Genesis only needs a keypair, not the entire fullnode::Config

This commit is contained in:
Michael Vines 2018-12-06 14:01:25 -08:00
parent 8f0a1e32d5
commit f4b26247c0
2 changed files with 11 additions and 11 deletions

View File

@ -99,7 +99,7 @@ if $node_type_leader; then
$solana_genesis \ $solana_genesis \
--num_tokens "$num_tokens" \ --num_tokens "$num_tokens" \
--mint "$mint_id_path" \ --mint "$mint_id_path" \
--bootstrap_leader "$SOLANA_CONFIG_DIR"/leader.json \ --bootstrap-leader-keypair "$leader_id_path" \
--ledger "$SOLANA_CONFIG_DIR"/ledger \ --ledger "$SOLANA_CONFIG_DIR"/ledger \
ls -lhR "$SOLANA_CONFIG_DIR"/ ls -lhR "$SOLANA_CONFIG_DIR"/

View File

@ -9,10 +9,9 @@ extern crate solana_sdk;
extern crate untrusted; extern crate untrusted;
use clap::{App, Arg}; use clap::{App, Arg};
use solana::fullnode::Config;
use solana::ledger::LedgerWriter; use solana::ledger::LedgerWriter;
use solana::mint::Mint; use solana::mint::Mint;
use solana_sdk::signature::KeypairUtil; use solana_sdk::signature::{read_keypair, KeypairUtil};
use std::error; use std::error;
use std::fs::File; use std::fs::File;
use std::path::Path; use std::path::Path;
@ -44,13 +43,13 @@ fn main() -> Result<(), Box<error::Error>> {
.required(true) .required(true)
.help("Path to file containing keys of the mint"), .help("Path to file containing keys of the mint"),
).arg( ).arg(
Arg::with_name("bootstrap_leader") Arg::with_name("bootstrap-leader-keypair")
.short("b") .short("b")
.long("bootstrap_leader") .long("bootstrap-leader-keypair")
.value_name("BOOTSTRAP LEADER") .value_name("BOOTSTRAP LEADER KEYPAIR")
.takes_value(true) .takes_value(true)
.required(true) .required(true)
.help("Path to file containing keys of the bootstrap leader"), .help("Path to file containing the bootstrap leader's keypair"),
).arg( ).arg(
Arg::with_name("ledger") Arg::with_name("ledger")
.short("l") .short("l")
@ -61,10 +60,11 @@ fn main() -> Result<(), Box<error::Error>> {
.help("Use directory as persistent ledger location"), .help("Use directory as persistent ledger location"),
).get_matches(); ).get_matches();
// Parse the input leader configuration // Load the bootstreap leader keypair
let file = File::open(Path::new(&matches.value_of("bootstrap_leader").unwrap())).unwrap(); // TODO: Only the public key is really needed, genesis should not have access to the leader's
let leader_config: Config = serde_json::from_reader(file).unwrap(); // secret key.
let leader_keypair = leader_config.keypair(); let leader_keypair = read_keypair(matches.value_of("bootstrap-leader-keypair").unwrap())
.expect("failed to read bootstrap leader keypair");
// Parse the input mint configuration // Parse the input mint configuration
let num_tokens = value_t_or_exit!(matches, "num_tokens", u64); let num_tokens = value_t_or_exit!(matches, "num_tokens", u64);