multi: add block cache size config

This commit adds block cache size to the main lnd config along with the
chainreg config.
This commit is contained in:
Elle Mouton 2021-03-18 13:40:53 +02:00
parent 275d55c9e6
commit 6702c79216
4 changed files with 17 additions and 0 deletions

View File

@ -73,6 +73,9 @@ type Config struct {
// RemoteChanDB is a pointer to the remote backing channel database.
RemoteChanDB *channeldb.DB
// BlockCacheSize is the size (in bytes) of blocks kept in memory.
BlockCacheSize uint64
// PrivateWalletPw is the private wallet password to the underlying
// btcwallet instance.
PrivateWalletPw []byte

View File

@ -101,6 +101,10 @@ const (
// initiated the channel closure.
defaultCoopCloseTargetConfs = 6
// defaultBlockCacheSize is the size (in bytes) of blocks that will be
// keep in memory if no size is specified.
defaultBlockCacheSize uint64 = 20 * 1024 * 1024 // 20 MB
// defaultHostSampleInterval is the default amount of time that the
// HostAnnouncer will wait between DNS resolutions to check if the
// backing IP of a host has changed.
@ -273,6 +277,8 @@ type Config struct {
LtcdMode *lncfg.Btcd `group:"ltcd" namespace:"ltcd"`
LitecoindMode *lncfg.Bitcoind `group:"litecoind" namespace:"litecoind"`
BlockCacheSize uint64 `long:"blockcachesize" description:"The maximum capacity of the block cache"`
Autopilot *lncfg.AutoPilot `group:"Autopilot" namespace:"autopilot"`
Tor *lncfg.Tor `group:"Tor" namespace:"tor"`
@ -434,6 +440,7 @@ func DefaultConfig() Config {
UserAgentName: neutrino.UserAgentName,
UserAgentVersion: neutrino.UserAgentVersion,
},
BlockCacheSize: defaultBlockCacheSize,
UnsafeDisconnect: true,
MaxPendingChannels: lncfg.DefaultMaxPendingChannels,
NoSeedBackup: defaultNoSeedBackup,

1
lnd.go
View File

@ -546,6 +546,7 @@ func Main(cfg *Config, lisCfg ListenerCfg, interceptor signal.Interceptor) error
Dialer: func(addr string) (net.Conn, error) {
return cfg.net.Dial("tcp", addr, cfg.ConnectionTimeout)
},
BlockCacheSize: cfg.BlockCacheSize,
}
activeChainControl, cleanup, err := chainreg.NewChainControl(chainControlCfg)

View File

@ -224,6 +224,12 @@
; The target location of the channel backup file.
; backupfilepath=~/.lnd/data/chain/bitcoin/simnet/channel.backup
; The maximum capacity of the block cache in bytes. Increasing this will result
; in more blocks being kept in memory but will increase performance when the
; same block is required multiple times.
; The example value below is 40 MB (1024 * 1024 * 40)
; blockcachesize=41943040
; Optional URL for external fee estimation. If no URL is specified, the method
; for fee estimation will depend on the chosen backend and network. Must be set
; for neutrino on mainnet.