diff options
author | Carl Dong <contact@carldong.me> | 2020-08-25 22:29:31 -0400 |
---|---|---|
committer | Carl Dong <contact@carldong.me> | 2021-02-22 11:48:39 -0500 |
commit | 4927c9e6991b09a36a41aab93a0e05332d899611 (patch) | |
tree | 197ecaa52c0a437969aab1c1ea75201aeaf7eeb2 /src | |
parent | 9da106be4db692fa5db7b4de79f9cf7bfef37075 (diff) |
validation: Remove global ::LoadGenesisBlock
Diffstat (limited to 'src')
-rw-r--r-- | src/init.cpp | 4 | ||||
-rw-r--r-- | src/test/util/setup_common.cpp | 2 | ||||
-rw-r--r-- | src/validation.cpp | 5 |
3 files changed, 3 insertions, 8 deletions
diff --git a/src/init.cpp b/src/init.cpp index befba2eb2d..ea222f393e 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -717,7 +717,7 @@ static void ThreadImport(ChainstateManager& chainman, std::vector<fs::path> vImp fReindex = false; LogPrintf("Reindexing finished\n"); // To avoid ending up in a situation without genesis block, re-try initializing (no-op if reindexing worked): - LoadGenesisBlock(chainparams); + ::ChainstateActive().LoadGenesisBlock(chainparams); } // -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 // (otherwise we use the one already on disk). // This is called again in ThreadImport after the reindex completes. - if (!fReindex && !LoadGenesisBlock(chainparams)) { + if (!fReindex && !::ChainstateActive().LoadGenesisBlock(chainparams)) { strLoadError = _("Error initializing block database"); break; } diff --git a/src/test/util/setup_common.cpp b/src/test/util/setup_common.cpp index 1ffe435531..46b28190d3 100644 --- a/src/test/util/setup_common.cpp +++ b/src/test/util/setup_common.cpp @@ -179,7 +179,7 @@ TestingSetup::TestingSetup(const std::string& chainName, const std::vector<const assert(!::ChainstateActive().CanFlushToDisk()); ::ChainstateActive().InitCoinsCache(1 << 23); assert(::ChainstateActive().CanFlushToDisk()); - if (!LoadGenesisBlock(chainparams)) { + if (!::ChainstateActive().LoadGenesisBlock(chainparams)) { throw std::runtime_error("LoadGenesisBlock failed."); } diff --git a/src/validation.cpp b/src/validation.cpp index a57a1cc211..43b0698f01 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -4642,11 +4642,6 @@ bool CChainState::LoadGenesisBlock(const CChainParams& chainparams) return true; } -bool LoadGenesisBlock(const CChainParams& chainparams) -{ - return ::ChainstateActive().LoadGenesisBlock(chainparams); -} - void CChainState::LoadExternalBlockFile(const CChainParams& chainparams, FILE* fileIn, FlatFilePos* dbp) { // Map of disk positions for blocks with unknown parent (only used for reindex) |