FIX: speedup multisig

This commit is contained in:
Overtorment 2020-10-14 18:14:16 +01:00
parent fef49136ca
commit 8c0487adab
2 changed files with 3 additions and 1 deletions

View file

@ -399,6 +399,8 @@ export class AbstractHDElectrumWallet extends AbstractHDWallet {
txs = txs.concat(addressTxs); txs = txs.concat(addressTxs);
} }
if (txs.length === 0) return []; // guard clause; so we wont spend time calculating addresses
// its faster to pre-build hashmap of owned addresses than to query `this.weOwnAddress()`, which in turn // its faster to pre-build hashmap of owned addresses than to query `this.weOwnAddress()`, which in turn
// iterates over all addresses in hierarchy // iterates over all addresses in hierarchy
const ownedAddressesHashmap = {}; const ownedAddressesHashmap = {};

View file

@ -190,6 +190,7 @@ export class MultisigHDWallet extends AbstractHDElectrumWallet {
const xpub = this._getXpubFromCosigner(cosigner); const xpub = this._getXpubFromCosigner(cosigner);
const hdNode = HDNode.fromBase58(xpub); const hdNode = HDNode.fromBase58(xpub);
_node = hdNode.derive(nodeIndex); _node = hdNode.derive(nodeIndex);
this._nodes[nodeIndex][cosignerIndex] = _node;
} else { } else {
_node = this._nodes[nodeIndex][cosignerIndex]; _node = this._nodes[nodeIndex][cosignerIndex];
} }
@ -487,7 +488,6 @@ export class MultisigHDWallet extends AbstractHDElectrumWallet {
xpub = xpub.substr(0, xpub.indexOf('/')); xpub = xpub.substr(0, xpub.indexOf('/'));
} }
// console.warn('m[2] = ', m[2], {hexFingerprint, path, xpub});
this.addCosigner(xpub, hexFingerprint.toUpperCase(), path); this.addCosigner(xpub, hexFingerprint.toUpperCase(), path);
} }
} }