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{
63 load_wallet_ret = wallet_instance->LoadWallet();
64 }
catch (
const std::runtime_error &) {
67 "Error loading %s. Is wallet being used by another process?\n",
73 wallet_instance =
nullptr;
80 "Error reading %s! All keys read correctly, but transaction "
81 "data or address book entries might be missing or incorrect.",
85 "Error loading %s: Wallet requires newer version of %s",
90 "Wallet needed to be rewritten: restart %s to complete",
103 return wallet_instance;
109 tfm::format(std::cout,
"Wallet info\n===========\n");
111 wallet_instance->
IsCrypted() ?
"yes" :
"no");
112 tfm::format(std::cout,
"HD (hd seed available): %s\n",
117 wallet_instance->mapWallet.size());
119 wallet_instance->m_address_book.size());
123 const std::string &
name) {
127 if (command ==
"create") {
128 std::shared_ptr<CWallet> wallet_instance =
130 if (wallet_instance) {
132 wallet_instance->Close();
134 }
else if (command ==
"info" || command ==
"salvage") {
135 if (command ==
"info") {
136 std::shared_ptr<CWallet> wallet_instance =
138 if (!wallet_instance) {
142 wallet_instance->Close();
143 }
else if (command ==
"salvage") {
145 std::vector<bilingual_str> warnings;
148 for (
const auto &warning : warnings) {
151 if (!
error.empty()) {
158 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.