Revert "switch to &&"

This reverts commit 8f470b750d.
This commit is contained in:
Mayukha Vadari
2026-06-30 13:49:58 -04:00
parent 69534b3ec6
commit f5689990ed
35 changed files with 100 additions and 90 deletions

View File

@@ -201,7 +201,7 @@ canWithdraw(ReadView const& view, STTx const& tx);
[[nodiscard]] TER
doWithdraw(
ApplyViewContext&& ctx,
ApplyViewContext& ctx,
AccountID const& senderAcct,
AccountID const& dstAcct,
AccountID const& sourceAcct,

View File

@@ -17,7 +17,7 @@ namespace xrpl {
template <ValidIssueType T>
TER
escrowUnlockApplyHelper(
ApplyViewContext&& ctx,
ApplyViewContext& ctx,
Rate lockedRate,
SLE::ref sleDest,
STAmount const& xrpBalance,
@@ -31,7 +31,7 @@ escrowUnlockApplyHelper(
template <>
inline TER
escrowUnlockApplyHelper<Issue>(
ApplyViewContext&& ctx,
ApplyViewContext& ctx,
Rate lockedRate,
SLE::ref sleDest,
STAmount const& xrpBalance,
@@ -58,7 +58,7 @@ escrowUnlockApplyHelper<Issue>(
if (!view.exists(trustLineKey) && createAsset)
{
// Can the account cover the trust line's reserve?
auto const sponsorSle = getTxReserveSponsor({.view = ctx.view, .tx = ctx.tx});
auto const sponsorSle = getTxReserveSponsor(ctx);
if (!sponsorSle)
return sponsorSle.error(); // LCOV_EXCL_LINE
@@ -168,7 +168,7 @@ escrowUnlockApplyHelper<Issue>(
template <>
inline TER
escrowUnlockApplyHelper<MPTIssue>(
ApplyViewContext&& ctx,
ApplyViewContext& ctx,
Rate lockedRate,
SLE::ref sleDest,
STAmount const& xrpBalance,
@@ -188,7 +188,7 @@ escrowUnlockApplyHelper<MPTIssue>(
auto const mptKeylet = keylet::mptoken(issuanceKey.key, receiver);
if (!view.exists(mptKeylet) && createAsset && !receiverIssuer)
{
auto const sponsorSle = getTxReserveSponsor({.view = ctx.view, .tx = ctx.tx});
auto const sponsorSle = getTxReserveSponsor(ctx);
if (!sponsorSle)
return sponsorSle.error(); // LCOV_EXCL_LINE

View File

@@ -71,7 +71,7 @@ canAddHolding(ReadView const& view, MPTIssue const& mptIssue);
[[nodiscard]] TER
authorizeMPToken(
ApplyViewContext&& ctx,
ApplyViewContext& ctx,
XRPAmount const& priorBalance,
MPTID const& mptIssuanceID,
AccountID const& account,
@@ -102,7 +102,7 @@ requireAuth(
*/
[[nodiscard]] TER
enforceMPTokenAuthorization(
ApplyViewContext&& ctx,
ApplyViewContext& ctx,
MPTID const& mptIssuanceID,
AccountID const& account,
XRPAmount const& priorBalance,
@@ -188,7 +188,7 @@ canMPTTradeAndTransfer(
[[nodiscard]] TER
addEmptyHolding(
ApplyViewContext&& ctx,
ApplyViewContext& ctx,
AccountID const& accountID,
XRPAmount priorBalance,
MPTIssue const& mptIssue,
@@ -196,7 +196,7 @@ addEmptyHolding(
[[nodiscard]] TER
removeEmptyHolding(
ApplyViewContext&& ctx,
ApplyViewContext& ctx,
AccountID const& accountID,
MPTIssue const& mptIssue,
beast::Journal journal);

View File

@@ -229,7 +229,7 @@ canTransfer(ReadView const& view, Issue const& issue, AccountID const& from, Acc
/// canAddHolding() in preflight with the same View and Asset
[[nodiscard]] TER
addEmptyHolding(
ApplyViewContext&& ctx,
ApplyViewContext& ctx,
AccountID const& accountID,
XRPAmount priorBalance,
Issue const& issue,
@@ -237,7 +237,7 @@ addEmptyHolding(
[[nodiscard]] TER
removeEmptyHolding(
ApplyViewContext&& ctx,
ApplyViewContext& ctx,
AccountID const& accountID,
Issue const& issue,
beast::Journal journal);

View File

@@ -35,7 +35,7 @@ getTxReserveSponsorAccountID(STTx const& tx)
}
inline std::expected<SLE::pointer, TER>
getTxReserveSponsor(ApplyViewContext&& ctx)
getTxReserveSponsor(ApplyViewContext& ctx)
{
auto const sponsorID = getTxReserveSponsorAccountID(ctx.tx);
if (sponsorID)

View File

@@ -230,7 +230,7 @@ canAddHolding(ReadView const& view, Asset const& asset);
[[nodiscard]] TER
addEmptyHolding(
ApplyViewContext&& ctx,
ApplyViewContext& ctx,
AccountID const& accountID,
XRPAmount priorBalance,
Asset const& asset,
@@ -238,7 +238,7 @@ addEmptyHolding(
[[nodiscard]] TER
removeEmptyHolding(
ApplyViewContext&& ctx,
ApplyViewContext& ctx,
AccountID const& accountID,
Asset const& asset,
beast::Journal journal);

View File

@@ -63,7 +63,7 @@ public:
beast::Journal const& j) override;
static std::expected<MPTID, TER>
create(ApplyViewContext&& ctx, beast::Journal journal, MPTCreateArgs const& args);
create(ApplyViewContext& ctx, beast::Journal journal, MPTCreateArgs const& args);
};
} // namespace xrpl

View File

@@ -432,7 +432,7 @@ canWithdraw(ReadView const& view, STTx const& tx)
TER
doWithdraw(
ApplyViewContext&& ctx,
ApplyViewContext& ctx,
AccountID const& senderAcct,
AccountID const& dstAcct,
AccountID const& sourceAcct,
@@ -443,8 +443,7 @@ doWithdraw(
// Create trust line or MPToken for the receiving account
if (dstAcct == senderAcct)
{
if (auto const ter = addEmptyHolding(
{.view = ctx.view, .tx = ctx.tx}, senderAcct, priorBalance, amount.asset(), j);
if (auto const ter = addEmptyHolding(ctx, senderAcct, priorBalance, amount.asset(), j);
!isTesSuccess(ter) && ter != tecDUPLICATE)
return ter;
}
@@ -470,7 +469,7 @@ doWithdraw(
// LCOV_EXCL_STOP
}
auto const sponsorSle = getTxReserveSponsor({.view = ctx.view, .tx = ctx.tx});
auto const sponsorSle = getTxReserveSponsor(ctx);
if (!sponsorSle)
return sponsorSle.error(); // LCOV_EXCL_LINE

View File

@@ -126,7 +126,7 @@ canAddHolding(ReadView const& view, MPTIssue const& mptIssue)
[[nodiscard]] TER
addEmptyHolding(
ApplyViewContext&& ctx,
ApplyViewContext& ctx,
AccountID const& accountID,
XRPAmount priorBalance,
MPTIssue const& mptIssue,
@@ -149,7 +149,7 @@ addEmptyHolding(
[[nodiscard]] TER
authorizeMPToken(
ApplyViewContext&& ctx,
ApplyViewContext& ctx,
XRPAmount const& priorBalance,
MPTID const& mptIssuanceID,
AccountID const& account,
@@ -286,7 +286,7 @@ authorizeMPToken(
[[nodiscard]] TER
removeEmptyHolding(
ApplyViewContext&& ctx,
ApplyViewContext& ctx,
AccountID const& accountID,
MPTIssue const& mptIssue,
beast::Journal journal)
@@ -309,7 +309,7 @@ removeEmptyHolding(
return tecHAS_OBLIGATIONS;
return authorizeMPToken(
{.view = ctx.view, .tx = ctx.tx},
ctx,
{}, // priorBalance
mptID,
accountID,
@@ -418,7 +418,7 @@ requireAuth(
[[nodiscard]] TER
enforceMPTokenAuthorization(
ApplyViewContext&& ctx,
ApplyViewContext& ctx,
MPTID const& mptIssuanceID,
AccountID const& account,
XRPAmount const& priorBalance, // for MPToken authorization
@@ -500,7 +500,7 @@ enforceMPTokenAuthorization(
maybeDomainID.has_value() && sleToken == nullptr,
"xrpl::enforceMPTokenAuthorization : new MPToken for domain");
if (auto const err = authorizeMPToken(
{.view = ctx.view, .tx = ctx.tx},
ctx,
priorBalance, // priorBalance
mptIssuanceID, // mptIssuanceID
account, // account

View File

@@ -633,7 +633,7 @@ canTransfer(ReadView const& view, Issue const& issue, AccountID const& from, Acc
TER
addEmptyHolding(
ApplyViewContext&& ctx,
ApplyViewContext& ctx,
AccountID const& accountID,
XRPAmount priorBalance,
Issue const& issue,
@@ -669,7 +669,7 @@ addEmptyHolding(
// A reserve sponsor only covers tx.Account's own objects.
if (!isPseudoAccount(sleDst) && accountID == tx[sfAccount])
{
auto sle = getTxReserveSponsor({.view = ctx.view, .tx = ctx.tx});
auto sle = getTxReserveSponsor(ctx);
if (!sle)
return sle.error(); // LCOV_EXCL_LINE
sponsorSle = std::move(*sle);
@@ -702,7 +702,7 @@ addEmptyHolding(
TER
removeEmptyHolding(
ApplyViewContext&& ctx,
ApplyViewContext& ctx,
AccountID const& accountID,
Issue const& issue,
beast::Journal journal)

View File

@@ -473,7 +473,7 @@ canAddHolding(ReadView const& view, Asset const& asset)
TER
addEmptyHolding(
ApplyViewContext&& ctx,
ApplyViewContext& ctx,
AccountID const& accountID,
XRPAmount priorBalance,
Asset const& asset,
@@ -481,15 +481,14 @@ addEmptyHolding(
{
return std::visit(
[&]<ValidIssueType TIss>(TIss const& issue) -> TER {
return addEmptyHolding(
{.view = ctx.view, .tx = ctx.tx}, accountID, priorBalance, issue, journal);
return addEmptyHolding(ctx, accountID, priorBalance, issue, journal);
},
asset.value());
}
TER
removeEmptyHolding(
ApplyViewContext&& ctx,
ApplyViewContext& ctx,
AccountID const& accountID,
Asset const& asset,
beast::Journal journal)
@@ -498,13 +497,11 @@ removeEmptyHolding(
[&]<ValidIssueType TIss>(TIss const& issue) -> TER {
if constexpr (std::is_same_v<TIss, Issue>)
{
return removeEmptyHolding(
{.view = ctx.view, .tx = ctx.tx}, accountID, issue, journal);
return removeEmptyHolding(ctx, accountID, issue, journal);
}
else
{
return removeEmptyHolding(
{.view = ctx.view, .tx = ctx.tx}, accountID, issue, journal);
return removeEmptyHolding(ctx, accountID, issue, journal);
}
},
asset.value());

View File

@@ -203,7 +203,9 @@ SponsorshipSet::doApply()
auto const feeAmount = ctx_.tx[~sfFeeAmount];
auto const maxFee = ctx_.tx[~sfMaxFee];
auto const remainingOwnerCount = ctx_.tx[~sfRemainingOwnerCount];
auto reserveSponsorAccSle = getTxReserveSponsor(ctx_.getApplyViewContext());
auto applyViewContext = ctx_.getApplyViewContext();
auto reserveSponsorAccSle = getTxReserveSponsor(applyViewContext);
if (!reserveSponsorAccSle)
return reserveSponsorAccSle.error(); // LCOV_EXCL_LINE

View File

@@ -322,7 +322,8 @@ SignerListSet::replaceSignerList()
// We check the reserve against the starting balance because we want to
// allow dipping into the reserve to pay fees. This behavior is consistent
// with TicketCreate.
auto const sponsorSle = getTxReserveSponsor(ctx_.getApplyViewContext());
auto applyViewContext = ctx_.getApplyViewContext();
auto const sponsorSle = getTxReserveSponsor(applyViewContext);
if (!sponsorSle)
return sponsorSle.error(); // LCOV_EXCL_LINE
if (auto const ret = checkInsufficientReserve(

View File

@@ -388,7 +388,8 @@ CheckCash::doApply()
STAmount const flowDeliver{
optDeliverMin ? maxDeliverMin() : ctx_.tx.getFieldAmount(sfAmount)};
auto const sponsorSle = getTxReserveSponsor({.view = psb, .tx = ctx_.tx});
auto applyViewContext = ApplyViewContext({.view = psb, .tx = ctx_.tx});
auto const sponsorSle = getTxReserveSponsor(applyViewContext);
if (!sponsorSle)
return sponsorSle.error(); // LCOV_EXCL_LINE

View File

@@ -195,7 +195,8 @@ CheckCreate::doApply()
// A check counts against the reserve of the issuing account, but we
// check the starting balance because we want to allow dipping into the
// reserve to pay fees.
auto const sponsorSle = getTxReserveSponsor(ctx_.getApplyViewContext());
auto applyViewContext = ctx_.getApplyViewContext();
auto const sponsorSle = getTxReserveSponsor(applyViewContext);
if (!sponsorSle)
return sponsorSle.error(); // LCOV_EXCL_LINE
if (auto const ret = checkInsufficientReserve(

View File

@@ -94,7 +94,9 @@ DelegateSet::doApply()
auto const& permissions = ctx_.tx.getFieldArray(sfPermissions);
if (permissions.empty())
return tecINTERNAL; // LCOV_EXCL_LINE
auto const sponsorSle = getTxReserveSponsor(ctx_.getApplyViewContext());
auto applyViewContext = ctx_.getApplyViewContext();
auto const sponsorSle = getTxReserveSponsor(applyViewContext);
if (!sponsorSle)
return sponsorSle.error(); // LCOV_EXCL_LINE
if (auto const ret = checkInsufficientReserve(

View File

@@ -178,10 +178,11 @@ EscrowCancel::doApply()
auto const issuer = amount.getIssuer();
bool const createAsset = account == accountID_;
auto applyViewContext = ctx_.getApplyViewContext();
if (auto const ret = std::visit(
[&]<typename T>(T const&) {
return escrowUnlockApplyHelper<T>(
ctx_.getApplyViewContext(),
applyViewContext,
kParityRate,
ctx_.view().rules().enabled(fixCleanup3_2_0) ? sle : slep,
preFeeBalance_,

View File

@@ -436,7 +436,8 @@ EscrowCreate::doApply()
STAmount const amount{ctx_.tx[sfAmount]};
auto const balance = sle->getFieldAmount(sfBalance).xrp();
auto const sponsorSle = getTxReserveSponsor(ctx_.getApplyViewContext());
auto applyViewContext = ctx_.getApplyViewContext();
auto const sponsorSle = getTxReserveSponsor(applyViewContext);
if (!sponsorSle)
return sponsorSle.error(); // LCOV_EXCL_LINE
if (auto const ret =

View File

@@ -362,10 +362,11 @@ EscrowFinish::doApply()
: kParityRate;
auto const issuer = amount.getIssuer();
bool const createAsset = destID == accountID_;
auto applyViewContext = ctx_.getApplyViewContext();
if (auto const ret = std::visit(
[&]<typename T>(T const&) {
return escrowUnlockApplyHelper<T>(
ctx_.getApplyViewContext(),
applyViewContext,
lockedRate,
sled,
preFeeBalance_,

View File

@@ -197,14 +197,10 @@ LoanBrokerCoverWithdraw::doApply()
view().update(broker);
associateAsset(*broker, vaultAsset);
auto applyViewContext = ctx_.getApplyViewContext();
return doWithdraw(
ctx_.getApplyViewContext(),
accountID_,
dstAcct,
brokerPseudoID,
preFeeBalance_,
amount,
j_);
applyViewContext, accountID_, dstAcct, brokerPseudoID, preFeeBalance_, amount, j_);
}
void

View File

@@ -158,7 +158,9 @@ LoanBrokerDelete::doApply()
view(), brokerPseudoID, accountID_, coverAvailable, j_, {}, WaiveTransferFee::Yes))
return ter;
}
if (auto ter = removeEmptyHolding(ctx_.getApplyViewContext(), brokerPseudoID, vaultAsset, j_))
auto applyViewContext = ctx_.getApplyViewContext();
if (auto ter = removeEmptyHolding(applyViewContext, brokerPseudoID, vaultAsset, j_))
return ter;
auto brokerPseudoSLE = view().peek(keylet::account(brokerPseudoID));

View File

@@ -247,8 +247,10 @@ LoanBrokerSet::doApply()
return maybePseudo.error(); // LCOV_EXCL_LINE
auto& pseudo = *maybePseudo;
auto pseudoId = pseudo->at(sfAccount);
auto applyViewContext = ctx_.getApplyViewContext();
if (auto ter = addEmptyHolding(
ctx_.getApplyViewContext(), pseudoId, preFeeBalance_, sleVault->at(sfAsset), j_))
applyViewContext, pseudoId, preFeeBalance_, sleVault->at(sfAsset), j_))
return ter;
// Initialize data fields:

View File

@@ -624,8 +624,9 @@ LoanPay::doApply()
if (brokerPayee == accountID_)
{
// The broker may have deleted their holding. Recreate it if needed
auto applyViewContext = ctx_.getApplyViewContext();
if (auto const ter = addEmptyHolding(
ctx_.getApplyViewContext(),
applyViewContext,
brokerPayee,
brokerPayeeSle->at(sfBalance).value().xrp(),
asset,

View File

@@ -538,12 +538,9 @@ LoanSet::doApply()
borrower == accountID_ || borrower == counterparty,
"xrpl::LoanSet::doApply",
"borrower signed transaction");
auto applyViewContext = ctx_.getApplyViewContext();
if (auto const ter = addEmptyHolding(
ctx_.getApplyViewContext(),
borrower,
borrowerSle->at(sfBalance).value().xrp(),
vaultAsset,
j_);
applyViewContext, borrower, borrowerSle->at(sfBalance).value().xrp(), vaultAsset, j_);
ter && ter != tecDUPLICATE)
{
// ignore tecDUPLICATE. That means the holding already exists, and
@@ -566,7 +563,7 @@ LoanSet::doApply()
"broker owner signed transaction");
if (auto const ter = addEmptyHolding(
ctx_.getApplyViewContext(),
applyViewContext,
brokerOwner,
brokerOwnerSle->at(sfBalance).value().xrp(),
vaultAsset,

View File

@@ -152,6 +152,7 @@ DepositPreauth::preclaim(PreclaimContext const& ctx)
TER
DepositPreauth::doApply()
{
auto applyViewContext = ctx_.getApplyViewContext();
if (ctx_.tx.isFieldPresent(sfAuthorize))
{
auto const sleOwner = view().peek(keylet::account(accountID_));
@@ -161,7 +162,7 @@ DepositPreauth::doApply()
// A preauth counts against the reserve of the issuing account, but we
// check the starting balance because we want to allow dipping into the
// reserve to pay fees.
auto const sponsorSle = getTxReserveSponsor(ctx_.getApplyViewContext());
auto const sponsorSle = getTxReserveSponsor(applyViewContext);
if (!sponsorSle)
return sponsorSle.error(); // LCOV_EXCL_LINE
if (auto const ret = checkInsufficientReserve(
@@ -209,7 +210,7 @@ DepositPreauth::doApply()
// A preauth counts against the reserve of the issuing account, but we
// check the starting balance because we want to allow dipping into the
// reserve to pay fees.
auto const sponsorSle = getTxReserveSponsor(ctx_.getApplyViewContext());
auto const sponsorSle = getTxReserveSponsor(applyViewContext);
if (!sponsorSle)
return sponsorSle.error(); // LCOV_EXCL_LINE
if (auto const ret = checkInsufficientReserve(

View File

@@ -203,7 +203,8 @@ PaymentChannelCreate::doApply()
// Deduct owner's balance, increment owner count
(*sle)[sfBalance] = (*sle)[sfBalance] - ctx_.tx[sfAmount];
auto const sponsorSle = getTxReserveSponsor(ctx_.getApplyViewContext());
auto applyViewContext = ctx_.getApplyViewContext();
auto const sponsorSle = getTxReserveSponsor(applyViewContext);
if (!sponsorSle)
return sponsorSle.error(); // LCOV_EXCL_LINE
adjustOwnerCount(ctx_.view(), sle, *sponsorSle, 1, ctx_.journal);

View File

@@ -90,7 +90,8 @@ PaymentChannelFund::doApply()
{
// Check reserve and funds availability
auto const balance = (*sle)[sfBalance];
auto const sponsorSle = getTxReserveSponsor(ctx_.getApplyViewContext());
auto applyViewContext = ctx_.getApplyViewContext();
auto const sponsorSle = getTxReserveSponsor(applyViewContext);
if (!sponsorSle)
return sponsorSle.error(); // LCOV_EXCL_LINE
if (auto const ret =

View File

@@ -143,8 +143,9 @@ TER
MPTokenAuthorize::doApply()
{
auto const& tx = ctx_.tx;
auto applyViewContext = ctx_.getApplyViewContext();
return authorizeMPToken(
ctx_.getApplyViewContext(),
applyViewContext,
preFeeBalance_,
tx[sfMPTokenIssuanceID],
accountID_,

View File

@@ -104,7 +104,7 @@ MPTokenIssuanceCreate::preflight(PreflightContext const& ctx)
std::expected<MPTID, TER>
MPTokenIssuanceCreate::create(
ApplyViewContext&& ctx,
ApplyViewContext& ctx,
beast::Journal journal,
MPTCreateArgs const& args)
{
@@ -116,7 +116,7 @@ MPTokenIssuanceCreate::create(
SLE::pointer sponsorSle;
if (!isPseudoAccount(acct))
{
auto sle = getTxReserveSponsor({.view = ctx.view, .tx = ctx.tx});
auto sle = getTxReserveSponsor(ctx);
if (!sle)
return std::unexpected(sle.error());
sponsorSle = std::move(*sle);
@@ -197,8 +197,9 @@ TER
MPTokenIssuanceCreate::doApply()
{
auto const& tx = ctx_.tx;
auto applyViewContext = ctx_.getApplyViewContext();
auto const result = create(
ctx_.getApplyViewContext(),
applyViewContext,
j_,
{
.priorBalance = preFeeBalance_,

View File

@@ -327,7 +327,9 @@ TrustSet::doApply()
// but the incremental reserve for the trust line as
// well. A person with no intention of using the gateway
// could use the extra XRP for their own purposes.
auto const sponsorSle = getTxReserveSponsor(ctx_.getApplyViewContext());
auto applyViewContext = ctx_.getApplyViewContext();
auto const sponsorSle = getTxReserveSponsor(applyViewContext);
if (!sponsorSle)
return sponsorSle.error(); // LCOV_EXCL_LINE

View File

@@ -399,8 +399,9 @@ VaultClawback::doApply()
// Keep MPToken if holder is the vault owner.
if (holder != vault->at(sfOwner))
{
auto applyViewContext = ctx_.getApplyViewContext();
if (auto const ter =
removeEmptyHolding(ctx_.getApplyViewContext(), holder, sharesDestroyed.asset(), j_);
removeEmptyHolding(applyViewContext, holder, sharesDestroyed.asset(), j_);
isTesSuccess(ter))
{
JLOG(j_.debug()) //

View File

@@ -146,6 +146,7 @@ VaultCreate::doApply()
// we can consider downgrading them to `tef` or `tem`.
auto const& tx = ctx_.tx;
auto applyViewContext = ctx_.getApplyViewContext();
auto const sequence = tx.getSeqValue();
auto const owner = view().peek(keylet::account(accountID_));
if (owner == nullptr)
@@ -167,7 +168,7 @@ VaultCreate::doApply()
AccountID const pseudoId = pseudo->at(sfAccount);
auto const asset = tx[sfAsset];
if (auto ter = addEmptyHolding(ctx_.getApplyViewContext(), pseudoId, preFeeBalance_, asset, j_);
if (auto ter = addEmptyHolding(applyViewContext, pseudoId, preFeeBalance_, asset, j_);
!isTesSuccess(ter))
return ter;
@@ -197,7 +198,7 @@ VaultCreate::doApply()
: keylet::line(pseudoId, asset.get<Issue>()).key;
}();
auto const maybeShare = MPTokenIssuanceCreate::create(
ctx_.getApplyViewContext(),
applyViewContext,
j_,
{
.priorBalance = std::nullopt,
@@ -244,7 +245,7 @@ VaultCreate::doApply()
// Explicitly create MPToken for the vault owner
if (auto const err = authorizeMPToken(
ctx_.getApplyViewContext(), preFeeBalance_, mptIssuanceID, accountID_, ctx_.journal);
applyViewContext, preFeeBalance_, mptIssuanceID, accountID_, ctx_.journal);
!isTesSuccess(err))
return err;
@@ -252,7 +253,7 @@ VaultCreate::doApply()
if (tx.isFlag(tfVaultPrivate))
{
if (auto const err = authorizeMPToken(
ctx_.getApplyViewContext(),
applyViewContext,
preFeeBalance_,
mptIssuanceID,
pseudoId,

View File

@@ -88,13 +88,14 @@ TER
VaultDelete::doApply()
{
auto const vault = view().peek(keylet::vault(ctx_.tx[sfVaultID]));
auto applyViewContext = ctx_.getApplyViewContext();
if (!vault)
return tefINTERNAL; // LCOV_EXCL_LINE
// Destroy the asset holding.
auto asset = vault->at(sfAsset);
if (auto ter = removeEmptyHolding(ctx_.getApplyViewContext(), vault->at(sfAccount), asset, j_);
if (auto ter = removeEmptyHolding(applyViewContext, vault->at(sfAccount), asset, j_);
!isTesSuccess(ter))
return ter;
@@ -123,8 +124,8 @@ VaultDelete::doApply()
// Try to remove MPToken for vault shares for the vault owner if it exists.
if (auto const mptoken = view().peek(keylet::mptoken(shareMPTID, accountID_)))
{
if (auto const ter = removeEmptyHolding(
ctx_.getApplyViewContext(), accountID_, MPTIssue(shareMPTID), j_);
if (auto const ter =
removeEmptyHolding(applyViewContext, accountID_, MPTIssue(shareMPTID), j_);
!isTesSuccess(ter))
{
// LCOV_EXCL_START

View File

@@ -187,6 +187,7 @@ VaultDeposit::doApply()
{
bool const fix320Enabled = view().rules().enabled(fixCleanup3_2_0);
auto const vault = view().peek(keylet::vault(ctx_.tx[sfVaultID]));
auto applyViewContext = ctx_.getApplyViewContext();
if (!vault)
return tefINTERNAL; // LCOV_EXCL_LINE
auto const vaultAsset = vault->at(sfAsset);
@@ -221,7 +222,7 @@ VaultDeposit::doApply()
if (vault->isFlag(lsfVaultPrivate) && accountID_ != vault->at(sfOwner))
{
if (auto const err = enforceMPTokenAuthorization(
ctx_.getApplyViewContext(), mptIssuanceID, accountID_, preFeeBalance_, j_);
applyViewContext, mptIssuanceID, accountID_, preFeeBalance_, j_);
!isTesSuccess(err))
return err;
}
@@ -231,7 +232,7 @@ VaultDeposit::doApply()
if (!view().exists(keylet::mptoken(mptIssuanceID, accountID_)))
{
if (auto const err = authorizeMPToken(
ctx_.getApplyViewContext(),
applyViewContext,
preFeeBalance_,
mptIssuanceID->value(),
accountID_,
@@ -247,7 +248,7 @@ VaultDeposit::doApply()
XRPL_ASSERT(
accountID_ == vault->at(sfOwner), "xrpl::VaultDeposit::doApply : account is owner");
if (auto const err = authorizeMPToken(
ctx_.getApplyViewContext(),
applyViewContext,
preFeeBalance_, // priorBalance
mptIssuanceID->value(), // mptIssuanceID
sleIssuance->at(sfIssuer), // account

View File

@@ -176,6 +176,7 @@ TER
VaultWithdraw::doApply()
{
auto const vault = view().peek(keylet::vault(ctx_.tx[sfVaultID]));
auto applyViewContext = ctx_.getApplyViewContext();
if (!vault)
return tefINTERNAL; // LCOV_EXCL_LINE
@@ -337,8 +338,8 @@ VaultWithdraw::doApply()
// Keep MPToken if holder is the vault owner.
if (accountID_ != vault->at(sfOwner))
{
if (auto const ter = removeEmptyHolding(
ctx_.getApplyViewContext(), accountID_, sharesRedeemed.asset(), j_);
if (auto const ter =
removeEmptyHolding(applyViewContext, accountID_, sharesRedeemed.asset(), j_);
isTesSuccess(ter))
{
JLOG(j_.debug()) //
@@ -365,13 +366,7 @@ VaultWithdraw::doApply()
associateAsset(*vault, vaultAsset);
return doWithdraw(
ctx_.getApplyViewContext(),
accountID_,
dstAcct,
vaultAccount,
preFeeBalance_,
assetsWithdrawn,
j_);
applyViewContext, accountID_, dstAcct, vaultAccount, preFeeBalance_, assetsWithdrawn, j_);
}
void