Remove instruction index parameter

This commit is contained in:
Greg Fitzgerald 2018-11-23 15:34:51 -07:00
parent b3af930153
commit f827bfd83f
2 changed files with 5 additions and 5 deletions

View File

@ -822,8 +822,8 @@ impl Bank {
system_program::process_instruction(&tx, instruction_index, program_accounts)
{
let err = match err {
system_program::Error::ResultWithNegativeTokens(i) => {
BankError::ResultWithNegativeTokens(i)
system_program::Error::ResultWithNegativeTokens => {
BankError::ResultWithNegativeTokens(instruction_index as u8)
}
_ => BankError::ProgramRuntimeError(instruction_index as u8),
};

View File

@ -12,7 +12,7 @@ pub enum Error {
InvalidArgument,
AssignOfUnownedAccount,
AccountNotFinalized,
ResultWithNegativeTokens(u8),
ResultWithNegativeTokens,
}
impl std::fmt::Display for Error {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
@ -60,7 +60,7 @@ pub fn process_instruction(
}
if tokens > accounts[0].tokens {
info!("Insufficient tokens in account[0]");
Err(Error::ResultWithNegativeTokens(pix as u8))?;
Err(Error::ResultWithNegativeTokens)?;
}
accounts[0].tokens -= tokens;
accounts[1].tokens += tokens;
@ -79,7 +79,7 @@ pub fn process_instruction(
//bank should be verifying correctness
if tokens > accounts[0].tokens {
info!("Insufficient tokens in account[0]");
Err(Error::ResultWithNegativeTokens(pix as u8))?;
Err(Error::ResultWithNegativeTokens)?;
}
accounts[0].tokens -= tokens;
accounts[1].tokens += tokens;