mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-27 14:35:52 +00:00
I apologize for this moderate buchery, but we need to save the calls to base58::ToString
This commit is contained in:
@@ -7,6 +7,8 @@
|
||||
#include <boost/format.hpp>
|
||||
#include <boost/functional/hash.hpp>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include <boost/thread/mutex.hpp>
|
||||
#include <boost/unordered_map.hpp>
|
||||
|
||||
#include <openssl/rand.h>
|
||||
|
||||
@@ -293,6 +295,9 @@ uint160 RippleAddress::getAccountID() const
|
||||
}
|
||||
}
|
||||
|
||||
static boost::mutex rncLock;
|
||||
static boost::unordered_map< std::vector<unsigned char>, std::string > rncMap;
|
||||
|
||||
std::string RippleAddress::humanAccountID() const
|
||||
{
|
||||
switch (nVersion) {
|
||||
@@ -300,7 +305,13 @@ std::string RippleAddress::humanAccountID() const
|
||||
throw std::runtime_error("unset source - humanAccountID");
|
||||
|
||||
case VER_ACCOUNT_ID:
|
||||
return ToString();
|
||||
{
|
||||
boost::mutex::scoped_lock sl(rncLock);
|
||||
boost::unordered_map< std::vector<unsigned char>, std::string >::iterator it = rncMap.find(vchData);
|
||||
if (it != rncMap.end())
|
||||
return it->second;
|
||||
return rncMap[vchData] = ToString();
|
||||
}
|
||||
|
||||
case VER_ACCOUNT_PUBLIC:
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user