walletdb: safe sync option.
This commit is contained in:
parent
04596522ea
commit
4cb11da4cf
@ -1857,12 +1857,17 @@ Wallet.prototype._setLookahead = co(function* setLookahead(acct, lookahead) {
|
|||||||
Wallet.prototype.syncOutputDepth = co(function* syncOutputDepth(details) {
|
Wallet.prototype.syncOutputDepth = co(function* syncOutputDepth(details) {
|
||||||
var derived = [];
|
var derived = [];
|
||||||
var accounts = {};
|
var accounts = {};
|
||||||
var i, j, path, paths, account;
|
var i, j, path, paths, acct, account;
|
||||||
var receive, change, nested, ring;
|
var receive, change, nested, ring;
|
||||||
|
|
||||||
if (!details)
|
if (!details)
|
||||||
return derived;
|
return derived;
|
||||||
|
|
||||||
|
if (this.db.options.safeSync) {
|
||||||
|
if (details.height === -1)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i < details.outputs.length; i++) {
|
for (i = 0; i < details.outputs.length; i++) {
|
||||||
path = details.outputs[i].path;
|
path = details.outputs[i].path;
|
||||||
|
|
||||||
@ -1882,7 +1887,7 @@ Wallet.prototype.syncOutputDepth = co(function* syncOutputDepth(details) {
|
|||||||
|
|
||||||
for (i = 0; i < accounts.length; i++) {
|
for (i = 0; i < accounts.length; i++) {
|
||||||
paths = accounts[i];
|
paths = accounts[i];
|
||||||
account = paths[0].account;
|
acct = paths[0].account;
|
||||||
receive = -1;
|
receive = -1;
|
||||||
change = -1;
|
change = -1;
|
||||||
nested = -1;
|
nested = -1;
|
||||||
@ -1910,10 +1915,8 @@ Wallet.prototype.syncOutputDepth = co(function* syncOutputDepth(details) {
|
|||||||
change += 2;
|
change += 2;
|
||||||
nested += 2;
|
nested += 2;
|
||||||
|
|
||||||
account = yield this.getAccount(account);
|
account = yield this.getAccount(acct);
|
||||||
|
assert(account);
|
||||||
if (!account)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
ring = yield account.syncDepth(receive, change, nested);
|
ring = yield account.syncDepth(receive, change, nested);
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user