Master Core  v0.0.9 - 2abfd2849db8ba7a83957c64eb976b406713c123
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Public Member Functions | Public Attributes | Friends | List of all members
CCoins Class Reference

pruned version of CTransaction: only retains metadata and unspent transaction outputs More...

#include <coins.h>

+ Collaboration diagram for CCoins:

Public Member Functions

 CCoins (const CTransaction &tx, int nHeightIn)
 
 CCoins ()
 
void Cleanup ()
 
void ClearUnspendable ()
 
void swap (CCoins &to)
 
void CalcMaskSize (unsigned int &nBytes, unsigned int &nNonzeroBytes) const
 
bool IsCoinBase () const
 
unsigned int GetSerializeSize (int nType, int nVersion) const
 
template<typename Stream >
void Serialize (Stream &s, int nType, int nVersion) const
 
template<typename Stream >
void Unserialize (Stream &s, int nType, int nVersion)
 
bool Spend (const COutPoint &out, CTxInUndo &undo)
 
bool Spend (int nPos)
 
bool IsAvailable (unsigned int nPos) const
 
bool IsPruned () const
 

Public Attributes

bool fCoinBase
 
std::vector< CTxOutvout
 
int nHeight
 
int nVersion
 

Friends

bool operator== (const CCoins &a, const CCoins &b)
 
bool operator!= (const CCoins &a, const CCoins &b)
 

Detailed Description

pruned version of CTransaction: only retains metadata and unspent transaction outputs

Serialized format:

The nCode value consists of:

Example: 0104835800816115944e077fe7c803cfa57f29b36bf87c1d358bb85e <><><-----------------------------------------—><-—> | \ | / version code vout[1] height

Example: 0109044086ef97d5790061b01caab50f1b8e9c50a5057eb43c2d9563a4eebbd123008c988f1a4a4de2161e0f50aac7f17e7f9555caa486af3b <><><–><-----------------------------------------------—><-------------------------------------------—><-—> / \ \ | | / version code unspentness vout[4] vout[16] height

Definition at line 68 of file coins.h.

Constructor & Destructor Documentation

CCoins::CCoins ( const CTransaction tx,
int  nHeightIn 
)
inline

Definition at line 85 of file coins.h.

References ClearUnspendable().

+ Here is the call graph for this function:

CCoins::CCoins ( )
inline

Definition at line 90 of file coins.h.

Member Function Documentation

void CCoins::CalcMaskSize ( unsigned int nBytes,
unsigned int nNonzeroBytes 
) const

Definition at line 12 of file coins.cpp.

References vout.

Referenced by GetSerializeSize(), and Serialize().

+ Here is the caller graph for this function:

void CCoins::Cleanup ( )
inline

Definition at line 93 of file coins.h.

Referenced by ClearUnspendable(), Spend(), and Unserialize().

+ Here is the caller graph for this function:

void CCoins::ClearUnspendable ( )
inline

Definition at line 100 of file coins.h.

References Cleanup(), CScript::IsUnspendable(), and CTxOut::scriptPubKey.

Referenced by CCoins(), and DisconnectBlock().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

unsigned int CCoins::GetSerializeSize ( int  nType,
int  nVersion 
) const
inline

Definition at line 135 of file coins.h.

References CalcMaskSize(), nVersion, REF(), and VARINT.

+ Here is the call graph for this function:

bool CCoins::IsAvailable ( unsigned int  nPos) const
inline

Definition at line 228 of file coins.h.

Referenced by CTxMemPool::check(), DisconnectBlock(), CCoinsViewCache::GetOutputFor(), CCoinsViewCache::GetPriority(), CCoinsViewCache::HaveInputs(), and signrawtransaction().

+ Here is the caller graph for this function:

bool CCoins::IsCoinBase ( ) const
inline

Definition at line 131 of file coins.h.

References fCoinBase.

Referenced by CheckInputs().

+ Here is the caller graph for this function:

bool CCoins::IsPruned ( ) const
inline

Definition at line 234 of file coins.h.

References CTxOut::IsNull().

Referenced by BatchWriteCoins(), and DisconnectBlock().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename Stream >
void CCoins::Serialize ( Stream &  s,
int  nType,
int  nVersion 
) const
inline

Definition at line 159 of file coins.h.

References CalcMaskSize(), nVersion, REF(), and VARINT.

+ Here is the call graph for this function:

bool CCoins::Spend ( const COutPoint out,
CTxInUndo undo 
)

Definition at line 30 of file coins.cpp.

References Cleanup(), fCoinBase, CTxInUndo::fCoinBase, COutPoint::n, nHeight, CTxInUndo::nHeight, nVersion, CTxInUndo::nVersion, and vout.

Referenced by CTxMemPool::pruneSpent(), Spend(), and UpdateCoins().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool CCoins::Spend ( int  nPos)

Definition at line 46 of file coins.cpp.

References Spend().

+ Here is the call graph for this function:

void CCoins::swap ( CCoins to)
inline

Definition at line 108 of file coins.h.

References fCoinBase, nHeight, nVersion, and vout.

Referenced by CCoinsViewCache::FetchCoins().

+ Here is the caller graph for this function:

template<typename Stream >
void CCoins::Unserialize ( Stream &  s,
int  nType,
int  nVersion 
)
inline

Definition at line 188 of file coins.h.

References Cleanup(), REF(), and VARINT.

+ Here is the call graph for this function:

Friends And Related Function Documentation

bool operator!= ( const CCoins a,
const CCoins b 
)
friend

Definition at line 125 of file coins.h.

bool operator== ( const CCoins a,
const CCoins b 
)
friend

Definition at line 116 of file coins.h.

Member Data Documentation

bool CCoins::fCoinBase

Definition at line 72 of file coins.h.

Referenced by DisconnectBlock(), gettxout(), IsCoinBase(), Spend(), and swap().

int CCoins::nHeight
int CCoins::nVersion

Definition at line 82 of file coins.h.

Referenced by DisconnectBlock(), GetSerializeSize(), gettxout(), Serialize(), Spend(), and swap().

std::vector<CTxOut> CCoins::vout

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