Update min-inbound-fee values on `NetworkGraph` load
authorMatt Corallo <git@bluematt.me>
Thu, 19 Jan 2023 18:24:30 +0000 (18:24 +0000)
committerMatt Corallo <git@bluematt.me>
Thu, 19 Jan 2023 19:10:05 +0000 (19:10 +0000)
commitefdd2217b78b1b5b3cbbcb8f4bce26f1c6a0cf87
tree9e65b02939d18025d30c4e038f2c9107baa36092
parent608c8adfd575ffb26d4485ebd74f42aabc64c6ad
Update min-inbound-fee values on `NetworkGraph` load

Historically we've had various bugs in keeping the
`lowest_inbound_channel_fees` field in `NodeInfo` up-to-date as we
go. This leaves the A* routing less efficient as it can't prune
hops as aggressively.

In order to get accurate benchmarks, this commit updates the
minimum-inbound-fees field on load. This is not the most efficient
way of doing so, but suffices for fetching benchmarks and will be
removed in the coming commits.

Note that this is *slower* than the non-updating version in the
previous commit. While I haven't dug into this incredibly deeply,
the graph snapshot in use has min-fee info for only 9,618 of
20,818 nodes. Thus, it is my guess that with the graph snapshot
as-is the branch predictor is able to largely remove the A*
heuristic lookups, but with this change it is forced to wait for
A* heuristic map lookups to complete, causing a performance
regression.

```
test routing::router::benches::generate_mpp_routes_with_probabilistic_scorer ... bench: 182,980,059 ns/iter (+/- 32,662,047)
test routing::router::benches::generate_mpp_routes_with_zero_penalty_scorer  ... bench: 151,170,457 ns/iter (+/- 75,351,011)
test routing::router::benches::generate_routes_with_probabilistic_scorer     ... bench:  58,187,277 ns/iter (+/- 11,606,440)
test routing::router::benches::generate_routes_with_zero_penalty_scorer      ... bench:  41,210,193 ns/iter (+/- 18,103,320)
```
lightning/src/routing/gossip.rs