walletdb: use set for querying wallets by tx.
This commit is contained in:
parent
2d74bda89b
commit
d9a726a358
@ -1529,7 +1529,7 @@ WalletDB.prototype.resendPending = async function resendPending(wid) {
|
|||||||
|
|
||||||
WalletDB.prototype.getWalletsByTX = async function getWalletsByTX(tx) {
|
WalletDB.prototype.getWalletsByTX = async function getWalletsByTX(tx) {
|
||||||
let hashes = tx.getOutputHashes('hex');
|
let hashes = tx.getOutputHashes('hex');
|
||||||
let result = [];
|
let result = new Set();
|
||||||
|
|
||||||
if (!tx.isCoinbase()) {
|
if (!tx.isCoinbase()) {
|
||||||
for (let input of tx.inputs) {
|
for (let input of tx.inputs) {
|
||||||
@ -1545,7 +1545,7 @@ WalletDB.prototype.getWalletsByTX = async function getWalletsByTX(tx) {
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
for (let wid of map.wids)
|
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;
|
continue;
|
||||||
|
|
||||||
for (let wid of map.wids)
|
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;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user