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:
Scott Schurr
2018-04-20 13:16:17 -07:00
committed by seelabs
parent b444196bf9
commit 008ff67ac2
56 changed files with 1589 additions and 177 deletions

View File

@@ -198,6 +198,15 @@ getCheckIndex (AccountID const& account, std::uint32_t uSequence)
std::uint32_t(uSequence));
}
uint256
getDepositPreauthIndex (AccountID const& owner, AccountID const& preauthorized)
{
return sha512Half(
std::uint16_t(spaceDepositPreauth),
owner,
preauthorized);
}
//------------------------------------------------------------------------------
namespace keylet {
@@ -300,6 +309,13 @@ Keylet check_t::operator()(AccountID const& id,
getCheckIndex(id, seq) };
}
Keylet depositPreauth_t::operator()(AccountID const& owner,
AccountID const& preauthorized) const
{
return { ltDEPOSIT_PREAUTH,
getDepositPreauthIndex(owner, preauthorized) };
}
//------------------------------------------------------------------------------
Keylet unchecked (uint256 const& key)