mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-17 04:48:21 +00:00
Added/modified types and constants according to specs
This commit is contained in:
@@ -35,6 +35,12 @@ impl Signature {
|
||||
pub fn as_raw(&self) -> &RawSignature {
|
||||
&self.0
|
||||
}
|
||||
|
||||
/// Returns a new empty signature.
|
||||
pub fn empty_sig() -> Self {
|
||||
let empty: Vec<u8> = vec![0; 97];
|
||||
Signature(RawSignature::from_bytes(&empty).unwrap())
|
||||
}
|
||||
}
|
||||
|
||||
impl Encodable for Signature {
|
||||
@@ -68,4 +74,16 @@ mod tests {
|
||||
|
||||
assert_eq!(original, decoded);
|
||||
}
|
||||
|
||||
#[test]
|
||||
pub fn test_empty_sig() {
|
||||
let sig = Signature::empty_sig();
|
||||
|
||||
let sig_as_bytes: Vec<u8> = sig.as_raw().as_bytes();
|
||||
|
||||
assert_eq!(sig_as_bytes.len(), 97);
|
||||
for one_byte in sig_as_bytes.iter() {
|
||||
assert_eq!(*one_byte, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user