aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/wallettool.cpp
diff options
context:
space:
mode:
authorAndrew Chow <achow101-github@achow101.com>2020-07-06 14:34:49 -0400
committerAndrew Chow <achow101-github@achow101.com>2020-07-26 20:22:45 -0400
commit9f536d4fe949666f14a0bf5b814522cecde71f56 (patch)
tree8e9ad411b07c37a653ce4db46bad9df976a975fa /src/wallet/wallettool.cpp
parent06e263a4e368671ebb4e4a77c1447ebd5104a488 (diff)
downloadbitcoin-9f536d4fe949666f14a0bf5b814522cecde71f56.tar.xz
wallettool: Have RecoverDatabaseFile return errors and warnings
Instead of logging or printing these errors and warnings, return them to the caller.
Diffstat (limited to 'src/wallet/wallettool.cpp')
-rw-r--r--src/wallet/wallettool.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/wallet/wallettool.cpp b/src/wallet/wallettool.cpp
index 1e699658e4..5cabefcbfc 100644
--- a/src/wallet/wallettool.cpp
+++ b/src/wallet/wallettool.cpp
@@ -126,7 +126,18 @@ bool ExecuteWalletToolFunc(const std::string& command, const std::string& name)
WalletShowInfo(wallet_instance.get());
wallet_instance->Flush(true);
} 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 {
tfm::format(std::cerr, "Invalid command: %s\n", command);