channelnotifier+discover+invoices: return error in Stop functions
In order to be consistent with other sub systems an error is now returned from the Stop functions. This also allows writing a generic cleanup mechanism to stop all sub systems in case of a failure.
This commit is contained in:
1 parent
c998264578
commit
3223df74e5
10 files changed
+58
-20
No files matched your search
@@ -527,7 +527,11 @@ func TestCancelHoldInvoice(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer registry.Stop()
|
||||
defer func() {
|
||||
if err := registry.Stop(); err != nil {
|
||||
t.Fatalf("failed to stop invoice registry: %v", err)
|
||||
}
|
||||
}()
|
||||
|
||||
// Add the invoice.
|
||||
_, err = registry.AddInvoice(testHodlInvoice, testInvoicePaymentHash)
|
||||
@@ -1005,7 +1009,9 @@ func TestInvoiceExpiryWithRegistry(t *testing.T) {
|
||||
|
||||
// Give some time to the watcher to cancel everything.
|
||||
time.Sleep(500 * time.Millisecond)
|
||||
registry.Stop()
|
||||
if err = registry.Stop(); err != nil {
|
||||
t.Fatalf("failed to stop invoice registry: %v", err)
|
||||
}
|
||||
|
||||
// Create the expected cancellation set before the final check.
|
||||
expectedCancellations = append(
|
||||
|
||||
Reference in new issue
Block a user