Skip to content

fix(abstract-utxo): throw on unrecognised chain code#8817

Merged
OttoAllmendinger merged 2 commits into
masterfrom
otto/fix-address-validation
May 20, 2026
Merged

fix(abstract-utxo): throw on unrecognised chain code#8817
OttoAllmendinger merged 2 commits into
masterfrom
otto/fix-address-validation

Conversation

@OttoAllmendinger
Copy link
Copy Markdown
Contributor

generateAddress previously fell back to chain=0 (P2SH) when given an
integer chain code that ChainCode.is() did not recognise. This produced
a misleading UnexpectedAddressError mentioning a P2SH address rather
than anything about the unknown chain, as seen in T1-3385 where
bitgo@18.0.1 did not know chain=40 (p2trMusig2).

Now throws InvalidAddressDerivationPropertyError immediately, naming
the unrecognised chain code so the caller knows to upgrade their SDK.

Refs: T1-3386

Adds two tests to assertFixedScriptWalletAddress that reproduce the class
of failure described in T1-3386 / T1-3385:

- generateAddress silently returns a P2SH address for any unrecognised
  chain code (e.g. a future chain=99) instead of throwing
- assertFixedScriptWalletAddress then throws a misleading
  UnexpectedAddressError that mentions a P2SH address rather than the
  unrecognised chain code

These tests document current (broken) behaviour and should be updated
when T1-3386 is fixed.

Refs: T1-3386
@linear-code
Copy link
Copy Markdown

linear-code Bot commented May 20, 2026

T1-3386

generateAddress previously fell back to chain=0 (P2SH) when given an
integer chain code that ChainCode.is() did not recognise. This produced
a misleading UnexpectedAddressError mentioning a P2SH address rather
than anything about the unknown chain, as seen in T1-3385 where
bitgo@18.0.1 did not know chain=40 (p2trMusig2).

Now throws InvalidAddressDerivationPropertyError immediately, naming
the unrecognised chain code so the caller knows to upgrade their SDK.

Refs: T1-3386
@OttoAllmendinger OttoAllmendinger force-pushed the otto/fix-address-validation branch from 5728b24 to edbb6be Compare May 20, 2026 10:30
@OttoAllmendinger OttoAllmendinger marked this pull request as ready for review May 20, 2026 10:51
@OttoAllmendinger OttoAllmendinger requested a review from a team as a code owner May 20, 2026 10:51
@OttoAllmendinger OttoAllmendinger merged commit 7898f7e into master May 20, 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