From: Matt Corallo <649246+TheBlueMatt@users.noreply.github.com> Date: Fri, 7 Apr 2023 16:14:30 +0000 (+0000) Subject: Merge pull request #2139 from TheBlueMatt/2023-03-metadata-prefactors X-Git-Tag: v0.0.115~33 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=1016e1f605ff03ed14ed875e7cd4f567ae15c96a;p=rust-lightning Merge pull request #2139 from TheBlueMatt/2023-03-metadata-prefactors Add a new `RecipientOnionFields` and replace `PaymentSecret` with it --- 1016e1f605ff03ed14ed875e7cd4f567ae15c96a diff --cc lightning/src/ln/channelmanager.rs index 59f92b202,7c84df75e..4bc60dcff --- a/lightning/src/ln/channelmanager.rs +++ b/lightning/src/ln/channelmanager.rs @@@ -317,21 -315,8 +315,20 @@@ impl HTLCSource session_priv: SecretKey::from_slice(&[1; 32]).unwrap(), first_hop_htlc_msat: 0, payment_id: PaymentId([2; 32]), - payment_secret: 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 {