syncer

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2022 License: Apache-2.0, MIT Imports: 33 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChainSyncProvider

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

ChainSyncProvider provides access to chain sync operations and their status.

func NewChainSyncProvider

func NewChainSyncProvider(chainSyncer chainSync) *ChainSyncProvider

NewChainSyncProvider returns a new ChainSyncProvider.

func (*ChainSyncProvider) HandleNewTipSet

func (chs *ChainSyncProvider) HandleNewTipSet(ci *types.ChainInfo) error

HandleNewTipSet extends the Syncer's chain store with the given tipset if they represent a valid extension. It limits the length of new chains it will attempt to validate and caches invalid blocks it has encountered to help prevent DOS.

type SyncerSubmodule

type SyncerSubmodule struct {
	BlockstoreModule   *blockstore.BlockstoreSubmodule
	ChainModule        *chain2.ChainSubmodule
	NetworkModule      *network.NetworkSubmodule
	DiscoverySubmodule *discovery.DiscoverySubmodule

	// todo: use the 'Topic' and 'Subscription' defined in
	//  "github.com/libp2p/go-libp2p-pubsub" replace which defined in
	//  'venus/pkg/net/pubsub/topic.go'
	BlockTopic       *pubsub.Topic
	BlockSub         pubsub.Subscription
	ChainSelector    nodeChainSelector
	Stmgr            *statemanger.Stmgr
	ChainSyncManager *chainsync.Manager
	Drand            beacon.Schedule
	SyncProvider     ChainSyncProvider
	SlashFilter      slashfilter.ISlashFilter
	BlockValidator   *consensus.BlockValidator

	// cancelChainSync cancels the context for chain sync subscriptions and handlers.
	CancelChainSync context.CancelFunc
}

SyncerSubmodule enhances the node with chain syncing capabilities

func NewSyncerSubmodule

func NewSyncerSubmodule(ctx context.Context,
	config syncerConfig,
	blockstore *blockstore.BlockstoreSubmodule,
	network *network.NetworkSubmodule,
	discovery *discovery.DiscoverySubmodule,
	chn *chain2.ChainSubmodule,
	circulatingSupplyCalculator chain.ICirculatingSupplyCalcualtor,
) (*SyncerSubmodule, error)

NewSyncerSubmodule creates a new chain submodule.

func (*SyncerSubmodule) API

func (syncer *SyncerSubmodule) API() v1api.ISyncer

API create a new sync api implement

func (*SyncerSubmodule) Start

func (syncer *SyncerSubmodule) Start(ctx context.Context) error

Start starts the syncer submodule for a node.

func (*SyncerSubmodule) Stop

func (syncer *SyncerSubmodule) Stop(ctx context.Context)

func (*SyncerSubmodule) V0API added in v0.9.7

func (syncer *SyncerSubmodule) V0API() v0api.ISyncer

Jump to

Keyboard shortcuts

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