Skip to content

Commit

Permalink
BFT-457: Doc unique keys
Browse files Browse the repository at this point in the history
  • Loading branch information
aakoshh committed Jun 13, 2024
1 parent 8f7c34c commit 5f7a046
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions node/libs/roles/src/attester/messages/msg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@ impl Committee {
}

/// Compute the sum of weights of as a list of public keys.
///
/// The method assumes that the keys are unique and does not de-duplicate.
pub fn weight_of_keys<'a>(&self, keys: impl Iterator<Item = &'a attester::PublicKey>) -> u64 {
keys.filter_map(|pk| self.index(pk).map(|i| self.vec[i].weight))
.sum()
Expand Down

0 comments on commit 5f7a046

Please sign in to comment.