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:
Rob Walker
2019-03-09 19:28:43 -08:00
committed by GitHub
parent ac226c3e14
commit 195a880576
89 changed files with 864 additions and 828 deletions

View File

@ -26,28 +26,28 @@ pub enum SystemInstruction {
impl SystemInstruction {
pub fn new_program_account(
from_id: Pubkey,
to_id: Pubkey,
from_id: &Pubkey,
to_id: &Pubkey,
lamports: u64,
space: u64,
program_id: Pubkey,
program_id: &Pubkey,
) -> BuilderInstruction {
BuilderInstruction::new(
system_program::id(),
&SystemInstruction::CreateAccount {
lamports,
space,
program_id,
program_id: *program_id,
},
vec![(from_id, true), (to_id, false)],
vec![(*from_id, true), (*to_id, false)],
)
}
pub fn new_move(from_id: Pubkey, to_id: Pubkey, lamports: u64) -> BuilderInstruction {
pub fn new_move(from_id: &Pubkey, to_id: &Pubkey, lamports: u64) -> BuilderInstruction {
BuilderInstruction::new(
system_program::id(),
&SystemInstruction::Move { lamports },
vec![(from_id, true), (to_id, false)],
vec![(*from_id, true), (*to_id, false)],
)
}
}