feat: impl rlp encodable for log and receipt (#1153)

This commit is contained in:
Rohit Narurkar 2022-04-18 18:55:45 +02:00 committed by GitHub
parent 6ad3d292b4
commit 45cce0f4b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 0 deletions

View File

@ -65,6 +65,15 @@ pub struct Log {
pub removed: Option<bool>,
}
impl rlp::Encodable for Log {
fn rlp_append(&self, s: &mut rlp::RlpStream) {
s.begin_list(3);
s.append(&self.address);
s.append_list(&self.topics);
s.append(&self.data.0);
}
}
#[derive(Copy, Clone, Debug, PartialEq)]
pub enum FilterBlockOption {
Range { from_block: Option<BlockNumber>, to_block: Option<BlockNumber> },

View File

@ -414,6 +414,16 @@ pub struct TransactionReceipt {
pub effective_gas_price: Option<U256>,
}
impl rlp::Encodable for TransactionReceipt {
fn rlp_append(&self, s: &mut RlpStream) {
s.begin_list(4);
s.append(&self.status);
s.append(&self.cumulative_gas_used);
s.append(&self.logs_bloom);
s.append_list(&self.logs);
}
}
#[cfg(test)]
#[cfg(not(feature = "celo"))]
mod tests {