setInvalid instead of invalidate + strictEqual assert

instead of running this.invalidate which deadlocks the chain, set the hash to invalid manually with this.setInvalid.

update assertion to use strict equal
This commit is contained in:
ohryan 2020-07-20 17:43:34 -07:00
parent 36671d02ed
commit 83a11fbcb2

View File

@ -985,11 +985,12 @@ class Chain extends AsyncEmitter {
// mark invalid_child from tip of fork to first block of fork
while (indexWalk.height !== fork.height + 1) {
indexWalk = await this.getPrevious(indexWalk)
await this.invalidate(indexWalk.hash)
await this.setInvalid(indexWalk.hash)
}
// check
assert.equal(await this.getPrevious(indexWalk), fork, 'nlr invalidation down to the fork')
indexWalk = await this.getPrevious(indexWalk)
assert.strictEqual(indexWalk, fork)
return true
}