|  | 
| 48 | 48 | 	defaultTotalPaymentTimeout = time.Minute * 60 | 
| 49 | 49 | 	defaultMaxPaymentRetries   = 3 | 
| 50 | 50 | 
 | 
|  | 51 | +	// defaultRPCBatchSize is the default batch size to use for RPC calls | 
|  | 52 | +	// we make to LND during migrations. If operations on the LND side are | 
|  | 53 | +	// too slow a too large batch size may prevent the migration from | 
|  | 54 | +	// completing. | 
|  | 55 | +	defaultRPCBatchSize = 1000 | 
|  | 56 | + | 
| 51 | 57 | 	// DefaultTLSCertFilename is the default file name for the autogenerated | 
| 52 | 58 | 	// TLS certificate. | 
| 53 | 59 | 	DefaultTLSCertFilename = "tls.cert" | 
| @@ -179,6 +185,8 @@ type Config struct { | 
| 179 | 185 | 
 | 
| 180 | 186 | 	EnableExperimental bool `long:"experimental" description:"Enable experimental features: reservations"` | 
| 181 | 187 | 
 | 
|  | 188 | +	MigrationRPCBatchSize int `long:"migrationrpcbatchsize" description:"The RPC batch size to use during migrations."` | 
|  | 189 | + | 
| 182 | 190 | 	Lnd *lndConfig `group:"lnd" namespace:"lnd"` | 
| 183 | 191 | 
 | 
| 184 | 192 | 	Server *loopServerConfig `group:"server" namespace:"server"` | 
| @@ -207,20 +215,21 @@ func DefaultConfig() Config { | 
| 207 | 215 | 		Sqlite: &loopdb.SqliteConfig{ | 
| 208 | 216 | 			DatabaseFileName: defaultSqliteDatabasePath, | 
| 209 | 217 | 		}, | 
| 210 |  | -		LogDir:              defaultLogDir, | 
| 211 |  | -		MaxLogFiles:         defaultMaxLogFiles, | 
| 212 |  | -		MaxLogFileSize:      defaultMaxLogFileSize, | 
| 213 |  | -		DebugLevel:          defaultLogLevel, | 
| 214 |  | -		TLSCertPath:         DefaultTLSCertPath, | 
| 215 |  | -		TLSKeyPath:          DefaultTLSKeyPath, | 
| 216 |  | -		TLSValidity:         DefaultAutogenValidity, | 
| 217 |  | -		MacaroonPath:        DefaultMacaroonPath, | 
| 218 |  | -		MaxL402Cost:         l402.DefaultMaxCostSats, | 
| 219 |  | -		MaxL402Fee:          l402.DefaultMaxRoutingFeeSats, | 
| 220 |  | -		LoopOutMaxParts:     defaultLoopOutMaxParts, | 
| 221 |  | -		TotalPaymentTimeout: defaultTotalPaymentTimeout, | 
| 222 |  | -		MaxPaymentRetries:   defaultMaxPaymentRetries, | 
| 223 |  | -		EnableExperimental:  false, | 
|  | 218 | +		LogDir:                defaultLogDir, | 
|  | 219 | +		MaxLogFiles:           defaultMaxLogFiles, | 
|  | 220 | +		MaxLogFileSize:        defaultMaxLogFileSize, | 
|  | 221 | +		DebugLevel:            defaultLogLevel, | 
|  | 222 | +		TLSCertPath:           DefaultTLSCertPath, | 
|  | 223 | +		TLSKeyPath:            DefaultTLSKeyPath, | 
|  | 224 | +		TLSValidity:           DefaultAutogenValidity, | 
|  | 225 | +		MacaroonPath:          DefaultMacaroonPath, | 
|  | 226 | +		MaxL402Cost:           l402.DefaultMaxCostSats, | 
|  | 227 | +		MaxL402Fee:            l402.DefaultMaxRoutingFeeSats, | 
|  | 228 | +		LoopOutMaxParts:       defaultLoopOutMaxParts, | 
|  | 229 | +		TotalPaymentTimeout:   defaultTotalPaymentTimeout, | 
|  | 230 | +		MaxPaymentRetries:     defaultMaxPaymentRetries, | 
|  | 231 | +		EnableExperimental:    false, | 
|  | 232 | +		MigrationRPCBatchSize: defaultRPCBatchSize, | 
| 224 | 233 | 		Lnd: &lndConfig{ | 
| 225 | 234 | 			Host:         "localhost:10009", | 
| 226 | 235 | 			MacaroonPath: DefaultLndMacaroonPath, | 
| @@ -367,6 +376,10 @@ func Validate(cfg *Config) error { | 
| 367 | 376 | 		return fmt.Errorf("TLS certificate minimum validity period is 24h") | 
| 368 | 377 | 	} | 
| 369 | 378 | 
 | 
|  | 379 | +	if cfg.MigrationRPCBatchSize <= 0 { | 
|  | 380 | +		return fmt.Errorf("migrationrpcbatchsize must be greater than 0") | 
|  | 381 | +	} | 
|  | 382 | + | 
| 370 | 383 | 	return nil | 
| 371 | 384 | } | 
| 372 | 385 | 
 | 
|  | 
0 commit comments