fix: make 6336 compile in v21.1.x branch, using older CHECK_NONFATAL functionality

This commit is contained in:
pasta 2024-10-22 11:51:50 -05:00
parent cd6598ff10
commit a7bbcc823d
No known key found for this signature in database
GPG Key ID: E2F3D7916E722D38
3 changed files with 9 additions and 3 deletions

View File

@ -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));

View File

@ -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));

View File

@ -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;
}