walletdb: safe sync option.

This commit is contained in:
Christopher Jeffrey 2016-11-07 21:46:15 -08:00
parent 04596522ea
commit 4cb11da4cf
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD

View File

@ -1857,12 +1857,17 @@ Wallet.prototype._setLookahead = co(function* setLookahead(acct, lookahead) {
Wallet.prototype.syncOutputDepth = co(function* syncOutputDepth(details) {
var derived = [];
var accounts = {};
var i, j, path, paths, account;
var i, j, path, paths, acct, account;
var receive, change, nested, ring;
if (!details)
return derived;
if (this.db.options.safeSync) {
if (details.height === -1)
return;
}
for (i = 0; i < details.outputs.length; i++) {
path = details.outputs[i].path;
@ -1882,7 +1887,7 @@ Wallet.prototype.syncOutputDepth = co(function* syncOutputDepth(details) {
for (i = 0; i < accounts.length; i++) {
paths = accounts[i];
account = paths[0].account;
acct = paths[0].account;
receive = -1;
change = -1;
nested = -1;
@ -1910,10 +1915,8 @@ Wallet.prototype.syncOutputDepth = co(function* syncOutputDepth(details) {
change += 2;
nested += 2;
account = yield this.getAccount(account);
if (!account)
continue;
account = yield this.getAccount(acct);
assert(account);
ring = yield account.syncDepth(receive, change, nested);