network

package
v0.0.0-...-92d349b Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BackwardBeaconDownloader

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

func NewBackwardBeaconDownloader

func NewBackwardBeaconDownloader(ctx context.Context, rpc *rpc.BeaconRpcP2P) *BackwardBeaconDownloader

func (*BackwardBeaconDownloader) Finished

func (b *BackwardBeaconDownloader) Finished() bool

HighestProcessedRoot returns the highest processed block root so far.

func (*BackwardBeaconDownloader) Peers

func (b *BackwardBeaconDownloader) Peers() (uint64, error)

Peers returns the current number of peers connected to the BackwardBeaconDownloader.

func (*BackwardBeaconDownloader) Progress

func (b *BackwardBeaconDownloader) Progress() uint64

Progress current progress.

func (*BackwardBeaconDownloader) RequestMore

func (b *BackwardBeaconDownloader) RequestMore()

RequestMore downloads a range of blocks in a backward manner. The function sends a request for a range of blocks starting from a given slot and ending count blocks before it. It then processes the response by iterating over the blocks in reverse order and calling a provided callback function onNewBlock on each block. If the callback returns an error or signals that the download should be finished, the function will exit. If the block's root hash does not match the expected root hash, it will be rejected and the function will continue to the next block.

func (*BackwardBeaconDownloader) SetExpectedRoot

func (b *BackwardBeaconDownloader) SetExpectedRoot(root libcommon.Hash)

SetExpectedRoot sets the expected root we expect to download.

func (*BackwardBeaconDownloader) SetOnNewBlock

func (b *BackwardBeaconDownloader) SetOnNewBlock(onNewBlock OnNewBlock)

SetShouldStopAtFn sets the stop condition.

func (*BackwardBeaconDownloader) SetSlotToDownload

func (b *BackwardBeaconDownloader) SetSlotToDownload(slot uint64)

SetSlotToDownload sets slot to download.

type ForwardBeaconDownloader

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

func NewForwardBeaconDownloader

func NewForwardBeaconDownloader(ctx context.Context, rpc *rpc.BeaconRpcP2P) *ForwardBeaconDownloader

func (*ForwardBeaconDownloader) GetHighestProcessedSlot

func (f *ForwardBeaconDownloader) GetHighestProcessedSlot() uint64

GetHighestProcessedSlot retrieve the highest processed slot we accumulated.

func (*ForwardBeaconDownloader) HighestProcessedRoot

func (f *ForwardBeaconDownloader) HighestProcessedRoot() libcommon.Hash

HighestProcessedRoot returns the highest processed block root so far.

func (*ForwardBeaconDownloader) ProcessBlocks

func (f *ForwardBeaconDownloader) ProcessBlocks() error

ProcessBlocks processes blocks we accumulated.

func (*ForwardBeaconDownloader) ReceiveGossip

func (f *ForwardBeaconDownloader) ReceiveGossip(obj ssz.Unmarshaler)

Start begins the gossip listening process.

func (*ForwardBeaconDownloader) RequestMore

func (f *ForwardBeaconDownloader) RequestMore()

func (*ForwardBeaconDownloader) SetHighestProcessedRoot

func (f *ForwardBeaconDownloader) SetHighestProcessedRoot(root libcommon.Hash)

SetHighestProcessedRoot sets the highest processed block root so far.

func (*ForwardBeaconDownloader) SetHighestProcessedSlot

func (f *ForwardBeaconDownloader) SetHighestProcessedSlot(highestSlotProcessed uint64)

SetHighestProcessedSlot sets the highest processed slot so far.

func (*ForwardBeaconDownloader) SetIsDownloading

func (f *ForwardBeaconDownloader) SetIsDownloading(isDownloading bool)

SetIsDownloading sets isDownloading

func (*ForwardBeaconDownloader) SetLimitSegmentsLength

func (f *ForwardBeaconDownloader) SetLimitSegmentsLength(limitSegmentsLength int)

SetLimitSegmentsLength sets the segments limiter.

func (*ForwardBeaconDownloader) SetProcessFunction

func (f *ForwardBeaconDownloader) SetProcessFunction(fn ProcessFn)

SetProcessFunction sets the function used to process segments.

func (*ForwardBeaconDownloader) SetTargetSlot

func (f *ForwardBeaconDownloader) SetTargetSlot(targetSlot uint64)

SetTargetSlot sets the target slot.

type GossipManager

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

func (*GossipManager) AddReceiver

func (g *GossipManager) AddReceiver(t sentinel.GossipType, receiver GossipReceiver)

func (*GossipManager) Loop

func (g *GossipManager) Loop()

type GossipReceiver

type GossipReceiver interface {
	ReceiveGossip(ssz.Unmarshaler)
}

type OnNewBlock

type OnNewBlock func(blk *cltypes.SignedBeaconBlock) (finished bool, err error)

Whether the reverse downloader arrived at expected height or condition.

type ProcessFn

type ProcessFn func(
	highestSlotProcessed uint64,
	highestBlockRootProcessed libcommon.Hash,
	blocks []*cltypes.SignedBeaconBlock) (
	newHighestSlotProcessed uint64,
	newHighestBlockRootProcessed libcommon.Hash,
	err error)

Input: the currently highest slot processed and the list of blocks we want to know process Output: the new last new highest slot processed and an error possibly?

Jump to

Keyboard shortcuts

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