mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Introduce support for deletable accounts:
The XRP Ledger utilizes an account model. Unlike systems based on a UTXO model, XRP Ledger accounts are first-class objects. This design choice allows the XRP Ledger to offer rich functionality, including the ability to own objects (offers, escrows, checks, signer lists) as well as other advanced features, such as key rotation and configurable multi-signing without needing to change a destination address. The trade-off is that accounts must be stored on ledger. The XRP Ledger applies reserve requirements, in XRP, to protect the shared global ledger from growing excessively large as the result of spam or malicious usage. Prior to this commit, accounts had been permanent objects; once created, they could never be deleted. This commit introduces a new amendment "DeletableAccounts" which, if enabled, will allow account objects to be deleted by executing the new "AccountDelete" transaction. Any funds remaining in the account will be transferred to an account specified in the deletion transaction. The amendment changes the mechanics of account creation; previously a new account would have an initial sequence number of 1. Accounts created after the amendment will have an initial sequence number that is equal to the ledger in which the account was created. Accounts can only be deleted if they are not associated with any obligations (like RippleStates, Escrows, or PayChannels) and if the current ledger sequence number exceeds the account's sequence number by at least 256 so that, if recreated, the account can be protected from transaction replay.
This commit is contained in:
committed by
Manoj doshi
parent
7e7664c29a
commit
a3a9dc26b4
@@ -94,6 +94,7 @@ struct Directory_test : public beast::unit_test::suite
|
||||
env.fund(XRP(10000000), alice, bob, gw);
|
||||
|
||||
// Insert 400 offers from Alice, then one from Bob:
|
||||
std::uint32_t const firstOfferSeq {env.seq (alice)};
|
||||
for (std::size_t i = 1; i <= 400; ++i)
|
||||
env(offer(alice, USD(10), XRP(10)));
|
||||
|
||||
@@ -104,7 +105,7 @@ struct Directory_test : public beast::unit_test::suite
|
||||
auto dir = Dir(*env.current(),
|
||||
keylet::ownerDir(alice));
|
||||
|
||||
std::uint32_t lastSeq = 1;
|
||||
std::uint32_t lastSeq = firstOfferSeq - 1;
|
||||
|
||||
// Check that the orders are sequential by checking
|
||||
// that their sequence numbers are:
|
||||
@@ -121,6 +122,7 @@ struct Directory_test : public beast::unit_test::suite
|
||||
Env env(*this);
|
||||
env.fund(XRP(10000000), alice, gw);
|
||||
|
||||
std::uint32_t const firstOfferSeq {env.seq (alice)};
|
||||
for (std::size_t i = 1; i <= 400; ++i)
|
||||
env(offer(alice, USD(i), XRP(i)));
|
||||
env.close();
|
||||
@@ -143,8 +145,9 @@ struct Directory_test : public beast::unit_test::suite
|
||||
|
||||
// Ensure that the page contains the correct orders by
|
||||
// calculating which sequence numbers belong here.
|
||||
std::uint32_t minSeq = 2 + (page * dirNodeMaxEntries);
|
||||
std::uint32_t maxSeq = minSeq + dirNodeMaxEntries;
|
||||
std::uint32_t const minSeq =
|
||||
firstOfferSeq + (page * dirNodeMaxEntries);
|
||||
std::uint32_t const maxSeq = minSeq + dirNodeMaxEntries;
|
||||
|
||||
for (auto const& e : v)
|
||||
{
|
||||
@@ -295,6 +298,7 @@ struct Directory_test : public beast::unit_test::suite
|
||||
auto const USD = gw["USD"];
|
||||
|
||||
env.fund(XRP(10000), alice, gw);
|
||||
env.close();
|
||||
env.trust(USD(1000), alice);
|
||||
env(pay(gw, alice, USD(1000)));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user