Skip to content

Commit 56711d9

Browse files
committed
test: flip request-id for asset-unlock-tx instead generation new quorums to get a favour situation
1 parent 4a7937d commit 56711d9

File tree

1 file changed

+23
-30
lines changed

1 file changed

+23
-30
lines changed

test/functional/feature_asset_locks.py

Lines changed: 23 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -668,23 +668,19 @@ def test_withdrawals_fork(self, node_wallet, node, pubkey):
668668
quorumHash_str = format(asset_unlock_tx_payload.quorumHash, '064x')
669669
assert quorumHash_str in node_wallet.quorum('list')['llmq_test_platform']
670670

671-
while quorumHash_str != node_wallet.quorum('list')['llmq_test_platform'][-1]:
672-
self.log.info("Generate one more quorum until signing quorum becomes the last one in the list")
673-
self.mine_quorum_2_nodes()
674-
self.check_mempool_result(tx=asset_unlock_tx, result_expected={'allowed': True, 'fees': {'base': Decimal(str(tiny_amount / COIN))}})
671+
if quorumHash_str != node_wallet.quorum('list')['llmq_test_platform'][-1]:
672+
self.log.info("The quorum for this msg-hash is not the last one in the list of active quorums. Try again!")
673+
index += 1
674+
else:
675+
break
675676

676-
self.log.info("Generate one more quorum after which signing quorum is gone but Asset Unlock tx is still valid")
677-
assert quorumHash_str in node_wallet.quorum('list')['llmq_test_platform']
678-
self.mine_quorum_2_nodes()
679-
assert quorumHash_str not in node_wallet.quorum('list')['llmq_test_platform']
677+
assert quorumHash_str in node_wallet.quorum('list')['llmq_test_platform']
678+
self.log.info("Generate one more quorum to make signing quorum inactive but still valid")
679+
self.mine_quorum_2_nodes()
680+
assert quorumHash_str not in node_wallet.quorum('list')['llmq_test_platform']
680681

681-
if asset_unlock_tx_payload.requestedHeight + HEIGHT_DIFF_EXPIRING > node_wallet.getblockcount():
682-
self.check_mempool_result(tx=asset_unlock_tx, result_expected={'allowed': True, 'fees': {'base': Decimal(str(tiny_amount / COIN))}})
683-
break
684-
else:
685-
self.check_mempool_result(tx=asset_unlock_tx, result_expected={'allowed': False, 'reject-reason' : 'bad-assetunlock-too-late'})
686-
self.log.info("Asset Unlock tx expired, let's try again...")
687-
index += 1
682+
assert asset_unlock_tx_payload.requestedHeight + HEIGHT_DIFF_EXPIRING > node_wallet.getblockcount()
683+
self.check_mempool_result(tx=asset_unlock_tx, result_expected={'allowed': True, 'fees': {'base': Decimal(str(tiny_amount / COIN))}})
688684

689685
self.log.info("Generate one more quorum after which signing quorum becomes too old")
690686
self.mine_quorum_2_nodes()
@@ -724,23 +720,20 @@ def test_v23_fork(self, node_wallet, node, pubkey):
724720
quorumHash_str = format(asset_unlock_tx_payload.quorumHash, '064x')
725721
assert quorumHash_str in node_wallet.quorum('list')['llmq_test_platform']
726722

727-
while quorumHash_str != node_wallet.quorum('list')['llmq_test_platform'][-1]:
728-
self.log.info("Generate one more quorum until signing quorum becomes the last one in the list")
729-
self.mine_quorum_2_nodes()
730-
self.check_mempool_result(tx=asset_unlock_tx, result_expected={'allowed': True, 'fees': {'base': Decimal(str(tiny_amount / COIN))}})
723+
if quorumHash_str != node_wallet.quorum('list')['llmq_test_platform'][-1]:
724+
self.log.info("The quorum for this msg-hash is not the last one in the list of active quorums. Try again!")
725+
index += 1
726+
else:
727+
break
731728

732-
self.log.info("Generate one more quorum after which signing quorum is gone but Asset Unlock tx is still valid")
733-
assert quorumHash_str in node_wallet.quorum('list')['llmq_test_platform']
734-
self.mine_quorum_2_nodes()
735-
assert quorumHash_str not in node_wallet.quorum('list')['llmq_test_platform']
729+
assert quorumHash_str in node_wallet.quorum('list')['llmq_test_platform']
730+
self.log.info("Generate one more quorum to make signing quorum inactive but still valid")
731+
self.mine_quorum_2_nodes()
732+
assert quorumHash_str not in node_wallet.quorum('list')['llmq_test_platform']
736733

737-
if asset_unlock_tx_payload.requestedHeight + HEIGHT_DIFF_EXPIRING > node_wallet.getblockcount():
738-
self.check_mempool_result(tx=asset_unlock_tx, result_expected={'allowed': True, 'fees': {'base': Decimal(str(tiny_amount / COIN))}})
739-
break
740-
else:
741-
self.check_mempool_result(tx=asset_unlock_tx, result_expected={'allowed': False, 'reject-reason' : 'bad-assetunlock-too-late'})
742-
self.log.info("Asset Unlock tx expired, let's try again...")
743-
index += 1
734+
735+
assert asset_unlock_tx_payload.requestedHeight + HEIGHT_DIFF_EXPIRING > node_wallet.getblockcount()
736+
self.check_mempool_result(tx=asset_unlock_tx, result_expected={'allowed': True, 'fees': {'base': Decimal(str(tiny_amount / COIN))}})
744737

745738
self.log.info("Generate one more quorum after which signing quorum becomes too old")
746739
self.mine_quorum_2_nodes()

0 commit comments

Comments
 (0)