Style fixed after review

This commit is contained in:
Anton Gavrilov 2017-08-10 12:36:29 +02:00
parent dd91121017
commit bfd238e000
7 changed files with 36 additions and 37 deletions

View File

@ -91,7 +91,7 @@ pub struct ExecutedBlock {
receipts: Vec<Receipt>,
transactions_set: HashSet<H256>,
state: State<StateDB>,
traces: Option<Vec<Vec<FlatTrace>>>
traces: Option<Vec<Vec<FlatTrace>>>,
}
/// A set of references to `ExecutedBlock` fields that are publicly accessible.
@ -396,7 +396,7 @@ impl<'x> OpenBlock<'x> {
let unclosed_state = s.block.state.clone();
if let Err(e) = s.engine.on_close_block(&mut s.block) {
warn!("Encountered error on closing the block: {}", e);
warn!("Encountered error on closing the block: {}", e);
}
if let Err(e) = s.block.state.commit() {
@ -423,7 +423,7 @@ impl<'x> OpenBlock<'x> {
let mut s = self;
if let Err(e) = s.engine.on_close_block(&mut s.block) {
warn!("Encountered error on closing the block: {}", e);
warn!("Encountered error on closing the block: {}", e);
}
if let Err(e) = s.block.state.commit() {

View File

@ -229,7 +229,7 @@ pub trait Engine : Sync + Send {
/// Block transformation functions, after the transactions.
fn on_close_block(&self, _block: &mut ExecutedBlock) -> Result<(), Error> {
Ok(())
Ok(())
}
/// None means that it requires external input (e.g. PoW) to seal a block.

View File

@ -24,7 +24,7 @@ use block::*;
use builtin::Builtin;
use vm::EnvInfo;
use error::{BlockError, Error, TransactionError};
use trace::{Tracer, ExecutiveTracer,RewardType};
use trace::{Tracer, ExecutiveTracer, RewardType};
use header::{Header, BlockNumber};
use state::CleanupMode;
use spec::CommonParams;
@ -309,7 +309,7 @@ impl Engine for Arc<Ethash> {
u.author(),
&result_uncle_reward,
CleanupMode::NoEmpty
)
)
} else {
result_uncle_reward = reward.shr(5);
fields.state.add_balance(
@ -322,7 +322,7 @@ impl Engine for Arc<Ethash> {
// Trace uncle rewards
if tracing_enabled {
tracer.trace_reward(uncle_author, result_uncle_reward, RewardType::Uncle);
}
}
}
// Commit state so that we can actually figure out the state root.

View File

@ -170,7 +170,7 @@ impl From<ethjson::spec::Params> for CommonParams {
wasm: p.wasm.unwrap_or(false),
gas_limit_bound_divisor: p.gas_limit_bound_divisor.into(),
block_reward: p.block_reward.map_or_else(U256::zero, Into::into),
registrar: p.registrar.map_or_else(Address::new, Into::into)
registrar: p.registrar.map_or_else(Address::new, Into::into),
}
}
}

View File

@ -74,17 +74,17 @@ fn can_trace_block_and_uncle_reward() {
// Add root block first
let mut root_block = OpenBlock::new(
engine,
Default::default(),
false,
db,
&last_header,
Arc::new(last_hashes.clone()),
author.clone(),
(3141562.into(), 31415620.into()),
vec![],
false,
).unwrap();
engine,
Default::default(),
false,
db,
&last_header,
Arc::new(last_hashes.clone()),
author.clone(),
(3141562.into(), 31415620.into()),
vec![],
false,
).unwrap();
root_block.set_difficulty(U256::from(0x20000));
rolling_timestamp += 10;
root_block.set_timestamp(rolling_timestamp);
@ -103,17 +103,17 @@ fn can_trace_block_and_uncle_reward() {
// Add parent block
let mut parent_block = OpenBlock::new(
engine,
Default::default(),
false,
db,
&last_header,
Arc::new(last_hashes.clone()),
author.clone(),
(3141562.into(), 31415620.into()),
vec![],
false,
).unwrap();
engine,
Default::default(),
false,
db,
&last_header,
Arc::new(last_hashes.clone()),
author.clone(),
(3141562.into(), 31415620.into()),
vec![],
false,
).unwrap();
parent_block.set_difficulty(U256::from(0x20000));
rolling_timestamp += 10;
parent_block.set_timestamp(rolling_timestamp);
@ -181,10 +181,10 @@ fn can_trace_block_and_uncle_reward() {
// Test0. Check overall filter
let filter = TraceFilter {
range: (BlockId::Number(1)..BlockId::Number(3)),
from_address: vec![],
to_address: vec![],
};
range: (BlockId::Number(1)..BlockId::Number(3)),
from_address: vec![],
to_address: vec![],
};
let traces = client.filter_traces(filter);
assert!(traces.is_some(), "Filtered traces should be present");

View File

@ -130,8 +130,7 @@ impl Filter {
from_matches && to_matches
},
Action::Reward(ref reward) => {
let to_matches = self.to_address.matches(&reward.author);
to_matches
self.to_address.matches(&reward.author)
}
}
}

View File

@ -164,7 +164,7 @@ mod tests {
use super::{FlatBlockTraces, FlatTransactionTraces, FlatTrace};
use trace::trace::{Action, Res, CallResult, Call, Suicide, Reward};
use evm::CallType;
use trace::RewardType;
use trace::RewardType;
#[test]
fn encode_flat_transaction_traces() {