Skip to content

Commit a59b9d8

Browse files
authored
Merge pull request #1700 from TheBlueMatt/2022-09-missing-event-deser
Add missing deserialization of Event::HTLCHandlingFailed
2 parents 301efc8 + 089ccbb commit a59b9d8

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

lightning/src/util/events.rs

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1002,7 +1002,7 @@ impl MaybeReadable for Event {
10021002
(4, path, vec_type),
10031003
(6, short_channel_id, option),
10041004
});
1005-
Ok(Some(Event::ProbeFailed{
1005+
Ok(Some(Event::ProbeFailed {
10061006
payment_id,
10071007
payment_hash,
10081008
path: path.unwrap(),
@@ -1011,6 +1011,28 @@ impl MaybeReadable for Event {
10111011
};
10121012
f()
10131013
},
1014+
25u8 => {
1015+
let f = || {
1016+
let mut prev_channel_id = [0; 32];
1017+
let mut failed_next_destination_opt = None;
1018+
read_tlv_fields!(reader, {
1019+
(0, prev_channel_id, required),
1020+
(2, failed_next_destination_opt, ignorable),
1021+
});
1022+
if let Some(failed_next_destination) = failed_next_destination_opt {
1023+
Ok(Some(Event::HTLCHandlingFailed {
1024+
prev_channel_id,
1025+
failed_next_destination,
1026+
}))
1027+
} else {
1028+
// If we fail to read a `failed_next_destination` assume it's because
1029+
// `MaybeReadable::read` returned `Ok(None)`, though it's also possible we
1030+
// were simply missing the field.
1031+
Ok(None)
1032+
}
1033+
};
1034+
f()
1035+
},
10141036
// Versions prior to 0.0.100 did not ignore odd types, instead returning InvalidValue.
10151037
// Version 0.0.100 failed to properly ignore odd types, possibly resulting in corrupt
10161038
// reads.

0 commit comments

Comments
 (0)