Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

addess comments #46

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading