1 // This file is Copyright its original authors, visible in version control
2 // history and in the source files from which this was generated.
4 // This file is licensed under the license available in the LICENSE or LICENSE.md
5 // file in the root of this repository or, if no such file exists, the same
6 // license as that which applies to the original source files from which this
7 // source was automatically generated.
9 //! Wire messages, traits representing wire message handlers, and a few error types live here.
11 //! For a normal node you probably don't need to use anything here, however, if you wish to split a
12 //! node into an internet-facing route/message socket handling daemon and a separate daemon (or
13 //! server entirely) which handles only channel-related messages you may wish to implement
14 //! ChannelMessageHandler yourself and use it to re-serialize messages and pass them across
17 //! Note that if you go with such an architecture (instead of passing raw socket events to a
18 //! non-internet-facing system) you trust the frontend internet-facing system to not lie about the
19 //! source node_id of the message, however this does allow you to significantly reduce bandwidth
20 //! between the systems as routing messages can represent a significant chunk of bandwidth usage
21 //! (especially for non-channel-publicly-announcing nodes). As an alternate design which avoids
22 //! this issue, if you have sufficient bidirectional bandwidth between your systems, you may send
23 //! raw socket events into your non-internet-facing system and then send routing events back to
24 //! track the network on the less-secure system.
27 use bitcoin::hashes::Hash;
28 use crate::c_types::*;
31 use lightning::ln::msgs::DecodeError as nativeDecodeErrorImport;
32 type nativeDecodeError = nativeDecodeErrorImport;
34 /// An error in decoding a message or struct.
37 pub struct DecodeError {
38 /// A pointer to the opaque Rust object.
40 /// Nearly everywhere, inner must be non-null, however in places where
41 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
42 pub inner: *mut nativeDecodeError,
43 /// Indicates that this is the only struct which contains the same pointer.
45 /// Rust functions which take ownership of an object provided via an argument require
46 /// this to be true and invalidate the object pointed to by inner.
50 impl Drop for DecodeError {
52 if self.is_owned && !<*mut nativeDecodeError>::is_null(self.inner) {
53 let _ = unsafe { Box::from_raw(self.inner) };
57 /// Frees any resources used by the DecodeError, if is_owned is set and inner is non-NULL.
59 pub extern "C" fn DecodeError_free(this_obj: DecodeError) { }
61 /// Used only if an object of this type is returned as a trait impl by a method
62 extern "C" fn DecodeError_free_void(this_ptr: *mut c_void) {
63 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeDecodeError); }
66 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
68 pub(crate) fn take_inner(mut self) -> *mut nativeDecodeError {
69 assert!(self.is_owned);
71 self.inner = std::ptr::null_mut();
75 impl Clone for DecodeError {
76 fn clone(&self) -> Self {
78 inner: if <*mut nativeDecodeError>::is_null(self.inner) { std::ptr::null_mut() } else {
79 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
85 /// Used only if an object of this type is returned as a trait impl by a method
86 pub(crate) extern "C" fn DecodeError_clone_void(this_ptr: *const c_void) -> *mut c_void {
87 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeDecodeError)).clone() })) as *mut c_void
90 /// Creates a copy of the DecodeError
91 pub extern "C" fn DecodeError_clone(orig: &DecodeError) -> DecodeError {
95 use lightning::ln::msgs::Init as nativeInitImport;
96 type nativeInit = nativeInitImport;
98 /// An init message to be sent or received from a peer
102 /// A pointer to the opaque Rust object.
104 /// Nearly everywhere, inner must be non-null, however in places where
105 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
106 pub inner: *mut nativeInit,
107 /// Indicates that this is the only struct which contains the same pointer.
109 /// Rust functions which take ownership of an object provided via an argument require
110 /// this to be true and invalidate the object pointed to by inner.
116 if self.is_owned && !<*mut nativeInit>::is_null(self.inner) {
117 let _ = unsafe { Box::from_raw(self.inner) };
121 /// Frees any resources used by the Init, if is_owned is set and inner is non-NULL.
123 pub extern "C" fn Init_free(this_obj: Init) { }
125 /// Used only if an object of this type is returned as a trait impl by a method
126 extern "C" fn Init_free_void(this_ptr: *mut c_void) {
127 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeInit); }
130 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
132 pub(crate) fn take_inner(mut self) -> *mut nativeInit {
133 assert!(self.is_owned);
134 let ret = self.inner;
135 self.inner = std::ptr::null_mut();
139 /// The relevant features which the sender supports
141 pub extern "C" fn Init_get_features(this_ptr: &Init) -> crate::lightning::ln::features::InitFeatures {
142 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.features;
143 crate::lightning::ln::features::InitFeatures { inner: unsafe { ( (&((*inner_val)) as *const _) as *mut _) }, is_owned: false }
145 /// The relevant features which the sender supports
147 pub extern "C" fn Init_set_features(this_ptr: &mut Init, mut val: crate::lightning::ln::features::InitFeatures) {
148 unsafe { &mut *this_ptr.inner }.features = *unsafe { Box::from_raw(val.take_inner()) };
150 /// Constructs a new Init given each field
153 pub extern "C" fn Init_new(mut features_arg: crate::lightning::ln::features::InitFeatures) -> Init {
154 Init { inner: Box::into_raw(Box::new(nativeInit {
155 features: *unsafe { Box::from_raw(features_arg.take_inner()) },
156 })), is_owned: true }
158 impl Clone for Init {
159 fn clone(&self) -> Self {
161 inner: if <*mut nativeInit>::is_null(self.inner) { std::ptr::null_mut() } else {
162 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
168 /// Used only if an object of this type is returned as a trait impl by a method
169 pub(crate) extern "C" fn Init_clone_void(this_ptr: *const c_void) -> *mut c_void {
170 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeInit)).clone() })) as *mut c_void
173 /// Creates a copy of the Init
174 pub extern "C" fn Init_clone(orig: &Init) -> Init {
178 use lightning::ln::msgs::ErrorMessage as nativeErrorMessageImport;
179 type nativeErrorMessage = nativeErrorMessageImport;
181 /// An error message to be sent or received from a peer
184 pub struct ErrorMessage {
185 /// A pointer to the opaque Rust object.
187 /// Nearly everywhere, inner must be non-null, however in places where
188 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
189 pub inner: *mut nativeErrorMessage,
190 /// Indicates that this is the only struct which contains the same pointer.
192 /// Rust functions which take ownership of an object provided via an argument require
193 /// this to be true and invalidate the object pointed to by inner.
197 impl Drop for ErrorMessage {
199 if self.is_owned && !<*mut nativeErrorMessage>::is_null(self.inner) {
200 let _ = unsafe { Box::from_raw(self.inner) };
204 /// Frees any resources used by the ErrorMessage, if is_owned is set and inner is non-NULL.
206 pub extern "C" fn ErrorMessage_free(this_obj: ErrorMessage) { }
208 /// Used only if an object of this type is returned as a trait impl by a method
209 extern "C" fn ErrorMessage_free_void(this_ptr: *mut c_void) {
210 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeErrorMessage); }
213 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
215 pub(crate) fn take_inner(mut self) -> *mut nativeErrorMessage {
216 assert!(self.is_owned);
217 let ret = self.inner;
218 self.inner = std::ptr::null_mut();
222 /// The channel ID involved in the error
224 pub extern "C" fn ErrorMessage_get_channel_id(this_ptr: &ErrorMessage) -> *const [u8; 32] {
225 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_id;
228 /// The channel ID involved in the error
230 pub extern "C" fn ErrorMessage_set_channel_id(this_ptr: &mut ErrorMessage, mut val: crate::c_types::ThirtyTwoBytes) {
231 unsafe { &mut *this_ptr.inner }.channel_id = val.data;
233 /// A possibly human-readable error description.
234 /// The string should be sanitized before it is used (e.g. emitted to logs
235 /// or printed to stdout). Otherwise, a well crafted error message may trigger a security
236 /// vulnerability in the terminal emulator or the logging subsystem.
238 pub extern "C" fn ErrorMessage_get_data(this_ptr: &ErrorMessage) -> crate::c_types::Str {
239 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.data;
240 (*inner_val).as_str().into()
242 /// A possibly human-readable error description.
243 /// The string should be sanitized before it is used (e.g. emitted to logs
244 /// or printed to stdout). Otherwise, a well crafted error message may trigger a security
245 /// vulnerability in the terminal emulator or the logging subsystem.
247 pub extern "C" fn ErrorMessage_set_data(this_ptr: &mut ErrorMessage, mut val: crate::c_types::derived::CVec_u8Z) {
248 unsafe { &mut *this_ptr.inner }.data = String::from_utf8(val.into_rust()).unwrap();
250 /// Constructs a new ErrorMessage given each field
253 pub extern "C" fn ErrorMessage_new(mut channel_id_arg: crate::c_types::ThirtyTwoBytes, mut data_arg: crate::c_types::derived::CVec_u8Z) -> ErrorMessage {
254 ErrorMessage { inner: Box::into_raw(Box::new(nativeErrorMessage {
255 channel_id: channel_id_arg.data,
256 data: String::from_utf8(data_arg.into_rust()).unwrap(),
257 })), is_owned: true }
259 impl Clone for ErrorMessage {
260 fn clone(&self) -> Self {
262 inner: if <*mut nativeErrorMessage>::is_null(self.inner) { std::ptr::null_mut() } else {
263 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
269 /// Used only if an object of this type is returned as a trait impl by a method
270 pub(crate) extern "C" fn ErrorMessage_clone_void(this_ptr: *const c_void) -> *mut c_void {
271 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeErrorMessage)).clone() })) as *mut c_void
274 /// Creates a copy of the ErrorMessage
275 pub extern "C" fn ErrorMessage_clone(orig: &ErrorMessage) -> ErrorMessage {
279 use lightning::ln::msgs::Ping as nativePingImport;
280 type nativePing = nativePingImport;
282 /// A ping message to be sent or received from a peer
286 /// A pointer to the opaque Rust object.
288 /// Nearly everywhere, inner must be non-null, however in places where
289 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
290 pub inner: *mut nativePing,
291 /// Indicates that this is the only struct which contains the same pointer.
293 /// Rust functions which take ownership of an object provided via an argument require
294 /// this to be true and invalidate the object pointed to by inner.
300 if self.is_owned && !<*mut nativePing>::is_null(self.inner) {
301 let _ = unsafe { Box::from_raw(self.inner) };
305 /// Frees any resources used by the Ping, if is_owned is set and inner is non-NULL.
307 pub extern "C" fn Ping_free(this_obj: Ping) { }
309 /// Used only if an object of this type is returned as a trait impl by a method
310 extern "C" fn Ping_free_void(this_ptr: *mut c_void) {
311 unsafe { let _ = Box::from_raw(this_ptr as *mut nativePing); }
314 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
316 pub(crate) fn take_inner(mut self) -> *mut nativePing {
317 assert!(self.is_owned);
318 let ret = self.inner;
319 self.inner = std::ptr::null_mut();
323 /// The desired response length
325 pub extern "C" fn Ping_get_ponglen(this_ptr: &Ping) -> u16 {
326 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.ponglen;
329 /// The desired response length
331 pub extern "C" fn Ping_set_ponglen(this_ptr: &mut Ping, mut val: u16) {
332 unsafe { &mut *this_ptr.inner }.ponglen = val;
334 /// The ping packet size.
335 /// This field is not sent on the wire. byteslen zeros are sent.
337 pub extern "C" fn Ping_get_byteslen(this_ptr: &Ping) -> u16 {
338 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.byteslen;
341 /// The ping packet size.
342 /// This field is not sent on the wire. byteslen zeros are sent.
344 pub extern "C" fn Ping_set_byteslen(this_ptr: &mut Ping, mut val: u16) {
345 unsafe { &mut *this_ptr.inner }.byteslen = val;
347 /// Constructs a new Ping given each field
350 pub extern "C" fn Ping_new(mut ponglen_arg: u16, mut byteslen_arg: u16) -> Ping {
351 Ping { inner: Box::into_raw(Box::new(nativePing {
352 ponglen: ponglen_arg,
353 byteslen: byteslen_arg,
354 })), is_owned: true }
356 impl Clone for Ping {
357 fn clone(&self) -> Self {
359 inner: if <*mut nativePing>::is_null(self.inner) { std::ptr::null_mut() } else {
360 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
366 /// Used only if an object of this type is returned as a trait impl by a method
367 pub(crate) extern "C" fn Ping_clone_void(this_ptr: *const c_void) -> *mut c_void {
368 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativePing)).clone() })) as *mut c_void
371 /// Creates a copy of the Ping
372 pub extern "C" fn Ping_clone(orig: &Ping) -> Ping {
376 use lightning::ln::msgs::Pong as nativePongImport;
377 type nativePong = nativePongImport;
379 /// A pong message to be sent or received from a peer
383 /// A pointer to the opaque Rust object.
385 /// Nearly everywhere, inner must be non-null, however in places where
386 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
387 pub inner: *mut nativePong,
388 /// Indicates that this is the only struct which contains the same pointer.
390 /// Rust functions which take ownership of an object provided via an argument require
391 /// this to be true and invalidate the object pointed to by inner.
397 if self.is_owned && !<*mut nativePong>::is_null(self.inner) {
398 let _ = unsafe { Box::from_raw(self.inner) };
402 /// Frees any resources used by the Pong, if is_owned is set and inner is non-NULL.
404 pub extern "C" fn Pong_free(this_obj: Pong) { }
406 /// Used only if an object of this type is returned as a trait impl by a method
407 extern "C" fn Pong_free_void(this_ptr: *mut c_void) {
408 unsafe { let _ = Box::from_raw(this_ptr as *mut nativePong); }
411 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
413 pub(crate) fn take_inner(mut self) -> *mut nativePong {
414 assert!(self.is_owned);
415 let ret = self.inner;
416 self.inner = std::ptr::null_mut();
420 /// The pong packet size.
421 /// This field is not sent on the wire. byteslen zeros are sent.
423 pub extern "C" fn Pong_get_byteslen(this_ptr: &Pong) -> u16 {
424 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.byteslen;
427 /// The pong packet size.
428 /// This field is not sent on the wire. byteslen zeros are sent.
430 pub extern "C" fn Pong_set_byteslen(this_ptr: &mut Pong, mut val: u16) {
431 unsafe { &mut *this_ptr.inner }.byteslen = val;
433 /// Constructs a new Pong given each field
436 pub extern "C" fn Pong_new(mut byteslen_arg: u16) -> Pong {
437 Pong { inner: Box::into_raw(Box::new(nativePong {
438 byteslen: byteslen_arg,
439 })), is_owned: true }
441 impl Clone for Pong {
442 fn clone(&self) -> Self {
444 inner: if <*mut nativePong>::is_null(self.inner) { std::ptr::null_mut() } else {
445 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
451 /// Used only if an object of this type is returned as a trait impl by a method
452 pub(crate) extern "C" fn Pong_clone_void(this_ptr: *const c_void) -> *mut c_void {
453 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativePong)).clone() })) as *mut c_void
456 /// Creates a copy of the Pong
457 pub extern "C" fn Pong_clone(orig: &Pong) -> Pong {
461 use lightning::ln::msgs::OpenChannel as nativeOpenChannelImport;
462 type nativeOpenChannel = nativeOpenChannelImport;
464 /// An open_channel message to be sent or received from a peer
467 pub struct OpenChannel {
468 /// A pointer to the opaque Rust object.
470 /// Nearly everywhere, inner must be non-null, however in places where
471 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
472 pub inner: *mut nativeOpenChannel,
473 /// Indicates that this is the only struct which contains the same pointer.
475 /// Rust functions which take ownership of an object provided via an argument require
476 /// this to be true and invalidate the object pointed to by inner.
480 impl Drop for OpenChannel {
482 if self.is_owned && !<*mut nativeOpenChannel>::is_null(self.inner) {
483 let _ = unsafe { Box::from_raw(self.inner) };
487 /// Frees any resources used by the OpenChannel, if is_owned is set and inner is non-NULL.
489 pub extern "C" fn OpenChannel_free(this_obj: OpenChannel) { }
491 /// Used only if an object of this type is returned as a trait impl by a method
492 extern "C" fn OpenChannel_free_void(this_ptr: *mut c_void) {
493 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeOpenChannel); }
496 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
498 pub(crate) fn take_inner(mut self) -> *mut nativeOpenChannel {
499 assert!(self.is_owned);
500 let ret = self.inner;
501 self.inner = std::ptr::null_mut();
505 /// The genesis hash of the blockchain where the channel is to be opened
507 pub extern "C" fn OpenChannel_get_chain_hash(this_ptr: &OpenChannel) -> *const [u8; 32] {
508 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.chain_hash;
509 (*inner_val).as_inner()
511 /// The genesis hash of the blockchain where the channel is to be opened
513 pub extern "C" fn OpenChannel_set_chain_hash(this_ptr: &mut OpenChannel, mut val: crate::c_types::ThirtyTwoBytes) {
514 unsafe { &mut *this_ptr.inner }.chain_hash = ::bitcoin::hash_types::BlockHash::from_slice(&val.data[..]).unwrap();
516 /// A temporary channel ID, until the funding outpoint is announced
518 pub extern "C" fn OpenChannel_get_temporary_channel_id(this_ptr: &OpenChannel) -> *const [u8; 32] {
519 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.temporary_channel_id;
522 /// A temporary channel ID, until the funding outpoint is announced
524 pub extern "C" fn OpenChannel_set_temporary_channel_id(this_ptr: &mut OpenChannel, mut val: crate::c_types::ThirtyTwoBytes) {
525 unsafe { &mut *this_ptr.inner }.temporary_channel_id = val.data;
527 /// The channel value
529 pub extern "C" fn OpenChannel_get_funding_satoshis(this_ptr: &OpenChannel) -> u64 {
530 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.funding_satoshis;
533 /// The channel value
535 pub extern "C" fn OpenChannel_set_funding_satoshis(this_ptr: &mut OpenChannel, mut val: u64) {
536 unsafe { &mut *this_ptr.inner }.funding_satoshis = val;
538 /// The amount to push to the counterparty as part of the open, in milli-satoshi
540 pub extern "C" fn OpenChannel_get_push_msat(this_ptr: &OpenChannel) -> u64 {
541 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.push_msat;
544 /// The amount to push to the counterparty as part of the open, in milli-satoshi
546 pub extern "C" fn OpenChannel_set_push_msat(this_ptr: &mut OpenChannel, mut val: u64) {
547 unsafe { &mut *this_ptr.inner }.push_msat = val;
549 /// The threshold below which outputs on transactions broadcast by sender will be omitted
551 pub extern "C" fn OpenChannel_get_dust_limit_satoshis(this_ptr: &OpenChannel) -> u64 {
552 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.dust_limit_satoshis;
555 /// The threshold below which outputs on transactions broadcast by sender will be omitted
557 pub extern "C" fn OpenChannel_set_dust_limit_satoshis(this_ptr: &mut OpenChannel, mut val: u64) {
558 unsafe { &mut *this_ptr.inner }.dust_limit_satoshis = val;
560 /// The maximum inbound HTLC value in flight towards sender, in milli-satoshi
562 pub extern "C" fn OpenChannel_get_max_htlc_value_in_flight_msat(this_ptr: &OpenChannel) -> u64 {
563 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.max_htlc_value_in_flight_msat;
566 /// The maximum inbound HTLC value in flight towards sender, in milli-satoshi
568 pub extern "C" fn OpenChannel_set_max_htlc_value_in_flight_msat(this_ptr: &mut OpenChannel, mut val: u64) {
569 unsafe { &mut *this_ptr.inner }.max_htlc_value_in_flight_msat = val;
571 /// The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
573 pub extern "C" fn OpenChannel_get_channel_reserve_satoshis(this_ptr: &OpenChannel) -> u64 {
574 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_reserve_satoshis;
577 /// The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
579 pub extern "C" fn OpenChannel_set_channel_reserve_satoshis(this_ptr: &mut OpenChannel, mut val: u64) {
580 unsafe { &mut *this_ptr.inner }.channel_reserve_satoshis = val;
582 /// The minimum HTLC size incoming to sender, in milli-satoshi
584 pub extern "C" fn OpenChannel_get_htlc_minimum_msat(this_ptr: &OpenChannel) -> u64 {
585 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.htlc_minimum_msat;
588 /// The minimum HTLC size incoming to sender, in milli-satoshi
590 pub extern "C" fn OpenChannel_set_htlc_minimum_msat(this_ptr: &mut OpenChannel, mut val: u64) {
591 unsafe { &mut *this_ptr.inner }.htlc_minimum_msat = val;
593 /// The feerate per 1000-weight of sender generated transactions, until updated by update_fee
595 pub extern "C" fn OpenChannel_get_feerate_per_kw(this_ptr: &OpenChannel) -> u32 {
596 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.feerate_per_kw;
599 /// The feerate per 1000-weight of sender generated transactions, until updated by update_fee
601 pub extern "C" fn OpenChannel_set_feerate_per_kw(this_ptr: &mut OpenChannel, mut val: u32) {
602 unsafe { &mut *this_ptr.inner }.feerate_per_kw = val;
604 /// The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
606 pub extern "C" fn OpenChannel_get_to_self_delay(this_ptr: &OpenChannel) -> u16 {
607 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.to_self_delay;
610 /// The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
612 pub extern "C" fn OpenChannel_set_to_self_delay(this_ptr: &mut OpenChannel, mut val: u16) {
613 unsafe { &mut *this_ptr.inner }.to_self_delay = val;
615 /// The maximum number of inbound HTLCs towards sender
617 pub extern "C" fn OpenChannel_get_max_accepted_htlcs(this_ptr: &OpenChannel) -> u16 {
618 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.max_accepted_htlcs;
621 /// The maximum number of inbound HTLCs towards sender
623 pub extern "C" fn OpenChannel_set_max_accepted_htlcs(this_ptr: &mut OpenChannel, mut val: u16) {
624 unsafe { &mut *this_ptr.inner }.max_accepted_htlcs = val;
626 /// The sender's key controlling the funding transaction
628 pub extern "C" fn OpenChannel_get_funding_pubkey(this_ptr: &OpenChannel) -> crate::c_types::PublicKey {
629 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.funding_pubkey;
630 crate::c_types::PublicKey::from_rust(&(*inner_val))
632 /// The sender's key controlling the funding transaction
634 pub extern "C" fn OpenChannel_set_funding_pubkey(this_ptr: &mut OpenChannel, mut val: crate::c_types::PublicKey) {
635 unsafe { &mut *this_ptr.inner }.funding_pubkey = val.into_rust();
637 /// Used to derive a revocation key for transactions broadcast by counterparty
639 pub extern "C" fn OpenChannel_get_revocation_basepoint(this_ptr: &OpenChannel) -> crate::c_types::PublicKey {
640 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.revocation_basepoint;
641 crate::c_types::PublicKey::from_rust(&(*inner_val))
643 /// Used to derive a revocation key for transactions broadcast by counterparty
645 pub extern "C" fn OpenChannel_set_revocation_basepoint(this_ptr: &mut OpenChannel, mut val: crate::c_types::PublicKey) {
646 unsafe { &mut *this_ptr.inner }.revocation_basepoint = val.into_rust();
648 /// A payment key to sender for transactions broadcast by counterparty
650 pub extern "C" fn OpenChannel_get_payment_point(this_ptr: &OpenChannel) -> crate::c_types::PublicKey {
651 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.payment_point;
652 crate::c_types::PublicKey::from_rust(&(*inner_val))
654 /// A payment key to sender for transactions broadcast by counterparty
656 pub extern "C" fn OpenChannel_set_payment_point(this_ptr: &mut OpenChannel, mut val: crate::c_types::PublicKey) {
657 unsafe { &mut *this_ptr.inner }.payment_point = val.into_rust();
659 /// Used to derive a payment key to sender for transactions broadcast by sender
661 pub extern "C" fn OpenChannel_get_delayed_payment_basepoint(this_ptr: &OpenChannel) -> crate::c_types::PublicKey {
662 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.delayed_payment_basepoint;
663 crate::c_types::PublicKey::from_rust(&(*inner_val))
665 /// Used to derive a payment key to sender for transactions broadcast by sender
667 pub extern "C" fn OpenChannel_set_delayed_payment_basepoint(this_ptr: &mut OpenChannel, mut val: crate::c_types::PublicKey) {
668 unsafe { &mut *this_ptr.inner }.delayed_payment_basepoint = val.into_rust();
670 /// Used to derive an HTLC payment key to sender
672 pub extern "C" fn OpenChannel_get_htlc_basepoint(this_ptr: &OpenChannel) -> crate::c_types::PublicKey {
673 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.htlc_basepoint;
674 crate::c_types::PublicKey::from_rust(&(*inner_val))
676 /// Used to derive an HTLC payment key to sender
678 pub extern "C" fn OpenChannel_set_htlc_basepoint(this_ptr: &mut OpenChannel, mut val: crate::c_types::PublicKey) {
679 unsafe { &mut *this_ptr.inner }.htlc_basepoint = val.into_rust();
681 /// The first to-be-broadcast-by-sender transaction's per commitment point
683 pub extern "C" fn OpenChannel_get_first_per_commitment_point(this_ptr: &OpenChannel) -> crate::c_types::PublicKey {
684 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.first_per_commitment_point;
685 crate::c_types::PublicKey::from_rust(&(*inner_val))
687 /// The first to-be-broadcast-by-sender transaction's per commitment point
689 pub extern "C" fn OpenChannel_set_first_per_commitment_point(this_ptr: &mut OpenChannel, mut val: crate::c_types::PublicKey) {
690 unsafe { &mut *this_ptr.inner }.first_per_commitment_point = val.into_rust();
694 pub extern "C" fn OpenChannel_get_channel_flags(this_ptr: &OpenChannel) -> u8 {
695 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_flags;
700 pub extern "C" fn OpenChannel_set_channel_flags(this_ptr: &mut OpenChannel, mut val: u8) {
701 unsafe { &mut *this_ptr.inner }.channel_flags = val;
703 impl Clone for OpenChannel {
704 fn clone(&self) -> Self {
706 inner: if <*mut nativeOpenChannel>::is_null(self.inner) { std::ptr::null_mut() } else {
707 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
713 /// Used only if an object of this type is returned as a trait impl by a method
714 pub(crate) extern "C" fn OpenChannel_clone_void(this_ptr: *const c_void) -> *mut c_void {
715 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeOpenChannel)).clone() })) as *mut c_void
718 /// Creates a copy of the OpenChannel
719 pub extern "C" fn OpenChannel_clone(orig: &OpenChannel) -> OpenChannel {
723 use lightning::ln::msgs::AcceptChannel as nativeAcceptChannelImport;
724 type nativeAcceptChannel = nativeAcceptChannelImport;
726 /// An accept_channel message to be sent or received from a peer
729 pub struct AcceptChannel {
730 /// A pointer to the opaque Rust object.
732 /// Nearly everywhere, inner must be non-null, however in places where
733 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
734 pub inner: *mut nativeAcceptChannel,
735 /// Indicates that this is the only struct which contains the same pointer.
737 /// Rust functions which take ownership of an object provided via an argument require
738 /// this to be true and invalidate the object pointed to by inner.
742 impl Drop for AcceptChannel {
744 if self.is_owned && !<*mut nativeAcceptChannel>::is_null(self.inner) {
745 let _ = unsafe { Box::from_raw(self.inner) };
749 /// Frees any resources used by the AcceptChannel, if is_owned is set and inner is non-NULL.
751 pub extern "C" fn AcceptChannel_free(this_obj: AcceptChannel) { }
753 /// Used only if an object of this type is returned as a trait impl by a method
754 extern "C" fn AcceptChannel_free_void(this_ptr: *mut c_void) {
755 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeAcceptChannel); }
758 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
760 pub(crate) fn take_inner(mut self) -> *mut nativeAcceptChannel {
761 assert!(self.is_owned);
762 let ret = self.inner;
763 self.inner = std::ptr::null_mut();
767 /// A temporary channel ID, until the funding outpoint is announced
769 pub extern "C" fn AcceptChannel_get_temporary_channel_id(this_ptr: &AcceptChannel) -> *const [u8; 32] {
770 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.temporary_channel_id;
773 /// A temporary channel ID, until the funding outpoint is announced
775 pub extern "C" fn AcceptChannel_set_temporary_channel_id(this_ptr: &mut AcceptChannel, mut val: crate::c_types::ThirtyTwoBytes) {
776 unsafe { &mut *this_ptr.inner }.temporary_channel_id = val.data;
778 /// The threshold below which outputs on transactions broadcast by sender will be omitted
780 pub extern "C" fn AcceptChannel_get_dust_limit_satoshis(this_ptr: &AcceptChannel) -> u64 {
781 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.dust_limit_satoshis;
784 /// The threshold below which outputs on transactions broadcast by sender will be omitted
786 pub extern "C" fn AcceptChannel_set_dust_limit_satoshis(this_ptr: &mut AcceptChannel, mut val: u64) {
787 unsafe { &mut *this_ptr.inner }.dust_limit_satoshis = val;
789 /// The maximum inbound HTLC value in flight towards sender, in milli-satoshi
791 pub extern "C" fn AcceptChannel_get_max_htlc_value_in_flight_msat(this_ptr: &AcceptChannel) -> u64 {
792 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.max_htlc_value_in_flight_msat;
795 /// The maximum inbound HTLC value in flight towards sender, in milli-satoshi
797 pub extern "C" fn AcceptChannel_set_max_htlc_value_in_flight_msat(this_ptr: &mut AcceptChannel, mut val: u64) {
798 unsafe { &mut *this_ptr.inner }.max_htlc_value_in_flight_msat = val;
800 /// The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
802 pub extern "C" fn AcceptChannel_get_channel_reserve_satoshis(this_ptr: &AcceptChannel) -> u64 {
803 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_reserve_satoshis;
806 /// The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
808 pub extern "C" fn AcceptChannel_set_channel_reserve_satoshis(this_ptr: &mut AcceptChannel, mut val: u64) {
809 unsafe { &mut *this_ptr.inner }.channel_reserve_satoshis = val;
811 /// The minimum HTLC size incoming to sender, in milli-satoshi
813 pub extern "C" fn AcceptChannel_get_htlc_minimum_msat(this_ptr: &AcceptChannel) -> u64 {
814 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.htlc_minimum_msat;
817 /// The minimum HTLC size incoming to sender, in milli-satoshi
819 pub extern "C" fn AcceptChannel_set_htlc_minimum_msat(this_ptr: &mut AcceptChannel, mut val: u64) {
820 unsafe { &mut *this_ptr.inner }.htlc_minimum_msat = val;
822 /// Minimum depth of the funding transaction before the channel is considered open
824 pub extern "C" fn AcceptChannel_get_minimum_depth(this_ptr: &AcceptChannel) -> u32 {
825 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.minimum_depth;
828 /// Minimum depth of the funding transaction before the channel is considered open
830 pub extern "C" fn AcceptChannel_set_minimum_depth(this_ptr: &mut AcceptChannel, mut val: u32) {
831 unsafe { &mut *this_ptr.inner }.minimum_depth = val;
833 /// The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
835 pub extern "C" fn AcceptChannel_get_to_self_delay(this_ptr: &AcceptChannel) -> u16 {
836 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.to_self_delay;
839 /// The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
841 pub extern "C" fn AcceptChannel_set_to_self_delay(this_ptr: &mut AcceptChannel, mut val: u16) {
842 unsafe { &mut *this_ptr.inner }.to_self_delay = val;
844 /// The maximum number of inbound HTLCs towards sender
846 pub extern "C" fn AcceptChannel_get_max_accepted_htlcs(this_ptr: &AcceptChannel) -> u16 {
847 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.max_accepted_htlcs;
850 /// The maximum number of inbound HTLCs towards sender
852 pub extern "C" fn AcceptChannel_set_max_accepted_htlcs(this_ptr: &mut AcceptChannel, mut val: u16) {
853 unsafe { &mut *this_ptr.inner }.max_accepted_htlcs = val;
855 /// The sender's key controlling the funding transaction
857 pub extern "C" fn AcceptChannel_get_funding_pubkey(this_ptr: &AcceptChannel) -> crate::c_types::PublicKey {
858 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.funding_pubkey;
859 crate::c_types::PublicKey::from_rust(&(*inner_val))
861 /// The sender's key controlling the funding transaction
863 pub extern "C" fn AcceptChannel_set_funding_pubkey(this_ptr: &mut AcceptChannel, mut val: crate::c_types::PublicKey) {
864 unsafe { &mut *this_ptr.inner }.funding_pubkey = val.into_rust();
866 /// Used to derive a revocation key for transactions broadcast by counterparty
868 pub extern "C" fn AcceptChannel_get_revocation_basepoint(this_ptr: &AcceptChannel) -> crate::c_types::PublicKey {
869 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.revocation_basepoint;
870 crate::c_types::PublicKey::from_rust(&(*inner_val))
872 /// Used to derive a revocation key for transactions broadcast by counterparty
874 pub extern "C" fn AcceptChannel_set_revocation_basepoint(this_ptr: &mut AcceptChannel, mut val: crate::c_types::PublicKey) {
875 unsafe { &mut *this_ptr.inner }.revocation_basepoint = val.into_rust();
877 /// A payment key to sender for transactions broadcast by counterparty
879 pub extern "C" fn AcceptChannel_get_payment_point(this_ptr: &AcceptChannel) -> crate::c_types::PublicKey {
880 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.payment_point;
881 crate::c_types::PublicKey::from_rust(&(*inner_val))
883 /// A payment key to sender for transactions broadcast by counterparty
885 pub extern "C" fn AcceptChannel_set_payment_point(this_ptr: &mut AcceptChannel, mut val: crate::c_types::PublicKey) {
886 unsafe { &mut *this_ptr.inner }.payment_point = val.into_rust();
888 /// Used to derive a payment key to sender for transactions broadcast by sender
890 pub extern "C" fn AcceptChannel_get_delayed_payment_basepoint(this_ptr: &AcceptChannel) -> crate::c_types::PublicKey {
891 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.delayed_payment_basepoint;
892 crate::c_types::PublicKey::from_rust(&(*inner_val))
894 /// Used to derive a payment key to sender for transactions broadcast by sender
896 pub extern "C" fn AcceptChannel_set_delayed_payment_basepoint(this_ptr: &mut AcceptChannel, mut val: crate::c_types::PublicKey) {
897 unsafe { &mut *this_ptr.inner }.delayed_payment_basepoint = val.into_rust();
899 /// Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
901 pub extern "C" fn AcceptChannel_get_htlc_basepoint(this_ptr: &AcceptChannel) -> crate::c_types::PublicKey {
902 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.htlc_basepoint;
903 crate::c_types::PublicKey::from_rust(&(*inner_val))
905 /// Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
907 pub extern "C" fn AcceptChannel_set_htlc_basepoint(this_ptr: &mut AcceptChannel, mut val: crate::c_types::PublicKey) {
908 unsafe { &mut *this_ptr.inner }.htlc_basepoint = val.into_rust();
910 /// The first to-be-broadcast-by-sender transaction's per commitment point
912 pub extern "C" fn AcceptChannel_get_first_per_commitment_point(this_ptr: &AcceptChannel) -> crate::c_types::PublicKey {
913 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.first_per_commitment_point;
914 crate::c_types::PublicKey::from_rust(&(*inner_val))
916 /// The first to-be-broadcast-by-sender transaction's per commitment point
918 pub extern "C" fn AcceptChannel_set_first_per_commitment_point(this_ptr: &mut AcceptChannel, mut val: crate::c_types::PublicKey) {
919 unsafe { &mut *this_ptr.inner }.first_per_commitment_point = val.into_rust();
921 impl Clone for AcceptChannel {
922 fn clone(&self) -> Self {
924 inner: if <*mut nativeAcceptChannel>::is_null(self.inner) { std::ptr::null_mut() } else {
925 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
931 /// Used only if an object of this type is returned as a trait impl by a method
932 pub(crate) extern "C" fn AcceptChannel_clone_void(this_ptr: *const c_void) -> *mut c_void {
933 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeAcceptChannel)).clone() })) as *mut c_void
936 /// Creates a copy of the AcceptChannel
937 pub extern "C" fn AcceptChannel_clone(orig: &AcceptChannel) -> AcceptChannel {
941 use lightning::ln::msgs::FundingCreated as nativeFundingCreatedImport;
942 type nativeFundingCreated = nativeFundingCreatedImport;
944 /// A funding_created message to be sent or received from a peer
947 pub struct FundingCreated {
948 /// A pointer to the opaque Rust object.
950 /// Nearly everywhere, inner must be non-null, however in places where
951 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
952 pub inner: *mut nativeFundingCreated,
953 /// Indicates that this is the only struct which contains the same pointer.
955 /// Rust functions which take ownership of an object provided via an argument require
956 /// this to be true and invalidate the object pointed to by inner.
960 impl Drop for FundingCreated {
962 if self.is_owned && !<*mut nativeFundingCreated>::is_null(self.inner) {
963 let _ = unsafe { Box::from_raw(self.inner) };
967 /// Frees any resources used by the FundingCreated, if is_owned is set and inner is non-NULL.
969 pub extern "C" fn FundingCreated_free(this_obj: FundingCreated) { }
971 /// Used only if an object of this type is returned as a trait impl by a method
972 extern "C" fn FundingCreated_free_void(this_ptr: *mut c_void) {
973 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeFundingCreated); }
976 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
977 impl FundingCreated {
978 pub(crate) fn take_inner(mut self) -> *mut nativeFundingCreated {
979 assert!(self.is_owned);
980 let ret = self.inner;
981 self.inner = std::ptr::null_mut();
985 /// A temporary channel ID, until the funding is established
987 pub extern "C" fn FundingCreated_get_temporary_channel_id(this_ptr: &FundingCreated) -> *const [u8; 32] {
988 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.temporary_channel_id;
991 /// A temporary channel ID, until the funding is established
993 pub extern "C" fn FundingCreated_set_temporary_channel_id(this_ptr: &mut FundingCreated, mut val: crate::c_types::ThirtyTwoBytes) {
994 unsafe { &mut *this_ptr.inner }.temporary_channel_id = val.data;
996 /// The funding transaction ID
998 pub extern "C" fn FundingCreated_get_funding_txid(this_ptr: &FundingCreated) -> *const [u8; 32] {
999 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.funding_txid;
1000 (*inner_val).as_inner()
1002 /// The funding transaction ID
1004 pub extern "C" fn FundingCreated_set_funding_txid(this_ptr: &mut FundingCreated, mut val: crate::c_types::ThirtyTwoBytes) {
1005 unsafe { &mut *this_ptr.inner }.funding_txid = ::bitcoin::hash_types::Txid::from_slice(&val.data[..]).unwrap();
1007 /// The specific output index funding this channel
1009 pub extern "C" fn FundingCreated_get_funding_output_index(this_ptr: &FundingCreated) -> u16 {
1010 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.funding_output_index;
1013 /// The specific output index funding this channel
1015 pub extern "C" fn FundingCreated_set_funding_output_index(this_ptr: &mut FundingCreated, mut val: u16) {
1016 unsafe { &mut *this_ptr.inner }.funding_output_index = val;
1018 /// The signature of the channel initiator (funder) on the funding transaction
1020 pub extern "C" fn FundingCreated_get_signature(this_ptr: &FundingCreated) -> crate::c_types::Signature {
1021 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.signature;
1022 crate::c_types::Signature::from_rust(&(*inner_val))
1024 /// The signature of the channel initiator (funder) on the funding transaction
1026 pub extern "C" fn FundingCreated_set_signature(this_ptr: &mut FundingCreated, mut val: crate::c_types::Signature) {
1027 unsafe { &mut *this_ptr.inner }.signature = val.into_rust();
1029 /// Constructs a new FundingCreated given each field
1032 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 {
1033 FundingCreated { inner: Box::into_raw(Box::new(nativeFundingCreated {
1034 temporary_channel_id: temporary_channel_id_arg.data,
1035 funding_txid: ::bitcoin::hash_types::Txid::from_slice(&funding_txid_arg.data[..]).unwrap(),
1036 funding_output_index: funding_output_index_arg,
1037 signature: signature_arg.into_rust(),
1038 })), is_owned: true }
1040 impl Clone for FundingCreated {
1041 fn clone(&self) -> Self {
1043 inner: if <*mut nativeFundingCreated>::is_null(self.inner) { std::ptr::null_mut() } else {
1044 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
1050 /// Used only if an object of this type is returned as a trait impl by a method
1051 pub(crate) extern "C" fn FundingCreated_clone_void(this_ptr: *const c_void) -> *mut c_void {
1052 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeFundingCreated)).clone() })) as *mut c_void
1055 /// Creates a copy of the FundingCreated
1056 pub extern "C" fn FundingCreated_clone(orig: &FundingCreated) -> FundingCreated {
1060 use lightning::ln::msgs::FundingSigned as nativeFundingSignedImport;
1061 type nativeFundingSigned = nativeFundingSignedImport;
1063 /// A funding_signed message to be sent or received from a peer
1066 pub struct FundingSigned {
1067 /// A pointer to the opaque Rust object.
1069 /// Nearly everywhere, inner must be non-null, however in places where
1070 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
1071 pub inner: *mut nativeFundingSigned,
1072 /// Indicates that this is the only struct which contains the same pointer.
1074 /// Rust functions which take ownership of an object provided via an argument require
1075 /// this to be true and invalidate the object pointed to by inner.
1079 impl Drop for FundingSigned {
1080 fn drop(&mut self) {
1081 if self.is_owned && !<*mut nativeFundingSigned>::is_null(self.inner) {
1082 let _ = unsafe { Box::from_raw(self.inner) };
1086 /// Frees any resources used by the FundingSigned, if is_owned is set and inner is non-NULL.
1088 pub extern "C" fn FundingSigned_free(this_obj: FundingSigned) { }
1090 /// Used only if an object of this type is returned as a trait impl by a method
1091 extern "C" fn FundingSigned_free_void(this_ptr: *mut c_void) {
1092 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeFundingSigned); }
1095 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
1096 impl FundingSigned {
1097 pub(crate) fn take_inner(mut self) -> *mut nativeFundingSigned {
1098 assert!(self.is_owned);
1099 let ret = self.inner;
1100 self.inner = std::ptr::null_mut();
1106 pub extern "C" fn FundingSigned_get_channel_id(this_ptr: &FundingSigned) -> *const [u8; 32] {
1107 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_id;
1112 pub extern "C" fn FundingSigned_set_channel_id(this_ptr: &mut FundingSigned, mut val: crate::c_types::ThirtyTwoBytes) {
1113 unsafe { &mut *this_ptr.inner }.channel_id = val.data;
1115 /// The signature of the channel acceptor (fundee) on the funding transaction
1117 pub extern "C" fn FundingSigned_get_signature(this_ptr: &FundingSigned) -> crate::c_types::Signature {
1118 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.signature;
1119 crate::c_types::Signature::from_rust(&(*inner_val))
1121 /// The signature of the channel acceptor (fundee) on the funding transaction
1123 pub extern "C" fn FundingSigned_set_signature(this_ptr: &mut FundingSigned, mut val: crate::c_types::Signature) {
1124 unsafe { &mut *this_ptr.inner }.signature = val.into_rust();
1126 /// Constructs a new FundingSigned given each field
1129 pub extern "C" fn FundingSigned_new(mut channel_id_arg: crate::c_types::ThirtyTwoBytes, mut signature_arg: crate::c_types::Signature) -> FundingSigned {
1130 FundingSigned { inner: Box::into_raw(Box::new(nativeFundingSigned {
1131 channel_id: channel_id_arg.data,
1132 signature: signature_arg.into_rust(),
1133 })), is_owned: true }
1135 impl Clone for FundingSigned {
1136 fn clone(&self) -> Self {
1138 inner: if <*mut nativeFundingSigned>::is_null(self.inner) { std::ptr::null_mut() } else {
1139 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
1145 /// Used only if an object of this type is returned as a trait impl by a method
1146 pub(crate) extern "C" fn FundingSigned_clone_void(this_ptr: *const c_void) -> *mut c_void {
1147 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeFundingSigned)).clone() })) as *mut c_void
1150 /// Creates a copy of the FundingSigned
1151 pub extern "C" fn FundingSigned_clone(orig: &FundingSigned) -> FundingSigned {
1155 use lightning::ln::msgs::FundingLocked as nativeFundingLockedImport;
1156 type nativeFundingLocked = nativeFundingLockedImport;
1158 /// A funding_locked message to be sent or received from a peer
1161 pub struct FundingLocked {
1162 /// A pointer to the opaque Rust object.
1164 /// Nearly everywhere, inner must be non-null, however in places where
1165 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
1166 pub inner: *mut nativeFundingLocked,
1167 /// Indicates that this is the only struct which contains the same pointer.
1169 /// Rust functions which take ownership of an object provided via an argument require
1170 /// this to be true and invalidate the object pointed to by inner.
1174 impl Drop for FundingLocked {
1175 fn drop(&mut self) {
1176 if self.is_owned && !<*mut nativeFundingLocked>::is_null(self.inner) {
1177 let _ = unsafe { Box::from_raw(self.inner) };
1181 /// Frees any resources used by the FundingLocked, if is_owned is set and inner is non-NULL.
1183 pub extern "C" fn FundingLocked_free(this_obj: FundingLocked) { }
1185 /// Used only if an object of this type is returned as a trait impl by a method
1186 extern "C" fn FundingLocked_free_void(this_ptr: *mut c_void) {
1187 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeFundingLocked); }
1190 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
1191 impl FundingLocked {
1192 pub(crate) fn take_inner(mut self) -> *mut nativeFundingLocked {
1193 assert!(self.is_owned);
1194 let ret = self.inner;
1195 self.inner = std::ptr::null_mut();
1201 pub extern "C" fn FundingLocked_get_channel_id(this_ptr: &FundingLocked) -> *const [u8; 32] {
1202 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_id;
1207 pub extern "C" fn FundingLocked_set_channel_id(this_ptr: &mut FundingLocked, mut val: crate::c_types::ThirtyTwoBytes) {
1208 unsafe { &mut *this_ptr.inner }.channel_id = val.data;
1210 /// The per-commitment point of the second commitment transaction
1212 pub extern "C" fn FundingLocked_get_next_per_commitment_point(this_ptr: &FundingLocked) -> crate::c_types::PublicKey {
1213 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.next_per_commitment_point;
1214 crate::c_types::PublicKey::from_rust(&(*inner_val))
1216 /// The per-commitment point of the second commitment transaction
1218 pub extern "C" fn FundingLocked_set_next_per_commitment_point(this_ptr: &mut FundingLocked, mut val: crate::c_types::PublicKey) {
1219 unsafe { &mut *this_ptr.inner }.next_per_commitment_point = val.into_rust();
1221 /// Constructs a new FundingLocked given each field
1224 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 {
1225 FundingLocked { inner: Box::into_raw(Box::new(nativeFundingLocked {
1226 channel_id: channel_id_arg.data,
1227 next_per_commitment_point: next_per_commitment_point_arg.into_rust(),
1228 })), is_owned: true }
1230 impl Clone for FundingLocked {
1231 fn clone(&self) -> Self {
1233 inner: if <*mut nativeFundingLocked>::is_null(self.inner) { std::ptr::null_mut() } else {
1234 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
1240 /// Used only if an object of this type is returned as a trait impl by a method
1241 pub(crate) extern "C" fn FundingLocked_clone_void(this_ptr: *const c_void) -> *mut c_void {
1242 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeFundingLocked)).clone() })) as *mut c_void
1245 /// Creates a copy of the FundingLocked
1246 pub extern "C" fn FundingLocked_clone(orig: &FundingLocked) -> FundingLocked {
1250 use lightning::ln::msgs::Shutdown as nativeShutdownImport;
1251 type nativeShutdown = nativeShutdownImport;
1253 /// A shutdown message to be sent or received from a peer
1256 pub struct Shutdown {
1257 /// A pointer to the opaque Rust object.
1259 /// Nearly everywhere, inner must be non-null, however in places where
1260 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
1261 pub inner: *mut nativeShutdown,
1262 /// Indicates that this is the only struct which contains the same pointer.
1264 /// Rust functions which take ownership of an object provided via an argument require
1265 /// this to be true and invalidate the object pointed to by inner.
1269 impl Drop for Shutdown {
1270 fn drop(&mut self) {
1271 if self.is_owned && !<*mut nativeShutdown>::is_null(self.inner) {
1272 let _ = unsafe { Box::from_raw(self.inner) };
1276 /// Frees any resources used by the Shutdown, if is_owned is set and inner is non-NULL.
1278 pub extern "C" fn Shutdown_free(this_obj: Shutdown) { }
1280 /// Used only if an object of this type is returned as a trait impl by a method
1281 extern "C" fn Shutdown_free_void(this_ptr: *mut c_void) {
1282 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeShutdown); }
1285 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
1287 pub(crate) fn take_inner(mut self) -> *mut nativeShutdown {
1288 assert!(self.is_owned);
1289 let ret = self.inner;
1290 self.inner = std::ptr::null_mut();
1296 pub extern "C" fn Shutdown_get_channel_id(this_ptr: &Shutdown) -> *const [u8; 32] {
1297 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_id;
1302 pub extern "C" fn Shutdown_set_channel_id(this_ptr: &mut Shutdown, mut val: crate::c_types::ThirtyTwoBytes) {
1303 unsafe { &mut *this_ptr.inner }.channel_id = val.data;
1305 /// The destination of this peer's funds on closing.
1306 /// Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
1308 pub extern "C" fn Shutdown_get_scriptpubkey(this_ptr: &Shutdown) -> crate::c_types::u8slice {
1309 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.scriptpubkey;
1310 crate::c_types::u8slice::from_slice(&(*inner_val)[..])
1312 /// The destination of this peer's funds on closing.
1313 /// Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
1315 pub extern "C" fn Shutdown_set_scriptpubkey(this_ptr: &mut Shutdown, mut val: crate::c_types::derived::CVec_u8Z) {
1316 unsafe { &mut *this_ptr.inner }.scriptpubkey = ::bitcoin::blockdata::script::Script::from(val.into_rust());
1318 /// Constructs a new Shutdown given each field
1321 pub extern "C" fn Shutdown_new(mut channel_id_arg: crate::c_types::ThirtyTwoBytes, mut scriptpubkey_arg: crate::c_types::derived::CVec_u8Z) -> Shutdown {
1322 Shutdown { inner: Box::into_raw(Box::new(nativeShutdown {
1323 channel_id: channel_id_arg.data,
1324 scriptpubkey: ::bitcoin::blockdata::script::Script::from(scriptpubkey_arg.into_rust()),
1325 })), is_owned: true }
1327 impl Clone for Shutdown {
1328 fn clone(&self) -> Self {
1330 inner: if <*mut nativeShutdown>::is_null(self.inner) { std::ptr::null_mut() } else {
1331 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
1337 /// Used only if an object of this type is returned as a trait impl by a method
1338 pub(crate) extern "C" fn Shutdown_clone_void(this_ptr: *const c_void) -> *mut c_void {
1339 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeShutdown)).clone() })) as *mut c_void
1342 /// Creates a copy of the Shutdown
1343 pub extern "C" fn Shutdown_clone(orig: &Shutdown) -> Shutdown {
1347 use lightning::ln::msgs::ClosingSigned as nativeClosingSignedImport;
1348 type nativeClosingSigned = nativeClosingSignedImport;
1350 /// A closing_signed message to be sent or received from a peer
1353 pub struct ClosingSigned {
1354 /// A pointer to the opaque Rust object.
1356 /// Nearly everywhere, inner must be non-null, however in places where
1357 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
1358 pub inner: *mut nativeClosingSigned,
1359 /// Indicates that this is the only struct which contains the same pointer.
1361 /// Rust functions which take ownership of an object provided via an argument require
1362 /// this to be true and invalidate the object pointed to by inner.
1366 impl Drop for ClosingSigned {
1367 fn drop(&mut self) {
1368 if self.is_owned && !<*mut nativeClosingSigned>::is_null(self.inner) {
1369 let _ = unsafe { Box::from_raw(self.inner) };
1373 /// Frees any resources used by the ClosingSigned, if is_owned is set and inner is non-NULL.
1375 pub extern "C" fn ClosingSigned_free(this_obj: ClosingSigned) { }
1377 /// Used only if an object of this type is returned as a trait impl by a method
1378 extern "C" fn ClosingSigned_free_void(this_ptr: *mut c_void) {
1379 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeClosingSigned); }
1382 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
1383 impl ClosingSigned {
1384 pub(crate) fn take_inner(mut self) -> *mut nativeClosingSigned {
1385 assert!(self.is_owned);
1386 let ret = self.inner;
1387 self.inner = std::ptr::null_mut();
1393 pub extern "C" fn ClosingSigned_get_channel_id(this_ptr: &ClosingSigned) -> *const [u8; 32] {
1394 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_id;
1399 pub extern "C" fn ClosingSigned_set_channel_id(this_ptr: &mut ClosingSigned, mut val: crate::c_types::ThirtyTwoBytes) {
1400 unsafe { &mut *this_ptr.inner }.channel_id = val.data;
1402 /// The proposed total fee for the closing transaction
1404 pub extern "C" fn ClosingSigned_get_fee_satoshis(this_ptr: &ClosingSigned) -> u64 {
1405 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.fee_satoshis;
1408 /// The proposed total fee for the closing transaction
1410 pub extern "C" fn ClosingSigned_set_fee_satoshis(this_ptr: &mut ClosingSigned, mut val: u64) {
1411 unsafe { &mut *this_ptr.inner }.fee_satoshis = val;
1413 /// A signature on the closing transaction
1415 pub extern "C" fn ClosingSigned_get_signature(this_ptr: &ClosingSigned) -> crate::c_types::Signature {
1416 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.signature;
1417 crate::c_types::Signature::from_rust(&(*inner_val))
1419 /// A signature on the closing transaction
1421 pub extern "C" fn ClosingSigned_set_signature(this_ptr: &mut ClosingSigned, mut val: crate::c_types::Signature) {
1422 unsafe { &mut *this_ptr.inner }.signature = val.into_rust();
1424 /// Constructs a new ClosingSigned given each field
1427 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 {
1428 ClosingSigned { inner: Box::into_raw(Box::new(nativeClosingSigned {
1429 channel_id: channel_id_arg.data,
1430 fee_satoshis: fee_satoshis_arg,
1431 signature: signature_arg.into_rust(),
1432 })), is_owned: true }
1434 impl Clone for ClosingSigned {
1435 fn clone(&self) -> Self {
1437 inner: if <*mut nativeClosingSigned>::is_null(self.inner) { std::ptr::null_mut() } else {
1438 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
1444 /// Used only if an object of this type is returned as a trait impl by a method
1445 pub(crate) extern "C" fn ClosingSigned_clone_void(this_ptr: *const c_void) -> *mut c_void {
1446 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeClosingSigned)).clone() })) as *mut c_void
1449 /// Creates a copy of the ClosingSigned
1450 pub extern "C" fn ClosingSigned_clone(orig: &ClosingSigned) -> ClosingSigned {
1454 use lightning::ln::msgs::UpdateAddHTLC as nativeUpdateAddHTLCImport;
1455 type nativeUpdateAddHTLC = nativeUpdateAddHTLCImport;
1457 /// An update_add_htlc message to be sent or received from a peer
1460 pub struct UpdateAddHTLC {
1461 /// A pointer to the opaque Rust object.
1463 /// Nearly everywhere, inner must be non-null, however in places where
1464 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
1465 pub inner: *mut nativeUpdateAddHTLC,
1466 /// Indicates that this is the only struct which contains the same pointer.
1468 /// Rust functions which take ownership of an object provided via an argument require
1469 /// this to be true and invalidate the object pointed to by inner.
1473 impl Drop for UpdateAddHTLC {
1474 fn drop(&mut self) {
1475 if self.is_owned && !<*mut nativeUpdateAddHTLC>::is_null(self.inner) {
1476 let _ = unsafe { Box::from_raw(self.inner) };
1480 /// Frees any resources used by the UpdateAddHTLC, if is_owned is set and inner is non-NULL.
1482 pub extern "C" fn UpdateAddHTLC_free(this_obj: UpdateAddHTLC) { }
1484 /// Used only if an object of this type is returned as a trait impl by a method
1485 extern "C" fn UpdateAddHTLC_free_void(this_ptr: *mut c_void) {
1486 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeUpdateAddHTLC); }
1489 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
1490 impl UpdateAddHTLC {
1491 pub(crate) fn take_inner(mut self) -> *mut nativeUpdateAddHTLC {
1492 assert!(self.is_owned);
1493 let ret = self.inner;
1494 self.inner = std::ptr::null_mut();
1500 pub extern "C" fn UpdateAddHTLC_get_channel_id(this_ptr: &UpdateAddHTLC) -> *const [u8; 32] {
1501 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_id;
1506 pub extern "C" fn UpdateAddHTLC_set_channel_id(this_ptr: &mut UpdateAddHTLC, mut val: crate::c_types::ThirtyTwoBytes) {
1507 unsafe { &mut *this_ptr.inner }.channel_id = val.data;
1511 pub extern "C" fn UpdateAddHTLC_get_htlc_id(this_ptr: &UpdateAddHTLC) -> u64 {
1512 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.htlc_id;
1517 pub extern "C" fn UpdateAddHTLC_set_htlc_id(this_ptr: &mut UpdateAddHTLC, mut val: u64) {
1518 unsafe { &mut *this_ptr.inner }.htlc_id = val;
1520 /// The HTLC value in milli-satoshi
1522 pub extern "C" fn UpdateAddHTLC_get_amount_msat(this_ptr: &UpdateAddHTLC) -> u64 {
1523 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.amount_msat;
1526 /// The HTLC value in milli-satoshi
1528 pub extern "C" fn UpdateAddHTLC_set_amount_msat(this_ptr: &mut UpdateAddHTLC, mut val: u64) {
1529 unsafe { &mut *this_ptr.inner }.amount_msat = val;
1531 /// The payment hash, the pre-image of which controls HTLC redemption
1533 pub extern "C" fn UpdateAddHTLC_get_payment_hash(this_ptr: &UpdateAddHTLC) -> *const [u8; 32] {
1534 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.payment_hash;
1537 /// The payment hash, the pre-image of which controls HTLC redemption
1539 pub extern "C" fn UpdateAddHTLC_set_payment_hash(this_ptr: &mut UpdateAddHTLC, mut val: crate::c_types::ThirtyTwoBytes) {
1540 unsafe { &mut *this_ptr.inner }.payment_hash = ::lightning::ln::channelmanager::PaymentHash(val.data);
1542 /// The expiry height of the HTLC
1544 pub extern "C" fn UpdateAddHTLC_get_cltv_expiry(this_ptr: &UpdateAddHTLC) -> u32 {
1545 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.cltv_expiry;
1548 /// The expiry height of the HTLC
1550 pub extern "C" fn UpdateAddHTLC_set_cltv_expiry(this_ptr: &mut UpdateAddHTLC, mut val: u32) {
1551 unsafe { &mut *this_ptr.inner }.cltv_expiry = val;
1553 impl Clone for UpdateAddHTLC {
1554 fn clone(&self) -> Self {
1556 inner: if <*mut nativeUpdateAddHTLC>::is_null(self.inner) { std::ptr::null_mut() } else {
1557 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
1563 /// Used only if an object of this type is returned as a trait impl by a method
1564 pub(crate) extern "C" fn UpdateAddHTLC_clone_void(this_ptr: *const c_void) -> *mut c_void {
1565 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeUpdateAddHTLC)).clone() })) as *mut c_void
1568 /// Creates a copy of the UpdateAddHTLC
1569 pub extern "C" fn UpdateAddHTLC_clone(orig: &UpdateAddHTLC) -> UpdateAddHTLC {
1573 use lightning::ln::msgs::UpdateFulfillHTLC as nativeUpdateFulfillHTLCImport;
1574 type nativeUpdateFulfillHTLC = nativeUpdateFulfillHTLCImport;
1576 /// An update_fulfill_htlc message to be sent or received from a peer
1579 pub struct UpdateFulfillHTLC {
1580 /// A pointer to the opaque Rust object.
1582 /// Nearly everywhere, inner must be non-null, however in places where
1583 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
1584 pub inner: *mut nativeUpdateFulfillHTLC,
1585 /// Indicates that this is the only struct which contains the same pointer.
1587 /// Rust functions which take ownership of an object provided via an argument require
1588 /// this to be true and invalidate the object pointed to by inner.
1592 impl Drop for UpdateFulfillHTLC {
1593 fn drop(&mut self) {
1594 if self.is_owned && !<*mut nativeUpdateFulfillHTLC>::is_null(self.inner) {
1595 let _ = unsafe { Box::from_raw(self.inner) };
1599 /// Frees any resources used by the UpdateFulfillHTLC, if is_owned is set and inner is non-NULL.
1601 pub extern "C" fn UpdateFulfillHTLC_free(this_obj: UpdateFulfillHTLC) { }
1603 /// Used only if an object of this type is returned as a trait impl by a method
1604 extern "C" fn UpdateFulfillHTLC_free_void(this_ptr: *mut c_void) {
1605 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeUpdateFulfillHTLC); }
1608 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
1609 impl UpdateFulfillHTLC {
1610 pub(crate) fn take_inner(mut self) -> *mut nativeUpdateFulfillHTLC {
1611 assert!(self.is_owned);
1612 let ret = self.inner;
1613 self.inner = std::ptr::null_mut();
1619 pub extern "C" fn UpdateFulfillHTLC_get_channel_id(this_ptr: &UpdateFulfillHTLC) -> *const [u8; 32] {
1620 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_id;
1625 pub extern "C" fn UpdateFulfillHTLC_set_channel_id(this_ptr: &mut UpdateFulfillHTLC, mut val: crate::c_types::ThirtyTwoBytes) {
1626 unsafe { &mut *this_ptr.inner }.channel_id = val.data;
1630 pub extern "C" fn UpdateFulfillHTLC_get_htlc_id(this_ptr: &UpdateFulfillHTLC) -> u64 {
1631 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.htlc_id;
1636 pub extern "C" fn UpdateFulfillHTLC_set_htlc_id(this_ptr: &mut UpdateFulfillHTLC, mut val: u64) {
1637 unsafe { &mut *this_ptr.inner }.htlc_id = val;
1639 /// The pre-image of the payment hash, allowing HTLC redemption
1641 pub extern "C" fn UpdateFulfillHTLC_get_payment_preimage(this_ptr: &UpdateFulfillHTLC) -> *const [u8; 32] {
1642 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.payment_preimage;
1645 /// The pre-image of the payment hash, allowing HTLC redemption
1647 pub extern "C" fn UpdateFulfillHTLC_set_payment_preimage(this_ptr: &mut UpdateFulfillHTLC, mut val: crate::c_types::ThirtyTwoBytes) {
1648 unsafe { &mut *this_ptr.inner }.payment_preimage = ::lightning::ln::channelmanager::PaymentPreimage(val.data);
1650 /// Constructs a new UpdateFulfillHTLC given each field
1653 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 {
1654 UpdateFulfillHTLC { inner: Box::into_raw(Box::new(nativeUpdateFulfillHTLC {
1655 channel_id: channel_id_arg.data,
1656 htlc_id: htlc_id_arg,
1657 payment_preimage: ::lightning::ln::channelmanager::PaymentPreimage(payment_preimage_arg.data),
1658 })), is_owned: true }
1660 impl Clone for UpdateFulfillHTLC {
1661 fn clone(&self) -> Self {
1663 inner: if <*mut nativeUpdateFulfillHTLC>::is_null(self.inner) { std::ptr::null_mut() } else {
1664 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
1670 /// Used only if an object of this type is returned as a trait impl by a method
1671 pub(crate) extern "C" fn UpdateFulfillHTLC_clone_void(this_ptr: *const c_void) -> *mut c_void {
1672 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeUpdateFulfillHTLC)).clone() })) as *mut c_void
1675 /// Creates a copy of the UpdateFulfillHTLC
1676 pub extern "C" fn UpdateFulfillHTLC_clone(orig: &UpdateFulfillHTLC) -> UpdateFulfillHTLC {
1680 use lightning::ln::msgs::UpdateFailHTLC as nativeUpdateFailHTLCImport;
1681 type nativeUpdateFailHTLC = nativeUpdateFailHTLCImport;
1683 /// An update_fail_htlc message to be sent or received from a peer
1686 pub struct UpdateFailHTLC {
1687 /// A pointer to the opaque Rust object.
1689 /// Nearly everywhere, inner must be non-null, however in places where
1690 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
1691 pub inner: *mut nativeUpdateFailHTLC,
1692 /// Indicates that this is the only struct which contains the same pointer.
1694 /// Rust functions which take ownership of an object provided via an argument require
1695 /// this to be true and invalidate the object pointed to by inner.
1699 impl Drop for UpdateFailHTLC {
1700 fn drop(&mut self) {
1701 if self.is_owned && !<*mut nativeUpdateFailHTLC>::is_null(self.inner) {
1702 let _ = unsafe { Box::from_raw(self.inner) };
1706 /// Frees any resources used by the UpdateFailHTLC, if is_owned is set and inner is non-NULL.
1708 pub extern "C" fn UpdateFailHTLC_free(this_obj: UpdateFailHTLC) { }
1710 /// Used only if an object of this type is returned as a trait impl by a method
1711 extern "C" fn UpdateFailHTLC_free_void(this_ptr: *mut c_void) {
1712 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeUpdateFailHTLC); }
1715 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
1716 impl UpdateFailHTLC {
1717 pub(crate) fn take_inner(mut self) -> *mut nativeUpdateFailHTLC {
1718 assert!(self.is_owned);
1719 let ret = self.inner;
1720 self.inner = std::ptr::null_mut();
1726 pub extern "C" fn UpdateFailHTLC_get_channel_id(this_ptr: &UpdateFailHTLC) -> *const [u8; 32] {
1727 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_id;
1732 pub extern "C" fn UpdateFailHTLC_set_channel_id(this_ptr: &mut UpdateFailHTLC, mut val: crate::c_types::ThirtyTwoBytes) {
1733 unsafe { &mut *this_ptr.inner }.channel_id = val.data;
1737 pub extern "C" fn UpdateFailHTLC_get_htlc_id(this_ptr: &UpdateFailHTLC) -> u64 {
1738 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.htlc_id;
1743 pub extern "C" fn UpdateFailHTLC_set_htlc_id(this_ptr: &mut UpdateFailHTLC, mut val: u64) {
1744 unsafe { &mut *this_ptr.inner }.htlc_id = val;
1746 impl Clone for UpdateFailHTLC {
1747 fn clone(&self) -> Self {
1749 inner: if <*mut nativeUpdateFailHTLC>::is_null(self.inner) { std::ptr::null_mut() } else {
1750 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
1756 /// Used only if an object of this type is returned as a trait impl by a method
1757 pub(crate) extern "C" fn UpdateFailHTLC_clone_void(this_ptr: *const c_void) -> *mut c_void {
1758 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeUpdateFailHTLC)).clone() })) as *mut c_void
1761 /// Creates a copy of the UpdateFailHTLC
1762 pub extern "C" fn UpdateFailHTLC_clone(orig: &UpdateFailHTLC) -> UpdateFailHTLC {
1766 use lightning::ln::msgs::UpdateFailMalformedHTLC as nativeUpdateFailMalformedHTLCImport;
1767 type nativeUpdateFailMalformedHTLC = nativeUpdateFailMalformedHTLCImport;
1769 /// An update_fail_malformed_htlc message to be sent or received from a peer
1772 pub struct UpdateFailMalformedHTLC {
1773 /// A pointer to the opaque Rust object.
1775 /// Nearly everywhere, inner must be non-null, however in places where
1776 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
1777 pub inner: *mut nativeUpdateFailMalformedHTLC,
1778 /// Indicates that this is the only struct which contains the same pointer.
1780 /// Rust functions which take ownership of an object provided via an argument require
1781 /// this to be true and invalidate the object pointed to by inner.
1785 impl Drop for UpdateFailMalformedHTLC {
1786 fn drop(&mut self) {
1787 if self.is_owned && !<*mut nativeUpdateFailMalformedHTLC>::is_null(self.inner) {
1788 let _ = unsafe { Box::from_raw(self.inner) };
1792 /// Frees any resources used by the UpdateFailMalformedHTLC, if is_owned is set and inner is non-NULL.
1794 pub extern "C" fn UpdateFailMalformedHTLC_free(this_obj: UpdateFailMalformedHTLC) { }
1796 /// Used only if an object of this type is returned as a trait impl by a method
1797 extern "C" fn UpdateFailMalformedHTLC_free_void(this_ptr: *mut c_void) {
1798 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeUpdateFailMalformedHTLC); }
1801 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
1802 impl UpdateFailMalformedHTLC {
1803 pub(crate) fn take_inner(mut self) -> *mut nativeUpdateFailMalformedHTLC {
1804 assert!(self.is_owned);
1805 let ret = self.inner;
1806 self.inner = std::ptr::null_mut();
1812 pub extern "C" fn UpdateFailMalformedHTLC_get_channel_id(this_ptr: &UpdateFailMalformedHTLC) -> *const [u8; 32] {
1813 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_id;
1818 pub extern "C" fn UpdateFailMalformedHTLC_set_channel_id(this_ptr: &mut UpdateFailMalformedHTLC, mut val: crate::c_types::ThirtyTwoBytes) {
1819 unsafe { &mut *this_ptr.inner }.channel_id = val.data;
1823 pub extern "C" fn UpdateFailMalformedHTLC_get_htlc_id(this_ptr: &UpdateFailMalformedHTLC) -> u64 {
1824 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.htlc_id;
1829 pub extern "C" fn UpdateFailMalformedHTLC_set_htlc_id(this_ptr: &mut UpdateFailMalformedHTLC, mut val: u64) {
1830 unsafe { &mut *this_ptr.inner }.htlc_id = val;
1832 /// The failure code
1834 pub extern "C" fn UpdateFailMalformedHTLC_get_failure_code(this_ptr: &UpdateFailMalformedHTLC) -> u16 {
1835 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.failure_code;
1838 /// The failure code
1840 pub extern "C" fn UpdateFailMalformedHTLC_set_failure_code(this_ptr: &mut UpdateFailMalformedHTLC, mut val: u16) {
1841 unsafe { &mut *this_ptr.inner }.failure_code = val;
1843 impl Clone for UpdateFailMalformedHTLC {
1844 fn clone(&self) -> Self {
1846 inner: if <*mut nativeUpdateFailMalformedHTLC>::is_null(self.inner) { std::ptr::null_mut() } else {
1847 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
1853 /// Used only if an object of this type is returned as a trait impl by a method
1854 pub(crate) extern "C" fn UpdateFailMalformedHTLC_clone_void(this_ptr: *const c_void) -> *mut c_void {
1855 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeUpdateFailMalformedHTLC)).clone() })) as *mut c_void
1858 /// Creates a copy of the UpdateFailMalformedHTLC
1859 pub extern "C" fn UpdateFailMalformedHTLC_clone(orig: &UpdateFailMalformedHTLC) -> UpdateFailMalformedHTLC {
1863 use lightning::ln::msgs::CommitmentSigned as nativeCommitmentSignedImport;
1864 type nativeCommitmentSigned = nativeCommitmentSignedImport;
1866 /// A commitment_signed message to be sent or received from a peer
1869 pub struct CommitmentSigned {
1870 /// A pointer to the opaque Rust object.
1872 /// Nearly everywhere, inner must be non-null, however in places where
1873 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
1874 pub inner: *mut nativeCommitmentSigned,
1875 /// Indicates that this is the only struct which contains the same pointer.
1877 /// Rust functions which take ownership of an object provided via an argument require
1878 /// this to be true and invalidate the object pointed to by inner.
1882 impl Drop for CommitmentSigned {
1883 fn drop(&mut self) {
1884 if self.is_owned && !<*mut nativeCommitmentSigned>::is_null(self.inner) {
1885 let _ = unsafe { Box::from_raw(self.inner) };
1889 /// Frees any resources used by the CommitmentSigned, if is_owned is set and inner is non-NULL.
1891 pub extern "C" fn CommitmentSigned_free(this_obj: CommitmentSigned) { }
1893 /// Used only if an object of this type is returned as a trait impl by a method
1894 extern "C" fn CommitmentSigned_free_void(this_ptr: *mut c_void) {
1895 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeCommitmentSigned); }
1898 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
1899 impl CommitmentSigned {
1900 pub(crate) fn take_inner(mut self) -> *mut nativeCommitmentSigned {
1901 assert!(self.is_owned);
1902 let ret = self.inner;
1903 self.inner = std::ptr::null_mut();
1909 pub extern "C" fn CommitmentSigned_get_channel_id(this_ptr: &CommitmentSigned) -> *const [u8; 32] {
1910 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_id;
1915 pub extern "C" fn CommitmentSigned_set_channel_id(this_ptr: &mut CommitmentSigned, mut val: crate::c_types::ThirtyTwoBytes) {
1916 unsafe { &mut *this_ptr.inner }.channel_id = val.data;
1918 /// A signature on the commitment transaction
1920 pub extern "C" fn CommitmentSigned_get_signature(this_ptr: &CommitmentSigned) -> crate::c_types::Signature {
1921 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.signature;
1922 crate::c_types::Signature::from_rust(&(*inner_val))
1924 /// A signature on the commitment transaction
1926 pub extern "C" fn CommitmentSigned_set_signature(this_ptr: &mut CommitmentSigned, mut val: crate::c_types::Signature) {
1927 unsafe { &mut *this_ptr.inner }.signature = val.into_rust();
1929 /// Signatures on the HTLC transactions
1931 pub extern "C" fn CommitmentSigned_set_htlc_signatures(this_ptr: &mut CommitmentSigned, mut val: crate::c_types::derived::CVec_SignatureZ) {
1932 let mut local_val = Vec::new(); for mut item in val.into_rust().drain(..) { local_val.push( { item.into_rust() }); };
1933 unsafe { &mut *this_ptr.inner }.htlc_signatures = local_val;
1935 /// Constructs a new CommitmentSigned given each field
1938 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 {
1939 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() }); };
1940 CommitmentSigned { inner: Box::into_raw(Box::new(nativeCommitmentSigned {
1941 channel_id: channel_id_arg.data,
1942 signature: signature_arg.into_rust(),
1943 htlc_signatures: local_htlc_signatures_arg,
1944 })), is_owned: true }
1946 impl Clone for CommitmentSigned {
1947 fn clone(&self) -> Self {
1949 inner: if <*mut nativeCommitmentSigned>::is_null(self.inner) { std::ptr::null_mut() } else {
1950 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
1956 /// Used only if an object of this type is returned as a trait impl by a method
1957 pub(crate) extern "C" fn CommitmentSigned_clone_void(this_ptr: *const c_void) -> *mut c_void {
1958 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeCommitmentSigned)).clone() })) as *mut c_void
1961 /// Creates a copy of the CommitmentSigned
1962 pub extern "C" fn CommitmentSigned_clone(orig: &CommitmentSigned) -> CommitmentSigned {
1966 use lightning::ln::msgs::RevokeAndACK as nativeRevokeAndACKImport;
1967 type nativeRevokeAndACK = nativeRevokeAndACKImport;
1969 /// A revoke_and_ack message to be sent or received from a peer
1972 pub struct RevokeAndACK {
1973 /// A pointer to the opaque Rust object.
1975 /// Nearly everywhere, inner must be non-null, however in places where
1976 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
1977 pub inner: *mut nativeRevokeAndACK,
1978 /// Indicates that this is the only struct which contains the same pointer.
1980 /// Rust functions which take ownership of an object provided via an argument require
1981 /// this to be true and invalidate the object pointed to by inner.
1985 impl Drop for RevokeAndACK {
1986 fn drop(&mut self) {
1987 if self.is_owned && !<*mut nativeRevokeAndACK>::is_null(self.inner) {
1988 let _ = unsafe { Box::from_raw(self.inner) };
1992 /// Frees any resources used by the RevokeAndACK, if is_owned is set and inner is non-NULL.
1994 pub extern "C" fn RevokeAndACK_free(this_obj: RevokeAndACK) { }
1996 /// Used only if an object of this type is returned as a trait impl by a method
1997 extern "C" fn RevokeAndACK_free_void(this_ptr: *mut c_void) {
1998 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeRevokeAndACK); }
2001 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
2003 pub(crate) fn take_inner(mut self) -> *mut nativeRevokeAndACK {
2004 assert!(self.is_owned);
2005 let ret = self.inner;
2006 self.inner = std::ptr::null_mut();
2012 pub extern "C" fn RevokeAndACK_get_channel_id(this_ptr: &RevokeAndACK) -> *const [u8; 32] {
2013 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_id;
2018 pub extern "C" fn RevokeAndACK_set_channel_id(this_ptr: &mut RevokeAndACK, mut val: crate::c_types::ThirtyTwoBytes) {
2019 unsafe { &mut *this_ptr.inner }.channel_id = val.data;
2021 /// The secret corresponding to the per-commitment point
2023 pub extern "C" fn RevokeAndACK_get_per_commitment_secret(this_ptr: &RevokeAndACK) -> *const [u8; 32] {
2024 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.per_commitment_secret;
2027 /// The secret corresponding to the per-commitment point
2029 pub extern "C" fn RevokeAndACK_set_per_commitment_secret(this_ptr: &mut RevokeAndACK, mut val: crate::c_types::ThirtyTwoBytes) {
2030 unsafe { &mut *this_ptr.inner }.per_commitment_secret = val.data;
2032 /// The next sender-broadcast commitment transaction's per-commitment point
2034 pub extern "C" fn RevokeAndACK_get_next_per_commitment_point(this_ptr: &RevokeAndACK) -> crate::c_types::PublicKey {
2035 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.next_per_commitment_point;
2036 crate::c_types::PublicKey::from_rust(&(*inner_val))
2038 /// The next sender-broadcast commitment transaction's per-commitment point
2040 pub extern "C" fn RevokeAndACK_set_next_per_commitment_point(this_ptr: &mut RevokeAndACK, mut val: crate::c_types::PublicKey) {
2041 unsafe { &mut *this_ptr.inner }.next_per_commitment_point = val.into_rust();
2043 /// Constructs a new RevokeAndACK given each field
2046 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 {
2047 RevokeAndACK { inner: Box::into_raw(Box::new(nativeRevokeAndACK {
2048 channel_id: channel_id_arg.data,
2049 per_commitment_secret: per_commitment_secret_arg.data,
2050 next_per_commitment_point: next_per_commitment_point_arg.into_rust(),
2051 })), is_owned: true }
2053 impl Clone for RevokeAndACK {
2054 fn clone(&self) -> Self {
2056 inner: if <*mut nativeRevokeAndACK>::is_null(self.inner) { std::ptr::null_mut() } else {
2057 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
2063 /// Used only if an object of this type is returned as a trait impl by a method
2064 pub(crate) extern "C" fn RevokeAndACK_clone_void(this_ptr: *const c_void) -> *mut c_void {
2065 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeRevokeAndACK)).clone() })) as *mut c_void
2068 /// Creates a copy of the RevokeAndACK
2069 pub extern "C" fn RevokeAndACK_clone(orig: &RevokeAndACK) -> RevokeAndACK {
2073 use lightning::ln::msgs::UpdateFee as nativeUpdateFeeImport;
2074 type nativeUpdateFee = nativeUpdateFeeImport;
2076 /// An update_fee message to be sent or received from a peer
2079 pub struct UpdateFee {
2080 /// A pointer to the opaque Rust object.
2082 /// Nearly everywhere, inner must be non-null, however in places where
2083 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
2084 pub inner: *mut nativeUpdateFee,
2085 /// Indicates that this is the only struct which contains the same pointer.
2087 /// Rust functions which take ownership of an object provided via an argument require
2088 /// this to be true and invalidate the object pointed to by inner.
2092 impl Drop for UpdateFee {
2093 fn drop(&mut self) {
2094 if self.is_owned && !<*mut nativeUpdateFee>::is_null(self.inner) {
2095 let _ = unsafe { Box::from_raw(self.inner) };
2099 /// Frees any resources used by the UpdateFee, if is_owned is set and inner is non-NULL.
2101 pub extern "C" fn UpdateFee_free(this_obj: UpdateFee) { }
2103 /// Used only if an object of this type is returned as a trait impl by a method
2104 extern "C" fn UpdateFee_free_void(this_ptr: *mut c_void) {
2105 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeUpdateFee); }
2108 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
2110 pub(crate) fn take_inner(mut self) -> *mut nativeUpdateFee {
2111 assert!(self.is_owned);
2112 let ret = self.inner;
2113 self.inner = std::ptr::null_mut();
2119 pub extern "C" fn UpdateFee_get_channel_id(this_ptr: &UpdateFee) -> *const [u8; 32] {
2120 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_id;
2125 pub extern "C" fn UpdateFee_set_channel_id(this_ptr: &mut UpdateFee, mut val: crate::c_types::ThirtyTwoBytes) {
2126 unsafe { &mut *this_ptr.inner }.channel_id = val.data;
2128 /// Fee rate per 1000-weight of the transaction
2130 pub extern "C" fn UpdateFee_get_feerate_per_kw(this_ptr: &UpdateFee) -> u32 {
2131 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.feerate_per_kw;
2134 /// Fee rate per 1000-weight of the transaction
2136 pub extern "C" fn UpdateFee_set_feerate_per_kw(this_ptr: &mut UpdateFee, mut val: u32) {
2137 unsafe { &mut *this_ptr.inner }.feerate_per_kw = val;
2139 /// Constructs a new UpdateFee given each field
2142 pub extern "C" fn UpdateFee_new(mut channel_id_arg: crate::c_types::ThirtyTwoBytes, mut feerate_per_kw_arg: u32) -> UpdateFee {
2143 UpdateFee { inner: Box::into_raw(Box::new(nativeUpdateFee {
2144 channel_id: channel_id_arg.data,
2145 feerate_per_kw: feerate_per_kw_arg,
2146 })), is_owned: true }
2148 impl Clone for UpdateFee {
2149 fn clone(&self) -> Self {
2151 inner: if <*mut nativeUpdateFee>::is_null(self.inner) { std::ptr::null_mut() } else {
2152 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
2158 /// Used only if an object of this type is returned as a trait impl by a method
2159 pub(crate) extern "C" fn UpdateFee_clone_void(this_ptr: *const c_void) -> *mut c_void {
2160 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeUpdateFee)).clone() })) as *mut c_void
2163 /// Creates a copy of the UpdateFee
2164 pub extern "C" fn UpdateFee_clone(orig: &UpdateFee) -> UpdateFee {
2168 use lightning::ln::msgs::DataLossProtect as nativeDataLossProtectImport;
2169 type nativeDataLossProtect = nativeDataLossProtectImport;
2171 /// Proof that the sender knows the per-commitment secret of the previous commitment transaction.
2172 /// This is used to convince the recipient that the channel is at a certain commitment
2173 /// number even if they lost that data due to a local failure. Of course, the peer may lie
2174 /// and even later commitments may have been revoked.
2177 pub struct DataLossProtect {
2178 /// A pointer to the opaque Rust object.
2180 /// Nearly everywhere, inner must be non-null, however in places where
2181 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
2182 pub inner: *mut nativeDataLossProtect,
2183 /// Indicates that this is the only struct which contains the same pointer.
2185 /// Rust functions which take ownership of an object provided via an argument require
2186 /// this to be true and invalidate the object pointed to by inner.
2190 impl Drop for DataLossProtect {
2191 fn drop(&mut self) {
2192 if self.is_owned && !<*mut nativeDataLossProtect>::is_null(self.inner) {
2193 let _ = unsafe { Box::from_raw(self.inner) };
2197 /// Frees any resources used by the DataLossProtect, if is_owned is set and inner is non-NULL.
2199 pub extern "C" fn DataLossProtect_free(this_obj: DataLossProtect) { }
2201 /// Used only if an object of this type is returned as a trait impl by a method
2202 extern "C" fn DataLossProtect_free_void(this_ptr: *mut c_void) {
2203 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeDataLossProtect); }
2206 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
2207 impl DataLossProtect {
2208 pub(crate) fn take_inner(mut self) -> *mut nativeDataLossProtect {
2209 assert!(self.is_owned);
2210 let ret = self.inner;
2211 self.inner = std::ptr::null_mut();
2215 /// Proof that the sender knows the per-commitment secret of a specific commitment transaction
2216 /// belonging to the recipient
2218 pub extern "C" fn DataLossProtect_get_your_last_per_commitment_secret(this_ptr: &DataLossProtect) -> *const [u8; 32] {
2219 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.your_last_per_commitment_secret;
2222 /// Proof that the sender knows the per-commitment secret of a specific commitment transaction
2223 /// belonging to the recipient
2225 pub extern "C" fn DataLossProtect_set_your_last_per_commitment_secret(this_ptr: &mut DataLossProtect, mut val: crate::c_types::ThirtyTwoBytes) {
2226 unsafe { &mut *this_ptr.inner }.your_last_per_commitment_secret = val.data;
2228 /// The sender's per-commitment point for their current commitment transaction
2230 pub extern "C" fn DataLossProtect_get_my_current_per_commitment_point(this_ptr: &DataLossProtect) -> crate::c_types::PublicKey {
2231 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.my_current_per_commitment_point;
2232 crate::c_types::PublicKey::from_rust(&(*inner_val))
2234 /// The sender's per-commitment point for their current commitment transaction
2236 pub extern "C" fn DataLossProtect_set_my_current_per_commitment_point(this_ptr: &mut DataLossProtect, mut val: crate::c_types::PublicKey) {
2237 unsafe { &mut *this_ptr.inner }.my_current_per_commitment_point = val.into_rust();
2239 /// Constructs a new DataLossProtect given each field
2242 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 {
2243 DataLossProtect { inner: Box::into_raw(Box::new(nativeDataLossProtect {
2244 your_last_per_commitment_secret: your_last_per_commitment_secret_arg.data,
2245 my_current_per_commitment_point: my_current_per_commitment_point_arg.into_rust(),
2246 })), is_owned: true }
2248 impl Clone for DataLossProtect {
2249 fn clone(&self) -> Self {
2251 inner: if <*mut nativeDataLossProtect>::is_null(self.inner) { 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 DataLossProtect_clone_void(this_ptr: *const c_void) -> *mut c_void {
2260 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeDataLossProtect)).clone() })) as *mut c_void
2263 /// Creates a copy of the DataLossProtect
2264 pub extern "C" fn DataLossProtect_clone(orig: &DataLossProtect) -> DataLossProtect {
2268 use lightning::ln::msgs::ChannelReestablish as nativeChannelReestablishImport;
2269 type nativeChannelReestablish = nativeChannelReestablishImport;
2271 /// A channel_reestablish message to be sent or received from a peer
2274 pub struct ChannelReestablish {
2275 /// A pointer to the opaque Rust object.
2277 /// Nearly everywhere, inner must be non-null, however in places where
2278 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
2279 pub inner: *mut nativeChannelReestablish,
2280 /// Indicates that this is the only struct which contains the same pointer.
2282 /// Rust functions which take ownership of an object provided via an argument require
2283 /// this to be true and invalidate the object pointed to by inner.
2287 impl Drop for ChannelReestablish {
2288 fn drop(&mut self) {
2289 if self.is_owned && !<*mut nativeChannelReestablish>::is_null(self.inner) {
2290 let _ = unsafe { Box::from_raw(self.inner) };
2294 /// Frees any resources used by the ChannelReestablish, if is_owned is set and inner is non-NULL.
2296 pub extern "C" fn ChannelReestablish_free(this_obj: ChannelReestablish) { }
2298 /// Used only if an object of this type is returned as a trait impl by a method
2299 extern "C" fn ChannelReestablish_free_void(this_ptr: *mut c_void) {
2300 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeChannelReestablish); }
2303 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
2304 impl ChannelReestablish {
2305 pub(crate) fn take_inner(mut self) -> *mut nativeChannelReestablish {
2306 assert!(self.is_owned);
2307 let ret = self.inner;
2308 self.inner = std::ptr::null_mut();
2314 pub extern "C" fn ChannelReestablish_get_channel_id(this_ptr: &ChannelReestablish) -> *const [u8; 32] {
2315 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_id;
2320 pub extern "C" fn ChannelReestablish_set_channel_id(this_ptr: &mut ChannelReestablish, mut val: crate::c_types::ThirtyTwoBytes) {
2321 unsafe { &mut *this_ptr.inner }.channel_id = val.data;
2323 /// The next commitment number for the sender
2325 pub extern "C" fn ChannelReestablish_get_next_local_commitment_number(this_ptr: &ChannelReestablish) -> u64 {
2326 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.next_local_commitment_number;
2329 /// The next commitment number for the sender
2331 pub extern "C" fn ChannelReestablish_set_next_local_commitment_number(this_ptr: &mut ChannelReestablish, mut val: u64) {
2332 unsafe { &mut *this_ptr.inner }.next_local_commitment_number = val;
2334 /// The next commitment number for the recipient
2336 pub extern "C" fn ChannelReestablish_get_next_remote_commitment_number(this_ptr: &ChannelReestablish) -> u64 {
2337 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.next_remote_commitment_number;
2340 /// The next commitment number for the recipient
2342 pub extern "C" fn ChannelReestablish_set_next_remote_commitment_number(this_ptr: &mut ChannelReestablish, mut val: u64) {
2343 unsafe { &mut *this_ptr.inner }.next_remote_commitment_number = val;
2345 impl Clone for ChannelReestablish {
2346 fn clone(&self) -> Self {
2348 inner: if <*mut nativeChannelReestablish>::is_null(self.inner) { std::ptr::null_mut() } else {
2349 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
2355 /// Used only if an object of this type is returned as a trait impl by a method
2356 pub(crate) extern "C" fn ChannelReestablish_clone_void(this_ptr: *const c_void) -> *mut c_void {
2357 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeChannelReestablish)).clone() })) as *mut c_void
2360 /// Creates a copy of the ChannelReestablish
2361 pub extern "C" fn ChannelReestablish_clone(orig: &ChannelReestablish) -> ChannelReestablish {
2365 use lightning::ln::msgs::AnnouncementSignatures as nativeAnnouncementSignaturesImport;
2366 type nativeAnnouncementSignatures = nativeAnnouncementSignaturesImport;
2368 /// An announcement_signatures message to be sent or received from a peer
2371 pub struct AnnouncementSignatures {
2372 /// A pointer to the opaque Rust object.
2374 /// Nearly everywhere, inner must be non-null, however in places where
2375 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
2376 pub inner: *mut nativeAnnouncementSignatures,
2377 /// Indicates that this is the only struct which contains the same pointer.
2379 /// Rust functions which take ownership of an object provided via an argument require
2380 /// this to be true and invalidate the object pointed to by inner.
2384 impl Drop for AnnouncementSignatures {
2385 fn drop(&mut self) {
2386 if self.is_owned && !<*mut nativeAnnouncementSignatures>::is_null(self.inner) {
2387 let _ = unsafe { Box::from_raw(self.inner) };
2391 /// Frees any resources used by the AnnouncementSignatures, if is_owned is set and inner is non-NULL.
2393 pub extern "C" fn AnnouncementSignatures_free(this_obj: AnnouncementSignatures) { }
2395 /// Used only if an object of this type is returned as a trait impl by a method
2396 extern "C" fn AnnouncementSignatures_free_void(this_ptr: *mut c_void) {
2397 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeAnnouncementSignatures); }
2400 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
2401 impl AnnouncementSignatures {
2402 pub(crate) fn take_inner(mut self) -> *mut nativeAnnouncementSignatures {
2403 assert!(self.is_owned);
2404 let ret = self.inner;
2405 self.inner = std::ptr::null_mut();
2411 pub extern "C" fn AnnouncementSignatures_get_channel_id(this_ptr: &AnnouncementSignatures) -> *const [u8; 32] {
2412 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_id;
2417 pub extern "C" fn AnnouncementSignatures_set_channel_id(this_ptr: &mut AnnouncementSignatures, mut val: crate::c_types::ThirtyTwoBytes) {
2418 unsafe { &mut *this_ptr.inner }.channel_id = val.data;
2420 /// The short channel ID
2422 pub extern "C" fn AnnouncementSignatures_get_short_channel_id(this_ptr: &AnnouncementSignatures) -> u64 {
2423 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.short_channel_id;
2426 /// The short channel ID
2428 pub extern "C" fn AnnouncementSignatures_set_short_channel_id(this_ptr: &mut AnnouncementSignatures, mut val: u64) {
2429 unsafe { &mut *this_ptr.inner }.short_channel_id = val;
2431 /// A signature by the node key
2433 pub extern "C" fn AnnouncementSignatures_get_node_signature(this_ptr: &AnnouncementSignatures) -> crate::c_types::Signature {
2434 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.node_signature;
2435 crate::c_types::Signature::from_rust(&(*inner_val))
2437 /// A signature by the node key
2439 pub extern "C" fn AnnouncementSignatures_set_node_signature(this_ptr: &mut AnnouncementSignatures, mut val: crate::c_types::Signature) {
2440 unsafe { &mut *this_ptr.inner }.node_signature = val.into_rust();
2442 /// A signature by the funding key
2444 pub extern "C" fn AnnouncementSignatures_get_bitcoin_signature(this_ptr: &AnnouncementSignatures) -> crate::c_types::Signature {
2445 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.bitcoin_signature;
2446 crate::c_types::Signature::from_rust(&(*inner_val))
2448 /// A signature by the funding key
2450 pub extern "C" fn AnnouncementSignatures_set_bitcoin_signature(this_ptr: &mut AnnouncementSignatures, mut val: crate::c_types::Signature) {
2451 unsafe { &mut *this_ptr.inner }.bitcoin_signature = val.into_rust();
2453 /// Constructs a new AnnouncementSignatures given each field
2456 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 {
2457 AnnouncementSignatures { inner: Box::into_raw(Box::new(nativeAnnouncementSignatures {
2458 channel_id: channel_id_arg.data,
2459 short_channel_id: short_channel_id_arg,
2460 node_signature: node_signature_arg.into_rust(),
2461 bitcoin_signature: bitcoin_signature_arg.into_rust(),
2462 })), is_owned: true }
2464 impl Clone for AnnouncementSignatures {
2465 fn clone(&self) -> Self {
2467 inner: if <*mut nativeAnnouncementSignatures>::is_null(self.inner) { std::ptr::null_mut() } else {
2468 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
2474 /// Used only if an object of this type is returned as a trait impl by a method
2475 pub(crate) extern "C" fn AnnouncementSignatures_clone_void(this_ptr: *const c_void) -> *mut c_void {
2476 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeAnnouncementSignatures)).clone() })) as *mut c_void
2479 /// Creates a copy of the AnnouncementSignatures
2480 pub extern "C" fn AnnouncementSignatures_clone(orig: &AnnouncementSignatures) -> AnnouncementSignatures {
2483 /// An address which can be used to connect to a remote peer
2487 pub enum NetAddress {
2488 /// An IPv4 address/port on which the peer is listening.
2490 /// The 4-byte IPv4 address
2491 addr: crate::c_types::FourBytes,
2492 /// The port on which the node is listening
2495 /// An IPv6 address/port on which the peer is listening.
2497 /// The 16-byte IPv6 address
2498 addr: crate::c_types::SixteenBytes,
2499 /// The port on which the node is listening
2502 /// An old-style Tor onion address/port on which the peer is listening.
2504 /// The bytes (usually encoded in base32 with \".onion\" appended)
2505 addr: crate::c_types::TenBytes,
2506 /// The port on which the node is listening
2509 /// A new-style Tor onion address/port on which the peer is listening.
2510 /// To create the human-readable \"hostname\", concatenate ed25519_pubkey, checksum, and version,
2511 /// wrap as base32 and append \".onion\".
2513 /// The ed25519 long-term public key of the peer
2514 ed25519_pubkey: crate::c_types::ThirtyTwoBytes,
2515 /// The checksum of the pubkey and version, as included in the onion address
2517 /// The version byte, as defined by the Tor Onion v3 spec.
2519 /// The port on which the node is listening
2523 use lightning::ln::msgs::NetAddress as nativeNetAddress;
2526 pub(crate) fn to_native(&self) -> nativeNetAddress {
2528 NetAddress::IPv4 {ref addr, ref port, } => {
2529 let mut addr_nonref = (*addr).clone();
2530 let mut port_nonref = (*port).clone();
2531 nativeNetAddress::IPv4 {
2532 addr: addr_nonref.data,
2536 NetAddress::IPv6 {ref addr, ref port, } => {
2537 let mut addr_nonref = (*addr).clone();
2538 let mut port_nonref = (*port).clone();
2539 nativeNetAddress::IPv6 {
2540 addr: addr_nonref.data,
2544 NetAddress::OnionV2 {ref addr, ref port, } => {
2545 let mut addr_nonref = (*addr).clone();
2546 let mut port_nonref = (*port).clone();
2547 nativeNetAddress::OnionV2 {
2548 addr: addr_nonref.data,
2552 NetAddress::OnionV3 {ref ed25519_pubkey, ref checksum, ref version, ref port, } => {
2553 let mut ed25519_pubkey_nonref = (*ed25519_pubkey).clone();
2554 let mut checksum_nonref = (*checksum).clone();
2555 let mut version_nonref = (*version).clone();
2556 let mut port_nonref = (*port).clone();
2557 nativeNetAddress::OnionV3 {
2558 ed25519_pubkey: ed25519_pubkey_nonref.data,
2559 checksum: checksum_nonref,
2560 version: version_nonref,
2567 pub(crate) fn into_native(self) -> nativeNetAddress {
2569 NetAddress::IPv4 {mut addr, mut port, } => {
2570 nativeNetAddress::IPv4 {
2575 NetAddress::IPv6 {mut addr, mut port, } => {
2576 nativeNetAddress::IPv6 {
2581 NetAddress::OnionV2 {mut addr, mut port, } => {
2582 nativeNetAddress::OnionV2 {
2587 NetAddress::OnionV3 {mut ed25519_pubkey, mut checksum, mut version, mut port, } => {
2588 nativeNetAddress::OnionV3 {
2589 ed25519_pubkey: ed25519_pubkey.data,
2598 pub(crate) fn from_native(native: &nativeNetAddress) -> Self {
2600 nativeNetAddress::IPv4 {ref addr, ref port, } => {
2601 let mut addr_nonref = (*addr).clone();
2602 let mut port_nonref = (*port).clone();
2604 addr: crate::c_types::FourBytes { data: addr_nonref },
2608 nativeNetAddress::IPv6 {ref addr, ref port, } => {
2609 let mut addr_nonref = (*addr).clone();
2610 let mut port_nonref = (*port).clone();
2612 addr: crate::c_types::SixteenBytes { data: addr_nonref },
2616 nativeNetAddress::OnionV2 {ref addr, ref port, } => {
2617 let mut addr_nonref = (*addr).clone();
2618 let mut port_nonref = (*port).clone();
2619 NetAddress::OnionV2 {
2620 addr: crate::c_types::TenBytes { data: addr_nonref },
2624 nativeNetAddress::OnionV3 {ref ed25519_pubkey, ref checksum, ref version, ref port, } => {
2625 let mut ed25519_pubkey_nonref = (*ed25519_pubkey).clone();
2626 let mut checksum_nonref = (*checksum).clone();
2627 let mut version_nonref = (*version).clone();
2628 let mut port_nonref = (*port).clone();
2629 NetAddress::OnionV3 {
2630 ed25519_pubkey: crate::c_types::ThirtyTwoBytes { data: ed25519_pubkey_nonref },
2631 checksum: checksum_nonref,
2632 version: version_nonref,
2639 pub(crate) fn native_into(native: nativeNetAddress) -> Self {
2641 nativeNetAddress::IPv4 {mut addr, mut port, } => {
2643 addr: crate::c_types::FourBytes { data: addr },
2647 nativeNetAddress::IPv6 {mut addr, mut port, } => {
2649 addr: crate::c_types::SixteenBytes { data: addr },
2653 nativeNetAddress::OnionV2 {mut addr, mut port, } => {
2654 NetAddress::OnionV2 {
2655 addr: crate::c_types::TenBytes { data: addr },
2659 nativeNetAddress::OnionV3 {mut ed25519_pubkey, mut checksum, mut version, mut port, } => {
2660 NetAddress::OnionV3 {
2661 ed25519_pubkey: crate::c_types::ThirtyTwoBytes { data: ed25519_pubkey },
2670 /// Frees any resources used by the NetAddress
2672 pub extern "C" fn NetAddress_free(this_ptr: NetAddress) { }
2673 /// Creates a copy of the NetAddress
2675 pub extern "C" fn NetAddress_clone(orig: &NetAddress) -> NetAddress {
2679 /// Serialize the NetAddress object into a byte array which can be read by NetAddress_read
2680 pub extern "C" fn NetAddress_write(obj: &NetAddress) -> crate::c_types::derived::CVec_u8Z {
2681 crate::c_types::serialize_obj(&unsafe { &*obj }.to_native())
2684 /// Read a Result from a byte array, created by Result_write
2685 pub extern "C" fn Result_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_CResult_NetAddressu8ZDecodeErrorZ {
2686 let res = crate::c_types::deserialize_obj(ser);
2687 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::lightning::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::lightning::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
2691 use lightning::ln::msgs::UnsignedNodeAnnouncement as nativeUnsignedNodeAnnouncementImport;
2692 type nativeUnsignedNodeAnnouncement = nativeUnsignedNodeAnnouncementImport;
2694 /// The unsigned part of a node_announcement
2697 pub struct UnsignedNodeAnnouncement {
2698 /// A pointer to the opaque Rust object.
2700 /// Nearly everywhere, inner must be non-null, however in places where
2701 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
2702 pub inner: *mut nativeUnsignedNodeAnnouncement,
2703 /// Indicates that this is the only struct which contains the same pointer.
2705 /// Rust functions which take ownership of an object provided via an argument require
2706 /// this to be true and invalidate the object pointed to by inner.
2710 impl Drop for UnsignedNodeAnnouncement {
2711 fn drop(&mut self) {
2712 if self.is_owned && !<*mut nativeUnsignedNodeAnnouncement>::is_null(self.inner) {
2713 let _ = unsafe { Box::from_raw(self.inner) };
2717 /// Frees any resources used by the UnsignedNodeAnnouncement, if is_owned is set and inner is non-NULL.
2719 pub extern "C" fn UnsignedNodeAnnouncement_free(this_obj: UnsignedNodeAnnouncement) { }
2721 /// Used only if an object of this type is returned as a trait impl by a method
2722 extern "C" fn UnsignedNodeAnnouncement_free_void(this_ptr: *mut c_void) {
2723 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeUnsignedNodeAnnouncement); }
2726 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
2727 impl UnsignedNodeAnnouncement {
2728 pub(crate) fn take_inner(mut self) -> *mut nativeUnsignedNodeAnnouncement {
2729 assert!(self.is_owned);
2730 let ret = self.inner;
2731 self.inner = std::ptr::null_mut();
2735 /// The advertised features
2737 pub extern "C" fn UnsignedNodeAnnouncement_get_features(this_ptr: &UnsignedNodeAnnouncement) -> crate::lightning::ln::features::NodeFeatures {
2738 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.features;
2739 crate::lightning::ln::features::NodeFeatures { inner: unsafe { ( (&((*inner_val)) as *const _) as *mut _) }, is_owned: false }
2741 /// The advertised features
2743 pub extern "C" fn UnsignedNodeAnnouncement_set_features(this_ptr: &mut UnsignedNodeAnnouncement, mut val: crate::lightning::ln::features::NodeFeatures) {
2744 unsafe { &mut *this_ptr.inner }.features = *unsafe { Box::from_raw(val.take_inner()) };
2746 /// A strictly monotonic announcement counter, with gaps allowed
2748 pub extern "C" fn UnsignedNodeAnnouncement_get_timestamp(this_ptr: &UnsignedNodeAnnouncement) -> u32 {
2749 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.timestamp;
2752 /// A strictly monotonic announcement counter, with gaps allowed
2754 pub extern "C" fn UnsignedNodeAnnouncement_set_timestamp(this_ptr: &mut UnsignedNodeAnnouncement, mut val: u32) {
2755 unsafe { &mut *this_ptr.inner }.timestamp = val;
2757 /// The node_id this announcement originated from (don't rebroadcast the node_announcement back
2760 pub extern "C" fn UnsignedNodeAnnouncement_get_node_id(this_ptr: &UnsignedNodeAnnouncement) -> crate::c_types::PublicKey {
2761 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.node_id;
2762 crate::c_types::PublicKey::from_rust(&(*inner_val))
2764 /// The node_id this announcement originated from (don't rebroadcast the node_announcement back
2767 pub extern "C" fn UnsignedNodeAnnouncement_set_node_id(this_ptr: &mut UnsignedNodeAnnouncement, mut val: crate::c_types::PublicKey) {
2768 unsafe { &mut *this_ptr.inner }.node_id = val.into_rust();
2770 /// An RGB color for UI purposes
2772 pub extern "C" fn UnsignedNodeAnnouncement_get_rgb(this_ptr: &UnsignedNodeAnnouncement) -> *const [u8; 3] {
2773 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.rgb;
2776 /// An RGB color for UI purposes
2778 pub extern "C" fn UnsignedNodeAnnouncement_set_rgb(this_ptr: &mut UnsignedNodeAnnouncement, mut val: crate::c_types::ThreeBytes) {
2779 unsafe { &mut *this_ptr.inner }.rgb = val.data;
2781 /// An alias, for UI purposes. This should be sanitized before use. There is no guarantee
2784 pub extern "C" fn UnsignedNodeAnnouncement_get_alias(this_ptr: &UnsignedNodeAnnouncement) -> *const [u8; 32] {
2785 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.alias;
2788 /// An alias, for UI purposes. This should be sanitized before use. There is no guarantee
2791 pub extern "C" fn UnsignedNodeAnnouncement_set_alias(this_ptr: &mut UnsignedNodeAnnouncement, mut val: crate::c_types::ThirtyTwoBytes) {
2792 unsafe { &mut *this_ptr.inner }.alias = val.data;
2794 /// List of addresses on which this node is reachable
2796 pub extern "C" fn UnsignedNodeAnnouncement_set_addresses(this_ptr: &mut UnsignedNodeAnnouncement, mut val: crate::c_types::derived::CVec_NetAddressZ) {
2797 let mut local_val = Vec::new(); for mut item in val.into_rust().drain(..) { local_val.push( { item.into_native() }); };
2798 unsafe { &mut *this_ptr.inner }.addresses = local_val;
2800 impl Clone for UnsignedNodeAnnouncement {
2801 fn clone(&self) -> Self {
2803 inner: if <*mut nativeUnsignedNodeAnnouncement>::is_null(self.inner) { std::ptr::null_mut() } else {
2804 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
2810 /// Used only if an object of this type is returned as a trait impl by a method
2811 pub(crate) extern "C" fn UnsignedNodeAnnouncement_clone_void(this_ptr: *const c_void) -> *mut c_void {
2812 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeUnsignedNodeAnnouncement)).clone() })) as *mut c_void
2815 /// Creates a copy of the UnsignedNodeAnnouncement
2816 pub extern "C" fn UnsignedNodeAnnouncement_clone(orig: &UnsignedNodeAnnouncement) -> UnsignedNodeAnnouncement {
2820 use lightning::ln::msgs::NodeAnnouncement as nativeNodeAnnouncementImport;
2821 type nativeNodeAnnouncement = nativeNodeAnnouncementImport;
2823 /// A node_announcement message to be sent or received from a peer
2826 pub struct NodeAnnouncement {
2827 /// A pointer to the opaque Rust object.
2829 /// Nearly everywhere, inner must be non-null, however in places where
2830 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
2831 pub inner: *mut nativeNodeAnnouncement,
2832 /// Indicates that this is the only struct which contains the same pointer.
2834 /// Rust functions which take ownership of an object provided via an argument require
2835 /// this to be true and invalidate the object pointed to by inner.
2839 impl Drop for NodeAnnouncement {
2840 fn drop(&mut self) {
2841 if self.is_owned && !<*mut nativeNodeAnnouncement>::is_null(self.inner) {
2842 let _ = unsafe { Box::from_raw(self.inner) };
2846 /// Frees any resources used by the NodeAnnouncement, if is_owned is set and inner is non-NULL.
2848 pub extern "C" fn NodeAnnouncement_free(this_obj: NodeAnnouncement) { }
2850 /// Used only if an object of this type is returned as a trait impl by a method
2851 extern "C" fn NodeAnnouncement_free_void(this_ptr: *mut c_void) {
2852 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeNodeAnnouncement); }
2855 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
2856 impl NodeAnnouncement {
2857 pub(crate) fn take_inner(mut self) -> *mut nativeNodeAnnouncement {
2858 assert!(self.is_owned);
2859 let ret = self.inner;
2860 self.inner = std::ptr::null_mut();
2864 /// The signature by the node key
2866 pub extern "C" fn NodeAnnouncement_get_signature(this_ptr: &NodeAnnouncement) -> crate::c_types::Signature {
2867 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.signature;
2868 crate::c_types::Signature::from_rust(&(*inner_val))
2870 /// The signature by the node key
2872 pub extern "C" fn NodeAnnouncement_set_signature(this_ptr: &mut NodeAnnouncement, mut val: crate::c_types::Signature) {
2873 unsafe { &mut *this_ptr.inner }.signature = val.into_rust();
2875 /// The actual content of the announcement
2877 pub extern "C" fn NodeAnnouncement_get_contents(this_ptr: &NodeAnnouncement) -> crate::lightning::ln::msgs::UnsignedNodeAnnouncement {
2878 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.contents;
2879 crate::lightning::ln::msgs::UnsignedNodeAnnouncement { inner: unsafe { ( (&((*inner_val)) as *const _) as *mut _) }, is_owned: false }
2881 /// The actual content of the announcement
2883 pub extern "C" fn NodeAnnouncement_set_contents(this_ptr: &mut NodeAnnouncement, mut val: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) {
2884 unsafe { &mut *this_ptr.inner }.contents = *unsafe { Box::from_raw(val.take_inner()) };
2886 /// Constructs a new NodeAnnouncement given each field
2889 pub extern "C" fn NodeAnnouncement_new(mut signature_arg: crate::c_types::Signature, mut contents_arg: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> NodeAnnouncement {
2890 NodeAnnouncement { inner: Box::into_raw(Box::new(nativeNodeAnnouncement {
2891 signature: signature_arg.into_rust(),
2892 contents: *unsafe { Box::from_raw(contents_arg.take_inner()) },
2893 })), is_owned: true }
2895 impl Clone for NodeAnnouncement {
2896 fn clone(&self) -> Self {
2898 inner: if <*mut nativeNodeAnnouncement>::is_null(self.inner) { std::ptr::null_mut() } else {
2899 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
2905 /// Used only if an object of this type is returned as a trait impl by a method
2906 pub(crate) extern "C" fn NodeAnnouncement_clone_void(this_ptr: *const c_void) -> *mut c_void {
2907 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeNodeAnnouncement)).clone() })) as *mut c_void
2910 /// Creates a copy of the NodeAnnouncement
2911 pub extern "C" fn NodeAnnouncement_clone(orig: &NodeAnnouncement) -> NodeAnnouncement {
2915 use lightning::ln::msgs::UnsignedChannelAnnouncement as nativeUnsignedChannelAnnouncementImport;
2916 type nativeUnsignedChannelAnnouncement = nativeUnsignedChannelAnnouncementImport;
2918 /// The unsigned part of a channel_announcement
2921 pub struct UnsignedChannelAnnouncement {
2922 /// A pointer to the opaque Rust object.
2924 /// Nearly everywhere, inner must be non-null, however in places where
2925 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
2926 pub inner: *mut nativeUnsignedChannelAnnouncement,
2927 /// Indicates that this is the only struct which contains the same pointer.
2929 /// Rust functions which take ownership of an object provided via an argument require
2930 /// this to be true and invalidate the object pointed to by inner.
2934 impl Drop for UnsignedChannelAnnouncement {
2935 fn drop(&mut self) {
2936 if self.is_owned && !<*mut nativeUnsignedChannelAnnouncement>::is_null(self.inner) {
2937 let _ = unsafe { Box::from_raw(self.inner) };
2941 /// Frees any resources used by the UnsignedChannelAnnouncement, if is_owned is set and inner is non-NULL.
2943 pub extern "C" fn UnsignedChannelAnnouncement_free(this_obj: UnsignedChannelAnnouncement) { }
2945 /// Used only if an object of this type is returned as a trait impl by a method
2946 extern "C" fn UnsignedChannelAnnouncement_free_void(this_ptr: *mut c_void) {
2947 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeUnsignedChannelAnnouncement); }
2950 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
2951 impl UnsignedChannelAnnouncement {
2952 pub(crate) fn take_inner(mut self) -> *mut nativeUnsignedChannelAnnouncement {
2953 assert!(self.is_owned);
2954 let ret = self.inner;
2955 self.inner = std::ptr::null_mut();
2959 /// The advertised channel features
2961 pub extern "C" fn UnsignedChannelAnnouncement_get_features(this_ptr: &UnsignedChannelAnnouncement) -> crate::lightning::ln::features::ChannelFeatures {
2962 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.features;
2963 crate::lightning::ln::features::ChannelFeatures { inner: unsafe { ( (&((*inner_val)) as *const _) as *mut _) }, is_owned: false }
2965 /// The advertised channel features
2967 pub extern "C" fn UnsignedChannelAnnouncement_set_features(this_ptr: &mut UnsignedChannelAnnouncement, mut val: crate::lightning::ln::features::ChannelFeatures) {
2968 unsafe { &mut *this_ptr.inner }.features = *unsafe { Box::from_raw(val.take_inner()) };
2970 /// The genesis hash of the blockchain where the channel is to be opened
2972 pub extern "C" fn UnsignedChannelAnnouncement_get_chain_hash(this_ptr: &UnsignedChannelAnnouncement) -> *const [u8; 32] {
2973 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.chain_hash;
2974 (*inner_val).as_inner()
2976 /// The genesis hash of the blockchain where the channel is to be opened
2978 pub extern "C" fn UnsignedChannelAnnouncement_set_chain_hash(this_ptr: &mut UnsignedChannelAnnouncement, mut val: crate::c_types::ThirtyTwoBytes) {
2979 unsafe { &mut *this_ptr.inner }.chain_hash = ::bitcoin::hash_types::BlockHash::from_slice(&val.data[..]).unwrap();
2981 /// The short channel ID
2983 pub extern "C" fn UnsignedChannelAnnouncement_get_short_channel_id(this_ptr: &UnsignedChannelAnnouncement) -> u64 {
2984 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.short_channel_id;
2987 /// The short channel ID
2989 pub extern "C" fn UnsignedChannelAnnouncement_set_short_channel_id(this_ptr: &mut UnsignedChannelAnnouncement, mut val: u64) {
2990 unsafe { &mut *this_ptr.inner }.short_channel_id = val;
2992 /// One of the two node_ids which are endpoints of this channel
2994 pub extern "C" fn UnsignedChannelAnnouncement_get_node_id_1(this_ptr: &UnsignedChannelAnnouncement) -> crate::c_types::PublicKey {
2995 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.node_id_1;
2996 crate::c_types::PublicKey::from_rust(&(*inner_val))
2998 /// One of the two node_ids which are endpoints of this channel
3000 pub extern "C" fn UnsignedChannelAnnouncement_set_node_id_1(this_ptr: &mut UnsignedChannelAnnouncement, mut val: crate::c_types::PublicKey) {
3001 unsafe { &mut *this_ptr.inner }.node_id_1 = val.into_rust();
3003 /// The other of the two node_ids which are endpoints of this channel
3005 pub extern "C" fn UnsignedChannelAnnouncement_get_node_id_2(this_ptr: &UnsignedChannelAnnouncement) -> crate::c_types::PublicKey {
3006 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.node_id_2;
3007 crate::c_types::PublicKey::from_rust(&(*inner_val))
3009 /// The other of the two node_ids which are endpoints of this channel
3011 pub extern "C" fn UnsignedChannelAnnouncement_set_node_id_2(this_ptr: &mut UnsignedChannelAnnouncement, mut val: crate::c_types::PublicKey) {
3012 unsafe { &mut *this_ptr.inner }.node_id_2 = val.into_rust();
3014 /// The funding key for the first node
3016 pub extern "C" fn UnsignedChannelAnnouncement_get_bitcoin_key_1(this_ptr: &UnsignedChannelAnnouncement) -> crate::c_types::PublicKey {
3017 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.bitcoin_key_1;
3018 crate::c_types::PublicKey::from_rust(&(*inner_val))
3020 /// The funding key for the first node
3022 pub extern "C" fn UnsignedChannelAnnouncement_set_bitcoin_key_1(this_ptr: &mut UnsignedChannelAnnouncement, mut val: crate::c_types::PublicKey) {
3023 unsafe { &mut *this_ptr.inner }.bitcoin_key_1 = val.into_rust();
3025 /// The funding key for the second node
3027 pub extern "C" fn UnsignedChannelAnnouncement_get_bitcoin_key_2(this_ptr: &UnsignedChannelAnnouncement) -> crate::c_types::PublicKey {
3028 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.bitcoin_key_2;
3029 crate::c_types::PublicKey::from_rust(&(*inner_val))
3031 /// The funding key for the second node
3033 pub extern "C" fn UnsignedChannelAnnouncement_set_bitcoin_key_2(this_ptr: &mut UnsignedChannelAnnouncement, mut val: crate::c_types::PublicKey) {
3034 unsafe { &mut *this_ptr.inner }.bitcoin_key_2 = val.into_rust();
3036 impl Clone for UnsignedChannelAnnouncement {
3037 fn clone(&self) -> Self {
3039 inner: if <*mut nativeUnsignedChannelAnnouncement>::is_null(self.inner) { std::ptr::null_mut() } else {
3040 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
3046 /// Used only if an object of this type is returned as a trait impl by a method
3047 pub(crate) extern "C" fn UnsignedChannelAnnouncement_clone_void(this_ptr: *const c_void) -> *mut c_void {
3048 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeUnsignedChannelAnnouncement)).clone() })) as *mut c_void
3051 /// Creates a copy of the UnsignedChannelAnnouncement
3052 pub extern "C" fn UnsignedChannelAnnouncement_clone(orig: &UnsignedChannelAnnouncement) -> UnsignedChannelAnnouncement {
3056 use lightning::ln::msgs::ChannelAnnouncement as nativeChannelAnnouncementImport;
3057 type nativeChannelAnnouncement = nativeChannelAnnouncementImport;
3059 /// A channel_announcement message to be sent or received from a peer
3062 pub struct ChannelAnnouncement {
3063 /// A pointer to the opaque Rust object.
3065 /// Nearly everywhere, inner must be non-null, however in places where
3066 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
3067 pub inner: *mut nativeChannelAnnouncement,
3068 /// Indicates that this is the only struct which contains the same pointer.
3070 /// Rust functions which take ownership of an object provided via an argument require
3071 /// this to be true and invalidate the object pointed to by inner.
3075 impl Drop for ChannelAnnouncement {
3076 fn drop(&mut self) {
3077 if self.is_owned && !<*mut nativeChannelAnnouncement>::is_null(self.inner) {
3078 let _ = unsafe { Box::from_raw(self.inner) };
3082 /// Frees any resources used by the ChannelAnnouncement, if is_owned is set and inner is non-NULL.
3084 pub extern "C" fn ChannelAnnouncement_free(this_obj: ChannelAnnouncement) { }
3086 /// Used only if an object of this type is returned as a trait impl by a method
3087 extern "C" fn ChannelAnnouncement_free_void(this_ptr: *mut c_void) {
3088 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeChannelAnnouncement); }
3091 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
3092 impl ChannelAnnouncement {
3093 pub(crate) fn take_inner(mut self) -> *mut nativeChannelAnnouncement {
3094 assert!(self.is_owned);
3095 let ret = self.inner;
3096 self.inner = std::ptr::null_mut();
3100 /// Authentication of the announcement by the first public node
3102 pub extern "C" fn ChannelAnnouncement_get_node_signature_1(this_ptr: &ChannelAnnouncement) -> crate::c_types::Signature {
3103 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.node_signature_1;
3104 crate::c_types::Signature::from_rust(&(*inner_val))
3106 /// Authentication of the announcement by the first public node
3108 pub extern "C" fn ChannelAnnouncement_set_node_signature_1(this_ptr: &mut ChannelAnnouncement, mut val: crate::c_types::Signature) {
3109 unsafe { &mut *this_ptr.inner }.node_signature_1 = val.into_rust();
3111 /// Authentication of the announcement by the second public node
3113 pub extern "C" fn ChannelAnnouncement_get_node_signature_2(this_ptr: &ChannelAnnouncement) -> crate::c_types::Signature {
3114 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.node_signature_2;
3115 crate::c_types::Signature::from_rust(&(*inner_val))
3117 /// Authentication of the announcement by the second public node
3119 pub extern "C" fn ChannelAnnouncement_set_node_signature_2(this_ptr: &mut ChannelAnnouncement, mut val: crate::c_types::Signature) {
3120 unsafe { &mut *this_ptr.inner }.node_signature_2 = val.into_rust();
3122 /// Proof of funding UTXO ownership by the first public node
3124 pub extern "C" fn ChannelAnnouncement_get_bitcoin_signature_1(this_ptr: &ChannelAnnouncement) -> crate::c_types::Signature {
3125 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.bitcoin_signature_1;
3126 crate::c_types::Signature::from_rust(&(*inner_val))
3128 /// Proof of funding UTXO ownership by the first public node
3130 pub extern "C" fn ChannelAnnouncement_set_bitcoin_signature_1(this_ptr: &mut ChannelAnnouncement, mut val: crate::c_types::Signature) {
3131 unsafe { &mut *this_ptr.inner }.bitcoin_signature_1 = val.into_rust();
3133 /// Proof of funding UTXO ownership by the second public node
3135 pub extern "C" fn ChannelAnnouncement_get_bitcoin_signature_2(this_ptr: &ChannelAnnouncement) -> crate::c_types::Signature {
3136 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.bitcoin_signature_2;
3137 crate::c_types::Signature::from_rust(&(*inner_val))
3139 /// Proof of funding UTXO ownership by the second public node
3141 pub extern "C" fn ChannelAnnouncement_set_bitcoin_signature_2(this_ptr: &mut ChannelAnnouncement, mut val: crate::c_types::Signature) {
3142 unsafe { &mut *this_ptr.inner }.bitcoin_signature_2 = val.into_rust();
3144 /// The actual announcement
3146 pub extern "C" fn ChannelAnnouncement_get_contents(this_ptr: &ChannelAnnouncement) -> crate::lightning::ln::msgs::UnsignedChannelAnnouncement {
3147 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.contents;
3148 crate::lightning::ln::msgs::UnsignedChannelAnnouncement { inner: unsafe { ( (&((*inner_val)) as *const _) as *mut _) }, is_owned: false }
3150 /// The actual announcement
3152 pub extern "C" fn ChannelAnnouncement_set_contents(this_ptr: &mut ChannelAnnouncement, mut val: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) {
3153 unsafe { &mut *this_ptr.inner }.contents = *unsafe { Box::from_raw(val.take_inner()) };
3155 /// Constructs a new ChannelAnnouncement given each field
3158 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::lightning::ln::msgs::UnsignedChannelAnnouncement) -> ChannelAnnouncement {
3159 ChannelAnnouncement { inner: Box::into_raw(Box::new(nativeChannelAnnouncement {
3160 node_signature_1: node_signature_1_arg.into_rust(),
3161 node_signature_2: node_signature_2_arg.into_rust(),
3162 bitcoin_signature_1: bitcoin_signature_1_arg.into_rust(),
3163 bitcoin_signature_2: bitcoin_signature_2_arg.into_rust(),
3164 contents: *unsafe { Box::from_raw(contents_arg.take_inner()) },
3165 })), is_owned: true }
3167 impl Clone for ChannelAnnouncement {
3168 fn clone(&self) -> Self {
3170 inner: if <*mut nativeChannelAnnouncement>::is_null(self.inner) { std::ptr::null_mut() } else {
3171 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
3177 /// Used only if an object of this type is returned as a trait impl by a method
3178 pub(crate) extern "C" fn ChannelAnnouncement_clone_void(this_ptr: *const c_void) -> *mut c_void {
3179 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeChannelAnnouncement)).clone() })) as *mut c_void
3182 /// Creates a copy of the ChannelAnnouncement
3183 pub extern "C" fn ChannelAnnouncement_clone(orig: &ChannelAnnouncement) -> ChannelAnnouncement {
3187 use lightning::ln::msgs::UnsignedChannelUpdate as nativeUnsignedChannelUpdateImport;
3188 type nativeUnsignedChannelUpdate = nativeUnsignedChannelUpdateImport;
3190 /// The unsigned part of a channel_update
3193 pub struct UnsignedChannelUpdate {
3194 /// A pointer to the opaque Rust object.
3196 /// Nearly everywhere, inner must be non-null, however in places where
3197 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
3198 pub inner: *mut nativeUnsignedChannelUpdate,
3199 /// Indicates that this is the only struct which contains the same pointer.
3201 /// Rust functions which take ownership of an object provided via an argument require
3202 /// this to be true and invalidate the object pointed to by inner.
3206 impl Drop for UnsignedChannelUpdate {
3207 fn drop(&mut self) {
3208 if self.is_owned && !<*mut nativeUnsignedChannelUpdate>::is_null(self.inner) {
3209 let _ = unsafe { Box::from_raw(self.inner) };
3213 /// Frees any resources used by the UnsignedChannelUpdate, if is_owned is set and inner is non-NULL.
3215 pub extern "C" fn UnsignedChannelUpdate_free(this_obj: UnsignedChannelUpdate) { }
3217 /// Used only if an object of this type is returned as a trait impl by a method
3218 extern "C" fn UnsignedChannelUpdate_free_void(this_ptr: *mut c_void) {
3219 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeUnsignedChannelUpdate); }
3222 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
3223 impl UnsignedChannelUpdate {
3224 pub(crate) fn take_inner(mut self) -> *mut nativeUnsignedChannelUpdate {
3225 assert!(self.is_owned);
3226 let ret = self.inner;
3227 self.inner = std::ptr::null_mut();
3231 /// The genesis hash of the blockchain where the channel is to be opened
3233 pub extern "C" fn UnsignedChannelUpdate_get_chain_hash(this_ptr: &UnsignedChannelUpdate) -> *const [u8; 32] {
3234 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.chain_hash;
3235 (*inner_val).as_inner()
3237 /// The genesis hash of the blockchain where the channel is to be opened
3239 pub extern "C" fn UnsignedChannelUpdate_set_chain_hash(this_ptr: &mut UnsignedChannelUpdate, mut val: crate::c_types::ThirtyTwoBytes) {
3240 unsafe { &mut *this_ptr.inner }.chain_hash = ::bitcoin::hash_types::BlockHash::from_slice(&val.data[..]).unwrap();
3242 /// The short channel ID
3244 pub extern "C" fn UnsignedChannelUpdate_get_short_channel_id(this_ptr: &UnsignedChannelUpdate) -> u64 {
3245 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.short_channel_id;
3248 /// The short channel ID
3250 pub extern "C" fn UnsignedChannelUpdate_set_short_channel_id(this_ptr: &mut UnsignedChannelUpdate, mut val: u64) {
3251 unsafe { &mut *this_ptr.inner }.short_channel_id = val;
3253 /// A strictly monotonic announcement counter, with gaps allowed, specific to this channel
3255 pub extern "C" fn UnsignedChannelUpdate_get_timestamp(this_ptr: &UnsignedChannelUpdate) -> u32 {
3256 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.timestamp;
3259 /// A strictly monotonic announcement counter, with gaps allowed, specific to this channel
3261 pub extern "C" fn UnsignedChannelUpdate_set_timestamp(this_ptr: &mut UnsignedChannelUpdate, mut val: u32) {
3262 unsafe { &mut *this_ptr.inner }.timestamp = val;
3266 pub extern "C" fn UnsignedChannelUpdate_get_flags(this_ptr: &UnsignedChannelUpdate) -> u8 {
3267 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.flags;
3272 pub extern "C" fn UnsignedChannelUpdate_set_flags(this_ptr: &mut UnsignedChannelUpdate, mut val: u8) {
3273 unsafe { &mut *this_ptr.inner }.flags = val;
3275 /// The number of blocks such that if:
3276 /// `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
3277 /// then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines
3278 /// the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a
3279 /// cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10,
3280 /// then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before
3281 /// forwarding. Note that the HTLC sender is the one who originally sets this value when
3282 /// constructing the route.
3284 pub extern "C" fn UnsignedChannelUpdate_get_cltv_expiry_delta(this_ptr: &UnsignedChannelUpdate) -> u16 {
3285 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.cltv_expiry_delta;
3288 /// The number of blocks such that if:
3289 /// `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
3290 /// then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines
3291 /// the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a
3292 /// cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10,
3293 /// then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before
3294 /// forwarding. Note that the HTLC sender is the one who originally sets this value when
3295 /// constructing the route.
3297 pub extern "C" fn UnsignedChannelUpdate_set_cltv_expiry_delta(this_ptr: &mut UnsignedChannelUpdate, mut val: u16) {
3298 unsafe { &mut *this_ptr.inner }.cltv_expiry_delta = val;
3300 /// The minimum HTLC size incoming to sender, in milli-satoshi
3302 pub extern "C" fn UnsignedChannelUpdate_get_htlc_minimum_msat(this_ptr: &UnsignedChannelUpdate) -> u64 {
3303 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.htlc_minimum_msat;
3306 /// The minimum HTLC size incoming to sender, in milli-satoshi
3308 pub extern "C" fn UnsignedChannelUpdate_set_htlc_minimum_msat(this_ptr: &mut UnsignedChannelUpdate, mut val: u64) {
3309 unsafe { &mut *this_ptr.inner }.htlc_minimum_msat = val;
3311 /// The base HTLC fee charged by sender, in milli-satoshi
3313 pub extern "C" fn UnsignedChannelUpdate_get_fee_base_msat(this_ptr: &UnsignedChannelUpdate) -> u32 {
3314 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.fee_base_msat;
3317 /// The base HTLC fee charged by sender, in milli-satoshi
3319 pub extern "C" fn UnsignedChannelUpdate_set_fee_base_msat(this_ptr: &mut UnsignedChannelUpdate, mut val: u32) {
3320 unsafe { &mut *this_ptr.inner }.fee_base_msat = val;
3322 /// The amount to fee multiplier, in micro-satoshi
3324 pub extern "C" fn UnsignedChannelUpdate_get_fee_proportional_millionths(this_ptr: &UnsignedChannelUpdate) -> u32 {
3325 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.fee_proportional_millionths;
3328 /// The amount to fee multiplier, in micro-satoshi
3330 pub extern "C" fn UnsignedChannelUpdate_set_fee_proportional_millionths(this_ptr: &mut UnsignedChannelUpdate, mut val: u32) {
3331 unsafe { &mut *this_ptr.inner }.fee_proportional_millionths = val;
3333 impl Clone for UnsignedChannelUpdate {
3334 fn clone(&self) -> Self {
3336 inner: if <*mut nativeUnsignedChannelUpdate>::is_null(self.inner) { std::ptr::null_mut() } else {
3337 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
3343 /// Used only if an object of this type is returned as a trait impl by a method
3344 pub(crate) extern "C" fn UnsignedChannelUpdate_clone_void(this_ptr: *const c_void) -> *mut c_void {
3345 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeUnsignedChannelUpdate)).clone() })) as *mut c_void
3348 /// Creates a copy of the UnsignedChannelUpdate
3349 pub extern "C" fn UnsignedChannelUpdate_clone(orig: &UnsignedChannelUpdate) -> UnsignedChannelUpdate {
3353 use lightning::ln::msgs::ChannelUpdate as nativeChannelUpdateImport;
3354 type nativeChannelUpdate = nativeChannelUpdateImport;
3356 /// A channel_update message to be sent or received from a peer
3359 pub struct ChannelUpdate {
3360 /// A pointer to the opaque Rust object.
3362 /// Nearly everywhere, inner must be non-null, however in places where
3363 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
3364 pub inner: *mut nativeChannelUpdate,
3365 /// Indicates that this is the only struct which contains the same pointer.
3367 /// Rust functions which take ownership of an object provided via an argument require
3368 /// this to be true and invalidate the object pointed to by inner.
3372 impl Drop for ChannelUpdate {
3373 fn drop(&mut self) {
3374 if self.is_owned && !<*mut nativeChannelUpdate>::is_null(self.inner) {
3375 let _ = unsafe { Box::from_raw(self.inner) };
3379 /// Frees any resources used by the ChannelUpdate, if is_owned is set and inner is non-NULL.
3381 pub extern "C" fn ChannelUpdate_free(this_obj: ChannelUpdate) { }
3383 /// Used only if an object of this type is returned as a trait impl by a method
3384 extern "C" fn ChannelUpdate_free_void(this_ptr: *mut c_void) {
3385 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeChannelUpdate); }
3388 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
3389 impl ChannelUpdate {
3390 pub(crate) fn take_inner(mut self) -> *mut nativeChannelUpdate {
3391 assert!(self.is_owned);
3392 let ret = self.inner;
3393 self.inner = std::ptr::null_mut();
3397 /// A signature of the channel update
3399 pub extern "C" fn ChannelUpdate_get_signature(this_ptr: &ChannelUpdate) -> crate::c_types::Signature {
3400 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.signature;
3401 crate::c_types::Signature::from_rust(&(*inner_val))
3403 /// A signature of the channel update
3405 pub extern "C" fn ChannelUpdate_set_signature(this_ptr: &mut ChannelUpdate, mut val: crate::c_types::Signature) {
3406 unsafe { &mut *this_ptr.inner }.signature = val.into_rust();
3408 /// The actual channel update
3410 pub extern "C" fn ChannelUpdate_get_contents(this_ptr: &ChannelUpdate) -> crate::lightning::ln::msgs::UnsignedChannelUpdate {
3411 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.contents;
3412 crate::lightning::ln::msgs::UnsignedChannelUpdate { inner: unsafe { ( (&((*inner_val)) as *const _) as *mut _) }, is_owned: false }
3414 /// The actual channel update
3416 pub extern "C" fn ChannelUpdate_set_contents(this_ptr: &mut ChannelUpdate, mut val: crate::lightning::ln::msgs::UnsignedChannelUpdate) {
3417 unsafe { &mut *this_ptr.inner }.contents = *unsafe { Box::from_raw(val.take_inner()) };
3419 /// Constructs a new ChannelUpdate given each field
3422 pub extern "C" fn ChannelUpdate_new(mut signature_arg: crate::c_types::Signature, mut contents_arg: crate::lightning::ln::msgs::UnsignedChannelUpdate) -> ChannelUpdate {
3423 ChannelUpdate { inner: Box::into_raw(Box::new(nativeChannelUpdate {
3424 signature: signature_arg.into_rust(),
3425 contents: *unsafe { Box::from_raw(contents_arg.take_inner()) },
3426 })), is_owned: true }
3428 impl Clone for ChannelUpdate {
3429 fn clone(&self) -> Self {
3431 inner: if <*mut nativeChannelUpdate>::is_null(self.inner) { std::ptr::null_mut() } else {
3432 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
3438 /// Used only if an object of this type is returned as a trait impl by a method
3439 pub(crate) extern "C" fn ChannelUpdate_clone_void(this_ptr: *const c_void) -> *mut c_void {
3440 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeChannelUpdate)).clone() })) as *mut c_void
3443 /// Creates a copy of the ChannelUpdate
3444 pub extern "C" fn ChannelUpdate_clone(orig: &ChannelUpdate) -> ChannelUpdate {
3448 use lightning::ln::msgs::QueryChannelRange as nativeQueryChannelRangeImport;
3449 type nativeQueryChannelRange = nativeQueryChannelRangeImport;
3451 /// A query_channel_range message is used to query a peer for channel
3452 /// UTXOs in a range of blocks. The recipient of a query makes a best
3453 /// effort to reply to the query using one or more reply_channel_range
3457 pub struct QueryChannelRange {
3458 /// A pointer to the opaque Rust object.
3460 /// Nearly everywhere, inner must be non-null, however in places where
3461 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
3462 pub inner: *mut nativeQueryChannelRange,
3463 /// Indicates that this is the only struct which contains the same pointer.
3465 /// Rust functions which take ownership of an object provided via an argument require
3466 /// this to be true and invalidate the object pointed to by inner.
3470 impl Drop for QueryChannelRange {
3471 fn drop(&mut self) {
3472 if self.is_owned && !<*mut nativeQueryChannelRange>::is_null(self.inner) {
3473 let _ = unsafe { Box::from_raw(self.inner) };
3477 /// Frees any resources used by the QueryChannelRange, if is_owned is set and inner is non-NULL.
3479 pub extern "C" fn QueryChannelRange_free(this_obj: QueryChannelRange) { }
3481 /// Used only if an object of this type is returned as a trait impl by a method
3482 extern "C" fn QueryChannelRange_free_void(this_ptr: *mut c_void) {
3483 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeQueryChannelRange); }
3486 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
3487 impl QueryChannelRange {
3488 pub(crate) fn take_inner(mut self) -> *mut nativeQueryChannelRange {
3489 assert!(self.is_owned);
3490 let ret = self.inner;
3491 self.inner = std::ptr::null_mut();
3495 /// The genesis hash of the blockchain being queried
3497 pub extern "C" fn QueryChannelRange_get_chain_hash(this_ptr: &QueryChannelRange) -> *const [u8; 32] {
3498 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.chain_hash;
3499 (*inner_val).as_inner()
3501 /// The genesis hash of the blockchain being queried
3503 pub extern "C" fn QueryChannelRange_set_chain_hash(this_ptr: &mut QueryChannelRange, mut val: crate::c_types::ThirtyTwoBytes) {
3504 unsafe { &mut *this_ptr.inner }.chain_hash = ::bitcoin::hash_types::BlockHash::from_slice(&val.data[..]).unwrap();
3506 /// The height of the first block for the channel UTXOs being queried
3508 pub extern "C" fn QueryChannelRange_get_first_blocknum(this_ptr: &QueryChannelRange) -> u32 {
3509 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.first_blocknum;
3512 /// The height of the first block for the channel UTXOs being queried
3514 pub extern "C" fn QueryChannelRange_set_first_blocknum(this_ptr: &mut QueryChannelRange, mut val: u32) {
3515 unsafe { &mut *this_ptr.inner }.first_blocknum = val;
3517 /// The number of blocks to include in the query results
3519 pub extern "C" fn QueryChannelRange_get_number_of_blocks(this_ptr: &QueryChannelRange) -> u32 {
3520 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.number_of_blocks;
3523 /// The number of blocks to include in the query results
3525 pub extern "C" fn QueryChannelRange_set_number_of_blocks(this_ptr: &mut QueryChannelRange, mut val: u32) {
3526 unsafe { &mut *this_ptr.inner }.number_of_blocks = val;
3528 /// Constructs a new QueryChannelRange given each field
3531 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 {
3532 QueryChannelRange { inner: Box::into_raw(Box::new(nativeQueryChannelRange {
3533 chain_hash: ::bitcoin::hash_types::BlockHash::from_slice(&chain_hash_arg.data[..]).unwrap(),
3534 first_blocknum: first_blocknum_arg,
3535 number_of_blocks: number_of_blocks_arg,
3536 })), is_owned: true }
3538 impl Clone for QueryChannelRange {
3539 fn clone(&self) -> Self {
3541 inner: if <*mut nativeQueryChannelRange>::is_null(self.inner) { 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 QueryChannelRange_clone_void(this_ptr: *const c_void) -> *mut c_void {
3550 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeQueryChannelRange)).clone() })) as *mut c_void
3553 /// Creates a copy of the QueryChannelRange
3554 pub extern "C" fn QueryChannelRange_clone(orig: &QueryChannelRange) -> QueryChannelRange {
3558 use lightning::ln::msgs::ReplyChannelRange as nativeReplyChannelRangeImport;
3559 type nativeReplyChannelRange = nativeReplyChannelRangeImport;
3561 /// A reply_channel_range message is a reply to a query_channel_range
3562 /// message. Multiple reply_channel_range messages can be sent in reply
3563 /// to a single query_channel_range message. The query recipient makes a
3564 /// best effort to respond based on their local network view which may
3565 /// not be a perfect view of the network. The short_channel_ids in the
3566 /// reply are encoded. We only support encoding_type=0 uncompressed
3567 /// serialization and do not support encoding_type=1 zlib serialization.
3570 pub struct ReplyChannelRange {
3571 /// A pointer to the opaque Rust object.
3573 /// Nearly everywhere, inner must be non-null, however in places where
3574 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
3575 pub inner: *mut nativeReplyChannelRange,
3576 /// Indicates that this is the only struct which contains the same pointer.
3578 /// Rust functions which take ownership of an object provided via an argument require
3579 /// this to be true and invalidate the object pointed to by inner.
3583 impl Drop for ReplyChannelRange {
3584 fn drop(&mut self) {
3585 if self.is_owned && !<*mut nativeReplyChannelRange>::is_null(self.inner) {
3586 let _ = unsafe { Box::from_raw(self.inner) };
3590 /// Frees any resources used by the ReplyChannelRange, if is_owned is set and inner is non-NULL.
3592 pub extern "C" fn ReplyChannelRange_free(this_obj: ReplyChannelRange) { }
3594 /// Used only if an object of this type is returned as a trait impl by a method
3595 extern "C" fn ReplyChannelRange_free_void(this_ptr: *mut c_void) {
3596 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeReplyChannelRange); }
3599 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
3600 impl ReplyChannelRange {
3601 pub(crate) fn take_inner(mut self) -> *mut nativeReplyChannelRange {
3602 assert!(self.is_owned);
3603 let ret = self.inner;
3604 self.inner = std::ptr::null_mut();
3608 /// The genesis hash of the blockchain being queried
3610 pub extern "C" fn ReplyChannelRange_get_chain_hash(this_ptr: &ReplyChannelRange) -> *const [u8; 32] {
3611 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.chain_hash;
3612 (*inner_val).as_inner()
3614 /// The genesis hash of the blockchain being queried
3616 pub extern "C" fn ReplyChannelRange_set_chain_hash(this_ptr: &mut ReplyChannelRange, mut val: crate::c_types::ThirtyTwoBytes) {
3617 unsafe { &mut *this_ptr.inner }.chain_hash = ::bitcoin::hash_types::BlockHash::from_slice(&val.data[..]).unwrap();
3619 /// The height of the first block in the range of the reply
3621 pub extern "C" fn ReplyChannelRange_get_first_blocknum(this_ptr: &ReplyChannelRange) -> u32 {
3622 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.first_blocknum;
3625 /// The height of the first block in the range of the reply
3627 pub extern "C" fn ReplyChannelRange_set_first_blocknum(this_ptr: &mut ReplyChannelRange, mut val: u32) {
3628 unsafe { &mut *this_ptr.inner }.first_blocknum = val;
3630 /// The number of blocks included in the range of the reply
3632 pub extern "C" fn ReplyChannelRange_get_number_of_blocks(this_ptr: &ReplyChannelRange) -> u32 {
3633 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.number_of_blocks;
3636 /// The number of blocks included in the range of the reply
3638 pub extern "C" fn ReplyChannelRange_set_number_of_blocks(this_ptr: &mut ReplyChannelRange, mut val: u32) {
3639 unsafe { &mut *this_ptr.inner }.number_of_blocks = val;
3641 /// True when this is the final reply for a query
3643 pub extern "C" fn ReplyChannelRange_get_sync_complete(this_ptr: &ReplyChannelRange) -> bool {
3644 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.sync_complete;
3647 /// True when this is the final reply for a query
3649 pub extern "C" fn ReplyChannelRange_set_sync_complete(this_ptr: &mut ReplyChannelRange, mut val: bool) {
3650 unsafe { &mut *this_ptr.inner }.sync_complete = val;
3652 /// The short_channel_ids in the channel range
3654 pub extern "C" fn ReplyChannelRange_set_short_channel_ids(this_ptr: &mut ReplyChannelRange, mut val: crate::c_types::derived::CVec_u64Z) {
3655 let mut local_val = Vec::new(); for mut item in val.into_rust().drain(..) { local_val.push( { item }); };
3656 unsafe { &mut *this_ptr.inner }.short_channel_ids = local_val;
3658 /// Constructs a new ReplyChannelRange given each field
3661 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 {
3662 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 }); };
3663 ReplyChannelRange { inner: Box::into_raw(Box::new(nativeReplyChannelRange {
3664 chain_hash: ::bitcoin::hash_types::BlockHash::from_slice(&chain_hash_arg.data[..]).unwrap(),
3665 first_blocknum: first_blocknum_arg,
3666 number_of_blocks: number_of_blocks_arg,
3667 sync_complete: sync_complete_arg,
3668 short_channel_ids: local_short_channel_ids_arg,
3669 })), is_owned: true }
3671 impl Clone for ReplyChannelRange {
3672 fn clone(&self) -> Self {
3674 inner: if <*mut nativeReplyChannelRange>::is_null(self.inner) { std::ptr::null_mut() } else {
3675 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
3681 /// Used only if an object of this type is returned as a trait impl by a method
3682 pub(crate) extern "C" fn ReplyChannelRange_clone_void(this_ptr: *const c_void) -> *mut c_void {
3683 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeReplyChannelRange)).clone() })) as *mut c_void
3686 /// Creates a copy of the ReplyChannelRange
3687 pub extern "C" fn ReplyChannelRange_clone(orig: &ReplyChannelRange) -> ReplyChannelRange {
3691 use lightning::ln::msgs::QueryShortChannelIds as nativeQueryShortChannelIdsImport;
3692 type nativeQueryShortChannelIds = nativeQueryShortChannelIdsImport;
3694 /// A query_short_channel_ids message is used to query a peer for
3695 /// routing gossip messages related to one or more short_channel_ids.
3696 /// The query recipient will reply with the latest, if available,
3697 /// channel_announcement, channel_update and node_announcement messages
3698 /// it maintains for the requested short_channel_ids followed by a
3699 /// reply_short_channel_ids_end message. The short_channel_ids sent in
3700 /// this query are encoded. We only support encoding_type=0 uncompressed
3701 /// serialization and do not support encoding_type=1 zlib serialization.
3704 pub struct QueryShortChannelIds {
3705 /// A pointer to the opaque Rust object.
3707 /// Nearly everywhere, inner must be non-null, however in places where
3708 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
3709 pub inner: *mut nativeQueryShortChannelIds,
3710 /// Indicates that this is the only struct which contains the same pointer.
3712 /// Rust functions which take ownership of an object provided via an argument require
3713 /// this to be true and invalidate the object pointed to by inner.
3717 impl Drop for QueryShortChannelIds {
3718 fn drop(&mut self) {
3719 if self.is_owned && !<*mut nativeQueryShortChannelIds>::is_null(self.inner) {
3720 let _ = unsafe { Box::from_raw(self.inner) };
3724 /// Frees any resources used by the QueryShortChannelIds, if is_owned is set and inner is non-NULL.
3726 pub extern "C" fn QueryShortChannelIds_free(this_obj: QueryShortChannelIds) { }
3728 /// Used only if an object of this type is returned as a trait impl by a method
3729 extern "C" fn QueryShortChannelIds_free_void(this_ptr: *mut c_void) {
3730 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeQueryShortChannelIds); }
3733 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
3734 impl QueryShortChannelIds {
3735 pub(crate) fn take_inner(mut self) -> *mut nativeQueryShortChannelIds {
3736 assert!(self.is_owned);
3737 let ret = self.inner;
3738 self.inner = std::ptr::null_mut();
3742 /// The genesis hash of the blockchain being queried
3744 pub extern "C" fn QueryShortChannelIds_get_chain_hash(this_ptr: &QueryShortChannelIds) -> *const [u8; 32] {
3745 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.chain_hash;
3746 (*inner_val).as_inner()
3748 /// The genesis hash of the blockchain being queried
3750 pub extern "C" fn QueryShortChannelIds_set_chain_hash(this_ptr: &mut QueryShortChannelIds, mut val: crate::c_types::ThirtyTwoBytes) {
3751 unsafe { &mut *this_ptr.inner }.chain_hash = ::bitcoin::hash_types::BlockHash::from_slice(&val.data[..]).unwrap();
3753 /// The short_channel_ids that are being queried
3755 pub extern "C" fn QueryShortChannelIds_set_short_channel_ids(this_ptr: &mut QueryShortChannelIds, mut val: crate::c_types::derived::CVec_u64Z) {
3756 let mut local_val = Vec::new(); for mut item in val.into_rust().drain(..) { local_val.push( { item }); };
3757 unsafe { &mut *this_ptr.inner }.short_channel_ids = local_val;
3759 /// Constructs a new QueryShortChannelIds given each field
3762 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 {
3763 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 }); };
3764 QueryShortChannelIds { inner: Box::into_raw(Box::new(nativeQueryShortChannelIds {
3765 chain_hash: ::bitcoin::hash_types::BlockHash::from_slice(&chain_hash_arg.data[..]).unwrap(),
3766 short_channel_ids: local_short_channel_ids_arg,
3767 })), is_owned: true }
3769 impl Clone for QueryShortChannelIds {
3770 fn clone(&self) -> Self {
3772 inner: if <*mut nativeQueryShortChannelIds>::is_null(self.inner) { std::ptr::null_mut() } else {
3773 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
3779 /// Used only if an object of this type is returned as a trait impl by a method
3780 pub(crate) extern "C" fn QueryShortChannelIds_clone_void(this_ptr: *const c_void) -> *mut c_void {
3781 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeQueryShortChannelIds)).clone() })) as *mut c_void
3784 /// Creates a copy of the QueryShortChannelIds
3785 pub extern "C" fn QueryShortChannelIds_clone(orig: &QueryShortChannelIds) -> QueryShortChannelIds {
3789 use lightning::ln::msgs::ReplyShortChannelIdsEnd as nativeReplyShortChannelIdsEndImport;
3790 type nativeReplyShortChannelIdsEnd = nativeReplyShortChannelIdsEndImport;
3792 /// A reply_short_channel_ids_end message is sent as a reply to a
3793 /// query_short_channel_ids message. The query recipient makes a best
3794 /// effort to respond based on their local network view which may not be
3795 /// a perfect view of the network.
3798 pub struct ReplyShortChannelIdsEnd {
3799 /// A pointer to the opaque Rust object.
3801 /// Nearly everywhere, inner must be non-null, however in places where
3802 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
3803 pub inner: *mut nativeReplyShortChannelIdsEnd,
3804 /// Indicates that this is the only struct which contains the same pointer.
3806 /// Rust functions which take ownership of an object provided via an argument require
3807 /// this to be true and invalidate the object pointed to by inner.
3811 impl Drop for ReplyShortChannelIdsEnd {
3812 fn drop(&mut self) {
3813 if self.is_owned && !<*mut nativeReplyShortChannelIdsEnd>::is_null(self.inner) {
3814 let _ = unsafe { Box::from_raw(self.inner) };
3818 /// Frees any resources used by the ReplyShortChannelIdsEnd, if is_owned is set and inner is non-NULL.
3820 pub extern "C" fn ReplyShortChannelIdsEnd_free(this_obj: ReplyShortChannelIdsEnd) { }
3822 /// Used only if an object of this type is returned as a trait impl by a method
3823 extern "C" fn ReplyShortChannelIdsEnd_free_void(this_ptr: *mut c_void) {
3824 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeReplyShortChannelIdsEnd); }
3827 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
3828 impl ReplyShortChannelIdsEnd {
3829 pub(crate) fn take_inner(mut self) -> *mut nativeReplyShortChannelIdsEnd {
3830 assert!(self.is_owned);
3831 let ret = self.inner;
3832 self.inner = std::ptr::null_mut();
3836 /// The genesis hash of the blockchain that was queried
3838 pub extern "C" fn ReplyShortChannelIdsEnd_get_chain_hash(this_ptr: &ReplyShortChannelIdsEnd) -> *const [u8; 32] {
3839 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.chain_hash;
3840 (*inner_val).as_inner()
3842 /// The genesis hash of the blockchain that was queried
3844 pub extern "C" fn ReplyShortChannelIdsEnd_set_chain_hash(this_ptr: &mut ReplyShortChannelIdsEnd, mut val: crate::c_types::ThirtyTwoBytes) {
3845 unsafe { &mut *this_ptr.inner }.chain_hash = ::bitcoin::hash_types::BlockHash::from_slice(&val.data[..]).unwrap();
3847 /// Indicates if the query recipient maintains up-to-date channel
3848 /// information for the chain_hash
3850 pub extern "C" fn ReplyShortChannelIdsEnd_get_full_information(this_ptr: &ReplyShortChannelIdsEnd) -> bool {
3851 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.full_information;
3854 /// Indicates if the query recipient maintains up-to-date channel
3855 /// information for the chain_hash
3857 pub extern "C" fn ReplyShortChannelIdsEnd_set_full_information(this_ptr: &mut ReplyShortChannelIdsEnd, mut val: bool) {
3858 unsafe { &mut *this_ptr.inner }.full_information = val;
3860 /// Constructs a new ReplyShortChannelIdsEnd given each field
3863 pub extern "C" fn ReplyShortChannelIdsEnd_new(mut chain_hash_arg: crate::c_types::ThirtyTwoBytes, mut full_information_arg: bool) -> ReplyShortChannelIdsEnd {
3864 ReplyShortChannelIdsEnd { inner: Box::into_raw(Box::new(nativeReplyShortChannelIdsEnd {
3865 chain_hash: ::bitcoin::hash_types::BlockHash::from_slice(&chain_hash_arg.data[..]).unwrap(),
3866 full_information: full_information_arg,
3867 })), is_owned: true }
3869 impl Clone for ReplyShortChannelIdsEnd {
3870 fn clone(&self) -> Self {
3872 inner: if <*mut nativeReplyShortChannelIdsEnd>::is_null(self.inner) { std::ptr::null_mut() } else {
3873 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
3879 /// Used only if an object of this type is returned as a trait impl by a method
3880 pub(crate) extern "C" fn ReplyShortChannelIdsEnd_clone_void(this_ptr: *const c_void) -> *mut c_void {
3881 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeReplyShortChannelIdsEnd)).clone() })) as *mut c_void
3884 /// Creates a copy of the ReplyShortChannelIdsEnd
3885 pub extern "C" fn ReplyShortChannelIdsEnd_clone(orig: &ReplyShortChannelIdsEnd) -> ReplyShortChannelIdsEnd {
3889 use lightning::ln::msgs::GossipTimestampFilter as nativeGossipTimestampFilterImport;
3890 type nativeGossipTimestampFilter = nativeGossipTimestampFilterImport;
3892 /// A gossip_timestamp_filter message is used by a node to request
3893 /// gossip relay for messages in the requested time range when the
3894 /// gossip_queries feature has been negotiated.
3897 pub struct GossipTimestampFilter {
3898 /// A pointer to the opaque Rust object.
3900 /// Nearly everywhere, inner must be non-null, however in places where
3901 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
3902 pub inner: *mut nativeGossipTimestampFilter,
3903 /// Indicates that this is the only struct which contains the same pointer.
3905 /// Rust functions which take ownership of an object provided via an argument require
3906 /// this to be true and invalidate the object pointed to by inner.
3910 impl Drop for GossipTimestampFilter {
3911 fn drop(&mut self) {
3912 if self.is_owned && !<*mut nativeGossipTimestampFilter>::is_null(self.inner) {
3913 let _ = unsafe { Box::from_raw(self.inner) };
3917 /// Frees any resources used by the GossipTimestampFilter, if is_owned is set and inner is non-NULL.
3919 pub extern "C" fn GossipTimestampFilter_free(this_obj: GossipTimestampFilter) { }
3921 /// Used only if an object of this type is returned as a trait impl by a method
3922 extern "C" fn GossipTimestampFilter_free_void(this_ptr: *mut c_void) {
3923 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeGossipTimestampFilter); }
3926 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
3927 impl GossipTimestampFilter {
3928 pub(crate) fn take_inner(mut self) -> *mut nativeGossipTimestampFilter {
3929 assert!(self.is_owned);
3930 let ret = self.inner;
3931 self.inner = std::ptr::null_mut();
3935 /// The genesis hash of the blockchain for channel and node information
3937 pub extern "C" fn GossipTimestampFilter_get_chain_hash(this_ptr: &GossipTimestampFilter) -> *const [u8; 32] {
3938 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.chain_hash;
3939 (*inner_val).as_inner()
3941 /// The genesis hash of the blockchain for channel and node information
3943 pub extern "C" fn GossipTimestampFilter_set_chain_hash(this_ptr: &mut GossipTimestampFilter, mut val: crate::c_types::ThirtyTwoBytes) {
3944 unsafe { &mut *this_ptr.inner }.chain_hash = ::bitcoin::hash_types::BlockHash::from_slice(&val.data[..]).unwrap();
3946 /// The starting unix timestamp
3948 pub extern "C" fn GossipTimestampFilter_get_first_timestamp(this_ptr: &GossipTimestampFilter) -> u32 {
3949 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.first_timestamp;
3952 /// The starting unix timestamp
3954 pub extern "C" fn GossipTimestampFilter_set_first_timestamp(this_ptr: &mut GossipTimestampFilter, mut val: u32) {
3955 unsafe { &mut *this_ptr.inner }.first_timestamp = val;
3957 /// The range of information in seconds
3959 pub extern "C" fn GossipTimestampFilter_get_timestamp_range(this_ptr: &GossipTimestampFilter) -> u32 {
3960 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.timestamp_range;
3963 /// The range of information in seconds
3965 pub extern "C" fn GossipTimestampFilter_set_timestamp_range(this_ptr: &mut GossipTimestampFilter, mut val: u32) {
3966 unsafe { &mut *this_ptr.inner }.timestamp_range = val;
3968 /// Constructs a new GossipTimestampFilter given each field
3971 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 {
3972 GossipTimestampFilter { inner: Box::into_raw(Box::new(nativeGossipTimestampFilter {
3973 chain_hash: ::bitcoin::hash_types::BlockHash::from_slice(&chain_hash_arg.data[..]).unwrap(),
3974 first_timestamp: first_timestamp_arg,
3975 timestamp_range: timestamp_range_arg,
3976 })), is_owned: true }
3978 impl Clone for GossipTimestampFilter {
3979 fn clone(&self) -> Self {
3981 inner: if <*mut nativeGossipTimestampFilter>::is_null(self.inner) { std::ptr::null_mut() } else {
3982 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
3988 /// Used only if an object of this type is returned as a trait impl by a method
3989 pub(crate) extern "C" fn GossipTimestampFilter_clone_void(this_ptr: *const c_void) -> *mut c_void {
3990 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeGossipTimestampFilter)).clone() })) as *mut c_void
3993 /// Creates a copy of the GossipTimestampFilter
3994 pub extern "C" fn GossipTimestampFilter_clone(orig: &GossipTimestampFilter) -> GossipTimestampFilter {
3997 /// Used to put an error message in a LightningError
4001 pub enum ErrorAction {
4002 /// The peer took some action which made us think they were useless. Disconnect them.
4004 /// An error message which we should make an effort to send before we disconnect.
4005 msg: crate::lightning::ln::msgs::ErrorMessage,
4007 /// The peer did something harmless that we weren't able to process, just log and ignore
4009 /// The peer did something incorrect. Tell them.
4011 /// The message to send.
4012 msg: crate::lightning::ln::msgs::ErrorMessage,
4015 use lightning::ln::msgs::ErrorAction as nativeErrorAction;
4018 pub(crate) fn to_native(&self) -> nativeErrorAction {
4020 ErrorAction::DisconnectPeer {ref msg, } => {
4021 let mut msg_nonref = (*msg).clone();
4022 let mut local_msg_nonref = if msg_nonref.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(msg_nonref.take_inner()) } }) };
4023 nativeErrorAction::DisconnectPeer {
4024 msg: local_msg_nonref,
4027 ErrorAction::IgnoreError => nativeErrorAction::IgnoreError,
4028 ErrorAction::SendErrorMessage {ref msg, } => {
4029 let mut msg_nonref = (*msg).clone();
4030 nativeErrorAction::SendErrorMessage {
4031 msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) },
4037 pub(crate) fn into_native(self) -> nativeErrorAction {
4039 ErrorAction::DisconnectPeer {mut msg, } => {
4040 let mut local_msg = if msg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(msg.take_inner()) } }) };
4041 nativeErrorAction::DisconnectPeer {
4045 ErrorAction::IgnoreError => nativeErrorAction::IgnoreError,
4046 ErrorAction::SendErrorMessage {mut msg, } => {
4047 nativeErrorAction::SendErrorMessage {
4048 msg: *unsafe { Box::from_raw(msg.take_inner()) },
4054 pub(crate) fn from_native(native: &nativeErrorAction) -> Self {
4056 nativeErrorAction::DisconnectPeer {ref msg, } => {
4057 let mut msg_nonref = (*msg).clone();
4058 let mut local_msg_nonref = crate::lightning::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 };
4059 ErrorAction::DisconnectPeer {
4060 msg: local_msg_nonref,
4063 nativeErrorAction::IgnoreError => ErrorAction::IgnoreError,
4064 nativeErrorAction::SendErrorMessage {ref msg, } => {
4065 let mut msg_nonref = (*msg).clone();
4066 ErrorAction::SendErrorMessage {
4067 msg: crate::lightning::ln::msgs::ErrorMessage { inner: Box::into_raw(Box::new(msg_nonref)), is_owned: true },
4073 pub(crate) fn native_into(native: nativeErrorAction) -> Self {
4075 nativeErrorAction::DisconnectPeer {mut msg, } => {
4076 let mut local_msg = crate::lightning::ln::msgs::ErrorMessage { inner: if msg.is_none() { std::ptr::null_mut() } else { { Box::into_raw(Box::new((msg.unwrap()))) } }, is_owned: true };
4077 ErrorAction::DisconnectPeer {
4081 nativeErrorAction::IgnoreError => ErrorAction::IgnoreError,
4082 nativeErrorAction::SendErrorMessage {mut msg, } => {
4083 ErrorAction::SendErrorMessage {
4084 msg: crate::lightning::ln::msgs::ErrorMessage { inner: Box::into_raw(Box::new(msg)), is_owned: true },
4090 /// Frees any resources used by the ErrorAction
4092 pub extern "C" fn ErrorAction_free(this_ptr: ErrorAction) { }
4093 /// Creates a copy of the ErrorAction
4095 pub extern "C" fn ErrorAction_clone(orig: &ErrorAction) -> ErrorAction {
4099 use lightning::ln::msgs::LightningError as nativeLightningErrorImport;
4100 type nativeLightningError = nativeLightningErrorImport;
4102 /// An Err type for failure to process messages.
4105 pub struct LightningError {
4106 /// A pointer to the opaque Rust object.
4108 /// Nearly everywhere, inner must be non-null, however in places where
4109 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
4110 pub inner: *mut nativeLightningError,
4111 /// Indicates that this is the only struct which contains the same pointer.
4113 /// Rust functions which take ownership of an object provided via an argument require
4114 /// this to be true and invalidate the object pointed to by inner.
4118 impl Drop for LightningError {
4119 fn drop(&mut self) {
4120 if self.is_owned && !<*mut nativeLightningError>::is_null(self.inner) {
4121 let _ = unsafe { Box::from_raw(self.inner) };
4125 /// Frees any resources used by the LightningError, if is_owned is set and inner is non-NULL.
4127 pub extern "C" fn LightningError_free(this_obj: LightningError) { }
4129 /// Used only if an object of this type is returned as a trait impl by a method
4130 extern "C" fn LightningError_free_void(this_ptr: *mut c_void) {
4131 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeLightningError); }
4134 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
4135 impl LightningError {
4136 pub(crate) fn take_inner(mut self) -> *mut nativeLightningError {
4137 assert!(self.is_owned);
4138 let ret = self.inner;
4139 self.inner = std::ptr::null_mut();
4143 /// A human-readable message describing the error
4145 pub extern "C" fn LightningError_get_err(this_ptr: &LightningError) -> crate::c_types::Str {
4146 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.err;
4147 (*inner_val).as_str().into()
4149 /// A human-readable message describing the error
4151 pub extern "C" fn LightningError_set_err(this_ptr: &mut LightningError, mut val: crate::c_types::derived::CVec_u8Z) {
4152 unsafe { &mut *this_ptr.inner }.err = String::from_utf8(val.into_rust()).unwrap();
4154 /// The action which should be taken against the offending peer.
4156 pub extern "C" fn LightningError_get_action(this_ptr: &LightningError) -> crate::lightning::ln::msgs::ErrorAction {
4157 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.action;
4158 crate::lightning::ln::msgs::ErrorAction::from_native(&(*inner_val))
4160 /// The action which should be taken against the offending peer.
4162 pub extern "C" fn LightningError_set_action(this_ptr: &mut LightningError, mut val: crate::lightning::ln::msgs::ErrorAction) {
4163 unsafe { &mut *this_ptr.inner }.action = val.into_native();
4165 /// Constructs a new LightningError given each field
4168 pub extern "C" fn LightningError_new(mut err_arg: crate::c_types::derived::CVec_u8Z, mut action_arg: crate::lightning::ln::msgs::ErrorAction) -> LightningError {
4169 LightningError { inner: Box::into_raw(Box::new(nativeLightningError {
4170 err: String::from_utf8(err_arg.into_rust()).unwrap(),
4171 action: action_arg.into_native(),
4172 })), is_owned: true }
4174 impl Clone for LightningError {
4175 fn clone(&self) -> Self {
4177 inner: if <*mut nativeLightningError>::is_null(self.inner) { std::ptr::null_mut() } else {
4178 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
4184 /// Used only if an object of this type is returned as a trait impl by a method
4185 pub(crate) extern "C" fn LightningError_clone_void(this_ptr: *const c_void) -> *mut c_void {
4186 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeLightningError)).clone() })) as *mut c_void
4189 /// Creates a copy of the LightningError
4190 pub extern "C" fn LightningError_clone(orig: &LightningError) -> LightningError {
4194 use lightning::ln::msgs::CommitmentUpdate as nativeCommitmentUpdateImport;
4195 type nativeCommitmentUpdate = nativeCommitmentUpdateImport;
4197 /// Struct used to return values from revoke_and_ack messages, containing a bunch of commitment
4198 /// transaction updates if they were pending.
4201 pub struct CommitmentUpdate {
4202 /// A pointer to the opaque Rust object.
4204 /// Nearly everywhere, inner must be non-null, however in places where
4205 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
4206 pub inner: *mut nativeCommitmentUpdate,
4207 /// Indicates that this is the only struct which contains the same pointer.
4209 /// Rust functions which take ownership of an object provided via an argument require
4210 /// this to be true and invalidate the object pointed to by inner.
4214 impl Drop for CommitmentUpdate {
4215 fn drop(&mut self) {
4216 if self.is_owned && !<*mut nativeCommitmentUpdate>::is_null(self.inner) {
4217 let _ = unsafe { Box::from_raw(self.inner) };
4221 /// Frees any resources used by the CommitmentUpdate, if is_owned is set and inner is non-NULL.
4223 pub extern "C" fn CommitmentUpdate_free(this_obj: CommitmentUpdate) { }
4225 /// Used only if an object of this type is returned as a trait impl by a method
4226 extern "C" fn CommitmentUpdate_free_void(this_ptr: *mut c_void) {
4227 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeCommitmentUpdate); }
4230 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
4231 impl CommitmentUpdate {
4232 pub(crate) fn take_inner(mut self) -> *mut nativeCommitmentUpdate {
4233 assert!(self.is_owned);
4234 let ret = self.inner;
4235 self.inner = std::ptr::null_mut();
4239 /// update_add_htlc messages which should be sent
4241 pub extern "C" fn CommitmentUpdate_set_update_add_htlcs(this_ptr: &mut CommitmentUpdate, mut val: crate::c_types::derived::CVec_UpdateAddHTLCZ) {
4242 let mut local_val = Vec::new(); for mut item in val.into_rust().drain(..) { local_val.push( { *unsafe { Box::from_raw(item.take_inner()) } }); };
4243 unsafe { &mut *this_ptr.inner }.update_add_htlcs = local_val;
4245 /// update_fulfill_htlc messages which should be sent
4247 pub extern "C" fn CommitmentUpdate_set_update_fulfill_htlcs(this_ptr: &mut CommitmentUpdate, mut val: crate::c_types::derived::CVec_UpdateFulfillHTLCZ) {
4248 let mut local_val = Vec::new(); for mut item in val.into_rust().drain(..) { local_val.push( { *unsafe { Box::from_raw(item.take_inner()) } }); };
4249 unsafe { &mut *this_ptr.inner }.update_fulfill_htlcs = local_val;
4251 /// update_fail_htlc messages which should be sent
4253 pub extern "C" fn CommitmentUpdate_set_update_fail_htlcs(this_ptr: &mut CommitmentUpdate, mut val: crate::c_types::derived::CVec_UpdateFailHTLCZ) {
4254 let mut local_val = Vec::new(); for mut item in val.into_rust().drain(..) { local_val.push( { *unsafe { Box::from_raw(item.take_inner()) } }); };
4255 unsafe { &mut *this_ptr.inner }.update_fail_htlcs = local_val;
4257 /// update_fail_malformed_htlc messages which should be sent
4259 pub extern "C" fn CommitmentUpdate_set_update_fail_malformed_htlcs(this_ptr: &mut CommitmentUpdate, mut val: crate::c_types::derived::CVec_UpdateFailMalformedHTLCZ) {
4260 let mut local_val = Vec::new(); for mut item in val.into_rust().drain(..) { local_val.push( { *unsafe { Box::from_raw(item.take_inner()) } }); };
4261 unsafe { &mut *this_ptr.inner }.update_fail_malformed_htlcs = local_val;
4263 /// An update_fee message which should be sent
4265 pub extern "C" fn CommitmentUpdate_get_update_fee(this_ptr: &CommitmentUpdate) -> crate::lightning::ln::msgs::UpdateFee {
4266 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.update_fee;
4267 let mut local_inner_val = crate::lightning::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 };
4270 /// An update_fee message which should be sent
4272 pub extern "C" fn CommitmentUpdate_set_update_fee(this_ptr: &mut CommitmentUpdate, mut val: crate::lightning::ln::msgs::UpdateFee) {
4273 let mut local_val = if val.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(val.take_inner()) } }) };
4274 unsafe { &mut *this_ptr.inner }.update_fee = local_val;
4276 /// Finally, the commitment_signed message which should be sent
4278 pub extern "C" fn CommitmentUpdate_get_commitment_signed(this_ptr: &CommitmentUpdate) -> crate::lightning::ln::msgs::CommitmentSigned {
4279 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.commitment_signed;
4280 crate::lightning::ln::msgs::CommitmentSigned { inner: unsafe { ( (&((*inner_val)) as *const _) as *mut _) }, is_owned: false }
4282 /// Finally, the commitment_signed message which should be sent
4284 pub extern "C" fn CommitmentUpdate_set_commitment_signed(this_ptr: &mut CommitmentUpdate, mut val: crate::lightning::ln::msgs::CommitmentSigned) {
4285 unsafe { &mut *this_ptr.inner }.commitment_signed = *unsafe { Box::from_raw(val.take_inner()) };
4287 /// Constructs a new CommitmentUpdate given each field
4290 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::lightning::ln::msgs::UpdateFee, mut commitment_signed_arg: crate::lightning::ln::msgs::CommitmentSigned) -> CommitmentUpdate {
4291 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()) } }); };
4292 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()) } }); };
4293 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()) } }); };
4294 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()) } }); };
4295 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()) } }) };
4296 CommitmentUpdate { inner: Box::into_raw(Box::new(nativeCommitmentUpdate {
4297 update_add_htlcs: local_update_add_htlcs_arg,
4298 update_fulfill_htlcs: local_update_fulfill_htlcs_arg,
4299 update_fail_htlcs: local_update_fail_htlcs_arg,
4300 update_fail_malformed_htlcs: local_update_fail_malformed_htlcs_arg,
4301 update_fee: local_update_fee_arg,
4302 commitment_signed: *unsafe { Box::from_raw(commitment_signed_arg.take_inner()) },
4303 })), is_owned: true }
4305 impl Clone for CommitmentUpdate {
4306 fn clone(&self) -> Self {
4308 inner: if <*mut nativeCommitmentUpdate>::is_null(self.inner) { std::ptr::null_mut() } else {
4309 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
4315 /// Used only if an object of this type is returned as a trait impl by a method
4316 pub(crate) extern "C" fn CommitmentUpdate_clone_void(this_ptr: *const c_void) -> *mut c_void {
4317 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeCommitmentUpdate)).clone() })) as *mut c_void
4320 /// Creates a copy of the CommitmentUpdate
4321 pub extern "C" fn CommitmentUpdate_clone(orig: &CommitmentUpdate) -> CommitmentUpdate {
4324 /// The information we received from a peer along the route of a payment we originated. This is
4325 /// returned by ChannelMessageHandler::handle_update_fail_htlc to be passed into
4326 /// RoutingMessageHandler::handle_htlc_fail_channel_update to update our network map.
4330 pub enum HTLCFailChannelUpdate {
4331 /// We received an error which included a full ChannelUpdate message.
4332 ChannelUpdateMessage {
4333 /// The unwrapped message we received
4334 msg: crate::lightning::ln::msgs::ChannelUpdate,
4336 /// We received an error which indicated only that a channel has been closed
4338 /// The short_channel_id which has now closed.
4339 short_channel_id: u64,
4340 /// when this true, this channel should be permanently removed from the
4341 /// consideration. Otherwise, this channel can be restored as new channel_update is received
4344 /// We received an error which indicated only that a node has failed
4346 /// The node_id that has failed.
4347 node_id: crate::c_types::PublicKey,
4348 /// when this true, node should be permanently removed from the
4349 /// consideration. Otherwise, the channels connected to this node can be
4350 /// restored as new channel_update is received
4354 use lightning::ln::msgs::HTLCFailChannelUpdate as nativeHTLCFailChannelUpdate;
4355 impl HTLCFailChannelUpdate {
4357 pub(crate) fn to_native(&self) -> nativeHTLCFailChannelUpdate {
4359 HTLCFailChannelUpdate::ChannelUpdateMessage {ref msg, } => {
4360 let mut msg_nonref = (*msg).clone();
4361 nativeHTLCFailChannelUpdate::ChannelUpdateMessage {
4362 msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) },
4365 HTLCFailChannelUpdate::ChannelClosed {ref short_channel_id, ref is_permanent, } => {
4366 let mut short_channel_id_nonref = (*short_channel_id).clone();
4367 let mut is_permanent_nonref = (*is_permanent).clone();
4368 nativeHTLCFailChannelUpdate::ChannelClosed {
4369 short_channel_id: short_channel_id_nonref,
4370 is_permanent: is_permanent_nonref,
4373 HTLCFailChannelUpdate::NodeFailure {ref node_id, ref is_permanent, } => {
4374 let mut node_id_nonref = (*node_id).clone();
4375 let mut is_permanent_nonref = (*is_permanent).clone();
4376 nativeHTLCFailChannelUpdate::NodeFailure {
4377 node_id: node_id_nonref.into_rust(),
4378 is_permanent: is_permanent_nonref,
4384 pub(crate) fn into_native(self) -> nativeHTLCFailChannelUpdate {
4386 HTLCFailChannelUpdate::ChannelUpdateMessage {mut msg, } => {
4387 nativeHTLCFailChannelUpdate::ChannelUpdateMessage {
4388 msg: *unsafe { Box::from_raw(msg.take_inner()) },
4391 HTLCFailChannelUpdate::ChannelClosed {mut short_channel_id, mut is_permanent, } => {
4392 nativeHTLCFailChannelUpdate::ChannelClosed {
4393 short_channel_id: short_channel_id,
4394 is_permanent: is_permanent,
4397 HTLCFailChannelUpdate::NodeFailure {mut node_id, mut is_permanent, } => {
4398 nativeHTLCFailChannelUpdate::NodeFailure {
4399 node_id: node_id.into_rust(),
4400 is_permanent: is_permanent,
4406 pub(crate) fn from_native(native: &nativeHTLCFailChannelUpdate) -> Self {
4408 nativeHTLCFailChannelUpdate::ChannelUpdateMessage {ref msg, } => {
4409 let mut msg_nonref = (*msg).clone();
4410 HTLCFailChannelUpdate::ChannelUpdateMessage {
4411 msg: crate::lightning::ln::msgs::ChannelUpdate { inner: Box::into_raw(Box::new(msg_nonref)), is_owned: true },
4414 nativeHTLCFailChannelUpdate::ChannelClosed {ref short_channel_id, ref is_permanent, } => {
4415 let mut short_channel_id_nonref = (*short_channel_id).clone();
4416 let mut is_permanent_nonref = (*is_permanent).clone();
4417 HTLCFailChannelUpdate::ChannelClosed {
4418 short_channel_id: short_channel_id_nonref,
4419 is_permanent: is_permanent_nonref,
4422 nativeHTLCFailChannelUpdate::NodeFailure {ref node_id, ref is_permanent, } => {
4423 let mut node_id_nonref = (*node_id).clone();
4424 let mut is_permanent_nonref = (*is_permanent).clone();
4425 HTLCFailChannelUpdate::NodeFailure {
4426 node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref),
4427 is_permanent: is_permanent_nonref,
4433 pub(crate) fn native_into(native: nativeHTLCFailChannelUpdate) -> Self {
4435 nativeHTLCFailChannelUpdate::ChannelUpdateMessage {mut msg, } => {
4436 HTLCFailChannelUpdate::ChannelUpdateMessage {
4437 msg: crate::lightning::ln::msgs::ChannelUpdate { inner: Box::into_raw(Box::new(msg)), is_owned: true },
4440 nativeHTLCFailChannelUpdate::ChannelClosed {mut short_channel_id, mut is_permanent, } => {
4441 HTLCFailChannelUpdate::ChannelClosed {
4442 short_channel_id: short_channel_id,
4443 is_permanent: is_permanent,
4446 nativeHTLCFailChannelUpdate::NodeFailure {mut node_id, mut is_permanent, } => {
4447 HTLCFailChannelUpdate::NodeFailure {
4448 node_id: crate::c_types::PublicKey::from_rust(&node_id),
4449 is_permanent: is_permanent,
4455 /// Frees any resources used by the HTLCFailChannelUpdate
4457 pub extern "C" fn HTLCFailChannelUpdate_free(this_ptr: HTLCFailChannelUpdate) { }
4458 /// Creates a copy of the HTLCFailChannelUpdate
4460 pub extern "C" fn HTLCFailChannelUpdate_clone(orig: &HTLCFailChannelUpdate) -> HTLCFailChannelUpdate {
4463 /// A trait to describe an object which can receive channel messages.
4465 /// Messages MAY be called in parallel when they originate from different their_node_ids, however
4466 /// they MUST NOT be called in parallel when the two calls have the same their_node_id.
4468 pub struct ChannelMessageHandler {
4469 /// An opaque pointer which is passed to your function implementations as an argument.
4470 /// This has no meaning in the LDK, and can be NULL or any other value.
4471 pub this_arg: *mut c_void,
4472 /// Handle an incoming open_channel message from the given peer.
4473 pub handle_open_channel: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, their_features: crate::lightning::ln::features::InitFeatures, msg: &crate::lightning::ln::msgs::OpenChannel),
4474 /// Handle an incoming accept_channel message from the given peer.
4475 pub handle_accept_channel: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, their_features: crate::lightning::ln::features::InitFeatures, msg: &crate::lightning::ln::msgs::AcceptChannel),
4476 /// Handle an incoming funding_created message from the given peer.
4477 pub handle_funding_created: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::FundingCreated),
4478 /// Handle an incoming funding_signed message from the given peer.
4479 pub handle_funding_signed: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::FundingSigned),
4480 /// Handle an incoming funding_locked message from the given peer.
4481 pub handle_funding_locked: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::FundingLocked),
4482 /// Handle an incoming shutdown message from the given peer.
4483 pub handle_shutdown: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, their_features: &crate::lightning::ln::features::InitFeatures, msg: &crate::lightning::ln::msgs::Shutdown),
4484 /// Handle an incoming closing_signed message from the given peer.
4485 pub handle_closing_signed: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::ClosingSigned),
4486 /// Handle an incoming update_add_htlc message from the given peer.
4487 pub handle_update_add_htlc: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::UpdateAddHTLC),
4488 /// Handle an incoming update_fulfill_htlc message from the given peer.
4489 pub handle_update_fulfill_htlc: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::UpdateFulfillHTLC),
4490 /// Handle an incoming update_fail_htlc message from the given peer.
4491 pub handle_update_fail_htlc: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::UpdateFailHTLC),
4492 /// Handle an incoming update_fail_malformed_htlc message from the given peer.
4493 pub handle_update_fail_malformed_htlc: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::UpdateFailMalformedHTLC),
4494 /// Handle an incoming commitment_signed message from the given peer.
4495 pub handle_commitment_signed: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::CommitmentSigned),
4496 /// Handle an incoming revoke_and_ack message from the given peer.
4497 pub handle_revoke_and_ack: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::RevokeAndACK),
4498 /// Handle an incoming update_fee message from the given peer.
4499 pub handle_update_fee: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::UpdateFee),
4500 /// Handle an incoming announcement_signatures message from the given peer.
4501 pub handle_announcement_signatures: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::AnnouncementSignatures),
4502 /// Indicates a connection to the peer failed/an existing connection was lost. If no connection
4503 /// is believed to be possible in the future (eg they're sending us messages we don't
4504 /// understand or indicate they require unknown feature bits), no_connection_possible is set
4505 /// and any outstanding channels should be failed.
4506 pub peer_disconnected: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, no_connection_possible: bool),
4507 /// Handle a peer reconnecting, possibly generating channel_reestablish message(s).
4508 pub peer_connected: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::Init),
4509 /// Handle an incoming channel_reestablish message from the given peer.
4510 pub handle_channel_reestablish: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::ChannelReestablish),
4511 /// Handle an incoming channel update from the given peer.
4512 pub handle_channel_update: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::ChannelUpdate),
4513 /// Handle an incoming error message from the given peer.
4514 pub handle_error: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::ErrorMessage),
4515 /// Implementation of MessageSendEventsProvider for this object.
4516 pub MessageSendEventsProvider: crate::lightning::util::events::MessageSendEventsProvider,
4517 /// Frees any resources associated with this object given its this_arg pointer.
4518 /// Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
4519 pub free: Option<extern "C" fn(this_arg: *mut c_void)>,
4521 impl lightning::util::events::MessageSendEventsProvider for ChannelMessageHandler {
4522 fn get_and_clear_pending_msg_events(&self) -> Vec<lightning::util::events::MessageSendEvent> {
4523 let mut ret = (self.MessageSendEventsProvider.get_and_clear_pending_msg_events)(self.this_arg);
4524 let mut local_ret = Vec::new(); for mut item in ret.into_rust().drain(..) { local_ret.push( { item.into_native() }); };
4528 unsafe impl Send for ChannelMessageHandler {}
4529 unsafe impl Sync for ChannelMessageHandler {}
4531 use lightning::ln::msgs::ChannelMessageHandler as rustChannelMessageHandler;
4532 impl rustChannelMessageHandler for ChannelMessageHandler {
4533 fn handle_open_channel(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, their_features: lightning::ln::features::InitFeatures, msg: &lightning::ln::msgs::OpenChannel) {
4534 (self.handle_open_channel)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), crate::lightning::ln::features::InitFeatures { inner: Box::into_raw(Box::new(their_features)), is_owned: true }, &crate::lightning::ln::msgs::OpenChannel { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false })
4536 fn handle_accept_channel(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, their_features: lightning::ln::features::InitFeatures, msg: &lightning::ln::msgs::AcceptChannel) {
4537 (self.handle_accept_channel)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), crate::lightning::ln::features::InitFeatures { inner: Box::into_raw(Box::new(their_features)), is_owned: true }, &crate::lightning::ln::msgs::AcceptChannel { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false })
4539 fn handle_funding_created(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, msg: &lightning::ln::msgs::FundingCreated) {
4540 (self.handle_funding_created)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::FundingCreated { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false })
4542 fn handle_funding_signed(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, msg: &lightning::ln::msgs::FundingSigned) {
4543 (self.handle_funding_signed)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::FundingSigned { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false })
4545 fn handle_funding_locked(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, msg: &lightning::ln::msgs::FundingLocked) {
4546 (self.handle_funding_locked)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::FundingLocked { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false })
4548 fn handle_shutdown(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, their_features: &lightning::ln::features::InitFeatures, msg: &lightning::ln::msgs::Shutdown) {
4549 (self.handle_shutdown)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::features::InitFeatures { inner: unsafe { (their_features as *const _) as *mut _ }, is_owned: false }, &crate::lightning::ln::msgs::Shutdown { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false })
4551 fn handle_closing_signed(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, msg: &lightning::ln::msgs::ClosingSigned) {
4552 (self.handle_closing_signed)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::ClosingSigned { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false })
4554 fn handle_update_add_htlc(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, msg: &lightning::ln::msgs::UpdateAddHTLC) {
4555 (self.handle_update_add_htlc)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::UpdateAddHTLC { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false })
4557 fn handle_update_fulfill_htlc(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, msg: &lightning::ln::msgs::UpdateFulfillHTLC) {
4558 (self.handle_update_fulfill_htlc)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::UpdateFulfillHTLC { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false })
4560 fn handle_update_fail_htlc(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, msg: &lightning::ln::msgs::UpdateFailHTLC) {
4561 (self.handle_update_fail_htlc)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::UpdateFailHTLC { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false })
4563 fn handle_update_fail_malformed_htlc(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, msg: &lightning::ln::msgs::UpdateFailMalformedHTLC) {
4564 (self.handle_update_fail_malformed_htlc)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::UpdateFailMalformedHTLC { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false })
4566 fn handle_commitment_signed(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, msg: &lightning::ln::msgs::CommitmentSigned) {
4567 (self.handle_commitment_signed)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::CommitmentSigned { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false })
4569 fn handle_revoke_and_ack(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, msg: &lightning::ln::msgs::RevokeAndACK) {
4570 (self.handle_revoke_and_ack)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::RevokeAndACK { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false })
4572 fn handle_update_fee(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, msg: &lightning::ln::msgs::UpdateFee) {
4573 (self.handle_update_fee)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::UpdateFee { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false })
4575 fn handle_announcement_signatures(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, msg: &lightning::ln::msgs::AnnouncementSignatures) {
4576 (self.handle_announcement_signatures)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::AnnouncementSignatures { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false })
4578 fn peer_disconnected(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, no_connection_possible: bool) {
4579 (self.peer_disconnected)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), no_connection_possible)
4581 fn peer_connected(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, msg: &lightning::ln::msgs::Init) {
4582 (self.peer_connected)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::Init { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false })
4584 fn handle_channel_reestablish(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, msg: &lightning::ln::msgs::ChannelReestablish) {
4585 (self.handle_channel_reestablish)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::ChannelReestablish { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false })
4587 fn handle_channel_update(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, msg: &lightning::ln::msgs::ChannelUpdate) {
4588 (self.handle_channel_update)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::ChannelUpdate { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false })
4590 fn handle_error(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, msg: &lightning::ln::msgs::ErrorMessage) {
4591 (self.handle_error)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::ErrorMessage { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false })
4595 // We're essentially a pointer already, or at least a set of pointers, so allow us to be used
4596 // directly as a Deref trait in higher-level structs:
4597 impl std::ops::Deref for ChannelMessageHandler {
4599 fn deref(&self) -> &Self {
4603 /// Calls the free function if one is set
4605 pub extern "C" fn ChannelMessageHandler_free(this_ptr: ChannelMessageHandler) { }
4606 impl Drop for ChannelMessageHandler {
4607 fn drop(&mut self) {
4608 if let Some(f) = self.free {
4613 /// A trait to describe an object which can receive routing messages.
4615 /// # Implementor DoS Warnings
4617 /// For `gossip_queries` messages there are potential DoS vectors when handling
4618 /// inbound queries. Implementors using an on-disk network graph should be aware of
4619 /// repeated disk I/O for queries accessing different parts of the network graph.
4621 pub struct RoutingMessageHandler {
4622 /// An opaque pointer which is passed to your function implementations as an argument.
4623 /// This has no meaning in the LDK, and can be NULL or any other value.
4624 pub this_arg: *mut c_void,
4625 /// Handle an incoming node_announcement message, returning true if it should be forwarded on,
4626 /// false or returning an Err otherwise.
4628 pub handle_node_announcement: extern "C" fn (this_arg: *const c_void, msg: &crate::lightning::ln::msgs::NodeAnnouncement) -> crate::c_types::derived::CResult_boolLightningErrorZ,
4629 /// Handle a channel_announcement message, returning true if it should be forwarded on, false
4630 /// or returning an Err otherwise.
4632 pub handle_channel_announcement: extern "C" fn (this_arg: *const c_void, msg: &crate::lightning::ln::msgs::ChannelAnnouncement) -> crate::c_types::derived::CResult_boolLightningErrorZ,
4633 /// Handle an incoming channel_update message, returning true if it should be forwarded on,
4634 /// false or returning an Err otherwise.
4636 pub handle_channel_update: extern "C" fn (this_arg: *const c_void, msg: &crate::lightning::ln::msgs::ChannelUpdate) -> crate::c_types::derived::CResult_boolLightningErrorZ,
4637 /// Handle some updates to the route graph that we learned due to an outbound failed payment.
4638 pub handle_htlc_fail_channel_update: extern "C" fn (this_arg: *const c_void, update: &crate::lightning::ln::msgs::HTLCFailChannelUpdate),
4639 /// Gets a subset of the channel announcements and updates required to dump our routing table
4640 /// to a remote node, starting at the short_channel_id indicated by starting_point and
4641 /// including the batch_amount entries immediately higher in numerical value than starting_point.
4643 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,
4644 /// Gets a subset of the node announcements required to dump our routing table to a remote node,
4645 /// starting at the node *after* the provided publickey and including batch_amount entries
4646 /// immediately higher (as defined by <PublicKey as Ord>::cmp) than starting_point.
4647 /// If None is provided for starting_point, we start at the first node.
4649 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,
4650 /// Called when a connection is established with a peer. This can be used to
4651 /// perform routing table synchronization using a strategy defined by the
4653 pub sync_routing_table: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, init: &crate::lightning::ln::msgs::Init),
4654 /// Handles the reply of a query we initiated to learn about channels
4655 /// for a given range of blocks. We can expect to receive one or more
4656 /// replies to a single query.
4658 pub handle_reply_channel_range: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: crate::lightning::ln::msgs::ReplyChannelRange) -> crate::c_types::derived::CResult_NoneLightningErrorZ,
4659 /// Handles the reply of a query we initiated asking for routing gossip
4660 /// messages for a list of channels. We should receive this message when
4661 /// a node has completed its best effort to send us the pertaining routing
4662 /// gossip messages.
4664 pub handle_reply_short_channel_ids_end: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> crate::c_types::derived::CResult_NoneLightningErrorZ,
4665 /// Handles when a peer asks us to send a list of short_channel_ids
4666 /// for the requested range of blocks.
4668 pub handle_query_channel_range: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: crate::lightning::ln::msgs::QueryChannelRange) -> crate::c_types::derived::CResult_NoneLightningErrorZ,
4669 /// Handles when a peer asks us to send routing gossip messages for a
4670 /// list of short_channel_ids.
4672 pub handle_query_short_channel_ids: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: crate::lightning::ln::msgs::QueryShortChannelIds) -> crate::c_types::derived::CResult_NoneLightningErrorZ,
4673 /// Implementation of MessageSendEventsProvider for this object.
4674 pub MessageSendEventsProvider: crate::lightning::util::events::MessageSendEventsProvider,
4675 /// Frees any resources associated with this object given its this_arg pointer.
4676 /// Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
4677 pub free: Option<extern "C" fn(this_arg: *mut c_void)>,
4679 unsafe impl Send for RoutingMessageHandler {}
4680 unsafe impl Sync for RoutingMessageHandler {}
4681 impl lightning::util::events::MessageSendEventsProvider for RoutingMessageHandler {
4682 fn get_and_clear_pending_msg_events(&self) -> Vec<lightning::util::events::MessageSendEvent> {
4683 let mut ret = (self.MessageSendEventsProvider.get_and_clear_pending_msg_events)(self.this_arg);
4684 let mut local_ret = Vec::new(); for mut item in ret.into_rust().drain(..) { local_ret.push( { item.into_native() }); };
4689 use lightning::ln::msgs::RoutingMessageHandler as rustRoutingMessageHandler;
4690 impl rustRoutingMessageHandler for RoutingMessageHandler {
4691 fn handle_node_announcement(&self, msg: &lightning::ln::msgs::NodeAnnouncement) -> Result<bool, lightning::ln::msgs::LightningError> {
4692 let mut ret = (self.handle_node_announcement)(self.this_arg, &crate::lightning::ln::msgs::NodeAnnouncement { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false });
4693 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()) } })};
4696 fn handle_channel_announcement(&self, msg: &lightning::ln::msgs::ChannelAnnouncement) -> Result<bool, lightning::ln::msgs::LightningError> {
4697 let mut ret = (self.handle_channel_announcement)(self.this_arg, &crate::lightning::ln::msgs::ChannelAnnouncement { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false });
4698 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()) } })};
4701 fn handle_channel_update(&self, msg: &lightning::ln::msgs::ChannelUpdate) -> Result<bool, lightning::ln::msgs::LightningError> {
4702 let mut ret = (self.handle_channel_update)(self.this_arg, &crate::lightning::ln::msgs::ChannelUpdate { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false });
4703 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()) } })};
4706 fn handle_htlc_fail_channel_update(&self, update: &lightning::ln::msgs::HTLCFailChannelUpdate) {
4707 (self.handle_htlc_fail_channel_update)(self.this_arg, &crate::lightning::ln::msgs::HTLCFailChannelUpdate::from_native(&update))
4709 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>)> {
4710 let mut ret = (self.get_next_channel_announcements)(self.this_arg, starting_point, batch_amount);
4711 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 }); };
4714 fn get_next_node_announcements(&self, starting_point: Option<&bitcoin::secp256k1::key::PublicKey>, batch_amount: u8) -> Vec<lightning::ln::msgs::NodeAnnouncement> {
4715 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())) } };
4716 let mut ret = (self.get_next_node_announcements)(self.this_arg, local_starting_point, batch_amount);
4717 let mut local_ret = Vec::new(); for mut item in ret.into_rust().drain(..) { local_ret.push( { *unsafe { Box::from_raw(item.take_inner()) } }); };
4720 fn sync_routing_table(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, init: &lightning::ln::msgs::Init) {
4721 (self.sync_routing_table)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::Init { inner: unsafe { (init as *const _) as *mut _ }, is_owned: false })
4723 fn handle_reply_channel_range(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, msg: lightning::ln::msgs::ReplyChannelRange) -> Result<(), lightning::ln::msgs::LightningError> {
4724 let mut ret = (self.handle_reply_channel_range)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), crate::lightning::ln::msgs::ReplyChannelRange { inner: Box::into_raw(Box::new(msg)), is_owned: true });
4725 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()) } })};
4728 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> {
4729 let mut ret = (self.handle_reply_short_channel_ids_end)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), crate::lightning::ln::msgs::ReplyShortChannelIdsEnd { inner: Box::into_raw(Box::new(msg)), is_owned: true });
4730 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()) } })};
4733 fn handle_query_channel_range(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, msg: lightning::ln::msgs::QueryChannelRange) -> Result<(), lightning::ln::msgs::LightningError> {
4734 let mut ret = (self.handle_query_channel_range)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), crate::lightning::ln::msgs::QueryChannelRange { inner: Box::into_raw(Box::new(msg)), is_owned: true });
4735 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()) } })};
4738 fn handle_query_short_channel_ids(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, msg: lightning::ln::msgs::QueryShortChannelIds) -> Result<(), lightning::ln::msgs::LightningError> {
4739 let mut ret = (self.handle_query_short_channel_ids)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), crate::lightning::ln::msgs::QueryShortChannelIds { inner: Box::into_raw(Box::new(msg)), is_owned: true });
4740 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()) } })};
4745 // We're essentially a pointer already, or at least a set of pointers, so allow us to be used
4746 // directly as a Deref trait in higher-level structs:
4747 impl std::ops::Deref for RoutingMessageHandler {
4749 fn deref(&self) -> &Self {
4753 /// Calls the free function if one is set
4755 pub extern "C" fn RoutingMessageHandler_free(this_ptr: RoutingMessageHandler) { }
4756 impl Drop for RoutingMessageHandler {
4757 fn drop(&mut self) {
4758 if let Some(f) = self.free {
4764 /// Serialize the AcceptChannel object into a byte array which can be read by AcceptChannel_read
4765 pub extern "C" fn AcceptChannel_write(obj: &AcceptChannel) -> crate::c_types::derived::CVec_u8Z {
4766 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
4769 pub(crate) extern "C" fn AcceptChannel_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
4770 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeAcceptChannel) })
4773 /// Read a AcceptChannel from a byte array, created by AcceptChannel_write
4774 pub extern "C" fn AcceptChannel_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_AcceptChannelDecodeErrorZ {
4775 let res = crate::c_types::deserialize_obj(ser);
4776 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::AcceptChannel { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
4780 /// Serialize the AnnouncementSignatures object into a byte array which can be read by AnnouncementSignatures_read
4781 pub extern "C" fn AnnouncementSignatures_write(obj: &AnnouncementSignatures) -> crate::c_types::derived::CVec_u8Z {
4782 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
4785 pub(crate) extern "C" fn AnnouncementSignatures_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
4786 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeAnnouncementSignatures) })
4789 /// Read a AnnouncementSignatures from a byte array, created by AnnouncementSignatures_write
4790 pub extern "C" fn AnnouncementSignatures_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_AnnouncementSignaturesDecodeErrorZ {
4791 let res = crate::c_types::deserialize_obj(ser);
4792 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::AnnouncementSignatures { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
4796 /// Serialize the ChannelReestablish object into a byte array which can be read by ChannelReestablish_read
4797 pub extern "C" fn ChannelReestablish_write(obj: &ChannelReestablish) -> crate::c_types::derived::CVec_u8Z {
4798 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
4801 pub(crate) extern "C" fn ChannelReestablish_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
4802 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeChannelReestablish) })
4805 /// Read a ChannelReestablish from a byte array, created by ChannelReestablish_write
4806 pub extern "C" fn ChannelReestablish_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ChannelReestablishDecodeErrorZ {
4807 let res = crate::c_types::deserialize_obj(ser);
4808 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::ChannelReestablish { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
4812 /// Serialize the ClosingSigned object into a byte array which can be read by ClosingSigned_read
4813 pub extern "C" fn ClosingSigned_write(obj: &ClosingSigned) -> crate::c_types::derived::CVec_u8Z {
4814 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
4817 pub(crate) extern "C" fn ClosingSigned_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
4818 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeClosingSigned) })
4821 /// Read a ClosingSigned from a byte array, created by ClosingSigned_write
4822 pub extern "C" fn ClosingSigned_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ClosingSignedDecodeErrorZ {
4823 let res = crate::c_types::deserialize_obj(ser);
4824 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::ClosingSigned { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
4828 /// Serialize the CommitmentSigned object into a byte array which can be read by CommitmentSigned_read
4829 pub extern "C" fn CommitmentSigned_write(obj: &CommitmentSigned) -> crate::c_types::derived::CVec_u8Z {
4830 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
4833 pub(crate) extern "C" fn CommitmentSigned_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
4834 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeCommitmentSigned) })
4837 /// Read a CommitmentSigned from a byte array, created by CommitmentSigned_write
4838 pub extern "C" fn CommitmentSigned_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_CommitmentSignedDecodeErrorZ {
4839 let res = crate::c_types::deserialize_obj(ser);
4840 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::CommitmentSigned { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
4844 /// Serialize the FundingCreated object into a byte array which can be read by FundingCreated_read
4845 pub extern "C" fn FundingCreated_write(obj: &FundingCreated) -> crate::c_types::derived::CVec_u8Z {
4846 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
4849 pub(crate) extern "C" fn FundingCreated_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
4850 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeFundingCreated) })
4853 /// Read a FundingCreated from a byte array, created by FundingCreated_write
4854 pub extern "C" fn FundingCreated_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_FundingCreatedDecodeErrorZ {
4855 let res = crate::c_types::deserialize_obj(ser);
4856 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::FundingCreated { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
4860 /// Serialize the FundingSigned object into a byte array which can be read by FundingSigned_read
4861 pub extern "C" fn FundingSigned_write(obj: &FundingSigned) -> crate::c_types::derived::CVec_u8Z {
4862 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
4865 pub(crate) extern "C" fn FundingSigned_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
4866 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeFundingSigned) })
4869 /// Read a FundingSigned from a byte array, created by FundingSigned_write
4870 pub extern "C" fn FundingSigned_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_FundingSignedDecodeErrorZ {
4871 let res = crate::c_types::deserialize_obj(ser);
4872 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::FundingSigned { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
4876 /// Serialize the FundingLocked object into a byte array which can be read by FundingLocked_read
4877 pub extern "C" fn FundingLocked_write(obj: &FundingLocked) -> crate::c_types::derived::CVec_u8Z {
4878 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
4881 pub(crate) extern "C" fn FundingLocked_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
4882 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeFundingLocked) })
4885 /// Read a FundingLocked from a byte array, created by FundingLocked_write
4886 pub extern "C" fn FundingLocked_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_FundingLockedDecodeErrorZ {
4887 let res = crate::c_types::deserialize_obj(ser);
4888 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::FundingLocked { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
4892 /// Serialize the Init object into a byte array which can be read by Init_read
4893 pub extern "C" fn Init_write(obj: &Init) -> crate::c_types::derived::CVec_u8Z {
4894 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
4897 pub(crate) extern "C" fn Init_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
4898 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeInit) })
4901 /// Read a Init from a byte array, created by Init_write
4902 pub extern "C" fn Init_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_InitDecodeErrorZ {
4903 let res = crate::c_types::deserialize_obj(ser);
4904 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::Init { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
4908 /// Serialize the OpenChannel object into a byte array which can be read by OpenChannel_read
4909 pub extern "C" fn OpenChannel_write(obj: &OpenChannel) -> crate::c_types::derived::CVec_u8Z {
4910 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
4913 pub(crate) extern "C" fn OpenChannel_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
4914 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeOpenChannel) })
4917 /// Read a OpenChannel from a byte array, created by OpenChannel_write
4918 pub extern "C" fn OpenChannel_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_OpenChannelDecodeErrorZ {
4919 let res = crate::c_types::deserialize_obj(ser);
4920 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::OpenChannel { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
4924 /// Serialize the RevokeAndACK object into a byte array which can be read by RevokeAndACK_read
4925 pub extern "C" fn RevokeAndACK_write(obj: &RevokeAndACK) -> crate::c_types::derived::CVec_u8Z {
4926 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
4929 pub(crate) extern "C" fn RevokeAndACK_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
4930 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeRevokeAndACK) })
4933 /// Read a RevokeAndACK from a byte array, created by RevokeAndACK_write
4934 pub extern "C" fn RevokeAndACK_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_RevokeAndACKDecodeErrorZ {
4935 let res = crate::c_types::deserialize_obj(ser);
4936 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::RevokeAndACK { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
4940 /// Serialize the Shutdown object into a byte array which can be read by Shutdown_read
4941 pub extern "C" fn Shutdown_write(obj: &Shutdown) -> crate::c_types::derived::CVec_u8Z {
4942 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
4945 pub(crate) extern "C" fn Shutdown_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
4946 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeShutdown) })
4949 /// Read a Shutdown from a byte array, created by Shutdown_write
4950 pub extern "C" fn Shutdown_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ShutdownDecodeErrorZ {
4951 let res = crate::c_types::deserialize_obj(ser);
4952 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::Shutdown { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
4956 /// Serialize the UpdateFailHTLC object into a byte array which can be read by UpdateFailHTLC_read
4957 pub extern "C" fn UpdateFailHTLC_write(obj: &UpdateFailHTLC) -> crate::c_types::derived::CVec_u8Z {
4958 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
4961 pub(crate) extern "C" fn UpdateFailHTLC_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
4962 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeUpdateFailHTLC) })
4965 /// Read a UpdateFailHTLC from a byte array, created by UpdateFailHTLC_write
4966 pub extern "C" fn UpdateFailHTLC_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_UpdateFailHTLCDecodeErrorZ {
4967 let res = crate::c_types::deserialize_obj(ser);
4968 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::UpdateFailHTLC { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
4972 /// Serialize the UpdateFailMalformedHTLC object into a byte array which can be read by UpdateFailMalformedHTLC_read
4973 pub extern "C" fn UpdateFailMalformedHTLC_write(obj: &UpdateFailMalformedHTLC) -> crate::c_types::derived::CVec_u8Z {
4974 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
4977 pub(crate) extern "C" fn UpdateFailMalformedHTLC_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
4978 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeUpdateFailMalformedHTLC) })
4981 /// Read a UpdateFailMalformedHTLC from a byte array, created by UpdateFailMalformedHTLC_write
4982 pub extern "C" fn UpdateFailMalformedHTLC_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_UpdateFailMalformedHTLCDecodeErrorZ {
4983 let res = crate::c_types::deserialize_obj(ser);
4984 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::UpdateFailMalformedHTLC { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
4988 /// Serialize the UpdateFee object into a byte array which can be read by UpdateFee_read
4989 pub extern "C" fn UpdateFee_write(obj: &UpdateFee) -> crate::c_types::derived::CVec_u8Z {
4990 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
4993 pub(crate) extern "C" fn UpdateFee_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
4994 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeUpdateFee) })
4997 /// Read a UpdateFee from a byte array, created by UpdateFee_write
4998 pub extern "C" fn UpdateFee_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_UpdateFeeDecodeErrorZ {
4999 let res = crate::c_types::deserialize_obj(ser);
5000 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::UpdateFee { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
5004 /// Serialize the UpdateFulfillHTLC object into a byte array which can be read by UpdateFulfillHTLC_read
5005 pub extern "C" fn UpdateFulfillHTLC_write(obj: &UpdateFulfillHTLC) -> crate::c_types::derived::CVec_u8Z {
5006 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
5009 pub(crate) extern "C" fn UpdateFulfillHTLC_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
5010 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeUpdateFulfillHTLC) })
5013 /// Read a UpdateFulfillHTLC from a byte array, created by UpdateFulfillHTLC_write
5014 pub extern "C" fn UpdateFulfillHTLC_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_UpdateFulfillHTLCDecodeErrorZ {
5015 let res = crate::c_types::deserialize_obj(ser);
5016 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::UpdateFulfillHTLC { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
5020 /// Serialize the UpdateAddHTLC object into a byte array which can be read by UpdateAddHTLC_read
5021 pub extern "C" fn UpdateAddHTLC_write(obj: &UpdateAddHTLC) -> crate::c_types::derived::CVec_u8Z {
5022 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
5025 pub(crate) extern "C" fn UpdateAddHTLC_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
5026 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeUpdateAddHTLC) })
5029 /// Read a UpdateAddHTLC from a byte array, created by UpdateAddHTLC_write
5030 pub extern "C" fn UpdateAddHTLC_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_UpdateAddHTLCDecodeErrorZ {
5031 let res = crate::c_types::deserialize_obj(ser);
5032 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::UpdateAddHTLC { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
5036 /// Serialize the Ping object into a byte array which can be read by Ping_read
5037 pub extern "C" fn Ping_write(obj: &Ping) -> crate::c_types::derived::CVec_u8Z {
5038 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
5041 pub(crate) extern "C" fn Ping_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
5042 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativePing) })
5045 /// Read a Ping from a byte array, created by Ping_write
5046 pub extern "C" fn Ping_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_PingDecodeErrorZ {
5047 let res = crate::c_types::deserialize_obj(ser);
5048 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::Ping { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
5052 /// Serialize the Pong object into a byte array which can be read by Pong_read
5053 pub extern "C" fn Pong_write(obj: &Pong) -> crate::c_types::derived::CVec_u8Z {
5054 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
5057 pub(crate) extern "C" fn Pong_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
5058 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativePong) })
5061 /// Read a Pong from a byte array, created by Pong_write
5062 pub extern "C" fn Pong_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_PongDecodeErrorZ {
5063 let res = crate::c_types::deserialize_obj(ser);
5064 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::Pong { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
5068 /// Serialize the UnsignedChannelAnnouncement object into a byte array which can be read by UnsignedChannelAnnouncement_read
5069 pub extern "C" fn UnsignedChannelAnnouncement_write(obj: &UnsignedChannelAnnouncement) -> crate::c_types::derived::CVec_u8Z {
5070 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
5073 pub(crate) extern "C" fn UnsignedChannelAnnouncement_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
5074 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeUnsignedChannelAnnouncement) })
5077 /// Read a UnsignedChannelAnnouncement from a byte array, created by UnsignedChannelAnnouncement_write
5078 pub extern "C" fn UnsignedChannelAnnouncement_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_UnsignedChannelAnnouncementDecodeErrorZ {
5079 let res = crate::c_types::deserialize_obj(ser);
5080 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::UnsignedChannelAnnouncement { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
5084 /// Serialize the ChannelAnnouncement object into a byte array which can be read by ChannelAnnouncement_read
5085 pub extern "C" fn ChannelAnnouncement_write(obj: &ChannelAnnouncement) -> crate::c_types::derived::CVec_u8Z {
5086 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
5089 pub(crate) extern "C" fn ChannelAnnouncement_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
5090 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeChannelAnnouncement) })
5093 /// Read a ChannelAnnouncement from a byte array, created by ChannelAnnouncement_write
5094 pub extern "C" fn ChannelAnnouncement_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ChannelAnnouncementDecodeErrorZ {
5095 let res = crate::c_types::deserialize_obj(ser);
5096 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::ChannelAnnouncement { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
5100 /// Serialize the UnsignedChannelUpdate object into a byte array which can be read by UnsignedChannelUpdate_read
5101 pub extern "C" fn UnsignedChannelUpdate_write(obj: &UnsignedChannelUpdate) -> crate::c_types::derived::CVec_u8Z {
5102 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
5105 pub(crate) extern "C" fn UnsignedChannelUpdate_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
5106 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeUnsignedChannelUpdate) })
5109 /// Read a UnsignedChannelUpdate from a byte array, created by UnsignedChannelUpdate_write
5110 pub extern "C" fn UnsignedChannelUpdate_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_UnsignedChannelUpdateDecodeErrorZ {
5111 let res = crate::c_types::deserialize_obj(ser);
5112 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::UnsignedChannelUpdate { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
5116 /// Serialize the ChannelUpdate object into a byte array which can be read by ChannelUpdate_read
5117 pub extern "C" fn ChannelUpdate_write(obj: &ChannelUpdate) -> crate::c_types::derived::CVec_u8Z {
5118 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
5121 pub(crate) extern "C" fn ChannelUpdate_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
5122 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeChannelUpdate) })
5125 /// Read a ChannelUpdate from a byte array, created by ChannelUpdate_write
5126 pub extern "C" fn ChannelUpdate_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ChannelUpdateDecodeErrorZ {
5127 let res = crate::c_types::deserialize_obj(ser);
5128 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::ChannelUpdate { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
5132 /// Serialize the ErrorMessage object into a byte array which can be read by ErrorMessage_read
5133 pub extern "C" fn ErrorMessage_write(obj: &ErrorMessage) -> crate::c_types::derived::CVec_u8Z {
5134 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
5137 pub(crate) extern "C" fn ErrorMessage_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
5138 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeErrorMessage) })
5141 /// Read a ErrorMessage from a byte array, created by ErrorMessage_write
5142 pub extern "C" fn ErrorMessage_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ErrorMessageDecodeErrorZ {
5143 let res = crate::c_types::deserialize_obj(ser);
5144 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::ErrorMessage { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
5148 /// Serialize the UnsignedNodeAnnouncement object into a byte array which can be read by UnsignedNodeAnnouncement_read
5149 pub extern "C" fn UnsignedNodeAnnouncement_write(obj: &UnsignedNodeAnnouncement) -> crate::c_types::derived::CVec_u8Z {
5150 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
5153 pub(crate) extern "C" fn UnsignedNodeAnnouncement_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
5154 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeUnsignedNodeAnnouncement) })
5157 /// Read a UnsignedNodeAnnouncement from a byte array, created by UnsignedNodeAnnouncement_write
5158 pub extern "C" fn UnsignedNodeAnnouncement_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_UnsignedNodeAnnouncementDecodeErrorZ {
5159 let res = crate::c_types::deserialize_obj(ser);
5160 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::UnsignedNodeAnnouncement { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
5164 /// Serialize the NodeAnnouncement object into a byte array which can be read by NodeAnnouncement_read
5165 pub extern "C" fn NodeAnnouncement_write(obj: &NodeAnnouncement) -> crate::c_types::derived::CVec_u8Z {
5166 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
5169 pub(crate) extern "C" fn NodeAnnouncement_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
5170 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeNodeAnnouncement) })
5173 /// Read a NodeAnnouncement from a byte array, created by NodeAnnouncement_write
5174 pub extern "C" fn NodeAnnouncement_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_NodeAnnouncementDecodeErrorZ {
5175 let res = crate::c_types::deserialize_obj(ser);
5176 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::NodeAnnouncement { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
5180 /// Read a QueryShortChannelIds from a byte array, created by QueryShortChannelIds_write
5181 pub extern "C" fn QueryShortChannelIds_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_QueryShortChannelIdsDecodeErrorZ {
5182 let res = crate::c_types::deserialize_obj(ser);
5183 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::QueryShortChannelIds { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
5187 /// Serialize the QueryShortChannelIds object into a byte array which can be read by QueryShortChannelIds_read
5188 pub extern "C" fn QueryShortChannelIds_write(obj: &QueryShortChannelIds) -> crate::c_types::derived::CVec_u8Z {
5189 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
5192 pub(crate) extern "C" fn QueryShortChannelIds_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
5193 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeQueryShortChannelIds) })
5196 /// Read a ReplyShortChannelIdsEnd from a byte array, created by ReplyShortChannelIdsEnd_write
5197 pub extern "C" fn ReplyShortChannelIdsEnd_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ReplyShortChannelIdsEndDecodeErrorZ {
5198 let res = crate::c_types::deserialize_obj(ser);
5199 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::ReplyShortChannelIdsEnd { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
5203 /// Serialize the ReplyShortChannelIdsEnd object into a byte array which can be read by ReplyShortChannelIdsEnd_read
5204 pub extern "C" fn ReplyShortChannelIdsEnd_write(obj: &ReplyShortChannelIdsEnd) -> crate::c_types::derived::CVec_u8Z {
5205 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
5208 pub(crate) extern "C" fn ReplyShortChannelIdsEnd_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
5209 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeReplyShortChannelIdsEnd) })
5211 ///\n\t * Calculates the overflow safe ending block height for the query.\n\t * Overflow returns `0xffffffff`, otherwise returns `first_blocknum + number_of_blocks`\n\t
5214 pub extern "C" fn QueryChannelRange_end_blocknum(this_arg: &QueryChannelRange) -> u32 {
5215 let mut ret = unsafe { &*this_arg.inner }.end_blocknum();
5220 /// Read a QueryChannelRange from a byte array, created by QueryChannelRange_write
5221 pub extern "C" fn QueryChannelRange_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_QueryChannelRangeDecodeErrorZ {
5222 let res = crate::c_types::deserialize_obj(ser);
5223 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::QueryChannelRange { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
5227 /// Serialize the QueryChannelRange object into a byte array which can be read by QueryChannelRange_read
5228 pub extern "C" fn QueryChannelRange_write(obj: &QueryChannelRange) -> crate::c_types::derived::CVec_u8Z {
5229 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
5232 pub(crate) extern "C" fn QueryChannelRange_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
5233 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeQueryChannelRange) })
5236 /// Read a ReplyChannelRange from a byte array, created by ReplyChannelRange_write
5237 pub extern "C" fn ReplyChannelRange_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ReplyChannelRangeDecodeErrorZ {
5238 let res = crate::c_types::deserialize_obj(ser);
5239 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::ReplyChannelRange { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
5243 /// Serialize the ReplyChannelRange object into a byte array which can be read by ReplyChannelRange_read
5244 pub extern "C" fn ReplyChannelRange_write(obj: &ReplyChannelRange) -> crate::c_types::derived::CVec_u8Z {
5245 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
5248 pub(crate) extern "C" fn ReplyChannelRange_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
5249 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeReplyChannelRange) })
5252 /// Read a GossipTimestampFilter from a byte array, created by GossipTimestampFilter_write
5253 pub extern "C" fn GossipTimestampFilter_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_GossipTimestampFilterDecodeErrorZ {
5254 let res = crate::c_types::deserialize_obj(ser);
5255 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::GossipTimestampFilter { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
5259 /// Serialize the GossipTimestampFilter object into a byte array which can be read by GossipTimestampFilter_read
5260 pub extern "C" fn GossipTimestampFilter_write(obj: &GossipTimestampFilter) -> crate::c_types::derived::CVec_u8Z {
5261 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
5264 pub(crate) extern "C" fn GossipTimestampFilter_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
5265 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeGossipTimestampFilter) })