Move all attestation_data fns into same file

This commit is contained in:
Paul Hauner 2019-02-05 12:40:03 +11:00
parent 05b890860a
commit cbb84c0d69
No known key found for this signature in database
GPG Key ID: D362883A9218FCC6
2 changed files with 9 additions and 16 deletions

View File

@ -1,11 +1,8 @@
use super::Hash256;
use super::{AttestationDataAndCustodyBit, Hash256};
use crate::test_utils::TestRandom;
use rand::RngCore;
use serde_derive::Serialize;
use ssz::{hash, Decodable, DecodeError, Encodable, SszStream, TreeHash};
use std::hash::Hash;
mod signing;
pub const SSZ_ATTESTION_DATA_LENGTH: usize = {
8 + // slot
@ -51,6 +48,14 @@ impl AttestationData {
pub fn canonical_root(&self) -> Hash256 {
Hash256::zero()
}
pub fn signable_message(&self, custody_bit: bool) -> Vec<u8> {
let attestation_data_and_custody_bit = AttestationDataAndCustodyBit {
data: self.clone(),
custody_bit,
};
attestation_data_and_custody_bit.hash_tree_root()
}
}
impl Encodable for AttestationData {

View File

@ -1,12 +0,0 @@
use crate::{AttestationData, AttestationDataAndCustodyBit};
use ssz::TreeHash;
impl AttestationData {
pub fn signable_message(&self, custody_bit: bool) -> Vec<u8> {
let attestation_data_and_custody_bit = AttestationDataAndCustodyBit {
data: self.clone(),
custody_bit,
};
attestation_data_and_custody_bit.hash_tree_root()
}
}