mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-02-22 22:25:24 +01:00
channeldb: return more detailed errors in DeleteInvoice
This PR was created in order to help to debug the failures in: https://github.com/lightningnetwork/lnd/issues/5113 We add some more contextual errors so we can figure out where the assumptions of the current scan to delete function in the invoice registry is incorrect.
This commit is contained in:
parent
e2690918a0
commit
0a1d592cf9
1 changed files with 6 additions and 3 deletions
|
@ -2181,7 +2181,8 @@ func (d *DB) DeleteInvoice(invoicesToDelete []InvoiceDeleteRef) error {
|
|||
// payment address index.
|
||||
key := payAddrIndex.Get(ref.PayAddr[:])
|
||||
if !bytes.Equal(key, invoiceKey) {
|
||||
return fmt.Errorf("unknown invoice")
|
||||
return fmt.Errorf("unknown invoice " +
|
||||
"in pay addr index")
|
||||
}
|
||||
|
||||
// Delete from the payment address index.
|
||||
|
@ -2199,7 +2200,8 @@ func (d *DB) DeleteInvoice(invoicesToDelete []InvoiceDeleteRef) error {
|
|||
// invoice key.
|
||||
key := invoiceAddIndex.Get(addIndexKey[:])
|
||||
if !bytes.Equal(key, invoiceKey) {
|
||||
return fmt.Errorf("unknown invoice")
|
||||
return fmt.Errorf("unknown invoice in " +
|
||||
"add index")
|
||||
}
|
||||
|
||||
// Remove from the add index.
|
||||
|
@ -2221,7 +2223,8 @@ func (d *DB) DeleteInvoice(invoicesToDelete []InvoiceDeleteRef) error {
|
|||
// settle index
|
||||
key := settleIndex.Get(settleIndexKey[:])
|
||||
if !bytes.Equal(key, invoiceKey) {
|
||||
return fmt.Errorf("unknown invoice")
|
||||
return fmt.Errorf("unknown invoice " +
|
||||
"in settle index")
|
||||
}
|
||||
|
||||
err = settleIndex.Delete(settleIndexKey[:])
|
||||
|
|
Loading…
Add table
Reference in a new issue