Raise InitError when peers.dat is invalid or corrupted
Summary:
peers.dat is silently erased when it can not be parsed or when it appears corrupted. Fix that by notifying the user. This might help in the following examples: - The user provided the database, but picked the wrong one. - A future version of Bitcoin Core wrote the file and it can't be read. - The file was corrupted by a logic bug in Bitcoin Core. - The file was corrupted by a disk failure.
Backport of core#22762.
Also cherry-picks a commit from PR22697 that is now required for the addrman_tests to pass, and for which the rationale is still trivially correct:
https://github.com/bitcoin/bitcoin/pull/22697/commits/ed9ba8af08f857bda3ce2f77413317374c22d7b4
Test Plan:
ninja all check-all
Reviewers: #bitcoin_abc, PiRK
Reviewed By: #bitcoin_abc, PiRK
Differential Revision: https://reviews.bitcoinabc.org/D12308