Skip to content

Commit 4ba3d4f

Browse files
author
MarcoFalke
committed
Merge #12728: [tests] rename TestNode to TestP2PConn in tests
728667b scripted-diff: rename TestNode to TestP2PConn in tests (John Newbery) Pull request description: Several test scripts define a subclass of P2PInterface called TestNode. This commit renames those to TestP2PConn since we already have a TestNode class in the test framework. Tree-SHA512: fc8472677312ad000560fa491b680a441d05c0fee5f8eea2d031d326d81e56d231c235930c0d09dd10afc98d7255fa9f9309d5e2ae6c252bc188a5951644a5b8
2 parents 55f490a + 728667b commit 4ba3d4f

File tree

6 files changed

+21
-21
lines changed

6 files changed

+21
-21
lines changed

test/functional/feature_maxuploadtarget.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from test_framework.test_framework import BitcoinTestFramework
1818
from test_framework.util import *
1919

20-
class TestNode(P2PInterface):
20+
class TestP2PConn(P2PInterface):
2121
def __init__(self):
2222
super().__init__()
2323
self.block_receive_map = defaultdict(int)
@@ -55,7 +55,7 @@ def run_test(self):
5555
p2p_conns = []
5656

5757
for _ in range(3):
58-
p2p_conns.append(self.nodes[0].add_p2p_connection(TestNode()))
58+
p2p_conns.append(self.nodes[0].add_p2p_connection(TestP2PConn()))
5959

6060
network_thread_start()
6161
for p2pc in p2p_conns:
@@ -147,7 +147,7 @@ def run_test(self):
147147
self.start_node(0, ["-whitelist=127.0.0.1", "-maxuploadtarget=1", "-blockmaxsize=999000"])
148148

149149
# Reconnect to self.nodes[0]
150-
self.nodes[0].add_p2p_connection(TestNode())
150+
self.nodes[0].add_p2p_connection(TestP2PConn())
151151

152152
network_thread_start()
153153
self.nodes[0].p2p.wait_for_verack()

test/functional/p2p_compactblocks.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
from test_framework.blocktools import create_block, create_coinbase, add_witness_commitment
1515
from test_framework.script import CScript, OP_TRUE
1616

17-
# TestNode: A peer we use to send messages to bitcoind, and store responses.
18-
class TestNode(P2PInterface):
17+
# TestP2PConn: A peer we use to send messages to bitcoind, and store responses.
18+
class TestP2PConn(P2PInterface):
1919
def __init__(self):
2020
super().__init__()
2121
self.last_sendcmpct = []
@@ -788,9 +788,9 @@ def announce_cmpct_block(node, peer):
788788

789789
def run_test(self):
790790
# Setup the p2p connections and start up the network thread.
791-
self.test_node = self.nodes[0].add_p2p_connection(TestNode())
792-
self.segwit_node = self.nodes[1].add_p2p_connection(TestNode(), services=NODE_NETWORK|NODE_WITNESS)
793-
self.old_node = self.nodes[1].add_p2p_connection(TestNode(), services=NODE_NETWORK)
791+
self.test_node = self.nodes[0].add_p2p_connection(TestP2PConn())
792+
self.segwit_node = self.nodes[1].add_p2p_connection(TestP2PConn(), services=NODE_NETWORK|NODE_WITNESS)
793+
self.old_node = self.nodes[1].add_p2p_connection(TestP2PConn(), services=NODE_NETWORK)
794794

795795
network_thread_start()
796796

test/functional/p2p_feefilter.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def allInvsMatch(invsExpected, testnode):
2222
time.sleep(1)
2323
return False
2424

25-
class TestNode(P2PInterface):
25+
class TestP2PConn(P2PInterface):
2626
def __init__(self):
2727
super().__init__()
2828
self.txinvs = []
@@ -48,7 +48,7 @@ def run_test(self):
4848
sync_blocks(self.nodes)
4949

5050
# Setup the p2p connections and start up the network thread.
51-
self.nodes[0].add_p2p_connection(TestNode())
51+
self.nodes[0].add_p2p_connection(TestP2PConn())
5252
network_thread_start()
5353
self.nodes[0].p2p.wait_for_verack()
5454

test/functional/p2p_segwit.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def test_witness_block(rpc, p2p, block, accepted, with_witness=True):
5959
p2p.sync_with_ping()
6060
assert_equal(rpc.getbestblockhash() == block.hash, accepted)
6161

62-
class TestNode(P2PInterface):
62+
class TestP2PConn(P2PInterface):
6363
def __init__(self):
6464
super().__init__()
6565
self.getdataset = set()
@@ -1878,11 +1878,11 @@ def test_non_standard_witness(self):
18781878
def run_test(self):
18791879
# Setup the p2p connections and start up the network thread.
18801880
# self.test_node sets NODE_WITNESS|NODE_NETWORK
1881-
self.test_node = self.nodes[0].add_p2p_connection(TestNode(), services=NODE_NETWORK|NODE_WITNESS)
1881+
self.test_node = self.nodes[0].add_p2p_connection(TestP2PConn(), services=NODE_NETWORK|NODE_WITNESS)
18821882
# self.old_node sets only NODE_NETWORK
1883-
self.old_node = self.nodes[0].add_p2p_connection(TestNode(), services=NODE_NETWORK)
1883+
self.old_node = self.nodes[0].add_p2p_connection(TestP2PConn(), services=NODE_NETWORK)
18841884
# self.std_node is for testing node1 (fRequireStandard=true)
1885-
self.std_node = self.nodes[1].add_p2p_connection(TestNode(), services=NODE_NETWORK|NODE_WITNESS)
1885+
self.std_node = self.nodes[1].add_p2p_connection(TestP2PConn(), services=NODE_NETWORK|NODE_WITNESS)
18861886

18871887
network_thread_start()
18881888

test/functional/p2p_timeouts.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
from test_framework.test_framework import BitcoinTestFramework
2828
from test_framework.util import *
2929

30-
class TestNode(P2PInterface):
30+
class TestP2PConn(P2PInterface):
3131
def on_version(self, message):
3232
# Don't send a verack in response
3333
pass
@@ -39,9 +39,9 @@ def set_test_params(self):
3939

4040
def run_test(self):
4141
# Setup the p2p connections and start up the network thread.
42-
no_verack_node = self.nodes[0].add_p2p_connection(TestNode())
43-
no_version_node = self.nodes[0].add_p2p_connection(TestNode(), send_version=False)
44-
no_send_node = self.nodes[0].add_p2p_connection(TestNode(), send_version=False)
42+
no_verack_node = self.nodes[0].add_p2p_connection(TestP2PConn())
43+
no_version_node = self.nodes[0].add_p2p_connection(TestP2PConn(), send_version=False)
44+
no_send_node = self.nodes[0].add_p2p_connection(TestP2PConn(), send_version=False)
4545

4646
network_thread_start()
4747

test/functional/test_framework/comptool.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
as the test generator to TestManager. get_tests() should be a python
99
generator that returns TestInstance objects. See below for definition.
1010
11-
TestNode behaves as follows:
11+
TestP2PConn behaves as follows:
1212
Configure with a BlockStore and TxStore
1313
on_inv: log the message but don't request
1414
on_headers: log the chain tip
@@ -39,7 +39,7 @@ def match(self, other):
3939
def __repr__(self):
4040
return '%i:%s' % (self.code,self.reason or '*')
4141

42-
class TestNode(P2PInterface):
42+
class TestP2PConn(P2PInterface):
4343

4444
def __init__(self, block_store, tx_store):
4545
super().__init__()
@@ -170,7 +170,7 @@ def __init__(self, testgen, datadir):
170170
def add_all_connections(self, nodes):
171171
for i in range(len(nodes)):
172172
# Create a p2p connection to each node
173-
node = TestNode(self.block_store, self.tx_store)
173+
node = TestP2PConn(self.block_store, self.tx_store)
174174
node.peer_connect('127.0.0.1', p2p_port(i))
175175
self.p2p_connections.append(node)
176176

0 commit comments

Comments
 (0)