Let native_loader own native executable accounts
This commit is contained in:
parent
72b6ec4aa8
commit
48671a1728
|
@ -13,11 +13,11 @@ pub fn check_id(program_id: &Pubkey) -> bool {
|
|||
program_id.as_ref() == NATIVE_LOADER_PROGRAM_ID
|
||||
}
|
||||
|
||||
/// Create an executable account owned by the given program_id and shared object name.
|
||||
pub fn create_program_account(program_id: Pubkey, name: &str) -> Account {
|
||||
/// Create an executable account with the given shared object name.
|
||||
pub fn create_program_account(name: &str) -> Account {
|
||||
Account {
|
||||
tokens: 1,
|
||||
owner: program_id,
|
||||
owner: id(),
|
||||
userdata: name.as_bytes().to_vec(),
|
||||
executable: true,
|
||||
loader: id(),
|
||||
|
|
17
src/bank.rs
17
src/bank.rs
|
@ -220,18 +220,16 @@ impl Bank {
|
|||
}
|
||||
|
||||
fn add_builtin_programs(&self) {
|
||||
let system_program_account =
|
||||
native_loader::create_program_account(system_program::id(), "solana_system_program");
|
||||
let system_program_account = native_loader::create_program_account("solana_system_program");
|
||||
self.accounts
|
||||
.store_slow(true, &system_program::id(), &system_program_account);
|
||||
|
||||
let vote_program_account =
|
||||
native_loader::create_program_account(vote_program::id(), "solana_vote_program");
|
||||
let vote_program_account = native_loader::create_program_account("solana_vote_program");
|
||||
self.accounts
|
||||
.store_slow(true, &vote_program::id(), &vote_program_account);
|
||||
|
||||
let storage_program_account =
|
||||
native_loader::create_program_account(storage_program::id(), "solana_storage_program");
|
||||
native_loader::create_program_account("solana_storage_program");
|
||||
self.accounts
|
||||
.store_slow(true, &storage_program::id(), &storage_program_account);
|
||||
|
||||
|
@ -239,18 +237,15 @@ impl Bank {
|
|||
self.accounts
|
||||
.store_slow(true, &storage_program::system_id(), &storage_system_account);
|
||||
|
||||
let bpf_loader_account =
|
||||
native_loader::create_program_account(bpf_loader::id(), "solana_bpf_loader");
|
||||
let bpf_loader_account = native_loader::create_program_account("solana_bpf_loader");
|
||||
self.accounts
|
||||
.store_slow(true, &bpf_loader::id(), &bpf_loader_account);
|
||||
|
||||
let budget_program_account =
|
||||
native_loader::create_program_account(budget_program::id(), "solana_budget_program");
|
||||
let budget_program_account = native_loader::create_program_account("solana_budget_program");
|
||||
self.accounts
|
||||
.store_slow(true, &budget_program::id(), &budget_program_account);
|
||||
|
||||
let erc20_account =
|
||||
native_loader::create_program_account(token_program::id(), "solana_erc20");
|
||||
let erc20_account = native_loader::create_program_account("solana_erc20");
|
||||
self.accounts
|
||||
.store_slow(true, &token_program::id(), &erc20_account);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue