From 87fb185a9b27910f63fe2ed9bfeb4f2ded64e64c Mon Sep 17 00:00:00 2001 From: Boris Nagaev Date: Wed, 29 May 2024 15:13:48 -0300 Subject: [PATCH] sweepbatcher: remove const defaultBatchConfTarget It is always overwritten with primary sweep's confTarget. Print a warning if batchConfTarget is 0 in updateRbfRate. See https://github.com/lightninglabs/loop/pull/754#discussion_r1613514363 --- sweepbatcher/sweep_batch.go | 8 ++++---- sweepbatcher/sweep_batcher.go | 2 -- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/sweepbatcher/sweep_batch.go b/sweepbatcher/sweep_batch.go index da27e308..b0d8c04b 100644 --- a/sweepbatcher/sweep_batch.go +++ b/sweepbatcher/sweep_batch.go @@ -35,10 +35,6 @@ const ( // fee rate is increased when an rbf is attempted. defaultFeeRateStep = chainfee.SatPerKWeight(100) - // defaultBatchConfTarget is the default confirmation target of the - // batch transaction. - defaultBatchConfTarget = 12 - // batchConfHeight is the default confirmation height of the batch // transaction. batchConfHeight = 3 @@ -1059,6 +1055,10 @@ func (b *batch) updateRbfRate(ctx context.Context) error { // If the feeRate is unset then we never published before, so we // retrieve the fee estimate from our wallet. if b.rbfCache.FeeRate == 0 { + if b.cfg.batchConfTarget == 0 { + b.log.Warnf("updateRbfRate called with zero " + + "batchConfTarget") + } b.log.Infof("initializing rbf fee rate for conf target=%v", b.cfg.batchConfTarget) rate, err := b.wallet.EstimateFeeRate( diff --git a/sweepbatcher/sweep_batcher.go b/sweepbatcher/sweep_batcher.go index 4c3a5330..749da451 100644 --- a/sweepbatcher/sweep_batcher.go +++ b/sweepbatcher/sweep_batcher.go @@ -378,7 +378,6 @@ func (b *Batcher) handleSweep(ctx context.Context, sweep *sweep, func (b *Batcher) spinUpBatch(ctx context.Context) (*batch, error) { cfg := batchConfig{ maxTimeoutDistance: defaultMaxTimeoutDistance, - batchConfTarget: defaultBatchConfTarget, } switch b.chainParams { @@ -488,7 +487,6 @@ func (b *Batcher) spinUpBatchFromDB(ctx context.Context, batch *batch) error { cfg := batchConfig{ maxTimeoutDistance: batch.cfg.maxTimeoutDistance, - batchConfTarget: defaultBatchConfTarget, } newBatch, err := NewBatchFromDB(cfg, batchKit)