From 4d96f31f599c42d08d6ae6b518b10560e6da9854 Mon Sep 17 00:00:00 2001 From: Torkel Rogstad Date: Wed, 6 Oct 2021 14:20:05 +0200 Subject: [PATCH] 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. --- cmd/lncli/commands.go | 10 +++++----- docs/release-notes/release-notes-0.14.0.md | 4 ++++ 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/cmd/lncli/commands.go b/cmd/lncli/commands.go index 68545d2c5..d36878461 100644 --- a/cmd/lncli/commands.go +++ b/cmd/lncli/commands.go @@ -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) diff --git a/docs/release-notes/release-notes-0.14.0.md b/docs/release-notes/release-notes-0.14.0.md index ca7c873c0..a20dcf4fa 100644 --- a/docs/release-notes/release-notes-0.14.0.md +++ b/docs/release-notes/release-notes-0.14.0.md @@ -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