Skip to content

Commit

Permalink
Merge pull request #3367 from TheBlueMatt/2024-10-dense-counters
Browse files Browse the repository at this point in the history
Don't bump the `next_node_counter` when using a removed counter
  • Loading branch information
TheBlueMatt authored Oct 29, 2024
2 parents 9e1853f + 0c0cb6f commit 299b7bd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lightning/src/routing/gossip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 299b7bd

Please sign in to comment.