mirror of
https://github.com/XRPLF/rippled.git
synced 2026-06-04 01:06:48 +00:00
Fixed the minimum amount for creating a Sponsored Account.
This commit is contained in:
@@ -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));
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user