aboutsummaryrefslogtreecommitdiff
path: root/test/functional/p2p_timeouts.py
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2020-03-02 14:14:30 -0500
committerMarcoFalke <falke.marco@gmail.com>2020-03-31 17:03:03 -0400
commitfa9064704524a0fd1fa9ea73eea45b07316ac3d1 (patch)
tree433ddf8d93da71c6c33b06ea7985bd1c6c9624cb /test/functional/p2p_timeouts.py
parentac5c5d0162a963be6fbaa53261c01705436a65f3 (diff)
downloadbitcoin-fa9064704524a0fd1fa9ea73eea45b07316ac3d1.tar.xz
test: Wait for both veracks in add_p2p_connection
Diffstat (limited to 'test/functional/p2p_timeouts.py')
-rwxr-xr-xtest/functional/p2p_timeouts.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/test/functional/p2p_timeouts.py b/test/functional/p2p_timeouts.py
index 02ceec3dc1..c1235f8a6b 100755
--- a/test/functional/p2p_timeouts.py
+++ b/test/functional/p2p_timeouts.py
@@ -27,11 +27,13 @@ from test_framework.messages import msg_ping
from test_framework.mininode import P2PInterface
from test_framework.test_framework import BitcoinTestFramework
+
class TestP2PConn(P2PInterface):
def on_version(self, message):
# Don't send a verack in response
pass
+
class TimeoutsTest(BitcoinTestFramework):
def set_test_params(self):
self.setup_clean_chain = True
@@ -41,10 +43,14 @@ class TimeoutsTest(BitcoinTestFramework):
def run_test(self):
# Setup the p2p connections
- no_verack_node = self.nodes[0].add_p2p_connection(TestP2PConn())
+ no_verack_node = self.nodes[0].add_p2p_connection(TestP2PConn(), wait_for_verack=False)
no_version_node = self.nodes[0].add_p2p_connection(TestP2PConn(), send_version=False, wait_for_verack=False)
no_send_node = self.nodes[0].add_p2p_connection(TestP2PConn(), send_version=False, wait_for_verack=False)
+ # Wait until we got the verack in response to the version. Though, don't wait for the other node to receive the
+ # verack, since we never sent one
+ no_verack_node.wait_for_verack()
+
sleep(1)
assert no_verack_node.is_connected
@@ -81,5 +87,6 @@ class TimeoutsTest(BitcoinTestFramework):
assert not no_version_node.is_connected
assert not no_send_node.is_connected
+
if __name__ == '__main__':
TimeoutsTest().main()