@@ -1169,12 +1169,12 @@ func (s *loopOutSwap) waitForHtlcSpendConfirmedV2(globalCtx context.Context,
1169
1169
timerChan = s .timerFactory (repushDelay )
1170
1170
1171
1171
case <- timerChan :
1172
- // sweepConfTarget will return false if the preimage is
1172
+ // canSweep will return false if the preimage is
1173
1173
// not revealed yet but the conf target is closer than
1174
1174
// 20 blocks. In this case to be sure we won't attempt
1175
1175
// to sweep at all and we won't reveal the preimage
1176
1176
// either.
1177
- _ , canSweep := s .sweepConfTarget ()
1177
+ canSweep := s .canSweep ()
1178
1178
if ! canSweep {
1179
1179
s .log .Infof ("Aborting swap, timed " +
1180
1180
"out on-chain" )
@@ -1375,9 +1375,9 @@ func validateLoopOutContract(lnd *lndclient.LndServices, request *OutRequest,
1375
1375
return nil
1376
1376
}
1377
1377
1378
- // sweepConfTarget returns the confirmation target for the htlc sweep or false
1379
- // if we're too late.
1380
- func (s * loopOutSwap ) sweepConfTarget () ( int32 , bool ) {
1378
+ // canSweep will return false if the preimage is not revealed yet but the conf
1379
+ // target is closer than 20 blocks (i.e. it is too late to reveal the preimage) .
1380
+ func (s * loopOutSwap ) canSweep () bool {
1381
1381
remainingBlocks := s .CltvExpiry - s .height
1382
1382
blocksToLastReveal := remainingBlocks - MinLoopOutPreimageRevealDelta
1383
1383
preimageRevealed := s .state == loopdb .StatePreimageRevealed
@@ -1393,20 +1393,8 @@ func (s *loopOutSwap) sweepConfTarget() (int32, bool) {
1393
1393
s .height )
1394
1394
1395
1395
s .state = loopdb .StateFailTimeout
1396
- return 0 , false
1396
+ return false
1397
1397
}
1398
1398
1399
- // Calculate the transaction fee based on the confirmation target
1400
- // required to sweep the HTLC before the timeout. We'll use the
1401
- // confirmation target provided by the client unless we've come too
1402
- // close to the expiration height, in which case we'll use the default
1403
- // if it is better than what the client provided.
1404
- confTarget := s .SweepConfTarget
1405
- if remainingBlocks <= DefaultSweepConfTargetDelta &&
1406
- confTarget > DefaultSweepConfTarget {
1407
-
1408
- confTarget = DefaultSweepConfTarget
1409
- }
1410
-
1411
- return confTarget , true
1399
+ return true
1412
1400
}
0 commit comments