mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-03 10:12:28 +02:00
routing: add outgoing channel restriction
This commit is contained in:
30
rpcserver.go
30
rpcserver.go
@@ -2732,12 +2732,13 @@ func unmarshallSendToRouteRequest(req *lnrpc.SendToRouteRequest,
|
||||
// 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
|
||||
dest *btcec.PublicKey
|
||||
rHash [32]byte
|
||||
cltvDelta uint16
|
||||
routeHints [][]routing.HopHint
|
||||
msat lnwire.MilliSatoshi
|
||||
feeLimit lnwire.MilliSatoshi
|
||||
dest *btcec.PublicKey
|
||||
rHash [32]byte
|
||||
cltvDelta uint16
|
||||
routeHints [][]routing.HopHint
|
||||
outgoingChannelID *uint64
|
||||
|
||||
routes []*routing.Route
|
||||
}
|
||||
@@ -2771,6 +2772,12 @@ func extractPaymentIntent(rpcPayReq *rpcPaymentRequest) (rpcPaymentIntent, error
|
||||
return payIntent, nil
|
||||
}
|
||||
|
||||
// If there are no routes specified, pass along a outgoing channel
|
||||
// restriction if specified.
|
||||
if rpcPayReq.OutgoingChanId != 0 {
|
||||
payIntent.outgoingChannelID = &rpcPayReq.OutgoingChanId
|
||||
}
|
||||
|
||||
// If the payment request field isn't blank, then the details of the
|
||||
// invoice are encoded entirely within the encoded payReq. So we'll
|
||||
// attempt to decode it, populating the payment accordingly.
|
||||
@@ -2920,11 +2927,12 @@ func (r *rpcServer) dispatchPaymentIntent(
|
||||
// router, otherwise we'll create a payment session to execute it.
|
||||
if len(payIntent.routes) == 0 {
|
||||
payment := &routing.LightningPayment{
|
||||
Target: payIntent.dest,
|
||||
Amount: payIntent.msat,
|
||||
FeeLimit: payIntent.feeLimit,
|
||||
PaymentHash: payIntent.rHash,
|
||||
RouteHints: payIntent.routeHints,
|
||||
Target: payIntent.dest,
|
||||
Amount: payIntent.msat,
|
||||
FeeLimit: payIntent.feeLimit,
|
||||
PaymentHash: payIntent.rHash,
|
||||
RouteHints: payIntent.routeHints,
|
||||
OutgoingChannelID: payIntent.outgoingChannelID,
|
||||
}
|
||||
|
||||
// If the final CLTV value was specified, then we'll use that
|
||||
|
Reference in New Issue
Block a user