mirror of
https://github.com/aljazceru/lightning.git
synced 2026-01-04 14:54:26 +01:00
lightningd: use hash map for peers instead of linked list.
After connecting 100,000 peers with one channel each (not all at once!), we see various places where we exhibit O(N^2) behaviour. Fix these by keeping a map of id->peer instead of a simple linked-list. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
committed by
Alex Myers
parent
17aa047b17
commit
cfa632b0e9
@@ -3,6 +3,7 @@
|
||||
#include "config.h"
|
||||
#include <lightningd/htlc_end.h>
|
||||
#include <lightningd/htlc_set.h>
|
||||
#include <lightningd/peer_control.h>
|
||||
#include <signal.h>
|
||||
#include <sys/stat.h>
|
||||
#include <wallet/wallet.h>
|
||||
@@ -178,8 +179,8 @@ struct lightningd {
|
||||
/* Daemon looking after peers during init / before channel. */
|
||||
struct subd *connectd;
|
||||
|
||||
/* All peers we're tracking. */
|
||||
struct list_head peers;
|
||||
/* All peers we're tracking (by node_id) */
|
||||
struct peer_node_id_map *peers;
|
||||
|
||||
/* Outstanding connect commands. */
|
||||
struct list_head connects;
|
||||
|
||||
Reference in New Issue
Block a user