|
|
@ -33,9 +33,11 @@ var (
|
|
|
|
LoopDirBase, DefaultNetwork, defaultConfigFilename,
|
|
|
|
LoopDirBase, DefaultNetwork, defaultConfigFilename,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
defaultMaxLogFiles = 3
|
|
|
|
defaultMaxLogFiles = 3
|
|
|
|
defaultMaxLogFileSize = 10
|
|
|
|
defaultMaxLogFileSize = 10
|
|
|
|
defaultLoopOutMaxParts = uint32(5)
|
|
|
|
defaultLoopOutMaxParts = uint32(5)
|
|
|
|
|
|
|
|
defaultTotalPaymentTimeout = time.Minute * 60
|
|
|
|
|
|
|
|
defaultMaxPaymentRetries = 3
|
|
|
|
|
|
|
|
|
|
|
|
// DefaultTLSCertFilename is the default file name for the autogenerated
|
|
|
|
// DefaultTLSCertFilename is the default file name for the autogenerated
|
|
|
|
// TLS certificate.
|
|
|
|
// TLS certificate.
|
|
|
@ -144,6 +146,9 @@ type Config struct {
|
|
|
|
|
|
|
|
|
|
|
|
LoopOutMaxParts uint32 `long:"loopoutmaxparts" description:"The maximum number of payment parts that may be used for a loop out swap."`
|
|
|
|
LoopOutMaxParts uint32 `long:"loopoutmaxparts" description:"The maximum number of payment parts that may be used for a loop out swap."`
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TotalPaymentTimeout time.Duration `long:"totalpaymenttimeout" description:"The timeout to use for off-chain payments."`
|
|
|
|
|
|
|
|
MaxPaymentRetries int `long:"maxpaymentretries" description:"The maximum number of times an off-chain payment may be retried."`
|
|
|
|
|
|
|
|
|
|
|
|
Lnd *lndConfig `group:"lnd" namespace:"lnd"`
|
|
|
|
Lnd *lndConfig `group:"lnd" namespace:"lnd"`
|
|
|
|
|
|
|
|
|
|
|
|
Server *loopServerConfig `group:"server" namespace:"server"`
|
|
|
|
Server *loopServerConfig `group:"server" namespace:"server"`
|
|
|
@ -165,19 +170,21 @@ func DefaultConfig() Config {
|
|
|
|
Server: &loopServerConfig{
|
|
|
|
Server: &loopServerConfig{
|
|
|
|
NoTLS: false,
|
|
|
|
NoTLS: false,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
LoopDir: LoopDirBase,
|
|
|
|
LoopDir: LoopDirBase,
|
|
|
|
ConfigFile: defaultConfigFile,
|
|
|
|
ConfigFile: defaultConfigFile,
|
|
|
|
DataDir: LoopDirBase,
|
|
|
|
DataDir: LoopDirBase,
|
|
|
|
LogDir: defaultLogDir,
|
|
|
|
LogDir: defaultLogDir,
|
|
|
|
MaxLogFiles: defaultMaxLogFiles,
|
|
|
|
MaxLogFiles: defaultMaxLogFiles,
|
|
|
|
MaxLogFileSize: defaultMaxLogFileSize,
|
|
|
|
MaxLogFileSize: defaultMaxLogFileSize,
|
|
|
|
DebugLevel: defaultLogLevel,
|
|
|
|
DebugLevel: defaultLogLevel,
|
|
|
|
TLSCertPath: DefaultTLSCertPath,
|
|
|
|
TLSCertPath: DefaultTLSCertPath,
|
|
|
|
TLSKeyPath: DefaultTLSKeyPath,
|
|
|
|
TLSKeyPath: DefaultTLSKeyPath,
|
|
|
|
MacaroonPath: DefaultMacaroonPath,
|
|
|
|
MacaroonPath: DefaultMacaroonPath,
|
|
|
|
MaxLSATCost: lsat.DefaultMaxCostSats,
|
|
|
|
MaxLSATCost: lsat.DefaultMaxCostSats,
|
|
|
|
MaxLSATFee: lsat.DefaultMaxRoutingFeeSats,
|
|
|
|
MaxLSATFee: lsat.DefaultMaxRoutingFeeSats,
|
|
|
|
LoopOutMaxParts: defaultLoopOutMaxParts,
|
|
|
|
LoopOutMaxParts: defaultLoopOutMaxParts,
|
|
|
|
|
|
|
|
TotalPaymentTimeout: defaultTotalPaymentTimeout,
|
|
|
|
|
|
|
|
MaxPaymentRetries: defaultMaxPaymentRetries,
|
|
|
|
Lnd: &lndConfig{
|
|
|
|
Lnd: &lndConfig{
|
|
|
|
Host: "localhost:10009",
|
|
|
|
Host: "localhost:10009",
|
|
|
|
MacaroonPath: DefaultLndMacaroonPath,
|
|
|
|
MacaroonPath: DefaultLndMacaroonPath,
|
|
|
@ -299,6 +306,17 @@ func Validate(cfg *Config) error {
|
|
|
|
return fmt.Errorf("must specify --lnd.macaroonpath")
|
|
|
|
return fmt.Errorf("must specify --lnd.macaroonpath")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Allow at most 2x the default total payment timeout.
|
|
|
|
|
|
|
|
if cfg.TotalPaymentTimeout > 2*defaultTotalPaymentTimeout {
|
|
|
|
|
|
|
|
return fmt.Errorf("max total payment timeout allowed is at "+
|
|
|
|
|
|
|
|
"most %v", 2*defaultTotalPaymentTimeout)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// At least one retry.
|
|
|
|
|
|
|
|
if cfg.MaxPaymentRetries < 1 {
|
|
|
|
|
|
|
|
return fmt.Errorf("max payment retries must be positive")
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return nil
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|