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:
parent
6c444df9e0
commit
0291e8c702
|
@ -392,6 +392,7 @@ impl StakeSubCommands for App<'_, '_> {
|
||||||
.value_name("KEYPAIR")
|
.value_name("KEYPAIR")
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.validator(is_valid_signer)
|
.validator(is_valid_signer)
|
||||||
|
.required_unless("new_withdraw_authority")
|
||||||
.help("New authorized staker")
|
.help("New authorized staker")
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
|
@ -400,6 +401,7 @@ impl StakeSubCommands for App<'_, '_> {
|
||||||
.value_name("KEYPAIR")
|
.value_name("KEYPAIR")
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.validator(is_valid_signer)
|
.validator(is_valid_signer)
|
||||||
|
.required_unless("new_stake_authority")
|
||||||
.help("New authorized withdrawer")
|
.help("New authorized withdrawer")
|
||||||
)
|
)
|
||||||
.arg(stake_authority_arg())
|
.arg(stake_authority_arg())
|
||||||
|
@ -948,6 +950,11 @@ pub fn parse_stake_authorize(
|
||||||
default_signer.generate_unique_signers(bulk_signers, matches, wallet_manager)?;
|
default_signer.generate_unique_signers(bulk_signers, matches, wallet_manager)?;
|
||||||
let compute_unit_price = value_of(matches, COMPUTE_UNIT_PRICE_ARG.name);
|
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
|
let new_authorizations = new_authorizations
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(
|
.map(
|
||||||
|
|
Loading…
Reference in New Issue