aboutsummaryrefslogtreecommitdiff
path: root/test/functional/p2p-compactblocks.py
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2017-11-08 13:10:43 -0500
committerMarcoFalke <falke.marco@gmail.com>2017-11-08 13:11:07 -0500
commitf7388e93d3dd91a90239aedac4ec58404f103a2e (patch)
tree4427094650d2405728b243cdb63911b86bada368 /test/functional/p2p-compactblocks.py
parent0a2f46b0158b6fc7244a585913b0925c0acf707f (diff)
parent32ae82f5c3d51a66ad4deb84819809b890664245 (diff)
downloadbitcoin-f7388e93d3dd91a90239aedac4ec58404f103a2e.tar.xz
Merge #11182: [tests] Add P2P interface to TestNode
32ae82f5c [tests] use TestNode p2p connection in tests (John Newbery) 5e5725cc2 [tests] Add p2p connection to TestNode (John Newbery) b86c1cd20 [tests] fix TestNode.__getattr__() method (John Newbery) Pull request description: Final two steps of #10082 : Adding the "mininode" P2P interface to `TestNode` This PR adds the mininode P2P interface to `TestNode`. It simplifies the process for opening a P2P connection to the node-under-test from this: ```python node0 = NodeConnCB() connections = [] connections.append(NodeConn('127.0.0.1', p2p_port(0), self.nodes[0], node0)) node0.add_connection(connections[0]) ``` to this: ```python self.nodes[0].add_p2p_connection(p2p_conn_type=NodeConnCB) ``` The first commit adds the infrastructure to `test_node.py`. The second updates the individual test cases to use it. Can be separated if this is too much review for one PR. Tree-SHA512: 44f1a6320f44eefc70489ae8350c6a16ad1a6035e4b9b7bafbdf19f5905ed0e2db85beaaf4758eec3059dd89a375a47a45352a029f39f57a86ab38a9ae66650e
Diffstat (limited to 'test/functional/p2p-compactblocks.py')
-rwxr-xr-xtest/functional/p2p-compactblocks.py17
1 files changed, 3 insertions, 14 deletions
diff --git a/test/functional/p2p-compactblocks.py b/test/functional/p2p-compactblocks.py
index e3f986d80b..d2c4d39305 100755
--- a/test/functional/p2p-compactblocks.py
+++ b/test/functional/p2p-compactblocks.py
@@ -788,23 +788,12 @@ class CompactBlocksTest(BitcoinTestFramework):
def run_test(self):
# Setup the p2p connections and start up the network thread.
- self.test_node = TestNode()
- self.segwit_node = TestNode()
- self.old_node = TestNode() # version 1 peer <--> segwit node
-
- connections = []
- connections.append(NodeConn('127.0.0.1', p2p_port(0), self.nodes[0], self.test_node))
- connections.append(NodeConn('127.0.0.1', p2p_port(1), self.nodes[1],
- self.segwit_node, services=NODE_NETWORK|NODE_WITNESS))
- connections.append(NodeConn('127.0.0.1', p2p_port(1), self.nodes[1],
- self.old_node, services=NODE_NETWORK))
- self.test_node.add_connection(connections[0])
- self.segwit_node.add_connection(connections[1])
- self.old_node.add_connection(connections[2])
+ self.test_node = self.nodes[0].add_p2p_connection(TestNode())
+ self.segwit_node = self.nodes[1].add_p2p_connection(TestNode(), services=NODE_NETWORK|NODE_WITNESS)
+ self.old_node = self.nodes[1].add_p2p_connection(TestNode(), services=NODE_NETWORK)
NetworkThread().start() # Start up network handling in another thread
- # Test logic begins here
self.test_node.wait_for_verack()
# We will need UTXOs to construct transactions in later tests.