diff --git a/src/bank.rs b/src/bank.rs index ff0e6d56ab..66776a0caa 100644 --- a/src/bank.rs +++ b/src/bank.rs @@ -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), }; diff --git a/src/system_program.rs b/src/system_program.rs index 9c5b8fd606..5d70e33f9b 100644 --- a/src/system_program.rs +++ b/src/system_program.rs @@ -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;