pass Pubkeys as refs, copy only where values needed (#3213)
* pass Pubkeys as refs, copy only where values needed * Pubkey is pervasive * fixup
This commit is contained in:
@@ -13,22 +13,22 @@ impl SystemTransaction {
|
||||
/// Create and sign new SystemInstruction::CreateAccount transaction
|
||||
pub fn new_program_account(
|
||||
from_keypair: &Keypair,
|
||||
to: Pubkey,
|
||||
to: &Pubkey,
|
||||
recent_blockhash: Hash,
|
||||
lamports: u64,
|
||||
space: u64,
|
||||
program_id: Pubkey,
|
||||
program_id: &Pubkey,
|
||||
fee: u64,
|
||||
) -> Transaction {
|
||||
let create = SystemInstruction::CreateAccount {
|
||||
lamports, //TODO, the lamports to allocate might need to be higher then 0 in the future
|
||||
space,
|
||||
program_id,
|
||||
program_id: *program_id,
|
||||
};
|
||||
Transaction::new(
|
||||
from_keypair,
|
||||
&[to],
|
||||
system_program::id(),
|
||||
&[*to],
|
||||
&system_program::id(),
|
||||
&create,
|
||||
recent_blockhash,
|
||||
fee,
|
||||
@@ -38,7 +38,7 @@ impl SystemTransaction {
|
||||
/// Create and sign a transaction to create a system account
|
||||
pub fn new_account(
|
||||
from_keypair: &Keypair,
|
||||
to: Pubkey,
|
||||
to: &Pubkey,
|
||||
lamports: u64,
|
||||
recent_blockhash: Hash,
|
||||
fee: u64,
|
||||
@@ -50,7 +50,7 @@ impl SystemTransaction {
|
||||
recent_blockhash,
|
||||
lamports,
|
||||
0,
|
||||
program_id,
|
||||
&program_id,
|
||||
fee,
|
||||
)
|
||||
}
|
||||
@@ -58,14 +58,16 @@ impl SystemTransaction {
|
||||
pub fn new_assign(
|
||||
from_keypair: &Keypair,
|
||||
recent_blockhash: Hash,
|
||||
program_id: Pubkey,
|
||||
program_id: &Pubkey,
|
||||
fee: u64,
|
||||
) -> Transaction {
|
||||
let assign = SystemInstruction::Assign { program_id };
|
||||
let assign = SystemInstruction::Assign {
|
||||
program_id: *program_id,
|
||||
};
|
||||
Transaction::new(
|
||||
from_keypair,
|
||||
&[],
|
||||
system_program::id(),
|
||||
&system_program::id(),
|
||||
&assign,
|
||||
recent_blockhash,
|
||||
fee,
|
||||
@@ -74,7 +76,7 @@ impl SystemTransaction {
|
||||
/// Create and sign new SystemInstruction::Move transaction
|
||||
pub fn new_move(
|
||||
from_keypair: &Keypair,
|
||||
to: Pubkey,
|
||||
to: &Pubkey,
|
||||
lamports: u64,
|
||||
recent_blockhash: Hash,
|
||||
fee: u64,
|
||||
@@ -82,8 +84,8 @@ impl SystemTransaction {
|
||||
let move_lamports = SystemInstruction::Move { lamports };
|
||||
Transaction::new(
|
||||
from_keypair,
|
||||
&[to],
|
||||
system_program::id(),
|
||||
&[*to],
|
||||
&system_program::id(),
|
||||
&move_lamports,
|
||||
recent_blockhash,
|
||||
fee,
|
||||
|
Reference in New Issue
Block a user