From a7bbcc823d800b293e9ec54dff518fa9929c763c Mon Sep 17 00:00:00 2001 From: pasta Date: Tue, 22 Oct 2024 11:51:50 -0500 Subject: [PATCH] fix: make 6336 compile in v21.1.x branch, using older CHECK_NONFATAL functionality --- src/core_write.cpp | 4 +++- src/rpc/blockchain.cpp | 4 +++- src/rpc/masternode.cpp | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/core_write.cpp b/src/core_write.cpp index 2edee784bb050..a2cdf68aa4c0a 100644 --- a/src/core_write.cpp +++ b/src/core_write.cpp @@ -336,7 +336,9 @@ void TxToUniv(const CTransaction& tx, const uint256& hashBlock, bool include_add if (calculate_fee) { CAmount fee = amt_total_in - amt_total_out; if (tx.IsPlatformTransfer()) { - fee = CHECK_NONFATAL(GetTxPayload(tx))->getFee(); + auto payload = GetTxPayload(tx); + CHECK_NONFATAL(payload); + fee = payload->getFee(); } CHECK_NONFATAL(MoneyRange(fee)); entry.pushKV("fee", ValueFromAmount(fee)); diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp index 409d24c879d35..9699375e18939 100644 --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -2453,7 +2453,9 @@ static RPCHelpMan getblockstats() CAmount txfee = tx_total_in - tx_total_out; if (tx->IsPlatformTransfer()) { - txfee = CHECK_NONFATAL(GetTxPayload(*tx))->getFee(); + auto payload = GetTxPayload(*tx); + CHECK_NONFATAL(payload); + txfee = payload->getFee(); } CHECK_NONFATAL(MoneyRange(txfee)); diff --git a/src/rpc/masternode.cpp b/src/rpc/masternode.cpp index cecaa6cbfb55c..ab424d442c8c3 100644 --- a/src/rpc/masternode.cpp +++ b/src/rpc/masternode.cpp @@ -408,7 +408,9 @@ static RPCHelpMan masternode_payments() continue; } if (tx->IsPlatformTransfer()) { - nBlockFees += CHECK_NONFATAL(GetTxPayload(*tx))->getFee(); + auto payload = GetTxPayload(*tx); + CHECK_NONFATAL(payload); + nBlockFees += payload->getFee(); continue; }