Explicitly pass const CChainParams& to LoadBlockIndexDB()

This commit is contained in:
Geoffrey Tsui 2016-10-25 22:35:26 +08:00
parent 9bdf5269f8
commit d0b01f3a85
3 changed files with 5 additions and 6 deletions

View file

@ -1320,7 +1320,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
CleanupBlockRevFiles(); CleanupBlockRevFiles();
} }
if (!LoadBlockIndex()) { if (!LoadBlockIndex(chainparams)) {
strLoadError = _("Error loading block database"); strLoadError = _("Error loading block database");
break; break;
} }

View file

@ -3966,9 +3966,8 @@ CBlockIndex * InsertBlockIndex(uint256 hash)
return pindexNew; return pindexNew;
} }
bool static LoadBlockIndexDB() bool static LoadBlockIndexDB(const CChainParams& chainparams)
{ {
const CChainParams& chainparams = Params();
if (!pblocktree->LoadBlockIndexGuts(InsertBlockIndex)) if (!pblocktree->LoadBlockIndexGuts(InsertBlockIndex))
return false; return false;
@ -4297,10 +4296,10 @@ void UnloadBlockIndex()
fHavePruned = false; fHavePruned = false;
} }
bool LoadBlockIndex() bool LoadBlockIndex(const CChainParams& chainparams)
{ {
// Load block index from databases // Load block index from databases
if (!fReindex && !LoadBlockIndexDB()) if (!fReindex && !LoadBlockIndexDB(chainparams))
return false; return false;
return true; return true;
} }

View file

@ -237,7 +237,7 @@ bool LoadExternalBlockFile(const CChainParams& chainparams, FILE* fileIn, CDiskB
/** Initialize a new block tree database + block data on disk */ /** Initialize a new block tree database + block data on disk */
bool InitBlockIndex(const CChainParams& chainparams); bool InitBlockIndex(const CChainParams& chainparams);
/** Load the block tree and coins database from disk */ /** Load the block tree and coins database from disk */
bool LoadBlockIndex(); bool LoadBlockIndex(const CChainParams& chainparams);
/** Unload database information */ /** Unload database information */
void UnloadBlockIndex(); void UnloadBlockIndex();
/** Run an instance of the script checking thread */ /** Run an instance of the script checking thread */