diff options
author | Andrew Chow <achow101-github@achow101.com> | 2021-10-13 18:45:39 -0400 |
---|---|---|
committer | Ava Chow <github@achow101.com> | 2023-12-19 16:54:06 -0500 |
commit | d83bea42d1f0ffb0899a6de3556c489543468995 (patch) | |
tree | 9abb5ee2c0ef292fde2e2446f69e5a0febd0a8f3 /src/wallet/wallettool.cpp | |
parent | 40c80e36b1a204ed133acc403016a6cb1a92051e (diff) | |
download | bitcoin-d83bea42d1f0ffb0899a6de3556c489543468995.tar.xz |
wallettool: Don't create CWallet when dumping DB
It's not necessary to set up an entire CWallet just so we can get access
to the WalletDatabase and read the records. Instead we can go one level
lower and make just a WalletDatabase.
Diffstat (limited to 'src/wallet/wallettool.cpp')
-rw-r--r-- | src/wallet/wallettool.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/wallet/wallettool.cpp b/src/wallet/wallettool.cpp index c8deda89b5..cda344ab19 100644 --- a/src/wallet/wallettool.cpp +++ b/src/wallet/wallettool.cpp @@ -193,10 +193,15 @@ bool ExecuteWalletToolFunc(const ArgsManager& args, const std::string& command) DatabaseOptions options; ReadDatabaseArgs(args, options); options.require_existing = true; - const std::shared_ptr<CWallet> wallet_instance = MakeWallet(name, path, options); - if (!wallet_instance) return false; + DatabaseStatus status; bilingual_str error; - bool ret = DumpWallet(args, *wallet_instance, error); + std::unique_ptr<WalletDatabase> database = MakeDatabase(path, options, status, error); + if (!database) { + tfm::format(std::cerr, "%s\n", error.original); + return false; + } + + bool ret = DumpWallet(args, *database, error); if (!ret && !error.empty()) { tfm::format(std::cerr, "%s\n", error.original); return ret; |