mirror of
https://github.com/bitcoin/bitcoin.git
synced 2024-11-20 02:25:40 +01:00
test: Fix intermittent issue in p2p_addr_relay.py
by increasing the mocktime bump for m_next_addr_send, which is on a Poisson timer, and explain why. Closes #22449
This commit is contained in:
parent
926fc2a0d4
commit
aeeccd9aa6
@ -121,7 +121,10 @@ class AddrTest(BitcoinTestFramework):
|
||||
|
||||
def send_addr_msg(self, source, msg, receivers):
|
||||
source.send_and_ping(msg)
|
||||
# pop m_next_addr_send timer
|
||||
# invoke m_next_addr_send timer:
|
||||
# `addr` messages are sent on an exponential distribution with mean interval of 30s.
|
||||
# Setting the mocktime 600s forward gives a probability of (1 - e^-(600/30)) that
|
||||
# the event will occur (i.e. this fails once in ~500 million repeats).
|
||||
self.mocktime += 10 * 60
|
||||
self.nodes[0].setmocktime(self.mocktime)
|
||||
for peer in receivers:
|
||||
@ -282,7 +285,8 @@ class AddrTest(BitcoinTestFramework):
|
||||
block_relay_peer.send_and_ping(msg_getaddr())
|
||||
inbound_peer.send_and_ping(msg_getaddr())
|
||||
|
||||
self.mocktime += 5 * 60
|
||||
# invoke m_next_addr_send timer, see under send_addr_msg() function for rationale
|
||||
self.mocktime += 10 * 60
|
||||
self.nodes[0].setmocktime(self.mocktime)
|
||||
inbound_peer.wait_until(lambda: inbound_peer.addr_received() is True)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user