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-
This commit is contained in:
parent
faaee1e39a
commit
fa3b9ee8b2
17 changed files with 60 additions and 60 deletions
|
@ -10,7 +10,7 @@ from test_framework.test_framework import BitcoinTestFramework
|
|||
from test_framework.util import (
|
||||
assert_equal,
|
||||
wait_until,
|
||||
connect_nodes_bi,
|
||||
connect_nodes,
|
||||
)
|
||||
|
||||
|
||||
|
@ -62,7 +62,7 @@ class NotificationsTest(BitcoinTestFramework):
|
|||
self.log.info("test -walletnotify after rescan")
|
||||
# restart node to rescan to force wallet notifications
|
||||
self.start_node(1)
|
||||
connect_nodes_bi(self.nodes, 0, 1)
|
||||
connect_nodes(self.nodes[0], 1)
|
||||
|
||||
wait_until(lambda: len(os.listdir(self.walletnotify_dir)) == block_count, timeout=10)
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ from test_framework.test_framework import BitcoinTestFramework
|
|||
from test_framework.util import (
|
||||
assert_equal,
|
||||
assert_raises_rpc_error,
|
||||
connect_nodes_bi,
|
||||
connect_nodes,
|
||||
)
|
||||
from test_framework.script import CScriptNum
|
||||
|
||||
|
@ -54,7 +54,7 @@ class MiningTest(BitcoinTestFramework):
|
|||
assert_equal(mining_info['currentblocktx'], 0)
|
||||
assert_equal(mining_info['currentblockweight'], 4000)
|
||||
self.restart_node(0)
|
||||
connect_nodes_bi(self.nodes, 0, 1)
|
||||
connect_nodes(self.nodes[0], 1)
|
||||
|
||||
def run_test(self):
|
||||
self.mine_chain()
|
||||
|
|
|
@ -9,7 +9,7 @@ from test_framework.test_framework import BitcoinTestFramework
|
|||
from test_framework.util import (
|
||||
assert_equal,
|
||||
assert_raises_rpc_error,
|
||||
connect_nodes_bi,
|
||||
connect_nodes,
|
||||
wait_until,
|
||||
)
|
||||
|
||||
|
@ -99,7 +99,7 @@ class DisconnectBanTest(BitcoinTestFramework):
|
|||
assert not [node for node in self.nodes[0].getpeerinfo() if node['addr'] == address1]
|
||||
|
||||
self.log.info("disconnectnode: successfully reconnect node")
|
||||
connect_nodes_bi(self.nodes, 0, 1) # reconnect the node
|
||||
connect_nodes(self.nodes[0], 1) # reconnect the node
|
||||
assert_equal(len(self.nodes[0].getpeerinfo()), 2)
|
||||
assert [node for node in self.nodes[0].getpeerinfo() if node['addr'] == address1]
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ from test_framework.test_framework import BitcoinTestFramework
|
|||
from test_framework.util import (
|
||||
assert_equal,
|
||||
disconnect_nodes,
|
||||
connect_nodes_bi,
|
||||
connect_nodes,
|
||||
wait_until,
|
||||
)
|
||||
|
||||
|
@ -64,7 +64,7 @@ class NodeNetworkLimitedTest(BitcoinTestFramework):
|
|||
assert_equal(int(self.nodes[0].getnetworkinfo()['localservices'], 16), expected_services)
|
||||
|
||||
self.log.info("Mine enough blocks to reach the NODE_NETWORK_LIMITED range.")
|
||||
connect_nodes_bi(self.nodes, 0, 1)
|
||||
connect_nodes(self.nodes[0], 1)
|
||||
blocks = self.nodes[1].generatetoaddress(292, self.nodes[1].get_deterministic_priv_key().address)
|
||||
self.sync_blocks([self.nodes[0], self.nodes[1]])
|
||||
|
||||
|
@ -90,7 +90,7 @@ class NodeNetworkLimitedTest(BitcoinTestFramework):
|
|||
|
||||
# connect unsynced node 2 with pruned NODE_NETWORK_LIMITED peer
|
||||
# because node 2 is in IBD and node 0 is a NODE_NETWORK_LIMITED peer, sync must not be possible
|
||||
connect_nodes_bi(self.nodes, 0, 2)
|
||||
connect_nodes(self.nodes[0], 2)
|
||||
try:
|
||||
self.sync_blocks([self.nodes[0], self.nodes[2]], timeout=5)
|
||||
except:
|
||||
|
@ -99,7 +99,7 @@ class NodeNetworkLimitedTest(BitcoinTestFramework):
|
|||
assert_equal(self.nodes[2].getblockheader(self.nodes[2].getbestblockhash())['height'], 0)
|
||||
|
||||
# now connect also to node 1 (non pruned)
|
||||
connect_nodes_bi(self.nodes, 1, 2)
|
||||
connect_nodes(self.nodes[1], 2)
|
||||
|
||||
# sync must be possible
|
||||
self.sync_blocks()
|
||||
|
@ -111,7 +111,7 @@ class NodeNetworkLimitedTest(BitcoinTestFramework):
|
|||
self.nodes[0].generatetoaddress(10, self.nodes[0].get_deterministic_priv_key().address)
|
||||
|
||||
# connect node1 (non pruned) with node0 (pruned) and check if the can sync
|
||||
connect_nodes_bi(self.nodes, 0, 1)
|
||||
connect_nodes(self.nodes[0], 1)
|
||||
|
||||
# sync must be possible, node 1 is no longer in IBD and should therefore connect to node 0 (NODE_NETWORK_LIMITED)
|
||||
self.sync_blocks([self.nodes[0], self.nodes[1]])
|
||||
|
|
|
@ -12,7 +12,7 @@ from test_framework.util import (
|
|||
assert_greater_than,
|
||||
assert_greater_than_or_equal,
|
||||
assert_raises_rpc_error,
|
||||
connect_nodes_bi,
|
||||
connect_nodes,
|
||||
count_bytes,
|
||||
find_vout_for_address,
|
||||
)
|
||||
|
@ -35,10 +35,10 @@ class RawTransactionsTest(BitcoinTestFramework):
|
|||
def setup_network(self):
|
||||
self.setup_nodes()
|
||||
|
||||
connect_nodes_bi(self.nodes, 0, 1)
|
||||
connect_nodes_bi(self.nodes, 1, 2)
|
||||
connect_nodes_bi(self.nodes, 0, 2)
|
||||
connect_nodes_bi(self.nodes, 0, 3)
|
||||
connect_nodes(self.nodes[0], 1)
|
||||
connect_nodes(self.nodes[1], 2)
|
||||
connect_nodes(self.nodes[0], 2)
|
||||
connect_nodes(self.nodes[0], 3)
|
||||
|
||||
def run_test(self):
|
||||
self.min_relay_tx_fee = self.nodes[0].getnetworkinfo()['relayfee']
|
||||
|
@ -508,10 +508,10 @@ class RawTransactionsTest(BitcoinTestFramework):
|
|||
for node in self.nodes:
|
||||
node.settxfee(self.min_relay_tx_fee)
|
||||
|
||||
connect_nodes_bi(self.nodes,0,1)
|
||||
connect_nodes_bi(self.nodes,1,2)
|
||||
connect_nodes_bi(self.nodes,0,2)
|
||||
connect_nodes_bi(self.nodes,0,3)
|
||||
connect_nodes(self.nodes[0], 1)
|
||||
connect_nodes(self.nodes[1], 2)
|
||||
connect_nodes(self.nodes[0], 2)
|
||||
connect_nodes(self.nodes[0], 3)
|
||||
# Again lock the watchonly UTXO or nodes[0] may spend it, because
|
||||
# lockunspent is memory-only and thus lost on restart
|
||||
self.nodes[0].lockunspent(False, [{"txid": self.watchonly_txid, "vout": self.watchonly_vout}])
|
||||
|
|
|
@ -15,7 +15,7 @@ from test_framework.util import (
|
|||
assert_greater_than_or_equal,
|
||||
assert_greater_than,
|
||||
assert_raises_rpc_error,
|
||||
connect_nodes_bi,
|
||||
connect_nodes,
|
||||
p2p_port,
|
||||
wait_until,
|
||||
)
|
||||
|
@ -66,7 +66,7 @@ class NetTest(BitcoinTestFramework):
|
|||
self._test_getnodeaddresses()
|
||||
|
||||
def _test_connection_count(self):
|
||||
# connect_nodes_bi connects each node to the other
|
||||
# connect_nodes connects each node to the other
|
||||
assert_equal(self.nodes[0].getconnectioncount(), 2)
|
||||
|
||||
def _test_getnettotals(self):
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.util import (
|
||||
assert_equal,
|
||||
connect_nodes_bi,
|
||||
connect_nodes,
|
||||
)
|
||||
|
||||
def unidirectional_node_sync_via_rpc(node_src, node_dest):
|
||||
|
@ -60,7 +60,7 @@ class PreciousTest(BitcoinTestFramework):
|
|||
self.log.info("Connect nodes and check no reorg occurs")
|
||||
# Submit competing blocks via RPC so any reorg should occur before we proceed (no way to wait on inaction for p2p sync)
|
||||
node_sync_via_rpc(self.nodes[0:2])
|
||||
connect_nodes_bi(self.nodes,0,1)
|
||||
connect_nodes(self.nodes[0], 1)
|
||||
assert_equal(self.nodes[0].getbestblockhash(), hashC)
|
||||
assert_equal(self.nodes[1].getbestblockhash(), hashG)
|
||||
self.log.info("Make Node0 prefer block G")
|
||||
|
@ -97,8 +97,8 @@ class PreciousTest(BitcoinTestFramework):
|
|||
hashL = self.nodes[2].getbestblockhash()
|
||||
self.log.info("Connect nodes and check no reorg occurs")
|
||||
node_sync_via_rpc(self.nodes[1:3])
|
||||
connect_nodes_bi(self.nodes,1,2)
|
||||
connect_nodes_bi(self.nodes,0,2)
|
||||
connect_nodes(self.nodes[1], 2)
|
||||
connect_nodes(self.nodes[0], 2)
|
||||
assert_equal(self.nodes[0].getbestblockhash(), hashH)
|
||||
assert_equal(self.nodes[1].getbestblockhash(), hashH)
|
||||
assert_equal(self.nodes[2].getbestblockhash(), hashL)
|
||||
|
|
|
@ -11,7 +11,7 @@ from test_framework.util import (
|
|||
assert_equal,
|
||||
assert_greater_than,
|
||||
assert_raises_rpc_error,
|
||||
connect_nodes_bi,
|
||||
connect_nodes,
|
||||
disconnect_nodes,
|
||||
find_output,
|
||||
)
|
||||
|
@ -72,8 +72,8 @@ class PSBTTest(BitcoinTestFramework):
|
|||
assert_equal(online_node.gettxout(txid,0)["confirmations"], 1)
|
||||
|
||||
# Reconnect
|
||||
connect_nodes_bi(self.nodes, 0, 1)
|
||||
connect_nodes_bi(self.nodes, 0, 2)
|
||||
connect_nodes(self.nodes[0], 1)
|
||||
connect_nodes(self.nodes[0], 2)
|
||||
|
||||
def run_test(self):
|
||||
# Create and fund a raw tx for sending 10 BTC
|
||||
|
|
|
@ -20,7 +20,7 @@ from test_framework.test_framework import BitcoinTestFramework
|
|||
from test_framework.util import (
|
||||
assert_equal,
|
||||
assert_raises_rpc_error,
|
||||
connect_nodes_bi,
|
||||
connect_nodes,
|
||||
hex_str_to_bytes,
|
||||
)
|
||||
|
||||
|
@ -59,7 +59,7 @@ class RawTransactionsTest(BitcoinTestFramework):
|
|||
|
||||
def setup_network(self):
|
||||
super().setup_network()
|
||||
connect_nodes_bi(self.nodes, 0, 2)
|
||||
connect_nodes(self.nodes[0], 2)
|
||||
|
||||
def run_test(self):
|
||||
self.log.info('prepare some coins for multiple *rawtransaction commands')
|
||||
|
|
|
@ -25,7 +25,7 @@ from .util import (
|
|||
PortSeed,
|
||||
assert_equal,
|
||||
check_json_precision,
|
||||
connect_nodes_bi,
|
||||
connect_nodes,
|
||||
disconnect_nodes,
|
||||
get_datadir_path,
|
||||
initialize_datadir,
|
||||
|
@ -433,7 +433,7 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
|
|||
"""
|
||||
Join the (previously split) network halves together.
|
||||
"""
|
||||
connect_nodes_bi(self.nodes, 1, 2)
|
||||
connect_nodes(self.nodes[1], 2)
|
||||
self.sync_all()
|
||||
|
||||
def sync_blocks(self, nodes=None, **kwargs):
|
||||
|
|
|
@ -62,7 +62,7 @@ from test_framework.util import (
|
|||
assert_equal,
|
||||
assert_greater_than,
|
||||
assert_raises_rpc_error,
|
||||
connect_nodes_bi,
|
||||
connect_nodes,
|
||||
)
|
||||
|
||||
|
||||
|
@ -87,7 +87,7 @@ class AddressTypeTest(BitcoinTestFramework):
|
|||
# Fully mesh-connect nodes for faster mempool sync
|
||||
for i, j in itertools.product(range(self.num_nodes), repeat=2):
|
||||
if i > j:
|
||||
connect_nodes_bi(self.nodes, i, j)
|
||||
connect_nodes(self.nodes[i], j)
|
||||
self.sync_all()
|
||||
|
||||
def get_balances(self, confirmed=True):
|
||||
|
|
|
@ -8,7 +8,7 @@ from test_framework.test_framework import BitcoinTestFramework
|
|||
from test_framework.util import (
|
||||
assert_equal,
|
||||
assert_raises_rpc_error,
|
||||
connect_nodes_bi,
|
||||
connect_nodes,
|
||||
)
|
||||
|
||||
# TODO: Copied from wallet_groups.py -- should perhaps move into util.py
|
||||
|
@ -103,7 +103,7 @@ class AvoidReuseTest(BitcoinTestFramework):
|
|||
# Stop and restart node 1
|
||||
self.stop_node(1)
|
||||
self.start_node(1)
|
||||
connect_nodes_bi(self.nodes, 0, 1)
|
||||
connect_nodes(self.nodes[0], 1)
|
||||
|
||||
# Flags should still be node1.avoid_reuse=false, node2.avoid_reuse=true
|
||||
assert_equal(self.nodes[0].getwalletinfo()["avoid_reuse"], False)
|
||||
|
|
|
@ -11,7 +11,7 @@ from test_framework.test_framework import BitcoinTestFramework
|
|||
from test_framework.util import (
|
||||
assert_equal,
|
||||
assert_raises_rpc_error,
|
||||
connect_nodes_bi,
|
||||
connect_nodes,
|
||||
sync_blocks,
|
||||
)
|
||||
|
||||
|
@ -211,7 +211,7 @@ class WalletTest(BitcoinTestFramework):
|
|||
|
||||
# Now confirm tx_orig
|
||||
self.restart_node(1, ['-persistmempool=0'])
|
||||
connect_nodes_bi(self.nodes, 0, 1)
|
||||
connect_nodes(self.nodes[0], 1)
|
||||
sync_blocks(self.nodes)
|
||||
self.nodes[1].sendrawtransaction(tx_orig)
|
||||
self.nodes[1].generatetoaddress(1, ADDRESS_WATCHONLY)
|
||||
|
|
|
@ -12,7 +12,7 @@ from test_framework.util import (
|
|||
assert_equal,
|
||||
assert_fee_amount,
|
||||
assert_raises_rpc_error,
|
||||
connect_nodes_bi,
|
||||
connect_nodes,
|
||||
wait_until,
|
||||
)
|
||||
|
||||
|
@ -32,9 +32,9 @@ class WalletTest(BitcoinTestFramework):
|
|||
self.setup_nodes()
|
||||
# Only need nodes 0-2 running at start of test
|
||||
self.stop_node(3)
|
||||
connect_nodes_bi(self.nodes, 0, 1)
|
||||
connect_nodes_bi(self.nodes, 1, 2)
|
||||
connect_nodes_bi(self.nodes, 0, 2)
|
||||
connect_nodes(self.nodes[0], 1)
|
||||
connect_nodes(self.nodes[1], 2)
|
||||
connect_nodes(self.nodes[0], 2)
|
||||
self.sync_all(self.nodes[0:3])
|
||||
|
||||
def check_fee_amount(self, curr_balance, balance_with_fee, fee_per_byte, tx_size):
|
||||
|
@ -218,7 +218,7 @@ class WalletTest(BitcoinTestFramework):
|
|||
node_0_bal = self.check_fee_amount(self.nodes[0].getbalance(), node_0_bal + Decimal('10'), fee_per_byte, self.get_vsize(self.nodes[2].gettransaction(txid)['hex']))
|
||||
|
||||
self.start_node(3)
|
||||
connect_nodes_bi(self.nodes, 0, 3)
|
||||
connect_nodes(self.nodes[0], 3)
|
||||
self.sync_all()
|
||||
|
||||
# check if we can list zero value tx as available coins
|
||||
|
@ -253,9 +253,9 @@ class WalletTest(BitcoinTestFramework):
|
|||
self.start_node(0, ["-walletbroadcast=0"])
|
||||
self.start_node(1, ["-walletbroadcast=0"])
|
||||
self.start_node(2, ["-walletbroadcast=0"])
|
||||
connect_nodes_bi(self.nodes, 0, 1)
|
||||
connect_nodes_bi(self.nodes, 1, 2)
|
||||
connect_nodes_bi(self.nodes, 0, 2)
|
||||
connect_nodes(self.nodes[0], 1)
|
||||
connect_nodes(self.nodes[1], 2)
|
||||
connect_nodes(self.nodes[0], 2)
|
||||
self.sync_all(self.nodes[0:3])
|
||||
|
||||
txid_not_broadcast = self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(), 2)
|
||||
|
@ -280,9 +280,9 @@ class WalletTest(BitcoinTestFramework):
|
|||
self.start_node(0)
|
||||
self.start_node(1)
|
||||
self.start_node(2)
|
||||
connect_nodes_bi(self.nodes, 0, 1)
|
||||
connect_nodes_bi(self.nodes, 1, 2)
|
||||
connect_nodes_bi(self.nodes, 0, 2)
|
||||
connect_nodes(self.nodes[0], 1)
|
||||
connect_nodes(self.nodes[1], 2)
|
||||
connect_nodes(self.nodes[0], 2)
|
||||
self.sync_blocks(self.nodes[0:3])
|
||||
|
||||
self.nodes[0].generate(1)
|
||||
|
|
|
@ -23,7 +23,7 @@ from test_framework.util import (
|
|||
assert_equal,
|
||||
assert_greater_than,
|
||||
assert_raises_rpc_error,
|
||||
connect_nodes_bi,
|
||||
connect_nodes,
|
||||
hex_str_to_bytes,
|
||||
)
|
||||
|
||||
|
@ -48,7 +48,7 @@ class BumpFeeTest(BitcoinTestFramework):
|
|||
self.nodes[1].encryptwallet(WALLET_PASSPHRASE)
|
||||
self.nodes[1].walletpassphrase(WALLET_PASSPHRASE, WALLET_PASSPHRASE_TIMEOUT)
|
||||
|
||||
connect_nodes_bi(self.nodes, 0, 1)
|
||||
connect_nodes(self.nodes[0], 1)
|
||||
self.sync_all()
|
||||
|
||||
peer_node, rbf_node = self.nodes
|
||||
|
|
|
@ -10,7 +10,7 @@ import shutil
|
|||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.util import (
|
||||
assert_equal,
|
||||
connect_nodes_bi,
|
||||
connect_nodes,
|
||||
assert_raises_rpc_error
|
||||
)
|
||||
|
||||
|
@ -82,7 +82,7 @@ class WalletHDTest(BitcoinTestFramework):
|
|||
assert_equal(hd_info_2["hdkeypath"], "m/0'/0'/"+str(i)+"'")
|
||||
assert_equal(hd_info_2["hdseedid"], masterkeyid)
|
||||
assert_equal(hd_add, hd_add_2)
|
||||
connect_nodes_bi(self.nodes, 0, 1)
|
||||
connect_nodes(self.nodes[0], 1)
|
||||
self.sync_all()
|
||||
|
||||
# Needs rescan
|
||||
|
@ -96,7 +96,7 @@ class WalletHDTest(BitcoinTestFramework):
|
|||
shutil.rmtree(os.path.join(self.nodes[1].datadir, "regtest", "chainstate"))
|
||||
shutil.copyfile(os.path.join(self.nodes[1].datadir, "hd.bak"), os.path.join(self.nodes[1].datadir, "regtest", "wallets", "wallet.dat"))
|
||||
self.start_node(1, extra_args=self.extra_args[1])
|
||||
connect_nodes_bi(self.nodes, 0, 1)
|
||||
connect_nodes(self.nodes[0], 1)
|
||||
self.sync_all()
|
||||
# Wallet automatically scans blocks older than key on startup
|
||||
assert_equal(self.nodes[1].getbalance(), NUM_HD_ADDS + 1)
|
||||
|
|
|
@ -16,7 +16,7 @@ import shutil
|
|||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.util import (
|
||||
assert_equal,
|
||||
connect_nodes_bi,
|
||||
connect_nodes,
|
||||
)
|
||||
|
||||
|
||||
|
@ -38,9 +38,9 @@ class KeypoolRestoreTest(BitcoinTestFramework):
|
|||
self.stop_node(1)
|
||||
shutil.copyfile(wallet_path, wallet_backup_path)
|
||||
self.start_node(1, self.extra_args[1])
|
||||
connect_nodes_bi(self.nodes, 0, 1)
|
||||
connect_nodes_bi(self.nodes, 0, 2)
|
||||
connect_nodes_bi(self.nodes, 0, 3)
|
||||
connect_nodes(self.nodes[0], 1)
|
||||
connect_nodes(self.nodes[0], 2)
|
||||
connect_nodes(self.nodes[0], 3)
|
||||
|
||||
for i, output_type in enumerate(["legacy", "p2sh-segwit", "bech32"]):
|
||||
|
||||
|
@ -72,7 +72,7 @@ class KeypoolRestoreTest(BitcoinTestFramework):
|
|||
self.stop_node(idx)
|
||||
shutil.copyfile(wallet_backup_path, wallet_path)
|
||||
self.start_node(idx, self.extra_args[idx])
|
||||
connect_nodes_bi(self.nodes, 0, idx)
|
||||
connect_nodes(self.nodes[0], idx)
|
||||
self.sync_all()
|
||||
|
||||
self.log.info("Verify keypool is restored and balance is correct")
|
||||
|
|
Loading…
Add table
Reference in a new issue