Skip to content

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pawanjay176 committed Sep 2, 2020
1 parent ad22178 commit 0e3ccba
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion beacon_node/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ pub fn get_data_dir(cli_args: &ArgMatches) -> PathBuf {
cli_args
.value_of("datadir")
.map(|path| PathBuf::from(path).join(DEFAULT_BEACON_NODE_DIR))
.unwrap_or_else(directory::get_default_base_dir)
.unwrap_or_else(|| directory::get_default_base_dir().join(DEFAULT_BEACON_NODE_DIR))
}

/// Try to parse the eth2 testnet config from the `testnet`, `testnet-dir` flags in that order.
Expand Down
19 changes: 13 additions & 6 deletions common/account_utils/src/validator_definitions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ impl ValidatorDefinitions {

/// Temporary migration script for updating `voting_keystore_path` and `voting_keystore_password_path`
/// in `ValidatorDefinitions`.
/// Warning: This code should be deleted after users migrate to the new directory structure.
pub fn migrate(
&mut self,
old_base_dir: &PathBuf,
Expand All @@ -140,16 +141,22 @@ impl ValidatorDefinitions {
..
} => {
// Update voting keystore path
let remaining = voting_keystore_path
.strip_prefix(old_base_dir)
.map_err(|e| format!("Failed to strip prefix: {}", e))?;
let remaining =
voting_keystore_path
.strip_prefix(old_base_dir)
.map_err(|e| {
format!("Failed to strip prefix for voting keystore path: {}", e)
})?;
*voting_keystore_path = new_base_dir.join(remaining);

// Update voting keystore password path
if let Some(path) = voting_keystore_password_path.as_mut() {
let remaining = path
.strip_prefix(old_base_dir)
.map_err(|e| format!("Failed to strip prefix: {}", e))?;
let remaining = path.strip_prefix(old_base_dir).map_err(|e| {
format!(
"Failed to strip prefix for voting keystore password path: {}",
e
)
})?;
*path = new_base_dir.join(remaining);
}
}
Expand Down

0 comments on commit 0e3ccba

Please sign in to comment.