From 8db3c04773daa8dc46730ba3563b5d6febe5925b Mon Sep 17 00:00:00 2001 From: Xavi Soler Date: Sat, 17 Nov 2018 01:12:49 +0100 Subject: [PATCH] lnrpc: reorder fields in lncli getingo output Move num_inactive_channels closer to num_active_channel, best_header_timestamp closer to block_hash/block_height and version as first item in the list. --- cmd/lncli/commands.go | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/cmd/lncli/commands.go b/cmd/lncli/commands.go index 4622ca16..084cf3ef 100644 --- a/cmd/lncli/commands.go +++ b/cmd/lncli/commands.go @@ -1585,7 +1585,39 @@ func getInfo(ctx *cli.Context) error { return err } - printRespJSON(resp) + // We print a struct that mimics the proto definition of GetInfoResponse + // but has a better ordering for the same list of fields. + printJSON(struct { + Version string `json:"version"` + IdentityPubkey string `json:"identity_pubkey"` + Alias string `json:"alias"` + NumPendingChannels uint32 `json:"num_pending_channels"` + NumActiveChannels uint32 `json:"num_active_channels"` + NumInactiveChannels uint32 `json:"num_inactive_channels"` + NumPeers uint32 `json:"num_peers"` + BlockHeight uint32 `json:"block_height"` + BlockHash string `json:"block_hash"` + BestHeaderTimestamp int64 `json:"best_header_timestamp"` + SyncedToChain bool `json:"synced_to_chain"` + Testnet bool `json:"testnet"` + Chains []string `json:"chains"` + Uris []string `json:"uris"` + }{ + Version: resp.Version, + IdentityPubkey: resp.IdentityPubkey, + Alias: resp.Alias, + NumPendingChannels: resp.NumPendingChannels, + NumActiveChannels: resp.NumActiveChannels, + NumInactiveChannels: resp.NumInactiveChannels, + NumPeers: resp.NumPeers, + BlockHeight: resp.BlockHeight, + BlockHash: resp.BlockHash, + BestHeaderTimestamp: resp.BestHeaderTimestamp, + SyncedToChain: resp.SyncedToChain, + Testnet: resp.Testnet, + Chains: resp.Chains, + Uris: resp.Uris, + }) return nil }