mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-13 11:35:20 +01:00
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".
This commit is contained in:
parent
f5bd46a4cc
commit
be386840d4
2 changed files with 4 additions and 7 deletions
|
@ -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…
Add table
Reference in a new issue