From 7a96c8be94fbe414b879859acb482ca596b25bab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20B=C3=ADlek?= Date: Thu, 17 Jan 2019 17:37:38 +0700 Subject: [PATCH] Fix android speed by skipping base58 validation This significantly speeds up Android version of webwallet, by ignoring expansive xpub base58 validation --- src/utils/hdnode.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils/hdnode.js b/src/utils/hdnode.js index b727dec2..d4d9da93 100644 --- a/src/utils/hdnode.js +++ b/src/utils/hdnode.js @@ -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; @@ -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 - ' +