diff --git a/src/core_write.cpp b/src/core_write.cpp index 2edee784bb..a2cdf68aa4 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 409d24c879..9699375e18 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 cecaa6cbfb..ab424d442c 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; }