mirror of
https://github.com/XRPLF/rippled.git
synced 2026-07-28 01:20:32 +00:00
clean up
This commit is contained in:
@@ -231,29 +231,12 @@ createMPToken(
|
||||
SLE::ref sponsorSle,
|
||||
std::uint32_t const flags);
|
||||
|
||||
TER
|
||||
checkCreateMPT(
|
||||
xrpl::ApplyViewContext& ctx,
|
||||
xrpl::MPTIssue const& mptIssue,
|
||||
xrpl::AccountID const& holder,
|
||||
beast::Journal j);
|
||||
|
||||
inline TER
|
||||
checkCreateMPT(
|
||||
xrpl::ApplyViewContext&& ctx,
|
||||
xrpl::MPTIssue const& mptIssue,
|
||||
xrpl::AccountID const& holder,
|
||||
beast::Journal j)
|
||||
{
|
||||
return checkCreateMPT(ctx, mptIssue, holder, j);
|
||||
}
|
||||
|
||||
TER
|
||||
checkCreateMPT(
|
||||
ApplyView& view,
|
||||
ReserveContext const& reserveCtx,
|
||||
xrpl::MPTIssue const& mptIssue,
|
||||
xrpl::AccountID const& holder,
|
||||
SLE::ref sponsorSle,
|
||||
beast::Journal j);
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
@@ -939,14 +939,18 @@ createMPToken(
|
||||
return tesSUCCESS;
|
||||
}
|
||||
|
||||
static TER
|
||||
checkCreateMPTWithReserve(
|
||||
TER
|
||||
checkCreateMPT(
|
||||
ApplyView& view,
|
||||
ReserveContext const& reserveCtx,
|
||||
xrpl::MPTIssue const& mptIssue,
|
||||
xrpl::AccountID const& holder,
|
||||
beast::Journal j)
|
||||
{
|
||||
XRPL_ASSERT(
|
||||
reserveCtx.accountID == holder,
|
||||
"xrpl::checkCreateMPTWithReserve : reserve context matches holder");
|
||||
|
||||
if (mptIssue.getIssuer() == holder)
|
||||
return tesSUCCESS;
|
||||
|
||||
@@ -971,35 +975,6 @@ checkCreateMPTWithReserve(
|
||||
return tesSUCCESS;
|
||||
}
|
||||
|
||||
TER
|
||||
checkCreateMPT(
|
||||
xrpl::ApplyViewContext& ctx,
|
||||
xrpl::MPTIssue const& mptIssue,
|
||||
xrpl::AccountID const& holder,
|
||||
beast::Journal j)
|
||||
{
|
||||
return checkCreateMPTWithReserve(ctx.view, ctx.reserveContext, mptIssue, holder, j);
|
||||
}
|
||||
|
||||
TER
|
||||
checkCreateMPT(
|
||||
ApplyView& view,
|
||||
xrpl::MPTIssue const& mptIssue,
|
||||
xrpl::AccountID const& holder,
|
||||
SLE::ref sponsorSle,
|
||||
beast::Journal j)
|
||||
{
|
||||
auto const sponsorID = sponsorSle
|
||||
? std::optional<AccountID>{sponsorSle->getAccountID(sfAccount)}
|
||||
: std::optional<AccountID>{};
|
||||
return checkCreateMPTWithReserve(
|
||||
view,
|
||||
ReserveContext{holder, view.peek(keylet::account(holder)), sponsorID, sponsorSle, nullptr},
|
||||
mptIssue,
|
||||
holder,
|
||||
j);
|
||||
}
|
||||
|
||||
std::int64_t
|
||||
maxMPTAmount(SLE const& sleIssuance)
|
||||
{
|
||||
|
||||
@@ -731,11 +731,14 @@ BookStep<TIn, TOut, TDerived>::forEachOffer(
|
||||
// Create MPToken for the offer's owner. No need to check
|
||||
// for the reserve since the offer is removed if it is consumed.
|
||||
// Therefore, the owner count remains the same.
|
||||
if (auto const err = checkCreateMPT(sb, assetIn.get<MPTIssue>(), owner, {}, j_);
|
||||
if (auto const err = checkCreateMPT(
|
||||
sb,
|
||||
ReserveContext{owner, sb.peek(keylet::account(owner)), {}, nullptr, nullptr},
|
||||
assetIn.get<MPTIssue>(),
|
||||
owner,
|
||||
j_);
|
||||
!isTesSuccess(err))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// It shouldn't matter from auth point of view whether it's sb
|
||||
|
||||
@@ -410,7 +410,12 @@ MPTEndpointOfferCrossingStep::checkCreateMPT(ApplyView& view, xrpl::DebtDirectio
|
||||
// for the reserve since the offer doesn't go on the books
|
||||
// if crossed. Insufficient reserve is allowed if the offer
|
||||
// crossed. See CreateOffer::applyGuts() for reserve check.
|
||||
if (auto const err = xrpl::checkCreateMPT(view, mptIssue_, dst_, {}, j_);
|
||||
if (auto const err = xrpl::checkCreateMPT(
|
||||
view,
|
||||
ReserveContext{dst_, view.peek(keylet::account(dst_)), {}, nullptr, nullptr},
|
||||
mptIssue_,
|
||||
dst_,
|
||||
j_);
|
||||
!isTesSuccess(err))
|
||||
{
|
||||
JLOG(j_.trace()) << "MPTEndpointStep::checkCreateMPT: failed create MPT";
|
||||
|
||||
@@ -504,8 +504,12 @@ CheckCash::doApply()
|
||||
if (sleDst == nullptr)
|
||||
return tecINSUFFICIENT_RESERVE;
|
||||
|
||||
if (auto const err =
|
||||
checkCreateMPT(applyViewContext, issue, accountID_, j_);
|
||||
if (auto const err = checkCreateMPT(
|
||||
applyViewContext.view,
|
||||
applyViewContext.reserveContext,
|
||||
issue,
|
||||
accountID_,
|
||||
j_);
|
||||
!isTesSuccess(err))
|
||||
{
|
||||
return err;
|
||||
|
||||
@@ -654,11 +654,15 @@ AMMWithdraw::withdraw(
|
||||
!isTesSuccess(err))
|
||||
return err;
|
||||
|
||||
if (auto const err = checkCreateMPT(view, mptIssue, account, {}, journal);
|
||||
if (auto const err = checkCreateMPT(
|
||||
view,
|
||||
ReserveContext{
|
||||
account, view.peek(keylet::account(account)), {}, nullptr, nullptr},
|
||||
mptIssue,
|
||||
account,
|
||||
journal);
|
||||
!isTesSuccess(err))
|
||||
{
|
||||
return err;
|
||||
}
|
||||
}
|
||||
return tesSUCCESS;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user