aboutsummaryrefslogtreecommitdiff
path: root/test/functional/sendheaders.py
diff options
context:
space:
mode:
authorJohn Newbery <john@johnnewbery.com>2017-08-24 15:36:02 -0400
committerJohn Newbery <john@johnnewbery.com>2017-11-08 09:32:04 -0500
commit32ae82f5c3d51a66ad4deb84819809b890664245 (patch)
tree23e83cfed1f974a3a21df022ec1f207eeb645dae /test/functional/sendheaders.py
parent5e5725cc2b56d66510fd85d7ee3822e6df43cd24 (diff)
[tests] use TestNode p2p connection in tests
Diffstat (limited to 'test/functional/sendheaders.py')
-rwxr-xr-xtest/functional/sendheaders.py16
1 files changed, 4 insertions, 12 deletions
diff --git a/test/functional/sendheaders.py b/test/functional/sendheaders.py
index 08de2ffa03..82cbc5a110 100755
--- a/test/functional/sendheaders.py
+++ b/test/functional/sendheaders.py
@@ -181,7 +181,7 @@ class SendHeadersTest(BitcoinTestFramework):
# mine count blocks and return the new tip
def mine_blocks(self, count):
# Clear out last block announcement from each p2p listener
- [ x.clear_last_announcement() for x in self.p2p_connections ]
+ [x.clear_last_announcement() for x in self.nodes[0].p2ps]
self.nodes[0].generate(count)
return int(self.nodes[0].getbestblockhash(), 16)
@@ -193,7 +193,7 @@ class SendHeadersTest(BitcoinTestFramework):
def mine_reorg(self, length):
self.nodes[0].generate(length) # make sure all invalidated blocks are node0's
sync_blocks(self.nodes, wait=0.1)
- for x in self.p2p_connections:
+ for x in self.nodes[0].p2ps:
x.wait_for_block_announcement(int(self.nodes[0].getbestblockhash(), 16))
x.clear_last_announcement()
@@ -206,18 +206,10 @@ class SendHeadersTest(BitcoinTestFramework):
def run_test(self):
# Setup the p2p connections and start up the network thread.
- inv_node = TestNode()
- test_node = TestNode()
-
- self.p2p_connections = [inv_node, test_node]
-
- connections = []
- connections.append(NodeConn('127.0.0.1', p2p_port(0), self.nodes[0], inv_node))
+ inv_node = self.nodes[0].add_p2p_connection(TestNode())
# Set nServices to 0 for test_node, so no block download will occur outside of
# direct fetching
- connections.append(NodeConn('127.0.0.1', p2p_port(0), self.nodes[0], test_node, services=NODE_WITNESS))
- inv_node.add_connection(connections[0])
- test_node.add_connection(connections[1])
+ test_node = self.nodes[0].add_p2p_connection(TestNode(), services=NODE_WITNESS)
NetworkThread().start() # Start up network handling in another thread