Ensure the validator's identity pubkey is not provided as a --trusted-validator (#8525)

automerge
This commit is contained in:
Michael Vines 2020-02-27 21:26:53 -07:00 committed by GitHub
parent 35db70a56c
commit 74da2de3b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 2 deletions

View File

@ -847,8 +847,18 @@ pub fn main() {
});
let trusted_validators = if matches.is_present("trusted_validators") {
let trusted_validators = values_t_or_exit!(matches, "trusted_validators", Pubkey);
Some(trusted_validators.into_iter().collect())
let trusted_validators: HashSet<_> =
values_t_or_exit!(matches, "trusted_validators", Pubkey)
.into_iter()
.collect();
if trusted_validators.contains(&identity_keypair.pubkey()) {
eprintln!(
"The validator's identity pubkey cannot be a --trusted-validator: {}",
identity_keypair.pubkey()
);
exit(1);
}
Some(trusted_validators)
} else {
None
};