Skip to content

Commit 14256ea

Browse files
committed
Refactor event read and write to use odd type
1 parent 40bbfd7 commit 14256ea

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

lightning/src/util/events.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ impl Writeable for Event {
350350
});
351351
},
352352
&Event::DiscardFunding { ref channel_id, ref transaction } => {
353-
12u8.write(writer)?;
353+
11u8.write(writer)?;
354354
write_tlv_fields!(writer, {
355355
(0, channel_id, required),
356356
(2, transaction, option)
@@ -487,6 +487,16 @@ impl MaybeReadable for Event {
487487
if reason.is_none() { return Ok(None); }
488488
Ok(Some(Event::ChannelClosed { channel_id, reason: reason.unwrap() }))
489489
},
490+
11u8 => {
491+
let mut channel_id = [0; 32];
492+
let mut transaction = None;
493+
read_tlv_fields!(reader, {
494+
(0, channel_id, required),
495+
(2, transaction, ignorable),
496+
});
497+
if transaction.is_none() { return Ok(None); }
498+
Ok(Some(Event::DiscardFunding { channel_id, transaction } ))
499+
},
490500
// Versions prior to 0.0.100 did not ignore odd types, instead returning InvalidValue.
491501
// Version 0.0.100 failed to properly ignore odd types, possibly resulting in corrupt
492502
// reads.

0 commit comments

Comments
 (0)