mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-10 10:52:31 -05:00
[test] Extract sending an addr message into a helper
Also reduces mocktime to prevent idle disconnects Co-Authored-By: Martin Zumsande <mzumsande@gmail.com>
This commit is contained in:
parent
c991943399
commit
d2dbfe6ff1
1 changed files with 9 additions and 5 deletions
|
@ -58,6 +58,14 @@ class AddrTest(BitcoinTestFramework):
|
||||||
msg.addrs = addrs
|
msg.addrs = addrs
|
||||||
return msg
|
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):
|
def oversized_addr_test(self):
|
||||||
self.log.info('Send an addr message that is too large')
|
self.log.info('Send an addr message that is too large')
|
||||||
addr_source = self.nodes[0].add_p2p_connection(P2PInterface())
|
addr_source = self.nodes[0].add_p2p_connection(P2PInterface())
|
||||||
|
@ -86,11 +94,7 @@ class AddrTest(BitcoinTestFramework):
|
||||||
'received: addr (301 bytes) peer=1',
|
'received: addr (301 bytes) peer=1',
|
||||||
]
|
]
|
||||||
):
|
):
|
||||||
addr_source.send_and_ping(msg)
|
self.send_addr_msg(addr_source, msg, receivers)
|
||||||
self.mocktime += 30 * 60
|
|
||||||
self.nodes[0].setmocktime(self.mocktime)
|
|
||||||
for receiver in receivers:
|
|
||||||
receiver.sync_with_ping()
|
|
||||||
|
|
||||||
total_ipv4_received = sum(r.num_ipv4_received for r in receivers)
|
total_ipv4_received = sum(r.num_ipv4_received for r in receivers)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue