diff options
author | furszy <matiasfurszyfer@protonmail.com> | 2022-04-08 16:43:10 -0300 |
---|---|---|
committer | furszy <matiasfurszyfer@protonmail.com> | 2022-07-08 11:18:35 -0300 |
commit | 22351725bc4c5eb63ee45f607374bbf2d76e2b8c (patch) | |
tree | f070e528309494f0f519be8fd590117c00f1761b /src/wallet/interfaces.cpp | |
parent | 198fcca162f4d2f877feab485e629ff89818ff56 (diff) | |
download | bitcoin-22351725bc4c5eb63ee45f607374bbf2d76e2b8c.tar.xz |
send: refactor CreateTransaction flow to return a BResult<CTransactionRef>
Diffstat (limited to 'src/wallet/interfaces.cpp')
-rw-r--r-- | src/wallet/interfaces.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/wallet/interfaces.cpp b/src/wallet/interfaces.cpp index cec103b02b..424d441488 100644 --- a/src/wallet/interfaces.cpp +++ b/src/wallet/interfaces.cpp @@ -250,21 +250,21 @@ public: LOCK(m_wallet->cs_wallet); return m_wallet->ListLockedCoins(outputs); } - CTransactionRef createTransaction(const std::vector<CRecipient>& recipients, + BResult<CTransactionRef> createTransaction(const std::vector<CRecipient>& recipients, const CCoinControl& coin_control, bool sign, int& change_pos, - CAmount& fee, - bilingual_str& fail_reason) override + CAmount& fee) override { LOCK(m_wallet->cs_wallet); - std::optional<CreatedTransactionResult> txr = CreateTransaction(*m_wallet, recipients, change_pos, - fail_reason, coin_control, sign); - if (!txr) return {}; - fee = txr->fee; - change_pos = txr->change_pos; + const auto& res = CreateTransaction(*m_wallet, recipients, change_pos, + coin_control, sign); + if (!res) return res.GetError(); + const auto& txr = res.GetObj(); + fee = txr.fee; + change_pos = txr.change_pos; - return txr->tx; + return txr.tx; } void commitTransaction(CTransactionRef tx, WalletValueMap value_map, |