You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fa55c3d Raise InitError when peers.dat is invalid or corrupted (MarcoFalke)
fa4e2cc Inline ReadPeerAddresses (MarcoFalke)
fa5aeec Move LoadAddrman from init to addrdb (MarcoFalke)
Pull request description:
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.
ACKs for top commit:
jonatack:
Code review re-ACK fa55c3d per `git range-diff eb1f570 fa59c6d fa55c3` and verified the new tests fail on master, except "Check mocked addrman is valid", as expected
prayank23:
tACK bitcoin/bitcoin@fa55c3d
vasild:
ACK fa55c3d
Tree-SHA512: 78264a78ee570a3c3262cf9c8542b5ffaffa5f52da1eef66c8c381f346989272967cfe1769c573502d9d7d3f7ad68c3ac3b2ec734185d2e4e7595b7122b14196
LogPrintf("Creating peers.dat because the file was not found (%s)\n", path_addr);
198
+
DumpPeerAddresses(args, *addrman);
199
+
} catch (const std::exception& e) {
200
+
addrman = nullptr;
201
+
returnstrprintf(_("Invalid or corrupt peers.dat (%s). If you believe this is a bug, please report it to %s. As a workaround, you can move the file (%s) out of the way (rename, move, or delete) to have a new one created on the next start."),
f"Error: Invalid or corrupt peers.dat \\({reason}\\). If you believe this "
49
+
f"is a bug, please report it to {self.config['environment']['PACKAGE_BUGREPORT']}. "
50
+
f'As a workaround, you can move the file \\("{peers_dat}"\\) out of the way \\(rename, '
51
+
"move, or delete\\) to have a new one created on the next start."
52
+
)
46
53
47
54
self.log.info("Check that mocked addrman is valid")
48
55
self.stop_node(0)
@@ -54,30 +61,29 @@ def run_test(self):
54
61
self.log.info("Check that addrman from future cannot be read")
55
62
self.stop_node(0)
56
63
write_addrman(peers_dat, lowest_compatible=111)
57
-
withself.nodes[0].assert_debug_log([
58
-
f'ERROR: DeserializeDB: Deserialize or I/O error - Unsupported format of addrman database: 1. It is compatible with formats >=111, but the maximum supported by this version of {self.config["environment"]["PACKAGE_NAME"]} is 3.',
0 commit comments