Use unordered_map for CCoinsViewCache with salted hash

This commit is contained in:
Pieter Wuille
2014-07-09 17:25:09 +02:00
parent bdd5b587fc
commit bc42503f6a
4 changed files with 66 additions and 4 deletions

View File

@@ -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
{