fix: getblockstats rpc to work with withdrawal transactions

This commit is contained in:
Konstantin Akimov 2024-10-22 19:20:49 +07:00
parent 96c9b469ca
commit ab7172bc8f
No known key found for this signature in database
GPG Key ID: 2176C4A5D01EA524

View File

@ -49,6 +49,7 @@
#include <versionbits.h>
#include <warnings.h>
#include <evo/assetlocktx.h>
#include <evo/cbtx.h>
#include <evo/evodb.h>
#include <evo/mnhftx.h>
@ -2450,6 +2451,11 @@ static RPCHelpMan getblockstats()
}
CAmount txfee = tx_total_in - tx_total_out;
if (tx->nType == TRANSACTION_ASSET_UNLOCK) {
txfee = CHECK_NONFATAL(GetTxPayload<CAssetUnlockPayload>(*tx))->getFee();
}
CHECK_NONFATAL(MoneyRange(txfee));
if (do_medianfee) {
fee_array.push_back(txfee);