Skip to content

Commit

Permalink
fix: getblockstats rpc to work with withdrawal transactions
Browse files Browse the repository at this point in the history
  • Loading branch information
knst committed Oct 22, 2024
1 parent 96c9b46 commit ab7172b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/rpc/blockchain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit ab7172b

Please sign in to comment.