Skip to content

Commit

Permalink
Fix eth_call. (openethereum#6365)
Browse files Browse the repository at this point in the history
* Fix eth_call.

* Fix warning spam.
  • Loading branch information
tomusdrw authored and jacogr committed Aug 24, 2017
1 parent 4bda7bf commit 5c0f9f1
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions rpc/src/v1/helpers/fake_sign.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,17 @@ pub fn sign_call<B: MiningBlockChainClient, M: MinerService>(
request: CallRequest,
gas_cap: bool,
) -> Result<SignedTransaction, Error> {
let from = request.from.unwrap_or(0.into());
let mut gas = request.gas.unwrap_or(U256::max_value());
if gas_cap {
let max_gas = 50_000_000.into();
if gas > max_gas {
let max_gas = 50_000_000.into();
let gas = match request.gas {
Some(gas) if gas_cap && gas > max_gas => {
warn!("Gas limit capped to {} (from {})", max_gas, gas);
gas = max_gas
max_gas
}
}
Some(gas) => gas,
None if gas_cap => max_gas,
None => U256::from(2) << 50,
};
let from = request.from.unwrap_or(0.into());

Ok(Transaction {
nonce: request.nonce.unwrap_or_else(|| client.latest_nonce(&from)),
Expand Down

0 comments on commit 5c0f9f1

Please sign in to comment.