mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 15:09:59 +01:00
send: refactor CreateTransaction flow to return a BResult<CTransactionRef>
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user