From 9cb6cdc59f9eb826b70ebbb6353a5bcee74996e3 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Fri, 27 Apr 2018 14:08:39 -0400 Subject: Simplify semantics of ChainStateFlushed callback Previously, ChainStateFlushed would fire either if a full flush completed (which can happen due to memory limits, forced flush, or on its own DATABASE_WRITE_INTERVAL timer) *or* on a ChainStateFlushed-specific DATABASE_WRITE_INTERVAL timer. This is both less clear for clients (as there are no guarantees about a flush having actually happened prior to the call), and reults in extra flushes not clearly intended by the code. We drop the second case, providing a strong guarantee without removing the periodit timer-based flushing. --- src/validationinterface.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/validationinterface.h') diff --git a/src/validationinterface.h b/src/validationinterface.h index 6089bc2b3c..3a5fed0106 100644 --- a/src/validationinterface.h +++ b/src/validationinterface.h @@ -99,6 +99,17 @@ protected: /** * Notifies listeners of the new active block chain on-disk. * + * Prior to this callback, any updates are not guaranteed to persist on disk + * (ie clients need to handle shutdown/restart safety by being able to + * understand when some updates were lost due to unclean shutdown). + * + * When this callback is invoked, the validation changes done by any prior + * callback are guaranteed to exist on disk and survive a restart, including + * an unclean shutdown. + * + * Provides a locator describing the best chain, which is likely useful for + * storing current state on disk in client DBs. + * * Called on a background thread. */ virtual void ChainStateFlushed(const CBlockLocator &locator) {} -- cgit v1.2.3