diff --git a/packages/fork-choice/src/forkChoice/forkChoice.ts b/packages/fork-choice/src/forkChoice/forkChoice.ts index 62a8af368b62..6dda2c639df2 100644 --- a/packages/fork-choice/src/forkChoice/forkChoice.ts +++ b/packages/fork-choice/src/forkChoice/forkChoice.ts @@ -672,6 +672,11 @@ export class ForkChoice implements IForkChoice { const prunedNodes = this.protoArray.maybePrune(finalizedRoot); const prunedCount = prunedNodes.length; for (const vote of this.votes) { + // validator has never voted + if (vote === undefined) { + continue; + } + if (vote.currentIndex !== null) { if (vote.currentIndex >= prunedCount) { vote.currentIndex -= prunedCount; @@ -680,6 +685,7 @@ export class ForkChoice implements IForkChoice { vote.currentIndex = null; } } + if (vote.nextIndex !== null) { if (vote.nextIndex >= prunedCount) { vote.nextIndex -= prunedCount;