mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-07 00:42:42 +00:00
Ensure password dir exists in val dir builder
This commit is contained in:
1
Cargo.lock
generated
1
Cargo.lock
generated
@@ -7345,6 +7345,7 @@ dependencies = [
|
|||||||
"bls",
|
"bls",
|
||||||
"deposit_contract",
|
"deposit_contract",
|
||||||
"derivative",
|
"derivative",
|
||||||
|
"directory",
|
||||||
"eth2_keystore",
|
"eth2_keystore",
|
||||||
"filesystem",
|
"filesystem",
|
||||||
"hex",
|
"hex",
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ tree_hash = "0.4.1"
|
|||||||
hex = "0.4.2"
|
hex = "0.4.2"
|
||||||
derivative = "2.1.1"
|
derivative = "2.1.1"
|
||||||
lockfile = { path = "../lockfile" }
|
lockfile = { path = "../lockfile" }
|
||||||
|
directory = { path = "../directory" }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
tempfile = "3.1.0"
|
tempfile = "3.1.0"
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
use crate::{Error as DirError, ValidatorDir};
|
use crate::{Error as DirError, ValidatorDir};
|
||||||
use bls::get_withdrawal_credentials;
|
use bls::get_withdrawal_credentials;
|
||||||
use deposit_contract::{encode_eth1_tx_data, Error as DepositError};
|
use deposit_contract::{encode_eth1_tx_data, Error as DepositError};
|
||||||
|
use directory::ensure_dir_exists;
|
||||||
use eth2_keystore::{Error as KeystoreError, Keystore, KeystoreBuilder, PlainText};
|
use eth2_keystore::{Error as KeystoreError, Keystore, KeystoreBuilder, PlainText};
|
||||||
use filesystem::create_with_600_perms;
|
use filesystem::create_with_600_perms;
|
||||||
use rand::{distributions::Alphanumeric, Rng};
|
use rand::{distributions::Alphanumeric, Rng};
|
||||||
@@ -41,6 +42,7 @@ pub enum Error {
|
|||||||
#[cfg(feature = "insecure_keys")]
|
#[cfg(feature = "insecure_keys")]
|
||||||
InsecureKeysError(String),
|
InsecureKeysError(String),
|
||||||
MissingPasswordDir,
|
MissingPasswordDir,
|
||||||
|
UnableToCreatePasswordDir(String),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<KeystoreError> for Error {
|
impl From<KeystoreError> for Error {
|
||||||
@@ -160,6 +162,10 @@ impl<'a> Builder<'a> {
|
|||||||
create_dir_all(&dir).map_err(Error::UnableToCreateDir)?;
|
create_dir_all(&dir).map_err(Error::UnableToCreateDir)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if let Some(password_dir) = &self.password_dir {
|
||||||
|
ensure_dir_exists(password_dir).map_err(Error::UnableToCreatePasswordDir)?;
|
||||||
|
}
|
||||||
|
|
||||||
// The withdrawal keystore must be initialized in order to store it or create an eth1
|
// The withdrawal keystore must be initialized in order to store it or create an eth1
|
||||||
// deposit.
|
// deposit.
|
||||||
if (self.store_withdrawal_keystore || self.deposit_info.is_some())
|
if (self.store_withdrawal_keystore || self.deposit_info.is_some())
|
||||||
|
|||||||
Reference in New Issue
Block a user