@@ -99,7 +99,7 @@ FUZZ_TARGET(coinselection)
99
99
}
100
100
101
101
// Run coinselection algorithms
102
- const auto result_bnb = SelectCoinsBnB (group_pos, target, cost_of_change, MAX_STANDARD_TX_WEIGHT);
102
+ auto result_bnb = SelectCoinsBnB (group_pos, target, cost_of_change, MAX_STANDARD_TX_WEIGHT);
103
103
104
104
auto result_srd = SelectCoinsSRD (group_pos, target, coin_params.m_change_fee , fast_random_context, MAX_STANDARD_TX_WEIGHT);
105
105
if (result_srd) {
@@ -116,6 +116,22 @@ FUZZ_TARGET(coinselection)
116
116
if (total_balance >= target && subtract_fee_outputs && !HasErrorMsg (result_knapsack)) {
117
117
assert (result_knapsack);
118
118
}
119
+
120
+ std::vector<COutput> utxos;
121
+ std::vector<util::Result<SelectionResult>> results{result_srd, result_knapsack, result_bnb};
122
+ CAmount new_total_balance{CreateCoins (fuzzed_data_provider, utxos, coin_params, next_locktime)};
123
+ if (new_total_balance > 0 ) {
124
+ std::set<std::shared_ptr<COutput>> new_utxo_pool;
125
+ for (const auto & utxo : utxos) {
126
+ new_utxo_pool.insert (std::make_shared<COutput>(utxo));
127
+ }
128
+ for (auto & result : results) {
129
+ if (!result) continue ;
130
+ const auto weight{result->GetWeight ()};
131
+ result->AddInputs (new_utxo_pool, subtract_fee_outputs);
132
+ assert (result->GetWeight () > weight);
133
+ }
134
+ }
119
135
}
120
136
121
137
} // namespace wallet
0 commit comments