If will_erase is not set, iterating through the cursor will erase spent coins from the map, and other coins will be unflagged (removing them from the linked list). If will_erase is set, the underlying map and linked list will not be modified, as the caller is expected to wipe the entire map anyway. This is an optimization compared to erasing all entries as the cursor iterates them when will_erase is set. Calling CCoinsMap::clear() afterwards is faster because a CoinsCachePair cannot be coerced back into a CCoinsMap::iterator to be erased, and must therefore be looked up again by key in the CCoinsMap before being erased.
Declared in <coins.h>
CoinsViewCacheCursor(
size_t& dirty_count,
CoinsCachePair& sentinel,
CCoinsMap& map,
bool will_erase) noexcept;
| Name | Description |
|---|---|
| dirty_count | Running count of dirty entries, decremented as entries are consumed. |
| sentinel | Sentinel node of the flagged-entry linked list to iterate. |
| map | The coins map whose entries may be erased or unflagged. |
| will_erase | When true, leave the map untouched because the caller will wipe it wholesale. |