Flush witness data to disk only when it’s consistent
This fix prevents the wallet database from getting into an inconsistent state. By flushing witness data to disk from the wallet thread, instead of the main thread, we ensure that the on-disk block height is always the same as the witness data height. Previously, the database occasionally got into a state where the latest block height was one ahead of the witness data. This then triggered an assertion failure in CWallet::IncrementNoteWitnesses() upon restarting after a zcashd shutdown.
Note that this code change will not automatically repair a data directory that has been affected by this problem; that requires starting zcashd with the -rescan or -reindex options.
Flush witness data to disk only when it’s consistent
This fix prevents the wallet database from getting into an inconsistent state. By flushing witness data to disk from the wallet thread, instead of the main thread, we ensure that the on-disk block height is always the same as the witness data height. Previously, the database occasionally got into a state where the latest block height was one ahead of the witness data. This then triggered an assertion failure in CWallet::IncrementNoteWitnesses() upon restarting after a zcashd shutdown.
Note that this code change will not automatically repair a data directory that has been affected by this problem; that requires starting zcashd with the -rescan or -reindex options.
from ZEC 3.1.0 release notes