Dash Core Source Documentation (0.16.0.1)

Find detailed information regarding the Dash Core source code.

The basic transaction that is broadcasted on the network and contained in blocks. More...

#include <transaction.h>

+ Collaboration diagram for CTransaction:

Public Member Functions

 CTransaction ()
 Construct a CTransaction that qualifies as IsNull() More...
 
 CTransaction (const CMutableTransaction &tx)
 Convert a CMutableTransaction into a CTransaction. More...
 
 CTransaction (CMutableTransaction &&tx)
 
template<typename Stream >
void Serialize (Stream &s) const
 
template<typename Stream >
 CTransaction (deserialize_type, Stream &s)
 This deserializing constructor is provided instead of an Unserialize method. More...
 
bool IsNull () const
 
const uint256GetHash () const
 
CAmount GetValueOut () const
 
unsigned int GetTotalSize () const
 Get the total transaction size in bytes, including witness data. More...
 
bool IsCoinBase () const
 
std::string ToString () const
 

Public Attributes

const std::vector< CTxInvin
 
const std::vector< CTxOutvout
 
const int16_t nVersion
 
const int16_t nType
 
const uint32_t nLockTime
 
const std::vector< uint8_t > vExtraPayload
 

Static Public Attributes

static const int32_t CURRENT_VERSION =2
 
static const int32_t MAX_STANDARD_VERSION =3
 

Private Member Functions

uint256 ComputeHash () const
 

Private Attributes

const uint256 hash
 Memory only. More...
 

Friends

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

Detailed Description

The basic transaction that is broadcasted on the network and contained in blocks.

A transaction can contain multiple inputs and outputs.

Definition at line 198 of file transaction.h.

Constructor & Destructor Documentation

◆ CTransaction() [1/4]

CTransaction::CTransaction ( )

Construct a CTransaction that qualifies as IsNull()

Definition at line 95 of file transaction.cpp.

◆ CTransaction() [2/4]

CTransaction::CTransaction ( const CMutableTransaction tx)

Convert a CMutableTransaction into a CTransaction.

Definition at line 96 of file transaction.cpp.

◆ CTransaction() [3/4]

CTransaction::CTransaction ( CMutableTransaction &&  tx)

Definition at line 97 of file transaction.cpp.

◆ CTransaction() [4/4]

template<typename Stream >
CTransaction::CTransaction ( deserialize_type  ,
Stream &  s 
)
inline

This deserializing constructor is provided instead of an Unserialize method.

Unserialize is not possible, since it would require overwriting const fields.

Definition at line 250 of file transaction.h.

Member Function Documentation

◆ ComputeHash()

uint256 CTransaction::ComputeHash ( ) const
private

Definition at line 89 of file transaction.cpp.

References SerializeHash().

◆ GetHash()

const uint256& CTransaction::GetHash ( ) const
inline

Definition at line 256 of file transaction.h.

References hash.

Referenced by AcceptToMemoryPoolWorker(), CTxMemPool::addAddressIndex(), AddCoins(), CTxMemPool::addSpentIndex(), CWallet::AddToWalletIfInvolvingMe(), AddTx(), CTxMemPool::addUnchecked(), PeerLogicValidation::BlockConnected(), CDeterministicMNManager::BuildNewListFromBlock(), CBlockHeaderAndShortTxIDs::CBlockHeaderAndShortTxIDs(), llmq::CInstantSendManager::CheckCanLock(), CheckInputs(), CheckProRegTx(), CBloomFilter::CheckSpecialTransactionMatchesAndUpdate(), CChainState::ConnectBlock(), CChainState::DisconnectBlock(), entryToJSON(), getblocktemplate(), llmq::CInstantSendManager::GetConflictingLock(), getmempoolancestors(), getmempooldescendants(), CBloomFilter::IsRelevantAndUpdate(), mempoolToJSON(), CZMQPublishHashInstantSendDoubleSpendNotifier::NotifyInstantSendDoubleSpendAttempt(), CZMQPublishRawInstantSendDoubleSpendNotifier::NotifyInstantSendDoubleSpendAttempt(), CZMQPublishHashTransactionNotifier::NotifyTransaction(), CZMQPublishRawTransactionNotifier::NotifyTransaction(), CZMQPublishHashTransactionLockNotifier::NotifyTransactionLock(), CZMQPublishRawTransactionLockNotifier::NotifyTransactionLock(), CZMQPublishRawTransactionLockSigNotifier::NotifyTransactionLock(), CWallet::NotifyTransactionLock(), mempoolentry_txid::operator()(), CompareTxMemPoolEntryByScore::operator()(), OutputTxHash(), CBlockPolicyEstimator::processBlockTx(), ProcessMessage(), CBlockPolicyEstimator::processTransaction(), llmq::CInstantSendManager::ProcessTx(), CConnman::RelayTransaction(), llmq::CInstantSendManager::RemoveConflictedTx(), CTxMemPool::removeConflicts(), CTxMemPool::removeProTxCollateralConflicts(), CTxMemPool::removeProTxConflicts(), CTxMemPool::removeProTxPubKeyConflicts(), CTxMemPool::removeRecursive(), CPrivateSendClientSession::SignFinalTransaction(), ToString(), llmq::CInstantSendManager::TrySignInstantSendLock(), TxToJSON(), and TxToUniv().

◆ GetTotalSize()

unsigned int CTransaction::GetTotalSize ( ) const

Get the total transaction size in bytes, including witness data.

"Total Size" defined in BIP141 and BIP144.

Returns
Total transaction size in bytes

Definition at line 110 of file transaction.cpp.

References GetSerializeSize(), PROTOCOL_VERSION, and SER_NETWORK.

◆ GetValueOut()

CAmount CTransaction::GetValueOut ( ) const

Definition at line 99 of file transaction.cpp.

References MoneyRange(), and vout.

Referenced by Consensus::CheckTxInputs(), and CSuperblock::IsValid().

◆ IsCoinBase()

◆ IsNull()

bool CTransaction::IsNull ( ) const
inline

Definition at line 252 of file transaction.h.

References vin, and vout.

◆ Serialize()

template<typename Stream >
void CTransaction::Serialize ( Stream &  s) const
inline

Definition at line 237 of file transaction.h.

References nLockTime, TRANSACTION_NORMAL, vExtraPayload, vin, and vout.

◆ ToString()

Friends And Related Function Documentation

◆ operator!=

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

Definition at line 282 of file transaction.h.

◆ operator==

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

Definition at line 277 of file transaction.h.

Member Data Documentation

◆ CURRENT_VERSION

const int32_t CTransaction::CURRENT_VERSION =2
static

Definition at line 202 of file transaction.h.

Referenced by AddOrphanTx(), and IsStandardTx().

◆ hash

const uint256 CTransaction::hash
private

Memory only.

Definition at line 224 of file transaction.h.

Referenced by GetHash().

◆ MAX_STANDARD_VERSION

const int32_t CTransaction::MAX_STANDARD_VERSION =3
static

Definition at line 208 of file transaction.h.

Referenced by IsStandardTx(), and MutateTxVersion().

◆ nLockTime

const uint32_t CTransaction::nLockTime

◆ nType

◆ nVersion

◆ vExtraPayload

const std::vector<uint8_t> CTransaction::vExtraPayload

Definition at line 220 of file transaction.h.

Referenced by CheckTransaction(), GetTxPayload(), Serialize(), ToString(), and TxToUniv().

◆ vin

const std::vector<CTxIn> CTransaction::vin

Definition at line 215 of file transaction.h.

Referenced by AcceptToMemoryPoolWorker(), CTxMemPool::addAddressIndex(), CTxMemPool::addSpentIndex(), CWallet::AddToWalletIfInvolvingMe(), CTxMemPool::addUnchecked(), AreInputsStandard(), PeerLogicValidation::BlockConnected(), CDeterministicMNManager::BuildNewListFromBlock(), CalcTxInputsHash(), CTxMemPool::CalculateMemPoolAncestors(), CalculateSequenceLocks(), CTxMemPool::check(), llmq::CInstantSendManager::CheckCanLock(), CheckInputs(), CheckInputsFromMempoolAndCache(), TransactionSignatureChecker::CheckLockTime(), TransactionSignatureChecker::CheckSequence(), CheckSequenceLocks(), CheckTransaction(), Consensus::CheckTxInputs(), CChainState::ConnectBlock(), dashconsensus_verify_script(), CChainState::DisconnectBlock(), entryToJSON(), CWallet::FindNonChangeParentOutput(), getblocktemplate(), llmq::CInstantSendManager::GetConflictingLock(), CWallet::GetDebit(), GetLegacySigOpCount(), GetP2SHSigOpCount(), CCoinsViewCache::GetValueIn(), CTxMemPool::HasNoInputsOf(), CCoinsViewCache::HaveInputs(), CWallet::IsAllFromMe(), IsCoinBase(), CPrivateSend::IsCollateralValid(), IsFinalTx(), IsNull(), CBloomFilter::IsRelevantAndUpdate(), IsStandardTx(), CScriptCheck::operator()(), ProcessMessage(), llmq::CInstantSendManager::ProcessTx(), RecursiveDynamicUsage(), llmq::CInstantSendManager::RemoveConflictedTx(), CTxMemPool::removeConflicts(), CTxMemPool::removeForReorg(), CTxMemPool::removeProTxSpentCollateralConflicts(), Serialize(), SignatureHash(), CWallet::SyncTransaction(), ToString(), llmq::CInstantSendManager::TrySignInstantSendLock(), TxToJSON(), TxToUniv(), and UpdateCoins().

◆ vout


The documentation for this class was generated from the following files:
Released under the MIT license