mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-23 08:11:48 +02:00
lnrpc+lncli: display peer errors in listpeers
This change adds a set of errors to the peer struct returned by list peers. A latest error boolean is added to allow for more succinct default lncli responses.
This commit is contained in:
@@ -1335,7 +1335,13 @@ var listPeersCommand = cli.Command{
|
||||
Name: "listpeers",
|
||||
Category: "Peers",
|
||||
Usage: "List all active, currently connected peers.",
|
||||
Action: actionDecorator(listPeers),
|
||||
Flags: []cli.Flag{
|
||||
cli.BoolFlag{
|
||||
Name: "list_errors",
|
||||
Usage: "list a full set of most recent errors for the peer",
|
||||
},
|
||||
},
|
||||
Action: actionDecorator(listPeers),
|
||||
}
|
||||
|
||||
func listPeers(ctx *cli.Context) error {
|
||||
@@ -1343,7 +1349,11 @@ func listPeers(ctx *cli.Context) error {
|
||||
client, cleanUp := getClient(ctx)
|
||||
defer cleanUp()
|
||||
|
||||
req := &lnrpc.ListPeersRequest{}
|
||||
// By default, we display a single error on the cli. If the user
|
||||
// specifically requests a full error set, then we will provide it.
|
||||
req := &lnrpc.ListPeersRequest{
|
||||
LatestError: !ctx.IsSet("list_errors"),
|
||||
}
|
||||
resp, err := client.ListPeers(ctxb, req)
|
||||
if err != nil {
|
||||
return err
|
||||
|
Reference in New Issue
Block a user