diff --git a/cli/src/cli.rs b/cli/src/cli.rs index 15ab5da23d..d7424235d2 100644 --- a/cli/src/cli.rs +++ b/cli/src/cli.rs @@ -367,6 +367,7 @@ pub enum CliCommand { }, // Vote Commands CreateVoteAccount { + vote_account: SignerIndex, seed: Option, identity_account: SignerIndex, authorized_voter: Option, @@ -2157,6 +2158,7 @@ pub fn process_command(config: &CliConfig) -> ProcessResult { // Create vote account CliCommand::CreateVoteAccount { + vote_account, seed, identity_account, authorized_voter, @@ -2165,6 +2167,7 @@ pub fn process_command(config: &CliConfig) -> ProcessResult { } => process_create_vote_account( &rpc_client, config, + *vote_account, seed, *identity_account, authorized_voter, @@ -3476,6 +3479,7 @@ mod tests { let bob_pubkey = bob_keypair.pubkey(); let identity_keypair = Keypair::new(); config.command = CliCommand::CreateVoteAccount { + vote_account: 1, seed: None, identity_account: 2, authorized_voter: Some(bob_pubkey), @@ -3714,6 +3718,7 @@ mod tests { let bob_keypair = Keypair::new(); let identity_keypair = Keypair::new(); config.command = CliCommand::CreateVoteAccount { + vote_account: 1, seed: None, identity_account: 2, authorized_voter: Some(bob_pubkey), diff --git a/cli/src/vote.rs b/cli/src/vote.rs index ec93081742..25c6503e38 100644 --- a/cli/src/vote.rs +++ b/cli/src/vote.rs @@ -249,7 +249,7 @@ pub fn parse_create_vote_account( default_signer_path: &str, wallet_manager: &mut Option>, ) -> Result { - let (vote_account, _) = signer_of(matches, "vote_account", wallet_manager)?; + let (vote_account, vote_account_pubkey) = signer_of(matches, "vote_account", wallet_manager)?; let seed = matches.value_of("seed").map(|s| s.to_string()); let (identity_account, identity_pubkey) = signer_of(matches, "identity_account", wallet_manager)?; @@ -267,6 +267,7 @@ pub fn parse_create_vote_account( Ok(CliCommandInfo { command: CliCommand::CreateVoteAccount { + vote_account: signer_info.index_of(vote_account_pubkey).unwrap(), seed, identity_account: signer_info.index_of(identity_pubkey).unwrap(), authorized_voter, @@ -418,13 +419,14 @@ pub fn parse_withdraw_from_vote_account( pub fn process_create_vote_account( rpc_client: &RpcClient, config: &CliConfig, + vote_account: SignerIndex, seed: &Option, identity_account: SignerIndex, authorized_voter: &Option, authorized_withdrawer: &Option, commission: u8, ) -> ProcessResult { - let vote_account = config.signers[1]; + let vote_account = config.signers[vote_account]; let vote_account_pubkey = vote_account.pubkey(); let vote_account_address = if let Some(seed) = seed { Pubkey::create_with_seed(&vote_account_pubkey, &seed, &solana_vote_program::id())? @@ -857,6 +859,7 @@ mod tests { parse_command(&test_create_vote_account, &default_keypair_file, &mut None).unwrap(), CliCommandInfo { command: CliCommand::CreateVoteAccount { + vote_account: 1, seed: None, identity_account: 2, authorized_voter: None, @@ -885,6 +888,7 @@ mod tests { parse_command(&test_create_vote_account2, &default_keypair_file, &mut None).unwrap(), CliCommandInfo { command: CliCommand::CreateVoteAccount { + vote_account: 1, seed: None, identity_account: 2, authorized_voter: None, @@ -917,6 +921,7 @@ mod tests { parse_command(&test_create_vote_account3, &default_keypair_file, &mut None).unwrap(), CliCommandInfo { command: CliCommand::CreateVoteAccount { + vote_account: 1, seed: None, identity_account: 2, authorized_voter: Some(authed), @@ -947,6 +952,7 @@ mod tests { parse_command(&test_create_vote_account4, &default_keypair_file, &mut None).unwrap(), CliCommandInfo { command: CliCommand::CreateVoteAccount { + vote_account: 1, seed: None, identity_account: 2, authorized_voter: None, diff --git a/cli/tests/stake.rs b/cli/tests/stake.rs index da01c5675d..1975616762 100644 --- a/cli/tests/stake.rs +++ b/cli/tests/stake.rs @@ -58,6 +58,7 @@ fn test_stake_delegation_force() { let vote_keypair = Keypair::new(); config.signers = vec![&default_signer, &vote_keypair]; config.command = CliCommand::CreateVoteAccount { + vote_account: 1, seed: None, identity_account: 0, authorized_voter: None, diff --git a/cli/tests/vote.rs b/cli/tests/vote.rs index d9ab4c49a6..3273adf75f 100644 --- a/cli/tests/vote.rs +++ b/cli/tests/vote.rs @@ -50,6 +50,7 @@ fn test_vote_authorize_and_withdraw() { let vote_account_pubkey = vote_account_keypair.pubkey(); config.signers = vec![&default_signer, &vote_account_keypair]; config.command = CliCommand::CreateVoteAccount { + vote_account: 1, seed: None, identity_account: 0, authorized_voter: None,