mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-10-09 18:24:03 +02:00
lncli: channel point for getchaninfo
This commit is contained in:
@@ -1787,8 +1787,16 @@ var getChanInfoCommand = cli.Command{
|
|||||||
ArgsUsage: "chan_id",
|
ArgsUsage: "chan_id",
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
cli.Uint64Flag{
|
cli.Uint64Flag{
|
||||||
Name: "chan_id",
|
Name: "chan_id",
|
||||||
Usage: "the 8-byte compact channel ID to query for",
|
Usage: "The 8-byte compact channel ID to query for. " +
|
||||||
|
"If this is set the chan_point param is " +
|
||||||
|
"ignored.",
|
||||||
|
},
|
||||||
|
cli.StringFlag{
|
||||||
|
Name: "chan_point",
|
||||||
|
Usage: "The channel point in format txid:index. If " +
|
||||||
|
"the chan_id param is set this param is " +
|
||||||
|
"ignored.",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Action: actionDecorator(getChanInfo),
|
Action: actionDecorator(getChanInfo),
|
||||||
@@ -1800,24 +1808,31 @@ func getChanInfo(ctx *cli.Context) error {
|
|||||||
defer cleanUp()
|
defer cleanUp()
|
||||||
|
|
||||||
var (
|
var (
|
||||||
chanID uint64
|
chanID uint64
|
||||||
err error
|
chanPoint string
|
||||||
|
err error
|
||||||
)
|
)
|
||||||
|
|
||||||
switch {
|
switch {
|
||||||
case ctx.IsSet("chan_id"):
|
case ctx.IsSet("chan_id"):
|
||||||
chanID = ctx.Uint64("chan_id")
|
chanID = ctx.Uint64("chan_id")
|
||||||
|
|
||||||
case ctx.Args().Present():
|
case ctx.Args().Present():
|
||||||
chanID, err = strconv.ParseUint(ctx.Args().First(), 10, 64)
|
chanID, err = strconv.ParseUint(ctx.Args().First(), 10, 64)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("error parsing chan_id: %w", err)
|
return fmt.Errorf("error parsing chan_id: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case ctx.IsSet("chan_point"):
|
||||||
|
chanPoint = ctx.String("chan_point")
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return fmt.Errorf("chan_id argument missing")
|
return fmt.Errorf("chan_id or chan_point argument missing")
|
||||||
}
|
}
|
||||||
|
|
||||||
req := &lnrpc.ChanInfoRequest{
|
req := &lnrpc.ChanInfoRequest{
|
||||||
ChanId: chanID,
|
ChanId: chanID,
|
||||||
|
ChanPoint: chanPoint,
|
||||||
}
|
}
|
||||||
|
|
||||||
chanInfo, err := client.GetChanInfo(ctxc, req)
|
chanInfo, err := client.GetChanInfo(ctxc, req)
|
||||||
|
Reference in New Issue
Block a user