@@ -67,11 +67,11 @@ void RegenerateCommitments(CBlock& block, ChainstateManager& chainman)
6767
6868static BlockAssembler::Options ClampOptions (BlockAssembler::Options options)
6969{
70- Assert (options.coinbase_max_additional_weight <= DEFAULT_BLOCK_MAX_WEIGHT );
70+ Assert (options.block_reserved_weight <= MAX_BLOCK_WEIGHT );
7171 Assert (options.coinbase_output_max_additional_sigops <= MAX_BLOCK_SIGOPS_COST);
72- // Limit weight to between coinbase_max_additional_weight and DEFAULT_BLOCK_MAX_WEIGHT for sanity:
73- // Coinbase (reserved) outputs can safely exceed -blockmaxweight, but the rest of the block template will be empty.
74- options.nBlockMaxWeight = std::clamp<size_t >(options.nBlockMaxWeight , options.coinbase_max_additional_weight , DEFAULT_BLOCK_MAX_WEIGHT );
72+ // Limit weight to between block_reserved_weight and MAX_BLOCK_WEIGHT for sanity:
73+ // block_reserved_weight can safely exceed -blockmaxweight, but the rest of the block template will be empty.
74+ options.nBlockMaxWeight = std::clamp<size_t >(options.nBlockMaxWeight , options.block_reserved_weight , MAX_BLOCK_WEIGHT );
7575 return options;
7676}
7777
@@ -97,8 +97,8 @@ void BlockAssembler::resetBlock()
9797{
9898 inBlock.clear ();
9999
100- // Reserve space for coinbase tx
101- nBlockWeight = m_options.coinbase_max_additional_weight ;
100+ // Reserve space for fixed-size block header, txs count, and coinbase tx.
101+ nBlockWeight = m_options.block_reserved_weight ;
102102 nBlockSigOpsCost = m_options.coinbase_output_max_additional_sigops ;
103103
104104 // These counters do not include coinbase tx
@@ -386,7 +386,7 @@ void BlockAssembler::addPackageTxs(int& nPackagesSelected, int& nDescendantsUpda
386386 ++nConsecutiveFailed;
387387
388388 if (nConsecutiveFailed > MAX_CONSECUTIVE_FAILURES && nBlockWeight >
389- m_options.nBlockMaxWeight - m_options.coinbase_max_additional_weight ) {
389+ m_options.nBlockMaxWeight - m_options.block_reserved_weight ) {
390390 // Give up if we're close to full and haven't succeeded in a while
391391 break ;
392392 }
0 commit comments