From 112a2c5ea0c697a4f551f23c37affbb509bf1322 Mon Sep 17 00:00:00 2001 From: Gustavo Chain Date: Sun, 16 Feb 2020 11:40:42 +0100 Subject: [PATCH] show vBytes/sec --- ui/ui.go | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/ui/ui.go b/ui/ui.go index 137c9f8..566b440 100644 --- a/ui/ui.go +++ b/ui/ui.go @@ -15,10 +15,11 @@ const ( ) type state struct { - loaded bool - blocks []client.Block - projected []client.ProjectedBlock - info *client.MempoolInfo + loaded bool + blocks []client.Block + projected []client.ProjectedBlock + vBytesPerSecond int + info *client.MempoolInfo } type UI struct { @@ -60,6 +61,8 @@ func (ui *UI) Loop() error { func (ui *UI) Render(resp *client.Response) { ui.state.loaded = true + ui.state.vBytesPerSecond = resp.VBytesPerSecond + nBlocks := len(resp.Blocks) blocks := make([]client.Block, nBlocks) for i := 0; i < nBlocks; i++ { @@ -259,9 +262,10 @@ func (ui *UI) info(g *gocui.Gui, x, y int) error { w += float64(b.BlockWeight) } - fmt.Fprintf(v, "%s %s, %s %s", + fmt.Fprintf(v, "%s %s, %s %s, %s %s", red("Unconfirmed Txs: "), white("%d", info.Size), blue("Mempool size"), white("%s (%d block/s)", fmtSize(mSize), ceil(w/4_000_000)), + blue("Tx weight per second"), red("%d", ui.state.vBytesPerSecond), ) return nil } @@ -293,6 +297,5 @@ func fmtSize(s int) string { } func (ui *UI) click(g *gocui.Gui, v *gocui.View) error { - _, err := g.SetCurrentView(v.Name()) - return err + return nil }