aboutsummaryrefslogtreecommitdiff
path: root/test/functional/p2p_addr_relay.py
diff options
context:
space:
mode:
authorMartin Zumsande <mzumsande@gmail.com>2021-12-08 16:27:02 +0000
committerMartin Zumsande <mzumsande@gmail.com>2021-12-16 12:43:38 +0000
commitaeeccd9aa699a913680aa9f5a96eca285e1703e0 (patch)
treeb1755b64815ebe88d1d917046613b7164551360a /test/functional/p2p_addr_relay.py
parent926fc2a0d4ff64cf2ff8e1dfa64eca2ebd24e090 (diff)
downloadbitcoin-aeeccd9aa699a913680aa9f5a96eca285e1703e0.tar.xz
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
Diffstat (limited to 'test/functional/p2p_addr_relay.py')
-rwxr-xr-xtest/functional/p2p_addr_relay.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/test/functional/p2p_addr_relay.py b/test/functional/p2p_addr_relay.py
index 5532056dbe..e55febc69a 100755
--- a/test/functional/p2p_addr_relay.py
+++ b/test/functional/p2p_addr_relay.py
@@ -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)