 |
PRCYCoin
2.0.0.7rc1
P2P Digital Currency
|
Go to the documentation of this file.
21 unsigned int nLastUsedByte = 0;
22 for (
unsigned int b = 0; 2 +
b * 8 <
vout.size();
b++) {
24 for (
unsigned int i = 0; i < 8 && 2 +
b * 8 + i <
vout.size(); i++) {
25 if (!
vout[2 +
b * 8 + i].IsNull()) {
31 nLastUsedByte =
b + 1;
35 nBytes += nLastUsedByte;
40 if (out.
n >=
vout.size()) {
43 if (
vout[out.
n].IsNull()) {
47 vout[out.
n].SetNull();
49 if (
vout.size() == 0) {
62 return Spend(out, undo);
96 CCoinsMap::iterator it =
cacheCoins.find(txid);
103 tmp.
swap(ret->second.coins);
104 if (ret->second.coins.IsPruned()) {
115 CCoinsMap::const_iterator it =
FetchCoins(txid);
117 coins = it->second.coins;
127 size_t cachedCoinUsage = 0;
131 ret.first->second.coins.Clear();
133 }
else if (ret.first->second.coins.IsPruned()) {
138 cachedCoinUsage = memusage::DynamicUsage(ret.first->second.coins);
147 CCoinsMap::const_iterator it =
FetchCoins(txid);
151 return &it->second.coins;
157 CCoinsMap::const_iterator it =
FetchCoins(txid);
162 return (it !=
cacheCoins.end() && !it->second.coins.vout.empty());
180 for (CCoinsMap::iterator it = mapCoins.begin(); it != mapCoins.end();) {
182 CCoinsMap::iterator itUs =
cacheCoins.find(it->first);
210 itUs->second.coins.swap(it->second.coins);
216 CCoinsMap::iterator itOld = it++;
217 mapCoins.erase(itOld);
246 for (
unsigned int i = 0; i < tx.
vin.size(); i++) {
268 it->second.coins.Cleanup();
void SetBackend(CCoinsView &viewIn)
An input of a transaction.
const uint256 UINT256_ZERO
constant uint256 instances
unsigned int GetCacheSize() const
Calculate the size of the cache (in number of transactions)
CCoinsModifier ModifyCoins(const uint256 &txid)
Return a modifiable reference to a CCoins.
void Cleanup()
remove spent outputs at the end of vout
bool GetStats(CCoinsStats &stats) const
Calculate statistics about the unspent transaction output set.
CCoinsModifier(CCoinsViewCache &cache_, CCoinsMap::iterator it_, size_t usage)
CCoinsViewCache(CCoinsView *baseIn)
const CTxOut & GetOutputFor(const CTxIn &input) const
bool IsAvailable(unsigned int nPos) const
check whether a particular output is still available
friend class CCoinsModifier
int nHeight
at which height this transaction was included in the active block chain
The basic transaction that is broadcasted on the network and contained in blocks.
Abstract view on the open txout dataset.
bool BatchWrite(CCoinsMap &mapCoins, const uint256 &hashBlock)
Do a bulk modification (multiple CCoins changes + BestBlock change).
virtual bool BatchWrite(CCoinsMap &mapCoins, const uint256 &hashBlock)
Do a bulk modification (multiple CCoins changes + BestBlock change).
virtual bool GetCoins(const uint256 &txid, CCoins &coins) const
Retrieve the CCoins (unspent transaction outputs) for a given txid.
std::vector< CTxOut > vout
unspent transaction outputs; spent outputs are .IsNull(); spent outputs at the end of the array are d...
An output of a transaction.
size_t DynamicMemoryUsage() const
Calculate the size of the cache (in bytes)
A reference to a mutable cache entry.
bool HaveCoins(const uint256 &txid) const
Just check whether we have data for a given txid.
uint256 hashBlock
Make mutable so that we can "fill the cache" even from Get-methods declared as "const".
256-bit unsigned big integer.
const CCoins * AccessCoins(const uint256 &txid) const
Return a pointer to CCoins in the cache, or NULL if not found.
CCoinsViewBacked(CCoinsView *viewIn)
bool GetCoins(const uint256 &txid, CCoins &coins) const
Retrieve the CCoins (unspent transaction outputs) for a given txid.
int nVersion
version of the CTransaction; accesses to this value should probably check for nHeight as well,...
bool BatchWrite(CCoinsMap &mapCoins, const uint256 &hashBlock)
Do a bulk modification (multiple CCoins changes + BestBlock change).
CCoinsView that adds a memory cache for transactions to another CCoinsView.
virtual bool GetStats(CCoinsStats &stats) const
Calculate statistics about the unspent transaction output set.
CCoinsView backed by another CCoinsView.
void SetBestBlock(const uint256 &hashBlock)
bool HaveCoins(const uint256 &txid) const
Just check whether we have data for a given txid.
bool HaveInputs(const CTransaction &tx) const
Check whether all prevouts of the transaction are present in the UTXO set represented by this view.
boost::unordered_map< uint256, CCoinsCacheEntry, CCoinsKeyHasher > CCoinsMap
Undo information for a CTxIn.
bool fCoinBase
whether transaction is a coinbase
uint256 GetBestBlock() const
Retrieve the block hash whose state this CCoinsView currently represents.
uint256 GetBestBlock() const
Retrieve the block hash whose state this CCoinsView currently represents.
An outpoint - a combination of a transaction hash and an index n into its vout.
bool Spend(const COutPoint &out, CTxInUndo &undo)
mark an outpoint spent, and construct undo information
virtual bool HaveCoins(const uint256 &txid) const
Just check whether we have data for a given txid.
void CalcMaskSize(unsigned int &nBytes, unsigned int &nNonzeroBytes) const
calculate number of bytes for the bitmask, and its number of non-zero bytes each bit in the bitmask r...
virtual uint256 GetBestBlock() const
Retrieve the block hash whose state this CCoinsView currently represents.
CCoinsMap::iterator FetchCoins(const uint256 &txid)
bool GetCoins(const uint256 &txid, CCoins &coins) const
Retrieve the CCoins (unspent transaction outputs) for a given txid.
bool Flush()
Push the modifications applied to this cache to its base.