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
|
||||
);
|
||||
|
||||
// mark invalid_child from tip of fork to second block of fork
|
||||
while (competitor.height > fork.height + 2) {
|
||||
// mark invalid_child from tip of fork to first block of fork
|
||||
while (competitor.height !== fork.height + 1) {
|
||||
const previous = await this.getPrevious(competitor)
|
||||
await this.invalidate(previous.hash)
|
||||
}
|
||||
|
||||
// mark invalid first block of fork
|
||||
const previous = await this.getPrevious(competitor)
|
||||
await this.invalidate(previous.hash)
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user