Add channel_id to SpendableOutputs event
[rust-lightning] / lightning / src / events / mod.rs
index 418f8d5459a18e7fe3711327ba119ab87d2de5ef..da687ad1b9aa5bb11cd385a3faa0d99e973d7aba 100644 (file)
@@ -673,6 +673,10 @@ pub enum Event {
        SpendableOutputs {
                /// The outputs which you should store as spendable by you.
                outputs: Vec<SpendableOutputDescriptor>,
+               /// The `channel_id` indicating which channel the spendable outputs belong to.
+               ///
+               /// This will always be `Some` for events generated by LDK versions 0.0.117 and above.
+               channel_id: Option<[u8; 32]>,
        },
        /// This event is generated when a payment has been successfully forwarded through us and a
        /// forwarding fee earned.
@@ -958,10 +962,11 @@ impl Writeable for Event {
                                // Note that we now ignore these on the read end as we'll re-generate them in
                                // ChannelManager, we write them here only for backwards compatibility.
                        },
-                       &Event::SpendableOutputs { ref outputs } => {
+                       &Event::SpendableOutputs { ref outputs, channel_id } => {
                                5u8.write(writer)?;
                                write_tlv_fields!(writer, {
                                        (0, WithoutLength(outputs), required),
+                                       (1, channel_id, option),
                                });
                        },
                        &Event::HTLCIntercepted { requested_next_hop_scid, payment_hash, inbound_amount_msat, expected_outbound_amount_msat, intercept_id } => {
@@ -1230,10 +1235,12 @@ impl MaybeReadable for Event {
                        5u8 => {
                                let f = || {
                                        let mut outputs = WithoutLength(Vec::new());
+                                       let mut channel_id: Option<[u8; 32]> = None;
                                        read_tlv_fields!(reader, {
                                                (0, outputs, required),
+                                               (1, channel_id, option),
                                        });
-                                       Ok(Some(Event::SpendableOutputs { outputs: outputs.0 }))
+                                       Ok(Some(Event::SpendableOutputs { outputs: outputs.0, channel_id }))
                                };
                                f()
                        },