MyHush / hush3

Hush: Speak And Transact Freely
https://myhush.org
Other
15 stars 13 forks source link

Flush witness data properly #129

Open leto opened 3 years ago

leto commented 3 years ago

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

leto commented 3 years ago

Not sure if this code was ported or not