Skip to content

Commit

Permalink
fix same as fixNFTokenTrustlineSurprise
Browse files Browse the repository at this point in the history
  • Loading branch information
tequdev committed Mar 15, 2024
1 parent 6e0d26f commit f65eea7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/ripple/app/tx/impl/NFTokenMint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,10 @@ NFTokenMint::preclaim(PreclaimContext const& ctx)
auto const nftIssuer =
ctx.tx[~sfIssuer].value_or(ctx.tx[sfAccount]);

if (!ctx.view.exists(keylet::line(nftIssuer, amount->issue())))
// If the IOU issuer and the NFToken issuer are the same,
// then that issuer does not need a trust line to accept their fee.
if (nftIssuer != amount->getIssuer() &&
!ctx.view.read(keylet::line(nftIssuer, amount->issue())))
return tecNO_LINE;

if (isFrozen(
Expand Down
9 changes: 9 additions & 0 deletions src/test/app/NFToken_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6707,6 +6707,15 @@ class NFTokenBaseUtil_test : public beast::unit_test::suite
env.close();
BEAST_EXPECT(ownerCount(env, alice) == 0);

// If the IOU issuer and the NFToken issuer are the same,
// then that issuer does not need a trust line to accept their
// fee.
env(token::mint(gw),
token::amount(gwAUD(1000)),
txflags(tfTransferable),
token::xferFee(10));
env.close();

// Give alice the needed trust line, but freeze it.
env(trust(gw, alice["AUD"](999), tfSetFreeze));
env.close();
Expand Down

0 comments on commit f65eea7

Please sign in to comment.