Versions in this module Expand all Collapse all v0 v0.0.3 Sep 11, 2024 Changes in this version + const AprioriEstimatorName + const BimodalEstimatorName + const BimodalScaleMsatMax + const BlockPadding + const DefaultAprioriWeight + const DefaultBimodalDecayTime + const DefaultBimodalNodeWeight + const DefaultBimodalScaleMsat + const DefaultCapacityFraction + const DefaultChannelPruneExpiry + const DefaultFeeEstimationTimeout + const DefaultFirstTimePruneDelay + const DefaultMaxMcHistory + const DefaultMcFlushInterval + const DefaultMinFailureRelaxInterval + const DefaultPayAttemptTimeout + const DefaultPenaltyHalfLife + const ErrChannelSpent + const ErrIgnored + const ErrInvalidFundingOutput + const ErrNoFundingTransaction + const ErrOutdated + const ErrParentValidationFailed + const ErrVBarrierShuttingDown + const MaxCLTVDelta + const MinCLTVDelta + const RiskFactorBillionths + const Subsystem + var DefaultAprioriHopProbability = float64(0.6) + var DefaultAttemptCost = lnwire.NewMSatFromSatoshis(100) + var DefaultAttemptCostPPM = int64(1000) + var DefaultEstimator = AprioriEstimatorName + var DefaultMinRouteProbability = float64(0.01) + var DefaultShardMinAmt = lnwire.NewMSatFromSatoshis(10000) + var ErrExpiryAndBlinded = errors.New(...) + var ErrHTLCRestrictions = errors.New("invalid htlc minimum and maximum") + var ErrHintsAndBlinded = errors.New(...) + var ErrInsufficientBlindedHops = errors.New(...) + var ErrInvalidAprioriWeight = errors.New("apriori weight must be in [0, 1]") + var ErrInvalidCapacityFraction = fmt.Errorf(..., minCapacityFraction) + var ErrInvalidDecayTime = errors.New("decay time must be larger than zero") + var ErrInvalidFailureInterval = errors.New("failure interval must be >= 0") + var ErrInvalidHalflife = errors.New("penalty half life must be >= 0") + var ErrInvalidHopProbability = errors.New(...) + var ErrInvalidMcHistory = errors.New(...) + var ErrInvalidNodeWeight = errors.New("node weight must be in [0, 1]") + var ErrInvalidScale = errors.New("scale must be >= 0 and sane") + var ErrNoBlindedPath = errors.New("blinded path required") + var ErrNoPayLoadSizeFunc = errors.New(...) + var ErrNoTarget = errors.New(...) + var ErrPaymentLifecycleExiting = errors.New("payment lifecycle exiting") + var ErrRouterShuttingDown = fmt.Errorf("router shutting down") + var ErrSelfIntro = errors.New(...) + var ErrSkipTempErr = errors.New("cannot skip temp error for non-MPP") + var ErrTargetAndBlinded = errors.New(...) + var ErrZeroCapacity = errors.New("capacity must be larger than zero") + func DisableLog() + func EncodeHexColor(color color.RGBA) string + func IsError(e interface{}, codes ...errorCode) bool + func RouteHintsToEdges(routeHints [][]zpay32.HopHint, target route.Vertex) (map[route.Vertex][]AdditionalEdge, error) + func UseLogger(logger btclog.Logger) + func ValidateCLTVLimit(limit uint32, delta uint16, includePad bool) error + func ValidateChannelAnn(a *lnwire.ChannelAnnouncement) error + func ValidateChannelUpdateAnn(pubKey *btcec.PublicKey, capacity btcutil.Amount, a *lnwire.ChannelUpdate) error + func ValidateChannelUpdateFields(capacity btcutil.Amount, msg *lnwire.ChannelUpdate) error + func ValidateNodeAnn(a *lnwire.NodeAnnouncement) error + func VerifyChannelUpdateSignature(msg *lnwire.ChannelUpdate, pubKey *btcec.PublicKey) error + type AMPOptions struct + RootShare [32]byte + SetID [32]byte + type AdditionalEdge interface + EdgePolicy func() *models.CachedEdgePolicy + IntermediatePayloadSize func(amount lnwire.MilliSatoshi, expiry uint32, legacy bool, channelID uint64) uint64 + type AprioriConfig struct + AprioriHopProbability float64 + AprioriWeight float64 + CapacityFraction float64 + PenaltyHalfLife time.Duration + func DefaultAprioriConfig() AprioriConfig + type AprioriEstimator struct + func NewAprioriEstimator(cfg AprioriConfig) (*AprioriEstimator, error) + func (p *AprioriEstimator) Config() estimatorConfig + func (p *AprioriEstimator) LocalPairProbability(now time.Time, results NodeResults, toNode route.Vertex) float64 + func (p *AprioriEstimator) PairProbability(now time.Time, results NodeResults, toNode route.Vertex, ...) float64 + func (p *AprioriEstimator) String() string + type BimodalConfig struct + BimodalDecayTime time.Duration + BimodalNodeWeight float64 + BimodalScaleMsat lnwire.MilliSatoshi + func DefaultBimodalConfig() BimodalConfig + type BimodalEstimator struct + func NewBimodalEstimator(cfg BimodalConfig) (*BimodalEstimator, error) + func (p *BimodalEstimator) Config() estimatorConfig + func (p *BimodalEstimator) LocalPairProbability(now time.Time, results NodeResults, toNode route.Vertex) float64 + func (p *BimodalEstimator) PairProbability(now time.Time, results NodeResults, toNode route.Vertex, ...) float64 + func (p *BimodalEstimator) String() string + type BlindedEdge struct + func (b *BlindedEdge) EdgePolicy() *models.CachedEdgePolicy + func (b *BlindedEdge) IntermediatePayloadSize(_ lnwire.MilliSatoshi, _ uint32, _ bool, _ uint64) uint64 + type BlindedPayment struct + BaseFee uint32 + BlindedPath *sphinx.BlindedPath + CltvExpiryDelta uint16 + Features *lnwire.FeatureVector + HtlcMaximum uint64 + HtlcMinimum uint64 + ProportionalFeeRate uint32 + func (b *BlindedPayment) Validate() error + type CachedGraph struct + func NewCachedGraph(sourceNode *channeldb.LightningNode, graph *channeldb.ChannelGraph) (*CachedGraph, error) + func (g *CachedGraph) Close() error + func (g *CachedGraph) FetchAmountPairCapacity(nodeFrom, nodeTo route.Vertex, amount lnwire.MilliSatoshi) (btcutil.Amount, error) + type ChannelEdgeUpdate struct + AdvertisingNode *btcec.PublicKey + BaseFee lnwire.MilliSatoshi + Capacity btcutil.Amount + ChanID uint64 + ChanPoint wire.OutPoint + ConnectingNode *btcec.PublicKey + Disabled bool + FeeRate lnwire.MilliSatoshi + MaxHTLC lnwire.MilliSatoshi + MinHTLC lnwire.MilliSatoshi + TimeLockDelta uint16 + type ChannelGraphSource interface + AddEdge func(edge *models.ChannelEdgeInfo, op ...batch.SchedulerOption) error + AddNode func(node *channeldb.LightningNode, op ...batch.SchedulerOption) error + AddProof func(chanID lnwire.ShortChannelID, proof *models.ChannelAuthProof) error + CurrentBlockHeight func() (uint32, error) + FetchLightningNode func(route.Vertex) (*channeldb.LightningNode, error) + ForAllOutgoingChannels func(...) error + ForEachNode func(func(node *channeldb.LightningNode) error) error + GetChannelByID func(chanID lnwire.ShortChannelID) (*models.ChannelEdgeInfo, *models.ChannelEdgePolicy, *models.ChannelEdgePolicy, ...) + IsKnownEdge func(chanID lnwire.ShortChannelID) bool + IsPublicNode func(node route.Vertex) (bool, error) + IsStaleEdgePolicy func(chanID lnwire.ShortChannelID, timestamp time.Time, ...) bool + IsStaleNode func(node route.Vertex, timestamp time.Time) bool + MarkEdgeLive func(chanID lnwire.ShortChannelID) error + UpdateEdge func(policy *models.ChannelEdgePolicy, op ...batch.SchedulerOption) error + type ChannelPolicy struct + MaxHTLC lnwire.MilliSatoshi + MinHTLC *lnwire.MilliSatoshi + TimeLockDelta uint32 + type ChannelRouter struct + func New(cfg Config) (*ChannelRouter, error) + func (r *ChannelRouter) AddEdge(edge *models.ChannelEdgeInfo, op ...batch.SchedulerOption) error + func (r *ChannelRouter) AddNode(node *channeldb.LightningNode, op ...batch.SchedulerOption) error + func (r *ChannelRouter) AddProof(chanID lnwire.ShortChannelID, proof *models.ChannelAuthProof) error + func (r *ChannelRouter) BuildRoute(amt *lnwire.MilliSatoshi, hops []route.Vertex, outgoingChan *uint64, ...) (*route.Route, error) + func (r *ChannelRouter) CurrentBlockHeight() (uint32, error) + func (r *ChannelRouter) FetchLightningNode(node route.Vertex) (*channeldb.LightningNode, error) + func (r *ChannelRouter) FindRoute(req *RouteRequest) (*route.Route, float64, error) + func (r *ChannelRouter) ForAllOutgoingChannels(cb func(kvdb.RTx, *models.ChannelEdgeInfo, *models.ChannelEdgePolicy) error) error + func (r *ChannelRouter) ForEachNode(cb func(*channeldb.LightningNode) error) error + func (r *ChannelRouter) GetChannelByID(chanID lnwire.ShortChannelID) (*models.ChannelEdgeInfo, *models.ChannelEdgePolicy, *models.ChannelEdgePolicy, ...) + func (r *ChannelRouter) IsKnownEdge(chanID lnwire.ShortChannelID) bool + func (r *ChannelRouter) IsPublicNode(node route.Vertex) (bool, error) + func (r *ChannelRouter) IsStaleEdgePolicy(chanID lnwire.ShortChannelID, timestamp time.Time, ...) bool + func (r *ChannelRouter) IsStaleNode(node route.Vertex, timestamp time.Time) bool + func (r *ChannelRouter) IsZombieChannel(updateTime1, updateTime2 time.Time) bool + func (r *ChannelRouter) MarkEdgeLive(chanID lnwire.ShortChannelID) error + func (r *ChannelRouter) PreparePayment(payment *LightningPayment) (PaymentSession, shards.ShardTracker, error) + func (r *ChannelRouter) SendPayment(payment *LightningPayment) ([32]byte, *route.Route, error) + func (r *ChannelRouter) SendPaymentAsync(payment *LightningPayment, ps PaymentSession, st shards.ShardTracker) + func (r *ChannelRouter) SendToRoute(htlcHash lntypes.Hash, rt *route.Route) (*channeldb.HTLCAttempt, error) + func (r *ChannelRouter) SendToRouteSkipTempErr(htlcHash lntypes.Hash, rt *route.Route) (*channeldb.HTLCAttempt, error) + func (r *ChannelRouter) Start() error + func (r *ChannelRouter) Stop() error + func (r *ChannelRouter) SubscribeTopology() (*TopologyClient, error) + func (r *ChannelRouter) SyncedHeight() uint32 + func (r *ChannelRouter) UpdateEdge(update *models.ChannelEdgePolicy, op ...batch.SchedulerOption) error + type ClosedChanSummary struct + Capacity btcutil.Amount + ChanID uint64 + ChanPoint wire.OutPoint + ClosedHeight uint32 + type Config struct + AssumeChannelValid bool + Chain lnwallet.BlockChainIO + ChainView chainview.FilteredChainView + ChannelPruneExpiry time.Duration + Clock clock.Clock + Control ControlTower + FirstTimePruneDelay time.Duration + GetLink getLinkQuery + Graph *channeldb.ChannelGraph + GraphPruneInterval time.Duration + IsAlias func(scid lnwire.ShortChannelID) bool + MissionControl MissionController + NextPaymentID func() (uint64, error) + Notifier chainntnfs.ChainNotifier + PathFindingConfig PathFindingConfig + Payer PaymentAttemptDispatcher + SessionSource PaymentSessionSource + StrictZombiePruning bool + type ControlTower interface + DeleteFailedAttempts func(lntypes.Hash) error + FailAttempt func(lntypes.Hash, uint64, *channeldb.HTLCFailInfo) (*channeldb.HTLCAttempt, error) + FailPayment func(lntypes.Hash, channeldb.FailureReason) error + FetchInFlightPayments func() ([]*channeldb.MPPayment, error) + FetchPayment func(paymentHash lntypes.Hash) (dbMPPayment, error) + InitPayment func(lntypes.Hash, *channeldb.PaymentCreationInfo) error + RegisterAttempt func(lntypes.Hash, *channeldb.HTLCAttemptInfo) error + SettleAttempt func(lntypes.Hash, uint64, *channeldb.HTLCSettleInfo) (*channeldb.HTLCAttempt, error) + SubscribeAllPayments func() (ControlTowerSubscriber, error) + SubscribePayment func(paymentHash lntypes.Hash) (ControlTowerSubscriber, error) + func NewControlTower(db *channeldb.PaymentControl) ControlTower + type ControlTowerSubscriber interface + Close func() + Updates func() <-chan interface{} + type DirectedNodePair struct + From route.Vertex + To route.Vertex + func NewDirectedNodePair(from, to route.Vertex) DirectedNodePair + func (d DirectedNodePair) Reverse() DirectedNodePair + func (d DirectedNodePair) String() string + type EdgeLocator struct + ChannelID uint64 + Direction uint8 + func (e *EdgeLocator) String() string + type ErrNoChannel struct + func (e ErrNoChannel) Error() string + type Estimator interface + Config func() estimatorConfig + LocalPairProbability func(now time.Time, results NodeResults, toNode route.Vertex) float64 + PairProbability func(now time.Time, results NodeResults, toNode route.Vertex, ...) float64 + String func() string + type FeeSchema struct + BaseFee lnwire.MilliSatoshi + FeeRate uint32 + InboundFee models.InboundFee + type LightningPayment struct + Amount lnwire.MilliSatoshi + CltvLimit uint32 + DestCustomRecords record.CustomSet + DestFeatures *lnwire.FeatureVector + FeeLimit lnwire.MilliSatoshi + FinalCLTVDelta uint16 + LastHop *route.Vertex + MaxParts uint32 + MaxShardAmt *lnwire.MilliSatoshi + Metadata []byte + OutgoingChannelIDs []uint64 + PayAttemptTimeout time.Duration + PaymentAddr *[32]byte + PaymentRequest []byte + RouteHints [][]zpay32.HopHint + Target route.Vertex + TimePref float64 + func (l *LightningPayment) Identifier() [32]byte + func (l *LightningPayment) SetAMP(amp *AMPOptions) error + func (l *LightningPayment) SetPaymentHash(hash lntypes.Hash) error + type MissionControl struct + func NewMissionControl(db kvdb.Backend, self route.Vertex, cfg *MissionControlConfig) (*MissionControl, error) + func (m *MissionControl) GetConfig() *MissionControlConfig + func (m *MissionControl) GetHistorySnapshot() *MissionControlSnapshot + func (m *MissionControl) GetPairHistorySnapshot(fromNode, toNode route.Vertex) TimedPairResult + func (m *MissionControl) GetProbability(fromNode, toNode route.Vertex, amt lnwire.MilliSatoshi, ...) float64 + func (m *MissionControl) ImportHistory(history *MissionControlSnapshot, force bool) error + func (m *MissionControl) ReportPaymentFail(paymentID uint64, rt *route.Route, failureSourceIdx *int, ...) (*channeldb.FailureReason, error) + func (m *MissionControl) ReportPaymentSuccess(paymentID uint64, rt *route.Route) error + func (m *MissionControl) ResetHistory() error + func (m *MissionControl) RunStoreTicker() + func (m *MissionControl) SetConfig(cfg *MissionControlConfig) error + func (m *MissionControl) StopStoreTicker() + type MissionControlConfig struct + Estimator Estimator + MaxMcHistory int + McFlushInterval time.Duration + MinFailureRelaxInterval time.Duration + func (c *MissionControlConfig) String() string + type MissionControlPairSnapshot struct + Pair DirectedNodePair + type MissionControlSnapshot struct + Pairs []MissionControlPairSnapshot + type MissionController interface + GetProbability func(fromNode, toNode route.Vertex, amt lnwire.MilliSatoshi, ...) float64 + ReportPaymentFail func(attemptID uint64, rt *route.Route, failureSourceIdx *int, ...) (*channeldb.FailureReason, error) + ReportPaymentSuccess func(attemptID uint64, rt *route.Route) error + type NetworkNodeUpdate struct + Addresses []net.Addr + Alias string + Color string + Features *lnwire.FeatureVector + IdentityKey *btcec.PublicKey + type NodeResults map[route.Vertex]TimedPairResult + type PathFindingConfig struct + AttemptCost lnwire.MilliSatoshi + AttemptCostPPM int64 + MinProbability float64 + type PayloadSizeFunc func(amount lnwire.MilliSatoshi, expiry uint32, legacy bool, channelID uint64) uint64 + type PaymentAttemptDispatcher interface + CleanStore func(keepPids map[uint64]struct{}) error + GetAttemptResult func(attemptID uint64, paymentHash lntypes.Hash, ...) (<-chan *htlcswitch.PaymentResult, error) + SendHTLC func(firstHop lnwire.ShortChannelID, attemptID uint64, ...) error + type PaymentSession interface + GetAdditionalEdgePolicy func(pubKey *btcec.PublicKey, channelID uint64) *models.CachedEdgePolicy + RequestRoute func(maxAmt, feeLimit lnwire.MilliSatoshi, activeShards, height uint32) (*route.Route, error) + UpdateAdditionalEdge func(msg *lnwire.ChannelUpdate, pubKey *btcec.PublicKey, ...) bool + type PaymentSessionSource interface + NewPaymentSession func(p *LightningPayment) (PaymentSession, error) + NewPaymentSessionEmpty func() PaymentSession + type PrivateEdge struct + func (p *PrivateEdge) EdgePolicy() *models.CachedEdgePolicy + func (p *PrivateEdge) IntermediatePayloadSize(amount lnwire.MilliSatoshi, expiry uint32, legacy bool, channelID uint64) uint64 + type RestrictParams struct + Amp *AMPOptions + BlindedPayment *BlindedPayment + CltvLimit uint32 + DestCustomRecords record.CustomSet + DestFeatures *lnwire.FeatureVector + FeeLimit lnwire.MilliSatoshi + LastHop *route.Vertex + Metadata []byte + OutgoingChannelIDs []uint64 + PaymentAddr *[32]byte + ProbabilitySource func(route.Vertex, route.Vertex, lnwire.MilliSatoshi, btcutil.Amount) float64 + type RouteHints map[route.Vertex][]AdditionalEdge + type RouteRequest struct + Amount lnwire.MilliSatoshi + BlindedPayment *BlindedPayment + CustomRecords record.CustomSet + FinalExpiry uint16 + Restrictions *RestrictParams + RouteHints RouteHints + Source route.Vertex + Target route.Vertex + TimePreference float64 + func NewRouteRequest(source route.Vertex, target *route.Vertex, amount lnwire.MilliSatoshi, ...) (*RouteRequest, error) + type SessionSource struct + GetLink getLinkQuery + Graph *channeldb.ChannelGraph + MissionControl MissionController + PathFindingConfig PathFindingConfig + SourceNode *channeldb.LightningNode + func (m *SessionSource) NewPaymentSession(p *LightningPayment) (PaymentSession, error) + func (m *SessionSource) NewPaymentSessionEmpty() PaymentSession + type TimedPairResult struct + FailAmt lnwire.MilliSatoshi + FailTime time.Time + SuccessAmt lnwire.MilliSatoshi + SuccessTime time.Time + type TopologyChange struct + ChannelEdgeUpdates []*ChannelEdgeUpdate + ClosedChannels []*ClosedChanSummary + NodeUpdates []*NetworkNodeUpdate + type TopologyClient struct + Cancel func() + TopologyChanges <-chan *TopologyChange + type ValidationBarrier struct + func NewValidationBarrier(numActiveReqs int, quitChan chan struct{}) *ValidationBarrier + func (v *ValidationBarrier) CompleteJob() + func (v *ValidationBarrier) InitJobDependencies(job interface{}) + func (v *ValidationBarrier) SignalDependants(job interface{}, allow bool) + func (v *ValidationBarrier) WaitForDependants(job interface{}) error