Documentation ¶
Overview ¶
Package fetcher contains the block announcement based synchronisation.
Index ¶
- type Fetcher
- func (f *Fetcher) Enqueue(peer string, block *types.Block) error
- func (f *Fetcher) FilterBodies(peer string, transactions [][]*types.Transaction, signs [][]*types.PbftSign, ...) ([][]*types.Transaction, [][]*types.PbftSign, [][]*types.CommitteeMember)
- func (f *Fetcher) FilterHeaders(peer string, headers []*types.Header, time time.Time) []*types.Header
- func (f *Fetcher) GetPendingBlock(hash common.Hash) *types.Block
- func (f *Fetcher) Notify(peer string, hash common.Hash, number uint64, time time.Time, ...) error
- func (f *Fetcher) Start()
- func (f *Fetcher) Stop()
- type PbftAgentFetcher
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, broadcastFastBlock blockBroadcasterFn, chainHeight chainHeightFn, insertChain chainInsertFn, dropPeer peerDropFn, agentFetcher PbftAgentFetcher, broadcastSigns signBroadcasterFn) *Fetcher
New creates a block fetcher to retrieve blocks based on hash announcements.
func (*Fetcher) FilterBodies ¶
func (f *Fetcher) FilterBodies(peer string, transactions [][]*types.Transaction, signs [][]*types.PbftSign, infos [][]*types.CommitteeMember, time time.Time) ([][]*types.Transaction, [][]*types.PbftSign, [][]*types.CommitteeMember)
FilterBodies extracts all the block bodies that were explicitly requested by the fetcher, returning those that should be handled differently.
func (*Fetcher) FilterHeaders ¶
func (f *Fetcher) 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 (*Fetcher) GetPendingBlock ¶
GetPendingBlock gets a block that is not inserted locally
func (*Fetcher) Notify ¶
func (f *Fetcher) 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.
type PbftAgentFetcher ¶
type PbftAgentFetcher interface { // a type to verify a leader's fast block for fast propagation. VerifyCommitteeSign(signs *types.PbftSign) bool // when check evil Leader, changeLeader ChangeCommitteeLeader(height *big.Int) bool // according height require committee number GetCommitteeNumber(height *big.Int) int32 // AcquireCommitteeAuth check current node whether committee. AcquireCommitteeAuth(*big.Int) bool }
PbftAgentFetcher encapsulates functions required to interact with PbftAgent.