channeld: Make sure status_setup_sync is called before status_failed

This was still happening if reading the `channel_init` message failed.

Signed-off-by: Christian Decker <decker.christian@gmail.com>
This commit is contained in:
Christian Decker 2017-09-08 18:32:59 -07:00 committed by Rusty Russell
parent 48b876e401
commit 006d664b59

View File

@ -1995,6 +1995,8 @@ static void init_channel(struct peer *peer)
assert(!(fcntl(MASTER_FD, F_GETFL) & O_NONBLOCK));
status_setup_sync(MASTER_FD);
msg = wire_sync_read(peer, MASTER_FD);
if (!fromwire_channel_init(peer, msg, NULL,
&peer->chain_hash,
@ -2042,8 +2044,6 @@ static void init_channel(struct peer *peer)
status_failed(WIRE_CHANNEL_BAD_COMMAND, "Init: %s",
tal_hex(msg, msg));
status_setup_sync(MASTER_FD);
status_trace("init %s: remote_per_commit = %s, old_remote_per_commit = %s"
" next_idx_local = %"PRIu64
" next_idx_remote = %"PRIu64