From 0d94e6062547f288a75921d2433458a44a5f2297 Mon Sep 17 00:00:00 2001 From: Russell Yanofsky Date: Tue, 4 Aug 2020 17:55:13 -0400 Subject: refactor: Use DatabaseStatus and DatabaseOptions types No changes in behavior. Just replaces arguments and return types --- src/interfaces/wallet.cpp | 15 +++++++++++---- src/interfaces/wallet.h | 3 +-- 2 files changed, 12 insertions(+), 6 deletions(-) (limited to 'src/interfaces') diff --git a/src/interfaces/wallet.cpp b/src/interfaces/wallet.cpp index d17110a0f6..d19d0406b6 100644 --- a/src/interfaces/wallet.cpp +++ b/src/interfaces/wallet.cpp @@ -514,15 +514,22 @@ public: void setMockTime(int64_t time) override { return SetMockTime(time); } //! WalletClient methods - std::unique_ptr createWallet(const std::string& name, const SecureString& passphrase, uint64_t wallet_creation_flags, WalletCreationStatus& status, bilingual_str& error, std::vector& warnings) override + std::unique_ptr createWallet(const std::string& name, const SecureString& passphrase, uint64_t wallet_creation_flags, bilingual_str& error, std::vector& warnings) override { std::shared_ptr wallet; - status = CreateWallet(*m_context.chain, passphrase, wallet_creation_flags, name, true /* load_on_start */, error, warnings, wallet); - return MakeWallet(std::move(wallet)); + DatabaseOptions options; + DatabaseStatus status; + options.require_create = true; + options.create_flags = wallet_creation_flags; + options.create_passphrase = passphrase; + return MakeWallet(CreateWallet(*m_context.chain, name, true /* load_on_start */, options, status, error, warnings)); } std::unique_ptr loadWallet(const std::string& name, bilingual_str& error, std::vector& warnings) override { - return MakeWallet(LoadWallet(*m_context.chain, name, true /* load_on_start */, error, warnings)); + DatabaseOptions options; + DatabaseStatus status; + options.require_existing = true; + return MakeWallet(LoadWallet(*m_context.chain, name, true /* load_on_start */, options, status, error, warnings)); } std::string getWalletDir() override { diff --git a/src/interfaces/wallet.h b/src/interfaces/wallet.h index 186f5d81a5..b1afbbfd7c 100644 --- a/src/interfaces/wallet.h +++ b/src/interfaces/wallet.h @@ -29,7 +29,6 @@ class CWallet; enum class FeeReason; enum class OutputType; enum class TransactionError; -enum class WalletCreationStatus; enum isminetype : unsigned int; struct CRecipient; struct PartiallySignedTransaction; @@ -311,7 +310,7 @@ class WalletClient : public ChainClient { public: //! Create new wallet. - virtual std::unique_ptr createWallet(const std::string& name, const SecureString& passphrase, uint64_t wallet_creation_flags, WalletCreationStatus& status, bilingual_str& error, std::vector& warnings) = 0; + virtual std::unique_ptr createWallet(const std::string& name, const SecureString& passphrase, uint64_t wallet_creation_flags, bilingual_str& error, std::vector& warnings) = 0; //! Load existing wallet. virtual std::unique_ptr loadWallet(const std::string& name, bilingual_str& error, std::vector& warnings) = 0; -- cgit v1.2.3