mirror of
https://github.com/XRPLF/rippled.git
synced 2026-08-21 22:30:57 +00:00
chore: Add comment explaining why ammLPHolds is called twice (#6546)
This commit is contained in:
@@ -128,8 +128,7 @@ AMMClawback::applyGuts(Sandbox& sb)
|
||||
|
||||
if (sb.rules().enabled(fixAMMClawbackRounding))
|
||||
{
|
||||
// retrieve LP token balance inside the amendment gate to avoid
|
||||
// inconsistent error behavior
|
||||
// retrieve LP token balance inside the amendment gate to avoid inconsistent error behavior
|
||||
auto const lpTokenBalance = ammLPHolds(sb, *ammSle, holder, j_);
|
||||
if (lpTokenBalance == beast::zero)
|
||||
return tecAMM_BALANCE;
|
||||
@@ -138,7 +137,6 @@ AMMClawback::applyGuts(Sandbox& sb)
|
||||
!res)
|
||||
return res.error(); // LCOV_EXCL_LINE
|
||||
}
|
||||
|
||||
auto const expected =
|
||||
ammHolds(sb, *ammSle, asset, asset2, FreezeHandling::fhIGNORE_FREEZE, ctx_.journal);
|
||||
|
||||
@@ -151,6 +149,8 @@ AMMClawback::applyGuts(Sandbox& sb)
|
||||
STAmount amountWithdraw;
|
||||
std::optional<STAmount> amount2Withdraw;
|
||||
|
||||
// calling a second time on purpose since `verifyAndAdjustLPTokenBalance` rounds and may adjust
|
||||
// the balance
|
||||
auto const holdLPtokens = ammLPHolds(sb, *ammSle, holder, j_);
|
||||
if (holdLPtokens == beast::zero)
|
||||
return tecAMM_BALANCE;
|
||||
|
||||
Reference in New Issue
Block a user