mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-10 20:03:34 -03:00
wallet: compute waste for SelectionResults of preset inputs
When we use only manually specified inputs, we should still calculate the waste so that if anything later on calls GetWaste (in order to log it), there won't be an error.
This commit is contained in:
parent
912f1ed181
commit
15b58383d0
1 changed files with 4 additions and 0 deletions
|
@ -438,6 +438,7 @@ std::optional<SelectionResult> SelectCoins(const CWallet& wallet, const std::vec
|
|||
SelectionResult result(nTargetValue, SelectionAlgorithm::MANUAL);
|
||||
result.AddInput(preset_inputs);
|
||||
if (result.GetSelectedValue() < nTargetValue) return std::nullopt;
|
||||
result.ComputeAndSetWaste(coin_selection_params.m_cost_of_change);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -573,6 +574,9 @@ std::optional<SelectionResult> SelectCoins(const CWallet& wallet, const std::vec
|
|||
|
||||
// Add preset inputs to result
|
||||
res->AddInput(preset_inputs);
|
||||
if (res->m_algo == SelectionAlgorithm::MANUAL) {
|
||||
res->ComputeAndSetWaste(coin_selection_params.m_cost_of_change);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue