Make lockups block stake transfers via rekeying (#7651)

This commit is contained in:
Rob Walker
2020-01-01 11:03:29 -08:00
committed by GitHub
parent 374c17a0d9
commit e97b0088f2
3 changed files with 125 additions and 18 deletions

View File

@@ -256,7 +256,11 @@ pub fn authorize(
new_authorized_pubkey: &Pubkey,
stake_authorize: StakeAuthorize,
) -> Instruction {
let account_metas = vec![AccountMeta::new(*stake_pubkey, false)].with_signer(authorized_pubkey);
let account_metas = vec![
AccountMeta::new(*stake_pubkey, false),
AccountMeta::new_readonly(sysvar::clock::id(), false),
]
.with_signer(authorized_pubkey);
Instruction::new(
id(),
@@ -357,9 +361,12 @@ pub fn process_instruction(
&lockup,
&Rent::from_keyed_account(next_keyed_account(keyed_accounts)?)?,
),
StakeInstruction::Authorize(authorized_pubkey, stake_authorize) => {
me.authorize(&authorized_pubkey, stake_authorize, &signers)
}
StakeInstruction::Authorize(authorized_pubkey, stake_authorize) => me.authorize(
&authorized_pubkey,
stake_authorize,
&signers,
&Clock::from_keyed_account(next_keyed_account(keyed_accounts)?)?,
),
StakeInstruction::DelegateStake => {
let vote = next_keyed_account(keyed_accounts)?;