diff --git a/src/wallet/dump.cpp b/src/wallet/dump.cpp index 7a36910dc1..157ec02a38 100644 --- a/src/wallet/dump.cpp +++ b/src/wallet/dump.cpp @@ -21,15 +21,8 @@ namespace wallet { static const std::string DUMP_MAGIC = "BITCOIN_CORE_WALLET_DUMP"; uint32_t DUMP_VERSION = 1; -bool DumpWallet(const ArgsManager& args, WalletDatabase& db, bilingual_str& error) +bool DumpWallet(WalletDatabase& db, bilingual_str& error, const std::string& dump_filename) { - // Get the dumpfile - std::string dump_filename = args.GetArg("-dumpfile", ""); - if (dump_filename.empty()) { - error = _("No dump file provided. To use dump, -dumpfile= must be provided."); - return false; - } - fs::path path = fs::PathFromString(dump_filename); path = fs::absolute(path); if (fs::exists(path)) { diff --git a/src/wallet/dump.h b/src/wallet/dump.h index 9b44af922e..c7b626decf 100644 --- a/src/wallet/dump.h +++ b/src/wallet/dump.h @@ -16,7 +16,7 @@ class ArgsManager; namespace wallet { class WalletDatabase; -bool DumpWallet(const ArgsManager& args, WalletDatabase& db, bilingual_str& error); +bool DumpWallet(WalletDatabase& db, bilingual_str& error, const std::string& dump_filename); bool CreateFromDump(const ArgsManager& args, const std::string& name, const fs::path& wallet_path, bilingual_str& error, std::vector& warnings); } // namespace wallet diff --git a/src/wallet/wallettool.cpp b/src/wallet/wallettool.cpp index cda344ab19..152a91076b 100644 --- a/src/wallet/wallettool.cpp +++ b/src/wallet/wallettool.cpp @@ -193,6 +193,14 @@ bool ExecuteWalletToolFunc(const ArgsManager& args, const std::string& command) DatabaseOptions options; ReadDatabaseArgs(args, options); options.require_existing = true; + + // Get the dumpfile + std::string dump_filename = args.GetArg("-dumpfile", ""); + if (dump_filename.empty()) { + tfm::format(std::cerr, "No dump file provided. To use dump, -dumpfile= must be provided.\n"); + return false; + } + DatabaseStatus status; bilingual_str error; std::unique_ptr database = MakeDatabase(path, options, status, error); @@ -201,7 +209,7 @@ bool ExecuteWalletToolFunc(const ArgsManager& args, const std::string& command) return false; } - bool ret = DumpWallet(args, *database, error); + bool ret = DumpWallet(*database, error, dump_filename); if (!ret && !error.empty()) { tfm::format(std::cerr, "%s\n", error.original); return ret;