diff options
author | MacroFake <falke.marco@gmail.com> | 2022-07-14 10:04:34 +0200 |
---|---|---|
committer | MacroFake <falke.marco@gmail.com> | 2022-07-14 10:04:42 +0200 |
commit | 062b9db0ccb6af8bfbaa2b29132408cda9991b40 (patch) | |
tree | 96b12c4ab0e31b5c1c6b580d1a76a401920a19a0 /src/wallet | |
parent | 8efa73e7ce4ea0c1b7ad5c3947a5ecf9fb6361d3 (diff) | |
parent | fa475e9c7977a952617738f2ee8cf600c07d4df8 (diff) | |
download | bitcoin-062b9db0ccb6af8bfbaa2b29132408cda9991b40.tar.xz |
Merge bitcoin/bitcoin#25594: refactor: Return BResult from restoreWallet
fa475e9c7977a952617738f2ee8cf600c07d4df8 refactor: Return BResult from restoreWallet (MacroFake)
fa8de09edc9ec4e6d171df80f746174a0ec58afb Prepare BResult for non-copyable types (MacroFake)
Pull request description:
This avoids the `error` in-out param (and if `warnings` is added to `BResult`, it will avoid passing that in-out param as well).
Also, as it is needed for this change, prepare `BResult` for non-copyable types.
ACKs for top commit:
w0xlt:
reACK https://github.com/bitcoin/bitcoin/pull/25594/commits/fa475e9c7977a952617738f2ee8cf600c07d4df8
ryanofsky:
Code review ACK fa475e9c7977a952617738f2ee8cf600c07d4df8. Changes since last review were replacing auto with explicit type and splitting commits
Tree-SHA512: 46350883572f13721ddd198f5dfb88d2fa58ebcbda416f74da3563ea15c920fb1e6ff30558526a4ac91c36c21e6afe27751a4e51b7b8bcbcbe805209f4e9014b
Diffstat (limited to 'src/wallet')
-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 { |