X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning-c-bindings%2Fsrc%2Flightning%2Futil%2Fevents.rs;h=7961f623bbc456c5ab50b8398cc3ddd0feca46fa;hb=033f4f3b2750dcd5afc8b158d7474242b29b24f3;hp=cb28df82f252669b840434264f4e502570c29aae;hpb=0d06fa1c196fad82d1c1c5a3b59fc6bd76f9cc12;p=ldk-c-bindings diff --git a/lightning-c-bindings/src/lightning/util/events.rs b/lightning-c-bindings/src/lightning/util/events.rs index cb28df8..7961f62 100644 --- a/lightning-c-bindings/src/lightning/util/events.rs +++ b/lightning-c-bindings/src/lightning/util/events.rs @@ -460,6 +460,15 @@ pub enum MessageSendEvent { /// The channel_update which should be sent. msg: crate::lightning::ln::msgs::ChannelUpdate, }, + /// Used to indicate that a channel_update should be sent to a single peer. + /// In contrast to [`Self::BroadcastChannelUpdate`], this is used when the channel is a + /// private channel and we shouldn't be informing all of our peers of channel parameters. + SendChannelUpdate { + /// The node_id of the node which should receive this message + node_id: crate::c_types::PublicKey, + /// The channel_update which should be sent. + msg: crate::lightning::ln::msgs::ChannelUpdate, + }, /// Broadcast an error downstream to be handled HandleError { /// The node_id of the node which should receive this message @@ -610,6 +619,14 @@ impl MessageSendEvent { msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, } }, + MessageSendEvent::SendChannelUpdate {ref node_id, ref msg, } => { + let mut node_id_nonref = (*node_id).clone(); + let mut msg_nonref = (*msg).clone(); + nativeMessageSendEvent::SendChannelUpdate { + node_id: node_id_nonref.into_rust(), + msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, + } + }, MessageSendEvent::HandleError {ref node_id, ref action, } => { let mut node_id_nonref = (*node_id).clone(); let mut action_nonref = (*action).clone(); @@ -735,6 +752,12 @@ impl MessageSendEvent { msg: *unsafe { Box::from_raw(msg.take_inner()) }, } }, + MessageSendEvent::SendChannelUpdate {mut node_id, mut msg, } => { + nativeMessageSendEvent::SendChannelUpdate { + node_id: node_id.into_rust(), + msg: *unsafe { Box::from_raw(msg.take_inner()) }, + } + }, MessageSendEvent::HandleError {mut node_id, mut action, } => { nativeMessageSendEvent::HandleError { node_id: node_id.into_rust(), @@ -877,6 +900,14 @@ impl MessageSendEvent { msg: crate::lightning::ln::msgs::ChannelUpdate { inner: Box::into_raw(Box::new(msg_nonref)), is_owned: true }, } }, + nativeMessageSendEvent::SendChannelUpdate {ref node_id, ref msg, } => { + let mut node_id_nonref = (*node_id).clone(); + let mut msg_nonref = (*msg).clone(); + MessageSendEvent::SendChannelUpdate { + node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), + msg: crate::lightning::ln::msgs::ChannelUpdate { inner: Box::into_raw(Box::new(msg_nonref)), is_owned: true }, + } + }, nativeMessageSendEvent::HandleError {ref node_id, ref action, } => { let mut node_id_nonref = (*node_id).clone(); let mut action_nonref = (*action).clone(); @@ -1002,6 +1033,12 @@ impl MessageSendEvent { msg: crate::lightning::ln::msgs::ChannelUpdate { inner: Box::into_raw(Box::new(msg)), is_owned: true }, } }, + nativeMessageSendEvent::SendChannelUpdate {mut node_id, mut msg, } => { + MessageSendEvent::SendChannelUpdate { + node_id: crate::c_types::PublicKey::from_rust(&node_id), + msg: crate::lightning::ln::msgs::ChannelUpdate { inner: Box::into_raw(Box::new(msg)), is_owned: true }, + } + }, nativeMessageSendEvent::HandleError {mut node_id, mut action, } => { MessageSendEvent::HandleError { node_id: crate::c_types::PublicKey::from_rust(&node_id),