From 465332f4091a308ecefcb481bb0ebe03059ee213 Mon Sep 17 00:00:00 2001 From: yyforyongyu Date: Wed, 31 Jan 2024 14:06:47 +0800 Subject: [PATCH] multi: deprecate `batchwindowduration` config option --- cmd/lncli/walletrpc_active.go | 4 ---- config.go | 3 +-- lncfg/sweeper.go | 2 +- sample-lnd.conf | 5 +++-- server.go | 4 ---- sweep/defaults.go | 7 ------- sweep/sweeper.go | 7 ------- sweep/sweeper_test.go | 9 ++++----- 8 files changed, 9 insertions(+), 32 deletions(-) diff --git a/cmd/lncli/walletrpc_active.go b/cmd/lncli/walletrpc_active.go index bb1fb4ecc..4951f2f32 100644 --- a/cmd/lncli/walletrpc_active.go +++ b/cmd/lncli/walletrpc_active.go @@ -286,8 +286,6 @@ var bumpCloseFeeCommand = cli.Command{ to sweep the anchor outputs of the closing transaction at the requested fee rate or confirmation target. The specified fee rate will be the effective fee rate taking the parent fee into account. - Depending on the sweeper configuration (batchwindowduration) the sweeptx - will not be published immediately. NOTE: This cmd is DEPRECATED please use bumpforceclosefee instead. `, Flags: []cli.Flag{ @@ -321,8 +319,6 @@ var bumpForceCloseFeeCommand = cli.Command{ to sweep the anchor outputs of the closing transaction at the requested fee rate or confirmation target. The specified fee rate will be the effective fee rate taking the parent fee into account. - Depending on the sweeper configuration (batchwindowduration) the sweeptx - will not be published immediately. `, Flags: []cli.Flag{ cli.Uint64Flag{ diff --git a/config.go b/config.go index 384995087..e14b9af0a 100644 --- a/config.go +++ b/config.go @@ -690,8 +690,7 @@ func DefaultConfig() Config { Timeout: lncfg.DefaultRemoteSignerRPCTimeout, }, Sweeper: &lncfg.Sweeper{ - BatchWindowDuration: sweep.DefaultBatchWindowDuration, - MaxFeeRate: sweep.DefaultMaxFeeRate, + MaxFeeRate: sweep.DefaultMaxFeeRate, }, Htlcswitch: &lncfg.Htlcswitch{ MailboxDeliveryTimeout: htlcswitch.DefaultMailboxDeliveryTimeout, diff --git a/lncfg/sweeper.go b/lncfg/sweeper.go index 08b12f6da..5bd3b1964 100644 --- a/lncfg/sweeper.go +++ b/lncfg/sweeper.go @@ -19,7 +19,7 @@ const ( //nolint:lll type Sweeper struct { - BatchWindowDuration time.Duration `long:"batchwindowduration" description:"Duration of the sweep batch window. The sweep is held back during the batch window to allow more inputs to be added and thereby lower the fee per input."` + BatchWindowDuration time.Duration `long:"batchwindowduration" description:"Duration of the sweep batch window. The sweep is held back during the batch window to allow more inputs to be added and thereby lower the fee per input." hidden:"true"` MaxFeeRate chainfee.SatPerVByte `long:"maxfeerate" description:"Maximum fee rate in sat/vb that the sweeper is allowed to use when sweeping funds. Setting this value too low can result in transactions not being confirmed in time, causing HTLCs to expire hence potentially losing funds."` } diff --git a/sample-lnd.conf b/sample-lnd.conf index 08a79bde5..9cbc29fa9 100644 --- a/sample-lnd.conf +++ b/sample-lnd.conf @@ -1612,8 +1612,9 @@ [sweeper] -; Duration of the sweep batch window. The sweep is held back during the batch -; window to allow more inputs to be added and thereby lower the fee per input. +; DEPRECATED: Duration of the sweep batch window. The sweep is held back during +; the batch window to allow more inputs to be added and thereby lower the fee +; per input. ; sweeper.batchwindowduration=30s ; The max fee rate in sat/vb which can be used when sweeping funds. Setting diff --git a/server.go b/server.go index b64378376..d38257048 100644 --- a/server.go +++ b/server.go @@ -1052,9 +1052,6 @@ func newServer(cfg *Config, listenAddrs []net.Addr, return nil, err } - srvrLog.Debugf("Sweeper batch window duration: %v", - cfg.Sweeper.BatchWindowDuration) - sweeperStore, err := sweep.NewSweeperStore( dbs.ChanStateDB, s.cfg.ActiveNetParams.GenesisHash, ) @@ -1073,7 +1070,6 @@ func newServer(cfg *Config, listenAddrs []net.Addr, GenSweepScript: newSweepPkScriptGen(cc.Wallet), Signer: cc.Wallet.Cfg.Signer, Wallet: newSweeperWallet(cc.Wallet), - TickerDuration: cfg.Sweeper.BatchWindowDuration, Mempool: cc.MempoolNotifier, Notifier: cc.ChainNotifier, Store: sweeperStore, diff --git a/sweep/defaults.go b/sweep/defaults.go index 3ea492190..fc5d12faf 100644 --- a/sweep/defaults.go +++ b/sweep/defaults.go @@ -1,17 +1,10 @@ package sweep import ( - "time" - "github.com/lightningnetwork/lnd/lnwallet/chainfee" ) var ( - // DefaultBatchWindowDuration specifies duration of the sweep batch - // window. The sweep is held back during the batch window to allow more - // inputs to be added and thereby lower the fee per input. - DefaultBatchWindowDuration = 30 * time.Second - // DefaultMaxFeeRate is the default maximum fee rate allowed within the // UtxoSweeper. The current value is equivalent to a fee rate of 1,000 // sat/vbyte. diff --git a/sweep/sweeper.go b/sweep/sweeper.go index a785bdacc..8fb2c84c1 100644 --- a/sweep/sweeper.go +++ b/sweep/sweeper.go @@ -5,7 +5,6 @@ import ( "fmt" "sync" "sync/atomic" - "time" "github.com/btcsuite/btcd/btcutil" "github.com/btcsuite/btcd/chaincfg/chainhash" @@ -318,12 +317,6 @@ type UtxoSweeperConfig struct { // Wallet contains the wallet functions that sweeper requires. Wallet Wallet - // TickerDuration is used to create a channel that will be sent on when - // a certain time window has passed. During this time window, new - // inputs can still be added to the sweep tx that is about to be - // generated. - TickerDuration time.Duration - // Notifier is an instance of a chain notifier we'll use to watch for // certain on-chain events. Notifier chainntnfs.ChainNotifier diff --git a/sweep/sweeper_test.go b/sweep/sweeper_test.go index 7396407b7..f3e4fb16f 100644 --- a/sweep/sweeper_test.go +++ b/sweep/sweeper_test.go @@ -138,11 +138,10 @@ func createSweeperTestContext(t *testing.T) *sweeperTestContext { } ctx.sweeper = New(&UtxoSweeperConfig{ - Notifier: notifier, - Wallet: backend, - TickerDuration: 100 * time.Millisecond, - Store: store, - Signer: &lnmock.DummySigner{}, + Notifier: notifier, + Wallet: backend, + Store: store, + Signer: &lnmock.DummySigner{}, GenSweepScript: func() ([]byte, error) { script := make([]byte, input.P2WPKHSize) script[0] = 0