Support future removal of redundant per-HTLC data in `ChanMonUpd`s 2023-03-one-less-sig
authorMatt Corallo <git@bluematt.me>
Fri, 10 Mar 2023 23:32:48 +0000 (23:32 +0000)
committerMatt Corallo <git@bluematt.me>
Fri, 24 Mar 2023 19:02:08 +0000 (19:02 +0000)
commitb72f6b1b84fee84f1c34a83fd9097fcc4418fa63
tree60355627e22bf70417acc7fd69bc187fd51536e3
parent85b573ddad70f3c5ee36e0992d587842af507a8d
Support future removal of redundant per-HTLC data in `ChanMonUpd`s

`ChannelMonitorUpdate`s are our most size-sensitive objects - they
are the minimal objects which need to be written to disk on each
commitment update. Thus, we should be careful to ensure we don't
pack too much extraneous information into each one.

Here we add future support for removing the per-HTLC explicit
`Option<Signature>` and `HTLCInCommitmentUpdate` for non-dust HTLCs
in holder commitment tx updates, which are redundant with the
`HolderCommitmentTransaction`.

While we cannot remove them entirely as previous versions rely on
them, adding support for filling in the in-memory structures from
the redundant fields will let us remove them in a future version.

We also add test-only generation logic to test the new derivation.
lightning/src/chain/channelmonitor.rs
lightning/src/ln/chan_utils.rs
lightning/src/ln/channel.rs
lightning/src/ln/channelmanager.rs