p2p: Avoid InitError when downgrading peers.dat

fixes #24188
When downgrading, a peers.dat with a future version that has a minimum
required version larger than the downgraded version would cause an InitError.

This commit changes this behavior to overwrite the existing peers.dat with
a new empty one, while creating a backup in peers.dat.bak.
This commit is contained in:
junderw
2022-01-29 21:58:59 +09:00
parent 5b4b8f76f3
commit d41ed32153
4 changed files with 24 additions and 10 deletions

View File

@@ -17,6 +17,12 @@
#include <utility>
#include <vector>
class InvalidAddrManVersionError : public std::ios_base::failure
{
public:
InvalidAddrManVersionError(std::string msg) : std::ios_base::failure(msg) { }
};
class AddrManImpl;
/** Default for -checkaddrman */