CLI: Fix explicitly plumb withdraw_authority through vote-update-commission
(cherry picked from commit 3392ecc310
)
This commit is contained in:
committed by
Trent Nelson
parent
d6ea4f50c9
commit
6666e54a1f
@ -411,6 +411,7 @@ pub enum CliCommand {
|
|||||||
VoteUpdateCommission {
|
VoteUpdateCommission {
|
||||||
vote_account_pubkey: Pubkey,
|
vote_account_pubkey: Pubkey,
|
||||||
commission: u8,
|
commission: u8,
|
||||||
|
withdraw_authority: SignerIndex,
|
||||||
},
|
},
|
||||||
// Wallet Commands
|
// Wallet Commands
|
||||||
Address,
|
Address,
|
||||||
@ -2227,7 +2228,14 @@ pub fn process_command(config: &CliConfig) -> ProcessResult {
|
|||||||
CliCommand::VoteUpdateCommission {
|
CliCommand::VoteUpdateCommission {
|
||||||
vote_account_pubkey,
|
vote_account_pubkey,
|
||||||
commission,
|
commission,
|
||||||
} => process_vote_update_commission(&rpc_client, config, &vote_account_pubkey, *commission),
|
withdraw_authority,
|
||||||
|
} => process_vote_update_commission(
|
||||||
|
&rpc_client,
|
||||||
|
config,
|
||||||
|
&vote_account_pubkey,
|
||||||
|
*commission,
|
||||||
|
*withdraw_authority,
|
||||||
|
),
|
||||||
|
|
||||||
// Wallet Commands
|
// Wallet Commands
|
||||||
|
|
||||||
|
@ -366,7 +366,8 @@ pub fn parse_vote_update_commission(
|
|||||||
) -> Result<CliCommandInfo, CliError> {
|
) -> Result<CliCommandInfo, CliError> {
|
||||||
let vote_account_pubkey =
|
let vote_account_pubkey =
|
||||||
pubkey_of_signer(matches, "vote_account_pubkey", wallet_manager)?.unwrap();
|
pubkey_of_signer(matches, "vote_account_pubkey", wallet_manager)?.unwrap();
|
||||||
let (authorized_withdrawer, _) = signer_of(matches, "authorized_withdrawer", wallet_manager)?;
|
let (authorized_withdrawer, authorized_withdrawer_pubkey) =
|
||||||
|
signer_of(matches, "authorized_withdrawer", wallet_manager)?;
|
||||||
let commission = value_t_or_exit!(matches, "commission", u8);
|
let commission = value_t_or_exit!(matches, "commission", u8);
|
||||||
|
|
||||||
let payer_provided = None;
|
let payer_provided = None;
|
||||||
@ -381,6 +382,7 @@ pub fn parse_vote_update_commission(
|
|||||||
command: CliCommand::VoteUpdateCommission {
|
command: CliCommand::VoteUpdateCommission {
|
||||||
vote_account_pubkey,
|
vote_account_pubkey,
|
||||||
commission,
|
commission,
|
||||||
|
withdraw_authority: signer_info.index_of(authorized_withdrawer_pubkey).unwrap(),
|
||||||
},
|
},
|
||||||
signers: signer_info.signers,
|
signers: signer_info.signers,
|
||||||
})
|
})
|
||||||
@ -597,8 +599,9 @@ pub fn process_vote_update_commission(
|
|||||||
config: &CliConfig,
|
config: &CliConfig,
|
||||||
vote_account_pubkey: &Pubkey,
|
vote_account_pubkey: &Pubkey,
|
||||||
commission: u8,
|
commission: u8,
|
||||||
|
withdraw_authority: SignerIndex,
|
||||||
) -> ProcessResult {
|
) -> ProcessResult {
|
||||||
let authorized_withdrawer = config.signers[1];
|
let authorized_withdrawer = config.signers[withdraw_authority];
|
||||||
let (recent_blockhash, fee_calculator) = rpc_client.get_recent_blockhash()?;
|
let (recent_blockhash, fee_calculator) = rpc_client.get_recent_blockhash()?;
|
||||||
let ixs = vec![vote_instruction::update_commission(
|
let ixs = vec![vote_instruction::update_commission(
|
||||||
vote_account_pubkey,
|
vote_account_pubkey,
|
||||||
@ -953,6 +956,7 @@ mod tests {
|
|||||||
command: CliCommand::VoteUpdateCommission {
|
command: CliCommand::VoteUpdateCommission {
|
||||||
vote_account_pubkey: pubkey,
|
vote_account_pubkey: pubkey,
|
||||||
commission: 42,
|
commission: 42,
|
||||||
|
withdraw_authority: 1,
|
||||||
},
|
},
|
||||||
signers: vec![
|
signers: vec![
|
||||||
read_keypair_file(&default_keypair_file).unwrap().into(),
|
read_keypair_file(&default_keypair_file).unwrap().into(),
|
||||||
|
Reference in New Issue
Block a user