Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BlockByHeight ¶ added in v1.2.0
BlockByHeight returns the block of a given height
type BlockPeer ¶ added in v1.8.2
type BlockPeer func(string)
BlockPeer adds the peer into blacklist in p2p layer
type BlockSync ¶
type BlockSync interface {
lifecycle.StartStopper
// TargetHeight returns the target height to sync to
TargetHeight() uint64
// ProcessSyncRequest processes a block sync request
ProcessSyncRequest(context.Context, peer.AddrInfo, uint64, uint64) error
// ProcessBlock processes an incoming block
ProcessBlock(context.Context, string, *block.Block) error
// SyncStatus report block sync status
SyncStatus() (startingHeight uint64, currentHeight uint64, targetHeight uint64, syncSpeedDesc string)
}
BlockSync defines the interface of blocksyncer
func NewBlockSyncer ¶
func NewBlockSyncer( cfg config.BlockSync, tipHeightHandler TipHeight, blockByHeightHandler BlockByHeight, commitBlockHandler CommitBlock, p2pNeighbor Neighbors, uniCastHandler UniCastOutbound, blockP2pPeer BlockPeer, ) (BlockSync, error)
NewBlockSyncer returns a new block syncer instance
func NewDummyBlockSyncer ¶ added in v1.6.3
func NewDummyBlockSyncer() BlockSync
NewDummyBlockSyncer creates a dummy BlockSync
type CommitBlock ¶ added in v1.2.0
CommitBlock commits a block to blockchain
Click to show internal directories.
Click to hide internal directories.