Style fixed after review
This commit is contained in:
parent
dd91121017
commit
bfd238e000
@ -91,7 +91,7 @@ pub struct ExecutedBlock {
|
|||||||
receipts: Vec<Receipt>,
|
receipts: Vec<Receipt>,
|
||||||
transactions_set: HashSet<H256>,
|
transactions_set: HashSet<H256>,
|
||||||
state: State<StateDB>,
|
state: State<StateDB>,
|
||||||
traces: Option<Vec<Vec<FlatTrace>>>
|
traces: Option<Vec<Vec<FlatTrace>>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A set of references to `ExecutedBlock` fields that are publicly accessible.
|
/// 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();
|
let unclosed_state = s.block.state.clone();
|
||||||
|
|
||||||
if let Err(e) = s.engine.on_close_block(&mut s.block) {
|
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() {
|
if let Err(e) = s.block.state.commit() {
|
||||||
@ -423,7 +423,7 @@ impl<'x> OpenBlock<'x> {
|
|||||||
let mut s = self;
|
let mut s = self;
|
||||||
|
|
||||||
if let Err(e) = s.engine.on_close_block(&mut s.block) {
|
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() {
|
if let Err(e) = s.block.state.commit() {
|
||||||
|
@ -229,7 +229,7 @@ pub trait Engine : Sync + Send {
|
|||||||
|
|
||||||
/// Block transformation functions, after the transactions.
|
/// Block transformation functions, after the transactions.
|
||||||
fn on_close_block(&self, _block: &mut ExecutedBlock) -> Result<(), Error> {
|
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.
|
/// None means that it requires external input (e.g. PoW) to seal a block.
|
||||||
|
@ -24,7 +24,7 @@ use block::*;
|
|||||||
use builtin::Builtin;
|
use builtin::Builtin;
|
||||||
use vm::EnvInfo;
|
use vm::EnvInfo;
|
||||||
use error::{BlockError, Error, TransactionError};
|
use error::{BlockError, Error, TransactionError};
|
||||||
use trace::{Tracer, ExecutiveTracer,RewardType};
|
use trace::{Tracer, ExecutiveTracer, RewardType};
|
||||||
use header::{Header, BlockNumber};
|
use header::{Header, BlockNumber};
|
||||||
use state::CleanupMode;
|
use state::CleanupMode;
|
||||||
use spec::CommonParams;
|
use spec::CommonParams;
|
||||||
|
@ -170,7 +170,7 @@ impl From<ethjson::spec::Params> for CommonParams {
|
|||||||
wasm: p.wasm.unwrap_or(false),
|
wasm: p.wasm.unwrap_or(false),
|
||||||
gas_limit_bound_divisor: p.gas_limit_bound_divisor.into(),
|
gas_limit_bound_divisor: p.gas_limit_bound_divisor.into(),
|
||||||
block_reward: p.block_reward.map_or_else(U256::zero, Into::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),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -74,17 +74,17 @@ fn can_trace_block_and_uncle_reward() {
|
|||||||
|
|
||||||
// Add root block first
|
// Add root block first
|
||||||
let mut root_block = OpenBlock::new(
|
let mut root_block = OpenBlock::new(
|
||||||
engine,
|
engine,
|
||||||
Default::default(),
|
Default::default(),
|
||||||
false,
|
false,
|
||||||
db,
|
db,
|
||||||
&last_header,
|
&last_header,
|
||||||
Arc::new(last_hashes.clone()),
|
Arc::new(last_hashes.clone()),
|
||||||
author.clone(),
|
author.clone(),
|
||||||
(3141562.into(), 31415620.into()),
|
(3141562.into(), 31415620.into()),
|
||||||
vec![],
|
vec![],
|
||||||
false,
|
false,
|
||||||
).unwrap();
|
).unwrap();
|
||||||
root_block.set_difficulty(U256::from(0x20000));
|
root_block.set_difficulty(U256::from(0x20000));
|
||||||
rolling_timestamp += 10;
|
rolling_timestamp += 10;
|
||||||
root_block.set_timestamp(rolling_timestamp);
|
root_block.set_timestamp(rolling_timestamp);
|
||||||
@ -103,17 +103,17 @@ fn can_trace_block_and_uncle_reward() {
|
|||||||
|
|
||||||
// Add parent block
|
// Add parent block
|
||||||
let mut parent_block = OpenBlock::new(
|
let mut parent_block = OpenBlock::new(
|
||||||
engine,
|
engine,
|
||||||
Default::default(),
|
Default::default(),
|
||||||
false,
|
false,
|
||||||
db,
|
db,
|
||||||
&last_header,
|
&last_header,
|
||||||
Arc::new(last_hashes.clone()),
|
Arc::new(last_hashes.clone()),
|
||||||
author.clone(),
|
author.clone(),
|
||||||
(3141562.into(), 31415620.into()),
|
(3141562.into(), 31415620.into()),
|
||||||
vec![],
|
vec![],
|
||||||
false,
|
false,
|
||||||
).unwrap();
|
).unwrap();
|
||||||
parent_block.set_difficulty(U256::from(0x20000));
|
parent_block.set_difficulty(U256::from(0x20000));
|
||||||
rolling_timestamp += 10;
|
rolling_timestamp += 10;
|
||||||
parent_block.set_timestamp(rolling_timestamp);
|
parent_block.set_timestamp(rolling_timestamp);
|
||||||
@ -181,10 +181,10 @@ fn can_trace_block_and_uncle_reward() {
|
|||||||
|
|
||||||
// Test0. Check overall filter
|
// Test0. Check overall filter
|
||||||
let filter = TraceFilter {
|
let filter = TraceFilter {
|
||||||
range: (BlockId::Number(1)..BlockId::Number(3)),
|
range: (BlockId::Number(1)..BlockId::Number(3)),
|
||||||
from_address: vec![],
|
from_address: vec![],
|
||||||
to_address: vec![],
|
to_address: vec![],
|
||||||
};
|
};
|
||||||
|
|
||||||
let traces = client.filter_traces(filter);
|
let traces = client.filter_traces(filter);
|
||||||
assert!(traces.is_some(), "Filtered traces should be present");
|
assert!(traces.is_some(), "Filtered traces should be present");
|
||||||
|
@ -130,8 +130,7 @@ impl Filter {
|
|||||||
from_matches && to_matches
|
from_matches && to_matches
|
||||||
},
|
},
|
||||||
Action::Reward(ref reward) => {
|
Action::Reward(ref reward) => {
|
||||||
let to_matches = self.to_address.matches(&reward.author);
|
self.to_address.matches(&reward.author)
|
||||||
to_matches
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -164,7 +164,7 @@ mod tests {
|
|||||||
use super::{FlatBlockTraces, FlatTransactionTraces, FlatTrace};
|
use super::{FlatBlockTraces, FlatTransactionTraces, FlatTrace};
|
||||||
use trace::trace::{Action, Res, CallResult, Call, Suicide, Reward};
|
use trace::trace::{Action, Res, CallResult, Call, Suicide, Reward};
|
||||||
use evm::CallType;
|
use evm::CallType;
|
||||||
use trace::RewardType;
|
use trace::RewardType;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn encode_flat_transaction_traces() {
|
fn encode_flat_transaction_traces() {
|
||||||
|
Loading…
Reference in New Issue
Block a user