channeld: don't crash if remote asks for unnecessary retransmit.

We assume they haven't acknowledged it, but they might have (seems
like a bug though).  We could hang up on them, but we'll happily
continue.

lightning_channeld: channeld/channel.c:1702: resend_commitment: Assertion `peer->revocations_received == peer->next_index[REMOTE] - 2' failed.
lightning_channeld: Fatal signal 6
0x559919c35dcd crashdump
        common/daemon.c:37
0x7f76d5be27ef ???
        ???:0
0x7f76d5be277f ???
        ???:0
0x7f76d5be4379 ???
        ???:0
0x7f76d5bdab46 ???
        ???:0
0x7f76d5bdabf1 ???
        ???:0
0x559919c29337 resend_commitment
        channeld/channel.c:1702
0x559919c297cf peer_reconnect
        channeld/channel.c:1853
0x559919c2b3d5 init_channel
        channeld/channel.c:2518
0x559919c2b6f8 main
        channeld/channel.c:2580
0x7f76d5bcd3f0 ???
        ???:0
0x559919c244d9 ???
        ???:0
0xffffffffffffffff ???
        ???:0

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2018-06-15 10:42:23 +09:30 committed by Christian Decker
parent 9d721ecb99
commit 4990b6bbcc
1 changed files with 7 additions and 1 deletions

View File

@ -1703,7 +1703,13 @@ static void resend_commitment(struct peer *peer, const struct changed_htlc *last
enqueue_peer_msg(peer, take(msg));
tal_free(commit_sigs);
assert(peer->revocations_received == peer->next_index[REMOTE] - 2);
/* If we have already received the revocation for the previous, the
* other side shouldn't be asking for a retransmit! */
if (peer->revocations_received != peer->next_index[REMOTE] - 2)
status_unusual("Retransmitted commitment_signed %"PRIu64
" but they already send revocation %"PRIu64"?",
peer->next_index[REMOTE]-1,
peer->revocations_received);
}
/* Our local wrapper around read_peer_msg */