mirror of
https://github.com/XRPLF/rippled.git
synced 2026-08-23 23:30:54 +00:00
fix build issues
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -204,7 +204,8 @@ SponsorshipSet::doApply()
|
||||
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
|
||||
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -95,7 +95,8 @@ DelegateSet::doApply()
|
||||
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(
|
||||
|
||||
@@ -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_,
|
||||
|
||||
@@ -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 =
|
||||
|
||||
@@ -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_,
|
||||
|
||||
@@ -159,7 +159,8 @@ LoanBrokerDelete::doApply()
|
||||
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));
|
||||
|
||||
@@ -248,8 +248,9 @@ LoanBrokerSet::doApply()
|
||||
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:
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -531,12 +531,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
|
||||
@@ -559,7 +556,7 @@ LoanSet::doApply()
|
||||
"broker owner signed transaction");
|
||||
|
||||
if (auto const ter = addEmptyHolding(
|
||||
ctx_.getApplyViewContext(),
|
||||
applyViewContext,
|
||||
brokerOwner,
|
||||
brokerOwnerSle->at(sfBalance).value().xrp(),
|
||||
vaultAsset,
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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 =
|
||||
|
||||
@@ -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_,
|
||||
|
||||
@@ -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_,
|
||||
|
||||
@@ -328,7 +328,8 @@ TrustSet::doApply()
|
||||
// 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
|
||||
|
||||
|
||||
@@ -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()) //
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user