From: Matt Corallo <649246+TheBlueMatt@users.noreply.github.com> Date: Thu, 6 Apr 2023 18:07:55 +0000 (+0000) Subject: Merge pull request #2101 from TheBlueMatt/2023-03-one-less-sig X-Git-Tag: v0.0.115~36 X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=ba1349982ba28657c9e2d03a5b02c3ecc054b5cc;p=rust-lightning Merge pull request #2101 from TheBlueMatt/2023-03-one-less-sig Support future removal of redundant per-HTLC signatures in `CMU`s --- ba1349982ba28657c9e2d03a5b02c3ecc054b5cc diff --cc lightning/src/ln/channelmanager.rs index c2ff9da67,0831649a3..b5e5a43fe --- a/lightning/src/ln/channelmanager.rs +++ b/lightning/src/ln/channelmanager.rs @@@ -318,8 -312,21 +318,20 @@@ impl HTLCSource first_hop_htlc_msat: 0, payment_id: PaymentId([2; 32]), payment_secret: None, - payment_params: None, } } + + #[cfg(debug_assertions)] + /// Checks whether this HTLCSource could possibly match the given HTLC output in a commitment + /// transaction. Useful to ensure different datastructures match up. + pub(crate) fn possibly_matches_output(&self, htlc: &super::chan_utils::HTLCOutputInCommitment) -> bool { + if let HTLCSource::OutboundRoute { first_hop_htlc_msat, .. } = self { + *first_hop_htlc_msat == htlc.amount_msat + } else { + // There's nothing we can check for forwarded HTLCs + true + } + } } struct ReceiveError {