2016-01-09 12:30:41 +01:00
|
|
|
use util::*;
|
2016-01-09 22:13:13 +01:00
|
|
|
use basic_types::LogBloom;
|
2015-12-20 13:16:12 +01:00
|
|
|
|
2016-01-09 23:47:15 +01:00
|
|
|
/// A single log's entry.
|
|
|
|
pub struct LogEntry {
|
|
|
|
pub address: Address,
|
|
|
|
pub topics: Vec<H256>,
|
|
|
|
pub data: Bytes,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl RlpStandard for LogEntry {
|
|
|
|
fn rlp_append(&self, s: &mut RlpStream) {
|
|
|
|
s.append_list(3);
|
|
|
|
s.append(&self.address);
|
|
|
|
s.append(&self.topics);
|
|
|
|
s.append(&self.data);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl LogEntry {
|
|
|
|
pub fn bloom(&self) -> LogBloom {
|
|
|
|
self.topics.iter().fold(LogBloom::from_bloomed(&self.address.sha3()), |b, t| b.with_bloomed(&t.sha3()))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-12-20 21:45:43 +01:00
|
|
|
/// Information describing execution of a transaction.
|
2015-12-20 13:16:12 +01:00
|
|
|
pub struct Receipt {
|
|
|
|
pub state_root: H256,
|
2016-01-08 22:04:21 +01:00
|
|
|
pub gas_used: U256,
|
2016-01-09 22:13:13 +01:00
|
|
|
pub log_bloom: LogBloom,
|
2016-01-09 23:47:15 +01:00
|
|
|
pub logs: Vec<LogEntry>,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl RlpStandard for Receipt {
|
|
|
|
fn rlp_append(&self, s: &mut RlpStream) {
|
|
|
|
s.append_list(4);
|
|
|
|
s.append(&self.state_root);
|
|
|
|
s.append(&self.gas_used);
|
|
|
|
s.append(&self.log_bloom);
|
|
|
|
// TODO: make work:
|
|
|
|
//s.append(&self.logs);
|
|
|
|
s.append_list(self.logs.len());
|
|
|
|
for l in self.logs.iter() {
|
|
|
|
l.rlp_append(s);
|
|
|
|
}
|
|
|
|
}
|
2015-12-20 13:16:12 +01:00
|
|
|
}
|