update invalidation stepping to use just the while loop and add missing await to assert check
This commit is contained in:
parent
11534032f4
commit
c6317a268d
@ -979,18 +979,14 @@ class Chain extends AsyncEmitter {
|
|||||||
tip.height - fork.height
|
tip.height - fork.height
|
||||||
);
|
);
|
||||||
|
|
||||||
// mark invalid_child from tip of fork to second block of fork
|
// mark invalid_child from tip of fork to first block of fork
|
||||||
while (competitor.height > fork.height + 2) {
|
while (competitor.height !== fork.height + 1) {
|
||||||
const previous = await this.getPrevious(competitor)
|
const previous = await this.getPrevious(competitor)
|
||||||
await this.invalidate(previous.hash)
|
await this.invalidate(previous.hash)
|
||||||
}
|
}
|
||||||
|
|
||||||
// mark invalid first block of fork
|
|
||||||
const previous = await this.getPrevious(competitor)
|
|
||||||
await this.invalidate(previous.hash)
|
|
||||||
|
|
||||||
// check
|
// check
|
||||||
assert.equal(this.getPrevious(previous), fork, 'nlr invalidation down to the fork')
|
assert.equal(await this.getPrevious(competitor), fork, 'nlr invalidation down to the fork')
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user