Merge pull request #3367 from TheBlueMatt/2024-10-dense-counters

Don't bump the `next_node_counter` when using a removed counter
This commit is contained in:
Matt Corallo 2024-10-29 17:48:57 +00:00 committed by GitHub
commit 299b7bd714
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2077,9 +2077,9 @@ where
},
IndexedMapEntry::Vacant(node_entry) => {
let mut removed_node_counters = self.removed_node_counters.lock().unwrap();
**chan_info_node_counter = removed_node_counters
.pop()
.unwrap_or(self.next_node_counter.fetch_add(1, Ordering::Relaxed) as u32);
**chan_info_node_counter = removed_node_counters.pop().unwrap_or_else(|| {
self.next_node_counter.fetch_add(1, Ordering::Relaxed) as u32
});
node_entry.insert(NodeInfo {
channels: vec![short_channel_id],
announcement_info: None,