mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-01-18 21:35:24 +01:00
server+lncfg: make sweepr batch window duration configurable
This commit is contained in:
parent
1aa4d047fe
commit
2f27a52f7f
@ -41,6 +41,7 @@ import (
|
||||
"github.com/lightningnetwork/lnd/lnwallet"
|
||||
"github.com/lightningnetwork/lnd/routing"
|
||||
"github.com/lightningnetwork/lnd/signal"
|
||||
"github.com/lightningnetwork/lnd/sweep"
|
||||
"github.com/lightningnetwork/lnd/tor"
|
||||
)
|
||||
|
||||
@ -439,6 +440,8 @@ type Config struct {
|
||||
|
||||
RemoteSigner *lncfg.RemoteSigner `group:"remotesigner" namespace:"remotesigner"`
|
||||
|
||||
Sweeper *lncfg.Sweeper `group:"sweeper" namespace:"sweeper"`
|
||||
|
||||
// LogWriter is the root logger that all of the daemon's subloggers are
|
||||
// hooked up to.
|
||||
LogWriter *build.RotatingLogWriter
|
||||
@ -635,6 +638,9 @@ func DefaultConfig() Config {
|
||||
RemoteSigner: &lncfg.RemoteSigner{
|
||||
Timeout: lncfg.DefaultRemoteSignerRPCTimeout,
|
||||
},
|
||||
Sweeper: &lncfg.Sweeper{
|
||||
BatchWindowDuration: sweep.DefaultBatchWindowDuration,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@ -1651,6 +1657,7 @@ func ValidateConfig(cfg Config, interceptor signal.Interceptor, fileParser,
|
||||
cfg.HealthChecks,
|
||||
cfg.RPCMiddleware,
|
||||
cfg.RemoteSigner,
|
||||
cfg.Sweeper,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
19
lncfg/sweeper.go
Normal file
19
lncfg/sweeper.go
Normal file
@ -0,0 +1,19 @@
|
||||
package lncfg
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
)
|
||||
|
||||
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."`
|
||||
}
|
||||
|
||||
// Validate checks the values configured for the sweeper.
|
||||
func (s *Sweeper) Validate() error {
|
||||
if s.BatchWindowDuration < 0 {
|
||||
return fmt.Errorf("batchwindowduration must be positive")
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
@ -1415,3 +1415,10 @@ litecoin.node=ltcd
|
||||
; for neutrino nodes as it means they'll only maintain edges where both nodes are
|
||||
; seen as being live from it's PoV.
|
||||
; routing.strictgraphpruning=true
|
||||
|
||||
[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.
|
||||
; sweeper.batchwindowduration=30s
|
||||
|
||||
|
@ -1004,7 +1004,7 @@ func newServer(cfg *Config, listenAddrs []net.Addr,
|
||||
Signer: cc.Wallet.Cfg.Signer,
|
||||
Wallet: cc.Wallet,
|
||||
NewBatchTimer: func() <-chan time.Time {
|
||||
return time.NewTimer(sweep.DefaultBatchWindowDuration).C
|
||||
return time.NewTimer(cfg.Sweeper.BatchWindowDuration).C
|
||||
},
|
||||
Notifier: cc.ChainNotifier,
|
||||
Store: sweeperStore,
|
||||
|
Loading…
Reference in New Issue
Block a user