From 83a11fbcb27c91d6ea883a5ce5b707277e123b3a Mon Sep 17 00:00:00 2001 From: ohryan Date: Mon, 20 Jul 2020 17:43:34 -0700 Subject: [PATCH] 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 --- lib/blockchain/chain.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/blockchain/chain.js b/lib/blockchain/chain.js index a86e3055..5e2cd14e 100644 --- a/lib/blockchain/chain.js +++ b/lib/blockchain/chain.js @@ -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 }