header

package
v0.4.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConstructModule

func ConstructModule(tp node.Type, cfg *Config) fx.Option

func Flags

func Flags() *flag.FlagSet

Flags gives a set of hardcoded Header package flags.

func ParseFlags

func ParseFlags(cmd *cobra.Command, cfg *Config) error

ParseFlags parses Header package flags from the given cmd and applies them to the passed config.

func ParseTrustedHashFlags

func ParseTrustedHashFlags(
	cmd *cobra.Command,
	cfg *Config,
) error

ParseTrustedHashFlags parses Header package flags from the given cmd and saves them to the passed config.

func ParseTrustedPeerFlags

func ParseTrustedPeerFlags(
	cmd *cobra.Command,
	cfg *Config,
) error

ParseTrustedPeerFlags parses Header package flags from the given cmd and applies them to the passed config.

func TrustedHashFlags

func TrustedHashFlags() *flag.FlagSet

TrustedHashFlags returns a set of flags related to configuring a `TrustedHash`.

func TrustedPeersFlags

func TrustedPeersFlags() *flag.FlagSet

TrustedPeersFlags returns a set of flags.

Types

type Config

type Config struct {
	// TrustedHash is the Block/Header hash that Nodes use as starting point for header synchronization.
	// Only affects the node once on initial sync.
	TrustedHash string
	// TrustedPeers are the peers we trust to fetch headers from.
	// Note: The trusted does *not* imply Headers are not verified, but trusted as reliable to fetch headers
	// at any moment.
	TrustedPeers []string
}

Config contains configuration parameters for header retrieval and management.

func DefaultConfig

func DefaultConfig() Config

func (*Config) Validate

func (cfg *Config) Validate() error

Validate performs basic validation of the config.

type Module

type Module interface {
	// GetByHeight returns the ExtendedHeader at the given height, blocking
	// until header has been processed by the store or context deadline is exceeded.
	GetByHeight(context.Context, uint64) (*header.ExtendedHeader, error)
	// Head returns the ExtendedHeader of the chain head.
	Head(context.Context) (*header.ExtendedHeader, error)
	// IsSyncing returns the status of sync
	IsSyncing() bool
}

func NewHeaderService

func NewHeaderService(
	syncer *sync.Syncer,
	sub header.Subscriber,
	p2pServer *p2p.ExchangeServer,
	ex header.Exchange,
	store header.Store) Module

NewHeaderService creates a new instance of header service.

Jump to

Keyboard shortcuts

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