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

[feat] #109

parent 098dbf5d
Branches
Tags
1 merge request!99Resolve "Change protocole : allowing certification replay before expiry (BR_G44.2)"
......@@ -87,8 +87,6 @@ impl<'de> Deserialize<'de> for NodeId {
pub enum NewLinkResult {
/// Certification worked.
Ok(usize),
/// This certification already exist.
AlreadyCertified(usize),
/// All available certifications has been used.
AllCertificationsUsed(usize),
/// Unknown source.
......
......@@ -134,8 +134,6 @@ impl WebOfTrust for RustyWebOfTrust {
NewLinkResult::UnknownTarget()
} else if self.nodes[source.0].issued_count >= self.max_links {
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 {
self.nodes[source.0].issued_count += 1;
self.nodes[target.0].links_source.insert(source);
......
......@@ -196,14 +196,6 @@ mod tests {
// 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(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));
// 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