Move CHistoryWriter into CCustomCSView #1700
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
CHistoryWriter should be created outside of any call to ConnectBlock or DisconnectBlock. This allows us to sometimes not pass in a history writer at all to avoid writing changes. For example, when starting the node VerifyDB is run which disconnects blocks. The changes made by VerifyDB when disconnecting blocks should be discarded, but for our bespoke DBs pburnHistoryDB, paccountHistoryDB and pvaultHistoryDB this did not happen which resulted in entries being removed from those DBs when new blocks were connected and the DBs were flushed.
This PR resolves that issue and is a step towards making all history writer DBs an integrated part of CCusttomCSView with layered flushing which will help simplify use and code further.