Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrHeightTooHigh is returned when the height is higher than the last // block that the provider has. The light client will not remove the provider ErrHeightTooHigh = errors.New("height requested is too high") // ErrLightBlockTooOld is returned when requesting the last block, and this last block is very old // The light client will not remove the provider ErrLightBlockTooOld = errors.New("light block is too old") // ErrLightBlockNotFound is returned when a provider can't find the // requested header (i.e. it has been pruned). // The light client will not remove the provider ErrLightBlockNotFound = errors.New("light block not found") // ErrNoResponse is returned if the provider doesn't respond to the // request in a given time. The light client will not remove the provider ErrNoResponse = errors.New("client failed to respond") // ErrConnectionClosed is returned if the provider closes the connection. // In this case we remove the provider. ErrConnectionClosed = errors.New("client closed connection") )
Functions ¶
This section is empty.
Types ¶
type ErrBadLightBlock ¶
type ErrBadLightBlock struct {
Reason error
}
ErrBadLightBlock is returned when a provider returns an invalid light block. The light client will remove the provider.
func (ErrBadLightBlock) Error ¶
func (e ErrBadLightBlock) Error() string
func (ErrBadLightBlock) Unwrap ¶
func (e ErrBadLightBlock) Unwrap() error
type ErrUnreliableProvider ¶
type ErrUnreliableProvider struct {
Reason error
}
ErrUnreliableProvider is a generic error that indicates that the provider isn't behaving in a reliable manner to the light client. The light client will remove the provider
func (ErrUnreliableProvider) Error ¶
func (e ErrUnreliableProvider) Error() string
func (ErrUnreliableProvider) Unwrap ¶
func (e ErrUnreliableProvider) Unwrap() error
type Provider ¶
type Provider interface { // LightBlock returns the LightBlock that corresponds to the given // height. // // 0 - the latest. // height must be >= 0. // // If the provider fails to fetch the LightBlock due to the IO or other // issues, an error will be returned. // If there's no LightBlock for the given height, ErrLightBlockNotFound // error is returned. LightBlock(ctx context.Context, height int64) (*types.LightBlock, error) // ReportEvidence reports an evidence of misbehavior. ReportEvidence(context.Context, types.Evidence) error // Returns the ID of a provider. For RPC providers it returns the IP address of the client // For p2p providers it returns a combination of NodeID and IP address ID() string }
Provider provides information for the light client to sync (verification happens in the client).
Click to show internal directories.
Click to hide internal directories.