Skip to content

Commit 3cbfadd

Browse files
stariushieblmi
authored andcommitted
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.
1 parent ce77fcc commit 3cbfadd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

loopout.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -873,7 +873,7 @@ func (s *loopOutSwap) payInvoiceAsync(ctx context.Context,
873873
}
874874

875875
if err := s.swapKit.server.ReportRoutingResult(
876-
ctx, s.swapInfo().SwapHash, s.swapInvoicePaymentAddr,
876+
ctx, s.hash, s.swapInvoicePaymentAddr,
877877
reportType, paymentSuccess, int32(attempts),
878878
dt.Milliseconds(),
879879
); err != nil {

0 commit comments

Comments
 (0)