Skip to content

Commit

Permalink
fix: make 6336 compile in v21.1.x branch, using older CHECK_NONFATAL …
Browse files Browse the repository at this point in the history
…functionality
  • Loading branch information
PastaPastaPasta committed Oct 22, 2024
1 parent cd6598f commit a7bbcc8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/core_write.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<CAssetUnlockPayload>(tx))->getFee();
auto payload = GetTxPayload<CAssetUnlockPayload>(tx);
CHECK_NONFATAL(payload);
fee = payload->getFee();
}
CHECK_NONFATAL(MoneyRange(fee));
entry.pushKV("fee", ValueFromAmount(fee));
Expand Down
4 changes: 3 additions & 1 deletion src/rpc/blockchain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2453,7 +2453,9 @@ static RPCHelpMan getblockstats()
CAmount txfee = tx_total_in - tx_total_out;

if (tx->IsPlatformTransfer()) {
txfee = CHECK_NONFATAL(GetTxPayload<CAssetUnlockPayload>(*tx))->getFee();
auto payload = GetTxPayload<CAssetUnlockPayload>(*tx);
CHECK_NONFATAL(payload);
txfee = payload->getFee();
}

CHECK_NONFATAL(MoneyRange(txfee));
Expand Down
4 changes: 3 additions & 1 deletion src/rpc/masternode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,9 @@ static RPCHelpMan masternode_payments()
continue;
}
if (tx->IsPlatformTransfer()) {
nBlockFees += CHECK_NONFATAL(GetTxPayload<CAssetUnlockPayload>(*tx))->getFee();
auto payload = GetTxPayload<CAssetUnlockPayload>(*tx);
CHECK_NONFATAL(payload);
nBlockFees += payload->getFee();
continue;
}

Expand Down

0 comments on commit a7bbcc8

Please sign in to comment.