Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/wallet.h
Show All 34 Lines | |||||
#include <utility> | #include <utility> | ||||
#include <vector> | #include <vector> | ||||
#include <boost/signals2/signal.hpp> | #include <boost/signals2/signal.hpp> | ||||
using LoadWalletFn = | using LoadWalletFn = | ||||
std::function<void(std::unique_ptr<interfaces::Wallet> wallet)>; | std::function<void(std::unique_ptr<interfaces::Wallet> wallet)>; | ||||
struct bilingual_str; | |||||
//! Explicitly unload and delete the wallet. | //! Explicitly unload and delete the wallet. | ||||
//! Blocks the current thread after signaling the unload intent so that all | //! Blocks the current thread after signaling the unload intent so that all | ||||
//! wallet clients release the wallet. | //! wallet clients release the wallet. | ||||
//! Note that, when blocking is not required, the wallet is implicitly unloaded | //! Note that, when blocking is not required, the wallet is implicitly unloaded | ||||
//! by the shared pointer deleter. | //! by the shared pointer deleter. | ||||
void UnloadWallet(std::shared_ptr<CWallet> &&wallet); | void UnloadWallet(std::shared_ptr<CWallet> &&wallet); | ||||
bool AddWallet(const std::shared_ptr<CWallet> &wallet); | bool AddWallet(const std::shared_ptr<CWallet> &wallet); | ||||
bool RemoveWallet(const std::shared_ptr<CWallet> &wallet); | bool RemoveWallet(const std::shared_ptr<CWallet> &wallet); | ||||
bool HasWallets(); | bool HasWallets(); | ||||
std::vector<std::shared_ptr<CWallet>> GetWallets(); | std::vector<std::shared_ptr<CWallet>> GetWallets(); | ||||
std::shared_ptr<CWallet> GetWallet(const std::string &name); | std::shared_ptr<CWallet> GetWallet(const std::string &name); | ||||
std::shared_ptr<CWallet> LoadWallet(const CChainParams &chainParams, | std::shared_ptr<CWallet> LoadWallet(const CChainParams &chainParams, | ||||
interfaces::Chain &chain, | interfaces::Chain &chain, | ||||
const WalletLocation &location, | const WalletLocation &location, | ||||
std::string &error, | bilingual_str &error, | ||||
std::vector<std::string> &warnings); | std::vector<bilingual_str> &warnings); | ||||
std::unique_ptr<interfaces::Handler> HandleLoadWallet(LoadWalletFn load_wallet); | std::unique_ptr<interfaces::Handler> HandleLoadWallet(LoadWalletFn load_wallet); | ||||
enum class WalletCreationStatus { SUCCESS, CREATION_FAILED, ENCRYPTION_FAILED }; | enum class WalletCreationStatus { SUCCESS, CREATION_FAILED, ENCRYPTION_FAILED }; | ||||
WalletCreationStatus CreateWallet(const CChainParams ¶ms, | WalletCreationStatus CreateWallet(const CChainParams ¶ms, | ||||
interfaces::Chain &chain, | interfaces::Chain &chain, | ||||
const SecureString &passphrase, | const SecureString &passphrase, | ||||
uint64_t wallet_creation_flags, | uint64_t wallet_creation_flags, | ||||
const std::string &name, std::string &error, | const std::string &name, bilingual_str &error, | ||||
std::vector<std::string> &warnings, | std::vector<bilingual_str> &warnings, | ||||
std::shared_ptr<CWallet> &result); | std::shared_ptr<CWallet> &result); | ||||
//! -paytxfee default | //! -paytxfee default | ||||
constexpr Amount DEFAULT_PAY_TX_FEE = Amount::zero(); | constexpr Amount DEFAULT_PAY_TX_FEE = Amount::zero(); | ||||
//! -fallbackfee default | //! -fallbackfee default | ||||
static const Amount DEFAULT_FALLBACK_FEE = Amount::zero(); | static const Amount DEFAULT_FALLBACK_FEE = Amount::zero(); | ||||
//! -mintxfee default | //! -mintxfee default | ||||
static const Amount DEFAULT_TRANSACTION_MINFEE_PER_KB = 1000 * SATOSHI; | static const Amount DEFAULT_TRANSACTION_MINFEE_PER_KB = 1000 * SATOSHI; | ||||
//! minimum recommended increment for BIP 125 replacement txs | //! minimum recommended increment for BIP 125 replacement txs | ||||
▲ Show 20 Lines • Show All 1,187 Lines • ▼ Show 20 Lines | public: | ||||
* Mark a transaction (and it in-wallet descendants) as abandoned so its | * Mark a transaction (and it in-wallet descendants) as abandoned so its | ||||
* inputs may be respent. | * inputs may be respent. | ||||
*/ | */ | ||||
bool AbandonTransaction(const TxId &txid); | bool AbandonTransaction(const TxId &txid); | ||||
//! Verify wallet naming and perform salvage on the wallet if required | //! Verify wallet naming and perform salvage on the wallet if required | ||||
static bool Verify(const CChainParams &chainParams, | static bool Verify(const CChainParams &chainParams, | ||||
interfaces::Chain &chain, const WalletLocation &location, | interfaces::Chain &chain, const WalletLocation &location, | ||||
bool salvage_wallet, std::string &error_string, | bool salvage_wallet, bilingual_str &error_string, | ||||
std::vector<std::string> &warnings); | std::vector<bilingual_str> &warnings); | ||||
/** | /** | ||||
* 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 std::shared_ptr<CWallet> CreateWalletFromFile( | static std::shared_ptr<CWallet> | ||||
const CChainParams &chainParams, interfaces::Chain &chain, | CreateWalletFromFile(const CChainParams &chainParams, | ||||
const WalletLocation &location, std::string &error, | interfaces::Chain &chain, | ||||
std::vector<std::string> &warnings, uint64_t wallet_creation_flags = 0); | const WalletLocation &location, bilingual_str &error, | ||||
std::vector<bilingual_str> &warnings, | |||||
uint64_t wallet_creation_flags = 0); | |||||
/** | /** | ||||
* 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(); | void postInitProcess(); | ||||
▲ Show 20 Lines • Show All 163 Lines • Show Last 20 Lines |