fix: backport bitcoin#26909, allow for silent overwriting of inconsistent peers.dat #6084
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.
Additional Information
bitcoin#22762 (backported as part of dash#6043) did away with then-existing behaviour of overwriting
peers.datsilently if found corrupt with the rationale of preventing situations where the wrong file is pointed at or the file is written by a higher version of Core. Alongside a change in behaviour, refactoring also took place and further changes were built on top of them.Since then, there have been reports of an increasing number of "Corrupt data. Consistency check failed with code -5: iostream error" errors from builds based on
develop. Reverting the pull request that introduced this change in behaviour is non-trivial due to the number of backports that build on top of the refactoring brought along with it.Nor were any other error messages found except for the one mentioned above. The tendency for
peers.datto corrupt itself has also been documented upstream (bitcoin#26599), with the issue marked as closed with the merger of bitcoin#26909.Therefore, to remedy the above problem, alongside backporting bitcoin#26909, to avoid inconvenience, instead of reverting all progress made from backporting (as the benefits of not overwriting
peers.datfor having the wrong magic altogether, for example, is something that doesn't need to be reverted), only inconsistentpeers.datfiles will be overwritten and the action logged with no user intervention required.Breaking Changes
None expected.
Checklist: