Skip to content

Commit

Permalink
Make fReindex atomic to avoid race
Browse files Browse the repository at this point in the history
  • Loading branch information
meshcollider committed Sep 7, 2017
1 parent 58d91af commit 35aeabe
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/validation.cpp
Expand Up @@ -66,7 +66,7 @@ CWaitableCriticalSection csBestBlock;
CConditionVariable cvBlockChange;
int nScriptCheckThreads = 0;
std::atomic_bool fImporting(false);
bool fReindex = false;
std::atomic_bool fReindex(false);
bool fTxIndex = false;
bool fHavePruned = false;
bool fPruneMode = false;
Expand Down Expand Up @@ -3523,7 +3523,7 @@ bool static LoadBlockIndexDB(const CChainParams& chainparams)
// Check whether we need to continue reindexing
bool fReindexing = false;
pblocktree->ReadReindexing(fReindexing);
fReindex |= fReindexing;
if(fReindexing) fReindex = true;

// Check whether we have a transaction index
pblocktree->ReadFlag("txindex", fTxIndex);
Expand Down
2 changes: 1 addition & 1 deletion src/validation.h
Expand Up @@ -167,7 +167,7 @@ extern const std::string strMessageMagic;
extern CWaitableCriticalSection csBestBlock;
extern CConditionVariable cvBlockChange;
extern std::atomic_bool fImporting;
extern bool fReindex;
extern std::atomic_bool fReindex;
extern int nScriptCheckThreads;
extern bool fTxIndex;
extern bool fIsBareMultisigStd;
Expand Down

0 comments on commit 35aeabe

Please sign in to comment.