aboutsummaryrefslogtreecommitdiff
path: root/test/functional/p2p-segwit.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/p2p-segwit.py')
-rwxr-xr-xtest/functional/p2p-segwit.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/test/functional/p2p-segwit.py b/test/functional/p2p-segwit.py
index 22da7f2db1..b940bc4096 100755
--- a/test/functional/p2p-segwit.py
+++ b/test/functional/p2p-segwit.py
@@ -32,9 +32,10 @@ def get_virtual_size(witness_block):
return vsize
class TestNode(NodeConnCB):
- def __init__(self):
+ def __init__(self, rpc):
super().__init__()
self.getdataset = set()
+ self.rpc = rpc
def on_getdata(self, conn, message):
for inv in message.inv:
@@ -73,7 +74,7 @@ class TestNode(NodeConnCB):
tx_message = msg_witness_tx(tx)
self.send_message(tx_message)
self.sync_with_ping()
- assert_equal(tx.hash in self.connection.rpc.getrawmempool(), accepted)
+ assert_equal(tx.hash in self.rpc.getrawmempool(), accepted)
if (reason != None and not accepted):
# Check the rejection reason as well.
with mininode_lock:
@@ -86,7 +87,7 @@ class TestNode(NodeConnCB):
else:
self.send_message(msg_block(block))
self.sync_with_ping()
- assert_equal(self.connection.rpc.getbestblockhash() == block.hash, accepted)
+ assert_equal(self.rpc.getbestblockhash() == block.hash, accepted)
# Used to keep track of anyone-can-spend outputs that we can use in the tests
class UTXO():
@@ -1869,11 +1870,11 @@ class SegWitTest(BitcoinTestFramework):
def run_test(self):
# Setup the p2p connections and start up the network thread.
# self.test_node sets NODE_WITNESS|NODE_NETWORK
- self.test_node = self.nodes[0].add_p2p_connection(TestNode(), services=NODE_NETWORK|NODE_WITNESS)
+ self.test_node = self.nodes[0].add_p2p_connection(TestNode(self.nodes[0].rpc), services=NODE_NETWORK|NODE_WITNESS)
# self.old_node sets only NODE_NETWORK
- self.old_node = self.nodes[0].add_p2p_connection(TestNode(), services=NODE_NETWORK)
+ self.old_node = self.nodes[0].add_p2p_connection(TestNode(self.nodes[0].rpc), services=NODE_NETWORK)
# self.std_node is for testing node1 (fRequireStandard=true)
- self.std_node = self.nodes[1].add_p2p_connection(TestNode(), services=NODE_NETWORK|NODE_WITNESS)
+ self.std_node = self.nodes[1].add_p2p_connection(TestNode(self.nodes[1].rpc), services=NODE_NETWORK|NODE_WITNESS)
NetworkThread().start() # Start up network handling in another thread