Repository navigation
Conversation
…keys early A pasted extended key that carries a trailing newline or tab (line-wrapped exports, notes, chat messages) was forwarded to the node verbatim: the SLIP-132 conversion silently fell back to the raw zpub and the node answered with an opaque miniscript checksum error. Descriptors and extended keys never contain whitespace, so drop all of it from the field and again before wrapping, and check a bare key's Base58Check checksum on the app side so a truncated or mistyped key gets a readable message instead of a wallet error. The key checks and the descriptor wrapping run on an injected default dispatcher and the RPC on the IO one (`CoroutineDispatchers`), instead of on the main thread; the Settings tests drive both with a StandardTestDispatcher under runTest. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
jvsena42
force-pushed
the
fix/descriptor-input-whitespace
branch
from
September 25, 2026 21:11
6c6938c to
42b0b1c
Compare
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.
Part of #164 (the "app doesn't accept this zpub" report).
What was found
On the current build a clean zpub pasted from BlueWallet's export screen is accepted (converted to
wpkh(xpub…/<0;1>/*)and loaded by the node; verified on the emulator). The failing inputs found are keys that arrive with stray whitespace or a typo:removeSpaces()only dropped spaces, the SLIP-132 conversion silently fell back to the rawzpub, and the node answered with an opaqueMiniscriptError(Parse(Tree(Checksum(InvalidCharacter { ch: '\n' … })))).Bip32Xpub(Base58(IncorrectChecksum …))wallet error.Changes
DescriptorUtils.sanitizedrops all whitespace from descriptor input (descriptors and extended keys never contain any); applied while typing and again before wrapping.DescriptorUtils.extendedKeyErrorchecks a bare extended key's Base58Check checksum on the app side and the Settings screen shows a readable message ("This extended key is not valid (bad checksum)…") instead of the wallet error. Full descriptors are still left to the node.Tests
DescriptorUtilsTest: sanitize, wrapping a zpub with a trailing newline, checksum validation (public BIP84 test vector).SettingsViewModelTest: typed text loses whitespace; a corrupted key is rejected without an RPC call../gradlew :app:testDebugUnitTest detekt lintDebugpass; the paste-from-BlueWallet flow verified on the emulator.🤖 Generated with Claude Code