From bacc9a2494b8545b5d0c756304380ed3729f74de Mon Sep 17 00:00:00 2001 From: debris Date: Thu, 14 Jan 2016 02:20:46 +0100 Subject: [PATCH] proper gas calculation in executive --- src/executive.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/executive.rs b/src/executive.rs index dbccd7924..c21fa00ed 100644 --- a/src/executive.rs +++ b/src/executive.rs @@ -104,6 +104,8 @@ impl<'a> Executive<'a> { let sender = try!(t.sender()); let nonce = self.state.nonce(&sender); + // TODO: error on base gas required + // validate transaction nonce if t.nonce != nonce { return Err(From::from(ExecutionError::InvalidNonce { expected: nonce, is: t.nonce })); @@ -136,7 +138,7 @@ impl<'a> Executive<'a> { let backup = self.state.clone(); let schedule = self.engine.schedule(self.info); - let init_gas = t.gas - U256::from(schedule.tx_gas); + let init_gas = t.gas - U256::from(t.gas_required(&schedule)); let res = match t.action() { &Action::Create => {