rust-lightning/lightning
Matt Corallo 8ab722235e Ensure monitors are not archived if they have a preimage we need
When a `ChannelMonitor` sees a payment preimage on chain for an
outbound HTLC, it creates a `MonitorEvent` containing the preimage
to pass to the inbound edge. The inclusion of the transaction
containing the payment preimage (plus six confirmations) also
results in the corresponding `Balance` being removed from the live
balance set, allowing the `ChannelMonitor` to be pruned (after a
further 4032 blocks).

While `MonitorEvent`s should always be processed in a timely
manner, if a node is suffering from a bug  where they are not, its
possible for 4038 blocks to pass with the preimage-containing
`MonitorEvent` still pending. If that happens, its possible the
`ChannelMonitor` is archived even though the preimage in it is
needed in another channel (or `ChannelMonitor`), causing funds
loss.

Luckily the fix is simple - check for pending events before
allowing a `ChannelMonitor` to be archived.

Fixes #2153
2024-12-08 20:36:26 +00:00
..
src Ensure monitors are not archived if they have a preimage we need 2024-12-08 20:36:26 +00:00
Cargo.toml Drop log-limiting features 2024-12-03 17:26:49 +01:00