Use boost::unordered_map for mapBlockIndex

This commit is contained in:
Pieter Wuille 2014-09-04 02:03:17 +02:00
parent 145d5be896
commit 8a41e1edd4

View file

@ -29,6 +29,8 @@
#include <utility> #include <utility>
#include <vector> #include <vector>
#include <boost/unordered_map.hpp>
class CBlockIndex; class CBlockIndex;
class CBloomFilter; class CBloomFilter;
class CInv; class CInv;
@ -81,11 +83,15 @@ static const unsigned char REJECT_DUST = 0x41;
static const unsigned char REJECT_INSUFFICIENTFEE = 0x42; static const unsigned char REJECT_INSUFFICIENTFEE = 0x42;
static const unsigned char REJECT_CHECKPOINT = 0x43; static const unsigned char REJECT_CHECKPOINT = 0x43;
struct BlockHasher
{
size_t operator()(const uint256& hash) const { return hash.GetLow64(); }
};
extern CScript COINBASE_FLAGS; extern CScript COINBASE_FLAGS;
extern CCriticalSection cs_main; extern CCriticalSection cs_main;
extern CTxMemPool mempool; extern CTxMemPool mempool;
typedef std::map<uint256, CBlockIndex*> BlockMap; typedef boost::unordered_map<uint256, CBlockIndex*, BlockHasher> BlockMap;
extern BlockMap mapBlockIndex; extern BlockMap mapBlockIndex;
extern uint64_t nLastBlockTx; extern uint64_t nLastBlockTx;
extern uint64_t nLastBlockSize; extern uint64_t nLastBlockSize;