Skip to content

Commit

Permalink
[tests] Remove support for bre-BIP31 ping messages
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jnewbery committed Nov 8, 2017
1 parent 2904e30 commit c0b1274
Showing 1 changed file with 1 addition and 22 deletions.
23 changes: 1 addition & 22 deletions test/functional/test_framework/mininode.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
from test_framework.siphash import siphash256
from test_framework.util import hex_str_to_bytes, bytes_to_hex_str, wait_until

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


class msg_ping_prebip31():
command = b"ping"

def __init__(self):
pass

def deserialize(self, f):
pass

def serialize(self):
return b""

def __repr__(self):
return "msg_ping() (pre-bip31)"


class msg_ping():
command = b"ping"

Expand Down Expand Up @@ -1528,8 +1511,7 @@ def on_inv(self, conn, message):
conn.send_message(want)

def on_ping(self, conn, message):
if conn.ver_send > BIP0031_VERSION:
conn.send_message(msg_pong(message.nonce))
conn.send_message(msg_pong(message.nonce))

def on_verack(self, conn, message):
conn.ver_recv = conn.ver_send
Expand Down Expand Up @@ -1786,9 +1768,6 @@ def send_message(self, message, pushbuf=False):
self.last_sent = time.time()

def got_message(self, message):
if message.command == b"version":
if message.nVersion <= BIP0031_VERSION:
self.messagemap[b'ping'] = msg_ping_prebip31
if self.last_sent + 30 * 60 < time.time():
self.send_message(self.messagemap[b'ping']())
self._log_message("receive", message)
Expand Down

0 comments on commit c0b1274

Please sign in to comment.