invoiceregistry: promote update closure to method

This commit moves the update code into its own function as a preparation
for extending the logic further for mpp.

In order to make this change cleanly, structured result codes are
introduced. This also prepares for a future htlc notifier rpc hook that
reports htlc settle decisions to external applications.

Furthermore the awkward use of errNoUpdate as a way to signal no update
is removed.
This commit is contained in:
Joost Jager committed 2019-12-04 14:51:36 +01:00
1 parent 823b52802c
commit 915867e90f
2 files changed
+191 -101

No files matched your search

+5
View File
@@ -1241,6 +1241,11 @@ func (d *DB) updateInvoice(hash lntypes.Hash, invoices, settleIndex *bbolt.Bucke
return &invoice, err
}
// If there is nothing to update, return early.
if update == nil {
return &invoice, nil
}
// Update invoice state.
invoice.State = update.State