Removes `hash` from the index, unlinking it from each of its watched keys and pruning any key bucket left empty. Returns the transaction's watch set if it was present.
(&mut self, hash: &TxHash)
| 225 | /// keys and pruning any key bucket left empty. Returns the transaction's |
| 226 | /// watch set if it was present. |
| 227 | pub fn remove(&mut self, hash: &TxHash) -> Option<WatchSet> { |
| 228 | let watch = self.watch_sets.remove(hash)?; |
| 229 | for key in watch.keys() { |
| 230 | if let Some(bucket) = self.by_key.get_mut(key) { |
| 231 | bucket.remove(hash); |
| 232 | if bucket.is_empty() { |
| 233 | self.by_key.remove(key); |
| 234 | if let InvalidationKey::ExpiryBucket(bucket) = key { |
| 235 | self.expiry_buckets.remove(bucket); |
| 236 | } |
| 237 | } |
| 238 | } |
| 239 | } |
| 240 | Some(watch) |
| 241 | } |
| 242 | |
| 243 | /// Returns `true` if `hash` is registered. |
| 244 | #[must_use] |