mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 14:38:29 +01:00
send: refactor CreateTransaction flow to return a BResult<CTransactionRef>
This commit is contained in:
@@ -219,18 +219,18 @@ Result CreateRateBumpTransaction(CWallet& wallet, const uint256& txid, const CCo
|
||||
new_coin_control.m_min_depth = 1;
|
||||
|
||||
constexpr int RANDOM_CHANGE_POSITION = -1;
|
||||
bilingual_str fail_reason;
|
||||
std::optional<CreatedTransactionResult> txr = CreateTransaction(wallet, recipients, RANDOM_CHANGE_POSITION, fail_reason, new_coin_control, false);
|
||||
if (!txr) {
|
||||
errors.push_back(Untranslated("Unable to create transaction.") + Untranslated(" ") + fail_reason);
|
||||
auto res = CreateTransaction(wallet, recipients, RANDOM_CHANGE_POSITION, new_coin_control, false);
|
||||
if (!res) {
|
||||
errors.push_back(Untranslated("Unable to create transaction.") + Untranslated(" ") + res.GetError());
|
||||
return Result::WALLET_ERROR;
|
||||
}
|
||||
|
||||
const auto& txr = res.GetObj();
|
||||
// Write back new fee if successful
|
||||
new_fee = txr->fee;
|
||||
new_fee = txr.fee;
|
||||
|
||||
// Write back transaction
|
||||
mtx = CMutableTransaction(*txr->tx);
|
||||
mtx = CMutableTransaction(*txr.tx);
|
||||
|
||||
return Result::OK;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user