Fix: allow zero tx

If bonder fees are 0 there is no need to check if  bonder fees are bigger or equal to amount to prevent impossible transaction
This commit is contained in:
Anthony Laibe 2023-10-26 09:47:16 +02:00
parent 11a3612290
commit a0bd3c9a94
1 changed files with 9 additions and 7 deletions

View File

@ -627,13 +627,15 @@ func (r *Router) suggestedRoutes(
if err != nil {
continue
}
if maxAmountIn.ToInt().Cmp(amountIn) >= 0 {
if bonderFees.Cmp(amountIn) >= 0 {
continue
}
} else {
if bonderFees.Cmp(maxAmountIn.ToInt()) >= 0 {
continue
if bonderFees.Cmp(zero) != 0 {
if maxAmountIn.ToInt().Cmp(amountIn) >= 0 {
if bonderFees.Cmp(amountIn) >= 0 {
continue
}
} else {
if bonderFees.Cmp(maxAmountIn.ToInt()) >= 0 {
continue
}
}
}
gasLimit := uint64(0)