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