From 202b7c26a7841665bb9a18ae8eb432021d25242f Mon Sep 17 00:00:00 2001 From: Joost Jager Date: Thu, 5 Dec 2019 12:54:56 +0100 Subject: [PATCH] invoices: move lock acquisition down Move in separate commit to make next commit more readable. --- invoices/invoiceregistry.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/invoices/invoiceregistry.go b/invoices/invoiceregistry.go index 0b316324..5a639a5e 100644 --- a/invoices/invoiceregistry.go +++ b/invoices/invoiceregistry.go @@ -710,9 +710,6 @@ func (i *InvoiceRegistry) NotifyExitHopHtlc(rHash lntypes.Hash, circuitKey channeldb.CircuitKey, hodlChan chan<- interface{}, payload Payload) (*HtlcResolution, error) { - i.Lock() - defer i.Unlock() - mpp := payload.MultiPath() debugLog := func(s string) { @@ -732,6 +729,9 @@ func (i *InvoiceRegistry) NotifyExitHopHtlc(rHash lntypes.Hash, mpp: mpp, } + i.Lock() + defer i.Unlock() + // 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. var (