mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-03 09:43:55 +02:00
miner: bugfix: fix duplicate weight reservation in block assembler
- This commit renamed coinbase_max_additional_weight to block_reserved_weight. - Also clarify that the reservation is for block header, transaction count and coinbase transaction.
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
|
||||
#include <node/miner.h>
|
||||
#include <node/mini_miner.h>
|
||||
#include <node/types.h>
|
||||
#include <primitives/transaction.h>
|
||||
#include <random.h>
|
||||
#include <txmempool.h>
|
||||
@@ -157,9 +158,10 @@ FUZZ_TARGET(mini_miner_selection, .init = initialize_miner)
|
||||
}
|
||||
}
|
||||
|
||||
// Stop if pool reaches DEFAULT_BLOCK_MAX_WEIGHT because BlockAssembler will stop when the
|
||||
const auto block_adjusted_max_weight = MAX_BLOCK_WEIGHT - DEFAULT_BLOCK_RESERVED_WEIGHT;
|
||||
// Stop if pool reaches block_adjusted_max_weight because BlockAssembler will stop when the
|
||||
// block template reaches that, but the MiniMiner will keep going.
|
||||
if (pool.GetTotalTxSize() + GetVirtualTransactionSize(*tx) >= DEFAULT_BLOCK_MAX_WEIGHT) break;
|
||||
if (pool.GetTotalTxSize() + GetVirtualTransactionSize(*tx) >= block_adjusted_max_weight) break;
|
||||
TestMemPoolEntryHelper entry;
|
||||
const CAmount fee{ConsumeMoney(fuzzed_data_provider, /*max=*/MAX_MONEY/100000)};
|
||||
assert(MoneyRange(fee));
|
||||
@@ -181,7 +183,7 @@ FUZZ_TARGET(mini_miner_selection, .init = initialize_miner)
|
||||
|
||||
node::BlockAssembler::Options miner_options;
|
||||
miner_options.blockMinFeeRate = target_feerate;
|
||||
miner_options.nBlockMaxWeight = DEFAULT_BLOCK_MAX_WEIGHT;
|
||||
miner_options.nBlockMaxWeight = MAX_BLOCK_WEIGHT;
|
||||
miner_options.test_block_validity = false;
|
||||
miner_options.coinbase_output_script = CScript() << OP_0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user