wallet: refactor syncOutputDepth.

This commit is contained in:
Christopher Jeffrey 2017-07-25 05:34:44 -07:00
parent 32c93af2c4
commit 2d74bda89b
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD

View File

@ -1956,7 +1956,7 @@ Wallet.prototype._setLookahead = async function setLookahead(acct, lookahead) {
*/ */
Wallet.prototype.syncOutputDepth = async function syncOutputDepth(details) { Wallet.prototype.syncOutputDepth = async function syncOutputDepth(details) {
let accounts = new Map(); let map = new Map();
let derived = []; let derived = [];
if (!details) if (!details)
@ -1971,14 +1971,13 @@ Wallet.prototype.syncOutputDepth = async function syncOutputDepth(details) {
if (path.index === -1) if (path.index === -1)
continue; continue;
if (!accounts.has(path.account)) if (!map.has(path.account))
accounts.set(path.account, []); map.set(path.account, []);
accounts.get(path.account).push(path); map.get(path.account).push(path);
} }
for (let paths of accounts.values()) { for (let [acct, paths] of map) {
let acct = paths[0].account;
let receive = -1; let receive = -1;
let change = -1; let change = -1;
let nested = -1; let nested = -1;