Skip to content

Commit

Permalink
ValidatorList - using HashSet rather than Vec (faster contains())
Browse files Browse the repository at this point in the history
  • Loading branch information
vlad committed Oct 27, 2024
1 parent c8a6671 commit ee9d211
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use std::collections::HashSet;
use tendermint_light_client_verifier::types::UntrustedBlockState;

#[cfg(not(feature = "production"))]
Expand All @@ -16,11 +17,11 @@ lazy_static::lazy_static! {
}

#[derive(Debug, Clone)]
struct ValidatorList(pub Vec<String>);
pub struct ValidatorList(pub HashSet<String>);

impl ValidatorList {
fn from_str(list: &str) -> Self {
let addresses: Vec<String> = list.split(',').map(|s| s.to_string()).collect();
let addresses: HashSet<String> = list.split(',').map(|s| s.to_string()).collect();
Self(addresses)
}

Expand Down

0 comments on commit ee9d211

Please sign in to comment.