Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/wallettool.cpp
Show First 20 Lines • Show All 142 Lines • ▼ Show 20 Lines | if (command == "create") { | ||||
if (command == "info") { | if (command == "info") { | ||||
std::shared_ptr<CWallet> wallet_instance = LoadWallet(name, path); | std::shared_ptr<CWallet> wallet_instance = LoadWallet(name, path); | ||||
if (!wallet_instance) { | if (!wallet_instance) { | ||||
return false; | return false; | ||||
} | } | ||||
WalletShowInfo(wallet_instance.get()); | WalletShowInfo(wallet_instance.get()); | ||||
wallet_instance->Flush(true); | wallet_instance->Flush(true); | ||||
} else if (command == "salvage") { | } else if (command == "salvage") { | ||||
return RecoverDatabaseFile(path); | bilingual_str error; | ||||
std::vector<bilingual_str> warnings; | |||||
bool ret = RecoverDatabaseFile(path, error, warnings); | |||||
if (!ret) { | |||||
for (const auto &warning : warnings) { | |||||
tfm::format(std::cerr, "%s\n", warning.original); | |||||
} | |||||
if (!error.empty()) { | |||||
tfm::format(std::cerr, "%s\n", error.original); | |||||
} | |||||
} | |||||
return ret; | |||||
} | } | ||||
} else { | } else { | ||||
tfm::format(std::cerr, "Invalid command: %s\n", command); | tfm::format(std::cerr, "Invalid command: %s\n", command); | ||||
return false; | return false; | ||||
} | } | ||||
return true; | return true; | ||||
} | } | ||||
} // namespace WalletTool | } // namespace WalletTool |