Use Account::owner as loader for executable accounts

This commit is contained in:
Greg Fitzgerald
2019-02-14 10:57:54 -07:00
parent 3849b8ece4
commit 4a0009365e
7 changed files with 17 additions and 30 deletions

View File

@ -59,7 +59,6 @@ pub fn entrypoint(
keyed_accounts[to].account.owner = program_id;
keyed_accounts[to].account.userdata = vec![0; space as usize];
keyed_accounts[to].account.executable = false;
keyed_accounts[to].account.loader = Pubkey::default();
}
SystemInstruction::Assign { program_id } => {
if !system_program::check_id(&keyed_accounts[from].account.owner) {
@ -83,11 +82,10 @@ pub fn entrypoint(
}
SystemInstruction::Spawn => {
if !keyed_accounts[from].account.executable
|| keyed_accounts[from].account.loader != Pubkey::default()
|| keyed_accounts[from].account.owner != Pubkey::default()
{
Err(ProgramError::AccountNotFinalized)?;
}
keyed_accounts[from].account.loader = keyed_accounts[from].account.owner;
keyed_accounts[from].account.owner = *keyed_accounts[from].signer_key().unwrap();
}
}