@@ -560,8 +560,12 @@ class WalletLoaderImpl : public WalletLoader
560
560
options.create_flags = wallet_creation_flags;
561
561
options.create_passphrase = passphrase;
562
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};
563
+ std::unique_ptr<Wallet> wallet{MakeWallet (m_context, CreateWallet (m_context, name, /* load_on_start=*/ true , options, status, error, warnings))};
564
+ if (wallet) {
565
+ return {std::move (wallet)};
566
+ } else {
567
+ return util::Error{error};
568
+ }
565
569
}
566
570
util::Result<std::unique_ptr<Wallet>> loadWallet (const std::string& name, std::vector<bilingual_str>& warnings) override
567
571
{
@@ -570,15 +574,23 @@ class WalletLoaderImpl : public WalletLoader
570
574
ReadDatabaseArgs (*m_context.args , options);
571
575
options.require_existing = true ;
572
576
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};
577
+ std::unique_ptr<Wallet> wallet{MakeWallet (m_context, LoadWallet (m_context, name, /* load_on_start=*/ true , options, status, error, warnings))};
578
+ if (wallet) {
579
+ return {std::move (wallet)};
580
+ } else {
581
+ return util::Error{error};
582
+ }
575
583
}
576
584
util::Result<std::unique_ptr<Wallet>> restoreWallet (const fs::path& backup_file, const std::string& wallet_name, std::vector<bilingual_str>& warnings) override
577
585
{
578
586
DatabaseStatus status;
579
587
bilingual_str error;
580
- util::Result<std::unique_ptr<Wallet>> wallet{MakeWallet (m_context, RestoreWallet (m_context, backup_file, wallet_name, /* load_on_start=*/ true , status, error, warnings))};
581
- return wallet ? std::move (wallet) : util::Error{error};
588
+ std::unique_ptr<Wallet> wallet{MakeWallet (m_context, RestoreWallet (m_context, backup_file, wallet_name, /* load_on_start=*/ true , status, error, warnings))};
589
+ if (wallet) {
590
+ return {std::move (wallet)};
591
+ } else {
592
+ return util::Error{error};
593
+ }
582
594
}
583
595
std::string getWalletDir () override
584
596
{
0 commit comments