From 5321251db33ba197d0cb7ea7539d1df5d357d9d2 Mon Sep 17 00:00:00 2001 From: ohryan Date: Tue, 21 Jul 2020 14:01:48 -0700 Subject: [PATCH] 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 --- lib/blockchain/chain.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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