diff options
| author | Pieter Wuille <[email protected]> | 2014-07-09 17:25:09 +0200 |
|---|---|---|
| committer | Pieter Wuille <[email protected]> | 2014-07-14 16:13:08 +0200 |
| commit | bc42503f6ab304608c321986a870795e45f5a016 (patch) | |
| tree | cbb104bd5010fd817a460c89b10470e8b60f9ea7 /src/coins.h | |
| parent | Add option to disable 077 umask (create new files with system default umask) (diff) | |
| download | discoin-bc42503f6ab304608c321986a870795e45f5a016.tar.xz discoin-bc42503f6ab304608c321986a870795e45f5a016.zip | |
Use unordered_map for CCoinsViewCache with salted hash
Diffstat (limited to 'src/coins.h')
| -rw-r--r-- | src/coins.h | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/coins.h b/src/coins.h index c57a5ec72..9f90fe6bd 100644 --- a/src/coins.h +++ b/src/coins.h @@ -13,6 +13,7 @@ #include <stdint.h> #include <boost/foreach.hpp> +#include <boost/unordered_map.hpp> /** pruned version of CTransaction: only retains metadata and unspent transaction outputs * @@ -239,7 +240,19 @@ public: } }; -typedef std::map<uint256,CCoins> CCoinsMap; +class CCoinsKeyHasher +{ +private: + uint256 salt; + +public: + CCoinsKeyHasher(); + uint64_t operator()(const uint256& key) const { + return key.GetHash(salt); + } +}; + +typedef boost::unordered_map<uint256, CCoins, CCoinsKeyHasher> CCoinsMap; struct CCoinsStats { |