From d3401f809f283d8a6528f60017e9d776a5e74e44 Mon Sep 17 00:00:00 2001 From: Andras Banki-Horvath Date: Wed, 11 May 2022 20:10:01 +0200 Subject: [PATCH] loopout: fix flaky loopout preimage push and expiry tests --- loopout_test.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/loopout_test.go b/loopout_test.go index e821aaa..d23e1a3 100644 --- a/loopout_test.go +++ b/loopout_test.go @@ -581,6 +581,11 @@ func testPreimagePush(t *testing.T) { // preimage is not revealed, we also do not expect a preimage push. expiryChan <- testTime + // Since we don't have a reliable mechanism to non-intrusively avoid + // races by setting the fee estimate too soon, let's sleep here a bit + // to ensure the first sweep fails. + time.Sleep(500 * time.Millisecond) + // Now we decrease our fees for the swap's confirmation target to less // than the maximum miner fee. ctx.Lnd.SetFeeEstimate(testReq.SweepConfTarget, chainfee.SatPerKWeight( @@ -760,6 +765,11 @@ func testExpiryBeforeReveal(t *testing.T) { // won't attempt a sweep at this point. expiryChan <- testTime + // Since we don't have a reliable mechanism to non-intrusively avoid + // races by setting the fee estimate too soon, let's sleep here a bit + // to ensure the first sweep fails. + time.Sleep(500 * time.Millisecond) + // Now we decrease our conf target to less than our max miner fee. lnd.SetFeeEstimate(testReq.SweepConfTarget, chainfee.SatPerKWeight( testReq.MaxMinerFee/2,