Bitcoin Core  0.19.99
P2P Digital Currency
Functions | Variables
wallet.cpp File Reference
#include <wallet/wallet.h>
#include <chain.h>
#include <consensus/consensus.h>
#include <consensus/validation.h>
#include <fs.h>
#include <interfaces/chain.h>
#include <interfaces/wallet.h>
#include <key.h>
#include <key_io.h>
#include <optional.h>
#include <policy/fees.h>
#include <policy/policy.h>
#include <primitives/block.h>
#include <primitives/transaction.h>
#include <script/descriptor.h>
#include <script/script.h>
#include <script/signingprovider.h>
#include <util/bip32.h>
#include <util/error.h>
#include <util/fees.h>
#include <util/moneystr.h>
#include <util/rbf.h>
#include <util/translation.h>
#include <wallet/coincontrol.h>
#include <wallet/fees.h>
#include <algorithm>
#include <assert.h>
#include <boost/algorithm/string/replace.hpp>
Include dependency graph for wallet.cpp:

Go to the source code of this file.

Functions

static std::vector< std::shared_ptr< CWallet > > vpwallets GUARDED_BY (cs_wallets)
 
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::unique_ptr< interfaces::HandlerHandleLoadWallet (LoadWalletFn load_wallet)
 
static void ReleaseWallet (CWallet *wallet)
 
void UnloadWallet (std::shared_ptr< CWallet > &&wallet)
 Explicitly unload and delete the wallet. More...
 
std::shared_ptr< CWalletLoadWallet (interfaces::Chain &chain, const WalletLocation &location, std::string &error, std::vector< std::string > &warnings)
 
std::shared_ptr< CWalletLoadWallet (interfaces::Chain &chain, const std::string &name, std::string &error, std::vector< std::string > &warnings)
 
WalletCreationStatus CreateWallet (interfaces::Chain &chain, const SecureString &passphrase, uint64_t wallet_creation_flags, const std::string &name, std::string &error, std::vector< std::string > &warnings, std::shared_ptr< CWallet > &result)
 
int64_t CalculateMaximumSignedTxSize (const CTransaction &tx, const CWallet *wallet, bool use_max_sig)
 
int64_t CalculateMaximumSignedTxSize (const CTransaction &tx, const CWallet *wallet, const std::vector< CTxOut > &txouts, bool use_max_sig)
 
int CalculateMaximumSignedInputSize (const CTxOut &txout, const CWallet *wallet, bool use_max_sig)
 
void MaybeResendWalletTxs ()
 Called periodically by the schedule thread. More...
 
static bool IsCurrentForAntiFeeSniping (interfaces::Chain &chain, interfaces::Chain::Lock &locked_chain)
 
static uint32_t GetLocktimeForNewTransaction (interfaces::Chain &chain, interfaces::Chain::Lock &locked_chain)
 Return a height-based locktime for new transactions (uses the height of the current chain tip unless we are not synced with the current chain. More...
 

Variables

const std::map< uint64_t, std::string > WALLET_FLAG_CAVEATS
 
static const size_t OUTPUT_GROUP_MAX_ENTRIES = 10
 
static RecursiveMutex cs_wallets
 
static Mutex g_wallet_release_mutex
 
static std::condition_variable g_wallet_release_cv
 
static std::set< std::string > g_unloading_wallet_set
 

Function Documentation

◆ AddWallet()

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

Definition at line 52 of file wallet.cpp.

Here is the caller graph for this function:

◆ CreateWallet()

WalletCreationStatus CreateWallet ( interfaces::Chain chain,
const SecureString passphrase,
uint64_t  wallet_creation_flags,
const std::string &  name,
std::string &  error,
std::vector< std::string > &  warnings,
std::shared_ptr< CWallet > &  result 
)

Definition at line 176 of file wallet.cpp.

Here is the call graph for this function:

◆ GetWallet()

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

Definition at line 87 of file wallet.cpp.

Here is the caller graph for this function:

◆ GetWallets()

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

Definition at line 81 of file wallet.cpp.

Here is the caller graph for this function:

◆ GUARDED_BY()

static std::list< LoadWalletFn > g_load_wallet_fns GUARDED_BY ( cs_wallets  )
static

◆ HandleLoadWallet()

std::unique_ptr<interfaces::Handler> HandleLoadWallet ( LoadWalletFn  load_wallet)

Definition at line 96 of file wallet.cpp.

Here is the call graph for this function:

◆ HasWallets()

bool HasWallets ( )

Definition at line 75 of file wallet.cpp.

Here is the caller graph for this function:

◆ LoadWallet() [1/2]

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

Definition at line 149 of file wallet.cpp.

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

◆ LoadWallet() [2/2]

std::shared_ptr<CWallet> LoadWallet ( interfaces::Chain chain,
const std::string &  name,
std::string &  error,
std::vector< std::string > &  warnings 
)

Definition at line 171 of file wallet.cpp.

Here is the call 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 2018 of file wallet.cpp.

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

◆ ReleaseWallet()

static void ReleaseWallet ( CWallet wallet)
static

Definition at line 108 of file wallet.cpp.

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

◆ RemoveWallet()

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

Definition at line 63 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 125 of file wallet.cpp.

Here is the caller graph for this function:

Variable Documentation

◆ cs_wallets

RecursiveMutex cs_wallets
static

Definition at line 48 of file wallet.cpp.

◆ g_unloading_wallet_set

std::set<std::string> g_unloading_wallet_set
static

Definition at line 105 of file wallet.cpp.

◆ g_wallet_release_cv

std::condition_variable g_wallet_release_cv
static

Definition at line 104 of file wallet.cpp.

◆ g_wallet_release_mutex

Mutex g_wallet_release_mutex
static

Definition at line 103 of file wallet.cpp.

◆ OUTPUT_GROUP_MAX_ENTRIES

const size_t OUTPUT_GROUP_MAX_ENTRIES = 10
static

Definition at line 46 of file wallet.cpp.

◆ WALLET_FLAG_CAVEATS

const std::map<uint64_t,std::string> WALLET_FLAG_CAVEATS
Initial value:
{
"You need to rescan the blockchain in order to correctly mark used "
"destinations in the past. Until this is done, some destinations may "
"be considered unused, even if the opposite is the case."
},
}

Definition at line 38 of file wallet.cpp.