diff --git a/sweepbatcher/greedy_batch_selection.go b/sweepbatcher/greedy_batch_selection.go index ae8d520a8..4857fa203 100644 --- a/sweepbatcher/greedy_batch_selection.go +++ b/sweepbatcher/greedy_batch_selection.go @@ -24,11 +24,6 @@ import ( // or creates new batch for it. If this method fails for whatever reason, the // caller falls back to the simple algorithm (method handleSweep). func (b *Batcher) greedyAddSweep(ctx context.Context, sweep *sweep) error { - if b.customFeeRate == nil { - return errors.New("greedy batch selection algorithm requires " + - "setting custom fee rate provider") - } - // Collect weight and fee rate info about the sweep and new batch. sweepFeeDetails, newBatchFeeDetails, err := estimateSweepFeeIncrement( sweep, diff --git a/sweepbatcher/sweep_batcher.go b/sweepbatcher/sweep_batcher.go index b12f391f2..670f7e9ab 100644 --- a/sweepbatcher/sweep_batcher.go +++ b/sweepbatcher/sweep_batcher.go @@ -474,19 +474,16 @@ func (b *Batcher) handleSweep(ctx context.Context, sweep *sweep, } } - // If custom fee rate provider is used, run the greedy algorithm of - // batch selection to minimize costs. - if b.customFeeRate != nil { - err := b.greedyAddSweep(ctx, sweep) - if err == nil { - // The greedy algorithm succeeded. - return nil - } - - log.Warnf("Greedy batch selection algorithm failed for sweep "+ - "%x, falling back to old approach.", sweep.swapHash[:6]) + // Try to run the greedy algorithm of batch selection to minimize costs. + err = b.greedyAddSweep(ctx, sweep) + if err == nil { + // The greedy algorithm succeeded. + return nil } + log.Warnf("Greedy batch selection algorithm failed for sweep %x: %v. "+ + "Falling back to old approach.", sweep.swapHash[:6], err) + // If one of the batches accepts the sweep, we provide it to that batch. for _, batch := range b.batches { accepted, err := batch.addSweep(ctx, sweep)