Error cleanly on show vote/stake/storage account pubkey mismatch (#5289)

Also deverb vote/stake account variables
This commit is contained in:
Michael Vines
2019-07-26 09:34:12 -07:00
committed by GitHub
parent 5f09aa36b3
commit feaf29792f

View File

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