fetcher

package
v1.3.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 1, 2016 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package fetcher contains the block announcement based synchonisation.

Index

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, validateBlock blockValidatorFn, broadcastBlock blockBroadcasterFn, chainHeight chainHeightFn, insertChain chainInsertFn, dropPeer peerDropFn) *Fetcher

New creates a block fetcher to retrieve blocks based on hash announcements.

func (*Fetcher) Enqueue

func (f *Fetcher) Enqueue(peer string, block *types.Block) error

Enqueue tries to fill gaps the the fetcher's future import queue.

func (*Fetcher) FilterBlocks added in v1.2.2

func (f *Fetcher) FilterBlocks(blocks types.Blocks) types.Blocks

FilterBlocks extracts all the blocks that were explicitly requested by the fetcher, returning those that should be handled differently.

func (*Fetcher) FilterBodies added in v1.2.2

func (f *Fetcher) FilterBodies(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 (*Fetcher) FilterHeaders added in v1.2.2

func (f *Fetcher) FilterHeaders(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) Notify

func (f *Fetcher) Notify(peer string, hash common.Hash, number uint64, time time.Time,
	blockFetcher blockRequesterFn,
	headerFetcher headerRequesterFn, bodyFetcher bodyRequesterFn) error

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

func (*Fetcher) Start

func (f *Fetcher) Start()

Start boots up the announcement based synchoniser, accepting and processing hash notifications and block fetches until termination requested.

func (*Fetcher) Stop

func (f *Fetcher) Stop()

Stop terminates the announcement based synchroniser, canceling all pending operations.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL