[rpc] expose blockmintxfee via getmininginfo
What changed, and why it matters
This commit simply adds a new read-only field called 'blockmintxfee' to the output of the getmininginfo RPC command. It exposes an existing configuration setting through the API so users can query it remotely. There is no security issue here.
No action required. This is a benign RPC information exposure change.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The change adds one line to the getmininginfo help documentation and three lines of C++ code that read the node’s configured blockMinFeeRate and return it as a JSON value. A corresponding functional test asserts that the returned value matches the configured value. No logic is modified; the value is read-only and already configurable via command-line arguments.
Changed components
src/rpc/mining.cpptest/functional/mining_basic.pyInspect captured patch +5 / −0
diff --git a/src/rpc/mining.cpp b/src/rpc/mining.cpp
index c66b6c19..e0e35569 100644
--- a/src/rpc/mining.cpp
+++ b/src/rpc/mining.cpp
@@ -429,6 +429,7 @@ static RPCHelpMan getmininginfo()
{RPCResult::Type::STR_HEX, "target", "The current target"},
{RPCResult::Type::NUM, "networkhashps", "The network hashes per second"},
{RPCResult::Type::NUM, "pooledtx", "The size of the mempool"},
+ {RPCResult::Type::STR_AMOUNT, "blockmintxfee", "Minimum feerate of packages selected for block inclusion in " + CURRENCY_UNIT + "/kvB"},
{RPCResult::Type::STR, "chain", "current network name (" LIST_CHAIN_NAMES ")"},
{RPCResult::Type::STR_HEX, "signet_challenge", /*optional=*/true, "The block challenge (aka. block script), in hexadecimal (only present if the current network is a signet)"},
{RPCResult::Type::OBJ, "next", "The next block",
@@ -469,6 +470,9 @@ static RPCHelpMan getmininginfo()
obj.pushKV("target", GetTarget(tip, chainman.GetConsensus().powLimit).GetHex());
obj.pushKV("networkhashps", getnetworkhashps().HandleRequest(request));
obj.pushKV("pooledtx", (uint64_t)mempool.size());
+ BlockAssembler::Options assembler_options;
+ ApplyArgsManOptions(*node.args, assembler_options);
+ obj.pushKV("blockmintxfee", ValueFromAmount(assembler_options.blockMinFeeRate.GetFeePerK()));
obj.pushKV("chain", chainman.GetParams().GetChainTypeString());
UniValue next(UniValue::VOBJ);
diff --git a/test/functional/mining_basic.py b/test/functional/mining_basic.py
index 4683919d..4f104359 100755
--- a/test/functional/mining_basic.py
+++ b/test/functional/mining_basic.py
@@ -153,6 +153,7 @@ class MiningTest(BitcoinTestFramework):
self.log.info(f"-> Test {blockmintxfee_parameter} ({blockmintxfee_sat_kvb} sat/kvB)...")
self.restart_node(0, extra_args=[blockmintxfee_parameter, '-minrelaytxfee=0', '-persistmempool=0'])
self.wallet.rescan_utxos() # to avoid spending outputs of txs that are not in mempool anymore after restart
+ assert_equal(node.getmininginfo()['blockmintxfee'], blockmintxfee_btc_kvb)
# submit one tx with exactly the blockmintxfee rate, and one slightly below
tx_with_min_feerate = self.wallet.send_self_transfer(from_node=node, fee_rate=blockmintxfee_btc_kvb, confirmed_only=True)
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.