Merge pull request #813 from jkczyz/2021-02-channel-monitor-mutex
[rust-lightning] / lightning-c-bindings / src / util / events.rs
index eef634762be0e7949abc5fbdca79159308ad1001..52893679e4d5d3a14d19f45751f9bf6ed5e5c41b 100644 (file)
@@ -249,7 +249,7 @@ impl Event {
                        },
                        nativeEvent::SpendableOutputs {ref outputs, } => {
                                let mut outputs_nonref = (*outputs).clone();
-                               let mut local_outputs_nonref = Vec::new(); for item in outputs_nonref.drain(..) { local_outputs_nonref.push( { crate::chain::keysinterface::SpendableOutputDescriptor::native_into(item) }); };
+                               let mut local_outputs_nonref = Vec::new(); for mut item in outputs_nonref.drain(..) { local_outputs_nonref.push( { crate::chain::keysinterface::SpendableOutputDescriptor::native_into(item) }); };
                                Event::SpendableOutputs {
                                        outputs: local_outputs_nonref.into(),
                                }
@@ -298,7 +298,7 @@ impl Event {
                                }
                        },
                        nativeEvent::SpendableOutputs {mut outputs, } => {
-                               let mut local_outputs = Vec::new(); for item in outputs.drain(..) { local_outputs.push( { crate::chain::keysinterface::SpendableOutputDescriptor::native_into(item) }); };
+                               let mut local_outputs = Vec::new(); for mut item in outputs.drain(..) { local_outputs.push( { crate::chain::keysinterface::SpendableOutputDescriptor::native_into(item) }); };
                                Event::SpendableOutputs {
                                        outputs: local_outputs.into(),
                                }
@@ -312,6 +312,10 @@ pub extern "C" fn Event_free(this_ptr: Event) { }
 pub extern "C" fn Event_clone(orig: &Event) -> Event {
        orig.clone()
 }
+#[no_mangle]
+pub extern "C" fn Event_write(obj: &Event) -> crate::c_types::derived::CVec_u8Z {
+       crate::c_types::serialize_obj(&unsafe { &*obj }.to_native())
+}
 /// An event generated by ChannelManager which indicates a message should be sent to a peer (or
 /// broadcast to most peers).
 /// These events are handled by PeerManager::process_events if you are using a PeerManager.