Skip to content

Commit 6a546dd

Browse files
committed
Refactor DiscardFunding event to use only bitcoin transaction
1 parent 14256ea commit 6a546dd

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

lightning/src/util/events.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ pub enum Event {
262262
/// The channel_id of the channel which has been closed.
263263
channel_id: [u8; 32],
264264
/// The full transaction received from the user
265-
transaction: Option<Transaction>
265+
transaction: Transaction
266266
}
267267
}
268268

@@ -353,7 +353,7 @@ impl Writeable for Event {
353353
11u8.write(writer)?;
354354
write_tlv_fields!(writer, {
355355
(0, channel_id, required),
356-
(2, transaction, option)
356+
(2, transaction, required)
357357
})
358358
},
359359
// Note that, going forward, all new events must only write data inside of
@@ -489,12 +489,11 @@ impl MaybeReadable for Event {
489489
},
490490
11u8 => {
491491
let mut channel_id = [0; 32];
492-
let mut transaction = None;
492+
let mut transaction = Transaction{ version: 2, lock_time: 0, input: Vec::new(), output: Vec::new() };
493493
read_tlv_fields!(reader, {
494494
(0, channel_id, required),
495-
(2, transaction, ignorable),
495+
(2, transaction, required),
496496
});
497-
if transaction.is_none() { return Ok(None); }
498497
Ok(Some(Event::DiscardFunding { channel_id, transaction } ))
499498
},
500499
// Versions prior to 0.0.100 did not ignore odd types, instead returning InvalidValue.

0 commit comments

Comments
 (0)