Skip to content

Commit

Permalink
Uses impl_crds_entry! for SnapshotHashes
Browse files Browse the repository at this point in the history
  • Loading branch information
brooksprumo committed Apr 3, 2023
1 parent 399b7ba commit 0e37b57
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions gossip/src/crds_entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,23 +57,17 @@ impl_crds_entry!(LegacyContactInfo, CrdsData::LegacyContactInfo(node), node);
impl_crds_entry!(LegacyVersion, CrdsData::LegacyVersion(version), version);
impl_crds_entry!(LowestSlot, CrdsData::LowestSlot(_, slot), slot);
impl_crds_entry!(Version, CrdsData::Version(version), version);
impl_crds_entry!(
SnapshotHashes,
CrdsData::SnapshotHashes(snapshot_hashes),
snapshot_hashes
);
impl_crds_entry!(
IncrementalSnapshotHashes,
CrdsData::IncrementalSnapshotHashes(incremental_snapshot_hashes),
incremental_snapshot_hashes
);

impl<'a, 'b> CrdsEntry<'a, 'b> for &'a SnapshotHashes {
type Key = Pubkey;
fn get_entry(table: &'a CrdsTable, key: Self::Key) -> Option<Self> {
let key = CrdsValueLabel::SnapshotHashes(key);
match &table.get(&key)?.value.data {
CrdsData::SnapshotHashes(snapshot_hash) => Some(snapshot_hash),
_ => None,
}
}
}

#[cfg(test)]
mod tests {
use {
Expand Down

0 comments on commit 0e37b57

Please sign in to comment.