Files
p2p/gossip/gossipable.go
zeekay 8120738994 Initial release: Extract p2p package from node
Extract network/p2p functionality to standalone github.com/luxfi/p2p module.

- Core p2p: handler, router, client, network, throttler, validators
- gossip: gossip protocol with bloom filter support
- lp118: warp message signature handling using github.com/luxfi/warp

All imports updated to use external luxfi packages.
2025-12-04 08:19:15 -08:00

32 lines
965 B
Go

// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package gossip
import "github.com/luxfi/ids"
// Gossipable is an item that can be gossiped across the network
type Gossipable interface {
GossipID() ids.ID
}
// Marshaller handles parsing logic for a concrete Gossipable type
type Marshaller[T Gossipable] interface {
MarshalGossip(T) ([]byte, error)
UnmarshalGossip([]byte) (T, error)
}
// Set holds a set of known Gossipable items
type Set[T Gossipable] interface {
// Add adds a Gossipable to the set. Returns an error if gossipable was not
// added.
Add(gossipable T) error
// Has returns true if the gossipable is in the set.
Has(gossipID ids.ID) bool
// Iterate iterates over elements until [f] returns false
Iterate(f func(gossipable T) bool)
// GetFilter returns the byte representation of bloom filter and its
// corresponding salt.
GetFilter() (bloom []byte, salt []byte)
}