Skip to content

Commit d3401f8

Browse files
committed
loopout: fix flaky loopout preimage push and expiry tests
1 parent 5c04b8d commit d3401f8

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

loopout_test.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -581,6 +581,11 @@ func testPreimagePush(t *testing.T) {
581581
// preimage is not revealed, we also do not expect a preimage push.
582582
expiryChan <- testTime
583583

584+
// Since we don't have a reliable mechanism to non-intrusively avoid
585+
// races by setting the fee estimate too soon, let's sleep here a bit
586+
// to ensure the first sweep fails.
587+
time.Sleep(500 * time.Millisecond)
588+
584589
// Now we decrease our fees for the swap's confirmation target to less
585590
// than the maximum miner fee.
586591
ctx.Lnd.SetFeeEstimate(testReq.SweepConfTarget, chainfee.SatPerKWeight(
@@ -760,6 +765,11 @@ func testExpiryBeforeReveal(t *testing.T) {
760765
// won't attempt a sweep at this point.
761766
expiryChan <- testTime
762767

768+
// Since we don't have a reliable mechanism to non-intrusively avoid
769+
// races by setting the fee estimate too soon, let's sleep here a bit
770+
// to ensure the first sweep fails.
771+
time.Sleep(500 * time.Millisecond)
772+
763773
// Now we decrease our conf target to less than our max miner fee.
764774
lnd.SetFeeEstimate(testReq.SweepConfTarget, chainfee.SatPerKWeight(
765775
testReq.MaxMinerFee/2,

0 commit comments

Comments
 (0)