Bitcoin Core 29.99.0
P2P Digital Currency
receive.h
Go to the documentation of this file.
1// Copyright (c) 2021-2022 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>
10#include <wallet/transaction.h>
11#include <wallet/wallet.h>
12
13namespace wallet {
14bool InputIsMine(const CWallet& wallet, const CTxIn& txin) EXCLUSIVE_LOCKS_REQUIRED(wallet.cs_wallet);
15
17bool AllInputsMine(const CWallet& wallet, const CTransaction& tx);
18
19CAmount OutputGetCredit(const CWallet& wallet, const CTxOut& txout);
20CAmount TxGetCredit(const CWallet& wallet, const CTransaction& tx);
21
22bool ScriptIsChange(const CWallet& wallet, const CScript& script) EXCLUSIVE_LOCKS_REQUIRED(wallet.cs_wallet);
23bool OutputIsChange(const CWallet& wallet, const CTxOut& txout) EXCLUSIVE_LOCKS_REQUIRED(wallet.cs_wallet);
24CAmount OutputGetChange(const CWallet& wallet, const CTxOut& txout) EXCLUSIVE_LOCKS_REQUIRED(wallet.cs_wallet);
25CAmount TxGetChange(const CWallet& wallet, const CTransaction& tx);
26
27CAmount CachedTxGetCredit(const CWallet& wallet, const CWalletTx& wtx, bool avoid_reuse)
29CAmount CachedTxGetDebit(const CWallet& wallet, const CWalletTx& wtx, bool avoid_reuse);
30CAmount CachedTxGetChange(const CWallet& wallet, const CWalletTx& wtx);
32{
35 int vout;
36};
37void CachedTxGetAmounts(const CWallet& wallet, const CWalletTx& wtx,
38 std::list<COutputEntry>& listReceived,
39 std::list<COutputEntry>& listSent,
40 CAmount& nFee,
41 bool include_change);
42bool CachedTxIsFromMe(const CWallet& wallet, const CWalletTx& wtx);
43bool CachedTxIsTrusted(const CWallet& wallet, const CWalletTx& wtx, std::set<Txid>& trusted_parents) EXCLUSIVE_LOCKS_REQUIRED(wallet.cs_wallet);
44bool CachedTxIsTrusted(const CWallet& wallet, const CWalletTx& wtx);
45
46struct Balance {
50};
51Balance GetBalance(const CWallet& wallet, int min_depth = 0, bool avoid_reuse = true);
52
53std::map<CTxDestination, CAmount> GetAddressBalances(const CWallet& wallet);
54std::set<std::set<CTxDestination>> GetAddressGroupings(const CWallet& wallet) EXCLUSIVE_LOCKS_REQUIRED(wallet.cs_wallet);
55} // namespace wallet
56
57#endif // BITCOIN_WALLET_RECEIVE_H
std::variant< CNoDestination, PubKeyDestination, PKHash, ScriptHash, WitnessV0ScriptHash, WitnessV0KeyHash, WitnessV1Taproot, PayToAnchor, WitnessUnknown > CTxDestination
A txout script categorized into standard templates.
Definition: addresstype.h:143
int64_t CAmount
Amount in satoshis (Can be negative)
Definition: amount.h:12
Serialized script, used inside transaction inputs and outputs.
Definition: script.h:413
The basic transaction that is broadcasted on the network and contained in blocks.
Definition: transaction.h:296
An input of a transaction.
Definition: transaction.h:67
An output of a transaction.
Definition: transaction.h:150
A CWallet maintains a set of transactions and balances, and provides the ability to create new transa...
Definition: wallet.h:311
A transaction with a bunch of additional info that only the owner cares about.
Definition: transaction.h:195
bool OutputIsChange(const CWallet &wallet, const CTxOut &txout)
Definition: receive.cpp:74
Balance GetBalance(const CWallet &wallet, const int min_depth, bool avoid_reuse)
Definition: receive.cpp:242
bool AllInputsMine(const CWallet &wallet, const CTransaction &tx)
Returns whether all of the inputs belong to the wallet.
Definition: receive.cpp:23
bool CachedTxIsFromMe(const CWallet &wallet, const CWalletTx &wtx)
Definition: receive.cpp:196
CAmount TxGetChange(const CWallet &wallet, const CTransaction &tx)
Definition: receive.cpp:87
bool CachedTxIsTrusted(const CWallet &wallet, const CWalletTx &wtx, std::set< Txid > &trusted_parents)
Definition: receive.cpp:202
bool ScriptIsChange(const CWallet &wallet, const CScript &script)
Definition: receive.cpp:52
CAmount TxGetCredit(const CWallet &wallet, const CTransaction &tx)
Definition: receive.cpp:40
CAmount OutputGetChange(const CWallet &wallet, const CTxOut &txout)
Definition: receive.cpp:79
CAmount CachedTxGetDebit(const CWallet &wallet, const CWalletTx &wtx, bool avoid_reuse)
Definition: receive.cpp:122
CAmount CachedTxGetChange(const CWallet &wallet, const CWalletTx &wtx)
Definition: receive.cpp:130
CAmount CachedTxGetCredit(const CWallet &wallet, const CWalletTx &wtx, bool avoid_reuse)
Definition: receive.cpp:110
void CachedTxGetAmounts(const CWallet &wallet, const CWalletTx &wtx, std::list< COutputEntry > &listReceived, std::list< COutputEntry > &listSent, CAmount &nFee, bool include_change)
Definition: receive.cpp:139
std::map< CTxDestination, CAmount > GetAddressBalances(const CWallet &wallet)
Definition: receive.cpp:273
bool InputIsMine(const CWallet &wallet, const CTxIn &txin)
Definition: receive.cpp:13
CAmount OutputGetCredit(const CWallet &wallet, const CTxOut &txout)
Definition: receive.cpp:32
std::set< std::set< CTxDestination > > GetAddressGroupings(const CWallet &wallet)
Definition: receive.cpp:301
CAmount m_mine_immature
Immature coinbases in the main chain.
Definition: receive.h:49
CAmount m_mine_untrusted_pending
Untrusted, but in mempool (pending)
Definition: receive.h:48
CAmount m_mine_trusted
Trusted, at depth=GetBalance.min_depth or more.
Definition: receive.h:47
Definition: receive.h:32
CAmount amount
Definition: receive.h:34
CTxDestination destination
Definition: receive.h:33
int vout
Definition: receive.h:35
#define EXCLUSIVE_LOCKS_REQUIRED(...)
Definition: threadsafety.h:51