ethereum

package
v0.0.136 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2023 License: GPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

Types

type BeaconNode

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

func NewBeaconNode

func NewBeaconNode(ctx context.Context, name string, config *Config, log logrus.FieldLogger) (*BeaconNode, error)

func (*BeaconNode) GetBeaconBlock

func (b *BeaconNode) GetBeaconBlock(ctx context.Context, identifier string, ignoreMetrics ...bool) (*spec.VersionedSignedBeaconBlock, error)

GetBeaconBlock returns a beacon block by its identifier. Blocks can be cached internally.

func (*BeaconNode) LazyLoadBeaconBlock

func (b *BeaconNode) LazyLoadBeaconBlock(identifier string)

func (*BeaconNode) Metadata

func (b *BeaconNode) Metadata() *services.MetadataService

func (*BeaconNode) Node

func (b *BeaconNode) Node() beacon.Node

func (*BeaconNode) OnReady

func (b *BeaconNode) OnReady(_ context.Context, callback func(ctx context.Context) error)

func (*BeaconNode) Start

func (b *BeaconNode) Start(ctx context.Context) error

func (*BeaconNode) Synced

func (b *BeaconNode) Synced(ctx context.Context) error

type Config

type Config struct {
	// The address of the Beacon node to connect to
	BeaconNodeAddress string `yaml:"beaconNodeAddress"`
	// OverrideNetworkName is the name of the network to use for the sentry.
	// If not set, the network name will be retrieved from the beacon node.
	OverrideNetworkName string `yaml:"overrideNetworkName"  default:""`
	// BlockCacheSize is the number of blocks to cache.
	BlockCacheSize uint64 `yaml:"blockCacheSize" default:"1000"`
	// BlockCacheTTL is the time to live for blocks in the cache.
	BlockCacheTTL human.Duration `yaml:"blockCacheTtl" default:"1h"`
	// BeaconNodeHeaders is a map of headers to send to the beacon node.
	BeaconNodeHeaders map[string]string `yaml:"beaconNodeHeaders"`
	// BlockPreloadWorkers is the number of workers to use for preloading blocks.
	BlockPreloadWorkers uint64 `yaml:"blockPreloadWorkers" default:"5"`
	// BlockPreloadQueueSize is the size of the queue for preloading blocks.
	BlockPreloadQueueSize uint64 `yaml:"blockPreloadQueueSize" default:"5000"`
}

func (*Config) Validate

func (c *Config) Validate() error

type Metrics

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

func NewMetrics

func NewMetrics(namespace, beaconNodeName string) *Metrics

func (*Metrics) IncBlockCacheHit

func (m *Metrics) IncBlockCacheHit(network string)

func (*Metrics) IncBlockCacheMiss

func (m *Metrics) IncBlockCacheMiss(network string)

func (*Metrics) IncBlocksFetchErrors

func (m *Metrics) IncBlocksFetchErrors(network string)

func (*Metrics) IncBlocksFetched

func (m *Metrics) IncBlocksFetched(network string)

func (*Metrics) SetPreloadBlockQueueSize

func (m *Metrics) SetPreloadBlockQueueSize(network string, size int)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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