Retain trusted peer snapshot hashes bugfix (#21077)
When retaining trusted peer snapshot hashes, and the peer's full snapshot hashes match a trusted snapshot hash, but the peer doesn't have incremental snapshot hashes, that's fine; the peer's hashes should be retained, not discarded.
This commit is contained in:
parent
32a242e777
commit
9d07746642
|
@ -1276,7 +1276,9 @@ mod with_incremental_snapshots {
|
|||
.get(&peer_snapshot_hash.snapshot_hash.full)
|
||||
.map(|trusted_incremental_hashes| {
|
||||
if peer_snapshot_hash.snapshot_hash.incr.is_none() {
|
||||
false
|
||||
// If the peer's full snapshot hashes match, but doesn't have any
|
||||
// incremental snapshots, that's fine; keep 'em!
|
||||
true
|
||||
} else {
|
||||
trusted_incremental_hashes
|
||||
.contains(peer_snapshot_hash.snapshot_hash.incr.as_ref().unwrap())
|
||||
|
@ -1700,11 +1702,14 @@ mod with_incremental_snapshots {
|
|||
),
|
||||
];
|
||||
|
||||
let expected = vec![PeerSnapshotHash::new(
|
||||
contact_info,
|
||||
*trusted_full_snapshot_hash,
|
||||
Some(*trusted_incremental_snapshot_hash),
|
||||
)];
|
||||
let expected = vec![
|
||||
PeerSnapshotHash::new(contact_info.clone(), *trusted_full_snapshot_hash, None),
|
||||
PeerSnapshotHash::new(
|
||||
contact_info,
|
||||
*trusted_full_snapshot_hash,
|
||||
Some(*trusted_incremental_snapshot_hash),
|
||||
),
|
||||
];
|
||||
let mut actual = peer_snapshot_hashes;
|
||||
retain_trusted_peer_snapshot_hashes(&trusted_snapshot_hashes, &mut actual);
|
||||
assert_eq!(expected, actual);
|
||||
|
|
Loading…
Reference in New Issue