Correct Channel outbound HTLC serialization 2021-04-fix-htlc-ser
authorMatt Corallo <git@bluematt.me>
Wed, 21 Apr 2021 20:47:24 +0000 (20:47 +0000)
committerMatt Corallo <git@bluematt.me>
Mon, 31 May 2021 18:20:22 +0000 (18:20 +0000)
commit25dbd0d7e09dac82ea80aa8df89615150cd105cc
tree87078e8dabe4cb83e7e38b397e219363aca17da0
parente003c431830f74addd489a47fa6eb4f66a7ad073
Correct Channel outbound HTLC serialization

Channel serialization should happen "as if
remove_uncommitted_htlcs_and_mark_paused had just been called".

This is true for the most part, but outbound RemoteRemoved HTLCs
were being serialized as normal, even though
`remote_uncommitted_htlcs_and_mark_paused` resets them to
`Committed`.

This led to a bug identified by the `chanmon_consistency_target`
fuzzer wherein, if we receive a update_*_htlc message bug not the
corresponding commitment_signed prior to a serialization roundtrip,
we'd force-close the channel due to the peer "attempting to
fail/claim an HTLC which was already failed/claimed".
lightning/src/ln/channel.rs