5#include <chainparams.h>
21 wallet->WalletLogPrintf(
"Releasing wallet\n");
33 CPubKey seed = spk_man->GenerateNewSeed();
34 spk_man->SetHDSeed(seed);
50 std::unique_ptr<WalletDatabase> database =
58 std::shared_ptr<CWallet> wallet_instance{
64 load_wallet_ret = wallet_instance->LoadWallet(first_run);
65 }
catch (
const std::runtime_error &) {
68 "Error loading %s. Is wallet being used by another process?\n",
74 wallet_instance =
nullptr;
81 "Error reading %s! All keys read correctly, but transaction "
82 "data or address book entries might be missing or incorrect.",
86 "Error loading %s: Wallet requires newer version of %s",
91 "Wallet needed to be rewritten: restart %s to complete",
104 return wallet_instance;
110 tfm::format(std::cout,
"Wallet info\n===========\n");
112 wallet_instance->
IsCrypted() ?
"yes" :
"no");
113 tfm::format(std::cout,
"HD (hd seed available): %s\n",
118 wallet_instance->mapWallet.size());
120 wallet_instance->m_address_book.size());
124 const std::string &
name) {
128 if (command ==
"create") {
129 std::shared_ptr<CWallet> wallet_instance =
131 if (wallet_instance) {
133 wallet_instance->Close();
135 }
else if (command ==
"info" || command ==
"salvage") {
136 if (command ==
"info") {
137 std::shared_ptr<CWallet> wallet_instance =
139 if (!wallet_instance) {
143 wallet_instance->Close();
144 }
else if (command ==
"salvage") {
146 std::vector<bilingual_str> warnings;
149 for (
const auto &warning : warnings) {
152 if (!
error.empty()) {
159 tfm::format(std::cerr,
"Invalid command: %s\n", command);
An encapsulated public key.
A CWallet maintains a set of transactions and balances, and provides the ability to create new transa...
LegacyScriptPubKeyMan * GetOrCreateLegacyScriptPubKeyMan()
Path class wrapper to block calls to the fs::path(std::string) implicit constructor and the fs::path:...
unsigned int GetKeyPoolSize() const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
bool TopUpKeyPool(unsigned int kpSize=0)
void SetMinVersion(enum WalletFeature, WalletBatch *batch_in=nullptr, bool fExplicit=false) override
signify that a particular wallet feature is now used.
bool error(const char *fmt, const Args &...args)
static path PathFromString(const std::string &string)
Convert byte string to path object.
fs::path AbsPathJoin(const fs::path &base, const fs::path &path)
Helper function for joining two paths.
bool RecoverDatabaseFile(const fs::path &file_path, bilingual_str &error, std::vector< bilingual_str > &warnings)
std::unique_ptr< WalletDatabase > MakeDatabase(const fs::path &path, const DatabaseOptions &options, DatabaseStatus &status, bilingual_str &error)
DBErrors
Error statuses for the wallet database.
fs::path GetWalletDir()
Get the path of the wallet directory.