mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-02-22 22:25:24 +01:00
lncli: add ignore_pair flag to queryroutes
This commit is contained in:
parent
6980a18ab1
commit
ae6161d847
2 changed files with 38 additions and 0 deletions
|
@ -1028,6 +1028,13 @@ var queryRoutesCommand = cli.Command{
|
||||||
Usage: "(optional) the channel id of the channel " +
|
Usage: "(optional) the channel id of the channel " +
|
||||||
"that must be taken to the first hop",
|
"that must be taken to the first hop",
|
||||||
},
|
},
|
||||||
|
cli.StringSliceFlag{
|
||||||
|
Name: "ignore_pair",
|
||||||
|
Usage: "ignore directional node pair " +
|
||||||
|
"<node1>:<node2>. This flag can be specified " +
|
||||||
|
"multiple times if multiple node pairs are " +
|
||||||
|
"to be ignored",
|
||||||
|
},
|
||||||
timePrefFlag,
|
timePrefFlag,
|
||||||
cltvLimitFlag,
|
cltvLimitFlag,
|
||||||
},
|
},
|
||||||
|
@ -1074,6 +1081,31 @@ func queryRoutes(ctx *cli.Context) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pairs := ctx.StringSlice("ignore_pair")
|
||||||
|
ignoredPairs := make([]*lnrpc.NodePair, len(pairs))
|
||||||
|
for i, pair := range pairs {
|
||||||
|
nodes := strings.Split(pair, ":")
|
||||||
|
if len(nodes) != 2 {
|
||||||
|
return fmt.Errorf("invalid node pair format. " +
|
||||||
|
"Expected <node1 pub key>:<node2 pub key>")
|
||||||
|
}
|
||||||
|
|
||||||
|
node1, err := hex.DecodeString(nodes[0])
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
node2, err := hex.DecodeString(nodes[1])
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
ignoredPairs[i] = &lnrpc.NodePair{
|
||||||
|
From: node1,
|
||||||
|
To: node2,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
req := &lnrpc.QueryRoutesRequest{
|
req := &lnrpc.QueryRoutesRequest{
|
||||||
PubKey: dest,
|
PubKey: dest,
|
||||||
Amt: amt,
|
Amt: amt,
|
||||||
|
@ -1083,6 +1115,7 @@ func queryRoutes(ctx *cli.Context) error {
|
||||||
CltvLimit: uint32(ctx.Uint64(cltvLimitFlag.Name)),
|
CltvLimit: uint32(ctx.Uint64(cltvLimitFlag.Name)),
|
||||||
OutgoingChanId: ctx.Uint64("outgoing_chanid"),
|
OutgoingChanId: ctx.Uint64("outgoing_chanid"),
|
||||||
TimePref: ctx.Float64(timePrefFlag.Name),
|
TimePref: ctx.Float64(timePrefFlag.Name),
|
||||||
|
IgnoredPairs: ignoredPairs,
|
||||||
}
|
}
|
||||||
|
|
||||||
route, err := client.QueryRoutes(ctxc, req)
|
route, err := client.QueryRoutes(ctxc, req)
|
||||||
|
|
|
@ -25,6 +25,11 @@
|
||||||
`updatechanstatus`](https://github.com/lightningnetwork/lnd/pull/6705)
|
`updatechanstatus`](https://github.com/lightningnetwork/lnd/pull/6705)
|
||||||
to offer a convenient way to specify the channel to be updated.
|
to offer a convenient way to specify the channel to be updated.
|
||||||
|
|
||||||
|
* [Add `ignore_pair` flag to
|
||||||
|
queryroutes](https://github.com/lightningnetwork/lnd/pull/6724) to allow a
|
||||||
|
user to request that specific directional node pairs be ignored during the
|
||||||
|
route search.
|
||||||
|
|
||||||
## Database
|
## Database
|
||||||
|
|
||||||
* [Delete failed payment attempts](https://github.com/lightningnetwork/lnd/pull/6438)
|
* [Delete failed payment attempts](https://github.com/lightningnetwork/lnd/pull/6438)
|
||||||
|
|
Loading…
Add table
Reference in a new issue