diff --git a/config_builder.go b/config_builder.go index 647d265bd..0f563d6f2 100644 --- a/config_builder.go +++ b/config_builder.go @@ -1056,6 +1056,9 @@ func (d *DefaultDatabaseBuilder) BuildDatabase( chanGraphOpts := []graphdb.ChanGraphOption{ graphdb.WithUseGraphCache(!cfg.DB.NoGraphCache), + graphdb.WithAsyncGraphCachePopulation( + !cfg.DB.SyncGraphCacheLoad, + ), } // We want to pre-allocate the channel graph cache according to what we diff --git a/lncfg/db.go b/lncfg/db.go index 6835382e2..4a8680b38 100644 --- a/lncfg/db.go +++ b/lncfg/db.go @@ -89,6 +89,8 @@ type DB struct { NoGraphCache bool `long:"no-graph-cache" description:"Don't use the in-memory graph cache for path finding. Much slower but uses less RAM. Can only be used with a bolt database backend."` + SyncGraphCacheLoad bool `long:"sync-graph-cache-load" description:"Force synchronous loading of the graph cache. This will block the startup until the graph cache is fully loaded into memory. This is useful if any bugs appear with the new async loading feature of the graph cache."` + PruneRevocation bool `long:"prune-revocation" description:"Run the optional migration that prunes the revocation logs to save disk space."` NoRevLogAmtData bool `long:"no-rev-log-amt-data" description:"If set, the to-local and to-remote output amounts of revoked commitment transactions will not be stored in the revocation log. Note that once this data is lost, a watchtower client will not be able to back up the revoked state."` diff --git a/sample-lnd.conf b/sample-lnd.conf index f874fadcb..6f3d84934 100644 --- a/sample-lnd.conf +++ b/sample-lnd.conf @@ -1501,6 +1501,12 @@ ; less RAM. Can only be used with a bolt database backend. ; db.no-graph-cache=false +; Block the start-up of LND until the graph cache has been fully populated. +; If not set, the graph cache will be populated asynchronously and any read +; calls made before the cache is fully populated will fall back to the +; database. +; db.sync-graph-cache-load=false + ; Specify whether the optional migration for pruning old revocation logs ; should be applied. This migration will only save disk space if there are open ; channels prior to lnd@v0.15.0.