Update ssz for Block
This commit is contained in:
parent
976e3a717e
commit
cbaee765e3
@ -1,6 +1,6 @@
|
||||
use super::utils::types::Hash256;
|
||||
use super::attestation_record::AttestationRecord;
|
||||
use super::ssz;
|
||||
use super::ssz::{ Encodable, SszStream };
|
||||
|
||||
const SSZ_BLOCK_LENGTH: usize = 192;
|
||||
|
||||
@ -27,12 +27,12 @@ impl Block {
|
||||
}
|
||||
}
|
||||
|
||||
// Not sure if this will be useful, leaving it here for the
|
||||
// time being.
|
||||
pub fn ssz_encode_without_attestations(&self)
|
||||
/// Return the bytes that should be signed in order to
|
||||
/// attest for this block.
|
||||
pub fn encode_for_signing(&self)
|
||||
-> [u8; SSZ_BLOCK_LENGTH]
|
||||
{
|
||||
let mut s = ssz::SszStream::new();
|
||||
let mut s = SszStream::new();
|
||||
s.append(&self.parent_hash);
|
||||
s.append(&self.slot_number);
|
||||
s.append(&self.randao_reveal);
|
||||
@ -45,6 +45,19 @@ impl Block {
|
||||
}
|
||||
}
|
||||
|
||||
impl Encodable for Block {
|
||||
fn ssz_append(&self, s: &mut SszStream) {
|
||||
let mut s = SszStream::new();
|
||||
s.append(&self.parent_hash);
|
||||
s.append(&self.slot_number);
|
||||
s.append(&self.randao_reveal);
|
||||
s.append(&self.attestations);
|
||||
s.append(&self.pow_chain_ref);
|
||||
s.append(&self.active_state_root);
|
||||
s.append(&self.crystallized_state_root);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
|
Loading…
Reference in New Issue
Block a user