Ensure attestations are created with empty signature (#960)
* Ensure attestations are created with empty sig * Update docs
This commit is contained in:
parent
784997b09b
commit
5a6e90428b
@ -756,7 +756,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
|||||||
root: target_root,
|
root: target_root,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
signature: AggregateSignature::new(),
|
signature: AggregateSignature::empty_signature(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ fn produces_attestations() {
|
|||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
attestation.signature,
|
attestation.signature,
|
||||||
AggregateSignature::new(),
|
AggregateSignature::empty_signature(),
|
||||||
"bad signature"
|
"bad signature"
|
||||||
);
|
);
|
||||||
assert_eq!(data.index, index, "bad index");
|
assert_eq!(data.index, index, "bad index");
|
||||||
|
@ -263,7 +263,7 @@ Returns a `Attestation` object with a default signature. The `signature` field s
|
|||||||
"root": "0xaefd23b384994dc0c1a6b77836bdb2f24f209ebfe6c4819324d9685f4a43b4e1"
|
"root": "0xaefd23b384994dc0c1a6b77836bdb2f24f209ebfe6c4819324d9685f4a43b4e1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"signature": "0xc00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
|
"signature": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -32,9 +32,12 @@ impl AggregateSignature {
|
|||||||
|
|
||||||
/// Add (aggregate) a signature to the `AggregateSignature`.
|
/// Add (aggregate) a signature to the `AggregateSignature`.
|
||||||
pub fn add(&mut self, signature: &Signature) {
|
pub fn add(&mut self, signature: &Signature) {
|
||||||
if !self.is_empty {
|
if self.is_empty {
|
||||||
self.aggregate_signature.add(signature.as_raw())
|
self.aggregate_signature = RawAggregateSignature::new();
|
||||||
|
self.is_empty = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
self.aggregate_signature.add(signature.as_raw())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Add (aggregate) another `AggregateSignature`.
|
/// Add (aggregate) another `AggregateSignature`.
|
||||||
|
Loading…
Reference in New Issue
Block a user