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