diff --git a/cmd/commands/cmd_payments.go b/cmd/commands/cmd_payments.go index d13b52da2cd..006f6f5da71 100644 --- a/cmd/commands/cmd_payments.go +++ b/cmd/commands/cmd_payments.go @@ -1163,6 +1163,17 @@ var queryRoutesCommand = cli.Command{ "to use as the first hop. This flag can be " + "specified multiple times in the same command.", }, + cli.StringFlag{ + Name: "source", + Usage: "(optional) the 33-byte hex-encoded public key for the " + + "payment source. If empty, self is assumed", + }, + cli.StringFlag{ + Name: "last_hop", + Usage: "(optional) the 33-byte hex-encoded public key " + + "for the last hop (penultimate node in the path) " + + "to route through for this payment", + }, cli.StringSliceFlag{ Name: "ignore_pair", Usage: "ignore directional node pair " + @@ -1270,6 +1281,7 @@ func queryRoutes(ctx *cli.Context) error { req := &lnrpc.QueryRoutesRequest{ PubKey: dest, + SourcePubKey: ctx.String("source"), Amt: amt, FeeLimit: feeLimit, FinalCltvDelta: int32(ctx.Int("final_cltv_delta")), @@ -1286,6 +1298,14 @@ func queryRoutes(ctx *cli.Context) error { return fmt.Errorf("unable to decode outgoing_chan_id: %w", err) } + if ctx.IsSet("last_hop") { + lastHop, err := hex.DecodeString(ctx.String("last_hop")) + if err != nil { + return fmt.Errorf("invalid last_hop argument: %w", err) + } + req.LastHopPubkey = lastHop + } + if ctx.IsSet("route_hints") { if len(blindedRoutes) > 0 { return fmt.Errorf("--route_hints should not be used " + diff --git a/docs/release-notes/release-notes-0.20.0.md b/docs/release-notes/release-notes-0.20.0.md index 631ede8c79a..585cc2c8588 100644 --- a/docs/release-notes/release-notes-0.20.0.md +++ b/docs/release-notes/release-notes-0.20.0.md @@ -149,11 +149,14 @@ circuit. The indices are only available for forwarding events saved after v0.20. `--route_hints` flag](https://github.com/lightningnetwork/lnd/pull/9721) to support routing through private channels. - * The `lncli fwdinghistory` command now supports two new flags: [`--incoming_chan_ids` and `--outgoing_chan_ids`](https://github.com/lightningnetwork/lnd/pull/9356). These filters allows to query forwarding events for specific channels. +* `lncli queryroutes` now supports two new optional parameters: `--source` to + specify the source node for the route and `--last_hop` to specify the + penultimate node in the payment path. + # Improvements ## Functional Updates @@ -304,6 +307,7 @@ reader of a payment request. * Boris Nagaev * Elle Mouton * Erick Cestari +* Feelancer21 * Funyug * Mohamed Awnallah * Olaoluwa Osuntokun