diff --git a/lib/blockchain/chain.js b/lib/blockchain/chain.js index 6c8822f0..3a407547 100644 --- a/lib/blockchain/chain.js +++ b/lib/blockchain/chain.js @@ -856,7 +856,7 @@ class Chain extends AsyncEmitter { assert(fork, 'No free space or data corruption.'); // Check NLR - if (this.noLongReorg(tip, fork, competitor)) return true + if (await this.noLongReorg(tip, fork, competitor)) return true // Blocks to disconnect. const disconnect = []; @@ -916,7 +916,7 @@ class Chain extends AsyncEmitter { assert(fork, 'No free space or data corruption.'); // Check NLR - if (this.noLongReorg(tip, fork, competitor)) return true + if (await this.noLongReorg(tip, fork, competitor)) return true // Buffer disconnected blocks. const disconnect = []; @@ -980,12 +980,12 @@ class Chain extends AsyncEmitter { // mark invalid_child from tip of fork to second block of fork while (competitor.height > fork.height + 2) { const previous = await this.getPrevious(competitor) - this.invalidate(previous.hash) + await this.invalidate(previous.hash) } // mark invalid first block of fork const previous = await this.getPrevious(competitor) - this.invalidate(previous.hash) + await this.invalidate(previous.hash) // check assert(this.getPrevious(previous), fork)