|
|
@@ -85,25 +85,24 @@ impl NegativeReport {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- /// Verify report if proof of bridge knowledge is bridge line hash
|
|
|
- pub fn verify_with_hash_of_bridge_line(self, bl: &BridgeLine) -> bool {
|
|
|
+ /// Verify report. Caller must pass Some of the bridge knowledge proof type
|
|
|
+ /// in the report.
|
|
|
+ pub fn verify(self, bl: Option<&BridgeLine>, bucket: Option<&Scalar>) -> bool {
|
|
|
match self.bridge_pok {
|
|
|
- ProofOfBridgeKnowledge::HashOfBridgeLine(pok) => {
|
|
|
- let hash = HashOfBridgeLine::new(bl);
|
|
|
- hash == pok
|
|
|
- }
|
|
|
- _ => false,
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /// Verify report if proof of bridge knowledge is bucket hash
|
|
|
- pub fn verify_with_hash_of_bucket(self, bucket: &Scalar) -> bool {
|
|
|
- match self.bridge_pok {
|
|
|
- ProofOfBridgeKnowledge::HashOfBucket(pok) => {
|
|
|
- let hash = HashOfBucket::new(bucket);
|
|
|
- hash == pok
|
|
|
- }
|
|
|
- _ => false,
|
|
|
+ ProofOfBridgeKnowledge::HashOfBridgeLine(pok) => match bl {
|
|
|
+ Some(b) => {
|
|
|
+ let hash = HashOfBridgeLine::new(b);
|
|
|
+ hash == pok
|
|
|
+ }
|
|
|
+ None => false,
|
|
|
+ },
|
|
|
+ ProofOfBridgeKnowledge::HashOfBucket(pok) => match bucket {
|
|
|
+ Some(b) => {
|
|
|
+ let hash = HashOfBucket::new(b);
|
|
|
+ hash == pok
|
|
|
+ }
|
|
|
+ None => false,
|
|
|
+ },
|
|
|
}
|
|
|
}
|
|
|
}
|