invoices: create error for invoice registry shutting down

This commit is contained in:
Joost Jager 2019-08-13 18:57:27 +02:00
parent 46e2a9e9b8
commit 9ab23de197
No known key found for this signature in database
GPG Key ID: A61B9D4C393C59C7

@ -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