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.
This commit is contained in:
Johan T. Halseth 2021-01-14 13:58:03 +01:00
parent 6373d32f36
commit 01f31e436a
No known key found for this signature in database
GPG Key ID: 15BAADA29DA20D26

@ -6726,7 +6726,10 @@ func testInvoiceRoutingHints(net *lntest.NetworkHarness, t *harnessTest) {
) )
// Make sure all the channels have been opened. // 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{ aliceChans := []*lnrpc.ChannelPoint{
chanPointBob, chanPointCarol, chanPointBobCarol, chanPointDave, chanPointBob, chanPointCarol, chanPointBobCarol, chanPointDave,
chanPointEve, chanPointEve,
@ -6735,8 +6738,8 @@ func testInvoiceRoutingHints(net *lntest.NetworkHarness, t *harnessTest) {
ctxt, _ := context.WithTimeout(ctxb, defaultTimeout) ctxt, _ := context.WithTimeout(ctxb, defaultTimeout)
err = net.Alice.WaitForNetworkChannelOpen(ctxt, chanPoint) err = net.Alice.WaitForNetworkChannelOpen(ctxt, chanPoint)
if err != nil { if err != nil {
t.Fatalf("timed out waiting for channel open between "+ t.Fatalf("timed out waiting for channel open %s: %v",
"alice and %s: %v", nodeNames[i], err) chanNames[i], err)
} }
} }