Bitcoin
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 <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/validation.h>
#include <validation.h>
#include <wallet/coincontrol.h>
#include <wallet/fees.h>
#include <algorithm>
#include <assert.h>
#include <future>
#include <boost/algorithm/string/replace.hpp>

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)
 
static void ReleaseWallet (CWallet *wallet)
 
void UnloadWallet (std::shared_ptr< CWallet > &&wallet)
 
std::shared_ptr< CWalletLoadWallet (interfaces::Chain &chain, const WalletLocation &location, std::string &error, std::string &warning)
 
std::shared_ptr< CWalletLoadWallet (interfaces::Chain &chain, const std::string &name, std::string &error, std::string &warning)
 
std::shared_ptr< CWalletCreateWallet (interfaces::Chain &chain, const std::string &name, std::string &error, std::string &warning, WalletCreationStatus &status, const SecureString &passphrase, uint64_t wallet_creation_flags)
 
std::vector< CKeyIDGetAffectedKeys (const CScript &spk, const SigningProvider &provider)
 
static bool ExtractPubKey (const CScript &dest, CPubKey &pubKeyOut)
 
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 ()
 
static bool IsCurrentForAntiFeeSniping (interfaces::Chain &chain, interfaces::Chain::Lock &locked_chain)
 
static uint32_t GetLocktimeForNewTransaction (interfaces::Chain &chain, interfaces::Chain::Lock &locked_chain)
 
static int64_t GetOldestKeyTimeInPool (const std::set< int64_t > &setKeyPool, WalletBatch &batch)
 

Variables

const std::map< uint64_t, std::string > WALLET_FLAG_CAVEATS
 
static const size_t OUTPUT_GROUP_MAX_ENTRIES = 10
 
static CCriticalSection cs_wallets
 
static Mutex g_wallet_release_mutex
 
static std::condition_variable g_wallet_release_cv
 
static std::set< CWallet * > g_unloading_wallet_set
 
const uint32_t BIP32_HARDENED_KEY_LIMIT = 0x80000000
 

Function Documentation

◆ AddWallet()

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

◆ CreateWallet()

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

◆ GetWallet()

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

◆ GetWallets()

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

◆ GUARDED_BY()

static std::vector<std::shared_ptr<CWallet> > vpwallets GUARDED_BY ( cs_wallets  )
static

◆ HasWallets()

bool HasWallets ( )

◆ LoadWallet() [1/2]

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

◆ LoadWallet() [2/2]

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

◆ 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.

◆ ReleaseWallet()

static void ReleaseWallet ( CWallet wallet)
static

◆ RemoveWallet()

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

◆ 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.

Variable Documentation

◆ BIP32_HARDENED_KEY_LIMIT

const uint32_t BIP32_HARDENED_KEY_LIMIT = 0x80000000

◆ cs_wallets

CCriticalSection cs_wallets
static

◆ g_unloading_wallet_set

std::set<CWallet*> g_unloading_wallet_set
static

◆ g_wallet_release_cv

std::condition_variable g_wallet_release_cv
static

◆ g_wallet_release_mutex

Mutex g_wallet_release_mutex
static

◆ OUTPUT_GROUP_MAX_ENTRIES

const size_t OUTPUT_GROUP_MAX_ENTRIES = 10
static

◆ 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: wallet.h:135