From 881c3893e63d994e0554a71bed2c296a69b95a98 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Mon, 10 Dec 2018 11:33:42 +1030 Subject: [PATCH] channeld: get local peer features from lightningd. Signed-off-by: Rusty Russell --- channeld/channel_wire.csv | 2 ++ channeld/channeld.c | 6 +++++- lightningd/channel_control.c | 3 ++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/channeld/channel_wire.csv b/channeld/channel_wire.csv index 5e30f7289..8c0fdb80b 100644 --- a/channeld/channel_wire.csv +++ b/channeld/channel_wire.csv @@ -59,6 +59,8 @@ channel_init,,init_peer_pkt_len,u16 channel_init,,init_peer_pkt,init_peer_pkt_len*u8 channel_init,,reached_announce_depth,bool channel_init,,last_remote_secret,struct secret +channel_init,,lflen,u16 +channel_init,,localfeatures,lflen*u8 # master->channeld funding hit new depth >= lock depth channel_funding_locked,1002 diff --git a/channeld/channeld.c b/channeld/channeld.c index 8a7f1567c..d0ad7b5e2 100644 --- a/channeld/channeld.c +++ b/channeld/channeld.c @@ -68,6 +68,9 @@ struct peer { bool funding_locked[NUM_SIDES]; u64 next_index[NUM_SIDES]; + /* Features peer supports. */ + u8 *localfeatures; + /* Tolerable amounts for feerate (only relevant for fundee). */ u32 feerate_min, feerate_max; @@ -2654,7 +2657,8 @@ static void init_channel(struct peer *peer) &peer->channel_flags, &funding_signed, &peer->announce_depth_reached, - &last_remote_per_commit_secret)) + &last_remote_per_commit_secret, + &peer->localfeatures)) master_badmsg(WIRE_CHANNEL_INIT, msg); status_trace("init %s: remote_per_commit = %s, old_remote_per_commit = %s" diff --git a/lightningd/channel_control.c b/lightningd/channel_control.c index b93e78dac..6fce5239e 100644 --- a/lightningd/channel_control.c +++ b/lightningd/channel_control.c @@ -381,7 +381,8 @@ void peer_start_channeld(struct channel *channel, channel->channel_flags, funding_signed, reached_announce_depth, - &last_remote_per_commit_secret); + &last_remote_per_commit_secret, + channel->peer->localfeatures); /* We don't expect a response: we are triggered by funding_depth_cb. */ subd_send_msg(channel->owner, take(initmsg));