Documentation ¶
Index ¶
- func MsgInsertHeaderWrapped(ctx context.Context, k Keeper, msg *types.MsgInsertHeader, powLimit big.Int, ...) (*types.MsgInsertHeaderResponse, error)
- func NewMsgServerImpl(keeper Keeper) types.MsgServer
- type Keeper
- func (k Keeper) AfterBTCHeaderInserted(ctx sdk.Context, headerInfo *types.BTCHeaderInfo)
- func (k Keeper) AfterBTCRollBack(ctx sdk.Context, headerInfo *types.BTCHeaderInfo)
- func (k Keeper) AfterBTCRollForward(ctx sdk.Context, headerInfo *types.BTCHeaderInfo)
- func (k Keeper) BaseHeader(ctx context.Context, req *types.QueryBaseHeaderRequest) (*types.QueryBaseHeaderResponse, error)
- func (k Keeper) BlockHeight(ctx sdk.Context, headerHash *bbn.BTCHeaderHashBytes) (uint64, error)
- func (k Keeper) Contains(ctx context.Context, req *types.QueryContainsRequest) (*types.QueryContainsResponse, error)
- func (k Keeper) ContainsBytes(ctx context.Context, req *types.QueryContainsBytesRequest) (*types.QueryContainsBytesResponse, error)
- func (k Keeper) GetBaseBTCHeader(ctx sdk.Context) *types.BTCHeaderInfo
- func (k Keeper) GetHeaderByHash(ctx sdk.Context, hash *bbn.BTCHeaderHashBytes) *types.BTCHeaderInfo
- func (k Keeper) GetHeaderByHeight(ctx sdk.Context, height uint64) *types.BTCHeaderInfo
- func (k Keeper) GetTipInfo(ctx sdk.Context) *types.BTCHeaderInfo
- func (k Keeper) Hashes(ctx context.Context, req *types.QueryHashesRequest) (*types.QueryHashesResponse, error)
- func (k Keeper) InsertHeader(ctx sdk.Context, header *bbn.BTCHeaderBytes) error
- func (k Keeper) IsAncestor(ctx sdk.Context, parentHashBytes *bbn.BTCHeaderHashBytes, ...) (bool, error)
- func (k Keeper) IsHeaderKDeep(ctx sdk.Context, headerHashBytes *bbn.BTCHeaderHashBytes, depth uint64) (bool, error)
- func (k Keeper) Logger(ctx sdk.Context) log.Logger
- func (k Keeper) MainChain(ctx context.Context, req *types.QueryMainChainRequest) (*types.QueryMainChainResponse, error)
- func (k Keeper) MainChainDepth(ctx sdk.Context, headerHashBytes *bbn.BTCHeaderHashBytes) (int64, error)
- func (k Keeper) SetBaseBTCHeader(ctx sdk.Context, baseBTCHeader types.BTCHeaderInfo)
- func (k *Keeper) SetHooks(bh types.BTCLightClientHooks) *Keeper
- func (k Keeper) Tip(ctx context.Context, req *types.QueryTipRequest) (*types.QueryTipResponse, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MsgInsertHeaderWrapped ¶
func NewMsgServerImpl ¶
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) BaseHeader ¶
func (k Keeper) BaseHeader(ctx context.Context, req *types.QueryBaseHeaderRequest) (*types.QueryBaseHeaderResponse, error)
func (Keeper) BlockHeight ¶
BlockHeight returns the height of the provided header
func (Keeper) Contains ¶
func (k Keeper) Contains(ctx context.Context, req *types.QueryContainsRequest) (*types.QueryContainsResponse, error)
func (Keeper) ContainsBytes ¶
func (k Keeper) ContainsBytes(ctx context.Context, req *types.QueryContainsBytesRequest) (*types.QueryContainsBytesResponse, error)
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
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 (k Keeper) Hashes(ctx context.Context, req *types.QueryHashesRequest) (*types.QueryHashesResponse, error)
func (Keeper) InsertHeader ¶
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) MainChain ¶
func (k Keeper) MainChain(ctx context.Context, req *types.QueryMainChainRequest) (*types.QueryMainChainResponse, error)
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 ¶
func (k Keeper) Tip(ctx context.Context, req *types.QueryTipRequest) (*types.QueryTipResponse, error)