Merge 2f6dca4d1c into merged_master (Bitcoin PR bitcoin/bitcoin#30335)

This commit is contained in:
ikripaka 2026-03-03 11:17:26 +00:00
commit 916e3086b0
No known key found for this signature in database
3 changed files with 18 additions and 16 deletions

View file

@ -888,10 +888,17 @@ public:
return context()->mempool->GetTransactionsUpdated();
}
bool testBlockValidity(BlockValidationState& state, const CBlock& block, bool check_merkle_root) override
bool testBlockValidity(const CBlock& block, bool check_merkle_root, BlockValidationState& state) override
{
LOCK(::cs_main);
return TestBlockValidity(state, chainman().GetParams(), chainman().ActiveChainstate(), block, chainman().ActiveChain().Tip(), /*fCheckPOW=*/false, check_merkle_root);
LOCK(cs_main);
CBlockIndex* tip{chainman().ActiveChain().Tip()};
// Fail if the tip updated before the lock was taken
if (block.hashPrevBlock != tip->GetBlockHash()) {
state.Error("Block does not connect to current chain tip.");
return false;
}
return TestBlockValidity(state, chainman().GetParams(), chainman().ActiveChainstate(), block, tip, /*fCheckPOW=*/false, check_merkle_root);
}
std::unique_ptr<CBlockTemplate> createNewBlock(const CScript& script_pub_key, bool use_mempool) override
@ -899,7 +906,6 @@ public:
BlockAssembler::Options options;
ApplyArgsManOptions(gArgs, options);
LOCK(::cs_main);
return BlockAssembler{chainman().ActiveChainstate(), use_mempool ? context()->mempool.get() : nullptr, options}.CreateNewBlock(script_pub_key);
}