mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-03-29 03:01:52 +01:00
lnd+sweep: remove unused NextAttemptDeltaFunc
This commit is contained in:
parent
5496d02b27
commit
b5e4384e24
25
server.go
25
server.go
@ -1068,19 +1068,18 @@ func newServer(cfg *Config, listenAddrs []net.Addr,
|
|||||||
)
|
)
|
||||||
|
|
||||||
s.sweeper = sweep.New(&sweep.UtxoSweeperConfig{
|
s.sweeper = sweep.New(&sweep.UtxoSweeperConfig{
|
||||||
FeeEstimator: cc.FeeEstimator,
|
FeeEstimator: cc.FeeEstimator,
|
||||||
GenSweepScript: newSweepPkScriptGen(cc.Wallet),
|
GenSweepScript: newSweepPkScriptGen(cc.Wallet),
|
||||||
Signer: cc.Wallet.Cfg.Signer,
|
Signer: cc.Wallet.Cfg.Signer,
|
||||||
Wallet: newSweeperWallet(cc.Wallet),
|
Wallet: newSweeperWallet(cc.Wallet),
|
||||||
TickerDuration: cfg.Sweeper.BatchWindowDuration,
|
TickerDuration: cfg.Sweeper.BatchWindowDuration,
|
||||||
Mempool: cc.MempoolNotifier,
|
Mempool: cc.MempoolNotifier,
|
||||||
Notifier: cc.ChainNotifier,
|
Notifier: cc.ChainNotifier,
|
||||||
Store: sweeperStore,
|
Store: sweeperStore,
|
||||||
MaxInputsPerTx: sweep.DefaultMaxInputsPerTx,
|
MaxInputsPerTx: sweep.DefaultMaxInputsPerTx,
|
||||||
MaxSweepAttempts: sweep.DefaultMaxSweepAttempts,
|
MaxSweepAttempts: sweep.DefaultMaxSweepAttempts,
|
||||||
NextAttemptDeltaFunc: sweep.DefaultNextAttemptDeltaFunc,
|
MaxFeeRate: cfg.Sweeper.MaxFeeRate,
|
||||||
MaxFeeRate: cfg.Sweeper.MaxFeeRate,
|
Aggregator: aggregator,
|
||||||
Aggregator: aggregator,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
s.utxoNursery = contractcourt.NewUtxoNursery(&contractcourt.NurseryConfig{
|
s.utxoNursery = contractcourt.NewUtxoNursery(&contractcourt.NurseryConfig{
|
||||||
|
@ -359,12 +359,7 @@ type UtxoSweeperConfig struct {
|
|||||||
// to the caller.
|
// to the caller.
|
||||||
MaxSweepAttempts int
|
MaxSweepAttempts int
|
||||||
|
|
||||||
// NextAttemptDeltaFunc returns given the number of already attempted
|
// MaxFeeRate is the maximum fee rate allowed within the UtxoSweeper.
|
||||||
// sweeps, how many blocks to wait before retrying to sweep.
|
|
||||||
NextAttemptDeltaFunc func(int) int32
|
|
||||||
|
|
||||||
// MaxFeeRate is the maximum fee rate allowed within the
|
|
||||||
// UtxoSweeper.
|
|
||||||
MaxFeeRate chainfee.SatPerVByte
|
MaxFeeRate chainfee.SatPerVByte
|
||||||
|
|
||||||
// Aggregator is used to group inputs into clusters based on its
|
// Aggregator is used to group inputs into clusters based on its
|
||||||
@ -1335,14 +1330,6 @@ func (s *UtxoSweeper) CreateSweepTx(inputs []input.Input,
|
|||||||
return tx, err
|
return tx, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// DefaultNextAttemptDeltaFunc is the default calculation for next sweep attempt
|
|
||||||
// scheduling. It implements exponential back-off with some randomness. This is
|
|
||||||
// to prevent a stuck tx (for example because fee is too low and can't be bumped
|
|
||||||
// in btcd) from blocking all other retried inputs in the same tx.
|
|
||||||
func DefaultNextAttemptDeltaFunc(attempts int) int32 {
|
|
||||||
return 1 + rand.Int31n(1<<uint(attempts-1))
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListSweeps returns a list of the sweeps recorded by the sweep store.
|
// ListSweeps returns a list of the sweeps recorded by the sweep store.
|
||||||
func (s *UtxoSweeper) ListSweeps() ([]chainhash.Hash, error) {
|
func (s *UtxoSweeper) ListSweeps() ([]chainhash.Hash, error) {
|
||||||
return s.cfg.Store.ListSweeps()
|
return s.cfg.Store.ListSweeps()
|
||||||
|
@ -149,12 +149,8 @@ func createSweeperTestContext(t *testing.T) *sweeperTestContext {
|
|||||||
FeeEstimator: estimator,
|
FeeEstimator: estimator,
|
||||||
MaxInputsPerTx: testMaxInputsPerTx,
|
MaxInputsPerTx: testMaxInputsPerTx,
|
||||||
MaxSweepAttempts: testMaxSweepAttempts,
|
MaxSweepAttempts: testMaxSweepAttempts,
|
||||||
NextAttemptDeltaFunc: func(attempts int) int32 {
|
MaxFeeRate: DefaultMaxFeeRate,
|
||||||
// Use delta func without random factor.
|
Aggregator: aggregator,
|
||||||
return 1 << uint(attempts-1)
|
|
||||||
},
|
|
||||||
MaxFeeRate: DefaultMaxFeeRate,
|
|
||||||
Aggregator: aggregator,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
ctx.sweeper.Start()
|
ctx.sweeper.Start()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user