Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/wallet.h
Show First 20 Lines • Show All 66 Lines • ▼ Show 20 Lines | |||||
static const bool DEFAULT_WALLETBROADCAST = true; | static const bool DEFAULT_WALLETBROADCAST = true; | ||||
static const bool DEFAULT_DISABLE_WALLET = false; | static const bool DEFAULT_DISABLE_WALLET = false; | ||||
//! if set, all keys will be derived by using BIP32 | //! if set, all keys will be derived by using BIP32 | ||||
static const bool DEFAULT_USE_HD_WALLET = true; | static const bool DEFAULT_USE_HD_WALLET = true; | ||||
extern const char *DEFAULT_WALLET_DAT; | extern const char *DEFAULT_WALLET_DAT; | ||||
class CBlockIndex; | class CBlockIndex; | ||||
class CChainParams; | |||||
class CCoinControl; | class CCoinControl; | ||||
class COutput; | class COutput; | ||||
class CReserveKey; | class CReserveKey; | ||||
class CScript; | class CScript; | ||||
class CScheduler; | class CScheduler; | ||||
class CTxMemPool; | class CTxMemPool; | ||||
class CWalletTx; | class CWalletTx; | ||||
▲ Show 20 Lines • Show All 588 Lines • ▼ Show 20 Lines | private: | ||||
std::unique_ptr<CWalletDBWrapper> dbw; | std::unique_ptr<CWalletDBWrapper> dbw; | ||||
// Used to NotifyTransactionChanged of the previous block's coinbase when | // Used to NotifyTransactionChanged of the previous block's coinbase when | ||||
// the next block comes in | // the next block comes in | ||||
uint256 hashPrevBestCoinbase; | uint256 hashPrevBestCoinbase; | ||||
public: | public: | ||||
const CChainParams &chainParams; | |||||
/* | /* | ||||
* Main wallet lock. | * Main wallet lock. | ||||
* This lock protects all the fields added by CWallet. | * This lock protects all the fields added by CWallet. | ||||
*/ | */ | ||||
mutable CCriticalSection cs_wallet; | mutable CCriticalSection cs_wallet; | ||||
/** | /** | ||||
* Get database handle used by this wallet. Ideally this function would not | * Get database handle used by this wallet. Ideally this function would not | ||||
Show All 18 Lines | public: | ||||
// key metadata. | // key metadata. | ||||
std::map<CTxDestination, CKeyMetadata> mapKeyMetadata; | std::map<CTxDestination, CKeyMetadata> mapKeyMetadata; | ||||
typedef std::map<unsigned int, CMasterKey> MasterKeyMap; | typedef std::map<unsigned int, CMasterKey> MasterKeyMap; | ||||
MasterKeyMap mapMasterKeys; | MasterKeyMap mapMasterKeys; | ||||
unsigned int nMasterKeyMaxID; | unsigned int nMasterKeyMaxID; | ||||
// Create wallet with dummy database handle | // Create wallet with dummy database handle | ||||
CWallet() : dbw(new CWalletDBWrapper()) { SetNull(); } | CWallet(const CChainParams &chainParams) | ||||
: dbw(new CWalletDBWrapper()), chainParams(chainParams) { | |||||
SetNull(); | |||||
} | |||||
// Create wallet with passed-in database handle | // Create wallet with passed-in database handle | ||||
CWallet(std::unique_ptr<CWalletDBWrapper> dbw_in) : dbw(std::move(dbw_in)) { | CWallet(const CChainParams &chainParams, | ||||
std::unique_ptr<CWalletDBWrapper> dbw_in) | |||||
: dbw(std::move(dbw_in)), chainParams(chainParams) { | |||||
SetNull(); | SetNull(); | ||||
} | } | ||||
~CWallet() { | ~CWallet() { | ||||
delete pwalletdbEncryption; | delete pwalletdbEncryption; | ||||
pwalletdbEncryption = nullptr; | pwalletdbEncryption = nullptr; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 330 Lines • ▼ Show 20 Lines | public: | ||||
//! Flush wallet (bitdb flush) | //! Flush wallet (bitdb flush) | ||||
void Flush(bool shutdown = false); | void Flush(bool shutdown = false); | ||||
//! Responsible for reading and validating the -wallet arguments and | //! Responsible for reading and validating the -wallet arguments and | ||||
//! verifying the wallet database. | //! verifying the wallet database. | ||||
// This function will perform salvage on the wallet if requested, as long as | // This function will perform salvage on the wallet if requested, as long as | ||||
// only one wallet is being loaded (CWallet::ParameterInteraction forbids | // only one wallet is being loaded (CWallet::ParameterInteraction forbids | ||||
// -salvagewallet, -zapwallettxes or -upgradewallet with multiwallet). | // -salvagewallet, -zapwallettxes or -upgradewallet with multiwallet). | ||||
static bool Verify(); | static bool Verify(const CChainParams &chainParams); | ||||
/** | /** | ||||
* Address book entry changed. | * Address book entry changed. | ||||
* @note called with lock cs_wallet held. | * @note called with lock cs_wallet held. | ||||
*/ | */ | ||||
boost::signals2::signal<void(CWallet *wallet, const CTxDestination &address, | boost::signals2::signal<void(CWallet *wallet, const CTxDestination &address, | ||||
const std::string &label, bool isMine, | const std::string &label, bool isMine, | ||||
const std::string &purpose, ChangeType status)> | const std::string &purpose, ChangeType status)> | ||||
Show All 29 Lines | public: | ||||
/* Returns the wallets help message */ | /* Returns the wallets help message */ | ||||
static std::string GetWalletHelpString(bool showDebug); | static std::string GetWalletHelpString(bool showDebug); | ||||
/** | /** | ||||
* Initializes the wallet, returns a new CWallet instance or a null pointer | * Initializes the wallet, returns a new CWallet instance or a null pointer | ||||
* in case of an error. | * in case of an error. | ||||
*/ | */ | ||||
static CWallet *CreateWalletFromFile(const std::string walletFile); | static CWallet *CreateWalletFromFile(const CChainParams &chainParams, | ||||
static bool InitLoadWallet(); | const std::string walletFile); | ||||
static bool InitLoadWallet(const CChainParams &chainParams); | |||||
/** | /** | ||||
* Wallet post-init setup | * Wallet post-init setup | ||||
* Gives the wallet a chance to register repetitive tasks and complete | * Gives the wallet a chance to register repetitive tasks and complete | ||||
* post-init tasks | * post-init tasks | ||||
*/ | */ | ||||
void postInitProcess(CScheduler &scheduler); | void postInitProcess(CScheduler &scheduler); | ||||
▲ Show 20 Lines • Show All 99 Lines • Show Last 20 Lines |