scripted-diff: validation: rename mandatory errors into block errors

Using "block" or "mempool" as the prefix in place of "mandatory" or "non-mandatory" is clearer
to a user. "non-mandatory" was renamed into "mempool" as part of #33050. This takes care of the
other half of this renaming as a scripted diff.

-BEGIN VERIFY SCRIPT-
sed -i 's/mandatory-script-verify/block-script-verify/g' $(git grep -l mandatory-script-verify)
-END VERIFY SCRIPT-
This commit is contained in:
Antoine Poinsot committed 2025-08-13 11:05:54 -04:00
1 parent dbf8b0980b
commit 9a04635432
11 files changed
+28 -28

No files matched your search

+10 -10
View File
@@ -505,7 +505,7 @@ class SegWitTest(BitcoinTestFramework):
# invalid (transactions are always validated with SCRIPT_VERIFY_WITNESS so a segwit v0 transaction
# without a witness is invalid).
test_witness_block(self.nodes[0], self.test_node, block, accepted=False, with_witness=False,
reason='mandatory-script-verify-flag-failed (Witness program was passed an empty witness)')
reason='block-script-verify-flag-failed (Witness program was passed an empty witness)')
self.utxo.pop(0)
self.utxo.append(UTXO(txid, 2, value))
@@ -977,7 +977,7 @@ class SegWitTest(BitcoinTestFramework):
# Extra witness data should not be allowed.
test_witness_block(self.nodes[0], self.test_node, block, accepted=False,
reason='mandatory-script-verify-flag-failed (Witness provided for non-witness script)')
reason='block-script-verify-flag-failed (Witness provided for non-witness script)')
# Try extra signature data. Ok if we're not spending a witness output.
block.vtx[1].wit.vtxinwit = []
@@ -1002,7 +1002,7 @@ class SegWitTest(BitcoinTestFramework):
# This has extra witness data, so it should fail.
test_witness_block(self.nodes[0], self.test_node, block, accepted=False,
reason='mandatory-script-verify-flag-failed (Stack size must be exactly one after execution)')
reason='block-script-verify-flag-failed (Stack size must be exactly one after execution)')
# Now get rid of the extra witness, but add extra scriptSig data
tx2.vin[0].scriptSig = CScript([OP_TRUE])
@@ -1014,7 +1014,7 @@ class SegWitTest(BitcoinTestFramework):
# This has extra signature data for a witness input, so it should fail.
test_witness_block(self.nodes[0], self.test_node, block, accepted=False,
reason='mandatory-script-verify-flag-failed (Witness requires empty scriptSig)')
reason='block-script-verify-flag-failed (Witness requires empty scriptSig)')
# Now get rid of the extra scriptsig on the witness input, and verify
# success (even with extra scriptsig data in the non-witness input)
@@ -1050,7 +1050,7 @@ class SegWitTest(BitcoinTestFramework):
self.update_witness_block_with_transactions(block, [tx, tx2])
test_witness_block(self.nodes[0], self.test_node, block, accepted=False,
reason='mandatory-script-verify-flag-failed (Push value size limit exceeded)')
reason='block-script-verify-flag-failed (Push value size limit exceeded)')
# Now reduce the length of the stack element
tx2.wit.vtxinwit[0].scriptWitness.stack[0] = b'a' * (MAX_SCRIPT_ELEMENT_SIZE)
@@ -1089,7 +1089,7 @@ class SegWitTest(BitcoinTestFramework):
self.update_witness_block_with_transactions(block, [tx, tx2])
test_witness_block(self.nodes[0], self.test_node, block, accepted=False,
reason='mandatory-script-verify-flag-failed (Script is too big)')
reason='block-script-verify-flag-failed (Script is too big)')
# Try again with one less byte in the witness script
witness_script = CScript([b'a' * MAX_SCRIPT_ELEMENT_SIZE] * 19 + [OP_DROP] * 62 + [OP_TRUE])
@@ -1179,7 +1179,7 @@ class SegWitTest(BitcoinTestFramework):
block.vtx = [block.vtx[0]]
self.update_witness_block_with_transactions(block, [tx2])
test_witness_block(self.nodes[0], self.test_node, block, accepted=False,
reason='mandatory-script-verify-flag-failed (Operation not valid with the current stack size)')
reason='block-script-verify-flag-failed (Operation not valid with the current stack size)')
# Fix the broken witness and the block should be accepted.
tx2.wit.vtxinwit[5].scriptWitness.stack = [b'a', witness_script]
@@ -1535,7 +1535,7 @@ class SegWitTest(BitcoinTestFramework):
sign_p2pk_witness_input(witness_script, tx, 0, hashtype, prev_utxo.nValue + 1, key)
self.update_witness_block_with_transactions(block, [tx])
test_witness_block(self.nodes[0], self.test_node, block, accepted=False,
reason='mandatory-script-verify-flag-failed (Script evaluated without error '
reason='block-script-verify-flag-failed (Script evaluated without error '
'but finished with a false/empty top stack element')
# Too-small input value
@@ -1543,7 +1543,7 @@ class SegWitTest(BitcoinTestFramework):
block.vtx.pop() # remove last tx
self.update_witness_block_with_transactions(block, [tx])
test_witness_block(self.nodes[0], self.test_node, block, accepted=False,
reason='mandatory-script-verify-flag-failed (Script evaluated without error '
reason='block-script-verify-flag-failed (Script evaluated without error '
'but finished with a false/empty top stack element')
# Now try correct value
@@ -1647,7 +1647,7 @@ class SegWitTest(BitcoinTestFramework):
block = self.build_next_block()
self.update_witness_block_with_transactions(block, [tx, tx2])
test_witness_block(self.nodes[0], self.test_node, block, accepted=False,
reason='mandatory-script-verify-flag-failed (Witness requires empty scriptSig)')
reason='block-script-verify-flag-failed (Witness requires empty scriptSig)')
# Move the signature to the witness.
block.vtx.pop()