keeper

package
v0.0.0-...-30704ab Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 16, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHandler

func NewHandler(keeper Keeper) sdk.Handler

NewHandler returns a handler for relay type messages.

func NewQuerier

func NewQuerier(keeper Keeper) sdk.Querier

NewQuerier makes a query routing function

Types

type Keeper

type Keeper struct {
	IsMainNet    bool
	ProofHandler types.ProofHandler
	// contains filtered or unexported fields
}

Keeper maintains the link to data storage and exposes getter/setter methods for the various parts of the state machine

func NewKeeper

func NewKeeper(storeKey sdk.StoreKey, cdc *codec.Codec, mainnet bool, handler types.ProofHandler) Keeper

NewKeeper instantiates a new keeper

func (Keeper) FindAncestor

func (k Keeper) FindAncestor(ctx sdk.Context, digestLE types.Hash256Digest, offset uint32) (types.Hash256Digest, sdk.Error)

FindAncestor finds the nth ancestor of some digest

func (Keeper) GetBestKnownDigest

func (k Keeper) GetBestKnownDigest(ctx sdk.Context) (types.Hash256Digest, sdk.Error)

GetBestKnownDigest returns the best known digest in the relay

func (Keeper) GetHeader

func (k Keeper) GetHeader(ctx sdk.Context, digestLE types.Hash256Digest) (types.BitcoinHeader, sdk.Error)

GetHeader retrieves a header from the store using its LE diges

func (Keeper) GetLastReorgLCA

func (k Keeper) GetLastReorgLCA(ctx sdk.Context) (types.Hash256Digest, sdk.Error)

GetLastReorgLCA returns the best known digest in the relay

func (Keeper) GetRelayGenesis

func (k Keeper) GetRelayGenesis(ctx sdk.Context) (types.Hash256Digest, sdk.Error)

GetRelayGenesis returns the first digest in the relay

func (Keeper) HasHeader

func (k Keeper) HasHeader(ctx sdk.Context, digestLE types.Hash256Digest) bool

HasHeader checks if a header is in the store

func (Keeper) HeaviestFromAncestor

func (k Keeper) HeaviestFromAncestor(ctx sdk.Context, ancestor, currentBest, newBest types.Hash256Digest, limit uint32) (types.Hash256Digest, sdk.Error)

HeaviestFromAncestor determines the heavier descendant of a common ancestor

func (Keeper) IngestDifficultyChange

func (k Keeper) IngestDifficultyChange(ctx sdk.Context, prevEpochStartLE types.Hash256Digest, headers []types.BitcoinHeader) sdk.Error

IngestDifficultyChange ingests a chain of headers

func (Keeper) IngestHeaderChain

func (k Keeper) IngestHeaderChain(ctx sdk.Context, headers []types.BitcoinHeader) sdk.Error

IngestHeaderChain ingests a chain of headers

func (Keeper) IsAncestor

func (k Keeper) IsAncestor(ctx sdk.Context, digestLE, ancestor types.Hash256Digest, limit uint32) bool

IsAncestor checks if there is a link between an ancestor and header

func (Keeper) IsMostRecentCommonAncestor

func (k Keeper) IsMostRecentCommonAncestor(ctx sdk.Context, ancestor, left, right types.Hash256Digest, limit uint32) bool

IsMostRecentCommonAncestor checks if a proposed ancestor is the LCA of two digests

func (Keeper) MarkNewHeaviest

func (k Keeper) MarkNewHeaviest(ctx sdk.Context, ancestor types.Hash256Digest, currentBest, newBest types.RawHeader, limit uint32) sdk.Error

MarkNewHeaviest updates the best known digest and LCA

func (Keeper) SetGenesisState

func (k Keeper) SetGenesisState(ctx sdk.Context, genesis, epochStart btcspv.BitcoinHeader) sdk.Error

SetGenesisState sets the genesis state

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL