From 1992cfe4a063b37701890e9f4def3cf444793158 Mon Sep 17 00:00:00 2001 From: Michael Feher Date: Tue, 10 Dec 2024 12:32:07 -0500 Subject: [PATCH] fix: fast-catchup detection --- internal/state.go | 2 +- internal/status.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/state.go b/internal/state.go index 0db012b3..f72c76ef 100644 --- a/internal/state.go +++ b/internal/state.go @@ -75,7 +75,7 @@ func (s *StateModel) Watch(cb func(model *StateModel, err error), ctx context.Co s.Status.State = "Unknown" // Update Status - s.Status.Update(status.JSON200.LastRound, status.JSON200.CatchupTime, status.JSON200.CatchpointAcquiredBlocks, status.JSON200.UpgradeNodeVote) + s.Status.Update(status.JSON200.LastRound, status.JSON200.CatchupTime, status.JSON200.Catchpoint, status.JSON200.UpgradeNodeVote) // Fetch Keys s.UpdateKeys() diff --git a/internal/status.go b/internal/status.go index adb2c25a..9425b015 100644 --- a/internal/status.go +++ b/internal/status.go @@ -29,10 +29,10 @@ type StatusModel struct { func (m *StatusModel) String() string { return fmt.Sprintf("\nLastRound: %d\n", m.LastRound) } -func (m *StatusModel) Update(lastRound int, catchupTime int, aquiredBlocks *int, upgradeNodeVote *bool) { +func (m *StatusModel) Update(lastRound int, catchupTime int, catchpoint *string, upgradeNodeVote *bool) { m.LastRound = uint64(lastRound) if catchupTime > 0 { - if aquiredBlocks != nil { + if catchpoint != nil && *catchpoint != "" { m.State = FastCatchupState } else { m.State = SyncingState @@ -77,6 +77,6 @@ func (m *StatusModel) Fetch(ctx context.Context, client api.ClientWithResponsesI return fmt.Errorf("Status code %d: %s", s.StatusCode(), s.Status()) } - m.Update(s.JSON200.LastRound, s.JSON200.CatchupTime, s.JSON200.CatchpointAcquiredBlocks, s.JSON200.UpgradeNodeVote) + m.Update(s.JSON200.LastRound, s.JSON200.CatchupTime, s.JSON200.Catchpoint, s.JSON200.UpgradeNodeVote) return nil }