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.
26 use std::str::FromStr;
28 use bitcoin::hashes::Hash;
29 use crate::c_types::*;
32 use lightning::ln::msgs::DecodeError as nativeDecodeErrorImport;
33 type nativeDecodeError = nativeDecodeErrorImport;
35 /// An error in decoding a message or struct.
38 pub struct DecodeError {
39 /// A pointer to the opaque Rust object.
41 /// Nearly everywhere, inner must be non-null, however in places where
42 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
43 pub inner: *mut nativeDecodeError,
44 /// Indicates that this is the only struct which contains the same pointer.
46 /// Rust functions which take ownership of an object provided via an argument require
47 /// this to be true and invalidate the object pointed to by inner.
51 impl Drop for DecodeError {
53 if self.is_owned && !<*mut nativeDecodeError>::is_null(self.inner) {
54 let _ = unsafe { Box::from_raw(self.inner) };
58 /// Frees any resources used by the DecodeError, if is_owned is set and inner is non-NULL.
60 pub extern "C" fn DecodeError_free(this_obj: DecodeError) { }
62 /// Used only if an object of this type is returned as a trait impl by a method
63 extern "C" fn DecodeError_free_void(this_ptr: *mut c_void) {
64 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeDecodeError); }
67 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
69 pub(crate) fn take_inner(mut self) -> *mut nativeDecodeError {
70 assert!(self.is_owned);
72 self.inner = std::ptr::null_mut();
76 impl Clone for DecodeError {
77 fn clone(&self) -> Self {
79 inner: if <*mut nativeDecodeError>::is_null(self.inner) { std::ptr::null_mut() } else {
80 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
86 /// Used only if an object of this type is returned as a trait impl by a method
87 pub(crate) extern "C" fn DecodeError_clone_void(this_ptr: *const c_void) -> *mut c_void {
88 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeDecodeError)).clone() })) as *mut c_void
91 /// Creates a copy of the DecodeError
92 pub extern "C" fn DecodeError_clone(orig: &DecodeError) -> DecodeError {
96 use lightning::ln::msgs::Init as nativeInitImport;
97 type nativeInit = nativeInitImport;
99 /// An init message to be sent or received from a peer
103 /// A pointer to the opaque Rust object.
105 /// Nearly everywhere, inner must be non-null, however in places where
106 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
107 pub inner: *mut nativeInit,
108 /// Indicates that this is the only struct which contains the same pointer.
110 /// Rust functions which take ownership of an object provided via an argument require
111 /// this to be true and invalidate the object pointed to by inner.
117 if self.is_owned && !<*mut nativeInit>::is_null(self.inner) {
118 let _ = unsafe { Box::from_raw(self.inner) };
122 /// Frees any resources used by the Init, if is_owned is set and inner is non-NULL.
124 pub extern "C" fn Init_free(this_obj: Init) { }
126 /// Used only if an object of this type is returned as a trait impl by a method
127 extern "C" fn Init_free_void(this_ptr: *mut c_void) {
128 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeInit); }
131 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
133 pub(crate) fn take_inner(mut self) -> *mut nativeInit {
134 assert!(self.is_owned);
135 let ret = self.inner;
136 self.inner = std::ptr::null_mut();
140 /// The relevant features which the sender supports
142 pub extern "C" fn Init_get_features(this_ptr: &Init) -> crate::lightning::ln::features::InitFeatures {
143 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.features;
144 crate::lightning::ln::features::InitFeatures { inner: unsafe { ( (&(*inner_val) as *const _) as *mut _) }, is_owned: false }
146 /// The relevant features which the sender supports
148 pub extern "C" fn Init_set_features(this_ptr: &mut Init, mut val: crate::lightning::ln::features::InitFeatures) {
149 unsafe { &mut *this_ptr.inner }.features = *unsafe { Box::from_raw(val.take_inner()) };
151 /// Constructs a new Init given each field
154 pub extern "C" fn Init_new(mut features_arg: crate::lightning::ln::features::InitFeatures) -> Init {
155 Init { inner: Box::into_raw(Box::new(nativeInit {
156 features: *unsafe { Box::from_raw(features_arg.take_inner()) },
157 })), is_owned: true }
159 impl Clone for Init {
160 fn clone(&self) -> Self {
162 inner: if <*mut nativeInit>::is_null(self.inner) { std::ptr::null_mut() } else {
163 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
169 /// Used only if an object of this type is returned as a trait impl by a method
170 pub(crate) extern "C" fn Init_clone_void(this_ptr: *const c_void) -> *mut c_void {
171 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeInit)).clone() })) as *mut c_void
174 /// Creates a copy of the Init
175 pub extern "C" fn Init_clone(orig: &Init) -> Init {
179 use lightning::ln::msgs::ErrorMessage as nativeErrorMessageImport;
180 type nativeErrorMessage = nativeErrorMessageImport;
182 /// An error message to be sent or received from a peer
185 pub struct ErrorMessage {
186 /// A pointer to the opaque Rust object.
188 /// Nearly everywhere, inner must be non-null, however in places where
189 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
190 pub inner: *mut nativeErrorMessage,
191 /// Indicates that this is the only struct which contains the same pointer.
193 /// Rust functions which take ownership of an object provided via an argument require
194 /// this to be true and invalidate the object pointed to by inner.
198 impl Drop for ErrorMessage {
200 if self.is_owned && !<*mut nativeErrorMessage>::is_null(self.inner) {
201 let _ = unsafe { Box::from_raw(self.inner) };
205 /// Frees any resources used by the ErrorMessage, if is_owned is set and inner is non-NULL.
207 pub extern "C" fn ErrorMessage_free(this_obj: ErrorMessage) { }
209 /// Used only if an object of this type is returned as a trait impl by a method
210 extern "C" fn ErrorMessage_free_void(this_ptr: *mut c_void) {
211 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeErrorMessage); }
214 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
216 pub(crate) fn take_inner(mut self) -> *mut nativeErrorMessage {
217 assert!(self.is_owned);
218 let ret = self.inner;
219 self.inner = std::ptr::null_mut();
223 /// The channel ID involved in the error
225 pub extern "C" fn ErrorMessage_get_channel_id(this_ptr: &ErrorMessage) -> *const [u8; 32] {
226 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_id;
229 /// The channel ID involved in the error
231 pub extern "C" fn ErrorMessage_set_channel_id(this_ptr: &mut ErrorMessage, mut val: crate::c_types::ThirtyTwoBytes) {
232 unsafe { &mut *this_ptr.inner }.channel_id = val.data;
234 /// A possibly human-readable error description.
235 /// The string should be sanitized before it is used (e.g. emitted to logs
236 /// or printed to stdout). Otherwise, a well crafted error message may trigger a security
237 /// vulnerability in the terminal emulator or the logging subsystem.
239 pub extern "C" fn ErrorMessage_get_data(this_ptr: &ErrorMessage) -> crate::c_types::Str {
240 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.data;
241 inner_val.as_str().into()
243 /// A possibly human-readable error description.
244 /// The string should be sanitized before it is used (e.g. emitted to logs
245 /// or printed to stdout). Otherwise, a well crafted error message may trigger a security
246 /// vulnerability in the terminal emulator or the logging subsystem.
248 pub extern "C" fn ErrorMessage_set_data(this_ptr: &mut ErrorMessage, mut val: crate::c_types::Str) {
249 unsafe { &mut *this_ptr.inner }.data = val.into_string();
251 /// Constructs a new ErrorMessage given each field
254 pub extern "C" fn ErrorMessage_new(mut channel_id_arg: crate::c_types::ThirtyTwoBytes, mut data_arg: crate::c_types::Str) -> ErrorMessage {
255 ErrorMessage { inner: Box::into_raw(Box::new(nativeErrorMessage {
256 channel_id: channel_id_arg.data,
257 data: data_arg.into_string(),
258 })), is_owned: true }
260 impl Clone for ErrorMessage {
261 fn clone(&self) -> Self {
263 inner: if <*mut nativeErrorMessage>::is_null(self.inner) { std::ptr::null_mut() } else {
264 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
270 /// Used only if an object of this type is returned as a trait impl by a method
271 pub(crate) extern "C" fn ErrorMessage_clone_void(this_ptr: *const c_void) -> *mut c_void {
272 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeErrorMessage)).clone() })) as *mut c_void
275 /// Creates a copy of the ErrorMessage
276 pub extern "C" fn ErrorMessage_clone(orig: &ErrorMessage) -> ErrorMessage {
280 use lightning::ln::msgs::Ping as nativePingImport;
281 type nativePing = nativePingImport;
283 /// A ping message to be sent or received from a peer
287 /// A pointer to the opaque Rust object.
289 /// Nearly everywhere, inner must be non-null, however in places where
290 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
291 pub inner: *mut nativePing,
292 /// Indicates that this is the only struct which contains the same pointer.
294 /// Rust functions which take ownership of an object provided via an argument require
295 /// this to be true and invalidate the object pointed to by inner.
301 if self.is_owned && !<*mut nativePing>::is_null(self.inner) {
302 let _ = unsafe { Box::from_raw(self.inner) };
306 /// Frees any resources used by the Ping, if is_owned is set and inner is non-NULL.
308 pub extern "C" fn Ping_free(this_obj: Ping) { }
310 /// Used only if an object of this type is returned as a trait impl by a method
311 extern "C" fn Ping_free_void(this_ptr: *mut c_void) {
312 unsafe { let _ = Box::from_raw(this_ptr as *mut nativePing); }
315 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
317 pub(crate) fn take_inner(mut self) -> *mut nativePing {
318 assert!(self.is_owned);
319 let ret = self.inner;
320 self.inner = std::ptr::null_mut();
324 /// The desired response length
326 pub extern "C" fn Ping_get_ponglen(this_ptr: &Ping) -> u16 {
327 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.ponglen;
330 /// The desired response length
332 pub extern "C" fn Ping_set_ponglen(this_ptr: &mut Ping, mut val: u16) {
333 unsafe { &mut *this_ptr.inner }.ponglen = val;
335 /// The ping packet size.
336 /// This field is not sent on the wire. byteslen zeros are sent.
338 pub extern "C" fn Ping_get_byteslen(this_ptr: &Ping) -> u16 {
339 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.byteslen;
342 /// The ping packet size.
343 /// This field is not sent on the wire. byteslen zeros are sent.
345 pub extern "C" fn Ping_set_byteslen(this_ptr: &mut Ping, mut val: u16) {
346 unsafe { &mut *this_ptr.inner }.byteslen = val;
348 /// Constructs a new Ping given each field
351 pub extern "C" fn Ping_new(mut ponglen_arg: u16, mut byteslen_arg: u16) -> Ping {
352 Ping { inner: Box::into_raw(Box::new(nativePing {
353 ponglen: ponglen_arg,
354 byteslen: byteslen_arg,
355 })), is_owned: true }
357 impl Clone for Ping {
358 fn clone(&self) -> Self {
360 inner: if <*mut nativePing>::is_null(self.inner) { std::ptr::null_mut() } else {
361 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
367 /// Used only if an object of this type is returned as a trait impl by a method
368 pub(crate) extern "C" fn Ping_clone_void(this_ptr: *const c_void) -> *mut c_void {
369 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativePing)).clone() })) as *mut c_void
372 /// Creates a copy of the Ping
373 pub extern "C" fn Ping_clone(orig: &Ping) -> Ping {
377 use lightning::ln::msgs::Pong as nativePongImport;
378 type nativePong = nativePongImport;
380 /// A pong message to be sent or received from a peer
384 /// A pointer to the opaque Rust object.
386 /// Nearly everywhere, inner must be non-null, however in places where
387 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
388 pub inner: *mut nativePong,
389 /// Indicates that this is the only struct which contains the same pointer.
391 /// Rust functions which take ownership of an object provided via an argument require
392 /// this to be true and invalidate the object pointed to by inner.
398 if self.is_owned && !<*mut nativePong>::is_null(self.inner) {
399 let _ = unsafe { Box::from_raw(self.inner) };
403 /// Frees any resources used by the Pong, if is_owned is set and inner is non-NULL.
405 pub extern "C" fn Pong_free(this_obj: Pong) { }
407 /// Used only if an object of this type is returned as a trait impl by a method
408 extern "C" fn Pong_free_void(this_ptr: *mut c_void) {
409 unsafe { let _ = Box::from_raw(this_ptr as *mut nativePong); }
412 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
414 pub(crate) fn take_inner(mut self) -> *mut nativePong {
415 assert!(self.is_owned);
416 let ret = self.inner;
417 self.inner = std::ptr::null_mut();
421 /// The pong packet size.
422 /// This field is not sent on the wire. byteslen zeros are sent.
424 pub extern "C" fn Pong_get_byteslen(this_ptr: &Pong) -> u16 {
425 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.byteslen;
428 /// The pong packet size.
429 /// This field is not sent on the wire. byteslen zeros are sent.
431 pub extern "C" fn Pong_set_byteslen(this_ptr: &mut Pong, mut val: u16) {
432 unsafe { &mut *this_ptr.inner }.byteslen = val;
434 /// Constructs a new Pong given each field
437 pub extern "C" fn Pong_new(mut byteslen_arg: u16) -> Pong {
438 Pong { inner: Box::into_raw(Box::new(nativePong {
439 byteslen: byteslen_arg,
440 })), is_owned: true }
442 impl Clone for Pong {
443 fn clone(&self) -> Self {
445 inner: if <*mut nativePong>::is_null(self.inner) { std::ptr::null_mut() } else {
446 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
452 /// Used only if an object of this type is returned as a trait impl by a method
453 pub(crate) extern "C" fn Pong_clone_void(this_ptr: *const c_void) -> *mut c_void {
454 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativePong)).clone() })) as *mut c_void
457 /// Creates a copy of the Pong
458 pub extern "C" fn Pong_clone(orig: &Pong) -> Pong {
462 use lightning::ln::msgs::OpenChannel as nativeOpenChannelImport;
463 type nativeOpenChannel = nativeOpenChannelImport;
465 /// An open_channel message to be sent or received from a peer
468 pub struct OpenChannel {
469 /// A pointer to the opaque Rust object.
471 /// Nearly everywhere, inner must be non-null, however in places where
472 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
473 pub inner: *mut nativeOpenChannel,
474 /// Indicates that this is the only struct which contains the same pointer.
476 /// Rust functions which take ownership of an object provided via an argument require
477 /// this to be true and invalidate the object pointed to by inner.
481 impl Drop for OpenChannel {
483 if self.is_owned && !<*mut nativeOpenChannel>::is_null(self.inner) {
484 let _ = unsafe { Box::from_raw(self.inner) };
488 /// Frees any resources used by the OpenChannel, if is_owned is set and inner is non-NULL.
490 pub extern "C" fn OpenChannel_free(this_obj: OpenChannel) { }
492 /// Used only if an object of this type is returned as a trait impl by a method
493 extern "C" fn OpenChannel_free_void(this_ptr: *mut c_void) {
494 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeOpenChannel); }
497 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
499 pub(crate) fn take_inner(mut self) -> *mut nativeOpenChannel {
500 assert!(self.is_owned);
501 let ret = self.inner;
502 self.inner = std::ptr::null_mut();
506 /// The genesis hash of the blockchain where the channel is to be opened
508 pub extern "C" fn OpenChannel_get_chain_hash(this_ptr: &OpenChannel) -> *const [u8; 32] {
509 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.chain_hash;
512 /// The genesis hash of the blockchain where the channel is to be opened
514 pub extern "C" fn OpenChannel_set_chain_hash(this_ptr: &mut OpenChannel, mut val: crate::c_types::ThirtyTwoBytes) {
515 unsafe { &mut *this_ptr.inner }.chain_hash = ::bitcoin::hash_types::BlockHash::from_slice(&val.data[..]).unwrap();
517 /// A temporary channel ID, until the funding outpoint is announced
519 pub extern "C" fn OpenChannel_get_temporary_channel_id(this_ptr: &OpenChannel) -> *const [u8; 32] {
520 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.temporary_channel_id;
523 /// A temporary channel ID, until the funding outpoint is announced
525 pub extern "C" fn OpenChannel_set_temporary_channel_id(this_ptr: &mut OpenChannel, mut val: crate::c_types::ThirtyTwoBytes) {
526 unsafe { &mut *this_ptr.inner }.temporary_channel_id = val.data;
528 /// The channel value
530 pub extern "C" fn OpenChannel_get_funding_satoshis(this_ptr: &OpenChannel) -> u64 {
531 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.funding_satoshis;
534 /// The channel value
536 pub extern "C" fn OpenChannel_set_funding_satoshis(this_ptr: &mut OpenChannel, mut val: u64) {
537 unsafe { &mut *this_ptr.inner }.funding_satoshis = val;
539 /// The amount to push to the counterparty as part of the open, in milli-satoshi
541 pub extern "C" fn OpenChannel_get_push_msat(this_ptr: &OpenChannel) -> u64 {
542 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.push_msat;
545 /// The amount to push to the counterparty as part of the open, in milli-satoshi
547 pub extern "C" fn OpenChannel_set_push_msat(this_ptr: &mut OpenChannel, mut val: u64) {
548 unsafe { &mut *this_ptr.inner }.push_msat = val;
550 /// The threshold below which outputs on transactions broadcast by sender will be omitted
552 pub extern "C" fn OpenChannel_get_dust_limit_satoshis(this_ptr: &OpenChannel) -> u64 {
553 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.dust_limit_satoshis;
556 /// The threshold below which outputs on transactions broadcast by sender will be omitted
558 pub extern "C" fn OpenChannel_set_dust_limit_satoshis(this_ptr: &mut OpenChannel, mut val: u64) {
559 unsafe { &mut *this_ptr.inner }.dust_limit_satoshis = val;
561 /// The maximum inbound HTLC value in flight towards sender, in milli-satoshi
563 pub extern "C" fn OpenChannel_get_max_htlc_value_in_flight_msat(this_ptr: &OpenChannel) -> u64 {
564 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.max_htlc_value_in_flight_msat;
567 /// The maximum inbound HTLC value in flight towards sender, in milli-satoshi
569 pub extern "C" fn OpenChannel_set_max_htlc_value_in_flight_msat(this_ptr: &mut OpenChannel, mut val: u64) {
570 unsafe { &mut *this_ptr.inner }.max_htlc_value_in_flight_msat = val;
572 /// The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
574 pub extern "C" fn OpenChannel_get_channel_reserve_satoshis(this_ptr: &OpenChannel) -> u64 {
575 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_reserve_satoshis;
578 /// The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
580 pub extern "C" fn OpenChannel_set_channel_reserve_satoshis(this_ptr: &mut OpenChannel, mut val: u64) {
581 unsafe { &mut *this_ptr.inner }.channel_reserve_satoshis = val;
583 /// The minimum HTLC size incoming to sender, in milli-satoshi
585 pub extern "C" fn OpenChannel_get_htlc_minimum_msat(this_ptr: &OpenChannel) -> u64 {
586 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.htlc_minimum_msat;
589 /// The minimum HTLC size incoming to sender, in milli-satoshi
591 pub extern "C" fn OpenChannel_set_htlc_minimum_msat(this_ptr: &mut OpenChannel, mut val: u64) {
592 unsafe { &mut *this_ptr.inner }.htlc_minimum_msat = val;
594 /// The feerate per 1000-weight of sender generated transactions, until updated by update_fee
596 pub extern "C" fn OpenChannel_get_feerate_per_kw(this_ptr: &OpenChannel) -> u32 {
597 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.feerate_per_kw;
600 /// The feerate per 1000-weight of sender generated transactions, until updated by update_fee
602 pub extern "C" fn OpenChannel_set_feerate_per_kw(this_ptr: &mut OpenChannel, mut val: u32) {
603 unsafe { &mut *this_ptr.inner }.feerate_per_kw = val;
605 /// The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
607 pub extern "C" fn OpenChannel_get_to_self_delay(this_ptr: &OpenChannel) -> u16 {
608 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.to_self_delay;
611 /// The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
613 pub extern "C" fn OpenChannel_set_to_self_delay(this_ptr: &mut OpenChannel, mut val: u16) {
614 unsafe { &mut *this_ptr.inner }.to_self_delay = val;
616 /// The maximum number of inbound HTLCs towards sender
618 pub extern "C" fn OpenChannel_get_max_accepted_htlcs(this_ptr: &OpenChannel) -> u16 {
619 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.max_accepted_htlcs;
622 /// The maximum number of inbound HTLCs towards sender
624 pub extern "C" fn OpenChannel_set_max_accepted_htlcs(this_ptr: &mut OpenChannel, mut val: u16) {
625 unsafe { &mut *this_ptr.inner }.max_accepted_htlcs = val;
627 /// The sender's key controlling the funding transaction
629 pub extern "C" fn OpenChannel_get_funding_pubkey(this_ptr: &OpenChannel) -> crate::c_types::PublicKey {
630 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.funding_pubkey;
631 crate::c_types::PublicKey::from_rust(&inner_val)
633 /// The sender's key controlling the funding transaction
635 pub extern "C" fn OpenChannel_set_funding_pubkey(this_ptr: &mut OpenChannel, mut val: crate::c_types::PublicKey) {
636 unsafe { &mut *this_ptr.inner }.funding_pubkey = val.into_rust();
638 /// Used to derive a revocation key for transactions broadcast by counterparty
640 pub extern "C" fn OpenChannel_get_revocation_basepoint(this_ptr: &OpenChannel) -> crate::c_types::PublicKey {
641 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.revocation_basepoint;
642 crate::c_types::PublicKey::from_rust(&inner_val)
644 /// Used to derive a revocation key for transactions broadcast by counterparty
646 pub extern "C" fn OpenChannel_set_revocation_basepoint(this_ptr: &mut OpenChannel, mut val: crate::c_types::PublicKey) {
647 unsafe { &mut *this_ptr.inner }.revocation_basepoint = val.into_rust();
649 /// A payment key to sender for transactions broadcast by counterparty
651 pub extern "C" fn OpenChannel_get_payment_point(this_ptr: &OpenChannel) -> crate::c_types::PublicKey {
652 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.payment_point;
653 crate::c_types::PublicKey::from_rust(&inner_val)
655 /// A payment key to sender for transactions broadcast by counterparty
657 pub extern "C" fn OpenChannel_set_payment_point(this_ptr: &mut OpenChannel, mut val: crate::c_types::PublicKey) {
658 unsafe { &mut *this_ptr.inner }.payment_point = val.into_rust();
660 /// Used to derive a payment key to sender for transactions broadcast by sender
662 pub extern "C" fn OpenChannel_get_delayed_payment_basepoint(this_ptr: &OpenChannel) -> crate::c_types::PublicKey {
663 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.delayed_payment_basepoint;
664 crate::c_types::PublicKey::from_rust(&inner_val)
666 /// Used to derive a payment key to sender for transactions broadcast by sender
668 pub extern "C" fn OpenChannel_set_delayed_payment_basepoint(this_ptr: &mut OpenChannel, mut val: crate::c_types::PublicKey) {
669 unsafe { &mut *this_ptr.inner }.delayed_payment_basepoint = val.into_rust();
671 /// Used to derive an HTLC payment key to sender
673 pub extern "C" fn OpenChannel_get_htlc_basepoint(this_ptr: &OpenChannel) -> crate::c_types::PublicKey {
674 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.htlc_basepoint;
675 crate::c_types::PublicKey::from_rust(&inner_val)
677 /// Used to derive an HTLC payment key to sender
679 pub extern "C" fn OpenChannel_set_htlc_basepoint(this_ptr: &mut OpenChannel, mut val: crate::c_types::PublicKey) {
680 unsafe { &mut *this_ptr.inner }.htlc_basepoint = val.into_rust();
682 /// The first to-be-broadcast-by-sender transaction's per commitment point
684 pub extern "C" fn OpenChannel_get_first_per_commitment_point(this_ptr: &OpenChannel) -> crate::c_types::PublicKey {
685 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.first_per_commitment_point;
686 crate::c_types::PublicKey::from_rust(&inner_val)
688 /// The first to-be-broadcast-by-sender transaction's per commitment point
690 pub extern "C" fn OpenChannel_set_first_per_commitment_point(this_ptr: &mut OpenChannel, mut val: crate::c_types::PublicKey) {
691 unsafe { &mut *this_ptr.inner }.first_per_commitment_point = val.into_rust();
695 pub extern "C" fn OpenChannel_get_channel_flags(this_ptr: &OpenChannel) -> u8 {
696 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_flags;
701 pub extern "C" fn OpenChannel_set_channel_flags(this_ptr: &mut OpenChannel, mut val: u8) {
702 unsafe { &mut *this_ptr.inner }.channel_flags = val;
704 impl Clone for OpenChannel {
705 fn clone(&self) -> Self {
707 inner: if <*mut nativeOpenChannel>::is_null(self.inner) { std::ptr::null_mut() } else {
708 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
714 /// Used only if an object of this type is returned as a trait impl by a method
715 pub(crate) extern "C" fn OpenChannel_clone_void(this_ptr: *const c_void) -> *mut c_void {
716 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeOpenChannel)).clone() })) as *mut c_void
719 /// Creates a copy of the OpenChannel
720 pub extern "C" fn OpenChannel_clone(orig: &OpenChannel) -> OpenChannel {
724 use lightning::ln::msgs::AcceptChannel as nativeAcceptChannelImport;
725 type nativeAcceptChannel = nativeAcceptChannelImport;
727 /// An accept_channel message to be sent or received from a peer
730 pub struct AcceptChannel {
731 /// A pointer to the opaque Rust object.
733 /// Nearly everywhere, inner must be non-null, however in places where
734 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
735 pub inner: *mut nativeAcceptChannel,
736 /// Indicates that this is the only struct which contains the same pointer.
738 /// Rust functions which take ownership of an object provided via an argument require
739 /// this to be true and invalidate the object pointed to by inner.
743 impl Drop for AcceptChannel {
745 if self.is_owned && !<*mut nativeAcceptChannel>::is_null(self.inner) {
746 let _ = unsafe { Box::from_raw(self.inner) };
750 /// Frees any resources used by the AcceptChannel, if is_owned is set and inner is non-NULL.
752 pub extern "C" fn AcceptChannel_free(this_obj: AcceptChannel) { }
754 /// Used only if an object of this type is returned as a trait impl by a method
755 extern "C" fn AcceptChannel_free_void(this_ptr: *mut c_void) {
756 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeAcceptChannel); }
759 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
761 pub(crate) fn take_inner(mut self) -> *mut nativeAcceptChannel {
762 assert!(self.is_owned);
763 let ret = self.inner;
764 self.inner = std::ptr::null_mut();
768 /// A temporary channel ID, until the funding outpoint is announced
770 pub extern "C" fn AcceptChannel_get_temporary_channel_id(this_ptr: &AcceptChannel) -> *const [u8; 32] {
771 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.temporary_channel_id;
774 /// A temporary channel ID, until the funding outpoint is announced
776 pub extern "C" fn AcceptChannel_set_temporary_channel_id(this_ptr: &mut AcceptChannel, mut val: crate::c_types::ThirtyTwoBytes) {
777 unsafe { &mut *this_ptr.inner }.temporary_channel_id = val.data;
779 /// The threshold below which outputs on transactions broadcast by sender will be omitted
781 pub extern "C" fn AcceptChannel_get_dust_limit_satoshis(this_ptr: &AcceptChannel) -> u64 {
782 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.dust_limit_satoshis;
785 /// The threshold below which outputs on transactions broadcast by sender will be omitted
787 pub extern "C" fn AcceptChannel_set_dust_limit_satoshis(this_ptr: &mut AcceptChannel, mut val: u64) {
788 unsafe { &mut *this_ptr.inner }.dust_limit_satoshis = val;
790 /// The maximum inbound HTLC value in flight towards sender, in milli-satoshi
792 pub extern "C" fn AcceptChannel_get_max_htlc_value_in_flight_msat(this_ptr: &AcceptChannel) -> u64 {
793 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.max_htlc_value_in_flight_msat;
796 /// The maximum inbound HTLC value in flight towards sender, in milli-satoshi
798 pub extern "C" fn AcceptChannel_set_max_htlc_value_in_flight_msat(this_ptr: &mut AcceptChannel, mut val: u64) {
799 unsafe { &mut *this_ptr.inner }.max_htlc_value_in_flight_msat = val;
801 /// The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
803 pub extern "C" fn AcceptChannel_get_channel_reserve_satoshis(this_ptr: &AcceptChannel) -> u64 {
804 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_reserve_satoshis;
807 /// The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
809 pub extern "C" fn AcceptChannel_set_channel_reserve_satoshis(this_ptr: &mut AcceptChannel, mut val: u64) {
810 unsafe { &mut *this_ptr.inner }.channel_reserve_satoshis = val;
812 /// The minimum HTLC size incoming to sender, in milli-satoshi
814 pub extern "C" fn AcceptChannel_get_htlc_minimum_msat(this_ptr: &AcceptChannel) -> u64 {
815 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.htlc_minimum_msat;
818 /// The minimum HTLC size incoming to sender, in milli-satoshi
820 pub extern "C" fn AcceptChannel_set_htlc_minimum_msat(this_ptr: &mut AcceptChannel, mut val: u64) {
821 unsafe { &mut *this_ptr.inner }.htlc_minimum_msat = val;
823 /// Minimum depth of the funding transaction before the channel is considered open
825 pub extern "C" fn AcceptChannel_get_minimum_depth(this_ptr: &AcceptChannel) -> u32 {
826 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.minimum_depth;
829 /// Minimum depth of the funding transaction before the channel is considered open
831 pub extern "C" fn AcceptChannel_set_minimum_depth(this_ptr: &mut AcceptChannel, mut val: u32) {
832 unsafe { &mut *this_ptr.inner }.minimum_depth = val;
834 /// The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
836 pub extern "C" fn AcceptChannel_get_to_self_delay(this_ptr: &AcceptChannel) -> u16 {
837 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.to_self_delay;
840 /// The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
842 pub extern "C" fn AcceptChannel_set_to_self_delay(this_ptr: &mut AcceptChannel, mut val: u16) {
843 unsafe { &mut *this_ptr.inner }.to_self_delay = val;
845 /// The maximum number of inbound HTLCs towards sender
847 pub extern "C" fn AcceptChannel_get_max_accepted_htlcs(this_ptr: &AcceptChannel) -> u16 {
848 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.max_accepted_htlcs;
851 /// The maximum number of inbound HTLCs towards sender
853 pub extern "C" fn AcceptChannel_set_max_accepted_htlcs(this_ptr: &mut AcceptChannel, mut val: u16) {
854 unsafe { &mut *this_ptr.inner }.max_accepted_htlcs = val;
856 /// The sender's key controlling the funding transaction
858 pub extern "C" fn AcceptChannel_get_funding_pubkey(this_ptr: &AcceptChannel) -> crate::c_types::PublicKey {
859 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.funding_pubkey;
860 crate::c_types::PublicKey::from_rust(&inner_val)
862 /// The sender's key controlling the funding transaction
864 pub extern "C" fn AcceptChannel_set_funding_pubkey(this_ptr: &mut AcceptChannel, mut val: crate::c_types::PublicKey) {
865 unsafe { &mut *this_ptr.inner }.funding_pubkey = val.into_rust();
867 /// Used to derive a revocation key for transactions broadcast by counterparty
869 pub extern "C" fn AcceptChannel_get_revocation_basepoint(this_ptr: &AcceptChannel) -> crate::c_types::PublicKey {
870 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.revocation_basepoint;
871 crate::c_types::PublicKey::from_rust(&inner_val)
873 /// Used to derive a revocation key for transactions broadcast by counterparty
875 pub extern "C" fn AcceptChannel_set_revocation_basepoint(this_ptr: &mut AcceptChannel, mut val: crate::c_types::PublicKey) {
876 unsafe { &mut *this_ptr.inner }.revocation_basepoint = val.into_rust();
878 /// A payment key to sender for transactions broadcast by counterparty
880 pub extern "C" fn AcceptChannel_get_payment_point(this_ptr: &AcceptChannel) -> crate::c_types::PublicKey {
881 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.payment_point;
882 crate::c_types::PublicKey::from_rust(&inner_val)
884 /// A payment key to sender for transactions broadcast by counterparty
886 pub extern "C" fn AcceptChannel_set_payment_point(this_ptr: &mut AcceptChannel, mut val: crate::c_types::PublicKey) {
887 unsafe { &mut *this_ptr.inner }.payment_point = val.into_rust();
889 /// Used to derive a payment key to sender for transactions broadcast by sender
891 pub extern "C" fn AcceptChannel_get_delayed_payment_basepoint(this_ptr: &AcceptChannel) -> crate::c_types::PublicKey {
892 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.delayed_payment_basepoint;
893 crate::c_types::PublicKey::from_rust(&inner_val)
895 /// Used to derive a payment key to sender for transactions broadcast by sender
897 pub extern "C" fn AcceptChannel_set_delayed_payment_basepoint(this_ptr: &mut AcceptChannel, mut val: crate::c_types::PublicKey) {
898 unsafe { &mut *this_ptr.inner }.delayed_payment_basepoint = val.into_rust();
900 /// Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
902 pub extern "C" fn AcceptChannel_get_htlc_basepoint(this_ptr: &AcceptChannel) -> crate::c_types::PublicKey {
903 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.htlc_basepoint;
904 crate::c_types::PublicKey::from_rust(&inner_val)
906 /// Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
908 pub extern "C" fn AcceptChannel_set_htlc_basepoint(this_ptr: &mut AcceptChannel, mut val: crate::c_types::PublicKey) {
909 unsafe { &mut *this_ptr.inner }.htlc_basepoint = val.into_rust();
911 /// The first to-be-broadcast-by-sender transaction's per commitment point
913 pub extern "C" fn AcceptChannel_get_first_per_commitment_point(this_ptr: &AcceptChannel) -> crate::c_types::PublicKey {
914 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.first_per_commitment_point;
915 crate::c_types::PublicKey::from_rust(&inner_val)
917 /// The first to-be-broadcast-by-sender transaction's per commitment point
919 pub extern "C" fn AcceptChannel_set_first_per_commitment_point(this_ptr: &mut AcceptChannel, mut val: crate::c_types::PublicKey) {
920 unsafe { &mut *this_ptr.inner }.first_per_commitment_point = val.into_rust();
922 impl Clone for AcceptChannel {
923 fn clone(&self) -> Self {
925 inner: if <*mut nativeAcceptChannel>::is_null(self.inner) { std::ptr::null_mut() } else {
926 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
932 /// Used only if an object of this type is returned as a trait impl by a method
933 pub(crate) extern "C" fn AcceptChannel_clone_void(this_ptr: *const c_void) -> *mut c_void {
934 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeAcceptChannel)).clone() })) as *mut c_void
937 /// Creates a copy of the AcceptChannel
938 pub extern "C" fn AcceptChannel_clone(orig: &AcceptChannel) -> AcceptChannel {
942 use lightning::ln::msgs::FundingCreated as nativeFundingCreatedImport;
943 type nativeFundingCreated = nativeFundingCreatedImport;
945 /// A funding_created message to be sent or received from a peer
948 pub struct FundingCreated {
949 /// A pointer to the opaque Rust object.
951 /// Nearly everywhere, inner must be non-null, however in places where
952 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
953 pub inner: *mut nativeFundingCreated,
954 /// Indicates that this is the only struct which contains the same pointer.
956 /// Rust functions which take ownership of an object provided via an argument require
957 /// this to be true and invalidate the object pointed to by inner.
961 impl Drop for FundingCreated {
963 if self.is_owned && !<*mut nativeFundingCreated>::is_null(self.inner) {
964 let _ = unsafe { Box::from_raw(self.inner) };
968 /// Frees any resources used by the FundingCreated, if is_owned is set and inner is non-NULL.
970 pub extern "C" fn FundingCreated_free(this_obj: FundingCreated) { }
972 /// Used only if an object of this type is returned as a trait impl by a method
973 extern "C" fn FundingCreated_free_void(this_ptr: *mut c_void) {
974 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeFundingCreated); }
977 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
978 impl FundingCreated {
979 pub(crate) fn take_inner(mut self) -> *mut nativeFundingCreated {
980 assert!(self.is_owned);
981 let ret = self.inner;
982 self.inner = std::ptr::null_mut();
986 /// A temporary channel ID, until the funding is established
988 pub extern "C" fn FundingCreated_get_temporary_channel_id(this_ptr: &FundingCreated) -> *const [u8; 32] {
989 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.temporary_channel_id;
992 /// A temporary channel ID, until the funding is established
994 pub extern "C" fn FundingCreated_set_temporary_channel_id(this_ptr: &mut FundingCreated, mut val: crate::c_types::ThirtyTwoBytes) {
995 unsafe { &mut *this_ptr.inner }.temporary_channel_id = val.data;
997 /// The funding transaction ID
999 pub extern "C" fn FundingCreated_get_funding_txid(this_ptr: &FundingCreated) -> *const [u8; 32] {
1000 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.funding_txid;
1001 inner_val.as_inner()
1003 /// The funding transaction ID
1005 pub extern "C" fn FundingCreated_set_funding_txid(this_ptr: &mut FundingCreated, mut val: crate::c_types::ThirtyTwoBytes) {
1006 unsafe { &mut *this_ptr.inner }.funding_txid = ::bitcoin::hash_types::Txid::from_slice(&val.data[..]).unwrap();
1008 /// The specific output index funding this channel
1010 pub extern "C" fn FundingCreated_get_funding_output_index(this_ptr: &FundingCreated) -> u16 {
1011 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.funding_output_index;
1014 /// The specific output index funding this channel
1016 pub extern "C" fn FundingCreated_set_funding_output_index(this_ptr: &mut FundingCreated, mut val: u16) {
1017 unsafe { &mut *this_ptr.inner }.funding_output_index = val;
1019 /// The signature of the channel initiator (funder) on the funding transaction
1021 pub extern "C" fn FundingCreated_get_signature(this_ptr: &FundingCreated) -> crate::c_types::Signature {
1022 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.signature;
1023 crate::c_types::Signature::from_rust(&inner_val)
1025 /// The signature of the channel initiator (funder) on the funding transaction
1027 pub extern "C" fn FundingCreated_set_signature(this_ptr: &mut FundingCreated, mut val: crate::c_types::Signature) {
1028 unsafe { &mut *this_ptr.inner }.signature = val.into_rust();
1030 /// Constructs a new FundingCreated given each field
1033 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 {
1034 FundingCreated { inner: Box::into_raw(Box::new(nativeFundingCreated {
1035 temporary_channel_id: temporary_channel_id_arg.data,
1036 funding_txid: ::bitcoin::hash_types::Txid::from_slice(&funding_txid_arg.data[..]).unwrap(),
1037 funding_output_index: funding_output_index_arg,
1038 signature: signature_arg.into_rust(),
1039 })), is_owned: true }
1041 impl Clone for FundingCreated {
1042 fn clone(&self) -> Self {
1044 inner: if <*mut nativeFundingCreated>::is_null(self.inner) { std::ptr::null_mut() } else {
1045 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
1051 /// Used only if an object of this type is returned as a trait impl by a method
1052 pub(crate) extern "C" fn FundingCreated_clone_void(this_ptr: *const c_void) -> *mut c_void {
1053 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeFundingCreated)).clone() })) as *mut c_void
1056 /// Creates a copy of the FundingCreated
1057 pub extern "C" fn FundingCreated_clone(orig: &FundingCreated) -> FundingCreated {
1061 use lightning::ln::msgs::FundingSigned as nativeFundingSignedImport;
1062 type nativeFundingSigned = nativeFundingSignedImport;
1064 /// A funding_signed message to be sent or received from a peer
1067 pub struct FundingSigned {
1068 /// A pointer to the opaque Rust object.
1070 /// Nearly everywhere, inner must be non-null, however in places where
1071 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
1072 pub inner: *mut nativeFundingSigned,
1073 /// Indicates that this is the only struct which contains the same pointer.
1075 /// Rust functions which take ownership of an object provided via an argument require
1076 /// this to be true and invalidate the object pointed to by inner.
1080 impl Drop for FundingSigned {
1081 fn drop(&mut self) {
1082 if self.is_owned && !<*mut nativeFundingSigned>::is_null(self.inner) {
1083 let _ = unsafe { Box::from_raw(self.inner) };
1087 /// Frees any resources used by the FundingSigned, if is_owned is set and inner is non-NULL.
1089 pub extern "C" fn FundingSigned_free(this_obj: FundingSigned) { }
1091 /// Used only if an object of this type is returned as a trait impl by a method
1092 extern "C" fn FundingSigned_free_void(this_ptr: *mut c_void) {
1093 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeFundingSigned); }
1096 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
1097 impl FundingSigned {
1098 pub(crate) fn take_inner(mut self) -> *mut nativeFundingSigned {
1099 assert!(self.is_owned);
1100 let ret = self.inner;
1101 self.inner = std::ptr::null_mut();
1107 pub extern "C" fn FundingSigned_get_channel_id(this_ptr: &FundingSigned) -> *const [u8; 32] {
1108 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_id;
1113 pub extern "C" fn FundingSigned_set_channel_id(this_ptr: &mut FundingSigned, mut val: crate::c_types::ThirtyTwoBytes) {
1114 unsafe { &mut *this_ptr.inner }.channel_id = val.data;
1116 /// The signature of the channel acceptor (fundee) on the funding transaction
1118 pub extern "C" fn FundingSigned_get_signature(this_ptr: &FundingSigned) -> crate::c_types::Signature {
1119 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.signature;
1120 crate::c_types::Signature::from_rust(&inner_val)
1122 /// The signature of the channel acceptor (fundee) on the funding transaction
1124 pub extern "C" fn FundingSigned_set_signature(this_ptr: &mut FundingSigned, mut val: crate::c_types::Signature) {
1125 unsafe { &mut *this_ptr.inner }.signature = val.into_rust();
1127 /// Constructs a new FundingSigned given each field
1130 pub extern "C" fn FundingSigned_new(mut channel_id_arg: crate::c_types::ThirtyTwoBytes, mut signature_arg: crate::c_types::Signature) -> FundingSigned {
1131 FundingSigned { inner: Box::into_raw(Box::new(nativeFundingSigned {
1132 channel_id: channel_id_arg.data,
1133 signature: signature_arg.into_rust(),
1134 })), is_owned: true }
1136 impl Clone for FundingSigned {
1137 fn clone(&self) -> Self {
1139 inner: if <*mut nativeFundingSigned>::is_null(self.inner) { std::ptr::null_mut() } else {
1140 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
1146 /// Used only if an object of this type is returned as a trait impl by a method
1147 pub(crate) extern "C" fn FundingSigned_clone_void(this_ptr: *const c_void) -> *mut c_void {
1148 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeFundingSigned)).clone() })) as *mut c_void
1151 /// Creates a copy of the FundingSigned
1152 pub extern "C" fn FundingSigned_clone(orig: &FundingSigned) -> FundingSigned {
1156 use lightning::ln::msgs::FundingLocked as nativeFundingLockedImport;
1157 type nativeFundingLocked = nativeFundingLockedImport;
1159 /// A funding_locked message to be sent or received from a peer
1162 pub struct FundingLocked {
1163 /// A pointer to the opaque Rust object.
1165 /// Nearly everywhere, inner must be non-null, however in places where
1166 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
1167 pub inner: *mut nativeFundingLocked,
1168 /// Indicates that this is the only struct which contains the same pointer.
1170 /// Rust functions which take ownership of an object provided via an argument require
1171 /// this to be true and invalidate the object pointed to by inner.
1175 impl Drop for FundingLocked {
1176 fn drop(&mut self) {
1177 if self.is_owned && !<*mut nativeFundingLocked>::is_null(self.inner) {
1178 let _ = unsafe { Box::from_raw(self.inner) };
1182 /// Frees any resources used by the FundingLocked, if is_owned is set and inner is non-NULL.
1184 pub extern "C" fn FundingLocked_free(this_obj: FundingLocked) { }
1186 /// Used only if an object of this type is returned as a trait impl by a method
1187 extern "C" fn FundingLocked_free_void(this_ptr: *mut c_void) {
1188 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeFundingLocked); }
1191 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
1192 impl FundingLocked {
1193 pub(crate) fn take_inner(mut self) -> *mut nativeFundingLocked {
1194 assert!(self.is_owned);
1195 let ret = self.inner;
1196 self.inner = std::ptr::null_mut();
1202 pub extern "C" fn FundingLocked_get_channel_id(this_ptr: &FundingLocked) -> *const [u8; 32] {
1203 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_id;
1208 pub extern "C" fn FundingLocked_set_channel_id(this_ptr: &mut FundingLocked, mut val: crate::c_types::ThirtyTwoBytes) {
1209 unsafe { &mut *this_ptr.inner }.channel_id = val.data;
1211 /// The per-commitment point of the second commitment transaction
1213 pub extern "C" fn FundingLocked_get_next_per_commitment_point(this_ptr: &FundingLocked) -> crate::c_types::PublicKey {
1214 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.next_per_commitment_point;
1215 crate::c_types::PublicKey::from_rust(&inner_val)
1217 /// The per-commitment point of the second commitment transaction
1219 pub extern "C" fn FundingLocked_set_next_per_commitment_point(this_ptr: &mut FundingLocked, mut val: crate::c_types::PublicKey) {
1220 unsafe { &mut *this_ptr.inner }.next_per_commitment_point = val.into_rust();
1222 /// Constructs a new FundingLocked given each field
1225 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 {
1226 FundingLocked { inner: Box::into_raw(Box::new(nativeFundingLocked {
1227 channel_id: channel_id_arg.data,
1228 next_per_commitment_point: next_per_commitment_point_arg.into_rust(),
1229 })), is_owned: true }
1231 impl Clone for FundingLocked {
1232 fn clone(&self) -> Self {
1234 inner: if <*mut nativeFundingLocked>::is_null(self.inner) { std::ptr::null_mut() } else {
1235 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
1241 /// Used only if an object of this type is returned as a trait impl by a method
1242 pub(crate) extern "C" fn FundingLocked_clone_void(this_ptr: *const c_void) -> *mut c_void {
1243 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeFundingLocked)).clone() })) as *mut c_void
1246 /// Creates a copy of the FundingLocked
1247 pub extern "C" fn FundingLocked_clone(orig: &FundingLocked) -> FundingLocked {
1251 use lightning::ln::msgs::Shutdown as nativeShutdownImport;
1252 type nativeShutdown = nativeShutdownImport;
1254 /// A shutdown message to be sent or received from a peer
1257 pub struct Shutdown {
1258 /// A pointer to the opaque Rust object.
1260 /// Nearly everywhere, inner must be non-null, however in places where
1261 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
1262 pub inner: *mut nativeShutdown,
1263 /// Indicates that this is the only struct which contains the same pointer.
1265 /// Rust functions which take ownership of an object provided via an argument require
1266 /// this to be true and invalidate the object pointed to by inner.
1270 impl Drop for Shutdown {
1271 fn drop(&mut self) {
1272 if self.is_owned && !<*mut nativeShutdown>::is_null(self.inner) {
1273 let _ = unsafe { Box::from_raw(self.inner) };
1277 /// Frees any resources used by the Shutdown, if is_owned is set and inner is non-NULL.
1279 pub extern "C" fn Shutdown_free(this_obj: Shutdown) { }
1281 /// Used only if an object of this type is returned as a trait impl by a method
1282 extern "C" fn Shutdown_free_void(this_ptr: *mut c_void) {
1283 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeShutdown); }
1286 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
1288 pub(crate) fn take_inner(mut self) -> *mut nativeShutdown {
1289 assert!(self.is_owned);
1290 let ret = self.inner;
1291 self.inner = std::ptr::null_mut();
1297 pub extern "C" fn Shutdown_get_channel_id(this_ptr: &Shutdown) -> *const [u8; 32] {
1298 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_id;
1303 pub extern "C" fn Shutdown_set_channel_id(this_ptr: &mut Shutdown, mut val: crate::c_types::ThirtyTwoBytes) {
1304 unsafe { &mut *this_ptr.inner }.channel_id = val.data;
1306 /// The destination of this peer's funds on closing.
1307 /// Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
1309 pub extern "C" fn Shutdown_get_scriptpubkey(this_ptr: &Shutdown) -> crate::c_types::u8slice {
1310 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.scriptpubkey;
1311 crate::c_types::u8slice::from_slice(&inner_val[..])
1313 /// The destination of this peer's funds on closing.
1314 /// Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
1316 pub extern "C" fn Shutdown_set_scriptpubkey(this_ptr: &mut Shutdown, mut val: crate::c_types::derived::CVec_u8Z) {
1317 unsafe { &mut *this_ptr.inner }.scriptpubkey = ::bitcoin::blockdata::script::Script::from(val.into_rust());
1319 /// Constructs a new Shutdown given each field
1322 pub extern "C" fn Shutdown_new(mut channel_id_arg: crate::c_types::ThirtyTwoBytes, mut scriptpubkey_arg: crate::c_types::derived::CVec_u8Z) -> Shutdown {
1323 Shutdown { inner: Box::into_raw(Box::new(nativeShutdown {
1324 channel_id: channel_id_arg.data,
1325 scriptpubkey: ::bitcoin::blockdata::script::Script::from(scriptpubkey_arg.into_rust()),
1326 })), is_owned: true }
1328 impl Clone for Shutdown {
1329 fn clone(&self) -> Self {
1331 inner: if <*mut nativeShutdown>::is_null(self.inner) { std::ptr::null_mut() } else {
1332 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
1338 /// Used only if an object of this type is returned as a trait impl by a method
1339 pub(crate) extern "C" fn Shutdown_clone_void(this_ptr: *const c_void) -> *mut c_void {
1340 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeShutdown)).clone() })) as *mut c_void
1343 /// Creates a copy of the Shutdown
1344 pub extern "C" fn Shutdown_clone(orig: &Shutdown) -> Shutdown {
1348 use lightning::ln::msgs::ClosingSigned as nativeClosingSignedImport;
1349 type nativeClosingSigned = nativeClosingSignedImport;
1351 /// A closing_signed message to be sent or received from a peer
1354 pub struct ClosingSigned {
1355 /// A pointer to the opaque Rust object.
1357 /// Nearly everywhere, inner must be non-null, however in places where
1358 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
1359 pub inner: *mut nativeClosingSigned,
1360 /// Indicates that this is the only struct which contains the same pointer.
1362 /// Rust functions which take ownership of an object provided via an argument require
1363 /// this to be true and invalidate the object pointed to by inner.
1367 impl Drop for ClosingSigned {
1368 fn drop(&mut self) {
1369 if self.is_owned && !<*mut nativeClosingSigned>::is_null(self.inner) {
1370 let _ = unsafe { Box::from_raw(self.inner) };
1374 /// Frees any resources used by the ClosingSigned, if is_owned is set and inner is non-NULL.
1376 pub extern "C" fn ClosingSigned_free(this_obj: ClosingSigned) { }
1378 /// Used only if an object of this type is returned as a trait impl by a method
1379 extern "C" fn ClosingSigned_free_void(this_ptr: *mut c_void) {
1380 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeClosingSigned); }
1383 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
1384 impl ClosingSigned {
1385 pub(crate) fn take_inner(mut self) -> *mut nativeClosingSigned {
1386 assert!(self.is_owned);
1387 let ret = self.inner;
1388 self.inner = std::ptr::null_mut();
1394 pub extern "C" fn ClosingSigned_get_channel_id(this_ptr: &ClosingSigned) -> *const [u8; 32] {
1395 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_id;
1400 pub extern "C" fn ClosingSigned_set_channel_id(this_ptr: &mut ClosingSigned, mut val: crate::c_types::ThirtyTwoBytes) {
1401 unsafe { &mut *this_ptr.inner }.channel_id = val.data;
1403 /// The proposed total fee for the closing transaction
1405 pub extern "C" fn ClosingSigned_get_fee_satoshis(this_ptr: &ClosingSigned) -> u64 {
1406 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.fee_satoshis;
1409 /// The proposed total fee for the closing transaction
1411 pub extern "C" fn ClosingSigned_set_fee_satoshis(this_ptr: &mut ClosingSigned, mut val: u64) {
1412 unsafe { &mut *this_ptr.inner }.fee_satoshis = val;
1414 /// A signature on the closing transaction
1416 pub extern "C" fn ClosingSigned_get_signature(this_ptr: &ClosingSigned) -> crate::c_types::Signature {
1417 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.signature;
1418 crate::c_types::Signature::from_rust(&inner_val)
1420 /// A signature on the closing transaction
1422 pub extern "C" fn ClosingSigned_set_signature(this_ptr: &mut ClosingSigned, mut val: crate::c_types::Signature) {
1423 unsafe { &mut *this_ptr.inner }.signature = val.into_rust();
1425 /// Constructs a new ClosingSigned given each field
1428 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 {
1429 ClosingSigned { inner: Box::into_raw(Box::new(nativeClosingSigned {
1430 channel_id: channel_id_arg.data,
1431 fee_satoshis: fee_satoshis_arg,
1432 signature: signature_arg.into_rust(),
1433 })), is_owned: true }
1435 impl Clone for ClosingSigned {
1436 fn clone(&self) -> Self {
1438 inner: if <*mut nativeClosingSigned>::is_null(self.inner) { std::ptr::null_mut() } else {
1439 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
1445 /// Used only if an object of this type is returned as a trait impl by a method
1446 pub(crate) extern "C" fn ClosingSigned_clone_void(this_ptr: *const c_void) -> *mut c_void {
1447 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeClosingSigned)).clone() })) as *mut c_void
1450 /// Creates a copy of the ClosingSigned
1451 pub extern "C" fn ClosingSigned_clone(orig: &ClosingSigned) -> ClosingSigned {
1455 use lightning::ln::msgs::UpdateAddHTLC as nativeUpdateAddHTLCImport;
1456 type nativeUpdateAddHTLC = nativeUpdateAddHTLCImport;
1458 /// An update_add_htlc message to be sent or received from a peer
1461 pub struct UpdateAddHTLC {
1462 /// A pointer to the opaque Rust object.
1464 /// Nearly everywhere, inner must be non-null, however in places where
1465 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
1466 pub inner: *mut nativeUpdateAddHTLC,
1467 /// Indicates that this is the only struct which contains the same pointer.
1469 /// Rust functions which take ownership of an object provided via an argument require
1470 /// this to be true and invalidate the object pointed to by inner.
1474 impl Drop for UpdateAddHTLC {
1475 fn drop(&mut self) {
1476 if self.is_owned && !<*mut nativeUpdateAddHTLC>::is_null(self.inner) {
1477 let _ = unsafe { Box::from_raw(self.inner) };
1481 /// Frees any resources used by the UpdateAddHTLC, if is_owned is set and inner is non-NULL.
1483 pub extern "C" fn UpdateAddHTLC_free(this_obj: UpdateAddHTLC) { }
1485 /// Used only if an object of this type is returned as a trait impl by a method
1486 extern "C" fn UpdateAddHTLC_free_void(this_ptr: *mut c_void) {
1487 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeUpdateAddHTLC); }
1490 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
1491 impl UpdateAddHTLC {
1492 pub(crate) fn take_inner(mut self) -> *mut nativeUpdateAddHTLC {
1493 assert!(self.is_owned);
1494 let ret = self.inner;
1495 self.inner = std::ptr::null_mut();
1501 pub extern "C" fn UpdateAddHTLC_get_channel_id(this_ptr: &UpdateAddHTLC) -> *const [u8; 32] {
1502 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_id;
1507 pub extern "C" fn UpdateAddHTLC_set_channel_id(this_ptr: &mut UpdateAddHTLC, mut val: crate::c_types::ThirtyTwoBytes) {
1508 unsafe { &mut *this_ptr.inner }.channel_id = val.data;
1512 pub extern "C" fn UpdateAddHTLC_get_htlc_id(this_ptr: &UpdateAddHTLC) -> u64 {
1513 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.htlc_id;
1518 pub extern "C" fn UpdateAddHTLC_set_htlc_id(this_ptr: &mut UpdateAddHTLC, mut val: u64) {
1519 unsafe { &mut *this_ptr.inner }.htlc_id = val;
1521 /// The HTLC value in milli-satoshi
1523 pub extern "C" fn UpdateAddHTLC_get_amount_msat(this_ptr: &UpdateAddHTLC) -> u64 {
1524 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.amount_msat;
1527 /// The HTLC value in milli-satoshi
1529 pub extern "C" fn UpdateAddHTLC_set_amount_msat(this_ptr: &mut UpdateAddHTLC, mut val: u64) {
1530 unsafe { &mut *this_ptr.inner }.amount_msat = val;
1532 /// The payment hash, the pre-image of which controls HTLC redemption
1534 pub extern "C" fn UpdateAddHTLC_get_payment_hash(this_ptr: &UpdateAddHTLC) -> *const [u8; 32] {
1535 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.payment_hash;
1538 /// The payment hash, the pre-image of which controls HTLC redemption
1540 pub extern "C" fn UpdateAddHTLC_set_payment_hash(this_ptr: &mut UpdateAddHTLC, mut val: crate::c_types::ThirtyTwoBytes) {
1541 unsafe { &mut *this_ptr.inner }.payment_hash = ::lightning::ln::PaymentHash(val.data);
1543 /// The expiry height of the HTLC
1545 pub extern "C" fn UpdateAddHTLC_get_cltv_expiry(this_ptr: &UpdateAddHTLC) -> u32 {
1546 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.cltv_expiry;
1549 /// The expiry height of the HTLC
1551 pub extern "C" fn UpdateAddHTLC_set_cltv_expiry(this_ptr: &mut UpdateAddHTLC, mut val: u32) {
1552 unsafe { &mut *this_ptr.inner }.cltv_expiry = val;
1554 impl Clone for UpdateAddHTLC {
1555 fn clone(&self) -> Self {
1557 inner: if <*mut nativeUpdateAddHTLC>::is_null(self.inner) { std::ptr::null_mut() } else {
1558 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
1564 /// Used only if an object of this type is returned as a trait impl by a method
1565 pub(crate) extern "C" fn UpdateAddHTLC_clone_void(this_ptr: *const c_void) -> *mut c_void {
1566 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeUpdateAddHTLC)).clone() })) as *mut c_void
1569 /// Creates a copy of the UpdateAddHTLC
1570 pub extern "C" fn UpdateAddHTLC_clone(orig: &UpdateAddHTLC) -> UpdateAddHTLC {
1574 use lightning::ln::msgs::UpdateFulfillHTLC as nativeUpdateFulfillHTLCImport;
1575 type nativeUpdateFulfillHTLC = nativeUpdateFulfillHTLCImport;
1577 /// An update_fulfill_htlc message to be sent or received from a peer
1580 pub struct UpdateFulfillHTLC {
1581 /// A pointer to the opaque Rust object.
1583 /// Nearly everywhere, inner must be non-null, however in places where
1584 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
1585 pub inner: *mut nativeUpdateFulfillHTLC,
1586 /// Indicates that this is the only struct which contains the same pointer.
1588 /// Rust functions which take ownership of an object provided via an argument require
1589 /// this to be true and invalidate the object pointed to by inner.
1593 impl Drop for UpdateFulfillHTLC {
1594 fn drop(&mut self) {
1595 if self.is_owned && !<*mut nativeUpdateFulfillHTLC>::is_null(self.inner) {
1596 let _ = unsafe { Box::from_raw(self.inner) };
1600 /// Frees any resources used by the UpdateFulfillHTLC, if is_owned is set and inner is non-NULL.
1602 pub extern "C" fn UpdateFulfillHTLC_free(this_obj: UpdateFulfillHTLC) { }
1604 /// Used only if an object of this type is returned as a trait impl by a method
1605 extern "C" fn UpdateFulfillHTLC_free_void(this_ptr: *mut c_void) {
1606 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeUpdateFulfillHTLC); }
1609 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
1610 impl UpdateFulfillHTLC {
1611 pub(crate) fn take_inner(mut self) -> *mut nativeUpdateFulfillHTLC {
1612 assert!(self.is_owned);
1613 let ret = self.inner;
1614 self.inner = std::ptr::null_mut();
1620 pub extern "C" fn UpdateFulfillHTLC_get_channel_id(this_ptr: &UpdateFulfillHTLC) -> *const [u8; 32] {
1621 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_id;
1626 pub extern "C" fn UpdateFulfillHTLC_set_channel_id(this_ptr: &mut UpdateFulfillHTLC, mut val: crate::c_types::ThirtyTwoBytes) {
1627 unsafe { &mut *this_ptr.inner }.channel_id = val.data;
1631 pub extern "C" fn UpdateFulfillHTLC_get_htlc_id(this_ptr: &UpdateFulfillHTLC) -> u64 {
1632 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.htlc_id;
1637 pub extern "C" fn UpdateFulfillHTLC_set_htlc_id(this_ptr: &mut UpdateFulfillHTLC, mut val: u64) {
1638 unsafe { &mut *this_ptr.inner }.htlc_id = val;
1640 /// The pre-image of the payment hash, allowing HTLC redemption
1642 pub extern "C" fn UpdateFulfillHTLC_get_payment_preimage(this_ptr: &UpdateFulfillHTLC) -> *const [u8; 32] {
1643 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.payment_preimage;
1646 /// The pre-image of the payment hash, allowing HTLC redemption
1648 pub extern "C" fn UpdateFulfillHTLC_set_payment_preimage(this_ptr: &mut UpdateFulfillHTLC, mut val: crate::c_types::ThirtyTwoBytes) {
1649 unsafe { &mut *this_ptr.inner }.payment_preimage = ::lightning::ln::PaymentPreimage(val.data);
1651 /// Constructs a new UpdateFulfillHTLC given each field
1654 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 {
1655 UpdateFulfillHTLC { inner: Box::into_raw(Box::new(nativeUpdateFulfillHTLC {
1656 channel_id: channel_id_arg.data,
1657 htlc_id: htlc_id_arg,
1658 payment_preimage: ::lightning::ln::PaymentPreimage(payment_preimage_arg.data),
1659 })), is_owned: true }
1661 impl Clone for UpdateFulfillHTLC {
1662 fn clone(&self) -> Self {
1664 inner: if <*mut nativeUpdateFulfillHTLC>::is_null(self.inner) { std::ptr::null_mut() } else {
1665 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
1671 /// Used only if an object of this type is returned as a trait impl by a method
1672 pub(crate) extern "C" fn UpdateFulfillHTLC_clone_void(this_ptr: *const c_void) -> *mut c_void {
1673 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeUpdateFulfillHTLC)).clone() })) as *mut c_void
1676 /// Creates a copy of the UpdateFulfillHTLC
1677 pub extern "C" fn UpdateFulfillHTLC_clone(orig: &UpdateFulfillHTLC) -> UpdateFulfillHTLC {
1681 use lightning::ln::msgs::UpdateFailHTLC as nativeUpdateFailHTLCImport;
1682 type nativeUpdateFailHTLC = nativeUpdateFailHTLCImport;
1684 /// An update_fail_htlc message to be sent or received from a peer
1687 pub struct UpdateFailHTLC {
1688 /// A pointer to the opaque Rust object.
1690 /// Nearly everywhere, inner must be non-null, however in places where
1691 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
1692 pub inner: *mut nativeUpdateFailHTLC,
1693 /// Indicates that this is the only struct which contains the same pointer.
1695 /// Rust functions which take ownership of an object provided via an argument require
1696 /// this to be true and invalidate the object pointed to by inner.
1700 impl Drop for UpdateFailHTLC {
1701 fn drop(&mut self) {
1702 if self.is_owned && !<*mut nativeUpdateFailHTLC>::is_null(self.inner) {
1703 let _ = unsafe { Box::from_raw(self.inner) };
1707 /// Frees any resources used by the UpdateFailHTLC, if is_owned is set and inner is non-NULL.
1709 pub extern "C" fn UpdateFailHTLC_free(this_obj: UpdateFailHTLC) { }
1711 /// Used only if an object of this type is returned as a trait impl by a method
1712 extern "C" fn UpdateFailHTLC_free_void(this_ptr: *mut c_void) {
1713 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeUpdateFailHTLC); }
1716 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
1717 impl UpdateFailHTLC {
1718 pub(crate) fn take_inner(mut self) -> *mut nativeUpdateFailHTLC {
1719 assert!(self.is_owned);
1720 let ret = self.inner;
1721 self.inner = std::ptr::null_mut();
1727 pub extern "C" fn UpdateFailHTLC_get_channel_id(this_ptr: &UpdateFailHTLC) -> *const [u8; 32] {
1728 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_id;
1733 pub extern "C" fn UpdateFailHTLC_set_channel_id(this_ptr: &mut UpdateFailHTLC, mut val: crate::c_types::ThirtyTwoBytes) {
1734 unsafe { &mut *this_ptr.inner }.channel_id = val.data;
1738 pub extern "C" fn UpdateFailHTLC_get_htlc_id(this_ptr: &UpdateFailHTLC) -> u64 {
1739 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.htlc_id;
1744 pub extern "C" fn UpdateFailHTLC_set_htlc_id(this_ptr: &mut UpdateFailHTLC, mut val: u64) {
1745 unsafe { &mut *this_ptr.inner }.htlc_id = val;
1747 impl Clone for UpdateFailHTLC {
1748 fn clone(&self) -> Self {
1750 inner: if <*mut nativeUpdateFailHTLC>::is_null(self.inner) { std::ptr::null_mut() } else {
1751 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
1757 /// Used only if an object of this type is returned as a trait impl by a method
1758 pub(crate) extern "C" fn UpdateFailHTLC_clone_void(this_ptr: *const c_void) -> *mut c_void {
1759 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeUpdateFailHTLC)).clone() })) as *mut c_void
1762 /// Creates a copy of the UpdateFailHTLC
1763 pub extern "C" fn UpdateFailHTLC_clone(orig: &UpdateFailHTLC) -> UpdateFailHTLC {
1767 use lightning::ln::msgs::UpdateFailMalformedHTLC as nativeUpdateFailMalformedHTLCImport;
1768 type nativeUpdateFailMalformedHTLC = nativeUpdateFailMalformedHTLCImport;
1770 /// An update_fail_malformed_htlc message to be sent or received from a peer
1773 pub struct UpdateFailMalformedHTLC {
1774 /// A pointer to the opaque Rust object.
1776 /// Nearly everywhere, inner must be non-null, however in places where
1777 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
1778 pub inner: *mut nativeUpdateFailMalformedHTLC,
1779 /// Indicates that this is the only struct which contains the same pointer.
1781 /// Rust functions which take ownership of an object provided via an argument require
1782 /// this to be true and invalidate the object pointed to by inner.
1786 impl Drop for UpdateFailMalformedHTLC {
1787 fn drop(&mut self) {
1788 if self.is_owned && !<*mut nativeUpdateFailMalformedHTLC>::is_null(self.inner) {
1789 let _ = unsafe { Box::from_raw(self.inner) };
1793 /// Frees any resources used by the UpdateFailMalformedHTLC, if is_owned is set and inner is non-NULL.
1795 pub extern "C" fn UpdateFailMalformedHTLC_free(this_obj: UpdateFailMalformedHTLC) { }
1797 /// Used only if an object of this type is returned as a trait impl by a method
1798 extern "C" fn UpdateFailMalformedHTLC_free_void(this_ptr: *mut c_void) {
1799 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeUpdateFailMalformedHTLC); }
1802 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
1803 impl UpdateFailMalformedHTLC {
1804 pub(crate) fn take_inner(mut self) -> *mut nativeUpdateFailMalformedHTLC {
1805 assert!(self.is_owned);
1806 let ret = self.inner;
1807 self.inner = std::ptr::null_mut();
1813 pub extern "C" fn UpdateFailMalformedHTLC_get_channel_id(this_ptr: &UpdateFailMalformedHTLC) -> *const [u8; 32] {
1814 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_id;
1819 pub extern "C" fn UpdateFailMalformedHTLC_set_channel_id(this_ptr: &mut UpdateFailMalformedHTLC, mut val: crate::c_types::ThirtyTwoBytes) {
1820 unsafe { &mut *this_ptr.inner }.channel_id = val.data;
1824 pub extern "C" fn UpdateFailMalformedHTLC_get_htlc_id(this_ptr: &UpdateFailMalformedHTLC) -> u64 {
1825 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.htlc_id;
1830 pub extern "C" fn UpdateFailMalformedHTLC_set_htlc_id(this_ptr: &mut UpdateFailMalformedHTLC, mut val: u64) {
1831 unsafe { &mut *this_ptr.inner }.htlc_id = val;
1833 /// The failure code
1835 pub extern "C" fn UpdateFailMalformedHTLC_get_failure_code(this_ptr: &UpdateFailMalformedHTLC) -> u16 {
1836 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.failure_code;
1839 /// The failure code
1841 pub extern "C" fn UpdateFailMalformedHTLC_set_failure_code(this_ptr: &mut UpdateFailMalformedHTLC, mut val: u16) {
1842 unsafe { &mut *this_ptr.inner }.failure_code = val;
1844 impl Clone for UpdateFailMalformedHTLC {
1845 fn clone(&self) -> Self {
1847 inner: if <*mut nativeUpdateFailMalformedHTLC>::is_null(self.inner) { std::ptr::null_mut() } else {
1848 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
1854 /// Used only if an object of this type is returned as a trait impl by a method
1855 pub(crate) extern "C" fn UpdateFailMalformedHTLC_clone_void(this_ptr: *const c_void) -> *mut c_void {
1856 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeUpdateFailMalformedHTLC)).clone() })) as *mut c_void
1859 /// Creates a copy of the UpdateFailMalformedHTLC
1860 pub extern "C" fn UpdateFailMalformedHTLC_clone(orig: &UpdateFailMalformedHTLC) -> UpdateFailMalformedHTLC {
1864 use lightning::ln::msgs::CommitmentSigned as nativeCommitmentSignedImport;
1865 type nativeCommitmentSigned = nativeCommitmentSignedImport;
1867 /// A commitment_signed message to be sent or received from a peer
1870 pub struct CommitmentSigned {
1871 /// A pointer to the opaque Rust object.
1873 /// Nearly everywhere, inner must be non-null, however in places where
1874 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
1875 pub inner: *mut nativeCommitmentSigned,
1876 /// Indicates that this is the only struct which contains the same pointer.
1878 /// Rust functions which take ownership of an object provided via an argument require
1879 /// this to be true and invalidate the object pointed to by inner.
1883 impl Drop for CommitmentSigned {
1884 fn drop(&mut self) {
1885 if self.is_owned && !<*mut nativeCommitmentSigned>::is_null(self.inner) {
1886 let _ = unsafe { Box::from_raw(self.inner) };
1890 /// Frees any resources used by the CommitmentSigned, if is_owned is set and inner is non-NULL.
1892 pub extern "C" fn CommitmentSigned_free(this_obj: CommitmentSigned) { }
1894 /// Used only if an object of this type is returned as a trait impl by a method
1895 extern "C" fn CommitmentSigned_free_void(this_ptr: *mut c_void) {
1896 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeCommitmentSigned); }
1899 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
1900 impl CommitmentSigned {
1901 pub(crate) fn take_inner(mut self) -> *mut nativeCommitmentSigned {
1902 assert!(self.is_owned);
1903 let ret = self.inner;
1904 self.inner = std::ptr::null_mut();
1910 pub extern "C" fn CommitmentSigned_get_channel_id(this_ptr: &CommitmentSigned) -> *const [u8; 32] {
1911 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_id;
1916 pub extern "C" fn CommitmentSigned_set_channel_id(this_ptr: &mut CommitmentSigned, mut val: crate::c_types::ThirtyTwoBytes) {
1917 unsafe { &mut *this_ptr.inner }.channel_id = val.data;
1919 /// A signature on the commitment transaction
1921 pub extern "C" fn CommitmentSigned_get_signature(this_ptr: &CommitmentSigned) -> crate::c_types::Signature {
1922 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.signature;
1923 crate::c_types::Signature::from_rust(&inner_val)
1925 /// A signature on the commitment transaction
1927 pub extern "C" fn CommitmentSigned_set_signature(this_ptr: &mut CommitmentSigned, mut val: crate::c_types::Signature) {
1928 unsafe { &mut *this_ptr.inner }.signature = val.into_rust();
1930 /// Signatures on the HTLC transactions
1932 pub extern "C" fn CommitmentSigned_set_htlc_signatures(this_ptr: &mut CommitmentSigned, mut val: crate::c_types::derived::CVec_SignatureZ) {
1933 let mut local_val = Vec::new(); for mut item in val.into_rust().drain(..) { local_val.push( { item.into_rust() }); };
1934 unsafe { &mut *this_ptr.inner }.htlc_signatures = local_val;
1936 /// Constructs a new CommitmentSigned given each field
1939 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 {
1940 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() }); };
1941 CommitmentSigned { inner: Box::into_raw(Box::new(nativeCommitmentSigned {
1942 channel_id: channel_id_arg.data,
1943 signature: signature_arg.into_rust(),
1944 htlc_signatures: local_htlc_signatures_arg,
1945 })), is_owned: true }
1947 impl Clone for CommitmentSigned {
1948 fn clone(&self) -> Self {
1950 inner: if <*mut nativeCommitmentSigned>::is_null(self.inner) { std::ptr::null_mut() } else {
1951 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
1957 /// Used only if an object of this type is returned as a trait impl by a method
1958 pub(crate) extern "C" fn CommitmentSigned_clone_void(this_ptr: *const c_void) -> *mut c_void {
1959 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeCommitmentSigned)).clone() })) as *mut c_void
1962 /// Creates a copy of the CommitmentSigned
1963 pub extern "C" fn CommitmentSigned_clone(orig: &CommitmentSigned) -> CommitmentSigned {
1967 use lightning::ln::msgs::RevokeAndACK as nativeRevokeAndACKImport;
1968 type nativeRevokeAndACK = nativeRevokeAndACKImport;
1970 /// A revoke_and_ack message to be sent or received from a peer
1973 pub struct RevokeAndACK {
1974 /// A pointer to the opaque Rust object.
1976 /// Nearly everywhere, inner must be non-null, however in places where
1977 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
1978 pub inner: *mut nativeRevokeAndACK,
1979 /// Indicates that this is the only struct which contains the same pointer.
1981 /// Rust functions which take ownership of an object provided via an argument require
1982 /// this to be true and invalidate the object pointed to by inner.
1986 impl Drop for RevokeAndACK {
1987 fn drop(&mut self) {
1988 if self.is_owned && !<*mut nativeRevokeAndACK>::is_null(self.inner) {
1989 let _ = unsafe { Box::from_raw(self.inner) };
1993 /// Frees any resources used by the RevokeAndACK, if is_owned is set and inner is non-NULL.
1995 pub extern "C" fn RevokeAndACK_free(this_obj: RevokeAndACK) { }
1997 /// Used only if an object of this type is returned as a trait impl by a method
1998 extern "C" fn RevokeAndACK_free_void(this_ptr: *mut c_void) {
1999 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeRevokeAndACK); }
2002 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
2004 pub(crate) fn take_inner(mut self) -> *mut nativeRevokeAndACK {
2005 assert!(self.is_owned);
2006 let ret = self.inner;
2007 self.inner = std::ptr::null_mut();
2013 pub extern "C" fn RevokeAndACK_get_channel_id(this_ptr: &RevokeAndACK) -> *const [u8; 32] {
2014 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_id;
2019 pub extern "C" fn RevokeAndACK_set_channel_id(this_ptr: &mut RevokeAndACK, mut val: crate::c_types::ThirtyTwoBytes) {
2020 unsafe { &mut *this_ptr.inner }.channel_id = val.data;
2022 /// The secret corresponding to the per-commitment point
2024 pub extern "C" fn RevokeAndACK_get_per_commitment_secret(this_ptr: &RevokeAndACK) -> *const [u8; 32] {
2025 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.per_commitment_secret;
2028 /// The secret corresponding to the per-commitment point
2030 pub extern "C" fn RevokeAndACK_set_per_commitment_secret(this_ptr: &mut RevokeAndACK, mut val: crate::c_types::ThirtyTwoBytes) {
2031 unsafe { &mut *this_ptr.inner }.per_commitment_secret = val.data;
2033 /// The next sender-broadcast commitment transaction's per-commitment point
2035 pub extern "C" fn RevokeAndACK_get_next_per_commitment_point(this_ptr: &RevokeAndACK) -> crate::c_types::PublicKey {
2036 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.next_per_commitment_point;
2037 crate::c_types::PublicKey::from_rust(&inner_val)
2039 /// The next sender-broadcast commitment transaction's per-commitment point
2041 pub extern "C" fn RevokeAndACK_set_next_per_commitment_point(this_ptr: &mut RevokeAndACK, mut val: crate::c_types::PublicKey) {
2042 unsafe { &mut *this_ptr.inner }.next_per_commitment_point = val.into_rust();
2044 /// Constructs a new RevokeAndACK given each field
2047 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 {
2048 RevokeAndACK { inner: Box::into_raw(Box::new(nativeRevokeAndACK {
2049 channel_id: channel_id_arg.data,
2050 per_commitment_secret: per_commitment_secret_arg.data,
2051 next_per_commitment_point: next_per_commitment_point_arg.into_rust(),
2052 })), is_owned: true }
2054 impl Clone for RevokeAndACK {
2055 fn clone(&self) -> Self {
2057 inner: if <*mut nativeRevokeAndACK>::is_null(self.inner) { std::ptr::null_mut() } else {
2058 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
2064 /// Used only if an object of this type is returned as a trait impl by a method
2065 pub(crate) extern "C" fn RevokeAndACK_clone_void(this_ptr: *const c_void) -> *mut c_void {
2066 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeRevokeAndACK)).clone() })) as *mut c_void
2069 /// Creates a copy of the RevokeAndACK
2070 pub extern "C" fn RevokeAndACK_clone(orig: &RevokeAndACK) -> RevokeAndACK {
2074 use lightning::ln::msgs::UpdateFee as nativeUpdateFeeImport;
2075 type nativeUpdateFee = nativeUpdateFeeImport;
2077 /// An update_fee message to be sent or received from a peer
2080 pub struct UpdateFee {
2081 /// A pointer to the opaque Rust object.
2083 /// Nearly everywhere, inner must be non-null, however in places where
2084 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
2085 pub inner: *mut nativeUpdateFee,
2086 /// Indicates that this is the only struct which contains the same pointer.
2088 /// Rust functions which take ownership of an object provided via an argument require
2089 /// this to be true and invalidate the object pointed to by inner.
2093 impl Drop for UpdateFee {
2094 fn drop(&mut self) {
2095 if self.is_owned && !<*mut nativeUpdateFee>::is_null(self.inner) {
2096 let _ = unsafe { Box::from_raw(self.inner) };
2100 /// Frees any resources used by the UpdateFee, if is_owned is set and inner is non-NULL.
2102 pub extern "C" fn UpdateFee_free(this_obj: UpdateFee) { }
2104 /// Used only if an object of this type is returned as a trait impl by a method
2105 extern "C" fn UpdateFee_free_void(this_ptr: *mut c_void) {
2106 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeUpdateFee); }
2109 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
2111 pub(crate) fn take_inner(mut self) -> *mut nativeUpdateFee {
2112 assert!(self.is_owned);
2113 let ret = self.inner;
2114 self.inner = std::ptr::null_mut();
2120 pub extern "C" fn UpdateFee_get_channel_id(this_ptr: &UpdateFee) -> *const [u8; 32] {
2121 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_id;
2126 pub extern "C" fn UpdateFee_set_channel_id(this_ptr: &mut UpdateFee, mut val: crate::c_types::ThirtyTwoBytes) {
2127 unsafe { &mut *this_ptr.inner }.channel_id = val.data;
2129 /// Fee rate per 1000-weight of the transaction
2131 pub extern "C" fn UpdateFee_get_feerate_per_kw(this_ptr: &UpdateFee) -> u32 {
2132 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.feerate_per_kw;
2135 /// Fee rate per 1000-weight of the transaction
2137 pub extern "C" fn UpdateFee_set_feerate_per_kw(this_ptr: &mut UpdateFee, mut val: u32) {
2138 unsafe { &mut *this_ptr.inner }.feerate_per_kw = val;
2140 /// Constructs a new UpdateFee given each field
2143 pub extern "C" fn UpdateFee_new(mut channel_id_arg: crate::c_types::ThirtyTwoBytes, mut feerate_per_kw_arg: u32) -> UpdateFee {
2144 UpdateFee { inner: Box::into_raw(Box::new(nativeUpdateFee {
2145 channel_id: channel_id_arg.data,
2146 feerate_per_kw: feerate_per_kw_arg,
2147 })), is_owned: true }
2149 impl Clone for UpdateFee {
2150 fn clone(&self) -> Self {
2152 inner: if <*mut nativeUpdateFee>::is_null(self.inner) { std::ptr::null_mut() } else {
2153 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
2159 /// Used only if an object of this type is returned as a trait impl by a method
2160 pub(crate) extern "C" fn UpdateFee_clone_void(this_ptr: *const c_void) -> *mut c_void {
2161 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeUpdateFee)).clone() })) as *mut c_void
2164 /// Creates a copy of the UpdateFee
2165 pub extern "C" fn UpdateFee_clone(orig: &UpdateFee) -> UpdateFee {
2169 use lightning::ln::msgs::DataLossProtect as nativeDataLossProtectImport;
2170 type nativeDataLossProtect = nativeDataLossProtectImport;
2172 /// Proof that the sender knows the per-commitment secret of the previous commitment transaction.
2173 /// This is used to convince the recipient that the channel is at a certain commitment
2174 /// number even if they lost that data due to a local failure. Of course, the peer may lie
2175 /// and even later commitments may have been revoked.
2178 pub struct DataLossProtect {
2179 /// A pointer to the opaque Rust object.
2181 /// Nearly everywhere, inner must be non-null, however in places where
2182 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
2183 pub inner: *mut nativeDataLossProtect,
2184 /// Indicates that this is the only struct which contains the same pointer.
2186 /// Rust functions which take ownership of an object provided via an argument require
2187 /// this to be true and invalidate the object pointed to by inner.
2191 impl Drop for DataLossProtect {
2192 fn drop(&mut self) {
2193 if self.is_owned && !<*mut nativeDataLossProtect>::is_null(self.inner) {
2194 let _ = unsafe { Box::from_raw(self.inner) };
2198 /// Frees any resources used by the DataLossProtect, if is_owned is set and inner is non-NULL.
2200 pub extern "C" fn DataLossProtect_free(this_obj: DataLossProtect) { }
2202 /// Used only if an object of this type is returned as a trait impl by a method
2203 extern "C" fn DataLossProtect_free_void(this_ptr: *mut c_void) {
2204 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeDataLossProtect); }
2207 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
2208 impl DataLossProtect {
2209 pub(crate) fn take_inner(mut self) -> *mut nativeDataLossProtect {
2210 assert!(self.is_owned);
2211 let ret = self.inner;
2212 self.inner = std::ptr::null_mut();
2216 /// Proof that the sender knows the per-commitment secret of a specific commitment transaction
2217 /// belonging to the recipient
2219 pub extern "C" fn DataLossProtect_get_your_last_per_commitment_secret(this_ptr: &DataLossProtect) -> *const [u8; 32] {
2220 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.your_last_per_commitment_secret;
2223 /// Proof that the sender knows the per-commitment secret of a specific commitment transaction
2224 /// belonging to the recipient
2226 pub extern "C" fn DataLossProtect_set_your_last_per_commitment_secret(this_ptr: &mut DataLossProtect, mut val: crate::c_types::ThirtyTwoBytes) {
2227 unsafe { &mut *this_ptr.inner }.your_last_per_commitment_secret = val.data;
2229 /// The sender's per-commitment point for their current commitment transaction
2231 pub extern "C" fn DataLossProtect_get_my_current_per_commitment_point(this_ptr: &DataLossProtect) -> crate::c_types::PublicKey {
2232 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.my_current_per_commitment_point;
2233 crate::c_types::PublicKey::from_rust(&inner_val)
2235 /// The sender's per-commitment point for their current commitment transaction
2237 pub extern "C" fn DataLossProtect_set_my_current_per_commitment_point(this_ptr: &mut DataLossProtect, mut val: crate::c_types::PublicKey) {
2238 unsafe { &mut *this_ptr.inner }.my_current_per_commitment_point = val.into_rust();
2240 /// Constructs a new DataLossProtect given each field
2243 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 {
2244 DataLossProtect { inner: Box::into_raw(Box::new(nativeDataLossProtect {
2245 your_last_per_commitment_secret: your_last_per_commitment_secret_arg.data,
2246 my_current_per_commitment_point: my_current_per_commitment_point_arg.into_rust(),
2247 })), is_owned: true }
2249 impl Clone for DataLossProtect {
2250 fn clone(&self) -> Self {
2252 inner: if <*mut nativeDataLossProtect>::is_null(self.inner) { std::ptr::null_mut() } else {
2253 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
2259 /// Used only if an object of this type is returned as a trait impl by a method
2260 pub(crate) extern "C" fn DataLossProtect_clone_void(this_ptr: *const c_void) -> *mut c_void {
2261 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeDataLossProtect)).clone() })) as *mut c_void
2264 /// Creates a copy of the DataLossProtect
2265 pub extern "C" fn DataLossProtect_clone(orig: &DataLossProtect) -> DataLossProtect {
2269 use lightning::ln::msgs::ChannelReestablish as nativeChannelReestablishImport;
2270 type nativeChannelReestablish = nativeChannelReestablishImport;
2272 /// A channel_reestablish message to be sent or received from a peer
2275 pub struct ChannelReestablish {
2276 /// A pointer to the opaque Rust object.
2278 /// Nearly everywhere, inner must be non-null, however in places where
2279 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
2280 pub inner: *mut nativeChannelReestablish,
2281 /// Indicates that this is the only struct which contains the same pointer.
2283 /// Rust functions which take ownership of an object provided via an argument require
2284 /// this to be true and invalidate the object pointed to by inner.
2288 impl Drop for ChannelReestablish {
2289 fn drop(&mut self) {
2290 if self.is_owned && !<*mut nativeChannelReestablish>::is_null(self.inner) {
2291 let _ = unsafe { Box::from_raw(self.inner) };
2295 /// Frees any resources used by the ChannelReestablish, if is_owned is set and inner is non-NULL.
2297 pub extern "C" fn ChannelReestablish_free(this_obj: ChannelReestablish) { }
2299 /// Used only if an object of this type is returned as a trait impl by a method
2300 extern "C" fn ChannelReestablish_free_void(this_ptr: *mut c_void) {
2301 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeChannelReestablish); }
2304 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
2305 impl ChannelReestablish {
2306 pub(crate) fn take_inner(mut self) -> *mut nativeChannelReestablish {
2307 assert!(self.is_owned);
2308 let ret = self.inner;
2309 self.inner = std::ptr::null_mut();
2315 pub extern "C" fn ChannelReestablish_get_channel_id(this_ptr: &ChannelReestablish) -> *const [u8; 32] {
2316 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_id;
2321 pub extern "C" fn ChannelReestablish_set_channel_id(this_ptr: &mut ChannelReestablish, mut val: crate::c_types::ThirtyTwoBytes) {
2322 unsafe { &mut *this_ptr.inner }.channel_id = val.data;
2324 /// The next commitment number for the sender
2326 pub extern "C" fn ChannelReestablish_get_next_local_commitment_number(this_ptr: &ChannelReestablish) -> u64 {
2327 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.next_local_commitment_number;
2330 /// The next commitment number for the sender
2332 pub extern "C" fn ChannelReestablish_set_next_local_commitment_number(this_ptr: &mut ChannelReestablish, mut val: u64) {
2333 unsafe { &mut *this_ptr.inner }.next_local_commitment_number = val;
2335 /// The next commitment number for the recipient
2337 pub extern "C" fn ChannelReestablish_get_next_remote_commitment_number(this_ptr: &ChannelReestablish) -> u64 {
2338 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.next_remote_commitment_number;
2341 /// The next commitment number for the recipient
2343 pub extern "C" fn ChannelReestablish_set_next_remote_commitment_number(this_ptr: &mut ChannelReestablish, mut val: u64) {
2344 unsafe { &mut *this_ptr.inner }.next_remote_commitment_number = val;
2346 impl Clone for ChannelReestablish {
2347 fn clone(&self) -> Self {
2349 inner: if <*mut nativeChannelReestablish>::is_null(self.inner) { std::ptr::null_mut() } else {
2350 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
2356 /// Used only if an object of this type is returned as a trait impl by a method
2357 pub(crate) extern "C" fn ChannelReestablish_clone_void(this_ptr: *const c_void) -> *mut c_void {
2358 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeChannelReestablish)).clone() })) as *mut c_void
2361 /// Creates a copy of the ChannelReestablish
2362 pub extern "C" fn ChannelReestablish_clone(orig: &ChannelReestablish) -> ChannelReestablish {
2366 use lightning::ln::msgs::AnnouncementSignatures as nativeAnnouncementSignaturesImport;
2367 type nativeAnnouncementSignatures = nativeAnnouncementSignaturesImport;
2369 /// An announcement_signatures message to be sent or received from a peer
2372 pub struct AnnouncementSignatures {
2373 /// A pointer to the opaque Rust object.
2375 /// Nearly everywhere, inner must be non-null, however in places where
2376 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
2377 pub inner: *mut nativeAnnouncementSignatures,
2378 /// Indicates that this is the only struct which contains the same pointer.
2380 /// Rust functions which take ownership of an object provided via an argument require
2381 /// this to be true and invalidate the object pointed to by inner.
2385 impl Drop for AnnouncementSignatures {
2386 fn drop(&mut self) {
2387 if self.is_owned && !<*mut nativeAnnouncementSignatures>::is_null(self.inner) {
2388 let _ = unsafe { Box::from_raw(self.inner) };
2392 /// Frees any resources used by the AnnouncementSignatures, if is_owned is set and inner is non-NULL.
2394 pub extern "C" fn AnnouncementSignatures_free(this_obj: AnnouncementSignatures) { }
2396 /// Used only if an object of this type is returned as a trait impl by a method
2397 extern "C" fn AnnouncementSignatures_free_void(this_ptr: *mut c_void) {
2398 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeAnnouncementSignatures); }
2401 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
2402 impl AnnouncementSignatures {
2403 pub(crate) fn take_inner(mut self) -> *mut nativeAnnouncementSignatures {
2404 assert!(self.is_owned);
2405 let ret = self.inner;
2406 self.inner = std::ptr::null_mut();
2412 pub extern "C" fn AnnouncementSignatures_get_channel_id(this_ptr: &AnnouncementSignatures) -> *const [u8; 32] {
2413 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_id;
2418 pub extern "C" fn AnnouncementSignatures_set_channel_id(this_ptr: &mut AnnouncementSignatures, mut val: crate::c_types::ThirtyTwoBytes) {
2419 unsafe { &mut *this_ptr.inner }.channel_id = val.data;
2421 /// The short channel ID
2423 pub extern "C" fn AnnouncementSignatures_get_short_channel_id(this_ptr: &AnnouncementSignatures) -> u64 {
2424 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.short_channel_id;
2427 /// The short channel ID
2429 pub extern "C" fn AnnouncementSignatures_set_short_channel_id(this_ptr: &mut AnnouncementSignatures, mut val: u64) {
2430 unsafe { &mut *this_ptr.inner }.short_channel_id = val;
2432 /// A signature by the node key
2434 pub extern "C" fn AnnouncementSignatures_get_node_signature(this_ptr: &AnnouncementSignatures) -> crate::c_types::Signature {
2435 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.node_signature;
2436 crate::c_types::Signature::from_rust(&inner_val)
2438 /// A signature by the node key
2440 pub extern "C" fn AnnouncementSignatures_set_node_signature(this_ptr: &mut AnnouncementSignatures, mut val: crate::c_types::Signature) {
2441 unsafe { &mut *this_ptr.inner }.node_signature = val.into_rust();
2443 /// A signature by the funding key
2445 pub extern "C" fn AnnouncementSignatures_get_bitcoin_signature(this_ptr: &AnnouncementSignatures) -> crate::c_types::Signature {
2446 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.bitcoin_signature;
2447 crate::c_types::Signature::from_rust(&inner_val)
2449 /// A signature by the funding key
2451 pub extern "C" fn AnnouncementSignatures_set_bitcoin_signature(this_ptr: &mut AnnouncementSignatures, mut val: crate::c_types::Signature) {
2452 unsafe { &mut *this_ptr.inner }.bitcoin_signature = val.into_rust();
2454 /// Constructs a new AnnouncementSignatures given each field
2457 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 {
2458 AnnouncementSignatures { inner: Box::into_raw(Box::new(nativeAnnouncementSignatures {
2459 channel_id: channel_id_arg.data,
2460 short_channel_id: short_channel_id_arg,
2461 node_signature: node_signature_arg.into_rust(),
2462 bitcoin_signature: bitcoin_signature_arg.into_rust(),
2463 })), is_owned: true }
2465 impl Clone for AnnouncementSignatures {
2466 fn clone(&self) -> Self {
2468 inner: if <*mut nativeAnnouncementSignatures>::is_null(self.inner) { std::ptr::null_mut() } else {
2469 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
2475 /// Used only if an object of this type is returned as a trait impl by a method
2476 pub(crate) extern "C" fn AnnouncementSignatures_clone_void(this_ptr: *const c_void) -> *mut c_void {
2477 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeAnnouncementSignatures)).clone() })) as *mut c_void
2480 /// Creates a copy of the AnnouncementSignatures
2481 pub extern "C" fn AnnouncementSignatures_clone(orig: &AnnouncementSignatures) -> AnnouncementSignatures {
2484 /// An address which can be used to connect to a remote peer
2488 pub enum NetAddress {
2489 /// An IPv4 address/port on which the peer is listening.
2491 /// The 4-byte IPv4 address
2492 addr: crate::c_types::FourBytes,
2493 /// The port on which the node is listening
2496 /// An IPv6 address/port on which the peer is listening.
2498 /// The 16-byte IPv6 address
2499 addr: crate::c_types::SixteenBytes,
2500 /// The port on which the node is listening
2503 /// An old-style Tor onion address/port on which the peer is listening.
2505 /// The bytes (usually encoded in base32 with \".onion\" appended)
2506 addr: crate::c_types::TenBytes,
2507 /// The port on which the node is listening
2510 /// A new-style Tor onion address/port on which the peer is listening.
2511 /// To create the human-readable \"hostname\", concatenate ed25519_pubkey, checksum, and version,
2512 /// wrap as base32 and append \".onion\".
2514 /// The ed25519 long-term public key of the peer
2515 ed25519_pubkey: crate::c_types::ThirtyTwoBytes,
2516 /// The checksum of the pubkey and version, as included in the onion address
2518 /// The version byte, as defined by the Tor Onion v3 spec.
2520 /// The port on which the node is listening
2524 use lightning::ln::msgs::NetAddress as nativeNetAddress;
2527 pub(crate) fn to_native(&self) -> nativeNetAddress {
2529 NetAddress::IPv4 {ref addr, ref port, } => {
2530 let mut addr_nonref = (*addr).clone();
2531 let mut port_nonref = (*port).clone();
2532 nativeNetAddress::IPv4 {
2533 addr: addr_nonref.data,
2537 NetAddress::IPv6 {ref addr, ref port, } => {
2538 let mut addr_nonref = (*addr).clone();
2539 let mut port_nonref = (*port).clone();
2540 nativeNetAddress::IPv6 {
2541 addr: addr_nonref.data,
2545 NetAddress::OnionV2 {ref addr, ref port, } => {
2546 let mut addr_nonref = (*addr).clone();
2547 let mut port_nonref = (*port).clone();
2548 nativeNetAddress::OnionV2 {
2549 addr: addr_nonref.data,
2553 NetAddress::OnionV3 {ref ed25519_pubkey, ref checksum, ref version, ref port, } => {
2554 let mut ed25519_pubkey_nonref = (*ed25519_pubkey).clone();
2555 let mut checksum_nonref = (*checksum).clone();
2556 let mut version_nonref = (*version).clone();
2557 let mut port_nonref = (*port).clone();
2558 nativeNetAddress::OnionV3 {
2559 ed25519_pubkey: ed25519_pubkey_nonref.data,
2560 checksum: checksum_nonref,
2561 version: version_nonref,
2568 pub(crate) fn into_native(self) -> nativeNetAddress {
2570 NetAddress::IPv4 {mut addr, mut port, } => {
2571 nativeNetAddress::IPv4 {
2576 NetAddress::IPv6 {mut addr, mut port, } => {
2577 nativeNetAddress::IPv6 {
2582 NetAddress::OnionV2 {mut addr, mut port, } => {
2583 nativeNetAddress::OnionV2 {
2588 NetAddress::OnionV3 {mut ed25519_pubkey, mut checksum, mut version, mut port, } => {
2589 nativeNetAddress::OnionV3 {
2590 ed25519_pubkey: ed25519_pubkey.data,
2599 pub(crate) fn from_native(native: &nativeNetAddress) -> Self {
2601 nativeNetAddress::IPv4 {ref addr, ref port, } => {
2602 let mut addr_nonref = (*addr).clone();
2603 let mut port_nonref = (*port).clone();
2605 addr: crate::c_types::FourBytes { data: addr_nonref },
2609 nativeNetAddress::IPv6 {ref addr, ref port, } => {
2610 let mut addr_nonref = (*addr).clone();
2611 let mut port_nonref = (*port).clone();
2613 addr: crate::c_types::SixteenBytes { data: addr_nonref },
2617 nativeNetAddress::OnionV2 {ref addr, ref port, } => {
2618 let mut addr_nonref = (*addr).clone();
2619 let mut port_nonref = (*port).clone();
2620 NetAddress::OnionV2 {
2621 addr: crate::c_types::TenBytes { data: addr_nonref },
2625 nativeNetAddress::OnionV3 {ref ed25519_pubkey, ref checksum, ref version, ref port, } => {
2626 let mut ed25519_pubkey_nonref = (*ed25519_pubkey).clone();
2627 let mut checksum_nonref = (*checksum).clone();
2628 let mut version_nonref = (*version).clone();
2629 let mut port_nonref = (*port).clone();
2630 NetAddress::OnionV3 {
2631 ed25519_pubkey: crate::c_types::ThirtyTwoBytes { data: ed25519_pubkey_nonref },
2632 checksum: checksum_nonref,
2633 version: version_nonref,
2640 pub(crate) fn native_into(native: nativeNetAddress) -> Self {
2642 nativeNetAddress::IPv4 {mut addr, mut port, } => {
2644 addr: crate::c_types::FourBytes { data: addr },
2648 nativeNetAddress::IPv6 {mut addr, mut port, } => {
2650 addr: crate::c_types::SixteenBytes { data: addr },
2654 nativeNetAddress::OnionV2 {mut addr, mut port, } => {
2655 NetAddress::OnionV2 {
2656 addr: crate::c_types::TenBytes { data: addr },
2660 nativeNetAddress::OnionV3 {mut ed25519_pubkey, mut checksum, mut version, mut port, } => {
2661 NetAddress::OnionV3 {
2662 ed25519_pubkey: crate::c_types::ThirtyTwoBytes { data: ed25519_pubkey },
2671 /// Frees any resources used by the NetAddress
2673 pub extern "C" fn NetAddress_free(this_ptr: NetAddress) { }
2674 /// Creates a copy of the NetAddress
2676 pub extern "C" fn NetAddress_clone(orig: &NetAddress) -> NetAddress {
2680 /// Serialize the NetAddress object into a byte array which can be read by NetAddress_read
2681 pub extern "C" fn NetAddress_write(obj: &NetAddress) -> crate::c_types::derived::CVec_u8Z {
2682 crate::c_types::serialize_obj(&unsafe { &*obj }.to_native())
2685 /// Read a Result from a byte array, created by Result_write
2686 pub extern "C" fn Result_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_CResult_NetAddressu8ZDecodeErrorZ {
2687 let res = crate::c_types::deserialize_obj(ser);
2688 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() };
2692 /// Read a NetAddress from a byte array, created by NetAddress_write
2693 pub extern "C" fn NetAddress_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_NetAddressDecodeErrorZ {
2694 let res = crate::c_types::deserialize_obj(ser);
2695 let mut local_res = match res { 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( { crate::lightning::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
2699 use lightning::ln::msgs::UnsignedNodeAnnouncement as nativeUnsignedNodeAnnouncementImport;
2700 type nativeUnsignedNodeAnnouncement = nativeUnsignedNodeAnnouncementImport;
2702 /// The unsigned part of a node_announcement
2705 pub struct UnsignedNodeAnnouncement {
2706 /// A pointer to the opaque Rust object.
2708 /// Nearly everywhere, inner must be non-null, however in places where
2709 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
2710 pub inner: *mut nativeUnsignedNodeAnnouncement,
2711 /// Indicates that this is the only struct which contains the same pointer.
2713 /// Rust functions which take ownership of an object provided via an argument require
2714 /// this to be true and invalidate the object pointed to by inner.
2718 impl Drop for UnsignedNodeAnnouncement {
2719 fn drop(&mut self) {
2720 if self.is_owned && !<*mut nativeUnsignedNodeAnnouncement>::is_null(self.inner) {
2721 let _ = unsafe { Box::from_raw(self.inner) };
2725 /// Frees any resources used by the UnsignedNodeAnnouncement, if is_owned is set and inner is non-NULL.
2727 pub extern "C" fn UnsignedNodeAnnouncement_free(this_obj: UnsignedNodeAnnouncement) { }
2729 /// Used only if an object of this type is returned as a trait impl by a method
2730 extern "C" fn UnsignedNodeAnnouncement_free_void(this_ptr: *mut c_void) {
2731 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeUnsignedNodeAnnouncement); }
2734 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
2735 impl UnsignedNodeAnnouncement {
2736 pub(crate) fn take_inner(mut self) -> *mut nativeUnsignedNodeAnnouncement {
2737 assert!(self.is_owned);
2738 let ret = self.inner;
2739 self.inner = std::ptr::null_mut();
2743 /// The advertised features
2745 pub extern "C" fn UnsignedNodeAnnouncement_get_features(this_ptr: &UnsignedNodeAnnouncement) -> crate::lightning::ln::features::NodeFeatures {
2746 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.features;
2747 crate::lightning::ln::features::NodeFeatures { inner: unsafe { ( (&(*inner_val) as *const _) as *mut _) }, is_owned: false }
2749 /// The advertised features
2751 pub extern "C" fn UnsignedNodeAnnouncement_set_features(this_ptr: &mut UnsignedNodeAnnouncement, mut val: crate::lightning::ln::features::NodeFeatures) {
2752 unsafe { &mut *this_ptr.inner }.features = *unsafe { Box::from_raw(val.take_inner()) };
2754 /// A strictly monotonic announcement counter, with gaps allowed
2756 pub extern "C" fn UnsignedNodeAnnouncement_get_timestamp(this_ptr: &UnsignedNodeAnnouncement) -> u32 {
2757 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.timestamp;
2760 /// A strictly monotonic announcement counter, with gaps allowed
2762 pub extern "C" fn UnsignedNodeAnnouncement_set_timestamp(this_ptr: &mut UnsignedNodeAnnouncement, mut val: u32) {
2763 unsafe { &mut *this_ptr.inner }.timestamp = val;
2765 /// The node_id this announcement originated from (don't rebroadcast the node_announcement back
2768 pub extern "C" fn UnsignedNodeAnnouncement_get_node_id(this_ptr: &UnsignedNodeAnnouncement) -> crate::c_types::PublicKey {
2769 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.node_id;
2770 crate::c_types::PublicKey::from_rust(&inner_val)
2772 /// The node_id this announcement originated from (don't rebroadcast the node_announcement back
2775 pub extern "C" fn UnsignedNodeAnnouncement_set_node_id(this_ptr: &mut UnsignedNodeAnnouncement, mut val: crate::c_types::PublicKey) {
2776 unsafe { &mut *this_ptr.inner }.node_id = val.into_rust();
2778 /// An RGB color for UI purposes
2780 pub extern "C" fn UnsignedNodeAnnouncement_get_rgb(this_ptr: &UnsignedNodeAnnouncement) -> *const [u8; 3] {
2781 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.rgb;
2784 /// An RGB color for UI purposes
2786 pub extern "C" fn UnsignedNodeAnnouncement_set_rgb(this_ptr: &mut UnsignedNodeAnnouncement, mut val: crate::c_types::ThreeBytes) {
2787 unsafe { &mut *this_ptr.inner }.rgb = val.data;
2789 /// An alias, for UI purposes. This should be sanitized before use. There is no guarantee
2792 pub extern "C" fn UnsignedNodeAnnouncement_get_alias(this_ptr: &UnsignedNodeAnnouncement) -> *const [u8; 32] {
2793 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.alias;
2796 /// An alias, for UI purposes. This should be sanitized before use. There is no guarantee
2799 pub extern "C" fn UnsignedNodeAnnouncement_set_alias(this_ptr: &mut UnsignedNodeAnnouncement, mut val: crate::c_types::ThirtyTwoBytes) {
2800 unsafe { &mut *this_ptr.inner }.alias = val.data;
2802 /// List of addresses on which this node is reachable
2804 pub extern "C" fn UnsignedNodeAnnouncement_set_addresses(this_ptr: &mut UnsignedNodeAnnouncement, mut val: crate::c_types::derived::CVec_NetAddressZ) {
2805 let mut local_val = Vec::new(); for mut item in val.into_rust().drain(..) { local_val.push( { item.into_native() }); };
2806 unsafe { &mut *this_ptr.inner }.addresses = local_val;
2808 impl Clone for UnsignedNodeAnnouncement {
2809 fn clone(&self) -> Self {
2811 inner: if <*mut nativeUnsignedNodeAnnouncement>::is_null(self.inner) { std::ptr::null_mut() } else {
2812 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
2818 /// Used only if an object of this type is returned as a trait impl by a method
2819 pub(crate) extern "C" fn UnsignedNodeAnnouncement_clone_void(this_ptr: *const c_void) -> *mut c_void {
2820 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeUnsignedNodeAnnouncement)).clone() })) as *mut c_void
2823 /// Creates a copy of the UnsignedNodeAnnouncement
2824 pub extern "C" fn UnsignedNodeAnnouncement_clone(orig: &UnsignedNodeAnnouncement) -> UnsignedNodeAnnouncement {
2828 use lightning::ln::msgs::NodeAnnouncement as nativeNodeAnnouncementImport;
2829 type nativeNodeAnnouncement = nativeNodeAnnouncementImport;
2831 /// A node_announcement message to be sent or received from a peer
2834 pub struct NodeAnnouncement {
2835 /// A pointer to the opaque Rust object.
2837 /// Nearly everywhere, inner must be non-null, however in places where
2838 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
2839 pub inner: *mut nativeNodeAnnouncement,
2840 /// Indicates that this is the only struct which contains the same pointer.
2842 /// Rust functions which take ownership of an object provided via an argument require
2843 /// this to be true and invalidate the object pointed to by inner.
2847 impl Drop for NodeAnnouncement {
2848 fn drop(&mut self) {
2849 if self.is_owned && !<*mut nativeNodeAnnouncement>::is_null(self.inner) {
2850 let _ = unsafe { Box::from_raw(self.inner) };
2854 /// Frees any resources used by the NodeAnnouncement, if is_owned is set and inner is non-NULL.
2856 pub extern "C" fn NodeAnnouncement_free(this_obj: NodeAnnouncement) { }
2858 /// Used only if an object of this type is returned as a trait impl by a method
2859 extern "C" fn NodeAnnouncement_free_void(this_ptr: *mut c_void) {
2860 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeNodeAnnouncement); }
2863 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
2864 impl NodeAnnouncement {
2865 pub(crate) fn take_inner(mut self) -> *mut nativeNodeAnnouncement {
2866 assert!(self.is_owned);
2867 let ret = self.inner;
2868 self.inner = std::ptr::null_mut();
2872 /// The signature by the node key
2874 pub extern "C" fn NodeAnnouncement_get_signature(this_ptr: &NodeAnnouncement) -> crate::c_types::Signature {
2875 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.signature;
2876 crate::c_types::Signature::from_rust(&inner_val)
2878 /// The signature by the node key
2880 pub extern "C" fn NodeAnnouncement_set_signature(this_ptr: &mut NodeAnnouncement, mut val: crate::c_types::Signature) {
2881 unsafe { &mut *this_ptr.inner }.signature = val.into_rust();
2883 /// The actual content of the announcement
2885 pub extern "C" fn NodeAnnouncement_get_contents(this_ptr: &NodeAnnouncement) -> crate::lightning::ln::msgs::UnsignedNodeAnnouncement {
2886 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.contents;
2887 crate::lightning::ln::msgs::UnsignedNodeAnnouncement { inner: unsafe { ( (&(*inner_val) as *const _) as *mut _) }, is_owned: false }
2889 /// The actual content of the announcement
2891 pub extern "C" fn NodeAnnouncement_set_contents(this_ptr: &mut NodeAnnouncement, mut val: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) {
2892 unsafe { &mut *this_ptr.inner }.contents = *unsafe { Box::from_raw(val.take_inner()) };
2894 /// Constructs a new NodeAnnouncement given each field
2897 pub extern "C" fn NodeAnnouncement_new(mut signature_arg: crate::c_types::Signature, mut contents_arg: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> NodeAnnouncement {
2898 NodeAnnouncement { inner: Box::into_raw(Box::new(nativeNodeAnnouncement {
2899 signature: signature_arg.into_rust(),
2900 contents: *unsafe { Box::from_raw(contents_arg.take_inner()) },
2901 })), is_owned: true }
2903 impl Clone for NodeAnnouncement {
2904 fn clone(&self) -> Self {
2906 inner: if <*mut nativeNodeAnnouncement>::is_null(self.inner) { std::ptr::null_mut() } else {
2907 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
2913 /// Used only if an object of this type is returned as a trait impl by a method
2914 pub(crate) extern "C" fn NodeAnnouncement_clone_void(this_ptr: *const c_void) -> *mut c_void {
2915 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeNodeAnnouncement)).clone() })) as *mut c_void
2918 /// Creates a copy of the NodeAnnouncement
2919 pub extern "C" fn NodeAnnouncement_clone(orig: &NodeAnnouncement) -> NodeAnnouncement {
2923 use lightning::ln::msgs::UnsignedChannelAnnouncement as nativeUnsignedChannelAnnouncementImport;
2924 type nativeUnsignedChannelAnnouncement = nativeUnsignedChannelAnnouncementImport;
2926 /// The unsigned part of a channel_announcement
2929 pub struct UnsignedChannelAnnouncement {
2930 /// A pointer to the opaque Rust object.
2932 /// Nearly everywhere, inner must be non-null, however in places where
2933 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
2934 pub inner: *mut nativeUnsignedChannelAnnouncement,
2935 /// Indicates that this is the only struct which contains the same pointer.
2937 /// Rust functions which take ownership of an object provided via an argument require
2938 /// this to be true and invalidate the object pointed to by inner.
2942 impl Drop for UnsignedChannelAnnouncement {
2943 fn drop(&mut self) {
2944 if self.is_owned && !<*mut nativeUnsignedChannelAnnouncement>::is_null(self.inner) {
2945 let _ = unsafe { Box::from_raw(self.inner) };
2949 /// Frees any resources used by the UnsignedChannelAnnouncement, if is_owned is set and inner is non-NULL.
2951 pub extern "C" fn UnsignedChannelAnnouncement_free(this_obj: UnsignedChannelAnnouncement) { }
2953 /// Used only if an object of this type is returned as a trait impl by a method
2954 extern "C" fn UnsignedChannelAnnouncement_free_void(this_ptr: *mut c_void) {
2955 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeUnsignedChannelAnnouncement); }
2958 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
2959 impl UnsignedChannelAnnouncement {
2960 pub(crate) fn take_inner(mut self) -> *mut nativeUnsignedChannelAnnouncement {
2961 assert!(self.is_owned);
2962 let ret = self.inner;
2963 self.inner = std::ptr::null_mut();
2967 /// The advertised channel features
2969 pub extern "C" fn UnsignedChannelAnnouncement_get_features(this_ptr: &UnsignedChannelAnnouncement) -> crate::lightning::ln::features::ChannelFeatures {
2970 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.features;
2971 crate::lightning::ln::features::ChannelFeatures { inner: unsafe { ( (&(*inner_val) as *const _) as *mut _) }, is_owned: false }
2973 /// The advertised channel features
2975 pub extern "C" fn UnsignedChannelAnnouncement_set_features(this_ptr: &mut UnsignedChannelAnnouncement, mut val: crate::lightning::ln::features::ChannelFeatures) {
2976 unsafe { &mut *this_ptr.inner }.features = *unsafe { Box::from_raw(val.take_inner()) };
2978 /// The genesis hash of the blockchain where the channel is to be opened
2980 pub extern "C" fn UnsignedChannelAnnouncement_get_chain_hash(this_ptr: &UnsignedChannelAnnouncement) -> *const [u8; 32] {
2981 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.chain_hash;
2982 inner_val.as_inner()
2984 /// The genesis hash of the blockchain where the channel is to be opened
2986 pub extern "C" fn UnsignedChannelAnnouncement_set_chain_hash(this_ptr: &mut UnsignedChannelAnnouncement, mut val: crate::c_types::ThirtyTwoBytes) {
2987 unsafe { &mut *this_ptr.inner }.chain_hash = ::bitcoin::hash_types::BlockHash::from_slice(&val.data[..]).unwrap();
2989 /// The short channel ID
2991 pub extern "C" fn UnsignedChannelAnnouncement_get_short_channel_id(this_ptr: &UnsignedChannelAnnouncement) -> u64 {
2992 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.short_channel_id;
2995 /// The short channel ID
2997 pub extern "C" fn UnsignedChannelAnnouncement_set_short_channel_id(this_ptr: &mut UnsignedChannelAnnouncement, mut val: u64) {
2998 unsafe { &mut *this_ptr.inner }.short_channel_id = val;
3000 /// One of the two node_ids which are endpoints of this channel
3002 pub extern "C" fn UnsignedChannelAnnouncement_get_node_id_1(this_ptr: &UnsignedChannelAnnouncement) -> crate::c_types::PublicKey {
3003 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.node_id_1;
3004 crate::c_types::PublicKey::from_rust(&inner_val)
3006 /// One of the two node_ids which are endpoints of this channel
3008 pub extern "C" fn UnsignedChannelAnnouncement_set_node_id_1(this_ptr: &mut UnsignedChannelAnnouncement, mut val: crate::c_types::PublicKey) {
3009 unsafe { &mut *this_ptr.inner }.node_id_1 = val.into_rust();
3011 /// The other of the two node_ids which are endpoints of this channel
3013 pub extern "C" fn UnsignedChannelAnnouncement_get_node_id_2(this_ptr: &UnsignedChannelAnnouncement) -> crate::c_types::PublicKey {
3014 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.node_id_2;
3015 crate::c_types::PublicKey::from_rust(&inner_val)
3017 /// The other of the two node_ids which are endpoints of this channel
3019 pub extern "C" fn UnsignedChannelAnnouncement_set_node_id_2(this_ptr: &mut UnsignedChannelAnnouncement, mut val: crate::c_types::PublicKey) {
3020 unsafe { &mut *this_ptr.inner }.node_id_2 = val.into_rust();
3022 /// The funding key for the first node
3024 pub extern "C" fn UnsignedChannelAnnouncement_get_bitcoin_key_1(this_ptr: &UnsignedChannelAnnouncement) -> crate::c_types::PublicKey {
3025 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.bitcoin_key_1;
3026 crate::c_types::PublicKey::from_rust(&inner_val)
3028 /// The funding key for the first node
3030 pub extern "C" fn UnsignedChannelAnnouncement_set_bitcoin_key_1(this_ptr: &mut UnsignedChannelAnnouncement, mut val: crate::c_types::PublicKey) {
3031 unsafe { &mut *this_ptr.inner }.bitcoin_key_1 = val.into_rust();
3033 /// The funding key for the second node
3035 pub extern "C" fn UnsignedChannelAnnouncement_get_bitcoin_key_2(this_ptr: &UnsignedChannelAnnouncement) -> crate::c_types::PublicKey {
3036 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.bitcoin_key_2;
3037 crate::c_types::PublicKey::from_rust(&inner_val)
3039 /// The funding key for the second node
3041 pub extern "C" fn UnsignedChannelAnnouncement_set_bitcoin_key_2(this_ptr: &mut UnsignedChannelAnnouncement, mut val: crate::c_types::PublicKey) {
3042 unsafe { &mut *this_ptr.inner }.bitcoin_key_2 = val.into_rust();
3044 impl Clone for UnsignedChannelAnnouncement {
3045 fn clone(&self) -> Self {
3047 inner: if <*mut nativeUnsignedChannelAnnouncement>::is_null(self.inner) { std::ptr::null_mut() } else {
3048 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
3054 /// Used only if an object of this type is returned as a trait impl by a method
3055 pub(crate) extern "C" fn UnsignedChannelAnnouncement_clone_void(this_ptr: *const c_void) -> *mut c_void {
3056 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeUnsignedChannelAnnouncement)).clone() })) as *mut c_void
3059 /// Creates a copy of the UnsignedChannelAnnouncement
3060 pub extern "C" fn UnsignedChannelAnnouncement_clone(orig: &UnsignedChannelAnnouncement) -> UnsignedChannelAnnouncement {
3064 use lightning::ln::msgs::ChannelAnnouncement as nativeChannelAnnouncementImport;
3065 type nativeChannelAnnouncement = nativeChannelAnnouncementImport;
3067 /// A channel_announcement message to be sent or received from a peer
3070 pub struct ChannelAnnouncement {
3071 /// A pointer to the opaque Rust object.
3073 /// Nearly everywhere, inner must be non-null, however in places where
3074 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
3075 pub inner: *mut nativeChannelAnnouncement,
3076 /// Indicates that this is the only struct which contains the same pointer.
3078 /// Rust functions which take ownership of an object provided via an argument require
3079 /// this to be true and invalidate the object pointed to by inner.
3083 impl Drop for ChannelAnnouncement {
3084 fn drop(&mut self) {
3085 if self.is_owned && !<*mut nativeChannelAnnouncement>::is_null(self.inner) {
3086 let _ = unsafe { Box::from_raw(self.inner) };
3090 /// Frees any resources used by the ChannelAnnouncement, if is_owned is set and inner is non-NULL.
3092 pub extern "C" fn ChannelAnnouncement_free(this_obj: ChannelAnnouncement) { }
3094 /// Used only if an object of this type is returned as a trait impl by a method
3095 extern "C" fn ChannelAnnouncement_free_void(this_ptr: *mut c_void) {
3096 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeChannelAnnouncement); }
3099 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
3100 impl ChannelAnnouncement {
3101 pub(crate) fn take_inner(mut self) -> *mut nativeChannelAnnouncement {
3102 assert!(self.is_owned);
3103 let ret = self.inner;
3104 self.inner = std::ptr::null_mut();
3108 /// Authentication of the announcement by the first public node
3110 pub extern "C" fn ChannelAnnouncement_get_node_signature_1(this_ptr: &ChannelAnnouncement) -> crate::c_types::Signature {
3111 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.node_signature_1;
3112 crate::c_types::Signature::from_rust(&inner_val)
3114 /// Authentication of the announcement by the first public node
3116 pub extern "C" fn ChannelAnnouncement_set_node_signature_1(this_ptr: &mut ChannelAnnouncement, mut val: crate::c_types::Signature) {
3117 unsafe { &mut *this_ptr.inner }.node_signature_1 = val.into_rust();
3119 /// Authentication of the announcement by the second public node
3121 pub extern "C" fn ChannelAnnouncement_get_node_signature_2(this_ptr: &ChannelAnnouncement) -> crate::c_types::Signature {
3122 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.node_signature_2;
3123 crate::c_types::Signature::from_rust(&inner_val)
3125 /// Authentication of the announcement by the second public node
3127 pub extern "C" fn ChannelAnnouncement_set_node_signature_2(this_ptr: &mut ChannelAnnouncement, mut val: crate::c_types::Signature) {
3128 unsafe { &mut *this_ptr.inner }.node_signature_2 = val.into_rust();
3130 /// Proof of funding UTXO ownership by the first public node
3132 pub extern "C" fn ChannelAnnouncement_get_bitcoin_signature_1(this_ptr: &ChannelAnnouncement) -> crate::c_types::Signature {
3133 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.bitcoin_signature_1;
3134 crate::c_types::Signature::from_rust(&inner_val)
3136 /// Proof of funding UTXO ownership by the first public node
3138 pub extern "C" fn ChannelAnnouncement_set_bitcoin_signature_1(this_ptr: &mut ChannelAnnouncement, mut val: crate::c_types::Signature) {
3139 unsafe { &mut *this_ptr.inner }.bitcoin_signature_1 = val.into_rust();
3141 /// Proof of funding UTXO ownership by the second public node
3143 pub extern "C" fn ChannelAnnouncement_get_bitcoin_signature_2(this_ptr: &ChannelAnnouncement) -> crate::c_types::Signature {
3144 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.bitcoin_signature_2;
3145 crate::c_types::Signature::from_rust(&inner_val)
3147 /// Proof of funding UTXO ownership by the second public node
3149 pub extern "C" fn ChannelAnnouncement_set_bitcoin_signature_2(this_ptr: &mut ChannelAnnouncement, mut val: crate::c_types::Signature) {
3150 unsafe { &mut *this_ptr.inner }.bitcoin_signature_2 = val.into_rust();
3152 /// The actual announcement
3154 pub extern "C" fn ChannelAnnouncement_get_contents(this_ptr: &ChannelAnnouncement) -> crate::lightning::ln::msgs::UnsignedChannelAnnouncement {
3155 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.contents;
3156 crate::lightning::ln::msgs::UnsignedChannelAnnouncement { inner: unsafe { ( (&(*inner_val) as *const _) as *mut _) }, is_owned: false }
3158 /// The actual announcement
3160 pub extern "C" fn ChannelAnnouncement_set_contents(this_ptr: &mut ChannelAnnouncement, mut val: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) {
3161 unsafe { &mut *this_ptr.inner }.contents = *unsafe { Box::from_raw(val.take_inner()) };
3163 /// Constructs a new ChannelAnnouncement given each field
3166 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 {
3167 ChannelAnnouncement { inner: Box::into_raw(Box::new(nativeChannelAnnouncement {
3168 node_signature_1: node_signature_1_arg.into_rust(),
3169 node_signature_2: node_signature_2_arg.into_rust(),
3170 bitcoin_signature_1: bitcoin_signature_1_arg.into_rust(),
3171 bitcoin_signature_2: bitcoin_signature_2_arg.into_rust(),
3172 contents: *unsafe { Box::from_raw(contents_arg.take_inner()) },
3173 })), is_owned: true }
3175 impl Clone for ChannelAnnouncement {
3176 fn clone(&self) -> Self {
3178 inner: if <*mut nativeChannelAnnouncement>::is_null(self.inner) { std::ptr::null_mut() } else {
3179 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
3185 /// Used only if an object of this type is returned as a trait impl by a method
3186 pub(crate) extern "C" fn ChannelAnnouncement_clone_void(this_ptr: *const c_void) -> *mut c_void {
3187 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeChannelAnnouncement)).clone() })) as *mut c_void
3190 /// Creates a copy of the ChannelAnnouncement
3191 pub extern "C" fn ChannelAnnouncement_clone(orig: &ChannelAnnouncement) -> ChannelAnnouncement {
3195 use lightning::ln::msgs::UnsignedChannelUpdate as nativeUnsignedChannelUpdateImport;
3196 type nativeUnsignedChannelUpdate = nativeUnsignedChannelUpdateImport;
3198 /// The unsigned part of a channel_update
3201 pub struct UnsignedChannelUpdate {
3202 /// A pointer to the opaque Rust object.
3204 /// Nearly everywhere, inner must be non-null, however in places where
3205 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
3206 pub inner: *mut nativeUnsignedChannelUpdate,
3207 /// Indicates that this is the only struct which contains the same pointer.
3209 /// Rust functions which take ownership of an object provided via an argument require
3210 /// this to be true and invalidate the object pointed to by inner.
3214 impl Drop for UnsignedChannelUpdate {
3215 fn drop(&mut self) {
3216 if self.is_owned && !<*mut nativeUnsignedChannelUpdate>::is_null(self.inner) {
3217 let _ = unsafe { Box::from_raw(self.inner) };
3221 /// Frees any resources used by the UnsignedChannelUpdate, if is_owned is set and inner is non-NULL.
3223 pub extern "C" fn UnsignedChannelUpdate_free(this_obj: UnsignedChannelUpdate) { }
3225 /// Used only if an object of this type is returned as a trait impl by a method
3226 extern "C" fn UnsignedChannelUpdate_free_void(this_ptr: *mut c_void) {
3227 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeUnsignedChannelUpdate); }
3230 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
3231 impl UnsignedChannelUpdate {
3232 pub(crate) fn take_inner(mut self) -> *mut nativeUnsignedChannelUpdate {
3233 assert!(self.is_owned);
3234 let ret = self.inner;
3235 self.inner = std::ptr::null_mut();
3239 /// The genesis hash of the blockchain where the channel is to be opened
3241 pub extern "C" fn UnsignedChannelUpdate_get_chain_hash(this_ptr: &UnsignedChannelUpdate) -> *const [u8; 32] {
3242 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.chain_hash;
3243 inner_val.as_inner()
3245 /// The genesis hash of the blockchain where the channel is to be opened
3247 pub extern "C" fn UnsignedChannelUpdate_set_chain_hash(this_ptr: &mut UnsignedChannelUpdate, mut val: crate::c_types::ThirtyTwoBytes) {
3248 unsafe { &mut *this_ptr.inner }.chain_hash = ::bitcoin::hash_types::BlockHash::from_slice(&val.data[..]).unwrap();
3250 /// The short channel ID
3252 pub extern "C" fn UnsignedChannelUpdate_get_short_channel_id(this_ptr: &UnsignedChannelUpdate) -> u64 {
3253 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.short_channel_id;
3256 /// The short channel ID
3258 pub extern "C" fn UnsignedChannelUpdate_set_short_channel_id(this_ptr: &mut UnsignedChannelUpdate, mut val: u64) {
3259 unsafe { &mut *this_ptr.inner }.short_channel_id = val;
3261 /// A strictly monotonic announcement counter, with gaps allowed, specific to this channel
3263 pub extern "C" fn UnsignedChannelUpdate_get_timestamp(this_ptr: &UnsignedChannelUpdate) -> u32 {
3264 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.timestamp;
3267 /// A strictly monotonic announcement counter, with gaps allowed, specific to this channel
3269 pub extern "C" fn UnsignedChannelUpdate_set_timestamp(this_ptr: &mut UnsignedChannelUpdate, mut val: u32) {
3270 unsafe { &mut *this_ptr.inner }.timestamp = val;
3274 pub extern "C" fn UnsignedChannelUpdate_get_flags(this_ptr: &UnsignedChannelUpdate) -> u8 {
3275 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.flags;
3280 pub extern "C" fn UnsignedChannelUpdate_set_flags(this_ptr: &mut UnsignedChannelUpdate, mut val: u8) {
3281 unsafe { &mut *this_ptr.inner }.flags = val;
3283 /// The number of blocks such that if:
3284 /// `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
3285 /// then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines
3286 /// the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a
3287 /// cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10,
3288 /// then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before
3289 /// forwarding. Note that the HTLC sender is the one who originally sets this value when
3290 /// constructing the route.
3292 pub extern "C" fn UnsignedChannelUpdate_get_cltv_expiry_delta(this_ptr: &UnsignedChannelUpdate) -> u16 {
3293 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.cltv_expiry_delta;
3296 /// The number of blocks such that if:
3297 /// `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
3298 /// then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines
3299 /// the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a
3300 /// cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10,
3301 /// then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before
3302 /// forwarding. Note that the HTLC sender is the one who originally sets this value when
3303 /// constructing the route.
3305 pub extern "C" fn UnsignedChannelUpdate_set_cltv_expiry_delta(this_ptr: &mut UnsignedChannelUpdate, mut val: u16) {
3306 unsafe { &mut *this_ptr.inner }.cltv_expiry_delta = val;
3308 /// The minimum HTLC size incoming to sender, in milli-satoshi
3310 pub extern "C" fn UnsignedChannelUpdate_get_htlc_minimum_msat(this_ptr: &UnsignedChannelUpdate) -> u64 {
3311 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.htlc_minimum_msat;
3314 /// The minimum HTLC size incoming to sender, in milli-satoshi
3316 pub extern "C" fn UnsignedChannelUpdate_set_htlc_minimum_msat(this_ptr: &mut UnsignedChannelUpdate, mut val: u64) {
3317 unsafe { &mut *this_ptr.inner }.htlc_minimum_msat = val;
3319 /// The base HTLC fee charged by sender, in milli-satoshi
3321 pub extern "C" fn UnsignedChannelUpdate_get_fee_base_msat(this_ptr: &UnsignedChannelUpdate) -> u32 {
3322 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.fee_base_msat;
3325 /// The base HTLC fee charged by sender, in milli-satoshi
3327 pub extern "C" fn UnsignedChannelUpdate_set_fee_base_msat(this_ptr: &mut UnsignedChannelUpdate, mut val: u32) {
3328 unsafe { &mut *this_ptr.inner }.fee_base_msat = val;
3330 /// The amount to fee multiplier, in micro-satoshi
3332 pub extern "C" fn UnsignedChannelUpdate_get_fee_proportional_millionths(this_ptr: &UnsignedChannelUpdate) -> u32 {
3333 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.fee_proportional_millionths;
3336 /// The amount to fee multiplier, in micro-satoshi
3338 pub extern "C" fn UnsignedChannelUpdate_set_fee_proportional_millionths(this_ptr: &mut UnsignedChannelUpdate, mut val: u32) {
3339 unsafe { &mut *this_ptr.inner }.fee_proportional_millionths = val;
3341 impl Clone for UnsignedChannelUpdate {
3342 fn clone(&self) -> Self {
3344 inner: if <*mut nativeUnsignedChannelUpdate>::is_null(self.inner) { std::ptr::null_mut() } else {
3345 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
3351 /// Used only if an object of this type is returned as a trait impl by a method
3352 pub(crate) extern "C" fn UnsignedChannelUpdate_clone_void(this_ptr: *const c_void) -> *mut c_void {
3353 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeUnsignedChannelUpdate)).clone() })) as *mut c_void
3356 /// Creates a copy of the UnsignedChannelUpdate
3357 pub extern "C" fn UnsignedChannelUpdate_clone(orig: &UnsignedChannelUpdate) -> UnsignedChannelUpdate {
3361 use lightning::ln::msgs::ChannelUpdate as nativeChannelUpdateImport;
3362 type nativeChannelUpdate = nativeChannelUpdateImport;
3364 /// A channel_update message to be sent or received from a peer
3367 pub struct ChannelUpdate {
3368 /// A pointer to the opaque Rust object.
3370 /// Nearly everywhere, inner must be non-null, however in places where
3371 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
3372 pub inner: *mut nativeChannelUpdate,
3373 /// Indicates that this is the only struct which contains the same pointer.
3375 /// Rust functions which take ownership of an object provided via an argument require
3376 /// this to be true and invalidate the object pointed to by inner.
3380 impl Drop for ChannelUpdate {
3381 fn drop(&mut self) {
3382 if self.is_owned && !<*mut nativeChannelUpdate>::is_null(self.inner) {
3383 let _ = unsafe { Box::from_raw(self.inner) };
3387 /// Frees any resources used by the ChannelUpdate, if is_owned is set and inner is non-NULL.
3389 pub extern "C" fn ChannelUpdate_free(this_obj: ChannelUpdate) { }
3391 /// Used only if an object of this type is returned as a trait impl by a method
3392 extern "C" fn ChannelUpdate_free_void(this_ptr: *mut c_void) {
3393 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeChannelUpdate); }
3396 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
3397 impl ChannelUpdate {
3398 pub(crate) fn take_inner(mut self) -> *mut nativeChannelUpdate {
3399 assert!(self.is_owned);
3400 let ret = self.inner;
3401 self.inner = std::ptr::null_mut();
3405 /// A signature of the channel update
3407 pub extern "C" fn ChannelUpdate_get_signature(this_ptr: &ChannelUpdate) -> crate::c_types::Signature {
3408 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.signature;
3409 crate::c_types::Signature::from_rust(&inner_val)
3411 /// A signature of the channel update
3413 pub extern "C" fn ChannelUpdate_set_signature(this_ptr: &mut ChannelUpdate, mut val: crate::c_types::Signature) {
3414 unsafe { &mut *this_ptr.inner }.signature = val.into_rust();
3416 /// The actual channel update
3418 pub extern "C" fn ChannelUpdate_get_contents(this_ptr: &ChannelUpdate) -> crate::lightning::ln::msgs::UnsignedChannelUpdate {
3419 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.contents;
3420 crate::lightning::ln::msgs::UnsignedChannelUpdate { inner: unsafe { ( (&(*inner_val) as *const _) as *mut _) }, is_owned: false }
3422 /// The actual channel update
3424 pub extern "C" fn ChannelUpdate_set_contents(this_ptr: &mut ChannelUpdate, mut val: crate::lightning::ln::msgs::UnsignedChannelUpdate) {
3425 unsafe { &mut *this_ptr.inner }.contents = *unsafe { Box::from_raw(val.take_inner()) };
3427 /// Constructs a new ChannelUpdate given each field
3430 pub extern "C" fn ChannelUpdate_new(mut signature_arg: crate::c_types::Signature, mut contents_arg: crate::lightning::ln::msgs::UnsignedChannelUpdate) -> ChannelUpdate {
3431 ChannelUpdate { inner: Box::into_raw(Box::new(nativeChannelUpdate {
3432 signature: signature_arg.into_rust(),
3433 contents: *unsafe { Box::from_raw(contents_arg.take_inner()) },
3434 })), is_owned: true }
3436 impl Clone for ChannelUpdate {
3437 fn clone(&self) -> Self {
3439 inner: if <*mut nativeChannelUpdate>::is_null(self.inner) { std::ptr::null_mut() } else {
3440 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
3446 /// Used only if an object of this type is returned as a trait impl by a method
3447 pub(crate) extern "C" fn ChannelUpdate_clone_void(this_ptr: *const c_void) -> *mut c_void {
3448 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeChannelUpdate)).clone() })) as *mut c_void
3451 /// Creates a copy of the ChannelUpdate
3452 pub extern "C" fn ChannelUpdate_clone(orig: &ChannelUpdate) -> ChannelUpdate {
3456 use lightning::ln::msgs::QueryChannelRange as nativeQueryChannelRangeImport;
3457 type nativeQueryChannelRange = nativeQueryChannelRangeImport;
3459 /// A query_channel_range message is used to query a peer for channel
3460 /// UTXOs in a range of blocks. The recipient of a query makes a best
3461 /// effort to reply to the query using one or more reply_channel_range
3465 pub struct QueryChannelRange {
3466 /// A pointer to the opaque Rust object.
3468 /// Nearly everywhere, inner must be non-null, however in places where
3469 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
3470 pub inner: *mut nativeQueryChannelRange,
3471 /// Indicates that this is the only struct which contains the same pointer.
3473 /// Rust functions which take ownership of an object provided via an argument require
3474 /// this to be true and invalidate the object pointed to by inner.
3478 impl Drop for QueryChannelRange {
3479 fn drop(&mut self) {
3480 if self.is_owned && !<*mut nativeQueryChannelRange>::is_null(self.inner) {
3481 let _ = unsafe { Box::from_raw(self.inner) };
3485 /// Frees any resources used by the QueryChannelRange, if is_owned is set and inner is non-NULL.
3487 pub extern "C" fn QueryChannelRange_free(this_obj: QueryChannelRange) { }
3489 /// Used only if an object of this type is returned as a trait impl by a method
3490 extern "C" fn QueryChannelRange_free_void(this_ptr: *mut c_void) {
3491 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeQueryChannelRange); }
3494 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
3495 impl QueryChannelRange {
3496 pub(crate) fn take_inner(mut self) -> *mut nativeQueryChannelRange {
3497 assert!(self.is_owned);
3498 let ret = self.inner;
3499 self.inner = std::ptr::null_mut();
3503 /// The genesis hash of the blockchain being queried
3505 pub extern "C" fn QueryChannelRange_get_chain_hash(this_ptr: &QueryChannelRange) -> *const [u8; 32] {
3506 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.chain_hash;
3507 inner_val.as_inner()
3509 /// The genesis hash of the blockchain being queried
3511 pub extern "C" fn QueryChannelRange_set_chain_hash(this_ptr: &mut QueryChannelRange, mut val: crate::c_types::ThirtyTwoBytes) {
3512 unsafe { &mut *this_ptr.inner }.chain_hash = ::bitcoin::hash_types::BlockHash::from_slice(&val.data[..]).unwrap();
3514 /// The height of the first block for the channel UTXOs being queried
3516 pub extern "C" fn QueryChannelRange_get_first_blocknum(this_ptr: &QueryChannelRange) -> u32 {
3517 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.first_blocknum;
3520 /// The height of the first block for the channel UTXOs being queried
3522 pub extern "C" fn QueryChannelRange_set_first_blocknum(this_ptr: &mut QueryChannelRange, mut val: u32) {
3523 unsafe { &mut *this_ptr.inner }.first_blocknum = val;
3525 /// The number of blocks to include in the query results
3527 pub extern "C" fn QueryChannelRange_get_number_of_blocks(this_ptr: &QueryChannelRange) -> u32 {
3528 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.number_of_blocks;
3531 /// The number of blocks to include in the query results
3533 pub extern "C" fn QueryChannelRange_set_number_of_blocks(this_ptr: &mut QueryChannelRange, mut val: u32) {
3534 unsafe { &mut *this_ptr.inner }.number_of_blocks = val;
3536 /// Constructs a new QueryChannelRange given each field
3539 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 {
3540 QueryChannelRange { inner: Box::into_raw(Box::new(nativeQueryChannelRange {
3541 chain_hash: ::bitcoin::hash_types::BlockHash::from_slice(&chain_hash_arg.data[..]).unwrap(),
3542 first_blocknum: first_blocknum_arg,
3543 number_of_blocks: number_of_blocks_arg,
3544 })), is_owned: true }
3546 impl Clone for QueryChannelRange {
3547 fn clone(&self) -> Self {
3549 inner: if <*mut nativeQueryChannelRange>::is_null(self.inner) { std::ptr::null_mut() } else {
3550 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
3556 /// Used only if an object of this type is returned as a trait impl by a method
3557 pub(crate) extern "C" fn QueryChannelRange_clone_void(this_ptr: *const c_void) -> *mut c_void {
3558 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeQueryChannelRange)).clone() })) as *mut c_void
3561 /// Creates a copy of the QueryChannelRange
3562 pub extern "C" fn QueryChannelRange_clone(orig: &QueryChannelRange) -> QueryChannelRange {
3566 use lightning::ln::msgs::ReplyChannelRange as nativeReplyChannelRangeImport;
3567 type nativeReplyChannelRange = nativeReplyChannelRangeImport;
3569 /// A reply_channel_range message is a reply to a query_channel_range
3570 /// message. Multiple reply_channel_range messages can be sent in reply
3571 /// to a single query_channel_range message. The query recipient makes a
3572 /// best effort to respond based on their local network view which may
3573 /// not be a perfect view of the network. The short_channel_ids in the
3574 /// reply are encoded. We only support encoding_type=0 uncompressed
3575 /// serialization and do not support encoding_type=1 zlib serialization.
3578 pub struct ReplyChannelRange {
3579 /// A pointer to the opaque Rust object.
3581 /// Nearly everywhere, inner must be non-null, however in places where
3582 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
3583 pub inner: *mut nativeReplyChannelRange,
3584 /// Indicates that this is the only struct which contains the same pointer.
3586 /// Rust functions which take ownership of an object provided via an argument require
3587 /// this to be true and invalidate the object pointed to by inner.
3591 impl Drop for ReplyChannelRange {
3592 fn drop(&mut self) {
3593 if self.is_owned && !<*mut nativeReplyChannelRange>::is_null(self.inner) {
3594 let _ = unsafe { Box::from_raw(self.inner) };
3598 /// Frees any resources used by the ReplyChannelRange, if is_owned is set and inner is non-NULL.
3600 pub extern "C" fn ReplyChannelRange_free(this_obj: ReplyChannelRange) { }
3602 /// Used only if an object of this type is returned as a trait impl by a method
3603 extern "C" fn ReplyChannelRange_free_void(this_ptr: *mut c_void) {
3604 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeReplyChannelRange); }
3607 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
3608 impl ReplyChannelRange {
3609 pub(crate) fn take_inner(mut self) -> *mut nativeReplyChannelRange {
3610 assert!(self.is_owned);
3611 let ret = self.inner;
3612 self.inner = std::ptr::null_mut();
3616 /// The genesis hash of the blockchain being queried
3618 pub extern "C" fn ReplyChannelRange_get_chain_hash(this_ptr: &ReplyChannelRange) -> *const [u8; 32] {
3619 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.chain_hash;
3620 inner_val.as_inner()
3622 /// The genesis hash of the blockchain being queried
3624 pub extern "C" fn ReplyChannelRange_set_chain_hash(this_ptr: &mut ReplyChannelRange, mut val: crate::c_types::ThirtyTwoBytes) {
3625 unsafe { &mut *this_ptr.inner }.chain_hash = ::bitcoin::hash_types::BlockHash::from_slice(&val.data[..]).unwrap();
3627 /// The height of the first block in the range of the reply
3629 pub extern "C" fn ReplyChannelRange_get_first_blocknum(this_ptr: &ReplyChannelRange) -> u32 {
3630 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.first_blocknum;
3633 /// The height of the first block in the range of the reply
3635 pub extern "C" fn ReplyChannelRange_set_first_blocknum(this_ptr: &mut ReplyChannelRange, mut val: u32) {
3636 unsafe { &mut *this_ptr.inner }.first_blocknum = val;
3638 /// The number of blocks included in the range of the reply
3640 pub extern "C" fn ReplyChannelRange_get_number_of_blocks(this_ptr: &ReplyChannelRange) -> u32 {
3641 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.number_of_blocks;
3644 /// The number of blocks included in the range of the reply
3646 pub extern "C" fn ReplyChannelRange_set_number_of_blocks(this_ptr: &mut ReplyChannelRange, mut val: u32) {
3647 unsafe { &mut *this_ptr.inner }.number_of_blocks = val;
3649 /// True when this is the final reply for a query
3651 pub extern "C" fn ReplyChannelRange_get_sync_complete(this_ptr: &ReplyChannelRange) -> bool {
3652 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.sync_complete;
3655 /// True when this is the final reply for a query
3657 pub extern "C" fn ReplyChannelRange_set_sync_complete(this_ptr: &mut ReplyChannelRange, mut val: bool) {
3658 unsafe { &mut *this_ptr.inner }.sync_complete = val;
3660 /// The short_channel_ids in the channel range
3662 pub extern "C" fn ReplyChannelRange_set_short_channel_ids(this_ptr: &mut ReplyChannelRange, mut val: crate::c_types::derived::CVec_u64Z) {
3663 let mut local_val = Vec::new(); for mut item in val.into_rust().drain(..) { local_val.push( { item }); };
3664 unsafe { &mut *this_ptr.inner }.short_channel_ids = local_val;
3666 /// Constructs a new ReplyChannelRange given each field
3669 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 {
3670 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 }); };
3671 ReplyChannelRange { inner: Box::into_raw(Box::new(nativeReplyChannelRange {
3672 chain_hash: ::bitcoin::hash_types::BlockHash::from_slice(&chain_hash_arg.data[..]).unwrap(),
3673 first_blocknum: first_blocknum_arg,
3674 number_of_blocks: number_of_blocks_arg,
3675 sync_complete: sync_complete_arg,
3676 short_channel_ids: local_short_channel_ids_arg,
3677 })), is_owned: true }
3679 impl Clone for ReplyChannelRange {
3680 fn clone(&self) -> Self {
3682 inner: if <*mut nativeReplyChannelRange>::is_null(self.inner) { std::ptr::null_mut() } else {
3683 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
3689 /// Used only if an object of this type is returned as a trait impl by a method
3690 pub(crate) extern "C" fn ReplyChannelRange_clone_void(this_ptr: *const c_void) -> *mut c_void {
3691 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeReplyChannelRange)).clone() })) as *mut c_void
3694 /// Creates a copy of the ReplyChannelRange
3695 pub extern "C" fn ReplyChannelRange_clone(orig: &ReplyChannelRange) -> ReplyChannelRange {
3699 use lightning::ln::msgs::QueryShortChannelIds as nativeQueryShortChannelIdsImport;
3700 type nativeQueryShortChannelIds = nativeQueryShortChannelIdsImport;
3702 /// A query_short_channel_ids message is used to query a peer for
3703 /// routing gossip messages related to one or more short_channel_ids.
3704 /// The query recipient will reply with the latest, if available,
3705 /// channel_announcement, channel_update and node_announcement messages
3706 /// it maintains for the requested short_channel_ids followed by a
3707 /// reply_short_channel_ids_end message. The short_channel_ids sent in
3708 /// this query are encoded. We only support encoding_type=0 uncompressed
3709 /// serialization and do not support encoding_type=1 zlib serialization.
3712 pub struct QueryShortChannelIds {
3713 /// A pointer to the opaque Rust object.
3715 /// Nearly everywhere, inner must be non-null, however in places where
3716 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
3717 pub inner: *mut nativeQueryShortChannelIds,
3718 /// Indicates that this is the only struct which contains the same pointer.
3720 /// Rust functions which take ownership of an object provided via an argument require
3721 /// this to be true and invalidate the object pointed to by inner.
3725 impl Drop for QueryShortChannelIds {
3726 fn drop(&mut self) {
3727 if self.is_owned && !<*mut nativeQueryShortChannelIds>::is_null(self.inner) {
3728 let _ = unsafe { Box::from_raw(self.inner) };
3732 /// Frees any resources used by the QueryShortChannelIds, if is_owned is set and inner is non-NULL.
3734 pub extern "C" fn QueryShortChannelIds_free(this_obj: QueryShortChannelIds) { }
3736 /// Used only if an object of this type is returned as a trait impl by a method
3737 extern "C" fn QueryShortChannelIds_free_void(this_ptr: *mut c_void) {
3738 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeQueryShortChannelIds); }
3741 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
3742 impl QueryShortChannelIds {
3743 pub(crate) fn take_inner(mut self) -> *mut nativeQueryShortChannelIds {
3744 assert!(self.is_owned);
3745 let ret = self.inner;
3746 self.inner = std::ptr::null_mut();
3750 /// The genesis hash of the blockchain being queried
3752 pub extern "C" fn QueryShortChannelIds_get_chain_hash(this_ptr: &QueryShortChannelIds) -> *const [u8; 32] {
3753 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.chain_hash;
3754 inner_val.as_inner()
3756 /// The genesis hash of the blockchain being queried
3758 pub extern "C" fn QueryShortChannelIds_set_chain_hash(this_ptr: &mut QueryShortChannelIds, mut val: crate::c_types::ThirtyTwoBytes) {
3759 unsafe { &mut *this_ptr.inner }.chain_hash = ::bitcoin::hash_types::BlockHash::from_slice(&val.data[..]).unwrap();
3761 /// The short_channel_ids that are being queried
3763 pub extern "C" fn QueryShortChannelIds_set_short_channel_ids(this_ptr: &mut QueryShortChannelIds, mut val: crate::c_types::derived::CVec_u64Z) {
3764 let mut local_val = Vec::new(); for mut item in val.into_rust().drain(..) { local_val.push( { item }); };
3765 unsafe { &mut *this_ptr.inner }.short_channel_ids = local_val;
3767 /// Constructs a new QueryShortChannelIds given each field
3770 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 {
3771 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 }); };
3772 QueryShortChannelIds { inner: Box::into_raw(Box::new(nativeQueryShortChannelIds {
3773 chain_hash: ::bitcoin::hash_types::BlockHash::from_slice(&chain_hash_arg.data[..]).unwrap(),
3774 short_channel_ids: local_short_channel_ids_arg,
3775 })), is_owned: true }
3777 impl Clone for QueryShortChannelIds {
3778 fn clone(&self) -> Self {
3780 inner: if <*mut nativeQueryShortChannelIds>::is_null(self.inner) { std::ptr::null_mut() } else {
3781 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
3787 /// Used only if an object of this type is returned as a trait impl by a method
3788 pub(crate) extern "C" fn QueryShortChannelIds_clone_void(this_ptr: *const c_void) -> *mut c_void {
3789 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeQueryShortChannelIds)).clone() })) as *mut c_void
3792 /// Creates a copy of the QueryShortChannelIds
3793 pub extern "C" fn QueryShortChannelIds_clone(orig: &QueryShortChannelIds) -> QueryShortChannelIds {
3797 use lightning::ln::msgs::ReplyShortChannelIdsEnd as nativeReplyShortChannelIdsEndImport;
3798 type nativeReplyShortChannelIdsEnd = nativeReplyShortChannelIdsEndImport;
3800 /// A reply_short_channel_ids_end message is sent as a reply to a
3801 /// query_short_channel_ids message. The query recipient makes a best
3802 /// effort to respond based on their local network view which may not be
3803 /// a perfect view of the network.
3806 pub struct ReplyShortChannelIdsEnd {
3807 /// A pointer to the opaque Rust object.
3809 /// Nearly everywhere, inner must be non-null, however in places where
3810 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
3811 pub inner: *mut nativeReplyShortChannelIdsEnd,
3812 /// Indicates that this is the only struct which contains the same pointer.
3814 /// Rust functions which take ownership of an object provided via an argument require
3815 /// this to be true and invalidate the object pointed to by inner.
3819 impl Drop for ReplyShortChannelIdsEnd {
3820 fn drop(&mut self) {
3821 if self.is_owned && !<*mut nativeReplyShortChannelIdsEnd>::is_null(self.inner) {
3822 let _ = unsafe { Box::from_raw(self.inner) };
3826 /// Frees any resources used by the ReplyShortChannelIdsEnd, if is_owned is set and inner is non-NULL.
3828 pub extern "C" fn ReplyShortChannelIdsEnd_free(this_obj: ReplyShortChannelIdsEnd) { }
3830 /// Used only if an object of this type is returned as a trait impl by a method
3831 extern "C" fn ReplyShortChannelIdsEnd_free_void(this_ptr: *mut c_void) {
3832 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeReplyShortChannelIdsEnd); }
3835 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
3836 impl ReplyShortChannelIdsEnd {
3837 pub(crate) fn take_inner(mut self) -> *mut nativeReplyShortChannelIdsEnd {
3838 assert!(self.is_owned);
3839 let ret = self.inner;
3840 self.inner = std::ptr::null_mut();
3844 /// The genesis hash of the blockchain that was queried
3846 pub extern "C" fn ReplyShortChannelIdsEnd_get_chain_hash(this_ptr: &ReplyShortChannelIdsEnd) -> *const [u8; 32] {
3847 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.chain_hash;
3848 inner_val.as_inner()
3850 /// The genesis hash of the blockchain that was queried
3852 pub extern "C" fn ReplyShortChannelIdsEnd_set_chain_hash(this_ptr: &mut ReplyShortChannelIdsEnd, mut val: crate::c_types::ThirtyTwoBytes) {
3853 unsafe { &mut *this_ptr.inner }.chain_hash = ::bitcoin::hash_types::BlockHash::from_slice(&val.data[..]).unwrap();
3855 /// Indicates if the query recipient maintains up-to-date channel
3856 /// information for the chain_hash
3858 pub extern "C" fn ReplyShortChannelIdsEnd_get_full_information(this_ptr: &ReplyShortChannelIdsEnd) -> bool {
3859 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.full_information;
3862 /// Indicates if the query recipient maintains up-to-date channel
3863 /// information for the chain_hash
3865 pub extern "C" fn ReplyShortChannelIdsEnd_set_full_information(this_ptr: &mut ReplyShortChannelIdsEnd, mut val: bool) {
3866 unsafe { &mut *this_ptr.inner }.full_information = val;
3868 /// Constructs a new ReplyShortChannelIdsEnd given each field
3871 pub extern "C" fn ReplyShortChannelIdsEnd_new(mut chain_hash_arg: crate::c_types::ThirtyTwoBytes, mut full_information_arg: bool) -> ReplyShortChannelIdsEnd {
3872 ReplyShortChannelIdsEnd { inner: Box::into_raw(Box::new(nativeReplyShortChannelIdsEnd {
3873 chain_hash: ::bitcoin::hash_types::BlockHash::from_slice(&chain_hash_arg.data[..]).unwrap(),
3874 full_information: full_information_arg,
3875 })), is_owned: true }
3877 impl Clone for ReplyShortChannelIdsEnd {
3878 fn clone(&self) -> Self {
3880 inner: if <*mut nativeReplyShortChannelIdsEnd>::is_null(self.inner) { std::ptr::null_mut() } else {
3881 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
3887 /// Used only if an object of this type is returned as a trait impl by a method
3888 pub(crate) extern "C" fn ReplyShortChannelIdsEnd_clone_void(this_ptr: *const c_void) -> *mut c_void {
3889 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeReplyShortChannelIdsEnd)).clone() })) as *mut c_void
3892 /// Creates a copy of the ReplyShortChannelIdsEnd
3893 pub extern "C" fn ReplyShortChannelIdsEnd_clone(orig: &ReplyShortChannelIdsEnd) -> ReplyShortChannelIdsEnd {
3897 use lightning::ln::msgs::GossipTimestampFilter as nativeGossipTimestampFilterImport;
3898 type nativeGossipTimestampFilter = nativeGossipTimestampFilterImport;
3900 /// A gossip_timestamp_filter message is used by a node to request
3901 /// gossip relay for messages in the requested time range when the
3902 /// gossip_queries feature has been negotiated.
3905 pub struct GossipTimestampFilter {
3906 /// A pointer to the opaque Rust object.
3908 /// Nearly everywhere, inner must be non-null, however in places where
3909 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
3910 pub inner: *mut nativeGossipTimestampFilter,
3911 /// Indicates that this is the only struct which contains the same pointer.
3913 /// Rust functions which take ownership of an object provided via an argument require
3914 /// this to be true and invalidate the object pointed to by inner.
3918 impl Drop for GossipTimestampFilter {
3919 fn drop(&mut self) {
3920 if self.is_owned && !<*mut nativeGossipTimestampFilter>::is_null(self.inner) {
3921 let _ = unsafe { Box::from_raw(self.inner) };
3925 /// Frees any resources used by the GossipTimestampFilter, if is_owned is set and inner is non-NULL.
3927 pub extern "C" fn GossipTimestampFilter_free(this_obj: GossipTimestampFilter) { }
3929 /// Used only if an object of this type is returned as a trait impl by a method
3930 extern "C" fn GossipTimestampFilter_free_void(this_ptr: *mut c_void) {
3931 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeGossipTimestampFilter); }
3934 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
3935 impl GossipTimestampFilter {
3936 pub(crate) fn take_inner(mut self) -> *mut nativeGossipTimestampFilter {
3937 assert!(self.is_owned);
3938 let ret = self.inner;
3939 self.inner = std::ptr::null_mut();
3943 /// The genesis hash of the blockchain for channel and node information
3945 pub extern "C" fn GossipTimestampFilter_get_chain_hash(this_ptr: &GossipTimestampFilter) -> *const [u8; 32] {
3946 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.chain_hash;
3947 inner_val.as_inner()
3949 /// The genesis hash of the blockchain for channel and node information
3951 pub extern "C" fn GossipTimestampFilter_set_chain_hash(this_ptr: &mut GossipTimestampFilter, mut val: crate::c_types::ThirtyTwoBytes) {
3952 unsafe { &mut *this_ptr.inner }.chain_hash = ::bitcoin::hash_types::BlockHash::from_slice(&val.data[..]).unwrap();
3954 /// The starting unix timestamp
3956 pub extern "C" fn GossipTimestampFilter_get_first_timestamp(this_ptr: &GossipTimestampFilter) -> u32 {
3957 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.first_timestamp;
3960 /// The starting unix timestamp
3962 pub extern "C" fn GossipTimestampFilter_set_first_timestamp(this_ptr: &mut GossipTimestampFilter, mut val: u32) {
3963 unsafe { &mut *this_ptr.inner }.first_timestamp = val;
3965 /// The range of information in seconds
3967 pub extern "C" fn GossipTimestampFilter_get_timestamp_range(this_ptr: &GossipTimestampFilter) -> u32 {
3968 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.timestamp_range;
3971 /// The range of information in seconds
3973 pub extern "C" fn GossipTimestampFilter_set_timestamp_range(this_ptr: &mut GossipTimestampFilter, mut val: u32) {
3974 unsafe { &mut *this_ptr.inner }.timestamp_range = val;
3976 /// Constructs a new GossipTimestampFilter given each field
3979 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 {
3980 GossipTimestampFilter { inner: Box::into_raw(Box::new(nativeGossipTimestampFilter {
3981 chain_hash: ::bitcoin::hash_types::BlockHash::from_slice(&chain_hash_arg.data[..]).unwrap(),
3982 first_timestamp: first_timestamp_arg,
3983 timestamp_range: timestamp_range_arg,
3984 })), is_owned: true }
3986 impl Clone for GossipTimestampFilter {
3987 fn clone(&self) -> Self {
3989 inner: if <*mut nativeGossipTimestampFilter>::is_null(self.inner) { std::ptr::null_mut() } else {
3990 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
3996 /// Used only if an object of this type is returned as a trait impl by a method
3997 pub(crate) extern "C" fn GossipTimestampFilter_clone_void(this_ptr: *const c_void) -> *mut c_void {
3998 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeGossipTimestampFilter)).clone() })) as *mut c_void
4001 /// Creates a copy of the GossipTimestampFilter
4002 pub extern "C" fn GossipTimestampFilter_clone(orig: &GossipTimestampFilter) -> GossipTimestampFilter {
4005 /// Used to put an error message in a LightningError
4009 pub enum ErrorAction {
4010 /// The peer took some action which made us think they were useless. Disconnect them.
4012 /// An error message which we should make an effort to send before we disconnect.
4013 msg: crate::lightning::ln::msgs::ErrorMessage,
4015 /// The peer did something harmless that we weren't able to process, just log and ignore
4017 /// The peer did something harmless that we weren't able to meaningfully process.
4018 /// If the error is logged, log it at the given level.
4019 IgnoreAndLog(crate::lightning::util::logger::Level),
4020 /// The peer did something incorrect. Tell them.
4022 /// The message to send.
4023 msg: crate::lightning::ln::msgs::ErrorMessage,
4026 use lightning::ln::msgs::ErrorAction as nativeErrorAction;
4029 pub(crate) fn to_native(&self) -> nativeErrorAction {
4031 ErrorAction::DisconnectPeer {ref msg, } => {
4032 let mut msg_nonref = (*msg).clone();
4033 let mut local_msg_nonref = if msg_nonref.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(msg_nonref.take_inner()) } }) };
4034 nativeErrorAction::DisconnectPeer {
4035 msg: local_msg_nonref,
4038 ErrorAction::IgnoreError => nativeErrorAction::IgnoreError,
4039 ErrorAction::IgnoreAndLog (ref a, ) => {
4040 let mut a_nonref = (*a).clone();
4041 nativeErrorAction::IgnoreAndLog (
4042 a_nonref.into_native(),
4045 ErrorAction::SendErrorMessage {ref msg, } => {
4046 let mut msg_nonref = (*msg).clone();
4047 nativeErrorAction::SendErrorMessage {
4048 msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) },
4054 pub(crate) fn into_native(self) -> nativeErrorAction {
4056 ErrorAction::DisconnectPeer {mut msg, } => {
4057 let mut local_msg = if msg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(msg.take_inner()) } }) };
4058 nativeErrorAction::DisconnectPeer {
4062 ErrorAction::IgnoreError => nativeErrorAction::IgnoreError,
4063 ErrorAction::IgnoreAndLog (mut a, ) => {
4064 nativeErrorAction::IgnoreAndLog (
4068 ErrorAction::SendErrorMessage {mut msg, } => {
4069 nativeErrorAction::SendErrorMessage {
4070 msg: *unsafe { Box::from_raw(msg.take_inner()) },
4076 pub(crate) fn from_native(native: &nativeErrorAction) -> Self {
4078 nativeErrorAction::DisconnectPeer {ref msg, } => {
4079 let mut msg_nonref = (*msg).clone();
4080 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 };
4081 ErrorAction::DisconnectPeer {
4082 msg: local_msg_nonref,
4085 nativeErrorAction::IgnoreError => ErrorAction::IgnoreError,
4086 nativeErrorAction::IgnoreAndLog (ref a, ) => {
4087 let mut a_nonref = (*a).clone();
4088 ErrorAction::IgnoreAndLog (
4089 crate::lightning::util::logger::Level::native_into(a_nonref),
4092 nativeErrorAction::SendErrorMessage {ref msg, } => {
4093 let mut msg_nonref = (*msg).clone();
4094 ErrorAction::SendErrorMessage {
4095 msg: crate::lightning::ln::msgs::ErrorMessage { inner: Box::into_raw(Box::new(msg_nonref)), is_owned: true },
4101 pub(crate) fn native_into(native: nativeErrorAction) -> Self {
4103 nativeErrorAction::DisconnectPeer {mut msg, } => {
4104 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 };
4105 ErrorAction::DisconnectPeer {
4109 nativeErrorAction::IgnoreError => ErrorAction::IgnoreError,
4110 nativeErrorAction::IgnoreAndLog (mut a, ) => {
4111 ErrorAction::IgnoreAndLog (
4112 crate::lightning::util::logger::Level::native_into(a),
4115 nativeErrorAction::SendErrorMessage {mut msg, } => {
4116 ErrorAction::SendErrorMessage {
4117 msg: crate::lightning::ln::msgs::ErrorMessage { inner: Box::into_raw(Box::new(msg)), is_owned: true },
4123 /// Frees any resources used by the ErrorAction
4125 pub extern "C" fn ErrorAction_free(this_ptr: ErrorAction) { }
4126 /// Creates a copy of the ErrorAction
4128 pub extern "C" fn ErrorAction_clone(orig: &ErrorAction) -> ErrorAction {
4132 use lightning::ln::msgs::LightningError as nativeLightningErrorImport;
4133 type nativeLightningError = nativeLightningErrorImport;
4135 /// An Err type for failure to process messages.
4138 pub struct LightningError {
4139 /// A pointer to the opaque Rust object.
4141 /// Nearly everywhere, inner must be non-null, however in places where
4142 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
4143 pub inner: *mut nativeLightningError,
4144 /// Indicates that this is the only struct which contains the same pointer.
4146 /// Rust functions which take ownership of an object provided via an argument require
4147 /// this to be true and invalidate the object pointed to by inner.
4151 impl Drop for LightningError {
4152 fn drop(&mut self) {
4153 if self.is_owned && !<*mut nativeLightningError>::is_null(self.inner) {
4154 let _ = unsafe { Box::from_raw(self.inner) };
4158 /// Frees any resources used by the LightningError, if is_owned is set and inner is non-NULL.
4160 pub extern "C" fn LightningError_free(this_obj: LightningError) { }
4162 /// Used only if an object of this type is returned as a trait impl by a method
4163 extern "C" fn LightningError_free_void(this_ptr: *mut c_void) {
4164 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeLightningError); }
4167 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
4168 impl LightningError {
4169 pub(crate) fn take_inner(mut self) -> *mut nativeLightningError {
4170 assert!(self.is_owned);
4171 let ret = self.inner;
4172 self.inner = std::ptr::null_mut();
4176 /// A human-readable message describing the error
4178 pub extern "C" fn LightningError_get_err(this_ptr: &LightningError) -> crate::c_types::Str {
4179 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.err;
4180 inner_val.as_str().into()
4182 /// A human-readable message describing the error
4184 pub extern "C" fn LightningError_set_err(this_ptr: &mut LightningError, mut val: crate::c_types::Str) {
4185 unsafe { &mut *this_ptr.inner }.err = val.into_string();
4187 /// The action which should be taken against the offending peer.
4189 pub extern "C" fn LightningError_get_action(this_ptr: &LightningError) -> crate::lightning::ln::msgs::ErrorAction {
4190 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.action;
4191 crate::lightning::ln::msgs::ErrorAction::from_native(inner_val)
4193 /// The action which should be taken against the offending peer.
4195 pub extern "C" fn LightningError_set_action(this_ptr: &mut LightningError, mut val: crate::lightning::ln::msgs::ErrorAction) {
4196 unsafe { &mut *this_ptr.inner }.action = val.into_native();
4198 /// Constructs a new LightningError given each field
4201 pub extern "C" fn LightningError_new(mut err_arg: crate::c_types::Str, mut action_arg: crate::lightning::ln::msgs::ErrorAction) -> LightningError {
4202 LightningError { inner: Box::into_raw(Box::new(nativeLightningError {
4203 err: err_arg.into_string(),
4204 action: action_arg.into_native(),
4205 })), is_owned: true }
4207 impl Clone for LightningError {
4208 fn clone(&self) -> Self {
4210 inner: if <*mut nativeLightningError>::is_null(self.inner) { std::ptr::null_mut() } else {
4211 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
4217 /// Used only if an object of this type is returned as a trait impl by a method
4218 pub(crate) extern "C" fn LightningError_clone_void(this_ptr: *const c_void) -> *mut c_void {
4219 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeLightningError)).clone() })) as *mut c_void
4222 /// Creates a copy of the LightningError
4223 pub extern "C" fn LightningError_clone(orig: &LightningError) -> LightningError {
4227 use lightning::ln::msgs::CommitmentUpdate as nativeCommitmentUpdateImport;
4228 type nativeCommitmentUpdate = nativeCommitmentUpdateImport;
4230 /// Struct used to return values from revoke_and_ack messages, containing a bunch of commitment
4231 /// transaction updates if they were pending.
4234 pub struct CommitmentUpdate {
4235 /// A pointer to the opaque Rust object.
4237 /// Nearly everywhere, inner must be non-null, however in places where
4238 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
4239 pub inner: *mut nativeCommitmentUpdate,
4240 /// Indicates that this is the only struct which contains the same pointer.
4242 /// Rust functions which take ownership of an object provided via an argument require
4243 /// this to be true and invalidate the object pointed to by inner.
4247 impl Drop for CommitmentUpdate {
4248 fn drop(&mut self) {
4249 if self.is_owned && !<*mut nativeCommitmentUpdate>::is_null(self.inner) {
4250 let _ = unsafe { Box::from_raw(self.inner) };
4254 /// Frees any resources used by the CommitmentUpdate, if is_owned is set and inner is non-NULL.
4256 pub extern "C" fn CommitmentUpdate_free(this_obj: CommitmentUpdate) { }
4258 /// Used only if an object of this type is returned as a trait impl by a method
4259 extern "C" fn CommitmentUpdate_free_void(this_ptr: *mut c_void) {
4260 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeCommitmentUpdate); }
4263 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
4264 impl CommitmentUpdate {
4265 pub(crate) fn take_inner(mut self) -> *mut nativeCommitmentUpdate {
4266 assert!(self.is_owned);
4267 let ret = self.inner;
4268 self.inner = std::ptr::null_mut();
4272 /// update_add_htlc messages which should be sent
4274 pub extern "C" fn CommitmentUpdate_set_update_add_htlcs(this_ptr: &mut CommitmentUpdate, mut val: crate::c_types::derived::CVec_UpdateAddHTLCZ) {
4275 let mut local_val = Vec::new(); for mut item in val.into_rust().drain(..) { local_val.push( { *unsafe { Box::from_raw(item.take_inner()) } }); };
4276 unsafe { &mut *this_ptr.inner }.update_add_htlcs = local_val;
4278 /// update_fulfill_htlc messages which should be sent
4280 pub extern "C" fn CommitmentUpdate_set_update_fulfill_htlcs(this_ptr: &mut CommitmentUpdate, mut val: crate::c_types::derived::CVec_UpdateFulfillHTLCZ) {
4281 let mut local_val = Vec::new(); for mut item in val.into_rust().drain(..) { local_val.push( { *unsafe { Box::from_raw(item.take_inner()) } }); };
4282 unsafe { &mut *this_ptr.inner }.update_fulfill_htlcs = local_val;
4284 /// update_fail_htlc messages which should be sent
4286 pub extern "C" fn CommitmentUpdate_set_update_fail_htlcs(this_ptr: &mut CommitmentUpdate, mut val: crate::c_types::derived::CVec_UpdateFailHTLCZ) {
4287 let mut local_val = Vec::new(); for mut item in val.into_rust().drain(..) { local_val.push( { *unsafe { Box::from_raw(item.take_inner()) } }); };
4288 unsafe { &mut *this_ptr.inner }.update_fail_htlcs = local_val;
4290 /// update_fail_malformed_htlc messages which should be sent
4292 pub extern "C" fn CommitmentUpdate_set_update_fail_malformed_htlcs(this_ptr: &mut CommitmentUpdate, mut val: crate::c_types::derived::CVec_UpdateFailMalformedHTLCZ) {
4293 let mut local_val = Vec::new(); for mut item in val.into_rust().drain(..) { local_val.push( { *unsafe { Box::from_raw(item.take_inner()) } }); };
4294 unsafe { &mut *this_ptr.inner }.update_fail_malformed_htlcs = local_val;
4296 /// An update_fee message which should be sent
4298 pub extern "C" fn CommitmentUpdate_get_update_fee(this_ptr: &CommitmentUpdate) -> crate::lightning::ln::msgs::UpdateFee {
4299 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.update_fee;
4300 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 };
4303 /// An update_fee message which should be sent
4305 pub extern "C" fn CommitmentUpdate_set_update_fee(this_ptr: &mut CommitmentUpdate, mut val: crate::lightning::ln::msgs::UpdateFee) {
4306 let mut local_val = if val.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(val.take_inner()) } }) };
4307 unsafe { &mut *this_ptr.inner }.update_fee = local_val;
4309 /// Finally, the commitment_signed message which should be sent
4311 pub extern "C" fn CommitmentUpdate_get_commitment_signed(this_ptr: &CommitmentUpdate) -> crate::lightning::ln::msgs::CommitmentSigned {
4312 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.commitment_signed;
4313 crate::lightning::ln::msgs::CommitmentSigned { inner: unsafe { ( (&(*inner_val) as *const _) as *mut _) }, is_owned: false }
4315 /// Finally, the commitment_signed message which should be sent
4317 pub extern "C" fn CommitmentUpdate_set_commitment_signed(this_ptr: &mut CommitmentUpdate, mut val: crate::lightning::ln::msgs::CommitmentSigned) {
4318 unsafe { &mut *this_ptr.inner }.commitment_signed = *unsafe { Box::from_raw(val.take_inner()) };
4320 /// Constructs a new CommitmentUpdate given each field
4323 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 {
4324 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()) } }); };
4325 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()) } }); };
4326 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()) } }); };
4327 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()) } }); };
4328 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()) } }) };
4329 CommitmentUpdate { inner: Box::into_raw(Box::new(nativeCommitmentUpdate {
4330 update_add_htlcs: local_update_add_htlcs_arg,
4331 update_fulfill_htlcs: local_update_fulfill_htlcs_arg,
4332 update_fail_htlcs: local_update_fail_htlcs_arg,
4333 update_fail_malformed_htlcs: local_update_fail_malformed_htlcs_arg,
4334 update_fee: local_update_fee_arg,
4335 commitment_signed: *unsafe { Box::from_raw(commitment_signed_arg.take_inner()) },
4336 })), is_owned: true }
4338 impl Clone for CommitmentUpdate {
4339 fn clone(&self) -> Self {
4341 inner: if <*mut nativeCommitmentUpdate>::is_null(self.inner) { std::ptr::null_mut() } else {
4342 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
4348 /// Used only if an object of this type is returned as a trait impl by a method
4349 pub(crate) extern "C" fn CommitmentUpdate_clone_void(this_ptr: *const c_void) -> *mut c_void {
4350 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeCommitmentUpdate)).clone() })) as *mut c_void
4353 /// Creates a copy of the CommitmentUpdate
4354 pub extern "C" fn CommitmentUpdate_clone(orig: &CommitmentUpdate) -> CommitmentUpdate {
4357 /// The information we received from a peer along the route of a payment we originated. This is
4358 /// returned by ChannelMessageHandler::handle_update_fail_htlc to be passed into
4359 /// RoutingMessageHandler::handle_htlc_fail_channel_update to update our network map.
4363 pub enum HTLCFailChannelUpdate {
4364 /// We received an error which included a full ChannelUpdate message.
4365 ChannelUpdateMessage {
4366 /// The unwrapped message we received
4367 msg: crate::lightning::ln::msgs::ChannelUpdate,
4369 /// We received an error which indicated only that a channel has been closed
4371 /// The short_channel_id which has now closed.
4372 short_channel_id: u64,
4373 /// when this true, this channel should be permanently removed from the
4374 /// consideration. Otherwise, this channel can be restored as new channel_update is received
4377 /// We received an error which indicated only that a node has failed
4379 /// The node_id that has failed.
4380 node_id: crate::c_types::PublicKey,
4381 /// when this true, node should be permanently removed from the
4382 /// consideration. Otherwise, the channels connected to this node can be
4383 /// restored as new channel_update is received
4387 use lightning::ln::msgs::HTLCFailChannelUpdate as nativeHTLCFailChannelUpdate;
4388 impl HTLCFailChannelUpdate {
4390 pub(crate) fn to_native(&self) -> nativeHTLCFailChannelUpdate {
4392 HTLCFailChannelUpdate::ChannelUpdateMessage {ref msg, } => {
4393 let mut msg_nonref = (*msg).clone();
4394 nativeHTLCFailChannelUpdate::ChannelUpdateMessage {
4395 msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) },
4398 HTLCFailChannelUpdate::ChannelClosed {ref short_channel_id, ref is_permanent, } => {
4399 let mut short_channel_id_nonref = (*short_channel_id).clone();
4400 let mut is_permanent_nonref = (*is_permanent).clone();
4401 nativeHTLCFailChannelUpdate::ChannelClosed {
4402 short_channel_id: short_channel_id_nonref,
4403 is_permanent: is_permanent_nonref,
4406 HTLCFailChannelUpdate::NodeFailure {ref node_id, ref is_permanent, } => {
4407 let mut node_id_nonref = (*node_id).clone();
4408 let mut is_permanent_nonref = (*is_permanent).clone();
4409 nativeHTLCFailChannelUpdate::NodeFailure {
4410 node_id: node_id_nonref.into_rust(),
4411 is_permanent: is_permanent_nonref,
4417 pub(crate) fn into_native(self) -> nativeHTLCFailChannelUpdate {
4419 HTLCFailChannelUpdate::ChannelUpdateMessage {mut msg, } => {
4420 nativeHTLCFailChannelUpdate::ChannelUpdateMessage {
4421 msg: *unsafe { Box::from_raw(msg.take_inner()) },
4424 HTLCFailChannelUpdate::ChannelClosed {mut short_channel_id, mut is_permanent, } => {
4425 nativeHTLCFailChannelUpdate::ChannelClosed {
4426 short_channel_id: short_channel_id,
4427 is_permanent: is_permanent,
4430 HTLCFailChannelUpdate::NodeFailure {mut node_id, mut is_permanent, } => {
4431 nativeHTLCFailChannelUpdate::NodeFailure {
4432 node_id: node_id.into_rust(),
4433 is_permanent: is_permanent,
4439 pub(crate) fn from_native(native: &nativeHTLCFailChannelUpdate) -> Self {
4441 nativeHTLCFailChannelUpdate::ChannelUpdateMessage {ref msg, } => {
4442 let mut msg_nonref = (*msg).clone();
4443 HTLCFailChannelUpdate::ChannelUpdateMessage {
4444 msg: crate::lightning::ln::msgs::ChannelUpdate { inner: Box::into_raw(Box::new(msg_nonref)), is_owned: true },
4447 nativeHTLCFailChannelUpdate::ChannelClosed {ref short_channel_id, ref is_permanent, } => {
4448 let mut short_channel_id_nonref = (*short_channel_id).clone();
4449 let mut is_permanent_nonref = (*is_permanent).clone();
4450 HTLCFailChannelUpdate::ChannelClosed {
4451 short_channel_id: short_channel_id_nonref,
4452 is_permanent: is_permanent_nonref,
4455 nativeHTLCFailChannelUpdate::NodeFailure {ref node_id, ref is_permanent, } => {
4456 let mut node_id_nonref = (*node_id).clone();
4457 let mut is_permanent_nonref = (*is_permanent).clone();
4458 HTLCFailChannelUpdate::NodeFailure {
4459 node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref),
4460 is_permanent: is_permanent_nonref,
4466 pub(crate) fn native_into(native: nativeHTLCFailChannelUpdate) -> Self {
4468 nativeHTLCFailChannelUpdate::ChannelUpdateMessage {mut msg, } => {
4469 HTLCFailChannelUpdate::ChannelUpdateMessage {
4470 msg: crate::lightning::ln::msgs::ChannelUpdate { inner: Box::into_raw(Box::new(msg)), is_owned: true },
4473 nativeHTLCFailChannelUpdate::ChannelClosed {mut short_channel_id, mut is_permanent, } => {
4474 HTLCFailChannelUpdate::ChannelClosed {
4475 short_channel_id: short_channel_id,
4476 is_permanent: is_permanent,
4479 nativeHTLCFailChannelUpdate::NodeFailure {mut node_id, mut is_permanent, } => {
4480 HTLCFailChannelUpdate::NodeFailure {
4481 node_id: crate::c_types::PublicKey::from_rust(&node_id),
4482 is_permanent: is_permanent,
4488 /// Frees any resources used by the HTLCFailChannelUpdate
4490 pub extern "C" fn HTLCFailChannelUpdate_free(this_ptr: HTLCFailChannelUpdate) { }
4491 /// Creates a copy of the HTLCFailChannelUpdate
4493 pub extern "C" fn HTLCFailChannelUpdate_clone(orig: &HTLCFailChannelUpdate) -> HTLCFailChannelUpdate {
4496 /// A trait to describe an object which can receive channel messages.
4498 /// Messages MAY be called in parallel when they originate from different their_node_ids, however
4499 /// they MUST NOT be called in parallel when the two calls have the same their_node_id.
4501 pub struct ChannelMessageHandler {
4502 /// An opaque pointer which is passed to your function implementations as an argument.
4503 /// This has no meaning in the LDK, and can be NULL or any other value.
4504 pub this_arg: *mut c_void,
4505 /// Handle an incoming open_channel message from the given peer.
4506 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),
4507 /// Handle an incoming accept_channel message from the given peer.
4508 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),
4509 /// Handle an incoming funding_created message from the given peer.
4510 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),
4511 /// Handle an incoming funding_signed message from the given peer.
4512 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),
4513 /// Handle an incoming funding_locked message from the given peer.
4514 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),
4515 /// Handle an incoming shutdown message from the given peer.
4516 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),
4517 /// Handle an incoming closing_signed message from the given peer.
4518 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),
4519 /// Handle an incoming update_add_htlc message from the given peer.
4520 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),
4521 /// Handle an incoming update_fulfill_htlc message from the given peer.
4522 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),
4523 /// Handle an incoming update_fail_htlc message from the given peer.
4524 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),
4525 /// Handle an incoming update_fail_malformed_htlc message from the given peer.
4526 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),
4527 /// Handle an incoming commitment_signed message from the given peer.
4528 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),
4529 /// Handle an incoming revoke_and_ack message from the given peer.
4530 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),
4531 /// Handle an incoming update_fee message from the given peer.
4532 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),
4533 /// Handle an incoming announcement_signatures message from the given peer.
4534 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),
4535 /// Indicates a connection to the peer failed/an existing connection was lost. If no connection
4536 /// is believed to be possible in the future (eg they're sending us messages we don't
4537 /// understand or indicate they require unknown feature bits), no_connection_possible is set
4538 /// and any outstanding channels should be failed.
4539 pub peer_disconnected: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, no_connection_possible: bool),
4540 /// Handle a peer reconnecting, possibly generating channel_reestablish message(s).
4541 pub peer_connected: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::Init),
4542 /// Handle an incoming channel_reestablish message from the given peer.
4543 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),
4544 /// Handle an incoming channel update from the given peer.
4545 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),
4546 /// Handle an incoming error message from the given peer.
4547 pub handle_error: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::ErrorMessage),
4548 /// Implementation of MessageSendEventsProvider for this object.
4549 pub MessageSendEventsProvider: crate::lightning::util::events::MessageSendEventsProvider,
4550 /// Frees any resources associated with this object given its this_arg pointer.
4551 /// Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
4552 pub free: Option<extern "C" fn(this_arg: *mut c_void)>,
4554 unsafe impl Send for ChannelMessageHandler {}
4555 unsafe impl Sync for ChannelMessageHandler {}
4556 impl lightning::util::events::MessageSendEventsProvider for ChannelMessageHandler {
4557 fn get_and_clear_pending_msg_events(&self) -> Vec<lightning::util::events::MessageSendEvent> {
4558 let mut ret = (self.MessageSendEventsProvider.get_and_clear_pending_msg_events)(self.this_arg);
4559 let mut local_ret = Vec::new(); for mut item in ret.into_rust().drain(..) { local_ret.push( { item.into_native() }); };
4564 use lightning::ln::msgs::ChannelMessageHandler as rustChannelMessageHandler;
4565 impl rustChannelMessageHandler for ChannelMessageHandler {
4566 fn handle_open_channel(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut their_features: lightning::ln::features::InitFeatures, mut msg: &lightning::ln::msgs::OpenChannel) {
4567 (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 })
4569 fn handle_accept_channel(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut their_features: lightning::ln::features::InitFeatures, mut msg: &lightning::ln::msgs::AcceptChannel) {
4570 (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 })
4572 fn handle_funding_created(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut msg: &lightning::ln::msgs::FundingCreated) {
4573 (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 })
4575 fn handle_funding_signed(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut msg: &lightning::ln::msgs::FundingSigned) {
4576 (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 })
4578 fn handle_funding_locked(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut msg: &lightning::ln::msgs::FundingLocked) {
4579 (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 })
4581 fn handle_shutdown(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut their_features: &lightning::ln::features::InitFeatures, mut msg: &lightning::ln::msgs::Shutdown) {
4582 (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 })
4584 fn handle_closing_signed(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut msg: &lightning::ln::msgs::ClosingSigned) {
4585 (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 })
4587 fn handle_update_add_htlc(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut msg: &lightning::ln::msgs::UpdateAddHTLC) {
4588 (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 })
4590 fn handle_update_fulfill_htlc(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut msg: &lightning::ln::msgs::UpdateFulfillHTLC) {
4591 (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 })
4593 fn handle_update_fail_htlc(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut msg: &lightning::ln::msgs::UpdateFailHTLC) {
4594 (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 })
4596 fn handle_update_fail_malformed_htlc(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut msg: &lightning::ln::msgs::UpdateFailMalformedHTLC) {
4597 (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 })
4599 fn handle_commitment_signed(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut msg: &lightning::ln::msgs::CommitmentSigned) {
4600 (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 })
4602 fn handle_revoke_and_ack(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut msg: &lightning::ln::msgs::RevokeAndACK) {
4603 (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 })
4605 fn handle_update_fee(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut msg: &lightning::ln::msgs::UpdateFee) {
4606 (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 })
4608 fn handle_announcement_signatures(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut msg: &lightning::ln::msgs::AnnouncementSignatures) {
4609 (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 })
4611 fn peer_disconnected(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut no_connection_possible: bool) {
4612 (self.peer_disconnected)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), no_connection_possible)
4614 fn peer_connected(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut msg: &lightning::ln::msgs::Init) {
4615 (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 })
4617 fn handle_channel_reestablish(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut msg: &lightning::ln::msgs::ChannelReestablish) {
4618 (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 })
4620 fn handle_channel_update(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut msg: &lightning::ln::msgs::ChannelUpdate) {
4621 (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 })
4623 fn handle_error(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut msg: &lightning::ln::msgs::ErrorMessage) {
4624 (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 })
4628 // We're essentially a pointer already, or at least a set of pointers, so allow us to be used
4629 // directly as a Deref trait in higher-level structs:
4630 impl std::ops::Deref for ChannelMessageHandler {
4632 fn deref(&self) -> &Self {
4636 /// Calls the free function if one is set
4638 pub extern "C" fn ChannelMessageHandler_free(this_ptr: ChannelMessageHandler) { }
4639 impl Drop for ChannelMessageHandler {
4640 fn drop(&mut self) {
4641 if let Some(f) = self.free {
4646 /// A trait to describe an object which can receive routing messages.
4648 /// # Implementor DoS Warnings
4650 /// For `gossip_queries` messages there are potential DoS vectors when handling
4651 /// inbound queries. Implementors using an on-disk network graph should be aware of
4652 /// repeated disk I/O for queries accessing different parts of the network graph.
4654 pub struct RoutingMessageHandler {
4655 /// An opaque pointer which is passed to your function implementations as an argument.
4656 /// This has no meaning in the LDK, and can be NULL or any other value.
4657 pub this_arg: *mut c_void,
4658 /// Handle an incoming node_announcement message, returning true if it should be forwarded on,
4659 /// false or returning an Err otherwise.
4661 pub handle_node_announcement: extern "C" fn (this_arg: *const c_void, msg: &crate::lightning::ln::msgs::NodeAnnouncement) -> crate::c_types::derived::CResult_boolLightningErrorZ,
4662 /// Handle a channel_announcement message, returning true if it should be forwarded on, false
4663 /// or returning an Err otherwise.
4665 pub handle_channel_announcement: extern "C" fn (this_arg: *const c_void, msg: &crate::lightning::ln::msgs::ChannelAnnouncement) -> crate::c_types::derived::CResult_boolLightningErrorZ,
4666 /// Handle an incoming channel_update message, returning true if it should be forwarded on,
4667 /// false or returning an Err otherwise.
4669 pub handle_channel_update: extern "C" fn (this_arg: *const c_void, msg: &crate::lightning::ln::msgs::ChannelUpdate) -> crate::c_types::derived::CResult_boolLightningErrorZ,
4670 /// Handle some updates to the route graph that we learned due to an outbound failed payment.
4671 pub handle_htlc_fail_channel_update: extern "C" fn (this_arg: *const c_void, update: &crate::lightning::ln::msgs::HTLCFailChannelUpdate),
4672 /// Gets a subset of the channel announcements and updates required to dump our routing table
4673 /// to a remote node, starting at the short_channel_id indicated by starting_point and
4674 /// including the batch_amount entries immediately higher in numerical value than starting_point.
4676 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,
4677 /// Gets a subset of the node announcements required to dump our routing table to a remote node,
4678 /// starting at the node *after* the provided publickey and including batch_amount entries
4679 /// immediately higher (as defined by <PublicKey as Ord>::cmp) than starting_point.
4680 /// If None is provided for starting_point, we start at the first node.
4682 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,
4683 /// Called when a connection is established with a peer. This can be used to
4684 /// perform routing table synchronization using a strategy defined by the
4686 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),
4687 /// Handles the reply of a query we initiated to learn about channels
4688 /// for a given range of blocks. We can expect to receive one or more
4689 /// replies to a single query.
4691 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,
4692 /// Handles the reply of a query we initiated asking for routing gossip
4693 /// messages for a list of channels. We should receive this message when
4694 /// a node has completed its best effort to send us the pertaining routing
4695 /// gossip messages.
4697 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,
4698 /// Handles when a peer asks us to send a list of short_channel_ids
4699 /// for the requested range of blocks.
4701 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,
4702 /// Handles when a peer asks us to send routing gossip messages for a
4703 /// list of short_channel_ids.
4705 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,
4706 /// Implementation of MessageSendEventsProvider for this object.
4707 pub MessageSendEventsProvider: crate::lightning::util::events::MessageSendEventsProvider,
4708 /// Frees any resources associated with this object given its this_arg pointer.
4709 /// Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
4710 pub free: Option<extern "C" fn(this_arg: *mut c_void)>,
4712 unsafe impl Send for RoutingMessageHandler {}
4713 unsafe impl Sync for RoutingMessageHandler {}
4714 impl lightning::util::events::MessageSendEventsProvider for RoutingMessageHandler {
4715 fn get_and_clear_pending_msg_events(&self) -> Vec<lightning::util::events::MessageSendEvent> {
4716 let mut ret = (self.MessageSendEventsProvider.get_and_clear_pending_msg_events)(self.this_arg);
4717 let mut local_ret = Vec::new(); for mut item in ret.into_rust().drain(..) { local_ret.push( { item.into_native() }); };
4722 use lightning::ln::msgs::RoutingMessageHandler as rustRoutingMessageHandler;
4723 impl rustRoutingMessageHandler for RoutingMessageHandler {
4724 fn handle_node_announcement(&self, mut msg: &lightning::ln::msgs::NodeAnnouncement) -> Result<bool, lightning::ln::msgs::LightningError> {
4725 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 });
4726 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()) } })};
4729 fn handle_channel_announcement(&self, mut msg: &lightning::ln::msgs::ChannelAnnouncement) -> Result<bool, lightning::ln::msgs::LightningError> {
4730 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 });
4731 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()) } })};
4734 fn handle_channel_update(&self, mut msg: &lightning::ln::msgs::ChannelUpdate) -> Result<bool, lightning::ln::msgs::LightningError> {
4735 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 });
4736 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()) } })};
4739 fn handle_htlc_fail_channel_update(&self, mut update: &lightning::ln::msgs::HTLCFailChannelUpdate) {
4740 (self.handle_htlc_fail_channel_update)(self.this_arg, &crate::lightning::ln::msgs::HTLCFailChannelUpdate::from_native(update))
4742 fn get_next_channel_announcements(&self, mut starting_point: u64, mut batch_amount: u8) -> Vec<(lightning::ln::msgs::ChannelAnnouncement, Option<lightning::ln::msgs::ChannelUpdate>, Option<lightning::ln::msgs::ChannelUpdate>)> {
4743 let mut ret = (self.get_next_channel_announcements)(self.this_arg, starting_point, batch_amount);
4744 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 }); };
4747 fn get_next_node_announcements(&self, mut starting_point: Option<&bitcoin::secp256k1::key::PublicKey>, mut batch_amount: u8) -> Vec<lightning::ln::msgs::NodeAnnouncement> {
4748 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())) } };
4749 let mut ret = (self.get_next_node_announcements)(self.this_arg, local_starting_point, batch_amount);
4750 let mut local_ret = Vec::new(); for mut item in ret.into_rust().drain(..) { local_ret.push( { *unsafe { Box::from_raw(item.take_inner()) } }); };
4753 fn sync_routing_table(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut init: &lightning::ln::msgs::Init) {
4754 (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 })
4756 fn handle_reply_channel_range(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut msg: lightning::ln::msgs::ReplyChannelRange) -> Result<(), lightning::ln::msgs::LightningError> {
4757 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 });
4758 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()) } })};
4761 fn handle_reply_short_channel_ids_end(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut msg: lightning::ln::msgs::ReplyShortChannelIdsEnd) -> Result<(), lightning::ln::msgs::LightningError> {
4762 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 });
4763 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()) } })};
4766 fn handle_query_channel_range(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut msg: lightning::ln::msgs::QueryChannelRange) -> Result<(), lightning::ln::msgs::LightningError> {
4767 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 });
4768 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()) } })};
4771 fn handle_query_short_channel_ids(&self, mut their_node_id: &bitcoin::secp256k1::key::PublicKey, mut msg: lightning::ln::msgs::QueryShortChannelIds) -> Result<(), lightning::ln::msgs::LightningError> {
4772 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 });
4773 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()) } })};
4778 // We're essentially a pointer already, or at least a set of pointers, so allow us to be used
4779 // directly as a Deref trait in higher-level structs:
4780 impl std::ops::Deref for RoutingMessageHandler {
4782 fn deref(&self) -> &Self {
4786 /// Calls the free function if one is set
4788 pub extern "C" fn RoutingMessageHandler_free(this_ptr: RoutingMessageHandler) { }
4789 impl Drop for RoutingMessageHandler {
4790 fn drop(&mut self) {
4791 if let Some(f) = self.free {
4796 mod fuzzy_internal_msgs {
4798 use std::str::FromStr;
4799 use std::ffi::c_void;
4800 use bitcoin::hashes::Hash;
4801 use crate::c_types::*;
4805 /// Serialize the AcceptChannel object into a byte array which can be read by AcceptChannel_read
4806 pub extern "C" fn AcceptChannel_write(obj: &AcceptChannel) -> crate::c_types::derived::CVec_u8Z {
4807 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
4810 pub(crate) extern "C" fn AcceptChannel_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
4811 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeAcceptChannel) })
4814 /// Read a AcceptChannel from a byte array, created by AcceptChannel_write
4815 pub extern "C" fn AcceptChannel_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_AcceptChannelDecodeErrorZ {
4816 let res = crate::c_types::deserialize_obj(ser);
4817 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() };
4821 /// Serialize the AnnouncementSignatures object into a byte array which can be read by AnnouncementSignatures_read
4822 pub extern "C" fn AnnouncementSignatures_write(obj: &AnnouncementSignatures) -> crate::c_types::derived::CVec_u8Z {
4823 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
4826 pub(crate) extern "C" fn AnnouncementSignatures_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
4827 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeAnnouncementSignatures) })
4830 /// Read a AnnouncementSignatures from a byte array, created by AnnouncementSignatures_write
4831 pub extern "C" fn AnnouncementSignatures_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_AnnouncementSignaturesDecodeErrorZ {
4832 let res = crate::c_types::deserialize_obj(ser);
4833 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() };
4837 /// Serialize the ChannelReestablish object into a byte array which can be read by ChannelReestablish_read
4838 pub extern "C" fn ChannelReestablish_write(obj: &ChannelReestablish) -> crate::c_types::derived::CVec_u8Z {
4839 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
4842 pub(crate) extern "C" fn ChannelReestablish_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
4843 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeChannelReestablish) })
4846 /// Read a ChannelReestablish from a byte array, created by ChannelReestablish_write
4847 pub extern "C" fn ChannelReestablish_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ChannelReestablishDecodeErrorZ {
4848 let res = crate::c_types::deserialize_obj(ser);
4849 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() };
4853 /// Serialize the ClosingSigned object into a byte array which can be read by ClosingSigned_read
4854 pub extern "C" fn ClosingSigned_write(obj: &ClosingSigned) -> crate::c_types::derived::CVec_u8Z {
4855 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
4858 pub(crate) extern "C" fn ClosingSigned_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
4859 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeClosingSigned) })
4862 /// Read a ClosingSigned from a byte array, created by ClosingSigned_write
4863 pub extern "C" fn ClosingSigned_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ClosingSignedDecodeErrorZ {
4864 let res = crate::c_types::deserialize_obj(ser);
4865 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() };
4869 /// Serialize the CommitmentSigned object into a byte array which can be read by CommitmentSigned_read
4870 pub extern "C" fn CommitmentSigned_write(obj: &CommitmentSigned) -> crate::c_types::derived::CVec_u8Z {
4871 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
4874 pub(crate) extern "C" fn CommitmentSigned_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
4875 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeCommitmentSigned) })
4878 /// Read a CommitmentSigned from a byte array, created by CommitmentSigned_write
4879 pub extern "C" fn CommitmentSigned_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_CommitmentSignedDecodeErrorZ {
4880 let res = crate::c_types::deserialize_obj(ser);
4881 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() };
4885 /// Serialize the FundingCreated object into a byte array which can be read by FundingCreated_read
4886 pub extern "C" fn FundingCreated_write(obj: &FundingCreated) -> crate::c_types::derived::CVec_u8Z {
4887 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
4890 pub(crate) extern "C" fn FundingCreated_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
4891 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeFundingCreated) })
4894 /// Read a FundingCreated from a byte array, created by FundingCreated_write
4895 pub extern "C" fn FundingCreated_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_FundingCreatedDecodeErrorZ {
4896 let res = crate::c_types::deserialize_obj(ser);
4897 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() };
4901 /// Serialize the FundingSigned object into a byte array which can be read by FundingSigned_read
4902 pub extern "C" fn FundingSigned_write(obj: &FundingSigned) -> crate::c_types::derived::CVec_u8Z {
4903 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
4906 pub(crate) extern "C" fn FundingSigned_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
4907 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeFundingSigned) })
4910 /// Read a FundingSigned from a byte array, created by FundingSigned_write
4911 pub extern "C" fn FundingSigned_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_FundingSignedDecodeErrorZ {
4912 let res = crate::c_types::deserialize_obj(ser);
4913 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() };
4917 /// Serialize the FundingLocked object into a byte array which can be read by FundingLocked_read
4918 pub extern "C" fn FundingLocked_write(obj: &FundingLocked) -> crate::c_types::derived::CVec_u8Z {
4919 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
4922 pub(crate) extern "C" fn FundingLocked_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
4923 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeFundingLocked) })
4926 /// Read a FundingLocked from a byte array, created by FundingLocked_write
4927 pub extern "C" fn FundingLocked_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_FundingLockedDecodeErrorZ {
4928 let res = crate::c_types::deserialize_obj(ser);
4929 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() };
4933 /// Serialize the Init object into a byte array which can be read by Init_read
4934 pub extern "C" fn Init_write(obj: &Init) -> crate::c_types::derived::CVec_u8Z {
4935 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
4938 pub(crate) extern "C" fn Init_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
4939 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeInit) })
4942 /// Read a Init from a byte array, created by Init_write
4943 pub extern "C" fn Init_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_InitDecodeErrorZ {
4944 let res = crate::c_types::deserialize_obj(ser);
4945 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() };
4949 /// Serialize the OpenChannel object into a byte array which can be read by OpenChannel_read
4950 pub extern "C" fn OpenChannel_write(obj: &OpenChannel) -> crate::c_types::derived::CVec_u8Z {
4951 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
4954 pub(crate) extern "C" fn OpenChannel_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
4955 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeOpenChannel) })
4958 /// Read a OpenChannel from a byte array, created by OpenChannel_write
4959 pub extern "C" fn OpenChannel_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_OpenChannelDecodeErrorZ {
4960 let res = crate::c_types::deserialize_obj(ser);
4961 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() };
4965 /// Serialize the RevokeAndACK object into a byte array which can be read by RevokeAndACK_read
4966 pub extern "C" fn RevokeAndACK_write(obj: &RevokeAndACK) -> crate::c_types::derived::CVec_u8Z {
4967 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
4970 pub(crate) extern "C" fn RevokeAndACK_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
4971 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeRevokeAndACK) })
4974 /// Read a RevokeAndACK from a byte array, created by RevokeAndACK_write
4975 pub extern "C" fn RevokeAndACK_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_RevokeAndACKDecodeErrorZ {
4976 let res = crate::c_types::deserialize_obj(ser);
4977 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() };
4981 /// Serialize the Shutdown object into a byte array which can be read by Shutdown_read
4982 pub extern "C" fn Shutdown_write(obj: &Shutdown) -> crate::c_types::derived::CVec_u8Z {
4983 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
4986 pub(crate) extern "C" fn Shutdown_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
4987 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeShutdown) })
4990 /// Read a Shutdown from a byte array, created by Shutdown_write
4991 pub extern "C" fn Shutdown_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ShutdownDecodeErrorZ {
4992 let res = crate::c_types::deserialize_obj(ser);
4993 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() };
4997 /// Serialize the UpdateFailHTLC object into a byte array which can be read by UpdateFailHTLC_read
4998 pub extern "C" fn UpdateFailHTLC_write(obj: &UpdateFailHTLC) -> crate::c_types::derived::CVec_u8Z {
4999 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
5002 pub(crate) extern "C" fn UpdateFailHTLC_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
5003 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeUpdateFailHTLC) })
5006 /// Read a UpdateFailHTLC from a byte array, created by UpdateFailHTLC_write
5007 pub extern "C" fn UpdateFailHTLC_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_UpdateFailHTLCDecodeErrorZ {
5008 let res = crate::c_types::deserialize_obj(ser);
5009 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() };
5013 /// Serialize the UpdateFailMalformedHTLC object into a byte array which can be read by UpdateFailMalformedHTLC_read
5014 pub extern "C" fn UpdateFailMalformedHTLC_write(obj: &UpdateFailMalformedHTLC) -> crate::c_types::derived::CVec_u8Z {
5015 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
5018 pub(crate) extern "C" fn UpdateFailMalformedHTLC_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
5019 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeUpdateFailMalformedHTLC) })
5022 /// Read a UpdateFailMalformedHTLC from a byte array, created by UpdateFailMalformedHTLC_write
5023 pub extern "C" fn UpdateFailMalformedHTLC_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_UpdateFailMalformedHTLCDecodeErrorZ {
5024 let res = crate::c_types::deserialize_obj(ser);
5025 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() };
5029 /// Serialize the UpdateFee object into a byte array which can be read by UpdateFee_read
5030 pub extern "C" fn UpdateFee_write(obj: &UpdateFee) -> crate::c_types::derived::CVec_u8Z {
5031 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
5034 pub(crate) extern "C" fn UpdateFee_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
5035 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeUpdateFee) })
5038 /// Read a UpdateFee from a byte array, created by UpdateFee_write
5039 pub extern "C" fn UpdateFee_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_UpdateFeeDecodeErrorZ {
5040 let res = crate::c_types::deserialize_obj(ser);
5041 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() };
5045 /// Serialize the UpdateFulfillHTLC object into a byte array which can be read by UpdateFulfillHTLC_read
5046 pub extern "C" fn UpdateFulfillHTLC_write(obj: &UpdateFulfillHTLC) -> crate::c_types::derived::CVec_u8Z {
5047 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
5050 pub(crate) extern "C" fn UpdateFulfillHTLC_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
5051 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeUpdateFulfillHTLC) })
5054 /// Read a UpdateFulfillHTLC from a byte array, created by UpdateFulfillHTLC_write
5055 pub extern "C" fn UpdateFulfillHTLC_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_UpdateFulfillHTLCDecodeErrorZ {
5056 let res = crate::c_types::deserialize_obj(ser);
5057 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() };
5061 /// Serialize the UpdateAddHTLC object into a byte array which can be read by UpdateAddHTLC_read
5062 pub extern "C" fn UpdateAddHTLC_write(obj: &UpdateAddHTLC) -> crate::c_types::derived::CVec_u8Z {
5063 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
5066 pub(crate) extern "C" fn UpdateAddHTLC_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
5067 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeUpdateAddHTLC) })
5070 /// Read a UpdateAddHTLC from a byte array, created by UpdateAddHTLC_write
5071 pub extern "C" fn UpdateAddHTLC_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_UpdateAddHTLCDecodeErrorZ {
5072 let res = crate::c_types::deserialize_obj(ser);
5073 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() };
5077 /// Serialize the Ping object into a byte array which can be read by Ping_read
5078 pub extern "C" fn Ping_write(obj: &Ping) -> crate::c_types::derived::CVec_u8Z {
5079 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
5082 pub(crate) extern "C" fn Ping_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
5083 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativePing) })
5086 /// Read a Ping from a byte array, created by Ping_write
5087 pub extern "C" fn Ping_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_PingDecodeErrorZ {
5088 let res = crate::c_types::deserialize_obj(ser);
5089 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() };
5093 /// Serialize the Pong object into a byte array which can be read by Pong_read
5094 pub extern "C" fn Pong_write(obj: &Pong) -> crate::c_types::derived::CVec_u8Z {
5095 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
5098 pub(crate) extern "C" fn Pong_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
5099 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativePong) })
5102 /// Read a Pong from a byte array, created by Pong_write
5103 pub extern "C" fn Pong_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_PongDecodeErrorZ {
5104 let res = crate::c_types::deserialize_obj(ser);
5105 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() };
5109 /// Serialize the UnsignedChannelAnnouncement object into a byte array which can be read by UnsignedChannelAnnouncement_read
5110 pub extern "C" fn UnsignedChannelAnnouncement_write(obj: &UnsignedChannelAnnouncement) -> crate::c_types::derived::CVec_u8Z {
5111 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
5114 pub(crate) extern "C" fn UnsignedChannelAnnouncement_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
5115 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeUnsignedChannelAnnouncement) })
5118 /// Read a UnsignedChannelAnnouncement from a byte array, created by UnsignedChannelAnnouncement_write
5119 pub extern "C" fn UnsignedChannelAnnouncement_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_UnsignedChannelAnnouncementDecodeErrorZ {
5120 let res = crate::c_types::deserialize_obj(ser);
5121 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() };
5125 /// Serialize the ChannelAnnouncement object into a byte array which can be read by ChannelAnnouncement_read
5126 pub extern "C" fn ChannelAnnouncement_write(obj: &ChannelAnnouncement) -> crate::c_types::derived::CVec_u8Z {
5127 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
5130 pub(crate) extern "C" fn ChannelAnnouncement_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
5131 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeChannelAnnouncement) })
5134 /// Read a ChannelAnnouncement from a byte array, created by ChannelAnnouncement_write
5135 pub extern "C" fn ChannelAnnouncement_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ChannelAnnouncementDecodeErrorZ {
5136 let res = crate::c_types::deserialize_obj(ser);
5137 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() };
5141 /// Serialize the UnsignedChannelUpdate object into a byte array which can be read by UnsignedChannelUpdate_read
5142 pub extern "C" fn UnsignedChannelUpdate_write(obj: &UnsignedChannelUpdate) -> crate::c_types::derived::CVec_u8Z {
5143 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
5146 pub(crate) extern "C" fn UnsignedChannelUpdate_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
5147 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeUnsignedChannelUpdate) })
5150 /// Read a UnsignedChannelUpdate from a byte array, created by UnsignedChannelUpdate_write
5151 pub extern "C" fn UnsignedChannelUpdate_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_UnsignedChannelUpdateDecodeErrorZ {
5152 let res = crate::c_types::deserialize_obj(ser);
5153 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() };
5157 /// Serialize the ChannelUpdate object into a byte array which can be read by ChannelUpdate_read
5158 pub extern "C" fn ChannelUpdate_write(obj: &ChannelUpdate) -> crate::c_types::derived::CVec_u8Z {
5159 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
5162 pub(crate) extern "C" fn ChannelUpdate_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
5163 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeChannelUpdate) })
5166 /// Read a ChannelUpdate from a byte array, created by ChannelUpdate_write
5167 pub extern "C" fn ChannelUpdate_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ChannelUpdateDecodeErrorZ {
5168 let res = crate::c_types::deserialize_obj(ser);
5169 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() };
5173 /// Serialize the ErrorMessage object into a byte array which can be read by ErrorMessage_read
5174 pub extern "C" fn ErrorMessage_write(obj: &ErrorMessage) -> crate::c_types::derived::CVec_u8Z {
5175 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
5178 pub(crate) extern "C" fn ErrorMessage_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
5179 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeErrorMessage) })
5182 /// Read a ErrorMessage from a byte array, created by ErrorMessage_write
5183 pub extern "C" fn ErrorMessage_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ErrorMessageDecodeErrorZ {
5184 let res = crate::c_types::deserialize_obj(ser);
5185 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() };
5189 /// Serialize the UnsignedNodeAnnouncement object into a byte array which can be read by UnsignedNodeAnnouncement_read
5190 pub extern "C" fn UnsignedNodeAnnouncement_write(obj: &UnsignedNodeAnnouncement) -> crate::c_types::derived::CVec_u8Z {
5191 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
5194 pub(crate) extern "C" fn UnsignedNodeAnnouncement_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
5195 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeUnsignedNodeAnnouncement) })
5198 /// Read a UnsignedNodeAnnouncement from a byte array, created by UnsignedNodeAnnouncement_write
5199 pub extern "C" fn UnsignedNodeAnnouncement_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_UnsignedNodeAnnouncementDecodeErrorZ {
5200 let res = crate::c_types::deserialize_obj(ser);
5201 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() };
5205 /// Serialize the NodeAnnouncement object into a byte array which can be read by NodeAnnouncement_read
5206 pub extern "C" fn NodeAnnouncement_write(obj: &NodeAnnouncement) -> crate::c_types::derived::CVec_u8Z {
5207 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
5210 pub(crate) extern "C" fn NodeAnnouncement_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
5211 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeNodeAnnouncement) })
5214 /// Read a NodeAnnouncement from a byte array, created by NodeAnnouncement_write
5215 pub extern "C" fn NodeAnnouncement_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_NodeAnnouncementDecodeErrorZ {
5216 let res = crate::c_types::deserialize_obj(ser);
5217 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() };
5221 /// Read a QueryShortChannelIds from a byte array, created by QueryShortChannelIds_write
5222 pub extern "C" fn QueryShortChannelIds_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_QueryShortChannelIdsDecodeErrorZ {
5223 let res = crate::c_types::deserialize_obj(ser);
5224 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() };
5228 /// Serialize the QueryShortChannelIds object into a byte array which can be read by QueryShortChannelIds_read
5229 pub extern "C" fn QueryShortChannelIds_write(obj: &QueryShortChannelIds) -> crate::c_types::derived::CVec_u8Z {
5230 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
5233 pub(crate) extern "C" fn QueryShortChannelIds_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
5234 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeQueryShortChannelIds) })
5237 /// Read a ReplyShortChannelIdsEnd from a byte array, created by ReplyShortChannelIdsEnd_write
5238 pub extern "C" fn ReplyShortChannelIdsEnd_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ReplyShortChannelIdsEndDecodeErrorZ {
5239 let res = crate::c_types::deserialize_obj(ser);
5240 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() };
5244 /// Serialize the ReplyShortChannelIdsEnd object into a byte array which can be read by ReplyShortChannelIdsEnd_read
5245 pub extern "C" fn ReplyShortChannelIdsEnd_write(obj: &ReplyShortChannelIdsEnd) -> crate::c_types::derived::CVec_u8Z {
5246 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
5249 pub(crate) extern "C" fn ReplyShortChannelIdsEnd_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
5250 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeReplyShortChannelIdsEnd) })
5252 ///\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
5255 pub extern "C" fn QueryChannelRange_end_blocknum(this_arg: &QueryChannelRange) -> u32 {
5256 let mut ret = unsafe { &*this_arg.inner }.end_blocknum();
5261 /// Read a QueryChannelRange from a byte array, created by QueryChannelRange_write
5262 pub extern "C" fn QueryChannelRange_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_QueryChannelRangeDecodeErrorZ {
5263 let res = crate::c_types::deserialize_obj(ser);
5264 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() };
5268 /// Serialize the QueryChannelRange object into a byte array which can be read by QueryChannelRange_read
5269 pub extern "C" fn QueryChannelRange_write(obj: &QueryChannelRange) -> crate::c_types::derived::CVec_u8Z {
5270 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
5273 pub(crate) extern "C" fn QueryChannelRange_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
5274 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeQueryChannelRange) })
5277 /// Read a ReplyChannelRange from a byte array, created by ReplyChannelRange_write
5278 pub extern "C" fn ReplyChannelRange_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ReplyChannelRangeDecodeErrorZ {
5279 let res = crate::c_types::deserialize_obj(ser);
5280 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() };
5284 /// Serialize the ReplyChannelRange object into a byte array which can be read by ReplyChannelRange_read
5285 pub extern "C" fn ReplyChannelRange_write(obj: &ReplyChannelRange) -> crate::c_types::derived::CVec_u8Z {
5286 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
5289 pub(crate) extern "C" fn ReplyChannelRange_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
5290 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeReplyChannelRange) })
5293 /// Read a GossipTimestampFilter from a byte array, created by GossipTimestampFilter_write
5294 pub extern "C" fn GossipTimestampFilter_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_GossipTimestampFilterDecodeErrorZ {
5295 let res = crate::c_types::deserialize_obj(ser);
5296 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() };
5300 /// Serialize the GossipTimestampFilter object into a byte array which can be read by GossipTimestampFilter_read
5301 pub extern "C" fn GossipTimestampFilter_write(obj: &GossipTimestampFilter) -> crate::c_types::derived::CVec_u8Z {
5302 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
5305 pub(crate) extern "C" fn GossipTimestampFilter_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
5306 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeGossipTimestampFilter) })