From 87f58a274bc59fb7e30f7bdf714c6373592d4e2f Mon Sep 17 00:00:00 2001 From: yyforyongyu Date: Thu, 28 Apr 2022 06:53:46 +0800 Subject: [PATCH] multi: add the flag `prune-revocation` to perform the optional migration --- config_builder.go | 1 + lncfg/db.go | 2 ++ sample-lnd.conf | 6 ++++++ 3 files changed, 9 insertions(+) diff --git a/config_builder.go b/config_builder.go index d43834e0d..214898157 100644 --- a/config_builder.go +++ b/config_builder.go @@ -857,6 +857,7 @@ func (d *DefaultDatabaseBuilder) BuildDatabase( channeldb.OptionDryRunMigration(cfg.DryRunMigration), channeldb.OptionSetUseGraphCache(!cfg.DB.NoGraphCache), channeldb.OptionKeepFailedPaymentAttempts(cfg.KeepFailedPaymentAttempts), + channeldb.OptionPruneRevocationLog(cfg.DB.PruneRevocation), } // We want to pre-allocate the channel graph cache according to what we diff --git a/lncfg/db.go b/lncfg/db.go index 34c7f2137..d60e5609c 100644 --- a/lncfg/db.go +++ b/lncfg/db.go @@ -61,6 +61,8 @@ type DB struct { Postgres *postgres.Config `group:"postgres" namespace:"postgres" description:"Postgres settings."` 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."` + + PruneRevocation bool `long:"prune-revocation" description:"Run the optional migration that prunes the revocation logs to save disk space."` } // DefaultDB creates and returns a new default DB config. diff --git a/sample-lnd.conf b/sample-lnd.conf index 0fd701c66..5904918ab 100644 --- a/sample-lnd.conf +++ b/sample-lnd.conf @@ -1205,6 +1205,12 @@ litecoin.node=ltcd ; less RAM. Can only be used with a bolt database backend. ; db.no-graph-cache=true +; 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. +; db.prune-revocation=false + + [etcd] ; Etcd database host.