diff --git a/lib/blockchain/chain.js b/lib/blockchain/chain.js index 5e2cd14e..9c305ff7 100644 --- a/lib/blockchain/chain.js +++ b/lib/blockchain/chain.js @@ -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