mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-08 23:01:53 +02:00
invoices: if there are no invoices make gc noop
This commit is contained in:
@@ -2139,14 +2139,14 @@ func (d *DB) DeleteCanceledInvoices(_ context.Context) error {
|
|||||||
invoiceIndexBucket,
|
invoiceIndexBucket,
|
||||||
)
|
)
|
||||||
if invoiceIndex == nil {
|
if invoiceIndex == nil {
|
||||||
return invpkg.ErrNoInvoicesCreated
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
invoiceAddIndex := invoices.NestedReadWriteBucket(
|
invoiceAddIndex := invoices.NestedReadWriteBucket(
|
||||||
addIndexBucket,
|
addIndexBucket,
|
||||||
)
|
)
|
||||||
if invoiceAddIndex == nil {
|
if invoiceAddIndex == nil {
|
||||||
return invpkg.ErrNoInvoicesCreated
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
payAddrIndex := tx.ReadWriteBucket(payAddrIndexBucket)
|
payAddrIndex := tx.ReadWriteBucket(payAddrIndexBucket)
|
||||||
|
@@ -2681,8 +2681,11 @@ func testDeleteCanceledInvoices(t *testing.T,
|
|||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add some invoices to the test db.
|
// Test deletion of canceled invoices when there are none.
|
||||||
ctxb := context.Background()
|
ctxb := context.Background()
|
||||||
|
require.NoError(t, db.DeleteCanceledInvoices(ctxb))
|
||||||
|
|
||||||
|
// Add some invoices to the test db.
|
||||||
var invoices []invpkg.Invoice
|
var invoices []invpkg.Invoice
|
||||||
for i := 0; i < 10; i++ {
|
for i := 0; i < 10; i++ {
|
||||||
invoice, err := randInvoice(lnwire.MilliSatoshi(i + 1))
|
invoice, err := randInvoice(lnwire.MilliSatoshi(i + 1))
|
||||||
|
Reference in New Issue
Block a user