diff --git a/src/validation.cpp b/src/validation.cpp index d7537f1fe4..9f60618b97 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -3036,7 +3036,9 @@ bool static FlushStateToDisk(CValidationState &state, FlushStateMode mode, int n } if (fDoFullFlush || ((mode == FLUSH_STATE_ALWAYS || mode == FLUSH_STATE_PERIODIC) && nNow > nLastSetChain + (int64_t)DATABASE_WRITE_INTERVAL * 1000000)) { // Update best block in wallet (so we can detect restored wallets). - GetMainSignals().SetBestChain(chainActive.GetLocator()); + if (!GetMainSignals().SetBestChain.empty()) { + GetMainSignals().SetBestChain(chainActive.GetLocator()); + } nLastSetChain = nNow; } } catch (const std::runtime_error& e) {