Uses impl_crds_entry! for SnapshotHashes (#31032)

This commit is contained in:
Brooks 2023-04-04 14:44:05 -04:00 committed by GitHub
parent 911489d373
commit aa8d7de2d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 11 deletions

View File

@ -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 {