From 3cbfadd27af6ce4ff5f59c1fa56f700f00b39915 Mon Sep 17 00:00:00 2001 From: Boris Nagaev Date: Wed, 12 Mar 2025 21:36:33 -0300 Subject: [PATCH] loop: fix race in loopOutSwap.payInvoiceAsync The function used to call the method swapKit.swapInfo() which accessed many fields of the swapKit which may change in parallel by handlePaymentResult called by executeSwap (payInvoiceAsync is called in a goroutine). The fields are: cost, state, and update time. --- loopout.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/loopout.go b/loopout.go index 26dfd142..99a7b737 100644 --- a/loopout.go +++ b/loopout.go @@ -873,7 +873,7 @@ func (s *loopOutSwap) payInvoiceAsync(ctx context.Context, } if err := s.swapKit.server.ReportRoutingResult( - ctx, s.swapInfo().SwapHash, s.swapInvoicePaymentAddr, + ctx, s.hash, s.swapInvoicePaymentAddr, reportType, paymentSuccess, int32(attempts), dt.Milliseconds(), ); err != nil {