node: relax converge criteria
Some test flakes would occur due to the `converge` function looping
forever. It was noticed that in these cases the log output would look
like:
test: Node z6MkqTKLVnFdVF24PQiDoQffbTPT7U5igghS3XWuFJLfah1P has
{(Id(rad:z39WuDs9hrqmCr9shjoz6dn2Abqyz),
PublicKey(z6MkemMxfWhRQFKy4UPX7FsN8GjLAZ9T65rbmDsUn7fchioP)),
(Id(rad:z39WuDs9hrqmCr9shjoz6dn2Abqyz),
PublicKey(z6MkpdPJp7naAurUjCpwef1BDD5jfPhAvwfinaGd7pVh227j)),
(Id(rad:z39WuDs9hrqmCr9shjoz6dn2Abqyz),
PublicKey(z6MkqTKLVnFdVF24PQiDoQffbTPT7U5igghS3XWuFJLfah1P))}
with further investigation, the variable `all_routes` was found to be
smaller than the calculated routes.
Instead of checking `==`, instead check that
`routes.is_superset(&all_routes)`, which means that `routes` must be
equal to `all_routes`, but allows it have extra entries.
Signed-off-by: Fintan Halpenny <Fintan Halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
This commit is contained in:
parent
070e912b3e
commit
76c969c755
|
|
@ -511,11 +511,12 @@ pub fn converge<'a, G: Signer + cyphernet::Ecdh + 'static>(
|
|||
let routing = node.routing();
|
||||
let routes = BTreeSet::from_iter(routing);
|
||||
|
||||
if routes == all_routes {
|
||||
if routes.is_superset(&all_routes) {
|
||||
log::debug!(target: "test", "Node {} has converged", node.id);
|
||||
return false;
|
||||
} else {
|
||||
log::debug!(target: "test", "Node {} has {:?}", node.id, routes);
|
||||
log::debug!(target: "test", "All routes {:?}", all_routes);
|
||||
}
|
||||
true
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue