This commit is contained in:
Martin Zumsande 2025-01-08 20:43:01 +01:00 committed by GitHub
commit 151b36d253
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -5169,16 +5169,15 @@ void ChainstateManager::LoadExternalBlockFile(
}
// Activate the genesis block so normal node progress can continue
if (hash == params.GetConsensus().hashGenesisBlock) {
bool genesis_activation_failure = false;
for (auto c : GetAll()) {
BlockValidationState state;
if (!c->ActivateBestChain(state, nullptr)) {
genesis_activation_failure = true;
break;
}
}
if (genesis_activation_failure) {
// During first -reindex, this will only connect Genesis since
// ActivateBestChain only connects blocks which are in the block tree db,
// which only contains blocks whose parents are in it.
// But do this only if genesis isn't activated yet, to avoid connecting many blocks
// without assumevalid in the case of a continuation of a reindex that
// was interrupted by the user.
if (hash == params.GetConsensus().hashGenesisBlock && WITH_LOCK(::cs_main, return ActiveHeight()) == -1) {
BlockValidationState state;
if (!ActiveChainstate().ActivateBestChain(state, nullptr)) {
break;
}
}