Call FlushStateToDisk(...) regardless of fCheckForPruning

FlushStateToDisk(...) won't do anything besides check if we need to prune if
FLUSH_STATE_NONE is given. We avoid reading the variable fCheckForPruning
which is guarded by the mutex cs_LastBlockFile.
This commit is contained in:
practicalswift 2017-11-06 11:21:15 +01:00
parent 0a8054e7cd
commit 2311c7cc86

View file

@ -3454,8 +3454,7 @@ bool CChainState::AcceptBlock(const std::shared_ptr<const CBlock>& pblock, CVali
return AbortNode(state, std::string("System error: ") + e.what()); return AbortNode(state, std::string("System error: ") + e.what());
} }
if (fCheckForPruning) FlushStateToDisk(chainparams, state, FlushStateMode::NONE);
FlushStateToDisk(chainparams, state, FlushStateMode::NONE); // we just allocated more disk space for block files
CheckBlockIndex(chainparams.GetConsensus()); CheckBlockIndex(chainparams.GetConsensus());