diff --git a/cli/src/cli.rs b/cli/src/cli.rs index 740007021c..15ab5da23d 100644 --- a/cli/src/cli.rs +++ b/cli/src/cli.rs @@ -391,6 +391,7 @@ pub enum CliCommand { VoteUpdateValidator { vote_account_pubkey: Pubkey, new_identity_account: SignerIndex, + withdraw_authority: SignerIndex, }, VoteUpdateCommission { vote_account_pubkey: Pubkey, @@ -2206,11 +2207,13 @@ pub fn process_command(config: &CliConfig) -> ProcessResult { CliCommand::VoteUpdateValidator { vote_account_pubkey, new_identity_account, + withdraw_authority, } => process_vote_update_validator( &rpc_client, config, &vote_account_pubkey, *new_identity_account, + *withdraw_authority, ), CliCommand::VoteUpdateCommission { vote_account_pubkey, @@ -3498,6 +3501,7 @@ mod tests { config.command = CliCommand::VoteUpdateValidator { vote_account_pubkey: bob_pubkey, new_identity_account: 2, + withdraw_authority: 1, }; let result = process_command(&config); assert!(result.is_ok()); @@ -3729,6 +3733,7 @@ mod tests { config.command = CliCommand::VoteUpdateValidator { vote_account_pubkey: bob_pubkey, new_identity_account: 1, + withdraw_authority: 1, }; assert!(process_command(&config).is_err()); diff --git a/cli/src/vote.rs b/cli/src/vote.rs index 20e4d3de49..ec93081742 100644 --- a/cli/src/vote.rs +++ b/cli/src/vote.rs @@ -316,7 +316,8 @@ pub fn parse_vote_update_validator( pubkey_of_signer(matches, "vote_account_pubkey", wallet_manager)?.unwrap(); let (new_identity_account, new_identity_pubkey) = signer_of(matches, "new_identity_account", wallet_manager)?; - let (authorized_withdrawer, _) = signer_of(matches, "authorized_withdrawer", wallet_manager)?; + let (authorized_withdrawer, authorized_withdrawer_pubkey) = + signer_of(matches, "authorized_withdrawer", wallet_manager)?; let payer_provided = None; let signer_info = generate_unique_signers( @@ -330,6 +331,7 @@ pub fn parse_vote_update_validator( command: CliCommand::VoteUpdateValidator { vote_account_pubkey, new_identity_account: signer_info.index_of(new_identity_pubkey).unwrap(), + withdraw_authority: signer_info.index_of(authorized_withdrawer_pubkey).unwrap(), }, signers: signer_info.signers, }) @@ -565,8 +567,9 @@ pub fn process_vote_update_validator( config: &CliConfig, vote_account_pubkey: &Pubkey, new_identity_account: SignerIndex, + withdraw_authority: SignerIndex, ) -> ProcessResult { - let authorized_withdrawer = config.signers[1]; + let authorized_withdrawer = config.signers[withdraw_authority]; let new_identity_account = config.signers[new_identity_account]; let new_identity_pubkey = new_identity_account.pubkey(); check_unique_pubkeys( @@ -971,6 +974,7 @@ mod tests { command: CliCommand::VoteUpdateValidator { vote_account_pubkey: pubkey, new_identity_account: 2, + withdraw_authority: 1, }, signers: vec![ read_keypair_file(&default_keypair_file).unwrap().into(), diff --git a/cli/tests/vote.rs b/cli/tests/vote.rs index 710effca29..d9ab4c49a6 100644 --- a/cli/tests/vote.rs +++ b/cli/tests/vote.rs @@ -125,6 +125,7 @@ fn test_vote_authorize_and_withdraw() { config.command = CliCommand::VoteUpdateValidator { vote_account_pubkey, new_identity_account: 2, + withdraw_authority: 1, }; process_command(&config).unwrap();