mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-21 13:54:44 +00:00
Update SSZ
- Implement generic list decoding> - Expose `encode` mod. - Add convenience encoding function.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
use super::ethereum_types::H256;
|
||||
use super::decode::decode_ssz_list;
|
||||
use super::{
|
||||
DecodeError,
|
||||
Decodable,
|
||||
@@ -65,6 +66,16 @@ impl Decodable for H256 {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> Decodable for Vec<T>
|
||||
where T: Decodable
|
||||
{
|
||||
fn ssz_decode(bytes: &[u8], index: usize)
|
||||
-> Result<(Self, usize), DecodeError>
|
||||
{
|
||||
decode_ssz_list(bytes, index)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
Reference in New Issue
Block a user