mirror of
https://github.com/bitcoin/bitcoin.git
synced 2024-11-20 10:38:42 +01:00
test: enable v2 transport for p2p_timeouts.py
by skipping the part where we send a non-version message before the version - this message would be interpreted as part of the v2 handshake.
This commit is contained in:
parent
2c1669c37a
commit
35fb9930ad
@ -68,11 +68,14 @@ class TimeoutsTest(BitcoinTestFramework):
|
|||||||
|
|
||||||
with self.nodes[0].assert_debug_log(['Unsupported message "ping" prior to verack from peer=0']):
|
with self.nodes[0].assert_debug_log(['Unsupported message "ping" prior to verack from peer=0']):
|
||||||
no_verack_node.send_message(msg_ping())
|
no_verack_node.send_message(msg_ping())
|
||||||
with self.nodes[0].assert_debug_log(['non-version message before version handshake. Message "ping" from peer=1']):
|
|
||||||
no_version_node.send_message(msg_ping())
|
# With v2, non-version messages before the handshake would be interpreted as part of the key exchange.
|
||||||
|
# Therefore, don't execute this part of the test if v2transport is chosen.
|
||||||
|
if not self.options.v2transport:
|
||||||
|
with self.nodes[0].assert_debug_log(['non-version message before version handshake. Message "ping" from peer=1']):
|
||||||
|
no_version_node.send_message(msg_ping())
|
||||||
|
|
||||||
self.mock_forward(1)
|
self.mock_forward(1)
|
||||||
|
|
||||||
assert "version" in no_verack_node.last_message
|
assert "version" in no_verack_node.last_message
|
||||||
|
|
||||||
assert no_verack_node.is_connected
|
assert no_verack_node.is_connected
|
||||||
@ -80,11 +83,12 @@ class TimeoutsTest(BitcoinTestFramework):
|
|||||||
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())
|
if not self.options.v2transport:
|
||||||
|
no_version_node.send_message(msg_ping())
|
||||||
|
|
||||||
expected_timeout_logs = [
|
expected_timeout_logs = [
|
||||||
"version handshake timeout peer=0",
|
"version handshake timeout peer=0",
|
||||||
"socket no message in first 3 seconds, 1 0 peer=1",
|
f"socket no message in first 3 seconds, {'0' if self.options.v2transport else '1'} 0 peer=1",
|
||||||
"socket no message in first 3 seconds, 0 0 peer=2",
|
"socket no message in first 3 seconds, 0 0 peer=2",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -100,5 +104,6 @@ class TimeoutsTest(BitcoinTestFramework):
|
|||||||
extra_args=['-peertimeout=0'],
|
extra_args=['-peertimeout=0'],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
TimeoutsTest().main()
|
TimeoutsTest().main()
|
||||||
|
@ -153,6 +153,7 @@ BASE_SCRIPTS = [
|
|||||||
'p2p_invalid_messages.py',
|
'p2p_invalid_messages.py',
|
||||||
'rpc_createmultisig.py',
|
'rpc_createmultisig.py',
|
||||||
'p2p_timeouts.py',
|
'p2p_timeouts.py',
|
||||||
|
'p2p_timeouts.py --v2transport',
|
||||||
'wallet_dump.py --legacy-wallet',
|
'wallet_dump.py --legacy-wallet',
|
||||||
'rpc_signer.py',
|
'rpc_signer.py',
|
||||||
'wallet_signer.py --descriptors',
|
'wallet_signer.py --descriptors',
|
||||||
|
Loading…
Reference in New Issue
Block a user