htlcswitch: add error return value to NewInterceptableSwitch

Prepares for parameter validation.
This commit is contained in:
Joost Jager committed 2022-10-18 18:04:34 +02:00
1 parent 93a7cab46e
commit 74eeb95e8c
4 files changed
+33 -20

No files matched your search

+4 -2
View File
@@ -146,7 +146,9 @@ type InterceptableSwitchConfig struct {
}
// NewInterceptableSwitch returns an instance of InterceptableSwitch.
func NewInterceptableSwitch(cfg *InterceptableSwitchConfig) *InterceptableSwitch {
func NewInterceptableSwitch(cfg *InterceptableSwitchConfig) (
*InterceptableSwitch, error) {
return &InterceptableSwitch{
htlcSwitch: cfg.Switch,
intercepted: make(chan *interceptedPackets),
@@ -159,7 +161,7 @@ func NewInterceptableSwitch(cfg *InterceptableSwitchConfig) *InterceptableSwitch
notifier: cfg.Notifier,
quit: make(chan struct{}),
}
}, nil
}
// SetInterceptor sets the ForwardInterceptor to be used. A nil argument