Changeset View
Changeset View
Standalone View
Standalone View
test/functional/p2p_timeouts.py
Show All 37 Lines | class TimeoutsTest(BitcoinTestFramework): | ||||
def set_test_params(self): | def set_test_params(self): | ||||
self.setup_clean_chain = True | self.setup_clean_chain = True | ||||
self.num_nodes = 1 | self.num_nodes = 1 | ||||
# set timeout to receive version/verack to 3 seconds | # set timeout to receive version/verack to 3 seconds | ||||
self.extra_args = [["-peertimeout=3"]] | self.extra_args = [["-peertimeout=3"]] | ||||
def run_test(self): | def run_test(self): | ||||
# Setup the p2p connections | # 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( | no_version_node = self.nodes[0].add_p2p_connection( | ||||
TestP2PConn(), send_version=False, wait_for_verack=False) | TestP2PConn(), send_version=False, wait_for_verack=False) | ||||
no_send_node = self.nodes[0].add_p2p_connection( | no_send_node = self.nodes[0].add_p2p_connection( | ||||
TestP2PConn(), send_version=False, wait_for_verack=False) | 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) | sleep(1) | ||||
assert no_verack_node.is_connected | assert no_verack_node.is_connected | ||||
assert no_version_node.is_connected | assert no_version_node.is_connected | ||||
assert no_send_node.is_connected | assert no_send_node.is_connected | ||||
no_verack_node.send_message(msg_ping()) | no_verack_node.send_message(msg_ping()) | ||||
no_version_node.send_message(msg_ping()) | no_version_node.send_message(msg_ping()) | ||||
Show All 31 Lines |