mirror of
https://github.com/tendermint/tendermint.git
synced 2026-09-20 15:04:22 +00:00
## Description I'm just doing a self audit of the light client. There's a few things I've changed - Validate trust level in `VerifyNonAdjacent` function - Make errNoWitnesses public (it's something people running software on top of a light client should be able to parse) - Remove `ChainID` check of witnesses on start up. We do this already when we compare the first header with witnesses - Remove `ChainID()` from provider interface Closes: #4538
34 lines
719 B
Go
34 lines
719 B
Go
package mock
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
"fmt"
|
|
|
|
"github.com/tendermint/tendermint/light/provider"
|
|
"github.com/tendermint/tendermint/types"
|
|
)
|
|
|
|
var errNoResp = errors.New("no response from provider")
|
|
|
|
type deadMock struct {
|
|
id string
|
|
}
|
|
|
|
// NewDeadMock creates a mock provider that always errors. id is used in case of multiple providers.
|
|
func NewDeadMock(id string) provider.Provider {
|
|
return &deadMock{id: id}
|
|
}
|
|
|
|
func (p *deadMock) String() string {
|
|
return fmt.Sprintf("DeadMock-%s", p.id)
|
|
}
|
|
|
|
func (p *deadMock) LightBlock(_ context.Context, height int64) (*types.LightBlock, error) {
|
|
return nil, errNoResp
|
|
}
|
|
|
|
func (p *deadMock) ReportEvidence(_ context.Context, ev types.Evidence) error {
|
|
return errNoResp
|
|
}
|