blockrelay

package
v0.0.0-...-1693796 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2024 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HandleIBD

func HandleIBD(context IBDContext, incomingRoute *router.Route, outgoingRoute *router.Route,
	peer *peerpkg.Peer) error

HandleIBD handles IBD

func HandleIBDBlockLocator

func HandleIBDBlockLocator(context HandleIBDBlockLocatorContext, incomingRoute *router.Route,
	outgoingRoute *router.Route, peer *peer.Peer) error

HandleIBDBlockLocator listens to appmessage.MsgIBDBlockLocator messages and sends the highest known block that's in the selected parent chain of `targetHash` to the requesting peer.

func HandleIBDBlockRequests

func HandleIBDBlockRequests(context HandleIBDBlockRequestsContext, incomingRoute *router.Route,
	outgoingRoute *router.Route) error

HandleIBDBlockRequests listens to appmessage.MsgRequestRelayBlocks messages and sends their corresponding blocks to the requesting peer.

func HandlePruningPointAndItsAnticoneRequests

func HandlePruningPointAndItsAnticoneRequests(context PruningPointAndItsAnticoneRequestsContext, incomingRoute *router.Route,
	outgoingRoute *router.Route, peer *peerpkg.Peer) error

HandlePruningPointAndItsAnticoneRequests listens to appmessage.MsgRequestPruningPointAndItsAnticone messages and sends the pruning point and its anticone to the requesting peer.

func HandleRelayBlockRequests

func HandleRelayBlockRequests(context RelayBlockRequestsContext, incomingRoute *router.Route,
	outgoingRoute *router.Route, peer *peerpkg.Peer) error

HandleRelayBlockRequests listens to appmessage.MsgRequestRelayBlocks messages and sends their corresponding blocks to the requesting peer.

func HandleRelayInvs

func HandleRelayInvs(context RelayInvsContext, incomingRoute *router.Route, outgoingRoute *router.Route,
	peer *peerpkg.Peer) error

HandleRelayInvs listens to appmessage.MsgInvRelayBlock messages, requests their corresponding blocks if they are missing, adds them to the DAG and propagates them to the rest of the network.

func HandleRequestAnticone

func HandleRequestAnticone(context RequestAnticoneContext, incomingRoute *router.Route,
	outgoingRoute *router.Route, peer *peer.Peer) error

HandleRequestAnticone handles RequestAnticone messages

func HandleRequestBlockLocator

func HandleRequestBlockLocator(context RequestBlockLocatorContext, incomingRoute *router.Route,
	outgoingRoute *router.Route) error

HandleRequestBlockLocator handles getBlockLocator messages

func HandleRequestHeaders

func HandleRequestHeaders(context RequestHeadersContext, incomingRoute *router.Route,
	outgoingRoute *router.Route, peer *peer.Peer) error

HandleRequestHeaders handles RequestHeaders messages

func HandleRequestIBDChainBlockLocator

func HandleRequestIBDChainBlockLocator(context RequestIBDChainBlockLocatorContext, incomingRoute *router.Route,
	outgoingRoute *router.Route) error

HandleRequestIBDChainBlockLocator handles getBlockLocator messages

func HandleRequestPruningPointUTXOSet

func HandleRequestPruningPointUTXOSet(context HandleRequestPruningPointUTXOSetContext, incomingRoute,
	outgoingRoute *router.Route) error

HandleRequestPruningPointUTXOSet listens to appmessage.MsgRequestPruningPointUTXOSet messages and sends the pruning point UTXO set and block body.

func SendVirtualSelectedParentInv

func SendVirtualSelectedParentInv(context SendVirtualSelectedParentInvContext,
	outgoingRoute *router.Route, peer *peerpkg.Peer) error

SendVirtualSelectedParentInv sends a peer the selected parent hash of the virtual

Types

type HandleIBDBlockLocatorContext

type HandleIBDBlockLocatorContext interface {
	Domain() domain.Domain
}

HandleIBDBlockLocatorContext is the interface for the context needed for the HandleIBDBlockLocator flow.

type HandleIBDBlockRequestsContext

type HandleIBDBlockRequestsContext interface {
	Domain() domain.Domain
}

HandleIBDBlockRequestsContext is the interface for the context needed for the HandleIBDBlockRequests flow.

type HandleRequestPruningPointUTXOSetContext

type HandleRequestPruningPointUTXOSetContext interface {
	Domain() domain.Domain
}

HandleRequestPruningPointUTXOSetContext is the interface for the context needed for the HandleRequestPruningPointUTXOSet flow.

type IBDContext

type IBDContext interface {
	Domain() domain.Domain
	Config() *config.Config
	OnNewBlock(block *externalapi.DomainBlock) error
	OnNewBlockTemplate() error
	OnPruningPointUTXOSetOverride() error
	IsIBDRunning() bool
	TrySetIBDRunning(ibdPeer *peerpkg.Peer) bool
	UnsetIBDRunning()
	IsRecoverableError(err error) bool
}

IBDContext is the interface for the context needed for the HandleIBD flow.

type PruningPointAndItsAnticoneRequestsContext

type PruningPointAndItsAnticoneRequestsContext interface {
	Domain() domain.Domain
	Config() *config.Config
}

PruningPointAndItsAnticoneRequestsContext is the interface for the context needed for the HandlePruningPointAndItsAnticoneRequests flow.

type RelayBlockRequestsContext

type RelayBlockRequestsContext interface {
	Domain() domain.Domain
}

RelayBlockRequestsContext is the interface for the context needed for the HandleRelayBlockRequests flow.

type RelayInvsContext

type RelayInvsContext interface {
	Domain() domain.Domain
	Config() *config.Config
	OnNewBlock(block *externalapi.DomainBlock) error
	OnNewBlockTemplate() error
	OnPruningPointUTXOSetOverride() error
	SharedRequestedBlocks() *flowcontext.SharedRequestedBlocks
	Broadcast(message appmessage.Message) error
	AddOrphan(orphanBlock *externalapi.DomainBlock)
	GetOrphanRoots(orphanHash *externalapi.DomainHash) ([]*externalapi.DomainHash, bool, error)
	IsOrphan(blockHash *externalapi.DomainHash) bool
	IsIBDRunning() bool
	IsRecoverableError(err error) bool
	IsNearlySynced() (bool, error)
}

RelayInvsContext is the interface for the context needed for the HandleRelayInvs flow.

type RequestAnticoneContext

type RequestAnticoneContext interface {
	Domain() domain.Domain
	Config() *config.Config
}

RequestAnticoneContext is the interface for the context needed for the HandleRequestHeaders flow.

type RequestBlockLocatorContext

type RequestBlockLocatorContext interface {
	Domain() domain.Domain
}

RequestBlockLocatorContext is the interface for the context needed for the HandleRequestBlockLocator flow.

type RequestHeadersContext

type RequestHeadersContext interface {
	Domain() domain.Domain
}

RequestHeadersContext is the interface for the context needed for the HandleRequestHeaders flow.

type RequestIBDChainBlockLocatorContext

type RequestIBDChainBlockLocatorContext interface {
	Domain() domain.Domain
}

RequestIBDChainBlockLocatorContext is the interface for the context needed for the HandleRequestBlockLocator flow.

type SendVirtualSelectedParentInvContext

type SendVirtualSelectedParentInvContext interface {
	Domain() domain.Domain
	Config() *config.Config
}

SendVirtualSelectedParentInvContext is the interface for the context needed for the SendVirtualSelectedParentInv flow.

Jump to

Keyboard shortcuts

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