mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-21 22:04:44 +00:00
Impl ssz Enc/Decode on Address. Decode on Vec<T>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
extern crate bytes;
|
||||
|
||||
use self::bytes::{BufMut, BytesMut};
|
||||
use super::ethereum_types::H256;
|
||||
use super::ethereum_types::{Address, H256};
|
||||
use super::{Encodable, SszStream};
|
||||
|
||||
/*
|
||||
@@ -52,6 +52,21 @@ impl Encodable for H256 {
|
||||
}
|
||||
}
|
||||
|
||||
impl Encodable for Address {
|
||||
fn ssz_append(&self, s: &mut SszStream) {
|
||||
s.append_encoded_raw(&self.to_vec());
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> Encodable for Vec<T>
|
||||
where
|
||||
T: Encodable,
|
||||
{
|
||||
fn ssz_append(&self, s: &mut SszStream) {
|
||||
s.append_vec(&self);
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
Reference in New Issue
Block a user