cli: require one or more authority params in `stake-authorized-checked` (#30863)

* Require one or more authority params

* Add auth list len check
This commit is contained in:
Tyera 2023-03-22 22:13:56 -06:00 committed by GitHub
parent 6c444df9e0
commit 0291e8c702
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 0 deletions

View File

@ -392,6 +392,7 @@ impl StakeSubCommands for App<'_, '_> {
.value_name("KEYPAIR")
.takes_value(true)
.validator(is_valid_signer)
.required_unless("new_withdraw_authority")
.help("New authorized staker")
)
.arg(
@ -400,6 +401,7 @@ impl StakeSubCommands for App<'_, '_> {
.value_name("KEYPAIR")
.takes_value(true)
.validator(is_valid_signer)
.required_unless("new_stake_authority")
.help("New authorized withdrawer")
)
.arg(stake_authority_arg())
@ -948,6 +950,11 @@ pub fn parse_stake_authorize(
default_signer.generate_unique_signers(bulk_signers, matches, wallet_manager)?;
let compute_unit_price = value_of(matches, COMPUTE_UNIT_PRICE_ARG.name);
if new_authorizations.is_empty() {
return Err(CliError::BadParameter(
"New authorization list must include at least one authority".to_string(),
));
}
let new_authorizations = new_authorizations
.into_iter()
.map(