0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-02-10 10:52:31 -05:00

Make fReindex atomic to avoid race

This commit is contained in:
MeshCollider 2017-08-24 13:45:26 +12:00
parent 58d91af59e
commit 35aeabec62
2 changed files with 3 additions and 3 deletions

View file

@ -66,7 +66,7 @@ CWaitableCriticalSection csBestBlock;
CConditionVariable cvBlockChange; CConditionVariable cvBlockChange;
int nScriptCheckThreads = 0; int nScriptCheckThreads = 0;
std::atomic_bool fImporting(false); std::atomic_bool fImporting(false);
bool fReindex = false; std::atomic_bool fReindex(false);
bool fTxIndex = false; bool fTxIndex = false;
bool fHavePruned = false; bool fHavePruned = false;
bool fPruneMode = false; bool fPruneMode = false;
@ -3523,7 +3523,7 @@ bool static LoadBlockIndexDB(const CChainParams& chainparams)
// Check whether we need to continue reindexing // Check whether we need to continue reindexing
bool fReindexing = false; bool fReindexing = false;
pblocktree->ReadReindexing(fReindexing); pblocktree->ReadReindexing(fReindexing);
fReindex |= fReindexing; if(fReindexing) fReindex = true;
// Check whether we have a transaction index // Check whether we have a transaction index
pblocktree->ReadFlag("txindex", fTxIndex); pblocktree->ReadFlag("txindex", fTxIndex);

View file

@ -167,7 +167,7 @@ extern const std::string strMessageMagic;
extern CWaitableCriticalSection csBestBlock; extern CWaitableCriticalSection csBestBlock;
extern CConditionVariable cvBlockChange; extern CConditionVariable cvBlockChange;
extern std::atomic_bool fImporting; extern std::atomic_bool fImporting;
extern bool fReindex; extern std::atomic_bool fReindex;
extern int nScriptCheckThreads; extern int nScriptCheckThreads;
extern bool fTxIndex; extern bool fTxIndex;
extern bool fIsBareMultisigStd; extern bool fIsBareMultisigStd;