Skip to content

test: Expand script verification tests to cover all output types and flags (continued)#146

Merged
sedited merged 1 commit intosedited:masterfrom
alexanderwiederin:expand-script-verify-tests
Mar 26, 2026
Merged

test: Expand script verification tests to cover all output types and flags (continued)#146
sedited merged 1 commit intosedited:masterfrom
alexanderwiederin:expand-script-verify-tests

Conversation

@alexanderwiederin
Copy link
Copy Markdown
Contributor

@alexanderwiederin alexanderwiederin commented Mar 23, 2026

Addresses #132.

Summary

  • New output types not previously tested: P2SH-multisig, CLTV, CSV, native P2WPKH, native P2WSH, P2TR script-path
  • New flags exercised individually: VERIFY_NONE, VERIFY_P2SH, VERIFY_DERSIG, VERIFY_NULLDUMMY, VERIFY_CHECKLOCKTIMEVERIFY, VERIFY_CHECKSEQUENCEVERIFY
  • Split script_verify_test into separate tests for each output type

Approach

Subtests are ordered from oldest output types to newest. Each test follows the same pattern:

  1. Valid transaction passes with both minimal and full flags
  2. An altered transaction fails — the spk stays the same and the transaction itself is modified (corrupted signature, wrong amount, different locktime/sequence)
  3. Stripping the relevant flag lets the altered transaction pass, confirming that flag is what catches the issue

For CLTV and CSV, changing locktime/sequence requires a fresh signature, so the invalid case uses a re-signed transaction rather than a byte flip. Unlike the other tests which use real mainnet transactions, the CLTV and CSV test data was created on regtest using a functional test.

Supersedes

This PR continues #137 by @stringintech with the following review feedback addressed:

…flags

New output types covered: P2SH-multisig, CLTV, CSV, P2WPKH, P2WSH,
P2TR script-path.
New flags covered: VERIFY_NONE, VERIFY_P2SH, VERIFY_DERSIG,
VERIFY_NULLDUMMY, VERIFY_CHECKLOCKTIMEVERIFY,
VERIFY_CHECKSEQUENCEVERIFY.

Split script_verify_test into per-output-type tests. Each test checks
validity with and without its relevant flag.

Co-authored-by: stringintech <stringintech@gmail.com>
@alexanderwiederin alexanderwiederin changed the title test: Expand script verification tests to cover all output types and flags test: Expand script verification tests to cover all output types and flags (continued) Mar 23, 2026
Copy link
Copy Markdown
Owner

@sedited sedited left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

We should really expose those granular script error types, would make looking this over much easier.

@sedited sedited merged commit 3184f6f into sedited:master Mar 26, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants