It is possible to craft orders in such a way that a path in the orderbook graph would end up with an empty flow because of rounding errors. This causes issues when reducing the orderbook as it would find a negative cycle with an empty flow, reduce it (which effectively does nothing since all the deducted amounts would be 0) and then go back to finding the same cycle, essentially looping forever.
The correct long term fix for this is to implement arbitrary precision rational numbers for exchange rate and capacity when finding and filling flows. This is already captured by #1381.
In the mean time to prevent infinite loops in the price estimator we can:
[x] Implement order and token filtering to remove rare offenders #1567
[ ] Panic on empty flows to prevent infinite loops #1568
It is possible to craft orders in such a way that a path in the orderbook graph would end up with an empty flow because of rounding errors. This causes issues when reducing the orderbook as it would find a negative cycle with an empty flow, reduce it (which effectively does nothing since all the deducted amounts would be 0) and then go back to finding the same cycle, essentially looping forever.
The correct long term fix for this is to implement arbitrary precision rational numbers for exchange rate and capacity when finding and filling flows. This is already captured by #1381.
In the mean time to prevent infinite loops in the price estimator we can: