aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/interfaces.cpp
diff options
context:
space:
mode:
authorfurszy <matiasfurszyfer@protonmail.com>2022-04-08 16:43:10 -0300
committerfurszy <matiasfurszyfer@protonmail.com>2022-07-08 11:18:35 -0300
commit22351725bc4c5eb63ee45f607374bbf2d76e2b8c (patch)
treef070e528309494f0f519be8fd590117c00f1761b /src/wallet/interfaces.cpp
parent198fcca162f4d2f877feab485e629ff89818ff56 (diff)
downloadbitcoin-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.cpp18
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,