From 52c959e7f0f5e569569ee4007dfca2bf78b0f2c1 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Wed, 16 Feb 2022 08:09:54 +0000 Subject: [PATCH] Allow cli users to authorize Staker signed by Withdrawer (#23146) (#23175) (cherry picked from commit 88b66ae3a8ec58b656d1ffcebfcdb7584bf3c099) Co-authored-by: Tyera Eulberg --- 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 40ab514b39..5290b00c71 100644 --- a/cli/src/stake.rs +++ b/cli/src/stake.rs @@ -1385,7 +1385,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())?;