Bitcoin Core  22.99.0
P2P Digital Currency
Public Types | Public Member Functions | Public Attributes | List of all members
CWalletTx Class Reference

A transaction with a bunch of additional info that only the owner cares about. More...

#include <transaction.h>

Collaboration diagram for CWalletTx:
[legend]

Public Types

enum  AmountType {
  DEBIT, CREDIT, IMMATURE_CREDIT, AVAILABLE_CREDIT,
  AMOUNTTYPE_ENUM_ELEMENTS
}
 

Public Member Functions

 CWalletTx (CTransactionRef tx, const TxState &state)
 
void Init ()
 
template<typename Stream >
void Serialize (Stream &s) const
 
template<typename Stream >
void Unserialize (Stream &s)
 
void SetTx (CTransactionRef arg)
 
void MarkDirty ()
 make sure balances are recalculated More...
 
bool IsEquivalentTo (const CWalletTx &tx) const
 True if only scriptSigs are different. More...
 
bool InMempool () const
 
int64_t GetTxTime () const
 
template<typename T >
const Tstate () const
 
template<typename T >
Tstate ()
 
bool isAbandoned () const
 
bool isConflicted () const
 
bool isUnconfirmed () const
 
bool isConfirmed () const
 
const uint256GetHash () const
 
bool IsCoinBase () const
 
 CWalletTx (CWalletTx const &)=delete
 
void operator= (CWalletTx const &x)=delete
 

Public Attributes

mapValue_t mapValue
 Key/value map with information about the transaction. More...
 
std::vector< std::pair< std::string, std::string > > vOrderForm
 
unsigned int fTimeReceivedIsTxTime
 
unsigned int nTimeReceived
 time received by this node More...
 
unsigned int nTimeSmart
 Stable timestamp that never changes, and reflects the order a transaction was added to the wallet. More...
 
bool fFromMe
 From me flag is set to 1 for transactions that were created by the wallet on this bitcoin node, and set to 0 for transactions that were created externally and came in through the network or sendrawtransaction RPC. More...
 
int64_t nOrderPos
 position in ordered transaction list More...
 
std::multimap< int64_t, CWalletTx * >::const_iterator m_it_wtxOrdered
 
CachableAmount m_amounts [AMOUNTTYPE_ENUM_ELEMENTS]
 
bool m_is_cache_empty {true}
 This flag is true if all m_amounts caches are empty. More...
 
bool fChangeCached
 
CAmount nChangeCached
 
CTransactionRef tx
 
TxState m_state
 

Detailed Description

A transaction with a bunch of additional info that only the owner cares about.

It includes any unrecorded transactions needed to link it back to the block chain.

Definition at line 136 of file transaction.h.

Member Enumeration Documentation

◆ AmountType

Enumerator
DEBIT 
CREDIT 
IMMATURE_CREDIT 
AVAILABLE_CREDIT 
AMOUNTTYPE_ENUM_ELEMENTS 

Definition at line 188 of file transaction.h.

Constructor & Destructor Documentation

◆ CWalletTx() [1/2]

CWalletTx::CWalletTx ( CTransactionRef  tx,
const TxState state 
)
inline

Definition at line 200 of file transaction.h.

Here is the call graph for this function:

◆ CWalletTx() [2/2]

CWalletTx::CWalletTx ( CWalletTx const &  )
delete

Member Function Documentation

◆ GetHash()

const uint256& CWalletTx::GetHash ( ) const
inline

Definition at line 297 of file transaction.h.

Here is the caller graph for this function:

◆ GetTxTime()

int64_t CWalletTx::GetTxTime ( ) const

Definition at line 21 of file transaction.cpp.

Here is the caller graph for this function:

◆ Init()

void CWalletTx::Init ( )
inline

Definition at line 205 of file transaction.h.

Here is the caller graph for this function:

◆ InMempool()

bool CWalletTx::InMempool ( ) const

Definition at line 16 of file transaction.cpp.

Here is the caller graph for this function:

◆ isAbandoned()

bool CWalletTx::isAbandoned ( ) const
inline

Definition at line 293 of file transaction.h.

Here is the caller graph for this function:

◆ IsCoinBase()

bool CWalletTx::IsCoinBase ( ) const
inline

Definition at line 298 of file transaction.h.

Here is the caller graph for this function:

◆ isConfirmed()

bool CWalletTx::isConfirmed ( ) const
inline

Definition at line 296 of file transaction.h.

Here is the caller graph for this function:

◆ isConflicted()

bool CWalletTx::isConflicted ( ) const
inline

Definition at line 294 of file transaction.h.

Here is the caller graph for this function:

◆ IsEquivalentTo()

bool CWalletTx::IsEquivalentTo ( const CWalletTx tx) const

True if only scriptSigs are different.

Definition at line 7 of file transaction.cpp.

Here is the caller graph for this function:

◆ isUnconfirmed()

bool CWalletTx::isUnconfirmed ( ) const
inline

Definition at line 295 of file transaction.h.

Here is the call graph for this function:

◆ MarkDirty()

void CWalletTx::MarkDirty ( )
inline

make sure balances are recalculated

Definition at line 273 of file transaction.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator=()

void CWalletTx::operator= ( CWalletTx const &  x)
delete

◆ Serialize()

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

< Used to be vMerkleBranch

< Used to be vtxPrev

< Used to be fSpent

Definition at line 222 of file transaction.h.

Here is the call graph for this function:

◆ SetTx()

void CWalletTx::SetTx ( CTransactionRef  arg)
inline

Definition at line 267 of file transaction.h.

Here is the caller graph for this function:

◆ state() [1/2]

template<typename T >
T* CWalletTx::state ( )
inline

Definition at line 291 of file transaction.h.

◆ state() [2/2]

template<typename T >
const T* CWalletTx::state ( ) const
inline

Definition at line 290 of file transaction.h.

Here is the caller graph for this function:

◆ Unserialize()

template<typename Stream >
void CWalletTx::Unserialize ( Stream &  s)
inline

< Used to be vMerkleBranch

< Used to be vtxPrev

Used to be fSpent

Definition at line 243 of file transaction.h.

Here is the call graph for this function:

Member Data Documentation

◆ fChangeCached

bool CWalletTx::fChangeCached
mutable

Definition at line 197 of file transaction.h.

◆ fFromMe

bool CWalletTx::fFromMe

From me flag is set to 1 for transactions that were created by the wallet on this bitcoin node, and set to 0 for transactions that were created externally and came in through the network or sendrawtransaction RPC.

Definition at line 183 of file transaction.h.

◆ fTimeReceivedIsTxTime

unsigned int CWalletTx::fTimeReceivedIsTxTime

Definition at line 166 of file transaction.h.

◆ m_amounts

CachableAmount CWalletTx::m_amounts[AMOUNTTYPE_ENUM_ELEMENTS]
mutable

Definition at line 189 of file transaction.h.

◆ m_is_cache_empty

bool CWalletTx::m_is_cache_empty {true}
mutable

This flag is true if all m_amounts caches are empty.

This is particularly useful in places where MarkDirty is conditionally called and the condition can be expensive and thus can be skipped if the flag is true. See MarkDestinationsDirty.

Definition at line 196 of file transaction.h.

◆ m_it_wtxOrdered

std::multimap<int64_t, CWalletTx*>::const_iterator CWalletTx::m_it_wtxOrdered

Definition at line 185 of file transaction.h.

◆ m_state

TxState CWalletTx::m_state

Definition at line 219 of file transaction.h.

◆ mapValue

mapValue_t CWalletTx::mapValue

Key/value map with information about the transaction.

The following keys can be read and written through the map and are serialized in the wallet database:

"comment", "to"   - comment strings provided to sendtoaddress,
                    and sendmany wallet RPCs
"replaces_txid"   - txid (as HexStr) of transaction replaced by
                    bumpfee on transaction created by bumpfee
"replaced_by_txid" - txid (as HexStr) of transaction created by
                    bumpfee on transaction replaced by bumpfee
"from", "message" - obsolete fields that could be set in UI prior to
                    2011 (removed in commit 4d9b223)

The following keys are serialized in the wallet database, but shouldn't be read or written through the map (they will be temporarily added and removed from the map during serialization):

"fromaccount"     - serialized strFromAccount value
"n"               - serialized nOrderPos value
"timesmart"       - serialized nTimeSmart value
"spent"           - serialized vfSpent value that existed prior to
                    2014 (removed in commit 93a18a3)

Definition at line 164 of file transaction.h.

◆ nChangeCached

CAmount CWalletTx::nChangeCached
mutable

Definition at line 198 of file transaction.h.

◆ nOrderPos

int64_t CWalletTx::nOrderPos

position in ordered transaction list

Definition at line 184 of file transaction.h.

◆ nTimeReceived

unsigned int CWalletTx::nTimeReceived

time received by this node

Definition at line 167 of file transaction.h.

◆ nTimeSmart

unsigned int CWalletTx::nTimeSmart

Stable timestamp that never changes, and reflects the order a transaction was added to the wallet.

Timestamp is based on the block time for a transaction added as part of a block, or else the time when the transaction was received if it wasn't part of a block, with the timestamp adjusted in both cases so timestamp order matches the order transactions were added to the wallet. More details can be found in CWallet::ComputeTimeSmart().

Definition at line 177 of file transaction.h.

◆ tx

CTransactionRef CWalletTx::tx

Definition at line 218 of file transaction.h.

◆ vOrderForm

std::vector<std::pair<std::string, std::string> > CWalletTx::vOrderForm

Definition at line 165 of file transaction.h.


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