From 9ab23de197ad9175d32c0bee9f88d533b7f0b11f Mon Sep 17 00:00:00 2001 From: Joost Jager Date: Tue, 13 Aug 2019 18:57:27 +0200 Subject: [PATCH] invoices: create error for invoice registry shutting down --- invoices/invoiceregistry.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/invoices/invoiceregistry.go b/invoices/invoiceregistry.go index 80f4474f..f2e70145 100644 --- a/invoices/invoiceregistry.go +++ b/invoices/invoiceregistry.go @@ -36,6 +36,10 @@ var ( // ErrInvoiceAmountTooLow is returned when an invoice is attempted to be // accepted or settled with an amount that is too low. ErrInvoiceAmountTooLow = errors.New("paid amount less than invoice amount") + + // ErrShuttingDown is returned when an operation failed because the + // invoice registry is shutting down. + ErrShuttingDown = errors.New("invoice registry shutting down") ) // HodlEvent describes how an htlc should be resolved. If HodlEvent.Preimage is @@ -330,7 +334,7 @@ func (i *InvoiceRegistry) deliverBacklogEvents(client *InvoiceSubscription) erro invoice: &addEvent, }: case <-i.quit: - return fmt.Errorf("registry shutting down") + return ErrShuttingDown } } @@ -344,7 +348,7 @@ func (i *InvoiceRegistry) deliverBacklogEvents(client *InvoiceSubscription) erro invoice: &settleEvent, }: case <-i.quit: - return fmt.Errorf("registry shutting down") + return ErrShuttingDown } } @@ -801,7 +805,7 @@ func (i *invoiceSubscriptionKit) notify(event *invoiceEvent) error { select { case i.ntfnQueue.ChanIn() <- event: case <-i.inv.quit: - return fmt.Errorf("registry shutting down") + return ErrShuttingDown } return nil