core

package
v0.3.1-account Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2022 License: Apache-2.0 Imports: 21 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateKVStore added in v0.3.0

func CreateKVStore(retainBlocks int64) *kvstore.Application

CreateKVStore creates a simple kv store app and gives the user ability to set desired amount of blocks to be retained.

func GetEndpoint added in v0.3.0

func GetEndpoint(cfg *config.Config) (string, error)

GetEndpoint returns the remote node's RPC endpoint.

func MakeCommit added in v0.3.0

func MakeCommit(blockID tmtypes.BlockID, height int64, round int32,
	voteSet *tmtypes.VoteSet, validators []tmtypes.PrivValidator, now time.Time) (*tmtypes.Commit, error)

func RandValidator added in v0.3.0

func RandValidator(randPower bool, minPower int64) (*tmtypes.Validator, tmtypes.PrivValidator)

func RandValidatorSet added in v0.3.0

func RandValidatorSet(numValidators int, votingPower int64) (*tmtypes.ValidatorSet, []tmtypes.PrivValidator)

func StartTestKVApp added in v0.3.0

func StartTestKVApp(ctx context.Context, t *testing.T) (tmservice.Service, types.Application, *config.Config)

StartTestKVApp starts Tendermint KVApp.

func StartTestNode added in v0.3.0

func StartTestNode(ctx context.Context, t *testing.T, app types.Application, cfg *config.Config) tmservice.Service

StartTestNode starts a mock Core node background process and returns it.

Types

type BlockFetcher

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

func NewBlockFetcher

func NewBlockFetcher(client Client) *BlockFetcher

NewBlockFetcher returns a new `BlockFetcher`.

func (*BlockFetcher) Commit

func (f *BlockFetcher) Commit(ctx context.Context, height *int64) (*types.Commit, error)

Commit queries Core for a `Commit` from the block at the given height.

func (*BlockFetcher) GetBlock

func (f *BlockFetcher) GetBlock(ctx context.Context, height *int64) (*types.Block, error)

GetBlock queries Core for a `Block` at the given height.

func (*BlockFetcher) GetBlockByHash

func (f *BlockFetcher) GetBlockByHash(ctx context.Context, hash tmbytes.HexBytes) (*types.Block, error)

func (*BlockFetcher) GetBlockInfo added in v0.2.0

func (f *BlockFetcher) GetBlockInfo(ctx context.Context, height *int64) (*types.Commit, *types.ValidatorSet, error)

GetBlockInfo queries Core for additional block information, like Commit and ValidatorSet.

func (*BlockFetcher) IsSyncing added in v0.3.0

func (f *BlockFetcher) IsSyncing(ctx context.Context) (bool, error)

IsSyncing returns the sync status of the Core connection: true for syncing, and false for already caught up. It can also return an error in the case of a failed status request.

func (*BlockFetcher) SubscribeNewBlockEvent

func (f *BlockFetcher) SubscribeNewBlockEvent(ctx context.Context) (<-chan *types.Block, error)

SubscribeNewBlockEvent subscribes to new block events from Core, returning a new block event channel on success.

func (*BlockFetcher) UnsubscribeNewBlockEvent

func (f *BlockFetcher) UnsubscribeNewBlockEvent(ctx context.Context) error

UnsubscribeNewBlockEvent stops the subscription to new block events from Core.

func (*BlockFetcher) ValidatorSet

func (f *BlockFetcher) ValidatorSet(ctx context.Context, height *int64) (*types.ValidatorSet, error)

ValidatorSet queries Core for the ValidatorSet from the block at the given height.

type Client

type Client = client.Client

Client is an alias to Core Client.

func NewRemote

func NewRemote(ip, port string) (Client, error)

NewRemote creates a new Client that communicates with a remote Core endpoint over HTTP.

func StartTestClient added in v0.3.0

func StartTestClient(ctx context.Context, t *testing.T) (tmservice.Service, Client)

StartTestClient returns a started remote Core node process, as well its mock Core Client.

Jump to

Keyboard shortcuts

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