multi: deprecate batchwindowduration config option

This commit is contained in:
yyforyongyu 2024-01-31 14:06:47 +08:00
parent c03509397f
commit 465332f409
No known key found for this signature in database
GPG Key ID: 9BCD95C4FF296868
8 changed files with 9 additions and 32 deletions

View File

@ -286,8 +286,6 @@ var bumpCloseFeeCommand = cli.Command{
to sweep the anchor outputs of the closing transaction at the requested to sweep the anchor outputs of the closing transaction at the requested
fee rate or confirmation target. The specified fee rate will be the fee rate or confirmation target. The specified fee rate will be the
effective fee rate taking the parent fee into account. 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. NOTE: This cmd is DEPRECATED please use bumpforceclosefee instead.
`, `,
Flags: []cli.Flag{ Flags: []cli.Flag{
@ -321,8 +319,6 @@ var bumpForceCloseFeeCommand = cli.Command{
to sweep the anchor outputs of the closing transaction at the requested to sweep the anchor outputs of the closing transaction at the requested
fee rate or confirmation target. The specified fee rate will be the fee rate or confirmation target. The specified fee rate will be the
effective fee rate taking the parent fee into account. 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{ Flags: []cli.Flag{
cli.Uint64Flag{ cli.Uint64Flag{

View File

@ -690,8 +690,7 @@ func DefaultConfig() Config {
Timeout: lncfg.DefaultRemoteSignerRPCTimeout, Timeout: lncfg.DefaultRemoteSignerRPCTimeout,
}, },
Sweeper: &lncfg.Sweeper{ Sweeper: &lncfg.Sweeper{
BatchWindowDuration: sweep.DefaultBatchWindowDuration, MaxFeeRate: sweep.DefaultMaxFeeRate,
MaxFeeRate: sweep.DefaultMaxFeeRate,
}, },
Htlcswitch: &lncfg.Htlcswitch{ Htlcswitch: &lncfg.Htlcswitch{
MailboxDeliveryTimeout: htlcswitch.DefaultMailboxDeliveryTimeout, MailboxDeliveryTimeout: htlcswitch.DefaultMailboxDeliveryTimeout,

View File

@ -19,7 +19,7 @@ const (
//nolint:lll //nolint:lll
type Sweeper struct { 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."` 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."`
} }

View File

@ -1612,8 +1612,9 @@
[sweeper] [sweeper]
; Duration of the sweep batch window. The sweep is held back during the batch ; DEPRECATED: Duration of the sweep batch window. The sweep is held back during
; window to allow more inputs to be added and thereby lower the fee per input. ; the batch window to allow more inputs to be added and thereby lower the fee
; per input.
; sweeper.batchwindowduration=30s ; sweeper.batchwindowduration=30s
; The max fee rate in sat/vb which can be used when sweeping funds. Setting ; The max fee rate in sat/vb which can be used when sweeping funds. Setting

View File

@ -1052,9 +1052,6 @@ func newServer(cfg *Config, listenAddrs []net.Addr,
return nil, err return nil, err
} }
srvrLog.Debugf("Sweeper batch window duration: %v",
cfg.Sweeper.BatchWindowDuration)
sweeperStore, err := sweep.NewSweeperStore( sweeperStore, err := sweep.NewSweeperStore(
dbs.ChanStateDB, s.cfg.ActiveNetParams.GenesisHash, dbs.ChanStateDB, s.cfg.ActiveNetParams.GenesisHash,
) )
@ -1073,7 +1070,6 @@ func newServer(cfg *Config, listenAddrs []net.Addr,
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,
Mempool: cc.MempoolNotifier, Mempool: cc.MempoolNotifier,
Notifier: cc.ChainNotifier, Notifier: cc.ChainNotifier,
Store: sweeperStore, Store: sweeperStore,

View File

@ -1,17 +1,10 @@
package sweep package sweep
import ( import (
"time"
"github.com/lightningnetwork/lnd/lnwallet/chainfee" "github.com/lightningnetwork/lnd/lnwallet/chainfee"
) )
var ( 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 // DefaultMaxFeeRate is the default maximum fee rate allowed within the
// UtxoSweeper. The current value is equivalent to a fee rate of 1,000 // UtxoSweeper. The current value is equivalent to a fee rate of 1,000
// sat/vbyte. // sat/vbyte.

View File

@ -5,7 +5,6 @@ import (
"fmt" "fmt"
"sync" "sync"
"sync/atomic" "sync/atomic"
"time"
"github.com/btcsuite/btcd/btcutil" "github.com/btcsuite/btcd/btcutil"
"github.com/btcsuite/btcd/chaincfg/chainhash" "github.com/btcsuite/btcd/chaincfg/chainhash"
@ -318,12 +317,6 @@ type UtxoSweeperConfig struct {
// Wallet contains the wallet functions that sweeper requires. // Wallet contains the wallet functions that sweeper requires.
Wallet Wallet 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 // Notifier is an instance of a chain notifier we'll use to watch for
// certain on-chain events. // certain on-chain events.
Notifier chainntnfs.ChainNotifier Notifier chainntnfs.ChainNotifier

View File

@ -138,11 +138,10 @@ func createSweeperTestContext(t *testing.T) *sweeperTestContext {
} }
ctx.sweeper = New(&UtxoSweeperConfig{ ctx.sweeper = New(&UtxoSweeperConfig{
Notifier: notifier, Notifier: notifier,
Wallet: backend, Wallet: backend,
TickerDuration: 100 * time.Millisecond, Store: store,
Store: store, Signer: &lnmock.DummySigner{},
Signer: &lnmock.DummySigner{},
GenSweepScript: func() ([]byte, error) { GenSweepScript: func() ([]byte, error) {
script := make([]byte, input.P2WPKHSize) script := make([]byte, input.P2WPKHSize)
script[0] = 0 script[0] = 0