Receipt logging

This commit is contained in:
arkpar 2016-01-15 02:52:37 +01:00
parent 5ce3275f04
commit 76223d3d13
3 changed files with 8 additions and 5 deletions

View File

@ -129,14 +129,14 @@ impl Client {
let block = BlockView::new(&bytes);
let header = block.header();
if let Err(e) = verify_block_family(&bytes, self.engine.deref().deref(), self.chain.read().unwrap().deref()) {
warn!(target: "client", "Stage 3 block verification failed for {}\nError: {:?}", header.hash(), e);
warn!(target: "client", "Stage 3 block verification failed for #{} ({})\nError: {:?}", header.number(), header.hash(), e);
// TODO: mark as bad
return;
};
let parent = match self.chain.read().unwrap().block_header(&header.parent_hash) {
Some(p) => p,
None => {
warn!(target: "client", "Block import failed for {}: Parent not found ({}) ", header.hash(), header.parent_hash);
warn!(target: "client", "Block import failed for #{} ({}): Parent not found ({}) ", header.number(), header.hash(), header.parent_hash);
return;
},
};
@ -157,12 +157,12 @@ impl Client {
let result = match enact(&bytes, self.engine.deref().deref(), self.state_db.clone(), &parent, &last_hashes) {
Ok(b) => b,
Err(e) => {
warn!(target: "client", "Block import failed for {}\nError: {:?}", header.hash(), e);
warn!(target: "client", "Block import failed for #{} ({})\nError: {:?}", header.number(), header.hash(), e);
return;
}
};
if let Err(e) = verify_block_final(&header, result.block().header()) {
warn!(target: "client", "Stage 4 block verification failed for {}\nError: {:?}", header.hash(), e);
warn!(target: "client", "Stage 4 block verification failed for #{} ({})\nError: {:?}", header.number(), header.hash(), e);
return;
}

View File

@ -3,6 +3,7 @@ use basic_types::LogBloom;
use log_entry::LogEntry;
/// Information describing execution of a transaction.
#[derive(Debug)]
pub struct Receipt {
pub state_root: H256,
pub gas_used: U256,

View File

@ -142,7 +142,9 @@ impl State {
let e = try!(Executive::new(self, env_info, engine).transact(t));
//println!("Executed: {:?}", e);
self.commit();
Ok(Receipt::new(self.root().clone(), e.gas_used, e.logs))
let receipt = Receipt::new(self.root().clone(), e.cumulative_gas_used, e.logs);
debug!("Transaction receipt: {:?}", receipt);
Ok(receipt)
}
pub fn revert(&mut self, backup: State) {