Skip to content
Snippets Groups Projects
Commit e3ae2832 authored by Éloïs's avatar Éloïs
Browse files

[feat] #109

parent 098dbf5d
No related branches found
No related tags found
1 merge request!99Resolve "Change protocole : allowing certification replay before expiry (BR_G44.2)"
...@@ -87,8 +87,6 @@ impl<'de> Deserialize<'de> for NodeId { ...@@ -87,8 +87,6 @@ impl<'de> Deserialize<'de> for NodeId {
pub enum NewLinkResult { pub enum NewLinkResult {
/// Certification worked. /// Certification worked.
Ok(usize), Ok(usize),
/// This certification already exist.
AlreadyCertified(usize),
/// All available certifications has been used. /// All available certifications has been used.
AllCertificationsUsed(usize), AllCertificationsUsed(usize),
/// Unknown source. /// Unknown source.
......
...@@ -134,8 +134,6 @@ impl WebOfTrust for RustyWebOfTrust { ...@@ -134,8 +134,6 @@ impl WebOfTrust for RustyWebOfTrust {
NewLinkResult::UnknownTarget() NewLinkResult::UnknownTarget()
} else if self.nodes[source.0].issued_count >= self.max_links { } else if self.nodes[source.0].issued_count >= self.max_links {
NewLinkResult::AllCertificationsUsed(self.nodes[target.0].links_source.len()) NewLinkResult::AllCertificationsUsed(self.nodes[target.0].links_source.len())
} else if self.nodes[target.0].links_source.contains(&source) {
NewLinkResult::AlreadyCertified(self.nodes[target.0].links_source.len())
} else { } else {
self.nodes[source.0].issued_count += 1; self.nodes[source.0].issued_count += 1;
self.nodes[target.0].links_source.insert(source); self.nodes[target.0].links_source.insert(source);
......
...@@ -196,14 +196,6 @@ mod tests { ...@@ -196,14 +196,6 @@ mod tests {
// should be able to add some links, cert count is returned // should be able to add some links, cert count is returned
assert_eq!(wot.add_link(NodeId(2), NodeId(0)), NewLinkResult::Ok(1)); assert_eq!(wot.add_link(NodeId(2), NodeId(0)), NewLinkResult::Ok(1));
assert_eq!(wot.add_link(NodeId(4), NodeId(0)), NewLinkResult::Ok(2)); assert_eq!(wot.add_link(NodeId(4), NodeId(0)), NewLinkResult::Ok(2));
assert_eq!(
wot.add_link(NodeId(4), NodeId(0)),
NewLinkResult::AlreadyCertified(2)
);
assert_eq!(
wot.add_link(NodeId(4), NodeId(0)),
NewLinkResult::AlreadyCertified(2)
);
assert_eq!(wot.add_link(NodeId(5), NodeId(0)), NewLinkResult::Ok(3)); assert_eq!(wot.add_link(NodeId(5), NodeId(0)), NewLinkResult::Ok(3));
// should exist new links // should exist new links
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment