From 30eee767676a6819410b48aeeeac97defb5aefa3 Mon Sep 17 00:00:00 2001 From: Robert Habermeier Date: Thu, 26 May 2016 12:57:15 +0200 Subject: [PATCH] use new nonce function in eth_TransactionCount --- rpc/src/v1/impls/eth.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/rpc/src/v1/impls/eth.rs b/rpc/src/v1/impls/eth.rs index 2aa5ff3f2..0d9f7211d 100644 --- a/rpc/src/v1/impls/eth.rs +++ b/rpc/src/v1/impls/eth.rs @@ -164,7 +164,7 @@ impl EthClient where .or_else(|| miner .last_nonce(&request.from) .map(|nonce| nonce + U256::one())) - .unwrap_or_else(|| client.nonce(&request.from)), + .unwrap_or_else(|| client.nonce_latest(&request.from)), action: request.to.map_or(Action::Create, Action::Call), gas: request.gas.unwrap_or_else(|| miner.sensible_gas_limit()), gas_price: request.gas_price.unwrap_or_else(|| miner.sensible_gas_price()), @@ -181,7 +181,7 @@ impl EthClient where let miner = take_weak!(self.miner); let from = request.from.unwrap_or(Address::zero()); Ok(EthTransaction { - nonce: request.nonce.unwrap_or_else(|| client.nonce(&from)), + nonce: request.nonce.unwrap_or_else(|| client.nonce_latest(&from)), action: request.to.map_or(Action::Create, Action::Call), gas: request.gas.unwrap_or(U256::from(50_000_000)), gas_price: request.gas_price.unwrap_or_else(|| miner.sensible_gas_price()), @@ -199,8 +199,8 @@ impl EthClient where miner.import_own_transaction(client.deref(), signed_transaction, |a: &Address| { AccountDetails { - nonce: client.nonce(&a), - balance: client.balance(&a, BlockID::Latest).unwrap(), + nonce: client.nonce_latest(&a), + balance: client.balance_latest(&a), } }) }; @@ -372,8 +372,7 @@ impl Eth for EthClient where from_params_default_second(params) .and_then(|(address, block_number,)| match block_number { BlockNumber::Pending => to_value(&take_weak!(self.miner).nonce(take_weak!(self.client).deref(), &address)), - BlockNumber::Latest => to_value(&take_weak!(self.client).nonce(&address)), - _ => Err(Error::invalid_params()), + id => to_value(&take_weak!(self.client).nonce(&address, id.into())), }) }