test: opt-out of post-generate* syncing in some Dash tests

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
This commit is contained in:
Kittywhiskers Van Gogh 2024-10-01 19:22:56 +00:00
parent 82da45a8bf
commit 1367115f7b
No known key found for this signature in database
GPG Key ID: 30CD0C065E5C4AAD
26 changed files with 100 additions and 100 deletions

View File

@ -72,19 +72,19 @@ class AddressIndexTest(BitcoinTestFramework):
self.log.info("Testing p2pkh and p2sh address index...")
txid0 = self.nodes[0].sendtoaddress("yMNJePdcKvXtWWQnFYHNeJ5u8TF2v1dfK4", 10)
self.generate(self.nodes[0], 1)
self.generate(self.nodes[0], 1, sync_fun=self.no_op)
txidb0 = self.nodes[0].sendtoaddress("93bVhahvUKmQu8gu9g3QnPPa2cxFK98pMB", 10)
self.generate(self.nodes[0], 1)
self.generate(self.nodes[0], 1, sync_fun=self.no_op)
txid1 = self.nodes[0].sendtoaddress("yMNJePdcKvXtWWQnFYHNeJ5u8TF2v1dfK4", 15)
self.generate(self.nodes[0], 1)
self.generate(self.nodes[0], 1, sync_fun=self.no_op)
txidb1 = self.nodes[0].sendtoaddress("93bVhahvUKmQu8gu9g3QnPPa2cxFK98pMB", 15)
self.generate(self.nodes[0], 1)
self.generate(self.nodes[0], 1, sync_fun=self.no_op)
txid2 = self.nodes[0].sendtoaddress("yMNJePdcKvXtWWQnFYHNeJ5u8TF2v1dfK4", 20)
self.generate(self.nodes[0], 1)
self.generate(self.nodes[0], 1, sync_fun=self.no_op)
txidb2 = self.nodes[0].sendtoaddress("93bVhahvUKmQu8gu9g3QnPPa2cxFK98pMB", 20)
self.generate(self.nodes[0], 1)
@ -233,10 +233,10 @@ class AddressIndexTest(BitcoinTestFramework):
assert_equal(utxos2[0]["satoshis"], amount)
# Check sorting of utxos
self.generate(self.nodes[2], 150)
self.generate(self.nodes[2], 150, sync_fun=self.no_op)
self.nodes[2].sendtoaddress(address2, 50)
self.generate(self.nodes[2], 1)
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()

View File

@ -294,7 +294,7 @@ class AssetLocksTest(DashTestFramework):
assert_equal(rpc_tx["assetLockTx"]["creditOutputs"][0]["scriptPubKey"]["hex"], key_to_p2pkh_script(pubkey).hex())
assert_equal(rpc_tx["assetLockTx"]["creditOutputs"][1]["scriptPubKey"]["hex"], key_to_p2pkh_script(pubkey).hex())
self.validate_credit_pool_balance(0)
self.generate(node, 1)
self.generate(node, 1, sync_fun=self.no_op)
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)
@ -507,7 +507,7 @@ class AssetLocksTest(DashTestFramework):
self.check_mempool_result(tx=spend_withdrawal, result_expected={'allowed': True, 'fees': {'base': Decimal(str(tiny_amount / COIN))}})
spend_txid_in_block = self.send_tx(spend_withdrawal)
self.generate(node, 1)
self.generate(node, 1, sync_fun=self.no_op)
block = node.getblock(node.getbestblockhash())
assert spend_txid_in_block in block['tx']

View File

@ -58,7 +58,7 @@ class DIP0020ActivationTest(BitcoinTestFramework):
# This tx should be completely valid, should be included in mempool and mined in the next block
assert txid in set(node.getrawmempool())
self.generate(node, 1)
self.generate(node, 1, sync_fun=self.no_op)
assert txid not in set(node.getrawmempool())
# Create spending tx
@ -83,9 +83,9 @@ class DIP0020ActivationTest(BitcoinTestFramework):
helper_peer.send_blocks_and_test([test_block], node, success=False, reject_reason='block-validation-failed', expect_disconnect=True)
self.log.info("Generate enough blocks to activate DIP0020 opcodes")
self.generate(node, 97)
self.generate(node, 97, sync_fun=self.no_op)
assert not softfork_active(node, 'dip0020')
self.generate(node, 1)
self.generate(node, 1, sync_fun=self.no_op)
assert softfork_active(node, 'dip0020')
# flush state to disk before potential crashes below
@ -103,7 +103,7 @@ class DIP0020ActivationTest(BitcoinTestFramework):
# txes spending new opcodes still won't be accepted into mempool if we roll back to the previous tip
node.invalidateblock(node.getbestblockhash())
assert tx0id not in set(node.getrawmempool())
self.generate(node, 1)
self.generate(node, 1, sync_fun=self.no_op)
self.log.info("Transactions spending coins with new opcodes are accepted one block after DIP0020 activation block")
node.sendrawtransaction(tx0_hex)

View File

@ -49,7 +49,7 @@ class DIP3Test(BitcoinTestFramework):
def run_test(self):
self.log.info("funding controller node")
while self.nodes[0].getbalance() < (self.num_initial_mn + 3) * 1000:
self.generate(self.nodes[0], 10) # generate enough for collaterals
self.generate(self.nodes[0], 10, sync_fun=self.no_op) # generate enough for collaterals
self.log.info("controller node has {} dash".format(self.nodes[0].getbalance()))
# Make sure we're below block 135 (which activates dip3)
@ -65,11 +65,11 @@ class DIP3Test(BitcoinTestFramework):
mns.append(before_dip3_mn)
# block 150 starts enforcing DIP3 MN payments
self.generate(self.nodes[0], 150 - self.nodes[0].getblockcount())
self.generate(self.nodes[0], 150 - self.nodes[0].getblockcount(), sync_fun=self.no_op)
assert self.nodes[0].getblockcount() == 150
self.log.info("mining final block for DIP3 activation")
self.generate(self.nodes[0], 1)
self.generate(self.nodes[0], 1, sync_fun=self.no_op)
# We have hundreds of blocks to sync here, give it more time
self.log.info("syncing blocks for all nodes")
@ -101,7 +101,7 @@ class DIP3Test(BitcoinTestFramework):
self.log.info("register %s" % mn.alias)
self.register_mn(self.nodes[0], mn)
self.generate(self.nodes[0], 1)
self.generate(self.nodes[0], 1, sync_fun=self.no_op)
if not start:
self.start_mn(mn)
@ -245,7 +245,7 @@ class DIP3Test(BitcoinTestFramework):
mn.collateral_address = node.getnewaddress()
mn.collateral_txid = node.sendtoaddress(mn.collateral_address, 1000)
mn.collateral_vout = None
self.generate(node, 1)
self.generate(node, 1, sync_fun=self.no_op)
rawtx = node.getrawtransaction(mn.collateral_txid, 1)
for txout in rawtx['vout']:
@ -277,7 +277,7 @@ class DIP3Test(BitcoinTestFramework):
mn.rewards_address = node.getnewaddress()
mn.protx_hash = node.protx('register', mn.collateral_txid, mn.collateral_vout, '127.0.0.1:%d' % mn.p2p_port, mn.ownerAddr, mn.operatorAddr, mn.votingAddr, mn.operator_reward, mn.rewards_address, mn.fundsAddr)
self.generate(node, 1)
self.generate(node, 1, sync_fun=self.no_op)
def start_mn(self, mn):
if len(self.nodes) <= mn.idx:
@ -313,7 +313,7 @@ class DIP3Test(BitcoinTestFramework):
# undo
self.nodes[0].protx('update_service', mn.protx_hash, '127.0.0.1:%d' % mn.p2p_port, mn.blsMnkey, "", mn.fundsAddr)
self.generate(self.nodes[0], 1)
self.generate(self.nodes[0], 1, sync_fun=self.no_op)
def assert_mnlists(self, mns):
for node in self.nodes:

View File

@ -130,7 +130,7 @@ class DIP3V19Test(DashTestFramework):
protx_result = self.nodes[0].protx('revoke', revoke_protx, revoke_keyoperator, 1, funds_address)
self.wait_for_instantlock(protx_result, self.nodes[0])
tip = self.generate(self.nodes[0], 1)[0]
tip = self.generate(self.nodes[0], 1, sync_fun=self.no_op)[0]
assert_equal(self.nodes[0].getrawtransaction(protx_result, 1, tip)['confirmations'], 1)
# Revoking a MN results in disconnects. Wait for disconnects to actually happen
# and then reconnect the corresponding node back to let sync_blocks finish correctly.

View File

@ -91,7 +91,7 @@ class LLMQCoinbaseCommitmentsTest(DashTestFramework):
#############################
# Now start testing quorum commitment merkle roots
self.generate(self.nodes[0], 1)
self.generate(self.nodes[0], 1, sync_fun=self.no_op)
oldhash = self.nodes[0].getbestblockhash()
# Test DIP8 activation once with a pre-existing quorum and once without (we don't know in which order it will activate on mainnet)
@ -248,7 +248,7 @@ class LLMQCoinbaseCommitmentsTest(DashTestFramework):
self.log.info("Wait for dip0008 activation")
while self.nodes[0].getblockcount() < DIP0008_HEIGHT:
self.bump_mocktime(10)
self.generate(self.nodes[0], 10)
self.generate(self.nodes[0], 10, sync_fun=self.no_op)
if slow_mode:
self.sync_blocks()
self.sync_blocks()
@ -301,7 +301,7 @@ class LLMQCoinbaseCommitmentsTest(DashTestFramework):
break
if not found_unconfirmed:
break
self.generate(self.nodes[0], 1)
self.generate(self.nodes[0], 1, sync_fun=self.no_op)
self.sync_blocks()
if __name__ == '__main__':

View File

@ -89,7 +89,7 @@ class DashGovernanceTest (DashTestFramework):
assert_equal(len(self.nodes[0].gobject("list-prepared")), 0)
self.log.info("Check 1st superblock before v20")
self.generate(self.nodes[0], 3)
self.generate(self.nodes[0], 3, sync_fun=self.no_op)
self.bump_mocktime(3)
self.sync_blocks()
assert_equal(self.nodes[0].getblockcount(), 130)
@ -97,7 +97,7 @@ class DashGovernanceTest (DashTestFramework):
self.check_superblockbudget(False)
self.log.info("Check 2nd superblock before v20")
self.generate(self.nodes[0], 10)
self.generate(self.nodes[0], 10, sync_fun=self.no_op)
self.bump_mocktime(10)
self.sync_blocks()
assert_equal(self.nodes[0].getblockcount(), 140)
@ -117,7 +117,7 @@ class DashGovernanceTest (DashTestFramework):
p1_collateral_prepare = prepare_object(self.nodes[0], 1, uint256_to_string(0), proposal_time, 1, "Proposal_1", self.p1_amount, self.p1_payout_address)
p2_collateral_prepare = prepare_object(self.nodes[0], 1, uint256_to_string(0), proposal_time, 1, "Proposal_2", self.p2_amount, self.p2_payout_address)
self.generate(self.nodes[0], 6)
self.generate(self.nodes[0], 6, sync_fun=self.no_op)
self.bump_mocktime(6)
self.sync_blocks()
@ -165,7 +165,7 @@ class DashGovernanceTest (DashTestFramework):
self.log.info("v20 is expected to be activate since block 160")
assert block_count + n < 160
for _ in range(n - 1):
self.generate(self.nodes[0], 1)
self.generate(self.nodes[0], 1, sync_fun=self.no_op)
self.bump_mocktime(1)
self.sync_blocks()
self.check_superblockbudget(False)
@ -193,8 +193,8 @@ class DashGovernanceTest (DashTestFramework):
isolated = self.nodes[payee_idx]
self.log.info("Move 1 block inside the Superblock maturity window on the isolated node")
self.generate(isolated, 1)
self.bump_mocktime(1)
self.generate(isolated, 1, sync_fun=self.no_op)
self.log.info("The isolated 'winner' should submit new trigger and vote for it")
self.wait_until(lambda: len(isolated.gobject("list", "valid", "triggers")) == 1, timeout=5)
isolated_trigger_hash = list(isolated.gobject("list", "valid", "triggers").keys())[0]
@ -203,8 +203,8 @@ class DashGovernanceTest (DashTestFramework):
assert_equal(more_votes, False)
self.log.info("Move 1 block enabling the Superblock maturity window on non-isolated nodes")
self.generate(self.nodes[0], 1)
self.bump_mocktime(1)
self.generate(self.nodes[0], 1, sync_fun=self.no_op)
assert_equal(self.nodes[0].getblockcount(), 150)
assert_equal(self.nodes[0].getblockchaininfo()["softforks"]["v20"]["active"], False)
self.check_superblockbudget(False)
@ -214,8 +214,8 @@ class DashGovernanceTest (DashTestFramework):
assert_equal(has_trigger, False)
self.log.info("Move 1 block inside the Superblock maturity window on non-isolated nodes")
self.generate(self.nodes[0], 1)
self.bump_mocktime(1)
self.generate(self.nodes[0], 1, sync_fun=self.no_op)
self.log.info("There is now new 'winner' who should submit new trigger and vote for it")
self.wait_until(lambda: len(self.nodes[0].gobject("list", "valid", "triggers")) == 1, timeout=5)
@ -232,8 +232,8 @@ class DashGovernanceTest (DashTestFramework):
assert(amount_str in payment_amounts_expected)
self.log.info("Move another block inside the Superblock maturity window on non-isolated nodes")
self.generate(self.nodes[0], 1)
self.bump_mocktime(1)
self.generate(self.nodes[0], 1, sync_fun=self.no_op)
self.log.info("Every non-isolated MN should vote for the same trigger now, no new triggers should be created")
self.wait_until(lambda: list(self.nodes[0].gobject("list", "valid", "triggers").values())[0]['YesCount'] == self.mn_count - 1, timeout=5)
@ -268,7 +268,7 @@ class DashGovernanceTest (DashTestFramework):
assert_equal(more_triggers, False)
self.log.info("Move another block inside the Superblock maturity window")
self.generate(self.nodes[0], 1)
self.generate(self.nodes[0], 1, sync_fun=self.no_op)
self.bump_mocktime(1)
self.sync_blocks()
@ -284,7 +284,7 @@ class DashGovernanceTest (DashTestFramework):
self.log.info("Move another block inside the Superblock maturity window")
with self.nodes[1].assert_debug_log(["CGovernanceManager::VoteGovernanceTriggers"]):
self.generate(self.nodes[0], 1)
self.generate(self.nodes[0], 1, sync_fun=self.no_op)
self.bump_mocktime(1)
self.sync_blocks()
@ -298,7 +298,7 @@ class DashGovernanceTest (DashTestFramework):
self.log.info("Move remaining n blocks until actual Superblock")
for i in range(n):
self.generate(self.nodes[0], 1)
self.generate(self.nodes[0], 1, sync_fun=self.no_op)
self.bump_mocktime(1)
self.sync_blocks()
# comparing to 159 because bip9 forks are active when the tip is one block behind the activation height
@ -310,7 +310,7 @@ class DashGovernanceTest (DashTestFramework):
self.log.info("Move a few block past the recent superblock height and make sure we have no new votes")
for _ in range(5):
with self.nodes[1].assert_debug_log("", [f"Voting NO-FUNDING for trigger:{winning_trigger_hash} success"]):
self.generate(self.nodes[0], 1)
self.generate(self.nodes[0], 1, sync_fun=self.no_op)
self.bump_mocktime(1)
self.sync_blocks()
# Votes on both triggers should NOT change
@ -322,13 +322,13 @@ class DashGovernanceTest (DashTestFramework):
self.log.info("Move remaining n blocks until the next Superblock")
for _ in range(n - 1):
self.generate(self.nodes[0], 1)
self.generate(self.nodes[0], 1, sync_fun=self.no_op)
self.bump_mocktime(1)
self.sync_blocks()
self.log.info("Wait for new trigger and votes")
self.wait_until(lambda: have_trigger_for_height(self.nodes, 180))
self.log.info("Mine superblock")
self.generate(self.nodes[0], 1)
self.generate(self.nodes[0], 1, sync_fun=self.no_op)
self.bump_mocktime(1)
self.sync_blocks()
assert_equal(self.nodes[0].getblockcount(), 180)
@ -337,14 +337,14 @@ class DashGovernanceTest (DashTestFramework):
self.log.info("Mine and check a couple more superblocks")
for i in range(2):
for _ in range(sb_cycle - 1):
self.generate(self.nodes[0], 1)
self.generate(self.nodes[0], 1, sync_fun=self.no_op)
self.bump_mocktime(1)
self.sync_blocks()
# Wait for new trigger and votes
sb_block_height = 180 + (i + 1) * sb_cycle
self.wait_until(lambda: have_trigger_for_height(self.nodes, sb_block_height))
# Mine superblock
self.generate(self.nodes[0], 1)
self.generate(self.nodes[0], 1, sync_fun=self.no_op)
self.bump_mocktime(1)
self.sync_blocks()
assert_equal(self.nodes[0].getblockcount(), sb_block_height)

View File

@ -83,7 +83,7 @@ class DashGovernanceTest (DashTestFramework):
p1_collateral_prepare = self.prepare_object(1, uint256_to_string(0), proposal_time, 1, "Proposal_1", self.p1_amount, self.p1_payout_address)
self.bump_mocktime(60 * 10 + 1)
self.generate(self.nodes[0], 6)
self.generate(self.nodes[0], 6, sync_fun=self.no_op)
self.bump_mocktime(6 * 156)
self.sync_blocks()
@ -158,7 +158,7 @@ class DashGovernanceTest (DashTestFramework):
self.log.info("Reconnect isolated node and confirm the next ChainLock will let it sync")
self.reconnect_isolated_node(5, 0)
assert_equal(self.nodes[5].mnsync("status")["IsSynced"], False)
self.generate(self.nodes[0], 1)
self.generate(self.nodes[0], 1, sync_fun=self.no_op)
# NOTE: bumping mocktime too much after recent reconnect can result in "timeout downloading block"
self.bump_mocktime(1)
self.sync_blocks()

View File

@ -38,7 +38,7 @@ class LLMQChainLocksTest(DashTestFramework):
self.test_coinbase_best_cl(self.nodes[0], expected_cl_in_cb=False)
# v20 is active, no quorums, no CLs - null CL in CbTx
nocl_block_hash = self.generate(self.nodes[0], 1)[0]
nocl_block_hash = self.generate(self.nodes[0], 1, sync_fun=self.no_op)[0]
self.test_coinbase_best_cl(self.nodes[0], expected_cl_in_cb=True, expected_null_cl=True)
cbtx = self.nodes[0].getspecialtxes(nocl_block_hash, 5, 1, 0, 2)[0]
assert_equal(cbtx["instantlock"], False)
@ -59,7 +59,7 @@ class LLMQChainLocksTest(DashTestFramework):
self.log.info("Mine single block, wait for chainlock")
self.generate(self.nodes[0], 1)
self.generate(self.nodes[0], 1, sync_fun=self.no_op)
self.wait_for_chainlocked_block_all_nodes(self.nodes[0].getbestblockhash())
self.test_coinbase_best_cl(self.nodes[0])
@ -70,7 +70,7 @@ class LLMQChainLocksTest(DashTestFramework):
assert_equal(cbtx["chainlock"], True)
self.log.info("Mine many blocks, wait for chainlock")
self.generate(self.nodes[0], 20)
self.generate(self.nodes[0], 20, sync_fun=self.no_op)
# We need more time here due to 20 blocks being generated at once
self.wait_for_chainlocked_block_all_nodes(self.nodes[0].getbestblockhash(), timeout=30)
self.test_coinbase_best_cl(self.nodes[0])
@ -90,7 +90,7 @@ class LLMQChainLocksTest(DashTestFramework):
self.log.info("Generate new blocks and verify that they are not chainlocked")
previous_block_hash = self.nodes[0].getbestblockhash()
for _ in range(2):
block_hash = self.generate(self.nodes[0], 1)[0]
block_hash = self.generate(self.nodes[0], 1, sync_fun=self.no_op)[0]
self.wait_for_chainlocked_block_all_nodes(block_hash, expected=False)
assert self.nodes[0].getblock(previous_block_hash)["chainlock"]
@ -101,18 +101,18 @@ class LLMQChainLocksTest(DashTestFramework):
self.isolate_node(0)
node0_mining_addr = self.nodes[0].getnewaddress()
node0_tip = self.nodes[0].getbestblockhash()
self.generatetoaddress(self.nodes[1], 5, node0_mining_addr)
self.generatetoaddress(self.nodes[1], 5, node0_mining_addr, sync_fun=self.no_op)
self.wait_for_chainlocked_block(self.nodes[1], self.nodes[1].getbestblockhash())
self.test_coinbase_best_cl(self.nodes[0])
assert self.nodes[0].getbestblockhash() == node0_tip
self.reconnect_isolated_node(0, 1)
self.generatetoaddress(self.nodes[1], 1, node0_mining_addr)
self.generatetoaddress(self.nodes[1], 1, node0_mining_addr, sync_fun=self.no_op)
self.wait_for_chainlocked_block_all_nodes(self.nodes[1].getbestblockhash())
self.test_coinbase_best_cl(self.nodes[0])
self.log.info("Isolate node, mine on another, reconnect and submit CL via RPC")
self.isolate_node(0)
self.generate(self.nodes[1], 1)
self.generate(self.nodes[1], 1, sync_fun=self.no_op)
self.wait_for_chainlocked_block(self.nodes[1], self.nodes[1].getbestblockhash())
best_0 = self.nodes[0].getbestchainlock()
best_1 = self.nodes[1].getbestchainlock()
@ -134,13 +134,13 @@ class LLMQChainLocksTest(DashTestFramework):
self.log.info("Isolate node, mine on both parts of the network, and reconnect")
self.isolate_node(0)
bad_tip = self.generate(self.nodes[0], 5)[-1]
self.generatetoaddress(self.nodes[1], 1, node0_mining_addr)
bad_tip = self.generate(self.nodes[0], 5, sync_fun=self.no_op)[-1]
self.generatetoaddress(self.nodes[1], 1, node0_mining_addr, sync_fun=self.no_op)
good_tip = self.nodes[1].getbestblockhash()
self.wait_for_chainlocked_block(self.nodes[1], good_tip)
assert not self.nodes[0].getblock(self.nodes[0].getbestblockhash())["chainlock"]
self.reconnect_isolated_node(0, 1)
self.generatetoaddress(self.nodes[1], 1, node0_mining_addr)
self.generatetoaddress(self.nodes[1], 1, node0_mining_addr, sync_fun=self.no_op)
self.wait_for_chainlocked_block_all_nodes(self.nodes[1].getbestblockhash())
self.test_coinbase_best_cl(self.nodes[0])
assert self.nodes[0].getblock(self.nodes[0].getbestblockhash())["previousblockhash"] == good_tip
@ -163,10 +163,10 @@ class LLMQChainLocksTest(DashTestFramework):
assert self.nodes[0].getbestblockhash() == good_tip
self.nodes[0].invalidateblock(good_tip)
self.log.info("Now try to reorg the chain")
self.generate(self.nodes[0], 2)
self.generate(self.nodes[0], 2, sync_fun=self.no_op)
time.sleep(6)
assert self.nodes[1].getbestblockhash() == good_tip
bad_tip = self.generate(self.nodes[0], 2)[-1]
bad_tip = self.generate(self.nodes[0], 2, sync_fun=self.no_op)[-1]
time.sleep(6)
assert self.nodes[0].getbestblockhash() == bad_tip
assert self.nodes[1].getbestblockhash() == good_tip
@ -175,7 +175,7 @@ class LLMQChainLocksTest(DashTestFramework):
self.nodes[0].reconsiderblock(good_tip)
assert self.nodes[0].getbestblockhash() != good_tip
good_fork = good_tip
good_tip = self.generatetoaddress(self.nodes[1], 1, node0_mining_addr)[-1] # this should mark bad_tip as conflicting
good_tip = self.generatetoaddress(self.nodes[1], 1, node0_mining_addr, sync_fun=self.no_op)[-1] # this should mark bad_tip as conflicting
self.wait_for_chainlocked_block_all_nodes(good_tip)
self.test_coinbase_best_cl(self.nodes[0])
assert self.nodes[0].getbestblockhash() == good_tip
@ -203,7 +203,7 @@ class LLMQChainLocksTest(DashTestFramework):
txs.append(self.nodes[0].sendtoaddress(self.nodes[0].getnewaddress(), 1))
txs += self.create_chained_txs(self.nodes[0], 1)
self.log.info("Assert that after block generation these TXs are NOT included (as they are \"unsafe\")")
node0_tip = self.generate(self.nodes[0], 1)[-1]
node0_tip = self.generate(self.nodes[0], 1, sync_fun=self.no_op)[-1]
for txid in txs:
tx = self.nodes[0].getrawtransaction(txid, 1)
assert "confirmations" not in tx
@ -214,7 +214,7 @@ class LLMQChainLocksTest(DashTestFramework):
self.log.info("Disable LLMQ based InstantSend for a very short time (this never gets propagated to other nodes)")
self.nodes[0].sporkupdate("SPORK_2_INSTANTSEND_ENABLED", 4070908800)
self.log.info("Now the TXs should be included")
self.generate(self.nodes[0], 1)
self.generate(self.nodes[0], 1, sync_fun=self.no_op)
self.nodes[0].sporkupdate("SPORK_2_INSTANTSEND_ENABLED", 0)
self.log.info("Assert that TXs got included now")
for txid in txs:
@ -296,12 +296,12 @@ class LLMQChainLocksTest(DashTestFramework):
def test_bestCLHeightDiff(self, mn_rr_active):
# We need 2 blocks we can grab clsigs from
for _ in range(2):
self.wait_for_chainlocked_block_all_nodes(self.generate(self.nodes[0], 1)[0])
self.wait_for_chainlocked_block_all_nodes(self.generate(self.nodes[0], 1, sync_fun=self.no_op)[0])
assert_equal(softfork_active(self.nodes[1], "mn_rr"), mn_rr_active)
tip1_hash = self.nodes[1].getbestblockhash()
self.isolate_node(1)
tip0_hash = self.generate(self.nodes[0], 1)[0]
tip0_hash = self.generate(self.nodes[0], 1, sync_fun=self.no_op)[0]
block_hex = self.nodes[0].getblock(tip0_hash, 0)
mal_block = CBlock()
mal_block.deserialize(BytesIO(bytes.fromhex(block_hex)))

View File

@ -44,7 +44,7 @@ class LLMQConnections(DashTestFramework):
self.wait_for_sporks_same()
self.log.info("mining one block and waiting for all members to connect to each other")
self.generate(self.nodes[0], 1)
self.generate(self.nodes[0], 1, sync_fun=self.no_op)
for mn in self.get_quorum_masternodes(q):
self.wait_for_mnauth(mn.node, 4)

View File

@ -46,7 +46,7 @@ class QuorumDataRecoveryTest(DashTestFramework):
self.connect_nodes(mn.node.index, 0)
if qdata_recovery_enabled:
# trigger recovery threads and wait for them to start
self.generate(self.nodes[0], 1)
self.generate(self.nodes[0], 1, sync_fun=self.no_op)
self.bump_mocktime(self.quorum_data_thread_request_timeout_seconds + 1)
time.sleep(1)
@ -177,14 +177,14 @@ class QuorumDataRecoveryTest(DashTestFramework):
self.test_mns(llmq_test_v17, quorum_hash_recover, valid_mns=[last_resort_v17], all_mns=member_mns_recover_v17)
# If recovery would be enabled it would trigger after the mocktime bump / mined block
self.bump_mocktime(self.quorum_data_request_expiration_timeout + 1)
self.generate(node, 1)
self.generate(node, 1, sync_fun=self.no_op)
time.sleep(10)
# Make sure they are still invalid
self.test_mns(llmq_test, quorum_hash_recover, valid_mns=[last_resort_test], all_mns=member_mns_recover_test)
self.test_mns(llmq_test_v17, quorum_hash_recover, valid_mns=[last_resort_v17], all_mns=member_mns_recover_v17)
# Mining a block should not result in a chainlock now because the responsible quorum shouldn't have enough
# valid members.
self.wait_for_chainlocked_block(node, self.generate(node, 1)[0], False, 5)
self.wait_for_chainlocked_block(node, self.generate(node, 1, sync_fun=self.no_op)[0], False, 5)
# Now restart with recovery enabled
self.restart_mns(mns=recover_members, exclude=exclude_members, reindex=True, qdata_recovery_enabled=True)
# Validate that all invalid members recover. Note: recover=True leads to mocktime bumps and mining while waiting

View File

@ -85,7 +85,7 @@ class LLMQDKGErrors(DashTestFramework):
self.wait_for_sporks_same()
for _ in range(blockCount):
self.bump_mocktime(1)
self.generate(self.nodes[0], 1)
self.generate(self.nodes[0], 1, sync_fun=self.no_op)
self.sync_all()
self.nodes[0].sporkupdate("SPORK_17_QUORUM_DKG_ENABLED", 0)
self.wait_for_sporks_same()

View File

@ -165,7 +165,7 @@ class LLMQEvoNodesTest(DashTestFramework):
current_evo = None
consecutive_payments = 0
self.generate(self.nodes[0], 1)
self.generate(self.nodes[0], 1, sync_fun=self.no_op)
if i % 8 == 0:
self.sync_blocks()

View File

@ -71,7 +71,7 @@ class LLMQ_IS_CL_Conflicts(DashTestFramework):
self.mine_cycle_quorum(llmq_type_name='llmq_test_dip0024', llmq_type=103)
# mine single block, wait for chainlock
self.generate(self.nodes[0], 1)
self.generate(self.nodes[0], 1, sync_fun=self.no_op)
self.wait_for_chainlocked_block_all_nodes(self.nodes[0].getbestblockhash())
self.test_chainlock_overrides_islock(False)

View File

@ -54,7 +54,7 @@ class LLMQ_IS_RetroactiveSigning(DashTestFramework):
self.wait_for_sporks_same()
# We have to wait in order to include tx in block
self.bump_mocktime(10 * 60 + 1)
block = self.generate(self.nodes[0], 1)[0]
block = self.generate(self.nodes[0], 1, sync_fun=self.no_op)[0]
self.wait_for_instantlock(txid, self.nodes[0])
self.nodes[0].sporkupdate("SPORK_19_CHAINLOCKS_ENABLED", 0)
self.wait_for_sporks_same()
@ -70,7 +70,7 @@ class LLMQ_IS_RetroactiveSigning(DashTestFramework):
# are the only "neighbours" in intra-quorum connections for one of them.
self.wait_for_instantlock(txid, self.nodes[0])
self.bump_mocktime(1)
block = self.generate(self.nodes[0], 1)[0]
block = self.generate(self.nodes[0], 1, sync_fun=self.no_op)[0]
self.wait_for_chainlocked_block_all_nodes(block)
self.log.info("testing normal signing with partially known TX")
@ -100,7 +100,7 @@ class LLMQ_IS_RetroactiveSigning(DashTestFramework):
txid = self.nodes[3].sendrawtransaction(rawtx)
# Make node 3 consider the TX as safe
self.bump_mocktime(10 * 60 + 1)
block = self.generatetoaddress(self.nodes[3], 1, self.nodes[0].getnewaddress())[0]
block = self.generatetoaddress(self.nodes[3], 1, self.nodes[0].getnewaddress(), sync_fun=self.no_op)[0]
self.reconnect_isolated_node(3, 0)
self.wait_for_chainlocked_block_all_nodes(block)
self.nodes[0].setmocktime(self.mocktime)
@ -120,7 +120,7 @@ class LLMQ_IS_RetroactiveSigning(DashTestFramework):
self.wait_for_instantlock(txid, self.nodes[0], False, 5)
# Make node0 consider the TX as safe
self.bump_mocktime(10 * 60 + 1)
block = self.generate(self.nodes[0], 1)[0]
block = self.generate(self.nodes[0], 1, sync_fun=self.no_op)[0]
assert txid in self.nodes[0].getblock(block, 1)['tx']
self.wait_for_chainlocked_block_all_nodes(block)
@ -166,7 +166,7 @@ class LLMQ_IS_RetroactiveSigning(DashTestFramework):
self.wait_for_instantlock(txid, self.nodes[0], False, 5)
# Make node 0 consider the TX as safe
self.bump_mocktime(10 * 60 + 1)
block = self.generate(self.nodes[0], 1)[0]
block = self.generate(self.nodes[0], 1, sync_fun=self.no_op)[0]
assert txid in self.nodes[0].getblock(block, 1)['tx']
self.wait_for_chainlocked_block_all_nodes(block)
@ -198,7 +198,7 @@ class LLMQ_IS_RetroactiveSigning(DashTestFramework):
self.wait_for_instantlock(txid, self.nodes[0], False, 5)
# Make node 0 consider the TX as safe
self.bump_mocktime(10 * 60 + 1)
block = self.generate(self.nodes[0], 1)[0]
block = self.generate(self.nodes[0], 1, sync_fun=self.no_op)[0]
assert txid in self.nodes[0].getblock(block, 1)['tx']
self.wait_for_chainlocked_block_all_nodes(block)

View File

@ -88,7 +88,7 @@ class LLMQQuorumRotationTest(DashTestFramework):
h_104_1 = QuorumId(104, int(h_1, 16))
self.log.info("Mine single block, wait for chainlock")
self.generate(self.nodes[0], 1)
self.generate(self.nodes[0], 1, sync_fun=self.no_op)
self.wait_for_chainlocked_block_all_nodes(self.nodes[0].getbestblockhash())
b_h_1 = self.nodes[0].getbestblockhash()
@ -119,7 +119,7 @@ class LLMQQuorumRotationTest(DashTestFramework):
assert_equal(projected_activation_height, softfork_info['height'])
# v20 is active for the next block, not for the tip
self.generate(self.nodes[0], 1)
self.generate(self.nodes[0], 1, sync_fun=self.no_op)
self.log.info("Wait for chainlock")
self.wait_for_chainlocked_block_all_nodes(self.nodes[0].getbestblockhash())
@ -200,7 +200,7 @@ class LLMQQuorumRotationTest(DashTestFramework):
self.sync_blocks(nodes)
quorum_list = self.nodes[0].quorum("list", llmq_type)
quorum_blockhash = self.nodes[0].getbestblockhash()
fallback_blockhash = self.generate(self.nodes[0], 1)[0]
fallback_blockhash = self.generate(self.nodes[0], 1, sync_fun=self.no_op)[0]
self.log.info("h("+str(self.nodes[0].getblockcount())+") quorum_list:"+str(quorum_list))
assert_greater_than_or_equal(len(intersection(quorum_members_0_0, quorum_members_1_0)), 3)

View File

@ -107,7 +107,7 @@ class LLMQSimplePoSeTest(DashTestFramework):
skip_count = 24 - (self.nodes[0].getblockcount() % 24)
if skip_count != 0:
self.bump_mocktime(skip_count, nodes=nodes)
self.generate(self.nodes[0], skip_count)
self.generate(self.nodes[0], skip_count, sync_fun=self.no_op)
self.sync_blocks(nodes)
q = self.nodes[0].getbestblockhash()

View File

@ -22,17 +22,17 @@ class NewQuorumTypeActivationTest(BitcoinTestFramework):
def run_test(self):
self.log.info(get_bip9_details(self.nodes[0], 'testdummy'))
assert_equal(get_bip9_details(self.nodes[0], 'testdummy')['status'], 'defined')
self.generate(self.nodes[0], 9)
self.generate(self.nodes[0], 9, sync_fun=self.no_op)
assert_equal(get_bip9_details(self.nodes[0], 'testdummy')['status'], 'started')
ql = self.nodes[0].quorum("list")
assert_equal(len(ql), 3)
assert "llmq_test_v17" not in ql
self.generate(self.nodes[0], 10)
self.generate(self.nodes[0], 10, sync_fun=self.no_op)
assert_equal(get_bip9_details(self.nodes[0], 'testdummy')['status'], 'locked_in')
ql = self.nodes[0].quorum("list")
assert_equal(len(ql), 3)
assert "llmq_test_v17" not in ql
self.generate(self.nodes[0], 10)
self.generate(self.nodes[0], 10, sync_fun=self.no_op)
assert_equal(get_bip9_details(self.nodes[0], 'testdummy')['status'], 'active')
ql = self.nodes[0].quorum("list")
assert_equal(len(ql), 4)

View File

@ -53,7 +53,7 @@ class SporkTest(BitcoinTestFramework):
assert self.get_test_spork_state(self.nodes[1]) == spork_new_state
# Generate one block to kick off masternode sync, which also starts sporks syncing for node2
self.generate(self.nodes[1], 1)
self.generate(self.nodes[1], 1, sync_fun=self.no_op)
# connect new node and check spork propagation after restoring from cache
self.connect_nodes(1, 2)

View File

@ -213,7 +213,7 @@ class DashZMQTest (DashTestFramework):
# Subscribe to recovered signature messages
self.subscribe(recovered_sig_publishers)
# Generate a ChainLock and make sure this leads to valid recovered sig ZMQ messages
rpc_last_block_hash = self.generate(self.nodes[0], 1)[0]
rpc_last_block_hash = self.generate(self.nodes[0], 1, sync_fun=self.no_op)[0]
self.wait_for_chainlocked_block_all_nodes(rpc_last_block_hash)
height = self.nodes[0].getblockcount()
rpc_request_id = hash256(ser_string(b"clsig") + struct.pack("<I", height))[::-1].hex()
@ -237,7 +237,7 @@ class DashZMQTest (DashTestFramework):
# Subscribe to ChainLock messages
self.subscribe(chain_lock_publishers)
# Generate ChainLock
generated_hash = self.generate(self.nodes[0], 1)[0]
generated_hash = self.generate(self.nodes[0], 1, sync_fun=self.no_op)[0]
self.wait_for_chainlocked_block_all_nodes(generated_hash)
rpc_best_chain_lock = self.nodes[0].getbestchainlock()
rpc_best_chain_lock_hash = rpc_best_chain_lock["blockhash"]
@ -326,7 +326,7 @@ class DashZMQTest (DashTestFramework):
assert zmq_double_spend_tx_1.is_valid()
assert_equal(zmq_double_spend_tx_1.hash, rpc_raw_tx_1['txid'])
# No islock notifications when tx is not received yet
self.generate(self.nodes[0], 1)
self.generate(self.nodes[0], 1, sync_fun=self.no_op)
rpc_raw_tx_3 = self.create_raw_tx(self.nodes[0], self.nodes[0], 1, 1, 100)
isdlock = self.create_isdlock(rpc_raw_tx_3['hex'])
self.test_node.send_islock(isdlock)

View File

@ -67,11 +67,11 @@ class InstantSendTest(DashTestFramework):
dblspnd_txid = isolated.sendrawtransaction(dblspnd_tx['hex'])
# generate block on isolated node with doublespend transaction
self.bump_mocktime(599)
wrong_early_block = self.generate(isolated, 1)[0]
wrong_early_block = self.generate(isolated, 1, sync_fun=self.no_op)[0]
assert not "confirmation" in isolated.getrawtransaction(dblspnd_txid, 1)
isolated.invalidateblock(wrong_early_block)
self.bump_mocktime(1)
wrong_block = self.generate(isolated, 1)[0]
wrong_block = self.generate(isolated, 1, sync_fun=self.no_op)[0]
assert_equal(isolated.getrawtransaction(dblspnd_txid, 1)["confirmations"], 1)
# connect isolated block to network
self.reconnect_isolated_node(self.isolated_idx, 0)

View File

@ -139,7 +139,7 @@ class SendHeadersTest(BitcoinTestFramework):
# Clear out block announcements from each p2p listener
[p2p.clear_block_announcements() for p2p in self.nodes[0].p2ps]
self.generate(self.nodes[0], count)
self.generate(self.nodes[0], count, sync_fun=self.no_op)
return int(self.nodes[0].getbestblockhash(), 16)
def mine_reorg(self, length):
@ -183,7 +183,7 @@ class SendHeadersTest(BitcoinTestFramework):
a block which hasn't been validated. Verifies only the first request returns
headers.
"""
tip = self.nodes[0].getblockheader(self.generate(self.nodes[0], 1)[0])
tip = self.nodes[0].getblockheader(self.generate(self.nodes[0], 1, sync_fun=self.no_op)[0])
tip_hash = int(tip["hash"], 16)
inv_node.check_last_inv_announcement(inv=[tip_hash])

View File

@ -23,7 +23,7 @@ class RPCMasternodeTest(DashTestFramework):
checked_0_operator_reward = False
checked_non_0_operator_reward = False
while not checked_0_operator_reward or not checked_non_0_operator_reward:
self.generate(self.nodes[0], 1)
self.generate(self.nodes[0], 1, sync_fun=self.no_op)
bi = self.nodes[0].getblockchaininfo()
height = bi["blocks"]
blockhash = bi["bestblockhash"]
@ -59,7 +59,7 @@ class RPCMasternodeTest(DashTestFramework):
self.log.info("test that `masternode payments` results at chaintip match `getblocktemplate` results for that block")
gbt_masternode = self.nodes[0].getblocktemplate()["masternode"]
self.generate(self.nodes[0], 1)
self.generate(self.nodes[0], 1, sync_fun=self.no_op)
payments_masternode = self.nodes[0].masternode("payments")[0]["masternodes"][0]
for i in range(0, len(gbt_masternode)):
assert_equal(gbt_masternode[i]["payee"], payments_masternode["payees"][i]["address"])
@ -84,13 +84,13 @@ class RPCMasternodeTest(DashTestFramework):
protx_info["state"]["operatorPayoutAddress"] == payments_masternode["payees"][0]["address"]
assert option1 or option2
checked_non_0_operator_reward = True
self.generate(self.nodes[0], 1)
self.generate(self.nodes[0], 1, sync_fun=self.no_op)
self.log.info("test that `masternode outputs` show correct list")
addr1 = self.nodes[0].getnewaddress()
addr2 = self.nodes[0].getnewaddress()
self.nodes[0].sendmany('', {addr1: 1000, addr2: 1000})
self.generate(self.nodes[0], 1)
self.generate(self.nodes[0], 1, sync_fun=self.no_op)
# we have 3 masternodes that are running already and 2 new outputs we just created
assert_equal(len(self.nodes[0].masternode("outputs")), 5)

View File

@ -31,7 +31,7 @@ class RPCVerifyChainLockTest(DashTestFramework):
self.nodes[0].sporkupdate("SPORK_17_QUORUM_DKG_ENABLED", 0)
self.wait_for_sporks_same()
self.mine_quorum()
self.wait_for_chainlocked_block(node0, self.generate(node0, 1)[0])
self.wait_for_chainlocked_block(node0, self.generate(node0, 1, sync_fun=self.no_op)[0])
chainlock = node0.getbestchainlock()
block_hash = chainlock["blockhash"]
height = chainlock["height"]
@ -47,8 +47,8 @@ class RPCVerifyChainLockTest(DashTestFramework):
self.wait_for_chainlocked_block_all_nodes(block_hash)
# Isolate node1, mine a block on node0 and wait for its ChainLock
node1.setnetworkactive(False)
self.generate(node0, 1)
self.wait_for_chainlocked_block(node0, self.generate(node0, 1)[0])
self.generate(node0, 1, sync_fun=self.no_op)
self.wait_for_chainlocked_block(node0, self.generate(node0, 1, sync_fun=self.no_op)[0])
chainlock = node0.getbestchainlock()
assert chainlock != node1.getbestchainlock()
block_hash = chainlock["blockhash"]
@ -61,7 +61,7 @@ class RPCVerifyChainLockTest(DashTestFramework):
assert node0.verifychainlock(block_hash, chainlock_signature, height)
assert node1.verifychainlock(block_hash, chainlock_signature, height)
self.generate(node1, 1)
self.generate(node1, 1, sync_fun=self.no_op)
height1 = node1.getblockcount()
tx0 = node0.getblock(node0.getbestblockhash())['tx'][0]
tx1 = node1.getblock(node1.getbestblockhash())['tx'][0]

View File

@ -56,7 +56,7 @@ class RPCVerifyISLockTest(DashTestFramework):
assert node.verifyislock(request_id, txid, rec_sig)
# Not mined, should use maxHeight
assert not node.verifyislock(request_id, txid, rec_sig, 1)
self.generate(node, 1)
self.generate(node, 1, sync_fun=self.no_op)
assert txid not in node.getrawmempool()
# Mined but at higher height, should use maxHeight
assert not node.verifyislock(request_id, txid, rec_sig, 1)

View File

@ -1328,7 +1328,7 @@ class DashTestFramework(BitcoinTestFramework):
fund_txid = self.nodes[0].sendtoaddress(funds_address, 1)
self.wait_for_instantlock(fund_txid, self.nodes[0])
tip = self.generate(self.nodes[0], 1, sync_fun=self.no_op)[0]
tip = self.generate(self.nodes[0], 1)[0]
assert_equal(self.nodes[0].getrawtransaction(fund_txid, 1, tip)['confirmations'], 1)
self.sync_all()
@ -1336,7 +1336,7 @@ class DashTestFramework(BitcoinTestFramework):
try:
protx_result = self.nodes[0].protx('update_service_evo', evo_info.proTxHash, evo_info.addr, evo_info.keyOperator, platform_node_id, platform_p2p_port, platform_http_port, operator_reward_address, funds_address)
self.wait_for_instantlock(protx_result, self.nodes[0])
tip = self.generate(self.nodes[0], 1, sync_fun=self.no_op)[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))
@ -1387,7 +1387,7 @@ class DashTestFramework(BitcoinTestFramework):
if register_fund:
protx_result = self.nodes[0].protx('register_fund', address, ipAndPort, ownerAddr, bls['public'], votingAddr, operatorReward, rewardsAddr, address, submit)
else:
self.generate(self.nodes[0], 1)
self.generate(self.nodes[0], 1, sync_fun=self.no_op)
protx_result = self.nodes[0].protx('register', txid, collateral_vout, ipAndPort, ownerAddr, bls['public'], votingAddr, operatorReward, rewardsAddr, address, submit)
if submit:
@ -1396,7 +1396,7 @@ class DashTestFramework(BitcoinTestFramework):
proTxHash = self.nodes[0].sendrawtransaction(protx_result)
if operatorReward > 0:
self.generate(self.nodes[0], 1)
self.generate(self.nodes[0], 1, sync_fun=self.no_op)
operatorPayoutAddress = self.nodes[0].getnewaddress()
self.nodes[0].protx('update_service', proTxHash, ipAndPort, bls['secret'], operatorPayoutAddress, address)