From f65eea7b220bdab1b419666badb62e6122e99561 Mon Sep 17 00:00:00 2001 From: tequ Date: Fri, 15 Mar 2024 12:32:05 +0900 Subject: [PATCH] fix same as fixNFTokenTrustlineSurprise --- src/ripple/app/tx/impl/NFTokenMint.cpp | 5 ++++- src/test/app/NFToken_test.cpp | 9 +++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/ripple/app/tx/impl/NFTokenMint.cpp b/src/ripple/app/tx/impl/NFTokenMint.cpp index c8e8a3b0512..aa1588baa95 100644 --- a/src/ripple/app/tx/impl/NFTokenMint.cpp +++ b/src/ripple/app/tx/impl/NFTokenMint.cpp @@ -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( diff --git a/src/test/app/NFToken_test.cpp b/src/test/app/NFToken_test.cpp index c3102f66b03..f6277a61014 100644 --- a/src/test/app/NFToken_test.cpp +++ b/src/test/app/NFToken_test.cpp @@ -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();