Add date to proof of bridge knowledge in negative reports

This commit is contained in:
Vecna 2024-04-04 22:56:10 -04:00
parent eb1b4939be
commit 13bf94ec17
1 changed files with 9 additions and 2 deletions

View File

@ -371,6 +371,8 @@ mod tests {
let num_report_3 = rng.next_u32() % 4 + 1; let num_report_3 = rng.next_u32() % 4 + 1;
let mut reports = BTreeMap::<String, u32>::new(); let mut reports = BTreeMap::<String, u32>::new();
let date = th.context.ba.lock().unwrap().today();
let report_1 = let report_1 =
NegativeReport::from_bridgeline(bridges[0], "ru".to_string(), BridgeDistributor::Lox); NegativeReport::from_bridgeline(bridges[0], "ru".to_string(), BridgeDistributor::Lox);
reports.insert(report_1.to_json(), num_report_1); reports.insert(report_1.to_json(), num_report_1);
@ -424,8 +426,12 @@ mod tests {
// Incorrect BridgeLine hash // Incorrect BridgeLine hash
let invalid_report_4 = NegativeReport::new( let invalid_report_4 = NegativeReport::new(
bridges[0].fingerprint, bridges[0].fingerprint,
ProofOfBridgeKnowledge::HashOfBridgeLine(HashOfBridgeLine::new(&BridgeLine::default())), ProofOfBridgeKnowledge::HashOfBridgeLine(HashOfBridgeLine::new(
&BridgeLine::default(),
date,
)),
"ru".to_string(), "ru".to_string(),
date,
BridgeDistributor::Lox, BridgeDistributor::Lox,
); );
reports.insert(invalid_report_4.to_json(), num_invalid_report_4); reports.insert(invalid_report_4.to_json(), num_invalid_report_4);
@ -433,8 +439,9 @@ mod tests {
// Incorrect bucket hash // Incorrect bucket hash
let invalid_report_5 = NegativeReport::new( let invalid_report_5 = NegativeReport::new(
bridges[1].fingerprint, bridges[1].fingerprint,
ProofOfBridgeKnowledge::HashOfBucket(HashOfBucket::new(&Scalar::ZERO)), ProofOfBridgeKnowledge::HashOfBucket(HashOfBucket::new(&Scalar::ZERO, date)),
"ru".to_string(), "ru".to_string(),
date,
BridgeDistributor::Lox, BridgeDistributor::Lox,
); );
reports.insert(invalid_report_5.to_json(), num_invalid_report_5); reports.insert(invalid_report_5.to_json(), num_invalid_report_5);