@@ -409,27 +409,6 @@ pub enum BlindedFailure {
409
409
FromBlindedNode,
410
410
}
411
411
412
- /// Tracks the inbound corresponding to an outbound HTLC
413
- #[derive(Clone, Debug, Hash, PartialEq, Eq)]
414
- pub(crate) struct HTLCPreviousHopData {
415
- // Note that this may be an outbound SCID alias for the associated channel.
416
- short_channel_id: u64,
417
- user_channel_id: Option<u128>,
418
- htlc_id: u64,
419
- incoming_packet_shared_secret: [u8; 32],
420
- phantom_shared_secret: Option<[u8; 32]>,
421
- blinded_failure: Option<BlindedFailure>,
422
- channel_id: ChannelId,
423
-
424
- // These fields are consumed by `claim_funds_from_hop()` when updating a force-closed backwards
425
- // channel with a preimage provided by the forward channel.
426
- outpoint: OutPoint,
427
- counterparty_node_id: Option<PublicKey>,
428
- /// Used to preserve our backwards channel by failing back in case an HTLC claim in the forward
429
- /// channel remains unconfirmed for too long.
430
- cltv_expiry: Option<u32>,
431
- }
432
-
433
412
#[derive(PartialEq, Eq)]
434
413
enum OnionPayload {
435
414
/// Indicates this incoming onion payload is for the purpose of paying an invoice.
@@ -674,21 +653,50 @@ impl_writeable_tlv_based_enum!(SentHTLCId,
674
653
},
675
654
);
676
655
677
-
678
- /// Tracks the inbound corresponding to an outbound HTLC
679
- #[allow(clippy::derive_hash_xor_eq)] // Our Hash is faithful to the data, we just don't have SecretKey::hash
680
- #[derive(Clone, Debug, PartialEq, Eq)]
681
- pub enum HTLCSource {
682
- PreviousHopData(HTLCPreviousHopData),
683
- OutboundRoute {
684
- path: Path,
685
- session_priv: SecretKey,
686
- /// Technically we can recalculate this from the route, but we cache it here to avoid
687
- /// doing a double-pass on route when we get a failure back
688
- first_hop_htlc_msat: u64,
689
- payment_id: PaymentId,
690
- },
656
+ mod fuzzy_channelmanager {
657
+ use super::*;
658
+
659
+ /// Tracks the inbound corresponding to an outbound HTLC
660
+ #[allow(clippy::derive_hash_xor_eq)] // Our Hash is faithful to the data, we just don't have SecretKey::hash
661
+ #[derive(Clone, Debug, PartialEq, Eq)]
662
+ pub enum HTLCSource {
663
+ PreviousHopData(HTLCPreviousHopData),
664
+ OutboundRoute {
665
+ path: Path,
666
+ session_priv: SecretKey,
667
+ /// Technically we can recalculate this from the route, but we cache it here to avoid
668
+ /// doing a double-pass on route when we get a failure back
669
+ first_hop_htlc_msat: u64,
670
+ payment_id: PaymentId,
671
+ },
672
+ }
673
+
674
+ /// Tracks the inbound corresponding to an outbound HTLC
675
+ #[derive(Clone, Debug, Hash, PartialEq, Eq)]
676
+ pub struct HTLCPreviousHopData {
677
+ // Note that this may be an outbound SCID alias for the associated channel.
678
+ pub short_channel_id: u64,
679
+ pub user_channel_id: Option<u128>,
680
+ pub htlc_id: u64,
681
+ pub incoming_packet_shared_secret: [u8; 32],
682
+ pub phantom_shared_secret: Option<[u8; 32]>,
683
+ pub blinded_failure: Option<BlindedFailure>,
684
+ pub channel_id: ChannelId,
685
+
686
+ // These fields are consumed by `claim_funds_from_hop()` when updating a force-closed backwards
687
+ // channel with a preimage provided by the forward channel.
688
+ pub outpoint: OutPoint,
689
+ pub counterparty_node_id: Option<PublicKey>,
690
+ /// Used to preserve our backwards channel by failing back in case an HTLC claim in the forward
691
+ /// channel remains unconfirmed for too long.
692
+ pub cltv_expiry: Option<u32>,
693
+ }
691
694
}
695
+ #[cfg(fuzzing)]
696
+ pub use self::fuzzy_channelmanager::*;
697
+ #[cfg(not(fuzzing))]
698
+ pub(crate) use self::fuzzy_channelmanager::*;
699
+
692
700
#[allow(clippy::derive_hash_xor_eq)] // Our Hash is faithful to the data, we just don't have SecretKey::hash
693
701
impl core::hash::Hash for HTLCSource {
694
702
fn hash<H: core::hash::Hasher>(&self, hasher: &mut H) {
0 commit comments