mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-06-29 18:20:58 +02:00
wallet: Use correct effective value when checking target
This commit is contained in:
@ -582,7 +582,13 @@ std::optional<SelectionResult> SelectCoins(const CWallet& wallet, CoinsResult& a
|
|||||||
if (coin_control.HasSelected() && !coin_control.m_allow_other_inputs) {
|
if (coin_control.HasSelected() && !coin_control.m_allow_other_inputs) {
|
||||||
SelectionResult result(nTargetValue, SelectionAlgorithm::MANUAL);
|
SelectionResult result(nTargetValue, SelectionAlgorithm::MANUAL);
|
||||||
result.AddInput(preset_inputs);
|
result.AddInput(preset_inputs);
|
||||||
if (result.GetSelectedValue() < nTargetValue) return std::nullopt;
|
|
||||||
|
if (!coin_selection_params.m_subtract_fee_outputs && result.GetSelectedEffectiveValue() < nTargetValue) {
|
||||||
|
return std::nullopt;
|
||||||
|
} else if (result.GetSelectedValue() < nTargetValue) {
|
||||||
|
return std::nullopt;
|
||||||
|
}
|
||||||
|
|
||||||
result.ComputeAndSetWaste(coin_selection_params.min_viable_change, coin_selection_params.m_cost_of_change, coin_selection_params.m_change_fee);
|
result.ComputeAndSetWaste(coin_selection_params.min_viable_change, coin_selection_params.m_cost_of_change, coin_selection_params.m_change_fee);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user