mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-19 23:03:45 +01:00
blockstorage: make block read hash checks explicit
Dropped the default expected_hash parameter from `ReadBlock()`.
In `blockmanager_flush_block_file` tests, we pass {} since the tests would already fail at PoW validation for corrupted blocks.
In `ChainstateManager::LoadExternalBlockFile`, we pass {} when processing child blocks because their hashes aren't known beforehand.
This commit is contained in:
@@ -5168,14 +5168,14 @@ void ChainstateManager::LoadExternalBlockFile(
|
||||
while (range.first != range.second) {
|
||||
std::multimap<uint256, FlatFilePos>::iterator it = range.first;
|
||||
std::shared_ptr<CBlock> pblockrecursive = std::make_shared<CBlock>();
|
||||
if (m_blockman.ReadBlock(*pblockrecursive, it->second)) {
|
||||
LogDebug(BCLog::REINDEX, "%s: Processing out of order child %s of %s\n", __func__, pblockrecursive->GetHash().ToString(),
|
||||
head.ToString());
|
||||
if (m_blockman.ReadBlock(*pblockrecursive, it->second, {})) {
|
||||
const auto& block_hash{pblockrecursive->GetHash()};
|
||||
LogDebug(BCLog::REINDEX, "%s: Processing out of order child %s of %s", __func__, block_hash.ToString(), head.ToString());
|
||||
LOCK(cs_main);
|
||||
BlockValidationState dummy;
|
||||
if (AcceptBlock(pblockrecursive, dummy, nullptr, true, &it->second, nullptr, true)) {
|
||||
nLoaded++;
|
||||
queue.push_back(pblockrecursive->GetHash());
|
||||
queue.push_back(block_hash);
|
||||
}
|
||||
}
|
||||
range.first++;
|
||||
|
||||
Reference in New Issue
Block a user