Documentation
¶
Overview ¶
Package tmlibp2p contains implementations of the tmp2p interfaces using github.com/libp2p/go-libp2p.
Note that this package will likely be moved to its own module in a separate git repository, in the future.
Index ¶
- type Connection
- func (c *Connection) Codec() tmcodec.MarshalCodec
- func (c *Connection) ConsensusBroadcaster() tmp2p.ConsensusBroadcaster
- func (c *Connection) Disconnect()
- func (c *Connection) Disconnected() <-chan struct{}
- func (c *Connection) Host() *Host
- func (c *Connection) OutgoingPrecommitProofs() chan<- tmconsensus.PrecommitSparseProof
- func (c *Connection) OutgoingPrevoteProofs() chan<- tmconsensus.PrevoteSparseProof
- func (c *Connection) OutgoingProposedHeaders() chan<- tmconsensus.ProposedHeader
- func (c *Connection) SetConsensusHandler(ctx context.Context, h tmconsensus.ConsensusHandler)
- type Host
- type HostOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
Connection is a connection to a libp2p network, including appropriate pubsub subscriptions.
func NewConnection ¶
func NewConnection(ctx context.Context, log *slog.Logger, h *Host, codec tmcodec.MarshalCodec) (*Connection, error)
NewConnection returns a new Connection based on a host that has already joined a network.
func (*Connection) Codec ¶
func (c *Connection) Codec() tmcodec.MarshalCodec
Codec returns c's codec. This is primarily useful for testing.
func (*Connection) ConsensusBroadcaster ¶
func (c *Connection) ConsensusBroadcaster() tmp2p.ConsensusBroadcaster
ConsensusBroadcaster returns c, which already satisfies the ConsensusBroadcaster interface.
func (*Connection) Disconnect ¶
func (c *Connection) Disconnect()
func (*Connection) Disconnected ¶
func (c *Connection) Disconnected() <-chan struct{}
Disconnected returns a channel that is closed once c.Disconnect() has been called and has returned.
func (*Connection) Host ¶
func (c *Connection) Host() *Host
Host returns c's underlying Host. This is useful for some bookkeeping in [tmlibp2ptest.Network].
func (*Connection) OutgoingPrecommitProofs ¶
func (c *Connection) OutgoingPrecommitProofs() chan<- tmconsensus.PrecommitSparseProof
OutgoingPrecommitProofs returns a channel where precommits may be sent, after which they will be broadcast to the p2p network.
func (*Connection) OutgoingPrevoteProofs ¶
func (c *Connection) OutgoingPrevoteProofs() chan<- tmconsensus.PrevoteSparseProof
OutgoingPrevoteProofs returns a channel where prevote proofs may be sent, after which they will be broadcast to the p2p network.
func (*Connection) OutgoingProposedHeaders ¶
func (c *Connection) OutgoingProposedHeaders() chan<- tmconsensus.ProposedHeader
OutgoingProposedHeaders returns a channel where proposed headers may be sent, after which they will be broadcast to the p2p network.
func (*Connection) SetConsensusHandler ¶
func (c *Connection) SetConsensusHandler(ctx context.Context, h tmconsensus.ConsensusHandler)
SetConsensusHandler sets the consensus handler for this Connection. h may be nil to ignore consensus messages.
type Host ¶
type Host struct {
// contains filtered or unexported fields
}
Host is a libp2p host and a pubsub connection.
func (*Host) Libp2pHost ¶
Libp2pHost returns the underlying libp2p host value.
type HostOptions ¶
type HostOptions struct { // Options are passed when creating a new libp2p host // (which is lower level than the Host type in this tmlibp2p package). Options []libp2p.Option // Currently PubSubOptions are always applied to NewGossipSub. PubSubOptions []pubsub.Option }
HostOptions holds libp2p configuration for the host and pubsub value.
Directories
¶
Path | Synopsis |
---|---|
Package tmlibp2ptest provides the Network type that is useful for tests that need to instantiate a Gordian peer-to-peer network backed by tmlibp2p.
|
Package tmlibp2ptest provides the Network type that is useful for tests that need to instantiate a Gordian peer-to-peer network backed by tmlibp2p. |