refactor: Remove confusing BlockIndex global

This commit is contained in:
MarcoFalke
2020-06-29 10:30:03 -04:00
parent 8edfc1715a
commit fa0dfdf447
5 changed files with 22 additions and 32 deletions

View File

@@ -1589,7 +1589,7 @@ bool AppInitMain(const util::Ref& context, NodeContext& node)
// If the loaded chain has a wrong genesis, bail out immediately
// (we're likely using a testnet datadir, or the other way around).
if (!::BlockIndex().empty() &&
if (!chainman.BlockIndex().empty() &&
!LookupBlockIndex(chainparams.GetConsensus().hashGenesisBlock)) {
return InitError(_("Incorrect or no genesis block found. Wrong datadir for network?"));
}
@@ -1869,8 +1869,8 @@ bool AppInitMain(const util::Ref& context, NodeContext& node)
//// debug print
{
LOCK(cs_main);
LogPrintf("block tree size = %u\n", ::BlockIndex().size());
chain_active_height = ::ChainActive().Height();
LogPrintf("block tree size = %u\n", chainman.BlockIndex().size());
chain_active_height = chainman.ActiveChain().Height();
}
LogPrintf("nBestHeight = %d\n", chain_active_height);