diff --git a/cli/src/cli.rs b/cli/src/cli.rs index fb584fd434..8060189e41 100644 --- a/cli/src/cli.rs +++ b/cli/src/cli.rs @@ -382,6 +382,7 @@ pub enum CliCommand { }, // Vote Commands CreateVoteAccount { + vote_account: SignerIndex, seed: Option, identity_account: SignerIndex, authorized_voter: Option, @@ -2168,6 +2169,7 @@ pub fn process_command(config: &CliConfig) -> ProcessResult { // Create vote account CliCommand::CreateVoteAccount { + vote_account, seed, identity_account, authorized_voter, @@ -2176,6 +2178,7 @@ pub fn process_command(config: &CliConfig) -> ProcessResult { } => process_create_vote_account( &rpc_client, config, + *vote_account, seed, *identity_account, authorized_voter, @@ -3483,6 +3486,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), @@ -3709,6 +3713,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 2cd042b74b..707ce639e4 100644 --- a/cli/src/vote.rs +++ b/cli/src/vote.rs @@ -273,7 +273,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)?; @@ -291,6 +291,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, @@ -443,13 +444,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())? @@ -820,6 +822,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, @@ -848,6 +851,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, @@ -880,6 +884,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), @@ -910,6 +915,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 101883a170..9ea6b0ebdb 100644 --- a/cli/tests/stake.rs +++ b/cli/tests/stake.rs @@ -68,6 +68,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 71587f534f..d7e87df69b 100644 --- a/cli/tests/vote.rs +++ b/cli/tests/vote.rs @@ -57,6 +57,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,