mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-20 07:34:24 +01:00
gossipd: implement Dijkstra.
Use a uintmap as our minheap. Note that Dijkstra can give overlength routes, so some checks are disabled. Comparison using gossipd/test/run-bench-find_route 100000 10: Before: 10 (10 succeeded) routes in 100000 nodes in 120087 msec (12008708402 nanoseconds per route) After: 10 (10 succeeded) routes in 100000 nodes in 2269 msec (226925462 nanoseconds per route) Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -118,6 +118,13 @@ struct node {
|
||||
/* Where that came from. */
|
||||
struct chan *prev;
|
||||
} bfg[ROUTING_MAX_HOPS+1];
|
||||
|
||||
struct {
|
||||
/* Total to get to here from target. */
|
||||
struct amount_msat total;
|
||||
/* Total risk premium of this route. */
|
||||
struct amount_msat risk;
|
||||
} dijkstra;
|
||||
};
|
||||
|
||||
const struct node_id *node_map_keyof_node(const struct node *n);
|
||||
@@ -428,4 +435,7 @@ static inline void local_enable_chan(struct routing_state *rstate,
|
||||
|
||||
/* Helper to convert on-wire addresses format to wireaddrs array */
|
||||
struct wireaddr *read_addresses(const tal_t *ctx, const u8 *ser);
|
||||
|
||||
/* Temporary to set routing algo */
|
||||
extern bool only_dijkstra;
|
||||
#endif /* LIGHTNING_GOSSIPD_ROUTING_H */
|
||||
|
||||
Reference in New Issue
Block a user