From: Matt Corallo Date: Tue, 6 Sep 2022 22:51:29 +0000 (+0000) Subject: Add missing deserialization of Event::HTLCHandlingFailed X-Git-Tag: v0.0.111~13^2 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=refs%2Fheads%2F2022-09-missing-event-deser;p=rust-lightning 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. --- 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.