protocol

package
v0.33.0 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2024 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	C_NumPrimeBlocksToDownload = 10
)
View Source
const (
	// ProtocolVersion is the current version of the Quai protocol
	ProtocolVersion protocol.ID = "/quai/1.0.0"
)

Variables

This section is empty.

Functions

func ProcRequestRate added in v0.32.0

func ProcRequestRate(peerId peer.ID, inbound bool) error

Feed the request rate tracker, recomputing the rate, and returning an error if the rate limit is exceeded

func QuaiProtocolHandler

func QuaiProtocolHandler(stream network.Stream, node QuaiP2PNode)

QuaiProtocolHandler handles all the incoming requests and responds with corresponding data

Types

type QuaiP2PNode

type QuaiP2PNode interface {
	// Search for a block in the node's cache, or query the consensus backend if it's not found in cache.
	// Returns nil if the block is not found.
	GetWorkObject(hash common.Hash, location common.Location) *types.WorkObject
	GetWorkObjectsFrom(hash common.Hash, location common.Location, count int) []*types.WorkObjectBlockView
	GetBlockHashByNumber(number *big.Int, location common.Location) *common.Hash
	GetRequestManager() requestManager.RequestManager
	GetBandwidthCounter() libp2pmetrics.Reporter

	Connect(peer.AddrInfo) error
	GetStream(peer.ID) (network.Stream, error)
}

interface required to join the quai protocol network

Directories

Path Synopsis
Package mock_protocol is a generated GoMock package.
Package mock_protocol is a generated GoMock package.

Jump to

Keyboard shortcuts

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