From 7b93fc90ec859b5cf6c0e043b796fbf81bcbf414 Mon Sep 17 00:00:00 2001 From: Gav Date: Tue, 10 Jan 2017 19:42:57 +0100 Subject: [PATCH 1/2] Return 0 instead of error with out of gas on estimate_gas --- rpc/src/v1/impls/eth.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/rpc/src/v1/impls/eth.rs b/rpc/src/v1/impls/eth.rs index fd5f3d4f3eb..22164998306 100644 --- a/rpc/src/v1/impls/eth.rs +++ b/rpc/src/v1/impls/eth.rs @@ -673,6 +673,7 @@ impl Eth for EthClient where let signed = self.sign_call(request)?; take_weak!(self.client).estimate_gas(&signed, num.0.into()) .map(Into::into) + .or_else(|_| Ok(0.into())) .map_err(errors::from_call_error) } From f11f8c2c1302821600664690ce9f0ac6cb21e907 Mon Sep 17 00:00:00 2001 From: Gav Date: Wed, 11 Jan 2017 12:50:44 +0100 Subject: [PATCH 2/2] Fix stuff up. --- ethcore/src/client/client.rs | 4 ++-- rpc/src/v1/impls/eth.rs | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/ethcore/src/client/client.rs b/ethcore/src/client/client.rs index cd074a88c86..c612bb8faef 100644 --- a/ethcore/src/client/client.rs +++ b/ethcore/src/client/client.rs @@ -848,7 +848,7 @@ impl BlockChainClient for Client { difficulty: header.difficulty(), last_hashes: last_hashes, gas_used: U256::zero(), - gas_limit: header.gas_limit(), + gas_limit: U256::max_value(), }; // that's just a copy of the state. let mut state = self.state_at(block).ok_or(CallError::StatePruned)?; @@ -883,7 +883,7 @@ impl BlockChainClient for Client { difficulty: header.difficulty(), last_hashes: last_hashes, gas_used: U256::zero(), - gas_limit: header.gas_limit(), + gas_limit: U256::max_value(), }; // that's just a copy of the state. let mut original_state = self.state_at(block).ok_or(CallError::StatePruned)?; diff --git a/rpc/src/v1/impls/eth.rs b/rpc/src/v1/impls/eth.rs index 22164998306..fd5f3d4f3eb 100644 --- a/rpc/src/v1/impls/eth.rs +++ b/rpc/src/v1/impls/eth.rs @@ -673,7 +673,6 @@ impl Eth for EthClient where let signed = self.sign_call(request)?; take_weak!(self.client).estimate_gas(&signed, num.0.into()) .map(Into::into) - .or_else(|_| Ok(0.into())) .map_err(errors::from_call_error) }