Documentation ¶
Index ¶
- type BackwardBeaconDownloader
- func (b *BackwardBeaconDownloader) Finished() bool
- func (b *BackwardBeaconDownloader) Peers() (uint64, error)
- func (b *BackwardBeaconDownloader) Progress() uint64
- func (b *BackwardBeaconDownloader) RequestMore(ctx context.Context) error
- func (b *BackwardBeaconDownloader) SetExpectedRoot(root libcommon.Hash)
- func (b *BackwardBeaconDownloader) SetNeverSkip(neverSkip bool)
- func (b *BackwardBeaconDownloader) SetOnNewBlock(onNewBlock OnNewBlock)
- func (b *BackwardBeaconDownloader) SetSlotToDownload(slot uint64)
- func (b *BackwardBeaconDownloader) SetThrottle(throttle time.Duration)
- type ForwardBeaconDownloader
- func (f *ForwardBeaconDownloader) GetHighestProcessedSlot() uint64
- func (f *ForwardBeaconDownloader) HighestProcessedRoot() libcommon.Hash
- func (f *ForwardBeaconDownloader) Peers() (uint64, error)
- func (f *ForwardBeaconDownloader) RequestMore(ctx context.Context)
- func (f *ForwardBeaconDownloader) SetHighestProcessedRoot(root libcommon.Hash)
- func (f *ForwardBeaconDownloader) SetHighestProcessedSlot(highestSlotProcessed uint64)
- func (f *ForwardBeaconDownloader) SetProcessFunction(fn ProcessFn)
- type GossipManager
- type OnNewBlock
- type ProcessFn
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, db kv.RwDB) *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(ctx context.Context) error
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) SetNeverSkip ¶
func (b *BackwardBeaconDownloader) SetNeverSkip(neverSkip bool)
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.
func (*BackwardBeaconDownloader) SetThrottle ¶
func (b *BackwardBeaconDownloader) SetThrottle(throttle time.Duration)
SetThrottle sets the throttle.
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) Peers ¶
func (f *ForwardBeaconDownloader) Peers() (uint64, error)
func (*ForwardBeaconDownloader) RequestMore ¶
func (f *ForwardBeaconDownloader) RequestMore(ctx context.Context)
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) SetProcessFunction ¶
func (f *ForwardBeaconDownloader) SetProcessFunction(fn ProcessFn)
SetProcessFunction sets the function used to process segments.
type GossipManager ¶
type GossipManager struct {
// contains filtered or unexported fields
}
Gossip manager is sending all messages to fork choice or others
func NewGossipReceiver ¶
func NewGossipReceiver(s sentinel.SentinelClient, forkChoice *forkchoice.ForkChoiceStore, beaconConfig *clparams.BeaconChainConfig, genesisConfig *clparams.GenesisConfig, recorder freezer.Freezer) *GossipManager
func (*GossipManager) Start ¶
func (g *GossipManager) Start(ctx context.Context)
func (*GossipManager) SubscribeSignedBeaconBlocks ¶
func (g *GossipManager) SubscribeSignedBeaconBlocks(ctx context.Context) <-chan *peers.PeeredObject[*cltypes.SignedBeaconBlock]
this subscribes to signed beacon blocks..... i wish this was better
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?