transactionrelay

package
v0.11.9 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2021 License: ISC Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HandleRelayedTransactions

func HandleRelayedTransactions(context TransactionsRelayContext, incomingRoute *router.Route, outgoingRoute *router.Route) error

HandleRelayedTransactions listens to appmessage.MsgInvTransaction messages, requests their corresponding transactions if they are missing, adds them to the mempool and propagates them to the rest of the network.

func HandleRequestedTransactions

func HandleRequestedTransactions(context TransactionsRelayContext, incomingRoute *router.Route, outgoingRoute *router.Route) error

HandleRequestedTransactions listens to appmessage.MsgRequestTransactions messages, responding with the requested transactions if those are in the mempool. Missing transactions would be ignored

Types

type SharedRequestedTransactions

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

SharedRequestedTransactions is a data structure that is shared between peers that holds the IDs of all the requested transactions to prevent redundant requests.

func NewSharedRequestedTransactions

func NewSharedRequestedTransactions() *SharedRequestedTransactions

NewSharedRequestedTransactions returns a new instance of SharedRequestedTransactions.

type TransactionsRelayContext

type TransactionsRelayContext interface {
	NetAdapter() *netadapter.NetAdapter
	Domain() domain.Domain
	SharedRequestedTransactions() *SharedRequestedTransactions
	OnTransactionAddedToMempool()
	EnqueueTransactionIDsForPropagation(transactionIDs []*externalapi.DomainTransactionID) error
}

TransactionsRelayContext is the interface for the context needed for the HandleRelayedTransactions and HandleRequestedTransactions flows.

Jump to

Keyboard shortcuts

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