diff --git a/src/cpp/ripple/RippleAddress.cpp b/src/cpp/ripple/RippleAddress.cpp index 701faa81cd..aac1695e19 100644 --- a/src/cpp/ripple/RippleAddress.cpp +++ b/src/cpp/ripple/RippleAddress.cpp @@ -7,6 +7,8 @@ #include #include #include +#include +#include #include @@ -293,6 +295,9 @@ uint160 RippleAddress::getAccountID() const } } +static boost::mutex rncLock; +static boost::unordered_map< std::vector, 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, std::string >::iterator it = rncMap.find(vchData); + if (it != rncMap.end()) + return it->second; + return rncMap[vchData] = ToString(); + } case VER_ACCOUNT_PUBLIC: {