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:
1 file changed
+6
-2
+6
-2
@@ -470,7 +470,10 @@ func testSingleHopInvoice(net *networkHarness, t *harnessTest) {
|
|||||||
bobBalance, paymentAmt)
|
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 {
|
if err != nil {
|
||||||
t.Fatalf("unable to query for alice's channel list: %v", err)
|
t.Fatalf("unable to query for alice's channel list: %v", err)
|
||||||
}
|
}
|
||||||
@@ -480,7 +483,7 @@ func testSingleHopInvoice(net *networkHarness, t *harnessTest) {
|
|||||||
aliceSatoshisSent, paymentAmt)
|
aliceSatoshisSent, paymentAmt)
|
||||||
}
|
}
|
||||||
|
|
||||||
bobListChannels, err := net.Bob.ListChannels(ctxb, &lnrpc.ListChannelsRequest{})
|
bobListChannels, err := net.Bob.ListChannels(ctxb, listReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("unable to query for bob's channel list: %v", err)
|
t.Fatalf("unable to query for bob's channel list: %v", err)
|
||||||
}
|
}
|
||||||
@@ -1052,6 +1055,7 @@ func testMaxPendingChannels(net *networkHarness, t *harnessTest) {
|
|||||||
Hash: *fundingTxID,
|
Hash: *fundingTxID,
|
||||||
Index: fundingChanPoint.OutputIndex,
|
Index: fundingChanPoint.OutputIndex,
|
||||||
}
|
}
|
||||||
|
time.Sleep(time.Millisecond * 500)
|
||||||
if err := net.AssertChannelExists(ctx, net.Alice, &chanPoint); err != nil {
|
if err := net.AssertChannelExists(ctx, net.Alice, &chanPoint); err != nil {
|
||||||
t.Fatalf("unable to assert channel existence: %v", err)
|
t.Fatalf("unable to assert channel existence: %v", err)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user