Read and write ChainMonitor
using the same key
#1665
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.
Fixes #1661.
Fixes #1565.
This fixes a kind of bug which could happen like this:
Create a
ChainMonitor
based on version 1.4.4 (for example). This would use the number "4" as the key.Upgrade to version 1.6.5 (for example).
On startup, we would identify the original
ChainMonitor
as backwards-incompatible and attempt to overwrite it. Instead, we would insert it under the new key "chain_monitor".Then we would build the
dlc_manager::Manager
, which would load theChainMonitor
internally. This would look for the firstChainMonitor
out of all the ones in theCHAIN_MONITOR
tree, ignoring the key. Because the original one was inserted first, wewould load the original one which would once again fail to deserialise due to backwards-incompatibility.
Now we ensure that we always use the same key to read and write the
ChainMonitor
. This makes sense because there should only ever be oneChainMonitor
per node.