@@ -617,7 +617,7 @@ util::Result<SelectionResult> SelectCoins(const CWallet& wallet, CoinsResult& av
617
617
}
618
618
619
619
// Start wallet Coin Selection procedure
620
- auto op_selection_result = AutomaticCoinSelection (wallet, available_coins, selection_target, coin_control, coin_selection_params);
620
+ auto op_selection_result = AutomaticCoinSelection (wallet, available_coins, selection_target, coin_selection_params);
621
621
if (!op_selection_result) return op_selection_result;
622
622
623
623
// If needed, add preset inputs to the automatic coin selection result
@@ -632,7 +632,7 @@ util::Result<SelectionResult> SelectCoins(const CWallet& wallet, CoinsResult& av
632
632
return op_selection_result;
633
633
}
634
634
635
- util::Result<SelectionResult> AutomaticCoinSelection (const CWallet& wallet, CoinsResult& available_coins, const CAmount& value_to_select, const CCoinControl& coin_control, const CoinSelectionParams& coin_selection_params)
635
+ util::Result<SelectionResult> AutomaticCoinSelection (const CWallet& wallet, CoinsResult& available_coins, const CAmount& value_to_select, const CoinSelectionParams& coin_selection_params)
636
636
{
637
637
unsigned int limit_ancestor_count = 0 ;
638
638
unsigned int limit_descendant_count = 0 ;
@@ -641,12 +641,10 @@ util::Result<SelectionResult> AutomaticCoinSelection(const CWallet& wallet, Coin
641
641
const size_t max_descendants = (size_t )std::max<int64_t >(1 , limit_descendant_count);
642
642
const bool fRejectLongChains = gArgs .GetBoolArg (" -walletrejectlongchains" , DEFAULT_WALLET_REJECT_LONG_CHAINS);
643
643
644
- // form groups from remaining coins; note that preset coins will not
645
- // automatically have their associated (same address) coins included
646
- if (coin_control.m_avoid_partial_spends && available_coins.Size () > OUTPUT_GROUP_MAX_ENTRIES) {
647
- // Cases where we have 101+ outputs all pointing to the same destination may result in
648
- // privacy leaks as they will potentially be deterministically sorted. We solve that by
649
- // explicitly shuffling the outputs before processing
644
+ // Cases where we have 101+ outputs all pointing to the same destination may result in
645
+ // privacy leaks as they will potentially be deterministically sorted. We solve that by
646
+ // explicitly shuffling the outputs before processing
647
+ if (coin_selection_params.m_avoid_partial_spends && available_coins.Size () > OUTPUT_GROUP_MAX_ENTRIES) {
650
648
available_coins.Shuffle (coin_selection_params.rng_fast );
651
649
}
652
650
@@ -673,7 +671,7 @@ util::Result<SelectionResult> AutomaticCoinSelection(const CWallet& wallet, Coin
673
671
ordered_filters.push_back ({CoinEligibilityFilter (0 , 1 , max_ancestors-1 , max_descendants-1 , /* include_partial=*/ true )});
674
672
// Try with unsafe inputs if they are allowed. This may spend unconfirmed outputs
675
673
// received from other wallets.
676
- if (coin_control .m_include_unsafe_inputs ) {
674
+ if (coin_selection_params .m_include_unsafe_inputs ) {
677
675
ordered_filters.push_back ({CoinEligibilityFilter (/* conf_mine=*/ 0 , /* conf_theirs*/ 0 , max_ancestors-1 , max_descendants-1 , /* include_partial=*/ true )});
678
676
}
679
677
// Try with unlimited ancestors/descendants. The transaction will still need to meet
@@ -804,6 +802,7 @@ static util::Result<CreatedTransactionResult> CreateTransactionInternal(
804
802
805
803
CoinSelectionParams coin_selection_params{rng_fast}; // Parameters for coin selection, init with dummy
806
804
coin_selection_params.m_avoid_partial_spends = coin_control.m_avoid_partial_spends ;
805
+ coin_selection_params.m_include_unsafe_inputs = coin_control.m_include_unsafe_inputs ;
807
806
808
807
// Set the long term feerate estimate to the wallet's consolidate feerate
809
808
coin_selection_params.m_long_term_feerate = wallet.m_consolidate_feerate ;
0 commit comments