Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
routing: routing may come up with suboptimal routes (weight function) #1358
The reason for creating an alternative method to build the test graph is that the current json file contains info that is not relevant for the unit test (pubkeys, channel id, channel point, flags). This makes it harder to maintain and also more difficult to understand the structure.
In this PR these non-relevant properties are (deterministically) generated at run time.
Then there was still the choice whether to stick with json or move the graph definition to go code. In my opinion, expressing the graph in go code can make it easier to understand and shorter because several useful constructors can be defined (for example: symmetricTestChannel).
The shorter the graph definition is, the less effort it is to bring up a dedicated graph to test a specific scenario. I can imagine that the number of these scenarios will grow significantly. Not only because the routing algorithm is not that extensively unit tested currently (unit test added in #1321 was missing for example), but also because future extensions like AMP will need additional unit tests.
With regards to a single test graph for all tests vs special graphs for special tests, I think a mixture will emerge. Some scenarios are just quite difficult to fit (together) into a single graph. There is the option to modify the graph runtime, but I think this is makes it more difficult to understand what is happening.
referenced this pull request
Jun 10, 2018
The set of json was added initially as when things were a bit more contained on testnet, we could use the output of
Thanks for this PR! The prior weighting algorithm was thrown in just to start to take the fees into account, but had a major flaw as you've shown here (was originally meant to be temporary, but it was never re-visited).
IMO, the new weight function drastically improves the decisions that path finding algo will make when sending routes. We may want to tweak the risk factor later in the future, but I think the current value is a good starting point (although the code could add a bit more detail in the comments w.r.t to how you arrived at the current value).