Skip to content

Commit ba2854e

Browse files
committed
peer: don't segv if closing before anchor established.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
1 parent 4c3370e commit ba2854e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

daemon/peer.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1013,6 +1013,9 @@ const struct htlc *peer_tx_revealed_r_value(struct peer *peer,
10131013

10141014
bool committed_to_htlcs(const struct peer *peer)
10151015
{
1016+
/* This is only set after anchor established. */
1017+
if (!peer->cstate)
1018+
return false;
10161019
return tal_count(peer->cstate->a.htlcs) != 0
10171020
|| tal_count(peer->cstate->b.htlcs) != 0;
10181021
}

0 commit comments

Comments
 (0)