Skip to content

Commit be38684

Browse files
committed
test: Replace use of (dis)?connect_nodes globals
A later scripted-diff commit replaces the majority of uses, which all follow this pattern: (dis)?connect_nodes(self.nodes[a], b) This commit replaces the few "special cases".
1 parent f5bd46a commit be38684

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

test/functional/mempool_unbroadcast.py

+3-5
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@
1111
from test_framework.test_framework import BitcoinTestFramework
1212
from test_framework.util import (
1313
assert_equal,
14-
connect_nodes,
1514
create_confirmed_utxos,
16-
disconnect_nodes,
1715
)
1816

1917
MAX_INITIAL_BROADCAST_DELAY = 15 * 60 # 15 minutes in seconds
@@ -36,7 +34,7 @@ def test_broadcast(self):
3634
min_relay_fee = node.getnetworkinfo()["relayfee"]
3735
utxos = create_confirmed_utxos(min_relay_fee, node, 10)
3836

39-
disconnect_nodes(node, 1)
37+
self.disconnect_nodes(0, 1)
4038

4139
self.log.info("Generate transactions that only node 0 knows about")
4240

@@ -70,7 +68,7 @@ def test_broadcast(self):
7068
self.restart_node(0)
7169

7270
self.log.info("Reconnect nodes & check if they are sent to node 1")
73-
connect_nodes(node, 1)
71+
self.connect_nodes(0, 1)
7472

7573
# fast forward into the future & ensure that the second node has the txns
7674
node.mockscheduler(MAX_INITIAL_BROADCAST_DELAY)
@@ -91,7 +89,7 @@ def test_broadcast(self):
9189
time.sleep(2) # allow sufficient time for possibility of broadcast
9290
assert_equal(len(conn.get_invs()), 0)
9391

94-
disconnect_nodes(node, 1)
92+
self.disconnect_nodes(0, 1)
9593
node.disconnect_p2ps()
9694

9795
def test_txn_removal(self):

test/functional/rpc_psbt.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
assert_greater_than,
1414
assert_raises_rpc_error,
1515
connect_nodes,
16-
disconnect_nodes,
1716
find_output,
1817
)
1918

@@ -46,7 +45,7 @@ def test_utxo_conversion(self):
4645

4746
# Disconnect offline node from others
4847
# Topology of test network is linear, so this one call is enough
49-
disconnect_nodes(offline_node, 1)
48+
self.disconnect_nodes(0, 1)
5049

5150
# Create watchonly on online_node
5251
online_node.createwallet(wallet_name='wonline', disable_private_keys=True)

0 commit comments

Comments
 (0)