mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-07 19:30:46 +02:00
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:
@@ -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
|
||||
|
||||
|
Reference in New Issue
Block a user