Skip to content

Commit

Permalink
channeld: assert we're not somehow nonblocking in init_channel.
Browse files Browse the repository at this point in the history
Christian reported seeing a zero-length packet come in; this seems the
most likely possibility.  

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
  • Loading branch information
rustyrussell committed Sep 8, 2017
1 parent e56ca11 commit ec8ec51
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions channeld/channel.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include <common/type_to_string.h>
#include <common/version.h>
#include <errno.h>
#include <fcntl.h>
#include <gossipd/routing.h>
#include <hsmd/gen_hsm_client_wire.h>
#include <inttypes.h>
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit ec8ec51

Please sign in to comment.