Skip to content

Commit 2560768

Browse files
committed
test: remove redundant sync after generate* calls in Bitcoin tests
1 parent 1b97c55 commit 2560768

24 files changed

+0
-87
lines changed

test/functional/feature_blockfilterindex_prune.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,7 @@ def run_test(self):
2727
assert_greater_than(len(self.nodes[0].getblockfilter(self.nodes[0].getbestblockhash())['filter']), 0)
2828
# Mine two batches of blocks to avoid hitting NODE_NETWORK_LIMITED_MIN_BLOCKS disconnection
2929
self.generate(self.nodes[0], 250)
30-
self.sync_all()
3130
self.generate(self.nodes[0], 250)
32-
self.sync_all()
3331
self.sync_index(height=700)
3432

3533
self.log.info("prune some blocks")

test/functional/feature_coinstatsindex.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,6 @@ def _test_coin_stats_index(self):
184184

185185
# Include both txs in a block
186186
self.generate(self.nodes[0], 1)
187-
self.sync_all()
188187

189188
for hash_option in index_hash_options:
190189
# Check all amounts were registered correctly
@@ -285,7 +284,6 @@ def _test_reorg_index(self):
285284
# Add another block, so we don't depend on reconsiderblock remembering which
286285
# blocks were touched by invalidateblock
287286
self.generate(index_node, 1)
288-
self.sync_all()
289287

290288
# Ensure that removing and re-adding blocks yields consistent results
291289
block = index_node.getblockhash(99)

test/functional/feature_minchainwork.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ def run_test(self):
9898
# insufficient work chain, in which case we'd need to reconnect them to
9999
# continue the test.
100100

101-
self.sync_all()
102101
self.log.info("Blockcounts: %s", [n.getblockcount() for n in self.nodes])
103102

104103
self.log.info("Test that getheaders requests to node2 are not ignored")

test/functional/interface_rest.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,7 @@ def run_test(self):
8585
not_related_address = "yj949n1UH6fDhw6HtVE5VMj2iSTaSWBMcW"
8686

8787
self.generate(self.nodes[0], 1)
88-
self.sync_all()
8988
self.generatetoaddress(self.nodes[1], 100, not_related_address)
90-
self.sync_all()
9189

9290
assert_equal(self.nodes[0].getbalance(), 500)
9391

@@ -118,7 +116,6 @@ def run_test(self):
118116
self.log.info("Query an unspent TXO using the /getutxos URI")
119117

120118
self.generatetoaddress(self.nodes[1], 1, not_related_address)
121-
self.sync_all()
122119
bb_hash = self.nodes[0].getbestblockhash()
123120

124121
assert_equal(self.nodes[1].getbalance(), Decimal("0.1"))
@@ -193,7 +190,6 @@ def run_test(self):
193190
assert_equal(len(json_obj['utxos']), 0)
194191

195192
self.generate(self.nodes[0], 1)
196-
self.sync_all()
197193

198194
json_obj = self.test_rest_request("/getutxos/{}-{}".format(*spending))
199195
assert_equal(len(json_obj['utxos']), 1)
@@ -214,7 +210,6 @@ def run_test(self):
214210
self.test_rest_request("/getutxos/checkmempool/{}".format(long_uri), http_method='POST', status=200)
215211

216212
self.generate(self.nodes[0], 1) # generate block to not affect upcoming tests
217-
self.sync_all()
218213

219214
self.log.info("Test the /block, /blockhashbyheight and /headers URIs")
220215
bb_hash = self.nodes[0].getbestblockhash()
@@ -285,7 +280,6 @@ def run_test(self):
285280

286281
# See if we can get 5 headers in one response
287282
self.generate(self.nodes[1], 5)
288-
self.sync_all()
289283
json_obj = self.test_rest_request("/headers/5/{}".format(bb_hash))
290284
assert_equal(len(json_obj), 5) # now we should have 5 header objects
291285

@@ -320,7 +314,6 @@ def run_test(self):
320314

321315
# Now mine the transactions
322316
newblockhash = self.generate(self.nodes[1], 1)
323-
self.sync_all()
324317

325318
# Check if the 3 tx show up in the new block
326319
json_obj = self.test_rest_request("/block/{}".format(newblockhash[0]))

test/functional/interface_zmq.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,6 @@ def test_basic(self):
189189
self.log.info("Generate %(n)d blocks (and %(n)d coinbase txes)" % {"n": num_blocks})
190190
genhashes = self.generatetoaddress(self.nodes[0], num_blocks, ADDRESS_BCRT1_UNSPENDABLE)
191191

192-
self.sync_all()
193-
194192
for x in range(num_blocks):
195193
# Should receive the coinbase txid.
196194
txid = hashtx.receive()
@@ -344,7 +342,6 @@ def test_sequence(self):
344342
# removed from the mempool by the block mining it.
345343
mempool_size = len(self.nodes[0].getrawmempool())
346344
c_block = self.generatetoaddress(self.nodes[0], 1, ADDRESS_BCRT1_UNSPENDABLE)[0]
347-
self.sync_all()
348345
# Make sure the number of mined transactions matches the number of txs out of mempool
349346
mempool_size_delta = mempool_size - len(self.nodes[0].getrawmempool())
350347
assert_equal(len(self.nodes[0].getblock(c_block)["tx"])-1, mempool_size_delta)
@@ -384,7 +381,6 @@ def test_sequence(self):
384381
# Other things may happen but aren't wallet-deterministic so we don't test for them currently
385382
self.nodes[0].reconsiderblock(best_hash)
386383
self.generatetoaddress(self.nodes[1], 1, ADDRESS_BCRT1_UNSPENDABLE)
387-
self.sync_all()
388384

389385
self.log.info("Evict mempool transaction by block conflict")
390386
orig_txid = self.nodes[0].sendtoaddress(address=self.nodes[0].getnewaddress(), amount=1.0)
@@ -429,7 +425,6 @@ def test_sequence(self):
429425
assert_equal((orig_txid_2, "A", mempool_seq), seq.receive_sequence())
430426
mempool_seq += 1
431427
self.generatetoaddress(self.nodes[0], 1, ADDRESS_BCRT1_UNSPENDABLE)
432-
self.sync_all() # want to make sure we didn't break "consensus" for other tests
433428

434429
def test_mempool_sync(self):
435430
"""

test/functional/mempool_packages.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,6 @@ def run_test(self):
312312

313313
# Mine these in a block
314314
self.generate(self.nodes[0], 1)
315-
self.sync_all()
316315

317316
# Now generate tx8, with a big fee
318317
inputs = [ {'txid' : tx1_id, 'vout': 0}, {'txid' : txid, 'vout': 0} ]

test/functional/p2p_ibd_txrelay.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ def run_test(self):
6767

6868
# Come out of IBD by generating a block
6969
self.generate(self.nodes[0], 1)
70-
self.sync_all()
7170

7271
self.log.info("Check that nodes process the same transaction, even when unsolicited, when no longer in IBD")
7372
peer_txer = self.nodes[0].add_p2p_connection(P2PInterface())

test/functional/p2p_permissions.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@ def run_test(self):
116116

117117
def check_tx_relay(self):
118118
block_op_true = self.nodes[0].getblock(self.generatetoaddress(self.nodes[0], 100, ADDRESS_BCRT1_P2SH_OP_TRUE)[0])
119-
self.sync_all()
120119

121120
self.log.debug("Create a connection from a forcerelay peer that rebroadcasts raw txs")
122121
# A test framework p2p connection is needed to send the raw transaction directly. If a full node was used, it could only

test/functional/rpc_createmultisig.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ def run_test(self):
4545

4646
self.log.info('Generating blocks ...')
4747
self.generate(node0, 149)
48-
self.sync_all()
4948

5049
self.moved = 0
5150
for self.nkeys in [3, 5]:
@@ -102,7 +101,6 @@ def check_addmultisigaddress_errors(self):
102101
def checkbalances(self):
103102
node0, node1, node2 = self.nodes
104103
self.generate(node0, 1)
105-
self.sync_all()
106104

107105
bal0 = node0.getbalance()
108106
bal1 = node1.getbalance()

test/functional/rpc_fundrawtransaction.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,7 @@ def run_test(self):
6868
self.fee_tolerance = 2 * self.min_relay_tx_fee / 1000
6969

7070
self.generate(self.nodes[2], 1)
71-
self.sync_all()
7271
self.generate(self.nodes[0], 121)
73-
self.sync_all()
7472

7573
self.test_change_position()
7674
self.test_simple()
@@ -128,7 +126,6 @@ def test_change_position(self):
128126
self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(), 50)
129127

130128
self.generate(self.nodes[0], 1)
131-
self.sync_all()
132129

133130
wwatch.unloadwallet()
134131

@@ -492,7 +489,6 @@ def test_spend_2of2(self):
492489
# send 12 DASH to msig addr
493490
self.nodes[0].sendtoaddress(mSigObj, 12)
494491
self.generate(self.nodes[0], 1)
495-
self.sync_all()
496492

497493
oldBalance = self.nodes[1].getbalance()
498494
inputs = []
@@ -503,7 +499,6 @@ def test_spend_2of2(self):
503499
final_psbt = w2.finalizepsbt(signed_psbt['psbt'])
504500
self.nodes[2].sendrawtransaction(final_psbt['hex'])
505501
self.generate(self.nodes[2], 1)
506-
self.sync_all()
507502

508503
# Make sure funds are received at node1.
509504
assert_equal(oldBalance+Decimal('11.0000000'), self.nodes[1].getbalance())
@@ -565,7 +560,6 @@ def test_locked_wallet(self):
565560
signedTx = self.nodes[1].signrawtransactionwithwallet(fundedTx['hex'])
566561
self.nodes[1].sendrawtransaction(signedTx['hex'])
567562
self.generate(self.nodes[1], 1)
568-
self.sync_all()
569563

570564
# Make sure funds are received at node1.
571565
assert_equal(oldBalance+Decimal('511.0000000'), self.nodes[0].getbalance())
@@ -577,12 +571,10 @@ def test_many_inputs_fee(self):
577571
# Empty node1, send some small coins from node0 to node1.
578572
self.nodes[1].sendtoaddress(self.nodes[0].getnewaddress(), self.nodes[1].getbalance(), "", "", True)
579573
self.generate(self.nodes[1], 1)
580-
self.sync_all()
581574

582575
for _ in range(20):
583576
self.nodes[0].sendtoaddress(self.nodes[1].getnewaddress(), 0.01)
584577
self.generate(self.nodes[0], 1)
585-
self.sync_all()
586578

587579
# Fund a tx with ~20 small inputs.
588580
inputs = []
@@ -605,12 +597,10 @@ def test_many_inputs_send(self):
605597
# Again, empty node1, send some small coins from node0 to node1.
606598
self.nodes[1].sendtoaddress(self.nodes[0].getnewaddress(), self.nodes[1].getbalance(), "", "", True)
607599
self.generate(self.nodes[1], 1)
608-
self.sync_all()
609600

610601
for _ in range(20):
611602
self.nodes[0].sendtoaddress(self.nodes[1].getnewaddress(), 0.01)
612603
self.generate(self.nodes[0], 1)
613-
self.sync_all()
614604

615605
# Fund a tx with ~20 small inputs.
616606
oldBalance = self.nodes[0].getbalance()
@@ -622,7 +612,6 @@ def test_many_inputs_send(self):
622612
fundedAndSignedTx = self.nodes[1].signrawtransactionwithwallet(fundedTx['hex'])
623613
self.nodes[1].sendrawtransaction(fundedAndSignedTx['hex'])
624614
self.generate(self.nodes[1], 1)
625-
self.sync_all()
626615
assert_equal(oldBalance+Decimal('500.19000000'), self.nodes[0].getbalance()) #0.19+block reward
627616

628617
def test_op_return(self):
@@ -700,7 +689,6 @@ def test_all_watched_funds(self):
700689
assert signedtx["complete"]
701690
self.nodes[0].sendrawtransaction(signedtx["hex"])
702691
self.generate(self.nodes[0], 1)
703-
self.sync_all()
704692

705693
wwatch.unloadwallet()
706694

0 commit comments

Comments
 (0)