Skip to content

Commit

Permalink
Update applications/tari_app_utilities/src/network_check.rs
Browse files Browse the repository at this point in the history
Co-authored-by: Cayle Sharrock <[email protected]>
  • Loading branch information
brianp and CjS77 authored Apr 5, 2023
1 parent 0b843e7 commit a3a238f
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions applications/tari_app_utilities/src/network_check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,13 @@ pub const TARGET_NETWORK: Target = Target::NextNet;
pub const TARGET_NETWORK: Target = Target::TestNet;

pub fn is_network_choice_valid(network: Network) -> Result<(), NetworkCheckError> {
match TARGET_NETWORK {
Target::MainNet => match network {
Network::MainNet | Network::StageNet => Ok(()),
_ => Err(NetworkCheckError::MainNetBinary(network)),
},
Target::NextNet => match network {
Network::NextNet => Ok(()),
_ => Err(NetworkCheckError::NextNetBinary(network)),
},
Target::TestNet => match network {
Network::LocalNet | Network::Igor | Network::Esmeralda => Ok(()),
_ => Err(NetworkCheckError::TestNetBinary(network)),
match (TARGET_NETWORK, network) {
(Target::MainNet, Network::MainNet | Network::StageNet) => Ok(()),
(Target::MainNet, _) => Err(NetworkCheckError::MainNetBinary(network)),
(Target::NextNet, Network::NextNet) => Ok(()),
(Target::NextNet, _) => Err(NetworkCheckError::NextNetBinary(network)),
(Target::TestNet, Network::LocalNet | Network::Igor | Network::Esmeralda) => Ok(()),
(Target::TestNet, _) => Err(NetworkCheckError::TestNetBinary(network)),
},
}
}

0 comments on commit a3a238f

Please sign in to comment.