From 06d25024dbdfa97a258136d7a20c865c5fc2b2b8 Mon Sep 17 00:00:00 2001 From: Jonathan Chappelow Date: Tue, 24 Jan 2023 16:28:11 -0600 Subject: [PATCH] client/core: fix newMatchNote swapConfirms data race The matchTracker.swapConfirms is an atomic, with the confirms() method as it's acccessor. newMatchNote was neglecting this. --- client/core/notification.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/core/notification.go b/client/core/notification.go index 98164286da..8c9db7e0b2 100644 --- a/client/core/notification.go +++ b/client/core/notification.go @@ -289,7 +289,7 @@ const ( ) func newMatchNote(topic Topic, subject, details string, severity db.Severity, t *trackedTrade, match *matchTracker) *MatchNote { - _, counterConfs := match.confirms() + swapConfs, counterConfs := match.confirms() if counterConfs < 0 { // This can be -1 before it is actually checked, but for purposes of the // match note, it should be non-negative. @@ -298,7 +298,7 @@ func newMatchNote(topic Topic, subject, details string, severity db.Severity, t return &MatchNote{ Notification: db.NewNotification(NoteTypeMatch, topic, subject, details, severity), OrderID: t.ID().Bytes(), - Match: matchFromMetaMatchWithConfs(t.Order, &match.MetaMatch, match.swapConfirms, + Match: matchFromMetaMatchWithConfs(t.Order, &match.MetaMatch, swapConfs, int64(t.wallets.fromAsset.SwapConf), counterConfs, int64(t.wallets.toAsset.SwapConf)), Host: t.dc.acct.host, MarketID: marketName(t.Base(), t.Quote()),