improved naming

This commit is contained in:
debris 2016-08-04 08:52:31 +02:00
parent 03c3d16744
commit 4051524462
7 changed files with 13 additions and 14 deletions

View File

@ -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
})

View File

@ -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(),

View File

@ -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};

View File

@ -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,
}
}

View File

@ -55,7 +55,7 @@ impl AddressesFilter {
/// Returns blooms of this addresses filter.
pub fn blooms(&self) -> Vec<LogBloom> {
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(),

View File

@ -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)),

View File

@ -106,7 +106,7 @@ fn prepare_transaction<C, M>(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()),
}
}