@@ -597,7 +597,7 @@ class WalletLoaderImpl : public WalletLoader
597597 void schedulerMockForward (std::chrono::seconds delta) override { Assert (m_context.scheduler )->MockForward (delta); }
598598
599599 // ! WalletLoader methods
600- 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
600+ util::ResultPtr <std::unique_ptr<Wallet>> createWallet (const std::string& name, const SecureString& passphrase, uint64_t wallet_creation_flags, std::vector<bilingual_str>& warnings) override
601601 {
602602 DatabaseOptions options;
603603 DatabaseStatus status;
@@ -606,37 +606,25 @@ class WalletLoaderImpl : public WalletLoader
606606 options.create_flags = wallet_creation_flags;
607607 options.create_passphrase = passphrase;
608608 bilingual_str error;
609- std::unique_ptr<Wallet> wallet{MakeWallet (m_context, CreateWallet (m_context, name, /* load_on_start=*/ true , options, status, error, warnings))};
610- if (wallet) {
611- return wallet;
612- } else {
613- return util::Error{error};
614- }
609+ util::ResultPtr<std::unique_ptr<Wallet>> wallet{MakeWallet (m_context, CreateWallet (m_context, name, /* load_on_start=*/ true , options, status, error, warnings))};
610+ return wallet ? std::move (wallet) : util::Error{error};
615611 }
616- util::Result <std::unique_ptr<Wallet>> loadWallet (const std::string& name, std::vector<bilingual_str>& warnings) override
612+ util::ResultPtr <std::unique_ptr<Wallet>> loadWallet (const std::string& name, std::vector<bilingual_str>& warnings) override
617613 {
618614 DatabaseOptions options;
619615 DatabaseStatus status;
620616 ReadDatabaseArgs (*m_context.args , options);
621617 options.require_existing = true ;
622618 bilingual_str error;
623- std::unique_ptr<Wallet> wallet{MakeWallet (m_context, LoadWallet (m_context, name, /* load_on_start=*/ true , options, status, error, warnings))};
624- if (wallet) {
625- return wallet;
626- } else {
627- return util::Error{error};
628- }
619+ util::ResultPtr<std::unique_ptr<Wallet>> wallet{MakeWallet (m_context, LoadWallet (m_context, name, /* load_on_start=*/ true , options, status, error, warnings))};
620+ return wallet ? std::move (wallet) : util::Error{error};
629621 }
630- util::Result <std::unique_ptr<Wallet>> restoreWallet (const fs::path& backup_file, const std::string& wallet_name, std::vector<bilingual_str>& warnings) override
622+ util::ResultPtr <std::unique_ptr<Wallet>> restoreWallet (const fs::path& backup_file, const std::string& wallet_name, std::vector<bilingual_str>& warnings) override
631623 {
632624 DatabaseStatus status;
633625 bilingual_str error;
634- std::unique_ptr<Wallet> wallet{MakeWallet (m_context, RestoreWallet (m_context, backup_file, wallet_name, /* load_on_start=*/ true , status, error, warnings))};
635- if (wallet) {
636- return wallet;
637- } else {
638- return util::Error{error};
639- }
626+ util::ResultPtr<std::unique_ptr<Wallet>> wallet{MakeWallet (m_context, RestoreWallet (m_context, backup_file, wallet_name, /* load_on_start=*/ true , status, error, warnings))};
627+ return wallet ? std::move (wallet) : util::Error{error};
640628 }
641629 util::Result<WalletMigrationResult> migrateWallet (const std::string& name, const SecureString& passphrase) override
642630 {
0 commit comments