invoices: do not fail DeleteInvoice if payment addr isn't indexed

This commit relaxes DeleteInvoice failure cases by removing the
requirement that the invoice needs to be indexed by the payment address.
Since payment address index was introduced with an empty migration it
is possible that users have old invoices which were never added to
this index causing invoice garbage collection to get stuck.
This commit is contained in:
Andras Banki-Horvath committed 2021-04-19 17:56:09 +02:00
1 parent a36c95f732
commit adbcc3f7a3
2 files changed
+13 -18

No files matched your search

-9
View File
@@ -2425,15 +2425,6 @@ func TestDeleteInvoices(t *testing.T) {
// Restore the hash.
invoicesToDelete[0].PayHash[2] ^= 3
// XOR one byte of one of the references' payment address and attempt
// to delete.
invoicesToDelete[1].PayAddr[5] ^= 7
require.Error(t, db.DeleteInvoice(invoicesToDelete))
assertInvoiceCount(3)
// Restore the payment address.
invoicesToDelete[1].PayAddr[5] ^= 7
// XOR the second invoice's payment settle index as it is settled, and
// attempt to delete.
invoicesToDelete[1].SettleIndex ^= 11