Rewrite Channel resend tracking to make it much more reliable
authorMatt Corallo <git@bluematt.me>
Tue, 5 Mar 2019 20:36:11 +0000 (15:36 -0500)
committerMatt Corallo <git@bluematt.me>
Mon, 25 Mar 2019 21:03:53 +0000 (17:03 -0400)
commit50e16c9573ef5af43abf4837e6199c6526429d42
treeaa00252d0ad1412b38cc827f51e4d6c90f068fa8
parent63ed8fe5769a9d410a46084c438d350bf712c902
Rewrite Channel resend tracking to make it much more reliable

Resending revoke_and_ack and commitment_signed (+update) messages
after monitor-update-failure or disconnection has been a highly
unreliable part of our codebase for some time (as evidenced by the
number of bugs caught in the chanmon_fail_consistency fuzz target).
This is due to its rather ad-hoc nature and tracking/behavior which
consists of checking a number of different flags to try to deduce
which messages were/were not delivered and go from there. Instead,
this commit rewrites it to simply keep track of the order messages
were generated originally, as we always resend in the
originally-generated order.

I'm anticipating this will be way more robust than the old code, in
addition to its simplicity.
src/ln/channel.rs
src/ln/channelmanager.rs