Rename SystemInstruction::Move to SystemInstruction::Transfer

This commit is contained in:
Greg Fitzgerald
2019-04-02 21:52:07 -06:00
parent 43bb813cbe
commit 867f6f107b
24 changed files with 137 additions and 85 deletions

View File

@ -54,7 +54,7 @@ fn assign_account_to_program(
fn move_lamports(keyed_accounts: &mut [KeyedAccount], lamports: u64) -> Result<(), SystemError> {
if lamports > keyed_accounts[FROM_ACCOUNT_INDEX].account.lamports {
debug!(
"Move: insufficient lamports ({}, need {})",
"Transfer: insufficient lamports ({}, need {})",
keyed_accounts[FROM_ACCOUNT_INDEX].account.lamports, lamports
);
Err(SystemError::ResultWithNegativeLamports)?;
@ -92,7 +92,7 @@ pub fn process_instruction(
}
assign_account_to_program(keyed_accounts, &program_id)
}
SystemInstruction::Move { lamports } => move_lamports(keyed_accounts, lamports),
SystemInstruction::Transfer { lamports } => move_lamports(keyed_accounts, lamports),
}
.map_err(|e| InstructionError::CustomError(serialize(&e).unwrap()))
} else {
@ -297,7 +297,7 @@ mod tests {
];
let malicious_instruction = Instruction::new(
system_program::id(),
&SystemInstruction::Move { lamports: 10 },
&SystemInstruction::Transfer { lamports: 10 },
account_metas,
);
assert_eq!(