diff --git a/ethcore/src/client/mod.rs b/ethcore/src/client/mod.rs index 7ffa0c5d8..8e0a7b2dd 100644 --- a/ethcore/src/client/mod.rs +++ b/ethcore/src/client/mod.rs @@ -70,7 +70,7 @@ pub trait BlockChainClient : Sync + Send { fn nonce(&self, address: &Address, id: BlockID) -> Option; /// Get address nonce at the latest block's state. - fn nonce_latest(&self, address: &Address) -> U256 { + fn latest_nonce(&self, address: &Address) -> U256 { self.nonce(address, BlockID::Latest) .expect("nonce will return Some when given BlockID::Latest. nonce was given BlockID::Latest. \ Therefore nonce has returned Some; qed") @@ -89,7 +89,7 @@ pub trait BlockChainClient : Sync + Send { fn balance(&self, address: &Address, id: BlockID) -> Option; /// Get address balance at the latest block's state. - fn balance_latest(&self, address: &Address) -> U256 { + fn latest_balance(&self, address: &Address) -> U256 { self.balance(address, BlockID::Latest) .expect("balance will return Some if given BlockID::Latest. balance was given BlockID::Latest \ Therefore balance has returned Some; qed") @@ -102,7 +102,7 @@ pub trait BlockChainClient : Sync + Send { fn storage_at(&self, address: &Address, position: &H256, id: BlockID) -> Option; /// Get value of the storage at given position at the latest block's state. - fn storage_at_latest(&self, address: &Address, position: &H256) -> H256 { + fn latest_storage_at(&self, address: &Address, position: &H256) -> H256 { self.storage_at(address, position, BlockID::Latest) .expect("storage_at will return Some if given BlockID::Latest. storage_at was given BlockID::Latest. \ Therefore storage_at has returned Some; qed") diff --git a/miner/src/miner.rs b/miner/src/miner.rs index 9fb771bb7..3860a79e6 100644 --- a/miner/src/miner.rs +++ b/miner/src/miner.rs @@ -167,8 +167,8 @@ impl Miner { }; let mut queue = self.transaction_queue.lock().unwrap(); let fetch_account = |a: &Address| AccountDetails { - nonce: chain.nonce_latest(a), - balance: chain.balance_latest(a), + nonce: chain.latest_nonce(a), + balance: chain.latest_balance(a), }; for hash in invalid_transactions.into_iter() { queue.remove_invalid(&hash, &fetch_account); @@ -291,7 +291,7 @@ impl MinerService for Miner { fn balance(&self, chain: &BlockChainClient, address: &Address) -> U256 { let sealing_work = self.sealing_work.lock().unwrap(); sealing_work.peek_last_ref().map_or_else( - || chain.balance_latest(address), + || chain.latest_balance(address), |b| b.block().fields().state.balance(address) ) } @@ -299,14 +299,14 @@ impl MinerService for Miner { fn storage_at(&self, chain: &BlockChainClient, address: &Address, position: &H256) -> H256 { let sealing_work = self.sealing_work.lock().unwrap(); sealing_work.peek_last_ref().map_or_else( - || chain.storage_at_latest(address, position), + || chain.latest_storage_at(address, position), |b| b.block().fields().state.storage_at(address, position) ) } fn nonce(&self, chain: &BlockChainClient, address: &Address) -> U256 { let sealing_work = self.sealing_work.lock().unwrap(); - sealing_work.peek_last_ref().map_or_else(|| chain.nonce_latest(address), |b| b.block().fields().state.nonce(address)) + sealing_work.peek_last_ref().map_or_else(|| chain.latest_nonce(address), |b| b.block().fields().state.nonce(address)) } fn code(&self, chain: &BlockChainClient, address: &Address) -> Option { @@ -551,8 +551,8 @@ impl MinerService for Miner { let _sender = tx.sender(); } let _ = self.import_transactions(txs, |a| AccountDetails { - nonce: chain.nonce_latest(a), - balance: chain.balance_latest(a), + nonce: chain.latest_nonce(a), + balance: chain.latest_balance(a), }); }); } @@ -572,7 +572,7 @@ impl MinerService for Miner { }) .collect::>(); for sender in to_remove.into_iter() { - transaction_queue.remove_all(sender, chain.nonce_latest(&sender)); + transaction_queue.remove_all(sender, chain.latest_nonce(&sender)); } }); } diff --git a/rpc/src/v1/impls/eth.rs b/rpc/src/v1/impls/eth.rs index 0d9f7211d..7b7daeab9 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_latest(&request.from)), + .unwrap_or_else(|| client.latest_nonce(&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_latest(&from)), + nonce: request.nonce.unwrap_or_else(|| client.latest_nonce(&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_latest(&a), - balance: client.balance_latest(&a), + nonce: client.latest_nonce(&a), + balance: client.latest_balance(&a), } }) }; diff --git a/sync/src/chain.rs b/sync/src/chain.rs index 7f8e21e58..e66fce0d5 100644 --- a/sync/src/chain.rs +++ b/sync/src/chain.rs @@ -900,8 +900,8 @@ impl ChainSync { } let chain = io.chain(); let fetch_account = |a: &Address| AccountDetails { - nonce: chain.nonce_latest(a), - balance: chain.balance_latest(a), + nonce: chain.latest_nonce(a), + balance: chain.latest_balance(a), }; let _ = self.miner.import_transactions(transactions, fetch_account); Ok(())