[block encodings] Make CheckBlock mockable for PartiallyDownloadedBlock

This commit is contained in:
dergoegge
2023-01-16 16:13:52 +01:00
parent dbca00ef76
commit 1429f83770
2 changed files with 12 additions and 1 deletions

View File

@@ -197,7 +197,8 @@ ReadStatus PartiallyDownloadedBlock::FillBlock(CBlock& block, const std::vector<
return READ_STATUS_INVALID;
BlockValidationState state;
if (!CheckBlock(block, state, Params().GetConsensus())) {
CheckBlockFn check_block = m_check_block_mock ? m_check_block_mock : CheckBlock;
if (!check_block(block, state, Params().GetConsensus(), /*fCheckPoW=*/true, /*fCheckMerkleRoot=*/true)) {
// TODO: We really want to just check merkle tree manually here,
// but that is expensive, and CheckBlock caches a block's
// "checked-status" (in the CBlock?). CBlock should be able to