Merge pull request #1700 from TheBlueMatt/2022-09-missing-event-deser

Add missing deserialization of Event::HTLCHandlingFailed
This commit is contained in:
Matt Corallo 2022-09-08 15:41:58 +00:00 committed by GitHub
commit a59b9d8079
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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.