Documentation ¶
Overview ¶
This is a temporary package whilst working on the gwc/66 blocking refactors. After that work is done, les needs to be refactored to use the new package, or alternatively use a stripped down version of it. Either way, we need to keep the changes scoped so duplicating temporarily seems the sanest.
Index ¶
- type BlockFetcher
- func (f *BlockFetcher) Enqueue(peer string, block *types.Block) error
- func (f *BlockFetcher) FilterBodies(peer string, transactions [][]*types.Transaction, uncles [][]*types.Header, ...) ([][]*types.Transaction, [][]*types.Header)
- 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, transactions [][]*types.Transaction, uncles [][]*types.Header, time time.Time) ([][]*types.Transaction, [][]*types.Header)
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.