Bitcoin Core  21.99.0
P2P Digital Currency
receive.cpp
Go to the documentation of this file.
1 // Copyright (c) 2021 The Bitcoin Core developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 
5 #include <consensus/consensus.h>
6 #include <wallet/receive.h>
7 #include <wallet/transaction.h>
8 #include <wallet/wallet.h>
9 
10 isminetype CWallet::IsMine(const CTxIn &txin) const
11 {
13  std::map<uint256, CWalletTx>::const_iterator mi = mapWallet.find(txin.prevout.hash);
14  if (mi != mapWallet.end())
15  {
16  const CWalletTx& prev = (*mi).second;
17  if (txin.prevout.n < prev.tx->vout.size())
18  return IsMine(prev.tx->vout[txin.prevout.n]);
19  }
20  return ISMINE_NO;
21 }
22 
23 bool CWallet::IsAllFromMe(const CTransaction& tx, const isminefilter& filter) const
24 {
25  LOCK(cs_wallet);
26 
27  for (const CTxIn& txin : tx.vin)
28  {
29  auto mi = mapWallet.find(txin.prevout.hash);
30  if (mi == mapWallet.end())
31  return false; // any unknown inputs can't be from us
32 
33  const CWalletTx& prev = (*mi).second;
34 
35  if (txin.prevout.n >= prev.tx->vout.size())
36  return false; // invalid input!
37 
38  if (!(IsMine(prev.tx->vout[txin.prevout.n]) & filter))
39  return false;
40  }
41  return true;
42 }
43 
44 CAmount CWallet::GetCredit(const CTxOut& txout, const isminefilter& filter) const
45 {
46  if (!MoneyRange(txout.nValue))
47  throw std::runtime_error(std::string(__func__) + ": value out of range");
48  LOCK(cs_wallet);
49  return ((IsMine(txout) & filter) ? txout.nValue : 0);
50 }
51 
52 CAmount CWallet::GetCredit(const CTransaction& tx, const isminefilter& filter) const
53 {
54  CAmount nCredit = 0;
55  for (const CTxOut& txout : tx.vout)
56  {
57  nCredit += GetCredit(txout, filter);
58  if (!MoneyRange(nCredit))
59  throw std::runtime_error(std::string(__func__) + ": value out of range");
60  }
61  return nCredit;
62 }
63 
64 bool CWallet::IsChange(const CScript& script) const
65 {
66  // TODO: fix handling of 'change' outputs. The assumption is that any
67  // payment to a script that is ours, but is not in the address book
68  // is change. That assumption is likely to break when we implement multisignature
69  // wallets that return change back into a multi-signature-protected address;
70  // a better way of identifying which outputs are 'the send' and which are
71  // 'the change' will need to be implemented (maybe extend CWalletTx to remember
72  // which output, if any, was change).
74  if (IsMine(script))
75  {
76  CTxDestination address;
77  if (!ExtractDestination(script, address))
78  return true;
79  if (!FindAddressBookEntry(address)) {
80  return true;
81  }
82  }
83  return false;
84 }
85 
86 bool CWallet::IsChange(const CTxOut& txout) const
87 {
88  return IsChange(txout.scriptPubKey);
89 }
90 
91 CAmount CWallet::GetChange(const CTxOut& txout) const
92 {
94  if (!MoneyRange(txout.nValue))
95  throw std::runtime_error(std::string(__func__) + ": value out of range");
96  return (IsChange(txout) ? txout.nValue : 0);
97 }
98 
100 {
101  LOCK(cs_wallet);
102  CAmount nChange = 0;
103  for (const CTxOut& txout : tx.vout)
104  {
105  nChange += GetChange(txout);
106  if (!MoneyRange(nChange))
107  throw std::runtime_error(std::string(__func__) + ": value out of range");
108  }
109  return nChange;
110 }
111 
112 CAmount CWalletTx::GetCachableAmount(AmountType type, const isminefilter& filter, bool recalculate) const
113 {
114  auto& amount = m_amounts[type];
115  if (recalculate || !amount.m_cached[filter]) {
116  amount.Set(filter, type == DEBIT ? pwallet->GetDebit(*tx, filter) : pwallet->GetCredit(*tx, filter));
117  m_is_cache_empty = false;
118  }
119  return amount.m_value[filter];
120 }
121 
123 {
124  // Must wait until coinbase is safely deep enough in the chain before valuing it
125  if (IsImmatureCoinBase())
126  return 0;
127 
128  CAmount credit = 0;
129  if (filter & ISMINE_SPENDABLE) {
130  // GetBalance can assume transactions in mapWallet won't change
132  }
133  if (filter & ISMINE_WATCH_ONLY) {
135  }
136  return credit;
137 }
138 
140 {
141  if (tx->vin.empty())
142  return 0;
143 
144  CAmount debit = 0;
145  if (filter & ISMINE_SPENDABLE) {
147  }
148  if (filter & ISMINE_WATCH_ONLY) {
150  }
151  return debit;
152 }
153 
155 {
156  if (fChangeCached)
157  return nChangeCached;
159  fChangeCached = true;
160  return nChangeCached;
161 }
162 
164 {
165  if (IsImmatureCoinBase() && IsInMainChain()) {
167  }
168 
169  return 0;
170 }
171 
173 {
174  if (IsImmatureCoinBase() && IsInMainChain()) {
176  }
177 
178  return 0;
179 }
180 
181 CAmount CWalletTx::GetAvailableCredit(bool fUseCache, const isminefilter& filter) const
182 {
183  if (pwallet == nullptr)
184  return 0;
185 
186  // Avoid caching ismine for NO or ALL cases (could remove this check and simplify in the future).
187  bool allow_cache = (filter & ISMINE_ALL) && (filter & ISMINE_ALL) != ISMINE_ALL;
188 
189  // Must wait until coinbase is safely deep enough in the chain before valuing it
190  if (IsImmatureCoinBase())
191  return 0;
192 
193  if (fUseCache && allow_cache && m_amounts[AVAILABLE_CREDIT].m_cached[filter]) {
194  return m_amounts[AVAILABLE_CREDIT].m_value[filter];
195  }
196 
197  bool allow_used_addresses = (filter & ISMINE_USED) || !pwallet->IsWalletFlagSet(WALLET_FLAG_AVOID_REUSE);
198  CAmount nCredit = 0;
199  uint256 hashTx = GetHash();
200  for (unsigned int i = 0; i < tx->vout.size(); i++)
201  {
202  if (!pwallet->IsSpent(hashTx, i) && (allow_used_addresses || !pwallet->IsSpentKey(hashTx, i))) {
203  const CTxOut &txout = tx->vout[i];
204  nCredit += pwallet->GetCredit(txout, filter);
205  if (!MoneyRange(nCredit))
206  throw std::runtime_error(std::string(__func__) + " : value out of range");
207  }
208  }
209 
210  if (allow_cache) {
211  m_amounts[AVAILABLE_CREDIT].Set(filter, nCredit);
212  m_is_cache_empty = false;
213  }
214 
215  return nCredit;
216 }
217 
218 void CWalletTx::GetAmounts(std::list<COutputEntry>& listReceived,
219  std::list<COutputEntry>& listSent, CAmount& nFee, const isminefilter& filter) const
220 {
221  nFee = 0;
222  listReceived.clear();
223  listSent.clear();
224 
225  // Compute fee:
226  CAmount nDebit = GetDebit(filter);
227  if (nDebit > 0) // debit>0 means we signed/sent this transaction
228  {
229  CAmount nValueOut = tx->GetValueOut();
230  nFee = nDebit - nValueOut;
231  }
232 
234  // Sent/received.
235  for (unsigned int i = 0; i < tx->vout.size(); ++i)
236  {
237  const CTxOut& txout = tx->vout[i];
238  isminetype fIsMine = pwallet->IsMine(txout);
239  // Only need to handle txouts if AT LEAST one of these is true:
240  // 1) they debit from us (sent)
241  // 2) the output is to us (received)
242  if (nDebit > 0)
243  {
244  // Don't report 'change' txouts
245  if (pwallet->IsChange(txout))
246  continue;
247  }
248  else if (!(fIsMine & filter))
249  continue;
250 
251  // In either case, we need to get the destination address
252  CTxDestination address;
253 
254  if (!ExtractDestination(txout.scriptPubKey, address) && !txout.scriptPubKey.IsUnspendable())
255  {
256  pwallet->WalletLogPrintf("CWalletTx::GetAmounts: Unknown transaction type found, txid %s\n",
257  this->GetHash().ToString());
258  address = CNoDestination();
259  }
260 
261  COutputEntry output = {address, txout.nValue, (int)i};
262 
263  // If we are debited by the transaction, add the output as a "sent" entry
264  if (nDebit > 0)
265  listSent.push_back(output);
266 
267  // If we are receiving the output, add it as a "received" entry
268  if (fIsMine & filter)
269  listReceived.push_back(output);
270  }
271 
272 }
273 
274 bool CWallet::IsTrusted(const CWalletTx& wtx, std::set<uint256>& trusted_parents) const
275 {
277  // Quick answer in most cases
278  if (!chain().checkFinalTx(*wtx.tx)) return false;
279  int nDepth = wtx.GetDepthInMainChain();
280  if (nDepth >= 1) return true;
281  if (nDepth < 0) return false;
282  // using wtx's cached debit
283  if (!m_spend_zero_conf_change || !wtx.IsFromMe(ISMINE_ALL)) return false;
284 
285  // Don't trust unconfirmed transactions from us unless they are in the mempool.
286  if (!wtx.InMempool()) return false;
287 
288  // Trusted if all inputs are from us and are in the mempool:
289  for (const CTxIn& txin : wtx.tx->vin)
290  {
291  // Transactions not sent by us: not trusted
292  const CWalletTx* parent = GetWalletTx(txin.prevout.hash);
293  if (parent == nullptr) return false;
294  const CTxOut& parentOut = parent->tx->vout[txin.prevout.n];
295  // Check that this specific input being spent is trusted
296  if (IsMine(parentOut) != ISMINE_SPENDABLE) return false;
297  // If we've already trusted this parent, continue
298  if (trusted_parents.count(parent->GetHash())) continue;
299  // Recurse to check that the parent is also trusted
300  if (!IsTrusted(*parent, trusted_parents)) return false;
301  trusted_parents.insert(parent->GetHash());
302  }
303  return true;
304 }
305 
307 {
308  std::set<uint256> trusted_parents;
310  return pwallet->IsTrusted(*this, trusted_parents);
311 }
312 
313 CWallet::Balance CWallet::GetBalance(const int min_depth, bool avoid_reuse) const
314 {
315  Balance ret;
316  isminefilter reuse_filter = avoid_reuse ? ISMINE_NO : ISMINE_USED;
317  {
318  LOCK(cs_wallet);
319  std::set<uint256> trusted_parents;
320  for (const auto& entry : mapWallet)
321  {
322  const CWalletTx& wtx = entry.second;
323  const bool is_trusted{IsTrusted(wtx, trusted_parents)};
324  const int tx_depth{wtx.GetDepthInMainChain()};
325  const CAmount tx_credit_mine{wtx.GetAvailableCredit(/* fUseCache */ true, ISMINE_SPENDABLE | reuse_filter)};
326  const CAmount tx_credit_watchonly{wtx.GetAvailableCredit(/* fUseCache */ true, ISMINE_WATCH_ONLY | reuse_filter)};
327  if (is_trusted && tx_depth >= min_depth) {
328  ret.m_mine_trusted += tx_credit_mine;
329  ret.m_watchonly_trusted += tx_credit_watchonly;
330  }
331  if (!is_trusted && tx_depth == 0 && wtx.InMempool()) {
332  ret.m_mine_untrusted_pending += tx_credit_mine;
333  ret.m_watchonly_untrusted_pending += tx_credit_watchonly;
334  }
335  ret.m_mine_immature += wtx.GetImmatureCredit();
337  }
338  }
339  return ret;
340 }
341 
342 std::map<CTxDestination, CAmount> CWallet::GetAddressBalances() const
343 {
344  std::map<CTxDestination, CAmount> balances;
345 
346  {
347  LOCK(cs_wallet);
348  std::set<uint256> trusted_parents;
349  for (const auto& walletEntry : mapWallet)
350  {
351  const CWalletTx& wtx = walletEntry.second;
352 
353  if (!IsTrusted(wtx, trusted_parents))
354  continue;
355 
356  if (wtx.IsImmatureCoinBase())
357  continue;
358 
359  int nDepth = wtx.GetDepthInMainChain();
360  if (nDepth < (wtx.IsFromMe(ISMINE_ALL) ? 0 : 1))
361  continue;
362 
363  for (unsigned int i = 0; i < wtx.tx->vout.size(); i++)
364  {
365  CTxDestination addr;
366  if (!IsMine(wtx.tx->vout[i]))
367  continue;
368  if(!ExtractDestination(wtx.tx->vout[i].scriptPubKey, addr))
369  continue;
370 
371  CAmount n = IsSpent(walletEntry.first, i) ? 0 : wtx.tx->vout[i].nValue;
372  balances[addr] += n;
373  }
374  }
375  }
376 
377  return balances;
378 }
379 
380 std::set< std::set<CTxDestination> > CWallet::GetAddressGroupings() const
381 {
383  std::set< std::set<CTxDestination> > groupings;
384  std::set<CTxDestination> grouping;
385 
386  for (const auto& walletEntry : mapWallet)
387  {
388  const CWalletTx& wtx = walletEntry.second;
389 
390  if (wtx.tx->vin.size() > 0)
391  {
392  bool any_mine = false;
393  // group all input addresses with each other
394  for (const CTxIn& txin : wtx.tx->vin)
395  {
396  CTxDestination address;
397  if(!IsMine(txin)) /* If this input isn't mine, ignore it */
398  continue;
399  if(!ExtractDestination(mapWallet.at(txin.prevout.hash).tx->vout[txin.prevout.n].scriptPubKey, address))
400  continue;
401  grouping.insert(address);
402  any_mine = true;
403  }
404 
405  // group change with input addresses
406  if (any_mine)
407  {
408  for (const CTxOut& txout : wtx.tx->vout)
409  if (IsChange(txout))
410  {
411  CTxDestination txoutAddr;
412  if(!ExtractDestination(txout.scriptPubKey, txoutAddr))
413  continue;
414  grouping.insert(txoutAddr);
415  }
416  }
417  if (grouping.size() > 0)
418  {
419  groupings.insert(grouping);
420  grouping.clear();
421  }
422  }
423 
424  // group lone addrs by themselves
425  for (const auto& txout : wtx.tx->vout)
426  if (IsMine(txout))
427  {
428  CTxDestination address;
429  if(!ExtractDestination(txout.scriptPubKey, address))
430  continue;
431  grouping.insert(address);
432  groupings.insert(grouping);
433  grouping.clear();
434  }
435  }
436 
437  std::set< std::set<CTxDestination>* > uniqueGroupings; // a set of pointers to groups of addresses
438  std::map< CTxDestination, std::set<CTxDestination>* > setmap; // map addresses to the unique group containing it
439  for (std::set<CTxDestination> _grouping : groupings)
440  {
441  // make a set of all the groups hit by this new group
442  std::set< std::set<CTxDestination>* > hits;
443  std::map< CTxDestination, std::set<CTxDestination>* >::iterator it;
444  for (const CTxDestination& address : _grouping)
445  if ((it = setmap.find(address)) != setmap.end())
446  hits.insert((*it).second);
447 
448  // merge all hit groups into a new single group and delete old groups
449  std::set<CTxDestination>* merged = new std::set<CTxDestination>(_grouping);
450  for (std::set<CTxDestination>* hit : hits)
451  {
452  merged->insert(hit->begin(), hit->end());
453  uniqueGroupings.erase(hit);
454  delete hit;
455  }
456  uniqueGroupings.insert(merged);
457 
458  // update setmap
459  for (const CTxDestination& element : *merged)
460  setmap[element] = merged;
461  }
462 
463  std::set< std::set<CTxDestination> > ret;
464  for (const std::set<CTxDestination>* uniqueGrouping : uniqueGroupings)
465  {
466  ret.insert(*uniqueGrouping);
467  delete uniqueGrouping;
468  }
469 
470  return ret;
471 }
CWalletTx::GetDebit
CAmount GetDebit(const isminefilter &filter) const
filter decides which addresses will count towards the debit
Definition: receive.cpp:139
CTxIn
An input of a transaction.
Definition: transaction.h:65
CWallet::WalletLogPrintf
void WalletLogPrintf(std::string fmt, Params... parameters) const
Prepends the wallet name in logging output to ease debugging in multi-wallet use cases.
Definition: wallet.h:822
CTransaction::vin
const std::vector< CTxIn > vin
Definition: transaction.h:270
CWallet::GetAddressGroupings
std::set< std::set< CTxDestination > > GetAddressGroupings() const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
Definition: receive.cpp:380
ToString
std::string ToString(const T &t)
Locale-independent version of std::to_string.
Definition: string.h:79
wallet.h
isminefilter
uint8_t isminefilter
Definition: wallet.h:36
ISMINE_ALL
@ ISMINE_ALL
Definition: ismine.h:44
CWalletTx::AVAILABLE_CREDIT
@ AVAILABLE_CREDIT
Definition: transaction.h:128
CWallet::IsWalletFlagSet
bool IsWalletFlagSet(uint64_t flag) const override
check if a certain wallet flag is set
Definition: wallet.cpp:1394
COutPoint::hash
uint256 hash
Definition: transaction.h:29
ISMINE_WATCH_ONLY
@ ISMINE_WATCH_ONLY
Definition: ismine.h:41
CWallet::Balance::m_watchonly_trusted
CAmount m_watchonly_trusted
Definition: wallet.h:545
CWalletTx::IsImmatureCoinBase
bool IsImmatureCoinBase() const
Definition: wallet.cpp:2884
CWallet::GetAddressBalances
std::map< CTxDestination, CAmount > GetAddressBalances() const
Definition: receive.cpp:342
CWallet::GetBalance
Balance GetBalance(int min_depth=0, bool avoid_reuse=true) const
Definition: receive.cpp:313
CWallet::chain
interfaces::Chain & chain() const
Interface for accessing chain state.
Definition: wallet.h:414
CWalletTx::AmountType
AmountType
Definition: transaction.h:128
CWalletTx::GetDepthInMainChain
int GetDepthInMainChain() const NO_THREAD_SAFETY_ANALYSIS
Return depth of transaction in blockchain: <0 : conflicts with a transaction this deep in the blockch...
Definition: wallet.cpp:2866
CachableAmount::m_value
CAmount m_value[ISMINE_ENUM_ELEMENTS]
Definition: ismine.h:58
CWallet::IsSpentKey
bool IsSpentKey(const uint256 &hash, unsigned int n) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
Definition: wallet.cpp:827
MoneyRange
bool MoneyRange(const CAmount &nValue)
Definition: amount.h:26
CWalletTx::m_is_cache_empty
bool m_is_cache_empty
This flag is true if all m_amounts caches are empty.
Definition: transaction.h:137
CWallet::IsChange
bool IsChange(const CTxOut &txout) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
Definition: receive.cpp:86
CWalletTx::nChangeCached
CAmount nChangeCached
Definition: transaction.h:140
CTransaction
The basic transaction that is broadcasted on the network and contained in blocks.
Definition: transaction.h:259
CWallet::Balance
Definition: wallet.h:541
CTxOut::nValue
CAmount nValue
Definition: transaction.h:131
CWalletTx::GetCredit
CAmount GetCredit(const isminefilter &filter) const
Definition: receive.cpp:122
isminetype
isminetype
IsMine() return codes, which depend on ScriptPubKeyMan implementation.
Definition: ismine.h:38
CTxDestination
std::variant< CNoDestination, PKHash, ScriptHash, WitnessV0ScriptHash, WitnessV0KeyHash, WitnessV1Taproot, WitnessUnknown > CTxDestination
A txout script template with a specific destination.
Definition: standard.h:156
CTxOut
An output of a transaction.
Definition: transaction.h:128
CWalletTx::fChangeCached
bool fChangeCached
Definition: transaction.h:138
CTransaction::vout
const std::vector< CTxOut > vout
Definition: transaction.h:271
CTxOut::scriptPubKey
CScript scriptPubKey
Definition: transaction.h:132
CachableAmount::Set
void Set(isminefilter filter, CAmount value)
Definition: ismine.h:63
CWallet::m_spend_zero_conf_change
bool m_spend_zero_conf_change
Allow Coin Selection to pick unconfirmed UTXOs that were sent from our own wallet if it cannot fund t...
Definition: wallet.h:620
CWalletTx::tx
CTransactionRef tx
Definition: transaction.h:164
WALLET_FLAG_AVOID_REUSE
@ WALLET_FLAG_AVOID_REUSE
Definition: walletutil.h:41
consensus.h
CWalletTx::GetAmounts
void GetAmounts(std::list< COutputEntry > &listReceived, std::list< COutputEntry > &listSent, CAmount &nFee, const isminefilter &filter) const
Definition: receive.cpp:218
CWalletTx::pwallet
const CWallet *const pwallet
Definition: transaction.h:71
COutputEntry
Definition: receive.h:13
CAmount
int64_t CAmount
Amount in satoshis (Can be negative)
Definition: amount.h:12
CWallet::IsTrusted
bool IsTrusted(const CWalletTx &wtx, std::set< uint256 > &trusted_parents) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
Definition: receive.cpp:274
AssertLockHeld
#define AssertLockHeld(cs)
Definition: sync.h:81
uint256
256-bit opaque blob.
Definition: uint256.h:124
ISMINE_NO
@ ISMINE_NO
Definition: ismine.h:40
CScript
Serialized script, used inside transaction inputs and outputs.
Definition: script.h:404
ExtractDestination
bool ExtractDestination(const CScript &scriptPubKey, CTxDestination &addressRet)
Parse a standard scriptPubKey for the destination address.
Definition: standard.cpp:213
CWalletTx::GetCachableAmount
CAmount GetCachableAmount(AmountType type, const isminefilter &filter, bool recalculate=false) const
Definition: receive.cpp:112
CWallet::Balance::m_mine_untrusted_pending
CAmount m_mine_untrusted_pending
Untrusted, but in mempool (pending)
Definition: wallet.h:543
CWallet::GetDebit
CAmount GetDebit(const CTxIn &txin, const isminefilter &filter) const
Returns amount of debit if the input matches the filter, otherwise returns 0.
Definition: wallet.cpp:1280
CNoDestination
Definition: standard.h:72
CWallet::IsAllFromMe
bool IsAllFromMe(const CTransaction &tx, const isminefilter &filter) const
Returns whether all of the inputs match the filter.
Definition: receive.cpp:23
ISMINE_SPENDABLE
@ ISMINE_SPENDABLE
Definition: ismine.h:42
transaction.h
CWallet::GetChange
CAmount GetChange(const CTxOut &txout) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
Definition: receive.cpp:91
CWallet::Balance::m_watchonly_immature
CAmount m_watchonly_immature
Definition: wallet.h:547
CWalletTx::IsInMainChain
bool IsInMainChain() const
Definition: transaction.h:325
CWalletTx::CREDIT
@ CREDIT
Definition: transaction.h:128
CWallet::Balance::m_mine_immature
CAmount m_mine_immature
Immature coinbases in the main chain.
Definition: wallet.h:544
CWallet::IsSpent
bool IsSpent(const uint256 &hash, unsigned int n) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
Outpoint is spent if any non-conflicted transaction spends it:
Definition: wallet.cpp:550
CWalletTx::GetChange
CAmount GetChange() const
Definition: receive.cpp:154
COutPoint::n
uint32_t n
Definition: transaction.h:30
LOCK
#define LOCK(cs)
Definition: sync.h:232
CWalletTx::GetHash
const uint256 & GetHash() const
Definition: transaction.h:347
CWalletTx
A transaction with a bunch of additional info that only the owner cares about.
Definition: transaction.h:68
CWallet::IsMine
isminetype IsMine(const CTxDestination &dest) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
Definition: wallet.cpp:1302
CTxIn::prevout
COutPoint prevout
Definition: transaction.h:68
ISMINE_USED
@ ISMINE_USED
Definition: ismine.h:43
CWallet::Balance::m_mine_trusted
CAmount m_mine_trusted
Trusted, at depth=GetBalance.min_depth or more.
Definition: wallet.h:542
CWallet::GetWalletTx
const CWalletTx * GetWalletTx(const uint256 &hash) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
Definition: wallet.cpp:352
CWallet::cs_wallet
RecursiveMutex cs_wallet
Main wallet lock.
Definition: wallet.h:343
CWalletTx::GetImmatureWatchOnlyCredit
CAmount GetImmatureWatchOnlyCredit(const bool fUseCache=true) const
Definition: receive.cpp:172
CWalletTx::IsTrusted
bool IsTrusted() const
Definition: receive.cpp:306
receive.h
CWalletTx::IMMATURE_CREDIT
@ IMMATURE_CREDIT
Definition: transaction.h:128
CWalletTx::DEBIT
@ DEBIT
Definition: transaction.h:128
CScript::IsUnspendable
bool IsUnspendable() const
Returns whether the script is guaranteed to fail at execution, regardless of the initial stack.
Definition: script.h:543
CWalletTx::m_amounts
CachableAmount m_amounts[AMOUNTTYPE_ENUM_ELEMENTS]
Definition: transaction.h:130
CWalletTx::GetAvailableCredit
CAmount GetAvailableCredit(bool fUseCache=true, const isminefilter &filter=ISMINE_SPENDABLE) const NO_THREAD_SAFETY_ANALYSIS
Definition: receive.cpp:181
CWallet::FindAddressBookEntry
const CAddressBookData * FindAddressBookEntry(const CTxDestination &, bool allow_change=false) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
Definition: wallet.cpp:2791
CWalletTx::GetImmatureCredit
CAmount GetImmatureCredit(bool fUseCache=true) const
Definition: receive.cpp:163
CWallet::GetCredit
CAmount GetCredit(const CTxOut &txout, const isminefilter &filter) const
Definition: receive.cpp:44
CWalletTx::InMempool
bool InMempool() const
Definition: transaction.cpp:16
it
auto it
Definition: validation.cpp:355
CWallet::Balance::m_watchonly_untrusted_pending
CAmount m_watchonly_untrusted_pending
Definition: wallet.h:546
CWalletTx::IsFromMe
bool IsFromMe(const isminefilter &filter) const
Definition: transaction.h:288