MCPcopy Create free account
hub / github.com/CPChain/chain / Notify

Method Notify

protocols/cpc/fetcher/fetcher.go:188–204  ·  view source on GitHub ↗

Notify announces the fetcher of the potential availability of a new block in the network.

(peer string, hash common.Hash, number uint64, time time.Time,
	headerFetcher headerRequesterFn, bodyFetcher bodyRequesterFn)

Source from the content-addressed store, hash-verified

186// Notify announces the fetcher of the potential availability of a new block in
187// the network.
188func (f *Fetcher) Notify(peer string, hash common.Hash, number uint64, time time.Time,
189 headerFetcher headerRequesterFn, bodyFetcher bodyRequesterFn) error {
190 block := &announce{
191 hash: hash,
192 number: number,
193 time: time,
194 origin: peer,
195 fetchHeader: headerFetcher,
196 fetchBodies: bodyFetcher,
197 }
198 select {
199 case f.notify <- block:
200 return nil
201 case <-f.quit:
202 return errTerminated
203 }
204}
205
206// Enqueue tries to fill gaps the the fetcher's future import queue.
207func (f *Fetcher) Enqueue(peer string, block *types.Block) error {

Callers 15

handleSyncMsgMethod · 0.45
traceChainMethod · 0.45
TestPendingDeduplicationFunction · 0.45
TestRandomArrivalImportFunction · 0.45
TestQueueGapFillFunction · 0.45
TestImportDeduplicationFunction · 0.45

Calls

no outgoing calls