• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

btcsuite / btcd / 23467752405
56%
master: 46%

Build:
Build:
LAST BUILD BRANCH: netsync-simnet-sync-candidate
DEFAULT BRANCH: master
Ran 24 Mar 2026 12:56AM UTC
Jobs 4
Files 282
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

24 Mar 2026 12:53AM UTC coverage: 55.01% (+0.06%) from 54.954%
23467752405

push

github

Roasbeef
txscript: reject OP_CODESEPARATOR in unexecuted branches for non-segwit

In this commit, we fix a policy-level divergence with Bitcoin Core when
handling OP_CODESEPARATOR inside unexecuted OP_IF branches in non-segwit
scripts with the ScriptVerifyConstScriptCode flag.

Bitcoin Core's EvalScript (interpreter.cpp:474-476) places the
SCRIPT_VERIFY_CONST_SCRIPTCODE check for OP_CODESEPARATOR before the
fExec branch-execution gate, causing it to fire unconditionally on every
OP_CODESEPARATOR encountered during script iteration -- even inside
OP_FALSE OP_IF ... OP_ENDIF envelopes.

Previously, btcd's equivalent check lived inside the opcodeCodeSeparator
handler, which was never reached for opcodes in unexecuted branches due
to the early return in executeOpcode that skips non-conditional opcodes
when isBranchExecuting() is false. This meant a script like:

  OP_FALSE OP_IF OP_CODESEPARATOR OP_ENDIF <validation>

would be rejected by Bitcoin Core's mempool but accepted by btcd's.

The fix moves the check before the branch-execution gate in
executeOpcode, matching Bitcoin Core's structure. This follows the
existing pattern in btcd where isOpcodeDisabled and isOpcodeAlwaysIllegal
checks already fire regardless of branch execution state.

Note: SCRIPT_VERIFY_CONST_SCRIPTCODE is purely a policy flag (included
in STANDARD_SCRIPT_VERIFY_FLAGS but not MANDATORY_SCRIPT_VERIFY_FLAGS),
so this was not a consensus divergence. Both implementations would accept
such transactions if mined in a block.

Found via differential fuzzing by Bruno from bitcoinfuzz.

7 of 7 new or added lines in 1 file covered. (100.0%)

6 existing lines in 2 files now uncovered.

31203 of 56722 relevant lines covered (55.01%)

445113.36 hits per line

Coverage Regressions

Lines Coverage ∆ File
5
97.99
-0.5% txscript/opcode.go
1
80.95
-0.3% btcutil/gcs/gcs.go
Jobs
ID Job ID Ran Files Coverage
1 btcutilpsbt - 23467752405.1 24 Mar 2026 12:56AM UTC 98
21.79
GitHub Action Run
2 btcec - 23467752405.2 24 Mar 2026 12:56AM UTC 18
80.51
GitHub Action Run
3 btcd - 23467752405.3 24 Mar 2026 12:56AM UTC 250
49.66
GitHub Action Run
4 btcutil - 23467752405.4 24 Mar 2026 12:56AM UTC 120
18.86
GitHub Action Run
Source Files on build 23467752405
  • Tree
  • List 282
  • Changed 4
  • Source Changed 1
  • Coverage Changed 4
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #23467752405
  • 1d827e03 on github
  • Prev Build on master (#20942501138)
  • Delete
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc