From ab7172bc8f0197d278ab1e4d94aa0dc66ef18f3a Mon Sep 17 00:00:00 2001 From: Konstantin Akimov Date: Tue, 22 Oct 2024 19:20:49 +0700 Subject: [PATCH] fix: getblockstats rpc to work with withdrawal transactions --- src/rpc/blockchain.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp index 411d6cb75d..fe44b5f2c3 100644 --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -49,6 +49,7 @@ #include #include +#include #include #include #include @@ -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(*tx))->getFee(); + } + CHECK_NONFATAL(MoneyRange(txfee)); if (do_medianfee) { fee_array.push_back(txfee);