Browse Source

Merge #9013: Trivial: Explicitly pass const CChainParams& to LoadBlockIndexDB()

d0b01f3 Explicitly pass const CChainParams& to LoadBlockIndexDB() (Geoffrey Tsui)
0.14
Wladimir J. van der Laan 8 years ago
parent
commit
c05db83488
No known key found for this signature in database
GPG Key ID: 74810B012346C9A6
  1. 2
      src/init.cpp
  2. 7
      src/main.cpp
  3. 2
      src/main.h

2
src/init.cpp

@ -1323,7 +1323,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;
} }

7
src/main.cpp

@ -3972,9 +3972,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;
@ -4303,10 +4302,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;
} }

2
src/main.h

@ -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 */

Loading…
Cancel
Save