Skip to content

fix(abstract-utxo): guard address in checkRecipient for OP_RETURN outputs#8649

Merged
mohammadalfaiyazbitgo merged 1 commit intomasterfrom
worktree-wal-826-fix-check-recipient
Apr 29, 2026
Merged

fix(abstract-utxo): guard address in checkRecipient for OP_RETURN outputs#8649
mohammadalfaiyazbitgo merged 1 commit intomasterfrom
worktree-wal-826-fix-check-recipient

Conversation

@mohammadalfaiyazbitgo
Copy link
Copy Markdown
Contributor

Summary

  • Make address optional in checkRecipient parameter type to reflect runtime reality
  • Add recipient.address && guard before calling isScriptRecipient to prevent crash when address is undefined
  • Pass explicit object to super.checkRecipient to satisfy its address: string constraint after the type narrows
  • Add unit tests covering OP_RETURN (no address) and script-prefixed recipient cases

Test Plan

  • New tests in modules/abstract-utxo/test/unit/transaction/recipient.ts all pass (5 tests)
  • Verify no crash when calling pendingApproval.approve() on a BTC wallet with an OP_RETURN output in buildParams.recipients
  • All existing abstract-utxo unit tests pass

Ticket

WAL-826

@linear
Copy link
Copy Markdown

linear Bot commented Apr 28, 2026

…puts

What changed:
- make address optional in checkRecipient parameter type
- add recipient.address guard before calling isScriptRecipient
- pass explicit object to super.checkRecipient to satisfy its address: string type
- add unit tests covering OP_RETURN and script-prefixed recipient cases

Why:
OP_RETURN recipients have no address field at runtime; calling
isScriptRecipient(undefined) unconditionally invoked undefined.toLowerCase()
causing a crash when approving pending approvals containing OP_RETURN outputs.

TICKET: WAL-826
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@mohammadalfaiyazbitgo mohammadalfaiyazbitgo force-pushed the worktree-wal-826-fix-check-recipient branch from 7b3d49d to 5f0d1ed Compare April 28, 2026 19:43
@mohammadalfaiyazbitgo mohammadalfaiyazbitgo marked this pull request as ready for review April 29, 2026 02:40
@mohammadalfaiyazbitgo mohammadalfaiyazbitgo requested a review from a team as a code owner April 29, 2026 02:40
@mohammadalfaiyazbitgo mohammadalfaiyazbitgo merged commit 447d400 into master Apr 29, 2026
22 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