testnet optimizations for low participation (#4100)

Update finality check to improve performance in testnets.
This commit is contained in:
Etan Kissling 2022-09-09 02:31:33 +02:00 committed by GitHub
parent 0a5b06317d
commit 5ab57369f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -541,12 +541,14 @@ func nodeIsViableForHead(self: ProtoArray, node: ProtoNode): bool =
return false
if self.hasLowParticipation:
if node.checkpoints.justified.epoch < self.checkpoints.justified.epoch:
return false
if self.isPreviousEpochJustified:
return true
return node.checkpoints.finalized == self.checkpoints.finalized or
self.checkpoints.finalized.epoch == GENESIS_EPOCH
return
if node.checkpoints.justified.epoch < self.checkpoints.justified.epoch:
false
elif self.isPreviousEpochJustified:
node.checkpoints.finalized.epoch >= self.checkpoints.finalized.epoch
else:
node.checkpoints.finalized == self.checkpoints.finalized or
self.checkpoints.finalized.epoch == GENESIS_EPOCH
## Any node that has a different finalized or justified epoch
## should not be viable for the head.