3333 LoopDirBase , DefaultNetwork , defaultConfigFilename ,
3434 )
3535
36- defaultMaxLogFiles = 3
37- defaultMaxLogFileSize = 10
38- defaultLoopOutMaxParts = uint32 (5 )
36+ defaultMaxLogFiles = 3
37+ defaultMaxLogFileSize = 10
38+ defaultLoopOutMaxParts = uint32 (5 )
39+ defaultTotalPaymentTimeout = time .Minute * 60
40+ defaultMaxPaymentRetries = 3
3941
4042 // DefaultTLSCertFilename is the default file name for the autogenerated
4143 // TLS certificate.
@@ -144,6 +146,9 @@ type Config struct {
144146
145147 LoopOutMaxParts uint32 `long:"loopoutmaxparts" description:"The maximum number of payment parts that may be used for a loop out swap."`
146148
149+ TotalPaymentTimeout time.Duration `long:"totalpaymenttimeout" description:"The timeout to use for off-chain payments."`
150+ MaxPaymentRetries int `long:"maxpaymentretries" description:"The maximum number of times an off-chain payment may be retried."`
151+
147152 Lnd * lndConfig `group:"lnd" namespace:"lnd"`
148153
149154 Server * loopServerConfig `group:"server" namespace:"server"`
@@ -165,19 +170,21 @@ func DefaultConfig() Config {
165170 Server : & loopServerConfig {
166171 NoTLS : false ,
167172 },
168- LoopDir : LoopDirBase ,
169- ConfigFile : defaultConfigFile ,
170- DataDir : LoopDirBase ,
171- LogDir : defaultLogDir ,
172- MaxLogFiles : defaultMaxLogFiles ,
173- MaxLogFileSize : defaultMaxLogFileSize ,
174- DebugLevel : defaultLogLevel ,
175- TLSCertPath : DefaultTLSCertPath ,
176- TLSKeyPath : DefaultTLSKeyPath ,
177- MacaroonPath : DefaultMacaroonPath ,
178- MaxLSATCost : lsat .DefaultMaxCostSats ,
179- MaxLSATFee : lsat .DefaultMaxRoutingFeeSats ,
180- LoopOutMaxParts : defaultLoopOutMaxParts ,
173+ LoopDir : LoopDirBase ,
174+ ConfigFile : defaultConfigFile ,
175+ DataDir : LoopDirBase ,
176+ LogDir : defaultLogDir ,
177+ MaxLogFiles : defaultMaxLogFiles ,
178+ MaxLogFileSize : defaultMaxLogFileSize ,
179+ DebugLevel : defaultLogLevel ,
180+ TLSCertPath : DefaultTLSCertPath ,
181+ TLSKeyPath : DefaultTLSKeyPath ,
182+ MacaroonPath : DefaultMacaroonPath ,
183+ MaxLSATCost : lsat .DefaultMaxCostSats ,
184+ MaxLSATFee : lsat .DefaultMaxRoutingFeeSats ,
185+ LoopOutMaxParts : defaultLoopOutMaxParts ,
186+ TotalPaymentTimeout : defaultTotalPaymentTimeout ,
187+ MaxPaymentRetries : defaultMaxPaymentRetries ,
181188 Lnd : & lndConfig {
182189 Host : "localhost:10009" ,
183190 MacaroonPath : DefaultLndMacaroonPath ,
@@ -299,6 +306,17 @@ func Validate(cfg *Config) error {
299306 return fmt .Errorf ("must specify --lnd.macaroonpath" )
300307 }
301308
309+ // Allow at most 2x the default total payment timeout.
310+ if cfg .TotalPaymentTimeout > 2 * defaultTotalPaymentTimeout {
311+ return fmt .Errorf ("max total payment timeout allowed is at " +
312+ "most %v" , 2 * defaultTotalPaymentTimeout )
313+ }
314+
315+ // At least one retry.
316+ if cfg .MaxPaymentRetries < 1 {
317+ return fmt .Errorf ("max payment retries must be positive" )
318+ }
319+
302320 return nil
303321}
304322
0 commit comments