mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Rename Account to AccountID
This commit is contained in:
committed by
Nik Bougalis
parent
e1cd1e9e32
commit
9dd08e4dab
@@ -58,7 +58,7 @@ getLedgerFeeIndex ()
|
||||
}
|
||||
|
||||
uint256
|
||||
getAccountRootIndex (Account const& account)
|
||||
getAccountRootIndex (AccountID const& account)
|
||||
{
|
||||
return sha512Half(
|
||||
std::uint16_t(spaceAccount),
|
||||
@@ -72,7 +72,7 @@ getAccountRootIndex (const RippleAddress & account)
|
||||
}
|
||||
|
||||
uint256
|
||||
getGeneratorIndex (Account const& uGeneratorID)
|
||||
getGeneratorIndex (AccountID const& uGeneratorID)
|
||||
{
|
||||
return sha512Half(
|
||||
std::uint16_t(spaceGenerator),
|
||||
@@ -93,7 +93,7 @@ getBookBase (Book const& book)
|
||||
}
|
||||
|
||||
uint256
|
||||
getOfferIndex (Account const& account, std::uint32_t uSequence)
|
||||
getOfferIndex (AccountID const& account, std::uint32_t uSequence)
|
||||
{
|
||||
return sha512Half(
|
||||
std::uint16_t(spaceOffer),
|
||||
@@ -102,7 +102,7 @@ getOfferIndex (Account const& account, std::uint32_t uSequence)
|
||||
}
|
||||
|
||||
uint256
|
||||
getOwnerDirIndex (Account const& account)
|
||||
getOwnerDirIndex (AccountID const& account)
|
||||
{
|
||||
return sha512Half(
|
||||
std::uint16_t(spaceOwnerDir),
|
||||
@@ -155,7 +155,7 @@ getQuality (uint256 const& uBase)
|
||||
}
|
||||
|
||||
uint256
|
||||
getTicketIndex (Account const& account, std::uint32_t uSequence)
|
||||
getTicketIndex (AccountID const& account, std::uint32_t uSequence)
|
||||
{
|
||||
return sha512Half(
|
||||
std::uint16_t(spaceTicket),
|
||||
@@ -164,7 +164,7 @@ getTicketIndex (Account const& account, std::uint32_t uSequence)
|
||||
}
|
||||
|
||||
uint256
|
||||
getRippleStateIndex (Account const& a, Account const& b, Currency const& currency)
|
||||
getRippleStateIndex (AccountID const& a, AccountID const& b, Currency const& currency)
|
||||
{
|
||||
if (a < b)
|
||||
return sha512Half(
|
||||
@@ -180,13 +180,13 @@ getRippleStateIndex (Account const& a, Account const& b, Currency const& currenc
|
||||
}
|
||||
|
||||
uint256
|
||||
getRippleStateIndex (Account const& a, Issue const& issue)
|
||||
getRippleStateIndex (AccountID const& a, Issue const& issue)
|
||||
{
|
||||
return getRippleStateIndex (a, issue.account, issue.currency);
|
||||
}
|
||||
|
||||
uint256
|
||||
getSignerListIndex (Account const& account)
|
||||
getSignerListIndex (AccountID const& account)
|
||||
{
|
||||
return sha512Half(
|
||||
std::uint16_t(spaceSignerList),
|
||||
@@ -198,7 +198,7 @@ getSignerListIndex (Account const& account)
|
||||
namespace keylet {
|
||||
|
||||
Keylet account_t::operator()(
|
||||
Account const& id) const
|
||||
AccountID const& id) const
|
||||
{
|
||||
return { ltACCOUNT_ROOT,
|
||||
getAccountRootIndex(id) };
|
||||
@@ -212,7 +212,7 @@ Keylet account_t::operator()(
|
||||
}
|
||||
|
||||
Keylet owndir_t::operator()(
|
||||
Account const& id) const
|
||||
AccountID const& id) const
|
||||
{
|
||||
return { ltDIR_NODE,
|
||||
getOwnerDirIndex(id) };
|
||||
@@ -248,7 +248,7 @@ Keylet book_t::operator()(Book const& b) const
|
||||
getBookBase(b) };
|
||||
}
|
||||
|
||||
Keylet offer_t::operator()(Account const& id,
|
||||
Keylet offer_t::operator()(AccountID const& id,
|
||||
std::uint32_t seq) const
|
||||
{
|
||||
return { ltOFFER,
|
||||
@@ -278,28 +278,28 @@ Keylet next_t::operator()(Keylet const& k) const
|
||||
getQualityNext(k.key) };
|
||||
}
|
||||
|
||||
Keylet ticket_t::operator()(Account const& id,
|
||||
Keylet ticket_t::operator()(AccountID const& id,
|
||||
std::uint32_t seq) const
|
||||
{
|
||||
return { ltTICKET,
|
||||
getTicketIndex(id, seq) };
|
||||
}
|
||||
|
||||
Keylet trust_t::operator()(Account const& id0,
|
||||
Account const& id1, Currency const& currency) const
|
||||
Keylet trust_t::operator()(AccountID const& id0,
|
||||
AccountID const& id1, Currency const& currency) const
|
||||
{
|
||||
return { ltRIPPLE_STATE,
|
||||
getRippleStateIndex(id0, id1, currency) };
|
||||
}
|
||||
|
||||
Keylet trust_t::operator()(Account const& id,
|
||||
Keylet trust_t::operator()(AccountID const& id,
|
||||
Issue const& issue) const
|
||||
{
|
||||
return { ltRIPPLE_STATE,
|
||||
getRippleStateIndex(id, issue) };
|
||||
}
|
||||
|
||||
Keylet signers_t::operator()(Account const& id) const
|
||||
Keylet signers_t::operator()(AccountID const& id) const
|
||||
{
|
||||
return { ltSIGNER_LIST,
|
||||
getSignerListIndex(id) };
|
||||
|
||||
@@ -325,7 +325,7 @@ void RippleAddress::signNodePrivate (uint256 const& hash, Blob& vchSig) const
|
||||
// AccountID
|
||||
//
|
||||
|
||||
Account RippleAddress::getAccountID () const
|
||||
AccountID RippleAddress::getAccountID () const
|
||||
{
|
||||
switch (nVersion)
|
||||
{
|
||||
@@ -333,12 +333,12 @@ Account RippleAddress::getAccountID () const
|
||||
throw std::runtime_error ("unset source - getAccountID");
|
||||
|
||||
case VER_ACCOUNT_ID:
|
||||
return Account(vchData);
|
||||
return AccountID(vchData);
|
||||
|
||||
case VER_ACCOUNT_PUBLIC: {
|
||||
// Note, we are encoding the left.
|
||||
// TODO(tom): decipher this comment.
|
||||
Account account;
|
||||
AccountID account;
|
||||
account.copyFrom (Hash160 (vchData));
|
||||
return account;
|
||||
}
|
||||
@@ -428,7 +428,7 @@ bool RippleAddress::setAccountID (
|
||||
{
|
||||
if (strAccountID.empty ())
|
||||
{
|
||||
setAccountID (Account ());
|
||||
setAccountID (AccountID ());
|
||||
|
||||
mIsValid = true;
|
||||
}
|
||||
@@ -440,7 +440,7 @@ bool RippleAddress::setAccountID (
|
||||
return mIsValid;
|
||||
}
|
||||
|
||||
void RippleAddress::setAccountID (Account const& hash160)
|
||||
void RippleAddress::setAccountID (AccountID const& hash160)
|
||||
{
|
||||
mIsValid = true;
|
||||
SetData (VER_ACCOUNT_ID, hash160);
|
||||
@@ -541,7 +541,7 @@ bool RippleAddress::accountPublicVerify (
|
||||
fullyCanonical);
|
||||
}
|
||||
|
||||
RippleAddress RippleAddress::createAccountID (Account const& account)
|
||||
RippleAddress RippleAddress::createAccountID (AccountID const& account)
|
||||
{
|
||||
RippleAddress na;
|
||||
na.setAccountID (account);
|
||||
|
||||
@@ -29,7 +29,7 @@ STAccount::STAccount (SerialIter& sit, SField const& name)
|
||||
|
||||
std::string STAccount::getText () const
|
||||
{
|
||||
Account u;
|
||||
AccountID u;
|
||||
RippleAddress a;
|
||||
|
||||
if (!getValueH160 (u))
|
||||
@@ -45,7 +45,7 @@ STAccount::construct (SerialIter& u, SField const& name)
|
||||
return new STAccount (name, u.getVLBuffer ());
|
||||
}
|
||||
|
||||
STAccount::STAccount (SField const& n, Account const& v)
|
||||
STAccount::STAccount (SField const& n, AccountID const& v)
|
||||
: STBlob (n, v.data (), v.size ())
|
||||
{
|
||||
}
|
||||
@@ -58,7 +58,7 @@ bool STAccount::isValueH160 () const
|
||||
RippleAddress STAccount::getValueNCA () const
|
||||
{
|
||||
RippleAddress a;
|
||||
Account account;
|
||||
AccountID account;
|
||||
|
||||
if (getValueH160 (account))
|
||||
a.setAccountID (account);
|
||||
|
||||
@@ -605,13 +605,13 @@ RippleAddress STObject::getFieldAccount (SField const& field) const
|
||||
return cf->getValueNCA ();
|
||||
}
|
||||
|
||||
Account STObject::getFieldAccount160 (SField const& field) const
|
||||
AccountID STObject::getFieldAccount160 (SField const& field) const
|
||||
{
|
||||
auto rf = peekAtPField (field);
|
||||
if (!rf)
|
||||
throw std::runtime_error ("Field not found");
|
||||
|
||||
Account account;
|
||||
AccountID account;
|
||||
if (rf->getSType () != STI_NOTPRESENT)
|
||||
{
|
||||
const STAccount* cf = dynamic_cast<const STAccount*> (rf);
|
||||
@@ -715,7 +715,7 @@ void STObject::setFieldV256 (SField const& field, STVector256 const& v)
|
||||
setFieldUsingSetValue <STVector256> (field, v);
|
||||
}
|
||||
|
||||
void STObject::setFieldAccount (SField const& field, Account const& v)
|
||||
void STObject::setFieldAccount (SField const& field, AccountID const& v)
|
||||
{
|
||||
STBase* rf = getPField (field, true);
|
||||
|
||||
|
||||
@@ -528,7 +528,7 @@ static boost::optional<detail::STVar> parseLeaf (
|
||||
Json::Value const& currency = pathEl["currency"];
|
||||
Json::Value const& issuer = pathEl["issuer"];
|
||||
bool hasCurrency = false;
|
||||
Account uAccount, uIssuer;
|
||||
AccountID uAccount, uIssuer;
|
||||
Currency uCurrency;
|
||||
|
||||
if (! account.isNull ())
|
||||
@@ -623,7 +623,7 @@ static boost::optional<detail::STVar> parseLeaf (
|
||||
|
||||
try
|
||||
{
|
||||
Account account;
|
||||
AccountID account;
|
||||
if (!account.SetHexExact (strValue))
|
||||
{
|
||||
RippleAddress a;
|
||||
|
||||
@@ -87,9 +87,9 @@ STPathSet::STPathSet (SerialIter& sit, SField const& name)
|
||||
auto hasCurrency = iType & STPathElement::typeCurrency;
|
||||
auto hasIssuer = iType & STPathElement::typeIssuer;
|
||||
|
||||
Account account;
|
||||
AccountID account;
|
||||
Currency currency;
|
||||
Account issuer;
|
||||
AccountID issuer;
|
||||
|
||||
if (hasAccount)
|
||||
account.copyFrom (sit.get160 ());
|
||||
@@ -135,8 +135,8 @@ STPathSet::isEquivalent (const STBase& t) const
|
||||
|
||||
bool
|
||||
STPath::hasSeen (
|
||||
Account const& account, Currency const& currency,
|
||||
Account const& issuer) const
|
||||
AccountID const& account, Currency const& currency,
|
||||
AccountID const& issuer) const
|
||||
{
|
||||
for (auto& p: mPath)
|
||||
{
|
||||
|
||||
@@ -345,56 +345,58 @@ STTx::checkMultiSign () const
|
||||
? ECDSA::strict
|
||||
: ECDSA::not_strict;
|
||||
|
||||
// We need to detect (and reject) if a multi-signer is both signing
|
||||
// directly and using a SigningFor. Here's an example:
|
||||
//
|
||||
// {
|
||||
// ...
|
||||
// "MultiSigners": [
|
||||
// {
|
||||
// "SigningFor": {
|
||||
// "Account": "<alice>",
|
||||
// "SigningAccounts": [
|
||||
// {
|
||||
// "SigningAccount": {
|
||||
// // * becky says that becky signs for alice. *
|
||||
// "Account": "<becky>",
|
||||
// ...
|
||||
// "SigningFor": {
|
||||
// "Account": "<becky>",
|
||||
// "SigningAccounts": [
|
||||
// {
|
||||
// "SigningAccount": {
|
||||
// // * cheri says that becky signs for alice. *
|
||||
// "Account": "<cheri>",
|
||||
// ...
|
||||
// "tx_json": {
|
||||
// "Account": "<alice>",
|
||||
// ...
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// Why is this way of signing a problem? Alice has a signer list, and
|
||||
// Becky can show up in that list only once. By design. So if Becky
|
||||
// signs twice -- once directly and once indirectly -- we have three
|
||||
// options:
|
||||
//
|
||||
// 1. We can add Becky's weight toward Alice's quorum twice, once for
|
||||
// each signature. This seems both unexpected and counter to Alice's
|
||||
// intention.
|
||||
//
|
||||
// 2. We could allow both signatures, but only add Becky's weight
|
||||
// toward Alice's quorum once. This seems a bit better. But it allows
|
||||
// our clients to ask rippled to do more work than necessary. We
|
||||
// should also let the client know that only one of the signatures
|
||||
// was necessary.
|
||||
//
|
||||
// 3. The only way to tell the client that they have done more work
|
||||
// than necessary (and that one of the signatures will be ignored) is
|
||||
// to declare the transaction malformed. This behavior also aligns
|
||||
// well with rippled's behavior if Becky had signed directly twice:
|
||||
// the transaction would be marked as malformed.
|
||||
//
|
||||
/*
|
||||
We need to detect (and reject) if a multi-signer is both signing
|
||||
directly and using a SigningFor. Here's an example:
|
||||
|
||||
{
|
||||
...
|
||||
"MultiSigners": [
|
||||
{
|
||||
"SigningFor": {
|
||||
"Account": "<alice>",
|
||||
"SigningAccounts": [
|
||||
{
|
||||
"SigningAccount": {
|
||||
// * becky says that becky signs for alice. *
|
||||
"Account": "<becky>",
|
||||
...
|
||||
"SigningFor": {
|
||||
"Account": "<becky>",
|
||||
"SigningAccounts": [
|
||||
{
|
||||
"SigningAccount": {
|
||||
// * cheri says that becky signs for alice. *
|
||||
"Account": "<cheri>",
|
||||
...
|
||||
"tx_json": {
|
||||
"Account": "<alice>",
|
||||
...
|
||||
}
|
||||
}
|
||||
|
||||
Why is this way of signing a problem? Alice has a signer list, and
|
||||
Becky can show up in that list only once. By design. So if Becky
|
||||
signs twice -- once directly and once indirectly -- we have three
|
||||
options:
|
||||
|
||||
1. We can add Becky's weight toward Alice's quorum twice, once for
|
||||
each signature. This seems both unexpected and counter to Alice's
|
||||
intention.
|
||||
|
||||
2. We could allow both signatures, but only add Becky's weight
|
||||
toward Alice's quorum once. This seems a bit better. But it allows
|
||||
our clients to ask rippled to do more work than necessary. We
|
||||
should also let the client know that only one of the signatures
|
||||
was necessary.
|
||||
|
||||
3. The only way to tell the client that they have done more work
|
||||
than necessary (and that one of the signatures will be ignored) is
|
||||
to declare the transaction malformed. This behavior also aligns
|
||||
well with rippled's behavior if Becky had signed directly twice:
|
||||
the transaction would be marked as malformed.
|
||||
*/
|
||||
|
||||
// We use this std::set to detect this form of double-signing.
|
||||
std::set<RippleAddress> firstLevelSigners;
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
namespace ripple {
|
||||
|
||||
std::string to_string(Account const& account)
|
||||
std::string to_string(AccountID const& account)
|
||||
{
|
||||
return RippleAddress::createAccountID (account).humanAccountID ();
|
||||
}
|
||||
@@ -111,7 +111,7 @@ Currency to_currency(std::string const& code)
|
||||
return currency;
|
||||
}
|
||||
|
||||
bool to_issuer(Account& issuer, std::string const& s)
|
||||
bool to_issuer(AccountID& issuer, std::string const& s)
|
||||
{
|
||||
if (s.size () == (160 / 4))
|
||||
{
|
||||
@@ -125,9 +125,9 @@ bool to_issuer(Account& issuer, std::string const& s)
|
||||
return success;
|
||||
}
|
||||
|
||||
Account const& xrpAccount()
|
||||
AccountID const& xrpAccount()
|
||||
{
|
||||
static Account const account(0);
|
||||
static AccountID const account(0);
|
||||
return account;
|
||||
}
|
||||
|
||||
@@ -137,9 +137,9 @@ Currency const& xrpCurrency()
|
||||
return currency;
|
||||
}
|
||||
|
||||
Account const& noAccount()
|
||||
AccountID const& noAccount()
|
||||
{
|
||||
static Account const account(1);
|
||||
static AccountID const account(1);
|
||||
return account;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user