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 block = BlockView::new(&bytes);
let header = block.header(); let header = block.header();
if let Err(e) = verify_block_family(&bytes, self.engine.deref().deref(), self.chain.read().unwrap().deref()) { 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 // TODO: mark as bad
return; return;
}; };
let parent = match self.chain.read().unwrap().block_header(&header.parent_hash) { let parent = match self.chain.read().unwrap().block_header(&header.parent_hash) {
Some(p) => p, Some(p) => p,
None => { 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; return;
}, },
}; };
@ -157,12 +157,12 @@ impl Client {
let result = match enact(&bytes, self.engine.deref().deref(), self.state_db.clone(), &parent, &last_hashes) { let result = match enact(&bytes, self.engine.deref().deref(), self.state_db.clone(), &parent, &last_hashes) {
Ok(b) => b, Ok(b) => b,
Err(e) => { 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; return;
} }
}; };
if let Err(e) = verify_block_final(&header, result.block().header()) { 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; return;
} }

View File

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

View File

@ -142,7 +142,9 @@ impl State {
let e = try!(Executive::new(self, env_info, engine).transact(t)); let e = try!(Executive::new(self, env_info, engine).transact(t));
//println!("Executed: {:?}", e); //println!("Executed: {:?}", e);
self.commit(); 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) { pub fn revert(&mut self, backup: State) {