From aeeb021b59b85259cd62f1d47d6c576558bba12e Mon Sep 17 00:00:00 2001 From: Gustavo Chain Date: Fri, 14 Feb 2020 10:27:51 +0100 Subject: [PATCH] fix new blocks ui --- ui/ui.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ui/ui.go b/ui/ui.go index 700b109..c0f440c 100644 --- a/ui/ui.go +++ b/ui/ui.go @@ -74,7 +74,7 @@ func (ui *UI) Render(resp *client.Response) { } if b := resp.Block; b != nil { - ui.state.blocks = append(ui.state.blocks, *b) + ui.state.blocks = append([]client.Block{*b}, ui.state.blocks...) } if info := resp.MempoolInfo; info != nil { @@ -102,7 +102,7 @@ func (ui *UI) Layout(g *gocui.Gui) error { name := fmt.Sprintf("projected-block-%d", i) var x0, x1, y0, y1 int if vertical { - x0 = x - (x/4)*(i+1) + x0 = x - (BLOCK_WIDTH+2)*(i+1) x1 = x0 + BLOCK_WIDTH y0 = (y / 2) - 12 y1 = (y / 2) - 2 @@ -135,7 +135,7 @@ func (ui *UI) Layout(g *gocui.Gui) error { name := fmt.Sprintf("block-%d", i) var x0, x1, y0, y1 int if vertical { - x0 = x - (x/4)*(i+1) + x0 = x - (BLOCK_WIDTH+2)*(i+1) x1 = x0 + BLOCK_WIDTH y0 = (y / 2) + 2 y1 = (y / 2) + 12 @@ -240,7 +240,7 @@ func (ui *UI) printProjectedBlock(n int) []byte { block := ui.state.projected[n] lines := []string{ - white(" ~%d sat/vB ", ceil(block.MedianFee)), + white(" ~%d sat/vB ", ceil(block.MedianFee)), yellow(" %d - %d sat/vB ", ceil(block.MinFee), ceil(block.MaxFee)), " ", white(" %.2f MB ", float64(block.BlockSize)/(1000*1000)), @@ -276,7 +276,7 @@ func (ui *UI) printBlock(n int) []byte { ago := time.Now().Unix() - int64(block.Time) lines := []string{ - white(" ~%d sat/Vb ", ceil(block.MedianFee)), + white(" ~%d sat/Vb ", ceil(block.MedianFee)), yellow(" %d - %d sat/vB ", ceil(block.MinFee), ceil(block.MaxFee)), " ", white(" %.2f MB ", float64(block.Size)/(1000*1000)),