From 01f31e436a4cdf4e76db243102e17427bd9c4ec8 Mon Sep 17 00:00:00 2001 From: "Johan T. Halseth" Date: Thu, 14 Jan 2021 13:58:03 +0100 Subject: [PATCH] itest: fix node names out of bounds If the last channel fails, the indexing into nodeNames would panic. We instead name the channels, such that the slices will be of the same length. --- lntest/itest/lnd_test.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lntest/itest/lnd_test.go b/lntest/itest/lnd_test.go index 4acf4470..9b94a671 100644 --- a/lntest/itest/lnd_test.go +++ b/lntest/itest/lnd_test.go @@ -6726,7 +6726,10 @@ func testInvoiceRoutingHints(net *lntest.NetworkHarness, t *harnessTest) { ) // Make sure all the channels have been opened. - nodeNames := []string{"bob", "carol", "dave", "eve"} + chanNames := []string{ + "alice-bob", "alice-carol", "bob-carol", "alice-dave", + "alice-eve", + } aliceChans := []*lnrpc.ChannelPoint{ chanPointBob, chanPointCarol, chanPointBobCarol, chanPointDave, chanPointEve, @@ -6735,8 +6738,8 @@ func testInvoiceRoutingHints(net *lntest.NetworkHarness, t *harnessTest) { ctxt, _ := context.WithTimeout(ctxb, defaultTimeout) err = net.Alice.WaitForNetworkChannelOpen(ctxt, chanPoint) if err != nil { - t.Fatalf("timed out waiting for channel open between "+ - "alice and %s: %v", nodeNames[i], err) + t.Fatalf("timed out waiting for channel open %s: %v", + chanNames[i], err) } }