Skip to content

test: Expand script verification tests to cover all output types and flags#137

Open
stringintech wants to merge 1 commit intosedited:masterfrom
stringintech:expand-script-verify-tests
Open

test: Expand script verification tests to cover all output types and flags#137
stringintech wants to merge 1 commit intosedited:masterfrom
stringintech:expand-script-verify-tests

Conversation

@stringintech
Copy link

@stringintech stringintech commented Feb 17, 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.

…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.
@stringintech stringintech force-pushed the expand-script-verify-tests branch from 46d18e1 to 3cac307 Compare February 17, 2026 15:42
@alexanderwiederin
Copy link
Contributor

Can we reuse these tests in the other libraries?

@stringintech
Copy link
Author

Can we reuse these tests in the other libraries?

Yes, my main motivation was to be able to extend the tests in kernel-bindings-tests, and I'm planning to open a PR there as well soon!

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