From bf5aa97ac79c41582f3e59704a4b9ae7a2265151 Mon Sep 17 00:00:00 2001 From: Giulio Date: Tue, 16 May 2023 12:26:39 +0200 Subject: [PATCH] done --- cl/phase1/forkchoice/forkchoice.go | 7 +++++++ cl/phase1/stages/stage_fork_choice.go | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/cl/phase1/forkchoice/forkchoice.go b/cl/phase1/forkchoice/forkchoice.go index 95d6d6ee2ad..beb28c30dc5 100644 --- a/cl/phase1/forkchoice/forkchoice.go +++ b/cl/phase1/forkchoice/forkchoice.go @@ -114,6 +114,13 @@ func (f *ForkChoiceStore) FinalizedCheckpoint() solid.Checkpoint { return f.finalizedCheckpoint } +// FinalizedCheckpoint returns justified checkpoint +func (f *ForkChoiceStore) FinalizedSlot() uint64 { + f.mu.Lock() + defer f.mu.Unlock() + return f.computeStartSlotAtEpoch(f.finalizedCheckpoint.Epoch()) +} + // FinalizedCheckpoint returns justified checkpoint func (f *ForkChoiceStore) Engine() execution_client.ExecutionEngine { f.mu.Lock() diff --git a/cl/phase1/stages/stage_fork_choice.go b/cl/phase1/stages/stage_fork_choice.go index 91bd182c272..a9137dd588a 100644 --- a/cl/phase1/stages/stage_fork_choice.go +++ b/cl/phase1/stages/stage_fork_choice.go @@ -169,7 +169,7 @@ MainLoop: cfg.downloader.SetHighestProcessedRoot(libcommon.Hash{}) cfg.downloader.SetHighestProcessedSlot( - utils.Max64(startDownloadSlot, cfg.forkChoice.AnchorSlot())) + utils.Max64(startDownloadSlot, cfg.forkChoice.FinalizedSlot())) // Wait small time log.Debug("Caplin may have missed some slots, started downloading chain")