Skip to content

Commit 9169a50

Browse files
committed
[rpc] expose blockmintxfee via getmininginfo
1 parent 7b4a135 commit 9169a50

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

src/rpc/mining.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,7 @@ static RPCHelpMan getmininginfo()
429429
{RPCResult::Type::STR_HEX, "target", "The current target"},
430430
{RPCResult::Type::NUM, "networkhashps", "The network hashes per second"},
431431
{RPCResult::Type::NUM, "pooledtx", "The size of the mempool"},
432+
{RPCResult::Type::STR_AMOUNT, "blockmintxfee", "Minimum feerate of packages selected for block inclusion in " + CURRENCY_UNIT + "/kvB"},
432433
{RPCResult::Type::STR, "chain", "current network name (" LIST_CHAIN_NAMES ")"},
433434
{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)"},
434435
{RPCResult::Type::OBJ, "next", "The next block",
@@ -469,6 +470,9 @@ static RPCHelpMan getmininginfo()
469470
obj.pushKV("target", GetTarget(tip, chainman.GetConsensus().powLimit).GetHex());
470471
obj.pushKV("networkhashps", getnetworkhashps().HandleRequest(request));
471472
obj.pushKV("pooledtx", (uint64_t)mempool.size());
473+
BlockAssembler::Options assembler_options;
474+
ApplyArgsManOptions(*node.args, assembler_options);
475+
obj.pushKV("blockmintxfee", ValueFromAmount(assembler_options.blockMinFeeRate.GetFeePerK()));
472476
obj.pushKV("chain", chainman.GetParams().GetChainTypeString());
473477

474478
UniValue next(UniValue::VOBJ);

test/functional/mining_basic.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ def test_blockmintxfee_parameter(self):
153153
self.log.info(f"-> Test {blockmintxfee_parameter} ({blockmintxfee_sat_kvb} sat/kvB)...")
154154
self.restart_node(0, extra_args=[blockmintxfee_parameter, '-minrelaytxfee=0', '-persistmempool=0'])
155155
self.wallet.rescan_utxos() # to avoid spending outputs of txs that are not in mempool anymore after restart
156+
assert_equal(node.getmininginfo()['blockmintxfee'], blockmintxfee_btc_kvb)
156157

157158
# submit one tx with exactly the blockmintxfee rate, and one slightly below
158159
tx_with_min_feerate = self.wallet.send_self_transfer(from_node=node, fee_rate=blockmintxfee_btc_kvb, confirmed_only=True)

0 commit comments

Comments
 (0)