Browse Source

Make fReindex atomic to avoid race

0.16
MeshCollider 7 years ago
parent
commit
35aeabec62
  1. 4
      src/validation.cpp
  2. 2
      src/validation.h

4
src/validation.cpp

@ -66,7 +66,7 @@ CWaitableCriticalSection csBestBlock; @@ -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;
@ -3523,7 +3523,7 @@ bool static LoadBlockIndexDB(const CChainParams& chainparams) @@ -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);

2
src/validation.h

@ -167,7 +167,7 @@ extern const std::string strMessageMagic; @@ -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;

Loading…
Cancel
Save