Documentation ¶
Overview ¶
Package fetcher contains the announcement based header, blocks or transaction synchronisation.
Index ¶
- type BlockFetcher
- func (f *BlockFetcher) Enqueue(peer string, block *types.Block) error
- func (f *BlockFetcher) FilterBodies(peer string, blockHashes []common.Hash, transactions [][]*types.Transaction, ...) ([]common.Hash, [][]*types.Transaction, []*types.Randomness, ...)
- func (f *BlockFetcher) FilterHeaders(peer string, headers []*types.Header, time time.Time) []*types.Header
- func (f *BlockFetcher) Notify(peer string, hash common.Hash, number uint64, time time.Time, ...) error
- func (f *BlockFetcher) Start()
- func (f *BlockFetcher) Stop()
- type HeaderRetrievalFn
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BlockFetcher ¶
type BlockFetcher struct {
// contains filtered or unexported fields
}
BlockFetcher is responsible for accumulating block announcements from various peers and scheduling them for retrieval.
func NewBlockFetcher ¶
func NewBlockFetcher(light bool, getHeader HeaderRetrievalFn, getBlock blockRetrievalFn, verifyHeader headerVerifierFn, broadcastBlock blockBroadcasterFn, chainHeight chainHeightFn, insertHeaders headersInsertFn, insertChain chainInsertFn, dropPeer peerDropFn) *BlockFetcher
NewBlockFetcher creates a block fetcher to retrieve blocks based on hash announcements.
func (*BlockFetcher) Enqueue ¶
func (f *BlockFetcher) Enqueue(peer string, block *types.Block) error
Enqueue tries to fill gaps the fetcher's future import queue.
func (*BlockFetcher) FilterBodies ¶
func (f *BlockFetcher) FilterBodies(peer string, blockHashes []common.Hash, transactions [][]*types.Transaction, randomness []*types.Randomness, epochSnarkData []*types.EpochSnarkData, time time.Time) ([]common.Hash, [][]*types.Transaction, []*types.Randomness, []*types.EpochSnarkData)
FilterBodies extracts all the block bodies that were explicitly requested by the fetcher, returning those that should be handled differently.
func (*BlockFetcher) FilterHeaders ¶
func (f *BlockFetcher) FilterHeaders(peer string, headers []*types.Header, time time.Time) []*types.Header
FilterHeaders extracts all the headers that were explicitly requested by the fetcher, returning those that should be handled differently.
func (*BlockFetcher) Notify ¶
func (f *BlockFetcher) Notify(peer string, hash common.Hash, number uint64, time time.Time, headerFetcher headerRequesterFn, bodyFetcher bodyRequesterFn) error
Notify announces the fetcher of the potential availability of a new block in the network.
func (*BlockFetcher) Start ¶
func (f *BlockFetcher) Start()
Start boots up the announcement based synchroniser, accepting and processing hash notifications and block fetches until termination requested.
func (*BlockFetcher) Stop ¶
func (f *BlockFetcher) Stop()
Stop terminates the announcement based synchroniser, canceling all pending operations.