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

@@ -1,11 +1,12 @@
//! The `system_transaction` module provides functionality for creating system transactions.
use crate::hash::Hash;
use crate::pubkey::Pubkey;
use crate::signature::{Keypair, KeypairUtil};
use crate::system_instruction;
use crate::system_program;
use crate::transaction::Transaction;
use crate::{
hash::Hash,
pubkey::Pubkey,
signature::{Keypair, KeypairUtil},
system_instruction,
transaction::Transaction,
};
/// Create and sign new SystemInstruction::CreateAccount transaction
pub fn create_account(
@@ -23,15 +24,17 @@ pub fn create_account(
Transaction::new_signed_instructions(&[from_keypair], instructions, recent_blockhash)
}
/// Create and sign a transaction to create a system account
pub fn create_user_account(
/// Create and sign new system_instruction::Transfer transaction, but don't use a CO "to"
pub fn transfer_now(
from_keypair: &Keypair,
to: &Pubkey,
lamports: u64,
recent_blockhash: Hash,
) -> Transaction {
let program_id = system_program::id();
create_account(from_keypair, to, recent_blockhash, lamports, 0, &program_id)
let from_pubkey = from_keypair.pubkey();
let transfer_instruction = system_instruction::transfer_now(&from_pubkey, to, lamports);
let instructions = vec![transfer_instruction];
Transaction::new_signed_instructions(&[from_keypair], instructions, recent_blockhash)
}
/// Create and sign new system_instruction::Assign transaction