mirror of
https://github.com/lightningnetwork/lnd.git
synced 2024-11-19 01:43:16 +01:00
invoices: add proper startup for the interceptor
During testing of this PR I figured out the the htlc interceptor was not shutdown and started properly in terms of closing the quit channel but also in terms of the relevant logs.
This commit is contained in:
parent
448193b0fd
commit
027de0a82c
@ -2,6 +2,7 @@ package invoices
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"sync/atomic"
|
||||
|
||||
"github.com/lightningnetwork/lnd/fn"
|
||||
@ -167,21 +168,31 @@ func (s *HtlcModificationInterceptor) RegisterInterceptor(
|
||||
|
||||
// Start starts the service.
|
||||
func (s *HtlcModificationInterceptor) Start() error {
|
||||
log.Info("HtlcModificationInterceptor starting...")
|
||||
|
||||
if !s.started.CompareAndSwap(false, true) {
|
||||
return nil
|
||||
return fmt.Errorf("HtlcModificationInterceptor started more" +
|
||||
"than once")
|
||||
}
|
||||
|
||||
log.Debugf("HtlcModificationInterceptor started")
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Stop stops the service.
|
||||
func (s *HtlcModificationInterceptor) Stop() error {
|
||||
log.Info("HtlcModificationInterceptor stopping...")
|
||||
|
||||
if !s.stopped.CompareAndSwap(false, true) {
|
||||
return nil
|
||||
return fmt.Errorf("HtlcModificationInterceptor stopped more" +
|
||||
"than once")
|
||||
}
|
||||
|
||||
close(s.quit)
|
||||
|
||||
log.Debug("HtlcModificationInterceptor stopped")
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user