routing+routerrpc: add multiple outgoing channel restriction

This commit is contained in:
Joost Jager 2020-05-07 11:48:39 +02:00
parent 53e4876a1d
commit c33d94ff27
No known key found for this signature in database
GPG Key ID: A61B9D4C393C59C7
11 changed files with 287 additions and 214 deletions

View File

@ -321,7 +321,10 @@ func sendPaymentRequest(ctx *cli.Context,
client := lnrpc.NewLightningClient(conn) client := lnrpc.NewLightningClient(conn)
routerClient := routerrpc.NewRouterClient(conn) routerClient := routerrpc.NewRouterClient(conn)
req.OutgoingChanId = ctx.Uint64("outgoing_chan_id") outChan := ctx.Uint64("outgoing_chan_id")
if outChan != 0 {
req.OutgoingChanIds = []uint64{outChan}
}
if ctx.IsSet(lastHopFlag.Name) { if ctx.IsSet(lastHopFlag.Name) {
lastHop, err := route.NewVertexFromStr( lastHop, err := route.NewVertexFromStr(
ctx.String(lastHopFlag.Name), ctx.String(lastHopFlag.Name),

View File

@ -248,9 +248,14 @@ type SendPaymentRequest struct {
//The fields fee_limit_sat and fee_limit_msat are mutually exclusive. //The fields fee_limit_sat and fee_limit_msat are mutually exclusive.
FeeLimitMsat int64 `protobuf:"varint,13,opt,name=fee_limit_msat,json=feeLimitMsat,proto3" json:"fee_limit_msat,omitempty"` FeeLimitMsat int64 `protobuf:"varint,13,opt,name=fee_limit_msat,json=feeLimitMsat,proto3" json:"fee_limit_msat,omitempty"`
// //
//The channel id of the channel that must be taken to the first hop. If zero, //Deprecated, use outgoing_chan_ids. The channel id of the channel that must
//be taken to the first hop. If zero, any channel may be used (unless
//outgoing_chan_ids are set).
OutgoingChanId uint64 `protobuf:"varint,8,opt,name=outgoing_chan_id,json=outgoingChanId,proto3" json:"outgoing_chan_id,omitempty"` // Deprecated: Do not use.
//
//The channel ids of the channels are allowed for the first hop. If empty,
//any channel may be used. //any channel may be used.
OutgoingChanId uint64 `protobuf:"varint,8,opt,name=outgoing_chan_id,json=outgoingChanId,proto3" json:"outgoing_chan_id,omitempty"` OutgoingChanIds []uint64 `protobuf:"varint,19,rep,packed,name=outgoing_chan_ids,json=outgoingChanIds,proto3" json:"outgoing_chan_ids,omitempty"`
// //
//The pubkey of the last hop of the route. If empty, any hop may be used. //The pubkey of the last hop of the route. If empty, any hop may be used.
LastHopPubkey []byte `protobuf:"bytes,14,opt,name=last_hop_pubkey,json=lastHopPubkey,proto3" json:"last_hop_pubkey,omitempty"` LastHopPubkey []byte `protobuf:"bytes,14,opt,name=last_hop_pubkey,json=lastHopPubkey,proto3" json:"last_hop_pubkey,omitempty"`
@ -379,6 +384,7 @@ func (m *SendPaymentRequest) GetFeeLimitMsat() int64 {
return 0 return 0
} }
// Deprecated: Do not use.
func (m *SendPaymentRequest) GetOutgoingChanId() uint64 { func (m *SendPaymentRequest) GetOutgoingChanId() uint64 {
if m != nil { if m != nil {
return m.OutgoingChanId return m.OutgoingChanId
@ -386,6 +392,13 @@ func (m *SendPaymentRequest) GetOutgoingChanId() uint64 {
return 0 return 0
} }
func (m *SendPaymentRequest) GetOutgoingChanIds() []uint64 {
if m != nil {
return m.OutgoingChanIds
}
return nil
}
func (m *SendPaymentRequest) GetLastHopPubkey() []byte { func (m *SendPaymentRequest) GetLastHopPubkey() []byte {
if m != nil { if m != nil {
return m.LastHopPubkey return m.LastHopPubkey
@ -1746,148 +1759,149 @@ func init() {
func init() { proto.RegisterFile("routerrpc/router.proto", fileDescriptor_7a0613f69d37b0a5) } func init() { proto.RegisterFile("routerrpc/router.proto", fileDescriptor_7a0613f69d37b0a5) }
var fileDescriptor_7a0613f69d37b0a5 = []byte{ var fileDescriptor_7a0613f69d37b0a5 = []byte{
// 2248 bytes of a gzipped FileDescriptorProto // 2268 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x58, 0xcd, 0x76, 0xdb, 0xb8, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x58, 0xcf, 0x77, 0xdb, 0xc6,
0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d0, 0x97, 0x50, 0x5b, 0xea, 0x88, 0x18, 0x30, 0xbf, 0x3c, 0xa1, 0xb4, 0xc7, 0xb1, 0x81, 0xcb, 0xd0, 0x67, 0x50, 0x5b, 0x71, 0x84, 0x8f,
0xab, 0x42, 0xa9, 0x92, 0x2a, 0x89, 0x40, 0x9f, 0x82, 0x16, 0xce, 0xd9, 0x65, 0xe8, 0x06, 0x97, 0x55, 0x41, 0xaa, 0xa4, 0x24, 0xe1, 0xe8, 0x01, 0x68, 0xe1, 0x82, 0x5d, 0x85, 0x5e, 0x70, 0x45,
0x64, 0x34, 0x75, 0x02, 0xe2, 0x8e, 0xeb, 0xc5, 0xa6, 0xd2, 0x52, 0x8f, 0x72, 0xcf, 0x14, 0x5c, 0x46, 0x53, 0x37, 0x20, 0xde, 0x58, 0x2f, 0x36, 0x95, 0x96, 0x7a, 0xac, 0xea, 0xca, 0x53, 0x05,
0x4b, 0x65, 0x9d, 0xa9, 0x13, 0x98, 0x63, 0xf4, 0x08, 0xb6, 0x3c, 0x27, 0x66, 0x64, 0x1a, 0xce, 0xd7, 0x52, 0x69, 0x67, 0xea, 0x06, 0xd6, 0x18, 0x3d, 0x81, 0xdd, 0xdb, 0xfc, 0x58, 0xaf, 0x37,
0xc8, 0x6c, 0x7e, 0x71, 0x45, 0xaf, 0xeb, 0x35, 0xb1, 0x33, 0x55, 0x0e, 0x9f, 0x84, 0xb3, 0xbe, 0xf3, 0x2d, 0x15, 0xef, 0xac, 0x53, 0x63, 0xf4, 0x18, 0x76, 0x7c, 0x37, 0x66, 0x64, 0x1a, 0xce,
0x00, 0xd1, 0x43, 0x00, 0xb1, 0x2b, 0x62, 0xf1, 0x7a, 0x49, 0xc4, 0x50, 0xe2, 0x88, 0x58, 0x18, 0xc9, 0x7c, 0x71, 0x79, 0x4d, 0x6f, 0xf4, 0x9a, 0xd8, 0xc7, 0x2a, 0x87, 0x4f, 0xc3, 0x79, 0x5f,
0x7d, 0x03, 0x65, 0x91, 0x4d, 0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3, 0xff, 0x04, 0x00, 0x00, 0xff, 0xff, 0xb3, 0x43, 0xf1, 0x4b, 0x46, 0xe0, 0x05, 0x57, 0x01, 0x65, 0x6f, 0xc3, 0xe8, 0xfa, 0xd0, 0x0f,
0x16, 0x00, 0xbc, 0x19, 0xca, 0x14, 0x00, 0x00, 0xc6, 0x87, 0xa2, 0x6e, 0x0e, 0x97, 0x7a, 0x2e, 0xb7, 0xc4, 0x0f, 0x99, 0x3f, 0xfd, 0x4f, 0x00,
0x00, 0x00, 0xff, 0xff, 0x61, 0x45, 0xd3, 0x59, 0xf8, 0x14, 0x00, 0x00,
} }
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.

View File

@ -154,10 +154,17 @@ message SendPaymentRequest {
int64 fee_limit_msat = 13; int64 fee_limit_msat = 13;
/* /*
The channel id of the channel that must be taken to the first hop. If zero, Deprecated, use outgoing_chan_ids. The channel id of the channel that must
be taken to the first hop. If zero, any channel may be used (unless
outgoing_chan_ids are set).
*/
uint64 outgoing_chan_id = 8 [jstype = JS_STRING, deprecated = true];
/*
The channel ids of the channels are allowed for the first hop. If empty,
any channel may be used. any channel may be used.
*/ */
uint64 outgoing_chan_id = 8 [jstype = JS_STRING]; repeated uint64 outgoing_chan_ids = 19;
/* /*
The pubkey of the last hop of the route. If empty, any hop may be used. The pubkey of the last hop of the route. If empty, any hop may be used.

View File

@ -248,7 +248,7 @@ func (r *RouterBackend) QueryRoutes(ctx context.Context,
// Pass along an outgoing channel restriction if specified. // Pass along an outgoing channel restriction if specified.
if in.OutgoingChanId != 0 { if in.OutgoingChanId != 0 {
restrictions.OutgoingChannelID = &in.OutgoingChanId restrictions.OutgoingChannelIDs = []uint64{in.OutgoingChanId}
} }
// Pass along a last hop restriction if specified. // Pass along a last hop restriction if specified.
@ -522,9 +522,19 @@ func (r *RouterBackend) extractIntentFromSendRequest(
payIntent := &routing.LightningPayment{} payIntent := &routing.LightningPayment{}
// Pass along an outgoing channel restriction if specified. // Pass along restrictions on the outgoing channels that may be used.
payIntent.OutgoingChannelIDs = rpcPayReq.OutgoingChanIds
// Add the deprecated single outgoing channel restriction if present.
if rpcPayReq.OutgoingChanId != 0 { if rpcPayReq.OutgoingChanId != 0 {
payIntent.OutgoingChannelID = &rpcPayReq.OutgoingChanId if payIntent.OutgoingChannelIDs != nil {
return nil, errors.New("outgoing_chan_id and " +
"outgoing_chan_ids are mutually exclusive")
}
payIntent.OutgoingChannelIDs = append(
payIntent.OutgoingChannelIDs, rpcPayReq.OutgoingChanId,
)
} }
// Pass along a last hop restriction if specified. // Pass along a last hop restriction if specified.

View File

@ -159,7 +159,7 @@ func testQueryRoutes(t *testing.T, useMissionControl bool, useMsat bool) {
t.Fatal("unexpected last hop") t.Fatal("unexpected last hop")
} }
if *restrictions.OutgoingChannelID != outgoingChan { if restrictions.OutgoingChannelIDs[0] != outgoingChan {
t.Fatal("unexpected outgoing channel id") t.Fatal("unexpected outgoing channel id")
} }

View File

@ -284,9 +284,9 @@ type RestrictParams struct {
// the source to the target. // the source to the target.
FeeLimit lnwire.MilliSatoshi FeeLimit lnwire.MilliSatoshi
// OutgoingChannelID is the channel that needs to be taken to the first // OutgoingChannelIDs is the list of channels that are allowed for the
// hop. If nil, any channel may be used. // first hop. If nil, any channel may be used.
OutgoingChannelID *uint64 OutgoingChannelIDs []uint64
// LastHop is the pubkey of the last node before the final destination // LastHop is the pubkey of the last node before the final destination
// is reached. If nil, any node may be used. // is reached. If nil, any node may be used.
@ -329,7 +329,7 @@ type PathFindingConfig struct {
// getOutgoingBalance returns the maximum available balance in any of the // getOutgoingBalance returns the maximum available balance in any of the
// channels of the given node. The second return parameters is the total // channels of the given node. The second return parameters is the total
// available balance. // available balance.
func getOutgoingBalance(node route.Vertex, outgoingChan *uint64, func getOutgoingBalance(node route.Vertex, outgoingChans map[uint64]struct{},
bandwidthHints map[uint64]lnwire.MilliSatoshi, bandwidthHints map[uint64]lnwire.MilliSatoshi,
g routingGraph) (lnwire.MilliSatoshi, lnwire.MilliSatoshi, error) { g routingGraph) (lnwire.MilliSatoshi, lnwire.MilliSatoshi, error) {
@ -344,8 +344,10 @@ func getOutgoingBalance(node route.Vertex, outgoingChan *uint64,
chanID := outEdge.ChannelID chanID := outEdge.ChannelID
// Enforce outgoing channel restriction. // Enforce outgoing channel restriction.
if outgoingChan != nil && chanID != *outgoingChan { if outgoingChans != nil {
return nil if _, ok := outgoingChans[chanID]; !ok {
return nil
}
} }
bandwidth, ok := bandwidthHints[chanID] bandwidth, ok := bandwidthHints[chanID]
@ -447,13 +449,22 @@ func findPath(g *graphParams, r *RestrictParams, cfg *PathFindingConfig,
return nil, errNoPaymentAddr return nil, errNoPaymentAddr
} }
// Set up outgoing channel map for quicker access.
var outgoingChanMap map[uint64]struct{}
if len(r.OutgoingChannelIDs) > 0 {
outgoingChanMap = make(map[uint64]struct{})
for _, outChan := range r.OutgoingChannelIDs {
outgoingChanMap[outChan] = struct{}{}
}
}
// If we are routing from ourselves, check that we have enough local // If we are routing from ourselves, check that we have enough local
// balance available. // balance available.
self := g.graph.sourceNode() self := g.graph.sourceNode()
if source == self { if source == self {
max, total, err := getOutgoingBalance( max, total, err := getOutgoingBalance(
self, r.OutgoingChannelID, g.bandwidthHints, g.graph, self, outgoingChanMap, g.bandwidthHints, g.graph,
) )
if err != nil { if err != nil {
return nil, err return nil, err
@ -763,7 +774,7 @@ func findPath(g *graphParams, r *RestrictParams, cfg *PathFindingConfig,
pivot := partialPath.node pivot := partialPath.node
// Create unified policies for all incoming connections. // Create unified policies for all incoming connections.
u := newUnifiedPolicies(self, pivot, r.OutgoingChannelID) u := newUnifiedPolicies(self, pivot, outgoingChanMap)
err := u.addGraphPolicies(g.graph) err := u.addGraphPolicies(g.graph)
if err != nil { if err != nil {

View File

@ -2249,11 +2249,12 @@ func TestRestrictOutgoingChannel(t *testing.T) {
// Define channel id constants // Define channel id constants
const ( const (
chanSourceA = 1 chanSourceA = 1
chanATarget = 4 chanATarget = 4
chanSourceB1 = 2 chanSourceB1 = 2
chanSourceB2 = 3 chanSourceB2 = 3
chanBTarget = 5 chanBTarget = 5
chanSourceTarget = 6
) )
// Set up a test graph with three possible paths from roasbeef to // Set up a test graph with three possible paths from roasbeef to
@ -2276,6 +2277,9 @@ func TestRestrictOutgoingChannel(t *testing.T) {
Expiry: 144, Expiry: 144,
FeeRate: 800, FeeRate: 800,
}, chanBTarget), }, chanBTarget),
symmetricTestChannel("roasbeef", "target", 100000, &testChannelPolicy{
Expiry: 144,
}, chanSourceTarget),
} }
ctx := newPathFindingTestContext(t, testChannels, "roasbeef") ctx := newPathFindingTestContext(t, testChannels, "roasbeef")
@ -2290,9 +2294,9 @@ func TestRestrictOutgoingChannel(t *testing.T) {
target := ctx.keyFromAlias("target") target := ctx.keyFromAlias("target")
outgoingChannelID := uint64(chanSourceB1) outgoingChannelID := uint64(chanSourceB1)
// Find the best path given the restriction to only use chanSourceB1 as // Find the best path given the restriction to only use channel 2 as the
// the outgoing channel. // outgoing channel.
ctx.restrictParams.OutgoingChannelID = &outgoingChannelID ctx.restrictParams.OutgoingChannelIDs = []uint64{outgoingChannelID}
path, err := ctx.findPath(target, paymentAmt) path, err := ctx.findPath(target, paymentAmt)
if err != nil { if err != nil {
t.Fatalf("unable to find path: %v", err) t.Fatalf("unable to find path: %v", err)
@ -2305,6 +2309,20 @@ func TestRestrictOutgoingChannel(t *testing.T) {
"but channel %v was selected instead", chanSourceB1, "but channel %v was selected instead", chanSourceB1,
path[0].ChannelID) path[0].ChannelID)
} }
// If a direct channel to target is allowed as well, that channel is
// expected to be selected because the routing fees are zero.
ctx.restrictParams.OutgoingChannelIDs = []uint64{
chanSourceB1, chanSourceTarget,
}
path, err = ctx.findPath(target, paymentAmt)
if err != nil {
t.Fatalf("unable to find path: %v", err)
}
if path[0].ChannelID != chanSourceTarget {
t.Fatalf("expected route to pass through channel %v",
chanSourceTarget)
}
} }
// TestRestrictLastHop asserts that a last hop restriction is obeyed by the path // TestRestrictLastHop asserts that a last hop restriction is obeyed by the path
@ -2766,7 +2784,7 @@ func TestRouteToSelf(t *testing.T) {
outgoingChanID := uint64(1) outgoingChanID := uint64(1)
lastHop := ctx.keyFromAlias("b") lastHop := ctx.keyFromAlias("b")
ctx.restrictParams.OutgoingChannelID = &outgoingChanID ctx.restrictParams.OutgoingChannelIDs = []uint64{outgoingChanID}
ctx.restrictParams.LastHop = &lastHop ctx.restrictParams.LastHop = &lastHop
// Find the best path to self given that we want to go out via channel 1 // Find the best path to self given that we want to go out via channel 1

View File

@ -202,14 +202,14 @@ func (p *paymentSession) RequestRoute(maxAmt, feeLimit lnwire.MilliSatoshi,
// to our destination, respecting the recommendations from // to our destination, respecting the recommendations from
// MissionControl. // MissionControl.
restrictions := &RestrictParams{ restrictions := &RestrictParams{
ProbabilitySource: p.missionControl.GetProbability, ProbabilitySource: p.missionControl.GetProbability,
FeeLimit: feeLimit, FeeLimit: feeLimit,
OutgoingChannelID: p.payment.OutgoingChannelID, OutgoingChannelIDs: p.payment.OutgoingChannelIDs,
LastHop: p.payment.LastHop, LastHop: p.payment.LastHop,
CltvLimit: cltvLimit, CltvLimit: cltvLimit,
DestCustomRecords: p.payment.DestCustomRecords, DestCustomRecords: p.payment.DestCustomRecords,
DestFeatures: p.payment.DestFeatures, DestFeatures: p.payment.DestFeatures,
PaymentAddr: p.payment.PaymentAddr, PaymentAddr: p.payment.PaymentAddr,
} }
finalHtlcExpiry := int32(height) + int32(finalCltvDelta) finalHtlcExpiry := int32(height) + int32(finalCltvDelta)

View File

@ -1594,9 +1594,9 @@ type LightningPayment struct {
// destination successfully. // destination successfully.
RouteHints [][]zpay32.HopHint RouteHints [][]zpay32.HopHint
// OutgoingChannelID is the channel that needs to be taken to the first // OutgoingChannelIDs is the list of channels that are allowed for the
// hop. If nil, any channel may be used. // first hop. If nil, any channel may be used.
OutgoingChannelID *uint64 OutgoingChannelIDs []uint64
// LastHop is the pubkey of the last node before the final destination // LastHop is the pubkey of the last node before the final destination
// is reached. If nil, any node may be used. // is reached. If nil, any node may be used.
@ -2379,6 +2379,13 @@ func (r *ChannelRouter) BuildRoute(amt *lnwire.MilliSatoshi,
log.Tracef("BuildRoute called: hopsCount=%v, amt=%v", log.Tracef("BuildRoute called: hopsCount=%v, amt=%v",
len(hops), amt) len(hops), amt)
var outgoingChans map[uint64]struct{}
if outgoingChan != nil {
outgoingChans = map[uint64]struct{}{
*outgoingChan: {},
}
}
// If no amount is specified, we need to build a route for the minimum // If no amount is specified, we need to build a route for the minimum
// amount that this route can carry. // amount that this route can carry.
useMinAmt := amt == nil useMinAmt := amt == nil
@ -2444,7 +2451,7 @@ func (r *ChannelRouter) BuildRoute(amt *lnwire.MilliSatoshi,
// Build unified policies for this hop based on the channels // Build unified policies for this hop based on the channels
// known in the graph. // known in the graph.
u := newUnifiedPolicies(source, toNode, outgoingChan) u := newUnifiedPolicies(source, toNode, outgoingChans)
err := u.addGraphPolicies(routingTx) err := u.addGraphPolicies(routingTx)
if err != nil { if err != nil {

View File

@ -21,13 +21,13 @@ type unifiedPolicies struct {
// outChanRestr is an optional outgoing channel restriction for the // outChanRestr is an optional outgoing channel restriction for the
// local channel to use. // local channel to use.
outChanRestr *uint64 outChanRestr map[uint64]struct{}
} }
// newUnifiedPolicies instantiates a new unifiedPolicies object. Channel // newUnifiedPolicies instantiates a new unifiedPolicies object. Channel
// policies can be added to this object. // policies can be added to this object.
func newUnifiedPolicies(sourceNode, toNode route.Vertex, func newUnifiedPolicies(sourceNode, toNode route.Vertex,
outChanRestr *uint64) *unifiedPolicies { outChanRestr map[uint64]struct{}) *unifiedPolicies {
return &unifiedPolicies{ return &unifiedPolicies{
policies: make(map[route.Vertex]*unifiedPolicy), policies: make(map[route.Vertex]*unifiedPolicy),
@ -45,10 +45,10 @@ func (u *unifiedPolicies) addPolicy(fromNode route.Vertex,
localChan := fromNode == u.sourceNode localChan := fromNode == u.sourceNode
// Skip channels if there is an outgoing channel restriction. // Skip channels if there is an outgoing channel restriction.
if localChan && u.outChanRestr != nil && if localChan && u.outChanRestr != nil {
*u.outChanRestr != edge.ChannelID { if _, ok := u.outChanRestr[edge.ChannelID]; !ok {
return
return }
} }
// Update the policies map. // Update the policies map.

View File

@ -3687,18 +3687,18 @@ func (r *rpcServer) unmarshallSendToRouteRequest(
// hints), or we'll get a fully populated route from the user that we'll pass // hints), or we'll get a fully populated route from the user that we'll pass
// directly to the channel router for dispatching. // directly to the channel router for dispatching.
type rpcPaymentIntent struct { type rpcPaymentIntent struct {
msat lnwire.MilliSatoshi msat lnwire.MilliSatoshi
feeLimit lnwire.MilliSatoshi feeLimit lnwire.MilliSatoshi
cltvLimit uint32 cltvLimit uint32
dest route.Vertex dest route.Vertex
rHash [32]byte rHash [32]byte
cltvDelta uint16 cltvDelta uint16
routeHints [][]zpay32.HopHint routeHints [][]zpay32.HopHint
outgoingChannelID *uint64 outgoingChannelIDs []uint64
lastHop *route.Vertex lastHop *route.Vertex
destFeatures *lnwire.FeatureVector destFeatures *lnwire.FeatureVector
paymentAddr *[32]byte paymentAddr *[32]byte
payReq []byte payReq []byte
destCustomRecords record.CustomSet destCustomRecords record.CustomSet
@ -3734,9 +3734,12 @@ func (r *rpcServer) extractPaymentIntent(rpcPayReq *rpcPaymentRequest) (rpcPayme
} }
// If there are no routes specified, pass along a outgoing channel // If there are no routes specified, pass along a outgoing channel
// restriction if specified. // restriction if specified. The main server rpc does not support
// multiple channel restrictions.
if rpcPayReq.OutgoingChanId != 0 { if rpcPayReq.OutgoingChanId != 0 {
payIntent.outgoingChannelID = &rpcPayReq.OutgoingChanId payIntent.outgoingChannelIDs = []uint64{
rpcPayReq.OutgoingChanId,
}
} }
// Pass along a last hop restriction if specified. // Pass along a last hop restriction if specified.
@ -3951,20 +3954,20 @@ func (r *rpcServer) dispatchPaymentIntent(
// router, otherwise we'll create a payment session to execute it. // router, otherwise we'll create a payment session to execute it.
if payIntent.route == nil { if payIntent.route == nil {
payment := &routing.LightningPayment{ payment := &routing.LightningPayment{
Target: payIntent.dest, Target: payIntent.dest,
Amount: payIntent.msat, Amount: payIntent.msat,
FinalCLTVDelta: payIntent.cltvDelta, FinalCLTVDelta: payIntent.cltvDelta,
FeeLimit: payIntent.feeLimit, FeeLimit: payIntent.feeLimit,
CltvLimit: payIntent.cltvLimit, CltvLimit: payIntent.cltvLimit,
PaymentHash: payIntent.rHash, PaymentHash: payIntent.rHash,
RouteHints: payIntent.routeHints, RouteHints: payIntent.routeHints,
OutgoingChannelID: payIntent.outgoingChannelID, OutgoingChannelIDs: payIntent.outgoingChannelIDs,
LastHop: payIntent.lastHop, LastHop: payIntent.lastHop,
PaymentRequest: payIntent.payReq, PaymentRequest: payIntent.payReq,
PayAttemptTimeout: routing.DefaultPayAttemptTimeout, PayAttemptTimeout: routing.DefaultPayAttemptTimeout,
DestCustomRecords: payIntent.destCustomRecords, DestCustomRecords: payIntent.destCustomRecords,
DestFeatures: payIntent.destFeatures, DestFeatures: payIntent.destFeatures,
PaymentAddr: payIntent.paymentAddr, PaymentAddr: payIntent.paymentAddr,
// Don't enable multi-part payments on the main rpc. // Don't enable multi-part payments on the main rpc.
// Users need to use routerrpc for that. // Users need to use routerrpc for that.