mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-20 11:05:54 +00:00
Keep existing order of checks
This commit is contained in:
@@ -77,6 +77,11 @@ MPTokenIssuanceCreate::create(
|
|||||||
if (!acct)
|
if (!acct)
|
||||||
return Unexpected(tecINTERNAL);
|
return Unexpected(tecINTERNAL);
|
||||||
|
|
||||||
|
if (args.priorBalance &&
|
||||||
|
*(args.priorBalance) <
|
||||||
|
view.fees().accountReserve((*acct)[sfOwnerCount] + 1))
|
||||||
|
return Unexpected(tecINSUFFICIENT_RESERVE);
|
||||||
|
|
||||||
auto mptId = makeMptID(args.sequence, args.account);
|
auto mptId = makeMptID(args.sequence, args.account);
|
||||||
auto const mptIssuanceKeylet = keylet::mptIssuance(mptId);
|
auto const mptIssuanceKeylet = keylet::mptIssuance(mptId);
|
||||||
|
|
||||||
@@ -125,11 +130,6 @@ TER
|
|||||||
MPTokenIssuanceCreate::doApply()
|
MPTokenIssuanceCreate::doApply()
|
||||||
{
|
{
|
||||||
auto const& tx = ctx_.tx;
|
auto const& tx = ctx_.tx;
|
||||||
|
|
||||||
auto const acct = view().peek(keylet::account(account_));
|
|
||||||
if (mPriorBalance < view().fees().accountReserve((*acct)[sfOwnerCount] + 1))
|
|
||||||
return tecINSUFFICIENT_RESERVE;
|
|
||||||
|
|
||||||
auto result = create(
|
auto result = create(
|
||||||
view(),
|
view(),
|
||||||
j_,
|
j_,
|
||||||
@@ -139,7 +139,8 @@ MPTokenIssuanceCreate::doApply()
|
|||||||
.maxAmount = tx[~sfMaximumAmount],
|
.maxAmount = tx[~sfMaximumAmount],
|
||||||
.assetScale = tx[~sfAssetScale],
|
.assetScale = tx[~sfAssetScale],
|
||||||
.transferFee = tx[~sfTransferFee],
|
.transferFee = tx[~sfTransferFee],
|
||||||
.metadata = tx[~sfMPTokenMetadata]});
|
.metadata = tx[~sfMPTokenMetadata],
|
||||||
|
.priorBalance = mPriorBalance});
|
||||||
return result ? tesSUCCESS : result.error();
|
return result ? tesSUCCESS : result.error();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ struct MPTCreateArgs
|
|||||||
std::optional<std::uint16_t> transferFee{};
|
std::optional<std::uint16_t> transferFee{};
|
||||||
std::optional<Slice> const& metadata{};
|
std::optional<Slice> const& metadata{};
|
||||||
std::optional<uint256> domainId{};
|
std::optional<uint256> domainId{};
|
||||||
|
std::optional<XRPAmount> priorBalance{};
|
||||||
};
|
};
|
||||||
|
|
||||||
class MPTokenIssuanceCreate : public Transactor
|
class MPTokenIssuanceCreate : public Transactor
|
||||||
|
|||||||
Reference in New Issue
Block a user