Bitcoin ABC  0.26.3
P2P Digital Currency
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
8 #include <consensus/amount.h>
9 #include <wallet/ismine.h>
10 #include <wallet/transaction.h>
11 #include <wallet/wallet.h>
13 isminetype InputIsMine(const CWallet &wallet, const CTxIn &txin)
17 bool AllInputsMine(const CWallet &wallet, const CTransaction &tx,
18  const isminefilter &filter);
20 Amount OutputGetCredit(const CWallet &wallet, const CTxOut &txout,
21  const isminefilter &filter);
22 Amount TxGetCredit(const CWallet &wallet, const CTransaction &tx,
23  const isminefilter &filter);
25 bool ScriptIsChange(const CWallet &wallet, const CScript &script)
27 bool OutputIsChange(const CWallet &wallet, const CTxOut &txout)
29 Amount OutputGetChange(const CWallet &wallet, const CTxOut &txout)
31 Amount TxGetChange(const CWallet &wallet, const CTransaction &tx);
34  const isminefilter &filter)
38  const isminefilter &filter);
39 Amount CachedTxGetChange(const CWallet &wallet, const CWalletTx &wtx);
41  bool fUseCache = true)
44  const CWalletTx &wtx,
45  const bool fUseCache = true)
48  bool fUseCache = true,
49  const isminefilter &filter = ISMINE_SPENDABLE)
51 ;
53 struct COutputEntry {
56  int vout;
57 };
58 void CachedTxGetAmounts(const CWallet &wallet, const CWalletTx &wtx,
59  std::list<COutputEntry> &listReceived,
60  std::list<COutputEntry> &listSent, Amount &nFee,
61  const isminefilter &filter);
62 bool CachedTxIsFromMe(const CWallet &wallet, const CWalletTx &wtx,
63  const isminefilter &filter);
64 bool CachedTxIsTrusted(const CWallet &wallet, const CWalletTx &wtx,
65  std::set<TxId> &trusted_parents)
67 bool CachedTxIsTrusted(const CWallet &wallet, const CWalletTx &wtx);
69 struct Balance {
79 };
81 Balance GetBalance(const CWallet &wallet, int min_depth = 0,
82  bool avoid_reuse = true);
84 std::map<CTxDestination, Amount> GetAddressBalances(const CWallet &wallet);
85 std::set<std::set<CTxDestination>> GetAddressGroupings(const CWallet &wallet)
Serialized script, used inside transaction inputs and outputs.
Definition: script.h:431
The basic transaction that is broadcasted on the network and contained in blocks.
Definition: transaction.h:194
An input of a transaction.
Definition: transaction.h:61
An output of a transaction.
Definition: transaction.h:130
A CWallet maintains a set of transactions and balances, and provides the ability to create new transa...
Definition: wallet.h:251
A transaction with a bunch of additional info that only the owner cares about.
Definition: transaction.h:65
uint8_t isminefilter
Definition: wallet.h:41
IsMine() return codes.
Definition: ismine.h:18
Definition: ismine.h:21
bool OutputIsChange(const CWallet &wallet, const CTxOut &txout) EXCLUSIVE_LOCKS_REQUIRED(wallet.cs_wallet)
Definition: receive.cpp:98
bool CachedTxIsFromMe(const CWallet &wallet, const CWalletTx &wtx, const isminefilter &filter)
Definition: receive.cpp:321
Amount CachedTxGetImmatureWatchOnlyCredit(const CWallet &wallet, const CWalletTx &wtx, const bool fUseCache=true) EXCLUSIVE_LOCKS_REQUIRED(wallet.cs_wallet)
Definition: receive.cpp:204
std::set< std::set< CTxDestination > > GetAddressGroupings(const CWallet &wallet) EXCLUSIVE_LOCKS_REQUIRED(wallet.cs_wallet)
Definition: receive.cpp:453
Amount CachedTxGetChange(const CWallet &wallet, const CWalletTx &wtx)
Definition: receive.cpp:183
Balance GetBalance(const CWallet &wallet, int min_depth=0, bool avoid_reuse=true)
Definition: receive.cpp:384
Amount CachedTxGetDebit(const CWallet &wallet, const CWalletTx &wtx, const isminefilter &filter)
filter decides which addresses will count towards the debit
Definition: receive.cpp:164
Amount TxGetCredit(const CWallet &wallet, const CTransaction &tx, const isminefilter &filter)
Definition: receive.cpp:61
bool CachedTxIsTrusted(const CWallet &wallet, const CWalletTx &wtx, std::set< TxId > &trusted_parents) EXCLUSIVE_LOCKS_REQUIRED(wallet.cs_wallet)
Definition: receive.cpp:326
Amount CachedTxGetCredit(const CWallet &wallet, const CWalletTx &wtx, const isminefilter &filter) EXCLUSIVE_LOCKS_REQUIRED(wallet.cs_wallet)
Definition: receive.cpp:139
isminetype InputIsMine(const CWallet &wallet, const CTxIn &txin) EXCLUSIVE_LOCKS_REQUIRED(wallet.cs_wallet)
Definition: receive.cpp:11
bool ScriptIsChange(const CWallet &wallet, const CScript &script) EXCLUSIVE_LOCKS_REQUIRED(wallet.cs_wallet)
Definition: receive.cpp:75
Amount CachedTxGetAvailableCredit(const CWallet &wallet, const CWalletTx &wtx, bool fUseCache=true, const isminefilter &filter=ISMINE_SPENDABLE) EXCLUSIVE_LOCKS_REQUIRED(wallet.cs_wallet)
Definition: receive.cpp:217
std::map< CTxDestination, Amount > GetAddressBalances(const CWallet &wallet)
Definition: receive.cpp:413
void CachedTxGetAmounts(const CWallet &wallet, const CWalletTx &wtx, std::list< COutputEntry > &listReceived, std::list< COutputEntry > &listSent, Amount &nFee, const isminefilter &filter)
Definition: receive.cpp:262
Amount OutputGetChange(const CWallet &wallet, const CTxOut &txout) EXCLUSIVE_LOCKS_REQUIRED(wallet.cs_wallet)
Definition: receive.cpp:102
Amount OutputGetCredit(const CWallet &wallet, const CTxOut &txout, const isminefilter &filter)
Definition: receive.cpp:51
Amount TxGetChange(const CWallet &wallet, const CTransaction &tx)
Definition: receive.cpp:111
Amount CachedTxGetImmatureCredit(const CWallet &wallet, const CWalletTx &wtx, bool fUseCache=true) EXCLUSIVE_LOCKS_REQUIRED(wallet.cs_wallet)
Definition: receive.cpp:192
bool AllInputsMine(const CWallet &wallet, const CTransaction &tx, const isminefilter &filter)
Returns whether all of the inputs match the filter.
Definition: receive.cpp:25
boost::variant< CNoDestination, PKHash, ScriptHash > CTxDestination
A txout script template with a specific destination.
Definition: standard.h:93
Definition: amount.h:19
static constexpr Amount zero() noexcept
Definition: amount.h:32
Amount m_mine_immature
Immature coinbases in the main chain.
Definition: receive.h:75
Amount m_watchonly_trusted
Definition: receive.h:76
Amount m_mine_untrusted_pending
Untrusted, but in mempool (pending)
Definition: receive.h:73
Amount m_watchonly_immature
Definition: receive.h:78
Amount m_watchonly_untrusted_pending
Definition: receive.h:77
Amount m_mine_trusted
Trusted, at depth=GetBalance.min_depth or more.
Definition: receive.h:71
Definition: receive.h:53
Amount amount
Definition: receive.h:55
int vout
Definition: receive.h:56
CTxDestination destination
Definition: receive.h:54
Definition: threadsafety.h:56