invoices: return error from SubscribeNotifications on shutdown
This commit is contained in:
3 files changed
+19
-8
No files matched your search
@@ -9,6 +9,7 @@ import (
|
||||
"github.com/lightningnetwork/lnd/lntypes"
|
||||
"github.com/lightningnetwork/lnd/lnwire"
|
||||
"github.com/lightningnetwork/lnd/record"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
// TestSettleInvoice tests settling of an invoice and related notifications.
|
||||
@@ -16,7 +17,8 @@ func TestSettleInvoice(t *testing.T) {
|
||||
ctx := newTestContext(t)
|
||||
defer ctx.cleanup()
|
||||
|
||||
allSubscriptions := ctx.registry.SubscribeNotifications(0, 0)
|
||||
allSubscriptions, err := ctx.registry.SubscribeNotifications(0, 0)
|
||||
assert.Nil(t, err)
|
||||
defer allSubscriptions.Cancel()
|
||||
|
||||
// Subscribe to the not yet existing invoice.
|
||||
@@ -221,11 +223,12 @@ func TestCancelInvoice(t *testing.T) {
|
||||
ctx := newTestContext(t)
|
||||
defer ctx.cleanup()
|
||||
|
||||
allSubscriptions := ctx.registry.SubscribeNotifications(0, 0)
|
||||
allSubscriptions, err := ctx.registry.SubscribeNotifications(0, 0)
|
||||
assert.Nil(t, err)
|
||||
defer allSubscriptions.Cancel()
|
||||
|
||||
// Try to cancel the not yet existing invoice. This should fail.
|
||||
err := ctx.registry.CancelInvoice(testInvoicePaymentHash)
|
||||
err = ctx.registry.CancelInvoice(testInvoicePaymentHash)
|
||||
if err != channeldb.ErrInvoiceNotFound {
|
||||
t.Fatalf("expected ErrInvoiceNotFound, but got %v", err)
|
||||
}
|
||||
@@ -352,7 +355,8 @@ func TestSettleHoldInvoice(t *testing.T) {
|
||||
}
|
||||
defer registry.Stop()
|
||||
|
||||
allSubscriptions := registry.SubscribeNotifications(0, 0)
|
||||
allSubscriptions, err := registry.SubscribeNotifications(0, 0)
|
||||
assert.Nil(t, err)
|
||||
defer allSubscriptions.Cancel()
|
||||
|
||||
// Subscribe to the not yet existing invoice.
|
||||
@@ -651,7 +655,8 @@ func testKeySend(t *testing.T, keySendEnabled bool) {
|
||||
|
||||
ctx.registry.cfg.AcceptKeySend = keySendEnabled
|
||||
|
||||
allSubscriptions := ctx.registry.SubscribeNotifications(0, 0)
|
||||
allSubscriptions, err := ctx.registry.SubscribeNotifications(0, 0)
|
||||
assert.Nil(t, err)
|
||||
defer allSubscriptions.Cancel()
|
||||
|
||||
hodlChan := make(chan interface{}, 1)
|
||||
|
||||
Reference in new issue
Block a user