Add --include_unannounced flag to describegraph lncli command.

Private and public channels which weren't announced yet are returned only
if the flag is set.
Note: this changes the default output of describegraph which used to
return all channels known to node.
This commit is contained in:
bluetegu 2018-09-27 02:45:04 -04:00
parent d942bb58c3
commit 2f3e2f9308

@ -2467,7 +2467,15 @@ var describeGraphCommand = cli.Command{
Category: "Peers", Category: "Peers",
Description: "Prints a human readable version of the known channel " + Description: "Prints a human readable version of the known channel " +
"graph from the PoV of the node", "graph from the PoV of the node",
Usage: "Describe the network graph.", Usage: "Describe the network graph.",
Flags: []cli.Flag{
cli.BoolFlag{
Name: "include_unannounced",
Usage: "If set, unannounced channels will be included in the " +
"graph. Unannounced channels are both private channels, and " +
"public channels that are not yet announced to the network.",
},
},
Action: actionDecorator(describeGraph), Action: actionDecorator(describeGraph),
} }
@ -2475,7 +2483,9 @@ func describeGraph(ctx *cli.Context) error {
client, cleanUp := getClient(ctx) client, cleanUp := getClient(ctx)
defer cleanUp() defer cleanUp()
req := &lnrpc.ChannelGraphRequest{} req := &lnrpc.ChannelGraphRequest{
IncludeUnannounced: ctx.Bool("include_unannounced"),
}
graph, err := client.DescribeGraph(context.Background(), req) graph, err := client.DescribeGraph(context.Background(), req)
if err != nil { if err != nil {