Add set-lockup to solana-stake-accounts (#9827)

* Add a command to set lockups or authorize a new custodian on derived stake accounts

* Thanks clippy
This commit is contained in:
Greg Fitzgerald
2020-04-30 17:56:37 -06:00
committed by GitHub
parent 7678af6300
commit 450f1d2867
5 changed files with 246 additions and 6 deletions

View File

@@ -77,6 +77,18 @@ impl StakeState {
_ => None,
}
}
pub fn lockup_from(account: &Account) -> Option<Lockup> {
Self::from(account).and_then(|state: Self| state.lockup())
}
pub fn lockup(&self) -> Option<Lockup> {
match self {
StakeState::Stake(meta, _stake) => Some(meta.lockup),
StakeState::Initialized(meta) => Some(meta.lockup),
_ => None,
}
}
}
#[derive(Debug, Serialize, Deserialize, PartialEq, Clone, Copy)]