Skip to content

Commit a7bbcc8

Browse files
fix: make 6336 compile in v21.1.x branch, using older CHECK_NONFATAL functionality
1 parent cd6598f commit a7bbcc8

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

src/core_write.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,9 @@ void TxToUniv(const CTransaction& tx, const uint256& hashBlock, bool include_add
336336
if (calculate_fee) {
337337
CAmount fee = amt_total_in - amt_total_out;
338338
if (tx.IsPlatformTransfer()) {
339-
fee = CHECK_NONFATAL(GetTxPayload<CAssetUnlockPayload>(tx))->getFee();
339+
auto payload = GetTxPayload<CAssetUnlockPayload>(tx);
340+
CHECK_NONFATAL(payload);
341+
fee = payload->getFee();
340342
}
341343
CHECK_NONFATAL(MoneyRange(fee));
342344
entry.pushKV("fee", ValueFromAmount(fee));

src/rpc/blockchain.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2453,7 +2453,9 @@ static RPCHelpMan getblockstats()
24532453
CAmount txfee = tx_total_in - tx_total_out;
24542454

24552455
if (tx->IsPlatformTransfer()) {
2456-
txfee = CHECK_NONFATAL(GetTxPayload<CAssetUnlockPayload>(*tx))->getFee();
2456+
auto payload = GetTxPayload<CAssetUnlockPayload>(*tx);
2457+
CHECK_NONFATAL(payload);
2458+
txfee = payload->getFee();
24572459
}
24582460

24592461
CHECK_NONFATAL(MoneyRange(txfee));

src/rpc/masternode.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,9 @@ static RPCHelpMan masternode_payments()
408408
continue;
409409
}
410410
if (tx->IsPlatformTransfer()) {
411-
nBlockFees += CHECK_NONFATAL(GetTxPayload<CAssetUnlockPayload>(*tx))->getFee();
411+
auto payload = GetTxPayload<CAssetUnlockPayload>(*tx);
412+
CHECK_NONFATAL(payload);
413+
nBlockFees += payload->getFee();
412414
continue;
413415
}
414416

0 commit comments

Comments
 (0)