Skip to content

Commit

Permalink
fix trade_simnet_test duplicate balance change tracking
Browse files Browse the repository at this point in the history
  • Loading branch information
itswisdomagain committed Jul 31, 2021
1 parent 9b51633 commit 7862ae4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions client/core/trade_simnet_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1004,6 +1004,7 @@ func monitorTrackedTrade(ctx context.Context, client *tClient, tracker *trackedT
client.psMTX.Unlock()
continue
}
lastStatus := client.processedStatus[match.MatchID]
client.processedStatus[match.MatchID] = status
client.psMTX.Unlock()
client.log("NOW =====> %s", status)
Expand All @@ -1025,8 +1026,8 @@ func monitorTrackedTrade(ctx context.Context, client *tClient, tracker *trackedT
// Our toAsset == counter-party's fromAsset.
assetToMine, swapOrRedeem = tracker.wallets.toAsset, "swap"

case status == order.MatchComplete, // maker normally jumps MakerRedeemed if 'redeem' succeeds
side == order.Maker && status == order.MakerRedeemed:
case side == order.Maker && status == order.MakerRedeemed,
status == order.MatchComplete && (side == order.Taker || lastStatus != order.MakerRedeemed): // allow MatchComplete for Maker if lastStatus != order.MakerRedeemed
recordBalanceChanges(tracker.wallets.toAsset.ID, false, match.Quantity, match.Rate)
// Mine blocks for redemption since counter-party does not wait
// for redeem tx confirmations before performing follow-up action.
Expand Down

0 comments on commit 7862ae4

Please sign in to comment.