diff options
author | MacroFake <falke.marco@gmail.com> | 2022-07-12 15:35:41 +0200 |
---|---|---|
committer | MacroFake <falke.marco@gmail.com> | 2022-07-12 19:20:01 +0200 |
commit | fa475e9c7977a952617738f2ee8cf600c07d4df8 (patch) | |
tree | dc97023220ebccf7db7dd674b00c66cea2b69a5e /src/wallet/interfaces.cpp | |
parent | fa8de09edc9ec4e6d171df80f746174a0ec58afb (diff) | |
download | bitcoin-fa475e9c7977a952617738f2ee8cf600c07d4df8.tar.xz |
refactor: Return BResult from restoreWallet
Diffstat (limited to 'src/wallet/interfaces.cpp')
-rw-r--r-- | src/wallet/interfaces.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/wallet/interfaces.cpp b/src/wallet/interfaces.cpp index 547d972c8d..23f91d9b3a 100644 --- a/src/wallet/interfaces.cpp +++ b/src/wallet/interfaces.cpp @@ -569,11 +569,13 @@ public: options.require_existing = true; return MakeWallet(m_context, LoadWallet(m_context, name, true /* load_on_start */, options, status, error, warnings)); } - std::unique_ptr<Wallet> restoreWallet(const fs::path& backup_file, const std::string& wallet_name, bilingual_str& error, std::vector<bilingual_str>& warnings) override + BResult<std::unique_ptr<Wallet>> restoreWallet(const fs::path& backup_file, const std::string& wallet_name, std::vector<bilingual_str>& warnings) override { DatabaseStatus status; - - return MakeWallet(m_context, RestoreWallet(m_context, backup_file, wallet_name, /*load_on_start=*/true, status, error, warnings)); + bilingual_str error; + BResult<std::unique_ptr<Wallet>> wallet{MakeWallet(m_context, RestoreWallet(m_context, backup_file, wallet_name, /*load_on_start=*/true, status, error, warnings))}; + if (!wallet) return error; + return wallet; } std::string getWalletDir() override { |