]> git.bitcoin.ninja Git - rust-lightning/commit
Handle closed-chan HTLC claims in `claim_funds_from_hop`
authorMatt Corallo <git@bluematt.me>
Tue, 6 Dec 2022 20:46:02 +0000 (20:46 +0000)
committerMatt Corallo <git@bluematt.me>
Thu, 8 Dec 2022 21:24:26 +0000 (21:24 +0000)
commit7b77a016b58face4a2d8a97edae84f2777094ee3
treefa7bb886f5fab093f36398bae0ae4843945a54b6
parentbffbd3784d5832df45f079f0058cb1e4fa2cd91d
Handle closed-chan HTLC claims in `claim_funds_from_hop`

Currently `claim_funds` does all HTLC claims in one `channel_state`
lock, ensuring that we always make claims from channels which are
open. It can thus avoid ever having to generate a
`ChannelMonitorUpdate` containing a preimage for a closed channel,
which we only do in `claim_funds_internal` (for forwarded payments).

In the next commit we'll change the locking of
`claim_funds_from_hop` so that `claim_funds` is no longer under a
single lock but takes a lock for each claim. This allows us to be
more flexible with locks going forward, and ultimately isn't a huge
change - if our counterparty intends to force-close a channel, us
choosing to ignore it by holding the `channel_state` lock for the
duration of the claim isn't going to result in a commitment update,
it will just result in the preimage already being in the
`ChannelMonitor`.
lightning/src/ln/channelmanager.rs