![]() |
Bitcoin Core
22.0.0
P2P Digital Currency
|
A transaction with a bunch of additional info that only the owner cares about. More...
#include <transaction.h>
Classes | |
| struct | Confirmation |
| Confirmation includes tx status and a triplet of {block height/block hash/tx index in block} at which tx has been confirmed. More... | |
Public Types | |
| enum | AmountType { DEBIT, CREDIT, IMMATURE_CREDIT, AVAILABLE_CREDIT, AMOUNTTYPE_ENUM_ELEMENTS } |
| enum | Status { UNCONFIRMED, CONFIRMED, CONFLICTED, ABANDONED } |
| New transactions start as UNCONFIRMED. More... | |
Public Member Functions | |
| CAmount | GetCachableAmount (AmountType type, const isminefilter &filter, bool recalculate=false) const |
| CWalletTx (const CWallet *wallet, CTransactionRef arg) | |
| 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... | |
| CAmount | GetDebit (const isminefilter &filter) const |
| filter decides which addresses will count towards the debit More... | |
| CAmount | GetCredit (const isminefilter &filter) const |
| CAmount | GetImmatureCredit (bool fUseCache=true) const |
| CAmount | GetAvailableCredit (bool fUseCache=true, const isminefilter &filter=ISMINE_SPENDABLE) const NO_THREAD_SAFETY_ANALYSIS |
| CAmount | GetImmatureWatchOnlyCredit (const bool fUseCache=true) const |
| CAmount | GetChange () const |
| int | GetSpendSize (unsigned int out, bool use_max_sig=false) const |
| Get the marginal bytes if spending the specified output from this transaction. More... | |
| void | GetAmounts (std::list< COutputEntry > &listReceived, std::list< COutputEntry > &listSent, CAmount &nFee, const isminefilter &filter) const |
| bool | IsFromMe (const isminefilter &filter) const |
| bool | IsEquivalentTo (const CWalletTx &tx) const |
| True if only scriptSigs are different. More... | |
| bool | InMempool () const |
| bool | IsTrusted () const |
| int64_t | GetTxTime () const |
| bool | SubmitMemoryPoolAndRelay (std::string &err_string, bool relay) |
| Pass this transaction to node for mempool insertion and relay to peers if flag set to true. More... | |
| std::set< uint256 > | GetConflicts () const NO_THREAD_SAFETY_ANALYSIS |
| int | GetDepthInMainChain () const NO_THREAD_SAFETY_ANALYSIS |
| Return depth of transaction in blockchain: <0 : conflicts with a transaction this deep in the blockchain 0 : in memory pool, waiting to be included in a block >=1 : this many blocks deep in the main chain. More... | |
| bool | IsInMainChain () const |
| int | GetBlocksToMaturity () const |
| bool | isAbandoned () const |
| void | setAbandoned () |
| bool | isConflicted () const |
| void | setConflicted () |
| bool | isUnconfirmed () const |
| void | setUnconfirmed () |
| bool | isConfirmed () const |
| void | setConfirmed () |
| const uint256 & | GetHash () const |
| bool | IsCoinBase () const |
| bool | IsImmatureCoinBase () 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 |
| bool | fInMempool |
| CAmount | nChangeCached |
| CTransactionRef | tx |
| Confirmation | m_confirm |
Private Attributes | |
| const CWallet *const | pwallet |
Static Private Attributes | |
| static constexpr const uint256 & | ABANDON_HASH = uint256::ONE |
| Constant used in hashBlock to indicate tx has been abandoned, only used at serialization/deserialization to avoid ambiguity with conflicted. More... | |
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 68 of file transaction.h.
| Enumerator | |
|---|---|
| DEBIT | |
| CREDIT | |
| IMMATURE_CREDIT | |
| AVAILABLE_CREDIT | |
| AMOUNTTYPE_ENUM_ELEMENTS | |
Definition at line 128 of file transaction.h.
| enum CWalletTx::Status |
New transactions start as UNCONFIRMED.
At BlockConnected, they will transition to CONFIRMED. In case of reorg, at BlockDisconnected, they roll back to UNCONFIRMED. If we detect a conflicting transaction at block connection, we update conflicted tx and its dependencies as CONFLICTED. If tx isn't confirmed and outside of mempool, the user may switch it to ABANDONED by using the abandontransaction call. This last status may be override by a CONFLICTED or CONFIRMED transition.
| Enumerator | |
|---|---|
| UNCONFIRMED | |
| CONFIRMED | |
| CONFLICTED | |
| ABANDONED | |
Definition at line 174 of file transaction.h.
|
inline |
|
delete |
| void CWalletTx::GetAmounts | ( | std::list< COutputEntry > & | listReceived, |
| std::list< COutputEntry > & | listSent, | ||
| CAmount & | nFee, | ||
| const isminefilter & | filter | ||
| ) | const |
| CAmount CWalletTx::GetAvailableCredit | ( | bool | fUseCache = true, |
| const isminefilter & | filter = ISMINE_SPENDABLE |
||
| ) | const |
Definition at line 181 of file receive.cpp.
| int CWalletTx::GetBlocksToMaturity | ( | ) | const |
Definition at line 2903 of file wallet.cpp.
| CAmount CWalletTx::GetCachableAmount | ( | AmountType | type, |
| const isminefilter & | filter, | ||
| bool | recalculate = false |
||
| ) | const |
Definition at line 112 of file receive.cpp.
| CAmount CWalletTx::GetChange | ( | ) | const |
| CAmount CWalletTx::GetCredit | ( | const isminefilter & | filter | ) | const |
Definition at line 122 of file receive.cpp.
| CAmount CWalletTx::GetDebit | ( | const isminefilter & | filter | ) | const |
filter decides which addresses will count towards the debit
Definition at line 139 of file receive.cpp.
| int CWalletTx::GetDepthInMainChain | ( | ) | const |
Return depth of transaction in blockchain: <0 : conflicts with a transaction this deep in the blockchain 0 : in memory pool, waiting to be included in a block >=1 : this many blocks deep in the main chain.
Definition at line 2894 of file wallet.cpp.
|
inline |
| CAmount CWalletTx::GetImmatureCredit | ( | bool | fUseCache = true | ) | const |
Definition at line 163 of file receive.cpp.
| CAmount CWalletTx::GetImmatureWatchOnlyCredit | ( | const bool | fUseCache = true | ) | const |
Definition at line 172 of file receive.cpp.
|
inline |
Get the marginal bytes if spending the specified output from this transaction.
Definition at line 280 of file transaction.h.
| int64_t CWalletTx::GetTxTime | ( | ) | const |
|
inline |
| bool CWalletTx::InMempool | ( | ) | const |
|
inline |
|
inline |
|
inline |
|
inline |
| bool CWalletTx::IsEquivalentTo | ( | const CWalletTx & | tx | ) | const |
True if only scriptSigs are different.
Definition at line 7 of file transaction.cpp.
|
inline |
Definition at line 288 of file transaction.h.
| bool CWalletTx::IsImmatureCoinBase | ( | ) | const |
Definition at line 2912 of file wallet.cpp.
|
inline |
Definition at line 325 of file transaction.h.
| bool CWalletTx::IsTrusted | ( | ) | const |
Definition at line 306 of file receive.cpp.
|
inline |
|
inline |
make sure balances are recalculated
Definition at line 257 of file transaction.h.
|
delete |
|
inline |
< Used to be vMerkleBranch
< Used to be vtxPrev
< Used to be fSpent
Definition at line 197 of file transaction.h.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
< Used to be vMerkleBranch
< Used to be vtxPrev
Used to be fSpent
Definition at line 216 of file transaction.h.
|
staticprivate |
Constant used in hashBlock to indicate tx has been abandoned, only used at serialization/deserialization to avoid ambiguity with conflicted.
Definition at line 76 of file transaction.h.
|
mutable |
Definition at line 138 of file transaction.h.
| 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 123 of file transaction.h.
|
mutable |
Definition at line 139 of file transaction.h.
| unsigned int CWalletTx::fTimeReceivedIsTxTime |
Definition at line 106 of file transaction.h.
|
mutable |
Definition at line 130 of file transaction.h.
| Confirmation CWalletTx::m_confirm |
Definition at line 194 of file transaction.h.
|
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 137 of file transaction.h.
| std::multimap<int64_t, CWalletTx*>::const_iterator CWalletTx::m_it_wtxOrdered |
Definition at line 125 of file transaction.h.
| 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 104 of file transaction.h.
|
mutable |
Definition at line 140 of file transaction.h.
| int64_t CWalletTx::nOrderPos |
position in ordered transaction list
Definition at line 124 of file transaction.h.
| unsigned int CWalletTx::nTimeReceived |
time received by this node
Definition at line 107 of file transaction.h.
| 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 117 of file transaction.h.
|
private |
Definition at line 71 of file transaction.h.
| CTransactionRef CWalletTx::tx |
Definition at line 164 of file transaction.h.
| std::vector<std::pair<std::string, std::string> > CWalletTx::vOrderForm |
Definition at line 105 of file transaction.h.
1.8.14