Skip to content

Commit

Permalink
Fix merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
gregtatcam committed Nov 5, 2024
1 parent 570c378 commit fb32608
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 6 deletions.
2 changes: 1 addition & 1 deletion include/xrpl/protocol/Feature.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ namespace detail {
// Feature.cpp. Because it's only used to reserve storage, and determine how
// large to make the FeatureBitset, it MAY be larger. It MUST NOT be less than
// the actual number of amendments. A LogicError on startup will verify this.
static constexpr std::size_t numFeatures = 81;
static constexpr std::size_t numFeatures = 82;

/** Amendments that this server supports and the default voting behavior.
Whether they are enabled depends on the Rules defined in the validated
Expand Down
3 changes: 3 additions & 0 deletions src/xrpld/app/tx/detail/AMMClawback.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ AMMClawback::applyGuts(Sandbox& sb)
0,
FreezeHandling::fhIGNORE_FREEZE,
WithdrawAll::Yes,
mPriorBalance,
ctx_.journal);
else
std::tie(result, newLPTokenBalance, amountWithdraw, amount2Withdraw) =
Expand Down Expand Up @@ -267,6 +268,7 @@ AMMClawback::equalWithdrawMatchingOneAmount(
0,
FreezeHandling::fhIGNORE_FREEZE,
WithdrawAll::Yes,
mPriorBalance,
ctx_.journal);

// Because we are doing a two-asset withdrawal,
Expand All @@ -284,6 +286,7 @@ AMMClawback::equalWithdrawMatchingOneAmount(
0,
FreezeHandling::fhIGNORE_FREEZE,
WithdrawAll::No,
mPriorBalance,
ctx_.journal);
}

Expand Down
16 changes: 11 additions & 5 deletions src/xrpld/app/tx/detail/AMMWithdraw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,7 @@ AMMWithdraw::withdraw(
tfee,
FreezeHandling::fhZERO_IF_FROZEN,
isWithdrawAll(ctx_.tx),
mPriorBalance,
j_);
return {ter, newLPTokenBalance};
}
Expand All @@ -490,6 +491,7 @@ AMMWithdraw::withdraw(
std::uint16_t tfee,
FreezeHandling freezeHandling,
WithdrawAll withdrawAll,
XRPAmount const& priorBalance,
beast::Journal const& journal)
{
auto const lpTokens = ammLPHolds(view, ammSle, account, journal);
Expand Down Expand Up @@ -594,9 +596,9 @@ AMMWithdraw::withdraw(
auto sufficientReserve = [&](Issue const& issue) -> TER {
if (!enabledFixAMMv1_2 || isXRP(issue))
return tesSUCCESS;
if (!view.exists(keylet::line(account_, issue)))
if (!view.exists(keylet::line(account, issue)))
{
auto const sleAccount = view.read(keylet::account(account_));
auto const sleAccount = view.read(keylet::account(account));
if (!sleAccount)
return tecINTERNAL; // LCOV_EXCL_LINE
auto const balance = (*sleAccount)[sfBalance].xrp();
Expand All @@ -607,14 +609,14 @@ AMMWithdraw::withdraw(
(ownerCount < 2) ? XRPAmount(beast::zero)
: view.fees().accountReserve(ownerCount + 1));

if (std::max(mPriorBalance, balance) < reserve)
if (std::max(priorBalance, balance) < reserve)
return tecINSUFFICIENT_RESERVE;
}
return tesSUCCESS;
};

if (auto const err = sufficientReserve(amountWithdrawActual.issue()))
return {err, STAmount{}};
return {err, STAmount{}, STAmount{}, STAmount{}};

// Withdraw amountWithdraw
auto res = accountSend(
Expand All @@ -638,7 +640,7 @@ AMMWithdraw::withdraw(
{
if (auto const err = sufficientReserve(amount2WithdrawActual->issue());
err != tesSUCCESS)
return {err, STAmount{}};
return {err, STAmount{}, STAmount{}, STAmount{}};

res = accountSend(
view,
Expand Down Expand Up @@ -707,6 +709,7 @@ AMMWithdraw::equalWithdrawTokens(
tfee,
FreezeHandling::fhZERO_IF_FROZEN,
isWithdrawAll(ctx_.tx),
mPriorBalance,
ctx_.journal);
return {ter, newLPTokenBalance};
}
Expand Down Expand Up @@ -756,6 +759,7 @@ AMMWithdraw::equalWithdrawTokens(
std::uint16_t tfee,
FreezeHandling freezeHanding,
WithdrawAll withdrawAll,
XRPAmount const& priorBalance,
beast::Journal const& journal)
{
try
Expand All @@ -776,6 +780,7 @@ AMMWithdraw::equalWithdrawTokens(
tfee,
freezeHanding,
WithdrawAll::Yes,
priorBalance,
journal);
}

Expand Down Expand Up @@ -804,6 +809,7 @@ AMMWithdraw::equalWithdrawTokens(
tfee,
freezeHanding,
withdrawAll,
priorBalance,
journal);
}
// LCOV_EXCL_START
Expand Down
4 changes: 4 additions & 0 deletions src/xrpld/app/tx/detail/AMMWithdraw.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ class AMMWithdraw : public Transactor
* @param lpTokensWithdraw amount of tokens to withdraw
* @param tfee trading fee in basis points
* @param withdrawAll if withdrawing all lptokens
* @param priorBalance balance before fees
* @return
*/
static std::tuple<TER, STAmount, STAmount, std::optional<STAmount>>
Expand All @@ -112,6 +113,7 @@ class AMMWithdraw : public Transactor
std::uint16_t tfee,
FreezeHandling freezeHanding,
WithdrawAll withdrawAll,
XRPAmount const& priorBalance,
beast::Journal const& journal);

/** Withdraw requested assets and token from AMM into LP account.
Expand All @@ -127,6 +129,7 @@ class AMMWithdraw : public Transactor
* @param lpTokensWithdraw amount of lptokens to withdraw
* @param tfee trading fee in basis points
* @param withdrawAll if withdraw all lptokens
* @param priorBalance balance before fees
* @return
*/
static std::tuple<TER, STAmount, STAmount, std::optional<STAmount>>
Expand All @@ -143,6 +146,7 @@ class AMMWithdraw : public Transactor
std::uint16_t tfee,
FreezeHandling freezeHandling,
WithdrawAll withdrawAll,
XRPAmount const& priorBalance,
beast::Journal const& journal);

static std::pair<TER, bool>
Expand Down

0 comments on commit fb32608

Please sign in to comment.