Skip to content
This repository has been archived by the owner on Aug 12, 2022. It is now read-only.

Fix android speed by skipping base58 validation #93

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/utils/hdnode.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ function convertXpub(original: string, network: bitcoin.Network) {
// it's bitcoin-like => return xpub
return original;
} else {
const node = bitcoin.HDNode.fromBase58(original); // use bitcoin magic
const node = bitcoin.HDNode.fromBase58(original, null, true); // use bitcoin magic

// "hard-fix" the new network into the HDNode keypair
node.keyPair.network = network;
Expand All @@ -81,7 +81,7 @@ export function pubKey2bjsNode(

const bjsXpub: string = bjsNode.toBase58();
// const keyXpub: string = convertXpub(key.message.xpub, network);
const keyXpub = convert ? convertXpub(key.message.xpub, network) : bitcoin.HDNode.fromBase58(key.message.xpub, network).toBase58();
const keyXpub = convert ? convertXpub(key.message.xpub, network) : bitcoin.HDNode.fromBase58(key.message.xpub, network, true).toBase58();

if (bjsXpub !== keyXpub) {
throw new Error('Invalid public key transmission detected - ' +
Expand Down