Skip to content

Commit

Permalink
address comments (XRPLF#46)
Browse files Browse the repository at this point in the history
  • Loading branch information
shawnxie999 authored Oct 23, 2024
1 parent 9d84f3b commit e8201f3
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/xrpld/app/tx/detail/MPTokenAuthorize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,6 @@ MPTokenAuthorize::preclaim(PreclaimContext const& ctx)
auto const accountID = ctx.tx[sfAccount];
auto const holderID = ctx.tx[~sfMPTokenHolder];

if (holderID && !(ctx.view.exists(keylet::account(*holderID))))
return tecNO_DST;

// if non-issuer account submits this tx, then they are trying either:
// 1. Unauthorize/delete MPToken
// 2. Use/create MPToken
Expand Down Expand Up @@ -106,6 +103,9 @@ MPTokenAuthorize::preclaim(PreclaimContext const& ctx)
return tesSUCCESS;
}

if (!ctx.view.exists(keylet::account(*holderID)))
return tecNO_DST;

auto const sleMptIssuance =
ctx.view.read(keylet::mptIssuance(ctx.tx[sfMPTokenIssuanceID]));
if (!sleMptIssuance)
Expand Down Expand Up @@ -178,6 +178,12 @@ MPTokenAuthorize::authorize(
// A potential holder wants to authorize/hold a mpt, the ledger must:
// - add the new mptokenKey to the owner directory
// - create the MPToken object for the holder

// The reserve that is required to create the MPToken. Note
// that although the reserve increases with every item
// an account owns, in the case of MPTokens we only
// *enforce* a reserve if the user owns more than two
// items. This is similar to the reserve requirements of trust lines.
std::uint32_t const uOwnerCount = sleAcct->getFieldU32(sfOwnerCount);
XRPAmount const reserveCreate(
(uOwnerCount < 2) ? XRPAmount(beast::zero)
Expand Down

0 comments on commit e8201f3

Please sign in to comment.