From 7ace87e50f31055043cd942032b9d8eccae308a9 Mon Sep 17 00:00:00 2001 From: debris Date: Fri, 15 Jan 2016 00:04:40 +0100 Subject: [PATCH] fixes for review issues --- src/executive.rs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/executive.rs b/src/executive.rs index e26148f53..23af492d2 100644 --- a/src/executive.rs +++ b/src/executive.rs @@ -21,7 +21,7 @@ pub struct Substate { logs: Vec, /// Refund counter of SSTORE nonzero->zero. refunds_count: U256, - /// True if transaction, or one of it's subcalls runs out of gas. + /// True if transaction, or one of its subcalls runs out of gas. out_of_gas: bool, /// Created contracts. contracts_created: Vec
@@ -293,10 +293,17 @@ impl<'a> Executive<'a> { } fn revert_if_needed(&mut self, result: &evm::Result, substate: &mut Substate, backup: State) { - if let &Err(evm::Error::OutOfGas) = result { - substate.out_of_gas = true; - self.state.revert(backup); + // TODO: handle other evm::Errors same as OutOfGas once they are implemented + match &result { + &Err(evm::Error::OutOfGas) => { + substate.out_of_gas = true; + self.state.revert(backup); + }, + &Err(evm::Error::Internal) => (), + &Ok(_) => () + } + result } }