connectd: reconnect for non-transient connections.

Rather than have lightningd call us repeatedly to try to connect, have
it tell us what peers are transient and aren't, and connectd will
automatically try to maintain that connection.

There's a new "downgrade_peer" message to tell it a peer is now
transient: to make it non-transient we simply tell connectd to
connect as a non-transient.

The first time, I missed that dual_open_control does its own state
transitions :(

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Changed: `connectd` now handles maintaining/reconnecting to important peers, and we remember the last successful address we connected to.
This commit is contained in:
Rusty Russell
2024-11-25 11:38:15 +10:30
parent ff290b19c9
commit 15950bb7d4
17 changed files with 347 additions and 277 deletions

View File

@@ -173,9 +173,6 @@ struct lightningd {
/* Do we want to reconnect to other peers having only unannouced channels with us? */
bool reconnect_private;
/* How many outstanding startup connection attempts? */
size_t num_startup_connects;
/* Do we want to listen for other peers? */
bool listen;
@@ -210,8 +207,6 @@ struct lightningd {
/* Daemon looking after peers during init / before channel. */
struct subd *connectd;
/* Reconnection attempts */
struct delayed_reconnect_map *delayed_reconnect_map;
/* All peers we're tracking (by node_id) */
struct peer_node_id_map *peers;