aboutsummaryrefslogtreecommitdiff
path: root/test/functional/sendheaders.py
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2017-11-29 16:29:12 -0500
committerMarcoFalke <falke.marco@gmail.com>2017-11-29 16:29:19 -0500
commit9f2c2dba21855b8cb9b193b1819be73fa4a23a99 (patch)
treed200bb364c984d331dfc9178497c629568a6669e /test/functional/sendheaders.py
parent32c9b570fceaad76536a2c881b4dc1d961d9b306 (diff)
parente9dfa9bccc5cbb6096c60498651b451297f0a931 (diff)
downloadbitcoin-9f2c2dba21855b8cb9b193b1819be73fa4a23a99.tar.xz
Merge #11712: [tests] Split NodeConn from NodeConnCB
e9dfa9bcc [tests] Move version message sending from NodeConn to NodeConnCB (John Newbery) dad596fc3 [tests] Make NodeConnCB a subclass of NodeConn (John Newbery) e30d40438 [tests] Move only: move NodeConnCB below NodeConn (John Newbery) 4d5059856 [tests] Tidy up mininode (John Newbery) f2ae6f32a [tests] Remove mininode periodic (half-hour) ping messages (John Newbery) ec59523c5 [tests] Remove rpc property from TestNode in p2p-segwit.py. (John Newbery) Pull request description: This is the final step in #11518, except for possibly renaming - for motivation, please see that PR. If this is merged, then migrating the test framework from asyncore to asyncio should be easier (I say should because I haven't dug too deeply into what would be required). Requesting review from @ryanofsky , since he always has good feedback on these refactor PRs, and I'd appreciate his take on this refactor. Note particularly that I've reverted the change suggested here: https://github.com/bitcoin/bitcoin/pull/11182#discussion_r148859555 . The idea, as always, is to present a simple interface to the test writer. Tree-SHA512: 94dd467a13ec799b101108cf47d4dccb6f6240b601e375e3d785313333bbb389c26072a50759aca663bbf3d6c8b867b99e36ae8800ab8ea115e0496c151926ce
Diffstat (limited to 'test/functional/sendheaders.py')
-rwxr-xr-xtest/functional/sendheaders.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/test/functional/sendheaders.py b/test/functional/sendheaders.py
index 68c0d95b4f..b589d0e8a5 100755
--- a/test/functional/sendheaders.py
+++ b/test/functional/sendheaders.py
@@ -113,6 +113,7 @@ DIRECT_FETCH_RESPONSE_TIME = 0.05
class BaseNode(NodeConnCB):
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()