From 40515244622d1e2060a58f28db02a269e2651be0 Mon Sep 17 00:00:00 2001 From: debris Date: Thu, 4 Aug 2016 08:52:31 +0200 Subject: [PATCH] improved naming --- ethcore/src/client/client.rs | 8 ++++---- ethcore/src/env_info.rs | 2 +- ethcore/src/miner/transaction_queue.rs | 3 +-- ethcore/src/types/receipt.rs | 2 +- ethcore/src/types/trace_types/filter.rs | 2 +- ethcore/src/types/transaction.rs | 8 ++++---- rpc/src/v1/impls/mod.rs | 2 +- 7 files changed, 13 insertions(+), 14 deletions(-) diff --git a/ethcore/src/client/client.rs b/ethcore/src/client/client.rs index 7673bb850..be96c8916 100644 --- a/ethcore/src/client/client.rs +++ b/ethcore/src/client/client.rs @@ -256,7 +256,7 @@ impl Client { } } let mut last_hashes = LastHashes::new(); - last_hashes.resize(256, Default::default()); + last_hashes.resize(256, H256::default()); last_hashes[0] = parent_hash; for i in 0..255 { match self.chain.block_details(&last_hashes[i]) { @@ -649,7 +649,7 @@ impl BlockChainClient for Client { timestamp: view.timestamp(), difficulty: view.difficulty(), last_hashes: last_hashes, - gas_used: Default::default(), + gas_used: U256::zero(), gas_limit: U256::max_value(), }; // that's just a copy of the state. @@ -696,7 +696,7 @@ impl BlockChainClient for Client { timestamp: view.timestamp(), difficulty: view.difficulty(), last_hashes: last_hashes, - gas_used: U256::zero(), + gas_used: U256::default(), gas_limit: view.gas_limit(), }; for t in txs.iter().take(address.index) { @@ -924,7 +924,7 @@ impl BlockChainClient for Client { entry: log, block_hash: hash.clone(), block_number: number, - transaction_hash: hashes.get(index).cloned().unwrap_or_else(Default::default), + transaction_hash: hashes.get(index).cloned().unwrap_or_else(H256::default), transaction_index: index, log_index: log_index + i }) diff --git a/ethcore/src/env_info.rs b/ethcore/src/env_info.rs index 02a551d3a..ddef71608 100644 --- a/ethcore/src/env_info.rs +++ b/ethcore/src/env_info.rs @@ -47,7 +47,7 @@ impl Default for EnvInfo { fn default() -> Self { EnvInfo { number: 0, - author: Default::default(), + author: Address::default(), timestamp: 0, difficulty: 0.into(), gas_limit: 0.into(), diff --git a/ethcore/src/miner/transaction_queue.rs b/ethcore/src/miner/transaction_queue.rs index eb3587705..6a88b4388 100644 --- a/ethcore/src/miner/transaction_queue.rs +++ b/ethcore/src/miner/transaction_queue.rs @@ -80,8 +80,7 @@ //! - It removes all transactions (either from `current` or `future`) with nonce < client nonce //! - It moves matching `future` transactions to `current` -use std::default::Default; -use std::cmp::{Ordering}; +use std::cmp::Ordering; use std::cmp; use std::collections::{HashMap, BTreeSet}; use util::{Address, H256, Uint, U256}; diff --git a/ethcore/src/types/receipt.rs b/ethcore/src/types/receipt.rs index 2550b532e..07847d1cb 100644 --- a/ethcore/src/types/receipt.rs +++ b/ethcore/src/types/receipt.rs @@ -45,7 +45,7 @@ impl Receipt { Receipt { state_root: state_root, gas_used: gas_used, - log_bloom: logs.iter().fold(Default::default(), |mut b, l| { b = &b | &l.bloom(); b }), //TODO: use |= operator + log_bloom: logs.iter().fold(LogBloom::default(), |mut b, l| { b = &b | &l.bloom(); b }), //TODO: use |= operator logs: logs, } } diff --git a/ethcore/src/types/trace_types/filter.rs b/ethcore/src/types/trace_types/filter.rs index 3f7e727be..27ef38e08 100644 --- a/ethcore/src/types/trace_types/filter.rs +++ b/ethcore/src/types/trace_types/filter.rs @@ -55,7 +55,7 @@ impl AddressesFilter { /// Returns blooms of this addresses filter. pub fn blooms(&self) -> Vec { match self.list.is_empty() { - true => vec![Default::default()], + true => vec![LogBloom::default()], false => self.list.iter() .map(|address| LogBloom::from_bloomed(&address.sha3())) .collect(), diff --git a/ethcore/src/types/transaction.rs b/ethcore/src/types/transaction.rs index 3aa24380f..8c26293d3 100644 --- a/ethcore/src/types/transaction.rs +++ b/ethcore/src/types/transaction.rs @@ -163,8 +163,8 @@ impl Transaction { pub fn invalid_sign(self) -> SignedTransaction { SignedTransaction { unsigned: self, - r: Default::default(), - s: Default::default(), + r: U256::default(), + s: U256::default(), v: 0, hash: Cell::new(None), sender: Cell::new(None), @@ -175,8 +175,8 @@ impl Transaction { pub fn fake_sign(self, from: Address) -> SignedTransaction { SignedTransaction { unsigned: self, - r: Default::default(), - s: Default::default(), + r: U256::default(), + s: U256::default(), v: 0, hash: Cell::new(None), sender: Cell::new(Some(from)), diff --git a/rpc/src/v1/impls/mod.rs b/rpc/src/v1/impls/mod.rs index 94aba32e5..86d796f63 100644 --- a/rpc/src/v1/impls/mod.rs +++ b/rpc/src/v1/impls/mod.rs @@ -106,7 +106,7 @@ fn prepare_transaction(client: &C, miner: &M, request: TransactionRequest) 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(|| default_gas_price(client, miner)), - value: request.value.unwrap_or_else(Default::default), + value: request.value.unwrap_or_else(U256::default), data: request.data.map_or_else(Vec::new, |b| b.to_vec()), } }