From 32ae82f5c3d51a66ad4deb84819809b890664245 Mon Sep 17 00:00:00 2001 From: John Newbery Date: Thu, 24 Aug 2017 15:36:02 -0400 Subject: [tests] use TestNode p2p connection in tests --- test/functional/sendheaders.py | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) (limited to 'test/functional/sendheaders.py') 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 -- cgit v1.2.3