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.

30 lines
678 B

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