Skip to content

Commit ee9d211

Browse files
author
vlad
committed
ValidatorList - using HashSet rather than Vec (faster contains())
1 parent c8a6671 commit ee9d211

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

cosmwasm/enclaves/shared/block-verifier/src/validator_whitelist.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use std::collections::HashSet;
12
use tendermint_light_client_verifier::types::UntrustedBlockState;
23

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

1819
#[derive(Debug, Clone)]
19-
struct ValidatorList(pub Vec<String>);
20+
pub struct ValidatorList(pub HashSet<String>);
2021

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

0 commit comments

Comments
 (0)