From 7cdaa24e63e72991363b0cb77a4d06a9b0b95338 Mon Sep 17 00:00:00 2001 From: tequ Date: Fri, 30 Jan 2026 20:27:46 +0900 Subject: [PATCH] Fixed the minimum amount for creating a Sponsored Account. --- src/test/app/Sponsor_test.cpp | 32 +++++++++++++---------------- src/xrpld/app/tx/detail/Payment.cpp | 5 +++++ 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/src/test/app/Sponsor_test.cpp b/src/test/app/Sponsor_test.cpp index 8ba30372ce..5e1bbea2dc 100644 --- a/src/test/app/Sponsor_test.cpp +++ b/src/test/app/Sponsor_test.cpp @@ -1155,7 +1155,6 @@ public: { testcase("Sponsor Account"); using namespace test::jtx; - Env env{*this, testable_amendments() - featureSponsor}; Account const alice("alice"); Account const sponsor("sponsor"); @@ -1163,13 +1162,18 @@ public: Account const charlie("charlie"); Account const gw("gw"); auto const USD = gw["USD"]; + + { + // Disabled + Env env{*this, testable_amendments() - featureSponsor}; + env.fund(XRP(10000), alice, sponsor); + env.close(); + env(pay(alice, bob, XRP(100)), txflags(tfSponsorCreatedAccount), ter(temDISABLED)); + env.close(); + } + + Env env{*this, testable_amendments()}; env.fund(XRP(10000), alice, sponsor); - - // Disabled - env(pay(alice, bob, XRP(100)), txflags(tfSponsorCreatedAccount), ter(temDISABLED)); - env.close(); - - env.enableFeature(featureSponsor); env.close(); // Invalid flags @@ -1187,12 +1191,6 @@ public: env(pay(alice, bob, USD(100)), txflags(tfSponsorCreatedAccount), ter(temBAD_AMOUNT)); env.close(); - // Insufficient reserve - env(pay(alice, bob, (env.current()->fees().accountReserve(0) - drops(1))), - txflags(tfSponsorCreatedAccount), - ter(tecNO_DST_INSUF_XRP)); - env.close(); - // Account is not sponsored by normal Sponsor specification { env(pay(alice, bob, drops(env.current()->fees().accountReserve(0))), @@ -1209,13 +1207,11 @@ public: // Use tfSponsorCreatedAccount to sponsor an account { // to funded account - env(pay(sponsor, bob, drops(env.current()->fees().accountReserve(0))), - txflags(tfSponsorCreatedAccount), - ter(tecNO_SPONSOR_PERMISSION)); + env(pay(sponsor, bob, drops(1)), txflags(tfSponsorCreatedAccount), ter(tecNO_SPONSOR_PERMISSION)); + env.close(); // to non-funded account - env(pay(sponsor, charlie, drops(env.current()->fees().accountReserve(0))), - txflags(tfSponsorCreatedAccount)); + env(pay(sponsor, charlie, drops(1)), txflags(tfSponsorCreatedAccount)); env.close(); auto const charlieSle = env.le(keylet::account(charlie)); diff --git a/src/xrpld/app/tx/detail/Payment.cpp b/src/xrpld/app/tx/detail/Payment.cpp index e57415ac43..9980cc3d1e 100644 --- a/src/xrpld/app/tx/detail/Payment.cpp +++ b/src/xrpld/app/tx/detail/Payment.cpp @@ -299,6 +299,11 @@ Payment::preclaim(PreclaimContext const& ctx) // transaction would succeed. return telNO_DST_PARTIAL; } + else if (txFlags & tfSponsorCreatedAccount) + { + // The minimum amount when creating a Sponsored Account is 1 drop. + // Since the reserve is covered by the sponsor, you don't need to hold the 1-increment reserve yourself. + } else if (dstAmount < STAmount(ctx.view.fees().reserve)) { // accountReserve is the minimum amount that an account can have.