Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix: Fix getting keys in wrong network format when no node is used #1188

Merged
merged 3 commits into from
May 27, 2021

Conversation

ben-kaufman
Copy link
Contributor

Fix xpubs being converted to wrong SLIP132 format when no node is connected in Specter.

try:
client.chain = (
Chain.TEST
if derivation.split("/")[2].startswith("1")
Copy link
Collaborator

@moneymanolis moneymanolis May 27, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it be better to be more specific here, setting the chain to main if derivation.split("/") startswith("0"), to test if startswith("1") and raising some error if sth. else (could also be by mistake) is provided? For example, using
m/49h/3h/0h results in a "mainnet key"
grafik

@moneymanolis
Copy link
Collaborator

Tested:
(1) Using a regtest node, imported via USB and custom derivation a mainnet key, was successfully recognized as mainnet and not testnet key.
(2) Using a mainnet node, imported via USB and custom derivation a testnet key, was successfully recognized as testnet and not mainnet key.

@k9ert k9ert merged commit 61f9059 into cryptoadvance:master May 27, 2021
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.

3 participants