![]() |
Dash Core
0.12.2.1
P2P Digital Currency
|
#include <coins.h>
Public Member Functions | |
void | FromTx (const CTransaction &tx, int nHeightIn) |
CCoins (const CTransaction &tx, int nHeightIn) | |
construct a CCoins from a CTransaction, at a given height More... | |
void | Clear () |
CCoins () | |
empty constructor More... | |
void | Cleanup () |
remove spent outputs at the end of vout More... | |
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 (uint32_t nPos) |
mark a vout spent More... | |
bool | IsAvailable (unsigned int nPos) const |
check whether a particular output is still available More... | |
bool | IsPruned () const |
size_t | DynamicMemoryUsage () const |
Public Attributes | |
bool | fCoinBase |
whether transaction is a coinbase More... | |
std::vector< CTxOut > | vout |
unspent transaction outputs; spent outputs are .IsNull(); spent outputs at the end of the array are dropped More... | |
int | nHeight |
at which height this transaction was included in the active block chain More... | |
int | nVersion |
Friends | |
bool | operator== (const CCoins &a, const CCoins &b) |
equality test More... | |
bool | operator!= (const CCoins &a, const CCoins &b) |
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
|
inline |
construct a CCoins from a CTransaction, at a given height
void CCoins::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 represents the availability of one output, but the availabilities of the first two outputs are encoded separately
Definition at line 17 of file coins.cpp.
Referenced by GetSerializeSize(), and Serialize().
|
inline |
remove spent outputs at the end of vout
Definition at line 113 of file coins.h.
Referenced by ClearUnspendable(), Spend(), and Unserialize().
|
inline |
Definition at line 102 of file coins.h.
Referenced by ApplyTxInUndo(), and DisconnectBlock().
|
inline |
Definition at line 120 of file coins.h.
Referenced by DisconnectBlock(), and FromTx().
|
inline |
Definition at line 258 of file coins.h.
Referenced by CCoinsViewCache::BatchWrite().
|
inline |
|
inline |
|
inline |
check whether a particular output is still available
Definition at line 245 of file coins.h.
Referenced by ApplyTxInUndo(), CTxMemPool::check(), CCoinsViewCache::GetOutputFor(), CCoinsViewCache::GetPriority(), CCoinsViewCache::HaveInputs(), MutateTxSign(), rest_getutxos(), and signrawtransaction().
|
inline |
Definition at line 151 of file coins.h.
Referenced by AcceptToMemoryPoolWorker(), Consensus::CheckTxInputs(), and CTxMemPool::removeForReorg().
|
inline |
check whether the entire CCoins is spent note that only !IsPruned() CCoins can be serialized
Definition at line 251 of file coins.h.
Referenced by ApplyTxInUndo(), ConnectBlock(), and CCoinsViewMemPool::GetCoins().
|
inline |
bool CCoins::Spend | ( | uint32_t | nPos | ) |
mark a vout spent
Definition at line 35 of file coins.cpp.
Referenced by CTxMemPool::pruneSpent(), and UpdateCoins().
|
inline |
Definition at line 128 of file coins.h.
Referenced by CCoinsViewCache::BatchWrite(), Clear(), and CCoinsViewCache::FetchCoins().
|
inline |
bool CCoins::fCoinBase |
whether transaction is a coinbase
Definition at line 77 of file coins.h.
Referenced by ApplyTxInUndo(), Clear(), FromTx(), GetSerializeSize(), gettxout(), IsCoinBase(), Serialize(), swap(), Unserialize(), and UpdateCoins().
int CCoins::nHeight |
at which height this transaction was included in the active block chain
Definition at line 83 of file coins.h.
Referenced by ApplyTxInUndo(), CMasternode::CheckCollateral(), CheckSequenceLocks(), Consensus::CheckTxInputs(), Clear(), ConnectBlock(), FromTx(), CCoinsViewCache::GetPriority(), GetSerializeSize(), GetTransaction(), gettxout(), gettxoutproof(), GetUTXOHeight(), CTxLockRequest::IsValid(), CTxLockVote::IsValid(), CTxMemPool::removeForReorg(), rest_getutxos(), sendrawtransaction(), Serialize(), swap(), Unserialize(), and UpdateCoins().
int CCoins::nVersion |
version of the CTransaction; accesses to this value should probably check for nHeight as well, as new tx version will probably only be introduced at certain heights
Definition at line 87 of file coins.h.
Referenced by ApplyTxInUndo(), Clear(), DisconnectBlock(), FromTx(), GetSerializeSize(), gettxout(), rest_getutxos(), Serialize(), swap(), Unserialize(), and UpdateCoins().
std::vector<CTxOut> CCoins::vout |
unspent transaction outputs; spent outputs are .IsNull(); spent outputs at the end of the array are dropped
Definition at line 80 of file coins.h.
Referenced by ApplyTxInUndo(), CalcMaskSize(), CMasternode::CheckCollateral(), Consensus::CheckTxInputs(), Cleanup(), Clear(), ClearUnspendable(), DynamicMemoryUsage(), FromTx(), CCoinsViewCache::GetOutputFor(), CCoinsViewCache::GetPriority(), GetSerializeSize(), CCoinsViewDB::GetStats(), gettxout(), GetUTXOCoins(), IsAvailable(), CPrivateSend::IsCollateralValid(), IsPruned(), CTxLockRequest::IsValid(), MutateTxSign(), CPrivateSendServer::ProcessMessage(), rest_getutxos(), Serialize(), signrawtransaction(), Spend(), swap(), TransactionDesc::toHTML(), Unserialize(), and UpdateCoins().