Versions in this module Expand all Collapse all v0 v0.0.1 Jan 19, 2022 Changes in this version + var DefaultTrustLevel = tmmath.Fraction + var ErrFailedHeaderCrossReferencing = errors.New(...) + var ErrLightClientAttack = errors.New(...) + var ErrNoWitnesses = errors.New("no witnesses connected. please reset light client") + func HeaderExpired(h *types.SignedHeader, trustingPeriod time.Duration, now time.Time) bool + func ValidateTrustLevel(lvl tmmath.Fraction) error + func Verify(trustedHeader *types.SignedHeader, trustedVals *types.ValidatorSet, ...) error + func VerifyAdjacent(trustedHeader *types.SignedHeader, untrustedHeader *types.SignedHeader, ...) error + func VerifyBackwards(untrustedHeader, trustedHeader *types.Header) error + func VerifyNonAdjacent(trustedHeader *types.SignedHeader, trustedVals *types.ValidatorSet, ...) error + type Client struct + func NewClient(ctx context.Context, chainID string, trustOptions TrustOptions, ...) (*Client, error) + func NewClientFromTrustedStore(chainID string, trustingPeriod time.Duration, primary provider.Provider, ...) (*Client, error) + func NewHTTPClient(ctx context.Context, chainID string, trustOptions TrustOptions, ...) (*Client, error) + func NewHTTPClientFromTrustedStore(chainID string, trustingPeriod time.Duration, primaryAddress string, ...) (*Client, error) + func (c *Client) ChainID() string + func (c *Client) Cleanup() error + func (c *Client) FirstTrustedHeight() (int64, error) + func (c *Client) LastTrustedHeight() (int64, error) + func (c *Client) Primary() provider.Provider + func (c *Client) TrustedLightBlock(height int64) (*types.LightBlock, error) + func (c *Client) Update(ctx context.Context, now time.Time) (*types.LightBlock, error) + func (c *Client) VerifyHeader(ctx context.Context, newHeader *types.Header, now time.Time) error + func (c *Client) VerifyLightBlockAtHeight(ctx context.Context, height int64, now time.Time) (*types.LightBlock, error) + func (c *Client) Witnesses() []provider.Provider + type ErrInvalidHeader struct + Reason error + func (e ErrInvalidHeader) Error() string + type ErrNewValSetCantBeTrusted struct + Reason types.ErrNotEnoughVotingPowerSigned + func (e ErrNewValSetCantBeTrusted) Error() string + type ErrOldHeaderExpired struct + At time.Time + Now time.Time + func (e ErrOldHeaderExpired) Error() string + type ErrVerificationFailed struct + From int64 + Reason error + To int64 + func (e ErrVerificationFailed) Error() string + func (e ErrVerificationFailed) Unwrap() error + type Option func(*Client) + func ConfirmationFunction(fn func(action string) bool) Option + func Logger(l log.Logger) Option + func MaxBlockLag(d time.Duration) Option + func MaxClockDrift(d time.Duration) Option + func MaxRetryAttempts(max uint16) Option + func PruningSize(h uint16) Option + func SequentialVerification() Option + func SkippingVerification(trustLevel tmmath.Fraction) Option + type TrustOptions struct + Hash []byte + Height int64 + Period time.Duration + func (opts TrustOptions) ValidateBasic() error