From 089ccbb67179b8d196fc396e91a33d28dd63619e Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Tue, 6 Sep 2022 22:51:29 +0000 Subject: [PATCH] Add missing deserialization of Event::HTLCHandlingFailed 17e6c374c513f2eca810fa4e931be65f0d4fc29f added the `HTLCHandlingFailed` event, including serialization thereof, however failed to add corresponding deserialization. This corrects that oversight by adding said deserialization. Thanks to @wpaulino for catching the oversight. --- lightning/src/util/events.rs | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/lightning/src/util/events.rs b/lightning/src/util/events.rs index e86eae3c8..099fea60e 100644 --- a/lightning/src/util/events.rs +++ b/lightning/src/util/events.rs @@ -1002,7 +1002,7 @@ impl MaybeReadable for Event { (4, path, vec_type), (6, short_channel_id, option), }); - Ok(Some(Event::ProbeFailed{ + Ok(Some(Event::ProbeFailed { payment_id, payment_hash, path: path.unwrap(), @@ -1011,6 +1011,28 @@ impl MaybeReadable for Event { }; f() }, + 25u8 => { + let f = || { + let mut prev_channel_id = [0; 32]; + let mut failed_next_destination_opt = None; + read_tlv_fields!(reader, { + (0, prev_channel_id, required), + (2, failed_next_destination_opt, ignorable), + }); + if let Some(failed_next_destination) = failed_next_destination_opt { + Ok(Some(Event::HTLCHandlingFailed { + prev_channel_id, + failed_next_destination, + })) + } else { + // If we fail to read a `failed_next_destination` assume it's because + // `MaybeReadable::read` returned `Ok(None)`, though it's also possible we + // were simply missing the field. + Ok(None) + } + }; + f() + }, // Versions prior to 0.0.100 did not ignore odd types, instead returning InvalidValue. // Version 0.0.100 failed to properly ignore odd types, possibly resulting in corrupt // reads. -- 2.39.5