Skip to content

Commit 668aa6a

Browse files
committed
test: p2p: check that getaddr msgs are only responded once per connection
1 parent 6f03c45 commit 668aa6a

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

test/functional/p2p_addr_relay.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,16 @@ def getaddr_tests(self):
299299
assert_equal(block_relay_peer.num_ipv4_received, 0)
300300
assert inbound_peer.num_ipv4_received > 100
301301

302+
self.log.info('Check that we answer getaddr messages only once per connection')
303+
received_addrs_before = inbound_peer.num_ipv4_received
304+
with self.nodes[0].assert_debug_log(['Ignoring repeated "getaddr".']):
305+
inbound_peer.send_and_ping(msg_getaddr())
306+
self.mocktime += 10 * 60
307+
self.nodes[0].setmocktime(self.mocktime)
308+
inbound_peer.sync_with_ping()
309+
received_addrs_after = inbound_peer.num_ipv4_received
310+
assert_equal(received_addrs_before, received_addrs_after)
311+
302312
self.nodes[0].disconnect_p2ps()
303313

304314
def blocksonly_mode_tests(self):

0 commit comments

Comments
 (0)