0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-02-08 10:31:50 -05:00

validation: Remove global ::LoadGenesisBlock

This commit is contained in:
Carl Dong 2020-08-25 22:29:31 -04:00
parent 9da106be4d
commit 4927c9e699
3 changed files with 3 additions and 8 deletions

View file

@ -717,7 +717,7 @@ static void ThreadImport(ChainstateManager& chainman, std::vector<fs::path> vImp
fReindex = false; fReindex = false;
LogPrintf("Reindexing finished\n"); LogPrintf("Reindexing finished\n");
// To avoid ending up in a situation without genesis block, re-try initializing (no-op if reindexing worked): // To avoid ending up in a situation without genesis block, re-try initializing (no-op if reindexing worked):
LoadGenesisBlock(chainparams); ::ChainstateActive().LoadGenesisBlock(chainparams);
} }
// -loadblock= // -loadblock=
@ -1630,7 +1630,7 @@ bool AppInitMain(const util::Ref& context, NodeContext& node, interfaces::BlockA
// If we're not mid-reindex (based on disk + args), add a genesis block on disk // If we're not mid-reindex (based on disk + args), add a genesis block on disk
// (otherwise we use the one already on disk). // (otherwise we use the one already on disk).
// This is called again in ThreadImport after the reindex completes. // This is called again in ThreadImport after the reindex completes.
if (!fReindex && !LoadGenesisBlock(chainparams)) { if (!fReindex && !::ChainstateActive().LoadGenesisBlock(chainparams)) {
strLoadError = _("Error initializing block database"); strLoadError = _("Error initializing block database");
break; break;
} }

View file

@ -179,7 +179,7 @@ TestingSetup::TestingSetup(const std::string& chainName, const std::vector<const
assert(!::ChainstateActive().CanFlushToDisk()); assert(!::ChainstateActive().CanFlushToDisk());
::ChainstateActive().InitCoinsCache(1 << 23); ::ChainstateActive().InitCoinsCache(1 << 23);
assert(::ChainstateActive().CanFlushToDisk()); assert(::ChainstateActive().CanFlushToDisk());
if (!LoadGenesisBlock(chainparams)) { if (!::ChainstateActive().LoadGenesisBlock(chainparams)) {
throw std::runtime_error("LoadGenesisBlock failed."); throw std::runtime_error("LoadGenesisBlock failed.");
} }

View file

@ -4642,11 +4642,6 @@ bool CChainState::LoadGenesisBlock(const CChainParams& chainparams)
return true; return true;
} }
bool LoadGenesisBlock(const CChainParams& chainparams)
{
return ::ChainstateActive().LoadGenesisBlock(chainparams);
}
void CChainState::LoadExternalBlockFile(const CChainParams& chainparams, FILE* fileIn, FlatFilePos* dbp) void CChainState::LoadExternalBlockFile(const CChainParams& chainparams, FILE* fileIn, FlatFilePos* dbp)
{ {
// Map of disk positions for blocks with unknown parent (only used for reindex) // Map of disk positions for blocks with unknown parent (only used for reindex)