mirror of
https://github.com/XRPLF/rippled.git
synced 2026-06-07 18:56:47 +00:00
fix amendment: AMM swap should honor invariants: (#5002)
The AMM has an invariant for swaps where: new_balance_1*new_balance_2 >= old_balance_1*old_balance_2 Due to rounding, this invariant could sometimes be violated (although by very small amounts). This patch introduces an amendment `fixAMMRounding` that changes the rounding to always favor the AMM. Doing this should maintain the invariant. Co-authored-by: Bronek Kozicki Co-authored-by: thejohnfreeman
This commit is contained in:
@@ -234,7 +234,6 @@ AMM::expectBalances(
|
||||
balances(asset1.issue(), asset2.issue(), account);
|
||||
return asset1 == asset1Balance && asset2 == asset2Balance &&
|
||||
lptAMMBalance == STAmount{lpt, lptIssue_};
|
||||
return false;
|
||||
}
|
||||
|
||||
IOUAmount
|
||||
|
||||
Reference in New Issue
Block a user