test: remove redundant sync after generate* calls in Dash tests

This commit is contained in:
Kittywhiskers Van Gogh 2024-10-01 16:08:01 +00:00
parent 1367115f7b
commit a99a39ce8d
No known key found for this signature in database
GPG Key ID: 30CD0C065E5C4AAD
13 changed files with 0 additions and 63 deletions

View File

@ -53,7 +53,6 @@ class AddressIndexTest(BitcoinTestFramework):
self.log.info("Mining blocks...")
mining_address = self.nodes[0].getnewaddress()
self.generatetoaddress(self.nodes[0], 105, mining_address)
self.sync_all()
chain_height = self.nodes[1].getblockcount()
assert_equal(chain_height, 105)
@ -89,8 +88,6 @@ class AddressIndexTest(BitcoinTestFramework):
txidb2 = self.nodes[0].sendtoaddress("93bVhahvUKmQu8gu9g3QnPPa2cxFK98pMB", 20)
self.generate(self.nodes[0], 1)
self.sync_all()
txids = self.nodes[1].getaddresstxids("yMNJePdcKvXtWWQnFYHNeJ5u8TF2v1dfK4")
assert_equal(len(txids), 3)
assert_equal(txids[0], txid0)
@ -142,7 +139,6 @@ class AddressIndexTest(BitcoinTestFramework):
sent_txid = self.nodes[0].sendrawtransaction(signed_tx["hex"], 0)
self.generate(self.nodes[0], 1)
self.sync_all()
txidsmany = self.nodes[1].getaddresstxids("93bVhahvUKmQu8gu9g3QnPPa2cxFK98pMB")
assert_equal(len(txidsmany), 4)
@ -171,7 +167,6 @@ class AddressIndexTest(BitcoinTestFramework):
signed_tx = self.nodes[0].signrawtransactionwithwallet(tx.serialize().hex())
spending_txid = self.nodes[0].sendrawtransaction(signed_tx["hex"], 0)
self.generate(self.nodes[0], 1)
self.sync_all()
balance1 = self.nodes[1].getaddressbalance(address2)
assert_equal(balance1["balance"], amount)
@ -185,7 +180,6 @@ class AddressIndexTest(BitcoinTestFramework):
signed_tx = self.nodes[0].signrawtransactionwithwallet(tx.serialize().hex())
sent_txid = self.nodes[0].sendrawtransaction(signed_tx["hex"], 0)
self.generate(self.nodes[0], 1)
self.sync_all()
balance2 = self.nodes[1].getaddressbalance(address2)
assert_equal(balance2["balance"], change_amount)
@ -239,7 +233,6 @@ class AddressIndexTest(BitcoinTestFramework):
self.generate(self.nodes[2], 1, sync_fun=self.no_op)
self.nodes[2].sendtoaddress(address2, 50)
self.generate(self.nodes[2], 1)
self.sync_all()
utxos3 = self.nodes[1].getaddressutxos({"addresses": [address2]})
assert_equal(len(utxos3), 3)
@ -292,7 +285,6 @@ class AddressIndexTest(BitcoinTestFramework):
assert_equal(mempool[2]["index"], 1)
self.generate(self.nodes[2], 1)
self.sync_all()
mempool2 = self.nodes[2].getaddressmempool({"addresses": [address3]})
assert_equal(len(mempool2), 0)
@ -323,7 +315,6 @@ class AddressIndexTest(BitcoinTestFramework):
self.nodes[0].sendtoaddress(address1, 10)
self.generate(self.nodes[0], 1)
self.sync_all()
utxos = self.nodes[1].getaddressutxos({"addresses": [address1]})
assert_equal(len(utxos), 1)

View File

@ -231,7 +231,6 @@ class AssetLocksTest(DashTestFramework):
count -= batch
self.bump_mocktime(batch)
self.generate(self.nodes[1], batch)
self.sync_all()
# This functional test intentionally setup only 2 MN and only 2 Evo nodes
# to ensure that corner case of quorum with minimum amount of nodes as possible
@ -260,7 +259,6 @@ class AssetLocksTest(DashTestFramework):
self.set_sporks()
self.generate(node, 1)
self.sync_all()
self.mempool_size = 0
key = ECKey()
@ -298,7 +296,6 @@ class AssetLocksTest(DashTestFramework):
assert_equal(self.get_credit_pool_balance(node=node), locked_1)
self.log.info("Generate a number of blocks to ensure this is the longest chain for later in the test when we reconsiderblock")
self.generate(node, 12)
self.sync_all()
self.validate_credit_pool_balance(locked_1)
@ -309,14 +306,12 @@ class AssetLocksTest(DashTestFramework):
inode.invalidateblock(self.block_hash_1)
assert_equal(self.get_credit_pool_balance(node=inode), 0)
self.generate(node, 3)
self.sync_all()
self.validate_credit_pool_balance(0)
self.log.info("Resubmit asset lock tx to new chain...")
# NEW tx appears
asset_lock_tx_2 = self.create_assetlock(coin, locked_2, pubkey)
txid_in_block = self.send_tx(asset_lock_tx_2)
self.generate(node, 1)
self.sync_all()
self.validate_credit_pool_balance(locked_2)
self.log.info("Reconsider old blocks...")
for inode in self.nodes:
@ -401,7 +396,6 @@ class AssetLocksTest(DashTestFramework):
self.check_mempool_size()
self.validate_credit_pool_balance(locked)
self.generate(node, 1)
self.sync_all()
assert_equal(rawtx["instantlock"], False)
assert_equal(rawtx["chainlock"], False)
rawtx = node.getrawtransaction(txid, 1)
@ -424,14 +418,12 @@ class AssetLocksTest(DashTestFramework):
self.validate_credit_pool_balance(locked - 1 * COIN)
self.send_tx(asset_unlock_tx_late)
self.generate(node, 1)
self.sync_all()
self.validate_credit_pool_balance(locked - 2 * COIN)
self.log.info("Generating many blocks to make quorum far behind (even still active)...")
self.generate_batch(too_late_height - node.getblockcount() - 1)
self.check_mempool_result(tx=asset_unlock_tx_too_late, result_expected={'allowed': True, 'fees': {'base': Decimal(str(tiny_amount / COIN))}})
self.generate(node, 1)
self.sync_all()
self.check_mempool_result(tx=asset_unlock_tx_too_late,
result_expected={'allowed': False, 'reject-reason' : 'bad-assetunlock-too-late'})
@ -456,7 +448,6 @@ class AssetLocksTest(DashTestFramework):
self.create_and_check_block([asset_unlock_tx_too_late], expected_error = "bad-assetunlock-not-active-quorum")
self.generate(node, 1)
self.sync_all()
self.validate_credit_pool_balance(locked - 2 * COIN)
self.validate_credit_pool_balance(block_hash=self.block_hash_1, expected=locked)
@ -476,7 +467,6 @@ class AssetLocksTest(DashTestFramework):
txid_in_block = self.send_tx(asset_unlock_tx_full)
self.generate(node, 1)
self.sync_all()
self.ensure_tx_is_not_mined(txid_in_block)
@ -490,7 +480,6 @@ class AssetLocksTest(DashTestFramework):
txid_in_block = self.send_tx(asset_unlock_tx_full)
expected_balance = (Decimal(self.get_credit_pool_balance()) - Decimal(tiny_amount))
self.generate(node, 1)
self.sync_all()
self.log.info("Check txid_in_block was mined")
block = node.getblock(node.getbestblockhash())
assert txid_in_block in block['tx']
@ -528,7 +517,6 @@ class AssetLocksTest(DashTestFramework):
self.log.info(f"Collecting coins in pool... Collected {total}/{10_901 * COIN}")
self.sync_mempools()
self.generate(node, 1)
self.sync_all()
credit_pool_balance_1 = self.get_credit_pool_balance()
assert_greater_than(credit_pool_balance_1, 10_901 * COIN)
limit_amount_1 = 1000 * COIN
@ -548,7 +536,6 @@ class AssetLocksTest(DashTestFramework):
self.sync_mempools()
self.generate(node, 1)
self.sync_all()
new_total = self.get_credit_pool_balance()
amount_actually_withdrawn = total - new_total
@ -561,7 +548,6 @@ class AssetLocksTest(DashTestFramework):
assert_equal(amount_actually_withdrawn, 900 * COIN + 10001)
self.generate(node, 1)
self.sync_all()
self.log.info("Checking that exactly 1 tx stayed in mempool...")
self.mempool_size = 1
self.check_mempool_size()
@ -575,7 +561,6 @@ class AssetLocksTest(DashTestFramework):
self.send_tx_simple(asset_unlock_tx)
self.sync_mempools()
self.generate(node, 1)
self.sync_all()
new_total = self.get_credit_pool_balance()
amount_actually_withdrawn = total - new_total
assert_equal(limit_amount_1, amount_actually_withdrawn)
@ -599,10 +584,8 @@ class AssetLocksTest(DashTestFramework):
asset_unlock_tx = self.create_assetunlock(index, limit_amount_2, pubkey)
self.send_tx(asset_unlock_tx)
self.generate(node, 1)
self.sync_all()
assert_equal(new_total, self.get_credit_pool_balance())
self.generate(node, 1)
self.sync_all()
new_total -= limit_amount_2
assert_equal(new_total, self.get_credit_pool_balance())
self.log.info("Trying to withdraw more... expecting to fail")
@ -610,7 +593,6 @@ class AssetLocksTest(DashTestFramework):
asset_unlock_tx = self.create_assetunlock(index, COIN, pubkey)
self.send_tx(asset_unlock_tx)
self.generate(node, 1)
self.sync_all()
tip = self.nodes[0].getblockcount()
indexes_statuses_no_height = self.nodes[0].getassetunlockstatuses(["101", "102", "103"])
@ -644,7 +626,6 @@ class AssetLocksTest(DashTestFramework):
assert_equal(platform_reward, 34371430)
assert_equal(locked, self.get_credit_pool_balance())
self.generate(node, 1)
self.sync_all()
locked += platform_reward
assert_equal(locked, self.get_credit_pool_balance())
@ -653,7 +634,6 @@ class AssetLocksTest(DashTestFramework):
self.send_tx(self.create_assetlock(coin, COIN, pubkey))
locked += platform_reward + COIN
self.generate(node, 1)
self.sync_all()
assert_equal(locked, self.get_credit_pool_balance())

View File

@ -126,7 +126,6 @@ class DIP3Test(BitcoinTestFramework):
dummy_txin = self.spend_mn_collateral(mns[i], with_dummy_input_output=True)
dummy_txins.append(dummy_txin)
self.generate(self.nodes[0], 1)
self.sync_all()
mns_tmp.remove(mns[i])
self.assert_mnlists(mns_tmp)
new_rpc_info = self.nodes[0].protx("info", old_protx_hash, old_blockhash)
@ -145,7 +144,6 @@ class DIP3Test(BitcoinTestFramework):
self.log.info("cause a reorg with a double spend and check that mnlists are still correct on all nodes")
self.mine_double_spend(mns, self.nodes[0], dummy_txins, self.nodes[0].getnewaddress())
self.generate(self.nodes[0], spend_mns_count)
self.sync_all()
self.assert_mnlists(mns_tmp)
self.log.info("test mn payment enforcement with deterministic MNs")
@ -153,7 +151,6 @@ class DIP3Test(BitcoinTestFramework):
node = self.nodes[i % len(self.nodes)]
self.test_invalid_mn_payment(mns, node)
self.generate(self.nodes[0], 1)
self.sync_all()
self.log.info("testing ProUpServTx")
for mn in mns:
@ -176,7 +173,6 @@ class DIP3Test(BitcoinTestFramework):
expected_payee = bt['masternode'][0]['payee']
expected_amount = bt['masternode'][0]['amount']
self.generate(self.nodes[0], 1)
self.sync_all()
if expected_payee == multisig:
block = self.nodes[0].getblock(self.nodes[0].getbestblockhash())
cbtx = self.nodes[0].getrawtransaction(block['tx'][0], 1)
@ -199,7 +195,6 @@ class DIP3Test(BitcoinTestFramework):
self.register_mn(self.nodes[0], new_mn)
mns[i] = new_mn
self.generate(self.nodes[0], 1)
self.sync_all()
self.assert_mnlists(mns)
self.log.info("restarting MN %s" % new_mn.alias)
self.stop_node(new_mn.idx)
@ -218,7 +213,6 @@ class DIP3Test(BitcoinTestFramework):
node.sendtoaddress(mn.rewards_address, 0.001)
node.protx('update_registrar', mn.protx_hash, "", new_voting_address, "")
self.generate(node, 1)
self.sync_all()
new_dmnState = mn.node.masternode("status")["dmnState"]
new_voting_address_from_rpc = new_dmnState["votingAddress"]
assert new_voting_address_from_rpc == new_voting_address
@ -296,7 +290,6 @@ class DIP3Test(BitcoinTestFramework):
self.nodes[0].sendtoaddress(mn.fundsAddr, 0.001)
self.nodes[0].protx('update_registrar', mn.protx_hash, '', '', payee, mn.fundsAddr)
self.generate(self.nodes[0], 1)
self.sync_all()
info = self.nodes[0].protx('info', mn.protx_hash)
assert info['state']['payoutAddress'] == payee
@ -304,7 +297,6 @@ class DIP3Test(BitcoinTestFramework):
self.nodes[0].sendtoaddress(mn.fundsAddr, 0.001)
self.nodes[0].protx('update_service', mn.protx_hash, '127.0.0.2:%d' % mn.p2p_port, mn.blsMnkey, "", mn.fundsAddr)
self.generate(self.nodes[0], 1)
self.sync_all()
for node in self.nodes:
protx_info = node.protx('info', mn.protx_hash)
mn_list = node.masternode('list')

View File

@ -126,7 +126,6 @@ class DIP3V19Test(DashTestFramework):
self.wait_for_instantlock(fund_txid, self.nodes[0])
tip = self.generate(self.nodes[0], 1)[0]
assert_equal(self.nodes[0].getrawtransaction(fund_txid, 1, tip)['confirmations'], 1)
self.sync_all()
protx_result = self.nodes[0].protx('revoke', revoke_protx, revoke_keyoperator, 1, funds_address)
self.wait_for_instantlock(protx_result, self.nodes[0])

View File

@ -214,7 +214,6 @@ class LLMQEvoNodesTest(DashTestFramework):
outputs = {collateral_address: collateral_amount, funds_address: 1}
collateral_txid = self.nodes[0].sendmany("", outputs)
self.generate(self.nodes[0], 8)
self.sync_all()
rawtx = self.nodes[0].getrawtransaction(collateral_txid, 1)
collateral_vout = 0

View File

@ -223,7 +223,6 @@ class LLMQ_IS_CL_Conflicts(DashTestFramework):
# Mine the conflicting TX into a block
good_tip = self.nodes[0].getbestblockhash()
self.generate(self.nodes[0], 2)
self.sync_all()
# Assert that the conflicting tx got mined and the locked TX is not valid
assert self.nodes[0].getrawtransaction(rawtx1_txid, True)['confirmations'] > 0
@ -255,7 +254,6 @@ class LLMQ_IS_CL_Conflicts(DashTestFramework):
assert_raises_rpc_error(-26, "tx-txlock-conflict", self.nodes[0].sendrawtransaction, rawtx1)
islock_tip = self.generate(self.nodes[0], 1)[0]
self.sync_all()
for node in self.nodes:
self.wait_for_instantlock(rawtx2_txid, node)

View File

@ -212,7 +212,6 @@ class LLMQSimplePoSeTest(DashTestFramework):
# Make sure protxes are "safe" to mine even when InstantSend and ChainLocks are no longer functional
self.bump_mocktime(60 * 10 + 1)
self.generate(self.nodes[0], 1)
self.sync_all()
# Isolate and re-connect all MNs (otherwise there might be open connections with no MNAUTH for MNs which were banned before)
for mn in self.mninfo:

View File

@ -149,8 +149,6 @@ class MnehfTest(DashTestFramework):
self.log.info(f"unknown ehf tx: {ehf_unknown_tx_sent}")
self.sync_all()
ehf_blockhash = self.generate(self.nodes[1], 1)[0]
self.sync_blocks()
self.sync_all()
self.log.info(f"Check MnEhfTx {ehf_tx_sent} was mined in {ehf_blockhash}")
assert ehf_tx_sent in node.getblock(ehf_blockhash)['tx']
@ -164,7 +162,6 @@ class MnehfTest(DashTestFramework):
while (node.getblockcount() + 1) % 4 != 0:
self.check_fork('defined')
self.generate(node, 1)
self.sync_all()
self.restart_all_nodes()
@ -172,13 +169,11 @@ class MnehfTest(DashTestFramework):
for _ in range(4):
self.check_fork('started')
self.generate(node, 1)
self.sync_all()
for i in range(4):
self.check_fork('locked_in')
self.generate(node, 1)
self.sync_all()
if i == 7:
self.restart_all_nodes()
@ -193,13 +188,11 @@ class MnehfTest(DashTestFramework):
for _ in range(4):
self.check_fork('defined')
self.generate(node, 1)
self.sync_all()
self.log.info("Re-sending MnEHF for new fork")
tx_sent_2 = self.send_tx(ehf_tx)
ehf_blockhash_2 = self.generate(node, 1)[0]
self.sync_all()
self.log.info(f"Check MnEhfTx again {tx_sent_2} was mined in {ehf_blockhash_2}")
assert tx_sent_2 in node.getblock(ehf_blockhash_2)['tx']
@ -242,7 +235,6 @@ class MnehfTest(DashTestFramework):
time.sleep(1)
self.bump_mocktime(1)
self.generate(self.nodes[1], 1)
self.sync_all()
self.check_fork('active')

View File

@ -54,7 +54,6 @@ class SpentIndexTest(BitcoinTestFramework):
self.log.info("Mining blocks...")
self.generate(self.nodes[0], 105)
self.sync_all()
chain_height = self.nodes[1].getblockcount()
assert_equal(chain_height, 105)
@ -77,7 +76,6 @@ class SpentIndexTest(BitcoinTestFramework):
signed_tx = self.nodes[0].signrawtransactionwithwallet(tx.serialize().hex())
txid = self.nodes[0].sendrawtransaction(signed_tx["hex"], 0)
self.generate(self.nodes[0], 1)
self.sync_all()
self.log.info("Testing getspentinfo method...")
@ -121,7 +119,6 @@ class SpentIndexTest(BitcoinTestFramework):
# Check the database index
self.generate(self.nodes[0], 1)
self.sync_all()
txVerbose4 = self.nodes[3].getrawtransaction(txid2, 1)
assert_equal(txVerbose4["vin"][0]["address"], address2)

View File

@ -49,7 +49,6 @@ class TimestampIndexTest(BitcoinTestFramework):
blockhashes = self.generate(self.nodes[0], 5)
low = self.nodes[0].getblock(blockhashes[0])["time"]
high = self.nodes[0].getblock(blockhashes[4])["time"]
self.sync_all()
self.log.info("Checking timestamp index...")
hashes = self.nodes[1].getblockhashes(high, low)
assert_equal(len(hashes), 5)

View File

@ -39,7 +39,6 @@ class TxIndexTest(BitcoinTestFramework):
def run_test(self):
self.log.info("Mining blocks...")
self.generate(self.nodes[0], 105)
self.sync_all()
chain_height = self.nodes[1].getblockcount()
assert_equal(chain_height, 105)
@ -59,7 +58,6 @@ class TxIndexTest(BitcoinTestFramework):
signed_tx = self.nodes[0].signrawtransactionwithwallet(tx.serialize().hex())
txid = self.nodes[0].sendrawtransaction(signed_tx["hex"], 0)
self.generate(self.nodes[0], 1)
self.sync_all()
# Check verbose raw transaction results
verbose = self.nodes[3].getrawtransaction(txid, 1)

View File

@ -48,7 +48,6 @@ class InstantSendTest(DashTestFramework):
self.wait_for_instantlock(is_id, node)
self.bump_mocktime(1)
self.generate(self.nodes[0], 2)
self.sync_all()
# create doublespending transaction, but don't relay it
dblspnd_tx = self.create_raw_tx(sender, isolated, 0.5, 1, 100)
@ -93,7 +92,6 @@ class InstantSendTest(DashTestFramework):
# make sure the above TX is on node0
self.sync_mempools([n for n in self.nodes if n is not isolated])
self.generate(self.nodes[0], 2)
self.sync_all()
def test_mempool_doublespend(self):
sender = self.nodes[self.sender_idx]
@ -109,7 +107,6 @@ class InstantSendTest(DashTestFramework):
self.wait_for_instantlock(is_id, node)
self.bump_mocktime(1)
self.generate(self.nodes[0], 2)
self.sync_all()
# create doublespending transaction, but don't relay it
dblspnd_tx = self.create_raw_tx(sender, isolated, 0.5, 1, 100)
@ -142,7 +139,6 @@ class InstantSendTest(DashTestFramework):
# mine more blocks
self.bump_mocktime(1)
self.generate(self.nodes[0], 2)
self.sync_all()
if __name__ == '__main__':
InstantSendTest().main()

View File

@ -1330,7 +1330,6 @@ class DashTestFramework(BitcoinTestFramework):
self.wait_for_instantlock(fund_txid, self.nodes[0])
tip = self.generate(self.nodes[0], 1)[0]
assert_equal(self.nodes[0].getrawtransaction(fund_txid, 1, tip)['confirmations'], 1)
self.sync_all()
protx_success = False
try:
@ -1338,7 +1337,6 @@ class DashTestFramework(BitcoinTestFramework):
self.wait_for_instantlock(protx_result, self.nodes[0])
tip = self.generate(self.nodes[0], 1)[0]
assert_equal(self.nodes[0].getrawtransaction(protx_result, 1, tip)['confirmations'], 1)
self.sync_all()
self.log.info("Updated EvoNode %s: platformNodeID=%s, platformP2PPort=%s, platformHTTPPort=%s" % (evo_info.proTxHash, platform_node_id, platform_p2p_port, platform_http_port))
protx_success = True
except:
@ -1410,7 +1408,6 @@ class DashTestFramework(BitcoinTestFramework):
rawtx = self.nodes[0].signrawtransactionwithwallet(rawtx)
self.nodes[0].sendrawtransaction(rawtx["hex"])
self.generate(self.nodes[0], 1)
self.sync_all()
self.mninfo.remove(mn)
self.log.info("Removed masternode %d", idx)