mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-07-02 11:41:18 +02:00
[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.
This commit is contained in:
@ -31,7 +31,6 @@ import time
|
|||||||
from test_framework.siphash import siphash256
|
from test_framework.siphash import siphash256
|
||||||
from test_framework.util import hex_str_to_bytes, assert_equal
|
from test_framework.util import hex_str_to_bytes, assert_equal
|
||||||
|
|
||||||
MIN_VERSION_SUPPORTED = 60001
|
|
||||||
MY_VERSION = 70016 # past wtxid relay
|
MY_VERSION = 70016 # past wtxid relay
|
||||||
MY_SUBVERSION = "/python-p2p-tester:0.0.3/"
|
MY_SUBVERSION = "/python-p2p-tester:0.0.3/"
|
||||||
MY_RELAY = 1 # from version 70001 onwards, fRelay should be appended to version messages (BIP37)
|
MY_RELAY = 1 # from version 70001 onwards, fRelay should be appended to version messages (BIP37)
|
||||||
|
@ -31,7 +31,6 @@ import threading
|
|||||||
from test_framework.messages import (
|
from test_framework.messages import (
|
||||||
CBlockHeader,
|
CBlockHeader,
|
||||||
MAX_HEADERS_RESULTS,
|
MAX_HEADERS_RESULTS,
|
||||||
MIN_VERSION_SUPPORTED,
|
|
||||||
msg_addr,
|
msg_addr,
|
||||||
msg_addrv2,
|
msg_addrv2,
|
||||||
msg_block,
|
msg_block,
|
||||||
@ -79,6 +78,9 @@ from test_framework.util import (
|
|||||||
|
|
||||||
logger = logging.getLogger("TestFramework.p2p")
|
logger = logging.getLogger("TestFramework.p2p")
|
||||||
|
|
||||||
|
# The minimum P2P version that this test framework supports
|
||||||
|
MIN_P2P_VERSION_SUPPORTED = 60001
|
||||||
|
|
||||||
MESSAGEMAP = {
|
MESSAGEMAP = {
|
||||||
b"addr": msg_addr,
|
b"addr": msg_addr,
|
||||||
b"addrv2": msg_addrv2,
|
b"addrv2": msg_addrv2,
|
||||||
@ -417,7 +419,7 @@ class P2PInterface(P2PConnection):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
def on_version(self, message):
|
def on_version(self, message):
|
||||||
assert message.nVersion >= MIN_VERSION_SUPPORTED, "Version {} received. Test framework only supports versions greater than {}".format(message.nVersion, MIN_VERSION_SUPPORTED)
|
assert message.nVersion >= MIN_P2P_VERSION_SUPPORTED, "Version {} received. Test framework only supports versions greater than {}".format(message.nVersion, MIN_P2P_VERSION_SUPPORTED)
|
||||||
if message.nVersion >= 70016 and self.wtxidrelay:
|
if message.nVersion >= 70016 and self.wtxidrelay:
|
||||||
self.send_message(msg_wtxidrelay())
|
self.send_message(msg_wtxidrelay())
|
||||||
if self.support_addrv2:
|
if self.support_addrv2:
|
||||||
|
Reference in New Issue
Block a user