From 5acbc04ec8074907298c1ea42553bab2e37db4ec Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Fri, 8 Sep 2017 19:53:57 +0930 Subject: [PATCH] channeld: assert we're not somehow nonblocking in init_channel. Christian reported seeing a zero-length packet come in; this seems the most likely possibility. Signed-off-by: Rusty Russell --- channeld/channel.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/channeld/channel.c b/channeld/channel.c index ee9a5acfc..9f70d6618 100644 --- a/channeld/channel.c +++ b/channeld/channel.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -2020,6 +2021,8 @@ static void init_channel(struct peer *peer) u8 *msg; u32 feerate_per_kw; + assert(!(fcntl(REQ_FD, F_GETFL) & O_NONBLOCK)); + msg = wire_sync_read(peer, REQ_FD); if (!fromwire_channel_init(peer, msg, NULL, &peer->chain_hash,