Add signable_message() to Attestation

This commit is contained in:
Paul Hauner
2019-01-27 17:27:53 +11:00
parent 2bda7e3d14
commit b487db68a1
3 changed files with 15 additions and 8 deletions

View File

@@ -5,6 +5,8 @@ use rand::RngCore;
use serde_derive::Serialize;
use ssz::{hash, Decodable, DecodeError, Encodable, SszStream, TreeHash};
mod signing;
#[derive(Debug, Clone, PartialEq, Serialize)]
pub struct Attestation {
pub data: AttestationData,

View File

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