Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(node): evm network initialization logic #8

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions ant-node/src/bin/antnode/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,16 +262,17 @@ fn main() -> Result<()> {
return Ok(());
}

let evm_network: EvmNetwork = if opt.peers.local {
println!("Running node in local mode");
local_evm_network_from_csv()?
} else {
opt.evm_network
.as_ref()
.cloned()
.map(|v| Ok(v.into()))
.unwrap_or_else(get_evm_network_from_env)?
};
let evm_network: EvmNetwork = match opt.evm_network.as_ref() {
Some(evm_network) => Ok(evm_network.clone().into()),
None => match get_evm_network_from_env() {
Ok(evm_network) => Ok(evm_network),
Err(_) if opt.peers.local => Ok(local_evm_network_from_csv()?),
Err(_) => Err(eyre!(
"EVM network not specified. Please specify a network using the subcommand or by setting the `EVM_NETWORK` environment variable."
)),
},
}?;

println!("EVM network: {evm_network:?}");

let node_socket_addr = SocketAddr::new(opt.ip, opt.port);
Expand Down
Loading