protocol

package
v0.39.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

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

	// Block height before which the prior major release will be tolerated
	//
	// For example, if the current protocol version is `quai/9.1.2`, and
	// `ProtocolGraceHeight` is 10000000, then peers running any `quai/9.X.X`
	// protocol version will still be tolerated. After the grace period is over,
	// peers running a protocol less than `quai/9.0.0` will not be tolerated.
	//
	// Note, in this example, peers below `quai/8.0.0` are not tolerated even
	// during the grace period.
	ProtocolGraceHeight uint64 = 40000
)
View Source
const (
	C_NumPrimeBlocksToDownload = 10
)

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(ctx context.Context, 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
	GetHeight(location common.Location) uint64
	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