diff --git a/src/ripple/app/paths/RippleLineCache.cpp b/src/ripple/app/paths/RippleLineCache.cpp index b17fade39..eed4fd3c5 100644 --- a/src/ripple/app/paths/RippleLineCache.cpp +++ b/src/ripple/app/paths/RippleLineCache.cpp @@ -30,7 +30,7 @@ RippleLineCache::RippleLineCache (Ledger::ref l) RippleLineCache::RippleStateVector const& RippleLineCache::getRippleLines (Account const& accountID) { - AccountKey key (accountID); + AccountKey key (accountID, hasher_ (accountID)); ScopedLockType sl (mLock); diff --git a/src/ripple/app/paths/RippleLineCache.h b/src/ripple/app/paths/RippleLineCache.h index 1fabba04f..8f9557364 100644 --- a/src/ripple/app/paths/RippleLineCache.h +++ b/src/ripple/app/paths/RippleLineCache.h @@ -51,6 +51,7 @@ private: typedef std::lock_guard ScopedLockType; LockType mLock; + ripple::hardened_hash<> hasher_; Ledger::pointer mLedger; struct AccountKey @@ -58,31 +59,19 @@ private: Account account_; std::size_t hash_value_; - AccountKey (Account const& account) + AccountKey (Account const& account, std::size_t hash) : account_ (account) - , hash_value_ (hardened_hash<>{}(account)) - { + , hash_value_ (hash) + { } - } + AccountKey (AccountKey const& other) = default; - AccountKey (AccountKey const& other) - : account_ (other.account_) - , hash_value_ (other.hash_value_) - { - - } - - AccountKey& operator=(AccountKey const& other) - { - account_ = other.account_; - hash_value_ = other.hash_value_; - return *this; - } + AccountKey& + operator=(AccountKey const& other) = default; bool operator== (AccountKey const& lhs) const { - return hash_value_ == lhs.hash_value_ && - account_ == lhs.account_; + return hash_value_ == lhs.hash_value_ && account_ == lhs.account_; } std::size_t