Add infra to block `ChannelMonitorUpdate`s on forwarded claims 2023-04-monitor-e-monitor-prep
authorMatt Corallo <git@bluematt.me>
Fri, 7 Apr 2023 00:31:39 +0000 (00:31 +0000)
committerMatt Corallo <git@bluematt.me>
Tue, 30 May 2023 23:05:03 +0000 (23:05 +0000)
commit394f54da314864a1a368d4c4f1b5c503da85c7ce
tree1bd46918d80cc253abe8687515f55704ad8c8934
parent785bdb84cb3fb0305cad2edc30e2df03b6988c9b
Add infra to block `ChannelMonitorUpdate`s on forwarded claims

When we forward a payment and receive an `update_fulfill_htlc`
message from the downstream channel, we immediately claim the HTLC
on the upstream channel, before even doing a `commitment_signed`
dance on the downstream channel. This implies that our
`ChannelMonitorUpdate`s "go out" in the right order - first we
ensure we'll get our money by writing the preimage down, then we
write the update that resolves giving money on the downstream node.

This is safe as long as `ChannelMonitorUpdate`s complete in the
order in which they are generated, but of course looking forward we
want to support asynchronous updates, which may complete in any
order.

Here we add infrastructure to handle downstream
`ChannelMonitorUpdate`s which are blocked on an upstream
preimage-containing one. We don't yet actually do the blocking which
will come in a future commit.
lightning/src/ln/channelmanager.rs