Skip to content

fix: handle invalid script data after OP_RETURN in DecodeScript#96

Merged
mergify[bot] merged 1 commit intomasterfrom
fix/decode-op-return
Feb 20, 2026
Merged

fix: handle invalid script data after OP_RETURN in DecodeScript#96
mergify[bot] merged 1 commit intomasterfrom
fix/decode-op-return

Conversation

@shruggr
Copy link
Collaborator

@shruggr shruggr commented Feb 20, 2026

Summary

  • Passes DecodeOptionsParseOpReturn to script.DecodeScript in xput.go so OP_RETURN data is parsed correctly
  • Returns nil instead of propagating error when DecodeScript fails on unparseable output scripts (e.g. sCrypt contracts, non-standard OP_RETURN data)
  • Bumps go-sdk from v1.1.27 to v1.2.18 (which introduced DecodeOptionsParseOpReturn)

Problem

Transaction 471442b27852e6a1a83e2f2bec8c1712ad3721534f2e35fda89b853471e7898f crashes the parsing pipeline. It contains an sCrypt contract output and a non-standard OP_RETURN output with invalid push data encoding. Without DecodeOptionsParseOpReturn, DecodeScript doesn't attempt to parse OP_RETURN data at all. With it enabled, when the post-OP_RETURN bytes can't be decoded, we now return nil so that:

  1. The unparseable output still flows through with metadata (satoshis, address, index) but empty tapes
  2. Other outputs in the same transaction parse normally
  3. The entire transaction is not killed by one bad output

@mergify
Copy link
Contributor

mergify bot commented Feb 20, 2026

Welcome to our open-source project! 💘

@mergify mergify bot added the bug-P3 Lowest rated bug, affects nearly none or low-impact label Feb 20, 2026
@shruggr shruggr force-pushed the fix/decode-op-return branch from 82d1b63 to f45dc30 Compare February 20, 2026 17:16
@mergify mergify bot merged commit 0f1986d into master Feb 20, 2026
4 checks passed
@mergify mergify bot deleted the fix/decode-op-return branch February 20, 2026 17:20
@codecov
Copy link

codecov bot commented Feb 20, 2026

Codecov Report

❌ Patch coverage is 50.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 75.60%. Comparing base (447156f) to head (f45dc30).
⚠️ Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
xput.go 50.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #96   +/-   ##
=======================================
  Coverage   75.60%   75.60%           
=======================================
  Files           3        3           
  Lines         287      287           
=======================================
  Hits          217      217           
  Misses         51       51           
  Partials       19       19           
Flag Coverage Δ
unittests 75.60% <50.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
xput.go 78.28% <50.00%> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 447156f...f45dc30. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug-P3 Lowest rated bug, affects nearly none or low-impact

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants