common/features: don't use internal global.

Turns out that unnecessary: all callers can access the feature_set,
so make it much more like a normal primitive.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2020-04-02 14:34:47 +10:30
parent 15f54878e4
commit cf43e44378
28 changed files with 253 additions and 233 deletions

View File

@@ -135,6 +135,7 @@ static struct io_plan *peer_write_postclose(struct io_conn *conn,
struct io_plan *peer_exchange_initmsg(struct io_conn *conn,
struct daemon *daemon,
const struct feature_set *fset,
const struct crypto_state *cs,
const struct node_id *id,
const struct wireaddr_internal *addr)
@@ -181,8 +182,8 @@ struct io_plan *peer_exchange_initmsg(struct io_conn *conn,
* Finally, we agreed that bits below 13 could be put in both, but
* from now on they'll all go in initfeatures. */
peer->msg = towire_init(NULL,
get_offered_globalinitfeatures(tmpctx),
get_offered_initfeatures(tmpctx),
fset->bits[GLOBAL_INIT_FEATURE],
fset->bits[INIT_FEATURE],
tlvs);
status_peer_io(LOG_IO_OUT, &peer->id, peer->msg);
peer->msg = cryptomsg_encrypt_msg(peer, &peer->cs, take(peer->msg));