limits CrdsGossipPull::pull_request_time size (#15793)

There is no pruning logic on CrdsGossipPull::pull_request_time
https://github.com/solana-labs/solana/blob/79ac1997d/core/src/crds_gossip_pull.rs#L172-L174
potentially allowing this to take too much memory.

Additionally, CrdsGossipPush::last_pushed_to is pruning recent push
timestamps:
https://github.com/solana-labs/solana/blob/79ac1997d/core/src/crds_gossip_push.rs#L275-L279
instead of the older ones.

Co-authored-by: Nathan Hawkins <utsl@utsl.org>
This commit is contained in:
behzad nouri
2021-03-24 18:33:56 +00:00
committed by GitHub
parent 7aa65831bc
commit a6c23648cb
5 changed files with 154 additions and 37 deletions

View File

@@ -264,6 +264,11 @@ impl Crds {
.map(move |i| self.table.index(*i))
}
/// Returns number of known pubkeys (network size).
pub(crate) fn num_nodes(&self) -> usize {
self.records.len()
}
pub fn len(&self) -> usize {
self.table.len()
}