bodydownload

package
v0.0.0-...-140c642 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2021 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const BlockBufferSize = 1024
View Source
const MaxBodiesInRequest = 1024

Variables

This section is empty.

Functions

This section is empty.

Types

type BodyDownload

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

BodyDownload represents the state of body downloading process

func NewBodyDownload

func NewBodyDownload(outstandingLimit int) *BodyDownload

NewBodyDownload create a new body download state object

func (*BodyDownload) DeliverBodies

func (bd *BodyDownload) DeliverBodies(bodies []*types.Body) (int, int)

DeliverBody takes the block body received from a peer and adds it to the various data structures

func (*BodyDownload) DeliveryCounts

func (bd *BodyDownload) DeliveryCounts() (float64, float64)

func (*BodyDownload) DeliverySize

func (bd *BodyDownload) DeliverySize(delivered float64, wasted float64)

func (*BodyDownload) GetDeliveries

func (bd *BodyDownload) GetDeliveries() []*types.Block

func (*BodyDownload) GetPenaltyPeers

func (bd *BodyDownload) GetPenaltyPeers() [][]byte

func (*BodyDownload) PrintPeerMap

func (bd *BodyDownload) PrintPeerMap()

func (*BodyDownload) RequestMoreBodies

func (bd *BodyDownload) RequestMoreBodies(db ethdb.Database, blockNum uint64, currentTime uint64) (*BodyRequest, uint64)

func (*BodyDownload) RequestSent

func (bd *BodyDownload) RequestSent(bodyReq *BodyRequest, timeWithTimeout uint64, peer []byte)

func (*BodyDownload) UpdateFromDb

func (bd *BodyDownload) UpdateFromDb(db ethdb.Database) (headHeight uint64, headHash common.Hash, headTd *big.Int, err error)

UpdateFromDb reads the state of the database and refreshes the state of the body download

type BodyRequest

type BodyRequest struct {
	BlockNums []uint64
	Hashes    []common.Hash
	// contains filtered or unexported fields
}

BodyRequest is a sketch of the request for block bodies, meaning that access to the database is required to convert it to the actual BlockBodies request (look up hashes of canonical blocks)

type DoubleHash

type DoubleHash [2 * common.HashLength]byte

DoubleHash is type to be used for the mapping between TxHash and UncleHash to the block header

Jump to

Keyboard shortcuts

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