mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-24 18:23:26 -03:00
Merge c9136ca906
into 66aa6a47bd
This commit is contained in:
commit
151b36d253
1 changed files with 9 additions and 10 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue