encapsulates purged values bookkeeping into crds module (#17265)
For all code paths (gossip push, pull, purge, etc) that remove or override a crds value, it is necessary to record hash of values purged from crds table, in order to exclude them from subsequent pull-requests; otherwise the next pull request will likely return outdated values, wasting bandwidth: https://github.com/solana-labs/solana/blob/ed51cde37/core/src/crds_gossip_pull.rs#L486-L491 Currently this is done all over the place in multiple modules, and this has caused bugs in the past where purged values were not recorded. This commit encapsulated this bookkeeping into crds module, so that any code path which removes or overrides a crds value, also records the hash of purged value in-place.
This commit is contained in:
@ -351,17 +351,14 @@ fn network_run_push(
|
||||
for (to, msgs) in push_messages {
|
||||
bytes += serialized_size(&msgs).unwrap() as usize;
|
||||
num_msgs += 1;
|
||||
let updated = network
|
||||
let origins: HashSet<_> = network
|
||||
.get(&to)
|
||||
.map(|node| {
|
||||
node.lock()
|
||||
.unwrap()
|
||||
.process_push_message(&from, msgs.clone(), now)
|
||||
})
|
||||
.unwrap();
|
||||
|
||||
let origins: HashSet<_> =
|
||||
updated.into_iter().map(|u| u.value.pubkey()).collect();
|
||||
.unwrap()
|
||||
.lock()
|
||||
.unwrap()
|
||||
.process_push_message(&from, msgs.clone(), now)
|
||||
.into_iter()
|
||||
.collect();
|
||||
let prunes_map = network
|
||||
.get(&to)
|
||||
.map(|node| node.lock().unwrap().prune_received_cache(origins, &stakes))
|
||||
|
Reference in New Issue
Block a user