Add new HTLCDestination variant for invalid onion
authorWilmer Paulino <wilmer@wilmerpaulino.com>
Tue, 23 Jan 2024 00:29:41 +0000 (16:29 -0800)
committerWilmer Paulino <wilmer@wilmerpaulino.com>
Wed, 27 Mar 2024 21:28:01 +0000 (14:28 -0700)
The existing variants do not cover such case as we previously never
surfaced `HTLCHandlingFailed` events for HTLCs that we failed back with
`UpdateFailMalformedHTLC` due to an invalid onion packet.

lightning/src/events/mod.rs

index f849dcc2fc24a29dd9dc9e5acfa1a06ca03c39a1..b43f2f9370d4370a70510af93c4828e2d3b93b92 100644 (file)
@@ -302,6 +302,8 @@ pub enum HTLCDestination {
                /// Short channel id we are requesting to forward an HTLC to.
                requested_forward_scid: u64
        },
+       /// We couldn't decode the incoming onion to obtain the forwarding details.
+       InvalidOnion,
        /// Failure scenario where an HTLC may have been forwarded to be intended for us,
        /// but is invalid for some reason, so we reject it.
        ///
@@ -329,6 +331,7 @@ impl_writeable_tlv_based_enum_upgradable!(HTLCDestination,
        (2, UnknownNextHop) => {
                (0, requested_forward_scid, required),
        },
+       (3, InvalidOnion) => {},
        (4, FailedPayment) => {
                (0, payment_hash, required),
        },