p2p

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2024 License: MIT Imports: 30 Imported by: 0

README

p2p spec

  1. Listen to transactions. These come from two souces:
    • on-chain listeners. These can be added through an interface from another module, likely asynchronously or through the db
    • peers: these can be got from peers via the announce transaction module. Signing peers are expected to ack.

Documentation

Overview

Package p2p provides the p2p communication layer for the committee.

Index

Constants

This section is empty.

Variables

View Source
var RebroadcastingInterval = time.Minute

RebroadcastingInterval is the interval at which the crdt will rebroadcast its data.

Functions

This section is empty.

Types

type LibP2PManager

type LibP2PManager interface {
	// Host returns the host from the manager.
	Host() host.Host // Expose host from manager
	// Start starts the libp2p manager.
	Start(ctx context.Context, bootstrapPeers []string) error
	// AddValidators adds validators to the manager.
	AddValidators(ctx context.Context, addr ...common.Address) error
	// Address returns the address of the node.
	Address() common.Address
	// GetSignature gets a signature from the datastore.
	GetSignature(ctx context.Context, address common.Address, chainID int, entryID common.Hash) ([]byte, error)
	// PutSignature puts a signature into the datastore.
	PutSignature(ctx context.Context, chainID int, entryID common.Hash, signature []byte) error
}

LibP2PManager is the interface for the libp2p manager.

func NewLibP2PManager

func NewLibP2PManager(ctx context.Context, handler metrics.Handler, auth signer.Signer, store db.Datstores, port int, usePeerID bool) (_ LibP2PManager, err error)

NewLibP2PManager creates a new libp2p manager. listenHost is the host to listen on.

validators should be a list of addresses that are allowed to connect to the host. This should include the address of the node itself. whitelist is the list of addresses that are allowed to write to the datastore.

Jump to

Keyboard shortcuts

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