Documentation
¶
Index ¶
- func ConstructModule(tp node.Type, cfg *Config) fx.Option
- func Flags() *flag.FlagSet
- func InitStore(ctx context.Context, cfg Config, net params.Network, s header.Store, ...) error
- func P2PExchange(cfg Config) func(params.Bootstrappers, host.Host) (header.Exchange, error)
- func ParseFlags(cmd *cobra.Command, cfg *Config) error
- func ParseTrustedHashFlags(cmd *cobra.Command, cfg *Config) error
- func ParseTrustedPeerFlags(cmd *cobra.Command, cfg *Config) error
- func TrustedHashFlags() *flag.FlagSet
- func TrustedPeersFlags() *flag.FlagSet
- func WithMetrics(enable bool) fx.Option
- type Config
- type Module
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitStore ¶ added in v0.6.2
func InitStore(ctx context.Context, cfg Config, net params.Network, s header.Store, ex header.Exchange) error
InitStore initializes the store.
func P2PExchange ¶
P2PExchange constructs new Exchange for headers.
func ParseFlags ¶
ParseFlags parses Header package flags from the given cmd and applies them to the passed config.
func ParseTrustedHashFlags ¶
ParseTrustedHashFlags parses Header package flags from the given cmd and saves them to the passed config.
func ParseTrustedPeerFlags ¶
ParseTrustedPeerFlags parses Header package flags from the given cmd and applies them to the passed config.
func TrustedHashFlags ¶
TrustedHashFlags returns a set of flags related to configuring a `TrustedHash`.
func TrustedPeersFlags ¶
TrustedPeersFlags returns a set of flags.
func WithMetrics ¶ added in v0.7.0
TODO: Eventually we should have a per-module metrics option. WithMetrics enables metrics exporting for the node.
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
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.