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.

32 lines
725 B

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