protocols

package
v0.0.0-...-91a82d4 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2019 License: LGPL-3.0 Imports: 15 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MinHashFetch  = 512
	MaxHashFetch  = 512
	MaxBlockFetch = 128
)

Functions

This section is empty.

Types

type Block

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

type DoneEvent

type DoneEvent struct{}

type Downloader

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

func NewDownloader

func NewDownloader(mux *feed.TypeMux, hasBlock hashCheckFn, getBlock blockRetrievalFn, headBlock headRetrievalFn, gettd getTdFn, insertChain chainInsertFn, dropPeer peerDropFn) *Downloader

func (*Downloader) DeliverBlocks

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

func (*Downloader) DeliverHashes

func (d *Downloader) DeliverHashes(id string, hashes []utils.Hash) error

func (*Downloader) Has

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

func (*Downloader) RegisterPeer

func (d *Downloader) RegisterPeer(id string, version int, head utils.Hash, getRelHashes relativeHashFetcherFn, getAbsHashes absoluteHashFetcherFn, getBlocks blockFetcherFn) error

func (*Downloader) Stats

func (d *Downloader) Stats() (pending int, cached int, importing int, estimate time.Duration)

func (*Downloader) Synchronise

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

func (*Downloader) Synchronising

func (d *Downloader) Synchronising() bool

func (*Downloader) Terminate

func (d *Downloader) Terminate()

func (*Downloader) UnregisterPeer

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

type FailedEvent

type FailedEvent struct{ Err error }

type Fetcher

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

func NewFetcher

func NewFetcher(getBlock blockRetrievalFn, validateBlock blockValidatorFn, broadcastBlock blockBroadcasterFn, chainHeight chainHeightFn, insertChain chainInsertFn, dropPeer peerDropFn) *Fetcher

func (*Fetcher) Enqueue

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

func (*Fetcher) Filter

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

func (*Fetcher) Notify

func (f *Fetcher) Notify(peer string, hash utils.Hash, time time.Time, fetcher blockRequesterFn) error

func (*Fetcher) Start

func (f *Fetcher) Start()

func (*Fetcher) Stop

func (f *Fetcher) Stop()

type StartEvent

type StartEvent struct{}

Jump to

Keyboard shortcuts

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