fixes for review issues

This commit is contained in:
debris 2016-01-15 00:04:40 +01:00
parent daccbed9a1
commit 7ace87e50f

View File

@ -21,7 +21,7 @@ pub struct Substate {
logs: Vec<LogEntry>, logs: Vec<LogEntry>,
/// Refund counter of SSTORE nonzero->zero. /// Refund counter of SSTORE nonzero->zero.
refunds_count: U256, 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, out_of_gas: bool,
/// Created contracts. /// Created contracts.
contracts_created: Vec<Address> contracts_created: Vec<Address>
@ -293,10 +293,17 @@ impl<'a> Executive<'a> {
} }
fn revert_if_needed(&mut self, result: &evm::Result, substate: &mut Substate, backup: State) { fn revert_if_needed(&mut self, result: &evm::Result, substate: &mut Substate, backup: State) {
if let &Err(evm::Error::OutOfGas) = result { // TODO: handle other evm::Errors same as OutOfGas once they are implemented
substate.out_of_gas = true; match &result {
self.state.revert(backup); &Err(evm::Error::OutOfGas) => {
substate.out_of_gas = true;
self.state.revert(backup);
},
&Err(evm::Error::Internal) => (),
&Ok(_) => ()
} }
result
} }
} }