mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 20:12:57 +01:00
Merge #17959: test: check specific reject reasons in feature_csv_activation.py
54be4e71d898de8f14e3269550d56097c023d1cc test: check specific reject reasons in feature_csv_activation.py (Sebastian Falbesoner) Pull request description: This is kind of a prequel to #17921: increases the general quality of the functional test `feature_csv_activation.py` by checking for the specific reject reasons whenever the sending of a block fails. To get the reason, we have to limit the script threads to 1 via the parameter `-par=1`, like it is also done in `feature_cltv.py`:a654626f07/test/functional/feature_cltv.py (L57-L61)
The commit also fixes a bug that was uncovered with this checks: for the BIP112 version 1 tx tests, txs from `bip112txs_vary_OP_CSV_v1` have been add twice to the list `failed_txs`:a654626f07/test/functional/feature_csv_activation.py (L396-L397)
leading also to a block rejection as expected but for the wrong reason. It seems one of those two tx lists was meant to be `bip112txs_vary_OP_CSV_v1` (without the `_9`) and it was a typo. ACKs for top commit: MarcoFalke: ACK 54be4e71d898de8f14e3269550d56097c023d1cc 📶 Tree-SHA512: 9aac11aee3f53f1ae95ddb346a2f268872038f4d118c8dcf81b8201dee869774c9f3c3f1c326e370b8fd4eaf8e0673371689a96d9b1cb91be4286c88824725c3
This commit is contained in:
parent
3f4a79f948
commit
64118fd2b2
@ -386,7 +386,7 @@ class BIP68_112_113Test(BitcoinTestFramework):
|
||||
bip113tx_v2.nLockTime = self.last_block_time - 600 * 5 # = MTP of prior block (not <) but < time put on current block
|
||||
bip113signed2 = sign_transaction(self.nodes[0], bip113tx_v2)
|
||||
for bip113tx in [bip113signed1, bip113signed2]:
|
||||
self.send_blocks([self.create_test_block([bip113tx])], success=False)
|
||||
self.send_blocks([self.create_test_block([bip113tx])], success=False, reject_reason='bad-txns-nonfinal')
|
||||
# BIP 113 tests should now pass if the locktime is < MTP
|
||||
bip113tx_v1.nLockTime = self.last_block_time - 600 * 5 - 1 # < MTP of prior block
|
||||
bip113signed1 = sign_transaction(self.nodes[0], bip113tx_v1)
|
||||
@ -418,11 +418,11 @@ class BIP68_112_113Test(BitcoinTestFramework):
|
||||
# All txs without flag fail as we are at delta height = 8 < 10 and delta time = 8 * 600 < 10 * 512
|
||||
bip68timetxs = [tx['tx'] for tx in bip68txs_v2 if not tx['sdf'] and tx['stf']]
|
||||
for tx in bip68timetxs:
|
||||
self.send_blocks([self.create_test_block([tx])], success=False)
|
||||
self.send_blocks([self.create_test_block([tx])], success=False, reject_reason='bad-txns-nonfinal')
|
||||
|
||||
bip68heighttxs = [tx['tx'] for tx in bip68txs_v2 if not tx['sdf'] and not tx['stf']]
|
||||
for tx in bip68heighttxs:
|
||||
self.send_blocks([self.create_test_block([tx])], success=False)
|
||||
self.send_blocks([self.create_test_block([tx])], success=False, reject_reason='bad-txns-nonfinal')
|
||||
|
||||
# Advance one block to 581
|
||||
test_blocks = self.generate_blocks(1, 1234)
|
||||
@ -433,7 +433,7 @@ class BIP68_112_113Test(BitcoinTestFramework):
|
||||
self.send_blocks([self.create_test_block(bip68success_txs)])
|
||||
self.nodes[0].invalidateblock(self.nodes[0].getbestblockhash())
|
||||
for tx in bip68heighttxs:
|
||||
self.send_blocks([self.create_test_block([tx])], success=False)
|
||||
self.send_blocks([self.create_test_block([tx])], success=False, reject_reason='bad-txns-nonfinal')
|
||||
|
||||
# Advance one block to 582
|
||||
test_blocks = self.generate_blocks(1, 1234)
|
||||
@ -448,7 +448,8 @@ class BIP68_112_113Test(BitcoinTestFramework):
|
||||
self.log.info("Test version 1 txs")
|
||||
|
||||
# -1 OP_CSV tx and (empty stack) OP_CSV tx should fail
|
||||
self.send_blocks([self.create_test_block([bip112tx_special_v1])], success=False)
|
||||
self.send_blocks([self.create_test_block([bip112tx_special_v1])], success=False,
|
||||
reject_reason='non-mandatory-script-verify-flag (Negative locktime)')
|
||||
self.send_blocks([self.create_test_block([bip112tx_emptystack_v1])], success=False,
|
||||
reject_reason='non-mandatory-script-verify-flag (Operation not valid with the current stack size)')
|
||||
# If SEQUENCE_LOCKTIME_DISABLE_FLAG is set in argument to OP_CSV, version 1 txs should still pass
|
||||
@ -461,15 +462,17 @@ class BIP68_112_113Test(BitcoinTestFramework):
|
||||
# If SEQUENCE_LOCKTIME_DISABLE_FLAG is unset in argument to OP_CSV, version 1 txs should now fail
|
||||
fail_txs = all_rlt_txs(bip112txs_vary_nSequence_v1)
|
||||
fail_txs += all_rlt_txs(bip112txs_vary_nSequence_9_v1)
|
||||
fail_txs += [tx['tx'] for tx in bip112txs_vary_OP_CSV_9_v1 if not tx['sdf']]
|
||||
fail_txs += [tx['tx'] for tx in bip112txs_vary_OP_CSV_v1 if not tx['sdf']]
|
||||
fail_txs += [tx['tx'] for tx in bip112txs_vary_OP_CSV_9_v1 if not tx['sdf']]
|
||||
for tx in fail_txs:
|
||||
self.send_blocks([self.create_test_block([tx])], success=False)
|
||||
self.send_blocks([self.create_test_block([tx])], success=False,
|
||||
reject_reason='non-mandatory-script-verify-flag (Locktime requirement not satisfied)')
|
||||
|
||||
self.log.info("Test version 2 txs")
|
||||
|
||||
# -1 OP_CSV tx and (empty stack) OP_CSV tx should fail
|
||||
self.send_blocks([self.create_test_block([bip112tx_special_v2])], success=False)
|
||||
self.send_blocks([self.create_test_block([bip112tx_special_v2])], success=False,
|
||||
reject_reason='non-mandatory-script-verify-flag (Negative locktime)')
|
||||
self.send_blocks([self.create_test_block([bip112tx_emptystack_v2])], success=False,
|
||||
reject_reason='non-mandatory-script-verify-flag (Operation not valid with the current stack size)')
|
||||
|
||||
@ -486,18 +489,21 @@ class BIP68_112_113Test(BitcoinTestFramework):
|
||||
fail_txs = all_rlt_txs(bip112txs_vary_nSequence_9_v2)
|
||||
fail_txs += [tx['tx'] for tx in bip112txs_vary_OP_CSV_9_v2 if not tx['sdf']]
|
||||
for tx in fail_txs:
|
||||
self.send_blocks([self.create_test_block([tx])], success=False)
|
||||
self.send_blocks([self.create_test_block([tx])], success=False,
|
||||
reject_reason='non-mandatory-script-verify-flag (Locktime requirement not satisfied)')
|
||||
|
||||
# If SEQUENCE_LOCKTIME_DISABLE_FLAG is set in nSequence, tx should fail
|
||||
fail_txs = [tx['tx'] for tx in bip112txs_vary_nSequence_v2 if tx['sdf']]
|
||||
for tx in fail_txs:
|
||||
self.send_blocks([self.create_test_block([tx])], success=False)
|
||||
self.send_blocks([self.create_test_block([tx])], success=False,
|
||||
reject_reason='non-mandatory-script-verify-flag (Locktime requirement not satisfied)')
|
||||
|
||||
# If sequencelock types mismatch, tx should fail
|
||||
fail_txs = [tx['tx'] for tx in bip112txs_vary_nSequence_v2 if not tx['sdf'] and tx['stf']]
|
||||
fail_txs += [tx['tx'] for tx in bip112txs_vary_OP_CSV_v2 if not tx['sdf'] and tx['stf']]
|
||||
for tx in fail_txs:
|
||||
self.send_blocks([self.create_test_block([tx])], success=False)
|
||||
self.send_blocks([self.create_test_block([tx])], success=False,
|
||||
reject_reason='non-mandatory-script-verify-flag (Locktime requirement not satisfied)')
|
||||
|
||||
# Remaining txs should pass, just test masking works properly
|
||||
success_txs = [tx['tx'] for tx in bip112txs_vary_nSequence_v2 if not tx['sdf'] and not tx['stf']]
|
||||
|
Loading…
Reference in New Issue
Block a user