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".
pull/764/head
Elliott Jin 4 years ago
parent f5bd46a4cc
commit be386840d4

@ -11,9 +11,7 @@ from test_framework.p2p import P2PTxInvStore
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import (
assert_equal,
connect_nodes,
create_confirmed_utxos,
disconnect_nodes,
)
MAX_INITIAL_BROADCAST_DELAY = 15 * 60 # 15 minutes in seconds
@ -36,7 +34,7 @@ class MempoolUnbroadcastTest(BitcoinTestFramework):
min_relay_fee = node.getnetworkinfo()["relayfee"]
utxos = create_confirmed_utxos(min_relay_fee, node, 10)
disconnect_nodes(node, 1)
self.disconnect_nodes(0, 1)
self.log.info("Generate transactions that only node 0 knows about")
@ -70,7 +68,7 @@ class MempoolUnbroadcastTest(BitcoinTestFramework):
self.restart_node(0)
self.log.info("Reconnect nodes & check if they are sent to node 1")
connect_nodes(node, 1)
self.connect_nodes(0, 1)
# fast forward into the future & ensure that the second node has the txns
node.mockscheduler(MAX_INITIAL_BROADCAST_DELAY)
@ -91,7 +89,7 @@ class MempoolUnbroadcastTest(BitcoinTestFramework):
time.sleep(2) # allow sufficient time for possibility of broadcast
assert_equal(len(conn.get_invs()), 0)
disconnect_nodes(node, 1)
self.disconnect_nodes(0, 1)
node.disconnect_p2ps()
def test_txn_removal(self):

@ -13,7 +13,6 @@ from test_framework.util import (
assert_greater_than,
assert_raises_rpc_error,
connect_nodes,
disconnect_nodes,
find_output,
)
@ -46,7 +45,7 @@ class PSBTTest(BitcoinTestFramework):
# Disconnect offline node from others
# Topology of test network is linear, so this one call is enough
disconnect_nodes(offline_node, 1)
self.disconnect_nodes(0, 1)
# Create watchonly on online_node
online_node.createwallet(wallet_name='wonline', disable_private_keys=True)

Loading…
Cancel
Save