config: add sync freelist cli flag

This commit is contained in:
Wilmer Paulino 2019-10-04 11:20:04 -04:00
parent fa96450db8
commit b63ed5ad56
No known key found for this signature in database
GPG Key ID: 6DF57B9F9514972F
3 changed files with 6 additions and 3 deletions

View File

@ -703,7 +703,7 @@ func initNeutrinoBackend(chainDir string) (*neutrino.ChainService, func(), error
}
dbName := filepath.Join(dbPath, "neutrino.db")
db, err := walletdb.Create("bdb", dbName, true)
db, err := walletdb.Create("bdb", dbName, !cfg.SyncFreelist)
if err != nil {
return nil, nil, fmt.Errorf("unable to create neutrino "+
"database: %v", err)

View File

@ -234,6 +234,7 @@ type config struct {
LndDir string `long:"lnddir" description:"The base directory that contains lnd's data, logs, configuration file, etc."`
ConfigFile string `short:"C" long:"configfile" description:"Path to configuration file"`
DataDir string `short:"b" long:"datadir" description:"The directory to store lnd's data within"`
SyncFreelist bool `long:"sync-freelist" description:"Whether the databases used within lnd should sync their freelist to disk. This is disabled by default resulting in improved memory performance during operation, but with an increase in startup time."`
TLSCertPath string `long:"tlscertpath" description:"Path to write the TLS certificate for lnd's RPC and REST services"`
TLSKeyPath string `long:"tlskeypath" description:"Path to write the TLS private key for lnd's RPC and REST services"`
TLSExtraIPs []string `long:"tlsextraip" description:"Adds an extra ip to the generated certificate"`

6
lnd.go
View File

@ -190,6 +190,7 @@ func Main(lisCfg ListenerCfg) error {
graphDir,
channeldb.OptionSetRejectCacheSize(cfg.Caches.RejectCacheSize),
channeldb.OptionSetChannelCacheSize(cfg.Caches.ChannelCacheSize),
channeldb.OptionSetSyncFreelist(cfg.SyncFreelist),
)
if err != nil {
err := fmt.Errorf("Unable to open channeldb: %v", err)
@ -1000,7 +1001,7 @@ func waitForWalletPassword(restEndpoints []net.Addr,
cfg.AdminMacPath, cfg.ReadMacPath, cfg.InvoiceMacPath,
}
pwService := walletunlocker.New(
chainConfig.ChainDir, activeNetParams.Params, true,
chainConfig.ChainDir, activeNetParams.Params, !cfg.SyncFreelist,
macaroonFiles,
)
lnrpc.RegisterWalletUnlockerServer(grpcServer, pwService)
@ -1094,7 +1095,8 @@ func waitForWalletPassword(restEndpoints []net.Addr,
chainConfig.ChainDir, activeNetParams.Params,
)
loader := wallet.NewLoader(
activeNetParams.Params, netDir, true, recoveryWindow,
activeNetParams.Params, netDir, !cfg.SyncFreelist,
recoveryWindow,
)
// With the seed, we can now use the wallet loader to create