Follow-up to #35664.
Going through which script error codes script_tests.json covers, I found that neither error gated behind SCRIPT_VERIFY_CONST_SCRIPTCODE is asserted anywhere. SCRIPT_ERR_SIG_FINDANDDELETE is not asserted by any test; SCRIPT_ERR_OP_CODESEPARATOR appears only as a mempool reject string in invalid_txs.py, never at the script level. tx_invalid.json does have a CONST_SCRIPTCODE section, but those vectors can only say a transaction is invalid, not which error made it fail; script_tests.json is the harness that pins error codes, and it has no vector using the flag.
This adds six vectors. Four fail with the flag set:
OP_CODESEPARATORin an executed pre-segwit script.OP_CODESEPARATORin an unexecutedIFbranch. The check inEvalScriptruns ahead of thefExecguard, so the opcode is rejected even though it never executes — the rule with no error-level coverage before.- A signature push that also appears in the scriptPubKey, against
CHECKSIG. - The same against
CHECKMULTISIG, which callsFindAndDeletein a separate loop.
The other two are controls with the flag off, one per error. Both checks run before signature verification, so the vectors can use a dummy signature.
To confirm the expected errors are the ones that fire, I added the vectors expecting OK first and let the harness report the actual error for each.
Tested with:
build/bin/test_bitcoin --run_test=script_tests/script_json_test