mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-06-30 02:21:08 +02:00
routing+routerrpc: add multiple outgoing channel restriction
This commit is contained in:
59
rpcserver.go
59
rpcserver.go
@ -3687,18 +3687,18 @@ func (r *rpcServer) unmarshallSendToRouteRequest(
|
||||
// hints), or we'll get a fully populated route from the user that we'll pass
|
||||
// directly to the channel router for dispatching.
|
||||
type rpcPaymentIntent struct {
|
||||
msat lnwire.MilliSatoshi
|
||||
feeLimit lnwire.MilliSatoshi
|
||||
cltvLimit uint32
|
||||
dest route.Vertex
|
||||
rHash [32]byte
|
||||
cltvDelta uint16
|
||||
routeHints [][]zpay32.HopHint
|
||||
outgoingChannelID *uint64
|
||||
lastHop *route.Vertex
|
||||
destFeatures *lnwire.FeatureVector
|
||||
paymentAddr *[32]byte
|
||||
payReq []byte
|
||||
msat lnwire.MilliSatoshi
|
||||
feeLimit lnwire.MilliSatoshi
|
||||
cltvLimit uint32
|
||||
dest route.Vertex
|
||||
rHash [32]byte
|
||||
cltvDelta uint16
|
||||
routeHints [][]zpay32.HopHint
|
||||
outgoingChannelIDs []uint64
|
||||
lastHop *route.Vertex
|
||||
destFeatures *lnwire.FeatureVector
|
||||
paymentAddr *[32]byte
|
||||
payReq []byte
|
||||
|
||||
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
|
||||
// restriction if specified.
|
||||
// restriction if specified. The main server rpc does not support
|
||||
// multiple channel restrictions.
|
||||
if rpcPayReq.OutgoingChanId != 0 {
|
||||
payIntent.outgoingChannelID = &rpcPayReq.OutgoingChanId
|
||||
payIntent.outgoingChannelIDs = []uint64{
|
||||
rpcPayReq.OutgoingChanId,
|
||||
}
|
||||
}
|
||||
|
||||
// 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.
|
||||
if payIntent.route == nil {
|
||||
payment := &routing.LightningPayment{
|
||||
Target: payIntent.dest,
|
||||
Amount: payIntent.msat,
|
||||
FinalCLTVDelta: payIntent.cltvDelta,
|
||||
FeeLimit: payIntent.feeLimit,
|
||||
CltvLimit: payIntent.cltvLimit,
|
||||
PaymentHash: payIntent.rHash,
|
||||
RouteHints: payIntent.routeHints,
|
||||
OutgoingChannelID: payIntent.outgoingChannelID,
|
||||
LastHop: payIntent.lastHop,
|
||||
PaymentRequest: payIntent.payReq,
|
||||
PayAttemptTimeout: routing.DefaultPayAttemptTimeout,
|
||||
DestCustomRecords: payIntent.destCustomRecords,
|
||||
DestFeatures: payIntent.destFeatures,
|
||||
PaymentAddr: payIntent.paymentAddr,
|
||||
Target: payIntent.dest,
|
||||
Amount: payIntent.msat,
|
||||
FinalCLTVDelta: payIntent.cltvDelta,
|
||||
FeeLimit: payIntent.feeLimit,
|
||||
CltvLimit: payIntent.cltvLimit,
|
||||
PaymentHash: payIntent.rHash,
|
||||
RouteHints: payIntent.routeHints,
|
||||
OutgoingChannelIDs: payIntent.outgoingChannelIDs,
|
||||
LastHop: payIntent.lastHop,
|
||||
PaymentRequest: payIntent.payReq,
|
||||
PayAttemptTimeout: routing.DefaultPayAttemptTimeout,
|
||||
DestCustomRecords: payIntent.destCustomRecords,
|
||||
DestFeatures: payIntent.destFeatures,
|
||||
PaymentAddr: payIntent.paymentAddr,
|
||||
|
||||
// Don't enable multi-part payments on the main rpc.
|
||||
// Users need to use routerrpc for that.
|
||||
|
Reference in New Issue
Block a user