set competitor chain tip to invaild

setting the competitor chain tip to invaild fixes the problem where the chain continues to sync after nlr. main chain will no longer sync with competitor after nlr
This commit is contained in:
ohryan 2020-07-21 14:01:48 -07:00
parent 83a11fbcb2
commit 5321251db3

View File

@ -982,10 +982,10 @@ class Chain extends AsyncEmitter {
let indexWalk = competitor
// mark invalid_child from tip of fork to first block of fork
while (indexWalk.height !== fork.height + 1) {
indexWalk = await this.getPrevious(indexWalk)
// mark invalid_child from tip of competitor to first block of fork
while (indexWalk.height > fork.height) {
await this.setInvalid(indexWalk.hash)
indexWalk = await this.getPrevious(indexWalk)
}
// check