diff --git a/invoices/modification_interceptor.go b/invoices/modification_interceptor.go index 47f0de80b..97e75e8cc 100644 --- a/invoices/modification_interceptor.go +++ b/invoices/modification_interceptor.go @@ -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 }