peer: don't segv if closing before anchor established.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2016-03-24 12:11:56 +10:30
parent 4c3370e023
commit ba2854e835

View File

@ -1013,6 +1013,9 @@ const struct htlc *peer_tx_revealed_r_value(struct peer *peer,
bool committed_to_htlcs(const struct peer *peer)
{
/* This is only set after anchor established. */
if (!peer->cstate)
return false;
return tal_count(peer->cstate->a.htlcs) != 0
|| tal_count(peer->cstate->b.htlcs) != 0;
}