Skip to content
This repository has been archived by the owner on Jun 25, 2021. It is now read-only.

Commit

Permalink
fix: resolve failing tests after SectionAuthProvider refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
maqi committed May 3, 2021
1 parent 67021d8 commit 3856e2a
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/section/section_authority_provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,14 @@ impl SectionAuthorityProvider {
pub(crate) fn peers(
&'_ self,
) -> impl Iterator<Item = Peer> + DoubleEndedIterator + ExactSizeIterator + Clone + '_ {
self.elders
.iter()
.map(|(name, addr)| Peer::new(*name, *addr))
// The `reachable` flag of Peer is defaulted to `false` during the construction.
// As the SectionAuthorityProvider only holds the list of alive elders, it shall be safe
// to set the flag as true here during the mapping.
self.elders.iter().map(|(name, addr)| {
let mut peer = Peer::new(*name, *addr);
peer.set_reachable(true);
peer
})
}

/// Returns the index of the elder with `name` in this set of elders.
Expand Down

0 comments on commit 3856e2a

Please sign in to comment.