From f4a0fecc71f8de450558b12b99bff246081d7067 Mon Sep 17 00:00:00 2001 From: Marton Date: Mon, 30 Jan 2023 08:58:40 -0500 Subject: [PATCH] client/core: Only check for fees when they are definitely available The fee checks for dynamic fee assets were happening many times before the transaction was confirmed, unnecessarily slowing the ticks down. This modifies the logic to decide if a check is needed by considering match status differently, and by checking if the swaps has at least one confirmation. --- client/core/trade.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/client/core/trade.go b/client/core/trade.go index 7cfd093192..a4631b0578 100644 --- a/client/core/trade.go +++ b/client/core/trade.go @@ -1386,10 +1386,13 @@ func (t *trackedTrade) checkSwapFeeConfirms(match *matchTracker) bool { // Confirmed will be set in the db. return true } + // Waiting until the swap is definitely confirmed in order to not + // keep calling the fee checker before the swap is confirmed. + mySwapConfs, _ := match.confirms() if match.Side == order.Maker { - return match.Status >= order.MakerSwapCast + return match.Status > order.MakerSwapCast || mySwapConfs > 0 } - return match.Status >= order.TakerSwapCast + return match.Status > order.TakerSwapCast || mySwapConfs > 0 } // checkRedemptionFeeConfirms returns whether the swap fee confirmations should