From 777434a2cd14841e35ce39d7a6f51131e6a41de2 Mon Sep 17 00:00:00 2001 From: ismaelsadeeq Date: Mon, 3 Feb 2025 12:47:59 -0500 Subject: [PATCH] doc: rpc: improve `getmininginfo` help text - The reserved weight of the coinbase transaction is an estimate and may not reflect the exact value; it can be lower. - It should be clear that `currentblockweight` includes the reserved coinbase transaction weight. whereas `currentblocktx` does not account for the coinbase transaction count. - Also clarify `m_last_block_num_txs` and `m_last_block_weight` --- src/node/miner.h | 2 ++ src/rpc/mining.cpp | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/node/miner.h b/src/node/miner.h index 3c4c66b0bad..18e19ea158d 100644 --- a/src/node/miner.h +++ b/src/node/miner.h @@ -176,7 +176,9 @@ public: /** Construct a new block template */ std::unique_ptr CreateNewBlock(); + /** The number of transactions in the last assembled block (excluding coinbase transaction) */ inline static std::optional m_last_block_num_txs{}; + /** The weight of the last assembled block (including reserved weight for block header, txs count and coinbase tx) */ inline static std::optional m_last_block_weight{}; private: diff --git a/src/rpc/mining.cpp b/src/rpc/mining.cpp index 5e3d1120e32..702925785bf 100644 --- a/src/rpc/mining.cpp +++ b/src/rpc/mining.cpp @@ -419,8 +419,8 @@ static RPCHelpMan getmininginfo() RPCResult::Type::OBJ, "", "", { {RPCResult::Type::NUM, "blocks", "The current block"}, - {RPCResult::Type::NUM, "currentblockweight", /*optional=*/true, "The block weight of the last assembled block (only present if a block was ever assembled)"}, - {RPCResult::Type::NUM, "currentblocktx", /*optional=*/true, "The number of block transactions of the last assembled block (only present if a block was ever assembled)"}, + {RPCResult::Type::NUM, "currentblockweight", /*optional=*/true, "The block weight (including reserved weight for block header, txs count and coinbase tx) of the last assembled block (only present if a block was ever assembled)"}, + {RPCResult::Type::NUM, "currentblocktx", /*optional=*/true, "The number of block transactions (excluding coinbase) of the last assembled block (only present if a block was ever assembled)"}, {RPCResult::Type::STR_HEX, "bits", "The current nBits, compact representation of the block difficulty target"}, {RPCResult::Type::NUM, "difficulty", "The current difficulty"}, {RPCResult::Type::STR_HEX, "target", "The current target"},