dashpay / dash

Dash - Reinventing Cryptocurrency
https://www.dash.org
MIT License
1.49k stars 1.19k forks source link

fix: backport bitcoin#26909, allow for silent overwriting of inconsistent peers.dat #6084

Closed kwvg closed 1 week ago

kwvg commented 1 week ago

Additional Information

bitcoin#22762 (backported as part of dash#6043) did away with then-existing behaviour of overwriting peers.dat silently 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.dat to 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.dat for having the wrong magic altogether, for example, is something that doesn't need to be reverted), only inconsistent peers.dat files will be overwritten and the action logged with no user intervention required.

Breaking Changes

None expected.

Checklist:

kwvg commented 1 week ago

Special thanks to @knst, @PastaPastaPasta and @thephez for reporting on this issue!