integration test: improve logging in case of channel announcement failure

This commit is contained in:
Johan T. Halseth 2018-01-21 14:57:30 +01:00
parent 2d104b7ec0
commit 786ca6cc50
No known key found for this signature in database
GPG Key ID: 15BAADA29DA20D26

@ -2366,12 +2366,25 @@ func testMultiHopPayments(net *lntest.NetworkHarness, t *harnessTest) {
} }
// Wait for all nodes to have seen all channels. // 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 _, 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) ctxt, _ = context.WithTimeout(ctxb, timeout)
err = node.WaitForNetworkChannelOpen(ctxt, chanPoint) err = node.WaitForNetworkChannelOpen(ctxt, chanPoint)
if err != nil { 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 // Wait for all nodes to have seen all these channels, as they
// are all public. // are all public.
nodes := []*lntest.HarnessNode{net.Alice, net.Bob, carol, dave} nodes := []*lntest.HarnessNode{net.Alice, net.Bob, carol, dave}
nodeNames := []string{"Alice", "Bob", "Carol", "Dave"}
for _, chanPoint := range networkChans { 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) ctxt, _ = context.WithTimeout(ctxb, timeout)
err = node.WaitForNetworkChannelOpen(ctxt, chanPoint) err = node.WaitForNetworkChannelOpen(ctxt, chanPoint)
if err != nil { if err != nil {
t.Fatalf("timeout waiting for channel open: %v", t.Fatalf("%s(%d): timeout waiting for "+
err) "channel(%s) open: %v", nodeNames[i],
node.NodeID, point, err)
} }
} }
} }
// Now create a _private_ channel directly between Carol and // Now create a _private_ channel directly between Carol and
// Alice of 100k. // Alice of 100k.
if err := net.ConnectNodes(ctxb, carol, net.Alice); err != nil { if err := net.ConnectNodes(ctxb, carol, net.Alice); err != nil {