invoices: move lock acquisition down

Move in separate commit to make next commit more readable.
This commit is contained in:
Joost Jager 2019-12-05 12:54:56 +01:00
parent 6063dc31fc
commit 202b7c26a7
No known key found for this signature in database
GPG Key ID: A61B9D4C393C59C7

@ -710,9 +710,6 @@ func (i *InvoiceRegistry) NotifyExitHopHtlc(rHash lntypes.Hash,
circuitKey channeldb.CircuitKey, hodlChan chan<- interface{}, circuitKey channeldb.CircuitKey, hodlChan chan<- interface{},
payload Payload) (*HtlcResolution, error) { payload Payload) (*HtlcResolution, error) {
i.Lock()
defer i.Unlock()
mpp := payload.MultiPath() mpp := payload.MultiPath()
debugLog := func(s string) { debugLog := func(s string) {
@ -732,6 +729,9 @@ func (i *InvoiceRegistry) NotifyExitHopHtlc(rHash lntypes.Hash,
mpp: mpp, mpp: mpp,
} }
i.Lock()
defer i.Unlock()
// We'll attempt to settle an invoice matching this rHash on disk (if // We'll attempt to settle an invoice matching this rHash on disk (if
// one exists). The callback will update the invoice state and/or htlcs. // one exists). The callback will update the invoice state and/or htlcs.
var ( var (