2016-01-09 12:30:41 +01:00
|
|
|
use util::*;
|
2016-01-09 22:13:13 +01:00
|
|
|
use basic_types::LogBloom;
|
2016-01-11 13:29:15 +01:00
|
|
|
use log_entry::LogEntry;
|
2016-01-09 23:47:15 +01:00
|
|
|
|
2015-12-20 21:45:43 +01:00
|
|
|
/// Information describing execution of a transaction.
|
2016-01-26 19:18:22 +01:00
|
|
|
#[derive(Default, Debug, Clone)]
|
2015-12-20 13:16:12 +01:00
|
|
|
pub struct Receipt {
|
2016-01-19 17:02:01 +01:00
|
|
|
/// TODO [Gav Wood] Please document me
|
2015-12-20 13:16:12 +01:00
|
|
|
pub state_root: H256,
|
2016-01-19 17:02:01 +01:00
|
|
|
/// TODO [Gav Wood] Please document me
|
2016-01-08 22:04:21 +01:00
|
|
|
pub gas_used: U256,
|
2016-01-19 17:02:01 +01:00
|
|
|
/// TODO [Gav Wood] Please document me
|
2016-01-09 22:13:13 +01:00
|
|
|
pub log_bloom: LogBloom,
|
2016-01-19 17:02:01 +01:00
|
|
|
/// TODO [Gav Wood] Please document me
|
2016-01-09 23:47:15 +01:00
|
|
|
pub logs: Vec<LogEntry>,
|
|
|
|
}
|
|
|
|
|
2016-01-11 17:37:22 +01:00
|
|
|
impl Receipt {
|
2016-01-19 17:02:01 +01:00
|
|
|
/// TODO [Gav Wood] Please document me
|
2016-01-11 17:37:22 +01:00
|
|
|
pub fn new(state_root: H256, gas_used: U256, logs: Vec<LogEntry>) -> Receipt {
|
|
|
|
Receipt {
|
|
|
|
state_root: state_root,
|
|
|
|
gas_used: gas_used,
|
|
|
|
log_bloom: logs.iter().fold(LogBloom::new(), |mut b, l| { b |= &l.bloom(); b }),
|
|
|
|
logs: logs,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-01-27 17:22:01 +01:00
|
|
|
impl Encodable for Receipt {
|
2016-01-09 23:47:15 +01:00
|
|
|
fn rlp_append(&self, s: &mut RlpStream) {
|
2016-01-27 17:22:01 +01:00
|
|
|
s.begin_list(4);
|
2016-01-09 23:47:15 +01:00
|
|
|
s.append(&self.state_root);
|
|
|
|
s.append(&self.gas_used);
|
|
|
|
s.append(&self.log_bloom);
|
2016-01-27 17:22:01 +01:00
|
|
|
s.append_list(&self.logs);
|
2016-01-09 23:47:15 +01:00
|
|
|
}
|
2015-12-20 13:16:12 +01:00
|
|
|
}
|