network
Package network
import "github.com/luxfi/node/network"Functions
NewValidatorsWrapper
func NewValidatorsWrapper(manager validators.Manager) *validatorsWrapperNewValidatorsWrapper creates a new validators wrapper
Types
Config
func NewTestNetworkConfig(
metrics metric.Registerer,
networkID uint32,
currentValidators validators.Manager,
trackedChains set.Set[ids.ID],
) (*Config, error)ConsistentHashPeerSelector
Legacy compatibility: ConsistentHashPeerSelector is an alias for backward compatibility. Use ScopedConsistentHashSelector with the PrimaryNetworkID as key for equivalent behavior.
func NewConsistentHashPeerSelector(virtualNodes int) *ConsistentHashPeerSelectorDelayConfig
ExternalHandler
ExternalHandler handles incoming messages
ExternalSender
ExternalSender sends messages to peers
HealthConfig
HealthConfig describes parameters for network layer health checks.
Message
Message represents a network message
Network
Network defines the functionality of the networking library.
func NewNetwork(
config *Config,
minCompatibleTime time.Time,
msgCreator message.Creator,
metricsRegistry metric.Registry,
log log.Logger,
listener net.Listener,
dialer dialer.EndpointDialer,
router ExternalHandler,
) (Network, error)func NewTestNetwork(
log log.Logger,
registry metric.Registry,
cfg *Config,
router ExternalHandler,
) (Network, error)PeerListGossipConfig
ScopedConsistentHashSelector
ScopedConsistentHashSelector maintains independent rings keyed by SelectorKey. This enables proper peer selection based on the validator set authority (sequencerID) rather than just the chain/execution domain.
func NewScopedConsistentHashSelector(virtualNodes int) *ScopedConsistentHashSelectorfunc (s *ScopedConsistentHashSelector) Clear(key SelectorKey)func (s *ScopedConsistentHashSelector) ClearAll()func (s *ScopedConsistentHashSelector) Contains(key SelectorKey, nodeID ids.NodeID) boolfunc (s *ScopedConsistentHashSelector) Keys() []SelectorKeyfunc (s *ScopedConsistentHashSelector) RemovePeer(key SelectorKey, nodeID ids.NodeID)func (s *ScopedConsistentHashSelector) SelectDeterministic(
key SelectorKey,
msgKey []byte,
n int,
exclude set.Set[ids.NodeID],
) []ids.NodeIDfunc (s *ScopedConsistentHashSelector) SelectPseudoRandom(
key SelectorKey,
seed []byte,
n int,
exclude set.Set[ids.NodeID],
) []ids.NodeIDfunc (s *ScopedConsistentHashSelector) Size(key SelectorKey) intfunc (s *ScopedConsistentHashSelector) TopByWeight(key SelectorKey, limit int) []ids.NodeIDfunc (s *ScopedConsistentHashSelector) TotalSize() intfunc (s *ScopedConsistentHashSelector) UpsertPeer(key SelectorKey, nodeID ids.NodeID, weight uint64)SelectorKey
SelectorKey is the scoping key for peer selection. In the Lux model this should be the SequencerID (validator-set identity). It can be different from a chainID (execution domain).
SetCallbackListener
SetCallbackListener for validator changes