downloader

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2015 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Overview

Package downloader contains the manual full chain synchronisation.

Index

Constants

This section is empty.

Variables

View Source
var (
	MaxHashFetch     = 512 // Amount of hashes to be fetched per retrieval request
	MaxBlockFetch    = 128 // Amount of blocks to be fetched per retrieval request
	MaxHeaderFetch   = 192 // Amount of block headers to be fetched per retrieval request
	MaxBodyFetch     = 128 // Amount of block bodies to be fetched per retrieval request
	MaxStateFetch    = 384 // Amount of node state values to allow fetching per request
	MaxReceiptsFetch = 384 // Amount of transaction receipts to allow fetching per request

)

Functions

This section is empty.

Types

type Block added in v0.9.26

type Block struct {
	RawBlock   *types.Block
	OriginPeer string
}

Block is an origin-tagged blockchain block.

type DoneEvent

type DoneEvent struct{}

type Downloader

type Downloader struct {
	// contains filtered or unexported fields
}

func New

func New(mux *event.TypeMux, hasBlock hashCheckFn, getBlock blockRetrievalFn, headBlock headRetrievalFn, getTd tdRetrievalFn, insertChain chainInsertFn, dropPeer peerDropFn) *Downloader

New creates a new downloader to fetch hashes and blocks from remote peers.

func (*Downloader) Boundaries added in v1.2.3

func (d *Downloader) Boundaries() (uint64, uint64)

Boundaries retrieves the synchronisation boundaries, specifically the origin block where synchronisation started at (may have failed/suspended) and the latest known block which the synchonisation targets.

func (*Downloader) DeliverBlocks61 added in v1.2.3

func (d *Downloader) DeliverBlocks61(id string, blocks []*types.Block) (err error)

DeliverBlocks61 injects a new batch of blocks received from a remote node. This is usually invoked through the BlocksMsg by the protocol handler.

func (*Downloader) DeliverBodies added in v1.2.3

func (d *Downloader) DeliverBodies(id string, transactions [][]*types.Transaction, uncles [][]*types.Header) (err error)

DeliverBodies injects a new batch of block bodies received from a remote node.

func (*Downloader) DeliverHashes61 added in v1.2.3

func (d *Downloader) DeliverHashes61(id string, hashes []common.Hash) (err error)

DeliverHashes61 injects a new batch of hashes received from a remote node into the download schedule. This is usually invoked through the BlockHashesMsg by the protocol handler.

func (*Downloader) DeliverHeaders added in v1.2.3

func (d *Downloader) DeliverHeaders(id string, headers []*types.Header) (err error)

DeliverHeaders injects a new batch of blck headers received from a remote node into the download schedule.

func (*Downloader) Has

func (d *Downloader) Has(hash common.Hash) bool

Has checks if the downloader knows about a particular hash, meaning that its either already downloaded of pending retrieval.

func (*Downloader) RegisterPeer

func (d *Downloader) RegisterPeer(id string, version int, head common.Hash,
	getRelHashes relativeHashFetcherFn, getAbsHashes absoluteHashFetcherFn, getBlocks blockFetcherFn,
	getRelHeaders relativeHeaderFetcherFn, getAbsHeaders absoluteHeaderFetcherFn, getBlockBodies blockBodyFetcherFn) error

RegisterPeer injects a new download peer into the set of block source to be used for fetching hashes and blocks from.

func (*Downloader) Synchronise

func (d *Downloader) Synchronise(id string, head common.Hash, td *big.Int)

Synchronise tries to sync up our local block chain with a remote peer, both adding various sanity checks as well as wrapping it with various log entries.

func (*Downloader) Synchronising

func (d *Downloader) Synchronising() bool

Synchronising returns whether the downloader is currently retrieving blocks.

func (*Downloader) Terminate added in v0.9.38

func (d *Downloader) Terminate()

Terminate interrupts the downloader, canceling all pending operations.

func (*Downloader) UnregisterPeer

func (d *Downloader) UnregisterPeer(id string) error

UnregisterPeer remove a peer from the known list, preventing any action from the specified peer.

type FailedEvent

type FailedEvent struct{ Err error }

type StartEvent

type StartEvent struct{}

Jump to

Keyboard shortcuts

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