@@ -148,7 +148,7 @@ class WalletImpl : public Wallet
148148 void abortRescan () override { m_wallet->AbortRescan (); }
149149 bool backupWallet (const std::string& filename) override { return m_wallet->BackupWallet (filename); }
150150 std::string getWalletName () override { return m_wallet->GetName (); }
151- util::Result<CTxDestination> getNewDestination (const OutputType type, const std::string label) override
151+ util::Result<CTxDestination> getNewDestination (const OutputType type, const std::string& label) override
152152 {
153153 LOCK (m_wallet->cs_wallet );
154154 return m_wallet->GetNewDestination (type, label);
@@ -551,32 +551,34 @@ class WalletLoaderImpl : public WalletLoader
551551 void setMockTime (int64_t time) override { return SetMockTime (time); }
552552
553553 // ! WalletLoader methods
554- std::unique_ptr<Wallet> createWallet (const std::string& name, const SecureString& passphrase, uint64_t wallet_creation_flags, bilingual_str& error , std::vector<bilingual_str>& warnings) override
554+ util::Result< std::unique_ptr<Wallet>> createWallet (const std::string& name, const SecureString& passphrase, uint64_t wallet_creation_flags, std::vector<bilingual_str>& warnings) override
555555 {
556- std::shared_ptr<CWallet> wallet;
557556 DatabaseOptions options;
558557 DatabaseStatus status;
559558 ReadDatabaseArgs (*m_context.args , options);
560559 options.require_create = true ;
561560 options.create_flags = wallet_creation_flags;
562561 options.create_passphrase = passphrase;
563- return MakeWallet (m_context, CreateWallet (m_context, name, true /* load_on_start */ , options, status, error, warnings));
562+ bilingual_str error;
563+ util::Result<std::unique_ptr<Wallet>> wallet{MakeWallet (m_context, CreateWallet (m_context, name, /* load_on_start=*/ true , options, status, error, warnings))};
564+ return wallet ? std::move (wallet) : util::Error{error};
564565 }
565- std::unique_ptr<Wallet> loadWallet (const std::string& name, bilingual_str& error , std::vector<bilingual_str>& warnings) override
566+ util::Result< std::unique_ptr<Wallet>> loadWallet (const std::string& name, std::vector<bilingual_str>& warnings) override
566567 {
567568 DatabaseOptions options;
568569 DatabaseStatus status;
569570 ReadDatabaseArgs (*m_context.args , options);
570571 options.require_existing = true ;
571- return MakeWallet (m_context, LoadWallet (m_context, name, true /* load_on_start */ , options, status, error, warnings));
572+ bilingual_str error;
573+ util::Result<std::unique_ptr<Wallet>> wallet{MakeWallet (m_context, LoadWallet (m_context, name, /* load_on_start=*/ true , options, status, error, warnings))};
574+ return wallet ? std::move (wallet) : util::Error{error};
572575 }
573576 util::Result<std::unique_ptr<Wallet>> restoreWallet (const fs::path& backup_file, const std::string& wallet_name, std::vector<bilingual_str>& warnings) override
574577 {
575578 DatabaseStatus status;
576579 bilingual_str error;
577580 util::Result<std::unique_ptr<Wallet>> wallet{MakeWallet (m_context, RestoreWallet (m_context, backup_file, wallet_name, /* load_on_start=*/ true , status, error, warnings))};
578- if (!wallet) return util::Error{error};
579- return wallet;
581+ return wallet ? std::move (wallet) : util::Error{error};
580582 }
581583 std::string getWalletDir () override
582584 {
0 commit comments