aboutsummaryrefslogtreecommitdiff
path: root/test/functional/p2p_leak.py
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2021-06-05 08:38:19 +0200
committerMarcoFalke <falke.marco@gmail.com>2021-06-05 08:38:22 +0200
commit8f5c9a7fd41d3ed56798a1c7c142db8d530ab1e2 (patch)
tree9c7e9de8a01d17ef7ec4c99e996b347e5abb03ea /test/functional/p2p_leak.py
parent346e52afd6d5e317c96fc506bb54cde13e87c8b2 (diff)
parentca3a77068b8c9c6107d078ea083f4ab7c0010548 (diff)
Merge bitcoin/bitcoin#22153: test: Fix p2p_leak.py intermittent failure
ca3a77068b8c9c6107d078ea083f4ab7c0010548 test: Fix p2p_leak.py intermittent failure by lowering timeout (Martin Zumsande) Pull request description: Fixes #22085 Root cause: There was just 1 second between the wait (5 seconds) and the `-peertimeout=4`. Since `ShouldRunInactivityChecks` in `net.cpp` measures the timeout in seconds, its result can only change once per second, even though it is called more often. So in situations when the connection is established early in a given second like [here](https://bitcoinbuilds.org/index.php?ansilog=d7b3e075-683a-45cc-94d4-9645fc17e0b6.log#l3117) (2021-05-27T12:28:04.**001**913Z ), the 1 second leeway was not be sufficient, leading to the intermittent failures. Fix this by lowering the timeout by one second. ACKs for top commit: MarcoFalke: re-ACK ca3a77068b8c9c6107d078ea083f4ab7c0010548 Tree-SHA512: e7e22356d276c65a5b4f0a1b7ee5a9ad07d27691220746c7d02af3fad22cab1d53fd0ef59a938167ec80e4571c96649132d6922ad10667fc91baa47892f27a3e
Diffstat (limited to 'test/functional/p2p_leak.py')
-rwxr-xr-xtest/functional/p2p_leak.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/test/functional/p2p_leak.py b/test/functional/p2p_leak.py
index 71d5ca92b3..f1538e8ac7 100755
--- a/test/functional/p2p_leak.py
+++ b/test/functional/p2p_leak.py
@@ -29,6 +29,8 @@ from test_framework.util import (
assert_greater_than_or_equal,
)
+PEER_TIMEOUT = 3
+
class LazyPeer(P2PInterface):
def __init__(self):
@@ -98,7 +100,7 @@ class P2PVersionStore(P2PInterface):
class P2PLeakTest(BitcoinTestFramework):
def set_test_params(self):
self.num_nodes = 1
- self.extra_args = [['-peertimeout=4']]
+ self.extra_args = [[f"-peertimeout={PEER_TIMEOUT}"]]
def create_old_version(self, nversion):
old_version_msg = msg_version()
@@ -134,7 +136,7 @@ class P2PLeakTest(BitcoinTestFramework):
self.nodes[0].generate(nblocks=1)
# Give the node enough time to possibly leak out a message
- time.sleep(5)
+ time.sleep(PEER_TIMEOUT + 2)
# Make sure only expected messages came in
assert not no_version_idle_peer.unexpected_msg