@@ -177,26 +177,27 @@ func (s *Sweeper) CreateSweepTx(
177177
178178// GetSweepFee calculates the required tx fee to spend to P2WKH. It takes a
179179// function that is expected to add the weight of the input to the weight
180- // estimator.
180+ // estimator. It also takes a label used for logging.
181181func (s * Sweeper ) GetSweepFee (ctx context.Context ,
182182 addInputEstimate func (* input.TxWeightEstimator ) error ,
183- destAddr btcutil.Address , sweepConfTarget int32 ) (
183+ destAddr btcutil.Address , sweepConfTarget int32 , label string ) (
184184 btcutil.Amount , error ) {
185185
186186 // Use GetSweepFeeDetails to get the fee and other unused data.
187187 fee , _ , _ , err := s .GetSweepFeeDetails (
188- ctx , addInputEstimate , destAddr , sweepConfTarget ,
188+ ctx , addInputEstimate , destAddr , sweepConfTarget , label ,
189189 )
190190
191191 return fee , err
192192}
193193
194194// GetSweepFeeDetails calculates the required tx fee to spend to P2WKH. It takes
195195// a function that is expected to add the weight of the input to the weight
196- // estimator. It returns also the fee rate and transaction weight.
196+ // estimator. It also takes a label used for logging. It returns also the fee
197+ // rate and transaction weight.
197198func (s * Sweeper ) GetSweepFeeDetails (ctx context.Context ,
198199 addInputEstimate func (* input.TxWeightEstimator ) error ,
199- destAddr btcutil.Address , sweepConfTarget int32 ) (
200+ destAddr btcutil.Address , sweepConfTarget int32 , label string ) (
200201 btcutil.Amount , chainfee.SatPerKWeight , lntypes.WeightUnit , error ) {
201202
202203 // Get fee estimate from lnd.
@@ -224,7 +225,14 @@ func (s *Sweeper) GetSweepFeeDetails(ctx context.Context,
224225 // Find weight.
225226 weight := weightEstimate .Weight ()
226227
227- return feeRate .FeeForWeight (weight ), feeRate , weight , nil
228+ // Find fee.
229+ fee := feeRate .FeeForWeight (weight )
230+
231+ log .Debugf ("Estimations for a tx (label=%s): weight=%v, fee=%v, " +
232+ "feerate=%v, sweepConfTarget=%d." , label , weight , fee , feeRate ,
233+ sweepConfTarget )
234+
235+ return fee , feeRate , weight , nil
228236}
229237
230238// AddOutputEstimate adds output to weight estimator.
0 commit comments