routing: introduce routing hints to lightning payments
In this commit, we add a new field of routing hints to payments over the Lightning Network. These routing hints can later be used within the path finding algorithm in order to craft a path that will reach the destination succesfully.
This commit is contained in:
parent
c8abeb46a5
commit
1e5659e5f4
@ -28,6 +28,28 @@ const (
|
|||||||
infinity = math.MaxInt64
|
infinity = math.MaxInt64
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// HopHint is a routing hint that contains the minimum information of a channel
|
||||||
|
// required for an intermediate hop in a route to forward the payment to the
|
||||||
|
// next. This should be ideally used for private channels, since they are not
|
||||||
|
// publicly advertised to the network for routing.
|
||||||
|
type HopHint struct {
|
||||||
|
// NodeID is the public key of the node at the start of the channel.
|
||||||
|
NodeID *btcec.PublicKey
|
||||||
|
|
||||||
|
// ChannelID is the unique identifier of the channel.
|
||||||
|
ChannelID uint64
|
||||||
|
|
||||||
|
// FeeBaseMSat is the base fee of the channel in millisatoshis.
|
||||||
|
FeeBaseMSat uint32
|
||||||
|
|
||||||
|
// FeeProportionalMillionths is the fee rate, in millionths of a
|
||||||
|
// satoshi, for every satoshi sent through the channel.
|
||||||
|
FeeProportionalMillionths uint32
|
||||||
|
|
||||||
|
// CLTVExpiryDelta is the time-lock delta of the channel.
|
||||||
|
CLTVExpiryDelta uint16
|
||||||
|
}
|
||||||
|
|
||||||
// ChannelHop is an intermediate hop within the network with a greater
|
// ChannelHop is an intermediate hop within the network with a greater
|
||||||
// multi-hop payment route. This struct contains the relevant routing policy of
|
// multi-hop payment route. This struct contains the relevant routing policy of
|
||||||
// the particular edge, as well as the total capacity, and origin chain of the
|
// the particular edge, as well as the total capacity, and origin chain of the
|
||||||
|
@ -1482,6 +1482,16 @@ type LightningPayment struct {
|
|||||||
// indefinitely.
|
// indefinitely.
|
||||||
PayAttemptTimeout time.Duration
|
PayAttemptTimeout time.Duration
|
||||||
|
|
||||||
|
// RouteHints represents the different routing hints that can be used to
|
||||||
|
// assist a payment in reaching its destination successfully. These
|
||||||
|
// hints will act as intermediate hops along the route.
|
||||||
|
//
|
||||||
|
// NOTE: This is optional unless required by the payment. When providing
|
||||||
|
// multiple routes, ensure the hop hints within each route are chained
|
||||||
|
// together and sorted in forward order in order to reach the
|
||||||
|
// destination successfully.
|
||||||
|
RouteHints [][]HopHint
|
||||||
|
|
||||||
// TODO(roasbeef): add e2e message?
|
// TODO(roasbeef): add e2e message?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user