sentry_multi_client

package
v0.0.0-...-1f8a15b Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2023 License: GPL-3.0 Imports: 42 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GrpcClient

func GrpcClient(ctx context.Context, sentryAddr string) (*direct.SentryClientRemote, error)

Types

type MultiClient

type MultiClient struct {
	Hd     *headerdownload.HeaderDownload
	Bd     *bodydownload.BodyDownload
	IsMock bool

	ChainConfig *chain.Config

	Engine consensus.Engine
	// contains filtered or unexported fields
}

MultiClient - does handle request/response/subscriptions to multiple sentries each sentry may support same or different p2p protocol

func NewMultiClient

func NewMultiClient(
	db kv.RwDB,
	nodeName string,
	chainConfig *chain.Config,
	genesisHash libcommon.Hash,
	genesisTime uint64,
	engine consensus.Engine,
	networkID uint64,
	sentries []direct.SentryClient,
	syncCfg ethconfig.Sync,
	blockReader services.FullBlockReader,
	blockBufferSize int,
	logPeerInfo bool,
	forkValidator *engine_helpers.ForkValidator,
	maxBlockBroadcastPeers func(*types.Header) uint,
	logger log.Logger,
) (*MultiClient, error)

func (*MultiClient) BroadcastNewBlock

func (cs *MultiClient) BroadcastNewBlock(ctx context.Context, header *types.Header, body *types.RawBody, td *big.Int)

func (*MultiClient) HandleInboundMessage

func (cs *MultiClient) HandleInboundMessage(ctx context.Context, message *proto_sentry.InboundMessage, sentry direct.SentryClient) (err error)

func (*MultiClient) HandlePeerEvent

func (cs *MultiClient) HandlePeerEvent(ctx context.Context, event *proto_sentry.PeerEvent, sentry direct.SentryClient) error

func (*MultiClient) PeerEventsLoop

func (cs *MultiClient) PeerEventsLoop(
	ctx context.Context,
	sentry direct.SentryClient,
	wg *sync.WaitGroup,
)

func (*MultiClient) Penalize

func (cs *MultiClient) Penalize(ctx context.Context, penalties []headerdownload.PenaltyItem)

sending list of penalties to all sentries

func (*MultiClient) PropagateNewBlockHashes

func (cs *MultiClient) PropagateNewBlockHashes(ctx context.Context, announces []headerdownload.Announce)

func (*MultiClient) RecvMessageLoop

func (cs *MultiClient) RecvMessageLoop(
	ctx context.Context,
	sentry direct.SentryClient,
	wg *sync.WaitGroup,
)

func (*MultiClient) RecvUploadHeadersMessageLoop

func (cs *MultiClient) RecvUploadHeadersMessageLoop(
	ctx context.Context,
	sentry direct.SentryClient,
	wg *sync.WaitGroup,
)

func (*MultiClient) RecvUploadMessageLoop

func (cs *MultiClient) RecvUploadMessageLoop(
	ctx context.Context,
	sentry direct.SentryClient,
	wg *sync.WaitGroup,
)

func (*MultiClient) SendBodyRequest

func (cs *MultiClient) SendBodyRequest(ctx context.Context, req *bodydownload.BodyRequest) (peerID [64]byte, ok bool)

func (*MultiClient) SendHeaderRequest

func (cs *MultiClient) SendHeaderRequest(ctx context.Context, req *headerdownload.HeaderRequest) (peerID [64]byte, ok bool)

func (*MultiClient) Sentries

func (cs *MultiClient) Sentries() []direct.SentryClient

func (*MultiClient) StartStreamLoops

func (cs *MultiClient) StartStreamLoops(ctx context.Context)

StartStreamLoops starts message processing loops for all sentries. The processing happens in several streams: RecvMessage - processing incoming headers/bodies RecvUploadMessage - sending bodies/receipts - may be heavy, it's ok to not process this messages enough fast, it's also ok to drop some of these messages if we can't process. RecvUploadHeadersMessage - sending headers - dedicated stream because headers propagation speed important for network health PeerEventsLoop - logging peer connect/disconnect events

func (*MultiClient) UpdateHead

func (cs *MultiClient) UpdateHead(ctx context.Context, height, time uint64, hash libcommon.Hash, td *uint256.Int)

Jump to

Keyboard shortcuts

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