Bitcoin ABC 0.34.2
P2P Digital Currency
Functions | Variables
wallet.cpp File Reference
#include <wallet/wallet.h>
#include <chain.h>
#include <chainparams.h>
#include <common/args.h>
#include <common/messages.h>
#include <common/signmessage.h>
#include <config.h>
#include <consensus/amount.h>
#include <consensus/consensus.h>
#include <consensus/validation.h>
#include <interfaces/wallet.h>
#include <kernel/chain.h>
#include <key.h>
#include <key_io.h>
#include <policy/policy.h>
#include <primitives/transaction.h>
#include <random.h>
#include <script/descriptor.h>
#include <script/script.h>
#include <script/sighashtype.h>
#include <script/sign.h>
#include <script/signingprovider.h>
#include <script/solver.h>
#include <support/cleanse.h>
#include <txmempool.h>
#include <univalue.h>
#include <util/bip32.h>
#include <util/check.h>
#include <util/fs.h>
#include <util/fs_helpers.h>
#include <util/moneystr.h>
#include <util/string.h>
#include <util/translation.h>
#include <wallet/coincontrol.h>
#include <wallet/context.h>
#include <wallet/fees.h>
#include <variant>
Include dependency graph for wallet.cpp:

Go to the source code of this file.

Functions

bool AddWalletSetting (interfaces::Chain &chain, const std::string &wallet_name)
 Add wallet name to persistent configuration so it will be loaded on startup. More...
 
bool RemoveWalletSetting (interfaces::Chain &chain, const std::string &wallet_name)
 Remove wallet name from persistent configuration so it will not be loaded on startup. More...
 
static void UpdateWalletSetting (interfaces::Chain &chain, const std::string &wallet_name, std::optional< bool > load_on_startup, std::vector< bilingual_str > &warnings)
 
bool AddWallet (WalletContext &context, const std::shared_ptr< CWallet > &wallet)
 
bool RemoveWallet (WalletContext &context, const std::shared_ptr< CWallet > &wallet, std::optional< bool > load_on_start, std::vector< bilingual_str > &warnings)
 
bool RemoveWallet (WalletContext &context, const std::shared_ptr< CWallet > &wallet, std::optional< bool > load_on_start)
 
std::vector< std::shared_ptr< CWallet > > GetWallets (WalletContext &context)
 
std::shared_ptr< CWallet > GetWallet (WalletContext &context, const std::string &name)
 
std::unique_ptr< interfaces::Handler > HandleLoadWallet (WalletContext &context, LoadWalletFn load_wallet)
 
void NotifyWalletLoaded (WalletContext &context, const std::shared_ptr< CWallet > &wallet)
 
static std::set< std::string > g_loading_wallet_set GUARDED_BY (g_loading_wallet_mutex)
 
static std::set< std::string > g_unloading_wallet_set GUARDED_BY (g_wallet_release_mutex)
 
static void FlushAndDeleteWallet (CWallet *wallet)
 
void WaitForDeleteWallet (std::shared_ptr< CWallet > &&wallet)
 Explicitly delete the wallet. More...
 
std::shared_ptr< CWallet > LoadWallet (WalletContext &context, const std::string &name, std::optional< bool > load_on_start, const DatabaseOptions &options, DatabaseStatus &status, bilingual_str &error, std::vector< bilingual_str > &warnings)
 
std::shared_ptr< CWallet > CreateWallet (WalletContext &context, const std::string &name, std::optional< bool > load_on_start, DatabaseOptions &options, DatabaseStatus &status, bilingual_str &error, std::vector< bilingual_str > &warnings)
 
std::shared_ptr< CWallet > RestoreWallet (WalletContext &context, const fs::path &backup_file, const std::string &wallet_name, std::optional< bool > load_on_start, DatabaseStatus &status, bilingual_str &error, std::vector< bilingual_str > &warnings)
 
void MaybeResendWalletTxs (WalletContext &context)
 Called periodically by the schedule thread. More...
 
std::unique_ptr< WalletDatabase > MakeWalletDatabase (const std::string &name, const DatabaseOptions &options, DatabaseStatus &status, bilingual_str &error_string)
 

Variables

const std::map< uint64_t, std::string > WALLET_FLAG_CAVEATS
 
static GlobalMutex g_loading_wallet_mutex
 
static GlobalMutex g_wallet_release_mutex
 
static std::condition_variable g_wallet_release_cv
 

Function Documentation

◆ AddWallet()

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

Definition at line 112 of file wallet.cpp.

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

◆ AddWalletSetting()

bool AddWalletSetting ( interfaces::Chain &  chain,
const std::string &  wallet_name 
)

Add wallet name to persistent configuration so it will be loaded on startup.

Definition at line 60 of file wallet.cpp.

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

◆ CreateWallet()

std::shared_ptr< CWallet > CreateWallet ( WalletContext &  context,
const std::string &  name,
std::optional< bool >  load_on_start,
DatabaseOptions &  options,
DatabaseStatus &  status,
bilingual_str &  error,
std::vector< bilingual_str > &  warnings 
)

Definition at line 303 of file wallet.cpp.

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

◆ FlushAndDeleteWallet()

static void FlushAndDeleteWallet ( CWallet *  wallet)
static

Definition at line 206 of file wallet.cpp.

Here is the caller graph for this function:

◆ GetWallet()

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

Definition at line 167 of file wallet.cpp.

Here is the caller graph for this function:

◆ GetWallets()

std::vector< std::shared_ptr< CWallet > > GetWallets ( WalletContext &  context)

Definition at line 162 of file wallet.cpp.

Here is the caller graph for this function:

◆ GUARDED_BY() [1/2]

static std::set< std::string > g_loading_wallet_set GUARDED_BY ( g_loading_wallet_mutex  )
static

◆ GUARDED_BY() [2/2]

static std::set< std::string > g_unloading_wallet_set GUARDED_BY ( g_wallet_release_mutex  )
static

◆ HandleLoadWallet()

std::unique_ptr< interfaces::Handler > HandleLoadWallet ( WalletContext &  context,
LoadWalletFn  load_wallet 
)

Definition at line 179 of file wallet.cpp.

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

◆ LoadWallet()

std::shared_ptr< CWallet > LoadWallet ( WalletContext &  context,
const std::string &  name,
std::optional< bool >  load_on_start,
const DatabaseOptions &  options,
DatabaseStatus &  status,
bilingual_str &  error,
std::vector< bilingual_str > &  warnings 
)

Definition at line 285 of file wallet.cpp.

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

◆ MakeWalletDatabase()

std::unique_ptr< WalletDatabase > MakeWalletDatabase ( const std::string &  name,
const DatabaseOptions &  options,
DatabaseStatus &  status,
bilingual_str &  error_string 
)

Definition at line 2758 of file wallet.cpp.

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

◆ MaybeResendWalletTxs()

void MaybeResendWalletTxs ( WalletContext &  context)

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 2079 of file wallet.cpp.

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

◆ NotifyWalletLoaded()

void NotifyWalletLoaded ( WalletContext &  context,
const std::shared_ptr< CWallet > &  wallet 
)

Definition at line 189 of file wallet.cpp.

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

◆ RemoveWallet() [1/2]

bool RemoveWallet ( WalletContext &  context,
const std::shared_ptr< CWallet > &  wallet,
std::optional< bool >  load_on_start 
)

Definition at line 155 of file wallet.cpp.

Here is the call graph for this function:

◆ RemoveWallet() [2/2]

bool RemoveWallet ( WalletContext &  context,
const std::shared_ptr< CWallet > &  wallet,
std::optional< bool >  load_on_start,
std::vector< bilingual_str > &  warnings 
)

Definition at line 126 of file wallet.cpp.

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

◆ RemoveWalletSetting()

bool RemoveWalletSetting ( interfaces::Chain &  chain,
const std::string &  wallet_name 
)

Remove wallet name from persistent configuration so it will not be loaded on startup.

Definition at line 75 of file wallet.cpp.

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

◆ RestoreWallet()

std::shared_ptr< CWallet > RestoreWallet ( WalletContext &  context,
const fs::path &  backup_file,
const std::string &  wallet_name,
std::optional< bool >  load_on_start,
DatabaseStatus &  status,
bilingual_str &  error,
std::vector< bilingual_str > &  warnings 
)

Definition at line 405 of file wallet.cpp.

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

◆ UpdateWalletSetting()

static void UpdateWalletSetting ( interfaces::Chain &  chain,
const std::string &  wallet_name,
std::optional< bool >  load_on_startup,
std::vector< bilingual_str > &  warnings 
)
static

Definition at line 93 of file wallet.cpp.

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

◆ WaitForDeleteWallet()

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

Explicitly delete the wallet.

Blocks the current thread until the wallet is destructed.

Definition at line 222 of file wallet.cpp.

Here is the caller graph for this function:

Variable Documentation

◆ g_loading_wallet_mutex

GlobalMutex g_loading_wallet_mutex
static

Definition at line 197 of file wallet.cpp.

◆ g_wallet_release_cv

std::condition_variable g_wallet_release_cv
static

Definition at line 199 of file wallet.cpp.

◆ g_wallet_release_mutex

GlobalMutex g_wallet_release_mutex
static

Definition at line 198 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."},
}
@ WALLET_FLAG_AVOID_REUSE
Definition: walletutil.h:47

Definition at line 53 of file wallet.cpp.