Dedup chain parsing (#2464)

### Description

Missed this by accident from #2249

### Drive-by changes

None

### Related issues

### Backward compatibility

_Are these changes backward compatible?_

Yes

_Are there any infrastructure implications, e.g. changes that would
prohibit deploying older commits using this infra tooling?_

None


### Testing

_What kind of testing have these changes undergone?_

Unit Tests
mattie/inclusive-block-range
Mattie Conover 1 year ago committed by GitHub
parent 420383eb54
commit 16a29edb00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 22
      rust/agents/relayer/src/settings/mod.rs

@ -246,11 +246,7 @@ impl FromRawConf<'_, RawRelayerSettings> for RelayerSettings {
#[allow(deprecated)]
raw.originchainname
}
.map(|s| {
s.split(',')
.map(str::to_ascii_lowercase)
.collect::<Vec<_>>()
});
.map(parse_chains);
if origin_chain_names.is_some() {
warn!(
@ -263,11 +259,7 @@ impl FromRawConf<'_, RawRelayerSettings> for RelayerSettings {
#[allow(deprecated)]
raw.destinationchainnames
}
.map(|r| {
r.split(',')
.map(str::to_ascii_lowercase)
.collect::<Vec<_>>()
});
.map(parse_chains);
if destination_chain_names.is_some() {
warn!(
@ -276,11 +268,7 @@ impl FromRawConf<'_, RawRelayerSettings> for RelayerSettings {
);
}
if let Some(relay_chain_names) = raw.relaychains.map(|r| {
r.split(',')
.map(str::to_ascii_lowercase)
.collect::<Vec<_>>()
}) {
if let Some(relay_chain_names) = raw.relaychains.map(parse_chains) {
if origin_chain_names.is_some() {
err.push(
cwp + "originchainname",
@ -400,3 +388,7 @@ impl FromRawConf<'_, RawRelayerSettings> for RelayerSettings {
fn default_gasfraction() -> String {
"1/2".into()
}
fn parse_chains(chains_str: String) -> Vec<String> {
chains_str.split(',').map(str::to_ascii_lowercase).collect()
}

Loading…
Cancel
Save