Bitcoin Core  0.18.99
P2P Digital Currency
Classes | Typedefs | Enumerations | Functions | Variables
wallet.h File Reference
#include <amount.h>
#include <interfaces/chain.h>
#include <interfaces/handler.h>
#include <outputtype.h>
#include <policy/feerate.h>
#include <script/ismine.h>
#include <script/sign.h>
#include <streams.h>
#include <tinyformat.h>
#include <ui_interface.h>
#include <util/strencodings.h>
#include <util/system.h>
#include <validationinterface.h>
#include <wallet/coinselection.h>
#include <wallet/crypter.h>
#include <wallet/walletdb.h>
#include <wallet/walletutil.h>
#include <algorithm>
#include <atomic>
#include <map>
#include <memory>
#include <set>
#include <stdexcept>
#include <stdint.h>
#include <string>
#include <utility>
#include <vector>
Include dependency graph for wallet.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  CKeyPool
 A key from a CWallet's keypool. More...
 
class  CReserveKey
 A wrapper to reserve a key from a wallet keypool. More...
 
class  CAddressBookData
 Address book data. More...
 
struct  CRecipient
 
struct  COutputEntry
 
class  CMerkleTx
 A transaction with a merkle branch linking it to the block chain. More...
 
class  CWalletTx
 A transaction with a bunch of additional info that only the owner cares about. More...
 
class  COutput
 
class  CWalletKey
 Private key that includes an expiration date in case it never gets used. More...
 
struct  CoinSelectionParams
 
class  CWallet
 A CWallet is an extension of a keystore, which also maintains a set of transactions and balances, and provides the ability to create new transactions. More...
 
struct  CWallet::ScanResult
 
struct  CWallet::Balance
 
class  WalletRescanReserver
 RAII object to check and reserve a wallet rescan. More...
 

Typedefs

typedef std::map< std::string, std::string > mapValue_t
 

Enumerations

enum  WalletFeature {
  FEATURE_BASE = 10500, FEATURE_WALLETCRYPT = 40000, FEATURE_COMPRPUBKEY = 60000, FEATURE_HD = 130000,
  FEATURE_HD_SPLIT = 139900, FEATURE_NO_DEFAULT_KEY = 159900, FEATURE_PRE_SPLIT_KEYPOOL = 169900, FEATURE_LATEST = FEATURE_PRE_SPLIT_KEYPOOL
}
 (client) version numbers for particular wallet features More...
 
enum  WalletFlags : uint64_t { WALLET_FLAG_KEY_ORIGIN_METADATA = (1ULL << 1), WALLET_FLAG_DISABLE_PRIVATE_KEYS = (1ULL << 32), WALLET_FLAG_BLANK_WALLET = (1ULL << 33) }
 

Functions

void UnloadWallet (std::shared_ptr< CWallet > &&wallet)
 Explicitly unload and delete the wallet. More...
 
bool AddWallet (const std::shared_ptr< CWallet > &wallet)
 
bool RemoveWallet (const std::shared_ptr< CWallet > &wallet)
 
bool HasWallets ()
 
std::vector< std::shared_ptr< CWallet > > GetWallets ()
 
std::shared_ptr< CWalletGetWallet (const std::string &name)
 
std::shared_ptr< CWalletLoadWallet (interfaces::Chain &chain, const WalletLocation &location, std::string &error, std::string &warning)
 
int CalculateMaximumSignedInputSize (const CTxOut &txout, const CWallet *pwallet, bool use_max_sig=false)
 
void MaybeResendWalletTxs ()
 Called periodically by the schedule thread. More...
 
int64_t CalculateMaximumSignedTxSize (const CTransaction &tx, const CWallet *wallet, bool use_max_sig=false) EXCLUSIVE_LOCKS_REQUIRED(wallet -> cs_wallet)
 
int64_t CalculateMaximumSignedTxSize (const CTransaction &tx, const CWallet *wallet, const std::vector< CTxOut > &txouts, bool use_max_sig=false)
 

Variables

constexpr CAmount DEFAULT_PAY_TX_FEE = 0
 -paytxfee default More...
 
constexpr CAmount DEFAULT_TRANSACTION_MAXFEE {COIN / 10}
 -maxtxfee default More...
 
constexpr CAmount HIGH_TX_FEE_PER_KB {COIN / 100}
 Discourage users to set fees higher than this amount (in satoshis) per kB. More...
 
constexpr CAmount HIGH_MAX_TX_FEE {100 * HIGH_TX_FEE_PER_KB}
 -maxtxfee will warn if called with a higher fee than this amount (in satoshis) More...
 
constexpr OutputType DEFAULT_ADDRESS_TYPE {OutputType::P2SH_SEGWIT}
 Default for -addresstype. More...
 
constexpr OutputType DEFAULT_CHANGE_TYPE {OutputType::CHANGE_AUTO}
 Default for -changetype. More...
 

Typedef Documentation

◆ mapValue_t

typedef std::map<std::string, std::string> mapValue_t

Definition at line 308 of file wallet.h.

Enumeration Type Documentation

◆ WalletFeature

(client) version numbers for particular wallet features

Enumerator
FEATURE_BASE 
FEATURE_WALLETCRYPT 
FEATURE_COMPRPUBKEY 
FEATURE_HD 
FEATURE_HD_SPLIT 
FEATURE_NO_DEFAULT_KEY 
FEATURE_PRE_SPLIT_KEYPOOL 
FEATURE_LATEST 

Definition at line 95 of file wallet.h.

◆ WalletFlags

enum WalletFlags : uint64_t
Enumerator
WALLET_FLAG_KEY_ORIGIN_METADATA 
WALLET_FLAG_DISABLE_PRIVATE_KEYS 
WALLET_FLAG_BLANK_WALLET 

Flag set when a wallet contains no HD seed and no private keys, scripts, addresses, and other watch only things, and is therefore "blank.".

The only function this flag serves is to distinguish a blank wallet from a newly created wallet when the wallet database is loaded, to avoid initialization that should only happen on first run.

This flag is also a mandatory flag to prevent previous versions of bitcoin from opening the wallet, thinking it was newly created, and then improperly reinitializing it.

Definition at line 119 of file wallet.h.

Function Documentation

◆ AddWallet()

bool AddWallet ( const std::shared_ptr< CWallet > &  wallet)

Definition at line 49 of file wallet.cpp.

Here is the caller graph for this function:

◆ GetWallet()

std::shared_ptr<CWallet> GetWallet ( const std::string &  name)

Definition at line 81 of file wallet.cpp.

Here is the caller graph for this function:

◆ GetWallets()

std::vector<std::shared_ptr<CWallet> > GetWallets ( )

Definition at line 67 of file dummywallet.cpp.

Here is the caller graph for this function:

◆ HasWallets()

bool HasWallets ( )

Definition at line 69 of file wallet.cpp.

Here is the caller graph for this function:

◆ LoadWallet()

std::shared_ptr<CWallet> LoadWallet ( interfaces::Chain chain,
const WalletLocation location,
std::string &  error,
std::string &  warning 
)

Definition at line 138 of file wallet.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MaybeResendWalletTxs()

void MaybeResendWalletTxs ( )

Called periodically by the schedule thread.

Prompts individual wallets to resend their transactions. Actual rebroadcast schedule is managed by the wallets themselves.

Definition at line 2123 of file wallet.cpp.

Here is the call graph for this function:

◆ RemoveWallet()

bool RemoveWallet ( const std::shared_ptr< CWallet > &  wallet)

Definition at line 59 of file wallet.cpp.

Here is the caller graph for this function:

◆ UnloadWallet()

void UnloadWallet ( std::shared_ptr< CWallet > &&  wallet)

Explicitly unload and delete the wallet.

Blocks the current thread after signaling the unload intent so that all wallet clients release the wallet. Note that, when blocking is not required, the wallet is implicitly unloaded by the shared pointer deleter.

Definition at line 115 of file wallet.cpp.

Here is the caller graph for this function:

Variable Documentation

◆ DEFAULT_ADDRESS_TYPE

constexpr OutputType DEFAULT_ADDRESS_TYPE {OutputType::P2SH_SEGWIT}

Default for -addresstype.

Definition at line 114 of file wallet.h.

◆ DEFAULT_CHANGE_TYPE

constexpr OutputType DEFAULT_CHANGE_TYPE {OutputType::CHANGE_AUTO}

Default for -changetype.

Definition at line 117 of file wallet.h.

◆ DEFAULT_PAY_TX_FEE

constexpr CAmount DEFAULT_PAY_TX_FEE = 0

-paytxfee default

Definition at line 55 of file wallet.h.

◆ DEFAULT_TRANSACTION_MAXFEE

constexpr CAmount DEFAULT_TRANSACTION_MAXFEE {COIN / 10}

-maxtxfee default

Definition at line 77 of file wallet.h.

◆ HIGH_MAX_TX_FEE

constexpr CAmount HIGH_MAX_TX_FEE {100 * HIGH_TX_FEE_PER_KB}

-maxtxfee will warn if called with a higher fee than this amount (in satoshis)

Definition at line 81 of file wallet.h.

◆ HIGH_TX_FEE_PER_KB

constexpr CAmount HIGH_TX_FEE_PER_KB {COIN / 100}

Discourage users to set fees higher than this amount (in satoshis) per kB.

Definition at line 79 of file wallet.h.