From 534c71b7428da0b29e974a354918e252ca3e66e4 Mon Sep 17 00:00:00 2001 From: Boris Nagaev Date: Thu, 24 Jul 2025 02:27:07 -0300 Subject: [PATCH] sweepbatcher: minimumSweepFeeRate fixes confTarget This is already done in GetConfTargetAndFeeRate. The fix is just a double check. --- sweepbatcher/sweep_batcher.go | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/sweepbatcher/sweep_batcher.go b/sweepbatcher/sweep_batcher.go index 9967c157..dcd987ef 100644 --- a/sweepbatcher/sweep_batcher.go +++ b/sweepbatcher/sweep_batcher.go @@ -1579,10 +1579,18 @@ func minimumSweepFeeRate(ctx context.Context, customFeeRate FeeRateProvider, return minFeeRate, nil } - if sweepConfTarget == 0 { - warnf("Fee estimation was requested for zero "+ - "confTarget for sweep %x.", swapHash[:6]) + // Make sure sweepConfTarget is at least 2. LND's walletkit fails with + // conftarget of 0 or 1. + // TODO: when https://github.com/lightningnetwork/lnd/pull/10087 is + // merged and that LND version becomes a requirement, we can decrease + // this from 2 to 1. + if sweepConfTarget < 2 { + warnf("Fee estimation was requested for confTarget=%d for "+ + "sweep %x; changing confTarget to 2", sweepConfTarget, + swapHash[:6]) + sweepConfTarget = 2 } + minFeeRate, err := wallet.EstimateFeeRate(ctx, sweepConfTarget) if err != nil { return 0, fmt.Errorf("failed to estimate fee rate "+