From 4614d49f5c82cbf9458299a39f8dab169c08f4d5 Mon Sep 17 00:00:00 2001 From: Samuel Dare Date: Wed, 10 Jan 2024 23:20:39 +0000 Subject: [PATCH] fix: push keys to key_pair vector --- core/cli/src/args/generate_keypair.rs | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/core/cli/src/args/generate_keypair.rs b/core/cli/src/args/generate_keypair.rs index 28ba87cbd..12b009c2e 100644 --- a/core/cli/src/args/generate_keypair.rs +++ b/core/cli/src/args/generate_keypair.rs @@ -21,7 +21,7 @@ pub struct GenerateKeypairArgs { help = "The number of keypairs to generate.", default_value = "1" )] - pub num: usize, + pub num: usize, #[arg( short = 'p', long = "path", @@ -46,7 +46,7 @@ impl GenerateKeypairArgs { key_pair.bls_private_key.as_bytes(), i, )?; - keypairs.push(Keypair::generate(i)?); + keypairs.push(key_pair); } println!( @@ -60,13 +60,13 @@ impl GenerateKeypairArgs { #[derive(Serialize, Clone, Debug)] pub struct Keypair { - pub index: usize, + pub index: usize, pub net_private_key: Hex, - pub public_key: Hex, - pub address: Address, - pub peer_id: String, + pub public_key: Hex, + pub address: Address, + pub peer_id: String, pub bls_private_key: Hex, - pub bls_public_key: Hex, + pub bls_public_key: Hex, } impl Keypair { @@ -90,13 +90,13 @@ impl Keypair { let bls_pub_key = bls_priv_key.pub_key(&String::new()); Ok(Keypair { - index: i, + index: i, net_private_key: Hex::encode(&net_seckey), - public_key: Hex::encode(&pubkey), - address: Address::from_pubkey_bytes(pubkey).map_err(Error::Running)?, - peer_id: secio_keypair.public_key().peer_id().to_base58(), + public_key: Hex::encode(&pubkey), + address: Address::from_pubkey_bytes(pubkey).map_err(Error::Running)?, + peer_id: secio_keypair.public_key().peer_id().to_base58(), bls_private_key: Hex::encode(&bls_seckey), - bls_public_key: Hex::encode(bls_pub_key.to_bytes()), + bls_public_key: Hex::encode(bls_pub_key.to_bytes()), }) }