mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 04:22:55 +01:00
Merge #11617: Avoid lock: Call FlushStateToDisk(...) regardless of fCheckForPruning
0000d8f
Document how FlushStateMode::NONE is handled (practicalswift)2311c7c
Call FlushStateToDisk(...) regardless of fCheckForPruning (practicalswift) Pull request description: 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. Tree-SHA512: 89df06256f73503a74b9e26d580ce9ed09efaef347fae1ff6a5759a2993b0db52edd2fadb65694d27e579a5aed92127753bdf41b5bb1bd516e577fcf17f17999
This commit is contained in:
commit
1b5723ee57
@ -2064,6 +2064,9 @@ bool CChainState::ConnectBlock(const CBlock& block, CValidationState& state, CBl
|
||||
* The caches and indexes are flushed depending on the mode we're called with
|
||||
* if they're too large, if it's been a while since the last write,
|
||||
* or always and in all cases if we're in prune mode and are deleting files.
|
||||
*
|
||||
* If FlushStateMode::NONE is used, then FlushStateToDisk(...) won't do anything
|
||||
* besides checking if we need to prune.
|
||||
*/
|
||||
bool static FlushStateToDisk(const CChainParams& chainparams, CValidationState &state, FlushStateMode mode, int nManualPruneHeight) {
|
||||
int64_t nMempoolUsage = mempool.DynamicMemoryUsage();
|
||||
@ -3454,8 +3457,7 @@ bool CChainState::AcceptBlock(const std::shared_ptr<const CBlock>& pblock, CVali
|
||||
return AbortNode(state, std::string("System error: ") + e.what());
|
||||
}
|
||||
|
||||
if (fCheckForPruning)
|
||||
FlushStateToDisk(chainparams, state, FlushStateMode::NONE); // we just allocated more disk space for block files
|
||||
FlushStateToDisk(chainparams, state, FlushStateMode::NONE);
|
||||
|
||||
CheckBlockIndex(chainparams.GetConsensus());
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user