MCPcopy Create free account
hub / github.com/ElementsProject/lightning / check_route_as_expected

Function check_route_as_expected

tests/test_askrene.py:689–709  ·  view source on GitHub ↗

Make sure all fields in paths are match those in routes

(routes, paths)

Source from the content-addressed store, hash-verified

687
688
689def check_route_as_expected(routes, paths):
690 """Make sure all fields in paths are match those in routes"""
691 def dict_subset_eq(a, b):
692 """Is every key in B is the same in A?"""
693 return all(a.get(key) == b[key] for key in b)
694
695 for path in paths:
696 found = False
697 for i in range(len(routes)):
698 route = routes[i]
699 if len(route['path']) != len(path):
700 continue
701 if all(dict_subset_eq(route['path'][i], path[i]) for i in range(len(path))):
702 del routes[i]
703 found = True
704 break
705 if not found:
706 raise ValueError("Could not find path {} in paths {}".format(path, routes))
707
708 if routes != []:
709 raise ValueError("Did not expect paths {}".format(routes))
710
711
712def check_getroute_paths(node,

Callers 5

check_getroute_pathsFunction · 0.85
test_sourcefree_on_modsFunction · 0.85
test_max_htlcFunction · 0.85
test_min_htlcFunction · 0.85
check_getroute_routesFunction · 0.85

Calls 1

dict_subset_eqFunction · 0.85

Tested by

no test coverage detected