Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F13115687
D6151.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
8 KB
Subscribers
None
D6151.diff
View Options
diff --git a/test/functional/example_test.py b/test/functional/example_test.py
--- a/test/functional/example_test.py
+++ b/test/functional/example_test.py
@@ -120,7 +120,7 @@
# sync_all() should not include node2, since we're not expecting it to
# sync.
connect_nodes(self.nodes[0], self.nodes[1])
- self.sync_all([self.nodes[0:2]])
+ self.sync_all(self.nodes[0:2])
# Use setup_nodes() to customize the node start behaviour (for example if
# you don't want to start all nodes at the start of the test).
@@ -145,7 +145,7 @@
# Generating a block on one of the nodes will get us out of IBD
blocks = [int(self.nodes[0].generate(nblocks=1)[0], 16)]
- self.sync_all([self.nodes[0:2]])
+ self.sync_all(self.nodes[0:2])
# Notice above how we called an RPC by calling a method with the same
# name on the node object. Notice also how we used a keyword argument
diff --git a/test/functional/rpc_getchaintips.py b/test/functional/rpc_getchaintips.py
--- a/test/functional/rpc_getchaintips.py
+++ b/test/functional/rpc_getchaintips.py
@@ -32,7 +32,8 @@
10, self.nodes[0].get_deterministic_priv_key().address)
self.nodes[2].generatetoaddress(
20, self.nodes[2].get_deterministic_priv_key().address)
- self.sync_all([self.nodes[:2], self.nodes[2:]])
+ self.sync_all(self.nodes[:2])
+ self.sync_all(self.nodes[2:])
tips = self.nodes[1].getchaintips()
assert_equal(len(tips), 1)
diff --git a/test/functional/test_framework/test_framework.py b/test/functional/test_framework/test_framework.py
--- a/test/functional/test_framework/test_framework.py
+++ b/test/functional/test_framework/test_framework.py
@@ -389,7 +389,8 @@
"""
disconnect_nodes(self.nodes[1], self.nodes[2])
disconnect_nodes(self.nodes[2], self.nodes[1])
- self.sync_all([self.nodes[:2], self.nodes[2:]])
+ self.sync_all(self.nodes[:2])
+ self.sync_all(self.nodes[2:])
def join_network(self):
"""
@@ -398,13 +399,9 @@
connect_nodes_bi(self.nodes[1], self.nodes[2])
self.sync_all()
- def sync_all(self, node_groups=None):
- if not node_groups:
- node_groups = [self.nodes]
-
- for group in node_groups:
- sync_blocks(group)
- sync_mempools(group)
+ def sync_all(self, nodes=None, **kwargs):
+ sync_blocks(nodes or self.nodes, **kwargs)
+ sync_mempools(nodes or self.nodes, **kwargs)
# Private helper methods. These should not be accessed by the subclass
# test scripts.
diff --git a/test/functional/wallet_basic.py b/test/functional/wallet_basic.py
--- a/test/functional/wallet_basic.py
+++ b/test/functional/wallet_basic.py
@@ -38,7 +38,7 @@
connect_nodes_bi(self.nodes[0], self.nodes[1])
connect_nodes_bi(self.nodes[1], self.nodes[2])
connect_nodes_bi(self.nodes[0], self.nodes[2])
- self.sync_all([self.nodes[0:3]])
+ self.sync_all(self.nodes[0:3])
def check_fee_amount(self, curr_balance,
balance_with_fee, fee_per_byte, tx_size):
@@ -61,9 +61,9 @@
assert_equal(walletinfo['immature_balance'], 50)
assert_equal(walletinfo['balance'], 0)
- self.sync_all([self.nodes[0:3]])
+ self.sync_all(self.nodes[0:3])
self.nodes[1].generate(101)
- self.sync_all([self.nodes[0:3]])
+ self.sync_all(self.nodes[0:3])
assert_equal(self.nodes[0].getbalance(), 50)
assert_equal(self.nodes[1].getbalance(), 50)
@@ -114,7 +114,7 @@
# Have node0 mine a block, thus it will collect its own fee.
self.nodes[0].generate(1)
- self.sync_all([self.nodes[0:3]])
+ self.sync_all(self.nodes[0:3])
# Exercise locking of unspent outputs
unspent_0 = self.nodes[2].listunspent()[0]
@@ -143,7 +143,7 @@
# Have node1 generate 100 blocks (so node0 can recover the fee)
self.nodes[1].generate(100)
- self.sync_all([self.nodes[0:3]])
+ self.sync_all(self.nodes[0:3])
# node0 should end up with 100 btc in block rewards plus fees, but
# minus the 21 plus fees sent to node2
@@ -173,7 +173,7 @@
# Have node1 mine a block to confirm transactions:
self.nodes[1].generate(1)
- self.sync_all([self.nodes[0:3]])
+ self.sync_all(self.nodes[0:3])
assert_equal(self.nodes[0].getbalance(), 0)
assert_equal(self.nodes[2].getbalance(), 94)
@@ -191,7 +191,7 @@
self.nodes[2].settxfee(fee_per_byte * 1000)
txid = self.nodes[2].sendtoaddress(address, 10, "", "", False)
self.nodes[2].generate(1)
- self.sync_all([self.nodes[0:3]])
+ self.sync_all(self.nodes[0:3])
ctx = FromHex(CTransaction(),
self.nodes[2].gettransaction(txid)['hex'])
@@ -202,7 +202,7 @@
# Send 10 BCH with subtract fee from amount
txid = self.nodes[2].sendtoaddress(address, 10, "", "", True)
self.nodes[2].generate(1)
- self.sync_all([self.nodes[0:3]])
+ self.sync_all(self.nodes[0:3])
node_2_bal -= Decimal('10')
assert_equal(self.nodes[2].getbalance(), node_2_bal)
node_0_bal = self.check_fee_amount(self.nodes[0].getbalance(), Decimal(
@@ -211,7 +211,7 @@
# Sendmany 10 BCH
txid = self.nodes[2].sendmany('', {address: 10}, 0, "", [])
self.nodes[2].generate(1)
- self.sync_all([self.nodes[0:3]])
+ self.sync_all(self.nodes[0:3])
node_0_bal += Decimal('10')
ctx = FromHex(CTransaction(),
self.nodes[2].gettransaction(txid)['hex'])
@@ -222,7 +222,7 @@
# Sendmany 10 BCH with subtract fee from amount
txid = self.nodes[2].sendmany('', {address: 10}, 0, "", [address])
self.nodes[2].generate(1)
- self.sync_all([self.nodes[0:3]])
+ self.sync_all(self.nodes[0:3])
node_2_bal -= Decimal('10')
assert_equal(self.nodes[2].getbalance(), node_2_bal)
ctx = FromHex(CTransaction(),
@@ -273,13 +273,13 @@
connect_nodes_bi(self.nodes[0], self.nodes[1])
connect_nodes_bi(self.nodes[1], self.nodes[2])
connect_nodes_bi(self.nodes[0], self.nodes[2])
- self.sync_all([self.nodes[0:3]])
+ self.sync_all(self.nodes[0:3])
txIdNotBroadcasted = self.nodes[0].sendtoaddress(
self.nodes[2].getnewaddress(), 2)
txObjNotBroadcasted = self.nodes[0].gettransaction(txIdNotBroadcasted)
self.nodes[1].generate(1) # mine a block, tx should not be in there
- self.sync_all([self.nodes[0:3]])
+ self.sync_all(self.nodes[0:3])
# should not be changed because tx was not broadcasted
assert_equal(self.nodes[2].getbalance(), node_2_bal)
@@ -287,7 +287,7 @@
# balance
self.nodes[1].sendrawtransaction(txObjNotBroadcasted['hex'])
self.nodes[1].generate(1)
- self.sync_all([self.nodes[0:3]])
+ self.sync_all(self.nodes[0:3])
node_2_bal += 2
txObjNotBroadcasted = self.nodes[0].gettransaction(txIdNotBroadcasted)
assert_equal(self.nodes[2].getbalance(), node_2_bal)
@@ -343,7 +343,7 @@
address_to_import = self.nodes[2].getnewaddress()
txid = self.nodes[0].sendtoaddress(address_to_import, 1)
self.nodes[0].generate(1)
- self.sync_all([self.nodes[0:3]])
+ self.sync_all(self.nodes[0:3])
# 2. Import address from node2 to node1
self.nodes[1].importaddress(address_to_import)
@@ -369,15 +369,15 @@
cbAddr = self.nodes[1].getnewaddress()
blkHash = self.nodes[0].generatetoaddress(1, cbAddr)[0]
cbTxId = self.nodes[0].getblock(blkHash)['tx'][0]
- self.sync_all([self.nodes[0:3]])
+ self.sync_all(self.nodes[0:3])
# Check that the txid and balance is found by node1
self.nodes[1].gettransaction(cbTxId)
# check if wallet or blockchain maintenance changes the balance
- self.sync_all([self.nodes[0:3]])
+ self.sync_all(self.nodes[0:3])
blocks = self.nodes[0].generate(2)
- self.sync_all([self.nodes[0:3]])
+ self.sync_all(self.nodes[0:3])
balance_nodes = [self.nodes[i].getbalance() for i in range(3)]
block_count = self.nodes[0].getblockcount()
diff --git a/test/functional/wallet_listsinceblock.py b/test/functional/wallet_listsinceblock.py
--- a/test/functional/wallet_listsinceblock.py
+++ b/test/functional/wallet_listsinceblock.py
@@ -99,7 +99,8 @@
self.nodes[2].generate(7)
self.log.info('lastblockhash={}'.format(lastblockhash))
- self.sync_all([self.nodes[:2], self.nodes[2:]])
+ self.sync_all(self.nodes[:2])
+ self.sync_all(self.nodes[2:])
self.join_network()
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Mar 1, 11:44 (3 h, 22 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5187682
Default Alt Text
D6151.diff (8 KB)
Attached To
D6151: test: Pass at most one node group to sync_all
Event Timeline
Log In to Comment