mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-15 23:25:02 +01:00
[test] Move MY_RELAY to p2p.py
messages.py is for message and primitive data structures. Specifics about the test framework's p2p implementation should be in p2p.py. Also rename to P2P_VERSION_RELAY. Also rename msg_version.nRelay to relay. In Bitcoin Core, this is referred to as fRelay, since it's a bool, so this field has always been misnamed.
This commit is contained in:
@@ -20,6 +20,7 @@ from test_framework.messages import (
|
||||
from test_framework.p2p import (
|
||||
P2PInterface,
|
||||
P2P_SUBVERSION,
|
||||
P2P_VERSION_RELAY,
|
||||
)
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.util import (
|
||||
@@ -128,13 +129,14 @@ class P2PLeakTest(BitcoinTestFramework):
|
||||
assert_equal(ver.addrFrom.port, 0)
|
||||
assert_equal(ver.addrFrom.ip, '0.0.0.0')
|
||||
assert_equal(ver.nStartingHeight, 201)
|
||||
assert_equal(ver.nRelay, 1)
|
||||
assert_equal(ver.relay, 1)
|
||||
|
||||
self.log.info('Check that old peers are disconnected')
|
||||
p2p_old_peer = self.nodes[0].add_p2p_connection(P2PInterface(), send_version=False, wait_for_verack=False)
|
||||
old_version_msg = msg_version()
|
||||
old_version_msg.nVersion = 31799
|
||||
old_version_msg.strSubVer = P2P_SUBVERSION
|
||||
old_version_msg.relay = P2P_VERSION_RELAY
|
||||
with self.nodes[0].assert_debug_log(['peer=3 using obsolete version 31799; disconnecting']):
|
||||
p2p_old_peer.send_message(old_version_msg)
|
||||
p2p_old_peer.wait_for_disconnect()
|
||||
|
||||
Reference in New Issue
Block a user