mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-04-28 21:33:25 +02:00
test: perturb anchors.dat to test it doesn't throw an error during initialization
This commit is contained in:
parent
1bad29fe02
commit
33fdfc7986
@ -63,14 +63,22 @@ class AnchorsTest(BitcoinTestFramework):
|
|||||||
self.log.info("Check the addresses in anchors.dat")
|
self.log.info("Check the addresses in anchors.dat")
|
||||||
|
|
||||||
with open(node_anchors_path, "rb") as file_handler:
|
with open(node_anchors_path, "rb") as file_handler:
|
||||||
anchors = file_handler.read().hex()
|
anchors = file_handler.read()
|
||||||
|
|
||||||
|
anchors_hex = anchors.hex()
|
||||||
for port in block_relay_nodes_port:
|
for port in block_relay_nodes_port:
|
||||||
ip_port = ip + port
|
ip_port = ip + port
|
||||||
assert ip_port in anchors
|
assert ip_port in anchors_hex
|
||||||
for port in inbound_nodes_port:
|
for port in inbound_nodes_port:
|
||||||
ip_port = ip + port
|
ip_port = ip + port
|
||||||
assert ip_port not in anchors
|
assert ip_port not in anchors_hex
|
||||||
|
|
||||||
|
self.log.info("Perturb anchors.dat to test it doesn't throw an error during initialization")
|
||||||
|
with self.nodes[0].assert_debug_log(["0 block-relay-only anchors will be tried for connections."]):
|
||||||
|
with open(node_anchors_path, "wb") as out_file_handler:
|
||||||
|
tweaked_contents = bytearray(anchors)
|
||||||
|
tweaked_contents[20:20] = b'1'
|
||||||
|
out_file_handler.write(bytes(tweaked_contents))
|
||||||
|
|
||||||
self.log.info("Start node")
|
self.log.info("Start node")
|
||||||
self.start_node(0)
|
self.start_node(0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user