Skip to content

Commit c0b1274

Browse files
committed
[tests] Remove support for bre-BIP31 ping messages
BIP31 support was added to Bitcoin Core in version 0.6.1. Our test framework is incompatible with Bitcoin Core versions that old, so remove all special logic for handling pre-BIP31 pings.
1 parent 2904e30 commit c0b1274

File tree

1 file changed

+1
-22
lines changed

1 file changed

+1
-22
lines changed

test/functional/test_framework/mininode.py

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
from test_framework.siphash import siphash256
3838
from test_framework.util import hex_str_to_bytes, bytes_to_hex_str, wait_until
3939

40-
BIP0031_VERSION = 60000
4140
MY_VERSION = 70014 # past bip-31 for ping/pong
4241
MY_SUBVERSION = b"/python-mininode-tester:0.0.3/"
4342
MY_RELAY = 1 # from version 70001 onwards, fRelay should be appended to version messages (BIP37)
@@ -1195,22 +1194,6 @@ def __repr__(self):
11951194
return "msg_getaddr()"
11961195

11971196

1198-
class msg_ping_prebip31():
1199-
command = b"ping"
1200-
1201-
def __init__(self):
1202-
pass
1203-
1204-
def deserialize(self, f):
1205-
pass
1206-
1207-
def serialize(self):
1208-
return b""
1209-
1210-
def __repr__(self):
1211-
return "msg_ping() (pre-bip31)"
1212-
1213-
12141197
class msg_ping():
12151198
command = b"ping"
12161199

@@ -1528,8 +1511,7 @@ def on_inv(self, conn, message):
15281511
conn.send_message(want)
15291512

15301513
def on_ping(self, conn, message):
1531-
if conn.ver_send > BIP0031_VERSION:
1532-
conn.send_message(msg_pong(message.nonce))
1514+
conn.send_message(msg_pong(message.nonce))
15331515

15341516
def on_verack(self, conn, message):
15351517
conn.ver_recv = conn.ver_send
@@ -1786,9 +1768,6 @@ def send_message(self, message, pushbuf=False):
17861768
self.last_sent = time.time()
17871769

17881770
def got_message(self, message):
1789-
if message.command == b"version":
1790-
if message.nVersion <= BIP0031_VERSION:
1791-
self.messagemap[b'ping'] = msg_ping_prebip31
17921771
if self.last_sent + 30 * 60 < time.time():
17931772
self.send_message(self.messagemap[b'ping']())
17941773
self._log_message("receive", message)

0 commit comments

Comments
 (0)