From c00a3ae03b30dcbe7c5a8b68eb0e7ebb035b77b2 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Sat, 2 Dec 2017 18:42:31 -0800 Subject: [PATCH] cmd/lncli: fix graph rendering with a single channel --- cmd/lncli/commands.go | 6 ++++++ lnd_test.go | 5 ++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/cmd/lncli/commands.go b/cmd/lncli/commands.go index f8c1cf3d..038d2b72 100644 --- a/cmd/lncli/commands.go +++ b/cmd/lncli/commands.go @@ -1466,6 +1466,12 @@ func drawChannelGraph(graph *lnrpc.ChannelGraph) error { normalizedCapacity := normalize(edge.Capacity) edgeThickness := strconv.FormatFloat(normalizedCapacity, 'f', -1, 64) + // If there's only a single channel in the graph, then we'll + // just set the edge thickness to 1 for everything. + if math.IsNaN(normalizedCapacity) { + edgeThickness = "1" + } + // TODO(roasbeef): color code based on percentile capacity graphCanvas.AddEdge(src, dest, false, gographviz.Attrs{ "penwidth": edgeThickness, diff --git a/lnd_test.go b/lnd_test.go index 56b95f2f..e27e6c33 100644 --- a/lnd_test.go +++ b/lnd_test.go @@ -2100,7 +2100,10 @@ func testMultiHopPayments(net *networkHarness, t *harnessTest) { err) } - // Using Carol as the source, pay to the 5 invoices from Bob created above. + time.Sleep(time.Millisecond * 50) + + // Using Carol as the source, pay to the 5 invoices from Bob created + // above. ctxt, _ = context.WithTimeout(ctxb, timeout) err = completePaymentRequests(ctxt, carol, payReqs, true) if err != nil {