Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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.
Types ¶
type RelayBlockRequestsContext ¶
RelayBlockRequestsContext is the interface for the context needed for the HandleRelayBlockRequests flow.
type RelayInvsContext ¶
type RelayInvsContext interface { NetAdapter() *netadapter.NetAdapter DAG() *blockdag.BlockDAG OnNewBlock(block *util.Block) error StartIBDIfRequired() IsInIBD() bool Broadcast(message appmessage.Message) error }
RelayInvsContext is the interface for the context needed for the HandleRelayInvs flow.
type SharedRequestedBlocks ¶
type SharedRequestedBlocks struct { // 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.