From 37d177178f87a979a0d3255e37bb35e16235d87a Mon Sep 17 00:00:00 2001 From: Brannon King Date: Tue, 12 Nov 2019 22:33:15 -0500 Subject: [PATCH] changed flush to have min height don't flush blocks on regtest --- src/logging.cpp | 2 +- src/validation.cpp | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/logging.cpp b/src/logging.cpp index fa0f7a497..37f9df983 100644 --- a/src/logging.cpp +++ b/src/logging.cpp @@ -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); } diff --git a/src/validation.cpp b/src/validation.cpp index 95a8a82fb..e7cdc8b19 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -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);