rust-lightning/lightning/src/ln
Matt Corallo 7e78fa660c Handle double-HTLC-claims without failing the backwards channel
When receiving an update_fulfill_htlc message, we immediately
forward the claim backwards along the payment path before waiting
for a full commitment_signed dance. This is great, but can cause
duplicative claims if a node sends an update_fulfill_htlc message,
disconnects, reconnects, and then has to re-send its
update_fulfill_htlc message again.

While there was code to handle this, it treated it as a channel
error on the inbound channel, which is incorrect - this is an
expected, albeit incredibly rare, condition. Instead, we handle
these double-claims correctly, simply ignoring them.

With debug_assertions enabled, we also check that the previous
close of the same HTLC was a fulfill, and that we are not moving
from a HTLC failure to an HTLC claim after its too late.

A test is also added, which hits all three failure cases in
`Channel::get_update_fulfill_htlc`.

Found by the chanmon_consistency fuzzer.
2021-07-28 00:34:53 +00:00
..
chan_utils.rs Fix TLV serialization to work with large types. 2021-06-24 16:25:31 -04:00
chanmon_update_fail_tests.rs Handle double-HTLC-claims without failing the backwards channel 2021-07-28 00:34:53 +00:00
channel.rs Handle double-HTLC-claims without failing the backwards channel 2021-07-28 00:34:53 +00:00
channelmanager.rs Expose the current best chain tip from ChannelManager + Monitors 2021-07-06 00:18:27 +00:00
features.rs Use alloc for no_std builds 2021-05-27 17:35:20 +00:00
functional_test_utils.rs Support pending update_fail_htlcs in reconnect_nodes test util 2021-07-14 18:23:32 +00:00
functional_tests.rs Support pending update_fail_htlcs in reconnect_nodes test util 2021-07-14 18:23:32 +00:00
mod.rs Use alloc for no_std builds 2021-05-27 17:35:20 +00:00
msgs.rs Merge pull request #965 from TheBlueMatt/2021-06-log-cleanups 2021-06-29 20:13:50 +00:00
onion_route_tests.rs Support pending update_fail_htlcs in reconnect_nodes test util 2021-07-14 18:23:32 +00:00
onion_utils.rs Drop byte_utils in favor of native to/from_be_bytes methods 2021-06-01 15:47:01 +00:00
peer_channel_encryptor.rs Drop byte_utils in favor of native to/from_be_bytes methods 2021-06-01 15:47:01 +00:00
peer_handler.rs Fix unused import in peer_handler introduced in 1f592b045f 2021-06-30 16:13:48 +00:00
reorg_tests.rs Use hashbrown replacements for std equivalents 2021-06-18 21:54:21 +00:00
wire.rs More consistently log in msg handling, incl full msg logging at trace 2021-06-29 19:36:47 +00:00