From cb377c2ea427812fcd87b4f2e6212d4ed7884384 Mon Sep 17 00:00:00 2001 From: Potuz Date: Mon, 8 Jul 2024 12:55:47 -0300 Subject: [PATCH] copy just the pointer in the votes loop --- beacon-chain/forkchoice/doubly-linked-tree/forkchoice.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/beacon-chain/forkchoice/doubly-linked-tree/forkchoice.go b/beacon-chain/forkchoice/doubly-linked-tree/forkchoice.go index 941d3c47d51a..caacb7807528 100644 --- a/beacon-chain/forkchoice/doubly-linked-tree/forkchoice.go +++ b/beacon-chain/forkchoice/doubly-linked-tree/forkchoice.go @@ -267,11 +267,12 @@ func (f *ForkChoice) updateBalances() error { newBalances := f.justifiedBalances zHash := params.BeaconConfig().ZeroHash - for index, vote := range f.votes { + for index := 0; index < len(f.votes); index++ { // Skip if validator has been slashed if f.store.slashedIndices[primitives.ValidatorIndex(index)] { continue } + vote := &f.votes[index] // Skip if validator has never voted for current root and next root (i.e. if the // votes are zero hash aka genesis block), there's nothing to compute. if vote.currentRoot == zHash && vote.nextRoot == zHash {