Documentation ¶
Index ¶
- Constants
- type BodyDownload
- func (bd *BodyDownload) AddToPrefetch(header *types.Header, body *types.RawBody)
- func (bd *BodyDownload) AdvanceLow()
- func (bd *BodyDownload) BodyCacheSize() int
- func (bd *BodyDownload) ClearBodyCache()
- func (bd *BodyDownload) DeliverBodies(txs [][][]byte, uncles [][]*types.Header, withdrawals []types.Withdrawals, ...)
- func (bd *BodyDownload) DeliveryCounts() (float64, float64)
- func (bd *BodyDownload) DeliverySize(delivered float64, wasted float64)
- func (bd *BodyDownload) GetBodyFromCache(blockNum uint64, del bool) *types.RawBody
- func (bd *BodyDownload) GetDeliveries(tx kv.RwTx) (uint64, uint64, error)
- func (bd *BodyDownload) GetHeader(blockNum uint64, blockReader services.FullBlockReader, tx kv.Tx) (*types.Header, libcommon.Hash, error)
- func (bd *BodyDownload) GetPenaltyPeers() [][64]byte
- func (bd *BodyDownload) NextProcessingCount() uint64
- func (bd *BodyDownload) NotDelivered(blockNum uint64)
- func (bd *BodyDownload) PrintPeerMap()
- func (bd *BodyDownload) RequestMoreBodies(tx kv.RwTx, blockReader services.FullBlockReader, currentTime uint64, ...) (*BodyRequest, error)
- func (bd *BodyDownload) RequestSent(bodyReq *BodyRequest, timeWithTimeout uint64, peer [64]byte)
- func (bd *BodyDownload) UpdateFromDb(db kv.Tx) (headHeight, headTime uint64, headHash libcommon.Hash, headTd256 *uint256.Int, ...)
- type BodyRequest
- type BodyTreeItem
- type Delivery
- type PrefetchedBlocks
- type RawTransactions
- type TripleHash
Constants ¶
const BlockBufferSize = 128
const MaxBodiesInRequest = 1024
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BodyDownload ¶
type BodyDownload struct { DeliveryNotify chan struct{} Engine consensus.Engine // contains filtered or unexported fields }
BodyDownload represents the state of body downloading process
func NewBodyDownload ¶
func NewBodyDownload(engine consensus.Engine, bodyCacheLimit int) *BodyDownload
NewBodyDownload create a new body download state object
func (*BodyDownload) AddToPrefetch ¶
func (bd *BodyDownload) AddToPrefetch(header *types.Header, body *types.RawBody)
func (*BodyDownload) AdvanceLow ¶
func (bd *BodyDownload) AdvanceLow()
func (*BodyDownload) BodyCacheSize ¶
func (bd *BodyDownload) BodyCacheSize() int
func (*BodyDownload) ClearBodyCache ¶
func (bd *BodyDownload) ClearBodyCache()
func (*BodyDownload) DeliverBodies ¶
func (bd *BodyDownload) DeliverBodies(txs [][][]byte, uncles [][]*types.Header, withdrawals []types.Withdrawals, lenOfP2PMsg uint64, peerID [64]byte)
DeliverBodies 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) GetBodyFromCache ¶
func (bd *BodyDownload) GetBodyFromCache(blockNum uint64, del bool) *types.RawBody
func (*BodyDownload) GetDeliveries ¶
func (*BodyDownload) GetHeader ¶
func (bd *BodyDownload) GetHeader(blockNum uint64, blockReader services.FullBlockReader, tx kv.Tx) (*types.Header, libcommon.Hash, error)
GetHeader returns a header by either loading from the deliveriesH slice populated when running RequestMoreBodies or if the code is continuing from a previous run and this isn't present, by reading from the DB as the RequestMoreBodies would have. as the requestedLow count is incremented before a call to this function we need the process count so that we can anticipate this, effectively reversing time a little to get the actual position we need in the slice prior to requestedLow being incremented
func (*BodyDownload) GetPenaltyPeers ¶
func (bd *BodyDownload) GetPenaltyPeers() [][64]byte
func (*BodyDownload) NextProcessingCount ¶
func (bd *BodyDownload) NextProcessingCount() uint64
NextProcessingCount returns the count of contiguous block numbers ready to process from the requestedLow minimum value. the requestedLow count is increased by the number returned
func (*BodyDownload) NotDelivered ¶
func (bd *BodyDownload) NotDelivered(blockNum uint64)
func (*BodyDownload) PrintPeerMap ¶
func (bd *BodyDownload) PrintPeerMap()
func (*BodyDownload) RequestMoreBodies ¶
func (bd *BodyDownload) RequestMoreBodies(tx kv.RwTx, blockReader services.FullBlockReader, currentTime uint64, blockPropagator adapter.BlockPropagator) (*BodyRequest, error)
RequestMoreBodies - returns nil if nothing to request
func (*BodyDownload) RequestSent ¶
func (bd *BodyDownload) RequestSent(bodyReq *BodyRequest, timeWithTimeout uint64, peer [64]byte)
type BodyRequest ¶
type BodyRequest struct { BlockNums []uint64 Hashes []libcommon.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 BodyTreeItem ¶
type BodyTreeItem struct {
// contains filtered or unexported fields
}
BodyQueueItem is part of the body cache kept in memory
type PrefetchedBlocks ¶
type PrefetchedBlocks struct {
// contains filtered or unexported fields
}
func NewPrefetchedBlocks ¶
func NewPrefetchedBlocks() *PrefetchedBlocks
type RawTransactions ¶
type RawTransactions [][]byte
RawTransaction implements core/types.DerivableList interface for hashing
func (RawTransactions) EncodeIndex ¶
func (rt RawTransactions) EncodeIndex(i int, w *bytes.Buffer)
EncodeIndex is part of core/types.DerivableList It strips the transaction envelope from the transaction RLP
func (RawTransactions) Len ¶
func (rt RawTransactions) Len() int
type TripleHash ¶
TripleHash is type to be used for the mapping between TxHash, UncleHash, and WithdrawalsHash to the block header