lightningd: use a hash table for peer->dbid.

Otherwise, loading up when we have 100k peers is *painful*!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2023-01-18 15:34:32 +10:30
committed by Alex Myers
parent cfa632b0e9
commit 0e25d56329
7 changed files with 47 additions and 13 deletions

View File

@@ -181,6 +181,9 @@ static struct lightningd *new_lightningd(const tal_t *ctx)
* linked-list as part of the 100k-peers project! */
ld->peers = tal(ld, struct peer_node_id_map);
peer_node_id_map_init(ld->peers);
/*~ And this was done at the same time, for db lookups at startup */
ld->peers_by_dbid = tal(ld, struct peer_dbid_map);
peer_dbid_map_init(ld->peers_by_dbid);
/*~ For multi-part payments, we need to keep some incoming payments
* in limbo until we get all the parts, or we time them out. */