keeper

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: May 10, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MsgInsertHeaderWrapped

func MsgInsertHeaderWrapped(ctx context.Context, k Keeper, msg *types.MsgInsertHeader,
	powLimit big.Int, reduceMinDifficulty bool, retargetAdjustmentFactor int64, powCheck bool,
) (*types.MsgInsertHeaderResponse, error)

func NewMsgServerImpl

func NewMsgServerImpl(keeper Keeper) types.MsgServer

NewMsgServerImpl returns an implementation of the MsgServer interface for the provided Keeper.

Types

type Keeper

type Keeper struct {
	// contains filtered or unexported fields
}

func NewKeeper

func NewKeeper(
	cdc codec.BinaryCodec,
	storeKey,
	memKey storetypes.StoreKey,
	btcConfig bbn.BtcConfig,
) *Keeper

func (Keeper) AfterBTCHeaderInserted

func (k Keeper) AfterBTCHeaderInserted(ctx sdk.Context, headerInfo *types.BTCHeaderInfo)

AfterBTCHeaderInserted - call hook if registered

func (Keeper) AfterBTCRollBack

func (k Keeper) AfterBTCRollBack(ctx sdk.Context, headerInfo *types.BTCHeaderInfo)

AfterBTCRollBack - call hook if registered

func (Keeper) AfterBTCRollForward

func (k Keeper) AfterBTCRollForward(ctx sdk.Context, headerInfo *types.BTCHeaderInfo)

AfterBTCRollForward - call hook if registered

func (Keeper) BlockHeight

func (k Keeper) BlockHeight(ctx sdk.Context, headerHash *bbn.BTCHeaderHashBytes) (uint64, error)

BlockHeight returns the height of the provided header

func (Keeper) Contains

func (Keeper) GetBaseBTCHeader

func (k Keeper) GetBaseBTCHeader(ctx sdk.Context) *types.BTCHeaderInfo

func (Keeper) GetHeaderByHash added in v0.6.0

func (k Keeper) GetHeaderByHash(ctx sdk.Context, hash *bbn.BTCHeaderHashBytes) *types.BTCHeaderInfo

TODO: The following functions, GetHeaderByHash and GetHeaderByHeight, are super inefficient and should be replaced with a better implementation. This requires changing the underlying data model for the whole btclightclient module. GetHeaderByHash returns header with given hash from main chain or returns nil if such header is not found or is not on main chain

func (Keeper) GetHeaderByHeight added in v0.6.0

func (k Keeper) GetHeaderByHeight(ctx sdk.Context, height uint64) *types.BTCHeaderInfo

GetHeaderByHeight returns header with given height from main chain, returns nil if such header is not found

func (Keeper) GetTipInfo

func (k Keeper) GetTipInfo(ctx sdk.Context) *types.BTCHeaderInfo

func (Keeper) Hashes

func (Keeper) InsertHeader

func (k Keeper) InsertHeader(ctx sdk.Context, header *bbn.BTCHeaderBytes) error

InsertHeader inserts a btcd header into the header state

func (Keeper) IsAncestor

func (k Keeper) IsAncestor(ctx sdk.Context, parentHashBytes *bbn.BTCHeaderHashBytes, childHashBytes *bbn.BTCHeaderHashBytes) (bool, error)

IsAncestor returns true/false depending on whether `parent` is an ancestor of `child`. Returns false if the parent and the child are the same header.

func (Keeper) IsHeaderKDeep

func (k Keeper) IsHeaderKDeep(ctx sdk.Context, headerHashBytes *bbn.BTCHeaderHashBytes, depth uint64) (bool, error)

IsHeaderKDeep returns true if a header is at least k-deep on the main chain

func (Keeper) Logger

func (k Keeper) Logger(ctx sdk.Context) log.Logger

func (Keeper) MainChainDepth

func (k Keeper) MainChainDepth(ctx sdk.Context, headerHashBytes *bbn.BTCHeaderHashBytes) (int64, error)

MainChainDepth returns the depth of the header in the main chain or -1 if it does not exist in it

func (Keeper) SetBaseBTCHeader

func (k Keeper) SetBaseBTCHeader(ctx sdk.Context, baseBTCHeader types.BTCHeaderInfo)

SetBaseBTCHeader checks whether a base BTC header exists and

if not inserts it into storage

func (*Keeper) SetHooks

func (k *Keeper) SetHooks(bh types.BTCLightClientHooks) *Keeper

SetHooks sets the btclightclient hooks

func (Keeper) Tip

Jump to

Keyboard shortcuts

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