peer: fix close before their sig has been received in corner case.

If we haven't received their closing signature yet, we might try to
send the closing packet anyway (and segfault).  Make sure we have
their signature before trying that.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2016-08-31 16:06:31 +09:30
parent 2610799bda
commit 9bd6a10f49

View File

@@ -1382,7 +1382,7 @@ static bool shutdown_pkt_in(struct peer *peer, const Pkt *pkt)
break; break;
} }
if (!err && !committed_to_htlcs(peer)) if (!err && !committed_to_htlcs(peer) && peer->closing.their_script)
err = start_closing(peer); err = start_closing(peer);
if (err) if (err)