test: p2p: check that getaddr msgs are only responded once per connection

This commit is contained in:
Sebastian Falbesoner 2023-09-03 14:15:36 +02:00
parent 6f03c45f6b
commit 668aa6af8d

View File

@ -299,6 +299,16 @@ class AddrTest(BitcoinTestFramework):
assert_equal(block_relay_peer.num_ipv4_received, 0)
assert inbound_peer.num_ipv4_received > 100
self.log.info('Check that we answer getaddr messages only once per connection')
received_addrs_before = inbound_peer.num_ipv4_received
with self.nodes[0].assert_debug_log(['Ignoring repeated "getaddr".']):
inbound_peer.send_and_ping(msg_getaddr())
self.mocktime += 10 * 60
self.nodes[0].setmocktime(self.mocktime)
inbound_peer.sync_with_ping()
received_addrs_after = inbound_peer.num_ipv4_received
assert_equal(received_addrs_before, received_addrs_after)
self.nodes[0].disconnect_p2ps()
def blocksonly_mode_tests(self):