Ensure attestations are created with empty signature (#960)

* Ensure attestations are created with empty sig

* Update docs
This commit is contained in:
Paul Hauner 2020-03-30 09:29:29 +11:00 committed by GitHub
parent 784997b09b
commit 5a6e90428b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 5 deletions

View File

@ -756,7 +756,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
root: target_root,
},
},
signature: AggregateSignature::new(),
signature: AggregateSignature::empty_signature(),
})
}

View File

@ -106,7 +106,7 @@ fn produces_attestations() {
);
assert_eq!(
attestation.signature,
AggregateSignature::new(),
AggregateSignature::empty_signature(),
"bad signature"
);
assert_eq!(data.index, index, "bad index");

View File

@ -263,7 +263,7 @@ Returns a `Attestation` object with a default signature. The `signature` field s
"root": "0xaefd23b384994dc0c1a6b77836bdb2f24f209ebfe6c4819324d9685f4a43b4e1"
}
},
"signature": "0xc00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
"signature": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
}
```

View File

@ -32,9 +32,12 @@ impl AggregateSignature {
/// Add (aggregate) a signature to the `AggregateSignature`.
pub fn add(&mut self, signature: &Signature) {
if !self.is_empty {
self.aggregate_signature.add(signature.as_raw())
if self.is_empty {
self.aggregate_signature = RawAggregateSignature::new();
self.is_empty = false;
}
self.aggregate_signature.add(signature.as_raw())
}
/// Add (aggregate) another `AggregateSignature`.