enhance header

pull/1/head
Edouard Paris 5 years ago
parent eb7d299c1d
commit 2b68624a33

@ -156,5 +156,7 @@ func infoProtoToInfo(resp *lnrpc.GetInfoResponse) *models.Info {
BlockHash: resp.BlockHash,
Synced: resp.SyncedToChain,
Version: resp.Version,
Chains: resp.Chains,
Testnet: resp.Testnet,
}
}

@ -13,6 +13,8 @@ type Info struct {
BlockHash string
Synced bool
Version string
Chains []string
Testnet bool
}
func (i Info) MarshalLogObject(enc logging.ObjectEncoder) error {

@ -34,9 +34,26 @@ func (h *Header) Set(g *gocui.Gui, x0, y0, x1, y1 int) error {
version = matches[0]
}
fmt.Fprintln(v, fmt.Sprintf("%s %s %s %s",
chain := ""
if len(h.Info.Chains) > 0 {
chain = h.Info.Chains[0]
}
network := "testnet"
if !h.Info.Testnet {
network = "mainnet"
}
sync := color.Yellow("[syncing]")
if h.Info.Synced {
sync = color.Green("[synced]")
}
fmt.Fprintln(v, fmt.Sprintf("%s %s %s %s %s %s",
color.CyanBg(h.Info.Alias),
color.Cyan(fmt.Sprintf("%s-v%s", "lnd", version)),
fmt.Sprintf("%s %s", chain, network),
sync,
fmt.Sprintf("%s %d", color.Cyan("height:"), h.Info.BlockHeight),
fmt.Sprintf("%s %d", color.Cyan("peers:"), h.Info.NumPeers),
))

Loading…
Cancel
Save