improved naming
This commit is contained in:
parent
03c3d16744
commit
4051524462
@ -256,7 +256,7 @@ impl Client {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
let mut last_hashes = LastHashes::new();
|
let mut last_hashes = LastHashes::new();
|
||||||
last_hashes.resize(256, Default::default());
|
last_hashes.resize(256, H256::default());
|
||||||
last_hashes[0] = parent_hash;
|
last_hashes[0] = parent_hash;
|
||||||
for i in 0..255 {
|
for i in 0..255 {
|
||||||
match self.chain.block_details(&last_hashes[i]) {
|
match self.chain.block_details(&last_hashes[i]) {
|
||||||
@ -649,7 +649,7 @@ impl BlockChainClient for Client {
|
|||||||
timestamp: view.timestamp(),
|
timestamp: view.timestamp(),
|
||||||
difficulty: view.difficulty(),
|
difficulty: view.difficulty(),
|
||||||
last_hashes: last_hashes,
|
last_hashes: last_hashes,
|
||||||
gas_used: Default::default(),
|
gas_used: U256::zero(),
|
||||||
gas_limit: U256::max_value(),
|
gas_limit: U256::max_value(),
|
||||||
};
|
};
|
||||||
// that's just a copy of the state.
|
// that's just a copy of the state.
|
||||||
@ -696,7 +696,7 @@ impl BlockChainClient for Client {
|
|||||||
timestamp: view.timestamp(),
|
timestamp: view.timestamp(),
|
||||||
difficulty: view.difficulty(),
|
difficulty: view.difficulty(),
|
||||||
last_hashes: last_hashes,
|
last_hashes: last_hashes,
|
||||||
gas_used: U256::zero(),
|
gas_used: U256::default(),
|
||||||
gas_limit: view.gas_limit(),
|
gas_limit: view.gas_limit(),
|
||||||
};
|
};
|
||||||
for t in txs.iter().take(address.index) {
|
for t in txs.iter().take(address.index) {
|
||||||
@ -924,7 +924,7 @@ impl BlockChainClient for Client {
|
|||||||
entry: log,
|
entry: log,
|
||||||
block_hash: hash.clone(),
|
block_hash: hash.clone(),
|
||||||
block_number: number,
|
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,
|
transaction_index: index,
|
||||||
log_index: log_index + i
|
log_index: log_index + i
|
||||||
})
|
})
|
||||||
|
@ -47,7 +47,7 @@ impl Default for EnvInfo {
|
|||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
EnvInfo {
|
EnvInfo {
|
||||||
number: 0,
|
number: 0,
|
||||||
author: Default::default(),
|
author: Address::default(),
|
||||||
timestamp: 0,
|
timestamp: 0,
|
||||||
difficulty: 0.into(),
|
difficulty: 0.into(),
|
||||||
gas_limit: 0.into(),
|
gas_limit: 0.into(),
|
||||||
|
@ -80,8 +80,7 @@
|
|||||||
//! - It removes all transactions (either from `current` or `future`) with nonce < client nonce
|
//! - It removes all transactions (either from `current` or `future`) with nonce < client nonce
|
||||||
//! - It moves matching `future` transactions to `current`
|
//! - It moves matching `future` transactions to `current`
|
||||||
|
|
||||||
use std::default::Default;
|
use std::cmp::Ordering;
|
||||||
use std::cmp::{Ordering};
|
|
||||||
use std::cmp;
|
use std::cmp;
|
||||||
use std::collections::{HashMap, BTreeSet};
|
use std::collections::{HashMap, BTreeSet};
|
||||||
use util::{Address, H256, Uint, U256};
|
use util::{Address, H256, Uint, U256};
|
||||||
|
@ -45,7 +45,7 @@ impl Receipt {
|
|||||||
Receipt {
|
Receipt {
|
||||||
state_root: state_root,
|
state_root: state_root,
|
||||||
gas_used: gas_used,
|
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,
|
logs: logs,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ impl AddressesFilter {
|
|||||||
/// Returns blooms of this addresses filter.
|
/// Returns blooms of this addresses filter.
|
||||||
pub fn blooms(&self) -> Vec<LogBloom> {
|
pub fn blooms(&self) -> Vec<LogBloom> {
|
||||||
match self.list.is_empty() {
|
match self.list.is_empty() {
|
||||||
true => vec![Default::default()],
|
true => vec![LogBloom::default()],
|
||||||
false => self.list.iter()
|
false => self.list.iter()
|
||||||
.map(|address| LogBloom::from_bloomed(&address.sha3()))
|
.map(|address| LogBloom::from_bloomed(&address.sha3()))
|
||||||
.collect(),
|
.collect(),
|
||||||
|
@ -163,8 +163,8 @@ impl Transaction {
|
|||||||
pub fn invalid_sign(self) -> SignedTransaction {
|
pub fn invalid_sign(self) -> SignedTransaction {
|
||||||
SignedTransaction {
|
SignedTransaction {
|
||||||
unsigned: self,
|
unsigned: self,
|
||||||
r: Default::default(),
|
r: U256::default(),
|
||||||
s: Default::default(),
|
s: U256::default(),
|
||||||
v: 0,
|
v: 0,
|
||||||
hash: Cell::new(None),
|
hash: Cell::new(None),
|
||||||
sender: Cell::new(None),
|
sender: Cell::new(None),
|
||||||
@ -175,8 +175,8 @@ impl Transaction {
|
|||||||
pub fn fake_sign(self, from: Address) -> SignedTransaction {
|
pub fn fake_sign(self, from: Address) -> SignedTransaction {
|
||||||
SignedTransaction {
|
SignedTransaction {
|
||||||
unsigned: self,
|
unsigned: self,
|
||||||
r: Default::default(),
|
r: U256::default(),
|
||||||
s: Default::default(),
|
s: U256::default(),
|
||||||
v: 0,
|
v: 0,
|
||||||
hash: Cell::new(None),
|
hash: Cell::new(None),
|
||||||
sender: Cell::new(Some(from)),
|
sender: Cell::new(Some(from)),
|
||||||
|
@ -106,7 +106,7 @@ fn prepare_transaction<C, M>(client: &C, miner: &M, request: TransactionRequest)
|
|||||||
action: request.to.map_or(Action::Create, Action::Call),
|
action: request.to.map_or(Action::Create, Action::Call),
|
||||||
gas: request.gas.unwrap_or_else(|| miner.sensible_gas_limit()),
|
gas: request.gas.unwrap_or_else(|| miner.sensible_gas_limit()),
|
||||||
gas_price: request.gas_price.unwrap_or_else(|| default_gas_price(client, miner)),
|
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()),
|
data: request.data.map_or_else(Vec::new, |b| b.to_vec()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user