Feature/error on noninit (#404)
* More graceful shutdown in case of uninitialised client/node * Performing version check on binary `run`
This commit is contained in:
committed by
GitHub
parent
72e9fb1bc3
commit
7c65101609
@@ -21,7 +21,6 @@ use log::*;
|
||||
use mixnet_client::forwarder::{MixForwardingSender, PacketForwarder};
|
||||
use std::sync::Arc;
|
||||
use tokio::runtime::Runtime;
|
||||
use version_checker::is_minor_version_compatible;
|
||||
|
||||
mod listener;
|
||||
mod metrics;
|
||||
@@ -126,31 +125,8 @@ impl MixNode {
|
||||
}
|
||||
}
|
||||
|
||||
// this only checks compatibility between config the binary. It does not take into consideration
|
||||
// network version. It might do so in the future.
|
||||
fn version_check(&self) -> bool {
|
||||
let binary_version = env!("CARGO_PKG_VERSION");
|
||||
let config_version = self.config.get_version();
|
||||
if binary_version != config_version {
|
||||
warn!("The mixnode binary has different version than what is specified in config file! {} and {}", binary_version, config_version);
|
||||
if is_minor_version_compatible(binary_version, config_version) {
|
||||
info!("but they are still semver compatible. However, consider running the `upgrade` command");
|
||||
true
|
||||
} else {
|
||||
error!("and they are semver incompatible! - please run the `upgrade` command before attempting `run` again");
|
||||
false
|
||||
}
|
||||
} else {
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
pub fn run(&mut self) {
|
||||
info!("Starting nym mixnode");
|
||||
if !self.version_check() {
|
||||
error!("failed the local version check");
|
||||
return;
|
||||
}
|
||||
|
||||
let mut runtime = Runtime::new().unwrap();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user