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

@ -8,13 +8,10 @@ pub struct Account {
pub tokens: u64,
/// data held in this account
pub userdata: Vec<u8>,
/// the program that owns this account
/// the program that owns this account. If executable, the program that loads this account.
pub owner: Pubkey,
/// this account's userdata contains a loaded program (and is now read-only)
pub executable: bool,
/// the loader for this account
/// (Pubkey::default() if the account is not executable and thus was never 'loaded')
pub loader: Pubkey,
}
impl Account {
@ -25,7 +22,6 @@ impl Account {
userdata: vec![0u8; space],
owner,
executable: false,
loader: Pubkey::default(),
}
}
}

View File

@ -20,6 +20,5 @@ pub fn create_program_account(name: &str) -> Account {
owner: id(),
userdata: name.as_bytes().to_vec(),
executable: true,
loader: id(),
}
}