Skip to content

Commit

Permalink
client/core: Only check for fees when they are definitely available
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
martonp authored Jan 30, 2023
1 parent 52d641f commit f4a0fec
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions client/core/trade.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f4a0fec

Please sign in to comment.