only try to set best chain if signal is registered

This commit is contained in:
Gregory Sanders 2018-09-26 10:15:31 -04:00
parent 61c54913c9
commit ea9d92d453

View file

@ -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) {