From bf5076f47fd40b088c7d562bf7c424cc44e941da Mon Sep 17 00:00:00 2001 From: Tyera Eulberg Date: Tue, 15 Feb 2022 22:08:53 -0700 Subject: [PATCH] Allow cli users to authorize Staker signed by Withdrawer (#23146) --- cli/src/stake.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cli/src/stake.rs b/cli/src/stake.rs index afbfcfcb7da3d6..e70f5e0525f66e 100644 --- a/cli/src/stake.rs +++ b/cli/src/stake.rs @@ -1384,7 +1384,13 @@ pub fn process_stake_authorize( if let Some(authorized) = authorized { match authorization_type { StakeAuthorize::Staker => { - check_current_authority(&authorized.staker, &authority.pubkey())?; + // first check authorized withdrawer + check_current_authority(&authorized.withdrawer, &authority.pubkey()) + .or_else(|_| { + // ...then check authorized staker. If neither matches, error will + // print the stake key as `expected` + check_current_authority(&authorized.staker, &authority.pubkey()) + })?; } StakeAuthorize::Withdrawer => { check_current_authority(&authorized.withdrawer, &authority.pubkey())?;