Skip to content

Commit

Permalink
client/core: fix newMatchNote swapConfirms data race
Browse files Browse the repository at this point in the history
The matchTracker.swapConfirms is an atomic, with the confirms() method
as it's acccessor. newMatchNote was neglecting this.
  • Loading branch information
chappjc committed Feb 22, 2023
1 parent ff7cfe0 commit 06d2502
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions client/core/notification.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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()),
Expand Down

0 comments on commit 06d2502

Please sign in to comment.