changed flush to have min height
don't flush blocks on regtest
This commit is contained in:
parent
f05b5973ae
commit
37d177178f
2 changed files with 6 additions and 4 deletions
|
@ -39,7 +39,7 @@ bool BCLog::Logger::OpenDebugLog()
|
|||
|
||||
if (fs::exists(m_file_path)) {
|
||||
fs::path old_file_path(m_file_path);
|
||||
old_file_path.append(".old");
|
||||
old_file_path += ".old";
|
||||
fs::rename(m_file_path, old_file_path);
|
||||
}
|
||||
|
||||
|
|
|
@ -2772,13 +2772,15 @@ bool CChainState::ActivateBestChain(CValidationState &state, const CChainParams&
|
|||
if (ShutdownRequested())
|
||||
break;
|
||||
} while (pindexNewTip != pindexMostWork);
|
||||
CheckBlockIndex(chainparams.GetConsensus());
|
||||
|
||||
auto& consensus = chainparams.GetConsensus();
|
||||
CheckBlockIndex(consensus);
|
||||
|
||||
auto flushMode = FlushStateMode::PERIODIC;
|
||||
if (pindexNewTip && pindexNewTip->nTime + chainparams.GetConsensus().nPowTargetSpacing > GetAdjustedTime()) {
|
||||
if (pindexNewTip && chainparams.NetworkIDString() != CBaseChainParams::REGTEST
|
||||
&& pindexNewTip->nTime + consensus.nPowTargetSpacing > GetAdjustedTime()) {
|
||||
// trying to ensure that we flush to disk after new blocks when we're caught up to the chain
|
||||
// they're technically allowed to be two hours late, but experience says one minute is more likely
|
||||
// LogPrintf("Added tip with time %d but it is now %ll\n", pindexNewTip->nTime, GetAdjustedTime());
|
||||
flushMode = FlushStateMode::ALWAYS;
|
||||
}
|
||||
return FlushStateToDisk(chainparams, state, flushMode);
|
||||
|
|
Loading…
Reference in a new issue