mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Refactor AccountID (RIPD-953):
All AccountID functionality is removed from RippleAddress and
replaced with free functions. The AccountID to string conversion
cache is factored out as an explicit type with an instance in
the Application object. New base58 conversion functions are used,
with no dependence on OpenSSL.
All types and free functions related to AccountID are consolidated
into one header file. Routines to operate on "tokens" are also
introduced and consolidated into a single header file.
A token one of the cryptographic primitives used in Ripple:
Secret Seed
Server Public Key
Server Secret Key
Account ID
Account Public Key
Account Private Key
and these deprecated primitives:
Account Family Seed
Account Family Generator
This commit is contained in:
@@ -58,6 +58,7 @@
|
||||
#include <ripple/overlay/make_Overlay.h>
|
||||
#include <ripple/protocol/Indexes.h>
|
||||
#include <ripple/protocol/STParsedJSON.h>
|
||||
#include <ripple/protocol/types.h>
|
||||
#include <ripple/rpc/Manager.h>
|
||||
#include <ripple/server/make_ServerHandler.h>
|
||||
#include <ripple/shamap/Family.h>
|
||||
@@ -259,6 +260,7 @@ public:
|
||||
std::unique_ptr <SHAMapStore> m_shaMapStore;
|
||||
std::unique_ptr <NodeStore::Database> m_nodeStore;
|
||||
PendingSaves pendingSaves_;
|
||||
AccountIDCache accountIDCache_;
|
||||
|
||||
// These are not Stoppable-derived
|
||||
NodeCache m_tempNodeCache;
|
||||
@@ -334,6 +336,8 @@ public:
|
||||
|
||||
, m_nodeStore (m_shaMapStore->makeDatabase ("NodeStore.main", 4))
|
||||
|
||||
, accountIDCache_(128000)
|
||||
|
||||
, m_tempNodeCache ("NodeCache", 16384, 90, get_seconds_clock (),
|
||||
m_logs.journal("TaggedCache"))
|
||||
|
||||
@@ -598,6 +602,12 @@ public:
|
||||
return pendingSaves_;
|
||||
}
|
||||
|
||||
AccountIDCache const&
|
||||
accountIDCache() const override
|
||||
{
|
||||
return accountIDCache_;
|
||||
}
|
||||
|
||||
Overlay& overlay ()
|
||||
{
|
||||
return *m_overlay;
|
||||
@@ -904,7 +914,6 @@ public:
|
||||
|
||||
m_overlay->saveValidatorKeyManifests (getWalletDB ());
|
||||
|
||||
RippleAddress::clearCache ();
|
||||
stopped ();
|
||||
}
|
||||
|
||||
@@ -1038,11 +1047,12 @@ void ApplicationImp::startNewLedger ()
|
||||
|
||||
// Print enough information to be able to claim root account.
|
||||
m_journal.info << "Root master seed: " << rootSeedMaster.humanSeed ();
|
||||
m_journal.info << "Root account: " << rootAddress.humanAccountID ();
|
||||
m_journal.info << "Root account: " << toBase58(calcAccountID(rootAddress));
|
||||
|
||||
{
|
||||
Ledger::pointer firstLedger = std::make_shared<Ledger> (rootAddress, SYSTEM_CURRENCY_START);
|
||||
assert (firstLedger->exists(keylet::account(rootAddress.getAccountID())));
|
||||
assert (firstLedger->exists(keylet::account(
|
||||
calcAccountID(rootAddress))));
|
||||
// TODO(david): Add any default amendments
|
||||
// TODO(david): Set default fee/reserve
|
||||
firstLedger->getHash(); // updates the hash
|
||||
@@ -1054,7 +1064,8 @@ void ApplicationImp::startNewLedger ()
|
||||
secondLedger->setClosed ();
|
||||
secondLedger->setAccepted ();
|
||||
m_ledgerMaster->pushLedger (secondLedger, std::make_shared<Ledger> (true, std::ref (*secondLedger)));
|
||||
assert (secondLedger->exists(keylet::account(rootAddress.getAccountID())));
|
||||
assert (secondLedger->exists(keylet::account(
|
||||
calcAccountID(rootAddress))));
|
||||
m_networkOPs->setLastCloseTime (secondLedger->getCloseTimeNC ());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user