test: add short sleep before channel assert to account for gossip propagation

This commit adds a short sleep before a channel assertion in the
`testMaxPendingChannels` test. This sleep serves to give the nodes
enough time to propagate the new channel announcement over the
authenticated gossip system. Without this sleep, the call may be issued
in a state wherein only half of the channel announcement has fully
propagated.
This commit is contained in:
Olaoluwa Osuntokun 2017-01-02 15:46:29 -08:00
parent 9b50df704c
commit 57c0f8f005
No known key found for this signature in database
GPG Key ID: 9CC5B105D03521A2

@ -470,7 +470,10 @@ func testSingleHopInvoice(net *networkHarness, t *harnessTest) {
bobBalance, paymentAmt)
}
aliceListChannels, err := net.Alice.ListChannels(ctxb, &lnrpc.ListChannelsRequest{})
// Both channels should also have properly accunted from the amount
// that has been sent/received over the channel.
listReq := &lnrpc.ListChannelsRequest{}
aliceListChannels, err := net.Alice.ListChannels(ctxb, listReq)
if err != nil {
t.Fatalf("unable to query for alice's channel list: %v", err)
}
@ -480,7 +483,7 @@ func testSingleHopInvoice(net *networkHarness, t *harnessTest) {
aliceSatoshisSent, paymentAmt)
}
bobListChannels, err := net.Bob.ListChannels(ctxb, &lnrpc.ListChannelsRequest{})
bobListChannels, err := net.Bob.ListChannels(ctxb, listReq)
if err != nil {
t.Fatalf("unable to query for bob's channel list: %v", err)
}
@ -1052,6 +1055,7 @@ func testMaxPendingChannels(net *networkHarness, t *harnessTest) {
Hash: *fundingTxID,
Index: fundingChanPoint.OutputIndex,
}
time.Sleep(time.Millisecond * 500)
if err := net.AssertChannelExists(ctx, net.Alice, &chanPoint); err != nil {
t.Fatalf("unable to assert channel existence: %v", err)
}