mirror of
https://github.com/lightningnetwork/lnd.git
synced 2024-11-19 01:43:16 +01:00
84fd911b47
Fixes new lint errors caught by the latest version.
35 lines
1.0 KiB
Go
35 lines
1.0 KiB
Go
package lncfg
|
|
|
|
import (
|
|
"fmt"
|
|
"time"
|
|
)
|
|
|
|
var (
|
|
// MaxMailboxDeliveryTimeout specifies the max allowed timeout value.
|
|
// This value is derived from the itest `async_bidirectional_payments`,
|
|
// where both side send 483 payments at the same time to stress test
|
|
// lnd.
|
|
MaxMailboxDeliveryTimeout = 2 * time.Minute
|
|
)
|
|
|
|
//nolint:lll
|
|
type Htlcswitch struct {
|
|
MailboxDeliveryTimeout time.Duration `long:"mailboxdeliverytimeout" description:"The timeout value when delivering HTLCs to a channel link. Setting this value too small will result in local payment failures if large number of payments are sent over a short period."`
|
|
}
|
|
|
|
// Validate checks the values configured for htlcswitch.
|
|
func (h *Htlcswitch) Validate() error {
|
|
if h.MailboxDeliveryTimeout <= 0 {
|
|
return fmt.Errorf("mailboxdeliverytimeout must be positive")
|
|
}
|
|
|
|
if h.MailboxDeliveryTimeout > MaxMailboxDeliveryTimeout {
|
|
return fmt.Errorf("mailboxdeliverytimeout: %v exceeds "+
|
|
"maximum: %v", h.MailboxDeliveryTimeout,
|
|
MaxMailboxDeliveryTimeout)
|
|
}
|
|
|
|
return nil
|
|
}
|