diff --git a/vms/platformvm/service.go b/vms/platformvm/service.go index db673036f4a2..158cdd2c038e 100644 --- a/vms/platformvm/service.go +++ b/vms/platformvm/service.go @@ -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