]> git.bitcoin.ninja Git - rust-lightning/commit
Correctly detect missing HTLCs when a local commitment tx was broadcast 2021-07-detect-htlcs-on-local-commitment
authorMatt Corallo <git@bluematt.me>
Sat, 31 Jul 2021 03:34:16 +0000 (03:34 +0000)
committerMatt Corallo <git@bluematt.me>
Mon, 9 Aug 2021 16:12:53 +0000 (16:12 +0000)
commit6bfab9d30a4ddab27f785643f2d974ffdc8371c0
tree98f240a438c88e7bd85b7c0b055a930061ec2864
parent925e64228ff0a271b9dc49faa26cef4b27c55e95
Correctly detect missing HTLCs when a local commitment tx was broadcast

If we forward an HTLC to our counterparty, but we force-closed the
channel before our counterparty provides us an updated commitment
transaction, we'll end up with a commitment transaction that does
not contain the HTLC which we attempted to forward. In this case,
we need to wait `ANTI_REORG_DELAY` blocks and then fail back the
HTLC as there is no way for us to learn the preimage and the
confirmed commitment transaction paid us the value of the HTLC.

However, check_spend_holder_transaction did not do this - it
instead only looked for dust HTLCs in the confirmed commitment
transaction, paying no attention to what other HTLCs may exist that
are missed.

This will eventually lead to channel force-closure as the channel
on which we received the inbound HTLC to forward will be closed in
time for the initial sender to claim the HTLC on-chain.
lightning/src/chain/channelmonitor.rs
lightning/src/ln/mod.rs
lightning/src/ln/monitor_tests.rs [new file with mode: 0644]