pub async fn add_validator_keystore<P: AsRef<Path>>(
        &self,
        voting_keystore_path: P,
        password: ZeroizeString,
        enable: bool,
        graffiti: Option<GraffitiString>,
    ) -> Result<ValidatorDefinition, String> {
        let mut validator_def = ValidatorDefinition::new_keystore_with_password(
            voting_keystore_path,
            Some(password),
            graffiti.map(Into::into),
        )
        .map_err(|e| format!("failed to create validator definitions: {:?}", e))?;

        self.slashing_protection
            .register_validator(validator_def.voting_public_key.compress())
            .map_err(|e| format!("failed to register validator: {:?}", e))?;

        validator_def.enabled = enable;

        self.validators
            .write()
            .add_definition(validator_def.clone())
            .await
            .map_err(|e| format!("Unable to add definition: {:?}", e))?;

        Ok(validator_def)
    }
/// Insert a new validator to `self`, where the validator is represented by an EIP-2335
/// keystore on the filesystem.
///
/// This function includes:
///
/// - Add the validator definition to the YAML file, saving it to the filesystem.
/// - Enable validator with the slashing protection database.
/// - If `enable == true`, start performing duties for the validator.
Insert a new validator to `self`, where the validator is represented by an EIP-2335
keystore on the filesystem.

This function includes.

Add the validator definition to the YAML file, saving it to the filesystem.
Enable validator with the slashing protection database.
If `enable == true`, start performing duties for the validator.
Insert a new validator to ` self ` where the validator is represented by an EIP - 2335 keystore on the filesystem . This function includes . Add the validator definition to the YAML file saving it to the filesystem . Enable validator with the slashing protection database . If ` enable == true ` start performing duties for the validator .
pub async fn add_validator_keystore<P: AsRef<Path>>(
        &self,
        voting_keystore_path: P,
        password: ZeroizeString,
        enable: bool,
        graffiti: Option<GraffitiString>,
    ) -> Result<ValidatorDefinition, String> {
        let mut validator_def = ValidatorDefinition::new_keystore_with_password(
            voting_keystore_path,
            Some(password),
            graffiti.map(Into::into),
        )
        .map_err(|e| format!("failed to create validator definitions: {:?}", e))?;
        self.slashing_protection
            .register_validator(validator_def.voting_public_key.compress())
            .map_err(|e| format!("failed to register validator: {:?}", e))?;
        validator_def.enabled = enable;
        self.validators
            .write()
            .add_definition(validator_def.clone())
            .await
            .map_err(|e| format!("Unable to add definition: {:?}", e))?;
        Ok(validator_def)
    }
pub async fn add_validator_keystore < P : AsRef < Path > > ( & self , voting_keystore_path : P , password : ZeroizeString , enable : bool , graffiti : Option < GraffitiString > , ) -> Result < ValidatorDefinition , String > { let mut validator_def = ValidatorDefinition :: new_keystore_with_password ( voting_keystore_path , Some ( password ) , graffiti . map ( Into :: into ) , ) . map_err ( | e | format ! ( " " e ) ) ? ; self . slashing_protection . register_validator ( validator_def . voting_public_key . compress ( ) ) . map_err ( | e | format ! ( " " e ) ) ? ; validator_def . enabled = enable ; self . validators . write ( ) . add_definition ( validator_def . clone ( ) ) . await . map_err ( | e | format ! ( " " e ) ) ? ; Ok ( validator_def ) }
Insert a new validator to `self`, where the validator is represented by an EIP-2335
keystore on the filesystem.
Insert a new validator to ` self ` where the validator is represented by an EIP - 2335 keystore on the filesystem .
&self
voting_keystore_path
P
password
ZeroizeString
enable
bool
graffiti
Option<GraffitiString>