Changeset View
Changeset View
Standalone View
Standalone View
src/coins.h
Show All 10 Lines | |||||
#include "hash.h" | #include "hash.h" | ||||
#include "memusage.h" | #include "memusage.h" | ||||
#include "serialize.h" | #include "serialize.h" | ||||
#include "uint256.h" | #include "uint256.h" | ||||
#include <cassert> | #include <cassert> | ||||
#include <cstdint> | #include <cstdint> | ||||
#include <boost/unordered_map.hpp> | #include <unordered_map> | ||||
/** | /** | ||||
* A UTXO entry. | * A UTXO entry. | ||||
* | * | ||||
* Serialized format: | * Serialized format: | ||||
* - VARINT((coinbase ? 1 : 0) | (height << 1)) | * - VARINT((coinbase ? 1 : 0) | (height << 1)) | ||||
* - the non-spent CTxOut (via CTxOutCompressor) | * - the non-spent CTxOut (via CTxOutCompressor) | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 263 Lines • ▼ Show 20 Lines | |||||
public: | public: | ||||
SaltedTxidHasher(); | SaltedTxidHasher(); | ||||
/** | /** | ||||
* This *must* return size_t. With Boost 1.46 on 32-bit systems the | * This *must* return size_t. With Boost 1.46 on 32-bit systems the | ||||
* unordered_map will behave unpredictably if the custom hasher returns a | * unordered_map will behave unpredictably if the custom hasher returns a | ||||
* uint64_t, resulting in failures when syncing the chain (#4634). | * uint64_t, resulting in failures when syncing the chain (#4634). | ||||
* Note: This information above might be outdated as the unordered map | |||||
* container type has meanwhile been switched to the C++ standard library | |||||
* implementation. | |||||
*/ | */ | ||||
size_t operator()(const uint256 &txid) const { | size_t operator()(const uint256 &txid) const { | ||||
return SipHashUint256(k0, k1, txid); | return SipHashUint256(k0, k1, txid); | ||||
} | } | ||||
}; | }; | ||||
struct CCoinsCacheEntry { | struct CCoinsCacheEntry { | ||||
CCoins coins; // The actual cached data. | CCoins coins; // The actual cached data. | ||||
Show All 9 Lines | enum Flags { | ||||
coins that are fully spent if we know we do not need to flush the | coins that are fully spent if we know we do not need to flush the | ||||
changes to the parent cache. It is always safe to not mark FRESH if | changes to the parent cache. It is always safe to not mark FRESH if | ||||
that condition is not guaranteed. */ | that condition is not guaranteed. */ | ||||
}; | }; | ||||
CCoinsCacheEntry() : coins(), flags(0) {} | CCoinsCacheEntry() : coins(), flags(0) {} | ||||
}; | }; | ||||
typedef boost::unordered_map<uint256, CCoinsCacheEntry, SaltedTxidHasher> | typedef std::unordered_map<uint256, CCoinsCacheEntry, SaltedTxidHasher> | ||||
CCoinsMap; | CCoinsMap; | ||||
/** Cursor for iterating over CoinsView state */ | /** Cursor for iterating over CoinsView state */ | ||||
class CCoinsViewCursor { | class CCoinsViewCursor { | ||||
public: | public: | ||||
CCoinsViewCursor(const uint256 &hashBlockIn) : hashBlock(hashBlockIn) {} | CCoinsViewCursor(const uint256 &hashBlockIn) : hashBlock(hashBlockIn) {} | ||||
virtual ~CCoinsViewCursor(); | virtual ~CCoinsViewCursor(); | ||||
▲ Show 20 Lines • Show All 247 Lines • Show Last 20 Lines |