1 //! Wire messages, traits representing wire message handlers, and a few error types live here.
3 //! For a normal node you probably don't need to use anything here, however, if you wish to split a
4 //! node into an internet-facing route/message socket handling daemon and a separate daemon (or
5 //! server entirely) which handles only channel-related messages you may wish to implement
6 //! ChannelMessageHandler yourself and use it to re-serialize messages and pass them across
9 //! Note that if you go with such an architecture (instead of passing raw socket events to a
10 //! non-internet-facing system) you trust the frontend internet-facing system to not lie about the
11 //! source node_id of the message, however this does allow you to significantly reduce bandwidth
12 //! between the systems as routing messages can represent a significant chunk of bandwidth usage
13 //! (especially for non-channel-publicly-announcing nodes). As an alternate design which avoids
14 //! this issue, if you have sufficient bidirectional bandwidth between your systems, you may send
15 //! raw socket events into your non-internet-facing system and then send routing events back to
16 //! track the network on the less-secure system.
19 use bitcoin::hashes::Hash;
20 use crate::c_types::*;
23 use lightning::ln::msgs::DecodeError as nativeDecodeErrorImport;
24 type nativeDecodeError = nativeDecodeErrorImport;
26 /// An error in decoding a message or struct.
29 pub struct DecodeError {
30 /// Nearly everywhere, inner must be non-null, however in places where
31 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
32 pub inner: *mut nativeDecodeError,
36 impl Drop for DecodeError {
38 if self.is_owned && !self.inner.is_null() {
39 let _ = unsafe { Box::from_raw(self.inner) };
44 pub extern "C" fn DecodeError_free(this_ptr: DecodeError) { }
46 /// Used only if an object of this type is returned as a trait impl by a method
47 extern "C" fn DecodeError_free_void(this_ptr: *mut c_void) {
48 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeDecodeError); }
51 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
53 pub(crate) fn take_inner(mut self) -> *mut nativeDecodeError {
54 assert!(self.is_owned);
56 self.inner = std::ptr::null_mut();
60 impl Clone for DecodeError {
61 fn clone(&self) -> Self {
63 inner: if self.inner.is_null() { std::ptr::null_mut() } else {
64 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
70 /// Used only if an object of this type is returned as a trait impl by a method
71 pub(crate) extern "C" fn DecodeError_clone_void(this_ptr: *const c_void) -> *mut c_void {
72 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeDecodeError)).clone() })) as *mut c_void
75 pub extern "C" fn DecodeError_clone(orig: &DecodeError) -> DecodeError {
79 use lightning::ln::msgs::Init as nativeInitImport;
80 type nativeInit = nativeInitImport;
82 /// An init message to be sent or received from a peer
86 /// Nearly everywhere, inner must be non-null, however in places where
87 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
88 pub inner: *mut nativeInit,
94 if self.is_owned && !self.inner.is_null() {
95 let _ = unsafe { Box::from_raw(self.inner) };
100 pub extern "C" fn Init_free(this_ptr: Init) { }
102 /// Used only if an object of this type is returned as a trait impl by a method
103 extern "C" fn Init_free_void(this_ptr: *mut c_void) {
104 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeInit); }
107 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
109 pub(crate) fn take_inner(mut self) -> *mut nativeInit {
110 assert!(self.is_owned);
111 let ret = self.inner;
112 self.inner = std::ptr::null_mut();
116 impl Clone for Init {
117 fn clone(&self) -> Self {
119 inner: if self.inner.is_null() { std::ptr::null_mut() } else {
120 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
126 /// Used only if an object of this type is returned as a trait impl by a method
127 pub(crate) extern "C" fn Init_clone_void(this_ptr: *const c_void) -> *mut c_void {
128 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeInit)).clone() })) as *mut c_void
131 pub extern "C" fn Init_clone(orig: &Init) -> Init {
135 use lightning::ln::msgs::ErrorMessage as nativeErrorMessageImport;
136 type nativeErrorMessage = nativeErrorMessageImport;
138 /// An error message to be sent or received from a peer
141 pub struct ErrorMessage {
142 /// Nearly everywhere, inner must be non-null, however in places where
143 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
144 pub inner: *mut nativeErrorMessage,
148 impl Drop for ErrorMessage {
150 if self.is_owned && !self.inner.is_null() {
151 let _ = unsafe { Box::from_raw(self.inner) };
156 pub extern "C" fn ErrorMessage_free(this_ptr: ErrorMessage) { }
158 /// Used only if an object of this type is returned as a trait impl by a method
159 extern "C" fn ErrorMessage_free_void(this_ptr: *mut c_void) {
160 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeErrorMessage); }
163 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
165 pub(crate) fn take_inner(mut self) -> *mut nativeErrorMessage {
166 assert!(self.is_owned);
167 let ret = self.inner;
168 self.inner = std::ptr::null_mut();
172 /// The channel ID involved in the error
174 pub extern "C" fn ErrorMessage_get_channel_id(this_ptr: &ErrorMessage) -> *const [u8; 32] {
175 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_id;
178 /// The channel ID involved in the error
180 pub extern "C" fn ErrorMessage_set_channel_id(this_ptr: &mut ErrorMessage, mut val: crate::c_types::ThirtyTwoBytes) {
181 unsafe { &mut *this_ptr.inner }.channel_id = val.data;
183 /// A possibly human-readable error description.
184 /// The string should be sanitized before it is used (e.g. emitted to logs
185 /// or printed to stdout). Otherwise, a well crafted error message may trigger a security
186 /// vulnerability in the terminal emulator or the logging subsystem.
188 pub extern "C" fn ErrorMessage_get_data(this_ptr: &ErrorMessage) -> crate::c_types::Str {
189 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.data;
190 (*inner_val).as_str().into()
192 /// A possibly human-readable error description.
193 /// The string should be sanitized before it is used (e.g. emitted to logs
194 /// or printed to stdout). Otherwise, a well crafted error message may trigger a security
195 /// vulnerability in the terminal emulator or the logging subsystem.
197 pub extern "C" fn ErrorMessage_set_data(this_ptr: &mut ErrorMessage, mut val: crate::c_types::derived::CVec_u8Z) {
198 unsafe { &mut *this_ptr.inner }.data = String::from_utf8(val.into_rust()).unwrap();
202 pub extern "C" fn ErrorMessage_new(mut channel_id_arg: crate::c_types::ThirtyTwoBytes, mut data_arg: crate::c_types::derived::CVec_u8Z) -> ErrorMessage {
203 ErrorMessage { inner: Box::into_raw(Box::new(nativeErrorMessage {
204 channel_id: channel_id_arg.data,
205 data: String::from_utf8(data_arg.into_rust()).unwrap(),
206 })), is_owned: true }
208 impl Clone for ErrorMessage {
209 fn clone(&self) -> Self {
211 inner: if self.inner.is_null() { std::ptr::null_mut() } else {
212 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
218 /// Used only if an object of this type is returned as a trait impl by a method
219 pub(crate) extern "C" fn ErrorMessage_clone_void(this_ptr: *const c_void) -> *mut c_void {
220 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeErrorMessage)).clone() })) as *mut c_void
223 pub extern "C" fn ErrorMessage_clone(orig: &ErrorMessage) -> ErrorMessage {
227 use lightning::ln::msgs::Ping as nativePingImport;
228 type nativePing = nativePingImport;
230 /// A ping message to be sent or received from a peer
234 /// Nearly everywhere, inner must be non-null, however in places where
235 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
236 pub inner: *mut nativePing,
242 if self.is_owned && !self.inner.is_null() {
243 let _ = unsafe { Box::from_raw(self.inner) };
248 pub extern "C" fn Ping_free(this_ptr: Ping) { }
250 /// Used only if an object of this type is returned as a trait impl by a method
251 extern "C" fn Ping_free_void(this_ptr: *mut c_void) {
252 unsafe { let _ = Box::from_raw(this_ptr as *mut nativePing); }
255 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
257 pub(crate) fn take_inner(mut self) -> *mut nativePing {
258 assert!(self.is_owned);
259 let ret = self.inner;
260 self.inner = std::ptr::null_mut();
264 /// The desired response length
266 pub extern "C" fn Ping_get_ponglen(this_ptr: &Ping) -> u16 {
267 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.ponglen;
270 /// The desired response length
272 pub extern "C" fn Ping_set_ponglen(this_ptr: &mut Ping, mut val: u16) {
273 unsafe { &mut *this_ptr.inner }.ponglen = val;
275 /// The ping packet size.
276 /// This field is not sent on the wire. byteslen zeros are sent.
278 pub extern "C" fn Ping_get_byteslen(this_ptr: &Ping) -> u16 {
279 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.byteslen;
282 /// The ping packet size.
283 /// This field is not sent on the wire. byteslen zeros are sent.
285 pub extern "C" fn Ping_set_byteslen(this_ptr: &mut Ping, mut val: u16) {
286 unsafe { &mut *this_ptr.inner }.byteslen = val;
290 pub extern "C" fn Ping_new(mut ponglen_arg: u16, mut byteslen_arg: u16) -> Ping {
291 Ping { inner: Box::into_raw(Box::new(nativePing {
292 ponglen: ponglen_arg,
293 byteslen: byteslen_arg,
294 })), is_owned: true }
296 impl Clone for Ping {
297 fn clone(&self) -> Self {
299 inner: if self.inner.is_null() { std::ptr::null_mut() } else {
300 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
306 /// Used only if an object of this type is returned as a trait impl by a method
307 pub(crate) extern "C" fn Ping_clone_void(this_ptr: *const c_void) -> *mut c_void {
308 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativePing)).clone() })) as *mut c_void
311 pub extern "C" fn Ping_clone(orig: &Ping) -> Ping {
315 use lightning::ln::msgs::Pong as nativePongImport;
316 type nativePong = nativePongImport;
318 /// A pong message to be sent or received from a peer
322 /// Nearly everywhere, inner must be non-null, however in places where
323 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
324 pub inner: *mut nativePong,
330 if self.is_owned && !self.inner.is_null() {
331 let _ = unsafe { Box::from_raw(self.inner) };
336 pub extern "C" fn Pong_free(this_ptr: Pong) { }
338 /// Used only if an object of this type is returned as a trait impl by a method
339 extern "C" fn Pong_free_void(this_ptr: *mut c_void) {
340 unsafe { let _ = Box::from_raw(this_ptr as *mut nativePong); }
343 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
345 pub(crate) fn take_inner(mut self) -> *mut nativePong {
346 assert!(self.is_owned);
347 let ret = self.inner;
348 self.inner = std::ptr::null_mut();
352 /// The pong packet size.
353 /// This field is not sent on the wire. byteslen zeros are sent.
355 pub extern "C" fn Pong_get_byteslen(this_ptr: &Pong) -> u16 {
356 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.byteslen;
359 /// The pong packet size.
360 /// This field is not sent on the wire. byteslen zeros are sent.
362 pub extern "C" fn Pong_set_byteslen(this_ptr: &mut Pong, mut val: u16) {
363 unsafe { &mut *this_ptr.inner }.byteslen = val;
367 pub extern "C" fn Pong_new(mut byteslen_arg: u16) -> Pong {
368 Pong { inner: Box::into_raw(Box::new(nativePong {
369 byteslen: byteslen_arg,
370 })), is_owned: true }
372 impl Clone for Pong {
373 fn clone(&self) -> Self {
375 inner: if self.inner.is_null() { std::ptr::null_mut() } else {
376 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
382 /// Used only if an object of this type is returned as a trait impl by a method
383 pub(crate) extern "C" fn Pong_clone_void(this_ptr: *const c_void) -> *mut c_void {
384 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativePong)).clone() })) as *mut c_void
387 pub extern "C" fn Pong_clone(orig: &Pong) -> Pong {
391 use lightning::ln::msgs::OpenChannel as nativeOpenChannelImport;
392 type nativeOpenChannel = nativeOpenChannelImport;
394 /// An open_channel message to be sent or received from a peer
397 pub struct OpenChannel {
398 /// Nearly everywhere, inner must be non-null, however in places where
399 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
400 pub inner: *mut nativeOpenChannel,
404 impl Drop for OpenChannel {
406 if self.is_owned && !self.inner.is_null() {
407 let _ = unsafe { Box::from_raw(self.inner) };
412 pub extern "C" fn OpenChannel_free(this_ptr: OpenChannel) { }
414 /// Used only if an object of this type is returned as a trait impl by a method
415 extern "C" fn OpenChannel_free_void(this_ptr: *mut c_void) {
416 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeOpenChannel); }
419 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
421 pub(crate) fn take_inner(mut self) -> *mut nativeOpenChannel {
422 assert!(self.is_owned);
423 let ret = self.inner;
424 self.inner = std::ptr::null_mut();
428 /// The genesis hash of the blockchain where the channel is to be opened
430 pub extern "C" fn OpenChannel_get_chain_hash(this_ptr: &OpenChannel) -> *const [u8; 32] {
431 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.chain_hash;
432 (*inner_val).as_inner()
434 /// The genesis hash of the blockchain where the channel is to be opened
436 pub extern "C" fn OpenChannel_set_chain_hash(this_ptr: &mut OpenChannel, mut val: crate::c_types::ThirtyTwoBytes) {
437 unsafe { &mut *this_ptr.inner }.chain_hash = ::bitcoin::hash_types::BlockHash::from_slice(&val.data[..]).unwrap();
439 /// A temporary channel ID, until the funding outpoint is announced
441 pub extern "C" fn OpenChannel_get_temporary_channel_id(this_ptr: &OpenChannel) -> *const [u8; 32] {
442 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.temporary_channel_id;
445 /// A temporary channel ID, until the funding outpoint is announced
447 pub extern "C" fn OpenChannel_set_temporary_channel_id(this_ptr: &mut OpenChannel, mut val: crate::c_types::ThirtyTwoBytes) {
448 unsafe { &mut *this_ptr.inner }.temporary_channel_id = val.data;
450 /// The channel value
452 pub extern "C" fn OpenChannel_get_funding_satoshis(this_ptr: &OpenChannel) -> u64 {
453 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.funding_satoshis;
456 /// The channel value
458 pub extern "C" fn OpenChannel_set_funding_satoshis(this_ptr: &mut OpenChannel, mut val: u64) {
459 unsafe { &mut *this_ptr.inner }.funding_satoshis = val;
461 /// The amount to push to the counterparty as part of the open, in milli-satoshi
463 pub extern "C" fn OpenChannel_get_push_msat(this_ptr: &OpenChannel) -> u64 {
464 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.push_msat;
467 /// The amount to push to the counterparty as part of the open, in milli-satoshi
469 pub extern "C" fn OpenChannel_set_push_msat(this_ptr: &mut OpenChannel, mut val: u64) {
470 unsafe { &mut *this_ptr.inner }.push_msat = val;
472 /// The threshold below which outputs on transactions broadcast by sender will be omitted
474 pub extern "C" fn OpenChannel_get_dust_limit_satoshis(this_ptr: &OpenChannel) -> u64 {
475 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.dust_limit_satoshis;
478 /// The threshold below which outputs on transactions broadcast by sender will be omitted
480 pub extern "C" fn OpenChannel_set_dust_limit_satoshis(this_ptr: &mut OpenChannel, mut val: u64) {
481 unsafe { &mut *this_ptr.inner }.dust_limit_satoshis = val;
483 /// The maximum inbound HTLC value in flight towards sender, in milli-satoshi
485 pub extern "C" fn OpenChannel_get_max_htlc_value_in_flight_msat(this_ptr: &OpenChannel) -> u64 {
486 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.max_htlc_value_in_flight_msat;
489 /// The maximum inbound HTLC value in flight towards sender, in milli-satoshi
491 pub extern "C" fn OpenChannel_set_max_htlc_value_in_flight_msat(this_ptr: &mut OpenChannel, mut val: u64) {
492 unsafe { &mut *this_ptr.inner }.max_htlc_value_in_flight_msat = val;
494 /// The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
496 pub extern "C" fn OpenChannel_get_channel_reserve_satoshis(this_ptr: &OpenChannel) -> u64 {
497 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_reserve_satoshis;
500 /// The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
502 pub extern "C" fn OpenChannel_set_channel_reserve_satoshis(this_ptr: &mut OpenChannel, mut val: u64) {
503 unsafe { &mut *this_ptr.inner }.channel_reserve_satoshis = val;
505 /// The minimum HTLC size incoming to sender, in milli-satoshi
507 pub extern "C" fn OpenChannel_get_htlc_minimum_msat(this_ptr: &OpenChannel) -> u64 {
508 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.htlc_minimum_msat;
511 /// The minimum HTLC size incoming to sender, in milli-satoshi
513 pub extern "C" fn OpenChannel_set_htlc_minimum_msat(this_ptr: &mut OpenChannel, mut val: u64) {
514 unsafe { &mut *this_ptr.inner }.htlc_minimum_msat = val;
516 /// The feerate per 1000-weight of sender generated transactions, until updated by update_fee
518 pub extern "C" fn OpenChannel_get_feerate_per_kw(this_ptr: &OpenChannel) -> u32 {
519 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.feerate_per_kw;
522 /// The feerate per 1000-weight of sender generated transactions, until updated by update_fee
524 pub extern "C" fn OpenChannel_set_feerate_per_kw(this_ptr: &mut OpenChannel, mut val: u32) {
525 unsafe { &mut *this_ptr.inner }.feerate_per_kw = val;
527 /// The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
529 pub extern "C" fn OpenChannel_get_to_self_delay(this_ptr: &OpenChannel) -> u16 {
530 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.to_self_delay;
533 /// The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
535 pub extern "C" fn OpenChannel_set_to_self_delay(this_ptr: &mut OpenChannel, mut val: u16) {
536 unsafe { &mut *this_ptr.inner }.to_self_delay = val;
538 /// The maximum number of inbound HTLCs towards sender
540 pub extern "C" fn OpenChannel_get_max_accepted_htlcs(this_ptr: &OpenChannel) -> u16 {
541 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.max_accepted_htlcs;
544 /// The maximum number of inbound HTLCs towards sender
546 pub extern "C" fn OpenChannel_set_max_accepted_htlcs(this_ptr: &mut OpenChannel, mut val: u16) {
547 unsafe { &mut *this_ptr.inner }.max_accepted_htlcs = val;
549 /// The sender's key controlling the funding transaction
551 pub extern "C" fn OpenChannel_get_funding_pubkey(this_ptr: &OpenChannel) -> crate::c_types::PublicKey {
552 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.funding_pubkey;
553 crate::c_types::PublicKey::from_rust(&(*inner_val))
555 /// The sender's key controlling the funding transaction
557 pub extern "C" fn OpenChannel_set_funding_pubkey(this_ptr: &mut OpenChannel, mut val: crate::c_types::PublicKey) {
558 unsafe { &mut *this_ptr.inner }.funding_pubkey = val.into_rust();
560 /// Used to derive a revocation key for transactions broadcast by counterparty
562 pub extern "C" fn OpenChannel_get_revocation_basepoint(this_ptr: &OpenChannel) -> crate::c_types::PublicKey {
563 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.revocation_basepoint;
564 crate::c_types::PublicKey::from_rust(&(*inner_val))
566 /// Used to derive a revocation key for transactions broadcast by counterparty
568 pub extern "C" fn OpenChannel_set_revocation_basepoint(this_ptr: &mut OpenChannel, mut val: crate::c_types::PublicKey) {
569 unsafe { &mut *this_ptr.inner }.revocation_basepoint = val.into_rust();
571 /// A payment key to sender for transactions broadcast by counterparty
573 pub extern "C" fn OpenChannel_get_payment_point(this_ptr: &OpenChannel) -> crate::c_types::PublicKey {
574 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.payment_point;
575 crate::c_types::PublicKey::from_rust(&(*inner_val))
577 /// A payment key to sender for transactions broadcast by counterparty
579 pub extern "C" fn OpenChannel_set_payment_point(this_ptr: &mut OpenChannel, mut val: crate::c_types::PublicKey) {
580 unsafe { &mut *this_ptr.inner }.payment_point = val.into_rust();
582 /// Used to derive a payment key to sender for transactions broadcast by sender
584 pub extern "C" fn OpenChannel_get_delayed_payment_basepoint(this_ptr: &OpenChannel) -> crate::c_types::PublicKey {
585 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.delayed_payment_basepoint;
586 crate::c_types::PublicKey::from_rust(&(*inner_val))
588 /// Used to derive a payment key to sender for transactions broadcast by sender
590 pub extern "C" fn OpenChannel_set_delayed_payment_basepoint(this_ptr: &mut OpenChannel, mut val: crate::c_types::PublicKey) {
591 unsafe { &mut *this_ptr.inner }.delayed_payment_basepoint = val.into_rust();
593 /// Used to derive an HTLC payment key to sender
595 pub extern "C" fn OpenChannel_get_htlc_basepoint(this_ptr: &OpenChannel) -> crate::c_types::PublicKey {
596 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.htlc_basepoint;
597 crate::c_types::PublicKey::from_rust(&(*inner_val))
599 /// Used to derive an HTLC payment key to sender
601 pub extern "C" fn OpenChannel_set_htlc_basepoint(this_ptr: &mut OpenChannel, mut val: crate::c_types::PublicKey) {
602 unsafe { &mut *this_ptr.inner }.htlc_basepoint = val.into_rust();
604 /// The first to-be-broadcast-by-sender transaction's per commitment point
606 pub extern "C" fn OpenChannel_get_first_per_commitment_point(this_ptr: &OpenChannel) -> crate::c_types::PublicKey {
607 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.first_per_commitment_point;
608 crate::c_types::PublicKey::from_rust(&(*inner_val))
610 /// The first to-be-broadcast-by-sender transaction's per commitment point
612 pub extern "C" fn OpenChannel_set_first_per_commitment_point(this_ptr: &mut OpenChannel, mut val: crate::c_types::PublicKey) {
613 unsafe { &mut *this_ptr.inner }.first_per_commitment_point = val.into_rust();
617 pub extern "C" fn OpenChannel_get_channel_flags(this_ptr: &OpenChannel) -> u8 {
618 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_flags;
623 pub extern "C" fn OpenChannel_set_channel_flags(this_ptr: &mut OpenChannel, mut val: u8) {
624 unsafe { &mut *this_ptr.inner }.channel_flags = val;
626 impl Clone for OpenChannel {
627 fn clone(&self) -> Self {
629 inner: if self.inner.is_null() { std::ptr::null_mut() } else {
630 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
636 /// Used only if an object of this type is returned as a trait impl by a method
637 pub(crate) extern "C" fn OpenChannel_clone_void(this_ptr: *const c_void) -> *mut c_void {
638 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeOpenChannel)).clone() })) as *mut c_void
641 pub extern "C" fn OpenChannel_clone(orig: &OpenChannel) -> OpenChannel {
645 use lightning::ln::msgs::AcceptChannel as nativeAcceptChannelImport;
646 type nativeAcceptChannel = nativeAcceptChannelImport;
648 /// An accept_channel message to be sent or received from a peer
651 pub struct AcceptChannel {
652 /// Nearly everywhere, inner must be non-null, however in places where
653 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
654 pub inner: *mut nativeAcceptChannel,
658 impl Drop for AcceptChannel {
660 if self.is_owned && !self.inner.is_null() {
661 let _ = unsafe { Box::from_raw(self.inner) };
666 pub extern "C" fn AcceptChannel_free(this_ptr: AcceptChannel) { }
668 /// Used only if an object of this type is returned as a trait impl by a method
669 extern "C" fn AcceptChannel_free_void(this_ptr: *mut c_void) {
670 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeAcceptChannel); }
673 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
675 pub(crate) fn take_inner(mut self) -> *mut nativeAcceptChannel {
676 assert!(self.is_owned);
677 let ret = self.inner;
678 self.inner = std::ptr::null_mut();
682 /// A temporary channel ID, until the funding outpoint is announced
684 pub extern "C" fn AcceptChannel_get_temporary_channel_id(this_ptr: &AcceptChannel) -> *const [u8; 32] {
685 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.temporary_channel_id;
688 /// A temporary channel ID, until the funding outpoint is announced
690 pub extern "C" fn AcceptChannel_set_temporary_channel_id(this_ptr: &mut AcceptChannel, mut val: crate::c_types::ThirtyTwoBytes) {
691 unsafe { &mut *this_ptr.inner }.temporary_channel_id = val.data;
693 /// The threshold below which outputs on transactions broadcast by sender will be omitted
695 pub extern "C" fn AcceptChannel_get_dust_limit_satoshis(this_ptr: &AcceptChannel) -> u64 {
696 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.dust_limit_satoshis;
699 /// The threshold below which outputs on transactions broadcast by sender will be omitted
701 pub extern "C" fn AcceptChannel_set_dust_limit_satoshis(this_ptr: &mut AcceptChannel, mut val: u64) {
702 unsafe { &mut *this_ptr.inner }.dust_limit_satoshis = val;
704 /// The maximum inbound HTLC value in flight towards sender, in milli-satoshi
706 pub extern "C" fn AcceptChannel_get_max_htlc_value_in_flight_msat(this_ptr: &AcceptChannel) -> u64 {
707 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.max_htlc_value_in_flight_msat;
710 /// The maximum inbound HTLC value in flight towards sender, in milli-satoshi
712 pub extern "C" fn AcceptChannel_set_max_htlc_value_in_flight_msat(this_ptr: &mut AcceptChannel, mut val: u64) {
713 unsafe { &mut *this_ptr.inner }.max_htlc_value_in_flight_msat = val;
715 /// The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
717 pub extern "C" fn AcceptChannel_get_channel_reserve_satoshis(this_ptr: &AcceptChannel) -> u64 {
718 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_reserve_satoshis;
721 /// The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
723 pub extern "C" fn AcceptChannel_set_channel_reserve_satoshis(this_ptr: &mut AcceptChannel, mut val: u64) {
724 unsafe { &mut *this_ptr.inner }.channel_reserve_satoshis = val;
726 /// The minimum HTLC size incoming to sender, in milli-satoshi
728 pub extern "C" fn AcceptChannel_get_htlc_minimum_msat(this_ptr: &AcceptChannel) -> u64 {
729 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.htlc_minimum_msat;
732 /// The minimum HTLC size incoming to sender, in milli-satoshi
734 pub extern "C" fn AcceptChannel_set_htlc_minimum_msat(this_ptr: &mut AcceptChannel, mut val: u64) {
735 unsafe { &mut *this_ptr.inner }.htlc_minimum_msat = val;
737 /// Minimum depth of the funding transaction before the channel is considered open
739 pub extern "C" fn AcceptChannel_get_minimum_depth(this_ptr: &AcceptChannel) -> u32 {
740 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.minimum_depth;
743 /// Minimum depth of the funding transaction before the channel is considered open
745 pub extern "C" fn AcceptChannel_set_minimum_depth(this_ptr: &mut AcceptChannel, mut val: u32) {
746 unsafe { &mut *this_ptr.inner }.minimum_depth = val;
748 /// The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
750 pub extern "C" fn AcceptChannel_get_to_self_delay(this_ptr: &AcceptChannel) -> u16 {
751 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.to_self_delay;
754 /// The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
756 pub extern "C" fn AcceptChannel_set_to_self_delay(this_ptr: &mut AcceptChannel, mut val: u16) {
757 unsafe { &mut *this_ptr.inner }.to_self_delay = val;
759 /// The maximum number of inbound HTLCs towards sender
761 pub extern "C" fn AcceptChannel_get_max_accepted_htlcs(this_ptr: &AcceptChannel) -> u16 {
762 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.max_accepted_htlcs;
765 /// The maximum number of inbound HTLCs towards sender
767 pub extern "C" fn AcceptChannel_set_max_accepted_htlcs(this_ptr: &mut AcceptChannel, mut val: u16) {
768 unsafe { &mut *this_ptr.inner }.max_accepted_htlcs = val;
770 /// The sender's key controlling the funding transaction
772 pub extern "C" fn AcceptChannel_get_funding_pubkey(this_ptr: &AcceptChannel) -> crate::c_types::PublicKey {
773 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.funding_pubkey;
774 crate::c_types::PublicKey::from_rust(&(*inner_val))
776 /// The sender's key controlling the funding transaction
778 pub extern "C" fn AcceptChannel_set_funding_pubkey(this_ptr: &mut AcceptChannel, mut val: crate::c_types::PublicKey) {
779 unsafe { &mut *this_ptr.inner }.funding_pubkey = val.into_rust();
781 /// Used to derive a revocation key for transactions broadcast by counterparty
783 pub extern "C" fn AcceptChannel_get_revocation_basepoint(this_ptr: &AcceptChannel) -> crate::c_types::PublicKey {
784 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.revocation_basepoint;
785 crate::c_types::PublicKey::from_rust(&(*inner_val))
787 /// Used to derive a revocation key for transactions broadcast by counterparty
789 pub extern "C" fn AcceptChannel_set_revocation_basepoint(this_ptr: &mut AcceptChannel, mut val: crate::c_types::PublicKey) {
790 unsafe { &mut *this_ptr.inner }.revocation_basepoint = val.into_rust();
792 /// A payment key to sender for transactions broadcast by counterparty
794 pub extern "C" fn AcceptChannel_get_payment_point(this_ptr: &AcceptChannel) -> crate::c_types::PublicKey {
795 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.payment_point;
796 crate::c_types::PublicKey::from_rust(&(*inner_val))
798 /// A payment key to sender for transactions broadcast by counterparty
800 pub extern "C" fn AcceptChannel_set_payment_point(this_ptr: &mut AcceptChannel, mut val: crate::c_types::PublicKey) {
801 unsafe { &mut *this_ptr.inner }.payment_point = val.into_rust();
803 /// Used to derive a payment key to sender for transactions broadcast by sender
805 pub extern "C" fn AcceptChannel_get_delayed_payment_basepoint(this_ptr: &AcceptChannel) -> crate::c_types::PublicKey {
806 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.delayed_payment_basepoint;
807 crate::c_types::PublicKey::from_rust(&(*inner_val))
809 /// Used to derive a payment key to sender for transactions broadcast by sender
811 pub extern "C" fn AcceptChannel_set_delayed_payment_basepoint(this_ptr: &mut AcceptChannel, mut val: crate::c_types::PublicKey) {
812 unsafe { &mut *this_ptr.inner }.delayed_payment_basepoint = val.into_rust();
814 /// Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
816 pub extern "C" fn AcceptChannel_get_htlc_basepoint(this_ptr: &AcceptChannel) -> crate::c_types::PublicKey {
817 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.htlc_basepoint;
818 crate::c_types::PublicKey::from_rust(&(*inner_val))
820 /// Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
822 pub extern "C" fn AcceptChannel_set_htlc_basepoint(this_ptr: &mut AcceptChannel, mut val: crate::c_types::PublicKey) {
823 unsafe { &mut *this_ptr.inner }.htlc_basepoint = val.into_rust();
825 /// The first to-be-broadcast-by-sender transaction's per commitment point
827 pub extern "C" fn AcceptChannel_get_first_per_commitment_point(this_ptr: &AcceptChannel) -> crate::c_types::PublicKey {
828 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.first_per_commitment_point;
829 crate::c_types::PublicKey::from_rust(&(*inner_val))
831 /// The first to-be-broadcast-by-sender transaction's per commitment point
833 pub extern "C" fn AcceptChannel_set_first_per_commitment_point(this_ptr: &mut AcceptChannel, mut val: crate::c_types::PublicKey) {
834 unsafe { &mut *this_ptr.inner }.first_per_commitment_point = val.into_rust();
836 impl Clone for AcceptChannel {
837 fn clone(&self) -> Self {
839 inner: if self.inner.is_null() { std::ptr::null_mut() } else {
840 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
846 /// Used only if an object of this type is returned as a trait impl by a method
847 pub(crate) extern "C" fn AcceptChannel_clone_void(this_ptr: *const c_void) -> *mut c_void {
848 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeAcceptChannel)).clone() })) as *mut c_void
851 pub extern "C" fn AcceptChannel_clone(orig: &AcceptChannel) -> AcceptChannel {
855 use lightning::ln::msgs::FundingCreated as nativeFundingCreatedImport;
856 type nativeFundingCreated = nativeFundingCreatedImport;
858 /// A funding_created message to be sent or received from a peer
861 pub struct FundingCreated {
862 /// Nearly everywhere, inner must be non-null, however in places where
863 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
864 pub inner: *mut nativeFundingCreated,
868 impl Drop for FundingCreated {
870 if self.is_owned && !self.inner.is_null() {
871 let _ = unsafe { Box::from_raw(self.inner) };
876 pub extern "C" fn FundingCreated_free(this_ptr: FundingCreated) { }
878 /// Used only if an object of this type is returned as a trait impl by a method
879 extern "C" fn FundingCreated_free_void(this_ptr: *mut c_void) {
880 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeFundingCreated); }
883 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
884 impl FundingCreated {
885 pub(crate) fn take_inner(mut self) -> *mut nativeFundingCreated {
886 assert!(self.is_owned);
887 let ret = self.inner;
888 self.inner = std::ptr::null_mut();
892 /// A temporary channel ID, until the funding is established
894 pub extern "C" fn FundingCreated_get_temporary_channel_id(this_ptr: &FundingCreated) -> *const [u8; 32] {
895 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.temporary_channel_id;
898 /// A temporary channel ID, until the funding is established
900 pub extern "C" fn FundingCreated_set_temporary_channel_id(this_ptr: &mut FundingCreated, mut val: crate::c_types::ThirtyTwoBytes) {
901 unsafe { &mut *this_ptr.inner }.temporary_channel_id = val.data;
903 /// The funding transaction ID
905 pub extern "C" fn FundingCreated_get_funding_txid(this_ptr: &FundingCreated) -> *const [u8; 32] {
906 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.funding_txid;
907 (*inner_val).as_inner()
909 /// The funding transaction ID
911 pub extern "C" fn FundingCreated_set_funding_txid(this_ptr: &mut FundingCreated, mut val: crate::c_types::ThirtyTwoBytes) {
912 unsafe { &mut *this_ptr.inner }.funding_txid = ::bitcoin::hash_types::Txid::from_slice(&val.data[..]).unwrap();
914 /// The specific output index funding this channel
916 pub extern "C" fn FundingCreated_get_funding_output_index(this_ptr: &FundingCreated) -> u16 {
917 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.funding_output_index;
920 /// The specific output index funding this channel
922 pub extern "C" fn FundingCreated_set_funding_output_index(this_ptr: &mut FundingCreated, mut val: u16) {
923 unsafe { &mut *this_ptr.inner }.funding_output_index = val;
925 /// The signature of the channel initiator (funder) on the funding transaction
927 pub extern "C" fn FundingCreated_get_signature(this_ptr: &FundingCreated) -> crate::c_types::Signature {
928 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.signature;
929 crate::c_types::Signature::from_rust(&(*inner_val))
931 /// The signature of the channel initiator (funder) on the funding transaction
933 pub extern "C" fn FundingCreated_set_signature(this_ptr: &mut FundingCreated, mut val: crate::c_types::Signature) {
934 unsafe { &mut *this_ptr.inner }.signature = val.into_rust();
938 pub extern "C" fn FundingCreated_new(mut temporary_channel_id_arg: crate::c_types::ThirtyTwoBytes, mut funding_txid_arg: crate::c_types::ThirtyTwoBytes, mut funding_output_index_arg: u16, mut signature_arg: crate::c_types::Signature) -> FundingCreated {
939 FundingCreated { inner: Box::into_raw(Box::new(nativeFundingCreated {
940 temporary_channel_id: temporary_channel_id_arg.data,
941 funding_txid: ::bitcoin::hash_types::Txid::from_slice(&funding_txid_arg.data[..]).unwrap(),
942 funding_output_index: funding_output_index_arg,
943 signature: signature_arg.into_rust(),
944 })), is_owned: true }
946 impl Clone for FundingCreated {
947 fn clone(&self) -> Self {
949 inner: if self.inner.is_null() { std::ptr::null_mut() } else {
950 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
956 /// Used only if an object of this type is returned as a trait impl by a method
957 pub(crate) extern "C" fn FundingCreated_clone_void(this_ptr: *const c_void) -> *mut c_void {
958 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeFundingCreated)).clone() })) as *mut c_void
961 pub extern "C" fn FundingCreated_clone(orig: &FundingCreated) -> FundingCreated {
965 use lightning::ln::msgs::FundingSigned as nativeFundingSignedImport;
966 type nativeFundingSigned = nativeFundingSignedImport;
968 /// A funding_signed message to be sent or received from a peer
971 pub struct FundingSigned {
972 /// Nearly everywhere, inner must be non-null, however in places where
973 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
974 pub inner: *mut nativeFundingSigned,
978 impl Drop for FundingSigned {
980 if self.is_owned && !self.inner.is_null() {
981 let _ = unsafe { Box::from_raw(self.inner) };
986 pub extern "C" fn FundingSigned_free(this_ptr: FundingSigned) { }
988 /// Used only if an object of this type is returned as a trait impl by a method
989 extern "C" fn FundingSigned_free_void(this_ptr: *mut c_void) {
990 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeFundingSigned); }
993 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
995 pub(crate) fn take_inner(mut self) -> *mut nativeFundingSigned {
996 assert!(self.is_owned);
997 let ret = self.inner;
998 self.inner = std::ptr::null_mut();
1004 pub extern "C" fn FundingSigned_get_channel_id(this_ptr: &FundingSigned) -> *const [u8; 32] {
1005 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_id;
1010 pub extern "C" fn FundingSigned_set_channel_id(this_ptr: &mut FundingSigned, mut val: crate::c_types::ThirtyTwoBytes) {
1011 unsafe { &mut *this_ptr.inner }.channel_id = val.data;
1013 /// The signature of the channel acceptor (fundee) on the funding transaction
1015 pub extern "C" fn FundingSigned_get_signature(this_ptr: &FundingSigned) -> crate::c_types::Signature {
1016 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.signature;
1017 crate::c_types::Signature::from_rust(&(*inner_val))
1019 /// The signature of the channel acceptor (fundee) on the funding transaction
1021 pub extern "C" fn FundingSigned_set_signature(this_ptr: &mut FundingSigned, mut val: crate::c_types::Signature) {
1022 unsafe { &mut *this_ptr.inner }.signature = val.into_rust();
1026 pub extern "C" fn FundingSigned_new(mut channel_id_arg: crate::c_types::ThirtyTwoBytes, mut signature_arg: crate::c_types::Signature) -> FundingSigned {
1027 FundingSigned { inner: Box::into_raw(Box::new(nativeFundingSigned {
1028 channel_id: channel_id_arg.data,
1029 signature: signature_arg.into_rust(),
1030 })), is_owned: true }
1032 impl Clone for FundingSigned {
1033 fn clone(&self) -> Self {
1035 inner: if self.inner.is_null() { std::ptr::null_mut() } else {
1036 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
1042 /// Used only if an object of this type is returned as a trait impl by a method
1043 pub(crate) extern "C" fn FundingSigned_clone_void(this_ptr: *const c_void) -> *mut c_void {
1044 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeFundingSigned)).clone() })) as *mut c_void
1047 pub extern "C" fn FundingSigned_clone(orig: &FundingSigned) -> FundingSigned {
1051 use lightning::ln::msgs::FundingLocked as nativeFundingLockedImport;
1052 type nativeFundingLocked = nativeFundingLockedImport;
1054 /// A funding_locked message to be sent or received from a peer
1057 pub struct FundingLocked {
1058 /// Nearly everywhere, inner must be non-null, however in places where
1059 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
1060 pub inner: *mut nativeFundingLocked,
1064 impl Drop for FundingLocked {
1065 fn drop(&mut self) {
1066 if self.is_owned && !self.inner.is_null() {
1067 let _ = unsafe { Box::from_raw(self.inner) };
1072 pub extern "C" fn FundingLocked_free(this_ptr: FundingLocked) { }
1074 /// Used only if an object of this type is returned as a trait impl by a method
1075 extern "C" fn FundingLocked_free_void(this_ptr: *mut c_void) {
1076 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeFundingLocked); }
1079 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
1080 impl FundingLocked {
1081 pub(crate) fn take_inner(mut self) -> *mut nativeFundingLocked {
1082 assert!(self.is_owned);
1083 let ret = self.inner;
1084 self.inner = std::ptr::null_mut();
1090 pub extern "C" fn FundingLocked_get_channel_id(this_ptr: &FundingLocked) -> *const [u8; 32] {
1091 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_id;
1096 pub extern "C" fn FundingLocked_set_channel_id(this_ptr: &mut FundingLocked, mut val: crate::c_types::ThirtyTwoBytes) {
1097 unsafe { &mut *this_ptr.inner }.channel_id = val.data;
1099 /// The per-commitment point of the second commitment transaction
1101 pub extern "C" fn FundingLocked_get_next_per_commitment_point(this_ptr: &FundingLocked) -> crate::c_types::PublicKey {
1102 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.next_per_commitment_point;
1103 crate::c_types::PublicKey::from_rust(&(*inner_val))
1105 /// The per-commitment point of the second commitment transaction
1107 pub extern "C" fn FundingLocked_set_next_per_commitment_point(this_ptr: &mut FundingLocked, mut val: crate::c_types::PublicKey) {
1108 unsafe { &mut *this_ptr.inner }.next_per_commitment_point = val.into_rust();
1112 pub extern "C" fn FundingLocked_new(mut channel_id_arg: crate::c_types::ThirtyTwoBytes, mut next_per_commitment_point_arg: crate::c_types::PublicKey) -> FundingLocked {
1113 FundingLocked { inner: Box::into_raw(Box::new(nativeFundingLocked {
1114 channel_id: channel_id_arg.data,
1115 next_per_commitment_point: next_per_commitment_point_arg.into_rust(),
1116 })), is_owned: true }
1118 impl Clone for FundingLocked {
1119 fn clone(&self) -> Self {
1121 inner: if self.inner.is_null() { std::ptr::null_mut() } else {
1122 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
1128 /// Used only if an object of this type is returned as a trait impl by a method
1129 pub(crate) extern "C" fn FundingLocked_clone_void(this_ptr: *const c_void) -> *mut c_void {
1130 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeFundingLocked)).clone() })) as *mut c_void
1133 pub extern "C" fn FundingLocked_clone(orig: &FundingLocked) -> FundingLocked {
1137 use lightning::ln::msgs::Shutdown as nativeShutdownImport;
1138 type nativeShutdown = nativeShutdownImport;
1140 /// A shutdown message to be sent or received from a peer
1143 pub struct Shutdown {
1144 /// Nearly everywhere, inner must be non-null, however in places where
1145 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
1146 pub inner: *mut nativeShutdown,
1150 impl Drop for Shutdown {
1151 fn drop(&mut self) {
1152 if self.is_owned && !self.inner.is_null() {
1153 let _ = unsafe { Box::from_raw(self.inner) };
1158 pub extern "C" fn Shutdown_free(this_ptr: Shutdown) { }
1160 /// Used only if an object of this type is returned as a trait impl by a method
1161 extern "C" fn Shutdown_free_void(this_ptr: *mut c_void) {
1162 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeShutdown); }
1165 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
1167 pub(crate) fn take_inner(mut self) -> *mut nativeShutdown {
1168 assert!(self.is_owned);
1169 let ret = self.inner;
1170 self.inner = std::ptr::null_mut();
1176 pub extern "C" fn Shutdown_get_channel_id(this_ptr: &Shutdown) -> *const [u8; 32] {
1177 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_id;
1182 pub extern "C" fn Shutdown_set_channel_id(this_ptr: &mut Shutdown, mut val: crate::c_types::ThirtyTwoBytes) {
1183 unsafe { &mut *this_ptr.inner }.channel_id = val.data;
1185 /// The destination of this peer's funds on closing.
1186 /// Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
1188 pub extern "C" fn Shutdown_get_scriptpubkey(this_ptr: &Shutdown) -> crate::c_types::u8slice {
1189 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.scriptpubkey;
1190 crate::c_types::u8slice::from_slice(&(*inner_val)[..])
1192 /// The destination of this peer's funds on closing.
1193 /// Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
1195 pub extern "C" fn Shutdown_set_scriptpubkey(this_ptr: &mut Shutdown, mut val: crate::c_types::derived::CVec_u8Z) {
1196 unsafe { &mut *this_ptr.inner }.scriptpubkey = ::bitcoin::blockdata::script::Script::from(val.into_rust());
1200 pub extern "C" fn Shutdown_new(mut channel_id_arg: crate::c_types::ThirtyTwoBytes, mut scriptpubkey_arg: crate::c_types::derived::CVec_u8Z) -> Shutdown {
1201 Shutdown { inner: Box::into_raw(Box::new(nativeShutdown {
1202 channel_id: channel_id_arg.data,
1203 scriptpubkey: ::bitcoin::blockdata::script::Script::from(scriptpubkey_arg.into_rust()),
1204 })), is_owned: true }
1206 impl Clone for Shutdown {
1207 fn clone(&self) -> Self {
1209 inner: if self.inner.is_null() { std::ptr::null_mut() } else {
1210 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
1216 /// Used only if an object of this type is returned as a trait impl by a method
1217 pub(crate) extern "C" fn Shutdown_clone_void(this_ptr: *const c_void) -> *mut c_void {
1218 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeShutdown)).clone() })) as *mut c_void
1221 pub extern "C" fn Shutdown_clone(orig: &Shutdown) -> Shutdown {
1225 use lightning::ln::msgs::ClosingSigned as nativeClosingSignedImport;
1226 type nativeClosingSigned = nativeClosingSignedImport;
1228 /// A closing_signed message to be sent or received from a peer
1231 pub struct ClosingSigned {
1232 /// Nearly everywhere, inner must be non-null, however in places where
1233 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
1234 pub inner: *mut nativeClosingSigned,
1238 impl Drop for ClosingSigned {
1239 fn drop(&mut self) {
1240 if self.is_owned && !self.inner.is_null() {
1241 let _ = unsafe { Box::from_raw(self.inner) };
1246 pub extern "C" fn ClosingSigned_free(this_ptr: ClosingSigned) { }
1248 /// Used only if an object of this type is returned as a trait impl by a method
1249 extern "C" fn ClosingSigned_free_void(this_ptr: *mut c_void) {
1250 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeClosingSigned); }
1253 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
1254 impl ClosingSigned {
1255 pub(crate) fn take_inner(mut self) -> *mut nativeClosingSigned {
1256 assert!(self.is_owned);
1257 let ret = self.inner;
1258 self.inner = std::ptr::null_mut();
1264 pub extern "C" fn ClosingSigned_get_channel_id(this_ptr: &ClosingSigned) -> *const [u8; 32] {
1265 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_id;
1270 pub extern "C" fn ClosingSigned_set_channel_id(this_ptr: &mut ClosingSigned, mut val: crate::c_types::ThirtyTwoBytes) {
1271 unsafe { &mut *this_ptr.inner }.channel_id = val.data;
1273 /// The proposed total fee for the closing transaction
1275 pub extern "C" fn ClosingSigned_get_fee_satoshis(this_ptr: &ClosingSigned) -> u64 {
1276 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.fee_satoshis;
1279 /// The proposed total fee for the closing transaction
1281 pub extern "C" fn ClosingSigned_set_fee_satoshis(this_ptr: &mut ClosingSigned, mut val: u64) {
1282 unsafe { &mut *this_ptr.inner }.fee_satoshis = val;
1284 /// A signature on the closing transaction
1286 pub extern "C" fn ClosingSigned_get_signature(this_ptr: &ClosingSigned) -> crate::c_types::Signature {
1287 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.signature;
1288 crate::c_types::Signature::from_rust(&(*inner_val))
1290 /// A signature on the closing transaction
1292 pub extern "C" fn ClosingSigned_set_signature(this_ptr: &mut ClosingSigned, mut val: crate::c_types::Signature) {
1293 unsafe { &mut *this_ptr.inner }.signature = val.into_rust();
1297 pub extern "C" fn ClosingSigned_new(mut channel_id_arg: crate::c_types::ThirtyTwoBytes, mut fee_satoshis_arg: u64, mut signature_arg: crate::c_types::Signature) -> ClosingSigned {
1298 ClosingSigned { inner: Box::into_raw(Box::new(nativeClosingSigned {
1299 channel_id: channel_id_arg.data,
1300 fee_satoshis: fee_satoshis_arg,
1301 signature: signature_arg.into_rust(),
1302 })), is_owned: true }
1304 impl Clone for ClosingSigned {
1305 fn clone(&self) -> Self {
1307 inner: if self.inner.is_null() { std::ptr::null_mut() } else {
1308 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
1314 /// Used only if an object of this type is returned as a trait impl by a method
1315 pub(crate) extern "C" fn ClosingSigned_clone_void(this_ptr: *const c_void) -> *mut c_void {
1316 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeClosingSigned)).clone() })) as *mut c_void
1319 pub extern "C" fn ClosingSigned_clone(orig: &ClosingSigned) -> ClosingSigned {
1323 use lightning::ln::msgs::UpdateAddHTLC as nativeUpdateAddHTLCImport;
1324 type nativeUpdateAddHTLC = nativeUpdateAddHTLCImport;
1326 /// An update_add_htlc message to be sent or received from a peer
1329 pub struct UpdateAddHTLC {
1330 /// Nearly everywhere, inner must be non-null, however in places where
1331 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
1332 pub inner: *mut nativeUpdateAddHTLC,
1336 impl Drop for UpdateAddHTLC {
1337 fn drop(&mut self) {
1338 if self.is_owned && !self.inner.is_null() {
1339 let _ = unsafe { Box::from_raw(self.inner) };
1344 pub extern "C" fn UpdateAddHTLC_free(this_ptr: UpdateAddHTLC) { }
1346 /// Used only if an object of this type is returned as a trait impl by a method
1347 extern "C" fn UpdateAddHTLC_free_void(this_ptr: *mut c_void) {
1348 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeUpdateAddHTLC); }
1351 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
1352 impl UpdateAddHTLC {
1353 pub(crate) fn take_inner(mut self) -> *mut nativeUpdateAddHTLC {
1354 assert!(self.is_owned);
1355 let ret = self.inner;
1356 self.inner = std::ptr::null_mut();
1362 pub extern "C" fn UpdateAddHTLC_get_channel_id(this_ptr: &UpdateAddHTLC) -> *const [u8; 32] {
1363 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_id;
1368 pub extern "C" fn UpdateAddHTLC_set_channel_id(this_ptr: &mut UpdateAddHTLC, mut val: crate::c_types::ThirtyTwoBytes) {
1369 unsafe { &mut *this_ptr.inner }.channel_id = val.data;
1373 pub extern "C" fn UpdateAddHTLC_get_htlc_id(this_ptr: &UpdateAddHTLC) -> u64 {
1374 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.htlc_id;
1379 pub extern "C" fn UpdateAddHTLC_set_htlc_id(this_ptr: &mut UpdateAddHTLC, mut val: u64) {
1380 unsafe { &mut *this_ptr.inner }.htlc_id = val;
1382 /// The HTLC value in milli-satoshi
1384 pub extern "C" fn UpdateAddHTLC_get_amount_msat(this_ptr: &UpdateAddHTLC) -> u64 {
1385 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.amount_msat;
1388 /// The HTLC value in milli-satoshi
1390 pub extern "C" fn UpdateAddHTLC_set_amount_msat(this_ptr: &mut UpdateAddHTLC, mut val: u64) {
1391 unsafe { &mut *this_ptr.inner }.amount_msat = val;
1393 /// The payment hash, the pre-image of which controls HTLC redemption
1395 pub extern "C" fn UpdateAddHTLC_get_payment_hash(this_ptr: &UpdateAddHTLC) -> *const [u8; 32] {
1396 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.payment_hash;
1399 /// The payment hash, the pre-image of which controls HTLC redemption
1401 pub extern "C" fn UpdateAddHTLC_set_payment_hash(this_ptr: &mut UpdateAddHTLC, mut val: crate::c_types::ThirtyTwoBytes) {
1402 unsafe { &mut *this_ptr.inner }.payment_hash = ::lightning::ln::channelmanager::PaymentHash(val.data);
1404 /// The expiry height of the HTLC
1406 pub extern "C" fn UpdateAddHTLC_get_cltv_expiry(this_ptr: &UpdateAddHTLC) -> u32 {
1407 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.cltv_expiry;
1410 /// The expiry height of the HTLC
1412 pub extern "C" fn UpdateAddHTLC_set_cltv_expiry(this_ptr: &mut UpdateAddHTLC, mut val: u32) {
1413 unsafe { &mut *this_ptr.inner }.cltv_expiry = val;
1415 impl Clone for UpdateAddHTLC {
1416 fn clone(&self) -> Self {
1418 inner: if self.inner.is_null() { std::ptr::null_mut() } else {
1419 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
1425 /// Used only if an object of this type is returned as a trait impl by a method
1426 pub(crate) extern "C" fn UpdateAddHTLC_clone_void(this_ptr: *const c_void) -> *mut c_void {
1427 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeUpdateAddHTLC)).clone() })) as *mut c_void
1430 pub extern "C" fn UpdateAddHTLC_clone(orig: &UpdateAddHTLC) -> UpdateAddHTLC {
1434 use lightning::ln::msgs::UpdateFulfillHTLC as nativeUpdateFulfillHTLCImport;
1435 type nativeUpdateFulfillHTLC = nativeUpdateFulfillHTLCImport;
1437 /// An update_fulfill_htlc message to be sent or received from a peer
1440 pub struct UpdateFulfillHTLC {
1441 /// Nearly everywhere, inner must be non-null, however in places where
1442 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
1443 pub inner: *mut nativeUpdateFulfillHTLC,
1447 impl Drop for UpdateFulfillHTLC {
1448 fn drop(&mut self) {
1449 if self.is_owned && !self.inner.is_null() {
1450 let _ = unsafe { Box::from_raw(self.inner) };
1455 pub extern "C" fn UpdateFulfillHTLC_free(this_ptr: UpdateFulfillHTLC) { }
1457 /// Used only if an object of this type is returned as a trait impl by a method
1458 extern "C" fn UpdateFulfillHTLC_free_void(this_ptr: *mut c_void) {
1459 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeUpdateFulfillHTLC); }
1462 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
1463 impl UpdateFulfillHTLC {
1464 pub(crate) fn take_inner(mut self) -> *mut nativeUpdateFulfillHTLC {
1465 assert!(self.is_owned);
1466 let ret = self.inner;
1467 self.inner = std::ptr::null_mut();
1473 pub extern "C" fn UpdateFulfillHTLC_get_channel_id(this_ptr: &UpdateFulfillHTLC) -> *const [u8; 32] {
1474 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_id;
1479 pub extern "C" fn UpdateFulfillHTLC_set_channel_id(this_ptr: &mut UpdateFulfillHTLC, mut val: crate::c_types::ThirtyTwoBytes) {
1480 unsafe { &mut *this_ptr.inner }.channel_id = val.data;
1484 pub extern "C" fn UpdateFulfillHTLC_get_htlc_id(this_ptr: &UpdateFulfillHTLC) -> u64 {
1485 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.htlc_id;
1490 pub extern "C" fn UpdateFulfillHTLC_set_htlc_id(this_ptr: &mut UpdateFulfillHTLC, mut val: u64) {
1491 unsafe { &mut *this_ptr.inner }.htlc_id = val;
1493 /// The pre-image of the payment hash, allowing HTLC redemption
1495 pub extern "C" fn UpdateFulfillHTLC_get_payment_preimage(this_ptr: &UpdateFulfillHTLC) -> *const [u8; 32] {
1496 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.payment_preimage;
1499 /// The pre-image of the payment hash, allowing HTLC redemption
1501 pub extern "C" fn UpdateFulfillHTLC_set_payment_preimage(this_ptr: &mut UpdateFulfillHTLC, mut val: crate::c_types::ThirtyTwoBytes) {
1502 unsafe { &mut *this_ptr.inner }.payment_preimage = ::lightning::ln::channelmanager::PaymentPreimage(val.data);
1506 pub extern "C" fn UpdateFulfillHTLC_new(mut channel_id_arg: crate::c_types::ThirtyTwoBytes, mut htlc_id_arg: u64, mut payment_preimage_arg: crate::c_types::ThirtyTwoBytes) -> UpdateFulfillHTLC {
1507 UpdateFulfillHTLC { inner: Box::into_raw(Box::new(nativeUpdateFulfillHTLC {
1508 channel_id: channel_id_arg.data,
1509 htlc_id: htlc_id_arg,
1510 payment_preimage: ::lightning::ln::channelmanager::PaymentPreimage(payment_preimage_arg.data),
1511 })), is_owned: true }
1513 impl Clone for UpdateFulfillHTLC {
1514 fn clone(&self) -> Self {
1516 inner: if self.inner.is_null() { std::ptr::null_mut() } else {
1517 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
1523 /// Used only if an object of this type is returned as a trait impl by a method
1524 pub(crate) extern "C" fn UpdateFulfillHTLC_clone_void(this_ptr: *const c_void) -> *mut c_void {
1525 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeUpdateFulfillHTLC)).clone() })) as *mut c_void
1528 pub extern "C" fn UpdateFulfillHTLC_clone(orig: &UpdateFulfillHTLC) -> UpdateFulfillHTLC {
1532 use lightning::ln::msgs::UpdateFailHTLC as nativeUpdateFailHTLCImport;
1533 type nativeUpdateFailHTLC = nativeUpdateFailHTLCImport;
1535 /// An update_fail_htlc message to be sent or received from a peer
1538 pub struct UpdateFailHTLC {
1539 /// Nearly everywhere, inner must be non-null, however in places where
1540 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
1541 pub inner: *mut nativeUpdateFailHTLC,
1545 impl Drop for UpdateFailHTLC {
1546 fn drop(&mut self) {
1547 if self.is_owned && !self.inner.is_null() {
1548 let _ = unsafe { Box::from_raw(self.inner) };
1553 pub extern "C" fn UpdateFailHTLC_free(this_ptr: UpdateFailHTLC) { }
1555 /// Used only if an object of this type is returned as a trait impl by a method
1556 extern "C" fn UpdateFailHTLC_free_void(this_ptr: *mut c_void) {
1557 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeUpdateFailHTLC); }
1560 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
1561 impl UpdateFailHTLC {
1562 pub(crate) fn take_inner(mut self) -> *mut nativeUpdateFailHTLC {
1563 assert!(self.is_owned);
1564 let ret = self.inner;
1565 self.inner = std::ptr::null_mut();
1571 pub extern "C" fn UpdateFailHTLC_get_channel_id(this_ptr: &UpdateFailHTLC) -> *const [u8; 32] {
1572 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_id;
1577 pub extern "C" fn UpdateFailHTLC_set_channel_id(this_ptr: &mut UpdateFailHTLC, mut val: crate::c_types::ThirtyTwoBytes) {
1578 unsafe { &mut *this_ptr.inner }.channel_id = val.data;
1582 pub extern "C" fn UpdateFailHTLC_get_htlc_id(this_ptr: &UpdateFailHTLC) -> u64 {
1583 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.htlc_id;
1588 pub extern "C" fn UpdateFailHTLC_set_htlc_id(this_ptr: &mut UpdateFailHTLC, mut val: u64) {
1589 unsafe { &mut *this_ptr.inner }.htlc_id = val;
1591 impl Clone for UpdateFailHTLC {
1592 fn clone(&self) -> Self {
1594 inner: if self.inner.is_null() { std::ptr::null_mut() } else {
1595 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
1601 /// Used only if an object of this type is returned as a trait impl by a method
1602 pub(crate) extern "C" fn UpdateFailHTLC_clone_void(this_ptr: *const c_void) -> *mut c_void {
1603 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeUpdateFailHTLC)).clone() })) as *mut c_void
1606 pub extern "C" fn UpdateFailHTLC_clone(orig: &UpdateFailHTLC) -> UpdateFailHTLC {
1610 use lightning::ln::msgs::UpdateFailMalformedHTLC as nativeUpdateFailMalformedHTLCImport;
1611 type nativeUpdateFailMalformedHTLC = nativeUpdateFailMalformedHTLCImport;
1613 /// An update_fail_malformed_htlc message to be sent or received from a peer
1616 pub struct UpdateFailMalformedHTLC {
1617 /// Nearly everywhere, inner must be non-null, however in places where
1618 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
1619 pub inner: *mut nativeUpdateFailMalformedHTLC,
1623 impl Drop for UpdateFailMalformedHTLC {
1624 fn drop(&mut self) {
1625 if self.is_owned && !self.inner.is_null() {
1626 let _ = unsafe { Box::from_raw(self.inner) };
1631 pub extern "C" fn UpdateFailMalformedHTLC_free(this_ptr: UpdateFailMalformedHTLC) { }
1633 /// Used only if an object of this type is returned as a trait impl by a method
1634 extern "C" fn UpdateFailMalformedHTLC_free_void(this_ptr: *mut c_void) {
1635 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeUpdateFailMalformedHTLC); }
1638 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
1639 impl UpdateFailMalformedHTLC {
1640 pub(crate) fn take_inner(mut self) -> *mut nativeUpdateFailMalformedHTLC {
1641 assert!(self.is_owned);
1642 let ret = self.inner;
1643 self.inner = std::ptr::null_mut();
1649 pub extern "C" fn UpdateFailMalformedHTLC_get_channel_id(this_ptr: &UpdateFailMalformedHTLC) -> *const [u8; 32] {
1650 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_id;
1655 pub extern "C" fn UpdateFailMalformedHTLC_set_channel_id(this_ptr: &mut UpdateFailMalformedHTLC, mut val: crate::c_types::ThirtyTwoBytes) {
1656 unsafe { &mut *this_ptr.inner }.channel_id = val.data;
1660 pub extern "C" fn UpdateFailMalformedHTLC_get_htlc_id(this_ptr: &UpdateFailMalformedHTLC) -> u64 {
1661 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.htlc_id;
1666 pub extern "C" fn UpdateFailMalformedHTLC_set_htlc_id(this_ptr: &mut UpdateFailMalformedHTLC, mut val: u64) {
1667 unsafe { &mut *this_ptr.inner }.htlc_id = val;
1669 /// The failure code
1671 pub extern "C" fn UpdateFailMalformedHTLC_get_failure_code(this_ptr: &UpdateFailMalformedHTLC) -> u16 {
1672 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.failure_code;
1675 /// The failure code
1677 pub extern "C" fn UpdateFailMalformedHTLC_set_failure_code(this_ptr: &mut UpdateFailMalformedHTLC, mut val: u16) {
1678 unsafe { &mut *this_ptr.inner }.failure_code = val;
1680 impl Clone for UpdateFailMalformedHTLC {
1681 fn clone(&self) -> Self {
1683 inner: if self.inner.is_null() { std::ptr::null_mut() } else {
1684 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
1690 /// Used only if an object of this type is returned as a trait impl by a method
1691 pub(crate) extern "C" fn UpdateFailMalformedHTLC_clone_void(this_ptr: *const c_void) -> *mut c_void {
1692 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeUpdateFailMalformedHTLC)).clone() })) as *mut c_void
1695 pub extern "C" fn UpdateFailMalformedHTLC_clone(orig: &UpdateFailMalformedHTLC) -> UpdateFailMalformedHTLC {
1699 use lightning::ln::msgs::CommitmentSigned as nativeCommitmentSignedImport;
1700 type nativeCommitmentSigned = nativeCommitmentSignedImport;
1702 /// A commitment_signed message to be sent or received from a peer
1705 pub struct CommitmentSigned {
1706 /// Nearly everywhere, inner must be non-null, however in places where
1707 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
1708 pub inner: *mut nativeCommitmentSigned,
1712 impl Drop for CommitmentSigned {
1713 fn drop(&mut self) {
1714 if self.is_owned && !self.inner.is_null() {
1715 let _ = unsafe { Box::from_raw(self.inner) };
1720 pub extern "C" fn CommitmentSigned_free(this_ptr: CommitmentSigned) { }
1722 /// Used only if an object of this type is returned as a trait impl by a method
1723 extern "C" fn CommitmentSigned_free_void(this_ptr: *mut c_void) {
1724 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeCommitmentSigned); }
1727 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
1728 impl CommitmentSigned {
1729 pub(crate) fn take_inner(mut self) -> *mut nativeCommitmentSigned {
1730 assert!(self.is_owned);
1731 let ret = self.inner;
1732 self.inner = std::ptr::null_mut();
1738 pub extern "C" fn CommitmentSigned_get_channel_id(this_ptr: &CommitmentSigned) -> *const [u8; 32] {
1739 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_id;
1744 pub extern "C" fn CommitmentSigned_set_channel_id(this_ptr: &mut CommitmentSigned, mut val: crate::c_types::ThirtyTwoBytes) {
1745 unsafe { &mut *this_ptr.inner }.channel_id = val.data;
1747 /// A signature on the commitment transaction
1749 pub extern "C" fn CommitmentSigned_get_signature(this_ptr: &CommitmentSigned) -> crate::c_types::Signature {
1750 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.signature;
1751 crate::c_types::Signature::from_rust(&(*inner_val))
1753 /// A signature on the commitment transaction
1755 pub extern "C" fn CommitmentSigned_set_signature(this_ptr: &mut CommitmentSigned, mut val: crate::c_types::Signature) {
1756 unsafe { &mut *this_ptr.inner }.signature = val.into_rust();
1758 /// Signatures on the HTLC transactions
1760 pub extern "C" fn CommitmentSigned_set_htlc_signatures(this_ptr: &mut CommitmentSigned, mut val: crate::c_types::derived::CVec_SignatureZ) {
1761 let mut local_val = Vec::new(); for mut item in val.into_rust().drain(..) { local_val.push( { item.into_rust() }); };
1762 unsafe { &mut *this_ptr.inner }.htlc_signatures = local_val;
1766 pub extern "C" fn CommitmentSigned_new(mut channel_id_arg: crate::c_types::ThirtyTwoBytes, mut signature_arg: crate::c_types::Signature, mut htlc_signatures_arg: crate::c_types::derived::CVec_SignatureZ) -> CommitmentSigned {
1767 let mut local_htlc_signatures_arg = Vec::new(); for mut item in htlc_signatures_arg.into_rust().drain(..) { local_htlc_signatures_arg.push( { item.into_rust() }); };
1768 CommitmentSigned { inner: Box::into_raw(Box::new(nativeCommitmentSigned {
1769 channel_id: channel_id_arg.data,
1770 signature: signature_arg.into_rust(),
1771 htlc_signatures: local_htlc_signatures_arg,
1772 })), is_owned: true }
1774 impl Clone for CommitmentSigned {
1775 fn clone(&self) -> Self {
1777 inner: if self.inner.is_null() { std::ptr::null_mut() } else {
1778 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
1784 /// Used only if an object of this type is returned as a trait impl by a method
1785 pub(crate) extern "C" fn CommitmentSigned_clone_void(this_ptr: *const c_void) -> *mut c_void {
1786 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeCommitmentSigned)).clone() })) as *mut c_void
1789 pub extern "C" fn CommitmentSigned_clone(orig: &CommitmentSigned) -> CommitmentSigned {
1793 use lightning::ln::msgs::RevokeAndACK as nativeRevokeAndACKImport;
1794 type nativeRevokeAndACK = nativeRevokeAndACKImport;
1796 /// A revoke_and_ack message to be sent or received from a peer
1799 pub struct RevokeAndACK {
1800 /// Nearly everywhere, inner must be non-null, however in places where
1801 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
1802 pub inner: *mut nativeRevokeAndACK,
1806 impl Drop for RevokeAndACK {
1807 fn drop(&mut self) {
1808 if self.is_owned && !self.inner.is_null() {
1809 let _ = unsafe { Box::from_raw(self.inner) };
1814 pub extern "C" fn RevokeAndACK_free(this_ptr: RevokeAndACK) { }
1816 /// Used only if an object of this type is returned as a trait impl by a method
1817 extern "C" fn RevokeAndACK_free_void(this_ptr: *mut c_void) {
1818 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeRevokeAndACK); }
1821 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
1823 pub(crate) fn take_inner(mut self) -> *mut nativeRevokeAndACK {
1824 assert!(self.is_owned);
1825 let ret = self.inner;
1826 self.inner = std::ptr::null_mut();
1832 pub extern "C" fn RevokeAndACK_get_channel_id(this_ptr: &RevokeAndACK) -> *const [u8; 32] {
1833 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_id;
1838 pub extern "C" fn RevokeAndACK_set_channel_id(this_ptr: &mut RevokeAndACK, mut val: crate::c_types::ThirtyTwoBytes) {
1839 unsafe { &mut *this_ptr.inner }.channel_id = val.data;
1841 /// The secret corresponding to the per-commitment point
1843 pub extern "C" fn RevokeAndACK_get_per_commitment_secret(this_ptr: &RevokeAndACK) -> *const [u8; 32] {
1844 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.per_commitment_secret;
1847 /// The secret corresponding to the per-commitment point
1849 pub extern "C" fn RevokeAndACK_set_per_commitment_secret(this_ptr: &mut RevokeAndACK, mut val: crate::c_types::ThirtyTwoBytes) {
1850 unsafe { &mut *this_ptr.inner }.per_commitment_secret = val.data;
1852 /// The next sender-broadcast commitment transaction's per-commitment point
1854 pub extern "C" fn RevokeAndACK_get_next_per_commitment_point(this_ptr: &RevokeAndACK) -> crate::c_types::PublicKey {
1855 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.next_per_commitment_point;
1856 crate::c_types::PublicKey::from_rust(&(*inner_val))
1858 /// The next sender-broadcast commitment transaction's per-commitment point
1860 pub extern "C" fn RevokeAndACK_set_next_per_commitment_point(this_ptr: &mut RevokeAndACK, mut val: crate::c_types::PublicKey) {
1861 unsafe { &mut *this_ptr.inner }.next_per_commitment_point = val.into_rust();
1865 pub extern "C" fn RevokeAndACK_new(mut channel_id_arg: crate::c_types::ThirtyTwoBytes, mut per_commitment_secret_arg: crate::c_types::ThirtyTwoBytes, mut next_per_commitment_point_arg: crate::c_types::PublicKey) -> RevokeAndACK {
1866 RevokeAndACK { inner: Box::into_raw(Box::new(nativeRevokeAndACK {
1867 channel_id: channel_id_arg.data,
1868 per_commitment_secret: per_commitment_secret_arg.data,
1869 next_per_commitment_point: next_per_commitment_point_arg.into_rust(),
1870 })), is_owned: true }
1872 impl Clone for RevokeAndACK {
1873 fn clone(&self) -> Self {
1875 inner: if self.inner.is_null() { std::ptr::null_mut() } else {
1876 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
1882 /// Used only if an object of this type is returned as a trait impl by a method
1883 pub(crate) extern "C" fn RevokeAndACK_clone_void(this_ptr: *const c_void) -> *mut c_void {
1884 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeRevokeAndACK)).clone() })) as *mut c_void
1887 pub extern "C" fn RevokeAndACK_clone(orig: &RevokeAndACK) -> RevokeAndACK {
1891 use lightning::ln::msgs::UpdateFee as nativeUpdateFeeImport;
1892 type nativeUpdateFee = nativeUpdateFeeImport;
1894 /// An update_fee message to be sent or received from a peer
1897 pub struct UpdateFee {
1898 /// Nearly everywhere, inner must be non-null, however in places where
1899 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
1900 pub inner: *mut nativeUpdateFee,
1904 impl Drop for UpdateFee {
1905 fn drop(&mut self) {
1906 if self.is_owned && !self.inner.is_null() {
1907 let _ = unsafe { Box::from_raw(self.inner) };
1912 pub extern "C" fn UpdateFee_free(this_ptr: UpdateFee) { }
1914 /// Used only if an object of this type is returned as a trait impl by a method
1915 extern "C" fn UpdateFee_free_void(this_ptr: *mut c_void) {
1916 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeUpdateFee); }
1919 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
1921 pub(crate) fn take_inner(mut self) -> *mut nativeUpdateFee {
1922 assert!(self.is_owned);
1923 let ret = self.inner;
1924 self.inner = std::ptr::null_mut();
1930 pub extern "C" fn UpdateFee_get_channel_id(this_ptr: &UpdateFee) -> *const [u8; 32] {
1931 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_id;
1936 pub extern "C" fn UpdateFee_set_channel_id(this_ptr: &mut UpdateFee, mut val: crate::c_types::ThirtyTwoBytes) {
1937 unsafe { &mut *this_ptr.inner }.channel_id = val.data;
1939 /// Fee rate per 1000-weight of the transaction
1941 pub extern "C" fn UpdateFee_get_feerate_per_kw(this_ptr: &UpdateFee) -> u32 {
1942 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.feerate_per_kw;
1945 /// Fee rate per 1000-weight of the transaction
1947 pub extern "C" fn UpdateFee_set_feerate_per_kw(this_ptr: &mut UpdateFee, mut val: u32) {
1948 unsafe { &mut *this_ptr.inner }.feerate_per_kw = val;
1952 pub extern "C" fn UpdateFee_new(mut channel_id_arg: crate::c_types::ThirtyTwoBytes, mut feerate_per_kw_arg: u32) -> UpdateFee {
1953 UpdateFee { inner: Box::into_raw(Box::new(nativeUpdateFee {
1954 channel_id: channel_id_arg.data,
1955 feerate_per_kw: feerate_per_kw_arg,
1956 })), is_owned: true }
1958 impl Clone for UpdateFee {
1959 fn clone(&self) -> Self {
1961 inner: if self.inner.is_null() { std::ptr::null_mut() } else {
1962 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
1968 /// Used only if an object of this type is returned as a trait impl by a method
1969 pub(crate) extern "C" fn UpdateFee_clone_void(this_ptr: *const c_void) -> *mut c_void {
1970 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeUpdateFee)).clone() })) as *mut c_void
1973 pub extern "C" fn UpdateFee_clone(orig: &UpdateFee) -> UpdateFee {
1977 use lightning::ln::msgs::DataLossProtect as nativeDataLossProtectImport;
1978 type nativeDataLossProtect = nativeDataLossProtectImport;
1980 /// Proof that the sender knows the per-commitment secret of the previous commitment transaction.
1981 /// This is used to convince the recipient that the channel is at a certain commitment
1982 /// number even if they lost that data due to a local failure. Of course, the peer may lie
1983 /// and even later commitments may have been revoked.
1986 pub struct DataLossProtect {
1987 /// Nearly everywhere, inner must be non-null, however in places where
1988 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
1989 pub inner: *mut nativeDataLossProtect,
1993 impl Drop for DataLossProtect {
1994 fn drop(&mut self) {
1995 if self.is_owned && !self.inner.is_null() {
1996 let _ = unsafe { Box::from_raw(self.inner) };
2001 pub extern "C" fn DataLossProtect_free(this_ptr: DataLossProtect) { }
2003 /// Used only if an object of this type is returned as a trait impl by a method
2004 extern "C" fn DataLossProtect_free_void(this_ptr: *mut c_void) {
2005 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeDataLossProtect); }
2008 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
2009 impl DataLossProtect {
2010 pub(crate) fn take_inner(mut self) -> *mut nativeDataLossProtect {
2011 assert!(self.is_owned);
2012 let ret = self.inner;
2013 self.inner = std::ptr::null_mut();
2017 /// Proof that the sender knows the per-commitment secret of a specific commitment transaction
2018 /// belonging to the recipient
2020 pub extern "C" fn DataLossProtect_get_your_last_per_commitment_secret(this_ptr: &DataLossProtect) -> *const [u8; 32] {
2021 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.your_last_per_commitment_secret;
2024 /// Proof that the sender knows the per-commitment secret of a specific commitment transaction
2025 /// belonging to the recipient
2027 pub extern "C" fn DataLossProtect_set_your_last_per_commitment_secret(this_ptr: &mut DataLossProtect, mut val: crate::c_types::ThirtyTwoBytes) {
2028 unsafe { &mut *this_ptr.inner }.your_last_per_commitment_secret = val.data;
2030 /// The sender's per-commitment point for their current commitment transaction
2032 pub extern "C" fn DataLossProtect_get_my_current_per_commitment_point(this_ptr: &DataLossProtect) -> crate::c_types::PublicKey {
2033 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.my_current_per_commitment_point;
2034 crate::c_types::PublicKey::from_rust(&(*inner_val))
2036 /// The sender's per-commitment point for their current commitment transaction
2038 pub extern "C" fn DataLossProtect_set_my_current_per_commitment_point(this_ptr: &mut DataLossProtect, mut val: crate::c_types::PublicKey) {
2039 unsafe { &mut *this_ptr.inner }.my_current_per_commitment_point = val.into_rust();
2043 pub extern "C" fn DataLossProtect_new(mut your_last_per_commitment_secret_arg: crate::c_types::ThirtyTwoBytes, mut my_current_per_commitment_point_arg: crate::c_types::PublicKey) -> DataLossProtect {
2044 DataLossProtect { inner: Box::into_raw(Box::new(nativeDataLossProtect {
2045 your_last_per_commitment_secret: your_last_per_commitment_secret_arg.data,
2046 my_current_per_commitment_point: my_current_per_commitment_point_arg.into_rust(),
2047 })), is_owned: true }
2049 impl Clone for DataLossProtect {
2050 fn clone(&self) -> Self {
2052 inner: if self.inner.is_null() { std::ptr::null_mut() } else {
2053 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
2059 /// Used only if an object of this type is returned as a trait impl by a method
2060 pub(crate) extern "C" fn DataLossProtect_clone_void(this_ptr: *const c_void) -> *mut c_void {
2061 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeDataLossProtect)).clone() })) as *mut c_void
2064 pub extern "C" fn DataLossProtect_clone(orig: &DataLossProtect) -> DataLossProtect {
2068 use lightning::ln::msgs::ChannelReestablish as nativeChannelReestablishImport;
2069 type nativeChannelReestablish = nativeChannelReestablishImport;
2071 /// A channel_reestablish message to be sent or received from a peer
2074 pub struct ChannelReestablish {
2075 /// Nearly everywhere, inner must be non-null, however in places where
2076 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
2077 pub inner: *mut nativeChannelReestablish,
2081 impl Drop for ChannelReestablish {
2082 fn drop(&mut self) {
2083 if self.is_owned && !self.inner.is_null() {
2084 let _ = unsafe { Box::from_raw(self.inner) };
2089 pub extern "C" fn ChannelReestablish_free(this_ptr: ChannelReestablish) { }
2091 /// Used only if an object of this type is returned as a trait impl by a method
2092 extern "C" fn ChannelReestablish_free_void(this_ptr: *mut c_void) {
2093 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeChannelReestablish); }
2096 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
2097 impl ChannelReestablish {
2098 pub(crate) fn take_inner(mut self) -> *mut nativeChannelReestablish {
2099 assert!(self.is_owned);
2100 let ret = self.inner;
2101 self.inner = std::ptr::null_mut();
2107 pub extern "C" fn ChannelReestablish_get_channel_id(this_ptr: &ChannelReestablish) -> *const [u8; 32] {
2108 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_id;
2113 pub extern "C" fn ChannelReestablish_set_channel_id(this_ptr: &mut ChannelReestablish, mut val: crate::c_types::ThirtyTwoBytes) {
2114 unsafe { &mut *this_ptr.inner }.channel_id = val.data;
2116 /// The next commitment number for the sender
2118 pub extern "C" fn ChannelReestablish_get_next_local_commitment_number(this_ptr: &ChannelReestablish) -> u64 {
2119 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.next_local_commitment_number;
2122 /// The next commitment number for the sender
2124 pub extern "C" fn ChannelReestablish_set_next_local_commitment_number(this_ptr: &mut ChannelReestablish, mut val: u64) {
2125 unsafe { &mut *this_ptr.inner }.next_local_commitment_number = val;
2127 /// The next commitment number for the recipient
2129 pub extern "C" fn ChannelReestablish_get_next_remote_commitment_number(this_ptr: &ChannelReestablish) -> u64 {
2130 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.next_remote_commitment_number;
2133 /// The next commitment number for the recipient
2135 pub extern "C" fn ChannelReestablish_set_next_remote_commitment_number(this_ptr: &mut ChannelReestablish, mut val: u64) {
2136 unsafe { &mut *this_ptr.inner }.next_remote_commitment_number = val;
2138 impl Clone for ChannelReestablish {
2139 fn clone(&self) -> Self {
2141 inner: if self.inner.is_null() { std::ptr::null_mut() } else {
2142 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
2148 /// Used only if an object of this type is returned as a trait impl by a method
2149 pub(crate) extern "C" fn ChannelReestablish_clone_void(this_ptr: *const c_void) -> *mut c_void {
2150 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeChannelReestablish)).clone() })) as *mut c_void
2153 pub extern "C" fn ChannelReestablish_clone(orig: &ChannelReestablish) -> ChannelReestablish {
2157 use lightning::ln::msgs::AnnouncementSignatures as nativeAnnouncementSignaturesImport;
2158 type nativeAnnouncementSignatures = nativeAnnouncementSignaturesImport;
2160 /// An announcement_signatures message to be sent or received from a peer
2163 pub struct AnnouncementSignatures {
2164 /// Nearly everywhere, inner must be non-null, however in places where
2165 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
2166 pub inner: *mut nativeAnnouncementSignatures,
2170 impl Drop for AnnouncementSignatures {
2171 fn drop(&mut self) {
2172 if self.is_owned && !self.inner.is_null() {
2173 let _ = unsafe { Box::from_raw(self.inner) };
2178 pub extern "C" fn AnnouncementSignatures_free(this_ptr: AnnouncementSignatures) { }
2180 /// Used only if an object of this type is returned as a trait impl by a method
2181 extern "C" fn AnnouncementSignatures_free_void(this_ptr: *mut c_void) {
2182 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeAnnouncementSignatures); }
2185 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
2186 impl AnnouncementSignatures {
2187 pub(crate) fn take_inner(mut self) -> *mut nativeAnnouncementSignatures {
2188 assert!(self.is_owned);
2189 let ret = self.inner;
2190 self.inner = std::ptr::null_mut();
2196 pub extern "C" fn AnnouncementSignatures_get_channel_id(this_ptr: &AnnouncementSignatures) -> *const [u8; 32] {
2197 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_id;
2202 pub extern "C" fn AnnouncementSignatures_set_channel_id(this_ptr: &mut AnnouncementSignatures, mut val: crate::c_types::ThirtyTwoBytes) {
2203 unsafe { &mut *this_ptr.inner }.channel_id = val.data;
2205 /// The short channel ID
2207 pub extern "C" fn AnnouncementSignatures_get_short_channel_id(this_ptr: &AnnouncementSignatures) -> u64 {
2208 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.short_channel_id;
2211 /// The short channel ID
2213 pub extern "C" fn AnnouncementSignatures_set_short_channel_id(this_ptr: &mut AnnouncementSignatures, mut val: u64) {
2214 unsafe { &mut *this_ptr.inner }.short_channel_id = val;
2216 /// A signature by the node key
2218 pub extern "C" fn AnnouncementSignatures_get_node_signature(this_ptr: &AnnouncementSignatures) -> crate::c_types::Signature {
2219 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.node_signature;
2220 crate::c_types::Signature::from_rust(&(*inner_val))
2222 /// A signature by the node key
2224 pub extern "C" fn AnnouncementSignatures_set_node_signature(this_ptr: &mut AnnouncementSignatures, mut val: crate::c_types::Signature) {
2225 unsafe { &mut *this_ptr.inner }.node_signature = val.into_rust();
2227 /// A signature by the funding key
2229 pub extern "C" fn AnnouncementSignatures_get_bitcoin_signature(this_ptr: &AnnouncementSignatures) -> crate::c_types::Signature {
2230 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.bitcoin_signature;
2231 crate::c_types::Signature::from_rust(&(*inner_val))
2233 /// A signature by the funding key
2235 pub extern "C" fn AnnouncementSignatures_set_bitcoin_signature(this_ptr: &mut AnnouncementSignatures, mut val: crate::c_types::Signature) {
2236 unsafe { &mut *this_ptr.inner }.bitcoin_signature = val.into_rust();
2240 pub extern "C" fn AnnouncementSignatures_new(mut channel_id_arg: crate::c_types::ThirtyTwoBytes, mut short_channel_id_arg: u64, mut node_signature_arg: crate::c_types::Signature, mut bitcoin_signature_arg: crate::c_types::Signature) -> AnnouncementSignatures {
2241 AnnouncementSignatures { inner: Box::into_raw(Box::new(nativeAnnouncementSignatures {
2242 channel_id: channel_id_arg.data,
2243 short_channel_id: short_channel_id_arg,
2244 node_signature: node_signature_arg.into_rust(),
2245 bitcoin_signature: bitcoin_signature_arg.into_rust(),
2246 })), is_owned: true }
2248 impl Clone for AnnouncementSignatures {
2249 fn clone(&self) -> Self {
2251 inner: if self.inner.is_null() { std::ptr::null_mut() } else {
2252 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
2258 /// Used only if an object of this type is returned as a trait impl by a method
2259 pub(crate) extern "C" fn AnnouncementSignatures_clone_void(this_ptr: *const c_void) -> *mut c_void {
2260 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeAnnouncementSignatures)).clone() })) as *mut c_void
2263 pub extern "C" fn AnnouncementSignatures_clone(orig: &AnnouncementSignatures) -> AnnouncementSignatures {
2266 /// An address which can be used to connect to a remote peer
2270 pub enum NetAddress {
2271 /// An IPv4 address/port on which the peer is listening.
2273 addr: crate::c_types::FourBytes,
2276 /// An IPv6 address/port on which the peer is listening.
2278 addr: crate::c_types::SixteenBytes,
2281 /// An old-style Tor onion address/port on which the peer is listening.
2283 addr: crate::c_types::TenBytes,
2286 /// A new-style Tor onion address/port on which the peer is listening.
2287 /// To create the human-readable \"hostname\", concatenate ed25519_pubkey, checksum, and version,
2288 /// wrap as base32 and append \".onion\".
2290 ed25519_pubkey: crate::c_types::ThirtyTwoBytes,
2296 use lightning::ln::msgs::NetAddress as nativeNetAddress;
2299 pub(crate) fn to_native(&self) -> nativeNetAddress {
2301 NetAddress::IPv4 {ref addr, ref port, } => {
2302 let mut addr_nonref = (*addr).clone();
2303 let mut port_nonref = (*port).clone();
2304 nativeNetAddress::IPv4 {
2305 addr: addr_nonref.data,
2309 NetAddress::IPv6 {ref addr, ref port, } => {
2310 let mut addr_nonref = (*addr).clone();
2311 let mut port_nonref = (*port).clone();
2312 nativeNetAddress::IPv6 {
2313 addr: addr_nonref.data,
2317 NetAddress::OnionV2 {ref addr, ref port, } => {
2318 let mut addr_nonref = (*addr).clone();
2319 let mut port_nonref = (*port).clone();
2320 nativeNetAddress::OnionV2 {
2321 addr: addr_nonref.data,
2325 NetAddress::OnionV3 {ref ed25519_pubkey, ref checksum, ref version, ref port, } => {
2326 let mut ed25519_pubkey_nonref = (*ed25519_pubkey).clone();
2327 let mut checksum_nonref = (*checksum).clone();
2328 let mut version_nonref = (*version).clone();
2329 let mut port_nonref = (*port).clone();
2330 nativeNetAddress::OnionV3 {
2331 ed25519_pubkey: ed25519_pubkey_nonref.data,
2332 checksum: checksum_nonref,
2333 version: version_nonref,
2340 pub(crate) fn into_native(self) -> nativeNetAddress {
2342 NetAddress::IPv4 {mut addr, mut port, } => {
2343 nativeNetAddress::IPv4 {
2348 NetAddress::IPv6 {mut addr, mut port, } => {
2349 nativeNetAddress::IPv6 {
2354 NetAddress::OnionV2 {mut addr, mut port, } => {
2355 nativeNetAddress::OnionV2 {
2360 NetAddress::OnionV3 {mut ed25519_pubkey, mut checksum, mut version, mut port, } => {
2361 nativeNetAddress::OnionV3 {
2362 ed25519_pubkey: ed25519_pubkey.data,
2371 pub(crate) fn from_native(native: &nativeNetAddress) -> Self {
2373 nativeNetAddress::IPv4 {ref addr, ref port, } => {
2374 let mut addr_nonref = (*addr).clone();
2375 let mut port_nonref = (*port).clone();
2377 addr: crate::c_types::FourBytes { data: addr_nonref },
2381 nativeNetAddress::IPv6 {ref addr, ref port, } => {
2382 let mut addr_nonref = (*addr).clone();
2383 let mut port_nonref = (*port).clone();
2385 addr: crate::c_types::SixteenBytes { data: addr_nonref },
2389 nativeNetAddress::OnionV2 {ref addr, ref port, } => {
2390 let mut addr_nonref = (*addr).clone();
2391 let mut port_nonref = (*port).clone();
2392 NetAddress::OnionV2 {
2393 addr: crate::c_types::TenBytes { data: addr_nonref },
2397 nativeNetAddress::OnionV3 {ref ed25519_pubkey, ref checksum, ref version, ref port, } => {
2398 let mut ed25519_pubkey_nonref = (*ed25519_pubkey).clone();
2399 let mut checksum_nonref = (*checksum).clone();
2400 let mut version_nonref = (*version).clone();
2401 let mut port_nonref = (*port).clone();
2402 NetAddress::OnionV3 {
2403 ed25519_pubkey: crate::c_types::ThirtyTwoBytes { data: ed25519_pubkey_nonref },
2404 checksum: checksum_nonref,
2405 version: version_nonref,
2412 pub(crate) fn native_into(native: nativeNetAddress) -> Self {
2414 nativeNetAddress::IPv4 {mut addr, mut port, } => {
2416 addr: crate::c_types::FourBytes { data: addr },
2420 nativeNetAddress::IPv6 {mut addr, mut port, } => {
2422 addr: crate::c_types::SixteenBytes { data: addr },
2426 nativeNetAddress::OnionV2 {mut addr, mut port, } => {
2427 NetAddress::OnionV2 {
2428 addr: crate::c_types::TenBytes { data: addr },
2432 nativeNetAddress::OnionV3 {mut ed25519_pubkey, mut checksum, mut version, mut port, } => {
2433 NetAddress::OnionV3 {
2434 ed25519_pubkey: crate::c_types::ThirtyTwoBytes { data: ed25519_pubkey },
2444 pub extern "C" fn NetAddress_free(this_ptr: NetAddress) { }
2446 pub extern "C" fn NetAddress_clone(orig: &NetAddress) -> NetAddress {
2450 pub extern "C" fn NetAddress_write(obj: &NetAddress) -> crate::c_types::derived::CVec_u8Z {
2451 crate::c_types::serialize_obj(&unsafe { &*obj }.to_native())
2454 pub extern "C" fn Result_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_CResult_NetAddressu8ZDecodeErrorZ {
2455 let res = crate::c_types::deserialize_obj(ser);
2456 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { let mut local_res_0 = match o { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::ln::msgs::NetAddress::native_into(o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { e }).into() }; local_res_0 }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
2460 use lightning::ln::msgs::UnsignedNodeAnnouncement as nativeUnsignedNodeAnnouncementImport;
2461 type nativeUnsignedNodeAnnouncement = nativeUnsignedNodeAnnouncementImport;
2463 /// The unsigned part of a node_announcement
2466 pub struct UnsignedNodeAnnouncement {
2467 /// Nearly everywhere, inner must be non-null, however in places where
2468 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
2469 pub inner: *mut nativeUnsignedNodeAnnouncement,
2473 impl Drop for UnsignedNodeAnnouncement {
2474 fn drop(&mut self) {
2475 if self.is_owned && !self.inner.is_null() {
2476 let _ = unsafe { Box::from_raw(self.inner) };
2481 pub extern "C" fn UnsignedNodeAnnouncement_free(this_ptr: UnsignedNodeAnnouncement) { }
2483 /// Used only if an object of this type is returned as a trait impl by a method
2484 extern "C" fn UnsignedNodeAnnouncement_free_void(this_ptr: *mut c_void) {
2485 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeUnsignedNodeAnnouncement); }
2488 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
2489 impl UnsignedNodeAnnouncement {
2490 pub(crate) fn take_inner(mut self) -> *mut nativeUnsignedNodeAnnouncement {
2491 assert!(self.is_owned);
2492 let ret = self.inner;
2493 self.inner = std::ptr::null_mut();
2497 /// The advertised features
2499 pub extern "C" fn UnsignedNodeAnnouncement_get_features(this_ptr: &UnsignedNodeAnnouncement) -> crate::ln::features::NodeFeatures {
2500 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.features;
2501 crate::ln::features::NodeFeatures { inner: unsafe { ( (&((*inner_val)) as *const _) as *mut _) }, is_owned: false }
2503 /// The advertised features
2505 pub extern "C" fn UnsignedNodeAnnouncement_set_features(this_ptr: &mut UnsignedNodeAnnouncement, mut val: crate::ln::features::NodeFeatures) {
2506 unsafe { &mut *this_ptr.inner }.features = *unsafe { Box::from_raw(val.take_inner()) };
2508 /// A strictly monotonic announcement counter, with gaps allowed
2510 pub extern "C" fn UnsignedNodeAnnouncement_get_timestamp(this_ptr: &UnsignedNodeAnnouncement) -> u32 {
2511 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.timestamp;
2514 /// A strictly monotonic announcement counter, with gaps allowed
2516 pub extern "C" fn UnsignedNodeAnnouncement_set_timestamp(this_ptr: &mut UnsignedNodeAnnouncement, mut val: u32) {
2517 unsafe { &mut *this_ptr.inner }.timestamp = val;
2519 /// The node_id this announcement originated from (don't rebroadcast the node_announcement back
2522 pub extern "C" fn UnsignedNodeAnnouncement_get_node_id(this_ptr: &UnsignedNodeAnnouncement) -> crate::c_types::PublicKey {
2523 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.node_id;
2524 crate::c_types::PublicKey::from_rust(&(*inner_val))
2526 /// The node_id this announcement originated from (don't rebroadcast the node_announcement back
2529 pub extern "C" fn UnsignedNodeAnnouncement_set_node_id(this_ptr: &mut UnsignedNodeAnnouncement, mut val: crate::c_types::PublicKey) {
2530 unsafe { &mut *this_ptr.inner }.node_id = val.into_rust();
2532 /// An RGB color for UI purposes
2534 pub extern "C" fn UnsignedNodeAnnouncement_get_rgb(this_ptr: &UnsignedNodeAnnouncement) -> *const [u8; 3] {
2535 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.rgb;
2538 /// An RGB color for UI purposes
2540 pub extern "C" fn UnsignedNodeAnnouncement_set_rgb(this_ptr: &mut UnsignedNodeAnnouncement, mut val: crate::c_types::ThreeBytes) {
2541 unsafe { &mut *this_ptr.inner }.rgb = val.data;
2543 /// An alias, for UI purposes. This should be sanitized before use. There is no guarantee
2546 pub extern "C" fn UnsignedNodeAnnouncement_get_alias(this_ptr: &UnsignedNodeAnnouncement) -> *const [u8; 32] {
2547 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.alias;
2550 /// An alias, for UI purposes. This should be sanitized before use. There is no guarantee
2553 pub extern "C" fn UnsignedNodeAnnouncement_set_alias(this_ptr: &mut UnsignedNodeAnnouncement, mut val: crate::c_types::ThirtyTwoBytes) {
2554 unsafe { &mut *this_ptr.inner }.alias = val.data;
2556 /// List of addresses on which this node is reachable
2558 pub extern "C" fn UnsignedNodeAnnouncement_set_addresses(this_ptr: &mut UnsignedNodeAnnouncement, mut val: crate::c_types::derived::CVec_NetAddressZ) {
2559 let mut local_val = Vec::new(); for mut item in val.into_rust().drain(..) { local_val.push( { item.into_native() }); };
2560 unsafe { &mut *this_ptr.inner }.addresses = local_val;
2562 impl Clone for UnsignedNodeAnnouncement {
2563 fn clone(&self) -> Self {
2565 inner: if self.inner.is_null() { std::ptr::null_mut() } else {
2566 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
2572 /// Used only if an object of this type is returned as a trait impl by a method
2573 pub(crate) extern "C" fn UnsignedNodeAnnouncement_clone_void(this_ptr: *const c_void) -> *mut c_void {
2574 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeUnsignedNodeAnnouncement)).clone() })) as *mut c_void
2577 pub extern "C" fn UnsignedNodeAnnouncement_clone(orig: &UnsignedNodeAnnouncement) -> UnsignedNodeAnnouncement {
2581 use lightning::ln::msgs::NodeAnnouncement as nativeNodeAnnouncementImport;
2582 type nativeNodeAnnouncement = nativeNodeAnnouncementImport;
2584 /// A node_announcement message to be sent or received from a peer
2587 pub struct NodeAnnouncement {
2588 /// Nearly everywhere, inner must be non-null, however in places where
2589 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
2590 pub inner: *mut nativeNodeAnnouncement,
2594 impl Drop for NodeAnnouncement {
2595 fn drop(&mut self) {
2596 if self.is_owned && !self.inner.is_null() {
2597 let _ = unsafe { Box::from_raw(self.inner) };
2602 pub extern "C" fn NodeAnnouncement_free(this_ptr: NodeAnnouncement) { }
2604 /// Used only if an object of this type is returned as a trait impl by a method
2605 extern "C" fn NodeAnnouncement_free_void(this_ptr: *mut c_void) {
2606 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeNodeAnnouncement); }
2609 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
2610 impl NodeAnnouncement {
2611 pub(crate) fn take_inner(mut self) -> *mut nativeNodeAnnouncement {
2612 assert!(self.is_owned);
2613 let ret = self.inner;
2614 self.inner = std::ptr::null_mut();
2618 /// The signature by the node key
2620 pub extern "C" fn NodeAnnouncement_get_signature(this_ptr: &NodeAnnouncement) -> crate::c_types::Signature {
2621 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.signature;
2622 crate::c_types::Signature::from_rust(&(*inner_val))
2624 /// The signature by the node key
2626 pub extern "C" fn NodeAnnouncement_set_signature(this_ptr: &mut NodeAnnouncement, mut val: crate::c_types::Signature) {
2627 unsafe { &mut *this_ptr.inner }.signature = val.into_rust();
2629 /// The actual content of the announcement
2631 pub extern "C" fn NodeAnnouncement_get_contents(this_ptr: &NodeAnnouncement) -> crate::ln::msgs::UnsignedNodeAnnouncement {
2632 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.contents;
2633 crate::ln::msgs::UnsignedNodeAnnouncement { inner: unsafe { ( (&((*inner_val)) as *const _) as *mut _) }, is_owned: false }
2635 /// The actual content of the announcement
2637 pub extern "C" fn NodeAnnouncement_set_contents(this_ptr: &mut NodeAnnouncement, mut val: crate::ln::msgs::UnsignedNodeAnnouncement) {
2638 unsafe { &mut *this_ptr.inner }.contents = *unsafe { Box::from_raw(val.take_inner()) };
2642 pub extern "C" fn NodeAnnouncement_new(mut signature_arg: crate::c_types::Signature, mut contents_arg: crate::ln::msgs::UnsignedNodeAnnouncement) -> NodeAnnouncement {
2643 NodeAnnouncement { inner: Box::into_raw(Box::new(nativeNodeAnnouncement {
2644 signature: signature_arg.into_rust(),
2645 contents: *unsafe { Box::from_raw(contents_arg.take_inner()) },
2646 })), is_owned: true }
2648 impl Clone for NodeAnnouncement {
2649 fn clone(&self) -> Self {
2651 inner: if self.inner.is_null() { std::ptr::null_mut() } else {
2652 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
2658 /// Used only if an object of this type is returned as a trait impl by a method
2659 pub(crate) extern "C" fn NodeAnnouncement_clone_void(this_ptr: *const c_void) -> *mut c_void {
2660 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeNodeAnnouncement)).clone() })) as *mut c_void
2663 pub extern "C" fn NodeAnnouncement_clone(orig: &NodeAnnouncement) -> NodeAnnouncement {
2667 use lightning::ln::msgs::UnsignedChannelAnnouncement as nativeUnsignedChannelAnnouncementImport;
2668 type nativeUnsignedChannelAnnouncement = nativeUnsignedChannelAnnouncementImport;
2670 /// The unsigned part of a channel_announcement
2673 pub struct UnsignedChannelAnnouncement {
2674 /// Nearly everywhere, inner must be non-null, however in places where
2675 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
2676 pub inner: *mut nativeUnsignedChannelAnnouncement,
2680 impl Drop for UnsignedChannelAnnouncement {
2681 fn drop(&mut self) {
2682 if self.is_owned && !self.inner.is_null() {
2683 let _ = unsafe { Box::from_raw(self.inner) };
2688 pub extern "C" fn UnsignedChannelAnnouncement_free(this_ptr: UnsignedChannelAnnouncement) { }
2690 /// Used only if an object of this type is returned as a trait impl by a method
2691 extern "C" fn UnsignedChannelAnnouncement_free_void(this_ptr: *mut c_void) {
2692 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeUnsignedChannelAnnouncement); }
2695 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
2696 impl UnsignedChannelAnnouncement {
2697 pub(crate) fn take_inner(mut self) -> *mut nativeUnsignedChannelAnnouncement {
2698 assert!(self.is_owned);
2699 let ret = self.inner;
2700 self.inner = std::ptr::null_mut();
2704 /// The advertised channel features
2706 pub extern "C" fn UnsignedChannelAnnouncement_get_features(this_ptr: &UnsignedChannelAnnouncement) -> crate::ln::features::ChannelFeatures {
2707 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.features;
2708 crate::ln::features::ChannelFeatures { inner: unsafe { ( (&((*inner_val)) as *const _) as *mut _) }, is_owned: false }
2710 /// The advertised channel features
2712 pub extern "C" fn UnsignedChannelAnnouncement_set_features(this_ptr: &mut UnsignedChannelAnnouncement, mut val: crate::ln::features::ChannelFeatures) {
2713 unsafe { &mut *this_ptr.inner }.features = *unsafe { Box::from_raw(val.take_inner()) };
2715 /// The genesis hash of the blockchain where the channel is to be opened
2717 pub extern "C" fn UnsignedChannelAnnouncement_get_chain_hash(this_ptr: &UnsignedChannelAnnouncement) -> *const [u8; 32] {
2718 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.chain_hash;
2719 (*inner_val).as_inner()
2721 /// The genesis hash of the blockchain where the channel is to be opened
2723 pub extern "C" fn UnsignedChannelAnnouncement_set_chain_hash(this_ptr: &mut UnsignedChannelAnnouncement, mut val: crate::c_types::ThirtyTwoBytes) {
2724 unsafe { &mut *this_ptr.inner }.chain_hash = ::bitcoin::hash_types::BlockHash::from_slice(&val.data[..]).unwrap();
2726 /// The short channel ID
2728 pub extern "C" fn UnsignedChannelAnnouncement_get_short_channel_id(this_ptr: &UnsignedChannelAnnouncement) -> u64 {
2729 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.short_channel_id;
2732 /// The short channel ID
2734 pub extern "C" fn UnsignedChannelAnnouncement_set_short_channel_id(this_ptr: &mut UnsignedChannelAnnouncement, mut val: u64) {
2735 unsafe { &mut *this_ptr.inner }.short_channel_id = val;
2737 /// One of the two node_ids which are endpoints of this channel
2739 pub extern "C" fn UnsignedChannelAnnouncement_get_node_id_1(this_ptr: &UnsignedChannelAnnouncement) -> crate::c_types::PublicKey {
2740 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.node_id_1;
2741 crate::c_types::PublicKey::from_rust(&(*inner_val))
2743 /// One of the two node_ids which are endpoints of this channel
2745 pub extern "C" fn UnsignedChannelAnnouncement_set_node_id_1(this_ptr: &mut UnsignedChannelAnnouncement, mut val: crate::c_types::PublicKey) {
2746 unsafe { &mut *this_ptr.inner }.node_id_1 = val.into_rust();
2748 /// The other of the two node_ids which are endpoints of this channel
2750 pub extern "C" fn UnsignedChannelAnnouncement_get_node_id_2(this_ptr: &UnsignedChannelAnnouncement) -> crate::c_types::PublicKey {
2751 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.node_id_2;
2752 crate::c_types::PublicKey::from_rust(&(*inner_val))
2754 /// The other of the two node_ids which are endpoints of this channel
2756 pub extern "C" fn UnsignedChannelAnnouncement_set_node_id_2(this_ptr: &mut UnsignedChannelAnnouncement, mut val: crate::c_types::PublicKey) {
2757 unsafe { &mut *this_ptr.inner }.node_id_2 = val.into_rust();
2759 /// The funding key for the first node
2761 pub extern "C" fn UnsignedChannelAnnouncement_get_bitcoin_key_1(this_ptr: &UnsignedChannelAnnouncement) -> crate::c_types::PublicKey {
2762 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.bitcoin_key_1;
2763 crate::c_types::PublicKey::from_rust(&(*inner_val))
2765 /// The funding key for the first node
2767 pub extern "C" fn UnsignedChannelAnnouncement_set_bitcoin_key_1(this_ptr: &mut UnsignedChannelAnnouncement, mut val: crate::c_types::PublicKey) {
2768 unsafe { &mut *this_ptr.inner }.bitcoin_key_1 = val.into_rust();
2770 /// The funding key for the second node
2772 pub extern "C" fn UnsignedChannelAnnouncement_get_bitcoin_key_2(this_ptr: &UnsignedChannelAnnouncement) -> crate::c_types::PublicKey {
2773 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.bitcoin_key_2;
2774 crate::c_types::PublicKey::from_rust(&(*inner_val))
2776 /// The funding key for the second node
2778 pub extern "C" fn UnsignedChannelAnnouncement_set_bitcoin_key_2(this_ptr: &mut UnsignedChannelAnnouncement, mut val: crate::c_types::PublicKey) {
2779 unsafe { &mut *this_ptr.inner }.bitcoin_key_2 = val.into_rust();
2781 impl Clone for UnsignedChannelAnnouncement {
2782 fn clone(&self) -> Self {
2784 inner: if self.inner.is_null() { std::ptr::null_mut() } else {
2785 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
2791 /// Used only if an object of this type is returned as a trait impl by a method
2792 pub(crate) extern "C" fn UnsignedChannelAnnouncement_clone_void(this_ptr: *const c_void) -> *mut c_void {
2793 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeUnsignedChannelAnnouncement)).clone() })) as *mut c_void
2796 pub extern "C" fn UnsignedChannelAnnouncement_clone(orig: &UnsignedChannelAnnouncement) -> UnsignedChannelAnnouncement {
2800 use lightning::ln::msgs::ChannelAnnouncement as nativeChannelAnnouncementImport;
2801 type nativeChannelAnnouncement = nativeChannelAnnouncementImport;
2803 /// A channel_announcement message to be sent or received from a peer
2806 pub struct ChannelAnnouncement {
2807 /// Nearly everywhere, inner must be non-null, however in places where
2808 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
2809 pub inner: *mut nativeChannelAnnouncement,
2813 impl Drop for ChannelAnnouncement {
2814 fn drop(&mut self) {
2815 if self.is_owned && !self.inner.is_null() {
2816 let _ = unsafe { Box::from_raw(self.inner) };
2821 pub extern "C" fn ChannelAnnouncement_free(this_ptr: ChannelAnnouncement) { }
2823 /// Used only if an object of this type is returned as a trait impl by a method
2824 extern "C" fn ChannelAnnouncement_free_void(this_ptr: *mut c_void) {
2825 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeChannelAnnouncement); }
2828 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
2829 impl ChannelAnnouncement {
2830 pub(crate) fn take_inner(mut self) -> *mut nativeChannelAnnouncement {
2831 assert!(self.is_owned);
2832 let ret = self.inner;
2833 self.inner = std::ptr::null_mut();
2837 /// Authentication of the announcement by the first public node
2839 pub extern "C" fn ChannelAnnouncement_get_node_signature_1(this_ptr: &ChannelAnnouncement) -> crate::c_types::Signature {
2840 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.node_signature_1;
2841 crate::c_types::Signature::from_rust(&(*inner_val))
2843 /// Authentication of the announcement by the first public node
2845 pub extern "C" fn ChannelAnnouncement_set_node_signature_1(this_ptr: &mut ChannelAnnouncement, mut val: crate::c_types::Signature) {
2846 unsafe { &mut *this_ptr.inner }.node_signature_1 = val.into_rust();
2848 /// Authentication of the announcement by the second public node
2850 pub extern "C" fn ChannelAnnouncement_get_node_signature_2(this_ptr: &ChannelAnnouncement) -> crate::c_types::Signature {
2851 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.node_signature_2;
2852 crate::c_types::Signature::from_rust(&(*inner_val))
2854 /// Authentication of the announcement by the second public node
2856 pub extern "C" fn ChannelAnnouncement_set_node_signature_2(this_ptr: &mut ChannelAnnouncement, mut val: crate::c_types::Signature) {
2857 unsafe { &mut *this_ptr.inner }.node_signature_2 = val.into_rust();
2859 /// Proof of funding UTXO ownership by the first public node
2861 pub extern "C" fn ChannelAnnouncement_get_bitcoin_signature_1(this_ptr: &ChannelAnnouncement) -> crate::c_types::Signature {
2862 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.bitcoin_signature_1;
2863 crate::c_types::Signature::from_rust(&(*inner_val))
2865 /// Proof of funding UTXO ownership by the first public node
2867 pub extern "C" fn ChannelAnnouncement_set_bitcoin_signature_1(this_ptr: &mut ChannelAnnouncement, mut val: crate::c_types::Signature) {
2868 unsafe { &mut *this_ptr.inner }.bitcoin_signature_1 = val.into_rust();
2870 /// Proof of funding UTXO ownership by the second public node
2872 pub extern "C" fn ChannelAnnouncement_get_bitcoin_signature_2(this_ptr: &ChannelAnnouncement) -> crate::c_types::Signature {
2873 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.bitcoin_signature_2;
2874 crate::c_types::Signature::from_rust(&(*inner_val))
2876 /// Proof of funding UTXO ownership by the second public node
2878 pub extern "C" fn ChannelAnnouncement_set_bitcoin_signature_2(this_ptr: &mut ChannelAnnouncement, mut val: crate::c_types::Signature) {
2879 unsafe { &mut *this_ptr.inner }.bitcoin_signature_2 = val.into_rust();
2881 /// The actual announcement
2883 pub extern "C" fn ChannelAnnouncement_get_contents(this_ptr: &ChannelAnnouncement) -> crate::ln::msgs::UnsignedChannelAnnouncement {
2884 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.contents;
2885 crate::ln::msgs::UnsignedChannelAnnouncement { inner: unsafe { ( (&((*inner_val)) as *const _) as *mut _) }, is_owned: false }
2887 /// The actual announcement
2889 pub extern "C" fn ChannelAnnouncement_set_contents(this_ptr: &mut ChannelAnnouncement, mut val: crate::ln::msgs::UnsignedChannelAnnouncement) {
2890 unsafe { &mut *this_ptr.inner }.contents = *unsafe { Box::from_raw(val.take_inner()) };
2894 pub extern "C" fn ChannelAnnouncement_new(mut node_signature_1_arg: crate::c_types::Signature, mut node_signature_2_arg: crate::c_types::Signature, mut bitcoin_signature_1_arg: crate::c_types::Signature, mut bitcoin_signature_2_arg: crate::c_types::Signature, mut contents_arg: crate::ln::msgs::UnsignedChannelAnnouncement) -> ChannelAnnouncement {
2895 ChannelAnnouncement { inner: Box::into_raw(Box::new(nativeChannelAnnouncement {
2896 node_signature_1: node_signature_1_arg.into_rust(),
2897 node_signature_2: node_signature_2_arg.into_rust(),
2898 bitcoin_signature_1: bitcoin_signature_1_arg.into_rust(),
2899 bitcoin_signature_2: bitcoin_signature_2_arg.into_rust(),
2900 contents: *unsafe { Box::from_raw(contents_arg.take_inner()) },
2901 })), is_owned: true }
2903 impl Clone for ChannelAnnouncement {
2904 fn clone(&self) -> Self {
2906 inner: if self.inner.is_null() { std::ptr::null_mut() } else {
2907 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
2913 /// Used only if an object of this type is returned as a trait impl by a method
2914 pub(crate) extern "C" fn ChannelAnnouncement_clone_void(this_ptr: *const c_void) -> *mut c_void {
2915 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeChannelAnnouncement)).clone() })) as *mut c_void
2918 pub extern "C" fn ChannelAnnouncement_clone(orig: &ChannelAnnouncement) -> ChannelAnnouncement {
2922 use lightning::ln::msgs::UnsignedChannelUpdate as nativeUnsignedChannelUpdateImport;
2923 type nativeUnsignedChannelUpdate = nativeUnsignedChannelUpdateImport;
2925 /// The unsigned part of a channel_update
2928 pub struct UnsignedChannelUpdate {
2929 /// Nearly everywhere, inner must be non-null, however in places where
2930 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
2931 pub inner: *mut nativeUnsignedChannelUpdate,
2935 impl Drop for UnsignedChannelUpdate {
2936 fn drop(&mut self) {
2937 if self.is_owned && !self.inner.is_null() {
2938 let _ = unsafe { Box::from_raw(self.inner) };
2943 pub extern "C" fn UnsignedChannelUpdate_free(this_ptr: UnsignedChannelUpdate) { }
2945 /// Used only if an object of this type is returned as a trait impl by a method
2946 extern "C" fn UnsignedChannelUpdate_free_void(this_ptr: *mut c_void) {
2947 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeUnsignedChannelUpdate); }
2950 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
2951 impl UnsignedChannelUpdate {
2952 pub(crate) fn take_inner(mut self) -> *mut nativeUnsignedChannelUpdate {
2953 assert!(self.is_owned);
2954 let ret = self.inner;
2955 self.inner = std::ptr::null_mut();
2959 /// The genesis hash of the blockchain where the channel is to be opened
2961 pub extern "C" fn UnsignedChannelUpdate_get_chain_hash(this_ptr: &UnsignedChannelUpdate) -> *const [u8; 32] {
2962 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.chain_hash;
2963 (*inner_val).as_inner()
2965 /// The genesis hash of the blockchain where the channel is to be opened
2967 pub extern "C" fn UnsignedChannelUpdate_set_chain_hash(this_ptr: &mut UnsignedChannelUpdate, mut val: crate::c_types::ThirtyTwoBytes) {
2968 unsafe { &mut *this_ptr.inner }.chain_hash = ::bitcoin::hash_types::BlockHash::from_slice(&val.data[..]).unwrap();
2970 /// The short channel ID
2972 pub extern "C" fn UnsignedChannelUpdate_get_short_channel_id(this_ptr: &UnsignedChannelUpdate) -> u64 {
2973 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.short_channel_id;
2976 /// The short channel ID
2978 pub extern "C" fn UnsignedChannelUpdate_set_short_channel_id(this_ptr: &mut UnsignedChannelUpdate, mut val: u64) {
2979 unsafe { &mut *this_ptr.inner }.short_channel_id = val;
2981 /// A strictly monotonic announcement counter, with gaps allowed, specific to this channel
2983 pub extern "C" fn UnsignedChannelUpdate_get_timestamp(this_ptr: &UnsignedChannelUpdate) -> u32 {
2984 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.timestamp;
2987 /// A strictly monotonic announcement counter, with gaps allowed, specific to this channel
2989 pub extern "C" fn UnsignedChannelUpdate_set_timestamp(this_ptr: &mut UnsignedChannelUpdate, mut val: u32) {
2990 unsafe { &mut *this_ptr.inner }.timestamp = val;
2994 pub extern "C" fn UnsignedChannelUpdate_get_flags(this_ptr: &UnsignedChannelUpdate) -> u8 {
2995 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.flags;
3000 pub extern "C" fn UnsignedChannelUpdate_set_flags(this_ptr: &mut UnsignedChannelUpdate, mut val: u8) {
3001 unsafe { &mut *this_ptr.inner }.flags = val;
3003 /// The number of blocks to subtract from incoming HTLC cltv_expiry values
3005 pub extern "C" fn UnsignedChannelUpdate_get_cltv_expiry_delta(this_ptr: &UnsignedChannelUpdate) -> u16 {
3006 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.cltv_expiry_delta;
3009 /// The number of blocks to subtract from incoming HTLC cltv_expiry values
3011 pub extern "C" fn UnsignedChannelUpdate_set_cltv_expiry_delta(this_ptr: &mut UnsignedChannelUpdate, mut val: u16) {
3012 unsafe { &mut *this_ptr.inner }.cltv_expiry_delta = val;
3014 /// The minimum HTLC size incoming to sender, in milli-satoshi
3016 pub extern "C" fn UnsignedChannelUpdate_get_htlc_minimum_msat(this_ptr: &UnsignedChannelUpdate) -> u64 {
3017 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.htlc_minimum_msat;
3020 /// The minimum HTLC size incoming to sender, in milli-satoshi
3022 pub extern "C" fn UnsignedChannelUpdate_set_htlc_minimum_msat(this_ptr: &mut UnsignedChannelUpdate, mut val: u64) {
3023 unsafe { &mut *this_ptr.inner }.htlc_minimum_msat = val;
3025 /// The base HTLC fee charged by sender, in milli-satoshi
3027 pub extern "C" fn UnsignedChannelUpdate_get_fee_base_msat(this_ptr: &UnsignedChannelUpdate) -> u32 {
3028 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.fee_base_msat;
3031 /// The base HTLC fee charged by sender, in milli-satoshi
3033 pub extern "C" fn UnsignedChannelUpdate_set_fee_base_msat(this_ptr: &mut UnsignedChannelUpdate, mut val: u32) {
3034 unsafe { &mut *this_ptr.inner }.fee_base_msat = val;
3036 /// The amount to fee multiplier, in micro-satoshi
3038 pub extern "C" fn UnsignedChannelUpdate_get_fee_proportional_millionths(this_ptr: &UnsignedChannelUpdate) -> u32 {
3039 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.fee_proportional_millionths;
3042 /// The amount to fee multiplier, in micro-satoshi
3044 pub extern "C" fn UnsignedChannelUpdate_set_fee_proportional_millionths(this_ptr: &mut UnsignedChannelUpdate, mut val: u32) {
3045 unsafe { &mut *this_ptr.inner }.fee_proportional_millionths = val;
3047 impl Clone for UnsignedChannelUpdate {
3048 fn clone(&self) -> Self {
3050 inner: if self.inner.is_null() { std::ptr::null_mut() } else {
3051 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
3057 /// Used only if an object of this type is returned as a trait impl by a method
3058 pub(crate) extern "C" fn UnsignedChannelUpdate_clone_void(this_ptr: *const c_void) -> *mut c_void {
3059 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeUnsignedChannelUpdate)).clone() })) as *mut c_void
3062 pub extern "C" fn UnsignedChannelUpdate_clone(orig: &UnsignedChannelUpdate) -> UnsignedChannelUpdate {
3066 use lightning::ln::msgs::ChannelUpdate as nativeChannelUpdateImport;
3067 type nativeChannelUpdate = nativeChannelUpdateImport;
3069 /// A channel_update message to be sent or received from a peer
3072 pub struct ChannelUpdate {
3073 /// Nearly everywhere, inner must be non-null, however in places where
3074 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
3075 pub inner: *mut nativeChannelUpdate,
3079 impl Drop for ChannelUpdate {
3080 fn drop(&mut self) {
3081 if self.is_owned && !self.inner.is_null() {
3082 let _ = unsafe { Box::from_raw(self.inner) };
3087 pub extern "C" fn ChannelUpdate_free(this_ptr: ChannelUpdate) { }
3089 /// Used only if an object of this type is returned as a trait impl by a method
3090 extern "C" fn ChannelUpdate_free_void(this_ptr: *mut c_void) {
3091 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeChannelUpdate); }
3094 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
3095 impl ChannelUpdate {
3096 pub(crate) fn take_inner(mut self) -> *mut nativeChannelUpdate {
3097 assert!(self.is_owned);
3098 let ret = self.inner;
3099 self.inner = std::ptr::null_mut();
3103 /// A signature of the channel update
3105 pub extern "C" fn ChannelUpdate_get_signature(this_ptr: &ChannelUpdate) -> crate::c_types::Signature {
3106 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.signature;
3107 crate::c_types::Signature::from_rust(&(*inner_val))
3109 /// A signature of the channel update
3111 pub extern "C" fn ChannelUpdate_set_signature(this_ptr: &mut ChannelUpdate, mut val: crate::c_types::Signature) {
3112 unsafe { &mut *this_ptr.inner }.signature = val.into_rust();
3114 /// The actual channel update
3116 pub extern "C" fn ChannelUpdate_get_contents(this_ptr: &ChannelUpdate) -> crate::ln::msgs::UnsignedChannelUpdate {
3117 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.contents;
3118 crate::ln::msgs::UnsignedChannelUpdate { inner: unsafe { ( (&((*inner_val)) as *const _) as *mut _) }, is_owned: false }
3120 /// The actual channel update
3122 pub extern "C" fn ChannelUpdate_set_contents(this_ptr: &mut ChannelUpdate, mut val: crate::ln::msgs::UnsignedChannelUpdate) {
3123 unsafe { &mut *this_ptr.inner }.contents = *unsafe { Box::from_raw(val.take_inner()) };
3127 pub extern "C" fn ChannelUpdate_new(mut signature_arg: crate::c_types::Signature, mut contents_arg: crate::ln::msgs::UnsignedChannelUpdate) -> ChannelUpdate {
3128 ChannelUpdate { inner: Box::into_raw(Box::new(nativeChannelUpdate {
3129 signature: signature_arg.into_rust(),
3130 contents: *unsafe { Box::from_raw(contents_arg.take_inner()) },
3131 })), is_owned: true }
3133 impl Clone for ChannelUpdate {
3134 fn clone(&self) -> Self {
3136 inner: if self.inner.is_null() { std::ptr::null_mut() } else {
3137 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
3143 /// Used only if an object of this type is returned as a trait impl by a method
3144 pub(crate) extern "C" fn ChannelUpdate_clone_void(this_ptr: *const c_void) -> *mut c_void {
3145 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeChannelUpdate)).clone() })) as *mut c_void
3148 pub extern "C" fn ChannelUpdate_clone(orig: &ChannelUpdate) -> ChannelUpdate {
3152 use lightning::ln::msgs::QueryChannelRange as nativeQueryChannelRangeImport;
3153 type nativeQueryChannelRange = nativeQueryChannelRangeImport;
3155 /// A query_channel_range message is used to query a peer for channel
3156 /// UTXOs in a range of blocks. The recipient of a query makes a best
3157 /// effort to reply to the query using one or more reply_channel_range
3161 pub struct QueryChannelRange {
3162 /// Nearly everywhere, inner must be non-null, however in places where
3163 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
3164 pub inner: *mut nativeQueryChannelRange,
3168 impl Drop for QueryChannelRange {
3169 fn drop(&mut self) {
3170 if self.is_owned && !self.inner.is_null() {
3171 let _ = unsafe { Box::from_raw(self.inner) };
3176 pub extern "C" fn QueryChannelRange_free(this_ptr: QueryChannelRange) { }
3178 /// Used only if an object of this type is returned as a trait impl by a method
3179 extern "C" fn QueryChannelRange_free_void(this_ptr: *mut c_void) {
3180 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeQueryChannelRange); }
3183 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
3184 impl QueryChannelRange {
3185 pub(crate) fn take_inner(mut self) -> *mut nativeQueryChannelRange {
3186 assert!(self.is_owned);
3187 let ret = self.inner;
3188 self.inner = std::ptr::null_mut();
3192 /// The genesis hash of the blockchain being queried
3194 pub extern "C" fn QueryChannelRange_get_chain_hash(this_ptr: &QueryChannelRange) -> *const [u8; 32] {
3195 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.chain_hash;
3196 (*inner_val).as_inner()
3198 /// The genesis hash of the blockchain being queried
3200 pub extern "C" fn QueryChannelRange_set_chain_hash(this_ptr: &mut QueryChannelRange, mut val: crate::c_types::ThirtyTwoBytes) {
3201 unsafe { &mut *this_ptr.inner }.chain_hash = ::bitcoin::hash_types::BlockHash::from_slice(&val.data[..]).unwrap();
3203 /// The height of the first block for the channel UTXOs being queried
3205 pub extern "C" fn QueryChannelRange_get_first_blocknum(this_ptr: &QueryChannelRange) -> u32 {
3206 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.first_blocknum;
3209 /// The height of the first block for the channel UTXOs being queried
3211 pub extern "C" fn QueryChannelRange_set_first_blocknum(this_ptr: &mut QueryChannelRange, mut val: u32) {
3212 unsafe { &mut *this_ptr.inner }.first_blocknum = val;
3214 /// The number of blocks to include in the query results
3216 pub extern "C" fn QueryChannelRange_get_number_of_blocks(this_ptr: &QueryChannelRange) -> u32 {
3217 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.number_of_blocks;
3220 /// The number of blocks to include in the query results
3222 pub extern "C" fn QueryChannelRange_set_number_of_blocks(this_ptr: &mut QueryChannelRange, mut val: u32) {
3223 unsafe { &mut *this_ptr.inner }.number_of_blocks = val;
3227 pub extern "C" fn QueryChannelRange_new(mut chain_hash_arg: crate::c_types::ThirtyTwoBytes, mut first_blocknum_arg: u32, mut number_of_blocks_arg: u32) -> QueryChannelRange {
3228 QueryChannelRange { inner: Box::into_raw(Box::new(nativeQueryChannelRange {
3229 chain_hash: ::bitcoin::hash_types::BlockHash::from_slice(&chain_hash_arg.data[..]).unwrap(),
3230 first_blocknum: first_blocknum_arg,
3231 number_of_blocks: number_of_blocks_arg,
3232 })), is_owned: true }
3234 impl Clone for QueryChannelRange {
3235 fn clone(&self) -> Self {
3237 inner: if self.inner.is_null() { std::ptr::null_mut() } else {
3238 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
3244 /// Used only if an object of this type is returned as a trait impl by a method
3245 pub(crate) extern "C" fn QueryChannelRange_clone_void(this_ptr: *const c_void) -> *mut c_void {
3246 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeQueryChannelRange)).clone() })) as *mut c_void
3249 pub extern "C" fn QueryChannelRange_clone(orig: &QueryChannelRange) -> QueryChannelRange {
3253 use lightning::ln::msgs::ReplyChannelRange as nativeReplyChannelRangeImport;
3254 type nativeReplyChannelRange = nativeReplyChannelRangeImport;
3256 /// A reply_channel_range message is a reply to a query_channel_range
3257 /// message. Multiple reply_channel_range messages can be sent in reply
3258 /// to a single query_channel_range message. The query recipient makes a
3259 /// best effort to respond based on their local network view which may
3260 /// not be a perfect view of the network. The short_channel_ids in the
3261 /// reply are encoded. We only support encoding_type=0 uncompressed
3262 /// serialization and do not support encoding_type=1 zlib serialization.
3265 pub struct ReplyChannelRange {
3266 /// Nearly everywhere, inner must be non-null, however in places where
3267 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
3268 pub inner: *mut nativeReplyChannelRange,
3272 impl Drop for ReplyChannelRange {
3273 fn drop(&mut self) {
3274 if self.is_owned && !self.inner.is_null() {
3275 let _ = unsafe { Box::from_raw(self.inner) };
3280 pub extern "C" fn ReplyChannelRange_free(this_ptr: ReplyChannelRange) { }
3282 /// Used only if an object of this type is returned as a trait impl by a method
3283 extern "C" fn ReplyChannelRange_free_void(this_ptr: *mut c_void) {
3284 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeReplyChannelRange); }
3287 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
3288 impl ReplyChannelRange {
3289 pub(crate) fn take_inner(mut self) -> *mut nativeReplyChannelRange {
3290 assert!(self.is_owned);
3291 let ret = self.inner;
3292 self.inner = std::ptr::null_mut();
3296 /// The genesis hash of the blockchain being queried
3298 pub extern "C" fn ReplyChannelRange_get_chain_hash(this_ptr: &ReplyChannelRange) -> *const [u8; 32] {
3299 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.chain_hash;
3300 (*inner_val).as_inner()
3302 /// The genesis hash of the blockchain being queried
3304 pub extern "C" fn ReplyChannelRange_set_chain_hash(this_ptr: &mut ReplyChannelRange, mut val: crate::c_types::ThirtyTwoBytes) {
3305 unsafe { &mut *this_ptr.inner }.chain_hash = ::bitcoin::hash_types::BlockHash::from_slice(&val.data[..]).unwrap();
3307 /// The height of the first block in the range of the reply
3309 pub extern "C" fn ReplyChannelRange_get_first_blocknum(this_ptr: &ReplyChannelRange) -> u32 {
3310 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.first_blocknum;
3313 /// The height of the first block in the range of the reply
3315 pub extern "C" fn ReplyChannelRange_set_first_blocknum(this_ptr: &mut ReplyChannelRange, mut val: u32) {
3316 unsafe { &mut *this_ptr.inner }.first_blocknum = val;
3318 /// The number of blocks included in the range of the reply
3320 pub extern "C" fn ReplyChannelRange_get_number_of_blocks(this_ptr: &ReplyChannelRange) -> u32 {
3321 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.number_of_blocks;
3324 /// The number of blocks included in the range of the reply
3326 pub extern "C" fn ReplyChannelRange_set_number_of_blocks(this_ptr: &mut ReplyChannelRange, mut val: u32) {
3327 unsafe { &mut *this_ptr.inner }.number_of_blocks = val;
3329 /// True when this is the final reply for a query
3331 pub extern "C" fn ReplyChannelRange_get_sync_complete(this_ptr: &ReplyChannelRange) -> bool {
3332 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.sync_complete;
3335 /// True when this is the final reply for a query
3337 pub extern "C" fn ReplyChannelRange_set_sync_complete(this_ptr: &mut ReplyChannelRange, mut val: bool) {
3338 unsafe { &mut *this_ptr.inner }.sync_complete = val;
3340 /// The short_channel_ids in the channel range
3342 pub extern "C" fn ReplyChannelRange_set_short_channel_ids(this_ptr: &mut ReplyChannelRange, mut val: crate::c_types::derived::CVec_u64Z) {
3343 let mut local_val = Vec::new(); for mut item in val.into_rust().drain(..) { local_val.push( { item }); };
3344 unsafe { &mut *this_ptr.inner }.short_channel_ids = local_val;
3348 pub extern "C" fn ReplyChannelRange_new(mut chain_hash_arg: crate::c_types::ThirtyTwoBytes, mut first_blocknum_arg: u32, mut number_of_blocks_arg: u32, mut sync_complete_arg: bool, mut short_channel_ids_arg: crate::c_types::derived::CVec_u64Z) -> ReplyChannelRange {
3349 let mut local_short_channel_ids_arg = Vec::new(); for mut item in short_channel_ids_arg.into_rust().drain(..) { local_short_channel_ids_arg.push( { item }); };
3350 ReplyChannelRange { inner: Box::into_raw(Box::new(nativeReplyChannelRange {
3351 chain_hash: ::bitcoin::hash_types::BlockHash::from_slice(&chain_hash_arg.data[..]).unwrap(),
3352 first_blocknum: first_blocknum_arg,
3353 number_of_blocks: number_of_blocks_arg,
3354 sync_complete: sync_complete_arg,
3355 short_channel_ids: local_short_channel_ids_arg,
3356 })), is_owned: true }
3358 impl Clone for ReplyChannelRange {
3359 fn clone(&self) -> Self {
3361 inner: if self.inner.is_null() { std::ptr::null_mut() } else {
3362 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
3368 /// Used only if an object of this type is returned as a trait impl by a method
3369 pub(crate) extern "C" fn ReplyChannelRange_clone_void(this_ptr: *const c_void) -> *mut c_void {
3370 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeReplyChannelRange)).clone() })) as *mut c_void
3373 pub extern "C" fn ReplyChannelRange_clone(orig: &ReplyChannelRange) -> ReplyChannelRange {
3377 use lightning::ln::msgs::QueryShortChannelIds as nativeQueryShortChannelIdsImport;
3378 type nativeQueryShortChannelIds = nativeQueryShortChannelIdsImport;
3380 /// A query_short_channel_ids message is used to query a peer for
3381 /// routing gossip messages related to one or more short_channel_ids.
3382 /// The query recipient will reply with the latest, if available,
3383 /// channel_announcement, channel_update and node_announcement messages
3384 /// it maintains for the requested short_channel_ids followed by a
3385 /// reply_short_channel_ids_end message. The short_channel_ids sent in
3386 /// this query are encoded. We only support encoding_type=0 uncompressed
3387 /// serialization and do not support encoding_type=1 zlib serialization.
3390 pub struct QueryShortChannelIds {
3391 /// Nearly everywhere, inner must be non-null, however in places where
3392 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
3393 pub inner: *mut nativeQueryShortChannelIds,
3397 impl Drop for QueryShortChannelIds {
3398 fn drop(&mut self) {
3399 if self.is_owned && !self.inner.is_null() {
3400 let _ = unsafe { Box::from_raw(self.inner) };
3405 pub extern "C" fn QueryShortChannelIds_free(this_ptr: QueryShortChannelIds) { }
3407 /// Used only if an object of this type is returned as a trait impl by a method
3408 extern "C" fn QueryShortChannelIds_free_void(this_ptr: *mut c_void) {
3409 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeQueryShortChannelIds); }
3412 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
3413 impl QueryShortChannelIds {
3414 pub(crate) fn take_inner(mut self) -> *mut nativeQueryShortChannelIds {
3415 assert!(self.is_owned);
3416 let ret = self.inner;
3417 self.inner = std::ptr::null_mut();
3421 /// The genesis hash of the blockchain being queried
3423 pub extern "C" fn QueryShortChannelIds_get_chain_hash(this_ptr: &QueryShortChannelIds) -> *const [u8; 32] {
3424 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.chain_hash;
3425 (*inner_val).as_inner()
3427 /// The genesis hash of the blockchain being queried
3429 pub extern "C" fn QueryShortChannelIds_set_chain_hash(this_ptr: &mut QueryShortChannelIds, mut val: crate::c_types::ThirtyTwoBytes) {
3430 unsafe { &mut *this_ptr.inner }.chain_hash = ::bitcoin::hash_types::BlockHash::from_slice(&val.data[..]).unwrap();
3432 /// The short_channel_ids that are being queried
3434 pub extern "C" fn QueryShortChannelIds_set_short_channel_ids(this_ptr: &mut QueryShortChannelIds, mut val: crate::c_types::derived::CVec_u64Z) {
3435 let mut local_val = Vec::new(); for mut item in val.into_rust().drain(..) { local_val.push( { item }); };
3436 unsafe { &mut *this_ptr.inner }.short_channel_ids = local_val;
3440 pub extern "C" fn QueryShortChannelIds_new(mut chain_hash_arg: crate::c_types::ThirtyTwoBytes, mut short_channel_ids_arg: crate::c_types::derived::CVec_u64Z) -> QueryShortChannelIds {
3441 let mut local_short_channel_ids_arg = Vec::new(); for mut item in short_channel_ids_arg.into_rust().drain(..) { local_short_channel_ids_arg.push( { item }); };
3442 QueryShortChannelIds { inner: Box::into_raw(Box::new(nativeQueryShortChannelIds {
3443 chain_hash: ::bitcoin::hash_types::BlockHash::from_slice(&chain_hash_arg.data[..]).unwrap(),
3444 short_channel_ids: local_short_channel_ids_arg,
3445 })), is_owned: true }
3447 impl Clone for QueryShortChannelIds {
3448 fn clone(&self) -> Self {
3450 inner: if self.inner.is_null() { std::ptr::null_mut() } else {
3451 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
3457 /// Used only if an object of this type is returned as a trait impl by a method
3458 pub(crate) extern "C" fn QueryShortChannelIds_clone_void(this_ptr: *const c_void) -> *mut c_void {
3459 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeQueryShortChannelIds)).clone() })) as *mut c_void
3462 pub extern "C" fn QueryShortChannelIds_clone(orig: &QueryShortChannelIds) -> QueryShortChannelIds {
3466 use lightning::ln::msgs::ReplyShortChannelIdsEnd as nativeReplyShortChannelIdsEndImport;
3467 type nativeReplyShortChannelIdsEnd = nativeReplyShortChannelIdsEndImport;
3469 /// A reply_short_channel_ids_end message is sent as a reply to a
3470 /// query_short_channel_ids message. The query recipient makes a best
3471 /// effort to respond based on their local network view which may not be
3472 /// a perfect view of the network.
3475 pub struct ReplyShortChannelIdsEnd {
3476 /// Nearly everywhere, inner must be non-null, however in places where
3477 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
3478 pub inner: *mut nativeReplyShortChannelIdsEnd,
3482 impl Drop for ReplyShortChannelIdsEnd {
3483 fn drop(&mut self) {
3484 if self.is_owned && !self.inner.is_null() {
3485 let _ = unsafe { Box::from_raw(self.inner) };
3490 pub extern "C" fn ReplyShortChannelIdsEnd_free(this_ptr: ReplyShortChannelIdsEnd) { }
3492 /// Used only if an object of this type is returned as a trait impl by a method
3493 extern "C" fn ReplyShortChannelIdsEnd_free_void(this_ptr: *mut c_void) {
3494 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeReplyShortChannelIdsEnd); }
3497 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
3498 impl ReplyShortChannelIdsEnd {
3499 pub(crate) fn take_inner(mut self) -> *mut nativeReplyShortChannelIdsEnd {
3500 assert!(self.is_owned);
3501 let ret = self.inner;
3502 self.inner = std::ptr::null_mut();
3506 /// The genesis hash of the blockchain that was queried
3508 pub extern "C" fn ReplyShortChannelIdsEnd_get_chain_hash(this_ptr: &ReplyShortChannelIdsEnd) -> *const [u8; 32] {
3509 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.chain_hash;
3510 (*inner_val).as_inner()
3512 /// The genesis hash of the blockchain that was queried
3514 pub extern "C" fn ReplyShortChannelIdsEnd_set_chain_hash(this_ptr: &mut ReplyShortChannelIdsEnd, mut val: crate::c_types::ThirtyTwoBytes) {
3515 unsafe { &mut *this_ptr.inner }.chain_hash = ::bitcoin::hash_types::BlockHash::from_slice(&val.data[..]).unwrap();
3517 /// Indicates if the query recipient maintains up-to-date channel
3518 /// information for the chain_hash
3520 pub extern "C" fn ReplyShortChannelIdsEnd_get_full_information(this_ptr: &ReplyShortChannelIdsEnd) -> bool {
3521 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.full_information;
3524 /// Indicates if the query recipient maintains up-to-date channel
3525 /// information for the chain_hash
3527 pub extern "C" fn ReplyShortChannelIdsEnd_set_full_information(this_ptr: &mut ReplyShortChannelIdsEnd, mut val: bool) {
3528 unsafe { &mut *this_ptr.inner }.full_information = val;
3532 pub extern "C" fn ReplyShortChannelIdsEnd_new(mut chain_hash_arg: crate::c_types::ThirtyTwoBytes, mut full_information_arg: bool) -> ReplyShortChannelIdsEnd {
3533 ReplyShortChannelIdsEnd { inner: Box::into_raw(Box::new(nativeReplyShortChannelIdsEnd {
3534 chain_hash: ::bitcoin::hash_types::BlockHash::from_slice(&chain_hash_arg.data[..]).unwrap(),
3535 full_information: full_information_arg,
3536 })), is_owned: true }
3538 impl Clone for ReplyShortChannelIdsEnd {
3539 fn clone(&self) -> Self {
3541 inner: if self.inner.is_null() { std::ptr::null_mut() } else {
3542 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
3548 /// Used only if an object of this type is returned as a trait impl by a method
3549 pub(crate) extern "C" fn ReplyShortChannelIdsEnd_clone_void(this_ptr: *const c_void) -> *mut c_void {
3550 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeReplyShortChannelIdsEnd)).clone() })) as *mut c_void
3553 pub extern "C" fn ReplyShortChannelIdsEnd_clone(orig: &ReplyShortChannelIdsEnd) -> ReplyShortChannelIdsEnd {
3557 use lightning::ln::msgs::GossipTimestampFilter as nativeGossipTimestampFilterImport;
3558 type nativeGossipTimestampFilter = nativeGossipTimestampFilterImport;
3560 /// A gossip_timestamp_filter message is used by a node to request
3561 /// gossip relay for messages in the requested time range when the
3562 /// gossip_queries feature has been negotiated.
3565 pub struct GossipTimestampFilter {
3566 /// Nearly everywhere, inner must be non-null, however in places where
3567 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
3568 pub inner: *mut nativeGossipTimestampFilter,
3572 impl Drop for GossipTimestampFilter {
3573 fn drop(&mut self) {
3574 if self.is_owned && !self.inner.is_null() {
3575 let _ = unsafe { Box::from_raw(self.inner) };
3580 pub extern "C" fn GossipTimestampFilter_free(this_ptr: GossipTimestampFilter) { }
3582 /// Used only if an object of this type is returned as a trait impl by a method
3583 extern "C" fn GossipTimestampFilter_free_void(this_ptr: *mut c_void) {
3584 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeGossipTimestampFilter); }
3587 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
3588 impl GossipTimestampFilter {
3589 pub(crate) fn take_inner(mut self) -> *mut nativeGossipTimestampFilter {
3590 assert!(self.is_owned);
3591 let ret = self.inner;
3592 self.inner = std::ptr::null_mut();
3596 /// The genesis hash of the blockchain for channel and node information
3598 pub extern "C" fn GossipTimestampFilter_get_chain_hash(this_ptr: &GossipTimestampFilter) -> *const [u8; 32] {
3599 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.chain_hash;
3600 (*inner_val).as_inner()
3602 /// The genesis hash of the blockchain for channel and node information
3604 pub extern "C" fn GossipTimestampFilter_set_chain_hash(this_ptr: &mut GossipTimestampFilter, mut val: crate::c_types::ThirtyTwoBytes) {
3605 unsafe { &mut *this_ptr.inner }.chain_hash = ::bitcoin::hash_types::BlockHash::from_slice(&val.data[..]).unwrap();
3607 /// The starting unix timestamp
3609 pub extern "C" fn GossipTimestampFilter_get_first_timestamp(this_ptr: &GossipTimestampFilter) -> u32 {
3610 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.first_timestamp;
3613 /// The starting unix timestamp
3615 pub extern "C" fn GossipTimestampFilter_set_first_timestamp(this_ptr: &mut GossipTimestampFilter, mut val: u32) {
3616 unsafe { &mut *this_ptr.inner }.first_timestamp = val;
3618 /// The range of information in seconds
3620 pub extern "C" fn GossipTimestampFilter_get_timestamp_range(this_ptr: &GossipTimestampFilter) -> u32 {
3621 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.timestamp_range;
3624 /// The range of information in seconds
3626 pub extern "C" fn GossipTimestampFilter_set_timestamp_range(this_ptr: &mut GossipTimestampFilter, mut val: u32) {
3627 unsafe { &mut *this_ptr.inner }.timestamp_range = val;
3631 pub extern "C" fn GossipTimestampFilter_new(mut chain_hash_arg: crate::c_types::ThirtyTwoBytes, mut first_timestamp_arg: u32, mut timestamp_range_arg: u32) -> GossipTimestampFilter {
3632 GossipTimestampFilter { inner: Box::into_raw(Box::new(nativeGossipTimestampFilter {
3633 chain_hash: ::bitcoin::hash_types::BlockHash::from_slice(&chain_hash_arg.data[..]).unwrap(),
3634 first_timestamp: first_timestamp_arg,
3635 timestamp_range: timestamp_range_arg,
3636 })), is_owned: true }
3638 impl Clone for GossipTimestampFilter {
3639 fn clone(&self) -> Self {
3641 inner: if self.inner.is_null() { std::ptr::null_mut() } else {
3642 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
3648 /// Used only if an object of this type is returned as a trait impl by a method
3649 pub(crate) extern "C" fn GossipTimestampFilter_clone_void(this_ptr: *const c_void) -> *mut c_void {
3650 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeGossipTimestampFilter)).clone() })) as *mut c_void
3653 pub extern "C" fn GossipTimestampFilter_clone(orig: &GossipTimestampFilter) -> GossipTimestampFilter {
3656 /// Used to put an error message in a LightningError
3660 pub enum ErrorAction {
3661 /// The peer took some action which made us think they were useless. Disconnect them.
3663 msg: crate::ln::msgs::ErrorMessage,
3665 /// The peer did something harmless that we weren't able to process, just log and ignore
3667 /// The peer did something incorrect. Tell them.
3669 msg: crate::ln::msgs::ErrorMessage,
3672 use lightning::ln::msgs::ErrorAction as nativeErrorAction;
3675 pub(crate) fn to_native(&self) -> nativeErrorAction {
3677 ErrorAction::DisconnectPeer {ref msg, } => {
3678 let mut msg_nonref = (*msg).clone();
3679 let mut local_msg_nonref = if msg_nonref.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(msg_nonref.take_inner()) } }) };
3680 nativeErrorAction::DisconnectPeer {
3681 msg: local_msg_nonref,
3684 ErrorAction::IgnoreError => nativeErrorAction::IgnoreError,
3685 ErrorAction::SendErrorMessage {ref msg, } => {
3686 let mut msg_nonref = (*msg).clone();
3687 nativeErrorAction::SendErrorMessage {
3688 msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) },
3694 pub(crate) fn into_native(self) -> nativeErrorAction {
3696 ErrorAction::DisconnectPeer {mut msg, } => {
3697 let mut local_msg = if msg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(msg.take_inner()) } }) };
3698 nativeErrorAction::DisconnectPeer {
3702 ErrorAction::IgnoreError => nativeErrorAction::IgnoreError,
3703 ErrorAction::SendErrorMessage {mut msg, } => {
3704 nativeErrorAction::SendErrorMessage {
3705 msg: *unsafe { Box::from_raw(msg.take_inner()) },
3711 pub(crate) fn from_native(native: &nativeErrorAction) -> Self {
3713 nativeErrorAction::DisconnectPeer {ref msg, } => {
3714 let mut msg_nonref = (*msg).clone();
3715 let mut local_msg_nonref = crate::ln::msgs::ErrorMessage { inner: if msg_nonref.is_none() { std::ptr::null_mut() } else { { Box::into_raw(Box::new((msg_nonref.unwrap()))) } }, is_owned: true };
3716 ErrorAction::DisconnectPeer {
3717 msg: local_msg_nonref,
3720 nativeErrorAction::IgnoreError => ErrorAction::IgnoreError,
3721 nativeErrorAction::SendErrorMessage {ref msg, } => {
3722 let mut msg_nonref = (*msg).clone();
3723 ErrorAction::SendErrorMessage {
3724 msg: crate::ln::msgs::ErrorMessage { inner: Box::into_raw(Box::new(msg_nonref)), is_owned: true },
3730 pub(crate) fn native_into(native: nativeErrorAction) -> Self {
3732 nativeErrorAction::DisconnectPeer {mut msg, } => {
3733 let mut local_msg = crate::ln::msgs::ErrorMessage { inner: if msg.is_none() { std::ptr::null_mut() } else { { Box::into_raw(Box::new((msg.unwrap()))) } }, is_owned: true };
3734 ErrorAction::DisconnectPeer {
3738 nativeErrorAction::IgnoreError => ErrorAction::IgnoreError,
3739 nativeErrorAction::SendErrorMessage {mut msg, } => {
3740 ErrorAction::SendErrorMessage {
3741 msg: crate::ln::msgs::ErrorMessage { inner: Box::into_raw(Box::new(msg)), is_owned: true },
3748 pub extern "C" fn ErrorAction_free(this_ptr: ErrorAction) { }
3750 pub extern "C" fn ErrorAction_clone(orig: &ErrorAction) -> ErrorAction {
3754 use lightning::ln::msgs::LightningError as nativeLightningErrorImport;
3755 type nativeLightningError = nativeLightningErrorImport;
3757 /// An Err type for failure to process messages.
3760 pub struct LightningError {
3761 /// Nearly everywhere, inner must be non-null, however in places where
3762 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
3763 pub inner: *mut nativeLightningError,
3767 impl Drop for LightningError {
3768 fn drop(&mut self) {
3769 if self.is_owned && !self.inner.is_null() {
3770 let _ = unsafe { Box::from_raw(self.inner) };
3775 pub extern "C" fn LightningError_free(this_ptr: LightningError) { }
3777 /// Used only if an object of this type is returned as a trait impl by a method
3778 extern "C" fn LightningError_free_void(this_ptr: *mut c_void) {
3779 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeLightningError); }
3782 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
3783 impl LightningError {
3784 pub(crate) fn take_inner(mut self) -> *mut nativeLightningError {
3785 assert!(self.is_owned);
3786 let ret = self.inner;
3787 self.inner = std::ptr::null_mut();
3791 /// A human-readable message describing the error
3793 pub extern "C" fn LightningError_get_err(this_ptr: &LightningError) -> crate::c_types::Str {
3794 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.err;
3795 (*inner_val).as_str().into()
3797 /// A human-readable message describing the error
3799 pub extern "C" fn LightningError_set_err(this_ptr: &mut LightningError, mut val: crate::c_types::derived::CVec_u8Z) {
3800 unsafe { &mut *this_ptr.inner }.err = String::from_utf8(val.into_rust()).unwrap();
3802 /// The action which should be taken against the offending peer.
3804 pub extern "C" fn LightningError_get_action(this_ptr: &LightningError) -> crate::ln::msgs::ErrorAction {
3805 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.action;
3806 crate::ln::msgs::ErrorAction::from_native(&(*inner_val))
3808 /// The action which should be taken against the offending peer.
3810 pub extern "C" fn LightningError_set_action(this_ptr: &mut LightningError, mut val: crate::ln::msgs::ErrorAction) {
3811 unsafe { &mut *this_ptr.inner }.action = val.into_native();
3815 pub extern "C" fn LightningError_new(mut err_arg: crate::c_types::derived::CVec_u8Z, mut action_arg: crate::ln::msgs::ErrorAction) -> LightningError {
3816 LightningError { inner: Box::into_raw(Box::new(nativeLightningError {
3817 err: String::from_utf8(err_arg.into_rust()).unwrap(),
3818 action: action_arg.into_native(),
3819 })), is_owned: true }
3821 impl Clone for LightningError {
3822 fn clone(&self) -> Self {
3824 inner: if self.inner.is_null() { std::ptr::null_mut() } else {
3825 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
3831 /// Used only if an object of this type is returned as a trait impl by a method
3832 pub(crate) extern "C" fn LightningError_clone_void(this_ptr: *const c_void) -> *mut c_void {
3833 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeLightningError)).clone() })) as *mut c_void
3836 pub extern "C" fn LightningError_clone(orig: &LightningError) -> LightningError {
3840 use lightning::ln::msgs::CommitmentUpdate as nativeCommitmentUpdateImport;
3841 type nativeCommitmentUpdate = nativeCommitmentUpdateImport;
3843 /// Struct used to return values from revoke_and_ack messages, containing a bunch of commitment
3844 /// transaction updates if they were pending.
3847 pub struct CommitmentUpdate {
3848 /// Nearly everywhere, inner must be non-null, however in places where
3849 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
3850 pub inner: *mut nativeCommitmentUpdate,
3854 impl Drop for CommitmentUpdate {
3855 fn drop(&mut self) {
3856 if self.is_owned && !self.inner.is_null() {
3857 let _ = unsafe { Box::from_raw(self.inner) };
3862 pub extern "C" fn CommitmentUpdate_free(this_ptr: CommitmentUpdate) { }
3864 /// Used only if an object of this type is returned as a trait impl by a method
3865 extern "C" fn CommitmentUpdate_free_void(this_ptr: *mut c_void) {
3866 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeCommitmentUpdate); }
3869 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
3870 impl CommitmentUpdate {
3871 pub(crate) fn take_inner(mut self) -> *mut nativeCommitmentUpdate {
3872 assert!(self.is_owned);
3873 let ret = self.inner;
3874 self.inner = std::ptr::null_mut();
3878 /// update_add_htlc messages which should be sent
3880 pub extern "C" fn CommitmentUpdate_set_update_add_htlcs(this_ptr: &mut CommitmentUpdate, mut val: crate::c_types::derived::CVec_UpdateAddHTLCZ) {
3881 let mut local_val = Vec::new(); for mut item in val.into_rust().drain(..) { local_val.push( { *unsafe { Box::from_raw(item.take_inner()) } }); };
3882 unsafe { &mut *this_ptr.inner }.update_add_htlcs = local_val;
3884 /// update_fulfill_htlc messages which should be sent
3886 pub extern "C" fn CommitmentUpdate_set_update_fulfill_htlcs(this_ptr: &mut CommitmentUpdate, mut val: crate::c_types::derived::CVec_UpdateFulfillHTLCZ) {
3887 let mut local_val = Vec::new(); for mut item in val.into_rust().drain(..) { local_val.push( { *unsafe { Box::from_raw(item.take_inner()) } }); };
3888 unsafe { &mut *this_ptr.inner }.update_fulfill_htlcs = local_val;
3890 /// update_fail_htlc messages which should be sent
3892 pub extern "C" fn CommitmentUpdate_set_update_fail_htlcs(this_ptr: &mut CommitmentUpdate, mut val: crate::c_types::derived::CVec_UpdateFailHTLCZ) {
3893 let mut local_val = Vec::new(); for mut item in val.into_rust().drain(..) { local_val.push( { *unsafe { Box::from_raw(item.take_inner()) } }); };
3894 unsafe { &mut *this_ptr.inner }.update_fail_htlcs = local_val;
3896 /// update_fail_malformed_htlc messages which should be sent
3898 pub extern "C" fn CommitmentUpdate_set_update_fail_malformed_htlcs(this_ptr: &mut CommitmentUpdate, mut val: crate::c_types::derived::CVec_UpdateFailMalformedHTLCZ) {
3899 let mut local_val = Vec::new(); for mut item in val.into_rust().drain(..) { local_val.push( { *unsafe { Box::from_raw(item.take_inner()) } }); };
3900 unsafe { &mut *this_ptr.inner }.update_fail_malformed_htlcs = local_val;
3902 /// An update_fee message which should be sent
3904 pub extern "C" fn CommitmentUpdate_get_update_fee(this_ptr: &CommitmentUpdate) -> crate::ln::msgs::UpdateFee {
3905 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.update_fee;
3906 let mut local_inner_val = crate::ln::msgs::UpdateFee { inner: unsafe { (if inner_val.is_none() { std::ptr::null() } else { { (inner_val.as_ref().unwrap()) } } as *const _) as *mut _ }, is_owned: false };
3909 /// An update_fee message which should be sent
3911 pub extern "C" fn CommitmentUpdate_set_update_fee(this_ptr: &mut CommitmentUpdate, mut val: crate::ln::msgs::UpdateFee) {
3912 let mut local_val = if val.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(val.take_inner()) } }) };
3913 unsafe { &mut *this_ptr.inner }.update_fee = local_val;
3915 /// Finally, the commitment_signed message which should be sent
3917 pub extern "C" fn CommitmentUpdate_get_commitment_signed(this_ptr: &CommitmentUpdate) -> crate::ln::msgs::CommitmentSigned {
3918 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.commitment_signed;
3919 crate::ln::msgs::CommitmentSigned { inner: unsafe { ( (&((*inner_val)) as *const _) as *mut _) }, is_owned: false }
3921 /// Finally, the commitment_signed message which should be sent
3923 pub extern "C" fn CommitmentUpdate_set_commitment_signed(this_ptr: &mut CommitmentUpdate, mut val: crate::ln::msgs::CommitmentSigned) {
3924 unsafe { &mut *this_ptr.inner }.commitment_signed = *unsafe { Box::from_raw(val.take_inner()) };
3928 pub extern "C" fn CommitmentUpdate_new(mut update_add_htlcs_arg: crate::c_types::derived::CVec_UpdateAddHTLCZ, mut update_fulfill_htlcs_arg: crate::c_types::derived::CVec_UpdateFulfillHTLCZ, mut update_fail_htlcs_arg: crate::c_types::derived::CVec_UpdateFailHTLCZ, mut update_fail_malformed_htlcs_arg: crate::c_types::derived::CVec_UpdateFailMalformedHTLCZ, mut update_fee_arg: crate::ln::msgs::UpdateFee, mut commitment_signed_arg: crate::ln::msgs::CommitmentSigned) -> CommitmentUpdate {
3929 let mut local_update_add_htlcs_arg = Vec::new(); for mut item in update_add_htlcs_arg.into_rust().drain(..) { local_update_add_htlcs_arg.push( { *unsafe { Box::from_raw(item.take_inner()) } }); };
3930 let mut local_update_fulfill_htlcs_arg = Vec::new(); for mut item in update_fulfill_htlcs_arg.into_rust().drain(..) { local_update_fulfill_htlcs_arg.push( { *unsafe { Box::from_raw(item.take_inner()) } }); };
3931 let mut local_update_fail_htlcs_arg = Vec::new(); for mut item in update_fail_htlcs_arg.into_rust().drain(..) { local_update_fail_htlcs_arg.push( { *unsafe { Box::from_raw(item.take_inner()) } }); };
3932 let mut local_update_fail_malformed_htlcs_arg = Vec::new(); for mut item in update_fail_malformed_htlcs_arg.into_rust().drain(..) { local_update_fail_malformed_htlcs_arg.push( { *unsafe { Box::from_raw(item.take_inner()) } }); };
3933 let mut local_update_fee_arg = if update_fee_arg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(update_fee_arg.take_inner()) } }) };
3934 CommitmentUpdate { inner: Box::into_raw(Box::new(nativeCommitmentUpdate {
3935 update_add_htlcs: local_update_add_htlcs_arg,
3936 update_fulfill_htlcs: local_update_fulfill_htlcs_arg,
3937 update_fail_htlcs: local_update_fail_htlcs_arg,
3938 update_fail_malformed_htlcs: local_update_fail_malformed_htlcs_arg,
3939 update_fee: local_update_fee_arg,
3940 commitment_signed: *unsafe { Box::from_raw(commitment_signed_arg.take_inner()) },
3941 })), is_owned: true }
3943 impl Clone for CommitmentUpdate {
3944 fn clone(&self) -> Self {
3946 inner: if self.inner.is_null() { std::ptr::null_mut() } else {
3947 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
3953 /// Used only if an object of this type is returned as a trait impl by a method
3954 pub(crate) extern "C" fn CommitmentUpdate_clone_void(this_ptr: *const c_void) -> *mut c_void {
3955 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeCommitmentUpdate)).clone() })) as *mut c_void
3958 pub extern "C" fn CommitmentUpdate_clone(orig: &CommitmentUpdate) -> CommitmentUpdate {
3961 /// The information we received from a peer along the route of a payment we originated. This is
3962 /// returned by ChannelMessageHandler::handle_update_fail_htlc to be passed into
3963 /// RoutingMessageHandler::handle_htlc_fail_channel_update to update our network map.
3967 pub enum HTLCFailChannelUpdate {
3968 /// We received an error which included a full ChannelUpdate message.
3969 ChannelUpdateMessage {
3970 msg: crate::ln::msgs::ChannelUpdate,
3972 /// We received an error which indicated only that a channel has been closed
3974 short_channel_id: u64,
3977 /// We received an error which indicated only that a node has failed
3979 node_id: crate::c_types::PublicKey,
3983 use lightning::ln::msgs::HTLCFailChannelUpdate as nativeHTLCFailChannelUpdate;
3984 impl HTLCFailChannelUpdate {
3986 pub(crate) fn to_native(&self) -> nativeHTLCFailChannelUpdate {
3988 HTLCFailChannelUpdate::ChannelUpdateMessage {ref msg, } => {
3989 let mut msg_nonref = (*msg).clone();
3990 nativeHTLCFailChannelUpdate::ChannelUpdateMessage {
3991 msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) },
3994 HTLCFailChannelUpdate::ChannelClosed {ref short_channel_id, ref is_permanent, } => {
3995 let mut short_channel_id_nonref = (*short_channel_id).clone();
3996 let mut is_permanent_nonref = (*is_permanent).clone();
3997 nativeHTLCFailChannelUpdate::ChannelClosed {
3998 short_channel_id: short_channel_id_nonref,
3999 is_permanent: is_permanent_nonref,
4002 HTLCFailChannelUpdate::NodeFailure {ref node_id, ref is_permanent, } => {
4003 let mut node_id_nonref = (*node_id).clone();
4004 let mut is_permanent_nonref = (*is_permanent).clone();
4005 nativeHTLCFailChannelUpdate::NodeFailure {
4006 node_id: node_id_nonref.into_rust(),
4007 is_permanent: is_permanent_nonref,
4013 pub(crate) fn into_native(self) -> nativeHTLCFailChannelUpdate {
4015 HTLCFailChannelUpdate::ChannelUpdateMessage {mut msg, } => {
4016 nativeHTLCFailChannelUpdate::ChannelUpdateMessage {
4017 msg: *unsafe { Box::from_raw(msg.take_inner()) },
4020 HTLCFailChannelUpdate::ChannelClosed {mut short_channel_id, mut is_permanent, } => {
4021 nativeHTLCFailChannelUpdate::ChannelClosed {
4022 short_channel_id: short_channel_id,
4023 is_permanent: is_permanent,
4026 HTLCFailChannelUpdate::NodeFailure {mut node_id, mut is_permanent, } => {
4027 nativeHTLCFailChannelUpdate::NodeFailure {
4028 node_id: node_id.into_rust(),
4029 is_permanent: is_permanent,
4035 pub(crate) fn from_native(native: &nativeHTLCFailChannelUpdate) -> Self {
4037 nativeHTLCFailChannelUpdate::ChannelUpdateMessage {ref msg, } => {
4038 let mut msg_nonref = (*msg).clone();
4039 HTLCFailChannelUpdate::ChannelUpdateMessage {
4040 msg: crate::ln::msgs::ChannelUpdate { inner: Box::into_raw(Box::new(msg_nonref)), is_owned: true },
4043 nativeHTLCFailChannelUpdate::ChannelClosed {ref short_channel_id, ref is_permanent, } => {
4044 let mut short_channel_id_nonref = (*short_channel_id).clone();
4045 let mut is_permanent_nonref = (*is_permanent).clone();
4046 HTLCFailChannelUpdate::ChannelClosed {
4047 short_channel_id: short_channel_id_nonref,
4048 is_permanent: is_permanent_nonref,
4051 nativeHTLCFailChannelUpdate::NodeFailure {ref node_id, ref is_permanent, } => {
4052 let mut node_id_nonref = (*node_id).clone();
4053 let mut is_permanent_nonref = (*is_permanent).clone();
4054 HTLCFailChannelUpdate::NodeFailure {
4055 node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref),
4056 is_permanent: is_permanent_nonref,
4062 pub(crate) fn native_into(native: nativeHTLCFailChannelUpdate) -> Self {
4064 nativeHTLCFailChannelUpdate::ChannelUpdateMessage {mut msg, } => {
4065 HTLCFailChannelUpdate::ChannelUpdateMessage {
4066 msg: crate::ln::msgs::ChannelUpdate { inner: Box::into_raw(Box::new(msg)), is_owned: true },
4069 nativeHTLCFailChannelUpdate::ChannelClosed {mut short_channel_id, mut is_permanent, } => {
4070 HTLCFailChannelUpdate::ChannelClosed {
4071 short_channel_id: short_channel_id,
4072 is_permanent: is_permanent,
4075 nativeHTLCFailChannelUpdate::NodeFailure {mut node_id, mut is_permanent, } => {
4076 HTLCFailChannelUpdate::NodeFailure {
4077 node_id: crate::c_types::PublicKey::from_rust(&node_id),
4078 is_permanent: is_permanent,
4085 pub extern "C" fn HTLCFailChannelUpdate_free(this_ptr: HTLCFailChannelUpdate) { }
4087 pub extern "C" fn HTLCFailChannelUpdate_clone(orig: &HTLCFailChannelUpdate) -> HTLCFailChannelUpdate {
4090 /// A trait to describe an object which can receive channel messages.
4092 /// Messages MAY be called in parallel when they originate from different their_node_ids, however
4093 /// they MUST NOT be called in parallel when the two calls have the same their_node_id.
4095 pub struct ChannelMessageHandler {
4096 pub this_arg: *mut c_void,
4097 /// Handle an incoming open_channel message from the given peer.
4098 pub handle_open_channel: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, their_features: crate::ln::features::InitFeatures, msg: &crate::ln::msgs::OpenChannel),
4099 /// Handle an incoming accept_channel message from the given peer.
4100 pub handle_accept_channel: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, their_features: crate::ln::features::InitFeatures, msg: &crate::ln::msgs::AcceptChannel),
4101 /// Handle an incoming funding_created message from the given peer.
4102 pub handle_funding_created: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::FundingCreated),
4103 /// Handle an incoming funding_signed message from the given peer.
4104 pub handle_funding_signed: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::FundingSigned),
4105 /// Handle an incoming funding_locked message from the given peer.
4106 pub handle_funding_locked: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::FundingLocked),
4107 /// Handle an incoming shutdown message from the given peer.
4108 pub handle_shutdown: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::Shutdown),
4109 /// Handle an incoming closing_signed message from the given peer.
4110 pub handle_closing_signed: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::ClosingSigned),
4111 /// Handle an incoming update_add_htlc message from the given peer.
4112 pub handle_update_add_htlc: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::UpdateAddHTLC),
4113 /// Handle an incoming update_fulfill_htlc message from the given peer.
4114 pub handle_update_fulfill_htlc: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::UpdateFulfillHTLC),
4115 /// Handle an incoming update_fail_htlc message from the given peer.
4116 pub handle_update_fail_htlc: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::UpdateFailHTLC),
4117 /// Handle an incoming update_fail_malformed_htlc message from the given peer.
4118 pub handle_update_fail_malformed_htlc: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::UpdateFailMalformedHTLC),
4119 /// Handle an incoming commitment_signed message from the given peer.
4120 pub handle_commitment_signed: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::CommitmentSigned),
4121 /// Handle an incoming revoke_and_ack message from the given peer.
4122 pub handle_revoke_and_ack: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::RevokeAndACK),
4123 /// Handle an incoming update_fee message from the given peer.
4124 pub handle_update_fee: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::UpdateFee),
4125 /// Handle an incoming announcement_signatures message from the given peer.
4126 pub handle_announcement_signatures: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::AnnouncementSignatures),
4127 /// Indicates a connection to the peer failed/an existing connection was lost. If no connection
4128 /// is believed to be possible in the future (eg they're sending us messages we don't
4129 /// understand or indicate they require unknown feature bits), no_connection_possible is set
4130 /// and any outstanding channels should be failed.
4131 pub peer_disconnected: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, no_connection_possible: bool),
4132 /// Handle a peer reconnecting, possibly generating channel_reestablish message(s).
4133 pub peer_connected: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::Init),
4134 /// Handle an incoming channel_reestablish message from the given peer.
4135 pub handle_channel_reestablish: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::ChannelReestablish),
4136 /// Handle an incoming error message from the given peer.
4137 pub handle_error: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::ErrorMessage),
4138 pub MessageSendEventsProvider: crate::util::events::MessageSendEventsProvider,
4139 pub free: Option<extern "C" fn(this_arg: *mut c_void)>,
4141 impl lightning::util::events::MessageSendEventsProvider for ChannelMessageHandler {
4142 fn get_and_clear_pending_msg_events(&self) -> Vec<lightning::util::events::MessageSendEvent> {
4143 <crate::util::events::MessageSendEventsProvider as lightning::util::events::MessageSendEventsProvider>::get_and_clear_pending_msg_events(&self.MessageSendEventsProvider)
4146 unsafe impl Send for ChannelMessageHandler {}
4147 unsafe impl Sync for ChannelMessageHandler {}
4149 use lightning::ln::msgs::ChannelMessageHandler as rustChannelMessageHandler;
4150 impl rustChannelMessageHandler for ChannelMessageHandler {
4151 fn handle_open_channel(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, their_features: lightning::ln::features::InitFeatures, msg: &lightning::ln::msgs::OpenChannel) {
4152 (self.handle_open_channel)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), crate::ln::features::InitFeatures { inner: Box::into_raw(Box::new(their_features)), is_owned: true }, &crate::ln::msgs::OpenChannel { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false })
4154 fn handle_accept_channel(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, their_features: lightning::ln::features::InitFeatures, msg: &lightning::ln::msgs::AcceptChannel) {
4155 (self.handle_accept_channel)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), crate::ln::features::InitFeatures { inner: Box::into_raw(Box::new(their_features)), is_owned: true }, &crate::ln::msgs::AcceptChannel { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false })
4157 fn handle_funding_created(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, msg: &lightning::ln::msgs::FundingCreated) {
4158 (self.handle_funding_created)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::ln::msgs::FundingCreated { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false })
4160 fn handle_funding_signed(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, msg: &lightning::ln::msgs::FundingSigned) {
4161 (self.handle_funding_signed)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::ln::msgs::FundingSigned { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false })
4163 fn handle_funding_locked(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, msg: &lightning::ln::msgs::FundingLocked) {
4164 (self.handle_funding_locked)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::ln::msgs::FundingLocked { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false })
4166 fn handle_shutdown(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, msg: &lightning::ln::msgs::Shutdown) {
4167 (self.handle_shutdown)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::ln::msgs::Shutdown { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false })
4169 fn handle_closing_signed(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, msg: &lightning::ln::msgs::ClosingSigned) {
4170 (self.handle_closing_signed)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::ln::msgs::ClosingSigned { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false })
4172 fn handle_update_add_htlc(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, msg: &lightning::ln::msgs::UpdateAddHTLC) {
4173 (self.handle_update_add_htlc)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::ln::msgs::UpdateAddHTLC { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false })
4175 fn handle_update_fulfill_htlc(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, msg: &lightning::ln::msgs::UpdateFulfillHTLC) {
4176 (self.handle_update_fulfill_htlc)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::ln::msgs::UpdateFulfillHTLC { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false })
4178 fn handle_update_fail_htlc(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, msg: &lightning::ln::msgs::UpdateFailHTLC) {
4179 (self.handle_update_fail_htlc)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::ln::msgs::UpdateFailHTLC { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false })
4181 fn handle_update_fail_malformed_htlc(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, msg: &lightning::ln::msgs::UpdateFailMalformedHTLC) {
4182 (self.handle_update_fail_malformed_htlc)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::ln::msgs::UpdateFailMalformedHTLC { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false })
4184 fn handle_commitment_signed(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, msg: &lightning::ln::msgs::CommitmentSigned) {
4185 (self.handle_commitment_signed)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::ln::msgs::CommitmentSigned { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false })
4187 fn handle_revoke_and_ack(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, msg: &lightning::ln::msgs::RevokeAndACK) {
4188 (self.handle_revoke_and_ack)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::ln::msgs::RevokeAndACK { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false })
4190 fn handle_update_fee(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, msg: &lightning::ln::msgs::UpdateFee) {
4191 (self.handle_update_fee)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::ln::msgs::UpdateFee { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false })
4193 fn handle_announcement_signatures(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, msg: &lightning::ln::msgs::AnnouncementSignatures) {
4194 (self.handle_announcement_signatures)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::ln::msgs::AnnouncementSignatures { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false })
4196 fn peer_disconnected(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, no_connection_possible: bool) {
4197 (self.peer_disconnected)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), no_connection_possible)
4199 fn peer_connected(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, msg: &lightning::ln::msgs::Init) {
4200 (self.peer_connected)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::ln::msgs::Init { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false })
4202 fn handle_channel_reestablish(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, msg: &lightning::ln::msgs::ChannelReestablish) {
4203 (self.handle_channel_reestablish)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::ln::msgs::ChannelReestablish { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false })
4205 fn handle_error(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, msg: &lightning::ln::msgs::ErrorMessage) {
4206 (self.handle_error)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::ln::msgs::ErrorMessage { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false })
4210 // We're essentially a pointer already, or at least a set of pointers, so allow us to be used
4211 // directly as a Deref trait in higher-level structs:
4212 impl std::ops::Deref for ChannelMessageHandler {
4214 fn deref(&self) -> &Self {
4218 /// Calls the free function if one is set
4220 pub extern "C" fn ChannelMessageHandler_free(this_ptr: ChannelMessageHandler) { }
4221 impl Drop for ChannelMessageHandler {
4222 fn drop(&mut self) {
4223 if let Some(f) = self.free {
4228 /// A trait to describe an object which can receive routing messages.
4230 /// # Implementor DoS Warnings
4232 /// For `gossip_queries` messages there are potential DoS vectors when handling
4233 /// inbound queries. Implementors using an on-disk network graph should be aware of
4234 /// repeated disk I/O for queries accessing different parts of the network graph.
4236 pub struct RoutingMessageHandler {
4237 pub this_arg: *mut c_void,
4238 /// Handle an incoming node_announcement message, returning true if it should be forwarded on,
4239 /// false or returning an Err otherwise.
4241 pub handle_node_announcement: extern "C" fn (this_arg: *const c_void, msg: &crate::ln::msgs::NodeAnnouncement) -> crate::c_types::derived::CResult_boolLightningErrorZ,
4242 /// Handle a channel_announcement message, returning true if it should be forwarded on, false
4243 /// or returning an Err otherwise.
4245 pub handle_channel_announcement: extern "C" fn (this_arg: *const c_void, msg: &crate::ln::msgs::ChannelAnnouncement) -> crate::c_types::derived::CResult_boolLightningErrorZ,
4246 /// Handle an incoming channel_update message, returning true if it should be forwarded on,
4247 /// false or returning an Err otherwise.
4249 pub handle_channel_update: extern "C" fn (this_arg: *const c_void, msg: &crate::ln::msgs::ChannelUpdate) -> crate::c_types::derived::CResult_boolLightningErrorZ,
4250 /// Handle some updates to the route graph that we learned due to an outbound failed payment.
4251 pub handle_htlc_fail_channel_update: extern "C" fn (this_arg: *const c_void, update: &crate::ln::msgs::HTLCFailChannelUpdate),
4252 /// Gets a subset of the channel announcements and updates required to dump our routing table
4253 /// to a remote node, starting at the short_channel_id indicated by starting_point and
4254 /// including the batch_amount entries immediately higher in numerical value than starting_point.
4256 pub get_next_channel_announcements: extern "C" fn (this_arg: *const c_void, starting_point: u64, batch_amount: u8) -> crate::c_types::derived::CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ,
4257 /// Gets a subset of the node announcements required to dump our routing table to a remote node,
4258 /// starting at the node *after* the provided publickey and including batch_amount entries
4259 /// immediately higher (as defined by <PublicKey as Ord>::cmp) than starting_point.
4260 /// If None is provided for starting_point, we start at the first node.
4262 pub get_next_node_announcements: extern "C" fn (this_arg: *const c_void, starting_point: crate::c_types::PublicKey, batch_amount: u8) -> crate::c_types::derived::CVec_NodeAnnouncementZ,
4263 /// Called when a connection is established with a peer. This can be used to
4264 /// perform routing table synchronization using a strategy defined by the
4266 pub sync_routing_table: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, init: &crate::ln::msgs::Init),
4267 /// Handles the reply of a query we initiated to learn about channels
4268 /// for a given range of blocks. We can expect to receive one or more
4269 /// replies to a single query.
4271 pub handle_reply_channel_range: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: crate::ln::msgs::ReplyChannelRange) -> crate::c_types::derived::CResult_NoneLightningErrorZ,
4272 /// Handles the reply of a query we initiated asking for routing gossip
4273 /// messages for a list of channels. We should receive this message when
4274 /// a node has completed its best effort to send us the pertaining routing
4275 /// gossip messages.
4277 pub handle_reply_short_channel_ids_end: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: crate::ln::msgs::ReplyShortChannelIdsEnd) -> crate::c_types::derived::CResult_NoneLightningErrorZ,
4278 /// Handles when a peer asks us to send a list of short_channel_ids
4279 /// for the requested range of blocks.
4281 pub handle_query_channel_range: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: crate::ln::msgs::QueryChannelRange) -> crate::c_types::derived::CResult_NoneLightningErrorZ,
4282 /// Handles when a peer asks us to send routing gossip messages for a
4283 /// list of short_channel_ids.
4285 pub handle_query_short_channel_ids: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: crate::ln::msgs::QueryShortChannelIds) -> crate::c_types::derived::CResult_NoneLightningErrorZ,
4286 pub MessageSendEventsProvider: crate::util::events::MessageSendEventsProvider,
4287 pub free: Option<extern "C" fn(this_arg: *mut c_void)>,
4289 unsafe impl Send for RoutingMessageHandler {}
4290 unsafe impl Sync for RoutingMessageHandler {}
4291 impl lightning::util::events::MessageSendEventsProvider for RoutingMessageHandler {
4292 fn get_and_clear_pending_msg_events(&self) -> Vec<lightning::util::events::MessageSendEvent> {
4293 <crate::util::events::MessageSendEventsProvider as lightning::util::events::MessageSendEventsProvider>::get_and_clear_pending_msg_events(&self.MessageSendEventsProvider)
4297 use lightning::ln::msgs::RoutingMessageHandler as rustRoutingMessageHandler;
4298 impl rustRoutingMessageHandler for RoutingMessageHandler {
4299 fn handle_node_announcement(&self, msg: &lightning::ln::msgs::NodeAnnouncement) -> Result<bool, lightning::ln::msgs::LightningError> {
4300 let mut ret = (self.handle_node_announcement)(self.this_arg, &crate::ln::msgs::NodeAnnouncement { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false });
4301 let mut local_ret = match ret.result_ok { true => Ok( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }) }), false => Err( { *unsafe { Box::from_raw((*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).take_inner()) } })};
4304 fn handle_channel_announcement(&self, msg: &lightning::ln::msgs::ChannelAnnouncement) -> Result<bool, lightning::ln::msgs::LightningError> {
4305 let mut ret = (self.handle_channel_announcement)(self.this_arg, &crate::ln::msgs::ChannelAnnouncement { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false });
4306 let mut local_ret = match ret.result_ok { true => Ok( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }) }), false => Err( { *unsafe { Box::from_raw((*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).take_inner()) } })};
4309 fn handle_channel_update(&self, msg: &lightning::ln::msgs::ChannelUpdate) -> Result<bool, lightning::ln::msgs::LightningError> {
4310 let mut ret = (self.handle_channel_update)(self.this_arg, &crate::ln::msgs::ChannelUpdate { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false });
4311 let mut local_ret = match ret.result_ok { true => Ok( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }) }), false => Err( { *unsafe { Box::from_raw((*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).take_inner()) } })};
4314 fn handle_htlc_fail_channel_update(&self, update: &lightning::ln::msgs::HTLCFailChannelUpdate) {
4315 (self.handle_htlc_fail_channel_update)(self.this_arg, &crate::ln::msgs::HTLCFailChannelUpdate::from_native(&update))
4317 fn get_next_channel_announcements(&self, starting_point: u64, batch_amount: u8) -> Vec<(lightning::ln::msgs::ChannelAnnouncement, Option<lightning::ln::msgs::ChannelUpdate>, Option<lightning::ln::msgs::ChannelUpdate>)> {
4318 let mut ret = (self.get_next_channel_announcements)(self.this_arg, starting_point, batch_amount);
4319 let mut local_ret = Vec::new(); for mut item in ret.into_rust().drain(..) { local_ret.push( { let (mut orig_ret_0_0, mut orig_ret_0_1, mut orig_ret_0_2) = item.to_rust(); let mut local_orig_ret_0_1 = if orig_ret_0_1.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(orig_ret_0_1.take_inner()) } }) }; let mut local_orig_ret_0_2 = if orig_ret_0_2.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(orig_ret_0_2.take_inner()) } }) }; let mut local_ret_0 = (*unsafe { Box::from_raw(orig_ret_0_0.take_inner()) }, local_orig_ret_0_1, local_orig_ret_0_2); local_ret_0 }); };
4322 fn get_next_node_announcements(&self, starting_point: Option<&bitcoin::secp256k1::key::PublicKey>, batch_amount: u8) -> Vec<lightning::ln::msgs::NodeAnnouncement> {
4323 let mut local_starting_point = if starting_point.is_none() { crate::c_types::PublicKey::null() } else { { crate::c_types::PublicKey::from_rust(&(starting_point.unwrap())) } };
4324 let mut ret = (self.get_next_node_announcements)(self.this_arg, local_starting_point, batch_amount);
4325 let mut local_ret = Vec::new(); for mut item in ret.into_rust().drain(..) { local_ret.push( { *unsafe { Box::from_raw(item.take_inner()) } }); };
4328 fn sync_routing_table(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, init: &lightning::ln::msgs::Init) {
4329 (self.sync_routing_table)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::ln::msgs::Init { inner: unsafe { (init as *const _) as *mut _ }, is_owned: false })
4331 fn handle_reply_channel_range(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, msg: lightning::ln::msgs::ReplyChannelRange) -> Result<(), lightning::ln::msgs::LightningError> {
4332 let mut ret = (self.handle_reply_channel_range)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), crate::ln::msgs::ReplyChannelRange { inner: Box::into_raw(Box::new(msg)), is_owned: true });
4333 let mut local_ret = match ret.result_ok { true => Ok( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) })*/ }), false => Err( { *unsafe { Box::from_raw((*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).take_inner()) } })};
4336 fn handle_reply_short_channel_ids_end(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, msg: lightning::ln::msgs::ReplyShortChannelIdsEnd) -> Result<(), lightning::ln::msgs::LightningError> {
4337 let mut ret = (self.handle_reply_short_channel_ids_end)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), crate::ln::msgs::ReplyShortChannelIdsEnd { inner: Box::into_raw(Box::new(msg)), is_owned: true });
4338 let mut local_ret = match ret.result_ok { true => Ok( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) })*/ }), false => Err( { *unsafe { Box::from_raw((*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).take_inner()) } })};
4341 fn handle_query_channel_range(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, msg: lightning::ln::msgs::QueryChannelRange) -> Result<(), lightning::ln::msgs::LightningError> {
4342 let mut ret = (self.handle_query_channel_range)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), crate::ln::msgs::QueryChannelRange { inner: Box::into_raw(Box::new(msg)), is_owned: true });
4343 let mut local_ret = match ret.result_ok { true => Ok( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) })*/ }), false => Err( { *unsafe { Box::from_raw((*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).take_inner()) } })};
4346 fn handle_query_short_channel_ids(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, msg: lightning::ln::msgs::QueryShortChannelIds) -> Result<(), lightning::ln::msgs::LightningError> {
4347 let mut ret = (self.handle_query_short_channel_ids)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), crate::ln::msgs::QueryShortChannelIds { inner: Box::into_raw(Box::new(msg)), is_owned: true });
4348 let mut local_ret = match ret.result_ok { true => Ok( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) })*/ }), false => Err( { *unsafe { Box::from_raw((*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).take_inner()) } })};
4353 // We're essentially a pointer already, or at least a set of pointers, so allow us to be used
4354 // directly as a Deref trait in higher-level structs:
4355 impl std::ops::Deref for RoutingMessageHandler {
4357 fn deref(&self) -> &Self {
4361 /// Calls the free function if one is set
4363 pub extern "C" fn RoutingMessageHandler_free(this_ptr: RoutingMessageHandler) { }
4364 impl Drop for RoutingMessageHandler {
4365 fn drop(&mut self) {
4366 if let Some(f) = self.free {
4372 pub extern "C" fn AcceptChannel_write(obj: &AcceptChannel) -> crate::c_types::derived::CVec_u8Z {
4373 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
4376 pub(crate) extern "C" fn AcceptChannel_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
4377 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeAcceptChannel) })
4380 pub extern "C" fn AcceptChannel_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_AcceptChannelDecodeErrorZ {
4381 let res = crate::c_types::deserialize_obj(ser);
4382 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::ln::msgs::AcceptChannel { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
4386 pub extern "C" fn AnnouncementSignatures_write(obj: &AnnouncementSignatures) -> crate::c_types::derived::CVec_u8Z {
4387 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
4390 pub(crate) extern "C" fn AnnouncementSignatures_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
4391 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeAnnouncementSignatures) })
4394 pub extern "C" fn AnnouncementSignatures_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_AnnouncementSignaturesDecodeErrorZ {
4395 let res = crate::c_types::deserialize_obj(ser);
4396 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::ln::msgs::AnnouncementSignatures { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
4400 pub extern "C" fn ChannelReestablish_write(obj: &ChannelReestablish) -> crate::c_types::derived::CVec_u8Z {
4401 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
4404 pub(crate) extern "C" fn ChannelReestablish_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
4405 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeChannelReestablish) })
4408 pub extern "C" fn ChannelReestablish_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ChannelReestablishDecodeErrorZ {
4409 let res = crate::c_types::deserialize_obj(ser);
4410 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::ln::msgs::ChannelReestablish { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
4414 pub extern "C" fn ClosingSigned_write(obj: &ClosingSigned) -> crate::c_types::derived::CVec_u8Z {
4415 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
4418 pub(crate) extern "C" fn ClosingSigned_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
4419 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeClosingSigned) })
4422 pub extern "C" fn ClosingSigned_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ClosingSignedDecodeErrorZ {
4423 let res = crate::c_types::deserialize_obj(ser);
4424 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::ln::msgs::ClosingSigned { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
4428 pub extern "C" fn CommitmentSigned_write(obj: &CommitmentSigned) -> crate::c_types::derived::CVec_u8Z {
4429 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
4432 pub(crate) extern "C" fn CommitmentSigned_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
4433 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeCommitmentSigned) })
4436 pub extern "C" fn CommitmentSigned_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_CommitmentSignedDecodeErrorZ {
4437 let res = crate::c_types::deserialize_obj(ser);
4438 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::ln::msgs::CommitmentSigned { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
4442 pub extern "C" fn FundingCreated_write(obj: &FundingCreated) -> crate::c_types::derived::CVec_u8Z {
4443 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
4446 pub(crate) extern "C" fn FundingCreated_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
4447 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeFundingCreated) })
4450 pub extern "C" fn FundingCreated_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_FundingCreatedDecodeErrorZ {
4451 let res = crate::c_types::deserialize_obj(ser);
4452 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::ln::msgs::FundingCreated { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
4456 pub extern "C" fn FundingSigned_write(obj: &FundingSigned) -> crate::c_types::derived::CVec_u8Z {
4457 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
4460 pub(crate) extern "C" fn FundingSigned_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
4461 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeFundingSigned) })
4464 pub extern "C" fn FundingSigned_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_FundingSignedDecodeErrorZ {
4465 let res = crate::c_types::deserialize_obj(ser);
4466 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::ln::msgs::FundingSigned { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
4470 pub extern "C" fn FundingLocked_write(obj: &FundingLocked) -> crate::c_types::derived::CVec_u8Z {
4471 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
4474 pub(crate) extern "C" fn FundingLocked_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
4475 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeFundingLocked) })
4478 pub extern "C" fn FundingLocked_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_FundingLockedDecodeErrorZ {
4479 let res = crate::c_types::deserialize_obj(ser);
4480 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::ln::msgs::FundingLocked { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
4484 pub extern "C" fn Init_write(obj: &Init) -> crate::c_types::derived::CVec_u8Z {
4485 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
4488 pub(crate) extern "C" fn Init_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
4489 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeInit) })
4492 pub extern "C" fn Init_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_InitDecodeErrorZ {
4493 let res = crate::c_types::deserialize_obj(ser);
4494 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::ln::msgs::Init { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
4498 pub extern "C" fn OpenChannel_write(obj: &OpenChannel) -> crate::c_types::derived::CVec_u8Z {
4499 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
4502 pub(crate) extern "C" fn OpenChannel_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
4503 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeOpenChannel) })
4506 pub extern "C" fn OpenChannel_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_OpenChannelDecodeErrorZ {
4507 let res = crate::c_types::deserialize_obj(ser);
4508 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::ln::msgs::OpenChannel { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
4512 pub extern "C" fn RevokeAndACK_write(obj: &RevokeAndACK) -> crate::c_types::derived::CVec_u8Z {
4513 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
4516 pub(crate) extern "C" fn RevokeAndACK_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
4517 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeRevokeAndACK) })
4520 pub extern "C" fn RevokeAndACK_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_RevokeAndACKDecodeErrorZ {
4521 let res = crate::c_types::deserialize_obj(ser);
4522 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::ln::msgs::RevokeAndACK { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
4526 pub extern "C" fn Shutdown_write(obj: &Shutdown) -> crate::c_types::derived::CVec_u8Z {
4527 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
4530 pub(crate) extern "C" fn Shutdown_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
4531 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeShutdown) })
4534 pub extern "C" fn Shutdown_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ShutdownDecodeErrorZ {
4535 let res = crate::c_types::deserialize_obj(ser);
4536 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::ln::msgs::Shutdown { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
4540 pub extern "C" fn UpdateFailHTLC_write(obj: &UpdateFailHTLC) -> crate::c_types::derived::CVec_u8Z {
4541 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
4544 pub(crate) extern "C" fn UpdateFailHTLC_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
4545 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeUpdateFailHTLC) })
4548 pub extern "C" fn UpdateFailHTLC_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_UpdateFailHTLCDecodeErrorZ {
4549 let res = crate::c_types::deserialize_obj(ser);
4550 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::ln::msgs::UpdateFailHTLC { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
4554 pub extern "C" fn UpdateFailMalformedHTLC_write(obj: &UpdateFailMalformedHTLC) -> crate::c_types::derived::CVec_u8Z {
4555 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
4558 pub(crate) extern "C" fn UpdateFailMalformedHTLC_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
4559 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeUpdateFailMalformedHTLC) })
4562 pub extern "C" fn UpdateFailMalformedHTLC_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_UpdateFailMalformedHTLCDecodeErrorZ {
4563 let res = crate::c_types::deserialize_obj(ser);
4564 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::ln::msgs::UpdateFailMalformedHTLC { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
4568 pub extern "C" fn UpdateFee_write(obj: &UpdateFee) -> crate::c_types::derived::CVec_u8Z {
4569 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
4572 pub(crate) extern "C" fn UpdateFee_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
4573 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeUpdateFee) })
4576 pub extern "C" fn UpdateFee_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_UpdateFeeDecodeErrorZ {
4577 let res = crate::c_types::deserialize_obj(ser);
4578 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::ln::msgs::UpdateFee { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
4582 pub extern "C" fn UpdateFulfillHTLC_write(obj: &UpdateFulfillHTLC) -> crate::c_types::derived::CVec_u8Z {
4583 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
4586 pub(crate) extern "C" fn UpdateFulfillHTLC_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
4587 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeUpdateFulfillHTLC) })
4590 pub extern "C" fn UpdateFulfillHTLC_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_UpdateFulfillHTLCDecodeErrorZ {
4591 let res = crate::c_types::deserialize_obj(ser);
4592 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::ln::msgs::UpdateFulfillHTLC { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
4596 pub extern "C" fn UpdateAddHTLC_write(obj: &UpdateAddHTLC) -> crate::c_types::derived::CVec_u8Z {
4597 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
4600 pub(crate) extern "C" fn UpdateAddHTLC_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
4601 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeUpdateAddHTLC) })
4604 pub extern "C" fn UpdateAddHTLC_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_UpdateAddHTLCDecodeErrorZ {
4605 let res = crate::c_types::deserialize_obj(ser);
4606 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::ln::msgs::UpdateAddHTLC { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
4610 pub extern "C" fn Ping_write(obj: &Ping) -> crate::c_types::derived::CVec_u8Z {
4611 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
4614 pub(crate) extern "C" fn Ping_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
4615 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativePing) })
4618 pub extern "C" fn Ping_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_PingDecodeErrorZ {
4619 let res = crate::c_types::deserialize_obj(ser);
4620 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::ln::msgs::Ping { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
4624 pub extern "C" fn Pong_write(obj: &Pong) -> crate::c_types::derived::CVec_u8Z {
4625 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
4628 pub(crate) extern "C" fn Pong_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
4629 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativePong) })
4632 pub extern "C" fn Pong_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_PongDecodeErrorZ {
4633 let res = crate::c_types::deserialize_obj(ser);
4634 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::ln::msgs::Pong { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
4638 pub extern "C" fn UnsignedChannelAnnouncement_write(obj: &UnsignedChannelAnnouncement) -> crate::c_types::derived::CVec_u8Z {
4639 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
4642 pub(crate) extern "C" fn UnsignedChannelAnnouncement_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
4643 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeUnsignedChannelAnnouncement) })
4646 pub extern "C" fn UnsignedChannelAnnouncement_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_UnsignedChannelAnnouncementDecodeErrorZ {
4647 let res = crate::c_types::deserialize_obj(ser);
4648 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::ln::msgs::UnsignedChannelAnnouncement { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
4652 pub extern "C" fn ChannelAnnouncement_write(obj: &ChannelAnnouncement) -> crate::c_types::derived::CVec_u8Z {
4653 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
4656 pub(crate) extern "C" fn ChannelAnnouncement_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
4657 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeChannelAnnouncement) })
4660 pub extern "C" fn ChannelAnnouncement_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ChannelAnnouncementDecodeErrorZ {
4661 let res = crate::c_types::deserialize_obj(ser);
4662 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::ln::msgs::ChannelAnnouncement { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
4666 pub extern "C" fn UnsignedChannelUpdate_write(obj: &UnsignedChannelUpdate) -> crate::c_types::derived::CVec_u8Z {
4667 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
4670 pub(crate) extern "C" fn UnsignedChannelUpdate_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
4671 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeUnsignedChannelUpdate) })
4674 pub extern "C" fn UnsignedChannelUpdate_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_UnsignedChannelUpdateDecodeErrorZ {
4675 let res = crate::c_types::deserialize_obj(ser);
4676 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::ln::msgs::UnsignedChannelUpdate { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
4680 pub extern "C" fn ChannelUpdate_write(obj: &ChannelUpdate) -> crate::c_types::derived::CVec_u8Z {
4681 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
4684 pub(crate) extern "C" fn ChannelUpdate_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
4685 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeChannelUpdate) })
4688 pub extern "C" fn ChannelUpdate_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ChannelUpdateDecodeErrorZ {
4689 let res = crate::c_types::deserialize_obj(ser);
4690 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::ln::msgs::ChannelUpdate { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
4694 pub extern "C" fn ErrorMessage_write(obj: &ErrorMessage) -> crate::c_types::derived::CVec_u8Z {
4695 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
4698 pub(crate) extern "C" fn ErrorMessage_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
4699 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeErrorMessage) })
4702 pub extern "C" fn ErrorMessage_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ErrorMessageDecodeErrorZ {
4703 let res = crate::c_types::deserialize_obj(ser);
4704 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::ln::msgs::ErrorMessage { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
4708 pub extern "C" fn UnsignedNodeAnnouncement_write(obj: &UnsignedNodeAnnouncement) -> crate::c_types::derived::CVec_u8Z {
4709 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
4712 pub(crate) extern "C" fn UnsignedNodeAnnouncement_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
4713 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeUnsignedNodeAnnouncement) })
4716 pub extern "C" fn UnsignedNodeAnnouncement_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_UnsignedNodeAnnouncementDecodeErrorZ {
4717 let res = crate::c_types::deserialize_obj(ser);
4718 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::ln::msgs::UnsignedNodeAnnouncement { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
4722 pub extern "C" fn NodeAnnouncement_write(obj: &NodeAnnouncement) -> crate::c_types::derived::CVec_u8Z {
4723 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
4726 pub(crate) extern "C" fn NodeAnnouncement_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
4727 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeNodeAnnouncement) })
4730 pub extern "C" fn NodeAnnouncement_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_NodeAnnouncementDecodeErrorZ {
4731 let res = crate::c_types::deserialize_obj(ser);
4732 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::ln::msgs::NodeAnnouncement { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
4736 pub extern "C" fn QueryShortChannelIds_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_QueryShortChannelIdsDecodeErrorZ {
4737 let res = crate::c_types::deserialize_obj(ser);
4738 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::ln::msgs::QueryShortChannelIds { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
4742 pub extern "C" fn QueryShortChannelIds_write(obj: &QueryShortChannelIds) -> crate::c_types::derived::CVec_u8Z {
4743 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
4746 pub(crate) extern "C" fn QueryShortChannelIds_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
4747 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeQueryShortChannelIds) })
4750 pub extern "C" fn ReplyShortChannelIdsEnd_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ReplyShortChannelIdsEndDecodeErrorZ {
4751 let res = crate::c_types::deserialize_obj(ser);
4752 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::ln::msgs::ReplyShortChannelIdsEnd { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
4756 pub extern "C" fn ReplyShortChannelIdsEnd_write(obj: &ReplyShortChannelIdsEnd) -> crate::c_types::derived::CVec_u8Z {
4757 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
4760 pub(crate) extern "C" fn ReplyShortChannelIdsEnd_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
4761 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeReplyShortChannelIdsEnd) })
4764 pub extern "C" fn QueryChannelRange_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_QueryChannelRangeDecodeErrorZ {
4765 let res = crate::c_types::deserialize_obj(ser);
4766 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::ln::msgs::QueryChannelRange { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
4770 pub extern "C" fn QueryChannelRange_write(obj: &QueryChannelRange) -> crate::c_types::derived::CVec_u8Z {
4771 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
4774 pub(crate) extern "C" fn QueryChannelRange_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
4775 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeQueryChannelRange) })
4778 pub extern "C" fn ReplyChannelRange_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ReplyChannelRangeDecodeErrorZ {
4779 let res = crate::c_types::deserialize_obj(ser);
4780 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::ln::msgs::ReplyChannelRange { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
4784 pub extern "C" fn ReplyChannelRange_write(obj: &ReplyChannelRange) -> crate::c_types::derived::CVec_u8Z {
4785 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
4788 pub(crate) extern "C" fn ReplyChannelRange_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
4789 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeReplyChannelRange) })
4792 pub extern "C" fn GossipTimestampFilter_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_GossipTimestampFilterDecodeErrorZ {
4793 let res = crate::c_types::deserialize_obj(ser);
4794 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::ln::msgs::GossipTimestampFilter { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
4798 pub extern "C" fn GossipTimestampFilter_write(obj: &GossipTimestampFilter) -> crate::c_types::derived::CVec_u8Z {
4799 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
4802 pub(crate) extern "C" fn GossipTimestampFilter_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
4803 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeGossipTimestampFilter) })