Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/wallettool.cpp
// Copyright (c) 2016-2018 The Bitcoin Core developers | // Copyright (c) 2016-2018 The Bitcoin Core developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
#include <chainparams.h> | #include <chainparams.h> | ||||
#include <fs.h> | #include <fs.h> | ||||
#include <util/system.h> | #include <util/system.h> | ||||
#include <util/translation.h> | |||||
#include <wallet/wallet.h> | #include <wallet/wallet.h> | ||||
#include <wallet/walletutil.h> | #include <wallet/walletutil.h> | ||||
#include <stdexcept> | #include <stdexcept> | ||||
namespace WalletTool { | namespace WalletTool { | ||||
// The standard wallet deleter function blocks on the validation interface | // The standard wallet deleter function blocks on the validation interface | ||||
▲ Show 20 Lines • Show All 115 Lines • ▼ Show 20 Lines | if (command == "create") { | ||||
WalletShowInfo(wallet_instance.get()); | WalletShowInfo(wallet_instance.get()); | ||||
wallet_instance->Flush(true); | wallet_instance->Flush(true); | ||||
} | } | ||||
} else if (command == "info") { | } else if (command == "info") { | ||||
if (!fs::exists(path)) { | if (!fs::exists(path)) { | ||||
tfm::format(std::cerr, "Error: no wallet file at %s\n", name); | tfm::format(std::cerr, "Error: no wallet file at %s\n", name); | ||||
return false; | return false; | ||||
} | } | ||||
std::string error; | bilingual_str error; | ||||
if (!WalletBatch::VerifyEnvironment(path, error)) { | if (!WalletBatch::VerifyEnvironment(path, error)) { | ||||
tfm::format( | tfm::format( | ||||
std::cerr, | std::cerr, | ||||
"Error loading %s. Is wallet being used by other process?\n", | "Error loading %s. Is wallet being used by other process?\n", | ||||
name); | name); | ||||
return false; | return false; | ||||
} | } | ||||
std::shared_ptr<CWallet> wallet_instance = LoadWallet(name, path); | std::shared_ptr<CWallet> wallet_instance = LoadWallet(name, path); | ||||
Show All 13 Lines |