Bitcoin Core 31.0.0
P2P Digital Currency
Loading...
Searching...
No Matches
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 , 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
bool IsEquivalentTo (const CWalletTx &tx) const
 True if only scriptSigs are different.
bool InMempool () const
int64_t GetTxTime () const
template<typename T>
const Tstate () const
template<typename T>
Tstate ()
void updateState (interfaces::Chain &chain)
bool isAbandoned () const
bool isMempoolConflicted () const
bool isBlockConflicted () const
bool isInactive () const
bool isUnconfirmed () const
bool isConfirmed () const
const TxidGetHash () const LIFETIMEBOUND
const WtxidGetWitnessHash () const LIFETIMEBOUND
bool IsCoinBase () const
void CopyFrom (const CWalletTx &)

Public Attributes

mapValue_t mapValue
 Key/value map with information about the transaction.
std::vector< std::pair< std::string, std::string > > vOrderForm
unsigned int nTimeReceived
 time received by this node
unsigned int nTimeSmart
 Stable timestamp that never changes, and reflects the order a transaction was added to the wallet.
std::optional< bool > m_cached_from_me {std::nullopt}
int64_t nOrderPos
 position in ordered transaction list
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.
bool fChangeCached
CAmount nChangeCached
CTransactionRef tx
TxState m_state
std::set< Txidmempool_conflicts
std::optional< Txidtruc_child_in_mempool

Private Member Functions

 CWalletTx (const CWalletTx &)=default
CWalletTxoperator= (const CWalletTx &)=default

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 194 of file transaction.h.

Member Enumeration Documentation

◆ AmountType

Enumerator
DEBIT 
CREDIT 
AMOUNTTYPE_ENUM_ELEMENTS 

Definition at line 241 of file transaction.h.

Constructor & Destructor Documentation

◆ CWalletTx() [1/2]

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

Definition at line 253 of file transaction.h.

◆ CWalletTx() [2/2]

wallet::CWalletTx::CWalletTx ( const CWalletTx & )
privatedefault

Member Function Documentation

◆ CopyFrom()

Definition at line 59 of file transaction.cpp.

◆ GetHash()

const Txid & wallet::CWalletTx::GetHash ( ) const
inline

Definition at line 367 of file transaction.h.

◆ GetTxTime()

int64_t wallet::CWalletTx::GetTxTime ( ) const

Definition at line 32 of file transaction.cpp.

◆ GetWitnessHash()

const Wtxid & wallet::CWalletTx::GetWitnessHash ( ) const
inline

Definition at line 368 of file transaction.h.

◆ Init()

void wallet::CWalletTx::Init ( )
inline

Definition at line 258 of file transaction.h.

◆ InMempool()

Definition at line 27 of file transaction.cpp.

◆ isAbandoned()

bool wallet::CWalletTx::isAbandoned ( ) const
inline

Definition at line 361 of file transaction.h.

◆ isBlockConflicted()

bool wallet::CWalletTx::isBlockConflicted ( ) const
inline

Definition at line 363 of file transaction.h.

◆ IsCoinBase()

bool wallet::CWalletTx::IsCoinBase ( ) const
inline

Definition at line 369 of file transaction.h.

◆ isConfirmed()

bool wallet::CWalletTx::isConfirmed ( ) const
inline

Definition at line 366 of file transaction.h.

◆ IsEquivalentTo()

bool wallet::CWalletTx::IsEquivalentTo ( const CWalletTx & tx) const

True if only scriptSigs are different.

Definition at line 12 of file transaction.cpp.

◆ isInactive()

bool wallet::CWalletTx::isInactive ( ) const
inline

Definition at line 364 of file transaction.h.

◆ isMempoolConflicted()

Definition at line 362 of file transaction.h.

◆ isUnconfirmed()

bool wallet::CWalletTx::isUnconfirmed ( ) const
inline

Definition at line 365 of file transaction.h.

◆ MarkDirty()

make sure balances are recalculated

Definition at line 338 of file transaction.h.

◆ operator=()

CWalletTx & wallet::CWalletTx::operator= ( const CWalletTx & )
privatedefault

◆ Serialize()

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

< Used to be vMerkleBranch

< Used to be vtxPrev

< Used to be fFromMe, and fSpent

Definition at line 285 of file transaction.h.

◆ SetTx()

Definition at line 332 of file transaction.h.

◆ state() [1/2]

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

Definition at line 355 of file transaction.h.

◆ state() [2/2]

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

Definition at line 354 of file transaction.h.

◆ Unserialize()

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

< Used to be vMerkleBranch

< Used to be vtxPrev

Used to be fFromMe, and fSpent

Definition at line 307 of file transaction.h.

◆ updateState()

Update transaction state when attaching to a chain, filling in heights of conflicted and confirmed blocks

Definition at line 38 of file transaction.cpp.

Member Data Documentation

◆ fChangeCached

Definition at line 250 of file transaction.h.

◆ m_amounts

Definition at line 242 of file transaction.h.

◆ m_cached_from_me

std::optional<bool> wallet::CWalletTx::m_cached_from_me {std::nullopt}
mutable

Definition at line 236 of file transaction.h.

◆ m_is_cache_empty

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 249 of file transaction.h.

◆ m_it_wtxOrdered

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

Definition at line 238 of file transaction.h.

◆ m_state

Definition at line 270 of file transaction.h.

◆ 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 222 of file transaction.h.

◆ mempool_conflicts

Definition at line 278 of file transaction.h.

◆ nChangeCached

Definition at line 251 of file transaction.h.

◆ nOrderPos

position in ordered transaction list

Definition at line 237 of file transaction.h.

◆ nTimeReceived

time received by this node

Definition at line 224 of file transaction.h.

◆ 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 234 of file transaction.h.

◆ truc_child_in_mempool

Definition at line 282 of file transaction.h.

◆ tx

◆ vOrderForm

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

Definition at line 223 of file transaction.h.


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