lncli: take chan_id as uint64 in getchaninfo

When taking in chan_id as a int64, there are some channels that cannot
be givn to lncli because they are out of range for an int64.
This commit is contained in:
Torkel Rogstad 2021-10-06 14:20:05 +02:00
parent ccc03931ad
commit 4d96f31f59
2 changed files with 9 additions and 5 deletions

View file

@ -1557,7 +1557,7 @@ var getChanInfoCommand = cli.Command{
"particular channel",
ArgsUsage: "chan_id",
Flags: []cli.Flag{
cli.Int64Flag{
cli.Uint64Flag{
Name: "chan_id",
Usage: "the 8-byte compact channel ID to query for",
},
@ -1571,15 +1571,15 @@ func getChanInfo(ctx *cli.Context) error {
defer cleanUp()
var (
chanID int64
chanID uint64
err error
)
switch {
case ctx.IsSet("chan_id"):
chanID = ctx.Int64("chan_id")
chanID = ctx.Uint64("chan_id")
case ctx.Args().Present():
chanID, err = strconv.ParseInt(ctx.Args().First(), 10, 64)
chanID, err = strconv.ParseUint(ctx.Args().First(), 10, 64)
if err != nil {
return fmt.Errorf("error parsing chan_id: %s", err)
}
@ -1588,7 +1588,7 @@ func getChanInfo(ctx *cli.Context) error {
}
req := &lnrpc.ChanInfoRequest{
ChanId: uint64(chanID),
ChanId: chanID,
}
chanInfo, err := client.GetChanInfo(ctxc, req)

View file

@ -443,6 +443,10 @@ you.
* [Use the change output index when validating the reserved wallet balance for
SendCoins/SendMany calls](https://github.com/lightningnetwork/lnd/pull/5665)
* A [bug](https://github.com/lightningnetwork/lnd/pull/5834) has been fixed where
certain channels couldn't be passed to `lncli getchaninfo` due to their 8-byte
compact ID being too large for an int64.
## Documentation
The [code contribution guidelines have been updated to mention the new