Error cleanly on show vote/stake/storage account pubkey mismatch (#5289)
Also deverb vote/stake account variables
This commit is contained in:
		@@ -197,7 +197,7 @@ pub fn parse_command(
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        ("create-vote-account", Some(matches)) => {
 | 
			
		||||
            let voting_account_pubkey = value_of(matches, "voting_account_pubkey").unwrap();
 | 
			
		||||
            let vote_account_pubkey = value_of(matches, "vote_account_pubkey").unwrap();
 | 
			
		||||
            let node_pubkey = value_of(matches, "node_pubkey").unwrap();
 | 
			
		||||
            let commission = if let Some(commission) = matches.value_of("commission") {
 | 
			
		||||
                commission.parse()?
 | 
			
		||||
@@ -206,68 +206,65 @@ pub fn parse_command(
 | 
			
		||||
            };
 | 
			
		||||
            let lamports = matches.value_of("lamports").unwrap().parse()?;
 | 
			
		||||
            Ok(WalletCommand::CreateVoteAccount(
 | 
			
		||||
                voting_account_pubkey,
 | 
			
		||||
                vote_account_pubkey,
 | 
			
		||||
                node_pubkey,
 | 
			
		||||
                commission,
 | 
			
		||||
                lamports,
 | 
			
		||||
            ))
 | 
			
		||||
        }
 | 
			
		||||
        ("authorize-voter", Some(matches)) => {
 | 
			
		||||
            let voting_account_pubkey = value_of(matches, "voting_account_pubkey").unwrap();
 | 
			
		||||
            let vote_account_pubkey = value_of(matches, "vote_account_pubkey").unwrap();
 | 
			
		||||
            let authorized_voter_keypair =
 | 
			
		||||
                keypair_of(matches, "authorized_voter_keypair_file").unwrap();
 | 
			
		||||
            let new_authorized_voter_pubkey =
 | 
			
		||||
                value_of(matches, "new_authorized_voter_pubkey").unwrap();
 | 
			
		||||
 | 
			
		||||
            Ok(WalletCommand::AuthorizeVoter(
 | 
			
		||||
                voting_account_pubkey,
 | 
			
		||||
                vote_account_pubkey,
 | 
			
		||||
                authorized_voter_keypair,
 | 
			
		||||
                new_authorized_voter_pubkey,
 | 
			
		||||
            ))
 | 
			
		||||
        }
 | 
			
		||||
        ("show-vote-account", Some(matches)) => {
 | 
			
		||||
            let voting_account_pubkey = value_of(matches, "voting_account_pubkey").unwrap();
 | 
			
		||||
            Ok(WalletCommand::ShowVoteAccount(voting_account_pubkey))
 | 
			
		||||
            let vote_account_pubkey = value_of(matches, "vote_account_pubkey").unwrap();
 | 
			
		||||
            Ok(WalletCommand::ShowVoteAccount(vote_account_pubkey))
 | 
			
		||||
        }
 | 
			
		||||
        ("delegate-stake", Some(matches)) => {
 | 
			
		||||
            let staking_account_keypair =
 | 
			
		||||
                keypair_of(matches, "staking_account_keypair_file").unwrap();
 | 
			
		||||
            let voting_account_pubkey = value_of(matches, "voting_account_pubkey").unwrap();
 | 
			
		||||
            let stake_account_keypair = keypair_of(matches, "stake_account_keypair_file").unwrap();
 | 
			
		||||
            let vote_account_pubkey = value_of(matches, "vote_account_pubkey").unwrap();
 | 
			
		||||
            let lamports_to_stake = matches.value_of("lamports_to_stake").unwrap().parse()?;
 | 
			
		||||
            Ok(WalletCommand::DelegateStake(
 | 
			
		||||
                staking_account_keypair,
 | 
			
		||||
                voting_account_pubkey,
 | 
			
		||||
                stake_account_keypair,
 | 
			
		||||
                vote_account_pubkey,
 | 
			
		||||
                lamports_to_stake,
 | 
			
		||||
            ))
 | 
			
		||||
        }
 | 
			
		||||
        ("withdraw-stake", Some(matches)) => {
 | 
			
		||||
            let staking_account_keypair =
 | 
			
		||||
                keypair_of(matches, "staking_account_keypair_file").unwrap();
 | 
			
		||||
            let stake_account_keypair = keypair_of(matches, "stake_account_keypair_file").unwrap();
 | 
			
		||||
            let destination_account_pubkey =
 | 
			
		||||
                value_of(matches, "destination_account_pubkey").unwrap();
 | 
			
		||||
            let lamports = matches.value_of("lamports").unwrap().parse()?;
 | 
			
		||||
            Ok(WalletCommand::WithdrawStake(
 | 
			
		||||
                staking_account_keypair,
 | 
			
		||||
                stake_account_keypair,
 | 
			
		||||
                destination_account_pubkey,
 | 
			
		||||
                lamports,
 | 
			
		||||
            ))
 | 
			
		||||
        }
 | 
			
		||||
        ("deactivate-stake", Some(matches)) => {
 | 
			
		||||
            let staking_account_keypair =
 | 
			
		||||
                keypair_of(matches, "staking_account_keypair_file").unwrap();
 | 
			
		||||
            Ok(WalletCommand::DeactivateStake(staking_account_keypair))
 | 
			
		||||
            let stake_account_keypair = keypair_of(matches, "stake_account_keypair_file").unwrap();
 | 
			
		||||
            Ok(WalletCommand::DeactivateStake(stake_account_keypair))
 | 
			
		||||
        }
 | 
			
		||||
        ("redeem-vote-credits", Some(matches)) => {
 | 
			
		||||
            let staking_account_pubkey = value_of(matches, "staking_account_pubkey").unwrap();
 | 
			
		||||
            let voting_account_pubkey = value_of(matches, "voting_account_pubkey").unwrap();
 | 
			
		||||
            let stake_account_pubkey = value_of(matches, "stake_account_pubkey").unwrap();
 | 
			
		||||
            let vote_account_pubkey = value_of(matches, "vote_account_pubkey").unwrap();
 | 
			
		||||
            Ok(WalletCommand::RedeemVoteCredits(
 | 
			
		||||
                staking_account_pubkey,
 | 
			
		||||
                voting_account_pubkey,
 | 
			
		||||
                stake_account_pubkey,
 | 
			
		||||
                vote_account_pubkey,
 | 
			
		||||
            ))
 | 
			
		||||
        }
 | 
			
		||||
        ("show-stake-account", Some(matches)) => {
 | 
			
		||||
            let staking_account_pubkey = value_of(matches, "staking_account_pubkey").unwrap();
 | 
			
		||||
            Ok(WalletCommand::ShowStakeAccount(staking_account_pubkey))
 | 
			
		||||
            let stake_account_pubkey = value_of(matches, "stake_account_pubkey").unwrap();
 | 
			
		||||
            Ok(WalletCommand::ShowStakeAccount(stake_account_pubkey))
 | 
			
		||||
        }
 | 
			
		||||
        ("create-replicator-storage-account", Some(matches)) => {
 | 
			
		||||
            let account_owner = value_of(matches, "storage_account_owner").unwrap();
 | 
			
		||||
@@ -455,14 +452,14 @@ fn process_confirm(rpc_client: &RpcClient, signature: &Signature) -> ProcessResu
 | 
			
		||||
fn process_create_vote_account(
 | 
			
		||||
    rpc_client: &RpcClient,
 | 
			
		||||
    config: &WalletConfig,
 | 
			
		||||
    voting_account_pubkey: &Pubkey,
 | 
			
		||||
    vote_account_pubkey: &Pubkey,
 | 
			
		||||
    node_pubkey: &Pubkey,
 | 
			
		||||
    commission: u8,
 | 
			
		||||
    lamports: u64,
 | 
			
		||||
) -> ProcessResult {
 | 
			
		||||
    let ixs = vote_instruction::create_account(
 | 
			
		||||
        &config.keypair.pubkey(),
 | 
			
		||||
        voting_account_pubkey,
 | 
			
		||||
        vote_account_pubkey,
 | 
			
		||||
        node_pubkey,
 | 
			
		||||
        commission,
 | 
			
		||||
        lamports,
 | 
			
		||||
@@ -476,13 +473,13 @@ fn process_create_vote_account(
 | 
			
		||||
fn process_authorize_voter(
 | 
			
		||||
    rpc_client: &RpcClient,
 | 
			
		||||
    config: &WalletConfig,
 | 
			
		||||
    voting_account_pubkey: &Pubkey,
 | 
			
		||||
    vote_account_pubkey: &Pubkey,
 | 
			
		||||
    authorized_voter_keypair: &Keypair,
 | 
			
		||||
    new_authorized_voter_pubkey: &Pubkey,
 | 
			
		||||
) -> ProcessResult {
 | 
			
		||||
    let (recent_blockhash, _fee_calculator) = rpc_client.get_recent_blockhash()?;
 | 
			
		||||
    let ixs = vec![vote_instruction::authorize_voter(
 | 
			
		||||
        voting_account_pubkey,              // vote account to update
 | 
			
		||||
        vote_account_pubkey,                // vote account to update
 | 
			
		||||
        &authorized_voter_keypair.pubkey(), // current authorized voter (often the vote account itself)
 | 
			
		||||
        new_authorized_voter_pubkey,        // new vote signer
 | 
			
		||||
    )];
 | 
			
		||||
@@ -501,18 +498,24 @@ fn process_authorize_voter(
 | 
			
		||||
fn process_show_vote_account(
 | 
			
		||||
    rpc_client: &RpcClient,
 | 
			
		||||
    _config: &WalletConfig,
 | 
			
		||||
    voting_account_pubkey: &Pubkey,
 | 
			
		||||
    vote_account_pubkey: &Pubkey,
 | 
			
		||||
) -> ProcessResult {
 | 
			
		||||
    let vote_account = rpc_client.get_account(vote_account_pubkey)?;
 | 
			
		||||
 | 
			
		||||
    use solana_vote_api::vote_state::VoteState;
 | 
			
		||||
    let vote_account_lamports = rpc_client.retry_get_balance(voting_account_pubkey, 5)?;
 | 
			
		||||
    let vote_account_data = rpc_client.get_account_data(voting_account_pubkey)?;
 | 
			
		||||
    let vote_state = VoteState::deserialize(&vote_account_data).map_err(|_| {
 | 
			
		||||
    if vote_account.owner != solana_vote_api::id() {
 | 
			
		||||
        Err(WalletError::RpcRequestError(
 | 
			
		||||
            format!("{:?} is not a vote account", vote_account_pubkey).to_string(),
 | 
			
		||||
        ))?;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    let vote_state = VoteState::deserialize(&vote_account.data).map_err(|_| {
 | 
			
		||||
        WalletError::RpcRequestError(
 | 
			
		||||
            "Account data could not be deserialized to vote state".to_string(),
 | 
			
		||||
        )
 | 
			
		||||
    })?;
 | 
			
		||||
 | 
			
		||||
    println!("account lamports: {}", vote_account_lamports.unwrap());
 | 
			
		||||
    println!("account lamports: {}", vote_account.lamports);
 | 
			
		||||
    println!("node id: {}", vote_state.node_pubkey);
 | 
			
		||||
    println!(
 | 
			
		||||
        "authorized voter pubkey: {}",
 | 
			
		||||
@@ -563,59 +566,59 @@ fn process_show_vote_account(
 | 
			
		||||
fn process_deactivate_stake_account(
 | 
			
		||||
    rpc_client: &RpcClient,
 | 
			
		||||
    config: &WalletConfig,
 | 
			
		||||
    staking_account_keypair: &Keypair,
 | 
			
		||||
    stake_account_keypair: &Keypair,
 | 
			
		||||
) -> ProcessResult {
 | 
			
		||||
    let (recent_blockhash, _fee_calculator) = rpc_client.get_recent_blockhash()?;
 | 
			
		||||
    let ixs = stake_instruction::deactivate_stake(&staking_account_keypair.pubkey());
 | 
			
		||||
    let ixs = stake_instruction::deactivate_stake(&stake_account_keypair.pubkey());
 | 
			
		||||
    let mut tx = Transaction::new_signed_with_payer(
 | 
			
		||||
        vec![ixs],
 | 
			
		||||
        Some(&config.keypair.pubkey()),
 | 
			
		||||
        &[&config.keypair, &staking_account_keypair],
 | 
			
		||||
        &[&config.keypair, &stake_account_keypair],
 | 
			
		||||
        recent_blockhash,
 | 
			
		||||
    );
 | 
			
		||||
    let signature_str = rpc_client
 | 
			
		||||
        .send_and_confirm_transaction(&mut tx, &[&config.keypair, &staking_account_keypair])?;
 | 
			
		||||
        .send_and_confirm_transaction(&mut tx, &[&config.keypair, &stake_account_keypair])?;
 | 
			
		||||
    Ok(signature_str.to_string())
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
fn process_delegate_stake(
 | 
			
		||||
    rpc_client: &RpcClient,
 | 
			
		||||
    config: &WalletConfig,
 | 
			
		||||
    staking_account_keypair: &Keypair,
 | 
			
		||||
    voting_account_pubkey: &Pubkey,
 | 
			
		||||
    stake_account_keypair: &Keypair,
 | 
			
		||||
    vote_account_pubkey: &Pubkey,
 | 
			
		||||
    lamports: u64,
 | 
			
		||||
) -> ProcessResult {
 | 
			
		||||
    let (recent_blockhash, _fee_calculator) = rpc_client.get_recent_blockhash()?;
 | 
			
		||||
 | 
			
		||||
    let ixs = stake_instruction::create_stake_account_and_delegate_stake(
 | 
			
		||||
        &config.keypair.pubkey(),
 | 
			
		||||
        &staking_account_keypair.pubkey(),
 | 
			
		||||
        voting_account_pubkey,
 | 
			
		||||
        &stake_account_keypair.pubkey(),
 | 
			
		||||
        vote_account_pubkey,
 | 
			
		||||
        lamports,
 | 
			
		||||
    );
 | 
			
		||||
 | 
			
		||||
    let mut tx = Transaction::new_signed_with_payer(
 | 
			
		||||
        ixs,
 | 
			
		||||
        Some(&config.keypair.pubkey()),
 | 
			
		||||
        &[&config.keypair, &staking_account_keypair],
 | 
			
		||||
        &[&config.keypair, &stake_account_keypair],
 | 
			
		||||
        recent_blockhash,
 | 
			
		||||
    );
 | 
			
		||||
 | 
			
		||||
    let signature_str = rpc_client
 | 
			
		||||
        .send_and_confirm_transaction(&mut tx, &[&config.keypair, &staking_account_keypair])?;
 | 
			
		||||
        .send_and_confirm_transaction(&mut tx, &[&config.keypair, &stake_account_keypair])?;
 | 
			
		||||
    Ok(signature_str.to_string())
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
fn process_withdraw_stake(
 | 
			
		||||
    rpc_client: &RpcClient,
 | 
			
		||||
    config: &WalletConfig,
 | 
			
		||||
    staking_account_keypair: &Keypair,
 | 
			
		||||
    stake_account_keypair: &Keypair,
 | 
			
		||||
    destination_account_pubkey: &Pubkey,
 | 
			
		||||
    lamports: u64,
 | 
			
		||||
) -> ProcessResult {
 | 
			
		||||
    let (recent_blockhash, _fee_calculator) = rpc_client.get_recent_blockhash()?;
 | 
			
		||||
    let ixs = vec![stake_instruction::withdraw(
 | 
			
		||||
        &staking_account_keypair.pubkey(),
 | 
			
		||||
        &stake_account_keypair.pubkey(),
 | 
			
		||||
        destination_account_pubkey,
 | 
			
		||||
        lamports,
 | 
			
		||||
    )];
 | 
			
		||||
@@ -623,25 +626,25 @@ fn process_withdraw_stake(
 | 
			
		||||
    let mut tx = Transaction::new_signed_with_payer(
 | 
			
		||||
        ixs,
 | 
			
		||||
        Some(&config.keypair.pubkey()),
 | 
			
		||||
        &[&config.keypair, &staking_account_keypair],
 | 
			
		||||
        &[&config.keypair, &stake_account_keypair],
 | 
			
		||||
        recent_blockhash,
 | 
			
		||||
    );
 | 
			
		||||
 | 
			
		||||
    let signature_str = rpc_client
 | 
			
		||||
        .send_and_confirm_transaction(&mut tx, &[&config.keypair, &staking_account_keypair])?;
 | 
			
		||||
        .send_and_confirm_transaction(&mut tx, &[&config.keypair, &stake_account_keypair])?;
 | 
			
		||||
    Ok(signature_str.to_string())
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
fn process_redeem_vote_credits(
 | 
			
		||||
    rpc_client: &RpcClient,
 | 
			
		||||
    config: &WalletConfig,
 | 
			
		||||
    staking_account_pubkey: &Pubkey,
 | 
			
		||||
    voting_account_pubkey: &Pubkey,
 | 
			
		||||
    stake_account_pubkey: &Pubkey,
 | 
			
		||||
    vote_account_pubkey: &Pubkey,
 | 
			
		||||
) -> ProcessResult {
 | 
			
		||||
    let (recent_blockhash, _fee_calculator) = rpc_client.get_recent_blockhash()?;
 | 
			
		||||
    let ixs = vec![stake_instruction::redeem_vote_credits(
 | 
			
		||||
        staking_account_pubkey,
 | 
			
		||||
        voting_account_pubkey,
 | 
			
		||||
        stake_account_pubkey,
 | 
			
		||||
        vote_account_pubkey,
 | 
			
		||||
    )];
 | 
			
		||||
    let mut tx = Transaction::new_signed_with_payer(
 | 
			
		||||
        ixs,
 | 
			
		||||
@@ -656,10 +659,15 @@ fn process_redeem_vote_credits(
 | 
			
		||||
fn process_show_stake_account(
 | 
			
		||||
    rpc_client: &RpcClient,
 | 
			
		||||
    _config: &WalletConfig,
 | 
			
		||||
    staking_account_pubkey: &Pubkey,
 | 
			
		||||
    stake_account_pubkey: &Pubkey,
 | 
			
		||||
) -> ProcessResult {
 | 
			
		||||
    use solana_stake_api::stake_state::StakeState;
 | 
			
		||||
    let stake_account = rpc_client.get_account(staking_account_pubkey)?;
 | 
			
		||||
    let stake_account = rpc_client.get_account(stake_account_pubkey)?;
 | 
			
		||||
    if stake_account.owner != solana_stake_api::id() {
 | 
			
		||||
        Err(WalletError::RpcRequestError(
 | 
			
		||||
            format!("{:?} is not a stake account", stake_account_pubkey).to_string(),
 | 
			
		||||
        ))?;
 | 
			
		||||
    }
 | 
			
		||||
    match stake_account.state() {
 | 
			
		||||
        Ok(StakeState::Stake(stake)) => {
 | 
			
		||||
            println!("total stake: {}", stake_account.lamports);
 | 
			
		||||
@@ -740,8 +748,15 @@ fn process_show_storage_account(
 | 
			
		||||
    _config: &WalletConfig,
 | 
			
		||||
    storage_account_pubkey: &Pubkey,
 | 
			
		||||
) -> ProcessResult {
 | 
			
		||||
    use solana_storage_api::storage_contract::StorageContract;
 | 
			
		||||
    let account = rpc_client.get_account(storage_account_pubkey)?;
 | 
			
		||||
 | 
			
		||||
    if account.owner != solana_storage_api::id() {
 | 
			
		||||
        Err(WalletError::RpcRequestError(
 | 
			
		||||
            format!("{:?} is not a storage account", storage_account_pubkey).to_string(),
 | 
			
		||||
        ))?;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    use solana_storage_api::storage_contract::StorageContract;
 | 
			
		||||
    let storage_contract: StorageContract = account.state().map_err(|err| {
 | 
			
		||||
        WalletError::RpcRequestError(
 | 
			
		||||
            format!("Unable to deserialize storage account: {:?}", err).to_string(),
 | 
			
		||||
@@ -1012,73 +1027,73 @@ pub fn process_command(config: &WalletConfig) -> ProcessResult {
 | 
			
		||||
 | 
			
		||||
        // Create vote account
 | 
			
		||||
        WalletCommand::CreateVoteAccount(
 | 
			
		||||
            voting_account_pubkey,
 | 
			
		||||
            vote_account_pubkey,
 | 
			
		||||
            node_pubkey,
 | 
			
		||||
            commission,
 | 
			
		||||
            lamports,
 | 
			
		||||
        ) => process_create_vote_account(
 | 
			
		||||
            &rpc_client,
 | 
			
		||||
            config,
 | 
			
		||||
            &voting_account_pubkey,
 | 
			
		||||
            &vote_account_pubkey,
 | 
			
		||||
            &node_pubkey,
 | 
			
		||||
            *commission,
 | 
			
		||||
            *lamports,
 | 
			
		||||
        ),
 | 
			
		||||
        // Configure staking account already created
 | 
			
		||||
 | 
			
		||||
        WalletCommand::AuthorizeVoter(
 | 
			
		||||
            voting_account_pubkey,
 | 
			
		||||
            vote_account_pubkey,
 | 
			
		||||
            authorized_voter_keypair,
 | 
			
		||||
            new_authorized_voter_pubkey,
 | 
			
		||||
        ) => process_authorize_voter(
 | 
			
		||||
            &rpc_client,
 | 
			
		||||
            config,
 | 
			
		||||
            &voting_account_pubkey,
 | 
			
		||||
            &vote_account_pubkey,
 | 
			
		||||
            &authorized_voter_keypair,
 | 
			
		||||
            &new_authorized_voter_pubkey,
 | 
			
		||||
        ),
 | 
			
		||||
        // Show a vote account
 | 
			
		||||
        WalletCommand::ShowVoteAccount(voting_account_pubkey) => {
 | 
			
		||||
            process_show_vote_account(&rpc_client, config, &voting_account_pubkey)
 | 
			
		||||
        WalletCommand::ShowVoteAccount(vote_account_pubkey) => {
 | 
			
		||||
            process_show_vote_account(&rpc_client, config, &vote_account_pubkey)
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        WalletCommand::DelegateStake(staking_account_keypair, voting_account_pubkey, lamports) => {
 | 
			
		||||
        WalletCommand::DelegateStake(stake_account_keypair, vote_account_pubkey, lamports) => {
 | 
			
		||||
            process_delegate_stake(
 | 
			
		||||
                &rpc_client,
 | 
			
		||||
                config,
 | 
			
		||||
                &staking_account_keypair,
 | 
			
		||||
                &voting_account_pubkey,
 | 
			
		||||
                &stake_account_keypair,
 | 
			
		||||
                &vote_account_pubkey,
 | 
			
		||||
                *lamports,
 | 
			
		||||
            )
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        WalletCommand::WithdrawStake(
 | 
			
		||||
            staking_account_keypair,
 | 
			
		||||
            stake_account_keypair,
 | 
			
		||||
            destination_account_pubkey,
 | 
			
		||||
            lamports,
 | 
			
		||||
        ) => process_withdraw_stake(
 | 
			
		||||
            &rpc_client,
 | 
			
		||||
            config,
 | 
			
		||||
            &staking_account_keypair,
 | 
			
		||||
            &stake_account_keypair,
 | 
			
		||||
            &destination_account_pubkey,
 | 
			
		||||
            *lamports,
 | 
			
		||||
        ),
 | 
			
		||||
 | 
			
		||||
        // Deactivate stake account
 | 
			
		||||
        WalletCommand::DeactivateStake(staking_account_keypair) => {
 | 
			
		||||
            process_deactivate_stake_account(&rpc_client, config, &staking_account_keypair)
 | 
			
		||||
        WalletCommand::DeactivateStake(stake_account_keypair) => {
 | 
			
		||||
            process_deactivate_stake_account(&rpc_client, config, &stake_account_keypair)
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        WalletCommand::RedeemVoteCredits(staking_account_pubkey, voting_account_pubkey) => {
 | 
			
		||||
        WalletCommand::RedeemVoteCredits(stake_account_pubkey, vote_account_pubkey) => {
 | 
			
		||||
            process_redeem_vote_credits(
 | 
			
		||||
                &rpc_client,
 | 
			
		||||
                config,
 | 
			
		||||
                &staking_account_pubkey,
 | 
			
		||||
                &voting_account_pubkey,
 | 
			
		||||
                &stake_account_pubkey,
 | 
			
		||||
                &vote_account_pubkey,
 | 
			
		||||
            )
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        WalletCommand::ShowStakeAccount(staking_account_pubkey) => {
 | 
			
		||||
            process_show_stake_account(&rpc_client, config, &staking_account_pubkey)
 | 
			
		||||
        WalletCommand::ShowStakeAccount(stake_account_pubkey) => {
 | 
			
		||||
            process_show_stake_account(&rpc_client, config, &stake_account_pubkey)
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        WalletCommand::CreateReplicatorStorageAccount(
 | 
			
		||||
@@ -1309,7 +1324,7 @@ pub fn app<'ab, 'v>(name: &str, about: &'ab str, version: &'v str) -> App<'ab, '
 | 
			
		||||
            SubCommand::with_name("authorize-voter")
 | 
			
		||||
                .about("Authorize a new vote signing keypair for the given vote account")
 | 
			
		||||
                .arg(
 | 
			
		||||
                    Arg::with_name("voting_account_pubkey")
 | 
			
		||||
                    Arg::with_name("vote_account_pubkey")
 | 
			
		||||
                        .index(1)
 | 
			
		||||
                        .value_name("PUBKEY")
 | 
			
		||||
                        .takes_value(true)
 | 
			
		||||
@@ -1337,9 +1352,9 @@ pub fn app<'ab, 'v>(name: &str, about: &'ab str, version: &'v str) -> App<'ab, '
 | 
			
		||||
        )
 | 
			
		||||
        .subcommand(
 | 
			
		||||
            SubCommand::with_name("create-vote-account")
 | 
			
		||||
                .about("Create vote account for a node")
 | 
			
		||||
                .about("Create a vote account")
 | 
			
		||||
                .arg(
 | 
			
		||||
                    Arg::with_name("voting_account_pubkey")
 | 
			
		||||
                    Arg::with_name("vote_account_pubkey")
 | 
			
		||||
                        .index(1)
 | 
			
		||||
                        .value_name("PUBKEY")
 | 
			
		||||
                        .takes_value(true)
 | 
			
		||||
@@ -1354,7 +1369,7 @@ pub fn app<'ab, 'v>(name: &str, about: &'ab str, version: &'v str) -> App<'ab, '
 | 
			
		||||
                        .takes_value(true)
 | 
			
		||||
                        .required(true)
 | 
			
		||||
                        .validator(is_pubkey)
 | 
			
		||||
                        .help("Node that will vote in this account"),
 | 
			
		||||
                        .help("Validator that will vote with this account"),
 | 
			
		||||
                )
 | 
			
		||||
                .arg(
 | 
			
		||||
                    Arg::with_name("lamports")
 | 
			
		||||
@@ -1376,7 +1391,7 @@ pub fn app<'ab, 'v>(name: &str, about: &'ab str, version: &'v str) -> App<'ab, '
 | 
			
		||||
            SubCommand::with_name("show-vote-account")
 | 
			
		||||
                .about("Show the contents of a vote account")
 | 
			
		||||
                .arg(
 | 
			
		||||
                    Arg::with_name("voting_account_pubkey")
 | 
			
		||||
                    Arg::with_name("vote_account_pubkey")
 | 
			
		||||
                        .index(1)
 | 
			
		||||
                        .value_name("PUBKEY")
 | 
			
		||||
                        .takes_value(true)
 | 
			
		||||
@@ -1389,7 +1404,7 @@ pub fn app<'ab, 'v>(name: &str, about: &'ab str, version: &'v str) -> App<'ab, '
 | 
			
		||||
            SubCommand::with_name("delegate-stake")
 | 
			
		||||
                .about("Delegate stake to a vote account")
 | 
			
		||||
                .arg(
 | 
			
		||||
                    Arg::with_name("staking_account_keypair_file")
 | 
			
		||||
                    Arg::with_name("stake_account_keypair_file")
 | 
			
		||||
                        .index(1)
 | 
			
		||||
                        .value_name("KEYPAIR_FILE")
 | 
			
		||||
                        .takes_value(true)
 | 
			
		||||
@@ -1397,13 +1412,13 @@ pub fn app<'ab, 'v>(name: &str, about: &'ab str, version: &'v str) -> App<'ab, '
 | 
			
		||||
                        .help("Keypair file for the new stake account"),
 | 
			
		||||
                )
 | 
			
		||||
                .arg(
 | 
			
		||||
                    Arg::with_name("voting_account_pubkey")
 | 
			
		||||
                    Arg::with_name("vote_account_pubkey")
 | 
			
		||||
                        .index(2)
 | 
			
		||||
                        .value_name("PUBKEY")
 | 
			
		||||
                        .takes_value(true)
 | 
			
		||||
                        .required(true)
 | 
			
		||||
                        .validator(is_pubkey)
 | 
			
		||||
                        .help("The voting account to which the stake will be delegated"),
 | 
			
		||||
                        .help("The vote account to which the stake will be delegated"),
 | 
			
		||||
                )
 | 
			
		||||
                .arg(
 | 
			
		||||
                    Arg::with_name("lamports_to_stake")
 | 
			
		||||
@@ -1416,26 +1431,26 @@ pub fn app<'ab, 'v>(name: &str, about: &'ab str, version: &'v str) -> App<'ab, '
 | 
			
		||||
        )
 | 
			
		||||
        .subcommand(
 | 
			
		||||
            SubCommand::with_name("deactivate-stake")
 | 
			
		||||
                .about("Deactivate the delegated stake from the staking account")
 | 
			
		||||
                .about("Deactivate the delegated stake from the stake account")
 | 
			
		||||
                .arg(
 | 
			
		||||
                    Arg::with_name("staking_account_keypair_file")
 | 
			
		||||
                    Arg::with_name("stake_account_keypair_file")
 | 
			
		||||
                        .index(1)
 | 
			
		||||
                        .value_name("KEYPAIR_FILE")
 | 
			
		||||
                        .takes_value(true)
 | 
			
		||||
                        .required(true)
 | 
			
		||||
                        .help("Keypair file for the staking account, for signing the delegate transaction."),
 | 
			
		||||
                        .help("Keypair file for the stake account, for signing the delegate transaction."),
 | 
			
		||||
                )
 | 
			
		||||
        )
 | 
			
		||||
        .subcommand(
 | 
			
		||||
            SubCommand::with_name("withdraw-stake")
 | 
			
		||||
                .about("Withdraw the unstaked lamports from the stake account")
 | 
			
		||||
                .arg(
 | 
			
		||||
                    Arg::with_name("staking_account_keypair_file")
 | 
			
		||||
                    Arg::with_name("stake_account_keypair_file")
 | 
			
		||||
                        .index(1)
 | 
			
		||||
                        .value_name("KEYPAIR_FILE")
 | 
			
		||||
                        .takes_value(true)
 | 
			
		||||
                        .required(true)
 | 
			
		||||
                        .help("Keypair file for the staking account, for signing the withdraw transaction."),
 | 
			
		||||
                        .help("Keypair file for the stake account, for signing the withdraw transaction."),
 | 
			
		||||
                )
 | 
			
		||||
                .arg(
 | 
			
		||||
                    Arg::with_name("destination_account_pubkey")
 | 
			
		||||
@@ -1457,7 +1472,7 @@ pub fn app<'ab, 'v>(name: &str, about: &'ab str, version: &'v str) -> App<'ab, '
 | 
			
		||||
        )
 | 
			
		||||
        .subcommand(
 | 
			
		||||
            SubCommand::with_name("redeem-vote-credits")
 | 
			
		||||
                .about("Redeem credits in the staking account")
 | 
			
		||||
                .about("Redeem credits in the stake account")
 | 
			
		||||
                .arg(
 | 
			
		||||
                    Arg::with_name("mining_pool_account_pubkey")
 | 
			
		||||
                        .index(1)
 | 
			
		||||
@@ -1468,7 +1483,7 @@ pub fn app<'ab, 'v>(name: &str, about: &'ab str, version: &'v str) -> App<'ab, '
 | 
			
		||||
                        .help("Mining pool account to redeem credits from"),
 | 
			
		||||
                )
 | 
			
		||||
                .arg(
 | 
			
		||||
                    Arg::with_name("staking_account_pubkey")
 | 
			
		||||
                    Arg::with_name("stake_account_pubkey")
 | 
			
		||||
                        .index(2)
 | 
			
		||||
                        .value_name("STAKING ACCOUNT PUBKEY")
 | 
			
		||||
                        .takes_value(true)
 | 
			
		||||
@@ -1477,20 +1492,20 @@ pub fn app<'ab, 'v>(name: &str, about: &'ab str, version: &'v str) -> App<'ab, '
 | 
			
		||||
                        .help("Staking account address to redeem credits for"),
 | 
			
		||||
                )
 | 
			
		||||
                .arg(
 | 
			
		||||
                    Arg::with_name("voting_account_pubkey")
 | 
			
		||||
                    Arg::with_name("vote_account_pubkey")
 | 
			
		||||
                        .index(3)
 | 
			
		||||
                        .value_name("PUBKEY")
 | 
			
		||||
                        .takes_value(true)
 | 
			
		||||
                        .required(true)
 | 
			
		||||
                        .validator(is_pubkey)
 | 
			
		||||
                        .help("The voting account to which the stake was previously delegated."),
 | 
			
		||||
                        .help("The vote account to which the stake was previously delegated."),
 | 
			
		||||
                ),
 | 
			
		||||
        )
 | 
			
		||||
        .subcommand(
 | 
			
		||||
            SubCommand::with_name("show-stake-account")
 | 
			
		||||
                .about("Show the contents of a stake account")
 | 
			
		||||
                .arg(
 | 
			
		||||
                    Arg::with_name("staking_account_pubkey")
 | 
			
		||||
                    Arg::with_name("stake_account_pubkey")
 | 
			
		||||
                        .index(1)
 | 
			
		||||
                        .value_name("PUBKEY")
 | 
			
		||||
                        .takes_value(true)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user