Skip to content

Commit

Permalink
Cleanup platform.GetHeight API implementation (#2023)
Browse files Browse the repository at this point in the history
  • Loading branch information
dhrubabasu authored Sep 14, 2023
1 parent ed452f0 commit 6fe9dd0
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions vms/platformvm/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,16 +107,9 @@ func (s *Service) GetHeight(r *http.Request, _ *struct{}, response *api.GetHeigh
)

ctx := r.Context()
lastAcceptedID, err := s.vm.LastAccepted(ctx)
if err != nil {
return fmt.Errorf("couldn't get last accepted block ID: %w", err)
}
lastAccepted, err := s.vm.GetBlock(ctx, lastAcceptedID)
if err != nil {
return fmt.Errorf("couldn't get last accepted block: %w", err)
}
response.Height = json.Uint64(lastAccepted.Height())
return nil
height, err := s.vm.GetCurrentHeight(ctx)
response.Height = json.Uint64(height)
return err
}

// ExportKeyArgs are arguments for ExportKey
Expand Down

0 comments on commit 6fe9dd0

Please sign in to comment.