fix: Fix issue where best routes with not enough balance is returned (#3164)
This commit is contained in:
parent
8934426cbd
commit
9b32c6067a
|
@ -570,6 +570,11 @@ func (r *Router) suggestedRoutes(
|
|||
}
|
||||
requiredNativeBalance := new(big.Int).Mul(gweiToWei(maxFees), big.NewInt(int64(gasLimit)))
|
||||
|
||||
// Removed the required fees from maxAMount in case of native token tx
|
||||
if token.IsNative() {
|
||||
maxAmountIn = (*hexutil.Big)(new(big.Int).Sub(maxAmountIn.ToInt(), requiredNativeBalance))
|
||||
}
|
||||
|
||||
if nativeBalance.Cmp(requiredNativeBalance) <= 0 {
|
||||
continue
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue