system_instruction_processor updates (#6448)

* zero lamport account creation

* whack create_user_account, take 2

* target->to

* ..

* ..

* update chacha golden

* update chacha golden

* ..

* ..
This commit is contained in:
Rob Walker
2019-10-19 18:23:27 -07:00
committed by GitHub
parent 74ee88d9bc
commit e2c316d2d0
28 changed files with 377 additions and 255 deletions

View File

@ -8,7 +8,6 @@ use num_derive::{FromPrimitive, ToPrimitive};
pub enum SystemError {
AccountAlreadyInUse,
ResultWithNegativeLamports,
SourceNotSystemAccount,
InvalidProgramId,
InvalidAccountId,
}
@ -70,10 +69,17 @@ pub fn create_account(
)
}
/// Create and sign a transaction to create a system account
pub fn create_user_account(from_pubkey: &Pubkey, to_pubkey: &Pubkey, lamports: u64) -> Instruction {
let program_id = system_program::id();
create_account(from_pubkey, to_pubkey, lamports, 0, &program_id)
/// transfer with to as credit-debit
pub fn transfer_now(from_pubkey: &Pubkey, to_pubkey: &Pubkey, lamports: u64) -> Instruction {
let account_metas = vec![
AccountMeta::new(*from_pubkey, true),
AccountMeta::new(*to_pubkey, false),
];
Instruction::new(
system_program::id(),
&SystemInstruction::Transfer { lamports },
account_metas,
)
}
pub fn assign(from_pubkey: &Pubkey, program_id: &Pubkey) -> Instruction {