aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAmiti Uttarwar <amiti@uttarwar.org>2021-03-30 13:15:30 -0700
committerMartin Zumsande <mzumsande@gmail.com>2021-04-21 22:16:39 +0200
commitd2dbfe6ff1806e5248399b28a7a1a22dab726c40 (patch)
tree874ee134e3cdf3b3764792f2640fd16cfebd5cac /test
parentc9919433994924931757aa7ec278c50744ede35d (diff)
downloadbitcoin-d2dbfe6ff1806e5248399b28a7a1a22dab726c40.tar.xz
[test] Extract sending an addr message into a helper
Also reduces mocktime to prevent idle disconnects Co-Authored-By: Martin Zumsande <mzumsande@gmail.com>
Diffstat (limited to 'test')
-rwxr-xr-xtest/functional/p2p_addr_relay.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/test/functional/p2p_addr_relay.py b/test/functional/p2p_addr_relay.py
index b728ed428b..4d7ad2eb10 100755
--- a/test/functional/p2p_addr_relay.py
+++ b/test/functional/p2p_addr_relay.py
@@ -58,6 +58,14 @@ class AddrTest(BitcoinTestFramework):
msg.addrs = addrs
return msg
+ def send_addr_msg(self, source, msg, receivers):
+ source.send_and_ping(msg)
+ # pop m_next_addr_send timer
+ self.mocktime += 5 * 60
+ self.nodes[0].setmocktime(self.mocktime)
+ for peer in receivers:
+ peer.sync_with_ping()
+
def oversized_addr_test(self):
self.log.info('Send an addr message that is too large')
addr_source = self.nodes[0].add_p2p_connection(P2PInterface())
@@ -86,11 +94,7 @@ class AddrTest(BitcoinTestFramework):
'received: addr (301 bytes) peer=1',
]
):
- addr_source.send_and_ping(msg)
- self.mocktime += 30 * 60
- self.nodes[0].setmocktime(self.mocktime)
- for receiver in receivers:
- receiver.sync_with_ping()
+ self.send_addr_msg(addr_source, msg, receivers)
total_ipv4_received = sum(r.num_ipv4_received for r in receivers)