383@@ -384,7 +384,7 @@ bool AttemptSelection(const CWallet& wallet, const CAmount& nTargetValue, const
384     std::vector<std::tuple<CAmount, std::set<CInputCoin>, CAmount>> results;
385 
386     // Note that unlike KnapsackSolver, we do not include the fee for creating a change output as BnB will not create a change output.
387-    std::vector<OutputGroup> positive_groups = GroupOutputs(wallet, coins, coin_selection_params, eligibility_filter, true /* positive_only */);
388+    std::vector<OutputGroup> positive_groups = GroupOutputs(wallet, coins, coin_selection_params, eligibility_filter, !coin_selection_params.m_subtract_fee_outputs/* positive_only */);
      
        
        
        
          
          
        
        
        
          
          
            
              
            
              
positive_groups is a misnomer, perhaps rename it non_knapsack_groups?
              
            
           
         
       
    
        
        
        
          
          
        
        
        
          
          
            
              
            
              
Named this to just groups and the groups that KnapsackSolver uses to be knapsack_groups. It’s better for the special case to be named after the special case rather than the normal case to be named as the negation of the special case.