config: adds cli configurable --migration-dry-run

This commit is contained in:
Conner Fromknecht 2020-05-11 15:38:56 -07:00
parent c775819372
commit 4f6cef83fc
No known key found for this signature in database
GPG Key ID: E7D737B67FA592C7
2 changed files with 10 additions and 3 deletions

View File

@ -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."`

11
lnd.go
View File

@ -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()