helloprotocol

package
v1.11.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2023 License: Apache-2.0, MIT Imports: 22 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrBadGenesis = fmt.Errorf("bad genesis block")

ErrBadGenesis is the error returned when a mismatch in genesis blocks happens.

Functions

This section is empty.

Types

type GetTipSetFunc

type GetTipSetFunc func() (*types.TipSet, error)

type HelloMessage

type HelloMessage struct {
	HeaviestTipSetCids   []cid.Cid
	HeaviestTipSetHeight abi.ChainEpoch
	HeaviestTipSetWeight fbig.Int
	GenesisHash          cid.Cid
}

HelloMessage is the data structure of a single message in the hello protocol.

func (*HelloMessage) MarshalCBOR

func (t *HelloMessage) MarshalCBOR(w io.Writer) error

func (*HelloMessage) UnmarshalCBOR

func (t *HelloMessage) UnmarshalCBOR(r io.Reader) (err error)

type HelloProtocolHandler

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

HelloProtocolHandler implements the 'Hello' protocol handler.

Upon connecting to a new node, we send them a message containing some information about the state of our chain, and receive the same information from them. This is used to initiate a chainsync and detect connections to forks.

func NewHelloProtocolHandler

func NewHelloProtocolHandler(h host.Host,
	peerMgr peermgr.IPeerMgr,
	exchange exchange.Client,
	chainStore *chain.Store,
	messageStore *chain.MessageStore,
	gen cid.Cid,
	helloTimeOut time.Duration,
) *HelloProtocolHandler

NewHelloProtocolHandler creates a new instance of the hello protocol `Handler` and registers it to the given `host.Host`.

func (*HelloProtocolHandler) Register

func (h *HelloProtocolHandler) Register(peerDiscoveredCallback PeerDiscoveredCallback)

Register registers the handler with the network.

type LatencyMessage

type LatencyMessage struct {
	TArrival int64
	TSent    int64
}

LatencyMessage is written in response to a hello message for measuring peer latency.

func (*LatencyMessage) MarshalCBOR

func (t *LatencyMessage) MarshalCBOR(w io.Writer) error

func (*LatencyMessage) UnmarshalCBOR

func (t *LatencyMessage) UnmarshalCBOR(r io.Reader) (err error)

type PeerDiscoveredCallback

type PeerDiscoveredCallback func(ci *types.ChainInfo)

Jump to

Keyboard shortcuts

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