routes

package
v0.0.0-...-a596a23 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const Subsystem = "B12-RTE"

Subsystem defines the logging code for this subsystem.

Variables

View Source
var (
	// ErrNoChannels is returned when we don't have any open channels, so
	// won't be reachable by onion message.
	ErrNoChannels = errors.New("can't create blinded route with no " +
		"channels")

	// ErrNoPeerChannels is returned when a peer does not have any public
	// channels, so it can't be used to relay onion messages.
	ErrNoPeerChannels = errors.New("peer has no channels")

	// ErrNoNodeInfo is returned when we don't have node information
	// available for a peer (graph sync is imperfect).
	ErrNoNodeInfo = errors.New("no node information available")

	// ErrFeatureMismatch is returned when a peer doesn't have the feautres
	// we need for onion relay.
	ErrFeatureMismatch = errors.New("insufficient node features")

	// ErrNoRelayingPeers is returned when we have no peers that are
	// eligible for inclusion in a route with the feature set we require.
	ErrNoRelayingPeers = errors.New("no relaying peers")

	// ErrNoPath is returned when a request for a blinded route doesn't
	// have sufficient hops.
	ErrNoPath = errors.New("at least one hop required in route request")

	// ErrSessionKeyRequired is returned when a session key is missing from
	// a routes request.
	ErrSessionKeyRequired = errors.New("session key required")

	// ErrBlindingKeyRequired is returned when a blinding key is missing
	// from a routes request.
	ErrBlindingKeyRequired = errors.New("blinding key required")

	// ErrNoIntroductionNode is returned when our introduction node is not
	// the final hop in a path provided for a send to a blinded route.
	ErrNoIntroductionNode = errors.New("introduction node should be " +
		"final hop when sending to a blinded path")
)

Functions

func DisableLog

func DisableLog()

DisableLog disables all library log output. Logging output is disabled by default until UseLogger is called.

func UseLogger

func UseLogger(logger btclog.Logger)

UseLogger uses a specified Logger to output package logging info. This should be used in preference to SetLogWriter if the caller is also using btclog.

Types

type BlindedRouteGenerator

type BlindedRouteGenerator struct {
	// contains filtered or unexported fields
}

BlindedRouteGenerator produces blinded routes.

func NewBlindedRouteGenerator

func NewBlindedRouteGenerator(lnd Lnd,
	pubkey *btcec.PublicKey) *BlindedRouteGenerator

NewBlindedRouteGenerator creates a blinded route generator.

func (*BlindedRouteGenerator) ReplyPath

func (b *BlindedRouteGenerator) ReplyPath(ctx context.Context,
	features []lndwire.FeatureBit) (*sphinx.BlindedPath, error)

ReplyPath produces a blinded route to our node with the set of features requested.

type BlindedRouteRequest

type BlindedRouteRequest struct {
	// contains filtered or unexported fields
}

BlindedRouteRequest contains a request to produce a blinded route.

func NewBlindedRouteRequest

func NewBlindedRouteRequest(sessionKey, blindingKey *btcec.PrivateKey,
	hops []*btcec.PublicKey, replyPath, blindedDest *lnwire.ReplyPath,
	finalPayloads []*lnwire.FinalHopPayload) *BlindedRouteRequest

NewBlindedRouteRequest produces a request to create a blinded path.

type BlindedRouteResponse

type BlindedRouteResponse struct {
	// OnionMessage is the onion message to be sent on the wire.
	OnionMessage *lnwire.OnionMessage

	// FirstNode is the unblinded public key of the node that the onion
	// message should be sent to.
	FirstNode *btcec.PublicKey
}

BlindedRouteRequest contains the output of a request for a blinded route.

func CreateBlindedRoute

func CreateBlindedRoute(req *BlindedRouteRequest) (*BlindedRouteResponse,
	error)

CreateBlindedRoute creates a blinded route from the request provided.

type Generator

type Generator interface {
	// ReplyPath produces a blinded route to our node with the set of
	// features requested.
	ReplyPath(ctx context.Context,
		features []lndwire.FeatureBit) (*sphinx.BlindedPath, error)
}

Generator is an interface implemented by blinded route producers.

type Lnd

type Lnd interface {
	// ListChannels lists our current set of channels.
	ListChannels(ctx context.Context, activeOnly,
		publicOnly bool) ([]lndclient.ChannelInfo, error)

	// GetNodeInfo looks up a node in the public ln graph.
	GetNodeInfo(ctx context.Context, pubkey route.Vertex,
		includeChannels bool) (*lndclient.NodeInfo, error)
}

Lnd describes the lnd dependencies required to find a route.

Jump to

Keyboard shortcuts

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