Merge pull request #5120 from Roasbeef/invoice-deletion-errors
channeldb: return more detailed errors in DeleteInvoice
This commit is contained in:
commit
abea1146a6
@ -2181,7 +2181,8 @@ func (d *DB) DeleteInvoice(invoicesToDelete []InvoiceDeleteRef) error {
|
|||||||
// payment address index.
|
// payment address index.
|
||||||
key := payAddrIndex.Get(ref.PayAddr[:])
|
key := payAddrIndex.Get(ref.PayAddr[:])
|
||||||
if !bytes.Equal(key, invoiceKey) {
|
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.
|
// Delete from the payment address index.
|
||||||
@ -2199,7 +2200,8 @@ func (d *DB) DeleteInvoice(invoicesToDelete []InvoiceDeleteRef) error {
|
|||||||
// invoice key.
|
// invoice key.
|
||||||
key := invoiceAddIndex.Get(addIndexKey[:])
|
key := invoiceAddIndex.Get(addIndexKey[:])
|
||||||
if !bytes.Equal(key, invoiceKey) {
|
if !bytes.Equal(key, invoiceKey) {
|
||||||
return fmt.Errorf("unknown invoice")
|
return fmt.Errorf("unknown invoice in " +
|
||||||
|
"add index")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove from the add index.
|
// Remove from the add index.
|
||||||
@ -2221,7 +2223,8 @@ func (d *DB) DeleteInvoice(invoicesToDelete []InvoiceDeleteRef) error {
|
|||||||
// settle index
|
// settle index
|
||||||
key := settleIndex.Get(settleIndexKey[:])
|
key := settleIndex.Get(settleIndexKey[:])
|
||||||
if !bytes.Equal(key, invoiceKey) {
|
if !bytes.Equal(key, invoiceKey) {
|
||||||
return fmt.Errorf("unknown invoice")
|
return fmt.Errorf("unknown invoice " +
|
||||||
|
"in settle index")
|
||||||
}
|
}
|
||||||
|
|
||||||
err = settleIndex.Delete(settleIndexKey[:])
|
err = settleIndex.Delete(settleIndexKey[:])
|
||||||
|
Loading…
Reference in New Issue
Block a user