Skip to content

Commit

Permalink
Add get_incremental_snapshot_hash_for_node() to gossip
Browse files Browse the repository at this point in the history
Fixes #20377
  • Loading branch information
brooksprumo committed Oct 3, 2021
1 parent 490fc04 commit 3318716
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions gossip/src/cluster_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1115,6 +1115,18 @@ impl ClusterInfo {
Some(map(hashes))
}

pub fn get_incremental_snapshot_hash_for_node<F, Y>(&self, pubkey: &Pubkey, map: F) -> Option<Y>
where
F: FnOnce((Slot, &Vec<(Slot, Hash)>)) -> Y,
{
let gossip_crds = self.gossip.crds.read().unwrap();
let incremental_snapshot_hash = &gossip_crds.get::<&IncrementalSnapshotHash>(*pubkey)?;
Some(map((
incremental_snapshot_hash.base_slot,
incremental_snapshot_hash.hashes,
)))
}

/// Returns epoch-slots inserted since the given cursor.
/// Excludes entries from nodes with unkown or different shred version.
pub fn get_epoch_slots(&self, cursor: &mut Cursor) -> Vec<EpochSlots> {
Expand Down

0 comments on commit 3318716

Please sign in to comment.