Skip to content

Commit 76b79c1

Browse files
committed
wallet: Use correct effective value when checking target
1 parent 291e363 commit 76b79c1

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/wallet/spend.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,13 @@ std::optional<SelectionResult> SelectCoins(const CWallet& wallet, CoinsResult& a
582582
if (coin_control.HasSelected() && !coin_control.m_allow_other_inputs) {
583583
SelectionResult result(nTargetValue, SelectionAlgorithm::MANUAL);
584584
result.AddInput(preset_inputs);
585-
if (result.GetSelectedValue() < nTargetValue) return std::nullopt;
585+
586+
if (!coin_selection_params.m_subtract_fee_outputs && result.GetSelectedEffectiveValue() < nTargetValue) {
587+
return std::nullopt;
588+
} else if (result.GetSelectedValue() < nTargetValue) {
589+
return std::nullopt;
590+
}
591+
586592
result.ComputeAndSetWaste(coin_selection_params.min_viable_change, coin_selection_params.m_cost_of_change, coin_selection_params.m_change_fee);
587593
return result;
588594
}

0 commit comments

Comments
 (0)