fix(abstract-utxo): throw on unrecognised chain code#8817
Merged
Conversation
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
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
5728b24 to
edbb6be
Compare
davidkaplanbitgo
approved these changes
May 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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