From d613b3fa9d6d48ed5a83c3ffab5b5cd6eda6e40d Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Mon, 3 Dec 2018 09:36:06 +1030 Subject: [PATCH] connectd: simply use global features from common/features. We currently hand the feature set from lightningd, but that's confusing if they were ever different. Signed-off-by: Rusty Russell --- connectd/connect_wire.csv | 4 ---- connectd/connectd.c | 11 +++-------- lightningd/connect_control.c | 3 +-- 3 files changed, 4 insertions(+), 14 deletions(-) diff --git a/connectd/connect_wire.csv b/connectd/connect_wire.csv index 49463ea54..0f7fbdbb5 100644 --- a/connectd/connect_wire.csv +++ b/connectd/connect_wire.csv @@ -4,10 +4,6 @@ connectctl_init,2000 connectctl_init,,id,struct pubkey -connectctl_init,,gflen,u16 -connectctl_init,,globalfeatures,gflen*u8 -connectctl_init,,lflen,u16 -connectctl_init,,localfeatures,lflen*u8 connectctl_init,,num_wireaddrs,u16 connectctl_init,,wireaddrs,num_wireaddrs*struct wireaddr_internal connectctl_init,,listen_announce,num_wireaddrs*enum addr_listen_announce diff --git a/connectd/connectd.c b/connectd/connectd.c index 7745b98d3..3320b6a18 100644 --- a/connectd/connectd.c +++ b/connectd/connectd.c @@ -124,9 +124,6 @@ struct daemon { /* Connection to main daemon. */ struct daemon_conn *master; - /* Local and global features to offer to peers. */ - u8 *localfeatures, *globalfeatures; - /* Allow localhost to be considered "public": DEVELOPER-only option, * but for simplicity we don't #if DEVELOPER-wrap it here. */ bool dev_allow_localhost; @@ -289,9 +286,7 @@ static int get_gossipfd(struct daemon *daemon, /*~ The way features generally work is that both sides need to offer it; * we always offer `gossip_queries`, but this check is explicit. */ gossip_queries_feature - = feature_offered(localfeatures, LOCAL_GOSSIP_QUERIES) - && feature_offered(daemon->localfeatures, - LOCAL_GOSSIP_QUERIES); + = local_feature_negotiated(localfeatures, LOCAL_GOSSIP_QUERIES); /*~ `initial_routing_sync is supported by every node, since it was in * the initial lightning specification: it means the peer wants the @@ -1102,8 +1097,8 @@ static struct io_plan *connect_init(struct io_conn *conn, /* Fields which require allocation are allocated off daemon */ if (!fromwire_connectctl_init( daemon, msg, - &daemon->id, &daemon->globalfeatures, - &daemon->localfeatures, &proposed_wireaddr, + &daemon->id, + &proposed_wireaddr, &proposed_listen_announce, &proxyaddr, &daemon->use_proxy_always, &daemon->dev_allow_localhost, &daemon->use_dns, diff --git a/lightningd/connect_control.c b/lightningd/connect_control.c index 8fc0220b1..46a75debe 100644 --- a/lightningd/connect_control.c +++ b/lightningd/connect_control.c @@ -367,8 +367,7 @@ int connectd_init(struct lightningd *ld) msg = towire_connectctl_init( tmpctx, &ld->id, - get_offered_globalfeatures(tmpctx), - get_offered_localfeatures(tmpctx), wireaddrs, + wireaddrs, listen_announce, ld->proxyaddr, ld->use_proxy_always || ld->pure_tor_setup, allow_localhost, ld->config.use_dns,