Merge bitcoin/bitcoin#35001: validation: Remove stale BlockManager param from ContextualCheckBlockHeader

851152e42a validation: Remove stale BlockManager param in ContextualCheckBlockHeader (ismaelsadeeq)

Pull request description:

  The `BlockManager`  reference in `ContextualCheckBlockHeader`  is unused.

  Fix this by removing it from the function parameter list.
  Remove `BlockManager`  reference argument in `ContextualCheckBlockHeader` invocations.

ACKs for top commit:
  maflcko:
    lgtm ACK 851152e42a
  stratospher:
    ACK 851152e. not used anymore since checkpoints were removed in 3c5d1a4.

Tree-SHA512: 4d4c32cfc8c280774271ab1b5daff32b330030c3c4f275713836d7d2030c1842cab8a6f7758318fbe760c9158938a49d772246e1e328302ad2f8505e44e55695
This commit is contained in:
merge-script
2026-04-07 16:50:42 +08:00

View File

@@ -4077,7 +4077,7 @@ arith_uint256 CalculateClaimedHeadersWork(std::span<const CBlockHeader> headers)
* v0.12 and v0.15 (when no additional protection was in place) whereby an attacker could unboundedly
* grow our in-memory block index. See https://bitcoincore.org/en/2024/07/03/disclose-header-spam.
*/
static bool ContextualCheckBlockHeader(const CBlockHeader& block, BlockValidationState& state, BlockManager& blockman, const ChainstateManager& chainman, const CBlockIndex* pindexPrev) EXCLUSIVE_LOCKS_REQUIRED(::cs_main)
static bool ContextualCheckBlockHeader(const CBlockHeader& block, BlockValidationState& state, const ChainstateManager& chainman, const CBlockIndex* pindexPrev) EXCLUSIVE_LOCKS_REQUIRED(::cs_main)
{
AssertLockHeld(::cs_main);
assert(pindexPrev != nullptr);
@@ -4221,7 +4221,7 @@ bool ChainstateManager::AcceptBlockHeader(const CBlockHeader& block, BlockValida
LogDebug(BCLog::VALIDATION, "header %s has prev block invalid: %s\n", hash.ToString(), block.hashPrevBlock.ToString());
return state.Invalid(BlockValidationResult::BLOCK_INVALID_PREV, "bad-prevblk");
}
if (!ContextualCheckBlockHeader(block, state, m_blockman, *this, pindexPrev)) {
if (!ContextualCheckBlockHeader(block, state, *this, pindexPrev)) {
LogDebug(BCLog::VALIDATION, "%s: Consensus::ContextualCheckBlockHeader: %s, %s\n", __func__, hash.ToString(), state.ToString());
return false;
}
@@ -4502,7 +4502,7 @@ BlockValidationState TestBlockValidity(
* - do run ContextualCheckBlock()
*/
if (!ContextualCheckBlockHeader(block, state, chainstate.m_blockman, chainstate.m_chainman, tip)) {
if (!ContextualCheckBlockHeader(block, state, chainstate.m_chainman, tip)) {
if (state.IsValid()) NONFATAL_UNREACHABLE();
return state;
}