Bitcoin ABC 0.30.5
P2P Digital Currency
receive.h
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#ifndef BITCOIN_WALLET_RECEIVE_H
6#define BITCOIN_WALLET_RECEIVE_H
7
8#include <consensus/amount.h>
9#include <wallet/ismine.h>
10#include <wallet/transaction.h>
11#include <wallet/wallet.h>
12
13isminetype InputIsMine(const CWallet &wallet, const CTxIn &txin)
15
17bool AllInputsMine(const CWallet &wallet, const CTransaction &tx,
18 const isminefilter &filter);
19
20Amount OutputGetCredit(const CWallet &wallet, const CTxOut &txout,
21 const isminefilter &filter);
22Amount TxGetCredit(const CWallet &wallet, const CTransaction &tx,
23 const isminefilter &filter);
24
25bool ScriptIsChange(const CWallet &wallet, const CScript &script)
27bool OutputIsChange(const CWallet &wallet, const CTxOut &txout)
29Amount OutputGetChange(const CWallet &wallet, const CTxOut &txout)
31Amount TxGetChange(const CWallet &wallet, const CTransaction &tx);
32
34 const isminefilter &filter)
38 const isminefilter &filter);
41 bool fUseCache = true)
44 const CWalletTx &wtx,
45 const bool fUseCache = true)
48 bool fUseCache = true,
49 const isminefilter &filter = ISMINE_SPENDABLE)
51;
52
56 int vout;
57};
58void CachedTxGetAmounts(const CWallet &wallet, const CWalletTx &wtx,
59 std::list<COutputEntry> &listReceived,
60 std::list<COutputEntry> &listSent, Amount &nFee,
61 const isminefilter &filter);
62bool CachedTxIsFromMe(const CWallet &wallet, const CWalletTx &wtx,
63 const isminefilter &filter);
64bool CachedTxIsTrusted(const CWallet &wallet, const CWalletTx &wtx,
65 std::set<TxId> &trusted_parents)
67bool CachedTxIsTrusted(const CWallet &wallet, const CWalletTx &wtx);
68
69struct Balance {
79};
80
81Balance GetBalance(const CWallet &wallet, int min_depth = 0,
82 bool avoid_reuse = true);
83
84std::map<CTxDestination, Amount> GetAddressBalances(const CWallet &wallet);
85std::set<std::set<CTxDestination>> GetAddressGroupings(const CWallet &wallet)
87
88#endif // BITCOIN_WALLET_RECEIVE_H
An output of a transaction.
Definition: transaction.h:128
A CWallet maintains a set of transactions and balances, and provides the ability to create new transa...
Definition: wallet.h:254
A transaction with a bunch of additional info that only the owner cares about.
Definition: transaction.h:65
uint8_t isminefilter
Definition: wallet.h:42
isminetype
IsMine() return codes.
Definition: ismine.h:18
@ ISMINE_SPENDABLE
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
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
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
std::map< CTxDestination, Amount > GetAddressBalances(const CWallet &wallet)
Definition: receive.cpp:413
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
std::set< std::set< CTxDestination > > GetAddressGroupings(const CWallet &wallet) EXCLUSIVE_LOCKS_REQUIRED(wallet.cs_wallet)
Definition: receive.cpp:453
std::variant< CNoDestination, PKHash, ScriptHash > CTxDestination
A txout script template with a specific destination.
Definition: standard.h:85
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
#define EXCLUSIVE_LOCKS_REQUIRED(...)
Definition: threadsafety.h:56