Rename process_transaction to process_instruction

This commit is contained in:
Greg Fitzgerald 2018-11-23 15:14:13 -07:00
parent cd488b7d07
commit b3af930153
5 changed files with 13 additions and 13 deletions

View File

@ -819,7 +819,7 @@ impl Bank {
// It's up to the contract to implement its own rules on moving funds
if system_program::check_id(&program_id) {
if let Err(err) =
system_program::process_transaction(&tx, instruction_index, program_accounts)
system_program::process_instruction(&tx, instruction_index, program_accounts)
{
let err = match err {
system_program::Error::ResultWithNegativeTokens(i) => {
@ -830,19 +830,19 @@ impl Bank {
return Err(err);
}
} else if budget_program::check_id(&program_id) {
if budget_program::process_transaction(&tx, instruction_index, program_accounts)
if budget_program::process_instruction(&tx, instruction_index, program_accounts)
.is_err()
{
return Err(BankError::ProgramRuntimeError(instruction_index as u8));
}
} else if storage_program::check_id(&program_id) {
if storage_program::process_transaction(&tx, instruction_index, program_accounts)
if storage_program::process_instruction(&tx, instruction_index, program_accounts)
.is_err()
{
return Err(BankError::ProgramRuntimeError(instruction_index as u8));
}
} else if vote_program::check_id(&program_id) {
if vote_program::process_transaction(&tx, instruction_index, program_accounts).is_err()
if vote_program::process_instruction(&tx, instruction_index, program_accounts).is_err()
{
return Err(BankError::ProgramRuntimeError(instruction_index as u8));
}

View File

@ -116,13 +116,13 @@ fn apply_debits(
/// * accounts[0] - The source of the tokens
/// * accounts[1] - The contract context. Once the contract has been completed, the tokens can
/// be spent from this account .
pub fn process_transaction(
pub fn process_instruction(
tx: &Transaction,
instruction_index: usize,
accounts: &mut [&mut Account],
) -> Result<(), BudgetError> {
if let Ok(instruction) = deserialize(tx.userdata(instruction_index)) {
trace!("process_transaction: {:?}", instruction);
trace!("process_instruction: {:?}", instruction);
apply_debits(tx, instruction_index, accounts, &instruction)
} else {
info!(
@ -264,7 +264,7 @@ mod test {
fn process_transaction(tx: &Transaction, accounts: &mut [Account]) -> Result<(), BudgetError> {
let mut refs: Vec<&mut Account> = accounts.iter_mut().collect();
super::process_transaction(&tx, 0, &mut refs[..])
super::process_instruction(&tx, 0, &mut refs[..])
}
#[test]
fn test_serializer() {

View File

@ -34,7 +34,7 @@ pub fn get_balance(account: &Account) -> u64 {
account.tokens
}
pub fn process_transaction(
pub fn process_instruction(
tx: &Transaction,
pix: usize,
_accounts: &mut [&mut Account],
@ -61,6 +61,6 @@ mod test {
fn test_storage_tx() {
let keypair = Keypair::new();
let tx = Transaction::new(&keypair, &[], id(), &(), Default::default(), 0);
assert!(process_transaction(&tx, 0, &mut []).is_err());
assert!(process_instruction(&tx, 0, &mut []).is_err());
}
}

View File

@ -35,13 +35,13 @@ pub fn id() -> Pubkey {
pub fn get_balance(account: &Account) -> u64 {
account.tokens
}
pub fn process_transaction(
pub fn process_instruction(
tx: &Transaction,
pix: usize,
accounts: &mut [&mut Account],
) -> Result<()> {
if let Ok(syscall) = deserialize(tx.userdata(pix)) {
trace!("process_transaction: {:?}", syscall);
trace!("process_instruction: {:?}", syscall);
match syscall {
SystemInstruction::CreateAccount {
tokens,
@ -111,7 +111,7 @@ mod test {
fn process_transaction(tx: &Transaction, accounts: &mut [Account]) -> Result<()> {
let mut refs: Vec<&mut Account> = accounts.iter_mut().collect();
super::process_transaction(&tx, 0, &mut refs[..])
super::process_instruction(&tx, 0, &mut refs[..])
}
#[test]

View File

@ -64,7 +64,7 @@ pub fn id() -> Pubkey {
Pubkey::new(&VOTE_PROGRAM_ID)
}
pub fn process_transaction(
pub fn process_instruction(
tx: &Transaction,
instruction_index: usize,
accounts: &mut [&mut Account],