Skip to content

Commit

Permalink
add -c flag; update required node version to 3.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
johanneshahn committed Mar 19, 2022
1 parent 1701a3f commit 66a34b4
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
13 changes: 11 additions & 2 deletions src/bin/epic-wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ use epic_wallet_impls::HTTPNodeClient;
use epic_wallet_util::epic_core as core;
use epic_wallet_util::epic_util as util;
use std::env;

use std::fs;
use std::path::PathBuf;
use epic_wallet::cmd;

// include build information
Expand Down Expand Up @@ -80,7 +81,15 @@ fn real_main() -> i32 {
};

let mut current_dir = None;

if let Some(_path) = args.value_of("current_dir") {
let current_dir_exist = PathBuf::from(&_path);
if !current_dir_exist.exists() {
fs::create_dir_all(current_dir_exist.clone()).unwrap_or_else(|e| {
panic!("Error creating current_dir: {:?}", e);
});
}
current_dir = Some(current_dir_exist);
}
// special cases for certain lifecycle commands
match args.subcommand() {
("init", Some(init_args)) => {
Expand Down
5 changes: 5 additions & 0 deletions src/bin/epic-wallet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ args:
short: t
long: top_level_dir
takes_value: true
- current_dir:
help: Path to epic-wallet dir
short: c
long: current_dir
takes_value: true
- external:
help: Listen on 0.0.0.0 interface to allow external connections (default is 127.0.0.1)
short: e
Expand Down
9 changes: 5 additions & 4 deletions src/cmd/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ use semver::Version;
use std::thread;
use std::time::Duration;

const MIN_COMPAT_NODE_VERSION: &str = "2.0.0-beta.1";

const MIN_COMPAT_NODE_VERSION: &str = "3.0.0";

pub fn wallet_command<C>(
wallet_args: &ArgMatches<'_>,
Expand All @@ -47,13 +48,13 @@ where
// the future. the nodeclient's get_version_info will return 1.0 if
// it gets a 404 for the version function
if Version::parse(&v.node_version) < Version::parse(MIN_COMPAT_NODE_VERSION) {
let version = if v.node_version == "1.0.0" {
"1.x.x series"
let version = if v.node_version == "2.0.0" {
"2.x.x series"
} else {
&v.node_version
};
println!("The Epic Node in use (version {}) is outdated and incompatible with this wallet version.", version);
println!("Please update the node to version 2.0.0 or later and try again.");
println!("Please update the node to version 3.0.0 or later and try again.");
return 1;
}
}
Expand Down

0 comments on commit 66a34b4

Please sign in to comment.