diff --git a/lib/wallet/walletdb.js b/lib/wallet/walletdb.js index 7e637625..6a122fd0 100644 --- a/lib/wallet/walletdb.js +++ b/lib/wallet/walletdb.js @@ -1529,7 +1529,7 @@ WalletDB.prototype.resendPending = async function resendPending(wid) { WalletDB.prototype.getWalletsByTX = async function getWalletsByTX(tx) { let hashes = tx.getOutputHashes('hex'); - let result = []; + let result = new Set(); if (!tx.isCoinbase()) { for (let input of tx.inputs) { @@ -1545,7 +1545,7 @@ WalletDB.prototype.getWalletsByTX = async function getWalletsByTX(tx) { continue; for (let wid of map.wids) - util.binaryInsert(result, wid, cmp, true); + result.add(wid); } } @@ -1561,10 +1561,10 @@ WalletDB.prototype.getWalletsByTX = async function getWalletsByTX(tx) { continue; for (let wid of map.wids) - util.binaryInsert(result, wid, cmp, true); + result.add(wid); } - if (result.length === 0) + if (result.size === 0) return; return result;