Skip to content

Commit 98d0a19

Browse files
committed
[FOLD] Address @ximinez feedback
* Refactor auction slot amendment creation on initialize * Update a comment in amm test utils
1 parent 0013fde commit 98d0a19

File tree

2 files changed

+11
-18
lines changed

2 files changed

+11
-18
lines changed

src/ripple/app/misc/impl/AMMUtils.cpp

+7-16
Original file line numberDiff line numberDiff line change
@@ -303,22 +303,13 @@ initializeFeeAuctionVote(
303303
// AMM creator gets the auction slot for free.
304304
// AuctionSlot is created on AMMCreate and updated on AMMDeposit
305305
// when AMM is in an empty state
306-
STObject& auctionSlot = [&]() -> STObject& {
307-
if (!rules.enabled(fixInnerObjTemplate))
308-
{
309-
return ammSle->peekFieldObject(sfAuctionSlot);
310-
}
311-
else
312-
{
313-
if (!ammSle->isFieldPresent(sfAuctionSlot))
314-
{
315-
STObject auctionSlot =
316-
STObject::makeInnerObject(sfAuctionSlot, rules);
317-
ammSle->set(std::move(auctionSlot));
318-
}
319-
return ammSle->peekFieldObject(sfAuctionSlot);
320-
}
321-
}();
306+
if (rules.enabled(fixInnerObjTemplate) &&
307+
!ammSle->isFieldPresent(sfAuctionSlot))
308+
{
309+
STObject auctionSlot = STObject::makeInnerObject(sfAuctionSlot, rules);
310+
ammSle->set(std::move(auctionSlot));
311+
}
312+
STObject& auctionSlot = ammSle->peekFieldObject(sfAuctionSlot);
322313
auctionSlot.setAccountID(sfAccount, account);
323314
// current + sec in 24h
324315
auto const expiration = std::chrono::duration_cast<std::chrono::seconds>(

src/test/jtx/impl/AMM.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -787,8 +787,10 @@ AMM::expectAuctionSlot(auto&& cb) const
787787
static_cast<STObject const&>(amm->peekAtField(sfAuctionSlot));
788788
if (auctionSlot.isFieldPresent(sfAccount))
789789
{
790-
// this could fail in pre-fixInnerObjTemplate test if one
791-
// the fail-cases. access as optional to avoid the failure
790+
// This could fail in pre-fixInnerObjTemplate tests
791+
// if the submitted transactions recreate one of
792+
// the failure scenarios. Access as optional
793+
// to avoid the failure.
792794
auto const slotFee = auctionSlot[~sfDiscountedFee].value_or(0);
793795
auto const slotInterval = ammAuctionTimeSlot(
794796
env_.app().timeKeeper().now().time_since_epoch().count(),

0 commit comments

Comments
 (0)