Skip to content

Commit

Permalink
fix: fast-catchup detection
Browse files Browse the repository at this point in the history
  • Loading branch information
PhearZero committed Dec 10, 2024
1 parent 386afe2 commit 1992cfe
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion internal/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
6 changes: 3 additions & 3 deletions internal/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}

0 comments on commit 1992cfe

Please sign in to comment.