File tree Expand file tree Collapse file tree 2 files changed +7
-9
lines changed
Expand file tree Collapse file tree 2 files changed +7
-9
lines changed Original file line number Diff line number Diff line change @@ -102,15 +102,13 @@ void CoinsResult::Clear() {
102102 coins.clear ();
103103}
104104
105- void CoinsResult::Erase (std::set <COutPoint>& preset_coins )
105+ void CoinsResult::Erase (const std::unordered_set <COutPoint, SaltedOutpointHasher >& coins_to_remove )
106106{
107- for (auto & it : coins) {
108- auto & vec = it.second ;
109- auto i = std::find_if (vec.begin (), vec.end (), [&](const COutput &c) { return preset_coins.count (c.outpoint );});
110- if (i != vec.end ()) {
111- vec.erase (i);
112- break ;
113- }
107+ for (auto & [type, vec] : coins) {
108+ auto remove_it = std::remove_if (vec.begin (), vec.end (), [&](const COutput& coin) {
109+ return coins_to_remove.count (coin.outpoint ) == 1 ;
110+ });
111+ vec.erase (remove_it, vec.end ());
114112 }
115113}
116114
Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ struct CoinsResult {
4747 * i.e., methods can work with individual OutputType vectors or on the entire object */
4848 size_t Size () const ;
4949 void Clear ();
50- void Erase (std::set <COutPoint>& preset_coins );
50+ void Erase (const std::unordered_set <COutPoint, SaltedOutpointHasher >& coins_to_remove );
5151 void Shuffle (FastRandomContext& rng_fast);
5252 void Add (OutputType type, const COutput& out);
5353
You can’t perform that action at this time.
0 commit comments