add missing awaits

This commit is contained in:
ohryan 2020-07-16 08:31:10 -07:00
parent 7a1816a3a8
commit 9f9c536efc

View File

@ -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)