From 786ca6cc50b47587cda7c907d9a9116afff5738c Mon Sep 17 00:00:00 2001 From: "Johan T. Halseth" Date: Sun, 21 Jan 2018 14:57:30 +0100 Subject: [PATCH] integration test: improve logging in case of channel announcement failure --- lnd_test.go | 35 +++++++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/lnd_test.go b/lnd_test.go index 37a5e30a..30214d26 100644 --- a/lnd_test.go +++ b/lnd_test.go @@ -2366,12 +2366,25 @@ func testMultiHopPayments(net *lntest.NetworkHarness, t *harnessTest) { } // Wait for all nodes to have seen all channels. + nodes := []*lntest.HarnessNode{net.Alice, net.Bob, carol, dave} + nodeNames := []string{"Alice", "Bob", "Carol", "Dave"} for _, chanPoint := range networkChans { - for _, node := range []*lntest.HarnessNode{net.Alice, net.Bob, carol, dave} { + for i, node := range nodes { + txid, e := chainhash.NewHash(chanPoint.FundingTxid) + if e != nil { + t.Fatalf("unable to create sha hash: %v", e) + } + point := wire.OutPoint{ + Hash: *txid, + Index: chanPoint.OutputIndex, + } + ctxt, _ = context.WithTimeout(ctxb, timeout) err = node.WaitForNetworkChannelOpen(ctxt, chanPoint) if err != nil { - t.Fatalf("timeout waiting for channel open: %v", err) + t.Fatalf("%s(%d): timeout waiting for "+ + "channel(%s) open: %v", nodeNames[i], + node.NodeID, point, err) } } } @@ -2551,17 +2564,27 @@ func testPrivateChannels(net *lntest.NetworkHarness, t *harnessTest) { // Wait for all nodes to have seen all these channels, as they // are all public. nodes := []*lntest.HarnessNode{net.Alice, net.Bob, carol, dave} + nodeNames := []string{"Alice", "Bob", "Carol", "Dave"} for _, chanPoint := range networkChans { - for _, node := range nodes { + for i, node := range nodes { + txid, e := chainhash.NewHash(chanPoint.FundingTxid) + if e != nil { + t.Fatalf("unable to create sha hash: %v", e) + } + point := wire.OutPoint{ + Hash: *txid, + Index: chanPoint.OutputIndex, + } + ctxt, _ = context.WithTimeout(ctxb, timeout) err = node.WaitForNetworkChannelOpen(ctxt, chanPoint) if err != nil { - t.Fatalf("timeout waiting for channel open: %v", - err) + t.Fatalf("%s(%d): timeout waiting for "+ + "channel(%s) open: %v", nodeNames[i], + node.NodeID, point, err) } } } - // Now create a _private_ channel directly between Carol and // Alice of 100k. if err := net.ConnectNodes(ctxb, carol, net.Alice); err != nil {