Skip to content

Commit 7f1ea70

Browse files
committed
primitives - Config - deserialize whitelisted validators into ValidatorId
1 parent 4f47c8d commit 7f1ea70

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

primitives/src/channel_validator.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,13 @@ pub trait ChannelValidator {
4444
}
4545
}
4646

47-
pub fn all_validators_listed(validators: &SpecValidators, whitelist: &[String]) -> bool {
47+
pub fn all_validators_listed(validators: &SpecValidators, whitelist: &[ValidatorId]) -> bool {
4848
if whitelist.is_empty() {
4949
true
5050
} else {
5151
let found_validators = whitelist
5252
.iter()
53-
.filter_map(|identity| ValidatorId::try_from(identity).ok())
54-
.filter(|allowed| {
53+
.filter(|&allowed| {
5554
allowed == &validators.leader().id || allowed == &validators.follower().id
5655
})
5756
// this will ensure that if we find the 2 validators earlier

primitives/src/config.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::event_submission::RateLimit;
2-
use crate::BigNum;
2+
use crate::{BigNum, ValidatorId};
33
use lazy_static::lazy_static;
44
use serde::{Deserialize, Serialize};
55
use std::fs;
@@ -38,7 +38,7 @@ pub struct Config {
3838
pub token_address_whitelist: Vec<String>,
3939
pub ethereum_core_address: String,
4040
pub ethereum_network: String,
41-
pub validators_whitelist: Vec<String>,
41+
pub validators_whitelist: Vec<ValidatorId>,
4242
}
4343

4444
#[derive(Serialize, Deserialize, Debug, Clone)]

0 commit comments

Comments
 (0)