mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-26 22:15:52 +00:00
Add DepositPreauth ledger type and transaction (RIPD-1624):
The lsfDepositAuth flag limits the AccountIDs that can deposit into the account that has the flag set. The original design only allowed deposits to complete if the account with the flag set also signed the transaction that caused the deposit. The DepositPreauth ledger type allows an account with the lsfDepositAuth flag set to preauthorize additional accounts. This preauthorization allows them to sign deposits as well. An account can add DepositPreauth objects to the ledger (and remove them as well) using the DepositPreauth transaction.
This commit is contained in:
@@ -355,6 +355,7 @@ public:
|
||||
BEAST_EXPECT (acct_objs_is_size (acct_objs (gw, jss::account), 0));
|
||||
BEAST_EXPECT (acct_objs_is_size (acct_objs (gw, jss::amendments), 0));
|
||||
BEAST_EXPECT (acct_objs_is_size (acct_objs (gw, jss::check), 0));
|
||||
BEAST_EXPECT (acct_objs_is_size (acct_objs (gw, jss::deposit_preauth), 0));
|
||||
BEAST_EXPECT (acct_objs_is_size (acct_objs (gw, jss::directory), 0));
|
||||
BEAST_EXPECT (acct_objs_is_size (acct_objs (gw, jss::escrow), 0));
|
||||
BEAST_EXPECT (acct_objs_is_size (acct_objs (gw, jss::fee), 0));
|
||||
@@ -400,6 +401,18 @@ public:
|
||||
BEAST_EXPECT (check[sfDestination.jsonName] == alice.human());
|
||||
BEAST_EXPECT (check[sfSendMax.jsonName][jss::value].asUInt() == 10);
|
||||
}
|
||||
// gw preauthorizes payments from alice.
|
||||
env (deposit::auth (gw, alice));
|
||||
env.close();
|
||||
{
|
||||
// Find the preauthorization.
|
||||
Json::Value const resp = acct_objs (gw, jss::deposit_preauth);
|
||||
BEAST_EXPECT (acct_objs_is_size (resp, 1));
|
||||
|
||||
auto const& preauth = resp[jss::result][jss::account_objects][0u];
|
||||
BEAST_EXPECT (preauth[sfAccount.jsonName] == gw.human());
|
||||
BEAST_EXPECT (preauth[sfAuthorize.jsonName] == alice.human());
|
||||
}
|
||||
{
|
||||
// gw creates an escrow that we can look for in the ledger.
|
||||
Json::Value jvEscrow;
|
||||
@@ -485,7 +498,7 @@ public:
|
||||
auto const& ticket = resp[jss::result][jss::account_objects][0u];
|
||||
BEAST_EXPECT (ticket[sfAccount.jsonName] == gw.human());
|
||||
BEAST_EXPECT (ticket[sfLedgerEntryType.jsonName] == "Ticket");
|
||||
BEAST_EXPECT (ticket[sfSequence.jsonName].asUInt() == 8);
|
||||
BEAST_EXPECT (ticket[sfSequence.jsonName].asUInt() == 9);
|
||||
}
|
||||
// Run up the number of directory entries so gw has two
|
||||
// directory nodes.
|
||||
|
||||
Reference in New Issue
Block a user