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.
This commit is contained in:
Boris Nagaev 2025-03-12 21:36:33 -03:00 committed by Slyghtning
parent ce77fcc12c
commit 3cbfadd27a
No known key found for this signature in database
GPG key ID: F82D456EA023C9BF

View file

@ -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 {