Strip new lines in validator create (#1214)
This commit is contained in:
parent
6383c95f8b
commit
7d897a0519
@ -49,8 +49,7 @@ pub fn strip_off_newlines(mut bytes: Vec<u8>) -> Vec<u8> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
bytes.truncate(bytes.len() - strip_off);
|
bytes.truncate(bytes.len() - strip_off);
|
||||||
|
bytes
|
||||||
bytes.to_vec()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use crate::{
|
use crate::{
|
||||||
common::{ensure_dir_exists, random_password},
|
common::{ensure_dir_exists, random_password, strip_off_newlines},
|
||||||
SECRETS_DIR_FLAG, VALIDATOR_DIR_FLAG,
|
SECRETS_DIR_FLAG, VALIDATOR_DIR_FLAG,
|
||||||
};
|
};
|
||||||
use clap::{App, Arg, ArgMatches};
|
use clap::{App, Arg, ArgMatches};
|
||||||
@ -155,7 +155,7 @@ pub fn cli_run<T: EthSpec>(
|
|||||||
|
|
||||||
let wallet_password = fs::read(&wallet_password_path)
|
let wallet_password = fs::read(&wallet_password_path)
|
||||||
.map_err(|e| format!("Unable to read {:?}: {:?}", wallet_password_path, e))
|
.map_err(|e| format!("Unable to read {:?}: {:?}", wallet_password_path, e))
|
||||||
.map(|bytes| PlainText::from(bytes))?;
|
.map(|bytes| PlainText::from(strip_off_newlines(bytes)))?;
|
||||||
|
|
||||||
let mgr = WalletManager::open(&wallet_base_dir)
|
let mgr = WalletManager::open(&wallet_base_dir)
|
||||||
.map_err(|e| format!("Unable to open --{}: {:?}", BASE_DIR_FLAG, e))?;
|
.map_err(|e| format!("Unable to open --{}: {:?}", BASE_DIR_FLAG, e))?;
|
||||||
|
@ -107,10 +107,7 @@ pub fn cli_run(matches: &ArgMatches, base_dir: PathBuf) -> Result<(), String> {
|
|||||||
|
|
||||||
let wallet_password = fs::read(&wallet_password_path)
|
let wallet_password = fs::read(&wallet_password_path)
|
||||||
.map_err(|e| format!("Unable to read {:?}: {:?}", wallet_password_path, e))
|
.map_err(|e| format!("Unable to read {:?}: {:?}", wallet_password_path, e))
|
||||||
.map(|bytes| {
|
.map(|bytes| PlainText::from(strip_off_newlines(bytes)))?;
|
||||||
let bytes = strip_off_newlines(bytes);
|
|
||||||
PlainText::from(bytes)
|
|
||||||
})?;
|
|
||||||
|
|
||||||
let wallet = mgr
|
let wallet = mgr
|
||||||
.create_wallet(name, wallet_type, &mnemonic, wallet_password.as_bytes())
|
.create_wallet(name, wallet_type, &mnemonic, wallet_password.as_bytes())
|
||||||
|
Loading…
Reference in New Issue
Block a user