-
Notifications
You must be signed in to change notification settings - Fork 2k
/
htlcswitch.go
34 lines (28 loc) · 1.01 KB
/
htlcswitch.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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
}