server+lncfg: make sweepr batch window duration configurable
This commit is contained in:
4 files changed
+34
-1
No files matched your search
@@ -41,6 +41,7 @@ import (
|
|||||||
"github.com/lightningnetwork/lnd/lnwallet"
|
"github.com/lightningnetwork/lnd/lnwallet"
|
||||||
"github.com/lightningnetwork/lnd/routing"
|
"github.com/lightningnetwork/lnd/routing"
|
||||||
"github.com/lightningnetwork/lnd/signal"
|
"github.com/lightningnetwork/lnd/signal"
|
||||||
|
"github.com/lightningnetwork/lnd/sweep"
|
||||||
"github.com/lightningnetwork/lnd/tor"
|
"github.com/lightningnetwork/lnd/tor"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -439,6 +440,8 @@ type Config struct {
|
|||||||
|
|
||||||
RemoteSigner *lncfg.RemoteSigner `group:"remotesigner" namespace:"remotesigner"`
|
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
|
// LogWriter is the root logger that all of the daemon's subloggers are
|
||||||
// hooked up to.
|
// hooked up to.
|
||||||
LogWriter *build.RotatingLogWriter
|
LogWriter *build.RotatingLogWriter
|
||||||
@@ -635,6 +638,9 @@ func DefaultConfig() Config {
|
|||||||
RemoteSigner: &lncfg.RemoteSigner{
|
RemoteSigner: &lncfg.RemoteSigner{
|
||||||
Timeout: lncfg.DefaultRemoteSignerRPCTimeout,
|
Timeout: lncfg.DefaultRemoteSignerRPCTimeout,
|
||||||
},
|
},
|
||||||
|
Sweeper: &lncfg.Sweeper{
|
||||||
|
BatchWindowDuration: sweep.DefaultBatchWindowDuration,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1651,6 +1657,7 @@ func ValidateConfig(cfg Config, interceptor signal.Interceptor, fileParser,
|
|||||||
cfg.HealthChecks,
|
cfg.HealthChecks,
|
||||||
cfg.RPCMiddleware,
|
cfg.RPCMiddleware,
|
||||||
cfg.RemoteSigner,
|
cfg.RemoteSigner,
|
||||||
|
cfg.Sweeper,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|||||||
@@ -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
|
; for neutrino nodes as it means they'll only maintain edges where both nodes are
|
||||||
; seen as being live from it's PoV.
|
; seen as being live from it's PoV.
|
||||||
; routing.strictgraphpruning=true
|
; 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,
|
Signer: cc.Wallet.Cfg.Signer,
|
||||||
Wallet: cc.Wallet,
|
Wallet: cc.Wallet,
|
||||||
NewBatchTimer: func() <-chan time.Time {
|
NewBatchTimer: func() <-chan time.Time {
|
||||||
return time.NewTimer(sweep.DefaultBatchWindowDuration).C
|
return time.NewTimer(cfg.Sweeper.BatchWindowDuration).C
|
||||||
},
|
},
|
||||||
Notifier: cc.ChainNotifier,
|
Notifier: cc.ChainNotifier,
|
||||||
Store: sweeperStore,
|
Store: sweeperStore,
|
||||||
|
|||||||
Reference in new issue
Block a user