connectd: Pass the init_featurebits down to connectd and use in init

The `init_featurebits` are computed at startup, and then cached
indefinitely. They are then used whenever a new `init` handshake is performed.

We could add a new message to push updates to `connectd` whenever a plugin is
added or removed, but that's up for discussion.
This commit is contained in:
Christian Decker
2020-01-30 22:26:57 +01:00
committed by Rusty Russell
parent 58c9a6a004
commit 8d6c8c3cd1
5 changed files with 24 additions and 8 deletions

View File

@@ -155,7 +155,8 @@ struct io_plan *peer_exchange_initmsg(struct io_conn *conn,
struct daemon *daemon,
const struct crypto_state *cs,
const struct node_id *id,
const struct wireaddr_internal *addr)
const struct wireaddr_internal *addr,
const u8 *init_featurebits)
{
/* If conn is closed, forget peer */
struct peer *peer = tal(conn, struct peer);
@@ -200,7 +201,7 @@ struct io_plan *peer_exchange_initmsg(struct io_conn *conn,
* from now on they'll all go in initfeatures. */
peer->msg = towire_init(NULL,
get_offered_globalinitfeatures(tmpctx),
get_offered_initfeatures(tmpctx),
init_featurebits,
tlvs);
status_peer_io(LOG_IO_OUT, &peer->id, peer->msg);
peer->msg = cryptomsg_encrypt_msg(peer, &peer->cs, take(peer->msg));