mining: drop unused include_dummy_extranonce option
What changed, and why it matters
This commit is a routine cleanup: it removes an option called include_dummy_extranonce that no longer does anything. The previous commit already made the block-building code ignore this flag, so this change only deletes leftover references in tests, benchmarks, RPC code, and fuzz targets. There is no security-relevant behavior change.
No security action needed. This is a non-functional cleanup commit.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit deletes the include_dummy_extranonce field from BlockCreateOptions (src/node/types.h) and removes all assignments to it across RPC mining code, benchmarks, unit tests, and fuzz harnesses. The commit message explicitly states the flag was already ignored by CreateNewBlock() after the preceding commit, so this is purely dead-code removal with no functional change to block template generation.
Changed components
src/node/types.hsrc/rpc/mining.cppsrc/bench/block_assemble.cppsrc/test/*Inspect captured patch +3 / −32
diff --git a/src/bench/block_assemble.cpp b/src/bench/block_assemble.cpp
index 702f2c09..297465be 100644
--- a/src/bench/block_assemble.cpp
+++ b/src/bench/block_assemble.cpp
@@ -30,7 +30,6 @@ static void AssembleBlock(benchmark::Bench& bench)
witness.stack.push_back(WITNESS_STACK_ELEM_OP_TRUE);
BlockAssembler::Options options;
options.coinbase_output_script = P2WSH_OP_TRUE;
- options.include_dummy_extranonce = true;
// Collect some loose transactions that spend the coinbases of our mined blocks
constexpr size_t NUM_BLOCKS{200};
diff --git a/src/node/types.h b/src/node/types.h
index f0debd45..d228fa41 100644
--- a/src/node/types.h
+++ b/src/node/types.h
@@ -72,15 +72,6 @@ struct BlockCreateOptions {
* coinbase_max_additional_weight and coinbase_output_max_additional_sigops.
*/
CScript coinbase_output_script{CScript() << OP_TRUE};
- /**
- * Whether to include an OP_0 as a dummy extraNonce in the template's coinbase
- *
- * This option is ignored and no longer has any effect.
- *
- * TODO: this can be dropped after regenerating hardcoded block and transaction
- * hashes in the test suite.
- */
- bool include_dummy_extranonce{false};
};
struct BlockWaitOptions {
diff --git a/src/rpc/mining.cpp b/src/rpc/mining.cpp
index dcf5ee26..223569fd 100644
--- a/src/rpc/mining.cpp
+++ b/src/rpc/mining.cpp
@@ -165,7 +165,7 @@ static UniValue generateBlocks(ChainstateManager& chainman, Mining& miner, const
{
UniValue blockHashes(UniValue::VARR);
while (nGenerate > 0 && !chainman.m_interrupt) {
- std::unique_ptr<BlockTemplate> block_template(miner.createNewBlock({ .coinbase_output_script = coinbase_output_script, .include_dummy_extranonce = true }, /*cooldown=*/false));
+ std::unique_ptr<BlockTemplate> block_template(miner.createNewBlock({ .coinbase_output_script = coinbase_output_script }, /*cooldown=*/false));
CHECK_NONFATAL(block_template);
std::shared_ptr<const CBlock> block_out;
@@ -377,7 +377,7 @@ static RPCMethod generateblock()
{
LOCK(chainman.GetMutex());
{
- std::unique_ptr<BlockTemplate> block_template{miner.createNewBlock({.use_mempool = false, .coinbase_output_script = coinbase_output_script, .include_dummy_extranonce = true}, /*cooldown=*/false)};
+ std::unique_ptr<BlockTemplate> block_template{miner.createNewBlock({.use_mempool = false, .coinbase_output_script = coinbase_output_script}, /*cooldown=*/false)};
CHECK_NONFATAL(block_template);
block = block_template->getBlock();
@@ -875,7 +875,7 @@ static RPCMethod getblocktemplate()
// a delay to each getblocktemplate call. This differs from typical
// long-lived IPC usage, where the overhead is paid only when creating
// the initial template.
- block_template = miner.createNewBlock({.include_dummy_extranonce = true}, /*cooldown=*/false);
+ block_template = miner.createNewBlock({}, /*cooldown=*/false);
CHECK_NONFATAL(block_template);
diff --git a/src/test/blockfilter_index_tests.cpp b/src/test/blockfilter_index_tests.cpp
index 10e4ffa4..b77942f7 100644
--- a/src/test/blockfilter_index_tests.cpp
+++ b/src/test/blockfilter_index_tests.cpp
@@ -71,7 +71,6 @@ CBlock BuildChainTestingSetup::CreateBlock(const CBlockIndex* prev,
{
BlockAssembler::Options options;
options.coinbase_output_script = scriptPubKey;
- options.include_dummy_extranonce = true;
std::unique_ptr<CBlockTemplate> pblocktemplate = BlockAssembler{m_node.chainman->ActiveChainstate(), m_node.mempool.get(), options}.CreateNewBlock();
CBlock& block = pblocktemplate->block;
block.hashPrevBlock = prev->GetBlockHash();
diff --git a/src/test/fuzz/cmpctblock.cpp b/src/test/fuzz/cmpctblock.cpp
index 3e4268cb..646a3ce0 100644
--- a/src/test/fuzz/cmpctblock.cpp
+++ b/src/test/fuzz/cmpctblock.cpp
@@ -121,7 +121,6 @@ void ResetChainmanAndMempool(TestingSetup& setup)
node::BlockAssembler::Options options;
options.coinbase_output_script = P2WSH_OP_TRUE;
- options.include_dummy_extranonce = true;
g_mature_coinbase.clear();
diff --git a/src/test/fuzz/package_eval.cpp b/src/test/fuzz/package_eval.cpp
index 93cd8ad6..1cc2caa3 100644
--- a/src/test/fuzz/package_eval.cpp
+++ b/src/test/fuzz/package_eval.cpp
@@ -46,7 +46,6 @@ void initialize_tx_pool()
BlockAssembler::Options options;
options.coinbase_output_script = P2WSH_EMPTY;
- options.include_dummy_extranonce = true;
for (int i = 0; i < 2 * COINBASE_MATURITY; ++i) {
COutPoint prevout{MineBlock(g_setup->m_node, options)};
diff --git a/src/test/fuzz/process_message.cpp b/src/test/fuzz/process_message.cpp
index 5f54857e..d8a91d7f 100644
--- a/src/test/fuzz/process_message.cpp
+++ b/src/test/fuzz/process_message.cpp
@@ -43,7 +43,6 @@ void ResetChainman(TestingSetup& setup)
setup.LoadVerifyActivateChainstate();
for (int i = 0; i < 2 * COINBASE_MATURITY; i++) {
node::BlockAssembler::Options options;
- options.include_dummy_extranonce = true;
MineBlock(setup.m_node, options);
}
}
diff --git a/src/test/fuzz/process_messages.cpp b/src/test/fuzz/process_messages.cpp
index 9f33b0df..314388fa 100644
--- a/src/test/fuzz/process_messages.cpp
+++ b/src/test/fuzz/process_messages.cpp
@@ -37,7 +37,6 @@ void ResetChainman(TestingSetup& setup)
setup.m_make_chainman();
setup.LoadVerifyActivateChainstate();
node::BlockAssembler::Options options;
- options.include_dummy_extranonce = true;
for (int i = 0; i < 2 * COINBASE_MATURITY; i++) {
MineBlock(setup.m_node, options);
}
diff --git a/src/test/fuzz/tx_pool.cpp b/src/test/fuzz/tx_pool.cpp
index bb155527..f70dd710 100644
--- a/src/test/fuzz/tx_pool.cpp
+++ b/src/test/fuzz/tx_pool.cpp
@@ -48,7 +48,6 @@ void initialize_tx_pool()
BlockAssembler::Options options;
options.coinbase_output_script = P2WSH_OP_TRUE;
- options.include_dummy_extranonce = true;
for (int i = 0; i < 2 * COINBASE_MATURITY; ++i) {
COutPoint prevout{MineBlock(g_setup->m_node, options)};
@@ -98,7 +97,6 @@ void Finish(FuzzedDataProvider& fuzzed_data_provider, MockedTxPool& tx_pool, Cha
BlockAssembler::Options options;
options.nBlockMaxWeight = fuzzed_data_provider.ConsumeIntegralInRange(0U, MAX_BLOCK_WEIGHT);
options.blockMinFeeRate = CFeeRate{ConsumeMoney(fuzzed_data_provider, /*max=*/COIN)};
- options.include_dummy_extranonce = true;
auto assembler = BlockAssembler{chainstate, &tx_pool, options};
auto block_template = assembler.CreateNewBlock();
Assert(block_template->block.vtx.size() >= 1);
diff --git a/src/test/fuzz/utxo_total_supply.cpp b/src/test/fuzz/utxo_total_supply.cpp
index 9e7ee205..b281f200 100644
--- a/src/test/fuzz/utxo_total_supply.cpp
+++ b/src/test/fuzz/utxo_total_supply.cpp
@@ -46,7 +46,6 @@ FUZZ_TARGET(utxo_total_supply)
};
BlockAssembler::Options options;
options.coinbase_output_script = CScript() << OP_FALSE;
- options.include_dummy_extranonce = true;
const auto PrepareNextBlock = [&]() {
// Use OP_FALSE to avoid BIP30 check from hitting early
auto block = PrepareBlock(node, options);
diff --git a/src/test/miner_tests.cpp b/src/test/miner_tests.cpp
index 6b4e85a5..124ef085 100644
--- a/src/test/miner_tests.cpp
+++ b/src/test/miner_tests.cpp
@@ -117,7 +117,6 @@ void MinerTestingSetup::TestPackageSelection(const CScript& scriptPubKey, const
auto mining{MakeMining()};
BlockAssembler::Options options;
options.coinbase_output_script = scriptPubKey;
- options.include_dummy_extranonce = true;
LOCK(tx_mempool.cs);
BOOST_CHECK(tx_mempool.size() == 0);
@@ -336,7 +335,6 @@ void MinerTestingSetup::TestBasicMining(const CScript& scriptPubKey, const std::
BlockAssembler::Options options;
options.coinbase_output_script = scriptPubKey;
- options.include_dummy_extranonce = true;
{
CTxMemPool& tx_mempool{MakeMempool()};
@@ -663,7 +661,6 @@ void MinerTestingSetup::TestPrioritisedMining(const CScript& scriptPubKey, const
BlockAssembler::Options options;
options.coinbase_output_script = scriptPubKey;
- options.include_dummy_extranonce = true;
CTxMemPool& tx_mempool{MakeMempool()};
LOCK(tx_mempool.cs);
@@ -753,7 +750,6 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
CScript scriptPubKey = CScript() << "04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f"_hex << OP_CHECKSIG;
BlockAssembler::Options options;
options.coinbase_output_script = scriptPubKey;
- options.include_dummy_extranonce = true;
// Create and check a simple template
std::unique_ptr<BlockTemplate> block_template = mining->createNewBlock(options, /*cooldown=*/false);
diff --git a/src/test/peerman_tests.cpp b/src/test/peerman_tests.cpp
index e391e8b9..36a66b14 100644
--- a/src/test/peerman_tests.cpp
+++ b/src/test/peerman_tests.cpp
@@ -20,7 +20,6 @@ static void mineBlock(const node::NodeContext& node, std::chrono::seconds block_
{
auto curr_time = GetTime<std::chrono::seconds>();
node::BlockAssembler::Options options;
- options.include_dummy_extranonce = true;
SetMockTime(block_time); // update time so the block is created with it
CBlock block = node::BlockAssembler{node.chainman->ActiveChainstate(), nullptr, options}.CreateNewBlock()->block;
while (!CheckProofOfWork(block.GetHash(), block.nBits, node.chainman->GetConsensus())) ++block.nNonce;
diff --git a/src/test/testnet4_miner_tests.cpp b/src/test/testnet4_miner_tests.cpp
index 1bfc19db..c501b4eb 100644
--- a/src/test/testnet4_miner_tests.cpp
+++ b/src/test/testnet4_miner_tests.cpp
@@ -36,7 +36,6 @@ BOOST_AUTO_TEST_CASE(MiningInterface)
BOOST_REQUIRE(mining);
BlockAssembler::Options options;
- options.include_dummy_extranonce = true;
std::unique_ptr<BlockTemplate> block_template;
// Set node time a few minutes past the testnet4 genesis block
diff --git a/src/test/util/mining.cpp b/src/test/util/mining.cpp
index c4823bce..05f1be77 100644
--- a/src/test/util/mining.cpp
+++ b/src/test/util/mining.cpp
@@ -29,7 +29,6 @@ COutPoint generatetoaddress(const NodeContext& node, const std::string& address)
assert(IsValidDestination(dest));
BlockAssembler::Options assembler_options;
assembler_options.coinbase_output_script = GetScriptForDestination(dest);
- assembler_options.include_dummy_extranonce = true;
return MineBlock(node, assembler_options);
}
@@ -140,7 +139,6 @@ std::shared_ptr<CBlock> PrepareBlock(const NodeContext& node, const CScript& coi
{
BlockAssembler::Options assembler_options;
assembler_options.coinbase_output_script = coinbase_scriptPubKey;
- assembler_options.include_dummy_extranonce = true;
ApplyArgsManOptions(*node.args, assembler_options);
return PrepareBlock(node, assembler_options);
}
diff --git a/src/test/util/setup_common.cpp b/src/test/util/setup_common.cpp
index c9511908..f924a0e8 100644
--- a/src/test/util/setup_common.cpp
+++ b/src/test/util/setup_common.cpp
@@ -412,7 +412,6 @@ CBlock TestChain100Setup::CreateBlock(
{
BlockAssembler::Options options;
options.coinbase_output_script = scriptPubKey;
- options.include_dummy_extranonce = true;
CBlock block = BlockAssembler{chainstate, nullptr, options}.CreateNewBlock()->block;
Assert(block.vtx.size() == 1);
diff --git a/src/test/validation_block_tests.cpp b/src/test/validation_block_tests.cpp
index 083a32da..e1f90477 100644
--- a/src/test/validation_block_tests.cpp
+++ b/src/test/validation_block_tests.cpp
@@ -69,7 +69,6 @@ std::shared_ptr<CBlock> MinerTestingSetup::Block(const uint256& prev_hash)
BlockAssembler::Options options;
options.coinbase_output_script = CScript{} << i++ << OP_TRUE;
- options.include_dummy_extranonce = true;
auto ptemplate = BlockAssembler{m_node.chainman->ActiveChainstate(), m_node.mempool.get(), options}.CreateNewBlock();
auto pblock = std::make_shared<CBlock>(ptemplate->block);
pblock->hashPrevBlock = prev_hash;
@@ -338,7 +337,6 @@ BOOST_AUTO_TEST_CASE(witness_commitment_index)
pubKey << 1 << OP_TRUE;
BlockAssembler::Options options;
options.coinbase_output_script = pubKey;
- options.include_dummy_extranonce = true;
auto ptemplate = BlockAssembler{m_node.chainman->ActiveChainstate(), m_node.mempool.get(), options}.CreateNewBlock();
CBlock pblock = ptemplate->block;
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.