Skip to content

Commit 6aced35

Browse files
committed
lnd+sweep: remove unused NextAttemptDeltaFunc
1 parent 05ad18d commit 6aced35

File tree

3 files changed

+14
-31
lines changed

3 files changed

+14
-31
lines changed

server.go

+12-13
Original file line numberDiff line numberDiff line change
@@ -1064,19 +1064,18 @@ func newServer(cfg *Config, listenAddrs []net.Addr,
10641064
)
10651065

10661066
s.sweeper = sweep.New(&sweep.UtxoSweeperConfig{
1067-
FeeEstimator: cc.FeeEstimator,
1068-
GenSweepScript: newSweepPkScriptGen(cc.Wallet),
1069-
Signer: cc.Wallet.Cfg.Signer,
1070-
Wallet: newSweeperWallet(cc.Wallet),
1071-
TickerDuration: cfg.Sweeper.BatchWindowDuration,
1072-
Mempool: cc.MempoolNotifier,
1073-
Notifier: cc.ChainNotifier,
1074-
Store: sweeperStore,
1075-
MaxInputsPerTx: sweep.DefaultMaxInputsPerTx,
1076-
MaxSweepAttempts: sweep.DefaultMaxSweepAttempts,
1077-
NextAttemptDeltaFunc: sweep.DefaultNextAttemptDeltaFunc,
1078-
MaxFeeRate: cfg.Sweeper.MaxFeeRate,
1079-
Aggregator: aggregator,
1067+
FeeEstimator: cc.FeeEstimator,
1068+
GenSweepScript: newSweepPkScriptGen(cc.Wallet),
1069+
Signer: cc.Wallet.Cfg.Signer,
1070+
Wallet: newSweeperWallet(cc.Wallet),
1071+
TickerDuration: cfg.Sweeper.BatchWindowDuration,
1072+
Mempool: cc.MempoolNotifier,
1073+
Notifier: cc.ChainNotifier,
1074+
Store: sweeperStore,
1075+
MaxInputsPerTx: sweep.DefaultMaxInputsPerTx,
1076+
MaxSweepAttempts: sweep.DefaultMaxSweepAttempts,
1077+
MaxFeeRate: cfg.Sweeper.MaxFeeRate,
1078+
Aggregator: aggregator,
10801079
})
10811080

10821081
s.utxoNursery = contractcourt.NewUtxoNursery(&contractcourt.NurseryConfig{

sweep/sweeper.go

-12
Original file line numberDiff line numberDiff line change
@@ -358,10 +358,6 @@ type UtxoSweeperConfig struct {
358358
// to the caller.
359359
MaxSweepAttempts int
360360

361-
// NextAttemptDeltaFunc returns given the number of already attempted
362-
// sweeps, how many blocks to wait before retrying to sweep.
363-
NextAttemptDeltaFunc func(int) int32
364-
365361
// MaxFeeRate is the the maximum fee rate allowed within the
366362
// UtxoSweeper.
367363
MaxFeeRate chainfee.SatPerVByte
@@ -1337,14 +1333,6 @@ func (s *UtxoSweeper) CreateSweepTx(inputs []input.Input,
13371333
return tx, err
13381334
}
13391335

1340-
// DefaultNextAttemptDeltaFunc is the default calculation for next sweep attempt
1341-
// scheduling. It implements exponential back-off with some randomness. This is
1342-
// to prevent a stuck tx (for example because fee is too low and can't be bumped
1343-
// in btcd) from blocking all other retried inputs in the same tx.
1344-
func DefaultNextAttemptDeltaFunc(attempts int) int32 {
1345-
return 1 + rand.Int31n(1<<uint(attempts-1))
1346-
}
1347-
13481336
// ListSweeps returns a list of the the sweeps recorded by the sweep store.
13491337
func (s *UtxoSweeper) ListSweeps() ([]chainhash.Hash, error) {
13501338
return s.cfg.Store.ListSweeps()

sweep/sweeper_test.go

+2-6
Original file line numberDiff line numberDiff line change
@@ -148,12 +148,8 @@ func createSweeperTestContext(t *testing.T) *sweeperTestContext {
148148
FeeEstimator: estimator,
149149
MaxInputsPerTx: testMaxInputsPerTx,
150150
MaxSweepAttempts: testMaxSweepAttempts,
151-
NextAttemptDeltaFunc: func(attempts int) int32 {
152-
// Use delta func without random factor.
153-
return 1 << uint(attempts-1)
154-
},
155-
MaxFeeRate: DefaultMaxFeeRate,
156-
Aggregator: aggregator,
151+
MaxFeeRate: DefaultMaxFeeRate,
152+
Aggregator: aggregator,
157153
})
158154

159155
ctx.sweeper.Start()

0 commit comments

Comments
 (0)