mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-08-01 02:54:22 +02:00
Merge bitcoin/bitcoin#35403: mining: pr 33966 followups (disentangle miner startup defaults)
b847626562test: refresh MiniWallet after node restart (Sjors Provoost)f4e643cb15test: merge mining options in package feerate check (Sjors Provoost)280ce6a0aeminer: ensure block_max_weight is flattened before limit checks (Sjors Provoost)65bd3164fbmining: clarify test_block_validity comment (Sjors Provoost)978e7216e6test: 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: ACKb847626562enirox001: tACKb847626562sedited: ACKb847626562w0xlt: ACKb847626562Tree-SHA512: 47678eaed604228269bd892ccf8ff58804745bbc7675b4a93528da9a9292a2eb1e0562cdb8341edac77178563420885b48282bb9e5c2b997b28f2fc64ceeff3d
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user