Anoncoin  0.9.4
P2P Digital Currency
Public Member Functions | Protected Attributes | Private Member Functions | List of all members
CCoinsViewCache Class Reference

CCoinsView that adds a memory cache for transactions to another CCoinsView. More...

#include <coins.h>

Inheritance diagram for CCoinsViewCache:
[legend]
Collaboration diagram for CCoinsViewCache:
[legend]

Public Member Functions

 CCoinsViewCache (CCoinsView &baseIn, bool fDummy=false)
 
bool GetCoins (const uint256 &txid, CCoins &coins)
 
bool SetCoins (const uint256 &txid, const CCoins &coins)
 
bool HaveCoins (const uint256 &txid)
 
uint256 GetBestBlock ()
 
bool SetBestBlock (const uint256 &hashBlock)
 
bool BatchWrite (const std::map< uint256, CCoins > &mapCoins, const uint256 &hashBlock)
 
CCoinsGetCoins (const uint256 &txid)
 
bool Flush ()
 
unsigned int GetCacheSize ()
 
int64_t GetValueIn (const CTransaction &tx)
 Amount of anoncoins coming in to a transaction Note that lightweight clients may not know anything besides the hash of previous transactions, so may not be able to calculate this. More...
 
bool HaveInputs (const CTransaction &tx)
 
double GetPriority (const CTransaction &tx, int nHeight)
 
const CTxOutGetOutputFor (const CTxIn &input)
 
- Public Member Functions inherited from CCoinsViewBacked
 CCoinsViewBacked (CCoinsView &viewIn)
 
void SetBackend (CCoinsView &viewIn)
 
bool GetStats (CCoinsStats &stats)
 
- Public Member Functions inherited from CCoinsView
virtual ~CCoinsView ()
 

Protected Attributes

uint256 hashBlock
 
std::map< uint256, CCoinscacheCoins
 
- Protected Attributes inherited from CCoinsViewBacked
CCoinsViewbase
 

Private Member Functions

std::map< uint256, CCoins >::iterator FetchCoins (const uint256 &txid)
 

Detailed Description

CCoinsView that adds a memory cache for transactions to another CCoinsView.

Definition at line 309 of file coins.h.

Constructor & Destructor Documentation

CCoinsViewCache::CCoinsViewCache ( CCoinsView baseIn,
bool  fDummy = false 
)

Definition at line 73 of file coins.cpp.

Member Function Documentation

bool CCoinsViewCache::BatchWrite ( const std::map< uint256, CCoins > &  mapCoins,
const uint256 hashBlock 
)
virtual

Reimplemented from CCoinsViewBacked.

Definition at line 125 of file coins.cpp.

std::map< uint256, CCoins >::iterator CCoinsViewCache::FetchCoins ( const uint256 txid)
private

Definition at line 87 of file coins.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool CCoinsViewCache::Flush ( )

Definition at line 132 of file coins.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

uint256 CCoinsViewCache::GetBestBlock ( )
virtual

Reimplemented from CCoinsViewBacked.

Definition at line 114 of file coins.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

unsigned int CCoinsViewCache::GetCacheSize ( )

Definition at line 139 of file coins.cpp.

Here is the caller graph for this function:

bool CCoinsViewCache::GetCoins ( const uint256 txid,
CCoins coins 
)
virtual

Reimplemented from CCoinsViewBacked.

Definition at line 75 of file coins.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

CCoins & CCoinsViewCache::GetCoins ( const uint256 txid)

Definition at line 99 of file coins.cpp.

Here is the call graph for this function:

const CTxOut & CCoinsViewCache::GetOutputFor ( const CTxIn input)

Definition at line 143 of file coins.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

double CCoinsViewCache::GetPriority ( const CTransaction tx,
int  nHeight 
)

Definition at line 183 of file coins.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

int64_t CCoinsViewCache::GetValueIn ( const CTransaction tx)

Amount of anoncoins coming in to a transaction Note that lightweight clients may not know anything besides the hash of previous transactions, so may not be able to calculate this.

Parameters
[in]txtransaction for which we are checking input total
Returns
Sum of value of all inputs (scriptSigs)

Definition at line 150 of file coins.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool CCoinsViewCache::HaveCoins ( const uint256 txid)
virtual

Reimplemented from CCoinsViewBacked.

Definition at line 110 of file coins.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool CCoinsViewCache::HaveInputs ( const CTransaction tx)

Definition at line 162 of file coins.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool CCoinsViewCache::SetBestBlock ( const uint256 hashBlock)
virtual

Reimplemented from CCoinsViewBacked.

Definition at line 120 of file coins.cpp.

Here is the caller graph for this function:

bool CCoinsViewCache::SetCoins ( const uint256 txid,
const CCoins coins 
)
virtual

Reimplemented from CCoinsViewBacked.

Definition at line 105 of file coins.cpp.

Here is the caller graph for this function:

Member Data Documentation

std::map<uint256,CCoins> CCoinsViewCache::cacheCoins
protected

Definition at line 313 of file coins.h.

uint256 CCoinsViewCache::hashBlock
protected

Definition at line 312 of file coins.h.


The documentation for this class was generated from the following files: