account: remove change lookahead.
This commit is contained in:
parent
7d3eb8f3fa
commit
f1f5a2e5d3
@ -452,9 +452,9 @@ Account.prototype.createKey = co(function* createKey(branch) {
|
||||
this.receive = key;
|
||||
break;
|
||||
case 1:
|
||||
// Note: no lookahead here.
|
||||
key = this.deriveChange(this.changeDepth);
|
||||
lookahead = this.deriveChange(this.changeDepth + this.lookahead);
|
||||
yield this.saveKey(lookahead);
|
||||
yield this.saveKey(key);
|
||||
this.changeDepth++;
|
||||
this.change = key;
|
||||
break;
|
||||
@ -626,7 +626,13 @@ Account.prototype.initDepth = co(function* initDepth() {
|
||||
|
||||
yield this.saveKey(this.receive);
|
||||
|
||||
// Change Address
|
||||
// Lookahead
|
||||
for (i = 0; i < this.lookahead; i++) {
|
||||
key = this.deriveReceive(i + 1);
|
||||
yield this.saveKey(key);
|
||||
}
|
||||
|
||||
// Change Address (no lookahead)
|
||||
this.change = this.deriveChange(0);
|
||||
this.changeDepth = 1;
|
||||
|
||||
@ -638,20 +644,8 @@ Account.prototype.initDepth = co(function* initDepth() {
|
||||
this.nestedDepth = 1;
|
||||
|
||||
yield this.saveKey(this.nested);
|
||||
}
|
||||
|
||||
// Lookaheads
|
||||
for (i = 0; i < this.lookahead; i++) {
|
||||
key = this.deriveReceive(i + 1);
|
||||
yield this.saveKey(key);
|
||||
}
|
||||
|
||||
for (i = 0; i < this.lookahead; i++) {
|
||||
key = this.deriveChange(i + 1);
|
||||
yield this.saveKey(key);
|
||||
}
|
||||
|
||||
if (this.witness) {
|
||||
// Lookahead
|
||||
for (i = 0; i < this.lookahead; i++) {
|
||||
key = this.deriveNested(i + 1);
|
||||
yield this.saveKey(key);
|
||||
@ -677,7 +671,7 @@ Account.prototype.syncDepth = co(function* syncDepth(receive, change, nested) {
|
||||
if (receive > this.receiveDepth) {
|
||||
depth = this.receiveDepth + this.lookahead;
|
||||
|
||||
assert(receive <= depth);
|
||||
assert(this.lookahead === 0 || receive <= depth);
|
||||
|
||||
for (i = depth; i < receive + this.lookahead; i++) {
|
||||
key = this.deriveReceive(i);
|
||||
@ -692,14 +686,10 @@ Account.prototype.syncDepth = co(function* syncDepth(receive, change, nested) {
|
||||
}
|
||||
|
||||
if (change > this.changeDepth) {
|
||||
depth = this.changeDepth + this.lookahead;
|
||||
assert(change === this.changeDepth + 1);
|
||||
|
||||
assert(change <= depth);
|
||||
|
||||
for (i = depth; i < change + this.lookahead; i++) {
|
||||
key = this.deriveChange(i);
|
||||
yield this.saveKey(key);
|
||||
}
|
||||
key = this.deriveChange(change - 1);
|
||||
yield this.saveKey(key);
|
||||
|
||||
this.change = this.deriveChange(change - 1);
|
||||
this.changeDepth = change;
|
||||
@ -710,7 +700,7 @@ Account.prototype.syncDepth = co(function* syncDepth(receive, change, nested) {
|
||||
if (this.witness && nested > this.nestedDepth) {
|
||||
depth = this.nestedDepth + this.lookahead;
|
||||
|
||||
assert(nested <= depth);
|
||||
assert(this.lookahead === 0 || nested <= depth);
|
||||
|
||||
for (i = depth; i < nested + this.lookahead; i++) {
|
||||
key = this.deriveNested(i);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user