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.

33 lines
719 B

  1. package mock
  2. import (
  3. "context"
  4. "errors"
  5. "fmt"
  6. "github.com/tendermint/tendermint/light/provider"
  7. "github.com/tendermint/tendermint/types"
  8. )
  9. var errNoResp = errors.New("no response from provider")
  10. type deadMock struct {
  11. id string
  12. }
  13. // NewDeadMock creates a mock provider that always errors. id is used in case of multiple providers.
  14. func NewDeadMock(id string) provider.Provider {
  15. return &deadMock{id: id}
  16. }
  17. func (p *deadMock) String() string {
  18. return fmt.Sprintf("DeadMock-%s", p.id)
  19. }
  20. func (p *deadMock) LightBlock(_ context.Context, height int64) (*types.LightBlock, error) {
  21. return nil, errNoResp
  22. }
  23. func (p *deadMock) ReportEvidence(_ context.Context, ev types.Evidence) error {
  24. return errNoResp
  25. }