Merge bitcoin/bitcoin#35403: mining: pr 33966 followups (disentangle miner startup defaults)

b847626562 test: refresh MiniWallet after node restart (Sjors Provoost)
f4e643cb15 test: merge mining options in package feerate check (Sjors Provoost)
280ce6a0ae miner: ensure block_max_weight is flattened before limit checks (Sjors Provoost)
65bd3164fb mining: clarify test_block_validity comment (Sjors Provoost)
978e7216e6 test: use shared default_ipc_timeout (Sjors Provoost)

Pull request description:

  This implement the suggested followups from #33966. Each commit links  to the original comment.

  The most important change is the extra asserts added in `miner: ensure block_max_weight is flattened before limit checks`.

ACKs for top commit:
  achow101:
    ACK b847626562
  enirox001:
    tACK b847626562
  sedited:
    ACK b847626562
  w0xlt:
    ACK b847626562

Tree-SHA512: 47678eaed604228269bd892ccf8ff58804745bbc7675b4a93528da9a9292a2eb1e0562cdb8341edac77178563420885b48282bb9e5c2b997b28f2fc64ceeff3d
This commit is contained in:
Ava Chow
2026-06-23 15:07:29 -07:00
4 changed files with 18 additions and 12 deletions

View File

@@ -245,7 +245,9 @@ std::unique_ptr<CBlockTemplate> BlockAssembler::CreateNewBlock()
bool BlockAssembler::TestChunkBlockLimits(FeePerWeight chunk_feerate, int64_t chunk_sigops_cost) const
{
if (nBlockWeight + chunk_feerate.size >= m_options.block_max_weight) {
// block_max_weight has been flattened before block assembly limit checks.
Assert(m_options.block_max_weight);
if (nBlockWeight + chunk_feerate.size >= *m_options.block_max_weight) {
return false;
}
if (nBlockSigOpsCost + chunk_sigops_cost >= MAX_BLOCK_SIGOPS_COST) {
@@ -318,8 +320,10 @@ void BlockAssembler::addChunks()
m_mempool->SkipBuilderChunk();
++nConsecutiveFailed;
// block_max_weight has been flattened before block assembly limit checks.
Assert(m_options.block_max_weight);
if (nConsecutiveFailed > MAX_CONSECUTIVE_FAILURES && nBlockWeight +
BLOCK_FULL_ENOUGH_WEIGHT_DELTA > m_options.block_max_weight) {
BLOCK_FULL_ENOUGH_WEIGHT_DELTA > *m_options.block_max_weight) {
// Give up if we're close to full and haven't succeeded in a while
return;
}

View File

@@ -86,7 +86,7 @@ struct BlockCreateOptions {
CScript coinbase_output_script{CScript() << OP_TRUE};
/**
* Whether to call TestBlockValidity() at the end of CreateNewBlock().
* Should only be used for tests / benchmarks.
* Should only be disabled for tests / benchmarks.
*/
bool test_block_validity{true};
};