From 9d048ecd6a0e0e318035b96ed3c472da01eb4020 Mon Sep 17 00:00:00 2001 From: Slyghtning Date: Sun, 15 Jan 2023 19:29:41 +1030 Subject: [PATCH] lncli: add flag skip_peer_alias_lookup to listchannels --- cmd/lncli/commands.go | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/cmd/lncli/commands.go b/cmd/lncli/commands.go index 7e46f1570..0cdecbd15 100644 --- a/cmd/lncli/commands.go +++ b/cmd/lncli/commands.go @@ -1415,6 +1415,11 @@ var listChannelsCommand = cli.Command{ "particular peer, accepts 66-byte, " + "hex-encoded pubkeys", }, + cli.BoolFlag{ + Name: "skip_peer_alias_lookup", + Usage: "skip the peer alias lookup per channel in " + + "order to improve performance", + }, }, Action: actionDecorator(listChannels), } @@ -1463,12 +1468,17 @@ func listChannels(ctx *cli.Context) error { peerKey = pk[:] } + // By default we will look up the peers' alias information unless the + // skip_peer_alias_lookup flag indicates otherwise. + lookupPeerAlias := !ctx.Bool("skip_peer_alias_lookup") + req := &lnrpc.ListChannelsRequest{ - ActiveOnly: ctx.Bool("active_only"), - InactiveOnly: ctx.Bool("inactive_only"), - PublicOnly: ctx.Bool("public_only"), - PrivateOnly: ctx.Bool("private_only"), - Peer: peerKey, + ActiveOnly: ctx.Bool("active_only"), + InactiveOnly: ctx.Bool("inactive_only"), + PublicOnly: ctx.Bool("public_only"), + PrivateOnly: ctx.Bool("private_only"), + Peer: peerKey, + PeerAliasLookup: lookupPeerAlias, } resp, err := client.ListChannels(ctxc, req)