mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 06:58:57 +01:00
wallet: CreateTransaction(): return out-params as (optional) struct
This commit is contained in:
@@ -218,21 +218,20 @@ Result CreateRateBumpTransaction(CWallet& wallet, const uint256& txid, const CCo
|
||||
// We cannot source new unconfirmed inputs(bip125 rule 2)
|
||||
new_coin_control.m_min_depth = 1;
|
||||
|
||||
CTransactionRef tx_new;
|
||||
CAmount fee_ret;
|
||||
int change_pos_in_out = -1; // No requested location for change
|
||||
constexpr int RANDOM_CHANGE_POSITION = -1;
|
||||
bilingual_str fail_reason;
|
||||
FeeCalculation fee_calc_out;
|
||||
if (!CreateTransaction(wallet, recipients, tx_new, fee_ret, change_pos_in_out, fail_reason, new_coin_control, fee_calc_out, false)) {
|
||||
std::optional<CreatedTransactionResult> txr = CreateTransaction(wallet, recipients, RANDOM_CHANGE_POSITION, fail_reason, new_coin_control, fee_calc_out, false);
|
||||
if (!txr) {
|
||||
errors.push_back(Untranslated("Unable to create transaction.") + Untranslated(" ") + fail_reason);
|
||||
return Result::WALLET_ERROR;
|
||||
}
|
||||
|
||||
// Write back new fee if successful
|
||||
new_fee = fee_ret;
|
||||
new_fee = txr->fee;
|
||||
|
||||
// Write back transaction
|
||||
mtx = CMutableTransaction(*tx_new);
|
||||
mtx = CMutableTransaction(*txr->tx);
|
||||
|
||||
return Result::OK;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user