diff --git a/wotb/rusty.rs b/wotb/rusty.rs index d0e605b6a78c0881aad1bb3fcc341463a5af80d2..8506ed13dd8d295b6f6afdccd73dcf5f34a984c8 100644 --- a/wotb/rusty.rs +++ b/wotb/rusty.rs @@ -260,12 +260,20 @@ impl WebOfTrust for RustyWebOfTrust { let mut new_paths = vec![]; for path in &paths { - let sources = &graph[path.last().unwrap().0]; - for source in &sources.1 { - let mut new_path = path.clone(); - new_path.push(NodeId(*source)); - new_paths.push(new_path); - } + let node = path.last().unwrap(); + + if node == &to { + // If path is complete, we keep it. + new_paths.push(path.clone()) + } else { + // If not complete we comlete paths + let sources = &graph[node.0]; + for source in &sources.1 { + let mut new_path = path.clone(); + new_path.push(NodeId(*source)); + new_paths.push(new_path); + } + } } paths = new_paths;