From 46b244212760933262a88d882bbd54ebfeb0f609 Mon Sep 17 00:00:00 2001 From: Nishant Das Date: Mon, 2 Oct 2023 09:46:58 +0800 Subject: [PATCH] Do Not Calculate Churn With 0 Exits (#12976) --- beacon-chain/core/blocks/exit.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/beacon-chain/core/blocks/exit.go b/beacon-chain/core/blocks/exit.go index 00e231788be7..6ada777ca465 100644 --- a/beacon-chain/core/blocks/exit.go +++ b/beacon-chain/core/blocks/exit.go @@ -51,6 +51,10 @@ func ProcessVoluntaryExits( beaconState state.BeaconState, exits []*ethpb.SignedVoluntaryExit, ) (state.BeaconState, error) { + // Avoid calculating the epoch churn if no exits exist. + if len(exits) == 0 { + return beaconState, nil + } maxExitEpoch, churn := v.ValidatorsMaxExitEpochAndChurn(beaconState) var exitEpoch primitives.Epoch for idx, exit := range exits {