diff --git a/config.go b/config.go index 02aff622..bc599a16 100644 --- a/config.go +++ b/config.go @@ -340,6 +340,8 @@ type config struct { MaxChannelFeeAllocation float64 `long:"max-channel-fee-allocation" description:"The maximum percentage of total funds that can be allocated to a channel's commitment fee. This only applies for the initiator of the channel. Valid values are within [0.1, 1]."` + DryRunMigration bool `long:"dry-run-migration" description:"If true, lnd will abort committing a migration if it would otherwise have been successful. This leaves the database unmodified, and still compatible with the previously active version of lnd."` + net tor.Net EnableUpfrontShutdown bool `long:"enable-upfront-shutdown" description:"If true, option upfront shutdown script will be enabled. If peers that we open channels with support this feature, we will automatically set the script to which cooperative closes should be paid out to on channel open. This offers the partial protection of a channel peer disconnecting from us if cooperative close is attempted with a different script."` diff --git a/lnd.go b/lnd.go index 98603c39..291a33cf 100644 --- a/lnd.go +++ b/lnd.go @@ -235,10 +235,15 @@ func Main(lisCfg ListenerCfg) error { channeldb.OptionSetRejectCacheSize(cfg.Caches.RejectCacheSize), channeldb.OptionSetChannelCacheSize(cfg.Caches.ChannelCacheSize), channeldb.OptionSetSyncFreelist(cfg.SyncFreelist), + channeldb.OptionDryRunMigration(cfg.DryRunMigration), ) - if err != nil { - err := fmt.Errorf("unable to open channeldb: %v", err) - ltndLog.Error(err) + switch { + case err == channeldb.ErrDryRunMigrationOK: + ltndLog.Info("%v, exiting", err) + return nil + + case err != nil: + ltndLog.Errorf("Unable to open channeldb: %v", err) return err } defer chanDB.Close()