Skip to content

Commit fa3b9ee

Browse files
author
MarcoFalke
committed
scripted-diff: test: Replace connect_nodes_bi with connect_nodes
-BEGIN VERIFY SCRIPT- sed -i --regexp-extended -e 's/connect_nodes_bi\(self.nodes,\s*(.),\s*/connect_nodes(self.nodes[\1], /g' $(git grep -l connect_nodes_bi) sed -i --regexp-extended -e 's/connect_nodes_bi(,| )/connect_nodes\1/g' $(git grep -l connect_nodes_bi) -END VERIFY SCRIPT-
1 parent faaee1e commit fa3b9ee

17 files changed

+60
-60
lines changed

test/functional/feature_notifications.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from test_framework.util import (
1111
assert_equal,
1212
wait_until,
13-
connect_nodes_bi,
13+
connect_nodes,
1414
)
1515

1616

@@ -62,7 +62,7 @@ def run_test(self):
6262
self.log.info("test -walletnotify after rescan")
6363
# restart node to rescan to force wallet notifications
6464
self.start_node(1)
65-
connect_nodes_bi(self.nodes, 0, 1)
65+
connect_nodes(self.nodes[0], 1)
6666

6767
wait_until(lambda: len(os.listdir(self.walletnotify_dir)) == block_count, timeout=10)
6868

test/functional/mining_basic.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
from test_framework.util import (
2828
assert_equal,
2929
assert_raises_rpc_error,
30-
connect_nodes_bi,
30+
connect_nodes,
3131
)
3232
from test_framework.script import CScriptNum
3333

@@ -54,7 +54,7 @@ def mine_chain(self):
5454
assert_equal(mining_info['currentblocktx'], 0)
5555
assert_equal(mining_info['currentblockweight'], 4000)
5656
self.restart_node(0)
57-
connect_nodes_bi(self.nodes, 0, 1)
57+
connect_nodes(self.nodes[0], 1)
5858

5959
def run_test(self):
6060
self.mine_chain()

test/functional/p2p_disconnect_ban.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from test_framework.util import (
1010
assert_equal,
1111
assert_raises_rpc_error,
12-
connect_nodes_bi,
12+
connect_nodes,
1313
wait_until,
1414
)
1515

@@ -99,7 +99,7 @@ def run_test(self):
9999
assert not [node for node in self.nodes[0].getpeerinfo() if node['addr'] == address1]
100100

101101
self.log.info("disconnectnode: successfully reconnect node")
102-
connect_nodes_bi(self.nodes, 0, 1) # reconnect the node
102+
connect_nodes(self.nodes[0], 1) # reconnect the node
103103
assert_equal(len(self.nodes[0].getpeerinfo()), 2)
104104
assert [node for node in self.nodes[0].getpeerinfo() if node['addr'] == address1]
105105

test/functional/p2p_node_network_limited.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from test_framework.util import (
1515
assert_equal,
1616
disconnect_nodes,
17-
connect_nodes_bi,
17+
connect_nodes,
1818
wait_until,
1919
)
2020

@@ -64,7 +64,7 @@ def run_test(self):
6464
assert_equal(int(self.nodes[0].getnetworkinfo()['localservices'], 16), expected_services)
6565

6666
self.log.info("Mine enough blocks to reach the NODE_NETWORK_LIMITED range.")
67-
connect_nodes_bi(self.nodes, 0, 1)
67+
connect_nodes(self.nodes[0], 1)
6868
blocks = self.nodes[1].generatetoaddress(292, self.nodes[1].get_deterministic_priv_key().address)
6969
self.sync_blocks([self.nodes[0], self.nodes[1]])
7070

@@ -90,7 +90,7 @@ def run_test(self):
9090

9191
# connect unsynced node 2 with pruned NODE_NETWORK_LIMITED peer
9292
# because node 2 is in IBD and node 0 is a NODE_NETWORK_LIMITED peer, sync must not be possible
93-
connect_nodes_bi(self.nodes, 0, 2)
93+
connect_nodes(self.nodes[0], 2)
9494
try:
9595
self.sync_blocks([self.nodes[0], self.nodes[2]], timeout=5)
9696
except:
@@ -99,7 +99,7 @@ def run_test(self):
9999
assert_equal(self.nodes[2].getblockheader(self.nodes[2].getbestblockhash())['height'], 0)
100100

101101
# now connect also to node 1 (non pruned)
102-
connect_nodes_bi(self.nodes, 1, 2)
102+
connect_nodes(self.nodes[1], 2)
103103

104104
# sync must be possible
105105
self.sync_blocks()
@@ -111,7 +111,7 @@ def run_test(self):
111111
self.nodes[0].generatetoaddress(10, self.nodes[0].get_deterministic_priv_key().address)
112112

113113
# connect node1 (non pruned) with node0 (pruned) and check if the can sync
114-
connect_nodes_bi(self.nodes, 0, 1)
114+
connect_nodes(self.nodes[0], 1)
115115

116116
# sync must be possible, node 1 is no longer in IBD and should therefore connect to node 0 (NODE_NETWORK_LIMITED)
117117
self.sync_blocks([self.nodes[0], self.nodes[1]])

test/functional/rpc_fundrawtransaction.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
assert_greater_than,
1313
assert_greater_than_or_equal,
1414
assert_raises_rpc_error,
15-
connect_nodes_bi,
15+
connect_nodes,
1616
count_bytes,
1717
find_vout_for_address,
1818
)
@@ -35,10 +35,10 @@ def skip_test_if_missing_module(self):
3535
def setup_network(self):
3636
self.setup_nodes()
3737

38-
connect_nodes_bi(self.nodes, 0, 1)
39-
connect_nodes_bi(self.nodes, 1, 2)
40-
connect_nodes_bi(self.nodes, 0, 2)
41-
connect_nodes_bi(self.nodes, 0, 3)
38+
connect_nodes(self.nodes[0], 1)
39+
connect_nodes(self.nodes[1], 2)
40+
connect_nodes(self.nodes[0], 2)
41+
connect_nodes(self.nodes[0], 3)
4242

4343
def run_test(self):
4444
self.min_relay_tx_fee = self.nodes[0].getnetworkinfo()['relayfee']
@@ -508,10 +508,10 @@ def test_locked_wallet(self):
508508
for node in self.nodes:
509509
node.settxfee(self.min_relay_tx_fee)
510510

511-
connect_nodes_bi(self.nodes,0,1)
512-
connect_nodes_bi(self.nodes,1,2)
513-
connect_nodes_bi(self.nodes,0,2)
514-
connect_nodes_bi(self.nodes,0,3)
511+
connect_nodes(self.nodes[0], 1)
512+
connect_nodes(self.nodes[1], 2)
513+
connect_nodes(self.nodes[0], 2)
514+
connect_nodes(self.nodes[0], 3)
515515
# Again lock the watchonly UTXO or nodes[0] may spend it, because
516516
# lockunspent is memory-only and thus lost on restart
517517
self.nodes[0].lockunspent(False, [{"txid": self.watchonly_txid, "vout": self.watchonly_vout}])

test/functional/rpc_net.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
assert_greater_than_or_equal,
1616
assert_greater_than,
1717
assert_raises_rpc_error,
18-
connect_nodes_bi,
18+
connect_nodes,
1919
p2p_port,
2020
wait_until,
2121
)
@@ -66,7 +66,7 @@ def run_test(self):
6666
self._test_getnodeaddresses()
6767

6868
def _test_connection_count(self):
69-
# connect_nodes_bi connects each node to the other
69+
# connect_nodes connects each node to the other
7070
assert_equal(self.nodes[0].getconnectioncount(), 2)
7171

7272
def _test_getnettotals(self):

test/functional/rpc_preciousblock.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from test_framework.test_framework import BitcoinTestFramework
88
from test_framework.util import (
99
assert_equal,
10-
connect_nodes_bi,
10+
connect_nodes,
1111
)
1212

1313
def unidirectional_node_sync_via_rpc(node_src, node_dest):
@@ -60,7 +60,7 @@ def run_test(self):
6060
self.log.info("Connect nodes and check no reorg occurs")
6161
# Submit competing blocks via RPC so any reorg should occur before we proceed (no way to wait on inaction for p2p sync)
6262
node_sync_via_rpc(self.nodes[0:2])
63-
connect_nodes_bi(self.nodes,0,1)
63+
connect_nodes(self.nodes[0], 1)
6464
assert_equal(self.nodes[0].getbestblockhash(), hashC)
6565
assert_equal(self.nodes[1].getbestblockhash(), hashG)
6666
self.log.info("Make Node0 prefer block G")
@@ -97,8 +97,8 @@ def run_test(self):
9797
hashL = self.nodes[2].getbestblockhash()
9898
self.log.info("Connect nodes and check no reorg occurs")
9999
node_sync_via_rpc(self.nodes[1:3])
100-
connect_nodes_bi(self.nodes,1,2)
101-
connect_nodes_bi(self.nodes,0,2)
100+
connect_nodes(self.nodes[1], 2)
101+
connect_nodes(self.nodes[0], 2)
102102
assert_equal(self.nodes[0].getbestblockhash(), hashH)
103103
assert_equal(self.nodes[1].getbestblockhash(), hashH)
104104
assert_equal(self.nodes[2].getbestblockhash(), hashL)

test/functional/rpc_psbt.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
assert_equal,
1212
assert_greater_than,
1313
assert_raises_rpc_error,
14-
connect_nodes_bi,
14+
connect_nodes,
1515
disconnect_nodes,
1616
find_output,
1717
)
@@ -72,8 +72,8 @@ def test_utxo_conversion(self):
7272
assert_equal(online_node.gettxout(txid,0)["confirmations"], 1)
7373

7474
# Reconnect
75-
connect_nodes_bi(self.nodes, 0, 1)
76-
connect_nodes_bi(self.nodes, 0, 2)
75+
connect_nodes(self.nodes[0], 1)
76+
connect_nodes(self.nodes[0], 2)
7777

7878
def run_test(self):
7979
# Create and fund a raw tx for sending 10 BTC

test/functional/rpc_rawtransaction.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from test_framework.util import (
2121
assert_equal,
2222
assert_raises_rpc_error,
23-
connect_nodes_bi,
23+
connect_nodes,
2424
hex_str_to_bytes,
2525
)
2626

@@ -59,7 +59,7 @@ def skip_test_if_missing_module(self):
5959

6060
def setup_network(self):
6161
super().setup_network()
62-
connect_nodes_bi(self.nodes, 0, 2)
62+
connect_nodes(self.nodes[0], 2)
6363

6464
def run_test(self):
6565
self.log.info('prepare some coins for multiple *rawtransaction commands')

test/functional/test_framework/test_framework.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
PortSeed,
2626
assert_equal,
2727
check_json_precision,
28-
connect_nodes_bi,
28+
connect_nodes,
2929
disconnect_nodes,
3030
get_datadir_path,
3131
initialize_datadir,
@@ -433,7 +433,7 @@ def join_network(self):
433433
"""
434434
Join the (previously split) network halves together.
435435
"""
436-
connect_nodes_bi(self.nodes, 1, 2)
436+
connect_nodes(self.nodes[1], 2)
437437
self.sync_all()
438438

439439
def sync_blocks(self, nodes=None, **kwargs):

0 commit comments

Comments
 (0)