From 418ecbaa1525a9ac8f39d5b2785fd4d3c5b40fc7 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Sun, 10 Jun 2018 22:32:25 -0700 Subject: [PATCH] test: fix flake by allowing channel to load before close --- lnd_test.go | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/lnd_test.go b/lnd_test.go index 7444e18f..d9e4f2a2 100644 --- a/lnd_test.go +++ b/lnd_test.go @@ -5105,11 +5105,20 @@ func testRevokedCloseRetributionZeroValueRemoteOutput(net *lntest.NetworkHarness // 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. - force := true - closeUpdates, closeTxId, err := net.CloseChannel(ctxb, carol, - chanPoint, force) + var ( + closeUpdates lnrpc.Lightning_CloseChannelClient + closeTxId *chainhash.Hash + closeErr error + force bool = true + ) + err = lntest.WaitPredicate(func() bool { + closeUpdates, closeTxId, closeErr = net.CloseChannel( + ctxb, carol, chanPoint, force, + ) + return closeErr == nil + }, time.Second*15) if err != nil { - t.Fatalf("unable to close channel: %v", err) + t.Fatalf("unable to close channel: %v", closeErr) } // Query the mempool for the breaching closing transaction, this should