blockrelay

package
v0.9.1-rc1 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2021 License: ISC Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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 HandlePruningPointHashRequests

func HandlePruningPointHashRequests(context HandlePruningPointHashRequestsFlowContext, incomingRoute,
	outgoingRoute *router.Route) error

HandlePruningPointHashRequests listens to appmessage.MsgRequestPruningPointHashMessage messages and sends the pruning point hash as response.

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 HandleRequestBlockLocator

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

HandleRequestBlockLocator handles getBlockLocator messages

func HandleRequestHeaders

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

HandleRequestHeaders handles RequestHeaders messages

func HandleRequestPruningPointUTXOSetAndBlock

func HandleRequestPruningPointUTXOSetAndBlock(context HandleRequestPruningPointUTXOSetAndBlockContext, incomingRoute,
	outgoingRoute *router.Route) error

HandleRequestPruningPointUTXOSetAndBlock listens to appmessage.MsgRequestPruningPointUTXOSetAndBlock 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 HandlePruningPointHashRequestsFlowContext

type HandlePruningPointHashRequestsFlowContext interface {
	Domain() domain.Domain
}

HandlePruningPointHashRequestsFlowContext is the interface for the context needed for the handlePruningPointHashRequestsFlow flow.

type HandleRequestPruningPointUTXOSetAndBlockContext

type HandleRequestPruningPointUTXOSetAndBlockContext interface {
	Domain() domain.Domain
}

HandleRequestPruningPointUTXOSetAndBlockContext is the interface for the context needed for the HandleRequestPruningPointUTXOSetAndBlock 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, blockInsertionResult *externalapi.BlockInsertionResult) error
	OnPruningPointUTXOSetOverride() error
	SharedRequestedBlocks() *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
	TrySetIBDRunning(ibdPeer *peerpkg.Peer) bool
	UnsetIBDRunning()
}

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

type RequestBlockLocatorContext

type RequestBlockLocatorContext interface {
	Domain() domain.Domain
}

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

type RequestIBDBlocksContext

type RequestIBDBlocksContext interface {
	Domain() domain.Domain
}

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

type SendVirtualSelectedParentInvContext

type SendVirtualSelectedParentInvContext interface {
	Domain() domain.Domain
}

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

type SharedRequestedBlocks

type SharedRequestedBlocks struct {
	sync.Mutex
	// contains filtered or unexported fields
}

SharedRequestedBlocks is a data structure that is shared between peers that holds the hashes of all the requested blocks to prevent redundant requests.

func NewSharedRequestedBlocks

func NewSharedRequestedBlocks() *SharedRequestedBlocks

NewSharedRequestedBlocks returns a new instance of SharedRequestedBlocks.

Jump to

Keyboard shortcuts

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