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() {
102
102
coins.clear ();
103
103
}
104
104
105
- void CoinsResult::Erase (std::set <COutPoint>& preset_coins )
105
+ void CoinsResult::Erase (const std::unordered_set <COutPoint, SaltedOutpointHasher >& coins_to_remove )
106
106
{
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 ());
114
112
}
115
113
}
116
114
Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ struct CoinsResult {
47
47
* i.e., methods can work with individual OutputType vectors or on the entire object */
48
48
size_t Size () const ;
49
49
void Clear ();
50
- void Erase (std::set <COutPoint>& preset_coins );
50
+ void Erase (const std::unordered_set <COutPoint, SaltedOutpointHasher >& coins_to_remove );
51
51
void Shuffle (FastRandomContext& rng_fast);
52
52
void Add (OutputType type, const COutput& out);
53
53
You can’t perform that action at this time.
0 commit comments