@@ -151,6 +151,8 @@ func TestLateHtlcPublish(t *testing.T) {
151151
152152 cfg := newSwapConfig (& lnd .LndServices , store , server )
153153
154+ testRequest .Expiry = height + testLoopOutMinOnChainCltvDelta
155+
154156 initResult , err := newLoopOutSwap (
155157 context .Background (), cfg , height , testRequest ,
156158 )
@@ -225,20 +227,22 @@ func TestCustomSweepConfTarget(t *testing.T) {
225227
226228 // Use the highest sweep confirmation target before we attempt to use
227229 // the default.
228- testRequest .SweepConfTarget = testLoopOutOnChainCltvDelta -
230+ testReq := * testRequest
231+
232+ testReq .SweepConfTarget = testLoopOutMinOnChainCltvDelta -
229233 DefaultSweepConfTargetDelta - 1
230234
231235 // Set up custom fee estimates such that the lower confirmation target
232236 // yields a much higher fee rate.
233- ctx .Lnd .SetFeeEstimate (testRequest .SweepConfTarget , 250 )
237+ ctx .Lnd .SetFeeEstimate (testReq .SweepConfTarget , 250 )
234238 ctx .Lnd .SetFeeEstimate (DefaultSweepConfTarget , 10000 )
235239
236240 cfg := newSwapConfig (
237241 & lnd .LndServices , newStoreMock (t ), server ,
238242 )
239243
240244 initResult , err := newLoopOutSwap (
241- context .Background (), cfg , ctx .Lnd .Height , testRequest ,
245+ context .Background (), cfg , ctx .Lnd .Height , & testReq ,
242246 )
243247 if err != nil {
244248 t .Fatal (err )
@@ -357,7 +361,7 @@ func TestCustomSweepConfTarget(t *testing.T) {
357361
358362 // The sweep should have a fee that corresponds to the custom
359363 // confirmation target.
360- _ = assertSweepTx (testRequest .SweepConfTarget )
364+ _ = assertSweepTx (testReq .SweepConfTarget )
361365
362366 // Once we have published an on chain sweep, we expect a preimage to
363367 // have been pushed to our server.
@@ -374,8 +378,8 @@ func TestCustomSweepConfTarget(t *testing.T) {
374378
375379 // We'll then notify the height at which we begin using the default
376380 // confirmation target.
377- defaultConfTargetHeight := ctx .Lnd .Height + testLoopOutOnChainCltvDelta -
378- DefaultSweepConfTargetDelta
381+ defaultConfTargetHeight := ctx .Lnd .Height +
382+ testLoopOutMinOnChainCltvDelta - DefaultSweepConfTargetDelta
379383 blockEpochChan <- int32 (defaultConfTargetHeight )
380384 expiryChan <- time .Now ()
381385
@@ -424,15 +428,17 @@ func TestPreimagePush(t *testing.T) {
424428
425429 // Start with a high confirmation delta which will have a very high fee
426430 // attached to it.
427- testRequest .SweepConfTarget = testLoopOutOnChainCltvDelta -
431+ testReq := * testRequest
432+ testReq .SweepConfTarget = testLoopOutMinOnChainCltvDelta -
428433 DefaultSweepConfTargetDelta - 1
434+ testReq .Expiry = ctx .Lnd .Height + testLoopOutMinOnChainCltvDelta
429435
430436 // We set our mock fee estimate for our target sweep confs to be our
431437 // max miner fee *2, so that our fee will definitely be above what we
432438 // are willing to pay, and we will not sweep.
433439 ctx .Lnd .SetFeeEstimate (
434- testRequest .SweepConfTarget , chainfee .SatPerKWeight (
435- testRequest .MaxMinerFee * 2 ,
440+ testReq .SweepConfTarget , chainfee .SatPerKWeight (
441+ testReq .MaxMinerFee * 2 ,
436442 ),
437443 )
438444
@@ -446,7 +452,7 @@ func TestPreimagePush(t *testing.T) {
446452 )
447453
448454 initResult , err := newLoopOutSwap (
449- context .Background (), cfg , ctx .Lnd .Height , testRequest ,
455+ context .Background (), cfg , ctx .Lnd .Height , & testReq ,
450456 )
451457 require .NoError (t , err )
452458 swap := initResult .swap
@@ -517,7 +523,7 @@ func TestPreimagePush(t *testing.T) {
517523 // Now, we notify the height at which the client will start using the
518524 // default confirmation target. This has the effect of lowering our fees
519525 // so that the client still start sweeping.
520- defaultConfTargetHeight := ctx .Lnd .Height + testLoopOutOnChainCltvDelta -
526+ defaultConfTargetHeight := ctx .Lnd .Height + testLoopOutMinOnChainCltvDelta -
521527 DefaultSweepConfTargetDelta
522528 blockEpochChan <- defaultConfTargetHeight
523529
0 commit comments