Skip to content

fix(abstract-utxo): guard undefined address in preprocessBuildParams#8668

Merged
mohammadalfaiyazbitgo merged 1 commit intomasterfrom
revert-8539-fix/WAL-375-recipients-guard-v2
Apr 30, 2026
Merged

fix(abstract-utxo): guard undefined address in preprocessBuildParams#8668
mohammadalfaiyazbitgo merged 1 commit intomasterfrom
revert-8539-fix/WAL-375-recipients-guard-v2

Conversation

@mohammadalfaiyazbitgo
Copy link
Copy Markdown
Contributor

@mohammadalfaiyazbitgo mohammadalfaiyazbitgo commented Apr 30, 2026

Summary

  • Guard against undefined address in preprocessBuildParams before calling fromExtendedAddressFormat, passing OP_RETURN recipients ({ script, amount }) through unchanged
  • Add unit test for preprocessBuildParams with a mixed normal + OP_RETURN recipients array

Root Cause

When a recipient has no address field (e.g. an OP_RETURN output using { script, amount }), destructuring in preprocessBuildParams gives address = undefined. Calling fromExtendedAddressFormat(undefined)isScriptRecipient(undefined)undefined.toLowerCase()TypeError crash.

The checkRecipient path already had an address && guard (PR #8649), but preprocessBuildParams was missed.

Test Plan

  • yarn unit-test --scope @bitgo/abstract-utxo passes including the new preprocessBuildParams test
  • Repro script (wcn323Repro.ts) runs to completion without TypeError: Cannot read properties of undefined (reading 'toLowerCase') — confirmed against test env, pending approval created successfully

Ticket

WAL-375

@mohammadalfaiyazbitgo mohammadalfaiyazbitgo changed the title fix(abstract-utxo): guard undefined address in preprocessBuildParams [WAL-375] fix(abstract-utxo): guard undefined address in preprocessBuildParams Apr 30, 2026
…AL-375]

What changed:
- guard against undefined address in preprocessBuildParams before calling
  fromExtendedAddressFormat, passing OP_RETURN recipients through unchanged
- add unit test for preprocessBuildParams with mixed normal + OP_RETURN recipients
- add WCN-323 repro script to examples/ts/btc/wcn323Repro.ts

Why:
Recipients with no address field (e.g. OP_RETURN outputs using { script, amount })
caused a TypeError crash in preprocessBuildParams when fromExtendedAddressFormat
called isScriptRecipient(undefined) -> undefined.toLowerCase().

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

TICKET: WAL-375
@mohammadalfaiyazbitgo mohammadalfaiyazbitgo force-pushed the revert-8539-fix/WAL-375-recipients-guard-v2 branch from 079911c to 9651f36 Compare April 30, 2026 19:35
@mohammadalfaiyazbitgo mohammadalfaiyazbitgo marked this pull request as ready for review April 30, 2026 19:35
@mohammadalfaiyazbitgo mohammadalfaiyazbitgo requested a review from a team as a code owner April 30, 2026 19:35
@mohammadalfaiyazbitgo mohammadalfaiyazbitgo merged commit d322a84 into master Apr 30, 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