test: fix revocation integration test flake

In this commit, we fix an existing flake within the set of revocation
integration tests. Right after Bob's restart, we attempt to force close
the channel. However, it may be the case that the chain arbitrator
hasn't yet been created. As a result, the request to force close the
channel will fail. We easily fix this by wrapping the force close
attempt in a WaitPredicate.
This commit is contained in:
Olaoluwa Osuntokun 2018-05-03 20:49:15 -07:00
parent ddd12eff9c
commit 8712ab110d
No known key found for this signature in database
GPG Key ID: 964EA263DD637C21

@ -4205,10 +4205,19 @@ func testRevokedCloseRetribution(net *lntest.NetworkHarness, t *harnessTest) {
// broadcasting his current channel state. This is actually the
// commitment transaction of a prior *revoked* state, so he'll soon
// feel the wrath of Alice's retribution.
var closeUpdates lnrpc.Lightning_CloseChannelClient
force := true
closeUpdates, _, err := net.CloseChannel(ctxb, net.Bob, chanPoint, force)
err = lntest.WaitPredicate(func() bool {
closeUpdates, _, err = net.CloseChannel(ctxb, net.Bob, chanPoint, force)
if err != nil {
predErr = err
return false
}
return true
}, time.Second*10)
if err != nil {
t.Fatalf("unable to close channel: %v", err)
t.Fatalf("unable to close channel: %v", predErr)
}
// Wait for Bob's breach transaction to show up in the mempool to ensure