Add extra authorized withdrawer test
This commit is contained in:
@ -2766,11 +2766,7 @@ mod tests {
|
|||||||
// Lockup expired: custodian cannot change it
|
// Lockup expired: custodian cannot change it
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
stake_keyed_account.set_lockup(
|
stake_keyed_account.set_lockup(
|
||||||
&LockupArgs {
|
&LockupArgs::default(),
|
||||||
unix_timestamp: Some(3),
|
|
||||||
epoch: None,
|
|
||||||
custodian: None,
|
|
||||||
},
|
|
||||||
&vec![custodian].into_iter().collect(),
|
&vec![custodian].into_iter().collect(),
|
||||||
Some(&Clock {
|
Some(&Clock {
|
||||||
unix_timestamp: UnixTimestamp::MAX,
|
unix_timestamp: UnixTimestamp::MAX,
|
||||||
@ -2784,11 +2780,7 @@ mod tests {
|
|||||||
// Lockup expired: authorized withdrawer can change it
|
// Lockup expired: authorized withdrawer can change it
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
stake_keyed_account.set_lockup(
|
stake_keyed_account.set_lockup(
|
||||||
&LockupArgs {
|
&LockupArgs::default(),
|
||||||
unix_timestamp: Some(3),
|
|
||||||
epoch: None,
|
|
||||||
custodian: None,
|
|
||||||
},
|
|
||||||
&vec![stake_pubkey].into_iter().collect(),
|
&vec![stake_pubkey].into_iter().collect(),
|
||||||
Some(&Clock {
|
Some(&Clock {
|
||||||
unix_timestamp: UnixTimestamp::MAX,
|
unix_timestamp: UnixTimestamp::MAX,
|
||||||
@ -2798,6 +2790,34 @@ mod tests {
|
|||||||
),
|
),
|
||||||
Ok(())
|
Ok(())
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Change authorized withdrawer
|
||||||
|
let new_withdraw_authority = solana_sdk::pubkey::new_rand();
|
||||||
|
assert_eq!(
|
||||||
|
stake_keyed_account.authorize(
|
||||||
|
&vec![stake_pubkey].into_iter().collect(),
|
||||||
|
&new_withdraw_authority,
|
||||||
|
StakeAuthorize::Withdrawer,
|
||||||
|
false,
|
||||||
|
&Clock::default(),
|
||||||
|
None
|
||||||
|
),
|
||||||
|
Ok(())
|
||||||
|
);
|
||||||
|
|
||||||
|
// Previous authorized withdrawer cannot change the lockup anymore
|
||||||
|
assert_eq!(
|
||||||
|
stake_keyed_account.set_lockup(
|
||||||
|
&LockupArgs::default(),
|
||||||
|
&vec![stake_pubkey].into_iter().collect(),
|
||||||
|
Some(&Clock {
|
||||||
|
unix_timestamp: UnixTimestamp::MAX,
|
||||||
|
epoch: Epoch::MAX,
|
||||||
|
..Clock::default()
|
||||||
|
})
|
||||||
|
),
|
||||||
|
Err(InstructionError::MissingRequiredSignature)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
Reference in New Issue
Block a user