Skip to content

Commit 6523111

Browse files
committed
[test] Move MIN_VERSION_SUPPORTED to p2p.py
The messages.py module should contain code and helpers for [de]serializing p2p messages. Specific usage of those messages should be in p2p.py. Therefore move MIN_VERSION_SUPPORTED to p2p.py. Also rename to MIN_P2P_VERSION_SUPPORTED to distinguish it from other versioning used in Bitcoin/Bitcoin Core.
1 parent 8639c44 commit 6523111

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

test/functional/test_framework/messages.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
from test_framework.siphash import siphash256
3232
from test_framework.util import hex_str_to_bytes, assert_equal
3333

34-
MIN_VERSION_SUPPORTED = 60001
3534
MY_VERSION = 70016 # past wtxid relay
3635
MY_SUBVERSION = "/python-p2p-tester:0.0.3/"
3736
MY_RELAY = 1 # from version 70001 onwards, fRelay should be appended to version messages (BIP37)

test/functional/test_framework/p2p.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
from test_framework.messages import (
3232
CBlockHeader,
3333
MAX_HEADERS_RESULTS,
34-
MIN_VERSION_SUPPORTED,
3534
msg_addr,
3635
msg_addrv2,
3736
msg_block,
@@ -79,6 +78,9 @@
7978

8079
logger = logging.getLogger("TestFramework.p2p")
8180

81+
# The minimum P2P version that this test framework supports
82+
MIN_P2P_VERSION_SUPPORTED = 60001
83+
8284
MESSAGEMAP = {
8385
b"addr": msg_addr,
8486
b"addrv2": msg_addrv2,
@@ -417,7 +419,7 @@ def on_verack(self, message):
417419
pass
418420

419421
def on_version(self, message):
420-
assert message.nVersion >= MIN_VERSION_SUPPORTED, "Version {} received. Test framework only supports versions greater than {}".format(message.nVersion, MIN_VERSION_SUPPORTED)
422+
assert message.nVersion >= MIN_P2P_VERSION_SUPPORTED, "Version {} received. Test framework only supports versions greater than {}".format(message.nVersion, MIN_P2P_VERSION_SUPPORTED)
421423
if message.nVersion >= 70016 and self.wtxidrelay:
422424
self.send_message(msg_wtxidrelay())
423425
if self.support_addrv2:

0 commit comments

Comments
 (0)