mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-07 00:42:42 +00:00
Add support for loading keypairs from file
This commit is contained in:
20
beacon_node/beacon_chain/test_harness/src/gen_keys.rs
Normal file
20
beacon_node/beacon_chain/test_harness/src/gen_keys.rs
Normal file
@@ -0,0 +1,20 @@
|
||||
use clap::{value_t, ArgMatches};
|
||||
use log::debug;
|
||||
use std::path::Path;
|
||||
use types::test_utils::{generate_deterministic_keypairs, KeypairsFile};
|
||||
|
||||
pub fn gen_keys(matches: &ArgMatches) {
|
||||
let validator_count = value_t!(matches.value_of("validator_count"), usize)
|
||||
.expect("Validator count is required argument");
|
||||
let output_file = matches
|
||||
.value_of("output_file")
|
||||
.expect("Output file has a default value.");
|
||||
|
||||
let keypairs = generate_deterministic_keypairs(validator_count);
|
||||
|
||||
debug!("Writing keypairs to file...");
|
||||
|
||||
let keypairs_path = Path::new(output_file);
|
||||
|
||||
keypairs.to_raw_file(&keypairs_path, &keypairs).unwrap();
|
||||
}
|
||||
Reference in New Issue
Block a user