1 //! Wire messages, traits representing wire message handlers, and a few error types live here.
3 //! For a normal node you probably don't need to use anything here, however, if you wish to split a
4 //! node into an internet-facing route/message socket handling daemon and a separate daemon (or
5 //! server entirely) which handles only channel-related messages you may wish to implement
6 //! ChannelMessageHandler yourself and use it to re-serialize messages and pass them across
9 //! Note that if you go with such an architecture (instead of passing raw socket events to a
10 //! non-internet-facing system) you trust the frontend internet-facing system to not lie about the
11 //! source node_id of the message, however this does allow you to significantly reduce bandwidth
12 //! between the systems as routing messages can represent a significant chunk of bandwidth usage
13 //! (especially for non-channel-publicly-announcing nodes). As an alternate design which avoids
14 //! this issue, if you have sufficient bidirectional bandwidth between your systems, you may send
15 //! raw socket events into your non-internet-facing system and then send routing events back to
16 //! track the network on the less-secure system.
19 use bitcoin::hashes::Hash;
20 use crate::c_types::*;
23 use lightning::ln::msgs::DecodeError as nativeDecodeErrorImport;
24 type nativeDecodeError = nativeDecodeErrorImport;
26 /// An error in decoding a message or struct.
29 pub struct DecodeError {
30 /// A pointer to the opaque Rust object.
32 /// Nearly everywhere, inner must be non-null, however in places where
33 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
34 pub inner: *mut nativeDecodeError,
35 /// Indicates that this is the only struct which contains the same pointer.
37 /// Rust functions which take ownership of an object provided via an argument require
38 /// this to be true and invalidate the object pointed to by inner.
42 impl Drop for DecodeError {
44 if self.is_owned && !<*mut nativeDecodeError>::is_null(self.inner) {
45 let _ = unsafe { Box::from_raw(self.inner) };
49 /// Frees any resources used by the DecodeError, if is_owned is set and inner is non-NULL.
51 pub extern "C" fn DecodeError_free(this_obj: DecodeError) { }
53 /// Used only if an object of this type is returned as a trait impl by a method
54 extern "C" fn DecodeError_free_void(this_ptr: *mut c_void) {
55 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeDecodeError); }
58 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
60 pub(crate) fn take_inner(mut self) -> *mut nativeDecodeError {
61 assert!(self.is_owned);
63 self.inner = std::ptr::null_mut();
67 impl Clone for DecodeError {
68 fn clone(&self) -> Self {
70 inner: if <*mut nativeDecodeError>::is_null(self.inner) { std::ptr::null_mut() } else {
71 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
77 /// Used only if an object of this type is returned as a trait impl by a method
78 pub(crate) extern "C" fn DecodeError_clone_void(this_ptr: *const c_void) -> *mut c_void {
79 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeDecodeError)).clone() })) as *mut c_void
82 /// Creates a copy of the DecodeError
83 pub extern "C" fn DecodeError_clone(orig: &DecodeError) -> DecodeError {
87 use lightning::ln::msgs::Init as nativeInitImport;
88 type nativeInit = nativeInitImport;
90 /// An init message to be sent or received from a peer
94 /// A pointer to the opaque Rust object.
96 /// Nearly everywhere, inner must be non-null, however in places where
97 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
98 pub inner: *mut nativeInit,
99 /// Indicates that this is the only struct which contains the same pointer.
101 /// Rust functions which take ownership of an object provided via an argument require
102 /// this to be true and invalidate the object pointed to by inner.
108 if self.is_owned && !<*mut nativeInit>::is_null(self.inner) {
109 let _ = unsafe { Box::from_raw(self.inner) };
113 /// Frees any resources used by the Init, if is_owned is set and inner is non-NULL.
115 pub extern "C" fn Init_free(this_obj: Init) { }
117 /// Used only if an object of this type is returned as a trait impl by a method
118 extern "C" fn Init_free_void(this_ptr: *mut c_void) {
119 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeInit); }
122 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
124 pub(crate) fn take_inner(mut self) -> *mut nativeInit {
125 assert!(self.is_owned);
126 let ret = self.inner;
127 self.inner = std::ptr::null_mut();
131 /// The relevant features which the sender supports
133 pub extern "C" fn Init_get_features(this_ptr: &Init) -> crate::ln::features::InitFeatures {
134 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.features;
135 crate::ln::features::InitFeatures { inner: unsafe { ( (&((*inner_val)) as *const _) as *mut _) }, is_owned: false }
137 /// The relevant features which the sender supports
139 pub extern "C" fn Init_set_features(this_ptr: &mut Init, mut val: crate::ln::features::InitFeatures) {
140 unsafe { &mut *this_ptr.inner }.features = *unsafe { Box::from_raw(val.take_inner()) };
142 /// Constructs a new Init given each field
145 pub extern "C" fn Init_new(mut features_arg: crate::ln::features::InitFeatures) -> Init {
146 Init { inner: Box::into_raw(Box::new(nativeInit {
147 features: *unsafe { Box::from_raw(features_arg.take_inner()) },
148 })), is_owned: true }
150 impl Clone for Init {
151 fn clone(&self) -> Self {
153 inner: if <*mut nativeInit>::is_null(self.inner) { std::ptr::null_mut() } else {
154 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
160 /// Used only if an object of this type is returned as a trait impl by a method
161 pub(crate) extern "C" fn Init_clone_void(this_ptr: *const c_void) -> *mut c_void {
162 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeInit)).clone() })) as *mut c_void
165 /// Creates a copy of the Init
166 pub extern "C" fn Init_clone(orig: &Init) -> Init {
170 use lightning::ln::msgs::ErrorMessage as nativeErrorMessageImport;
171 type nativeErrorMessage = nativeErrorMessageImport;
173 /// An error message to be sent or received from a peer
176 pub struct ErrorMessage {
177 /// A pointer to the opaque Rust object.
179 /// Nearly everywhere, inner must be non-null, however in places where
180 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
181 pub inner: *mut nativeErrorMessage,
182 /// Indicates that this is the only struct which contains the same pointer.
184 /// Rust functions which take ownership of an object provided via an argument require
185 /// this to be true and invalidate the object pointed to by inner.
189 impl Drop for ErrorMessage {
191 if self.is_owned && !<*mut nativeErrorMessage>::is_null(self.inner) {
192 let _ = unsafe { Box::from_raw(self.inner) };
196 /// Frees any resources used by the ErrorMessage, if is_owned is set and inner is non-NULL.
198 pub extern "C" fn ErrorMessage_free(this_obj: ErrorMessage) { }
200 /// Used only if an object of this type is returned as a trait impl by a method
201 extern "C" fn ErrorMessage_free_void(this_ptr: *mut c_void) {
202 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeErrorMessage); }
205 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
207 pub(crate) fn take_inner(mut self) -> *mut nativeErrorMessage {
208 assert!(self.is_owned);
209 let ret = self.inner;
210 self.inner = std::ptr::null_mut();
214 /// The channel ID involved in the error
216 pub extern "C" fn ErrorMessage_get_channel_id(this_ptr: &ErrorMessage) -> *const [u8; 32] {
217 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_id;
220 /// The channel ID involved in the error
222 pub extern "C" fn ErrorMessage_set_channel_id(this_ptr: &mut ErrorMessage, mut val: crate::c_types::ThirtyTwoBytes) {
223 unsafe { &mut *this_ptr.inner }.channel_id = val.data;
225 /// A possibly human-readable error description.
226 /// The string should be sanitized before it is used (e.g. emitted to logs
227 /// or printed to stdout). Otherwise, a well crafted error message may trigger a security
228 /// vulnerability in the terminal emulator or the logging subsystem.
230 pub extern "C" fn ErrorMessage_get_data(this_ptr: &ErrorMessage) -> crate::c_types::Str {
231 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.data;
232 (*inner_val).as_str().into()
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_set_data(this_ptr: &mut ErrorMessage, mut val: crate::c_types::derived::CVec_u8Z) {
240 unsafe { &mut *this_ptr.inner }.data = String::from_utf8(val.into_rust()).unwrap();
242 /// Constructs a new ErrorMessage given each field
245 pub extern "C" fn ErrorMessage_new(mut channel_id_arg: crate::c_types::ThirtyTwoBytes, mut data_arg: crate::c_types::derived::CVec_u8Z) -> ErrorMessage {
246 ErrorMessage { inner: Box::into_raw(Box::new(nativeErrorMessage {
247 channel_id: channel_id_arg.data,
248 data: String::from_utf8(data_arg.into_rust()).unwrap(),
249 })), is_owned: true }
251 impl Clone for ErrorMessage {
252 fn clone(&self) -> Self {
254 inner: if <*mut nativeErrorMessage>::is_null(self.inner) { std::ptr::null_mut() } else {
255 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
261 /// Used only if an object of this type is returned as a trait impl by a method
262 pub(crate) extern "C" fn ErrorMessage_clone_void(this_ptr: *const c_void) -> *mut c_void {
263 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeErrorMessage)).clone() })) as *mut c_void
266 /// Creates a copy of the ErrorMessage
267 pub extern "C" fn ErrorMessage_clone(orig: &ErrorMessage) -> ErrorMessage {
271 use lightning::ln::msgs::Ping as nativePingImport;
272 type nativePing = nativePingImport;
274 /// A ping message to be sent or received from a peer
278 /// A pointer to the opaque Rust object.
280 /// Nearly everywhere, inner must be non-null, however in places where
281 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
282 pub inner: *mut nativePing,
283 /// Indicates that this is the only struct which contains the same pointer.
285 /// Rust functions which take ownership of an object provided via an argument require
286 /// this to be true and invalidate the object pointed to by inner.
292 if self.is_owned && !<*mut nativePing>::is_null(self.inner) {
293 let _ = unsafe { Box::from_raw(self.inner) };
297 /// Frees any resources used by the Ping, if is_owned is set and inner is non-NULL.
299 pub extern "C" fn Ping_free(this_obj: Ping) { }
301 /// Used only if an object of this type is returned as a trait impl by a method
302 extern "C" fn Ping_free_void(this_ptr: *mut c_void) {
303 unsafe { let _ = Box::from_raw(this_ptr as *mut nativePing); }
306 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
308 pub(crate) fn take_inner(mut self) -> *mut nativePing {
309 assert!(self.is_owned);
310 let ret = self.inner;
311 self.inner = std::ptr::null_mut();
315 /// The desired response length
317 pub extern "C" fn Ping_get_ponglen(this_ptr: &Ping) -> u16 {
318 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.ponglen;
321 /// The desired response length
323 pub extern "C" fn Ping_set_ponglen(this_ptr: &mut Ping, mut val: u16) {
324 unsafe { &mut *this_ptr.inner }.ponglen = val;
326 /// The ping packet size.
327 /// This field is not sent on the wire. byteslen zeros are sent.
329 pub extern "C" fn Ping_get_byteslen(this_ptr: &Ping) -> u16 {
330 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.byteslen;
333 /// The ping packet size.
334 /// This field is not sent on the wire. byteslen zeros are sent.
336 pub extern "C" fn Ping_set_byteslen(this_ptr: &mut Ping, mut val: u16) {
337 unsafe { &mut *this_ptr.inner }.byteslen = val;
339 /// Constructs a new Ping given each field
342 pub extern "C" fn Ping_new(mut ponglen_arg: u16, mut byteslen_arg: u16) -> Ping {
343 Ping { inner: Box::into_raw(Box::new(nativePing {
344 ponglen: ponglen_arg,
345 byteslen: byteslen_arg,
346 })), is_owned: true }
348 impl Clone for Ping {
349 fn clone(&self) -> Self {
351 inner: if <*mut nativePing>::is_null(self.inner) { std::ptr::null_mut() } else {
352 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
358 /// Used only if an object of this type is returned as a trait impl by a method
359 pub(crate) extern "C" fn Ping_clone_void(this_ptr: *const c_void) -> *mut c_void {
360 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativePing)).clone() })) as *mut c_void
363 /// Creates a copy of the Ping
364 pub extern "C" fn Ping_clone(orig: &Ping) -> Ping {
368 use lightning::ln::msgs::Pong as nativePongImport;
369 type nativePong = nativePongImport;
371 /// A pong message to be sent or received from a peer
375 /// A pointer to the opaque Rust object.
377 /// Nearly everywhere, inner must be non-null, however in places where
378 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
379 pub inner: *mut nativePong,
380 /// Indicates that this is the only struct which contains the same pointer.
382 /// Rust functions which take ownership of an object provided via an argument require
383 /// this to be true and invalidate the object pointed to by inner.
389 if self.is_owned && !<*mut nativePong>::is_null(self.inner) {
390 let _ = unsafe { Box::from_raw(self.inner) };
394 /// Frees any resources used by the Pong, if is_owned is set and inner is non-NULL.
396 pub extern "C" fn Pong_free(this_obj: Pong) { }
398 /// Used only if an object of this type is returned as a trait impl by a method
399 extern "C" fn Pong_free_void(this_ptr: *mut c_void) {
400 unsafe { let _ = Box::from_raw(this_ptr as *mut nativePong); }
403 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
405 pub(crate) fn take_inner(mut self) -> *mut nativePong {
406 assert!(self.is_owned);
407 let ret = self.inner;
408 self.inner = std::ptr::null_mut();
412 /// The pong packet size.
413 /// This field is not sent on the wire. byteslen zeros are sent.
415 pub extern "C" fn Pong_get_byteslen(this_ptr: &Pong) -> u16 {
416 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.byteslen;
419 /// The pong packet size.
420 /// This field is not sent on the wire. byteslen zeros are sent.
422 pub extern "C" fn Pong_set_byteslen(this_ptr: &mut Pong, mut val: u16) {
423 unsafe { &mut *this_ptr.inner }.byteslen = val;
425 /// Constructs a new Pong given each field
428 pub extern "C" fn Pong_new(mut byteslen_arg: u16) -> Pong {
429 Pong { inner: Box::into_raw(Box::new(nativePong {
430 byteslen: byteslen_arg,
431 })), is_owned: true }
433 impl Clone for Pong {
434 fn clone(&self) -> Self {
436 inner: if <*mut nativePong>::is_null(self.inner) { std::ptr::null_mut() } else {
437 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
443 /// Used only if an object of this type is returned as a trait impl by a method
444 pub(crate) extern "C" fn Pong_clone_void(this_ptr: *const c_void) -> *mut c_void {
445 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativePong)).clone() })) as *mut c_void
448 /// Creates a copy of the Pong
449 pub extern "C" fn Pong_clone(orig: &Pong) -> Pong {
453 use lightning::ln::msgs::OpenChannel as nativeOpenChannelImport;
454 type nativeOpenChannel = nativeOpenChannelImport;
456 /// An open_channel message to be sent or received from a peer
459 pub struct OpenChannel {
460 /// A pointer to the opaque Rust object.
462 /// Nearly everywhere, inner must be non-null, however in places where
463 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
464 pub inner: *mut nativeOpenChannel,
465 /// Indicates that this is the only struct which contains the same pointer.
467 /// Rust functions which take ownership of an object provided via an argument require
468 /// this to be true and invalidate the object pointed to by inner.
472 impl Drop for OpenChannel {
474 if self.is_owned && !<*mut nativeOpenChannel>::is_null(self.inner) {
475 let _ = unsafe { Box::from_raw(self.inner) };
479 /// Frees any resources used by the OpenChannel, if is_owned is set and inner is non-NULL.
481 pub extern "C" fn OpenChannel_free(this_obj: OpenChannel) { }
483 /// Used only if an object of this type is returned as a trait impl by a method
484 extern "C" fn OpenChannel_free_void(this_ptr: *mut c_void) {
485 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeOpenChannel); }
488 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
490 pub(crate) fn take_inner(mut self) -> *mut nativeOpenChannel {
491 assert!(self.is_owned);
492 let ret = self.inner;
493 self.inner = std::ptr::null_mut();
497 /// The genesis hash of the blockchain where the channel is to be opened
499 pub extern "C" fn OpenChannel_get_chain_hash(this_ptr: &OpenChannel) -> *const [u8; 32] {
500 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.chain_hash;
501 (*inner_val).as_inner()
503 /// The genesis hash of the blockchain where the channel is to be opened
505 pub extern "C" fn OpenChannel_set_chain_hash(this_ptr: &mut OpenChannel, mut val: crate::c_types::ThirtyTwoBytes) {
506 unsafe { &mut *this_ptr.inner }.chain_hash = ::bitcoin::hash_types::BlockHash::from_slice(&val.data[..]).unwrap();
508 /// A temporary channel ID, until the funding outpoint is announced
510 pub extern "C" fn OpenChannel_get_temporary_channel_id(this_ptr: &OpenChannel) -> *const [u8; 32] {
511 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.temporary_channel_id;
514 /// A temporary channel ID, until the funding outpoint is announced
516 pub extern "C" fn OpenChannel_set_temporary_channel_id(this_ptr: &mut OpenChannel, mut val: crate::c_types::ThirtyTwoBytes) {
517 unsafe { &mut *this_ptr.inner }.temporary_channel_id = val.data;
519 /// The channel value
521 pub extern "C" fn OpenChannel_get_funding_satoshis(this_ptr: &OpenChannel) -> u64 {
522 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.funding_satoshis;
525 /// The channel value
527 pub extern "C" fn OpenChannel_set_funding_satoshis(this_ptr: &mut OpenChannel, mut val: u64) {
528 unsafe { &mut *this_ptr.inner }.funding_satoshis = val;
530 /// The amount to push to the counterparty as part of the open, in milli-satoshi
532 pub extern "C" fn OpenChannel_get_push_msat(this_ptr: &OpenChannel) -> u64 {
533 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.push_msat;
536 /// The amount to push to the counterparty as part of the open, in milli-satoshi
538 pub extern "C" fn OpenChannel_set_push_msat(this_ptr: &mut OpenChannel, mut val: u64) {
539 unsafe { &mut *this_ptr.inner }.push_msat = val;
541 /// The threshold below which outputs on transactions broadcast by sender will be omitted
543 pub extern "C" fn OpenChannel_get_dust_limit_satoshis(this_ptr: &OpenChannel) -> u64 {
544 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.dust_limit_satoshis;
547 /// The threshold below which outputs on transactions broadcast by sender will be omitted
549 pub extern "C" fn OpenChannel_set_dust_limit_satoshis(this_ptr: &mut OpenChannel, mut val: u64) {
550 unsafe { &mut *this_ptr.inner }.dust_limit_satoshis = val;
552 /// The maximum inbound HTLC value in flight towards sender, in milli-satoshi
554 pub extern "C" fn OpenChannel_get_max_htlc_value_in_flight_msat(this_ptr: &OpenChannel) -> u64 {
555 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.max_htlc_value_in_flight_msat;
558 /// The maximum inbound HTLC value in flight towards sender, in milli-satoshi
560 pub extern "C" fn OpenChannel_set_max_htlc_value_in_flight_msat(this_ptr: &mut OpenChannel, mut val: u64) {
561 unsafe { &mut *this_ptr.inner }.max_htlc_value_in_flight_msat = val;
563 /// The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
565 pub extern "C" fn OpenChannel_get_channel_reserve_satoshis(this_ptr: &OpenChannel) -> u64 {
566 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_reserve_satoshis;
569 /// The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
571 pub extern "C" fn OpenChannel_set_channel_reserve_satoshis(this_ptr: &mut OpenChannel, mut val: u64) {
572 unsafe { &mut *this_ptr.inner }.channel_reserve_satoshis = val;
574 /// The minimum HTLC size incoming to sender, in milli-satoshi
576 pub extern "C" fn OpenChannel_get_htlc_minimum_msat(this_ptr: &OpenChannel) -> u64 {
577 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.htlc_minimum_msat;
580 /// The minimum HTLC size incoming to sender, in milli-satoshi
582 pub extern "C" fn OpenChannel_set_htlc_minimum_msat(this_ptr: &mut OpenChannel, mut val: u64) {
583 unsafe { &mut *this_ptr.inner }.htlc_minimum_msat = val;
585 /// The feerate per 1000-weight of sender generated transactions, until updated by update_fee
587 pub extern "C" fn OpenChannel_get_feerate_per_kw(this_ptr: &OpenChannel) -> u32 {
588 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.feerate_per_kw;
591 /// The feerate per 1000-weight of sender generated transactions, until updated by update_fee
593 pub extern "C" fn OpenChannel_set_feerate_per_kw(this_ptr: &mut OpenChannel, mut val: u32) {
594 unsafe { &mut *this_ptr.inner }.feerate_per_kw = val;
596 /// The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
598 pub extern "C" fn OpenChannel_get_to_self_delay(this_ptr: &OpenChannel) -> u16 {
599 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.to_self_delay;
602 /// The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
604 pub extern "C" fn OpenChannel_set_to_self_delay(this_ptr: &mut OpenChannel, mut val: u16) {
605 unsafe { &mut *this_ptr.inner }.to_self_delay = val;
607 /// The maximum number of inbound HTLCs towards sender
609 pub extern "C" fn OpenChannel_get_max_accepted_htlcs(this_ptr: &OpenChannel) -> u16 {
610 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.max_accepted_htlcs;
613 /// The maximum number of inbound HTLCs towards sender
615 pub extern "C" fn OpenChannel_set_max_accepted_htlcs(this_ptr: &mut OpenChannel, mut val: u16) {
616 unsafe { &mut *this_ptr.inner }.max_accepted_htlcs = val;
618 /// The sender's key controlling the funding transaction
620 pub extern "C" fn OpenChannel_get_funding_pubkey(this_ptr: &OpenChannel) -> crate::c_types::PublicKey {
621 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.funding_pubkey;
622 crate::c_types::PublicKey::from_rust(&(*inner_val))
624 /// The sender's key controlling the funding transaction
626 pub extern "C" fn OpenChannel_set_funding_pubkey(this_ptr: &mut OpenChannel, mut val: crate::c_types::PublicKey) {
627 unsafe { &mut *this_ptr.inner }.funding_pubkey = val.into_rust();
629 /// Used to derive a revocation key for transactions broadcast by counterparty
631 pub extern "C" fn OpenChannel_get_revocation_basepoint(this_ptr: &OpenChannel) -> crate::c_types::PublicKey {
632 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.revocation_basepoint;
633 crate::c_types::PublicKey::from_rust(&(*inner_val))
635 /// Used to derive a revocation key for transactions broadcast by counterparty
637 pub extern "C" fn OpenChannel_set_revocation_basepoint(this_ptr: &mut OpenChannel, mut val: crate::c_types::PublicKey) {
638 unsafe { &mut *this_ptr.inner }.revocation_basepoint = val.into_rust();
640 /// A payment key to sender for transactions broadcast by counterparty
642 pub extern "C" fn OpenChannel_get_payment_point(this_ptr: &OpenChannel) -> crate::c_types::PublicKey {
643 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.payment_point;
644 crate::c_types::PublicKey::from_rust(&(*inner_val))
646 /// A payment key to sender for transactions broadcast by counterparty
648 pub extern "C" fn OpenChannel_set_payment_point(this_ptr: &mut OpenChannel, mut val: crate::c_types::PublicKey) {
649 unsafe { &mut *this_ptr.inner }.payment_point = val.into_rust();
651 /// Used to derive a payment key to sender for transactions broadcast by sender
653 pub extern "C" fn OpenChannel_get_delayed_payment_basepoint(this_ptr: &OpenChannel) -> crate::c_types::PublicKey {
654 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.delayed_payment_basepoint;
655 crate::c_types::PublicKey::from_rust(&(*inner_val))
657 /// Used to derive a payment key to sender for transactions broadcast by sender
659 pub extern "C" fn OpenChannel_set_delayed_payment_basepoint(this_ptr: &mut OpenChannel, mut val: crate::c_types::PublicKey) {
660 unsafe { &mut *this_ptr.inner }.delayed_payment_basepoint = val.into_rust();
662 /// Used to derive an HTLC payment key to sender
664 pub extern "C" fn OpenChannel_get_htlc_basepoint(this_ptr: &OpenChannel) -> crate::c_types::PublicKey {
665 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.htlc_basepoint;
666 crate::c_types::PublicKey::from_rust(&(*inner_val))
668 /// Used to derive an HTLC payment key to sender
670 pub extern "C" fn OpenChannel_set_htlc_basepoint(this_ptr: &mut OpenChannel, mut val: crate::c_types::PublicKey) {
671 unsafe { &mut *this_ptr.inner }.htlc_basepoint = val.into_rust();
673 /// The first to-be-broadcast-by-sender transaction's per commitment point
675 pub extern "C" fn OpenChannel_get_first_per_commitment_point(this_ptr: &OpenChannel) -> crate::c_types::PublicKey {
676 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.first_per_commitment_point;
677 crate::c_types::PublicKey::from_rust(&(*inner_val))
679 /// The first to-be-broadcast-by-sender transaction's per commitment point
681 pub extern "C" fn OpenChannel_set_first_per_commitment_point(this_ptr: &mut OpenChannel, mut val: crate::c_types::PublicKey) {
682 unsafe { &mut *this_ptr.inner }.first_per_commitment_point = val.into_rust();
686 pub extern "C" fn OpenChannel_get_channel_flags(this_ptr: &OpenChannel) -> u8 {
687 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_flags;
692 pub extern "C" fn OpenChannel_set_channel_flags(this_ptr: &mut OpenChannel, mut val: u8) {
693 unsafe { &mut *this_ptr.inner }.channel_flags = val;
695 impl Clone for OpenChannel {
696 fn clone(&self) -> Self {
698 inner: if <*mut nativeOpenChannel>::is_null(self.inner) { std::ptr::null_mut() } else {
699 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
705 /// Used only if an object of this type is returned as a trait impl by a method
706 pub(crate) extern "C" fn OpenChannel_clone_void(this_ptr: *const c_void) -> *mut c_void {
707 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeOpenChannel)).clone() })) as *mut c_void
710 /// Creates a copy of the OpenChannel
711 pub extern "C" fn OpenChannel_clone(orig: &OpenChannel) -> OpenChannel {
715 use lightning::ln::msgs::AcceptChannel as nativeAcceptChannelImport;
716 type nativeAcceptChannel = nativeAcceptChannelImport;
718 /// An accept_channel message to be sent or received from a peer
721 pub struct AcceptChannel {
722 /// A pointer to the opaque Rust object.
724 /// Nearly everywhere, inner must be non-null, however in places where
725 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
726 pub inner: *mut nativeAcceptChannel,
727 /// Indicates that this is the only struct which contains the same pointer.
729 /// Rust functions which take ownership of an object provided via an argument require
730 /// this to be true and invalidate the object pointed to by inner.
734 impl Drop for AcceptChannel {
736 if self.is_owned && !<*mut nativeAcceptChannel>::is_null(self.inner) {
737 let _ = unsafe { Box::from_raw(self.inner) };
741 /// Frees any resources used by the AcceptChannel, if is_owned is set and inner is non-NULL.
743 pub extern "C" fn AcceptChannel_free(this_obj: AcceptChannel) { }
745 /// Used only if an object of this type is returned as a trait impl by a method
746 extern "C" fn AcceptChannel_free_void(this_ptr: *mut c_void) {
747 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeAcceptChannel); }
750 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
752 pub(crate) fn take_inner(mut self) -> *mut nativeAcceptChannel {
753 assert!(self.is_owned);
754 let ret = self.inner;
755 self.inner = std::ptr::null_mut();
759 /// A temporary channel ID, until the funding outpoint is announced
761 pub extern "C" fn AcceptChannel_get_temporary_channel_id(this_ptr: &AcceptChannel) -> *const [u8; 32] {
762 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.temporary_channel_id;
765 /// A temporary channel ID, until the funding outpoint is announced
767 pub extern "C" fn AcceptChannel_set_temporary_channel_id(this_ptr: &mut AcceptChannel, mut val: crate::c_types::ThirtyTwoBytes) {
768 unsafe { &mut *this_ptr.inner }.temporary_channel_id = val.data;
770 /// The threshold below which outputs on transactions broadcast by sender will be omitted
772 pub extern "C" fn AcceptChannel_get_dust_limit_satoshis(this_ptr: &AcceptChannel) -> u64 {
773 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.dust_limit_satoshis;
776 /// The threshold below which outputs on transactions broadcast by sender will be omitted
778 pub extern "C" fn AcceptChannel_set_dust_limit_satoshis(this_ptr: &mut AcceptChannel, mut val: u64) {
779 unsafe { &mut *this_ptr.inner }.dust_limit_satoshis = val;
781 /// The maximum inbound HTLC value in flight towards sender, in milli-satoshi
783 pub extern "C" fn AcceptChannel_get_max_htlc_value_in_flight_msat(this_ptr: &AcceptChannel) -> u64 {
784 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.max_htlc_value_in_flight_msat;
787 /// The maximum inbound HTLC value in flight towards sender, in milli-satoshi
789 pub extern "C" fn AcceptChannel_set_max_htlc_value_in_flight_msat(this_ptr: &mut AcceptChannel, mut val: u64) {
790 unsafe { &mut *this_ptr.inner }.max_htlc_value_in_flight_msat = val;
792 /// The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
794 pub extern "C" fn AcceptChannel_get_channel_reserve_satoshis(this_ptr: &AcceptChannel) -> u64 {
795 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_reserve_satoshis;
798 /// The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
800 pub extern "C" fn AcceptChannel_set_channel_reserve_satoshis(this_ptr: &mut AcceptChannel, mut val: u64) {
801 unsafe { &mut *this_ptr.inner }.channel_reserve_satoshis = val;
803 /// The minimum HTLC size incoming to sender, in milli-satoshi
805 pub extern "C" fn AcceptChannel_get_htlc_minimum_msat(this_ptr: &AcceptChannel) -> u64 {
806 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.htlc_minimum_msat;
809 /// The minimum HTLC size incoming to sender, in milli-satoshi
811 pub extern "C" fn AcceptChannel_set_htlc_minimum_msat(this_ptr: &mut AcceptChannel, mut val: u64) {
812 unsafe { &mut *this_ptr.inner }.htlc_minimum_msat = val;
814 /// Minimum depth of the funding transaction before the channel is considered open
816 pub extern "C" fn AcceptChannel_get_minimum_depth(this_ptr: &AcceptChannel) -> u32 {
817 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.minimum_depth;
820 /// Minimum depth of the funding transaction before the channel is considered open
822 pub extern "C" fn AcceptChannel_set_minimum_depth(this_ptr: &mut AcceptChannel, mut val: u32) {
823 unsafe { &mut *this_ptr.inner }.minimum_depth = val;
825 /// The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
827 pub extern "C" fn AcceptChannel_get_to_self_delay(this_ptr: &AcceptChannel) -> u16 {
828 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.to_self_delay;
831 /// The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
833 pub extern "C" fn AcceptChannel_set_to_self_delay(this_ptr: &mut AcceptChannel, mut val: u16) {
834 unsafe { &mut *this_ptr.inner }.to_self_delay = val;
836 /// The maximum number of inbound HTLCs towards sender
838 pub extern "C" fn AcceptChannel_get_max_accepted_htlcs(this_ptr: &AcceptChannel) -> u16 {
839 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.max_accepted_htlcs;
842 /// The maximum number of inbound HTLCs towards sender
844 pub extern "C" fn AcceptChannel_set_max_accepted_htlcs(this_ptr: &mut AcceptChannel, mut val: u16) {
845 unsafe { &mut *this_ptr.inner }.max_accepted_htlcs = val;
847 /// The sender's key controlling the funding transaction
849 pub extern "C" fn AcceptChannel_get_funding_pubkey(this_ptr: &AcceptChannel) -> crate::c_types::PublicKey {
850 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.funding_pubkey;
851 crate::c_types::PublicKey::from_rust(&(*inner_val))
853 /// The sender's key controlling the funding transaction
855 pub extern "C" fn AcceptChannel_set_funding_pubkey(this_ptr: &mut AcceptChannel, mut val: crate::c_types::PublicKey) {
856 unsafe { &mut *this_ptr.inner }.funding_pubkey = val.into_rust();
858 /// Used to derive a revocation key for transactions broadcast by counterparty
860 pub extern "C" fn AcceptChannel_get_revocation_basepoint(this_ptr: &AcceptChannel) -> crate::c_types::PublicKey {
861 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.revocation_basepoint;
862 crate::c_types::PublicKey::from_rust(&(*inner_val))
864 /// Used to derive a revocation key for transactions broadcast by counterparty
866 pub extern "C" fn AcceptChannel_set_revocation_basepoint(this_ptr: &mut AcceptChannel, mut val: crate::c_types::PublicKey) {
867 unsafe { &mut *this_ptr.inner }.revocation_basepoint = val.into_rust();
869 /// A payment key to sender for transactions broadcast by counterparty
871 pub extern "C" fn AcceptChannel_get_payment_point(this_ptr: &AcceptChannel) -> crate::c_types::PublicKey {
872 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.payment_point;
873 crate::c_types::PublicKey::from_rust(&(*inner_val))
875 /// A payment key to sender for transactions broadcast by counterparty
877 pub extern "C" fn AcceptChannel_set_payment_point(this_ptr: &mut AcceptChannel, mut val: crate::c_types::PublicKey) {
878 unsafe { &mut *this_ptr.inner }.payment_point = val.into_rust();
880 /// Used to derive a payment key to sender for transactions broadcast by sender
882 pub extern "C" fn AcceptChannel_get_delayed_payment_basepoint(this_ptr: &AcceptChannel) -> crate::c_types::PublicKey {
883 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.delayed_payment_basepoint;
884 crate::c_types::PublicKey::from_rust(&(*inner_val))
886 /// Used to derive a payment key to sender for transactions broadcast by sender
888 pub extern "C" fn AcceptChannel_set_delayed_payment_basepoint(this_ptr: &mut AcceptChannel, mut val: crate::c_types::PublicKey) {
889 unsafe { &mut *this_ptr.inner }.delayed_payment_basepoint = val.into_rust();
891 /// Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
893 pub extern "C" fn AcceptChannel_get_htlc_basepoint(this_ptr: &AcceptChannel) -> crate::c_types::PublicKey {
894 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.htlc_basepoint;
895 crate::c_types::PublicKey::from_rust(&(*inner_val))
897 /// Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
899 pub extern "C" fn AcceptChannel_set_htlc_basepoint(this_ptr: &mut AcceptChannel, mut val: crate::c_types::PublicKey) {
900 unsafe { &mut *this_ptr.inner }.htlc_basepoint = val.into_rust();
902 /// The first to-be-broadcast-by-sender transaction's per commitment point
904 pub extern "C" fn AcceptChannel_get_first_per_commitment_point(this_ptr: &AcceptChannel) -> crate::c_types::PublicKey {
905 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.first_per_commitment_point;
906 crate::c_types::PublicKey::from_rust(&(*inner_val))
908 /// The first to-be-broadcast-by-sender transaction's per commitment point
910 pub extern "C" fn AcceptChannel_set_first_per_commitment_point(this_ptr: &mut AcceptChannel, mut val: crate::c_types::PublicKey) {
911 unsafe { &mut *this_ptr.inner }.first_per_commitment_point = val.into_rust();
913 impl Clone for AcceptChannel {
914 fn clone(&self) -> Self {
916 inner: if <*mut nativeAcceptChannel>::is_null(self.inner) { std::ptr::null_mut() } else {
917 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
923 /// Used only if an object of this type is returned as a trait impl by a method
924 pub(crate) extern "C" fn AcceptChannel_clone_void(this_ptr: *const c_void) -> *mut c_void {
925 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeAcceptChannel)).clone() })) as *mut c_void
928 /// Creates a copy of the AcceptChannel
929 pub extern "C" fn AcceptChannel_clone(orig: &AcceptChannel) -> AcceptChannel {
933 use lightning::ln::msgs::FundingCreated as nativeFundingCreatedImport;
934 type nativeFundingCreated = nativeFundingCreatedImport;
936 /// A funding_created message to be sent or received from a peer
939 pub struct FundingCreated {
940 /// A pointer to the opaque Rust object.
942 /// Nearly everywhere, inner must be non-null, however in places where
943 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
944 pub inner: *mut nativeFundingCreated,
945 /// Indicates that this is the only struct which contains the same pointer.
947 /// Rust functions which take ownership of an object provided via an argument require
948 /// this to be true and invalidate the object pointed to by inner.
952 impl Drop for FundingCreated {
954 if self.is_owned && !<*mut nativeFundingCreated>::is_null(self.inner) {
955 let _ = unsafe { Box::from_raw(self.inner) };
959 /// Frees any resources used by the FundingCreated, if is_owned is set and inner is non-NULL.
961 pub extern "C" fn FundingCreated_free(this_obj: FundingCreated) { }
963 /// Used only if an object of this type is returned as a trait impl by a method
964 extern "C" fn FundingCreated_free_void(this_ptr: *mut c_void) {
965 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeFundingCreated); }
968 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
969 impl FundingCreated {
970 pub(crate) fn take_inner(mut self) -> *mut nativeFundingCreated {
971 assert!(self.is_owned);
972 let ret = self.inner;
973 self.inner = std::ptr::null_mut();
977 /// A temporary channel ID, until the funding is established
979 pub extern "C" fn FundingCreated_get_temporary_channel_id(this_ptr: &FundingCreated) -> *const [u8; 32] {
980 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.temporary_channel_id;
983 /// A temporary channel ID, until the funding is established
985 pub extern "C" fn FundingCreated_set_temporary_channel_id(this_ptr: &mut FundingCreated, mut val: crate::c_types::ThirtyTwoBytes) {
986 unsafe { &mut *this_ptr.inner }.temporary_channel_id = val.data;
988 /// The funding transaction ID
990 pub extern "C" fn FundingCreated_get_funding_txid(this_ptr: &FundingCreated) -> *const [u8; 32] {
991 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.funding_txid;
992 (*inner_val).as_inner()
994 /// The funding transaction ID
996 pub extern "C" fn FundingCreated_set_funding_txid(this_ptr: &mut FundingCreated, mut val: crate::c_types::ThirtyTwoBytes) {
997 unsafe { &mut *this_ptr.inner }.funding_txid = ::bitcoin::hash_types::Txid::from_slice(&val.data[..]).unwrap();
999 /// The specific output index funding this channel
1001 pub extern "C" fn FundingCreated_get_funding_output_index(this_ptr: &FundingCreated) -> u16 {
1002 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.funding_output_index;
1005 /// The specific output index funding this channel
1007 pub extern "C" fn FundingCreated_set_funding_output_index(this_ptr: &mut FundingCreated, mut val: u16) {
1008 unsafe { &mut *this_ptr.inner }.funding_output_index = val;
1010 /// The signature of the channel initiator (funder) on the funding transaction
1012 pub extern "C" fn FundingCreated_get_signature(this_ptr: &FundingCreated) -> crate::c_types::Signature {
1013 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.signature;
1014 crate::c_types::Signature::from_rust(&(*inner_val))
1016 /// The signature of the channel initiator (funder) on the funding transaction
1018 pub extern "C" fn FundingCreated_set_signature(this_ptr: &mut FundingCreated, mut val: crate::c_types::Signature) {
1019 unsafe { &mut *this_ptr.inner }.signature = val.into_rust();
1021 /// Constructs a new FundingCreated given each field
1024 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 {
1025 FundingCreated { inner: Box::into_raw(Box::new(nativeFundingCreated {
1026 temporary_channel_id: temporary_channel_id_arg.data,
1027 funding_txid: ::bitcoin::hash_types::Txid::from_slice(&funding_txid_arg.data[..]).unwrap(),
1028 funding_output_index: funding_output_index_arg,
1029 signature: signature_arg.into_rust(),
1030 })), is_owned: true }
1032 impl Clone for FundingCreated {
1033 fn clone(&self) -> Self {
1035 inner: if <*mut nativeFundingCreated>::is_null(self.inner) { std::ptr::null_mut() } else {
1036 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
1042 /// Used only if an object of this type is returned as a trait impl by a method
1043 pub(crate) extern "C" fn FundingCreated_clone_void(this_ptr: *const c_void) -> *mut c_void {
1044 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeFundingCreated)).clone() })) as *mut c_void
1047 /// Creates a copy of the FundingCreated
1048 pub extern "C" fn FundingCreated_clone(orig: &FundingCreated) -> FundingCreated {
1052 use lightning::ln::msgs::FundingSigned as nativeFundingSignedImport;
1053 type nativeFundingSigned = nativeFundingSignedImport;
1055 /// A funding_signed message to be sent or received from a peer
1058 pub struct FundingSigned {
1059 /// A pointer to the opaque Rust object.
1061 /// Nearly everywhere, inner must be non-null, however in places where
1062 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
1063 pub inner: *mut nativeFundingSigned,
1064 /// Indicates that this is the only struct which contains the same pointer.
1066 /// Rust functions which take ownership of an object provided via an argument require
1067 /// this to be true and invalidate the object pointed to by inner.
1071 impl Drop for FundingSigned {
1072 fn drop(&mut self) {
1073 if self.is_owned && !<*mut nativeFundingSigned>::is_null(self.inner) {
1074 let _ = unsafe { Box::from_raw(self.inner) };
1078 /// Frees any resources used by the FundingSigned, if is_owned is set and inner is non-NULL.
1080 pub extern "C" fn FundingSigned_free(this_obj: FundingSigned) { }
1082 /// Used only if an object of this type is returned as a trait impl by a method
1083 extern "C" fn FundingSigned_free_void(this_ptr: *mut c_void) {
1084 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeFundingSigned); }
1087 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
1088 impl FundingSigned {
1089 pub(crate) fn take_inner(mut self) -> *mut nativeFundingSigned {
1090 assert!(self.is_owned);
1091 let ret = self.inner;
1092 self.inner = std::ptr::null_mut();
1098 pub extern "C" fn FundingSigned_get_channel_id(this_ptr: &FundingSigned) -> *const [u8; 32] {
1099 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_id;
1104 pub extern "C" fn FundingSigned_set_channel_id(this_ptr: &mut FundingSigned, mut val: crate::c_types::ThirtyTwoBytes) {
1105 unsafe { &mut *this_ptr.inner }.channel_id = val.data;
1107 /// The signature of the channel acceptor (fundee) on the funding transaction
1109 pub extern "C" fn FundingSigned_get_signature(this_ptr: &FundingSigned) -> crate::c_types::Signature {
1110 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.signature;
1111 crate::c_types::Signature::from_rust(&(*inner_val))
1113 /// The signature of the channel acceptor (fundee) on the funding transaction
1115 pub extern "C" fn FundingSigned_set_signature(this_ptr: &mut FundingSigned, mut val: crate::c_types::Signature) {
1116 unsafe { &mut *this_ptr.inner }.signature = val.into_rust();
1118 /// Constructs a new FundingSigned given each field
1121 pub extern "C" fn FundingSigned_new(mut channel_id_arg: crate::c_types::ThirtyTwoBytes, mut signature_arg: crate::c_types::Signature) -> FundingSigned {
1122 FundingSigned { inner: Box::into_raw(Box::new(nativeFundingSigned {
1123 channel_id: channel_id_arg.data,
1124 signature: signature_arg.into_rust(),
1125 })), is_owned: true }
1127 impl Clone for FundingSigned {
1128 fn clone(&self) -> Self {
1130 inner: if <*mut nativeFundingSigned>::is_null(self.inner) { std::ptr::null_mut() } else {
1131 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
1137 /// Used only if an object of this type is returned as a trait impl by a method
1138 pub(crate) extern "C" fn FundingSigned_clone_void(this_ptr: *const c_void) -> *mut c_void {
1139 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeFundingSigned)).clone() })) as *mut c_void
1142 /// Creates a copy of the FundingSigned
1143 pub extern "C" fn FundingSigned_clone(orig: &FundingSigned) -> FundingSigned {
1147 use lightning::ln::msgs::FundingLocked as nativeFundingLockedImport;
1148 type nativeFundingLocked = nativeFundingLockedImport;
1150 /// A funding_locked message to be sent or received from a peer
1153 pub struct FundingLocked {
1154 /// A pointer to the opaque Rust object.
1156 /// Nearly everywhere, inner must be non-null, however in places where
1157 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
1158 pub inner: *mut nativeFundingLocked,
1159 /// Indicates that this is the only struct which contains the same pointer.
1161 /// Rust functions which take ownership of an object provided via an argument require
1162 /// this to be true and invalidate the object pointed to by inner.
1166 impl Drop for FundingLocked {
1167 fn drop(&mut self) {
1168 if self.is_owned && !<*mut nativeFundingLocked>::is_null(self.inner) {
1169 let _ = unsafe { Box::from_raw(self.inner) };
1173 /// Frees any resources used by the FundingLocked, if is_owned is set and inner is non-NULL.
1175 pub extern "C" fn FundingLocked_free(this_obj: FundingLocked) { }
1177 /// Used only if an object of this type is returned as a trait impl by a method
1178 extern "C" fn FundingLocked_free_void(this_ptr: *mut c_void) {
1179 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeFundingLocked); }
1182 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
1183 impl FundingLocked {
1184 pub(crate) fn take_inner(mut self) -> *mut nativeFundingLocked {
1185 assert!(self.is_owned);
1186 let ret = self.inner;
1187 self.inner = std::ptr::null_mut();
1193 pub extern "C" fn FundingLocked_get_channel_id(this_ptr: &FundingLocked) -> *const [u8; 32] {
1194 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_id;
1199 pub extern "C" fn FundingLocked_set_channel_id(this_ptr: &mut FundingLocked, mut val: crate::c_types::ThirtyTwoBytes) {
1200 unsafe { &mut *this_ptr.inner }.channel_id = val.data;
1202 /// The per-commitment point of the second commitment transaction
1204 pub extern "C" fn FundingLocked_get_next_per_commitment_point(this_ptr: &FundingLocked) -> crate::c_types::PublicKey {
1205 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.next_per_commitment_point;
1206 crate::c_types::PublicKey::from_rust(&(*inner_val))
1208 /// The per-commitment point of the second commitment transaction
1210 pub extern "C" fn FundingLocked_set_next_per_commitment_point(this_ptr: &mut FundingLocked, mut val: crate::c_types::PublicKey) {
1211 unsafe { &mut *this_ptr.inner }.next_per_commitment_point = val.into_rust();
1213 /// Constructs a new FundingLocked given each field
1216 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 {
1217 FundingLocked { inner: Box::into_raw(Box::new(nativeFundingLocked {
1218 channel_id: channel_id_arg.data,
1219 next_per_commitment_point: next_per_commitment_point_arg.into_rust(),
1220 })), is_owned: true }
1222 impl Clone for FundingLocked {
1223 fn clone(&self) -> Self {
1225 inner: if <*mut nativeFundingLocked>::is_null(self.inner) { std::ptr::null_mut() } else {
1226 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
1232 /// Used only if an object of this type is returned as a trait impl by a method
1233 pub(crate) extern "C" fn FundingLocked_clone_void(this_ptr: *const c_void) -> *mut c_void {
1234 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeFundingLocked)).clone() })) as *mut c_void
1237 /// Creates a copy of the FundingLocked
1238 pub extern "C" fn FundingLocked_clone(orig: &FundingLocked) -> FundingLocked {
1242 use lightning::ln::msgs::Shutdown as nativeShutdownImport;
1243 type nativeShutdown = nativeShutdownImport;
1245 /// A shutdown message to be sent or received from a peer
1248 pub struct Shutdown {
1249 /// A pointer to the opaque Rust object.
1251 /// Nearly everywhere, inner must be non-null, however in places where
1252 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
1253 pub inner: *mut nativeShutdown,
1254 /// Indicates that this is the only struct which contains the same pointer.
1256 /// Rust functions which take ownership of an object provided via an argument require
1257 /// this to be true and invalidate the object pointed to by inner.
1261 impl Drop for Shutdown {
1262 fn drop(&mut self) {
1263 if self.is_owned && !<*mut nativeShutdown>::is_null(self.inner) {
1264 let _ = unsafe { Box::from_raw(self.inner) };
1268 /// Frees any resources used by the Shutdown, if is_owned is set and inner is non-NULL.
1270 pub extern "C" fn Shutdown_free(this_obj: Shutdown) { }
1272 /// Used only if an object of this type is returned as a trait impl by a method
1273 extern "C" fn Shutdown_free_void(this_ptr: *mut c_void) {
1274 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeShutdown); }
1277 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
1279 pub(crate) fn take_inner(mut self) -> *mut nativeShutdown {
1280 assert!(self.is_owned);
1281 let ret = self.inner;
1282 self.inner = std::ptr::null_mut();
1288 pub extern "C" fn Shutdown_get_channel_id(this_ptr: &Shutdown) -> *const [u8; 32] {
1289 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_id;
1294 pub extern "C" fn Shutdown_set_channel_id(this_ptr: &mut Shutdown, mut val: crate::c_types::ThirtyTwoBytes) {
1295 unsafe { &mut *this_ptr.inner }.channel_id = val.data;
1297 /// The destination of this peer's funds on closing.
1298 /// Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
1300 pub extern "C" fn Shutdown_get_scriptpubkey(this_ptr: &Shutdown) -> crate::c_types::u8slice {
1301 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.scriptpubkey;
1302 crate::c_types::u8slice::from_slice(&(*inner_val)[..])
1304 /// The destination of this peer's funds on closing.
1305 /// Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
1307 pub extern "C" fn Shutdown_set_scriptpubkey(this_ptr: &mut Shutdown, mut val: crate::c_types::derived::CVec_u8Z) {
1308 unsafe { &mut *this_ptr.inner }.scriptpubkey = ::bitcoin::blockdata::script::Script::from(val.into_rust());
1310 /// Constructs a new Shutdown given each field
1313 pub extern "C" fn Shutdown_new(mut channel_id_arg: crate::c_types::ThirtyTwoBytes, mut scriptpubkey_arg: crate::c_types::derived::CVec_u8Z) -> Shutdown {
1314 Shutdown { inner: Box::into_raw(Box::new(nativeShutdown {
1315 channel_id: channel_id_arg.data,
1316 scriptpubkey: ::bitcoin::blockdata::script::Script::from(scriptpubkey_arg.into_rust()),
1317 })), is_owned: true }
1319 impl Clone for Shutdown {
1320 fn clone(&self) -> Self {
1322 inner: if <*mut nativeShutdown>::is_null(self.inner) { std::ptr::null_mut() } else {
1323 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
1329 /// Used only if an object of this type is returned as a trait impl by a method
1330 pub(crate) extern "C" fn Shutdown_clone_void(this_ptr: *const c_void) -> *mut c_void {
1331 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeShutdown)).clone() })) as *mut c_void
1334 /// Creates a copy of the Shutdown
1335 pub extern "C" fn Shutdown_clone(orig: &Shutdown) -> Shutdown {
1339 use lightning::ln::msgs::ClosingSigned as nativeClosingSignedImport;
1340 type nativeClosingSigned = nativeClosingSignedImport;
1342 /// A closing_signed message to be sent or received from a peer
1345 pub struct ClosingSigned {
1346 /// A pointer to the opaque Rust object.
1348 /// Nearly everywhere, inner must be non-null, however in places where
1349 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
1350 pub inner: *mut nativeClosingSigned,
1351 /// Indicates that this is the only struct which contains the same pointer.
1353 /// Rust functions which take ownership of an object provided via an argument require
1354 /// this to be true and invalidate the object pointed to by inner.
1358 impl Drop for ClosingSigned {
1359 fn drop(&mut self) {
1360 if self.is_owned && !<*mut nativeClosingSigned>::is_null(self.inner) {
1361 let _ = unsafe { Box::from_raw(self.inner) };
1365 /// Frees any resources used by the ClosingSigned, if is_owned is set and inner is non-NULL.
1367 pub extern "C" fn ClosingSigned_free(this_obj: ClosingSigned) { }
1369 /// Used only if an object of this type is returned as a trait impl by a method
1370 extern "C" fn ClosingSigned_free_void(this_ptr: *mut c_void) {
1371 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeClosingSigned); }
1374 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
1375 impl ClosingSigned {
1376 pub(crate) fn take_inner(mut self) -> *mut nativeClosingSigned {
1377 assert!(self.is_owned);
1378 let ret = self.inner;
1379 self.inner = std::ptr::null_mut();
1385 pub extern "C" fn ClosingSigned_get_channel_id(this_ptr: &ClosingSigned) -> *const [u8; 32] {
1386 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_id;
1391 pub extern "C" fn ClosingSigned_set_channel_id(this_ptr: &mut ClosingSigned, mut val: crate::c_types::ThirtyTwoBytes) {
1392 unsafe { &mut *this_ptr.inner }.channel_id = val.data;
1394 /// The proposed total fee for the closing transaction
1396 pub extern "C" fn ClosingSigned_get_fee_satoshis(this_ptr: &ClosingSigned) -> u64 {
1397 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.fee_satoshis;
1400 /// The proposed total fee for the closing transaction
1402 pub extern "C" fn ClosingSigned_set_fee_satoshis(this_ptr: &mut ClosingSigned, mut val: u64) {
1403 unsafe { &mut *this_ptr.inner }.fee_satoshis = val;
1405 /// A signature on the closing transaction
1407 pub extern "C" fn ClosingSigned_get_signature(this_ptr: &ClosingSigned) -> crate::c_types::Signature {
1408 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.signature;
1409 crate::c_types::Signature::from_rust(&(*inner_val))
1411 /// A signature on the closing transaction
1413 pub extern "C" fn ClosingSigned_set_signature(this_ptr: &mut ClosingSigned, mut val: crate::c_types::Signature) {
1414 unsafe { &mut *this_ptr.inner }.signature = val.into_rust();
1416 /// Constructs a new ClosingSigned given each field
1419 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 {
1420 ClosingSigned { inner: Box::into_raw(Box::new(nativeClosingSigned {
1421 channel_id: channel_id_arg.data,
1422 fee_satoshis: fee_satoshis_arg,
1423 signature: signature_arg.into_rust(),
1424 })), is_owned: true }
1426 impl Clone for ClosingSigned {
1427 fn clone(&self) -> Self {
1429 inner: if <*mut nativeClosingSigned>::is_null(self.inner) { std::ptr::null_mut() } else {
1430 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
1436 /// Used only if an object of this type is returned as a trait impl by a method
1437 pub(crate) extern "C" fn ClosingSigned_clone_void(this_ptr: *const c_void) -> *mut c_void {
1438 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeClosingSigned)).clone() })) as *mut c_void
1441 /// Creates a copy of the ClosingSigned
1442 pub extern "C" fn ClosingSigned_clone(orig: &ClosingSigned) -> ClosingSigned {
1446 use lightning::ln::msgs::UpdateAddHTLC as nativeUpdateAddHTLCImport;
1447 type nativeUpdateAddHTLC = nativeUpdateAddHTLCImport;
1449 /// An update_add_htlc message to be sent or received from a peer
1452 pub struct UpdateAddHTLC {
1453 /// A pointer to the opaque Rust object.
1455 /// Nearly everywhere, inner must be non-null, however in places where
1456 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
1457 pub inner: *mut nativeUpdateAddHTLC,
1458 /// Indicates that this is the only struct which contains the same pointer.
1460 /// Rust functions which take ownership of an object provided via an argument require
1461 /// this to be true and invalidate the object pointed to by inner.
1465 impl Drop for UpdateAddHTLC {
1466 fn drop(&mut self) {
1467 if self.is_owned && !<*mut nativeUpdateAddHTLC>::is_null(self.inner) {
1468 let _ = unsafe { Box::from_raw(self.inner) };
1472 /// Frees any resources used by the UpdateAddHTLC, if is_owned is set and inner is non-NULL.
1474 pub extern "C" fn UpdateAddHTLC_free(this_obj: UpdateAddHTLC) { }
1476 /// Used only if an object of this type is returned as a trait impl by a method
1477 extern "C" fn UpdateAddHTLC_free_void(this_ptr: *mut c_void) {
1478 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeUpdateAddHTLC); }
1481 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
1482 impl UpdateAddHTLC {
1483 pub(crate) fn take_inner(mut self) -> *mut nativeUpdateAddHTLC {
1484 assert!(self.is_owned);
1485 let ret = self.inner;
1486 self.inner = std::ptr::null_mut();
1492 pub extern "C" fn UpdateAddHTLC_get_channel_id(this_ptr: &UpdateAddHTLC) -> *const [u8; 32] {
1493 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_id;
1498 pub extern "C" fn UpdateAddHTLC_set_channel_id(this_ptr: &mut UpdateAddHTLC, mut val: crate::c_types::ThirtyTwoBytes) {
1499 unsafe { &mut *this_ptr.inner }.channel_id = val.data;
1503 pub extern "C" fn UpdateAddHTLC_get_htlc_id(this_ptr: &UpdateAddHTLC) -> u64 {
1504 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.htlc_id;
1509 pub extern "C" fn UpdateAddHTLC_set_htlc_id(this_ptr: &mut UpdateAddHTLC, mut val: u64) {
1510 unsafe { &mut *this_ptr.inner }.htlc_id = val;
1512 /// The HTLC value in milli-satoshi
1514 pub extern "C" fn UpdateAddHTLC_get_amount_msat(this_ptr: &UpdateAddHTLC) -> u64 {
1515 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.amount_msat;
1518 /// The HTLC value in milli-satoshi
1520 pub extern "C" fn UpdateAddHTLC_set_amount_msat(this_ptr: &mut UpdateAddHTLC, mut val: u64) {
1521 unsafe { &mut *this_ptr.inner }.amount_msat = val;
1523 /// The payment hash, the pre-image of which controls HTLC redemption
1525 pub extern "C" fn UpdateAddHTLC_get_payment_hash(this_ptr: &UpdateAddHTLC) -> *const [u8; 32] {
1526 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.payment_hash;
1529 /// The payment hash, the pre-image of which controls HTLC redemption
1531 pub extern "C" fn UpdateAddHTLC_set_payment_hash(this_ptr: &mut UpdateAddHTLC, mut val: crate::c_types::ThirtyTwoBytes) {
1532 unsafe { &mut *this_ptr.inner }.payment_hash = ::lightning::ln::channelmanager::PaymentHash(val.data);
1534 /// The expiry height of the HTLC
1536 pub extern "C" fn UpdateAddHTLC_get_cltv_expiry(this_ptr: &UpdateAddHTLC) -> u32 {
1537 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.cltv_expiry;
1540 /// The expiry height of the HTLC
1542 pub extern "C" fn UpdateAddHTLC_set_cltv_expiry(this_ptr: &mut UpdateAddHTLC, mut val: u32) {
1543 unsafe { &mut *this_ptr.inner }.cltv_expiry = val;
1545 impl Clone for UpdateAddHTLC {
1546 fn clone(&self) -> Self {
1548 inner: if <*mut nativeUpdateAddHTLC>::is_null(self.inner) { std::ptr::null_mut() } else {
1549 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
1555 /// Used only if an object of this type is returned as a trait impl by a method
1556 pub(crate) extern "C" fn UpdateAddHTLC_clone_void(this_ptr: *const c_void) -> *mut c_void {
1557 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeUpdateAddHTLC)).clone() })) as *mut c_void
1560 /// Creates a copy of the UpdateAddHTLC
1561 pub extern "C" fn UpdateAddHTLC_clone(orig: &UpdateAddHTLC) -> UpdateAddHTLC {
1565 use lightning::ln::msgs::UpdateFulfillHTLC as nativeUpdateFulfillHTLCImport;
1566 type nativeUpdateFulfillHTLC = nativeUpdateFulfillHTLCImport;
1568 /// An update_fulfill_htlc message to be sent or received from a peer
1571 pub struct UpdateFulfillHTLC {
1572 /// A pointer to the opaque Rust object.
1574 /// Nearly everywhere, inner must be non-null, however in places where
1575 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
1576 pub inner: *mut nativeUpdateFulfillHTLC,
1577 /// Indicates that this is the only struct which contains the same pointer.
1579 /// Rust functions which take ownership of an object provided via an argument require
1580 /// this to be true and invalidate the object pointed to by inner.
1584 impl Drop for UpdateFulfillHTLC {
1585 fn drop(&mut self) {
1586 if self.is_owned && !<*mut nativeUpdateFulfillHTLC>::is_null(self.inner) {
1587 let _ = unsafe { Box::from_raw(self.inner) };
1591 /// Frees any resources used by the UpdateFulfillHTLC, if is_owned is set and inner is non-NULL.
1593 pub extern "C" fn UpdateFulfillHTLC_free(this_obj: UpdateFulfillHTLC) { }
1595 /// Used only if an object of this type is returned as a trait impl by a method
1596 extern "C" fn UpdateFulfillHTLC_free_void(this_ptr: *mut c_void) {
1597 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeUpdateFulfillHTLC); }
1600 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
1601 impl UpdateFulfillHTLC {
1602 pub(crate) fn take_inner(mut self) -> *mut nativeUpdateFulfillHTLC {
1603 assert!(self.is_owned);
1604 let ret = self.inner;
1605 self.inner = std::ptr::null_mut();
1611 pub extern "C" fn UpdateFulfillHTLC_get_channel_id(this_ptr: &UpdateFulfillHTLC) -> *const [u8; 32] {
1612 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_id;
1617 pub extern "C" fn UpdateFulfillHTLC_set_channel_id(this_ptr: &mut UpdateFulfillHTLC, mut val: crate::c_types::ThirtyTwoBytes) {
1618 unsafe { &mut *this_ptr.inner }.channel_id = val.data;
1622 pub extern "C" fn UpdateFulfillHTLC_get_htlc_id(this_ptr: &UpdateFulfillHTLC) -> u64 {
1623 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.htlc_id;
1628 pub extern "C" fn UpdateFulfillHTLC_set_htlc_id(this_ptr: &mut UpdateFulfillHTLC, mut val: u64) {
1629 unsafe { &mut *this_ptr.inner }.htlc_id = val;
1631 /// The pre-image of the payment hash, allowing HTLC redemption
1633 pub extern "C" fn UpdateFulfillHTLC_get_payment_preimage(this_ptr: &UpdateFulfillHTLC) -> *const [u8; 32] {
1634 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.payment_preimage;
1637 /// The pre-image of the payment hash, allowing HTLC redemption
1639 pub extern "C" fn UpdateFulfillHTLC_set_payment_preimage(this_ptr: &mut UpdateFulfillHTLC, mut val: crate::c_types::ThirtyTwoBytes) {
1640 unsafe { &mut *this_ptr.inner }.payment_preimage = ::lightning::ln::channelmanager::PaymentPreimage(val.data);
1642 /// Constructs a new UpdateFulfillHTLC given each field
1645 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 {
1646 UpdateFulfillHTLC { inner: Box::into_raw(Box::new(nativeUpdateFulfillHTLC {
1647 channel_id: channel_id_arg.data,
1648 htlc_id: htlc_id_arg,
1649 payment_preimage: ::lightning::ln::channelmanager::PaymentPreimage(payment_preimage_arg.data),
1650 })), is_owned: true }
1652 impl Clone for UpdateFulfillHTLC {
1653 fn clone(&self) -> Self {
1655 inner: if <*mut nativeUpdateFulfillHTLC>::is_null(self.inner) { std::ptr::null_mut() } else {
1656 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
1662 /// Used only if an object of this type is returned as a trait impl by a method
1663 pub(crate) extern "C" fn UpdateFulfillHTLC_clone_void(this_ptr: *const c_void) -> *mut c_void {
1664 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeUpdateFulfillHTLC)).clone() })) as *mut c_void
1667 /// Creates a copy of the UpdateFulfillHTLC
1668 pub extern "C" fn UpdateFulfillHTLC_clone(orig: &UpdateFulfillHTLC) -> UpdateFulfillHTLC {
1672 use lightning::ln::msgs::UpdateFailHTLC as nativeUpdateFailHTLCImport;
1673 type nativeUpdateFailHTLC = nativeUpdateFailHTLCImport;
1675 /// An update_fail_htlc message to be sent or received from a peer
1678 pub struct UpdateFailHTLC {
1679 /// A pointer to the opaque Rust object.
1681 /// Nearly everywhere, inner must be non-null, however in places where
1682 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
1683 pub inner: *mut nativeUpdateFailHTLC,
1684 /// Indicates that this is the only struct which contains the same pointer.
1686 /// Rust functions which take ownership of an object provided via an argument require
1687 /// this to be true and invalidate the object pointed to by inner.
1691 impl Drop for UpdateFailHTLC {
1692 fn drop(&mut self) {
1693 if self.is_owned && !<*mut nativeUpdateFailHTLC>::is_null(self.inner) {
1694 let _ = unsafe { Box::from_raw(self.inner) };
1698 /// Frees any resources used by the UpdateFailHTLC, if is_owned is set and inner is non-NULL.
1700 pub extern "C" fn UpdateFailHTLC_free(this_obj: UpdateFailHTLC) { }
1702 /// Used only if an object of this type is returned as a trait impl by a method
1703 extern "C" fn UpdateFailHTLC_free_void(this_ptr: *mut c_void) {
1704 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeUpdateFailHTLC); }
1707 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
1708 impl UpdateFailHTLC {
1709 pub(crate) fn take_inner(mut self) -> *mut nativeUpdateFailHTLC {
1710 assert!(self.is_owned);
1711 let ret = self.inner;
1712 self.inner = std::ptr::null_mut();
1718 pub extern "C" fn UpdateFailHTLC_get_channel_id(this_ptr: &UpdateFailHTLC) -> *const [u8; 32] {
1719 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_id;
1724 pub extern "C" fn UpdateFailHTLC_set_channel_id(this_ptr: &mut UpdateFailHTLC, mut val: crate::c_types::ThirtyTwoBytes) {
1725 unsafe { &mut *this_ptr.inner }.channel_id = val.data;
1729 pub extern "C" fn UpdateFailHTLC_get_htlc_id(this_ptr: &UpdateFailHTLC) -> u64 {
1730 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.htlc_id;
1735 pub extern "C" fn UpdateFailHTLC_set_htlc_id(this_ptr: &mut UpdateFailHTLC, mut val: u64) {
1736 unsafe { &mut *this_ptr.inner }.htlc_id = val;
1738 impl Clone for UpdateFailHTLC {
1739 fn clone(&self) -> Self {
1741 inner: if <*mut nativeUpdateFailHTLC>::is_null(self.inner) { std::ptr::null_mut() } else {
1742 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
1748 /// Used only if an object of this type is returned as a trait impl by a method
1749 pub(crate) extern "C" fn UpdateFailHTLC_clone_void(this_ptr: *const c_void) -> *mut c_void {
1750 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeUpdateFailHTLC)).clone() })) as *mut c_void
1753 /// Creates a copy of the UpdateFailHTLC
1754 pub extern "C" fn UpdateFailHTLC_clone(orig: &UpdateFailHTLC) -> UpdateFailHTLC {
1758 use lightning::ln::msgs::UpdateFailMalformedHTLC as nativeUpdateFailMalformedHTLCImport;
1759 type nativeUpdateFailMalformedHTLC = nativeUpdateFailMalformedHTLCImport;
1761 /// An update_fail_malformed_htlc message to be sent or received from a peer
1764 pub struct UpdateFailMalformedHTLC {
1765 /// A pointer to the opaque Rust object.
1767 /// Nearly everywhere, inner must be non-null, however in places where
1768 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
1769 pub inner: *mut nativeUpdateFailMalformedHTLC,
1770 /// Indicates that this is the only struct which contains the same pointer.
1772 /// Rust functions which take ownership of an object provided via an argument require
1773 /// this to be true and invalidate the object pointed to by inner.
1777 impl Drop for UpdateFailMalformedHTLC {
1778 fn drop(&mut self) {
1779 if self.is_owned && !<*mut nativeUpdateFailMalformedHTLC>::is_null(self.inner) {
1780 let _ = unsafe { Box::from_raw(self.inner) };
1784 /// Frees any resources used by the UpdateFailMalformedHTLC, if is_owned is set and inner is non-NULL.
1786 pub extern "C" fn UpdateFailMalformedHTLC_free(this_obj: UpdateFailMalformedHTLC) { }
1788 /// Used only if an object of this type is returned as a trait impl by a method
1789 extern "C" fn UpdateFailMalformedHTLC_free_void(this_ptr: *mut c_void) {
1790 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeUpdateFailMalformedHTLC); }
1793 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
1794 impl UpdateFailMalformedHTLC {
1795 pub(crate) fn take_inner(mut self) -> *mut nativeUpdateFailMalformedHTLC {
1796 assert!(self.is_owned);
1797 let ret = self.inner;
1798 self.inner = std::ptr::null_mut();
1804 pub extern "C" fn UpdateFailMalformedHTLC_get_channel_id(this_ptr: &UpdateFailMalformedHTLC) -> *const [u8; 32] {
1805 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_id;
1810 pub extern "C" fn UpdateFailMalformedHTLC_set_channel_id(this_ptr: &mut UpdateFailMalformedHTLC, mut val: crate::c_types::ThirtyTwoBytes) {
1811 unsafe { &mut *this_ptr.inner }.channel_id = val.data;
1815 pub extern "C" fn UpdateFailMalformedHTLC_get_htlc_id(this_ptr: &UpdateFailMalformedHTLC) -> u64 {
1816 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.htlc_id;
1821 pub extern "C" fn UpdateFailMalformedHTLC_set_htlc_id(this_ptr: &mut UpdateFailMalformedHTLC, mut val: u64) {
1822 unsafe { &mut *this_ptr.inner }.htlc_id = val;
1824 /// The failure code
1826 pub extern "C" fn UpdateFailMalformedHTLC_get_failure_code(this_ptr: &UpdateFailMalformedHTLC) -> u16 {
1827 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.failure_code;
1830 /// The failure code
1832 pub extern "C" fn UpdateFailMalformedHTLC_set_failure_code(this_ptr: &mut UpdateFailMalformedHTLC, mut val: u16) {
1833 unsafe { &mut *this_ptr.inner }.failure_code = val;
1835 impl Clone for UpdateFailMalformedHTLC {
1836 fn clone(&self) -> Self {
1838 inner: if <*mut nativeUpdateFailMalformedHTLC>::is_null(self.inner) { std::ptr::null_mut() } else {
1839 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
1845 /// Used only if an object of this type is returned as a trait impl by a method
1846 pub(crate) extern "C" fn UpdateFailMalformedHTLC_clone_void(this_ptr: *const c_void) -> *mut c_void {
1847 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeUpdateFailMalformedHTLC)).clone() })) as *mut c_void
1850 /// Creates a copy of the UpdateFailMalformedHTLC
1851 pub extern "C" fn UpdateFailMalformedHTLC_clone(orig: &UpdateFailMalformedHTLC) -> UpdateFailMalformedHTLC {
1855 use lightning::ln::msgs::CommitmentSigned as nativeCommitmentSignedImport;
1856 type nativeCommitmentSigned = nativeCommitmentSignedImport;
1858 /// A commitment_signed message to be sent or received from a peer
1861 pub struct CommitmentSigned {
1862 /// A pointer to the opaque Rust object.
1864 /// Nearly everywhere, inner must be non-null, however in places where
1865 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
1866 pub inner: *mut nativeCommitmentSigned,
1867 /// Indicates that this is the only struct which contains the same pointer.
1869 /// Rust functions which take ownership of an object provided via an argument require
1870 /// this to be true and invalidate the object pointed to by inner.
1874 impl Drop for CommitmentSigned {
1875 fn drop(&mut self) {
1876 if self.is_owned && !<*mut nativeCommitmentSigned>::is_null(self.inner) {
1877 let _ = unsafe { Box::from_raw(self.inner) };
1881 /// Frees any resources used by the CommitmentSigned, if is_owned is set and inner is non-NULL.
1883 pub extern "C" fn CommitmentSigned_free(this_obj: CommitmentSigned) { }
1885 /// Used only if an object of this type is returned as a trait impl by a method
1886 extern "C" fn CommitmentSigned_free_void(this_ptr: *mut c_void) {
1887 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeCommitmentSigned); }
1890 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
1891 impl CommitmentSigned {
1892 pub(crate) fn take_inner(mut self) -> *mut nativeCommitmentSigned {
1893 assert!(self.is_owned);
1894 let ret = self.inner;
1895 self.inner = std::ptr::null_mut();
1901 pub extern "C" fn CommitmentSigned_get_channel_id(this_ptr: &CommitmentSigned) -> *const [u8; 32] {
1902 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_id;
1907 pub extern "C" fn CommitmentSigned_set_channel_id(this_ptr: &mut CommitmentSigned, mut val: crate::c_types::ThirtyTwoBytes) {
1908 unsafe { &mut *this_ptr.inner }.channel_id = val.data;
1910 /// A signature on the commitment transaction
1912 pub extern "C" fn CommitmentSigned_get_signature(this_ptr: &CommitmentSigned) -> crate::c_types::Signature {
1913 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.signature;
1914 crate::c_types::Signature::from_rust(&(*inner_val))
1916 /// A signature on the commitment transaction
1918 pub extern "C" fn CommitmentSigned_set_signature(this_ptr: &mut CommitmentSigned, mut val: crate::c_types::Signature) {
1919 unsafe { &mut *this_ptr.inner }.signature = val.into_rust();
1921 /// Signatures on the HTLC transactions
1923 pub extern "C" fn CommitmentSigned_set_htlc_signatures(this_ptr: &mut CommitmentSigned, mut val: crate::c_types::derived::CVec_SignatureZ) {
1924 let mut local_val = Vec::new(); for mut item in val.into_rust().drain(..) { local_val.push( { item.into_rust() }); };
1925 unsafe { &mut *this_ptr.inner }.htlc_signatures = local_val;
1927 /// Constructs a new CommitmentSigned given each field
1930 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 {
1931 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() }); };
1932 CommitmentSigned { inner: Box::into_raw(Box::new(nativeCommitmentSigned {
1933 channel_id: channel_id_arg.data,
1934 signature: signature_arg.into_rust(),
1935 htlc_signatures: local_htlc_signatures_arg,
1936 })), is_owned: true }
1938 impl Clone for CommitmentSigned {
1939 fn clone(&self) -> Self {
1941 inner: if <*mut nativeCommitmentSigned>::is_null(self.inner) { std::ptr::null_mut() } else {
1942 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
1948 /// Used only if an object of this type is returned as a trait impl by a method
1949 pub(crate) extern "C" fn CommitmentSigned_clone_void(this_ptr: *const c_void) -> *mut c_void {
1950 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeCommitmentSigned)).clone() })) as *mut c_void
1953 /// Creates a copy of the CommitmentSigned
1954 pub extern "C" fn CommitmentSigned_clone(orig: &CommitmentSigned) -> CommitmentSigned {
1958 use lightning::ln::msgs::RevokeAndACK as nativeRevokeAndACKImport;
1959 type nativeRevokeAndACK = nativeRevokeAndACKImport;
1961 /// A revoke_and_ack message to be sent or received from a peer
1964 pub struct RevokeAndACK {
1965 /// A pointer to the opaque Rust object.
1967 /// Nearly everywhere, inner must be non-null, however in places where
1968 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
1969 pub inner: *mut nativeRevokeAndACK,
1970 /// Indicates that this is the only struct which contains the same pointer.
1972 /// Rust functions which take ownership of an object provided via an argument require
1973 /// this to be true and invalidate the object pointed to by inner.
1977 impl Drop for RevokeAndACK {
1978 fn drop(&mut self) {
1979 if self.is_owned && !<*mut nativeRevokeAndACK>::is_null(self.inner) {
1980 let _ = unsafe { Box::from_raw(self.inner) };
1984 /// Frees any resources used by the RevokeAndACK, if is_owned is set and inner is non-NULL.
1986 pub extern "C" fn RevokeAndACK_free(this_obj: RevokeAndACK) { }
1988 /// Used only if an object of this type is returned as a trait impl by a method
1989 extern "C" fn RevokeAndACK_free_void(this_ptr: *mut c_void) {
1990 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeRevokeAndACK); }
1993 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
1995 pub(crate) fn take_inner(mut self) -> *mut nativeRevokeAndACK {
1996 assert!(self.is_owned);
1997 let ret = self.inner;
1998 self.inner = std::ptr::null_mut();
2004 pub extern "C" fn RevokeAndACK_get_channel_id(this_ptr: &RevokeAndACK) -> *const [u8; 32] {
2005 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_id;
2010 pub extern "C" fn RevokeAndACK_set_channel_id(this_ptr: &mut RevokeAndACK, mut val: crate::c_types::ThirtyTwoBytes) {
2011 unsafe { &mut *this_ptr.inner }.channel_id = val.data;
2013 /// The secret corresponding to the per-commitment point
2015 pub extern "C" fn RevokeAndACK_get_per_commitment_secret(this_ptr: &RevokeAndACK) -> *const [u8; 32] {
2016 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.per_commitment_secret;
2019 /// The secret corresponding to the per-commitment point
2021 pub extern "C" fn RevokeAndACK_set_per_commitment_secret(this_ptr: &mut RevokeAndACK, mut val: crate::c_types::ThirtyTwoBytes) {
2022 unsafe { &mut *this_ptr.inner }.per_commitment_secret = val.data;
2024 /// The next sender-broadcast commitment transaction's per-commitment point
2026 pub extern "C" fn RevokeAndACK_get_next_per_commitment_point(this_ptr: &RevokeAndACK) -> crate::c_types::PublicKey {
2027 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.next_per_commitment_point;
2028 crate::c_types::PublicKey::from_rust(&(*inner_val))
2030 /// The next sender-broadcast commitment transaction's per-commitment point
2032 pub extern "C" fn RevokeAndACK_set_next_per_commitment_point(this_ptr: &mut RevokeAndACK, mut val: crate::c_types::PublicKey) {
2033 unsafe { &mut *this_ptr.inner }.next_per_commitment_point = val.into_rust();
2035 /// Constructs a new RevokeAndACK given each field
2038 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 {
2039 RevokeAndACK { inner: Box::into_raw(Box::new(nativeRevokeAndACK {
2040 channel_id: channel_id_arg.data,
2041 per_commitment_secret: per_commitment_secret_arg.data,
2042 next_per_commitment_point: next_per_commitment_point_arg.into_rust(),
2043 })), is_owned: true }
2045 impl Clone for RevokeAndACK {
2046 fn clone(&self) -> Self {
2048 inner: if <*mut nativeRevokeAndACK>::is_null(self.inner) { std::ptr::null_mut() } else {
2049 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
2055 /// Used only if an object of this type is returned as a trait impl by a method
2056 pub(crate) extern "C" fn RevokeAndACK_clone_void(this_ptr: *const c_void) -> *mut c_void {
2057 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeRevokeAndACK)).clone() })) as *mut c_void
2060 /// Creates a copy of the RevokeAndACK
2061 pub extern "C" fn RevokeAndACK_clone(orig: &RevokeAndACK) -> RevokeAndACK {
2065 use lightning::ln::msgs::UpdateFee as nativeUpdateFeeImport;
2066 type nativeUpdateFee = nativeUpdateFeeImport;
2068 /// An update_fee message to be sent or received from a peer
2071 pub struct UpdateFee {
2072 /// A pointer to the opaque Rust object.
2074 /// Nearly everywhere, inner must be non-null, however in places where
2075 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
2076 pub inner: *mut nativeUpdateFee,
2077 /// Indicates that this is the only struct which contains the same pointer.
2079 /// Rust functions which take ownership of an object provided via an argument require
2080 /// this to be true and invalidate the object pointed to by inner.
2084 impl Drop for UpdateFee {
2085 fn drop(&mut self) {
2086 if self.is_owned && !<*mut nativeUpdateFee>::is_null(self.inner) {
2087 let _ = unsafe { Box::from_raw(self.inner) };
2091 /// Frees any resources used by the UpdateFee, if is_owned is set and inner is non-NULL.
2093 pub extern "C" fn UpdateFee_free(this_obj: UpdateFee) { }
2095 /// Used only if an object of this type is returned as a trait impl by a method
2096 extern "C" fn UpdateFee_free_void(this_ptr: *mut c_void) {
2097 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeUpdateFee); }
2100 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
2102 pub(crate) fn take_inner(mut self) -> *mut nativeUpdateFee {
2103 assert!(self.is_owned);
2104 let ret = self.inner;
2105 self.inner = std::ptr::null_mut();
2111 pub extern "C" fn UpdateFee_get_channel_id(this_ptr: &UpdateFee) -> *const [u8; 32] {
2112 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_id;
2117 pub extern "C" fn UpdateFee_set_channel_id(this_ptr: &mut UpdateFee, mut val: crate::c_types::ThirtyTwoBytes) {
2118 unsafe { &mut *this_ptr.inner }.channel_id = val.data;
2120 /// Fee rate per 1000-weight of the transaction
2122 pub extern "C" fn UpdateFee_get_feerate_per_kw(this_ptr: &UpdateFee) -> u32 {
2123 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.feerate_per_kw;
2126 /// Fee rate per 1000-weight of the transaction
2128 pub extern "C" fn UpdateFee_set_feerate_per_kw(this_ptr: &mut UpdateFee, mut val: u32) {
2129 unsafe { &mut *this_ptr.inner }.feerate_per_kw = val;
2131 /// Constructs a new UpdateFee given each field
2134 pub extern "C" fn UpdateFee_new(mut channel_id_arg: crate::c_types::ThirtyTwoBytes, mut feerate_per_kw_arg: u32) -> UpdateFee {
2135 UpdateFee { inner: Box::into_raw(Box::new(nativeUpdateFee {
2136 channel_id: channel_id_arg.data,
2137 feerate_per_kw: feerate_per_kw_arg,
2138 })), is_owned: true }
2140 impl Clone for UpdateFee {
2141 fn clone(&self) -> Self {
2143 inner: if <*mut nativeUpdateFee>::is_null(self.inner) { std::ptr::null_mut() } else {
2144 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
2150 /// Used only if an object of this type is returned as a trait impl by a method
2151 pub(crate) extern "C" fn UpdateFee_clone_void(this_ptr: *const c_void) -> *mut c_void {
2152 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeUpdateFee)).clone() })) as *mut c_void
2155 /// Creates a copy of the UpdateFee
2156 pub extern "C" fn UpdateFee_clone(orig: &UpdateFee) -> UpdateFee {
2160 use lightning::ln::msgs::DataLossProtect as nativeDataLossProtectImport;
2161 type nativeDataLossProtect = nativeDataLossProtectImport;
2163 /// Proof that the sender knows the per-commitment secret of the previous commitment transaction.
2164 /// This is used to convince the recipient that the channel is at a certain commitment
2165 /// number even if they lost that data due to a local failure. Of course, the peer may lie
2166 /// and even later commitments may have been revoked.
2169 pub struct DataLossProtect {
2170 /// A pointer to the opaque Rust object.
2172 /// Nearly everywhere, inner must be non-null, however in places where
2173 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
2174 pub inner: *mut nativeDataLossProtect,
2175 /// Indicates that this is the only struct which contains the same pointer.
2177 /// Rust functions which take ownership of an object provided via an argument require
2178 /// this to be true and invalidate the object pointed to by inner.
2182 impl Drop for DataLossProtect {
2183 fn drop(&mut self) {
2184 if self.is_owned && !<*mut nativeDataLossProtect>::is_null(self.inner) {
2185 let _ = unsafe { Box::from_raw(self.inner) };
2189 /// Frees any resources used by the DataLossProtect, if is_owned is set and inner is non-NULL.
2191 pub extern "C" fn DataLossProtect_free(this_obj: DataLossProtect) { }
2193 /// Used only if an object of this type is returned as a trait impl by a method
2194 extern "C" fn DataLossProtect_free_void(this_ptr: *mut c_void) {
2195 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeDataLossProtect); }
2198 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
2199 impl DataLossProtect {
2200 pub(crate) fn take_inner(mut self) -> *mut nativeDataLossProtect {
2201 assert!(self.is_owned);
2202 let ret = self.inner;
2203 self.inner = std::ptr::null_mut();
2207 /// Proof that the sender knows the per-commitment secret of a specific commitment transaction
2208 /// belonging to the recipient
2210 pub extern "C" fn DataLossProtect_get_your_last_per_commitment_secret(this_ptr: &DataLossProtect) -> *const [u8; 32] {
2211 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.your_last_per_commitment_secret;
2214 /// Proof that the sender knows the per-commitment secret of a specific commitment transaction
2215 /// belonging to the recipient
2217 pub extern "C" fn DataLossProtect_set_your_last_per_commitment_secret(this_ptr: &mut DataLossProtect, mut val: crate::c_types::ThirtyTwoBytes) {
2218 unsafe { &mut *this_ptr.inner }.your_last_per_commitment_secret = val.data;
2220 /// The sender's per-commitment point for their current commitment transaction
2222 pub extern "C" fn DataLossProtect_get_my_current_per_commitment_point(this_ptr: &DataLossProtect) -> crate::c_types::PublicKey {
2223 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.my_current_per_commitment_point;
2224 crate::c_types::PublicKey::from_rust(&(*inner_val))
2226 /// The sender's per-commitment point for their current commitment transaction
2228 pub extern "C" fn DataLossProtect_set_my_current_per_commitment_point(this_ptr: &mut DataLossProtect, mut val: crate::c_types::PublicKey) {
2229 unsafe { &mut *this_ptr.inner }.my_current_per_commitment_point = val.into_rust();
2231 /// Constructs a new DataLossProtect given each field
2234 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 {
2235 DataLossProtect { inner: Box::into_raw(Box::new(nativeDataLossProtect {
2236 your_last_per_commitment_secret: your_last_per_commitment_secret_arg.data,
2237 my_current_per_commitment_point: my_current_per_commitment_point_arg.into_rust(),
2238 })), is_owned: true }
2240 impl Clone for DataLossProtect {
2241 fn clone(&self) -> Self {
2243 inner: if <*mut nativeDataLossProtect>::is_null(self.inner) { std::ptr::null_mut() } else {
2244 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
2250 /// Used only if an object of this type is returned as a trait impl by a method
2251 pub(crate) extern "C" fn DataLossProtect_clone_void(this_ptr: *const c_void) -> *mut c_void {
2252 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeDataLossProtect)).clone() })) as *mut c_void
2255 /// Creates a copy of the DataLossProtect
2256 pub extern "C" fn DataLossProtect_clone(orig: &DataLossProtect) -> DataLossProtect {
2260 use lightning::ln::msgs::ChannelReestablish as nativeChannelReestablishImport;
2261 type nativeChannelReestablish = nativeChannelReestablishImport;
2263 /// A channel_reestablish message to be sent or received from a peer
2266 pub struct ChannelReestablish {
2267 /// A pointer to the opaque Rust object.
2269 /// Nearly everywhere, inner must be non-null, however in places where
2270 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
2271 pub inner: *mut nativeChannelReestablish,
2272 /// Indicates that this is the only struct which contains the same pointer.
2274 /// Rust functions which take ownership of an object provided via an argument require
2275 /// this to be true and invalidate the object pointed to by inner.
2279 impl Drop for ChannelReestablish {
2280 fn drop(&mut self) {
2281 if self.is_owned && !<*mut nativeChannelReestablish>::is_null(self.inner) {
2282 let _ = unsafe { Box::from_raw(self.inner) };
2286 /// Frees any resources used by the ChannelReestablish, if is_owned is set and inner is non-NULL.
2288 pub extern "C" fn ChannelReestablish_free(this_obj: ChannelReestablish) { }
2290 /// Used only if an object of this type is returned as a trait impl by a method
2291 extern "C" fn ChannelReestablish_free_void(this_ptr: *mut c_void) {
2292 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeChannelReestablish); }
2295 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
2296 impl ChannelReestablish {
2297 pub(crate) fn take_inner(mut self) -> *mut nativeChannelReestablish {
2298 assert!(self.is_owned);
2299 let ret = self.inner;
2300 self.inner = std::ptr::null_mut();
2306 pub extern "C" fn ChannelReestablish_get_channel_id(this_ptr: &ChannelReestablish) -> *const [u8; 32] {
2307 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_id;
2312 pub extern "C" fn ChannelReestablish_set_channel_id(this_ptr: &mut ChannelReestablish, mut val: crate::c_types::ThirtyTwoBytes) {
2313 unsafe { &mut *this_ptr.inner }.channel_id = val.data;
2315 /// The next commitment number for the sender
2317 pub extern "C" fn ChannelReestablish_get_next_local_commitment_number(this_ptr: &ChannelReestablish) -> u64 {
2318 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.next_local_commitment_number;
2321 /// The next commitment number for the sender
2323 pub extern "C" fn ChannelReestablish_set_next_local_commitment_number(this_ptr: &mut ChannelReestablish, mut val: u64) {
2324 unsafe { &mut *this_ptr.inner }.next_local_commitment_number = val;
2326 /// The next commitment number for the recipient
2328 pub extern "C" fn ChannelReestablish_get_next_remote_commitment_number(this_ptr: &ChannelReestablish) -> u64 {
2329 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.next_remote_commitment_number;
2332 /// The next commitment number for the recipient
2334 pub extern "C" fn ChannelReestablish_set_next_remote_commitment_number(this_ptr: &mut ChannelReestablish, mut val: u64) {
2335 unsafe { &mut *this_ptr.inner }.next_remote_commitment_number = val;
2337 impl Clone for ChannelReestablish {
2338 fn clone(&self) -> Self {
2340 inner: if <*mut nativeChannelReestablish>::is_null(self.inner) { std::ptr::null_mut() } else {
2341 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
2347 /// Used only if an object of this type is returned as a trait impl by a method
2348 pub(crate) extern "C" fn ChannelReestablish_clone_void(this_ptr: *const c_void) -> *mut c_void {
2349 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeChannelReestablish)).clone() })) as *mut c_void
2352 /// Creates a copy of the ChannelReestablish
2353 pub extern "C" fn ChannelReestablish_clone(orig: &ChannelReestablish) -> ChannelReestablish {
2357 use lightning::ln::msgs::AnnouncementSignatures as nativeAnnouncementSignaturesImport;
2358 type nativeAnnouncementSignatures = nativeAnnouncementSignaturesImport;
2360 /// An announcement_signatures message to be sent or received from a peer
2363 pub struct AnnouncementSignatures {
2364 /// A pointer to the opaque Rust object.
2366 /// Nearly everywhere, inner must be non-null, however in places where
2367 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
2368 pub inner: *mut nativeAnnouncementSignatures,
2369 /// Indicates that this is the only struct which contains the same pointer.
2371 /// Rust functions which take ownership of an object provided via an argument require
2372 /// this to be true and invalidate the object pointed to by inner.
2376 impl Drop for AnnouncementSignatures {
2377 fn drop(&mut self) {
2378 if self.is_owned && !<*mut nativeAnnouncementSignatures>::is_null(self.inner) {
2379 let _ = unsafe { Box::from_raw(self.inner) };
2383 /// Frees any resources used by the AnnouncementSignatures, if is_owned is set and inner is non-NULL.
2385 pub extern "C" fn AnnouncementSignatures_free(this_obj: AnnouncementSignatures) { }
2387 /// Used only if an object of this type is returned as a trait impl by a method
2388 extern "C" fn AnnouncementSignatures_free_void(this_ptr: *mut c_void) {
2389 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeAnnouncementSignatures); }
2392 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
2393 impl AnnouncementSignatures {
2394 pub(crate) fn take_inner(mut self) -> *mut nativeAnnouncementSignatures {
2395 assert!(self.is_owned);
2396 let ret = self.inner;
2397 self.inner = std::ptr::null_mut();
2403 pub extern "C" fn AnnouncementSignatures_get_channel_id(this_ptr: &AnnouncementSignatures) -> *const [u8; 32] {
2404 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.channel_id;
2409 pub extern "C" fn AnnouncementSignatures_set_channel_id(this_ptr: &mut AnnouncementSignatures, mut val: crate::c_types::ThirtyTwoBytes) {
2410 unsafe { &mut *this_ptr.inner }.channel_id = val.data;
2412 /// The short channel ID
2414 pub extern "C" fn AnnouncementSignatures_get_short_channel_id(this_ptr: &AnnouncementSignatures) -> u64 {
2415 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.short_channel_id;
2418 /// The short channel ID
2420 pub extern "C" fn AnnouncementSignatures_set_short_channel_id(this_ptr: &mut AnnouncementSignatures, mut val: u64) {
2421 unsafe { &mut *this_ptr.inner }.short_channel_id = val;
2423 /// A signature by the node key
2425 pub extern "C" fn AnnouncementSignatures_get_node_signature(this_ptr: &AnnouncementSignatures) -> crate::c_types::Signature {
2426 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.node_signature;
2427 crate::c_types::Signature::from_rust(&(*inner_val))
2429 /// A signature by the node key
2431 pub extern "C" fn AnnouncementSignatures_set_node_signature(this_ptr: &mut AnnouncementSignatures, mut val: crate::c_types::Signature) {
2432 unsafe { &mut *this_ptr.inner }.node_signature = val.into_rust();
2434 /// A signature by the funding key
2436 pub extern "C" fn AnnouncementSignatures_get_bitcoin_signature(this_ptr: &AnnouncementSignatures) -> crate::c_types::Signature {
2437 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.bitcoin_signature;
2438 crate::c_types::Signature::from_rust(&(*inner_val))
2440 /// A signature by the funding key
2442 pub extern "C" fn AnnouncementSignatures_set_bitcoin_signature(this_ptr: &mut AnnouncementSignatures, mut val: crate::c_types::Signature) {
2443 unsafe { &mut *this_ptr.inner }.bitcoin_signature = val.into_rust();
2445 /// Constructs a new AnnouncementSignatures given each field
2448 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 {
2449 AnnouncementSignatures { inner: Box::into_raw(Box::new(nativeAnnouncementSignatures {
2450 channel_id: channel_id_arg.data,
2451 short_channel_id: short_channel_id_arg,
2452 node_signature: node_signature_arg.into_rust(),
2453 bitcoin_signature: bitcoin_signature_arg.into_rust(),
2454 })), is_owned: true }
2456 impl Clone for AnnouncementSignatures {
2457 fn clone(&self) -> Self {
2459 inner: if <*mut nativeAnnouncementSignatures>::is_null(self.inner) { std::ptr::null_mut() } else {
2460 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
2466 /// Used only if an object of this type is returned as a trait impl by a method
2467 pub(crate) extern "C" fn AnnouncementSignatures_clone_void(this_ptr: *const c_void) -> *mut c_void {
2468 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeAnnouncementSignatures)).clone() })) as *mut c_void
2471 /// Creates a copy of the AnnouncementSignatures
2472 pub extern "C" fn AnnouncementSignatures_clone(orig: &AnnouncementSignatures) -> AnnouncementSignatures {
2475 /// An address which can be used to connect to a remote peer
2479 pub enum NetAddress {
2480 /// An IPv4 address/port on which the peer is listening.
2482 /// The 4-byte IPv4 address
2483 addr: crate::c_types::FourBytes,
2484 /// The port on which the node is listening
2487 /// An IPv6 address/port on which the peer is listening.
2489 /// The 16-byte IPv6 address
2490 addr: crate::c_types::SixteenBytes,
2491 /// The port on which the node is listening
2494 /// An old-style Tor onion address/port on which the peer is listening.
2496 /// The bytes (usually encoded in base32 with \".onion\" appended)
2497 addr: crate::c_types::TenBytes,
2498 /// The port on which the node is listening
2501 /// A new-style Tor onion address/port on which the peer is listening.
2502 /// To create the human-readable \"hostname\", concatenate ed25519_pubkey, checksum, and version,
2503 /// wrap as base32 and append \".onion\".
2505 /// The ed25519 long-term public key of the peer
2506 ed25519_pubkey: crate::c_types::ThirtyTwoBytes,
2507 /// The checksum of the pubkey and version, as included in the onion address
2509 /// The version byte, as defined by the Tor Onion v3 spec.
2511 /// The port on which the node is listening
2515 use lightning::ln::msgs::NetAddress as nativeNetAddress;
2518 pub(crate) fn to_native(&self) -> nativeNetAddress {
2520 NetAddress::IPv4 {ref addr, ref port, } => {
2521 let mut addr_nonref = (*addr).clone();
2522 let mut port_nonref = (*port).clone();
2523 nativeNetAddress::IPv4 {
2524 addr: addr_nonref.data,
2528 NetAddress::IPv6 {ref addr, ref port, } => {
2529 let mut addr_nonref = (*addr).clone();
2530 let mut port_nonref = (*port).clone();
2531 nativeNetAddress::IPv6 {
2532 addr: addr_nonref.data,
2536 NetAddress::OnionV2 {ref addr, ref port, } => {
2537 let mut addr_nonref = (*addr).clone();
2538 let mut port_nonref = (*port).clone();
2539 nativeNetAddress::OnionV2 {
2540 addr: addr_nonref.data,
2544 NetAddress::OnionV3 {ref ed25519_pubkey, ref checksum, ref version, ref port, } => {
2545 let mut ed25519_pubkey_nonref = (*ed25519_pubkey).clone();
2546 let mut checksum_nonref = (*checksum).clone();
2547 let mut version_nonref = (*version).clone();
2548 let mut port_nonref = (*port).clone();
2549 nativeNetAddress::OnionV3 {
2550 ed25519_pubkey: ed25519_pubkey_nonref.data,
2551 checksum: checksum_nonref,
2552 version: version_nonref,
2559 pub(crate) fn into_native(self) -> nativeNetAddress {
2561 NetAddress::IPv4 {mut addr, mut port, } => {
2562 nativeNetAddress::IPv4 {
2567 NetAddress::IPv6 {mut addr, mut port, } => {
2568 nativeNetAddress::IPv6 {
2573 NetAddress::OnionV2 {mut addr, mut port, } => {
2574 nativeNetAddress::OnionV2 {
2579 NetAddress::OnionV3 {mut ed25519_pubkey, mut checksum, mut version, mut port, } => {
2580 nativeNetAddress::OnionV3 {
2581 ed25519_pubkey: ed25519_pubkey.data,
2590 pub(crate) fn from_native(native: &nativeNetAddress) -> Self {
2592 nativeNetAddress::IPv4 {ref addr, ref port, } => {
2593 let mut addr_nonref = (*addr).clone();
2594 let mut port_nonref = (*port).clone();
2596 addr: crate::c_types::FourBytes { data: addr_nonref },
2600 nativeNetAddress::IPv6 {ref addr, ref port, } => {
2601 let mut addr_nonref = (*addr).clone();
2602 let mut port_nonref = (*port).clone();
2604 addr: crate::c_types::SixteenBytes { data: addr_nonref },
2608 nativeNetAddress::OnionV2 {ref addr, ref port, } => {
2609 let mut addr_nonref = (*addr).clone();
2610 let mut port_nonref = (*port).clone();
2611 NetAddress::OnionV2 {
2612 addr: crate::c_types::TenBytes { data: addr_nonref },
2616 nativeNetAddress::OnionV3 {ref ed25519_pubkey, ref checksum, ref version, ref port, } => {
2617 let mut ed25519_pubkey_nonref = (*ed25519_pubkey).clone();
2618 let mut checksum_nonref = (*checksum).clone();
2619 let mut version_nonref = (*version).clone();
2620 let mut port_nonref = (*port).clone();
2621 NetAddress::OnionV3 {
2622 ed25519_pubkey: crate::c_types::ThirtyTwoBytes { data: ed25519_pubkey_nonref },
2623 checksum: checksum_nonref,
2624 version: version_nonref,
2631 pub(crate) fn native_into(native: nativeNetAddress) -> Self {
2633 nativeNetAddress::IPv4 {mut addr, mut port, } => {
2635 addr: crate::c_types::FourBytes { data: addr },
2639 nativeNetAddress::IPv6 {mut addr, mut port, } => {
2641 addr: crate::c_types::SixteenBytes { data: addr },
2645 nativeNetAddress::OnionV2 {mut addr, mut port, } => {
2646 NetAddress::OnionV2 {
2647 addr: crate::c_types::TenBytes { data: addr },
2651 nativeNetAddress::OnionV3 {mut ed25519_pubkey, mut checksum, mut version, mut port, } => {
2652 NetAddress::OnionV3 {
2653 ed25519_pubkey: crate::c_types::ThirtyTwoBytes { data: ed25519_pubkey },
2662 /// Frees any resources used by the NetAddress
2664 pub extern "C" fn NetAddress_free(this_ptr: NetAddress) { }
2665 /// Creates a copy of the NetAddress
2667 pub extern "C" fn NetAddress_clone(orig: &NetAddress) -> NetAddress {
2671 /// Serialize the NetAddress object into a byte array which can be read by NetAddress_read
2672 pub extern "C" fn NetAddress_write(obj: &NetAddress) -> crate::c_types::derived::CVec_u8Z {
2673 crate::c_types::serialize_obj(&unsafe { &*obj }.to_native())
2676 /// Read a Result from a byte array, created by Result_write
2677 pub extern "C" fn Result_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_CResult_NetAddressu8ZDecodeErrorZ {
2678 let res = crate::c_types::deserialize_obj(ser);
2679 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { let mut local_res_0 = match o { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::ln::msgs::NetAddress::native_into(o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { e }).into() }; local_res_0 }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
2683 use lightning::ln::msgs::UnsignedNodeAnnouncement as nativeUnsignedNodeAnnouncementImport;
2684 type nativeUnsignedNodeAnnouncement = nativeUnsignedNodeAnnouncementImport;
2686 /// The unsigned part of a node_announcement
2689 pub struct UnsignedNodeAnnouncement {
2690 /// A pointer to the opaque Rust object.
2692 /// Nearly everywhere, inner must be non-null, however in places where
2693 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
2694 pub inner: *mut nativeUnsignedNodeAnnouncement,
2695 /// Indicates that this is the only struct which contains the same pointer.
2697 /// Rust functions which take ownership of an object provided via an argument require
2698 /// this to be true and invalidate the object pointed to by inner.
2702 impl Drop for UnsignedNodeAnnouncement {
2703 fn drop(&mut self) {
2704 if self.is_owned && !<*mut nativeUnsignedNodeAnnouncement>::is_null(self.inner) {
2705 let _ = unsafe { Box::from_raw(self.inner) };
2709 /// Frees any resources used by the UnsignedNodeAnnouncement, if is_owned is set and inner is non-NULL.
2711 pub extern "C" fn UnsignedNodeAnnouncement_free(this_obj: UnsignedNodeAnnouncement) { }
2713 /// Used only if an object of this type is returned as a trait impl by a method
2714 extern "C" fn UnsignedNodeAnnouncement_free_void(this_ptr: *mut c_void) {
2715 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeUnsignedNodeAnnouncement); }
2718 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
2719 impl UnsignedNodeAnnouncement {
2720 pub(crate) fn take_inner(mut self) -> *mut nativeUnsignedNodeAnnouncement {
2721 assert!(self.is_owned);
2722 let ret = self.inner;
2723 self.inner = std::ptr::null_mut();
2727 /// The advertised features
2729 pub extern "C" fn UnsignedNodeAnnouncement_get_features(this_ptr: &UnsignedNodeAnnouncement) -> crate::ln::features::NodeFeatures {
2730 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.features;
2731 crate::ln::features::NodeFeatures { inner: unsafe { ( (&((*inner_val)) as *const _) as *mut _) }, is_owned: false }
2733 /// The advertised features
2735 pub extern "C" fn UnsignedNodeAnnouncement_set_features(this_ptr: &mut UnsignedNodeAnnouncement, mut val: crate::ln::features::NodeFeatures) {
2736 unsafe { &mut *this_ptr.inner }.features = *unsafe { Box::from_raw(val.take_inner()) };
2738 /// A strictly monotonic announcement counter, with gaps allowed
2740 pub extern "C" fn UnsignedNodeAnnouncement_get_timestamp(this_ptr: &UnsignedNodeAnnouncement) -> u32 {
2741 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.timestamp;
2744 /// A strictly monotonic announcement counter, with gaps allowed
2746 pub extern "C" fn UnsignedNodeAnnouncement_set_timestamp(this_ptr: &mut UnsignedNodeAnnouncement, mut val: u32) {
2747 unsafe { &mut *this_ptr.inner }.timestamp = val;
2749 /// The node_id this announcement originated from (don't rebroadcast the node_announcement back
2752 pub extern "C" fn UnsignedNodeAnnouncement_get_node_id(this_ptr: &UnsignedNodeAnnouncement) -> crate::c_types::PublicKey {
2753 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.node_id;
2754 crate::c_types::PublicKey::from_rust(&(*inner_val))
2756 /// The node_id this announcement originated from (don't rebroadcast the node_announcement back
2759 pub extern "C" fn UnsignedNodeAnnouncement_set_node_id(this_ptr: &mut UnsignedNodeAnnouncement, mut val: crate::c_types::PublicKey) {
2760 unsafe { &mut *this_ptr.inner }.node_id = val.into_rust();
2762 /// An RGB color for UI purposes
2764 pub extern "C" fn UnsignedNodeAnnouncement_get_rgb(this_ptr: &UnsignedNodeAnnouncement) -> *const [u8; 3] {
2765 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.rgb;
2768 /// An RGB color for UI purposes
2770 pub extern "C" fn UnsignedNodeAnnouncement_set_rgb(this_ptr: &mut UnsignedNodeAnnouncement, mut val: crate::c_types::ThreeBytes) {
2771 unsafe { &mut *this_ptr.inner }.rgb = val.data;
2773 /// An alias, for UI purposes. This should be sanitized before use. There is no guarantee
2776 pub extern "C" fn UnsignedNodeAnnouncement_get_alias(this_ptr: &UnsignedNodeAnnouncement) -> *const [u8; 32] {
2777 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.alias;
2780 /// An alias, for UI purposes. This should be sanitized before use. There is no guarantee
2783 pub extern "C" fn UnsignedNodeAnnouncement_set_alias(this_ptr: &mut UnsignedNodeAnnouncement, mut val: crate::c_types::ThirtyTwoBytes) {
2784 unsafe { &mut *this_ptr.inner }.alias = val.data;
2786 /// List of addresses on which this node is reachable
2788 pub extern "C" fn UnsignedNodeAnnouncement_set_addresses(this_ptr: &mut UnsignedNodeAnnouncement, mut val: crate::c_types::derived::CVec_NetAddressZ) {
2789 let mut local_val = Vec::new(); for mut item in val.into_rust().drain(..) { local_val.push( { item.into_native() }); };
2790 unsafe { &mut *this_ptr.inner }.addresses = local_val;
2792 impl Clone for UnsignedNodeAnnouncement {
2793 fn clone(&self) -> Self {
2795 inner: if <*mut nativeUnsignedNodeAnnouncement>::is_null(self.inner) { std::ptr::null_mut() } else {
2796 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
2802 /// Used only if an object of this type is returned as a trait impl by a method
2803 pub(crate) extern "C" fn UnsignedNodeAnnouncement_clone_void(this_ptr: *const c_void) -> *mut c_void {
2804 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeUnsignedNodeAnnouncement)).clone() })) as *mut c_void
2807 /// Creates a copy of the UnsignedNodeAnnouncement
2808 pub extern "C" fn UnsignedNodeAnnouncement_clone(orig: &UnsignedNodeAnnouncement) -> UnsignedNodeAnnouncement {
2812 use lightning::ln::msgs::NodeAnnouncement as nativeNodeAnnouncementImport;
2813 type nativeNodeAnnouncement = nativeNodeAnnouncementImport;
2815 /// A node_announcement message to be sent or received from a peer
2818 pub struct NodeAnnouncement {
2819 /// A pointer to the opaque Rust object.
2821 /// Nearly everywhere, inner must be non-null, however in places where
2822 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
2823 pub inner: *mut nativeNodeAnnouncement,
2824 /// Indicates that this is the only struct which contains the same pointer.
2826 /// Rust functions which take ownership of an object provided via an argument require
2827 /// this to be true and invalidate the object pointed to by inner.
2831 impl Drop for NodeAnnouncement {
2832 fn drop(&mut self) {
2833 if self.is_owned && !<*mut nativeNodeAnnouncement>::is_null(self.inner) {
2834 let _ = unsafe { Box::from_raw(self.inner) };
2838 /// Frees any resources used by the NodeAnnouncement, if is_owned is set and inner is non-NULL.
2840 pub extern "C" fn NodeAnnouncement_free(this_obj: NodeAnnouncement) { }
2842 /// Used only if an object of this type is returned as a trait impl by a method
2843 extern "C" fn NodeAnnouncement_free_void(this_ptr: *mut c_void) {
2844 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeNodeAnnouncement); }
2847 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
2848 impl NodeAnnouncement {
2849 pub(crate) fn take_inner(mut self) -> *mut nativeNodeAnnouncement {
2850 assert!(self.is_owned);
2851 let ret = self.inner;
2852 self.inner = std::ptr::null_mut();
2856 /// The signature by the node key
2858 pub extern "C" fn NodeAnnouncement_get_signature(this_ptr: &NodeAnnouncement) -> crate::c_types::Signature {
2859 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.signature;
2860 crate::c_types::Signature::from_rust(&(*inner_val))
2862 /// The signature by the node key
2864 pub extern "C" fn NodeAnnouncement_set_signature(this_ptr: &mut NodeAnnouncement, mut val: crate::c_types::Signature) {
2865 unsafe { &mut *this_ptr.inner }.signature = val.into_rust();
2867 /// The actual content of the announcement
2869 pub extern "C" fn NodeAnnouncement_get_contents(this_ptr: &NodeAnnouncement) -> crate::ln::msgs::UnsignedNodeAnnouncement {
2870 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.contents;
2871 crate::ln::msgs::UnsignedNodeAnnouncement { inner: unsafe { ( (&((*inner_val)) as *const _) as *mut _) }, is_owned: false }
2873 /// The actual content of the announcement
2875 pub extern "C" fn NodeAnnouncement_set_contents(this_ptr: &mut NodeAnnouncement, mut val: crate::ln::msgs::UnsignedNodeAnnouncement) {
2876 unsafe { &mut *this_ptr.inner }.contents = *unsafe { Box::from_raw(val.take_inner()) };
2878 /// Constructs a new NodeAnnouncement given each field
2881 pub extern "C" fn NodeAnnouncement_new(mut signature_arg: crate::c_types::Signature, mut contents_arg: crate::ln::msgs::UnsignedNodeAnnouncement) -> NodeAnnouncement {
2882 NodeAnnouncement { inner: Box::into_raw(Box::new(nativeNodeAnnouncement {
2883 signature: signature_arg.into_rust(),
2884 contents: *unsafe { Box::from_raw(contents_arg.take_inner()) },
2885 })), is_owned: true }
2887 impl Clone for NodeAnnouncement {
2888 fn clone(&self) -> Self {
2890 inner: if <*mut nativeNodeAnnouncement>::is_null(self.inner) { std::ptr::null_mut() } else {
2891 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
2897 /// Used only if an object of this type is returned as a trait impl by a method
2898 pub(crate) extern "C" fn NodeAnnouncement_clone_void(this_ptr: *const c_void) -> *mut c_void {
2899 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeNodeAnnouncement)).clone() })) as *mut c_void
2902 /// Creates a copy of the NodeAnnouncement
2903 pub extern "C" fn NodeAnnouncement_clone(orig: &NodeAnnouncement) -> NodeAnnouncement {
2907 use lightning::ln::msgs::UnsignedChannelAnnouncement as nativeUnsignedChannelAnnouncementImport;
2908 type nativeUnsignedChannelAnnouncement = nativeUnsignedChannelAnnouncementImport;
2910 /// The unsigned part of a channel_announcement
2913 pub struct UnsignedChannelAnnouncement {
2914 /// A pointer to the opaque Rust object.
2916 /// Nearly everywhere, inner must be non-null, however in places where
2917 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
2918 pub inner: *mut nativeUnsignedChannelAnnouncement,
2919 /// Indicates that this is the only struct which contains the same pointer.
2921 /// Rust functions which take ownership of an object provided via an argument require
2922 /// this to be true and invalidate the object pointed to by inner.
2926 impl Drop for UnsignedChannelAnnouncement {
2927 fn drop(&mut self) {
2928 if self.is_owned && !<*mut nativeUnsignedChannelAnnouncement>::is_null(self.inner) {
2929 let _ = unsafe { Box::from_raw(self.inner) };
2933 /// Frees any resources used by the UnsignedChannelAnnouncement, if is_owned is set and inner is non-NULL.
2935 pub extern "C" fn UnsignedChannelAnnouncement_free(this_obj: UnsignedChannelAnnouncement) { }
2937 /// Used only if an object of this type is returned as a trait impl by a method
2938 extern "C" fn UnsignedChannelAnnouncement_free_void(this_ptr: *mut c_void) {
2939 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeUnsignedChannelAnnouncement); }
2942 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
2943 impl UnsignedChannelAnnouncement {
2944 pub(crate) fn take_inner(mut self) -> *mut nativeUnsignedChannelAnnouncement {
2945 assert!(self.is_owned);
2946 let ret = self.inner;
2947 self.inner = std::ptr::null_mut();
2951 /// The advertised channel features
2953 pub extern "C" fn UnsignedChannelAnnouncement_get_features(this_ptr: &UnsignedChannelAnnouncement) -> crate::ln::features::ChannelFeatures {
2954 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.features;
2955 crate::ln::features::ChannelFeatures { inner: unsafe { ( (&((*inner_val)) as *const _) as *mut _) }, is_owned: false }
2957 /// The advertised channel features
2959 pub extern "C" fn UnsignedChannelAnnouncement_set_features(this_ptr: &mut UnsignedChannelAnnouncement, mut val: crate::ln::features::ChannelFeatures) {
2960 unsafe { &mut *this_ptr.inner }.features = *unsafe { Box::from_raw(val.take_inner()) };
2962 /// The genesis hash of the blockchain where the channel is to be opened
2964 pub extern "C" fn UnsignedChannelAnnouncement_get_chain_hash(this_ptr: &UnsignedChannelAnnouncement) -> *const [u8; 32] {
2965 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.chain_hash;
2966 (*inner_val).as_inner()
2968 /// The genesis hash of the blockchain where the channel is to be opened
2970 pub extern "C" fn UnsignedChannelAnnouncement_set_chain_hash(this_ptr: &mut UnsignedChannelAnnouncement, mut val: crate::c_types::ThirtyTwoBytes) {
2971 unsafe { &mut *this_ptr.inner }.chain_hash = ::bitcoin::hash_types::BlockHash::from_slice(&val.data[..]).unwrap();
2973 /// The short channel ID
2975 pub extern "C" fn UnsignedChannelAnnouncement_get_short_channel_id(this_ptr: &UnsignedChannelAnnouncement) -> u64 {
2976 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.short_channel_id;
2979 /// The short channel ID
2981 pub extern "C" fn UnsignedChannelAnnouncement_set_short_channel_id(this_ptr: &mut UnsignedChannelAnnouncement, mut val: u64) {
2982 unsafe { &mut *this_ptr.inner }.short_channel_id = val;
2984 /// One of the two node_ids which are endpoints of this channel
2986 pub extern "C" fn UnsignedChannelAnnouncement_get_node_id_1(this_ptr: &UnsignedChannelAnnouncement) -> crate::c_types::PublicKey {
2987 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.node_id_1;
2988 crate::c_types::PublicKey::from_rust(&(*inner_val))
2990 /// One of the two node_ids which are endpoints of this channel
2992 pub extern "C" fn UnsignedChannelAnnouncement_set_node_id_1(this_ptr: &mut UnsignedChannelAnnouncement, mut val: crate::c_types::PublicKey) {
2993 unsafe { &mut *this_ptr.inner }.node_id_1 = val.into_rust();
2995 /// The other of the two node_ids which are endpoints of this channel
2997 pub extern "C" fn UnsignedChannelAnnouncement_get_node_id_2(this_ptr: &UnsignedChannelAnnouncement) -> crate::c_types::PublicKey {
2998 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.node_id_2;
2999 crate::c_types::PublicKey::from_rust(&(*inner_val))
3001 /// The other of the two node_ids which are endpoints of this channel
3003 pub extern "C" fn UnsignedChannelAnnouncement_set_node_id_2(this_ptr: &mut UnsignedChannelAnnouncement, mut val: crate::c_types::PublicKey) {
3004 unsafe { &mut *this_ptr.inner }.node_id_2 = val.into_rust();
3006 /// The funding key for the first node
3008 pub extern "C" fn UnsignedChannelAnnouncement_get_bitcoin_key_1(this_ptr: &UnsignedChannelAnnouncement) -> crate::c_types::PublicKey {
3009 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.bitcoin_key_1;
3010 crate::c_types::PublicKey::from_rust(&(*inner_val))
3012 /// The funding key for the first node
3014 pub extern "C" fn UnsignedChannelAnnouncement_set_bitcoin_key_1(this_ptr: &mut UnsignedChannelAnnouncement, mut val: crate::c_types::PublicKey) {
3015 unsafe { &mut *this_ptr.inner }.bitcoin_key_1 = val.into_rust();
3017 /// The funding key for the second node
3019 pub extern "C" fn UnsignedChannelAnnouncement_get_bitcoin_key_2(this_ptr: &UnsignedChannelAnnouncement) -> crate::c_types::PublicKey {
3020 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.bitcoin_key_2;
3021 crate::c_types::PublicKey::from_rust(&(*inner_val))
3023 /// The funding key for the second node
3025 pub extern "C" fn UnsignedChannelAnnouncement_set_bitcoin_key_2(this_ptr: &mut UnsignedChannelAnnouncement, mut val: crate::c_types::PublicKey) {
3026 unsafe { &mut *this_ptr.inner }.bitcoin_key_2 = val.into_rust();
3028 impl Clone for UnsignedChannelAnnouncement {
3029 fn clone(&self) -> Self {
3031 inner: if <*mut nativeUnsignedChannelAnnouncement>::is_null(self.inner) { std::ptr::null_mut() } else {
3032 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
3038 /// Used only if an object of this type is returned as a trait impl by a method
3039 pub(crate) extern "C" fn UnsignedChannelAnnouncement_clone_void(this_ptr: *const c_void) -> *mut c_void {
3040 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeUnsignedChannelAnnouncement)).clone() })) as *mut c_void
3043 /// Creates a copy of the UnsignedChannelAnnouncement
3044 pub extern "C" fn UnsignedChannelAnnouncement_clone(orig: &UnsignedChannelAnnouncement) -> UnsignedChannelAnnouncement {
3048 use lightning::ln::msgs::ChannelAnnouncement as nativeChannelAnnouncementImport;
3049 type nativeChannelAnnouncement = nativeChannelAnnouncementImport;
3051 /// A channel_announcement message to be sent or received from a peer
3054 pub struct ChannelAnnouncement {
3055 /// A pointer to the opaque Rust object.
3057 /// Nearly everywhere, inner must be non-null, however in places where
3058 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
3059 pub inner: *mut nativeChannelAnnouncement,
3060 /// Indicates that this is the only struct which contains the same pointer.
3062 /// Rust functions which take ownership of an object provided via an argument require
3063 /// this to be true and invalidate the object pointed to by inner.
3067 impl Drop for ChannelAnnouncement {
3068 fn drop(&mut self) {
3069 if self.is_owned && !<*mut nativeChannelAnnouncement>::is_null(self.inner) {
3070 let _ = unsafe { Box::from_raw(self.inner) };
3074 /// Frees any resources used by the ChannelAnnouncement, if is_owned is set and inner is non-NULL.
3076 pub extern "C" fn ChannelAnnouncement_free(this_obj: ChannelAnnouncement) { }
3078 /// Used only if an object of this type is returned as a trait impl by a method
3079 extern "C" fn ChannelAnnouncement_free_void(this_ptr: *mut c_void) {
3080 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeChannelAnnouncement); }
3083 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
3084 impl ChannelAnnouncement {
3085 pub(crate) fn take_inner(mut self) -> *mut nativeChannelAnnouncement {
3086 assert!(self.is_owned);
3087 let ret = self.inner;
3088 self.inner = std::ptr::null_mut();
3092 /// Authentication of the announcement by the first public node
3094 pub extern "C" fn ChannelAnnouncement_get_node_signature_1(this_ptr: &ChannelAnnouncement) -> crate::c_types::Signature {
3095 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.node_signature_1;
3096 crate::c_types::Signature::from_rust(&(*inner_val))
3098 /// Authentication of the announcement by the first public node
3100 pub extern "C" fn ChannelAnnouncement_set_node_signature_1(this_ptr: &mut ChannelAnnouncement, mut val: crate::c_types::Signature) {
3101 unsafe { &mut *this_ptr.inner }.node_signature_1 = val.into_rust();
3103 /// Authentication of the announcement by the second public node
3105 pub extern "C" fn ChannelAnnouncement_get_node_signature_2(this_ptr: &ChannelAnnouncement) -> crate::c_types::Signature {
3106 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.node_signature_2;
3107 crate::c_types::Signature::from_rust(&(*inner_val))
3109 /// Authentication of the announcement by the second public node
3111 pub extern "C" fn ChannelAnnouncement_set_node_signature_2(this_ptr: &mut ChannelAnnouncement, mut val: crate::c_types::Signature) {
3112 unsafe { &mut *this_ptr.inner }.node_signature_2 = val.into_rust();
3114 /// Proof of funding UTXO ownership by the first public node
3116 pub extern "C" fn ChannelAnnouncement_get_bitcoin_signature_1(this_ptr: &ChannelAnnouncement) -> crate::c_types::Signature {
3117 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.bitcoin_signature_1;
3118 crate::c_types::Signature::from_rust(&(*inner_val))
3120 /// Proof of funding UTXO ownership by the first public node
3122 pub extern "C" fn ChannelAnnouncement_set_bitcoin_signature_1(this_ptr: &mut ChannelAnnouncement, mut val: crate::c_types::Signature) {
3123 unsafe { &mut *this_ptr.inner }.bitcoin_signature_1 = val.into_rust();
3125 /// Proof of funding UTXO ownership by the second public node
3127 pub extern "C" fn ChannelAnnouncement_get_bitcoin_signature_2(this_ptr: &ChannelAnnouncement) -> crate::c_types::Signature {
3128 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.bitcoin_signature_2;
3129 crate::c_types::Signature::from_rust(&(*inner_val))
3131 /// Proof of funding UTXO ownership by the second public node
3133 pub extern "C" fn ChannelAnnouncement_set_bitcoin_signature_2(this_ptr: &mut ChannelAnnouncement, mut val: crate::c_types::Signature) {
3134 unsafe { &mut *this_ptr.inner }.bitcoin_signature_2 = val.into_rust();
3136 /// The actual announcement
3138 pub extern "C" fn ChannelAnnouncement_get_contents(this_ptr: &ChannelAnnouncement) -> crate::ln::msgs::UnsignedChannelAnnouncement {
3139 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.contents;
3140 crate::ln::msgs::UnsignedChannelAnnouncement { inner: unsafe { ( (&((*inner_val)) as *const _) as *mut _) }, is_owned: false }
3142 /// The actual announcement
3144 pub extern "C" fn ChannelAnnouncement_set_contents(this_ptr: &mut ChannelAnnouncement, mut val: crate::ln::msgs::UnsignedChannelAnnouncement) {
3145 unsafe { &mut *this_ptr.inner }.contents = *unsafe { Box::from_raw(val.take_inner()) };
3147 /// Constructs a new ChannelAnnouncement given each field
3150 pub extern "C" fn ChannelAnnouncement_new(mut node_signature_1_arg: crate::c_types::Signature, mut node_signature_2_arg: crate::c_types::Signature, mut bitcoin_signature_1_arg: crate::c_types::Signature, mut bitcoin_signature_2_arg: crate::c_types::Signature, mut contents_arg: crate::ln::msgs::UnsignedChannelAnnouncement) -> ChannelAnnouncement {
3151 ChannelAnnouncement { inner: Box::into_raw(Box::new(nativeChannelAnnouncement {
3152 node_signature_1: node_signature_1_arg.into_rust(),
3153 node_signature_2: node_signature_2_arg.into_rust(),
3154 bitcoin_signature_1: bitcoin_signature_1_arg.into_rust(),
3155 bitcoin_signature_2: bitcoin_signature_2_arg.into_rust(),
3156 contents: *unsafe { Box::from_raw(contents_arg.take_inner()) },
3157 })), is_owned: true }
3159 impl Clone for ChannelAnnouncement {
3160 fn clone(&self) -> Self {
3162 inner: if <*mut nativeChannelAnnouncement>::is_null(self.inner) { std::ptr::null_mut() } else {
3163 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
3169 /// Used only if an object of this type is returned as a trait impl by a method
3170 pub(crate) extern "C" fn ChannelAnnouncement_clone_void(this_ptr: *const c_void) -> *mut c_void {
3171 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeChannelAnnouncement)).clone() })) as *mut c_void
3174 /// Creates a copy of the ChannelAnnouncement
3175 pub extern "C" fn ChannelAnnouncement_clone(orig: &ChannelAnnouncement) -> ChannelAnnouncement {
3179 use lightning::ln::msgs::UnsignedChannelUpdate as nativeUnsignedChannelUpdateImport;
3180 type nativeUnsignedChannelUpdate = nativeUnsignedChannelUpdateImport;
3182 /// The unsigned part of a channel_update
3185 pub struct UnsignedChannelUpdate {
3186 /// A pointer to the opaque Rust object.
3188 /// Nearly everywhere, inner must be non-null, however in places where
3189 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
3190 pub inner: *mut nativeUnsignedChannelUpdate,
3191 /// Indicates that this is the only struct which contains the same pointer.
3193 /// Rust functions which take ownership of an object provided via an argument require
3194 /// this to be true and invalidate the object pointed to by inner.
3198 impl Drop for UnsignedChannelUpdate {
3199 fn drop(&mut self) {
3200 if self.is_owned && !<*mut nativeUnsignedChannelUpdate>::is_null(self.inner) {
3201 let _ = unsafe { Box::from_raw(self.inner) };
3205 /// Frees any resources used by the UnsignedChannelUpdate, if is_owned is set and inner is non-NULL.
3207 pub extern "C" fn UnsignedChannelUpdate_free(this_obj: UnsignedChannelUpdate) { }
3209 /// Used only if an object of this type is returned as a trait impl by a method
3210 extern "C" fn UnsignedChannelUpdate_free_void(this_ptr: *mut c_void) {
3211 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeUnsignedChannelUpdate); }
3214 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
3215 impl UnsignedChannelUpdate {
3216 pub(crate) fn take_inner(mut self) -> *mut nativeUnsignedChannelUpdate {
3217 assert!(self.is_owned);
3218 let ret = self.inner;
3219 self.inner = std::ptr::null_mut();
3223 /// The genesis hash of the blockchain where the channel is to be opened
3225 pub extern "C" fn UnsignedChannelUpdate_get_chain_hash(this_ptr: &UnsignedChannelUpdate) -> *const [u8; 32] {
3226 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.chain_hash;
3227 (*inner_val).as_inner()
3229 /// The genesis hash of the blockchain where the channel is to be opened
3231 pub extern "C" fn UnsignedChannelUpdate_set_chain_hash(this_ptr: &mut UnsignedChannelUpdate, mut val: crate::c_types::ThirtyTwoBytes) {
3232 unsafe { &mut *this_ptr.inner }.chain_hash = ::bitcoin::hash_types::BlockHash::from_slice(&val.data[..]).unwrap();
3234 /// The short channel ID
3236 pub extern "C" fn UnsignedChannelUpdate_get_short_channel_id(this_ptr: &UnsignedChannelUpdate) -> u64 {
3237 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.short_channel_id;
3240 /// The short channel ID
3242 pub extern "C" fn UnsignedChannelUpdate_set_short_channel_id(this_ptr: &mut UnsignedChannelUpdate, mut val: u64) {
3243 unsafe { &mut *this_ptr.inner }.short_channel_id = val;
3245 /// A strictly monotonic announcement counter, with gaps allowed, specific to this channel
3247 pub extern "C" fn UnsignedChannelUpdate_get_timestamp(this_ptr: &UnsignedChannelUpdate) -> u32 {
3248 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.timestamp;
3251 /// A strictly monotonic announcement counter, with gaps allowed, specific to this channel
3253 pub extern "C" fn UnsignedChannelUpdate_set_timestamp(this_ptr: &mut UnsignedChannelUpdate, mut val: u32) {
3254 unsafe { &mut *this_ptr.inner }.timestamp = val;
3258 pub extern "C" fn UnsignedChannelUpdate_get_flags(this_ptr: &UnsignedChannelUpdate) -> u8 {
3259 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.flags;
3264 pub extern "C" fn UnsignedChannelUpdate_set_flags(this_ptr: &mut UnsignedChannelUpdate, mut val: u8) {
3265 unsafe { &mut *this_ptr.inner }.flags = val;
3267 /// The number of blocks to subtract from incoming HTLC cltv_expiry values
3269 pub extern "C" fn UnsignedChannelUpdate_get_cltv_expiry_delta(this_ptr: &UnsignedChannelUpdate) -> u16 {
3270 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.cltv_expiry_delta;
3273 /// The number of blocks to subtract from incoming HTLC cltv_expiry values
3275 pub extern "C" fn UnsignedChannelUpdate_set_cltv_expiry_delta(this_ptr: &mut UnsignedChannelUpdate, mut val: u16) {
3276 unsafe { &mut *this_ptr.inner }.cltv_expiry_delta = val;
3278 /// The minimum HTLC size incoming to sender, in milli-satoshi
3280 pub extern "C" fn UnsignedChannelUpdate_get_htlc_minimum_msat(this_ptr: &UnsignedChannelUpdate) -> u64 {
3281 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.htlc_minimum_msat;
3284 /// The minimum HTLC size incoming to sender, in milli-satoshi
3286 pub extern "C" fn UnsignedChannelUpdate_set_htlc_minimum_msat(this_ptr: &mut UnsignedChannelUpdate, mut val: u64) {
3287 unsafe { &mut *this_ptr.inner }.htlc_minimum_msat = val;
3289 /// The base HTLC fee charged by sender, in milli-satoshi
3291 pub extern "C" fn UnsignedChannelUpdate_get_fee_base_msat(this_ptr: &UnsignedChannelUpdate) -> u32 {
3292 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.fee_base_msat;
3295 /// The base HTLC fee charged by sender, in milli-satoshi
3297 pub extern "C" fn UnsignedChannelUpdate_set_fee_base_msat(this_ptr: &mut UnsignedChannelUpdate, mut val: u32) {
3298 unsafe { &mut *this_ptr.inner }.fee_base_msat = val;
3300 /// The amount to fee multiplier, in micro-satoshi
3302 pub extern "C" fn UnsignedChannelUpdate_get_fee_proportional_millionths(this_ptr: &UnsignedChannelUpdate) -> u32 {
3303 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.fee_proportional_millionths;
3306 /// The amount to fee multiplier, in micro-satoshi
3308 pub extern "C" fn UnsignedChannelUpdate_set_fee_proportional_millionths(this_ptr: &mut UnsignedChannelUpdate, mut val: u32) {
3309 unsafe { &mut *this_ptr.inner }.fee_proportional_millionths = val;
3311 impl Clone for UnsignedChannelUpdate {
3312 fn clone(&self) -> Self {
3314 inner: if <*mut nativeUnsignedChannelUpdate>::is_null(self.inner) { std::ptr::null_mut() } else {
3315 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
3321 /// Used only if an object of this type is returned as a trait impl by a method
3322 pub(crate) extern "C" fn UnsignedChannelUpdate_clone_void(this_ptr: *const c_void) -> *mut c_void {
3323 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeUnsignedChannelUpdate)).clone() })) as *mut c_void
3326 /// Creates a copy of the UnsignedChannelUpdate
3327 pub extern "C" fn UnsignedChannelUpdate_clone(orig: &UnsignedChannelUpdate) -> UnsignedChannelUpdate {
3331 use lightning::ln::msgs::ChannelUpdate as nativeChannelUpdateImport;
3332 type nativeChannelUpdate = nativeChannelUpdateImport;
3334 /// A channel_update message to be sent or received from a peer
3337 pub struct ChannelUpdate {
3338 /// A pointer to the opaque Rust object.
3340 /// Nearly everywhere, inner must be non-null, however in places where
3341 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
3342 pub inner: *mut nativeChannelUpdate,
3343 /// Indicates that this is the only struct which contains the same pointer.
3345 /// Rust functions which take ownership of an object provided via an argument require
3346 /// this to be true and invalidate the object pointed to by inner.
3350 impl Drop for ChannelUpdate {
3351 fn drop(&mut self) {
3352 if self.is_owned && !<*mut nativeChannelUpdate>::is_null(self.inner) {
3353 let _ = unsafe { Box::from_raw(self.inner) };
3357 /// Frees any resources used by the ChannelUpdate, if is_owned is set and inner is non-NULL.
3359 pub extern "C" fn ChannelUpdate_free(this_obj: ChannelUpdate) { }
3361 /// Used only if an object of this type is returned as a trait impl by a method
3362 extern "C" fn ChannelUpdate_free_void(this_ptr: *mut c_void) {
3363 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeChannelUpdate); }
3366 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
3367 impl ChannelUpdate {
3368 pub(crate) fn take_inner(mut self) -> *mut nativeChannelUpdate {
3369 assert!(self.is_owned);
3370 let ret = self.inner;
3371 self.inner = std::ptr::null_mut();
3375 /// A signature of the channel update
3377 pub extern "C" fn ChannelUpdate_get_signature(this_ptr: &ChannelUpdate) -> crate::c_types::Signature {
3378 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.signature;
3379 crate::c_types::Signature::from_rust(&(*inner_val))
3381 /// A signature of the channel update
3383 pub extern "C" fn ChannelUpdate_set_signature(this_ptr: &mut ChannelUpdate, mut val: crate::c_types::Signature) {
3384 unsafe { &mut *this_ptr.inner }.signature = val.into_rust();
3386 /// The actual channel update
3388 pub extern "C" fn ChannelUpdate_get_contents(this_ptr: &ChannelUpdate) -> crate::ln::msgs::UnsignedChannelUpdate {
3389 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.contents;
3390 crate::ln::msgs::UnsignedChannelUpdate { inner: unsafe { ( (&((*inner_val)) as *const _) as *mut _) }, is_owned: false }
3392 /// The actual channel update
3394 pub extern "C" fn ChannelUpdate_set_contents(this_ptr: &mut ChannelUpdate, mut val: crate::ln::msgs::UnsignedChannelUpdate) {
3395 unsafe { &mut *this_ptr.inner }.contents = *unsafe { Box::from_raw(val.take_inner()) };
3397 /// Constructs a new ChannelUpdate given each field
3400 pub extern "C" fn ChannelUpdate_new(mut signature_arg: crate::c_types::Signature, mut contents_arg: crate::ln::msgs::UnsignedChannelUpdate) -> ChannelUpdate {
3401 ChannelUpdate { inner: Box::into_raw(Box::new(nativeChannelUpdate {
3402 signature: signature_arg.into_rust(),
3403 contents: *unsafe { Box::from_raw(contents_arg.take_inner()) },
3404 })), is_owned: true }
3406 impl Clone for ChannelUpdate {
3407 fn clone(&self) -> Self {
3409 inner: if <*mut nativeChannelUpdate>::is_null(self.inner) { std::ptr::null_mut() } else {
3410 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
3416 /// Used only if an object of this type is returned as a trait impl by a method
3417 pub(crate) extern "C" fn ChannelUpdate_clone_void(this_ptr: *const c_void) -> *mut c_void {
3418 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeChannelUpdate)).clone() })) as *mut c_void
3421 /// Creates a copy of the ChannelUpdate
3422 pub extern "C" fn ChannelUpdate_clone(orig: &ChannelUpdate) -> ChannelUpdate {
3426 use lightning::ln::msgs::QueryChannelRange as nativeQueryChannelRangeImport;
3427 type nativeQueryChannelRange = nativeQueryChannelRangeImport;
3429 /// A query_channel_range message is used to query a peer for channel
3430 /// UTXOs in a range of blocks. The recipient of a query makes a best
3431 /// effort to reply to the query using one or more reply_channel_range
3435 pub struct QueryChannelRange {
3436 /// A pointer to the opaque Rust object.
3438 /// Nearly everywhere, inner must be non-null, however in places where
3439 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
3440 pub inner: *mut nativeQueryChannelRange,
3441 /// Indicates that this is the only struct which contains the same pointer.
3443 /// Rust functions which take ownership of an object provided via an argument require
3444 /// this to be true and invalidate the object pointed to by inner.
3448 impl Drop for QueryChannelRange {
3449 fn drop(&mut self) {
3450 if self.is_owned && !<*mut nativeQueryChannelRange>::is_null(self.inner) {
3451 let _ = unsafe { Box::from_raw(self.inner) };
3455 /// Frees any resources used by the QueryChannelRange, if is_owned is set and inner is non-NULL.
3457 pub extern "C" fn QueryChannelRange_free(this_obj: QueryChannelRange) { }
3459 /// Used only if an object of this type is returned as a trait impl by a method
3460 extern "C" fn QueryChannelRange_free_void(this_ptr: *mut c_void) {
3461 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeQueryChannelRange); }
3464 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
3465 impl QueryChannelRange {
3466 pub(crate) fn take_inner(mut self) -> *mut nativeQueryChannelRange {
3467 assert!(self.is_owned);
3468 let ret = self.inner;
3469 self.inner = std::ptr::null_mut();
3473 /// The genesis hash of the blockchain being queried
3475 pub extern "C" fn QueryChannelRange_get_chain_hash(this_ptr: &QueryChannelRange) -> *const [u8; 32] {
3476 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.chain_hash;
3477 (*inner_val).as_inner()
3479 /// The genesis hash of the blockchain being queried
3481 pub extern "C" fn QueryChannelRange_set_chain_hash(this_ptr: &mut QueryChannelRange, mut val: crate::c_types::ThirtyTwoBytes) {
3482 unsafe { &mut *this_ptr.inner }.chain_hash = ::bitcoin::hash_types::BlockHash::from_slice(&val.data[..]).unwrap();
3484 /// The height of the first block for the channel UTXOs being queried
3486 pub extern "C" fn QueryChannelRange_get_first_blocknum(this_ptr: &QueryChannelRange) -> u32 {
3487 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.first_blocknum;
3490 /// The height of the first block for the channel UTXOs being queried
3492 pub extern "C" fn QueryChannelRange_set_first_blocknum(this_ptr: &mut QueryChannelRange, mut val: u32) {
3493 unsafe { &mut *this_ptr.inner }.first_blocknum = val;
3495 /// The number of blocks to include in the query results
3497 pub extern "C" fn QueryChannelRange_get_number_of_blocks(this_ptr: &QueryChannelRange) -> u32 {
3498 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.number_of_blocks;
3501 /// The number of blocks to include in the query results
3503 pub extern "C" fn QueryChannelRange_set_number_of_blocks(this_ptr: &mut QueryChannelRange, mut val: u32) {
3504 unsafe { &mut *this_ptr.inner }.number_of_blocks = val;
3506 /// Constructs a new QueryChannelRange given each field
3509 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 {
3510 QueryChannelRange { inner: Box::into_raw(Box::new(nativeQueryChannelRange {
3511 chain_hash: ::bitcoin::hash_types::BlockHash::from_slice(&chain_hash_arg.data[..]).unwrap(),
3512 first_blocknum: first_blocknum_arg,
3513 number_of_blocks: number_of_blocks_arg,
3514 })), is_owned: true }
3516 impl Clone for QueryChannelRange {
3517 fn clone(&self) -> Self {
3519 inner: if <*mut nativeQueryChannelRange>::is_null(self.inner) { std::ptr::null_mut() } else {
3520 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
3526 /// Used only if an object of this type is returned as a trait impl by a method
3527 pub(crate) extern "C" fn QueryChannelRange_clone_void(this_ptr: *const c_void) -> *mut c_void {
3528 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeQueryChannelRange)).clone() })) as *mut c_void
3531 /// Creates a copy of the QueryChannelRange
3532 pub extern "C" fn QueryChannelRange_clone(orig: &QueryChannelRange) -> QueryChannelRange {
3536 use lightning::ln::msgs::ReplyChannelRange as nativeReplyChannelRangeImport;
3537 type nativeReplyChannelRange = nativeReplyChannelRangeImport;
3539 /// A reply_channel_range message is a reply to a query_channel_range
3540 /// message. Multiple reply_channel_range messages can be sent in reply
3541 /// to a single query_channel_range message. The query recipient makes a
3542 /// best effort to respond based on their local network view which may
3543 /// not be a perfect view of the network. The short_channel_ids in the
3544 /// reply are encoded. We only support encoding_type=0 uncompressed
3545 /// serialization and do not support encoding_type=1 zlib serialization.
3548 pub struct ReplyChannelRange {
3549 /// A pointer to the opaque Rust object.
3551 /// Nearly everywhere, inner must be non-null, however in places where
3552 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
3553 pub inner: *mut nativeReplyChannelRange,
3554 /// Indicates that this is the only struct which contains the same pointer.
3556 /// Rust functions which take ownership of an object provided via an argument require
3557 /// this to be true and invalidate the object pointed to by inner.
3561 impl Drop for ReplyChannelRange {
3562 fn drop(&mut self) {
3563 if self.is_owned && !<*mut nativeReplyChannelRange>::is_null(self.inner) {
3564 let _ = unsafe { Box::from_raw(self.inner) };
3568 /// Frees any resources used by the ReplyChannelRange, if is_owned is set and inner is non-NULL.
3570 pub extern "C" fn ReplyChannelRange_free(this_obj: ReplyChannelRange) { }
3572 /// Used only if an object of this type is returned as a trait impl by a method
3573 extern "C" fn ReplyChannelRange_free_void(this_ptr: *mut c_void) {
3574 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeReplyChannelRange); }
3577 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
3578 impl ReplyChannelRange {
3579 pub(crate) fn take_inner(mut self) -> *mut nativeReplyChannelRange {
3580 assert!(self.is_owned);
3581 let ret = self.inner;
3582 self.inner = std::ptr::null_mut();
3586 /// The genesis hash of the blockchain being queried
3588 pub extern "C" fn ReplyChannelRange_get_chain_hash(this_ptr: &ReplyChannelRange) -> *const [u8; 32] {
3589 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.chain_hash;
3590 (*inner_val).as_inner()
3592 /// The genesis hash of the blockchain being queried
3594 pub extern "C" fn ReplyChannelRange_set_chain_hash(this_ptr: &mut ReplyChannelRange, mut val: crate::c_types::ThirtyTwoBytes) {
3595 unsafe { &mut *this_ptr.inner }.chain_hash = ::bitcoin::hash_types::BlockHash::from_slice(&val.data[..]).unwrap();
3597 /// The height of the first block in the range of the reply
3599 pub extern "C" fn ReplyChannelRange_get_first_blocknum(this_ptr: &ReplyChannelRange) -> u32 {
3600 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.first_blocknum;
3603 /// The height of the first block in the range of the reply
3605 pub extern "C" fn ReplyChannelRange_set_first_blocknum(this_ptr: &mut ReplyChannelRange, mut val: u32) {
3606 unsafe { &mut *this_ptr.inner }.first_blocknum = val;
3608 /// The number of blocks included in the range of the reply
3610 pub extern "C" fn ReplyChannelRange_get_number_of_blocks(this_ptr: &ReplyChannelRange) -> u32 {
3611 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.number_of_blocks;
3614 /// The number of blocks included in the range of the reply
3616 pub extern "C" fn ReplyChannelRange_set_number_of_blocks(this_ptr: &mut ReplyChannelRange, mut val: u32) {
3617 unsafe { &mut *this_ptr.inner }.number_of_blocks = val;
3619 /// True when this is the final reply for a query
3621 pub extern "C" fn ReplyChannelRange_get_sync_complete(this_ptr: &ReplyChannelRange) -> bool {
3622 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.sync_complete;
3625 /// True when this is the final reply for a query
3627 pub extern "C" fn ReplyChannelRange_set_sync_complete(this_ptr: &mut ReplyChannelRange, mut val: bool) {
3628 unsafe { &mut *this_ptr.inner }.sync_complete = val;
3630 /// The short_channel_ids in the channel range
3632 pub extern "C" fn ReplyChannelRange_set_short_channel_ids(this_ptr: &mut ReplyChannelRange, mut val: crate::c_types::derived::CVec_u64Z) {
3633 let mut local_val = Vec::new(); for mut item in val.into_rust().drain(..) { local_val.push( { item }); };
3634 unsafe { &mut *this_ptr.inner }.short_channel_ids = local_val;
3636 /// Constructs a new ReplyChannelRange given each field
3639 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 {
3640 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 }); };
3641 ReplyChannelRange { inner: Box::into_raw(Box::new(nativeReplyChannelRange {
3642 chain_hash: ::bitcoin::hash_types::BlockHash::from_slice(&chain_hash_arg.data[..]).unwrap(),
3643 first_blocknum: first_blocknum_arg,
3644 number_of_blocks: number_of_blocks_arg,
3645 sync_complete: sync_complete_arg,
3646 short_channel_ids: local_short_channel_ids_arg,
3647 })), is_owned: true }
3649 impl Clone for ReplyChannelRange {
3650 fn clone(&self) -> Self {
3652 inner: if <*mut nativeReplyChannelRange>::is_null(self.inner) { std::ptr::null_mut() } else {
3653 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
3659 /// Used only if an object of this type is returned as a trait impl by a method
3660 pub(crate) extern "C" fn ReplyChannelRange_clone_void(this_ptr: *const c_void) -> *mut c_void {
3661 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeReplyChannelRange)).clone() })) as *mut c_void
3664 /// Creates a copy of the ReplyChannelRange
3665 pub extern "C" fn ReplyChannelRange_clone(orig: &ReplyChannelRange) -> ReplyChannelRange {
3669 use lightning::ln::msgs::QueryShortChannelIds as nativeQueryShortChannelIdsImport;
3670 type nativeQueryShortChannelIds = nativeQueryShortChannelIdsImport;
3672 /// A query_short_channel_ids message is used to query a peer for
3673 /// routing gossip messages related to one or more short_channel_ids.
3674 /// The query recipient will reply with the latest, if available,
3675 /// channel_announcement, channel_update and node_announcement messages
3676 /// it maintains for the requested short_channel_ids followed by a
3677 /// reply_short_channel_ids_end message. The short_channel_ids sent in
3678 /// this query are encoded. We only support encoding_type=0 uncompressed
3679 /// serialization and do not support encoding_type=1 zlib serialization.
3682 pub struct QueryShortChannelIds {
3683 /// A pointer to the opaque Rust object.
3685 /// Nearly everywhere, inner must be non-null, however in places where
3686 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
3687 pub inner: *mut nativeQueryShortChannelIds,
3688 /// Indicates that this is the only struct which contains the same pointer.
3690 /// Rust functions which take ownership of an object provided via an argument require
3691 /// this to be true and invalidate the object pointed to by inner.
3695 impl Drop for QueryShortChannelIds {
3696 fn drop(&mut self) {
3697 if self.is_owned && !<*mut nativeQueryShortChannelIds>::is_null(self.inner) {
3698 let _ = unsafe { Box::from_raw(self.inner) };
3702 /// Frees any resources used by the QueryShortChannelIds, if is_owned is set and inner is non-NULL.
3704 pub extern "C" fn QueryShortChannelIds_free(this_obj: QueryShortChannelIds) { }
3706 /// Used only if an object of this type is returned as a trait impl by a method
3707 extern "C" fn QueryShortChannelIds_free_void(this_ptr: *mut c_void) {
3708 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeQueryShortChannelIds); }
3711 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
3712 impl QueryShortChannelIds {
3713 pub(crate) fn take_inner(mut self) -> *mut nativeQueryShortChannelIds {
3714 assert!(self.is_owned);
3715 let ret = self.inner;
3716 self.inner = std::ptr::null_mut();
3720 /// The genesis hash of the blockchain being queried
3722 pub extern "C" fn QueryShortChannelIds_get_chain_hash(this_ptr: &QueryShortChannelIds) -> *const [u8; 32] {
3723 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.chain_hash;
3724 (*inner_val).as_inner()
3726 /// The genesis hash of the blockchain being queried
3728 pub extern "C" fn QueryShortChannelIds_set_chain_hash(this_ptr: &mut QueryShortChannelIds, mut val: crate::c_types::ThirtyTwoBytes) {
3729 unsafe { &mut *this_ptr.inner }.chain_hash = ::bitcoin::hash_types::BlockHash::from_slice(&val.data[..]).unwrap();
3731 /// The short_channel_ids that are being queried
3733 pub extern "C" fn QueryShortChannelIds_set_short_channel_ids(this_ptr: &mut QueryShortChannelIds, mut val: crate::c_types::derived::CVec_u64Z) {
3734 let mut local_val = Vec::new(); for mut item in val.into_rust().drain(..) { local_val.push( { item }); };
3735 unsafe { &mut *this_ptr.inner }.short_channel_ids = local_val;
3737 /// Constructs a new QueryShortChannelIds given each field
3740 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 {
3741 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 }); };
3742 QueryShortChannelIds { inner: Box::into_raw(Box::new(nativeQueryShortChannelIds {
3743 chain_hash: ::bitcoin::hash_types::BlockHash::from_slice(&chain_hash_arg.data[..]).unwrap(),
3744 short_channel_ids: local_short_channel_ids_arg,
3745 })), is_owned: true }
3747 impl Clone for QueryShortChannelIds {
3748 fn clone(&self) -> Self {
3750 inner: if <*mut nativeQueryShortChannelIds>::is_null(self.inner) { std::ptr::null_mut() } else {
3751 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
3757 /// Used only if an object of this type is returned as a trait impl by a method
3758 pub(crate) extern "C" fn QueryShortChannelIds_clone_void(this_ptr: *const c_void) -> *mut c_void {
3759 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeQueryShortChannelIds)).clone() })) as *mut c_void
3762 /// Creates a copy of the QueryShortChannelIds
3763 pub extern "C" fn QueryShortChannelIds_clone(orig: &QueryShortChannelIds) -> QueryShortChannelIds {
3767 use lightning::ln::msgs::ReplyShortChannelIdsEnd as nativeReplyShortChannelIdsEndImport;
3768 type nativeReplyShortChannelIdsEnd = nativeReplyShortChannelIdsEndImport;
3770 /// A reply_short_channel_ids_end message is sent as a reply to a
3771 /// query_short_channel_ids message. The query recipient makes a best
3772 /// effort to respond based on their local network view which may not be
3773 /// a perfect view of the network.
3776 pub struct ReplyShortChannelIdsEnd {
3777 /// A pointer to the opaque Rust object.
3779 /// Nearly everywhere, inner must be non-null, however in places where
3780 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
3781 pub inner: *mut nativeReplyShortChannelIdsEnd,
3782 /// Indicates that this is the only struct which contains the same pointer.
3784 /// Rust functions which take ownership of an object provided via an argument require
3785 /// this to be true and invalidate the object pointed to by inner.
3789 impl Drop for ReplyShortChannelIdsEnd {
3790 fn drop(&mut self) {
3791 if self.is_owned && !<*mut nativeReplyShortChannelIdsEnd>::is_null(self.inner) {
3792 let _ = unsafe { Box::from_raw(self.inner) };
3796 /// Frees any resources used by the ReplyShortChannelIdsEnd, if is_owned is set and inner is non-NULL.
3798 pub extern "C" fn ReplyShortChannelIdsEnd_free(this_obj: ReplyShortChannelIdsEnd) { }
3800 /// Used only if an object of this type is returned as a trait impl by a method
3801 extern "C" fn ReplyShortChannelIdsEnd_free_void(this_ptr: *mut c_void) {
3802 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeReplyShortChannelIdsEnd); }
3805 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
3806 impl ReplyShortChannelIdsEnd {
3807 pub(crate) fn take_inner(mut self) -> *mut nativeReplyShortChannelIdsEnd {
3808 assert!(self.is_owned);
3809 let ret = self.inner;
3810 self.inner = std::ptr::null_mut();
3814 /// The genesis hash of the blockchain that was queried
3816 pub extern "C" fn ReplyShortChannelIdsEnd_get_chain_hash(this_ptr: &ReplyShortChannelIdsEnd) -> *const [u8; 32] {
3817 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.chain_hash;
3818 (*inner_val).as_inner()
3820 /// The genesis hash of the blockchain that was queried
3822 pub extern "C" fn ReplyShortChannelIdsEnd_set_chain_hash(this_ptr: &mut ReplyShortChannelIdsEnd, mut val: crate::c_types::ThirtyTwoBytes) {
3823 unsafe { &mut *this_ptr.inner }.chain_hash = ::bitcoin::hash_types::BlockHash::from_slice(&val.data[..]).unwrap();
3825 /// Indicates if the query recipient maintains up-to-date channel
3826 /// information for the chain_hash
3828 pub extern "C" fn ReplyShortChannelIdsEnd_get_full_information(this_ptr: &ReplyShortChannelIdsEnd) -> bool {
3829 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.full_information;
3832 /// Indicates if the query recipient maintains up-to-date channel
3833 /// information for the chain_hash
3835 pub extern "C" fn ReplyShortChannelIdsEnd_set_full_information(this_ptr: &mut ReplyShortChannelIdsEnd, mut val: bool) {
3836 unsafe { &mut *this_ptr.inner }.full_information = val;
3838 /// Constructs a new ReplyShortChannelIdsEnd given each field
3841 pub extern "C" fn ReplyShortChannelIdsEnd_new(mut chain_hash_arg: crate::c_types::ThirtyTwoBytes, mut full_information_arg: bool) -> ReplyShortChannelIdsEnd {
3842 ReplyShortChannelIdsEnd { inner: Box::into_raw(Box::new(nativeReplyShortChannelIdsEnd {
3843 chain_hash: ::bitcoin::hash_types::BlockHash::from_slice(&chain_hash_arg.data[..]).unwrap(),
3844 full_information: full_information_arg,
3845 })), is_owned: true }
3847 impl Clone for ReplyShortChannelIdsEnd {
3848 fn clone(&self) -> Self {
3850 inner: if <*mut nativeReplyShortChannelIdsEnd>::is_null(self.inner) { std::ptr::null_mut() } else {
3851 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
3857 /// Used only if an object of this type is returned as a trait impl by a method
3858 pub(crate) extern "C" fn ReplyShortChannelIdsEnd_clone_void(this_ptr: *const c_void) -> *mut c_void {
3859 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeReplyShortChannelIdsEnd)).clone() })) as *mut c_void
3862 /// Creates a copy of the ReplyShortChannelIdsEnd
3863 pub extern "C" fn ReplyShortChannelIdsEnd_clone(orig: &ReplyShortChannelIdsEnd) -> ReplyShortChannelIdsEnd {
3867 use lightning::ln::msgs::GossipTimestampFilter as nativeGossipTimestampFilterImport;
3868 type nativeGossipTimestampFilter = nativeGossipTimestampFilterImport;
3870 /// A gossip_timestamp_filter message is used by a node to request
3871 /// gossip relay for messages in the requested time range when the
3872 /// gossip_queries feature has been negotiated.
3875 pub struct GossipTimestampFilter {
3876 /// A pointer to the opaque Rust object.
3878 /// Nearly everywhere, inner must be non-null, however in places where
3879 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
3880 pub inner: *mut nativeGossipTimestampFilter,
3881 /// Indicates that this is the only struct which contains the same pointer.
3883 /// Rust functions which take ownership of an object provided via an argument require
3884 /// this to be true and invalidate the object pointed to by inner.
3888 impl Drop for GossipTimestampFilter {
3889 fn drop(&mut self) {
3890 if self.is_owned && !<*mut nativeGossipTimestampFilter>::is_null(self.inner) {
3891 let _ = unsafe { Box::from_raw(self.inner) };
3895 /// Frees any resources used by the GossipTimestampFilter, if is_owned is set and inner is non-NULL.
3897 pub extern "C" fn GossipTimestampFilter_free(this_obj: GossipTimestampFilter) { }
3899 /// Used only if an object of this type is returned as a trait impl by a method
3900 extern "C" fn GossipTimestampFilter_free_void(this_ptr: *mut c_void) {
3901 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeGossipTimestampFilter); }
3904 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
3905 impl GossipTimestampFilter {
3906 pub(crate) fn take_inner(mut self) -> *mut nativeGossipTimestampFilter {
3907 assert!(self.is_owned);
3908 let ret = self.inner;
3909 self.inner = std::ptr::null_mut();
3913 /// The genesis hash of the blockchain for channel and node information
3915 pub extern "C" fn GossipTimestampFilter_get_chain_hash(this_ptr: &GossipTimestampFilter) -> *const [u8; 32] {
3916 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.chain_hash;
3917 (*inner_val).as_inner()
3919 /// The genesis hash of the blockchain for channel and node information
3921 pub extern "C" fn GossipTimestampFilter_set_chain_hash(this_ptr: &mut GossipTimestampFilter, mut val: crate::c_types::ThirtyTwoBytes) {
3922 unsafe { &mut *this_ptr.inner }.chain_hash = ::bitcoin::hash_types::BlockHash::from_slice(&val.data[..]).unwrap();
3924 /// The starting unix timestamp
3926 pub extern "C" fn GossipTimestampFilter_get_first_timestamp(this_ptr: &GossipTimestampFilter) -> u32 {
3927 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.first_timestamp;
3930 /// The starting unix timestamp
3932 pub extern "C" fn GossipTimestampFilter_set_first_timestamp(this_ptr: &mut GossipTimestampFilter, mut val: u32) {
3933 unsafe { &mut *this_ptr.inner }.first_timestamp = val;
3935 /// The range of information in seconds
3937 pub extern "C" fn GossipTimestampFilter_get_timestamp_range(this_ptr: &GossipTimestampFilter) -> u32 {
3938 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.timestamp_range;
3941 /// The range of information in seconds
3943 pub extern "C" fn GossipTimestampFilter_set_timestamp_range(this_ptr: &mut GossipTimestampFilter, mut val: u32) {
3944 unsafe { &mut *this_ptr.inner }.timestamp_range = val;
3946 /// Constructs a new GossipTimestampFilter given each field
3949 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 {
3950 GossipTimestampFilter { inner: Box::into_raw(Box::new(nativeGossipTimestampFilter {
3951 chain_hash: ::bitcoin::hash_types::BlockHash::from_slice(&chain_hash_arg.data[..]).unwrap(),
3952 first_timestamp: first_timestamp_arg,
3953 timestamp_range: timestamp_range_arg,
3954 })), is_owned: true }
3956 impl Clone for GossipTimestampFilter {
3957 fn clone(&self) -> Self {
3959 inner: if <*mut nativeGossipTimestampFilter>::is_null(self.inner) { std::ptr::null_mut() } else {
3960 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
3966 /// Used only if an object of this type is returned as a trait impl by a method
3967 pub(crate) extern "C" fn GossipTimestampFilter_clone_void(this_ptr: *const c_void) -> *mut c_void {
3968 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeGossipTimestampFilter)).clone() })) as *mut c_void
3971 /// Creates a copy of the GossipTimestampFilter
3972 pub extern "C" fn GossipTimestampFilter_clone(orig: &GossipTimestampFilter) -> GossipTimestampFilter {
3975 /// Used to put an error message in a LightningError
3979 pub enum ErrorAction {
3980 /// The peer took some action which made us think they were useless. Disconnect them.
3982 /// An error message which we should make an effort to send before we disconnect.
3983 msg: crate::ln::msgs::ErrorMessage,
3985 /// The peer did something harmless that we weren't able to process, just log and ignore
3987 /// The peer did something incorrect. Tell them.
3989 /// The message to send.
3990 msg: crate::ln::msgs::ErrorMessage,
3993 use lightning::ln::msgs::ErrorAction as nativeErrorAction;
3996 pub(crate) fn to_native(&self) -> nativeErrorAction {
3998 ErrorAction::DisconnectPeer {ref msg, } => {
3999 let mut msg_nonref = (*msg).clone();
4000 let mut local_msg_nonref = if msg_nonref.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(msg_nonref.take_inner()) } }) };
4001 nativeErrorAction::DisconnectPeer {
4002 msg: local_msg_nonref,
4005 ErrorAction::IgnoreError => nativeErrorAction::IgnoreError,
4006 ErrorAction::SendErrorMessage {ref msg, } => {
4007 let mut msg_nonref = (*msg).clone();
4008 nativeErrorAction::SendErrorMessage {
4009 msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) },
4015 pub(crate) fn into_native(self) -> nativeErrorAction {
4017 ErrorAction::DisconnectPeer {mut msg, } => {
4018 let mut local_msg = if msg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(msg.take_inner()) } }) };
4019 nativeErrorAction::DisconnectPeer {
4023 ErrorAction::IgnoreError => nativeErrorAction::IgnoreError,
4024 ErrorAction::SendErrorMessage {mut msg, } => {
4025 nativeErrorAction::SendErrorMessage {
4026 msg: *unsafe { Box::from_raw(msg.take_inner()) },
4032 pub(crate) fn from_native(native: &nativeErrorAction) -> Self {
4034 nativeErrorAction::DisconnectPeer {ref msg, } => {
4035 let mut msg_nonref = (*msg).clone();
4036 let mut local_msg_nonref = crate::ln::msgs::ErrorMessage { inner: if msg_nonref.is_none() { std::ptr::null_mut() } else { { Box::into_raw(Box::new((msg_nonref.unwrap()))) } }, is_owned: true };
4037 ErrorAction::DisconnectPeer {
4038 msg: local_msg_nonref,
4041 nativeErrorAction::IgnoreError => ErrorAction::IgnoreError,
4042 nativeErrorAction::SendErrorMessage {ref msg, } => {
4043 let mut msg_nonref = (*msg).clone();
4044 ErrorAction::SendErrorMessage {
4045 msg: crate::ln::msgs::ErrorMessage { inner: Box::into_raw(Box::new(msg_nonref)), is_owned: true },
4051 pub(crate) fn native_into(native: nativeErrorAction) -> Self {
4053 nativeErrorAction::DisconnectPeer {mut msg, } => {
4054 let mut local_msg = crate::ln::msgs::ErrorMessage { inner: if msg.is_none() { std::ptr::null_mut() } else { { Box::into_raw(Box::new((msg.unwrap()))) } }, is_owned: true };
4055 ErrorAction::DisconnectPeer {
4059 nativeErrorAction::IgnoreError => ErrorAction::IgnoreError,
4060 nativeErrorAction::SendErrorMessage {mut msg, } => {
4061 ErrorAction::SendErrorMessage {
4062 msg: crate::ln::msgs::ErrorMessage { inner: Box::into_raw(Box::new(msg)), is_owned: true },
4068 /// Frees any resources used by the ErrorAction
4070 pub extern "C" fn ErrorAction_free(this_ptr: ErrorAction) { }
4071 /// Creates a copy of the ErrorAction
4073 pub extern "C" fn ErrorAction_clone(orig: &ErrorAction) -> ErrorAction {
4077 use lightning::ln::msgs::LightningError as nativeLightningErrorImport;
4078 type nativeLightningError = nativeLightningErrorImport;
4080 /// An Err type for failure to process messages.
4083 pub struct LightningError {
4084 /// A pointer to the opaque Rust object.
4086 /// Nearly everywhere, inner must be non-null, however in places where
4087 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
4088 pub inner: *mut nativeLightningError,
4089 /// Indicates that this is the only struct which contains the same pointer.
4091 /// Rust functions which take ownership of an object provided via an argument require
4092 /// this to be true and invalidate the object pointed to by inner.
4096 impl Drop for LightningError {
4097 fn drop(&mut self) {
4098 if self.is_owned && !<*mut nativeLightningError>::is_null(self.inner) {
4099 let _ = unsafe { Box::from_raw(self.inner) };
4103 /// Frees any resources used by the LightningError, if is_owned is set and inner is non-NULL.
4105 pub extern "C" fn LightningError_free(this_obj: LightningError) { }
4107 /// Used only if an object of this type is returned as a trait impl by a method
4108 extern "C" fn LightningError_free_void(this_ptr: *mut c_void) {
4109 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeLightningError); }
4112 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
4113 impl LightningError {
4114 pub(crate) fn take_inner(mut self) -> *mut nativeLightningError {
4115 assert!(self.is_owned);
4116 let ret = self.inner;
4117 self.inner = std::ptr::null_mut();
4121 /// A human-readable message describing the error
4123 pub extern "C" fn LightningError_get_err(this_ptr: &LightningError) -> crate::c_types::Str {
4124 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.err;
4125 (*inner_val).as_str().into()
4127 /// A human-readable message describing the error
4129 pub extern "C" fn LightningError_set_err(this_ptr: &mut LightningError, mut val: crate::c_types::derived::CVec_u8Z) {
4130 unsafe { &mut *this_ptr.inner }.err = String::from_utf8(val.into_rust()).unwrap();
4132 /// The action which should be taken against the offending peer.
4134 pub extern "C" fn LightningError_get_action(this_ptr: &LightningError) -> crate::ln::msgs::ErrorAction {
4135 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.action;
4136 crate::ln::msgs::ErrorAction::from_native(&(*inner_val))
4138 /// The action which should be taken against the offending peer.
4140 pub extern "C" fn LightningError_set_action(this_ptr: &mut LightningError, mut val: crate::ln::msgs::ErrorAction) {
4141 unsafe { &mut *this_ptr.inner }.action = val.into_native();
4143 /// Constructs a new LightningError given each field
4146 pub extern "C" fn LightningError_new(mut err_arg: crate::c_types::derived::CVec_u8Z, mut action_arg: crate::ln::msgs::ErrorAction) -> LightningError {
4147 LightningError { inner: Box::into_raw(Box::new(nativeLightningError {
4148 err: String::from_utf8(err_arg.into_rust()).unwrap(),
4149 action: action_arg.into_native(),
4150 })), is_owned: true }
4152 impl Clone for LightningError {
4153 fn clone(&self) -> Self {
4155 inner: if <*mut nativeLightningError>::is_null(self.inner) { std::ptr::null_mut() } else {
4156 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
4162 /// Used only if an object of this type is returned as a trait impl by a method
4163 pub(crate) extern "C" fn LightningError_clone_void(this_ptr: *const c_void) -> *mut c_void {
4164 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeLightningError)).clone() })) as *mut c_void
4167 /// Creates a copy of the LightningError
4168 pub extern "C" fn LightningError_clone(orig: &LightningError) -> LightningError {
4172 use lightning::ln::msgs::CommitmentUpdate as nativeCommitmentUpdateImport;
4173 type nativeCommitmentUpdate = nativeCommitmentUpdateImport;
4175 /// Struct used to return values from revoke_and_ack messages, containing a bunch of commitment
4176 /// transaction updates if they were pending.
4179 pub struct CommitmentUpdate {
4180 /// A pointer to the opaque Rust object.
4182 /// Nearly everywhere, inner must be non-null, however in places where
4183 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
4184 pub inner: *mut nativeCommitmentUpdate,
4185 /// Indicates that this is the only struct which contains the same pointer.
4187 /// Rust functions which take ownership of an object provided via an argument require
4188 /// this to be true and invalidate the object pointed to by inner.
4192 impl Drop for CommitmentUpdate {
4193 fn drop(&mut self) {
4194 if self.is_owned && !<*mut nativeCommitmentUpdate>::is_null(self.inner) {
4195 let _ = unsafe { Box::from_raw(self.inner) };
4199 /// Frees any resources used by the CommitmentUpdate, if is_owned is set and inner is non-NULL.
4201 pub extern "C" fn CommitmentUpdate_free(this_obj: CommitmentUpdate) { }
4203 /// Used only if an object of this type is returned as a trait impl by a method
4204 extern "C" fn CommitmentUpdate_free_void(this_ptr: *mut c_void) {
4205 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeCommitmentUpdate); }
4208 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
4209 impl CommitmentUpdate {
4210 pub(crate) fn take_inner(mut self) -> *mut nativeCommitmentUpdate {
4211 assert!(self.is_owned);
4212 let ret = self.inner;
4213 self.inner = std::ptr::null_mut();
4217 /// update_add_htlc messages which should be sent
4219 pub extern "C" fn CommitmentUpdate_set_update_add_htlcs(this_ptr: &mut CommitmentUpdate, mut val: crate::c_types::derived::CVec_UpdateAddHTLCZ) {
4220 let mut local_val = Vec::new(); for mut item in val.into_rust().drain(..) { local_val.push( { *unsafe { Box::from_raw(item.take_inner()) } }); };
4221 unsafe { &mut *this_ptr.inner }.update_add_htlcs = local_val;
4223 /// update_fulfill_htlc messages which should be sent
4225 pub extern "C" fn CommitmentUpdate_set_update_fulfill_htlcs(this_ptr: &mut CommitmentUpdate, mut val: crate::c_types::derived::CVec_UpdateFulfillHTLCZ) {
4226 let mut local_val = Vec::new(); for mut item in val.into_rust().drain(..) { local_val.push( { *unsafe { Box::from_raw(item.take_inner()) } }); };
4227 unsafe { &mut *this_ptr.inner }.update_fulfill_htlcs = local_val;
4229 /// update_fail_htlc messages which should be sent
4231 pub extern "C" fn CommitmentUpdate_set_update_fail_htlcs(this_ptr: &mut CommitmentUpdate, mut val: crate::c_types::derived::CVec_UpdateFailHTLCZ) {
4232 let mut local_val = Vec::new(); for mut item in val.into_rust().drain(..) { local_val.push( { *unsafe { Box::from_raw(item.take_inner()) } }); };
4233 unsafe { &mut *this_ptr.inner }.update_fail_htlcs = local_val;
4235 /// update_fail_malformed_htlc messages which should be sent
4237 pub extern "C" fn CommitmentUpdate_set_update_fail_malformed_htlcs(this_ptr: &mut CommitmentUpdate, mut val: crate::c_types::derived::CVec_UpdateFailMalformedHTLCZ) {
4238 let mut local_val = Vec::new(); for mut item in val.into_rust().drain(..) { local_val.push( { *unsafe { Box::from_raw(item.take_inner()) } }); };
4239 unsafe { &mut *this_ptr.inner }.update_fail_malformed_htlcs = local_val;
4241 /// An update_fee message which should be sent
4243 pub extern "C" fn CommitmentUpdate_get_update_fee(this_ptr: &CommitmentUpdate) -> crate::ln::msgs::UpdateFee {
4244 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.update_fee;
4245 let mut local_inner_val = crate::ln::msgs::UpdateFee { inner: unsafe { (if inner_val.is_none() { std::ptr::null() } else { { (inner_val.as_ref().unwrap()) } } as *const _) as *mut _ }, is_owned: false };
4248 /// An update_fee message which should be sent
4250 pub extern "C" fn CommitmentUpdate_set_update_fee(this_ptr: &mut CommitmentUpdate, mut val: crate::ln::msgs::UpdateFee) {
4251 let mut local_val = if val.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(val.take_inner()) } }) };
4252 unsafe { &mut *this_ptr.inner }.update_fee = local_val;
4254 /// Finally, the commitment_signed message which should be sent
4256 pub extern "C" fn CommitmentUpdate_get_commitment_signed(this_ptr: &CommitmentUpdate) -> crate::ln::msgs::CommitmentSigned {
4257 let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.commitment_signed;
4258 crate::ln::msgs::CommitmentSigned { inner: unsafe { ( (&((*inner_val)) as *const _) as *mut _) }, is_owned: false }
4260 /// Finally, the commitment_signed message which should be sent
4262 pub extern "C" fn CommitmentUpdate_set_commitment_signed(this_ptr: &mut CommitmentUpdate, mut val: crate::ln::msgs::CommitmentSigned) {
4263 unsafe { &mut *this_ptr.inner }.commitment_signed = *unsafe { Box::from_raw(val.take_inner()) };
4265 /// Constructs a new CommitmentUpdate given each field
4268 pub extern "C" fn CommitmentUpdate_new(mut update_add_htlcs_arg: crate::c_types::derived::CVec_UpdateAddHTLCZ, mut update_fulfill_htlcs_arg: crate::c_types::derived::CVec_UpdateFulfillHTLCZ, mut update_fail_htlcs_arg: crate::c_types::derived::CVec_UpdateFailHTLCZ, mut update_fail_malformed_htlcs_arg: crate::c_types::derived::CVec_UpdateFailMalformedHTLCZ, mut update_fee_arg: crate::ln::msgs::UpdateFee, mut commitment_signed_arg: crate::ln::msgs::CommitmentSigned) -> CommitmentUpdate {
4269 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()) } }); };
4270 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()) } }); };
4271 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()) } }); };
4272 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()) } }); };
4273 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()) } }) };
4274 CommitmentUpdate { inner: Box::into_raw(Box::new(nativeCommitmentUpdate {
4275 update_add_htlcs: local_update_add_htlcs_arg,
4276 update_fulfill_htlcs: local_update_fulfill_htlcs_arg,
4277 update_fail_htlcs: local_update_fail_htlcs_arg,
4278 update_fail_malformed_htlcs: local_update_fail_malformed_htlcs_arg,
4279 update_fee: local_update_fee_arg,
4280 commitment_signed: *unsafe { Box::from_raw(commitment_signed_arg.take_inner()) },
4281 })), is_owned: true }
4283 impl Clone for CommitmentUpdate {
4284 fn clone(&self) -> Self {
4286 inner: if <*mut nativeCommitmentUpdate>::is_null(self.inner) { std::ptr::null_mut() } else {
4287 Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
4293 /// Used only if an object of this type is returned as a trait impl by a method
4294 pub(crate) extern "C" fn CommitmentUpdate_clone_void(this_ptr: *const c_void) -> *mut c_void {
4295 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeCommitmentUpdate)).clone() })) as *mut c_void
4298 /// Creates a copy of the CommitmentUpdate
4299 pub extern "C" fn CommitmentUpdate_clone(orig: &CommitmentUpdate) -> CommitmentUpdate {
4302 /// The information we received from a peer along the route of a payment we originated. This is
4303 /// returned by ChannelMessageHandler::handle_update_fail_htlc to be passed into
4304 /// RoutingMessageHandler::handle_htlc_fail_channel_update to update our network map.
4308 pub enum HTLCFailChannelUpdate {
4309 /// We received an error which included a full ChannelUpdate message.
4310 ChannelUpdateMessage {
4311 /// The unwrapped message we received
4312 msg: crate::ln::msgs::ChannelUpdate,
4314 /// We received an error which indicated only that a channel has been closed
4316 /// The short_channel_id which has now closed.
4317 short_channel_id: u64,
4318 /// when this true, this channel should be permanently removed from the
4319 /// consideration. Otherwise, this channel can be restored as new channel_update is received
4322 /// We received an error which indicated only that a node has failed
4324 /// The node_id that has failed.
4325 node_id: crate::c_types::PublicKey,
4326 /// when this true, node should be permanently removed from the
4327 /// consideration. Otherwise, the channels connected to this node can be
4328 /// restored as new channel_update is received
4332 use lightning::ln::msgs::HTLCFailChannelUpdate as nativeHTLCFailChannelUpdate;
4333 impl HTLCFailChannelUpdate {
4335 pub(crate) fn to_native(&self) -> nativeHTLCFailChannelUpdate {
4337 HTLCFailChannelUpdate::ChannelUpdateMessage {ref msg, } => {
4338 let mut msg_nonref = (*msg).clone();
4339 nativeHTLCFailChannelUpdate::ChannelUpdateMessage {
4340 msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) },
4343 HTLCFailChannelUpdate::ChannelClosed {ref short_channel_id, ref is_permanent, } => {
4344 let mut short_channel_id_nonref = (*short_channel_id).clone();
4345 let mut is_permanent_nonref = (*is_permanent).clone();
4346 nativeHTLCFailChannelUpdate::ChannelClosed {
4347 short_channel_id: short_channel_id_nonref,
4348 is_permanent: is_permanent_nonref,
4351 HTLCFailChannelUpdate::NodeFailure {ref node_id, ref is_permanent, } => {
4352 let mut node_id_nonref = (*node_id).clone();
4353 let mut is_permanent_nonref = (*is_permanent).clone();
4354 nativeHTLCFailChannelUpdate::NodeFailure {
4355 node_id: node_id_nonref.into_rust(),
4356 is_permanent: is_permanent_nonref,
4362 pub(crate) fn into_native(self) -> nativeHTLCFailChannelUpdate {
4364 HTLCFailChannelUpdate::ChannelUpdateMessage {mut msg, } => {
4365 nativeHTLCFailChannelUpdate::ChannelUpdateMessage {
4366 msg: *unsafe { Box::from_raw(msg.take_inner()) },
4369 HTLCFailChannelUpdate::ChannelClosed {mut short_channel_id, mut is_permanent, } => {
4370 nativeHTLCFailChannelUpdate::ChannelClosed {
4371 short_channel_id: short_channel_id,
4372 is_permanent: is_permanent,
4375 HTLCFailChannelUpdate::NodeFailure {mut node_id, mut is_permanent, } => {
4376 nativeHTLCFailChannelUpdate::NodeFailure {
4377 node_id: node_id.into_rust(),
4378 is_permanent: is_permanent,
4384 pub(crate) fn from_native(native: &nativeHTLCFailChannelUpdate) -> Self {
4386 nativeHTLCFailChannelUpdate::ChannelUpdateMessage {ref msg, } => {
4387 let mut msg_nonref = (*msg).clone();
4388 HTLCFailChannelUpdate::ChannelUpdateMessage {
4389 msg: crate::ln::msgs::ChannelUpdate { inner: Box::into_raw(Box::new(msg_nonref)), is_owned: true },
4392 nativeHTLCFailChannelUpdate::ChannelClosed {ref short_channel_id, ref is_permanent, } => {
4393 let mut short_channel_id_nonref = (*short_channel_id).clone();
4394 let mut is_permanent_nonref = (*is_permanent).clone();
4395 HTLCFailChannelUpdate::ChannelClosed {
4396 short_channel_id: short_channel_id_nonref,
4397 is_permanent: is_permanent_nonref,
4400 nativeHTLCFailChannelUpdate::NodeFailure {ref node_id, ref is_permanent, } => {
4401 let mut node_id_nonref = (*node_id).clone();
4402 let mut is_permanent_nonref = (*is_permanent).clone();
4403 HTLCFailChannelUpdate::NodeFailure {
4404 node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref),
4405 is_permanent: is_permanent_nonref,
4411 pub(crate) fn native_into(native: nativeHTLCFailChannelUpdate) -> Self {
4413 nativeHTLCFailChannelUpdate::ChannelUpdateMessage {mut msg, } => {
4414 HTLCFailChannelUpdate::ChannelUpdateMessage {
4415 msg: crate::ln::msgs::ChannelUpdate { inner: Box::into_raw(Box::new(msg)), is_owned: true },
4418 nativeHTLCFailChannelUpdate::ChannelClosed {mut short_channel_id, mut is_permanent, } => {
4419 HTLCFailChannelUpdate::ChannelClosed {
4420 short_channel_id: short_channel_id,
4421 is_permanent: is_permanent,
4424 nativeHTLCFailChannelUpdate::NodeFailure {mut node_id, mut is_permanent, } => {
4425 HTLCFailChannelUpdate::NodeFailure {
4426 node_id: crate::c_types::PublicKey::from_rust(&node_id),
4427 is_permanent: is_permanent,
4433 /// Frees any resources used by the HTLCFailChannelUpdate
4435 pub extern "C" fn HTLCFailChannelUpdate_free(this_ptr: HTLCFailChannelUpdate) { }
4436 /// Creates a copy of the HTLCFailChannelUpdate
4438 pub extern "C" fn HTLCFailChannelUpdate_clone(orig: &HTLCFailChannelUpdate) -> HTLCFailChannelUpdate {
4441 /// A trait to describe an object which can receive channel messages.
4443 /// Messages MAY be called in parallel when they originate from different their_node_ids, however
4444 /// they MUST NOT be called in parallel when the two calls have the same their_node_id.
4446 pub struct ChannelMessageHandler {
4447 /// An opaque pointer which is passed to your function implementations as an argument.
4448 /// This has no meaning in the LDK, and can be NULL or any other value.
4449 pub this_arg: *mut c_void,
4450 /// Handle an incoming open_channel message from the given peer.
4451 pub handle_open_channel: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, their_features: crate::ln::features::InitFeatures, msg: &crate::ln::msgs::OpenChannel),
4452 /// Handle an incoming accept_channel message from the given peer.
4453 pub handle_accept_channel: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, their_features: crate::ln::features::InitFeatures, msg: &crate::ln::msgs::AcceptChannel),
4454 /// Handle an incoming funding_created message from the given peer.
4455 pub handle_funding_created: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::FundingCreated),
4456 /// Handle an incoming funding_signed message from the given peer.
4457 pub handle_funding_signed: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::FundingSigned),
4458 /// Handle an incoming funding_locked message from the given peer.
4459 pub handle_funding_locked: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::FundingLocked),
4460 /// Handle an incoming shutdown message from the given peer.
4461 pub handle_shutdown: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, their_features: &crate::ln::features::InitFeatures, msg: &crate::ln::msgs::Shutdown),
4462 /// Handle an incoming closing_signed message from the given peer.
4463 pub handle_closing_signed: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::ClosingSigned),
4464 /// Handle an incoming update_add_htlc message from the given peer.
4465 pub handle_update_add_htlc: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::UpdateAddHTLC),
4466 /// Handle an incoming update_fulfill_htlc message from the given peer.
4467 pub handle_update_fulfill_htlc: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::UpdateFulfillHTLC),
4468 /// Handle an incoming update_fail_htlc message from the given peer.
4469 pub handle_update_fail_htlc: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::UpdateFailHTLC),
4470 /// Handle an incoming update_fail_malformed_htlc message from the given peer.
4471 pub handle_update_fail_malformed_htlc: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::UpdateFailMalformedHTLC),
4472 /// Handle an incoming commitment_signed message from the given peer.
4473 pub handle_commitment_signed: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::CommitmentSigned),
4474 /// Handle an incoming revoke_and_ack message from the given peer.
4475 pub handle_revoke_and_ack: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::RevokeAndACK),
4476 /// Handle an incoming update_fee message from the given peer.
4477 pub handle_update_fee: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::UpdateFee),
4478 /// Handle an incoming announcement_signatures message from the given peer.
4479 pub handle_announcement_signatures: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::AnnouncementSignatures),
4480 /// Indicates a connection to the peer failed/an existing connection was lost. If no connection
4481 /// is believed to be possible in the future (eg they're sending us messages we don't
4482 /// understand or indicate they require unknown feature bits), no_connection_possible is set
4483 /// and any outstanding channels should be failed.
4484 pub peer_disconnected: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, no_connection_possible: bool),
4485 /// Handle a peer reconnecting, possibly generating channel_reestablish message(s).
4486 pub peer_connected: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::Init),
4487 /// Handle an incoming channel_reestablish message from the given peer.
4488 pub handle_channel_reestablish: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::ChannelReestablish),
4489 /// Handle an incoming error message from the given peer.
4490 pub handle_error: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: &crate::ln::msgs::ErrorMessage),
4491 /// Implementation of MessageSendEventsProvider for this object.
4492 pub MessageSendEventsProvider: crate::util::events::MessageSendEventsProvider,
4493 /// Frees any resources associated with this object given its this_arg pointer.
4494 /// Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
4495 pub free: Option<extern "C" fn(this_arg: *mut c_void)>,
4497 impl lightning::util::events::MessageSendEventsProvider for ChannelMessageHandler {
4498 fn get_and_clear_pending_msg_events(&self) -> Vec<lightning::util::events::MessageSendEvent> {
4499 <crate::util::events::MessageSendEventsProvider as lightning::util::events::MessageSendEventsProvider>::get_and_clear_pending_msg_events(&self.MessageSendEventsProvider)
4502 unsafe impl Send for ChannelMessageHandler {}
4503 unsafe impl Sync for ChannelMessageHandler {}
4505 use lightning::ln::msgs::ChannelMessageHandler as rustChannelMessageHandler;
4506 impl rustChannelMessageHandler for ChannelMessageHandler {
4507 fn handle_open_channel(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, their_features: lightning::ln::features::InitFeatures, msg: &lightning::ln::msgs::OpenChannel) {
4508 (self.handle_open_channel)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), crate::ln::features::InitFeatures { inner: Box::into_raw(Box::new(their_features)), is_owned: true }, &crate::ln::msgs::OpenChannel { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false })
4510 fn handle_accept_channel(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, their_features: lightning::ln::features::InitFeatures, msg: &lightning::ln::msgs::AcceptChannel) {
4511 (self.handle_accept_channel)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), crate::ln::features::InitFeatures { inner: Box::into_raw(Box::new(their_features)), is_owned: true }, &crate::ln::msgs::AcceptChannel { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false })
4513 fn handle_funding_created(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, msg: &lightning::ln::msgs::FundingCreated) {
4514 (self.handle_funding_created)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::ln::msgs::FundingCreated { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false })
4516 fn handle_funding_signed(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, msg: &lightning::ln::msgs::FundingSigned) {
4517 (self.handle_funding_signed)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::ln::msgs::FundingSigned { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false })
4519 fn handle_funding_locked(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, msg: &lightning::ln::msgs::FundingLocked) {
4520 (self.handle_funding_locked)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::ln::msgs::FundingLocked { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false })
4522 fn handle_shutdown(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, their_features: &lightning::ln::features::InitFeatures, msg: &lightning::ln::msgs::Shutdown) {
4523 (self.handle_shutdown)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::ln::features::InitFeatures { inner: unsafe { (their_features as *const _) as *mut _ }, is_owned: false }, &crate::ln::msgs::Shutdown { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false })
4525 fn handle_closing_signed(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, msg: &lightning::ln::msgs::ClosingSigned) {
4526 (self.handle_closing_signed)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::ln::msgs::ClosingSigned { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false })
4528 fn handle_update_add_htlc(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, msg: &lightning::ln::msgs::UpdateAddHTLC) {
4529 (self.handle_update_add_htlc)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::ln::msgs::UpdateAddHTLC { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false })
4531 fn handle_update_fulfill_htlc(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, msg: &lightning::ln::msgs::UpdateFulfillHTLC) {
4532 (self.handle_update_fulfill_htlc)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::ln::msgs::UpdateFulfillHTLC { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false })
4534 fn handle_update_fail_htlc(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, msg: &lightning::ln::msgs::UpdateFailHTLC) {
4535 (self.handle_update_fail_htlc)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::ln::msgs::UpdateFailHTLC { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false })
4537 fn handle_update_fail_malformed_htlc(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, msg: &lightning::ln::msgs::UpdateFailMalformedHTLC) {
4538 (self.handle_update_fail_malformed_htlc)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::ln::msgs::UpdateFailMalformedHTLC { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false })
4540 fn handle_commitment_signed(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, msg: &lightning::ln::msgs::CommitmentSigned) {
4541 (self.handle_commitment_signed)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::ln::msgs::CommitmentSigned { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false })
4543 fn handle_revoke_and_ack(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, msg: &lightning::ln::msgs::RevokeAndACK) {
4544 (self.handle_revoke_and_ack)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::ln::msgs::RevokeAndACK { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false })
4546 fn handle_update_fee(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, msg: &lightning::ln::msgs::UpdateFee) {
4547 (self.handle_update_fee)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::ln::msgs::UpdateFee { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false })
4549 fn handle_announcement_signatures(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, msg: &lightning::ln::msgs::AnnouncementSignatures) {
4550 (self.handle_announcement_signatures)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::ln::msgs::AnnouncementSignatures { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false })
4552 fn peer_disconnected(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, no_connection_possible: bool) {
4553 (self.peer_disconnected)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), no_connection_possible)
4555 fn peer_connected(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, msg: &lightning::ln::msgs::Init) {
4556 (self.peer_connected)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::ln::msgs::Init { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false })
4558 fn handle_channel_reestablish(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, msg: &lightning::ln::msgs::ChannelReestablish) {
4559 (self.handle_channel_reestablish)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::ln::msgs::ChannelReestablish { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false })
4561 fn handle_error(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, msg: &lightning::ln::msgs::ErrorMessage) {
4562 (self.handle_error)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::ln::msgs::ErrorMessage { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false })
4566 // We're essentially a pointer already, or at least a set of pointers, so allow us to be used
4567 // directly as a Deref trait in higher-level structs:
4568 impl std::ops::Deref for ChannelMessageHandler {
4570 fn deref(&self) -> &Self {
4574 /// Calls the free function if one is set
4576 pub extern "C" fn ChannelMessageHandler_free(this_ptr: ChannelMessageHandler) { }
4577 impl Drop for ChannelMessageHandler {
4578 fn drop(&mut self) {
4579 if let Some(f) = self.free {
4584 /// A trait to describe an object which can receive routing messages.
4586 /// # Implementor DoS Warnings
4588 /// For `gossip_queries` messages there are potential DoS vectors when handling
4589 /// inbound queries. Implementors using an on-disk network graph should be aware of
4590 /// repeated disk I/O for queries accessing different parts of the network graph.
4592 pub struct RoutingMessageHandler {
4593 /// An opaque pointer which is passed to your function implementations as an argument.
4594 /// This has no meaning in the LDK, and can be NULL or any other value.
4595 pub this_arg: *mut c_void,
4596 /// Handle an incoming node_announcement message, returning true if it should be forwarded on,
4597 /// false or returning an Err otherwise.
4599 pub handle_node_announcement: extern "C" fn (this_arg: *const c_void, msg: &crate::ln::msgs::NodeAnnouncement) -> crate::c_types::derived::CResult_boolLightningErrorZ,
4600 /// Handle a channel_announcement message, returning true if it should be forwarded on, false
4601 /// or returning an Err otherwise.
4603 pub handle_channel_announcement: extern "C" fn (this_arg: *const c_void, msg: &crate::ln::msgs::ChannelAnnouncement) -> crate::c_types::derived::CResult_boolLightningErrorZ,
4604 /// Handle an incoming channel_update message, returning true if it should be forwarded on,
4605 /// false or returning an Err otherwise.
4607 pub handle_channel_update: extern "C" fn (this_arg: *const c_void, msg: &crate::ln::msgs::ChannelUpdate) -> crate::c_types::derived::CResult_boolLightningErrorZ,
4608 /// Handle some updates to the route graph that we learned due to an outbound failed payment.
4609 pub handle_htlc_fail_channel_update: extern "C" fn (this_arg: *const c_void, update: &crate::ln::msgs::HTLCFailChannelUpdate),
4610 /// Gets a subset of the channel announcements and updates required to dump our routing table
4611 /// to a remote node, starting at the short_channel_id indicated by starting_point and
4612 /// including the batch_amount entries immediately higher in numerical value than starting_point.
4614 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,
4615 /// Gets a subset of the node announcements required to dump our routing table to a remote node,
4616 /// starting at the node *after* the provided publickey and including batch_amount entries
4617 /// immediately higher (as defined by <PublicKey as Ord>::cmp) than starting_point.
4618 /// If None is provided for starting_point, we start at the first node.
4620 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,
4621 /// Called when a connection is established with a peer. This can be used to
4622 /// perform routing table synchronization using a strategy defined by the
4624 pub sync_routing_table: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, init: &crate::ln::msgs::Init),
4625 /// Handles the reply of a query we initiated to learn about channels
4626 /// for a given range of blocks. We can expect to receive one or more
4627 /// replies to a single query.
4629 pub handle_reply_channel_range: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: crate::ln::msgs::ReplyChannelRange) -> crate::c_types::derived::CResult_NoneLightningErrorZ,
4630 /// Handles the reply of a query we initiated asking for routing gossip
4631 /// messages for a list of channels. We should receive this message when
4632 /// a node has completed its best effort to send us the pertaining routing
4633 /// gossip messages.
4635 pub handle_reply_short_channel_ids_end: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: crate::ln::msgs::ReplyShortChannelIdsEnd) -> crate::c_types::derived::CResult_NoneLightningErrorZ,
4636 /// Handles when a peer asks us to send a list of short_channel_ids
4637 /// for the requested range of blocks.
4639 pub handle_query_channel_range: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: crate::ln::msgs::QueryChannelRange) -> crate::c_types::derived::CResult_NoneLightningErrorZ,
4640 /// Handles when a peer asks us to send routing gossip messages for a
4641 /// list of short_channel_ids.
4643 pub handle_query_short_channel_ids: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: crate::ln::msgs::QueryShortChannelIds) -> crate::c_types::derived::CResult_NoneLightningErrorZ,
4644 /// Implementation of MessageSendEventsProvider for this object.
4645 pub MessageSendEventsProvider: crate::util::events::MessageSendEventsProvider,
4646 /// Frees any resources associated with this object given its this_arg pointer.
4647 /// Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
4648 pub free: Option<extern "C" fn(this_arg: *mut c_void)>,
4650 unsafe impl Send for RoutingMessageHandler {}
4651 unsafe impl Sync for RoutingMessageHandler {}
4652 impl lightning::util::events::MessageSendEventsProvider for RoutingMessageHandler {
4653 fn get_and_clear_pending_msg_events(&self) -> Vec<lightning::util::events::MessageSendEvent> {
4654 <crate::util::events::MessageSendEventsProvider as lightning::util::events::MessageSendEventsProvider>::get_and_clear_pending_msg_events(&self.MessageSendEventsProvider)
4658 use lightning::ln::msgs::RoutingMessageHandler as rustRoutingMessageHandler;
4659 impl rustRoutingMessageHandler for RoutingMessageHandler {
4660 fn handle_node_announcement(&self, msg: &lightning::ln::msgs::NodeAnnouncement) -> Result<bool, lightning::ln::msgs::LightningError> {
4661 let mut ret = (self.handle_node_announcement)(self.this_arg, &crate::ln::msgs::NodeAnnouncement { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false });
4662 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()) } })};
4665 fn handle_channel_announcement(&self, msg: &lightning::ln::msgs::ChannelAnnouncement) -> Result<bool, lightning::ln::msgs::LightningError> {
4666 let mut ret = (self.handle_channel_announcement)(self.this_arg, &crate::ln::msgs::ChannelAnnouncement { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false });
4667 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()) } })};
4670 fn handle_channel_update(&self, msg: &lightning::ln::msgs::ChannelUpdate) -> Result<bool, lightning::ln::msgs::LightningError> {
4671 let mut ret = (self.handle_channel_update)(self.this_arg, &crate::ln::msgs::ChannelUpdate { inner: unsafe { (msg as *const _) as *mut _ }, is_owned: false });
4672 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()) } })};
4675 fn handle_htlc_fail_channel_update(&self, update: &lightning::ln::msgs::HTLCFailChannelUpdate) {
4676 (self.handle_htlc_fail_channel_update)(self.this_arg, &crate::ln::msgs::HTLCFailChannelUpdate::from_native(&update))
4678 fn get_next_channel_announcements(&self, starting_point: u64, batch_amount: u8) -> Vec<(lightning::ln::msgs::ChannelAnnouncement, Option<lightning::ln::msgs::ChannelUpdate>, Option<lightning::ln::msgs::ChannelUpdate>)> {
4679 let mut ret = (self.get_next_channel_announcements)(self.this_arg, starting_point, batch_amount);
4680 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 }); };
4683 fn get_next_node_announcements(&self, starting_point: Option<&bitcoin::secp256k1::key::PublicKey>, batch_amount: u8) -> Vec<lightning::ln::msgs::NodeAnnouncement> {
4684 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())) } };
4685 let mut ret = (self.get_next_node_announcements)(self.this_arg, local_starting_point, batch_amount);
4686 let mut local_ret = Vec::new(); for mut item in ret.into_rust().drain(..) { local_ret.push( { *unsafe { Box::from_raw(item.take_inner()) } }); };
4689 fn sync_routing_table(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, init: &lightning::ln::msgs::Init) {
4690 (self.sync_routing_table)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::ln::msgs::Init { inner: unsafe { (init as *const _) as *mut _ }, is_owned: false })
4692 fn handle_reply_channel_range(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, msg: lightning::ln::msgs::ReplyChannelRange) -> Result<(), lightning::ln::msgs::LightningError> {
4693 let mut ret = (self.handle_reply_channel_range)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), crate::ln::msgs::ReplyChannelRange { inner: Box::into_raw(Box::new(msg)), is_owned: true });
4694 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()) } })};
4697 fn handle_reply_short_channel_ids_end(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, msg: lightning::ln::msgs::ReplyShortChannelIdsEnd) -> Result<(), lightning::ln::msgs::LightningError> {
4698 let mut ret = (self.handle_reply_short_channel_ids_end)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), crate::ln::msgs::ReplyShortChannelIdsEnd { inner: Box::into_raw(Box::new(msg)), is_owned: true });
4699 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()) } })};
4702 fn handle_query_channel_range(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, msg: lightning::ln::msgs::QueryChannelRange) -> Result<(), lightning::ln::msgs::LightningError> {
4703 let mut ret = (self.handle_query_channel_range)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), crate::ln::msgs::QueryChannelRange { inner: Box::into_raw(Box::new(msg)), is_owned: true });
4704 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()) } })};
4707 fn handle_query_short_channel_ids(&self, their_node_id: &bitcoin::secp256k1::key::PublicKey, msg: lightning::ln::msgs::QueryShortChannelIds) -> Result<(), lightning::ln::msgs::LightningError> {
4708 let mut ret = (self.handle_query_short_channel_ids)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), crate::ln::msgs::QueryShortChannelIds { inner: Box::into_raw(Box::new(msg)), is_owned: true });
4709 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()) } })};
4714 // We're essentially a pointer already, or at least a set of pointers, so allow us to be used
4715 // directly as a Deref trait in higher-level structs:
4716 impl std::ops::Deref for RoutingMessageHandler {
4718 fn deref(&self) -> &Self {
4722 /// Calls the free function if one is set
4724 pub extern "C" fn RoutingMessageHandler_free(this_ptr: RoutingMessageHandler) { }
4725 impl Drop for RoutingMessageHandler {
4726 fn drop(&mut self) {
4727 if let Some(f) = self.free {
4733 /// Serialize the AcceptChannel object into a byte array which can be read by AcceptChannel_read
4734 pub extern "C" fn AcceptChannel_write(obj: &AcceptChannel) -> crate::c_types::derived::CVec_u8Z {
4735 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
4738 pub(crate) extern "C" fn AcceptChannel_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
4739 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeAcceptChannel) })
4742 /// Read a AcceptChannel from a byte array, created by AcceptChannel_write
4743 pub extern "C" fn AcceptChannel_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_AcceptChannelDecodeErrorZ {
4744 let res = crate::c_types::deserialize_obj(ser);
4745 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::ln::msgs::AcceptChannel { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
4749 /// Serialize the AnnouncementSignatures object into a byte array which can be read by AnnouncementSignatures_read
4750 pub extern "C" fn AnnouncementSignatures_write(obj: &AnnouncementSignatures) -> crate::c_types::derived::CVec_u8Z {
4751 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
4754 pub(crate) extern "C" fn AnnouncementSignatures_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
4755 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeAnnouncementSignatures) })
4758 /// Read a AnnouncementSignatures from a byte array, created by AnnouncementSignatures_write
4759 pub extern "C" fn AnnouncementSignatures_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_AnnouncementSignaturesDecodeErrorZ {
4760 let res = crate::c_types::deserialize_obj(ser);
4761 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::ln::msgs::AnnouncementSignatures { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
4765 /// Serialize the ChannelReestablish object into a byte array which can be read by ChannelReestablish_read
4766 pub extern "C" fn ChannelReestablish_write(obj: &ChannelReestablish) -> crate::c_types::derived::CVec_u8Z {
4767 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
4770 pub(crate) extern "C" fn ChannelReestablish_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
4771 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeChannelReestablish) })
4774 /// Read a ChannelReestablish from a byte array, created by ChannelReestablish_write
4775 pub extern "C" fn ChannelReestablish_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ChannelReestablishDecodeErrorZ {
4776 let res = crate::c_types::deserialize_obj(ser);
4777 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::ln::msgs::ChannelReestablish { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
4781 /// Serialize the ClosingSigned object into a byte array which can be read by ClosingSigned_read
4782 pub extern "C" fn ClosingSigned_write(obj: &ClosingSigned) -> crate::c_types::derived::CVec_u8Z {
4783 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
4786 pub(crate) extern "C" fn ClosingSigned_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
4787 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeClosingSigned) })
4790 /// Read a ClosingSigned from a byte array, created by ClosingSigned_write
4791 pub extern "C" fn ClosingSigned_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ClosingSignedDecodeErrorZ {
4792 let res = crate::c_types::deserialize_obj(ser);
4793 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::ln::msgs::ClosingSigned { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
4797 /// Serialize the CommitmentSigned object into a byte array which can be read by CommitmentSigned_read
4798 pub extern "C" fn CommitmentSigned_write(obj: &CommitmentSigned) -> crate::c_types::derived::CVec_u8Z {
4799 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
4802 pub(crate) extern "C" fn CommitmentSigned_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
4803 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeCommitmentSigned) })
4806 /// Read a CommitmentSigned from a byte array, created by CommitmentSigned_write
4807 pub extern "C" fn CommitmentSigned_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_CommitmentSignedDecodeErrorZ {
4808 let res = crate::c_types::deserialize_obj(ser);
4809 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::ln::msgs::CommitmentSigned { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
4813 /// Serialize the FundingCreated object into a byte array which can be read by FundingCreated_read
4814 pub extern "C" fn FundingCreated_write(obj: &FundingCreated) -> crate::c_types::derived::CVec_u8Z {
4815 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
4818 pub(crate) extern "C" fn FundingCreated_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
4819 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeFundingCreated) })
4822 /// Read a FundingCreated from a byte array, created by FundingCreated_write
4823 pub extern "C" fn FundingCreated_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_FundingCreatedDecodeErrorZ {
4824 let res = crate::c_types::deserialize_obj(ser);
4825 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::ln::msgs::FundingCreated { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
4829 /// Serialize the FundingSigned object into a byte array which can be read by FundingSigned_read
4830 pub extern "C" fn FundingSigned_write(obj: &FundingSigned) -> crate::c_types::derived::CVec_u8Z {
4831 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
4834 pub(crate) extern "C" fn FundingSigned_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
4835 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeFundingSigned) })
4838 /// Read a FundingSigned from a byte array, created by FundingSigned_write
4839 pub extern "C" fn FundingSigned_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_FundingSignedDecodeErrorZ {
4840 let res = crate::c_types::deserialize_obj(ser);
4841 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::ln::msgs::FundingSigned { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
4845 /// Serialize the FundingLocked object into a byte array which can be read by FundingLocked_read
4846 pub extern "C" fn FundingLocked_write(obj: &FundingLocked) -> crate::c_types::derived::CVec_u8Z {
4847 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
4850 pub(crate) extern "C" fn FundingLocked_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
4851 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeFundingLocked) })
4854 /// Read a FundingLocked from a byte array, created by FundingLocked_write
4855 pub extern "C" fn FundingLocked_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_FundingLockedDecodeErrorZ {
4856 let res = crate::c_types::deserialize_obj(ser);
4857 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::ln::msgs::FundingLocked { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
4861 /// Serialize the Init object into a byte array which can be read by Init_read
4862 pub extern "C" fn Init_write(obj: &Init) -> crate::c_types::derived::CVec_u8Z {
4863 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
4866 pub(crate) extern "C" fn Init_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
4867 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeInit) })
4870 /// Read a Init from a byte array, created by Init_write
4871 pub extern "C" fn Init_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_InitDecodeErrorZ {
4872 let res = crate::c_types::deserialize_obj(ser);
4873 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::ln::msgs::Init { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
4877 /// Serialize the OpenChannel object into a byte array which can be read by OpenChannel_read
4878 pub extern "C" fn OpenChannel_write(obj: &OpenChannel) -> crate::c_types::derived::CVec_u8Z {
4879 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
4882 pub(crate) extern "C" fn OpenChannel_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
4883 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeOpenChannel) })
4886 /// Read a OpenChannel from a byte array, created by OpenChannel_write
4887 pub extern "C" fn OpenChannel_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_OpenChannelDecodeErrorZ {
4888 let res = crate::c_types::deserialize_obj(ser);
4889 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::ln::msgs::OpenChannel { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
4893 /// Serialize the RevokeAndACK object into a byte array which can be read by RevokeAndACK_read
4894 pub extern "C" fn RevokeAndACK_write(obj: &RevokeAndACK) -> crate::c_types::derived::CVec_u8Z {
4895 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
4898 pub(crate) extern "C" fn RevokeAndACK_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
4899 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeRevokeAndACK) })
4902 /// Read a RevokeAndACK from a byte array, created by RevokeAndACK_write
4903 pub extern "C" fn RevokeAndACK_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_RevokeAndACKDecodeErrorZ {
4904 let res = crate::c_types::deserialize_obj(ser);
4905 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::ln::msgs::RevokeAndACK { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
4909 /// Serialize the Shutdown object into a byte array which can be read by Shutdown_read
4910 pub extern "C" fn Shutdown_write(obj: &Shutdown) -> crate::c_types::derived::CVec_u8Z {
4911 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
4914 pub(crate) extern "C" fn Shutdown_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
4915 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeShutdown) })
4918 /// Read a Shutdown from a byte array, created by Shutdown_write
4919 pub extern "C" fn Shutdown_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ShutdownDecodeErrorZ {
4920 let res = crate::c_types::deserialize_obj(ser);
4921 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::ln::msgs::Shutdown { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
4925 /// Serialize the UpdateFailHTLC object into a byte array which can be read by UpdateFailHTLC_read
4926 pub extern "C" fn UpdateFailHTLC_write(obj: &UpdateFailHTLC) -> crate::c_types::derived::CVec_u8Z {
4927 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
4930 pub(crate) extern "C" fn UpdateFailHTLC_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
4931 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeUpdateFailHTLC) })
4934 /// Read a UpdateFailHTLC from a byte array, created by UpdateFailHTLC_write
4935 pub extern "C" fn UpdateFailHTLC_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_UpdateFailHTLCDecodeErrorZ {
4936 let res = crate::c_types::deserialize_obj(ser);
4937 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::ln::msgs::UpdateFailHTLC { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
4941 /// Serialize the UpdateFailMalformedHTLC object into a byte array which can be read by UpdateFailMalformedHTLC_read
4942 pub extern "C" fn UpdateFailMalformedHTLC_write(obj: &UpdateFailMalformedHTLC) -> crate::c_types::derived::CVec_u8Z {
4943 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
4946 pub(crate) extern "C" fn UpdateFailMalformedHTLC_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
4947 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeUpdateFailMalformedHTLC) })
4950 /// Read a UpdateFailMalformedHTLC from a byte array, created by UpdateFailMalformedHTLC_write
4951 pub extern "C" fn UpdateFailMalformedHTLC_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_UpdateFailMalformedHTLCDecodeErrorZ {
4952 let res = crate::c_types::deserialize_obj(ser);
4953 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::ln::msgs::UpdateFailMalformedHTLC { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
4957 /// Serialize the UpdateFee object into a byte array which can be read by UpdateFee_read
4958 pub extern "C" fn UpdateFee_write(obj: &UpdateFee) -> crate::c_types::derived::CVec_u8Z {
4959 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
4962 pub(crate) extern "C" fn UpdateFee_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
4963 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeUpdateFee) })
4966 /// Read a UpdateFee from a byte array, created by UpdateFee_write
4967 pub extern "C" fn UpdateFee_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_UpdateFeeDecodeErrorZ {
4968 let res = crate::c_types::deserialize_obj(ser);
4969 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::ln::msgs::UpdateFee { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
4973 /// Serialize the UpdateFulfillHTLC object into a byte array which can be read by UpdateFulfillHTLC_read
4974 pub extern "C" fn UpdateFulfillHTLC_write(obj: &UpdateFulfillHTLC) -> crate::c_types::derived::CVec_u8Z {
4975 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
4978 pub(crate) extern "C" fn UpdateFulfillHTLC_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
4979 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeUpdateFulfillHTLC) })
4982 /// Read a UpdateFulfillHTLC from a byte array, created by UpdateFulfillHTLC_write
4983 pub extern "C" fn UpdateFulfillHTLC_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_UpdateFulfillHTLCDecodeErrorZ {
4984 let res = crate::c_types::deserialize_obj(ser);
4985 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::ln::msgs::UpdateFulfillHTLC { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
4989 /// Serialize the UpdateAddHTLC object into a byte array which can be read by UpdateAddHTLC_read
4990 pub extern "C" fn UpdateAddHTLC_write(obj: &UpdateAddHTLC) -> crate::c_types::derived::CVec_u8Z {
4991 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
4994 pub(crate) extern "C" fn UpdateAddHTLC_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
4995 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeUpdateAddHTLC) })
4998 /// Read a UpdateAddHTLC from a byte array, created by UpdateAddHTLC_write
4999 pub extern "C" fn UpdateAddHTLC_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_UpdateAddHTLCDecodeErrorZ {
5000 let res = crate::c_types::deserialize_obj(ser);
5001 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::ln::msgs::UpdateAddHTLC { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
5005 /// Serialize the Ping object into a byte array which can be read by Ping_read
5006 pub extern "C" fn Ping_write(obj: &Ping) -> crate::c_types::derived::CVec_u8Z {
5007 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
5010 pub(crate) extern "C" fn Ping_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
5011 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativePing) })
5014 /// Read a Ping from a byte array, created by Ping_write
5015 pub extern "C" fn Ping_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_PingDecodeErrorZ {
5016 let res = crate::c_types::deserialize_obj(ser);
5017 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::ln::msgs::Ping { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
5021 /// Serialize the Pong object into a byte array which can be read by Pong_read
5022 pub extern "C" fn Pong_write(obj: &Pong) -> crate::c_types::derived::CVec_u8Z {
5023 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
5026 pub(crate) extern "C" fn Pong_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
5027 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativePong) })
5030 /// Read a Pong from a byte array, created by Pong_write
5031 pub extern "C" fn Pong_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_PongDecodeErrorZ {
5032 let res = crate::c_types::deserialize_obj(ser);
5033 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::ln::msgs::Pong { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
5037 /// Serialize the UnsignedChannelAnnouncement object into a byte array which can be read by UnsignedChannelAnnouncement_read
5038 pub extern "C" fn UnsignedChannelAnnouncement_write(obj: &UnsignedChannelAnnouncement) -> crate::c_types::derived::CVec_u8Z {
5039 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
5042 pub(crate) extern "C" fn UnsignedChannelAnnouncement_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
5043 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeUnsignedChannelAnnouncement) })
5046 /// Read a UnsignedChannelAnnouncement from a byte array, created by UnsignedChannelAnnouncement_write
5047 pub extern "C" fn UnsignedChannelAnnouncement_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_UnsignedChannelAnnouncementDecodeErrorZ {
5048 let res = crate::c_types::deserialize_obj(ser);
5049 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::ln::msgs::UnsignedChannelAnnouncement { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
5053 /// Serialize the ChannelAnnouncement object into a byte array which can be read by ChannelAnnouncement_read
5054 pub extern "C" fn ChannelAnnouncement_write(obj: &ChannelAnnouncement) -> crate::c_types::derived::CVec_u8Z {
5055 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
5058 pub(crate) extern "C" fn ChannelAnnouncement_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
5059 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeChannelAnnouncement) })
5062 /// Read a ChannelAnnouncement from a byte array, created by ChannelAnnouncement_write
5063 pub extern "C" fn ChannelAnnouncement_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ChannelAnnouncementDecodeErrorZ {
5064 let res = crate::c_types::deserialize_obj(ser);
5065 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::ln::msgs::ChannelAnnouncement { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
5069 /// Serialize the UnsignedChannelUpdate object into a byte array which can be read by UnsignedChannelUpdate_read
5070 pub extern "C" fn UnsignedChannelUpdate_write(obj: &UnsignedChannelUpdate) -> crate::c_types::derived::CVec_u8Z {
5071 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
5074 pub(crate) extern "C" fn UnsignedChannelUpdate_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
5075 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeUnsignedChannelUpdate) })
5078 /// Read a UnsignedChannelUpdate from a byte array, created by UnsignedChannelUpdate_write
5079 pub extern "C" fn UnsignedChannelUpdate_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_UnsignedChannelUpdateDecodeErrorZ {
5080 let res = crate::c_types::deserialize_obj(ser);
5081 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::ln::msgs::UnsignedChannelUpdate { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
5085 /// Serialize the ChannelUpdate object into a byte array which can be read by ChannelUpdate_read
5086 pub extern "C" fn ChannelUpdate_write(obj: &ChannelUpdate) -> crate::c_types::derived::CVec_u8Z {
5087 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
5090 pub(crate) extern "C" fn ChannelUpdate_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
5091 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeChannelUpdate) })
5094 /// Read a ChannelUpdate from a byte array, created by ChannelUpdate_write
5095 pub extern "C" fn ChannelUpdate_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ChannelUpdateDecodeErrorZ {
5096 let res = crate::c_types::deserialize_obj(ser);
5097 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::ln::msgs::ChannelUpdate { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
5101 /// Serialize the ErrorMessage object into a byte array which can be read by ErrorMessage_read
5102 pub extern "C" fn ErrorMessage_write(obj: &ErrorMessage) -> crate::c_types::derived::CVec_u8Z {
5103 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
5106 pub(crate) extern "C" fn ErrorMessage_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
5107 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeErrorMessage) })
5110 /// Read a ErrorMessage from a byte array, created by ErrorMessage_write
5111 pub extern "C" fn ErrorMessage_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ErrorMessageDecodeErrorZ {
5112 let res = crate::c_types::deserialize_obj(ser);
5113 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::ln::msgs::ErrorMessage { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
5117 /// Serialize the UnsignedNodeAnnouncement object into a byte array which can be read by UnsignedNodeAnnouncement_read
5118 pub extern "C" fn UnsignedNodeAnnouncement_write(obj: &UnsignedNodeAnnouncement) -> crate::c_types::derived::CVec_u8Z {
5119 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
5122 pub(crate) extern "C" fn UnsignedNodeAnnouncement_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
5123 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeUnsignedNodeAnnouncement) })
5126 /// Read a UnsignedNodeAnnouncement from a byte array, created by UnsignedNodeAnnouncement_write
5127 pub extern "C" fn UnsignedNodeAnnouncement_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_UnsignedNodeAnnouncementDecodeErrorZ {
5128 let res = crate::c_types::deserialize_obj(ser);
5129 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::ln::msgs::UnsignedNodeAnnouncement { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
5133 /// Serialize the NodeAnnouncement object into a byte array which can be read by NodeAnnouncement_read
5134 pub extern "C" fn NodeAnnouncement_write(obj: &NodeAnnouncement) -> crate::c_types::derived::CVec_u8Z {
5135 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
5138 pub(crate) extern "C" fn NodeAnnouncement_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
5139 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeNodeAnnouncement) })
5142 /// Read a NodeAnnouncement from a byte array, created by NodeAnnouncement_write
5143 pub extern "C" fn NodeAnnouncement_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_NodeAnnouncementDecodeErrorZ {
5144 let res = crate::c_types::deserialize_obj(ser);
5145 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::ln::msgs::NodeAnnouncement { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
5149 /// Read a QueryShortChannelIds from a byte array, created by QueryShortChannelIds_write
5150 pub extern "C" fn QueryShortChannelIds_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_QueryShortChannelIdsDecodeErrorZ {
5151 let res = crate::c_types::deserialize_obj(ser);
5152 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::ln::msgs::QueryShortChannelIds { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
5156 /// Serialize the QueryShortChannelIds object into a byte array which can be read by QueryShortChannelIds_read
5157 pub extern "C" fn QueryShortChannelIds_write(obj: &QueryShortChannelIds) -> crate::c_types::derived::CVec_u8Z {
5158 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
5161 pub(crate) extern "C" fn QueryShortChannelIds_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
5162 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeQueryShortChannelIds) })
5165 /// Read a ReplyShortChannelIdsEnd from a byte array, created by ReplyShortChannelIdsEnd_write
5166 pub extern "C" fn ReplyShortChannelIdsEnd_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ReplyShortChannelIdsEndDecodeErrorZ {
5167 let res = crate::c_types::deserialize_obj(ser);
5168 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::ln::msgs::ReplyShortChannelIdsEnd { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
5172 /// Serialize the ReplyShortChannelIdsEnd object into a byte array which can be read by ReplyShortChannelIdsEnd_read
5173 pub extern "C" fn ReplyShortChannelIdsEnd_write(obj: &ReplyShortChannelIdsEnd) -> crate::c_types::derived::CVec_u8Z {
5174 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
5177 pub(crate) extern "C" fn ReplyShortChannelIdsEnd_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
5178 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeReplyShortChannelIdsEnd) })
5181 /// Read a QueryChannelRange from a byte array, created by QueryChannelRange_write
5182 pub extern "C" fn QueryChannelRange_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_QueryChannelRangeDecodeErrorZ {
5183 let res = crate::c_types::deserialize_obj(ser);
5184 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::ln::msgs::QueryChannelRange { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
5188 /// Serialize the QueryChannelRange object into a byte array which can be read by QueryChannelRange_read
5189 pub extern "C" fn QueryChannelRange_write(obj: &QueryChannelRange) -> crate::c_types::derived::CVec_u8Z {
5190 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
5193 pub(crate) extern "C" fn QueryChannelRange_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
5194 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeQueryChannelRange) })
5197 /// Read a ReplyChannelRange from a byte array, created by ReplyChannelRange_write
5198 pub extern "C" fn ReplyChannelRange_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ReplyChannelRangeDecodeErrorZ {
5199 let res = crate::c_types::deserialize_obj(ser);
5200 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::ln::msgs::ReplyChannelRange { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
5204 /// Serialize the ReplyChannelRange object into a byte array which can be read by ReplyChannelRange_read
5205 pub extern "C" fn ReplyChannelRange_write(obj: &ReplyChannelRange) -> crate::c_types::derived::CVec_u8Z {
5206 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
5209 pub(crate) extern "C" fn ReplyChannelRange_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
5210 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeReplyChannelRange) })
5213 /// Read a GossipTimestampFilter from a byte array, created by GossipTimestampFilter_write
5214 pub extern "C" fn GossipTimestampFilter_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_GossipTimestampFilterDecodeErrorZ {
5215 let res = crate::c_types::deserialize_obj(ser);
5216 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::ln::msgs::GossipTimestampFilter { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
5220 /// Serialize the GossipTimestampFilter object into a byte array which can be read by GossipTimestampFilter_read
5221 pub extern "C" fn GossipTimestampFilter_write(obj: &GossipTimestampFilter) -> crate::c_types::derived::CVec_u8Z {
5222 crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
5225 pub(crate) extern "C" fn GossipTimestampFilter_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
5226 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeGossipTimestampFilter) })