blocksync

package
v0.0.0-...-4ef5390 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// NOTE: keep up to date with bcproto.BlockResponse
	BlockResponseMessagePrefixSize   = 4
	BlockResponseMessageFieldKeySize = 1
	MaxMsgSize                       = types.MaxBlockSizeBytes +
		BlockResponseMessagePrefixSize +
		BlockResponseMessageFieldKeySize
)
View Source
const (
	// BlocksyncChannel is a channel for blocks and status updates (`BlockStore` height)
	BlocksyncChannel = byte(0x40)
)

Variables

View Source
var (
	// ErrNilMessage is returned when provided message is empty
	ErrNilMessage = errors.New("message cannot be nil")
)

Functions

func ValidateMsg

func ValidateMsg(pb proto.Message) error

ValidateMsg validates a message.

Types

type ErrInvalidBase

type ErrInvalidBase struct {
	Base   int64
	Reason string
}

ErrInvalidBase is returned when peer informs of a status with invalid base

func (ErrInvalidBase) Error

func (e ErrInvalidBase) Error() string

type ErrInvalidHeight

type ErrInvalidHeight struct {
	Height int64
	Reason string
}

ErrInvalidBase is returned when peer informs of a status with invalid height

func (ErrInvalidHeight) Error

func (e ErrInvalidHeight) Error() string

type ErrReactorValidation

type ErrReactorValidation struct {
	Err error
}

func (ErrReactorValidation) Error

func (e ErrReactorValidation) Error() string

func (ErrReactorValidation) Unwrap

func (e ErrReactorValidation) Unwrap() error

type ErrUnknownMessageType

type ErrUnknownMessageType struct {
	Msg proto.Message
}

func (ErrUnknownMessageType) Error

func (e ErrUnknownMessageType) Error() string

type Reactor

type Reactor struct {
	p2p.BaseReactor
	// contains filtered or unexported fields
}

Reactor handles long-term catchup syncing.

func NewReactor

func NewReactor(state sm.State, store *store.BlockStore, localPeerID p2p.ID,
	celestiaCfg *relayer.CelestiaConfig, genDoc *types.GenesisDoc,
	clientCtx client.Context, cmtConfig *cfg.Config, celestiaPollInterval time.Duration,
	celestiaNamespace string, chainID string,
) *Reactor

NewReactor returns new reactor instance.

func (*Reactor) AddPeer

func (bcR *Reactor) AddPeer(peer p2p.Peer)

AddPeer implements Reactor by sending our state to peer.

func (*Reactor) GetChannels

func (bcR *Reactor) GetChannels() []*p2p.ChannelDescriptor

GetChannels implements Reactor

func (*Reactor) OnStart

func (bcR *Reactor) OnStart() error

OnStart implements service.Service.

func (*Reactor) OnStop

func (bcR *Reactor) OnStop()

OnStop implements service.Service.

func (*Reactor) Receive

func (bcR *Reactor) Receive(e p2p.Envelope)

Receive implements Reactor by handling 4 types of messages (look below).

func (*Reactor) RemovePeer

func (bcR *Reactor) RemovePeer(peer p2p.Peer, _ interface{})

RemovePeer implements Reactor by removing peer from the pool.

func (*Reactor) SetLogger

func (bcR *Reactor) SetLogger(l log.Logger)

SetLogger implements service.Service by setting the logger on reactor and pool.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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