You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
1.1 KiB

  1. package provider
  2. import (
  3. "errors"
  4. "fmt"
  5. )
  6. var (
  7. // ErrLightBlockNotFound is returned when a provider can't find the
  8. // requested header. The light client will not remove the provider
  9. ErrLightBlockNotFound = errors.New("light block not found")
  10. // ErrNoResponse is returned if the provider doesn't respond to the
  11. // request in a given time. The light client will not remove the provider
  12. ErrNoResponse = errors.New("client failed to respond")
  13. )
  14. // ErrBadLightBlock is returned when a provider returns an invalid
  15. // light block. The light client will remove the provider.
  16. type ErrBadLightBlock struct {
  17. Reason error
  18. }
  19. func (e ErrBadLightBlock) Error() string {
  20. return fmt.Sprintf("client provided bad signed header: %s", e.Reason.Error())
  21. }
  22. // ErrUnreliableProvider is a generic error that indicates that the provider isn't
  23. // behaving in a reliable manner to the light client. The light client will
  24. // remove the provider
  25. type ErrUnreliableProvider struct {
  26. Reason string
  27. }
  28. func (e ErrUnreliableProvider) Error() string {
  29. return fmt.Sprintf("client deemed unreliable: %s", e.Reason)
  30. }