diff options
Diffstat (limited to 'src/wallet/interfaces.cpp')
-rw-r--r-- | src/wallet/interfaces.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/wallet/interfaces.cpp b/src/wallet/interfaces.cpp index 5add128717..aea6d5534e 100644 --- a/src/wallet/interfaces.cpp +++ b/src/wallet/interfaces.cpp @@ -48,6 +48,8 @@ using interfaces::WalletTxStatus; using interfaces::WalletValueMap; namespace wallet { +// All members of the classes in this namespace are intentionally public, as the +// classes themselves are private. namespace { //! Construct wallet tx struct. WalletTx MakeWalletTx(CWallet& wallet, const CWalletTx& wtx) @@ -146,7 +148,7 @@ public: void abortRescan() override { m_wallet->AbortRescan(); } bool backupWallet(const std::string& filename) override { return m_wallet->BackupWallet(filename); } std::string getWalletName() override { return m_wallet->GetName(); } - BResult<CTxDestination> getNewDestination(const OutputType type, const std::string label) override + util::Result<CTxDestination> getNewDestination(const OutputType type, const std::string label) override { LOCK(m_wallet->cs_wallet); return m_wallet->GetNewDestination(type, label); @@ -249,17 +251,17 @@ public: LOCK(m_wallet->cs_wallet); return m_wallet->ListLockedCoins(outputs); } - BResult<CTransactionRef> createTransaction(const std::vector<CRecipient>& recipients, + util::Result<CTransactionRef> createTransaction(const std::vector<CRecipient>& recipients, const CCoinControl& coin_control, bool sign, int& change_pos, CAmount& fee) override { LOCK(m_wallet->cs_wallet); - const auto& res = CreateTransaction(*m_wallet, recipients, change_pos, + auto res = CreateTransaction(*m_wallet, recipients, change_pos, coin_control, sign); - if (!res) return res.GetError(); - const auto& txr = res.GetObj(); + if (!res) return util::Error{util::ErrorString(res)}; + const auto& txr = *res; fee = txr.fee; change_pos = txr.change_pos; @@ -568,12 +570,12 @@ public: options.require_existing = true; return MakeWallet(m_context, LoadWallet(m_context, name, true /* load_on_start */, options, status, error, warnings)); } - BResult<std::unique_ptr<Wallet>> restoreWallet(const fs::path& backup_file, const std::string& wallet_name, std::vector<bilingual_str>& warnings) override + util::Result<std::unique_ptr<Wallet>> restoreWallet(const fs::path& backup_file, const std::string& wallet_name, std::vector<bilingual_str>& warnings) override { DatabaseStatus status; 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; + util::Result<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 util::Error{error}; return wallet; } std::string getWalletDir() override |