Documentation
¶
Overview ¶
Package fetcher contains the block announcement based synchronisation.
Index ¶
- type Fetcher
- func (f *Fetcher) Enqueue(peer string, block types.BlockIntf) error
- func (f *Fetcher) FilterBodies(peer string, shardBlocks [][]*types.ShardBlockInfo, ...) ([][]*types.ShardBlockInfo, [][]*types.Receipt, [][]*types.Transaction, ...)
- func (f *Fetcher) FilterHeaders(peer string, headers []types.HeaderIntf, time time.Time) []types.HeaderIntf
- func (f *Fetcher) FilterMasterBodies(peer string, shardBlocks [][]*types.ShardBlockInfo, ...) ([][]*types.ShardBlockInfo, [][]*types.Receipt, [][]*types.Transaction, ...)
- func (f *Fetcher) FilterShardBodies(peer string, txs [][]*types.Transaction, results [][]*types.ContractResult, ...) ([][]*types.ShardBlockInfo, [][]*types.Receipt, [][]*types.Transaction, ...)
- func (f *Fetcher) Notify(peer string, shardId uint16, hash common.Hash, number uint64, time time.Time, ...) error
- func (f *Fetcher) Start()
- func (f *Fetcher) Stop()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Fetcher ¶
type Fetcher struct {
// contains filtered or unexported fields
}
Fetcher is responsible for accumulating block announcements from various peers and scheduling them for retrieval.
func New ¶
func New(getBlock blockRetrievalFn, verifyHeader headerVerifierFn, broadcastBlock blockBroadcasterFn, chainHeight chainHeightFn, insertChain chainInsertFn, dropPeer peerDropFn) *Fetcher
New creates a block fetcher to retrieve blocks based on hash announcements.
func (*Fetcher) FilterBodies ¶ added in v1.2.2
func (f *Fetcher) FilterBodies(peer string, shardBlocks [][]*types.ShardBlockInfo, receipts [][]*types.Receipt, txs [][]*types.Transaction, results [][]*types.ContractResult, time time.Time, shardId uint16) ([][]*types.ShardBlockInfo, [][]*types.Receipt, [][]*types.Transaction, [][]*types.ContractResult)
func (*Fetcher) FilterHeaders ¶ added in v1.2.2
func (f *Fetcher) FilterHeaders(peer string, headers []types.HeaderIntf, time time.Time) []types.HeaderIntf
FilterHeaders extracts all the headers that were explicitly requested by the fetcher, returning those that should be handled differently.
func (*Fetcher) FilterMasterBodies ¶
func (f *Fetcher) FilterMasterBodies(peer string, shardBlocks [][]*types.ShardBlockInfo, receipts [][]*types.Receipt, time time.Time) ([][]*types.ShardBlockInfo, [][]*types.Receipt, [][]*types.Transaction, [][]*types.ContractResult)
FilterBodies extracts all the block bodies that were explicitly requested by the fetcher, returning those that should be handled differently.
func (*Fetcher) FilterShardBodies ¶
func (f *Fetcher) FilterShardBodies(peer string, txs [][]*types.Transaction, results [][]*types.ContractResult, time time.Time) ([][]*types.ShardBlockInfo, [][]*types.Receipt, [][]*types.Transaction, [][]*types.ContractResult)
FilterBodies extracts all the block bodies that were explicitly requested by the fetcher, returning those that should be handled differently.
func (*Fetcher) Notify ¶
func (f *Fetcher) Notify(peer string, shardId uint16, 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.