aboutsummaryrefslogtreecommitdiff
path: root/test/functional/sendheaders.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/sendheaders.py')
-rwxr-xr-xtest/functional/sendheaders.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/test/functional/sendheaders.py b/test/functional/sendheaders.py
index 68c0d95b4f..99b7f6b99e 100755
--- a/test/functional/sendheaders.py
+++ b/test/functional/sendheaders.py
@@ -91,7 +91,7 @@ from test_framework.mininode import (
CInv,
NODE_WITNESS,
NetworkThread,
- NodeConnCB,
+ P2PInterface,
mininode_lock,
msg_block,
msg_getblocks,
@@ -110,9 +110,10 @@ from test_framework.util import (
DIRECT_FETCH_RESPONSE_TIME = 0.05
-class BaseNode(NodeConnCB):
+class BaseNode(P2PInterface):
def __init__(self):
super().__init__()
+
self.block_announced = False
self.last_blockhash_announced = None
@@ -121,18 +122,18 @@ class BaseNode(NodeConnCB):
msg = msg_getdata()
for x in block_hashes:
msg.inv.append(CInv(2, x))
- self.connection.send_message(msg)
+ self.send_message(msg)
def send_get_headers(self, locator, hashstop):
msg = msg_getheaders()
msg.locator.vHave = locator
msg.hashstop = hashstop
- self.connection.send_message(msg)
+ self.send_message(msg)
def send_block_inv(self, blockhash):
msg = msg_inv()
msg.inv = [CInv(2, blockhash)]
- self.connection.send_message(msg)
+ self.send_message(msg)
def send_header_for_blocks(self, new_blocks):
headers_message = msg_headers()
@@ -155,11 +156,11 @@ class BaseNode(NodeConnCB):
test_function = lambda: self.last_blockhash_announced == block_hash
wait_until(test_function, timeout=timeout, lock=mininode_lock)
- def on_inv(self, conn, message):
+ def on_inv(self, message):
self.block_announced = True
self.last_blockhash_announced = message.inv[-1].hash
- def on_headers(self, conn, message):
+ def on_headers(self, message):
if len(message.headers):
self.block_announced = True
message.headers[-1].calc_sha256()