Update auto-generated bindings for LDK 0.0.115
[ldk-c-bindings] / lightning-c-bindings / include / lightning.h
1 #ifndef LDK_C_BINDINGS_H
2 #define LDK_C_BINDINGS_H
3
4 /* Generated with cbindgen:0.24.3 */
5
6 /* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */
7
8 #include <stdarg.h>
9 #include <stdbool.h>
10 #include <stdint.h>
11 #include "ldk_rust_types.h"
12
13 /**
14  * An enum which can either contain a  or not
15  */
16 typedef enum LDKCOption_NoneZ {
17    /**
18     * When we're in this state, this COption_NoneZ contains a
19     */
20    LDKCOption_NoneZ_Some,
21    /**
22     * When we're in this state, this COption_NoneZ contains nothing
23     */
24    LDKCOption_NoneZ_None,
25    /**
26     * Must be last for serialization purposes
27     */
28    LDKCOption_NoneZ_Sentinel,
29 } LDKCOption_NoneZ;
30
31 /**
32  * An enum representing the status of a channel monitor update persistence.
33  */
34 typedef enum LDKChannelMonitorUpdateStatus {
35    /**
36     * The update has been durably persisted and all copies of the relevant [`ChannelMonitor`]
37     * have been updated.
38     *
39     * This includes performing any `fsync()` calls required to ensure the update is guaranteed to
40     * be available on restart even if the application crashes.
41     */
42    LDKChannelMonitorUpdateStatus_Completed,
43    /**
44     * Used to indicate a temporary failure (eg connection to a watchtower or remote backup of
45     * our state failed, but is expected to succeed at some point in the future).
46     *
47     * Such a failure will \"freeze\" a channel, preventing us from revoking old states or
48     * submitting new commitment transactions to the counterparty. Once the update(s) which failed
49     * have been successfully applied, a [`MonitorEvent::Completed`] can be used to restore the
50     * channel to an operational state.
51     *
52     * Note that a given [`ChannelManager`] will *never* re-generate a [`ChannelMonitorUpdate`].
53     * If you return this error you must ensure that it is written to disk safely before writing
54     * the latest [`ChannelManager`] state, or you should return [`PermanentFailure`] instead.
55     *
56     * Even when a channel has been \"frozen\", updates to the [`ChannelMonitor`] can continue to
57     * occur (e.g. if an inbound HTLC which we forwarded was claimed upstream, resulting in us
58     * attempting to claim it on this channel) and those updates must still be persisted.
59     *
60     * No updates to the channel will be made which could invalidate other [`ChannelMonitor`]s
61     * until a [`MonitorEvent::Completed`] is provided, even if you return no error on a later
62     * monitor update for the same channel.
63     *
64     * For deployments where a copy of ChannelMonitors and other local state are backed up in a
65     * remote location (with local copies persisted immediately), it is anticipated that all
66     * updates will return [`InProgress`] until the remote copies could be updated.
67     *
68     * [`PermanentFailure`]: ChannelMonitorUpdateStatus::PermanentFailure
69     * [`InProgress`]: ChannelMonitorUpdateStatus::InProgress
70     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
71     */
72    LDKChannelMonitorUpdateStatus_InProgress,
73    /**
74     * Used to indicate no further channel monitor updates will be allowed (likely a disk failure
75     * or a remote copy of this [`ChannelMonitor`] is no longer reachable and thus not updatable).
76     *
77     * When this is returned, [`ChannelManager`] will force-close the channel but *not* broadcast
78     * our current commitment transaction. This avoids a dangerous case where a local disk failure
79     * (e.g. the Linux-default remounting of the disk as read-only) causes [`PermanentFailure`]s
80     * for all monitor updates. If we were to broadcast our latest commitment transaction and then
81     * restart, we could end up reading a previous [`ChannelMonitor`] and [`ChannelManager`],
82     * revoking our now-broadcasted state before seeing it confirm and losing all our funds.
83     *
84     * Note that this is somewhat of a tradeoff - if the disk is really gone and we may have lost
85     * the data permanently, we really should broadcast immediately. If the data can be recovered
86     * with manual intervention, we'd rather close the channel, rejecting future updates to it,
87     * and broadcast the latest state only if we have HTLCs to claim which are timing out (which
88     * we do as long as blocks are connected).
89     *
90     * In order to broadcast the latest local commitment transaction, you'll need to call
91     * [`ChannelMonitor::get_latest_holder_commitment_txn`] and broadcast the resulting
92     * transactions once you've safely ensured no further channel updates can be generated by your
93     * [`ChannelManager`].
94     *
95     * Note that at least one final [`ChannelMonitorUpdate`] may still be provided, which must
96     * still be processed by a running [`ChannelMonitor`]. This final update will mark the
97     * [`ChannelMonitor`] as finalized, ensuring no further updates (e.g. revocation of the latest
98     * commitment transaction) are allowed.
99     *
100     * Note that even if you return a [`PermanentFailure`] due to unavailability of secondary
101     * [`ChannelMonitor`] copies, you should still make an attempt to store the update where
102     * possible to ensure you can claim HTLC outputs on the latest commitment transaction
103     * broadcasted later.
104     *
105     * In case of distributed watchtowers deployment, the new version must be written to disk, as
106     * state may have been stored but rejected due to a block forcing a commitment broadcast. This
107     * storage is used to claim outputs of rejected state confirmed onchain by another watchtower,
108     * lagging behind on block processing.
109     *
110     * [`PermanentFailure`]: ChannelMonitorUpdateStatus::PermanentFailure
111     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
112     */
113    LDKChannelMonitorUpdateStatus_PermanentFailure,
114    /**
115     * Must be last for serialization purposes
116     */
117    LDKChannelMonitorUpdateStatus_Sentinel,
118 } LDKChannelMonitorUpdateStatus;
119
120 /**
121  * An enum that represents the speed at which we want a transaction to confirm used for feerate
122  * estimation.
123  */
124 typedef enum LDKConfirmationTarget {
125    /**
126     * We are happy with this transaction confirming slowly when feerate drops some.
127     */
128    LDKConfirmationTarget_Background,
129    /**
130     * We'd like this transaction to confirm without major delay, but 12-18 blocks is fine.
131     */
132    LDKConfirmationTarget_Normal,
133    /**
134     * We'd like this transaction to confirm in the next few blocks.
135     */
136    LDKConfirmationTarget_HighPriority,
137    /**
138     * Must be last for serialization purposes
139     */
140    LDKConfirmationTarget_Sentinel,
141 } LDKConfirmationTarget;
142
143 /**
144  * Errors that may occur when constructing a new [`RawInvoice`] or [`Invoice`]
145  */
146 typedef enum LDKCreationError {
147    /**
148     * The supplied description string was longer than 639 __bytes__ (see [`Description::new`])
149     */
150    LDKCreationError_DescriptionTooLong,
151    /**
152     * The specified route has too many hops and can't be encoded
153     */
154    LDKCreationError_RouteTooLong,
155    /**
156     * The Unix timestamp of the supplied date is less than zero or greater than 35-bits
157     */
158    LDKCreationError_TimestampOutOfBounds,
159    /**
160     * The supplied millisatoshi amount was greater than the total bitcoin supply.
161     */
162    LDKCreationError_InvalidAmount,
163    /**
164     * Route hints were required for this invoice and were missing. Applies to
165     * [phantom invoices].
166     *
167     * [phantom invoices]: crate::utils::create_phantom_invoice
168     */
169    LDKCreationError_MissingRouteHints,
170    /**
171     * The provided `min_final_cltv_expiry_delta` was less than [`MIN_FINAL_CLTV_EXPIRY_DELTA`].
172     *
173     * [`MIN_FINAL_CLTV_EXPIRY_DELTA`]: lightning::ln::channelmanager::MIN_FINAL_CLTV_EXPIRY_DELTA
174     */
175    LDKCreationError_MinFinalCltvExpiryDeltaTooShort,
176    /**
177     * Must be last for serialization purposes
178     */
179    LDKCreationError_Sentinel,
180 } LDKCreationError;
181
182 /**
183  * Enum representing the crypto currencies (or networks) supported by this library
184  */
185 typedef enum LDKCurrency {
186    /**
187     * Bitcoin mainnet
188     */
189    LDKCurrency_Bitcoin,
190    /**
191     * Bitcoin testnet
192     */
193    LDKCurrency_BitcoinTestnet,
194    /**
195     * Bitcoin regtest
196     */
197    LDKCurrency_Regtest,
198    /**
199     * Bitcoin simnet
200     */
201    LDKCurrency_Simnet,
202    /**
203     * Bitcoin signet
204     */
205    LDKCurrency_Signet,
206    /**
207     * Must be last for serialization purposes
208     */
209    LDKCurrency_Sentinel,
210 } LDKCurrency;
211
212 /**
213  * This enum is used to specify which error data to send to peers when failing back an HTLC
214  * using [`ChannelManager::fail_htlc_backwards_with_reason`].
215  *
216  * For more info on failure codes, see <https://github.com/lightning/bolts/blob/master/04-onion-routing.md#failure-messages>.
217  */
218 typedef enum LDKFailureCode {
219    /**
220     * We had a temporary error processing the payment. Useful if no other error codes fit
221     * and you want to indicate that the payer may want to retry.
222     */
223    LDKFailureCode_TemporaryNodeFailure,
224    /**
225     * We have a required feature which was not in this onion. For example, you may require
226     * some additional metadata that was not provided with this payment.
227     */
228    LDKFailureCode_RequiredNodeFeatureMissing,
229    /**
230     * You may wish to use this when a `payment_preimage` is unknown, or the CLTV expiry of
231     * the HTLC is too close to the current block height for safe handling.
232     * Using this failure code in [`ChannelManager::fail_htlc_backwards_with_reason`] is
233     * equivalent to calling [`ChannelManager::fail_htlc_backwards`].
234     */
235    LDKFailureCode_IncorrectOrUnknownPaymentDetails,
236    /**
237     * Must be last for serialization purposes
238     */
239    LDKFailureCode_Sentinel,
240 } LDKFailureCode;
241
242 /**
243  * Describes the type of HTLC claim as determined by analyzing the witness.
244  */
245 typedef enum LDKHTLCClaim {
246    /**
247     * Claims an offered output on a commitment transaction through the timeout path.
248     */
249    LDKHTLCClaim_OfferedTimeout,
250    /**
251     * Claims an offered output on a commitment transaction through the success path.
252     */
253    LDKHTLCClaim_OfferedPreimage,
254    /**
255     * Claims an accepted output on a commitment transaction through the timeout path.
256     */
257    LDKHTLCClaim_AcceptedTimeout,
258    /**
259     * Claims an accepted output on a commitment transaction through the success path.
260     */
261    LDKHTLCClaim_AcceptedPreimage,
262    /**
263     * Claims an offered/accepted output on a commitment transaction through the revocation path.
264     */
265    LDKHTLCClaim_Revocation,
266    /**
267     * Must be last for serialization purposes
268     */
269    LDKHTLCClaim_Sentinel,
270 } LDKHTLCClaim;
271
272 /**
273  * Represents an IO Error. Note that some information is lost in the conversion from Rust.
274  */
275 typedef enum LDKIOError {
276    LDKIOError_NotFound,
277    LDKIOError_PermissionDenied,
278    LDKIOError_ConnectionRefused,
279    LDKIOError_ConnectionReset,
280    LDKIOError_ConnectionAborted,
281    LDKIOError_NotConnected,
282    LDKIOError_AddrInUse,
283    LDKIOError_AddrNotAvailable,
284    LDKIOError_BrokenPipe,
285    LDKIOError_AlreadyExists,
286    LDKIOError_WouldBlock,
287    LDKIOError_InvalidInput,
288    LDKIOError_InvalidData,
289    LDKIOError_TimedOut,
290    LDKIOError_WriteZero,
291    LDKIOError_Interrupted,
292    LDKIOError_Other,
293    LDKIOError_UnexpectedEof,
294    /**
295     * Must be last for serialization purposes
296     */
297    LDKIOError_Sentinel,
298 } LDKIOError;
299
300 /**
301  * An enum representing the available verbosity levels of the logger.
302  */
303 typedef enum LDKLevel {
304    /**
305     * Designates extremely verbose information, including gossip-induced messages
306     */
307    LDKLevel_Gossip,
308    /**
309     * Designates very low priority, often extremely verbose, information
310     */
311    LDKLevel_Trace,
312    /**
313     * Designates lower priority information
314     */
315    LDKLevel_Debug,
316    /**
317     * Designates useful information
318     */
319    LDKLevel_Info,
320    /**
321     * Designates hazardous situations
322     */
323    LDKLevel_Warn,
324    /**
325     * Designates very serious errors
326     */
327    LDKLevel_Error,
328    /**
329     * Must be last for serialization purposes
330     */
331    LDKLevel_Sentinel,
332 } LDKLevel;
333
334 /**
335  * An enum representing the possible Bitcoin or test networks which we can run on
336  */
337 typedef enum LDKNetwork {
338    /**
339     * The main Bitcoin blockchain.
340     */
341    LDKNetwork_Bitcoin,
342    /**
343     * The testnet3 blockchain.
344     */
345    LDKNetwork_Testnet,
346    /**
347     * A local test blockchain.
348     */
349    LDKNetwork_Regtest,
350    /**
351     * A blockchain on which blocks are signed instead of mined.
352     */
353    LDKNetwork_Signet,
354    /**
355     * Must be last for serialization purposes
356     */
357    LDKNetwork_Sentinel,
358 } LDKNetwork;
359
360 /**
361  * The reason the payment failed. Used in [`Event::PaymentFailed`].
362  */
363 typedef enum LDKPaymentFailureReason {
364    /**
365     * The intended recipient rejected our payment.
366     */
367    LDKPaymentFailureReason_RecipientRejected,
368    /**
369     * The user chose to abandon this payment by calling [`ChannelManager::abandon_payment`].
370     *
371     * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
372     */
373    LDKPaymentFailureReason_UserAbandoned,
374    /**
375     * We exhausted all of our retry attempts while trying to send the payment, or we
376     * exhausted the [`Retry::Timeout`] if the user set one. If at any point a retry
377     * attempt failed while being forwarded along the path, an [`Event::PaymentPathFailed`] will
378     * have come before this.
379     *
380     * [`Retry::Timeout`]: crate::ln::channelmanager::Retry::Timeout
381     */
382    LDKPaymentFailureReason_RetriesExhausted,
383    /**
384     * The payment expired while retrying, based on the provided
385     * [`PaymentParameters::expiry_time`].
386     *
387     * [`PaymentParameters::expiry_time`]: crate::routing::router::PaymentParameters::expiry_time
388     */
389    LDKPaymentFailureReason_PaymentExpired,
390    /**
391     * We failed to find a route while retrying the payment.
392     */
393    LDKPaymentFailureReason_RouteNotFound,
394    /**
395     * This error should generally never happen. This likely means that there is a problem with
396     * your router.
397     */
398    LDKPaymentFailureReason_UnexpectedError,
399    /**
400     * Must be last for serialization purposes
401     */
402    LDKPaymentFailureReason_Sentinel,
403 } LDKPaymentFailureReason;
404
405 /**
406  * Specifies the recipient of an invoice.
407  *
408  * This indicates to [`NodeSigner::sign_invoice`] what node secret key should be used to sign
409  * the invoice.
410  */
411 typedef enum LDKRecipient {
412    /**
413     * The invoice should be signed with the local node secret key.
414     */
415    LDKRecipient_Node,
416    /**
417     * The invoice should be signed with the phantom node secret key. This secret key must be the
418     * same for all nodes participating in the [phantom node payment].
419     *
420     * [phantom node payment]: PhantomKeysManager
421     */
422    LDKRecipient_PhantomNode,
423    /**
424     * Must be last for serialization purposes
425     */
426    LDKRecipient_Sentinel,
427 } LDKRecipient;
428
429 /**
430  * Indicates an immediate error on [`ChannelManager::send_payment`]. Further errors may be
431  * surfaced later via [`Event::PaymentPathFailed`] and [`Event::PaymentFailed`].
432  *
433  * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
434  * [`Event::PaymentPathFailed`]: crate::events::Event::PaymentPathFailed
435  * [`Event::PaymentFailed`]: crate::events::Event::PaymentFailed
436  */
437 typedef enum LDKRetryableSendFailure {
438    /**
439     * The provided [`PaymentParameters::expiry_time`] indicated that the payment has expired. Note
440     * that this error is *not* caused by [`Retry::Timeout`].
441     *
442     * [`PaymentParameters::expiry_time`]: crate::routing::router::PaymentParameters::expiry_time
443     */
444    LDKRetryableSendFailure_PaymentExpired,
445    /**
446     * We were unable to find a route to the destination.
447     */
448    LDKRetryableSendFailure_RouteNotFound,
449    /**
450     * Indicates that a payment for the provided [`PaymentId`] is already in-flight and has not
451     * yet completed (i.e. generated an [`Event::PaymentSent`] or [`Event::PaymentFailed`]).
452     *
453     * [`PaymentId`]: crate::ln::channelmanager::PaymentId
454     * [`Event::PaymentSent`]: crate::events::Event::PaymentSent
455     * [`Event::PaymentFailed`]: crate::events::Event::PaymentFailed
456     */
457    LDKRetryableSendFailure_DuplicatePayment,
458    /**
459     * Must be last for serialization purposes
460     */
461    LDKRetryableSendFailure_Sentinel,
462 } LDKRetryableSendFailure;
463
464 /**
465  * Represents an error returned from libsecp256k1 during validation of some secp256k1 data
466  */
467 typedef enum LDKSecp256k1Error {
468    /**
469     * Signature failed verification
470     */
471    LDKSecp256k1Error_IncorrectSignature,
472    /**
473     * Badly sized message ("messages" are actually fixed-sized digests; see the MESSAGE_SIZE constant)
474     */
475    LDKSecp256k1Error_InvalidMessage,
476    /**
477     * Bad public key
478     */
479    LDKSecp256k1Error_InvalidPublicKey,
480    /**
481     * Bad signature
482     */
483    LDKSecp256k1Error_InvalidSignature,
484    /**
485     * Bad secret key
486     */
487    LDKSecp256k1Error_InvalidSecretKey,
488    /**
489     * Bad shared secret.
490     */
491    LDKSecp256k1Error_InvalidSharedSecret,
492    /**
493     * Bad recovery id
494     */
495    LDKSecp256k1Error_InvalidRecoveryId,
496    /**
497     * Invalid tweak for add_assign or mul_assign
498     */
499    LDKSecp256k1Error_InvalidTweak,
500    /**
501     * Didn't pass enough memory to context creation with preallocated memory
502     */
503    LDKSecp256k1Error_NotEnoughMemory,
504    /**
505     * Bad set of public keys.
506     */
507    LDKSecp256k1Error_InvalidPublicKeySum,
508    /**
509     * The only valid parity values are 0 or 1.
510     */
511    LDKSecp256k1Error_InvalidParityValue,
512    /**
513     * Must be last for serialization purposes
514     */
515    LDKSecp256k1Error_Sentinel,
516 } LDKSecp256k1Error;
517
518 /**
519  * Errors that may occur when converting a [`RawInvoice`] to an [`Invoice`]. They relate to the
520  * requirements sections in BOLT #11
521  */
522 typedef enum LDKSemanticError {
523    /**
524     * The invoice is missing the mandatory payment hash
525     */
526    LDKSemanticError_NoPaymentHash,
527    /**
528     * The invoice has multiple payment hashes which isn't allowed
529     */
530    LDKSemanticError_MultiplePaymentHashes,
531    /**
532     * No description or description hash are part of the invoice
533     */
534    LDKSemanticError_NoDescription,
535    /**
536     * The invoice contains multiple descriptions and/or description hashes which isn't allowed
537     */
538    LDKSemanticError_MultipleDescriptions,
539    /**
540     * The invoice is missing the mandatory payment secret, which all modern lightning nodes
541     * should provide.
542     */
543    LDKSemanticError_NoPaymentSecret,
544    /**
545     * The invoice contains multiple payment secrets
546     */
547    LDKSemanticError_MultiplePaymentSecrets,
548    /**
549     * The invoice's features are invalid
550     */
551    LDKSemanticError_InvalidFeatures,
552    /**
553     * The recovery id doesn't fit the signature/pub key
554     */
555    LDKSemanticError_InvalidRecoveryId,
556    /**
557     * The invoice's signature is invalid
558     */
559    LDKSemanticError_InvalidSignature,
560    /**
561     * The invoice's amount was not a whole number of millisatoshis
562     */
563    LDKSemanticError_ImpreciseAmount,
564    /**
565     * Must be last for serialization purposes
566     */
567    LDKSemanticError_Sentinel,
568 } LDKSemanticError;
569
570 /**
571  * SI prefixes for the human readable part
572  */
573 typedef enum LDKSiPrefix {
574    /**
575     * 10^-3
576     */
577    LDKSiPrefix_Milli,
578    /**
579     * 10^-6
580     */
581    LDKSiPrefix_Micro,
582    /**
583     * 10^-9
584     */
585    LDKSiPrefix_Nano,
586    /**
587     * 10^-12
588     */
589    LDKSiPrefix_Pico,
590    /**
591     * Must be last for serialization purposes
592     */
593    LDKSiPrefix_Sentinel,
594 } LDKSiPrefix;
595
596 /**
597  * An error when accessing the chain via [`UtxoLookup`].
598  */
599 typedef enum LDKUtxoLookupError {
600    /**
601     * The requested chain is unknown.
602     */
603    LDKUtxoLookupError_UnknownChain,
604    /**
605     * The requested transaction doesn't exist or hasn't confirmed.
606     */
607    LDKUtxoLookupError_UnknownTx,
608    /**
609     * Must be last for serialization purposes
610     */
611    LDKUtxoLookupError_Sentinel,
612 } LDKUtxoLookupError;
613
614 /**
615  * A Rust str object, ie a reference to a UTF8-valid string.
616  * This is *not* null-terminated so cannot be used directly as a C string!
617  */
618 typedef struct LDKStr {
619    /**
620     * A pointer to the string's bytes, in UTF8 encoding
621     */
622    const uint8_t *chars;
623    /**
624     * The number of bytes (not characters!) pointed to by `chars`
625     */
626    uintptr_t len;
627    /**
628     * Whether the data pointed to by `chars` should be freed or not.
629     */
630    bool chars_is_owned;
631 } LDKStr;
632
633 /**
634  * A 16-byte byte array.
635  */
636 typedef struct LDKSixteenBytes {
637    /**
638     * The sixteen bytes
639     */
640    uint8_t data[16];
641 } LDKSixteenBytes;
642
643 /**
644  * Unsigned, 128-bit integer.
645  *
646  * Because LLVM implements an incorrect ABI for 128-bit integers, a wrapper type is defined here.
647  * See https://github.com/rust-lang/rust/issues/54341 for more details.
648  */
649 typedef struct LDKU128 {
650    /**
651     * The 128-bit integer, as 16 little-endian bytes
652     */
653    uint8_t le_bytes[16];
654 } LDKU128;
655
656 /**
657  * Represents a scalar value between zero and the secp256k1 curve order, in big endian.
658  */
659 typedef struct LDKBigEndianScalar {
660    /**
661     * The bytes of the scalar value.
662     */
663    uint8_t big_endian_bytes[32];
664 } LDKBigEndianScalar;
665
666 /**
667  * Arbitrary 32 bytes, which could represent one of a few different things. You probably want to
668  * look up the corresponding function in rust-lightning's docs.
669  */
670 typedef struct LDKThirtyTwoBytes {
671    /**
672     * The thirty-two bytes
673     */
674    uint8_t data[32];
675 } LDKThirtyTwoBytes;
676
677 /**
678  * Represents an error returned from the bech32 library during validation of some bech32 data
679  */
680 typedef enum LDKBech32Error_Tag {
681    /**
682     * String does not contain the separator character
683     */
684    LDKBech32Error_MissingSeparator,
685    /**
686     * The checksum does not match the rest of the data
687     */
688    LDKBech32Error_InvalidChecksum,
689    /**
690     * The data or human-readable part is too long or too short
691     */
692    LDKBech32Error_InvalidLength,
693    /**
694     * Some part of the string contains an invalid character
695     */
696    LDKBech32Error_InvalidChar,
697    /**
698     * Some part of the data has an invalid value
699     */
700    LDKBech32Error_InvalidData,
701    /**
702     * The bit conversion failed due to a padding issue
703     */
704    LDKBech32Error_InvalidPadding,
705    /**
706     * The whole string must be of one case
707     */
708    LDKBech32Error_MixedCase,
709    /**
710     * Must be last for serialization purposes
711     */
712    LDKBech32Error_Sentinel,
713 } LDKBech32Error_Tag;
714
715 typedef struct LDKBech32Error {
716    LDKBech32Error_Tag tag;
717    union {
718       struct {
719          uint32_t invalid_char;
720       };
721       struct {
722          uint8_t invalid_data;
723       };
724    };
725 } LDKBech32Error;
726
727 /**
728  * A serialized transaction, in (pointer, length) form.
729  *
730  * This type optionally owns its own memory, and thus the semantics around access change based on
731  * the `data_is_owned` flag. If `data_is_owned` is set, you must call `Transaction_free` to free
732  * the underlying buffer before the object goes out of scope. If `data_is_owned` is not set, any
733  * access to the buffer after the scope in which the object was provided to you is invalid. eg,
734  * access after you return from the call in which a `!data_is_owned` `Transaction` is provided to
735  * you would be invalid.
736  *
737  * Note that, while it may change in the future, because transactions on the Rust side are stored
738  * in a deserialized form, all `Transaction`s generated on the Rust side will have `data_is_owned`
739  * set. Similarly, while it may change in the future, all `Transaction`s you pass to Rust may have
740  * `data_is_owned` either set or unset at your discretion.
741  */
742 typedef struct LDKTransaction {
743    /**
744     * The serialized transaction data.
745     *
746     * This is non-const for your convenience, an object passed to Rust is never written to.
747     */
748    uint8_t *data;
749    /**
750     * The length of the serialized transaction
751     */
752    uintptr_t datalen;
753    /**
754     * Whether the data pointed to by `data` should be freed or not.
755     */
756    bool data_is_owned;
757 } LDKTransaction;
758
759 /**
760  * A serialized witness.
761  */
762 typedef struct LDKWitness {
763    /**
764     * The serialized transaction data.
765     *
766     * This is non-const for your convenience, an object passed to Rust is never written to.
767     */
768    uint8_t *data;
769    /**
770     * The length of the serialized transaction
771     */
772    uintptr_t datalen;
773    /**
774     * Whether the data pointed to by `data` should be freed or not.
775     */
776    bool data_is_owned;
777 } LDKWitness;
778
779 /**
780  * A dynamically-allocated array of u8s of arbitrary size.
781  * This corresponds to std::vector in C++
782  */
783 typedef struct LDKCVec_u8Z {
784    /**
785     * The elements in the array.
786     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
787     */
788    uint8_t *data;
789    /**
790     * The number of elements pointed to by `data`.
791     */
792    uintptr_t datalen;
793 } LDKCVec_u8Z;
794
795 /**
796  * A transaction output including a scriptPubKey and value.
797  * This type *does* own its own memory, so must be free'd appropriately.
798  */
799 typedef struct LDKTxOut {
800    /**
801     * The script_pubkey in this output
802     */
803    struct LDKCVec_u8Z script_pubkey;
804    /**
805     * The value, in satoshis, of this output
806     */
807    uint64_t value;
808 } LDKTxOut;
809
810 /**
811  * An enum which can either contain a u64 or not
812  */
813 typedef enum LDKCOption_DurationZ_Tag {
814    /**
815     * When we're in this state, this COption_DurationZ contains a u64
816     */
817    LDKCOption_DurationZ_Some,
818    /**
819     * When we're in this state, this COption_DurationZ contains nothing
820     */
821    LDKCOption_DurationZ_None,
822    /**
823     * Must be last for serialization purposes
824     */
825    LDKCOption_DurationZ_Sentinel,
826 } LDKCOption_DurationZ_Tag;
827
828 typedef struct LDKCOption_DurationZ {
829    LDKCOption_DurationZ_Tag tag;
830    union {
831       struct {
832          uint64_t some;
833       };
834    };
835 } LDKCOption_DurationZ;
836
837
838
839 /**
840  * Onion messages and payments can be sent and received to blinded paths, which serve to hide the
841  * identity of the recipient.
842  */
843 typedef struct MUST_USE_STRUCT LDKBlindedPath {
844    /**
845     * A pointer to the opaque Rust object.
846     * Nearly everywhere, inner must be non-null, however in places where
847     * the Rust equivalent takes an Option, it may be set to null to indicate None.
848     */
849    LDKnativeBlindedPath *inner;
850    /**
851     * Indicates that this is the only struct which contains the same pointer.
852     * Rust functions which take ownership of an object provided via an argument require
853     * this to be true and invalidate the object pointed to by inner.
854     */
855    bool is_owned;
856 } LDKBlindedPath;
857
858 /**
859  * A dynamically-allocated array of crate::lightning::blinded_path::BlindedPaths of arbitrary size.
860  * This corresponds to std::vector in C++
861  */
862 typedef struct LDKCVec_BlindedPathZ {
863    /**
864     * The elements in the array.
865     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
866     */
867    struct LDKBlindedPath *data;
868    /**
869     * The number of elements pointed to by `data`.
870     */
871    uintptr_t datalen;
872 } LDKCVec_BlindedPathZ;
873
874 /**
875  * An enum which can either contain a u64 or not
876  */
877 typedef enum LDKCOption_u64Z_Tag {
878    /**
879     * When we're in this state, this COption_u64Z contains a u64
880     */
881    LDKCOption_u64Z_Some,
882    /**
883     * When we're in this state, this COption_u64Z contains nothing
884     */
885    LDKCOption_u64Z_None,
886    /**
887     * Must be last for serialization purposes
888     */
889    LDKCOption_u64Z_Sentinel,
890 } LDKCOption_u64Z_Tag;
891
892 typedef struct LDKCOption_u64Z {
893    LDKCOption_u64Z_Tag tag;
894    union {
895       struct {
896          uint64_t some;
897       };
898    };
899 } LDKCOption_u64Z;
900
901
902
903 /**
904  * A script pubkey for shutting down a channel as defined by [BOLT #2].
905  *
906  * [BOLT #2]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md
907  */
908 typedef struct MUST_USE_STRUCT LDKShutdownScript {
909    /**
910     * A pointer to the opaque Rust object.
911     * Nearly everywhere, inner must be non-null, however in places where
912     * the Rust equivalent takes an Option, it may be set to null to indicate None.
913     */
914    LDKnativeShutdownScript *inner;
915    /**
916     * Indicates that this is the only struct which contains the same pointer.
917     * Rust functions which take ownership of an object provided via an argument require
918     * this to be true and invalidate the object pointed to by inner.
919     */
920    bool is_owned;
921 } LDKShutdownScript;
922
923 /**
924  * Indicates an error on the client's part (usually some variant of attempting to use too-low or
925  * too-high values)
926  */
927 typedef enum LDKAPIError_Tag {
928    /**
929     * Indicates the API was wholly misused (see err for more). Cases where these can be returned
930     * are documented, but generally indicates some precondition of a function was violated.
931     */
932    LDKAPIError_APIMisuseError,
933    /**
934     * Due to a high feerate, we were unable to complete the request.
935     * For example, this may be returned if the feerate implies we cannot open a channel at the
936     * requested value, but opening a larger channel would succeed.
937     */
938    LDKAPIError_FeeRateTooHigh,
939    /**
940     * A malformed Route was provided (eg overflowed value, node id mismatch, overly-looped route,
941     * too-many-hops, etc).
942     */
943    LDKAPIError_InvalidRoute,
944    /**
945     * We were unable to complete the request as the Channel required to do so is unable to
946     * complete the request (or was not found). This can take many forms, including disconnected
947     * peer, channel at capacity, channel shutting down, etc.
948     */
949    LDKAPIError_ChannelUnavailable,
950    /**
951     * An attempt to call [`chain::Watch::watch_channel`]/[`chain::Watch::update_channel`]
952     * returned a [`ChannelMonitorUpdateStatus::InProgress`] indicating the persistence of a
953     * monitor update is awaiting async resolution. Once it resolves the attempted action should
954     * complete automatically.
955     *
956     * [`chain::Watch::watch_channel`]: crate::chain::Watch::watch_channel
957     * [`chain::Watch::update_channel`]: crate::chain::Watch::update_channel
958     * [`ChannelMonitorUpdateStatus::InProgress`]: crate::chain::ChannelMonitorUpdateStatus::InProgress
959     */
960    LDKAPIError_MonitorUpdateInProgress,
961    /**
962     * [`SignerProvider::get_shutdown_scriptpubkey`] returned a shutdown scriptpubkey incompatible
963     * with the channel counterparty as negotiated in [`InitFeatures`].
964     *
965     * Using a SegWit v0 script should resolve this issue. If you cannot, you won't be able to open
966     * a channel or cooperatively close one with this peer (and will have to force-close instead).
967     *
968     * [`SignerProvider::get_shutdown_scriptpubkey`]: crate::chain::keysinterface::SignerProvider::get_shutdown_scriptpubkey
969     * [`InitFeatures`]: crate::ln::features::InitFeatures
970     */
971    LDKAPIError_IncompatibleShutdownScript,
972    /**
973     * Must be last for serialization purposes
974     */
975    LDKAPIError_Sentinel,
976 } LDKAPIError_Tag;
977
978 typedef struct LDKAPIError_LDKAPIMisuseError_Body {
979    /**
980     * A human-readable error message
981     */
982    struct LDKStr err;
983 } LDKAPIError_LDKAPIMisuseError_Body;
984
985 typedef struct LDKAPIError_LDKFeeRateTooHigh_Body {
986    /**
987     * A human-readable error message
988     */
989    struct LDKStr err;
990    /**
991     * The feerate which was too high.
992     */
993    uint32_t feerate;
994 } LDKAPIError_LDKFeeRateTooHigh_Body;
995
996 typedef struct LDKAPIError_LDKInvalidRoute_Body {
997    /**
998     * A human-readable error message
999     */
1000    struct LDKStr err;
1001 } LDKAPIError_LDKInvalidRoute_Body;
1002
1003 typedef struct LDKAPIError_LDKChannelUnavailable_Body {
1004    /**
1005     * A human-readable error message
1006     */
1007    struct LDKStr err;
1008 } LDKAPIError_LDKChannelUnavailable_Body;
1009
1010 typedef struct LDKAPIError_LDKIncompatibleShutdownScript_Body {
1011    /**
1012     * The incompatible shutdown script.
1013     */
1014    struct LDKShutdownScript script;
1015 } LDKAPIError_LDKIncompatibleShutdownScript_Body;
1016
1017 typedef struct MUST_USE_STRUCT LDKAPIError {
1018    LDKAPIError_Tag tag;
1019    union {
1020       LDKAPIError_LDKAPIMisuseError_Body api_misuse_error;
1021       LDKAPIError_LDKFeeRateTooHigh_Body fee_rate_too_high;
1022       LDKAPIError_LDKInvalidRoute_Body invalid_route;
1023       LDKAPIError_LDKChannelUnavailable_Body channel_unavailable;
1024       LDKAPIError_LDKIncompatibleShutdownScript_Body incompatible_shutdown_script;
1025    };
1026 } LDKAPIError;
1027
1028 /**
1029  * The contents of CResult_NoneAPIErrorZ
1030  */
1031 typedef union LDKCResult_NoneAPIErrorZPtr {
1032    /**
1033     * Note that this value is always NULL, as there are no contents in the OK variant
1034     */
1035    void *result;
1036    /**
1037     * A pointer to the contents in the error state.
1038     * Reading from this pointer when `result_ok` is set is undefined.
1039     */
1040    struct LDKAPIError *err;
1041 } LDKCResult_NoneAPIErrorZPtr;
1042
1043 /**
1044  * A CResult_NoneAPIErrorZ represents the result of a fallible operation,
1045  * containing a () on success and a crate::lightning::util::errors::APIError on failure.
1046  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1047  */
1048 typedef struct LDKCResult_NoneAPIErrorZ {
1049    /**
1050     * The contents of this CResult_NoneAPIErrorZ, accessible via either
1051     * `err` or `result` depending on the state of `result_ok`.
1052     */
1053    union LDKCResult_NoneAPIErrorZPtr contents;
1054    /**
1055     * Whether this CResult_NoneAPIErrorZ represents a success state.
1056     */
1057    bool result_ok;
1058 } LDKCResult_NoneAPIErrorZ;
1059
1060 /**
1061  * A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
1062  * This corresponds to std::vector in C++
1063  */
1064 typedef struct LDKCVec_CResult_NoneAPIErrorZZ {
1065    /**
1066     * The elements in the array.
1067     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1068     */
1069    struct LDKCResult_NoneAPIErrorZ *data;
1070    /**
1071     * The number of elements pointed to by `data`.
1072     */
1073    uintptr_t datalen;
1074 } LDKCVec_CResult_NoneAPIErrorZZ;
1075
1076 /**
1077  * A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
1078  * This corresponds to std::vector in C++
1079  */
1080 typedef struct LDKCVec_APIErrorZ {
1081    /**
1082     * The elements in the array.
1083     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1084     */
1085    struct LDKAPIError *data;
1086    /**
1087     * The number of elements pointed to by `data`.
1088     */
1089    uintptr_t datalen;
1090 } LDKCVec_APIErrorZ;
1091
1092 /**
1093  * An enum which can either contain a crate::c_types::derived::CVec_u8Z or not
1094  */
1095 typedef enum LDKCOption_CVec_u8ZZ_Tag {
1096    /**
1097     * When we're in this state, this COption_CVec_u8ZZ contains a crate::c_types::derived::CVec_u8Z
1098     */
1099    LDKCOption_CVec_u8ZZ_Some,
1100    /**
1101     * When we're in this state, this COption_CVec_u8ZZ contains nothing
1102     */
1103    LDKCOption_CVec_u8ZZ_None,
1104    /**
1105     * Must be last for serialization purposes
1106     */
1107    LDKCOption_CVec_u8ZZ_Sentinel,
1108 } LDKCOption_CVec_u8ZZ_Tag;
1109
1110 typedef struct LDKCOption_CVec_u8ZZ {
1111    LDKCOption_CVec_u8ZZ_Tag tag;
1112    union {
1113       struct {
1114          struct LDKCVec_u8Z some;
1115       };
1116    };
1117 } LDKCOption_CVec_u8ZZ;
1118
1119
1120
1121 /**
1122  * Information which is provided, encrypted, to the payment recipient when sending HTLCs.
1123  *
1124  * This should generally be constructed with data communicated to us from the recipient (via a
1125  * BOLT11 or BOLT12 invoice).
1126  */
1127 typedef struct MUST_USE_STRUCT LDKRecipientOnionFields {
1128    /**
1129     * A pointer to the opaque Rust object.
1130     * Nearly everywhere, inner must be non-null, however in places where
1131     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1132     */
1133    LDKnativeRecipientOnionFields *inner;
1134    /**
1135     * Indicates that this is the only struct which contains the same pointer.
1136     * Rust functions which take ownership of an object provided via an argument require
1137     * this to be true and invalidate the object pointed to by inner.
1138     */
1139    bool is_owned;
1140 } LDKRecipientOnionFields;
1141
1142 /**
1143  * An error in decoding a message or struct.
1144  */
1145 typedef enum LDKDecodeError_Tag {
1146    /**
1147     * A version byte specified something we don't know how to handle.
1148     *
1149     * Includes unknown realm byte in an onion hop data packet.
1150     */
1151    LDKDecodeError_UnknownVersion,
1152    /**
1153     * Unknown feature mandating we fail to parse message (e.g., TLV with an even, unknown type)
1154     */
1155    LDKDecodeError_UnknownRequiredFeature,
1156    /**
1157     * Value was invalid.
1158     *
1159     * For example, a byte which was supposed to be a bool was something other than a 0
1160     * or 1, a public key/private key/signature was invalid, text wasn't UTF-8, TLV was
1161     * syntactically incorrect, etc.
1162     */
1163    LDKDecodeError_InvalidValue,
1164    /**
1165     * The buffer to be read was too short.
1166     */
1167    LDKDecodeError_ShortRead,
1168    /**
1169     * A length descriptor in the packet didn't describe the later data correctly.
1170     */
1171    LDKDecodeError_BadLengthDescriptor,
1172    /**
1173     * Error from [`std::io`].
1174     */
1175    LDKDecodeError_Io,
1176    /**
1177     * The message included zlib-compressed values, which we don't support.
1178     */
1179    LDKDecodeError_UnsupportedCompression,
1180    /**
1181     * Must be last for serialization purposes
1182     */
1183    LDKDecodeError_Sentinel,
1184 } LDKDecodeError_Tag;
1185
1186 typedef struct MUST_USE_STRUCT LDKDecodeError {
1187    LDKDecodeError_Tag tag;
1188    union {
1189       struct {
1190          enum LDKIOError io;
1191       };
1192    };
1193 } LDKDecodeError;
1194
1195 /**
1196  * The contents of CResult_RecipientOnionFieldsDecodeErrorZ
1197  */
1198 typedef union LDKCResult_RecipientOnionFieldsDecodeErrorZPtr {
1199    /**
1200     * A pointer to the contents in the success state.
1201     * Reading from this pointer when `result_ok` is not set is undefined.
1202     */
1203    struct LDKRecipientOnionFields *result;
1204    /**
1205     * A pointer to the contents in the error state.
1206     * Reading from this pointer when `result_ok` is set is undefined.
1207     */
1208    struct LDKDecodeError *err;
1209 } LDKCResult_RecipientOnionFieldsDecodeErrorZPtr;
1210
1211 /**
1212  * A CResult_RecipientOnionFieldsDecodeErrorZ represents the result of a fallible operation,
1213  * containing a crate::lightning::ln::outbound_payment::RecipientOnionFields on success and a crate::lightning::ln::msgs::DecodeError on failure.
1214  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1215  */
1216 typedef struct LDKCResult_RecipientOnionFieldsDecodeErrorZ {
1217    /**
1218     * The contents of this CResult_RecipientOnionFieldsDecodeErrorZ, accessible via either
1219     * `err` or `result` depending on the state of `result_ok`.
1220     */
1221    union LDKCResult_RecipientOnionFieldsDecodeErrorZPtr contents;
1222    /**
1223     * Whether this CResult_RecipientOnionFieldsDecodeErrorZ represents a success state.
1224     */
1225    bool result_ok;
1226 } LDKCResult_RecipientOnionFieldsDecodeErrorZ;
1227
1228 /**
1229  * An enum which can either contain a crate::lightning::ln::chan_utils::HTLCClaim or not
1230  */
1231 typedef enum LDKCOption_HTLCClaimZ_Tag {
1232    /**
1233     * When we're in this state, this COption_HTLCClaimZ contains a crate::lightning::ln::chan_utils::HTLCClaim
1234     */
1235    LDKCOption_HTLCClaimZ_Some,
1236    /**
1237     * When we're in this state, this COption_HTLCClaimZ contains nothing
1238     */
1239    LDKCOption_HTLCClaimZ_None,
1240    /**
1241     * Must be last for serialization purposes
1242     */
1243    LDKCOption_HTLCClaimZ_Sentinel,
1244 } LDKCOption_HTLCClaimZ_Tag;
1245
1246 typedef struct LDKCOption_HTLCClaimZ {
1247    LDKCOption_HTLCClaimZ_Tag tag;
1248    union {
1249       struct {
1250          enum LDKHTLCClaim some;
1251       };
1252    };
1253 } LDKCOption_HTLCClaimZ;
1254
1255 /**
1256  * The contents of CResult_NoneNoneZ
1257  */
1258 typedef union LDKCResult_NoneNoneZPtr {
1259    /**
1260     * Note that this value is always NULL, as there are no contents in the OK variant
1261     */
1262    void *result;
1263    /**
1264     * Note that this value is always NULL, as there are no contents in the Err variant
1265     */
1266    void *err;
1267 } LDKCResult_NoneNoneZPtr;
1268
1269 /**
1270  * A CResult_NoneNoneZ represents the result of a fallible operation,
1271  * containing a () on success and a () on failure.
1272  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1273  */
1274 typedef struct LDKCResult_NoneNoneZ {
1275    /**
1276     * The contents of this CResult_NoneNoneZ, accessible via either
1277     * `err` or `result` depending on the state of `result_ok`.
1278     */
1279    union LDKCResult_NoneNoneZPtr contents;
1280    /**
1281     * Whether this CResult_NoneNoneZ represents a success state.
1282     */
1283    bool result_ok;
1284 } LDKCResult_NoneNoneZ;
1285
1286
1287
1288 /**
1289  * Implements the per-commitment secret storage scheme from
1290  * [BOLT 3](https://github.com/lightning/bolts/blob/dcbf8583976df087c79c3ce0b535311212e6812d/03-transactions.md#efficient-per-commitment-secret-storage).
1291  *
1292  * Allows us to keep track of all of the revocation secrets of our counterparty in just 50*32 bytes
1293  * or so.
1294  */
1295 typedef struct MUST_USE_STRUCT LDKCounterpartyCommitmentSecrets {
1296    /**
1297     * A pointer to the opaque Rust object.
1298     * Nearly everywhere, inner must be non-null, however in places where
1299     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1300     */
1301    LDKnativeCounterpartyCommitmentSecrets *inner;
1302    /**
1303     * Indicates that this is the only struct which contains the same pointer.
1304     * Rust functions which take ownership of an object provided via an argument require
1305     * this to be true and invalidate the object pointed to by inner.
1306     */
1307    bool is_owned;
1308 } LDKCounterpartyCommitmentSecrets;
1309
1310 /**
1311  * The contents of CResult_CounterpartyCommitmentSecretsDecodeErrorZ
1312  */
1313 typedef union LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
1314    /**
1315     * A pointer to the contents in the success state.
1316     * Reading from this pointer when `result_ok` is not set is undefined.
1317     */
1318    struct LDKCounterpartyCommitmentSecrets *result;
1319    /**
1320     * A pointer to the contents in the error state.
1321     * Reading from this pointer when `result_ok` is set is undefined.
1322     */
1323    struct LDKDecodeError *err;
1324 } LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZPtr;
1325
1326 /**
1327  * A CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents the result of a fallible operation,
1328  * containing a crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets on success and a crate::lightning::ln::msgs::DecodeError on failure.
1329  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1330  */
1331 typedef struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ {
1332    /**
1333     * The contents of this CResult_CounterpartyCommitmentSecretsDecodeErrorZ, accessible via either
1334     * `err` or `result` depending on the state of `result_ok`.
1335     */
1336    union LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZPtr contents;
1337    /**
1338     * Whether this CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents a success state.
1339     */
1340    bool result_ok;
1341 } LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ;
1342
1343
1344
1345 /**
1346  * The set of public keys which are used in the creation of one commitment transaction.
1347  * These are derived from the channel base keys and per-commitment data.
1348  *
1349  * A broadcaster key is provided from potential broadcaster of the computed transaction.
1350  * A countersignatory key is coming from a protocol participant unable to broadcast the
1351  * transaction.
1352  *
1353  * These keys are assumed to be good, either because the code derived them from
1354  * channel basepoints via the new function, or they were obtained via
1355  * CommitmentTransaction.trust().keys() because we trusted the source of the
1356  * pre-calculated keys.
1357  */
1358 typedef struct MUST_USE_STRUCT LDKTxCreationKeys {
1359    /**
1360     * A pointer to the opaque Rust object.
1361     * Nearly everywhere, inner must be non-null, however in places where
1362     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1363     */
1364    LDKnativeTxCreationKeys *inner;
1365    /**
1366     * Indicates that this is the only struct which contains the same pointer.
1367     * Rust functions which take ownership of an object provided via an argument require
1368     * this to be true and invalidate the object pointed to by inner.
1369     */
1370    bool is_owned;
1371 } LDKTxCreationKeys;
1372
1373 /**
1374  * The contents of CResult_TxCreationKeysDecodeErrorZ
1375  */
1376 typedef union LDKCResult_TxCreationKeysDecodeErrorZPtr {
1377    /**
1378     * A pointer to the contents in the success state.
1379     * Reading from this pointer when `result_ok` is not set is undefined.
1380     */
1381    struct LDKTxCreationKeys *result;
1382    /**
1383     * A pointer to the contents in the error state.
1384     * Reading from this pointer when `result_ok` is set is undefined.
1385     */
1386    struct LDKDecodeError *err;
1387 } LDKCResult_TxCreationKeysDecodeErrorZPtr;
1388
1389 /**
1390  * A CResult_TxCreationKeysDecodeErrorZ represents the result of a fallible operation,
1391  * containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
1392  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1393  */
1394 typedef struct LDKCResult_TxCreationKeysDecodeErrorZ {
1395    /**
1396     * The contents of this CResult_TxCreationKeysDecodeErrorZ, accessible via either
1397     * `err` or `result` depending on the state of `result_ok`.
1398     */
1399    union LDKCResult_TxCreationKeysDecodeErrorZPtr contents;
1400    /**
1401     * Whether this CResult_TxCreationKeysDecodeErrorZ represents a success state.
1402     */
1403    bool result_ok;
1404 } LDKCResult_TxCreationKeysDecodeErrorZ;
1405
1406
1407
1408 /**
1409  * One counterparty's public keys which do not change over the life of a channel.
1410  */
1411 typedef struct MUST_USE_STRUCT LDKChannelPublicKeys {
1412    /**
1413     * A pointer to the opaque Rust object.
1414     * Nearly everywhere, inner must be non-null, however in places where
1415     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1416     */
1417    LDKnativeChannelPublicKeys *inner;
1418    /**
1419     * Indicates that this is the only struct which contains the same pointer.
1420     * Rust functions which take ownership of an object provided via an argument require
1421     * this to be true and invalidate the object pointed to by inner.
1422     */
1423    bool is_owned;
1424 } LDKChannelPublicKeys;
1425
1426 /**
1427  * The contents of CResult_ChannelPublicKeysDecodeErrorZ
1428  */
1429 typedef union LDKCResult_ChannelPublicKeysDecodeErrorZPtr {
1430    /**
1431     * A pointer to the contents in the success state.
1432     * Reading from this pointer when `result_ok` is not set is undefined.
1433     */
1434    struct LDKChannelPublicKeys *result;
1435    /**
1436     * A pointer to the contents in the error state.
1437     * Reading from this pointer when `result_ok` is set is undefined.
1438     */
1439    struct LDKDecodeError *err;
1440 } LDKCResult_ChannelPublicKeysDecodeErrorZPtr;
1441
1442 /**
1443  * A CResult_ChannelPublicKeysDecodeErrorZ represents the result of a fallible operation,
1444  * containing a crate::lightning::ln::chan_utils::ChannelPublicKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
1445  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1446  */
1447 typedef struct LDKCResult_ChannelPublicKeysDecodeErrorZ {
1448    /**
1449     * The contents of this CResult_ChannelPublicKeysDecodeErrorZ, accessible via either
1450     * `err` or `result` depending on the state of `result_ok`.
1451     */
1452    union LDKCResult_ChannelPublicKeysDecodeErrorZPtr contents;
1453    /**
1454     * Whether this CResult_ChannelPublicKeysDecodeErrorZ represents a success state.
1455     */
1456    bool result_ok;
1457 } LDKCResult_ChannelPublicKeysDecodeErrorZ;
1458
1459 /**
1460  * An enum which can either contain a u32 or not
1461  */
1462 typedef enum LDKCOption_u32Z_Tag {
1463    /**
1464     * When we're in this state, this COption_u32Z contains a u32
1465     */
1466    LDKCOption_u32Z_Some,
1467    /**
1468     * When we're in this state, this COption_u32Z contains nothing
1469     */
1470    LDKCOption_u32Z_None,
1471    /**
1472     * Must be last for serialization purposes
1473     */
1474    LDKCOption_u32Z_Sentinel,
1475 } LDKCOption_u32Z_Tag;
1476
1477 typedef struct LDKCOption_u32Z {
1478    LDKCOption_u32Z_Tag tag;
1479    union {
1480       struct {
1481          uint32_t some;
1482       };
1483    };
1484 } LDKCOption_u32Z;
1485
1486
1487
1488 /**
1489  * Information about an HTLC as it appears in a commitment transaction
1490  */
1491 typedef struct MUST_USE_STRUCT LDKHTLCOutputInCommitment {
1492    /**
1493     * A pointer to the opaque Rust object.
1494     * Nearly everywhere, inner must be non-null, however in places where
1495     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1496     */
1497    LDKnativeHTLCOutputInCommitment *inner;
1498    /**
1499     * Indicates that this is the only struct which contains the same pointer.
1500     * Rust functions which take ownership of an object provided via an argument require
1501     * this to be true and invalidate the object pointed to by inner.
1502     */
1503    bool is_owned;
1504 } LDKHTLCOutputInCommitment;
1505
1506 /**
1507  * The contents of CResult_HTLCOutputInCommitmentDecodeErrorZ
1508  */
1509 typedef union LDKCResult_HTLCOutputInCommitmentDecodeErrorZPtr {
1510    /**
1511     * A pointer to the contents in the success state.
1512     * Reading from this pointer when `result_ok` is not set is undefined.
1513     */
1514    struct LDKHTLCOutputInCommitment *result;
1515    /**
1516     * A pointer to the contents in the error state.
1517     * Reading from this pointer when `result_ok` is set is undefined.
1518     */
1519    struct LDKDecodeError *err;
1520 } LDKCResult_HTLCOutputInCommitmentDecodeErrorZPtr;
1521
1522 /**
1523  * A CResult_HTLCOutputInCommitmentDecodeErrorZ represents the result of a fallible operation,
1524  * containing a crate::lightning::ln::chan_utils::HTLCOutputInCommitment on success and a crate::lightning::ln::msgs::DecodeError on failure.
1525  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1526  */
1527 typedef struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ {
1528    /**
1529     * The contents of this CResult_HTLCOutputInCommitmentDecodeErrorZ, accessible via either
1530     * `err` or `result` depending on the state of `result_ok`.
1531     */
1532    union LDKCResult_HTLCOutputInCommitmentDecodeErrorZPtr contents;
1533    /**
1534     * Whether this CResult_HTLCOutputInCommitmentDecodeErrorZ represents a success state.
1535     */
1536    bool result_ok;
1537 } LDKCResult_HTLCOutputInCommitmentDecodeErrorZ;
1538
1539
1540
1541 /**
1542  * Late-bound per-channel counterparty data used to build transactions.
1543  */
1544 typedef struct MUST_USE_STRUCT LDKCounterpartyChannelTransactionParameters {
1545    /**
1546     * A pointer to the opaque Rust object.
1547     * Nearly everywhere, inner must be non-null, however in places where
1548     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1549     */
1550    LDKnativeCounterpartyChannelTransactionParameters *inner;
1551    /**
1552     * Indicates that this is the only struct which contains the same pointer.
1553     * Rust functions which take ownership of an object provided via an argument require
1554     * this to be true and invalidate the object pointed to by inner.
1555     */
1556    bool is_owned;
1557 } LDKCounterpartyChannelTransactionParameters;
1558
1559 /**
1560  * The contents of CResult_CounterpartyChannelTransactionParametersDecodeErrorZ
1561  */
1562 typedef union LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
1563    /**
1564     * A pointer to the contents in the success state.
1565     * Reading from this pointer when `result_ok` is not set is undefined.
1566     */
1567    struct LDKCounterpartyChannelTransactionParameters *result;
1568    /**
1569     * A pointer to the contents in the error state.
1570     * Reading from this pointer when `result_ok` is set is undefined.
1571     */
1572    struct LDKDecodeError *err;
1573 } LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr;
1574
1575 /**
1576  * A CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
1577  * containing a crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
1578  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1579  */
1580 typedef struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
1581    /**
1582     * The contents of this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ, accessible via either
1583     * `err` or `result` depending on the state of `result_ok`.
1584     */
1585    union LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr contents;
1586    /**
1587     * Whether this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents a success state.
1588     */
1589    bool result_ok;
1590 } LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ;
1591
1592
1593
1594 /**
1595  * Per-channel data used to build transactions in conjunction with the per-commitment data (CommitmentTransaction).
1596  * The fields are organized by holder/counterparty.
1597  *
1598  * Normally, this is converted to the broadcaster/countersignatory-organized DirectedChannelTransactionParameters
1599  * before use, via the as_holder_broadcastable and as_counterparty_broadcastable functions.
1600  */
1601 typedef struct MUST_USE_STRUCT LDKChannelTransactionParameters {
1602    /**
1603     * A pointer to the opaque Rust object.
1604     * Nearly everywhere, inner must be non-null, however in places where
1605     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1606     */
1607    LDKnativeChannelTransactionParameters *inner;
1608    /**
1609     * Indicates that this is the only struct which contains the same pointer.
1610     * Rust functions which take ownership of an object provided via an argument require
1611     * this to be true and invalidate the object pointed to by inner.
1612     */
1613    bool is_owned;
1614 } LDKChannelTransactionParameters;
1615
1616 /**
1617  * The contents of CResult_ChannelTransactionParametersDecodeErrorZ
1618  */
1619 typedef union LDKCResult_ChannelTransactionParametersDecodeErrorZPtr {
1620    /**
1621     * A pointer to the contents in the success state.
1622     * Reading from this pointer when `result_ok` is not set is undefined.
1623     */
1624    struct LDKChannelTransactionParameters *result;
1625    /**
1626     * A pointer to the contents in the error state.
1627     * Reading from this pointer when `result_ok` is set is undefined.
1628     */
1629    struct LDKDecodeError *err;
1630 } LDKCResult_ChannelTransactionParametersDecodeErrorZPtr;
1631
1632 /**
1633  * A CResult_ChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
1634  * containing a crate::lightning::ln::chan_utils::ChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
1635  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1636  */
1637 typedef struct LDKCResult_ChannelTransactionParametersDecodeErrorZ {
1638    /**
1639     * The contents of this CResult_ChannelTransactionParametersDecodeErrorZ, accessible via either
1640     * `err` or `result` depending on the state of `result_ok`.
1641     */
1642    union LDKCResult_ChannelTransactionParametersDecodeErrorZPtr contents;
1643    /**
1644     * Whether this CResult_ChannelTransactionParametersDecodeErrorZ represents a success state.
1645     */
1646    bool result_ok;
1647 } LDKCResult_ChannelTransactionParametersDecodeErrorZ;
1648
1649 /**
1650  * Represents a secp256k1 signature serialized as two 32-byte numbers
1651  */
1652 typedef struct LDKSignature {
1653    /**
1654     * The bytes of the signature in "compact" form
1655     */
1656    uint8_t compact_form[64];
1657 } LDKSignature;
1658
1659 /**
1660  * A dynamically-allocated array of crate::c_types::Signatures of arbitrary size.
1661  * This corresponds to std::vector in C++
1662  */
1663 typedef struct LDKCVec_SignatureZ {
1664    /**
1665     * The elements in the array.
1666     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1667     */
1668    struct LDKSignature *data;
1669    /**
1670     * The number of elements pointed to by `data`.
1671     */
1672    uintptr_t datalen;
1673 } LDKCVec_SignatureZ;
1674
1675
1676
1677 /**
1678  * Information needed to build and sign a holder's commitment transaction.
1679  *
1680  * The transaction is only signed once we are ready to broadcast.
1681  */
1682 typedef struct MUST_USE_STRUCT LDKHolderCommitmentTransaction {
1683    /**
1684     * A pointer to the opaque Rust object.
1685     * Nearly everywhere, inner must be non-null, however in places where
1686     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1687     */
1688    LDKnativeHolderCommitmentTransaction *inner;
1689    /**
1690     * Indicates that this is the only struct which contains the same pointer.
1691     * Rust functions which take ownership of an object provided via an argument require
1692     * this to be true and invalidate the object pointed to by inner.
1693     */
1694    bool is_owned;
1695 } LDKHolderCommitmentTransaction;
1696
1697 /**
1698  * The contents of CResult_HolderCommitmentTransactionDecodeErrorZ
1699  */
1700 typedef union LDKCResult_HolderCommitmentTransactionDecodeErrorZPtr {
1701    /**
1702     * A pointer to the contents in the success state.
1703     * Reading from this pointer when `result_ok` is not set is undefined.
1704     */
1705    struct LDKHolderCommitmentTransaction *result;
1706    /**
1707     * A pointer to the contents in the error state.
1708     * Reading from this pointer when `result_ok` is set is undefined.
1709     */
1710    struct LDKDecodeError *err;
1711 } LDKCResult_HolderCommitmentTransactionDecodeErrorZPtr;
1712
1713 /**
1714  * A CResult_HolderCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1715  * containing a crate::lightning::ln::chan_utils::HolderCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1716  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1717  */
1718 typedef struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ {
1719    /**
1720     * The contents of this CResult_HolderCommitmentTransactionDecodeErrorZ, accessible via either
1721     * `err` or `result` depending on the state of `result_ok`.
1722     */
1723    union LDKCResult_HolderCommitmentTransactionDecodeErrorZPtr contents;
1724    /**
1725     * Whether this CResult_HolderCommitmentTransactionDecodeErrorZ represents a success state.
1726     */
1727    bool result_ok;
1728 } LDKCResult_HolderCommitmentTransactionDecodeErrorZ;
1729
1730
1731
1732 /**
1733  * A pre-built Bitcoin commitment transaction and its txid.
1734  */
1735 typedef struct MUST_USE_STRUCT LDKBuiltCommitmentTransaction {
1736    /**
1737     * A pointer to the opaque Rust object.
1738     * Nearly everywhere, inner must be non-null, however in places where
1739     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1740     */
1741    LDKnativeBuiltCommitmentTransaction *inner;
1742    /**
1743     * Indicates that this is the only struct which contains the same pointer.
1744     * Rust functions which take ownership of an object provided via an argument require
1745     * this to be true and invalidate the object pointed to by inner.
1746     */
1747    bool is_owned;
1748 } LDKBuiltCommitmentTransaction;
1749
1750 /**
1751  * The contents of CResult_BuiltCommitmentTransactionDecodeErrorZ
1752  */
1753 typedef union LDKCResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1754    /**
1755     * A pointer to the contents in the success state.
1756     * Reading from this pointer when `result_ok` is not set is undefined.
1757     */
1758    struct LDKBuiltCommitmentTransaction *result;
1759    /**
1760     * A pointer to the contents in the error state.
1761     * Reading from this pointer when `result_ok` is set is undefined.
1762     */
1763    struct LDKDecodeError *err;
1764 } LDKCResult_BuiltCommitmentTransactionDecodeErrorZPtr;
1765
1766 /**
1767  * A CResult_BuiltCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1768  * containing a crate::lightning::ln::chan_utils::BuiltCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1769  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1770  */
1771 typedef struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ {
1772    /**
1773     * The contents of this CResult_BuiltCommitmentTransactionDecodeErrorZ, accessible via either
1774     * `err` or `result` depending on the state of `result_ok`.
1775     */
1776    union LDKCResult_BuiltCommitmentTransactionDecodeErrorZPtr contents;
1777    /**
1778     * Whether this CResult_BuiltCommitmentTransactionDecodeErrorZ represents a success state.
1779     */
1780    bool result_ok;
1781 } LDKCResult_BuiltCommitmentTransactionDecodeErrorZ;
1782
1783
1784
1785 /**
1786  * A wrapper on ClosingTransaction indicating that the built bitcoin
1787  * transaction is trusted.
1788  *
1789  * See trust() and verify() functions on CommitmentTransaction.
1790  *
1791  * This structure implements Deref.
1792  */
1793 typedef struct MUST_USE_STRUCT LDKTrustedClosingTransaction {
1794    /**
1795     * A pointer to the opaque Rust object.
1796     * Nearly everywhere, inner must be non-null, however in places where
1797     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1798     */
1799    LDKnativeTrustedClosingTransaction *inner;
1800    /**
1801     * Indicates that this is the only struct which contains the same pointer.
1802     * Rust functions which take ownership of an object provided via an argument require
1803     * this to be true and invalidate the object pointed to by inner.
1804     */
1805    bool is_owned;
1806 } LDKTrustedClosingTransaction;
1807
1808 /**
1809  * The contents of CResult_TrustedClosingTransactionNoneZ
1810  */
1811 typedef union LDKCResult_TrustedClosingTransactionNoneZPtr {
1812    /**
1813     * A pointer to the contents in the success state.
1814     * Reading from this pointer when `result_ok` is not set is undefined.
1815     */
1816    struct LDKTrustedClosingTransaction *result;
1817    /**
1818     * Note that this value is always NULL, as there are no contents in the Err variant
1819     */
1820    void *err;
1821 } LDKCResult_TrustedClosingTransactionNoneZPtr;
1822
1823 /**
1824  * A CResult_TrustedClosingTransactionNoneZ represents the result of a fallible operation,
1825  * containing a crate::lightning::ln::chan_utils::TrustedClosingTransaction on success and a () on failure.
1826  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1827  */
1828 typedef struct LDKCResult_TrustedClosingTransactionNoneZ {
1829    /**
1830     * The contents of this CResult_TrustedClosingTransactionNoneZ, accessible via either
1831     * `err` or `result` depending on the state of `result_ok`.
1832     */
1833    union LDKCResult_TrustedClosingTransactionNoneZPtr contents;
1834    /**
1835     * Whether this CResult_TrustedClosingTransactionNoneZ represents a success state.
1836     */
1837    bool result_ok;
1838 } LDKCResult_TrustedClosingTransactionNoneZ;
1839
1840
1841
1842 /**
1843  * This class tracks the per-transaction information needed to build a commitment transaction and will
1844  * actually build it and sign.  It is used for holder transactions that we sign only when needed
1845  * and for transactions we sign for the counterparty.
1846  *
1847  * This class can be used inside a signer implementation to generate a signature given the relevant
1848  * secret key.
1849  */
1850 typedef struct MUST_USE_STRUCT LDKCommitmentTransaction {
1851    /**
1852     * A pointer to the opaque Rust object.
1853     * Nearly everywhere, inner must be non-null, however in places where
1854     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1855     */
1856    LDKnativeCommitmentTransaction *inner;
1857    /**
1858     * Indicates that this is the only struct which contains the same pointer.
1859     * Rust functions which take ownership of an object provided via an argument require
1860     * this to be true and invalidate the object pointed to by inner.
1861     */
1862    bool is_owned;
1863 } LDKCommitmentTransaction;
1864
1865 /**
1866  * The contents of CResult_CommitmentTransactionDecodeErrorZ
1867  */
1868 typedef union LDKCResult_CommitmentTransactionDecodeErrorZPtr {
1869    /**
1870     * A pointer to the contents in the success state.
1871     * Reading from this pointer when `result_ok` is not set is undefined.
1872     */
1873    struct LDKCommitmentTransaction *result;
1874    /**
1875     * A pointer to the contents in the error state.
1876     * Reading from this pointer when `result_ok` is set is undefined.
1877     */
1878    struct LDKDecodeError *err;
1879 } LDKCResult_CommitmentTransactionDecodeErrorZPtr;
1880
1881 /**
1882  * A CResult_CommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1883  * containing a crate::lightning::ln::chan_utils::CommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1884  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1885  */
1886 typedef struct LDKCResult_CommitmentTransactionDecodeErrorZ {
1887    /**
1888     * The contents of this CResult_CommitmentTransactionDecodeErrorZ, accessible via either
1889     * `err` or `result` depending on the state of `result_ok`.
1890     */
1891    union LDKCResult_CommitmentTransactionDecodeErrorZPtr contents;
1892    /**
1893     * Whether this CResult_CommitmentTransactionDecodeErrorZ represents a success state.
1894     */
1895    bool result_ok;
1896 } LDKCResult_CommitmentTransactionDecodeErrorZ;
1897
1898
1899
1900 /**
1901  * A wrapper on CommitmentTransaction indicating that the derived fields (the built bitcoin
1902  * transaction and the transaction creation keys) are trusted.
1903  *
1904  * See trust() and verify() functions on CommitmentTransaction.
1905  *
1906  * This structure implements Deref.
1907  */
1908 typedef struct MUST_USE_STRUCT LDKTrustedCommitmentTransaction {
1909    /**
1910     * A pointer to the opaque Rust object.
1911     * Nearly everywhere, inner must be non-null, however in places where
1912     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1913     */
1914    LDKnativeTrustedCommitmentTransaction *inner;
1915    /**
1916     * Indicates that this is the only struct which contains the same pointer.
1917     * Rust functions which take ownership of an object provided via an argument require
1918     * this to be true and invalidate the object pointed to by inner.
1919     */
1920    bool is_owned;
1921 } LDKTrustedCommitmentTransaction;
1922
1923 /**
1924  * The contents of CResult_TrustedCommitmentTransactionNoneZ
1925  */
1926 typedef union LDKCResult_TrustedCommitmentTransactionNoneZPtr {
1927    /**
1928     * A pointer to the contents in the success state.
1929     * Reading from this pointer when `result_ok` is not set is undefined.
1930     */
1931    struct LDKTrustedCommitmentTransaction *result;
1932    /**
1933     * Note that this value is always NULL, as there are no contents in the Err variant
1934     */
1935    void *err;
1936 } LDKCResult_TrustedCommitmentTransactionNoneZPtr;
1937
1938 /**
1939  * A CResult_TrustedCommitmentTransactionNoneZ represents the result of a fallible operation,
1940  * containing a crate::lightning::ln::chan_utils::TrustedCommitmentTransaction on success and a () on failure.
1941  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1942  */
1943 typedef struct LDKCResult_TrustedCommitmentTransactionNoneZ {
1944    /**
1945     * The contents of this CResult_TrustedCommitmentTransactionNoneZ, accessible via either
1946     * `err` or `result` depending on the state of `result_ok`.
1947     */
1948    union LDKCResult_TrustedCommitmentTransactionNoneZPtr contents;
1949    /**
1950     * Whether this CResult_TrustedCommitmentTransactionNoneZ represents a success state.
1951     */
1952    bool result_ok;
1953 } LDKCResult_TrustedCommitmentTransactionNoneZ;
1954
1955 /**
1956  * The contents of CResult_CVec_SignatureZNoneZ
1957  */
1958 typedef union LDKCResult_CVec_SignatureZNoneZPtr {
1959    /**
1960     * A pointer to the contents in the success state.
1961     * Reading from this pointer when `result_ok` is not set is undefined.
1962     */
1963    struct LDKCVec_SignatureZ *result;
1964    /**
1965     * Note that this value is always NULL, as there are no contents in the Err variant
1966     */
1967    void *err;
1968 } LDKCResult_CVec_SignatureZNoneZPtr;
1969
1970 /**
1971  * A CResult_CVec_SignatureZNoneZ represents the result of a fallible operation,
1972  * containing a crate::c_types::derived::CVec_SignatureZ on success and a () on failure.
1973  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1974  */
1975 typedef struct LDKCResult_CVec_SignatureZNoneZ {
1976    /**
1977     * The contents of this CResult_CVec_SignatureZNoneZ, accessible via either
1978     * `err` or `result` depending on the state of `result_ok`.
1979     */
1980    union LDKCResult_CVec_SignatureZNoneZPtr contents;
1981    /**
1982     * Whether this CResult_CVec_SignatureZNoneZ represents a success state.
1983     */
1984    bool result_ok;
1985 } LDKCResult_CVec_SignatureZNoneZ;
1986
1987 /**
1988  * The contents of CResult_ShutdownScriptDecodeErrorZ
1989  */
1990 typedef union LDKCResult_ShutdownScriptDecodeErrorZPtr {
1991    /**
1992     * A pointer to the contents in the success state.
1993     * Reading from this pointer when `result_ok` is not set is undefined.
1994     */
1995    struct LDKShutdownScript *result;
1996    /**
1997     * A pointer to the contents in the error state.
1998     * Reading from this pointer when `result_ok` is set is undefined.
1999     */
2000    struct LDKDecodeError *err;
2001 } LDKCResult_ShutdownScriptDecodeErrorZPtr;
2002
2003 /**
2004  * A CResult_ShutdownScriptDecodeErrorZ represents the result of a fallible operation,
2005  * containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::msgs::DecodeError on failure.
2006  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2007  */
2008 typedef struct LDKCResult_ShutdownScriptDecodeErrorZ {
2009    /**
2010     * The contents of this CResult_ShutdownScriptDecodeErrorZ, accessible via either
2011     * `err` or `result` depending on the state of `result_ok`.
2012     */
2013    union LDKCResult_ShutdownScriptDecodeErrorZPtr contents;
2014    /**
2015     * Whether this CResult_ShutdownScriptDecodeErrorZ represents a success state.
2016     */
2017    bool result_ok;
2018 } LDKCResult_ShutdownScriptDecodeErrorZ;
2019
2020
2021
2022 /**
2023  * An error occurring when converting from [`Script`] to [`ShutdownScript`].
2024  */
2025 typedef struct MUST_USE_STRUCT LDKInvalidShutdownScript {
2026    /**
2027     * A pointer to the opaque Rust object.
2028     * Nearly everywhere, inner must be non-null, however in places where
2029     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2030     */
2031    LDKnativeInvalidShutdownScript *inner;
2032    /**
2033     * Indicates that this is the only struct which contains the same pointer.
2034     * Rust functions which take ownership of an object provided via an argument require
2035     * this to be true and invalidate the object pointed to by inner.
2036     */
2037    bool is_owned;
2038 } LDKInvalidShutdownScript;
2039
2040 /**
2041  * The contents of CResult_ShutdownScriptInvalidShutdownScriptZ
2042  */
2043 typedef union LDKCResult_ShutdownScriptInvalidShutdownScriptZPtr {
2044    /**
2045     * A pointer to the contents in the success state.
2046     * Reading from this pointer when `result_ok` is not set is undefined.
2047     */
2048    struct LDKShutdownScript *result;
2049    /**
2050     * A pointer to the contents in the error state.
2051     * Reading from this pointer when `result_ok` is set is undefined.
2052     */
2053    struct LDKInvalidShutdownScript *err;
2054 } LDKCResult_ShutdownScriptInvalidShutdownScriptZPtr;
2055
2056 /**
2057  * A CResult_ShutdownScriptInvalidShutdownScriptZ represents the result of a fallible operation,
2058  * containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::script::InvalidShutdownScript on failure.
2059  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2060  */
2061 typedef struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ {
2062    /**
2063     * The contents of this CResult_ShutdownScriptInvalidShutdownScriptZ, accessible via either
2064     * `err` or `result` depending on the state of `result_ok`.
2065     */
2066    union LDKCResult_ShutdownScriptInvalidShutdownScriptZPtr contents;
2067    /**
2068     * Whether this CResult_ShutdownScriptInvalidShutdownScriptZ represents a success state.
2069     */
2070    bool result_ok;
2071 } LDKCResult_ShutdownScriptInvalidShutdownScriptZ;
2072
2073
2074
2075 /**
2076  * Information needed to route a payment across a [`BlindedPath`].
2077  */
2078 typedef struct MUST_USE_STRUCT LDKBlindedPayInfo {
2079    /**
2080     * A pointer to the opaque Rust object.
2081     * Nearly everywhere, inner must be non-null, however in places where
2082     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2083     */
2084    LDKnativeBlindedPayInfo *inner;
2085    /**
2086     * Indicates that this is the only struct which contains the same pointer.
2087     * Rust functions which take ownership of an object provided via an argument require
2088     * this to be true and invalidate the object pointed to by inner.
2089     */
2090    bool is_owned;
2091 } LDKBlindedPayInfo;
2092
2093 /**
2094  * The contents of CResult_BlindedPayInfoDecodeErrorZ
2095  */
2096 typedef union LDKCResult_BlindedPayInfoDecodeErrorZPtr {
2097    /**
2098     * A pointer to the contents in the success state.
2099     * Reading from this pointer when `result_ok` is not set is undefined.
2100     */
2101    struct LDKBlindedPayInfo *result;
2102    /**
2103     * A pointer to the contents in the error state.
2104     * Reading from this pointer when `result_ok` is set is undefined.
2105     */
2106    struct LDKDecodeError *err;
2107 } LDKCResult_BlindedPayInfoDecodeErrorZPtr;
2108
2109 /**
2110  * A CResult_BlindedPayInfoDecodeErrorZ represents the result of a fallible operation,
2111  * containing a crate::lightning::offers::invoice::BlindedPayInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
2112  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2113  */
2114 typedef struct LDKCResult_BlindedPayInfoDecodeErrorZ {
2115    /**
2116     * The contents of this CResult_BlindedPayInfoDecodeErrorZ, accessible via either
2117     * `err` or `result` depending on the state of `result_ok`.
2118     */
2119    union LDKCResult_BlindedPayInfoDecodeErrorZPtr contents;
2120    /**
2121     * Whether this CResult_BlindedPayInfoDecodeErrorZ represents a success state.
2122     */
2123    bool result_ok;
2124 } LDKCResult_BlindedPayInfoDecodeErrorZ;
2125
2126
2127
2128 /**
2129  * Represents the compressed public key of a node
2130  */
2131 typedef struct MUST_USE_STRUCT LDKNodeId {
2132    /**
2133     * A pointer to the opaque Rust object.
2134     * Nearly everywhere, inner must be non-null, however in places where
2135     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2136     */
2137    LDKnativeNodeId *inner;
2138    /**
2139     * Indicates that this is the only struct which contains the same pointer.
2140     * Rust functions which take ownership of an object provided via an argument require
2141     * this to be true and invalidate the object pointed to by inner.
2142     */
2143    bool is_owned;
2144 } LDKNodeId;
2145
2146
2147
2148 /**
2149  * Proposed use of a channel passed as a parameter to [`Score::channel_penalty_msat`].
2150  */
2151 typedef struct MUST_USE_STRUCT LDKChannelUsage {
2152    /**
2153     * A pointer to the opaque Rust object.
2154     * Nearly everywhere, inner must be non-null, however in places where
2155     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2156     */
2157    LDKnativeChannelUsage *inner;
2158    /**
2159     * Indicates that this is the only struct which contains the same pointer.
2160     * Rust functions which take ownership of an object provided via an argument require
2161     * this to be true and invalidate the object pointed to by inner.
2162     */
2163    bool is_owned;
2164 } LDKChannelUsage;
2165
2166
2167
2168 /**
2169  * A path in a [`Route`] to the payment recipient. Must always be at least length one.
2170  * If no [`Path::blinded_tail`] is present, then [`Path::hops`] length may be up to 19.
2171  */
2172 typedef struct MUST_USE_STRUCT LDKPath {
2173    /**
2174     * A pointer to the opaque Rust object.
2175     * Nearly everywhere, inner must be non-null, however in places where
2176     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2177     */
2178    LDKnativePath *inner;
2179    /**
2180     * Indicates that this is the only struct which contains the same pointer.
2181     * Rust functions which take ownership of an object provided via an argument require
2182     * this to be true and invalidate the object pointed to by inner.
2183     */
2184    bool is_owned;
2185 } LDKPath;
2186
2187 /**
2188  * An interface used to score payment channels for path finding.
2189  *
2190  *\tScoring is in terms of fees willing to be paid in order to avoid routing through a channel.
2191  */
2192 typedef struct LDKScore {
2193    /**
2194     * An opaque pointer which is passed to your function implementations as an argument.
2195     * This has no meaning in the LDK, and can be NULL or any other value.
2196     */
2197    void *this_arg;
2198    /**
2199     * Returns the fee in msats willing to be paid to avoid routing `send_amt_msat` through the
2200     * given channel in the direction from `source` to `target`.
2201     *
2202     * The channel's capacity (less any other MPP parts that are also being considered for use in
2203     * the same payment) is given by `capacity_msat`. It may be determined from various sources
2204     * such as a chain data, network gossip, or invoice hints. For invoice hints, a capacity near
2205     * [`u64::max_value`] is given to indicate sufficient capacity for the invoice's full amount.
2206     * Thus, implementations should be overflow-safe.
2207     */
2208    uint64_t (*channel_penalty_msat)(const void *this_arg, uint64_t short_channel_id, const struct LDKNodeId *NONNULL_PTR source, const struct LDKNodeId *NONNULL_PTR target, struct LDKChannelUsage usage);
2209    /**
2210     * Handles updating channel penalties after failing to route through a channel.
2211     */
2212    void (*payment_path_failed)(void *this_arg, const struct LDKPath *NONNULL_PTR path, uint64_t short_channel_id);
2213    /**
2214     * Handles updating channel penalties after successfully routing along a path.
2215     */
2216    void (*payment_path_successful)(void *this_arg, const struct LDKPath *NONNULL_PTR path);
2217    /**
2218     * Handles updating channel penalties after a probe over the given path failed.
2219     */
2220    void (*probe_failed)(void *this_arg, const struct LDKPath *NONNULL_PTR path, uint64_t short_channel_id);
2221    /**
2222     * Handles updating channel penalties after a probe over the given path succeeded.
2223     */
2224    void (*probe_successful)(void *this_arg, const struct LDKPath *NONNULL_PTR path);
2225    /**
2226     * Serialize the object into a byte array
2227     */
2228    struct LDKCVec_u8Z (*write)(const void *this_arg);
2229    /**
2230     * Frees any resources associated with this object given its this_arg pointer.
2231     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
2232     */
2233    void (*free)(void *this_arg);
2234 } LDKScore;
2235
2236 /**
2237  * A scorer that is accessed under a lock.
2238  *
2239  * Needed so that calls to [`Score::channel_penalty_msat`] in [`find_route`] can be made while
2240  * having shared ownership of a scorer but without requiring internal locking in [`Score`]
2241  * implementations. Internal locking would be detrimental to route finding performance and could
2242  * result in [`Score::channel_penalty_msat`] returning a different value for the same channel.
2243  *
2244  * [`find_route`]: crate::routing::router::find_route
2245  */
2246 typedef struct LDKLockableScore {
2247    /**
2248     * An opaque pointer which is passed to your function implementations as an argument.
2249     * This has no meaning in the LDK, and can be NULL or any other value.
2250     */
2251    void *this_arg;
2252    /**
2253     * Returns the locked scorer.
2254     */
2255    struct LDKScore (*lock)(const void *this_arg);
2256    /**
2257     * Frees any resources associated with this object given its this_arg pointer.
2258     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
2259     */
2260    void (*free)(void *this_arg);
2261 } LDKLockableScore;
2262
2263 /**
2264  * Refers to a scorer that is accessible under lock and also writeable to disk
2265  *
2266  * We need this trait to be able to pass in a scorer to `lightning-background-processor` that will enable us to
2267  * use the Persister to persist it.
2268  */
2269 typedef struct LDKWriteableScore {
2270    /**
2271     * An opaque pointer which is passed to your function implementations as an argument.
2272     * This has no meaning in the LDK, and can be NULL or any other value.
2273     */
2274    void *this_arg;
2275    /**
2276     * Implementation of LockableScore for this object.
2277     */
2278    struct LDKLockableScore LockableScore;
2279    /**
2280     * Serialize the object into a byte array
2281     */
2282    struct LDKCVec_u8Z (*write)(const void *this_arg);
2283    /**
2284     * Frees any resources associated with this object given its this_arg pointer.
2285     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
2286     */
2287    void (*free)(void *this_arg);
2288 } LDKWriteableScore;
2289
2290 /**
2291  * An enum which can either contain a crate::lightning::routing::scoring::WriteableScore or not
2292  */
2293 typedef enum LDKCOption_WriteableScoreZ_Tag {
2294    /**
2295     * When we're in this state, this COption_WriteableScoreZ contains a crate::lightning::routing::scoring::WriteableScore
2296     */
2297    LDKCOption_WriteableScoreZ_Some,
2298    /**
2299     * When we're in this state, this COption_WriteableScoreZ contains nothing
2300     */
2301    LDKCOption_WriteableScoreZ_None,
2302    /**
2303     * Must be last for serialization purposes
2304     */
2305    LDKCOption_WriteableScoreZ_Sentinel,
2306 } LDKCOption_WriteableScoreZ_Tag;
2307
2308 typedef struct LDKCOption_WriteableScoreZ {
2309    LDKCOption_WriteableScoreZ_Tag tag;
2310    union {
2311       struct {
2312          struct LDKWriteableScore some;
2313       };
2314    };
2315 } LDKCOption_WriteableScoreZ;
2316
2317 /**
2318  * The contents of CResult_NoneErrorZ
2319  */
2320 typedef union LDKCResult_NoneErrorZPtr {
2321    /**
2322     * Note that this value is always NULL, as there are no contents in the OK variant
2323     */
2324    void *result;
2325    /**
2326     * A pointer to the contents in the error state.
2327     * Reading from this pointer when `result_ok` is set is undefined.
2328     */
2329    enum LDKIOError *err;
2330 } LDKCResult_NoneErrorZPtr;
2331
2332 /**
2333  * A CResult_NoneErrorZ represents the result of a fallible operation,
2334  * containing a () on success and a crate::c_types::IOError on failure.
2335  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2336  */
2337 typedef struct LDKCResult_NoneErrorZ {
2338    /**
2339     * The contents of this CResult_NoneErrorZ, accessible via either
2340     * `err` or `result` depending on the state of `result_ok`.
2341     */
2342    union LDKCResult_NoneErrorZPtr contents;
2343    /**
2344     * Whether this CResult_NoneErrorZ represents a success state.
2345     */
2346    bool result_ok;
2347 } LDKCResult_NoneErrorZ;
2348
2349
2350
2351 /**
2352  * Details of a channel, as returned by [`ChannelManager::list_channels`] and [`ChannelManager::list_usable_channels`]
2353  */
2354 typedef struct MUST_USE_STRUCT LDKChannelDetails {
2355    /**
2356     * A pointer to the opaque Rust object.
2357     * Nearly everywhere, inner must be non-null, however in places where
2358     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2359     */
2360    LDKnativeChannelDetails *inner;
2361    /**
2362     * Indicates that this is the only struct which contains the same pointer.
2363     * Rust functions which take ownership of an object provided via an argument require
2364     * this to be true and invalidate the object pointed to by inner.
2365     */
2366    bool is_owned;
2367 } LDKChannelDetails;
2368
2369 /**
2370  * A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
2371  * This corresponds to std::vector in C++
2372  */
2373 typedef struct LDKCVec_ChannelDetailsZ {
2374    /**
2375     * The elements in the array.
2376     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2377     */
2378    struct LDKChannelDetails *data;
2379    /**
2380     * The number of elements pointed to by `data`.
2381     */
2382    uintptr_t datalen;
2383 } LDKCVec_ChannelDetailsZ;
2384
2385
2386
2387 /**
2388  * A route directs a payment from the sender (us) to the recipient. If the recipient supports MPP,
2389  * it can take multiple paths. Each path is composed of one or more hops through the network.
2390  */
2391 typedef struct MUST_USE_STRUCT LDKRoute {
2392    /**
2393     * A pointer to the opaque Rust object.
2394     * Nearly everywhere, inner must be non-null, however in places where
2395     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2396     */
2397    LDKnativeRoute *inner;
2398    /**
2399     * Indicates that this is the only struct which contains the same pointer.
2400     * Rust functions which take ownership of an object provided via an argument require
2401     * this to be true and invalidate the object pointed to by inner.
2402     */
2403    bool is_owned;
2404 } LDKRoute;
2405
2406
2407
2408 /**
2409  * An Err type for failure to process messages.
2410  */
2411 typedef struct MUST_USE_STRUCT LDKLightningError {
2412    /**
2413     * A pointer to the opaque Rust object.
2414     * Nearly everywhere, inner must be non-null, however in places where
2415     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2416     */
2417    LDKnativeLightningError *inner;
2418    /**
2419     * Indicates that this is the only struct which contains the same pointer.
2420     * Rust functions which take ownership of an object provided via an argument require
2421     * this to be true and invalidate the object pointed to by inner.
2422     */
2423    bool is_owned;
2424 } LDKLightningError;
2425
2426 /**
2427  * The contents of CResult_RouteLightningErrorZ
2428  */
2429 typedef union LDKCResult_RouteLightningErrorZPtr {
2430    /**
2431     * A pointer to the contents in the success state.
2432     * Reading from this pointer when `result_ok` is not set is undefined.
2433     */
2434    struct LDKRoute *result;
2435    /**
2436     * A pointer to the contents in the error state.
2437     * Reading from this pointer when `result_ok` is set is undefined.
2438     */
2439    struct LDKLightningError *err;
2440 } LDKCResult_RouteLightningErrorZPtr;
2441
2442 /**
2443  * A CResult_RouteLightningErrorZ represents the result of a fallible operation,
2444  * containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
2445  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2446  */
2447 typedef struct LDKCResult_RouteLightningErrorZ {
2448    /**
2449     * The contents of this CResult_RouteLightningErrorZ, accessible via either
2450     * `err` or `result` depending on the state of `result_ok`.
2451     */
2452    union LDKCResult_RouteLightningErrorZPtr contents;
2453    /**
2454     * Whether this CResult_RouteLightningErrorZ represents a success state.
2455     */
2456    bool result_ok;
2457 } LDKCResult_RouteLightningErrorZ;
2458
2459
2460
2461 /**
2462  * A data structure for tracking in-flight HTLCs. May be used during pathfinding to account for
2463  * in-use channel liquidity.
2464  */
2465 typedef struct MUST_USE_STRUCT LDKInFlightHtlcs {
2466    /**
2467     * A pointer to the opaque Rust object.
2468     * Nearly everywhere, inner must be non-null, however in places where
2469     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2470     */
2471    LDKnativeInFlightHtlcs *inner;
2472    /**
2473     * Indicates that this is the only struct which contains the same pointer.
2474     * Rust functions which take ownership of an object provided via an argument require
2475     * this to be true and invalidate the object pointed to by inner.
2476     */
2477    bool is_owned;
2478 } LDKInFlightHtlcs;
2479
2480 /**
2481  * The contents of CResult_InFlightHtlcsDecodeErrorZ
2482  */
2483 typedef union LDKCResult_InFlightHtlcsDecodeErrorZPtr {
2484    /**
2485     * A pointer to the contents in the success state.
2486     * Reading from this pointer when `result_ok` is not set is undefined.
2487     */
2488    struct LDKInFlightHtlcs *result;
2489    /**
2490     * A pointer to the contents in the error state.
2491     * Reading from this pointer when `result_ok` is set is undefined.
2492     */
2493    struct LDKDecodeError *err;
2494 } LDKCResult_InFlightHtlcsDecodeErrorZPtr;
2495
2496 /**
2497  * A CResult_InFlightHtlcsDecodeErrorZ represents the result of a fallible operation,
2498  * containing a crate::lightning::routing::router::InFlightHtlcs on success and a crate::lightning::ln::msgs::DecodeError on failure.
2499  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2500  */
2501 typedef struct LDKCResult_InFlightHtlcsDecodeErrorZ {
2502    /**
2503     * The contents of this CResult_InFlightHtlcsDecodeErrorZ, accessible via either
2504     * `err` or `result` depending on the state of `result_ok`.
2505     */
2506    union LDKCResult_InFlightHtlcsDecodeErrorZPtr contents;
2507    /**
2508     * Whether this CResult_InFlightHtlcsDecodeErrorZ represents a success state.
2509     */
2510    bool result_ok;
2511 } LDKCResult_InFlightHtlcsDecodeErrorZ;
2512
2513
2514
2515 /**
2516  * A hop in a route, and additional metadata about it. \"Hop\" is defined as a node and the channel
2517  * that leads to it.
2518  */
2519 typedef struct MUST_USE_STRUCT LDKRouteHop {
2520    /**
2521     * A pointer to the opaque Rust object.
2522     * Nearly everywhere, inner must be non-null, however in places where
2523     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2524     */
2525    LDKnativeRouteHop *inner;
2526    /**
2527     * Indicates that this is the only struct which contains the same pointer.
2528     * Rust functions which take ownership of an object provided via an argument require
2529     * this to be true and invalidate the object pointed to by inner.
2530     */
2531    bool is_owned;
2532 } LDKRouteHop;
2533
2534 /**
2535  * The contents of CResult_RouteHopDecodeErrorZ
2536  */
2537 typedef union LDKCResult_RouteHopDecodeErrorZPtr {
2538    /**
2539     * A pointer to the contents in the success state.
2540     * Reading from this pointer when `result_ok` is not set is undefined.
2541     */
2542    struct LDKRouteHop *result;
2543    /**
2544     * A pointer to the contents in the error state.
2545     * Reading from this pointer when `result_ok` is set is undefined.
2546     */
2547    struct LDKDecodeError *err;
2548 } LDKCResult_RouteHopDecodeErrorZPtr;
2549
2550 /**
2551  * A CResult_RouteHopDecodeErrorZ represents the result of a fallible operation,
2552  * containing a crate::lightning::routing::router::RouteHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
2553  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2554  */
2555 typedef struct LDKCResult_RouteHopDecodeErrorZ {
2556    /**
2557     * The contents of this CResult_RouteHopDecodeErrorZ, accessible via either
2558     * `err` or `result` depending on the state of `result_ok`.
2559     */
2560    union LDKCResult_RouteHopDecodeErrorZPtr contents;
2561    /**
2562     * Whether this CResult_RouteHopDecodeErrorZ represents a success state.
2563     */
2564    bool result_ok;
2565 } LDKCResult_RouteHopDecodeErrorZ;
2566
2567
2568
2569 /**
2570  * Used to construct the blinded hops portion of a blinded path. These hops cannot be identified
2571  * by outside observers and thus can be used to hide the identity of the recipient.
2572  */
2573 typedef struct MUST_USE_STRUCT LDKBlindedHop {
2574    /**
2575     * A pointer to the opaque Rust object.
2576     * Nearly everywhere, inner must be non-null, however in places where
2577     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2578     */
2579    LDKnativeBlindedHop *inner;
2580    /**
2581     * Indicates that this is the only struct which contains the same pointer.
2582     * Rust functions which take ownership of an object provided via an argument require
2583     * this to be true and invalidate the object pointed to by inner.
2584     */
2585    bool is_owned;
2586 } LDKBlindedHop;
2587
2588 /**
2589  * A dynamically-allocated array of crate::lightning::blinded_path::BlindedHops of arbitrary size.
2590  * This corresponds to std::vector in C++
2591  */
2592 typedef struct LDKCVec_BlindedHopZ {
2593    /**
2594     * The elements in the array.
2595     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2596     */
2597    struct LDKBlindedHop *data;
2598    /**
2599     * The number of elements pointed to by `data`.
2600     */
2601    uintptr_t datalen;
2602 } LDKCVec_BlindedHopZ;
2603
2604
2605
2606 /**
2607  * The blinded portion of a [`Path`], if we're routing to a recipient who provided blinded paths in
2608  * their BOLT12 [`Invoice`].
2609  *
2610  * [`Invoice`]: crate::offers::invoice::Invoice
2611  */
2612 typedef struct MUST_USE_STRUCT LDKBlindedTail {
2613    /**
2614     * A pointer to the opaque Rust object.
2615     * Nearly everywhere, inner must be non-null, however in places where
2616     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2617     */
2618    LDKnativeBlindedTail *inner;
2619    /**
2620     * Indicates that this is the only struct which contains the same pointer.
2621     * Rust functions which take ownership of an object provided via an argument require
2622     * this to be true and invalidate the object pointed to by inner.
2623     */
2624    bool is_owned;
2625 } LDKBlindedTail;
2626
2627 /**
2628  * The contents of CResult_BlindedTailDecodeErrorZ
2629  */
2630 typedef union LDKCResult_BlindedTailDecodeErrorZPtr {
2631    /**
2632     * A pointer to the contents in the success state.
2633     * Reading from this pointer when `result_ok` is not set is undefined.
2634     */
2635    struct LDKBlindedTail *result;
2636    /**
2637     * A pointer to the contents in the error state.
2638     * Reading from this pointer when `result_ok` is set is undefined.
2639     */
2640    struct LDKDecodeError *err;
2641 } LDKCResult_BlindedTailDecodeErrorZPtr;
2642
2643 /**
2644  * A CResult_BlindedTailDecodeErrorZ represents the result of a fallible operation,
2645  * containing a crate::lightning::routing::router::BlindedTail on success and a crate::lightning::ln::msgs::DecodeError on failure.
2646  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2647  */
2648 typedef struct LDKCResult_BlindedTailDecodeErrorZ {
2649    /**
2650     * The contents of this CResult_BlindedTailDecodeErrorZ, accessible via either
2651     * `err` or `result` depending on the state of `result_ok`.
2652     */
2653    union LDKCResult_BlindedTailDecodeErrorZPtr contents;
2654    /**
2655     * Whether this CResult_BlindedTailDecodeErrorZ represents a success state.
2656     */
2657    bool result_ok;
2658 } LDKCResult_BlindedTailDecodeErrorZ;
2659
2660 /**
2661  * A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
2662  * This corresponds to std::vector in C++
2663  */
2664 typedef struct LDKCVec_RouteHopZ {
2665    /**
2666     * The elements in the array.
2667     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2668     */
2669    struct LDKRouteHop *data;
2670    /**
2671     * The number of elements pointed to by `data`.
2672     */
2673    uintptr_t datalen;
2674 } LDKCVec_RouteHopZ;
2675
2676 /**
2677  * A dynamically-allocated array of crate::lightning::routing::router::Paths of arbitrary size.
2678  * This corresponds to std::vector in C++
2679  */
2680 typedef struct LDKCVec_PathZ {
2681    /**
2682     * The elements in the array.
2683     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2684     */
2685    struct LDKPath *data;
2686    /**
2687     * The number of elements pointed to by `data`.
2688     */
2689    uintptr_t datalen;
2690 } LDKCVec_PathZ;
2691
2692 /**
2693  * The contents of CResult_RouteDecodeErrorZ
2694  */
2695 typedef union LDKCResult_RouteDecodeErrorZPtr {
2696    /**
2697     * A pointer to the contents in the success state.
2698     * Reading from this pointer when `result_ok` is not set is undefined.
2699     */
2700    struct LDKRoute *result;
2701    /**
2702     * A pointer to the contents in the error state.
2703     * Reading from this pointer when `result_ok` is set is undefined.
2704     */
2705    struct LDKDecodeError *err;
2706 } LDKCResult_RouteDecodeErrorZPtr;
2707
2708 /**
2709  * A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
2710  * containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
2711  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2712  */
2713 typedef struct LDKCResult_RouteDecodeErrorZ {
2714    /**
2715     * The contents of this CResult_RouteDecodeErrorZ, accessible via either
2716     * `err` or `result` depending on the state of `result_ok`.
2717     */
2718    union LDKCResult_RouteDecodeErrorZPtr contents;
2719    /**
2720     * Whether this CResult_RouteDecodeErrorZ represents a success state.
2721     */
2722    bool result_ok;
2723 } LDKCResult_RouteDecodeErrorZ;
2724
2725
2726
2727 /**
2728  * Parameters needed to find a [`Route`].
2729  *
2730  * Passed to [`find_route`] and [`build_route_from_hops`], but also provided in
2731  * [`Event::PaymentPathFailed`].
2732  *
2733  * [`Event::PaymentPathFailed`]: crate::events::Event::PaymentPathFailed
2734  */
2735 typedef struct MUST_USE_STRUCT LDKRouteParameters {
2736    /**
2737     * A pointer to the opaque Rust object.
2738     * Nearly everywhere, inner must be non-null, however in places where
2739     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2740     */
2741    LDKnativeRouteParameters *inner;
2742    /**
2743     * Indicates that this is the only struct which contains the same pointer.
2744     * Rust functions which take ownership of an object provided via an argument require
2745     * this to be true and invalidate the object pointed to by inner.
2746     */
2747    bool is_owned;
2748 } LDKRouteParameters;
2749
2750 /**
2751  * The contents of CResult_RouteParametersDecodeErrorZ
2752  */
2753 typedef union LDKCResult_RouteParametersDecodeErrorZPtr {
2754    /**
2755     * A pointer to the contents in the success state.
2756     * Reading from this pointer when `result_ok` is not set is undefined.
2757     */
2758    struct LDKRouteParameters *result;
2759    /**
2760     * A pointer to the contents in the error state.
2761     * Reading from this pointer when `result_ok` is set is undefined.
2762     */
2763    struct LDKDecodeError *err;
2764 } LDKCResult_RouteParametersDecodeErrorZPtr;
2765
2766 /**
2767  * A CResult_RouteParametersDecodeErrorZ represents the result of a fallible operation,
2768  * containing a crate::lightning::routing::router::RouteParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
2769  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2770  */
2771 typedef struct LDKCResult_RouteParametersDecodeErrorZ {
2772    /**
2773     * The contents of this CResult_RouteParametersDecodeErrorZ, accessible via either
2774     * `err` or `result` depending on the state of `result_ok`.
2775     */
2776    union LDKCResult_RouteParametersDecodeErrorZPtr contents;
2777    /**
2778     * Whether this CResult_RouteParametersDecodeErrorZ represents a success state.
2779     */
2780    bool result_ok;
2781 } LDKCResult_RouteParametersDecodeErrorZ;
2782
2783 /**
2784  * A dynamically-allocated array of u64s of arbitrary size.
2785  * This corresponds to std::vector in C++
2786  */
2787 typedef struct LDKCVec_u64Z {
2788    /**
2789     * The elements in the array.
2790     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2791     */
2792    uint64_t *data;
2793    /**
2794     * The number of elements pointed to by `data`.
2795     */
2796    uintptr_t datalen;
2797 } LDKCVec_u64Z;
2798
2799
2800
2801 /**
2802  * The recipient of a payment.
2803  */
2804 typedef struct MUST_USE_STRUCT LDKPaymentParameters {
2805    /**
2806     * A pointer to the opaque Rust object.
2807     * Nearly everywhere, inner must be non-null, however in places where
2808     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2809     */
2810    LDKnativePaymentParameters *inner;
2811    /**
2812     * Indicates that this is the only struct which contains the same pointer.
2813     * Rust functions which take ownership of an object provided via an argument require
2814     * this to be true and invalidate the object pointed to by inner.
2815     */
2816    bool is_owned;
2817 } LDKPaymentParameters;
2818
2819 /**
2820  * The contents of CResult_PaymentParametersDecodeErrorZ
2821  */
2822 typedef union LDKCResult_PaymentParametersDecodeErrorZPtr {
2823    /**
2824     * A pointer to the contents in the success state.
2825     * Reading from this pointer when `result_ok` is not set is undefined.
2826     */
2827    struct LDKPaymentParameters *result;
2828    /**
2829     * A pointer to the contents in the error state.
2830     * Reading from this pointer when `result_ok` is set is undefined.
2831     */
2832    struct LDKDecodeError *err;
2833 } LDKCResult_PaymentParametersDecodeErrorZPtr;
2834
2835 /**
2836  * A CResult_PaymentParametersDecodeErrorZ represents the result of a fallible operation,
2837  * containing a crate::lightning::routing::router::PaymentParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
2838  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2839  */
2840 typedef struct LDKCResult_PaymentParametersDecodeErrorZ {
2841    /**
2842     * The contents of this CResult_PaymentParametersDecodeErrorZ, accessible via either
2843     * `err` or `result` depending on the state of `result_ok`.
2844     */
2845    union LDKCResult_PaymentParametersDecodeErrorZPtr contents;
2846    /**
2847     * Whether this CResult_PaymentParametersDecodeErrorZ represents a success state.
2848     */
2849    bool result_ok;
2850 } LDKCResult_PaymentParametersDecodeErrorZ;
2851
2852 /**
2853  * A tuple of 2 elements. See the individual fields for the types contained.
2854  */
2855 typedef struct LDKC2Tuple_BlindedPayInfoBlindedPathZ {
2856    /**
2857     * The element at position 0
2858     */
2859    struct LDKBlindedPayInfo a;
2860    /**
2861     * The element at position 1
2862     */
2863    struct LDKBlindedPath b;
2864 } LDKC2Tuple_BlindedPayInfoBlindedPathZ;
2865
2866 /**
2867  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZs of arbitrary size.
2868  * This corresponds to std::vector in C++
2869  */
2870 typedef struct LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ {
2871    /**
2872     * The elements in the array.
2873     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2874     */
2875    struct LDKC2Tuple_BlindedPayInfoBlindedPathZ *data;
2876    /**
2877     * The number of elements pointed to by `data`.
2878     */
2879    uintptr_t datalen;
2880 } LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ;
2881
2882
2883
2884 /**
2885  * A list of hops along a payment path terminating with a channel to the recipient.
2886  */
2887 typedef struct MUST_USE_STRUCT LDKRouteHint {
2888    /**
2889     * A pointer to the opaque Rust object.
2890     * Nearly everywhere, inner must be non-null, however in places where
2891     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2892     */
2893    LDKnativeRouteHint *inner;
2894    /**
2895     * Indicates that this is the only struct which contains the same pointer.
2896     * Rust functions which take ownership of an object provided via an argument require
2897     * this to be true and invalidate the object pointed to by inner.
2898     */
2899    bool is_owned;
2900 } LDKRouteHint;
2901
2902 /**
2903  * A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size.
2904  * This corresponds to std::vector in C++
2905  */
2906 typedef struct LDKCVec_RouteHintZ {
2907    /**
2908     * The elements in the array.
2909     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2910     */
2911    struct LDKRouteHint *data;
2912    /**
2913     * The number of elements pointed to by `data`.
2914     */
2915    uintptr_t datalen;
2916 } LDKCVec_RouteHintZ;
2917
2918
2919
2920 /**
2921  * A channel descriptor for a hop along a payment path.
2922  */
2923 typedef struct MUST_USE_STRUCT LDKRouteHintHop {
2924    /**
2925     * A pointer to the opaque Rust object.
2926     * Nearly everywhere, inner must be non-null, however in places where
2927     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2928     */
2929    LDKnativeRouteHintHop *inner;
2930    /**
2931     * Indicates that this is the only struct which contains the same pointer.
2932     * Rust functions which take ownership of an object provided via an argument require
2933     * this to be true and invalidate the object pointed to by inner.
2934     */
2935    bool is_owned;
2936 } LDKRouteHintHop;
2937
2938 /**
2939  * A dynamically-allocated array of crate::lightning::routing::router::RouteHintHops of arbitrary size.
2940  * This corresponds to std::vector in C++
2941  */
2942 typedef struct LDKCVec_RouteHintHopZ {
2943    /**
2944     * The elements in the array.
2945     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2946     */
2947    struct LDKRouteHintHop *data;
2948    /**
2949     * The number of elements pointed to by `data`.
2950     */
2951    uintptr_t datalen;
2952 } LDKCVec_RouteHintHopZ;
2953
2954 /**
2955  * The contents of CResult_RouteHintDecodeErrorZ
2956  */
2957 typedef union LDKCResult_RouteHintDecodeErrorZPtr {
2958    /**
2959     * A pointer to the contents in the success state.
2960     * Reading from this pointer when `result_ok` is not set is undefined.
2961     */
2962    struct LDKRouteHint *result;
2963    /**
2964     * A pointer to the contents in the error state.
2965     * Reading from this pointer when `result_ok` is set is undefined.
2966     */
2967    struct LDKDecodeError *err;
2968 } LDKCResult_RouteHintDecodeErrorZPtr;
2969
2970 /**
2971  * A CResult_RouteHintDecodeErrorZ represents the result of a fallible operation,
2972  * containing a crate::lightning::routing::router::RouteHint on success and a crate::lightning::ln::msgs::DecodeError on failure.
2973  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2974  */
2975 typedef struct LDKCResult_RouteHintDecodeErrorZ {
2976    /**
2977     * The contents of this CResult_RouteHintDecodeErrorZ, accessible via either
2978     * `err` or `result` depending on the state of `result_ok`.
2979     */
2980    union LDKCResult_RouteHintDecodeErrorZPtr contents;
2981    /**
2982     * Whether this CResult_RouteHintDecodeErrorZ represents a success state.
2983     */
2984    bool result_ok;
2985 } LDKCResult_RouteHintDecodeErrorZ;
2986
2987 /**
2988  * The contents of CResult_RouteHintHopDecodeErrorZ
2989  */
2990 typedef union LDKCResult_RouteHintHopDecodeErrorZPtr {
2991    /**
2992     * A pointer to the contents in the success state.
2993     * Reading from this pointer when `result_ok` is not set is undefined.
2994     */
2995    struct LDKRouteHintHop *result;
2996    /**
2997     * A pointer to the contents in the error state.
2998     * Reading from this pointer when `result_ok` is set is undefined.
2999     */
3000    struct LDKDecodeError *err;
3001 } LDKCResult_RouteHintHopDecodeErrorZPtr;
3002
3003 /**
3004  * A CResult_RouteHintHopDecodeErrorZ represents the result of a fallible operation,
3005  * containing a crate::lightning::routing::router::RouteHintHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
3006  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3007  */
3008 typedef struct LDKCResult_RouteHintHopDecodeErrorZ {
3009    /**
3010     * The contents of this CResult_RouteHintHopDecodeErrorZ, accessible via either
3011     * `err` or `result` depending on the state of `result_ok`.
3012     */
3013    union LDKCResult_RouteHintHopDecodeErrorZPtr contents;
3014    /**
3015     * Whether this CResult_RouteHintHopDecodeErrorZ represents a success state.
3016     */
3017    bool result_ok;
3018 } LDKCResult_RouteHintHopDecodeErrorZ;
3019
3020 /**
3021  * Represents a valid secp256k1 public key serialized in "compressed form" as a 33 byte array.
3022  */
3023 typedef struct LDKPublicKey {
3024    /**
3025     * The bytes of the public key
3026     */
3027    uint8_t compressed_form[33];
3028 } LDKPublicKey;
3029
3030 /**
3031  * A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
3032  * This corresponds to std::vector in C++
3033  */
3034 typedef struct LDKCVec_PublicKeyZ {
3035    /**
3036     * The elements in the array.
3037     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3038     */
3039    struct LDKPublicKey *data;
3040    /**
3041     * The number of elements pointed to by `data`.
3042     */
3043    uintptr_t datalen;
3044 } LDKCVec_PublicKeyZ;
3045
3046 /**
3047  * A tuple of 2 elements. See the individual fields for the types contained.
3048  */
3049 typedef struct LDKC2Tuple_usizeTransactionZ {
3050    /**
3051     * The element at position 0
3052     */
3053    uintptr_t a;
3054    /**
3055     * The element at position 1
3056     */
3057    struct LDKTransaction b;
3058 } LDKC2Tuple_usizeTransactionZ;
3059
3060 /**
3061  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
3062  * This corresponds to std::vector in C++
3063  */
3064 typedef struct LDKCVec_C2Tuple_usizeTransactionZZ {
3065    /**
3066     * The elements in the array.
3067     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3068     */
3069    struct LDKC2Tuple_usizeTransactionZ *data;
3070    /**
3071     * The number of elements pointed to by `data`.
3072     */
3073    uintptr_t datalen;
3074 } LDKCVec_C2Tuple_usizeTransactionZZ;
3075
3076 /**
3077  * A tuple of 2 elements. See the individual fields for the types contained.
3078  */
3079 typedef struct LDKC2Tuple_TxidBlockHashZ {
3080    /**
3081     * The element at position 0
3082     */
3083    struct LDKThirtyTwoBytes a;
3084    /**
3085     * The element at position 1
3086     */
3087    struct LDKThirtyTwoBytes b;
3088 } LDKC2Tuple_TxidBlockHashZ;
3089
3090 /**
3091  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidBlockHashZs of arbitrary size.
3092  * This corresponds to std::vector in C++
3093  */
3094 typedef struct LDKCVec_C2Tuple_TxidBlockHashZZ {
3095    /**
3096     * The elements in the array.
3097     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3098     */
3099    struct LDKC2Tuple_TxidBlockHashZ *data;
3100    /**
3101     * The number of elements pointed to by `data`.
3102     */
3103    uintptr_t datalen;
3104 } LDKCVec_C2Tuple_TxidBlockHashZZ;
3105
3106
3107
3108 /**
3109  * Simple structure sent back by `chain::Watch` when an HTLC from a forward channel is detected on
3110  * chain. Used to update the corresponding HTLC in the backward channel. Failing to pass the
3111  * preimage claim backward will lead to loss of funds.
3112  */
3113 typedef struct MUST_USE_STRUCT LDKHTLCUpdate {
3114    /**
3115     * A pointer to the opaque Rust object.
3116     * Nearly everywhere, inner must be non-null, however in places where
3117     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3118     */
3119    LDKnativeHTLCUpdate *inner;
3120    /**
3121     * Indicates that this is the only struct which contains the same pointer.
3122     * Rust functions which take ownership of an object provided via an argument require
3123     * this to be true and invalidate the object pointed to by inner.
3124     */
3125    bool is_owned;
3126 } LDKHTLCUpdate;
3127
3128
3129
3130 /**
3131  * A reference to a transaction output.
3132  *
3133  * Differs from bitcoin::blockdata::transaction::OutPoint as the index is a u16 instead of u32
3134  * due to LN's restrictions on index values. Should reduce (possibly) unsafe conversions this way.
3135  */
3136 typedef struct MUST_USE_STRUCT LDKOutPoint {
3137    /**
3138     * A pointer to the opaque Rust object.
3139     * Nearly everywhere, inner must be non-null, however in places where
3140     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3141     */
3142    LDKnativeOutPoint *inner;
3143    /**
3144     * Indicates that this is the only struct which contains the same pointer.
3145     * Rust functions which take ownership of an object provided via an argument require
3146     * this to be true and invalidate the object pointed to by inner.
3147     */
3148    bool is_owned;
3149 } LDKOutPoint;
3150
3151 /**
3152  * An event to be processed by the ChannelManager.
3153  */
3154 typedef enum LDKMonitorEvent_Tag {
3155    /**
3156     * A monitor event containing an HTLCUpdate.
3157     */
3158    LDKMonitorEvent_HTLCEvent,
3159    /**
3160     * A monitor event that the Channel's commitment transaction was confirmed.
3161     */
3162    LDKMonitorEvent_CommitmentTxConfirmed,
3163    /**
3164     * Indicates a [`ChannelMonitor`] update has completed. See
3165     * [`ChannelMonitorUpdateStatus::InProgress`] for more information on how this is used.
3166     *
3167     * [`ChannelMonitorUpdateStatus::InProgress`]: super::ChannelMonitorUpdateStatus::InProgress
3168     */
3169    LDKMonitorEvent_Completed,
3170    /**
3171     * Indicates a [`ChannelMonitor`] update has failed. See
3172     * [`ChannelMonitorUpdateStatus::PermanentFailure`] for more information on how this is used.
3173     *
3174     * [`ChannelMonitorUpdateStatus::PermanentFailure`]: super::ChannelMonitorUpdateStatus::PermanentFailure
3175     */
3176    LDKMonitorEvent_UpdateFailed,
3177    /**
3178     * Must be last for serialization purposes
3179     */
3180    LDKMonitorEvent_Sentinel,
3181 } LDKMonitorEvent_Tag;
3182
3183 typedef struct LDKMonitorEvent_LDKCompleted_Body {
3184    /**
3185     * The funding outpoint of the [`ChannelMonitor`] that was updated
3186     */
3187    struct LDKOutPoint funding_txo;
3188    /**
3189     * The Update ID from [`ChannelMonitorUpdate::update_id`] which was applied or
3190     * [`ChannelMonitor::get_latest_update_id`].
3191     *
3192     * Note that this should only be set to a given update's ID if all previous updates for the
3193     * same [`ChannelMonitor`] have been applied and persisted.
3194     */
3195    uint64_t monitor_update_id;
3196 } LDKMonitorEvent_LDKCompleted_Body;
3197
3198 typedef struct MUST_USE_STRUCT LDKMonitorEvent {
3199    LDKMonitorEvent_Tag tag;
3200    union {
3201       struct {
3202          struct LDKHTLCUpdate htlc_event;
3203       };
3204       struct {
3205          struct LDKOutPoint commitment_tx_confirmed;
3206       };
3207       LDKMonitorEvent_LDKCompleted_Body completed;
3208       struct {
3209          struct LDKOutPoint update_failed;
3210       };
3211    };
3212 } LDKMonitorEvent;
3213
3214 /**
3215  * A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
3216  * This corresponds to std::vector in C++
3217  */
3218 typedef struct LDKCVec_MonitorEventZ {
3219    /**
3220     * The elements in the array.
3221     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3222     */
3223    struct LDKMonitorEvent *data;
3224    /**
3225     * The number of elements pointed to by `data`.
3226     */
3227    uintptr_t datalen;
3228 } LDKCVec_MonitorEventZ;
3229
3230 /**
3231  * A tuple of 3 elements. See the individual fields for the types contained.
3232  */
3233 typedef struct LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
3234    /**
3235     * The element at position 0
3236     */
3237    struct LDKOutPoint a;
3238    /**
3239     * The element at position 1
3240     */
3241    struct LDKCVec_MonitorEventZ b;
3242    /**
3243     * The element at position 2
3244     */
3245    struct LDKPublicKey c;
3246 } LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ;
3247
3248 /**
3249  * A dynamically-allocated array of crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZs of arbitrary size.
3250  * This corresponds to std::vector in C++
3251  */
3252 typedef struct LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
3253    /**
3254     * The elements in the array.
3255     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3256     */
3257    struct LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *data;
3258    /**
3259     * The number of elements pointed to by `data`.
3260     */
3261    uintptr_t datalen;
3262 } LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ;
3263
3264
3265
3266 /**
3267  * [`Score`] implementation that uses a fixed penalty.
3268  */
3269 typedef struct MUST_USE_STRUCT LDKFixedPenaltyScorer {
3270    /**
3271     * A pointer to the opaque Rust object.
3272     * Nearly everywhere, inner must be non-null, however in places where
3273     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3274     */
3275    LDKnativeFixedPenaltyScorer *inner;
3276    /**
3277     * Indicates that this is the only struct which contains the same pointer.
3278     * Rust functions which take ownership of an object provided via an argument require
3279     * this to be true and invalidate the object pointed to by inner.
3280     */
3281    bool is_owned;
3282 } LDKFixedPenaltyScorer;
3283
3284 /**
3285  * The contents of CResult_FixedPenaltyScorerDecodeErrorZ
3286  */
3287 typedef union LDKCResult_FixedPenaltyScorerDecodeErrorZPtr {
3288    /**
3289     * A pointer to the contents in the success state.
3290     * Reading from this pointer when `result_ok` is not set is undefined.
3291     */
3292    struct LDKFixedPenaltyScorer *result;
3293    /**
3294     * A pointer to the contents in the error state.
3295     * Reading from this pointer when `result_ok` is set is undefined.
3296     */
3297    struct LDKDecodeError *err;
3298 } LDKCResult_FixedPenaltyScorerDecodeErrorZPtr;
3299
3300 /**
3301  * A CResult_FixedPenaltyScorerDecodeErrorZ represents the result of a fallible operation,
3302  * containing a crate::lightning::routing::scoring::FixedPenaltyScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
3303  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3304  */
3305 typedef struct LDKCResult_FixedPenaltyScorerDecodeErrorZ {
3306    /**
3307     * The contents of this CResult_FixedPenaltyScorerDecodeErrorZ, accessible via either
3308     * `err` or `result` depending on the state of `result_ok`.
3309     */
3310    union LDKCResult_FixedPenaltyScorerDecodeErrorZPtr contents;
3311    /**
3312     * Whether this CResult_FixedPenaltyScorerDecodeErrorZ represents a success state.
3313     */
3314    bool result_ok;
3315 } LDKCResult_FixedPenaltyScorerDecodeErrorZ;
3316
3317 /**
3318  * A tuple of 2 elements. See the individual fields for the types contained.
3319  */
3320 typedef struct LDKC2Tuple_u64u64Z {
3321    /**
3322     * The element at position 0
3323     */
3324    uint64_t a;
3325    /**
3326     * The element at position 1
3327     */
3328    uint64_t b;
3329 } LDKC2Tuple_u64u64Z;
3330
3331 /**
3332  * An enum which can either contain a crate::c_types::derived::C2Tuple_u64u64Z or not
3333  */
3334 typedef enum LDKCOption_C2Tuple_u64u64ZZ_Tag {
3335    /**
3336     * When we're in this state, this COption_C2Tuple_u64u64ZZ contains a crate::c_types::derived::C2Tuple_u64u64Z
3337     */
3338    LDKCOption_C2Tuple_u64u64ZZ_Some,
3339    /**
3340     * When we're in this state, this COption_C2Tuple_u64u64ZZ contains nothing
3341     */
3342    LDKCOption_C2Tuple_u64u64ZZ_None,
3343    /**
3344     * Must be last for serialization purposes
3345     */
3346    LDKCOption_C2Tuple_u64u64ZZ_Sentinel,
3347 } LDKCOption_C2Tuple_u64u64ZZ_Tag;
3348
3349 typedef struct LDKCOption_C2Tuple_u64u64ZZ {
3350    LDKCOption_C2Tuple_u64u64ZZ_Tag tag;
3351    union {
3352       struct {
3353          struct LDKC2Tuple_u64u64Z some;
3354       };
3355    };
3356 } LDKCOption_C2Tuple_u64u64ZZ;
3357
3358 /**
3359  * 8 u16s
3360  */
3361 typedef struct LDKEightU16s {
3362    /**
3363     * The eight 16-bit integers
3364     */
3365    uint16_t data[8];
3366 } LDKEightU16s;
3367
3368 /**
3369  * A tuple of 2 elements. See the individual fields for the types contained.
3370  */
3371 typedef struct LDKC2Tuple_Z {
3372    /**
3373     * The element at position 0
3374     */
3375    struct LDKEightU16s a;
3376    /**
3377     * The element at position 1
3378     */
3379    struct LDKEightU16s b;
3380 } LDKC2Tuple_Z;
3381
3382 /**
3383  * A tuple of 2 elements. See the individual fields for the types contained.
3384  */
3385 typedef struct LDKC2Tuple__u168_u168Z {
3386    /**
3387     * The element at position 0
3388     */
3389    struct LDKEightU16s a;
3390    /**
3391     * The element at position 1
3392     */
3393    struct LDKEightU16s b;
3394 } LDKC2Tuple__u168_u168Z;
3395
3396 /**
3397  * An enum which can either contain a crate::c_types::derived::C2Tuple__u168_u168Z or not
3398  */
3399 typedef enum LDKCOption_C2Tuple_EightU16sEightU16sZZ_Tag {
3400    /**
3401     * When we're in this state, this COption_C2Tuple_EightU16sEightU16sZZ contains a crate::c_types::derived::C2Tuple__u168_u168Z
3402     */
3403    LDKCOption_C2Tuple_EightU16sEightU16sZZ_Some,
3404    /**
3405     * When we're in this state, this COption_C2Tuple_EightU16sEightU16sZZ contains nothing
3406     */
3407    LDKCOption_C2Tuple_EightU16sEightU16sZZ_None,
3408    /**
3409     * Must be last for serialization purposes
3410     */
3411    LDKCOption_C2Tuple_EightU16sEightU16sZZ_Sentinel,
3412 } LDKCOption_C2Tuple_EightU16sEightU16sZZ_Tag;
3413
3414 typedef struct LDKCOption_C2Tuple_EightU16sEightU16sZZ {
3415    LDKCOption_C2Tuple_EightU16sEightU16sZZ_Tag tag;
3416    union {
3417       struct {
3418          struct LDKC2Tuple__u168_u168Z some;
3419       };
3420    };
3421 } LDKCOption_C2Tuple_EightU16sEightU16sZZ;
3422
3423 /**
3424  * A dynamically-allocated array of crate::lightning::routing::gossip::NodeIds of arbitrary size.
3425  * This corresponds to std::vector in C++
3426  */
3427 typedef struct LDKCVec_NodeIdZ {
3428    /**
3429     * The elements in the array.
3430     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3431     */
3432    struct LDKNodeId *data;
3433    /**
3434     * The number of elements pointed to by `data`.
3435     */
3436    uintptr_t datalen;
3437 } LDKCVec_NodeIdZ;
3438
3439
3440
3441 /**
3442  * A Record, unit of logging output with Metadata to enable filtering
3443  * Module_path, file, line to inform on log's source
3444  */
3445 typedef struct MUST_USE_STRUCT LDKRecord {
3446    /**
3447     * A pointer to the opaque Rust object.
3448     * Nearly everywhere, inner must be non-null, however in places where
3449     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3450     */
3451    LDKnativeRecord *inner;
3452    /**
3453     * Indicates that this is the only struct which contains the same pointer.
3454     * Rust functions which take ownership of an object provided via an argument require
3455     * this to be true and invalidate the object pointed to by inner.
3456     */
3457    bool is_owned;
3458 } LDKRecord;
3459
3460 /**
3461  * A trait encapsulating the operations required of a logger
3462  */
3463 typedef struct LDKLogger {
3464    /**
3465     * An opaque pointer which is passed to your function implementations as an argument.
3466     * This has no meaning in the LDK, and can be NULL or any other value.
3467     */
3468    void *this_arg;
3469    /**
3470     * Logs the `Record`
3471     */
3472    void (*log)(const void *this_arg, const struct LDKRecord *NONNULL_PTR record);
3473    /**
3474     * Frees any resources associated with this object given its this_arg pointer.
3475     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
3476     */
3477    void (*free)(void *this_arg);
3478 } LDKLogger;
3479
3480
3481
3482 /**
3483  * Represents the network as nodes and channels between them
3484  */
3485 typedef struct MUST_USE_STRUCT LDKNetworkGraph {
3486    /**
3487     * A pointer to the opaque Rust object.
3488     * Nearly everywhere, inner must be non-null, however in places where
3489     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3490     */
3491    LDKnativeNetworkGraph *inner;
3492    /**
3493     * Indicates that this is the only struct which contains the same pointer.
3494     * Rust functions which take ownership of an object provided via an argument require
3495     * this to be true and invalidate the object pointed to by inner.
3496     */
3497    bool is_owned;
3498 } LDKNetworkGraph;
3499
3500
3501
3502 /**
3503  * [`Score`] implementation using channel success probability distributions.
3504  *
3505  * Channels are tracked with upper and lower liquidity bounds - when an HTLC fails at a channel,
3506  * we learn that the upper-bound on the available liquidity is lower than the amount of the HTLC.
3507  * When a payment is forwarded through a channel (but fails later in the route), we learn the
3508  * lower-bound on the channel's available liquidity must be at least the value of the HTLC.
3509  *
3510  * These bounds are then used to determine a success probability using the formula from
3511  * *Optimally Reliable & Cheap Payment Flows on the Lightning Network* by Rene Pickhardt
3512  * and Stefan Richter [[1]] (i.e. `(upper_bound - payment_amount) / (upper_bound - lower_bound)`).
3513  *
3514  * This probability is combined with the [`liquidity_penalty_multiplier_msat`] and
3515  * [`liquidity_penalty_amount_multiplier_msat`] parameters to calculate a concrete penalty in
3516  * milli-satoshis. The penalties, when added across all hops, have the property of being linear in
3517  * terms of the entire path's success probability. This allows the router to directly compare
3518  * penalties for different paths. See the documentation of those parameters for the exact formulas.
3519  *
3520  * The liquidity bounds are decayed by halving them every [`liquidity_offset_half_life`].
3521  *
3522  * Further, we track the history of our upper and lower liquidity bounds for each channel,
3523  * allowing us to assign a second penalty (using [`historical_liquidity_penalty_multiplier_msat`]
3524  * and [`historical_liquidity_penalty_amount_multiplier_msat`]) based on the same probability
3525  * formula, but using the history of a channel rather than our latest estimates for the liquidity
3526  * bounds.
3527  *
3528  * # Note
3529  *
3530  * Mixing the `no-std` feature between serialization and deserialization results in undefined
3531  * behavior.
3532  *
3533  * [1]: https://arxiv.org/abs/2107.05322
3534  * [`liquidity_penalty_multiplier_msat`]: ProbabilisticScoringParameters::liquidity_penalty_multiplier_msat
3535  * [`liquidity_penalty_amount_multiplier_msat`]: ProbabilisticScoringParameters::liquidity_penalty_amount_multiplier_msat
3536  * [`liquidity_offset_half_life`]: ProbabilisticScoringParameters::liquidity_offset_half_life
3537  * [`historical_liquidity_penalty_multiplier_msat`]: ProbabilisticScoringParameters::historical_liquidity_penalty_multiplier_msat
3538  * [`historical_liquidity_penalty_amount_multiplier_msat`]: ProbabilisticScoringParameters::historical_liquidity_penalty_amount_multiplier_msat
3539  */
3540 typedef struct MUST_USE_STRUCT LDKProbabilisticScorer {
3541    /**
3542     * A pointer to the opaque Rust object.
3543     * Nearly everywhere, inner must be non-null, however in places where
3544     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3545     */
3546    LDKnativeProbabilisticScorer *inner;
3547    /**
3548     * Indicates that this is the only struct which contains the same pointer.
3549     * Rust functions which take ownership of an object provided via an argument require
3550     * this to be true and invalidate the object pointed to by inner.
3551     */
3552    bool is_owned;
3553 } LDKProbabilisticScorer;
3554
3555 /**
3556  * The contents of CResult_ProbabilisticScorerDecodeErrorZ
3557  */
3558 typedef union LDKCResult_ProbabilisticScorerDecodeErrorZPtr {
3559    /**
3560     * A pointer to the contents in the success state.
3561     * Reading from this pointer when `result_ok` is not set is undefined.
3562     */
3563    struct LDKProbabilisticScorer *result;
3564    /**
3565     * A pointer to the contents in the error state.
3566     * Reading from this pointer when `result_ok` is set is undefined.
3567     */
3568    struct LDKDecodeError *err;
3569 } LDKCResult_ProbabilisticScorerDecodeErrorZPtr;
3570
3571 /**
3572  * A CResult_ProbabilisticScorerDecodeErrorZ represents the result of a fallible operation,
3573  * containing a crate::lightning::routing::scoring::ProbabilisticScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
3574  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3575  */
3576 typedef struct LDKCResult_ProbabilisticScorerDecodeErrorZ {
3577    /**
3578     * The contents of this CResult_ProbabilisticScorerDecodeErrorZ, accessible via either
3579     * `err` or `result` depending on the state of `result_ok`.
3580     */
3581    union LDKCResult_ProbabilisticScorerDecodeErrorZPtr contents;
3582    /**
3583     * Whether this CResult_ProbabilisticScorerDecodeErrorZ represents a success state.
3584     */
3585    bool result_ok;
3586 } LDKCResult_ProbabilisticScorerDecodeErrorZ;
3587
3588
3589
3590 /**
3591  * Features used within an `init` message.
3592  */
3593 typedef struct MUST_USE_STRUCT LDKInitFeatures {
3594    /**
3595     * A pointer to the opaque Rust object.
3596     * Nearly everywhere, inner must be non-null, however in places where
3597     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3598     */
3599    LDKnativeInitFeatures *inner;
3600    /**
3601     * Indicates that this is the only struct which contains the same pointer.
3602     * Rust functions which take ownership of an object provided via an argument require
3603     * this to be true and invalidate the object pointed to by inner.
3604     */
3605    bool is_owned;
3606 } LDKInitFeatures;
3607
3608 /**
3609  * The contents of CResult_InitFeaturesDecodeErrorZ
3610  */
3611 typedef union LDKCResult_InitFeaturesDecodeErrorZPtr {
3612    /**
3613     * A pointer to the contents in the success state.
3614     * Reading from this pointer when `result_ok` is not set is undefined.
3615     */
3616    struct LDKInitFeatures *result;
3617    /**
3618     * A pointer to the contents in the error state.
3619     * Reading from this pointer when `result_ok` is set is undefined.
3620     */
3621    struct LDKDecodeError *err;
3622 } LDKCResult_InitFeaturesDecodeErrorZPtr;
3623
3624 /**
3625  * A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
3626  * containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
3627  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3628  */
3629 typedef struct LDKCResult_InitFeaturesDecodeErrorZ {
3630    /**
3631     * The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
3632     * `err` or `result` depending on the state of `result_ok`.
3633     */
3634    union LDKCResult_InitFeaturesDecodeErrorZPtr contents;
3635    /**
3636     * Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
3637     */
3638    bool result_ok;
3639 } LDKCResult_InitFeaturesDecodeErrorZ;
3640
3641
3642
3643 /**
3644  * Features used within a `channel_announcement` message.
3645  */
3646 typedef struct MUST_USE_STRUCT LDKChannelFeatures {
3647    /**
3648     * A pointer to the opaque Rust object.
3649     * Nearly everywhere, inner must be non-null, however in places where
3650     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3651     */
3652    LDKnativeChannelFeatures *inner;
3653    /**
3654     * Indicates that this is the only struct which contains the same pointer.
3655     * Rust functions which take ownership of an object provided via an argument require
3656     * this to be true and invalidate the object pointed to by inner.
3657     */
3658    bool is_owned;
3659 } LDKChannelFeatures;
3660
3661 /**
3662  * The contents of CResult_ChannelFeaturesDecodeErrorZ
3663  */
3664 typedef union LDKCResult_ChannelFeaturesDecodeErrorZPtr {
3665    /**
3666     * A pointer to the contents in the success state.
3667     * Reading from this pointer when `result_ok` is not set is undefined.
3668     */
3669    struct LDKChannelFeatures *result;
3670    /**
3671     * A pointer to the contents in the error state.
3672     * Reading from this pointer when `result_ok` is set is undefined.
3673     */
3674    struct LDKDecodeError *err;
3675 } LDKCResult_ChannelFeaturesDecodeErrorZPtr;
3676
3677 /**
3678  * A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
3679  * containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
3680  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3681  */
3682 typedef struct LDKCResult_ChannelFeaturesDecodeErrorZ {
3683    /**
3684     * The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
3685     * `err` or `result` depending on the state of `result_ok`.
3686     */
3687    union LDKCResult_ChannelFeaturesDecodeErrorZPtr contents;
3688    /**
3689     * Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
3690     */
3691    bool result_ok;
3692 } LDKCResult_ChannelFeaturesDecodeErrorZ;
3693
3694
3695
3696 /**
3697  * Features used within a `node_announcement` message.
3698  */
3699 typedef struct MUST_USE_STRUCT LDKNodeFeatures {
3700    /**
3701     * A pointer to the opaque Rust object.
3702     * Nearly everywhere, inner must be non-null, however in places where
3703     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3704     */
3705    LDKnativeNodeFeatures *inner;
3706    /**
3707     * Indicates that this is the only struct which contains the same pointer.
3708     * Rust functions which take ownership of an object provided via an argument require
3709     * this to be true and invalidate the object pointed to by inner.
3710     */
3711    bool is_owned;
3712 } LDKNodeFeatures;
3713
3714 /**
3715  * The contents of CResult_NodeFeaturesDecodeErrorZ
3716  */
3717 typedef union LDKCResult_NodeFeaturesDecodeErrorZPtr {
3718    /**
3719     * A pointer to the contents in the success state.
3720     * Reading from this pointer when `result_ok` is not set is undefined.
3721     */
3722    struct LDKNodeFeatures *result;
3723    /**
3724     * A pointer to the contents in the error state.
3725     * Reading from this pointer when `result_ok` is set is undefined.
3726     */
3727    struct LDKDecodeError *err;
3728 } LDKCResult_NodeFeaturesDecodeErrorZPtr;
3729
3730 /**
3731  * A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
3732  * containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
3733  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3734  */
3735 typedef struct LDKCResult_NodeFeaturesDecodeErrorZ {
3736    /**
3737     * The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
3738     * `err` or `result` depending on the state of `result_ok`.
3739     */
3740    union LDKCResult_NodeFeaturesDecodeErrorZPtr contents;
3741    /**
3742     * Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
3743     */
3744    bool result_ok;
3745 } LDKCResult_NodeFeaturesDecodeErrorZ;
3746
3747
3748
3749 /**
3750  * Features used within an invoice.
3751  */
3752 typedef struct MUST_USE_STRUCT LDKInvoiceFeatures {
3753    /**
3754     * A pointer to the opaque Rust object.
3755     * Nearly everywhere, inner must be non-null, however in places where
3756     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3757     */
3758    LDKnativeInvoiceFeatures *inner;
3759    /**
3760     * Indicates that this is the only struct which contains the same pointer.
3761     * Rust functions which take ownership of an object provided via an argument require
3762     * this to be true and invalidate the object pointed to by inner.
3763     */
3764    bool is_owned;
3765 } LDKInvoiceFeatures;
3766
3767 /**
3768  * The contents of CResult_InvoiceFeaturesDecodeErrorZ
3769  */
3770 typedef union LDKCResult_InvoiceFeaturesDecodeErrorZPtr {
3771    /**
3772     * A pointer to the contents in the success state.
3773     * Reading from this pointer when `result_ok` is not set is undefined.
3774     */
3775    struct LDKInvoiceFeatures *result;
3776    /**
3777     * A pointer to the contents in the error state.
3778     * Reading from this pointer when `result_ok` is set is undefined.
3779     */
3780    struct LDKDecodeError *err;
3781 } LDKCResult_InvoiceFeaturesDecodeErrorZPtr;
3782
3783 /**
3784  * A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
3785  * containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
3786  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3787  */
3788 typedef struct LDKCResult_InvoiceFeaturesDecodeErrorZ {
3789    /**
3790     * The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
3791     * `err` or `result` depending on the state of `result_ok`.
3792     */
3793    union LDKCResult_InvoiceFeaturesDecodeErrorZPtr contents;
3794    /**
3795     * Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
3796     */
3797    bool result_ok;
3798 } LDKCResult_InvoiceFeaturesDecodeErrorZ;
3799
3800
3801
3802 /**
3803  * Features used within BOLT 4 encrypted_data_tlv and BOLT 12 blinded_payinfo
3804  */
3805 typedef struct MUST_USE_STRUCT LDKBlindedHopFeatures {
3806    /**
3807     * A pointer to the opaque Rust object.
3808     * Nearly everywhere, inner must be non-null, however in places where
3809     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3810     */
3811    LDKnativeBlindedHopFeatures *inner;
3812    /**
3813     * Indicates that this is the only struct which contains the same pointer.
3814     * Rust functions which take ownership of an object provided via an argument require
3815     * this to be true and invalidate the object pointed to by inner.
3816     */
3817    bool is_owned;
3818 } LDKBlindedHopFeatures;
3819
3820 /**
3821  * The contents of CResult_BlindedHopFeaturesDecodeErrorZ
3822  */
3823 typedef union LDKCResult_BlindedHopFeaturesDecodeErrorZPtr {
3824    /**
3825     * A pointer to the contents in the success state.
3826     * Reading from this pointer when `result_ok` is not set is undefined.
3827     */
3828    struct LDKBlindedHopFeatures *result;
3829    /**
3830     * A pointer to the contents in the error state.
3831     * Reading from this pointer when `result_ok` is set is undefined.
3832     */
3833    struct LDKDecodeError *err;
3834 } LDKCResult_BlindedHopFeaturesDecodeErrorZPtr;
3835
3836 /**
3837  * A CResult_BlindedHopFeaturesDecodeErrorZ represents the result of a fallible operation,
3838  * containing a crate::lightning::ln::features::BlindedHopFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
3839  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3840  */
3841 typedef struct LDKCResult_BlindedHopFeaturesDecodeErrorZ {
3842    /**
3843     * The contents of this CResult_BlindedHopFeaturesDecodeErrorZ, accessible via either
3844     * `err` or `result` depending on the state of `result_ok`.
3845     */
3846    union LDKCResult_BlindedHopFeaturesDecodeErrorZPtr contents;
3847    /**
3848     * Whether this CResult_BlindedHopFeaturesDecodeErrorZ represents a success state.
3849     */
3850    bool result_ok;
3851 } LDKCResult_BlindedHopFeaturesDecodeErrorZ;
3852
3853
3854
3855 /**
3856  * Features used within the channel_type field in an OpenChannel message.
3857  *
3858  * A channel is always of some known \"type\", describing the transaction formats used and the exact
3859  * semantics of our interaction with our peer.
3860  *
3861  * Note that because a channel is a specific type which is proposed by the opener and accepted by
3862  * the counterparty, only required features are allowed here.
3863  *
3864  * This is serialized differently from other feature types - it is not prefixed by a length, and
3865  * thus must only appear inside a TLV where its length is known in advance.
3866  */
3867 typedef struct MUST_USE_STRUCT LDKChannelTypeFeatures {
3868    /**
3869     * A pointer to the opaque Rust object.
3870     * Nearly everywhere, inner must be non-null, however in places where
3871     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3872     */
3873    LDKnativeChannelTypeFeatures *inner;
3874    /**
3875     * Indicates that this is the only struct which contains the same pointer.
3876     * Rust functions which take ownership of an object provided via an argument require
3877     * this to be true and invalidate the object pointed to by inner.
3878     */
3879    bool is_owned;
3880 } LDKChannelTypeFeatures;
3881
3882 /**
3883  * The contents of CResult_ChannelTypeFeaturesDecodeErrorZ
3884  */
3885 typedef union LDKCResult_ChannelTypeFeaturesDecodeErrorZPtr {
3886    /**
3887     * A pointer to the contents in the success state.
3888     * Reading from this pointer when `result_ok` is not set is undefined.
3889     */
3890    struct LDKChannelTypeFeatures *result;
3891    /**
3892     * A pointer to the contents in the error state.
3893     * Reading from this pointer when `result_ok` is set is undefined.
3894     */
3895    struct LDKDecodeError *err;
3896 } LDKCResult_ChannelTypeFeaturesDecodeErrorZPtr;
3897
3898 /**
3899  * A CResult_ChannelTypeFeaturesDecodeErrorZ represents the result of a fallible operation,
3900  * containing a crate::lightning::ln::features::ChannelTypeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
3901  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3902  */
3903 typedef struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ {
3904    /**
3905     * The contents of this CResult_ChannelTypeFeaturesDecodeErrorZ, accessible via either
3906     * `err` or `result` depending on the state of `result_ok`.
3907     */
3908    union LDKCResult_ChannelTypeFeaturesDecodeErrorZPtr contents;
3909    /**
3910     * Whether this CResult_ChannelTypeFeaturesDecodeErrorZ represents a success state.
3911     */
3912    bool result_ok;
3913 } LDKCResult_ChannelTypeFeaturesDecodeErrorZ;
3914
3915 /**
3916  * Some information provided on receipt of payment depends on whether the payment received is a
3917  * spontaneous payment or a \"conventional\" lightning payment that's paying an invoice.
3918  */
3919 typedef enum LDKPaymentPurpose_Tag {
3920    /**
3921     * Information for receiving a payment that we generated an invoice for.
3922     */
3923    LDKPaymentPurpose_InvoicePayment,
3924    /**
3925     * Because this is a spontaneous payment, the payer generated their own preimage rather than us
3926     * (the payee) providing a preimage.
3927     */
3928    LDKPaymentPurpose_SpontaneousPayment,
3929    /**
3930     * Must be last for serialization purposes
3931     */
3932    LDKPaymentPurpose_Sentinel,
3933 } LDKPaymentPurpose_Tag;
3934
3935 typedef struct LDKPaymentPurpose_LDKInvoicePayment_Body {
3936    /**
3937     * The preimage to the payment_hash, if the payment hash (and secret) were fetched via
3938     * [`ChannelManager::create_inbound_payment`]. If provided, this can be handed directly to
3939     * [`ChannelManager::claim_funds`].
3940     *
3941     * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
3942     * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
3943     *
3944     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
3945     */
3946    struct LDKThirtyTwoBytes payment_preimage;
3947    /**
3948     * The \"payment secret\". This authenticates the sender to the recipient, preventing a
3949     * number of deanonymization attacks during the routing process.
3950     * It is provided here for your reference, however its accuracy is enforced directly by
3951     * [`ChannelManager`] using the values you previously provided to
3952     * [`ChannelManager::create_inbound_payment`] or
3953     * [`ChannelManager::create_inbound_payment_for_hash`].
3954     *
3955     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
3956     * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
3957     * [`ChannelManager::create_inbound_payment_for_hash`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
3958     */
3959    struct LDKThirtyTwoBytes payment_secret;
3960 } LDKPaymentPurpose_LDKInvoicePayment_Body;
3961
3962 typedef struct MUST_USE_STRUCT LDKPaymentPurpose {
3963    LDKPaymentPurpose_Tag tag;
3964    union {
3965       LDKPaymentPurpose_LDKInvoicePayment_Body invoice_payment;
3966       struct {
3967          struct LDKThirtyTwoBytes spontaneous_payment;
3968       };
3969    };
3970 } LDKPaymentPurpose;
3971
3972 /**
3973  * The contents of CResult_PaymentPurposeDecodeErrorZ
3974  */
3975 typedef union LDKCResult_PaymentPurposeDecodeErrorZPtr {
3976    /**
3977     * A pointer to the contents in the success state.
3978     * Reading from this pointer when `result_ok` is not set is undefined.
3979     */
3980    struct LDKPaymentPurpose *result;
3981    /**
3982     * A pointer to the contents in the error state.
3983     * Reading from this pointer when `result_ok` is set is undefined.
3984     */
3985    struct LDKDecodeError *err;
3986 } LDKCResult_PaymentPurposeDecodeErrorZPtr;
3987
3988 /**
3989  * A CResult_PaymentPurposeDecodeErrorZ represents the result of a fallible operation,
3990  * containing a crate::lightning::events::PaymentPurpose on success and a crate::lightning::ln::msgs::DecodeError on failure.
3991  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3992  */
3993 typedef struct LDKCResult_PaymentPurposeDecodeErrorZ {
3994    /**
3995     * The contents of this CResult_PaymentPurposeDecodeErrorZ, accessible via either
3996     * `err` or `result` depending on the state of `result_ok`.
3997     */
3998    union LDKCResult_PaymentPurposeDecodeErrorZPtr contents;
3999    /**
4000     * Whether this CResult_PaymentPurposeDecodeErrorZ represents a success state.
4001     */
4002    bool result_ok;
4003 } LDKCResult_PaymentPurposeDecodeErrorZ;
4004
4005
4006
4007 /**
4008  * A [`channel_update`] message to be sent to or received from a peer.
4009  *
4010  * [`channel_update`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-channel_update-message
4011  */
4012 typedef struct MUST_USE_STRUCT LDKChannelUpdate {
4013    /**
4014     * A pointer to the opaque Rust object.
4015     * Nearly everywhere, inner must be non-null, however in places where
4016     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4017     */
4018    LDKnativeChannelUpdate *inner;
4019    /**
4020     * Indicates that this is the only struct which contains the same pointer.
4021     * Rust functions which take ownership of an object provided via an argument require
4022     * this to be true and invalidate the object pointed to by inner.
4023     */
4024    bool is_owned;
4025 } LDKChannelUpdate;
4026
4027 /**
4028  * Update to the [`NetworkGraph`] based on payment failure information conveyed via the Onion
4029  * return packet by a node along the route. See [BOLT #4] for details.
4030  *
4031  * [BOLT #4]: https://github.com/lightning/bolts/blob/master/04-onion-routing.md
4032  */
4033 typedef enum LDKNetworkUpdate_Tag {
4034    /**
4035     * An error indicating a `channel_update` messages should be applied via
4036     * [`NetworkGraph::update_channel`].
4037     */
4038    LDKNetworkUpdate_ChannelUpdateMessage,
4039    /**
4040     * An error indicating that a channel failed to route a payment, which should be applied via
4041     * [`NetworkGraph::channel_failed_permanent`] if permanent.
4042     */
4043    LDKNetworkUpdate_ChannelFailure,
4044    /**
4045     * An error indicating that a node failed to route a payment, which should be applied via
4046     * [`NetworkGraph::node_failed_permanent`] if permanent.
4047     */
4048    LDKNetworkUpdate_NodeFailure,
4049    /**
4050     * Must be last for serialization purposes
4051     */
4052    LDKNetworkUpdate_Sentinel,
4053 } LDKNetworkUpdate_Tag;
4054
4055 typedef struct LDKNetworkUpdate_LDKChannelUpdateMessage_Body {
4056    /**
4057     * The update to apply via [`NetworkGraph::update_channel`].
4058     */
4059    struct LDKChannelUpdate msg;
4060 } LDKNetworkUpdate_LDKChannelUpdateMessage_Body;
4061
4062 typedef struct LDKNetworkUpdate_LDKChannelFailure_Body {
4063    /**
4064     * The short channel id of the closed channel.
4065     */
4066    uint64_t short_channel_id;
4067    /**
4068     * Whether the channel should be permanently removed or temporarily disabled until a new
4069     * `channel_update` message is received.
4070     */
4071    bool is_permanent;
4072 } LDKNetworkUpdate_LDKChannelFailure_Body;
4073
4074 typedef struct LDKNetworkUpdate_LDKNodeFailure_Body {
4075    /**
4076     * The node id of the failed node.
4077     */
4078    struct LDKPublicKey node_id;
4079    /**
4080     * Whether the node should be permanently removed from consideration or can be restored
4081     * when a new `channel_update` message is received.
4082     */
4083    bool is_permanent;
4084 } LDKNetworkUpdate_LDKNodeFailure_Body;
4085
4086 typedef struct MUST_USE_STRUCT LDKNetworkUpdate {
4087    LDKNetworkUpdate_Tag tag;
4088    union {
4089       LDKNetworkUpdate_LDKChannelUpdateMessage_Body channel_update_message;
4090       LDKNetworkUpdate_LDKChannelFailure_Body channel_failure;
4091       LDKNetworkUpdate_LDKNodeFailure_Body node_failure;
4092    };
4093 } LDKNetworkUpdate;
4094
4095 /**
4096  * An enum which can either contain a crate::lightning::routing::gossip::NetworkUpdate or not
4097  */
4098 typedef enum LDKCOption_NetworkUpdateZ_Tag {
4099    /**
4100     * When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::gossip::NetworkUpdate
4101     */
4102    LDKCOption_NetworkUpdateZ_Some,
4103    /**
4104     * When we're in this state, this COption_NetworkUpdateZ contains nothing
4105     */
4106    LDKCOption_NetworkUpdateZ_None,
4107    /**
4108     * Must be last for serialization purposes
4109     */
4110    LDKCOption_NetworkUpdateZ_Sentinel,
4111 } LDKCOption_NetworkUpdateZ_Tag;
4112
4113 typedef struct LDKCOption_NetworkUpdateZ {
4114    LDKCOption_NetworkUpdateZ_Tag tag;
4115    union {
4116       struct {
4117          struct LDKNetworkUpdate some;
4118       };
4119    };
4120 } LDKCOption_NetworkUpdateZ;
4121
4122 /**
4123  * When the payment path failure took place and extra details about it. [`PathFailure::OnPath`] may
4124  * contain a [`NetworkUpdate`] that needs to be applied to the [`NetworkGraph`].
4125  *
4126  * [`NetworkUpdate`]: crate::routing::gossip::NetworkUpdate
4127  * [`NetworkGraph`]: crate::routing::gossip::NetworkGraph
4128  */
4129 typedef enum LDKPathFailure_Tag {
4130    /**
4131     * We failed to initially send the payment and no HTLC was committed to. Contains the relevant
4132     * error.
4133     */
4134    LDKPathFailure_InitialSend,
4135    /**
4136     * A hop on the path failed to forward our payment.
4137     */
4138    LDKPathFailure_OnPath,
4139    /**
4140     * Must be last for serialization purposes
4141     */
4142    LDKPathFailure_Sentinel,
4143 } LDKPathFailure_Tag;
4144
4145 typedef struct LDKPathFailure_LDKInitialSend_Body {
4146    /**
4147     * The error surfaced from initial send.
4148     */
4149    struct LDKAPIError err;
4150 } LDKPathFailure_LDKInitialSend_Body;
4151
4152 typedef struct LDKPathFailure_LDKOnPath_Body {
4153    /**
4154     * If present, this [`NetworkUpdate`] should be applied to the [`NetworkGraph`] so that routing
4155     * decisions can take into account the update.
4156     *
4157     * [`NetworkUpdate`]: crate::routing::gossip::NetworkUpdate
4158     * [`NetworkGraph`]: crate::routing::gossip::NetworkGraph
4159     */
4160    struct LDKCOption_NetworkUpdateZ network_update;
4161 } LDKPathFailure_LDKOnPath_Body;
4162
4163 typedef struct MUST_USE_STRUCT LDKPathFailure {
4164    LDKPathFailure_Tag tag;
4165    union {
4166       LDKPathFailure_LDKInitialSend_Body initial_send;
4167       LDKPathFailure_LDKOnPath_Body on_path;
4168    };
4169 } LDKPathFailure;
4170
4171 /**
4172  * An enum which can either contain a crate::lightning::events::PathFailure or not
4173  */
4174 typedef enum LDKCOption_PathFailureZ_Tag {
4175    /**
4176     * When we're in this state, this COption_PathFailureZ contains a crate::lightning::events::PathFailure
4177     */
4178    LDKCOption_PathFailureZ_Some,
4179    /**
4180     * When we're in this state, this COption_PathFailureZ contains nothing
4181     */
4182    LDKCOption_PathFailureZ_None,
4183    /**
4184     * Must be last for serialization purposes
4185     */
4186    LDKCOption_PathFailureZ_Sentinel,
4187 } LDKCOption_PathFailureZ_Tag;
4188
4189 typedef struct LDKCOption_PathFailureZ {
4190    LDKCOption_PathFailureZ_Tag tag;
4191    union {
4192       struct {
4193          struct LDKPathFailure some;
4194       };
4195    };
4196 } LDKCOption_PathFailureZ;
4197
4198 /**
4199  * The contents of CResult_COption_PathFailureZDecodeErrorZ
4200  */
4201 typedef union LDKCResult_COption_PathFailureZDecodeErrorZPtr {
4202    /**
4203     * A pointer to the contents in the success state.
4204     * Reading from this pointer when `result_ok` is not set is undefined.
4205     */
4206    struct LDKCOption_PathFailureZ *result;
4207    /**
4208     * A pointer to the contents in the error state.
4209     * Reading from this pointer when `result_ok` is set is undefined.
4210     */
4211    struct LDKDecodeError *err;
4212 } LDKCResult_COption_PathFailureZDecodeErrorZPtr;
4213
4214 /**
4215  * A CResult_COption_PathFailureZDecodeErrorZ represents the result of a fallible operation,
4216  * containing a crate::c_types::derived::COption_PathFailureZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
4217  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4218  */
4219 typedef struct LDKCResult_COption_PathFailureZDecodeErrorZ {
4220    /**
4221     * The contents of this CResult_COption_PathFailureZDecodeErrorZ, accessible via either
4222     * `err` or `result` depending on the state of `result_ok`.
4223     */
4224    union LDKCResult_COption_PathFailureZDecodeErrorZPtr contents;
4225    /**
4226     * Whether this CResult_COption_PathFailureZDecodeErrorZ represents a success state.
4227     */
4228    bool result_ok;
4229 } LDKCResult_COption_PathFailureZDecodeErrorZ;
4230
4231
4232
4233 /**
4234  * Struct to `Display` fields in a safe way using `PrintableString`
4235  */
4236 typedef struct MUST_USE_STRUCT LDKUntrustedString {
4237    /**
4238     * A pointer to the opaque Rust object.
4239     * Nearly everywhere, inner must be non-null, however in places where
4240     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4241     */
4242    LDKnativeUntrustedString *inner;
4243    /**
4244     * Indicates that this is the only struct which contains the same pointer.
4245     * Rust functions which take ownership of an object provided via an argument require
4246     * this to be true and invalidate the object pointed to by inner.
4247     */
4248    bool is_owned;
4249 } LDKUntrustedString;
4250
4251 /**
4252  * The reason the channel was closed. See individual variants more details.
4253  */
4254 typedef enum LDKClosureReason_Tag {
4255    /**
4256     * Closure generated from receiving a peer error message.
4257     *
4258     * Our counterparty may have broadcasted their latest commitment state, and we have
4259     * as well.
4260     */
4261    LDKClosureReason_CounterpartyForceClosed,
4262    /**
4263     * Closure generated from [`ChannelManager::force_close_channel`], called by the user.
4264     *
4265     * [`ChannelManager::force_close_channel`]: crate::ln::channelmanager::ChannelManager::force_close_channel.
4266     */
4267    LDKClosureReason_HolderForceClosed,
4268    /**
4269     * The channel was closed after negotiating a cooperative close and we've now broadcasted
4270     * the cooperative close transaction. Note the shutdown may have been initiated by us.
4271     */
4272    LDKClosureReason_CooperativeClosure,
4273    /**
4274     * A commitment transaction was confirmed on chain, closing the channel. Most likely this
4275     * commitment transaction came from our counterparty, but it may also have come from
4276     * a copy of our own `ChannelMonitor`.
4277     */
4278    LDKClosureReason_CommitmentTxConfirmed,
4279    /**
4280     * The funding transaction failed to confirm in a timely manner on an inbound channel.
4281     */
4282    LDKClosureReason_FundingTimedOut,
4283    /**
4284     * Closure generated from processing an event, likely a HTLC forward/relay/reception.
4285     */
4286    LDKClosureReason_ProcessingError,
4287    /**
4288     * The peer disconnected prior to funding completing. In this case the spec mandates that we
4289     * forget the channel entirely - we can attempt again if the peer reconnects.
4290     *
4291     * This includes cases where we restarted prior to funding completion, including prior to the
4292     * initial [`ChannelMonitor`] persistence completing.
4293     *
4294     * In LDK versions prior to 0.0.107 this could also occur if we were unable to connect to the
4295     * peer because of mutual incompatibility between us and our channel counterparty.
4296     *
4297     * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor
4298     */
4299    LDKClosureReason_DisconnectedPeer,
4300    /**
4301     * Closure generated from `ChannelManager::read` if the [`ChannelMonitor`] is newer than
4302     * the [`ChannelManager`] deserialized.
4303     *
4304     * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor
4305     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
4306     */
4307    LDKClosureReason_OutdatedChannelManager,
4308    /**
4309     * Must be last for serialization purposes
4310     */
4311    LDKClosureReason_Sentinel,
4312 } LDKClosureReason_Tag;
4313
4314 typedef struct LDKClosureReason_LDKCounterpartyForceClosed_Body {
4315    /**
4316     * The error which the peer sent us.
4317     *
4318     * Be careful about printing the peer_msg, a well-crafted message could exploit
4319     * a security vulnerability in the terminal emulator or the logging subsystem.
4320     * To be safe, use `Display` on `UntrustedString`
4321     *
4322     * [`UntrustedString`]: crate::util::string::UntrustedString
4323     */
4324    struct LDKUntrustedString peer_msg;
4325 } LDKClosureReason_LDKCounterpartyForceClosed_Body;
4326
4327 typedef struct LDKClosureReason_LDKProcessingError_Body {
4328    /**
4329     * A developer-readable error message which we generated.
4330     */
4331    struct LDKStr err;
4332 } LDKClosureReason_LDKProcessingError_Body;
4333
4334 typedef struct MUST_USE_STRUCT LDKClosureReason {
4335    LDKClosureReason_Tag tag;
4336    union {
4337       LDKClosureReason_LDKCounterpartyForceClosed_Body counterparty_force_closed;
4338       LDKClosureReason_LDKProcessingError_Body processing_error;
4339    };
4340 } LDKClosureReason;
4341
4342 /**
4343  * An enum which can either contain a crate::lightning::events::ClosureReason or not
4344  */
4345 typedef enum LDKCOption_ClosureReasonZ_Tag {
4346    /**
4347     * When we're in this state, this COption_ClosureReasonZ contains a crate::lightning::events::ClosureReason
4348     */
4349    LDKCOption_ClosureReasonZ_Some,
4350    /**
4351     * When we're in this state, this COption_ClosureReasonZ contains nothing
4352     */
4353    LDKCOption_ClosureReasonZ_None,
4354    /**
4355     * Must be last for serialization purposes
4356     */
4357    LDKCOption_ClosureReasonZ_Sentinel,
4358 } LDKCOption_ClosureReasonZ_Tag;
4359
4360 typedef struct LDKCOption_ClosureReasonZ {
4361    LDKCOption_ClosureReasonZ_Tag tag;
4362    union {
4363       struct {
4364          struct LDKClosureReason some;
4365       };
4366    };
4367 } LDKCOption_ClosureReasonZ;
4368
4369 /**
4370  * The contents of CResult_COption_ClosureReasonZDecodeErrorZ
4371  */
4372 typedef union LDKCResult_COption_ClosureReasonZDecodeErrorZPtr {
4373    /**
4374     * A pointer to the contents in the success state.
4375     * Reading from this pointer when `result_ok` is not set is undefined.
4376     */
4377    struct LDKCOption_ClosureReasonZ *result;
4378    /**
4379     * A pointer to the contents in the error state.
4380     * Reading from this pointer when `result_ok` is set is undefined.
4381     */
4382    struct LDKDecodeError *err;
4383 } LDKCResult_COption_ClosureReasonZDecodeErrorZPtr;
4384
4385 /**
4386  * A CResult_COption_ClosureReasonZDecodeErrorZ represents the result of a fallible operation,
4387  * containing a crate::c_types::derived::COption_ClosureReasonZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
4388  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4389  */
4390 typedef struct LDKCResult_COption_ClosureReasonZDecodeErrorZ {
4391    /**
4392     * The contents of this CResult_COption_ClosureReasonZDecodeErrorZ, accessible via either
4393     * `err` or `result` depending on the state of `result_ok`.
4394     */
4395    union LDKCResult_COption_ClosureReasonZDecodeErrorZPtr contents;
4396    /**
4397     * Whether this CResult_COption_ClosureReasonZDecodeErrorZ represents a success state.
4398     */
4399    bool result_ok;
4400 } LDKCResult_COption_ClosureReasonZDecodeErrorZ;
4401
4402 /**
4403  * Intended destination of a failed HTLC as indicated in [`Event::HTLCHandlingFailed`].
4404  */
4405 typedef enum LDKHTLCDestination_Tag {
4406    /**
4407     * We tried forwarding to a channel but failed to do so. An example of such an instance is when
4408     * there is insufficient capacity in our outbound channel.
4409     */
4410    LDKHTLCDestination_NextHopChannel,
4411    /**
4412     * Scenario where we are unsure of the next node to forward the HTLC to.
4413     */
4414    LDKHTLCDestination_UnknownNextHop,
4415    /**
4416     * We couldn't forward to the outgoing scid. An example would be attempting to send a duplicate
4417     * intercept HTLC.
4418     */
4419    LDKHTLCDestination_InvalidForward,
4420    /**
4421     * Failure scenario where an HTLC may have been forwarded to be intended for us,
4422     * but is invalid for some reason, so we reject it.
4423     *
4424     * Some of the reasons may include:
4425     * * HTLC Timeouts
4426     * * Excess HTLCs for a payment that we have already fully received, over-paying for the
4427     *   payment,
4428     * * The counterparty node modified the HTLC in transit,
4429     * * A probing attack where an intermediary node is trying to detect if we are the ultimate
4430     *   recipient for a payment.
4431     */
4432    LDKHTLCDestination_FailedPayment,
4433    /**
4434     * Must be last for serialization purposes
4435     */
4436    LDKHTLCDestination_Sentinel,
4437 } LDKHTLCDestination_Tag;
4438
4439 typedef struct LDKHTLCDestination_LDKNextHopChannel_Body {
4440    /**
4441     * The `node_id` of the next node. For backwards compatibility, this field is
4442     * marked as optional, versions prior to 0.0.110 may not always be able to provide
4443     * counterparty node information.
4444     *
4445     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
4446     */
4447    struct LDKPublicKey node_id;
4448    /**
4449     * The outgoing `channel_id` between us and the next node.
4450     */
4451    struct LDKThirtyTwoBytes channel_id;
4452 } LDKHTLCDestination_LDKNextHopChannel_Body;
4453
4454 typedef struct LDKHTLCDestination_LDKUnknownNextHop_Body {
4455    /**
4456     * Short channel id we are requesting to forward an HTLC to.
4457     */
4458    uint64_t requested_forward_scid;
4459 } LDKHTLCDestination_LDKUnknownNextHop_Body;
4460
4461 typedef struct LDKHTLCDestination_LDKInvalidForward_Body {
4462    /**
4463     * Short channel id we are requesting to forward an HTLC to.
4464     */
4465    uint64_t requested_forward_scid;
4466 } LDKHTLCDestination_LDKInvalidForward_Body;
4467
4468 typedef struct LDKHTLCDestination_LDKFailedPayment_Body {
4469    /**
4470     * The payment hash of the payment we attempted to process.
4471     */
4472    struct LDKThirtyTwoBytes payment_hash;
4473 } LDKHTLCDestination_LDKFailedPayment_Body;
4474
4475 typedef struct MUST_USE_STRUCT LDKHTLCDestination {
4476    LDKHTLCDestination_Tag tag;
4477    union {
4478       LDKHTLCDestination_LDKNextHopChannel_Body next_hop_channel;
4479       LDKHTLCDestination_LDKUnknownNextHop_Body unknown_next_hop;
4480       LDKHTLCDestination_LDKInvalidForward_Body invalid_forward;
4481       LDKHTLCDestination_LDKFailedPayment_Body failed_payment;
4482    };
4483 } LDKHTLCDestination;
4484
4485 /**
4486  * An enum which can either contain a crate::lightning::events::HTLCDestination or not
4487  */
4488 typedef enum LDKCOption_HTLCDestinationZ_Tag {
4489    /**
4490     * When we're in this state, this COption_HTLCDestinationZ contains a crate::lightning::events::HTLCDestination
4491     */
4492    LDKCOption_HTLCDestinationZ_Some,
4493    /**
4494     * When we're in this state, this COption_HTLCDestinationZ contains nothing
4495     */
4496    LDKCOption_HTLCDestinationZ_None,
4497    /**
4498     * Must be last for serialization purposes
4499     */
4500    LDKCOption_HTLCDestinationZ_Sentinel,
4501 } LDKCOption_HTLCDestinationZ_Tag;
4502
4503 typedef struct LDKCOption_HTLCDestinationZ {
4504    LDKCOption_HTLCDestinationZ_Tag tag;
4505    union {
4506       struct {
4507          struct LDKHTLCDestination some;
4508       };
4509    };
4510 } LDKCOption_HTLCDestinationZ;
4511
4512 /**
4513  * The contents of CResult_COption_HTLCDestinationZDecodeErrorZ
4514  */
4515 typedef union LDKCResult_COption_HTLCDestinationZDecodeErrorZPtr {
4516    /**
4517     * A pointer to the contents in the success state.
4518     * Reading from this pointer when `result_ok` is not set is undefined.
4519     */
4520    struct LDKCOption_HTLCDestinationZ *result;
4521    /**
4522     * A pointer to the contents in the error state.
4523     * Reading from this pointer when `result_ok` is set is undefined.
4524     */
4525    struct LDKDecodeError *err;
4526 } LDKCResult_COption_HTLCDestinationZDecodeErrorZPtr;
4527
4528 /**
4529  * A CResult_COption_HTLCDestinationZDecodeErrorZ represents the result of a fallible operation,
4530  * containing a crate::c_types::derived::COption_HTLCDestinationZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
4531  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4532  */
4533 typedef struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ {
4534    /**
4535     * The contents of this CResult_COption_HTLCDestinationZDecodeErrorZ, accessible via either
4536     * `err` or `result` depending on the state of `result_ok`.
4537     */
4538    union LDKCResult_COption_HTLCDestinationZDecodeErrorZPtr contents;
4539    /**
4540     * Whether this CResult_COption_HTLCDestinationZDecodeErrorZ represents a success state.
4541     */
4542    bool result_ok;
4543 } LDKCResult_COption_HTLCDestinationZDecodeErrorZ;
4544
4545 /**
4546  * The contents of CResult_PaymentFailureReasonDecodeErrorZ
4547  */
4548 typedef union LDKCResult_PaymentFailureReasonDecodeErrorZPtr {
4549    /**
4550     * A pointer to the contents in the success state.
4551     * Reading from this pointer when `result_ok` is not set is undefined.
4552     */
4553    enum LDKPaymentFailureReason *result;
4554    /**
4555     * A pointer to the contents in the error state.
4556     * Reading from this pointer when `result_ok` is set is undefined.
4557     */
4558    struct LDKDecodeError *err;
4559 } LDKCResult_PaymentFailureReasonDecodeErrorZPtr;
4560
4561 /**
4562  * A CResult_PaymentFailureReasonDecodeErrorZ represents the result of a fallible operation,
4563  * containing a crate::lightning::events::PaymentFailureReason on success and a crate::lightning::ln::msgs::DecodeError on failure.
4564  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4565  */
4566 typedef struct LDKCResult_PaymentFailureReasonDecodeErrorZ {
4567    /**
4568     * The contents of this CResult_PaymentFailureReasonDecodeErrorZ, accessible via either
4569     * `err` or `result` depending on the state of `result_ok`.
4570     */
4571    union LDKCResult_PaymentFailureReasonDecodeErrorZPtr contents;
4572    /**
4573     * Whether this CResult_PaymentFailureReasonDecodeErrorZ represents a success state.
4574     */
4575    bool result_ok;
4576 } LDKCResult_PaymentFailureReasonDecodeErrorZ;
4577
4578 /**
4579  * An enum which can either contain a crate::c_types::U128 or not
4580  */
4581 typedef enum LDKCOption_u128Z_Tag {
4582    /**
4583     * When we're in this state, this COption_u128Z contains a crate::c_types::U128
4584     */
4585    LDKCOption_u128Z_Some,
4586    /**
4587     * When we're in this state, this COption_u128Z contains nothing
4588     */
4589    LDKCOption_u128Z_None,
4590    /**
4591     * Must be last for serialization purposes
4592     */
4593    LDKCOption_u128Z_Sentinel,
4594 } LDKCOption_u128Z_Tag;
4595
4596 typedef struct LDKCOption_u128Z {
4597    LDKCOption_u128Z_Tag tag;
4598    union {
4599       struct {
4600          struct LDKU128 some;
4601       };
4602    };
4603 } LDKCOption_u128Z;
4604
4605 /**
4606  * An enum which can either contain a crate::lightning::events::PaymentFailureReason or not
4607  */
4608 typedef enum LDKCOption_PaymentFailureReasonZ_Tag {
4609    /**
4610     * When we're in this state, this COption_PaymentFailureReasonZ contains a crate::lightning::events::PaymentFailureReason
4611     */
4612    LDKCOption_PaymentFailureReasonZ_Some,
4613    /**
4614     * When we're in this state, this COption_PaymentFailureReasonZ contains nothing
4615     */
4616    LDKCOption_PaymentFailureReasonZ_None,
4617    /**
4618     * Must be last for serialization purposes
4619     */
4620    LDKCOption_PaymentFailureReasonZ_Sentinel,
4621 } LDKCOption_PaymentFailureReasonZ_Tag;
4622
4623 typedef struct LDKCOption_PaymentFailureReasonZ {
4624    LDKCOption_PaymentFailureReasonZ_Tag tag;
4625    union {
4626       struct {
4627          enum LDKPaymentFailureReason some;
4628       };
4629    };
4630 } LDKCOption_PaymentFailureReasonZ;
4631
4632
4633
4634 /**
4635  * Information about a spendable output to a P2WSH script.
4636  *
4637  * See [`SpendableOutputDescriptor::DelayedPaymentOutput`] for more details on how to spend this.
4638  */
4639 typedef struct MUST_USE_STRUCT LDKDelayedPaymentOutputDescriptor {
4640    /**
4641     * A pointer to the opaque Rust object.
4642     * Nearly everywhere, inner must be non-null, however in places where
4643     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4644     */
4645    LDKnativeDelayedPaymentOutputDescriptor *inner;
4646    /**
4647     * Indicates that this is the only struct which contains the same pointer.
4648     * Rust functions which take ownership of an object provided via an argument require
4649     * this to be true and invalidate the object pointed to by inner.
4650     */
4651    bool is_owned;
4652 } LDKDelayedPaymentOutputDescriptor;
4653
4654
4655
4656 /**
4657  * Information about a spendable output to our \"payment key\".
4658  *
4659  * See [`SpendableOutputDescriptor::StaticPaymentOutput`] for more details on how to spend this.
4660  */
4661 typedef struct MUST_USE_STRUCT LDKStaticPaymentOutputDescriptor {
4662    /**
4663     * A pointer to the opaque Rust object.
4664     * Nearly everywhere, inner must be non-null, however in places where
4665     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4666     */
4667    LDKnativeStaticPaymentOutputDescriptor *inner;
4668    /**
4669     * Indicates that this is the only struct which contains the same pointer.
4670     * Rust functions which take ownership of an object provided via an argument require
4671     * this to be true and invalidate the object pointed to by inner.
4672     */
4673    bool is_owned;
4674 } LDKStaticPaymentOutputDescriptor;
4675
4676 /**
4677  * Describes the necessary information to spend a spendable output.
4678  *
4679  * When on-chain outputs are created by LDK (which our counterparty is not able to claim at any
4680  * point in the future) a [`SpendableOutputs`] event is generated which you must track and be able
4681  * to spend on-chain. The information needed to do this is provided in this enum, including the
4682  * outpoint describing which `txid` and output `index` is available, the full output which exists
4683  * at that `txid`/`index`, and any keys or other information required to sign.
4684  *
4685  * [`SpendableOutputs`]: crate::events::Event::SpendableOutputs
4686  */
4687 typedef enum LDKSpendableOutputDescriptor_Tag {
4688    /**
4689     * An output to a script which was provided via [`SignerProvider`] directly, either from
4690     * [`get_destination_script`] or [`get_shutdown_scriptpubkey`], thus you should already
4691     * know how to spend it. No secret keys are provided as LDK was never given any key.
4692     * These may include outputs from a transaction punishing our counterparty or claiming an HTLC
4693     * on-chain using the payment preimage or after it has timed out.
4694     *
4695     * [`get_shutdown_scriptpubkey`]: SignerProvider::get_shutdown_scriptpubkey
4696     * [`get_destination_script`]: SignerProvider::get_shutdown_scriptpubkey
4697     */
4698    LDKSpendableOutputDescriptor_StaticOutput,
4699    /**
4700     * An output to a P2WSH script which can be spent with a single signature after an `OP_CSV`
4701     * delay.
4702     *
4703     * The witness in the spending input should be:
4704     * ```bitcoin
4705     * <BIP 143 signature> <empty vector> (MINIMALIF standard rule) <provided witnessScript>
4706     * ```
4707     *
4708     * Note that the `nSequence` field in the spending input must be set to
4709     * [`DelayedPaymentOutputDescriptor::to_self_delay`] (which means the transaction is not
4710     * broadcastable until at least [`DelayedPaymentOutputDescriptor::to_self_delay`] blocks after
4711     * the outpoint confirms, see [BIP
4712     * 68](https://github.com/bitcoin/bips/blob/master/bip-0068.mediawiki)). Also note that LDK
4713     * won't generate a [`SpendableOutputDescriptor`] until the corresponding block height
4714     * is reached.
4715     *
4716     * These are generally the result of a \"revocable\" output to us, spendable only by us unless
4717     * it is an output from an old state which we broadcast (which should never happen).
4718     *
4719     * To derive the delayed payment key which is used to sign this input, you must pass the
4720     * holder [`InMemorySigner::delayed_payment_base_key`] (i.e., the private key which corresponds to the
4721     * [`ChannelPublicKeys::delayed_payment_basepoint`] in [`ChannelSigner::pubkeys`]) and the provided
4722     * [`DelayedPaymentOutputDescriptor::per_commitment_point`] to [`chan_utils::derive_private_key`]. The public key can be
4723     * generated without the secret key using [`chan_utils::derive_public_key`] and only the
4724     * [`ChannelPublicKeys::delayed_payment_basepoint`] which appears in [`ChannelSigner::pubkeys`].
4725     *
4726     * To derive the [`DelayedPaymentOutputDescriptor::revocation_pubkey`] provided here (which is
4727     * used in the witness script generation), you must pass the counterparty
4728     * [`ChannelPublicKeys::revocation_basepoint`] (which appears in the call to
4729     * [`ChannelSigner::provide_channel_parameters`]) and the provided
4730     * [`DelayedPaymentOutputDescriptor::per_commitment_point`] to
4731     * [`chan_utils::derive_public_revocation_key`].
4732     *
4733     * The witness script which is hashed and included in the output `script_pubkey` may be
4734     * regenerated by passing the [`DelayedPaymentOutputDescriptor::revocation_pubkey`] (derived
4735     * as explained above), our delayed payment pubkey (derived as explained above), and the
4736     * [`DelayedPaymentOutputDescriptor::to_self_delay`] contained here to
4737     * [`chan_utils::get_revokeable_redeemscript`].
4738     */
4739    LDKSpendableOutputDescriptor_DelayedPaymentOutput,
4740    /**
4741     * An output to a P2WPKH, spendable exclusively by our payment key (i.e., the private key
4742     * which corresponds to the `payment_point` in [`ChannelSigner::pubkeys`]). The witness
4743     * in the spending input is, thus, simply:
4744     * ```bitcoin
4745     * <BIP 143 signature> <payment key>
4746     * ```
4747     *
4748     * These are generally the result of our counterparty having broadcast the current state,
4749     * allowing us to claim the non-HTLC-encumbered outputs immediately.
4750     */
4751    LDKSpendableOutputDescriptor_StaticPaymentOutput,
4752    /**
4753     * Must be last for serialization purposes
4754     */
4755    LDKSpendableOutputDescriptor_Sentinel,
4756 } LDKSpendableOutputDescriptor_Tag;
4757
4758 typedef struct LDKSpendableOutputDescriptor_LDKStaticOutput_Body {
4759    /**
4760     * The outpoint which is spendable.
4761     */
4762    struct LDKOutPoint outpoint;
4763    /**
4764     * The output which is referenced by the given outpoint.
4765     */
4766    struct LDKTxOut output;
4767 } LDKSpendableOutputDescriptor_LDKStaticOutput_Body;
4768
4769 typedef struct MUST_USE_STRUCT LDKSpendableOutputDescriptor {
4770    LDKSpendableOutputDescriptor_Tag tag;
4771    union {
4772       LDKSpendableOutputDescriptor_LDKStaticOutput_Body static_output;
4773       struct {
4774          struct LDKDelayedPaymentOutputDescriptor delayed_payment_output;
4775       };
4776       struct {
4777          struct LDKStaticPaymentOutputDescriptor static_payment_output;
4778       };
4779    };
4780 } LDKSpendableOutputDescriptor;
4781
4782 /**
4783  * A dynamically-allocated array of crate::lightning::chain::keysinterface::SpendableOutputDescriptors of arbitrary size.
4784  * This corresponds to std::vector in C++
4785  */
4786 typedef struct LDKCVec_SpendableOutputDescriptorZ {
4787    /**
4788     * The elements in the array.
4789     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4790     */
4791    struct LDKSpendableOutputDescriptor *data;
4792    /**
4793     * The number of elements pointed to by `data`.
4794     */
4795    uintptr_t datalen;
4796 } LDKCVec_SpendableOutputDescriptorZ;
4797
4798 /**
4799  * An Event which you should probably take some action in response to.
4800  *
4801  * Note that while Writeable and Readable are implemented for Event, you probably shouldn't use
4802  * them directly as they don't round-trip exactly (for example FundingGenerationReady is never
4803  * written as it makes no sense to respond to it after reconnecting to peers).
4804  */
4805 typedef enum LDKEvent_Tag {
4806    /**
4807     * Used to indicate that the client should generate a funding transaction with the given
4808     * parameters and then call [`ChannelManager::funding_transaction_generated`].
4809     * Generated in [`ChannelManager`] message handling.
4810     * Note that *all inputs* in the funding transaction must spend SegWit outputs or your
4811     * counterparty can steal your funds!
4812     *
4813     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
4814     * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated
4815     */
4816    LDKEvent_FundingGenerationReady,
4817    /**
4818     * Indicates that we've been offered a payment and it needs to be claimed via calling
4819     * [`ChannelManager::claim_funds`] with the preimage given in [`PaymentPurpose`].
4820     *
4821     * Note that if the preimage is not known, you should call
4822     * [`ChannelManager::fail_htlc_backwards`] or [`ChannelManager::fail_htlc_backwards_with_reason`]
4823     * to free up resources for this HTLC and avoid network congestion.
4824     * If you fail to call either [`ChannelManager::claim_funds`], [`ChannelManager::fail_htlc_backwards`],
4825     * or [`ChannelManager::fail_htlc_backwards_with_reason`] within the HTLC's timeout, the HTLC will be
4826     * automatically failed.
4827     *
4828     * # Note
4829     * LDK will not stop an inbound payment from being paid multiple times, so multiple
4830     * `PaymentClaimable` events may be generated for the same payment. In such a case it is
4831     * polite (and required in the lightning specification) to fail the payment the second time
4832     * and give the sender their money back rather than accepting double payment.
4833     *
4834     * # Note
4835     * This event used to be called `PaymentReceived` in LDK versions 0.0.112 and earlier.
4836     *
4837     * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
4838     * [`ChannelManager::fail_htlc_backwards`]: crate::ln::channelmanager::ChannelManager::fail_htlc_backwards
4839     * [`ChannelManager::fail_htlc_backwards_with_reason`]: crate::ln::channelmanager::ChannelManager::fail_htlc_backwards_with_reason
4840     */
4841    LDKEvent_PaymentClaimable,
4842    /**
4843     * Indicates a payment has been claimed and we've received money!
4844     *
4845     * This most likely occurs when [`ChannelManager::claim_funds`] has been called in response
4846     * to an [`Event::PaymentClaimable`]. However, if we previously crashed during a
4847     * [`ChannelManager::claim_funds`] call you may see this event without a corresponding
4848     * [`Event::PaymentClaimable`] event.
4849     *
4850     * # Note
4851     * LDK will not stop an inbound payment from being paid multiple times, so multiple
4852     * `PaymentClaimable` events may be generated for the same payment. If you then call
4853     * [`ChannelManager::claim_funds`] twice for the same [`Event::PaymentClaimable`] you may get
4854     * multiple `PaymentClaimed` events.
4855     *
4856     * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
4857     */
4858    LDKEvent_PaymentClaimed,
4859    /**
4860     * Indicates an outbound payment we made succeeded (i.e. it made it all the way to its target
4861     * and we got back the payment preimage for it).
4862     *
4863     * Note for MPP payments: in rare cases, this event may be preceded by a `PaymentPathFailed`
4864     * event. In this situation, you SHOULD treat this payment as having succeeded.
4865     */
4866    LDKEvent_PaymentSent,
4867    /**
4868     * Indicates an outbound payment failed. Individual [`Event::PaymentPathFailed`] events
4869     * provide failure information for each path attempt in the payment, including retries.
4870     *
4871     * This event is provided once there are no further pending HTLCs for the payment and the
4872     * payment is no longer retryable, due either to the [`Retry`] provided or
4873     * [`ChannelManager::abandon_payment`] having been called for the corresponding payment.
4874     *
4875     * [`Retry`]: crate::ln::channelmanager::Retry
4876     * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
4877     */
4878    LDKEvent_PaymentFailed,
4879    /**
4880     * Indicates that a path for an outbound payment was successful.
4881     *
4882     * Always generated after [`Event::PaymentSent`] and thus useful for scoring channels. See
4883     * [`Event::PaymentSent`] for obtaining the payment preimage.
4884     */
4885    LDKEvent_PaymentPathSuccessful,
4886    /**
4887     * Indicates an outbound HTLC we sent failed, likely due to an intermediary node being unable to
4888     * handle the HTLC.
4889     *
4890     * Note that this does *not* indicate that all paths for an MPP payment have failed, see
4891     * [`Event::PaymentFailed`].
4892     *
4893     * See [`ChannelManager::abandon_payment`] for giving up on this payment before its retries have
4894     * been exhausted.
4895     *
4896     * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
4897     */
4898    LDKEvent_PaymentPathFailed,
4899    /**
4900     * Indicates that a probe payment we sent returned successful, i.e., only failed at the destination.
4901     */
4902    LDKEvent_ProbeSuccessful,
4903    /**
4904     * Indicates that a probe payment we sent failed at an intermediary node on the path.
4905     */
4906    LDKEvent_ProbeFailed,
4907    /**
4908     * Used to indicate that [`ChannelManager::process_pending_htlc_forwards`] should be called at
4909     * a time in the future.
4910     *
4911     * [`ChannelManager::process_pending_htlc_forwards`]: crate::ln::channelmanager::ChannelManager::process_pending_htlc_forwards
4912     */
4913    LDKEvent_PendingHTLCsForwardable,
4914    /**
4915     * Used to indicate that we've intercepted an HTLC forward. This event will only be generated if
4916     * you've encoded an intercept scid in the receiver's invoice route hints using
4917     * [`ChannelManager::get_intercept_scid`] and have set [`UserConfig::accept_intercept_htlcs`].
4918     *
4919     * [`ChannelManager::forward_intercepted_htlc`] or
4920     * [`ChannelManager::fail_intercepted_htlc`] MUST be called in response to this event. See
4921     * their docs for more information.
4922     *
4923     * [`ChannelManager::get_intercept_scid`]: crate::ln::channelmanager::ChannelManager::get_intercept_scid
4924     * [`UserConfig::accept_intercept_htlcs`]: crate::util::config::UserConfig::accept_intercept_htlcs
4925     * [`ChannelManager::forward_intercepted_htlc`]: crate::ln::channelmanager::ChannelManager::forward_intercepted_htlc
4926     * [`ChannelManager::fail_intercepted_htlc`]: crate::ln::channelmanager::ChannelManager::fail_intercepted_htlc
4927     */
4928    LDKEvent_HTLCIntercepted,
4929    /**
4930     * Used to indicate that an output which you should know how to spend was confirmed on chain
4931     * and is now spendable.
4932     * Such an output will *not* ever be spent by rust-lightning, and are not at risk of your
4933     * counterparty spending them due to some kind of timeout. Thus, you need to store them
4934     * somewhere and spend them when you create on-chain transactions.
4935     */
4936    LDKEvent_SpendableOutputs,
4937    /**
4938     * This event is generated when a payment has been successfully forwarded through us and a
4939     * forwarding fee earned.
4940     */
4941    LDKEvent_PaymentForwarded,
4942    /**
4943     * Used to indicate that a channel with the given `channel_id` is being opened and pending
4944     * confirmation on-chain.
4945     *
4946     * This event is emitted when the funding transaction has been signed and is broadcast to the
4947     * network. For 0conf channels it will be immediately followed by the corresponding
4948     * [`Event::ChannelReady`] event.
4949     */
4950    LDKEvent_ChannelPending,
4951    /**
4952     * Used to indicate that a channel with the given `channel_id` is ready to
4953     * be used. This event is emitted either when the funding transaction has been confirmed
4954     * on-chain, or, in case of a 0conf channel, when both parties have confirmed the channel
4955     * establishment.
4956     */
4957    LDKEvent_ChannelReady,
4958    /**
4959     * Used to indicate that a previously opened channel with the given `channel_id` is in the
4960     * process of closure.
4961     */
4962    LDKEvent_ChannelClosed,
4963    /**
4964     * Used to indicate to the user that they can abandon the funding transaction and recycle the
4965     * inputs for another purpose.
4966     */
4967    LDKEvent_DiscardFunding,
4968    /**
4969     * Indicates a request to open a new channel by a peer.
4970     *
4971     * To accept the request, call [`ChannelManager::accept_inbound_channel`]. To reject the
4972     * request, call [`ChannelManager::force_close_without_broadcasting_txn`].
4973     *
4974     * The event is only triggered when a new open channel request is received and the
4975     * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true.
4976     *
4977     * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
4978     * [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn
4979     * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
4980     */
4981    LDKEvent_OpenChannelRequest,
4982    /**
4983     * Indicates that the HTLC was accepted, but could not be processed when or after attempting to
4984     * forward it.
4985     *
4986     * Some scenarios where this event may be sent include:
4987     * * Insufficient capacity in the outbound channel
4988     * * While waiting to forward the HTLC, the channel it is meant to be forwarded through closes
4989     * * When an unknown SCID is requested for forwarding a payment.
4990     * * Expected MPP amount has already been reached
4991     * * The HTLC has timed out
4992     *
4993     * This event, however, does not get generated if an HTLC fails to meet the forwarding
4994     * requirements (i.e. insufficient fees paid, or a CLTV that is too soon).
4995     */
4996    LDKEvent_HTLCHandlingFailed,
4997    /**
4998     * Must be last for serialization purposes
4999     */
5000    LDKEvent_Sentinel,
5001 } LDKEvent_Tag;
5002
5003 typedef struct LDKEvent_LDKFundingGenerationReady_Body {
5004    /**
5005     * The random channel_id we picked which you'll need to pass into
5006     * [`ChannelManager::funding_transaction_generated`].
5007     *
5008     * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated
5009     */
5010    struct LDKThirtyTwoBytes temporary_channel_id;
5011    /**
5012     * The counterparty's node_id, which you'll need to pass back into
5013     * [`ChannelManager::funding_transaction_generated`].
5014     *
5015     * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated
5016     */
5017    struct LDKPublicKey counterparty_node_id;
5018    /**
5019     * The value, in satoshis, that the output should have.
5020     */
5021    uint64_t channel_value_satoshis;
5022    /**
5023     * The script which should be used in the transaction output.
5024     */
5025    struct LDKCVec_u8Z output_script;
5026    /**
5027     * The `user_channel_id` value passed in to [`ChannelManager::create_channel`], or a
5028     * random value for an inbound channel. This may be zero for objects serialized with LDK
5029     * versions prior to 0.0.113.
5030     *
5031     * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
5032     */
5033    struct LDKU128 user_channel_id;
5034 } LDKEvent_LDKFundingGenerationReady_Body;
5035
5036 typedef struct LDKEvent_LDKPaymentClaimable_Body {
5037    /**
5038     * The node that will receive the payment after it has been claimed.
5039     * This is useful to identify payments received via [phantom nodes].
5040     * This field will always be filled in when the event was generated by LDK versions
5041     * 0.0.113 and above.
5042     *
5043     * [phantom nodes]: crate::chain::keysinterface::PhantomKeysManager
5044     *
5045     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
5046     */
5047    struct LDKPublicKey receiver_node_id;
5048    /**
5049     * The hash for which the preimage should be handed to the ChannelManager. Note that LDK will
5050     * not stop you from registering duplicate payment hashes for inbound payments.
5051     */
5052    struct LDKThirtyTwoBytes payment_hash;
5053    /**
5054     * The fields in the onion which were received with each HTLC. Only fields which were
5055     * identical in each HTLC involved in the payment will be included here.
5056     *
5057     * Payments received on LDK versions prior to 0.0.115 will have this field unset.
5058     *
5059     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
5060     */
5061    struct LDKRecipientOnionFields onion_fields;
5062    /**
5063     * The value, in thousandths of a satoshi, that this payment is for.
5064     */
5065    uint64_t amount_msat;
5066    /**
5067     * Information for claiming this received payment, based on whether the purpose of the
5068     * payment is to pay an invoice or to send a spontaneous payment.
5069     */
5070    struct LDKPaymentPurpose purpose;
5071    /**
5072     * The `channel_id` indicating over which channel we received the payment.
5073     *
5074     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
5075     */
5076    struct LDKThirtyTwoBytes via_channel_id;
5077    /**
5078     * The `user_channel_id` indicating over which channel we received the payment.
5079     */
5080    struct LDKCOption_u128Z via_user_channel_id;
5081    /**
5082     * The block height at which this payment will be failed back and will no longer be
5083     * eligible for claiming.
5084     *
5085     * Prior to this height, a call to [`ChannelManager::claim_funds`] is guaranteed to
5086     * succeed, however you should wait for [`Event::PaymentClaimed`] to be sure.
5087     *
5088     * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
5089     */
5090    struct LDKCOption_u32Z claim_deadline;
5091 } LDKEvent_LDKPaymentClaimable_Body;
5092
5093 typedef struct LDKEvent_LDKPaymentClaimed_Body {
5094    /**
5095     * The node that received the payment.
5096     * This is useful to identify payments which were received via [phantom nodes].
5097     * This field will always be filled in when the event was generated by LDK versions
5098     * 0.0.113 and above.
5099     *
5100     * [phantom nodes]: crate::chain::keysinterface::PhantomKeysManager
5101     *
5102     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
5103     */
5104    struct LDKPublicKey receiver_node_id;
5105    /**
5106     * The payment hash of the claimed payment. Note that LDK will not stop you from
5107     * registering duplicate payment hashes for inbound payments.
5108     */
5109    struct LDKThirtyTwoBytes payment_hash;
5110    /**
5111     * The value, in thousandths of a satoshi, that this payment is for.
5112     */
5113    uint64_t amount_msat;
5114    /**
5115     * The purpose of the claimed payment, i.e. whether the payment was for an invoice or a
5116     * spontaneous payment.
5117     */
5118    struct LDKPaymentPurpose purpose;
5119 } LDKEvent_LDKPaymentClaimed_Body;
5120
5121 typedef struct LDKEvent_LDKPaymentSent_Body {
5122    /**
5123     * The `payment_id` passed to [`ChannelManager::send_payment`].
5124     *
5125     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
5126     *
5127     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
5128     */
5129    struct LDKThirtyTwoBytes payment_id;
5130    /**
5131     * The preimage to the hash given to ChannelManager::send_payment.
5132     * Note that this serves as a payment receipt, if you wish to have such a thing, you must
5133     * store it somehow!
5134     */
5135    struct LDKThirtyTwoBytes payment_preimage;
5136    /**
5137     * The hash that was given to [`ChannelManager::send_payment`].
5138     *
5139     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
5140     */
5141    struct LDKThirtyTwoBytes payment_hash;
5142    /**
5143     * The total fee which was spent at intermediate hops in this payment, across all paths.
5144     *
5145     * Note that, like [`Route::get_total_fees`] this does *not* include any potential
5146     * overpayment to the recipient node.
5147     *
5148     * If the recipient or an intermediate node misbehaves and gives us free money, this may
5149     * overstate the amount paid, though this is unlikely.
5150     *
5151     * [`Route::get_total_fees`]: crate::routing::router::Route::get_total_fees
5152     */
5153    struct LDKCOption_u64Z fee_paid_msat;
5154 } LDKEvent_LDKPaymentSent_Body;
5155
5156 typedef struct LDKEvent_LDKPaymentFailed_Body {
5157    /**
5158     * The `payment_id` passed to [`ChannelManager::send_payment`].
5159     *
5160     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
5161     */
5162    struct LDKThirtyTwoBytes payment_id;
5163    /**
5164     * The hash that was given to [`ChannelManager::send_payment`].
5165     *
5166     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
5167     */
5168    struct LDKThirtyTwoBytes payment_hash;
5169    /**
5170     * The reason the payment failed. This is only `None` for events generated or serialized
5171     * by versions prior to 0.0.115.
5172     */
5173    struct LDKCOption_PaymentFailureReasonZ reason;
5174 } LDKEvent_LDKPaymentFailed_Body;
5175
5176 typedef struct LDKEvent_LDKPaymentPathSuccessful_Body {
5177    /**
5178     * The `payment_id` passed to [`ChannelManager::send_payment`].
5179     *
5180     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
5181     */
5182    struct LDKThirtyTwoBytes payment_id;
5183    /**
5184     * The hash that was given to [`ChannelManager::send_payment`].
5185     *
5186     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
5187     *
5188     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
5189     */
5190    struct LDKThirtyTwoBytes payment_hash;
5191    /**
5192     * The payment path that was successful.
5193     *
5194     * May contain a closed channel if the HTLC sent along the path was fulfilled on chain.
5195     */
5196    struct LDKPath path;
5197 } LDKEvent_LDKPaymentPathSuccessful_Body;
5198
5199 typedef struct LDKEvent_LDKPaymentPathFailed_Body {
5200    /**
5201     * The `payment_id` passed to [`ChannelManager::send_payment`].
5202     *
5203     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
5204     * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
5205     *
5206     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
5207     */
5208    struct LDKThirtyTwoBytes payment_id;
5209    /**
5210     * The hash that was given to [`ChannelManager::send_payment`].
5211     *
5212     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
5213     */
5214    struct LDKThirtyTwoBytes payment_hash;
5215    /**
5216     * Indicates the payment was rejected for some reason by the recipient. This implies that
5217     * the payment has failed, not just the route in question. If this is not set, the payment may
5218     * be retried via a different route.
5219     */
5220    bool payment_failed_permanently;
5221    /**
5222     * Extra error details based on the failure type. May contain an update that needs to be
5223     * applied to the [`NetworkGraph`].
5224     *
5225     * [`NetworkGraph`]: crate::routing::gossip::NetworkGraph
5226     */
5227    struct LDKPathFailure failure;
5228    /**
5229     * The payment path that failed.
5230     */
5231    struct LDKPath path;
5232    /**
5233     * The channel responsible for the failed payment path.
5234     *
5235     * Note that for route hints or for the first hop in a path this may be an SCID alias and
5236     * may not refer to a channel in the public network graph. These aliases may also collide
5237     * with channels in the public network graph.
5238     *
5239     * If this is `Some`, then the corresponding channel should be avoided when the payment is
5240     * retried. May be `None` for older [`Event`] serializations.
5241     */
5242    struct LDKCOption_u64Z short_channel_id;
5243 } LDKEvent_LDKPaymentPathFailed_Body;
5244
5245 typedef struct LDKEvent_LDKProbeSuccessful_Body {
5246    /**
5247     * The id returned by [`ChannelManager::send_probe`].
5248     *
5249     * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe
5250     */
5251    struct LDKThirtyTwoBytes payment_id;
5252    /**
5253     * The hash generated by [`ChannelManager::send_probe`].
5254     *
5255     * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe
5256     */
5257    struct LDKThirtyTwoBytes payment_hash;
5258    /**
5259     * The payment path that was successful.
5260     */
5261    struct LDKPath path;
5262 } LDKEvent_LDKProbeSuccessful_Body;
5263
5264 typedef struct LDKEvent_LDKProbeFailed_Body {
5265    /**
5266     * The id returned by [`ChannelManager::send_probe`].
5267     *
5268     * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe
5269     */
5270    struct LDKThirtyTwoBytes payment_id;
5271    /**
5272     * The hash generated by [`ChannelManager::send_probe`].
5273     *
5274     * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe
5275     */
5276    struct LDKThirtyTwoBytes payment_hash;
5277    /**
5278     * The payment path that failed.
5279     */
5280    struct LDKPath path;
5281    /**
5282     * The channel responsible for the failed probe.
5283     *
5284     * Note that for route hints or for the first hop in a path this may be an SCID alias and
5285     * may not refer to a channel in the public network graph. These aliases may also collide
5286     * with channels in the public network graph.
5287     */
5288    struct LDKCOption_u64Z short_channel_id;
5289 } LDKEvent_LDKProbeFailed_Body;
5290
5291 typedef struct LDKEvent_LDKPendingHTLCsForwardable_Body {
5292    /**
5293     * The minimum amount of time that should be waited prior to calling
5294     * process_pending_htlc_forwards. To increase the effort required to correlate payments,
5295     * you should wait a random amount of time in roughly the range (now + time_forwardable,
5296     * now + 5*time_forwardable).
5297     */
5298    uint64_t time_forwardable;
5299 } LDKEvent_LDKPendingHTLCsForwardable_Body;
5300
5301 typedef struct LDKEvent_LDKHTLCIntercepted_Body {
5302    /**
5303     * An id to help LDK identify which HTLC is being forwarded or failed.
5304     */
5305    struct LDKThirtyTwoBytes intercept_id;
5306    /**
5307     * The fake scid that was programmed as the next hop's scid, generated using
5308     * [`ChannelManager::get_intercept_scid`].
5309     *
5310     * [`ChannelManager::get_intercept_scid`]: crate::ln::channelmanager::ChannelManager::get_intercept_scid
5311     */
5312    uint64_t requested_next_hop_scid;
5313    /**
5314     * The payment hash used for this HTLC.
5315     */
5316    struct LDKThirtyTwoBytes payment_hash;
5317    /**
5318     * How many msats were received on the inbound edge of this HTLC.
5319     */
5320    uint64_t inbound_amount_msat;
5321    /**
5322     * How many msats the payer intended to route to the next node. Depending on the reason you are
5323     * intercepting this payment, you might take a fee by forwarding less than this amount.
5324     *
5325     * Note that LDK will NOT check that expected fees were factored into this value. You MUST
5326     * check that whatever fee you want has been included here or subtract it as required. Further,
5327     * LDK will not stop you from forwarding more than you received.
5328     */
5329    uint64_t expected_outbound_amount_msat;
5330 } LDKEvent_LDKHTLCIntercepted_Body;
5331
5332 typedef struct LDKEvent_LDKSpendableOutputs_Body {
5333    /**
5334     * The outputs which you should store as spendable by you.
5335     */
5336    struct LDKCVec_SpendableOutputDescriptorZ outputs;
5337 } LDKEvent_LDKSpendableOutputs_Body;
5338
5339 typedef struct LDKEvent_LDKPaymentForwarded_Body {
5340    /**
5341     * The incoming channel between the previous node and us. This is only `None` for events
5342     * generated or serialized by versions prior to 0.0.107.
5343     *
5344     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
5345     */
5346    struct LDKThirtyTwoBytes prev_channel_id;
5347    /**
5348     * The outgoing channel between the next node and us. This is only `None` for events
5349     * generated or serialized by versions prior to 0.0.107.
5350     *
5351     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
5352     */
5353    struct LDKThirtyTwoBytes next_channel_id;
5354    /**
5355     * The fee, in milli-satoshis, which was earned as a result of the payment.
5356     *
5357     * Note that if we force-closed the channel over which we forwarded an HTLC while the HTLC
5358     * was pending, the amount the next hop claimed will have been rounded down to the nearest
5359     * whole satoshi. Thus, the fee calculated here may be higher than expected as we still
5360     * claimed the full value in millisatoshis from the source. In this case,
5361     * `claim_from_onchain_tx` will be set.
5362     *
5363     * If the channel which sent us the payment has been force-closed, we will claim the funds
5364     * via an on-chain transaction. In that case we do not yet know the on-chain transaction
5365     * fees which we will spend and will instead set this to `None`. It is possible duplicate
5366     * `PaymentForwarded` events are generated for the same payment iff `fee_earned_msat` is
5367     * `None`.
5368     */
5369    struct LDKCOption_u64Z fee_earned_msat;
5370    /**
5371     * If this is `true`, the forwarded HTLC was claimed by our counterparty via an on-chain
5372     * transaction.
5373     */
5374    bool claim_from_onchain_tx;
5375    /**
5376     * The final amount forwarded, in milli-satoshis, after the fee is deducted.
5377     *
5378     * The caveat described above the `fee_earned_msat` field applies here as well.
5379     */
5380    struct LDKCOption_u64Z outbound_amount_forwarded_msat;
5381 } LDKEvent_LDKPaymentForwarded_Body;
5382
5383 typedef struct LDKEvent_LDKChannelPending_Body {
5384    /**
5385     * The `channel_id` of the channel that is pending confirmation.
5386     */
5387    struct LDKThirtyTwoBytes channel_id;
5388    /**
5389     * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound
5390     * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if
5391     * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise
5392     * `user_channel_id` will be randomized for an inbound channel.
5393     *
5394     * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
5395     * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
5396     * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
5397     */
5398    struct LDKU128 user_channel_id;
5399    /**
5400     * The `temporary_channel_id` this channel used to be known by during channel establishment.
5401     *
5402     * Will be `None` for channels created prior to LDK version 0.0.115.
5403     *
5404     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
5405     */
5406    struct LDKThirtyTwoBytes former_temporary_channel_id;
5407    /**
5408     * The `node_id` of the channel counterparty.
5409     */
5410    struct LDKPublicKey counterparty_node_id;
5411    /**
5412     * The outpoint of the channel's funding transaction.
5413     */
5414    struct LDKOutPoint funding_txo;
5415 } LDKEvent_LDKChannelPending_Body;
5416
5417 typedef struct LDKEvent_LDKChannelReady_Body {
5418    /**
5419     * The `channel_id` of the channel that is ready.
5420     */
5421    struct LDKThirtyTwoBytes channel_id;
5422    /**
5423     * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound
5424     * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if
5425     * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise
5426     * `user_channel_id` will be randomized for an inbound channel.
5427     *
5428     * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
5429     * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
5430     * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
5431     */
5432    struct LDKU128 user_channel_id;
5433    /**
5434     * The `node_id` of the channel counterparty.
5435     */
5436    struct LDKPublicKey counterparty_node_id;
5437    /**
5438     * The features that this channel will operate with.
5439     */
5440    struct LDKChannelTypeFeatures channel_type;
5441 } LDKEvent_LDKChannelReady_Body;
5442
5443 typedef struct LDKEvent_LDKChannelClosed_Body {
5444    /**
5445     * The `channel_id` of the channel which has been closed. Note that on-chain transactions
5446     * resolving the channel are likely still awaiting confirmation.
5447     */
5448    struct LDKThirtyTwoBytes channel_id;
5449    /**
5450     * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound
5451     * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if
5452     * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise
5453     * `user_channel_id` will be randomized for inbound channels.
5454     * This may be zero for inbound channels serialized prior to 0.0.113 and will always be
5455     * zero for objects serialized with LDK versions prior to 0.0.102.
5456     *
5457     * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
5458     * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
5459     * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
5460     */
5461    struct LDKU128 user_channel_id;
5462    /**
5463     * The reason the channel was closed.
5464     */
5465    struct LDKClosureReason reason;
5466 } LDKEvent_LDKChannelClosed_Body;
5467
5468 typedef struct LDKEvent_LDKDiscardFunding_Body {
5469    /**
5470     * The channel_id of the channel which has been closed.
5471     */
5472    struct LDKThirtyTwoBytes channel_id;
5473    /**
5474     * The full transaction received from the user
5475     */
5476    struct LDKTransaction transaction;
5477 } LDKEvent_LDKDiscardFunding_Body;
5478
5479 typedef struct LDKEvent_LDKOpenChannelRequest_Body {
5480    /**
5481     * The temporary channel ID of the channel requested to be opened.
5482     *
5483     * When responding to the request, the `temporary_channel_id` should be passed
5484     * back to the ChannelManager through [`ChannelManager::accept_inbound_channel`] to accept,
5485     * or through [`ChannelManager::force_close_without_broadcasting_txn`] to reject.
5486     *
5487     * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
5488     * [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn
5489     */
5490    struct LDKThirtyTwoBytes temporary_channel_id;
5491    /**
5492     * The node_id of the counterparty requesting to open the channel.
5493     *
5494     * When responding to the request, the `counterparty_node_id` should be passed
5495     * back to the `ChannelManager` through [`ChannelManager::accept_inbound_channel`] to
5496     * accept the request, or through [`ChannelManager::force_close_without_broadcasting_txn`] to reject the
5497     * request.
5498     *
5499     * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
5500     * [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn
5501     */
5502    struct LDKPublicKey counterparty_node_id;
5503    /**
5504     * The channel value of the requested channel.
5505     */
5506    uint64_t funding_satoshis;
5507    /**
5508     * Our starting balance in the channel if the request is accepted, in milli-satoshi.
5509     */
5510    uint64_t push_msat;
5511    /**
5512     * The features that this channel will operate with. If you reject the channel, a
5513     * well-behaved counterparty may automatically re-attempt the channel with a new set of
5514     * feature flags.
5515     *
5516     * Note that if [`ChannelTypeFeatures::supports_scid_privacy`] returns true on this type,
5517     * the resulting [`ChannelManager`] will not be readable by versions of LDK prior to
5518     * 0.0.106.
5519     *
5520     * Furthermore, note that if [`ChannelTypeFeatures::supports_zero_conf`] returns true on this type,
5521     * the resulting [`ChannelManager`] will not be readable by versions of LDK prior to
5522     * 0.0.107. Channels setting this type also need to get manually accepted via
5523     * [`crate::ln::channelmanager::ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`],
5524     * or will be rejected otherwise.
5525     *
5526     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
5527     */
5528    struct LDKChannelTypeFeatures channel_type;
5529 } LDKEvent_LDKOpenChannelRequest_Body;
5530
5531 typedef struct LDKEvent_LDKHTLCHandlingFailed_Body {
5532    /**
5533     * The channel over which the HTLC was received.
5534     */
5535    struct LDKThirtyTwoBytes prev_channel_id;
5536    /**
5537     * Destination of the HTLC that failed to be processed.
5538     */
5539    struct LDKHTLCDestination failed_next_destination;
5540 } LDKEvent_LDKHTLCHandlingFailed_Body;
5541
5542 typedef struct MUST_USE_STRUCT LDKEvent {
5543    LDKEvent_Tag tag;
5544    union {
5545       LDKEvent_LDKFundingGenerationReady_Body funding_generation_ready;
5546       LDKEvent_LDKPaymentClaimable_Body payment_claimable;
5547       LDKEvent_LDKPaymentClaimed_Body payment_claimed;
5548       LDKEvent_LDKPaymentSent_Body payment_sent;
5549       LDKEvent_LDKPaymentFailed_Body payment_failed;
5550       LDKEvent_LDKPaymentPathSuccessful_Body payment_path_successful;
5551       LDKEvent_LDKPaymentPathFailed_Body payment_path_failed;
5552       LDKEvent_LDKProbeSuccessful_Body probe_successful;
5553       LDKEvent_LDKProbeFailed_Body probe_failed;
5554       LDKEvent_LDKPendingHTLCsForwardable_Body pending_htl_cs_forwardable;
5555       LDKEvent_LDKHTLCIntercepted_Body htlc_intercepted;
5556       LDKEvent_LDKSpendableOutputs_Body spendable_outputs;
5557       LDKEvent_LDKPaymentForwarded_Body payment_forwarded;
5558       LDKEvent_LDKChannelPending_Body channel_pending;
5559       LDKEvent_LDKChannelReady_Body channel_ready;
5560       LDKEvent_LDKChannelClosed_Body channel_closed;
5561       LDKEvent_LDKDiscardFunding_Body discard_funding;
5562       LDKEvent_LDKOpenChannelRequest_Body open_channel_request;
5563       LDKEvent_LDKHTLCHandlingFailed_Body htlc_handling_failed;
5564    };
5565 } LDKEvent;
5566
5567 /**
5568  * An enum which can either contain a crate::lightning::events::Event or not
5569  */
5570 typedef enum LDKCOption_EventZ_Tag {
5571    /**
5572     * When we're in this state, this COption_EventZ contains a crate::lightning::events::Event
5573     */
5574    LDKCOption_EventZ_Some,
5575    /**
5576     * When we're in this state, this COption_EventZ contains nothing
5577     */
5578    LDKCOption_EventZ_None,
5579    /**
5580     * Must be last for serialization purposes
5581     */
5582    LDKCOption_EventZ_Sentinel,
5583 } LDKCOption_EventZ_Tag;
5584
5585 typedef struct LDKCOption_EventZ {
5586    LDKCOption_EventZ_Tag tag;
5587    union {
5588       struct {
5589          struct LDKEvent some;
5590       };
5591    };
5592 } LDKCOption_EventZ;
5593
5594 /**
5595  * The contents of CResult_COption_EventZDecodeErrorZ
5596  */
5597 typedef union LDKCResult_COption_EventZDecodeErrorZPtr {
5598    /**
5599     * A pointer to the contents in the success state.
5600     * Reading from this pointer when `result_ok` is not set is undefined.
5601     */
5602    struct LDKCOption_EventZ *result;
5603    /**
5604     * A pointer to the contents in the error state.
5605     * Reading from this pointer when `result_ok` is set is undefined.
5606     */
5607    struct LDKDecodeError *err;
5608 } LDKCResult_COption_EventZDecodeErrorZPtr;
5609
5610 /**
5611  * A CResult_COption_EventZDecodeErrorZ represents the result of a fallible operation,
5612  * containing a crate::c_types::derived::COption_EventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
5613  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5614  */
5615 typedef struct LDKCResult_COption_EventZDecodeErrorZ {
5616    /**
5617     * The contents of this CResult_COption_EventZDecodeErrorZ, accessible via either
5618     * `err` or `result` depending on the state of `result_ok`.
5619     */
5620    union LDKCResult_COption_EventZDecodeErrorZPtr contents;
5621    /**
5622     * Whether this CResult_COption_EventZDecodeErrorZ represents a success state.
5623     */
5624    bool result_ok;
5625 } LDKCResult_COption_EventZDecodeErrorZ;
5626
5627
5628
5629 /**
5630  * An [`accept_channel`] message to be sent to or received from a peer.
5631  *
5632  * [`accept_channel`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-accept_channel-message
5633  */
5634 typedef struct MUST_USE_STRUCT LDKAcceptChannel {
5635    /**
5636     * A pointer to the opaque Rust object.
5637     * Nearly everywhere, inner must be non-null, however in places where
5638     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5639     */
5640    LDKnativeAcceptChannel *inner;
5641    /**
5642     * Indicates that this is the only struct which contains the same pointer.
5643     * Rust functions which take ownership of an object provided via an argument require
5644     * this to be true and invalidate the object pointed to by inner.
5645     */
5646    bool is_owned;
5647 } LDKAcceptChannel;
5648
5649
5650
5651 /**
5652  * An [`open_channel`] message to be sent to or received from a peer.
5653  *
5654  * [`open_channel`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-open_channel-message
5655  */
5656 typedef struct MUST_USE_STRUCT LDKOpenChannel {
5657    /**
5658     * A pointer to the opaque Rust object.
5659     * Nearly everywhere, inner must be non-null, however in places where
5660     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5661     */
5662    LDKnativeOpenChannel *inner;
5663    /**
5664     * Indicates that this is the only struct which contains the same pointer.
5665     * Rust functions which take ownership of an object provided via an argument require
5666     * this to be true and invalidate the object pointed to by inner.
5667     */
5668    bool is_owned;
5669 } LDKOpenChannel;
5670
5671
5672
5673 /**
5674  * A [`funding_created`] message to be sent to or received from a peer.
5675  *
5676  * [`funding_created`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-funding_created-message
5677  */
5678 typedef struct MUST_USE_STRUCT LDKFundingCreated {
5679    /**
5680     * A pointer to the opaque Rust object.
5681     * Nearly everywhere, inner must be non-null, however in places where
5682     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5683     */
5684    LDKnativeFundingCreated *inner;
5685    /**
5686     * Indicates that this is the only struct which contains the same pointer.
5687     * Rust functions which take ownership of an object provided via an argument require
5688     * this to be true and invalidate the object pointed to by inner.
5689     */
5690    bool is_owned;
5691 } LDKFundingCreated;
5692
5693
5694
5695 /**
5696  * A [`funding_signed`] message to be sent to or received from a peer.
5697  *
5698  * [`funding_signed`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-funding_signed-message
5699  */
5700 typedef struct MUST_USE_STRUCT LDKFundingSigned {
5701    /**
5702     * A pointer to the opaque Rust object.
5703     * Nearly everywhere, inner must be non-null, however in places where
5704     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5705     */
5706    LDKnativeFundingSigned *inner;
5707    /**
5708     * Indicates that this is the only struct which contains the same pointer.
5709     * Rust functions which take ownership of an object provided via an argument require
5710     * this to be true and invalidate the object pointed to by inner.
5711     */
5712    bool is_owned;
5713 } LDKFundingSigned;
5714
5715
5716
5717 /**
5718  * A [`channel_ready`] message to be sent to or received from a peer.
5719  *
5720  * [`channel_ready`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-channel_ready-message
5721  */
5722 typedef struct MUST_USE_STRUCT LDKChannelReady {
5723    /**
5724     * A pointer to the opaque Rust object.
5725     * Nearly everywhere, inner must be non-null, however in places where
5726     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5727     */
5728    LDKnativeChannelReady *inner;
5729    /**
5730     * Indicates that this is the only struct which contains the same pointer.
5731     * Rust functions which take ownership of an object provided via an argument require
5732     * this to be true and invalidate the object pointed to by inner.
5733     */
5734    bool is_owned;
5735 } LDKChannelReady;
5736
5737
5738
5739 /**
5740  * An [`announcement_signatures`] message to be sent to or received from a peer.
5741  *
5742  * [`announcement_signatures`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-announcement_signatures-message
5743  */
5744 typedef struct MUST_USE_STRUCT LDKAnnouncementSignatures {
5745    /**
5746     * A pointer to the opaque Rust object.
5747     * Nearly everywhere, inner must be non-null, however in places where
5748     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5749     */
5750    LDKnativeAnnouncementSignatures *inner;
5751    /**
5752     * Indicates that this is the only struct which contains the same pointer.
5753     * Rust functions which take ownership of an object provided via an argument require
5754     * this to be true and invalidate the object pointed to by inner.
5755     */
5756    bool is_owned;
5757 } LDKAnnouncementSignatures;
5758
5759
5760
5761 /**
5762  * Struct used to return values from [`RevokeAndACK`] messages, containing a bunch of commitment
5763  * transaction updates if they were pending.
5764  */
5765 typedef struct MUST_USE_STRUCT LDKCommitmentUpdate {
5766    /**
5767     * A pointer to the opaque Rust object.
5768     * Nearly everywhere, inner must be non-null, however in places where
5769     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5770     */
5771    LDKnativeCommitmentUpdate *inner;
5772    /**
5773     * Indicates that this is the only struct which contains the same pointer.
5774     * Rust functions which take ownership of an object provided via an argument require
5775     * this to be true and invalidate the object pointed to by inner.
5776     */
5777    bool is_owned;
5778 } LDKCommitmentUpdate;
5779
5780
5781
5782 /**
5783  * A [`revoke_and_ack`] message to be sent to or received from a peer.
5784  *
5785  * [`revoke_and_ack`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#completing-the-transition-to-the-updated-state-revoke_and_ack
5786  */
5787 typedef struct MUST_USE_STRUCT LDKRevokeAndACK {
5788    /**
5789     * A pointer to the opaque Rust object.
5790     * Nearly everywhere, inner must be non-null, however in places where
5791     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5792     */
5793    LDKnativeRevokeAndACK *inner;
5794    /**
5795     * Indicates that this is the only struct which contains the same pointer.
5796     * Rust functions which take ownership of an object provided via an argument require
5797     * this to be true and invalidate the object pointed to by inner.
5798     */
5799    bool is_owned;
5800 } LDKRevokeAndACK;
5801
5802
5803
5804 /**
5805  * A [`closing_signed`] message to be sent to or received from a peer.
5806  *
5807  * [`closing_signed`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#closing-negotiation-closing_signed
5808  */
5809 typedef struct MUST_USE_STRUCT LDKClosingSigned {
5810    /**
5811     * A pointer to the opaque Rust object.
5812     * Nearly everywhere, inner must be non-null, however in places where
5813     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5814     */
5815    LDKnativeClosingSigned *inner;
5816    /**
5817     * Indicates that this is the only struct which contains the same pointer.
5818     * Rust functions which take ownership of an object provided via an argument require
5819     * this to be true and invalidate the object pointed to by inner.
5820     */
5821    bool is_owned;
5822 } LDKClosingSigned;
5823
5824
5825
5826 /**
5827  * A [`shutdown`] message to be sent to or received from a peer.
5828  *
5829  * [`shutdown`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#closing-initiation-shutdown
5830  */
5831 typedef struct MUST_USE_STRUCT LDKShutdown {
5832    /**
5833     * A pointer to the opaque Rust object.
5834     * Nearly everywhere, inner must be non-null, however in places where
5835     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5836     */
5837    LDKnativeShutdown *inner;
5838    /**
5839     * Indicates that this is the only struct which contains the same pointer.
5840     * Rust functions which take ownership of an object provided via an argument require
5841     * this to be true and invalidate the object pointed to by inner.
5842     */
5843    bool is_owned;
5844 } LDKShutdown;
5845
5846
5847
5848 /**
5849  * A [`channel_reestablish`] message to be sent to or received from a peer.
5850  *
5851  * [`channel_reestablish`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#message-retransmission
5852  */
5853 typedef struct MUST_USE_STRUCT LDKChannelReestablish {
5854    /**
5855     * A pointer to the opaque Rust object.
5856     * Nearly everywhere, inner must be non-null, however in places where
5857     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5858     */
5859    LDKnativeChannelReestablish *inner;
5860    /**
5861     * Indicates that this is the only struct which contains the same pointer.
5862     * Rust functions which take ownership of an object provided via an argument require
5863     * this to be true and invalidate the object pointed to by inner.
5864     */
5865    bool is_owned;
5866 } LDKChannelReestablish;
5867
5868
5869
5870 /**
5871  * A [`channel_announcement`] message to be sent to or received from a peer.
5872  *
5873  * [`channel_announcement`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-channel_announcement-message
5874  */
5875 typedef struct MUST_USE_STRUCT LDKChannelAnnouncement {
5876    /**
5877     * A pointer to the opaque Rust object.
5878     * Nearly everywhere, inner must be non-null, however in places where
5879     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5880     */
5881    LDKnativeChannelAnnouncement *inner;
5882    /**
5883     * Indicates that this is the only struct which contains the same pointer.
5884     * Rust functions which take ownership of an object provided via an argument require
5885     * this to be true and invalidate the object pointed to by inner.
5886     */
5887    bool is_owned;
5888 } LDKChannelAnnouncement;
5889
5890
5891
5892 /**
5893  * A [`node_announcement`] message to be sent to or received from a peer.
5894  *
5895  * [`node_announcement`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-node_announcement-message
5896  */
5897 typedef struct MUST_USE_STRUCT LDKNodeAnnouncement {
5898    /**
5899     * A pointer to the opaque Rust object.
5900     * Nearly everywhere, inner must be non-null, however in places where
5901     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5902     */
5903    LDKnativeNodeAnnouncement *inner;
5904    /**
5905     * Indicates that this is the only struct which contains the same pointer.
5906     * Rust functions which take ownership of an object provided via an argument require
5907     * this to be true and invalidate the object pointed to by inner.
5908     */
5909    bool is_owned;
5910 } LDKNodeAnnouncement;
5911
5912
5913
5914 /**
5915  * An [`error`] message to be sent to or received from a peer.
5916  *
5917  * [`error`]: https://github.com/lightning/bolts/blob/master/01-messaging.md#the-error-and-warning-messages
5918  */
5919 typedef struct MUST_USE_STRUCT LDKErrorMessage {
5920    /**
5921     * A pointer to the opaque Rust object.
5922     * Nearly everywhere, inner must be non-null, however in places where
5923     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5924     */
5925    LDKnativeErrorMessage *inner;
5926    /**
5927     * Indicates that this is the only struct which contains the same pointer.
5928     * Rust functions which take ownership of an object provided via an argument require
5929     * this to be true and invalidate the object pointed to by inner.
5930     */
5931    bool is_owned;
5932 } LDKErrorMessage;
5933
5934
5935
5936 /**
5937  * A [`warning`] message to be sent to or received from a peer.
5938  *
5939  * [`warning`]: https://github.com/lightning/bolts/blob/master/01-messaging.md#the-error-and-warning-messages
5940  */
5941 typedef struct MUST_USE_STRUCT LDKWarningMessage {
5942    /**
5943     * A pointer to the opaque Rust object.
5944     * Nearly everywhere, inner must be non-null, however in places where
5945     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5946     */
5947    LDKnativeWarningMessage *inner;
5948    /**
5949     * Indicates that this is the only struct which contains the same pointer.
5950     * Rust functions which take ownership of an object provided via an argument require
5951     * this to be true and invalidate the object pointed to by inner.
5952     */
5953    bool is_owned;
5954 } LDKWarningMessage;
5955
5956 /**
5957  * Used to put an error message in a [`LightningError`].
5958  */
5959 typedef enum LDKErrorAction_Tag {
5960    /**
5961     * The peer took some action which made us think they were useless. Disconnect them.
5962     */
5963    LDKErrorAction_DisconnectPeer,
5964    /**
5965     * The peer did something harmless that we weren't able to process, just log and ignore
5966     */
5967    LDKErrorAction_IgnoreError,
5968    /**
5969     * The peer did something harmless that we weren't able to meaningfully process.
5970     * If the error is logged, log it at the given level.
5971     */
5972    LDKErrorAction_IgnoreAndLog,
5973    /**
5974     * The peer provided us with a gossip message which we'd already seen. In most cases this
5975     * should be ignored, but it may result in the message being forwarded if it is a duplicate of
5976     * our own channel announcements.
5977     */
5978    LDKErrorAction_IgnoreDuplicateGossip,
5979    /**
5980     * The peer did something incorrect. Tell them.
5981     */
5982    LDKErrorAction_SendErrorMessage,
5983    /**
5984     * The peer did something incorrect. Tell them without closing any channels.
5985     */
5986    LDKErrorAction_SendWarningMessage,
5987    /**
5988     * Must be last for serialization purposes
5989     */
5990    LDKErrorAction_Sentinel,
5991 } LDKErrorAction_Tag;
5992
5993 typedef struct LDKErrorAction_LDKDisconnectPeer_Body {
5994    /**
5995     * An error message which we should make an effort to send before we disconnect.
5996     *
5997     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
5998     */
5999    struct LDKErrorMessage msg;
6000 } LDKErrorAction_LDKDisconnectPeer_Body;
6001
6002 typedef struct LDKErrorAction_LDKSendErrorMessage_Body {
6003    /**
6004     * The message to send.
6005     */
6006    struct LDKErrorMessage msg;
6007 } LDKErrorAction_LDKSendErrorMessage_Body;
6008
6009 typedef struct LDKErrorAction_LDKSendWarningMessage_Body {
6010    /**
6011     * The message to send.
6012     */
6013    struct LDKWarningMessage msg;
6014    /**
6015     * The peer may have done something harmless that we weren't able to meaningfully process,
6016     * though we should still tell them about it.
6017     * If this event is logged, log it at the given level.
6018     */
6019    enum LDKLevel log_level;
6020 } LDKErrorAction_LDKSendWarningMessage_Body;
6021
6022 typedef struct MUST_USE_STRUCT LDKErrorAction {
6023    LDKErrorAction_Tag tag;
6024    union {
6025       LDKErrorAction_LDKDisconnectPeer_Body disconnect_peer;
6026       struct {
6027          enum LDKLevel ignore_and_log;
6028       };
6029       LDKErrorAction_LDKSendErrorMessage_Body send_error_message;
6030       LDKErrorAction_LDKSendWarningMessage_Body send_warning_message;
6031    };
6032 } LDKErrorAction;
6033
6034
6035
6036 /**
6037  * A [`query_channel_range`] message is used to query a peer for channel
6038  * UTXOs in a range of blocks. The recipient of a query makes a best
6039  * effort to reply to the query using one or more [`ReplyChannelRange`]
6040  * messages.
6041  *
6042  * [`query_channel_range`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-query_channel_range-and-reply_channel_range-messages
6043  */
6044 typedef struct MUST_USE_STRUCT LDKQueryChannelRange {
6045    /**
6046     * A pointer to the opaque Rust object.
6047     * Nearly everywhere, inner must be non-null, however in places where
6048     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6049     */
6050    LDKnativeQueryChannelRange *inner;
6051    /**
6052     * Indicates that this is the only struct which contains the same pointer.
6053     * Rust functions which take ownership of an object provided via an argument require
6054     * this to be true and invalidate the object pointed to by inner.
6055     */
6056    bool is_owned;
6057 } LDKQueryChannelRange;
6058
6059
6060
6061 /**
6062  * A [`query_short_channel_ids`] message is used to query a peer for
6063  * routing gossip messages related to one or more `short_channel_id`s.
6064  *
6065  * The query recipient will reply with the latest, if available,
6066  * [`ChannelAnnouncement`], [`ChannelUpdate`] and [`NodeAnnouncement`] messages
6067  * it maintains for the requested `short_channel_id`s followed by a
6068  * [`ReplyShortChannelIdsEnd`] message. The `short_channel_id`s sent in
6069  * this query are encoded. We only support `encoding_type=0` uncompressed
6070  * serialization and do not support `encoding_type=1` zlib serialization.
6071  *
6072  * [`query_short_channel_ids`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-query_short_channel_idsreply_short_channel_ids_end-messages
6073  */
6074 typedef struct MUST_USE_STRUCT LDKQueryShortChannelIds {
6075    /**
6076     * A pointer to the opaque Rust object.
6077     * Nearly everywhere, inner must be non-null, however in places where
6078     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6079     */
6080    LDKnativeQueryShortChannelIds *inner;
6081    /**
6082     * Indicates that this is the only struct which contains the same pointer.
6083     * Rust functions which take ownership of an object provided via an argument require
6084     * this to be true and invalidate the object pointed to by inner.
6085     */
6086    bool is_owned;
6087 } LDKQueryShortChannelIds;
6088
6089
6090
6091 /**
6092  * A [`reply_channel_range`] message is a reply to a [`QueryChannelRange`]
6093  * message.
6094  *
6095  * Multiple `reply_channel_range` messages can be sent in reply
6096  * to a single [`QueryChannelRange`] message. The query recipient makes a
6097  * best effort to respond based on their local network view which may
6098  * not be a perfect view of the network. The `short_channel_id`s in the
6099  * reply are encoded. We only support `encoding_type=0` uncompressed
6100  * serialization and do not support `encoding_type=1` zlib serialization.
6101  *
6102  * [`reply_channel_range`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-query_channel_range-and-reply_channel_range-messages
6103  */
6104 typedef struct MUST_USE_STRUCT LDKReplyChannelRange {
6105    /**
6106     * A pointer to the opaque Rust object.
6107     * Nearly everywhere, inner must be non-null, however in places where
6108     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6109     */
6110    LDKnativeReplyChannelRange *inner;
6111    /**
6112     * Indicates that this is the only struct which contains the same pointer.
6113     * Rust functions which take ownership of an object provided via an argument require
6114     * this to be true and invalidate the object pointed to by inner.
6115     */
6116    bool is_owned;
6117 } LDKReplyChannelRange;
6118
6119
6120
6121 /**
6122  * A [`gossip_timestamp_filter`] message is used by a node to request
6123  * gossip relay for messages in the requested time range when the
6124  * `gossip_queries` feature has been negotiated.
6125  *
6126  * [`gossip_timestamp_filter`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-gossip_timestamp_filter-message
6127  */
6128 typedef struct MUST_USE_STRUCT LDKGossipTimestampFilter {
6129    /**
6130     * A pointer to the opaque Rust object.
6131     * Nearly everywhere, inner must be non-null, however in places where
6132     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6133     */
6134    LDKnativeGossipTimestampFilter *inner;
6135    /**
6136     * Indicates that this is the only struct which contains the same pointer.
6137     * Rust functions which take ownership of an object provided via an argument require
6138     * this to be true and invalidate the object pointed to by inner.
6139     */
6140    bool is_owned;
6141 } LDKGossipTimestampFilter;
6142
6143 /**
6144  * An event generated by ChannelManager which indicates a message should be sent to a peer (or
6145  * broadcast to most peers).
6146  * These events are handled by PeerManager::process_events if you are using a PeerManager.
6147  */
6148 typedef enum LDKMessageSendEvent_Tag {
6149    /**
6150     * Used to indicate that we've accepted a channel open and should send the accept_channel
6151     * message provided to the given peer.
6152     */
6153    LDKMessageSendEvent_SendAcceptChannel,
6154    /**
6155     * Used to indicate that we've initiated a channel open and should send the open_channel
6156     * message provided to the given peer.
6157     */
6158    LDKMessageSendEvent_SendOpenChannel,
6159    /**
6160     * Used to indicate that a funding_created message should be sent to the peer with the given node_id.
6161     */
6162    LDKMessageSendEvent_SendFundingCreated,
6163    /**
6164     * Used to indicate that a funding_signed message should be sent to the peer with the given node_id.
6165     */
6166    LDKMessageSendEvent_SendFundingSigned,
6167    /**
6168     * Used to indicate that a channel_ready message should be sent to the peer with the given node_id.
6169     */
6170    LDKMessageSendEvent_SendChannelReady,
6171    /**
6172     * Used to indicate that an announcement_signatures message should be sent to the peer with the given node_id.
6173     */
6174    LDKMessageSendEvent_SendAnnouncementSignatures,
6175    /**
6176     * Used to indicate that a series of HTLC update messages, as well as a commitment_signed
6177     * message should be sent to the peer with the given node_id.
6178     */
6179    LDKMessageSendEvent_UpdateHTLCs,
6180    /**
6181     * Used to indicate that a revoke_and_ack message should be sent to the peer with the given node_id.
6182     */
6183    LDKMessageSendEvent_SendRevokeAndACK,
6184    /**
6185     * Used to indicate that a closing_signed message should be sent to the peer with the given node_id.
6186     */
6187    LDKMessageSendEvent_SendClosingSigned,
6188    /**
6189     * Used to indicate that a shutdown message should be sent to the peer with the given node_id.
6190     */
6191    LDKMessageSendEvent_SendShutdown,
6192    /**
6193     * Used to indicate that a channel_reestablish message should be sent to the peer with the given node_id.
6194     */
6195    LDKMessageSendEvent_SendChannelReestablish,
6196    /**
6197     * Used to send a channel_announcement and channel_update to a specific peer, likely on
6198     * initial connection to ensure our peers know about our channels.
6199     */
6200    LDKMessageSendEvent_SendChannelAnnouncement,
6201    /**
6202     * Used to indicate that a channel_announcement and channel_update should be broadcast to all
6203     * peers (except the peer with node_id either msg.contents.node_id_1 or msg.contents.node_id_2).
6204     *
6205     * Note that after doing so, you very likely (unless you did so very recently) want to
6206     * broadcast a node_announcement (e.g. via [`PeerManager::broadcast_node_announcement`]). This
6207     * ensures that any nodes which see our channel_announcement also have a relevant
6208     * node_announcement, including relevant feature flags which may be important for routing
6209     * through or to us.
6210     *
6211     * [`PeerManager::broadcast_node_announcement`]: crate::ln::peer_handler::PeerManager::broadcast_node_announcement
6212     */
6213    LDKMessageSendEvent_BroadcastChannelAnnouncement,
6214    /**
6215     * Used to indicate that a channel_update should be broadcast to all peers.
6216     */
6217    LDKMessageSendEvent_BroadcastChannelUpdate,
6218    /**
6219     * Used to indicate that a node_announcement should be broadcast to all peers.
6220     */
6221    LDKMessageSendEvent_BroadcastNodeAnnouncement,
6222    /**
6223     * Used to indicate that a channel_update should be sent to a single peer.
6224     * In contrast to [`Self::BroadcastChannelUpdate`], this is used when the channel is a
6225     * private channel and we shouldn't be informing all of our peers of channel parameters.
6226     */
6227    LDKMessageSendEvent_SendChannelUpdate,
6228    /**
6229     * Broadcast an error downstream to be handled
6230     */
6231    LDKMessageSendEvent_HandleError,
6232    /**
6233     * Query a peer for channels with funding transaction UTXOs in a block range.
6234     */
6235    LDKMessageSendEvent_SendChannelRangeQuery,
6236    /**
6237     * Request routing gossip messages from a peer for a list of channels identified by
6238     * their short_channel_ids.
6239     */
6240    LDKMessageSendEvent_SendShortIdsQuery,
6241    /**
6242     * Sends a reply to a channel range query. This may be one of several SendReplyChannelRange events
6243     * emitted during processing of the query.
6244     */
6245    LDKMessageSendEvent_SendReplyChannelRange,
6246    /**
6247     * Sends a timestamp filter for inbound gossip. This should be sent on each new connection to
6248     * enable receiving gossip messages from the peer.
6249     */
6250    LDKMessageSendEvent_SendGossipTimestampFilter,
6251    /**
6252     * Must be last for serialization purposes
6253     */
6254    LDKMessageSendEvent_Sentinel,
6255 } LDKMessageSendEvent_Tag;
6256
6257 typedef struct LDKMessageSendEvent_LDKSendAcceptChannel_Body {
6258    /**
6259     * The node_id of the node which should receive this message
6260     */
6261    struct LDKPublicKey node_id;
6262    /**
6263     * The message which should be sent.
6264     */
6265    struct LDKAcceptChannel msg;
6266 } LDKMessageSendEvent_LDKSendAcceptChannel_Body;
6267
6268 typedef struct LDKMessageSendEvent_LDKSendOpenChannel_Body {
6269    /**
6270     * The node_id of the node which should receive this message
6271     */
6272    struct LDKPublicKey node_id;
6273    /**
6274     * The message which should be sent.
6275     */
6276    struct LDKOpenChannel msg;
6277 } LDKMessageSendEvent_LDKSendOpenChannel_Body;
6278
6279 typedef struct LDKMessageSendEvent_LDKSendFundingCreated_Body {
6280    /**
6281     * The node_id of the node which should receive this message
6282     */
6283    struct LDKPublicKey node_id;
6284    /**
6285     * The message which should be sent.
6286     */
6287    struct LDKFundingCreated msg;
6288 } LDKMessageSendEvent_LDKSendFundingCreated_Body;
6289
6290 typedef struct LDKMessageSendEvent_LDKSendFundingSigned_Body {
6291    /**
6292     * The node_id of the node which should receive this message
6293     */
6294    struct LDKPublicKey node_id;
6295    /**
6296     * The message which should be sent.
6297     */
6298    struct LDKFundingSigned msg;
6299 } LDKMessageSendEvent_LDKSendFundingSigned_Body;
6300
6301 typedef struct LDKMessageSendEvent_LDKSendChannelReady_Body {
6302    /**
6303     * The node_id of the node which should receive these message(s)
6304     */
6305    struct LDKPublicKey node_id;
6306    /**
6307     * The channel_ready message which should be sent.
6308     */
6309    struct LDKChannelReady msg;
6310 } LDKMessageSendEvent_LDKSendChannelReady_Body;
6311
6312 typedef struct LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body {
6313    /**
6314     * The node_id of the node which should receive these message(s)
6315     */
6316    struct LDKPublicKey node_id;
6317    /**
6318     * The announcement_signatures message which should be sent.
6319     */
6320    struct LDKAnnouncementSignatures msg;
6321 } LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body;
6322
6323 typedef struct LDKMessageSendEvent_LDKUpdateHTLCs_Body {
6324    /**
6325     * The node_id of the node which should receive these message(s)
6326     */
6327    struct LDKPublicKey node_id;
6328    /**
6329     * The update messages which should be sent. ALL messages in the struct should be sent!
6330     */
6331    struct LDKCommitmentUpdate updates;
6332 } LDKMessageSendEvent_LDKUpdateHTLCs_Body;
6333
6334 typedef struct LDKMessageSendEvent_LDKSendRevokeAndACK_Body {
6335    /**
6336     * The node_id of the node which should receive this message
6337     */
6338    struct LDKPublicKey node_id;
6339    /**
6340     * The message which should be sent.
6341     */
6342    struct LDKRevokeAndACK msg;
6343 } LDKMessageSendEvent_LDKSendRevokeAndACK_Body;
6344
6345 typedef struct LDKMessageSendEvent_LDKSendClosingSigned_Body {
6346    /**
6347     * The node_id of the node which should receive this message
6348     */
6349    struct LDKPublicKey node_id;
6350    /**
6351     * The message which should be sent.
6352     */
6353    struct LDKClosingSigned msg;
6354 } LDKMessageSendEvent_LDKSendClosingSigned_Body;
6355
6356 typedef struct LDKMessageSendEvent_LDKSendShutdown_Body {
6357    /**
6358     * The node_id of the node which should receive this message
6359     */
6360    struct LDKPublicKey node_id;
6361    /**
6362     * The message which should be sent.
6363     */
6364    struct LDKShutdown msg;
6365 } LDKMessageSendEvent_LDKSendShutdown_Body;
6366
6367 typedef struct LDKMessageSendEvent_LDKSendChannelReestablish_Body {
6368    /**
6369     * The node_id of the node which should receive this message
6370     */
6371    struct LDKPublicKey node_id;
6372    /**
6373     * The message which should be sent.
6374     */
6375    struct LDKChannelReestablish msg;
6376 } LDKMessageSendEvent_LDKSendChannelReestablish_Body;
6377
6378 typedef struct LDKMessageSendEvent_LDKSendChannelAnnouncement_Body {
6379    /**
6380     * The node_id of the node which should receive this message
6381     */
6382    struct LDKPublicKey node_id;
6383    /**
6384     * The channel_announcement which should be sent.
6385     */
6386    struct LDKChannelAnnouncement msg;
6387    /**
6388     * The followup channel_update which should be sent.
6389     */
6390    struct LDKChannelUpdate update_msg;
6391 } LDKMessageSendEvent_LDKSendChannelAnnouncement_Body;
6392
6393 typedef struct LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body {
6394    /**
6395     * The channel_announcement which should be sent.
6396     */
6397    struct LDKChannelAnnouncement msg;
6398    /**
6399     * The followup channel_update which should be sent.
6400     *
6401     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
6402     */
6403    struct LDKChannelUpdate update_msg;
6404 } LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body;
6405
6406 typedef struct LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body {
6407    /**
6408     * The channel_update which should be sent.
6409     */
6410    struct LDKChannelUpdate msg;
6411 } LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body;
6412
6413 typedef struct LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body {
6414    /**
6415     * The node_announcement which should be sent.
6416     */
6417    struct LDKNodeAnnouncement msg;
6418 } LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body;
6419
6420 typedef struct LDKMessageSendEvent_LDKSendChannelUpdate_Body {
6421    /**
6422     * The node_id of the node which should receive this message
6423     */
6424    struct LDKPublicKey node_id;
6425    /**
6426     * The channel_update which should be sent.
6427     */
6428    struct LDKChannelUpdate msg;
6429 } LDKMessageSendEvent_LDKSendChannelUpdate_Body;
6430
6431 typedef struct LDKMessageSendEvent_LDKHandleError_Body {
6432    /**
6433     * The node_id of the node which should receive this message
6434     */
6435    struct LDKPublicKey node_id;
6436    /**
6437     * The action which should be taken.
6438     */
6439    struct LDKErrorAction action;
6440 } LDKMessageSendEvent_LDKHandleError_Body;
6441
6442 typedef struct LDKMessageSendEvent_LDKSendChannelRangeQuery_Body {
6443    /**
6444     * The node_id of this message recipient
6445     */
6446    struct LDKPublicKey node_id;
6447    /**
6448     * The query_channel_range which should be sent.
6449     */
6450    struct LDKQueryChannelRange msg;
6451 } LDKMessageSendEvent_LDKSendChannelRangeQuery_Body;
6452
6453 typedef struct LDKMessageSendEvent_LDKSendShortIdsQuery_Body {
6454    /**
6455     * The node_id of this message recipient
6456     */
6457    struct LDKPublicKey node_id;
6458    /**
6459     * The query_short_channel_ids which should be sent.
6460     */
6461    struct LDKQueryShortChannelIds msg;
6462 } LDKMessageSendEvent_LDKSendShortIdsQuery_Body;
6463
6464 typedef struct LDKMessageSendEvent_LDKSendReplyChannelRange_Body {
6465    /**
6466     * The node_id of this message recipient
6467     */
6468    struct LDKPublicKey node_id;
6469    /**
6470     * The reply_channel_range which should be sent.
6471     */
6472    struct LDKReplyChannelRange msg;
6473 } LDKMessageSendEvent_LDKSendReplyChannelRange_Body;
6474
6475 typedef struct LDKMessageSendEvent_LDKSendGossipTimestampFilter_Body {
6476    /**
6477     * The node_id of this message recipient
6478     */
6479    struct LDKPublicKey node_id;
6480    /**
6481     * The gossip_timestamp_filter which should be sent.
6482     */
6483    struct LDKGossipTimestampFilter msg;
6484 } LDKMessageSendEvent_LDKSendGossipTimestampFilter_Body;
6485
6486 typedef struct MUST_USE_STRUCT LDKMessageSendEvent {
6487    LDKMessageSendEvent_Tag tag;
6488    union {
6489       LDKMessageSendEvent_LDKSendAcceptChannel_Body send_accept_channel;
6490       LDKMessageSendEvent_LDKSendOpenChannel_Body send_open_channel;
6491       LDKMessageSendEvent_LDKSendFundingCreated_Body send_funding_created;
6492       LDKMessageSendEvent_LDKSendFundingSigned_Body send_funding_signed;
6493       LDKMessageSendEvent_LDKSendChannelReady_Body send_channel_ready;
6494       LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body send_announcement_signatures;
6495       LDKMessageSendEvent_LDKUpdateHTLCs_Body update_htl_cs;
6496       LDKMessageSendEvent_LDKSendRevokeAndACK_Body send_revoke_and_ack;
6497       LDKMessageSendEvent_LDKSendClosingSigned_Body send_closing_signed;
6498       LDKMessageSendEvent_LDKSendShutdown_Body send_shutdown;
6499       LDKMessageSendEvent_LDKSendChannelReestablish_Body send_channel_reestablish;
6500       LDKMessageSendEvent_LDKSendChannelAnnouncement_Body send_channel_announcement;
6501       LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body broadcast_channel_announcement;
6502       LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body broadcast_channel_update;
6503       LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body broadcast_node_announcement;
6504       LDKMessageSendEvent_LDKSendChannelUpdate_Body send_channel_update;
6505       LDKMessageSendEvent_LDKHandleError_Body handle_error;
6506       LDKMessageSendEvent_LDKSendChannelRangeQuery_Body send_channel_range_query;
6507       LDKMessageSendEvent_LDKSendShortIdsQuery_Body send_short_ids_query;
6508       LDKMessageSendEvent_LDKSendReplyChannelRange_Body send_reply_channel_range;
6509       LDKMessageSendEvent_LDKSendGossipTimestampFilter_Body send_gossip_timestamp_filter;
6510    };
6511 } LDKMessageSendEvent;
6512
6513 /**
6514  * A dynamically-allocated array of crate::lightning::events::MessageSendEvents of arbitrary size.
6515  * This corresponds to std::vector in C++
6516  */
6517 typedef struct LDKCVec_MessageSendEventZ {
6518    /**
6519     * The elements in the array.
6520     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6521     */
6522    struct LDKMessageSendEvent *data;
6523    /**
6524     * The number of elements pointed to by `data`.
6525     */
6526    uintptr_t datalen;
6527 } LDKCVec_MessageSendEventZ;
6528
6529 /**
6530  * A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
6531  * This corresponds to std::vector in C++
6532  */
6533 typedef struct LDKCVec_ChainHashZ {
6534    /**
6535     * The elements in the array.
6536     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6537     */
6538    struct LDKThirtyTwoBytes *data;
6539    /**
6540     * The number of elements pointed to by `data`.
6541     */
6542    uintptr_t datalen;
6543 } LDKCVec_ChainHashZ;
6544
6545 /**
6546  * The contents of CResult_PublicKeyErrorZ
6547  */
6548 typedef union LDKCResult_PublicKeyErrorZPtr {
6549    /**
6550     * A pointer to the contents in the success state.
6551     * Reading from this pointer when `result_ok` is not set is undefined.
6552     */
6553    struct LDKPublicKey *result;
6554    /**
6555     * A pointer to the contents in the error state.
6556     * Reading from this pointer when `result_ok` is set is undefined.
6557     */
6558    enum LDKSecp256k1Error *err;
6559 } LDKCResult_PublicKeyErrorZPtr;
6560
6561 /**
6562  * A CResult_PublicKeyErrorZ represents the result of a fallible operation,
6563  * containing a crate::c_types::PublicKey on success and a crate::c_types::Secp256k1Error on failure.
6564  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6565  */
6566 typedef struct LDKCResult_PublicKeyErrorZ {
6567    /**
6568     * The contents of this CResult_PublicKeyErrorZ, accessible via either
6569     * `err` or `result` depending on the state of `result_ok`.
6570     */
6571    union LDKCResult_PublicKeyErrorZPtr contents;
6572    /**
6573     * Whether this CResult_PublicKeyErrorZ represents a success state.
6574     */
6575    bool result_ok;
6576 } LDKCResult_PublicKeyErrorZ;
6577
6578 /**
6579  * The contents of CResult_NodeIdDecodeErrorZ
6580  */
6581 typedef union LDKCResult_NodeIdDecodeErrorZPtr {
6582    /**
6583     * A pointer to the contents in the success state.
6584     * Reading from this pointer when `result_ok` is not set is undefined.
6585     */
6586    struct LDKNodeId *result;
6587    /**
6588     * A pointer to the contents in the error state.
6589     * Reading from this pointer when `result_ok` is set is undefined.
6590     */
6591    struct LDKDecodeError *err;
6592 } LDKCResult_NodeIdDecodeErrorZPtr;
6593
6594 /**
6595  * A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation,
6596  * containing a crate::lightning::routing::gossip::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure.
6597  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6598  */
6599 typedef struct LDKCResult_NodeIdDecodeErrorZ {
6600    /**
6601     * The contents of this CResult_NodeIdDecodeErrorZ, accessible via either
6602     * `err` or `result` depending on the state of `result_ok`.
6603     */
6604    union LDKCResult_NodeIdDecodeErrorZPtr contents;
6605    /**
6606     * Whether this CResult_NodeIdDecodeErrorZ represents a success state.
6607     */
6608    bool result_ok;
6609 } LDKCResult_NodeIdDecodeErrorZ;
6610
6611 /**
6612  * The contents of CResult_COption_NetworkUpdateZDecodeErrorZ
6613  */
6614 typedef union LDKCResult_COption_NetworkUpdateZDecodeErrorZPtr {
6615    /**
6616     * A pointer to the contents in the success state.
6617     * Reading from this pointer when `result_ok` is not set is undefined.
6618     */
6619    struct LDKCOption_NetworkUpdateZ *result;
6620    /**
6621     * A pointer to the contents in the error state.
6622     * Reading from this pointer when `result_ok` is set is undefined.
6623     */
6624    struct LDKDecodeError *err;
6625 } LDKCResult_COption_NetworkUpdateZDecodeErrorZPtr;
6626
6627 /**
6628  * A CResult_COption_NetworkUpdateZDecodeErrorZ represents the result of a fallible operation,
6629  * containing a crate::c_types::derived::COption_NetworkUpdateZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
6630  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6631  */
6632 typedef struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ {
6633    /**
6634     * The contents of this CResult_COption_NetworkUpdateZDecodeErrorZ, accessible via either
6635     * `err` or `result` depending on the state of `result_ok`.
6636     */
6637    union LDKCResult_COption_NetworkUpdateZDecodeErrorZPtr contents;
6638    /**
6639     * Whether this CResult_COption_NetworkUpdateZDecodeErrorZ represents a success state.
6640     */
6641    bool result_ok;
6642 } LDKCResult_COption_NetworkUpdateZDecodeErrorZ;
6643
6644 /**
6645  * The contents of CResult_TxOutUtxoLookupErrorZ
6646  */
6647 typedef union LDKCResult_TxOutUtxoLookupErrorZPtr {
6648    /**
6649     * A pointer to the contents in the success state.
6650     * Reading from this pointer when `result_ok` is not set is undefined.
6651     */
6652    struct LDKTxOut *result;
6653    /**
6654     * A pointer to the contents in the error state.
6655     * Reading from this pointer when `result_ok` is set is undefined.
6656     */
6657    enum LDKUtxoLookupError *err;
6658 } LDKCResult_TxOutUtxoLookupErrorZPtr;
6659
6660 /**
6661  * A CResult_TxOutUtxoLookupErrorZ represents the result of a fallible operation,
6662  * containing a crate::c_types::TxOut on success and a crate::lightning::routing::utxo::UtxoLookupError on failure.
6663  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6664  */
6665 typedef struct LDKCResult_TxOutUtxoLookupErrorZ {
6666    /**
6667     * The contents of this CResult_TxOutUtxoLookupErrorZ, accessible via either
6668     * `err` or `result` depending on the state of `result_ok`.
6669     */
6670    union LDKCResult_TxOutUtxoLookupErrorZPtr contents;
6671    /**
6672     * Whether this CResult_TxOutUtxoLookupErrorZ represents a success state.
6673     */
6674    bool result_ok;
6675 } LDKCResult_TxOutUtxoLookupErrorZ;
6676
6677
6678
6679 /**
6680  * Represents a future resolution of a [`UtxoLookup::get_utxo`] query resolving async.
6681  *
6682  * See [`UtxoResult::Async`] and [`UtxoFuture::resolve`] for more info.
6683  */
6684 typedef struct MUST_USE_STRUCT LDKUtxoFuture {
6685    /**
6686     * A pointer to the opaque Rust object.
6687     * Nearly everywhere, inner must be non-null, however in places where
6688     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6689     */
6690    LDKnativeUtxoFuture *inner;
6691    /**
6692     * Indicates that this is the only struct which contains the same pointer.
6693     * Rust functions which take ownership of an object provided via an argument require
6694     * this to be true and invalidate the object pointed to by inner.
6695     */
6696    bool is_owned;
6697 } LDKUtxoFuture;
6698
6699 /**
6700  * The result of a [`UtxoLookup::get_utxo`] call. A call may resolve either synchronously,
6701  * returning the `Sync` variant, or asynchronously, returning an [`UtxoFuture`] in the `Async`
6702  * variant.
6703  */
6704 typedef enum LDKUtxoResult_Tag {
6705    /**
6706     * A result which was resolved synchronously. It either includes a [`TxOut`] for the output
6707     * requested or a [`UtxoLookupError`].
6708     */
6709    LDKUtxoResult_Sync,
6710    /**
6711     * A result which will be resolved asynchronously. It includes a [`UtxoFuture`], a `clone` of
6712     * which you must keep locally and call [`UtxoFuture::resolve`] on once the lookup completes.
6713     *
6714     * Note that in order to avoid runaway memory usage, the number of parallel checks is limited,
6715     * but only fairly loosely. Because a pending checks block all message processing, leaving
6716     * checks pending for an extended time may cause DoS of other functions. It is recommended you
6717     * keep a tight timeout on lookups, on the order of a few seconds.
6718     */
6719    LDKUtxoResult_Async,
6720    /**
6721     * Must be last for serialization purposes
6722     */
6723    LDKUtxoResult_Sentinel,
6724 } LDKUtxoResult_Tag;
6725
6726 typedef struct MUST_USE_STRUCT LDKUtxoResult {
6727    LDKUtxoResult_Tag tag;
6728    union {
6729       struct {
6730          struct LDKCResult_TxOutUtxoLookupErrorZ sync;
6731       };
6732       struct {
6733          struct LDKUtxoFuture async;
6734       };
6735    };
6736 } LDKUtxoResult;
6737
6738 /**
6739  * The `UtxoLookup` trait defines behavior for accessing on-chain UTXOs.
6740  */
6741 typedef struct LDKUtxoLookup {
6742    /**
6743     * An opaque pointer which is passed to your function implementations as an argument.
6744     * This has no meaning in the LDK, and can be NULL or any other value.
6745     */
6746    void *this_arg;
6747    /**
6748     * Returns the transaction output of a funding transaction encoded by [`short_channel_id`].
6749     * Returns an error if `genesis_hash` is for a different chain or if such a transaction output
6750     * is unknown.
6751     *
6752     * [`short_channel_id`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#definition-of-short_channel_id
6753     */
6754    struct LDKUtxoResult (*get_utxo)(const void *this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id);
6755    /**
6756     * Frees any resources associated with this object given its this_arg pointer.
6757     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
6758     */
6759    void (*free)(void *this_arg);
6760 } LDKUtxoLookup;
6761
6762 /**
6763  * An enum which can either contain a crate::lightning::routing::utxo::UtxoLookup or not
6764  */
6765 typedef enum LDKCOption_UtxoLookupZ_Tag {
6766    /**
6767     * When we're in this state, this COption_UtxoLookupZ contains a crate::lightning::routing::utxo::UtxoLookup
6768     */
6769    LDKCOption_UtxoLookupZ_Some,
6770    /**
6771     * When we're in this state, this COption_UtxoLookupZ contains nothing
6772     */
6773    LDKCOption_UtxoLookupZ_None,
6774    /**
6775     * Must be last for serialization purposes
6776     */
6777    LDKCOption_UtxoLookupZ_Sentinel,
6778 } LDKCOption_UtxoLookupZ_Tag;
6779
6780 typedef struct LDKCOption_UtxoLookupZ {
6781    LDKCOption_UtxoLookupZ_Tag tag;
6782    union {
6783       struct {
6784          struct LDKUtxoLookup some;
6785       };
6786    };
6787 } LDKCOption_UtxoLookupZ;
6788
6789 /**
6790  * The contents of CResult_boolLightningErrorZ
6791  */
6792 typedef union LDKCResult_boolLightningErrorZPtr {
6793    /**
6794     * A pointer to the contents in the success state.
6795     * Reading from this pointer when `result_ok` is not set is undefined.
6796     */
6797    bool *result;
6798    /**
6799     * A pointer to the contents in the error state.
6800     * Reading from this pointer when `result_ok` is set is undefined.
6801     */
6802    struct LDKLightningError *err;
6803 } LDKCResult_boolLightningErrorZPtr;
6804
6805 /**
6806  * A CResult_boolLightningErrorZ represents the result of a fallible operation,
6807  * containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
6808  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6809  */
6810 typedef struct LDKCResult_boolLightningErrorZ {
6811    /**
6812     * The contents of this CResult_boolLightningErrorZ, accessible via either
6813     * `err` or `result` depending on the state of `result_ok`.
6814     */
6815    union LDKCResult_boolLightningErrorZPtr contents;
6816    /**
6817     * Whether this CResult_boolLightningErrorZ represents a success state.
6818     */
6819    bool result_ok;
6820 } LDKCResult_boolLightningErrorZ;
6821
6822 /**
6823  * A tuple of 3 elements. See the individual fields for the types contained.
6824  */
6825 typedef struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
6826    /**
6827     * The element at position 0
6828     */
6829    struct LDKChannelAnnouncement a;
6830    /**
6831     * The element at position 1
6832     */
6833    struct LDKChannelUpdate b;
6834    /**
6835     * The element at position 2
6836     */
6837    struct LDKChannelUpdate c;
6838 } LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ;
6839
6840 /**
6841  * An enum which can either contain a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ or not
6842  */
6843 typedef enum LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Tag {
6844    /**
6845     * When we're in this state, this COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ contains a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ
6846     */
6847    LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some,
6848    /**
6849     * When we're in this state, this COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ contains nothing
6850     */
6851    LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None,
6852    /**
6853     * Must be last for serialization purposes
6854     */
6855    LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Sentinel,
6856 } LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Tag;
6857
6858 typedef struct LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
6859    LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Tag tag;
6860    union {
6861       struct {
6862          struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ some;
6863       };
6864    };
6865 } LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ;
6866
6867 /**
6868  * The contents of CResult_NoneLightningErrorZ
6869  */
6870 typedef union LDKCResult_NoneLightningErrorZPtr {
6871    /**
6872     * Note that this value is always NULL, as there are no contents in the OK variant
6873     */
6874    void *result;
6875    /**
6876     * A pointer to the contents in the error state.
6877     * Reading from this pointer when `result_ok` is set is undefined.
6878     */
6879    struct LDKLightningError *err;
6880 } LDKCResult_NoneLightningErrorZPtr;
6881
6882 /**
6883  * A CResult_NoneLightningErrorZ represents the result of a fallible operation,
6884  * containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
6885  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6886  */
6887 typedef struct LDKCResult_NoneLightningErrorZ {
6888    /**
6889     * The contents of this CResult_NoneLightningErrorZ, accessible via either
6890     * `err` or `result` depending on the state of `result_ok`.
6891     */
6892    union LDKCResult_NoneLightningErrorZPtr contents;
6893    /**
6894     * Whether this CResult_NoneLightningErrorZ represents a success state.
6895     */
6896    bool result_ok;
6897 } LDKCResult_NoneLightningErrorZ;
6898
6899
6900
6901 /**
6902  * Details about one direction of a channel as received within a [`ChannelUpdate`].
6903  */
6904 typedef struct MUST_USE_STRUCT LDKChannelUpdateInfo {
6905    /**
6906     * A pointer to the opaque Rust object.
6907     * Nearly everywhere, inner must be non-null, however in places where
6908     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6909     */
6910    LDKnativeChannelUpdateInfo *inner;
6911    /**
6912     * Indicates that this is the only struct which contains the same pointer.
6913     * Rust functions which take ownership of an object provided via an argument require
6914     * this to be true and invalidate the object pointed to by inner.
6915     */
6916    bool is_owned;
6917 } LDKChannelUpdateInfo;
6918
6919 /**
6920  * The contents of CResult_ChannelUpdateInfoDecodeErrorZ
6921  */
6922 typedef union LDKCResult_ChannelUpdateInfoDecodeErrorZPtr {
6923    /**
6924     * A pointer to the contents in the success state.
6925     * Reading from this pointer when `result_ok` is not set is undefined.
6926     */
6927    struct LDKChannelUpdateInfo *result;
6928    /**
6929     * A pointer to the contents in the error state.
6930     * Reading from this pointer when `result_ok` is set is undefined.
6931     */
6932    struct LDKDecodeError *err;
6933 } LDKCResult_ChannelUpdateInfoDecodeErrorZPtr;
6934
6935 /**
6936  * A CResult_ChannelUpdateInfoDecodeErrorZ represents the result of a fallible operation,
6937  * containing a crate::lightning::routing::gossip::ChannelUpdateInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
6938  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6939  */
6940 typedef struct LDKCResult_ChannelUpdateInfoDecodeErrorZ {
6941    /**
6942     * The contents of this CResult_ChannelUpdateInfoDecodeErrorZ, accessible via either
6943     * `err` or `result` depending on the state of `result_ok`.
6944     */
6945    union LDKCResult_ChannelUpdateInfoDecodeErrorZPtr contents;
6946    /**
6947     * Whether this CResult_ChannelUpdateInfoDecodeErrorZ represents a success state.
6948     */
6949    bool result_ok;
6950 } LDKCResult_ChannelUpdateInfoDecodeErrorZ;
6951
6952
6953
6954 /**
6955  * Details about a channel (both directions).
6956  * Received within a channel announcement.
6957  */
6958 typedef struct MUST_USE_STRUCT LDKChannelInfo {
6959    /**
6960     * A pointer to the opaque Rust object.
6961     * Nearly everywhere, inner must be non-null, however in places where
6962     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6963     */
6964    LDKnativeChannelInfo *inner;
6965    /**
6966     * Indicates that this is the only struct which contains the same pointer.
6967     * Rust functions which take ownership of an object provided via an argument require
6968     * this to be true and invalidate the object pointed to by inner.
6969     */
6970    bool is_owned;
6971 } LDKChannelInfo;
6972
6973 /**
6974  * The contents of CResult_ChannelInfoDecodeErrorZ
6975  */
6976 typedef union LDKCResult_ChannelInfoDecodeErrorZPtr {
6977    /**
6978     * A pointer to the contents in the success state.
6979     * Reading from this pointer when `result_ok` is not set is undefined.
6980     */
6981    struct LDKChannelInfo *result;
6982    /**
6983     * A pointer to the contents in the error state.
6984     * Reading from this pointer when `result_ok` is set is undefined.
6985     */
6986    struct LDKDecodeError *err;
6987 } LDKCResult_ChannelInfoDecodeErrorZPtr;
6988
6989 /**
6990  * A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
6991  * containing a crate::lightning::routing::gossip::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
6992  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6993  */
6994 typedef struct LDKCResult_ChannelInfoDecodeErrorZ {
6995    /**
6996     * The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
6997     * `err` or `result` depending on the state of `result_ok`.
6998     */
6999    union LDKCResult_ChannelInfoDecodeErrorZPtr contents;
7000    /**
7001     * Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
7002     */
7003    bool result_ok;
7004 } LDKCResult_ChannelInfoDecodeErrorZ;
7005
7006
7007
7008 /**
7009  * Fees for routing via a given channel or a node
7010  */
7011 typedef struct MUST_USE_STRUCT LDKRoutingFees {
7012    /**
7013     * A pointer to the opaque Rust object.
7014     * Nearly everywhere, inner must be non-null, however in places where
7015     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7016     */
7017    LDKnativeRoutingFees *inner;
7018    /**
7019     * Indicates that this is the only struct which contains the same pointer.
7020     * Rust functions which take ownership of an object provided via an argument require
7021     * this to be true and invalidate the object pointed to by inner.
7022     */
7023    bool is_owned;
7024 } LDKRoutingFees;
7025
7026 /**
7027  * The contents of CResult_RoutingFeesDecodeErrorZ
7028  */
7029 typedef union LDKCResult_RoutingFeesDecodeErrorZPtr {
7030    /**
7031     * A pointer to the contents in the success state.
7032     * Reading from this pointer when `result_ok` is not set is undefined.
7033     */
7034    struct LDKRoutingFees *result;
7035    /**
7036     * A pointer to the contents in the error state.
7037     * Reading from this pointer when `result_ok` is set is undefined.
7038     */
7039    struct LDKDecodeError *err;
7040 } LDKCResult_RoutingFeesDecodeErrorZPtr;
7041
7042 /**
7043  * A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
7044  * containing a crate::lightning::routing::gossip::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
7045  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7046  */
7047 typedef struct LDKCResult_RoutingFeesDecodeErrorZ {
7048    /**
7049     * The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
7050     * `err` or `result` depending on the state of `result_ok`.
7051     */
7052    union LDKCResult_RoutingFeesDecodeErrorZPtr contents;
7053    /**
7054     * Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
7055     */
7056    bool result_ok;
7057 } LDKCResult_RoutingFeesDecodeErrorZ;
7058
7059 /**
7060  * A 4-byte byte array.
7061  */
7062 typedef struct LDKFourBytes {
7063    /**
7064     * The four bytes
7065     */
7066    uint8_t data[4];
7067 } LDKFourBytes;
7068
7069 /**
7070  * A 12-byte byte array.
7071  */
7072 typedef struct LDKTwelveBytes {
7073    /**
7074     * The twelve bytes
7075     */
7076    uint8_t data[12];
7077 } LDKTwelveBytes;
7078
7079
7080
7081 /**
7082  * Represents a hostname for serialization purposes.
7083  * Only the character set and length will be validated.
7084  * The character set consists of ASCII alphanumeric characters, hyphens, and periods.
7085  * Its length is guaranteed to be representable by a single byte.
7086  * This serialization is used by [`BOLT 7`] hostnames.
7087  *
7088  * [`BOLT 7`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md
7089  */
7090 typedef struct MUST_USE_STRUCT LDKHostname {
7091    /**
7092     * A pointer to the opaque Rust object.
7093     * Nearly everywhere, inner must be non-null, however in places where
7094     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7095     */
7096    LDKnativeHostname *inner;
7097    /**
7098     * Indicates that this is the only struct which contains the same pointer.
7099     * Rust functions which take ownership of an object provided via an argument require
7100     * this to be true and invalidate the object pointed to by inner.
7101     */
7102    bool is_owned;
7103 } LDKHostname;
7104
7105 /**
7106  * An address which can be used to connect to a remote peer.
7107  */
7108 typedef enum LDKNetAddress_Tag {
7109    /**
7110     * An IPv4 address/port on which the peer is listening.
7111     */
7112    LDKNetAddress_IPv4,
7113    /**
7114     * An IPv6 address/port on which the peer is listening.
7115     */
7116    LDKNetAddress_IPv6,
7117    /**
7118     * An old-style Tor onion address/port on which the peer is listening.
7119     *
7120     * This field is deprecated and the Tor network generally no longer supports V2 Onion
7121     * addresses. Thus, the details are not parsed here.
7122     */
7123    LDKNetAddress_OnionV2,
7124    /**
7125     * A new-style Tor onion address/port on which the peer is listening.
7126     *
7127     * To create the human-readable \"hostname\", concatenate the ED25519 pubkey, checksum, and version,
7128     * wrap as base32 and append \".onion\".
7129     */
7130    LDKNetAddress_OnionV3,
7131    /**
7132     * A hostname/port on which the peer is listening.
7133     */
7134    LDKNetAddress_Hostname,
7135    /**
7136     * Must be last for serialization purposes
7137     */
7138    LDKNetAddress_Sentinel,
7139 } LDKNetAddress_Tag;
7140
7141 typedef struct LDKNetAddress_LDKIPv4_Body {
7142    /**
7143     * The 4-byte IPv4 address
7144     */
7145    struct LDKFourBytes addr;
7146    /**
7147     * The port on which the node is listening
7148     */
7149    uint16_t port;
7150 } LDKNetAddress_LDKIPv4_Body;
7151
7152 typedef struct LDKNetAddress_LDKIPv6_Body {
7153    /**
7154     * The 16-byte IPv6 address
7155     */
7156    struct LDKSixteenBytes addr;
7157    /**
7158     * The port on which the node is listening
7159     */
7160    uint16_t port;
7161 } LDKNetAddress_LDKIPv6_Body;
7162
7163 typedef struct LDKNetAddress_LDKOnionV3_Body {
7164    /**
7165     * The ed25519 long-term public key of the peer
7166     */
7167    struct LDKThirtyTwoBytes ed25519_pubkey;
7168    /**
7169     * The checksum of the pubkey and version, as included in the onion address
7170     */
7171    uint16_t checksum;
7172    /**
7173     * The version byte, as defined by the Tor Onion v3 spec.
7174     */
7175    uint8_t version;
7176    /**
7177     * The port on which the node is listening
7178     */
7179    uint16_t port;
7180 } LDKNetAddress_LDKOnionV3_Body;
7181
7182 typedef struct LDKNetAddress_LDKHostname_Body {
7183    /**
7184     * The hostname on which the node is listening.
7185     */
7186    struct LDKHostname hostname;
7187    /**
7188     * The port on which the node is listening.
7189     */
7190    uint16_t port;
7191 } LDKNetAddress_LDKHostname_Body;
7192
7193 typedef struct MUST_USE_STRUCT LDKNetAddress {
7194    LDKNetAddress_Tag tag;
7195    union {
7196       LDKNetAddress_LDKIPv4_Body i_pv4;
7197       LDKNetAddress_LDKIPv6_Body i_pv6;
7198       struct {
7199          struct LDKTwelveBytes onion_v2;
7200       };
7201       LDKNetAddress_LDKOnionV3_Body onion_v3;
7202       LDKNetAddress_LDKHostname_Body hostname;
7203    };
7204 } LDKNetAddress;
7205
7206 /**
7207  * A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
7208  * This corresponds to std::vector in C++
7209  */
7210 typedef struct LDKCVec_NetAddressZ {
7211    /**
7212     * The elements in the array.
7213     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7214     */
7215    struct LDKNetAddress *data;
7216    /**
7217     * The number of elements pointed to by `data`.
7218     */
7219    uintptr_t datalen;
7220 } LDKCVec_NetAddressZ;
7221
7222
7223
7224 /**
7225  * Information received in the latest node_announcement from this node.
7226  */
7227 typedef struct MUST_USE_STRUCT LDKNodeAnnouncementInfo {
7228    /**
7229     * A pointer to the opaque Rust object.
7230     * Nearly everywhere, inner must be non-null, however in places where
7231     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7232     */
7233    LDKnativeNodeAnnouncementInfo *inner;
7234    /**
7235     * Indicates that this is the only struct which contains the same pointer.
7236     * Rust functions which take ownership of an object provided via an argument require
7237     * this to be true and invalidate the object pointed to by inner.
7238     */
7239    bool is_owned;
7240 } LDKNodeAnnouncementInfo;
7241
7242 /**
7243  * The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
7244  */
7245 typedef union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr {
7246    /**
7247     * A pointer to the contents in the success state.
7248     * Reading from this pointer when `result_ok` is not set is undefined.
7249     */
7250    struct LDKNodeAnnouncementInfo *result;
7251    /**
7252     * A pointer to the contents in the error state.
7253     * Reading from this pointer when `result_ok` is set is undefined.
7254     */
7255    struct LDKDecodeError *err;
7256 } LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr;
7257
7258 /**
7259  * A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
7260  * containing a crate::lightning::routing::gossip::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
7261  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7262  */
7263 typedef struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ {
7264    /**
7265     * The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
7266     * `err` or `result` depending on the state of `result_ok`.
7267     */
7268    union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr contents;
7269    /**
7270     * Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
7271     */
7272    bool result_ok;
7273 } LDKCResult_NodeAnnouncementInfoDecodeErrorZ;
7274
7275
7276
7277 /**
7278  * A user-defined name for a node, which may be used when displaying the node in a graph.
7279  *
7280  * Since node aliases are provided by third parties, they are a potential avenue for injection
7281  * attacks. Care must be taken when processing.
7282  */
7283 typedef struct MUST_USE_STRUCT LDKNodeAlias {
7284    /**
7285     * A pointer to the opaque Rust object.
7286     * Nearly everywhere, inner must be non-null, however in places where
7287     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7288     */
7289    LDKnativeNodeAlias *inner;
7290    /**
7291     * Indicates that this is the only struct which contains the same pointer.
7292     * Rust functions which take ownership of an object provided via an argument require
7293     * this to be true and invalidate the object pointed to by inner.
7294     */
7295    bool is_owned;
7296 } LDKNodeAlias;
7297
7298 /**
7299  * The contents of CResult_NodeAliasDecodeErrorZ
7300  */
7301 typedef union LDKCResult_NodeAliasDecodeErrorZPtr {
7302    /**
7303     * A pointer to the contents in the success state.
7304     * Reading from this pointer when `result_ok` is not set is undefined.
7305     */
7306    struct LDKNodeAlias *result;
7307    /**
7308     * A pointer to the contents in the error state.
7309     * Reading from this pointer when `result_ok` is set is undefined.
7310     */
7311    struct LDKDecodeError *err;
7312 } LDKCResult_NodeAliasDecodeErrorZPtr;
7313
7314 /**
7315  * A CResult_NodeAliasDecodeErrorZ represents the result of a fallible operation,
7316  * containing a crate::lightning::routing::gossip::NodeAlias on success and a crate::lightning::ln::msgs::DecodeError on failure.
7317  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7318  */
7319 typedef struct LDKCResult_NodeAliasDecodeErrorZ {
7320    /**
7321     * The contents of this CResult_NodeAliasDecodeErrorZ, accessible via either
7322     * `err` or `result` depending on the state of `result_ok`.
7323     */
7324    union LDKCResult_NodeAliasDecodeErrorZPtr contents;
7325    /**
7326     * Whether this CResult_NodeAliasDecodeErrorZ represents a success state.
7327     */
7328    bool result_ok;
7329 } LDKCResult_NodeAliasDecodeErrorZ;
7330
7331
7332
7333 /**
7334  * Details about a node in the network, known from the network announcement.
7335  */
7336 typedef struct MUST_USE_STRUCT LDKNodeInfo {
7337    /**
7338     * A pointer to the opaque Rust object.
7339     * Nearly everywhere, inner must be non-null, however in places where
7340     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7341     */
7342    LDKnativeNodeInfo *inner;
7343    /**
7344     * Indicates that this is the only struct which contains the same pointer.
7345     * Rust functions which take ownership of an object provided via an argument require
7346     * this to be true and invalidate the object pointed to by inner.
7347     */
7348    bool is_owned;
7349 } LDKNodeInfo;
7350
7351 /**
7352  * The contents of CResult_NodeInfoDecodeErrorZ
7353  */
7354 typedef union LDKCResult_NodeInfoDecodeErrorZPtr {
7355    /**
7356     * A pointer to the contents in the success state.
7357     * Reading from this pointer when `result_ok` is not set is undefined.
7358     */
7359    struct LDKNodeInfo *result;
7360    /**
7361     * A pointer to the contents in the error state.
7362     * Reading from this pointer when `result_ok` is set is undefined.
7363     */
7364    struct LDKDecodeError *err;
7365 } LDKCResult_NodeInfoDecodeErrorZPtr;
7366
7367 /**
7368  * A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
7369  * containing a crate::lightning::routing::gossip::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
7370  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7371  */
7372 typedef struct LDKCResult_NodeInfoDecodeErrorZ {
7373    /**
7374     * The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
7375     * `err` or `result` depending on the state of `result_ok`.
7376     */
7377    union LDKCResult_NodeInfoDecodeErrorZPtr contents;
7378    /**
7379     * Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
7380     */
7381    bool result_ok;
7382 } LDKCResult_NodeInfoDecodeErrorZ;
7383
7384 /**
7385  * The contents of CResult_NetworkGraphDecodeErrorZ
7386  */
7387 typedef union LDKCResult_NetworkGraphDecodeErrorZPtr {
7388    /**
7389     * A pointer to the contents in the success state.
7390     * Reading from this pointer when `result_ok` is not set is undefined.
7391     */
7392    struct LDKNetworkGraph *result;
7393    /**
7394     * A pointer to the contents in the error state.
7395     * Reading from this pointer when `result_ok` is set is undefined.
7396     */
7397    struct LDKDecodeError *err;
7398 } LDKCResult_NetworkGraphDecodeErrorZPtr;
7399
7400 /**
7401  * A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
7402  * containing a crate::lightning::routing::gossip::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
7403  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7404  */
7405 typedef struct LDKCResult_NetworkGraphDecodeErrorZ {
7406    /**
7407     * The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
7408     * `err` or `result` depending on the state of `result_ok`.
7409     */
7410    union LDKCResult_NetworkGraphDecodeErrorZPtr contents;
7411    /**
7412     * Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
7413     */
7414    bool result_ok;
7415 } LDKCResult_NetworkGraphDecodeErrorZ;
7416
7417 /**
7418  * An enum which can either contain a crate::c_types::derived::CVec_NetAddressZ or not
7419  */
7420 typedef enum LDKCOption_CVec_NetAddressZZ_Tag {
7421    /**
7422     * When we're in this state, this COption_CVec_NetAddressZZ contains a crate::c_types::derived::CVec_NetAddressZ
7423     */
7424    LDKCOption_CVec_NetAddressZZ_Some,
7425    /**
7426     * When we're in this state, this COption_CVec_NetAddressZZ contains nothing
7427     */
7428    LDKCOption_CVec_NetAddressZZ_None,
7429    /**
7430     * Must be last for serialization purposes
7431     */
7432    LDKCOption_CVec_NetAddressZZ_Sentinel,
7433 } LDKCOption_CVec_NetAddressZZ_Tag;
7434
7435 typedef struct LDKCOption_CVec_NetAddressZZ {
7436    LDKCOption_CVec_NetAddressZZ_Tag tag;
7437    union {
7438       struct {
7439          struct LDKCVec_NetAddressZ some;
7440       };
7441    };
7442 } LDKCOption_CVec_NetAddressZZ;
7443
7444 /**
7445  * The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
7446  */
7447 typedef union LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
7448    /**
7449     * A pointer to the contents in the success state.
7450     * Reading from this pointer when `result_ok` is not set is undefined.
7451     */
7452    struct LDKDelayedPaymentOutputDescriptor *result;
7453    /**
7454     * A pointer to the contents in the error state.
7455     * Reading from this pointer when `result_ok` is set is undefined.
7456     */
7457    struct LDKDecodeError *err;
7458 } LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr;
7459
7460 /**
7461  * A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
7462  * containing a crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
7463  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7464  */
7465 typedef struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
7466    /**
7467     * The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
7468     * `err` or `result` depending on the state of `result_ok`.
7469     */
7470    union LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr contents;
7471    /**
7472     * Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
7473     */
7474    bool result_ok;
7475 } LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ;
7476
7477 /**
7478  * The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
7479  */
7480 typedef union LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
7481    /**
7482     * A pointer to the contents in the success state.
7483     * Reading from this pointer when `result_ok` is not set is undefined.
7484     */
7485    struct LDKStaticPaymentOutputDescriptor *result;
7486    /**
7487     * A pointer to the contents in the error state.
7488     * Reading from this pointer when `result_ok` is set is undefined.
7489     */
7490    struct LDKDecodeError *err;
7491 } LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr;
7492
7493 /**
7494  * A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
7495  * containing a crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
7496  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7497  */
7498 typedef struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ {
7499    /**
7500     * The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
7501     * `err` or `result` depending on the state of `result_ok`.
7502     */
7503    union LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr contents;
7504    /**
7505     * Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
7506     */
7507    bool result_ok;
7508 } LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ;
7509
7510 /**
7511  * The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
7512  */
7513 typedef union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr {
7514    /**
7515     * A pointer to the contents in the success state.
7516     * Reading from this pointer when `result_ok` is not set is undefined.
7517     */
7518    struct LDKSpendableOutputDescriptor *result;
7519    /**
7520     * A pointer to the contents in the error state.
7521     * Reading from this pointer when `result_ok` is set is undefined.
7522     */
7523    struct LDKDecodeError *err;
7524 } LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr;
7525
7526 /**
7527  * A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
7528  * containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
7529  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7530  */
7531 typedef struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ {
7532    /**
7533     * The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
7534     * `err` or `result` depending on the state of `result_ok`.
7535     */
7536    union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr contents;
7537    /**
7538     * Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
7539     */
7540    bool result_ok;
7541 } LDKCResult_SpendableOutputDescriptorDecodeErrorZ;
7542
7543 /**
7544  * A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
7545  * This corresponds to std::vector in C++
7546  */
7547 typedef struct LDKCVec_PaymentPreimageZ {
7548    /**
7549     * The elements in the array.
7550     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7551     */
7552    struct LDKThirtyTwoBytes *data;
7553    /**
7554     * The number of elements pointed to by `data`.
7555     */
7556    uintptr_t datalen;
7557 } LDKCVec_PaymentPreimageZ;
7558
7559 /**
7560  * A tuple of 2 elements. See the individual fields for the types contained.
7561  */
7562 typedef struct LDKC2Tuple_SignatureCVec_SignatureZZ {
7563    /**
7564     * The element at position 0
7565     */
7566    struct LDKSignature a;
7567    /**
7568     * The element at position 1
7569     */
7570    struct LDKCVec_SignatureZ b;
7571 } LDKC2Tuple_SignatureCVec_SignatureZZ;
7572
7573 /**
7574  * The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
7575  */
7576 typedef union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
7577    /**
7578     * A pointer to the contents in the success state.
7579     * Reading from this pointer when `result_ok` is not set is undefined.
7580     */
7581    struct LDKC2Tuple_SignatureCVec_SignatureZZ *result;
7582    /**
7583     * Note that this value is always NULL, as there are no contents in the Err variant
7584     */
7585    void *err;
7586 } LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr;
7587
7588 /**
7589  * A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
7590  * containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
7591  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7592  */
7593 typedef struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
7594    /**
7595     * The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
7596     * `err` or `result` depending on the state of `result_ok`.
7597     */
7598    union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr contents;
7599    /**
7600     * Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
7601     */
7602    bool result_ok;
7603 } LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ;
7604
7605 /**
7606  * The contents of CResult_SignatureNoneZ
7607  */
7608 typedef union LDKCResult_SignatureNoneZPtr {
7609    /**
7610     * A pointer to the contents in the success state.
7611     * Reading from this pointer when `result_ok` is not set is undefined.
7612     */
7613    struct LDKSignature *result;
7614    /**
7615     * Note that this value is always NULL, as there are no contents in the Err variant
7616     */
7617    void *err;
7618 } LDKCResult_SignatureNoneZPtr;
7619
7620 /**
7621  * A CResult_SignatureNoneZ represents the result of a fallible operation,
7622  * containing a crate::c_types::Signature on success and a () on failure.
7623  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7624  */
7625 typedef struct LDKCResult_SignatureNoneZ {
7626    /**
7627     * The contents of this CResult_SignatureNoneZ, accessible via either
7628     * `err` or `result` depending on the state of `result_ok`.
7629     */
7630    union LDKCResult_SignatureNoneZPtr contents;
7631    /**
7632     * Whether this CResult_SignatureNoneZ represents a success state.
7633     */
7634    bool result_ok;
7635 } LDKCResult_SignatureNoneZ;
7636
7637 /**
7638  * The contents of CResult_PublicKeyNoneZ
7639  */
7640 typedef union LDKCResult_PublicKeyNoneZPtr {
7641    /**
7642     * A pointer to the contents in the success state.
7643     * Reading from this pointer when `result_ok` is not set is undefined.
7644     */
7645    struct LDKPublicKey *result;
7646    /**
7647     * Note that this value is always NULL, as there are no contents in the Err variant
7648     */
7649    void *err;
7650 } LDKCResult_PublicKeyNoneZPtr;
7651
7652 /**
7653  * A CResult_PublicKeyNoneZ represents the result of a fallible operation,
7654  * containing a crate::c_types::PublicKey on success and a () on failure.
7655  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7656  */
7657 typedef struct LDKCResult_PublicKeyNoneZ {
7658    /**
7659     * The contents of this CResult_PublicKeyNoneZ, accessible via either
7660     * `err` or `result` depending on the state of `result_ok`.
7661     */
7662    union LDKCResult_PublicKeyNoneZPtr contents;
7663    /**
7664     * Whether this CResult_PublicKeyNoneZ represents a success state.
7665     */
7666    bool result_ok;
7667 } LDKCResult_PublicKeyNoneZ;
7668
7669 /**
7670  * An enum which can either contain a crate::c_types::BigEndianScalar or not
7671  */
7672 typedef enum LDKCOption_ScalarZ_Tag {
7673    /**
7674     * When we're in this state, this COption_ScalarZ contains a crate::c_types::BigEndianScalar
7675     */
7676    LDKCOption_ScalarZ_Some,
7677    /**
7678     * When we're in this state, this COption_ScalarZ contains nothing
7679     */
7680    LDKCOption_ScalarZ_None,
7681    /**
7682     * Must be last for serialization purposes
7683     */
7684    LDKCOption_ScalarZ_Sentinel,
7685 } LDKCOption_ScalarZ_Tag;
7686
7687 typedef struct LDKCOption_ScalarZ {
7688    LDKCOption_ScalarZ_Tag tag;
7689    union {
7690       struct {
7691          struct LDKBigEndianScalar some;
7692       };
7693    };
7694 } LDKCOption_ScalarZ;
7695
7696 /**
7697  * The contents of CResult_SharedSecretNoneZ
7698  */
7699 typedef union LDKCResult_SharedSecretNoneZPtr {
7700    /**
7701     * A pointer to the contents in the success state.
7702     * Reading from this pointer when `result_ok` is not set is undefined.
7703     */
7704    struct LDKThirtyTwoBytes *result;
7705    /**
7706     * Note that this value is always NULL, as there are no contents in the Err variant
7707     */
7708    void *err;
7709 } LDKCResult_SharedSecretNoneZPtr;
7710
7711 /**
7712  * A CResult_SharedSecretNoneZ represents the result of a fallible operation,
7713  * containing a crate::c_types::ThirtyTwoBytes on success and a () on failure.
7714  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7715  */
7716 typedef struct LDKCResult_SharedSecretNoneZ {
7717    /**
7718     * The contents of this CResult_SharedSecretNoneZ, accessible via either
7719     * `err` or `result` depending on the state of `result_ok`.
7720     */
7721    union LDKCResult_SharedSecretNoneZPtr contents;
7722    /**
7723     * Whether this CResult_SharedSecretNoneZ represents a success state.
7724     */
7725    bool result_ok;
7726 } LDKCResult_SharedSecretNoneZ;
7727
7728 /**
7729  * Integer in the range `0..32`
7730  */
7731 typedef struct LDKU5 {
7732    uint8_t _0;
7733 } LDKU5;
7734
7735 /**
7736  * A dynamically-allocated array of crate::c_types::U5s of arbitrary size.
7737  * This corresponds to std::vector in C++
7738  */
7739 typedef struct LDKCVec_U5Z {
7740    /**
7741     * The elements in the array.
7742     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7743     */
7744    struct LDKU5 *data;
7745    /**
7746     * The number of elements pointed to by `data`.
7747     */
7748    uintptr_t datalen;
7749 } LDKCVec_U5Z;
7750
7751 /**
7752  * Represents a secp256k1 signature serialized as two 32-byte numbers as well as a tag which
7753  * allows recovering the exact public key which created the signature given the message.
7754  */
7755 typedef struct LDKRecoverableSignature {
7756    /**
7757     * The bytes of the signature in "compact" form plus a "Recovery ID" which allows for
7758     * recovery.
7759     */
7760    uint8_t serialized_form[68];
7761 } LDKRecoverableSignature;
7762
7763 /**
7764  * The contents of CResult_RecoverableSignatureNoneZ
7765  */
7766 typedef union LDKCResult_RecoverableSignatureNoneZPtr {
7767    /**
7768     * A pointer to the contents in the success state.
7769     * Reading from this pointer when `result_ok` is not set is undefined.
7770     */
7771    struct LDKRecoverableSignature *result;
7772    /**
7773     * Note that this value is always NULL, as there are no contents in the Err variant
7774     */
7775    void *err;
7776 } LDKCResult_RecoverableSignatureNoneZPtr;
7777
7778 /**
7779  * A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
7780  * containing a crate::c_types::RecoverableSignature on success and a () on failure.
7781  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7782  */
7783 typedef struct LDKCResult_RecoverableSignatureNoneZ {
7784    /**
7785     * The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
7786     * `err` or `result` depending on the state of `result_ok`.
7787     */
7788    union LDKCResult_RecoverableSignatureNoneZPtr contents;
7789    /**
7790     * Whether this CResult_RecoverableSignatureNoneZ represents a success state.
7791     */
7792    bool result_ok;
7793 } LDKCResult_RecoverableSignatureNoneZ;
7794
7795
7796
7797 /**
7798  * This class tracks the per-transaction information needed to build a closing transaction and will
7799  * actually build it and sign.
7800  *
7801  * This class can be used inside a signer implementation to generate a signature given the relevant
7802  * secret key.
7803  */
7804 typedef struct MUST_USE_STRUCT LDKClosingTransaction {
7805    /**
7806     * A pointer to the opaque Rust object.
7807     * Nearly everywhere, inner must be non-null, however in places where
7808     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7809     */
7810    LDKnativeClosingTransaction *inner;
7811    /**
7812     * Indicates that this is the only struct which contains the same pointer.
7813     * Rust functions which take ownership of an object provided via an argument require
7814     * this to be true and invalidate the object pointed to by inner.
7815     */
7816    bool is_owned;
7817 } LDKClosingTransaction;
7818
7819
7820
7821 /**
7822  * The unsigned part of a [`channel_announcement`] message.
7823  *
7824  * [`channel_announcement`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-channel_announcement-message
7825  */
7826 typedef struct MUST_USE_STRUCT LDKUnsignedChannelAnnouncement {
7827    /**
7828     * A pointer to the opaque Rust object.
7829     * Nearly everywhere, inner must be non-null, however in places where
7830     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7831     */
7832    LDKnativeUnsignedChannelAnnouncement *inner;
7833    /**
7834     * Indicates that this is the only struct which contains the same pointer.
7835     * Rust functions which take ownership of an object provided via an argument require
7836     * this to be true and invalidate the object pointed to by inner.
7837     */
7838    bool is_owned;
7839 } LDKUnsignedChannelAnnouncement;
7840
7841 /**
7842  * A trait to handle Lightning channel key material without concretizing the channel type or
7843  * the signature mechanism.
7844  */
7845 typedef struct LDKChannelSigner {
7846    /**
7847     * An opaque pointer which is passed to your function implementations as an argument.
7848     * This has no meaning in the LDK, and can be NULL or any other value.
7849     */
7850    void *this_arg;
7851    /**
7852     * Gets the per-commitment point for a specific commitment number
7853     *
7854     * Note that the commitment number starts at `(1 << 48) - 1` and counts backwards.
7855     */
7856    struct LDKPublicKey (*get_per_commitment_point)(const void *this_arg, uint64_t idx);
7857    /**
7858     * Gets the commitment secret for a specific commitment number as part of the revocation process
7859     *
7860     * An external signer implementation should error here if the commitment was already signed
7861     * and should refuse to sign it in the future.
7862     *
7863     * May be called more than once for the same index.
7864     *
7865     * Note that the commitment number starts at `(1 << 48) - 1` and counts backwards.
7866     */
7867    struct LDKThirtyTwoBytes (*release_commitment_secret)(const void *this_arg, uint64_t idx);
7868    /**
7869     * Validate the counterparty's signatures on the holder commitment transaction and HTLCs.
7870     *
7871     * This is required in order for the signer to make sure that releasing a commitment
7872     * secret won't leave us without a broadcastable holder transaction.
7873     * Policy checks should be implemented in this function, including checking the amount
7874     * sent to us and checking the HTLCs.
7875     *
7876     * The preimages of outgoing HTLCs that were fulfilled since the last commitment are provided.
7877     * A validating signer should ensure that an HTLC output is removed only when the matching
7878     * preimage is provided, or when the value to holder is restored.
7879     *
7880     * Note that all the relevant preimages will be provided, but there may also be additional
7881     * irrelevant or duplicate preimages.
7882     */
7883    struct LDKCResult_NoneNoneZ (*validate_holder_commitment)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR holder_tx, struct LDKCVec_PaymentPreimageZ preimages);
7884    /**
7885     * Returns the holder's channel public keys and basepoints.
7886     */
7887    struct LDKChannelPublicKeys pubkeys;
7888    /**
7889     * Fill in the pubkeys field as a reference to it will be given to Rust after this returns
7890     * Note that this takes a pointer to this object, not the this_ptr like other methods do
7891     * This function pointer may be NULL if pubkeys is filled in when this object is created and never needs updating.
7892     */
7893    void (*set_pubkeys)(const struct LDKChannelSigner*NONNULL_PTR );
7894    /**
7895     * Returns an arbitrary identifier describing the set of keys which are provided back to you in
7896     * some [`SpendableOutputDescriptor`] types. This should be sufficient to identify this
7897     * [`EcdsaChannelSigner`] object uniquely and lookup or re-derive its keys.
7898     */
7899    struct LDKThirtyTwoBytes (*channel_keys_id)(const void *this_arg);
7900    /**
7901     * Set the counterparty static channel data, including basepoints,
7902     * `counterparty_selected`/`holder_selected_contest_delay` and funding outpoint.
7903     *
7904     * This data is static, and will never change for a channel once set. For a given [`ChannelSigner`]
7905     * instance, LDK will call this method exactly once - either immediately after construction
7906     * (not including if done via [`SignerProvider::read_chan_signer`]) or when the funding
7907     * information has been generated.
7908     *
7909     * channel_parameters.is_populated() MUST be true.
7910     */
7911    void (*provide_channel_parameters)(void *this_arg, const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters);
7912    /**
7913     * Frees any resources associated with this object given its this_arg pointer.
7914     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7915     */
7916    void (*free)(void *this_arg);
7917 } LDKChannelSigner;
7918
7919 /**
7920  * A trait to sign Lightning channel transactions as described in
7921  * [BOLT 3](https://github.com/lightning/bolts/blob/master/03-transactions.md).
7922  *
7923  * Signing services could be implemented on a hardware wallet and should implement signing
7924  * policies in order to be secure. Please refer to the [VLS Policy
7925  * Controls](https://gitlab.com/lightning-signer/validating-lightning-signer/-/blob/main/docs/policy-controls.md)
7926  * for an example of such policies.
7927  */
7928 typedef struct LDKEcdsaChannelSigner {
7929    /**
7930     * An opaque pointer which is passed to your function implementations as an argument.
7931     * This has no meaning in the LDK, and can be NULL or any other value.
7932     */
7933    void *this_arg;
7934    /**
7935     * Create a signature for a counterparty's commitment transaction and associated HTLC transactions.
7936     *
7937     * Note that if signing fails or is rejected, the channel will be force-closed.
7938     *
7939     * Policy checks should be implemented in this function, including checking the amount
7940     * sent to us and checking the HTLCs.
7941     *
7942     * The preimages of outgoing HTLCs that were fulfilled since the last commitment are provided.
7943     * A validating signer should ensure that an HTLC output is removed only when the matching
7944     * preimage is provided, or when the value to holder is restored.
7945     *
7946     * Note that all the relevant preimages will be provided, but there may also be additional
7947     * irrelevant or duplicate preimages.
7948     */
7949    struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_counterparty_commitment)(const void *this_arg, const struct LDKCommitmentTransaction *NONNULL_PTR commitment_tx, struct LDKCVec_PaymentPreimageZ preimages);
7950    /**
7951     * Validate the counterparty's revocation.
7952     *
7953     * This is required in order for the signer to make sure that the state has moved
7954     * forward and it is safe to sign the next counterparty commitment.
7955     */
7956    struct LDKCResult_NoneNoneZ (*validate_counterparty_revocation)(const void *this_arg, uint64_t idx, const uint8_t (*secret)[32]);
7957    /**
7958     * Creates a signature for a holder's commitment transaction and its claiming HTLC transactions.
7959     *
7960     * This will be called
7961     * - with a non-revoked `commitment_tx`.
7962     * - with the latest `commitment_tx` when we initiate a force-close.
7963     * - with the previous `commitment_tx`, just to get claiming HTLC
7964     *   signatures, if we are reacting to a [`ChannelMonitor`]
7965     *   [replica](https://github.com/lightningdevkit/rust-lightning/blob/main/GLOSSARY.md#monitor-replicas)
7966     *   that decided to broadcast before it had been updated to the latest `commitment_tx`.
7967     *
7968     * This may be called multiple times for the same transaction.
7969     *
7970     * An external signer implementation should check that the commitment has not been revoked.
7971     *
7972     * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor
7973     */
7974    struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_holder_commitment_and_htlcs)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx);
7975    /**
7976     * Create a signature for the given input in a transaction spending an HTLC transaction output
7977     * or a commitment transaction `to_local` output when our counterparty broadcasts an old state.
7978     *
7979     * A justice transaction may claim multiple outputs at the same time if timelocks are
7980     * similar, but only a signature for the input at index `input` should be signed for here.
7981     * It may be called multiple times for same output(s) if a fee-bump is needed with regards
7982     * to an upcoming timelock expiration.
7983     *
7984     * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
7985     *
7986     * `per_commitment_key` is revocation secret which was provided by our counterparty when they
7987     * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
7988     * not allow the spending of any funds by itself (you need our holder `revocation_secret` to do
7989     * so).
7990     */
7991    struct LDKCResult_SignatureNoneZ (*sign_justice_revoked_output)(const void *this_arg, struct LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (*per_commitment_key)[32]);
7992    /**
7993     * Create a signature for the given input in a transaction spending a commitment transaction
7994     * HTLC output when our counterparty broadcasts an old state.
7995     *
7996     * A justice transaction may claim multiple outputs at the same time if timelocks are
7997     * similar, but only a signature for the input at index `input` should be signed for here.
7998     * It may be called multiple times for same output(s) if a fee-bump is needed with regards
7999     * to an upcoming timelock expiration.
8000     *
8001     * `amount` is the value of the output spent by this input, committed to in the BIP 143
8002     * signature.
8003     *
8004     * `per_commitment_key` is revocation secret which was provided by our counterparty when they
8005     * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
8006     * not allow the spending of any funds by itself (you need our holder revocation_secret to do
8007     * so).
8008     *
8009     * `htlc` holds HTLC elements (hash, timelock), thus changing the format of the witness script
8010     * (which is committed to in the BIP 143 signatures).
8011     */
8012    struct LDKCResult_SignatureNoneZ (*sign_justice_revoked_htlc)(const void *this_arg, struct LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (*per_commitment_key)[32], const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc);
8013    /**
8014     * Create a signature for a claiming transaction for a HTLC output on a counterparty's commitment
8015     * transaction, either offered or received.
8016     *
8017     * Such a transaction may claim multiples offered outputs at same time if we know the
8018     * preimage for each when we create it, but only the input at index `input` should be
8019     * signed for here. It may be called multiple times for same output(s) if a fee-bump is
8020     * needed with regards to an upcoming timelock expiration.
8021     *
8022     * `witness_script` is either an offered or received script as defined in BOLT3 for HTLC
8023     * outputs.
8024     *
8025     * `amount` is value of the output spent by this input, committed to in the BIP 143 signature.
8026     *
8027     * `per_commitment_point` is the dynamic point corresponding to the channel state
8028     * detected onchain. It has been generated by our counterparty and is used to derive
8029     * channel state keys, which are then included in the witness script and committed to in the
8030     * BIP 143 signature.
8031     */
8032    struct LDKCResult_SignatureNoneZ (*sign_counterparty_htlc_transaction)(const void *this_arg, struct LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, struct LDKPublicKey per_commitment_point, const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc);
8033    /**
8034     * Create a signature for a (proposed) closing transaction.
8035     *
8036     * Note that, due to rounding, there may be one \"missing\" satoshi, and either party may have
8037     * chosen to forgo their output as dust.
8038     */
8039    struct LDKCResult_SignatureNoneZ (*sign_closing_transaction)(const void *this_arg, const struct LDKClosingTransaction *NONNULL_PTR closing_tx);
8040    /**
8041     * Computes the signature for a commitment transaction's anchor output used as an
8042     * input within `anchor_tx`, which spends the commitment transaction, at index `input`.
8043     */
8044    struct LDKCResult_SignatureNoneZ (*sign_holder_anchor_input)(const void *this_arg, struct LDKTransaction anchor_tx, uintptr_t input);
8045    /**
8046     * Signs a channel announcement message with our funding key proving it comes from one of the
8047     * channel participants.
8048     *
8049     * Channel announcements also require a signature from each node's network key. Our node
8050     * signature is computed through [`NodeSigner::sign_gossip_message`].
8051     *
8052     * Note that if this fails or is rejected, the channel will not be publicly announced and
8053     * our counterparty may (though likely will not) close the channel on us for violating the
8054     * protocol.
8055     */
8056    struct LDKCResult_SignatureNoneZ (*sign_channel_announcement_with_funding_key)(const void *this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg);
8057    /**
8058     * Implementation of ChannelSigner for this object.
8059     */
8060    struct LDKChannelSigner ChannelSigner;
8061    /**
8062     * Frees any resources associated with this object given its this_arg pointer.
8063     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8064     */
8065    void (*free)(void *this_arg);
8066 } LDKEcdsaChannelSigner;
8067
8068 /**
8069  * A writeable signer.
8070  *
8071  * There will always be two instances of a signer per channel, one occupied by the
8072  * [`ChannelManager`] and another by the channel's [`ChannelMonitor`].
8073  *
8074  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
8075  * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor
8076  */
8077 typedef struct LDKWriteableEcdsaChannelSigner {
8078    /**
8079     * An opaque pointer which is passed to your function implementations as an argument.
8080     * This has no meaning in the LDK, and can be NULL or any other value.
8081     */
8082    void *this_arg;
8083    /**
8084     * Implementation of EcdsaChannelSigner for this object.
8085     */
8086    struct LDKEcdsaChannelSigner EcdsaChannelSigner;
8087    /**
8088     * Serialize the object into a byte array
8089     */
8090    struct LDKCVec_u8Z (*write)(const void *this_arg);
8091    /**
8092     * Frees any resources associated with this object given its this_arg pointer.
8093     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8094     */
8095    void (*free)(void *this_arg);
8096 } LDKWriteableEcdsaChannelSigner;
8097
8098 /**
8099  * The contents of CResult_WriteableEcdsaChannelSignerDecodeErrorZ
8100  */
8101 typedef union LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZPtr {
8102    /**
8103     * A pointer to the contents in the success state.
8104     * Reading from this pointer when `result_ok` is not set is undefined.
8105     */
8106    struct LDKWriteableEcdsaChannelSigner *result;
8107    /**
8108     * A pointer to the contents in the error state.
8109     * Reading from this pointer when `result_ok` is set is undefined.
8110     */
8111    struct LDKDecodeError *err;
8112 } LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZPtr;
8113
8114 /**
8115  * A CResult_WriteableEcdsaChannelSignerDecodeErrorZ represents the result of a fallible operation,
8116  * containing a crate::lightning::chain::keysinterface::WriteableEcdsaChannelSigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
8117  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8118  */
8119 typedef struct LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ {
8120    /**
8121     * The contents of this CResult_WriteableEcdsaChannelSignerDecodeErrorZ, accessible via either
8122     * `err` or `result` depending on the state of `result_ok`.
8123     */
8124    union LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZPtr contents;
8125    /**
8126     * Whether this CResult_WriteableEcdsaChannelSignerDecodeErrorZ represents a success state.
8127     */
8128    bool result_ok;
8129 } LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ;
8130
8131 /**
8132  * A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
8133  * This corresponds to std::vector in C++
8134  */
8135 typedef struct LDKCVec_CVec_u8ZZ {
8136    /**
8137     * The elements in the array.
8138     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8139     */
8140    struct LDKCVec_u8Z *data;
8141    /**
8142     * The number of elements pointed to by `data`.
8143     */
8144    uintptr_t datalen;
8145 } LDKCVec_CVec_u8ZZ;
8146
8147 /**
8148  * The contents of CResult_CVec_CVec_u8ZZNoneZ
8149  */
8150 typedef union LDKCResult_CVec_CVec_u8ZZNoneZPtr {
8151    /**
8152     * A pointer to the contents in the success state.
8153     * Reading from this pointer when `result_ok` is not set is undefined.
8154     */
8155    struct LDKCVec_CVec_u8ZZ *result;
8156    /**
8157     * Note that this value is always NULL, as there are no contents in the Err variant
8158     */
8159    void *err;
8160 } LDKCResult_CVec_CVec_u8ZZNoneZPtr;
8161
8162 /**
8163  * A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
8164  * containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
8165  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8166  */
8167 typedef struct LDKCResult_CVec_CVec_u8ZZNoneZ {
8168    /**
8169     * The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
8170     * `err` or `result` depending on the state of `result_ok`.
8171     */
8172    union LDKCResult_CVec_CVec_u8ZZNoneZPtr contents;
8173    /**
8174     * Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
8175     */
8176    bool result_ok;
8177 } LDKCResult_CVec_CVec_u8ZZNoneZ;
8178
8179
8180
8181 /**
8182  * A simple implementation of [`WriteableEcdsaChannelSigner`] that just keeps the private keys in memory.
8183  *
8184  * This implementation performs no policy checks and is insufficient by itself as
8185  * a secure external signer.
8186  */
8187 typedef struct MUST_USE_STRUCT LDKInMemorySigner {
8188    /**
8189     * A pointer to the opaque Rust object.
8190     * Nearly everywhere, inner must be non-null, however in places where
8191     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8192     */
8193    LDKnativeInMemorySigner *inner;
8194    /**
8195     * Indicates that this is the only struct which contains the same pointer.
8196     * Rust functions which take ownership of an object provided via an argument require
8197     * this to be true and invalidate the object pointed to by inner.
8198     */
8199    bool is_owned;
8200 } LDKInMemorySigner;
8201
8202 /**
8203  * The contents of CResult_InMemorySignerDecodeErrorZ
8204  */
8205 typedef union LDKCResult_InMemorySignerDecodeErrorZPtr {
8206    /**
8207     * A pointer to the contents in the success state.
8208     * Reading from this pointer when `result_ok` is not set is undefined.
8209     */
8210    struct LDKInMemorySigner *result;
8211    /**
8212     * A pointer to the contents in the error state.
8213     * Reading from this pointer when `result_ok` is set is undefined.
8214     */
8215    struct LDKDecodeError *err;
8216 } LDKCResult_InMemorySignerDecodeErrorZPtr;
8217
8218 /**
8219  * A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
8220  * containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
8221  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8222  */
8223 typedef struct LDKCResult_InMemorySignerDecodeErrorZ {
8224    /**
8225     * The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
8226     * `err` or `result` depending on the state of `result_ok`.
8227     */
8228    union LDKCResult_InMemorySignerDecodeErrorZPtr contents;
8229    /**
8230     * Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
8231     */
8232    bool result_ok;
8233 } LDKCResult_InMemorySignerDecodeErrorZ;
8234
8235 /**
8236  * A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
8237  * This corresponds to std::vector in C++
8238  */
8239 typedef struct LDKCVec_TxOutZ {
8240    /**
8241     * The elements in the array.
8242     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8243     */
8244    struct LDKTxOut *data;
8245    /**
8246     * The number of elements pointed to by `data`.
8247     */
8248    uintptr_t datalen;
8249 } LDKCVec_TxOutZ;
8250
8251 /**
8252  * The contents of CResult_TransactionNoneZ
8253  */
8254 typedef union LDKCResult_TransactionNoneZPtr {
8255    /**
8256     * A pointer to the contents in the success state.
8257     * Reading from this pointer when `result_ok` is not set is undefined.
8258     */
8259    struct LDKTransaction *result;
8260    /**
8261     * Note that this value is always NULL, as there are no contents in the Err variant
8262     */
8263    void *err;
8264 } LDKCResult_TransactionNoneZPtr;
8265
8266 /**
8267  * A CResult_TransactionNoneZ represents the result of a fallible operation,
8268  * containing a crate::c_types::Transaction on success and a () on failure.
8269  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8270  */
8271 typedef struct LDKCResult_TransactionNoneZ {
8272    /**
8273     * The contents of this CResult_TransactionNoneZ, accessible via either
8274     * `err` or `result` depending on the state of `result_ok`.
8275     */
8276    union LDKCResult_TransactionNoneZPtr contents;
8277    /**
8278     * Whether this CResult_TransactionNoneZ represents a success state.
8279     */
8280    bool result_ok;
8281 } LDKCResult_TransactionNoneZ;
8282
8283
8284
8285 /**
8286  * A ChannelMonitor handles chain events (blocks connected and disconnected) and generates
8287  * on-chain transactions to ensure no loss of funds occurs.
8288  *
8289  * You MUST ensure that no ChannelMonitors for a given channel anywhere contain out-of-date
8290  * information and are actively monitoring the chain.
8291  *
8292  * Pending Events or updated HTLCs which have not yet been read out by
8293  * get_and_clear_pending_monitor_events or get_and_clear_pending_events are serialized to disk and
8294  * reloaded at deserialize-time. Thus, you must ensure that, when handling events, all events
8295  * gotten are fully handled before re-serializing the new state.
8296  *
8297  * Note that the deserializer is only implemented for (BlockHash, ChannelMonitor), which
8298  * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
8299  * the \"reorg path\" (ie disconnecting blocks until you find a common ancestor from both the
8300  * returned block hash and the the current chain and then reconnecting blocks to get to the
8301  * best chain) upon deserializing the object!
8302  */
8303 typedef struct MUST_USE_STRUCT LDKChannelMonitor {
8304    /**
8305     * A pointer to the opaque Rust object.
8306     * Nearly everywhere, inner must be non-null, however in places where
8307     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8308     */
8309    LDKnativeChannelMonitor *inner;
8310    /**
8311     * Indicates that this is the only struct which contains the same pointer.
8312     * Rust functions which take ownership of an object provided via an argument require
8313     * this to be true and invalidate the object pointed to by inner.
8314     */
8315    bool is_owned;
8316 } LDKChannelMonitor;
8317
8318 /**
8319  * A tuple of 2 elements. See the individual fields for the types contained.
8320  */
8321 typedef struct LDKC2Tuple_BlockHashChannelMonitorZ {
8322    /**
8323     * The element at position 0
8324     */
8325    struct LDKThirtyTwoBytes a;
8326    /**
8327     * The element at position 1
8328     */
8329    struct LDKChannelMonitor b;
8330 } LDKC2Tuple_BlockHashChannelMonitorZ;
8331
8332 /**
8333  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
8334  * This corresponds to std::vector in C++
8335  */
8336 typedef struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ {
8337    /**
8338     * The elements in the array.
8339     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8340     */
8341    struct LDKC2Tuple_BlockHashChannelMonitorZ *data;
8342    /**
8343     * The number of elements pointed to by `data`.
8344     */
8345    uintptr_t datalen;
8346 } LDKCVec_C2Tuple_BlockHashChannelMonitorZZ;
8347
8348 /**
8349  * The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
8350  */
8351 typedef union LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
8352    /**
8353     * A pointer to the contents in the success state.
8354     * Reading from this pointer when `result_ok` is not set is undefined.
8355     */
8356    struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *result;
8357    /**
8358     * A pointer to the contents in the error state.
8359     * Reading from this pointer when `result_ok` is set is undefined.
8360     */
8361    enum LDKIOError *err;
8362 } LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr;
8363
8364 /**
8365  * A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
8366  * containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
8367  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8368  */
8369 typedef struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
8370    /**
8371     * The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
8372     * `err` or `result` depending on the state of `result_ok`.
8373     */
8374    union LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr contents;
8375    /**
8376     * Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
8377     */
8378    bool result_ok;
8379 } LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ;
8380
8381 /**
8382  * An enum which can either contain a u16 or not
8383  */
8384 typedef enum LDKCOption_u16Z_Tag {
8385    /**
8386     * When we're in this state, this COption_u16Z contains a u16
8387     */
8388    LDKCOption_u16Z_Some,
8389    /**
8390     * When we're in this state, this COption_u16Z contains nothing
8391     */
8392    LDKCOption_u16Z_None,
8393    /**
8394     * Must be last for serialization purposes
8395     */
8396    LDKCOption_u16Z_Sentinel,
8397 } LDKCOption_u16Z_Tag;
8398
8399 typedef struct LDKCOption_u16Z {
8400    LDKCOption_u16Z_Tag tag;
8401    union {
8402       struct {
8403          uint16_t some;
8404       };
8405    };
8406 } LDKCOption_u16Z;
8407
8408 /**
8409  * The contents of CResult__u832APIErrorZ
8410  */
8411 typedef union LDKCResult__u832APIErrorZPtr {
8412    /**
8413     * A pointer to the contents in the success state.
8414     * Reading from this pointer when `result_ok` is not set is undefined.
8415     */
8416    struct LDKThirtyTwoBytes *result;
8417    /**
8418     * A pointer to the contents in the error state.
8419     * Reading from this pointer when `result_ok` is set is undefined.
8420     */
8421    struct LDKAPIError *err;
8422 } LDKCResult__u832APIErrorZPtr;
8423
8424 /**
8425  * A CResult__u832APIErrorZ represents the result of a fallible operation,
8426  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
8427  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8428  */
8429 typedef struct LDKCResult__u832APIErrorZ {
8430    /**
8431     * The contents of this CResult__u832APIErrorZ, accessible via either
8432     * `err` or `result` depending on the state of `result_ok`.
8433     */
8434    union LDKCResult__u832APIErrorZPtr contents;
8435    /**
8436     * Whether this CResult__u832APIErrorZ represents a success state.
8437     */
8438    bool result_ok;
8439 } LDKCResult__u832APIErrorZ;
8440
8441 /**
8442  * Used by [`ChannelManager::list_recent_payments`] to express the status of recent payments.
8443  * These include payments that have yet to find a successful path, or have unresolved HTLCs.
8444  */
8445 typedef enum LDKRecentPaymentDetails_Tag {
8446    /**
8447     * When a payment is still being sent and awaiting successful delivery.
8448     */
8449    LDKRecentPaymentDetails_Pending,
8450    /**
8451     * When a pending payment is fulfilled, we continue tracking it until all pending HTLCs have
8452     * been resolved. Upon receiving [`Event::PaymentSent`], we delay for a few minutes before the
8453     * payment is removed from tracking.
8454     */
8455    LDKRecentPaymentDetails_Fulfilled,
8456    /**
8457     * After a payment's retries are exhausted per the provided [`Retry`], or it is explicitly
8458     * abandoned via [`ChannelManager::abandon_payment`], it is marked as abandoned until all
8459     * pending HTLCs for this payment resolve and an [`Event::PaymentFailed`] is generated.
8460     */
8461    LDKRecentPaymentDetails_Abandoned,
8462    /**
8463     * Must be last for serialization purposes
8464     */
8465    LDKRecentPaymentDetails_Sentinel,
8466 } LDKRecentPaymentDetails_Tag;
8467
8468 typedef struct LDKRecentPaymentDetails_LDKPending_Body {
8469    /**
8470     * Hash of the payment that is currently being sent but has yet to be fulfilled or
8471     * abandoned.
8472     */
8473    struct LDKThirtyTwoBytes payment_hash;
8474    /**
8475     * Total amount (in msat, excluding fees) across all paths for this payment,
8476     * not just the amount currently inflight.
8477     */
8478    uint64_t total_msat;
8479 } LDKRecentPaymentDetails_LDKPending_Body;
8480
8481 typedef struct LDKRecentPaymentDetails_LDKFulfilled_Body {
8482    /**
8483     * Hash of the payment that was claimed. `None` for serializations of [`ChannelManager`]
8484     * made before LDK version 0.0.104.
8485     *
8486     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
8487     */
8488    struct LDKThirtyTwoBytes payment_hash;
8489 } LDKRecentPaymentDetails_LDKFulfilled_Body;
8490
8491 typedef struct LDKRecentPaymentDetails_LDKAbandoned_Body {
8492    /**
8493     * Hash of the payment that we have given up trying to send.
8494     */
8495    struct LDKThirtyTwoBytes payment_hash;
8496 } LDKRecentPaymentDetails_LDKAbandoned_Body;
8497
8498 typedef struct MUST_USE_STRUCT LDKRecentPaymentDetails {
8499    LDKRecentPaymentDetails_Tag tag;
8500    union {
8501       LDKRecentPaymentDetails_LDKPending_Body pending;
8502       LDKRecentPaymentDetails_LDKFulfilled_Body fulfilled;
8503       LDKRecentPaymentDetails_LDKAbandoned_Body abandoned;
8504    };
8505 } LDKRecentPaymentDetails;
8506
8507 /**
8508  * A dynamically-allocated array of crate::lightning::ln::channelmanager::RecentPaymentDetailss of arbitrary size.
8509  * This corresponds to std::vector in C++
8510  */
8511 typedef struct LDKCVec_RecentPaymentDetailsZ {
8512    /**
8513     * The elements in the array.
8514     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8515     */
8516    struct LDKRecentPaymentDetails *data;
8517    /**
8518     * The number of elements pointed to by `data`.
8519     */
8520    uintptr_t datalen;
8521 } LDKCVec_RecentPaymentDetailsZ;
8522
8523 /**
8524  * If a payment fails to send with [`ChannelManager::send_payment_with_route`], it can be in one
8525  * of several states. This enum is returned as the Err() type describing which state the payment
8526  * is in, see the description of individual enum states for more.
8527  *
8528  * [`ChannelManager::send_payment_with_route`]: crate::ln::channelmanager::ChannelManager::send_payment_with_route
8529  */
8530 typedef enum LDKPaymentSendFailure_Tag {
8531    /**
8532     * A parameter which was passed to send_payment was invalid, preventing us from attempting to
8533     * send the payment at all.
8534     *
8535     * You can freely resend the payment in full (with the parameter error fixed).
8536     *
8537     * Because the payment failed outright, no payment tracking is done and no
8538     * [`Event::PaymentPathFailed`] or [`Event::PaymentFailed`] events will be generated.
8539     *
8540     * [`Event::PaymentPathFailed`]: crate::events::Event::PaymentPathFailed
8541     * [`Event::PaymentFailed`]: crate::events::Event::PaymentFailed
8542     */
8543    LDKPaymentSendFailure_ParameterError,
8544    /**
8545     * A parameter in a single path which was passed to send_payment was invalid, preventing us
8546     * from attempting to send the payment at all.
8547     *
8548     * You can freely resend the payment in full (with the parameter error fixed).
8549     *
8550     * Because the payment failed outright, no payment tracking is done and no
8551     * [`Event::PaymentPathFailed`] or [`Event::PaymentFailed`] events will be generated.
8552     *
8553     * The results here are ordered the same as the paths in the route object which was passed to
8554     * send_payment.
8555     *
8556     * [`Event::PaymentPathFailed`]: crate::events::Event::PaymentPathFailed
8557     * [`Event::PaymentFailed`]: crate::events::Event::PaymentFailed
8558     */
8559    LDKPaymentSendFailure_PathParameterError,
8560    /**
8561     * All paths which were attempted failed to send, with no channel state change taking place.
8562     * You can freely resend the payment in full (though you probably want to do so over different
8563     * paths than the ones selected).
8564     *
8565     * Because the payment failed outright, no payment tracking is done and no
8566     * [`Event::PaymentPathFailed`] or [`Event::PaymentFailed`] events will be generated.
8567     *
8568     * [`Event::PaymentPathFailed`]: crate::events::Event::PaymentPathFailed
8569     * [`Event::PaymentFailed`]: crate::events::Event::PaymentFailed
8570     */
8571    LDKPaymentSendFailure_AllFailedResendSafe,
8572    /**
8573     * Indicates that a payment for the provided [`PaymentId`] is already in-flight and has not
8574     * yet completed (i.e. generated an [`Event::PaymentSent`] or [`Event::PaymentFailed`]).
8575     *
8576     * [`PaymentId`]: crate::ln::channelmanager::PaymentId
8577     * [`Event::PaymentSent`]: crate::events::Event::PaymentSent
8578     * [`Event::PaymentFailed`]: crate::events::Event::PaymentFailed
8579     */
8580    LDKPaymentSendFailure_DuplicatePayment,
8581    /**
8582     * Some paths that were attempted failed to send, though some paths may have succeeded. At least
8583     * some paths have irrevocably committed to the HTLC.
8584     *
8585     * The results here are ordered the same as the paths in the route object that was passed to
8586     * send_payment.
8587     *
8588     * Any entries that contain `Err(APIError::MonitorUpdateInprogress)` will send once a
8589     * [`MonitorEvent::Completed`] is provided for the next-hop channel with the latest update_id.
8590     *
8591     * [`MonitorEvent::Completed`]: crate::chain::channelmonitor::MonitorEvent::Completed
8592     */
8593    LDKPaymentSendFailure_PartialFailure,
8594    /**
8595     * Must be last for serialization purposes
8596     */
8597    LDKPaymentSendFailure_Sentinel,
8598 } LDKPaymentSendFailure_Tag;
8599
8600 typedef struct LDKPaymentSendFailure_LDKPartialFailure_Body {
8601    /**
8602     * The errors themselves, in the same order as the paths from the route.
8603     */
8604    struct LDKCVec_CResult_NoneAPIErrorZZ results;
8605    /**
8606     * If some paths failed without irrevocably committing to the new HTLC(s), this will
8607     * contain a [`RouteParameters`] object for the failing paths.
8608     *
8609     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
8610     */
8611    struct LDKRouteParameters failed_paths_retry;
8612    /**
8613     * The payment id for the payment, which is now at least partially pending.
8614     */
8615    struct LDKThirtyTwoBytes payment_id;
8616 } LDKPaymentSendFailure_LDKPartialFailure_Body;
8617
8618 typedef struct MUST_USE_STRUCT LDKPaymentSendFailure {
8619    LDKPaymentSendFailure_Tag tag;
8620    union {
8621       struct {
8622          struct LDKAPIError parameter_error;
8623       };
8624       struct {
8625          struct LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error;
8626       };
8627       struct {
8628          struct LDKCVec_APIErrorZ all_failed_resend_safe;
8629       };
8630       LDKPaymentSendFailure_LDKPartialFailure_Body partial_failure;
8631    };
8632 } LDKPaymentSendFailure;
8633
8634 /**
8635  * The contents of CResult_NonePaymentSendFailureZ
8636  */
8637 typedef union LDKCResult_NonePaymentSendFailureZPtr {
8638    /**
8639     * Note that this value is always NULL, as there are no contents in the OK variant
8640     */
8641    void *result;
8642    /**
8643     * A pointer to the contents in the error state.
8644     * Reading from this pointer when `result_ok` is set is undefined.
8645     */
8646    struct LDKPaymentSendFailure *err;
8647 } LDKCResult_NonePaymentSendFailureZPtr;
8648
8649 /**
8650  * A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
8651  * containing a () on success and a crate::lightning::ln::outbound_payment::PaymentSendFailure on failure.
8652  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8653  */
8654 typedef struct LDKCResult_NonePaymentSendFailureZ {
8655    /**
8656     * The contents of this CResult_NonePaymentSendFailureZ, accessible via either
8657     * `err` or `result` depending on the state of `result_ok`.
8658     */
8659    union LDKCResult_NonePaymentSendFailureZPtr contents;
8660    /**
8661     * Whether this CResult_NonePaymentSendFailureZ represents a success state.
8662     */
8663    bool result_ok;
8664 } LDKCResult_NonePaymentSendFailureZ;
8665
8666 /**
8667  * The contents of CResult_NoneRetryableSendFailureZ
8668  */
8669 typedef union LDKCResult_NoneRetryableSendFailureZPtr {
8670    /**
8671     * Note that this value is always NULL, as there are no contents in the OK variant
8672     */
8673    void *result;
8674    /**
8675     * A pointer to the contents in the error state.
8676     * Reading from this pointer when `result_ok` is set is undefined.
8677     */
8678    enum LDKRetryableSendFailure *err;
8679 } LDKCResult_NoneRetryableSendFailureZPtr;
8680
8681 /**
8682  * A CResult_NoneRetryableSendFailureZ represents the result of a fallible operation,
8683  * containing a () on success and a crate::lightning::ln::outbound_payment::RetryableSendFailure on failure.
8684  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8685  */
8686 typedef struct LDKCResult_NoneRetryableSendFailureZ {
8687    /**
8688     * The contents of this CResult_NoneRetryableSendFailureZ, accessible via either
8689     * `err` or `result` depending on the state of `result_ok`.
8690     */
8691    union LDKCResult_NoneRetryableSendFailureZPtr contents;
8692    /**
8693     * Whether this CResult_NoneRetryableSendFailureZ represents a success state.
8694     */
8695    bool result_ok;
8696 } LDKCResult_NoneRetryableSendFailureZ;
8697
8698 /**
8699  * The contents of CResult_PaymentHashPaymentSendFailureZ
8700  */
8701 typedef union LDKCResult_PaymentHashPaymentSendFailureZPtr {
8702    /**
8703     * A pointer to the contents in the success state.
8704     * Reading from this pointer when `result_ok` is not set is undefined.
8705     */
8706    struct LDKThirtyTwoBytes *result;
8707    /**
8708     * A pointer to the contents in the error state.
8709     * Reading from this pointer when `result_ok` is set is undefined.
8710     */
8711    struct LDKPaymentSendFailure *err;
8712 } LDKCResult_PaymentHashPaymentSendFailureZPtr;
8713
8714 /**
8715  * A CResult_PaymentHashPaymentSendFailureZ represents the result of a fallible operation,
8716  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::outbound_payment::PaymentSendFailure on failure.
8717  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8718  */
8719 typedef struct LDKCResult_PaymentHashPaymentSendFailureZ {
8720    /**
8721     * The contents of this CResult_PaymentHashPaymentSendFailureZ, accessible via either
8722     * `err` or `result` depending on the state of `result_ok`.
8723     */
8724    union LDKCResult_PaymentHashPaymentSendFailureZPtr contents;
8725    /**
8726     * Whether this CResult_PaymentHashPaymentSendFailureZ represents a success state.
8727     */
8728    bool result_ok;
8729 } LDKCResult_PaymentHashPaymentSendFailureZ;
8730
8731 /**
8732  * The contents of CResult_PaymentHashRetryableSendFailureZ
8733  */
8734 typedef union LDKCResult_PaymentHashRetryableSendFailureZPtr {
8735    /**
8736     * A pointer to the contents in the success state.
8737     * Reading from this pointer when `result_ok` is not set is undefined.
8738     */
8739    struct LDKThirtyTwoBytes *result;
8740    /**
8741     * A pointer to the contents in the error state.
8742     * Reading from this pointer when `result_ok` is set is undefined.
8743     */
8744    enum LDKRetryableSendFailure *err;
8745 } LDKCResult_PaymentHashRetryableSendFailureZPtr;
8746
8747 /**
8748  * A CResult_PaymentHashRetryableSendFailureZ represents the result of a fallible operation,
8749  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::outbound_payment::RetryableSendFailure on failure.
8750  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8751  */
8752 typedef struct LDKCResult_PaymentHashRetryableSendFailureZ {
8753    /**
8754     * The contents of this CResult_PaymentHashRetryableSendFailureZ, accessible via either
8755     * `err` or `result` depending on the state of `result_ok`.
8756     */
8757    union LDKCResult_PaymentHashRetryableSendFailureZPtr contents;
8758    /**
8759     * Whether this CResult_PaymentHashRetryableSendFailureZ represents a success state.
8760     */
8761    bool result_ok;
8762 } LDKCResult_PaymentHashRetryableSendFailureZ;
8763
8764 /**
8765  * A tuple of 2 elements. See the individual fields for the types contained.
8766  */
8767 typedef struct LDKC2Tuple_PaymentHashPaymentIdZ {
8768    /**
8769     * The element at position 0
8770     */
8771    struct LDKThirtyTwoBytes a;
8772    /**
8773     * The element at position 1
8774     */
8775    struct LDKThirtyTwoBytes b;
8776 } LDKC2Tuple_PaymentHashPaymentIdZ;
8777
8778 /**
8779  * The contents of CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ
8780  */
8781 typedef union LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
8782    /**
8783     * A pointer to the contents in the success state.
8784     * Reading from this pointer when `result_ok` is not set is undefined.
8785     */
8786    struct LDKC2Tuple_PaymentHashPaymentIdZ *result;
8787    /**
8788     * A pointer to the contents in the error state.
8789     * Reading from this pointer when `result_ok` is set is undefined.
8790     */
8791    struct LDKPaymentSendFailure *err;
8792 } LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr;
8793
8794 /**
8795  * A CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents the result of a fallible operation,
8796  * containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ on success and a crate::lightning::ln::outbound_payment::PaymentSendFailure on failure.
8797  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8798  */
8799 typedef struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8800    /**
8801     * The contents of this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ, accessible via either
8802     * `err` or `result` depending on the state of `result_ok`.
8803     */
8804    union LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr contents;
8805    /**
8806     * Whether this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents a success state.
8807     */
8808    bool result_ok;
8809 } LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ;
8810
8811 /**
8812  * A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
8813  * This corresponds to std::vector in C++
8814  */
8815 typedef struct LDKCVec_ThirtyTwoBytesZ {
8816    /**
8817     * The elements in the array.
8818     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8819     */
8820    struct LDKThirtyTwoBytes *data;
8821    /**
8822     * The number of elements pointed to by `data`.
8823     */
8824    uintptr_t datalen;
8825 } LDKCVec_ThirtyTwoBytesZ;
8826
8827 /**
8828  * A tuple of 2 elements. See the individual fields for the types contained.
8829  */
8830 typedef struct LDKC2Tuple_PaymentHashPaymentSecretZ {
8831    /**
8832     * The element at position 0
8833     */
8834    struct LDKThirtyTwoBytes a;
8835    /**
8836     * The element at position 1
8837     */
8838    struct LDKThirtyTwoBytes b;
8839 } LDKC2Tuple_PaymentHashPaymentSecretZ;
8840
8841 /**
8842  * The contents of CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ
8843  */
8844 typedef union LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
8845    /**
8846     * A pointer to the contents in the success state.
8847     * Reading from this pointer when `result_ok` is not set is undefined.
8848     */
8849    struct LDKC2Tuple_PaymentHashPaymentSecretZ *result;
8850    /**
8851     * Note that this value is always NULL, as there are no contents in the Err variant
8852     */
8853    void *err;
8854 } LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr;
8855
8856 /**
8857  * A CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents the result of a fallible operation,
8858  * containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a () on failure.
8859  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8860  */
8861 typedef struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8862    /**
8863     * The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ, accessible via either
8864     * `err` or `result` depending on the state of `result_ok`.
8865     */
8866    union LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr contents;
8867    /**
8868     * Whether this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents a success state.
8869     */
8870    bool result_ok;
8871 } LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ;
8872
8873 /**
8874  * The contents of CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ
8875  */
8876 typedef union LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
8877    /**
8878     * A pointer to the contents in the success state.
8879     * Reading from this pointer when `result_ok` is not set is undefined.
8880     */
8881    struct LDKC2Tuple_PaymentHashPaymentSecretZ *result;
8882    /**
8883     * A pointer to the contents in the error state.
8884     * Reading from this pointer when `result_ok` is set is undefined.
8885     */
8886    struct LDKAPIError *err;
8887 } LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr;
8888
8889 /**
8890  * A CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents the result of a fallible operation,
8891  * containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a crate::lightning::util::errors::APIError on failure.
8892  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8893  */
8894 typedef struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8895    /**
8896     * The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ, accessible via either
8897     * `err` or `result` depending on the state of `result_ok`.
8898     */
8899    union LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr contents;
8900    /**
8901     * Whether this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents a success state.
8902     */
8903    bool result_ok;
8904 } LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ;
8905
8906 /**
8907  * The contents of CResult_PaymentSecretNoneZ
8908  */
8909 typedef union LDKCResult_PaymentSecretNoneZPtr {
8910    /**
8911     * A pointer to the contents in the success state.
8912     * Reading from this pointer when `result_ok` is not set is undefined.
8913     */
8914    struct LDKThirtyTwoBytes *result;
8915    /**
8916     * Note that this value is always NULL, as there are no contents in the Err variant
8917     */
8918    void *err;
8919 } LDKCResult_PaymentSecretNoneZPtr;
8920
8921 /**
8922  * A CResult_PaymentSecretNoneZ represents the result of a fallible operation,
8923  * containing a crate::c_types::ThirtyTwoBytes on success and a () on failure.
8924  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8925  */
8926 typedef struct LDKCResult_PaymentSecretNoneZ {
8927    /**
8928     * The contents of this CResult_PaymentSecretNoneZ, accessible via either
8929     * `err` or `result` depending on the state of `result_ok`.
8930     */
8931    union LDKCResult_PaymentSecretNoneZPtr contents;
8932    /**
8933     * Whether this CResult_PaymentSecretNoneZ represents a success state.
8934     */
8935    bool result_ok;
8936 } LDKCResult_PaymentSecretNoneZ;
8937
8938 /**
8939  * The contents of CResult_PaymentSecretAPIErrorZ
8940  */
8941 typedef union LDKCResult_PaymentSecretAPIErrorZPtr {
8942    /**
8943     * A pointer to the contents in the success state.
8944     * Reading from this pointer when `result_ok` is not set is undefined.
8945     */
8946    struct LDKThirtyTwoBytes *result;
8947    /**
8948     * A pointer to the contents in the error state.
8949     * Reading from this pointer when `result_ok` is set is undefined.
8950     */
8951    struct LDKAPIError *err;
8952 } LDKCResult_PaymentSecretAPIErrorZPtr;
8953
8954 /**
8955  * A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
8956  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
8957  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8958  */
8959 typedef struct LDKCResult_PaymentSecretAPIErrorZ {
8960    /**
8961     * The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
8962     * `err` or `result` depending on the state of `result_ok`.
8963     */
8964    union LDKCResult_PaymentSecretAPIErrorZPtr contents;
8965    /**
8966     * Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
8967     */
8968    bool result_ok;
8969 } LDKCResult_PaymentSecretAPIErrorZ;
8970
8971 /**
8972  * The contents of CResult_PaymentPreimageAPIErrorZ
8973  */
8974 typedef union LDKCResult_PaymentPreimageAPIErrorZPtr {
8975    /**
8976     * A pointer to the contents in the success state.
8977     * Reading from this pointer when `result_ok` is not set is undefined.
8978     */
8979    struct LDKThirtyTwoBytes *result;
8980    /**
8981     * A pointer to the contents in the error state.
8982     * Reading from this pointer when `result_ok` is set is undefined.
8983     */
8984    struct LDKAPIError *err;
8985 } LDKCResult_PaymentPreimageAPIErrorZPtr;
8986
8987 /**
8988  * A CResult_PaymentPreimageAPIErrorZ represents the result of a fallible operation,
8989  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
8990  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8991  */
8992 typedef struct LDKCResult_PaymentPreimageAPIErrorZ {
8993    /**
8994     * The contents of this CResult_PaymentPreimageAPIErrorZ, accessible via either
8995     * `err` or `result` depending on the state of `result_ok`.
8996     */
8997    union LDKCResult_PaymentPreimageAPIErrorZPtr contents;
8998    /**
8999     * Whether this CResult_PaymentPreimageAPIErrorZ represents a success state.
9000     */
9001    bool result_ok;
9002 } LDKCResult_PaymentPreimageAPIErrorZ;
9003
9004
9005
9006 /**
9007  * Information needed for constructing an invoice route hint for this channel.
9008  */
9009 typedef struct MUST_USE_STRUCT LDKCounterpartyForwardingInfo {
9010    /**
9011     * A pointer to the opaque Rust object.
9012     * Nearly everywhere, inner must be non-null, however in places where
9013     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9014     */
9015    LDKnativeCounterpartyForwardingInfo *inner;
9016    /**
9017     * Indicates that this is the only struct which contains the same pointer.
9018     * Rust functions which take ownership of an object provided via an argument require
9019     * this to be true and invalidate the object pointed to by inner.
9020     */
9021    bool is_owned;
9022 } LDKCounterpartyForwardingInfo;
9023
9024 /**
9025  * The contents of CResult_CounterpartyForwardingInfoDecodeErrorZ
9026  */
9027 typedef union LDKCResult_CounterpartyForwardingInfoDecodeErrorZPtr {
9028    /**
9029     * A pointer to the contents in the success state.
9030     * Reading from this pointer when `result_ok` is not set is undefined.
9031     */
9032    struct LDKCounterpartyForwardingInfo *result;
9033    /**
9034     * A pointer to the contents in the error state.
9035     * Reading from this pointer when `result_ok` is set is undefined.
9036     */
9037    struct LDKDecodeError *err;
9038 } LDKCResult_CounterpartyForwardingInfoDecodeErrorZPtr;
9039
9040 /**
9041  * A CResult_CounterpartyForwardingInfoDecodeErrorZ represents the result of a fallible operation,
9042  * containing a crate::lightning::ln::channelmanager::CounterpartyForwardingInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
9043  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9044  */
9045 typedef struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ {
9046    /**
9047     * The contents of this CResult_CounterpartyForwardingInfoDecodeErrorZ, accessible via either
9048     * `err` or `result` depending on the state of `result_ok`.
9049     */
9050    union LDKCResult_CounterpartyForwardingInfoDecodeErrorZPtr contents;
9051    /**
9052     * Whether this CResult_CounterpartyForwardingInfoDecodeErrorZ represents a success state.
9053     */
9054    bool result_ok;
9055 } LDKCResult_CounterpartyForwardingInfoDecodeErrorZ;
9056
9057
9058
9059 /**
9060  * Channel parameters which apply to our counterparty. These are split out from [`ChannelDetails`]
9061  * to better separate parameters.
9062  */
9063 typedef struct MUST_USE_STRUCT LDKChannelCounterparty {
9064    /**
9065     * A pointer to the opaque Rust object.
9066     * Nearly everywhere, inner must be non-null, however in places where
9067     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9068     */
9069    LDKnativeChannelCounterparty *inner;
9070    /**
9071     * Indicates that this is the only struct which contains the same pointer.
9072     * Rust functions which take ownership of an object provided via an argument require
9073     * this to be true and invalidate the object pointed to by inner.
9074     */
9075    bool is_owned;
9076 } LDKChannelCounterparty;
9077
9078 /**
9079  * The contents of CResult_ChannelCounterpartyDecodeErrorZ
9080  */
9081 typedef union LDKCResult_ChannelCounterpartyDecodeErrorZPtr {
9082    /**
9083     * A pointer to the contents in the success state.
9084     * Reading from this pointer when `result_ok` is not set is undefined.
9085     */
9086    struct LDKChannelCounterparty *result;
9087    /**
9088     * A pointer to the contents in the error state.
9089     * Reading from this pointer when `result_ok` is set is undefined.
9090     */
9091    struct LDKDecodeError *err;
9092 } LDKCResult_ChannelCounterpartyDecodeErrorZPtr;
9093
9094 /**
9095  * A CResult_ChannelCounterpartyDecodeErrorZ represents the result of a fallible operation,
9096  * containing a crate::lightning::ln::channelmanager::ChannelCounterparty on success and a crate::lightning::ln::msgs::DecodeError on failure.
9097  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9098  */
9099 typedef struct LDKCResult_ChannelCounterpartyDecodeErrorZ {
9100    /**
9101     * The contents of this CResult_ChannelCounterpartyDecodeErrorZ, accessible via either
9102     * `err` or `result` depending on the state of `result_ok`.
9103     */
9104    union LDKCResult_ChannelCounterpartyDecodeErrorZPtr contents;
9105    /**
9106     * Whether this CResult_ChannelCounterpartyDecodeErrorZ represents a success state.
9107     */
9108    bool result_ok;
9109 } LDKCResult_ChannelCounterpartyDecodeErrorZ;
9110
9111 /**
9112  * The contents of CResult_ChannelDetailsDecodeErrorZ
9113  */
9114 typedef union LDKCResult_ChannelDetailsDecodeErrorZPtr {
9115    /**
9116     * A pointer to the contents in the success state.
9117     * Reading from this pointer when `result_ok` is not set is undefined.
9118     */
9119    struct LDKChannelDetails *result;
9120    /**
9121     * A pointer to the contents in the error state.
9122     * Reading from this pointer when `result_ok` is set is undefined.
9123     */
9124    struct LDKDecodeError *err;
9125 } LDKCResult_ChannelDetailsDecodeErrorZPtr;
9126
9127 /**
9128  * A CResult_ChannelDetailsDecodeErrorZ represents the result of a fallible operation,
9129  * containing a crate::lightning::ln::channelmanager::ChannelDetails on success and a crate::lightning::ln::msgs::DecodeError on failure.
9130  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9131  */
9132 typedef struct LDKCResult_ChannelDetailsDecodeErrorZ {
9133    /**
9134     * The contents of this CResult_ChannelDetailsDecodeErrorZ, accessible via either
9135     * `err` or `result` depending on the state of `result_ok`.
9136     */
9137    union LDKCResult_ChannelDetailsDecodeErrorZPtr contents;
9138    /**
9139     * Whether this CResult_ChannelDetailsDecodeErrorZ represents a success state.
9140     */
9141    bool result_ok;
9142 } LDKCResult_ChannelDetailsDecodeErrorZ;
9143
9144
9145
9146 /**
9147  * Route hints used in constructing invoices for [phantom node payents].
9148  *
9149  * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager
9150  */
9151 typedef struct MUST_USE_STRUCT LDKPhantomRouteHints {
9152    /**
9153     * A pointer to the opaque Rust object.
9154     * Nearly everywhere, inner must be non-null, however in places where
9155     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9156     */
9157    LDKnativePhantomRouteHints *inner;
9158    /**
9159     * Indicates that this is the only struct which contains the same pointer.
9160     * Rust functions which take ownership of an object provided via an argument require
9161     * this to be true and invalidate the object pointed to by inner.
9162     */
9163    bool is_owned;
9164 } LDKPhantomRouteHints;
9165
9166 /**
9167  * The contents of CResult_PhantomRouteHintsDecodeErrorZ
9168  */
9169 typedef union LDKCResult_PhantomRouteHintsDecodeErrorZPtr {
9170    /**
9171     * A pointer to the contents in the success state.
9172     * Reading from this pointer when `result_ok` is not set is undefined.
9173     */
9174    struct LDKPhantomRouteHints *result;
9175    /**
9176     * A pointer to the contents in the error state.
9177     * Reading from this pointer when `result_ok` is set is undefined.
9178     */
9179    struct LDKDecodeError *err;
9180 } LDKCResult_PhantomRouteHintsDecodeErrorZPtr;
9181
9182 /**
9183  * A CResult_PhantomRouteHintsDecodeErrorZ represents the result of a fallible operation,
9184  * containing a crate::lightning::ln::channelmanager::PhantomRouteHints on success and a crate::lightning::ln::msgs::DecodeError on failure.
9185  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9186  */
9187 typedef struct LDKCResult_PhantomRouteHintsDecodeErrorZ {
9188    /**
9189     * The contents of this CResult_PhantomRouteHintsDecodeErrorZ, accessible via either
9190     * `err` or `result` depending on the state of `result_ok`.
9191     */
9192    union LDKCResult_PhantomRouteHintsDecodeErrorZPtr contents;
9193    /**
9194     * Whether this CResult_PhantomRouteHintsDecodeErrorZ represents a success state.
9195     */
9196    bool result_ok;
9197 } LDKCResult_PhantomRouteHintsDecodeErrorZ;
9198
9199 /**
9200  * A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
9201  * This corresponds to std::vector in C++
9202  */
9203 typedef struct LDKCVec_ChannelMonitorZ {
9204    /**
9205     * The elements in the array.
9206     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9207     */
9208    struct LDKChannelMonitor *data;
9209    /**
9210     * The number of elements pointed to by `data`.
9211     */
9212    uintptr_t datalen;
9213 } LDKCVec_ChannelMonitorZ;
9214
9215
9216
9217 /**
9218  * An update generated by the underlying channel itself which contains some new information the
9219  * [`ChannelMonitor`] should be made aware of.
9220  *
9221  * Because this represents only a small number of updates to the underlying state, it is generally
9222  * much smaller than a full [`ChannelMonitor`]. However, for large single commitment transaction
9223  * updates (e.g. ones during which there are hundreds of HTLCs pending on the commitment
9224  * transaction), a single update may reach upwards of 1 MiB in serialized size.
9225  */
9226 typedef struct MUST_USE_STRUCT LDKChannelMonitorUpdate {
9227    /**
9228     * A pointer to the opaque Rust object.
9229     * Nearly everywhere, inner must be non-null, however in places where
9230     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9231     */
9232    LDKnativeChannelMonitorUpdate *inner;
9233    /**
9234     * Indicates that this is the only struct which contains the same pointer.
9235     * Rust functions which take ownership of an object provided via an argument require
9236     * this to be true and invalidate the object pointed to by inner.
9237     */
9238    bool is_owned;
9239 } LDKChannelMonitorUpdate;
9240
9241 /**
9242  * The `Watch` trait defines behavior for watching on-chain activity pertaining to channels as
9243  * blocks are connected and disconnected.
9244  *
9245  * Each channel is associated with a [`ChannelMonitor`]. Implementations of this trait are
9246  * responsible for maintaining a set of monitors such that they can be updated accordingly as
9247  * channel state changes and HTLCs are resolved. See method documentation for specific
9248  * requirements.
9249  *
9250  * Implementations **must** ensure that updates are successfully applied and persisted upon method
9251  * completion. If an update fails with a [`PermanentFailure`], then it must immediately shut down
9252  * without taking any further action such as persisting the current state.
9253  *
9254  * If an implementation maintains multiple instances of a channel's monitor (e.g., by storing
9255  * backup copies), then it must ensure that updates are applied across all instances. Otherwise, it
9256  * could result in a revoked transaction being broadcast, allowing the counterparty to claim all
9257  * funds in the channel. See [`ChannelMonitorUpdateStatus`] for more details about how to handle
9258  * multiple instances.
9259  *
9260  * [`PermanentFailure`]: ChannelMonitorUpdateStatus::PermanentFailure
9261  */
9262 typedef struct LDKWatch {
9263    /**
9264     * An opaque pointer which is passed to your function implementations as an argument.
9265     * This has no meaning in the LDK, and can be NULL or any other value.
9266     */
9267    void *this_arg;
9268    /**
9269     * Watches a channel identified by `funding_txo` using `monitor`.
9270     *
9271     * Implementations are responsible for watching the chain for the funding transaction along
9272     * with any spends of outputs returned by [`get_outputs_to_watch`]. In practice, this means
9273     * calling [`block_connected`] and [`block_disconnected`] on the monitor.
9274     *
9275     * Note: this interface MUST error with [`ChannelMonitorUpdateStatus::PermanentFailure`] if
9276     * the given `funding_txo` has previously been registered via `watch_channel`.
9277     *
9278     * [`get_outputs_to_watch`]: channelmonitor::ChannelMonitor::get_outputs_to_watch
9279     * [`block_connected`]: channelmonitor::ChannelMonitor::block_connected
9280     * [`block_disconnected`]: channelmonitor::ChannelMonitor::block_disconnected
9281     */
9282    enum LDKChannelMonitorUpdateStatus (*watch_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitor monitor);
9283    /**
9284     * Updates a channel identified by `funding_txo` by applying `update` to its monitor.
9285     *
9286     * Implementations must call [`update_monitor`] with the given update. See
9287     * [`ChannelMonitorUpdateStatus`] for invariants around returning an error.
9288     *
9289     * [`update_monitor`]: channelmonitor::ChannelMonitor::update_monitor
9290     */
9291    enum LDKChannelMonitorUpdateStatus (*update_channel)(const void *this_arg, struct LDKOutPoint funding_txo, const struct LDKChannelMonitorUpdate *NONNULL_PTR update);
9292    /**
9293     * Returns any monitor events since the last call. Subsequent calls must only return new
9294     * events.
9295     *
9296     * Note that after any block- or transaction-connection calls to a [`ChannelMonitor`], no
9297     * further events may be returned here until the [`ChannelMonitor`] has been fully persisted
9298     * to disk.
9299     *
9300     * For details on asynchronous [`ChannelMonitor`] updating and returning
9301     * [`MonitorEvent::Completed`] here, see [`ChannelMonitorUpdateStatus::InProgress`].
9302     */
9303    struct LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ (*release_pending_monitor_events)(const void *this_arg);
9304    /**
9305     * Frees any resources associated with this object given its this_arg pointer.
9306     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
9307     */
9308    void (*free)(void *this_arg);
9309 } LDKWatch;
9310
9311 /**
9312  * An interface to send a transaction to the Bitcoin network.
9313  */
9314 typedef struct LDKBroadcasterInterface {
9315    /**
9316     * An opaque pointer which is passed to your function implementations as an argument.
9317     * This has no meaning in the LDK, and can be NULL or any other value.
9318     */
9319    void *this_arg;
9320    /**
9321     * Sends a transaction out to (hopefully) be mined.
9322     */
9323    void (*broadcast_transaction)(const void *this_arg, struct LDKTransaction tx);
9324    /**
9325     * Frees any resources associated with this object given its this_arg pointer.
9326     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
9327     */
9328    void (*free)(void *this_arg);
9329 } LDKBroadcasterInterface;
9330
9331 /**
9332  * A trait that describes a source of entropy.
9333  */
9334 typedef struct LDKEntropySource {
9335    /**
9336     * An opaque pointer which is passed to your function implementations as an argument.
9337     * This has no meaning in the LDK, and can be NULL or any other value.
9338     */
9339    void *this_arg;
9340    /**
9341     * Gets a unique, cryptographically-secure, random 32-byte value. This method must return a
9342     * different value each time it is called.
9343     */
9344    struct LDKThirtyTwoBytes (*get_secure_random_bytes)(const void *this_arg);
9345    /**
9346     * Frees any resources associated with this object given its this_arg pointer.
9347     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
9348     */
9349    void (*free)(void *this_arg);
9350 } LDKEntropySource;
9351
9352 /**
9353  * A "slice" referencing some byte array. This is simply a length-tagged pointer which does not
9354  * own the memory pointed to by data.
9355  */
9356 typedef struct LDKu8slice {
9357    /**
9358     * A pointer to the byte buffer
9359     */
9360    const uint8_t *data;
9361    /**
9362     * The number of bytes pointed to by `data`.
9363     */
9364    uintptr_t datalen;
9365 } LDKu8slice;
9366
9367
9368
9369 /**
9370  * The unsigned part of a [`channel_update`] message.
9371  *
9372  * [`channel_update`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-channel_update-message
9373  */
9374 typedef struct MUST_USE_STRUCT LDKUnsignedChannelUpdate {
9375    /**
9376     * A pointer to the opaque Rust object.
9377     * Nearly everywhere, inner must be non-null, however in places where
9378     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9379     */
9380    LDKnativeUnsignedChannelUpdate *inner;
9381    /**
9382     * Indicates that this is the only struct which contains the same pointer.
9383     * Rust functions which take ownership of an object provided via an argument require
9384     * this to be true and invalidate the object pointed to by inner.
9385     */
9386    bool is_owned;
9387 } LDKUnsignedChannelUpdate;
9388
9389
9390
9391 /**
9392  * The unsigned part of a [`node_announcement`] message.
9393  *
9394  * [`node_announcement`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-node_announcement-message
9395  */
9396 typedef struct MUST_USE_STRUCT LDKUnsignedNodeAnnouncement {
9397    /**
9398     * A pointer to the opaque Rust object.
9399     * Nearly everywhere, inner must be non-null, however in places where
9400     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9401     */
9402    LDKnativeUnsignedNodeAnnouncement *inner;
9403    /**
9404     * Indicates that this is the only struct which contains the same pointer.
9405     * Rust functions which take ownership of an object provided via an argument require
9406     * this to be true and invalidate the object pointed to by inner.
9407     */
9408    bool is_owned;
9409 } LDKUnsignedNodeAnnouncement;
9410
9411 /**
9412  * Represents the set of gossip messages that require a signature from a node's identity key.
9413  */
9414 typedef enum LDKUnsignedGossipMessage_Tag {
9415    /**
9416     * An unsigned channel announcement.
9417     */
9418    LDKUnsignedGossipMessage_ChannelAnnouncement,
9419    /**
9420     * An unsigned channel update.
9421     */
9422    LDKUnsignedGossipMessage_ChannelUpdate,
9423    /**
9424     * An unsigned node announcement.
9425     */
9426    LDKUnsignedGossipMessage_NodeAnnouncement,
9427    /**
9428     * Must be last for serialization purposes
9429     */
9430    LDKUnsignedGossipMessage_Sentinel,
9431 } LDKUnsignedGossipMessage_Tag;
9432
9433 typedef struct MUST_USE_STRUCT LDKUnsignedGossipMessage {
9434    LDKUnsignedGossipMessage_Tag tag;
9435    union {
9436       struct {
9437          struct LDKUnsignedChannelAnnouncement channel_announcement;
9438       };
9439       struct {
9440          struct LDKUnsignedChannelUpdate channel_update;
9441       };
9442       struct {
9443          struct LDKUnsignedNodeAnnouncement node_announcement;
9444       };
9445    };
9446 } LDKUnsignedGossipMessage;
9447
9448 /**
9449  * A trait that can handle cryptographic operations at the scope level of a node.
9450  */
9451 typedef struct LDKNodeSigner {
9452    /**
9453     * An opaque pointer which is passed to your function implementations as an argument.
9454     * This has no meaning in the LDK, and can be NULL or any other value.
9455     */
9456    void *this_arg;
9457    /**
9458     * Get secret key material as bytes for use in encrypting and decrypting inbound payment data.
9459     *
9460     * If the implementor of this trait supports [phantom node payments], then every node that is
9461     * intended to be included in the phantom invoice route hints must return the same value from
9462     * this method.
9463     *
9464     * This method must return the same value each time it is called.
9465     *
9466     * [phantom node payments]: PhantomKeysManager
9467     */
9468    struct LDKThirtyTwoBytes (*get_inbound_payment_key_material)(const void *this_arg);
9469    /**
9470     * Get node id based on the provided [`Recipient`].
9471     *
9472     * This method must return the same value each time it is called with a given [`Recipient`]
9473     * parameter.
9474     *
9475     * Errors if the [`Recipient`] variant is not supported by the implementation.
9476     */
9477    struct LDKCResult_PublicKeyNoneZ (*get_node_id)(const void *this_arg, enum LDKRecipient recipient);
9478    /**
9479     * Gets the ECDH shared secret of our node secret and `other_key`, multiplying by `tweak` if
9480     * one is provided. Note that this tweak can be applied to `other_key` instead of our node
9481     * secret, though this is less efficient.
9482     *
9483     * Note that if this fails while attempting to forward an HTLC, LDK will panic. The error
9484     * should be resolved to allow LDK to resume forwarding HTLCs.
9485     *
9486     * Errors if the [`Recipient`] variant is not supported by the implementation.
9487     */
9488    struct LDKCResult_SharedSecretNoneZ (*ecdh)(const void *this_arg, enum LDKRecipient recipient, struct LDKPublicKey other_key, struct LDKCOption_ScalarZ tweak);
9489    /**
9490     * Sign an invoice.
9491     *
9492     * By parameterizing by the raw invoice bytes instead of the hash, we allow implementors of
9493     * this trait to parse the invoice and make sure they're signing what they expect, rather than
9494     * blindly signing the hash.
9495     *
9496     * The `hrp_bytes` are ASCII bytes, while the `invoice_data` is base32.
9497     *
9498     * The secret key used to sign the invoice is dependent on the [`Recipient`].
9499     *
9500     * Errors if the [`Recipient`] variant is not supported by the implementation.
9501     */
9502    struct LDKCResult_RecoverableSignatureNoneZ (*sign_invoice)(const void *this_arg, struct LDKu8slice hrp_bytes, struct LDKCVec_U5Z invoice_data, enum LDKRecipient recipient);
9503    /**
9504     * Sign a gossip message.
9505     *
9506     * Note that if this fails, LDK may panic and the message will not be broadcast to the network
9507     * or a possible channel counterparty. If LDK panics, the error should be resolved to allow the
9508     * message to be broadcast, as otherwise it may prevent one from receiving funds over the
9509     * corresponding channel.
9510     */
9511    struct LDKCResult_SignatureNoneZ (*sign_gossip_message)(const void *this_arg, struct LDKUnsignedGossipMessage msg);
9512    /**
9513     * Frees any resources associated with this object given its this_arg pointer.
9514     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
9515     */
9516    void (*free)(void *this_arg);
9517 } LDKNodeSigner;
9518
9519 /**
9520  * A trait that can return signer instances for individual channels.
9521  */
9522 typedef struct LDKSignerProvider {
9523    /**
9524     * An opaque pointer which is passed to your function implementations as an argument.
9525     * This has no meaning in the LDK, and can be NULL or any other value.
9526     */
9527    void *this_arg;
9528    /**
9529     * Generates a unique `channel_keys_id` that can be used to obtain a [`Self::Signer`] through
9530     * [`SignerProvider::derive_channel_signer`]. The `user_channel_id` is provided to allow
9531     * implementations of [`SignerProvider`] to maintain a mapping between itself and the generated
9532     * `channel_keys_id`.
9533     *
9534     * This method must return a different value each time it is called.
9535     */
9536    struct LDKThirtyTwoBytes (*generate_channel_keys_id)(const void *this_arg, bool inbound, uint64_t channel_value_satoshis, struct LDKU128 user_channel_id);
9537    /**
9538     * Derives the private key material backing a `Signer`.
9539     *
9540     * To derive a new `Signer`, a fresh `channel_keys_id` should be obtained through
9541     * [`SignerProvider::generate_channel_keys_id`]. Otherwise, an existing `Signer` can be
9542     * re-derived from its `channel_keys_id`, which can be obtained through its trait method
9543     * [`ChannelSigner::channel_keys_id`].
9544     */
9545    struct LDKWriteableEcdsaChannelSigner (*derive_channel_signer)(const void *this_arg, uint64_t channel_value_satoshis, struct LDKThirtyTwoBytes channel_keys_id);
9546    /**
9547     * Reads a [`Signer`] for this [`SignerProvider`] from the given input stream.
9548     * This is only called during deserialization of other objects which contain
9549     * [`WriteableEcdsaChannelSigner`]-implementing objects (i.e., [`ChannelMonitor`]s and [`ChannelManager`]s).
9550     * The bytes are exactly those which `<Self::Signer as Writeable>::write()` writes, and
9551     * contain no versioning scheme. You may wish to include your own version prefix and ensure
9552     * you've read all of the provided bytes to ensure no corruption occurred.
9553     *
9554     * This method is slowly being phased out -- it will only be called when reading objects
9555     * written by LDK versions prior to 0.0.113.
9556     *
9557     * [`Signer`]: Self::Signer
9558     * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor
9559     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
9560     */
9561    struct LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ (*read_chan_signer)(const void *this_arg, struct LDKu8slice reader);
9562    /**
9563     * Get a script pubkey which we send funds to when claiming on-chain contestable outputs.
9564     *
9565     * This method should return a different value each time it is called, to avoid linking
9566     * on-chain funds across channels as controlled to the same user.
9567     */
9568    struct LDKCVec_u8Z (*get_destination_script)(const void *this_arg);
9569    /**
9570     * Get a script pubkey which we will send funds to when closing a channel.
9571     *
9572     * This method should return a different value each time it is called, to avoid linking
9573     * on-chain funds across channels as controlled to the same user.
9574     */
9575    struct LDKShutdownScript (*get_shutdown_scriptpubkey)(const void *this_arg);
9576    /**
9577     * Frees any resources associated with this object given its this_arg pointer.
9578     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
9579     */
9580    void (*free)(void *this_arg);
9581 } LDKSignerProvider;
9582
9583 /**
9584  * A trait which should be implemented to provide feerate information on a number of time
9585  * horizons.
9586  *
9587  * Note that all of the functions implemented here *must* be reentrant-safe (obviously - they're
9588  * called from inside the library in response to chain events, P2P events, or timer events).
9589  */
9590 typedef struct LDKFeeEstimator {
9591    /**
9592     * An opaque pointer which is passed to your function implementations as an argument.
9593     * This has no meaning in the LDK, and can be NULL or any other value.
9594     */
9595    void *this_arg;
9596    /**
9597     * Gets estimated satoshis of fee required per 1000 Weight-Units.
9598     *
9599     * LDK will wrap this method and ensure that the value returned is no smaller than 253
9600     * (ie 1 satoshi-per-byte rounded up to ensure later round-downs don't put us below 1 satoshi-per-byte).
9601     *
9602     * The following unit conversions can be used to convert to sats/KW:
9603     *  * satoshis-per-byte * 250
9604     *  * satoshis-per-kbyte / 4
9605     */
9606    uint32_t (*get_est_sat_per_1000_weight)(const void *this_arg, enum LDKConfirmationTarget confirmation_target);
9607    /**
9608     * Frees any resources associated with this object given its this_arg pointer.
9609     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
9610     */
9611    void (*free)(void *this_arg);
9612 } LDKFeeEstimator;
9613
9614 /**
9615  * A trait defining behavior for routing a payment.
9616  */
9617 typedef struct LDKRouter {
9618    /**
9619     * An opaque pointer which is passed to your function implementations as an argument.
9620     * This has no meaning in the LDK, and can be NULL or any other value.
9621     */
9622    void *this_arg;
9623    /**
9624     * Finds a [`Route`] between `payer` and `payee` for a payment with the given values.
9625     *
9626     * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None
9627     */
9628    struct LDKCResult_RouteLightningErrorZ (*find_route)(const void *this_arg, struct LDKPublicKey payer, const struct LDKRouteParameters *NONNULL_PTR route_params, struct LDKCVec_ChannelDetailsZ *first_hops, const struct LDKInFlightHtlcs *NONNULL_PTR inflight_htlcs);
9629    /**
9630     * Finds a [`Route`] between `payer` and `payee` for a payment with the given values. Includes
9631     * `PaymentHash` and `PaymentId` to be able to correlate the request with a specific payment.
9632     *
9633     * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None
9634     */
9635    struct LDKCResult_RouteLightningErrorZ (*find_route_with_id)(const void *this_arg, struct LDKPublicKey payer, const struct LDKRouteParameters *NONNULL_PTR route_params, struct LDKCVec_ChannelDetailsZ *first_hops, const struct LDKInFlightHtlcs *NONNULL_PTR inflight_htlcs, struct LDKThirtyTwoBytes _payment_hash, struct LDKThirtyTwoBytes _payment_id);
9636    /**
9637     * Frees any resources associated with this object given its this_arg pointer.
9638     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
9639     */
9640    void (*free)(void *this_arg);
9641 } LDKRouter;
9642
9643
9644
9645 /**
9646  * Manager which keeps track of a number of channels and sends messages to the appropriate
9647  * channel, also tracking HTLC preimages and forwarding onion packets appropriately.
9648  *
9649  * Implements [`ChannelMessageHandler`], handling the multi-channel parts and passing things through
9650  * to individual Channels.
9651  *
9652  * Implements [`Writeable`] to write out all channel state to disk. Implies [`peer_disconnected`] for
9653  * all peers during write/read (though does not modify this instance, only the instance being
9654  * serialized). This will result in any channels which have not yet exchanged [`funding_created`] (i.e.,
9655  * called [`funding_transaction_generated`] for outbound channels) being closed.
9656  *
9657  * Note that you can be a bit lazier about writing out `ChannelManager` than you can be with
9658  * [`ChannelMonitor`]. With [`ChannelMonitor`] you MUST write each monitor update out to disk before
9659  * returning from [`chain::Watch::watch_channel`]/[`update_channel`], with ChannelManagers, writing updates
9660  * happens out-of-band (and will prevent any other `ChannelManager` operations from occurring during
9661  * the serialization process). If the deserialized version is out-of-date compared to the
9662  * [`ChannelMonitor`] passed by reference to [`read`], those channels will be force-closed based on the
9663  * `ChannelMonitor` state and no funds will be lost (mod on-chain transaction fees).
9664  *
9665  * Note that the deserializer is only implemented for `(`[`BlockHash`]`, `[`ChannelManager`]`)`, which
9666  * tells you the last block hash which was connected. You should get the best block tip before using the manager.
9667  * See [`chain::Listen`] and [`chain::Confirm`] for more details.
9668  *
9669  * Note that `ChannelManager` is responsible for tracking liveness of its channels and generating
9670  * [`ChannelUpdate`] messages informing peers that the channel is temporarily disabled. To avoid
9671  * spam due to quick disconnection/reconnection, updates are not sent until the channel has been
9672  * offline for a full minute. In order to track this, you must call
9673  * [`timer_tick_occurred`] roughly once per minute, though it doesn't have to be perfect.
9674  *
9675  * To avoid trivial DoS issues, `ChannelManager` limits the number of inbound connections and
9676  * inbound channels without confirmed funding transactions. This may result in nodes which we do
9677  * not have a channel with being unable to connect to us or open new channels with us if we have
9678  * many peers with unfunded channels.
9679  *
9680  * Because it is an indication of trust, inbound channels which we've accepted as 0conf are
9681  * exempted from the count of unfunded channels. Similarly, outbound channels and connections are
9682  * never limited. Please ensure you limit the count of such channels yourself.
9683  *
9684  * Rather than using a plain `ChannelManager`, it is preferable to use either a [`SimpleArcChannelManager`]
9685  * a [`SimpleRefChannelManager`], for conciseness. See their documentation for more details, but
9686  * essentially you should default to using a [`SimpleRefChannelManager`], and use a
9687  * [`SimpleArcChannelManager`] when you require a `ChannelManager` with a static lifetime, such as when
9688  * you're using lightning-net-tokio.
9689  *
9690  * [`peer_disconnected`]: msgs::ChannelMessageHandler::peer_disconnected
9691  * [`funding_created`]: msgs::FundingCreated
9692  * [`funding_transaction_generated`]: Self::funding_transaction_generated
9693  * [`BlockHash`]: bitcoin::hash_types::BlockHash
9694  * [`update_channel`]: chain::Watch::update_channel
9695  * [`ChannelUpdate`]: msgs::ChannelUpdate
9696  * [`timer_tick_occurred`]: Self::timer_tick_occurred
9697  * [`read`]: ReadableArgs::read
9698  */
9699 typedef struct MUST_USE_STRUCT LDKChannelManager {
9700    /**
9701     * A pointer to the opaque Rust object.
9702     * Nearly everywhere, inner must be non-null, however in places where
9703     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9704     */
9705    LDKnativeChannelManager *inner;
9706    /**
9707     * Indicates that this is the only struct which contains the same pointer.
9708     * Rust functions which take ownership of an object provided via an argument require
9709     * this to be true and invalidate the object pointed to by inner.
9710     */
9711    bool is_owned;
9712 } LDKChannelManager;
9713
9714 /**
9715  * A tuple of 2 elements. See the individual fields for the types contained.
9716  */
9717 typedef struct LDKC2Tuple_BlockHashChannelManagerZ {
9718    /**
9719     * The element at position 0
9720     */
9721    struct LDKThirtyTwoBytes a;
9722    /**
9723     * The element at position 1
9724     */
9725    struct LDKChannelManager b;
9726 } LDKC2Tuple_BlockHashChannelManagerZ;
9727
9728 /**
9729  * The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
9730  */
9731 typedef union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
9732    /**
9733     * A pointer to the contents in the success state.
9734     * Reading from this pointer when `result_ok` is not set is undefined.
9735     */
9736    struct LDKC2Tuple_BlockHashChannelManagerZ *result;
9737    /**
9738     * A pointer to the contents in the error state.
9739     * Reading from this pointer when `result_ok` is set is undefined.
9740     */
9741    struct LDKDecodeError *err;
9742 } LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr;
9743
9744 /**
9745  * A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
9746  * containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
9747  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9748  */
9749 typedef struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9750    /**
9751     * The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
9752     * `err` or `result` depending on the state of `result_ok`.
9753     */
9754    union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr contents;
9755    /**
9756     * Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
9757     */
9758    bool result_ok;
9759 } LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ;
9760
9761
9762
9763 /**
9764  * Options which apply on a per-channel basis and may change at runtime or based on negotiation
9765  * with our counterparty.
9766  */
9767 typedef struct MUST_USE_STRUCT LDKChannelConfig {
9768    /**
9769     * A pointer to the opaque Rust object.
9770     * Nearly everywhere, inner must be non-null, however in places where
9771     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9772     */
9773    LDKnativeChannelConfig *inner;
9774    /**
9775     * Indicates that this is the only struct which contains the same pointer.
9776     * Rust functions which take ownership of an object provided via an argument require
9777     * this to be true and invalidate the object pointed to by inner.
9778     */
9779    bool is_owned;
9780 } LDKChannelConfig;
9781
9782 /**
9783  * The contents of CResult_ChannelConfigDecodeErrorZ
9784  */
9785 typedef union LDKCResult_ChannelConfigDecodeErrorZPtr {
9786    /**
9787     * A pointer to the contents in the success state.
9788     * Reading from this pointer when `result_ok` is not set is undefined.
9789     */
9790    struct LDKChannelConfig *result;
9791    /**
9792     * A pointer to the contents in the error state.
9793     * Reading from this pointer when `result_ok` is set is undefined.
9794     */
9795    struct LDKDecodeError *err;
9796 } LDKCResult_ChannelConfigDecodeErrorZPtr;
9797
9798 /**
9799  * A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
9800  * containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
9801  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9802  */
9803 typedef struct LDKCResult_ChannelConfigDecodeErrorZ {
9804    /**
9805     * The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
9806     * `err` or `result` depending on the state of `result_ok`.
9807     */
9808    union LDKCResult_ChannelConfigDecodeErrorZPtr contents;
9809    /**
9810     * Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
9811     */
9812    bool result_ok;
9813 } LDKCResult_ChannelConfigDecodeErrorZ;
9814
9815 /**
9816  * An enum which can either contain a crate::lightning::util::errors::APIError or not
9817  */
9818 typedef enum LDKCOption_APIErrorZ_Tag {
9819    /**
9820     * When we're in this state, this COption_APIErrorZ contains a crate::lightning::util::errors::APIError
9821     */
9822    LDKCOption_APIErrorZ_Some,
9823    /**
9824     * When we're in this state, this COption_APIErrorZ contains nothing
9825     */
9826    LDKCOption_APIErrorZ_None,
9827    /**
9828     * Must be last for serialization purposes
9829     */
9830    LDKCOption_APIErrorZ_Sentinel,
9831 } LDKCOption_APIErrorZ_Tag;
9832
9833 typedef struct LDKCOption_APIErrorZ {
9834    LDKCOption_APIErrorZ_Tag tag;
9835    union {
9836       struct {
9837          struct LDKAPIError some;
9838       };
9839    };
9840 } LDKCOption_APIErrorZ;
9841
9842 /**
9843  * The contents of CResult_COption_APIErrorZDecodeErrorZ
9844  */
9845 typedef union LDKCResult_COption_APIErrorZDecodeErrorZPtr {
9846    /**
9847     * A pointer to the contents in the success state.
9848     * Reading from this pointer when `result_ok` is not set is undefined.
9849     */
9850    struct LDKCOption_APIErrorZ *result;
9851    /**
9852     * A pointer to the contents in the error state.
9853     * Reading from this pointer when `result_ok` is set is undefined.
9854     */
9855    struct LDKDecodeError *err;
9856 } LDKCResult_COption_APIErrorZDecodeErrorZPtr;
9857
9858 /**
9859  * A CResult_COption_APIErrorZDecodeErrorZ represents the result of a fallible operation,
9860  * containing a crate::c_types::derived::COption_APIErrorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
9861  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9862  */
9863 typedef struct LDKCResult_COption_APIErrorZDecodeErrorZ {
9864    /**
9865     * The contents of this CResult_COption_APIErrorZDecodeErrorZ, accessible via either
9866     * `err` or `result` depending on the state of `result_ok`.
9867     */
9868    union LDKCResult_COption_APIErrorZDecodeErrorZPtr contents;
9869    /**
9870     * Whether this CResult_COption_APIErrorZDecodeErrorZ represents a success state.
9871     */
9872    bool result_ok;
9873 } LDKCResult_COption_APIErrorZDecodeErrorZ;
9874
9875 /**
9876  * The contents of CResult_UntrustedStringDecodeErrorZ
9877  */
9878 typedef union LDKCResult_UntrustedStringDecodeErrorZPtr {
9879    /**
9880     * A pointer to the contents in the success state.
9881     * Reading from this pointer when `result_ok` is not set is undefined.
9882     */
9883    struct LDKUntrustedString *result;
9884    /**
9885     * A pointer to the contents in the error state.
9886     * Reading from this pointer when `result_ok` is set is undefined.
9887     */
9888    struct LDKDecodeError *err;
9889 } LDKCResult_UntrustedStringDecodeErrorZPtr;
9890
9891 /**
9892  * A CResult_UntrustedStringDecodeErrorZ represents the result of a fallible operation,
9893  * containing a crate::lightning::util::string::UntrustedString on success and a crate::lightning::ln::msgs::DecodeError on failure.
9894  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9895  */
9896 typedef struct LDKCResult_UntrustedStringDecodeErrorZ {
9897    /**
9898     * The contents of this CResult_UntrustedStringDecodeErrorZ, accessible via either
9899     * `err` or `result` depending on the state of `result_ok`.
9900     */
9901    union LDKCResult_UntrustedStringDecodeErrorZPtr contents;
9902    /**
9903     * Whether this CResult_UntrustedStringDecodeErrorZ represents a success state.
9904     */
9905    bool result_ok;
9906 } LDKCResult_UntrustedStringDecodeErrorZ;
9907
9908 /**
9909  * The contents of CResult_OutPointDecodeErrorZ
9910  */
9911 typedef union LDKCResult_OutPointDecodeErrorZPtr {
9912    /**
9913     * A pointer to the contents in the success state.
9914     * Reading from this pointer when `result_ok` is not set is undefined.
9915     */
9916    struct LDKOutPoint *result;
9917    /**
9918     * A pointer to the contents in the error state.
9919     * Reading from this pointer when `result_ok` is set is undefined.
9920     */
9921    struct LDKDecodeError *err;
9922 } LDKCResult_OutPointDecodeErrorZPtr;
9923
9924 /**
9925  * A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
9926  * containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
9927  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9928  */
9929 typedef struct LDKCResult_OutPointDecodeErrorZ {
9930    /**
9931     * The contents of this CResult_OutPointDecodeErrorZ, accessible via either
9932     * `err` or `result` depending on the state of `result_ok`.
9933     */
9934    union LDKCResult_OutPointDecodeErrorZPtr contents;
9935    /**
9936     * Whether this CResult_OutPointDecodeErrorZ represents a success state.
9937     */
9938    bool result_ok;
9939 } LDKCResult_OutPointDecodeErrorZ;
9940
9941 /**
9942  * Defines a type identifier for sending messages over the wire.
9943  *
9944  * Messages implementing this trait specify a type and must be [`Writeable`].
9945  */
9946 typedef struct LDKType {
9947    /**
9948     * An opaque pointer which is passed to your function implementations as an argument.
9949     * This has no meaning in the LDK, and can be NULL or any other value.
9950     */
9951    void *this_arg;
9952    /**
9953     * Returns the type identifying the message payload.
9954     */
9955    uint16_t (*type_id)(const void *this_arg);
9956    /**
9957     * Return a human-readable "debug" string describing this object
9958     */
9959    struct LDKStr (*debug_str)(const void *this_arg);
9960    /**
9961     * Serialize the object into a byte array
9962     */
9963    struct LDKCVec_u8Z (*write)(const void *this_arg);
9964    /**
9965     * Frees any resources associated with this object given its this_arg pointer.
9966     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
9967     */
9968    void (*free)(void *this_arg);
9969 } LDKType;
9970
9971 /**
9972  * An enum which can either contain a crate::lightning::ln::wire::Type or not
9973  */
9974 typedef enum LDKCOption_TypeZ_Tag {
9975    /**
9976     * When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type
9977     */
9978    LDKCOption_TypeZ_Some,
9979    /**
9980     * When we're in this state, this COption_TypeZ contains nothing
9981     */
9982    LDKCOption_TypeZ_None,
9983    /**
9984     * Must be last for serialization purposes
9985     */
9986    LDKCOption_TypeZ_Sentinel,
9987 } LDKCOption_TypeZ_Tag;
9988
9989 typedef struct LDKCOption_TypeZ {
9990    LDKCOption_TypeZ_Tag tag;
9991    union {
9992       struct {
9993          struct LDKType some;
9994       };
9995    };
9996 } LDKCOption_TypeZ;
9997
9998 /**
9999  * The contents of CResult_COption_TypeZDecodeErrorZ
10000  */
10001 typedef union LDKCResult_COption_TypeZDecodeErrorZPtr {
10002    /**
10003     * A pointer to the contents in the success state.
10004     * Reading from this pointer when `result_ok` is not set is undefined.
10005     */
10006    struct LDKCOption_TypeZ *result;
10007    /**
10008     * A pointer to the contents in the error state.
10009     * Reading from this pointer when `result_ok` is set is undefined.
10010     */
10011    struct LDKDecodeError *err;
10012 } LDKCResult_COption_TypeZDecodeErrorZPtr;
10013
10014 /**
10015  * A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation,
10016  * containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
10017  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10018  */
10019 typedef struct LDKCResult_COption_TypeZDecodeErrorZ {
10020    /**
10021     * The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either
10022     * `err` or `result` depending on the state of `result_ok`.
10023     */
10024    union LDKCResult_COption_TypeZDecodeErrorZPtr contents;
10025    /**
10026     * Whether this CResult_COption_TypeZDecodeErrorZ represents a success state.
10027     */
10028    bool result_ok;
10029 } LDKCResult_COption_TypeZDecodeErrorZ;
10030
10031 /**
10032  * An error that may occur when making a payment.
10033  */
10034 typedef enum LDKPaymentError_Tag {
10035    /**
10036     * An error resulting from the provided [`Invoice`] or payment hash.
10037     */
10038    LDKPaymentError_Invoice,
10039    /**
10040     * An error occurring when sending a payment.
10041     */
10042    LDKPaymentError_Sending,
10043    /**
10044     * Must be last for serialization purposes
10045     */
10046    LDKPaymentError_Sentinel,
10047 } LDKPaymentError_Tag;
10048
10049 typedef struct MUST_USE_STRUCT LDKPaymentError {
10050    LDKPaymentError_Tag tag;
10051    union {
10052       struct {
10053          struct LDKStr invoice;
10054       };
10055       struct {
10056          enum LDKRetryableSendFailure sending;
10057       };
10058    };
10059 } LDKPaymentError;
10060
10061 /**
10062  * The contents of CResult_PaymentIdPaymentErrorZ
10063  */
10064 typedef union LDKCResult_PaymentIdPaymentErrorZPtr {
10065    /**
10066     * A pointer to the contents in the success state.
10067     * Reading from this pointer when `result_ok` is not set is undefined.
10068     */
10069    struct LDKThirtyTwoBytes *result;
10070    /**
10071     * A pointer to the contents in the error state.
10072     * Reading from this pointer when `result_ok` is set is undefined.
10073     */
10074    struct LDKPaymentError *err;
10075 } LDKCResult_PaymentIdPaymentErrorZPtr;
10076
10077 /**
10078  * A CResult_PaymentIdPaymentErrorZ represents the result of a fallible operation,
10079  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning_invoice::payment::PaymentError on failure.
10080  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10081  */
10082 typedef struct LDKCResult_PaymentIdPaymentErrorZ {
10083    /**
10084     * The contents of this CResult_PaymentIdPaymentErrorZ, accessible via either
10085     * `err` or `result` depending on the state of `result_ok`.
10086     */
10087    union LDKCResult_PaymentIdPaymentErrorZPtr contents;
10088    /**
10089     * Whether this CResult_PaymentIdPaymentErrorZ represents a success state.
10090     */
10091    bool result_ok;
10092 } LDKCResult_PaymentIdPaymentErrorZ;
10093
10094 /**
10095  * The contents of CResult_NonePaymentErrorZ
10096  */
10097 typedef union LDKCResult_NonePaymentErrorZPtr {
10098    /**
10099     * Note that this value is always NULL, as there are no contents in the OK variant
10100     */
10101    void *result;
10102    /**
10103     * A pointer to the contents in the error state.
10104     * Reading from this pointer when `result_ok` is set is undefined.
10105     */
10106    struct LDKPaymentError *err;
10107 } LDKCResult_NonePaymentErrorZPtr;
10108
10109 /**
10110  * A CResult_NonePaymentErrorZ represents the result of a fallible operation,
10111  * containing a () on success and a crate::lightning_invoice::payment::PaymentError on failure.
10112  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10113  */
10114 typedef struct LDKCResult_NonePaymentErrorZ {
10115    /**
10116     * The contents of this CResult_NonePaymentErrorZ, accessible via either
10117     * `err` or `result` depending on the state of `result_ok`.
10118     */
10119    union LDKCResult_NonePaymentErrorZPtr contents;
10120    /**
10121     * Whether this CResult_NonePaymentErrorZ represents a success state.
10122     */
10123    bool result_ok;
10124 } LDKCResult_NonePaymentErrorZ;
10125
10126 /**
10127  * The contents of CResult_StringErrorZ
10128  */
10129 typedef union LDKCResult_StringErrorZPtr {
10130    /**
10131     * A pointer to the contents in the success state.
10132     * Reading from this pointer when `result_ok` is not set is undefined.
10133     */
10134    struct LDKStr *result;
10135    /**
10136     * A pointer to the contents in the error state.
10137     * Reading from this pointer when `result_ok` is set is undefined.
10138     */
10139    enum LDKSecp256k1Error *err;
10140 } LDKCResult_StringErrorZPtr;
10141
10142 /**
10143  * A CResult_StringErrorZ represents the result of a fallible operation,
10144  * containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
10145  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10146  */
10147 typedef struct LDKCResult_StringErrorZ {
10148    /**
10149     * The contents of this CResult_StringErrorZ, accessible via either
10150     * `err` or `result` depending on the state of `result_ok`.
10151     */
10152    union LDKCResult_StringErrorZPtr contents;
10153    /**
10154     * Whether this CResult_StringErrorZ represents a success state.
10155     */
10156    bool result_ok;
10157 } LDKCResult_StringErrorZ;
10158
10159 /**
10160  * The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
10161  */
10162 typedef union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr {
10163    /**
10164     * A pointer to the contents in the success state.
10165     * Reading from this pointer when `result_ok` is not set is undefined.
10166     */
10167    struct LDKChannelMonitorUpdate *result;
10168    /**
10169     * A pointer to the contents in the error state.
10170     * Reading from this pointer when `result_ok` is set is undefined.
10171     */
10172    struct LDKDecodeError *err;
10173 } LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr;
10174
10175 /**
10176  * A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
10177  * containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
10178  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10179  */
10180 typedef struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ {
10181    /**
10182     * The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
10183     * `err` or `result` depending on the state of `result_ok`.
10184     */
10185    union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr contents;
10186    /**
10187     * Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
10188     */
10189    bool result_ok;
10190 } LDKCResult_ChannelMonitorUpdateDecodeErrorZ;
10191
10192 /**
10193  * An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not
10194  */
10195 typedef enum LDKCOption_MonitorEventZ_Tag {
10196    /**
10197     * When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent
10198     */
10199    LDKCOption_MonitorEventZ_Some,
10200    /**
10201     * When we're in this state, this COption_MonitorEventZ contains nothing
10202     */
10203    LDKCOption_MonitorEventZ_None,
10204    /**
10205     * Must be last for serialization purposes
10206     */
10207    LDKCOption_MonitorEventZ_Sentinel,
10208 } LDKCOption_MonitorEventZ_Tag;
10209
10210 typedef struct LDKCOption_MonitorEventZ {
10211    LDKCOption_MonitorEventZ_Tag tag;
10212    union {
10213       struct {
10214          struct LDKMonitorEvent some;
10215       };
10216    };
10217 } LDKCOption_MonitorEventZ;
10218
10219 /**
10220  * The contents of CResult_COption_MonitorEventZDecodeErrorZ
10221  */
10222 typedef union LDKCResult_COption_MonitorEventZDecodeErrorZPtr {
10223    /**
10224     * A pointer to the contents in the success state.
10225     * Reading from this pointer when `result_ok` is not set is undefined.
10226     */
10227    struct LDKCOption_MonitorEventZ *result;
10228    /**
10229     * A pointer to the contents in the error state.
10230     * Reading from this pointer when `result_ok` is set is undefined.
10231     */
10232    struct LDKDecodeError *err;
10233 } LDKCResult_COption_MonitorEventZDecodeErrorZPtr;
10234
10235 /**
10236  * A CResult_COption_MonitorEventZDecodeErrorZ represents the result of a fallible operation,
10237  * containing a crate::c_types::derived::COption_MonitorEventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
10238  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10239  */
10240 typedef struct LDKCResult_COption_MonitorEventZDecodeErrorZ {
10241    /**
10242     * The contents of this CResult_COption_MonitorEventZDecodeErrorZ, accessible via either
10243     * `err` or `result` depending on the state of `result_ok`.
10244     */
10245    union LDKCResult_COption_MonitorEventZDecodeErrorZPtr contents;
10246    /**
10247     * Whether this CResult_COption_MonitorEventZDecodeErrorZ represents a success state.
10248     */
10249    bool result_ok;
10250 } LDKCResult_COption_MonitorEventZDecodeErrorZ;
10251
10252 /**
10253  * The contents of CResult_HTLCUpdateDecodeErrorZ
10254  */
10255 typedef union LDKCResult_HTLCUpdateDecodeErrorZPtr {
10256    /**
10257     * A pointer to the contents in the success state.
10258     * Reading from this pointer when `result_ok` is not set is undefined.
10259     */
10260    struct LDKHTLCUpdate *result;
10261    /**
10262     * A pointer to the contents in the error state.
10263     * Reading from this pointer when `result_ok` is set is undefined.
10264     */
10265    struct LDKDecodeError *err;
10266 } LDKCResult_HTLCUpdateDecodeErrorZPtr;
10267
10268 /**
10269  * A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
10270  * containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
10271  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10272  */
10273 typedef struct LDKCResult_HTLCUpdateDecodeErrorZ {
10274    /**
10275     * The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
10276     * `err` or `result` depending on the state of `result_ok`.
10277     */
10278    union LDKCResult_HTLCUpdateDecodeErrorZPtr contents;
10279    /**
10280     * Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
10281     */
10282    bool result_ok;
10283 } LDKCResult_HTLCUpdateDecodeErrorZ;
10284
10285 /**
10286  * A tuple of 2 elements. See the individual fields for the types contained.
10287  */
10288 typedef struct LDKC2Tuple_OutPointScriptZ {
10289    /**
10290     * The element at position 0
10291     */
10292    struct LDKOutPoint a;
10293    /**
10294     * The element at position 1
10295     */
10296    struct LDKCVec_u8Z b;
10297 } LDKC2Tuple_OutPointScriptZ;
10298
10299 /**
10300  * A tuple of 2 elements. See the individual fields for the types contained.
10301  */
10302 typedef struct LDKC2Tuple_u32ScriptZ {
10303    /**
10304     * The element at position 0
10305     */
10306    uint32_t a;
10307    /**
10308     * The element at position 1
10309     */
10310    struct LDKCVec_u8Z b;
10311 } LDKC2Tuple_u32ScriptZ;
10312
10313 /**
10314  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
10315  * This corresponds to std::vector in C++
10316  */
10317 typedef struct LDKCVec_C2Tuple_u32ScriptZZ {
10318    /**
10319     * The elements in the array.
10320     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10321     */
10322    struct LDKC2Tuple_u32ScriptZ *data;
10323    /**
10324     * The number of elements pointed to by `data`.
10325     */
10326    uintptr_t datalen;
10327 } LDKCVec_C2Tuple_u32ScriptZZ;
10328
10329 /**
10330  * A tuple of 2 elements. See the individual fields for the types contained.
10331  */
10332 typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
10333    /**
10334     * The element at position 0
10335     */
10336    struct LDKThirtyTwoBytes a;
10337    /**
10338     * The element at position 1
10339     */
10340    struct LDKCVec_C2Tuple_u32ScriptZZ b;
10341 } LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ;
10342
10343 /**
10344  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
10345  * This corresponds to std::vector in C++
10346  */
10347 typedef struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
10348    /**
10349     * The elements in the array.
10350     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10351     */
10352    struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *data;
10353    /**
10354     * The number of elements pointed to by `data`.
10355     */
10356    uintptr_t datalen;
10357 } LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ;
10358
10359 /**
10360  * A dynamically-allocated array of crate::lightning::events::Events of arbitrary size.
10361  * This corresponds to std::vector in C++
10362  */
10363 typedef struct LDKCVec_EventZ {
10364    /**
10365     * The elements in the array.
10366     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10367     */
10368    struct LDKEvent *data;
10369    /**
10370     * The number of elements pointed to by `data`.
10371     */
10372    uintptr_t datalen;
10373 } LDKCVec_EventZ;
10374
10375 /**
10376  * A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
10377  * This corresponds to std::vector in C++
10378  */
10379 typedef struct LDKCVec_TransactionZ {
10380    /**
10381     * The elements in the array.
10382     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10383     */
10384    struct LDKTransaction *data;
10385    /**
10386     * The number of elements pointed to by `data`.
10387     */
10388    uintptr_t datalen;
10389 } LDKCVec_TransactionZ;
10390
10391 /**
10392  * A tuple of 2 elements. See the individual fields for the types contained.
10393  */
10394 typedef struct LDKC2Tuple_u32TxOutZ {
10395    /**
10396     * The element at position 0
10397     */
10398    uint32_t a;
10399    /**
10400     * The element at position 1
10401     */
10402    struct LDKTxOut b;
10403 } LDKC2Tuple_u32TxOutZ;
10404
10405 /**
10406  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
10407  * This corresponds to std::vector in C++
10408  */
10409 typedef struct LDKCVec_C2Tuple_u32TxOutZZ {
10410    /**
10411     * The elements in the array.
10412     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10413     */
10414    struct LDKC2Tuple_u32TxOutZ *data;
10415    /**
10416     * The number of elements pointed to by `data`.
10417     */
10418    uintptr_t datalen;
10419 } LDKCVec_C2Tuple_u32TxOutZZ;
10420
10421 /**
10422  * A tuple of 2 elements. See the individual fields for the types contained.
10423  */
10424 typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
10425    /**
10426     * The element at position 0
10427     */
10428    struct LDKThirtyTwoBytes a;
10429    /**
10430     * The element at position 1
10431     */
10432    struct LDKCVec_C2Tuple_u32TxOutZZ b;
10433 } LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ;
10434
10435 /**
10436  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
10437  * This corresponds to std::vector in C++
10438  */
10439 typedef struct LDKCVec_TransactionOutputsZ {
10440    /**
10441     * The elements in the array.
10442     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10443     */
10444    struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *data;
10445    /**
10446     * The number of elements pointed to by `data`.
10447     */
10448    uintptr_t datalen;
10449 } LDKCVec_TransactionOutputsZ;
10450
10451 /**
10452  * Details about the balance(s) available for spending once the channel appears on chain.
10453  *
10454  * See [`ChannelMonitor::get_claimable_balances`] for more details on when these will or will not
10455  * be provided.
10456  */
10457 typedef enum LDKBalance_Tag {
10458    /**
10459     * The channel is not yet closed (or the commitment or closing transaction has not yet
10460     * appeared in a block). The given balance is claimable (less on-chain fees) if the channel is
10461     * force-closed now.
10462     */
10463    LDKBalance_ClaimableOnChannelClose,
10464    /**
10465     * The channel has been closed, and the given balance is ours but awaiting confirmations until
10466     * we consider it spendable.
10467     */
10468    LDKBalance_ClaimableAwaitingConfirmations,
10469    /**
10470     * The channel has been closed, and the given balance should be ours but awaiting spending
10471     * transaction confirmation. If the spending transaction does not confirm in time, it is
10472     * possible our counterparty can take the funds by broadcasting an HTLC timeout on-chain.
10473     *
10474     * Once the spending transaction confirms, before it has reached enough confirmations to be
10475     * considered safe from chain reorganizations, the balance will instead be provided via
10476     * [`Balance::ClaimableAwaitingConfirmations`].
10477     */
10478    LDKBalance_ContentiousClaimable,
10479    /**
10480     * HTLCs which we sent to our counterparty which are claimable after a timeout (less on-chain
10481     * fees) if the counterparty does not know the preimage for the HTLCs. These are somewhat
10482     * likely to be claimed by our counterparty before we do.
10483     */
10484    LDKBalance_MaybeTimeoutClaimableHTLC,
10485    /**
10486     * HTLCs which we received from our counterparty which are claimable with a preimage which we
10487     * do not currently have. This will only be claimable if we receive the preimage from the node
10488     * to which we forwarded this HTLC before the timeout.
10489     */
10490    LDKBalance_MaybePreimageClaimableHTLC,
10491    /**
10492     * The channel has been closed, and our counterparty broadcasted a revoked commitment
10493     * transaction.
10494     *
10495     * Thus, we're able to claim all outputs in the commitment transaction, one of which has the
10496     * following amount.
10497     */
10498    LDKBalance_CounterpartyRevokedOutputClaimable,
10499    /**
10500     * Must be last for serialization purposes
10501     */
10502    LDKBalance_Sentinel,
10503 } LDKBalance_Tag;
10504
10505 typedef struct LDKBalance_LDKClaimableOnChannelClose_Body {
10506    /**
10507     * The amount available to claim, in satoshis, excluding the on-chain fees which will be
10508     * required to do so.
10509     */
10510    uint64_t claimable_amount_satoshis;
10511 } LDKBalance_LDKClaimableOnChannelClose_Body;
10512
10513 typedef struct LDKBalance_LDKClaimableAwaitingConfirmations_Body {
10514    /**
10515     * The amount available to claim, in satoshis, possibly excluding the on-chain fees which
10516     * were spent in broadcasting the transaction.
10517     */
10518    uint64_t claimable_amount_satoshis;
10519    /**
10520     * The height at which an [`Event::SpendableOutputs`] event will be generated for this
10521     * amount.
10522     */
10523    uint32_t confirmation_height;
10524 } LDKBalance_LDKClaimableAwaitingConfirmations_Body;
10525
10526 typedef struct LDKBalance_LDKContentiousClaimable_Body {
10527    /**
10528     * The amount available to claim, in satoshis, excluding the on-chain fees which will be
10529     * required to do so.
10530     */
10531    uint64_t claimable_amount_satoshis;
10532    /**
10533     * The height at which the counterparty may be able to claim the balance if we have not
10534     * done so.
10535     */
10536    uint32_t timeout_height;
10537 } LDKBalance_LDKContentiousClaimable_Body;
10538
10539 typedef struct LDKBalance_LDKMaybeTimeoutClaimableHTLC_Body {
10540    /**
10541     * The amount potentially available to claim, in satoshis, excluding the on-chain fees
10542     * which will be required to do so.
10543     */
10544    uint64_t claimable_amount_satoshis;
10545    /**
10546     * The height at which we will be able to claim the balance if our counterparty has not
10547     * done so.
10548     */
10549    uint32_t claimable_height;
10550 } LDKBalance_LDKMaybeTimeoutClaimableHTLC_Body;
10551
10552 typedef struct LDKBalance_LDKMaybePreimageClaimableHTLC_Body {
10553    /**
10554     * The amount potentially available to claim, in satoshis, excluding the on-chain fees
10555     * which will be required to do so.
10556     */
10557    uint64_t claimable_amount_satoshis;
10558    /**
10559     * The height at which our counterparty will be able to claim the balance if we have not
10560     * yet received the preimage and claimed it ourselves.
10561     */
10562    uint32_t expiry_height;
10563 } LDKBalance_LDKMaybePreimageClaimableHTLC_Body;
10564
10565 typedef struct LDKBalance_LDKCounterpartyRevokedOutputClaimable_Body {
10566    /**
10567     * The amount, in satoshis, of the output which we can claim.
10568     *
10569     * Note that for outputs from HTLC balances this may be excluding some on-chain fees that
10570     * were already spent.
10571     */
10572    uint64_t claimable_amount_satoshis;
10573 } LDKBalance_LDKCounterpartyRevokedOutputClaimable_Body;
10574
10575 typedef struct MUST_USE_STRUCT LDKBalance {
10576    LDKBalance_Tag tag;
10577    union {
10578       LDKBalance_LDKClaimableOnChannelClose_Body claimable_on_channel_close;
10579       LDKBalance_LDKClaimableAwaitingConfirmations_Body claimable_awaiting_confirmations;
10580       LDKBalance_LDKContentiousClaimable_Body contentious_claimable;
10581       LDKBalance_LDKMaybeTimeoutClaimableHTLC_Body maybe_timeout_claimable_htlc;
10582       LDKBalance_LDKMaybePreimageClaimableHTLC_Body maybe_preimage_claimable_htlc;
10583       LDKBalance_LDKCounterpartyRevokedOutputClaimable_Body counterparty_revoked_output_claimable;
10584    };
10585 } LDKBalance;
10586
10587 /**
10588  * A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size.
10589  * This corresponds to std::vector in C++
10590  */
10591 typedef struct LDKCVec_BalanceZ {
10592    /**
10593     * The elements in the array.
10594     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10595     */
10596    struct LDKBalance *data;
10597    /**
10598     * The number of elements pointed to by `data`.
10599     */
10600    uintptr_t datalen;
10601 } LDKCVec_BalanceZ;
10602
10603 /**
10604  * The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
10605  */
10606 typedef union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
10607    /**
10608     * A pointer to the contents in the success state.
10609     * Reading from this pointer when `result_ok` is not set is undefined.
10610     */
10611    struct LDKC2Tuple_BlockHashChannelMonitorZ *result;
10612    /**
10613     * A pointer to the contents in the error state.
10614     * Reading from this pointer when `result_ok` is set is undefined.
10615     */
10616    struct LDKDecodeError *err;
10617 } LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr;
10618
10619 /**
10620  * A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
10621  * containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
10622  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10623  */
10624 typedef struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
10625    /**
10626     * The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
10627     * `err` or `result` depending on the state of `result_ok`.
10628     */
10629    union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr contents;
10630    /**
10631     * Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
10632     */
10633    bool result_ok;
10634 } LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ;
10635
10636 /**
10637  * A tuple of 2 elements. See the individual fields for the types contained.
10638  */
10639 typedef struct LDKC2Tuple_PublicKeyTypeZ {
10640    /**
10641     * The element at position 0
10642     */
10643    struct LDKPublicKey a;
10644    /**
10645     * The element at position 1
10646     */
10647    struct LDKType b;
10648 } LDKC2Tuple_PublicKeyTypeZ;
10649
10650 /**
10651  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size.
10652  * This corresponds to std::vector in C++
10653  */
10654 typedef struct LDKCVec_C2Tuple_PublicKeyTypeZZ {
10655    /**
10656     * The elements in the array.
10657     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10658     */
10659    struct LDKC2Tuple_PublicKeyTypeZ *data;
10660    /**
10661     * The number of elements pointed to by `data`.
10662     */
10663    uintptr_t datalen;
10664 } LDKCVec_C2Tuple_PublicKeyTypeZZ;
10665
10666 /**
10667  * The contents of a custom onion message.
10668  */
10669 typedef struct LDKCustomOnionMessageContents {
10670    /**
10671     * An opaque pointer which is passed to your function implementations as an argument.
10672     * This has no meaning in the LDK, and can be NULL or any other value.
10673     */
10674    void *this_arg;
10675    /**
10676     * Returns the TLV type identifying the message contents. MUST be >= 64.
10677     */
10678    uint64_t (*tlv_type)(const void *this_arg);
10679    /**
10680     * Serialize the object into a byte array
10681     */
10682    struct LDKCVec_u8Z (*write)(const void *this_arg);
10683    /**
10684     * Frees any resources associated with this object given its this_arg pointer.
10685     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
10686     */
10687    void (*free)(void *this_arg);
10688 } LDKCustomOnionMessageContents;
10689
10690 /**
10691  * An enum which can either contain a crate::lightning::onion_message::packet::CustomOnionMessageContents or not
10692  */
10693 typedef enum LDKCOption_CustomOnionMessageContentsZ_Tag {
10694    /**
10695     * When we're in this state, this COption_CustomOnionMessageContentsZ contains a crate::lightning::onion_message::packet::CustomOnionMessageContents
10696     */
10697    LDKCOption_CustomOnionMessageContentsZ_Some,
10698    /**
10699     * When we're in this state, this COption_CustomOnionMessageContentsZ contains nothing
10700     */
10701    LDKCOption_CustomOnionMessageContentsZ_None,
10702    /**
10703     * Must be last for serialization purposes
10704     */
10705    LDKCOption_CustomOnionMessageContentsZ_Sentinel,
10706 } LDKCOption_CustomOnionMessageContentsZ_Tag;
10707
10708 typedef struct LDKCOption_CustomOnionMessageContentsZ {
10709    LDKCOption_CustomOnionMessageContentsZ_Tag tag;
10710    union {
10711       struct {
10712          struct LDKCustomOnionMessageContents some;
10713       };
10714    };
10715 } LDKCOption_CustomOnionMessageContentsZ;
10716
10717 /**
10718  * The contents of CResult_COption_CustomOnionMessageContentsZDecodeErrorZ
10719  */
10720 typedef union LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr {
10721    /**
10722     * A pointer to the contents in the success state.
10723     * Reading from this pointer when `result_ok` is not set is undefined.
10724     */
10725    struct LDKCOption_CustomOnionMessageContentsZ *result;
10726    /**
10727     * A pointer to the contents in the error state.
10728     * Reading from this pointer when `result_ok` is set is undefined.
10729     */
10730    struct LDKDecodeError *err;
10731 } LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr;
10732
10733 /**
10734  * A CResult_COption_CustomOnionMessageContentsZDecodeErrorZ represents the result of a fallible operation,
10735  * containing a crate::c_types::derived::COption_CustomOnionMessageContentsZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
10736  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10737  */
10738 typedef struct LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
10739    /**
10740     * The contents of this CResult_COption_CustomOnionMessageContentsZDecodeErrorZ, accessible via either
10741     * `err` or `result` depending on the state of `result_ok`.
10742     */
10743    union LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr contents;
10744    /**
10745     * Whether this CResult_COption_CustomOnionMessageContentsZDecodeErrorZ represents a success state.
10746     */
10747    bool result_ok;
10748 } LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ;
10749
10750 /**
10751  * An enum which can either contain a crate::lightning::ln::msgs::NetAddress or not
10752  */
10753 typedef enum LDKCOption_NetAddressZ_Tag {
10754    /**
10755     * When we're in this state, this COption_NetAddressZ contains a crate::lightning::ln::msgs::NetAddress
10756     */
10757    LDKCOption_NetAddressZ_Some,
10758    /**
10759     * When we're in this state, this COption_NetAddressZ contains nothing
10760     */
10761    LDKCOption_NetAddressZ_None,
10762    /**
10763     * Must be last for serialization purposes
10764     */
10765    LDKCOption_NetAddressZ_Sentinel,
10766 } LDKCOption_NetAddressZ_Tag;
10767
10768 typedef struct LDKCOption_NetAddressZ {
10769    LDKCOption_NetAddressZ_Tag tag;
10770    union {
10771       struct {
10772          struct LDKNetAddress some;
10773       };
10774    };
10775 } LDKCOption_NetAddressZ;
10776
10777 /**
10778  * A tuple of 2 elements. See the individual fields for the types contained.
10779  */
10780 typedef struct LDKC2Tuple_PublicKeyCOption_NetAddressZZ {
10781    /**
10782     * The element at position 0
10783     */
10784    struct LDKPublicKey a;
10785    /**
10786     * The element at position 1
10787     */
10788    struct LDKCOption_NetAddressZ b;
10789 } LDKC2Tuple_PublicKeyCOption_NetAddressZZ;
10790
10791 /**
10792  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyCOption_NetAddressZZs of arbitrary size.
10793  * This corresponds to std::vector in C++
10794  */
10795 typedef struct LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ {
10796    /**
10797     * The elements in the array.
10798     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10799     */
10800    struct LDKC2Tuple_PublicKeyCOption_NetAddressZZ *data;
10801    /**
10802     * The number of elements pointed to by `data`.
10803     */
10804    uintptr_t datalen;
10805 } LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ;
10806
10807
10808
10809 /**
10810  * Error for PeerManager errors. If you get one of these, you must disconnect the socket and
10811  * generate no further read_event/write_buffer_space_avail/socket_disconnected calls for the
10812  * descriptor.
10813  */
10814 typedef struct MUST_USE_STRUCT LDKPeerHandleError {
10815    /**
10816     * A pointer to the opaque Rust object.
10817     * Nearly everywhere, inner must be non-null, however in places where
10818     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10819     */
10820    LDKnativePeerHandleError *inner;
10821    /**
10822     * Indicates that this is the only struct which contains the same pointer.
10823     * Rust functions which take ownership of an object provided via an argument require
10824     * this to be true and invalidate the object pointed to by inner.
10825     */
10826    bool is_owned;
10827 } LDKPeerHandleError;
10828
10829 /**
10830  * The contents of CResult_CVec_u8ZPeerHandleErrorZ
10831  */
10832 typedef union LDKCResult_CVec_u8ZPeerHandleErrorZPtr {
10833    /**
10834     * A pointer to the contents in the success state.
10835     * Reading from this pointer when `result_ok` is not set is undefined.
10836     */
10837    struct LDKCVec_u8Z *result;
10838    /**
10839     * A pointer to the contents in the error state.
10840     * Reading from this pointer when `result_ok` is set is undefined.
10841     */
10842    struct LDKPeerHandleError *err;
10843 } LDKCResult_CVec_u8ZPeerHandleErrorZPtr;
10844
10845 /**
10846  * A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
10847  * containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
10848  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10849  */
10850 typedef struct LDKCResult_CVec_u8ZPeerHandleErrorZ {
10851    /**
10852     * The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
10853     * `err` or `result` depending on the state of `result_ok`.
10854     */
10855    union LDKCResult_CVec_u8ZPeerHandleErrorZPtr contents;
10856    /**
10857     * Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
10858     */
10859    bool result_ok;
10860 } LDKCResult_CVec_u8ZPeerHandleErrorZ;
10861
10862 /**
10863  * The contents of CResult_NonePeerHandleErrorZ
10864  */
10865 typedef union LDKCResult_NonePeerHandleErrorZPtr {
10866    /**
10867     * Note that this value is always NULL, as there are no contents in the OK variant
10868     */
10869    void *result;
10870    /**
10871     * A pointer to the contents in the error state.
10872     * Reading from this pointer when `result_ok` is set is undefined.
10873     */
10874    struct LDKPeerHandleError *err;
10875 } LDKCResult_NonePeerHandleErrorZPtr;
10876
10877 /**
10878  * A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
10879  * containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
10880  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10881  */
10882 typedef struct LDKCResult_NonePeerHandleErrorZ {
10883    /**
10884     * The contents of this CResult_NonePeerHandleErrorZ, accessible via either
10885     * `err` or `result` depending on the state of `result_ok`.
10886     */
10887    union LDKCResult_NonePeerHandleErrorZPtr contents;
10888    /**
10889     * Whether this CResult_NonePeerHandleErrorZ represents a success state.
10890     */
10891    bool result_ok;
10892 } LDKCResult_NonePeerHandleErrorZ;
10893
10894 /**
10895  * The contents of CResult_boolPeerHandleErrorZ
10896  */
10897 typedef union LDKCResult_boolPeerHandleErrorZPtr {
10898    /**
10899     * A pointer to the contents in the success state.
10900     * Reading from this pointer when `result_ok` is not set is undefined.
10901     */
10902    bool *result;
10903    /**
10904     * A pointer to the contents in the error state.
10905     * Reading from this pointer when `result_ok` is set is undefined.
10906     */
10907    struct LDKPeerHandleError *err;
10908 } LDKCResult_boolPeerHandleErrorZPtr;
10909
10910 /**
10911  * A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
10912  * containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
10913  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10914  */
10915 typedef struct LDKCResult_boolPeerHandleErrorZ {
10916    /**
10917     * The contents of this CResult_boolPeerHandleErrorZ, accessible via either
10918     * `err` or `result` depending on the state of `result_ok`.
10919     */
10920    union LDKCResult_boolPeerHandleErrorZPtr contents;
10921    /**
10922     * Whether this CResult_boolPeerHandleErrorZ represents a success state.
10923     */
10924    bool result_ok;
10925 } LDKCResult_boolPeerHandleErrorZ;
10926
10927 /**
10928  * Errors that may occur when [sending an onion message].
10929  *
10930  * [sending an onion message]: OnionMessenger::send_onion_message
10931  */
10932 typedef enum LDKSendError_Tag {
10933    /**
10934     * Errored computing onion message packet keys.
10935     */
10936    LDKSendError_Secp256k1,
10937    /**
10938     * Because implementations such as Eclair will drop onion messages where the message packet
10939     * exceeds 32834 bytes, we refuse to send messages where the packet exceeds this size.
10940     */
10941    LDKSendError_TooBigPacket,
10942    /**
10943     * The provided [`Destination`] was an invalid [`BlindedPath`], due to having fewer than two
10944     * blinded hops.
10945     */
10946    LDKSendError_TooFewBlindedHops,
10947    /**
10948     * Our next-hop peer was offline or does not support onion message forwarding.
10949     */
10950    LDKSendError_InvalidFirstHop,
10951    /**
10952     * Onion message contents must have a TLV type >= 64.
10953     */
10954    LDKSendError_InvalidMessage,
10955    /**
10956     * Our next-hop peer's buffer was full or our total outbound buffer was full.
10957     */
10958    LDKSendError_BufferFull,
10959    /**
10960     * Failed to retrieve our node id from the provided [`NodeSigner`].
10961     *
10962     * [`NodeSigner`]: crate::chain::keysinterface::NodeSigner
10963     */
10964    LDKSendError_GetNodeIdFailed,
10965    /**
10966     * We attempted to send to a blinded path where we are the introduction node, and failed to
10967     * advance the blinded path to make the second hop the new introduction node. Either
10968     * [`NodeSigner::ecdh`] failed, we failed to tweak the current blinding point to get the
10969     * new blinding point, or we were attempting to send to ourselves.
10970     */
10971    LDKSendError_BlindedPathAdvanceFailed,
10972    /**
10973     * Must be last for serialization purposes
10974     */
10975    LDKSendError_Sentinel,
10976 } LDKSendError_Tag;
10977
10978 typedef struct MUST_USE_STRUCT LDKSendError {
10979    LDKSendError_Tag tag;
10980    union {
10981       struct {
10982          enum LDKSecp256k1Error secp256k1;
10983       };
10984    };
10985 } LDKSendError;
10986
10987 /**
10988  * The contents of CResult_NoneSendErrorZ
10989  */
10990 typedef union LDKCResult_NoneSendErrorZPtr {
10991    /**
10992     * Note that this value is always NULL, as there are no contents in the OK variant
10993     */
10994    void *result;
10995    /**
10996     * A pointer to the contents in the error state.
10997     * Reading from this pointer when `result_ok` is set is undefined.
10998     */
10999    struct LDKSendError *err;
11000 } LDKCResult_NoneSendErrorZPtr;
11001
11002 /**
11003  * A CResult_NoneSendErrorZ represents the result of a fallible operation,
11004  * containing a () on success and a crate::lightning::onion_message::messenger::SendError on failure.
11005  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11006  */
11007 typedef struct LDKCResult_NoneSendErrorZ {
11008    /**
11009     * The contents of this CResult_NoneSendErrorZ, accessible via either
11010     * `err` or `result` depending on the state of `result_ok`.
11011     */
11012    union LDKCResult_NoneSendErrorZPtr contents;
11013    /**
11014     * Whether this CResult_NoneSendErrorZ represents a success state.
11015     */
11016    bool result_ok;
11017 } LDKCResult_NoneSendErrorZ;
11018
11019 /**
11020  * The contents of CResult_BlindedPathNoneZ
11021  */
11022 typedef union LDKCResult_BlindedPathNoneZPtr {
11023    /**
11024     * A pointer to the contents in the success state.
11025     * Reading from this pointer when `result_ok` is not set is undefined.
11026     */
11027    struct LDKBlindedPath *result;
11028    /**
11029     * Note that this value is always NULL, as there are no contents in the Err variant
11030     */
11031    void *err;
11032 } LDKCResult_BlindedPathNoneZPtr;
11033
11034 /**
11035  * A CResult_BlindedPathNoneZ represents the result of a fallible operation,
11036  * containing a crate::lightning::blinded_path::BlindedPath on success and a () on failure.
11037  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11038  */
11039 typedef struct LDKCResult_BlindedPathNoneZ {
11040    /**
11041     * The contents of this CResult_BlindedPathNoneZ, accessible via either
11042     * `err` or `result` depending on the state of `result_ok`.
11043     */
11044    union LDKCResult_BlindedPathNoneZPtr contents;
11045    /**
11046     * Whether this CResult_BlindedPathNoneZ represents a success state.
11047     */
11048    bool result_ok;
11049 } LDKCResult_BlindedPathNoneZ;
11050
11051 /**
11052  * The contents of CResult_BlindedPathDecodeErrorZ
11053  */
11054 typedef union LDKCResult_BlindedPathDecodeErrorZPtr {
11055    /**
11056     * A pointer to the contents in the success state.
11057     * Reading from this pointer when `result_ok` is not set is undefined.
11058     */
11059    struct LDKBlindedPath *result;
11060    /**
11061     * A pointer to the contents in the error state.
11062     * Reading from this pointer when `result_ok` is set is undefined.
11063     */
11064    struct LDKDecodeError *err;
11065 } LDKCResult_BlindedPathDecodeErrorZPtr;
11066
11067 /**
11068  * A CResult_BlindedPathDecodeErrorZ represents the result of a fallible operation,
11069  * containing a crate::lightning::blinded_path::BlindedPath on success and a crate::lightning::ln::msgs::DecodeError on failure.
11070  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11071  */
11072 typedef struct LDKCResult_BlindedPathDecodeErrorZ {
11073    /**
11074     * The contents of this CResult_BlindedPathDecodeErrorZ, accessible via either
11075     * `err` or `result` depending on the state of `result_ok`.
11076     */
11077    union LDKCResult_BlindedPathDecodeErrorZPtr contents;
11078    /**
11079     * Whether this CResult_BlindedPathDecodeErrorZ represents a success state.
11080     */
11081    bool result_ok;
11082 } LDKCResult_BlindedPathDecodeErrorZ;
11083
11084 /**
11085  * The contents of CResult_BlindedHopDecodeErrorZ
11086  */
11087 typedef union LDKCResult_BlindedHopDecodeErrorZPtr {
11088    /**
11089     * A pointer to the contents in the success state.
11090     * Reading from this pointer when `result_ok` is not set is undefined.
11091     */
11092    struct LDKBlindedHop *result;
11093    /**
11094     * A pointer to the contents in the error state.
11095     * Reading from this pointer when `result_ok` is set is undefined.
11096     */
11097    struct LDKDecodeError *err;
11098 } LDKCResult_BlindedHopDecodeErrorZPtr;
11099
11100 /**
11101  * A CResult_BlindedHopDecodeErrorZ represents the result of a fallible operation,
11102  * containing a crate::lightning::blinded_path::BlindedHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
11103  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11104  */
11105 typedef struct LDKCResult_BlindedHopDecodeErrorZ {
11106    /**
11107     * The contents of this CResult_BlindedHopDecodeErrorZ, accessible via either
11108     * `err` or `result` depending on the state of `result_ok`.
11109     */
11110    union LDKCResult_BlindedHopDecodeErrorZPtr contents;
11111    /**
11112     * Whether this CResult_BlindedHopDecodeErrorZ represents a success state.
11113     */
11114    bool result_ok;
11115 } LDKCResult_BlindedHopDecodeErrorZ;
11116
11117 /**
11118  * Sub-errors which don't have specific information in them use this type.
11119  */
11120 typedef struct LDKError {
11121    /**
11122     * Zero-Sized_types aren't consistent across Rust/C/C++, so we add some size here
11123     */
11124    uint8_t _dummy;
11125 } LDKError;
11126
11127 /**
11128  * Errors that indicate what is wrong with the invoice. They have some granularity for debug
11129  * reasons, but should generally result in an \"invalid BOLT11 invoice\" message for the user.
11130  */
11131 typedef enum LDKParseError_Tag {
11132    LDKParseError_Bech32Error,
11133    LDKParseError_ParseAmountError,
11134    LDKParseError_MalformedSignature,
11135    LDKParseError_BadPrefix,
11136    LDKParseError_UnknownCurrency,
11137    LDKParseError_UnknownSiPrefix,
11138    LDKParseError_MalformedHRP,
11139    LDKParseError_TooShortDataPart,
11140    LDKParseError_UnexpectedEndOfTaggedFields,
11141    LDKParseError_DescriptionDecodeError,
11142    LDKParseError_PaddingError,
11143    LDKParseError_IntegerOverflowError,
11144    LDKParseError_InvalidSegWitProgramLength,
11145    LDKParseError_InvalidPubKeyHashLength,
11146    LDKParseError_InvalidScriptHashLength,
11147    LDKParseError_InvalidRecoveryId,
11148    LDKParseError_InvalidSliceLength,
11149    /**
11150     * Not an error, but used internally to signal that a part of the invoice should be ignored
11151     * according to BOLT11
11152     */
11153    LDKParseError_Skip,
11154    /**
11155     * Must be last for serialization purposes
11156     */
11157    LDKParseError_Sentinel,
11158 } LDKParseError_Tag;
11159
11160 typedef struct MUST_USE_STRUCT LDKParseError {
11161    LDKParseError_Tag tag;
11162    union {
11163       struct {
11164          struct LDKBech32Error bech32_error;
11165       };
11166       struct {
11167          struct LDKError parse_amount_error;
11168       };
11169       struct {
11170          enum LDKSecp256k1Error malformed_signature;
11171       };
11172       struct {
11173          struct LDKError description_decode_error;
11174       };
11175       struct {
11176          struct LDKStr invalid_slice_length;
11177       };
11178    };
11179 } LDKParseError;
11180
11181 /**
11182  * The contents of CResult_SiPrefixParseErrorZ
11183  */
11184 typedef union LDKCResult_SiPrefixParseErrorZPtr {
11185    /**
11186     * A pointer to the contents in the success state.
11187     * Reading from this pointer when `result_ok` is not set is undefined.
11188     */
11189    enum LDKSiPrefix *result;
11190    /**
11191     * A pointer to the contents in the error state.
11192     * Reading from this pointer when `result_ok` is set is undefined.
11193     */
11194    struct LDKParseError *err;
11195 } LDKCResult_SiPrefixParseErrorZPtr;
11196
11197 /**
11198  * A CResult_SiPrefixParseErrorZ represents the result of a fallible operation,
11199  * containing a crate::lightning_invoice::SiPrefix on success and a crate::lightning_invoice::ParseError on failure.
11200  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11201  */
11202 typedef struct LDKCResult_SiPrefixParseErrorZ {
11203    /**
11204     * The contents of this CResult_SiPrefixParseErrorZ, accessible via either
11205     * `err` or `result` depending on the state of `result_ok`.
11206     */
11207    union LDKCResult_SiPrefixParseErrorZPtr contents;
11208    /**
11209     * Whether this CResult_SiPrefixParseErrorZ represents a success state.
11210     */
11211    bool result_ok;
11212 } LDKCResult_SiPrefixParseErrorZ;
11213
11214
11215
11216 /**
11217  * Represents a syntactically and semantically correct lightning BOLT11 invoice.
11218  *
11219  * There are three ways to construct an `Invoice`:
11220  *  1. using [`InvoiceBuilder`]
11221  *  2. using [`Invoice::from_signed`]
11222  *  3. using `str::parse::<Invoice>(&str)` (see [`Invoice::from_str`])
11223  *
11224  * [`Invoice::from_str`]: crate::Invoice#impl-FromStr
11225  */
11226 typedef struct MUST_USE_STRUCT LDKInvoice {
11227    /**
11228     * A pointer to the opaque Rust object.
11229     * Nearly everywhere, inner must be non-null, however in places where
11230     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11231     */
11232    LDKnativeInvoice *inner;
11233    /**
11234     * Indicates that this is the only struct which contains the same pointer.
11235     * Rust functions which take ownership of an object provided via an argument require
11236     * this to be true and invalidate the object pointed to by inner.
11237     */
11238    bool is_owned;
11239 } LDKInvoice;
11240
11241 /**
11242  * Indicates that something went wrong while parsing or validating the invoice. Parsing errors
11243  * should be mostly seen as opaque and are only there for debugging reasons. Semantic errors
11244  * like wrong signatures, missing fields etc. could mean that someone tampered with the invoice.
11245  */
11246 typedef enum LDKParseOrSemanticError_Tag {
11247    /**
11248     * The invoice couldn't be decoded
11249     */
11250    LDKParseOrSemanticError_ParseError,
11251    /**
11252     * The invoice could be decoded but violates the BOLT11 standard
11253     */
11254    LDKParseOrSemanticError_SemanticError,
11255    /**
11256     * Must be last for serialization purposes
11257     */
11258    LDKParseOrSemanticError_Sentinel,
11259 } LDKParseOrSemanticError_Tag;
11260
11261 typedef struct MUST_USE_STRUCT LDKParseOrSemanticError {
11262    LDKParseOrSemanticError_Tag tag;
11263    union {
11264       struct {
11265          struct LDKParseError parse_error;
11266       };
11267       struct {
11268          enum LDKSemanticError semantic_error;
11269       };
11270    };
11271 } LDKParseOrSemanticError;
11272
11273 /**
11274  * The contents of CResult_InvoiceParseOrSemanticErrorZ
11275  */
11276 typedef union LDKCResult_InvoiceParseOrSemanticErrorZPtr {
11277    /**
11278     * A pointer to the contents in the success state.
11279     * Reading from this pointer when `result_ok` is not set is undefined.
11280     */
11281    struct LDKInvoice *result;
11282    /**
11283     * A pointer to the contents in the error state.
11284     * Reading from this pointer when `result_ok` is set is undefined.
11285     */
11286    struct LDKParseOrSemanticError *err;
11287 } LDKCResult_InvoiceParseOrSemanticErrorZPtr;
11288
11289 /**
11290  * A CResult_InvoiceParseOrSemanticErrorZ represents the result of a fallible operation,
11291  * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::ParseOrSemanticError on failure.
11292  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11293  */
11294 typedef struct LDKCResult_InvoiceParseOrSemanticErrorZ {
11295    /**
11296     * The contents of this CResult_InvoiceParseOrSemanticErrorZ, accessible via either
11297     * `err` or `result` depending on the state of `result_ok`.
11298     */
11299    union LDKCResult_InvoiceParseOrSemanticErrorZPtr contents;
11300    /**
11301     * Whether this CResult_InvoiceParseOrSemanticErrorZ represents a success state.
11302     */
11303    bool result_ok;
11304 } LDKCResult_InvoiceParseOrSemanticErrorZ;
11305
11306
11307
11308 /**
11309  * Represents a signed [`RawInvoice`] with cached hash. The signature is not checked and may be
11310  * invalid.
11311  *
11312  * # Invariants
11313  * The hash has to be either from the deserialized invoice or from the serialized [`RawInvoice`].
11314  */
11315 typedef struct MUST_USE_STRUCT LDKSignedRawInvoice {
11316    /**
11317     * A pointer to the opaque Rust object.
11318     * Nearly everywhere, inner must be non-null, however in places where
11319     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11320     */
11321    LDKnativeSignedRawInvoice *inner;
11322    /**
11323     * Indicates that this is the only struct which contains the same pointer.
11324     * Rust functions which take ownership of an object provided via an argument require
11325     * this to be true and invalidate the object pointed to by inner.
11326     */
11327    bool is_owned;
11328 } LDKSignedRawInvoice;
11329
11330 /**
11331  * The contents of CResult_SignedRawInvoiceParseErrorZ
11332  */
11333 typedef union LDKCResult_SignedRawInvoiceParseErrorZPtr {
11334    /**
11335     * A pointer to the contents in the success state.
11336     * Reading from this pointer when `result_ok` is not set is undefined.
11337     */
11338    struct LDKSignedRawInvoice *result;
11339    /**
11340     * A pointer to the contents in the error state.
11341     * Reading from this pointer when `result_ok` is set is undefined.
11342     */
11343    struct LDKParseError *err;
11344 } LDKCResult_SignedRawInvoiceParseErrorZPtr;
11345
11346 /**
11347  * A CResult_SignedRawInvoiceParseErrorZ represents the result of a fallible operation,
11348  * containing a crate::lightning_invoice::SignedRawInvoice on success and a crate::lightning_invoice::ParseError on failure.
11349  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11350  */
11351 typedef struct LDKCResult_SignedRawInvoiceParseErrorZ {
11352    /**
11353     * The contents of this CResult_SignedRawInvoiceParseErrorZ, accessible via either
11354     * `err` or `result` depending on the state of `result_ok`.
11355     */
11356    union LDKCResult_SignedRawInvoiceParseErrorZPtr contents;
11357    /**
11358     * Whether this CResult_SignedRawInvoiceParseErrorZ represents a success state.
11359     */
11360    bool result_ok;
11361 } LDKCResult_SignedRawInvoiceParseErrorZ;
11362
11363
11364
11365 /**
11366  * Represents an syntactically correct [`Invoice`] for a payment on the lightning network,
11367  * but without the signature information.
11368  * Decoding and encoding should not lead to information loss but may lead to different hashes.
11369  *
11370  * For methods without docs see the corresponding methods in [`Invoice`].
11371  */
11372 typedef struct MUST_USE_STRUCT LDKRawInvoice {
11373    /**
11374     * A pointer to the opaque Rust object.
11375     * Nearly everywhere, inner must be non-null, however in places where
11376     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11377     */
11378    LDKnativeRawInvoice *inner;
11379    /**
11380     * Indicates that this is the only struct which contains the same pointer.
11381     * Rust functions which take ownership of an object provided via an argument require
11382     * this to be true and invalidate the object pointed to by inner.
11383     */
11384    bool is_owned;
11385 } LDKRawInvoice;
11386
11387
11388
11389 /**
11390  * Recoverable signature
11391  */
11392 typedef struct MUST_USE_STRUCT LDKInvoiceSignature {
11393    /**
11394     * A pointer to the opaque Rust object.
11395     * Nearly everywhere, inner must be non-null, however in places where
11396     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11397     */
11398    LDKnativeInvoiceSignature *inner;
11399    /**
11400     * Indicates that this is the only struct which contains the same pointer.
11401     * Rust functions which take ownership of an object provided via an argument require
11402     * this to be true and invalidate the object pointed to by inner.
11403     */
11404    bool is_owned;
11405 } LDKInvoiceSignature;
11406
11407 /**
11408  * A tuple of 3 elements. See the individual fields for the types contained.
11409  */
11410 typedef struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ {
11411    /**
11412     * The element at position 0
11413     */
11414    struct LDKRawInvoice a;
11415    /**
11416     * The element at position 1
11417     */
11418    struct LDKThirtyTwoBytes b;
11419    /**
11420     * The element at position 2
11421     */
11422    struct LDKInvoiceSignature c;
11423 } LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ;
11424
11425
11426
11427 /**
11428  * Payee public key
11429  */
11430 typedef struct MUST_USE_STRUCT LDKPayeePubKey {
11431    /**
11432     * A pointer to the opaque Rust object.
11433     * Nearly everywhere, inner must be non-null, however in places where
11434     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11435     */
11436    LDKnativePayeePubKey *inner;
11437    /**
11438     * Indicates that this is the only struct which contains the same pointer.
11439     * Rust functions which take ownership of an object provided via an argument require
11440     * this to be true and invalidate the object pointed to by inner.
11441     */
11442    bool is_owned;
11443 } LDKPayeePubKey;
11444
11445 /**
11446  * The contents of CResult_PayeePubKeyErrorZ
11447  */
11448 typedef union LDKCResult_PayeePubKeyErrorZPtr {
11449    /**
11450     * A pointer to the contents in the success state.
11451     * Reading from this pointer when `result_ok` is not set is undefined.
11452     */
11453    struct LDKPayeePubKey *result;
11454    /**
11455     * A pointer to the contents in the error state.
11456     * Reading from this pointer when `result_ok` is set is undefined.
11457     */
11458    enum LDKSecp256k1Error *err;
11459 } LDKCResult_PayeePubKeyErrorZPtr;
11460
11461 /**
11462  * A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
11463  * containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
11464  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11465  */
11466 typedef struct LDKCResult_PayeePubKeyErrorZ {
11467    /**
11468     * The contents of this CResult_PayeePubKeyErrorZ, accessible via either
11469     * `err` or `result` depending on the state of `result_ok`.
11470     */
11471    union LDKCResult_PayeePubKeyErrorZPtr contents;
11472    /**
11473     * Whether this CResult_PayeePubKeyErrorZ represents a success state.
11474     */
11475    bool result_ok;
11476 } LDKCResult_PayeePubKeyErrorZ;
11477
11478
11479
11480 /**
11481  * Private routing information
11482  *
11483  * # Invariants
11484  * The encoded route has to be <1024 5bit characters long (<=639 bytes or <=12 hops)
11485  *
11486  */
11487 typedef struct MUST_USE_STRUCT LDKPrivateRoute {
11488    /**
11489     * A pointer to the opaque Rust object.
11490     * Nearly everywhere, inner must be non-null, however in places where
11491     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11492     */
11493    LDKnativePrivateRoute *inner;
11494    /**
11495     * Indicates that this is the only struct which contains the same pointer.
11496     * Rust functions which take ownership of an object provided via an argument require
11497     * this to be true and invalidate the object pointed to by inner.
11498     */
11499    bool is_owned;
11500 } LDKPrivateRoute;
11501
11502 /**
11503  * A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
11504  * This corresponds to std::vector in C++
11505  */
11506 typedef struct LDKCVec_PrivateRouteZ {
11507    /**
11508     * The elements in the array.
11509     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11510     */
11511    struct LDKPrivateRoute *data;
11512    /**
11513     * The number of elements pointed to by `data`.
11514     */
11515    uintptr_t datalen;
11516 } LDKCVec_PrivateRouteZ;
11517
11518
11519
11520 /**
11521  * A timestamp that refers to a date after 1 January 1970.
11522  *
11523  * # Invariants
11524  *
11525  * The Unix timestamp representing the stored time has to be positive and no greater than
11526  * [`MAX_TIMESTAMP`].
11527  */
11528 typedef struct MUST_USE_STRUCT LDKPositiveTimestamp {
11529    /**
11530     * A pointer to the opaque Rust object.
11531     * Nearly everywhere, inner must be non-null, however in places where
11532     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11533     */
11534    LDKnativePositiveTimestamp *inner;
11535    /**
11536     * Indicates that this is the only struct which contains the same pointer.
11537     * Rust functions which take ownership of an object provided via an argument require
11538     * this to be true and invalidate the object pointed to by inner.
11539     */
11540    bool is_owned;
11541 } LDKPositiveTimestamp;
11542
11543 /**
11544  * The contents of CResult_PositiveTimestampCreationErrorZ
11545  */
11546 typedef union LDKCResult_PositiveTimestampCreationErrorZPtr {
11547    /**
11548     * A pointer to the contents in the success state.
11549     * Reading from this pointer when `result_ok` is not set is undefined.
11550     */
11551    struct LDKPositiveTimestamp *result;
11552    /**
11553     * A pointer to the contents in the error state.
11554     * Reading from this pointer when `result_ok` is set is undefined.
11555     */
11556    enum LDKCreationError *err;
11557 } LDKCResult_PositiveTimestampCreationErrorZPtr;
11558
11559 /**
11560  * A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
11561  * containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
11562  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11563  */
11564 typedef struct LDKCResult_PositiveTimestampCreationErrorZ {
11565    /**
11566     * The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
11567     * `err` or `result` depending on the state of `result_ok`.
11568     */
11569    union LDKCResult_PositiveTimestampCreationErrorZPtr contents;
11570    /**
11571     * Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
11572     */
11573    bool result_ok;
11574 } LDKCResult_PositiveTimestampCreationErrorZ;
11575
11576 /**
11577  * The contents of CResult_NoneSemanticErrorZ
11578  */
11579 typedef union LDKCResult_NoneSemanticErrorZPtr {
11580    /**
11581     * Note that this value is always NULL, as there are no contents in the OK variant
11582     */
11583    void *result;
11584    /**
11585     * A pointer to the contents in the error state.
11586     * Reading from this pointer when `result_ok` is set is undefined.
11587     */
11588    enum LDKSemanticError *err;
11589 } LDKCResult_NoneSemanticErrorZPtr;
11590
11591 /**
11592  * A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
11593  * containing a () on success and a crate::lightning_invoice::SemanticError on failure.
11594  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11595  */
11596 typedef struct LDKCResult_NoneSemanticErrorZ {
11597    /**
11598     * The contents of this CResult_NoneSemanticErrorZ, accessible via either
11599     * `err` or `result` depending on the state of `result_ok`.
11600     */
11601    union LDKCResult_NoneSemanticErrorZPtr contents;
11602    /**
11603     * Whether this CResult_NoneSemanticErrorZ represents a success state.
11604     */
11605    bool result_ok;
11606 } LDKCResult_NoneSemanticErrorZ;
11607
11608 /**
11609  * The contents of CResult_InvoiceSemanticErrorZ
11610  */
11611 typedef union LDKCResult_InvoiceSemanticErrorZPtr {
11612    /**
11613     * A pointer to the contents in the success state.
11614     * Reading from this pointer when `result_ok` is not set is undefined.
11615     */
11616    struct LDKInvoice *result;
11617    /**
11618     * A pointer to the contents in the error state.
11619     * Reading from this pointer when `result_ok` is set is undefined.
11620     */
11621    enum LDKSemanticError *err;
11622 } LDKCResult_InvoiceSemanticErrorZPtr;
11623
11624 /**
11625  * A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
11626  * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
11627  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11628  */
11629 typedef struct LDKCResult_InvoiceSemanticErrorZ {
11630    /**
11631     * The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
11632     * `err` or `result` depending on the state of `result_ok`.
11633     */
11634    union LDKCResult_InvoiceSemanticErrorZPtr contents;
11635    /**
11636     * Whether this CResult_InvoiceSemanticErrorZ represents a success state.
11637     */
11638    bool result_ok;
11639 } LDKCResult_InvoiceSemanticErrorZ;
11640
11641 /**
11642  * A dynamically-allocated array of crate::c_types::Strs of arbitrary size.
11643  * This corresponds to std::vector in C++
11644  */
11645 typedef struct LDKCVec_AddressZ {
11646    /**
11647     * The elements in the array.
11648     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11649     */
11650    struct LDKStr *data;
11651    /**
11652     * The number of elements pointed to by `data`.
11653     */
11654    uintptr_t datalen;
11655 } LDKCVec_AddressZ;
11656
11657
11658
11659 /**
11660  * Description string
11661  *
11662  * # Invariants
11663  * The description can be at most 639 __bytes__ long
11664  */
11665 typedef struct MUST_USE_STRUCT LDKDescription {
11666    /**
11667     * A pointer to the opaque Rust object.
11668     * Nearly everywhere, inner must be non-null, however in places where
11669     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11670     */
11671    LDKnativeDescription *inner;
11672    /**
11673     * Indicates that this is the only struct which contains the same pointer.
11674     * Rust functions which take ownership of an object provided via an argument require
11675     * this to be true and invalidate the object pointed to by inner.
11676     */
11677    bool is_owned;
11678 } LDKDescription;
11679
11680 /**
11681  * The contents of CResult_DescriptionCreationErrorZ
11682  */
11683 typedef union LDKCResult_DescriptionCreationErrorZPtr {
11684    /**
11685     * A pointer to the contents in the success state.
11686     * Reading from this pointer when `result_ok` is not set is undefined.
11687     */
11688    struct LDKDescription *result;
11689    /**
11690     * A pointer to the contents in the error state.
11691     * Reading from this pointer when `result_ok` is set is undefined.
11692     */
11693    enum LDKCreationError *err;
11694 } LDKCResult_DescriptionCreationErrorZPtr;
11695
11696 /**
11697  * A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
11698  * containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
11699  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11700  */
11701 typedef struct LDKCResult_DescriptionCreationErrorZ {
11702    /**
11703     * The contents of this CResult_DescriptionCreationErrorZ, accessible via either
11704     * `err` or `result` depending on the state of `result_ok`.
11705     */
11706    union LDKCResult_DescriptionCreationErrorZPtr contents;
11707    /**
11708     * Whether this CResult_DescriptionCreationErrorZ represents a success state.
11709     */
11710    bool result_ok;
11711 } LDKCResult_DescriptionCreationErrorZ;
11712
11713 /**
11714  * The contents of CResult_PrivateRouteCreationErrorZ
11715  */
11716 typedef union LDKCResult_PrivateRouteCreationErrorZPtr {
11717    /**
11718     * A pointer to the contents in the success state.
11719     * Reading from this pointer when `result_ok` is not set is undefined.
11720     */
11721    struct LDKPrivateRoute *result;
11722    /**
11723     * A pointer to the contents in the error state.
11724     * Reading from this pointer when `result_ok` is set is undefined.
11725     */
11726    enum LDKCreationError *err;
11727 } LDKCResult_PrivateRouteCreationErrorZPtr;
11728
11729 /**
11730  * A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
11731  * containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
11732  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11733  */
11734 typedef struct LDKCResult_PrivateRouteCreationErrorZ {
11735    /**
11736     * The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
11737     * `err` or `result` depending on the state of `result_ok`.
11738     */
11739    union LDKCResult_PrivateRouteCreationErrorZPtr contents;
11740    /**
11741     * Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
11742     */
11743    bool result_ok;
11744 } LDKCResult_PrivateRouteCreationErrorZ;
11745
11746 /**
11747  * The contents of CResult_NetAddressDecodeErrorZ
11748  */
11749 typedef union LDKCResult_NetAddressDecodeErrorZPtr {
11750    /**
11751     * A pointer to the contents in the success state.
11752     * Reading from this pointer when `result_ok` is not set is undefined.
11753     */
11754    struct LDKNetAddress *result;
11755    /**
11756     * A pointer to the contents in the error state.
11757     * Reading from this pointer when `result_ok` is set is undefined.
11758     */
11759    struct LDKDecodeError *err;
11760 } LDKCResult_NetAddressDecodeErrorZPtr;
11761
11762 /**
11763  * A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation,
11764  * containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
11765  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11766  */
11767 typedef struct LDKCResult_NetAddressDecodeErrorZ {
11768    /**
11769     * The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
11770     * `err` or `result` depending on the state of `result_ok`.
11771     */
11772    union LDKCResult_NetAddressDecodeErrorZPtr contents;
11773    /**
11774     * Whether this CResult_NetAddressDecodeErrorZ represents a success state.
11775     */
11776    bool result_ok;
11777 } LDKCResult_NetAddressDecodeErrorZ;
11778
11779
11780
11781 /**
11782  * An [`update_add_htlc`] message to be sent to or received from a peer.
11783  *
11784  * [`update_add_htlc`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#adding-an-htlc-update_add_htlc
11785  */
11786 typedef struct MUST_USE_STRUCT LDKUpdateAddHTLC {
11787    /**
11788     * A pointer to the opaque Rust object.
11789     * Nearly everywhere, inner must be non-null, however in places where
11790     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11791     */
11792    LDKnativeUpdateAddHTLC *inner;
11793    /**
11794     * Indicates that this is the only struct which contains the same pointer.
11795     * Rust functions which take ownership of an object provided via an argument require
11796     * this to be true and invalidate the object pointed to by inner.
11797     */
11798    bool is_owned;
11799 } LDKUpdateAddHTLC;
11800
11801 /**
11802  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
11803  * This corresponds to std::vector in C++
11804  */
11805 typedef struct LDKCVec_UpdateAddHTLCZ {
11806    /**
11807     * The elements in the array.
11808     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11809     */
11810    struct LDKUpdateAddHTLC *data;
11811    /**
11812     * The number of elements pointed to by `data`.
11813     */
11814    uintptr_t datalen;
11815 } LDKCVec_UpdateAddHTLCZ;
11816
11817
11818
11819 /**
11820  * An [`update_fulfill_htlc`] message to be sent to or received from a peer.
11821  *
11822  * [`update_fulfill_htlc`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#removing-an-htlc-update_fulfill_htlc-update_fail_htlc-and-update_fail_malformed_htlc
11823  */
11824 typedef struct MUST_USE_STRUCT LDKUpdateFulfillHTLC {
11825    /**
11826     * A pointer to the opaque Rust object.
11827     * Nearly everywhere, inner must be non-null, however in places where
11828     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11829     */
11830    LDKnativeUpdateFulfillHTLC *inner;
11831    /**
11832     * Indicates that this is the only struct which contains the same pointer.
11833     * Rust functions which take ownership of an object provided via an argument require
11834     * this to be true and invalidate the object pointed to by inner.
11835     */
11836    bool is_owned;
11837 } LDKUpdateFulfillHTLC;
11838
11839 /**
11840  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
11841  * This corresponds to std::vector in C++
11842  */
11843 typedef struct LDKCVec_UpdateFulfillHTLCZ {
11844    /**
11845     * The elements in the array.
11846     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11847     */
11848    struct LDKUpdateFulfillHTLC *data;
11849    /**
11850     * The number of elements pointed to by `data`.
11851     */
11852    uintptr_t datalen;
11853 } LDKCVec_UpdateFulfillHTLCZ;
11854
11855
11856
11857 /**
11858  * An [`update_fail_htlc`] message to be sent to or received from a peer.
11859  *
11860  * [`update_fail_htlc`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#removing-an-htlc-update_fulfill_htlc-update_fail_htlc-and-update_fail_malformed_htlc
11861  */
11862 typedef struct MUST_USE_STRUCT LDKUpdateFailHTLC {
11863    /**
11864     * A pointer to the opaque Rust object.
11865     * Nearly everywhere, inner must be non-null, however in places where
11866     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11867     */
11868    LDKnativeUpdateFailHTLC *inner;
11869    /**
11870     * Indicates that this is the only struct which contains the same pointer.
11871     * Rust functions which take ownership of an object provided via an argument require
11872     * this to be true and invalidate the object pointed to by inner.
11873     */
11874    bool is_owned;
11875 } LDKUpdateFailHTLC;
11876
11877 /**
11878  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
11879  * This corresponds to std::vector in C++
11880  */
11881 typedef struct LDKCVec_UpdateFailHTLCZ {
11882    /**
11883     * The elements in the array.
11884     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11885     */
11886    struct LDKUpdateFailHTLC *data;
11887    /**
11888     * The number of elements pointed to by `data`.
11889     */
11890    uintptr_t datalen;
11891 } LDKCVec_UpdateFailHTLCZ;
11892
11893
11894
11895 /**
11896  * An [`update_fail_malformed_htlc`] message to be sent to or received from a peer.
11897  *
11898  * [`update_fail_malformed_htlc`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#removing-an-htlc-update_fulfill_htlc-update_fail_htlc-and-update_fail_malformed_htlc
11899  */
11900 typedef struct MUST_USE_STRUCT LDKUpdateFailMalformedHTLC {
11901    /**
11902     * A pointer to the opaque Rust object.
11903     * Nearly everywhere, inner must be non-null, however in places where
11904     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11905     */
11906    LDKnativeUpdateFailMalformedHTLC *inner;
11907    /**
11908     * Indicates that this is the only struct which contains the same pointer.
11909     * Rust functions which take ownership of an object provided via an argument require
11910     * this to be true and invalidate the object pointed to by inner.
11911     */
11912    bool is_owned;
11913 } LDKUpdateFailMalformedHTLC;
11914
11915 /**
11916  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
11917  * This corresponds to std::vector in C++
11918  */
11919 typedef struct LDKCVec_UpdateFailMalformedHTLCZ {
11920    /**
11921     * The elements in the array.
11922     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11923     */
11924    struct LDKUpdateFailMalformedHTLC *data;
11925    /**
11926     * The number of elements pointed to by `data`.
11927     */
11928    uintptr_t datalen;
11929 } LDKCVec_UpdateFailMalformedHTLCZ;
11930
11931 /**
11932  * The contents of CResult_AcceptChannelDecodeErrorZ
11933  */
11934 typedef union LDKCResult_AcceptChannelDecodeErrorZPtr {
11935    /**
11936     * A pointer to the contents in the success state.
11937     * Reading from this pointer when `result_ok` is not set is undefined.
11938     */
11939    struct LDKAcceptChannel *result;
11940    /**
11941     * A pointer to the contents in the error state.
11942     * Reading from this pointer when `result_ok` is set is undefined.
11943     */
11944    struct LDKDecodeError *err;
11945 } LDKCResult_AcceptChannelDecodeErrorZPtr;
11946
11947 /**
11948  * A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
11949  * containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
11950  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11951  */
11952 typedef struct LDKCResult_AcceptChannelDecodeErrorZ {
11953    /**
11954     * The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
11955     * `err` or `result` depending on the state of `result_ok`.
11956     */
11957    union LDKCResult_AcceptChannelDecodeErrorZPtr contents;
11958    /**
11959     * Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
11960     */
11961    bool result_ok;
11962 } LDKCResult_AcceptChannelDecodeErrorZ;
11963
11964 /**
11965  * The contents of CResult_AnnouncementSignaturesDecodeErrorZ
11966  */
11967 typedef union LDKCResult_AnnouncementSignaturesDecodeErrorZPtr {
11968    /**
11969     * A pointer to the contents in the success state.
11970     * Reading from this pointer when `result_ok` is not set is undefined.
11971     */
11972    struct LDKAnnouncementSignatures *result;
11973    /**
11974     * A pointer to the contents in the error state.
11975     * Reading from this pointer when `result_ok` is set is undefined.
11976     */
11977    struct LDKDecodeError *err;
11978 } LDKCResult_AnnouncementSignaturesDecodeErrorZPtr;
11979
11980 /**
11981  * A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
11982  * containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
11983  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11984  */
11985 typedef struct LDKCResult_AnnouncementSignaturesDecodeErrorZ {
11986    /**
11987     * The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
11988     * `err` or `result` depending on the state of `result_ok`.
11989     */
11990    union LDKCResult_AnnouncementSignaturesDecodeErrorZPtr contents;
11991    /**
11992     * Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
11993     */
11994    bool result_ok;
11995 } LDKCResult_AnnouncementSignaturesDecodeErrorZ;
11996
11997 /**
11998  * The contents of CResult_ChannelReestablishDecodeErrorZ
11999  */
12000 typedef union LDKCResult_ChannelReestablishDecodeErrorZPtr {
12001    /**
12002     * A pointer to the contents in the success state.
12003     * Reading from this pointer when `result_ok` is not set is undefined.
12004     */
12005    struct LDKChannelReestablish *result;
12006    /**
12007     * A pointer to the contents in the error state.
12008     * Reading from this pointer when `result_ok` is set is undefined.
12009     */
12010    struct LDKDecodeError *err;
12011 } LDKCResult_ChannelReestablishDecodeErrorZPtr;
12012
12013 /**
12014  * A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
12015  * containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
12016  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
12017  */
12018 typedef struct LDKCResult_ChannelReestablishDecodeErrorZ {
12019    /**
12020     * The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
12021     * `err` or `result` depending on the state of `result_ok`.
12022     */
12023    union LDKCResult_ChannelReestablishDecodeErrorZPtr contents;
12024    /**
12025     * Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
12026     */
12027    bool result_ok;
12028 } LDKCResult_ChannelReestablishDecodeErrorZ;
12029
12030 /**
12031  * The contents of CResult_ClosingSignedDecodeErrorZ
12032  */
12033 typedef union LDKCResult_ClosingSignedDecodeErrorZPtr {
12034    /**
12035     * A pointer to the contents in the success state.
12036     * Reading from this pointer when `result_ok` is not set is undefined.
12037     */
12038    struct LDKClosingSigned *result;
12039    /**
12040     * A pointer to the contents in the error state.
12041     * Reading from this pointer when `result_ok` is set is undefined.
12042     */
12043    struct LDKDecodeError *err;
12044 } LDKCResult_ClosingSignedDecodeErrorZPtr;
12045
12046 /**
12047  * A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
12048  * containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
12049  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
12050  */
12051 typedef struct LDKCResult_ClosingSignedDecodeErrorZ {
12052    /**
12053     * The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
12054     * `err` or `result` depending on the state of `result_ok`.
12055     */
12056    union LDKCResult_ClosingSignedDecodeErrorZPtr contents;
12057    /**
12058     * Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
12059     */
12060    bool result_ok;
12061 } LDKCResult_ClosingSignedDecodeErrorZ;
12062
12063
12064
12065 /**
12066  * The minimum and maximum fees which the sender is willing to place on the closing transaction.
12067  *
12068  * This is provided in [`ClosingSigned`] by both sides to indicate the fee range they are willing
12069  * to use.
12070  */
12071 typedef struct MUST_USE_STRUCT LDKClosingSignedFeeRange {
12072    /**
12073     * A pointer to the opaque Rust object.
12074     * Nearly everywhere, inner must be non-null, however in places where
12075     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12076     */
12077    LDKnativeClosingSignedFeeRange *inner;
12078    /**
12079     * Indicates that this is the only struct which contains the same pointer.
12080     * Rust functions which take ownership of an object provided via an argument require
12081     * this to be true and invalidate the object pointed to by inner.
12082     */
12083    bool is_owned;
12084 } LDKClosingSignedFeeRange;
12085
12086 /**
12087  * The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ
12088  */
12089 typedef union LDKCResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12090    /**
12091     * A pointer to the contents in the success state.
12092     * Reading from this pointer when `result_ok` is not set is undefined.
12093     */
12094    struct LDKClosingSignedFeeRange *result;
12095    /**
12096     * A pointer to the contents in the error state.
12097     * Reading from this pointer when `result_ok` is set is undefined.
12098     */
12099    struct LDKDecodeError *err;
12100 } LDKCResult_ClosingSignedFeeRangeDecodeErrorZPtr;
12101
12102 /**
12103  * A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation,
12104  * containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
12105  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
12106  */
12107 typedef struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ {
12108    /**
12109     * The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either
12110     * `err` or `result` depending on the state of `result_ok`.
12111     */
12112    union LDKCResult_ClosingSignedFeeRangeDecodeErrorZPtr contents;
12113    /**
12114     * Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state.
12115     */
12116    bool result_ok;
12117 } LDKCResult_ClosingSignedFeeRangeDecodeErrorZ;
12118
12119
12120
12121 /**
12122  * A [`commitment_signed`] message to be sent to or received from a peer.
12123  *
12124  * [`commitment_signed`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#committing-updates-so-far-commitment_signed
12125  */
12126 typedef struct MUST_USE_STRUCT LDKCommitmentSigned {
12127    /**
12128     * A pointer to the opaque Rust object.
12129     * Nearly everywhere, inner must be non-null, however in places where
12130     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12131     */
12132    LDKnativeCommitmentSigned *inner;
12133    /**
12134     * Indicates that this is the only struct which contains the same pointer.
12135     * Rust functions which take ownership of an object provided via an argument require
12136     * this to be true and invalidate the object pointed to by inner.
12137     */
12138    bool is_owned;
12139 } LDKCommitmentSigned;
12140
12141 /**
12142  * The contents of CResult_CommitmentSignedDecodeErrorZ
12143  */
12144 typedef union LDKCResult_CommitmentSignedDecodeErrorZPtr {
12145    /**
12146     * A pointer to the contents in the success state.
12147     * Reading from this pointer when `result_ok` is not set is undefined.
12148     */
12149    struct LDKCommitmentSigned *result;
12150    /**
12151     * A pointer to the contents in the error state.
12152     * Reading from this pointer when `result_ok` is set is undefined.
12153     */
12154    struct LDKDecodeError *err;
12155 } LDKCResult_CommitmentSignedDecodeErrorZPtr;
12156
12157 /**
12158  * A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
12159  * containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
12160  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
12161  */
12162 typedef struct LDKCResult_CommitmentSignedDecodeErrorZ {
12163    /**
12164     * The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
12165     * `err` or `result` depending on the state of `result_ok`.
12166     */
12167    union LDKCResult_CommitmentSignedDecodeErrorZPtr contents;
12168    /**
12169     * Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
12170     */
12171    bool result_ok;
12172 } LDKCResult_CommitmentSignedDecodeErrorZ;
12173
12174 /**
12175  * The contents of CResult_FundingCreatedDecodeErrorZ
12176  */
12177 typedef union LDKCResult_FundingCreatedDecodeErrorZPtr {
12178    /**
12179     * A pointer to the contents in the success state.
12180     * Reading from this pointer when `result_ok` is not set is undefined.
12181     */
12182    struct LDKFundingCreated *result;
12183    /**
12184     * A pointer to the contents in the error state.
12185     * Reading from this pointer when `result_ok` is set is undefined.
12186     */
12187    struct LDKDecodeError *err;
12188 } LDKCResult_FundingCreatedDecodeErrorZPtr;
12189
12190 /**
12191  * A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
12192  * containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
12193  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
12194  */
12195 typedef struct LDKCResult_FundingCreatedDecodeErrorZ {
12196    /**
12197     * The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
12198     * `err` or `result` depending on the state of `result_ok`.
12199     */
12200    union LDKCResult_FundingCreatedDecodeErrorZPtr contents;
12201    /**
12202     * Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
12203     */
12204    bool result_ok;
12205 } LDKCResult_FundingCreatedDecodeErrorZ;
12206
12207 /**
12208  * The contents of CResult_FundingSignedDecodeErrorZ
12209  */
12210 typedef union LDKCResult_FundingSignedDecodeErrorZPtr {
12211    /**
12212     * A pointer to the contents in the success state.
12213     * Reading from this pointer when `result_ok` is not set is undefined.
12214     */
12215    struct LDKFundingSigned *result;
12216    /**
12217     * A pointer to the contents in the error state.
12218     * Reading from this pointer when `result_ok` is set is undefined.
12219     */
12220    struct LDKDecodeError *err;
12221 } LDKCResult_FundingSignedDecodeErrorZPtr;
12222
12223 /**
12224  * A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
12225  * containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
12226  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
12227  */
12228 typedef struct LDKCResult_FundingSignedDecodeErrorZ {
12229    /**
12230     * The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
12231     * `err` or `result` depending on the state of `result_ok`.
12232     */
12233    union LDKCResult_FundingSignedDecodeErrorZPtr contents;
12234    /**
12235     * Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
12236     */
12237    bool result_ok;
12238 } LDKCResult_FundingSignedDecodeErrorZ;
12239
12240 /**
12241  * The contents of CResult_ChannelReadyDecodeErrorZ
12242  */
12243 typedef union LDKCResult_ChannelReadyDecodeErrorZPtr {
12244    /**
12245     * A pointer to the contents in the success state.
12246     * Reading from this pointer when `result_ok` is not set is undefined.
12247     */
12248    struct LDKChannelReady *result;
12249    /**
12250     * A pointer to the contents in the error state.
12251     * Reading from this pointer when `result_ok` is set is undefined.
12252     */
12253    struct LDKDecodeError *err;
12254 } LDKCResult_ChannelReadyDecodeErrorZPtr;
12255
12256 /**
12257  * A CResult_ChannelReadyDecodeErrorZ represents the result of a fallible operation,
12258  * containing a crate::lightning::ln::msgs::ChannelReady on success and a crate::lightning::ln::msgs::DecodeError on failure.
12259  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
12260  */
12261 typedef struct LDKCResult_ChannelReadyDecodeErrorZ {
12262    /**
12263     * The contents of this CResult_ChannelReadyDecodeErrorZ, accessible via either
12264     * `err` or `result` depending on the state of `result_ok`.
12265     */
12266    union LDKCResult_ChannelReadyDecodeErrorZPtr contents;
12267    /**
12268     * Whether this CResult_ChannelReadyDecodeErrorZ represents a success state.
12269     */
12270    bool result_ok;
12271 } LDKCResult_ChannelReadyDecodeErrorZ;
12272
12273
12274
12275 /**
12276  * An [`init`] message to be sent to or received from a peer.
12277  *
12278  * [`init`]: https://github.com/lightning/bolts/blob/master/01-messaging.md#the-init-message
12279  */
12280 typedef struct MUST_USE_STRUCT LDKInit {
12281    /**
12282     * A pointer to the opaque Rust object.
12283     * Nearly everywhere, inner must be non-null, however in places where
12284     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12285     */
12286    LDKnativeInit *inner;
12287    /**
12288     * Indicates that this is the only struct which contains the same pointer.
12289     * Rust functions which take ownership of an object provided via an argument require
12290     * this to be true and invalidate the object pointed to by inner.
12291     */
12292    bool is_owned;
12293 } LDKInit;
12294
12295 /**
12296  * The contents of CResult_InitDecodeErrorZ
12297  */
12298 typedef union LDKCResult_InitDecodeErrorZPtr {
12299    /**
12300     * A pointer to the contents in the success state.
12301     * Reading from this pointer when `result_ok` is not set is undefined.
12302     */
12303    struct LDKInit *result;
12304    /**
12305     * A pointer to the contents in the error state.
12306     * Reading from this pointer when `result_ok` is set is undefined.
12307     */
12308    struct LDKDecodeError *err;
12309 } LDKCResult_InitDecodeErrorZPtr;
12310
12311 /**
12312  * A CResult_InitDecodeErrorZ represents the result of a fallible operation,
12313  * containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
12314  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
12315  */
12316 typedef struct LDKCResult_InitDecodeErrorZ {
12317    /**
12318     * The contents of this CResult_InitDecodeErrorZ, accessible via either
12319     * `err` or `result` depending on the state of `result_ok`.
12320     */
12321    union LDKCResult_InitDecodeErrorZPtr contents;
12322    /**
12323     * Whether this CResult_InitDecodeErrorZ represents a success state.
12324     */
12325    bool result_ok;
12326 } LDKCResult_InitDecodeErrorZ;
12327
12328 /**
12329  * The contents of CResult_OpenChannelDecodeErrorZ
12330  */
12331 typedef union LDKCResult_OpenChannelDecodeErrorZPtr {
12332    /**
12333     * A pointer to the contents in the success state.
12334     * Reading from this pointer when `result_ok` is not set is undefined.
12335     */
12336    struct LDKOpenChannel *result;
12337    /**
12338     * A pointer to the contents in the error state.
12339     * Reading from this pointer when `result_ok` is set is undefined.
12340     */
12341    struct LDKDecodeError *err;
12342 } LDKCResult_OpenChannelDecodeErrorZPtr;
12343
12344 /**
12345  * A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
12346  * containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
12347  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
12348  */
12349 typedef struct LDKCResult_OpenChannelDecodeErrorZ {
12350    /**
12351     * The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
12352     * `err` or `result` depending on the state of `result_ok`.
12353     */
12354    union LDKCResult_OpenChannelDecodeErrorZPtr contents;
12355    /**
12356     * Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
12357     */
12358    bool result_ok;
12359 } LDKCResult_OpenChannelDecodeErrorZ;
12360
12361 /**
12362  * The contents of CResult_RevokeAndACKDecodeErrorZ
12363  */
12364 typedef union LDKCResult_RevokeAndACKDecodeErrorZPtr {
12365    /**
12366     * A pointer to the contents in the success state.
12367     * Reading from this pointer when `result_ok` is not set is undefined.
12368     */
12369    struct LDKRevokeAndACK *result;
12370    /**
12371     * A pointer to the contents in the error state.
12372     * Reading from this pointer when `result_ok` is set is undefined.
12373     */
12374    struct LDKDecodeError *err;
12375 } LDKCResult_RevokeAndACKDecodeErrorZPtr;
12376
12377 /**
12378  * A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
12379  * containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
12380  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
12381  */
12382 typedef struct LDKCResult_RevokeAndACKDecodeErrorZ {
12383    /**
12384     * The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
12385     * `err` or `result` depending on the state of `result_ok`.
12386     */
12387    union LDKCResult_RevokeAndACKDecodeErrorZPtr contents;
12388    /**
12389     * Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
12390     */
12391    bool result_ok;
12392 } LDKCResult_RevokeAndACKDecodeErrorZ;
12393
12394 /**
12395  * The contents of CResult_ShutdownDecodeErrorZ
12396  */
12397 typedef union LDKCResult_ShutdownDecodeErrorZPtr {
12398    /**
12399     * A pointer to the contents in the success state.
12400     * Reading from this pointer when `result_ok` is not set is undefined.
12401     */
12402    struct LDKShutdown *result;
12403    /**
12404     * A pointer to the contents in the error state.
12405     * Reading from this pointer when `result_ok` is set is undefined.
12406     */
12407    struct LDKDecodeError *err;
12408 } LDKCResult_ShutdownDecodeErrorZPtr;
12409
12410 /**
12411  * A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
12412  * containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
12413  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
12414  */
12415 typedef struct LDKCResult_ShutdownDecodeErrorZ {
12416    /**
12417     * The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
12418     * `err` or `result` depending on the state of `result_ok`.
12419     */
12420    union LDKCResult_ShutdownDecodeErrorZPtr contents;
12421    /**
12422     * Whether this CResult_ShutdownDecodeErrorZ represents a success state.
12423     */
12424    bool result_ok;
12425 } LDKCResult_ShutdownDecodeErrorZ;
12426
12427 /**
12428  * The contents of CResult_UpdateFailHTLCDecodeErrorZ
12429  */
12430 typedef union LDKCResult_UpdateFailHTLCDecodeErrorZPtr {
12431    /**
12432     * A pointer to the contents in the success state.
12433     * Reading from this pointer when `result_ok` is not set is undefined.
12434     */
12435    struct LDKUpdateFailHTLC *result;
12436    /**
12437     * A pointer to the contents in the error state.
12438     * Reading from this pointer when `result_ok` is set is undefined.
12439     */
12440    struct LDKDecodeError *err;
12441 } LDKCResult_UpdateFailHTLCDecodeErrorZPtr;
12442
12443 /**
12444  * A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
12445  * containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
12446  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
12447  */
12448 typedef struct LDKCResult_UpdateFailHTLCDecodeErrorZ {
12449    /**
12450     * The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
12451     * `err` or `result` depending on the state of `result_ok`.
12452     */
12453    union LDKCResult_UpdateFailHTLCDecodeErrorZPtr contents;
12454    /**
12455     * Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
12456     */
12457    bool result_ok;
12458 } LDKCResult_UpdateFailHTLCDecodeErrorZ;
12459
12460 /**
12461  * The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
12462  */
12463 typedef union LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
12464    /**
12465     * A pointer to the contents in the success state.
12466     * Reading from this pointer when `result_ok` is not set is undefined.
12467     */
12468    struct LDKUpdateFailMalformedHTLC *result;
12469    /**
12470     * A pointer to the contents in the error state.
12471     * Reading from this pointer when `result_ok` is set is undefined.
12472     */
12473    struct LDKDecodeError *err;
12474 } LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr;
12475
12476 /**
12477  * A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
12478  * containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
12479  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
12480  */
12481 typedef struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ {
12482    /**
12483     * The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
12484     * `err` or `result` depending on the state of `result_ok`.
12485     */
12486    union LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr contents;
12487    /**
12488     * Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
12489     */
12490    bool result_ok;
12491 } LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ;
12492
12493
12494
12495 /**
12496  * An [`update_fee`] message to be sent to or received from a peer
12497  *
12498  * [`update_fee`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#updating-fees-update_fee
12499  */
12500 typedef struct MUST_USE_STRUCT LDKUpdateFee {
12501    /**
12502     * A pointer to the opaque Rust object.
12503     * Nearly everywhere, inner must be non-null, however in places where
12504     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12505     */
12506    LDKnativeUpdateFee *inner;
12507    /**
12508     * Indicates that this is the only struct which contains the same pointer.
12509     * Rust functions which take ownership of an object provided via an argument require
12510     * this to be true and invalidate the object pointed to by inner.
12511     */
12512    bool is_owned;
12513 } LDKUpdateFee;
12514
12515 /**
12516  * The contents of CResult_UpdateFeeDecodeErrorZ
12517  */
12518 typedef union LDKCResult_UpdateFeeDecodeErrorZPtr {
12519    /**
12520     * A pointer to the contents in the success state.
12521     * Reading from this pointer when `result_ok` is not set is undefined.
12522     */
12523    struct LDKUpdateFee *result;
12524    /**
12525     * A pointer to the contents in the error state.
12526     * Reading from this pointer when `result_ok` is set is undefined.
12527     */
12528    struct LDKDecodeError *err;
12529 } LDKCResult_UpdateFeeDecodeErrorZPtr;
12530
12531 /**
12532  * A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
12533  * containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
12534  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
12535  */
12536 typedef struct LDKCResult_UpdateFeeDecodeErrorZ {
12537    /**
12538     * The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
12539     * `err` or `result` depending on the state of `result_ok`.
12540     */
12541    union LDKCResult_UpdateFeeDecodeErrorZPtr contents;
12542    /**
12543     * Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
12544     */
12545    bool result_ok;
12546 } LDKCResult_UpdateFeeDecodeErrorZ;
12547
12548 /**
12549  * The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
12550  */
12551 typedef union LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr {
12552    /**
12553     * A pointer to the contents in the success state.
12554     * Reading from this pointer when `result_ok` is not set is undefined.
12555     */
12556    struct LDKUpdateFulfillHTLC *result;
12557    /**
12558     * A pointer to the contents in the error state.
12559     * Reading from this pointer when `result_ok` is set is undefined.
12560     */
12561    struct LDKDecodeError *err;
12562 } LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr;
12563
12564 /**
12565  * A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
12566  * containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
12567  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
12568  */
12569 typedef struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ {
12570    /**
12571     * The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
12572     * `err` or `result` depending on the state of `result_ok`.
12573     */
12574    union LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr contents;
12575    /**
12576     * Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
12577     */
12578    bool result_ok;
12579 } LDKCResult_UpdateFulfillHTLCDecodeErrorZ;
12580
12581 /**
12582  * The contents of CResult_UpdateAddHTLCDecodeErrorZ
12583  */
12584 typedef union LDKCResult_UpdateAddHTLCDecodeErrorZPtr {
12585    /**
12586     * A pointer to the contents in the success state.
12587     * Reading from this pointer when `result_ok` is not set is undefined.
12588     */
12589    struct LDKUpdateAddHTLC *result;
12590    /**
12591     * A pointer to the contents in the error state.
12592     * Reading from this pointer when `result_ok` is set is undefined.
12593     */
12594    struct LDKDecodeError *err;
12595 } LDKCResult_UpdateAddHTLCDecodeErrorZPtr;
12596
12597 /**
12598  * A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
12599  * containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
12600  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
12601  */
12602 typedef struct LDKCResult_UpdateAddHTLCDecodeErrorZ {
12603    /**
12604     * The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
12605     * `err` or `result` depending on the state of `result_ok`.
12606     */
12607    union LDKCResult_UpdateAddHTLCDecodeErrorZPtr contents;
12608    /**
12609     * Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
12610     */
12611    bool result_ok;
12612 } LDKCResult_UpdateAddHTLCDecodeErrorZ;
12613
12614
12615
12616 /**
12617  * An onion message to be sent to or received from a peer.
12618  *
12619  */
12620 typedef struct MUST_USE_STRUCT LDKOnionMessage {
12621    /**
12622     * A pointer to the opaque Rust object.
12623     * Nearly everywhere, inner must be non-null, however in places where
12624     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12625     */
12626    LDKnativeOnionMessage *inner;
12627    /**
12628     * Indicates that this is the only struct which contains the same pointer.
12629     * Rust functions which take ownership of an object provided via an argument require
12630     * this to be true and invalidate the object pointed to by inner.
12631     */
12632    bool is_owned;
12633 } LDKOnionMessage;
12634
12635 /**
12636  * The contents of CResult_OnionMessageDecodeErrorZ
12637  */
12638 typedef union LDKCResult_OnionMessageDecodeErrorZPtr {
12639    /**
12640     * A pointer to the contents in the success state.
12641     * Reading from this pointer when `result_ok` is not set is undefined.
12642     */
12643    struct LDKOnionMessage *result;
12644    /**
12645     * A pointer to the contents in the error state.
12646     * Reading from this pointer when `result_ok` is set is undefined.
12647     */
12648    struct LDKDecodeError *err;
12649 } LDKCResult_OnionMessageDecodeErrorZPtr;
12650
12651 /**
12652  * A CResult_OnionMessageDecodeErrorZ represents the result of a fallible operation,
12653  * containing a crate::lightning::ln::msgs::OnionMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
12654  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
12655  */
12656 typedef struct LDKCResult_OnionMessageDecodeErrorZ {
12657    /**
12658     * The contents of this CResult_OnionMessageDecodeErrorZ, accessible via either
12659     * `err` or `result` depending on the state of `result_ok`.
12660     */
12661    union LDKCResult_OnionMessageDecodeErrorZPtr contents;
12662    /**
12663     * Whether this CResult_OnionMessageDecodeErrorZ represents a success state.
12664     */
12665    bool result_ok;
12666 } LDKCResult_OnionMessageDecodeErrorZ;
12667
12668
12669
12670 /**
12671  * A [`ping`] message to be sent to or received from a peer.
12672  *
12673  * [`ping`]: https://github.com/lightning/bolts/blob/master/01-messaging.md#the-ping-and-pong-messages
12674  */
12675 typedef struct MUST_USE_STRUCT LDKPing {
12676    /**
12677     * A pointer to the opaque Rust object.
12678     * Nearly everywhere, inner must be non-null, however in places where
12679     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12680     */
12681    LDKnativePing *inner;
12682    /**
12683     * Indicates that this is the only struct which contains the same pointer.
12684     * Rust functions which take ownership of an object provided via an argument require
12685     * this to be true and invalidate the object pointed to by inner.
12686     */
12687    bool is_owned;
12688 } LDKPing;
12689
12690 /**
12691  * The contents of CResult_PingDecodeErrorZ
12692  */
12693 typedef union LDKCResult_PingDecodeErrorZPtr {
12694    /**
12695     * A pointer to the contents in the success state.
12696     * Reading from this pointer when `result_ok` is not set is undefined.
12697     */
12698    struct LDKPing *result;
12699    /**
12700     * A pointer to the contents in the error state.
12701     * Reading from this pointer when `result_ok` is set is undefined.
12702     */
12703    struct LDKDecodeError *err;
12704 } LDKCResult_PingDecodeErrorZPtr;
12705
12706 /**
12707  * A CResult_PingDecodeErrorZ represents the result of a fallible operation,
12708  * containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
12709  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
12710  */
12711 typedef struct LDKCResult_PingDecodeErrorZ {
12712    /**
12713     * The contents of this CResult_PingDecodeErrorZ, accessible via either
12714     * `err` or `result` depending on the state of `result_ok`.
12715     */
12716    union LDKCResult_PingDecodeErrorZPtr contents;
12717    /**
12718     * Whether this CResult_PingDecodeErrorZ represents a success state.
12719     */
12720    bool result_ok;
12721 } LDKCResult_PingDecodeErrorZ;
12722
12723
12724
12725 /**
12726  * A [`pong`] message to be sent to or received from a peer.
12727  *
12728  * [`pong`]: https://github.com/lightning/bolts/blob/master/01-messaging.md#the-ping-and-pong-messages
12729  */
12730 typedef struct MUST_USE_STRUCT LDKPong {
12731    /**
12732     * A pointer to the opaque Rust object.
12733     * Nearly everywhere, inner must be non-null, however in places where
12734     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12735     */
12736    LDKnativePong *inner;
12737    /**
12738     * Indicates that this is the only struct which contains the same pointer.
12739     * Rust functions which take ownership of an object provided via an argument require
12740     * this to be true and invalidate the object pointed to by inner.
12741     */
12742    bool is_owned;
12743 } LDKPong;
12744
12745 /**
12746  * The contents of CResult_PongDecodeErrorZ
12747  */
12748 typedef union LDKCResult_PongDecodeErrorZPtr {
12749    /**
12750     * A pointer to the contents in the success state.
12751     * Reading from this pointer when `result_ok` is not set is undefined.
12752     */
12753    struct LDKPong *result;
12754    /**
12755     * A pointer to the contents in the error state.
12756     * Reading from this pointer when `result_ok` is set is undefined.
12757     */
12758    struct LDKDecodeError *err;
12759 } LDKCResult_PongDecodeErrorZPtr;
12760
12761 /**
12762  * A CResult_PongDecodeErrorZ represents the result of a fallible operation,
12763  * containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
12764  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
12765  */
12766 typedef struct LDKCResult_PongDecodeErrorZ {
12767    /**
12768     * The contents of this CResult_PongDecodeErrorZ, accessible via either
12769     * `err` or `result` depending on the state of `result_ok`.
12770     */
12771    union LDKCResult_PongDecodeErrorZPtr contents;
12772    /**
12773     * Whether this CResult_PongDecodeErrorZ represents a success state.
12774     */
12775    bool result_ok;
12776 } LDKCResult_PongDecodeErrorZ;
12777
12778 /**
12779  * The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
12780  */
12781 typedef union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
12782    /**
12783     * A pointer to the contents in the success state.
12784     * Reading from this pointer when `result_ok` is not set is undefined.
12785     */
12786    struct LDKUnsignedChannelAnnouncement *result;
12787    /**
12788     * A pointer to the contents in the error state.
12789     * Reading from this pointer when `result_ok` is set is undefined.
12790     */
12791    struct LDKDecodeError *err;
12792 } LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr;
12793
12794 /**
12795  * A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
12796  * containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
12797  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
12798  */
12799 typedef struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ {
12800    /**
12801     * The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
12802     * `err` or `result` depending on the state of `result_ok`.
12803     */
12804    union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr contents;
12805    /**
12806     * Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
12807     */
12808    bool result_ok;
12809 } LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ;
12810
12811 /**
12812  * The contents of CResult_ChannelAnnouncementDecodeErrorZ
12813  */
12814 typedef union LDKCResult_ChannelAnnouncementDecodeErrorZPtr {
12815    /**
12816     * A pointer to the contents in the success state.
12817     * Reading from this pointer when `result_ok` is not set is undefined.
12818     */
12819    struct LDKChannelAnnouncement *result;
12820    /**
12821     * A pointer to the contents in the error state.
12822     * Reading from this pointer when `result_ok` is set is undefined.
12823     */
12824    struct LDKDecodeError *err;
12825 } LDKCResult_ChannelAnnouncementDecodeErrorZPtr;
12826
12827 /**
12828  * A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
12829  * containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
12830  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
12831  */
12832 typedef struct LDKCResult_ChannelAnnouncementDecodeErrorZ {
12833    /**
12834     * The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
12835     * `err` or `result` depending on the state of `result_ok`.
12836     */
12837    union LDKCResult_ChannelAnnouncementDecodeErrorZPtr contents;
12838    /**
12839     * Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
12840     */
12841    bool result_ok;
12842 } LDKCResult_ChannelAnnouncementDecodeErrorZ;
12843
12844 /**
12845  * The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
12846  */
12847 typedef union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr {
12848    /**
12849     * A pointer to the contents in the success state.
12850     * Reading from this pointer when `result_ok` is not set is undefined.
12851     */
12852    struct LDKUnsignedChannelUpdate *result;
12853    /**
12854     * A pointer to the contents in the error state.
12855     * Reading from this pointer when `result_ok` is set is undefined.
12856     */
12857    struct LDKDecodeError *err;
12858 } LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr;
12859
12860 /**
12861  * A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
12862  * containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
12863  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
12864  */
12865 typedef struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ {
12866    /**
12867     * The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
12868     * `err` or `result` depending on the state of `result_ok`.
12869     */
12870    union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr contents;
12871    /**
12872     * Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
12873     */
12874    bool result_ok;
12875 } LDKCResult_UnsignedChannelUpdateDecodeErrorZ;
12876
12877 /**
12878  * The contents of CResult_ChannelUpdateDecodeErrorZ
12879  */
12880 typedef union LDKCResult_ChannelUpdateDecodeErrorZPtr {
12881    /**
12882     * A pointer to the contents in the success state.
12883     * Reading from this pointer when `result_ok` is not set is undefined.
12884     */
12885    struct LDKChannelUpdate *result;
12886    /**
12887     * A pointer to the contents in the error state.
12888     * Reading from this pointer when `result_ok` is set is undefined.
12889     */
12890    struct LDKDecodeError *err;
12891 } LDKCResult_ChannelUpdateDecodeErrorZPtr;
12892
12893 /**
12894  * A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
12895  * containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
12896  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
12897  */
12898 typedef struct LDKCResult_ChannelUpdateDecodeErrorZ {
12899    /**
12900     * The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
12901     * `err` or `result` depending on the state of `result_ok`.
12902     */
12903    union LDKCResult_ChannelUpdateDecodeErrorZPtr contents;
12904    /**
12905     * Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
12906     */
12907    bool result_ok;
12908 } LDKCResult_ChannelUpdateDecodeErrorZ;
12909
12910 /**
12911  * The contents of CResult_ErrorMessageDecodeErrorZ
12912  */
12913 typedef union LDKCResult_ErrorMessageDecodeErrorZPtr {
12914    /**
12915     * A pointer to the contents in the success state.
12916     * Reading from this pointer when `result_ok` is not set is undefined.
12917     */
12918    struct LDKErrorMessage *result;
12919    /**
12920     * A pointer to the contents in the error state.
12921     * Reading from this pointer when `result_ok` is set is undefined.
12922     */
12923    struct LDKDecodeError *err;
12924 } LDKCResult_ErrorMessageDecodeErrorZPtr;
12925
12926 /**
12927  * A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
12928  * containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
12929  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
12930  */
12931 typedef struct LDKCResult_ErrorMessageDecodeErrorZ {
12932    /**
12933     * The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
12934     * `err` or `result` depending on the state of `result_ok`.
12935     */
12936    union LDKCResult_ErrorMessageDecodeErrorZPtr contents;
12937    /**
12938     * Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
12939     */
12940    bool result_ok;
12941 } LDKCResult_ErrorMessageDecodeErrorZ;
12942
12943 /**
12944  * The contents of CResult_WarningMessageDecodeErrorZ
12945  */
12946 typedef union LDKCResult_WarningMessageDecodeErrorZPtr {
12947    /**
12948     * A pointer to the contents in the success state.
12949     * Reading from this pointer when `result_ok` is not set is undefined.
12950     */
12951    struct LDKWarningMessage *result;
12952    /**
12953     * A pointer to the contents in the error state.
12954     * Reading from this pointer when `result_ok` is set is undefined.
12955     */
12956    struct LDKDecodeError *err;
12957 } LDKCResult_WarningMessageDecodeErrorZPtr;
12958
12959 /**
12960  * A CResult_WarningMessageDecodeErrorZ represents the result of a fallible operation,
12961  * containing a crate::lightning::ln::msgs::WarningMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
12962  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
12963  */
12964 typedef struct LDKCResult_WarningMessageDecodeErrorZ {
12965    /**
12966     * The contents of this CResult_WarningMessageDecodeErrorZ, accessible via either
12967     * `err` or `result` depending on the state of `result_ok`.
12968     */
12969    union LDKCResult_WarningMessageDecodeErrorZPtr contents;
12970    /**
12971     * Whether this CResult_WarningMessageDecodeErrorZ represents a success state.
12972     */
12973    bool result_ok;
12974 } LDKCResult_WarningMessageDecodeErrorZ;
12975
12976 /**
12977  * The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
12978  */
12979 typedef union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
12980    /**
12981     * A pointer to the contents in the success state.
12982     * Reading from this pointer when `result_ok` is not set is undefined.
12983     */
12984    struct LDKUnsignedNodeAnnouncement *result;
12985    /**
12986     * A pointer to the contents in the error state.
12987     * Reading from this pointer when `result_ok` is set is undefined.
12988     */
12989    struct LDKDecodeError *err;
12990 } LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr;
12991
12992 /**
12993  * A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
12994  * containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
12995  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
12996  */
12997 typedef struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ {
12998    /**
12999     * The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
13000     * `err` or `result` depending on the state of `result_ok`.
13001     */
13002    union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr contents;
13003    /**
13004     * Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
13005     */
13006    bool result_ok;
13007 } LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ;
13008
13009 /**
13010  * The contents of CResult_NodeAnnouncementDecodeErrorZ
13011  */
13012 typedef union LDKCResult_NodeAnnouncementDecodeErrorZPtr {
13013    /**
13014     * A pointer to the contents in the success state.
13015     * Reading from this pointer when `result_ok` is not set is undefined.
13016     */
13017    struct LDKNodeAnnouncement *result;
13018    /**
13019     * A pointer to the contents in the error state.
13020     * Reading from this pointer when `result_ok` is set is undefined.
13021     */
13022    struct LDKDecodeError *err;
13023 } LDKCResult_NodeAnnouncementDecodeErrorZPtr;
13024
13025 /**
13026  * A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
13027  * containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
13028  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
13029  */
13030 typedef struct LDKCResult_NodeAnnouncementDecodeErrorZ {
13031    /**
13032     * The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
13033     * `err` or `result` depending on the state of `result_ok`.
13034     */
13035    union LDKCResult_NodeAnnouncementDecodeErrorZPtr contents;
13036    /**
13037     * Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
13038     */
13039    bool result_ok;
13040 } LDKCResult_NodeAnnouncementDecodeErrorZ;
13041
13042 /**
13043  * The contents of CResult_QueryShortChannelIdsDecodeErrorZ
13044  */
13045 typedef union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr {
13046    /**
13047     * A pointer to the contents in the success state.
13048     * Reading from this pointer when `result_ok` is not set is undefined.
13049     */
13050    struct LDKQueryShortChannelIds *result;
13051    /**
13052     * A pointer to the contents in the error state.
13053     * Reading from this pointer when `result_ok` is set is undefined.
13054     */
13055    struct LDKDecodeError *err;
13056 } LDKCResult_QueryShortChannelIdsDecodeErrorZPtr;
13057
13058 /**
13059  * A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
13060  * containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
13061  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
13062  */
13063 typedef struct LDKCResult_QueryShortChannelIdsDecodeErrorZ {
13064    /**
13065     * The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
13066     * `err` or `result` depending on the state of `result_ok`.
13067     */
13068    union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr contents;
13069    /**
13070     * Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
13071     */
13072    bool result_ok;
13073 } LDKCResult_QueryShortChannelIdsDecodeErrorZ;
13074
13075
13076
13077 /**
13078  * A [`reply_short_channel_ids_end`] message is sent as a reply to a
13079  * message. The query recipient makes a best
13080  * effort to respond based on their local network view which may not be
13081  * a perfect view of the network.
13082  *
13083  * [`reply_short_channel_ids_end`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-query_short_channel_idsreply_short_channel_ids_end-messages
13084  */
13085 typedef struct MUST_USE_STRUCT LDKReplyShortChannelIdsEnd {
13086    /**
13087     * A pointer to the opaque Rust object.
13088     * Nearly everywhere, inner must be non-null, however in places where
13089     * the Rust equivalent takes an Option, it may be set to null to indicate None.
13090     */
13091    LDKnativeReplyShortChannelIdsEnd *inner;
13092    /**
13093     * Indicates that this is the only struct which contains the same pointer.
13094     * Rust functions which take ownership of an object provided via an argument require
13095     * this to be true and invalidate the object pointed to by inner.
13096     */
13097    bool is_owned;
13098 } LDKReplyShortChannelIdsEnd;
13099
13100 /**
13101  * The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
13102  */
13103 typedef union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
13104    /**
13105     * A pointer to the contents in the success state.
13106     * Reading from this pointer when `result_ok` is not set is undefined.
13107     */
13108    struct LDKReplyShortChannelIdsEnd *result;
13109    /**
13110     * A pointer to the contents in the error state.
13111     * Reading from this pointer when `result_ok` is set is undefined.
13112     */
13113    struct LDKDecodeError *err;
13114 } LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr;
13115
13116 /**
13117  * A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
13118  * containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
13119  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
13120  */
13121 typedef struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ {
13122    /**
13123     * The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
13124     * `err` or `result` depending on the state of `result_ok`.
13125     */
13126    union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr contents;
13127    /**
13128     * Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
13129     */
13130    bool result_ok;
13131 } LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ;
13132
13133 /**
13134  * The contents of CResult_QueryChannelRangeDecodeErrorZ
13135  */
13136 typedef union LDKCResult_QueryChannelRangeDecodeErrorZPtr {
13137    /**
13138     * A pointer to the contents in the success state.
13139     * Reading from this pointer when `result_ok` is not set is undefined.
13140     */
13141    struct LDKQueryChannelRange *result;
13142    /**
13143     * A pointer to the contents in the error state.
13144     * Reading from this pointer when `result_ok` is set is undefined.
13145     */
13146    struct LDKDecodeError *err;
13147 } LDKCResult_QueryChannelRangeDecodeErrorZPtr;
13148
13149 /**
13150  * A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
13151  * containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
13152  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
13153  */
13154 typedef struct LDKCResult_QueryChannelRangeDecodeErrorZ {
13155    /**
13156     * The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
13157     * `err` or `result` depending on the state of `result_ok`.
13158     */
13159    union LDKCResult_QueryChannelRangeDecodeErrorZPtr contents;
13160    /**
13161     * Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
13162     */
13163    bool result_ok;
13164 } LDKCResult_QueryChannelRangeDecodeErrorZ;
13165
13166 /**
13167  * The contents of CResult_ReplyChannelRangeDecodeErrorZ
13168  */
13169 typedef union LDKCResult_ReplyChannelRangeDecodeErrorZPtr {
13170    /**
13171     * A pointer to the contents in the success state.
13172     * Reading from this pointer when `result_ok` is not set is undefined.
13173     */
13174    struct LDKReplyChannelRange *result;
13175    /**
13176     * A pointer to the contents in the error state.
13177     * Reading from this pointer when `result_ok` is set is undefined.
13178     */
13179    struct LDKDecodeError *err;
13180 } LDKCResult_ReplyChannelRangeDecodeErrorZPtr;
13181
13182 /**
13183  * A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
13184  * containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
13185  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
13186  */
13187 typedef struct LDKCResult_ReplyChannelRangeDecodeErrorZ {
13188    /**
13189     * The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
13190     * `err` or `result` depending on the state of `result_ok`.
13191     */
13192    union LDKCResult_ReplyChannelRangeDecodeErrorZPtr contents;
13193    /**
13194     * Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
13195     */
13196    bool result_ok;
13197 } LDKCResult_ReplyChannelRangeDecodeErrorZ;
13198
13199 /**
13200  * The contents of CResult_GossipTimestampFilterDecodeErrorZ
13201  */
13202 typedef union LDKCResult_GossipTimestampFilterDecodeErrorZPtr {
13203    /**
13204     * A pointer to the contents in the success state.
13205     * Reading from this pointer when `result_ok` is not set is undefined.
13206     */
13207    struct LDKGossipTimestampFilter *result;
13208    /**
13209     * A pointer to the contents in the error state.
13210     * Reading from this pointer when `result_ok` is set is undefined.
13211     */
13212    struct LDKDecodeError *err;
13213 } LDKCResult_GossipTimestampFilterDecodeErrorZPtr;
13214
13215 /**
13216  * A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
13217  * containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
13218  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
13219  */
13220 typedef struct LDKCResult_GossipTimestampFilterDecodeErrorZ {
13221    /**
13222     * The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
13223     * `err` or `result` depending on the state of `result_ok`.
13224     */
13225    union LDKCResult_GossipTimestampFilterDecodeErrorZPtr contents;
13226    /**
13227     * Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
13228     */
13229    bool result_ok;
13230 } LDKCResult_GossipTimestampFilterDecodeErrorZ;
13231
13232 /**
13233  * A dynamically-allocated array of crate::lightning::ln::channelmanager::PhantomRouteHintss of arbitrary size.
13234  * This corresponds to std::vector in C++
13235  */
13236 typedef struct LDKCVec_PhantomRouteHintsZ {
13237    /**
13238     * The elements in the array.
13239     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13240     */
13241    struct LDKPhantomRouteHints *data;
13242    /**
13243     * The number of elements pointed to by `data`.
13244     */
13245    uintptr_t datalen;
13246 } LDKCVec_PhantomRouteHintsZ;
13247
13248 /**
13249  * When signing using a fallible method either an user-supplied `SignError` or a [`CreationError`]
13250  * may occur.
13251  */
13252 typedef enum LDKSignOrCreationError_Tag {
13253    /**
13254     * An error occurred during signing
13255     */
13256    LDKSignOrCreationError_SignError,
13257    /**
13258     * An error occurred while building the transaction
13259     */
13260    LDKSignOrCreationError_CreationError,
13261    /**
13262     * Must be last for serialization purposes
13263     */
13264    LDKSignOrCreationError_Sentinel,
13265 } LDKSignOrCreationError_Tag;
13266
13267 typedef struct MUST_USE_STRUCT LDKSignOrCreationError {
13268    LDKSignOrCreationError_Tag tag;
13269    union {
13270       struct {
13271          enum LDKCreationError creation_error;
13272       };
13273    };
13274 } LDKSignOrCreationError;
13275
13276 /**
13277  * The contents of CResult_InvoiceSignOrCreationErrorZ
13278  */
13279 typedef union LDKCResult_InvoiceSignOrCreationErrorZPtr {
13280    /**
13281     * A pointer to the contents in the success state.
13282     * Reading from this pointer when `result_ok` is not set is undefined.
13283     */
13284    struct LDKInvoice *result;
13285    /**
13286     * A pointer to the contents in the error state.
13287     * Reading from this pointer when `result_ok` is set is undefined.
13288     */
13289    struct LDKSignOrCreationError *err;
13290 } LDKCResult_InvoiceSignOrCreationErrorZPtr;
13291
13292 /**
13293  * A CResult_InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
13294  * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
13295  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
13296  */
13297 typedef struct LDKCResult_InvoiceSignOrCreationErrorZ {
13298    /**
13299     * The contents of this CResult_InvoiceSignOrCreationErrorZ, accessible via either
13300     * `err` or `result` depending on the state of `result_ok`.
13301     */
13302    union LDKCResult_InvoiceSignOrCreationErrorZPtr contents;
13303    /**
13304     * Whether this CResult_InvoiceSignOrCreationErrorZ represents a success state.
13305     */
13306    bool result_ok;
13307 } LDKCResult_InvoiceSignOrCreationErrorZ;
13308
13309
13310
13311 /**
13312  * A simple future which can complete once, and calls some callback(s) when it does so.
13313  *
13314  * Clones can be made and all futures cloned from the same source will complete at the same time.
13315  */
13316 typedef struct MUST_USE_STRUCT LDKFuture {
13317    /**
13318     * A pointer to the opaque Rust object.
13319     * Nearly everywhere, inner must be non-null, however in places where
13320     * the Rust equivalent takes an Option, it may be set to null to indicate None.
13321     */
13322    LDKnativeFuture *inner;
13323    /**
13324     * Indicates that this is the only struct which contains the same pointer.
13325     * Rust functions which take ownership of an object provided via an argument require
13326     * this to be true and invalidate the object pointed to by inner.
13327     */
13328    bool is_owned;
13329 } LDKFuture;
13330
13331 /**
13332  * A dynamically-allocated array of crate::lightning::util::wakers::Futures of arbitrary size.
13333  * This corresponds to std::vector in C++
13334  */
13335 typedef struct LDKCVec_FutureZ {
13336    /**
13337     * The elements in the array.
13338     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13339     */
13340    struct LDKFuture *data;
13341    /**
13342     * The number of elements pointed to by `data`.
13343     */
13344    uintptr_t datalen;
13345 } LDKCVec_FutureZ;
13346
13347
13348
13349 /**
13350  * A transaction output watched by a [`ChannelMonitor`] for spends on-chain.
13351  *
13352  * Used to convey to a [`Filter`] such an output with a given spending condition. Any transaction
13353  * spending the output must be given to [`ChannelMonitor::block_connected`] either directly or via
13354  * [`Confirm::transactions_confirmed`].
13355  *
13356  * If `block_hash` is `Some`, this indicates the output was created in the corresponding block and
13357  * may have been spent there. See [`Filter::register_output`] for details.
13358  *
13359  * [`ChannelMonitor`]: channelmonitor::ChannelMonitor
13360  * [`ChannelMonitor::block_connected`]: channelmonitor::ChannelMonitor::block_connected
13361  */
13362 typedef struct MUST_USE_STRUCT LDKWatchedOutput {
13363    /**
13364     * A pointer to the opaque Rust object.
13365     * Nearly everywhere, inner must be non-null, however in places where
13366     * the Rust equivalent takes an Option, it may be set to null to indicate None.
13367     */
13368    LDKnativeWatchedOutput *inner;
13369    /**
13370     * Indicates that this is the only struct which contains the same pointer.
13371     * Rust functions which take ownership of an object provided via an argument require
13372     * this to be true and invalidate the object pointed to by inner.
13373     */
13374    bool is_owned;
13375 } LDKWatchedOutput;
13376
13377 /**
13378  * The `Filter` trait defines behavior for indicating chain activity of interest pertaining to
13379  * channels.
13380  *
13381  * This is useful in order to have a [`Watch`] implementation convey to a chain source which
13382  * transactions to be notified of. Notification may take the form of pre-filtering blocks or, in
13383  * the case of [BIP 157]/[BIP 158], only fetching a block if the compact filter matches. If
13384  * receiving full blocks from a chain source, any further filtering is unnecessary.
13385  *
13386  * After an output has been registered, subsequent block retrievals from the chain source must not
13387  * exclude any transactions matching the new criteria nor any in-block descendants of such
13388  * transactions.
13389  *
13390  * Note that use as part of a [`Watch`] implementation involves reentrancy. Therefore, the `Filter`
13391  * should not block on I/O. Implementations should instead queue the newly monitored data to be
13392  * processed later. Then, in order to block until the data has been processed, any [`Watch`]
13393  * invocation that has called the `Filter` must return [`InProgress`].
13394  *
13395  * [`InProgress`]: ChannelMonitorUpdateStatus::InProgress
13396  * [BIP 157]: https://github.com/bitcoin/bips/blob/master/bip-0157.mediawiki
13397  * [BIP 158]: https://github.com/bitcoin/bips/blob/master/bip-0158.mediawiki
13398  */
13399 typedef struct LDKFilter {
13400    /**
13401     * An opaque pointer which is passed to your function implementations as an argument.
13402     * This has no meaning in the LDK, and can be NULL or any other value.
13403     */
13404    void *this_arg;
13405    /**
13406     * Registers interest in a transaction with `txid` and having an output with `script_pubkey` as
13407     * a spending condition.
13408     */
13409    void (*register_tx)(const void *this_arg, const uint8_t (*txid)[32], struct LDKu8slice script_pubkey);
13410    /**
13411     * Registers interest in spends of a transaction output.
13412     *
13413     * Note that this method might be called during processing of a new block. You therefore need
13414     * to ensure that also dependent output spents within an already connected block are correctly
13415     * handled, e.g., by re-scanning the block in question whenever new outputs have been
13416     * registered mid-processing.
13417     */
13418    void (*register_output)(const void *this_arg, struct LDKWatchedOutput output);
13419    /**
13420     * Frees any resources associated with this object given its this_arg pointer.
13421     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
13422     */
13423    void (*free)(void *this_arg);
13424 } LDKFilter;
13425
13426 /**
13427  * An enum which can either contain a crate::lightning::chain::Filter or not
13428  */
13429 typedef enum LDKCOption_FilterZ_Tag {
13430    /**
13431     * When we're in this state, this COption_FilterZ contains a crate::lightning::chain::Filter
13432     */
13433    LDKCOption_FilterZ_Some,
13434    /**
13435     * When we're in this state, this COption_FilterZ contains nothing
13436     */
13437    LDKCOption_FilterZ_None,
13438    /**
13439     * Must be last for serialization purposes
13440     */
13441    LDKCOption_FilterZ_Sentinel,
13442 } LDKCOption_FilterZ_Tag;
13443
13444 typedef struct LDKCOption_FilterZ {
13445    LDKCOption_FilterZ_Tag tag;
13446    union {
13447       struct {
13448          struct LDKFilter some;
13449       };
13450    };
13451 } LDKCOption_FilterZ;
13452
13453
13454
13455 /**
13456  * A read-only reference to a current ChannelMonitor.
13457  *
13458  * Note that this holds a mutex in [`ChainMonitor`] and may block other events until it is
13459  * released.
13460  */
13461 typedef struct MUST_USE_STRUCT LDKLockedChannelMonitor {
13462    /**
13463     * A pointer to the opaque Rust object.
13464     * Nearly everywhere, inner must be non-null, however in places where
13465     * the Rust equivalent takes an Option, it may be set to null to indicate None.
13466     */
13467    LDKnativeLockedChannelMonitor *inner;
13468    /**
13469     * Indicates that this is the only struct which contains the same pointer.
13470     * Rust functions which take ownership of an object provided via an argument require
13471     * this to be true and invalidate the object pointed to by inner.
13472     */
13473    bool is_owned;
13474 } LDKLockedChannelMonitor;
13475
13476 /**
13477  * The contents of CResult_LockedChannelMonitorNoneZ
13478  */
13479 typedef union LDKCResult_LockedChannelMonitorNoneZPtr {
13480    /**
13481     * A pointer to the contents in the success state.
13482     * Reading from this pointer when `result_ok` is not set is undefined.
13483     */
13484    struct LDKLockedChannelMonitor *result;
13485    /**
13486     * Note that this value is always NULL, as there are no contents in the Err variant
13487     */
13488    void *err;
13489 } LDKCResult_LockedChannelMonitorNoneZPtr;
13490
13491 /**
13492  * A CResult_LockedChannelMonitorNoneZ represents the result of a fallible operation,
13493  * containing a crate::lightning::chain::chainmonitor::LockedChannelMonitor on success and a () on failure.
13494  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
13495  */
13496 typedef struct LDKCResult_LockedChannelMonitorNoneZ {
13497    /**
13498     * The contents of this CResult_LockedChannelMonitorNoneZ, accessible via either
13499     * `err` or `result` depending on the state of `result_ok`.
13500     */
13501    union LDKCResult_LockedChannelMonitorNoneZPtr contents;
13502    /**
13503     * Whether this CResult_LockedChannelMonitorNoneZ represents a success state.
13504     */
13505    bool result_ok;
13506 } LDKCResult_LockedChannelMonitorNoneZ;
13507
13508 /**
13509  * A dynamically-allocated array of crate::lightning::chain::transaction::OutPoints of arbitrary size.
13510  * This corresponds to std::vector in C++
13511  */
13512 typedef struct LDKCVec_OutPointZ {
13513    /**
13514     * The elements in the array.
13515     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13516     */
13517    struct LDKOutPoint *data;
13518    /**
13519     * The number of elements pointed to by `data`.
13520     */
13521    uintptr_t datalen;
13522 } LDKCVec_OutPointZ;
13523
13524
13525
13526 /**
13527  * An opaque identifier describing a specific [`Persist`] method call.
13528  */
13529 typedef struct MUST_USE_STRUCT LDKMonitorUpdateId {
13530    /**
13531     * A pointer to the opaque Rust object.
13532     * Nearly everywhere, inner must be non-null, however in places where
13533     * the Rust equivalent takes an Option, it may be set to null to indicate None.
13534     */
13535    LDKnativeMonitorUpdateId *inner;
13536    /**
13537     * Indicates that this is the only struct which contains the same pointer.
13538     * Rust functions which take ownership of an object provided via an argument require
13539     * this to be true and invalidate the object pointed to by inner.
13540     */
13541    bool is_owned;
13542 } LDKMonitorUpdateId;
13543
13544 /**
13545  * A dynamically-allocated array of crate::lightning::chain::chainmonitor::MonitorUpdateIds of arbitrary size.
13546  * This corresponds to std::vector in C++
13547  */
13548 typedef struct LDKCVec_MonitorUpdateIdZ {
13549    /**
13550     * The elements in the array.
13551     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13552     */
13553    struct LDKMonitorUpdateId *data;
13554    /**
13555     * The number of elements pointed to by `data`.
13556     */
13557    uintptr_t datalen;
13558 } LDKCVec_MonitorUpdateIdZ;
13559
13560 /**
13561  * A tuple of 2 elements. See the individual fields for the types contained.
13562  */
13563 typedef struct LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ {
13564    /**
13565     * The element at position 0
13566     */
13567    struct LDKOutPoint a;
13568    /**
13569     * The element at position 1
13570     */
13571    struct LDKCVec_MonitorUpdateIdZ b;
13572 } LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ;
13573
13574 /**
13575  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZs of arbitrary size.
13576  * This corresponds to std::vector in C++
13577  */
13578 typedef struct LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
13579    /**
13580     * The elements in the array.
13581     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13582     */
13583    struct LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *data;
13584    /**
13585     * The number of elements pointed to by `data`.
13586     */
13587    uintptr_t datalen;
13588 } LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ;
13589
13590 /**
13591  * All-encompassing standard error type that processing can return
13592  */
13593 typedef enum LDKGraphSyncError_Tag {
13594    /**
13595     * Error trying to read the update data, typically due to an erroneous data length indication
13596     * that is greater than the actual amount of data provided
13597     */
13598    LDKGraphSyncError_DecodeError,
13599    /**
13600     * Error applying the patch to the network graph, usually the result of updates that are too
13601     * old or missing prerequisite data to the application of updates out of order
13602     */
13603    LDKGraphSyncError_LightningError,
13604    /**
13605     * Must be last for serialization purposes
13606     */
13607    LDKGraphSyncError_Sentinel,
13608 } LDKGraphSyncError_Tag;
13609
13610 typedef struct MUST_USE_STRUCT LDKGraphSyncError {
13611    LDKGraphSyncError_Tag tag;
13612    union {
13613       struct {
13614          struct LDKDecodeError decode_error;
13615       };
13616       struct {
13617          struct LDKLightningError lightning_error;
13618       };
13619    };
13620 } LDKGraphSyncError;
13621
13622 /**
13623  * The contents of CResult_u32GraphSyncErrorZ
13624  */
13625 typedef union LDKCResult_u32GraphSyncErrorZPtr {
13626    /**
13627     * A pointer to the contents in the success state.
13628     * Reading from this pointer when `result_ok` is not set is undefined.
13629     */
13630    uint32_t *result;
13631    /**
13632     * A pointer to the contents in the error state.
13633     * Reading from this pointer when `result_ok` is set is undefined.
13634     */
13635    struct LDKGraphSyncError *err;
13636 } LDKCResult_u32GraphSyncErrorZPtr;
13637
13638 /**
13639  * A CResult_u32GraphSyncErrorZ represents the result of a fallible operation,
13640  * containing a u32 on success and a crate::lightning_rapid_gossip_sync::error::GraphSyncError on failure.
13641  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
13642  */
13643 typedef struct LDKCResult_u32GraphSyncErrorZ {
13644    /**
13645     * The contents of this CResult_u32GraphSyncErrorZ, accessible via either
13646     * `err` or `result` depending on the state of `result_ok`.
13647     */
13648    union LDKCResult_u32GraphSyncErrorZPtr contents;
13649    /**
13650     * Whether this CResult_u32GraphSyncErrorZ represents a success state.
13651     */
13652    bool result_ok;
13653 } LDKCResult_u32GraphSyncErrorZ;
13654
13655
13656
13657 /**
13658  * Lightning TLV uses a custom variable-length integer called `BigSize`. It is similar to Bitcoin's
13659  * variable-length integers except that it is serialized in big-endian instead of little-endian.
13660  *
13661  * Like Bitcoin's variable-length integer, it exhibits ambiguity in that certain values can be
13662  * encoded in several different ways, which we must check for at deserialization-time. Thus, if
13663  * you're looking for an example of a variable-length integer to use for your own project, move
13664  * along, this is a rather poor design.
13665  */
13666 typedef struct MUST_USE_STRUCT LDKBigSize {
13667    /**
13668     * A pointer to the opaque Rust object.
13669     * Nearly everywhere, inner must be non-null, however in places where
13670     * the Rust equivalent takes an Option, it may be set to null to indicate None.
13671     */
13672    LDKnativeBigSize *inner;
13673    /**
13674     * Indicates that this is the only struct which contains the same pointer.
13675     * Rust functions which take ownership of an object provided via an argument require
13676     * this to be true and invalidate the object pointed to by inner.
13677     */
13678    bool is_owned;
13679 } LDKBigSize;
13680
13681 /**
13682  * Trait that handles persisting a [`ChannelManager`], [`NetworkGraph`], and [`WriteableScore`] to disk.
13683  */
13684 typedef struct LDKPersister {
13685    /**
13686     * An opaque pointer which is passed to your function implementations as an argument.
13687     * This has no meaning in the LDK, and can be NULL or any other value.
13688     */
13689    void *this_arg;
13690    /**
13691     * Persist the given ['ChannelManager'] to disk, returning an error if persistence failed.
13692     */
13693    struct LDKCResult_NoneErrorZ (*persist_manager)(const void *this_arg, const struct LDKChannelManager *NONNULL_PTR channel_manager);
13694    /**
13695     * Persist the given [`NetworkGraph`] to disk, returning an error if persistence failed.
13696     */
13697    struct LDKCResult_NoneErrorZ (*persist_graph)(const void *this_arg, const struct LDKNetworkGraph *NONNULL_PTR network_graph);
13698    /**
13699     * Persist the given [`WriteableScore`] to disk, returning an error if persistence failed.
13700     */
13701    struct LDKCResult_NoneErrorZ (*persist_scorer)(const void *this_arg, const struct LDKWriteableScore *NONNULL_PTR scorer);
13702    /**
13703     * Frees any resources associated with this object given its this_arg pointer.
13704     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
13705     */
13706    void (*free)(void *this_arg);
13707 } LDKPersister;
13708
13709
13710
13711 /**
13712  * A string that displays only printable characters, replacing control characters with
13713  * [`core::char::REPLACEMENT_CHARACTER`].
13714  */
13715 typedef struct MUST_USE_STRUCT LDKPrintableString {
13716    /**
13717     * A pointer to the opaque Rust object.
13718     * Nearly everywhere, inner must be non-null, however in places where
13719     * the Rust equivalent takes an Option, it may be set to null to indicate None.
13720     */
13721    LDKnativePrintableString *inner;
13722    /**
13723     * Indicates that this is the only struct which contains the same pointer.
13724     * Rust functions which take ownership of an object provided via an argument require
13725     * this to be true and invalidate the object pointed to by inner.
13726     */
13727    bool is_owned;
13728 } LDKPrintableString;
13729
13730 /**
13731  * A callback which is called when a [`Future`] completes.
13732  *
13733  * Note that this MUST NOT call back into LDK directly, it must instead schedule actions to be
13734  * taken later. Rust users should use the [`std::future::Future`] implementation for [`Future`]
13735  * instead.
13736  *
13737  * Note that the [`std::future::Future`] implementation may only work for runtimes which schedule
13738  * futures when they receive a wake, rather than immediately executing them.
13739  */
13740 typedef struct LDKFutureCallback {
13741    /**
13742     * An opaque pointer which is passed to your function implementations as an argument.
13743     * This has no meaning in the LDK, and can be NULL or any other value.
13744     */
13745    void *this_arg;
13746    /**
13747     * The method which is called.
13748     */
13749    void (*call)(const void *this_arg);
13750    /**
13751     * Frees any resources associated with this object given its this_arg pointer.
13752     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
13753     */
13754    void (*free)(void *this_arg);
13755 } LDKFutureCallback;
13756
13757
13758
13759 /**
13760  * A struct which can be used to select across many [`Future`]s at once without relying on a full
13761  * async context.
13762  */
13763 typedef struct MUST_USE_STRUCT LDKSleeper {
13764    /**
13765     * A pointer to the opaque Rust object.
13766     * Nearly everywhere, inner must be non-null, however in places where
13767     * the Rust equivalent takes an Option, it may be set to null to indicate None.
13768     */
13769    LDKnativeSleeper *inner;
13770    /**
13771     * Indicates that this is the only struct which contains the same pointer.
13772     * Rust functions which take ownership of an object provided via an argument require
13773     * this to be true and invalidate the object pointed to by inner.
13774     */
13775    bool is_owned;
13776 } LDKSleeper;
13777
13778
13779
13780 /**
13781  * Configuration we set when applicable.
13782  *
13783  * Default::default() provides sane defaults.
13784  */
13785 typedef struct MUST_USE_STRUCT LDKChannelHandshakeConfig {
13786    /**
13787     * A pointer to the opaque Rust object.
13788     * Nearly everywhere, inner must be non-null, however in places where
13789     * the Rust equivalent takes an Option, it may be set to null to indicate None.
13790     */
13791    LDKnativeChannelHandshakeConfig *inner;
13792    /**
13793     * Indicates that this is the only struct which contains the same pointer.
13794     * Rust functions which take ownership of an object provided via an argument require
13795     * this to be true and invalidate the object pointed to by inner.
13796     */
13797    bool is_owned;
13798 } LDKChannelHandshakeConfig;
13799
13800
13801
13802 /**
13803  * Optional channel limits which are applied during channel creation.
13804  *
13805  * These limits are only applied to our counterparty's limits, not our own.
13806  *
13807  * Use 0/`<type>::max_value()` as appropriate to skip checking.
13808  *
13809  * Provides sane defaults for most configurations.
13810  *
13811  * Most additional limits are disabled except those with which specify a default in individual
13812  * field documentation. Note that this may result in barely-usable channels, but since they
13813  * are applied mostly only to incoming channels that's not much of a problem.
13814  */
13815 typedef struct MUST_USE_STRUCT LDKChannelHandshakeLimits {
13816    /**
13817     * A pointer to the opaque Rust object.
13818     * Nearly everywhere, inner must be non-null, however in places where
13819     * the Rust equivalent takes an Option, it may be set to null to indicate None.
13820     */
13821    LDKnativeChannelHandshakeLimits *inner;
13822    /**
13823     * Indicates that this is the only struct which contains the same pointer.
13824     * Rust functions which take ownership of an object provided via an argument require
13825     * this to be true and invalidate the object pointed to by inner.
13826     */
13827    bool is_owned;
13828 } LDKChannelHandshakeLimits;
13829
13830
13831
13832 /**
13833  * Top-level config which holds ChannelHandshakeLimits and ChannelConfig.
13834  *
13835  * Default::default() provides sane defaults for most configurations
13836  * (but currently with 0 relay fees!)
13837  */
13838 typedef struct MUST_USE_STRUCT LDKUserConfig {
13839    /**
13840     * A pointer to the opaque Rust object.
13841     * Nearly everywhere, inner must be non-null, however in places where
13842     * the Rust equivalent takes an Option, it may be set to null to indicate None.
13843     */
13844    LDKnativeUserConfig *inner;
13845    /**
13846     * Indicates that this is the only struct which contains the same pointer.
13847     * Rust functions which take ownership of an object provided via an argument require
13848     * this to be true and invalidate the object pointed to by inner.
13849     */
13850    bool is_owned;
13851 } LDKUserConfig;
13852
13853
13854
13855 /**
13856  * The best known block as identified by its hash and height.
13857  */
13858 typedef struct MUST_USE_STRUCT LDKBestBlock {
13859    /**
13860     * A pointer to the opaque Rust object.
13861     * Nearly everywhere, inner must be non-null, however in places where
13862     * the Rust equivalent takes an Option, it may be set to null to indicate None.
13863     */
13864    LDKnativeBestBlock *inner;
13865    /**
13866     * Indicates that this is the only struct which contains the same pointer.
13867     * Rust functions which take ownership of an object provided via an argument require
13868     * this to be true and invalidate the object pointed to by inner.
13869     */
13870    bool is_owned;
13871 } LDKBestBlock;
13872
13873 /**
13874  * The `Listen` trait is used to notify when blocks have been connected or disconnected from the
13875  * chain.
13876  *
13877  * Useful when needing to replay chain data upon startup or as new chain events occur. Clients
13878  * sourcing chain data using a block-oriented API should prefer this interface over [`Confirm`].
13879  * Such clients fetch the entire header chain whereas clients using [`Confirm`] only fetch headers
13880  * when needed.
13881  *
13882  * By using [`Listen::filtered_block_connected`] this interface supports clients fetching the
13883  * entire header chain and only blocks with matching transaction data using BIP 157 filters or
13884  * other similar filtering.
13885  */
13886 typedef struct LDKListen {
13887    /**
13888     * An opaque pointer which is passed to your function implementations as an argument.
13889     * This has no meaning in the LDK, and can be NULL or any other value.
13890     */
13891    void *this_arg;
13892    /**
13893     * Notifies the listener that a block was added at the given height, with the transaction data
13894     * possibly filtered.
13895     */
13896    void (*filtered_block_connected)(const void *this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height);
13897    /**
13898     * Notifies the listener that a block was added at the given height.
13899     */
13900    void (*block_connected)(const void *this_arg, struct LDKu8slice block, uint32_t height);
13901    /**
13902     * Notifies the listener that a block was removed at the given height.
13903     */
13904    void (*block_disconnected)(const void *this_arg, const uint8_t (*header)[80], uint32_t height);
13905    /**
13906     * Frees any resources associated with this object given its this_arg pointer.
13907     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
13908     */
13909    void (*free)(void *this_arg);
13910 } LDKListen;
13911
13912 /**
13913  * The `Confirm` trait is used to notify LDK when relevant transactions have been confirmed on
13914  * chain or unconfirmed during a chain reorganization.
13915  *
13916  * Clients sourcing chain data using a transaction-oriented API should prefer this interface over
13917  * [`Listen`]. For instance, an Electrum-based transaction sync implementation may implement
13918  * [`Filter`] to subscribe to relevant transactions and unspent outputs it should monitor for
13919  * on-chain activity. Then, it needs to notify LDK via this interface upon observing any changes
13920  * with reference to the confirmation status of the monitored objects.
13921  *
13922  * # Use
13923  * The intended use is as follows:
13924  * - Call [`transactions_confirmed`] to notify LDK whenever any of the registered transactions or
13925  *   outputs are, respectively, confirmed or spent on chain.
13926  * - Call [`transaction_unconfirmed`] to notify LDK whenever any transaction returned by
13927  *   [`get_relevant_txids`] is no longer confirmed in the block with the given block hash.
13928  * - Call [`best_block_updated`] to notify LDK whenever a new chain tip becomes available.
13929  *
13930  * # Order
13931  *
13932  * Clients must call these methods in chain order. Specifically:
13933  * - Transactions which are confirmed in a particular block must be given before transactions
13934  *   confirmed in a later block.
13935  * - Dependent transactions within the same block must be given in topological order, possibly in
13936  *   separate calls.
13937  * - All unconfirmed transactions must be given after the original confirmations and before *any*
13938  *   reconfirmations, i.e., [`transactions_confirmed`] and [`transaction_unconfirmed`] calls should
13939  *   never be interleaved, but always conduced *en bloc*.
13940  * - Any reconfirmed transactions need to be explicitly unconfirmed before they are reconfirmed
13941  *   in regard to the new block.
13942  *
13943  * See individual method documentation for further details.
13944  *
13945  * [`transactions_confirmed`]: Self::transactions_confirmed
13946  * [`transaction_unconfirmed`]: Self::transaction_unconfirmed
13947  * [`best_block_updated`]: Self::best_block_updated
13948  * [`get_relevant_txids`]: Self::get_relevant_txids
13949  */
13950 typedef struct LDKConfirm {
13951    /**
13952     * An opaque pointer which is passed to your function implementations as an argument.
13953     * This has no meaning in the LDK, and can be NULL or any other value.
13954     */
13955    void *this_arg;
13956    /**
13957     * Notifies LDK of transactions confirmed in a block with a given header and height.
13958     *
13959     * Must be called for any transactions registered by [`Filter::register_tx`] or any
13960     * transactions spending an output registered by [`Filter::register_output`]. Such transactions
13961     * appearing in the same block do not need to be included in the same call; instead, multiple
13962     * calls with additional transactions may be made so long as they are made in [chain order].
13963     *
13964     * May be called before or after [`best_block_updated`] for the corresponding block. However,
13965     * in the event of a chain reorganization, it must not be called with a `header` that is no
13966     * longer in the chain as of the last call to [`best_block_updated`].
13967     *
13968     * [chain order]: Confirm#order
13969     * [`best_block_updated`]: Self::best_block_updated
13970     */
13971    void (*transactions_confirmed)(const void *this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height);
13972    /**
13973     * Notifies LDK of a transaction that is no longer confirmed as result of a chain reorganization.
13974     *
13975     * Must be called for any transaction returned by [`get_relevant_txids`] if it has been
13976     * reorganized out of the best chain or if it is no longer confirmed in the block with the
13977     * given block hash. Once called, the given transaction will not be returned
13978     * by [`get_relevant_txids`], unless it has been reconfirmed via [`transactions_confirmed`].
13979     *
13980     * [`get_relevant_txids`]: Self::get_relevant_txids
13981     * [`transactions_confirmed`]: Self::transactions_confirmed
13982     */
13983    void (*transaction_unconfirmed)(const void *this_arg, const uint8_t (*txid)[32]);
13984    /**
13985     * Notifies LDK of an update to the best header connected at the given height.
13986     *
13987     * Must be called whenever a new chain tip becomes available. May be skipped for intermediary
13988     * blocks.
13989     */
13990    void (*best_block_updated)(const void *this_arg, const uint8_t (*header)[80], uint32_t height);
13991    /**
13992     * Returns transactions that must be monitored for reorganization out of the chain along
13993     * with the hash of the block as part of which it had been previously confirmed.
13994     *
13995     * Note that the returned `Option<BlockHash>` might be `None` for channels created with LDK
13996     * 0.0.112 and prior, in which case you need to manually track previous confirmations.
13997     *
13998     * Will include any transactions passed to [`transactions_confirmed`] that have insufficient
13999     * confirmations to be safe from a chain reorganization. Will not include any transactions
14000     * passed to [`transaction_unconfirmed`], unless later reconfirmed.
14001     *
14002     * Must be called to determine the subset of transactions that must be monitored for
14003     * reorganization. Will be idempotent between calls but may change as a result of calls to the
14004     * other interface methods. Thus, this is useful to determine which transactions must be
14005     * given to [`transaction_unconfirmed`].
14006     *
14007     * If any of the returned transactions are confirmed in a block other than the one with the
14008     * given hash, they need to be unconfirmed and reconfirmed via [`transaction_unconfirmed`] and
14009     * [`transactions_confirmed`], respectively.
14010     *
14011     * [`transactions_confirmed`]: Self::transactions_confirmed
14012     * [`transaction_unconfirmed`]: Self::transaction_unconfirmed
14013     */
14014    struct LDKCVec_C2Tuple_TxidBlockHashZZ (*get_relevant_txids)(const void *this_arg);
14015    /**
14016     * Frees any resources associated with this object given its this_arg pointer.
14017     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
14018     */
14019    void (*free)(void *this_arg);
14020 } LDKConfirm;
14021
14022 /**
14023  * `Persist` defines behavior for persisting channel monitors: this could mean
14024  * writing once to disk, and/or uploading to one or more backup services.
14025  *
14026  * Each method can return three possible values:
14027  *  * If persistence (including any relevant `fsync()` calls) happens immediately, the
14028  *    implementation should return [`ChannelMonitorUpdateStatus::Completed`], indicating normal
14029  *    channel operation should continue.
14030  *  * If persistence happens asynchronously, implementations should first ensure the
14031  *    [`ChannelMonitor`] or [`ChannelMonitorUpdate`] are written durably to disk, and then return
14032  *    [`ChannelMonitorUpdateStatus::InProgress`] while the update continues in the background.
14033  *    Once the update completes, [`ChainMonitor::channel_monitor_updated`] should be called with
14034  *    the corresponding [`MonitorUpdateId`].
14035  *
14036  *    Note that unlike the direct [`chain::Watch`] interface,
14037  *    [`ChainMonitor::channel_monitor_updated`] must be called once for *each* update which occurs.
14038  *
14039  *  * If persistence fails for some reason, implementations should return
14040  *    [`ChannelMonitorUpdateStatus::PermanentFailure`], in which case the channel will likely be
14041  *    closed without broadcasting the latest state. See
14042  *    [`ChannelMonitorUpdateStatus::PermanentFailure`] for more details.
14043  */
14044 typedef struct LDKPersist {
14045    /**
14046     * An opaque pointer which is passed to your function implementations as an argument.
14047     * This has no meaning in the LDK, and can be NULL or any other value.
14048     */
14049    void *this_arg;
14050    /**
14051     * Persist a new channel's data in response to a [`chain::Watch::watch_channel`] call. This is
14052     * called by [`ChannelManager`] for new channels, or may be called directly, e.g. on startup.
14053     *
14054     * The data can be stored any way you want, but the identifier provided by LDK is the
14055     * channel's outpoint (and it is up to you to maintain a correct mapping between the outpoint
14056     * and the stored channel data). Note that you **must** persist every new monitor to disk.
14057     *
14058     * The `update_id` is used to identify this call to [`ChainMonitor::channel_monitor_updated`],
14059     * if you return [`ChannelMonitorUpdateStatus::InProgress`].
14060     *
14061     * See [`Writeable::write`] on [`ChannelMonitor`] for writing out a `ChannelMonitor`
14062     * and [`ChannelMonitorUpdateStatus`] for requirements when returning errors.
14063     *
14064     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
14065     * [`Writeable::write`]: crate::util::ser::Writeable::write
14066     */
14067    enum LDKChannelMonitorUpdateStatus (*persist_new_channel)(const void *this_arg, struct LDKOutPoint channel_id, const struct LDKChannelMonitor *NONNULL_PTR data, struct LDKMonitorUpdateId update_id);
14068    /**
14069     * Update one channel's data. The provided [`ChannelMonitor`] has already applied the given
14070     * update.
14071     *
14072     * Note that on every update, you **must** persist either the [`ChannelMonitorUpdate`] or the
14073     * updated monitor itself to disk/backups. See the [`Persist`] trait documentation for more
14074     * details.
14075     *
14076     * During blockchain synchronization operations, this may be called with no
14077     * [`ChannelMonitorUpdate`], in which case the full [`ChannelMonitor`] needs to be persisted.
14078     * Note that after the full [`ChannelMonitor`] is persisted any previous
14079     * [`ChannelMonitorUpdate`]s which were persisted should be discarded - they can no longer be
14080     * applied to the persisted [`ChannelMonitor`] as they were already applied.
14081     *
14082     * If an implementer chooses to persist the updates only, they need to make
14083     * sure that all the updates are applied to the `ChannelMonitors` *before*
14084     * the set of channel monitors is given to the `ChannelManager`
14085     * deserialization routine. See [`ChannelMonitor::update_monitor`] for
14086     * applying a monitor update to a monitor. If full `ChannelMonitors` are
14087     * persisted, then there is no need to persist individual updates.
14088     *
14089     * Note that there could be a performance tradeoff between persisting complete
14090     * channel monitors on every update vs. persisting only updates and applying
14091     * them in batches. The size of each monitor grows `O(number of state updates)`
14092     * whereas updates are small and `O(1)`.
14093     *
14094     * The `update_id` is used to identify this call to [`ChainMonitor::channel_monitor_updated`],
14095     * if you return [`ChannelMonitorUpdateStatus::InProgress`].
14096     *
14097     * See [`Writeable::write`] on [`ChannelMonitor`] for writing out a `ChannelMonitor`,
14098     * [`Writeable::write`] on [`ChannelMonitorUpdate`] for writing out an update, and
14099     * [`ChannelMonitorUpdateStatus`] for requirements when returning errors.
14100     *
14101     * [`Writeable::write`]: crate::util::ser::Writeable::write
14102     *
14103     * Note that update (or a relevant inner pointer) may be NULL or all-0s to represent None
14104     */
14105    enum LDKChannelMonitorUpdateStatus (*update_persisted_channel)(const void *this_arg, struct LDKOutPoint channel_id, struct LDKChannelMonitorUpdate update, const struct LDKChannelMonitor *NONNULL_PTR data, struct LDKMonitorUpdateId update_id);
14106    /**
14107     * Frees any resources associated with this object given its this_arg pointer.
14108     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
14109     */
14110    void (*free)(void *this_arg);
14111 } LDKPersist;
14112
14113
14114
14115 /**
14116  * An implementation of [`chain::Watch`] for monitoring channels.
14117  *
14118  * Connected and disconnected blocks must be provided to `ChainMonitor` as documented by
14119  * [`chain::Watch`]. May be used in conjunction with [`ChannelManager`] to monitor channels locally
14120  * or used independently to monitor channels remotely. See the [module-level documentation] for
14121  * details.
14122  *
14123  * Note that `ChainMonitor` should regularly trigger rebroadcasts/fee bumps of pending claims from
14124  * a force-closed channel. This is crucial in preventing certain classes of pinning attacks,
14125  * detecting substantial mempool feerate changes between blocks, and ensuring reliability if
14126  * broadcasting fails. We recommend invoking this every 30 seconds, or lower if running in an
14127  * environment with spotty connections, like on mobile.
14128  *
14129  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
14130  * [module-level documentation]: crate::chain::chainmonitor
14131  * [`rebroadcast_pending_claims`]: Self::rebroadcast_pending_claims
14132  */
14133 typedef struct MUST_USE_STRUCT LDKChainMonitor {
14134    /**
14135     * A pointer to the opaque Rust object.
14136     * Nearly everywhere, inner must be non-null, however in places where
14137     * the Rust equivalent takes an Option, it may be set to null to indicate None.
14138     */
14139    LDKnativeChainMonitor *inner;
14140    /**
14141     * Indicates that this is the only struct which contains the same pointer.
14142     * Rust functions which take ownership of an object provided via an argument require
14143     * this to be true and invalidate the object pointed to by inner.
14144     */
14145    bool is_owned;
14146 } LDKChainMonitor;
14147
14148 /**
14149  * A trait implemented for objects handling events from [`EventsProvider`].
14150  *
14151  * An async variation also exists for implementations of [`EventsProvider`] that support async
14152  * event handling. The async event handler should satisfy the generic bounds: `F:
14153  * core::future::Future, H: Fn(Event) -> F`.
14154  */
14155 typedef struct LDKEventHandler {
14156    /**
14157     * An opaque pointer which is passed to your function implementations as an argument.
14158     * This has no meaning in the LDK, and can be NULL or any other value.
14159     */
14160    void *this_arg;
14161    /**
14162     * Handles the given [`Event`].
14163     *
14164     * See [`EventsProvider`] for details that must be considered when implementing this method.
14165     */
14166    void (*handle_event)(const void *this_arg, struct LDKEvent event);
14167    /**
14168     * Frees any resources associated with this object given its this_arg pointer.
14169     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
14170     */
14171    void (*free)(void *this_arg);
14172 } LDKEventHandler;
14173
14174 /**
14175  * A trait indicating an object may generate events.
14176  *
14177  * Events are processed by passing an [`EventHandler`] to [`process_pending_events`].
14178  *
14179  * Implementations of this trait may also feature an async version of event handling, as shown with
14180  * [`ChannelManager::process_pending_events_async`] and
14181  * [`ChainMonitor::process_pending_events_async`].
14182  *
14183  * # Requirements
14184  *
14185  * When using this trait, [`process_pending_events`] will call [`handle_event`] for each pending
14186  * event since the last invocation.
14187  *
14188  * In order to ensure no [`Event`]s are lost, implementors of this trait will persist [`Event`]s
14189  * and replay any unhandled events on startup. An [`Event`] is considered handled when
14190  * [`process_pending_events`] returns, thus handlers MUST fully handle [`Event`]s and persist any
14191  * relevant changes to disk *before* returning.
14192  *
14193  * Further, because an application may crash between an [`Event`] being handled and the
14194  * implementor of this trait being re-serialized, [`Event`] handling must be idempotent - in
14195  * effect, [`Event`]s may be replayed.
14196  *
14197  * Note, handlers may call back into the provider and thus deadlocking must be avoided. Be sure to
14198  * consult the provider's documentation on the implication of processing events and how a handler
14199  * may safely use the provider (e.g., see [`ChannelManager::process_pending_events`] and
14200  * [`ChainMonitor::process_pending_events`]).
14201  *
14202  * (C-not implementable) As there is likely no reason for a user to implement this trait on their
14203  * own type(s).
14204  *
14205  * [`process_pending_events`]: Self::process_pending_events
14206  * [`handle_event`]: EventHandler::handle_event
14207  * [`ChannelManager::process_pending_events`]: crate::ln::channelmanager::ChannelManager#method.process_pending_events
14208  * [`ChainMonitor::process_pending_events`]: crate::chain::chainmonitor::ChainMonitor#method.process_pending_events
14209  * [`ChannelManager::process_pending_events_async`]: crate::ln::channelmanager::ChannelManager::process_pending_events_async
14210  * [`ChainMonitor::process_pending_events_async`]: crate::chain::chainmonitor::ChainMonitor::process_pending_events_async
14211  */
14212 typedef struct LDKEventsProvider {
14213    /**
14214     * An opaque pointer which is passed to your function implementations as an argument.
14215     * This has no meaning in the LDK, and can be NULL or any other value.
14216     */
14217    void *this_arg;
14218    /**
14219     * Processes any events generated since the last call using the given event handler.
14220     *
14221     * See the trait-level documentation for requirements.
14222     */
14223    void (*process_pending_events)(const void *this_arg, struct LDKEventHandler handler);
14224    /**
14225     * Frees any resources associated with this object given its this_arg pointer.
14226     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
14227     */
14228    void (*free)(void *this_arg);
14229 } LDKEventsProvider;
14230
14231 /**
14232  * Represents a valid secp256k1 secret key serialized as a 32 byte array.
14233  */
14234 typedef struct LDKSecretKey {
14235    /**
14236     * The bytes of the secret key
14237     */
14238    uint8_t bytes[32];
14239 } LDKSecretKey;
14240
14241
14242
14243 /**
14244  * Simple implementation of [`EntropySource`], [`NodeSigner`], and [`SignerProvider`] that takes a
14245  * 32-byte seed for use as a BIP 32 extended key and derives keys from that.
14246  *
14247  * Your `node_id` is seed/0'.
14248  * Unilateral closes may use seed/1'.
14249  * Cooperative closes may use seed/2'.
14250  * The two close keys may be needed to claim on-chain funds!
14251  *
14252  * This struct cannot be used for nodes that wish to support receiving phantom payments;
14253  * [`PhantomKeysManager`] must be used instead.
14254  *
14255  * Note that switching between this struct and [`PhantomKeysManager`] will invalidate any
14256  * previously issued invoices and attempts to pay previous invoices will fail.
14257  */
14258 typedef struct MUST_USE_STRUCT LDKKeysManager {
14259    /**
14260     * A pointer to the opaque Rust object.
14261     * Nearly everywhere, inner must be non-null, however in places where
14262     * the Rust equivalent takes an Option, it may be set to null to indicate None.
14263     */
14264    LDKnativeKeysManager *inner;
14265    /**
14266     * Indicates that this is the only struct which contains the same pointer.
14267     * Rust functions which take ownership of an object provided via an argument require
14268     * this to be true and invalidate the object pointed to by inner.
14269     */
14270    bool is_owned;
14271 } LDKKeysManager;
14272
14273
14274
14275 /**
14276  * Similar to [`KeysManager`], but allows the node using this struct to receive phantom node
14277  * payments.
14278  *
14279  * A phantom node payment is a payment made to a phantom invoice, which is an invoice that can be
14280  * paid to one of multiple nodes. This works because we encode the invoice route hints such that
14281  * LDK will recognize an incoming payment as destined for a phantom node, and collect the payment
14282  * itself without ever needing to forward to this fake node.
14283  *
14284  * Phantom node payments are useful for load balancing between multiple LDK nodes. They also
14285  * provide some fault tolerance, because payers will automatically retry paying other provided
14286  * nodes in the case that one node goes down.
14287  *
14288  * Note that multi-path payments are not supported in phantom invoices for security reasons.
14289  * Switching between this struct and [`KeysManager`] will invalidate any previously issued
14290  * invoices and attempts to pay previous invoices will fail.
14291  */
14292 typedef struct MUST_USE_STRUCT LDKPhantomKeysManager {
14293    /**
14294     * A pointer to the opaque Rust object.
14295     * Nearly everywhere, inner must be non-null, however in places where
14296     * the Rust equivalent takes an Option, it may be set to null to indicate None.
14297     */
14298    LDKnativePhantomKeysManager *inner;
14299    /**
14300     * Indicates that this is the only struct which contains the same pointer.
14301     * Rust functions which take ownership of an object provided via an argument require
14302     * this to be true and invalidate the object pointed to by inner.
14303     */
14304    bool is_owned;
14305 } LDKPhantomKeysManager;
14306
14307
14308
14309 /**
14310  * Chain-related parameters used to construct a new `ChannelManager`.
14311  *
14312  * Typically, the block-specific parameters are derived from the best block hash for the network,
14313  * as a newly constructed `ChannelManager` will not have created any channels yet. These parameters
14314  * are not needed when deserializing a previously constructed `ChannelManager`.
14315  */
14316 typedef struct MUST_USE_STRUCT LDKChainParameters {
14317    /**
14318     * A pointer to the opaque Rust object.
14319     * Nearly everywhere, inner must be non-null, however in places where
14320     * the Rust equivalent takes an Option, it may be set to null to indicate None.
14321     */
14322    LDKnativeChainParameters *inner;
14323    /**
14324     * Indicates that this is the only struct which contains the same pointer.
14325     * Rust functions which take ownership of an object provided via an argument require
14326     * this to be true and invalidate the object pointed to by inner.
14327     */
14328    bool is_owned;
14329 } LDKChainParameters;
14330
14331 /**
14332  * Strategies available to retry payment path failures.
14333  */
14334 typedef enum LDKRetry_Tag {
14335    /**
14336     * Max number of attempts to retry payment.
14337     *
14338     * Each attempt may be multiple HTLCs along multiple paths if the router decides to split up a
14339     * retry, and may retry multiple failed HTLCs at once if they failed around the same time and
14340     * were retried along a route from a single call to [`Router::find_route_with_id`].
14341     */
14342    LDKRetry_Attempts,
14343    /**
14344     * Time elapsed before abandoning retries for a payment. At least one attempt at payment is made;
14345     * see [`PaymentParameters::expiry_time`] to avoid any attempt at payment after a specific time.
14346     *
14347     * [`PaymentParameters::expiry_time`]: crate::routing::router::PaymentParameters::expiry_time
14348     */
14349    LDKRetry_Timeout,
14350    /**
14351     * Must be last for serialization purposes
14352     */
14353    LDKRetry_Sentinel,
14354 } LDKRetry_Tag;
14355
14356 typedef struct MUST_USE_STRUCT LDKRetry {
14357    LDKRetry_Tag tag;
14358    union {
14359       struct {
14360          uintptr_t attempts;
14361       };
14362       struct {
14363          uint64_t timeout;
14364       };
14365    };
14366 } LDKRetry;
14367
14368 /**
14369  * A trait indicating an object may generate message send events
14370  */
14371 typedef struct LDKMessageSendEventsProvider {
14372    /**
14373     * An opaque pointer which is passed to your function implementations as an argument.
14374     * This has no meaning in the LDK, and can be NULL or any other value.
14375     */
14376    void *this_arg;
14377    /**
14378     * Gets the list of pending events which were generated by previous actions, clearing the list
14379     * in the process.
14380     */
14381    struct LDKCVec_MessageSendEventZ (*get_and_clear_pending_msg_events)(const void *this_arg);
14382    /**
14383     * Frees any resources associated with this object given its this_arg pointer.
14384     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
14385     */
14386    void (*free)(void *this_arg);
14387 } LDKMessageSendEventsProvider;
14388
14389 /**
14390  * A trait to describe an object which can receive channel messages.
14391  *
14392  * Messages MAY be called in parallel when they originate from different `their_node_ids`, however
14393  * they MUST NOT be called in parallel when the two calls have the same `their_node_id`.
14394  */
14395 typedef struct LDKChannelMessageHandler {
14396    /**
14397     * An opaque pointer which is passed to your function implementations as an argument.
14398     * This has no meaning in the LDK, and can be NULL or any other value.
14399     */
14400    void *this_arg;
14401    /**
14402     * Handle an incoming `open_channel` message from the given peer.
14403     */
14404    void (*handle_open_channel)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKOpenChannel *NONNULL_PTR msg);
14405    /**
14406     * Handle an incoming `accept_channel` message from the given peer.
14407     */
14408    void (*handle_accept_channel)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKAcceptChannel *NONNULL_PTR msg);
14409    /**
14410     * Handle an incoming `funding_created` message from the given peer.
14411     */
14412    void (*handle_funding_created)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingCreated *NONNULL_PTR msg);
14413    /**
14414     * Handle an incoming `funding_signed` message from the given peer.
14415     */
14416    void (*handle_funding_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingSigned *NONNULL_PTR msg);
14417    /**
14418     * Handle an incoming `channel_ready` message from the given peer.
14419     */
14420    void (*handle_channel_ready)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelReady *NONNULL_PTR msg);
14421    /**
14422     * Handle an incoming `shutdown` message from the given peer.
14423     */
14424    void (*handle_shutdown)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKShutdown *NONNULL_PTR msg);
14425    /**
14426     * Handle an incoming `closing_signed` message from the given peer.
14427     */
14428    void (*handle_closing_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKClosingSigned *NONNULL_PTR msg);
14429    /**
14430     * Handle an incoming `update_add_htlc` message from the given peer.
14431     */
14432    void (*handle_update_add_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateAddHTLC *NONNULL_PTR msg);
14433    /**
14434     * Handle an incoming `update_fulfill_htlc` message from the given peer.
14435     */
14436    void (*handle_update_fulfill_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFulfillHTLC *NONNULL_PTR msg);
14437    /**
14438     * Handle an incoming `update_fail_htlc` message from the given peer.
14439     */
14440    void (*handle_update_fail_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailHTLC *NONNULL_PTR msg);
14441    /**
14442     * Handle an incoming `update_fail_malformed_htlc` message from the given peer.
14443     */
14444    void (*handle_update_fail_malformed_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR msg);
14445    /**
14446     * Handle an incoming `commitment_signed` message from the given peer.
14447     */
14448    void (*handle_commitment_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKCommitmentSigned *NONNULL_PTR msg);
14449    /**
14450     * Handle an incoming `revoke_and_ack` message from the given peer.
14451     */
14452    void (*handle_revoke_and_ack)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKRevokeAndACK *NONNULL_PTR msg);
14453    /**
14454     * Handle an incoming `update_fee` message from the given peer.
14455     */
14456    void (*handle_update_fee)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFee *NONNULL_PTR msg);
14457    /**
14458     * Handle an incoming `announcement_signatures` message from the given peer.
14459     */
14460    void (*handle_announcement_signatures)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKAnnouncementSignatures *NONNULL_PTR msg);
14461    /**
14462     * Indicates a connection to the peer failed/an existing connection was lost.
14463     */
14464    void (*peer_disconnected)(const void *this_arg, struct LDKPublicKey their_node_id);
14465    /**
14466     * Handle a peer reconnecting, possibly generating `channel_reestablish` message(s).
14467     *
14468     * May return an `Err(())` if the features the peer supports are not sufficient to communicate
14469     * with us. Implementors should be somewhat conservative about doing so, however, as other
14470     * message handlers may still wish to communicate with this peer.
14471     */
14472    struct LDKCResult_NoneNoneZ (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR msg, bool inbound);
14473    /**
14474     * Handle an incoming `channel_reestablish` message from the given peer.
14475     */
14476    void (*handle_channel_reestablish)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelReestablish *NONNULL_PTR msg);
14477    /**
14478     * Handle an incoming `channel_update` message from the given peer.
14479     */
14480    void (*handle_channel_update)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelUpdate *NONNULL_PTR msg);
14481    /**
14482     * Handle an incoming `error` message from the given peer.
14483     */
14484    void (*handle_error)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKErrorMessage *NONNULL_PTR msg);
14485    /**
14486     * Gets the node feature flags which this handler itself supports. All available handlers are
14487     * queried similarly and their feature flags are OR'd together to form the [`NodeFeatures`]
14488     * which are broadcasted in our [`NodeAnnouncement`] message.
14489     */
14490    struct LDKNodeFeatures (*provided_node_features)(const void *this_arg);
14491    /**
14492     * Gets the init feature flags which should be sent to the given peer. All available handlers
14493     * are queried similarly and their feature flags are OR'd together to form the [`InitFeatures`]
14494     * which are sent in our [`Init`] message.
14495     *
14496     * Note that this method is called before [`Self::peer_connected`].
14497     */
14498    struct LDKInitFeatures (*provided_init_features)(const void *this_arg, struct LDKPublicKey their_node_id);
14499    /**
14500     * Implementation of MessageSendEventsProvider for this object.
14501     */
14502    struct LDKMessageSendEventsProvider MessageSendEventsProvider;
14503    /**
14504     * Frees any resources associated with this object given its this_arg pointer.
14505     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
14506     */
14507    void (*free)(void *this_arg);
14508 } LDKChannelMessageHandler;
14509
14510
14511
14512 /**
14513  * Arguments for the creation of a ChannelManager that are not deserialized.
14514  *
14515  * At a high-level, the process for deserializing a ChannelManager and resuming normal operation
14516  * is:
14517  * 1) Deserialize all stored [`ChannelMonitor`]s.
14518  * 2) Deserialize the [`ChannelManager`] by filling in this struct and calling:
14519  *    `<(BlockHash, ChannelManager)>::read(reader, args)`
14520  *    This may result in closing some channels if the [`ChannelMonitor`] is newer than the stored
14521  *    [`ChannelManager`] state to ensure no loss of funds. Thus, transactions may be broadcasted.
14522  * 3) If you are not fetching full blocks, register all relevant [`ChannelMonitor`] outpoints the
14523  *    same way you would handle a [`chain::Filter`] call using
14524  *    [`ChannelMonitor::get_outputs_to_watch`] and [`ChannelMonitor::get_funding_txo`].
14525  * 4) Reconnect blocks on your [`ChannelMonitor`]s.
14526  * 5) Disconnect/connect blocks on the [`ChannelManager`].
14527  * 6) Re-persist the [`ChannelMonitor`]s to ensure the latest state is on disk.
14528  *    Note that if you're using a [`ChainMonitor`] for your [`chain::Watch`] implementation, you
14529  *    will likely accomplish this as a side-effect of calling [`chain::Watch::watch_channel`] in
14530  *    the next step.
14531  * 7) Move the [`ChannelMonitor`]s into your local [`chain::Watch`]. If you're using a
14532  *    [`ChainMonitor`], this is done by calling [`chain::Watch::watch_channel`].
14533  *
14534  * Note that the ordering of #4-7 is not of importance, however all four must occur before you
14535  * call any other methods on the newly-deserialized [`ChannelManager`].
14536  *
14537  * Note that because some channels may be closed during deserialization, it is critical that you
14538  * always deserialize only the latest version of a ChannelManager and ChannelMonitors available to
14539  * you. If you deserialize an old ChannelManager (during which force-closure transactions may be
14540  * broadcast), and then later deserialize a newer version of the same ChannelManager (which will
14541  * not force-close the same channels but consider them live), you may end up revoking a state for
14542  * which you've already broadcasted the transaction.
14543  *
14544  * [`ChainMonitor`]: crate::chain::chainmonitor::ChainMonitor
14545  */
14546 typedef struct MUST_USE_STRUCT LDKChannelManagerReadArgs {
14547    /**
14548     * A pointer to the opaque Rust object.
14549     * Nearly everywhere, inner must be non-null, however in places where
14550     * the Rust equivalent takes an Option, it may be set to null to indicate None.
14551     */
14552    LDKnativeChannelManagerReadArgs *inner;
14553    /**
14554     * Indicates that this is the only struct which contains the same pointer.
14555     * Rust functions which take ownership of an object provided via an argument require
14556     * this to be true and invalidate the object pointed to by inner.
14557     */
14558    bool is_owned;
14559 } LDKChannelManagerReadArgs;
14560
14561
14562
14563 /**
14564  * A set of keys that were HKDF-expanded from an initial call to
14565  * [`NodeSigner::get_inbound_payment_key_material`].
14566  *
14567  * [`NodeSigner::get_inbound_payment_key_material`]: crate::chain::keysinterface::NodeSigner::get_inbound_payment_key_material
14568  */
14569 typedef struct MUST_USE_STRUCT LDKExpandedKey {
14570    /**
14571     * A pointer to the opaque Rust object.
14572     * Nearly everywhere, inner must be non-null, however in places where
14573     * the Rust equivalent takes an Option, it may be set to null to indicate None.
14574     */
14575    LDKnativeExpandedKey *inner;
14576    /**
14577     * Indicates that this is the only struct which contains the same pointer.
14578     * Rust functions which take ownership of an object provided via an argument require
14579     * this to be true and invalidate the object pointed to by inner.
14580     */
14581    bool is_owned;
14582 } LDKExpandedKey;
14583
14584
14585
14586 /**
14587  * Proof that the sender knows the per-commitment secret of the previous commitment transaction.
14588  *
14589  * This is used to convince the recipient that the channel is at a certain commitment
14590  * number even if they lost that data due to a local failure. Of course, the peer may lie
14591  * and even later commitments may have been revoked.
14592  */
14593 typedef struct MUST_USE_STRUCT LDKDataLossProtect {
14594    /**
14595     * A pointer to the opaque Rust object.
14596     * Nearly everywhere, inner must be non-null, however in places where
14597     * the Rust equivalent takes an Option, it may be set to null to indicate None.
14598     */
14599    LDKnativeDataLossProtect *inner;
14600    /**
14601     * Indicates that this is the only struct which contains the same pointer.
14602     * Rust functions which take ownership of an object provided via an argument require
14603     * this to be true and invalidate the object pointed to by inner.
14604     */
14605    bool is_owned;
14606 } LDKDataLossProtect;
14607
14608 /**
14609  * A 3-byte byte array.
14610  */
14611 typedef struct LDKThreeBytes {
14612    /**
14613     * The three bytes
14614     */
14615    uint8_t data[3];
14616 } LDKThreeBytes;
14617
14618 /**
14619  * A trait to describe an object which can receive routing messages.
14620  *
14621  * # Implementor DoS Warnings
14622  *
14623  * For messages enabled with the `gossip_queries` feature there are potential DoS vectors when
14624  * handling inbound queries. Implementors using an on-disk network graph should be aware of
14625  * repeated disk I/O for queries accessing different parts of the network graph.
14626  */
14627 typedef struct LDKRoutingMessageHandler {
14628    /**
14629     * An opaque pointer which is passed to your function implementations as an argument.
14630     * This has no meaning in the LDK, and can be NULL or any other value.
14631     */
14632    void *this_arg;
14633    /**
14634     * Handle an incoming `node_announcement` message, returning `true` if it should be forwarded on,
14635     * `false` or returning an `Err` otherwise.
14636     */
14637    struct LDKCResult_boolLightningErrorZ (*handle_node_announcement)(const void *this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
14638    /**
14639     * Handle a `channel_announcement` message, returning `true` if it should be forwarded on, `false`
14640     * or returning an `Err` otherwise.
14641     */
14642    struct LDKCResult_boolLightningErrorZ (*handle_channel_announcement)(const void *this_arg, const struct LDKChannelAnnouncement *NONNULL_PTR msg);
14643    /**
14644     * Handle an incoming `channel_update` message, returning true if it should be forwarded on,
14645     * `false` or returning an `Err` otherwise.
14646     */
14647    struct LDKCResult_boolLightningErrorZ (*handle_channel_update)(const void *this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
14648    /**
14649     * Gets channel announcements and updates required to dump our routing table to a remote node,
14650     * starting at the `short_channel_id` indicated by `starting_point` and including announcements
14651     * for a single channel.
14652     */
14653    struct LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ (*get_next_channel_announcement)(const void *this_arg, uint64_t starting_point);
14654    /**
14655     * Gets a node announcement required to dump our routing table to a remote node, starting at
14656     * the node *after* the provided pubkey and including up to one announcement immediately
14657     * higher (as defined by `<PublicKey as Ord>::cmp`) than `starting_point`.
14658     * If `None` is provided for `starting_point`, we start at the first node.
14659     *
14660     * Note that starting_point (or a relevant inner pointer) may be NULL or all-0s to represent None
14661     * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
14662     */
14663    struct LDKNodeAnnouncement (*get_next_node_announcement)(const void *this_arg, struct LDKNodeId starting_point);
14664    /**
14665     * Called when a connection is established with a peer. This can be used to
14666     * perform routing table synchronization using a strategy defined by the
14667     * implementor.
14668     *
14669     * May return an `Err(())` if the features the peer supports are not sufficient to communicate
14670     * with us. Implementors should be somewhat conservative about doing so, however, as other
14671     * message handlers may still wish to communicate with this peer.
14672     */
14673    struct LDKCResult_NoneNoneZ (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR init, bool inbound);
14674    /**
14675     * Handles the reply of a query we initiated to learn about channels
14676     * for a given range of blocks. We can expect to receive one or more
14677     * replies to a single query.
14678     */
14679    struct LDKCResult_NoneLightningErrorZ (*handle_reply_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyChannelRange msg);
14680    /**
14681     * Handles the reply of a query we initiated asking for routing gossip
14682     * messages for a list of channels. We should receive this message when
14683     * a node has completed its best effort to send us the pertaining routing
14684     * gossip messages.
14685     */
14686    struct LDKCResult_NoneLightningErrorZ (*handle_reply_short_channel_ids_end)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyShortChannelIdsEnd msg);
14687    /**
14688     * Handles when a peer asks us to send a list of `short_channel_id`s
14689     * for the requested range of blocks.
14690     */
14691    struct LDKCResult_NoneLightningErrorZ (*handle_query_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryChannelRange msg);
14692    /**
14693     * Handles when a peer asks us to send routing gossip messages for a
14694     * list of `short_channel_id`s.
14695     */
14696    struct LDKCResult_NoneLightningErrorZ (*handle_query_short_channel_ids)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryShortChannelIds msg);
14697    /**
14698     * Indicates that there are a large number of [`ChannelAnnouncement`] (or other) messages
14699     * pending some async action. While there is no guarantee of the rate of future messages, the
14700     * caller should seek to reduce the rate of new gossip messages handled, especially
14701     * [`ChannelAnnouncement`]s.
14702     */
14703    bool (*processing_queue_high)(const void *this_arg);
14704    /**
14705     * Gets the node feature flags which this handler itself supports. All available handlers are
14706     * queried similarly and their feature flags are OR'd together to form the [`NodeFeatures`]
14707     * which are broadcasted in our [`NodeAnnouncement`] message.
14708     */
14709    struct LDKNodeFeatures (*provided_node_features)(const void *this_arg);
14710    /**
14711     * Gets the init feature flags which should be sent to the given peer. All available handlers
14712     * are queried similarly and their feature flags are OR'd together to form the [`InitFeatures`]
14713     * which are sent in our [`Init`] message.
14714     *
14715     * Note that this method is called before [`Self::peer_connected`].
14716     */
14717    struct LDKInitFeatures (*provided_init_features)(const void *this_arg, struct LDKPublicKey their_node_id);
14718    /**
14719     * Implementation of MessageSendEventsProvider for this object.
14720     */
14721    struct LDKMessageSendEventsProvider MessageSendEventsProvider;
14722    /**
14723     * Frees any resources associated with this object given its this_arg pointer.
14724     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
14725     */
14726    void (*free)(void *this_arg);
14727 } LDKRoutingMessageHandler;
14728
14729 /**
14730  * A trait indicating an object may generate onion messages to send
14731  */
14732 typedef struct LDKOnionMessageProvider {
14733    /**
14734     * An opaque pointer which is passed to your function implementations as an argument.
14735     * This has no meaning in the LDK, and can be NULL or any other value.
14736     */
14737    void *this_arg;
14738    /**
14739     * Gets the next pending onion message for the peer with the given node id.
14740     *
14741     * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
14742     */
14743    struct LDKOnionMessage (*next_onion_message_for_peer)(const void *this_arg, struct LDKPublicKey peer_node_id);
14744    /**
14745     * Frees any resources associated with this object given its this_arg pointer.
14746     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
14747     */
14748    void (*free)(void *this_arg);
14749 } LDKOnionMessageProvider;
14750
14751 /**
14752  * A trait to describe an object that can receive onion messages.
14753  */
14754 typedef struct LDKOnionMessageHandler {
14755    /**
14756     * An opaque pointer which is passed to your function implementations as an argument.
14757     * This has no meaning in the LDK, and can be NULL or any other value.
14758     */
14759    void *this_arg;
14760    /**
14761     * Handle an incoming `onion_message` message from the given peer.
14762     */
14763    void (*handle_onion_message)(const void *this_arg, struct LDKPublicKey peer_node_id, const struct LDKOnionMessage *NONNULL_PTR msg);
14764    /**
14765     * Called when a connection is established with a peer. Can be used to track which peers
14766     * advertise onion message support and are online.
14767     *
14768     * May return an `Err(())` if the features the peer supports are not sufficient to communicate
14769     * with us. Implementors should be somewhat conservative about doing so, however, as other
14770     * message handlers may still wish to communicate with this peer.
14771     */
14772    struct LDKCResult_NoneNoneZ (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR init, bool inbound);
14773    /**
14774     * Indicates a connection to the peer failed/an existing connection was lost. Allows handlers to
14775     * drop and refuse to forward onion messages to this peer.
14776     */
14777    void (*peer_disconnected)(const void *this_arg, struct LDKPublicKey their_node_id);
14778    /**
14779     * Gets the node feature flags which this handler itself supports. All available handlers are
14780     * queried similarly and their feature flags are OR'd together to form the [`NodeFeatures`]
14781     * which are broadcasted in our [`NodeAnnouncement`] message.
14782     */
14783    struct LDKNodeFeatures (*provided_node_features)(const void *this_arg);
14784    /**
14785     * Gets the init feature flags which should be sent to the given peer. All available handlers
14786     * are queried similarly and their feature flags are OR'd together to form the [`InitFeatures`]
14787     * which are sent in our [`Init`] message.
14788     *
14789     * Note that this method is called before [`Self::peer_connected`].
14790     */
14791    struct LDKInitFeatures (*provided_init_features)(const void *this_arg, struct LDKPublicKey their_node_id);
14792    /**
14793     * Implementation of OnionMessageProvider for this object.
14794     */
14795    struct LDKOnionMessageProvider OnionMessageProvider;
14796    /**
14797     * Frees any resources associated with this object given its this_arg pointer.
14798     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
14799     */
14800    void (*free)(void *this_arg);
14801 } LDKOnionMessageHandler;
14802
14803 /**
14804  * Trait to be implemented by custom message (unrelated to the channel/gossip LN layers)
14805  * decoders.
14806  */
14807 typedef struct LDKCustomMessageReader {
14808    /**
14809     * An opaque pointer which is passed to your function implementations as an argument.
14810     * This has no meaning in the LDK, and can be NULL or any other value.
14811     */
14812    void *this_arg;
14813    /**
14814     * Decodes a custom message to `CustomMessageType`. If the given message type is known to the
14815     * implementation and the message could be decoded, must return `Ok(Some(message))`. If the
14816     * message type is unknown to the implementation, must return `Ok(None)`. If a decoding error
14817     * occur, must return `Err(DecodeError::X)` where `X` details the encountered error.
14818     */
14819    struct LDKCResult_COption_TypeZDecodeErrorZ (*read)(const void *this_arg, uint16_t message_type, struct LDKu8slice buffer);
14820    /**
14821     * Frees any resources associated with this object given its this_arg pointer.
14822     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
14823     */
14824    void (*free)(void *this_arg);
14825 } LDKCustomMessageReader;
14826
14827 /**
14828  * A handler provided to [`PeerManager`] for reading and handling custom messages.
14829  *
14830  * [BOLT 1] specifies a custom message type range for use with experimental or application-specific
14831  * messages. `CustomMessageHandler` allows for user-defined handling of such types. See the
14832  * [`lightning_custom_message`] crate for tools useful in composing more than one custom handler.
14833  *
14834  * [BOLT 1]: https://github.com/lightning/bolts/blob/master/01-messaging.md
14835  * [`lightning_custom_message`]: https://docs.rs/lightning_custom_message/latest/lightning_custom_message
14836  */
14837 typedef struct LDKCustomMessageHandler {
14838    /**
14839     * An opaque pointer which is passed to your function implementations as an argument.
14840     * This has no meaning in the LDK, and can be NULL or any other value.
14841     */
14842    void *this_arg;
14843    /**
14844     * Handles the given message sent from `sender_node_id`, possibly producing messages for
14845     * [`CustomMessageHandler::get_and_clear_pending_msg`] to return and thus for [`PeerManager`]
14846     * to send.
14847     */
14848    struct LDKCResult_NoneLightningErrorZ (*handle_custom_message)(const void *this_arg, struct LDKType msg, struct LDKPublicKey sender_node_id);
14849    /**
14850     * Returns the list of pending messages that were generated by the handler, clearing the list
14851     * in the process. Each message is paired with the node id of the intended recipient. If no
14852     * connection to the node exists, then the message is simply not sent.
14853     */
14854    struct LDKCVec_C2Tuple_PublicKeyTypeZZ (*get_and_clear_pending_msg)(const void *this_arg);
14855    /**
14856     * Implementation of CustomMessageReader for this object.
14857     */
14858    struct LDKCustomMessageReader CustomMessageReader;
14859    /**
14860     * Frees any resources associated with this object given its this_arg pointer.
14861     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
14862     */
14863    void (*free)(void *this_arg);
14864 } LDKCustomMessageHandler;
14865
14866
14867
14868 /**
14869  * A dummy struct which implements `RoutingMessageHandler` without storing any routing information
14870  * or doing any processing. You can provide one of these as the route_handler in a MessageHandler.
14871  */
14872 typedef struct MUST_USE_STRUCT LDKIgnoringMessageHandler {
14873    /**
14874     * A pointer to the opaque Rust object.
14875     * Nearly everywhere, inner must be non-null, however in places where
14876     * the Rust equivalent takes an Option, it may be set to null to indicate None.
14877     */
14878    LDKnativeIgnoringMessageHandler *inner;
14879    /**
14880     * Indicates that this is the only struct which contains the same pointer.
14881     * Rust functions which take ownership of an object provided via an argument require
14882     * this to be true and invalidate the object pointed to by inner.
14883     */
14884    bool is_owned;
14885 } LDKIgnoringMessageHandler;
14886
14887 /**
14888  * Handler for custom onion messages. If you are using [`SimpleArcOnionMessenger`],
14889  * [`SimpleRefOnionMessenger`], or prefer to ignore inbound custom onion messages,
14890  * [`IgnoringMessageHandler`] must be provided to [`OnionMessenger::new`]. Otherwise, a custom
14891  * implementation of this trait must be provided, with [`CustomMessage`] specifying the supported
14892  * message types.
14893  *
14894  * See [`OnionMessenger`] for example usage.
14895  *
14896  * [`IgnoringMessageHandler`]: crate::ln::peer_handler::IgnoringMessageHandler
14897  * [`CustomMessage`]: Self::CustomMessage
14898  */
14899 typedef struct LDKCustomOnionMessageHandler {
14900    /**
14901     * An opaque pointer which is passed to your function implementations as an argument.
14902     * This has no meaning in the LDK, and can be NULL or any other value.
14903     */
14904    void *this_arg;
14905    /**
14906     * Called with the custom message that was received.
14907     */
14908    void (*handle_custom_message)(const void *this_arg, struct LDKCustomOnionMessageContents msg);
14909    /**
14910     * Read a custom message of type `message_type` from `buffer`, returning `Ok(None)` if the
14911     * message type is unknown.
14912     */
14913    struct LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ (*read_custom_message)(const void *this_arg, uint64_t message_type, struct LDKu8slice buffer);
14914    /**
14915     * Frees any resources associated with this object given its this_arg pointer.
14916     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
14917     */
14918    void (*free)(void *this_arg);
14919 } LDKCustomOnionMessageHandler;
14920
14921
14922
14923 /**
14924  * A dummy struct which implements `ChannelMessageHandler` without having any channels.
14925  * You can provide one of these as the route_handler in a MessageHandler.
14926  */
14927 typedef struct MUST_USE_STRUCT LDKErroringMessageHandler {
14928    /**
14929     * A pointer to the opaque Rust object.
14930     * Nearly everywhere, inner must be non-null, however in places where
14931     * the Rust equivalent takes an Option, it may be set to null to indicate None.
14932     */
14933    LDKnativeErroringMessageHandler *inner;
14934    /**
14935     * Indicates that this is the only struct which contains the same pointer.
14936     * Rust functions which take ownership of an object provided via an argument require
14937     * this to be true and invalidate the object pointed to by inner.
14938     */
14939    bool is_owned;
14940 } LDKErroringMessageHandler;
14941
14942
14943
14944 /**
14945  * Provides references to trait impls which handle different types of messages.
14946  */
14947 typedef struct MUST_USE_STRUCT LDKMessageHandler {
14948    /**
14949     * A pointer to the opaque Rust object.
14950     * Nearly everywhere, inner must be non-null, however in places where
14951     * the Rust equivalent takes an Option, it may be set to null to indicate None.
14952     */
14953    LDKnativeMessageHandler *inner;
14954    /**
14955     * Indicates that this is the only struct which contains the same pointer.
14956     * Rust functions which take ownership of an object provided via an argument require
14957     * this to be true and invalidate the object pointed to by inner.
14958     */
14959    bool is_owned;
14960 } LDKMessageHandler;
14961
14962 /**
14963  * Provides an object which can be used to send data to and which uniquely identifies a connection
14964  * to a remote host. You will need to be able to generate multiple of these which meet Eq and
14965  * implement Hash to meet the PeerManager API.
14966  *
14967  * For efficiency, [`Clone`] should be relatively cheap for this type.
14968  *
14969  * Two descriptors may compare equal (by [`cmp::Eq`] and [`hash::Hash`]) as long as the original
14970  * has been disconnected, the [`PeerManager`] has been informed of the disconnection (either by it
14971  * having triggered the disconnection or a call to [`PeerManager::socket_disconnected`]), and no
14972  * further calls to the [`PeerManager`] related to the original socket occur. This allows you to
14973  * use a file descriptor for your SocketDescriptor directly, however for simplicity you may wish
14974  * to simply use another value which is guaranteed to be globally unique instead.
14975  */
14976 typedef struct LDKSocketDescriptor {
14977    /**
14978     * An opaque pointer which is passed to your function implementations as an argument.
14979     * This has no meaning in the LDK, and can be NULL or any other value.
14980     */
14981    void *this_arg;
14982    /**
14983     * Attempts to send some data from the given slice to the peer.
14984     *
14985     * Returns the amount of data which was sent, possibly 0 if the socket has since disconnected.
14986     * Note that in the disconnected case, [`PeerManager::socket_disconnected`] must still be
14987     * called and further write attempts may occur until that time.
14988     *
14989     * If the returned size is smaller than `data.len()`, a
14990     * [`PeerManager::write_buffer_space_avail`] call must be made the next time more data can be
14991     * written. Additionally, until a `send_data` event completes fully, no further
14992     * [`PeerManager::read_event`] calls should be made for the same peer! Because this is to
14993     * prevent denial-of-service issues, you should not read or buffer any data from the socket
14994     * until then.
14995     *
14996     * If a [`PeerManager::read_event`] call on this descriptor had previously returned true
14997     * (indicating that read events should be paused to prevent DoS in the send buffer),
14998     * `resume_read` may be set indicating that read events on this descriptor should resume. A
14999     * `resume_read` of false carries no meaning, and should not cause any action.
15000     */
15001    uintptr_t (*send_data)(void *this_arg, struct LDKu8slice data, bool resume_read);
15002    /**
15003     * Disconnect the socket pointed to by this SocketDescriptor.
15004     *
15005     * You do *not* need to call [`PeerManager::socket_disconnected`] with this socket after this
15006     * call (doing so is a noop).
15007     */
15008    void (*disconnect_socket)(void *this_arg);
15009    /**
15010     * Checks if two objects are equal given this object's this_arg pointer and another object.
15011     */
15012    bool (*eq)(const void *this_arg, const struct LDKSocketDescriptor *NONNULL_PTR other_arg);
15013    /**
15014     * Calculate a succinct non-cryptographic hash for an object given its this_arg pointer.
15015     * This is used, for example, for inclusion of this object in a hash map.
15016     */
15017    uint64_t (*hash)(const void *this_arg);
15018    /**
15019     * Called, if set, after this SocketDescriptor has been cloned into a duplicate object.
15020     * The new SocketDescriptor is provided, and should be mutated as needed to perform a
15021     * deep copy of the object pointed to by this_arg or avoid any double-freeing.
15022     */
15023    void (*cloned)(struct LDKSocketDescriptor *NONNULL_PTR new_SocketDescriptor);
15024    /**
15025     * Frees any resources associated with this object given its this_arg pointer.
15026     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
15027     */
15028    void (*free)(void *this_arg);
15029 } LDKSocketDescriptor;
15030
15031
15032
15033 /**
15034  * A PeerManager manages a set of peers, described by their [`SocketDescriptor`] and marshalls
15035  * socket events into messages which it passes on to its [`MessageHandler`].
15036  *
15037  * Locks are taken internally, so you must never assume that reentrancy from a
15038  * [`SocketDescriptor`] call back into [`PeerManager`] methods will not deadlock.
15039  *
15040  * Calls to [`read_event`] will decode relevant messages and pass them to the
15041  * [`ChannelMessageHandler`], likely doing message processing in-line. Thus, the primary form of
15042  * parallelism in Rust-Lightning is in calls to [`read_event`]. Note, however, that calls to any
15043  * [`PeerManager`] functions related to the same connection must occur only in serial, making new
15044  * calls only after previous ones have returned.
15045  *
15046  * Rather than using a plain [`PeerManager`], it is preferable to use either a [`SimpleArcPeerManager`]
15047  * a [`SimpleRefPeerManager`], for conciseness. See their documentation for more details, but
15048  * essentially you should default to using a [`SimpleRefPeerManager`], and use a
15049  * [`SimpleArcPeerManager`] when you require a `PeerManager` with a static lifetime, such as when
15050  * you're using lightning-net-tokio.
15051  *
15052  * [`read_event`]: PeerManager::read_event
15053  */
15054 typedef struct MUST_USE_STRUCT LDKPeerManager {
15055    /**
15056     * A pointer to the opaque Rust object.
15057     * Nearly everywhere, inner must be non-null, however in places where
15058     * the Rust equivalent takes an Option, it may be set to null to indicate None.
15059     */
15060    LDKnativePeerManager *inner;
15061    /**
15062     * Indicates that this is the only struct which contains the same pointer.
15063     * Rust functions which take ownership of an object provided via an argument require
15064     * this to be true and invalidate the object pointed to by inner.
15065     */
15066    bool is_owned;
15067 } LDKPeerManager;
15068
15069
15070
15071 /**
15072  * Static channel fields used to build transactions given per-commitment fields, organized by
15073  * broadcaster/countersignatory.
15074  *
15075  * This is derived from the holder/counterparty-organized ChannelTransactionParameters via the
15076  * as_holder_broadcastable and as_counterparty_broadcastable functions.
15077  */
15078 typedef struct MUST_USE_STRUCT LDKDirectedChannelTransactionParameters {
15079    /**
15080     * A pointer to the opaque Rust object.
15081     * Nearly everywhere, inner must be non-null, however in places where
15082     * the Rust equivalent takes an Option, it may be set to null to indicate None.
15083     */
15084    LDKnativeDirectedChannelTransactionParameters *inner;
15085    /**
15086     * Indicates that this is the only struct which contains the same pointer.
15087     * Rust functions which take ownership of an object provided via an argument require
15088     * this to be true and invalidate the object pointed to by inner.
15089     */
15090    bool is_owned;
15091 } LDKDirectedChannelTransactionParameters;
15092
15093
15094
15095 /**
15096  * Features used within an `offer`.
15097  */
15098 typedef struct MUST_USE_STRUCT LDKOfferFeatures {
15099    /**
15100     * A pointer to the opaque Rust object.
15101     * Nearly everywhere, inner must be non-null, however in places where
15102     * the Rust equivalent takes an Option, it may be set to null to indicate None.
15103     */
15104    LDKnativeOfferFeatures *inner;
15105    /**
15106     * Indicates that this is the only struct which contains the same pointer.
15107     * Rust functions which take ownership of an object provided via an argument require
15108     * this to be true and invalidate the object pointed to by inner.
15109     */
15110    bool is_owned;
15111 } LDKOfferFeatures;
15112
15113
15114
15115 /**
15116  * Features used within an `invoice_request`.
15117  */
15118 typedef struct MUST_USE_STRUCT LDKInvoiceRequestFeatures {
15119    /**
15120     * A pointer to the opaque Rust object.
15121     * Nearly everywhere, inner must be non-null, however in places where
15122     * the Rust equivalent takes an Option, it may be set to null to indicate None.
15123     */
15124    LDKnativeInvoiceRequestFeatures *inner;
15125    /**
15126     * Indicates that this is the only struct which contains the same pointer.
15127     * Rust functions which take ownership of an object provided via an argument require
15128     * this to be true and invalidate the object pointed to by inner.
15129     */
15130    bool is_owned;
15131 } LDKInvoiceRequestFeatures;
15132
15133
15134
15135 /**
15136  * Features used within an `invoice`.
15137  */
15138 typedef struct MUST_USE_STRUCT LDKBolt12InvoiceFeatures {
15139    /**
15140     * A pointer to the opaque Rust object.
15141     * Nearly everywhere, inner must be non-null, however in places where
15142     * the Rust equivalent takes an Option, it may be set to null to indicate None.
15143     */
15144    LDKnativeBolt12InvoiceFeatures *inner;
15145    /**
15146     * Indicates that this is the only struct which contains the same pointer.
15147     * Rust functions which take ownership of an object provided via an argument require
15148     * this to be true and invalidate the object pointed to by inner.
15149     */
15150    bool is_owned;
15151 } LDKBolt12InvoiceFeatures;
15152
15153 /**
15154  * Integer in the range `0..=16`
15155  */
15156 typedef struct LDKWitnessVersion {
15157    uint8_t _0;
15158 } LDKWitnessVersion;
15159
15160
15161
15162 /**
15163  * A semantically valid [`Invoice`] that hasn't been signed.
15164  */
15165 typedef struct MUST_USE_STRUCT LDKUnsignedInvoice {
15166    /**
15167     * A pointer to the opaque Rust object.
15168     * Nearly everywhere, inner must be non-null, however in places where
15169     * the Rust equivalent takes an Option, it may be set to null to indicate None.
15170     */
15171    LDKnativeUnsignedInvoice *inner;
15172    /**
15173     * Indicates that this is the only struct which contains the same pointer.
15174     * Rust functions which take ownership of an object provided via an argument require
15175     * this to be true and invalidate the object pointed to by inner.
15176     */
15177    bool is_owned;
15178 } LDKUnsignedInvoice;
15179
15180
15181
15182 /**
15183  * A semantically valid [`InvoiceRequest`] that hasn't been signed.
15184  */
15185 typedef struct MUST_USE_STRUCT LDKUnsignedInvoiceRequest {
15186    /**
15187     * A pointer to the opaque Rust object.
15188     * Nearly everywhere, inner must be non-null, however in places where
15189     * the Rust equivalent takes an Option, it may be set to null to indicate None.
15190     */
15191    LDKnativeUnsignedInvoiceRequest *inner;
15192    /**
15193     * Indicates that this is the only struct which contains the same pointer.
15194     * Rust functions which take ownership of an object provided via an argument require
15195     * this to be true and invalidate the object pointed to by inner.
15196     */
15197    bool is_owned;
15198 } LDKUnsignedInvoiceRequest;
15199
15200
15201
15202 /**
15203  * An `InvoiceRequest` is a request for an [`Invoice`] formulated from an [`Offer`].
15204  *
15205  * An offer may provide choices such as quantity, amount, chain, features, etc. An invoice request
15206  * specifies these such that its recipient can send an invoice for payment.
15207  *
15208  * [`Invoice`]: crate::offers::invoice::Invoice
15209  * [`Offer`]: crate::offers::offer::Offer
15210  */
15211 typedef struct MUST_USE_STRUCT LDKInvoiceRequest {
15212    /**
15213     * A pointer to the opaque Rust object.
15214     * Nearly everywhere, inner must be non-null, however in places where
15215     * the Rust equivalent takes an Option, it may be set to null to indicate None.
15216     */
15217    LDKnativeInvoiceRequest *inner;
15218    /**
15219     * Indicates that this is the only struct which contains the same pointer.
15220     * Rust functions which take ownership of an object provided via an argument require
15221     * this to be true and invalidate the object pointed to by inner.
15222     */
15223    bool is_owned;
15224 } LDKInvoiceRequest;
15225
15226
15227
15228 /**
15229  * An `Offer` is a potentially long-lived proposal for payment of a good or service.
15230  *
15231  * An offer is a precursor to an [`InvoiceRequest`]. A merchant publishes an offer from which a
15232  * customer may request an [`Invoice`] for a specific quantity and using an amount sufficient to
15233  * cover that quantity (i.e., at least `quantity * amount`). See [`Offer::amount`].
15234  *
15235  * Offers may be denominated in currency other than bitcoin but are ultimately paid using the
15236  * latter.
15237  *
15238  * Through the use of [`BlindedPath`]s, offers provide recipient privacy.
15239  *
15240  * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
15241  * [`Invoice`]: crate::offers::invoice::Invoice
15242  */
15243 typedef struct MUST_USE_STRUCT LDKOffer {
15244    /**
15245     * A pointer to the opaque Rust object.
15246     * Nearly everywhere, inner must be non-null, however in places where
15247     * the Rust equivalent takes an Option, it may be set to null to indicate None.
15248     */
15249    LDKnativeOffer *inner;
15250    /**
15251     * Indicates that this is the only struct which contains the same pointer.
15252     * Rust functions which take ownership of an object provided via an argument require
15253     * this to be true and invalidate the object pointed to by inner.
15254     */
15255    bool is_owned;
15256 } LDKOffer;
15257
15258
15259
15260 /**
15261  * The minimum amount required for an item in an [`Offer`], denominated in either bitcoin or
15262  * another currency.
15263  */
15264 typedef struct MUST_USE_STRUCT LDKAmount {
15265    /**
15266     * A pointer to the opaque Rust object.
15267     * Nearly everywhere, inner must be non-null, however in places where
15268     * the Rust equivalent takes an Option, it may be set to null to indicate None.
15269     */
15270    LDKnativeAmount *inner;
15271    /**
15272     * Indicates that this is the only struct which contains the same pointer.
15273     * Rust functions which take ownership of an object provided via an argument require
15274     * this to be true and invalidate the object pointed to by inner.
15275     */
15276    bool is_owned;
15277 } LDKAmount;
15278
15279
15280
15281 /**
15282  * Quantity of items supported by an [`Offer`].
15283  */
15284 typedef struct MUST_USE_STRUCT LDKQuantity {
15285    /**
15286     * A pointer to the opaque Rust object.
15287     * Nearly everywhere, inner must be non-null, however in places where
15288     * the Rust equivalent takes an Option, it may be set to null to indicate None.
15289     */
15290    LDKnativeQuantity *inner;
15291    /**
15292     * Indicates that this is the only struct which contains the same pointer.
15293     * Rust functions which take ownership of an object provided via an argument require
15294     * this to be true and invalidate the object pointed to by inner.
15295     */
15296    bool is_owned;
15297 } LDKQuantity;
15298
15299
15300
15301 /**
15302  * A `Refund` is a request to send an [`Invoice`] without a preceding [`Offer`].
15303  *
15304  * Typically, after an invoice is paid, the recipient may publish a refund allowing the sender to
15305  * recoup their funds. A refund may be used more generally as an \"offer for money\", such as with a
15306  * bitcoin ATM.
15307  *
15308  * [`Invoice`]: crate::offers::invoice::Invoice
15309  * [`Offer`]: crate::offers::offer::Offer
15310  */
15311 typedef struct MUST_USE_STRUCT LDKRefund {
15312    /**
15313     * A pointer to the opaque Rust object.
15314     * Nearly everywhere, inner must be non-null, however in places where
15315     * the Rust equivalent takes an Option, it may be set to null to indicate None.
15316     */
15317    LDKnativeRefund *inner;
15318    /**
15319     * Indicates that this is the only struct which contains the same pointer.
15320     * Rust functions which take ownership of an object provided via an argument require
15321     * this to be true and invalidate the object pointed to by inner.
15322     */
15323    bool is_owned;
15324 } LDKRefund;
15325
15326
15327
15328 /**
15329  * Receives and validates network updates from peers,
15330  * stores authentic and relevant data as a network graph.
15331  * This network graph is then used for routing payments.
15332  * Provides interface to help with initial routing sync by
15333  * serving historical announcements.
15334  */
15335 typedef struct MUST_USE_STRUCT LDKP2PGossipSync {
15336    /**
15337     * A pointer to the opaque Rust object.
15338     * Nearly everywhere, inner must be non-null, however in places where
15339     * the Rust equivalent takes an Option, it may be set to null to indicate None.
15340     */
15341    LDKnativeP2PGossipSync *inner;
15342    /**
15343     * Indicates that this is the only struct which contains the same pointer.
15344     * Rust functions which take ownership of an object provided via an argument require
15345     * this to be true and invalidate the object pointed to by inner.
15346     */
15347    bool is_owned;
15348 } LDKP2PGossipSync;
15349
15350
15351
15352 /**
15353  * A read-only view of [`NetworkGraph`].
15354  */
15355 typedef struct MUST_USE_STRUCT LDKReadOnlyNetworkGraph {
15356    /**
15357     * A pointer to the opaque Rust object.
15358     * Nearly everywhere, inner must be non-null, however in places where
15359     * the Rust equivalent takes an Option, it may be set to null to indicate None.
15360     */
15361    LDKnativeReadOnlyNetworkGraph *inner;
15362    /**
15363     * Indicates that this is the only struct which contains the same pointer.
15364     * Rust functions which take ownership of an object provided via an argument require
15365     * this to be true and invalidate the object pointed to by inner.
15366     */
15367    bool is_owned;
15368 } LDKReadOnlyNetworkGraph;
15369
15370
15371
15372 /**
15373  * A wrapper around [`ChannelInfo`] representing information about the channel as directed from a
15374  * source node to a target node.
15375  */
15376 typedef struct MUST_USE_STRUCT LDKDirectedChannelInfo {
15377    /**
15378     * A pointer to the opaque Rust object.
15379     * Nearly everywhere, inner must be non-null, however in places where
15380     * the Rust equivalent takes an Option, it may be set to null to indicate None.
15381     */
15382    LDKnativeDirectedChannelInfo *inner;
15383    /**
15384     * Indicates that this is the only struct which contains the same pointer.
15385     * Rust functions which take ownership of an object provided via an argument require
15386     * this to be true and invalidate the object pointed to by inner.
15387     */
15388    bool is_owned;
15389 } LDKDirectedChannelInfo;
15390
15391 /**
15392  * The effective capacity of a channel for routing purposes.
15393  *
15394  * While this may be smaller than the actual channel capacity, amounts greater than
15395  * [`Self::as_msat`] should not be routed through the channel.
15396  */
15397 typedef enum LDKEffectiveCapacity_Tag {
15398    /**
15399     * The available liquidity in the channel known from being a channel counterparty, and thus a
15400     * direct hop.
15401     */
15402    LDKEffectiveCapacity_ExactLiquidity,
15403    /**
15404     * The maximum HTLC amount in one direction as advertised on the gossip network.
15405     */
15406    LDKEffectiveCapacity_MaximumHTLC,
15407    /**
15408     * The total capacity of the channel as determined by the funding transaction.
15409     */
15410    LDKEffectiveCapacity_Total,
15411    /**
15412     * A capacity sufficient to route any payment, typically used for private channels provided by
15413     * an invoice.
15414     */
15415    LDKEffectiveCapacity_Infinite,
15416    /**
15417     * A capacity that is unknown possibly because either the chain state is unavailable to know
15418     * the total capacity or the `htlc_maximum_msat` was not advertised on the gossip network.
15419     */
15420    LDKEffectiveCapacity_Unknown,
15421    /**
15422     * Must be last for serialization purposes
15423     */
15424    LDKEffectiveCapacity_Sentinel,
15425 } LDKEffectiveCapacity_Tag;
15426
15427 typedef struct LDKEffectiveCapacity_LDKExactLiquidity_Body {
15428    /**
15429     * Either the inbound or outbound liquidity depending on the direction, denominated in
15430     * millisatoshi.
15431     */
15432    uint64_t liquidity_msat;
15433 } LDKEffectiveCapacity_LDKExactLiquidity_Body;
15434
15435 typedef struct LDKEffectiveCapacity_LDKMaximumHTLC_Body {
15436    /**
15437     * The maximum HTLC amount denominated in millisatoshi.
15438     */
15439    uint64_t amount_msat;
15440 } LDKEffectiveCapacity_LDKMaximumHTLC_Body;
15441
15442 typedef struct LDKEffectiveCapacity_LDKTotal_Body {
15443    /**
15444     * The funding amount denominated in millisatoshi.
15445     */
15446    uint64_t capacity_msat;
15447    /**
15448     * The maximum HTLC amount denominated in millisatoshi.
15449     */
15450    uint64_t htlc_maximum_msat;
15451 } LDKEffectiveCapacity_LDKTotal_Body;
15452
15453 typedef struct MUST_USE_STRUCT LDKEffectiveCapacity {
15454    LDKEffectiveCapacity_Tag tag;
15455    union {
15456       LDKEffectiveCapacity_LDKExactLiquidity_Body exact_liquidity;
15457       LDKEffectiveCapacity_LDKMaximumHTLC_Body maximum_htlc;
15458       LDKEffectiveCapacity_LDKTotal_Body total;
15459    };
15460 } LDKEffectiveCapacity;
15461
15462
15463
15464 /**
15465  * A [`Router`] implemented using [`find_route`].
15466  */
15467 typedef struct MUST_USE_STRUCT LDKDefaultRouter {
15468    /**
15469     * A pointer to the opaque Rust object.
15470     * Nearly everywhere, inner must be non-null, however in places where
15471     * the Rust equivalent takes an Option, it may be set to null to indicate None.
15472     */
15473    LDKnativeDefaultRouter *inner;
15474    /**
15475     * Indicates that this is the only struct which contains the same pointer.
15476     * Rust functions which take ownership of an object provided via an argument require
15477     * this to be true and invalidate the object pointed to by inner.
15478     */
15479    bool is_owned;
15480 } LDKDefaultRouter;
15481
15482
15483
15484 /**
15485  * [`Score`] implementation that factors in in-flight HTLC liquidity.
15486  *
15487  * Useful for custom [`Router`] implementations to wrap their [`Score`] on-the-fly when calling
15488  * [`find_route`].
15489  *
15490  * [`Score`]: crate::routing::scoring::Score
15491  */
15492 typedef struct MUST_USE_STRUCT LDKScorerAccountingForInFlightHtlcs {
15493    /**
15494     * A pointer to the opaque Rust object.
15495     * Nearly everywhere, inner must be non-null, however in places where
15496     * the Rust equivalent takes an Option, it may be set to null to indicate None.
15497     */
15498    LDKnativeScorerAccountingForInFlightHtlcs *inner;
15499    /**
15500     * Indicates that this is the only struct which contains the same pointer.
15501     * Rust functions which take ownership of an object provided via an argument require
15502     * this to be true and invalidate the object pointed to by inner.
15503     */
15504    bool is_owned;
15505 } LDKScorerAccountingForInFlightHtlcs;
15506
15507 /**
15508  * Routing hints for the tail of the route.
15509  */
15510 typedef enum LDKHints_Tag {
15511    /**
15512     * The recipient provided blinded paths and payinfo to reach them. The blinded paths themselves
15513     * will be included in the final [`Route`].
15514     */
15515    LDKHints_Blinded,
15516    /**
15517     * The recipient included these route hints in their BOLT11 invoice.
15518     */
15519    LDKHints_Clear,
15520    /**
15521     * Must be last for serialization purposes
15522     */
15523    LDKHints_Sentinel,
15524 } LDKHints_Tag;
15525
15526 typedef struct MUST_USE_STRUCT LDKHints {
15527    LDKHints_Tag tag;
15528    union {
15529       struct {
15530          struct LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ blinded;
15531       };
15532       struct {
15533          struct LDKCVec_RouteHintZ clear;
15534       };
15535    };
15536 } LDKHints;
15537
15538
15539
15540 /**
15541  * A concrete implementation of [`LockableScore`] which supports multi-threading.
15542  */
15543 typedef struct MUST_USE_STRUCT LDKMultiThreadedLockableScore {
15544    /**
15545     * A pointer to the opaque Rust object.
15546     * Nearly everywhere, inner must be non-null, however in places where
15547     * the Rust equivalent takes an Option, it may be set to null to indicate None.
15548     */
15549    LDKnativeMultiThreadedLockableScore *inner;
15550    /**
15551     * Indicates that this is the only struct which contains the same pointer.
15552     * Rust functions which take ownership of an object provided via an argument require
15553     * this to be true and invalidate the object pointed to by inner.
15554     */
15555    bool is_owned;
15556 } LDKMultiThreadedLockableScore;
15557
15558
15559
15560 /**
15561  * A locked `MultiThreadedLockableScore`.
15562  */
15563 typedef struct MUST_USE_STRUCT LDKMultiThreadedScoreLock {
15564    /**
15565     * A pointer to the opaque Rust object.
15566     * Nearly everywhere, inner must be non-null, however in places where
15567     * the Rust equivalent takes an Option, it may be set to null to indicate None.
15568     */
15569    LDKnativeMultiThreadedScoreLock *inner;
15570    /**
15571     * Indicates that this is the only struct which contains the same pointer.
15572     * Rust functions which take ownership of an object provided via an argument require
15573     * this to be true and invalidate the object pointed to by inner.
15574     */
15575    bool is_owned;
15576 } LDKMultiThreadedScoreLock;
15577
15578
15579
15580 /**
15581  * Parameters for configuring [`ProbabilisticScorer`].
15582  *
15583  * Used to configure base, liquidity, and amount penalties, the sum of which comprises the channel
15584  * penalty (i.e., the amount in msats willing to be paid to avoid routing through the channel).
15585  *
15586  * The penalty applied to any channel by the [`ProbabilisticScorer`] is the sum of each of the
15587  * parameters here.
15588  */
15589 typedef struct MUST_USE_STRUCT LDKProbabilisticScoringParameters {
15590    /**
15591     * A pointer to the opaque Rust object.
15592     * Nearly everywhere, inner must be non-null, however in places where
15593     * the Rust equivalent takes an Option, it may be set to null to indicate None.
15594     */
15595    LDKnativeProbabilisticScoringParameters *inner;
15596    /**
15597     * Indicates that this is the only struct which contains the same pointer.
15598     * Rust functions which take ownership of an object provided via an argument require
15599     * this to be true and invalidate the object pointed to by inner.
15600     */
15601    bool is_owned;
15602 } LDKProbabilisticScoringParameters;
15603
15604
15605
15606 /**
15607  * A sender, receiver and forwarder of onion messages. In upcoming releases, this object will be
15608  * used to retrieve invoices and fulfill invoice requests from [offers]. Currently, only sending
15609  * and receiving custom onion messages is supported.
15610  *
15611  * # Example
15612  *
15613  * ```
15614  * # extern crate bitcoin;
15615  * # use bitcoin::hashes::_export::_core::time::Duration;
15616  * # use bitcoin::secp256k1::{PublicKey, Secp256k1, SecretKey};
15617  * # use lightning::blinded_path::BlindedPath;
15618  * # use lightning::chain::keysinterface::KeysManager;
15619  * # use lightning::ln::peer_handler::IgnoringMessageHandler;
15620  * # use lightning::onion_message::messenger::{Destination, OnionMessenger};
15621  * # use lightning::onion_message::packet::{CustomOnionMessageContents, OnionMessageContents};
15622  * # use lightning::util::logger::{Logger, Record};
15623  * # use lightning::util::ser::{Writeable, Writer};
15624  * # use lightning::io;
15625  * # use std::sync::Arc;
15626  * # struct FakeLogger;
15627  * # impl Logger for FakeLogger {
15628  * #     fn log(&self, record: &Record) { unimplemented!() }
15629  * # }
15630  * # let seed = [42u8; 32];
15631  * # let time = Duration::from_secs(123456);
15632  * # let keys_manager = KeysManager::new(&seed, time.as_secs(), time.subsec_nanos());
15633  * # let logger = Arc::new(FakeLogger {});
15634  * # let node_secret = SecretKey::from_slice(&hex::decode(\"0101010101010101010101010101010101010101010101010101010101010101\").unwrap()[..]).unwrap();
15635  * # let secp_ctx = Secp256k1::new();
15636  * # let hop_node_id1 = PublicKey::from_secret_key(&secp_ctx, &node_secret);
15637  * # let (hop_node_id2, hop_node_id3, hop_node_id4) = (hop_node_id1, hop_node_id1, hop_node_id1);
15638  * # let destination_node_id = hop_node_id1;
15639  * # let your_custom_message_handler = IgnoringMessageHandler {};
15640  * // Create the onion messenger. This must use the same `keys_manager` as is passed to your
15641  * // ChannelManager.
15642  * let onion_messenger = OnionMessenger::new(&keys_manager, &keys_manager, logger, &your_custom_message_handler);
15643  *
15644  * # struct YourCustomMessage {}
15645  * impl Writeable for YourCustomMessage {
15646  * \tfn write<W: Writer>(&self, w: &mut W) -> Result<(), io::Error> {
15647  * \t\t# Ok(())
15648  * \t\t// Write your custom onion message to `w`
15649  * \t}
15650  * }
15651  * impl CustomOnionMessageContents for YourCustomMessage {
15652  * \tfn tlv_type(&self) -> u64 {
15653  * \t\t# let your_custom_message_type = 42;
15654  * \t\tyour_custom_message_type
15655  * \t}
15656  * }
15657  * // Send a custom onion message to a node id.
15658  * let intermediate_hops = [hop_node_id1, hop_node_id2];
15659  * let reply_path = None;
15660  * # let your_custom_message = YourCustomMessage {};
15661  * let message = OnionMessageContents::Custom(your_custom_message);
15662  * onion_messenger.send_onion_message(&intermediate_hops, Destination::Node(destination_node_id), message, reply_path);
15663  *
15664  * // Create a blinded path to yourself, for someone to send an onion message to.
15665  * # let your_node_id = hop_node_id1;
15666  * let hops = [hop_node_id3, hop_node_id4, your_node_id];
15667  * let blinded_path = BlindedPath::new_for_message(&hops, &keys_manager, &secp_ctx).unwrap();
15668  *
15669  * // Send a custom onion message to a blinded path.
15670  * # let intermediate_hops = [hop_node_id1, hop_node_id2];
15671  * let reply_path = None;
15672  * # let your_custom_message = YourCustomMessage {};
15673  * let message = OnionMessageContents::Custom(your_custom_message);
15674  * onion_messenger.send_onion_message(&intermediate_hops, Destination::BlindedPath(blinded_path), message, reply_path);
15675  * ```
15676  *
15677  * [offers]: <https://github.com/lightning/bolts/pull/798>
15678  * [`OnionMessenger`]: crate::onion_message::OnionMessenger
15679  */
15680 typedef struct MUST_USE_STRUCT LDKOnionMessenger {
15681    /**
15682     * A pointer to the opaque Rust object.
15683     * Nearly everywhere, inner must be non-null, however in places where
15684     * the Rust equivalent takes an Option, it may be set to null to indicate None.
15685     */
15686    LDKnativeOnionMessenger *inner;
15687    /**
15688     * Indicates that this is the only struct which contains the same pointer.
15689     * Rust functions which take ownership of an object provided via an argument require
15690     * this to be true and invalidate the object pointed to by inner.
15691     */
15692    bool is_owned;
15693 } LDKOnionMessenger;
15694
15695 /**
15696  * The destination of an onion message.
15697  */
15698 typedef enum LDKDestination_Tag {
15699    /**
15700     * We're sending this onion message to a node.
15701     */
15702    LDKDestination_Node,
15703    /**
15704     * We're sending this onion message to a blinded path.
15705     */
15706    LDKDestination_BlindedPath,
15707    /**
15708     * Must be last for serialization purposes
15709     */
15710    LDKDestination_Sentinel,
15711 } LDKDestination_Tag;
15712
15713 typedef struct MUST_USE_STRUCT LDKDestination {
15714    LDKDestination_Tag tag;
15715    union {
15716       struct {
15717          struct LDKPublicKey node;
15718       };
15719       struct {
15720          struct LDKBlindedPath blinded_path;
15721       };
15722    };
15723 } LDKDestination;
15724
15725 /**
15726  * The contents of an onion message. In the context of offers, this would be the invoice, invoice
15727  * request, or invoice error.
15728  */
15729 typedef enum LDKOnionMessageContents_Tag {
15730    /**
15731     * A custom onion message specified by the user.
15732     */
15733    LDKOnionMessageContents_Custom,
15734    /**
15735     * Must be last for serialization purposes
15736     */
15737    LDKOnionMessageContents_Sentinel,
15738 } LDKOnionMessageContents_Tag;
15739
15740 typedef struct MUST_USE_STRUCT LDKOnionMessageContents {
15741    LDKOnionMessageContents_Tag tag;
15742    union {
15743       struct {
15744          struct LDKCustomOnionMessageContents custom;
15745       };
15746    };
15747 } LDKOnionMessageContents;
15748
15749
15750
15751 /**
15752  * FilesystemPersister persists channel data on disk, where each channel's
15753  * data is stored in a file named after its funding outpoint.
15754  *
15755  * Warning: this module does the best it can with calls to persist data, but it
15756  * can only guarantee that the data is passed to the drive. It is up to the
15757  * drive manufacturers to do the actual persistence properly, which they often
15758  * don't (especially on consumer-grade hardware). Therefore, it is up to the
15759  * user to validate their entire storage stack, to ensure the writes are
15760  * persistent.
15761  * Corollary: especially when dealing with larger amounts of money, it is best
15762  * practice to have multiple channel data backups and not rely only on one
15763  * FilesystemPersister.
15764  */
15765 typedef struct MUST_USE_STRUCT LDKFilesystemPersister {
15766    /**
15767     * A pointer to the opaque Rust object.
15768     * Nearly everywhere, inner must be non-null, however in places where
15769     * the Rust equivalent takes an Option, it may be set to null to indicate None.
15770     */
15771    LDKnativeFilesystemPersister *inner;
15772    /**
15773     * Indicates that this is the only struct which contains the same pointer.
15774     * Rust functions which take ownership of an object provided via an argument require
15775     * this to be true and invalidate the object pointed to by inner.
15776     */
15777    bool is_owned;
15778 } LDKFilesystemPersister;
15779
15780
15781
15782 /**
15783  * `BackgroundProcessor` takes care of tasks that (1) need to happen periodically to keep
15784  * Rust-Lightning running properly, and (2) either can or should be run in the background. Its
15785  * responsibilities are:
15786  * * Processing [`Event`]s with a user-provided [`EventHandler`].
15787  * * Monitoring whether the [`ChannelManager`] needs to be re-persisted to disk, and if so,
15788  *   writing it to disk/backups by invoking the callback given to it at startup.
15789  *   [`ChannelManager`] persistence should be done in the background.
15790  * * Calling [`ChannelManager::timer_tick_occurred`], [`ChainMonitor::rebroadcast_pending_claims`]
15791  *   and [`PeerManager::timer_tick_occurred`] at the appropriate intervals.
15792  * * Calling [`NetworkGraph::remove_stale_channels_and_tracking`] (if a [`GossipSync`] with a
15793  *   [`NetworkGraph`] is provided to [`BackgroundProcessor::start`]).
15794  *
15795  * It will also call [`PeerManager::process_events`] periodically though this shouldn't be relied
15796  * upon as doing so may result in high latency.
15797  *
15798  * # Note
15799  *
15800  * If [`ChannelManager`] persistence fails and the persisted manager becomes out-of-date, then
15801  * there is a risk of channels force-closing on startup when the manager realizes it's outdated.
15802  * However, as long as [`ChannelMonitor`] backups are sound, no funds besides those used for
15803  * unilateral chain closure fees are at risk.
15804  *
15805  * [`ChannelMonitor`]: lightning::chain::channelmonitor::ChannelMonitor
15806  * [`Event`]: lightning::events::Event
15807  *BackgroundProcessor will immediately stop on drop. It should be stored until shutdown.
15808  */
15809 typedef struct MUST_USE_STRUCT LDKBackgroundProcessor {
15810    /**
15811     * A pointer to the opaque Rust object.
15812     * Nearly everywhere, inner must be non-null, however in places where
15813     * the Rust equivalent takes an Option, it may be set to null to indicate None.
15814     */
15815    LDKnativeBackgroundProcessor *inner;
15816    /**
15817     * Indicates that this is the only struct which contains the same pointer.
15818     * Rust functions which take ownership of an object provided via an argument require
15819     * this to be true and invalidate the object pointed to by inner.
15820     */
15821    bool is_owned;
15822 } LDKBackgroundProcessor;
15823
15824
15825
15826 /**
15827  * The main Rapid Gossip Sync object.
15828  *
15829  * See [crate-level documentation] for usage.
15830  *
15831  * [crate-level documentation]: crate
15832  */
15833 typedef struct MUST_USE_STRUCT LDKRapidGossipSync {
15834    /**
15835     * A pointer to the opaque Rust object.
15836     * Nearly everywhere, inner must be non-null, however in places where
15837     * the Rust equivalent takes an Option, it may be set to null to indicate None.
15838     */
15839    LDKnativeRapidGossipSync *inner;
15840    /**
15841     * Indicates that this is the only struct which contains the same pointer.
15842     * Rust functions which take ownership of an object provided via an argument require
15843     * this to be true and invalidate the object pointed to by inner.
15844     */
15845    bool is_owned;
15846 } LDKRapidGossipSync;
15847
15848 /**
15849  * Either [`P2PGossipSync`] or [`RapidGossipSync`].
15850  */
15851 typedef enum LDKGossipSync_Tag {
15852    /**
15853     * Gossip sync via the lightning peer-to-peer network as defined by BOLT 7.
15854     */
15855    LDKGossipSync_P2P,
15856    /**
15857     * Rapid gossip sync from a trusted server.
15858     */
15859    LDKGossipSync_Rapid,
15860    /**
15861     * No gossip sync.
15862     */
15863    LDKGossipSync_None,
15864    /**
15865     * Must be last for serialization purposes
15866     */
15867    LDKGossipSync_Sentinel,
15868 } LDKGossipSync_Tag;
15869
15870 typedef struct MUST_USE_STRUCT LDKGossipSync {
15871    LDKGossipSync_Tag tag;
15872    union {
15873       struct {
15874          /**
15875           * Note that this field is expected to be a reference.
15876           */
15877          struct LDKP2PGossipSync p2p;
15878       };
15879       struct {
15880          /**
15881           * Note that this field is expected to be a reference.
15882           */
15883          struct LDKRapidGossipSync rapid;
15884       };
15885    };
15886 } LDKGossipSync;
15887
15888
15889
15890 /**
15891  * Data of the [`RawInvoice`] that is encoded in the data part
15892  */
15893 typedef struct MUST_USE_STRUCT LDKRawDataPart {
15894    /**
15895     * A pointer to the opaque Rust object.
15896     * Nearly everywhere, inner must be non-null, however in places where
15897     * the Rust equivalent takes an Option, it may be set to null to indicate None.
15898     */
15899    LDKnativeRawDataPart *inner;
15900    /**
15901     * Indicates that this is the only struct which contains the same pointer.
15902     * Rust functions which take ownership of an object provided via an argument require
15903     * this to be true and invalidate the object pointed to by inner.
15904     */
15905    bool is_owned;
15906 } LDKRawDataPart;
15907
15908
15909
15910 /**
15911  * SHA-256 hash
15912  */
15913 typedef struct MUST_USE_STRUCT LDKSha256 {
15914    /**
15915     * A pointer to the opaque Rust object.
15916     * Nearly everywhere, inner must be non-null, however in places where
15917     * the Rust equivalent takes an Option, it may be set to null to indicate None.
15918     */
15919    LDKnativeSha256 *inner;
15920    /**
15921     * Indicates that this is the only struct which contains the same pointer.
15922     * Rust functions which take ownership of an object provided via an argument require
15923     * this to be true and invalidate the object pointed to by inner.
15924     */
15925    bool is_owned;
15926 } LDKSha256;
15927
15928
15929
15930 /**
15931  * Positive duration that defines when (relatively to the timestamp) in the future the invoice
15932  * expires
15933  */
15934 typedef struct MUST_USE_STRUCT LDKExpiryTime {
15935    /**
15936     * A pointer to the opaque Rust object.
15937     * Nearly everywhere, inner must be non-null, however in places where
15938     * the Rust equivalent takes an Option, it may be set to null to indicate None.
15939     */
15940    LDKnativeExpiryTime *inner;
15941    /**
15942     * Indicates that this is the only struct which contains the same pointer.
15943     * Rust functions which take ownership of an object provided via an argument require
15944     * this to be true and invalidate the object pointed to by inner.
15945     */
15946    bool is_owned;
15947 } LDKExpiryTime;
15948
15949
15950
15951 /**
15952  * `min_final_cltv_expiry_delta` to use for the last HTLC in the route
15953  */
15954 typedef struct MUST_USE_STRUCT LDKMinFinalCltvExpiryDelta {
15955    /**
15956     * A pointer to the opaque Rust object.
15957     * Nearly everywhere, inner must be non-null, however in places where
15958     * the Rust equivalent takes an Option, it may be set to null to indicate None.
15959     */
15960    LDKnativeMinFinalCltvExpiryDelta *inner;
15961    /**
15962     * Indicates that this is the only struct which contains the same pointer.
15963     * Rust functions which take ownership of an object provided via an argument require
15964     * this to be true and invalidate the object pointed to by inner.
15965     */
15966    bool is_owned;
15967 } LDKMinFinalCltvExpiryDelta;
15968
15969 /**
15970  * A 20-byte byte array.
15971  */
15972 typedef struct LDKTwentyBytes {
15973    /**
15974     * The twenty bytes
15975     */
15976    uint8_t data[20];
15977 } LDKTwentyBytes;
15978
15979 /**
15980  * Fallback address in case no LN payment is possible
15981  */
15982 typedef enum LDKFallback_Tag {
15983    LDKFallback_SegWitProgram,
15984    LDKFallback_PubKeyHash,
15985    LDKFallback_ScriptHash,
15986    /**
15987     * Must be last for serialization purposes
15988     */
15989    LDKFallback_Sentinel,
15990 } LDKFallback_Tag;
15991
15992 typedef struct LDKFallback_LDKSegWitProgram_Body {
15993    struct LDKWitnessVersion version;
15994    struct LDKCVec_u8Z program;
15995 } LDKFallback_LDKSegWitProgram_Body;
15996
15997 typedef struct MUST_USE_STRUCT LDKFallback {
15998    LDKFallback_Tag tag;
15999    union {
16000       LDKFallback_LDKSegWitProgram_Body seg_wit_program;
16001       struct {
16002          struct LDKTwentyBytes pub_key_hash;
16003       };
16004       struct {
16005          struct LDKTwentyBytes script_hash;
16006       };
16007    };
16008 } LDKFallback;
16009
16010 extern const uintptr_t MAX_BUF_SIZE;
16011
16012 extern const uint64_t MIN_RELAY_FEE_SAT_PER_1000_WEIGHT;
16013
16014 extern const uint32_t FEERATE_FLOOR_SATS_PER_KW;
16015
16016 extern const uint64_t CLOSED_CHANNEL_UPDATE_ID;
16017
16018 extern const uint32_t ANTI_REORG_DELAY;
16019
16020 extern const uint16_t BREAKDOWN_TIMEOUT;
16021
16022 extern const uint16_t MIN_CLTV_EXPIRY_DELTA;
16023
16024 extern const uint16_t MIN_FINAL_CLTV_EXPIRY_DELTA;
16025
16026 extern const uint16_t MAX_HTLCS;
16027
16028 extern const uintptr_t OFFERED_HTLC_SCRIPT_WEIGHT;
16029
16030 extern const uintptr_t OFFERED_HTLC_SCRIPT_WEIGHT_ANCHORS;
16031
16032 extern const uintptr_t MAX_ACCEPTED_HTLC_SCRIPT_WEIGHT;
16033
16034 extern const uintptr_t REVOKEABLE_REDEEMSCRIPT_MAX_LENGTH;
16035
16036 extern const uint64_t UNKNOWN_CHANNEL_CAPACITY_MSAT;
16037
16038 extern const uint32_t DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA;
16039
16040 extern const uint8_t DEFAULT_MAX_PATH_COUNT;
16041
16042 extern const uint64_t MAX_TIMESTAMP;
16043
16044 extern const uint64_t DEFAULT_EXPIRY_TIME;
16045
16046 extern const uint64_t DEFAULT_MIN_FINAL_CLTV_EXPIRY_DELTA;
16047
16048 extern const uint8_t TAG_PAYMENT_HASH;
16049
16050 extern const uint8_t TAG_DESCRIPTION;
16051
16052 extern const uint8_t TAG_PAYEE_PUB_KEY;
16053
16054 extern const uint8_t TAG_DESCRIPTION_HASH;
16055
16056 extern const uint8_t TAG_EXPIRY_TIME;
16057
16058 extern const uint8_t TAG_MIN_FINAL_CLTV_EXPIRY_DELTA;
16059
16060 extern const uint8_t TAG_FALLBACK;
16061
16062 extern const uint8_t TAG_PRIVATE_ROUTE;
16063
16064 extern const uint8_t TAG_PAYMENT_SECRET;
16065
16066 extern const uint8_t TAG_PAYMENT_METADATA;
16067
16068 extern const uint8_t TAG_FEATURES;
16069
16070 struct LDKStr _ldk_get_compiled_version(void);
16071
16072 struct LDKStr _ldk_c_bindings_get_compiled_version(void);
16073
16074 /**
16075  * Gets the 128-bit integer, as 16 little-endian bytes
16076  */
16077 struct LDKSixteenBytes U128_le_bytes(struct LDKU128 val);
16078
16079 /**
16080  * Constructs a new U128 from 16 little-endian bytes
16081  */
16082 struct LDKU128 U128_new(struct LDKSixteenBytes le_bytes);
16083
16084 /**
16085  * Convenience function for constructing a new BigEndianScalar
16086  */
16087 struct LDKBigEndianScalar BigEndianScalar_new(struct LDKThirtyTwoBytes big_endian_bytes);
16088
16089 /**
16090  * Creates a new Bech32Error which has the same data as `orig`
16091  */
16092 struct LDKBech32Error Bech32Error_clone(const struct LDKBech32Error *NONNULL_PTR orig);
16093
16094 /**
16095  * Releases any memory held by the given `Bech32Error` (which is currently none)
16096  */
16097 void Bech32Error_free(struct LDKBech32Error o);
16098
16099 /**
16100  * Frees the data buffer, if data_is_owned is set and datalen > 0.
16101  */
16102 void Transaction_free(struct LDKTransaction _res);
16103
16104 /**
16105  * Frees the data pointed to by data
16106  */
16107 void Witness_free(struct LDKWitness _res);
16108
16109 /**
16110  * Convenience function for constructing a new TxOut
16111  */
16112 struct LDKTxOut TxOut_new(struct LDKCVec_u8Z script_pubkey, uint64_t value);
16113
16114 /**
16115  * Frees the data pointed to by script_pubkey.
16116  */
16117 void TxOut_free(struct LDKTxOut _res);
16118
16119 /**
16120  * Creates a new TxOut which has the same data as `orig` but with a new script buffer.
16121  */
16122 struct LDKTxOut TxOut_clone(const struct LDKTxOut *NONNULL_PTR orig);
16123
16124 /**
16125  * Frees the data buffer, if chars_is_owned is set and len > 0.
16126  */
16127 void Str_free(struct LDKStr _res);
16128
16129 #if defined(LDK_DEBUG_BUILD)
16130 /**
16131  * This function exists for memory safety testing purposes. It should never be used in production
16132  * code
16133  */
16134 const void *__unmangle_inner_ptr(const void *ptr);
16135 #endif
16136
16137 /**
16138  * Constructs a new COption_DurationZ containing a u64
16139  */
16140 struct LDKCOption_DurationZ COption_DurationZ_some(uint64_t o);
16141
16142 /**
16143  * Constructs a new COption_DurationZ containing nothing
16144  */
16145 struct LDKCOption_DurationZ COption_DurationZ_none(void);
16146
16147 /**
16148  * Frees any resources associated with the u64, if we are in the Some state
16149  */
16150 void COption_DurationZ_free(struct LDKCOption_DurationZ _res);
16151
16152 /**
16153  * Creates a new COption_DurationZ which has the same data as `orig`
16154  * but with all dynamically-allocated buffers duplicated in new buffers.
16155  */
16156 struct LDKCOption_DurationZ COption_DurationZ_clone(const struct LDKCOption_DurationZ *NONNULL_PTR orig);
16157
16158 /**
16159  * Frees the buffer pointed to by `data` if `datalen` is non-0.
16160  */
16161 void CVec_BlindedPathZ_free(struct LDKCVec_BlindedPathZ _res);
16162
16163 /**
16164  * Constructs a new COption_u64Z containing a u64
16165  */
16166 struct LDKCOption_u64Z COption_u64Z_some(uint64_t o);
16167
16168 /**
16169  * Constructs a new COption_u64Z containing nothing
16170  */
16171 struct LDKCOption_u64Z COption_u64Z_none(void);
16172
16173 /**
16174  * Frees any resources associated with the u64, if we are in the Some state
16175  */
16176 void COption_u64Z_free(struct LDKCOption_u64Z _res);
16177
16178 /**
16179  * Creates a new COption_u64Z which has the same data as `orig`
16180  * but with all dynamically-allocated buffers duplicated in new buffers.
16181  */
16182 struct LDKCOption_u64Z COption_u64Z_clone(const struct LDKCOption_u64Z *NONNULL_PTR orig);
16183
16184 /**
16185  * Creates a new CResult_NoneAPIErrorZ in the success state.
16186  */
16187 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_ok(void);
16188
16189 /**
16190  * Creates a new CResult_NoneAPIErrorZ in the error state.
16191  */
16192 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_err(struct LDKAPIError e);
16193
16194 /**
16195  * Checks if the given object is currently in the success state
16196  */
16197 bool CResult_NoneAPIErrorZ_is_ok(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR o);
16198
16199 /**
16200  * Frees any resources used by the CResult_NoneAPIErrorZ.
16201  */
16202 void CResult_NoneAPIErrorZ_free(struct LDKCResult_NoneAPIErrorZ _res);
16203
16204 /**
16205  * Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
16206  * but with all dynamically-allocated buffers duplicated in new buffers.
16207  */
16208 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_clone(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR orig);
16209
16210 /**
16211  * Frees the buffer pointed to by `data` if `datalen` is non-0.
16212  */
16213 void CVec_CResult_NoneAPIErrorZZ_free(struct LDKCVec_CResult_NoneAPIErrorZZ _res);
16214
16215 /**
16216  * Frees the buffer pointed to by `data` if `datalen` is non-0.
16217  */
16218 void CVec_APIErrorZ_free(struct LDKCVec_APIErrorZ _res);
16219
16220 /**
16221  * Frees the buffer pointed to by `data` if `datalen` is non-0.
16222  */
16223 void CVec_u8Z_free(struct LDKCVec_u8Z _res);
16224
16225 /**
16226  * Constructs a new COption_CVec_u8ZZ containing a crate::c_types::derived::CVec_u8Z
16227  */
16228 struct LDKCOption_CVec_u8ZZ COption_CVec_u8ZZ_some(struct LDKCVec_u8Z o);
16229
16230 /**
16231  * Constructs a new COption_CVec_u8ZZ containing nothing
16232  */
16233 struct LDKCOption_CVec_u8ZZ COption_CVec_u8ZZ_none(void);
16234
16235 /**
16236  * Frees any resources associated with the crate::c_types::derived::CVec_u8Z, if we are in the Some state
16237  */
16238 void COption_CVec_u8ZZ_free(struct LDKCOption_CVec_u8ZZ _res);
16239
16240 /**
16241  * Creates a new COption_CVec_u8ZZ which has the same data as `orig`
16242  * but with all dynamically-allocated buffers duplicated in new buffers.
16243  */
16244 struct LDKCOption_CVec_u8ZZ COption_CVec_u8ZZ_clone(const struct LDKCOption_CVec_u8ZZ *NONNULL_PTR orig);
16245
16246 /**
16247  * Creates a new CResult_RecipientOnionFieldsDecodeErrorZ in the success state.
16248  */
16249 struct LDKCResult_RecipientOnionFieldsDecodeErrorZ CResult_RecipientOnionFieldsDecodeErrorZ_ok(struct LDKRecipientOnionFields o);
16250
16251 /**
16252  * Creates a new CResult_RecipientOnionFieldsDecodeErrorZ in the error state.
16253  */
16254 struct LDKCResult_RecipientOnionFieldsDecodeErrorZ CResult_RecipientOnionFieldsDecodeErrorZ_err(struct LDKDecodeError e);
16255
16256 /**
16257  * Checks if the given object is currently in the success state
16258  */
16259 bool CResult_RecipientOnionFieldsDecodeErrorZ_is_ok(const struct LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR o);
16260
16261 /**
16262  * Frees any resources used by the CResult_RecipientOnionFieldsDecodeErrorZ.
16263  */
16264 void CResult_RecipientOnionFieldsDecodeErrorZ_free(struct LDKCResult_RecipientOnionFieldsDecodeErrorZ _res);
16265
16266 /**
16267  * Creates a new CResult_RecipientOnionFieldsDecodeErrorZ which has the same data as `orig`
16268  * but with all dynamically-allocated buffers duplicated in new buffers.
16269  */
16270 struct LDKCResult_RecipientOnionFieldsDecodeErrorZ CResult_RecipientOnionFieldsDecodeErrorZ_clone(const struct LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR orig);
16271
16272 /**
16273  * Constructs a new COption_HTLCClaimZ containing a crate::lightning::ln::chan_utils::HTLCClaim
16274  */
16275 struct LDKCOption_HTLCClaimZ COption_HTLCClaimZ_some(enum LDKHTLCClaim o);
16276
16277 /**
16278  * Constructs a new COption_HTLCClaimZ containing nothing
16279  */
16280 struct LDKCOption_HTLCClaimZ COption_HTLCClaimZ_none(void);
16281
16282 /**
16283  * Frees any resources associated with the crate::lightning::ln::chan_utils::HTLCClaim, if we are in the Some state
16284  */
16285 void COption_HTLCClaimZ_free(struct LDKCOption_HTLCClaimZ _res);
16286
16287 /**
16288  * Creates a new CResult_NoneNoneZ in the success state.
16289  */
16290 struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_ok(void);
16291
16292 /**
16293  * Creates a new CResult_NoneNoneZ in the error state.
16294  */
16295 struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_err(void);
16296
16297 /**
16298  * Checks if the given object is currently in the success state
16299  */
16300 bool CResult_NoneNoneZ_is_ok(const struct LDKCResult_NoneNoneZ *NONNULL_PTR o);
16301
16302 /**
16303  * Frees any resources used by the CResult_NoneNoneZ.
16304  */
16305 void CResult_NoneNoneZ_free(struct LDKCResult_NoneNoneZ _res);
16306
16307 /**
16308  * Creates a new CResult_NoneNoneZ which has the same data as `orig`
16309  * but with all dynamically-allocated buffers duplicated in new buffers.
16310  */
16311 struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_clone(const struct LDKCResult_NoneNoneZ *NONNULL_PTR orig);
16312
16313 /**
16314  * Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the success state.
16315  */
16316 struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(struct LDKCounterpartyCommitmentSecrets o);
16317
16318 /**
16319  * Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the error state.
16320  */
16321 struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(struct LDKDecodeError e);
16322
16323 /**
16324  * Checks if the given object is currently in the success state
16325  */
16326 bool CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(const struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR o);
16327
16328 /**
16329  * Frees any resources used by the CResult_CounterpartyCommitmentSecretsDecodeErrorZ.
16330  */
16331 void CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ _res);
16332
16333 /**
16334  * Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ which has the same data as `orig`
16335  * but with all dynamically-allocated buffers duplicated in new buffers.
16336  */
16337 struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(const struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR orig);
16338
16339 /**
16340  * Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state.
16341  */
16342 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_ok(struct LDKTxCreationKeys o);
16343
16344 /**
16345  * Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state.
16346  */
16347 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_err(struct LDKDecodeError e);
16348
16349 /**
16350  * Checks if the given object is currently in the success state
16351  */
16352 bool CResult_TxCreationKeysDecodeErrorZ_is_ok(const struct LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR o);
16353
16354 /**
16355  * Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
16356  */
16357 void CResult_TxCreationKeysDecodeErrorZ_free(struct LDKCResult_TxCreationKeysDecodeErrorZ _res);
16358
16359 /**
16360  * Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig`
16361  * but with all dynamically-allocated buffers duplicated in new buffers.
16362  */
16363 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_clone(const struct LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR orig);
16364
16365 /**
16366  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state.
16367  */
16368 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_ok(struct LDKChannelPublicKeys o);
16369
16370 /**
16371  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state.
16372  */
16373 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_err(struct LDKDecodeError e);
16374
16375 /**
16376  * Checks if the given object is currently in the success state
16377  */
16378 bool CResult_ChannelPublicKeysDecodeErrorZ_is_ok(const struct LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR o);
16379
16380 /**
16381  * Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
16382  */
16383 void CResult_ChannelPublicKeysDecodeErrorZ_free(struct LDKCResult_ChannelPublicKeysDecodeErrorZ _res);
16384
16385 /**
16386  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig`
16387  * but with all dynamically-allocated buffers duplicated in new buffers.
16388  */
16389 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_clone(const struct LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR orig);
16390
16391 /**
16392  * Constructs a new COption_u32Z containing a u32
16393  */
16394 struct LDKCOption_u32Z COption_u32Z_some(uint32_t o);
16395
16396 /**
16397  * Constructs a new COption_u32Z containing nothing
16398  */
16399 struct LDKCOption_u32Z COption_u32Z_none(void);
16400
16401 /**
16402  * Frees any resources associated with the u32, if we are in the Some state
16403  */
16404 void COption_u32Z_free(struct LDKCOption_u32Z _res);
16405
16406 /**
16407  * Creates a new COption_u32Z which has the same data as `orig`
16408  * but with all dynamically-allocated buffers duplicated in new buffers.
16409  */
16410 struct LDKCOption_u32Z COption_u32Z_clone(const struct LDKCOption_u32Z *NONNULL_PTR orig);
16411
16412 /**
16413  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
16414  */
16415 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(struct LDKHTLCOutputInCommitment o);
16416
16417 /**
16418  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
16419  */
16420 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_err(struct LDKDecodeError e);
16421
16422 /**
16423  * Checks if the given object is currently in the success state
16424  */
16425 bool CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(const struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR o);
16426
16427 /**
16428  * Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
16429  */
16430 void CResult_HTLCOutputInCommitmentDecodeErrorZ_free(struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res);
16431
16432 /**
16433  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
16434  * but with all dynamically-allocated buffers duplicated in new buffers.
16435  */
16436 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(const struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR orig);
16437
16438 /**
16439  * Constructs a new COption_NoneZ containing a
16440  */
16441 enum LDKCOption_NoneZ COption_NoneZ_some(void);
16442
16443 /**
16444  * Constructs a new COption_NoneZ containing nothing
16445  */
16446 enum LDKCOption_NoneZ COption_NoneZ_none(void);
16447
16448 /**
16449  * Frees any resources associated with the , if we are in the Some state
16450  */
16451 void COption_NoneZ_free(enum LDKCOption_NoneZ _res);
16452
16453 /**
16454  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
16455  */
16456 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(struct LDKCounterpartyChannelTransactionParameters o);
16457
16458 /**
16459  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
16460  */
16461 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e);
16462
16463 /**
16464  * Checks if the given object is currently in the success state
16465  */
16466 bool CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(const struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR o);
16467
16468 /**
16469  * Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
16470  */
16471 void CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res);
16472
16473 /**
16474  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
16475  * but with all dynamically-allocated buffers duplicated in new buffers.
16476  */
16477 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig);
16478
16479 /**
16480  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
16481  */
16482 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_ok(struct LDKChannelTransactionParameters o);
16483
16484 /**
16485  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
16486  */
16487 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e);
16488
16489 /**
16490  * Checks if the given object is currently in the success state
16491  */
16492 bool CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(const struct LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR o);
16493
16494 /**
16495  * Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
16496  */
16497 void CResult_ChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_ChannelTransactionParametersDecodeErrorZ _res);
16498
16499 /**
16500  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
16501  * but with all dynamically-allocated buffers duplicated in new buffers.
16502  */
16503 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig);
16504
16505 /**
16506  * Frees the buffer pointed to by `data` if `datalen` is non-0.
16507  */
16508 void CVec_SignatureZ_free(struct LDKCVec_SignatureZ _res);
16509
16510 /**
16511  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
16512  */
16513 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_ok(struct LDKHolderCommitmentTransaction o);
16514
16515 /**
16516  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
16517  */
16518 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
16519
16520 /**
16521  * Checks if the given object is currently in the success state
16522  */
16523 bool CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR o);
16524
16525 /**
16526  * Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
16527  */
16528 void CResult_HolderCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res);
16529
16530 /**
16531  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
16532  * but with all dynamically-allocated buffers duplicated in new buffers.
16533  */
16534 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
16535
16536 /**
16537  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
16538  */
16539 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(struct LDKBuiltCommitmentTransaction o);
16540
16541 /**
16542  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
16543  */
16544 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
16545
16546 /**
16547  * Checks if the given object is currently in the success state
16548  */
16549 bool CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR o);
16550
16551 /**
16552  * Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
16553  */
16554 void CResult_BuiltCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res);
16555
16556 /**
16557  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
16558  * but with all dynamically-allocated buffers duplicated in new buffers.
16559  */
16560 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
16561
16562 /**
16563  * Creates a new CResult_TrustedClosingTransactionNoneZ in the success state.
16564  */
16565 struct LDKCResult_TrustedClosingTransactionNoneZ CResult_TrustedClosingTransactionNoneZ_ok(struct LDKTrustedClosingTransaction o);
16566
16567 /**
16568  * Creates a new CResult_TrustedClosingTransactionNoneZ in the error state.
16569  */
16570 struct LDKCResult_TrustedClosingTransactionNoneZ CResult_TrustedClosingTransactionNoneZ_err(void);
16571
16572 /**
16573  * Checks if the given object is currently in the success state
16574  */
16575 bool CResult_TrustedClosingTransactionNoneZ_is_ok(const struct LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR o);
16576
16577 /**
16578  * Frees any resources used by the CResult_TrustedClosingTransactionNoneZ.
16579  */
16580 void CResult_TrustedClosingTransactionNoneZ_free(struct LDKCResult_TrustedClosingTransactionNoneZ _res);
16581
16582 /**
16583  * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
16584  */
16585 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_ok(struct LDKCommitmentTransaction o);
16586
16587 /**
16588  * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
16589  */
16590 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
16591
16592 /**
16593  * Checks if the given object is currently in the success state
16594  */
16595 bool CResult_CommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR o);
16596
16597 /**
16598  * Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
16599  */
16600 void CResult_CommitmentTransactionDecodeErrorZ_free(struct LDKCResult_CommitmentTransactionDecodeErrorZ _res);
16601
16602 /**
16603  * Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
16604  * but with all dynamically-allocated buffers duplicated in new buffers.
16605  */
16606 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
16607
16608 /**
16609  * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
16610  */
16611 struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_ok(struct LDKTrustedCommitmentTransaction o);
16612
16613 /**
16614  * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
16615  */
16616 struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_err(void);
16617
16618 /**
16619  * Checks if the given object is currently in the success state
16620  */
16621 bool CResult_TrustedCommitmentTransactionNoneZ_is_ok(const struct LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR o);
16622
16623 /**
16624  * Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
16625  */
16626 void CResult_TrustedCommitmentTransactionNoneZ_free(struct LDKCResult_TrustedCommitmentTransactionNoneZ _res);
16627
16628 /**
16629  * Creates a new CResult_CVec_SignatureZNoneZ in the success state.
16630  */
16631 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_ok(struct LDKCVec_SignatureZ o);
16632
16633 /**
16634  * Creates a new CResult_CVec_SignatureZNoneZ in the error state.
16635  */
16636 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_err(void);
16637
16638 /**
16639  * Checks if the given object is currently in the success state
16640  */
16641 bool CResult_CVec_SignatureZNoneZ_is_ok(const struct LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR o);
16642
16643 /**
16644  * Frees any resources used by the CResult_CVec_SignatureZNoneZ.
16645  */
16646 void CResult_CVec_SignatureZNoneZ_free(struct LDKCResult_CVec_SignatureZNoneZ _res);
16647
16648 /**
16649  * Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig`
16650  * but with all dynamically-allocated buffers duplicated in new buffers.
16651  */
16652 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_clone(const struct LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR orig);
16653
16654 /**
16655  * Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state.
16656  */
16657 struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_ok(struct LDKShutdownScript o);
16658
16659 /**
16660  * Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state.
16661  */
16662 struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_err(struct LDKDecodeError e);
16663
16664 /**
16665  * Checks if the given object is currently in the success state
16666  */
16667 bool CResult_ShutdownScriptDecodeErrorZ_is_ok(const struct LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR o);
16668
16669 /**
16670  * Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ.
16671  */
16672 void CResult_ShutdownScriptDecodeErrorZ_free(struct LDKCResult_ShutdownScriptDecodeErrorZ _res);
16673
16674 /**
16675  * Creates a new CResult_ShutdownScriptDecodeErrorZ which has the same data as `orig`
16676  * but with all dynamically-allocated buffers duplicated in new buffers.
16677  */
16678 struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_clone(const struct LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR orig);
16679
16680 /**
16681  * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state.
16682  */
16683 struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_ok(struct LDKShutdownScript o);
16684
16685 /**
16686  * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state.
16687  */
16688 struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_err(struct LDKInvalidShutdownScript e);
16689
16690 /**
16691  * Checks if the given object is currently in the success state
16692  */
16693 bool CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(const struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR o);
16694
16695 /**
16696  * Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ.
16697  */
16698 void CResult_ShutdownScriptInvalidShutdownScriptZ_free(struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res);
16699
16700 /**
16701  * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ which has the same data as `orig`
16702  * but with all dynamically-allocated buffers duplicated in new buffers.
16703  */
16704 struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_clone(const struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR orig);
16705
16706 /**
16707  * Creates a new CResult_BlindedPayInfoDecodeErrorZ in the success state.
16708  */
16709 struct LDKCResult_BlindedPayInfoDecodeErrorZ CResult_BlindedPayInfoDecodeErrorZ_ok(struct LDKBlindedPayInfo o);
16710
16711 /**
16712  * Creates a new CResult_BlindedPayInfoDecodeErrorZ in the error state.
16713  */
16714 struct LDKCResult_BlindedPayInfoDecodeErrorZ CResult_BlindedPayInfoDecodeErrorZ_err(struct LDKDecodeError e);
16715
16716 /**
16717  * Checks if the given object is currently in the success state
16718  */
16719 bool CResult_BlindedPayInfoDecodeErrorZ_is_ok(const struct LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR o);
16720
16721 /**
16722  * Frees any resources used by the CResult_BlindedPayInfoDecodeErrorZ.
16723  */
16724 void CResult_BlindedPayInfoDecodeErrorZ_free(struct LDKCResult_BlindedPayInfoDecodeErrorZ _res);
16725
16726 /**
16727  * Creates a new CResult_BlindedPayInfoDecodeErrorZ which has the same data as `orig`
16728  * but with all dynamically-allocated buffers duplicated in new buffers.
16729  */
16730 struct LDKCResult_BlindedPayInfoDecodeErrorZ CResult_BlindedPayInfoDecodeErrorZ_clone(const struct LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR orig);
16731
16732 /**
16733  * Constructs a new COption_WriteableScoreZ containing a crate::lightning::routing::scoring::WriteableScore
16734  */
16735 struct LDKCOption_WriteableScoreZ COption_WriteableScoreZ_some(struct LDKWriteableScore o);
16736
16737 /**
16738  * Constructs a new COption_WriteableScoreZ containing nothing
16739  */
16740 struct LDKCOption_WriteableScoreZ COption_WriteableScoreZ_none(void);
16741
16742 /**
16743  * Frees any resources associated with the crate::lightning::routing::scoring::WriteableScore, if we are in the Some state
16744  */
16745 void COption_WriteableScoreZ_free(struct LDKCOption_WriteableScoreZ _res);
16746
16747 /**
16748  * Creates a new CResult_NoneErrorZ in the success state.
16749  */
16750 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_ok(void);
16751
16752 /**
16753  * Creates a new CResult_NoneErrorZ in the error state.
16754  */
16755 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_err(enum LDKIOError e);
16756
16757 /**
16758  * Checks if the given object is currently in the success state
16759  */
16760 bool CResult_NoneErrorZ_is_ok(const struct LDKCResult_NoneErrorZ *NONNULL_PTR o);
16761
16762 /**
16763  * Frees any resources used by the CResult_NoneErrorZ.
16764  */
16765 void CResult_NoneErrorZ_free(struct LDKCResult_NoneErrorZ _res);
16766
16767 /**
16768  * Creates a new CResult_NoneErrorZ which has the same data as `orig`
16769  * but with all dynamically-allocated buffers duplicated in new buffers.
16770  */
16771 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_clone(const struct LDKCResult_NoneErrorZ *NONNULL_PTR orig);
16772
16773 /**
16774  * Frees the buffer pointed to by `data` if `datalen` is non-0.
16775  */
16776 void CVec_ChannelDetailsZ_free(struct LDKCVec_ChannelDetailsZ _res);
16777
16778 /**
16779  * Creates a new CResult_RouteLightningErrorZ in the success state.
16780  */
16781 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_ok(struct LDKRoute o);
16782
16783 /**
16784  * Creates a new CResult_RouteLightningErrorZ in the error state.
16785  */
16786 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_err(struct LDKLightningError e);
16787
16788 /**
16789  * Checks if the given object is currently in the success state
16790  */
16791 bool CResult_RouteLightningErrorZ_is_ok(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR o);
16792
16793 /**
16794  * Frees any resources used by the CResult_RouteLightningErrorZ.
16795  */
16796 void CResult_RouteLightningErrorZ_free(struct LDKCResult_RouteLightningErrorZ _res);
16797
16798 /**
16799  * Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
16800  * but with all dynamically-allocated buffers duplicated in new buffers.
16801  */
16802 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_clone(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR orig);
16803
16804 /**
16805  * Creates a new CResult_InFlightHtlcsDecodeErrorZ in the success state.
16806  */
16807 struct LDKCResult_InFlightHtlcsDecodeErrorZ CResult_InFlightHtlcsDecodeErrorZ_ok(struct LDKInFlightHtlcs o);
16808
16809 /**
16810  * Creates a new CResult_InFlightHtlcsDecodeErrorZ in the error state.
16811  */
16812 struct LDKCResult_InFlightHtlcsDecodeErrorZ CResult_InFlightHtlcsDecodeErrorZ_err(struct LDKDecodeError e);
16813
16814 /**
16815  * Checks if the given object is currently in the success state
16816  */
16817 bool CResult_InFlightHtlcsDecodeErrorZ_is_ok(const struct LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR o);
16818
16819 /**
16820  * Frees any resources used by the CResult_InFlightHtlcsDecodeErrorZ.
16821  */
16822 void CResult_InFlightHtlcsDecodeErrorZ_free(struct LDKCResult_InFlightHtlcsDecodeErrorZ _res);
16823
16824 /**
16825  * Creates a new CResult_InFlightHtlcsDecodeErrorZ which has the same data as `orig`
16826  * but with all dynamically-allocated buffers duplicated in new buffers.
16827  */
16828 struct LDKCResult_InFlightHtlcsDecodeErrorZ CResult_InFlightHtlcsDecodeErrorZ_clone(const struct LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR orig);
16829
16830 /**
16831  * Creates a new CResult_RouteHopDecodeErrorZ in the success state.
16832  */
16833 struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_ok(struct LDKRouteHop o);
16834
16835 /**
16836  * Creates a new CResult_RouteHopDecodeErrorZ in the error state.
16837  */
16838 struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_err(struct LDKDecodeError e);
16839
16840 /**
16841  * Checks if the given object is currently in the success state
16842  */
16843 bool CResult_RouteHopDecodeErrorZ_is_ok(const struct LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR o);
16844
16845 /**
16846  * Frees any resources used by the CResult_RouteHopDecodeErrorZ.
16847  */
16848 void CResult_RouteHopDecodeErrorZ_free(struct LDKCResult_RouteHopDecodeErrorZ _res);
16849
16850 /**
16851  * Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig`
16852  * but with all dynamically-allocated buffers duplicated in new buffers.
16853  */
16854 struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_clone(const struct LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR orig);
16855
16856 /**
16857  * Frees the buffer pointed to by `data` if `datalen` is non-0.
16858  */
16859 void CVec_BlindedHopZ_free(struct LDKCVec_BlindedHopZ _res);
16860
16861 /**
16862  * Creates a new CResult_BlindedTailDecodeErrorZ in the success state.
16863  */
16864 struct LDKCResult_BlindedTailDecodeErrorZ CResult_BlindedTailDecodeErrorZ_ok(struct LDKBlindedTail o);
16865
16866 /**
16867  * Creates a new CResult_BlindedTailDecodeErrorZ in the error state.
16868  */
16869 struct LDKCResult_BlindedTailDecodeErrorZ CResult_BlindedTailDecodeErrorZ_err(struct LDKDecodeError e);
16870
16871 /**
16872  * Checks if the given object is currently in the success state
16873  */
16874 bool CResult_BlindedTailDecodeErrorZ_is_ok(const struct LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR o);
16875
16876 /**
16877  * Frees any resources used by the CResult_BlindedTailDecodeErrorZ.
16878  */
16879 void CResult_BlindedTailDecodeErrorZ_free(struct LDKCResult_BlindedTailDecodeErrorZ _res);
16880
16881 /**
16882  * Creates a new CResult_BlindedTailDecodeErrorZ which has the same data as `orig`
16883  * but with all dynamically-allocated buffers duplicated in new buffers.
16884  */
16885 struct LDKCResult_BlindedTailDecodeErrorZ CResult_BlindedTailDecodeErrorZ_clone(const struct LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR orig);
16886
16887 /**
16888  * Frees the buffer pointed to by `data` if `datalen` is non-0.
16889  */
16890 void CVec_RouteHopZ_free(struct LDKCVec_RouteHopZ _res);
16891
16892 /**
16893  * Frees the buffer pointed to by `data` if `datalen` is non-0.
16894  */
16895 void CVec_PathZ_free(struct LDKCVec_PathZ _res);
16896
16897 /**
16898  * Creates a new CResult_RouteDecodeErrorZ in the success state.
16899  */
16900 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_ok(struct LDKRoute o);
16901
16902 /**
16903  * Creates a new CResult_RouteDecodeErrorZ in the error state.
16904  */
16905 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_err(struct LDKDecodeError e);
16906
16907 /**
16908  * Checks if the given object is currently in the success state
16909  */
16910 bool CResult_RouteDecodeErrorZ_is_ok(const struct LDKCResult_RouteDecodeErrorZ *NONNULL_PTR o);
16911
16912 /**
16913  * Frees any resources used by the CResult_RouteDecodeErrorZ.
16914  */
16915 void CResult_RouteDecodeErrorZ_free(struct LDKCResult_RouteDecodeErrorZ _res);
16916
16917 /**
16918  * Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
16919  * but with all dynamically-allocated buffers duplicated in new buffers.
16920  */
16921 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_clone(const struct LDKCResult_RouteDecodeErrorZ *NONNULL_PTR orig);
16922
16923 /**
16924  * Creates a new CResult_RouteParametersDecodeErrorZ in the success state.
16925  */
16926 struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_ok(struct LDKRouteParameters o);
16927
16928 /**
16929  * Creates a new CResult_RouteParametersDecodeErrorZ in the error state.
16930  */
16931 struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_err(struct LDKDecodeError e);
16932
16933 /**
16934  * Checks if the given object is currently in the success state
16935  */
16936 bool CResult_RouteParametersDecodeErrorZ_is_ok(const struct LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR o);
16937
16938 /**
16939  * Frees any resources used by the CResult_RouteParametersDecodeErrorZ.
16940  */
16941 void CResult_RouteParametersDecodeErrorZ_free(struct LDKCResult_RouteParametersDecodeErrorZ _res);
16942
16943 /**
16944  * Creates a new CResult_RouteParametersDecodeErrorZ which has the same data as `orig`
16945  * but with all dynamically-allocated buffers duplicated in new buffers.
16946  */
16947 struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_clone(const struct LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR orig);
16948
16949 /**
16950  * Frees the buffer pointed to by `data` if `datalen` is non-0.
16951  */
16952 void CVec_u64Z_free(struct LDKCVec_u64Z _res);
16953
16954 /**
16955  * Creates a new CResult_PaymentParametersDecodeErrorZ in the success state.
16956  */
16957 struct LDKCResult_PaymentParametersDecodeErrorZ CResult_PaymentParametersDecodeErrorZ_ok(struct LDKPaymentParameters o);
16958
16959 /**
16960  * Creates a new CResult_PaymentParametersDecodeErrorZ in the error state.
16961  */
16962 struct LDKCResult_PaymentParametersDecodeErrorZ CResult_PaymentParametersDecodeErrorZ_err(struct LDKDecodeError e);
16963
16964 /**
16965  * Checks if the given object is currently in the success state
16966  */
16967 bool CResult_PaymentParametersDecodeErrorZ_is_ok(const struct LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR o);
16968
16969 /**
16970  * Frees any resources used by the CResult_PaymentParametersDecodeErrorZ.
16971  */
16972 void CResult_PaymentParametersDecodeErrorZ_free(struct LDKCResult_PaymentParametersDecodeErrorZ _res);
16973
16974 /**
16975  * Creates a new CResult_PaymentParametersDecodeErrorZ which has the same data as `orig`
16976  * but with all dynamically-allocated buffers duplicated in new buffers.
16977  */
16978 struct LDKCResult_PaymentParametersDecodeErrorZ CResult_PaymentParametersDecodeErrorZ_clone(const struct LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR orig);
16979
16980 /**
16981  * Creates a new tuple which has the same data as `orig`
16982  * but with all dynamically-allocated buffers duplicated in new buffers.
16983  */
16984 struct LDKC2Tuple_BlindedPayInfoBlindedPathZ C2Tuple_BlindedPayInfoBlindedPathZ_clone(const struct LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR orig);
16985
16986 /**
16987  * Creates a new C2Tuple_BlindedPayInfoBlindedPathZ from the contained elements.
16988  */
16989 struct LDKC2Tuple_BlindedPayInfoBlindedPathZ C2Tuple_BlindedPayInfoBlindedPathZ_new(struct LDKBlindedPayInfo a, struct LDKBlindedPath b);
16990
16991 /**
16992  * Frees any resources used by the C2Tuple_BlindedPayInfoBlindedPathZ.
16993  */
16994 void C2Tuple_BlindedPayInfoBlindedPathZ_free(struct LDKC2Tuple_BlindedPayInfoBlindedPathZ _res);
16995
16996 /**
16997  * Frees the buffer pointed to by `data` if `datalen` is non-0.
16998  */
16999 void CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_free(struct LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ _res);
17000
17001 /**
17002  * Frees the buffer pointed to by `data` if `datalen` is non-0.
17003  */
17004 void CVec_RouteHintZ_free(struct LDKCVec_RouteHintZ _res);
17005
17006 /**
17007  * Frees the buffer pointed to by `data` if `datalen` is non-0.
17008  */
17009 void CVec_RouteHintHopZ_free(struct LDKCVec_RouteHintHopZ _res);
17010
17011 /**
17012  * Creates a new CResult_RouteHintDecodeErrorZ in the success state.
17013  */
17014 struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_ok(struct LDKRouteHint o);
17015
17016 /**
17017  * Creates a new CResult_RouteHintDecodeErrorZ in the error state.
17018  */
17019 struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_err(struct LDKDecodeError e);
17020
17021 /**
17022  * Checks if the given object is currently in the success state
17023  */
17024 bool CResult_RouteHintDecodeErrorZ_is_ok(const struct LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR o);
17025
17026 /**
17027  * Frees any resources used by the CResult_RouteHintDecodeErrorZ.
17028  */
17029 void CResult_RouteHintDecodeErrorZ_free(struct LDKCResult_RouteHintDecodeErrorZ _res);
17030
17031 /**
17032  * Creates a new CResult_RouteHintDecodeErrorZ which has the same data as `orig`
17033  * but with all dynamically-allocated buffers duplicated in new buffers.
17034  */
17035 struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_clone(const struct LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR orig);
17036
17037 /**
17038  * Creates a new CResult_RouteHintHopDecodeErrorZ in the success state.
17039  */
17040 struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_ok(struct LDKRouteHintHop o);
17041
17042 /**
17043  * Creates a new CResult_RouteHintHopDecodeErrorZ in the error state.
17044  */
17045 struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_err(struct LDKDecodeError e);
17046
17047 /**
17048  * Checks if the given object is currently in the success state
17049  */
17050 bool CResult_RouteHintHopDecodeErrorZ_is_ok(const struct LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR o);
17051
17052 /**
17053  * Frees any resources used by the CResult_RouteHintHopDecodeErrorZ.
17054  */
17055 void CResult_RouteHintHopDecodeErrorZ_free(struct LDKCResult_RouteHintHopDecodeErrorZ _res);
17056
17057 /**
17058  * Creates a new CResult_RouteHintHopDecodeErrorZ which has the same data as `orig`
17059  * but with all dynamically-allocated buffers duplicated in new buffers.
17060  */
17061 struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_clone(const struct LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR orig);
17062
17063 /**
17064  * Frees the buffer pointed to by `data` if `datalen` is non-0.
17065  */
17066 void CVec_PublicKeyZ_free(struct LDKCVec_PublicKeyZ _res);
17067
17068 /**
17069  * Creates a new tuple which has the same data as `orig`
17070  * but with all dynamically-allocated buffers duplicated in new buffers.
17071  */
17072 struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_clone(const struct LDKC2Tuple_usizeTransactionZ *NONNULL_PTR orig);
17073
17074 /**
17075  * Creates a new C2Tuple_usizeTransactionZ from the contained elements.
17076  */
17077 struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_new(uintptr_t a, struct LDKTransaction b);
17078
17079 /**
17080  * Frees any resources used by the C2Tuple_usizeTransactionZ.
17081  */
17082 void C2Tuple_usizeTransactionZ_free(struct LDKC2Tuple_usizeTransactionZ _res);
17083
17084 /**
17085  * Frees the buffer pointed to by `data` if `datalen` is non-0.
17086  */
17087 void CVec_C2Tuple_usizeTransactionZZ_free(struct LDKCVec_C2Tuple_usizeTransactionZZ _res);
17088
17089 /**
17090  * Creates a new tuple which has the same data as `orig`
17091  * but with all dynamically-allocated buffers duplicated in new buffers.
17092  */
17093 struct LDKC2Tuple_TxidBlockHashZ C2Tuple_TxidBlockHashZ_clone(const struct LDKC2Tuple_TxidBlockHashZ *NONNULL_PTR orig);
17094
17095 /**
17096  * Creates a new C2Tuple_TxidBlockHashZ from the contained elements.
17097  */
17098 struct LDKC2Tuple_TxidBlockHashZ C2Tuple_TxidBlockHashZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b);
17099
17100 /**
17101  * Frees any resources used by the C2Tuple_TxidBlockHashZ.
17102  */
17103 void C2Tuple_TxidBlockHashZ_free(struct LDKC2Tuple_TxidBlockHashZ _res);
17104
17105 /**
17106  * Frees the buffer pointed to by `data` if `datalen` is non-0.
17107  */
17108 void CVec_C2Tuple_TxidBlockHashZZ_free(struct LDKCVec_C2Tuple_TxidBlockHashZZ _res);
17109
17110 /**
17111  * Frees the buffer pointed to by `data` if `datalen` is non-0.
17112  */
17113 void CVec_MonitorEventZ_free(struct LDKCVec_MonitorEventZ _res);
17114
17115 /**
17116  * Creates a new tuple which has the same data as `orig`
17117  * but with all dynamically-allocated buffers duplicated in new buffers.
17118  */
17119 struct LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(const struct LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR orig);
17120
17121 /**
17122  * Creates a new C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ from the contained elements.
17123  */
17124 struct LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(struct LDKOutPoint a, struct LDKCVec_MonitorEventZ b, struct LDKPublicKey c);
17125
17126 /**
17127  * Frees any resources used by the C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ.
17128  */
17129 void C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(struct LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res);
17130
17131 /**
17132  * Frees the buffer pointed to by `data` if `datalen` is non-0.
17133  */
17134 void CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(struct LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ _res);
17135
17136 /**
17137  * Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the success state.
17138  */
17139 struct LDKCResult_FixedPenaltyScorerDecodeErrorZ CResult_FixedPenaltyScorerDecodeErrorZ_ok(struct LDKFixedPenaltyScorer o);
17140
17141 /**
17142  * Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the error state.
17143  */
17144 struct LDKCResult_FixedPenaltyScorerDecodeErrorZ CResult_FixedPenaltyScorerDecodeErrorZ_err(struct LDKDecodeError e);
17145
17146 /**
17147  * Checks if the given object is currently in the success state
17148  */
17149 bool CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(const struct LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR o);
17150
17151 /**
17152  * Frees any resources used by the CResult_FixedPenaltyScorerDecodeErrorZ.
17153  */
17154 void CResult_FixedPenaltyScorerDecodeErrorZ_free(struct LDKCResult_FixedPenaltyScorerDecodeErrorZ _res);
17155
17156 /**
17157  * Creates a new CResult_FixedPenaltyScorerDecodeErrorZ which has the same data as `orig`
17158  * but with all dynamically-allocated buffers duplicated in new buffers.
17159  */
17160 struct LDKCResult_FixedPenaltyScorerDecodeErrorZ CResult_FixedPenaltyScorerDecodeErrorZ_clone(const struct LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR orig);
17161
17162 /**
17163  * Creates a new tuple which has the same data as `orig`
17164  * but with all dynamically-allocated buffers duplicated in new buffers.
17165  */
17166 struct LDKC2Tuple_u64u64Z C2Tuple_u64u64Z_clone(const struct LDKC2Tuple_u64u64Z *NONNULL_PTR orig);
17167
17168 /**
17169  * Creates a new C2Tuple_u64u64Z from the contained elements.
17170  */
17171 struct LDKC2Tuple_u64u64Z C2Tuple_u64u64Z_new(uint64_t a, uint64_t b);
17172
17173 /**
17174  * Frees any resources used by the C2Tuple_u64u64Z.
17175  */
17176 void C2Tuple_u64u64Z_free(struct LDKC2Tuple_u64u64Z _res);
17177
17178 /**
17179  * Constructs a new COption_C2Tuple_u64u64ZZ containing a crate::c_types::derived::C2Tuple_u64u64Z
17180  */
17181 struct LDKCOption_C2Tuple_u64u64ZZ COption_C2Tuple_u64u64ZZ_some(struct LDKC2Tuple_u64u64Z o);
17182
17183 /**
17184  * Constructs a new COption_C2Tuple_u64u64ZZ containing nothing
17185  */
17186 struct LDKCOption_C2Tuple_u64u64ZZ COption_C2Tuple_u64u64ZZ_none(void);
17187
17188 /**
17189  * Frees any resources associated with the crate::c_types::derived::C2Tuple_u64u64Z, if we are in the Some state
17190  */
17191 void COption_C2Tuple_u64u64ZZ_free(struct LDKCOption_C2Tuple_u64u64ZZ _res);
17192
17193 /**
17194  * Creates a new COption_C2Tuple_u64u64ZZ which has the same data as `orig`
17195  * but with all dynamically-allocated buffers duplicated in new buffers.
17196  */
17197 struct LDKCOption_C2Tuple_u64u64ZZ COption_C2Tuple_u64u64ZZ_clone(const struct LDKCOption_C2Tuple_u64u64ZZ *NONNULL_PTR orig);
17198
17199 /**
17200  * Creates a new tuple which has the same data as `orig`
17201  * but with all dynamically-allocated buffers duplicated in new buffers.
17202  */
17203 struct LDKC2Tuple_Z C2Tuple_Z_clone(const struct LDKC2Tuple_Z *NONNULL_PTR orig);
17204
17205 /**
17206  * Creates a new C2Tuple_Z from the contained elements.
17207  */
17208 struct LDKC2Tuple_Z C2Tuple_Z_new(struct LDKEightU16s a, struct LDKEightU16s b);
17209
17210 /**
17211  * Frees any resources used by the C2Tuple_Z.
17212  */
17213 void C2Tuple_Z_free(struct LDKC2Tuple_Z _res);
17214
17215 /**
17216  * Creates a new tuple which has the same data as `orig`
17217  * but with all dynamically-allocated buffers duplicated in new buffers.
17218  */
17219 struct LDKC2Tuple__u168_u168Z C2Tuple__u168_u168Z_clone(const struct LDKC2Tuple__u168_u168Z *NONNULL_PTR orig);
17220
17221 /**
17222  * Creates a new C2Tuple__u168_u168Z from the contained elements.
17223  */
17224 struct LDKC2Tuple__u168_u168Z C2Tuple__u168_u168Z_new(struct LDKEightU16s a, struct LDKEightU16s b);
17225
17226 /**
17227  * Frees any resources used by the C2Tuple__u168_u168Z.
17228  */
17229 void C2Tuple__u168_u168Z_free(struct LDKC2Tuple__u168_u168Z _res);
17230
17231 /**
17232  * Constructs a new COption_C2Tuple_EightU16sEightU16sZZ containing a crate::c_types::derived::C2Tuple__u168_u168Z
17233  */
17234 struct LDKCOption_C2Tuple_EightU16sEightU16sZZ COption_C2Tuple_EightU16sEightU16sZZ_some(struct LDKC2Tuple__u168_u168Z o);
17235
17236 /**
17237  * Constructs a new COption_C2Tuple_EightU16sEightU16sZZ containing nothing
17238  */
17239 struct LDKCOption_C2Tuple_EightU16sEightU16sZZ COption_C2Tuple_EightU16sEightU16sZZ_none(void);
17240
17241 /**
17242  * Frees any resources associated with the crate::c_types::derived::C2Tuple__u168_u168Z, if we are in the Some state
17243  */
17244 void COption_C2Tuple_EightU16sEightU16sZZ_free(struct LDKCOption_C2Tuple_EightU16sEightU16sZZ _res);
17245
17246 /**
17247  * Creates a new COption_C2Tuple_EightU16sEightU16sZZ which has the same data as `orig`
17248  * but with all dynamically-allocated buffers duplicated in new buffers.
17249  */
17250 struct LDKCOption_C2Tuple_EightU16sEightU16sZZ COption_C2Tuple_EightU16sEightU16sZZ_clone(const struct LDKCOption_C2Tuple_EightU16sEightU16sZZ *NONNULL_PTR orig);
17251
17252 /**
17253  * Frees the buffer pointed to by `data` if `datalen` is non-0.
17254  */
17255 void CVec_NodeIdZ_free(struct LDKCVec_NodeIdZ _res);
17256
17257 /**
17258  * Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the success state.
17259  */
17260 struct LDKCResult_ProbabilisticScorerDecodeErrorZ CResult_ProbabilisticScorerDecodeErrorZ_ok(struct LDKProbabilisticScorer o);
17261
17262 /**
17263  * Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the error state.
17264  */
17265 struct LDKCResult_ProbabilisticScorerDecodeErrorZ CResult_ProbabilisticScorerDecodeErrorZ_err(struct LDKDecodeError e);
17266
17267 /**
17268  * Checks if the given object is currently in the success state
17269  */
17270 bool CResult_ProbabilisticScorerDecodeErrorZ_is_ok(const struct LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR o);
17271
17272 /**
17273  * Frees any resources used by the CResult_ProbabilisticScorerDecodeErrorZ.
17274  */
17275 void CResult_ProbabilisticScorerDecodeErrorZ_free(struct LDKCResult_ProbabilisticScorerDecodeErrorZ _res);
17276
17277 /**
17278  * Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
17279  */
17280 struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_ok(struct LDKInitFeatures o);
17281
17282 /**
17283  * Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
17284  */
17285 struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
17286
17287 /**
17288  * Checks if the given object is currently in the success state
17289  */
17290 bool CResult_InitFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR o);
17291
17292 /**
17293  * Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
17294  */
17295 void CResult_InitFeaturesDecodeErrorZ_free(struct LDKCResult_InitFeaturesDecodeErrorZ _res);
17296
17297 /**
17298  * Creates a new CResult_InitFeaturesDecodeErrorZ which has the same data as `orig`
17299  * but with all dynamically-allocated buffers duplicated in new buffers.
17300  */
17301 struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_clone(const struct LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR orig);
17302
17303 /**
17304  * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
17305  */
17306 struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_ok(struct LDKChannelFeatures o);
17307
17308 /**
17309  * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
17310  */
17311 struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
17312
17313 /**
17314  * Checks if the given object is currently in the success state
17315  */
17316 bool CResult_ChannelFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR o);
17317
17318 /**
17319  * Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
17320  */
17321 void CResult_ChannelFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelFeaturesDecodeErrorZ _res);
17322
17323 /**
17324  * Creates a new CResult_ChannelFeaturesDecodeErrorZ which has the same data as `orig`
17325  * but with all dynamically-allocated buffers duplicated in new buffers.
17326  */
17327 struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_clone(const struct LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR orig);
17328
17329 /**
17330  * Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
17331  */
17332 struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_ok(struct LDKNodeFeatures o);
17333
17334 /**
17335  * Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
17336  */
17337 struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
17338
17339 /**
17340  * Checks if the given object is currently in the success state
17341  */
17342 bool CResult_NodeFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR o);
17343
17344 /**
17345  * Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
17346  */
17347 void CResult_NodeFeaturesDecodeErrorZ_free(struct LDKCResult_NodeFeaturesDecodeErrorZ _res);
17348
17349 /**
17350  * Creates a new CResult_NodeFeaturesDecodeErrorZ which has the same data as `orig`
17351  * but with all dynamically-allocated buffers duplicated in new buffers.
17352  */
17353 struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_clone(const struct LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR orig);
17354
17355 /**
17356  * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
17357  */
17358 struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_ok(struct LDKInvoiceFeatures o);
17359
17360 /**
17361  * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
17362  */
17363 struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
17364
17365 /**
17366  * Checks if the given object is currently in the success state
17367  */
17368 bool CResult_InvoiceFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR o);
17369
17370 /**
17371  * Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
17372  */
17373 void CResult_InvoiceFeaturesDecodeErrorZ_free(struct LDKCResult_InvoiceFeaturesDecodeErrorZ _res);
17374
17375 /**
17376  * Creates a new CResult_InvoiceFeaturesDecodeErrorZ which has the same data as `orig`
17377  * but with all dynamically-allocated buffers duplicated in new buffers.
17378  */
17379 struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_clone(const struct LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR orig);
17380
17381 /**
17382  * Creates a new CResult_BlindedHopFeaturesDecodeErrorZ in the success state.
17383  */
17384 struct LDKCResult_BlindedHopFeaturesDecodeErrorZ CResult_BlindedHopFeaturesDecodeErrorZ_ok(struct LDKBlindedHopFeatures o);
17385
17386 /**
17387  * Creates a new CResult_BlindedHopFeaturesDecodeErrorZ in the error state.
17388  */
17389 struct LDKCResult_BlindedHopFeaturesDecodeErrorZ CResult_BlindedHopFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
17390
17391 /**
17392  * Checks if the given object is currently in the success state
17393  */
17394 bool CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR o);
17395
17396 /**
17397  * Frees any resources used by the CResult_BlindedHopFeaturesDecodeErrorZ.
17398  */
17399 void CResult_BlindedHopFeaturesDecodeErrorZ_free(struct LDKCResult_BlindedHopFeaturesDecodeErrorZ _res);
17400
17401 /**
17402  * Creates a new CResult_BlindedHopFeaturesDecodeErrorZ which has the same data as `orig`
17403  * but with all dynamically-allocated buffers duplicated in new buffers.
17404  */
17405 struct LDKCResult_BlindedHopFeaturesDecodeErrorZ CResult_BlindedHopFeaturesDecodeErrorZ_clone(const struct LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR orig);
17406
17407 /**
17408  * Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the success state.
17409  */
17410 struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_ok(struct LDKChannelTypeFeatures o);
17411
17412 /**
17413  * Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the error state.
17414  */
17415 struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
17416
17417 /**
17418  * Checks if the given object is currently in the success state
17419  */
17420 bool CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR o);
17421
17422 /**
17423  * Frees any resources used by the CResult_ChannelTypeFeaturesDecodeErrorZ.
17424  */
17425 void CResult_ChannelTypeFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res);
17426
17427 /**
17428  * Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ which has the same data as `orig`
17429  * but with all dynamically-allocated buffers duplicated in new buffers.
17430  */
17431 struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_clone(const struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR orig);
17432
17433 /**
17434  * Creates a new CResult_PaymentPurposeDecodeErrorZ in the success state.
17435  */
17436 struct LDKCResult_PaymentPurposeDecodeErrorZ CResult_PaymentPurposeDecodeErrorZ_ok(struct LDKPaymentPurpose o);
17437
17438 /**
17439  * Creates a new CResult_PaymentPurposeDecodeErrorZ in the error state.
17440  */
17441 struct LDKCResult_PaymentPurposeDecodeErrorZ CResult_PaymentPurposeDecodeErrorZ_err(struct LDKDecodeError e);
17442
17443 /**
17444  * Checks if the given object is currently in the success state
17445  */
17446 bool CResult_PaymentPurposeDecodeErrorZ_is_ok(const struct LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR o);
17447
17448 /**
17449  * Frees any resources used by the CResult_PaymentPurposeDecodeErrorZ.
17450  */
17451 void CResult_PaymentPurposeDecodeErrorZ_free(struct LDKCResult_PaymentPurposeDecodeErrorZ _res);
17452
17453 /**
17454  * Creates a new CResult_PaymentPurposeDecodeErrorZ which has the same data as `orig`
17455  * but with all dynamically-allocated buffers duplicated in new buffers.
17456  */
17457 struct LDKCResult_PaymentPurposeDecodeErrorZ CResult_PaymentPurposeDecodeErrorZ_clone(const struct LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR orig);
17458
17459 /**
17460  * Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::gossip::NetworkUpdate
17461  */
17462 struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_some(struct LDKNetworkUpdate o);
17463
17464 /**
17465  * Constructs a new COption_NetworkUpdateZ containing nothing
17466  */
17467 struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_none(void);
17468
17469 /**
17470  * Frees any resources associated with the crate::lightning::routing::gossip::NetworkUpdate, if we are in the Some state
17471  */
17472 void COption_NetworkUpdateZ_free(struct LDKCOption_NetworkUpdateZ _res);
17473
17474 /**
17475  * Creates a new COption_NetworkUpdateZ which has the same data as `orig`
17476  * but with all dynamically-allocated buffers duplicated in new buffers.
17477  */
17478 struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_clone(const struct LDKCOption_NetworkUpdateZ *NONNULL_PTR orig);
17479
17480 /**
17481  * Constructs a new COption_PathFailureZ containing a crate::lightning::events::PathFailure
17482  */
17483 struct LDKCOption_PathFailureZ COption_PathFailureZ_some(struct LDKPathFailure o);
17484
17485 /**
17486  * Constructs a new COption_PathFailureZ containing nothing
17487  */
17488 struct LDKCOption_PathFailureZ COption_PathFailureZ_none(void);
17489
17490 /**
17491  * Frees any resources associated with the crate::lightning::events::PathFailure, if we are in the Some state
17492  */
17493 void COption_PathFailureZ_free(struct LDKCOption_PathFailureZ _res);
17494
17495 /**
17496  * Creates a new COption_PathFailureZ which has the same data as `orig`
17497  * but with all dynamically-allocated buffers duplicated in new buffers.
17498  */
17499 struct LDKCOption_PathFailureZ COption_PathFailureZ_clone(const struct LDKCOption_PathFailureZ *NONNULL_PTR orig);
17500
17501 /**
17502  * Creates a new CResult_COption_PathFailureZDecodeErrorZ in the success state.
17503  */
17504 struct LDKCResult_COption_PathFailureZDecodeErrorZ CResult_COption_PathFailureZDecodeErrorZ_ok(struct LDKCOption_PathFailureZ o);
17505
17506 /**
17507  * Creates a new CResult_COption_PathFailureZDecodeErrorZ in the error state.
17508  */
17509 struct LDKCResult_COption_PathFailureZDecodeErrorZ CResult_COption_PathFailureZDecodeErrorZ_err(struct LDKDecodeError e);
17510
17511 /**
17512  * Checks if the given object is currently in the success state
17513  */
17514 bool CResult_COption_PathFailureZDecodeErrorZ_is_ok(const struct LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR o);
17515
17516 /**
17517  * Frees any resources used by the CResult_COption_PathFailureZDecodeErrorZ.
17518  */
17519 void CResult_COption_PathFailureZDecodeErrorZ_free(struct LDKCResult_COption_PathFailureZDecodeErrorZ _res);
17520
17521 /**
17522  * Creates a new CResult_COption_PathFailureZDecodeErrorZ which has the same data as `orig`
17523  * but with all dynamically-allocated buffers duplicated in new buffers.
17524  */
17525 struct LDKCResult_COption_PathFailureZDecodeErrorZ CResult_COption_PathFailureZDecodeErrorZ_clone(const struct LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR orig);
17526
17527 /**
17528  * Constructs a new COption_ClosureReasonZ containing a crate::lightning::events::ClosureReason
17529  */
17530 struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_some(struct LDKClosureReason o);
17531
17532 /**
17533  * Constructs a new COption_ClosureReasonZ containing nothing
17534  */
17535 struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_none(void);
17536
17537 /**
17538  * Frees any resources associated with the crate::lightning::events::ClosureReason, if we are in the Some state
17539  */
17540 void COption_ClosureReasonZ_free(struct LDKCOption_ClosureReasonZ _res);
17541
17542 /**
17543  * Creates a new COption_ClosureReasonZ which has the same data as `orig`
17544  * but with all dynamically-allocated buffers duplicated in new buffers.
17545  */
17546 struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_clone(const struct LDKCOption_ClosureReasonZ *NONNULL_PTR orig);
17547
17548 /**
17549  * Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the success state.
17550  */
17551 struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_ok(struct LDKCOption_ClosureReasonZ o);
17552
17553 /**
17554  * Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the error state.
17555  */
17556 struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_err(struct LDKDecodeError e);
17557
17558 /**
17559  * Checks if the given object is currently in the success state
17560  */
17561 bool CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(const struct LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR o);
17562
17563 /**
17564  * Frees any resources used by the CResult_COption_ClosureReasonZDecodeErrorZ.
17565  */
17566 void CResult_COption_ClosureReasonZDecodeErrorZ_free(struct LDKCResult_COption_ClosureReasonZDecodeErrorZ _res);
17567
17568 /**
17569  * Creates a new CResult_COption_ClosureReasonZDecodeErrorZ which has the same data as `orig`
17570  * but with all dynamically-allocated buffers duplicated in new buffers.
17571  */
17572 struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_clone(const struct LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR orig);
17573
17574 /**
17575  * Constructs a new COption_HTLCDestinationZ containing a crate::lightning::events::HTLCDestination
17576  */
17577 struct LDKCOption_HTLCDestinationZ COption_HTLCDestinationZ_some(struct LDKHTLCDestination o);
17578
17579 /**
17580  * Constructs a new COption_HTLCDestinationZ containing nothing
17581  */
17582 struct LDKCOption_HTLCDestinationZ COption_HTLCDestinationZ_none(void);
17583
17584 /**
17585  * Frees any resources associated with the crate::lightning::events::HTLCDestination, if we are in the Some state
17586  */
17587 void COption_HTLCDestinationZ_free(struct LDKCOption_HTLCDestinationZ _res);
17588
17589 /**
17590  * Creates a new COption_HTLCDestinationZ which has the same data as `orig`
17591  * but with all dynamically-allocated buffers duplicated in new buffers.
17592  */
17593 struct LDKCOption_HTLCDestinationZ COption_HTLCDestinationZ_clone(const struct LDKCOption_HTLCDestinationZ *NONNULL_PTR orig);
17594
17595 /**
17596  * Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the success state.
17597  */
17598 struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ CResult_COption_HTLCDestinationZDecodeErrorZ_ok(struct LDKCOption_HTLCDestinationZ o);
17599
17600 /**
17601  * Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the error state.
17602  */
17603 struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ CResult_COption_HTLCDestinationZDecodeErrorZ_err(struct LDKDecodeError e);
17604
17605 /**
17606  * Checks if the given object is currently in the success state
17607  */
17608 bool CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(const struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR o);
17609
17610 /**
17611  * Frees any resources used by the CResult_COption_HTLCDestinationZDecodeErrorZ.
17612  */
17613 void CResult_COption_HTLCDestinationZDecodeErrorZ_free(struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ _res);
17614
17615 /**
17616  * Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ which has the same data as `orig`
17617  * but with all dynamically-allocated buffers duplicated in new buffers.
17618  */
17619 struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ CResult_COption_HTLCDestinationZDecodeErrorZ_clone(const struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR orig);
17620
17621 /**
17622  * Creates a new CResult_PaymentFailureReasonDecodeErrorZ in the success state.
17623  */
17624 struct LDKCResult_PaymentFailureReasonDecodeErrorZ CResult_PaymentFailureReasonDecodeErrorZ_ok(enum LDKPaymentFailureReason o);
17625
17626 /**
17627  * Creates a new CResult_PaymentFailureReasonDecodeErrorZ in the error state.
17628  */
17629 struct LDKCResult_PaymentFailureReasonDecodeErrorZ CResult_PaymentFailureReasonDecodeErrorZ_err(struct LDKDecodeError e);
17630
17631 /**
17632  * Checks if the given object is currently in the success state
17633  */
17634 bool CResult_PaymentFailureReasonDecodeErrorZ_is_ok(const struct LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR o);
17635
17636 /**
17637  * Frees any resources used by the CResult_PaymentFailureReasonDecodeErrorZ.
17638  */
17639 void CResult_PaymentFailureReasonDecodeErrorZ_free(struct LDKCResult_PaymentFailureReasonDecodeErrorZ _res);
17640
17641 /**
17642  * Creates a new CResult_PaymentFailureReasonDecodeErrorZ which has the same data as `orig`
17643  * but with all dynamically-allocated buffers duplicated in new buffers.
17644  */
17645 struct LDKCResult_PaymentFailureReasonDecodeErrorZ CResult_PaymentFailureReasonDecodeErrorZ_clone(const struct LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR orig);
17646
17647 /**
17648  * Constructs a new COption_u128Z containing a crate::c_types::U128
17649  */
17650 struct LDKCOption_u128Z COption_u128Z_some(struct LDKU128 o);
17651
17652 /**
17653  * Constructs a new COption_u128Z containing nothing
17654  */
17655 struct LDKCOption_u128Z COption_u128Z_none(void);
17656
17657 /**
17658  * Frees any resources associated with the crate::c_types::U128, if we are in the Some state
17659  */
17660 void COption_u128Z_free(struct LDKCOption_u128Z _res);
17661
17662 /**
17663  * Creates a new COption_u128Z which has the same data as `orig`
17664  * but with all dynamically-allocated buffers duplicated in new buffers.
17665  */
17666 struct LDKCOption_u128Z COption_u128Z_clone(const struct LDKCOption_u128Z *NONNULL_PTR orig);
17667
17668 /**
17669  * Constructs a new COption_PaymentFailureReasonZ containing a crate::lightning::events::PaymentFailureReason
17670  */
17671 struct LDKCOption_PaymentFailureReasonZ COption_PaymentFailureReasonZ_some(enum LDKPaymentFailureReason o);
17672
17673 /**
17674  * Constructs a new COption_PaymentFailureReasonZ containing nothing
17675  */
17676 struct LDKCOption_PaymentFailureReasonZ COption_PaymentFailureReasonZ_none(void);
17677
17678 /**
17679  * Frees any resources associated with the crate::lightning::events::PaymentFailureReason, if we are in the Some state
17680  */
17681 void COption_PaymentFailureReasonZ_free(struct LDKCOption_PaymentFailureReasonZ _res);
17682
17683 /**
17684  * Creates a new COption_PaymentFailureReasonZ which has the same data as `orig`
17685  * but with all dynamically-allocated buffers duplicated in new buffers.
17686  */
17687 struct LDKCOption_PaymentFailureReasonZ COption_PaymentFailureReasonZ_clone(const struct LDKCOption_PaymentFailureReasonZ *NONNULL_PTR orig);
17688
17689 /**
17690  * Frees the buffer pointed to by `data` if `datalen` is non-0.
17691  */
17692 void CVec_SpendableOutputDescriptorZ_free(struct LDKCVec_SpendableOutputDescriptorZ _res);
17693
17694 /**
17695  * Constructs a new COption_EventZ containing a crate::lightning::events::Event
17696  */
17697 struct LDKCOption_EventZ COption_EventZ_some(struct LDKEvent o);
17698
17699 /**
17700  * Constructs a new COption_EventZ containing nothing
17701  */
17702 struct LDKCOption_EventZ COption_EventZ_none(void);
17703
17704 /**
17705  * Frees any resources associated with the crate::lightning::events::Event, if we are in the Some state
17706  */
17707 void COption_EventZ_free(struct LDKCOption_EventZ _res);
17708
17709 /**
17710  * Creates a new COption_EventZ which has the same data as `orig`
17711  * but with all dynamically-allocated buffers duplicated in new buffers.
17712  */
17713 struct LDKCOption_EventZ COption_EventZ_clone(const struct LDKCOption_EventZ *NONNULL_PTR orig);
17714
17715 /**
17716  * Creates a new CResult_COption_EventZDecodeErrorZ in the success state.
17717  */
17718 struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_ok(struct LDKCOption_EventZ o);
17719
17720 /**
17721  * Creates a new CResult_COption_EventZDecodeErrorZ in the error state.
17722  */
17723 struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_err(struct LDKDecodeError e);
17724
17725 /**
17726  * Checks if the given object is currently in the success state
17727  */
17728 bool CResult_COption_EventZDecodeErrorZ_is_ok(const struct LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR o);
17729
17730 /**
17731  * Frees any resources used by the CResult_COption_EventZDecodeErrorZ.
17732  */
17733 void CResult_COption_EventZDecodeErrorZ_free(struct LDKCResult_COption_EventZDecodeErrorZ _res);
17734
17735 /**
17736  * Creates a new CResult_COption_EventZDecodeErrorZ which has the same data as `orig`
17737  * but with all dynamically-allocated buffers duplicated in new buffers.
17738  */
17739 struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_clone(const struct LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR orig);
17740
17741 /**
17742  * Frees the buffer pointed to by `data` if `datalen` is non-0.
17743  */
17744 void CVec_MessageSendEventZ_free(struct LDKCVec_MessageSendEventZ _res);
17745
17746 /**
17747  * Frees the buffer pointed to by `data` if `datalen` is non-0.
17748  */
17749 void CVec_ChainHashZ_free(struct LDKCVec_ChainHashZ _res);
17750
17751 /**
17752  * Creates a new CResult_PublicKeyErrorZ in the success state.
17753  */
17754 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_ok(struct LDKPublicKey o);
17755
17756 /**
17757  * Creates a new CResult_PublicKeyErrorZ in the error state.
17758  */
17759 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_err(enum LDKSecp256k1Error e);
17760
17761 /**
17762  * Checks if the given object is currently in the success state
17763  */
17764 bool CResult_PublicKeyErrorZ_is_ok(const struct LDKCResult_PublicKeyErrorZ *NONNULL_PTR o);
17765
17766 /**
17767  * Frees any resources used by the CResult_PublicKeyErrorZ.
17768  */
17769 void CResult_PublicKeyErrorZ_free(struct LDKCResult_PublicKeyErrorZ _res);
17770
17771 /**
17772  * Creates a new CResult_PublicKeyErrorZ which has the same data as `orig`
17773  * but with all dynamically-allocated buffers duplicated in new buffers.
17774  */
17775 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_clone(const struct LDKCResult_PublicKeyErrorZ *NONNULL_PTR orig);
17776
17777 /**
17778  * Creates a new CResult_NodeIdDecodeErrorZ in the success state.
17779  */
17780 struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_ok(struct LDKNodeId o);
17781
17782 /**
17783  * Creates a new CResult_NodeIdDecodeErrorZ in the error state.
17784  */
17785 struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_err(struct LDKDecodeError e);
17786
17787 /**
17788  * Checks if the given object is currently in the success state
17789  */
17790 bool CResult_NodeIdDecodeErrorZ_is_ok(const struct LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR o);
17791
17792 /**
17793  * Frees any resources used by the CResult_NodeIdDecodeErrorZ.
17794  */
17795 void CResult_NodeIdDecodeErrorZ_free(struct LDKCResult_NodeIdDecodeErrorZ _res);
17796
17797 /**
17798  * Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig`
17799  * but with all dynamically-allocated buffers duplicated in new buffers.
17800  */
17801 struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_clone(const struct LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR orig);
17802
17803 /**
17804  * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state.
17805  */
17806 struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_ok(struct LDKCOption_NetworkUpdateZ o);
17807
17808 /**
17809  * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state.
17810  */
17811 struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_err(struct LDKDecodeError e);
17812
17813 /**
17814  * Checks if the given object is currently in the success state
17815  */
17816 bool CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(const struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR o);
17817
17818 /**
17819  * Frees any resources used by the CResult_COption_NetworkUpdateZDecodeErrorZ.
17820  */
17821 void CResult_COption_NetworkUpdateZDecodeErrorZ_free(struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res);
17822
17823 /**
17824  * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ which has the same data as `orig`
17825  * but with all dynamically-allocated buffers duplicated in new buffers.
17826  */
17827 struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_clone(const struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR orig);
17828
17829 /**
17830  * Constructs a new COption_UtxoLookupZ containing a crate::lightning::routing::utxo::UtxoLookup
17831  */
17832 struct LDKCOption_UtxoLookupZ COption_UtxoLookupZ_some(struct LDKUtxoLookup o);
17833
17834 /**
17835  * Constructs a new COption_UtxoLookupZ containing nothing
17836  */
17837 struct LDKCOption_UtxoLookupZ COption_UtxoLookupZ_none(void);
17838
17839 /**
17840  * Frees any resources associated with the crate::lightning::routing::utxo::UtxoLookup, if we are in the Some state
17841  */
17842 void COption_UtxoLookupZ_free(struct LDKCOption_UtxoLookupZ _res);
17843
17844 /**
17845  * Creates a new CResult_boolLightningErrorZ in the success state.
17846  */
17847 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_ok(bool o);
17848
17849 /**
17850  * Creates a new CResult_boolLightningErrorZ in the error state.
17851  */
17852 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_err(struct LDKLightningError e);
17853
17854 /**
17855  * Checks if the given object is currently in the success state
17856  */
17857 bool CResult_boolLightningErrorZ_is_ok(const struct LDKCResult_boolLightningErrorZ *NONNULL_PTR o);
17858
17859 /**
17860  * Frees any resources used by the CResult_boolLightningErrorZ.
17861  */
17862 void CResult_boolLightningErrorZ_free(struct LDKCResult_boolLightningErrorZ _res);
17863
17864 /**
17865  * Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
17866  * but with all dynamically-allocated buffers duplicated in new buffers.
17867  */
17868 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_clone(const struct LDKCResult_boolLightningErrorZ *NONNULL_PTR orig);
17869
17870 /**
17871  * Creates a new tuple which has the same data as `orig`
17872  * but with all dynamically-allocated buffers duplicated in new buffers.
17873  */
17874 struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(const struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR orig);
17875
17876 /**
17877  * Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
17878  */
17879 struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(struct LDKChannelAnnouncement a, struct LDKChannelUpdate b, struct LDKChannelUpdate c);
17880
17881 /**
17882  * Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
17883  */
17884 void C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res);
17885
17886 /**
17887  * Constructs a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ containing a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ
17888  */
17889 struct LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ o);
17890
17891 /**
17892  * Constructs a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ containing nothing
17893  */
17894 struct LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none(void);
17895
17896 /**
17897  * Frees any resources associated with the crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ, if we are in the Some state
17898  */
17899 void COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(struct LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res);
17900
17901 /**
17902  * Creates a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ which has the same data as `orig`
17903  * but with all dynamically-allocated buffers duplicated in new buffers.
17904  */
17905 struct LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(const struct LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *NONNULL_PTR orig);
17906
17907 /**
17908  * Creates a new CResult_NoneLightningErrorZ in the success state.
17909  */
17910 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_ok(void);
17911
17912 /**
17913  * Creates a new CResult_NoneLightningErrorZ in the error state.
17914  */
17915 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_err(struct LDKLightningError e);
17916
17917 /**
17918  * Checks if the given object is currently in the success state
17919  */
17920 bool CResult_NoneLightningErrorZ_is_ok(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR o);
17921
17922 /**
17923  * Frees any resources used by the CResult_NoneLightningErrorZ.
17924  */
17925 void CResult_NoneLightningErrorZ_free(struct LDKCResult_NoneLightningErrorZ _res);
17926
17927 /**
17928  * Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
17929  * but with all dynamically-allocated buffers duplicated in new buffers.
17930  */
17931 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_clone(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR orig);
17932
17933 /**
17934  * Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the success state.
17935  */
17936 struct LDKCResult_ChannelUpdateInfoDecodeErrorZ CResult_ChannelUpdateInfoDecodeErrorZ_ok(struct LDKChannelUpdateInfo o);
17937
17938 /**
17939  * Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the error state.
17940  */
17941 struct LDKCResult_ChannelUpdateInfoDecodeErrorZ CResult_ChannelUpdateInfoDecodeErrorZ_err(struct LDKDecodeError e);
17942
17943 /**
17944  * Checks if the given object is currently in the success state
17945  */
17946 bool CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(const struct LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR o);
17947
17948 /**
17949  * Frees any resources used by the CResult_ChannelUpdateInfoDecodeErrorZ.
17950  */
17951 void CResult_ChannelUpdateInfoDecodeErrorZ_free(struct LDKCResult_ChannelUpdateInfoDecodeErrorZ _res);
17952
17953 /**
17954  * Creates a new CResult_ChannelUpdateInfoDecodeErrorZ which has the same data as `orig`
17955  * but with all dynamically-allocated buffers duplicated in new buffers.
17956  */
17957 struct LDKCResult_ChannelUpdateInfoDecodeErrorZ CResult_ChannelUpdateInfoDecodeErrorZ_clone(const struct LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR orig);
17958
17959 /**
17960  * Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
17961  */
17962 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_ok(struct LDKChannelInfo o);
17963
17964 /**
17965  * Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
17966  */
17967 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_err(struct LDKDecodeError e);
17968
17969 /**
17970  * Checks if the given object is currently in the success state
17971  */
17972 bool CResult_ChannelInfoDecodeErrorZ_is_ok(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR o);
17973
17974 /**
17975  * Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
17976  */
17977 void CResult_ChannelInfoDecodeErrorZ_free(struct LDKCResult_ChannelInfoDecodeErrorZ _res);
17978
17979 /**
17980  * Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
17981  * but with all dynamically-allocated buffers duplicated in new buffers.
17982  */
17983 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_clone(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR orig);
17984
17985 /**
17986  * Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
17987  */
17988 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_ok(struct LDKRoutingFees o);
17989
17990 /**
17991  * Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
17992  */
17993 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_err(struct LDKDecodeError e);
17994
17995 /**
17996  * Checks if the given object is currently in the success state
17997  */
17998 bool CResult_RoutingFeesDecodeErrorZ_is_ok(const struct LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR o);
17999
18000 /**
18001  * Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
18002  */
18003 void CResult_RoutingFeesDecodeErrorZ_free(struct LDKCResult_RoutingFeesDecodeErrorZ _res);
18004
18005 /**
18006  * Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
18007  * but with all dynamically-allocated buffers duplicated in new buffers.
18008  */
18009 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_clone(const struct LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR orig);
18010
18011 /**
18012  * Frees the buffer pointed to by `data` if `datalen` is non-0.
18013  */
18014 void CVec_NetAddressZ_free(struct LDKCVec_NetAddressZ _res);
18015
18016 /**
18017  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
18018  */
18019 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_ok(struct LDKNodeAnnouncementInfo o);
18020
18021 /**
18022  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
18023  */
18024 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_err(struct LDKDecodeError e);
18025
18026 /**
18027  * Checks if the given object is currently in the success state
18028  */
18029 bool CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(const struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR o);
18030
18031 /**
18032  * Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
18033  */
18034 void CResult_NodeAnnouncementInfoDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res);
18035
18036 /**
18037  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
18038  * but with all dynamically-allocated buffers duplicated in new buffers.
18039  */
18040 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR orig);
18041
18042 /**
18043  * Creates a new CResult_NodeAliasDecodeErrorZ in the success state.
18044  */
18045 struct LDKCResult_NodeAliasDecodeErrorZ CResult_NodeAliasDecodeErrorZ_ok(struct LDKNodeAlias o);
18046
18047 /**
18048  * Creates a new CResult_NodeAliasDecodeErrorZ in the error state.
18049  */
18050 struct LDKCResult_NodeAliasDecodeErrorZ CResult_NodeAliasDecodeErrorZ_err(struct LDKDecodeError e);
18051
18052 /**
18053  * Checks if the given object is currently in the success state
18054  */
18055 bool CResult_NodeAliasDecodeErrorZ_is_ok(const struct LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR o);
18056
18057 /**
18058  * Frees any resources used by the CResult_NodeAliasDecodeErrorZ.
18059  */
18060 void CResult_NodeAliasDecodeErrorZ_free(struct LDKCResult_NodeAliasDecodeErrorZ _res);
18061
18062 /**
18063  * Creates a new CResult_NodeAliasDecodeErrorZ which has the same data as `orig`
18064  * but with all dynamically-allocated buffers duplicated in new buffers.
18065  */
18066 struct LDKCResult_NodeAliasDecodeErrorZ CResult_NodeAliasDecodeErrorZ_clone(const struct LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR orig);
18067
18068 /**
18069  * Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
18070  */
18071 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_ok(struct LDKNodeInfo o);
18072
18073 /**
18074  * Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
18075  */
18076 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_err(struct LDKDecodeError e);
18077
18078 /**
18079  * Checks if the given object is currently in the success state
18080  */
18081 bool CResult_NodeInfoDecodeErrorZ_is_ok(const struct LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR o);
18082
18083 /**
18084  * Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
18085  */
18086 void CResult_NodeInfoDecodeErrorZ_free(struct LDKCResult_NodeInfoDecodeErrorZ _res);
18087
18088 /**
18089  * Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
18090  * but with all dynamically-allocated buffers duplicated in new buffers.
18091  */
18092 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_clone(const struct LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR orig);
18093
18094 /**
18095  * Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
18096  */
18097 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_ok(struct LDKNetworkGraph o);
18098
18099 /**
18100  * Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
18101  */
18102 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_err(struct LDKDecodeError e);
18103
18104 /**
18105  * Checks if the given object is currently in the success state
18106  */
18107 bool CResult_NetworkGraphDecodeErrorZ_is_ok(const struct LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR o);
18108
18109 /**
18110  * Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
18111  */
18112 void CResult_NetworkGraphDecodeErrorZ_free(struct LDKCResult_NetworkGraphDecodeErrorZ _res);
18113
18114 /**
18115  * Constructs a new COption_CVec_NetAddressZZ containing a crate::c_types::derived::CVec_NetAddressZ
18116  */
18117 struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_some(struct LDKCVec_NetAddressZ o);
18118
18119 /**
18120  * Constructs a new COption_CVec_NetAddressZZ containing nothing
18121  */
18122 struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_none(void);
18123
18124 /**
18125  * Frees any resources associated with the crate::c_types::derived::CVec_NetAddressZ, if we are in the Some state
18126  */
18127 void COption_CVec_NetAddressZZ_free(struct LDKCOption_CVec_NetAddressZZ _res);
18128
18129 /**
18130  * Creates a new COption_CVec_NetAddressZZ which has the same data as `orig`
18131  * but with all dynamically-allocated buffers duplicated in new buffers.
18132  */
18133 struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_clone(const struct LDKCOption_CVec_NetAddressZZ *NONNULL_PTR orig);
18134
18135 /**
18136  * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
18137  */
18138 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(struct LDKDelayedPaymentOutputDescriptor o);
18139
18140 /**
18141  * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
18142  */
18143 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
18144
18145 /**
18146  * Checks if the given object is currently in the success state
18147  */
18148 bool CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR o);
18149
18150 /**
18151  * Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
18152  */
18153 void CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res);
18154
18155 /**
18156  * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
18157  * but with all dynamically-allocated buffers duplicated in new buffers.
18158  */
18159 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
18160
18161 /**
18162  * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
18163  */
18164 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(struct LDKStaticPaymentOutputDescriptor o);
18165
18166 /**
18167  * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
18168  */
18169 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
18170
18171 /**
18172  * Checks if the given object is currently in the success state
18173  */
18174 bool CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR o);
18175
18176 /**
18177  * Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
18178  */
18179 void CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res);
18180
18181 /**
18182  * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
18183  * but with all dynamically-allocated buffers duplicated in new buffers.
18184  */
18185 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
18186
18187 /**
18188  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
18189  */
18190 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_ok(struct LDKSpendableOutputDescriptor o);
18191
18192 /**
18193  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
18194  */
18195 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
18196
18197 /**
18198  * Checks if the given object is currently in the success state
18199  */
18200 bool CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR o);
18201
18202 /**
18203  * Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
18204  */
18205 void CResult_SpendableOutputDescriptorDecodeErrorZ_free(struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res);
18206
18207 /**
18208  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
18209  * but with all dynamically-allocated buffers duplicated in new buffers.
18210  */
18211 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
18212
18213 /**
18214  * Frees the buffer pointed to by `data` if `datalen` is non-0.
18215  */
18216 void CVec_PaymentPreimageZ_free(struct LDKCVec_PaymentPreimageZ _res);
18217
18218 /**
18219  * Creates a new tuple which has the same data as `orig`
18220  * but with all dynamically-allocated buffers duplicated in new buffers.
18221  */
18222 struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_clone(const struct LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR orig);
18223
18224 /**
18225  * Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
18226  */
18227 struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_new(struct LDKSignature a, struct LDKCVec_SignatureZ b);
18228
18229 /**
18230  * Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
18231  */
18232 void C2Tuple_SignatureCVec_SignatureZZ_free(struct LDKC2Tuple_SignatureCVec_SignatureZZ _res);
18233
18234 /**
18235  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
18236  */
18237 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(struct LDKC2Tuple_SignatureCVec_SignatureZZ o);
18238
18239 /**
18240  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
18241  */
18242 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err(void);
18243
18244 /**
18245  * Checks if the given object is currently in the success state
18246  */
18247 bool CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(const struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR o);
18248
18249 /**
18250  * Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
18251  */
18252 void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res);
18253
18254 /**
18255  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
18256  * but with all dynamically-allocated buffers duplicated in new buffers.
18257  */
18258 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(const struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR orig);
18259
18260 /**
18261  * Creates a new CResult_SignatureNoneZ in the success state.
18262  */
18263 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_ok(struct LDKSignature o);
18264
18265 /**
18266  * Creates a new CResult_SignatureNoneZ in the error state.
18267  */
18268 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_err(void);
18269
18270 /**
18271  * Checks if the given object is currently in the success state
18272  */
18273 bool CResult_SignatureNoneZ_is_ok(const struct LDKCResult_SignatureNoneZ *NONNULL_PTR o);
18274
18275 /**
18276  * Frees any resources used by the CResult_SignatureNoneZ.
18277  */
18278 void CResult_SignatureNoneZ_free(struct LDKCResult_SignatureNoneZ _res);
18279
18280 /**
18281  * Creates a new CResult_SignatureNoneZ which has the same data as `orig`
18282  * but with all dynamically-allocated buffers duplicated in new buffers.
18283  */
18284 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_clone(const struct LDKCResult_SignatureNoneZ *NONNULL_PTR orig);
18285
18286 /**
18287  * Creates a new CResult_PublicKeyNoneZ in the success state.
18288  */
18289 struct LDKCResult_PublicKeyNoneZ CResult_PublicKeyNoneZ_ok(struct LDKPublicKey o);
18290
18291 /**
18292  * Creates a new CResult_PublicKeyNoneZ in the error state.
18293  */
18294 struct LDKCResult_PublicKeyNoneZ CResult_PublicKeyNoneZ_err(void);
18295
18296 /**
18297  * Checks if the given object is currently in the success state
18298  */
18299 bool CResult_PublicKeyNoneZ_is_ok(const struct LDKCResult_PublicKeyNoneZ *NONNULL_PTR o);
18300
18301 /**
18302  * Frees any resources used by the CResult_PublicKeyNoneZ.
18303  */
18304 void CResult_PublicKeyNoneZ_free(struct LDKCResult_PublicKeyNoneZ _res);
18305
18306 /**
18307  * Creates a new CResult_PublicKeyNoneZ which has the same data as `orig`
18308  * but with all dynamically-allocated buffers duplicated in new buffers.
18309  */
18310 struct LDKCResult_PublicKeyNoneZ CResult_PublicKeyNoneZ_clone(const struct LDKCResult_PublicKeyNoneZ *NONNULL_PTR orig);
18311
18312 /**
18313  * Constructs a new COption_ScalarZ containing a crate::c_types::BigEndianScalar
18314  */
18315 struct LDKCOption_ScalarZ COption_ScalarZ_some(struct LDKBigEndianScalar o);
18316
18317 /**
18318  * Constructs a new COption_ScalarZ containing nothing
18319  */
18320 struct LDKCOption_ScalarZ COption_ScalarZ_none(void);
18321
18322 /**
18323  * Frees any resources associated with the crate::c_types::BigEndianScalar, if we are in the Some state
18324  */
18325 void COption_ScalarZ_free(struct LDKCOption_ScalarZ _res);
18326
18327 /**
18328  * Creates a new CResult_SharedSecretNoneZ in the success state.
18329  */
18330 struct LDKCResult_SharedSecretNoneZ CResult_SharedSecretNoneZ_ok(struct LDKThirtyTwoBytes o);
18331
18332 /**
18333  * Creates a new CResult_SharedSecretNoneZ in the error state.
18334  */
18335 struct LDKCResult_SharedSecretNoneZ CResult_SharedSecretNoneZ_err(void);
18336
18337 /**
18338  * Checks if the given object is currently in the success state
18339  */
18340 bool CResult_SharedSecretNoneZ_is_ok(const struct LDKCResult_SharedSecretNoneZ *NONNULL_PTR o);
18341
18342 /**
18343  * Frees any resources used by the CResult_SharedSecretNoneZ.
18344  */
18345 void CResult_SharedSecretNoneZ_free(struct LDKCResult_SharedSecretNoneZ _res);
18346
18347 /**
18348  * Creates a new CResult_SharedSecretNoneZ which has the same data as `orig`
18349  * but with all dynamically-allocated buffers duplicated in new buffers.
18350  */
18351 struct LDKCResult_SharedSecretNoneZ CResult_SharedSecretNoneZ_clone(const struct LDKCResult_SharedSecretNoneZ *NONNULL_PTR orig);
18352
18353 /**
18354  * Frees the buffer pointed to by `data` if `datalen` is non-0.
18355  */
18356 void CVec_U5Z_free(struct LDKCVec_U5Z _res);
18357
18358 /**
18359  * Creates a new CResult_RecoverableSignatureNoneZ in the success state.
18360  */
18361 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_ok(struct LDKRecoverableSignature o);
18362
18363 /**
18364  * Creates a new CResult_RecoverableSignatureNoneZ in the error state.
18365  */
18366 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_err(void);
18367
18368 /**
18369  * Checks if the given object is currently in the success state
18370  */
18371 bool CResult_RecoverableSignatureNoneZ_is_ok(const struct LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR o);
18372
18373 /**
18374  * Frees any resources used by the CResult_RecoverableSignatureNoneZ.
18375  */
18376 void CResult_RecoverableSignatureNoneZ_free(struct LDKCResult_RecoverableSignatureNoneZ _res);
18377
18378 /**
18379  * Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
18380  * but with all dynamically-allocated buffers duplicated in new buffers.
18381  */
18382 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_clone(const struct LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR orig);
18383
18384 /**
18385  * Creates a new CResult_WriteableEcdsaChannelSignerDecodeErrorZ in the success state.
18386  */
18387 struct LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(struct LDKWriteableEcdsaChannelSigner o);
18388
18389 /**
18390  * Creates a new CResult_WriteableEcdsaChannelSignerDecodeErrorZ in the error state.
18391  */
18392 struct LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err(struct LDKDecodeError e);
18393
18394 /**
18395  * Checks if the given object is currently in the success state
18396  */
18397 bool CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(const struct LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR o);
18398
18399 /**
18400  * Frees any resources used by the CResult_WriteableEcdsaChannelSignerDecodeErrorZ.
18401  */
18402 void CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(struct LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ _res);
18403
18404 /**
18405  * Frees the buffer pointed to by `data` if `datalen` is non-0.
18406  */
18407 void CVec_CVec_u8ZZ_free(struct LDKCVec_CVec_u8ZZ _res);
18408
18409 /**
18410  * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
18411  */
18412 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_ok(struct LDKCVec_CVec_u8ZZ o);
18413
18414 /**
18415  * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
18416  */
18417 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_err(void);
18418
18419 /**
18420  * Checks if the given object is currently in the success state
18421  */
18422 bool CResult_CVec_CVec_u8ZZNoneZ_is_ok(const struct LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR o);
18423
18424 /**
18425  * Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
18426  */
18427 void CResult_CVec_CVec_u8ZZNoneZ_free(struct LDKCResult_CVec_CVec_u8ZZNoneZ _res);
18428
18429 /**
18430  * Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
18431  * but with all dynamically-allocated buffers duplicated in new buffers.
18432  */
18433 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_clone(const struct LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR orig);
18434
18435 /**
18436  * Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
18437  */
18438 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_ok(struct LDKInMemorySigner o);
18439
18440 /**
18441  * Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
18442  */
18443 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_err(struct LDKDecodeError e);
18444
18445 /**
18446  * Checks if the given object is currently in the success state
18447  */
18448 bool CResult_InMemorySignerDecodeErrorZ_is_ok(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR o);
18449
18450 /**
18451  * Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
18452  */
18453 void CResult_InMemorySignerDecodeErrorZ_free(struct LDKCResult_InMemorySignerDecodeErrorZ _res);
18454
18455 /**
18456  * Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
18457  * but with all dynamically-allocated buffers duplicated in new buffers.
18458  */
18459 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_clone(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR orig);
18460
18461 /**
18462  * Frees the buffer pointed to by `data` if `datalen` is non-0.
18463  */
18464 void CVec_TxOutZ_free(struct LDKCVec_TxOutZ _res);
18465
18466 /**
18467  * Creates a new CResult_TransactionNoneZ in the success state.
18468  */
18469 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_ok(struct LDKTransaction o);
18470
18471 /**
18472  * Creates a new CResult_TransactionNoneZ in the error state.
18473  */
18474 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_err(void);
18475
18476 /**
18477  * Checks if the given object is currently in the success state
18478  */
18479 bool CResult_TransactionNoneZ_is_ok(const struct LDKCResult_TransactionNoneZ *NONNULL_PTR o);
18480
18481 /**
18482  * Frees any resources used by the CResult_TransactionNoneZ.
18483  */
18484 void CResult_TransactionNoneZ_free(struct LDKCResult_TransactionNoneZ _res);
18485
18486 /**
18487  * Creates a new CResult_TransactionNoneZ which has the same data as `orig`
18488  * but with all dynamically-allocated buffers duplicated in new buffers.
18489  */
18490 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_clone(const struct LDKCResult_TransactionNoneZ *NONNULL_PTR orig);
18491
18492 /**
18493  * Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
18494  */
18495 struct LDKC2Tuple_BlockHashChannelMonitorZ C2Tuple_BlockHashChannelMonitorZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelMonitor b);
18496
18497 /**
18498  * Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
18499  */
18500 void C2Tuple_BlockHashChannelMonitorZ_free(struct LDKC2Tuple_BlockHashChannelMonitorZ _res);
18501
18502 /**
18503  * Frees the buffer pointed to by `data` if `datalen` is non-0.
18504  */
18505 void CVec_C2Tuple_BlockHashChannelMonitorZZ_free(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res);
18506
18507 /**
18508  * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
18509  */
18510 struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o);
18511
18512 /**
18513  * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
18514  */
18515 struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(enum LDKIOError e);
18516
18517 /**
18518  * Checks if the given object is currently in the success state
18519  */
18520 bool CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(const struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *NONNULL_PTR o);
18521
18522 /**
18523  * Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
18524  */
18525 void CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res);
18526
18527 /**
18528  * Constructs a new COption_u16Z containing a u16
18529  */
18530 struct LDKCOption_u16Z COption_u16Z_some(uint16_t o);
18531
18532 /**
18533  * Constructs a new COption_u16Z containing nothing
18534  */
18535 struct LDKCOption_u16Z COption_u16Z_none(void);
18536
18537 /**
18538  * Frees any resources associated with the u16, if we are in the Some state
18539  */
18540 void COption_u16Z_free(struct LDKCOption_u16Z _res);
18541
18542 /**
18543  * Creates a new COption_u16Z which has the same data as `orig`
18544  * but with all dynamically-allocated buffers duplicated in new buffers.
18545  */
18546 struct LDKCOption_u16Z COption_u16Z_clone(const struct LDKCOption_u16Z *NONNULL_PTR orig);
18547
18548 /**
18549  * Creates a new CResult__u832APIErrorZ in the success state.
18550  */
18551 struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_ok(struct LDKThirtyTwoBytes o);
18552
18553 /**
18554  * Creates a new CResult__u832APIErrorZ in the error state.
18555  */
18556 struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_err(struct LDKAPIError e);
18557
18558 /**
18559  * Checks if the given object is currently in the success state
18560  */
18561 bool CResult__u832APIErrorZ_is_ok(const struct LDKCResult__u832APIErrorZ *NONNULL_PTR o);
18562
18563 /**
18564  * Frees any resources used by the CResult__u832APIErrorZ.
18565  */
18566 void CResult__u832APIErrorZ_free(struct LDKCResult__u832APIErrorZ _res);
18567
18568 /**
18569  * Creates a new CResult__u832APIErrorZ which has the same data as `orig`
18570  * but with all dynamically-allocated buffers duplicated in new buffers.
18571  */
18572 struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_clone(const struct LDKCResult__u832APIErrorZ *NONNULL_PTR orig);
18573
18574 /**
18575  * Frees the buffer pointed to by `data` if `datalen` is non-0.
18576  */
18577 void CVec_RecentPaymentDetailsZ_free(struct LDKCVec_RecentPaymentDetailsZ _res);
18578
18579 /**
18580  * Creates a new CResult_NonePaymentSendFailureZ in the success state.
18581  */
18582 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_ok(void);
18583
18584 /**
18585  * Creates a new CResult_NonePaymentSendFailureZ in the error state.
18586  */
18587 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
18588
18589 /**
18590  * Checks if the given object is currently in the success state
18591  */
18592 bool CResult_NonePaymentSendFailureZ_is_ok(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR o);
18593
18594 /**
18595  * Frees any resources used by the CResult_NonePaymentSendFailureZ.
18596  */
18597 void CResult_NonePaymentSendFailureZ_free(struct LDKCResult_NonePaymentSendFailureZ _res);
18598
18599 /**
18600  * Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
18601  * but with all dynamically-allocated buffers duplicated in new buffers.
18602  */
18603 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_clone(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR orig);
18604
18605 /**
18606  * Creates a new CResult_NoneRetryableSendFailureZ in the success state.
18607  */
18608 struct LDKCResult_NoneRetryableSendFailureZ CResult_NoneRetryableSendFailureZ_ok(void);
18609
18610 /**
18611  * Creates a new CResult_NoneRetryableSendFailureZ in the error state.
18612  */
18613 struct LDKCResult_NoneRetryableSendFailureZ CResult_NoneRetryableSendFailureZ_err(enum LDKRetryableSendFailure e);
18614
18615 /**
18616  * Checks if the given object is currently in the success state
18617  */
18618 bool CResult_NoneRetryableSendFailureZ_is_ok(const struct LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR o);
18619
18620 /**
18621  * Frees any resources used by the CResult_NoneRetryableSendFailureZ.
18622  */
18623 void CResult_NoneRetryableSendFailureZ_free(struct LDKCResult_NoneRetryableSendFailureZ _res);
18624
18625 /**
18626  * Creates a new CResult_NoneRetryableSendFailureZ which has the same data as `orig`
18627  * but with all dynamically-allocated buffers duplicated in new buffers.
18628  */
18629 struct LDKCResult_NoneRetryableSendFailureZ CResult_NoneRetryableSendFailureZ_clone(const struct LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR orig);
18630
18631 /**
18632  * Creates a new CResult_PaymentHashPaymentSendFailureZ in the success state.
18633  */
18634 struct LDKCResult_PaymentHashPaymentSendFailureZ CResult_PaymentHashPaymentSendFailureZ_ok(struct LDKThirtyTwoBytes o);
18635
18636 /**
18637  * Creates a new CResult_PaymentHashPaymentSendFailureZ in the error state.
18638  */
18639 struct LDKCResult_PaymentHashPaymentSendFailureZ CResult_PaymentHashPaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
18640
18641 /**
18642  * Checks if the given object is currently in the success state
18643  */
18644 bool CResult_PaymentHashPaymentSendFailureZ_is_ok(const struct LDKCResult_PaymentHashPaymentSendFailureZ *NONNULL_PTR o);
18645
18646 /**
18647  * Frees any resources used by the CResult_PaymentHashPaymentSendFailureZ.
18648  */
18649 void CResult_PaymentHashPaymentSendFailureZ_free(struct LDKCResult_PaymentHashPaymentSendFailureZ _res);
18650
18651 /**
18652  * Creates a new CResult_PaymentHashPaymentSendFailureZ which has the same data as `orig`
18653  * but with all dynamically-allocated buffers duplicated in new buffers.
18654  */
18655 struct LDKCResult_PaymentHashPaymentSendFailureZ CResult_PaymentHashPaymentSendFailureZ_clone(const struct LDKCResult_PaymentHashPaymentSendFailureZ *NONNULL_PTR orig);
18656
18657 /**
18658  * Creates a new CResult_PaymentHashRetryableSendFailureZ in the success state.
18659  */
18660 struct LDKCResult_PaymentHashRetryableSendFailureZ CResult_PaymentHashRetryableSendFailureZ_ok(struct LDKThirtyTwoBytes o);
18661
18662 /**
18663  * Creates a new CResult_PaymentHashRetryableSendFailureZ in the error state.
18664  */
18665 struct LDKCResult_PaymentHashRetryableSendFailureZ CResult_PaymentHashRetryableSendFailureZ_err(enum LDKRetryableSendFailure e);
18666
18667 /**
18668  * Checks if the given object is currently in the success state
18669  */
18670 bool CResult_PaymentHashRetryableSendFailureZ_is_ok(const struct LDKCResult_PaymentHashRetryableSendFailureZ *NONNULL_PTR o);
18671
18672 /**
18673  * Frees any resources used by the CResult_PaymentHashRetryableSendFailureZ.
18674  */
18675 void CResult_PaymentHashRetryableSendFailureZ_free(struct LDKCResult_PaymentHashRetryableSendFailureZ _res);
18676
18677 /**
18678  * Creates a new CResult_PaymentHashRetryableSendFailureZ which has the same data as `orig`
18679  * but with all dynamically-allocated buffers duplicated in new buffers.
18680  */
18681 struct LDKCResult_PaymentHashRetryableSendFailureZ CResult_PaymentHashRetryableSendFailureZ_clone(const struct LDKCResult_PaymentHashRetryableSendFailureZ *NONNULL_PTR orig);
18682
18683 /**
18684  * Creates a new tuple which has the same data as `orig`
18685  * but with all dynamically-allocated buffers duplicated in new buffers.
18686  */
18687 struct LDKC2Tuple_PaymentHashPaymentIdZ C2Tuple_PaymentHashPaymentIdZ_clone(const struct LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR orig);
18688
18689 /**
18690  * Creates a new C2Tuple_PaymentHashPaymentIdZ from the contained elements.
18691  */
18692 struct LDKC2Tuple_PaymentHashPaymentIdZ C2Tuple_PaymentHashPaymentIdZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b);
18693
18694 /**
18695  * Frees any resources used by the C2Tuple_PaymentHashPaymentIdZ.
18696  */
18697 void C2Tuple_PaymentHashPaymentIdZ_free(struct LDKC2Tuple_PaymentHashPaymentIdZ _res);
18698
18699 /**
18700  * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the success state.
18701  */
18702 struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(struct LDKC2Tuple_PaymentHashPaymentIdZ o);
18703
18704 /**
18705  * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the error state.
18706  */
18707 struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
18708
18709 /**
18710  * Checks if the given object is currently in the success state
18711  */
18712 bool CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(const struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR o);
18713
18714 /**
18715  * Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.
18716  */
18717 void CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res);
18718
18719 /**
18720  * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ which has the same data as `orig`
18721  * but with all dynamically-allocated buffers duplicated in new buffers.
18722  */
18723 struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR orig);
18724
18725 /**
18726  * Frees the buffer pointed to by `data` if `datalen` is non-0.
18727  */
18728 void CVec_ThirtyTwoBytesZ_free(struct LDKCVec_ThirtyTwoBytesZ _res);
18729
18730 /**
18731  * Creates a new tuple which has the same data as `orig`
18732  * but with all dynamically-allocated buffers duplicated in new buffers.
18733  */
18734 struct LDKC2Tuple_PaymentHashPaymentSecretZ C2Tuple_PaymentHashPaymentSecretZ_clone(const struct LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR orig);
18735
18736 /**
18737  * Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
18738  */
18739 struct LDKC2Tuple_PaymentHashPaymentSecretZ C2Tuple_PaymentHashPaymentSecretZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b);
18740
18741 /**
18742  * Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
18743  */
18744 void C2Tuple_PaymentHashPaymentSecretZ_free(struct LDKC2Tuple_PaymentHashPaymentSecretZ _res);
18745
18746 /**
18747  * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the success state.
18748  */
18749 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(struct LDKC2Tuple_PaymentHashPaymentSecretZ o);
18750
18751 /**
18752  * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the error state.
18753  */
18754 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err(void);
18755
18756 /**
18757  * Checks if the given object is currently in the success state
18758  */
18759 bool CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR o);
18760
18761 /**
18762  * Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ.
18763  */
18764 void CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ _res);
18765
18766 /**
18767  * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ which has the same data as `orig`
18768  * but with all dynamically-allocated buffers duplicated in new buffers.
18769  */
18770 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR orig);
18771
18772 /**
18773  * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the success state.
18774  */
18775 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(struct LDKC2Tuple_PaymentHashPaymentSecretZ o);
18776
18777 /**
18778  * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the error state.
18779  */
18780 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(struct LDKAPIError e);
18781
18782 /**
18783  * Checks if the given object is currently in the success state
18784  */
18785 bool CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR o);
18786
18787 /**
18788  * Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ.
18789  */
18790 void CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ _res);
18791
18792 /**
18793  * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ which has the same data as `orig`
18794  * but with all dynamically-allocated buffers duplicated in new buffers.
18795  */
18796 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR orig);
18797
18798 /**
18799  * Creates a new CResult_PaymentSecretNoneZ in the success state.
18800  */
18801 struct LDKCResult_PaymentSecretNoneZ CResult_PaymentSecretNoneZ_ok(struct LDKThirtyTwoBytes o);
18802
18803 /**
18804  * Creates a new CResult_PaymentSecretNoneZ in the error state.
18805  */
18806 struct LDKCResult_PaymentSecretNoneZ CResult_PaymentSecretNoneZ_err(void);
18807
18808 /**
18809  * Checks if the given object is currently in the success state
18810  */
18811 bool CResult_PaymentSecretNoneZ_is_ok(const struct LDKCResult_PaymentSecretNoneZ *NONNULL_PTR o);
18812
18813 /**
18814  * Frees any resources used by the CResult_PaymentSecretNoneZ.
18815  */
18816 void CResult_PaymentSecretNoneZ_free(struct LDKCResult_PaymentSecretNoneZ _res);
18817
18818 /**
18819  * Creates a new CResult_PaymentSecretNoneZ which has the same data as `orig`
18820  * but with all dynamically-allocated buffers duplicated in new buffers.
18821  */
18822 struct LDKCResult_PaymentSecretNoneZ CResult_PaymentSecretNoneZ_clone(const struct LDKCResult_PaymentSecretNoneZ *NONNULL_PTR orig);
18823
18824 /**
18825  * Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
18826  */
18827 struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_ok(struct LDKThirtyTwoBytes o);
18828
18829 /**
18830  * Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
18831  */
18832 struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_err(struct LDKAPIError e);
18833
18834 /**
18835  * Checks if the given object is currently in the success state
18836  */
18837 bool CResult_PaymentSecretAPIErrorZ_is_ok(const struct LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR o);
18838
18839 /**
18840  * Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
18841  */
18842 void CResult_PaymentSecretAPIErrorZ_free(struct LDKCResult_PaymentSecretAPIErrorZ _res);
18843
18844 /**
18845  * Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig`
18846  * but with all dynamically-allocated buffers duplicated in new buffers.
18847  */
18848 struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_clone(const struct LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR orig);
18849
18850 /**
18851  * Creates a new CResult_PaymentPreimageAPIErrorZ in the success state.
18852  */
18853 struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_ok(struct LDKThirtyTwoBytes o);
18854
18855 /**
18856  * Creates a new CResult_PaymentPreimageAPIErrorZ in the error state.
18857  */
18858 struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_err(struct LDKAPIError e);
18859
18860 /**
18861  * Checks if the given object is currently in the success state
18862  */
18863 bool CResult_PaymentPreimageAPIErrorZ_is_ok(const struct LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR o);
18864
18865 /**
18866  * Frees any resources used by the CResult_PaymentPreimageAPIErrorZ.
18867  */
18868 void CResult_PaymentPreimageAPIErrorZ_free(struct LDKCResult_PaymentPreimageAPIErrorZ _res);
18869
18870 /**
18871  * Creates a new CResult_PaymentPreimageAPIErrorZ which has the same data as `orig`
18872  * but with all dynamically-allocated buffers duplicated in new buffers.
18873  */
18874 struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_clone(const struct LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR orig);
18875
18876 /**
18877  * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the success state.
18878  */
18879 struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(struct LDKCounterpartyForwardingInfo o);
18880
18881 /**
18882  * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the error state.
18883  */
18884 struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_err(struct LDKDecodeError e);
18885
18886 /**
18887  * Checks if the given object is currently in the success state
18888  */
18889 bool CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(const struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR o);
18890
18891 /**
18892  * Frees any resources used by the CResult_CounterpartyForwardingInfoDecodeErrorZ.
18893  */
18894 void CResult_CounterpartyForwardingInfoDecodeErrorZ_free(struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res);
18895
18896 /**
18897  * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ which has the same data as `orig`
18898  * but with all dynamically-allocated buffers duplicated in new buffers.
18899  */
18900 struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(const struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR orig);
18901
18902 /**
18903  * Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the success state.
18904  */
18905 struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_ok(struct LDKChannelCounterparty o);
18906
18907 /**
18908  * Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the error state.
18909  */
18910 struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_err(struct LDKDecodeError e);
18911
18912 /**
18913  * Checks if the given object is currently in the success state
18914  */
18915 bool CResult_ChannelCounterpartyDecodeErrorZ_is_ok(const struct LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR o);
18916
18917 /**
18918  * Frees any resources used by the CResult_ChannelCounterpartyDecodeErrorZ.
18919  */
18920 void CResult_ChannelCounterpartyDecodeErrorZ_free(struct LDKCResult_ChannelCounterpartyDecodeErrorZ _res);
18921
18922 /**
18923  * Creates a new CResult_ChannelCounterpartyDecodeErrorZ which has the same data as `orig`
18924  * but with all dynamically-allocated buffers duplicated in new buffers.
18925  */
18926 struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_clone(const struct LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR orig);
18927
18928 /**
18929  * Creates a new CResult_ChannelDetailsDecodeErrorZ in the success state.
18930  */
18931 struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_ok(struct LDKChannelDetails o);
18932
18933 /**
18934  * Creates a new CResult_ChannelDetailsDecodeErrorZ in the error state.
18935  */
18936 struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_err(struct LDKDecodeError e);
18937
18938 /**
18939  * Checks if the given object is currently in the success state
18940  */
18941 bool CResult_ChannelDetailsDecodeErrorZ_is_ok(const struct LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR o);
18942
18943 /**
18944  * Frees any resources used by the CResult_ChannelDetailsDecodeErrorZ.
18945  */
18946 void CResult_ChannelDetailsDecodeErrorZ_free(struct LDKCResult_ChannelDetailsDecodeErrorZ _res);
18947
18948 /**
18949  * Creates a new CResult_ChannelDetailsDecodeErrorZ which has the same data as `orig`
18950  * but with all dynamically-allocated buffers duplicated in new buffers.
18951  */
18952 struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_clone(const struct LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR orig);
18953
18954 /**
18955  * Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the success state.
18956  */
18957 struct LDKCResult_PhantomRouteHintsDecodeErrorZ CResult_PhantomRouteHintsDecodeErrorZ_ok(struct LDKPhantomRouteHints o);
18958
18959 /**
18960  * Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the error state.
18961  */
18962 struct LDKCResult_PhantomRouteHintsDecodeErrorZ CResult_PhantomRouteHintsDecodeErrorZ_err(struct LDKDecodeError e);
18963
18964 /**
18965  * Checks if the given object is currently in the success state
18966  */
18967 bool CResult_PhantomRouteHintsDecodeErrorZ_is_ok(const struct LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR o);
18968
18969 /**
18970  * Frees any resources used by the CResult_PhantomRouteHintsDecodeErrorZ.
18971  */
18972 void CResult_PhantomRouteHintsDecodeErrorZ_free(struct LDKCResult_PhantomRouteHintsDecodeErrorZ _res);
18973
18974 /**
18975  * Creates a new CResult_PhantomRouteHintsDecodeErrorZ which has the same data as `orig`
18976  * but with all dynamically-allocated buffers duplicated in new buffers.
18977  */
18978 struct LDKCResult_PhantomRouteHintsDecodeErrorZ CResult_PhantomRouteHintsDecodeErrorZ_clone(const struct LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR orig);
18979
18980 /**
18981  * Frees the buffer pointed to by `data` if `datalen` is non-0.
18982  */
18983 void CVec_ChannelMonitorZ_free(struct LDKCVec_ChannelMonitorZ _res);
18984
18985 /**
18986  * Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
18987  */
18988 struct LDKC2Tuple_BlockHashChannelManagerZ C2Tuple_BlockHashChannelManagerZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelManager b);
18989
18990 /**
18991  * Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
18992  */
18993 void C2Tuple_BlockHashChannelManagerZ_free(struct LDKC2Tuple_BlockHashChannelManagerZ _res);
18994
18995 /**
18996  * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
18997  */
18998 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelManagerZ o);
18999
19000 /**
19001  * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
19002  */
19003 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(struct LDKDecodeError e);
19004
19005 /**
19006  * Checks if the given object is currently in the success state
19007  */
19008 bool CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(const struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR o);
19009
19010 /**
19011  * Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
19012  */
19013 void CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res);
19014
19015 /**
19016  * Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
19017  */
19018 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_ok(struct LDKChannelConfig o);
19019
19020 /**
19021  * Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
19022  */
19023 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_err(struct LDKDecodeError e);
19024
19025 /**
19026  * Checks if the given object is currently in the success state
19027  */
19028 bool CResult_ChannelConfigDecodeErrorZ_is_ok(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR o);
19029
19030 /**
19031  * Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
19032  */
19033 void CResult_ChannelConfigDecodeErrorZ_free(struct LDKCResult_ChannelConfigDecodeErrorZ _res);
19034
19035 /**
19036  * Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
19037  * but with all dynamically-allocated buffers duplicated in new buffers.
19038  */
19039 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_clone(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR orig);
19040
19041 /**
19042  * Constructs a new COption_APIErrorZ containing a crate::lightning::util::errors::APIError
19043  */
19044 struct LDKCOption_APIErrorZ COption_APIErrorZ_some(struct LDKAPIError o);
19045
19046 /**
19047  * Constructs a new COption_APIErrorZ containing nothing
19048  */
19049 struct LDKCOption_APIErrorZ COption_APIErrorZ_none(void);
19050
19051 /**
19052  * Frees any resources associated with the crate::lightning::util::errors::APIError, if we are in the Some state
19053  */
19054 void COption_APIErrorZ_free(struct LDKCOption_APIErrorZ _res);
19055
19056 /**
19057  * Creates a new COption_APIErrorZ which has the same data as `orig`
19058  * but with all dynamically-allocated buffers duplicated in new buffers.
19059  */
19060 struct LDKCOption_APIErrorZ COption_APIErrorZ_clone(const struct LDKCOption_APIErrorZ *NONNULL_PTR orig);
19061
19062 /**
19063  * Creates a new CResult_COption_APIErrorZDecodeErrorZ in the success state.
19064  */
19065 struct LDKCResult_COption_APIErrorZDecodeErrorZ CResult_COption_APIErrorZDecodeErrorZ_ok(struct LDKCOption_APIErrorZ o);
19066
19067 /**
19068  * Creates a new CResult_COption_APIErrorZDecodeErrorZ in the error state.
19069  */
19070 struct LDKCResult_COption_APIErrorZDecodeErrorZ CResult_COption_APIErrorZDecodeErrorZ_err(struct LDKDecodeError e);
19071
19072 /**
19073  * Checks if the given object is currently in the success state
19074  */
19075 bool CResult_COption_APIErrorZDecodeErrorZ_is_ok(const struct LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR o);
19076
19077 /**
19078  * Frees any resources used by the CResult_COption_APIErrorZDecodeErrorZ.
19079  */
19080 void CResult_COption_APIErrorZDecodeErrorZ_free(struct LDKCResult_COption_APIErrorZDecodeErrorZ _res);
19081
19082 /**
19083  * Creates a new CResult_COption_APIErrorZDecodeErrorZ which has the same data as `orig`
19084  * but with all dynamically-allocated buffers duplicated in new buffers.
19085  */
19086 struct LDKCResult_COption_APIErrorZDecodeErrorZ CResult_COption_APIErrorZDecodeErrorZ_clone(const struct LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR orig);
19087
19088 /**
19089  * Creates a new CResult_UntrustedStringDecodeErrorZ in the success state.
19090  */
19091 struct LDKCResult_UntrustedStringDecodeErrorZ CResult_UntrustedStringDecodeErrorZ_ok(struct LDKUntrustedString o);
19092
19093 /**
19094  * Creates a new CResult_UntrustedStringDecodeErrorZ in the error state.
19095  */
19096 struct LDKCResult_UntrustedStringDecodeErrorZ CResult_UntrustedStringDecodeErrorZ_err(struct LDKDecodeError e);
19097
19098 /**
19099  * Checks if the given object is currently in the success state
19100  */
19101 bool CResult_UntrustedStringDecodeErrorZ_is_ok(const struct LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR o);
19102
19103 /**
19104  * Frees any resources used by the CResult_UntrustedStringDecodeErrorZ.
19105  */
19106 void CResult_UntrustedStringDecodeErrorZ_free(struct LDKCResult_UntrustedStringDecodeErrorZ _res);
19107
19108 /**
19109  * Creates a new CResult_UntrustedStringDecodeErrorZ which has the same data as `orig`
19110  * but with all dynamically-allocated buffers duplicated in new buffers.
19111  */
19112 struct LDKCResult_UntrustedStringDecodeErrorZ CResult_UntrustedStringDecodeErrorZ_clone(const struct LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR orig);
19113
19114 /**
19115  * Creates a new CResult_OutPointDecodeErrorZ in the success state.
19116  */
19117 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_ok(struct LDKOutPoint o);
19118
19119 /**
19120  * Creates a new CResult_OutPointDecodeErrorZ in the error state.
19121  */
19122 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_err(struct LDKDecodeError e);
19123
19124 /**
19125  * Checks if the given object is currently in the success state
19126  */
19127 bool CResult_OutPointDecodeErrorZ_is_ok(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR o);
19128
19129 /**
19130  * Frees any resources used by the CResult_OutPointDecodeErrorZ.
19131  */
19132 void CResult_OutPointDecodeErrorZ_free(struct LDKCResult_OutPointDecodeErrorZ _res);
19133
19134 /**
19135  * Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
19136  * but with all dynamically-allocated buffers duplicated in new buffers.
19137  */
19138 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_clone(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR orig);
19139
19140 /**
19141  * Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
19142  */
19143 struct LDKCOption_TypeZ COption_TypeZ_some(struct LDKType o);
19144
19145 /**
19146  * Constructs a new COption_TypeZ containing nothing
19147  */
19148 struct LDKCOption_TypeZ COption_TypeZ_none(void);
19149
19150 /**
19151  * Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state
19152  */
19153 void COption_TypeZ_free(struct LDKCOption_TypeZ _res);
19154
19155 /**
19156  * Creates a new CResult_COption_TypeZDecodeErrorZ in the success state.
19157  */
19158 struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_ok(struct LDKCOption_TypeZ o);
19159
19160 /**
19161  * Creates a new CResult_COption_TypeZDecodeErrorZ in the error state.
19162  */
19163 struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_err(struct LDKDecodeError e);
19164
19165 /**
19166  * Checks if the given object is currently in the success state
19167  */
19168 bool CResult_COption_TypeZDecodeErrorZ_is_ok(const struct LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR o);
19169
19170 /**
19171  * Frees any resources used by the CResult_COption_TypeZDecodeErrorZ.
19172  */
19173 void CResult_COption_TypeZDecodeErrorZ_free(struct LDKCResult_COption_TypeZDecodeErrorZ _res);
19174
19175 /**
19176  * Creates a new CResult_PaymentIdPaymentErrorZ in the success state.
19177  */
19178 struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_ok(struct LDKThirtyTwoBytes o);
19179
19180 /**
19181  * Creates a new CResult_PaymentIdPaymentErrorZ in the error state.
19182  */
19183 struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_err(struct LDKPaymentError e);
19184
19185 /**
19186  * Checks if the given object is currently in the success state
19187  */
19188 bool CResult_PaymentIdPaymentErrorZ_is_ok(const struct LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR o);
19189
19190 /**
19191  * Frees any resources used by the CResult_PaymentIdPaymentErrorZ.
19192  */
19193 void CResult_PaymentIdPaymentErrorZ_free(struct LDKCResult_PaymentIdPaymentErrorZ _res);
19194
19195 /**
19196  * Creates a new CResult_PaymentIdPaymentErrorZ which has the same data as `orig`
19197  * but with all dynamically-allocated buffers duplicated in new buffers.
19198  */
19199 struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_clone(const struct LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR orig);
19200
19201 /**
19202  * Creates a new CResult_NonePaymentErrorZ in the success state.
19203  */
19204 struct LDKCResult_NonePaymentErrorZ CResult_NonePaymentErrorZ_ok(void);
19205
19206 /**
19207  * Creates a new CResult_NonePaymentErrorZ in the error state.
19208  */
19209 struct LDKCResult_NonePaymentErrorZ CResult_NonePaymentErrorZ_err(struct LDKPaymentError e);
19210
19211 /**
19212  * Checks if the given object is currently in the success state
19213  */
19214 bool CResult_NonePaymentErrorZ_is_ok(const struct LDKCResult_NonePaymentErrorZ *NONNULL_PTR o);
19215
19216 /**
19217  * Frees any resources used by the CResult_NonePaymentErrorZ.
19218  */
19219 void CResult_NonePaymentErrorZ_free(struct LDKCResult_NonePaymentErrorZ _res);
19220
19221 /**
19222  * Creates a new CResult_NonePaymentErrorZ which has the same data as `orig`
19223  * but with all dynamically-allocated buffers duplicated in new buffers.
19224  */
19225 struct LDKCResult_NonePaymentErrorZ CResult_NonePaymentErrorZ_clone(const struct LDKCResult_NonePaymentErrorZ *NONNULL_PTR orig);
19226
19227 /**
19228  * Creates a new CResult_StringErrorZ in the success state.
19229  */
19230 struct LDKCResult_StringErrorZ CResult_StringErrorZ_ok(struct LDKStr o);
19231
19232 /**
19233  * Creates a new CResult_StringErrorZ in the error state.
19234  */
19235 struct LDKCResult_StringErrorZ CResult_StringErrorZ_err(enum LDKSecp256k1Error e);
19236
19237 /**
19238  * Checks if the given object is currently in the success state
19239  */
19240 bool CResult_StringErrorZ_is_ok(const struct LDKCResult_StringErrorZ *NONNULL_PTR o);
19241
19242 /**
19243  * Frees any resources used by the CResult_StringErrorZ.
19244  */
19245 void CResult_StringErrorZ_free(struct LDKCResult_StringErrorZ _res);
19246
19247 /**
19248  * Creates a new CResult_StringErrorZ which has the same data as `orig`
19249  * but with all dynamically-allocated buffers duplicated in new buffers.
19250  */
19251 struct LDKCResult_StringErrorZ CResult_StringErrorZ_clone(const struct LDKCResult_StringErrorZ *NONNULL_PTR orig);
19252
19253 /**
19254  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
19255  */
19256 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_ok(struct LDKChannelMonitorUpdate o);
19257
19258 /**
19259  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
19260  */
19261 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_err(struct LDKDecodeError e);
19262
19263 /**
19264  * Checks if the given object is currently in the success state
19265  */
19266 bool CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR o);
19267
19268 /**
19269  * Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
19270  */
19271 void CResult_ChannelMonitorUpdateDecodeErrorZ_free(struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res);
19272
19273 /**
19274  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
19275  * but with all dynamically-allocated buffers duplicated in new buffers.
19276  */
19277 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR orig);
19278
19279 /**
19280  * Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent
19281  */
19282 struct LDKCOption_MonitorEventZ COption_MonitorEventZ_some(struct LDKMonitorEvent o);
19283
19284 /**
19285  * Constructs a new COption_MonitorEventZ containing nothing
19286  */
19287 struct LDKCOption_MonitorEventZ COption_MonitorEventZ_none(void);
19288
19289 /**
19290  * Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state
19291  */
19292 void COption_MonitorEventZ_free(struct LDKCOption_MonitorEventZ _res);
19293
19294 /**
19295  * Creates a new COption_MonitorEventZ which has the same data as `orig`
19296  * but with all dynamically-allocated buffers duplicated in new buffers.
19297  */
19298 struct LDKCOption_MonitorEventZ COption_MonitorEventZ_clone(const struct LDKCOption_MonitorEventZ *NONNULL_PTR orig);
19299
19300 /**
19301  * Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state.
19302  */
19303 struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_ok(struct LDKCOption_MonitorEventZ o);
19304
19305 /**
19306  * Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state.
19307  */
19308 struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_err(struct LDKDecodeError e);
19309
19310 /**
19311  * Checks if the given object is currently in the success state
19312  */
19313 bool CResult_COption_MonitorEventZDecodeErrorZ_is_ok(const struct LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR o);
19314
19315 /**
19316  * Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ.
19317  */
19318 void CResult_COption_MonitorEventZDecodeErrorZ_free(struct LDKCResult_COption_MonitorEventZDecodeErrorZ _res);
19319
19320 /**
19321  * Creates a new CResult_COption_MonitorEventZDecodeErrorZ which has the same data as `orig`
19322  * but with all dynamically-allocated buffers duplicated in new buffers.
19323  */
19324 struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_clone(const struct LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR orig);
19325
19326 /**
19327  * Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
19328  */
19329 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_ok(struct LDKHTLCUpdate o);
19330
19331 /**
19332  * Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
19333  */
19334 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_err(struct LDKDecodeError e);
19335
19336 /**
19337  * Checks if the given object is currently in the success state
19338  */
19339 bool CResult_HTLCUpdateDecodeErrorZ_is_ok(const struct LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR o);
19340
19341 /**
19342  * Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
19343  */
19344 void CResult_HTLCUpdateDecodeErrorZ_free(struct LDKCResult_HTLCUpdateDecodeErrorZ _res);
19345
19346 /**
19347  * Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
19348  * but with all dynamically-allocated buffers duplicated in new buffers.
19349  */
19350 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_clone(const struct LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR orig);
19351
19352 /**
19353  * Creates a new tuple which has the same data as `orig`
19354  * but with all dynamically-allocated buffers duplicated in new buffers.
19355  */
19356 struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_clone(const struct LDKC2Tuple_OutPointScriptZ *NONNULL_PTR orig);
19357
19358 /**
19359  * Creates a new C2Tuple_OutPointScriptZ from the contained elements.
19360  */
19361 struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_new(struct LDKOutPoint a, struct LDKCVec_u8Z b);
19362
19363 /**
19364  * Frees any resources used by the C2Tuple_OutPointScriptZ.
19365  */
19366 void C2Tuple_OutPointScriptZ_free(struct LDKC2Tuple_OutPointScriptZ _res);
19367
19368 /**
19369  * Creates a new tuple which has the same data as `orig`
19370  * but with all dynamically-allocated buffers duplicated in new buffers.
19371  */
19372 struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_clone(const struct LDKC2Tuple_u32ScriptZ *NONNULL_PTR orig);
19373
19374 /**
19375  * Creates a new C2Tuple_u32ScriptZ from the contained elements.
19376  */
19377 struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_new(uint32_t a, struct LDKCVec_u8Z b);
19378
19379 /**
19380  * Frees any resources used by the C2Tuple_u32ScriptZ.
19381  */
19382 void C2Tuple_u32ScriptZ_free(struct LDKC2Tuple_u32ScriptZ _res);
19383
19384 /**
19385  * Frees the buffer pointed to by `data` if `datalen` is non-0.
19386  */
19387 void CVec_C2Tuple_u32ScriptZZ_free(struct LDKCVec_C2Tuple_u32ScriptZZ _res);
19388
19389 /**
19390  * Creates a new tuple which has the same data as `orig`
19391  * but with all dynamically-allocated buffers duplicated in new buffers.
19392  */
19393 struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(const struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR orig);
19394
19395 /**
19396  * Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
19397  */
19398 struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32ScriptZZ b);
19399
19400 /**
19401  * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
19402  */
19403 void C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res);
19404
19405 /**
19406  * Frees the buffer pointed to by `data` if `datalen` is non-0.
19407  */
19408 void CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res);
19409
19410 /**
19411  * Frees the buffer pointed to by `data` if `datalen` is non-0.
19412  */
19413 void CVec_EventZ_free(struct LDKCVec_EventZ _res);
19414
19415 /**
19416  * Frees the buffer pointed to by `data` if `datalen` is non-0.
19417  */
19418 void CVec_TransactionZ_free(struct LDKCVec_TransactionZ _res);
19419
19420 /**
19421  * Creates a new tuple which has the same data as `orig`
19422  * but with all dynamically-allocated buffers duplicated in new buffers.
19423  */
19424 struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_clone(const struct LDKC2Tuple_u32TxOutZ *NONNULL_PTR orig);
19425
19426 /**
19427  * Creates a new C2Tuple_u32TxOutZ from the contained elements.
19428  */
19429 struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_new(uint32_t a, struct LDKTxOut b);
19430
19431 /**
19432  * Frees any resources used by the C2Tuple_u32TxOutZ.
19433  */
19434 void C2Tuple_u32TxOutZ_free(struct LDKC2Tuple_u32TxOutZ _res);
19435
19436 /**
19437  * Frees the buffer pointed to by `data` if `datalen` is non-0.
19438  */
19439 void CVec_C2Tuple_u32TxOutZZ_free(struct LDKCVec_C2Tuple_u32TxOutZZ _res);
19440
19441 /**
19442  * Creates a new tuple which has the same data as `orig`
19443  * but with all dynamically-allocated buffers duplicated in new buffers.
19444  */
19445 struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(const struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR orig);
19446
19447 /**
19448  * Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
19449  */
19450 struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32TxOutZZ b);
19451
19452 /**
19453  * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
19454  */
19455 void C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res);
19456
19457 /**
19458  * Frees the buffer pointed to by `data` if `datalen` is non-0.
19459  */
19460 void CVec_TransactionOutputsZ_free(struct LDKCVec_TransactionOutputsZ _res);
19461
19462 /**
19463  * Frees the buffer pointed to by `data` if `datalen` is non-0.
19464  */
19465 void CVec_BalanceZ_free(struct LDKCVec_BalanceZ _res);
19466
19467 /**
19468  * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
19469  */
19470 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelMonitorZ o);
19471
19472 /**
19473  * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
19474  */
19475 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(struct LDKDecodeError e);
19476
19477 /**
19478  * Checks if the given object is currently in the success state
19479  */
19480 bool CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(const struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR o);
19481
19482 /**
19483  * Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
19484  */
19485 void CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res);
19486
19487 /**
19488  * Creates a new C2Tuple_PublicKeyTypeZ from the contained elements.
19489  */
19490 struct LDKC2Tuple_PublicKeyTypeZ C2Tuple_PublicKeyTypeZ_new(struct LDKPublicKey a, struct LDKType b);
19491
19492 /**
19493  * Frees any resources used by the C2Tuple_PublicKeyTypeZ.
19494  */
19495 void C2Tuple_PublicKeyTypeZ_free(struct LDKC2Tuple_PublicKeyTypeZ _res);
19496
19497 /**
19498  * Frees the buffer pointed to by `data` if `datalen` is non-0.
19499  */
19500 void CVec_C2Tuple_PublicKeyTypeZZ_free(struct LDKCVec_C2Tuple_PublicKeyTypeZZ _res);
19501
19502 /**
19503  * Constructs a new COption_CustomOnionMessageContentsZ containing a crate::lightning::onion_message::packet::CustomOnionMessageContents
19504  */
19505 struct LDKCOption_CustomOnionMessageContentsZ COption_CustomOnionMessageContentsZ_some(struct LDKCustomOnionMessageContents o);
19506
19507 /**
19508  * Constructs a new COption_CustomOnionMessageContentsZ containing nothing
19509  */
19510 struct LDKCOption_CustomOnionMessageContentsZ COption_CustomOnionMessageContentsZ_none(void);
19511
19512 /**
19513  * Frees any resources associated with the crate::lightning::onion_message::packet::CustomOnionMessageContents, if we are in the Some state
19514  */
19515 void COption_CustomOnionMessageContentsZ_free(struct LDKCOption_CustomOnionMessageContentsZ _res);
19516
19517 /**
19518  * Creates a new CResult_COption_CustomOnionMessageContentsZDecodeErrorZ in the success state.
19519  */
19520 struct LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok(struct LDKCOption_CustomOnionMessageContentsZ o);
19521
19522 /**
19523  * Creates a new CResult_COption_CustomOnionMessageContentsZDecodeErrorZ in the error state.
19524  */
19525 struct LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err(struct LDKDecodeError e);
19526
19527 /**
19528  * Checks if the given object is currently in the success state
19529  */
19530 bool CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok(const struct LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ *NONNULL_PTR o);
19531
19532 /**
19533  * Frees any resources used by the CResult_COption_CustomOnionMessageContentsZDecodeErrorZ.
19534  */
19535 void CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free(struct LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ _res);
19536
19537 /**
19538  * Constructs a new COption_NetAddressZ containing a crate::lightning::ln::msgs::NetAddress
19539  */
19540 struct LDKCOption_NetAddressZ COption_NetAddressZ_some(struct LDKNetAddress o);
19541
19542 /**
19543  * Constructs a new COption_NetAddressZ containing nothing
19544  */
19545 struct LDKCOption_NetAddressZ COption_NetAddressZ_none(void);
19546
19547 /**
19548  * Frees any resources associated with the crate::lightning::ln::msgs::NetAddress, if we are in the Some state
19549  */
19550 void COption_NetAddressZ_free(struct LDKCOption_NetAddressZ _res);
19551
19552 /**
19553  * Creates a new COption_NetAddressZ which has the same data as `orig`
19554  * but with all dynamically-allocated buffers duplicated in new buffers.
19555  */
19556 struct LDKCOption_NetAddressZ COption_NetAddressZ_clone(const struct LDKCOption_NetAddressZ *NONNULL_PTR orig);
19557
19558 /**
19559  * Creates a new tuple which has the same data as `orig`
19560  * but with all dynamically-allocated buffers duplicated in new buffers.
19561  */
19562 struct LDKC2Tuple_PublicKeyCOption_NetAddressZZ C2Tuple_PublicKeyCOption_NetAddressZZ_clone(const struct LDKC2Tuple_PublicKeyCOption_NetAddressZZ *NONNULL_PTR orig);
19563
19564 /**
19565  * Creates a new C2Tuple_PublicKeyCOption_NetAddressZZ from the contained elements.
19566  */
19567 struct LDKC2Tuple_PublicKeyCOption_NetAddressZZ C2Tuple_PublicKeyCOption_NetAddressZZ_new(struct LDKPublicKey a, struct LDKCOption_NetAddressZ b);
19568
19569 /**
19570  * Frees any resources used by the C2Tuple_PublicKeyCOption_NetAddressZZ.
19571  */
19572 void C2Tuple_PublicKeyCOption_NetAddressZZ_free(struct LDKC2Tuple_PublicKeyCOption_NetAddressZZ _res);
19573
19574 /**
19575  * Frees the buffer pointed to by `data` if `datalen` is non-0.
19576  */
19577 void CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ_free(struct LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ _res);
19578
19579 /**
19580  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
19581  */
19582 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_ok(struct LDKCVec_u8Z o);
19583
19584 /**
19585  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
19586  */
19587 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_err(struct LDKPeerHandleError e);
19588
19589 /**
19590  * Checks if the given object is currently in the success state
19591  */
19592 bool CResult_CVec_u8ZPeerHandleErrorZ_is_ok(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR o);
19593
19594 /**
19595  * Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
19596  */
19597 void CResult_CVec_u8ZPeerHandleErrorZ_free(struct LDKCResult_CVec_u8ZPeerHandleErrorZ _res);
19598
19599 /**
19600  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
19601  * but with all dynamically-allocated buffers duplicated in new buffers.
19602  */
19603 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_clone(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR orig);
19604
19605 /**
19606  * Creates a new CResult_NonePeerHandleErrorZ in the success state.
19607  */
19608 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_ok(void);
19609
19610 /**
19611  * Creates a new CResult_NonePeerHandleErrorZ in the error state.
19612  */
19613 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_err(struct LDKPeerHandleError e);
19614
19615 /**
19616  * Checks if the given object is currently in the success state
19617  */
19618 bool CResult_NonePeerHandleErrorZ_is_ok(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR o);
19619
19620 /**
19621  * Frees any resources used by the CResult_NonePeerHandleErrorZ.
19622  */
19623 void CResult_NonePeerHandleErrorZ_free(struct LDKCResult_NonePeerHandleErrorZ _res);
19624
19625 /**
19626  * Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
19627  * but with all dynamically-allocated buffers duplicated in new buffers.
19628  */
19629 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_clone(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR orig);
19630
19631 /**
19632  * Creates a new CResult_boolPeerHandleErrorZ in the success state.
19633  */
19634 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_ok(bool o);
19635
19636 /**
19637  * Creates a new CResult_boolPeerHandleErrorZ in the error state.
19638  */
19639 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_err(struct LDKPeerHandleError e);
19640
19641 /**
19642  * Checks if the given object is currently in the success state
19643  */
19644 bool CResult_boolPeerHandleErrorZ_is_ok(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR o);
19645
19646 /**
19647  * Frees any resources used by the CResult_boolPeerHandleErrorZ.
19648  */
19649 void CResult_boolPeerHandleErrorZ_free(struct LDKCResult_boolPeerHandleErrorZ _res);
19650
19651 /**
19652  * Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
19653  * but with all dynamically-allocated buffers duplicated in new buffers.
19654  */
19655 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_clone(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR orig);
19656
19657 /**
19658  * Creates a new CResult_TxOutUtxoLookupErrorZ in the success state.
19659  */
19660 struct LDKCResult_TxOutUtxoLookupErrorZ CResult_TxOutUtxoLookupErrorZ_ok(struct LDKTxOut o);
19661
19662 /**
19663  * Creates a new CResult_TxOutUtxoLookupErrorZ in the error state.
19664  */
19665 struct LDKCResult_TxOutUtxoLookupErrorZ CResult_TxOutUtxoLookupErrorZ_err(enum LDKUtxoLookupError e);
19666
19667 /**
19668  * Checks if the given object is currently in the success state
19669  */
19670 bool CResult_TxOutUtxoLookupErrorZ_is_ok(const struct LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR o);
19671
19672 /**
19673  * Frees any resources used by the CResult_TxOutUtxoLookupErrorZ.
19674  */
19675 void CResult_TxOutUtxoLookupErrorZ_free(struct LDKCResult_TxOutUtxoLookupErrorZ _res);
19676
19677 /**
19678  * Creates a new CResult_TxOutUtxoLookupErrorZ which has the same data as `orig`
19679  * but with all dynamically-allocated buffers duplicated in new buffers.
19680  */
19681 struct LDKCResult_TxOutUtxoLookupErrorZ CResult_TxOutUtxoLookupErrorZ_clone(const struct LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR orig);
19682
19683 /**
19684  * Creates a new CResult_NoneSendErrorZ in the success state.
19685  */
19686 struct LDKCResult_NoneSendErrorZ CResult_NoneSendErrorZ_ok(void);
19687
19688 /**
19689  * Creates a new CResult_NoneSendErrorZ in the error state.
19690  */
19691 struct LDKCResult_NoneSendErrorZ CResult_NoneSendErrorZ_err(struct LDKSendError e);
19692
19693 /**
19694  * Checks if the given object is currently in the success state
19695  */
19696 bool CResult_NoneSendErrorZ_is_ok(const struct LDKCResult_NoneSendErrorZ *NONNULL_PTR o);
19697
19698 /**
19699  * Frees any resources used by the CResult_NoneSendErrorZ.
19700  */
19701 void CResult_NoneSendErrorZ_free(struct LDKCResult_NoneSendErrorZ _res);
19702
19703 /**
19704  * Creates a new CResult_BlindedPathNoneZ in the success state.
19705  */
19706 struct LDKCResult_BlindedPathNoneZ CResult_BlindedPathNoneZ_ok(struct LDKBlindedPath o);
19707
19708 /**
19709  * Creates a new CResult_BlindedPathNoneZ in the error state.
19710  */
19711 struct LDKCResult_BlindedPathNoneZ CResult_BlindedPathNoneZ_err(void);
19712
19713 /**
19714  * Checks if the given object is currently in the success state
19715  */
19716 bool CResult_BlindedPathNoneZ_is_ok(const struct LDKCResult_BlindedPathNoneZ *NONNULL_PTR o);
19717
19718 /**
19719  * Frees any resources used by the CResult_BlindedPathNoneZ.
19720  */
19721 void CResult_BlindedPathNoneZ_free(struct LDKCResult_BlindedPathNoneZ _res);
19722
19723 /**
19724  * Creates a new CResult_BlindedPathNoneZ which has the same data as `orig`
19725  * but with all dynamically-allocated buffers duplicated in new buffers.
19726  */
19727 struct LDKCResult_BlindedPathNoneZ CResult_BlindedPathNoneZ_clone(const struct LDKCResult_BlindedPathNoneZ *NONNULL_PTR orig);
19728
19729 /**
19730  * Creates a new CResult_BlindedPathDecodeErrorZ in the success state.
19731  */
19732 struct LDKCResult_BlindedPathDecodeErrorZ CResult_BlindedPathDecodeErrorZ_ok(struct LDKBlindedPath o);
19733
19734 /**
19735  * Creates a new CResult_BlindedPathDecodeErrorZ in the error state.
19736  */
19737 struct LDKCResult_BlindedPathDecodeErrorZ CResult_BlindedPathDecodeErrorZ_err(struct LDKDecodeError e);
19738
19739 /**
19740  * Checks if the given object is currently in the success state
19741  */
19742 bool CResult_BlindedPathDecodeErrorZ_is_ok(const struct LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR o);
19743
19744 /**
19745  * Frees any resources used by the CResult_BlindedPathDecodeErrorZ.
19746  */
19747 void CResult_BlindedPathDecodeErrorZ_free(struct LDKCResult_BlindedPathDecodeErrorZ _res);
19748
19749 /**
19750  * Creates a new CResult_BlindedPathDecodeErrorZ which has the same data as `orig`
19751  * but with all dynamically-allocated buffers duplicated in new buffers.
19752  */
19753 struct LDKCResult_BlindedPathDecodeErrorZ CResult_BlindedPathDecodeErrorZ_clone(const struct LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR orig);
19754
19755 /**
19756  * Creates a new CResult_BlindedHopDecodeErrorZ in the success state.
19757  */
19758 struct LDKCResult_BlindedHopDecodeErrorZ CResult_BlindedHopDecodeErrorZ_ok(struct LDKBlindedHop o);
19759
19760 /**
19761  * Creates a new CResult_BlindedHopDecodeErrorZ in the error state.
19762  */
19763 struct LDKCResult_BlindedHopDecodeErrorZ CResult_BlindedHopDecodeErrorZ_err(struct LDKDecodeError e);
19764
19765 /**
19766  * Checks if the given object is currently in the success state
19767  */
19768 bool CResult_BlindedHopDecodeErrorZ_is_ok(const struct LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR o);
19769
19770 /**
19771  * Frees any resources used by the CResult_BlindedHopDecodeErrorZ.
19772  */
19773 void CResult_BlindedHopDecodeErrorZ_free(struct LDKCResult_BlindedHopDecodeErrorZ _res);
19774
19775 /**
19776  * Creates a new CResult_BlindedHopDecodeErrorZ which has the same data as `orig`
19777  * but with all dynamically-allocated buffers duplicated in new buffers.
19778  */
19779 struct LDKCResult_BlindedHopDecodeErrorZ CResult_BlindedHopDecodeErrorZ_clone(const struct LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR orig);
19780
19781 /**
19782  * Creates a new CResult_SiPrefixParseErrorZ in the success state.
19783  */
19784 struct LDKCResult_SiPrefixParseErrorZ CResult_SiPrefixParseErrorZ_ok(enum LDKSiPrefix o);
19785
19786 /**
19787  * Creates a new CResult_SiPrefixParseErrorZ in the error state.
19788  */
19789 struct LDKCResult_SiPrefixParseErrorZ CResult_SiPrefixParseErrorZ_err(struct LDKParseError e);
19790
19791 /**
19792  * Checks if the given object is currently in the success state
19793  */
19794 bool CResult_SiPrefixParseErrorZ_is_ok(const struct LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR o);
19795
19796 /**
19797  * Frees any resources used by the CResult_SiPrefixParseErrorZ.
19798  */
19799 void CResult_SiPrefixParseErrorZ_free(struct LDKCResult_SiPrefixParseErrorZ _res);
19800
19801 /**
19802  * Creates a new CResult_SiPrefixParseErrorZ which has the same data as `orig`
19803  * but with all dynamically-allocated buffers duplicated in new buffers.
19804  */
19805 struct LDKCResult_SiPrefixParseErrorZ CResult_SiPrefixParseErrorZ_clone(const struct LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR orig);
19806
19807 /**
19808  * Creates a new CResult_InvoiceParseOrSemanticErrorZ in the success state.
19809  */
19810 struct LDKCResult_InvoiceParseOrSemanticErrorZ CResult_InvoiceParseOrSemanticErrorZ_ok(struct LDKInvoice o);
19811
19812 /**
19813  * Creates a new CResult_InvoiceParseOrSemanticErrorZ in the error state.
19814  */
19815 struct LDKCResult_InvoiceParseOrSemanticErrorZ CResult_InvoiceParseOrSemanticErrorZ_err(struct LDKParseOrSemanticError e);
19816
19817 /**
19818  * Checks if the given object is currently in the success state
19819  */
19820 bool CResult_InvoiceParseOrSemanticErrorZ_is_ok(const struct LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR o);
19821
19822 /**
19823  * Frees any resources used by the CResult_InvoiceParseOrSemanticErrorZ.
19824  */
19825 void CResult_InvoiceParseOrSemanticErrorZ_free(struct LDKCResult_InvoiceParseOrSemanticErrorZ _res);
19826
19827 /**
19828  * Creates a new CResult_InvoiceParseOrSemanticErrorZ which has the same data as `orig`
19829  * but with all dynamically-allocated buffers duplicated in new buffers.
19830  */
19831 struct LDKCResult_InvoiceParseOrSemanticErrorZ CResult_InvoiceParseOrSemanticErrorZ_clone(const struct LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR orig);
19832
19833 /**
19834  * Creates a new CResult_SignedRawInvoiceParseErrorZ in the success state.
19835  */
19836 struct LDKCResult_SignedRawInvoiceParseErrorZ CResult_SignedRawInvoiceParseErrorZ_ok(struct LDKSignedRawInvoice o);
19837
19838 /**
19839  * Creates a new CResult_SignedRawInvoiceParseErrorZ in the error state.
19840  */
19841 struct LDKCResult_SignedRawInvoiceParseErrorZ CResult_SignedRawInvoiceParseErrorZ_err(struct LDKParseError e);
19842
19843 /**
19844  * Checks if the given object is currently in the success state
19845  */
19846 bool CResult_SignedRawInvoiceParseErrorZ_is_ok(const struct LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR o);
19847
19848 /**
19849  * Frees any resources used by the CResult_SignedRawInvoiceParseErrorZ.
19850  */
19851 void CResult_SignedRawInvoiceParseErrorZ_free(struct LDKCResult_SignedRawInvoiceParseErrorZ _res);
19852
19853 /**
19854  * Creates a new CResult_SignedRawInvoiceParseErrorZ which has the same data as `orig`
19855  * but with all dynamically-allocated buffers duplicated in new buffers.
19856  */
19857 struct LDKCResult_SignedRawInvoiceParseErrorZ CResult_SignedRawInvoiceParseErrorZ_clone(const struct LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR orig);
19858
19859 /**
19860  * Creates a new tuple which has the same data as `orig`
19861  * but with all dynamically-allocated buffers duplicated in new buffers.
19862  */
19863 struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(const struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR orig);
19864
19865 /**
19866  * Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
19867  */
19868 struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(struct LDKRawInvoice a, struct LDKThirtyTwoBytes b, struct LDKInvoiceSignature c);
19869
19870 /**
19871  * Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
19872  */
19873 void C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res);
19874
19875 /**
19876  * Creates a new CResult_PayeePubKeyErrorZ in the success state.
19877  */
19878 struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_ok(struct LDKPayeePubKey o);
19879
19880 /**
19881  * Creates a new CResult_PayeePubKeyErrorZ in the error state.
19882  */
19883 struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_err(enum LDKSecp256k1Error e);
19884
19885 /**
19886  * Checks if the given object is currently in the success state
19887  */
19888 bool CResult_PayeePubKeyErrorZ_is_ok(const struct LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR o);
19889
19890 /**
19891  * Frees any resources used by the CResult_PayeePubKeyErrorZ.
19892  */
19893 void CResult_PayeePubKeyErrorZ_free(struct LDKCResult_PayeePubKeyErrorZ _res);
19894
19895 /**
19896  * Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig`
19897  * but with all dynamically-allocated buffers duplicated in new buffers.
19898  */
19899 struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_clone(const struct LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR orig);
19900
19901 /**
19902  * Frees the buffer pointed to by `data` if `datalen` is non-0.
19903  */
19904 void CVec_PrivateRouteZ_free(struct LDKCVec_PrivateRouteZ _res);
19905
19906 /**
19907  * Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
19908  */
19909 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_ok(struct LDKPositiveTimestamp o);
19910
19911 /**
19912  * Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
19913  */
19914 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_err(enum LDKCreationError e);
19915
19916 /**
19917  * Checks if the given object is currently in the success state
19918  */
19919 bool CResult_PositiveTimestampCreationErrorZ_is_ok(const struct LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR o);
19920
19921 /**
19922  * Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
19923  */
19924 void CResult_PositiveTimestampCreationErrorZ_free(struct LDKCResult_PositiveTimestampCreationErrorZ _res);
19925
19926 /**
19927  * Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
19928  * but with all dynamically-allocated buffers duplicated in new buffers.
19929  */
19930 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_clone(const struct LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR orig);
19931
19932 /**
19933  * Creates a new CResult_NoneSemanticErrorZ in the success state.
19934  */
19935 struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_ok(void);
19936
19937 /**
19938  * Creates a new CResult_NoneSemanticErrorZ in the error state.
19939  */
19940 struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_err(enum LDKSemanticError e);
19941
19942 /**
19943  * Checks if the given object is currently in the success state
19944  */
19945 bool CResult_NoneSemanticErrorZ_is_ok(const struct LDKCResult_NoneSemanticErrorZ *NONNULL_PTR o);
19946
19947 /**
19948  * Frees any resources used by the CResult_NoneSemanticErrorZ.
19949  */
19950 void CResult_NoneSemanticErrorZ_free(struct LDKCResult_NoneSemanticErrorZ _res);
19951
19952 /**
19953  * Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
19954  * but with all dynamically-allocated buffers duplicated in new buffers.
19955  */
19956 struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_clone(const struct LDKCResult_NoneSemanticErrorZ *NONNULL_PTR orig);
19957
19958 /**
19959  * Creates a new CResult_InvoiceSemanticErrorZ in the success state.
19960  */
19961 struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_ok(struct LDKInvoice o);
19962
19963 /**
19964  * Creates a new CResult_InvoiceSemanticErrorZ in the error state.
19965  */
19966 struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_err(enum LDKSemanticError e);
19967
19968 /**
19969  * Checks if the given object is currently in the success state
19970  */
19971 bool CResult_InvoiceSemanticErrorZ_is_ok(const struct LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR o);
19972
19973 /**
19974  * Frees any resources used by the CResult_InvoiceSemanticErrorZ.
19975  */
19976 void CResult_InvoiceSemanticErrorZ_free(struct LDKCResult_InvoiceSemanticErrorZ _res);
19977
19978 /**
19979  * Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
19980  * but with all dynamically-allocated buffers duplicated in new buffers.
19981  */
19982 struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_clone(const struct LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR orig);
19983
19984 /**
19985  * Frees the buffer pointed to by `data` if `datalen` is non-0.
19986  */
19987 void CVec_AddressZ_free(struct LDKCVec_AddressZ _res);
19988
19989 /**
19990  * Creates a new CResult_DescriptionCreationErrorZ in the success state.
19991  */
19992 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_ok(struct LDKDescription o);
19993
19994 /**
19995  * Creates a new CResult_DescriptionCreationErrorZ in the error state.
19996  */
19997 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_err(enum LDKCreationError e);
19998
19999 /**
20000  * Checks if the given object is currently in the success state
20001  */
20002 bool CResult_DescriptionCreationErrorZ_is_ok(const struct LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR o);
20003
20004 /**
20005  * Frees any resources used by the CResult_DescriptionCreationErrorZ.
20006  */
20007 void CResult_DescriptionCreationErrorZ_free(struct LDKCResult_DescriptionCreationErrorZ _res);
20008
20009 /**
20010  * Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
20011  * but with all dynamically-allocated buffers duplicated in new buffers.
20012  */
20013 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_clone(const struct LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR orig);
20014
20015 /**
20016  * Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
20017  */
20018 struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_ok(struct LDKPrivateRoute o);
20019
20020 /**
20021  * Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
20022  */
20023 struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_err(enum LDKCreationError e);
20024
20025 /**
20026  * Checks if the given object is currently in the success state
20027  */
20028 bool CResult_PrivateRouteCreationErrorZ_is_ok(const struct LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR o);
20029
20030 /**
20031  * Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
20032  */
20033 void CResult_PrivateRouteCreationErrorZ_free(struct LDKCResult_PrivateRouteCreationErrorZ _res);
20034
20035 /**
20036  * Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
20037  * but with all dynamically-allocated buffers duplicated in new buffers.
20038  */
20039 struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_clone(const struct LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR orig);
20040
20041 /**
20042  * Creates a new CResult_NetAddressDecodeErrorZ in the success state.
20043  */
20044 struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_ok(struct LDKNetAddress o);
20045
20046 /**
20047  * Creates a new CResult_NetAddressDecodeErrorZ in the error state.
20048  */
20049 struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_err(struct LDKDecodeError e);
20050
20051 /**
20052  * Checks if the given object is currently in the success state
20053  */
20054 bool CResult_NetAddressDecodeErrorZ_is_ok(const struct LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR o);
20055
20056 /**
20057  * Frees any resources used by the CResult_NetAddressDecodeErrorZ.
20058  */
20059 void CResult_NetAddressDecodeErrorZ_free(struct LDKCResult_NetAddressDecodeErrorZ _res);
20060
20061 /**
20062  * Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig`
20063  * but with all dynamically-allocated buffers duplicated in new buffers.
20064  */
20065 struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_clone(const struct LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR orig);
20066
20067 /**
20068  * Frees the buffer pointed to by `data` if `datalen` is non-0.
20069  */
20070 void CVec_UpdateAddHTLCZ_free(struct LDKCVec_UpdateAddHTLCZ _res);
20071
20072 /**
20073  * Frees the buffer pointed to by `data` if `datalen` is non-0.
20074  */
20075 void CVec_UpdateFulfillHTLCZ_free(struct LDKCVec_UpdateFulfillHTLCZ _res);
20076
20077 /**
20078  * Frees the buffer pointed to by `data` if `datalen` is non-0.
20079  */
20080 void CVec_UpdateFailHTLCZ_free(struct LDKCVec_UpdateFailHTLCZ _res);
20081
20082 /**
20083  * Frees the buffer pointed to by `data` if `datalen` is non-0.
20084  */
20085 void CVec_UpdateFailMalformedHTLCZ_free(struct LDKCVec_UpdateFailMalformedHTLCZ _res);
20086
20087 /**
20088  * Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
20089  */
20090 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_ok(struct LDKAcceptChannel o);
20091
20092 /**
20093  * Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
20094  */
20095 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_err(struct LDKDecodeError e);
20096
20097 /**
20098  * Checks if the given object is currently in the success state
20099  */
20100 bool CResult_AcceptChannelDecodeErrorZ_is_ok(const struct LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR o);
20101
20102 /**
20103  * Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
20104  */
20105 void CResult_AcceptChannelDecodeErrorZ_free(struct LDKCResult_AcceptChannelDecodeErrorZ _res);
20106
20107 /**
20108  * Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
20109  * but with all dynamically-allocated buffers duplicated in new buffers.
20110  */
20111 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_clone(const struct LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR orig);
20112
20113 /**
20114  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
20115  */
20116 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_ok(struct LDKAnnouncementSignatures o);
20117
20118 /**
20119  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
20120  */
20121 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_err(struct LDKDecodeError e);
20122
20123 /**
20124  * Checks if the given object is currently in the success state
20125  */
20126 bool CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(const struct LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR o);
20127
20128 /**
20129  * Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
20130  */
20131 void CResult_AnnouncementSignaturesDecodeErrorZ_free(struct LDKCResult_AnnouncementSignaturesDecodeErrorZ _res);
20132
20133 /**
20134  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
20135  * but with all dynamically-allocated buffers duplicated in new buffers.
20136  */
20137 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_clone(const struct LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR orig);
20138
20139 /**
20140  * Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
20141  */
20142 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_ok(struct LDKChannelReestablish o);
20143
20144 /**
20145  * Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
20146  */
20147 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_err(struct LDKDecodeError e);
20148
20149 /**
20150  * Checks if the given object is currently in the success state
20151  */
20152 bool CResult_ChannelReestablishDecodeErrorZ_is_ok(const struct LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR o);
20153
20154 /**
20155  * Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
20156  */
20157 void CResult_ChannelReestablishDecodeErrorZ_free(struct LDKCResult_ChannelReestablishDecodeErrorZ _res);
20158
20159 /**
20160  * Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
20161  * but with all dynamically-allocated buffers duplicated in new buffers.
20162  */
20163 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_clone(const struct LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR orig);
20164
20165 /**
20166  * Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
20167  */
20168 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_ok(struct LDKClosingSigned o);
20169
20170 /**
20171  * Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
20172  */
20173 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_err(struct LDKDecodeError e);
20174
20175 /**
20176  * Checks if the given object is currently in the success state
20177  */
20178 bool CResult_ClosingSignedDecodeErrorZ_is_ok(const struct LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR o);
20179
20180 /**
20181  * Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
20182  */
20183 void CResult_ClosingSignedDecodeErrorZ_free(struct LDKCResult_ClosingSignedDecodeErrorZ _res);
20184
20185 /**
20186  * Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
20187  * but with all dynamically-allocated buffers duplicated in new buffers.
20188  */
20189 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_clone(const struct LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR orig);
20190
20191 /**
20192  * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state.
20193  */
20194 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(struct LDKClosingSignedFeeRange o);
20195
20196 /**
20197  * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state.
20198  */
20199 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_err(struct LDKDecodeError e);
20200
20201 /**
20202  * Checks if the given object is currently in the success state
20203  */
20204 bool CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(const struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR o);
20205
20206 /**
20207  * Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ.
20208  */
20209 void CResult_ClosingSignedFeeRangeDecodeErrorZ_free(struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res);
20210
20211 /**
20212  * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig`
20213  * but with all dynamically-allocated buffers duplicated in new buffers.
20214  */
20215 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(const struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR orig);
20216
20217 /**
20218  * Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
20219  */
20220 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_ok(struct LDKCommitmentSigned o);
20221
20222 /**
20223  * Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
20224  */
20225 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_err(struct LDKDecodeError e);
20226
20227 /**
20228  * Checks if the given object is currently in the success state
20229  */
20230 bool CResult_CommitmentSignedDecodeErrorZ_is_ok(const struct LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR o);
20231
20232 /**
20233  * Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
20234  */
20235 void CResult_CommitmentSignedDecodeErrorZ_free(struct LDKCResult_CommitmentSignedDecodeErrorZ _res);
20236
20237 /**
20238  * Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
20239  * but with all dynamically-allocated buffers duplicated in new buffers.
20240  */
20241 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_clone(const struct LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR orig);
20242
20243 /**
20244  * Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
20245  */
20246 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_ok(struct LDKFundingCreated o);
20247
20248 /**
20249  * Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
20250  */
20251 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_err(struct LDKDecodeError e);
20252
20253 /**
20254  * Checks if the given object is currently in the success state
20255  */
20256 bool CResult_FundingCreatedDecodeErrorZ_is_ok(const struct LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR o);
20257
20258 /**
20259  * Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
20260  */
20261 void CResult_FundingCreatedDecodeErrorZ_free(struct LDKCResult_FundingCreatedDecodeErrorZ _res);
20262
20263 /**
20264  * Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
20265  * but with all dynamically-allocated buffers duplicated in new buffers.
20266  */
20267 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_clone(const struct LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR orig);
20268
20269 /**
20270  * Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
20271  */
20272 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_ok(struct LDKFundingSigned o);
20273
20274 /**
20275  * Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
20276  */
20277 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_err(struct LDKDecodeError e);
20278
20279 /**
20280  * Checks if the given object is currently in the success state
20281  */
20282 bool CResult_FundingSignedDecodeErrorZ_is_ok(const struct LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR o);
20283
20284 /**
20285  * Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
20286  */
20287 void CResult_FundingSignedDecodeErrorZ_free(struct LDKCResult_FundingSignedDecodeErrorZ _res);
20288
20289 /**
20290  * Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
20291  * but with all dynamically-allocated buffers duplicated in new buffers.
20292  */
20293 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_clone(const struct LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR orig);
20294
20295 /**
20296  * Creates a new CResult_ChannelReadyDecodeErrorZ in the success state.
20297  */
20298 struct LDKCResult_ChannelReadyDecodeErrorZ CResult_ChannelReadyDecodeErrorZ_ok(struct LDKChannelReady o);
20299
20300 /**
20301  * Creates a new CResult_ChannelReadyDecodeErrorZ in the error state.
20302  */
20303 struct LDKCResult_ChannelReadyDecodeErrorZ CResult_ChannelReadyDecodeErrorZ_err(struct LDKDecodeError e);
20304
20305 /**
20306  * Checks if the given object is currently in the success state
20307  */
20308 bool CResult_ChannelReadyDecodeErrorZ_is_ok(const struct LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR o);
20309
20310 /**
20311  * Frees any resources used by the CResult_ChannelReadyDecodeErrorZ.
20312  */
20313 void CResult_ChannelReadyDecodeErrorZ_free(struct LDKCResult_ChannelReadyDecodeErrorZ _res);
20314
20315 /**
20316  * Creates a new CResult_ChannelReadyDecodeErrorZ which has the same data as `orig`
20317  * but with all dynamically-allocated buffers duplicated in new buffers.
20318  */
20319 struct LDKCResult_ChannelReadyDecodeErrorZ CResult_ChannelReadyDecodeErrorZ_clone(const struct LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR orig);
20320
20321 /**
20322  * Creates a new CResult_InitDecodeErrorZ in the success state.
20323  */
20324 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_ok(struct LDKInit o);
20325
20326 /**
20327  * Creates a new CResult_InitDecodeErrorZ in the error state.
20328  */
20329 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_err(struct LDKDecodeError e);
20330
20331 /**
20332  * Checks if the given object is currently in the success state
20333  */
20334 bool CResult_InitDecodeErrorZ_is_ok(const struct LDKCResult_InitDecodeErrorZ *NONNULL_PTR o);
20335
20336 /**
20337  * Frees any resources used by the CResult_InitDecodeErrorZ.
20338  */
20339 void CResult_InitDecodeErrorZ_free(struct LDKCResult_InitDecodeErrorZ _res);
20340
20341 /**
20342  * Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
20343  * but with all dynamically-allocated buffers duplicated in new buffers.
20344  */
20345 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_clone(const struct LDKCResult_InitDecodeErrorZ *NONNULL_PTR orig);
20346
20347 /**
20348  * Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
20349  */
20350 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_ok(struct LDKOpenChannel o);
20351
20352 /**
20353  * Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
20354  */
20355 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_err(struct LDKDecodeError e);
20356
20357 /**
20358  * Checks if the given object is currently in the success state
20359  */
20360 bool CResult_OpenChannelDecodeErrorZ_is_ok(const struct LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR o);
20361
20362 /**
20363  * Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
20364  */
20365 void CResult_OpenChannelDecodeErrorZ_free(struct LDKCResult_OpenChannelDecodeErrorZ _res);
20366
20367 /**
20368  * Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
20369  * but with all dynamically-allocated buffers duplicated in new buffers.
20370  */
20371 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_clone(const struct LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR orig);
20372
20373 /**
20374  * Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
20375  */
20376 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_ok(struct LDKRevokeAndACK o);
20377
20378 /**
20379  * Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
20380  */
20381 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_err(struct LDKDecodeError e);
20382
20383 /**
20384  * Checks if the given object is currently in the success state
20385  */
20386 bool CResult_RevokeAndACKDecodeErrorZ_is_ok(const struct LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR o);
20387
20388 /**
20389  * Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
20390  */
20391 void CResult_RevokeAndACKDecodeErrorZ_free(struct LDKCResult_RevokeAndACKDecodeErrorZ _res);
20392
20393 /**
20394  * Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
20395  * but with all dynamically-allocated buffers duplicated in new buffers.
20396  */
20397 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_clone(const struct LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR orig);
20398
20399 /**
20400  * Creates a new CResult_ShutdownDecodeErrorZ in the success state.
20401  */
20402 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_ok(struct LDKShutdown o);
20403
20404 /**
20405  * Creates a new CResult_ShutdownDecodeErrorZ in the error state.
20406  */
20407 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_err(struct LDKDecodeError e);
20408
20409 /**
20410  * Checks if the given object is currently in the success state
20411  */
20412 bool CResult_ShutdownDecodeErrorZ_is_ok(const struct LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR o);
20413
20414 /**
20415  * Frees any resources used by the CResult_ShutdownDecodeErrorZ.
20416  */
20417 void CResult_ShutdownDecodeErrorZ_free(struct LDKCResult_ShutdownDecodeErrorZ _res);
20418
20419 /**
20420  * Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
20421  * but with all dynamically-allocated buffers duplicated in new buffers.
20422  */
20423 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_clone(const struct LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR orig);
20424
20425 /**
20426  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
20427  */
20428 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_ok(struct LDKUpdateFailHTLC o);
20429
20430 /**
20431  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
20432  */
20433 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_err(struct LDKDecodeError e);
20434
20435 /**
20436  * Checks if the given object is currently in the success state
20437  */
20438 bool CResult_UpdateFailHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR o);
20439
20440 /**
20441  * Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
20442  */
20443 void CResult_UpdateFailHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailHTLCDecodeErrorZ _res);
20444
20445 /**
20446  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
20447  * but with all dynamically-allocated buffers duplicated in new buffers.
20448  */
20449 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR orig);
20450
20451 /**
20452  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
20453  */
20454 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(struct LDKUpdateFailMalformedHTLC o);
20455
20456 /**
20457  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
20458  */
20459 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(struct LDKDecodeError e);
20460
20461 /**
20462  * Checks if the given object is currently in the success state
20463  */
20464 bool CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR o);
20465
20466 /**
20467  * Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
20468  */
20469 void CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res);
20470
20471 /**
20472  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
20473  * but with all dynamically-allocated buffers duplicated in new buffers.
20474  */
20475 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR orig);
20476
20477 /**
20478  * Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
20479  */
20480 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_ok(struct LDKUpdateFee o);
20481
20482 /**
20483  * Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
20484  */
20485 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_err(struct LDKDecodeError e);
20486
20487 /**
20488  * Checks if the given object is currently in the success state
20489  */
20490 bool CResult_UpdateFeeDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR o);
20491
20492 /**
20493  * Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
20494  */
20495 void CResult_UpdateFeeDecodeErrorZ_free(struct LDKCResult_UpdateFeeDecodeErrorZ _res);
20496
20497 /**
20498  * Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
20499  * but with all dynamically-allocated buffers duplicated in new buffers.
20500  */
20501 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_clone(const struct LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR orig);
20502
20503 /**
20504  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
20505  */
20506 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_ok(struct LDKUpdateFulfillHTLC o);
20507
20508 /**
20509  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
20510  */
20511 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_err(struct LDKDecodeError e);
20512
20513 /**
20514  * Checks if the given object is currently in the success state
20515  */
20516 bool CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR o);
20517
20518 /**
20519  * Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
20520  */
20521 void CResult_UpdateFulfillHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res);
20522
20523 /**
20524  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
20525  * but with all dynamically-allocated buffers duplicated in new buffers.
20526  */
20527 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR orig);
20528
20529 /**
20530  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
20531  */
20532 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_ok(struct LDKUpdateAddHTLC o);
20533
20534 /**
20535  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
20536  */
20537 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_err(struct LDKDecodeError e);
20538
20539 /**
20540  * Checks if the given object is currently in the success state
20541  */
20542 bool CResult_UpdateAddHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR o);
20543
20544 /**
20545  * Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
20546  */
20547 void CResult_UpdateAddHTLCDecodeErrorZ_free(struct LDKCResult_UpdateAddHTLCDecodeErrorZ _res);
20548
20549 /**
20550  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
20551  * but with all dynamically-allocated buffers duplicated in new buffers.
20552  */
20553 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR orig);
20554
20555 /**
20556  * Creates a new CResult_OnionMessageDecodeErrorZ in the success state.
20557  */
20558 struct LDKCResult_OnionMessageDecodeErrorZ CResult_OnionMessageDecodeErrorZ_ok(struct LDKOnionMessage o);
20559
20560 /**
20561  * Creates a new CResult_OnionMessageDecodeErrorZ in the error state.
20562  */
20563 struct LDKCResult_OnionMessageDecodeErrorZ CResult_OnionMessageDecodeErrorZ_err(struct LDKDecodeError e);
20564
20565 /**
20566  * Checks if the given object is currently in the success state
20567  */
20568 bool CResult_OnionMessageDecodeErrorZ_is_ok(const struct LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR o);
20569
20570 /**
20571  * Frees any resources used by the CResult_OnionMessageDecodeErrorZ.
20572  */
20573 void CResult_OnionMessageDecodeErrorZ_free(struct LDKCResult_OnionMessageDecodeErrorZ _res);
20574
20575 /**
20576  * Creates a new CResult_OnionMessageDecodeErrorZ which has the same data as `orig`
20577  * but with all dynamically-allocated buffers duplicated in new buffers.
20578  */
20579 struct LDKCResult_OnionMessageDecodeErrorZ CResult_OnionMessageDecodeErrorZ_clone(const struct LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR orig);
20580
20581 /**
20582  * Creates a new CResult_PingDecodeErrorZ in the success state.
20583  */
20584 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_ok(struct LDKPing o);
20585
20586 /**
20587  * Creates a new CResult_PingDecodeErrorZ in the error state.
20588  */
20589 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_err(struct LDKDecodeError e);
20590
20591 /**
20592  * Checks if the given object is currently in the success state
20593  */
20594 bool CResult_PingDecodeErrorZ_is_ok(const struct LDKCResult_PingDecodeErrorZ *NONNULL_PTR o);
20595
20596 /**
20597  * Frees any resources used by the CResult_PingDecodeErrorZ.
20598  */
20599 void CResult_PingDecodeErrorZ_free(struct LDKCResult_PingDecodeErrorZ _res);
20600
20601 /**
20602  * Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
20603  * but with all dynamically-allocated buffers duplicated in new buffers.
20604  */
20605 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_clone(const struct LDKCResult_PingDecodeErrorZ *NONNULL_PTR orig);
20606
20607 /**
20608  * Creates a new CResult_PongDecodeErrorZ in the success state.
20609  */
20610 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_ok(struct LDKPong o);
20611
20612 /**
20613  * Creates a new CResult_PongDecodeErrorZ in the error state.
20614  */
20615 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_err(struct LDKDecodeError e);
20616
20617 /**
20618  * Checks if the given object is currently in the success state
20619  */
20620 bool CResult_PongDecodeErrorZ_is_ok(const struct LDKCResult_PongDecodeErrorZ *NONNULL_PTR o);
20621
20622 /**
20623  * Frees any resources used by the CResult_PongDecodeErrorZ.
20624  */
20625 void CResult_PongDecodeErrorZ_free(struct LDKCResult_PongDecodeErrorZ _res);
20626
20627 /**
20628  * Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
20629  * but with all dynamically-allocated buffers duplicated in new buffers.
20630  */
20631 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_clone(const struct LDKCResult_PongDecodeErrorZ *NONNULL_PTR orig);
20632
20633 /**
20634  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
20635  */
20636 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(struct LDKUnsignedChannelAnnouncement o);
20637
20638 /**
20639  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
20640  */
20641 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
20642
20643 /**
20644  * Checks if the given object is currently in the success state
20645  */
20646 bool CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR o);
20647
20648 /**
20649  * Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
20650  */
20651 void CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res);
20652
20653 /**
20654  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
20655  * but with all dynamically-allocated buffers duplicated in new buffers.
20656  */
20657 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig);
20658
20659 /**
20660  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
20661  */
20662 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_ok(struct LDKChannelAnnouncement o);
20663
20664 /**
20665  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
20666  */
20667 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
20668
20669 /**
20670  * Checks if the given object is currently in the success state
20671  */
20672 bool CResult_ChannelAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR o);
20673
20674 /**
20675  * Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
20676  */
20677 void CResult_ChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_ChannelAnnouncementDecodeErrorZ _res);
20678
20679 /**
20680  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
20681  * but with all dynamically-allocated buffers duplicated in new buffers.
20682  */
20683 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig);
20684
20685 /**
20686  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
20687  */
20688 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_ok(struct LDKUnsignedChannelUpdate o);
20689
20690 /**
20691  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
20692  */
20693 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e);
20694
20695 /**
20696  * Checks if the given object is currently in the success state
20697  */
20698 bool CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(const struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR o);
20699
20700 /**
20701  * Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
20702  */
20703 void CResult_UnsignedChannelUpdateDecodeErrorZ_free(struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res);
20704
20705 /**
20706  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
20707  * but with all dynamically-allocated buffers duplicated in new buffers.
20708  */
20709 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR orig);
20710
20711 /**
20712  * Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
20713  */
20714 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_ok(struct LDKChannelUpdate o);
20715
20716 /**
20717  * Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
20718  */
20719 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e);
20720
20721 /**
20722  * Checks if the given object is currently in the success state
20723  */
20724 bool CResult_ChannelUpdateDecodeErrorZ_is_ok(const struct LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR o);
20725
20726 /**
20727  * Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
20728  */
20729 void CResult_ChannelUpdateDecodeErrorZ_free(struct LDKCResult_ChannelUpdateDecodeErrorZ _res);
20730
20731 /**
20732  * Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
20733  * but with all dynamically-allocated buffers duplicated in new buffers.
20734  */
20735 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR orig);
20736
20737 /**
20738  * Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
20739  */
20740 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_ok(struct LDKErrorMessage o);
20741
20742 /**
20743  * Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
20744  */
20745 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_err(struct LDKDecodeError e);
20746
20747 /**
20748  * Checks if the given object is currently in the success state
20749  */
20750 bool CResult_ErrorMessageDecodeErrorZ_is_ok(const struct LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR o);
20751
20752 /**
20753  * Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
20754  */
20755 void CResult_ErrorMessageDecodeErrorZ_free(struct LDKCResult_ErrorMessageDecodeErrorZ _res);
20756
20757 /**
20758  * Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
20759  * but with all dynamically-allocated buffers duplicated in new buffers.
20760  */
20761 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_clone(const struct LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR orig);
20762
20763 /**
20764  * Creates a new CResult_WarningMessageDecodeErrorZ in the success state.
20765  */
20766 struct LDKCResult_WarningMessageDecodeErrorZ CResult_WarningMessageDecodeErrorZ_ok(struct LDKWarningMessage o);
20767
20768 /**
20769  * Creates a new CResult_WarningMessageDecodeErrorZ in the error state.
20770  */
20771 struct LDKCResult_WarningMessageDecodeErrorZ CResult_WarningMessageDecodeErrorZ_err(struct LDKDecodeError e);
20772
20773 /**
20774  * Checks if the given object is currently in the success state
20775  */
20776 bool CResult_WarningMessageDecodeErrorZ_is_ok(const struct LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR o);
20777
20778 /**
20779  * Frees any resources used by the CResult_WarningMessageDecodeErrorZ.
20780  */
20781 void CResult_WarningMessageDecodeErrorZ_free(struct LDKCResult_WarningMessageDecodeErrorZ _res);
20782
20783 /**
20784  * Creates a new CResult_WarningMessageDecodeErrorZ which has the same data as `orig`
20785  * but with all dynamically-allocated buffers duplicated in new buffers.
20786  */
20787 struct LDKCResult_WarningMessageDecodeErrorZ CResult_WarningMessageDecodeErrorZ_clone(const struct LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR orig);
20788
20789 /**
20790  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
20791  */
20792 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(struct LDKUnsignedNodeAnnouncement o);
20793
20794 /**
20795  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
20796  */
20797 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
20798
20799 /**
20800  * Checks if the given object is currently in the success state
20801  */
20802 bool CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR o);
20803
20804 /**
20805  * Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
20806  */
20807 void CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res);
20808
20809 /**
20810  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
20811  * but with all dynamically-allocated buffers duplicated in new buffers.
20812  */
20813 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR orig);
20814
20815 /**
20816  * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
20817  */
20818 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_ok(struct LDKNodeAnnouncement o);
20819
20820 /**
20821  * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
20822  */
20823 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
20824
20825 /**
20826  * Checks if the given object is currently in the success state
20827  */
20828 bool CResult_NodeAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR o);
20829
20830 /**
20831  * Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
20832  */
20833 void CResult_NodeAnnouncementDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementDecodeErrorZ _res);
20834
20835 /**
20836  * Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
20837  * but with all dynamically-allocated buffers duplicated in new buffers.
20838  */
20839 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR orig);
20840
20841 /**
20842  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
20843  */
20844 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_ok(struct LDKQueryShortChannelIds o);
20845
20846 /**
20847  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
20848  */
20849 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_err(struct LDKDecodeError e);
20850
20851 /**
20852  * Checks if the given object is currently in the success state
20853  */
20854 bool CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(const struct LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR o);
20855
20856 /**
20857  * Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
20858  */
20859 void CResult_QueryShortChannelIdsDecodeErrorZ_free(struct LDKCResult_QueryShortChannelIdsDecodeErrorZ _res);
20860
20861 /**
20862  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
20863  * but with all dynamically-allocated buffers duplicated in new buffers.
20864  */
20865 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_clone(const struct LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR orig);
20866
20867 /**
20868  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
20869  */
20870 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(struct LDKReplyShortChannelIdsEnd o);
20871
20872 /**
20873  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
20874  */
20875 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(struct LDKDecodeError e);
20876
20877 /**
20878  * Checks if the given object is currently in the success state
20879  */
20880 bool CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(const struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR o);
20881
20882 /**
20883  * Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
20884  */
20885 void CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res);
20886
20887 /**
20888  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
20889  * but with all dynamically-allocated buffers duplicated in new buffers.
20890  */
20891 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(const struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR orig);
20892
20893 /**
20894  * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
20895  */
20896 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_ok(struct LDKQueryChannelRange o);
20897
20898 /**
20899  * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
20900  */
20901 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
20902
20903 /**
20904  * Checks if the given object is currently in the success state
20905  */
20906 bool CResult_QueryChannelRangeDecodeErrorZ_is_ok(const struct LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR o);
20907
20908 /**
20909  * Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
20910  */
20911 void CResult_QueryChannelRangeDecodeErrorZ_free(struct LDKCResult_QueryChannelRangeDecodeErrorZ _res);
20912
20913 /**
20914  * Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
20915  * but with all dynamically-allocated buffers duplicated in new buffers.
20916  */
20917 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_clone(const struct LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR orig);
20918
20919 /**
20920  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
20921  */
20922 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_ok(struct LDKReplyChannelRange o);
20923
20924 /**
20925  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
20926  */
20927 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
20928
20929 /**
20930  * Checks if the given object is currently in the success state
20931  */
20932 bool CResult_ReplyChannelRangeDecodeErrorZ_is_ok(const struct LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR o);
20933
20934 /**
20935  * Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
20936  */
20937 void CResult_ReplyChannelRangeDecodeErrorZ_free(struct LDKCResult_ReplyChannelRangeDecodeErrorZ _res);
20938
20939 /**
20940  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
20941  * but with all dynamically-allocated buffers duplicated in new buffers.
20942  */
20943 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_clone(const struct LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR orig);
20944
20945 /**
20946  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
20947  */
20948 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_ok(struct LDKGossipTimestampFilter o);
20949
20950 /**
20951  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
20952  */
20953 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_err(struct LDKDecodeError e);
20954
20955 /**
20956  * Checks if the given object is currently in the success state
20957  */
20958 bool CResult_GossipTimestampFilterDecodeErrorZ_is_ok(const struct LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR o);
20959
20960 /**
20961  * Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
20962  */
20963 void CResult_GossipTimestampFilterDecodeErrorZ_free(struct LDKCResult_GossipTimestampFilterDecodeErrorZ _res);
20964
20965 /**
20966  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
20967  * but with all dynamically-allocated buffers duplicated in new buffers.
20968  */
20969 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_clone(const struct LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR orig);
20970
20971 /**
20972  * Frees the buffer pointed to by `data` if `datalen` is non-0.
20973  */
20974 void CVec_PhantomRouteHintsZ_free(struct LDKCVec_PhantomRouteHintsZ _res);
20975
20976 /**
20977  * Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state.
20978  */
20979 struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_ok(struct LDKInvoice o);
20980
20981 /**
20982  * Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state.
20983  */
20984 struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_err(struct LDKSignOrCreationError e);
20985
20986 /**
20987  * Checks if the given object is currently in the success state
20988  */
20989 bool CResult_InvoiceSignOrCreationErrorZ_is_ok(const struct LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR o);
20990
20991 /**
20992  * Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ.
20993  */
20994 void CResult_InvoiceSignOrCreationErrorZ_free(struct LDKCResult_InvoiceSignOrCreationErrorZ _res);
20995
20996 /**
20997  * Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig`
20998  * but with all dynamically-allocated buffers duplicated in new buffers.
20999  */
21000 struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_clone(const struct LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR orig);
21001
21002 /**
21003  * Frees the buffer pointed to by `data` if `datalen` is non-0.
21004  */
21005 void CVec_FutureZ_free(struct LDKCVec_FutureZ _res);
21006
21007 /**
21008  * Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter
21009  */
21010 struct LDKCOption_FilterZ COption_FilterZ_some(struct LDKFilter o);
21011
21012 /**
21013  * Constructs a new COption_FilterZ containing nothing
21014  */
21015 struct LDKCOption_FilterZ COption_FilterZ_none(void);
21016
21017 /**
21018  * Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state
21019  */
21020 void COption_FilterZ_free(struct LDKCOption_FilterZ _res);
21021
21022 /**
21023  * Creates a new CResult_LockedChannelMonitorNoneZ in the success state.
21024  */
21025 struct LDKCResult_LockedChannelMonitorNoneZ CResult_LockedChannelMonitorNoneZ_ok(struct LDKLockedChannelMonitor o);
21026
21027 /**
21028  * Creates a new CResult_LockedChannelMonitorNoneZ in the error state.
21029  */
21030 struct LDKCResult_LockedChannelMonitorNoneZ CResult_LockedChannelMonitorNoneZ_err(void);
21031
21032 /**
21033  * Checks if the given object is currently in the success state
21034  */
21035 bool CResult_LockedChannelMonitorNoneZ_is_ok(const struct LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR o);
21036
21037 /**
21038  * Frees any resources used by the CResult_LockedChannelMonitorNoneZ.
21039  */
21040 void CResult_LockedChannelMonitorNoneZ_free(struct LDKCResult_LockedChannelMonitorNoneZ _res);
21041
21042 /**
21043  * Frees the buffer pointed to by `data` if `datalen` is non-0.
21044  */
21045 void CVec_OutPointZ_free(struct LDKCVec_OutPointZ _res);
21046
21047 /**
21048  * Frees the buffer pointed to by `data` if `datalen` is non-0.
21049  */
21050 void CVec_MonitorUpdateIdZ_free(struct LDKCVec_MonitorUpdateIdZ _res);
21051
21052 /**
21053  * Creates a new tuple which has the same data as `orig`
21054  * but with all dynamically-allocated buffers duplicated in new buffers.
21055  */
21056 struct LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(const struct LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR orig);
21057
21058 /**
21059  * Creates a new C2Tuple_OutPointCVec_MonitorUpdateIdZZ from the contained elements.
21060  */
21061 struct LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(struct LDKOutPoint a, struct LDKCVec_MonitorUpdateIdZ b);
21062
21063 /**
21064  * Frees any resources used by the C2Tuple_OutPointCVec_MonitorUpdateIdZZ.
21065  */
21066 void C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(struct LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ _res);
21067
21068 /**
21069  * Frees the buffer pointed to by `data` if `datalen` is non-0.
21070  */
21071 void CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(struct LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ _res);
21072
21073 /**
21074  * Creates a new CResult_u32GraphSyncErrorZ in the success state.
21075  */
21076 struct LDKCResult_u32GraphSyncErrorZ CResult_u32GraphSyncErrorZ_ok(uint32_t o);
21077
21078 /**
21079  * Creates a new CResult_u32GraphSyncErrorZ in the error state.
21080  */
21081 struct LDKCResult_u32GraphSyncErrorZ CResult_u32GraphSyncErrorZ_err(struct LDKGraphSyncError e);
21082
21083 /**
21084  * Checks if the given object is currently in the success state
21085  */
21086 bool CResult_u32GraphSyncErrorZ_is_ok(const struct LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR o);
21087
21088 /**
21089  * Frees any resources used by the CResult_u32GraphSyncErrorZ.
21090  */
21091 void CResult_u32GraphSyncErrorZ_free(struct LDKCResult_u32GraphSyncErrorZ _res);
21092
21093 /**
21094  * Frees any resources used by the APIError
21095  */
21096 void APIError_free(struct LDKAPIError this_ptr);
21097
21098 /**
21099  * Creates a copy of the APIError
21100  */
21101 struct LDKAPIError APIError_clone(const struct LDKAPIError *NONNULL_PTR orig);
21102
21103 /**
21104  * Utility method to constructs a new APIMisuseError-variant APIError
21105  */
21106 struct LDKAPIError APIError_apimisuse_error(struct LDKStr err);
21107
21108 /**
21109  * Utility method to constructs a new FeeRateTooHigh-variant APIError
21110  */
21111 struct LDKAPIError APIError_fee_rate_too_high(struct LDKStr err, uint32_t feerate);
21112
21113 /**
21114  * Utility method to constructs a new InvalidRoute-variant APIError
21115  */
21116 struct LDKAPIError APIError_invalid_route(struct LDKStr err);
21117
21118 /**
21119  * Utility method to constructs a new ChannelUnavailable-variant APIError
21120  */
21121 struct LDKAPIError APIError_channel_unavailable(struct LDKStr err);
21122
21123 /**
21124  * Utility method to constructs a new MonitorUpdateInProgress-variant APIError
21125  */
21126 struct LDKAPIError APIError_monitor_update_in_progress(void);
21127
21128 /**
21129  * Utility method to constructs a new IncompatibleShutdownScript-variant APIError
21130  */
21131 struct LDKAPIError APIError_incompatible_shutdown_script(struct LDKShutdownScript script);
21132
21133 /**
21134  * Checks if two APIErrors contain equal inner contents.
21135  * This ignores pointers and is_owned flags and looks at the values in fields.
21136  */
21137 bool APIError_eq(const struct LDKAPIError *NONNULL_PTR a, const struct LDKAPIError *NONNULL_PTR b);
21138
21139 /**
21140  * Serialize the APIError object into a byte array which can be read by APIError_read
21141  */
21142 struct LDKCVec_u8Z APIError_write(const struct LDKAPIError *NONNULL_PTR obj);
21143
21144 /**
21145  * Read a APIError from a byte array, created by APIError_write
21146  */
21147 struct LDKCResult_COption_APIErrorZDecodeErrorZ APIError_read(struct LDKu8slice ser);
21148
21149 /**
21150  * Frees any resources used by the BigSize, if is_owned is set and inner is non-NULL.
21151  */
21152 void BigSize_free(struct LDKBigSize this_obj);
21153
21154 uint64_t BigSize_get_a(const struct LDKBigSize *NONNULL_PTR this_ptr);
21155
21156 void BigSize_set_a(struct LDKBigSize *NONNULL_PTR this_ptr, uint64_t val);
21157
21158 /**
21159  * Constructs a new BigSize given each field
21160  */
21161 MUST_USE_RES struct LDKBigSize BigSize_new(uint64_t a_arg);
21162
21163 /**
21164  * Frees any resources used by the Hostname, if is_owned is set and inner is non-NULL.
21165  */
21166 void Hostname_free(struct LDKHostname this_obj);
21167
21168 /**
21169  * Creates a copy of the Hostname
21170  */
21171 struct LDKHostname Hostname_clone(const struct LDKHostname *NONNULL_PTR orig);
21172
21173 /**
21174  * Checks if two Hostnames contain equal inner contents.
21175  * This ignores pointers and is_owned flags and looks at the values in fields.
21176  * Two objects with NULL inner values will be considered "equal" here.
21177  */
21178 bool Hostname_eq(const struct LDKHostname *NONNULL_PTR a, const struct LDKHostname *NONNULL_PTR b);
21179
21180 /**
21181  * Returns the length of the hostname.
21182  */
21183 MUST_USE_RES uint8_t Hostname_len(const struct LDKHostname *NONNULL_PTR this_arg);
21184
21185 /**
21186  * Creates a digital signature of a message given a SecretKey, like the node's secret.
21187  * A receiver knowing the PublicKey (e.g. the node's id) and the message can be sure that the signature was generated by the caller.
21188  * Signatures are EC recoverable, meaning that given the message and the signature the PublicKey of the signer can be extracted.
21189  */
21190 struct LDKCResult_StringErrorZ sign(struct LDKu8slice msg, const uint8_t (*sk)[32]);
21191
21192 /**
21193  * Recovers the PublicKey of the signer of the message given the message and the signature.
21194  */
21195 struct LDKCResult_PublicKeyErrorZ recover_pk(struct LDKu8slice msg, struct LDKStr sig);
21196
21197 /**
21198  * Verifies a message was signed by a PrivateKey that derives to a given PublicKey, given a message, a signature,
21199  * and the PublicKey.
21200  */
21201 bool verify(struct LDKu8slice msg, struct LDKStr sig, struct LDKPublicKey pk);
21202
21203 /**
21204  * Construct the invoice's HRP and signatureless data into a preimage to be hashed.
21205  */
21206 struct LDKCVec_u8Z construct_invoice_preimage(struct LDKu8slice hrp_bytes, struct LDKCVec_U5Z data_without_signature);
21207
21208 /**
21209  * Calls the free function if one is set
21210  */
21211 void Persister_free(struct LDKPersister this_ptr);
21212
21213 /**
21214  * Frees any resources used by the UntrustedString, if is_owned is set and inner is non-NULL.
21215  */
21216 void UntrustedString_free(struct LDKUntrustedString this_obj);
21217
21218 struct LDKStr UntrustedString_get_a(const struct LDKUntrustedString *NONNULL_PTR this_ptr);
21219
21220 void UntrustedString_set_a(struct LDKUntrustedString *NONNULL_PTR this_ptr, struct LDKStr val);
21221
21222 /**
21223  * Constructs a new UntrustedString given each field
21224  */
21225 MUST_USE_RES struct LDKUntrustedString UntrustedString_new(struct LDKStr a_arg);
21226
21227 /**
21228  * Creates a copy of the UntrustedString
21229  */
21230 struct LDKUntrustedString UntrustedString_clone(const struct LDKUntrustedString *NONNULL_PTR orig);
21231
21232 /**
21233  * Checks if two UntrustedStrings contain equal inner contents.
21234  * This ignores pointers and is_owned flags and looks at the values in fields.
21235  * Two objects with NULL inner values will be considered "equal" here.
21236  */
21237 bool UntrustedString_eq(const struct LDKUntrustedString *NONNULL_PTR a, const struct LDKUntrustedString *NONNULL_PTR b);
21238
21239 /**
21240  * Serialize the UntrustedString object into a byte array which can be read by UntrustedString_read
21241  */
21242 struct LDKCVec_u8Z UntrustedString_write(const struct LDKUntrustedString *NONNULL_PTR obj);
21243
21244 /**
21245  * Read a UntrustedString from a byte array, created by UntrustedString_write
21246  */
21247 struct LDKCResult_UntrustedStringDecodeErrorZ UntrustedString_read(struct LDKu8slice ser);
21248
21249 /**
21250  * Frees any resources used by the PrintableString, if is_owned is set and inner is non-NULL.
21251  */
21252 void PrintableString_free(struct LDKPrintableString this_obj);
21253
21254 struct LDKStr PrintableString_get_a(const struct LDKPrintableString *NONNULL_PTR this_ptr);
21255
21256 void PrintableString_set_a(struct LDKPrintableString *NONNULL_PTR this_ptr, struct LDKStr val);
21257
21258 /**
21259  * Constructs a new PrintableString given each field
21260  */
21261 MUST_USE_RES struct LDKPrintableString PrintableString_new(struct LDKStr a_arg);
21262
21263 /**
21264  * Calls the free function if one is set
21265  */
21266 void FutureCallback_free(struct LDKFutureCallback this_ptr);
21267
21268 /**
21269  * Frees any resources used by the Future, if is_owned is set and inner is non-NULL.
21270  */
21271 void Future_free(struct LDKFuture this_obj);
21272
21273 /**
21274  * Creates a copy of the Future
21275  */
21276 struct LDKFuture Future_clone(const struct LDKFuture *NONNULL_PTR orig);
21277
21278 /**
21279  * Registers a callback to be called upon completion of this future. If the future has already
21280  * completed, the callback will be called immediately.
21281  */
21282 void Future_register_callback_fn(const struct LDKFuture *NONNULL_PTR this_arg, struct LDKFutureCallback callback);
21283
21284 /**
21285  * Waits until this [`Future`] completes.
21286  */
21287 void Future_wait(struct LDKFuture this_arg);
21288
21289 /**
21290  * Waits until this [`Future`] completes or the given amount of time has elapsed.
21291  *
21292  * Returns true if the [`Future`] completed, false if the time elapsed.
21293  */
21294 MUST_USE_RES bool Future_wait_timeout(struct LDKFuture this_arg, uint64_t max_wait);
21295
21296 /**
21297  * Frees any resources used by the Sleeper, if is_owned is set and inner is non-NULL.
21298  */
21299 void Sleeper_free(struct LDKSleeper this_obj);
21300
21301 /**
21302  * Constructs a new sleeper from one future, allowing blocking on it.
21303  */
21304 MUST_USE_RES struct LDKSleeper Sleeper_from_single_future(struct LDKFuture future);
21305
21306 /**
21307  * Constructs a new sleeper from two futures, allowing blocking on both at once.
21308  */
21309 MUST_USE_RES struct LDKSleeper Sleeper_from_two_futures(struct LDKFuture fut_a, struct LDKFuture fut_b);
21310
21311 /**
21312  * Constructs a new sleeper on many futures, allowing blocking on all at once.
21313  */
21314 MUST_USE_RES struct LDKSleeper Sleeper_new(struct LDKCVec_FutureZ futures);
21315
21316 /**
21317  * Wait until one of the [`Future`]s registered with this [`Sleeper`] has completed.
21318  */
21319 void Sleeper_wait(const struct LDKSleeper *NONNULL_PTR this_arg);
21320
21321 /**
21322  * Wait until one of the [`Future`]s registered with this [`Sleeper`] has completed or the
21323  * given amount of time has elapsed. Returns true if a [`Future`] completed, false if the time
21324  * elapsed.
21325  */
21326 MUST_USE_RES bool Sleeper_wait_timeout(const struct LDKSleeper *NONNULL_PTR this_arg, uint64_t max_wait);
21327
21328 /**
21329  * Creates a copy of the Level
21330  */
21331 enum LDKLevel Level_clone(const enum LDKLevel *NONNULL_PTR orig);
21332
21333 /**
21334  * Utility method to constructs a new Gossip-variant Level
21335  */
21336 enum LDKLevel Level_gossip(void);
21337
21338 /**
21339  * Utility method to constructs a new Trace-variant Level
21340  */
21341 enum LDKLevel Level_trace(void);
21342
21343 /**
21344  * Utility method to constructs a new Debug-variant Level
21345  */
21346 enum LDKLevel Level_debug(void);
21347
21348 /**
21349  * Utility method to constructs a new Info-variant Level
21350  */
21351 enum LDKLevel Level_info(void);
21352
21353 /**
21354  * Utility method to constructs a new Warn-variant Level
21355  */
21356 enum LDKLevel Level_warn(void);
21357
21358 /**
21359  * Utility method to constructs a new Error-variant Level
21360  */
21361 enum LDKLevel Level_error(void);
21362
21363 /**
21364  * Checks if two Levels contain equal inner contents.
21365  * This ignores pointers and is_owned flags and looks at the values in fields.
21366  */
21367 bool Level_eq(const enum LDKLevel *NONNULL_PTR a, const enum LDKLevel *NONNULL_PTR b);
21368
21369 /**
21370  * Generates a non-cryptographic 64-bit hash of the Level.
21371  */
21372 uint64_t Level_hash(const enum LDKLevel *NONNULL_PTR o);
21373
21374 /**
21375  * Returns the most verbose logging level.
21376  */
21377 MUST_USE_RES enum LDKLevel Level_max(void);
21378
21379 /**
21380  * Frees any resources used by the Record, if is_owned is set and inner is non-NULL.
21381  */
21382 void Record_free(struct LDKRecord this_obj);
21383
21384 /**
21385  * The verbosity level of the message.
21386  */
21387 enum LDKLevel Record_get_level(const struct LDKRecord *NONNULL_PTR this_ptr);
21388
21389 /**
21390  * The verbosity level of the message.
21391  */
21392 void Record_set_level(struct LDKRecord *NONNULL_PTR this_ptr, enum LDKLevel val);
21393
21394 /**
21395  * The message body.
21396  */
21397 struct LDKStr Record_get_args(const struct LDKRecord *NONNULL_PTR this_ptr);
21398
21399 /**
21400  * The message body.
21401  */
21402 void Record_set_args(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKStr val);
21403
21404 /**
21405  * The module path of the message.
21406  */
21407 struct LDKStr Record_get_module_path(const struct LDKRecord *NONNULL_PTR this_ptr);
21408
21409 /**
21410  * The module path of the message.
21411  */
21412 void Record_set_module_path(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKStr val);
21413
21414 /**
21415  * The source file containing the message.
21416  */
21417 struct LDKStr Record_get_file(const struct LDKRecord *NONNULL_PTR this_ptr);
21418
21419 /**
21420  * The source file containing the message.
21421  */
21422 void Record_set_file(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKStr val);
21423
21424 /**
21425  * The line containing the message.
21426  */
21427 uint32_t Record_get_line(const struct LDKRecord *NONNULL_PTR this_ptr);
21428
21429 /**
21430  * The line containing the message.
21431  */
21432 void Record_set_line(struct LDKRecord *NONNULL_PTR this_ptr, uint32_t val);
21433
21434 /**
21435  * Creates a copy of the Record
21436  */
21437 struct LDKRecord Record_clone(const struct LDKRecord *NONNULL_PTR orig);
21438
21439 /**
21440  * Calls the free function if one is set
21441  */
21442 void Logger_free(struct LDKLogger this_ptr);
21443
21444 /**
21445  * Frees any resources used by the ChannelHandshakeConfig, if is_owned is set and inner is non-NULL.
21446  */
21447 void ChannelHandshakeConfig_free(struct LDKChannelHandshakeConfig this_obj);
21448
21449 /**
21450  * Confirmations we will wait for before considering the channel locked in.
21451  * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
21452  * equivalent limit applied to outbound channels).
21453  *
21454  * A lower-bound of 1 is applied, requiring all channels to have a confirmed commitment
21455  * transaction before operation. If you wish to accept channels with zero confirmations, see
21456  * [`UserConfig::manually_accept_inbound_channels`] and
21457  * [`ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`].
21458  *
21459  * Default value: 6.
21460  *
21461  * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
21462  * [`ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel_from_trusted_peer_0conf
21463  */
21464 uint32_t ChannelHandshakeConfig_get_minimum_depth(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
21465
21466 /**
21467  * Confirmations we will wait for before considering the channel locked in.
21468  * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
21469  * equivalent limit applied to outbound channels).
21470  *
21471  * A lower-bound of 1 is applied, requiring all channels to have a confirmed commitment
21472  * transaction before operation. If you wish to accept channels with zero confirmations, see
21473  * [`UserConfig::manually_accept_inbound_channels`] and
21474  * [`ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`].
21475  *
21476  * Default value: 6.
21477  *
21478  * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
21479  * [`ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel_from_trusted_peer_0conf
21480  */
21481 void ChannelHandshakeConfig_set_minimum_depth(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint32_t val);
21482
21483 /**
21484  * Set to the number of blocks we require our counterparty to wait to claim their money (ie
21485  * the number of blocks we have to punish our counterparty if they broadcast a revoked
21486  * transaction).
21487  *
21488  * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST
21489  * be online to check for revoked transactions on-chain at least once every our_to_self_delay
21490  * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction,
21491  * possibly with time in between to RBF the spending transaction).
21492  *
21493  * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
21494  * case of an honest unilateral channel close, which implicitly decrease the economic value of
21495  * our channel.
21496  *
21497  * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you
21498  * can tweak config to ask for more security, not less.
21499  */
21500 uint16_t ChannelHandshakeConfig_get_our_to_self_delay(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
21501
21502 /**
21503  * Set to the number of blocks we require our counterparty to wait to claim their money (ie
21504  * the number of blocks we have to punish our counterparty if they broadcast a revoked
21505  * transaction).
21506  *
21507  * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST
21508  * be online to check for revoked transactions on-chain at least once every our_to_self_delay
21509  * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction,
21510  * possibly with time in between to RBF the spending transaction).
21511  *
21512  * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
21513  * case of an honest unilateral channel close, which implicitly decrease the economic value of
21514  * our channel.
21515  *
21516  * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you
21517  * can tweak config to ask for more security, not less.
21518  */
21519 void ChannelHandshakeConfig_set_our_to_self_delay(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint16_t val);
21520
21521 /**
21522  * Set to the smallest value HTLC we will accept to process.
21523  *
21524  * This value is sent to our counterparty on channel-open and we close the channel any time
21525  * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
21526  *
21527  * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
21528  * by the protocol.
21529  */
21530 uint64_t ChannelHandshakeConfig_get_our_htlc_minimum_msat(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
21531
21532 /**
21533  * Set to the smallest value HTLC we will accept to process.
21534  *
21535  * This value is sent to our counterparty on channel-open and we close the channel any time
21536  * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
21537  *
21538  * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
21539  * by the protocol.
21540  */
21541 void ChannelHandshakeConfig_set_our_htlc_minimum_msat(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint64_t val);
21542
21543 /**
21544  * Sets the percentage of the channel value we will cap the total value of outstanding inbound
21545  * HTLCs to.
21546  *
21547  * This can be set to a value between 1-100, where the value corresponds to the percent of the
21548  * channel value in whole percentages.
21549  *
21550  * Note that:
21551  * * If configured to another value than the default value 10, any new channels created with
21552  * the non default value will cause versions of LDK prior to 0.0.104 to refuse to read the
21553  * `ChannelManager`.
21554  *
21555  * * This caps the total value for inbound HTLCs in-flight only, and there's currently
21556  * no way to configure the cap for the total value of outbound HTLCs in-flight.
21557  *
21558  * * The requirements for your node being online to ensure the safety of HTLC-encumbered funds
21559  * are different from the non-HTLC-encumbered funds. This makes this an important knob to
21560  * restrict exposure to loss due to being offline for too long.
21561  * See [`ChannelHandshakeConfig::our_to_self_delay`] and [`ChannelConfig::cltv_expiry_delta`]
21562  * for more information.
21563  *
21564  * Default value: 10.
21565  * Minimum value: 1, any values less than 1 will be treated as 1 instead.
21566  * Maximum value: 100, any values larger than 100 will be treated as 100 instead.
21567  */
21568 uint8_t ChannelHandshakeConfig_get_max_inbound_htlc_value_in_flight_percent_of_channel(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
21569
21570 /**
21571  * Sets the percentage of the channel value we will cap the total value of outstanding inbound
21572  * HTLCs to.
21573  *
21574  * This can be set to a value between 1-100, where the value corresponds to the percent of the
21575  * channel value in whole percentages.
21576  *
21577  * Note that:
21578  * * If configured to another value than the default value 10, any new channels created with
21579  * the non default value will cause versions of LDK prior to 0.0.104 to refuse to read the
21580  * `ChannelManager`.
21581  *
21582  * * This caps the total value for inbound HTLCs in-flight only, and there's currently
21583  * no way to configure the cap for the total value of outbound HTLCs in-flight.
21584  *
21585  * * The requirements for your node being online to ensure the safety of HTLC-encumbered funds
21586  * are different from the non-HTLC-encumbered funds. This makes this an important knob to
21587  * restrict exposure to loss due to being offline for too long.
21588  * See [`ChannelHandshakeConfig::our_to_self_delay`] and [`ChannelConfig::cltv_expiry_delta`]
21589  * for more information.
21590  *
21591  * Default value: 10.
21592  * Minimum value: 1, any values less than 1 will be treated as 1 instead.
21593  * Maximum value: 100, any values larger than 100 will be treated as 100 instead.
21594  */
21595 void ChannelHandshakeConfig_set_max_inbound_htlc_value_in_flight_percent_of_channel(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint8_t val);
21596
21597 /**
21598  * If set, we attempt to negotiate the `scid_privacy` (referred to as `scid_alias` in the
21599  * BOLTs) option for outbound private channels. This provides better privacy by not including
21600  * our real on-chain channel UTXO in each invoice and requiring that our counterparty only
21601  * relay HTLCs to us using the channel's SCID alias.
21602  *
21603  * If this option is set, channels may be created that will not be readable by LDK versions
21604  * prior to 0.0.106, causing [`ChannelManager`]'s read method to return a
21605  * [`DecodeError::InvalidValue`].
21606  *
21607  * Note that setting this to true does *not* prevent us from opening channels with
21608  * counterparties that do not support the `scid_alias` option; we will simply fall back to a
21609  * private channel without that option.
21610  *
21611  * Ignored if the channel is negotiated to be announced, see
21612  * [`ChannelHandshakeConfig::announced_channel`] and
21613  * [`ChannelHandshakeLimits::force_announced_channel_preference`] for more.
21614  *
21615  * Default value: false. This value is likely to change to true in the future.
21616  *
21617  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
21618  * [`DecodeError::InvalidValue`]: crate::ln::msgs::DecodeError::InvalidValue
21619  */
21620 bool ChannelHandshakeConfig_get_negotiate_scid_privacy(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
21621
21622 /**
21623  * If set, we attempt to negotiate the `scid_privacy` (referred to as `scid_alias` in the
21624  * BOLTs) option for outbound private channels. This provides better privacy by not including
21625  * our real on-chain channel UTXO in each invoice and requiring that our counterparty only
21626  * relay HTLCs to us using the channel's SCID alias.
21627  *
21628  * If this option is set, channels may be created that will not be readable by LDK versions
21629  * prior to 0.0.106, causing [`ChannelManager`]'s read method to return a
21630  * [`DecodeError::InvalidValue`].
21631  *
21632  * Note that setting this to true does *not* prevent us from opening channels with
21633  * counterparties that do not support the `scid_alias` option; we will simply fall back to a
21634  * private channel without that option.
21635  *
21636  * Ignored if the channel is negotiated to be announced, see
21637  * [`ChannelHandshakeConfig::announced_channel`] and
21638  * [`ChannelHandshakeLimits::force_announced_channel_preference`] for more.
21639  *
21640  * Default value: false. This value is likely to change to true in the future.
21641  *
21642  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
21643  * [`DecodeError::InvalidValue`]: crate::ln::msgs::DecodeError::InvalidValue
21644  */
21645 void ChannelHandshakeConfig_set_negotiate_scid_privacy(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, bool val);
21646
21647 /**
21648  * Set to announce the channel publicly and notify all nodes that they can route via this
21649  * channel.
21650  *
21651  * This should only be set to true for nodes which expect to be online reliably.
21652  *
21653  * As the node which funds a channel picks this value this will only apply for new outbound
21654  * channels unless [`ChannelHandshakeLimits::force_announced_channel_preference`] is set.
21655  *
21656  * Default value: false.
21657  */
21658 bool ChannelHandshakeConfig_get_announced_channel(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
21659
21660 /**
21661  * Set to announce the channel publicly and notify all nodes that they can route via this
21662  * channel.
21663  *
21664  * This should only be set to true for nodes which expect to be online reliably.
21665  *
21666  * As the node which funds a channel picks this value this will only apply for new outbound
21667  * channels unless [`ChannelHandshakeLimits::force_announced_channel_preference`] is set.
21668  *
21669  * Default value: false.
21670  */
21671 void ChannelHandshakeConfig_set_announced_channel(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, bool val);
21672
21673 /**
21674  * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
21675  * supports it, they will then enforce the mutual-close output to us matches what we provided
21676  * at intialization, preventing us from closing to an alternate pubkey.
21677  *
21678  * This is set to true by default to provide a slight increase in security, though ultimately
21679  * any attacker who is able to take control of a channel can just as easily send the funds via
21680  * lightning payments, so we never require that our counterparties support this option.
21681  *
21682  * The upfront key committed is provided from [`SignerProvider::get_shutdown_scriptpubkey`].
21683  *
21684  * Default value: true.
21685  *
21686  * [`SignerProvider::get_shutdown_scriptpubkey`]: crate::chain::keysinterface::SignerProvider::get_shutdown_scriptpubkey
21687  */
21688 bool ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
21689
21690 /**
21691  * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
21692  * supports it, they will then enforce the mutual-close output to us matches what we provided
21693  * at intialization, preventing us from closing to an alternate pubkey.
21694  *
21695  * This is set to true by default to provide a slight increase in security, though ultimately
21696  * any attacker who is able to take control of a channel can just as easily send the funds via
21697  * lightning payments, so we never require that our counterparties support this option.
21698  *
21699  * The upfront key committed is provided from [`SignerProvider::get_shutdown_scriptpubkey`].
21700  *
21701  * Default value: true.
21702  *
21703  * [`SignerProvider::get_shutdown_scriptpubkey`]: crate::chain::keysinterface::SignerProvider::get_shutdown_scriptpubkey
21704  */
21705 void ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, bool val);
21706
21707 /**
21708  * The Proportion of the channel value to configure as counterparty's channel reserve,
21709  * i.e., `their_channel_reserve_satoshis` for both outbound and inbound channels.
21710  *
21711  * `their_channel_reserve_satoshis` is the minimum balance that the other node has to maintain
21712  * on their side, at all times.
21713  * This ensures that if our counterparty broadcasts a revoked state, we can punish them by
21714  * claiming at least this value on chain.
21715  *
21716  * Channel reserve values greater than 30% could be considered highly unreasonable, since that
21717  * amount can never be used for payments.
21718  * Also, if our selected channel reserve for counterparty and counterparty's selected
21719  * channel reserve for us sum up to equal or greater than channel value, channel negotiations
21720  * will fail.
21721  *
21722  * Note: Versions of LDK earlier than v0.0.104 will fail to read channels with any channel reserve
21723  * other than the default value.
21724  *
21725  * Default value: 1% of channel value, i.e., configured as 10,000 millionths.
21726  * Minimum value: If the calculated proportional value is less than 1000 sats, it will be treated
21727  *                as 1000 sats instead, which is a safe implementation-specific lower bound.
21728  * Maximum value: 1,000,000, any values larger than 1 Million will be treated as 1 Million (or 100%)
21729  *                instead, although channel negotiations will fail in that case.
21730  */
21731 uint32_t ChannelHandshakeConfig_get_their_channel_reserve_proportional_millionths(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
21732
21733 /**
21734  * The Proportion of the channel value to configure as counterparty's channel reserve,
21735  * i.e., `their_channel_reserve_satoshis` for both outbound and inbound channels.
21736  *
21737  * `their_channel_reserve_satoshis` is the minimum balance that the other node has to maintain
21738  * on their side, at all times.
21739  * This ensures that if our counterparty broadcasts a revoked state, we can punish them by
21740  * claiming at least this value on chain.
21741  *
21742  * Channel reserve values greater than 30% could be considered highly unreasonable, since that
21743  * amount can never be used for payments.
21744  * Also, if our selected channel reserve for counterparty and counterparty's selected
21745  * channel reserve for us sum up to equal or greater than channel value, channel negotiations
21746  * will fail.
21747  *
21748  * Note: Versions of LDK earlier than v0.0.104 will fail to read channels with any channel reserve
21749  * other than the default value.
21750  *
21751  * Default value: 1% of channel value, i.e., configured as 10,000 millionths.
21752  * Minimum value: If the calculated proportional value is less than 1000 sats, it will be treated
21753  *                as 1000 sats instead, which is a safe implementation-specific lower bound.
21754  * Maximum value: 1,000,000, any values larger than 1 Million will be treated as 1 Million (or 100%)
21755  *                instead, although channel negotiations will fail in that case.
21756  */
21757 void ChannelHandshakeConfig_set_their_channel_reserve_proportional_millionths(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint32_t val);
21758
21759 /**
21760  * The maximum number of HTLCs in-flight from our counterparty towards us at the same time.
21761  *
21762  * Increasing the value can help improve liquidity and stability in
21763  * routing at the cost of higher long term disk / DB usage.
21764  *
21765  * Note: Versions of LDK earlier than v0.0.115 will fail to read channels with a configuration
21766  * other than the default value.
21767  *
21768  * Default value: 50
21769  * Maximum value: 483, any values larger will be treated as 483.
21770  *                     This is the BOLT #2 spec limit on `max_accepted_htlcs`.
21771  */
21772 uint16_t ChannelHandshakeConfig_get_our_max_accepted_htlcs(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
21773
21774 /**
21775  * The maximum number of HTLCs in-flight from our counterparty towards us at the same time.
21776  *
21777  * Increasing the value can help improve liquidity and stability in
21778  * routing at the cost of higher long term disk / DB usage.
21779  *
21780  * Note: Versions of LDK earlier than v0.0.115 will fail to read channels with a configuration
21781  * other than the default value.
21782  *
21783  * Default value: 50
21784  * Maximum value: 483, any values larger will be treated as 483.
21785  *                     This is the BOLT #2 spec limit on `max_accepted_htlcs`.
21786  */
21787 void ChannelHandshakeConfig_set_our_max_accepted_htlcs(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint16_t val);
21788
21789 /**
21790  * Constructs a new ChannelHandshakeConfig given each field
21791  */
21792 MUST_USE_RES struct LDKChannelHandshakeConfig ChannelHandshakeConfig_new(uint32_t minimum_depth_arg, uint16_t our_to_self_delay_arg, uint64_t our_htlc_minimum_msat_arg, uint8_t max_inbound_htlc_value_in_flight_percent_of_channel_arg, bool negotiate_scid_privacy_arg, bool announced_channel_arg, bool commit_upfront_shutdown_pubkey_arg, uint32_t their_channel_reserve_proportional_millionths_arg, uint16_t our_max_accepted_htlcs_arg);
21793
21794 /**
21795  * Creates a copy of the ChannelHandshakeConfig
21796  */
21797 struct LDKChannelHandshakeConfig ChannelHandshakeConfig_clone(const struct LDKChannelHandshakeConfig *NONNULL_PTR orig);
21798
21799 /**
21800  * Creates a "default" ChannelHandshakeConfig. See struct and individual field documentaiton for details on which values are used.
21801  */
21802 MUST_USE_RES struct LDKChannelHandshakeConfig ChannelHandshakeConfig_default(void);
21803
21804 /**
21805  * Frees any resources used by the ChannelHandshakeLimits, if is_owned is set and inner is non-NULL.
21806  */
21807 void ChannelHandshakeLimits_free(struct LDKChannelHandshakeLimits this_obj);
21808
21809 /**
21810  * Minimum allowed satoshis when a channel is funded. This is supplied by the sender and so
21811  * only applies to inbound channels.
21812  *
21813  * Default value: 0.
21814  */
21815 uint64_t ChannelHandshakeLimits_get_min_funding_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
21816
21817 /**
21818  * Minimum allowed satoshis when a channel is funded. This is supplied by the sender and so
21819  * only applies to inbound channels.
21820  *
21821  * Default value: 0.
21822  */
21823 void ChannelHandshakeLimits_set_min_funding_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
21824
21825 /**
21826  * Maximum allowed satoshis when a channel is funded. This is supplied by the sender and so
21827  * only applies to inbound channels.
21828  *
21829  * Default value: 2^24 - 1.
21830  */
21831 uint64_t ChannelHandshakeLimits_get_max_funding_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
21832
21833 /**
21834  * Maximum allowed satoshis when a channel is funded. This is supplied by the sender and so
21835  * only applies to inbound channels.
21836  *
21837  * Default value: 2^24 - 1.
21838  */
21839 void ChannelHandshakeLimits_set_max_funding_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
21840
21841 /**
21842  * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
21843  * you to limit the maximum minimum-size they can require.
21844  *
21845  * Default value: u64::max_value.
21846  */
21847 uint64_t ChannelHandshakeLimits_get_max_htlc_minimum_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
21848
21849 /**
21850  * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
21851  * you to limit the maximum minimum-size they can require.
21852  *
21853  * Default value: u64::max_value.
21854  */
21855 void ChannelHandshakeLimits_set_max_htlc_minimum_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
21856
21857 /**
21858  * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
21859  * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
21860  *
21861  * Default value: 0.
21862  */
21863 uint64_t ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
21864
21865 /**
21866  * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
21867  * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
21868  *
21869  * Default value: 0.
21870  */
21871 void ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
21872
21873 /**
21874  * The remote node will require we keep a certain amount in direct payment to ourselves at all
21875  * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
21876  * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
21877  *
21878  * Default value: u64::max_value.
21879  */
21880 uint64_t ChannelHandshakeLimits_get_max_channel_reserve_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
21881
21882 /**
21883  * The remote node will require we keep a certain amount in direct payment to ourselves at all
21884  * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
21885  * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
21886  *
21887  * Default value: u64::max_value.
21888  */
21889 void ChannelHandshakeLimits_set_max_channel_reserve_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
21890
21891 /**
21892  * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
21893  * time. This allows you to set a minimum such value.
21894  *
21895  * Default value: 0.
21896  */
21897 uint16_t ChannelHandshakeLimits_get_min_max_accepted_htlcs(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
21898
21899 /**
21900  * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
21901  * time. This allows you to set a minimum such value.
21902  *
21903  * Default value: 0.
21904  */
21905 void ChannelHandshakeLimits_set_min_max_accepted_htlcs(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
21906
21907 /**
21908  * Before a channel is usable the funding transaction will need to be confirmed by at least a
21909  * certain number of blocks, specified by the node which is not the funder (as the funder can
21910  * assume they aren't going to double-spend themselves).
21911  * This config allows you to set a limit on the maximum amount of time to wait.
21912  *
21913  * Default value: 144, or roughly one day and only applies to outbound channels.
21914  */
21915 uint32_t ChannelHandshakeLimits_get_max_minimum_depth(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
21916
21917 /**
21918  * Before a channel is usable the funding transaction will need to be confirmed by at least a
21919  * certain number of blocks, specified by the node which is not the funder (as the funder can
21920  * assume they aren't going to double-spend themselves).
21921  * This config allows you to set a limit on the maximum amount of time to wait.
21922  *
21923  * Default value: 144, or roughly one day and only applies to outbound channels.
21924  */
21925 void ChannelHandshakeLimits_set_max_minimum_depth(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint32_t val);
21926
21927 /**
21928  * Whether we implicitly trust funding transactions generated by us for our own outbound
21929  * channels to not be double-spent.
21930  *
21931  * If this is set, we assume that our own funding transactions are *never* double-spent, and
21932  * thus we can trust them without any confirmations. This is generally a reasonable
21933  * assumption, given we're the only ones who could ever double-spend it (assuming we have sole
21934  * control of the signing keys).
21935  *
21936  * You may wish to un-set this if you allow the user to (or do in an automated fashion)
21937  * double-spend the funding transaction to RBF with an alternative channel open.
21938  *
21939  * This only applies if our counterparty set their confirmations-required value to 0, and we
21940  * always trust our own funding transaction at 1 confirmation irrespective of this value.
21941  * Thus, this effectively acts as a `min_minimum_depth`, with the only possible values being
21942  * `true` (0) and `false` (1).
21943  *
21944  * Default value: true
21945  */
21946 bool ChannelHandshakeLimits_get_trust_own_funding_0conf(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
21947
21948 /**
21949  * Whether we implicitly trust funding transactions generated by us for our own outbound
21950  * channels to not be double-spent.
21951  *
21952  * If this is set, we assume that our own funding transactions are *never* double-spent, and
21953  * thus we can trust them without any confirmations. This is generally a reasonable
21954  * assumption, given we're the only ones who could ever double-spend it (assuming we have sole
21955  * control of the signing keys).
21956  *
21957  * You may wish to un-set this if you allow the user to (or do in an automated fashion)
21958  * double-spend the funding transaction to RBF with an alternative channel open.
21959  *
21960  * This only applies if our counterparty set their confirmations-required value to 0, and we
21961  * always trust our own funding transaction at 1 confirmation irrespective of this value.
21962  * Thus, this effectively acts as a `min_minimum_depth`, with the only possible values being
21963  * `true` (0) and `false` (1).
21964  *
21965  * Default value: true
21966  */
21967 void ChannelHandshakeLimits_set_trust_own_funding_0conf(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, bool val);
21968
21969 /**
21970  * Set to force an incoming channel to match our announced channel preference in
21971  * [`ChannelHandshakeConfig::announced_channel`].
21972  *
21973  * For a node which is not online reliably, this should be set to true and
21974  * [`ChannelHandshakeConfig::announced_channel`] set to false, ensuring that no announced (aka public)
21975  * channels will ever be opened.
21976  *
21977  * Default value: true.
21978  */
21979 bool ChannelHandshakeLimits_get_force_announced_channel_preference(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
21980
21981 /**
21982  * Set to force an incoming channel to match our announced channel preference in
21983  * [`ChannelHandshakeConfig::announced_channel`].
21984  *
21985  * For a node which is not online reliably, this should be set to true and
21986  * [`ChannelHandshakeConfig::announced_channel`] set to false, ensuring that no announced (aka public)
21987  * channels will ever be opened.
21988  *
21989  * Default value: true.
21990  */
21991 void ChannelHandshakeLimits_set_force_announced_channel_preference(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, bool val);
21992
21993 /**
21994  * Set to the amount of time we're willing to wait to claim money back to us.
21995  *
21996  * Not checking this value would be a security issue, as our peer would be able to set it to
21997  * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
21998  *
21999  * Default value: 2016, which we also enforce as a maximum value so you can tweak config to
22000  * reduce the loss of having useless locked funds (if your peer accepts)
22001  */
22002 uint16_t ChannelHandshakeLimits_get_their_to_self_delay(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
22003
22004 /**
22005  * Set to the amount of time we're willing to wait to claim money back to us.
22006  *
22007  * Not checking this value would be a security issue, as our peer would be able to set it to
22008  * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
22009  *
22010  * Default value: 2016, which we also enforce as a maximum value so you can tweak config to
22011  * reduce the loss of having useless locked funds (if your peer accepts)
22012  */
22013 void ChannelHandshakeLimits_set_their_to_self_delay(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
22014
22015 /**
22016  * Constructs a new ChannelHandshakeLimits given each field
22017  */
22018 MUST_USE_RES struct LDKChannelHandshakeLimits ChannelHandshakeLimits_new(uint64_t min_funding_satoshis_arg, uint64_t max_funding_satoshis_arg, uint64_t max_htlc_minimum_msat_arg, uint64_t min_max_htlc_value_in_flight_msat_arg, uint64_t max_channel_reserve_satoshis_arg, uint16_t min_max_accepted_htlcs_arg, uint32_t max_minimum_depth_arg, bool trust_own_funding_0conf_arg, bool force_announced_channel_preference_arg, uint16_t their_to_self_delay_arg);
22019
22020 /**
22021  * Creates a copy of the ChannelHandshakeLimits
22022  */
22023 struct LDKChannelHandshakeLimits ChannelHandshakeLimits_clone(const struct LDKChannelHandshakeLimits *NONNULL_PTR orig);
22024
22025 /**
22026  * Creates a "default" ChannelHandshakeLimits. See struct and individual field documentaiton for details on which values are used.
22027  */
22028 MUST_USE_RES struct LDKChannelHandshakeLimits ChannelHandshakeLimits_default(void);
22029
22030 /**
22031  * Frees any resources used by the ChannelConfig, if is_owned is set and inner is non-NULL.
22032  */
22033 void ChannelConfig_free(struct LDKChannelConfig this_obj);
22034
22035 /**
22036  * Amount (in millionths of a satoshi) charged per satoshi for payments forwarded outbound
22037  * over the channel.
22038  * This may be allowed to change at runtime in a later update, however doing so must result in
22039  * update messages sent to notify all nodes of our updated relay fee.
22040  *
22041  * Default value: 0.
22042  */
22043 uint32_t ChannelConfig_get_forwarding_fee_proportional_millionths(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
22044
22045 /**
22046  * Amount (in millionths of a satoshi) charged per satoshi for payments forwarded outbound
22047  * over the channel.
22048  * This may be allowed to change at runtime in a later update, however doing so must result in
22049  * update messages sent to notify all nodes of our updated relay fee.
22050  *
22051  * Default value: 0.
22052  */
22053 void ChannelConfig_set_forwarding_fee_proportional_millionths(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint32_t val);
22054
22055 /**
22056  * Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in
22057  * excess of [`forwarding_fee_proportional_millionths`].
22058  * This may be allowed to change at runtime in a later update, however doing so must result in
22059  * update messages sent to notify all nodes of our updated relay fee.
22060  *
22061  * The default value of a single satoshi roughly matches the market rate on many routing nodes
22062  * as of July 2021. Adjusting it upwards or downwards may change whether nodes route through
22063  * this node.
22064  *
22065  * Default value: 1000.
22066  *
22067  * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths
22068  */
22069 uint32_t ChannelConfig_get_forwarding_fee_base_msat(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
22070
22071 /**
22072  * Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in
22073  * excess of [`forwarding_fee_proportional_millionths`].
22074  * This may be allowed to change at runtime in a later update, however doing so must result in
22075  * update messages sent to notify all nodes of our updated relay fee.
22076  *
22077  * The default value of a single satoshi roughly matches the market rate on many routing nodes
22078  * as of July 2021. Adjusting it upwards or downwards may change whether nodes route through
22079  * this node.
22080  *
22081  * Default value: 1000.
22082  *
22083  * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths
22084  */
22085 void ChannelConfig_set_forwarding_fee_base_msat(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint32_t val);
22086
22087 /**
22088  * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over
22089  * the channel this config applies to.
22090  *
22091  * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight
22092  * HTLC balance when a channel appears on-chain whereas
22093  * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining
22094  * (non-HTLC-encumbered) balance.
22095  *
22096  * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed,
22097  * we (or one of our watchtowers) MUST be online to check for broadcast of the current
22098  * commitment transaction at least once per this many blocks (minus some margin to allow us
22099  * enough time to broadcast and confirm a transaction, possibly with time in between to RBF
22100  * the spending transaction).
22101  *
22102  * Default value: 72 (12 hours at an average of 6 blocks/hour).
22103  * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as
22104  *                [`MIN_CLTV_EXPIRY_DELTA`] instead.
22105  *
22106  * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA
22107  */
22108 uint16_t ChannelConfig_get_cltv_expiry_delta(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
22109
22110 /**
22111  * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over
22112  * the channel this config applies to.
22113  *
22114  * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight
22115  * HTLC balance when a channel appears on-chain whereas
22116  * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining
22117  * (non-HTLC-encumbered) balance.
22118  *
22119  * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed,
22120  * we (or one of our watchtowers) MUST be online to check for broadcast of the current
22121  * commitment transaction at least once per this many blocks (minus some margin to allow us
22122  * enough time to broadcast and confirm a transaction, possibly with time in between to RBF
22123  * the spending transaction).
22124  *
22125  * Default value: 72 (12 hours at an average of 6 blocks/hour).
22126  * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as
22127  *                [`MIN_CLTV_EXPIRY_DELTA`] instead.
22128  *
22129  * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA
22130  */
22131 void ChannelConfig_set_cltv_expiry_delta(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint16_t val);
22132
22133 /**
22134  * Limit our total exposure to in-flight HTLCs which are burned to fees as they are too
22135  * small to claim on-chain.
22136  *
22137  * When an HTLC present in one of our channels is below a \"dust\" threshold, the HTLC will
22138  * not be claimable on-chain, instead being turned into additional miner fees if either
22139  * party force-closes the channel. Because the threshold is per-HTLC, our total exposure
22140  * to such payments may be sustantial if there are many dust HTLCs present when the
22141  * channel is force-closed.
22142  *
22143  * The dust threshold for each HTLC is based on the `dust_limit_satoshis` for each party in a
22144  * channel negotiated throughout the channel open process, along with the fees required to have
22145  * a broadcastable HTLC spending transaction. When a channel supports anchor outputs
22146  * (specifically the zero fee HTLC transaction variant), this threshold no longer takes into
22147  * account the HTLC transaction fee as it is zero.
22148  *
22149  * This limit is applied for sent, forwarded, and received HTLCs and limits the total
22150  * exposure across all three types per-channel. Setting this too low may prevent the
22151  * sending or receipt of low-value HTLCs on high-traffic nodes, and this limit is very
22152  * important to prevent stealing of dust HTLCs by miners.
22153  *
22154  * Default value: 5_000_000 msat.
22155  */
22156 uint64_t ChannelConfig_get_max_dust_htlc_exposure_msat(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
22157
22158 /**
22159  * Limit our total exposure to in-flight HTLCs which are burned to fees as they are too
22160  * small to claim on-chain.
22161  *
22162  * When an HTLC present in one of our channels is below a \"dust\" threshold, the HTLC will
22163  * not be claimable on-chain, instead being turned into additional miner fees if either
22164  * party force-closes the channel. Because the threshold is per-HTLC, our total exposure
22165  * to such payments may be sustantial if there are many dust HTLCs present when the
22166  * channel is force-closed.
22167  *
22168  * The dust threshold for each HTLC is based on the `dust_limit_satoshis` for each party in a
22169  * channel negotiated throughout the channel open process, along with the fees required to have
22170  * a broadcastable HTLC spending transaction. When a channel supports anchor outputs
22171  * (specifically the zero fee HTLC transaction variant), this threshold no longer takes into
22172  * account the HTLC transaction fee as it is zero.
22173  *
22174  * This limit is applied for sent, forwarded, and received HTLCs and limits the total
22175  * exposure across all three types per-channel. Setting this too low may prevent the
22176  * sending or receipt of low-value HTLCs on high-traffic nodes, and this limit is very
22177  * important to prevent stealing of dust HTLCs by miners.
22178  *
22179  * Default value: 5_000_000 msat.
22180  */
22181 void ChannelConfig_set_max_dust_htlc_exposure_msat(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint64_t val);
22182
22183 /**
22184  * The additional fee we're willing to pay to avoid waiting for the counterparty's
22185  * `to_self_delay` to reclaim funds.
22186  *
22187  * When we close a channel cooperatively with our counterparty, we negotiate a fee for the
22188  * closing transaction which both sides find acceptable, ultimately paid by the channel
22189  * funder/initiator.
22190  *
22191  * When we are the funder, because we have to pay the channel closing fee, we bound the
22192  * acceptable fee by our [`Background`] and [`Normal`] fees, with the upper bound increased by
22193  * this value. Because the on-chain fee we'd pay to force-close the channel is kept near our
22194  * [`Normal`] feerate during normal operation, this value represents the additional fee we're
22195  * willing to pay in order to avoid waiting for our counterparty's to_self_delay to reclaim our
22196  * funds.
22197  *
22198  * When we are not the funder, we require the closing transaction fee pay at least our
22199  * [`Background`] fee estimate, but allow our counterparty to pay as much fee as they like.
22200  * Thus, this value is ignored when we are not the funder.
22201  *
22202  * Default value: 1000 satoshis.
22203  *
22204  * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
22205  * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
22206  */
22207 uint64_t ChannelConfig_get_force_close_avoidance_max_fee_satoshis(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
22208
22209 /**
22210  * The additional fee we're willing to pay to avoid waiting for the counterparty's
22211  * `to_self_delay` to reclaim funds.
22212  *
22213  * When we close a channel cooperatively with our counterparty, we negotiate a fee for the
22214  * closing transaction which both sides find acceptable, ultimately paid by the channel
22215  * funder/initiator.
22216  *
22217  * When we are the funder, because we have to pay the channel closing fee, we bound the
22218  * acceptable fee by our [`Background`] and [`Normal`] fees, with the upper bound increased by
22219  * this value. Because the on-chain fee we'd pay to force-close the channel is kept near our
22220  * [`Normal`] feerate during normal operation, this value represents the additional fee we're
22221  * willing to pay in order to avoid waiting for our counterparty's to_self_delay to reclaim our
22222  * funds.
22223  *
22224  * When we are not the funder, we require the closing transaction fee pay at least our
22225  * [`Background`] fee estimate, but allow our counterparty to pay as much fee as they like.
22226  * Thus, this value is ignored when we are not the funder.
22227  *
22228  * Default value: 1000 satoshis.
22229  *
22230  * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
22231  * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
22232  */
22233 void ChannelConfig_set_force_close_avoidance_max_fee_satoshis(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint64_t val);
22234
22235 /**
22236  * Constructs a new ChannelConfig given each field
22237  */
22238 MUST_USE_RES struct LDKChannelConfig ChannelConfig_new(uint32_t forwarding_fee_proportional_millionths_arg, uint32_t forwarding_fee_base_msat_arg, uint16_t cltv_expiry_delta_arg, uint64_t max_dust_htlc_exposure_msat_arg, uint64_t force_close_avoidance_max_fee_satoshis_arg);
22239
22240 /**
22241  * Creates a copy of the ChannelConfig
22242  */
22243 struct LDKChannelConfig ChannelConfig_clone(const struct LDKChannelConfig *NONNULL_PTR orig);
22244
22245 /**
22246  * Checks if two ChannelConfigs contain equal inner contents.
22247  * This ignores pointers and is_owned flags and looks at the values in fields.
22248  * Two objects with NULL inner values will be considered "equal" here.
22249  */
22250 bool ChannelConfig_eq(const struct LDKChannelConfig *NONNULL_PTR a, const struct LDKChannelConfig *NONNULL_PTR b);
22251
22252 /**
22253  * Creates a "default" ChannelConfig. See struct and individual field documentaiton for details on which values are used.
22254  */
22255 MUST_USE_RES struct LDKChannelConfig ChannelConfig_default(void);
22256
22257 /**
22258  * Serialize the ChannelConfig object into a byte array which can be read by ChannelConfig_read
22259  */
22260 struct LDKCVec_u8Z ChannelConfig_write(const struct LDKChannelConfig *NONNULL_PTR obj);
22261
22262 /**
22263  * Read a ChannelConfig from a byte array, created by ChannelConfig_write
22264  */
22265 struct LDKCResult_ChannelConfigDecodeErrorZ ChannelConfig_read(struct LDKu8slice ser);
22266
22267 /**
22268  * Frees any resources used by the UserConfig, if is_owned is set and inner is non-NULL.
22269  */
22270 void UserConfig_free(struct LDKUserConfig this_obj);
22271
22272 /**
22273  * Channel handshake config that we propose to our counterparty.
22274  */
22275 struct LDKChannelHandshakeConfig UserConfig_get_channel_handshake_config(const struct LDKUserConfig *NONNULL_PTR this_ptr);
22276
22277 /**
22278  * Channel handshake config that we propose to our counterparty.
22279  */
22280 void UserConfig_set_channel_handshake_config(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeConfig val);
22281
22282 /**
22283  * Limits applied to our counterparty's proposed channel handshake config settings.
22284  */
22285 struct LDKChannelHandshakeLimits UserConfig_get_channel_handshake_limits(const struct LDKUserConfig *NONNULL_PTR this_ptr);
22286
22287 /**
22288  * Limits applied to our counterparty's proposed channel handshake config settings.
22289  */
22290 void UserConfig_set_channel_handshake_limits(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeLimits val);
22291
22292 /**
22293  * Channel config which affects behavior during channel lifetime.
22294  */
22295 struct LDKChannelConfig UserConfig_get_channel_config(const struct LDKUserConfig *NONNULL_PTR this_ptr);
22296
22297 /**
22298  * Channel config which affects behavior during channel lifetime.
22299  */
22300 void UserConfig_set_channel_config(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelConfig val);
22301
22302 /**
22303  * If this is set to false, we will reject any HTLCs which were to be forwarded over private
22304  * channels. This prevents us from taking on HTLC-forwarding risk when we intend to run as a
22305  * node which is not online reliably.
22306  *
22307  * For nodes which are not online reliably, you should set all channels to *not* be announced
22308  * (using [`ChannelHandshakeConfig::announced_channel`] and
22309  * [`ChannelHandshakeLimits::force_announced_channel_preference`]) and set this to false to
22310  * ensure you are not exposed to any forwarding risk.
22311  *
22312  * Note that because you cannot change a channel's announced state after creation, there is no
22313  * way to disable forwarding on public channels retroactively. Thus, in order to change a node
22314  * from a publicly-announced forwarding node to a private non-forwarding node you must close
22315  * all your channels and open new ones. For privacy, you should also change your node_id
22316  * (swapping all private and public key material for new ones) at that time.
22317  *
22318  * Default value: false.
22319  */
22320 bool UserConfig_get_accept_forwards_to_priv_channels(const struct LDKUserConfig *NONNULL_PTR this_ptr);
22321
22322 /**
22323  * If this is set to false, we will reject any HTLCs which were to be forwarded over private
22324  * channels. This prevents us from taking on HTLC-forwarding risk when we intend to run as a
22325  * node which is not online reliably.
22326  *
22327  * For nodes which are not online reliably, you should set all channels to *not* be announced
22328  * (using [`ChannelHandshakeConfig::announced_channel`] and
22329  * [`ChannelHandshakeLimits::force_announced_channel_preference`]) and set this to false to
22330  * ensure you are not exposed to any forwarding risk.
22331  *
22332  * Note that because you cannot change a channel's announced state after creation, there is no
22333  * way to disable forwarding on public channels retroactively. Thus, in order to change a node
22334  * from a publicly-announced forwarding node to a private non-forwarding node you must close
22335  * all your channels and open new ones. For privacy, you should also change your node_id
22336  * (swapping all private and public key material for new ones) at that time.
22337  *
22338  * Default value: false.
22339  */
22340 void UserConfig_set_accept_forwards_to_priv_channels(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val);
22341
22342 /**
22343  * If this is set to false, we do not accept inbound requests to open a new channel.
22344  * Default value: true.
22345  */
22346 bool UserConfig_get_accept_inbound_channels(const struct LDKUserConfig *NONNULL_PTR this_ptr);
22347
22348 /**
22349  * If this is set to false, we do not accept inbound requests to open a new channel.
22350  * Default value: true.
22351  */
22352 void UserConfig_set_accept_inbound_channels(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val);
22353
22354 /**
22355  * If this is set to true, the user needs to manually accept inbound requests to open a new
22356  * channel.
22357  *
22358  * When set to true, [`Event::OpenChannelRequest`] will be triggered once a request to open a
22359  * new inbound channel is received through a [`msgs::OpenChannel`] message. In that case, a
22360  * [`msgs::AcceptChannel`] message will not be sent back to the counterparty node unless the
22361  * user explicitly chooses to accept the request.
22362  *
22363  * Default value: false.
22364  *
22365  * [`Event::OpenChannelRequest`]: crate::events::Event::OpenChannelRequest
22366  * [`msgs::OpenChannel`]: crate::ln::msgs::OpenChannel
22367  * [`msgs::AcceptChannel`]: crate::ln::msgs::AcceptChannel
22368  */
22369 bool UserConfig_get_manually_accept_inbound_channels(const struct LDKUserConfig *NONNULL_PTR this_ptr);
22370
22371 /**
22372  * If this is set to true, the user needs to manually accept inbound requests to open a new
22373  * channel.
22374  *
22375  * When set to true, [`Event::OpenChannelRequest`] will be triggered once a request to open a
22376  * new inbound channel is received through a [`msgs::OpenChannel`] message. In that case, a
22377  * [`msgs::AcceptChannel`] message will not be sent back to the counterparty node unless the
22378  * user explicitly chooses to accept the request.
22379  *
22380  * Default value: false.
22381  *
22382  * [`Event::OpenChannelRequest`]: crate::events::Event::OpenChannelRequest
22383  * [`msgs::OpenChannel`]: crate::ln::msgs::OpenChannel
22384  * [`msgs::AcceptChannel`]: crate::ln::msgs::AcceptChannel
22385  */
22386 void UserConfig_set_manually_accept_inbound_channels(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val);
22387
22388 /**
22389  *  If this is set to true, LDK will intercept HTLCs that are attempting to be forwarded over
22390  *  fake short channel ids generated via [`ChannelManager::get_intercept_scid`]. Upon HTLC
22391  *  intercept, LDK will generate an [`Event::HTLCIntercepted`] which MUST be handled by the user.
22392  *
22393  *  Setting this to true may break backwards compatibility with LDK versions < 0.0.113.
22394  *
22395  *  Default value: false.
22396  *
22397  * [`ChannelManager::get_intercept_scid`]: crate::ln::channelmanager::ChannelManager::get_intercept_scid
22398  * [`Event::HTLCIntercepted`]: crate::events::Event::HTLCIntercepted
22399  */
22400 bool UserConfig_get_accept_intercept_htlcs(const struct LDKUserConfig *NONNULL_PTR this_ptr);
22401
22402 /**
22403  *  If this is set to true, LDK will intercept HTLCs that are attempting to be forwarded over
22404  *  fake short channel ids generated via [`ChannelManager::get_intercept_scid`]. Upon HTLC
22405  *  intercept, LDK will generate an [`Event::HTLCIntercepted`] which MUST be handled by the user.
22406  *
22407  *  Setting this to true may break backwards compatibility with LDK versions < 0.0.113.
22408  *
22409  *  Default value: false.
22410  *
22411  * [`ChannelManager::get_intercept_scid`]: crate::ln::channelmanager::ChannelManager::get_intercept_scid
22412  * [`Event::HTLCIntercepted`]: crate::events::Event::HTLCIntercepted
22413  */
22414 void UserConfig_set_accept_intercept_htlcs(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val);
22415
22416 /**
22417  * Constructs a new UserConfig given each field
22418  */
22419 MUST_USE_RES struct LDKUserConfig UserConfig_new(struct LDKChannelHandshakeConfig channel_handshake_config_arg, struct LDKChannelHandshakeLimits channel_handshake_limits_arg, struct LDKChannelConfig channel_config_arg, bool accept_forwards_to_priv_channels_arg, bool accept_inbound_channels_arg, bool manually_accept_inbound_channels_arg, bool accept_intercept_htlcs_arg);
22420
22421 /**
22422  * Creates a copy of the UserConfig
22423  */
22424 struct LDKUserConfig UserConfig_clone(const struct LDKUserConfig *NONNULL_PTR orig);
22425
22426 /**
22427  * Creates a "default" UserConfig. See struct and individual field documentaiton for details on which values are used.
22428  */
22429 MUST_USE_RES struct LDKUserConfig UserConfig_default(void);
22430
22431 /**
22432  * Frees any resources used by the BestBlock, if is_owned is set and inner is non-NULL.
22433  */
22434 void BestBlock_free(struct LDKBestBlock this_obj);
22435
22436 /**
22437  * Creates a copy of the BestBlock
22438  */
22439 struct LDKBestBlock BestBlock_clone(const struct LDKBestBlock *NONNULL_PTR orig);
22440
22441 /**
22442  * Checks if two BestBlocks contain equal inner contents.
22443  * This ignores pointers and is_owned flags and looks at the values in fields.
22444  * Two objects with NULL inner values will be considered "equal" here.
22445  */
22446 bool BestBlock_eq(const struct LDKBestBlock *NONNULL_PTR a, const struct LDKBestBlock *NONNULL_PTR b);
22447
22448 /**
22449  * Constructs a `BestBlock` that represents the genesis block at height 0 of the given
22450  * network.
22451  */
22452 MUST_USE_RES struct LDKBestBlock BestBlock_from_network(enum LDKNetwork network);
22453
22454 /**
22455  * Returns a `BestBlock` as identified by the given block hash and height.
22456  */
22457 MUST_USE_RES struct LDKBestBlock BestBlock_new(struct LDKThirtyTwoBytes block_hash, uint32_t height);
22458
22459 /**
22460  * Returns the best block hash.
22461  */
22462 MUST_USE_RES struct LDKThirtyTwoBytes BestBlock_block_hash(const struct LDKBestBlock *NONNULL_PTR this_arg);
22463
22464 /**
22465  * Returns the best block height.
22466  */
22467 MUST_USE_RES uint32_t BestBlock_height(const struct LDKBestBlock *NONNULL_PTR this_arg);
22468
22469 /**
22470  * Calls the free function if one is set
22471  */
22472 void Listen_free(struct LDKListen this_ptr);
22473
22474 /**
22475  * Calls the free function if one is set
22476  */
22477 void Confirm_free(struct LDKConfirm this_ptr);
22478
22479 /**
22480  * Creates a copy of the ChannelMonitorUpdateStatus
22481  */
22482 enum LDKChannelMonitorUpdateStatus ChannelMonitorUpdateStatus_clone(const enum LDKChannelMonitorUpdateStatus *NONNULL_PTR orig);
22483
22484 /**
22485  * Utility method to constructs a new Completed-variant ChannelMonitorUpdateStatus
22486  */
22487 enum LDKChannelMonitorUpdateStatus ChannelMonitorUpdateStatus_completed(void);
22488
22489 /**
22490  * Utility method to constructs a new InProgress-variant ChannelMonitorUpdateStatus
22491  */
22492 enum LDKChannelMonitorUpdateStatus ChannelMonitorUpdateStatus_in_progress(void);
22493
22494 /**
22495  * Utility method to constructs a new PermanentFailure-variant ChannelMonitorUpdateStatus
22496  */
22497 enum LDKChannelMonitorUpdateStatus ChannelMonitorUpdateStatus_permanent_failure(void);
22498
22499 /**
22500  * Checks if two ChannelMonitorUpdateStatuss contain equal inner contents.
22501  * This ignores pointers and is_owned flags and looks at the values in fields.
22502  */
22503 bool ChannelMonitorUpdateStatus_eq(const enum LDKChannelMonitorUpdateStatus *NONNULL_PTR a, const enum LDKChannelMonitorUpdateStatus *NONNULL_PTR b);
22504
22505 /**
22506  * Calls the free function if one is set
22507  */
22508 void Watch_free(struct LDKWatch this_ptr);
22509
22510 /**
22511  * Calls the free function if one is set
22512  */
22513 void Filter_free(struct LDKFilter this_ptr);
22514
22515 /**
22516  * Frees any resources used by the WatchedOutput, if is_owned is set and inner is non-NULL.
22517  */
22518 void WatchedOutput_free(struct LDKWatchedOutput this_obj);
22519
22520 /**
22521  * First block where the transaction output may have been spent.
22522  *
22523  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
22524  */
22525 struct LDKThirtyTwoBytes WatchedOutput_get_block_hash(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
22526
22527 /**
22528  * First block where the transaction output may have been spent.
22529  *
22530  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
22531  */
22532 void WatchedOutput_set_block_hash(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
22533
22534 /**
22535  * Outpoint identifying the transaction output.
22536  */
22537 struct LDKOutPoint WatchedOutput_get_outpoint(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
22538
22539 /**
22540  * Outpoint identifying the transaction output.
22541  */
22542 void WatchedOutput_set_outpoint(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKOutPoint val);
22543
22544 /**
22545  * Spending condition of the transaction output.
22546  */
22547 struct LDKu8slice WatchedOutput_get_script_pubkey(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
22548
22549 /**
22550  * Spending condition of the transaction output.
22551  */
22552 void WatchedOutput_set_script_pubkey(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
22553
22554 /**
22555  * Constructs a new WatchedOutput given each field
22556  */
22557 MUST_USE_RES struct LDKWatchedOutput WatchedOutput_new(struct LDKThirtyTwoBytes block_hash_arg, struct LDKOutPoint outpoint_arg, struct LDKCVec_u8Z script_pubkey_arg);
22558
22559 /**
22560  * Creates a copy of the WatchedOutput
22561  */
22562 struct LDKWatchedOutput WatchedOutput_clone(const struct LDKWatchedOutput *NONNULL_PTR orig);
22563
22564 /**
22565  * Checks if two WatchedOutputs contain equal inner contents.
22566  * This ignores pointers and is_owned flags and looks at the values in fields.
22567  * Two objects with NULL inner values will be considered "equal" here.
22568  */
22569 bool WatchedOutput_eq(const struct LDKWatchedOutput *NONNULL_PTR a, const struct LDKWatchedOutput *NONNULL_PTR b);
22570
22571 /**
22572  * Generates a non-cryptographic 64-bit hash of the WatchedOutput.
22573  */
22574 uint64_t WatchedOutput_hash(const struct LDKWatchedOutput *NONNULL_PTR o);
22575
22576 /**
22577  * Calls the free function if one is set
22578  */
22579 void BroadcasterInterface_free(struct LDKBroadcasterInterface this_ptr);
22580
22581 /**
22582  * Creates a copy of the ConfirmationTarget
22583  */
22584 enum LDKConfirmationTarget ConfirmationTarget_clone(const enum LDKConfirmationTarget *NONNULL_PTR orig);
22585
22586 /**
22587  * Utility method to constructs a new Background-variant ConfirmationTarget
22588  */
22589 enum LDKConfirmationTarget ConfirmationTarget_background(void);
22590
22591 /**
22592  * Utility method to constructs a new Normal-variant ConfirmationTarget
22593  */
22594 enum LDKConfirmationTarget ConfirmationTarget_normal(void);
22595
22596 /**
22597  * Utility method to constructs a new HighPriority-variant ConfirmationTarget
22598  */
22599 enum LDKConfirmationTarget ConfirmationTarget_high_priority(void);
22600
22601 /**
22602  * Generates a non-cryptographic 64-bit hash of the ConfirmationTarget.
22603  */
22604 uint64_t ConfirmationTarget_hash(const enum LDKConfirmationTarget *NONNULL_PTR o);
22605
22606 /**
22607  * Checks if two ConfirmationTargets contain equal inner contents.
22608  * This ignores pointers and is_owned flags and looks at the values in fields.
22609  */
22610 bool ConfirmationTarget_eq(const enum LDKConfirmationTarget *NONNULL_PTR a, const enum LDKConfirmationTarget *NONNULL_PTR b);
22611
22612 /**
22613  * Calls the free function if one is set
22614  */
22615 void FeeEstimator_free(struct LDKFeeEstimator this_ptr);
22616
22617 /**
22618  * Frees any resources used by the MonitorUpdateId, if is_owned is set and inner is non-NULL.
22619  */
22620 void MonitorUpdateId_free(struct LDKMonitorUpdateId this_obj);
22621
22622 /**
22623  * Creates a copy of the MonitorUpdateId
22624  */
22625 struct LDKMonitorUpdateId MonitorUpdateId_clone(const struct LDKMonitorUpdateId *NONNULL_PTR orig);
22626
22627 /**
22628  * Generates a non-cryptographic 64-bit hash of the MonitorUpdateId.
22629  */
22630 uint64_t MonitorUpdateId_hash(const struct LDKMonitorUpdateId *NONNULL_PTR o);
22631
22632 /**
22633  * Checks if two MonitorUpdateIds contain equal inner contents.
22634  * This ignores pointers and is_owned flags and looks at the values in fields.
22635  * Two objects with NULL inner values will be considered "equal" here.
22636  */
22637 bool MonitorUpdateId_eq(const struct LDKMonitorUpdateId *NONNULL_PTR a, const struct LDKMonitorUpdateId *NONNULL_PTR b);
22638
22639 /**
22640  * Calls the free function if one is set
22641  */
22642 void Persist_free(struct LDKPersist this_ptr);
22643
22644 /**
22645  * Frees any resources used by the LockedChannelMonitor, if is_owned is set and inner is non-NULL.
22646  */
22647 void LockedChannelMonitor_free(struct LDKLockedChannelMonitor this_obj);
22648
22649 /**
22650  * Frees any resources used by the ChainMonitor, if is_owned is set and inner is non-NULL.
22651  */
22652 void ChainMonitor_free(struct LDKChainMonitor this_obj);
22653
22654 /**
22655  * Creates a new `ChainMonitor` used to watch on-chain activity pertaining to channels.
22656  *
22657  * When an optional chain source implementing [`chain::Filter`] is provided, the chain monitor
22658  * will call back to it indicating transactions and outputs of interest. This allows clients to
22659  * pre-filter blocks or only fetch blocks matching a compact filter. Otherwise, clients may
22660  * always need to fetch full blocks absent another means for determining which blocks contain
22661  * transactions relevant to the watched channels.
22662  */
22663 MUST_USE_RES struct LDKChainMonitor ChainMonitor_new(struct LDKCOption_FilterZ chain_source, struct LDKBroadcasterInterface broadcaster, struct LDKLogger logger, struct LDKFeeEstimator feeest, struct LDKPersist persister);
22664
22665 /**
22666  * Gets the balances in the contained [`ChannelMonitor`]s which are claimable on-chain or
22667  * claims which are awaiting confirmation.
22668  *
22669  * Includes the balances from each [`ChannelMonitor`] *except* those included in
22670  * `ignored_channels`, allowing you to filter out balances from channels which are still open
22671  * (and whose balance should likely be pulled from the [`ChannelDetails`]).
22672  *
22673  * See [`ChannelMonitor::get_claimable_balances`] for more details on the exact criteria for
22674  * inclusion in the return value.
22675  */
22676 MUST_USE_RES struct LDKCVec_BalanceZ ChainMonitor_get_claimable_balances(const struct LDKChainMonitor *NONNULL_PTR this_arg, struct LDKCVec_ChannelDetailsZ ignored_channels);
22677
22678 /**
22679  * Gets the [`LockedChannelMonitor`] for a given funding outpoint, returning an `Err` if no
22680  * such [`ChannelMonitor`] is currently being monitored for.
22681  *
22682  * Note that the result holds a mutex over our monitor set, and should not be held
22683  * indefinitely.
22684  */
22685 MUST_USE_RES struct LDKCResult_LockedChannelMonitorNoneZ ChainMonitor_get_monitor(const struct LDKChainMonitor *NONNULL_PTR this_arg, struct LDKOutPoint funding_txo);
22686
22687 /**
22688  * Lists the funding outpoint of each [`ChannelMonitor`] being monitored.
22689  *
22690  * Note that [`ChannelMonitor`]s are not removed when a channel is closed as they are always
22691  * monitoring for on-chain state resolutions.
22692  */
22693 MUST_USE_RES struct LDKCVec_OutPointZ ChainMonitor_list_monitors(const struct LDKChainMonitor *NONNULL_PTR this_arg);
22694
22695 /**
22696  * Lists the pending updates for each [`ChannelMonitor`] (by `OutPoint` being monitored).
22697  */
22698 MUST_USE_RES struct LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ ChainMonitor_list_pending_monitor_updates(const struct LDKChainMonitor *NONNULL_PTR this_arg);
22699
22700 /**
22701  * Indicates the persistence of a [`ChannelMonitor`] has completed after
22702  * [`ChannelMonitorUpdateStatus::InProgress`] was returned from an update operation.
22703  *
22704  * Thus, the anticipated use is, at a high level:
22705  *  1) This [`ChainMonitor`] calls [`Persist::update_persisted_channel`] which stores the
22706  *     update to disk and begins updating any remote (e.g. watchtower/backup) copies,
22707  *     returning [`ChannelMonitorUpdateStatus::InProgress`],
22708  *  2) once all remote copies are updated, you call this function with the
22709  *     `completed_update_id` that completed, and once all pending updates have completed the
22710  *     channel will be re-enabled.
22711  *
22712  * Returns an [`APIError::APIMisuseError`] if `funding_txo` does not match any currently
22713  * registered [`ChannelMonitor`]s.
22714  */
22715 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChainMonitor_channel_monitor_updated(const struct LDKChainMonitor *NONNULL_PTR this_arg, struct LDKOutPoint funding_txo, struct LDKMonitorUpdateId completed_update_id);
22716
22717 /**
22718  * Gets a [`Future`] that completes when an event is available either via
22719  * [`chain::Watch::release_pending_monitor_events`] or
22720  * [`EventsProvider::process_pending_events`].
22721  *
22722  * Note that callbacks registered on the [`Future`] MUST NOT call back into this
22723  * [`ChainMonitor`] and should instead register actions to be taken later.
22724  *
22725  * [`EventsProvider::process_pending_events`]: crate::events::EventsProvider::process_pending_events
22726  */
22727 MUST_USE_RES struct LDKFuture ChainMonitor_get_update_future(const struct LDKChainMonitor *NONNULL_PTR this_arg);
22728
22729 /**
22730  * Triggers rebroadcasts/fee-bumps of pending claims from a force-closed channel. This is
22731  * crucial in preventing certain classes of pinning attacks, detecting substantial mempool
22732  * feerate changes between blocks, and ensuring reliability if broadcasting fails. We recommend
22733  * invoking this every 30 seconds, or lower if running in an environment with spotty
22734  * connections, like on mobile.
22735  */
22736 void ChainMonitor_rebroadcast_pending_claims(const struct LDKChainMonitor *NONNULL_PTR this_arg);
22737
22738 /**
22739  * Constructs a new Listen which calls the relevant methods on this_arg.
22740  * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is
22741  */
22742 struct LDKListen ChainMonitor_as_Listen(const struct LDKChainMonitor *NONNULL_PTR this_arg);
22743
22744 /**
22745  * Constructs a new Confirm which calls the relevant methods on this_arg.
22746  * This copies the `inner` pointer in this_arg and thus the returned Confirm must be freed before this_arg is
22747  */
22748 struct LDKConfirm ChainMonitor_as_Confirm(const struct LDKChainMonitor *NONNULL_PTR this_arg);
22749
22750 /**
22751  * Constructs a new Watch which calls the relevant methods on this_arg.
22752  * This copies the `inner` pointer in this_arg and thus the returned Watch must be freed before this_arg is
22753  */
22754 struct LDKWatch ChainMonitor_as_Watch(const struct LDKChainMonitor *NONNULL_PTR this_arg);
22755
22756 /**
22757  * Constructs a new EventsProvider which calls the relevant methods on this_arg.
22758  * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is
22759  */
22760 struct LDKEventsProvider ChainMonitor_as_EventsProvider(const struct LDKChainMonitor *NONNULL_PTR this_arg);
22761
22762 /**
22763  * Frees any resources used by the ChannelMonitorUpdate, if is_owned is set and inner is non-NULL.
22764  */
22765 void ChannelMonitorUpdate_free(struct LDKChannelMonitorUpdate this_obj);
22766
22767 /**
22768  * The sequence number of this update. Updates *must* be replayed in-order according to this
22769  * sequence number (and updates may panic if they are not). The update_id values are strictly
22770  * increasing and increase by one for each new update, with two exceptions specified below.
22771  *
22772  * This sequence number is also used to track up to which points updates which returned
22773  * [`ChannelMonitorUpdateStatus::InProgress`] have been applied to all copies of a given
22774  * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
22775  *
22776  * The only instances we allow where update_id values are not strictly increasing have a
22777  * special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. This update ID is used for updates that
22778  * will force close the channel by broadcasting the latest commitment transaction or
22779  * special post-force-close updates, like providing preimages necessary to claim outputs on the
22780  * broadcast commitment transaction. See its docs for more details.
22781  *
22782  * [`ChannelMonitorUpdateStatus::InProgress`]: super::ChannelMonitorUpdateStatus::InProgress
22783  */
22784 uint64_t ChannelMonitorUpdate_get_update_id(const struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr);
22785
22786 /**
22787  * The sequence number of this update. Updates *must* be replayed in-order according to this
22788  * sequence number (and updates may panic if they are not). The update_id values are strictly
22789  * increasing and increase by one for each new update, with two exceptions specified below.
22790  *
22791  * This sequence number is also used to track up to which points updates which returned
22792  * [`ChannelMonitorUpdateStatus::InProgress`] have been applied to all copies of a given
22793  * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
22794  *
22795  * The only instances we allow where update_id values are not strictly increasing have a
22796  * special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. This update ID is used for updates that
22797  * will force close the channel by broadcasting the latest commitment transaction or
22798  * special post-force-close updates, like providing preimages necessary to claim outputs on the
22799  * broadcast commitment transaction. See its docs for more details.
22800  *
22801  * [`ChannelMonitorUpdateStatus::InProgress`]: super::ChannelMonitorUpdateStatus::InProgress
22802  */
22803 void ChannelMonitorUpdate_set_update_id(struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr, uint64_t val);
22804
22805 /**
22806  * Creates a copy of the ChannelMonitorUpdate
22807  */
22808 struct LDKChannelMonitorUpdate ChannelMonitorUpdate_clone(const struct LDKChannelMonitorUpdate *NONNULL_PTR orig);
22809
22810 /**
22811  * Checks if two ChannelMonitorUpdates contain equal inner contents.
22812  * This ignores pointers and is_owned flags and looks at the values in fields.
22813  * Two objects with NULL inner values will be considered "equal" here.
22814  */
22815 bool ChannelMonitorUpdate_eq(const struct LDKChannelMonitorUpdate *NONNULL_PTR a, const struct LDKChannelMonitorUpdate *NONNULL_PTR b);
22816
22817 /**
22818  * Serialize the ChannelMonitorUpdate object into a byte array which can be read by ChannelMonitorUpdate_read
22819  */
22820 struct LDKCVec_u8Z ChannelMonitorUpdate_write(const struct LDKChannelMonitorUpdate *NONNULL_PTR obj);
22821
22822 /**
22823  * Read a ChannelMonitorUpdate from a byte array, created by ChannelMonitorUpdate_write
22824  */
22825 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ ChannelMonitorUpdate_read(struct LDKu8slice ser);
22826
22827 /**
22828  * Frees any resources used by the MonitorEvent
22829  */
22830 void MonitorEvent_free(struct LDKMonitorEvent this_ptr);
22831
22832 /**
22833  * Creates a copy of the MonitorEvent
22834  */
22835 struct LDKMonitorEvent MonitorEvent_clone(const struct LDKMonitorEvent *NONNULL_PTR orig);
22836
22837 /**
22838  * Utility method to constructs a new HTLCEvent-variant MonitorEvent
22839  */
22840 struct LDKMonitorEvent MonitorEvent_htlcevent(struct LDKHTLCUpdate a);
22841
22842 /**
22843  * Utility method to constructs a new CommitmentTxConfirmed-variant MonitorEvent
22844  */
22845 struct LDKMonitorEvent MonitorEvent_commitment_tx_confirmed(struct LDKOutPoint a);
22846
22847 /**
22848  * Utility method to constructs a new Completed-variant MonitorEvent
22849  */
22850 struct LDKMonitorEvent MonitorEvent_completed(struct LDKOutPoint funding_txo, uint64_t monitor_update_id);
22851
22852 /**
22853  * Utility method to constructs a new UpdateFailed-variant MonitorEvent
22854  */
22855 struct LDKMonitorEvent MonitorEvent_update_failed(struct LDKOutPoint a);
22856
22857 /**
22858  * Checks if two MonitorEvents contain equal inner contents.
22859  * This ignores pointers and is_owned flags and looks at the values in fields.
22860  */
22861 bool MonitorEvent_eq(const struct LDKMonitorEvent *NONNULL_PTR a, const struct LDKMonitorEvent *NONNULL_PTR b);
22862
22863 /**
22864  * Serialize the MonitorEvent object into a byte array which can be read by MonitorEvent_read
22865  */
22866 struct LDKCVec_u8Z MonitorEvent_write(const struct LDKMonitorEvent *NONNULL_PTR obj);
22867
22868 /**
22869  * Read a MonitorEvent from a byte array, created by MonitorEvent_write
22870  */
22871 struct LDKCResult_COption_MonitorEventZDecodeErrorZ MonitorEvent_read(struct LDKu8slice ser);
22872
22873 /**
22874  * Frees any resources used by the HTLCUpdate, if is_owned is set and inner is non-NULL.
22875  */
22876 void HTLCUpdate_free(struct LDKHTLCUpdate this_obj);
22877
22878 /**
22879  * Creates a copy of the HTLCUpdate
22880  */
22881 struct LDKHTLCUpdate HTLCUpdate_clone(const struct LDKHTLCUpdate *NONNULL_PTR orig);
22882
22883 /**
22884  * Checks if two HTLCUpdates contain equal inner contents.
22885  * This ignores pointers and is_owned flags and looks at the values in fields.
22886  * Two objects with NULL inner values will be considered "equal" here.
22887  */
22888 bool HTLCUpdate_eq(const struct LDKHTLCUpdate *NONNULL_PTR a, const struct LDKHTLCUpdate *NONNULL_PTR b);
22889
22890 /**
22891  * Serialize the HTLCUpdate object into a byte array which can be read by HTLCUpdate_read
22892  */
22893 struct LDKCVec_u8Z HTLCUpdate_write(const struct LDKHTLCUpdate *NONNULL_PTR obj);
22894
22895 /**
22896  * Read a HTLCUpdate from a byte array, created by HTLCUpdate_write
22897  */
22898 struct LDKCResult_HTLCUpdateDecodeErrorZ HTLCUpdate_read(struct LDKu8slice ser);
22899
22900 /**
22901  * Frees any resources used by the Balance
22902  */
22903 void Balance_free(struct LDKBalance this_ptr);
22904
22905 /**
22906  * Creates a copy of the Balance
22907  */
22908 struct LDKBalance Balance_clone(const struct LDKBalance *NONNULL_PTR orig);
22909
22910 /**
22911  * Utility method to constructs a new ClaimableOnChannelClose-variant Balance
22912  */
22913 struct LDKBalance Balance_claimable_on_channel_close(uint64_t claimable_amount_satoshis);
22914
22915 /**
22916  * Utility method to constructs a new ClaimableAwaitingConfirmations-variant Balance
22917  */
22918 struct LDKBalance Balance_claimable_awaiting_confirmations(uint64_t claimable_amount_satoshis, uint32_t confirmation_height);
22919
22920 /**
22921  * Utility method to constructs a new ContentiousClaimable-variant Balance
22922  */
22923 struct LDKBalance Balance_contentious_claimable(uint64_t claimable_amount_satoshis, uint32_t timeout_height);
22924
22925 /**
22926  * Utility method to constructs a new MaybeTimeoutClaimableHTLC-variant Balance
22927  */
22928 struct LDKBalance Balance_maybe_timeout_claimable_htlc(uint64_t claimable_amount_satoshis, uint32_t claimable_height);
22929
22930 /**
22931  * Utility method to constructs a new MaybePreimageClaimableHTLC-variant Balance
22932  */
22933 struct LDKBalance Balance_maybe_preimage_claimable_htlc(uint64_t claimable_amount_satoshis, uint32_t expiry_height);
22934
22935 /**
22936  * Utility method to constructs a new CounterpartyRevokedOutputClaimable-variant Balance
22937  */
22938 struct LDKBalance Balance_counterparty_revoked_output_claimable(uint64_t claimable_amount_satoshis);
22939
22940 /**
22941  * Checks if two Balances contain equal inner contents.
22942  * This ignores pointers and is_owned flags and looks at the values in fields.
22943  */
22944 bool Balance_eq(const struct LDKBalance *NONNULL_PTR a, const struct LDKBalance *NONNULL_PTR b);
22945
22946 /**
22947  * Frees any resources used by the ChannelMonitor, if is_owned is set and inner is non-NULL.
22948  */
22949 void ChannelMonitor_free(struct LDKChannelMonitor this_obj);
22950
22951 /**
22952  * Serialize the ChannelMonitor object into a byte array which can be read by ChannelMonitor_read
22953  */
22954 struct LDKCVec_u8Z ChannelMonitor_write(const struct LDKChannelMonitor *NONNULL_PTR obj);
22955
22956 /**
22957  * Updates a ChannelMonitor on the basis of some new information provided by the Channel
22958  * itself.
22959  *
22960  * panics if the given update is not the next update by update_id.
22961  */
22962 MUST_USE_RES struct LDKCResult_NoneNoneZ ChannelMonitor_update_monitor(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKChannelMonitorUpdate *NONNULL_PTR updates, const struct LDKBroadcasterInterface *NONNULL_PTR broadcaster, struct LDKFeeEstimator fee_estimator, const struct LDKLogger *NONNULL_PTR logger);
22963
22964 /**
22965  * Gets the update_id from the latest ChannelMonitorUpdate which was applied to this
22966  * ChannelMonitor.
22967  */
22968 MUST_USE_RES uint64_t ChannelMonitor_get_latest_update_id(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
22969
22970 /**
22971  * Gets the funding transaction outpoint of the channel this ChannelMonitor is monitoring for.
22972  */
22973 MUST_USE_RES struct LDKC2Tuple_OutPointScriptZ ChannelMonitor_get_funding_txo(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
22974
22975 /**
22976  * Gets a list of txids, with their output scripts (in the order they appear in the
22977  * transaction), which we must learn about spends of via block_connected().
22978  */
22979 MUST_USE_RES struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ChannelMonitor_get_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
22980
22981 /**
22982  * Loads the funding txo and outputs to watch into the given `chain::Filter` by repeatedly
22983  * calling `chain::Filter::register_output` and `chain::Filter::register_tx` until all outputs
22984  * have been registered.
22985  */
22986 void ChannelMonitor_load_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKFilter *NONNULL_PTR filter);
22987
22988 /**
22989  * Get the list of HTLCs who's status has been updated on chain. This should be called by
22990  * ChannelManager via [`chain::Watch::release_pending_monitor_events`].
22991  */
22992 MUST_USE_RES struct LDKCVec_MonitorEventZ ChannelMonitor_get_and_clear_pending_monitor_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
22993
22994 /**
22995  * Gets the list of pending events which were generated by previous actions, clearing the list
22996  * in the process.
22997  *
22998  * This is called by the [`EventsProvider::process_pending_events`] implementation for
22999  * [`ChainMonitor`].
23000  *
23001  * [`EventsProvider::process_pending_events`]: crate::events::EventsProvider::process_pending_events
23002  * [`ChainMonitor`]: crate::chain::chainmonitor::ChainMonitor
23003  */
23004 MUST_USE_RES struct LDKCVec_EventZ ChannelMonitor_get_and_clear_pending_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
23005
23006 /**
23007  * Gets the `node_id` of the counterparty for this channel.
23008  *
23009  * Will be `None` for channels constructed on LDK versions prior to 0.0.110 and always `Some`
23010  * otherwise.
23011  *
23012  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
23013  */
23014 MUST_USE_RES struct LDKPublicKey ChannelMonitor_get_counterparty_node_id(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
23015
23016 /**
23017  * Used by ChannelManager deserialization to broadcast the latest holder state if its copy of
23018  * the Channel was out-of-date.
23019  *
23020  * You may also use this to broadcast the latest local commitment transaction, either because
23021  * a monitor update failed with [`ChannelMonitorUpdateStatus::PermanentFailure`] or because we've
23022  * fallen behind (i.e. we've received proof that our counterparty side knows a revocation
23023  * secret we gave them that they shouldn't know).
23024  *
23025  * Broadcasting these transactions in the second case is UNSAFE, as they allow counterparty
23026  * side to punish you. Nevertheless you may want to broadcast them if counterparty doesn't
23027  * close channel with their commitment transaction after a substantial amount of time. Best
23028  * may be to contact the other node operator out-of-band to coordinate other options available
23029  * to you. In any-case, the choice is up to you.
23030  *
23031  * [`ChannelMonitorUpdateStatus::PermanentFailure`]: super::ChannelMonitorUpdateStatus::PermanentFailure
23032  */
23033 MUST_USE_RES struct LDKCVec_TransactionZ ChannelMonitor_get_latest_holder_commitment_txn(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKLogger *NONNULL_PTR logger);
23034
23035 /**
23036  * Processes transactions in a newly connected block, which may result in any of the following:
23037  * - update the monitor's state against resolved HTLCs
23038  * - punish the counterparty in the case of seeing a revoked commitment transaction
23039  * - force close the channel and claim/timeout incoming/outgoing HTLCs if near expiration
23040  * - detect settled outputs for later spending
23041  * - schedule and bump any in-flight claims
23042  *
23043  * Returns any new outputs to watch from `txdata`; after called, these are also included in
23044  * [`get_outputs_to_watch`].
23045  *
23046  * [`get_outputs_to_watch`]: #method.get_outputs_to_watch
23047  */
23048 MUST_USE_RES struct LDKCVec_TransactionOutputsZ ChannelMonitor_block_connected(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height, struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator, struct LDKLogger logger);
23049
23050 /**
23051  * Determines if the disconnected block contained any transactions of interest and updates
23052  * appropriately.
23053  */
23054 void ChannelMonitor_block_disconnected(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], uint32_t height, struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator, struct LDKLogger logger);
23055
23056 /**
23057  * Processes transactions confirmed in a block with the given header and height, returning new
23058  * outputs to watch. See [`block_connected`] for details.
23059  *
23060  * Used instead of [`block_connected`] by clients that are notified of transactions rather than
23061  * blocks. See [`chain::Confirm`] for calling expectations.
23062  *
23063  * [`block_connected`]: Self::block_connected
23064  */
23065 MUST_USE_RES struct LDKCVec_TransactionOutputsZ ChannelMonitor_transactions_confirmed(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height, struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator, struct LDKLogger logger);
23066
23067 /**
23068  * Processes a transaction that was reorganized out of the chain.
23069  *
23070  * Used instead of [`block_disconnected`] by clients that are notified of transactions rather
23071  * than blocks. See [`chain::Confirm`] for calling expectations.
23072  *
23073  * [`block_disconnected`]: Self::block_disconnected
23074  */
23075 void ChannelMonitor_transaction_unconfirmed(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const uint8_t (*txid)[32], struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator, struct LDKLogger logger);
23076
23077 /**
23078  * Updates the monitor with the current best chain tip, returning new outputs to watch. See
23079  * [`block_connected`] for details.
23080  *
23081  * Used instead of [`block_connected`] by clients that are notified of transactions rather than
23082  * blocks. See [`chain::Confirm`] for calling expectations.
23083  *
23084  * [`block_connected`]: Self::block_connected
23085  */
23086 MUST_USE_RES struct LDKCVec_TransactionOutputsZ ChannelMonitor_best_block_updated(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], uint32_t height, struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator, struct LDKLogger logger);
23087
23088 /**
23089  * Returns the set of txids that should be monitored for re-organization out of the chain.
23090  */
23091 MUST_USE_RES struct LDKCVec_C2Tuple_TxidBlockHashZZ ChannelMonitor_get_relevant_txids(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
23092
23093 /**
23094  * Gets the latest best block which was connected either via the [`chain::Listen`] or
23095  * [`chain::Confirm`] interfaces.
23096  */
23097 MUST_USE_RES struct LDKBestBlock ChannelMonitor_current_best_block(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
23098
23099 /**
23100  * Triggers rebroadcasts/fee-bumps of pending claims from a force-closed channel. This is
23101  * crucial in preventing certain classes of pinning attacks, detecting substantial mempool
23102  * feerate changes between blocks, and ensuring reliability if broadcasting fails. We recommend
23103  * invoking this every 30 seconds, or lower if running in an environment with spotty
23104  * connections, like on mobile.
23105  */
23106 void ChannelMonitor_rebroadcast_pending_claims(const struct LDKChannelMonitor *NONNULL_PTR this_arg, struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator, struct LDKLogger logger);
23107
23108 /**
23109  * Gets the balances in this channel which are either claimable by us if we were to
23110  * force-close the channel now or which are claimable on-chain (possibly awaiting
23111  * confirmation).
23112  *
23113  * Any balances in the channel which are available on-chain (excluding on-chain fees) are
23114  * included here until an [`Event::SpendableOutputs`] event has been generated for the
23115  * balance, or until our counterparty has claimed the balance and accrued several
23116  * confirmations on the claim transaction.
23117  *
23118  * Note that for `ChannelMonitors` which track a channel which went on-chain with versions of
23119  * LDK prior to 0.0.111, balances may not be fully captured if our counterparty broadcasted
23120  * a revoked state.
23121  *
23122  * See [`Balance`] for additional details on the types of claimable balances which
23123  * may be returned here and their meanings.
23124  */
23125 MUST_USE_RES struct LDKCVec_BalanceZ ChannelMonitor_get_claimable_balances(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
23126
23127 /**
23128  * Read a C2Tuple_BlockHashChannelMonitorZ from a byte array, created by C2Tuple_BlockHashChannelMonitorZ_write
23129  */
23130 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ C2Tuple_BlockHashChannelMonitorZ_read(struct LDKu8slice ser, const struct LDKEntropySource *NONNULL_PTR arg_a, const struct LDKSignerProvider *NONNULL_PTR arg_b);
23131
23132 /**
23133  * Frees any resources used by the OutPoint, if is_owned is set and inner is non-NULL.
23134  */
23135 void OutPoint_free(struct LDKOutPoint this_obj);
23136
23137 /**
23138  * The referenced transaction's txid.
23139  */
23140 const uint8_t (*OutPoint_get_txid(const struct LDKOutPoint *NONNULL_PTR this_ptr))[32];
23141
23142 /**
23143  * The referenced transaction's txid.
23144  */
23145 void OutPoint_set_txid(struct LDKOutPoint *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
23146
23147 /**
23148  * The index of the referenced output in its transaction's vout.
23149  */
23150 uint16_t OutPoint_get_index(const struct LDKOutPoint *NONNULL_PTR this_ptr);
23151
23152 /**
23153  * The index of the referenced output in its transaction's vout.
23154  */
23155 void OutPoint_set_index(struct LDKOutPoint *NONNULL_PTR this_ptr, uint16_t val);
23156
23157 /**
23158  * Constructs a new OutPoint given each field
23159  */
23160 MUST_USE_RES struct LDKOutPoint OutPoint_new(struct LDKThirtyTwoBytes txid_arg, uint16_t index_arg);
23161
23162 /**
23163  * Creates a copy of the OutPoint
23164  */
23165 struct LDKOutPoint OutPoint_clone(const struct LDKOutPoint *NONNULL_PTR orig);
23166
23167 /**
23168  * Checks if two OutPoints contain equal inner contents.
23169  * This ignores pointers and is_owned flags and looks at the values in fields.
23170  * Two objects with NULL inner values will be considered "equal" here.
23171  */
23172 bool OutPoint_eq(const struct LDKOutPoint *NONNULL_PTR a, const struct LDKOutPoint *NONNULL_PTR b);
23173
23174 /**
23175  * Generates a non-cryptographic 64-bit hash of the OutPoint.
23176  */
23177 uint64_t OutPoint_hash(const struct LDKOutPoint *NONNULL_PTR o);
23178
23179 /**
23180  * Convert an `OutPoint` to a lightning channel id.
23181  */
23182 MUST_USE_RES struct LDKThirtyTwoBytes OutPoint_to_channel_id(const struct LDKOutPoint *NONNULL_PTR this_arg);
23183
23184 /**
23185  * Serialize the OutPoint object into a byte array which can be read by OutPoint_read
23186  */
23187 struct LDKCVec_u8Z OutPoint_write(const struct LDKOutPoint *NONNULL_PTR obj);
23188
23189 /**
23190  * Read a OutPoint from a byte array, created by OutPoint_write
23191  */
23192 struct LDKCResult_OutPointDecodeErrorZ OutPoint_read(struct LDKu8slice ser);
23193
23194 /**
23195  * Frees any resources used by the DelayedPaymentOutputDescriptor, if is_owned is set and inner is non-NULL.
23196  */
23197 void DelayedPaymentOutputDescriptor_free(struct LDKDelayedPaymentOutputDescriptor this_obj);
23198
23199 /**
23200  * The outpoint which is spendable.
23201  */
23202 struct LDKOutPoint DelayedPaymentOutputDescriptor_get_outpoint(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
23203
23204 /**
23205  * The outpoint which is spendable.
23206  */
23207 void DelayedPaymentOutputDescriptor_set_outpoint(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val);
23208
23209 /**
23210  * Per commitment point to derive the delayed payment key by key holder.
23211  */
23212 struct LDKPublicKey DelayedPaymentOutputDescriptor_get_per_commitment_point(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
23213
23214 /**
23215  * Per commitment point to derive the delayed payment key by key holder.
23216  */
23217 void DelayedPaymentOutputDescriptor_set_per_commitment_point(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val);
23218
23219 /**
23220  * The `nSequence` value which must be set in the spending input to satisfy the `OP_CSV` in
23221  * the witness_script.
23222  */
23223 uint16_t DelayedPaymentOutputDescriptor_get_to_self_delay(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
23224
23225 /**
23226  * The `nSequence` value which must be set in the spending input to satisfy the `OP_CSV` in
23227  * the witness_script.
23228  */
23229 void DelayedPaymentOutputDescriptor_set_to_self_delay(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint16_t val);
23230
23231 /**
23232  * The output which is referenced by the given outpoint.
23233  *
23234  * Returns a copy of the field.
23235  */
23236 struct LDKTxOut DelayedPaymentOutputDescriptor_get_output(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
23237
23238 /**
23239  * The output which is referenced by the given outpoint.
23240  */
23241 void DelayedPaymentOutputDescriptor_set_output(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val);
23242
23243 /**
23244  * The revocation point specific to the commitment transaction which was broadcast. Used to
23245  * derive the witnessScript for this output.
23246  */
23247 struct LDKPublicKey DelayedPaymentOutputDescriptor_get_revocation_pubkey(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
23248
23249 /**
23250  * The revocation point specific to the commitment transaction which was broadcast. Used to
23251  * derive the witnessScript for this output.
23252  */
23253 void DelayedPaymentOutputDescriptor_set_revocation_pubkey(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val);
23254
23255 /**
23256  * Arbitrary identification information returned by a call to [`ChannelSigner::channel_keys_id`].
23257  * This may be useful in re-deriving keys used in the channel to spend the output.
23258  */
23259 const uint8_t (*DelayedPaymentOutputDescriptor_get_channel_keys_id(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32];
23260
23261 /**
23262  * Arbitrary identification information returned by a call to [`ChannelSigner::channel_keys_id`].
23263  * This may be useful in re-deriving keys used in the channel to spend the output.
23264  */
23265 void DelayedPaymentOutputDescriptor_set_channel_keys_id(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
23266
23267 /**
23268  * The value of the channel which this output originated from, possibly indirectly.
23269  */
23270 uint64_t DelayedPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
23271
23272 /**
23273  * The value of the channel which this output originated from, possibly indirectly.
23274  */
23275 void DelayedPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val);
23276
23277 /**
23278  * Constructs a new DelayedPaymentOutputDescriptor given each field
23279  */
23280 MUST_USE_RES struct LDKDelayedPaymentOutputDescriptor DelayedPaymentOutputDescriptor_new(struct LDKOutPoint outpoint_arg, struct LDKPublicKey per_commitment_point_arg, uint16_t to_self_delay_arg, struct LDKTxOut output_arg, struct LDKPublicKey revocation_pubkey_arg, struct LDKThirtyTwoBytes channel_keys_id_arg, uint64_t channel_value_satoshis_arg);
23281
23282 /**
23283  * Creates a copy of the DelayedPaymentOutputDescriptor
23284  */
23285 struct LDKDelayedPaymentOutputDescriptor DelayedPaymentOutputDescriptor_clone(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR orig);
23286
23287 /**
23288  * Checks if two DelayedPaymentOutputDescriptors contain equal inner contents.
23289  * This ignores pointers and is_owned flags and looks at the values in fields.
23290  * Two objects with NULL inner values will be considered "equal" here.
23291  */
23292 bool DelayedPaymentOutputDescriptor_eq(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR a, const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR b);
23293
23294 /**
23295  * Serialize the DelayedPaymentOutputDescriptor object into a byte array which can be read by DelayedPaymentOutputDescriptor_read
23296  */
23297 struct LDKCVec_u8Z DelayedPaymentOutputDescriptor_write(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR obj);
23298
23299 /**
23300  * Read a DelayedPaymentOutputDescriptor from a byte array, created by DelayedPaymentOutputDescriptor_write
23301  */
23302 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ DelayedPaymentOutputDescriptor_read(struct LDKu8slice ser);
23303
23304 /**
23305  * Frees any resources used by the StaticPaymentOutputDescriptor, if is_owned is set and inner is non-NULL.
23306  */
23307 void StaticPaymentOutputDescriptor_free(struct LDKStaticPaymentOutputDescriptor this_obj);
23308
23309 /**
23310  * The outpoint which is spendable.
23311  */
23312 struct LDKOutPoint StaticPaymentOutputDescriptor_get_outpoint(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr);
23313
23314 /**
23315  * The outpoint which is spendable.
23316  */
23317 void StaticPaymentOutputDescriptor_set_outpoint(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val);
23318
23319 /**
23320  * The output which is referenced by the given outpoint.
23321  *
23322  * Returns a copy of the field.
23323  */
23324 struct LDKTxOut StaticPaymentOutputDescriptor_get_output(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr);
23325
23326 /**
23327  * The output which is referenced by the given outpoint.
23328  */
23329 void StaticPaymentOutputDescriptor_set_output(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val);
23330
23331 /**
23332  * Arbitrary identification information returned by a call to [`ChannelSigner::channel_keys_id`].
23333  * This may be useful in re-deriving keys used in the channel to spend the output.
23334  */
23335 const uint8_t (*StaticPaymentOutputDescriptor_get_channel_keys_id(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32];
23336
23337 /**
23338  * Arbitrary identification information returned by a call to [`ChannelSigner::channel_keys_id`].
23339  * This may be useful in re-deriving keys used in the channel to spend the output.
23340  */
23341 void StaticPaymentOutputDescriptor_set_channel_keys_id(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
23342
23343 /**
23344  * The value of the channel which this transactions spends.
23345  */
23346 uint64_t StaticPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr);
23347
23348 /**
23349  * The value of the channel which this transactions spends.
23350  */
23351 void StaticPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val);
23352
23353 /**
23354  * Constructs a new StaticPaymentOutputDescriptor given each field
23355  */
23356 MUST_USE_RES struct LDKStaticPaymentOutputDescriptor StaticPaymentOutputDescriptor_new(struct LDKOutPoint outpoint_arg, struct LDKTxOut output_arg, struct LDKThirtyTwoBytes channel_keys_id_arg, uint64_t channel_value_satoshis_arg);
23357
23358 /**
23359  * Creates a copy of the StaticPaymentOutputDescriptor
23360  */
23361 struct LDKStaticPaymentOutputDescriptor StaticPaymentOutputDescriptor_clone(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR orig);
23362
23363 /**
23364  * Checks if two StaticPaymentOutputDescriptors contain equal inner contents.
23365  * This ignores pointers and is_owned flags and looks at the values in fields.
23366  * Two objects with NULL inner values will be considered "equal" here.
23367  */
23368 bool StaticPaymentOutputDescriptor_eq(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR a, const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR b);
23369
23370 /**
23371  * Serialize the StaticPaymentOutputDescriptor object into a byte array which can be read by StaticPaymentOutputDescriptor_read
23372  */
23373 struct LDKCVec_u8Z StaticPaymentOutputDescriptor_write(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR obj);
23374
23375 /**
23376  * Read a StaticPaymentOutputDescriptor from a byte array, created by StaticPaymentOutputDescriptor_write
23377  */
23378 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ StaticPaymentOutputDescriptor_read(struct LDKu8slice ser);
23379
23380 /**
23381  * Frees any resources used by the SpendableOutputDescriptor
23382  */
23383 void SpendableOutputDescriptor_free(struct LDKSpendableOutputDescriptor this_ptr);
23384
23385 /**
23386  * Creates a copy of the SpendableOutputDescriptor
23387  */
23388 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_clone(const struct LDKSpendableOutputDescriptor *NONNULL_PTR orig);
23389
23390 /**
23391  * Utility method to constructs a new StaticOutput-variant SpendableOutputDescriptor
23392  */
23393 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_static_output(struct LDKOutPoint outpoint, struct LDKTxOut output);
23394
23395 /**
23396  * Utility method to constructs a new DelayedPaymentOutput-variant SpendableOutputDescriptor
23397  */
23398 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_delayed_payment_output(struct LDKDelayedPaymentOutputDescriptor a);
23399
23400 /**
23401  * Utility method to constructs a new StaticPaymentOutput-variant SpendableOutputDescriptor
23402  */
23403 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_static_payment_output(struct LDKStaticPaymentOutputDescriptor a);
23404
23405 /**
23406  * Checks if two SpendableOutputDescriptors contain equal inner contents.
23407  * This ignores pointers and is_owned flags and looks at the values in fields.
23408  */
23409 bool SpendableOutputDescriptor_eq(const struct LDKSpendableOutputDescriptor *NONNULL_PTR a, const struct LDKSpendableOutputDescriptor *NONNULL_PTR b);
23410
23411 /**
23412  * Serialize the SpendableOutputDescriptor object into a byte array which can be read by SpendableOutputDescriptor_read
23413  */
23414 struct LDKCVec_u8Z SpendableOutputDescriptor_write(const struct LDKSpendableOutputDescriptor *NONNULL_PTR obj);
23415
23416 /**
23417  * Read a SpendableOutputDescriptor from a byte array, created by SpendableOutputDescriptor_write
23418  */
23419 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ SpendableOutputDescriptor_read(struct LDKu8slice ser);
23420
23421 /**
23422  * Calls the free function if one is set
23423  */
23424 void ChannelSigner_free(struct LDKChannelSigner this_ptr);
23425
23426 /**
23427  * Calls the free function if one is set
23428  */
23429 void EcdsaChannelSigner_free(struct LDKEcdsaChannelSigner this_ptr);
23430
23431 /**
23432  * Calls the free function if one is set
23433  */
23434 void WriteableEcdsaChannelSigner_free(struct LDKWriteableEcdsaChannelSigner this_ptr);
23435
23436 /**
23437  * Creates a copy of the Recipient
23438  */
23439 enum LDKRecipient Recipient_clone(const enum LDKRecipient *NONNULL_PTR orig);
23440
23441 /**
23442  * Utility method to constructs a new Node-variant Recipient
23443  */
23444 enum LDKRecipient Recipient_node(void);
23445
23446 /**
23447  * Utility method to constructs a new PhantomNode-variant Recipient
23448  */
23449 enum LDKRecipient Recipient_phantom_node(void);
23450
23451 /**
23452  * Calls the free function if one is set
23453  */
23454 void EntropySource_free(struct LDKEntropySource this_ptr);
23455
23456 /**
23457  * Calls the free function if one is set
23458  */
23459 void NodeSigner_free(struct LDKNodeSigner this_ptr);
23460
23461 /**
23462  * Calls the free function if one is set
23463  */
23464 void SignerProvider_free(struct LDKSignerProvider this_ptr);
23465
23466 /**
23467  * Frees any resources used by the InMemorySigner, if is_owned is set and inner is non-NULL.
23468  */
23469 void InMemorySigner_free(struct LDKInMemorySigner this_obj);
23470
23471 /**
23472  * Holder secret key in the 2-of-2 multisig script of a channel. This key also backs the
23473  * holder's anchor output in a commitment transaction, if one is present.
23474  */
23475 const uint8_t (*InMemorySigner_get_funding_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
23476
23477 /**
23478  * Holder secret key in the 2-of-2 multisig script of a channel. This key also backs the
23479  * holder's anchor output in a commitment transaction, if one is present.
23480  */
23481 void InMemorySigner_set_funding_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
23482
23483 /**
23484  * Holder secret key for blinded revocation pubkey.
23485  */
23486 const uint8_t (*InMemorySigner_get_revocation_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
23487
23488 /**
23489  * Holder secret key for blinded revocation pubkey.
23490  */
23491 void InMemorySigner_set_revocation_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
23492
23493 /**
23494  * Holder secret key used for our balance in counterparty-broadcasted commitment transactions.
23495  */
23496 const uint8_t (*InMemorySigner_get_payment_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
23497
23498 /**
23499  * Holder secret key used for our balance in counterparty-broadcasted commitment transactions.
23500  */
23501 void InMemorySigner_set_payment_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
23502
23503 /**
23504  * Holder secret key used in an HTLC transaction.
23505  */
23506 const uint8_t (*InMemorySigner_get_delayed_payment_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
23507
23508 /**
23509  * Holder secret key used in an HTLC transaction.
23510  */
23511 void InMemorySigner_set_delayed_payment_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
23512
23513 /**
23514  * Holder HTLC secret key used in commitment transaction HTLC outputs.
23515  */
23516 const uint8_t (*InMemorySigner_get_htlc_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
23517
23518 /**
23519  * Holder HTLC secret key used in commitment transaction HTLC outputs.
23520  */
23521 void InMemorySigner_set_htlc_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
23522
23523 /**
23524  * Commitment seed.
23525  */
23526 const uint8_t (*InMemorySigner_get_commitment_seed(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
23527
23528 /**
23529  * Commitment seed.
23530  */
23531 void InMemorySigner_set_commitment_seed(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
23532
23533 /**
23534  * Creates a copy of the InMemorySigner
23535  */
23536 struct LDKInMemorySigner InMemorySigner_clone(const struct LDKInMemorySigner *NONNULL_PTR orig);
23537
23538 /**
23539  * Creates a new [`InMemorySigner`].
23540  */
23541 MUST_USE_RES struct LDKInMemorySigner InMemorySigner_new(struct LDKSecretKey funding_key, struct LDKSecretKey revocation_base_key, struct LDKSecretKey payment_key, struct LDKSecretKey delayed_payment_base_key, struct LDKSecretKey htlc_base_key, struct LDKThirtyTwoBytes commitment_seed, uint64_t channel_value_satoshis, struct LDKThirtyTwoBytes channel_keys_id, struct LDKThirtyTwoBytes rand_bytes_unique_start);
23542
23543 /**
23544  * Returns the counterparty's pubkeys.
23545  *
23546  * Will panic if [`ChannelSigner::provide_channel_parameters`] has not been called before.
23547  */
23548 MUST_USE_RES struct LDKChannelPublicKeys InMemorySigner_counterparty_pubkeys(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
23549
23550 /**
23551  * Returns the `contest_delay` value specified by our counterparty and applied on holder-broadcastable
23552  * transactions, i.e., the amount of time that we have to wait to recover our funds if we
23553  * broadcast a transaction.
23554  *
23555  * Will panic if [`ChannelSigner::provide_channel_parameters`] has not been called before.
23556  */
23557 MUST_USE_RES uint16_t InMemorySigner_counterparty_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
23558
23559 /**
23560  * Returns the `contest_delay` value specified by us and applied on transactions broadcastable
23561  * by our counterparty, i.e., the amount of time that they have to wait to recover their funds
23562  * if they broadcast a transaction.
23563  *
23564  * Will panic if [`ChannelSigner::provide_channel_parameters`] has not been called before.
23565  */
23566 MUST_USE_RES uint16_t InMemorySigner_holder_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
23567
23568 /**
23569  * Returns whether the holder is the initiator.
23570  *
23571  * Will panic if [`ChannelSigner::provide_channel_parameters`] has not been called before.
23572  */
23573 MUST_USE_RES bool InMemorySigner_is_outbound(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
23574
23575 /**
23576  * Funding outpoint
23577  *
23578  * Will panic if [`ChannelSigner::provide_channel_parameters`] has not been called before.
23579  */
23580 MUST_USE_RES struct LDKOutPoint InMemorySigner_funding_outpoint(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
23581
23582 /**
23583  * Returns a [`ChannelTransactionParameters`] for this channel, to be used when verifying or
23584  * building transactions.
23585  *
23586  * Will panic if [`ChannelSigner::provide_channel_parameters`] has not been called before.
23587  */
23588 MUST_USE_RES struct LDKChannelTransactionParameters InMemorySigner_get_channel_parameters(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
23589
23590 /**
23591  * Returns whether anchors should be used.
23592  *
23593  * Will panic if [`ChannelSigner::provide_channel_parameters`] has not been called before.
23594  */
23595 MUST_USE_RES bool InMemorySigner_opt_anchors(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
23596
23597 /**
23598  * Sign the single input of `spend_tx` at index `input_idx`, which spends the output described
23599  * by `descriptor`, returning the witness stack for the input.
23600  *
23601  * Returns an error if the input at `input_idx` does not exist, has a non-empty `script_sig`,
23602  * is not spending the outpoint described by [`descriptor.outpoint`],
23603  * or if an output descriptor `script_pubkey` does not match the one we can spend.
23604  *
23605  * [`descriptor.outpoint`]: StaticPaymentOutputDescriptor::outpoint
23606  */
23607 MUST_USE_RES struct LDKCResult_CVec_CVec_u8ZZNoneZ InMemorySigner_sign_counterparty_payment_input(const struct LDKInMemorySigner *NONNULL_PTR this_arg, struct LDKTransaction spend_tx, uintptr_t input_idx, const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR descriptor);
23608
23609 /**
23610  * Sign the single input of `spend_tx` at index `input_idx` which spends the output
23611  * described by `descriptor`, returning the witness stack for the input.
23612  *
23613  * Returns an error if the input at `input_idx` does not exist, has a non-empty `script_sig`,
23614  * is not spending the outpoint described by [`descriptor.outpoint`], does not have a
23615  * sequence set to [`descriptor.to_self_delay`], or if an output descriptor
23616  * `script_pubkey` does not match the one we can spend.
23617  *
23618  * [`descriptor.outpoint`]: DelayedPaymentOutputDescriptor::outpoint
23619  * [`descriptor.to_self_delay`]: DelayedPaymentOutputDescriptor::to_self_delay
23620  */
23621 MUST_USE_RES struct LDKCResult_CVec_CVec_u8ZZNoneZ InMemorySigner_sign_dynamic_p2wsh_input(const struct LDKInMemorySigner *NONNULL_PTR this_arg, struct LDKTransaction spend_tx, uintptr_t input_idx, const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR descriptor);
23622
23623 /**
23624  * Constructs a new EntropySource which calls the relevant methods on this_arg.
23625  * This copies the `inner` pointer in this_arg and thus the returned EntropySource must be freed before this_arg is
23626  */
23627 struct LDKEntropySource InMemorySigner_as_EntropySource(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
23628
23629 /**
23630  * Constructs a new ChannelSigner which calls the relevant methods on this_arg.
23631  * This copies the `inner` pointer in this_arg and thus the returned ChannelSigner must be freed before this_arg is
23632  */
23633 struct LDKChannelSigner InMemorySigner_as_ChannelSigner(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
23634
23635 /**
23636  * Constructs a new EcdsaChannelSigner which calls the relevant methods on this_arg.
23637  * This copies the `inner` pointer in this_arg and thus the returned EcdsaChannelSigner must be freed before this_arg is
23638  */
23639 struct LDKEcdsaChannelSigner InMemorySigner_as_EcdsaChannelSigner(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
23640
23641 /**
23642  * Constructs a new WriteableEcdsaChannelSigner which calls the relevant methods on this_arg.
23643  * This copies the `inner` pointer in this_arg and thus the returned WriteableEcdsaChannelSigner must be freed before this_arg is
23644  */
23645 struct LDKWriteableEcdsaChannelSigner InMemorySigner_as_WriteableEcdsaChannelSigner(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
23646
23647 /**
23648  * Serialize the InMemorySigner object into a byte array which can be read by InMemorySigner_read
23649  */
23650 struct LDKCVec_u8Z InMemorySigner_write(const struct LDKInMemorySigner *NONNULL_PTR obj);
23651
23652 /**
23653  * Read a InMemorySigner from a byte array, created by InMemorySigner_write
23654  */
23655 struct LDKCResult_InMemorySignerDecodeErrorZ InMemorySigner_read(struct LDKu8slice ser, struct LDKEntropySource arg);
23656
23657 /**
23658  * Frees any resources used by the KeysManager, if is_owned is set and inner is non-NULL.
23659  */
23660 void KeysManager_free(struct LDKKeysManager this_obj);
23661
23662 /**
23663  * Constructs a [`KeysManager`] from a 32-byte seed. If the seed is in some way biased (e.g.,
23664  * your CSRNG is busted) this may panic (but more importantly, you will possibly lose funds).
23665  * `starting_time` isn't strictly required to actually be a time, but it must absolutely,
23666  * without a doubt, be unique to this instance. ie if you start multiple times with the same
23667  * `seed`, `starting_time` must be unique to each run. Thus, the easiest way to achieve this
23668  * is to simply use the current time (with very high precision).
23669  *
23670  * The `seed` MUST be backed up safely prior to use so that the keys can be re-created, however,
23671  * obviously, `starting_time` should be unique every time you reload the library - it is only
23672  * used to generate new ephemeral key data (which will be stored by the individual channel if
23673  * necessary).
23674  *
23675  * Note that the seed is required to recover certain on-chain funds independent of
23676  * [`ChannelMonitor`] data, though a current copy of [`ChannelMonitor`] data is also required
23677  * for any channel, and some on-chain during-closing funds.
23678  *
23679  * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor
23680  */
23681 MUST_USE_RES struct LDKKeysManager KeysManager_new(const uint8_t (*seed)[32], uint64_t starting_time_secs, uint32_t starting_time_nanos);
23682
23683 /**
23684  * Gets the \"node_id\" secret key used to sign gossip announcements, decode onion data, etc.
23685  */
23686 MUST_USE_RES struct LDKSecretKey KeysManager_get_node_secret_key(const struct LDKKeysManager *NONNULL_PTR this_arg);
23687
23688 /**
23689  * Derive an old [`WriteableEcdsaChannelSigner`] containing per-channel secrets based on a key derivation parameters.
23690  */
23691 MUST_USE_RES struct LDKInMemorySigner KeysManager_derive_channel_keys(const struct LDKKeysManager *NONNULL_PTR this_arg, uint64_t channel_value_satoshis, const uint8_t (*params)[32]);
23692
23693 /**
23694  * Creates a [`Transaction`] which spends the given descriptors to the given outputs, plus an
23695  * output to the given change destination (if sufficient change value remains). The
23696  * transaction will have a feerate, at least, of the given value.
23697  *
23698  * Returns `Err(())` if the output value is greater than the input value minus required fee,
23699  * if a descriptor was duplicated, or if an output descriptor `script_pubkey`
23700  * does not match the one we can spend.
23701  *
23702  * We do not enforce that outputs meet the dust limit or that any output scripts are standard.
23703  *
23704  * May panic if the [`SpendableOutputDescriptor`]s were not generated by channels which used
23705  * this [`KeysManager`] or one of the [`InMemorySigner`] created by this [`KeysManager`].
23706  */
23707 MUST_USE_RES struct LDKCResult_TransactionNoneZ KeysManager_spend_spendable_outputs(const struct LDKKeysManager *NONNULL_PTR this_arg, struct LDKCVec_SpendableOutputDescriptorZ descriptors, struct LDKCVec_TxOutZ outputs, struct LDKCVec_u8Z change_destination_script, uint32_t feerate_sat_per_1000_weight);
23708
23709 /**
23710  * Constructs a new EntropySource which calls the relevant methods on this_arg.
23711  * This copies the `inner` pointer in this_arg and thus the returned EntropySource must be freed before this_arg is
23712  */
23713 struct LDKEntropySource KeysManager_as_EntropySource(const struct LDKKeysManager *NONNULL_PTR this_arg);
23714
23715 /**
23716  * Constructs a new NodeSigner which calls the relevant methods on this_arg.
23717  * This copies the `inner` pointer in this_arg and thus the returned NodeSigner must be freed before this_arg is
23718  */
23719 struct LDKNodeSigner KeysManager_as_NodeSigner(const struct LDKKeysManager *NONNULL_PTR this_arg);
23720
23721 /**
23722  * Constructs a new SignerProvider which calls the relevant methods on this_arg.
23723  * This copies the `inner` pointer in this_arg and thus the returned SignerProvider must be freed before this_arg is
23724  */
23725 struct LDKSignerProvider KeysManager_as_SignerProvider(const struct LDKKeysManager *NONNULL_PTR this_arg);
23726
23727 /**
23728  * Frees any resources used by the PhantomKeysManager, if is_owned is set and inner is non-NULL.
23729  */
23730 void PhantomKeysManager_free(struct LDKPhantomKeysManager this_obj);
23731
23732 /**
23733  * Constructs a new EntropySource which calls the relevant methods on this_arg.
23734  * This copies the `inner` pointer in this_arg and thus the returned EntropySource must be freed before this_arg is
23735  */
23736 struct LDKEntropySource PhantomKeysManager_as_EntropySource(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg);
23737
23738 /**
23739  * Constructs a new NodeSigner which calls the relevant methods on this_arg.
23740  * This copies the `inner` pointer in this_arg and thus the returned NodeSigner must be freed before this_arg is
23741  */
23742 struct LDKNodeSigner PhantomKeysManager_as_NodeSigner(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg);
23743
23744 /**
23745  * Constructs a new SignerProvider which calls the relevant methods on this_arg.
23746  * This copies the `inner` pointer in this_arg and thus the returned SignerProvider must be freed before this_arg is
23747  */
23748 struct LDKSignerProvider PhantomKeysManager_as_SignerProvider(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg);
23749
23750 /**
23751  * Constructs a [`PhantomKeysManager`] given a 32-byte seed and an additional `cross_node_seed`
23752  * that is shared across all nodes that intend to participate in [phantom node payments]
23753  * together.
23754  *
23755  * See [`KeysManager::new`] for more information on `seed`, `starting_time_secs`, and
23756  * `starting_time_nanos`.
23757  *
23758  * `cross_node_seed` must be the same across all phantom payment-receiving nodes and also the
23759  * same across restarts, or else inbound payments may fail.
23760  *
23761  * [phantom node payments]: PhantomKeysManager
23762  */
23763 MUST_USE_RES struct LDKPhantomKeysManager PhantomKeysManager_new(const uint8_t (*seed)[32], uint64_t starting_time_secs, uint32_t starting_time_nanos, const uint8_t (*cross_node_seed)[32]);
23764
23765 /**
23766  * See [`KeysManager::spend_spendable_outputs`] for documentation on this method.
23767  */
23768 MUST_USE_RES struct LDKCResult_TransactionNoneZ PhantomKeysManager_spend_spendable_outputs(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg, struct LDKCVec_SpendableOutputDescriptorZ descriptors, struct LDKCVec_TxOutZ outputs, struct LDKCVec_u8Z change_destination_script, uint32_t feerate_sat_per_1000_weight);
23769
23770 /**
23771  * See [`KeysManager::derive_channel_keys`] for documentation on this method.
23772  */
23773 MUST_USE_RES struct LDKInMemorySigner PhantomKeysManager_derive_channel_keys(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg, uint64_t channel_value_satoshis, const uint8_t (*params)[32]);
23774
23775 /**
23776  * Gets the \"node_id\" secret key used to sign gossip announcements, decode onion data, etc.
23777  */
23778 MUST_USE_RES struct LDKSecretKey PhantomKeysManager_get_node_secret_key(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg);
23779
23780 /**
23781  * Gets the \"node_id\" secret key of the phantom node used to sign invoices, decode the
23782  * last-hop onion data, etc.
23783  */
23784 MUST_USE_RES struct LDKSecretKey PhantomKeysManager_get_phantom_node_secret_key(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg);
23785
23786 /**
23787  * Creates a copy of the FailureCode
23788  */
23789 enum LDKFailureCode FailureCode_clone(const enum LDKFailureCode *NONNULL_PTR orig);
23790
23791 /**
23792  * Utility method to constructs a new TemporaryNodeFailure-variant FailureCode
23793  */
23794 enum LDKFailureCode FailureCode_temporary_node_failure(void);
23795
23796 /**
23797  * Utility method to constructs a new RequiredNodeFeatureMissing-variant FailureCode
23798  */
23799 enum LDKFailureCode FailureCode_required_node_feature_missing(void);
23800
23801 /**
23802  * Utility method to constructs a new IncorrectOrUnknownPaymentDetails-variant FailureCode
23803  */
23804 enum LDKFailureCode FailureCode_incorrect_or_unknown_payment_details(void);
23805
23806 /**
23807  * Frees any resources used by the ChannelManager, if is_owned is set and inner is non-NULL.
23808  */
23809 void ChannelManager_free(struct LDKChannelManager this_obj);
23810
23811 /**
23812  * Frees any resources used by the ChainParameters, if is_owned is set and inner is non-NULL.
23813  */
23814 void ChainParameters_free(struct LDKChainParameters this_obj);
23815
23816 /**
23817  * The network for determining the `chain_hash` in Lightning messages.
23818  */
23819 enum LDKNetwork ChainParameters_get_network(const struct LDKChainParameters *NONNULL_PTR this_ptr);
23820
23821 /**
23822  * The network for determining the `chain_hash` in Lightning messages.
23823  */
23824 void ChainParameters_set_network(struct LDKChainParameters *NONNULL_PTR this_ptr, enum LDKNetwork val);
23825
23826 /**
23827  * The hash and height of the latest block successfully connected.
23828  *
23829  * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
23830  */
23831 struct LDKBestBlock ChainParameters_get_best_block(const struct LDKChainParameters *NONNULL_PTR this_ptr);
23832
23833 /**
23834  * The hash and height of the latest block successfully connected.
23835  *
23836  * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
23837  */
23838 void ChainParameters_set_best_block(struct LDKChainParameters *NONNULL_PTR this_ptr, struct LDKBestBlock val);
23839
23840 /**
23841  * Constructs a new ChainParameters given each field
23842  */
23843 MUST_USE_RES struct LDKChainParameters ChainParameters_new(enum LDKNetwork network_arg, struct LDKBestBlock best_block_arg);
23844
23845 /**
23846  * Creates a copy of the ChainParameters
23847  */
23848 struct LDKChainParameters ChainParameters_clone(const struct LDKChainParameters *NONNULL_PTR orig);
23849
23850 /**
23851  * Frees any resources used by the CounterpartyForwardingInfo, if is_owned is set and inner is non-NULL.
23852  */
23853 void CounterpartyForwardingInfo_free(struct LDKCounterpartyForwardingInfo this_obj);
23854
23855 /**
23856  * Base routing fee in millisatoshis.
23857  */
23858 uint32_t CounterpartyForwardingInfo_get_fee_base_msat(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr);
23859
23860 /**
23861  * Base routing fee in millisatoshis.
23862  */
23863 void CounterpartyForwardingInfo_set_fee_base_msat(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint32_t val);
23864
23865 /**
23866  * Amount in millionths of a satoshi the channel will charge per transferred satoshi.
23867  */
23868 uint32_t CounterpartyForwardingInfo_get_fee_proportional_millionths(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr);
23869
23870 /**
23871  * Amount in millionths of a satoshi the channel will charge per transferred satoshi.
23872  */
23873 void CounterpartyForwardingInfo_set_fee_proportional_millionths(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint32_t val);
23874
23875 /**
23876  * The minimum difference in cltv_expiry between an ingoing HTLC and its outgoing counterpart,
23877  * such that the outgoing HTLC is forwardable to this counterparty. See `msgs::ChannelUpdate`'s
23878  * `cltv_expiry_delta` for more details.
23879  */
23880 uint16_t CounterpartyForwardingInfo_get_cltv_expiry_delta(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr);
23881
23882 /**
23883  * The minimum difference in cltv_expiry between an ingoing HTLC and its outgoing counterpart,
23884  * such that the outgoing HTLC is forwardable to this counterparty. See `msgs::ChannelUpdate`'s
23885  * `cltv_expiry_delta` for more details.
23886  */
23887 void CounterpartyForwardingInfo_set_cltv_expiry_delta(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint16_t val);
23888
23889 /**
23890  * Constructs a new CounterpartyForwardingInfo given each field
23891  */
23892 MUST_USE_RES struct LDKCounterpartyForwardingInfo CounterpartyForwardingInfo_new(uint32_t fee_base_msat_arg, uint32_t fee_proportional_millionths_arg, uint16_t cltv_expiry_delta_arg);
23893
23894 /**
23895  * Creates a copy of the CounterpartyForwardingInfo
23896  */
23897 struct LDKCounterpartyForwardingInfo CounterpartyForwardingInfo_clone(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR orig);
23898
23899 /**
23900  * Frees any resources used by the ChannelCounterparty, if is_owned is set and inner is non-NULL.
23901  */
23902 void ChannelCounterparty_free(struct LDKChannelCounterparty this_obj);
23903
23904 /**
23905  * The node_id of our counterparty
23906  */
23907 struct LDKPublicKey ChannelCounterparty_get_node_id(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
23908
23909 /**
23910  * The node_id of our counterparty
23911  */
23912 void ChannelCounterparty_set_node_id(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKPublicKey val);
23913
23914 /**
23915  * The Features the channel counterparty provided upon last connection.
23916  * Useful for routing as it is the most up-to-date copy of the counterparty's features and
23917  * many routing-relevant features are present in the init context.
23918  */
23919 struct LDKInitFeatures ChannelCounterparty_get_features(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
23920
23921 /**
23922  * The Features the channel counterparty provided upon last connection.
23923  * Useful for routing as it is the most up-to-date copy of the counterparty's features and
23924  * many routing-relevant features are present in the init context.
23925  */
23926 void ChannelCounterparty_set_features(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKInitFeatures val);
23927
23928 /**
23929  * The value, in satoshis, that must always be held in the channel for our counterparty. This
23930  * value ensures that if our counterparty broadcasts a revoked state, we can punish them by
23931  * claiming at least this value on chain.
23932  *
23933  * This value is not included in [`inbound_capacity_msat`] as it can never be spent.
23934  *
23935  * [`inbound_capacity_msat`]: ChannelDetails::inbound_capacity_msat
23936  */
23937 uint64_t ChannelCounterparty_get_unspendable_punishment_reserve(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
23938
23939 /**
23940  * The value, in satoshis, that must always be held in the channel for our counterparty. This
23941  * value ensures that if our counterparty broadcasts a revoked state, we can punish them by
23942  * claiming at least this value on chain.
23943  *
23944  * This value is not included in [`inbound_capacity_msat`] as it can never be spent.
23945  *
23946  * [`inbound_capacity_msat`]: ChannelDetails::inbound_capacity_msat
23947  */
23948 void ChannelCounterparty_set_unspendable_punishment_reserve(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, uint64_t val);
23949
23950 /**
23951  * Information on the fees and requirements that the counterparty requires when forwarding
23952  * payments to us through this channel.
23953  *
23954  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
23955  */
23956 struct LDKCounterpartyForwardingInfo ChannelCounterparty_get_forwarding_info(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
23957
23958 /**
23959  * Information on the fees and requirements that the counterparty requires when forwarding
23960  * payments to us through this channel.
23961  *
23962  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
23963  */
23964 void ChannelCounterparty_set_forwarding_info(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKCounterpartyForwardingInfo val);
23965
23966 /**
23967  * The smallest value HTLC (in msat) the remote peer will accept, for this channel. This field
23968  * is only `None` before we have received either the `OpenChannel` or `AcceptChannel` message
23969  * from the remote peer, or for `ChannelCounterparty` objects serialized prior to LDK 0.0.107.
23970  */
23971 struct LDKCOption_u64Z ChannelCounterparty_get_outbound_htlc_minimum_msat(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
23972
23973 /**
23974  * The smallest value HTLC (in msat) the remote peer will accept, for this channel. This field
23975  * is only `None` before we have received either the `OpenChannel` or `AcceptChannel` message
23976  * from the remote peer, or for `ChannelCounterparty` objects serialized prior to LDK 0.0.107.
23977  */
23978 void ChannelCounterparty_set_outbound_htlc_minimum_msat(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
23979
23980 /**
23981  * The largest value HTLC (in msat) the remote peer currently will accept, for this channel.
23982  */
23983 struct LDKCOption_u64Z ChannelCounterparty_get_outbound_htlc_maximum_msat(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
23984
23985 /**
23986  * The largest value HTLC (in msat) the remote peer currently will accept, for this channel.
23987  */
23988 void ChannelCounterparty_set_outbound_htlc_maximum_msat(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
23989
23990 /**
23991  * Constructs a new ChannelCounterparty given each field
23992  */
23993 MUST_USE_RES struct LDKChannelCounterparty ChannelCounterparty_new(struct LDKPublicKey node_id_arg, struct LDKInitFeatures features_arg, uint64_t unspendable_punishment_reserve_arg, struct LDKCounterpartyForwardingInfo forwarding_info_arg, struct LDKCOption_u64Z outbound_htlc_minimum_msat_arg, struct LDKCOption_u64Z outbound_htlc_maximum_msat_arg);
23994
23995 /**
23996  * Creates a copy of the ChannelCounterparty
23997  */
23998 struct LDKChannelCounterparty ChannelCounterparty_clone(const struct LDKChannelCounterparty *NONNULL_PTR orig);
23999
24000 /**
24001  * Frees any resources used by the ChannelDetails, if is_owned is set and inner is non-NULL.
24002  */
24003 void ChannelDetails_free(struct LDKChannelDetails this_obj);
24004
24005 /**
24006  * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
24007  * thereafter this is the txid of the funding transaction xor the funding transaction output).
24008  * Note that this means this value is *not* persistent - it can change once during the
24009  * lifetime of the channel.
24010  */
24011 const uint8_t (*ChannelDetails_get_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr))[32];
24012
24013 /**
24014  * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
24015  * thereafter this is the txid of the funding transaction xor the funding transaction output).
24016  * Note that this means this value is *not* persistent - it can change once during the
24017  * lifetime of the channel.
24018  */
24019 void ChannelDetails_set_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
24020
24021 /**
24022  * Parameters which apply to our counterparty. See individual fields for more information.
24023  */
24024 struct LDKChannelCounterparty ChannelDetails_get_counterparty(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
24025
24026 /**
24027  * Parameters which apply to our counterparty. See individual fields for more information.
24028  */
24029 void ChannelDetails_set_counterparty(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKChannelCounterparty val);
24030
24031 /**
24032  * The Channel's funding transaction output, if we've negotiated the funding transaction with
24033  * our counterparty already.
24034  *
24035  * Note that, if this has been set, `channel_id` will be equivalent to
24036  * `funding_txo.unwrap().to_channel_id()`.
24037  *
24038  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
24039  */
24040 struct LDKOutPoint ChannelDetails_get_funding_txo(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
24041
24042 /**
24043  * The Channel's funding transaction output, if we've negotiated the funding transaction with
24044  * our counterparty already.
24045  *
24046  * Note that, if this has been set, `channel_id` will be equivalent to
24047  * `funding_txo.unwrap().to_channel_id()`.
24048  *
24049  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
24050  */
24051 void ChannelDetails_set_funding_txo(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKOutPoint val);
24052
24053 /**
24054  * The features which this channel operates with. See individual features for more info.
24055  *
24056  * `None` until negotiation completes and the channel type is finalized.
24057  *
24058  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
24059  */
24060 struct LDKChannelTypeFeatures ChannelDetails_get_channel_type(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
24061
24062 /**
24063  * The features which this channel operates with. See individual features for more info.
24064  *
24065  * `None` until negotiation completes and the channel type is finalized.
24066  *
24067  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
24068  */
24069 void ChannelDetails_set_channel_type(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKChannelTypeFeatures val);
24070
24071 /**
24072  * The position of the funding transaction in the chain. None if the funding transaction has
24073  * not yet been confirmed and the channel fully opened.
24074  *
24075  * Note that if [`inbound_scid_alias`] is set, it must be used for invoices and inbound
24076  * payments instead of this. See [`get_inbound_payment_scid`].
24077  *
24078  * For channels with [`confirmations_required`] set to `Some(0)`, [`outbound_scid_alias`] may
24079  * be used in place of this in outbound routes. See [`get_outbound_payment_scid`].
24080  *
24081  * [`inbound_scid_alias`]: Self::inbound_scid_alias
24082  * [`outbound_scid_alias`]: Self::outbound_scid_alias
24083  * [`get_inbound_payment_scid`]: Self::get_inbound_payment_scid
24084  * [`get_outbound_payment_scid`]: Self::get_outbound_payment_scid
24085  * [`confirmations_required`]: Self::confirmations_required
24086  */
24087 struct LDKCOption_u64Z ChannelDetails_get_short_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
24088
24089 /**
24090  * The position of the funding transaction in the chain. None if the funding transaction has
24091  * not yet been confirmed and the channel fully opened.
24092  *
24093  * Note that if [`inbound_scid_alias`] is set, it must be used for invoices and inbound
24094  * payments instead of this. See [`get_inbound_payment_scid`].
24095  *
24096  * For channels with [`confirmations_required`] set to `Some(0)`, [`outbound_scid_alias`] may
24097  * be used in place of this in outbound routes. See [`get_outbound_payment_scid`].
24098  *
24099  * [`inbound_scid_alias`]: Self::inbound_scid_alias
24100  * [`outbound_scid_alias`]: Self::outbound_scid_alias
24101  * [`get_inbound_payment_scid`]: Self::get_inbound_payment_scid
24102  * [`get_outbound_payment_scid`]: Self::get_outbound_payment_scid
24103  * [`confirmations_required`]: Self::confirmations_required
24104  */
24105 void ChannelDetails_set_short_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
24106
24107 /**
24108  * An optional [`short_channel_id`] alias for this channel, randomly generated by us and
24109  * usable in place of [`short_channel_id`] to reference the channel in outbound routes when
24110  * the channel has not yet been confirmed (as long as [`confirmations_required`] is
24111  * `Some(0)`).
24112  *
24113  * This will be `None` as long as the channel is not available for routing outbound payments.
24114  *
24115  * [`short_channel_id`]: Self::short_channel_id
24116  * [`confirmations_required`]: Self::confirmations_required
24117  */
24118 struct LDKCOption_u64Z ChannelDetails_get_outbound_scid_alias(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
24119
24120 /**
24121  * An optional [`short_channel_id`] alias for this channel, randomly generated by us and
24122  * usable in place of [`short_channel_id`] to reference the channel in outbound routes when
24123  * the channel has not yet been confirmed (as long as [`confirmations_required`] is
24124  * `Some(0)`).
24125  *
24126  * This will be `None` as long as the channel is not available for routing outbound payments.
24127  *
24128  * [`short_channel_id`]: Self::short_channel_id
24129  * [`confirmations_required`]: Self::confirmations_required
24130  */
24131 void ChannelDetails_set_outbound_scid_alias(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
24132
24133 /**
24134  * An optional [`short_channel_id`] alias for this channel, randomly generated by our
24135  * counterparty and usable in place of [`short_channel_id`] in invoice route hints. Our
24136  * counterparty will recognize the alias provided here in place of the [`short_channel_id`]
24137  * when they see a payment to be routed to us.
24138  *
24139  * Our counterparty may choose to rotate this value at any time, though will always recognize
24140  * previous values for inbound payment forwarding.
24141  *
24142  * [`short_channel_id`]: Self::short_channel_id
24143  */
24144 struct LDKCOption_u64Z ChannelDetails_get_inbound_scid_alias(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
24145
24146 /**
24147  * An optional [`short_channel_id`] alias for this channel, randomly generated by our
24148  * counterparty and usable in place of [`short_channel_id`] in invoice route hints. Our
24149  * counterparty will recognize the alias provided here in place of the [`short_channel_id`]
24150  * when they see a payment to be routed to us.
24151  *
24152  * Our counterparty may choose to rotate this value at any time, though will always recognize
24153  * previous values for inbound payment forwarding.
24154  *
24155  * [`short_channel_id`]: Self::short_channel_id
24156  */
24157 void ChannelDetails_set_inbound_scid_alias(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
24158
24159 /**
24160  * The value, in satoshis, of this channel as appears in the funding output
24161  */
24162 uint64_t ChannelDetails_get_channel_value_satoshis(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
24163
24164 /**
24165  * The value, in satoshis, of this channel as appears in the funding output
24166  */
24167 void ChannelDetails_set_channel_value_satoshis(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
24168
24169 /**
24170  * The value, in satoshis, that must always be held in the channel for us. This value ensures
24171  * that if we broadcast a revoked state, our counterparty can punish us by claiming at least
24172  * this value on chain.
24173  *
24174  * This value is not included in [`outbound_capacity_msat`] as it can never be spent.
24175  *
24176  * This value will be `None` for outbound channels until the counterparty accepts the channel.
24177  *
24178  * [`outbound_capacity_msat`]: ChannelDetails::outbound_capacity_msat
24179  */
24180 struct LDKCOption_u64Z ChannelDetails_get_unspendable_punishment_reserve(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
24181
24182 /**
24183  * The value, in satoshis, that must always be held in the channel for us. This value ensures
24184  * that if we broadcast a revoked state, our counterparty can punish us by claiming at least
24185  * this value on chain.
24186  *
24187  * This value is not included in [`outbound_capacity_msat`] as it can never be spent.
24188  *
24189  * This value will be `None` for outbound channels until the counterparty accepts the channel.
24190  *
24191  * [`outbound_capacity_msat`]: ChannelDetails::outbound_capacity_msat
24192  */
24193 void ChannelDetails_set_unspendable_punishment_reserve(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
24194
24195 /**
24196  * The `user_channel_id` passed in to create_channel, or a random value if the channel was
24197  * inbound. This may be zero for inbound channels serialized with LDK versions prior to
24198  * 0.0.113.
24199  */
24200 struct LDKU128 ChannelDetails_get_user_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
24201
24202 /**
24203  * The `user_channel_id` passed in to create_channel, or a random value if the channel was
24204  * inbound. This may be zero for inbound channels serialized with LDK versions prior to
24205  * 0.0.113.
24206  */
24207 void ChannelDetails_set_user_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKU128 val);
24208
24209 /**
24210  * The currently negotiated fee rate denominated in satoshi per 1000 weight units,
24211  * which is applied to commitment and HTLC transactions.
24212  *
24213  * This value will be `None` for objects serialized with LDK versions prior to 0.0.115.
24214  */
24215 struct LDKCOption_u32Z ChannelDetails_get_feerate_sat_per_1000_weight(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
24216
24217 /**
24218  * The currently negotiated fee rate denominated in satoshi per 1000 weight units,
24219  * which is applied to commitment and HTLC transactions.
24220  *
24221  * This value will be `None` for objects serialized with LDK versions prior to 0.0.115.
24222  */
24223 void ChannelDetails_set_feerate_sat_per_1000_weight(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val);
24224
24225 /**
24226  * Our total balance.  This is the amount we would get if we close the channel.
24227  * This value is not exact. Due to various in-flight changes and feerate changes, exactly this
24228  * amount is not likely to be recoverable on close.
24229  *
24230  * This does not include any pending HTLCs which are not yet fully resolved (and, thus, whose
24231  * balance is not available for inclusion in new outbound HTLCs). This further does not include
24232  * any pending outgoing HTLCs which are awaiting some other resolution to be sent.
24233  * This does not consider any on-chain fees.
24234  *
24235  * See also [`ChannelDetails::outbound_capacity_msat`]
24236  */
24237 uint64_t ChannelDetails_get_balance_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
24238
24239 /**
24240  * Our total balance.  This is the amount we would get if we close the channel.
24241  * This value is not exact. Due to various in-flight changes and feerate changes, exactly this
24242  * amount is not likely to be recoverable on close.
24243  *
24244  * This does not include any pending HTLCs which are not yet fully resolved (and, thus, whose
24245  * balance is not available for inclusion in new outbound HTLCs). This further does not include
24246  * any pending outgoing HTLCs which are awaiting some other resolution to be sent.
24247  * This does not consider any on-chain fees.
24248  *
24249  * See also [`ChannelDetails::outbound_capacity_msat`]
24250  */
24251 void ChannelDetails_set_balance_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
24252
24253 /**
24254  * The available outbound capacity for sending HTLCs to the remote peer. This does not include
24255  * any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
24256  * available for inclusion in new outbound HTLCs). This further does not include any pending
24257  * outgoing HTLCs which are awaiting some other resolution to be sent.
24258  *
24259  * See also [`ChannelDetails::balance_msat`]
24260  *
24261  * This value is not exact. Due to various in-flight changes, feerate changes, and our
24262  * conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we
24263  * should be able to spend nearly this amount.
24264  */
24265 uint64_t ChannelDetails_get_outbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
24266
24267 /**
24268  * The available outbound capacity for sending HTLCs to the remote peer. This does not include
24269  * any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
24270  * available for inclusion in new outbound HTLCs). This further does not include any pending
24271  * outgoing HTLCs which are awaiting some other resolution to be sent.
24272  *
24273  * See also [`ChannelDetails::balance_msat`]
24274  *
24275  * This value is not exact. Due to various in-flight changes, feerate changes, and our
24276  * conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we
24277  * should be able to spend nearly this amount.
24278  */
24279 void ChannelDetails_set_outbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
24280
24281 /**
24282  * The available outbound capacity for sending a single HTLC to the remote peer. This is
24283  * similar to [`ChannelDetails::outbound_capacity_msat`] but it may be further restricted by
24284  * the current state and per-HTLC limit(s). This is intended for use when routing, allowing us
24285  * to use a limit as close as possible to the HTLC limit we can currently send.
24286  *
24287  * See also [`ChannelDetails::balance_msat`] and [`ChannelDetails::outbound_capacity_msat`].
24288  */
24289 uint64_t ChannelDetails_get_next_outbound_htlc_limit_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
24290
24291 /**
24292  * The available outbound capacity for sending a single HTLC to the remote peer. This is
24293  * similar to [`ChannelDetails::outbound_capacity_msat`] but it may be further restricted by
24294  * the current state and per-HTLC limit(s). This is intended for use when routing, allowing us
24295  * to use a limit as close as possible to the HTLC limit we can currently send.
24296  *
24297  * See also [`ChannelDetails::balance_msat`] and [`ChannelDetails::outbound_capacity_msat`].
24298  */
24299 void ChannelDetails_set_next_outbound_htlc_limit_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
24300
24301 /**
24302  * The available inbound capacity for the remote peer to send HTLCs to us. This does not
24303  * include any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
24304  * available for inclusion in new inbound HTLCs).
24305  * Note that there are some corner cases not fully handled here, so the actual available
24306  * inbound capacity may be slightly higher than this.
24307  *
24308  * This value is not exact. Due to various in-flight changes, feerate changes, and our
24309  * counterparty's conflict-avoidance policy, exactly this amount is not likely to be spendable.
24310  * However, our counterparty should be able to spend nearly this amount.
24311  */
24312 uint64_t ChannelDetails_get_inbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
24313
24314 /**
24315  * The available inbound capacity for the remote peer to send HTLCs to us. This does not
24316  * include any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
24317  * available for inclusion in new inbound HTLCs).
24318  * Note that there are some corner cases not fully handled here, so the actual available
24319  * inbound capacity may be slightly higher than this.
24320  *
24321  * This value is not exact. Due to various in-flight changes, feerate changes, and our
24322  * counterparty's conflict-avoidance policy, exactly this amount is not likely to be spendable.
24323  * However, our counterparty should be able to spend nearly this amount.
24324  */
24325 void ChannelDetails_set_inbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
24326
24327 /**
24328  * The number of required confirmations on the funding transaction before the funding will be
24329  * considered \"locked\". This number is selected by the channel fundee (i.e. us if
24330  * [`is_outbound`] is *not* set), and can be selected for inbound channels with
24331  * [`ChannelHandshakeConfig::minimum_depth`] or limited for outbound channels with
24332  * [`ChannelHandshakeLimits::max_minimum_depth`].
24333  *
24334  * This value will be `None` for outbound channels until the counterparty accepts the channel.
24335  *
24336  * [`is_outbound`]: ChannelDetails::is_outbound
24337  * [`ChannelHandshakeConfig::minimum_depth`]: crate::util::config::ChannelHandshakeConfig::minimum_depth
24338  * [`ChannelHandshakeLimits::max_minimum_depth`]: crate::util::config::ChannelHandshakeLimits::max_minimum_depth
24339  */
24340 struct LDKCOption_u32Z ChannelDetails_get_confirmations_required(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
24341
24342 /**
24343  * The number of required confirmations on the funding transaction before the funding will be
24344  * considered \"locked\". This number is selected by the channel fundee (i.e. us if
24345  * [`is_outbound`] is *not* set), and can be selected for inbound channels with
24346  * [`ChannelHandshakeConfig::minimum_depth`] or limited for outbound channels with
24347  * [`ChannelHandshakeLimits::max_minimum_depth`].
24348  *
24349  * This value will be `None` for outbound channels until the counterparty accepts the channel.
24350  *
24351  * [`is_outbound`]: ChannelDetails::is_outbound
24352  * [`ChannelHandshakeConfig::minimum_depth`]: crate::util::config::ChannelHandshakeConfig::minimum_depth
24353  * [`ChannelHandshakeLimits::max_minimum_depth`]: crate::util::config::ChannelHandshakeLimits::max_minimum_depth
24354  */
24355 void ChannelDetails_set_confirmations_required(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val);
24356
24357 /**
24358  * The current number of confirmations on the funding transaction.
24359  *
24360  * This value will be `None` for objects serialized with LDK versions prior to 0.0.113.
24361  */
24362 struct LDKCOption_u32Z ChannelDetails_get_confirmations(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
24363
24364 /**
24365  * The current number of confirmations on the funding transaction.
24366  *
24367  * This value will be `None` for objects serialized with LDK versions prior to 0.0.113.
24368  */
24369 void ChannelDetails_set_confirmations(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val);
24370
24371 /**
24372  * The number of blocks (after our commitment transaction confirms) that we will need to wait
24373  * until we can claim our funds after we force-close the channel. During this time our
24374  * counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty
24375  * force-closes the channel and broadcasts a commitment transaction we do not have to wait any
24376  * time to claim our non-HTLC-encumbered funds.
24377  *
24378  * This value will be `None` for outbound channels until the counterparty accepts the channel.
24379  */
24380 struct LDKCOption_u16Z ChannelDetails_get_force_close_spend_delay(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
24381
24382 /**
24383  * The number of blocks (after our commitment transaction confirms) that we will need to wait
24384  * until we can claim our funds after we force-close the channel. During this time our
24385  * counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty
24386  * force-closes the channel and broadcasts a commitment transaction we do not have to wait any
24387  * time to claim our non-HTLC-encumbered funds.
24388  *
24389  * This value will be `None` for outbound channels until the counterparty accepts the channel.
24390  */
24391 void ChannelDetails_set_force_close_spend_delay(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u16Z val);
24392
24393 /**
24394  * True if the channel was initiated (and thus funded) by us.
24395  */
24396 bool ChannelDetails_get_is_outbound(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
24397
24398 /**
24399  * True if the channel was initiated (and thus funded) by us.
24400  */
24401 void ChannelDetails_set_is_outbound(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
24402
24403 /**
24404  * True if the channel is confirmed, channel_ready messages have been exchanged, and the
24405  * channel is not currently being shut down. `channel_ready` message exchange implies the
24406  * required confirmation count has been reached (and we were connected to the peer at some
24407  * point after the funding transaction received enough confirmations). The required
24408  * confirmation count is provided in [`confirmations_required`].
24409  *
24410  * [`confirmations_required`]: ChannelDetails::confirmations_required
24411  */
24412 bool ChannelDetails_get_is_channel_ready(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
24413
24414 /**
24415  * True if the channel is confirmed, channel_ready messages have been exchanged, and the
24416  * channel is not currently being shut down. `channel_ready` message exchange implies the
24417  * required confirmation count has been reached (and we were connected to the peer at some
24418  * point after the funding transaction received enough confirmations). The required
24419  * confirmation count is provided in [`confirmations_required`].
24420  *
24421  * [`confirmations_required`]: ChannelDetails::confirmations_required
24422  */
24423 void ChannelDetails_set_is_channel_ready(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
24424
24425 /**
24426  * True if the channel is (a) confirmed and channel_ready messages have been exchanged, (b)
24427  * the peer is connected, and (c) the channel is not currently negotiating a shutdown.
24428  *
24429  * This is a strict superset of `is_channel_ready`.
24430  */
24431 bool ChannelDetails_get_is_usable(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
24432
24433 /**
24434  * True if the channel is (a) confirmed and channel_ready messages have been exchanged, (b)
24435  * the peer is connected, and (c) the channel is not currently negotiating a shutdown.
24436  *
24437  * This is a strict superset of `is_channel_ready`.
24438  */
24439 void ChannelDetails_set_is_usable(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
24440
24441 /**
24442  * True if this channel is (or will be) publicly-announced.
24443  */
24444 bool ChannelDetails_get_is_public(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
24445
24446 /**
24447  * True if this channel is (or will be) publicly-announced.
24448  */
24449 void ChannelDetails_set_is_public(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
24450
24451 /**
24452  * The smallest value HTLC (in msat) we will accept, for this channel. This field
24453  * is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.107
24454  */
24455 struct LDKCOption_u64Z ChannelDetails_get_inbound_htlc_minimum_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
24456
24457 /**
24458  * The smallest value HTLC (in msat) we will accept, for this channel. This field
24459  * is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.107
24460  */
24461 void ChannelDetails_set_inbound_htlc_minimum_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
24462
24463 /**
24464  * The largest value HTLC (in msat) we currently will accept, for this channel.
24465  */
24466 struct LDKCOption_u64Z ChannelDetails_get_inbound_htlc_maximum_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
24467
24468 /**
24469  * The largest value HTLC (in msat) we currently will accept, for this channel.
24470  */
24471 void ChannelDetails_set_inbound_htlc_maximum_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
24472
24473 /**
24474  * Set of configurable parameters that affect channel operation.
24475  *
24476  * This field is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.109.
24477  *
24478  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
24479  */
24480 struct LDKChannelConfig ChannelDetails_get_config(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
24481
24482 /**
24483  * Set of configurable parameters that affect channel operation.
24484  *
24485  * This field is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.109.
24486  *
24487  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
24488  */
24489 void ChannelDetails_set_config(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKChannelConfig val);
24490
24491 /**
24492  * Constructs a new ChannelDetails given each field
24493  */
24494 MUST_USE_RES struct LDKChannelDetails ChannelDetails_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKChannelCounterparty counterparty_arg, struct LDKOutPoint funding_txo_arg, struct LDKChannelTypeFeatures channel_type_arg, struct LDKCOption_u64Z short_channel_id_arg, struct LDKCOption_u64Z outbound_scid_alias_arg, struct LDKCOption_u64Z inbound_scid_alias_arg, uint64_t channel_value_satoshis_arg, struct LDKCOption_u64Z unspendable_punishment_reserve_arg, struct LDKU128 user_channel_id_arg, struct LDKCOption_u32Z feerate_sat_per_1000_weight_arg, uint64_t balance_msat_arg, uint64_t outbound_capacity_msat_arg, uint64_t next_outbound_htlc_limit_msat_arg, uint64_t inbound_capacity_msat_arg, struct LDKCOption_u32Z confirmations_required_arg, struct LDKCOption_u32Z confirmations_arg, struct LDKCOption_u16Z force_close_spend_delay_arg, bool is_outbound_arg, bool is_channel_ready_arg, bool is_usable_arg, bool is_public_arg, struct LDKCOption_u64Z inbound_htlc_minimum_msat_arg, struct LDKCOption_u64Z inbound_htlc_maximum_msat_arg, struct LDKChannelConfig config_arg);
24495
24496 /**
24497  * Creates a copy of the ChannelDetails
24498  */
24499 struct LDKChannelDetails ChannelDetails_clone(const struct LDKChannelDetails *NONNULL_PTR orig);
24500
24501 /**
24502  * Gets the current SCID which should be used to identify this channel for inbound payments.
24503  * This should be used for providing invoice hints or in any other context where our
24504  * counterparty will forward a payment to us.
24505  *
24506  * This is either the [`ChannelDetails::inbound_scid_alias`], if set, or the
24507  * [`ChannelDetails::short_channel_id`]. See those for more information.
24508  */
24509 MUST_USE_RES struct LDKCOption_u64Z ChannelDetails_get_inbound_payment_scid(const struct LDKChannelDetails *NONNULL_PTR this_arg);
24510
24511 /**
24512  * Gets the current SCID which should be used to identify this channel for outbound payments.
24513  * This should be used in [`Route`]s to describe the first hop or in other contexts where
24514  * we're sending or forwarding a payment outbound over this channel.
24515  *
24516  * This is either the [`ChannelDetails::short_channel_id`], if set, or the
24517  * [`ChannelDetails::outbound_scid_alias`]. See those for more information.
24518  */
24519 MUST_USE_RES struct LDKCOption_u64Z ChannelDetails_get_outbound_payment_scid(const struct LDKChannelDetails *NONNULL_PTR this_arg);
24520
24521 /**
24522  * Frees any resources used by the RecentPaymentDetails
24523  */
24524 void RecentPaymentDetails_free(struct LDKRecentPaymentDetails this_ptr);
24525
24526 /**
24527  * Creates a copy of the RecentPaymentDetails
24528  */
24529 struct LDKRecentPaymentDetails RecentPaymentDetails_clone(const struct LDKRecentPaymentDetails *NONNULL_PTR orig);
24530
24531 /**
24532  * Utility method to constructs a new Pending-variant RecentPaymentDetails
24533  */
24534 struct LDKRecentPaymentDetails RecentPaymentDetails_pending(struct LDKThirtyTwoBytes payment_hash, uint64_t total_msat);
24535
24536 /**
24537  * Utility method to constructs a new Fulfilled-variant RecentPaymentDetails
24538  */
24539 struct LDKRecentPaymentDetails RecentPaymentDetails_fulfilled(struct LDKThirtyTwoBytes payment_hash);
24540
24541 /**
24542  * Utility method to constructs a new Abandoned-variant RecentPaymentDetails
24543  */
24544 struct LDKRecentPaymentDetails RecentPaymentDetails_abandoned(struct LDKThirtyTwoBytes payment_hash);
24545
24546 /**
24547  * Frees any resources used by the PhantomRouteHints, if is_owned is set and inner is non-NULL.
24548  */
24549 void PhantomRouteHints_free(struct LDKPhantomRouteHints this_obj);
24550
24551 /**
24552  * The list of channels to be included in the invoice route hints.
24553  */
24554 struct LDKCVec_ChannelDetailsZ PhantomRouteHints_get_channels(const struct LDKPhantomRouteHints *NONNULL_PTR this_ptr);
24555
24556 /**
24557  * The list of channels to be included in the invoice route hints.
24558  */
24559 void PhantomRouteHints_set_channels(struct LDKPhantomRouteHints *NONNULL_PTR this_ptr, struct LDKCVec_ChannelDetailsZ val);
24560
24561 /**
24562  * A fake scid used for representing the phantom node's fake channel in generating the invoice
24563  * route hints.
24564  */
24565 uint64_t PhantomRouteHints_get_phantom_scid(const struct LDKPhantomRouteHints *NONNULL_PTR this_ptr);
24566
24567 /**
24568  * A fake scid used for representing the phantom node's fake channel in generating the invoice
24569  * route hints.
24570  */
24571 void PhantomRouteHints_set_phantom_scid(struct LDKPhantomRouteHints *NONNULL_PTR this_ptr, uint64_t val);
24572
24573 /**
24574  * The pubkey of the real backing node that would ultimately receive the payment.
24575  */
24576 struct LDKPublicKey PhantomRouteHints_get_real_node_pubkey(const struct LDKPhantomRouteHints *NONNULL_PTR this_ptr);
24577
24578 /**
24579  * The pubkey of the real backing node that would ultimately receive the payment.
24580  */
24581 void PhantomRouteHints_set_real_node_pubkey(struct LDKPhantomRouteHints *NONNULL_PTR this_ptr, struct LDKPublicKey val);
24582
24583 /**
24584  * Constructs a new PhantomRouteHints given each field
24585  */
24586 MUST_USE_RES struct LDKPhantomRouteHints PhantomRouteHints_new(struct LDKCVec_ChannelDetailsZ channels_arg, uint64_t phantom_scid_arg, struct LDKPublicKey real_node_pubkey_arg);
24587
24588 /**
24589  * Creates a copy of the PhantomRouteHints
24590  */
24591 struct LDKPhantomRouteHints PhantomRouteHints_clone(const struct LDKPhantomRouteHints *NONNULL_PTR orig);
24592
24593 /**
24594  * Constructs a new `ChannelManager` to hold several channels and route between them.
24595  *
24596  * This is the main \"logic hub\" for all channel-related actions, and implements
24597  * [`ChannelMessageHandler`].
24598  *
24599  * Non-proportional fees are fixed according to our risk using the provided fee estimator.
24600  *
24601  * Users need to notify the new `ChannelManager` when a new block is connected or
24602  * disconnected using its [`block_connected`] and [`block_disconnected`] methods, starting
24603  * from after [`params.best_block.block_hash`]. See [`chain::Listen`] and [`chain::Confirm`] for
24604  * more details.
24605  *
24606  * [`block_connected`]: chain::Listen::block_connected
24607  * [`block_disconnected`]: chain::Listen::block_disconnected
24608  * [`params.best_block.block_hash`]: chain::BestBlock::block_hash
24609  */
24610 MUST_USE_RES struct LDKChannelManager ChannelManager_new(struct LDKFeeEstimator fee_est, struct LDKWatch chain_monitor, struct LDKBroadcasterInterface tx_broadcaster, struct LDKRouter router, struct LDKLogger logger, struct LDKEntropySource entropy_source, struct LDKNodeSigner node_signer, struct LDKSignerProvider signer_provider, struct LDKUserConfig config, struct LDKChainParameters params);
24611
24612 /**
24613  * Gets the current configuration applied to all new channels.
24614  */
24615 MUST_USE_RES struct LDKUserConfig ChannelManager_get_current_default_configuration(const struct LDKChannelManager *NONNULL_PTR this_arg);
24616
24617 /**
24618  * Creates a new outbound channel to the given remote node and with the given value.
24619  *
24620  * `user_channel_id` will be provided back as in
24621  * [`Event::FundingGenerationReady::user_channel_id`] to allow tracking of which events
24622  * correspond with which `create_channel` call. Note that the `user_channel_id` defaults to a
24623  * randomized value for inbound channels. `user_channel_id` has no meaning inside of LDK, it
24624  * is simply copied to events and otherwise ignored.
24625  *
24626  * Raises [`APIError::APIMisuseError`] when `channel_value_satoshis` > 2**24 or `push_msat` is
24627  * greater than `channel_value_satoshis * 1k` or `channel_value_satoshis < 1000`.
24628  *
24629  * Note that we do not check if you are currently connected to the given peer. If no
24630  * connection is available, the outbound `open_channel` message may fail to send, resulting in
24631  * the channel eventually being silently forgotten (dropped on reload).
24632  *
24633  * Returns the new Channel's temporary `channel_id`. This ID will appear as
24634  * [`Event::FundingGenerationReady::temporary_channel_id`] and in
24635  * [`ChannelDetails::channel_id`] until after
24636  * [`ChannelManager::funding_transaction_generated`] is called, swapping the Channel's ID for
24637  * one derived from the funding transaction's TXID. If the counterparty rejects the channel
24638  * immediately, this temporary ID will appear in [`Event::ChannelClosed::channel_id`].
24639  *
24640  * [`Event::FundingGenerationReady::user_channel_id`]: events::Event::FundingGenerationReady::user_channel_id
24641  * [`Event::FundingGenerationReady::temporary_channel_id`]: events::Event::FundingGenerationReady::temporary_channel_id
24642  * [`Event::ChannelClosed::channel_id`]: events::Event::ChannelClosed::channel_id
24643  *
24644  * Note that override_config (or a relevant inner pointer) may be NULL or all-0s to represent None
24645  */
24646 MUST_USE_RES struct LDKCResult__u832APIErrorZ ChannelManager_create_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKPublicKey their_network_key, uint64_t channel_value_satoshis, uint64_t push_msat, struct LDKU128 user_channel_id, struct LDKUserConfig override_config);
24647
24648 /**
24649  * Gets the list of open channels, in random order. See [`ChannelDetails`] field documentation for
24650  * more information.
24651  */
24652 MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
24653
24654 /**
24655  * Gets the list of usable channels, in random order. Useful as an argument to
24656  * [`Router::find_route`] to ensure non-announced channels are used.
24657  *
24658  * These are guaranteed to have their [`ChannelDetails::is_usable`] value set to true, see the
24659  * documentation for [`ChannelDetails::is_usable`] for more info on exactly what the criteria
24660  * are.
24661  */
24662 MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_usable_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
24663
24664 /**
24665  * Gets the list of channels we have with a given counterparty, in random order.
24666  */
24667 MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_channels_with_counterparty(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKPublicKey counterparty_node_id);
24668
24669 /**
24670  * Returns in an undefined order recent payments that -- if not fulfilled -- have yet to find a
24671  * successful path, or have unresolved HTLCs.
24672  *
24673  * This can be useful for payments that may have been prepared, but ultimately not sent, as a
24674  * result of a crash. If such a payment exists, is not listed here, and an
24675  * [`Event::PaymentSent`] has not been received, you may consider resending the payment.
24676  *
24677  * [`Event::PaymentSent`]: events::Event::PaymentSent
24678  */
24679 MUST_USE_RES struct LDKCVec_RecentPaymentDetailsZ ChannelManager_list_recent_payments(const struct LDKChannelManager *NONNULL_PTR this_arg);
24680
24681 /**
24682  * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs
24683  * will be accepted on the given channel, and after additional timeout/the closing of all
24684  * pending HTLCs, the channel will be closed on chain.
24685  *
24686  *  * If we are the channel initiator, we will pay between our [`Background`] and
24687  *    [`ChannelConfig::force_close_avoidance_max_fee_satoshis`] plus our [`Normal`] fee
24688  *    estimate.
24689  *  * If our counterparty is the channel initiator, we will require a channel closing
24690  *    transaction feerate of at least our [`Background`] feerate or the feerate which
24691  *    would appear on a force-closure transaction, whichever is lower. We will allow our
24692  *    counterparty to pay as much fee as they'd like, however.
24693  *
24694  * May generate a [`SendShutdown`] message event on success, which should be relayed.
24695  *
24696  * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]: crate::util::config::ChannelConfig::force_close_avoidance_max_fee_satoshis
24697  * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
24698  * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
24699  * [`SendShutdown`]: crate::events::MessageSendEvent::SendShutdown
24700  */
24701 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32], struct LDKPublicKey counterparty_node_id);
24702
24703 /**
24704  * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs
24705  * will be accepted on the given channel, and after additional timeout/the closing of all
24706  * pending HTLCs, the channel will be closed on chain.
24707  *
24708  * `target_feerate_sat_per_1000_weight` has different meanings depending on if we initiated
24709  * the channel being closed or not:
24710  *  * If we are the channel initiator, we will pay at least this feerate on the closing
24711  *    transaction. The upper-bound is set by
24712  *    [`ChannelConfig::force_close_avoidance_max_fee_satoshis`] plus our [`Normal`] fee
24713  *    estimate (or `target_feerate_sat_per_1000_weight`, if it is greater).
24714  *  * If our counterparty is the channel initiator, we will refuse to accept a channel closure
24715  *    transaction feerate below `target_feerate_sat_per_1000_weight` (or the feerate which
24716  *    will appear on a force-closure transaction, whichever is lower).
24717  *
24718  * May generate a [`SendShutdown`] message event on success, which should be relayed.
24719  *
24720  * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]: crate::util::config::ChannelConfig::force_close_avoidance_max_fee_satoshis
24721  * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
24722  * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
24723  * [`SendShutdown`]: crate::events::MessageSendEvent::SendShutdown
24724  */
24725 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_close_channel_with_target_feerate(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32], struct LDKPublicKey counterparty_node_id, uint32_t target_feerate_sats_per_1000_weight);
24726
24727 /**
24728  * Force closes a channel, immediately broadcasting the latest local transaction(s) and
24729  * rejecting new HTLCs on the given channel. Fails if `channel_id` is unknown to
24730  * the manager, or if the `counterparty_node_id` isn't the counterparty of the corresponding
24731  * channel.
24732  */
24733 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_force_close_broadcasting_latest_txn(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32], struct LDKPublicKey counterparty_node_id);
24734
24735 /**
24736  * Force closes a channel, rejecting new HTLCs on the given channel but skips broadcasting
24737  * the latest local transaction(s). Fails if `channel_id` is unknown to the manager, or if the
24738  * `counterparty_node_id` isn't the counterparty of the corresponding channel.
24739  *
24740  * You can always get the latest local transaction(s) to broadcast from
24741  * [`ChannelMonitor::get_latest_holder_commitment_txn`].
24742  */
24743 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_force_close_without_broadcasting_txn(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32], struct LDKPublicKey counterparty_node_id);
24744
24745 /**
24746  * Force close all channels, immediately broadcasting the latest local commitment transaction
24747  * for each to the chain and rejecting new HTLCs on each.
24748  */
24749 void ChannelManager_force_close_all_channels_broadcasting_latest_txn(const struct LDKChannelManager *NONNULL_PTR this_arg);
24750
24751 /**
24752  * Force close all channels rejecting new HTLCs on each but without broadcasting the latest
24753  * local transaction(s).
24754  */
24755 void ChannelManager_force_close_all_channels_without_broadcasting_txn(const struct LDKChannelManager *NONNULL_PTR this_arg);
24756
24757 /**
24758  * Sends a payment along a given route.
24759  *
24760  * Value parameters are provided via the last hop in route, see documentation for [`RouteHop`]
24761  * fields for more info.
24762  *
24763  * May generate [`UpdateHTLCs`] message(s) event on success, which should be relayed (e.g. via
24764  * [`PeerManager::process_events`]).
24765  *
24766  * # Avoiding Duplicate Payments
24767  *
24768  * If a pending payment is currently in-flight with the same [`PaymentId`] provided, this
24769  * method will error with an [`APIError::InvalidRoute`]. Note, however, that once a payment
24770  * is no longer pending (either via [`ChannelManager::abandon_payment`], or handling of an
24771  * [`Event::PaymentSent`] or [`Event::PaymentFailed`]) LDK will not stop you from sending a
24772  * second payment with the same [`PaymentId`].
24773  *
24774  * Thus, in order to ensure duplicate payments are not sent, you should implement your own
24775  * tracking of payments, including state to indicate once a payment has completed. Because you
24776  * should also ensure that [`PaymentHash`]es are not re-used, for simplicity, you should
24777  * consider using the [`PaymentHash`] as the key for tracking payments. In that case, the
24778  * [`PaymentId`] should be a copy of the [`PaymentHash`] bytes.
24779  *
24780  * Additionally, in the scenario where we begin the process of sending a payment, but crash
24781  * before `send_payment` returns (or prior to [`ChannelMonitorUpdate`] persistence if you're
24782  * using [`ChannelMonitorUpdateStatus::InProgress`]), the payment may be lost on restart. See
24783  * [`ChannelManager::list_recent_payments`] for more information.
24784  *
24785  * # Possible Error States on [`PaymentSendFailure`]
24786  *
24787  * Each path may have a different return value, and [`PaymentSendFailure`] may return a `Vec` with
24788  * each entry matching the corresponding-index entry in the route paths, see
24789  * [`PaymentSendFailure`] for more info.
24790  *
24791  * In general, a path may raise:
24792  *  * [`APIError::InvalidRoute`] when an invalid route or forwarding parameter (cltv_delta, fee,
24793  *    node public key) is specified.
24794  *  * [`APIError::ChannelUnavailable`] if the next-hop channel is not available for updates
24795  *    (including due to previous monitor update failure or new permanent monitor update
24796  *    failure).
24797  *  * [`APIError::MonitorUpdateInProgress`] if a new monitor update failure prevented sending the
24798  *    relevant updates.
24799  *
24800  * Note that depending on the type of the [`PaymentSendFailure`] the HTLC may have been
24801  * irrevocably committed to on our end. In such a case, do NOT retry the payment with a
24802  * different route unless you intend to pay twice!
24803  *
24804  * [`Event::PaymentSent`]: events::Event::PaymentSent
24805  * [`Event::PaymentFailed`]: events::Event::PaymentFailed
24806  * [`UpdateHTLCs`]: events::MessageSendEvent::UpdateHTLCs
24807  * [`PeerManager::process_events`]: crate::ln::peer_handler::PeerManager::process_events
24808  * [`ChannelMonitorUpdateStatus::InProgress`]: crate::chain::ChannelMonitorUpdateStatus::InProgress
24809  */
24810 MUST_USE_RES struct LDKCResult_NonePaymentSendFailureZ ChannelManager_send_payment_with_route(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_hash, struct LDKRecipientOnionFields recipient_onion, struct LDKThirtyTwoBytes payment_id);
24811
24812 /**
24813  * Similar to [`ChannelManager::send_payment`], but will automatically find a route based on
24814  * `route_params` and retry failed payment paths based on `retry_strategy`.
24815  */
24816 MUST_USE_RES struct LDKCResult_NoneRetryableSendFailureZ ChannelManager_send_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_hash, struct LDKRecipientOnionFields recipient_onion, struct LDKThirtyTwoBytes payment_id, struct LDKRouteParameters route_params, struct LDKRetry retry_strategy);
24817
24818 /**
24819  * Signals that no further retries for the given payment should occur. Useful if you have a
24820  * pending outbound payment with retries remaining, but wish to stop retrying the payment before
24821  * retries are exhausted.
24822  *
24823  * If no [`Event::PaymentFailed`] event had been generated before, one will be generated as soon
24824  * as there are no remaining pending HTLCs for this payment.
24825  *
24826  * Note that calling this method does *not* prevent a payment from succeeding. You must still
24827  * wait until you receive either a [`Event::PaymentFailed`] or [`Event::PaymentSent`] event to
24828  * determine the ultimate status of a payment.
24829  *
24830  * If an [`Event::PaymentFailed`] event is generated and we restart without this
24831  * [`ChannelManager`] having been persisted, another [`Event::PaymentFailed`] may be generated.
24832  *
24833  * [`Event::PaymentFailed`]: events::Event::PaymentFailed
24834  * [`Event::PaymentSent`]: events::Event::PaymentSent
24835  */
24836 void ChannelManager_abandon_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_id);
24837
24838 /**
24839  * Send a spontaneous payment, which is a payment that does not require the recipient to have
24840  * generated an invoice. Optionally, you may specify the preimage. If you do choose to specify
24841  * the preimage, it must be a cryptographically secure random value that no intermediate node
24842  * would be able to guess -- otherwise, an intermediate node may claim the payment and it will
24843  * never reach the recipient.
24844  *
24845  * See [`send_payment`] documentation for more details on the return value of this function
24846  * and idempotency guarantees provided by the [`PaymentId`] key.
24847  *
24848  * Similar to regular payments, you MUST NOT reuse a `payment_preimage` value. See
24849  * [`send_payment`] for more information about the risks of duplicate preimage usage.
24850  *
24851  * Note that `route` must have exactly one path.
24852  *
24853  * [`send_payment`]: Self::send_payment
24854  *
24855  * Note that payment_preimage (or a relevant inner pointer) may be NULL or all-0s to represent None
24856  */
24857 MUST_USE_RES struct LDKCResult_PaymentHashPaymentSendFailureZ ChannelManager_send_spontaneous_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_preimage, struct LDKRecipientOnionFields recipient_onion, struct LDKThirtyTwoBytes payment_id);
24858
24859 /**
24860  * Similar to [`ChannelManager::send_spontaneous_payment`], but will automatically find a route
24861  * based on `route_params` and retry failed payment paths based on `retry_strategy`.
24862  *
24863  * See [`PaymentParameters::for_keysend`] for help in constructing `route_params` for spontaneous
24864  * payments.
24865  *
24866  * [`PaymentParameters::for_keysend`]: crate::routing::router::PaymentParameters::for_keysend
24867  *
24868  * Note that payment_preimage (or a relevant inner pointer) may be NULL or all-0s to represent None
24869  */
24870 MUST_USE_RES struct LDKCResult_PaymentHashRetryableSendFailureZ ChannelManager_send_spontaneous_payment_with_retry(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_preimage, struct LDKRecipientOnionFields recipient_onion, struct LDKThirtyTwoBytes payment_id, struct LDKRouteParameters route_params, struct LDKRetry retry_strategy);
24871
24872 /**
24873  * Send a payment that is probing the given route for liquidity. We calculate the
24874  * [`PaymentHash`] of probes based on a static secret and a random [`PaymentId`], which allows
24875  * us to easily discern them from real payments.
24876  */
24877 MUST_USE_RES struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ ChannelManager_send_probe(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKPath path);
24878
24879 /**
24880  * Call this upon creation of a funding transaction for the given channel.
24881  *
24882  * Returns an [`APIError::APIMisuseError`] if the funding_transaction spent non-SegWit outputs
24883  * or if no output was found which matches the parameters in [`Event::FundingGenerationReady`].
24884  *
24885  * Returns [`APIError::APIMisuseError`] if the funding transaction is not final for propagation
24886  * across the p2p network.
24887  *
24888  * Returns [`APIError::ChannelUnavailable`] if a funding transaction has already been provided
24889  * for the channel or if the channel has been closed as indicated by [`Event::ChannelClosed`].
24890  *
24891  * May panic if the output found in the funding transaction is duplicative with some other
24892  * channel (note that this should be trivially prevented by using unique funding transaction
24893  * keys per-channel).
24894  *
24895  * Do NOT broadcast the funding transaction yourself. When we have safely received our
24896  * counterparty's signature the funding transaction will automatically be broadcast via the
24897  * [`BroadcasterInterface`] provided when this `ChannelManager` was constructed.
24898  *
24899  * Note that this includes RBF or similar transaction replacement strategies - lightning does
24900  * not currently support replacing a funding transaction on an existing channel. Instead,
24901  * create a new channel with a conflicting funding transaction.
24902  *
24903  * Note to keep the miner incentives aligned in moving the blockchain forward, we recommend
24904  * the wallet software generating the funding transaction to apply anti-fee sniping as
24905  * implemented by Bitcoin Core wallet. See <https://bitcoinops.org/en/topics/fee-sniping/>
24906  * for more details.
24907  *
24908  * [`Event::FundingGenerationReady`]: crate::events::Event::FundingGenerationReady
24909  * [`Event::ChannelClosed`]: crate::events::Event::ChannelClosed
24910  */
24911 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_funding_transaction_generated(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*temporary_channel_id)[32], struct LDKPublicKey counterparty_node_id, struct LDKTransaction funding_transaction);
24912
24913 /**
24914  * Atomically updates the [`ChannelConfig`] for the given channels.
24915  *
24916  * Once the updates are applied, each eligible channel (advertised with a known short channel
24917  * ID and a change in [`forwarding_fee_proportional_millionths`], [`forwarding_fee_base_msat`],
24918  * or [`cltv_expiry_delta`]) has a [`BroadcastChannelUpdate`] event message generated
24919  * containing the new [`ChannelUpdate`] message which should be broadcast to the network.
24920  *
24921  * Returns [`ChannelUnavailable`] when a channel is not found or an incorrect
24922  * `counterparty_node_id` is provided.
24923  *
24924  * Returns [`APIMisuseError`] when a [`cltv_expiry_delta`] update is to be applied with a value
24925  * below [`MIN_CLTV_EXPIRY_DELTA`].
24926  *
24927  * If an error is returned, none of the updates should be considered applied.
24928  *
24929  * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths
24930  * [`forwarding_fee_base_msat`]: ChannelConfig::forwarding_fee_base_msat
24931  * [`cltv_expiry_delta`]: ChannelConfig::cltv_expiry_delta
24932  * [`BroadcastChannelUpdate`]: events::MessageSendEvent::BroadcastChannelUpdate
24933  * [`ChannelUpdate`]: msgs::ChannelUpdate
24934  * [`ChannelUnavailable`]: APIError::ChannelUnavailable
24935  * [`APIMisuseError`]: APIError::APIMisuseError
24936  */
24937 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_update_channel_config(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKPublicKey counterparty_node_id, struct LDKCVec_ThirtyTwoBytesZ channel_ids, const struct LDKChannelConfig *NONNULL_PTR config);
24938
24939 /**
24940  * Attempts to forward an intercepted HTLC over the provided channel id and with the provided
24941  * amount to forward. Should only be called in response to an [`HTLCIntercepted`] event.
24942  *
24943  * Intercepted HTLCs can be useful for Lightning Service Providers (LSPs) to open a just-in-time
24944  * channel to a receiving node if the node lacks sufficient inbound liquidity.
24945  *
24946  * To make use of intercepted HTLCs, set [`UserConfig::accept_intercept_htlcs`] and use
24947  * [`ChannelManager::get_intercept_scid`] to generate short channel id(s) to put in the
24948  * receiver's invoice route hints. These route hints will signal to LDK to generate an
24949  * [`HTLCIntercepted`] event when it receives the forwarded HTLC, and this method or
24950  * [`ChannelManager::fail_intercepted_htlc`] MUST be called in response to the event.
24951  *
24952  * Note that LDK does not enforce fee requirements in `amt_to_forward_msat`, and will not stop
24953  * you from forwarding more than you received.
24954  *
24955  * Errors if the event was not handled in time, in which case the HTLC was automatically failed
24956  * backwards.
24957  *
24958  * [`UserConfig::accept_intercept_htlcs`]: crate::util::config::UserConfig::accept_intercept_htlcs
24959  * [`HTLCIntercepted`]: events::Event::HTLCIntercepted
24960  */
24961 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_forward_intercepted_htlc(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes intercept_id, const uint8_t (*next_hop_channel_id)[32], struct LDKPublicKey next_node_id, uint64_t amt_to_forward_msat);
24962
24963 /**
24964  * Fails the intercepted HTLC indicated by intercept_id. Should only be called in response to
24965  * an [`HTLCIntercepted`] event. See [`ChannelManager::forward_intercepted_htlc`].
24966  *
24967  * Errors if the event was not handled in time, in which case the HTLC was automatically failed
24968  * backwards.
24969  *
24970  * [`HTLCIntercepted`]: events::Event::HTLCIntercepted
24971  */
24972 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_fail_intercepted_htlc(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes intercept_id);
24973
24974 /**
24975  * Processes HTLCs which are pending waiting on random forward delay.
24976  *
24977  * Should only really ever be called in response to a PendingHTLCsForwardable event.
24978  * Will likely generate further events.
24979  */
24980 void ChannelManager_process_pending_htlc_forwards(const struct LDKChannelManager *NONNULL_PTR this_arg);
24981
24982 /**
24983  * Performs actions which should happen on startup and roughly once per minute thereafter.
24984  *
24985  * This currently includes:
24986  *  * Increasing or decreasing the on-chain feerate estimates for our outbound channels,
24987  *  * Broadcasting [`ChannelUpdate`] messages if we've been disconnected from our peer for more
24988  *    than a minute, informing the network that they should no longer attempt to route over
24989  *    the channel.
24990  *  * Expiring a channel's previous [`ChannelConfig`] if necessary to only allow forwarding HTLCs
24991  *    with the current [`ChannelConfig`].
24992  *  * Removing peers which have disconnected but and no longer have any channels.
24993  *
24994  * Note that this may cause reentrancy through [`chain::Watch::update_channel`] calls or feerate
24995  * estimate fetches.
24996  *
24997  * [`ChannelUpdate`]: msgs::ChannelUpdate
24998  * [`ChannelConfig`]: crate::util::config::ChannelConfig
24999  */
25000 void ChannelManager_timer_tick_occurred(const struct LDKChannelManager *NONNULL_PTR this_arg);
25001
25002 /**
25003  * Indicates that the preimage for payment_hash is unknown or the received amount is incorrect
25004  * after a PaymentClaimable event, failing the HTLC back to its origin and freeing resources
25005  * along the path (including in our own channel on which we received it).
25006  *
25007  * Note that in some cases around unclean shutdown, it is possible the payment may have
25008  * already been claimed by you via [`ChannelManager::claim_funds`] prior to you seeing (a
25009  * second copy of) the [`events::Event::PaymentClaimable`] event. Alternatively, the payment
25010  * may have already been failed automatically by LDK if it was nearing its expiration time.
25011  *
25012  * While LDK will never claim a payment automatically on your behalf (i.e. without you calling
25013  * [`ChannelManager::claim_funds`]), you should still monitor for
25014  * [`events::Event::PaymentClaimed`] events even for payments you intend to fail, especially on
25015  * startup during which time claims that were in-progress at shutdown may be replayed.
25016  */
25017 void ChannelManager_fail_htlc_backwards(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32]);
25018
25019 /**
25020  * This is a variant of [`ChannelManager::fail_htlc_backwards`] that allows you to specify the
25021  * reason for the failure.
25022  *
25023  * See [`FailureCode`] for valid failure codes.
25024  */
25025 void ChannelManager_fail_htlc_backwards_with_reason(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32], enum LDKFailureCode failure_code);
25026
25027 /**
25028  * Provides a payment preimage in response to [`Event::PaymentClaimable`], generating any
25029  * [`MessageSendEvent`]s needed to claim the payment.
25030  *
25031  * This method is guaranteed to ensure the payment has been claimed but only if the current
25032  * height is strictly below [`Event::PaymentClaimable::claim_deadline`]. To avoid race
25033  * conditions, you should wait for an [`Event::PaymentClaimed`] before considering the payment
25034  * successful. It will generally be available in the next [`process_pending_events`] call.
25035  *
25036  * Note that if you did not set an `amount_msat` when calling [`create_inbound_payment`] or
25037  * [`create_inbound_payment_for_hash`] you must check that the amount in the `PaymentClaimable`
25038  * event matches your expectation. If you fail to do so and call this method, you may provide
25039  * the sender \"proof-of-payment\" when they did not fulfill the full expected payment.
25040  *
25041  * [`Event::PaymentClaimable`]: crate::events::Event::PaymentClaimable
25042  * [`Event::PaymentClaimable::claim_deadline`]: crate::events::Event::PaymentClaimable::claim_deadline
25043  * [`Event::PaymentClaimed`]: crate::events::Event::PaymentClaimed
25044  * [`process_pending_events`]: EventsProvider::process_pending_events
25045  * [`create_inbound_payment`]: Self::create_inbound_payment
25046  * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
25047  */
25048 void ChannelManager_claim_funds(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_preimage);
25049
25050 /**
25051  * Gets the node_id held by this ChannelManager
25052  */
25053 MUST_USE_RES struct LDKPublicKey ChannelManager_get_our_node_id(const struct LDKChannelManager *NONNULL_PTR this_arg);
25054
25055 /**
25056  * Accepts a request to open a channel after a [`Event::OpenChannelRequest`].
25057  *
25058  * The `temporary_channel_id` parameter indicates which inbound channel should be accepted,
25059  * and the `counterparty_node_id` parameter is the id of the peer which has requested to open
25060  * the channel.
25061  *
25062  * The `user_channel_id` parameter will be provided back in
25063  * [`Event::ChannelClosed::user_channel_id`] to allow tracking of which events correspond
25064  * with which `accept_inbound_channel`/`accept_inbound_channel_from_trusted_peer_0conf` call.
25065  *
25066  * Note that this method will return an error and reject the channel, if it requires support
25067  * for zero confirmations. Instead, `accept_inbound_channel_from_trusted_peer_0conf` must be
25068  * used to accept such channels.
25069  *
25070  * [`Event::OpenChannelRequest`]: events::Event::OpenChannelRequest
25071  * [`Event::ChannelClosed::user_channel_id`]: events::Event::ChannelClosed::user_channel_id
25072  */
25073 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_accept_inbound_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*temporary_channel_id)[32], struct LDKPublicKey counterparty_node_id, struct LDKU128 user_channel_id);
25074
25075 /**
25076  * Accepts a request to open a channel after a [`events::Event::OpenChannelRequest`], treating
25077  * it as confirmed immediately.
25078  *
25079  * The `user_channel_id` parameter will be provided back in
25080  * [`Event::ChannelClosed::user_channel_id`] to allow tracking of which events correspond
25081  * with which `accept_inbound_channel`/`accept_inbound_channel_from_trusted_peer_0conf` call.
25082  *
25083  * Unlike [`ChannelManager::accept_inbound_channel`], this method accepts the incoming channel
25084  * and (if the counterparty agrees), enables forwarding of payments immediately.
25085  *
25086  * This fully trusts that the counterparty has honestly and correctly constructed the funding
25087  * transaction and blindly assumes that it will eventually confirm.
25088  *
25089  * If it does not confirm before we decide to close the channel, or if the funding transaction
25090  * does not pay to the correct script the correct amount, *you will lose funds*.
25091  *
25092  * [`Event::OpenChannelRequest`]: events::Event::OpenChannelRequest
25093  * [`Event::ChannelClosed::user_channel_id`]: events::Event::ChannelClosed::user_channel_id
25094  */
25095 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_accept_inbound_channel_from_trusted_peer_0conf(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*temporary_channel_id)[32], struct LDKPublicKey counterparty_node_id, struct LDKU128 user_channel_id);
25096
25097 /**
25098  * Gets a payment secret and payment hash for use in an invoice given to a third party wishing
25099  * to pay us.
25100  *
25101  * This differs from [`create_inbound_payment_for_hash`] only in that it generates the
25102  * [`PaymentHash`] and [`PaymentPreimage`] for you.
25103  *
25104  * The [`PaymentPreimage`] will ultimately be returned to you in the [`PaymentClaimable`], which
25105  * will have the [`PaymentClaimable::purpose`] be [`PaymentPurpose::InvoicePayment`] with
25106  * its [`PaymentPurpose::InvoicePayment::payment_preimage`] field filled in. That should then be
25107  * passed directly to [`claim_funds`].
25108  *
25109  * See [`create_inbound_payment_for_hash`] for detailed documentation on behavior and requirements.
25110  *
25111  * Note that a malicious eavesdropper can intuit whether an inbound payment was created by
25112  * `create_inbound_payment` or `create_inbound_payment_for_hash` based on runtime.
25113  *
25114  * # Note
25115  *
25116  * If you register an inbound payment with this method, then serialize the `ChannelManager`, then
25117  * deserialize it with a node running 0.0.103 and earlier, the payment will fail to be received.
25118  *
25119  * Errors if `min_value_msat` is greater than total bitcoin supply.
25120  *
25121  * If `min_final_cltv_expiry_delta` is set to some value, then the payment will not be receivable
25122  * on versions of LDK prior to 0.0.114.
25123  *
25124  * [`claim_funds`]: Self::claim_funds
25125  * [`PaymentClaimable`]: events::Event::PaymentClaimable
25126  * [`PaymentClaimable::purpose`]: events::Event::PaymentClaimable::purpose
25127  * [`PaymentPurpose::InvoicePayment`]: events::PaymentPurpose::InvoicePayment
25128  * [`PaymentPurpose::InvoicePayment::payment_preimage`]: events::PaymentPurpose::InvoicePayment::payment_preimage
25129  * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
25130  */
25131 MUST_USE_RES struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ ChannelManager_create_inbound_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKCOption_u64Z min_value_msat, uint32_t invoice_expiry_delta_secs, struct LDKCOption_u16Z min_final_cltv_expiry_delta);
25132
25133 /**
25134  * Legacy version of [`create_inbound_payment`]. Use this method if you wish to share
25135  * serialized state with LDK node(s) running 0.0.103 and earlier.
25136  *
25137  * May panic if `invoice_expiry_delta_secs` is greater than one year.
25138  *
25139  * # Note
25140  * This method is deprecated and will be removed soon.
25141  *
25142  * [`create_inbound_payment`]: Self::create_inbound_payment
25143  */
25144 MUST_USE_RES struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ ChannelManager_create_inbound_payment_legacy(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKCOption_u64Z min_value_msat, uint32_t invoice_expiry_delta_secs);
25145
25146 /**
25147  * Gets a [`PaymentSecret`] for a given [`PaymentHash`], for which the payment preimage is
25148  * stored external to LDK.
25149  *
25150  * A [`PaymentClaimable`] event will only be generated if the [`PaymentSecret`] matches a
25151  * payment secret fetched via this method or [`create_inbound_payment`], and which is at least
25152  * the `min_value_msat` provided here, if one is provided.
25153  *
25154  * The [`PaymentHash`] (and corresponding [`PaymentPreimage`]) should be globally unique, though
25155  * note that LDK will not stop you from registering duplicate payment hashes for inbound
25156  * payments.
25157  *
25158  * `min_value_msat` should be set if the invoice being generated contains a value. Any payment
25159  * received for the returned [`PaymentHash`] will be required to be at least `min_value_msat`
25160  * before a [`PaymentClaimable`] event will be generated, ensuring that we do not provide the
25161  * sender \"proof-of-payment\" unless they have paid the required amount.
25162  *
25163  * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
25164  * in excess of the current time. This should roughly match the expiry time set in the invoice.
25165  * After this many seconds, we will remove the inbound payment, resulting in any attempts to
25166  * pay the invoice failing. The BOLT spec suggests 3,600 secs as a default validity time for
25167  * invoices when no timeout is set.
25168  *
25169  * Note that we use block header time to time-out pending inbound payments (with some margin
25170  * to compensate for the inaccuracy of block header timestamps). Thus, in practice we will
25171  * accept a payment and generate a [`PaymentClaimable`] event for some time after the expiry.
25172  * If you need exact expiry semantics, you should enforce them upon receipt of
25173  * [`PaymentClaimable`].
25174  *
25175  * Note that invoices generated for inbound payments should have their `min_final_cltv_expiry_delta`
25176  * set to at least [`MIN_FINAL_CLTV_EXPIRY_DELTA`].
25177  *
25178  * Note that a malicious eavesdropper can intuit whether an inbound payment was created by
25179  * `create_inbound_payment` or `create_inbound_payment_for_hash` based on runtime.
25180  *
25181  * # Note
25182  *
25183  * If you register an inbound payment with this method, then serialize the `ChannelManager`, then
25184  * deserialize it with a node running 0.0.103 and earlier, the payment will fail to be received.
25185  *
25186  * Errors if `min_value_msat` is greater than total bitcoin supply.
25187  *
25188  * If `min_final_cltv_expiry_delta` is set to some value, then the payment will not be receivable
25189  * on versions of LDK prior to 0.0.114.
25190  *
25191  * [`create_inbound_payment`]: Self::create_inbound_payment
25192  * [`PaymentClaimable`]: events::Event::PaymentClaimable
25193  */
25194 MUST_USE_RES struct LDKCResult_PaymentSecretNoneZ ChannelManager_create_inbound_payment_for_hash(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_hash, struct LDKCOption_u64Z min_value_msat, uint32_t invoice_expiry_delta_secs, struct LDKCOption_u16Z min_final_cltv_expiry);
25195
25196 /**
25197  * Legacy version of [`create_inbound_payment_for_hash`]. Use this method if you wish to share
25198  * serialized state with LDK node(s) running 0.0.103 and earlier.
25199  *
25200  * May panic if `invoice_expiry_delta_secs` is greater than one year.
25201  *
25202  * # Note
25203  * This method is deprecated and will be removed soon.
25204  *
25205  * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
25206  */
25207 MUST_USE_RES struct LDKCResult_PaymentSecretAPIErrorZ ChannelManager_create_inbound_payment_for_hash_legacy(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_hash, struct LDKCOption_u64Z min_value_msat, uint32_t invoice_expiry_delta_secs);
25208
25209 /**
25210  * Gets an LDK-generated payment preimage from a payment hash and payment secret that were
25211  * previously returned from [`create_inbound_payment`].
25212  *
25213  * [`create_inbound_payment`]: Self::create_inbound_payment
25214  */
25215 MUST_USE_RES struct LDKCResult_PaymentPreimageAPIErrorZ ChannelManager_get_payment_preimage(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret);
25216
25217 /**
25218  * Gets a fake short channel id for use in receiving [phantom node payments]. These fake scids
25219  * are used when constructing the phantom invoice's route hints.
25220  *
25221  * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager
25222  */
25223 MUST_USE_RES uint64_t ChannelManager_get_phantom_scid(const struct LDKChannelManager *NONNULL_PTR this_arg);
25224
25225 /**
25226  * Gets route hints for use in receiving [phantom node payments].
25227  *
25228  * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager
25229  */
25230 MUST_USE_RES struct LDKPhantomRouteHints ChannelManager_get_phantom_route_hints(const struct LDKChannelManager *NONNULL_PTR this_arg);
25231
25232 /**
25233  * Gets a fake short channel id for use in receiving intercepted payments. These fake scids are
25234  * used when constructing the route hints for HTLCs intended to be intercepted. See
25235  * [`ChannelManager::forward_intercepted_htlc`].
25236  *
25237  * Note that this method is not guaranteed to return unique values, you may need to call it a few
25238  * times to get a unique scid.
25239  */
25240 MUST_USE_RES uint64_t ChannelManager_get_intercept_scid(const struct LDKChannelManager *NONNULL_PTR this_arg);
25241
25242 /**
25243  * Gets inflight HTLC information by processing pending outbound payments that are in
25244  * our channels. May be used during pathfinding to account for in-use channel liquidity.
25245  */
25246 MUST_USE_RES struct LDKInFlightHtlcs ChannelManager_compute_inflight_htlcs(const struct LDKChannelManager *NONNULL_PTR this_arg);
25247
25248 /**
25249  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
25250  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
25251  */
25252 struct LDKMessageSendEventsProvider ChannelManager_as_MessageSendEventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
25253
25254 /**
25255  * Constructs a new EventsProvider which calls the relevant methods on this_arg.
25256  * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is
25257  */
25258 struct LDKEventsProvider ChannelManager_as_EventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
25259
25260 /**
25261  * Constructs a new Listen which calls the relevant methods on this_arg.
25262  * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is
25263  */
25264 struct LDKListen ChannelManager_as_Listen(const struct LDKChannelManager *NONNULL_PTR this_arg);
25265
25266 /**
25267  * Constructs a new Confirm which calls the relevant methods on this_arg.
25268  * This copies the `inner` pointer in this_arg and thus the returned Confirm must be freed before this_arg is
25269  */
25270 struct LDKConfirm ChannelManager_as_Confirm(const struct LDKChannelManager *NONNULL_PTR this_arg);
25271
25272 /**
25273  * Gets a [`Future`] that completes when this [`ChannelManager`] needs to be persisted.
25274  *
25275  * Note that callbacks registered on the [`Future`] MUST NOT call back into this
25276  * [`ChannelManager`] and should instead register actions to be taken later.
25277  *
25278  */
25279 MUST_USE_RES struct LDKFuture ChannelManager_get_persistable_update_future(const struct LDKChannelManager *NONNULL_PTR this_arg);
25280
25281 /**
25282  * Gets the latest best block which was connected either via the [`chain::Listen`] or
25283  * [`chain::Confirm`] interfaces.
25284  */
25285 MUST_USE_RES struct LDKBestBlock ChannelManager_current_best_block(const struct LDKChannelManager *NONNULL_PTR this_arg);
25286
25287 /**
25288  * Fetches the set of [`NodeFeatures`] flags which are provided by or required by
25289  * [`ChannelManager`].
25290  */
25291 MUST_USE_RES struct LDKNodeFeatures ChannelManager_node_features(const struct LDKChannelManager *NONNULL_PTR this_arg);
25292
25293 /**
25294  * Fetches the set of [`ChannelFeatures`] flags which are provided by or required by
25295  * [`ChannelManager`].
25296  */
25297 MUST_USE_RES struct LDKChannelFeatures ChannelManager_channel_features(const struct LDKChannelManager *NONNULL_PTR this_arg);
25298
25299 /**
25300  * Fetches the set of [`ChannelTypeFeatures`] flags which are provided by or required by
25301  * [`ChannelManager`].
25302  */
25303 MUST_USE_RES struct LDKChannelTypeFeatures ChannelManager_channel_type_features(const struct LDKChannelManager *NONNULL_PTR this_arg);
25304
25305 /**
25306  * Fetches the set of [`InitFeatures`] flags which are provided by or required by
25307  * [`ChannelManager`].
25308  */
25309 MUST_USE_RES struct LDKInitFeatures ChannelManager_init_features(const struct LDKChannelManager *NONNULL_PTR this_arg);
25310
25311 /**
25312  * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg.
25313  * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is
25314  */
25315 struct LDKChannelMessageHandler ChannelManager_as_ChannelMessageHandler(const struct LDKChannelManager *NONNULL_PTR this_arg);
25316
25317 /**
25318  * Fetches the set of [`InitFeatures`] flags which are provided by or required by
25319  * [`ChannelManager`].
25320  */
25321 struct LDKInitFeatures provided_init_features(const struct LDKUserConfig *NONNULL_PTR _config);
25322
25323 /**
25324  * Serialize the CounterpartyForwardingInfo object into a byte array which can be read by CounterpartyForwardingInfo_read
25325  */
25326 struct LDKCVec_u8Z CounterpartyForwardingInfo_write(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR obj);
25327
25328 /**
25329  * Read a CounterpartyForwardingInfo from a byte array, created by CounterpartyForwardingInfo_write
25330  */
25331 struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CounterpartyForwardingInfo_read(struct LDKu8slice ser);
25332
25333 /**
25334  * Serialize the ChannelCounterparty object into a byte array which can be read by ChannelCounterparty_read
25335  */
25336 struct LDKCVec_u8Z ChannelCounterparty_write(const struct LDKChannelCounterparty *NONNULL_PTR obj);
25337
25338 /**
25339  * Read a ChannelCounterparty from a byte array, created by ChannelCounterparty_write
25340  */
25341 struct LDKCResult_ChannelCounterpartyDecodeErrorZ ChannelCounterparty_read(struct LDKu8slice ser);
25342
25343 /**
25344  * Serialize the ChannelDetails object into a byte array which can be read by ChannelDetails_read
25345  */
25346 struct LDKCVec_u8Z ChannelDetails_write(const struct LDKChannelDetails *NONNULL_PTR obj);
25347
25348 /**
25349  * Read a ChannelDetails from a byte array, created by ChannelDetails_write
25350  */
25351 struct LDKCResult_ChannelDetailsDecodeErrorZ ChannelDetails_read(struct LDKu8slice ser);
25352
25353 /**
25354  * Serialize the PhantomRouteHints object into a byte array which can be read by PhantomRouteHints_read
25355  */
25356 struct LDKCVec_u8Z PhantomRouteHints_write(const struct LDKPhantomRouteHints *NONNULL_PTR obj);
25357
25358 /**
25359  * Read a PhantomRouteHints from a byte array, created by PhantomRouteHints_write
25360  */
25361 struct LDKCResult_PhantomRouteHintsDecodeErrorZ PhantomRouteHints_read(struct LDKu8slice ser);
25362
25363 /**
25364  * Serialize the ChannelManager object into a byte array which can be read by ChannelManager_read
25365  */
25366 struct LDKCVec_u8Z ChannelManager_write(const struct LDKChannelManager *NONNULL_PTR obj);
25367
25368 /**
25369  * Frees any resources used by the ChannelManagerReadArgs, if is_owned is set and inner is non-NULL.
25370  */
25371 void ChannelManagerReadArgs_free(struct LDKChannelManagerReadArgs this_obj);
25372
25373 /**
25374  * A cryptographically secure source of entropy.
25375  */
25376 const struct LDKEntropySource *ChannelManagerReadArgs_get_entropy_source(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
25377
25378 /**
25379  * A cryptographically secure source of entropy.
25380  */
25381 void ChannelManagerReadArgs_set_entropy_source(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKEntropySource val);
25382
25383 /**
25384  * A signer that is able to perform node-scoped cryptographic operations.
25385  */
25386 const struct LDKNodeSigner *ChannelManagerReadArgs_get_node_signer(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
25387
25388 /**
25389  * A signer that is able to perform node-scoped cryptographic operations.
25390  */
25391 void ChannelManagerReadArgs_set_node_signer(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKNodeSigner val);
25392
25393 /**
25394  * The keys provider which will give us relevant keys. Some keys will be loaded during
25395  * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
25396  * signing data.
25397  */
25398 const struct LDKSignerProvider *ChannelManagerReadArgs_get_signer_provider(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
25399
25400 /**
25401  * The keys provider which will give us relevant keys. Some keys will be loaded during
25402  * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
25403  * signing data.
25404  */
25405 void ChannelManagerReadArgs_set_signer_provider(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKSignerProvider val);
25406
25407 /**
25408  * The fee_estimator for use in the ChannelManager in the future.
25409  *
25410  * No calls to the FeeEstimator will be made during deserialization.
25411  */
25412 const struct LDKFeeEstimator *ChannelManagerReadArgs_get_fee_estimator(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
25413
25414 /**
25415  * The fee_estimator for use in the ChannelManager in the future.
25416  *
25417  * No calls to the FeeEstimator will be made during deserialization.
25418  */
25419 void ChannelManagerReadArgs_set_fee_estimator(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKFeeEstimator val);
25420
25421 /**
25422  * The chain::Watch for use in the ChannelManager in the future.
25423  *
25424  * No calls to the chain::Watch will be made during deserialization. It is assumed that
25425  * you have deserialized ChannelMonitors separately and will add them to your
25426  * chain::Watch after deserializing this ChannelManager.
25427  */
25428 const struct LDKWatch *ChannelManagerReadArgs_get_chain_monitor(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
25429
25430 /**
25431  * The chain::Watch for use in the ChannelManager in the future.
25432  *
25433  * No calls to the chain::Watch will be made during deserialization. It is assumed that
25434  * you have deserialized ChannelMonitors separately and will add them to your
25435  * chain::Watch after deserializing this ChannelManager.
25436  */
25437 void ChannelManagerReadArgs_set_chain_monitor(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKWatch val);
25438
25439 /**
25440  * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
25441  * used to broadcast the latest local commitment transactions of channels which must be
25442  * force-closed during deserialization.
25443  */
25444 const struct LDKBroadcasterInterface *ChannelManagerReadArgs_get_tx_broadcaster(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
25445
25446 /**
25447  * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
25448  * used to broadcast the latest local commitment transactions of channels which must be
25449  * force-closed during deserialization.
25450  */
25451 void ChannelManagerReadArgs_set_tx_broadcaster(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKBroadcasterInterface val);
25452
25453 /**
25454  * The router which will be used in the ChannelManager in the future for finding routes
25455  * on-the-fly for trampoline payments. Absent in private nodes that don't support forwarding.
25456  *
25457  * No calls to the router will be made during deserialization.
25458  */
25459 const struct LDKRouter *ChannelManagerReadArgs_get_router(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
25460
25461 /**
25462  * The router which will be used in the ChannelManager in the future for finding routes
25463  * on-the-fly for trampoline payments. Absent in private nodes that don't support forwarding.
25464  *
25465  * No calls to the router will be made during deserialization.
25466  */
25467 void ChannelManagerReadArgs_set_router(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKRouter val);
25468
25469 /**
25470  * The Logger for use in the ChannelManager and which may be used to log information during
25471  * deserialization.
25472  */
25473 const struct LDKLogger *ChannelManagerReadArgs_get_logger(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
25474
25475 /**
25476  * The Logger for use in the ChannelManager and which may be used to log information during
25477  * deserialization.
25478  */
25479 void ChannelManagerReadArgs_set_logger(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKLogger val);
25480
25481 /**
25482  * Default settings used for new channels. Any existing channels will continue to use the
25483  * runtime settings which were stored when the ChannelManager was serialized.
25484  */
25485 struct LDKUserConfig ChannelManagerReadArgs_get_default_config(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
25486
25487 /**
25488  * Default settings used for new channels. Any existing channels will continue to use the
25489  * runtime settings which were stored when the ChannelManager was serialized.
25490  */
25491 void ChannelManagerReadArgs_set_default_config(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKUserConfig val);
25492
25493 /**
25494  * Simple utility function to create a ChannelManagerReadArgs which creates the monitor
25495  * HashMap for you. This is primarily useful for C bindings where it is not practical to
25496  * populate a HashMap directly from C.
25497  */
25498 MUST_USE_RES struct LDKChannelManagerReadArgs ChannelManagerReadArgs_new(struct LDKEntropySource entropy_source, struct LDKNodeSigner node_signer, struct LDKSignerProvider signer_provider, struct LDKFeeEstimator fee_estimator, struct LDKWatch chain_monitor, struct LDKBroadcasterInterface tx_broadcaster, struct LDKRouter router, struct LDKLogger logger, struct LDKUserConfig default_config, struct LDKCVec_ChannelMonitorZ channel_monitors);
25499
25500 /**
25501  * Read a C2Tuple_BlockHashChannelManagerZ from a byte array, created by C2Tuple_BlockHashChannelManagerZ_write
25502  */
25503 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ C2Tuple_BlockHashChannelManagerZ_read(struct LDKu8slice ser, struct LDKChannelManagerReadArgs arg);
25504
25505 /**
25506  * Frees any resources used by the ExpandedKey, if is_owned is set and inner is non-NULL.
25507  */
25508 void ExpandedKey_free(struct LDKExpandedKey this_obj);
25509
25510 /**
25511  * Create a  new [`ExpandedKey`] for generating an inbound payment hash and secret.
25512  *
25513  * It is recommended to cache this value and not regenerate it for each new inbound payment.
25514  */
25515 MUST_USE_RES struct LDKExpandedKey ExpandedKey_new(const uint8_t (*key_material)[32]);
25516
25517 /**
25518  * Equivalent to [`crate::ln::channelmanager::ChannelManager::create_inbound_payment`], but no
25519  * `ChannelManager` is required. Useful for generating invoices for [phantom node payments] without
25520  * a `ChannelManager`.
25521  *
25522  * `keys` is generated by calling [`NodeSigner::get_inbound_payment_key_material`] and then
25523  * calling [`ExpandedKey::new`] with its result. It is recommended to cache this value and not
25524  * regenerate it for each new inbound payment.
25525  *
25526  * `current_time` is a Unix timestamp representing the current time.
25527  *
25528  * Note that if `min_final_cltv_expiry_delta` is set to some value, then the payment will not be receivable
25529  * on versions of LDK prior to 0.0.114.
25530  *
25531  * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager
25532  * [`NodeSigner::get_inbound_payment_key_material`]: crate::chain::keysinterface::NodeSigner::get_inbound_payment_key_material
25533  */
25534 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ create(const struct LDKExpandedKey *NONNULL_PTR keys, struct LDKCOption_u64Z min_value_msat, uint32_t invoice_expiry_delta_secs, const struct LDKEntropySource *NONNULL_PTR entropy_source, uint64_t current_time, struct LDKCOption_u16Z min_final_cltv_expiry_delta);
25535
25536 /**
25537  * Equivalent to [`crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash`],
25538  * but no `ChannelManager` is required. Useful for generating invoices for [phantom node payments]
25539  * without a `ChannelManager`.
25540  *
25541  * See [`create`] for information on the `keys` and `current_time` parameters.
25542  *
25543  * Note that if `min_final_cltv_expiry_delta` is set to some value, then the payment will not be receivable
25544  * on versions of LDK prior to 0.0.114.
25545  *
25546  * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager
25547  */
25548 struct LDKCResult_PaymentSecretNoneZ create_from_hash(const struct LDKExpandedKey *NONNULL_PTR keys, struct LDKCOption_u64Z min_value_msat, struct LDKThirtyTwoBytes payment_hash, uint32_t invoice_expiry_delta_secs, uint64_t current_time, struct LDKCOption_u16Z min_final_cltv_expiry_delta);
25549
25550 /**
25551  * Frees any resources used by the DecodeError
25552  */
25553 void DecodeError_free(struct LDKDecodeError this_ptr);
25554
25555 /**
25556  * Creates a copy of the DecodeError
25557  */
25558 struct LDKDecodeError DecodeError_clone(const struct LDKDecodeError *NONNULL_PTR orig);
25559
25560 /**
25561  * Utility method to constructs a new UnknownVersion-variant DecodeError
25562  */
25563 struct LDKDecodeError DecodeError_unknown_version(void);
25564
25565 /**
25566  * Utility method to constructs a new UnknownRequiredFeature-variant DecodeError
25567  */
25568 struct LDKDecodeError DecodeError_unknown_required_feature(void);
25569
25570 /**
25571  * Utility method to constructs a new InvalidValue-variant DecodeError
25572  */
25573 struct LDKDecodeError DecodeError_invalid_value(void);
25574
25575 /**
25576  * Utility method to constructs a new ShortRead-variant DecodeError
25577  */
25578 struct LDKDecodeError DecodeError_short_read(void);
25579
25580 /**
25581  * Utility method to constructs a new BadLengthDescriptor-variant DecodeError
25582  */
25583 struct LDKDecodeError DecodeError_bad_length_descriptor(void);
25584
25585 /**
25586  * Utility method to constructs a new Io-variant DecodeError
25587  */
25588 struct LDKDecodeError DecodeError_io(enum LDKIOError a);
25589
25590 /**
25591  * Utility method to constructs a new UnsupportedCompression-variant DecodeError
25592  */
25593 struct LDKDecodeError DecodeError_unsupported_compression(void);
25594
25595 /**
25596  * Checks if two DecodeErrors contain equal inner contents.
25597  * This ignores pointers and is_owned flags and looks at the values in fields.
25598  */
25599 bool DecodeError_eq(const struct LDKDecodeError *NONNULL_PTR a, const struct LDKDecodeError *NONNULL_PTR b);
25600
25601 /**
25602  * Frees any resources used by the Init, if is_owned is set and inner is non-NULL.
25603  */
25604 void Init_free(struct LDKInit this_obj);
25605
25606 /**
25607  * The relevant features which the sender supports.
25608  */
25609 struct LDKInitFeatures Init_get_features(const struct LDKInit *NONNULL_PTR this_ptr);
25610
25611 /**
25612  * The relevant features which the sender supports.
25613  */
25614 void Init_set_features(struct LDKInit *NONNULL_PTR this_ptr, struct LDKInitFeatures val);
25615
25616 /**
25617  * The receipient's network address.
25618  *
25619  * This adds the option to report a remote IP address back to a connecting peer using the init
25620  * message. A node can decide to use that information to discover a potential update to its
25621  * public IPv4 address (NAT) and use that for a [`NodeAnnouncement`] update message containing
25622  * the new address.
25623  */
25624 struct LDKCOption_NetAddressZ Init_get_remote_network_address(const struct LDKInit *NONNULL_PTR this_ptr);
25625
25626 /**
25627  * The receipient's network address.
25628  *
25629  * This adds the option to report a remote IP address back to a connecting peer using the init
25630  * message. A node can decide to use that information to discover a potential update to its
25631  * public IPv4 address (NAT) and use that for a [`NodeAnnouncement`] update message containing
25632  * the new address.
25633  */
25634 void Init_set_remote_network_address(struct LDKInit *NONNULL_PTR this_ptr, struct LDKCOption_NetAddressZ val);
25635
25636 /**
25637  * Constructs a new Init given each field
25638  */
25639 MUST_USE_RES struct LDKInit Init_new(struct LDKInitFeatures features_arg, struct LDKCOption_NetAddressZ remote_network_address_arg);
25640
25641 /**
25642  * Creates a copy of the Init
25643  */
25644 struct LDKInit Init_clone(const struct LDKInit *NONNULL_PTR orig);
25645
25646 /**
25647  * Checks if two Inits contain equal inner contents.
25648  * This ignores pointers and is_owned flags and looks at the values in fields.
25649  * Two objects with NULL inner values will be considered "equal" here.
25650  */
25651 bool Init_eq(const struct LDKInit *NONNULL_PTR a, const struct LDKInit *NONNULL_PTR b);
25652
25653 /**
25654  * Frees any resources used by the ErrorMessage, if is_owned is set and inner is non-NULL.
25655  */
25656 void ErrorMessage_free(struct LDKErrorMessage this_obj);
25657
25658 /**
25659  * The channel ID involved in the error.
25660  *
25661  * All-0s indicates a general error unrelated to a specific channel, after which all channels
25662  * with the sending peer should be closed.
25663  */
25664 const uint8_t (*ErrorMessage_get_channel_id(const struct LDKErrorMessage *NONNULL_PTR this_ptr))[32];
25665
25666 /**
25667  * The channel ID involved in the error.
25668  *
25669  * All-0s indicates a general error unrelated to a specific channel, after which all channels
25670  * with the sending peer should be closed.
25671  */
25672 void ErrorMessage_set_channel_id(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
25673
25674 /**
25675  * A possibly human-readable error description.
25676  *
25677  * The string should be sanitized before it is used (e.g., emitted to logs or printed to
25678  * `stdout`). Otherwise, a well crafted error message may trigger a security vulnerability in
25679  * the terminal emulator or the logging subsystem.
25680  */
25681 struct LDKStr ErrorMessage_get_data(const struct LDKErrorMessage *NONNULL_PTR this_ptr);
25682
25683 /**
25684  * A possibly human-readable error description.
25685  *
25686  * The string should be sanitized before it is used (e.g., emitted to logs or printed to
25687  * `stdout`). Otherwise, a well crafted error message may trigger a security vulnerability in
25688  * the terminal emulator or the logging subsystem.
25689  */
25690 void ErrorMessage_set_data(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKStr val);
25691
25692 /**
25693  * Constructs a new ErrorMessage given each field
25694  */
25695 MUST_USE_RES struct LDKErrorMessage ErrorMessage_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKStr data_arg);
25696
25697 /**
25698  * Creates a copy of the ErrorMessage
25699  */
25700 struct LDKErrorMessage ErrorMessage_clone(const struct LDKErrorMessage *NONNULL_PTR orig);
25701
25702 /**
25703  * Checks if two ErrorMessages contain equal inner contents.
25704  * This ignores pointers and is_owned flags and looks at the values in fields.
25705  * Two objects with NULL inner values will be considered "equal" here.
25706  */
25707 bool ErrorMessage_eq(const struct LDKErrorMessage *NONNULL_PTR a, const struct LDKErrorMessage *NONNULL_PTR b);
25708
25709 /**
25710  * Frees any resources used by the WarningMessage, if is_owned is set and inner is non-NULL.
25711  */
25712 void WarningMessage_free(struct LDKWarningMessage this_obj);
25713
25714 /**
25715  * The channel ID involved in the warning.
25716  *
25717  * All-0s indicates a warning unrelated to a specific channel.
25718  */
25719 const uint8_t (*WarningMessage_get_channel_id(const struct LDKWarningMessage *NONNULL_PTR this_ptr))[32];
25720
25721 /**
25722  * The channel ID involved in the warning.
25723  *
25724  * All-0s indicates a warning unrelated to a specific channel.
25725  */
25726 void WarningMessage_set_channel_id(struct LDKWarningMessage *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
25727
25728 /**
25729  * A possibly human-readable warning description.
25730  *
25731  * The string should be sanitized before it is used (e.g. emitted to logs or printed to
25732  * stdout). Otherwise, a well crafted error message may trigger a security vulnerability in
25733  * the terminal emulator or the logging subsystem.
25734  */
25735 struct LDKStr WarningMessage_get_data(const struct LDKWarningMessage *NONNULL_PTR this_ptr);
25736
25737 /**
25738  * A possibly human-readable warning description.
25739  *
25740  * The string should be sanitized before it is used (e.g. emitted to logs or printed to
25741  * stdout). Otherwise, a well crafted error message may trigger a security vulnerability in
25742  * the terminal emulator or the logging subsystem.
25743  */
25744 void WarningMessage_set_data(struct LDKWarningMessage *NONNULL_PTR this_ptr, struct LDKStr val);
25745
25746 /**
25747  * Constructs a new WarningMessage given each field
25748  */
25749 MUST_USE_RES struct LDKWarningMessage WarningMessage_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKStr data_arg);
25750
25751 /**
25752  * Creates a copy of the WarningMessage
25753  */
25754 struct LDKWarningMessage WarningMessage_clone(const struct LDKWarningMessage *NONNULL_PTR orig);
25755
25756 /**
25757  * Checks if two WarningMessages contain equal inner contents.
25758  * This ignores pointers and is_owned flags and looks at the values in fields.
25759  * Two objects with NULL inner values will be considered "equal" here.
25760  */
25761 bool WarningMessage_eq(const struct LDKWarningMessage *NONNULL_PTR a, const struct LDKWarningMessage *NONNULL_PTR b);
25762
25763 /**
25764  * Frees any resources used by the Ping, if is_owned is set and inner is non-NULL.
25765  */
25766 void Ping_free(struct LDKPing this_obj);
25767
25768 /**
25769  * The desired response length.
25770  */
25771 uint16_t Ping_get_ponglen(const struct LDKPing *NONNULL_PTR this_ptr);
25772
25773 /**
25774  * The desired response length.
25775  */
25776 void Ping_set_ponglen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
25777
25778 /**
25779  * The ping packet size.
25780  *
25781  * This field is not sent on the wire. byteslen zeros are sent.
25782  */
25783 uint16_t Ping_get_byteslen(const struct LDKPing *NONNULL_PTR this_ptr);
25784
25785 /**
25786  * The ping packet size.
25787  *
25788  * This field is not sent on the wire. byteslen zeros are sent.
25789  */
25790 void Ping_set_byteslen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
25791
25792 /**
25793  * Constructs a new Ping given each field
25794  */
25795 MUST_USE_RES struct LDKPing Ping_new(uint16_t ponglen_arg, uint16_t byteslen_arg);
25796
25797 /**
25798  * Creates a copy of the Ping
25799  */
25800 struct LDKPing Ping_clone(const struct LDKPing *NONNULL_PTR orig);
25801
25802 /**
25803  * Checks if two Pings contain equal inner contents.
25804  * This ignores pointers and is_owned flags and looks at the values in fields.
25805  * Two objects with NULL inner values will be considered "equal" here.
25806  */
25807 bool Ping_eq(const struct LDKPing *NONNULL_PTR a, const struct LDKPing *NONNULL_PTR b);
25808
25809 /**
25810  * Frees any resources used by the Pong, if is_owned is set and inner is non-NULL.
25811  */
25812 void Pong_free(struct LDKPong this_obj);
25813
25814 /**
25815  * The pong packet size.
25816  *
25817  * This field is not sent on the wire. byteslen zeros are sent.
25818  */
25819 uint16_t Pong_get_byteslen(const struct LDKPong *NONNULL_PTR this_ptr);
25820
25821 /**
25822  * The pong packet size.
25823  *
25824  * This field is not sent on the wire. byteslen zeros are sent.
25825  */
25826 void Pong_set_byteslen(struct LDKPong *NONNULL_PTR this_ptr, uint16_t val);
25827
25828 /**
25829  * Constructs a new Pong given each field
25830  */
25831 MUST_USE_RES struct LDKPong Pong_new(uint16_t byteslen_arg);
25832
25833 /**
25834  * Creates a copy of the Pong
25835  */
25836 struct LDKPong Pong_clone(const struct LDKPong *NONNULL_PTR orig);
25837
25838 /**
25839  * Checks if two Pongs contain equal inner contents.
25840  * This ignores pointers and is_owned flags and looks at the values in fields.
25841  * Two objects with NULL inner values will be considered "equal" here.
25842  */
25843 bool Pong_eq(const struct LDKPong *NONNULL_PTR a, const struct LDKPong *NONNULL_PTR b);
25844
25845 /**
25846  * Frees any resources used by the OpenChannel, if is_owned is set and inner is non-NULL.
25847  */
25848 void OpenChannel_free(struct LDKOpenChannel this_obj);
25849
25850 /**
25851  * The genesis hash of the blockchain where the channel is to be opened
25852  */
25853 const uint8_t (*OpenChannel_get_chain_hash(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32];
25854
25855 /**
25856  * The genesis hash of the blockchain where the channel is to be opened
25857  */
25858 void OpenChannel_set_chain_hash(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
25859
25860 /**
25861  * A temporary channel ID, until the funding outpoint is announced
25862  */
25863 const uint8_t (*OpenChannel_get_temporary_channel_id(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32];
25864
25865 /**
25866  * A temporary channel ID, until the funding outpoint is announced
25867  */
25868 void OpenChannel_set_temporary_channel_id(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
25869
25870 /**
25871  * The channel value
25872  */
25873 uint64_t OpenChannel_get_funding_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
25874
25875 /**
25876  * The channel value
25877  */
25878 void OpenChannel_set_funding_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
25879
25880 /**
25881  * The amount to push to the counterparty as part of the open, in milli-satoshi
25882  */
25883 uint64_t OpenChannel_get_push_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
25884
25885 /**
25886  * The amount to push to the counterparty as part of the open, in milli-satoshi
25887  */
25888 void OpenChannel_set_push_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
25889
25890 /**
25891  * The threshold below which outputs on transactions broadcast by sender will be omitted
25892  */
25893 uint64_t OpenChannel_get_dust_limit_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
25894
25895 /**
25896  * The threshold below which outputs on transactions broadcast by sender will be omitted
25897  */
25898 void OpenChannel_set_dust_limit_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
25899
25900 /**
25901  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
25902  */
25903 uint64_t OpenChannel_get_max_htlc_value_in_flight_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
25904
25905 /**
25906  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
25907  */
25908 void OpenChannel_set_max_htlc_value_in_flight_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
25909
25910 /**
25911  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
25912  */
25913 uint64_t OpenChannel_get_channel_reserve_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
25914
25915 /**
25916  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
25917  */
25918 void OpenChannel_set_channel_reserve_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
25919
25920 /**
25921  * The minimum HTLC size incoming to sender, in milli-satoshi
25922  */
25923 uint64_t OpenChannel_get_htlc_minimum_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
25924
25925 /**
25926  * The minimum HTLC size incoming to sender, in milli-satoshi
25927  */
25928 void OpenChannel_set_htlc_minimum_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
25929
25930 /**
25931  * The feerate per 1000-weight of sender generated transactions, until updated by
25932  * [`UpdateFee`]
25933  */
25934 uint32_t OpenChannel_get_feerate_per_kw(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
25935
25936 /**
25937  * The feerate per 1000-weight of sender generated transactions, until updated by
25938  * [`UpdateFee`]
25939  */
25940 void OpenChannel_set_feerate_per_kw(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint32_t val);
25941
25942 /**
25943  * The number of blocks which the counterparty will have to wait to claim on-chain funds if
25944  * they broadcast a commitment transaction
25945  */
25946 uint16_t OpenChannel_get_to_self_delay(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
25947
25948 /**
25949  * The number of blocks which the counterparty will have to wait to claim on-chain funds if
25950  * they broadcast a commitment transaction
25951  */
25952 void OpenChannel_set_to_self_delay(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val);
25953
25954 /**
25955  * The maximum number of inbound HTLCs towards sender
25956  */
25957 uint16_t OpenChannel_get_max_accepted_htlcs(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
25958
25959 /**
25960  * The maximum number of inbound HTLCs towards sender
25961  */
25962 void OpenChannel_set_max_accepted_htlcs(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val);
25963
25964 /**
25965  * The sender's key controlling the funding transaction
25966  */
25967 struct LDKPublicKey OpenChannel_get_funding_pubkey(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
25968
25969 /**
25970  * The sender's key controlling the funding transaction
25971  */
25972 void OpenChannel_set_funding_pubkey(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
25973
25974 /**
25975  * Used to derive a revocation key for transactions broadcast by counterparty
25976  */
25977 struct LDKPublicKey OpenChannel_get_revocation_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
25978
25979 /**
25980  * Used to derive a revocation key for transactions broadcast by counterparty
25981  */
25982 void OpenChannel_set_revocation_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
25983
25984 /**
25985  * A payment key to sender for transactions broadcast by counterparty
25986  */
25987 struct LDKPublicKey OpenChannel_get_payment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
25988
25989 /**
25990  * A payment key to sender for transactions broadcast by counterparty
25991  */
25992 void OpenChannel_set_payment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
25993
25994 /**
25995  * Used to derive a payment key to sender for transactions broadcast by sender
25996  */
25997 struct LDKPublicKey OpenChannel_get_delayed_payment_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
25998
25999 /**
26000  * Used to derive a payment key to sender for transactions broadcast by sender
26001  */
26002 void OpenChannel_set_delayed_payment_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
26003
26004 /**
26005  * Used to derive an HTLC payment key to sender
26006  */
26007 struct LDKPublicKey OpenChannel_get_htlc_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
26008
26009 /**
26010  * Used to derive an HTLC payment key to sender
26011  */
26012 void OpenChannel_set_htlc_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
26013
26014 /**
26015  * The first to-be-broadcast-by-sender transaction's per commitment point
26016  */
26017 struct LDKPublicKey OpenChannel_get_first_per_commitment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
26018
26019 /**
26020  * The first to-be-broadcast-by-sender transaction's per commitment point
26021  */
26022 void OpenChannel_set_first_per_commitment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
26023
26024 /**
26025  * The channel flags to be used
26026  */
26027 uint8_t OpenChannel_get_channel_flags(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
26028
26029 /**
26030  * The channel flags to be used
26031  */
26032 void OpenChannel_set_channel_flags(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint8_t val);
26033
26034 /**
26035  * The channel type that this channel will represent
26036  *
26037  * If this is `None`, we derive the channel type from the intersection of our
26038  * feature bits with our counterparty's feature bits from the [`Init`] message.
26039  *
26040  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
26041  */
26042 struct LDKChannelTypeFeatures OpenChannel_get_channel_type(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
26043
26044 /**
26045  * The channel type that this channel will represent
26046  *
26047  * If this is `None`, we derive the channel type from the intersection of our
26048  * feature bits with our counterparty's feature bits from the [`Init`] message.
26049  *
26050  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
26051  */
26052 void OpenChannel_set_channel_type(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKChannelTypeFeatures val);
26053
26054 /**
26055  * Creates a copy of the OpenChannel
26056  */
26057 struct LDKOpenChannel OpenChannel_clone(const struct LDKOpenChannel *NONNULL_PTR orig);
26058
26059 /**
26060  * Checks if two OpenChannels contain equal inner contents.
26061  * This ignores pointers and is_owned flags and looks at the values in fields.
26062  * Two objects with NULL inner values will be considered "equal" here.
26063  */
26064 bool OpenChannel_eq(const struct LDKOpenChannel *NONNULL_PTR a, const struct LDKOpenChannel *NONNULL_PTR b);
26065
26066 /**
26067  * Frees any resources used by the AcceptChannel, if is_owned is set and inner is non-NULL.
26068  */
26069 void AcceptChannel_free(struct LDKAcceptChannel this_obj);
26070
26071 /**
26072  * A temporary channel ID, until the funding outpoint is announced
26073  */
26074 const uint8_t (*AcceptChannel_get_temporary_channel_id(const struct LDKAcceptChannel *NONNULL_PTR this_ptr))[32];
26075
26076 /**
26077  * A temporary channel ID, until the funding outpoint is announced
26078  */
26079 void AcceptChannel_set_temporary_channel_id(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
26080
26081 /**
26082  * The threshold below which outputs on transactions broadcast by sender will be omitted
26083  */
26084 uint64_t AcceptChannel_get_dust_limit_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
26085
26086 /**
26087  * The threshold below which outputs on transactions broadcast by sender will be omitted
26088  */
26089 void AcceptChannel_set_dust_limit_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
26090
26091 /**
26092  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
26093  */
26094 uint64_t AcceptChannel_get_max_htlc_value_in_flight_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
26095
26096 /**
26097  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
26098  */
26099 void AcceptChannel_set_max_htlc_value_in_flight_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
26100
26101 /**
26102  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
26103  */
26104 uint64_t AcceptChannel_get_channel_reserve_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
26105
26106 /**
26107  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
26108  */
26109 void AcceptChannel_set_channel_reserve_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
26110
26111 /**
26112  * The minimum HTLC size incoming to sender, in milli-satoshi
26113  */
26114 uint64_t AcceptChannel_get_htlc_minimum_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
26115
26116 /**
26117  * The minimum HTLC size incoming to sender, in milli-satoshi
26118  */
26119 void AcceptChannel_set_htlc_minimum_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
26120
26121 /**
26122  * Minimum depth of the funding transaction before the channel is considered open
26123  */
26124 uint32_t AcceptChannel_get_minimum_depth(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
26125
26126 /**
26127  * Minimum depth of the funding transaction before the channel is considered open
26128  */
26129 void AcceptChannel_set_minimum_depth(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint32_t val);
26130
26131 /**
26132  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
26133  */
26134 uint16_t AcceptChannel_get_to_self_delay(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
26135
26136 /**
26137  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
26138  */
26139 void AcceptChannel_set_to_self_delay(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val);
26140
26141 /**
26142  * The maximum number of inbound HTLCs towards sender
26143  */
26144 uint16_t AcceptChannel_get_max_accepted_htlcs(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
26145
26146 /**
26147  * The maximum number of inbound HTLCs towards sender
26148  */
26149 void AcceptChannel_set_max_accepted_htlcs(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val);
26150
26151 /**
26152  * The sender's key controlling the funding transaction
26153  */
26154 struct LDKPublicKey AcceptChannel_get_funding_pubkey(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
26155
26156 /**
26157  * The sender's key controlling the funding transaction
26158  */
26159 void AcceptChannel_set_funding_pubkey(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
26160
26161 /**
26162  * Used to derive a revocation key for transactions broadcast by counterparty
26163  */
26164 struct LDKPublicKey AcceptChannel_get_revocation_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
26165
26166 /**
26167  * Used to derive a revocation key for transactions broadcast by counterparty
26168  */
26169 void AcceptChannel_set_revocation_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
26170
26171 /**
26172  * A payment key to sender for transactions broadcast by counterparty
26173  */
26174 struct LDKPublicKey AcceptChannel_get_payment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
26175
26176 /**
26177  * A payment key to sender for transactions broadcast by counterparty
26178  */
26179 void AcceptChannel_set_payment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
26180
26181 /**
26182  * Used to derive a payment key to sender for transactions broadcast by sender
26183  */
26184 struct LDKPublicKey AcceptChannel_get_delayed_payment_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
26185
26186 /**
26187  * Used to derive a payment key to sender for transactions broadcast by sender
26188  */
26189 void AcceptChannel_set_delayed_payment_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
26190
26191 /**
26192  * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
26193  */
26194 struct LDKPublicKey AcceptChannel_get_htlc_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
26195
26196 /**
26197  * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
26198  */
26199 void AcceptChannel_set_htlc_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
26200
26201 /**
26202  * The first to-be-broadcast-by-sender transaction's per commitment point
26203  */
26204 struct LDKPublicKey AcceptChannel_get_first_per_commitment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
26205
26206 /**
26207  * The first to-be-broadcast-by-sender transaction's per commitment point
26208  */
26209 void AcceptChannel_set_first_per_commitment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
26210
26211 /**
26212  * The channel type that this channel will represent.
26213  *
26214  * If this is `None`, we derive the channel type from the intersection of
26215  * our feature bits with our counterparty's feature bits from the [`Init`] message.
26216  * This is required to match the equivalent field in [`OpenChannel::channel_type`].
26217  *
26218  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
26219  */
26220 struct LDKChannelTypeFeatures AcceptChannel_get_channel_type(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
26221
26222 /**
26223  * The channel type that this channel will represent.
26224  *
26225  * If this is `None`, we derive the channel type from the intersection of
26226  * our feature bits with our counterparty's feature bits from the [`Init`] message.
26227  * This is required to match the equivalent field in [`OpenChannel::channel_type`].
26228  *
26229  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
26230  */
26231 void AcceptChannel_set_channel_type(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKChannelTypeFeatures val);
26232
26233 /**
26234  * Creates a copy of the AcceptChannel
26235  */
26236 struct LDKAcceptChannel AcceptChannel_clone(const struct LDKAcceptChannel *NONNULL_PTR orig);
26237
26238 /**
26239  * Checks if two AcceptChannels contain equal inner contents.
26240  * This ignores pointers and is_owned flags and looks at the values in fields.
26241  * Two objects with NULL inner values will be considered "equal" here.
26242  */
26243 bool AcceptChannel_eq(const struct LDKAcceptChannel *NONNULL_PTR a, const struct LDKAcceptChannel *NONNULL_PTR b);
26244
26245 /**
26246  * Frees any resources used by the FundingCreated, if is_owned is set and inner is non-NULL.
26247  */
26248 void FundingCreated_free(struct LDKFundingCreated this_obj);
26249
26250 /**
26251  * A temporary channel ID, until the funding is established
26252  */
26253 const uint8_t (*FundingCreated_get_temporary_channel_id(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32];
26254
26255 /**
26256  * A temporary channel ID, until the funding is established
26257  */
26258 void FundingCreated_set_temporary_channel_id(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
26259
26260 /**
26261  * The funding transaction ID
26262  */
26263 const uint8_t (*FundingCreated_get_funding_txid(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32];
26264
26265 /**
26266  * The funding transaction ID
26267  */
26268 void FundingCreated_set_funding_txid(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
26269
26270 /**
26271  * The specific output index funding this channel
26272  */
26273 uint16_t FundingCreated_get_funding_output_index(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
26274
26275 /**
26276  * The specific output index funding this channel
26277  */
26278 void FundingCreated_set_funding_output_index(struct LDKFundingCreated *NONNULL_PTR this_ptr, uint16_t val);
26279
26280 /**
26281  * The signature of the channel initiator (funder) on the initial commitment transaction
26282  */
26283 struct LDKSignature FundingCreated_get_signature(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
26284
26285 /**
26286  * The signature of the channel initiator (funder) on the initial commitment transaction
26287  */
26288 void FundingCreated_set_signature(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKSignature val);
26289
26290 /**
26291  * Constructs a new FundingCreated given each field
26292  */
26293 MUST_USE_RES struct LDKFundingCreated FundingCreated_new(struct LDKThirtyTwoBytes temporary_channel_id_arg, struct LDKThirtyTwoBytes funding_txid_arg, uint16_t funding_output_index_arg, struct LDKSignature signature_arg);
26294
26295 /**
26296  * Creates a copy of the FundingCreated
26297  */
26298 struct LDKFundingCreated FundingCreated_clone(const struct LDKFundingCreated *NONNULL_PTR orig);
26299
26300 /**
26301  * Checks if two FundingCreateds contain equal inner contents.
26302  * This ignores pointers and is_owned flags and looks at the values in fields.
26303  * Two objects with NULL inner values will be considered "equal" here.
26304  */
26305 bool FundingCreated_eq(const struct LDKFundingCreated *NONNULL_PTR a, const struct LDKFundingCreated *NONNULL_PTR b);
26306
26307 /**
26308  * Frees any resources used by the FundingSigned, if is_owned is set and inner is non-NULL.
26309  */
26310 void FundingSigned_free(struct LDKFundingSigned this_obj);
26311
26312 /**
26313  * The channel ID
26314  */
26315 const uint8_t (*FundingSigned_get_channel_id(const struct LDKFundingSigned *NONNULL_PTR this_ptr))[32];
26316
26317 /**
26318  * The channel ID
26319  */
26320 void FundingSigned_set_channel_id(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
26321
26322 /**
26323  * The signature of the channel acceptor (fundee) on the initial commitment transaction
26324  */
26325 struct LDKSignature FundingSigned_get_signature(const struct LDKFundingSigned *NONNULL_PTR this_ptr);
26326
26327 /**
26328  * The signature of the channel acceptor (fundee) on the initial commitment transaction
26329  */
26330 void FundingSigned_set_signature(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
26331
26332 /**
26333  * Constructs a new FundingSigned given each field
26334  */
26335 MUST_USE_RES struct LDKFundingSigned FundingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg);
26336
26337 /**
26338  * Creates a copy of the FundingSigned
26339  */
26340 struct LDKFundingSigned FundingSigned_clone(const struct LDKFundingSigned *NONNULL_PTR orig);
26341
26342 /**
26343  * Checks if two FundingSigneds contain equal inner contents.
26344  * This ignores pointers and is_owned flags and looks at the values in fields.
26345  * Two objects with NULL inner values will be considered "equal" here.
26346  */
26347 bool FundingSigned_eq(const struct LDKFundingSigned *NONNULL_PTR a, const struct LDKFundingSigned *NONNULL_PTR b);
26348
26349 /**
26350  * Frees any resources used by the ChannelReady, if is_owned is set and inner is non-NULL.
26351  */
26352 void ChannelReady_free(struct LDKChannelReady this_obj);
26353
26354 /**
26355  * The channel ID
26356  */
26357 const uint8_t (*ChannelReady_get_channel_id(const struct LDKChannelReady *NONNULL_PTR this_ptr))[32];
26358
26359 /**
26360  * The channel ID
26361  */
26362 void ChannelReady_set_channel_id(struct LDKChannelReady *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
26363
26364 /**
26365  * The per-commitment point of the second commitment transaction
26366  */
26367 struct LDKPublicKey ChannelReady_get_next_per_commitment_point(const struct LDKChannelReady *NONNULL_PTR this_ptr);
26368
26369 /**
26370  * The per-commitment point of the second commitment transaction
26371  */
26372 void ChannelReady_set_next_per_commitment_point(struct LDKChannelReady *NONNULL_PTR this_ptr, struct LDKPublicKey val);
26373
26374 /**
26375  * If set, provides a `short_channel_id` alias for this channel.
26376  *
26377  * The sender will accept payments to be forwarded over this SCID and forward them to this
26378  * messages' recipient.
26379  */
26380 struct LDKCOption_u64Z ChannelReady_get_short_channel_id_alias(const struct LDKChannelReady *NONNULL_PTR this_ptr);
26381
26382 /**
26383  * If set, provides a `short_channel_id` alias for this channel.
26384  *
26385  * The sender will accept payments to be forwarded over this SCID and forward them to this
26386  * messages' recipient.
26387  */
26388 void ChannelReady_set_short_channel_id_alias(struct LDKChannelReady *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
26389
26390 /**
26391  * Constructs a new ChannelReady given each field
26392  */
26393 MUST_USE_RES struct LDKChannelReady ChannelReady_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKPublicKey next_per_commitment_point_arg, struct LDKCOption_u64Z short_channel_id_alias_arg);
26394
26395 /**
26396  * Creates a copy of the ChannelReady
26397  */
26398 struct LDKChannelReady ChannelReady_clone(const struct LDKChannelReady *NONNULL_PTR orig);
26399
26400 /**
26401  * Checks if two ChannelReadys contain equal inner contents.
26402  * This ignores pointers and is_owned flags and looks at the values in fields.
26403  * Two objects with NULL inner values will be considered "equal" here.
26404  */
26405 bool ChannelReady_eq(const struct LDKChannelReady *NONNULL_PTR a, const struct LDKChannelReady *NONNULL_PTR b);
26406
26407 /**
26408  * Frees any resources used by the Shutdown, if is_owned is set and inner is non-NULL.
26409  */
26410 void Shutdown_free(struct LDKShutdown this_obj);
26411
26412 /**
26413  * The channel ID
26414  */
26415 const uint8_t (*Shutdown_get_channel_id(const struct LDKShutdown *NONNULL_PTR this_ptr))[32];
26416
26417 /**
26418  * The channel ID
26419  */
26420 void Shutdown_set_channel_id(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
26421
26422 /**
26423  * The destination of this peer's funds on closing.
26424  *
26425  * Must be in one of these forms: P2PKH, P2SH, P2WPKH, P2WSH, P2TR.
26426  */
26427 struct LDKu8slice Shutdown_get_scriptpubkey(const struct LDKShutdown *NONNULL_PTR this_ptr);
26428
26429 /**
26430  * The destination of this peer's funds on closing.
26431  *
26432  * Must be in one of these forms: P2PKH, P2SH, P2WPKH, P2WSH, P2TR.
26433  */
26434 void Shutdown_set_scriptpubkey(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
26435
26436 /**
26437  * Constructs a new Shutdown given each field
26438  */
26439 MUST_USE_RES struct LDKShutdown Shutdown_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKCVec_u8Z scriptpubkey_arg);
26440
26441 /**
26442  * Creates a copy of the Shutdown
26443  */
26444 struct LDKShutdown Shutdown_clone(const struct LDKShutdown *NONNULL_PTR orig);
26445
26446 /**
26447  * Checks if two Shutdowns contain equal inner contents.
26448  * This ignores pointers and is_owned flags and looks at the values in fields.
26449  * Two objects with NULL inner values will be considered "equal" here.
26450  */
26451 bool Shutdown_eq(const struct LDKShutdown *NONNULL_PTR a, const struct LDKShutdown *NONNULL_PTR b);
26452
26453 /**
26454  * Frees any resources used by the ClosingSignedFeeRange, if is_owned is set and inner is non-NULL.
26455  */
26456 void ClosingSignedFeeRange_free(struct LDKClosingSignedFeeRange this_obj);
26457
26458 /**
26459  * The minimum absolute fee, in satoshis, which the sender is willing to place on the closing
26460  * transaction.
26461  */
26462 uint64_t ClosingSignedFeeRange_get_min_fee_satoshis(const struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr);
26463
26464 /**
26465  * The minimum absolute fee, in satoshis, which the sender is willing to place on the closing
26466  * transaction.
26467  */
26468 void ClosingSignedFeeRange_set_min_fee_satoshis(struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr, uint64_t val);
26469
26470 /**
26471  * The maximum absolute fee, in satoshis, which the sender is willing to place on the closing
26472  * transaction.
26473  */
26474 uint64_t ClosingSignedFeeRange_get_max_fee_satoshis(const struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr);
26475
26476 /**
26477  * The maximum absolute fee, in satoshis, which the sender is willing to place on the closing
26478  * transaction.
26479  */
26480 void ClosingSignedFeeRange_set_max_fee_satoshis(struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr, uint64_t val);
26481
26482 /**
26483  * Constructs a new ClosingSignedFeeRange given each field
26484  */
26485 MUST_USE_RES struct LDKClosingSignedFeeRange ClosingSignedFeeRange_new(uint64_t min_fee_satoshis_arg, uint64_t max_fee_satoshis_arg);
26486
26487 /**
26488  * Creates a copy of the ClosingSignedFeeRange
26489  */
26490 struct LDKClosingSignedFeeRange ClosingSignedFeeRange_clone(const struct LDKClosingSignedFeeRange *NONNULL_PTR orig);
26491
26492 /**
26493  * Checks if two ClosingSignedFeeRanges contain equal inner contents.
26494  * This ignores pointers and is_owned flags and looks at the values in fields.
26495  * Two objects with NULL inner values will be considered "equal" here.
26496  */
26497 bool ClosingSignedFeeRange_eq(const struct LDKClosingSignedFeeRange *NONNULL_PTR a, const struct LDKClosingSignedFeeRange *NONNULL_PTR b);
26498
26499 /**
26500  * Frees any resources used by the ClosingSigned, if is_owned is set and inner is non-NULL.
26501  */
26502 void ClosingSigned_free(struct LDKClosingSigned this_obj);
26503
26504 /**
26505  * The channel ID
26506  */
26507 const uint8_t (*ClosingSigned_get_channel_id(const struct LDKClosingSigned *NONNULL_PTR this_ptr))[32];
26508
26509 /**
26510  * The channel ID
26511  */
26512 void ClosingSigned_set_channel_id(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
26513
26514 /**
26515  * The proposed total fee for the closing transaction
26516  */
26517 uint64_t ClosingSigned_get_fee_satoshis(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
26518
26519 /**
26520  * The proposed total fee for the closing transaction
26521  */
26522 void ClosingSigned_set_fee_satoshis(struct LDKClosingSigned *NONNULL_PTR this_ptr, uint64_t val);
26523
26524 /**
26525  * A signature on the closing transaction
26526  */
26527 struct LDKSignature ClosingSigned_get_signature(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
26528
26529 /**
26530  * A signature on the closing transaction
26531  */
26532 void ClosingSigned_set_signature(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
26533
26534 /**
26535  * The minimum and maximum fees which the sender is willing to accept, provided only by new
26536  * nodes.
26537  *
26538  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
26539  */
26540 struct LDKClosingSignedFeeRange ClosingSigned_get_fee_range(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
26541
26542 /**
26543  * The minimum and maximum fees which the sender is willing to accept, provided only by new
26544  * nodes.
26545  *
26546  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
26547  */
26548 void ClosingSigned_set_fee_range(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKClosingSignedFeeRange val);
26549
26550 /**
26551  * Constructs a new ClosingSigned given each field
26552  */
26553 MUST_USE_RES struct LDKClosingSigned ClosingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t fee_satoshis_arg, struct LDKSignature signature_arg, struct LDKClosingSignedFeeRange fee_range_arg);
26554
26555 /**
26556  * Creates a copy of the ClosingSigned
26557  */
26558 struct LDKClosingSigned ClosingSigned_clone(const struct LDKClosingSigned *NONNULL_PTR orig);
26559
26560 /**
26561  * Checks if two ClosingSigneds contain equal inner contents.
26562  * This ignores pointers and is_owned flags and looks at the values in fields.
26563  * Two objects with NULL inner values will be considered "equal" here.
26564  */
26565 bool ClosingSigned_eq(const struct LDKClosingSigned *NONNULL_PTR a, const struct LDKClosingSigned *NONNULL_PTR b);
26566
26567 /**
26568  * Frees any resources used by the UpdateAddHTLC, if is_owned is set and inner is non-NULL.
26569  */
26570 void UpdateAddHTLC_free(struct LDKUpdateAddHTLC this_obj);
26571
26572 /**
26573  * The channel ID
26574  */
26575 const uint8_t (*UpdateAddHTLC_get_channel_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32];
26576
26577 /**
26578  * The channel ID
26579  */
26580 void UpdateAddHTLC_set_channel_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
26581
26582 /**
26583  * The HTLC ID
26584  */
26585 uint64_t UpdateAddHTLC_get_htlc_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
26586
26587 /**
26588  * The HTLC ID
26589  */
26590 void UpdateAddHTLC_set_htlc_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
26591
26592 /**
26593  * The HTLC value in milli-satoshi
26594  */
26595 uint64_t UpdateAddHTLC_get_amount_msat(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
26596
26597 /**
26598  * The HTLC value in milli-satoshi
26599  */
26600 void UpdateAddHTLC_set_amount_msat(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
26601
26602 /**
26603  * The payment hash, the pre-image of which controls HTLC redemption
26604  */
26605 const uint8_t (*UpdateAddHTLC_get_payment_hash(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32];
26606
26607 /**
26608  * The payment hash, the pre-image of which controls HTLC redemption
26609  */
26610 void UpdateAddHTLC_set_payment_hash(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
26611
26612 /**
26613  * The expiry height of the HTLC
26614  */
26615 uint32_t UpdateAddHTLC_get_cltv_expiry(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
26616
26617 /**
26618  * The expiry height of the HTLC
26619  */
26620 void UpdateAddHTLC_set_cltv_expiry(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint32_t val);
26621
26622 /**
26623  * Creates a copy of the UpdateAddHTLC
26624  */
26625 struct LDKUpdateAddHTLC UpdateAddHTLC_clone(const struct LDKUpdateAddHTLC *NONNULL_PTR orig);
26626
26627 /**
26628  * Checks if two UpdateAddHTLCs contain equal inner contents.
26629  * This ignores pointers and is_owned flags and looks at the values in fields.
26630  * Two objects with NULL inner values will be considered "equal" here.
26631  */
26632 bool UpdateAddHTLC_eq(const struct LDKUpdateAddHTLC *NONNULL_PTR a, const struct LDKUpdateAddHTLC *NONNULL_PTR b);
26633
26634 /**
26635  * Frees any resources used by the OnionMessage, if is_owned is set and inner is non-NULL.
26636  */
26637 void OnionMessage_free(struct LDKOnionMessage this_obj);
26638
26639 /**
26640  * Used in decrypting the onion packet's payload.
26641  */
26642 struct LDKPublicKey OnionMessage_get_blinding_point(const struct LDKOnionMessage *NONNULL_PTR this_ptr);
26643
26644 /**
26645  * Used in decrypting the onion packet's payload.
26646  */
26647 void OnionMessage_set_blinding_point(struct LDKOnionMessage *NONNULL_PTR this_ptr, struct LDKPublicKey val);
26648
26649 /**
26650  * Creates a copy of the OnionMessage
26651  */
26652 struct LDKOnionMessage OnionMessage_clone(const struct LDKOnionMessage *NONNULL_PTR orig);
26653
26654 /**
26655  * Checks if two OnionMessages contain equal inner contents.
26656  * This ignores pointers and is_owned flags and looks at the values in fields.
26657  * Two objects with NULL inner values will be considered "equal" here.
26658  */
26659 bool OnionMessage_eq(const struct LDKOnionMessage *NONNULL_PTR a, const struct LDKOnionMessage *NONNULL_PTR b);
26660
26661 /**
26662  * Frees any resources used by the UpdateFulfillHTLC, if is_owned is set and inner is non-NULL.
26663  */
26664 void UpdateFulfillHTLC_free(struct LDKUpdateFulfillHTLC this_obj);
26665
26666 /**
26667  * The channel ID
26668  */
26669 const uint8_t (*UpdateFulfillHTLC_get_channel_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32];
26670
26671 /**
26672  * The channel ID
26673  */
26674 void UpdateFulfillHTLC_set_channel_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
26675
26676 /**
26677  * The HTLC ID
26678  */
26679 uint64_t UpdateFulfillHTLC_get_htlc_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr);
26680
26681 /**
26682  * The HTLC ID
26683  */
26684 void UpdateFulfillHTLC_set_htlc_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, uint64_t val);
26685
26686 /**
26687  * The pre-image of the payment hash, allowing HTLC redemption
26688  */
26689 const uint8_t (*UpdateFulfillHTLC_get_payment_preimage(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32];
26690
26691 /**
26692  * The pre-image of the payment hash, allowing HTLC redemption
26693  */
26694 void UpdateFulfillHTLC_set_payment_preimage(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
26695
26696 /**
26697  * Constructs a new UpdateFulfillHTLC given each field
26698  */
26699 MUST_USE_RES struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t htlc_id_arg, struct LDKThirtyTwoBytes payment_preimage_arg);
26700
26701 /**
26702  * Creates a copy of the UpdateFulfillHTLC
26703  */
26704 struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_clone(const struct LDKUpdateFulfillHTLC *NONNULL_PTR orig);
26705
26706 /**
26707  * Checks if two UpdateFulfillHTLCs contain equal inner contents.
26708  * This ignores pointers and is_owned flags and looks at the values in fields.
26709  * Two objects with NULL inner values will be considered "equal" here.
26710  */
26711 bool UpdateFulfillHTLC_eq(const struct LDKUpdateFulfillHTLC *NONNULL_PTR a, const struct LDKUpdateFulfillHTLC *NONNULL_PTR b);
26712
26713 /**
26714  * Frees any resources used by the UpdateFailHTLC, if is_owned is set and inner is non-NULL.
26715  */
26716 void UpdateFailHTLC_free(struct LDKUpdateFailHTLC this_obj);
26717
26718 /**
26719  * The channel ID
26720  */
26721 const uint8_t (*UpdateFailHTLC_get_channel_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr))[32];
26722
26723 /**
26724  * The channel ID
26725  */
26726 void UpdateFailHTLC_set_channel_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
26727
26728 /**
26729  * The HTLC ID
26730  */
26731 uint64_t UpdateFailHTLC_get_htlc_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr);
26732
26733 /**
26734  * The HTLC ID
26735  */
26736 void UpdateFailHTLC_set_htlc_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, uint64_t val);
26737
26738 /**
26739  * Creates a copy of the UpdateFailHTLC
26740  */
26741 struct LDKUpdateFailHTLC UpdateFailHTLC_clone(const struct LDKUpdateFailHTLC *NONNULL_PTR orig);
26742
26743 /**
26744  * Checks if two UpdateFailHTLCs contain equal inner contents.
26745  * This ignores pointers and is_owned flags and looks at the values in fields.
26746  * Two objects with NULL inner values will be considered "equal" here.
26747  */
26748 bool UpdateFailHTLC_eq(const struct LDKUpdateFailHTLC *NONNULL_PTR a, const struct LDKUpdateFailHTLC *NONNULL_PTR b);
26749
26750 /**
26751  * Frees any resources used by the UpdateFailMalformedHTLC, if is_owned is set and inner is non-NULL.
26752  */
26753 void UpdateFailMalformedHTLC_free(struct LDKUpdateFailMalformedHTLC this_obj);
26754
26755 /**
26756  * The channel ID
26757  */
26758 const uint8_t (*UpdateFailMalformedHTLC_get_channel_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr))[32];
26759
26760 /**
26761  * The channel ID
26762  */
26763 void UpdateFailMalformedHTLC_set_channel_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
26764
26765 /**
26766  * The HTLC ID
26767  */
26768 uint64_t UpdateFailMalformedHTLC_get_htlc_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
26769
26770 /**
26771  * The HTLC ID
26772  */
26773 void UpdateFailMalformedHTLC_set_htlc_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint64_t val);
26774
26775 /**
26776  * The failure code
26777  */
26778 uint16_t UpdateFailMalformedHTLC_get_failure_code(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
26779
26780 /**
26781  * The failure code
26782  */
26783 void UpdateFailMalformedHTLC_set_failure_code(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint16_t val);
26784
26785 /**
26786  * Creates a copy of the UpdateFailMalformedHTLC
26787  */
26788 struct LDKUpdateFailMalformedHTLC UpdateFailMalformedHTLC_clone(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR orig);
26789
26790 /**
26791  * Checks if two UpdateFailMalformedHTLCs contain equal inner contents.
26792  * This ignores pointers and is_owned flags and looks at the values in fields.
26793  * Two objects with NULL inner values will be considered "equal" here.
26794  */
26795 bool UpdateFailMalformedHTLC_eq(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR a, const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR b);
26796
26797 /**
26798  * Frees any resources used by the CommitmentSigned, if is_owned is set and inner is non-NULL.
26799  */
26800 void CommitmentSigned_free(struct LDKCommitmentSigned this_obj);
26801
26802 /**
26803  * The channel ID
26804  */
26805 const uint8_t (*CommitmentSigned_get_channel_id(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr))[32];
26806
26807 /**
26808  * The channel ID
26809  */
26810 void CommitmentSigned_set_channel_id(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
26811
26812 /**
26813  * A signature on the commitment transaction
26814  */
26815 struct LDKSignature CommitmentSigned_get_signature(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr);
26816
26817 /**
26818  * A signature on the commitment transaction
26819  */
26820 void CommitmentSigned_set_signature(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
26821
26822 /**
26823  * Signatures on the HTLC transactions
26824  *
26825  * Returns a copy of the field.
26826  */
26827 struct LDKCVec_SignatureZ CommitmentSigned_get_htlc_signatures(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr);
26828
26829 /**
26830  * Signatures on the HTLC transactions
26831  */
26832 void CommitmentSigned_set_htlc_signatures(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val);
26833
26834 /**
26835  * Constructs a new CommitmentSigned given each field
26836  */
26837 MUST_USE_RES struct LDKCommitmentSigned CommitmentSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg, struct LDKCVec_SignatureZ htlc_signatures_arg);
26838
26839 /**
26840  * Creates a copy of the CommitmentSigned
26841  */
26842 struct LDKCommitmentSigned CommitmentSigned_clone(const struct LDKCommitmentSigned *NONNULL_PTR orig);
26843
26844 /**
26845  * Checks if two CommitmentSigneds contain equal inner contents.
26846  * This ignores pointers and is_owned flags and looks at the values in fields.
26847  * Two objects with NULL inner values will be considered "equal" here.
26848  */
26849 bool CommitmentSigned_eq(const struct LDKCommitmentSigned *NONNULL_PTR a, const struct LDKCommitmentSigned *NONNULL_PTR b);
26850
26851 /**
26852  * Frees any resources used by the RevokeAndACK, if is_owned is set and inner is non-NULL.
26853  */
26854 void RevokeAndACK_free(struct LDKRevokeAndACK this_obj);
26855
26856 /**
26857  * The channel ID
26858  */
26859 const uint8_t (*RevokeAndACK_get_channel_id(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32];
26860
26861 /**
26862  * The channel ID
26863  */
26864 void RevokeAndACK_set_channel_id(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
26865
26866 /**
26867  * The secret corresponding to the per-commitment point
26868  */
26869 const uint8_t (*RevokeAndACK_get_per_commitment_secret(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32];
26870
26871 /**
26872  * The secret corresponding to the per-commitment point
26873  */
26874 void RevokeAndACK_set_per_commitment_secret(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
26875
26876 /**
26877  * The next sender-broadcast commitment transaction's per-commitment point
26878  */
26879 struct LDKPublicKey RevokeAndACK_get_next_per_commitment_point(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr);
26880
26881 /**
26882  * The next sender-broadcast commitment transaction's per-commitment point
26883  */
26884 void RevokeAndACK_set_next_per_commitment_point(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKPublicKey val);
26885
26886 /**
26887  * Constructs a new RevokeAndACK given each field
26888  */
26889 MUST_USE_RES struct LDKRevokeAndACK RevokeAndACK_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKThirtyTwoBytes per_commitment_secret_arg, struct LDKPublicKey next_per_commitment_point_arg);
26890
26891 /**
26892  * Creates a copy of the RevokeAndACK
26893  */
26894 struct LDKRevokeAndACK RevokeAndACK_clone(const struct LDKRevokeAndACK *NONNULL_PTR orig);
26895
26896 /**
26897  * Checks if two RevokeAndACKs contain equal inner contents.
26898  * This ignores pointers and is_owned flags and looks at the values in fields.
26899  * Two objects with NULL inner values will be considered "equal" here.
26900  */
26901 bool RevokeAndACK_eq(const struct LDKRevokeAndACK *NONNULL_PTR a, const struct LDKRevokeAndACK *NONNULL_PTR b);
26902
26903 /**
26904  * Frees any resources used by the UpdateFee, if is_owned is set and inner is non-NULL.
26905  */
26906 void UpdateFee_free(struct LDKUpdateFee this_obj);
26907
26908 /**
26909  * The channel ID
26910  */
26911 const uint8_t (*UpdateFee_get_channel_id(const struct LDKUpdateFee *NONNULL_PTR this_ptr))[32];
26912
26913 /**
26914  * The channel ID
26915  */
26916 void UpdateFee_set_channel_id(struct LDKUpdateFee *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
26917
26918 /**
26919  * Fee rate per 1000-weight of the transaction
26920  */
26921 uint32_t UpdateFee_get_feerate_per_kw(const struct LDKUpdateFee *NONNULL_PTR this_ptr);
26922
26923 /**
26924  * Fee rate per 1000-weight of the transaction
26925  */
26926 void UpdateFee_set_feerate_per_kw(struct LDKUpdateFee *NONNULL_PTR this_ptr, uint32_t val);
26927
26928 /**
26929  * Constructs a new UpdateFee given each field
26930  */
26931 MUST_USE_RES struct LDKUpdateFee UpdateFee_new(struct LDKThirtyTwoBytes channel_id_arg, uint32_t feerate_per_kw_arg);
26932
26933 /**
26934  * Creates a copy of the UpdateFee
26935  */
26936 struct LDKUpdateFee UpdateFee_clone(const struct LDKUpdateFee *NONNULL_PTR orig);
26937
26938 /**
26939  * Checks if two UpdateFees contain equal inner contents.
26940  * This ignores pointers and is_owned flags and looks at the values in fields.
26941  * Two objects with NULL inner values will be considered "equal" here.
26942  */
26943 bool UpdateFee_eq(const struct LDKUpdateFee *NONNULL_PTR a, const struct LDKUpdateFee *NONNULL_PTR b);
26944
26945 /**
26946  * Frees any resources used by the DataLossProtect, if is_owned is set and inner is non-NULL.
26947  */
26948 void DataLossProtect_free(struct LDKDataLossProtect this_obj);
26949
26950 /**
26951  * Proof that the sender knows the per-commitment secret of a specific commitment transaction
26952  * belonging to the recipient
26953  */
26954 const uint8_t (*DataLossProtect_get_your_last_per_commitment_secret(const struct LDKDataLossProtect *NONNULL_PTR this_ptr))[32];
26955
26956 /**
26957  * Proof that the sender knows the per-commitment secret of a specific commitment transaction
26958  * belonging to the recipient
26959  */
26960 void DataLossProtect_set_your_last_per_commitment_secret(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
26961
26962 /**
26963  * The sender's per-commitment point for their current commitment transaction
26964  */
26965 struct LDKPublicKey DataLossProtect_get_my_current_per_commitment_point(const struct LDKDataLossProtect *NONNULL_PTR this_ptr);
26966
26967 /**
26968  * The sender's per-commitment point for their current commitment transaction
26969  */
26970 void DataLossProtect_set_my_current_per_commitment_point(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKPublicKey val);
26971
26972 /**
26973  * Constructs a new DataLossProtect given each field
26974  */
26975 MUST_USE_RES struct LDKDataLossProtect DataLossProtect_new(struct LDKThirtyTwoBytes your_last_per_commitment_secret_arg, struct LDKPublicKey my_current_per_commitment_point_arg);
26976
26977 /**
26978  * Creates a copy of the DataLossProtect
26979  */
26980 struct LDKDataLossProtect DataLossProtect_clone(const struct LDKDataLossProtect *NONNULL_PTR orig);
26981
26982 /**
26983  * Checks if two DataLossProtects contain equal inner contents.
26984  * This ignores pointers and is_owned flags and looks at the values in fields.
26985  * Two objects with NULL inner values will be considered "equal" here.
26986  */
26987 bool DataLossProtect_eq(const struct LDKDataLossProtect *NONNULL_PTR a, const struct LDKDataLossProtect *NONNULL_PTR b);
26988
26989 /**
26990  * Frees any resources used by the ChannelReestablish, if is_owned is set and inner is non-NULL.
26991  */
26992 void ChannelReestablish_free(struct LDKChannelReestablish this_obj);
26993
26994 /**
26995  * The channel ID
26996  */
26997 const uint8_t (*ChannelReestablish_get_channel_id(const struct LDKChannelReestablish *NONNULL_PTR this_ptr))[32];
26998
26999 /**
27000  * The channel ID
27001  */
27002 void ChannelReestablish_set_channel_id(struct LDKChannelReestablish *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
27003
27004 /**
27005  * The next commitment number for the sender
27006  */
27007 uint64_t ChannelReestablish_get_next_local_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
27008
27009 /**
27010  * The next commitment number for the sender
27011  */
27012 void ChannelReestablish_set_next_local_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
27013
27014 /**
27015  * The next commitment number for the recipient
27016  */
27017 uint64_t ChannelReestablish_get_next_remote_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
27018
27019 /**
27020  * The next commitment number for the recipient
27021  */
27022 void ChannelReestablish_set_next_remote_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
27023
27024 /**
27025  * Creates a copy of the ChannelReestablish
27026  */
27027 struct LDKChannelReestablish ChannelReestablish_clone(const struct LDKChannelReestablish *NONNULL_PTR orig);
27028
27029 /**
27030  * Checks if two ChannelReestablishs contain equal inner contents.
27031  * This ignores pointers and is_owned flags and looks at the values in fields.
27032  * Two objects with NULL inner values will be considered "equal" here.
27033  */
27034 bool ChannelReestablish_eq(const struct LDKChannelReestablish *NONNULL_PTR a, const struct LDKChannelReestablish *NONNULL_PTR b);
27035
27036 /**
27037  * Frees any resources used by the AnnouncementSignatures, if is_owned is set and inner is non-NULL.
27038  */
27039 void AnnouncementSignatures_free(struct LDKAnnouncementSignatures this_obj);
27040
27041 /**
27042  * The channel ID
27043  */
27044 const uint8_t (*AnnouncementSignatures_get_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr))[32];
27045
27046 /**
27047  * The channel ID
27048  */
27049 void AnnouncementSignatures_set_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
27050
27051 /**
27052  * The short channel ID
27053  */
27054 uint64_t AnnouncementSignatures_get_short_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
27055
27056 /**
27057  * The short channel ID
27058  */
27059 void AnnouncementSignatures_set_short_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, uint64_t val);
27060
27061 /**
27062  * A signature by the node key
27063  */
27064 struct LDKSignature AnnouncementSignatures_get_node_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
27065
27066 /**
27067  * A signature by the node key
27068  */
27069 void AnnouncementSignatures_set_node_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val);
27070
27071 /**
27072  * A signature by the funding key
27073  */
27074 struct LDKSignature AnnouncementSignatures_get_bitcoin_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
27075
27076 /**
27077  * A signature by the funding key
27078  */
27079 void AnnouncementSignatures_set_bitcoin_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val);
27080
27081 /**
27082  * Constructs a new AnnouncementSignatures given each field
27083  */
27084 MUST_USE_RES struct LDKAnnouncementSignatures AnnouncementSignatures_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t short_channel_id_arg, struct LDKSignature node_signature_arg, struct LDKSignature bitcoin_signature_arg);
27085
27086 /**
27087  * Creates a copy of the AnnouncementSignatures
27088  */
27089 struct LDKAnnouncementSignatures AnnouncementSignatures_clone(const struct LDKAnnouncementSignatures *NONNULL_PTR orig);
27090
27091 /**
27092  * Checks if two AnnouncementSignaturess contain equal inner contents.
27093  * This ignores pointers and is_owned flags and looks at the values in fields.
27094  * Two objects with NULL inner values will be considered "equal" here.
27095  */
27096 bool AnnouncementSignatures_eq(const struct LDKAnnouncementSignatures *NONNULL_PTR a, const struct LDKAnnouncementSignatures *NONNULL_PTR b);
27097
27098 /**
27099  * Frees any resources used by the NetAddress
27100  */
27101 void NetAddress_free(struct LDKNetAddress this_ptr);
27102
27103 /**
27104  * Creates a copy of the NetAddress
27105  */
27106 struct LDKNetAddress NetAddress_clone(const struct LDKNetAddress *NONNULL_PTR orig);
27107
27108 /**
27109  * Utility method to constructs a new IPv4-variant NetAddress
27110  */
27111 struct LDKNetAddress NetAddress_ipv4(struct LDKFourBytes addr, uint16_t port);
27112
27113 /**
27114  * Utility method to constructs a new IPv6-variant NetAddress
27115  */
27116 struct LDKNetAddress NetAddress_ipv6(struct LDKSixteenBytes addr, uint16_t port);
27117
27118 /**
27119  * Utility method to constructs a new OnionV2-variant NetAddress
27120  */
27121 struct LDKNetAddress NetAddress_onion_v2(struct LDKTwelveBytes a);
27122
27123 /**
27124  * Utility method to constructs a new OnionV3-variant NetAddress
27125  */
27126 struct LDKNetAddress NetAddress_onion_v3(struct LDKThirtyTwoBytes ed25519_pubkey, uint16_t checksum, uint8_t version, uint16_t port);
27127
27128 /**
27129  * Utility method to constructs a new Hostname-variant NetAddress
27130  */
27131 struct LDKNetAddress NetAddress_hostname(struct LDKHostname hostname, uint16_t port);
27132
27133 /**
27134  * Checks if two NetAddresss contain equal inner contents.
27135  * This ignores pointers and is_owned flags and looks at the values in fields.
27136  */
27137 bool NetAddress_eq(const struct LDKNetAddress *NONNULL_PTR a, const struct LDKNetAddress *NONNULL_PTR b);
27138
27139 /**
27140  * Serialize the NetAddress object into a byte array which can be read by NetAddress_read
27141  */
27142 struct LDKCVec_u8Z NetAddress_write(const struct LDKNetAddress *NONNULL_PTR obj);
27143
27144 /**
27145  * Read a NetAddress from a byte array, created by NetAddress_write
27146  */
27147 struct LDKCResult_NetAddressDecodeErrorZ NetAddress_read(struct LDKu8slice ser);
27148
27149 /**
27150  * Frees any resources used by the UnsignedGossipMessage
27151  */
27152 void UnsignedGossipMessage_free(struct LDKUnsignedGossipMessage this_ptr);
27153
27154 /**
27155  * Creates a copy of the UnsignedGossipMessage
27156  */
27157 struct LDKUnsignedGossipMessage UnsignedGossipMessage_clone(const struct LDKUnsignedGossipMessage *NONNULL_PTR orig);
27158
27159 /**
27160  * Utility method to constructs a new ChannelAnnouncement-variant UnsignedGossipMessage
27161  */
27162 struct LDKUnsignedGossipMessage UnsignedGossipMessage_channel_announcement(struct LDKUnsignedChannelAnnouncement a);
27163
27164 /**
27165  * Utility method to constructs a new ChannelUpdate-variant UnsignedGossipMessage
27166  */
27167 struct LDKUnsignedGossipMessage UnsignedGossipMessage_channel_update(struct LDKUnsignedChannelUpdate a);
27168
27169 /**
27170  * Utility method to constructs a new NodeAnnouncement-variant UnsignedGossipMessage
27171  */
27172 struct LDKUnsignedGossipMessage UnsignedGossipMessage_node_announcement(struct LDKUnsignedNodeAnnouncement a);
27173
27174 /**
27175  * Serialize the UnsignedGossipMessage object into a byte array which can be read by UnsignedGossipMessage_read
27176  */
27177 struct LDKCVec_u8Z UnsignedGossipMessage_write(const struct LDKUnsignedGossipMessage *NONNULL_PTR obj);
27178
27179 /**
27180  * Frees any resources used by the UnsignedNodeAnnouncement, if is_owned is set and inner is non-NULL.
27181  */
27182 void UnsignedNodeAnnouncement_free(struct LDKUnsignedNodeAnnouncement this_obj);
27183
27184 /**
27185  * The advertised features
27186  */
27187 struct LDKNodeFeatures UnsignedNodeAnnouncement_get_features(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
27188
27189 /**
27190  * The advertised features
27191  */
27192 void UnsignedNodeAnnouncement_set_features(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
27193
27194 /**
27195  * A strictly monotonic announcement counter, with gaps allowed
27196  */
27197 uint32_t UnsignedNodeAnnouncement_get_timestamp(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
27198
27199 /**
27200  * A strictly monotonic announcement counter, with gaps allowed
27201  */
27202 void UnsignedNodeAnnouncement_set_timestamp(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, uint32_t val);
27203
27204 /**
27205  * The `node_id` this announcement originated from (don't rebroadcast the `node_announcement` back
27206  * to this node).
27207  */
27208 struct LDKNodeId UnsignedNodeAnnouncement_get_node_id(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
27209
27210 /**
27211  * The `node_id` this announcement originated from (don't rebroadcast the `node_announcement` back
27212  * to this node).
27213  */
27214 void UnsignedNodeAnnouncement_set_node_id(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeId val);
27215
27216 /**
27217  * An RGB color for UI purposes
27218  */
27219 const uint8_t (*UnsignedNodeAnnouncement_get_rgb(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[3];
27220
27221 /**
27222  * An RGB color for UI purposes
27223  */
27224 void UnsignedNodeAnnouncement_set_rgb(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
27225
27226 /**
27227  * An alias, for UI purposes.
27228  *
27229  * This should be sanitized before use. There is no guarantee of uniqueness.
27230  */
27231 struct LDKNodeAlias UnsignedNodeAnnouncement_get_alias(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
27232
27233 /**
27234  * An alias, for UI purposes.
27235  *
27236  * This should be sanitized before use. There is no guarantee of uniqueness.
27237  */
27238 void UnsignedNodeAnnouncement_set_alias(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeAlias val);
27239
27240 /**
27241  * List of addresses on which this node is reachable
27242  *
27243  * Returns a copy of the field.
27244  */
27245 struct LDKCVec_NetAddressZ UnsignedNodeAnnouncement_get_addresses(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
27246
27247 /**
27248  * List of addresses on which this node is reachable
27249  */
27250 void UnsignedNodeAnnouncement_set_addresses(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val);
27251
27252 /**
27253  * Creates a copy of the UnsignedNodeAnnouncement
27254  */
27255 struct LDKUnsignedNodeAnnouncement UnsignedNodeAnnouncement_clone(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR orig);
27256
27257 /**
27258  * Checks if two UnsignedNodeAnnouncements contain equal inner contents.
27259  * This ignores pointers and is_owned flags and looks at the values in fields.
27260  * Two objects with NULL inner values will be considered "equal" here.
27261  */
27262 bool UnsignedNodeAnnouncement_eq(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR a, const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR b);
27263
27264 /**
27265  * Frees any resources used by the NodeAnnouncement, if is_owned is set and inner is non-NULL.
27266  */
27267 void NodeAnnouncement_free(struct LDKNodeAnnouncement this_obj);
27268
27269 /**
27270  * The signature by the node key
27271  */
27272 struct LDKSignature NodeAnnouncement_get_signature(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
27273
27274 /**
27275  * The signature by the node key
27276  */
27277 void NodeAnnouncement_set_signature(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
27278
27279 /**
27280  * The actual content of the announcement
27281  */
27282 struct LDKUnsignedNodeAnnouncement NodeAnnouncement_get_contents(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
27283
27284 /**
27285  * The actual content of the announcement
27286  */
27287 void NodeAnnouncement_set_contents(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedNodeAnnouncement val);
27288
27289 /**
27290  * Constructs a new NodeAnnouncement given each field
27291  */
27292 MUST_USE_RES struct LDKNodeAnnouncement NodeAnnouncement_new(struct LDKSignature signature_arg, struct LDKUnsignedNodeAnnouncement contents_arg);
27293
27294 /**
27295  * Creates a copy of the NodeAnnouncement
27296  */
27297 struct LDKNodeAnnouncement NodeAnnouncement_clone(const struct LDKNodeAnnouncement *NONNULL_PTR orig);
27298
27299 /**
27300  * Checks if two NodeAnnouncements contain equal inner contents.
27301  * This ignores pointers and is_owned flags and looks at the values in fields.
27302  * Two objects with NULL inner values will be considered "equal" here.
27303  */
27304 bool NodeAnnouncement_eq(const struct LDKNodeAnnouncement *NONNULL_PTR a, const struct LDKNodeAnnouncement *NONNULL_PTR b);
27305
27306 /**
27307  * Frees any resources used by the UnsignedChannelAnnouncement, if is_owned is set and inner is non-NULL.
27308  */
27309 void UnsignedChannelAnnouncement_free(struct LDKUnsignedChannelAnnouncement this_obj);
27310
27311 /**
27312  * The advertised channel features
27313  */
27314 struct LDKChannelFeatures UnsignedChannelAnnouncement_get_features(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
27315
27316 /**
27317  * The advertised channel features
27318  */
27319 void UnsignedChannelAnnouncement_set_features(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
27320
27321 /**
27322  * The genesis hash of the blockchain where the channel is to be opened
27323  */
27324 const uint8_t (*UnsignedChannelAnnouncement_get_chain_hash(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr))[32];
27325
27326 /**
27327  * The genesis hash of the blockchain where the channel is to be opened
27328  */
27329 void UnsignedChannelAnnouncement_set_chain_hash(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
27330
27331 /**
27332  * The short channel ID
27333  */
27334 uint64_t UnsignedChannelAnnouncement_get_short_channel_id(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
27335
27336 /**
27337  * The short channel ID
27338  */
27339 void UnsignedChannelAnnouncement_set_short_channel_id(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, uint64_t val);
27340
27341 /**
27342  * One of the two `node_id`s which are endpoints of this channel
27343  */
27344 struct LDKNodeId UnsignedChannelAnnouncement_get_node_id_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
27345
27346 /**
27347  * One of the two `node_id`s which are endpoints of this channel
27348  */
27349 void UnsignedChannelAnnouncement_set_node_id_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeId val);
27350
27351 /**
27352  * The other of the two `node_id`s which are endpoints of this channel
27353  */
27354 struct LDKNodeId UnsignedChannelAnnouncement_get_node_id_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
27355
27356 /**
27357  * The other of the two `node_id`s which are endpoints of this channel
27358  */
27359 void UnsignedChannelAnnouncement_set_node_id_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeId val);
27360
27361 /**
27362  * The funding key for the first node
27363  */
27364 struct LDKNodeId UnsignedChannelAnnouncement_get_bitcoin_key_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
27365
27366 /**
27367  * The funding key for the first node
27368  */
27369 void UnsignedChannelAnnouncement_set_bitcoin_key_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeId val);
27370
27371 /**
27372  * The funding key for the second node
27373  */
27374 struct LDKNodeId UnsignedChannelAnnouncement_get_bitcoin_key_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
27375
27376 /**
27377  * The funding key for the second node
27378  */
27379 void UnsignedChannelAnnouncement_set_bitcoin_key_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeId val);
27380
27381 /**
27382  * Creates a copy of the UnsignedChannelAnnouncement
27383  */
27384 struct LDKUnsignedChannelAnnouncement UnsignedChannelAnnouncement_clone(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR orig);
27385
27386 /**
27387  * Checks if two UnsignedChannelAnnouncements contain equal inner contents.
27388  * This ignores pointers and is_owned flags and looks at the values in fields.
27389  * Two objects with NULL inner values will be considered "equal" here.
27390  */
27391 bool UnsignedChannelAnnouncement_eq(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR a, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR b);
27392
27393 /**
27394  * Frees any resources used by the ChannelAnnouncement, if is_owned is set and inner is non-NULL.
27395  */
27396 void ChannelAnnouncement_free(struct LDKChannelAnnouncement this_obj);
27397
27398 /**
27399  * Authentication of the announcement by the first public node
27400  */
27401 struct LDKSignature ChannelAnnouncement_get_node_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
27402
27403 /**
27404  * Authentication of the announcement by the first public node
27405  */
27406 void ChannelAnnouncement_set_node_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
27407
27408 /**
27409  * Authentication of the announcement by the second public node
27410  */
27411 struct LDKSignature ChannelAnnouncement_get_node_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
27412
27413 /**
27414  * Authentication of the announcement by the second public node
27415  */
27416 void ChannelAnnouncement_set_node_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
27417
27418 /**
27419  * Proof of funding UTXO ownership by the first public node
27420  */
27421 struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
27422
27423 /**
27424  * Proof of funding UTXO ownership by the first public node
27425  */
27426 void ChannelAnnouncement_set_bitcoin_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
27427
27428 /**
27429  * Proof of funding UTXO ownership by the second public node
27430  */
27431 struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
27432
27433 /**
27434  * Proof of funding UTXO ownership by the second public node
27435  */
27436 void ChannelAnnouncement_set_bitcoin_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
27437
27438 /**
27439  * The actual announcement
27440  */
27441 struct LDKUnsignedChannelAnnouncement ChannelAnnouncement_get_contents(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
27442
27443 /**
27444  * The actual announcement
27445  */
27446 void ChannelAnnouncement_set_contents(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedChannelAnnouncement val);
27447
27448 /**
27449  * Constructs a new ChannelAnnouncement given each field
27450  */
27451 MUST_USE_RES struct LDKChannelAnnouncement ChannelAnnouncement_new(struct LDKSignature node_signature_1_arg, struct LDKSignature node_signature_2_arg, struct LDKSignature bitcoin_signature_1_arg, struct LDKSignature bitcoin_signature_2_arg, struct LDKUnsignedChannelAnnouncement contents_arg);
27452
27453 /**
27454  * Creates a copy of the ChannelAnnouncement
27455  */
27456 struct LDKChannelAnnouncement ChannelAnnouncement_clone(const struct LDKChannelAnnouncement *NONNULL_PTR orig);
27457
27458 /**
27459  * Checks if two ChannelAnnouncements contain equal inner contents.
27460  * This ignores pointers and is_owned flags and looks at the values in fields.
27461  * Two objects with NULL inner values will be considered "equal" here.
27462  */
27463 bool ChannelAnnouncement_eq(const struct LDKChannelAnnouncement *NONNULL_PTR a, const struct LDKChannelAnnouncement *NONNULL_PTR b);
27464
27465 /**
27466  * Frees any resources used by the UnsignedChannelUpdate, if is_owned is set and inner is non-NULL.
27467  */
27468 void UnsignedChannelUpdate_free(struct LDKUnsignedChannelUpdate this_obj);
27469
27470 /**
27471  * The genesis hash of the blockchain where the channel is to be opened
27472  */
27473 const uint8_t (*UnsignedChannelUpdate_get_chain_hash(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr))[32];
27474
27475 /**
27476  * The genesis hash of the blockchain where the channel is to be opened
27477  */
27478 void UnsignedChannelUpdate_set_chain_hash(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
27479
27480 /**
27481  * The short channel ID
27482  */
27483 uint64_t UnsignedChannelUpdate_get_short_channel_id(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
27484
27485 /**
27486  * The short channel ID
27487  */
27488 void UnsignedChannelUpdate_set_short_channel_id(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
27489
27490 /**
27491  * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
27492  */
27493 uint32_t UnsignedChannelUpdate_get_timestamp(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
27494
27495 /**
27496  * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
27497  */
27498 void UnsignedChannelUpdate_set_timestamp(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
27499
27500 /**
27501  * Channel flags
27502  */
27503 uint8_t UnsignedChannelUpdate_get_flags(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
27504
27505 /**
27506  * Channel flags
27507  */
27508 void UnsignedChannelUpdate_set_flags(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint8_t val);
27509
27510 /**
27511  * The number of blocks such that if:
27512  * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
27513  * then we need to fail the HTLC backwards. When forwarding an HTLC, `cltv_expiry_delta` determines
27514  * the outgoing HTLC's minimum `cltv_expiry` value -- so, if an incoming HTLC comes in with a
27515  * `cltv_expiry` of 100000, and the node we're forwarding to has a `cltv_expiry_delta` value of 10,
27516  * then we'll check that the outgoing HTLC's `cltv_expiry` value is at least 100010 before
27517  * forwarding. Note that the HTLC sender is the one who originally sets this value when
27518  * constructing the route.
27519  */
27520 uint16_t UnsignedChannelUpdate_get_cltv_expiry_delta(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
27521
27522 /**
27523  * The number of blocks such that if:
27524  * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
27525  * then we need to fail the HTLC backwards. When forwarding an HTLC, `cltv_expiry_delta` determines
27526  * the outgoing HTLC's minimum `cltv_expiry` value -- so, if an incoming HTLC comes in with a
27527  * `cltv_expiry` of 100000, and the node we're forwarding to has a `cltv_expiry_delta` value of 10,
27528  * then we'll check that the outgoing HTLC's `cltv_expiry` value is at least 100010 before
27529  * forwarding. Note that the HTLC sender is the one who originally sets this value when
27530  * constructing the route.
27531  */
27532 void UnsignedChannelUpdate_set_cltv_expiry_delta(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint16_t val);
27533
27534 /**
27535  * The minimum HTLC size incoming to sender, in milli-satoshi
27536  */
27537 uint64_t UnsignedChannelUpdate_get_htlc_minimum_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
27538
27539 /**
27540  * The minimum HTLC size incoming to sender, in milli-satoshi
27541  */
27542 void UnsignedChannelUpdate_set_htlc_minimum_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
27543
27544 /**
27545  * The maximum HTLC value incoming to sender, in milli-satoshi.
27546  *
27547  * This used to be optional.
27548  */
27549 uint64_t UnsignedChannelUpdate_get_htlc_maximum_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
27550
27551 /**
27552  * The maximum HTLC value incoming to sender, in milli-satoshi.
27553  *
27554  * This used to be optional.
27555  */
27556 void UnsignedChannelUpdate_set_htlc_maximum_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
27557
27558 /**
27559  * The base HTLC fee charged by sender, in milli-satoshi
27560  */
27561 uint32_t UnsignedChannelUpdate_get_fee_base_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
27562
27563 /**
27564  * The base HTLC fee charged by sender, in milli-satoshi
27565  */
27566 void UnsignedChannelUpdate_set_fee_base_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
27567
27568 /**
27569  * The amount to fee multiplier, in micro-satoshi
27570  */
27571 uint32_t UnsignedChannelUpdate_get_fee_proportional_millionths(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
27572
27573 /**
27574  * The amount to fee multiplier, in micro-satoshi
27575  */
27576 void UnsignedChannelUpdate_set_fee_proportional_millionths(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
27577
27578 /**
27579  * Excess data which was signed as a part of the message which we do not (yet) understand how
27580  * to decode.
27581  *
27582  * This is stored to ensure forward-compatibility as new fields are added to the lightning gossip protocol.
27583  *
27584  * Returns a copy of the field.
27585  */
27586 struct LDKCVec_u8Z UnsignedChannelUpdate_get_excess_data(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
27587
27588 /**
27589  * Excess data which was signed as a part of the message which we do not (yet) understand how
27590  * to decode.
27591  *
27592  * This is stored to ensure forward-compatibility as new fields are added to the lightning gossip protocol.
27593  */
27594 void UnsignedChannelUpdate_set_excess_data(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
27595
27596 /**
27597  * Constructs a new UnsignedChannelUpdate given each field
27598  */
27599 MUST_USE_RES struct LDKUnsignedChannelUpdate UnsignedChannelUpdate_new(struct LDKThirtyTwoBytes chain_hash_arg, uint64_t short_channel_id_arg, uint32_t timestamp_arg, uint8_t flags_arg, uint16_t cltv_expiry_delta_arg, uint64_t htlc_minimum_msat_arg, uint64_t htlc_maximum_msat_arg, uint32_t fee_base_msat_arg, uint32_t fee_proportional_millionths_arg, struct LDKCVec_u8Z excess_data_arg);
27600
27601 /**
27602  * Creates a copy of the UnsignedChannelUpdate
27603  */
27604 struct LDKUnsignedChannelUpdate UnsignedChannelUpdate_clone(const struct LDKUnsignedChannelUpdate *NONNULL_PTR orig);
27605
27606 /**
27607  * Checks if two UnsignedChannelUpdates contain equal inner contents.
27608  * This ignores pointers and is_owned flags and looks at the values in fields.
27609  * Two objects with NULL inner values will be considered "equal" here.
27610  */
27611 bool UnsignedChannelUpdate_eq(const struct LDKUnsignedChannelUpdate *NONNULL_PTR a, const struct LDKUnsignedChannelUpdate *NONNULL_PTR b);
27612
27613 /**
27614  * Frees any resources used by the ChannelUpdate, if is_owned is set and inner is non-NULL.
27615  */
27616 void ChannelUpdate_free(struct LDKChannelUpdate this_obj);
27617
27618 /**
27619  * A signature of the channel update
27620  */
27621 struct LDKSignature ChannelUpdate_get_signature(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
27622
27623 /**
27624  * A signature of the channel update
27625  */
27626 void ChannelUpdate_set_signature(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKSignature val);
27627
27628 /**
27629  * The actual channel update
27630  */
27631 struct LDKUnsignedChannelUpdate ChannelUpdate_get_contents(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
27632
27633 /**
27634  * The actual channel update
27635  */
27636 void ChannelUpdate_set_contents(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKUnsignedChannelUpdate val);
27637
27638 /**
27639  * Constructs a new ChannelUpdate given each field
27640  */
27641 MUST_USE_RES struct LDKChannelUpdate ChannelUpdate_new(struct LDKSignature signature_arg, struct LDKUnsignedChannelUpdate contents_arg);
27642
27643 /**
27644  * Creates a copy of the ChannelUpdate
27645  */
27646 struct LDKChannelUpdate ChannelUpdate_clone(const struct LDKChannelUpdate *NONNULL_PTR orig);
27647
27648 /**
27649  * Checks if two ChannelUpdates contain equal inner contents.
27650  * This ignores pointers and is_owned flags and looks at the values in fields.
27651  * Two objects with NULL inner values will be considered "equal" here.
27652  */
27653 bool ChannelUpdate_eq(const struct LDKChannelUpdate *NONNULL_PTR a, const struct LDKChannelUpdate *NONNULL_PTR b);
27654
27655 /**
27656  * Frees any resources used by the QueryChannelRange, if is_owned is set and inner is non-NULL.
27657  */
27658 void QueryChannelRange_free(struct LDKQueryChannelRange this_obj);
27659
27660 /**
27661  * The genesis hash of the blockchain being queried
27662  */
27663 const uint8_t (*QueryChannelRange_get_chain_hash(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr))[32];
27664
27665 /**
27666  * The genesis hash of the blockchain being queried
27667  */
27668 void QueryChannelRange_set_chain_hash(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
27669
27670 /**
27671  * The height of the first block for the channel UTXOs being queried
27672  */
27673 uint32_t QueryChannelRange_get_first_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
27674
27675 /**
27676  * The height of the first block for the channel UTXOs being queried
27677  */
27678 void QueryChannelRange_set_first_blocknum(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
27679
27680 /**
27681  * The number of blocks to include in the query results
27682  */
27683 uint32_t QueryChannelRange_get_number_of_blocks(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
27684
27685 /**
27686  * The number of blocks to include in the query results
27687  */
27688 void QueryChannelRange_set_number_of_blocks(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
27689
27690 /**
27691  * Constructs a new QueryChannelRange given each field
27692  */
27693 MUST_USE_RES struct LDKQueryChannelRange QueryChannelRange_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_blocknum_arg, uint32_t number_of_blocks_arg);
27694
27695 /**
27696  * Creates a copy of the QueryChannelRange
27697  */
27698 struct LDKQueryChannelRange QueryChannelRange_clone(const struct LDKQueryChannelRange *NONNULL_PTR orig);
27699
27700 /**
27701  * Checks if two QueryChannelRanges contain equal inner contents.
27702  * This ignores pointers and is_owned flags and looks at the values in fields.
27703  * Two objects with NULL inner values will be considered "equal" here.
27704  */
27705 bool QueryChannelRange_eq(const struct LDKQueryChannelRange *NONNULL_PTR a, const struct LDKQueryChannelRange *NONNULL_PTR b);
27706
27707 /**
27708  * Frees any resources used by the ReplyChannelRange, if is_owned is set and inner is non-NULL.
27709  */
27710 void ReplyChannelRange_free(struct LDKReplyChannelRange this_obj);
27711
27712 /**
27713  * The genesis hash of the blockchain being queried
27714  */
27715 const uint8_t (*ReplyChannelRange_get_chain_hash(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr))[32];
27716
27717 /**
27718  * The genesis hash of the blockchain being queried
27719  */
27720 void ReplyChannelRange_set_chain_hash(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
27721
27722 /**
27723  * The height of the first block in the range of the reply
27724  */
27725 uint32_t ReplyChannelRange_get_first_blocknum(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
27726
27727 /**
27728  * The height of the first block in the range of the reply
27729  */
27730 void ReplyChannelRange_set_first_blocknum(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
27731
27732 /**
27733  * The number of blocks included in the range of the reply
27734  */
27735 uint32_t ReplyChannelRange_get_number_of_blocks(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
27736
27737 /**
27738  * The number of blocks included in the range of the reply
27739  */
27740 void ReplyChannelRange_set_number_of_blocks(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
27741
27742 /**
27743  * True when this is the final reply for a query
27744  */
27745 bool ReplyChannelRange_get_sync_complete(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
27746
27747 /**
27748  * True when this is the final reply for a query
27749  */
27750 void ReplyChannelRange_set_sync_complete(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, bool val);
27751
27752 /**
27753  * The `short_channel_id`s in the channel range
27754  *
27755  * Returns a copy of the field.
27756  */
27757 struct LDKCVec_u64Z ReplyChannelRange_get_short_channel_ids(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
27758
27759 /**
27760  * The `short_channel_id`s in the channel range
27761  */
27762 void ReplyChannelRange_set_short_channel_ids(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
27763
27764 /**
27765  * Constructs a new ReplyChannelRange given each field
27766  */
27767 MUST_USE_RES struct LDKReplyChannelRange ReplyChannelRange_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_blocknum_arg, uint32_t number_of_blocks_arg, bool sync_complete_arg, struct LDKCVec_u64Z short_channel_ids_arg);
27768
27769 /**
27770  * Creates a copy of the ReplyChannelRange
27771  */
27772 struct LDKReplyChannelRange ReplyChannelRange_clone(const struct LDKReplyChannelRange *NONNULL_PTR orig);
27773
27774 /**
27775  * Checks if two ReplyChannelRanges contain equal inner contents.
27776  * This ignores pointers and is_owned flags and looks at the values in fields.
27777  * Two objects with NULL inner values will be considered "equal" here.
27778  */
27779 bool ReplyChannelRange_eq(const struct LDKReplyChannelRange *NONNULL_PTR a, const struct LDKReplyChannelRange *NONNULL_PTR b);
27780
27781 /**
27782  * Frees any resources used by the QueryShortChannelIds, if is_owned is set and inner is non-NULL.
27783  */
27784 void QueryShortChannelIds_free(struct LDKQueryShortChannelIds this_obj);
27785
27786 /**
27787  * The genesis hash of the blockchain being queried
27788  */
27789 const uint8_t (*QueryShortChannelIds_get_chain_hash(const struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr))[32];
27790
27791 /**
27792  * The genesis hash of the blockchain being queried
27793  */
27794 void QueryShortChannelIds_set_chain_hash(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
27795
27796 /**
27797  * The short_channel_ids that are being queried
27798  *
27799  * Returns a copy of the field.
27800  */
27801 struct LDKCVec_u64Z QueryShortChannelIds_get_short_channel_ids(const struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr);
27802
27803 /**
27804  * The short_channel_ids that are being queried
27805  */
27806 void QueryShortChannelIds_set_short_channel_ids(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
27807
27808 /**
27809  * Constructs a new QueryShortChannelIds given each field
27810  */
27811 MUST_USE_RES struct LDKQueryShortChannelIds QueryShortChannelIds_new(struct LDKThirtyTwoBytes chain_hash_arg, struct LDKCVec_u64Z short_channel_ids_arg);
27812
27813 /**
27814  * Creates a copy of the QueryShortChannelIds
27815  */
27816 struct LDKQueryShortChannelIds QueryShortChannelIds_clone(const struct LDKQueryShortChannelIds *NONNULL_PTR orig);
27817
27818 /**
27819  * Checks if two QueryShortChannelIdss contain equal inner contents.
27820  * This ignores pointers and is_owned flags and looks at the values in fields.
27821  * Two objects with NULL inner values will be considered "equal" here.
27822  */
27823 bool QueryShortChannelIds_eq(const struct LDKQueryShortChannelIds *NONNULL_PTR a, const struct LDKQueryShortChannelIds *NONNULL_PTR b);
27824
27825 /**
27826  * Frees any resources used by the ReplyShortChannelIdsEnd, if is_owned is set and inner is non-NULL.
27827  */
27828 void ReplyShortChannelIdsEnd_free(struct LDKReplyShortChannelIdsEnd this_obj);
27829
27830 /**
27831  * The genesis hash of the blockchain that was queried
27832  */
27833 const uint8_t (*ReplyShortChannelIdsEnd_get_chain_hash(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr))[32];
27834
27835 /**
27836  * The genesis hash of the blockchain that was queried
27837  */
27838 void ReplyShortChannelIdsEnd_set_chain_hash(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
27839
27840 /**
27841  * Indicates if the query recipient maintains up-to-date channel
27842  * information for the `chain_hash`
27843  */
27844 bool ReplyShortChannelIdsEnd_get_full_information(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr);
27845
27846 /**
27847  * Indicates if the query recipient maintains up-to-date channel
27848  * information for the `chain_hash`
27849  */
27850 void ReplyShortChannelIdsEnd_set_full_information(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, bool val);
27851
27852 /**
27853  * Constructs a new ReplyShortChannelIdsEnd given each field
27854  */
27855 MUST_USE_RES struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_new(struct LDKThirtyTwoBytes chain_hash_arg, bool full_information_arg);
27856
27857 /**
27858  * Creates a copy of the ReplyShortChannelIdsEnd
27859  */
27860 struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_clone(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR orig);
27861
27862 /**
27863  * Checks if two ReplyShortChannelIdsEnds contain equal inner contents.
27864  * This ignores pointers and is_owned flags and looks at the values in fields.
27865  * Two objects with NULL inner values will be considered "equal" here.
27866  */
27867 bool ReplyShortChannelIdsEnd_eq(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR a, const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR b);
27868
27869 /**
27870  * Frees any resources used by the GossipTimestampFilter, if is_owned is set and inner is non-NULL.
27871  */
27872 void GossipTimestampFilter_free(struct LDKGossipTimestampFilter this_obj);
27873
27874 /**
27875  * The genesis hash of the blockchain for channel and node information
27876  */
27877 const uint8_t (*GossipTimestampFilter_get_chain_hash(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr))[32];
27878
27879 /**
27880  * The genesis hash of the blockchain for channel and node information
27881  */
27882 void GossipTimestampFilter_set_chain_hash(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
27883
27884 /**
27885  * The starting unix timestamp
27886  */
27887 uint32_t GossipTimestampFilter_get_first_timestamp(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
27888
27889 /**
27890  * The starting unix timestamp
27891  */
27892 void GossipTimestampFilter_set_first_timestamp(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
27893
27894 /**
27895  * The range of information in seconds
27896  */
27897 uint32_t GossipTimestampFilter_get_timestamp_range(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
27898
27899 /**
27900  * The range of information in seconds
27901  */
27902 void GossipTimestampFilter_set_timestamp_range(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
27903
27904 /**
27905  * Constructs a new GossipTimestampFilter given each field
27906  */
27907 MUST_USE_RES struct LDKGossipTimestampFilter GossipTimestampFilter_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_timestamp_arg, uint32_t timestamp_range_arg);
27908
27909 /**
27910  * Creates a copy of the GossipTimestampFilter
27911  */
27912 struct LDKGossipTimestampFilter GossipTimestampFilter_clone(const struct LDKGossipTimestampFilter *NONNULL_PTR orig);
27913
27914 /**
27915  * Checks if two GossipTimestampFilters contain equal inner contents.
27916  * This ignores pointers and is_owned flags and looks at the values in fields.
27917  * Two objects with NULL inner values will be considered "equal" here.
27918  */
27919 bool GossipTimestampFilter_eq(const struct LDKGossipTimestampFilter *NONNULL_PTR a, const struct LDKGossipTimestampFilter *NONNULL_PTR b);
27920
27921 /**
27922  * Frees any resources used by the ErrorAction
27923  */
27924 void ErrorAction_free(struct LDKErrorAction this_ptr);
27925
27926 /**
27927  * Creates a copy of the ErrorAction
27928  */
27929 struct LDKErrorAction ErrorAction_clone(const struct LDKErrorAction *NONNULL_PTR orig);
27930
27931 /**
27932  * Utility method to constructs a new DisconnectPeer-variant ErrorAction
27933  */
27934 struct LDKErrorAction ErrorAction_disconnect_peer(struct LDKErrorMessage msg);
27935
27936 /**
27937  * Utility method to constructs a new IgnoreError-variant ErrorAction
27938  */
27939 struct LDKErrorAction ErrorAction_ignore_error(void);
27940
27941 /**
27942  * Utility method to constructs a new IgnoreAndLog-variant ErrorAction
27943  */
27944 struct LDKErrorAction ErrorAction_ignore_and_log(enum LDKLevel a);
27945
27946 /**
27947  * Utility method to constructs a new IgnoreDuplicateGossip-variant ErrorAction
27948  */
27949 struct LDKErrorAction ErrorAction_ignore_duplicate_gossip(void);
27950
27951 /**
27952  * Utility method to constructs a new SendErrorMessage-variant ErrorAction
27953  */
27954 struct LDKErrorAction ErrorAction_send_error_message(struct LDKErrorMessage msg);
27955
27956 /**
27957  * Utility method to constructs a new SendWarningMessage-variant ErrorAction
27958  */
27959 struct LDKErrorAction ErrorAction_send_warning_message(struct LDKWarningMessage msg, enum LDKLevel log_level);
27960
27961 /**
27962  * Frees any resources used by the LightningError, if is_owned is set and inner is non-NULL.
27963  */
27964 void LightningError_free(struct LDKLightningError this_obj);
27965
27966 /**
27967  * A human-readable message describing the error
27968  */
27969 struct LDKStr LightningError_get_err(const struct LDKLightningError *NONNULL_PTR this_ptr);
27970
27971 /**
27972  * A human-readable message describing the error
27973  */
27974 void LightningError_set_err(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKStr val);
27975
27976 /**
27977  * The action which should be taken against the offending peer.
27978  */
27979 struct LDKErrorAction LightningError_get_action(const struct LDKLightningError *NONNULL_PTR this_ptr);
27980
27981 /**
27982  * The action which should be taken against the offending peer.
27983  */
27984 void LightningError_set_action(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKErrorAction val);
27985
27986 /**
27987  * Constructs a new LightningError given each field
27988  */
27989 MUST_USE_RES struct LDKLightningError LightningError_new(struct LDKStr err_arg, struct LDKErrorAction action_arg);
27990
27991 /**
27992  * Creates a copy of the LightningError
27993  */
27994 struct LDKLightningError LightningError_clone(const struct LDKLightningError *NONNULL_PTR orig);
27995
27996 /**
27997  * Frees any resources used by the CommitmentUpdate, if is_owned is set and inner is non-NULL.
27998  */
27999 void CommitmentUpdate_free(struct LDKCommitmentUpdate this_obj);
28000
28001 /**
28002  * `update_add_htlc` messages which should be sent
28003  */
28004 struct LDKCVec_UpdateAddHTLCZ CommitmentUpdate_get_update_add_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
28005
28006 /**
28007  * `update_add_htlc` messages which should be sent
28008  */
28009 void CommitmentUpdate_set_update_add_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateAddHTLCZ val);
28010
28011 /**
28012  * `update_fulfill_htlc` messages which should be sent
28013  */
28014 struct LDKCVec_UpdateFulfillHTLCZ CommitmentUpdate_get_update_fulfill_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
28015
28016 /**
28017  * `update_fulfill_htlc` messages which should be sent
28018  */
28019 void CommitmentUpdate_set_update_fulfill_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFulfillHTLCZ val);
28020
28021 /**
28022  * `update_fail_htlc` messages which should be sent
28023  */
28024 struct LDKCVec_UpdateFailHTLCZ CommitmentUpdate_get_update_fail_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
28025
28026 /**
28027  * `update_fail_htlc` messages which should be sent
28028  */
28029 void CommitmentUpdate_set_update_fail_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailHTLCZ val);
28030
28031 /**
28032  * `update_fail_malformed_htlc` messages which should be sent
28033  */
28034 struct LDKCVec_UpdateFailMalformedHTLCZ CommitmentUpdate_get_update_fail_malformed_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
28035
28036 /**
28037  * `update_fail_malformed_htlc` messages which should be sent
28038  */
28039 void CommitmentUpdate_set_update_fail_malformed_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailMalformedHTLCZ val);
28040
28041 /**
28042  * An `update_fee` message which should be sent
28043  *
28044  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
28045  */
28046 struct LDKUpdateFee CommitmentUpdate_get_update_fee(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
28047
28048 /**
28049  * An `update_fee` message which should be sent
28050  *
28051  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
28052  */
28053 void CommitmentUpdate_set_update_fee(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKUpdateFee val);
28054
28055 /**
28056  * A `commitment_signed` message which should be sent
28057  */
28058 struct LDKCommitmentSigned CommitmentUpdate_get_commitment_signed(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
28059
28060 /**
28061  * A `commitment_signed` message which should be sent
28062  */
28063 void CommitmentUpdate_set_commitment_signed(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCommitmentSigned val);
28064
28065 /**
28066  * Constructs a new CommitmentUpdate given each field
28067  */
28068 MUST_USE_RES struct LDKCommitmentUpdate CommitmentUpdate_new(struct LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg, struct LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg, struct LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg, struct LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg, struct LDKUpdateFee update_fee_arg, struct LDKCommitmentSigned commitment_signed_arg);
28069
28070 /**
28071  * Creates a copy of the CommitmentUpdate
28072  */
28073 struct LDKCommitmentUpdate CommitmentUpdate_clone(const struct LDKCommitmentUpdate *NONNULL_PTR orig);
28074
28075 /**
28076  * Checks if two CommitmentUpdates contain equal inner contents.
28077  * This ignores pointers and is_owned flags and looks at the values in fields.
28078  * Two objects with NULL inner values will be considered "equal" here.
28079  */
28080 bool CommitmentUpdate_eq(const struct LDKCommitmentUpdate *NONNULL_PTR a, const struct LDKCommitmentUpdate *NONNULL_PTR b);
28081
28082 /**
28083  * Calls the free function if one is set
28084  */
28085 void ChannelMessageHandler_free(struct LDKChannelMessageHandler this_ptr);
28086
28087 /**
28088  * Calls the free function if one is set
28089  */
28090 void RoutingMessageHandler_free(struct LDKRoutingMessageHandler this_ptr);
28091
28092 /**
28093  * Calls the free function if one is set
28094  */
28095 void OnionMessageHandler_free(struct LDKOnionMessageHandler this_ptr);
28096
28097 /**
28098  * Serialize the AcceptChannel object into a byte array which can be read by AcceptChannel_read
28099  */
28100 struct LDKCVec_u8Z AcceptChannel_write(const struct LDKAcceptChannel *NONNULL_PTR obj);
28101
28102 /**
28103  * Read a AcceptChannel from a byte array, created by AcceptChannel_write
28104  */
28105 struct LDKCResult_AcceptChannelDecodeErrorZ AcceptChannel_read(struct LDKu8slice ser);
28106
28107 /**
28108  * Serialize the AnnouncementSignatures object into a byte array which can be read by AnnouncementSignatures_read
28109  */
28110 struct LDKCVec_u8Z AnnouncementSignatures_write(const struct LDKAnnouncementSignatures *NONNULL_PTR obj);
28111
28112 /**
28113  * Read a AnnouncementSignatures from a byte array, created by AnnouncementSignatures_write
28114  */
28115 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ AnnouncementSignatures_read(struct LDKu8slice ser);
28116
28117 /**
28118  * Serialize the ChannelReestablish object into a byte array which can be read by ChannelReestablish_read
28119  */
28120 struct LDKCVec_u8Z ChannelReestablish_write(const struct LDKChannelReestablish *NONNULL_PTR obj);
28121
28122 /**
28123  * Read a ChannelReestablish from a byte array, created by ChannelReestablish_write
28124  */
28125 struct LDKCResult_ChannelReestablishDecodeErrorZ ChannelReestablish_read(struct LDKu8slice ser);
28126
28127 /**
28128  * Serialize the ClosingSigned object into a byte array which can be read by ClosingSigned_read
28129  */
28130 struct LDKCVec_u8Z ClosingSigned_write(const struct LDKClosingSigned *NONNULL_PTR obj);
28131
28132 /**
28133  * Read a ClosingSigned from a byte array, created by ClosingSigned_write
28134  */
28135 struct LDKCResult_ClosingSignedDecodeErrorZ ClosingSigned_read(struct LDKu8slice ser);
28136
28137 /**
28138  * Serialize the ClosingSignedFeeRange object into a byte array which can be read by ClosingSignedFeeRange_read
28139  */
28140 struct LDKCVec_u8Z ClosingSignedFeeRange_write(const struct LDKClosingSignedFeeRange *NONNULL_PTR obj);
28141
28142 /**
28143  * Read a ClosingSignedFeeRange from a byte array, created by ClosingSignedFeeRange_write
28144  */
28145 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ ClosingSignedFeeRange_read(struct LDKu8slice ser);
28146
28147 /**
28148  * Serialize the CommitmentSigned object into a byte array which can be read by CommitmentSigned_read
28149  */
28150 struct LDKCVec_u8Z CommitmentSigned_write(const struct LDKCommitmentSigned *NONNULL_PTR obj);
28151
28152 /**
28153  * Read a CommitmentSigned from a byte array, created by CommitmentSigned_write
28154  */
28155 struct LDKCResult_CommitmentSignedDecodeErrorZ CommitmentSigned_read(struct LDKu8slice ser);
28156
28157 /**
28158  * Serialize the FundingCreated object into a byte array which can be read by FundingCreated_read
28159  */
28160 struct LDKCVec_u8Z FundingCreated_write(const struct LDKFundingCreated *NONNULL_PTR obj);
28161
28162 /**
28163  * Read a FundingCreated from a byte array, created by FundingCreated_write
28164  */
28165 struct LDKCResult_FundingCreatedDecodeErrorZ FundingCreated_read(struct LDKu8slice ser);
28166
28167 /**
28168  * Serialize the FundingSigned object into a byte array which can be read by FundingSigned_read
28169  */
28170 struct LDKCVec_u8Z FundingSigned_write(const struct LDKFundingSigned *NONNULL_PTR obj);
28171
28172 /**
28173  * Read a FundingSigned from a byte array, created by FundingSigned_write
28174  */
28175 struct LDKCResult_FundingSignedDecodeErrorZ FundingSigned_read(struct LDKu8slice ser);
28176
28177 /**
28178  * Serialize the ChannelReady object into a byte array which can be read by ChannelReady_read
28179  */
28180 struct LDKCVec_u8Z ChannelReady_write(const struct LDKChannelReady *NONNULL_PTR obj);
28181
28182 /**
28183  * Read a ChannelReady from a byte array, created by ChannelReady_write
28184  */
28185 struct LDKCResult_ChannelReadyDecodeErrorZ ChannelReady_read(struct LDKu8slice ser);
28186
28187 /**
28188  * Serialize the Init object into a byte array which can be read by Init_read
28189  */
28190 struct LDKCVec_u8Z Init_write(const struct LDKInit *NONNULL_PTR obj);
28191
28192 /**
28193  * Read a Init from a byte array, created by Init_write
28194  */
28195 struct LDKCResult_InitDecodeErrorZ Init_read(struct LDKu8slice ser);
28196
28197 /**
28198  * Serialize the OpenChannel object into a byte array which can be read by OpenChannel_read
28199  */
28200 struct LDKCVec_u8Z OpenChannel_write(const struct LDKOpenChannel *NONNULL_PTR obj);
28201
28202 /**
28203  * Read a OpenChannel from a byte array, created by OpenChannel_write
28204  */
28205 struct LDKCResult_OpenChannelDecodeErrorZ OpenChannel_read(struct LDKu8slice ser);
28206
28207 /**
28208  * Serialize the RevokeAndACK object into a byte array which can be read by RevokeAndACK_read
28209  */
28210 struct LDKCVec_u8Z RevokeAndACK_write(const struct LDKRevokeAndACK *NONNULL_PTR obj);
28211
28212 /**
28213  * Read a RevokeAndACK from a byte array, created by RevokeAndACK_write
28214  */
28215 struct LDKCResult_RevokeAndACKDecodeErrorZ RevokeAndACK_read(struct LDKu8slice ser);
28216
28217 /**
28218  * Serialize the Shutdown object into a byte array which can be read by Shutdown_read
28219  */
28220 struct LDKCVec_u8Z Shutdown_write(const struct LDKShutdown *NONNULL_PTR obj);
28221
28222 /**
28223  * Read a Shutdown from a byte array, created by Shutdown_write
28224  */
28225 struct LDKCResult_ShutdownDecodeErrorZ Shutdown_read(struct LDKu8slice ser);
28226
28227 /**
28228  * Serialize the UpdateFailHTLC object into a byte array which can be read by UpdateFailHTLC_read
28229  */
28230 struct LDKCVec_u8Z UpdateFailHTLC_write(const struct LDKUpdateFailHTLC *NONNULL_PTR obj);
28231
28232 /**
28233  * Read a UpdateFailHTLC from a byte array, created by UpdateFailHTLC_write
28234  */
28235 struct LDKCResult_UpdateFailHTLCDecodeErrorZ UpdateFailHTLC_read(struct LDKu8slice ser);
28236
28237 /**
28238  * Serialize the UpdateFailMalformedHTLC object into a byte array which can be read by UpdateFailMalformedHTLC_read
28239  */
28240 struct LDKCVec_u8Z UpdateFailMalformedHTLC_write(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR obj);
28241
28242 /**
28243  * Read a UpdateFailMalformedHTLC from a byte array, created by UpdateFailMalformedHTLC_write
28244  */
28245 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ UpdateFailMalformedHTLC_read(struct LDKu8slice ser);
28246
28247 /**
28248  * Serialize the UpdateFee object into a byte array which can be read by UpdateFee_read
28249  */
28250 struct LDKCVec_u8Z UpdateFee_write(const struct LDKUpdateFee *NONNULL_PTR obj);
28251
28252 /**
28253  * Read a UpdateFee from a byte array, created by UpdateFee_write
28254  */
28255 struct LDKCResult_UpdateFeeDecodeErrorZ UpdateFee_read(struct LDKu8slice ser);
28256
28257 /**
28258  * Serialize the UpdateFulfillHTLC object into a byte array which can be read by UpdateFulfillHTLC_read
28259  */
28260 struct LDKCVec_u8Z UpdateFulfillHTLC_write(const struct LDKUpdateFulfillHTLC *NONNULL_PTR obj);
28261
28262 /**
28263  * Read a UpdateFulfillHTLC from a byte array, created by UpdateFulfillHTLC_write
28264  */
28265 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ UpdateFulfillHTLC_read(struct LDKu8slice ser);
28266
28267 /**
28268  * Serialize the UpdateAddHTLC object into a byte array which can be read by UpdateAddHTLC_read
28269  */
28270 struct LDKCVec_u8Z UpdateAddHTLC_write(const struct LDKUpdateAddHTLC *NONNULL_PTR obj);
28271
28272 /**
28273  * Read a UpdateAddHTLC from a byte array, created by UpdateAddHTLC_write
28274  */
28275 struct LDKCResult_UpdateAddHTLCDecodeErrorZ UpdateAddHTLC_read(struct LDKu8slice ser);
28276
28277 /**
28278  * Read a OnionMessage from a byte array, created by OnionMessage_write
28279  */
28280 struct LDKCResult_OnionMessageDecodeErrorZ OnionMessage_read(struct LDKu8slice ser);
28281
28282 /**
28283  * Serialize the OnionMessage object into a byte array which can be read by OnionMessage_read
28284  */
28285 struct LDKCVec_u8Z OnionMessage_write(const struct LDKOnionMessage *NONNULL_PTR obj);
28286
28287 /**
28288  * Serialize the Ping object into a byte array which can be read by Ping_read
28289  */
28290 struct LDKCVec_u8Z Ping_write(const struct LDKPing *NONNULL_PTR obj);
28291
28292 /**
28293  * Read a Ping from a byte array, created by Ping_write
28294  */
28295 struct LDKCResult_PingDecodeErrorZ Ping_read(struct LDKu8slice ser);
28296
28297 /**
28298  * Serialize the Pong object into a byte array which can be read by Pong_read
28299  */
28300 struct LDKCVec_u8Z Pong_write(const struct LDKPong *NONNULL_PTR obj);
28301
28302 /**
28303  * Read a Pong from a byte array, created by Pong_write
28304  */
28305 struct LDKCResult_PongDecodeErrorZ Pong_read(struct LDKu8slice ser);
28306
28307 /**
28308  * Serialize the UnsignedChannelAnnouncement object into a byte array which can be read by UnsignedChannelAnnouncement_read
28309  */
28310 struct LDKCVec_u8Z UnsignedChannelAnnouncement_write(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR obj);
28311
28312 /**
28313  * Read a UnsignedChannelAnnouncement from a byte array, created by UnsignedChannelAnnouncement_write
28314  */
28315 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ UnsignedChannelAnnouncement_read(struct LDKu8slice ser);
28316
28317 /**
28318  * Serialize the ChannelAnnouncement object into a byte array which can be read by ChannelAnnouncement_read
28319  */
28320 struct LDKCVec_u8Z ChannelAnnouncement_write(const struct LDKChannelAnnouncement *NONNULL_PTR obj);
28321
28322 /**
28323  * Read a ChannelAnnouncement from a byte array, created by ChannelAnnouncement_write
28324  */
28325 struct LDKCResult_ChannelAnnouncementDecodeErrorZ ChannelAnnouncement_read(struct LDKu8slice ser);
28326
28327 /**
28328  * Serialize the UnsignedChannelUpdate object into a byte array which can be read by UnsignedChannelUpdate_read
28329  */
28330 struct LDKCVec_u8Z UnsignedChannelUpdate_write(const struct LDKUnsignedChannelUpdate *NONNULL_PTR obj);
28331
28332 /**
28333  * Read a UnsignedChannelUpdate from a byte array, created by UnsignedChannelUpdate_write
28334  */
28335 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ UnsignedChannelUpdate_read(struct LDKu8slice ser);
28336
28337 /**
28338  * Serialize the ChannelUpdate object into a byte array which can be read by ChannelUpdate_read
28339  */
28340 struct LDKCVec_u8Z ChannelUpdate_write(const struct LDKChannelUpdate *NONNULL_PTR obj);
28341
28342 /**
28343  * Read a ChannelUpdate from a byte array, created by ChannelUpdate_write
28344  */
28345 struct LDKCResult_ChannelUpdateDecodeErrorZ ChannelUpdate_read(struct LDKu8slice ser);
28346
28347 /**
28348  * Serialize the ErrorMessage object into a byte array which can be read by ErrorMessage_read
28349  */
28350 struct LDKCVec_u8Z ErrorMessage_write(const struct LDKErrorMessage *NONNULL_PTR obj);
28351
28352 /**
28353  * Read a ErrorMessage from a byte array, created by ErrorMessage_write
28354  */
28355 struct LDKCResult_ErrorMessageDecodeErrorZ ErrorMessage_read(struct LDKu8slice ser);
28356
28357 /**
28358  * Serialize the WarningMessage object into a byte array which can be read by WarningMessage_read
28359  */
28360 struct LDKCVec_u8Z WarningMessage_write(const struct LDKWarningMessage *NONNULL_PTR obj);
28361
28362 /**
28363  * Read a WarningMessage from a byte array, created by WarningMessage_write
28364  */
28365 struct LDKCResult_WarningMessageDecodeErrorZ WarningMessage_read(struct LDKu8slice ser);
28366
28367 /**
28368  * Serialize the UnsignedNodeAnnouncement object into a byte array which can be read by UnsignedNodeAnnouncement_read
28369  */
28370 struct LDKCVec_u8Z UnsignedNodeAnnouncement_write(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR obj);
28371
28372 /**
28373  * Read a UnsignedNodeAnnouncement from a byte array, created by UnsignedNodeAnnouncement_write
28374  */
28375 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ UnsignedNodeAnnouncement_read(struct LDKu8slice ser);
28376
28377 /**
28378  * Serialize the NodeAnnouncement object into a byte array which can be read by NodeAnnouncement_read
28379  */
28380 struct LDKCVec_u8Z NodeAnnouncement_write(const struct LDKNodeAnnouncement *NONNULL_PTR obj);
28381
28382 /**
28383  * Read a NodeAnnouncement from a byte array, created by NodeAnnouncement_write
28384  */
28385 struct LDKCResult_NodeAnnouncementDecodeErrorZ NodeAnnouncement_read(struct LDKu8slice ser);
28386
28387 /**
28388  * Read a QueryShortChannelIds from a byte array, created by QueryShortChannelIds_write
28389  */
28390 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ QueryShortChannelIds_read(struct LDKu8slice ser);
28391
28392 /**
28393  * Serialize the QueryShortChannelIds object into a byte array which can be read by QueryShortChannelIds_read
28394  */
28395 struct LDKCVec_u8Z QueryShortChannelIds_write(const struct LDKQueryShortChannelIds *NONNULL_PTR obj);
28396
28397 /**
28398  * Serialize the ReplyShortChannelIdsEnd object into a byte array which can be read by ReplyShortChannelIdsEnd_read
28399  */
28400 struct LDKCVec_u8Z ReplyShortChannelIdsEnd_write(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR obj);
28401
28402 /**
28403  * Read a ReplyShortChannelIdsEnd from a byte array, created by ReplyShortChannelIdsEnd_write
28404  */
28405 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ ReplyShortChannelIdsEnd_read(struct LDKu8slice ser);
28406
28407 /**
28408  * Calculates the overflow safe ending block height for the query.
28409  *
28410  * Overflow returns `0xffffffff`, otherwise returns `first_blocknum + number_of_blocks`.
28411  */
28412 MUST_USE_RES uint32_t QueryChannelRange_end_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_arg);
28413
28414 /**
28415  * Serialize the QueryChannelRange object into a byte array which can be read by QueryChannelRange_read
28416  */
28417 struct LDKCVec_u8Z QueryChannelRange_write(const struct LDKQueryChannelRange *NONNULL_PTR obj);
28418
28419 /**
28420  * Read a QueryChannelRange from a byte array, created by QueryChannelRange_write
28421  */
28422 struct LDKCResult_QueryChannelRangeDecodeErrorZ QueryChannelRange_read(struct LDKu8slice ser);
28423
28424 /**
28425  * Read a ReplyChannelRange from a byte array, created by ReplyChannelRange_write
28426  */
28427 struct LDKCResult_ReplyChannelRangeDecodeErrorZ ReplyChannelRange_read(struct LDKu8slice ser);
28428
28429 /**
28430  * Serialize the ReplyChannelRange object into a byte array which can be read by ReplyChannelRange_read
28431  */
28432 struct LDKCVec_u8Z ReplyChannelRange_write(const struct LDKReplyChannelRange *NONNULL_PTR obj);
28433
28434 /**
28435  * Serialize the GossipTimestampFilter object into a byte array which can be read by GossipTimestampFilter_read
28436  */
28437 struct LDKCVec_u8Z GossipTimestampFilter_write(const struct LDKGossipTimestampFilter *NONNULL_PTR obj);
28438
28439 /**
28440  * Read a GossipTimestampFilter from a byte array, created by GossipTimestampFilter_write
28441  */
28442 struct LDKCResult_GossipTimestampFilterDecodeErrorZ GossipTimestampFilter_read(struct LDKu8slice ser);
28443
28444 /**
28445  * Calls the free function if one is set
28446  */
28447 void CustomMessageHandler_free(struct LDKCustomMessageHandler this_ptr);
28448
28449 /**
28450  * Frees any resources used by the IgnoringMessageHandler, if is_owned is set and inner is non-NULL.
28451  */
28452 void IgnoringMessageHandler_free(struct LDKIgnoringMessageHandler this_obj);
28453
28454 /**
28455  * Constructs a new IgnoringMessageHandler given each field
28456  */
28457 MUST_USE_RES struct LDKIgnoringMessageHandler IgnoringMessageHandler_new(void);
28458
28459 /**
28460  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
28461  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
28462  */
28463 struct LDKMessageSendEventsProvider IgnoringMessageHandler_as_MessageSendEventsProvider(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
28464
28465 /**
28466  * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg.
28467  * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is
28468  */
28469 struct LDKRoutingMessageHandler IgnoringMessageHandler_as_RoutingMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
28470
28471 /**
28472  * Constructs a new OnionMessageProvider which calls the relevant methods on this_arg.
28473  * This copies the `inner` pointer in this_arg and thus the returned OnionMessageProvider must be freed before this_arg is
28474  */
28475 struct LDKOnionMessageProvider IgnoringMessageHandler_as_OnionMessageProvider(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
28476
28477 /**
28478  * Constructs a new OnionMessageHandler which calls the relevant methods on this_arg.
28479  * This copies the `inner` pointer in this_arg and thus the returned OnionMessageHandler must be freed before this_arg is
28480  */
28481 struct LDKOnionMessageHandler IgnoringMessageHandler_as_OnionMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
28482
28483 /**
28484  * Constructs a new CustomOnionMessageHandler which calls the relevant methods on this_arg.
28485  * This copies the `inner` pointer in this_arg and thus the returned CustomOnionMessageHandler must be freed before this_arg is
28486  */
28487 struct LDKCustomOnionMessageHandler IgnoringMessageHandler_as_CustomOnionMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
28488
28489 /**
28490  * Constructs a new CustomMessageReader which calls the relevant methods on this_arg.
28491  * This copies the `inner` pointer in this_arg and thus the returned CustomMessageReader must be freed before this_arg is
28492  */
28493 struct LDKCustomMessageReader IgnoringMessageHandler_as_CustomMessageReader(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
28494
28495 /**
28496  * Constructs a new CustomMessageHandler which calls the relevant methods on this_arg.
28497  * This copies the `inner` pointer in this_arg and thus the returned CustomMessageHandler must be freed before this_arg is
28498  */
28499 struct LDKCustomMessageHandler IgnoringMessageHandler_as_CustomMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
28500
28501 /**
28502  * Frees any resources used by the ErroringMessageHandler, if is_owned is set and inner is non-NULL.
28503  */
28504 void ErroringMessageHandler_free(struct LDKErroringMessageHandler this_obj);
28505
28506 /**
28507  * Constructs a new ErroringMessageHandler
28508  */
28509 MUST_USE_RES struct LDKErroringMessageHandler ErroringMessageHandler_new(void);
28510
28511 /**
28512  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
28513  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
28514  */
28515 struct LDKMessageSendEventsProvider ErroringMessageHandler_as_MessageSendEventsProvider(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg);
28516
28517 /**
28518  * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg.
28519  * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is
28520  */
28521 struct LDKChannelMessageHandler ErroringMessageHandler_as_ChannelMessageHandler(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg);
28522
28523 /**
28524  * Frees any resources used by the MessageHandler, if is_owned is set and inner is non-NULL.
28525  */
28526 void MessageHandler_free(struct LDKMessageHandler this_obj);
28527
28528 /**
28529  * A message handler which handles messages specific to channels. Usually this is just a
28530  * [`ChannelManager`] object or an [`ErroringMessageHandler`].
28531  *
28532  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
28533  */
28534 const struct LDKChannelMessageHandler *MessageHandler_get_chan_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
28535
28536 /**
28537  * A message handler which handles messages specific to channels. Usually this is just a
28538  * [`ChannelManager`] object or an [`ErroringMessageHandler`].
28539  *
28540  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
28541  */
28542 void MessageHandler_set_chan_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKChannelMessageHandler val);
28543
28544 /**
28545  * A message handler which handles messages updating our knowledge of the network channel
28546  * graph. Usually this is just a [`P2PGossipSync`] object or an [`IgnoringMessageHandler`].
28547  *
28548  * [`P2PGossipSync`]: crate::routing::gossip::P2PGossipSync
28549  */
28550 const struct LDKRoutingMessageHandler *MessageHandler_get_route_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
28551
28552 /**
28553  * A message handler which handles messages updating our knowledge of the network channel
28554  * graph. Usually this is just a [`P2PGossipSync`] object or an [`IgnoringMessageHandler`].
28555  *
28556  * [`P2PGossipSync`]: crate::routing::gossip::P2PGossipSync
28557  */
28558 void MessageHandler_set_route_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKRoutingMessageHandler val);
28559
28560 /**
28561  * A message handler which handles onion messages. For now, this can only be an
28562  * [`IgnoringMessageHandler`].
28563  */
28564 const struct LDKOnionMessageHandler *MessageHandler_get_onion_message_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
28565
28566 /**
28567  * A message handler which handles onion messages. For now, this can only be an
28568  * [`IgnoringMessageHandler`].
28569  */
28570 void MessageHandler_set_onion_message_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKOnionMessageHandler val);
28571
28572 /**
28573  * Constructs a new MessageHandler given each field
28574  */
28575 MUST_USE_RES struct LDKMessageHandler MessageHandler_new(struct LDKChannelMessageHandler chan_handler_arg, struct LDKRoutingMessageHandler route_handler_arg, struct LDKOnionMessageHandler onion_message_handler_arg);
28576
28577 /**
28578  * Creates a copy of a SocketDescriptor
28579  */
28580 struct LDKSocketDescriptor SocketDescriptor_clone(const struct LDKSocketDescriptor *NONNULL_PTR orig);
28581
28582 /**
28583  * Calls the free function if one is set
28584  */
28585 void SocketDescriptor_free(struct LDKSocketDescriptor this_ptr);
28586
28587 /**
28588  * Frees any resources used by the PeerHandleError, if is_owned is set and inner is non-NULL.
28589  */
28590 void PeerHandleError_free(struct LDKPeerHandleError this_obj);
28591
28592 /**
28593  * Constructs a new PeerHandleError given each field
28594  */
28595 MUST_USE_RES struct LDKPeerHandleError PeerHandleError_new(void);
28596
28597 /**
28598  * Creates a copy of the PeerHandleError
28599  */
28600 struct LDKPeerHandleError PeerHandleError_clone(const struct LDKPeerHandleError *NONNULL_PTR orig);
28601
28602 /**
28603  * Frees any resources used by the PeerManager, if is_owned is set and inner is non-NULL.
28604  */
28605 void PeerManager_free(struct LDKPeerManager this_obj);
28606
28607 /**
28608  * Constructs a new `PeerManager` with the given message handlers.
28609  *
28610  * `ephemeral_random_data` is used to derive per-connection ephemeral keys and must be
28611  * cryptographically secure random bytes.
28612  *
28613  * `current_time` is used as an always-increasing counter that survives across restarts and is
28614  * incremented irregularly internally. In general it is best to simply use the current UNIX
28615  * timestamp, however if it is not available a persistent counter that increases once per
28616  * minute should suffice.
28617  */
28618 MUST_USE_RES struct LDKPeerManager PeerManager_new(struct LDKMessageHandler message_handler, uint32_t current_time, const uint8_t (*ephemeral_random_data)[32], struct LDKLogger logger, struct LDKCustomMessageHandler custom_message_handler, struct LDKNodeSigner node_signer);
28619
28620 /**
28621  * Get a list of tuples mapping from node id to network addresses for peers which have
28622  * completed the initial handshake.
28623  *
28624  * For outbound connections, the [`PublicKey`] will be the same as the `their_node_id` parameter
28625  * passed in to [`Self::new_outbound_connection`], however entries will only appear once the initial
28626  * handshake has completed and we are sure the remote peer has the private key for the given
28627  * [`PublicKey`].
28628  *
28629  * The returned `Option`s will only be `Some` if an address had been previously given via
28630  * [`Self::new_outbound_connection`] or [`Self::new_inbound_connection`].
28631  */
28632 MUST_USE_RES struct LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ PeerManager_get_peer_node_ids(const struct LDKPeerManager *NONNULL_PTR this_arg);
28633
28634 /**
28635  * Indicates a new outbound connection has been established to a node with the given `node_id`
28636  * and an optional remote network address.
28637  *
28638  * The remote network address adds the option to report a remote IP address back to a connecting
28639  * peer using the init message.
28640  * The user should pass the remote network address of the host they are connected to.
28641  *
28642  * If an `Err` is returned here you must disconnect the connection immediately.
28643  *
28644  * Returns a small number of bytes to send to the remote node (currently always 50).
28645  *
28646  * Panics if descriptor is duplicative with some other descriptor which has not yet been
28647  * [`socket_disconnected`].
28648  *
28649  * [`socket_disconnected`]: PeerManager::socket_disconnected
28650  */
28651 MUST_USE_RES struct LDKCResult_CVec_u8ZPeerHandleErrorZ PeerManager_new_outbound_connection(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey their_node_id, struct LDKSocketDescriptor descriptor, struct LDKCOption_NetAddressZ remote_network_address);
28652
28653 /**
28654  * Indicates a new inbound connection has been established to a node with an optional remote
28655  * network address.
28656  *
28657  * The remote network address adds the option to report a remote IP address back to a connecting
28658  * peer using the init message.
28659  * The user should pass the remote network address of the host they are connected to.
28660  *
28661  * May refuse the connection by returning an Err, but will never write bytes to the remote end
28662  * (outbound connector always speaks first). If an `Err` is returned here you must disconnect
28663  * the connection immediately.
28664  *
28665  * Panics if descriptor is duplicative with some other descriptor which has not yet been
28666  * [`socket_disconnected`].
28667  *
28668  * [`socket_disconnected`]: PeerManager::socket_disconnected
28669  */
28670 MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_new_inbound_connection(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor descriptor, struct LDKCOption_NetAddressZ remote_network_address);
28671
28672 /**
28673  * Indicates that there is room to write data to the given socket descriptor.
28674  *
28675  * May return an Err to indicate that the connection should be closed.
28676  *
28677  * May call [`send_data`] on the descriptor passed in (or an equal descriptor) before
28678  * returning. Thus, be very careful with reentrancy issues! The invariants around calling
28679  * [`write_buffer_space_avail`] in case a write did not fully complete must still hold - be
28680  * ready to call [`write_buffer_space_avail`] again if a write call generated here isn't
28681  * sufficient!
28682  *
28683  * [`send_data`]: SocketDescriptor::send_data
28684  * [`write_buffer_space_avail`]: PeerManager::write_buffer_space_avail
28685  */
28686 MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_write_buffer_space_avail(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor *NONNULL_PTR descriptor);
28687
28688 /**
28689  * Indicates that data was read from the given socket descriptor.
28690  *
28691  * May return an Err to indicate that the connection should be closed.
28692  *
28693  * Will *not* call back into [`send_data`] on any descriptors to avoid reentrancy complexity.
28694  * Thus, however, you should call [`process_events`] after any `read_event` to generate
28695  * [`send_data`] calls to handle responses.
28696  *
28697  * If `Ok(true)` is returned, further read_events should not be triggered until a
28698  * [`send_data`] call on this descriptor has `resume_read` set (preventing DoS issues in the
28699  * send buffer).
28700  *
28701  * In order to avoid processing too many messages at once per peer, `data` should be on the
28702  * order of 4KiB.
28703  *
28704  * [`send_data`]: SocketDescriptor::send_data
28705  * [`process_events`]: PeerManager::process_events
28706  */
28707 MUST_USE_RES struct LDKCResult_boolPeerHandleErrorZ PeerManager_read_event(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor *NONNULL_PTR peer_descriptor, struct LDKu8slice data);
28708
28709 /**
28710  * Checks for any events generated by our handlers and processes them. Includes sending most
28711  * response messages as well as messages generated by calls to handler functions directly (eg
28712  * functions like [`ChannelManager::process_pending_htlc_forwards`] or [`send_payment`]).
28713  *
28714  * May call [`send_data`] on [`SocketDescriptor`]s. Thus, be very careful with reentrancy
28715  * issues!
28716  *
28717  * You don't have to call this function explicitly if you are using [`lightning-net-tokio`]
28718  * or one of the other clients provided in our language bindings.
28719  *
28720  * Note that if there are any other calls to this function waiting on lock(s) this may return
28721  * without doing any work. All available events that need handling will be handled before the
28722  * other calls return.
28723  *
28724  * [`send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
28725  * [`ChannelManager::process_pending_htlc_forwards`]: crate::ln::channelmanager::ChannelManager::process_pending_htlc_forwards
28726  * [`send_data`]: SocketDescriptor::send_data
28727  */
28728 void PeerManager_process_events(const struct LDKPeerManager *NONNULL_PTR this_arg);
28729
28730 /**
28731  * Indicates that the given socket descriptor's connection is now closed.
28732  */
28733 void PeerManager_socket_disconnected(const struct LDKPeerManager *NONNULL_PTR this_arg, const struct LDKSocketDescriptor *NONNULL_PTR descriptor);
28734
28735 /**
28736  * Disconnect a peer given its node id.
28737  *
28738  * If a peer is connected, this will call [`disconnect_socket`] on the descriptor for the
28739  * peer. Thus, be very careful about reentrancy issues.
28740  *
28741  * [`disconnect_socket`]: SocketDescriptor::disconnect_socket
28742  */
28743 void PeerManager_disconnect_by_node_id(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey node_id);
28744
28745 /**
28746  * Disconnects all currently-connected peers. This is useful on platforms where there may be
28747  * an indication that TCP sockets have stalled even if we weren't around to time them out
28748  * using regular ping/pongs.
28749  */
28750 void PeerManager_disconnect_all_peers(const struct LDKPeerManager *NONNULL_PTR this_arg);
28751
28752 /**
28753  * Send pings to each peer and disconnect those which did not respond to the last round of
28754  * pings.
28755  *
28756  * This may be called on any timescale you want, however, roughly once every ten seconds is
28757  * preferred. The call rate determines both how often we send a ping to our peers and how much
28758  * time they have to respond before we disconnect them.
28759  *
28760  * May call [`send_data`] on all [`SocketDescriptor`]s. Thus, be very careful with reentrancy
28761  * issues!
28762  *
28763  * [`send_data`]: SocketDescriptor::send_data
28764  */
28765 void PeerManager_timer_tick_occurred(const struct LDKPeerManager *NONNULL_PTR this_arg);
28766
28767 /**
28768  * Generates a signed node_announcement from the given arguments, sending it to all connected
28769  * peers. Note that peers will likely ignore this message unless we have at least one public
28770  * channel which has at least six confirmations on-chain.
28771  *
28772  * `rgb` is a node \"color\" and `alias` is a printable human-readable string to describe this
28773  * node to humans. They carry no in-protocol meaning.
28774  *
28775  * `addresses` represent the set (possibly empty) of socket addresses on which this node
28776  * accepts incoming connections. These will be included in the node_announcement, publicly
28777  * tying these addresses together and to this node. If you wish to preserve user privacy,
28778  * addresses should likely contain only Tor Onion addresses.
28779  *
28780  * Panics if `addresses` is absurdly large (more than 100).
28781  *
28782  * [`get_and_clear_pending_msg_events`]: MessageSendEventsProvider::get_and_clear_pending_msg_events
28783  */
28784 void PeerManager_broadcast_node_announcement(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKThreeBytes rgb, struct LDKThirtyTwoBytes alias, struct LDKCVec_NetAddressZ addresses);
28785
28786 /**
28787  * Gets the weight for an HTLC-Success transaction.
28788  */
28789 uint64_t htlc_success_tx_weight(bool opt_anchors);
28790
28791 /**
28792  * Gets the weight for an HTLC-Timeout transaction.
28793  */
28794 uint64_t htlc_timeout_tx_weight(bool opt_anchors);
28795
28796 /**
28797  * Creates a copy of the HTLCClaim
28798  */
28799 enum LDKHTLCClaim HTLCClaim_clone(const enum LDKHTLCClaim *NONNULL_PTR orig);
28800
28801 /**
28802  * Utility method to constructs a new OfferedTimeout-variant HTLCClaim
28803  */
28804 enum LDKHTLCClaim HTLCClaim_offered_timeout(void);
28805
28806 /**
28807  * Utility method to constructs a new OfferedPreimage-variant HTLCClaim
28808  */
28809 enum LDKHTLCClaim HTLCClaim_offered_preimage(void);
28810
28811 /**
28812  * Utility method to constructs a new AcceptedTimeout-variant HTLCClaim
28813  */
28814 enum LDKHTLCClaim HTLCClaim_accepted_timeout(void);
28815
28816 /**
28817  * Utility method to constructs a new AcceptedPreimage-variant HTLCClaim
28818  */
28819 enum LDKHTLCClaim HTLCClaim_accepted_preimage(void);
28820
28821 /**
28822  * Utility method to constructs a new Revocation-variant HTLCClaim
28823  */
28824 enum LDKHTLCClaim HTLCClaim_revocation(void);
28825
28826 /**
28827  * Checks if two HTLCClaims contain equal inner contents.
28828  * This ignores pointers and is_owned flags and looks at the values in fields.
28829  */
28830 bool HTLCClaim_eq(const enum LDKHTLCClaim *NONNULL_PTR a, const enum LDKHTLCClaim *NONNULL_PTR b);
28831
28832 /**
28833  * Check if a given input witness attempts to claim a HTLC.
28834  */
28835 MUST_USE_RES struct LDKCOption_HTLCClaimZ HTLCClaim_from_witness(struct LDKWitness witness);
28836
28837 /**
28838  * Build the commitment secret from the seed and the commitment number
28839  */
28840 struct LDKThirtyTwoBytes build_commitment_secret(const uint8_t (*commitment_seed)[32], uint64_t idx);
28841
28842 /**
28843  * Build a closing transaction
28844  */
28845 struct LDKTransaction build_closing_transaction(uint64_t to_holder_value_sat, uint64_t to_counterparty_value_sat, struct LDKCVec_u8Z to_holder_script, struct LDKCVec_u8Z to_counterparty_script, struct LDKOutPoint funding_outpoint);
28846
28847 /**
28848  * Frees any resources used by the CounterpartyCommitmentSecrets, if is_owned is set and inner is non-NULL.
28849  */
28850 void CounterpartyCommitmentSecrets_free(struct LDKCounterpartyCommitmentSecrets this_obj);
28851
28852 /**
28853  * Creates a copy of the CounterpartyCommitmentSecrets
28854  */
28855 struct LDKCounterpartyCommitmentSecrets CounterpartyCommitmentSecrets_clone(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR orig);
28856
28857 /**
28858  * Creates a new empty `CounterpartyCommitmentSecrets` structure.
28859  */
28860 MUST_USE_RES struct LDKCounterpartyCommitmentSecrets CounterpartyCommitmentSecrets_new(void);
28861
28862 /**
28863  * Returns the minimum index of all stored secrets. Note that indexes start
28864  * at 1 << 48 and get decremented by one for each new secret.
28865  */
28866 MUST_USE_RES uint64_t CounterpartyCommitmentSecrets_get_min_seen_secret(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR this_arg);
28867
28868 /**
28869  * Inserts the `secret` at `idx`. Returns `Ok(())` if the secret
28870  * was generated in accordance with BOLT 3 and is consistent with previous secrets.
28871  */
28872 MUST_USE_RES struct LDKCResult_NoneNoneZ CounterpartyCommitmentSecrets_provide_secret(struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR this_arg, uint64_t idx, struct LDKThirtyTwoBytes secret);
28873
28874 /**
28875  * Returns the secret at `idx`.
28876  * Returns `None` if `idx` is < [`CounterpartyCommitmentSecrets::get_min_seen_secret`].
28877  *
28878  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
28879  */
28880 MUST_USE_RES struct LDKThirtyTwoBytes CounterpartyCommitmentSecrets_get_secret(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR this_arg, uint64_t idx);
28881
28882 /**
28883  * Serialize the CounterpartyCommitmentSecrets object into a byte array which can be read by CounterpartyCommitmentSecrets_read
28884  */
28885 struct LDKCVec_u8Z CounterpartyCommitmentSecrets_write(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR obj);
28886
28887 /**
28888  * Read a CounterpartyCommitmentSecrets from a byte array, created by CounterpartyCommitmentSecrets_write
28889  */
28890 struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CounterpartyCommitmentSecrets_read(struct LDKu8slice ser);
28891
28892 /**
28893  * Derives a per-commitment-transaction private key (eg an htlc key or delayed_payment key)
28894  * from the base secret and the per_commitment_point.
28895  */
28896 struct LDKSecretKey derive_private_key(struct LDKPublicKey per_commitment_point, const uint8_t (*base_secret)[32]);
28897
28898 /**
28899  * Derives a per-commitment-transaction public key (eg an htlc key or a delayed_payment key)
28900  * from the base point and the per_commitment_key. This is the public equivalent of
28901  * derive_private_key - using only public keys to derive a public key instead of private keys.
28902  */
28903 struct LDKPublicKey derive_public_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey base_point);
28904
28905 /**
28906  * Derives a per-commitment-transaction revocation key from its constituent parts.
28907  *
28908  * Only the cheating participant owns a valid witness to propagate a revoked
28909  * commitment transaction, thus per_commitment_secret always come from cheater
28910  * and revocation_base_secret always come from punisher, which is the broadcaster
28911  * of the transaction spending with this key knowledge.
28912  */
28913 struct LDKSecretKey derive_private_revocation_key(const uint8_t (*per_commitment_secret)[32], const uint8_t (*countersignatory_revocation_base_secret)[32]);
28914
28915 /**
28916  * Derives a per-commitment-transaction revocation public key from its constituent parts. This is
28917  * the public equivalend of derive_private_revocation_key - using only public keys to derive a
28918  * public key instead of private keys.
28919  *
28920  * Only the cheating participant owns a valid witness to propagate a revoked
28921  * commitment transaction, thus per_commitment_point always come from cheater
28922  * and revocation_base_point always come from punisher, which is the broadcaster
28923  * of the transaction spending with this key knowledge.
28924  *
28925  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
28926  * generated (ie our own).
28927  */
28928 struct LDKPublicKey derive_public_revocation_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey countersignatory_revocation_base_point);
28929
28930 /**
28931  * Frees any resources used by the TxCreationKeys, if is_owned is set and inner is non-NULL.
28932  */
28933 void TxCreationKeys_free(struct LDKTxCreationKeys this_obj);
28934
28935 /**
28936  * The broadcaster's per-commitment public key which was used to derive the other keys.
28937  */
28938 struct LDKPublicKey TxCreationKeys_get_per_commitment_point(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
28939
28940 /**
28941  * The broadcaster's per-commitment public key which was used to derive the other keys.
28942  */
28943 void TxCreationKeys_set_per_commitment_point(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
28944
28945 /**
28946  * The revocation key which is used to allow the broadcaster of the commitment
28947  * transaction to provide their counterparty the ability to punish them if they broadcast
28948  * an old state.
28949  */
28950 struct LDKPublicKey TxCreationKeys_get_revocation_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
28951
28952 /**
28953  * The revocation key which is used to allow the broadcaster of the commitment
28954  * transaction to provide their counterparty the ability to punish them if they broadcast
28955  * an old state.
28956  */
28957 void TxCreationKeys_set_revocation_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
28958
28959 /**
28960  * Broadcaster's HTLC Key
28961  */
28962 struct LDKPublicKey TxCreationKeys_get_broadcaster_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
28963
28964 /**
28965  * Broadcaster's HTLC Key
28966  */
28967 void TxCreationKeys_set_broadcaster_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
28968
28969 /**
28970  * Countersignatory's HTLC Key
28971  */
28972 struct LDKPublicKey TxCreationKeys_get_countersignatory_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
28973
28974 /**
28975  * Countersignatory's HTLC Key
28976  */
28977 void TxCreationKeys_set_countersignatory_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
28978
28979 /**
28980  * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
28981  */
28982 struct LDKPublicKey TxCreationKeys_get_broadcaster_delayed_payment_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
28983
28984 /**
28985  * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
28986  */
28987 void TxCreationKeys_set_broadcaster_delayed_payment_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
28988
28989 /**
28990  * Constructs a new TxCreationKeys given each field
28991  */
28992 MUST_USE_RES struct LDKTxCreationKeys TxCreationKeys_new(struct LDKPublicKey per_commitment_point_arg, struct LDKPublicKey revocation_key_arg, struct LDKPublicKey broadcaster_htlc_key_arg, struct LDKPublicKey countersignatory_htlc_key_arg, struct LDKPublicKey broadcaster_delayed_payment_key_arg);
28993
28994 /**
28995  * Checks if two TxCreationKeyss contain equal inner contents.
28996  * This ignores pointers and is_owned flags and looks at the values in fields.
28997  * Two objects with NULL inner values will be considered "equal" here.
28998  */
28999 bool TxCreationKeys_eq(const struct LDKTxCreationKeys *NONNULL_PTR a, const struct LDKTxCreationKeys *NONNULL_PTR b);
29000
29001 /**
29002  * Creates a copy of the TxCreationKeys
29003  */
29004 struct LDKTxCreationKeys TxCreationKeys_clone(const struct LDKTxCreationKeys *NONNULL_PTR orig);
29005
29006 /**
29007  * Serialize the TxCreationKeys object into a byte array which can be read by TxCreationKeys_read
29008  */
29009 struct LDKCVec_u8Z TxCreationKeys_write(const struct LDKTxCreationKeys *NONNULL_PTR obj);
29010
29011 /**
29012  * Read a TxCreationKeys from a byte array, created by TxCreationKeys_write
29013  */
29014 struct LDKCResult_TxCreationKeysDecodeErrorZ TxCreationKeys_read(struct LDKu8slice ser);
29015
29016 /**
29017  * Frees any resources used by the ChannelPublicKeys, if is_owned is set and inner is non-NULL.
29018  */
29019 void ChannelPublicKeys_free(struct LDKChannelPublicKeys this_obj);
29020
29021 /**
29022  * The public key which is used to sign all commitment transactions, as it appears in the
29023  * on-chain channel lock-in 2-of-2 multisig output.
29024  */
29025 struct LDKPublicKey ChannelPublicKeys_get_funding_pubkey(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
29026
29027 /**
29028  * The public key which is used to sign all commitment transactions, as it appears in the
29029  * on-chain channel lock-in 2-of-2 multisig output.
29030  */
29031 void ChannelPublicKeys_set_funding_pubkey(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
29032
29033 /**
29034  * The base point which is used (with derive_public_revocation_key) to derive per-commitment
29035  * revocation keys. This is combined with the per-commitment-secret generated by the
29036  * counterparty to create a secret which the counterparty can reveal to revoke previous
29037  * states.
29038  */
29039 struct LDKPublicKey ChannelPublicKeys_get_revocation_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
29040
29041 /**
29042  * The base point which is used (with derive_public_revocation_key) to derive per-commitment
29043  * revocation keys. This is combined with the per-commitment-secret generated by the
29044  * counterparty to create a secret which the counterparty can reveal to revoke previous
29045  * states.
29046  */
29047 void ChannelPublicKeys_set_revocation_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
29048
29049 /**
29050  * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
29051  * spendable primary channel balance on the broadcaster's commitment transaction. This key is
29052  * static across every commitment transaction.
29053  */
29054 struct LDKPublicKey ChannelPublicKeys_get_payment_point(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
29055
29056 /**
29057  * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
29058  * spendable primary channel balance on the broadcaster's commitment transaction. This key is
29059  * static across every commitment transaction.
29060  */
29061 void ChannelPublicKeys_set_payment_point(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
29062
29063 /**
29064  * The base point which is used (with derive_public_key) to derive a per-commitment payment
29065  * public key which receives non-HTLC-encumbered funds which are only available for spending
29066  * after some delay (or can be claimed via the revocation path).
29067  */
29068 struct LDKPublicKey ChannelPublicKeys_get_delayed_payment_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
29069
29070 /**
29071  * The base point which is used (with derive_public_key) to derive a per-commitment payment
29072  * public key which receives non-HTLC-encumbered funds which are only available for spending
29073  * after some delay (or can be claimed via the revocation path).
29074  */
29075 void ChannelPublicKeys_set_delayed_payment_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
29076
29077 /**
29078  * The base point which is used (with derive_public_key) to derive a per-commitment public key
29079  * which is used to encumber HTLC-in-flight outputs.
29080  */
29081 struct LDKPublicKey ChannelPublicKeys_get_htlc_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
29082
29083 /**
29084  * The base point which is used (with derive_public_key) to derive a per-commitment public key
29085  * which is used to encumber HTLC-in-flight outputs.
29086  */
29087 void ChannelPublicKeys_set_htlc_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
29088
29089 /**
29090  * Constructs a new ChannelPublicKeys given each field
29091  */
29092 MUST_USE_RES struct LDKChannelPublicKeys ChannelPublicKeys_new(struct LDKPublicKey funding_pubkey_arg, struct LDKPublicKey revocation_basepoint_arg, struct LDKPublicKey payment_point_arg, struct LDKPublicKey delayed_payment_basepoint_arg, struct LDKPublicKey htlc_basepoint_arg);
29093
29094 /**
29095  * Creates a copy of the ChannelPublicKeys
29096  */
29097 struct LDKChannelPublicKeys ChannelPublicKeys_clone(const struct LDKChannelPublicKeys *NONNULL_PTR orig);
29098
29099 /**
29100  * Checks if two ChannelPublicKeyss contain equal inner contents.
29101  * This ignores pointers and is_owned flags and looks at the values in fields.
29102  * Two objects with NULL inner values will be considered "equal" here.
29103  */
29104 bool ChannelPublicKeys_eq(const struct LDKChannelPublicKeys *NONNULL_PTR a, const struct LDKChannelPublicKeys *NONNULL_PTR b);
29105
29106 /**
29107  * Serialize the ChannelPublicKeys object into a byte array which can be read by ChannelPublicKeys_read
29108  */
29109 struct LDKCVec_u8Z ChannelPublicKeys_write(const struct LDKChannelPublicKeys *NONNULL_PTR obj);
29110
29111 /**
29112  * Read a ChannelPublicKeys from a byte array, created by ChannelPublicKeys_write
29113  */
29114 struct LDKCResult_ChannelPublicKeysDecodeErrorZ ChannelPublicKeys_read(struct LDKu8slice ser);
29115
29116 /**
29117  * Create per-state keys from channel base points and the per-commitment point.
29118  * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
29119  */
29120 MUST_USE_RES struct LDKTxCreationKeys TxCreationKeys_derive_new(struct LDKPublicKey per_commitment_point, struct LDKPublicKey broadcaster_delayed_payment_base, struct LDKPublicKey broadcaster_htlc_base, struct LDKPublicKey countersignatory_revocation_base, struct LDKPublicKey countersignatory_htlc_base);
29121
29122 /**
29123  * Generate per-state keys from channel static keys.
29124  * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
29125  */
29126 MUST_USE_RES struct LDKTxCreationKeys TxCreationKeys_from_channel_static_keys(struct LDKPublicKey per_commitment_point, const struct LDKChannelPublicKeys *NONNULL_PTR broadcaster_keys, const struct LDKChannelPublicKeys *NONNULL_PTR countersignatory_keys);
29127
29128 /**
29129  * A script either spendable by the revocation
29130  * key or the broadcaster_delayed_payment_key and satisfying the relative-locktime OP_CSV constrain.
29131  * Encumbering a `to_holder` output on a commitment transaction or 2nd-stage HTLC transactions.
29132  */
29133 struct LDKCVec_u8Z get_revokeable_redeemscript(struct LDKPublicKey revocation_key, uint16_t contest_delay, struct LDKPublicKey broadcaster_delayed_payment_key);
29134
29135 /**
29136  * Frees any resources used by the HTLCOutputInCommitment, if is_owned is set and inner is non-NULL.
29137  */
29138 void HTLCOutputInCommitment_free(struct LDKHTLCOutputInCommitment this_obj);
29139
29140 /**
29141  * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
29142  * Note that this is not the same as whether it is ountbound *from us*. To determine that you
29143  * need to compare this value to whether the commitment transaction in question is that of
29144  * the counterparty or our own.
29145  */
29146 bool HTLCOutputInCommitment_get_offered(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
29147
29148 /**
29149  * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
29150  * Note that this is not the same as whether it is ountbound *from us*. To determine that you
29151  * need to compare this value to whether the commitment transaction in question is that of
29152  * the counterparty or our own.
29153  */
29154 void HTLCOutputInCommitment_set_offered(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, bool val);
29155
29156 /**
29157  * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
29158  * this divided by 1000.
29159  */
29160 uint64_t HTLCOutputInCommitment_get_amount_msat(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
29161
29162 /**
29163  * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
29164  * this divided by 1000.
29165  */
29166 void HTLCOutputInCommitment_set_amount_msat(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint64_t val);
29167
29168 /**
29169  * The CLTV lock-time at which this HTLC expires.
29170  */
29171 uint32_t HTLCOutputInCommitment_get_cltv_expiry(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
29172
29173 /**
29174  * The CLTV lock-time at which this HTLC expires.
29175  */
29176 void HTLCOutputInCommitment_set_cltv_expiry(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint32_t val);
29177
29178 /**
29179  * The hash of the preimage which unlocks this HTLC.
29180  */
29181 const uint8_t (*HTLCOutputInCommitment_get_payment_hash(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr))[32];
29182
29183 /**
29184  * The hash of the preimage which unlocks this HTLC.
29185  */
29186 void HTLCOutputInCommitment_set_payment_hash(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
29187
29188 /**
29189  * The position within the commitment transactions' outputs. This may be None if the value is
29190  * below the dust limit (in which case no output appears in the commitment transaction and the
29191  * value is spent to additional transaction fees).
29192  */
29193 struct LDKCOption_u32Z HTLCOutputInCommitment_get_transaction_output_index(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
29194
29195 /**
29196  * The position within the commitment transactions' outputs. This may be None if the value is
29197  * below the dust limit (in which case no output appears in the commitment transaction and the
29198  * value is spent to additional transaction fees).
29199  */
29200 void HTLCOutputInCommitment_set_transaction_output_index(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val);
29201
29202 /**
29203  * Constructs a new HTLCOutputInCommitment given each field
29204  */
29205 MUST_USE_RES struct LDKHTLCOutputInCommitment HTLCOutputInCommitment_new(bool offered_arg, uint64_t amount_msat_arg, uint32_t cltv_expiry_arg, struct LDKThirtyTwoBytes payment_hash_arg, struct LDKCOption_u32Z transaction_output_index_arg);
29206
29207 /**
29208  * Creates a copy of the HTLCOutputInCommitment
29209  */
29210 struct LDKHTLCOutputInCommitment HTLCOutputInCommitment_clone(const struct LDKHTLCOutputInCommitment *NONNULL_PTR orig);
29211
29212 /**
29213  * Checks if two HTLCOutputInCommitments contain equal inner contents.
29214  * This ignores pointers and is_owned flags and looks at the values in fields.
29215  * Two objects with NULL inner values will be considered "equal" here.
29216  */
29217 bool HTLCOutputInCommitment_eq(const struct LDKHTLCOutputInCommitment *NONNULL_PTR a, const struct LDKHTLCOutputInCommitment *NONNULL_PTR b);
29218
29219 /**
29220  * Serialize the HTLCOutputInCommitment object into a byte array which can be read by HTLCOutputInCommitment_read
29221  */
29222 struct LDKCVec_u8Z HTLCOutputInCommitment_write(const struct LDKHTLCOutputInCommitment *NONNULL_PTR obj);
29223
29224 /**
29225  * Read a HTLCOutputInCommitment from a byte array, created by HTLCOutputInCommitment_write
29226  */
29227 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ HTLCOutputInCommitment_read(struct LDKu8slice ser);
29228
29229 /**
29230  * Gets the witness redeemscript for an HTLC output in a commitment transaction. Note that htlc
29231  * does not need to have its previous_output_index filled.
29232  */
29233 struct LDKCVec_u8Z get_htlc_redeemscript(const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, bool opt_anchors, const struct LDKTxCreationKeys *NONNULL_PTR keys);
29234
29235 /**
29236  * Gets the redeemscript for a funding output from the two funding public keys.
29237  * Note that the order of funding public keys does not matter.
29238  */
29239 struct LDKCVec_u8Z make_funding_redeemscript(struct LDKPublicKey broadcaster, struct LDKPublicKey countersignatory);
29240
29241 /**
29242  * Builds an unsigned HTLC-Success or HTLC-Timeout transaction from the given channel and HTLC
29243  * parameters. This is used by [`TrustedCommitmentTransaction::get_htlc_sigs`] to fetch the
29244  * transaction which needs signing, and can be used to construct an HTLC transaction which is
29245  * broadcastable given a counterparty HTLC signature.
29246  *
29247  * Panics if htlc.transaction_output_index.is_none() (as such HTLCs do not appear in the
29248  * commitment transaction).
29249  */
29250 struct LDKTransaction build_htlc_transaction(const uint8_t (*commitment_txid)[32], uint32_t feerate_per_kw, uint16_t contest_delay, const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, bool opt_anchors, bool use_non_zero_fee_anchors, struct LDKPublicKey broadcaster_delayed_payment_key, struct LDKPublicKey revocation_key);
29251
29252 /**
29253  * Returns the witness required to satisfy and spend a HTLC input.
29254  *
29255  * Note that preimage (or a relevant inner pointer) may be NULL or all-0s to represent None
29256  */
29257 struct LDKWitness build_htlc_input_witness(struct LDKSignature local_sig, struct LDKSignature remote_sig, struct LDKThirtyTwoBytes preimage, struct LDKu8slice redeem_script, bool opt_anchors);
29258
29259 /**
29260  * Gets the witnessScript for the to_remote output when anchors are enabled.
29261  */
29262 struct LDKCVec_u8Z get_to_countersignatory_with_anchors_redeemscript(struct LDKPublicKey payment_point);
29263
29264 /**
29265  * Gets the witnessScript for an anchor output from the funding public key.
29266  * The witness in the spending input must be:
29267  * <BIP 143 funding_signature>
29268  * After 16 blocks of confirmation, an alternative satisfying witness could be:
29269  * <>
29270  * (empty vector required to satisfy compliance with MINIMALIF-standard rule)
29271  */
29272 struct LDKCVec_u8Z get_anchor_redeemscript(struct LDKPublicKey funding_pubkey);
29273
29274 /**
29275  * Returns the witness required to satisfy and spend an anchor input.
29276  */
29277 struct LDKWitness build_anchor_input_witness(struct LDKPublicKey funding_key, struct LDKSignature funding_sig);
29278
29279 /**
29280  * Frees any resources used by the ChannelTransactionParameters, if is_owned is set and inner is non-NULL.
29281  */
29282 void ChannelTransactionParameters_free(struct LDKChannelTransactionParameters this_obj);
29283
29284 /**
29285  * Holder public keys
29286  */
29287 struct LDKChannelPublicKeys ChannelTransactionParameters_get_holder_pubkeys(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
29288
29289 /**
29290  * Holder public keys
29291  */
29292 void ChannelTransactionParameters_set_holder_pubkeys(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
29293
29294 /**
29295  * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
29296  */
29297 uint16_t ChannelTransactionParameters_get_holder_selected_contest_delay(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
29298
29299 /**
29300  * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
29301  */
29302 void ChannelTransactionParameters_set_holder_selected_contest_delay(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
29303
29304 /**
29305  * Whether the holder is the initiator of this channel.
29306  * This is an input to the commitment number obscure factor computation.
29307  */
29308 bool ChannelTransactionParameters_get_is_outbound_from_holder(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
29309
29310 /**
29311  * Whether the holder is the initiator of this channel.
29312  * This is an input to the commitment number obscure factor computation.
29313  */
29314 void ChannelTransactionParameters_set_is_outbound_from_holder(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, bool val);
29315
29316 /**
29317  * The late-bound counterparty channel transaction parameters.
29318  * These parameters are populated at the point in the protocol where the counterparty provides them.
29319  *
29320  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
29321  */
29322 struct LDKCounterpartyChannelTransactionParameters ChannelTransactionParameters_get_counterparty_parameters(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
29323
29324 /**
29325  * The late-bound counterparty channel transaction parameters.
29326  * These parameters are populated at the point in the protocol where the counterparty provides them.
29327  *
29328  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
29329  */
29330 void ChannelTransactionParameters_set_counterparty_parameters(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKCounterpartyChannelTransactionParameters val);
29331
29332 /**
29333  * The late-bound funding outpoint
29334  *
29335  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
29336  */
29337 struct LDKOutPoint ChannelTransactionParameters_get_funding_outpoint(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
29338
29339 /**
29340  * The late-bound funding outpoint
29341  *
29342  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
29343  */
29344 void ChannelTransactionParameters_set_funding_outpoint(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKOutPoint val);
29345
29346 /**
29347  * Are anchors (zero fee HTLC transaction variant) used for this channel. Boolean is
29348  * serialization backwards-compatible.
29349  */
29350 enum LDKCOption_NoneZ ChannelTransactionParameters_get_opt_anchors(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
29351
29352 /**
29353  * Are anchors (zero fee HTLC transaction variant) used for this channel. Boolean is
29354  * serialization backwards-compatible.
29355  */
29356 void ChannelTransactionParameters_set_opt_anchors(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, enum LDKCOption_NoneZ val);
29357
29358 /**
29359  * Are non-zero-fee anchors are enabled (used in conjuction with opt_anchors)
29360  * It is intended merely for backwards compatibility with signers that need it.
29361  * There is no support for this feature in LDK channel negotiation.
29362  */
29363 enum LDKCOption_NoneZ ChannelTransactionParameters_get_opt_non_zero_fee_anchors(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
29364
29365 /**
29366  * Are non-zero-fee anchors are enabled (used in conjuction with opt_anchors)
29367  * It is intended merely for backwards compatibility with signers that need it.
29368  * There is no support for this feature in LDK channel negotiation.
29369  */
29370 void ChannelTransactionParameters_set_opt_non_zero_fee_anchors(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, enum LDKCOption_NoneZ val);
29371
29372 /**
29373  * Constructs a new ChannelTransactionParameters given each field
29374  */
29375 MUST_USE_RES struct LDKChannelTransactionParameters ChannelTransactionParameters_new(struct LDKChannelPublicKeys holder_pubkeys_arg, uint16_t holder_selected_contest_delay_arg, bool is_outbound_from_holder_arg, struct LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg, struct LDKOutPoint funding_outpoint_arg, enum LDKCOption_NoneZ opt_anchors_arg, enum LDKCOption_NoneZ opt_non_zero_fee_anchors_arg);
29376
29377 /**
29378  * Creates a copy of the ChannelTransactionParameters
29379  */
29380 struct LDKChannelTransactionParameters ChannelTransactionParameters_clone(const struct LDKChannelTransactionParameters *NONNULL_PTR orig);
29381
29382 /**
29383  * Checks if two ChannelTransactionParameterss contain equal inner contents.
29384  * This ignores pointers and is_owned flags and looks at the values in fields.
29385  * Two objects with NULL inner values will be considered "equal" here.
29386  */
29387 bool ChannelTransactionParameters_eq(const struct LDKChannelTransactionParameters *NONNULL_PTR a, const struct LDKChannelTransactionParameters *NONNULL_PTR b);
29388
29389 /**
29390  * Frees any resources used by the CounterpartyChannelTransactionParameters, if is_owned is set and inner is non-NULL.
29391  */
29392 void CounterpartyChannelTransactionParameters_free(struct LDKCounterpartyChannelTransactionParameters this_obj);
29393
29394 /**
29395  * Counter-party public keys
29396  */
29397 struct LDKChannelPublicKeys CounterpartyChannelTransactionParameters_get_pubkeys(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
29398
29399 /**
29400  * Counter-party public keys
29401  */
29402 void CounterpartyChannelTransactionParameters_set_pubkeys(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
29403
29404 /**
29405  * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
29406  */
29407 uint16_t CounterpartyChannelTransactionParameters_get_selected_contest_delay(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
29408
29409 /**
29410  * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
29411  */
29412 void CounterpartyChannelTransactionParameters_set_selected_contest_delay(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
29413
29414 /**
29415  * Constructs a new CounterpartyChannelTransactionParameters given each field
29416  */
29417 MUST_USE_RES struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_new(struct LDKChannelPublicKeys pubkeys_arg, uint16_t selected_contest_delay_arg);
29418
29419 /**
29420  * Creates a copy of the CounterpartyChannelTransactionParameters
29421  */
29422 struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_clone(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR orig);
29423
29424 /**
29425  * Checks if two CounterpartyChannelTransactionParameterss contain equal inner contents.
29426  * This ignores pointers and is_owned flags and looks at the values in fields.
29427  * Two objects with NULL inner values will be considered "equal" here.
29428  */
29429 bool CounterpartyChannelTransactionParameters_eq(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR a, const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR b);
29430
29431 /**
29432  * Whether the late bound parameters are populated.
29433  */
29434 MUST_USE_RES bool ChannelTransactionParameters_is_populated(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
29435
29436 /**
29437  * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
29438  * given that the holder is the broadcaster.
29439  *
29440  * self.is_populated() must be true before calling this function.
29441  */
29442 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_holder_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
29443
29444 /**
29445  * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
29446  * given that the counterparty is the broadcaster.
29447  *
29448  * self.is_populated() must be true before calling this function.
29449  */
29450 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_counterparty_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
29451
29452 /**
29453  * Serialize the CounterpartyChannelTransactionParameters object into a byte array which can be read by CounterpartyChannelTransactionParameters_read
29454  */
29455 struct LDKCVec_u8Z CounterpartyChannelTransactionParameters_write(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR obj);
29456
29457 /**
29458  * Read a CounterpartyChannelTransactionParameters from a byte array, created by CounterpartyChannelTransactionParameters_write
29459  */
29460 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CounterpartyChannelTransactionParameters_read(struct LDKu8slice ser);
29461
29462 /**
29463  * Serialize the ChannelTransactionParameters object into a byte array which can be read by ChannelTransactionParameters_read
29464  */
29465 struct LDKCVec_u8Z ChannelTransactionParameters_write(const struct LDKChannelTransactionParameters *NONNULL_PTR obj);
29466
29467 /**
29468  * Read a ChannelTransactionParameters from a byte array, created by ChannelTransactionParameters_write
29469  */
29470 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ ChannelTransactionParameters_read(struct LDKu8slice ser);
29471
29472 /**
29473  * Frees any resources used by the DirectedChannelTransactionParameters, if is_owned is set and inner is non-NULL.
29474  */
29475 void DirectedChannelTransactionParameters_free(struct LDKDirectedChannelTransactionParameters this_obj);
29476
29477 /**
29478  * Get the channel pubkeys for the broadcaster
29479  */
29480 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_broadcaster_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
29481
29482 /**
29483  * Get the channel pubkeys for the countersignatory
29484  */
29485 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_countersignatory_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
29486
29487 /**
29488  * Get the contest delay applicable to the transactions.
29489  * Note that the contest delay was selected by the countersignatory.
29490  */
29491 MUST_USE_RES uint16_t DirectedChannelTransactionParameters_contest_delay(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
29492
29493 /**
29494  * Whether the channel is outbound from the broadcaster.
29495  *
29496  * The boolean representing the side that initiated the channel is
29497  * an input to the commitment number obscure factor computation.
29498  */
29499 MUST_USE_RES bool DirectedChannelTransactionParameters_is_outbound(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
29500
29501 /**
29502  * The funding outpoint
29503  */
29504 MUST_USE_RES struct LDKOutPoint DirectedChannelTransactionParameters_funding_outpoint(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
29505
29506 /**
29507  * Whether to use anchors for this channel
29508  */
29509 MUST_USE_RES bool DirectedChannelTransactionParameters_opt_anchors(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
29510
29511 /**
29512  * Frees any resources used by the HolderCommitmentTransaction, if is_owned is set and inner is non-NULL.
29513  */
29514 void HolderCommitmentTransaction_free(struct LDKHolderCommitmentTransaction this_obj);
29515
29516 /**
29517  * Our counterparty's signature for the transaction
29518  */
29519 struct LDKSignature HolderCommitmentTransaction_get_counterparty_sig(const struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr);
29520
29521 /**
29522  * Our counterparty's signature for the transaction
29523  */
29524 void HolderCommitmentTransaction_set_counterparty_sig(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKSignature val);
29525
29526 /**
29527  * All non-dust counterparty HTLC signatures, in the order they appear in the transaction
29528  *
29529  * Returns a copy of the field.
29530  */
29531 struct LDKCVec_SignatureZ HolderCommitmentTransaction_get_counterparty_htlc_sigs(const struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr);
29532
29533 /**
29534  * All non-dust counterparty HTLC signatures, in the order they appear in the transaction
29535  */
29536 void HolderCommitmentTransaction_set_counterparty_htlc_sigs(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val);
29537
29538 /**
29539  * Creates a copy of the HolderCommitmentTransaction
29540  */
29541 struct LDKHolderCommitmentTransaction HolderCommitmentTransaction_clone(const struct LDKHolderCommitmentTransaction *NONNULL_PTR orig);
29542
29543 /**
29544  * Serialize the HolderCommitmentTransaction object into a byte array which can be read by HolderCommitmentTransaction_read
29545  */
29546 struct LDKCVec_u8Z HolderCommitmentTransaction_write(const struct LDKHolderCommitmentTransaction *NONNULL_PTR obj);
29547
29548 /**
29549  * Read a HolderCommitmentTransaction from a byte array, created by HolderCommitmentTransaction_write
29550  */
29551 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ HolderCommitmentTransaction_read(struct LDKu8slice ser);
29552
29553 /**
29554  * Create a new holder transaction with the given counterparty signatures.
29555  * The funding keys are used to figure out which signature should go first when building the transaction for broadcast.
29556  */
29557 MUST_USE_RES struct LDKHolderCommitmentTransaction HolderCommitmentTransaction_new(struct LDKCommitmentTransaction commitment_tx, struct LDKSignature counterparty_sig, struct LDKCVec_SignatureZ counterparty_htlc_sigs, struct LDKPublicKey holder_funding_key, struct LDKPublicKey counterparty_funding_key);
29558
29559 /**
29560  * Frees any resources used by the BuiltCommitmentTransaction, if is_owned is set and inner is non-NULL.
29561  */
29562 void BuiltCommitmentTransaction_free(struct LDKBuiltCommitmentTransaction this_obj);
29563
29564 /**
29565  * The commitment transaction
29566  */
29567 struct LDKTransaction BuiltCommitmentTransaction_get_transaction(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr);
29568
29569 /**
29570  * The commitment transaction
29571  */
29572 void BuiltCommitmentTransaction_set_transaction(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKTransaction val);
29573
29574 /**
29575  * The txid for the commitment transaction.
29576  *
29577  * This is provided as a performance optimization, instead of calling transaction.txid()
29578  * multiple times.
29579  */
29580 const uint8_t (*BuiltCommitmentTransaction_get_txid(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr))[32];
29581
29582 /**
29583  * The txid for the commitment transaction.
29584  *
29585  * This is provided as a performance optimization, instead of calling transaction.txid()
29586  * multiple times.
29587  */
29588 void BuiltCommitmentTransaction_set_txid(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
29589
29590 /**
29591  * Constructs a new BuiltCommitmentTransaction given each field
29592  */
29593 MUST_USE_RES struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_new(struct LDKTransaction transaction_arg, struct LDKThirtyTwoBytes txid_arg);
29594
29595 /**
29596  * Creates a copy of the BuiltCommitmentTransaction
29597  */
29598 struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_clone(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR orig);
29599
29600 /**
29601  * Serialize the BuiltCommitmentTransaction object into a byte array which can be read by BuiltCommitmentTransaction_read
29602  */
29603 struct LDKCVec_u8Z BuiltCommitmentTransaction_write(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR obj);
29604
29605 /**
29606  * Read a BuiltCommitmentTransaction from a byte array, created by BuiltCommitmentTransaction_write
29607  */
29608 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ BuiltCommitmentTransaction_read(struct LDKu8slice ser);
29609
29610 /**
29611  * Get the SIGHASH_ALL sighash value of the transaction.
29612  *
29613  * This can be used to verify a signature.
29614  */
29615 MUST_USE_RES struct LDKThirtyTwoBytes BuiltCommitmentTransaction_get_sighash_all(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_arg, struct LDKu8slice funding_redeemscript, uint64_t channel_value_satoshis);
29616
29617 /**
29618  * Signs the counterparty's commitment transaction.
29619  */
29620 MUST_USE_RES struct LDKSignature BuiltCommitmentTransaction_sign_counterparty_commitment(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_arg, const uint8_t (*funding_key)[32], struct LDKu8slice funding_redeemscript, uint64_t channel_value_satoshis);
29621
29622 /**
29623  * Signs the holder commitment transaction because we are about to broadcast it.
29624  */
29625 MUST_USE_RES struct LDKSignature BuiltCommitmentTransaction_sign_holder_commitment(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_arg, const uint8_t (*funding_key)[32], struct LDKu8slice funding_redeemscript, uint64_t channel_value_satoshis, const struct LDKEntropySource *NONNULL_PTR entropy_source);
29626
29627 /**
29628  * Frees any resources used by the ClosingTransaction, if is_owned is set and inner is non-NULL.
29629  */
29630 void ClosingTransaction_free(struct LDKClosingTransaction this_obj);
29631
29632 /**
29633  * Creates a copy of the ClosingTransaction
29634  */
29635 struct LDKClosingTransaction ClosingTransaction_clone(const struct LDKClosingTransaction *NONNULL_PTR orig);
29636
29637 /**
29638  * Generates a non-cryptographic 64-bit hash of the ClosingTransaction.
29639  */
29640 uint64_t ClosingTransaction_hash(const struct LDKClosingTransaction *NONNULL_PTR o);
29641
29642 /**
29643  * Checks if two ClosingTransactions contain equal inner contents.
29644  * This ignores pointers and is_owned flags and looks at the values in fields.
29645  * Two objects with NULL inner values will be considered "equal" here.
29646  */
29647 bool ClosingTransaction_eq(const struct LDKClosingTransaction *NONNULL_PTR a, const struct LDKClosingTransaction *NONNULL_PTR b);
29648
29649 /**
29650  * Construct an object of the class
29651  */
29652 MUST_USE_RES struct LDKClosingTransaction ClosingTransaction_new(uint64_t to_holder_value_sat, uint64_t to_counterparty_value_sat, struct LDKCVec_u8Z to_holder_script, struct LDKCVec_u8Z to_counterparty_script, struct LDKOutPoint funding_outpoint);
29653
29654 /**
29655  * Trust our pre-built transaction.
29656  *
29657  * Applies a wrapper which allows access to the transaction.
29658  *
29659  * This should only be used if you fully trust the builder of this object. It should not
29660  * be used by an external signer - instead use the verify function.
29661  */
29662 MUST_USE_RES struct LDKTrustedClosingTransaction ClosingTransaction_trust(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
29663
29664 /**
29665  * Verify our pre-built transaction.
29666  *
29667  * Applies a wrapper which allows access to the transaction.
29668  *
29669  * An external validating signer must call this method before signing
29670  * or using the built transaction.
29671  */
29672 MUST_USE_RES struct LDKCResult_TrustedClosingTransactionNoneZ ClosingTransaction_verify(const struct LDKClosingTransaction *NONNULL_PTR this_arg, struct LDKOutPoint funding_outpoint);
29673
29674 /**
29675  * The value to be sent to the holder, or zero if the output will be omitted
29676  */
29677 MUST_USE_RES uint64_t ClosingTransaction_to_holder_value_sat(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
29678
29679 /**
29680  * The value to be sent to the counterparty, or zero if the output will be omitted
29681  */
29682 MUST_USE_RES uint64_t ClosingTransaction_to_counterparty_value_sat(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
29683
29684 /**
29685  * The destination of the holder's output
29686  */
29687 MUST_USE_RES struct LDKu8slice ClosingTransaction_to_holder_script(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
29688
29689 /**
29690  * The destination of the counterparty's output
29691  */
29692 MUST_USE_RES struct LDKu8slice ClosingTransaction_to_counterparty_script(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
29693
29694 /**
29695  * Frees any resources used by the TrustedClosingTransaction, if is_owned is set and inner is non-NULL.
29696  */
29697 void TrustedClosingTransaction_free(struct LDKTrustedClosingTransaction this_obj);
29698
29699 /**
29700  * The pre-built Bitcoin commitment transaction
29701  */
29702 MUST_USE_RES struct LDKTransaction TrustedClosingTransaction_built_transaction(const struct LDKTrustedClosingTransaction *NONNULL_PTR this_arg);
29703
29704 /**
29705  * Get the SIGHASH_ALL sighash value of the transaction.
29706  *
29707  * This can be used to verify a signature.
29708  */
29709 MUST_USE_RES struct LDKThirtyTwoBytes TrustedClosingTransaction_get_sighash_all(const struct LDKTrustedClosingTransaction *NONNULL_PTR this_arg, struct LDKu8slice funding_redeemscript, uint64_t channel_value_satoshis);
29710
29711 /**
29712  * Sign a transaction, either because we are counter-signing the counterparty's transaction or
29713  * because we are about to broadcast a holder transaction.
29714  */
29715 MUST_USE_RES struct LDKSignature TrustedClosingTransaction_sign(const struct LDKTrustedClosingTransaction *NONNULL_PTR this_arg, const uint8_t (*funding_key)[32], struct LDKu8slice funding_redeemscript, uint64_t channel_value_satoshis);
29716
29717 /**
29718  * Frees any resources used by the CommitmentTransaction, if is_owned is set and inner is non-NULL.
29719  */
29720 void CommitmentTransaction_free(struct LDKCommitmentTransaction this_obj);
29721
29722 /**
29723  * Creates a copy of the CommitmentTransaction
29724  */
29725 struct LDKCommitmentTransaction CommitmentTransaction_clone(const struct LDKCommitmentTransaction *NONNULL_PTR orig);
29726
29727 /**
29728  * Serialize the CommitmentTransaction object into a byte array which can be read by CommitmentTransaction_read
29729  */
29730 struct LDKCVec_u8Z CommitmentTransaction_write(const struct LDKCommitmentTransaction *NONNULL_PTR obj);
29731
29732 /**
29733  * Read a CommitmentTransaction from a byte array, created by CommitmentTransaction_write
29734  */
29735 struct LDKCResult_CommitmentTransactionDecodeErrorZ CommitmentTransaction_read(struct LDKu8slice ser);
29736
29737 /**
29738  * The backwards-counting commitment number
29739  */
29740 MUST_USE_RES uint64_t CommitmentTransaction_commitment_number(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
29741
29742 /**
29743  * The value to be sent to the broadcaster
29744  */
29745 MUST_USE_RES uint64_t CommitmentTransaction_to_broadcaster_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
29746
29747 /**
29748  * The value to be sent to the counterparty
29749  */
29750 MUST_USE_RES uint64_t CommitmentTransaction_to_countersignatory_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
29751
29752 /**
29753  * The feerate paid per 1000-weight-unit in this commitment transaction.
29754  */
29755 MUST_USE_RES uint32_t CommitmentTransaction_feerate_per_kw(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
29756
29757 /**
29758  * Trust our pre-built transaction and derived transaction creation public keys.
29759  *
29760  * Applies a wrapper which allows access to these fields.
29761  *
29762  * This should only be used if you fully trust the builder of this object.  It should not
29763  * be used by an external signer - instead use the verify function.
29764  */
29765 MUST_USE_RES struct LDKTrustedCommitmentTransaction CommitmentTransaction_trust(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
29766
29767 /**
29768  * Verify our pre-built transaction and derived transaction creation public keys.
29769  *
29770  * Applies a wrapper which allows access to these fields.
29771  *
29772  * An external validating signer must call this method before signing
29773  * or using the built transaction.
29774  */
29775 MUST_USE_RES struct LDKCResult_TrustedCommitmentTransactionNoneZ CommitmentTransaction_verify(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg, const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR channel_parameters, const struct LDKChannelPublicKeys *NONNULL_PTR broadcaster_keys, const struct LDKChannelPublicKeys *NONNULL_PTR countersignatory_keys);
29776
29777 /**
29778  * Frees any resources used by the TrustedCommitmentTransaction, if is_owned is set and inner is non-NULL.
29779  */
29780 void TrustedCommitmentTransaction_free(struct LDKTrustedCommitmentTransaction this_obj);
29781
29782 /**
29783  * The transaction ID of the built Bitcoin transaction
29784  */
29785 MUST_USE_RES struct LDKThirtyTwoBytes TrustedCommitmentTransaction_txid(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
29786
29787 /**
29788  * The pre-built Bitcoin commitment transaction
29789  */
29790 MUST_USE_RES struct LDKBuiltCommitmentTransaction TrustedCommitmentTransaction_built_transaction(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
29791
29792 /**
29793  * The pre-calculated transaction creation public keys.
29794  */
29795 MUST_USE_RES struct LDKTxCreationKeys TrustedCommitmentTransaction_keys(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
29796
29797 /**
29798  * Should anchors be used.
29799  */
29800 MUST_USE_RES bool TrustedCommitmentTransaction_opt_anchors(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
29801
29802 /**
29803  * Get a signature for each HTLC which was included in the commitment transaction (ie for
29804  * which HTLCOutputInCommitment::transaction_output_index.is_some()).
29805  *
29806  * The returned Vec has one entry for each HTLC, and in the same order.
29807  *
29808  * This function is only valid in the holder commitment context, it always uses EcdsaSighashType::All.
29809  */
29810 MUST_USE_RES struct LDKCResult_CVec_SignatureZNoneZ TrustedCommitmentTransaction_get_htlc_sigs(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg, const uint8_t (*htlc_base_key)[32], const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR channel_parameters, const struct LDKEntropySource *NONNULL_PTR entropy_source);
29811
29812 /**
29813  * Commitment transaction numbers which appear in the transactions themselves are XOR'd with a
29814  * shared secret first. This prevents on-chain observers from discovering how many commitment
29815  * transactions occurred in a channel before it was closed.
29816  *
29817  * This function gets the shared secret from relevant channel public keys and can be used to
29818  * \"decrypt\" the commitment transaction number given a commitment transaction on-chain.
29819  */
29820 uint64_t get_commitment_transaction_number_obscure_factor(struct LDKPublicKey broadcaster_payment_basepoint, struct LDKPublicKey countersignatory_payment_basepoint, bool outbound_from_broadcaster);
29821
29822 /**
29823  * Checks if two InitFeaturess contain equal inner contents.
29824  * This ignores pointers and is_owned flags and looks at the values in fields.
29825  * Two objects with NULL inner values will be considered "equal" here.
29826  */
29827 bool InitFeatures_eq(const struct LDKInitFeatures *NONNULL_PTR a, const struct LDKInitFeatures *NONNULL_PTR b);
29828
29829 /**
29830  * Checks if two NodeFeaturess contain equal inner contents.
29831  * This ignores pointers and is_owned flags and looks at the values in fields.
29832  * Two objects with NULL inner values will be considered "equal" here.
29833  */
29834 bool NodeFeatures_eq(const struct LDKNodeFeatures *NONNULL_PTR a, const struct LDKNodeFeatures *NONNULL_PTR b);
29835
29836 /**
29837  * Checks if two ChannelFeaturess contain equal inner contents.
29838  * This ignores pointers and is_owned flags and looks at the values in fields.
29839  * Two objects with NULL inner values will be considered "equal" here.
29840  */
29841 bool ChannelFeatures_eq(const struct LDKChannelFeatures *NONNULL_PTR a, const struct LDKChannelFeatures *NONNULL_PTR b);
29842
29843 /**
29844  * Checks if two InvoiceFeaturess contain equal inner contents.
29845  * This ignores pointers and is_owned flags and looks at the values in fields.
29846  * Two objects with NULL inner values will be considered "equal" here.
29847  */
29848 bool InvoiceFeatures_eq(const struct LDKInvoiceFeatures *NONNULL_PTR a, const struct LDKInvoiceFeatures *NONNULL_PTR b);
29849
29850 /**
29851  * Checks if two OfferFeaturess contain equal inner contents.
29852  * This ignores pointers and is_owned flags and looks at the values in fields.
29853  * Two objects with NULL inner values will be considered "equal" here.
29854  */
29855 bool OfferFeatures_eq(const struct LDKOfferFeatures *NONNULL_PTR a, const struct LDKOfferFeatures *NONNULL_PTR b);
29856
29857 /**
29858  * Checks if two InvoiceRequestFeaturess contain equal inner contents.
29859  * This ignores pointers and is_owned flags and looks at the values in fields.
29860  * Two objects with NULL inner values will be considered "equal" here.
29861  */
29862 bool InvoiceRequestFeatures_eq(const struct LDKInvoiceRequestFeatures *NONNULL_PTR a, const struct LDKInvoiceRequestFeatures *NONNULL_PTR b);
29863
29864 /**
29865  * Checks if two Bolt12InvoiceFeaturess contain equal inner contents.
29866  * This ignores pointers and is_owned flags and looks at the values in fields.
29867  * Two objects with NULL inner values will be considered "equal" here.
29868  */
29869 bool Bolt12InvoiceFeatures_eq(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR a, const struct LDKBolt12InvoiceFeatures *NONNULL_PTR b);
29870
29871 /**
29872  * Checks if two BlindedHopFeaturess contain equal inner contents.
29873  * This ignores pointers and is_owned flags and looks at the values in fields.
29874  * Two objects with NULL inner values will be considered "equal" here.
29875  */
29876 bool BlindedHopFeatures_eq(const struct LDKBlindedHopFeatures *NONNULL_PTR a, const struct LDKBlindedHopFeatures *NONNULL_PTR b);
29877
29878 /**
29879  * Checks if two ChannelTypeFeaturess contain equal inner contents.
29880  * This ignores pointers and is_owned flags and looks at the values in fields.
29881  * Two objects with NULL inner values will be considered "equal" here.
29882  */
29883 bool ChannelTypeFeatures_eq(const struct LDKChannelTypeFeatures *NONNULL_PTR a, const struct LDKChannelTypeFeatures *NONNULL_PTR b);
29884
29885 /**
29886  * Creates a copy of the InitFeatures
29887  */
29888 struct LDKInitFeatures InitFeatures_clone(const struct LDKInitFeatures *NONNULL_PTR orig);
29889
29890 /**
29891  * Creates a copy of the NodeFeatures
29892  */
29893 struct LDKNodeFeatures NodeFeatures_clone(const struct LDKNodeFeatures *NONNULL_PTR orig);
29894
29895 /**
29896  * Creates a copy of the ChannelFeatures
29897  */
29898 struct LDKChannelFeatures ChannelFeatures_clone(const struct LDKChannelFeatures *NONNULL_PTR orig);
29899
29900 /**
29901  * Creates a copy of the InvoiceFeatures
29902  */
29903 struct LDKInvoiceFeatures InvoiceFeatures_clone(const struct LDKInvoiceFeatures *NONNULL_PTR orig);
29904
29905 /**
29906  * Creates a copy of the OfferFeatures
29907  */
29908 struct LDKOfferFeatures OfferFeatures_clone(const struct LDKOfferFeatures *NONNULL_PTR orig);
29909
29910 /**
29911  * Creates a copy of the InvoiceRequestFeatures
29912  */
29913 struct LDKInvoiceRequestFeatures InvoiceRequestFeatures_clone(const struct LDKInvoiceRequestFeatures *NONNULL_PTR orig);
29914
29915 /**
29916  * Creates a copy of the Bolt12InvoiceFeatures
29917  */
29918 struct LDKBolt12InvoiceFeatures Bolt12InvoiceFeatures_clone(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR orig);
29919
29920 /**
29921  * Creates a copy of the BlindedHopFeatures
29922  */
29923 struct LDKBlindedHopFeatures BlindedHopFeatures_clone(const struct LDKBlindedHopFeatures *NONNULL_PTR orig);
29924
29925 /**
29926  * Creates a copy of the ChannelTypeFeatures
29927  */
29928 struct LDKChannelTypeFeatures ChannelTypeFeatures_clone(const struct LDKChannelTypeFeatures *NONNULL_PTR orig);
29929
29930 /**
29931  * Frees any resources used by the InitFeatures, if is_owned is set and inner is non-NULL.
29932  */
29933 void InitFeatures_free(struct LDKInitFeatures this_obj);
29934
29935 /**
29936  * Frees any resources used by the NodeFeatures, if is_owned is set and inner is non-NULL.
29937  */
29938 void NodeFeatures_free(struct LDKNodeFeatures this_obj);
29939
29940 /**
29941  * Frees any resources used by the ChannelFeatures, if is_owned is set and inner is non-NULL.
29942  */
29943 void ChannelFeatures_free(struct LDKChannelFeatures this_obj);
29944
29945 /**
29946  * Frees any resources used by the InvoiceFeatures, if is_owned is set and inner is non-NULL.
29947  */
29948 void InvoiceFeatures_free(struct LDKInvoiceFeatures this_obj);
29949
29950 /**
29951  * Frees any resources used by the OfferFeatures, if is_owned is set and inner is non-NULL.
29952  */
29953 void OfferFeatures_free(struct LDKOfferFeatures this_obj);
29954
29955 /**
29956  * Frees any resources used by the InvoiceRequestFeatures, if is_owned is set and inner is non-NULL.
29957  */
29958 void InvoiceRequestFeatures_free(struct LDKInvoiceRequestFeatures this_obj);
29959
29960 /**
29961  * Frees any resources used by the Bolt12InvoiceFeatures, if is_owned is set and inner is non-NULL.
29962  */
29963 void Bolt12InvoiceFeatures_free(struct LDKBolt12InvoiceFeatures this_obj);
29964
29965 /**
29966  * Frees any resources used by the BlindedHopFeatures, if is_owned is set and inner is non-NULL.
29967  */
29968 void BlindedHopFeatures_free(struct LDKBlindedHopFeatures this_obj);
29969
29970 /**
29971  * Frees any resources used by the ChannelTypeFeatures, if is_owned is set and inner is non-NULL.
29972  */
29973 void ChannelTypeFeatures_free(struct LDKChannelTypeFeatures this_obj);
29974
29975 /**
29976  * Create a blank Features with no features set
29977  */
29978 MUST_USE_RES struct LDKInitFeatures InitFeatures_empty(void);
29979
29980 /**
29981  * Returns true if this `Features` object contains unknown feature flags which are set as
29982  * \"required\".
29983  */
29984 MUST_USE_RES bool InitFeatures_requires_unknown_bits(const struct LDKInitFeatures *NONNULL_PTR this_arg);
29985
29986 /**
29987  * Create a blank Features with no features set
29988  */
29989 MUST_USE_RES struct LDKNodeFeatures NodeFeatures_empty(void);
29990
29991 /**
29992  * Returns true if this `Features` object contains unknown feature flags which are set as
29993  * \"required\".
29994  */
29995 MUST_USE_RES bool NodeFeatures_requires_unknown_bits(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
29996
29997 /**
29998  * Create a blank Features with no features set
29999  */
30000 MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_empty(void);
30001
30002 /**
30003  * Returns true if this `Features` object contains unknown feature flags which are set as
30004  * \"required\".
30005  */
30006 MUST_USE_RES bool ChannelFeatures_requires_unknown_bits(const struct LDKChannelFeatures *NONNULL_PTR this_arg);
30007
30008 /**
30009  * Create a blank Features with no features set
30010  */
30011 MUST_USE_RES struct LDKInvoiceFeatures InvoiceFeatures_empty(void);
30012
30013 /**
30014  * Returns true if this `Features` object contains unknown feature flags which are set as
30015  * \"required\".
30016  */
30017 MUST_USE_RES bool InvoiceFeatures_requires_unknown_bits(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
30018
30019 /**
30020  * Create a blank Features with no features set
30021  */
30022 MUST_USE_RES struct LDKOfferFeatures OfferFeatures_empty(void);
30023
30024 /**
30025  * Returns true if this `Features` object contains unknown feature flags which are set as
30026  * \"required\".
30027  */
30028 MUST_USE_RES bool OfferFeatures_requires_unknown_bits(const struct LDKOfferFeatures *NONNULL_PTR this_arg);
30029
30030 /**
30031  * Create a blank Features with no features set
30032  */
30033 MUST_USE_RES struct LDKInvoiceRequestFeatures InvoiceRequestFeatures_empty(void);
30034
30035 /**
30036  * Returns true if this `Features` object contains unknown feature flags which are set as
30037  * \"required\".
30038  */
30039 MUST_USE_RES bool InvoiceRequestFeatures_requires_unknown_bits(const struct LDKInvoiceRequestFeatures *NONNULL_PTR this_arg);
30040
30041 /**
30042  * Create a blank Features with no features set
30043  */
30044 MUST_USE_RES struct LDKBolt12InvoiceFeatures Bolt12InvoiceFeatures_empty(void);
30045
30046 /**
30047  * Returns true if this `Features` object contains unknown feature flags which are set as
30048  * \"required\".
30049  */
30050 MUST_USE_RES bool Bolt12InvoiceFeatures_requires_unknown_bits(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg);
30051
30052 /**
30053  * Create a blank Features with no features set
30054  */
30055 MUST_USE_RES struct LDKBlindedHopFeatures BlindedHopFeatures_empty(void);
30056
30057 /**
30058  * Returns true if this `Features` object contains unknown feature flags which are set as
30059  * \"required\".
30060  */
30061 MUST_USE_RES bool BlindedHopFeatures_requires_unknown_bits(const struct LDKBlindedHopFeatures *NONNULL_PTR this_arg);
30062
30063 /**
30064  * Create a blank Features with no features set
30065  */
30066 MUST_USE_RES struct LDKChannelTypeFeatures ChannelTypeFeatures_empty(void);
30067
30068 /**
30069  * Returns true if this `Features` object contains unknown feature flags which are set as
30070  * \"required\".
30071  */
30072 MUST_USE_RES bool ChannelTypeFeatures_requires_unknown_bits(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
30073
30074 /**
30075  * Serialize the InitFeatures object into a byte array which can be read by InitFeatures_read
30076  */
30077 struct LDKCVec_u8Z InitFeatures_write(const struct LDKInitFeatures *NONNULL_PTR obj);
30078
30079 /**
30080  * Read a InitFeatures from a byte array, created by InitFeatures_write
30081  */
30082 struct LDKCResult_InitFeaturesDecodeErrorZ InitFeatures_read(struct LDKu8slice ser);
30083
30084 /**
30085  * Serialize the ChannelFeatures object into a byte array which can be read by ChannelFeatures_read
30086  */
30087 struct LDKCVec_u8Z ChannelFeatures_write(const struct LDKChannelFeatures *NONNULL_PTR obj);
30088
30089 /**
30090  * Read a ChannelFeatures from a byte array, created by ChannelFeatures_write
30091  */
30092 struct LDKCResult_ChannelFeaturesDecodeErrorZ ChannelFeatures_read(struct LDKu8slice ser);
30093
30094 /**
30095  * Serialize the NodeFeatures object into a byte array which can be read by NodeFeatures_read
30096  */
30097 struct LDKCVec_u8Z NodeFeatures_write(const struct LDKNodeFeatures *NONNULL_PTR obj);
30098
30099 /**
30100  * Read a NodeFeatures from a byte array, created by NodeFeatures_write
30101  */
30102 struct LDKCResult_NodeFeaturesDecodeErrorZ NodeFeatures_read(struct LDKu8slice ser);
30103
30104 /**
30105  * Serialize the InvoiceFeatures object into a byte array which can be read by InvoiceFeatures_read
30106  */
30107 struct LDKCVec_u8Z InvoiceFeatures_write(const struct LDKInvoiceFeatures *NONNULL_PTR obj);
30108
30109 /**
30110  * Read a InvoiceFeatures from a byte array, created by InvoiceFeatures_write
30111  */
30112 struct LDKCResult_InvoiceFeaturesDecodeErrorZ InvoiceFeatures_read(struct LDKu8slice ser);
30113
30114 /**
30115  * Serialize the BlindedHopFeatures object into a byte array which can be read by BlindedHopFeatures_read
30116  */
30117 struct LDKCVec_u8Z BlindedHopFeatures_write(const struct LDKBlindedHopFeatures *NONNULL_PTR obj);
30118
30119 /**
30120  * Read a BlindedHopFeatures from a byte array, created by BlindedHopFeatures_write
30121  */
30122 struct LDKCResult_BlindedHopFeaturesDecodeErrorZ BlindedHopFeatures_read(struct LDKu8slice ser);
30123
30124 /**
30125  * Serialize the ChannelTypeFeatures object into a byte array which can be read by ChannelTypeFeatures_read
30126  */
30127 struct LDKCVec_u8Z ChannelTypeFeatures_write(const struct LDKChannelTypeFeatures *NONNULL_PTR obj);
30128
30129 /**
30130  * Read a ChannelTypeFeatures from a byte array, created by ChannelTypeFeatures_write
30131  */
30132 struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ ChannelTypeFeatures_read(struct LDKu8slice ser);
30133
30134 /**
30135  * Set this feature as optional.
30136  */
30137 void InitFeatures_set_data_loss_protect_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
30138
30139 /**
30140  * Set this feature as required.
30141  */
30142 void InitFeatures_set_data_loss_protect_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
30143
30144 /**
30145  * Checks if this feature is supported.
30146  */
30147 MUST_USE_RES bool InitFeatures_supports_data_loss_protect(const struct LDKInitFeatures *NONNULL_PTR this_arg);
30148
30149 /**
30150  * Set this feature as optional.
30151  */
30152 void NodeFeatures_set_data_loss_protect_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
30153
30154 /**
30155  * Set this feature as required.
30156  */
30157 void NodeFeatures_set_data_loss_protect_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
30158
30159 /**
30160  * Checks if this feature is supported.
30161  */
30162 MUST_USE_RES bool NodeFeatures_supports_data_loss_protect(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
30163
30164 /**
30165  * Checks if this feature is required.
30166  */
30167 MUST_USE_RES bool InitFeatures_requires_data_loss_protect(const struct LDKInitFeatures *NONNULL_PTR this_arg);
30168
30169 /**
30170  * Checks if this feature is required.
30171  */
30172 MUST_USE_RES bool NodeFeatures_requires_data_loss_protect(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
30173
30174 /**
30175  * Set this feature as optional.
30176  */
30177 void InitFeatures_set_initial_routing_sync_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
30178
30179 /**
30180  * Set this feature as required.
30181  */
30182 void InitFeatures_set_initial_routing_sync_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
30183
30184 /**
30185  * Checks if this feature is supported.
30186  */
30187 MUST_USE_RES bool InitFeatures_initial_routing_sync(const struct LDKInitFeatures *NONNULL_PTR this_arg);
30188
30189 /**
30190  * Set this feature as optional.
30191  */
30192 void InitFeatures_set_upfront_shutdown_script_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
30193
30194 /**
30195  * Set this feature as required.
30196  */
30197 void InitFeatures_set_upfront_shutdown_script_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
30198
30199 /**
30200  * Checks if this feature is supported.
30201  */
30202 MUST_USE_RES bool InitFeatures_supports_upfront_shutdown_script(const struct LDKInitFeatures *NONNULL_PTR this_arg);
30203
30204 /**
30205  * Set this feature as optional.
30206  */
30207 void NodeFeatures_set_upfront_shutdown_script_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
30208
30209 /**
30210  * Set this feature as required.
30211  */
30212 void NodeFeatures_set_upfront_shutdown_script_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
30213
30214 /**
30215  * Checks if this feature is supported.
30216  */
30217 MUST_USE_RES bool NodeFeatures_supports_upfront_shutdown_script(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
30218
30219 /**
30220  * Checks if this feature is required.
30221  */
30222 MUST_USE_RES bool InitFeatures_requires_upfront_shutdown_script(const struct LDKInitFeatures *NONNULL_PTR this_arg);
30223
30224 /**
30225  * Checks if this feature is required.
30226  */
30227 MUST_USE_RES bool NodeFeatures_requires_upfront_shutdown_script(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
30228
30229 /**
30230  * Set this feature as optional.
30231  */
30232 void InitFeatures_set_gossip_queries_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
30233
30234 /**
30235  * Set this feature as required.
30236  */
30237 void InitFeatures_set_gossip_queries_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
30238
30239 /**
30240  * Checks if this feature is supported.
30241  */
30242 MUST_USE_RES bool InitFeatures_supports_gossip_queries(const struct LDKInitFeatures *NONNULL_PTR this_arg);
30243
30244 /**
30245  * Set this feature as optional.
30246  */
30247 void NodeFeatures_set_gossip_queries_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
30248
30249 /**
30250  * Set this feature as required.
30251  */
30252 void NodeFeatures_set_gossip_queries_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
30253
30254 /**
30255  * Checks if this feature is supported.
30256  */
30257 MUST_USE_RES bool NodeFeatures_supports_gossip_queries(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
30258
30259 /**
30260  * Checks if this feature is required.
30261  */
30262 MUST_USE_RES bool InitFeatures_requires_gossip_queries(const struct LDKInitFeatures *NONNULL_PTR this_arg);
30263
30264 /**
30265  * Checks if this feature is required.
30266  */
30267 MUST_USE_RES bool NodeFeatures_requires_gossip_queries(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
30268
30269 /**
30270  * Set this feature as optional.
30271  */
30272 void InitFeatures_set_variable_length_onion_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
30273
30274 /**
30275  * Set this feature as required.
30276  */
30277 void InitFeatures_set_variable_length_onion_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
30278
30279 /**
30280  * Checks if this feature is supported.
30281  */
30282 MUST_USE_RES bool InitFeatures_supports_variable_length_onion(const struct LDKInitFeatures *NONNULL_PTR this_arg);
30283
30284 /**
30285  * Set this feature as optional.
30286  */
30287 void NodeFeatures_set_variable_length_onion_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
30288
30289 /**
30290  * Set this feature as required.
30291  */
30292 void NodeFeatures_set_variable_length_onion_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
30293
30294 /**
30295  * Checks if this feature is supported.
30296  */
30297 MUST_USE_RES bool NodeFeatures_supports_variable_length_onion(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
30298
30299 /**
30300  * Set this feature as optional.
30301  */
30302 void InvoiceFeatures_set_variable_length_onion_optional(struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
30303
30304 /**
30305  * Set this feature as required.
30306  */
30307 void InvoiceFeatures_set_variable_length_onion_required(struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
30308
30309 /**
30310  * Checks if this feature is supported.
30311  */
30312 MUST_USE_RES bool InvoiceFeatures_supports_variable_length_onion(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
30313
30314 /**
30315  * Checks if this feature is required.
30316  */
30317 MUST_USE_RES bool InitFeatures_requires_variable_length_onion(const struct LDKInitFeatures *NONNULL_PTR this_arg);
30318
30319 /**
30320  * Checks if this feature is required.
30321  */
30322 MUST_USE_RES bool NodeFeatures_requires_variable_length_onion(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
30323
30324 /**
30325  * Checks if this feature is required.
30326  */
30327 MUST_USE_RES bool InvoiceFeatures_requires_variable_length_onion(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
30328
30329 /**
30330  * Set this feature as optional.
30331  */
30332 void InitFeatures_set_static_remote_key_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
30333
30334 /**
30335  * Set this feature as required.
30336  */
30337 void InitFeatures_set_static_remote_key_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
30338
30339 /**
30340  * Checks if this feature is supported.
30341  */
30342 MUST_USE_RES bool InitFeatures_supports_static_remote_key(const struct LDKInitFeatures *NONNULL_PTR this_arg);
30343
30344 /**
30345  * Set this feature as optional.
30346  */
30347 void NodeFeatures_set_static_remote_key_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
30348
30349 /**
30350  * Set this feature as required.
30351  */
30352 void NodeFeatures_set_static_remote_key_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
30353
30354 /**
30355  * Checks if this feature is supported.
30356  */
30357 MUST_USE_RES bool NodeFeatures_supports_static_remote_key(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
30358
30359 /**
30360  * Set this feature as optional.
30361  */
30362 void ChannelTypeFeatures_set_static_remote_key_optional(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
30363
30364 /**
30365  * Set this feature as required.
30366  */
30367 void ChannelTypeFeatures_set_static_remote_key_required(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
30368
30369 /**
30370  * Checks if this feature is supported.
30371  */
30372 MUST_USE_RES bool ChannelTypeFeatures_supports_static_remote_key(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
30373
30374 /**
30375  * Checks if this feature is required.
30376  */
30377 MUST_USE_RES bool InitFeatures_requires_static_remote_key(const struct LDKInitFeatures *NONNULL_PTR this_arg);
30378
30379 /**
30380  * Checks if this feature is required.
30381  */
30382 MUST_USE_RES bool NodeFeatures_requires_static_remote_key(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
30383
30384 /**
30385  * Checks if this feature is required.
30386  */
30387 MUST_USE_RES bool ChannelTypeFeatures_requires_static_remote_key(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
30388
30389 /**
30390  * Set this feature as optional.
30391  */
30392 void InitFeatures_set_payment_secret_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
30393
30394 /**
30395  * Set this feature as required.
30396  */
30397 void InitFeatures_set_payment_secret_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
30398
30399 /**
30400  * Checks if this feature is supported.
30401  */
30402 MUST_USE_RES bool InitFeatures_supports_payment_secret(const struct LDKInitFeatures *NONNULL_PTR this_arg);
30403
30404 /**
30405  * Set this feature as optional.
30406  */
30407 void NodeFeatures_set_payment_secret_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
30408
30409 /**
30410  * Set this feature as required.
30411  */
30412 void NodeFeatures_set_payment_secret_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
30413
30414 /**
30415  * Checks if this feature is supported.
30416  */
30417 MUST_USE_RES bool NodeFeatures_supports_payment_secret(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
30418
30419 /**
30420  * Set this feature as optional.
30421  */
30422 void InvoiceFeatures_set_payment_secret_optional(struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
30423
30424 /**
30425  * Set this feature as required.
30426  */
30427 void InvoiceFeatures_set_payment_secret_required(struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
30428
30429 /**
30430  * Checks if this feature is supported.
30431  */
30432 MUST_USE_RES bool InvoiceFeatures_supports_payment_secret(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
30433
30434 /**
30435  * Checks if this feature is required.
30436  */
30437 MUST_USE_RES bool InitFeatures_requires_payment_secret(const struct LDKInitFeatures *NONNULL_PTR this_arg);
30438
30439 /**
30440  * Checks if this feature is required.
30441  */
30442 MUST_USE_RES bool NodeFeatures_requires_payment_secret(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
30443
30444 /**
30445  * Checks if this feature is required.
30446  */
30447 MUST_USE_RES bool InvoiceFeatures_requires_payment_secret(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
30448
30449 /**
30450  * Set this feature as optional.
30451  */
30452 void InitFeatures_set_basic_mpp_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
30453
30454 /**
30455  * Set this feature as required.
30456  */
30457 void InitFeatures_set_basic_mpp_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
30458
30459 /**
30460  * Checks if this feature is supported.
30461  */
30462 MUST_USE_RES bool InitFeatures_supports_basic_mpp(const struct LDKInitFeatures *NONNULL_PTR this_arg);
30463
30464 /**
30465  * Set this feature as optional.
30466  */
30467 void NodeFeatures_set_basic_mpp_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
30468
30469 /**
30470  * Set this feature as required.
30471  */
30472 void NodeFeatures_set_basic_mpp_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
30473
30474 /**
30475  * Checks if this feature is supported.
30476  */
30477 MUST_USE_RES bool NodeFeatures_supports_basic_mpp(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
30478
30479 /**
30480  * Set this feature as optional.
30481  */
30482 void InvoiceFeatures_set_basic_mpp_optional(struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
30483
30484 /**
30485  * Set this feature as required.
30486  */
30487 void InvoiceFeatures_set_basic_mpp_required(struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
30488
30489 /**
30490  * Checks if this feature is supported.
30491  */
30492 MUST_USE_RES bool InvoiceFeatures_supports_basic_mpp(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
30493
30494 /**
30495  * Set this feature as optional.
30496  */
30497 void Bolt12InvoiceFeatures_set_basic_mpp_optional(struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg);
30498
30499 /**
30500  * Set this feature as required.
30501  */
30502 void Bolt12InvoiceFeatures_set_basic_mpp_required(struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg);
30503
30504 /**
30505  * Checks if this feature is supported.
30506  */
30507 MUST_USE_RES bool Bolt12InvoiceFeatures_supports_basic_mpp(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg);
30508
30509 /**
30510  * Checks if this feature is required.
30511  */
30512 MUST_USE_RES bool InitFeatures_requires_basic_mpp(const struct LDKInitFeatures *NONNULL_PTR this_arg);
30513
30514 /**
30515  * Checks if this feature is required.
30516  */
30517 MUST_USE_RES bool NodeFeatures_requires_basic_mpp(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
30518
30519 /**
30520  * Checks if this feature is required.
30521  */
30522 MUST_USE_RES bool InvoiceFeatures_requires_basic_mpp(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
30523
30524 /**
30525  * Checks if this feature is required.
30526  */
30527 MUST_USE_RES bool Bolt12InvoiceFeatures_requires_basic_mpp(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg);
30528
30529 /**
30530  * Set this feature as optional.
30531  */
30532 void InitFeatures_set_wumbo_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
30533
30534 /**
30535  * Set this feature as required.
30536  */
30537 void InitFeatures_set_wumbo_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
30538
30539 /**
30540  * Checks if this feature is supported.
30541  */
30542 MUST_USE_RES bool InitFeatures_supports_wumbo(const struct LDKInitFeatures *NONNULL_PTR this_arg);
30543
30544 /**
30545  * Set this feature as optional.
30546  */
30547 void NodeFeatures_set_wumbo_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
30548
30549 /**
30550  * Set this feature as required.
30551  */
30552 void NodeFeatures_set_wumbo_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
30553
30554 /**
30555  * Checks if this feature is supported.
30556  */
30557 MUST_USE_RES bool NodeFeatures_supports_wumbo(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
30558
30559 /**
30560  * Checks if this feature is required.
30561  */
30562 MUST_USE_RES bool InitFeatures_requires_wumbo(const struct LDKInitFeatures *NONNULL_PTR this_arg);
30563
30564 /**
30565  * Checks if this feature is required.
30566  */
30567 MUST_USE_RES bool NodeFeatures_requires_wumbo(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
30568
30569 /**
30570  * Set this feature as optional.
30571  */
30572 void InitFeatures_set_anchors_zero_fee_htlc_tx_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
30573
30574 /**
30575  * Set this feature as required.
30576  */
30577 void InitFeatures_set_anchors_zero_fee_htlc_tx_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
30578
30579 /**
30580  * Checks if this feature is supported.
30581  */
30582 MUST_USE_RES bool InitFeatures_supports_anchors_zero_fee_htlc_tx(const struct LDKInitFeatures *NONNULL_PTR this_arg);
30583
30584 /**
30585  * Set this feature as optional.
30586  */
30587 void NodeFeatures_set_anchors_zero_fee_htlc_tx_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
30588
30589 /**
30590  * Set this feature as required.
30591  */
30592 void NodeFeatures_set_anchors_zero_fee_htlc_tx_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
30593
30594 /**
30595  * Checks if this feature is supported.
30596  */
30597 MUST_USE_RES bool NodeFeatures_supports_anchors_zero_fee_htlc_tx(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
30598
30599 /**
30600  * Set this feature as optional.
30601  */
30602 void ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_optional(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
30603
30604 /**
30605  * Set this feature as required.
30606  */
30607 void ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_required(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
30608
30609 /**
30610  * Checks if this feature is supported.
30611  */
30612 MUST_USE_RES bool ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
30613
30614 /**
30615  * Checks if this feature is required.
30616  */
30617 MUST_USE_RES bool InitFeatures_requires_anchors_zero_fee_htlc_tx(const struct LDKInitFeatures *NONNULL_PTR this_arg);
30618
30619 /**
30620  * Checks if this feature is required.
30621  */
30622 MUST_USE_RES bool NodeFeatures_requires_anchors_zero_fee_htlc_tx(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
30623
30624 /**
30625  * Checks if this feature is required.
30626  */
30627 MUST_USE_RES bool ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
30628
30629 /**
30630  * Set this feature as optional.
30631  */
30632 void InitFeatures_set_shutdown_any_segwit_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
30633
30634 /**
30635  * Set this feature as required.
30636  */
30637 void InitFeatures_set_shutdown_any_segwit_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
30638
30639 /**
30640  * Checks if this feature is supported.
30641  */
30642 MUST_USE_RES bool InitFeatures_supports_shutdown_anysegwit(const struct LDKInitFeatures *NONNULL_PTR this_arg);
30643
30644 /**
30645  * Set this feature as optional.
30646  */
30647 void NodeFeatures_set_shutdown_any_segwit_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
30648
30649 /**
30650  * Set this feature as required.
30651  */
30652 void NodeFeatures_set_shutdown_any_segwit_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
30653
30654 /**
30655  * Checks if this feature is supported.
30656  */
30657 MUST_USE_RES bool NodeFeatures_supports_shutdown_anysegwit(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
30658
30659 /**
30660  * Checks if this feature is required.
30661  */
30662 MUST_USE_RES bool InitFeatures_requires_shutdown_anysegwit(const struct LDKInitFeatures *NONNULL_PTR this_arg);
30663
30664 /**
30665  * Checks if this feature is required.
30666  */
30667 MUST_USE_RES bool NodeFeatures_requires_shutdown_anysegwit(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
30668
30669 /**
30670  * Set this feature as optional.
30671  */
30672 void InitFeatures_set_onion_messages_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
30673
30674 /**
30675  * Set this feature as required.
30676  */
30677 void InitFeatures_set_onion_messages_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
30678
30679 /**
30680  * Checks if this feature is supported.
30681  */
30682 MUST_USE_RES bool InitFeatures_supports_onion_messages(const struct LDKInitFeatures *NONNULL_PTR this_arg);
30683
30684 /**
30685  * Set this feature as optional.
30686  */
30687 void NodeFeatures_set_onion_messages_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
30688
30689 /**
30690  * Set this feature as required.
30691  */
30692 void NodeFeatures_set_onion_messages_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
30693
30694 /**
30695  * Checks if this feature is supported.
30696  */
30697 MUST_USE_RES bool NodeFeatures_supports_onion_messages(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
30698
30699 /**
30700  * Checks if this feature is required.
30701  */
30702 MUST_USE_RES bool InitFeatures_requires_onion_messages(const struct LDKInitFeatures *NONNULL_PTR this_arg);
30703
30704 /**
30705  * Checks if this feature is required.
30706  */
30707 MUST_USE_RES bool NodeFeatures_requires_onion_messages(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
30708
30709 /**
30710  * Set this feature as optional.
30711  */
30712 void InitFeatures_set_channel_type_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
30713
30714 /**
30715  * Set this feature as required.
30716  */
30717 void InitFeatures_set_channel_type_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
30718
30719 /**
30720  * Checks if this feature is supported.
30721  */
30722 MUST_USE_RES bool InitFeatures_supports_channel_type(const struct LDKInitFeatures *NONNULL_PTR this_arg);
30723
30724 /**
30725  * Set this feature as optional.
30726  */
30727 void NodeFeatures_set_channel_type_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
30728
30729 /**
30730  * Set this feature as required.
30731  */
30732 void NodeFeatures_set_channel_type_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
30733
30734 /**
30735  * Checks if this feature is supported.
30736  */
30737 MUST_USE_RES bool NodeFeatures_supports_channel_type(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
30738
30739 /**
30740  * Checks if this feature is required.
30741  */
30742 MUST_USE_RES bool InitFeatures_requires_channel_type(const struct LDKInitFeatures *NONNULL_PTR this_arg);
30743
30744 /**
30745  * Checks if this feature is required.
30746  */
30747 MUST_USE_RES bool NodeFeatures_requires_channel_type(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
30748
30749 /**
30750  * Set this feature as optional.
30751  */
30752 void InitFeatures_set_scid_privacy_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
30753
30754 /**
30755  * Set this feature as required.
30756  */
30757 void InitFeatures_set_scid_privacy_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
30758
30759 /**
30760  * Checks if this feature is supported.
30761  */
30762 MUST_USE_RES bool InitFeatures_supports_scid_privacy(const struct LDKInitFeatures *NONNULL_PTR this_arg);
30763
30764 /**
30765  * Set this feature as optional.
30766  */
30767 void NodeFeatures_set_scid_privacy_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
30768
30769 /**
30770  * Set this feature as required.
30771  */
30772 void NodeFeatures_set_scid_privacy_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
30773
30774 /**
30775  * Checks if this feature is supported.
30776  */
30777 MUST_USE_RES bool NodeFeatures_supports_scid_privacy(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
30778
30779 /**
30780  * Set this feature as optional.
30781  */
30782 void ChannelTypeFeatures_set_scid_privacy_optional(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
30783
30784 /**
30785  * Set this feature as required.
30786  */
30787 void ChannelTypeFeatures_set_scid_privacy_required(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
30788
30789 /**
30790  * Checks if this feature is supported.
30791  */
30792 MUST_USE_RES bool ChannelTypeFeatures_supports_scid_privacy(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
30793
30794 /**
30795  * Checks if this feature is required.
30796  */
30797 MUST_USE_RES bool InitFeatures_requires_scid_privacy(const struct LDKInitFeatures *NONNULL_PTR this_arg);
30798
30799 /**
30800  * Checks if this feature is required.
30801  */
30802 MUST_USE_RES bool NodeFeatures_requires_scid_privacy(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
30803
30804 /**
30805  * Checks if this feature is required.
30806  */
30807 MUST_USE_RES bool ChannelTypeFeatures_requires_scid_privacy(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
30808
30809 /**
30810  * Set this feature as optional.
30811  */
30812 void InvoiceFeatures_set_payment_metadata_optional(struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
30813
30814 /**
30815  * Set this feature as required.
30816  */
30817 void InvoiceFeatures_set_payment_metadata_required(struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
30818
30819 /**
30820  * Checks if this feature is supported.
30821  */
30822 MUST_USE_RES bool InvoiceFeatures_supports_payment_metadata(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
30823
30824 /**
30825  * Checks if this feature is required.
30826  */
30827 MUST_USE_RES bool InvoiceFeatures_requires_payment_metadata(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
30828
30829 /**
30830  * Set this feature as optional.
30831  */
30832 void InitFeatures_set_zero_conf_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
30833
30834 /**
30835  * Set this feature as required.
30836  */
30837 void InitFeatures_set_zero_conf_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
30838
30839 /**
30840  * Checks if this feature is supported.
30841  */
30842 MUST_USE_RES bool InitFeatures_supports_zero_conf(const struct LDKInitFeatures *NONNULL_PTR this_arg);
30843
30844 /**
30845  * Set this feature as optional.
30846  */
30847 void NodeFeatures_set_zero_conf_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
30848
30849 /**
30850  * Set this feature as required.
30851  */
30852 void NodeFeatures_set_zero_conf_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
30853
30854 /**
30855  * Checks if this feature is supported.
30856  */
30857 MUST_USE_RES bool NodeFeatures_supports_zero_conf(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
30858
30859 /**
30860  * Set this feature as optional.
30861  */
30862 void ChannelTypeFeatures_set_zero_conf_optional(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
30863
30864 /**
30865  * Set this feature as required.
30866  */
30867 void ChannelTypeFeatures_set_zero_conf_required(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
30868
30869 /**
30870  * Checks if this feature is supported.
30871  */
30872 MUST_USE_RES bool ChannelTypeFeatures_supports_zero_conf(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
30873
30874 /**
30875  * Checks if this feature is required.
30876  */
30877 MUST_USE_RES bool InitFeatures_requires_zero_conf(const struct LDKInitFeatures *NONNULL_PTR this_arg);
30878
30879 /**
30880  * Checks if this feature is required.
30881  */
30882 MUST_USE_RES bool NodeFeatures_requires_zero_conf(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
30883
30884 /**
30885  * Checks if this feature is required.
30886  */
30887 MUST_USE_RES bool ChannelTypeFeatures_requires_zero_conf(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
30888
30889 /**
30890  * Set this feature as optional.
30891  */
30892 void NodeFeatures_set_keysend_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
30893
30894 /**
30895  * Set this feature as required.
30896  */
30897 void NodeFeatures_set_keysend_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
30898
30899 /**
30900  * Checks if this feature is supported.
30901  */
30902 MUST_USE_RES bool NodeFeatures_supports_keysend(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
30903
30904 /**
30905  * Checks if this feature is required.
30906  */
30907 MUST_USE_RES bool NodeFeatures_requires_keysend(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
30908
30909 /**
30910  * Frees any resources used by the ShutdownScript, if is_owned is set and inner is non-NULL.
30911  */
30912 void ShutdownScript_free(struct LDKShutdownScript this_obj);
30913
30914 /**
30915  * Creates a copy of the ShutdownScript
30916  */
30917 struct LDKShutdownScript ShutdownScript_clone(const struct LDKShutdownScript *NONNULL_PTR orig);
30918
30919 /**
30920  * Checks if two ShutdownScripts contain equal inner contents.
30921  * This ignores pointers and is_owned flags and looks at the values in fields.
30922  * Two objects with NULL inner values will be considered "equal" here.
30923  */
30924 bool ShutdownScript_eq(const struct LDKShutdownScript *NONNULL_PTR a, const struct LDKShutdownScript *NONNULL_PTR b);
30925
30926 /**
30927  * Frees any resources used by the InvalidShutdownScript, if is_owned is set and inner is non-NULL.
30928  */
30929 void InvalidShutdownScript_free(struct LDKInvalidShutdownScript this_obj);
30930
30931 /**
30932  * The script that did not meet the requirements from [BOLT #2].
30933  *
30934  * [BOLT #2]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md
30935  */
30936 struct LDKu8slice InvalidShutdownScript_get_script(const struct LDKInvalidShutdownScript *NONNULL_PTR this_ptr);
30937
30938 /**
30939  * The script that did not meet the requirements from [BOLT #2].
30940  *
30941  * [BOLT #2]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md
30942  */
30943 void InvalidShutdownScript_set_script(struct LDKInvalidShutdownScript *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
30944
30945 /**
30946  * Constructs a new InvalidShutdownScript given each field
30947  */
30948 MUST_USE_RES struct LDKInvalidShutdownScript InvalidShutdownScript_new(struct LDKCVec_u8Z script_arg);
30949
30950 /**
30951  * Creates a copy of the InvalidShutdownScript
30952  */
30953 struct LDKInvalidShutdownScript InvalidShutdownScript_clone(const struct LDKInvalidShutdownScript *NONNULL_PTR orig);
30954
30955 /**
30956  * Serialize the ShutdownScript object into a byte array which can be read by ShutdownScript_read
30957  */
30958 struct LDKCVec_u8Z ShutdownScript_write(const struct LDKShutdownScript *NONNULL_PTR obj);
30959
30960 /**
30961  * Read a ShutdownScript from a byte array, created by ShutdownScript_write
30962  */
30963 struct LDKCResult_ShutdownScriptDecodeErrorZ ShutdownScript_read(struct LDKu8slice ser);
30964
30965 /**
30966  * Generates a P2WPKH script pubkey from the given [`WPubkeyHash`].
30967  */
30968 MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2wpkh(const uint8_t (*pubkey_hash)[20]);
30969
30970 /**
30971  * Generates a P2WSH script pubkey from the given [`WScriptHash`].
30972  */
30973 MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2wsh(const uint8_t (*script_hash)[32]);
30974
30975 /**
30976  * Generates a witness script pubkey from the given segwit version and program.
30977  *
30978  * Note for version-zero witness scripts you must use [`ShutdownScript::new_p2wpkh`] or
30979  * [`ShutdownScript::new_p2wsh`] instead.
30980  *
30981  * # Errors
30982  *
30983  * This function may return an error if `program` is invalid for the segwit `version`.
30984  */
30985 MUST_USE_RES struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ ShutdownScript_new_witness_program(struct LDKWitnessVersion version, struct LDKu8slice program);
30986
30987 /**
30988  * Converts the shutdown script into the underlying [`Script`].
30989  */
30990 MUST_USE_RES struct LDKCVec_u8Z ShutdownScript_into_inner(struct LDKShutdownScript this_arg);
30991
30992 /**
30993  * Returns the [`PublicKey`] used for a P2WPKH shutdown script if constructed directly from it.
30994  *
30995  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
30996  */
30997 MUST_USE_RES struct LDKPublicKey ShutdownScript_as_legacy_pubkey(const struct LDKShutdownScript *NONNULL_PTR this_arg);
30998
30999 /**
31000  * Returns whether the shutdown script is compatible with the features as defined by BOLT #2.
31001  *
31002  * Specifically, checks for compliance with feature `option_shutdown_anysegwit`.
31003  */
31004 MUST_USE_RES bool ShutdownScript_is_compatible(const struct LDKShutdownScript *NONNULL_PTR this_arg, const struct LDKInitFeatures *NONNULL_PTR features);
31005
31006 /**
31007  * Frees any resources used by the Retry
31008  */
31009 void Retry_free(struct LDKRetry this_ptr);
31010
31011 /**
31012  * Creates a copy of the Retry
31013  */
31014 struct LDKRetry Retry_clone(const struct LDKRetry *NONNULL_PTR orig);
31015
31016 /**
31017  * Utility method to constructs a new Attempts-variant Retry
31018  */
31019 struct LDKRetry Retry_attempts(uintptr_t a);
31020
31021 /**
31022  * Utility method to constructs a new Timeout-variant Retry
31023  */
31024 struct LDKRetry Retry_timeout(uint64_t a);
31025
31026 /**
31027  * Checks if two Retrys contain equal inner contents.
31028  * This ignores pointers and is_owned flags and looks at the values in fields.
31029  */
31030 bool Retry_eq(const struct LDKRetry *NONNULL_PTR a, const struct LDKRetry *NONNULL_PTR b);
31031
31032 /**
31033  * Generates a non-cryptographic 64-bit hash of the Retry.
31034  */
31035 uint64_t Retry_hash(const struct LDKRetry *NONNULL_PTR o);
31036
31037 /**
31038  * Creates a copy of the RetryableSendFailure
31039  */
31040 enum LDKRetryableSendFailure RetryableSendFailure_clone(const enum LDKRetryableSendFailure *NONNULL_PTR orig);
31041
31042 /**
31043  * Utility method to constructs a new PaymentExpired-variant RetryableSendFailure
31044  */
31045 enum LDKRetryableSendFailure RetryableSendFailure_payment_expired(void);
31046
31047 /**
31048  * Utility method to constructs a new RouteNotFound-variant RetryableSendFailure
31049  */
31050 enum LDKRetryableSendFailure RetryableSendFailure_route_not_found(void);
31051
31052 /**
31053  * Utility method to constructs a new DuplicatePayment-variant RetryableSendFailure
31054  */
31055 enum LDKRetryableSendFailure RetryableSendFailure_duplicate_payment(void);
31056
31057 /**
31058  * Frees any resources used by the PaymentSendFailure
31059  */
31060 void PaymentSendFailure_free(struct LDKPaymentSendFailure this_ptr);
31061
31062 /**
31063  * Creates a copy of the PaymentSendFailure
31064  */
31065 struct LDKPaymentSendFailure PaymentSendFailure_clone(const struct LDKPaymentSendFailure *NONNULL_PTR orig);
31066
31067 /**
31068  * Utility method to constructs a new ParameterError-variant PaymentSendFailure
31069  */
31070 struct LDKPaymentSendFailure PaymentSendFailure_parameter_error(struct LDKAPIError a);
31071
31072 /**
31073  * Utility method to constructs a new PathParameterError-variant PaymentSendFailure
31074  */
31075 struct LDKPaymentSendFailure PaymentSendFailure_path_parameter_error(struct LDKCVec_CResult_NoneAPIErrorZZ a);
31076
31077 /**
31078  * Utility method to constructs a new AllFailedResendSafe-variant PaymentSendFailure
31079  */
31080 struct LDKPaymentSendFailure PaymentSendFailure_all_failed_resend_safe(struct LDKCVec_APIErrorZ a);
31081
31082 /**
31083  * Utility method to constructs a new DuplicatePayment-variant PaymentSendFailure
31084  */
31085 struct LDKPaymentSendFailure PaymentSendFailure_duplicate_payment(void);
31086
31087 /**
31088  * Utility method to constructs a new PartialFailure-variant PaymentSendFailure
31089  */
31090 struct LDKPaymentSendFailure PaymentSendFailure_partial_failure(struct LDKCVec_CResult_NoneAPIErrorZZ results, struct LDKRouteParameters failed_paths_retry, struct LDKThirtyTwoBytes payment_id);
31091
31092 /**
31093  * Frees any resources used by the RecipientOnionFields, if is_owned is set and inner is non-NULL.
31094  */
31095 void RecipientOnionFields_free(struct LDKRecipientOnionFields this_obj);
31096
31097 /**
31098  * The [`PaymentSecret`] is an arbitrary 32 bytes provided by the recipient for us to repeat
31099  * in the onion. It is unrelated to `payment_hash` (or [`PaymentPreimage`]) and exists to
31100  * authenticate the sender to the recipient and prevent payment-probing (deanonymization)
31101  * attacks.
31102  *
31103  * If you do not have one, the [`Route`] you pay over must not contain multiple paths as
31104  * multi-path payments require a recipient-provided secret.
31105  *
31106  * Note that for spontaneous payments most lightning nodes do not currently support MPP
31107  * receives, thus you should generally never be providing a secret here for spontaneous
31108  * payments.
31109  *
31110  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
31111  */
31112 struct LDKThirtyTwoBytes RecipientOnionFields_get_payment_secret(const struct LDKRecipientOnionFields *NONNULL_PTR this_ptr);
31113
31114 /**
31115  * The [`PaymentSecret`] is an arbitrary 32 bytes provided by the recipient for us to repeat
31116  * in the onion. It is unrelated to `payment_hash` (or [`PaymentPreimage`]) and exists to
31117  * authenticate the sender to the recipient and prevent payment-probing (deanonymization)
31118  * attacks.
31119  *
31120  * If you do not have one, the [`Route`] you pay over must not contain multiple paths as
31121  * multi-path payments require a recipient-provided secret.
31122  *
31123  * Note that for spontaneous payments most lightning nodes do not currently support MPP
31124  * receives, thus you should generally never be providing a secret here for spontaneous
31125  * payments.
31126  *
31127  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
31128  */
31129 void RecipientOnionFields_set_payment_secret(struct LDKRecipientOnionFields *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
31130
31131 /**
31132  * The payment metadata serves a similar purpose as [`Self::payment_secret`] but is of
31133  * arbitrary length. This gives recipients substantially more flexibility to receive
31134  * additional data.
31135  *
31136  * In LDK, while the [`Self::payment_secret`] is fixed based on an internal authentication
31137  * scheme to authenticate received payments against expected payments and invoices, this field
31138  * is not used in LDK for received payments, and can be used to store arbitrary data in
31139  * invoices which will be received with the payment.
31140  *
31141  * Note that this field was added to the lightning specification more recently than
31142  * [`Self::payment_secret`] and while nearly all lightning senders support secrets, metadata
31143  * may not be supported as universally.
31144  *
31145  * Returns a copy of the field.
31146  */
31147 struct LDKCOption_CVec_u8ZZ RecipientOnionFields_get_payment_metadata(const struct LDKRecipientOnionFields *NONNULL_PTR this_ptr);
31148
31149 /**
31150  * The payment metadata serves a similar purpose as [`Self::payment_secret`] but is of
31151  * arbitrary length. This gives recipients substantially more flexibility to receive
31152  * additional data.
31153  *
31154  * In LDK, while the [`Self::payment_secret`] is fixed based on an internal authentication
31155  * scheme to authenticate received payments against expected payments and invoices, this field
31156  * is not used in LDK for received payments, and can be used to store arbitrary data in
31157  * invoices which will be received with the payment.
31158  *
31159  * Note that this field was added to the lightning specification more recently than
31160  * [`Self::payment_secret`] and while nearly all lightning senders support secrets, metadata
31161  * may not be supported as universally.
31162  */
31163 void RecipientOnionFields_set_payment_metadata(struct LDKRecipientOnionFields *NONNULL_PTR this_ptr, struct LDKCOption_CVec_u8ZZ val);
31164
31165 /**
31166  * Constructs a new RecipientOnionFields given each field
31167  */
31168 MUST_USE_RES struct LDKRecipientOnionFields RecipientOnionFields_new(struct LDKThirtyTwoBytes payment_secret_arg, struct LDKCOption_CVec_u8ZZ payment_metadata_arg);
31169
31170 /**
31171  * Creates a copy of the RecipientOnionFields
31172  */
31173 struct LDKRecipientOnionFields RecipientOnionFields_clone(const struct LDKRecipientOnionFields *NONNULL_PTR orig);
31174
31175 /**
31176  * Checks if two RecipientOnionFieldss contain equal inner contents.
31177  * This ignores pointers and is_owned flags and looks at the values in fields.
31178  * Two objects with NULL inner values will be considered "equal" here.
31179  */
31180 bool RecipientOnionFields_eq(const struct LDKRecipientOnionFields *NONNULL_PTR a, const struct LDKRecipientOnionFields *NONNULL_PTR b);
31181
31182 /**
31183  * Serialize the RecipientOnionFields object into a byte array which can be read by RecipientOnionFields_read
31184  */
31185 struct LDKCVec_u8Z RecipientOnionFields_write(const struct LDKRecipientOnionFields *NONNULL_PTR obj);
31186
31187 /**
31188  * Read a RecipientOnionFields from a byte array, created by RecipientOnionFields_write
31189  */
31190 struct LDKCResult_RecipientOnionFieldsDecodeErrorZ RecipientOnionFields_read(struct LDKu8slice ser);
31191
31192 /**
31193  * Creates a [`RecipientOnionFields`] from only a [`PaymentSecret`]. This is the most common
31194  * set of onion fields for today's BOLT11 invoices - most nodes require a [`PaymentSecret`]
31195  * but do not require or provide any further data.
31196  */
31197 MUST_USE_RES struct LDKRecipientOnionFields RecipientOnionFields_secret_only(struct LDKThirtyTwoBytes payment_secret);
31198
31199 /**
31200  * Creates a new [`RecipientOnionFields`] with no fields. This generally does not create
31201  * payable HTLCs except for spontaneous payments, i.e. this should generally only be used for
31202  * calls to [`ChannelManager::send_spontaneous_payment`].
31203  *
31204  * [`ChannelManager::send_spontaneous_payment`]: super::channelmanager::ChannelManager::send_spontaneous_payment
31205  */
31206 MUST_USE_RES struct LDKRecipientOnionFields RecipientOnionFields_spontaneous_empty(void);
31207
31208 /**
31209  * Calls the free function if one is set
31210  */
31211 void CustomMessageReader_free(struct LDKCustomMessageReader this_ptr);
31212
31213 /**
31214  * Calls the free function if one is set
31215  */
31216 void Type_free(struct LDKType this_ptr);
31217
31218 /**
31219  * Frees any resources used by the UnsignedInvoice, if is_owned is set and inner is non-NULL.
31220  */
31221 void UnsignedInvoice_free(struct LDKUnsignedInvoice this_obj);
31222
31223 /**
31224  * The public key corresponding to the key needed to sign the invoice.
31225  */
31226 MUST_USE_RES struct LDKPublicKey UnsignedInvoice_signing_pubkey(const struct LDKUnsignedInvoice *NONNULL_PTR this_arg);
31227
31228 /**
31229  * Frees any resources used by the BlindedPayInfo, if is_owned is set and inner is non-NULL.
31230  */
31231 void BlindedPayInfo_free(struct LDKBlindedPayInfo this_obj);
31232
31233 /**
31234  * Base fee charged (in millisatoshi) for the entire blinded path.
31235  */
31236 uint32_t BlindedPayInfo_get_fee_base_msat(const struct LDKBlindedPayInfo *NONNULL_PTR this_ptr);
31237
31238 /**
31239  * Base fee charged (in millisatoshi) for the entire blinded path.
31240  */
31241 void BlindedPayInfo_set_fee_base_msat(struct LDKBlindedPayInfo *NONNULL_PTR this_ptr, uint32_t val);
31242
31243 /**
31244  * Liquidity fee charged (in millionths of the amount transferred) for the entire blinded path
31245  * (i.e., 10,000 is 1%).
31246  */
31247 uint32_t BlindedPayInfo_get_fee_proportional_millionths(const struct LDKBlindedPayInfo *NONNULL_PTR this_ptr);
31248
31249 /**
31250  * Liquidity fee charged (in millionths of the amount transferred) for the entire blinded path
31251  * (i.e., 10,000 is 1%).
31252  */
31253 void BlindedPayInfo_set_fee_proportional_millionths(struct LDKBlindedPayInfo *NONNULL_PTR this_ptr, uint32_t val);
31254
31255 /**
31256  * Number of blocks subtracted from an incoming HTLC's `cltv_expiry` for the entire blinded
31257  * path.
31258  */
31259 uint16_t BlindedPayInfo_get_cltv_expiry_delta(const struct LDKBlindedPayInfo *NONNULL_PTR this_ptr);
31260
31261 /**
31262  * Number of blocks subtracted from an incoming HTLC's `cltv_expiry` for the entire blinded
31263  * path.
31264  */
31265 void BlindedPayInfo_set_cltv_expiry_delta(struct LDKBlindedPayInfo *NONNULL_PTR this_ptr, uint16_t val);
31266
31267 /**
31268  * The minimum HTLC value (in millisatoshi) that is acceptable to all channel peers on the
31269  * blinded path from the introduction node to the recipient, accounting for any fees, i.e., as
31270  * seen by the recipient.
31271  */
31272 uint64_t BlindedPayInfo_get_htlc_minimum_msat(const struct LDKBlindedPayInfo *NONNULL_PTR this_ptr);
31273
31274 /**
31275  * The minimum HTLC value (in millisatoshi) that is acceptable to all channel peers on the
31276  * blinded path from the introduction node to the recipient, accounting for any fees, i.e., as
31277  * seen by the recipient.
31278  */
31279 void BlindedPayInfo_set_htlc_minimum_msat(struct LDKBlindedPayInfo *NONNULL_PTR this_ptr, uint64_t val);
31280
31281 /**
31282  * The maximum HTLC value (in millisatoshi) that is acceptable to all channel peers on the
31283  * blinded path from the introduction node to the recipient, accounting for any fees, i.e., as
31284  * seen by the recipient.
31285  */
31286 uint64_t BlindedPayInfo_get_htlc_maximum_msat(const struct LDKBlindedPayInfo *NONNULL_PTR this_ptr);
31287
31288 /**
31289  * The maximum HTLC value (in millisatoshi) that is acceptable to all channel peers on the
31290  * blinded path from the introduction node to the recipient, accounting for any fees, i.e., as
31291  * seen by the recipient.
31292  */
31293 void BlindedPayInfo_set_htlc_maximum_msat(struct LDKBlindedPayInfo *NONNULL_PTR this_ptr, uint64_t val);
31294
31295 /**
31296  * Features set in `encrypted_data_tlv` for the `encrypted_recipient_data` TLV record in an
31297  * onion payload.
31298  */
31299 struct LDKBlindedHopFeatures BlindedPayInfo_get_features(const struct LDKBlindedPayInfo *NONNULL_PTR this_ptr);
31300
31301 /**
31302  * Features set in `encrypted_data_tlv` for the `encrypted_recipient_data` TLV record in an
31303  * onion payload.
31304  */
31305 void BlindedPayInfo_set_features(struct LDKBlindedPayInfo *NONNULL_PTR this_ptr, struct LDKBlindedHopFeatures val);
31306
31307 /**
31308  * Constructs a new BlindedPayInfo given each field
31309  */
31310 MUST_USE_RES struct LDKBlindedPayInfo BlindedPayInfo_new(uint32_t fee_base_msat_arg, uint32_t fee_proportional_millionths_arg, uint16_t cltv_expiry_delta_arg, uint64_t htlc_minimum_msat_arg, uint64_t htlc_maximum_msat_arg, struct LDKBlindedHopFeatures features_arg);
31311
31312 /**
31313  * Creates a copy of the BlindedPayInfo
31314  */
31315 struct LDKBlindedPayInfo BlindedPayInfo_clone(const struct LDKBlindedPayInfo *NONNULL_PTR orig);
31316
31317 /**
31318  * Generates a non-cryptographic 64-bit hash of the BlindedPayInfo.
31319  */
31320 uint64_t BlindedPayInfo_hash(const struct LDKBlindedPayInfo *NONNULL_PTR o);
31321
31322 /**
31323  * Checks if two BlindedPayInfos contain equal inner contents.
31324  * This ignores pointers and is_owned flags and looks at the values in fields.
31325  * Two objects with NULL inner values will be considered "equal" here.
31326  */
31327 bool BlindedPayInfo_eq(const struct LDKBlindedPayInfo *NONNULL_PTR a, const struct LDKBlindedPayInfo *NONNULL_PTR b);
31328
31329 /**
31330  * Serialize the BlindedPayInfo object into a byte array which can be read by BlindedPayInfo_read
31331  */
31332 struct LDKCVec_u8Z BlindedPayInfo_write(const struct LDKBlindedPayInfo *NONNULL_PTR obj);
31333
31334 /**
31335  * Read a BlindedPayInfo from a byte array, created by BlindedPayInfo_write
31336  */
31337 struct LDKCResult_BlindedPayInfoDecodeErrorZ BlindedPayInfo_read(struct LDKu8slice ser);
31338
31339 /**
31340  * Frees any resources used by the UnsignedInvoiceRequest, if is_owned is set and inner is non-NULL.
31341  */
31342 void UnsignedInvoiceRequest_free(struct LDKUnsignedInvoiceRequest this_obj);
31343
31344 /**
31345  * Frees any resources used by the InvoiceRequest, if is_owned is set and inner is non-NULL.
31346  */
31347 void InvoiceRequest_free(struct LDKInvoiceRequest this_obj);
31348
31349 /**
31350  * Creates a copy of the InvoiceRequest
31351  */
31352 struct LDKInvoiceRequest InvoiceRequest_clone(const struct LDKInvoiceRequest *NONNULL_PTR orig);
31353
31354 /**
31355  * An unpredictable series of bytes, typically containing information about the derivation of
31356  * [`payer_id`].
31357  *
31358  * [`payer_id`]: Self::payer_id
31359  */
31360 MUST_USE_RES struct LDKu8slice InvoiceRequest_metadata(const struct LDKInvoiceRequest *NONNULL_PTR this_arg);
31361
31362 /**
31363  * A chain from [`Offer::chains`] that the offer is valid for.
31364  */
31365 MUST_USE_RES struct LDKThirtyTwoBytes InvoiceRequest_chain(const struct LDKInvoiceRequest *NONNULL_PTR this_arg);
31366
31367 /**
31368  * The amount to pay in msats (i.e., the minimum lightning-payable unit for [`chain`]), which
31369  * must be greater than or equal to [`Offer::amount`], converted if necessary.
31370  *
31371  * [`chain`]: Self::chain
31372  */
31373 MUST_USE_RES struct LDKCOption_u64Z InvoiceRequest_amount_msats(const struct LDKInvoiceRequest *NONNULL_PTR this_arg);
31374
31375 /**
31376  * Features pertaining to requesting an invoice.
31377  */
31378 MUST_USE_RES struct LDKInvoiceRequestFeatures InvoiceRequest_features(const struct LDKInvoiceRequest *NONNULL_PTR this_arg);
31379
31380 /**
31381  * The quantity of the offer's item conforming to [`Offer::is_valid_quantity`].
31382  */
31383 MUST_USE_RES struct LDKCOption_u64Z InvoiceRequest_quantity(const struct LDKInvoiceRequest *NONNULL_PTR this_arg);
31384
31385 /**
31386  * A possibly transient pubkey used to sign the invoice request.
31387  */
31388 MUST_USE_RES struct LDKPublicKey InvoiceRequest_payer_id(const struct LDKInvoiceRequest *NONNULL_PTR this_arg);
31389
31390 /**
31391  * A payer-provided note which will be seen by the recipient and reflected back in the invoice
31392  * response.
31393  *
31394  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
31395  */
31396 MUST_USE_RES struct LDKPrintableString InvoiceRequest_payer_note(const struct LDKInvoiceRequest *NONNULL_PTR this_arg);
31397
31398 /**
31399  * Serialize the InvoiceRequest object into a byte array which can be read by InvoiceRequest_read
31400  */
31401 struct LDKCVec_u8Z InvoiceRequest_write(const struct LDKInvoiceRequest *NONNULL_PTR obj);
31402
31403 /**
31404  * Frees any resources used by the Offer, if is_owned is set and inner is non-NULL.
31405  */
31406 void Offer_free(struct LDKOffer this_obj);
31407
31408 /**
31409  * Creates a copy of the Offer
31410  */
31411 struct LDKOffer Offer_clone(const struct LDKOffer *NONNULL_PTR orig);
31412
31413 /**
31414  * The chains that may be used when paying a requested invoice (e.g., bitcoin mainnet).
31415  * Payments must be denominated in units of the minimal lightning-payable unit (e.g., msats)
31416  * for the selected chain.
31417  */
31418 MUST_USE_RES struct LDKCVec_ChainHashZ Offer_chains(const struct LDKOffer *NONNULL_PTR this_arg);
31419
31420 /**
31421  * Returns whether the given chain is supported by the offer.
31422  */
31423 MUST_USE_RES bool Offer_supports_chain(const struct LDKOffer *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes chain);
31424
31425 /**
31426  * Opaque bytes set by the originator. Useful for authentication and validating fields since it
31427  * is reflected in `invoice_request` messages along with all the other fields from the `offer`.
31428  */
31429 MUST_USE_RES struct LDKCOption_CVec_u8ZZ Offer_metadata(const struct LDKOffer *NONNULL_PTR this_arg);
31430
31431 /**
31432  * The minimum amount required for a successful payment of a single item.
31433  *
31434  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
31435  */
31436 MUST_USE_RES struct LDKAmount Offer_amount(const struct LDKOffer *NONNULL_PTR this_arg);
31437
31438 /**
31439  * A complete description of the purpose of the payment. Intended to be displayed to the user
31440  * but with the caveat that it has not been verified in any way.
31441  */
31442 MUST_USE_RES struct LDKPrintableString Offer_description(const struct LDKOffer *NONNULL_PTR this_arg);
31443
31444 /**
31445  * Features pertaining to the offer.
31446  */
31447 MUST_USE_RES struct LDKOfferFeatures Offer_features(const struct LDKOffer *NONNULL_PTR this_arg);
31448
31449 /**
31450  * Duration since the Unix epoch when an invoice should no longer be requested.
31451  *
31452  * If `None`, the offer does not expire.
31453  */
31454 MUST_USE_RES struct LDKCOption_DurationZ Offer_absolute_expiry(const struct LDKOffer *NONNULL_PTR this_arg);
31455
31456 /**
31457  * Whether the offer has expired.
31458  */
31459 MUST_USE_RES bool Offer_is_expired(const struct LDKOffer *NONNULL_PTR this_arg);
31460
31461 /**
31462  * The issuer of the offer, possibly beginning with `user@domain` or `domain`. Intended to be
31463  * displayed to the user but with the caveat that it has not been verified in any way.
31464  *
31465  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
31466  */
31467 MUST_USE_RES struct LDKPrintableString Offer_issuer(const struct LDKOffer *NONNULL_PTR this_arg);
31468
31469 /**
31470  * Paths to the recipient originating from publicly reachable nodes. Blinded paths provide
31471  * recipient privacy by obfuscating its node id.
31472  */
31473 MUST_USE_RES struct LDKCVec_BlindedPathZ Offer_paths(const struct LDKOffer *NONNULL_PTR this_arg);
31474
31475 /**
31476  * The quantity of items supported.
31477  */
31478 MUST_USE_RES struct LDKQuantity Offer_supported_quantity(const struct LDKOffer *NONNULL_PTR this_arg);
31479
31480 /**
31481  * Returns whether the given quantity is valid for the offer.
31482  */
31483 MUST_USE_RES bool Offer_is_valid_quantity(const struct LDKOffer *NONNULL_PTR this_arg, uint64_t quantity);
31484
31485 /**
31486  * Returns whether a quantity is expected in an [`InvoiceRequest`] for the offer.
31487  *
31488  * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
31489  */
31490 MUST_USE_RES bool Offer_expects_quantity(const struct LDKOffer *NONNULL_PTR this_arg);
31491
31492 /**
31493  * The public key used by the recipient to sign invoices.
31494  */
31495 MUST_USE_RES struct LDKPublicKey Offer_signing_pubkey(const struct LDKOffer *NONNULL_PTR this_arg);
31496
31497 /**
31498  * Serialize the Offer object into a byte array which can be read by Offer_read
31499  */
31500 struct LDKCVec_u8Z Offer_write(const struct LDKOffer *NONNULL_PTR obj);
31501
31502 /**
31503  * Frees any resources used by the Amount, if is_owned is set and inner is non-NULL.
31504  */
31505 void Amount_free(struct LDKAmount this_obj);
31506
31507 /**
31508  * Creates a copy of the Amount
31509  */
31510 struct LDKAmount Amount_clone(const struct LDKAmount *NONNULL_PTR orig);
31511
31512 /**
31513  * Frees any resources used by the Quantity, if is_owned is set and inner is non-NULL.
31514  */
31515 void Quantity_free(struct LDKQuantity this_obj);
31516
31517 /**
31518  * Creates a copy of the Quantity
31519  */
31520 struct LDKQuantity Quantity_clone(const struct LDKQuantity *NONNULL_PTR orig);
31521
31522 /**
31523  * Frees any resources used by the Refund, if is_owned is set and inner is non-NULL.
31524  */
31525 void Refund_free(struct LDKRefund this_obj);
31526
31527 /**
31528  * Creates a copy of the Refund
31529  */
31530 struct LDKRefund Refund_clone(const struct LDKRefund *NONNULL_PTR orig);
31531
31532 /**
31533  * A complete description of the purpose of the refund. Intended to be displayed to the user
31534  * but with the caveat that it has not been verified in any way.
31535  */
31536 MUST_USE_RES struct LDKPrintableString Refund_description(const struct LDKRefund *NONNULL_PTR this_arg);
31537
31538 /**
31539  * Duration since the Unix epoch when an invoice should no longer be sent.
31540  *
31541  * If `None`, the refund does not expire.
31542  */
31543 MUST_USE_RES struct LDKCOption_DurationZ Refund_absolute_expiry(const struct LDKRefund *NONNULL_PTR this_arg);
31544
31545 /**
31546  * Whether the refund has expired.
31547  */
31548 MUST_USE_RES bool Refund_is_expired(const struct LDKRefund *NONNULL_PTR this_arg);
31549
31550 /**
31551  * The issuer of the refund, possibly beginning with `user@domain` or `domain`. Intended to be
31552  * displayed to the user but with the caveat that it has not been verified in any way.
31553  *
31554  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
31555  */
31556 MUST_USE_RES struct LDKPrintableString Refund_issuer(const struct LDKRefund *NONNULL_PTR this_arg);
31557
31558 /**
31559  * Paths to the sender originating from publicly reachable nodes. Blinded paths provide sender
31560  * privacy by obfuscating its node id.
31561  */
31562 MUST_USE_RES struct LDKCVec_BlindedPathZ Refund_paths(const struct LDKRefund *NONNULL_PTR this_arg);
31563
31564 /**
31565  * An unpredictable series of bytes, typically containing information about the derivation of
31566  * [`payer_id`].
31567  *
31568  * [`payer_id`]: Self::payer_id
31569  */
31570 MUST_USE_RES struct LDKu8slice Refund_metadata(const struct LDKRefund *NONNULL_PTR this_arg);
31571
31572 /**
31573  * A chain that the refund is valid for.
31574  */
31575 MUST_USE_RES struct LDKThirtyTwoBytes Refund_chain(const struct LDKRefund *NONNULL_PTR this_arg);
31576
31577 /**
31578  * The amount to refund in msats (i.e., the minimum lightning-payable unit for [`chain`]).
31579  *
31580  * [`chain`]: Self::chain
31581  */
31582 MUST_USE_RES uint64_t Refund_amount_msats(const struct LDKRefund *NONNULL_PTR this_arg);
31583
31584 /**
31585  * Features pertaining to requesting an invoice.
31586  */
31587 MUST_USE_RES struct LDKInvoiceRequestFeatures Refund_features(const struct LDKRefund *NONNULL_PTR this_arg);
31588
31589 /**
31590  * The quantity of an item that refund is for.
31591  */
31592 MUST_USE_RES struct LDKCOption_u64Z Refund_quantity(const struct LDKRefund *NONNULL_PTR this_arg);
31593
31594 /**
31595  * A public node id to send to in the case where there are no [`paths`]. Otherwise, a possibly
31596  * transient pubkey.
31597  *
31598  * [`paths`]: Self::paths
31599  */
31600 MUST_USE_RES struct LDKPublicKey Refund_payer_id(const struct LDKRefund *NONNULL_PTR this_arg);
31601
31602 /**
31603  * Payer provided note to include in the invoice.
31604  *
31605  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
31606  */
31607 MUST_USE_RES struct LDKPrintableString Refund_payer_note(const struct LDKRefund *NONNULL_PTR this_arg);
31608
31609 /**
31610  * Serialize the Refund object into a byte array which can be read by Refund_read
31611  */
31612 struct LDKCVec_u8Z Refund_write(const struct LDKRefund *NONNULL_PTR obj);
31613
31614 /**
31615  * Creates a copy of the UtxoLookupError
31616  */
31617 enum LDKUtxoLookupError UtxoLookupError_clone(const enum LDKUtxoLookupError *NONNULL_PTR orig);
31618
31619 /**
31620  * Utility method to constructs a new UnknownChain-variant UtxoLookupError
31621  */
31622 enum LDKUtxoLookupError UtxoLookupError_unknown_chain(void);
31623
31624 /**
31625  * Utility method to constructs a new UnknownTx-variant UtxoLookupError
31626  */
31627 enum LDKUtxoLookupError UtxoLookupError_unknown_tx(void);
31628
31629 /**
31630  * Frees any resources used by the UtxoResult
31631  */
31632 void UtxoResult_free(struct LDKUtxoResult this_ptr);
31633
31634 /**
31635  * Creates a copy of the UtxoResult
31636  */
31637 struct LDKUtxoResult UtxoResult_clone(const struct LDKUtxoResult *NONNULL_PTR orig);
31638
31639 /**
31640  * Utility method to constructs a new Sync-variant UtxoResult
31641  */
31642 struct LDKUtxoResult UtxoResult_sync(struct LDKCResult_TxOutUtxoLookupErrorZ a);
31643
31644 /**
31645  * Utility method to constructs a new Async-variant UtxoResult
31646  */
31647 struct LDKUtxoResult UtxoResult_async(struct LDKUtxoFuture a);
31648
31649 /**
31650  * Calls the free function if one is set
31651  */
31652 void UtxoLookup_free(struct LDKUtxoLookup this_ptr);
31653
31654 /**
31655  * Frees any resources used by the UtxoFuture, if is_owned is set and inner is non-NULL.
31656  */
31657 void UtxoFuture_free(struct LDKUtxoFuture this_obj);
31658
31659 /**
31660  * Creates a copy of the UtxoFuture
31661  */
31662 struct LDKUtxoFuture UtxoFuture_clone(const struct LDKUtxoFuture *NONNULL_PTR orig);
31663
31664 /**
31665  * Builds a new future for later resolution.
31666  */
31667 MUST_USE_RES struct LDKUtxoFuture UtxoFuture_new(void);
31668
31669 /**
31670  * Resolves this future against the given `graph` and with the given `result`.
31671  *
31672  * This is identical to calling [`UtxoFuture::resolve`] with a dummy `gossip`, disabling
31673  * forwarding the validated gossip message onwards to peers.
31674  *
31675  * Because this may cause the [`NetworkGraph`]'s [`processing_queue_high`] to flip, in order
31676  * to allow us to interact with peers again, you should call [`PeerManager::process_events`]
31677  * after this.
31678  *
31679  * [`processing_queue_high`]: crate::ln::msgs::RoutingMessageHandler::processing_queue_high
31680  * [`PeerManager::process_events`]: crate::ln::peer_handler::PeerManager::process_events
31681  */
31682 void UtxoFuture_resolve_without_forwarding(const struct LDKUtxoFuture *NONNULL_PTR this_arg, const struct LDKNetworkGraph *NONNULL_PTR graph, struct LDKCResult_TxOutUtxoLookupErrorZ result);
31683
31684 /**
31685  * Resolves this future against the given `graph` and with the given `result`.
31686  *
31687  * The given `gossip` is used to broadcast any validated messages onwards to all peers which
31688  * have available buffer space.
31689  *
31690  * Because this may cause the [`NetworkGraph`]'s [`processing_queue_high`] to flip, in order
31691  * to allow us to interact with peers again, you should call [`PeerManager::process_events`]
31692  * after this.
31693  *
31694  * [`processing_queue_high`]: crate::ln::msgs::RoutingMessageHandler::processing_queue_high
31695  * [`PeerManager::process_events`]: crate::ln::peer_handler::PeerManager::process_events
31696  */
31697 void UtxoFuture_resolve(const struct LDKUtxoFuture *NONNULL_PTR this_arg, const struct LDKNetworkGraph *NONNULL_PTR graph, const struct LDKP2PGossipSync *NONNULL_PTR gossip, struct LDKCResult_TxOutUtxoLookupErrorZ result);
31698
31699 /**
31700  * Frees any resources used by the NodeId, if is_owned is set and inner is non-NULL.
31701  */
31702 void NodeId_free(struct LDKNodeId this_obj);
31703
31704 /**
31705  * Creates a copy of the NodeId
31706  */
31707 struct LDKNodeId NodeId_clone(const struct LDKNodeId *NONNULL_PTR orig);
31708
31709 /**
31710  * Create a new NodeId from a public key
31711  */
31712 MUST_USE_RES struct LDKNodeId NodeId_from_pubkey(struct LDKPublicKey pubkey);
31713
31714 /**
31715  * Get the public key slice from this NodeId
31716  */
31717 MUST_USE_RES struct LDKu8slice NodeId_as_slice(const struct LDKNodeId *NONNULL_PTR this_arg);
31718
31719 /**
31720  * Get the public key from this NodeId
31721  */
31722 MUST_USE_RES struct LDKCResult_PublicKeyErrorZ NodeId_as_pubkey(const struct LDKNodeId *NONNULL_PTR this_arg);
31723
31724 /**
31725  * Generates a non-cryptographic 64-bit hash of the NodeId.
31726  */
31727 uint64_t NodeId_hash(const struct LDKNodeId *NONNULL_PTR o);
31728
31729 /**
31730  * Serialize the NodeId object into a byte array which can be read by NodeId_read
31731  */
31732 struct LDKCVec_u8Z NodeId_write(const struct LDKNodeId *NONNULL_PTR obj);
31733
31734 /**
31735  * Read a NodeId from a byte array, created by NodeId_write
31736  */
31737 struct LDKCResult_NodeIdDecodeErrorZ NodeId_read(struct LDKu8slice ser);
31738
31739 /**
31740  * Frees any resources used by the NetworkGraph, if is_owned is set and inner is non-NULL.
31741  */
31742 void NetworkGraph_free(struct LDKNetworkGraph this_obj);
31743
31744 /**
31745  * Frees any resources used by the ReadOnlyNetworkGraph, if is_owned is set and inner is non-NULL.
31746  */
31747 void ReadOnlyNetworkGraph_free(struct LDKReadOnlyNetworkGraph this_obj);
31748
31749 /**
31750  * Frees any resources used by the NetworkUpdate
31751  */
31752 void NetworkUpdate_free(struct LDKNetworkUpdate this_ptr);
31753
31754 /**
31755  * Creates a copy of the NetworkUpdate
31756  */
31757 struct LDKNetworkUpdate NetworkUpdate_clone(const struct LDKNetworkUpdate *NONNULL_PTR orig);
31758
31759 /**
31760  * Utility method to constructs a new ChannelUpdateMessage-variant NetworkUpdate
31761  */
31762 struct LDKNetworkUpdate NetworkUpdate_channel_update_message(struct LDKChannelUpdate msg);
31763
31764 /**
31765  * Utility method to constructs a new ChannelFailure-variant NetworkUpdate
31766  */
31767 struct LDKNetworkUpdate NetworkUpdate_channel_failure(uint64_t short_channel_id, bool is_permanent);
31768
31769 /**
31770  * Utility method to constructs a new NodeFailure-variant NetworkUpdate
31771  */
31772 struct LDKNetworkUpdate NetworkUpdate_node_failure(struct LDKPublicKey node_id, bool is_permanent);
31773
31774 /**
31775  * Checks if two NetworkUpdates contain equal inner contents.
31776  * This ignores pointers and is_owned flags and looks at the values in fields.
31777  */
31778 bool NetworkUpdate_eq(const struct LDKNetworkUpdate *NONNULL_PTR a, const struct LDKNetworkUpdate *NONNULL_PTR b);
31779
31780 /**
31781  * Serialize the NetworkUpdate object into a byte array which can be read by NetworkUpdate_read
31782  */
31783 struct LDKCVec_u8Z NetworkUpdate_write(const struct LDKNetworkUpdate *NONNULL_PTR obj);
31784
31785 /**
31786  * Read a NetworkUpdate from a byte array, created by NetworkUpdate_write
31787  */
31788 struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ NetworkUpdate_read(struct LDKu8slice ser);
31789
31790 /**
31791  * Frees any resources used by the P2PGossipSync, if is_owned is set and inner is non-NULL.
31792  */
31793 void P2PGossipSync_free(struct LDKP2PGossipSync this_obj);
31794
31795 /**
31796  * Creates a new tracker of the actual state of the network of channels and nodes,
31797  * assuming an existing [`NetworkGraph`].
31798  * UTXO lookup is used to make sure announced channels exist on-chain, channel data is
31799  * correct, and the announcement is signed with channel owners' keys.
31800  */
31801 MUST_USE_RES struct LDKP2PGossipSync P2PGossipSync_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKCOption_UtxoLookupZ utxo_lookup, struct LDKLogger logger);
31802
31803 /**
31804  * Adds a provider used to check new announcements. Does not affect
31805  * existing announcements unless they are updated.
31806  * Add, update or remove the provider would replace the current one.
31807  */
31808 void P2PGossipSync_add_utxo_lookup(struct LDKP2PGossipSync *NONNULL_PTR this_arg, struct LDKCOption_UtxoLookupZ utxo_lookup);
31809
31810 /**
31811  * Handles any network updates originating from [`Event`]s.
31812  *
31813  * [`Event`]: crate::events::Event
31814  */
31815 void NetworkGraph_handle_network_update(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKNetworkUpdate *NONNULL_PTR network_update);
31816
31817 /**
31818  * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg.
31819  * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is
31820  */
31821 struct LDKRoutingMessageHandler P2PGossipSync_as_RoutingMessageHandler(const struct LDKP2PGossipSync *NONNULL_PTR this_arg);
31822
31823 /**
31824  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
31825  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
31826  */
31827 struct LDKMessageSendEventsProvider P2PGossipSync_as_MessageSendEventsProvider(const struct LDKP2PGossipSync *NONNULL_PTR this_arg);
31828
31829 /**
31830  * Frees any resources used by the ChannelUpdateInfo, if is_owned is set and inner is non-NULL.
31831  */
31832 void ChannelUpdateInfo_free(struct LDKChannelUpdateInfo this_obj);
31833
31834 /**
31835  * When the last update to the channel direction was issued.
31836  * Value is opaque, as set in the announcement.
31837  */
31838 uint32_t ChannelUpdateInfo_get_last_update(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
31839
31840 /**
31841  * When the last update to the channel direction was issued.
31842  * Value is opaque, as set in the announcement.
31843  */
31844 void ChannelUpdateInfo_set_last_update(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, uint32_t val);
31845
31846 /**
31847  * Whether the channel can be currently used for payments (in this one direction).
31848  */
31849 bool ChannelUpdateInfo_get_enabled(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
31850
31851 /**
31852  * Whether the channel can be currently used for payments (in this one direction).
31853  */
31854 void ChannelUpdateInfo_set_enabled(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, bool val);
31855
31856 /**
31857  * The difference in CLTV values that you must have when routing through this channel.
31858  */
31859 uint16_t ChannelUpdateInfo_get_cltv_expiry_delta(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
31860
31861 /**
31862  * The difference in CLTV values that you must have when routing through this channel.
31863  */
31864 void ChannelUpdateInfo_set_cltv_expiry_delta(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, uint16_t val);
31865
31866 /**
31867  * The minimum value, which must be relayed to the next hop via the channel
31868  */
31869 uint64_t ChannelUpdateInfo_get_htlc_minimum_msat(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
31870
31871 /**
31872  * The minimum value, which must be relayed to the next hop via the channel
31873  */
31874 void ChannelUpdateInfo_set_htlc_minimum_msat(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, uint64_t val);
31875
31876 /**
31877  * The maximum value which may be relayed to the next hop via the channel.
31878  */
31879 uint64_t ChannelUpdateInfo_get_htlc_maximum_msat(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
31880
31881 /**
31882  * The maximum value which may be relayed to the next hop via the channel.
31883  */
31884 void ChannelUpdateInfo_set_htlc_maximum_msat(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, uint64_t val);
31885
31886 /**
31887  * Fees charged when the channel is used for routing
31888  */
31889 struct LDKRoutingFees ChannelUpdateInfo_get_fees(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
31890
31891 /**
31892  * Fees charged when the channel is used for routing
31893  */
31894 void ChannelUpdateInfo_set_fees(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
31895
31896 /**
31897  * Most recent update for the channel received from the network
31898  * Mostly redundant with the data we store in fields explicitly.
31899  * Everything else is useful only for sending out for initial routing sync.
31900  * Not stored if contains excess data to prevent DoS.
31901  *
31902  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
31903  */
31904 struct LDKChannelUpdate ChannelUpdateInfo_get_last_update_message(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
31905
31906 /**
31907  * Most recent update for the channel received from the network
31908  * Mostly redundant with the data we store in fields explicitly.
31909  * Everything else is useful only for sending out for initial routing sync.
31910  * Not stored if contains excess data to prevent DoS.
31911  *
31912  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
31913  */
31914 void ChannelUpdateInfo_set_last_update_message(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdate val);
31915
31916 /**
31917  * Constructs a new ChannelUpdateInfo given each field
31918  */
31919 MUST_USE_RES struct LDKChannelUpdateInfo ChannelUpdateInfo_new(uint32_t last_update_arg, bool enabled_arg, uint16_t cltv_expiry_delta_arg, uint64_t htlc_minimum_msat_arg, uint64_t htlc_maximum_msat_arg, struct LDKRoutingFees fees_arg, struct LDKChannelUpdate last_update_message_arg);
31920
31921 /**
31922  * Creates a copy of the ChannelUpdateInfo
31923  */
31924 struct LDKChannelUpdateInfo ChannelUpdateInfo_clone(const struct LDKChannelUpdateInfo *NONNULL_PTR orig);
31925
31926 /**
31927  * Checks if two ChannelUpdateInfos contain equal inner contents.
31928  * This ignores pointers and is_owned flags and looks at the values in fields.
31929  * Two objects with NULL inner values will be considered "equal" here.
31930  */
31931 bool ChannelUpdateInfo_eq(const struct LDKChannelUpdateInfo *NONNULL_PTR a, const struct LDKChannelUpdateInfo *NONNULL_PTR b);
31932
31933 /**
31934  * Serialize the ChannelUpdateInfo object into a byte array which can be read by ChannelUpdateInfo_read
31935  */
31936 struct LDKCVec_u8Z ChannelUpdateInfo_write(const struct LDKChannelUpdateInfo *NONNULL_PTR obj);
31937
31938 /**
31939  * Read a ChannelUpdateInfo from a byte array, created by ChannelUpdateInfo_write
31940  */
31941 struct LDKCResult_ChannelUpdateInfoDecodeErrorZ ChannelUpdateInfo_read(struct LDKu8slice ser);
31942
31943 /**
31944  * Frees any resources used by the ChannelInfo, if is_owned is set and inner is non-NULL.
31945  */
31946 void ChannelInfo_free(struct LDKChannelInfo this_obj);
31947
31948 /**
31949  * Protocol features of a channel communicated during its announcement
31950  */
31951 struct LDKChannelFeatures ChannelInfo_get_features(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
31952
31953 /**
31954  * Protocol features of a channel communicated during its announcement
31955  */
31956 void ChannelInfo_set_features(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
31957
31958 /**
31959  * Source node of the first direction of a channel
31960  */
31961 struct LDKNodeId ChannelInfo_get_node_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
31962
31963 /**
31964  * Source node of the first direction of a channel
31965  */
31966 void ChannelInfo_set_node_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKNodeId val);
31967
31968 /**
31969  * Details about the first direction of a channel
31970  *
31971  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
31972  */
31973 struct LDKChannelUpdateInfo ChannelInfo_get_one_to_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
31974
31975 /**
31976  * Details about the first direction of a channel
31977  *
31978  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
31979  */
31980 void ChannelInfo_set_one_to_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdateInfo val);
31981
31982 /**
31983  * Source node of the second direction of a channel
31984  */
31985 struct LDKNodeId ChannelInfo_get_node_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
31986
31987 /**
31988  * Source node of the second direction of a channel
31989  */
31990 void ChannelInfo_set_node_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKNodeId val);
31991
31992 /**
31993  * Details about the second direction of a channel
31994  *
31995  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
31996  */
31997 struct LDKChannelUpdateInfo ChannelInfo_get_two_to_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
31998
31999 /**
32000  * Details about the second direction of a channel
32001  *
32002  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
32003  */
32004 void ChannelInfo_set_two_to_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdateInfo val);
32005
32006 /**
32007  * The channel capacity as seen on-chain, if chain lookup is available.
32008  */
32009 struct LDKCOption_u64Z ChannelInfo_get_capacity_sats(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
32010
32011 /**
32012  * The channel capacity as seen on-chain, if chain lookup is available.
32013  */
32014 void ChannelInfo_set_capacity_sats(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
32015
32016 /**
32017  * An initial announcement of the channel
32018  * Mostly redundant with the data we store in fields explicitly.
32019  * Everything else is useful only for sending out for initial routing sync.
32020  * Not stored if contains excess data to prevent DoS.
32021  *
32022  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
32023  */
32024 struct LDKChannelAnnouncement ChannelInfo_get_announcement_message(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
32025
32026 /**
32027  * An initial announcement of the channel
32028  * Mostly redundant with the data we store in fields explicitly.
32029  * Everything else is useful only for sending out for initial routing sync.
32030  * Not stored if contains excess data to prevent DoS.
32031  *
32032  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
32033  */
32034 void ChannelInfo_set_announcement_message(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelAnnouncement val);
32035
32036 /**
32037  * Creates a copy of the ChannelInfo
32038  */
32039 struct LDKChannelInfo ChannelInfo_clone(const struct LDKChannelInfo *NONNULL_PTR orig);
32040
32041 /**
32042  * Checks if two ChannelInfos contain equal inner contents.
32043  * This ignores pointers and is_owned flags and looks at the values in fields.
32044  * Two objects with NULL inner values will be considered "equal" here.
32045  */
32046 bool ChannelInfo_eq(const struct LDKChannelInfo *NONNULL_PTR a, const struct LDKChannelInfo *NONNULL_PTR b);
32047
32048 /**
32049  * Returns a [`ChannelUpdateInfo`] based on the direction implied by the channel_flag.
32050  *
32051  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
32052  */
32053 MUST_USE_RES struct LDKChannelUpdateInfo ChannelInfo_get_directional_info(const struct LDKChannelInfo *NONNULL_PTR this_arg, uint8_t channel_flags);
32054
32055 /**
32056  * Serialize the ChannelInfo object into a byte array which can be read by ChannelInfo_read
32057  */
32058 struct LDKCVec_u8Z ChannelInfo_write(const struct LDKChannelInfo *NONNULL_PTR obj);
32059
32060 /**
32061  * Read a ChannelInfo from a byte array, created by ChannelInfo_write
32062  */
32063 struct LDKCResult_ChannelInfoDecodeErrorZ ChannelInfo_read(struct LDKu8slice ser);
32064
32065 /**
32066  * Frees any resources used by the DirectedChannelInfo, if is_owned is set and inner is non-NULL.
32067  */
32068 void DirectedChannelInfo_free(struct LDKDirectedChannelInfo this_obj);
32069
32070 /**
32071  * Creates a copy of the DirectedChannelInfo
32072  */
32073 struct LDKDirectedChannelInfo DirectedChannelInfo_clone(const struct LDKDirectedChannelInfo *NONNULL_PTR orig);
32074
32075 /**
32076  * Returns information for the channel.
32077  */
32078 MUST_USE_RES struct LDKChannelInfo DirectedChannelInfo_channel(const struct LDKDirectedChannelInfo *NONNULL_PTR this_arg);
32079
32080 /**
32081  * Returns the maximum HTLC amount allowed over the channel in the direction.
32082  */
32083 MUST_USE_RES uint64_t DirectedChannelInfo_htlc_maximum_msat(const struct LDKDirectedChannelInfo *NONNULL_PTR this_arg);
32084
32085 /**
32086  * Returns the [`EffectiveCapacity`] of the channel in the direction.
32087  *
32088  * This is either the total capacity from the funding transaction, if known, or the
32089  * `htlc_maximum_msat` for the direction as advertised by the gossip network, if known,
32090  * otherwise.
32091  */
32092 MUST_USE_RES struct LDKEffectiveCapacity DirectedChannelInfo_effective_capacity(const struct LDKDirectedChannelInfo *NONNULL_PTR this_arg);
32093
32094 /**
32095  * Frees any resources used by the EffectiveCapacity
32096  */
32097 void EffectiveCapacity_free(struct LDKEffectiveCapacity this_ptr);
32098
32099 /**
32100  * Creates a copy of the EffectiveCapacity
32101  */
32102 struct LDKEffectiveCapacity EffectiveCapacity_clone(const struct LDKEffectiveCapacity *NONNULL_PTR orig);
32103
32104 /**
32105  * Utility method to constructs a new ExactLiquidity-variant EffectiveCapacity
32106  */
32107 struct LDKEffectiveCapacity EffectiveCapacity_exact_liquidity(uint64_t liquidity_msat);
32108
32109 /**
32110  * Utility method to constructs a new MaximumHTLC-variant EffectiveCapacity
32111  */
32112 struct LDKEffectiveCapacity EffectiveCapacity_maximum_htlc(uint64_t amount_msat);
32113
32114 /**
32115  * Utility method to constructs a new Total-variant EffectiveCapacity
32116  */
32117 struct LDKEffectiveCapacity EffectiveCapacity_total(uint64_t capacity_msat, uint64_t htlc_maximum_msat);
32118
32119 /**
32120  * Utility method to constructs a new Infinite-variant EffectiveCapacity
32121  */
32122 struct LDKEffectiveCapacity EffectiveCapacity_infinite(void);
32123
32124 /**
32125  * Utility method to constructs a new Unknown-variant EffectiveCapacity
32126  */
32127 struct LDKEffectiveCapacity EffectiveCapacity_unknown(void);
32128
32129 /**
32130  * Returns the effective capacity denominated in millisatoshi.
32131  */
32132 MUST_USE_RES uint64_t EffectiveCapacity_as_msat(const struct LDKEffectiveCapacity *NONNULL_PTR this_arg);
32133
32134 /**
32135  * Frees any resources used by the RoutingFees, if is_owned is set and inner is non-NULL.
32136  */
32137 void RoutingFees_free(struct LDKRoutingFees this_obj);
32138
32139 /**
32140  * Flat routing fee in millisatoshis.
32141  */
32142 uint32_t RoutingFees_get_base_msat(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
32143
32144 /**
32145  * Flat routing fee in millisatoshis.
32146  */
32147 void RoutingFees_set_base_msat(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
32148
32149 /**
32150  * Liquidity-based routing fee in millionths of a routed amount.
32151  * In other words, 10000 is 1%.
32152  */
32153 uint32_t RoutingFees_get_proportional_millionths(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
32154
32155 /**
32156  * Liquidity-based routing fee in millionths of a routed amount.
32157  * In other words, 10000 is 1%.
32158  */
32159 void RoutingFees_set_proportional_millionths(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
32160
32161 /**
32162  * Constructs a new RoutingFees given each field
32163  */
32164 MUST_USE_RES struct LDKRoutingFees RoutingFees_new(uint32_t base_msat_arg, uint32_t proportional_millionths_arg);
32165
32166 /**
32167  * Checks if two RoutingFeess contain equal inner contents.
32168  * This ignores pointers and is_owned flags and looks at the values in fields.
32169  * Two objects with NULL inner values will be considered "equal" here.
32170  */
32171 bool RoutingFees_eq(const struct LDKRoutingFees *NONNULL_PTR a, const struct LDKRoutingFees *NONNULL_PTR b);
32172
32173 /**
32174  * Creates a copy of the RoutingFees
32175  */
32176 struct LDKRoutingFees RoutingFees_clone(const struct LDKRoutingFees *NONNULL_PTR orig);
32177
32178 /**
32179  * Generates a non-cryptographic 64-bit hash of the RoutingFees.
32180  */
32181 uint64_t RoutingFees_hash(const struct LDKRoutingFees *NONNULL_PTR o);
32182
32183 /**
32184  * Serialize the RoutingFees object into a byte array which can be read by RoutingFees_read
32185  */
32186 struct LDKCVec_u8Z RoutingFees_write(const struct LDKRoutingFees *NONNULL_PTR obj);
32187
32188 /**
32189  * Read a RoutingFees from a byte array, created by RoutingFees_write
32190  */
32191 struct LDKCResult_RoutingFeesDecodeErrorZ RoutingFees_read(struct LDKu8slice ser);
32192
32193 /**
32194  * Frees any resources used by the NodeAnnouncementInfo, if is_owned is set and inner is non-NULL.
32195  */
32196 void NodeAnnouncementInfo_free(struct LDKNodeAnnouncementInfo this_obj);
32197
32198 /**
32199  * Protocol features the node announced support for
32200  */
32201 struct LDKNodeFeatures NodeAnnouncementInfo_get_features(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
32202
32203 /**
32204  * Protocol features the node announced support for
32205  */
32206 void NodeAnnouncementInfo_set_features(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
32207
32208 /**
32209  * When the last known update to the node state was issued.
32210  * Value is opaque, as set in the announcement.
32211  */
32212 uint32_t NodeAnnouncementInfo_get_last_update(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
32213
32214 /**
32215  * When the last known update to the node state was issued.
32216  * Value is opaque, as set in the announcement.
32217  */
32218 void NodeAnnouncementInfo_set_last_update(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, uint32_t val);
32219
32220 /**
32221  * Color assigned to the node
32222  */
32223 const uint8_t (*NodeAnnouncementInfo_get_rgb(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[3];
32224
32225 /**
32226  * Color assigned to the node
32227  */
32228 void NodeAnnouncementInfo_set_rgb(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
32229
32230 /**
32231  * Moniker assigned to the node.
32232  * May be invalid or malicious (eg control chars),
32233  * should not be exposed to the user.
32234  */
32235 struct LDKNodeAlias NodeAnnouncementInfo_get_alias(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
32236
32237 /**
32238  * Moniker assigned to the node.
32239  * May be invalid or malicious (eg control chars),
32240  * should not be exposed to the user.
32241  */
32242 void NodeAnnouncementInfo_set_alias(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeAlias val);
32243
32244 /**
32245  * An initial announcement of the node
32246  * Mostly redundant with the data we store in fields explicitly.
32247  * Everything else is useful only for sending out for initial routing sync.
32248  * Not stored if contains excess data to prevent DoS.
32249  *
32250  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
32251  */
32252 struct LDKNodeAnnouncement NodeAnnouncementInfo_get_announcement_message(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
32253
32254 /**
32255  * An initial announcement of the node
32256  * Mostly redundant with the data we store in fields explicitly.
32257  * Everything else is useful only for sending out for initial routing sync.
32258  * Not stored if contains excess data to prevent DoS.
32259  *
32260  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
32261  */
32262 void NodeAnnouncementInfo_set_announcement_message(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncement val);
32263
32264 /**
32265  * Constructs a new NodeAnnouncementInfo given each field
32266  */
32267 MUST_USE_RES struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_new(struct LDKNodeFeatures features_arg, uint32_t last_update_arg, struct LDKThreeBytes rgb_arg, struct LDKNodeAlias alias_arg, struct LDKNodeAnnouncement announcement_message_arg);
32268
32269 /**
32270  * Creates a copy of the NodeAnnouncementInfo
32271  */
32272 struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_clone(const struct LDKNodeAnnouncementInfo *NONNULL_PTR orig);
32273
32274 /**
32275  * Checks if two NodeAnnouncementInfos contain equal inner contents.
32276  * This ignores pointers and is_owned flags and looks at the values in fields.
32277  * Two objects with NULL inner values will be considered "equal" here.
32278  */
32279 bool NodeAnnouncementInfo_eq(const struct LDKNodeAnnouncementInfo *NONNULL_PTR a, const struct LDKNodeAnnouncementInfo *NONNULL_PTR b);
32280
32281 /**
32282  * Internet-level addresses via which one can connect to the node
32283  */
32284 MUST_USE_RES struct LDKCVec_NetAddressZ NodeAnnouncementInfo_addresses(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_arg);
32285
32286 /**
32287  * Serialize the NodeAnnouncementInfo object into a byte array which can be read by NodeAnnouncementInfo_read
32288  */
32289 struct LDKCVec_u8Z NodeAnnouncementInfo_write(const struct LDKNodeAnnouncementInfo *NONNULL_PTR obj);
32290
32291 /**
32292  * Read a NodeAnnouncementInfo from a byte array, created by NodeAnnouncementInfo_write
32293  */
32294 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ NodeAnnouncementInfo_read(struct LDKu8slice ser);
32295
32296 /**
32297  * Frees any resources used by the NodeAlias, if is_owned is set and inner is non-NULL.
32298  */
32299 void NodeAlias_free(struct LDKNodeAlias this_obj);
32300
32301 const uint8_t (*NodeAlias_get_a(const struct LDKNodeAlias *NONNULL_PTR this_ptr))[32];
32302
32303 void NodeAlias_set_a(struct LDKNodeAlias *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
32304
32305 /**
32306  * Constructs a new NodeAlias given each field
32307  */
32308 MUST_USE_RES struct LDKNodeAlias NodeAlias_new(struct LDKThirtyTwoBytes a_arg);
32309
32310 /**
32311  * Creates a copy of the NodeAlias
32312  */
32313 struct LDKNodeAlias NodeAlias_clone(const struct LDKNodeAlias *NONNULL_PTR orig);
32314
32315 /**
32316  * Checks if two NodeAliass contain equal inner contents.
32317  * This ignores pointers and is_owned flags and looks at the values in fields.
32318  * Two objects with NULL inner values will be considered "equal" here.
32319  */
32320 bool NodeAlias_eq(const struct LDKNodeAlias *NONNULL_PTR a, const struct LDKNodeAlias *NONNULL_PTR b);
32321
32322 /**
32323  * Serialize the NodeAlias object into a byte array which can be read by NodeAlias_read
32324  */
32325 struct LDKCVec_u8Z NodeAlias_write(const struct LDKNodeAlias *NONNULL_PTR obj);
32326
32327 /**
32328  * Read a NodeAlias from a byte array, created by NodeAlias_write
32329  */
32330 struct LDKCResult_NodeAliasDecodeErrorZ NodeAlias_read(struct LDKu8slice ser);
32331
32332 /**
32333  * Frees any resources used by the NodeInfo, if is_owned is set and inner is non-NULL.
32334  */
32335 void NodeInfo_free(struct LDKNodeInfo this_obj);
32336
32337 /**
32338  * All valid channels a node has announced
32339  *
32340  * Returns a copy of the field.
32341  */
32342 struct LDKCVec_u64Z NodeInfo_get_channels(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
32343
32344 /**
32345  * All valid channels a node has announced
32346  */
32347 void NodeInfo_set_channels(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
32348
32349 /**
32350  * More information about a node from node_announcement.
32351  * Optional because we store a Node entry after learning about it from
32352  * a channel announcement, but before receiving a node announcement.
32353  *
32354  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
32355  */
32356 struct LDKNodeAnnouncementInfo NodeInfo_get_announcement_info(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
32357
32358 /**
32359  * More information about a node from node_announcement.
32360  * Optional because we store a Node entry after learning about it from
32361  * a channel announcement, but before receiving a node announcement.
32362  *
32363  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
32364  */
32365 void NodeInfo_set_announcement_info(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncementInfo val);
32366
32367 /**
32368  * Constructs a new NodeInfo given each field
32369  */
32370 MUST_USE_RES struct LDKNodeInfo NodeInfo_new(struct LDKCVec_u64Z channels_arg, struct LDKNodeAnnouncementInfo announcement_info_arg);
32371
32372 /**
32373  * Creates a copy of the NodeInfo
32374  */
32375 struct LDKNodeInfo NodeInfo_clone(const struct LDKNodeInfo *NONNULL_PTR orig);
32376
32377 /**
32378  * Checks if two NodeInfos contain equal inner contents.
32379  * This ignores pointers and is_owned flags and looks at the values in fields.
32380  * Two objects with NULL inner values will be considered "equal" here.
32381  */
32382 bool NodeInfo_eq(const struct LDKNodeInfo *NONNULL_PTR a, const struct LDKNodeInfo *NONNULL_PTR b);
32383
32384 /**
32385  * Serialize the NodeInfo object into a byte array which can be read by NodeInfo_read
32386  */
32387 struct LDKCVec_u8Z NodeInfo_write(const struct LDKNodeInfo *NONNULL_PTR obj);
32388
32389 /**
32390  * Read a NodeInfo from a byte array, created by NodeInfo_write
32391  */
32392 struct LDKCResult_NodeInfoDecodeErrorZ NodeInfo_read(struct LDKu8slice ser);
32393
32394 /**
32395  * Serialize the NetworkGraph object into a byte array which can be read by NetworkGraph_read
32396  */
32397 struct LDKCVec_u8Z NetworkGraph_write(const struct LDKNetworkGraph *NONNULL_PTR obj);
32398
32399 /**
32400  * Read a NetworkGraph from a byte array, created by NetworkGraph_write
32401  */
32402 struct LDKCResult_NetworkGraphDecodeErrorZ NetworkGraph_read(struct LDKu8slice ser, struct LDKLogger arg);
32403
32404 /**
32405  * Creates a new, empty, network graph.
32406  */
32407 MUST_USE_RES struct LDKNetworkGraph NetworkGraph_new(enum LDKNetwork network, struct LDKLogger logger);
32408
32409 /**
32410  * Returns a read-only view of the network graph.
32411  */
32412 MUST_USE_RES struct LDKReadOnlyNetworkGraph NetworkGraph_read_only(const struct LDKNetworkGraph *NONNULL_PTR this_arg);
32413
32414 /**
32415  * The unix timestamp provided by the most recent rapid gossip sync.
32416  * It will be set by the rapid sync process after every sync completion.
32417  */
32418 MUST_USE_RES struct LDKCOption_u32Z NetworkGraph_get_last_rapid_gossip_sync_timestamp(const struct LDKNetworkGraph *NONNULL_PTR this_arg);
32419
32420 /**
32421  * Update the unix timestamp provided by the most recent rapid gossip sync.
32422  * This should be done automatically by the rapid sync process after every sync completion.
32423  */
32424 void NetworkGraph_set_last_rapid_gossip_sync_timestamp(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint32_t last_rapid_gossip_sync_timestamp);
32425
32426 /**
32427  * For an already known node (from channel announcements), update its stored properties from a
32428  * given node announcement.
32429  *
32430  * You probably don't want to call this directly, instead relying on a P2PGossipSync's
32431  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
32432  * routing messages from a source using a protocol other than the lightning P2P protocol.
32433  */
32434 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_announcement(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
32435
32436 /**
32437  * For an already known node (from channel announcements), update its stored properties from a
32438  * given node announcement without verifying the associated signatures. Because we aren't
32439  * given the associated signatures here we cannot relay the node announcement to any of our
32440  * peers.
32441  */
32442 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_unsigned_announcement(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR msg);
32443
32444 /**
32445  * Store or update channel info from a channel announcement.
32446  *
32447  * You probably don't want to call this directly, instead relying on a P2PGossipSync's
32448  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
32449  * routing messages from a source using a protocol other than the lightning P2P protocol.
32450  *
32451  * If a [`UtxoLookup`] object is provided via `utxo_lookup`, it will be called to verify
32452  * the corresponding UTXO exists on chain and is correctly-formatted.
32453  */
32454 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_from_announcement(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelAnnouncement *NONNULL_PTR msg, struct LDKCOption_UtxoLookupZ utxo_lookup);
32455
32456 /**
32457  * Store or update channel info from a channel announcement without verifying the associated
32458  * signatures. Because we aren't given the associated signatures here we cannot relay the
32459  * channel announcement to any of our peers.
32460  *
32461  * If a [`UtxoLookup`] object is provided via `utxo_lookup`, it will be called to verify
32462  * the corresponding UTXO exists on chain and is correctly-formatted.
32463  */
32464 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_from_unsigned_announcement(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg, struct LDKCOption_UtxoLookupZ utxo_lookup);
32465
32466 /**
32467  * Update channel from partial announcement data received via rapid gossip sync
32468  *
32469  * `timestamp: u64`: Timestamp emulating the backdated original announcement receipt (by the
32470  * rapid gossip sync server)
32471  *
32472  * All other parameters as used in [`msgs::UnsignedChannelAnnouncement`] fields.
32473  */
32474 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_add_channel_from_partial_announcement(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id, uint64_t timestamp, struct LDKChannelFeatures features, struct LDKPublicKey node_id_1, struct LDKPublicKey node_id_2);
32475
32476 /**
32477  * Marks a channel in the graph as failed permanently.
32478  *
32479  * The channel and any node for which this was their last channel are removed from the graph.
32480  */
32481 void NetworkGraph_channel_failed_permanent(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id);
32482
32483 /**
32484  * Marks a node in the graph as permanently failed, effectively removing it and its channels
32485  * from local storage.
32486  */
32487 void NetworkGraph_node_failed_permanent(const struct LDKNetworkGraph *NONNULL_PTR this_arg, struct LDKPublicKey node_id);
32488
32489 /**
32490  * Removes information about channels that we haven't heard any updates about in some time.
32491  * This can be used regularly to prune the network graph of channels that likely no longer
32492  * exist.
32493  *
32494  * While there is no formal requirement that nodes regularly re-broadcast their channel
32495  * updates every two weeks, the non-normative section of BOLT 7 currently suggests that
32496  * pruning occur for updates which are at least two weeks old, which we implement here.
32497  *
32498  * Note that for users of the `lightning-background-processor` crate this method may be
32499  * automatically called regularly for you.
32500  *
32501  * This method will also cause us to stop tracking removed nodes and channels if they have been
32502  * in the map for a while so that these can be resynced from gossip in the future.
32503  *
32504  * This method is only available with the `std` feature. See
32505  * [`NetworkGraph::remove_stale_channels_and_tracking_with_time`] for `no-std` use.
32506  */
32507 void NetworkGraph_remove_stale_channels_and_tracking(const struct LDKNetworkGraph *NONNULL_PTR this_arg);
32508
32509 /**
32510  * Removes information about channels that we haven't heard any updates about in some time.
32511  * This can be used regularly to prune the network graph of channels that likely no longer
32512  * exist.
32513  *
32514  * While there is no formal requirement that nodes regularly re-broadcast their channel
32515  * updates every two weeks, the non-normative section of BOLT 7 currently suggests that
32516  * pruning occur for updates which are at least two weeks old, which we implement here.
32517  *
32518  * This method will also cause us to stop tracking removed nodes and channels if they have been
32519  * in the map for a while so that these can be resynced from gossip in the future.
32520  *
32521  * This function takes the current unix time as an argument. For users with the `std` feature
32522  * enabled, [`NetworkGraph::remove_stale_channels_and_tracking`] may be preferable.
32523  */
32524 void NetworkGraph_remove_stale_channels_and_tracking_with_time(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t current_time_unix);
32525
32526 /**
32527  * For an already known (from announcement) channel, update info about one of the directions
32528  * of the channel.
32529  *
32530  * You probably don't want to call this directly, instead relying on a P2PGossipSync's
32531  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
32532  * routing messages from a source using a protocol other than the lightning P2P protocol.
32533  *
32534  * If built with `no-std`, any updates with a timestamp more than two weeks in the past or
32535  * materially in the future will be rejected.
32536  */
32537 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
32538
32539 /**
32540  * For an already known (from announcement) channel, update info about one of the directions
32541  * of the channel without verifying the associated signatures. Because we aren't given the
32542  * associated signatures here we cannot relay the channel update to any of our peers.
32543  *
32544  * If built with `no-std`, any updates with a timestamp more than two weeks in the past or
32545  * materially in the future will be rejected.
32546  */
32547 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_unsigned(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelUpdate *NONNULL_PTR msg);
32548
32549 /**
32550  * Returns information on a channel with the given id.
32551  *
32552  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
32553  */
32554 MUST_USE_RES struct LDKChannelInfo ReadOnlyNetworkGraph_channel(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id);
32555
32556 /**
32557  * Returns the list of channels in the graph
32558  */
32559 MUST_USE_RES struct LDKCVec_u64Z ReadOnlyNetworkGraph_list_channels(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg);
32560
32561 /**
32562  * Returns information on a node with the given id.
32563  *
32564  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
32565  */
32566 MUST_USE_RES struct LDKNodeInfo ReadOnlyNetworkGraph_node(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR node_id);
32567
32568 /**
32569  * Returns the list of nodes in the graph
32570  */
32571 MUST_USE_RES struct LDKCVec_NodeIdZ ReadOnlyNetworkGraph_list_nodes(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg);
32572
32573 /**
32574  * Get network addresses by node id.
32575  * Returns None if the requested node is completely unknown,
32576  * or if node announcement for the node was never received.
32577  */
32578 MUST_USE_RES struct LDKCOption_CVec_NetAddressZZ ReadOnlyNetworkGraph_get_addresses(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg, struct LDKPublicKey pubkey);
32579
32580 /**
32581  * Frees any resources used by the DefaultRouter, if is_owned is set and inner is non-NULL.
32582  */
32583 void DefaultRouter_free(struct LDKDefaultRouter this_obj);
32584
32585 /**
32586  * Creates a new router.
32587  */
32588 MUST_USE_RES struct LDKDefaultRouter DefaultRouter_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKLogger logger, struct LDKThirtyTwoBytes random_seed_bytes, struct LDKLockableScore scorer);
32589
32590 /**
32591  * Constructs a new Router which calls the relevant methods on this_arg.
32592  * This copies the `inner` pointer in this_arg and thus the returned Router must be freed before this_arg is
32593  */
32594 struct LDKRouter DefaultRouter_as_Router(const struct LDKDefaultRouter *NONNULL_PTR this_arg);
32595
32596 /**
32597  * Calls the free function if one is set
32598  */
32599 void Router_free(struct LDKRouter this_ptr);
32600
32601 /**
32602  * Frees any resources used by the ScorerAccountingForInFlightHtlcs, if is_owned is set and inner is non-NULL.
32603  */
32604 void ScorerAccountingForInFlightHtlcs_free(struct LDKScorerAccountingForInFlightHtlcs this_obj);
32605
32606 /**
32607  * Initialize a new `ScorerAccountingForInFlightHtlcs`.
32608  */
32609 MUST_USE_RES struct LDKScorerAccountingForInFlightHtlcs ScorerAccountingForInFlightHtlcs_new(struct LDKScore scorer, const struct LDKInFlightHtlcs *NONNULL_PTR inflight_htlcs);
32610
32611 /**
32612  * Serialize the ScorerAccountingForInFlightHtlcs object into a byte array which can be read by ScorerAccountingForInFlightHtlcs_read
32613  */
32614 struct LDKCVec_u8Z ScorerAccountingForInFlightHtlcs_write(const struct LDKScorerAccountingForInFlightHtlcs *NONNULL_PTR obj);
32615
32616 /**
32617  * Constructs a new Score which calls the relevant methods on this_arg.
32618  * This copies the `inner` pointer in this_arg and thus the returned Score must be freed before this_arg is
32619  */
32620 struct LDKScore ScorerAccountingForInFlightHtlcs_as_Score(const struct LDKScorerAccountingForInFlightHtlcs *NONNULL_PTR this_arg);
32621
32622 /**
32623  * Frees any resources used by the InFlightHtlcs, if is_owned is set and inner is non-NULL.
32624  */
32625 void InFlightHtlcs_free(struct LDKInFlightHtlcs this_obj);
32626
32627 /**
32628  * Creates a copy of the InFlightHtlcs
32629  */
32630 struct LDKInFlightHtlcs InFlightHtlcs_clone(const struct LDKInFlightHtlcs *NONNULL_PTR orig);
32631
32632 /**
32633  * Constructs an empty `InFlightHtlcs`.
32634  */
32635 MUST_USE_RES struct LDKInFlightHtlcs InFlightHtlcs_new(void);
32636
32637 /**
32638  * Takes in a path with payer's node id and adds the path's details to `InFlightHtlcs`.
32639  */
32640 void InFlightHtlcs_process_path(struct LDKInFlightHtlcs *NONNULL_PTR this_arg, const struct LDKPath *NONNULL_PTR path, struct LDKPublicKey payer_node_id);
32641
32642 /**
32643  * Returns liquidity in msat given the public key of the HTLC source, target, and short channel
32644  * id.
32645  */
32646 MUST_USE_RES struct LDKCOption_u64Z InFlightHtlcs_used_liquidity_msat(const struct LDKInFlightHtlcs *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR source, const struct LDKNodeId *NONNULL_PTR target, uint64_t channel_scid);
32647
32648 /**
32649  * Serialize the InFlightHtlcs object into a byte array which can be read by InFlightHtlcs_read
32650  */
32651 struct LDKCVec_u8Z InFlightHtlcs_write(const struct LDKInFlightHtlcs *NONNULL_PTR obj);
32652
32653 /**
32654  * Read a InFlightHtlcs from a byte array, created by InFlightHtlcs_write
32655  */
32656 struct LDKCResult_InFlightHtlcsDecodeErrorZ InFlightHtlcs_read(struct LDKu8slice ser);
32657
32658 /**
32659  * Frees any resources used by the RouteHop, if is_owned is set and inner is non-NULL.
32660  */
32661 void RouteHop_free(struct LDKRouteHop this_obj);
32662
32663 /**
32664  * The node_id of the node at this hop.
32665  */
32666 struct LDKPublicKey RouteHop_get_pubkey(const struct LDKRouteHop *NONNULL_PTR this_ptr);
32667
32668 /**
32669  * The node_id of the node at this hop.
32670  */
32671 void RouteHop_set_pubkey(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKPublicKey val);
32672
32673 /**
32674  * The node_announcement features of the node at this hop. For the last hop, these may be
32675  * amended to match the features present in the invoice this node generated.
32676  */
32677 struct LDKNodeFeatures RouteHop_get_node_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
32678
32679 /**
32680  * The node_announcement features of the node at this hop. For the last hop, these may be
32681  * amended to match the features present in the invoice this node generated.
32682  */
32683 void RouteHop_set_node_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
32684
32685 /**
32686  * The channel that should be used from the previous hop to reach this node.
32687  */
32688 uint64_t RouteHop_get_short_channel_id(const struct LDKRouteHop *NONNULL_PTR this_ptr);
32689
32690 /**
32691  * The channel that should be used from the previous hop to reach this node.
32692  */
32693 void RouteHop_set_short_channel_id(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
32694
32695 /**
32696  * The channel_announcement features of the channel that should be used from the previous hop
32697  * to reach this node.
32698  */
32699 struct LDKChannelFeatures RouteHop_get_channel_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
32700
32701 /**
32702  * The channel_announcement features of the channel that should be used from the previous hop
32703  * to reach this node.
32704  */
32705 void RouteHop_set_channel_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
32706
32707 /**
32708  * The fee taken on this hop (for paying for the use of the *next* channel in the path).
32709  * If this is the last hop in [`Path::hops`]:
32710  * * if we're sending to a [`BlindedPath`], this is the fee paid for use of the entire blinded path
32711  * * otherwise, this is the full value of this [`Path`]'s part of the payment
32712  *
32713  * [`BlindedPath`]: crate::blinded_path::BlindedPath
32714  */
32715 uint64_t RouteHop_get_fee_msat(const struct LDKRouteHop *NONNULL_PTR this_ptr);
32716
32717 /**
32718  * The fee taken on this hop (for paying for the use of the *next* channel in the path).
32719  * If this is the last hop in [`Path::hops`]:
32720  * * if we're sending to a [`BlindedPath`], this is the fee paid for use of the entire blinded path
32721  * * otherwise, this is the full value of this [`Path`]'s part of the payment
32722  *
32723  * [`BlindedPath`]: crate::blinded_path::BlindedPath
32724  */
32725 void RouteHop_set_fee_msat(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
32726
32727 /**
32728  * The CLTV delta added for this hop.
32729  * If this is the last hop in [`Path::hops`]:
32730  * * if we're sending to a [`BlindedPath`], this is the CLTV delta for the entire blinded path
32731  * * otherwise, this is the CLTV delta expected at the destination
32732  *
32733  * [`BlindedPath`]: crate::blinded_path::BlindedPath
32734  */
32735 uint32_t RouteHop_get_cltv_expiry_delta(const struct LDKRouteHop *NONNULL_PTR this_ptr);
32736
32737 /**
32738  * The CLTV delta added for this hop.
32739  * If this is the last hop in [`Path::hops`]:
32740  * * if we're sending to a [`BlindedPath`], this is the CLTV delta for the entire blinded path
32741  * * otherwise, this is the CLTV delta expected at the destination
32742  *
32743  * [`BlindedPath`]: crate::blinded_path::BlindedPath
32744  */
32745 void RouteHop_set_cltv_expiry_delta(struct LDKRouteHop *NONNULL_PTR this_ptr, uint32_t val);
32746
32747 /**
32748  * Constructs a new RouteHop given each field
32749  */
32750 MUST_USE_RES struct LDKRouteHop RouteHop_new(struct LDKPublicKey pubkey_arg, struct LDKNodeFeatures node_features_arg, uint64_t short_channel_id_arg, struct LDKChannelFeatures channel_features_arg, uint64_t fee_msat_arg, uint32_t cltv_expiry_delta_arg);
32751
32752 /**
32753  * Creates a copy of the RouteHop
32754  */
32755 struct LDKRouteHop RouteHop_clone(const struct LDKRouteHop *NONNULL_PTR orig);
32756
32757 /**
32758  * Generates a non-cryptographic 64-bit hash of the RouteHop.
32759  */
32760 uint64_t RouteHop_hash(const struct LDKRouteHop *NONNULL_PTR o);
32761
32762 /**
32763  * Checks if two RouteHops contain equal inner contents.
32764  * This ignores pointers and is_owned flags and looks at the values in fields.
32765  * Two objects with NULL inner values will be considered "equal" here.
32766  */
32767 bool RouteHop_eq(const struct LDKRouteHop *NONNULL_PTR a, const struct LDKRouteHop *NONNULL_PTR b);
32768
32769 /**
32770  * Serialize the RouteHop object into a byte array which can be read by RouteHop_read
32771  */
32772 struct LDKCVec_u8Z RouteHop_write(const struct LDKRouteHop *NONNULL_PTR obj);
32773
32774 /**
32775  * Read a RouteHop from a byte array, created by RouteHop_write
32776  */
32777 struct LDKCResult_RouteHopDecodeErrorZ RouteHop_read(struct LDKu8slice ser);
32778
32779 /**
32780  * Frees any resources used by the BlindedTail, if is_owned is set and inner is non-NULL.
32781  */
32782 void BlindedTail_free(struct LDKBlindedTail this_obj);
32783
32784 /**
32785  * The hops of the [`BlindedPath`] provided by the recipient.
32786  *
32787  * [`BlindedPath`]: crate::blinded_path::BlindedPath
32788  */
32789 struct LDKCVec_BlindedHopZ BlindedTail_get_hops(const struct LDKBlindedTail *NONNULL_PTR this_ptr);
32790
32791 /**
32792  * The hops of the [`BlindedPath`] provided by the recipient.
32793  *
32794  * [`BlindedPath`]: crate::blinded_path::BlindedPath
32795  */
32796 void BlindedTail_set_hops(struct LDKBlindedTail *NONNULL_PTR this_ptr, struct LDKCVec_BlindedHopZ val);
32797
32798 /**
32799  * The blinding point of the [`BlindedPath`] provided by the recipient.
32800  *
32801  * [`BlindedPath`]: crate::blinded_path::BlindedPath
32802  */
32803 struct LDKPublicKey BlindedTail_get_blinding_point(const struct LDKBlindedTail *NONNULL_PTR this_ptr);
32804
32805 /**
32806  * The blinding point of the [`BlindedPath`] provided by the recipient.
32807  *
32808  * [`BlindedPath`]: crate::blinded_path::BlindedPath
32809  */
32810 void BlindedTail_set_blinding_point(struct LDKBlindedTail *NONNULL_PTR this_ptr, struct LDKPublicKey val);
32811
32812 /**
32813  * Excess CLTV delta added to the recipient's CLTV expiry to deter intermediate nodes from
32814  * inferring the destination. May be 0.
32815  */
32816 uint32_t BlindedTail_get_excess_final_cltv_expiry_delta(const struct LDKBlindedTail *NONNULL_PTR this_ptr);
32817
32818 /**
32819  * Excess CLTV delta added to the recipient's CLTV expiry to deter intermediate nodes from
32820  * inferring the destination. May be 0.
32821  */
32822 void BlindedTail_set_excess_final_cltv_expiry_delta(struct LDKBlindedTail *NONNULL_PTR this_ptr, uint32_t val);
32823
32824 /**
32825  * The total amount paid on this [`Path`], excluding the fees.
32826  */
32827 uint64_t BlindedTail_get_final_value_msat(const struct LDKBlindedTail *NONNULL_PTR this_ptr);
32828
32829 /**
32830  * The total amount paid on this [`Path`], excluding the fees.
32831  */
32832 void BlindedTail_set_final_value_msat(struct LDKBlindedTail *NONNULL_PTR this_ptr, uint64_t val);
32833
32834 /**
32835  * Constructs a new BlindedTail given each field
32836  */
32837 MUST_USE_RES struct LDKBlindedTail BlindedTail_new(struct LDKCVec_BlindedHopZ hops_arg, struct LDKPublicKey blinding_point_arg, uint32_t excess_final_cltv_expiry_delta_arg, uint64_t final_value_msat_arg);
32838
32839 /**
32840  * Creates a copy of the BlindedTail
32841  */
32842 struct LDKBlindedTail BlindedTail_clone(const struct LDKBlindedTail *NONNULL_PTR orig);
32843
32844 /**
32845  * Generates a non-cryptographic 64-bit hash of the BlindedTail.
32846  */
32847 uint64_t BlindedTail_hash(const struct LDKBlindedTail *NONNULL_PTR o);
32848
32849 /**
32850  * Checks if two BlindedTails contain equal inner contents.
32851  * This ignores pointers and is_owned flags and looks at the values in fields.
32852  * Two objects with NULL inner values will be considered "equal" here.
32853  */
32854 bool BlindedTail_eq(const struct LDKBlindedTail *NONNULL_PTR a, const struct LDKBlindedTail *NONNULL_PTR b);
32855
32856 /**
32857  * Serialize the BlindedTail object into a byte array which can be read by BlindedTail_read
32858  */
32859 struct LDKCVec_u8Z BlindedTail_write(const struct LDKBlindedTail *NONNULL_PTR obj);
32860
32861 /**
32862  * Read a BlindedTail from a byte array, created by BlindedTail_write
32863  */
32864 struct LDKCResult_BlindedTailDecodeErrorZ BlindedTail_read(struct LDKu8slice ser);
32865
32866 /**
32867  * Frees any resources used by the Path, if is_owned is set and inner is non-NULL.
32868  */
32869 void Path_free(struct LDKPath this_obj);
32870
32871 /**
32872  * The list of unblinded hops in this [`Path`]. Must be at least length one.
32873  */
32874 struct LDKCVec_RouteHopZ Path_get_hops(const struct LDKPath *NONNULL_PTR this_ptr);
32875
32876 /**
32877  * The list of unblinded hops in this [`Path`]. Must be at least length one.
32878  */
32879 void Path_set_hops(struct LDKPath *NONNULL_PTR this_ptr, struct LDKCVec_RouteHopZ val);
32880
32881 /**
32882  * The blinded path at which this path terminates, if we're sending to one, and its metadata.
32883  *
32884  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
32885  */
32886 struct LDKBlindedTail Path_get_blinded_tail(const struct LDKPath *NONNULL_PTR this_ptr);
32887
32888 /**
32889  * The blinded path at which this path terminates, if we're sending to one, and its metadata.
32890  *
32891  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
32892  */
32893 void Path_set_blinded_tail(struct LDKPath *NONNULL_PTR this_ptr, struct LDKBlindedTail val);
32894
32895 /**
32896  * Constructs a new Path given each field
32897  */
32898 MUST_USE_RES struct LDKPath Path_new(struct LDKCVec_RouteHopZ hops_arg, struct LDKBlindedTail blinded_tail_arg);
32899
32900 /**
32901  * Creates a copy of the Path
32902  */
32903 struct LDKPath Path_clone(const struct LDKPath *NONNULL_PTR orig);
32904
32905 /**
32906  * Generates a non-cryptographic 64-bit hash of the Path.
32907  */
32908 uint64_t Path_hash(const struct LDKPath *NONNULL_PTR o);
32909
32910 /**
32911  * Checks if two Paths contain equal inner contents.
32912  * This ignores pointers and is_owned flags and looks at the values in fields.
32913  * Two objects with NULL inner values will be considered "equal" here.
32914  */
32915 bool Path_eq(const struct LDKPath *NONNULL_PTR a, const struct LDKPath *NONNULL_PTR b);
32916
32917 /**
32918  * Gets the fees for a given path, excluding any excess paid to the recipient.
32919  */
32920 MUST_USE_RES uint64_t Path_fee_msat(const struct LDKPath *NONNULL_PTR this_arg);
32921
32922 /**
32923  * Gets the total amount paid on this [`Path`], excluding the fees.
32924  */
32925 MUST_USE_RES uint64_t Path_final_value_msat(const struct LDKPath *NONNULL_PTR this_arg);
32926
32927 /**
32928  * Gets the final hop's CLTV expiry delta.
32929  */
32930 MUST_USE_RES struct LDKCOption_u32Z Path_final_cltv_expiry_delta(const struct LDKPath *NONNULL_PTR this_arg);
32931
32932 /**
32933  * Frees any resources used by the Route, if is_owned is set and inner is non-NULL.
32934  */
32935 void Route_free(struct LDKRoute this_obj);
32936
32937 /**
32938  * The list of [`Path`]s taken for a single (potentially-)multi-part payment. If no
32939  * [`BlindedTail`]s are present, then the pubkey of the last [`RouteHop`] in each path must be
32940  * the same.
32941  */
32942 struct LDKCVec_PathZ Route_get_paths(const struct LDKRoute *NONNULL_PTR this_ptr);
32943
32944 /**
32945  * The list of [`Path`]s taken for a single (potentially-)multi-part payment. If no
32946  * [`BlindedTail`]s are present, then the pubkey of the last [`RouteHop`] in each path must be
32947  * the same.
32948  */
32949 void Route_set_paths(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKCVec_PathZ val);
32950
32951 /**
32952  * The `payment_params` parameter passed to [`find_route`].
32953  * This is used by `ChannelManager` to track information which may be required for retries,
32954  * provided back to you via [`Event::PaymentPathFailed`].
32955  *
32956  * [`Event::PaymentPathFailed`]: crate::events::Event::PaymentPathFailed
32957  *
32958  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
32959  */
32960 struct LDKPaymentParameters Route_get_payment_params(const struct LDKRoute *NONNULL_PTR this_ptr);
32961
32962 /**
32963  * The `payment_params` parameter passed to [`find_route`].
32964  * This is used by `ChannelManager` to track information which may be required for retries,
32965  * provided back to you via [`Event::PaymentPathFailed`].
32966  *
32967  * [`Event::PaymentPathFailed`]: crate::events::Event::PaymentPathFailed
32968  *
32969  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
32970  */
32971 void Route_set_payment_params(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKPaymentParameters val);
32972
32973 /**
32974  * Constructs a new Route given each field
32975  */
32976 MUST_USE_RES struct LDKRoute Route_new(struct LDKCVec_PathZ paths_arg, struct LDKPaymentParameters payment_params_arg);
32977
32978 /**
32979  * Creates a copy of the Route
32980  */
32981 struct LDKRoute Route_clone(const struct LDKRoute *NONNULL_PTR orig);
32982
32983 /**
32984  * Generates a non-cryptographic 64-bit hash of the Route.
32985  */
32986 uint64_t Route_hash(const struct LDKRoute *NONNULL_PTR o);
32987
32988 /**
32989  * Checks if two Routes contain equal inner contents.
32990  * This ignores pointers and is_owned flags and looks at the values in fields.
32991  * Two objects with NULL inner values will be considered "equal" here.
32992  */
32993 bool Route_eq(const struct LDKRoute *NONNULL_PTR a, const struct LDKRoute *NONNULL_PTR b);
32994
32995 /**
32996  * Returns the total amount of fees paid on this [`Route`].
32997  *
32998  * This doesn't include any extra payment made to the recipient, which can happen in excess of
32999  * the amount passed to [`find_route`]'s `params.final_value_msat`.
33000  */
33001 MUST_USE_RES uint64_t Route_get_total_fees(const struct LDKRoute *NONNULL_PTR this_arg);
33002
33003 /**
33004  * Returns the total amount paid on this [`Route`], excluding the fees. Might be more than
33005  * requested if we had to reach htlc_minimum_msat.
33006  */
33007 MUST_USE_RES uint64_t Route_get_total_amount(const struct LDKRoute *NONNULL_PTR this_arg);
33008
33009 /**
33010  * Serialize the Route object into a byte array which can be read by Route_read
33011  */
33012 struct LDKCVec_u8Z Route_write(const struct LDKRoute *NONNULL_PTR obj);
33013
33014 /**
33015  * Read a Route from a byte array, created by Route_write
33016  */
33017 struct LDKCResult_RouteDecodeErrorZ Route_read(struct LDKu8slice ser);
33018
33019 /**
33020  * Frees any resources used by the RouteParameters, if is_owned is set and inner is non-NULL.
33021  */
33022 void RouteParameters_free(struct LDKRouteParameters this_obj);
33023
33024 /**
33025  * The parameters of the failed payment path.
33026  */
33027 struct LDKPaymentParameters RouteParameters_get_payment_params(const struct LDKRouteParameters *NONNULL_PTR this_ptr);
33028
33029 /**
33030  * The parameters of the failed payment path.
33031  */
33032 void RouteParameters_set_payment_params(struct LDKRouteParameters *NONNULL_PTR this_ptr, struct LDKPaymentParameters val);
33033
33034 /**
33035  * The amount in msats sent on the failed payment path.
33036  */
33037 uint64_t RouteParameters_get_final_value_msat(const struct LDKRouteParameters *NONNULL_PTR this_ptr);
33038
33039 /**
33040  * The amount in msats sent on the failed payment path.
33041  */
33042 void RouteParameters_set_final_value_msat(struct LDKRouteParameters *NONNULL_PTR this_ptr, uint64_t val);
33043
33044 /**
33045  * Constructs a new RouteParameters given each field
33046  */
33047 MUST_USE_RES struct LDKRouteParameters RouteParameters_new(struct LDKPaymentParameters payment_params_arg, uint64_t final_value_msat_arg);
33048
33049 /**
33050  * Creates a copy of the RouteParameters
33051  */
33052 struct LDKRouteParameters RouteParameters_clone(const struct LDKRouteParameters *NONNULL_PTR orig);
33053
33054 /**
33055  * Checks if two RouteParameterss contain equal inner contents.
33056  * This ignores pointers and is_owned flags and looks at the values in fields.
33057  * Two objects with NULL inner values will be considered "equal" here.
33058  */
33059 bool RouteParameters_eq(const struct LDKRouteParameters *NONNULL_PTR a, const struct LDKRouteParameters *NONNULL_PTR b);
33060
33061 /**
33062  * Serialize the RouteParameters object into a byte array which can be read by RouteParameters_read
33063  */
33064 struct LDKCVec_u8Z RouteParameters_write(const struct LDKRouteParameters *NONNULL_PTR obj);
33065
33066 /**
33067  * Read a RouteParameters from a byte array, created by RouteParameters_write
33068  */
33069 struct LDKCResult_RouteParametersDecodeErrorZ RouteParameters_read(struct LDKu8slice ser);
33070
33071 /**
33072  * Frees any resources used by the PaymentParameters, if is_owned is set and inner is non-NULL.
33073  */
33074 void PaymentParameters_free(struct LDKPaymentParameters this_obj);
33075
33076 /**
33077  * The node id of the payee.
33078  */
33079 struct LDKPublicKey PaymentParameters_get_payee_pubkey(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
33080
33081 /**
33082  * The node id of the payee.
33083  */
33084 void PaymentParameters_set_payee_pubkey(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKPublicKey val);
33085
33086 /**
33087  * Features supported by the payee.
33088  *
33089  * May be set from the payee's invoice or via [`for_keysend`]. May be `None` if the invoice
33090  * does not contain any features.
33091  *
33092  * [`for_keysend`]: Self::for_keysend
33093  *
33094  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
33095  */
33096 struct LDKInvoiceFeatures PaymentParameters_get_features(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
33097
33098 /**
33099  * Features supported by the payee.
33100  *
33101  * May be set from the payee's invoice or via [`for_keysend`]. May be `None` if the invoice
33102  * does not contain any features.
33103  *
33104  * [`for_keysend`]: Self::for_keysend
33105  *
33106  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
33107  */
33108 void PaymentParameters_set_features(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKInvoiceFeatures val);
33109
33110 /**
33111  * Hints for routing to the payee, containing channels connecting the payee to public nodes.
33112  */
33113 struct LDKHints PaymentParameters_get_route_hints(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
33114
33115 /**
33116  * Hints for routing to the payee, containing channels connecting the payee to public nodes.
33117  */
33118 void PaymentParameters_set_route_hints(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKHints val);
33119
33120 /**
33121  * Expiration of a payment to the payee, in seconds relative to the UNIX epoch.
33122  */
33123 struct LDKCOption_u64Z PaymentParameters_get_expiry_time(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
33124
33125 /**
33126  * Expiration of a payment to the payee, in seconds relative to the UNIX epoch.
33127  */
33128 void PaymentParameters_set_expiry_time(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
33129
33130 /**
33131  * The maximum total CLTV delta we accept for the route.
33132  * Defaults to [`DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA`].
33133  */
33134 uint32_t PaymentParameters_get_max_total_cltv_expiry_delta(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
33135
33136 /**
33137  * The maximum total CLTV delta we accept for the route.
33138  * Defaults to [`DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA`].
33139  */
33140 void PaymentParameters_set_max_total_cltv_expiry_delta(struct LDKPaymentParameters *NONNULL_PTR this_ptr, uint32_t val);
33141
33142 /**
33143  * The maximum number of paths that may be used by (MPP) payments.
33144  * Defaults to [`DEFAULT_MAX_PATH_COUNT`].
33145  */
33146 uint8_t PaymentParameters_get_max_path_count(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
33147
33148 /**
33149  * The maximum number of paths that may be used by (MPP) payments.
33150  * Defaults to [`DEFAULT_MAX_PATH_COUNT`].
33151  */
33152 void PaymentParameters_set_max_path_count(struct LDKPaymentParameters *NONNULL_PTR this_ptr, uint8_t val);
33153
33154 /**
33155  * Selects the maximum share of a channel's total capacity which will be sent over a channel,
33156  * as a power of 1/2. A higher value prefers to send the payment using more MPP parts whereas
33157  * a lower value prefers to send larger MPP parts, potentially saturating channels and
33158  * increasing failure probability for those paths.
33159  *
33160  * Note that this restriction will be relaxed during pathfinding after paths which meet this
33161  * restriction have been found. While paths which meet this criteria will be searched for, it
33162  * is ultimately up to the scorer to select them over other paths.
33163  *
33164  * A value of 0 will allow payments up to and including a channel's total announced usable
33165  * capacity, a value of one will only use up to half its capacity, two 1/4, etc.
33166  *
33167  * Default value: 2
33168  */
33169 uint8_t PaymentParameters_get_max_channel_saturation_power_of_half(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
33170
33171 /**
33172  * Selects the maximum share of a channel's total capacity which will be sent over a channel,
33173  * as a power of 1/2. A higher value prefers to send the payment using more MPP parts whereas
33174  * a lower value prefers to send larger MPP parts, potentially saturating channels and
33175  * increasing failure probability for those paths.
33176  *
33177  * Note that this restriction will be relaxed during pathfinding after paths which meet this
33178  * restriction have been found. While paths which meet this criteria will be searched for, it
33179  * is ultimately up to the scorer to select them over other paths.
33180  *
33181  * A value of 0 will allow payments up to and including a channel's total announced usable
33182  * capacity, a value of one will only use up to half its capacity, two 1/4, etc.
33183  *
33184  * Default value: 2
33185  */
33186 void PaymentParameters_set_max_channel_saturation_power_of_half(struct LDKPaymentParameters *NONNULL_PTR this_ptr, uint8_t val);
33187
33188 /**
33189  * A list of SCIDs which this payment was previously attempted over and which caused the
33190  * payment to fail. Future attempts for the same payment shouldn't be relayed through any of
33191  * these SCIDs.
33192  *
33193  * Returns a copy of the field.
33194  */
33195 struct LDKCVec_u64Z PaymentParameters_get_previously_failed_channels(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
33196
33197 /**
33198  * A list of SCIDs which this payment was previously attempted over and which caused the
33199  * payment to fail. Future attempts for the same payment shouldn't be relayed through any of
33200  * these SCIDs.
33201  */
33202 void PaymentParameters_set_previously_failed_channels(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
33203
33204 /**
33205  * The minimum CLTV delta at the end of the route. This value must not be zero.
33206  */
33207 uint32_t PaymentParameters_get_final_cltv_expiry_delta(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
33208
33209 /**
33210  * The minimum CLTV delta at the end of the route. This value must not be zero.
33211  */
33212 void PaymentParameters_set_final_cltv_expiry_delta(struct LDKPaymentParameters *NONNULL_PTR this_ptr, uint32_t val);
33213
33214 /**
33215  * Constructs a new PaymentParameters given each field
33216  */
33217 MUST_USE_RES struct LDKPaymentParameters PaymentParameters_new(struct LDKPublicKey payee_pubkey_arg, struct LDKInvoiceFeatures features_arg, struct LDKHints route_hints_arg, struct LDKCOption_u64Z expiry_time_arg, uint32_t max_total_cltv_expiry_delta_arg, uint8_t max_path_count_arg, uint8_t max_channel_saturation_power_of_half_arg, struct LDKCVec_u64Z previously_failed_channels_arg, uint32_t final_cltv_expiry_delta_arg);
33218
33219 /**
33220  * Creates a copy of the PaymentParameters
33221  */
33222 struct LDKPaymentParameters PaymentParameters_clone(const struct LDKPaymentParameters *NONNULL_PTR orig);
33223
33224 /**
33225  * Generates a non-cryptographic 64-bit hash of the PaymentParameters.
33226  */
33227 uint64_t PaymentParameters_hash(const struct LDKPaymentParameters *NONNULL_PTR o);
33228
33229 /**
33230  * Checks if two PaymentParameterss contain equal inner contents.
33231  * This ignores pointers and is_owned flags and looks at the values in fields.
33232  * Two objects with NULL inner values will be considered "equal" here.
33233  */
33234 bool PaymentParameters_eq(const struct LDKPaymentParameters *NONNULL_PTR a, const struct LDKPaymentParameters *NONNULL_PTR b);
33235
33236 /**
33237  * Serialize the PaymentParameters object into a byte array which can be read by PaymentParameters_read
33238  */
33239 struct LDKCVec_u8Z PaymentParameters_write(const struct LDKPaymentParameters *NONNULL_PTR obj);
33240
33241 /**
33242  * Read a PaymentParameters from a byte array, created by PaymentParameters_write
33243  */
33244 struct LDKCResult_PaymentParametersDecodeErrorZ PaymentParameters_read(struct LDKu8slice ser, uint32_t arg);
33245
33246 /**
33247  * Creates a payee with the node id of the given `pubkey`.
33248  *
33249  * The `final_cltv_expiry_delta` should match the expected final CLTV delta the recipient has
33250  * provided.
33251  */
33252 MUST_USE_RES struct LDKPaymentParameters PaymentParameters_from_node_id(struct LDKPublicKey payee_pubkey, uint32_t final_cltv_expiry_delta);
33253
33254 /**
33255  * Creates a payee with the node id of the given `pubkey` to use for keysend payments.
33256  *
33257  * The `final_cltv_expiry_delta` should match the expected final CLTV delta the recipient has
33258  * provided.
33259  */
33260 MUST_USE_RES struct LDKPaymentParameters PaymentParameters_for_keysend(struct LDKPublicKey payee_pubkey, uint32_t final_cltv_expiry_delta);
33261
33262 /**
33263  * Frees any resources used by the Hints
33264  */
33265 void Hints_free(struct LDKHints this_ptr);
33266
33267 /**
33268  * Creates a copy of the Hints
33269  */
33270 struct LDKHints Hints_clone(const struct LDKHints *NONNULL_PTR orig);
33271
33272 /**
33273  * Utility method to constructs a new Blinded-variant Hints
33274  */
33275 struct LDKHints Hints_blinded(struct LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ a);
33276
33277 /**
33278  * Utility method to constructs a new Clear-variant Hints
33279  */
33280 struct LDKHints Hints_clear(struct LDKCVec_RouteHintZ a);
33281
33282 /**
33283  * Generates a non-cryptographic 64-bit hash of the Hints.
33284  */
33285 uint64_t Hints_hash(const struct LDKHints *NONNULL_PTR o);
33286
33287 /**
33288  * Checks if two Hintss contain equal inner contents.
33289  * This ignores pointers and is_owned flags and looks at the values in fields.
33290  */
33291 bool Hints_eq(const struct LDKHints *NONNULL_PTR a, const struct LDKHints *NONNULL_PTR b);
33292
33293 /**
33294  * Frees any resources used by the RouteHint, if is_owned is set and inner is non-NULL.
33295  */
33296 void RouteHint_free(struct LDKRouteHint this_obj);
33297
33298 struct LDKCVec_RouteHintHopZ RouteHint_get_a(const struct LDKRouteHint *NONNULL_PTR this_ptr);
33299
33300 void RouteHint_set_a(struct LDKRouteHint *NONNULL_PTR this_ptr, struct LDKCVec_RouteHintHopZ val);
33301
33302 /**
33303  * Constructs a new RouteHint given each field
33304  */
33305 MUST_USE_RES struct LDKRouteHint RouteHint_new(struct LDKCVec_RouteHintHopZ a_arg);
33306
33307 /**
33308  * Creates a copy of the RouteHint
33309  */
33310 struct LDKRouteHint RouteHint_clone(const struct LDKRouteHint *NONNULL_PTR orig);
33311
33312 /**
33313  * Generates a non-cryptographic 64-bit hash of the RouteHint.
33314  */
33315 uint64_t RouteHint_hash(const struct LDKRouteHint *NONNULL_PTR o);
33316
33317 /**
33318  * Checks if two RouteHints contain equal inner contents.
33319  * This ignores pointers and is_owned flags and looks at the values in fields.
33320  * Two objects with NULL inner values will be considered "equal" here.
33321  */
33322 bool RouteHint_eq(const struct LDKRouteHint *NONNULL_PTR a, const struct LDKRouteHint *NONNULL_PTR b);
33323
33324 /**
33325  * Serialize the RouteHint object into a byte array which can be read by RouteHint_read
33326  */
33327 struct LDKCVec_u8Z RouteHint_write(const struct LDKRouteHint *NONNULL_PTR obj);
33328
33329 /**
33330  * Read a RouteHint from a byte array, created by RouteHint_write
33331  */
33332 struct LDKCResult_RouteHintDecodeErrorZ RouteHint_read(struct LDKu8slice ser);
33333
33334 /**
33335  * Frees any resources used by the RouteHintHop, if is_owned is set and inner is non-NULL.
33336  */
33337 void RouteHintHop_free(struct LDKRouteHintHop this_obj);
33338
33339 /**
33340  * The node_id of the non-target end of the route
33341  */
33342 struct LDKPublicKey RouteHintHop_get_src_node_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
33343
33344 /**
33345  * The node_id of the non-target end of the route
33346  */
33347 void RouteHintHop_set_src_node_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKPublicKey val);
33348
33349 /**
33350  * The short_channel_id of this channel
33351  */
33352 uint64_t RouteHintHop_get_short_channel_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
33353
33354 /**
33355  * The short_channel_id of this channel
33356  */
33357 void RouteHintHop_set_short_channel_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint64_t val);
33358
33359 /**
33360  * The fees which must be paid to use this channel
33361  */
33362 struct LDKRoutingFees RouteHintHop_get_fees(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
33363
33364 /**
33365  * The fees which must be paid to use this channel
33366  */
33367 void RouteHintHop_set_fees(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
33368
33369 /**
33370  * The difference in CLTV values between this node and the next node.
33371  */
33372 uint16_t RouteHintHop_get_cltv_expiry_delta(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
33373
33374 /**
33375  * The difference in CLTV values between this node and the next node.
33376  */
33377 void RouteHintHop_set_cltv_expiry_delta(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint16_t val);
33378
33379 /**
33380  * The minimum value, in msat, which must be relayed to the next hop.
33381  */
33382 struct LDKCOption_u64Z RouteHintHop_get_htlc_minimum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
33383
33384 /**
33385  * The minimum value, in msat, which must be relayed to the next hop.
33386  */
33387 void RouteHintHop_set_htlc_minimum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
33388
33389 /**
33390  * The maximum value in msat available for routing with a single HTLC.
33391  */
33392 struct LDKCOption_u64Z RouteHintHop_get_htlc_maximum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
33393
33394 /**
33395  * The maximum value in msat available for routing with a single HTLC.
33396  */
33397 void RouteHintHop_set_htlc_maximum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
33398
33399 /**
33400  * Constructs a new RouteHintHop given each field
33401  */
33402 MUST_USE_RES struct LDKRouteHintHop RouteHintHop_new(struct LDKPublicKey src_node_id_arg, uint64_t short_channel_id_arg, struct LDKRoutingFees fees_arg, uint16_t cltv_expiry_delta_arg, struct LDKCOption_u64Z htlc_minimum_msat_arg, struct LDKCOption_u64Z htlc_maximum_msat_arg);
33403
33404 /**
33405  * Creates a copy of the RouteHintHop
33406  */
33407 struct LDKRouteHintHop RouteHintHop_clone(const struct LDKRouteHintHop *NONNULL_PTR orig);
33408
33409 /**
33410  * Generates a non-cryptographic 64-bit hash of the RouteHintHop.
33411  */
33412 uint64_t RouteHintHop_hash(const struct LDKRouteHintHop *NONNULL_PTR o);
33413
33414 /**
33415  * Checks if two RouteHintHops contain equal inner contents.
33416  * This ignores pointers and is_owned flags and looks at the values in fields.
33417  * Two objects with NULL inner values will be considered "equal" here.
33418  */
33419 bool RouteHintHop_eq(const struct LDKRouteHintHop *NONNULL_PTR a, const struct LDKRouteHintHop *NONNULL_PTR b);
33420
33421 /**
33422  * Serialize the RouteHintHop object into a byte array which can be read by RouteHintHop_read
33423  */
33424 struct LDKCVec_u8Z RouteHintHop_write(const struct LDKRouteHintHop *NONNULL_PTR obj);
33425
33426 /**
33427  * Read a RouteHintHop from a byte array, created by RouteHintHop_write
33428  */
33429 struct LDKCResult_RouteHintHopDecodeErrorZ RouteHintHop_read(struct LDKu8slice ser);
33430
33431 /**
33432  * Finds a route from us (payer) to the given target node (payee).
33433  *
33434  * If the payee provided features in their invoice, they should be provided via `params.payee`.
33435  * Without this, MPP will only be used if the payee's features are available in the network graph.
33436  *
33437  * Private routing paths between a public node and the target may be included in `params.payee`.
33438  *
33439  * If some channels aren't announced, it may be useful to fill in `first_hops` with the results
33440  * from [`ChannelManager::list_usable_channels`]. If it is filled in, the view of these channels
33441  * from `network_graph` will be ignored, and only those in `first_hops` will be used.
33442  *
33443  * The fees on channels from us to the next hop are ignored as they are assumed to all be equal.
33444  * However, the enabled/disabled bit on such channels as well as the `htlc_minimum_msat` /
33445  * `htlc_maximum_msat` *are* checked as they may change based on the receiving node.
33446  *
33447  * # Note
33448  *
33449  * May be used to re-compute a [`Route`] when handling a [`Event::PaymentPathFailed`]. Any
33450  * adjustments to the [`NetworkGraph`] and channel scores should be made prior to calling this
33451  * function.
33452  *
33453  * # Panics
33454  *
33455  * Panics if first_hops contains channels without short_channel_ids;
33456  * [`ChannelManager::list_usable_channels`] will never include such channels.
33457  *
33458  * [`ChannelManager::list_usable_channels`]: crate::ln::channelmanager::ChannelManager::list_usable_channels
33459  * [`Event::PaymentPathFailed`]: crate::events::Event::PaymentPathFailed
33460  * [`NetworkGraph`]: crate::routing::gossip::NetworkGraph
33461  *
33462  * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None
33463  */
33464 struct LDKCResult_RouteLightningErrorZ find_route(struct LDKPublicKey our_node_pubkey, const struct LDKRouteParameters *NONNULL_PTR route_params, const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKLogger logger, const struct LDKScore *NONNULL_PTR scorer, const uint8_t (*random_seed_bytes)[32]);
33465
33466 /**
33467  * Construct a route from us (payer) to the target node (payee) via the given hops (which should
33468  * exclude the payer, but include the payee). This may be useful, e.g., for probing the chosen path.
33469  *
33470  * Re-uses logic from `find_route`, so the restrictions described there also apply here.
33471  */
33472 struct LDKCResult_RouteLightningErrorZ build_route_from_hops(struct LDKPublicKey our_node_pubkey, struct LDKCVec_PublicKeyZ hops, const struct LDKRouteParameters *NONNULL_PTR route_params, const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKLogger logger, const uint8_t (*random_seed_bytes)[32]);
33473
33474 /**
33475  * Calls the free function if one is set
33476  */
33477 void Score_free(struct LDKScore this_ptr);
33478
33479 /**
33480  * Calls the free function if one is set
33481  */
33482 void LockableScore_free(struct LDKLockableScore this_ptr);
33483
33484 /**
33485  * Calls the free function if one is set
33486  */
33487 void WriteableScore_free(struct LDKWriteableScore this_ptr);
33488
33489 /**
33490  * Frees any resources used by the MultiThreadedLockableScore, if is_owned is set and inner is non-NULL.
33491  */
33492 void MultiThreadedLockableScore_free(struct LDKMultiThreadedLockableScore this_obj);
33493
33494 /**
33495  * Frees any resources used by the MultiThreadedScoreLock, if is_owned is set and inner is non-NULL.
33496  */
33497 void MultiThreadedScoreLock_free(struct LDKMultiThreadedScoreLock this_obj);
33498
33499 /**
33500  * Constructs a new Score which calls the relevant methods on this_arg.
33501  * This copies the `inner` pointer in this_arg and thus the returned Score must be freed before this_arg is
33502  */
33503 struct LDKScore MultiThreadedScoreLock_as_Score(const struct LDKMultiThreadedScoreLock *NONNULL_PTR this_arg);
33504
33505 /**
33506  * Serialize the MultiThreadedScoreLock object into a byte array which can be read by MultiThreadedScoreLock_read
33507  */
33508 struct LDKCVec_u8Z MultiThreadedScoreLock_write(const struct LDKMultiThreadedScoreLock *NONNULL_PTR obj);
33509
33510 /**
33511  * Constructs a new LockableScore which calls the relevant methods on this_arg.
33512  * This copies the `inner` pointer in this_arg and thus the returned LockableScore must be freed before this_arg is
33513  */
33514 struct LDKLockableScore MultiThreadedLockableScore_as_LockableScore(const struct LDKMultiThreadedLockableScore *NONNULL_PTR this_arg);
33515
33516 /**
33517  * Serialize the MultiThreadedLockableScore object into a byte array which can be read by MultiThreadedLockableScore_read
33518  */
33519 struct LDKCVec_u8Z MultiThreadedLockableScore_write(const struct LDKMultiThreadedLockableScore *NONNULL_PTR obj);
33520
33521 /**
33522  * Constructs a new WriteableScore which calls the relevant methods on this_arg.
33523  * This copies the `inner` pointer in this_arg and thus the returned WriteableScore must be freed before this_arg is
33524  */
33525 struct LDKWriteableScore MultiThreadedLockableScore_as_WriteableScore(const struct LDKMultiThreadedLockableScore *NONNULL_PTR this_arg);
33526
33527 /**
33528  * Creates a new [`MultiThreadedLockableScore`] given an underlying [`Score`].
33529  */
33530 MUST_USE_RES struct LDKMultiThreadedLockableScore MultiThreadedLockableScore_new(struct LDKScore score);
33531
33532 /**
33533  * Frees any resources used by the ChannelUsage, if is_owned is set and inner is non-NULL.
33534  */
33535 void ChannelUsage_free(struct LDKChannelUsage this_obj);
33536
33537 /**
33538  * The amount to send through the channel, denominated in millisatoshis.
33539  */
33540 uint64_t ChannelUsage_get_amount_msat(const struct LDKChannelUsage *NONNULL_PTR this_ptr);
33541
33542 /**
33543  * The amount to send through the channel, denominated in millisatoshis.
33544  */
33545 void ChannelUsage_set_amount_msat(struct LDKChannelUsage *NONNULL_PTR this_ptr, uint64_t val);
33546
33547 /**
33548  * Total amount, denominated in millisatoshis, already allocated to send through the channel
33549  * as part of a multi-path payment.
33550  */
33551 uint64_t ChannelUsage_get_inflight_htlc_msat(const struct LDKChannelUsage *NONNULL_PTR this_ptr);
33552
33553 /**
33554  * Total amount, denominated in millisatoshis, already allocated to send through the channel
33555  * as part of a multi-path payment.
33556  */
33557 void ChannelUsage_set_inflight_htlc_msat(struct LDKChannelUsage *NONNULL_PTR this_ptr, uint64_t val);
33558
33559 /**
33560  * The effective capacity of the channel.
33561  */
33562 struct LDKEffectiveCapacity ChannelUsage_get_effective_capacity(const struct LDKChannelUsage *NONNULL_PTR this_ptr);
33563
33564 /**
33565  * The effective capacity of the channel.
33566  */
33567 void ChannelUsage_set_effective_capacity(struct LDKChannelUsage *NONNULL_PTR this_ptr, struct LDKEffectiveCapacity val);
33568
33569 /**
33570  * Constructs a new ChannelUsage given each field
33571  */
33572 MUST_USE_RES struct LDKChannelUsage ChannelUsage_new(uint64_t amount_msat_arg, uint64_t inflight_htlc_msat_arg, struct LDKEffectiveCapacity effective_capacity_arg);
33573
33574 /**
33575  * Creates a copy of the ChannelUsage
33576  */
33577 struct LDKChannelUsage ChannelUsage_clone(const struct LDKChannelUsage *NONNULL_PTR orig);
33578
33579 /**
33580  * Frees any resources used by the FixedPenaltyScorer, if is_owned is set and inner is non-NULL.
33581  */
33582 void FixedPenaltyScorer_free(struct LDKFixedPenaltyScorer this_obj);
33583
33584 /**
33585  * Creates a copy of the FixedPenaltyScorer
33586  */
33587 struct LDKFixedPenaltyScorer FixedPenaltyScorer_clone(const struct LDKFixedPenaltyScorer *NONNULL_PTR orig);
33588
33589 /**
33590  * Creates a new scorer using `penalty_msat`.
33591  */
33592 MUST_USE_RES struct LDKFixedPenaltyScorer FixedPenaltyScorer_with_penalty(uint64_t penalty_msat);
33593
33594 /**
33595  * Constructs a new Score which calls the relevant methods on this_arg.
33596  * This copies the `inner` pointer in this_arg and thus the returned Score must be freed before this_arg is
33597  */
33598 struct LDKScore FixedPenaltyScorer_as_Score(const struct LDKFixedPenaltyScorer *NONNULL_PTR this_arg);
33599
33600 /**
33601  * Serialize the FixedPenaltyScorer object into a byte array which can be read by FixedPenaltyScorer_read
33602  */
33603 struct LDKCVec_u8Z FixedPenaltyScorer_write(const struct LDKFixedPenaltyScorer *NONNULL_PTR obj);
33604
33605 /**
33606  * Read a FixedPenaltyScorer from a byte array, created by FixedPenaltyScorer_write
33607  */
33608 struct LDKCResult_FixedPenaltyScorerDecodeErrorZ FixedPenaltyScorer_read(struct LDKu8slice ser, uint64_t arg);
33609
33610 /**
33611  * Frees any resources used by the ProbabilisticScorer, if is_owned is set and inner is non-NULL.
33612  */
33613 void ProbabilisticScorer_free(struct LDKProbabilisticScorer this_obj);
33614
33615 /**
33616  * Frees any resources used by the ProbabilisticScoringParameters, if is_owned is set and inner is non-NULL.
33617  */
33618 void ProbabilisticScoringParameters_free(struct LDKProbabilisticScoringParameters this_obj);
33619
33620 /**
33621  * A fixed penalty in msats to apply to each channel.
33622  *
33623  * Default value: 500 msat
33624  */
33625 uint64_t ProbabilisticScoringParameters_get_base_penalty_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr);
33626
33627 /**
33628  * A fixed penalty in msats to apply to each channel.
33629  *
33630  * Default value: 500 msat
33631  */
33632 void ProbabilisticScoringParameters_set_base_penalty_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
33633
33634 /**
33635  * A multiplier used with the payment amount to calculate a fixed penalty applied to each
33636  * channel, in excess of the [`base_penalty_msat`].
33637  *
33638  * The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e.,
33639  * fees plus penalty) for large payments. The penalty is computed as the product of this
33640  * multiplier and `2^30`ths of the payment amount.
33641  *
33642  * ie `base_penalty_amount_multiplier_msat * amount_msat / 2^30`
33643  *
33644  * Default value: 8,192 msat
33645  *
33646  * [`base_penalty_msat`]: Self::base_penalty_msat
33647  */
33648 uint64_t ProbabilisticScoringParameters_get_base_penalty_amount_multiplier_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr);
33649
33650 /**
33651  * A multiplier used with the payment amount to calculate a fixed penalty applied to each
33652  * channel, in excess of the [`base_penalty_msat`].
33653  *
33654  * The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e.,
33655  * fees plus penalty) for large payments. The penalty is computed as the product of this
33656  * multiplier and `2^30`ths of the payment amount.
33657  *
33658  * ie `base_penalty_amount_multiplier_msat * amount_msat / 2^30`
33659  *
33660  * Default value: 8,192 msat
33661  *
33662  * [`base_penalty_msat`]: Self::base_penalty_msat
33663  */
33664 void ProbabilisticScoringParameters_set_base_penalty_amount_multiplier_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
33665
33666 /**
33667  * A multiplier used in conjunction with the negative `log10` of the channel's success
33668  * probability for a payment, as determined by our latest estimates of the channel's
33669  * liquidity, to determine the liquidity penalty.
33670  *
33671  * The penalty is based in part on the knowledge learned from prior successful and unsuccessful
33672  * payments. This knowledge is decayed over time based on [`liquidity_offset_half_life`]. The
33673  * penalty is effectively limited to `2 * liquidity_penalty_multiplier_msat` (corresponding to
33674  * lower bounding the success probability to `0.01`) when the amount falls within the
33675  * uncertainty bounds of the channel liquidity balance. Amounts above the upper bound will
33676  * result in a `u64::max_value` penalty, however.
33677  *
33678  * `-log10(success_probability) * liquidity_penalty_multiplier_msat`
33679  *
33680  * Default value: 30,000 msat
33681  *
33682  * [`liquidity_offset_half_life`]: Self::liquidity_offset_half_life
33683  */
33684 uint64_t ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr);
33685
33686 /**
33687  * A multiplier used in conjunction with the negative `log10` of the channel's success
33688  * probability for a payment, as determined by our latest estimates of the channel's
33689  * liquidity, to determine the liquidity penalty.
33690  *
33691  * The penalty is based in part on the knowledge learned from prior successful and unsuccessful
33692  * payments. This knowledge is decayed over time based on [`liquidity_offset_half_life`]. The
33693  * penalty is effectively limited to `2 * liquidity_penalty_multiplier_msat` (corresponding to
33694  * lower bounding the success probability to `0.01`) when the amount falls within the
33695  * uncertainty bounds of the channel liquidity balance. Amounts above the upper bound will
33696  * result in a `u64::max_value` penalty, however.
33697  *
33698  * `-log10(success_probability) * liquidity_penalty_multiplier_msat`
33699  *
33700  * Default value: 30,000 msat
33701  *
33702  * [`liquidity_offset_half_life`]: Self::liquidity_offset_half_life
33703  */
33704 void ProbabilisticScoringParameters_set_liquidity_penalty_multiplier_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
33705
33706 /**
33707  * Whenever this amount of time elapses since the last update to a channel's liquidity bounds,
33708  * the distance from the bounds to \"zero\" is cut in half. In other words, the lower-bound on
33709  * the available liquidity is halved and the upper-bound moves half-way to the channel's total
33710  * capacity.
33711  *
33712  * Because halving the liquidity bounds grows the uncertainty on the channel's liquidity,
33713  * the penalty for an amount within the new bounds may change. See the [`ProbabilisticScorer`]
33714  * struct documentation for more info on the way the liquidity bounds are used.
33715  *
33716  * For example, if the channel's capacity is 1 million sats, and the current upper and lower
33717  * liquidity bounds are 200,000 sats and 600,000 sats, after this amount of time the upper
33718  * and lower liquidity bounds will be decayed to 100,000 and 800,000 sats.
33719  *
33720  * Default value: 6 hours
33721  *
33722  * # Note
33723  *
33724  * When built with the `no-std` feature, time will never elapse. Therefore, the channel
33725  * liquidity knowledge will never decay except when the bounds cross.
33726  */
33727 uint64_t ProbabilisticScoringParameters_get_liquidity_offset_half_life(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr);
33728
33729 /**
33730  * Whenever this amount of time elapses since the last update to a channel's liquidity bounds,
33731  * the distance from the bounds to \"zero\" is cut in half. In other words, the lower-bound on
33732  * the available liquidity is halved and the upper-bound moves half-way to the channel's total
33733  * capacity.
33734  *
33735  * Because halving the liquidity bounds grows the uncertainty on the channel's liquidity,
33736  * the penalty for an amount within the new bounds may change. See the [`ProbabilisticScorer`]
33737  * struct documentation for more info on the way the liquidity bounds are used.
33738  *
33739  * For example, if the channel's capacity is 1 million sats, and the current upper and lower
33740  * liquidity bounds are 200,000 sats and 600,000 sats, after this amount of time the upper
33741  * and lower liquidity bounds will be decayed to 100,000 and 800,000 sats.
33742  *
33743  * Default value: 6 hours
33744  *
33745  * # Note
33746  *
33747  * When built with the `no-std` feature, time will never elapse. Therefore, the channel
33748  * liquidity knowledge will never decay except when the bounds cross.
33749  */
33750 void ProbabilisticScoringParameters_set_liquidity_offset_half_life(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
33751
33752 /**
33753  * A multiplier used in conjunction with a payment amount and the negative `log10` of the
33754  * channel's success probability for the payment, as determined by our latest estimates of the
33755  * channel's liquidity, to determine the amount penalty.
33756  *
33757  * The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e.,
33758  * fees plus penalty) for large payments. The penalty is computed as the product of this
33759  * multiplier and `2^20`ths of the payment amount, weighted by the negative `log10` of the
33760  * success probability.
33761  *
33762  * `-log10(success_probability) * liquidity_penalty_amount_multiplier_msat * amount_msat / 2^20`
33763  *
33764  * In practice, this means for 0.1 success probability (`-log10(0.1) == 1`) each `2^20`th of
33765  * the amount will result in a penalty of the multiplier. And, as the success probability
33766  * decreases, the negative `log10` weighting will increase dramatically. For higher success
33767  * probabilities, the multiplier will have a decreasing effect as the negative `log10` will
33768  * fall below `1`.
33769  *
33770  * Default value: 192 msat
33771  */
33772 uint64_t ProbabilisticScoringParameters_get_liquidity_penalty_amount_multiplier_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr);
33773
33774 /**
33775  * A multiplier used in conjunction with a payment amount and the negative `log10` of the
33776  * channel's success probability for the payment, as determined by our latest estimates of the
33777  * channel's liquidity, to determine the amount penalty.
33778  *
33779  * The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e.,
33780  * fees plus penalty) for large payments. The penalty is computed as the product of this
33781  * multiplier and `2^20`ths of the payment amount, weighted by the negative `log10` of the
33782  * success probability.
33783  *
33784  * `-log10(success_probability) * liquidity_penalty_amount_multiplier_msat * amount_msat / 2^20`
33785  *
33786  * In practice, this means for 0.1 success probability (`-log10(0.1) == 1`) each `2^20`th of
33787  * the amount will result in a penalty of the multiplier. And, as the success probability
33788  * decreases, the negative `log10` weighting will increase dramatically. For higher success
33789  * probabilities, the multiplier will have a decreasing effect as the negative `log10` will
33790  * fall below `1`.
33791  *
33792  * Default value: 192 msat
33793  */
33794 void ProbabilisticScoringParameters_set_liquidity_penalty_amount_multiplier_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
33795
33796 /**
33797  * A multiplier used in conjunction with the negative `log10` of the channel's success
33798  * probability for the payment, as determined based on the history of our estimates of the
33799  * channel's available liquidity, to determine a penalty.
33800  *
33801  * This penalty is similar to [`liquidity_penalty_multiplier_msat`], however, instead of using
33802  * only our latest estimate for the current liquidity available in the channel, it estimates
33803  * success probability based on the estimated liquidity available in the channel through
33804  * history. Specifically, every time we update our liquidity bounds on a given channel, we
33805  * track which of several buckets those bounds fall into, exponentially decaying the
33806  * probability of each bucket as new samples are added.
33807  *
33808  * Default value: 10,000 msat
33809  *
33810  * [`liquidity_penalty_multiplier_msat`]: Self::liquidity_penalty_multiplier_msat
33811  */
33812 uint64_t ProbabilisticScoringParameters_get_historical_liquidity_penalty_multiplier_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr);
33813
33814 /**
33815  * A multiplier used in conjunction with the negative `log10` of the channel's success
33816  * probability for the payment, as determined based on the history of our estimates of the
33817  * channel's available liquidity, to determine a penalty.
33818  *
33819  * This penalty is similar to [`liquidity_penalty_multiplier_msat`], however, instead of using
33820  * only our latest estimate for the current liquidity available in the channel, it estimates
33821  * success probability based on the estimated liquidity available in the channel through
33822  * history. Specifically, every time we update our liquidity bounds on a given channel, we
33823  * track which of several buckets those bounds fall into, exponentially decaying the
33824  * probability of each bucket as new samples are added.
33825  *
33826  * Default value: 10,000 msat
33827  *
33828  * [`liquidity_penalty_multiplier_msat`]: Self::liquidity_penalty_multiplier_msat
33829  */
33830 void ProbabilisticScoringParameters_set_historical_liquidity_penalty_multiplier_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
33831
33832 /**
33833  * A multiplier used in conjunction with the payment amount and the negative `log10` of the
33834  * channel's success probability for the payment, as determined based on the history of our
33835  * estimates of the channel's available liquidity, to determine a penalty.
33836  *
33837  * The purpose of the amount penalty is to avoid having fees dominate the channel cost for
33838  * large payments. The penalty is computed as the product of this multiplier and the `2^20`ths
33839  * of the payment amount, weighted by the negative `log10` of the success probability.
33840  *
33841  * This penalty is similar to [`liquidity_penalty_amount_multiplier_msat`], however, instead
33842  * of using only our latest estimate for the current liquidity available in the channel, it
33843  * estimates success probability based on the estimated liquidity available in the channel
33844  * through history. Specifically, every time we update our liquidity bounds on a given
33845  * channel, we track which of several buckets those bounds fall into, exponentially decaying
33846  * the probability of each bucket as new samples are added.
33847  *
33848  * Default value: 64 msat
33849  *
33850  * [`liquidity_penalty_amount_multiplier_msat`]: Self::liquidity_penalty_amount_multiplier_msat
33851  */
33852 uint64_t ProbabilisticScoringParameters_get_historical_liquidity_penalty_amount_multiplier_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr);
33853
33854 /**
33855  * A multiplier used in conjunction with the payment amount and the negative `log10` of the
33856  * channel's success probability for the payment, as determined based on the history of our
33857  * estimates of the channel's available liquidity, to determine a penalty.
33858  *
33859  * The purpose of the amount penalty is to avoid having fees dominate the channel cost for
33860  * large payments. The penalty is computed as the product of this multiplier and the `2^20`ths
33861  * of the payment amount, weighted by the negative `log10` of the success probability.
33862  *
33863  * This penalty is similar to [`liquidity_penalty_amount_multiplier_msat`], however, instead
33864  * of using only our latest estimate for the current liquidity available in the channel, it
33865  * estimates success probability based on the estimated liquidity available in the channel
33866  * through history. Specifically, every time we update our liquidity bounds on a given
33867  * channel, we track which of several buckets those bounds fall into, exponentially decaying
33868  * the probability of each bucket as new samples are added.
33869  *
33870  * Default value: 64 msat
33871  *
33872  * [`liquidity_penalty_amount_multiplier_msat`]: Self::liquidity_penalty_amount_multiplier_msat
33873  */
33874 void ProbabilisticScoringParameters_set_historical_liquidity_penalty_amount_multiplier_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
33875
33876 /**
33877  * If we aren't learning any new datapoints for a channel, the historical liquidity bounds
33878  * tracking can simply live on with increasingly stale data. Instead, when a channel has not
33879  * seen a liquidity estimate update for this amount of time, the historical datapoints are
33880  * decayed by half.
33881  *
33882  * Note that after 16 or more half lives all historical data will be completely gone.
33883  *
33884  * Default value: 14 days
33885  */
33886 uint64_t ProbabilisticScoringParameters_get_historical_no_updates_half_life(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr);
33887
33888 /**
33889  * If we aren't learning any new datapoints for a channel, the historical liquidity bounds
33890  * tracking can simply live on with increasingly stale data. Instead, when a channel has not
33891  * seen a liquidity estimate update for this amount of time, the historical datapoints are
33892  * decayed by half.
33893  *
33894  * Note that after 16 or more half lives all historical data will be completely gone.
33895  *
33896  * Default value: 14 days
33897  */
33898 void ProbabilisticScoringParameters_set_historical_no_updates_half_life(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
33899
33900 /**
33901  * This penalty is applied when `htlc_maximum_msat` is equal to or larger than half of the
33902  * channel's capacity, which makes us prefer nodes with a smaller `htlc_maximum_msat`. We
33903  * treat such nodes preferentially as this makes balance discovery attacks harder to execute,
33904  * thereby creating an incentive to restrict `htlc_maximum_msat` and improve privacy.
33905  *
33906  * Default value: 250 msat
33907  */
33908 uint64_t ProbabilisticScoringParameters_get_anti_probing_penalty_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr);
33909
33910 /**
33911  * This penalty is applied when `htlc_maximum_msat` is equal to or larger than half of the
33912  * channel's capacity, which makes us prefer nodes with a smaller `htlc_maximum_msat`. We
33913  * treat such nodes preferentially as this makes balance discovery attacks harder to execute,
33914  * thereby creating an incentive to restrict `htlc_maximum_msat` and improve privacy.
33915  *
33916  * Default value: 250 msat
33917  */
33918 void ProbabilisticScoringParameters_set_anti_probing_penalty_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
33919
33920 /**
33921  * This penalty is applied when the amount we're attempting to send over a channel exceeds our
33922  * current estimate of the channel's available liquidity.
33923  *
33924  * Note that in this case all other penalties, including the
33925  * [`liquidity_penalty_multiplier_msat`] and [`liquidity_penalty_amount_multiplier_msat`]-based
33926  * penalties, as well as the [`base_penalty_msat`] and the [`anti_probing_penalty_msat`], if
33927  * applicable, are still included in the overall penalty.
33928  *
33929  * If you wish to avoid creating paths with such channels entirely, setting this to a value of
33930  * `u64::max_value()` will guarantee that.
33931  *
33932  * Default value: 1_0000_0000_000 msat (1 Bitcoin)
33933  *
33934  * [`liquidity_penalty_multiplier_msat`]: Self::liquidity_penalty_multiplier_msat
33935  * [`liquidity_penalty_amount_multiplier_msat`]: Self::liquidity_penalty_amount_multiplier_msat
33936  * [`base_penalty_msat`]: Self::base_penalty_msat
33937  * [`anti_probing_penalty_msat`]: Self::anti_probing_penalty_msat
33938  */
33939 uint64_t ProbabilisticScoringParameters_get_considered_impossible_penalty_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr);
33940
33941 /**
33942  * This penalty is applied when the amount we're attempting to send over a channel exceeds our
33943  * current estimate of the channel's available liquidity.
33944  *
33945  * Note that in this case all other penalties, including the
33946  * [`liquidity_penalty_multiplier_msat`] and [`liquidity_penalty_amount_multiplier_msat`]-based
33947  * penalties, as well as the [`base_penalty_msat`] and the [`anti_probing_penalty_msat`], if
33948  * applicable, are still included in the overall penalty.
33949  *
33950  * If you wish to avoid creating paths with such channels entirely, setting this to a value of
33951  * `u64::max_value()` will guarantee that.
33952  *
33953  * Default value: 1_0000_0000_000 msat (1 Bitcoin)
33954  *
33955  * [`liquidity_penalty_multiplier_msat`]: Self::liquidity_penalty_multiplier_msat
33956  * [`liquidity_penalty_amount_multiplier_msat`]: Self::liquidity_penalty_amount_multiplier_msat
33957  * [`base_penalty_msat`]: Self::base_penalty_msat
33958  * [`anti_probing_penalty_msat`]: Self::anti_probing_penalty_msat
33959  */
33960 void ProbabilisticScoringParameters_set_considered_impossible_penalty_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
33961
33962 /**
33963  * Creates a copy of the ProbabilisticScoringParameters
33964  */
33965 struct LDKProbabilisticScoringParameters ProbabilisticScoringParameters_clone(const struct LDKProbabilisticScoringParameters *NONNULL_PTR orig);
33966
33967 /**
33968  * Creates a new scorer using the given scoring parameters for sending payments from a node
33969  * through a network graph.
33970  */
33971 MUST_USE_RES struct LDKProbabilisticScorer ProbabilisticScorer_new(struct LDKProbabilisticScoringParameters params, const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKLogger logger);
33972
33973 /**
33974  * Dump the contents of this scorer into the configured logger.
33975  *
33976  * Note that this writes roughly one line per channel for which we have a liquidity estimate,
33977  * which may be a substantial amount of log output.
33978  */
33979 void ProbabilisticScorer_debug_log_liquidity_stats(const struct LDKProbabilisticScorer *NONNULL_PTR this_arg);
33980
33981 /**
33982  * Query the estimated minimum and maximum liquidity available for sending a payment over the
33983  * channel with `scid` towards the given `target` node.
33984  */
33985 MUST_USE_RES struct LDKCOption_C2Tuple_u64u64ZZ ProbabilisticScorer_estimated_channel_liquidity_range(const struct LDKProbabilisticScorer *NONNULL_PTR this_arg, uint64_t scid, const struct LDKNodeId *NONNULL_PTR target);
33986
33987 /**
33988  * Query the historical estimated minimum and maximum liquidity available for sending a
33989  * payment over the channel with `scid` towards the given `target` node.
33990  *
33991  * Returns two sets of 8 buckets. The first set describes the octiles for lower-bound
33992  * liquidity estimates, the second set describes the octiles for upper-bound liquidity
33993  * estimates. Each bucket describes the relative frequency at which we've seen a liquidity
33994  * bound in the octile relative to the channel's total capacity, on an arbitrary scale.
33995  * Because the values are slowly decayed, more recent data points are weighted more heavily
33996  * than older datapoints.
33997  *
33998  * When scoring, the estimated probability that an upper-/lower-bound lies in a given octile
33999  * relative to the channel's total capacity is calculated by dividing that bucket's value with
34000  * the total of all buckets for the given bound.
34001  *
34002  * For example, a value of `[0, 0, 0, 0, 0, 0, 32]` indicates that we believe the probability
34003  * of a bound being in the top octile to be 100%, and have never (recently) seen it in any
34004  * other octiles. A value of `[31, 0, 0, 0, 0, 0, 0, 32]` indicates we've seen the bound being
34005  * both in the top and bottom octile, and roughly with similar (recent) frequency.
34006  *
34007  * Because the datapoints are decayed slowly over time, values will eventually return to
34008  * `Some(([0; 8], [0; 8]))`.
34009  */
34010 MUST_USE_RES struct LDKCOption_C2Tuple_EightU16sEightU16sZZ ProbabilisticScorer_historical_estimated_channel_liquidity_probabilities(const struct LDKProbabilisticScorer *NONNULL_PTR this_arg, uint64_t scid, const struct LDKNodeId *NONNULL_PTR target);
34011
34012 /**
34013  * Marks the node with the given `node_id` as banned, i.e.,
34014  * it will be avoided during path finding.
34015  */
34016 void ProbabilisticScorer_add_banned(struct LDKProbabilisticScorer *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR node_id);
34017
34018 /**
34019  * Removes the node with the given `node_id` from the list of nodes to avoid.
34020  */
34021 void ProbabilisticScorer_remove_banned(struct LDKProbabilisticScorer *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR node_id);
34022
34023 /**
34024  * Sets a manual penalty for the given node.
34025  */
34026 void ProbabilisticScorer_set_manual_penalty(struct LDKProbabilisticScorer *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR node_id, uint64_t penalty);
34027
34028 /**
34029  * Removes the node with the given `node_id` from the list of manual penalties.
34030  */
34031 void ProbabilisticScorer_remove_manual_penalty(struct LDKProbabilisticScorer *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR node_id);
34032
34033 /**
34034  * Clears the list of manual penalties that are applied during path finding.
34035  */
34036 void ProbabilisticScorer_clear_manual_penalties(struct LDKProbabilisticScorer *NONNULL_PTR this_arg);
34037
34038 /**
34039  * Marks all nodes in the given list as banned, i.e.,
34040  * they will be avoided during path finding.
34041  */
34042 void ProbabilisticScoringParameters_add_banned_from_list(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_arg, struct LDKCVec_NodeIdZ node_ids);
34043
34044 /**
34045  * Creates a "default" ProbabilisticScoringParameters. See struct and individual field documentaiton for details on which values are used.
34046  */
34047 MUST_USE_RES struct LDKProbabilisticScoringParameters ProbabilisticScoringParameters_default(void);
34048
34049 /**
34050  * Constructs a new Score which calls the relevant methods on this_arg.
34051  * This copies the `inner` pointer in this_arg and thus the returned Score must be freed before this_arg is
34052  */
34053 struct LDKScore ProbabilisticScorer_as_Score(const struct LDKProbabilisticScorer *NONNULL_PTR this_arg);
34054
34055 /**
34056  * Serialize the ProbabilisticScorer object into a byte array which can be read by ProbabilisticScorer_read
34057  */
34058 struct LDKCVec_u8Z ProbabilisticScorer_write(const struct LDKProbabilisticScorer *NONNULL_PTR obj);
34059
34060 /**
34061  * Read a ProbabilisticScorer from a byte array, created by ProbabilisticScorer_write
34062  */
34063 struct LDKCResult_ProbabilisticScorerDecodeErrorZ ProbabilisticScorer_read(struct LDKu8slice ser, struct LDKProbabilisticScoringParameters arg_a, const struct LDKNetworkGraph *NONNULL_PTR arg_b, struct LDKLogger arg_c);
34064
34065 /**
34066  * Frees any resources used by the OnionMessenger, if is_owned is set and inner is non-NULL.
34067  */
34068 void OnionMessenger_free(struct LDKOnionMessenger this_obj);
34069
34070 /**
34071  * Frees any resources used by the Destination
34072  */
34073 void Destination_free(struct LDKDestination this_ptr);
34074
34075 /**
34076  * Creates a copy of the Destination
34077  */
34078 struct LDKDestination Destination_clone(const struct LDKDestination *NONNULL_PTR orig);
34079
34080 /**
34081  * Utility method to constructs a new Node-variant Destination
34082  */
34083 struct LDKDestination Destination_node(struct LDKPublicKey a);
34084
34085 /**
34086  * Utility method to constructs a new BlindedPath-variant Destination
34087  */
34088 struct LDKDestination Destination_blinded_path(struct LDKBlindedPath a);
34089
34090 /**
34091  * Frees any resources used by the SendError
34092  */
34093 void SendError_free(struct LDKSendError this_ptr);
34094
34095 /**
34096  * Creates a copy of the SendError
34097  */
34098 struct LDKSendError SendError_clone(const struct LDKSendError *NONNULL_PTR orig);
34099
34100 /**
34101  * Utility method to constructs a new Secp256k1-variant SendError
34102  */
34103 struct LDKSendError SendError_secp256k1(enum LDKSecp256k1Error a);
34104
34105 /**
34106  * Utility method to constructs a new TooBigPacket-variant SendError
34107  */
34108 struct LDKSendError SendError_too_big_packet(void);
34109
34110 /**
34111  * Utility method to constructs a new TooFewBlindedHops-variant SendError
34112  */
34113 struct LDKSendError SendError_too_few_blinded_hops(void);
34114
34115 /**
34116  * Utility method to constructs a new InvalidFirstHop-variant SendError
34117  */
34118 struct LDKSendError SendError_invalid_first_hop(void);
34119
34120 /**
34121  * Utility method to constructs a new InvalidMessage-variant SendError
34122  */
34123 struct LDKSendError SendError_invalid_message(void);
34124
34125 /**
34126  * Utility method to constructs a new BufferFull-variant SendError
34127  */
34128 struct LDKSendError SendError_buffer_full(void);
34129
34130 /**
34131  * Utility method to constructs a new GetNodeIdFailed-variant SendError
34132  */
34133 struct LDKSendError SendError_get_node_id_failed(void);
34134
34135 /**
34136  * Utility method to constructs a new BlindedPathAdvanceFailed-variant SendError
34137  */
34138 struct LDKSendError SendError_blinded_path_advance_failed(void);
34139
34140 /**
34141  * Checks if two SendErrors contain equal inner contents.
34142  * This ignores pointers and is_owned flags and looks at the values in fields.
34143  */
34144 bool SendError_eq(const struct LDKSendError *NONNULL_PTR a, const struct LDKSendError *NONNULL_PTR b);
34145
34146 /**
34147  * Calls the free function if one is set
34148  */
34149 void CustomOnionMessageHandler_free(struct LDKCustomOnionMessageHandler this_ptr);
34150
34151 /**
34152  * Constructs a new `OnionMessenger` to send, forward, and delegate received onion messages to
34153  * their respective handlers.
34154  */
34155 MUST_USE_RES struct LDKOnionMessenger OnionMessenger_new(struct LDKEntropySource entropy_source, struct LDKNodeSigner node_signer, struct LDKLogger logger, struct LDKCustomOnionMessageHandler custom_handler);
34156
34157 /**
34158  * Send an onion message with contents `message` to `destination`, routing it through `intermediate_nodes`.
34159  * See [`OnionMessenger`] for example usage.
34160  *
34161  * Note that reply_path (or a relevant inner pointer) may be NULL or all-0s to represent None
34162  */
34163 MUST_USE_RES struct LDKCResult_NoneSendErrorZ OnionMessenger_send_onion_message(const struct LDKOnionMessenger *NONNULL_PTR this_arg, struct LDKCVec_PublicKeyZ intermediate_nodes, struct LDKDestination destination, struct LDKOnionMessageContents message, struct LDKBlindedPath reply_path);
34164
34165 /**
34166  * Constructs a new OnionMessageHandler which calls the relevant methods on this_arg.
34167  * This copies the `inner` pointer in this_arg and thus the returned OnionMessageHandler must be freed before this_arg is
34168  */
34169 struct LDKOnionMessageHandler OnionMessenger_as_OnionMessageHandler(const struct LDKOnionMessenger *NONNULL_PTR this_arg);
34170
34171 /**
34172  * Constructs a new OnionMessageProvider which calls the relevant methods on this_arg.
34173  * This copies the `inner` pointer in this_arg and thus the returned OnionMessageProvider must be freed before this_arg is
34174  */
34175 struct LDKOnionMessageProvider OnionMessenger_as_OnionMessageProvider(const struct LDKOnionMessenger *NONNULL_PTR this_arg);
34176
34177 /**
34178  * Frees any resources used by the OnionMessageContents
34179  */
34180 void OnionMessageContents_free(struct LDKOnionMessageContents this_ptr);
34181
34182 /**
34183  * Utility method to constructs a new Custom-variant OnionMessageContents
34184  */
34185 struct LDKOnionMessageContents OnionMessageContents_custom(struct LDKCustomOnionMessageContents a);
34186
34187 /**
34188  * Calls the free function if one is set
34189  */
34190 void CustomOnionMessageContents_free(struct LDKCustomOnionMessageContents this_ptr);
34191
34192 /**
34193  * Frees any resources used by the BlindedPath, if is_owned is set and inner is non-NULL.
34194  */
34195 void BlindedPath_free(struct LDKBlindedPath this_obj);
34196
34197 /**
34198  * Creates a copy of the BlindedPath
34199  */
34200 struct LDKBlindedPath BlindedPath_clone(const struct LDKBlindedPath *NONNULL_PTR orig);
34201
34202 /**
34203  * Generates a non-cryptographic 64-bit hash of the BlindedPath.
34204  */
34205 uint64_t BlindedPath_hash(const struct LDKBlindedPath *NONNULL_PTR o);
34206
34207 /**
34208  * Checks if two BlindedPaths contain equal inner contents.
34209  * This ignores pointers and is_owned flags and looks at the values in fields.
34210  * Two objects with NULL inner values will be considered "equal" here.
34211  */
34212 bool BlindedPath_eq(const struct LDKBlindedPath *NONNULL_PTR a, const struct LDKBlindedPath *NONNULL_PTR b);
34213
34214 /**
34215  * Frees any resources used by the BlindedHop, if is_owned is set and inner is non-NULL.
34216  */
34217 void BlindedHop_free(struct LDKBlindedHop this_obj);
34218
34219 /**
34220  * Creates a copy of the BlindedHop
34221  */
34222 struct LDKBlindedHop BlindedHop_clone(const struct LDKBlindedHop *NONNULL_PTR orig);
34223
34224 /**
34225  * Generates a non-cryptographic 64-bit hash of the BlindedHop.
34226  */
34227 uint64_t BlindedHop_hash(const struct LDKBlindedHop *NONNULL_PTR o);
34228
34229 /**
34230  * Checks if two BlindedHops contain equal inner contents.
34231  * This ignores pointers and is_owned flags and looks at the values in fields.
34232  * Two objects with NULL inner values will be considered "equal" here.
34233  */
34234 bool BlindedHop_eq(const struct LDKBlindedHop *NONNULL_PTR a, const struct LDKBlindedHop *NONNULL_PTR b);
34235
34236 /**
34237  * Create a blinded path for an onion message, to be forwarded along `node_pks`. The last node
34238  * pubkey in `node_pks` will be the destination node.
34239  *
34240  * Errors if less than two hops are provided or if `node_pk`(s) are invalid.
34241  */
34242 MUST_USE_RES struct LDKCResult_BlindedPathNoneZ BlindedPath_new_for_message(struct LDKCVec_PublicKeyZ node_pks, const struct LDKEntropySource *NONNULL_PTR entropy_source);
34243
34244 /**
34245  * Serialize the BlindedPath object into a byte array which can be read by BlindedPath_read
34246  */
34247 struct LDKCVec_u8Z BlindedPath_write(const struct LDKBlindedPath *NONNULL_PTR obj);
34248
34249 /**
34250  * Read a BlindedPath from a byte array, created by BlindedPath_write
34251  */
34252 struct LDKCResult_BlindedPathDecodeErrorZ BlindedPath_read(struct LDKu8slice ser);
34253
34254 /**
34255  * Serialize the BlindedHop object into a byte array which can be read by BlindedHop_read
34256  */
34257 struct LDKCVec_u8Z BlindedHop_write(const struct LDKBlindedHop *NONNULL_PTR obj);
34258
34259 /**
34260  * Read a BlindedHop from a byte array, created by BlindedHop_write
34261  */
34262 struct LDKCResult_BlindedHopDecodeErrorZ BlindedHop_read(struct LDKu8slice ser);
34263
34264 /**
34265  * Frees any resources used by the PaymentPurpose
34266  */
34267 void PaymentPurpose_free(struct LDKPaymentPurpose this_ptr);
34268
34269 /**
34270  * Creates a copy of the PaymentPurpose
34271  */
34272 struct LDKPaymentPurpose PaymentPurpose_clone(const struct LDKPaymentPurpose *NONNULL_PTR orig);
34273
34274 /**
34275  * Utility method to constructs a new InvoicePayment-variant PaymentPurpose
34276  */
34277 struct LDKPaymentPurpose PaymentPurpose_invoice_payment(struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_secret);
34278
34279 /**
34280  * Utility method to constructs a new SpontaneousPayment-variant PaymentPurpose
34281  */
34282 struct LDKPaymentPurpose PaymentPurpose_spontaneous_payment(struct LDKThirtyTwoBytes a);
34283
34284 /**
34285  * Checks if two PaymentPurposes contain equal inner contents.
34286  * This ignores pointers and is_owned flags and looks at the values in fields.
34287  */
34288 bool PaymentPurpose_eq(const struct LDKPaymentPurpose *NONNULL_PTR a, const struct LDKPaymentPurpose *NONNULL_PTR b);
34289
34290 /**
34291  * Serialize the PaymentPurpose object into a byte array which can be read by PaymentPurpose_read
34292  */
34293 struct LDKCVec_u8Z PaymentPurpose_write(const struct LDKPaymentPurpose *NONNULL_PTR obj);
34294
34295 /**
34296  * Read a PaymentPurpose from a byte array, created by PaymentPurpose_write
34297  */
34298 struct LDKCResult_PaymentPurposeDecodeErrorZ PaymentPurpose_read(struct LDKu8slice ser);
34299
34300 /**
34301  * Frees any resources used by the PathFailure
34302  */
34303 void PathFailure_free(struct LDKPathFailure this_ptr);
34304
34305 /**
34306  * Creates a copy of the PathFailure
34307  */
34308 struct LDKPathFailure PathFailure_clone(const struct LDKPathFailure *NONNULL_PTR orig);
34309
34310 /**
34311  * Utility method to constructs a new InitialSend-variant PathFailure
34312  */
34313 struct LDKPathFailure PathFailure_initial_send(struct LDKAPIError err);
34314
34315 /**
34316  * Utility method to constructs a new OnPath-variant PathFailure
34317  */
34318 struct LDKPathFailure PathFailure_on_path(struct LDKCOption_NetworkUpdateZ network_update);
34319
34320 /**
34321  * Checks if two PathFailures contain equal inner contents.
34322  * This ignores pointers and is_owned flags and looks at the values in fields.
34323  */
34324 bool PathFailure_eq(const struct LDKPathFailure *NONNULL_PTR a, const struct LDKPathFailure *NONNULL_PTR b);
34325
34326 /**
34327  * Serialize the PathFailure object into a byte array which can be read by PathFailure_read
34328  */
34329 struct LDKCVec_u8Z PathFailure_write(const struct LDKPathFailure *NONNULL_PTR obj);
34330
34331 /**
34332  * Read a PathFailure from a byte array, created by PathFailure_write
34333  */
34334 struct LDKCResult_COption_PathFailureZDecodeErrorZ PathFailure_read(struct LDKu8slice ser);
34335
34336 /**
34337  * Frees any resources used by the ClosureReason
34338  */
34339 void ClosureReason_free(struct LDKClosureReason this_ptr);
34340
34341 /**
34342  * Creates a copy of the ClosureReason
34343  */
34344 struct LDKClosureReason ClosureReason_clone(const struct LDKClosureReason *NONNULL_PTR orig);
34345
34346 /**
34347  * Utility method to constructs a new CounterpartyForceClosed-variant ClosureReason
34348  */
34349 struct LDKClosureReason ClosureReason_counterparty_force_closed(struct LDKUntrustedString peer_msg);
34350
34351 /**
34352  * Utility method to constructs a new HolderForceClosed-variant ClosureReason
34353  */
34354 struct LDKClosureReason ClosureReason_holder_force_closed(void);
34355
34356 /**
34357  * Utility method to constructs a new CooperativeClosure-variant ClosureReason
34358  */
34359 struct LDKClosureReason ClosureReason_cooperative_closure(void);
34360
34361 /**
34362  * Utility method to constructs a new CommitmentTxConfirmed-variant ClosureReason
34363  */
34364 struct LDKClosureReason ClosureReason_commitment_tx_confirmed(void);
34365
34366 /**
34367  * Utility method to constructs a new FundingTimedOut-variant ClosureReason
34368  */
34369 struct LDKClosureReason ClosureReason_funding_timed_out(void);
34370
34371 /**
34372  * Utility method to constructs a new ProcessingError-variant ClosureReason
34373  */
34374 struct LDKClosureReason ClosureReason_processing_error(struct LDKStr err);
34375
34376 /**
34377  * Utility method to constructs a new DisconnectedPeer-variant ClosureReason
34378  */
34379 struct LDKClosureReason ClosureReason_disconnected_peer(void);
34380
34381 /**
34382  * Utility method to constructs a new OutdatedChannelManager-variant ClosureReason
34383  */
34384 struct LDKClosureReason ClosureReason_outdated_channel_manager(void);
34385
34386 /**
34387  * Checks if two ClosureReasons contain equal inner contents.
34388  * This ignores pointers and is_owned flags and looks at the values in fields.
34389  */
34390 bool ClosureReason_eq(const struct LDKClosureReason *NONNULL_PTR a, const struct LDKClosureReason *NONNULL_PTR b);
34391
34392 /**
34393  * Serialize the ClosureReason object into a byte array which can be read by ClosureReason_read
34394  */
34395 struct LDKCVec_u8Z ClosureReason_write(const struct LDKClosureReason *NONNULL_PTR obj);
34396
34397 /**
34398  * Read a ClosureReason from a byte array, created by ClosureReason_write
34399  */
34400 struct LDKCResult_COption_ClosureReasonZDecodeErrorZ ClosureReason_read(struct LDKu8slice ser);
34401
34402 /**
34403  * Frees any resources used by the HTLCDestination
34404  */
34405 void HTLCDestination_free(struct LDKHTLCDestination this_ptr);
34406
34407 /**
34408  * Creates a copy of the HTLCDestination
34409  */
34410 struct LDKHTLCDestination HTLCDestination_clone(const struct LDKHTLCDestination *NONNULL_PTR orig);
34411
34412 /**
34413  * Utility method to constructs a new NextHopChannel-variant HTLCDestination
34414  */
34415 struct LDKHTLCDestination HTLCDestination_next_hop_channel(struct LDKPublicKey node_id, struct LDKThirtyTwoBytes channel_id);
34416
34417 /**
34418  * Utility method to constructs a new UnknownNextHop-variant HTLCDestination
34419  */
34420 struct LDKHTLCDestination HTLCDestination_unknown_next_hop(uint64_t requested_forward_scid);
34421
34422 /**
34423  * Utility method to constructs a new InvalidForward-variant HTLCDestination
34424  */
34425 struct LDKHTLCDestination HTLCDestination_invalid_forward(uint64_t requested_forward_scid);
34426
34427 /**
34428  * Utility method to constructs a new FailedPayment-variant HTLCDestination
34429  */
34430 struct LDKHTLCDestination HTLCDestination_failed_payment(struct LDKThirtyTwoBytes payment_hash);
34431
34432 /**
34433  * Checks if two HTLCDestinations contain equal inner contents.
34434  * This ignores pointers and is_owned flags and looks at the values in fields.
34435  */
34436 bool HTLCDestination_eq(const struct LDKHTLCDestination *NONNULL_PTR a, const struct LDKHTLCDestination *NONNULL_PTR b);
34437
34438 /**
34439  * Serialize the HTLCDestination object into a byte array which can be read by HTLCDestination_read
34440  */
34441 struct LDKCVec_u8Z HTLCDestination_write(const struct LDKHTLCDestination *NONNULL_PTR obj);
34442
34443 /**
34444  * Read a HTLCDestination from a byte array, created by HTLCDestination_write
34445  */
34446 struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ HTLCDestination_read(struct LDKu8slice ser);
34447
34448 /**
34449  * Creates a copy of the PaymentFailureReason
34450  */
34451 enum LDKPaymentFailureReason PaymentFailureReason_clone(const enum LDKPaymentFailureReason *NONNULL_PTR orig);
34452
34453 /**
34454  * Utility method to constructs a new RecipientRejected-variant PaymentFailureReason
34455  */
34456 enum LDKPaymentFailureReason PaymentFailureReason_recipient_rejected(void);
34457
34458 /**
34459  * Utility method to constructs a new UserAbandoned-variant PaymentFailureReason
34460  */
34461 enum LDKPaymentFailureReason PaymentFailureReason_user_abandoned(void);
34462
34463 /**
34464  * Utility method to constructs a new RetriesExhausted-variant PaymentFailureReason
34465  */
34466 enum LDKPaymentFailureReason PaymentFailureReason_retries_exhausted(void);
34467
34468 /**
34469  * Utility method to constructs a new PaymentExpired-variant PaymentFailureReason
34470  */
34471 enum LDKPaymentFailureReason PaymentFailureReason_payment_expired(void);
34472
34473 /**
34474  * Utility method to constructs a new RouteNotFound-variant PaymentFailureReason
34475  */
34476 enum LDKPaymentFailureReason PaymentFailureReason_route_not_found(void);
34477
34478 /**
34479  * Utility method to constructs a new UnexpectedError-variant PaymentFailureReason
34480  */
34481 enum LDKPaymentFailureReason PaymentFailureReason_unexpected_error(void);
34482
34483 /**
34484  * Checks if two PaymentFailureReasons contain equal inner contents.
34485  * This ignores pointers and is_owned flags and looks at the values in fields.
34486  */
34487 bool PaymentFailureReason_eq(const enum LDKPaymentFailureReason *NONNULL_PTR a, const enum LDKPaymentFailureReason *NONNULL_PTR b);
34488
34489 /**
34490  * Serialize the PaymentFailureReason object into a byte array which can be read by PaymentFailureReason_read
34491  */
34492 struct LDKCVec_u8Z PaymentFailureReason_write(const enum LDKPaymentFailureReason *NONNULL_PTR obj);
34493
34494 /**
34495  * Read a PaymentFailureReason from a byte array, created by PaymentFailureReason_write
34496  */
34497 struct LDKCResult_PaymentFailureReasonDecodeErrorZ PaymentFailureReason_read(struct LDKu8slice ser);
34498
34499 /**
34500  * Frees any resources used by the Event
34501  */
34502 void Event_free(struct LDKEvent this_ptr);
34503
34504 /**
34505  * Creates a copy of the Event
34506  */
34507 struct LDKEvent Event_clone(const struct LDKEvent *NONNULL_PTR orig);
34508
34509 /**
34510  * Utility method to constructs a new FundingGenerationReady-variant Event
34511  */
34512 struct LDKEvent Event_funding_generation_ready(struct LDKThirtyTwoBytes temporary_channel_id, struct LDKPublicKey counterparty_node_id, uint64_t channel_value_satoshis, struct LDKCVec_u8Z output_script, struct LDKU128 user_channel_id);
34513
34514 /**
34515  * Utility method to constructs a new PaymentClaimable-variant Event
34516  */
34517 struct LDKEvent Event_payment_claimable(struct LDKPublicKey receiver_node_id, struct LDKThirtyTwoBytes payment_hash, struct LDKRecipientOnionFields onion_fields, uint64_t amount_msat, struct LDKPaymentPurpose purpose, struct LDKThirtyTwoBytes via_channel_id, struct LDKCOption_u128Z via_user_channel_id, struct LDKCOption_u32Z claim_deadline);
34518
34519 /**
34520  * Utility method to constructs a new PaymentClaimed-variant Event
34521  */
34522 struct LDKEvent Event_payment_claimed(struct LDKPublicKey receiver_node_id, struct LDKThirtyTwoBytes payment_hash, uint64_t amount_msat, struct LDKPaymentPurpose purpose);
34523
34524 /**
34525  * Utility method to constructs a new PaymentSent-variant Event
34526  */
34527 struct LDKEvent Event_payment_sent(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_hash, struct LDKCOption_u64Z fee_paid_msat);
34528
34529 /**
34530  * Utility method to constructs a new PaymentFailed-variant Event
34531  */
34532 struct LDKEvent Event_payment_failed(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, struct LDKCOption_PaymentFailureReasonZ reason);
34533
34534 /**
34535  * Utility method to constructs a new PaymentPathSuccessful-variant Event
34536  */
34537 struct LDKEvent Event_payment_path_successful(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, struct LDKPath path);
34538
34539 /**
34540  * Utility method to constructs a new PaymentPathFailed-variant Event
34541  */
34542 struct LDKEvent Event_payment_path_failed(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, bool payment_failed_permanently, struct LDKPathFailure failure, struct LDKPath path, struct LDKCOption_u64Z short_channel_id);
34543
34544 /**
34545  * Utility method to constructs a new ProbeSuccessful-variant Event
34546  */
34547 struct LDKEvent Event_probe_successful(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, struct LDKPath path);
34548
34549 /**
34550  * Utility method to constructs a new ProbeFailed-variant Event
34551  */
34552 struct LDKEvent Event_probe_failed(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, struct LDKPath path, struct LDKCOption_u64Z short_channel_id);
34553
34554 /**
34555  * Utility method to constructs a new PendingHTLCsForwardable-variant Event
34556  */
34557 struct LDKEvent Event_pending_htlcs_forwardable(uint64_t time_forwardable);
34558
34559 /**
34560  * Utility method to constructs a new HTLCIntercepted-variant Event
34561  */
34562 struct LDKEvent Event_htlcintercepted(struct LDKThirtyTwoBytes intercept_id, uint64_t requested_next_hop_scid, struct LDKThirtyTwoBytes payment_hash, uint64_t inbound_amount_msat, uint64_t expected_outbound_amount_msat);
34563
34564 /**
34565  * Utility method to constructs a new SpendableOutputs-variant Event
34566  */
34567 struct LDKEvent Event_spendable_outputs(struct LDKCVec_SpendableOutputDescriptorZ outputs);
34568
34569 /**
34570  * Utility method to constructs a new PaymentForwarded-variant Event
34571  */
34572 struct LDKEvent Event_payment_forwarded(struct LDKThirtyTwoBytes prev_channel_id, struct LDKThirtyTwoBytes next_channel_id, struct LDKCOption_u64Z fee_earned_msat, bool claim_from_onchain_tx, struct LDKCOption_u64Z outbound_amount_forwarded_msat);
34573
34574 /**
34575  * Utility method to constructs a new ChannelPending-variant Event
34576  */
34577 struct LDKEvent Event_channel_pending(struct LDKThirtyTwoBytes channel_id, struct LDKU128 user_channel_id, struct LDKThirtyTwoBytes former_temporary_channel_id, struct LDKPublicKey counterparty_node_id, struct LDKOutPoint funding_txo);
34578
34579 /**
34580  * Utility method to constructs a new ChannelReady-variant Event
34581  */
34582 struct LDKEvent Event_channel_ready(struct LDKThirtyTwoBytes channel_id, struct LDKU128 user_channel_id, struct LDKPublicKey counterparty_node_id, struct LDKChannelTypeFeatures channel_type);
34583
34584 /**
34585  * Utility method to constructs a new ChannelClosed-variant Event
34586  */
34587 struct LDKEvent Event_channel_closed(struct LDKThirtyTwoBytes channel_id, struct LDKU128 user_channel_id, struct LDKClosureReason reason);
34588
34589 /**
34590  * Utility method to constructs a new DiscardFunding-variant Event
34591  */
34592 struct LDKEvent Event_discard_funding(struct LDKThirtyTwoBytes channel_id, struct LDKTransaction transaction);
34593
34594 /**
34595  * Utility method to constructs a new OpenChannelRequest-variant Event
34596  */
34597 struct LDKEvent Event_open_channel_request(struct LDKThirtyTwoBytes temporary_channel_id, struct LDKPublicKey counterparty_node_id, uint64_t funding_satoshis, uint64_t push_msat, struct LDKChannelTypeFeatures channel_type);
34598
34599 /**
34600  * Utility method to constructs a new HTLCHandlingFailed-variant Event
34601  */
34602 struct LDKEvent Event_htlchandling_failed(struct LDKThirtyTwoBytes prev_channel_id, struct LDKHTLCDestination failed_next_destination);
34603
34604 /**
34605  * Checks if two Events contain equal inner contents.
34606  * This ignores pointers and is_owned flags and looks at the values in fields.
34607  */
34608 bool Event_eq(const struct LDKEvent *NONNULL_PTR a, const struct LDKEvent *NONNULL_PTR b);
34609
34610 /**
34611  * Serialize the Event object into a byte array which can be read by Event_read
34612  */
34613 struct LDKCVec_u8Z Event_write(const struct LDKEvent *NONNULL_PTR obj);
34614
34615 /**
34616  * Read a Event from a byte array, created by Event_write
34617  */
34618 struct LDKCResult_COption_EventZDecodeErrorZ Event_read(struct LDKu8slice ser);
34619
34620 /**
34621  * Frees any resources used by the MessageSendEvent
34622  */
34623 void MessageSendEvent_free(struct LDKMessageSendEvent this_ptr);
34624
34625 /**
34626  * Creates a copy of the MessageSendEvent
34627  */
34628 struct LDKMessageSendEvent MessageSendEvent_clone(const struct LDKMessageSendEvent *NONNULL_PTR orig);
34629
34630 /**
34631  * Utility method to constructs a new SendAcceptChannel-variant MessageSendEvent
34632  */
34633 struct LDKMessageSendEvent MessageSendEvent_send_accept_channel(struct LDKPublicKey node_id, struct LDKAcceptChannel msg);
34634
34635 /**
34636  * Utility method to constructs a new SendOpenChannel-variant MessageSendEvent
34637  */
34638 struct LDKMessageSendEvent MessageSendEvent_send_open_channel(struct LDKPublicKey node_id, struct LDKOpenChannel msg);
34639
34640 /**
34641  * Utility method to constructs a new SendFundingCreated-variant MessageSendEvent
34642  */
34643 struct LDKMessageSendEvent MessageSendEvent_send_funding_created(struct LDKPublicKey node_id, struct LDKFundingCreated msg);
34644
34645 /**
34646  * Utility method to constructs a new SendFundingSigned-variant MessageSendEvent
34647  */
34648 struct LDKMessageSendEvent MessageSendEvent_send_funding_signed(struct LDKPublicKey node_id, struct LDKFundingSigned msg);
34649
34650 /**
34651  * Utility method to constructs a new SendChannelReady-variant MessageSendEvent
34652  */
34653 struct LDKMessageSendEvent MessageSendEvent_send_channel_ready(struct LDKPublicKey node_id, struct LDKChannelReady msg);
34654
34655 /**
34656  * Utility method to constructs a new SendAnnouncementSignatures-variant MessageSendEvent
34657  */
34658 struct LDKMessageSendEvent MessageSendEvent_send_announcement_signatures(struct LDKPublicKey node_id, struct LDKAnnouncementSignatures msg);
34659
34660 /**
34661  * Utility method to constructs a new UpdateHTLCs-variant MessageSendEvent
34662  */
34663 struct LDKMessageSendEvent MessageSendEvent_update_htlcs(struct LDKPublicKey node_id, struct LDKCommitmentUpdate updates);
34664
34665 /**
34666  * Utility method to constructs a new SendRevokeAndACK-variant MessageSendEvent
34667  */
34668 struct LDKMessageSendEvent MessageSendEvent_send_revoke_and_ack(struct LDKPublicKey node_id, struct LDKRevokeAndACK msg);
34669
34670 /**
34671  * Utility method to constructs a new SendClosingSigned-variant MessageSendEvent
34672  */
34673 struct LDKMessageSendEvent MessageSendEvent_send_closing_signed(struct LDKPublicKey node_id, struct LDKClosingSigned msg);
34674
34675 /**
34676  * Utility method to constructs a new SendShutdown-variant MessageSendEvent
34677  */
34678 struct LDKMessageSendEvent MessageSendEvent_send_shutdown(struct LDKPublicKey node_id, struct LDKShutdown msg);
34679
34680 /**
34681  * Utility method to constructs a new SendChannelReestablish-variant MessageSendEvent
34682  */
34683 struct LDKMessageSendEvent MessageSendEvent_send_channel_reestablish(struct LDKPublicKey node_id, struct LDKChannelReestablish msg);
34684
34685 /**
34686  * Utility method to constructs a new SendChannelAnnouncement-variant MessageSendEvent
34687  */
34688 struct LDKMessageSendEvent MessageSendEvent_send_channel_announcement(struct LDKPublicKey node_id, struct LDKChannelAnnouncement msg, struct LDKChannelUpdate update_msg);
34689
34690 /**
34691  * Utility method to constructs a new BroadcastChannelAnnouncement-variant MessageSendEvent
34692  */
34693 struct LDKMessageSendEvent MessageSendEvent_broadcast_channel_announcement(struct LDKChannelAnnouncement msg, struct LDKChannelUpdate update_msg);
34694
34695 /**
34696  * Utility method to constructs a new BroadcastChannelUpdate-variant MessageSendEvent
34697  */
34698 struct LDKMessageSendEvent MessageSendEvent_broadcast_channel_update(struct LDKChannelUpdate msg);
34699
34700 /**
34701  * Utility method to constructs a new BroadcastNodeAnnouncement-variant MessageSendEvent
34702  */
34703 struct LDKMessageSendEvent MessageSendEvent_broadcast_node_announcement(struct LDKNodeAnnouncement msg);
34704
34705 /**
34706  * Utility method to constructs a new SendChannelUpdate-variant MessageSendEvent
34707  */
34708 struct LDKMessageSendEvent MessageSendEvent_send_channel_update(struct LDKPublicKey node_id, struct LDKChannelUpdate msg);
34709
34710 /**
34711  * Utility method to constructs a new HandleError-variant MessageSendEvent
34712  */
34713 struct LDKMessageSendEvent MessageSendEvent_handle_error(struct LDKPublicKey node_id, struct LDKErrorAction action);
34714
34715 /**
34716  * Utility method to constructs a new SendChannelRangeQuery-variant MessageSendEvent
34717  */
34718 struct LDKMessageSendEvent MessageSendEvent_send_channel_range_query(struct LDKPublicKey node_id, struct LDKQueryChannelRange msg);
34719
34720 /**
34721  * Utility method to constructs a new SendShortIdsQuery-variant MessageSendEvent
34722  */
34723 struct LDKMessageSendEvent MessageSendEvent_send_short_ids_query(struct LDKPublicKey node_id, struct LDKQueryShortChannelIds msg);
34724
34725 /**
34726  * Utility method to constructs a new SendReplyChannelRange-variant MessageSendEvent
34727  */
34728 struct LDKMessageSendEvent MessageSendEvent_send_reply_channel_range(struct LDKPublicKey node_id, struct LDKReplyChannelRange msg);
34729
34730 /**
34731  * Utility method to constructs a new SendGossipTimestampFilter-variant MessageSendEvent
34732  */
34733 struct LDKMessageSendEvent MessageSendEvent_send_gossip_timestamp_filter(struct LDKPublicKey node_id, struct LDKGossipTimestampFilter msg);
34734
34735 /**
34736  * Calls the free function if one is set
34737  */
34738 void MessageSendEventsProvider_free(struct LDKMessageSendEventsProvider this_ptr);
34739
34740 /**
34741  * Calls the free function if one is set
34742  */
34743 void OnionMessageProvider_free(struct LDKOnionMessageProvider this_ptr);
34744
34745 /**
34746  * Calls the free function if one is set
34747  */
34748 void EventsProvider_free(struct LDKEventsProvider this_ptr);
34749
34750 /**
34751  * Calls the free function if one is set
34752  */
34753 void EventHandler_free(struct LDKEventHandler this_ptr);
34754
34755 /**
34756  * Frees any resources used by the FilesystemPersister, if is_owned is set and inner is non-NULL.
34757  */
34758 void FilesystemPersister_free(struct LDKFilesystemPersister this_obj);
34759
34760 /**
34761  * Initialize a new FilesystemPersister and set the path to the individual channels'
34762  * files.
34763  */
34764 MUST_USE_RES struct LDKFilesystemPersister FilesystemPersister_new(struct LDKStr path_to_channel_data);
34765
34766 /**
34767  * Get the directory which was provided when this persister was initialized.
34768  */
34769 MUST_USE_RES struct LDKStr FilesystemPersister_get_data_dir(const struct LDKFilesystemPersister *NONNULL_PTR this_arg);
34770
34771 /**
34772  * Read `ChannelMonitor`s from disk.
34773  */
34774 MUST_USE_RES struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ FilesystemPersister_read_channelmonitors(const struct LDKFilesystemPersister *NONNULL_PTR this_arg, struct LDKEntropySource entropy_source, const struct LDKSignerProvider *NONNULL_PTR signer_provider);
34775
34776 /**
34777  * Frees any resources used by the BackgroundProcessor, if is_owned is set and inner is non-NULL.
34778  */
34779 void BackgroundProcessor_free(struct LDKBackgroundProcessor this_obj);
34780
34781 /**
34782  * Frees any resources used by the GossipSync
34783  */
34784 void GossipSync_free(struct LDKGossipSync this_ptr);
34785
34786 /**
34787  * Utility method to constructs a new P2P-variant GossipSync
34788  */
34789 struct LDKGossipSync GossipSync_p2_p(const struct LDKP2PGossipSync *NONNULL_PTR a);
34790
34791 /**
34792  * Utility method to constructs a new Rapid-variant GossipSync
34793  */
34794 struct LDKGossipSync GossipSync_rapid(const struct LDKRapidGossipSync *NONNULL_PTR a);
34795
34796 /**
34797  * Utility method to constructs a new None-variant GossipSync
34798  */
34799 struct LDKGossipSync GossipSync_none(void);
34800
34801 /**
34802  * Start a background thread that takes care of responsibilities enumerated in the [top-level
34803  * documentation].
34804  *
34805  * The thread runs indefinitely unless the object is dropped, [`stop`] is called, or
34806  * [`Persister::persist_manager`] returns an error. In case of an error, the error is retrieved by calling
34807  * either [`join`] or [`stop`].
34808  *
34809  * # Data Persistence
34810  *
34811  * [`Persister::persist_manager`] is responsible for writing out the [`ChannelManager`] to disk, and/or
34812  * uploading to one or more backup services. See [`ChannelManager::write`] for writing out a
34813  * [`ChannelManager`]. See the `lightning-persister` crate for LDK's
34814  * provided implementation.
34815  *
34816  * [`Persister::persist_graph`] is responsible for writing out the [`NetworkGraph`] to disk, if
34817  * [`GossipSync`] is supplied. See [`NetworkGraph::write`] for writing out a [`NetworkGraph`].
34818  * See the `lightning-persister` crate for LDK's provided implementation.
34819  *
34820  * Typically, users should either implement [`Persister::persist_manager`] to never return an
34821  * error or call [`join`] and handle any error that may arise. For the latter case,
34822  * `BackgroundProcessor` must be restarted by calling `start` again after handling the error.
34823  *
34824  * # Event Handling
34825  *
34826  * `event_handler` is responsible for handling events that users should be notified of (e.g.,
34827  * payment failed). [`BackgroundProcessor`] may decorate the given [`EventHandler`] with common
34828  * functionality implemented by other handlers.
34829  * * [`P2PGossipSync`] if given will update the [`NetworkGraph`] based on payment failures.
34830  *
34831  * # Rapid Gossip Sync
34832  *
34833  * If rapid gossip sync is meant to run at startup, pass [`RapidGossipSync`] via `gossip_sync`
34834  * to indicate that the [`BackgroundProcessor`] should not prune the [`NetworkGraph`] instance
34835  * until the [`RapidGossipSync`] instance completes its first sync.
34836  *
34837  * [top-level documentation]: BackgroundProcessor
34838  * [`join`]: Self::join
34839  * [`stop`]: Self::stop
34840  * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
34841  * [`ChannelManager::write`]: lightning::ln::channelmanager::ChannelManager#impl-Writeable
34842  * [`Persister::persist_manager`]: lightning::util::persist::Persister::persist_manager
34843  * [`Persister::persist_graph`]: lightning::util::persist::Persister::persist_graph
34844  * [`NetworkGraph`]: lightning::routing::gossip::NetworkGraph
34845  * [`NetworkGraph::write`]: lightning::routing::gossip::NetworkGraph#impl-Writeable
34846  */
34847 MUST_USE_RES struct LDKBackgroundProcessor BackgroundProcessor_start(struct LDKPersister persister, struct LDKEventHandler event_handler, const struct LDKChainMonitor *NONNULL_PTR chain_monitor, const struct LDKChannelManager *NONNULL_PTR channel_manager, struct LDKGossipSync gossip_sync, const struct LDKPeerManager *NONNULL_PTR peer_manager, struct LDKLogger logger, struct LDKCOption_WriteableScoreZ scorer);
34848
34849 /**
34850  * Join `BackgroundProcessor`'s thread, returning any error that occurred while persisting
34851  * [`ChannelManager`].
34852  *
34853  * # Panics
34854  *
34855  * This function panics if the background thread has panicked such as while persisting or
34856  * handling events.
34857  *
34858  * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
34859  */
34860 MUST_USE_RES struct LDKCResult_NoneErrorZ BackgroundProcessor_join(struct LDKBackgroundProcessor this_arg);
34861
34862 /**
34863  * Stop `BackgroundProcessor`'s thread, returning any error that occurred while persisting
34864  * [`ChannelManager`].
34865  *
34866  * # Panics
34867  *
34868  * This function panics if the background thread has panicked such as while persisting or
34869  * handling events.
34870  *
34871  * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
34872  */
34873 MUST_USE_RES struct LDKCResult_NoneErrorZ BackgroundProcessor_stop(struct LDKBackgroundProcessor this_arg);
34874
34875 /**
34876  * Frees any resources used by the ParseError
34877  */
34878 void ParseError_free(struct LDKParseError this_ptr);
34879
34880 /**
34881  * Creates a copy of the ParseError
34882  */
34883 struct LDKParseError ParseError_clone(const struct LDKParseError *NONNULL_PTR orig);
34884
34885 /**
34886  * Utility method to constructs a new Bech32Error-variant ParseError
34887  */
34888 struct LDKParseError ParseError_bech32_error(struct LDKBech32Error a);
34889
34890 /**
34891  * Utility method to constructs a new ParseAmountError-variant ParseError
34892  */
34893 struct LDKParseError ParseError_parse_amount_error(struct LDKError a);
34894
34895 /**
34896  * Utility method to constructs a new MalformedSignature-variant ParseError
34897  */
34898 struct LDKParseError ParseError_malformed_signature(enum LDKSecp256k1Error a);
34899
34900 /**
34901  * Utility method to constructs a new BadPrefix-variant ParseError
34902  */
34903 struct LDKParseError ParseError_bad_prefix(void);
34904
34905 /**
34906  * Utility method to constructs a new UnknownCurrency-variant ParseError
34907  */
34908 struct LDKParseError ParseError_unknown_currency(void);
34909
34910 /**
34911  * Utility method to constructs a new UnknownSiPrefix-variant ParseError
34912  */
34913 struct LDKParseError ParseError_unknown_si_prefix(void);
34914
34915 /**
34916  * Utility method to constructs a new MalformedHRP-variant ParseError
34917  */
34918 struct LDKParseError ParseError_malformed_hrp(void);
34919
34920 /**
34921  * Utility method to constructs a new TooShortDataPart-variant ParseError
34922  */
34923 struct LDKParseError ParseError_too_short_data_part(void);
34924
34925 /**
34926  * Utility method to constructs a new UnexpectedEndOfTaggedFields-variant ParseError
34927  */
34928 struct LDKParseError ParseError_unexpected_end_of_tagged_fields(void);
34929
34930 /**
34931  * Utility method to constructs a new DescriptionDecodeError-variant ParseError
34932  */
34933 struct LDKParseError ParseError_description_decode_error(struct LDKError a);
34934
34935 /**
34936  * Utility method to constructs a new PaddingError-variant ParseError
34937  */
34938 struct LDKParseError ParseError_padding_error(void);
34939
34940 /**
34941  * Utility method to constructs a new IntegerOverflowError-variant ParseError
34942  */
34943 struct LDKParseError ParseError_integer_overflow_error(void);
34944
34945 /**
34946  * Utility method to constructs a new InvalidSegWitProgramLength-variant ParseError
34947  */
34948 struct LDKParseError ParseError_invalid_seg_wit_program_length(void);
34949
34950 /**
34951  * Utility method to constructs a new InvalidPubKeyHashLength-variant ParseError
34952  */
34953 struct LDKParseError ParseError_invalid_pub_key_hash_length(void);
34954
34955 /**
34956  * Utility method to constructs a new InvalidScriptHashLength-variant ParseError
34957  */
34958 struct LDKParseError ParseError_invalid_script_hash_length(void);
34959
34960 /**
34961  * Utility method to constructs a new InvalidRecoveryId-variant ParseError
34962  */
34963 struct LDKParseError ParseError_invalid_recovery_id(void);
34964
34965 /**
34966  * Utility method to constructs a new InvalidSliceLength-variant ParseError
34967  */
34968 struct LDKParseError ParseError_invalid_slice_length(struct LDKStr a);
34969
34970 /**
34971  * Utility method to constructs a new Skip-variant ParseError
34972  */
34973 struct LDKParseError ParseError_skip(void);
34974
34975 /**
34976  * Checks if two ParseErrors contain equal inner contents.
34977  * This ignores pointers and is_owned flags and looks at the values in fields.
34978  */
34979 bool ParseError_eq(const struct LDKParseError *NONNULL_PTR a, const struct LDKParseError *NONNULL_PTR b);
34980
34981 /**
34982  * Frees any resources used by the ParseOrSemanticError
34983  */
34984 void ParseOrSemanticError_free(struct LDKParseOrSemanticError this_ptr);
34985
34986 /**
34987  * Creates a copy of the ParseOrSemanticError
34988  */
34989 struct LDKParseOrSemanticError ParseOrSemanticError_clone(const struct LDKParseOrSemanticError *NONNULL_PTR orig);
34990
34991 /**
34992  * Utility method to constructs a new ParseError-variant ParseOrSemanticError
34993  */
34994 struct LDKParseOrSemanticError ParseOrSemanticError_parse_error(struct LDKParseError a);
34995
34996 /**
34997  * Utility method to constructs a new SemanticError-variant ParseOrSemanticError
34998  */
34999 struct LDKParseOrSemanticError ParseOrSemanticError_semantic_error(enum LDKSemanticError a);
35000
35001 /**
35002  * Checks if two ParseOrSemanticErrors contain equal inner contents.
35003  * This ignores pointers and is_owned flags and looks at the values in fields.
35004  */
35005 bool ParseOrSemanticError_eq(const struct LDKParseOrSemanticError *NONNULL_PTR a, const struct LDKParseOrSemanticError *NONNULL_PTR b);
35006
35007 /**
35008  * Frees any resources used by the Invoice, if is_owned is set and inner is non-NULL.
35009  */
35010 void Invoice_free(struct LDKInvoice this_obj);
35011
35012 /**
35013  * Checks if two Invoices contain equal inner contents.
35014  * This ignores pointers and is_owned flags and looks at the values in fields.
35015  * Two objects with NULL inner values will be considered "equal" here.
35016  */
35017 bool Invoice_eq(const struct LDKInvoice *NONNULL_PTR a, const struct LDKInvoice *NONNULL_PTR b);
35018
35019 /**
35020  * Creates a copy of the Invoice
35021  */
35022 struct LDKInvoice Invoice_clone(const struct LDKInvoice *NONNULL_PTR orig);
35023
35024 /**
35025  * Generates a non-cryptographic 64-bit hash of the Invoice.
35026  */
35027 uint64_t Invoice_hash(const struct LDKInvoice *NONNULL_PTR o);
35028
35029 /**
35030  * Frees any resources used by the SignedRawInvoice, if is_owned is set and inner is non-NULL.
35031  */
35032 void SignedRawInvoice_free(struct LDKSignedRawInvoice this_obj);
35033
35034 /**
35035  * Checks if two SignedRawInvoices contain equal inner contents.
35036  * This ignores pointers and is_owned flags and looks at the values in fields.
35037  * Two objects with NULL inner values will be considered "equal" here.
35038  */
35039 bool SignedRawInvoice_eq(const struct LDKSignedRawInvoice *NONNULL_PTR a, const struct LDKSignedRawInvoice *NONNULL_PTR b);
35040
35041 /**
35042  * Creates a copy of the SignedRawInvoice
35043  */
35044 struct LDKSignedRawInvoice SignedRawInvoice_clone(const struct LDKSignedRawInvoice *NONNULL_PTR orig);
35045
35046 /**
35047  * Generates a non-cryptographic 64-bit hash of the SignedRawInvoice.
35048  */
35049 uint64_t SignedRawInvoice_hash(const struct LDKSignedRawInvoice *NONNULL_PTR o);
35050
35051 /**
35052  * Frees any resources used by the RawInvoice, if is_owned is set and inner is non-NULL.
35053  */
35054 void RawInvoice_free(struct LDKRawInvoice this_obj);
35055
35056 /**
35057  * data part
35058  */
35059 struct LDKRawDataPart RawInvoice_get_data(const struct LDKRawInvoice *NONNULL_PTR this_ptr);
35060
35061 /**
35062  * data part
35063  */
35064 void RawInvoice_set_data(struct LDKRawInvoice *NONNULL_PTR this_ptr, struct LDKRawDataPart val);
35065
35066 /**
35067  * Checks if two RawInvoices contain equal inner contents.
35068  * This ignores pointers and is_owned flags and looks at the values in fields.
35069  * Two objects with NULL inner values will be considered "equal" here.
35070  */
35071 bool RawInvoice_eq(const struct LDKRawInvoice *NONNULL_PTR a, const struct LDKRawInvoice *NONNULL_PTR b);
35072
35073 /**
35074  * Creates a copy of the RawInvoice
35075  */
35076 struct LDKRawInvoice RawInvoice_clone(const struct LDKRawInvoice *NONNULL_PTR orig);
35077
35078 /**
35079  * Generates a non-cryptographic 64-bit hash of the RawInvoice.
35080  */
35081 uint64_t RawInvoice_hash(const struct LDKRawInvoice *NONNULL_PTR o);
35082
35083 /**
35084  * Frees any resources used by the RawDataPart, if is_owned is set and inner is non-NULL.
35085  */
35086 void RawDataPart_free(struct LDKRawDataPart this_obj);
35087
35088 /**
35089  * generation time of the invoice
35090  */
35091 struct LDKPositiveTimestamp RawDataPart_get_timestamp(const struct LDKRawDataPart *NONNULL_PTR this_ptr);
35092
35093 /**
35094  * generation time of the invoice
35095  */
35096 void RawDataPart_set_timestamp(struct LDKRawDataPart *NONNULL_PTR this_ptr, struct LDKPositiveTimestamp val);
35097
35098 /**
35099  * Checks if two RawDataParts contain equal inner contents.
35100  * This ignores pointers and is_owned flags and looks at the values in fields.
35101  * Two objects with NULL inner values will be considered "equal" here.
35102  */
35103 bool RawDataPart_eq(const struct LDKRawDataPart *NONNULL_PTR a, const struct LDKRawDataPart *NONNULL_PTR b);
35104
35105 /**
35106  * Creates a copy of the RawDataPart
35107  */
35108 struct LDKRawDataPart RawDataPart_clone(const struct LDKRawDataPart *NONNULL_PTR orig);
35109
35110 /**
35111  * Generates a non-cryptographic 64-bit hash of the RawDataPart.
35112  */
35113 uint64_t RawDataPart_hash(const struct LDKRawDataPart *NONNULL_PTR o);
35114
35115 /**
35116  * Frees any resources used by the PositiveTimestamp, if is_owned is set and inner is non-NULL.
35117  */
35118 void PositiveTimestamp_free(struct LDKPositiveTimestamp this_obj);
35119
35120 /**
35121  * Checks if two PositiveTimestamps contain equal inner contents.
35122  * This ignores pointers and is_owned flags and looks at the values in fields.
35123  * Two objects with NULL inner values will be considered "equal" here.
35124  */
35125 bool PositiveTimestamp_eq(const struct LDKPositiveTimestamp *NONNULL_PTR a, const struct LDKPositiveTimestamp *NONNULL_PTR b);
35126
35127 /**
35128  * Creates a copy of the PositiveTimestamp
35129  */
35130 struct LDKPositiveTimestamp PositiveTimestamp_clone(const struct LDKPositiveTimestamp *NONNULL_PTR orig);
35131
35132 /**
35133  * Generates a non-cryptographic 64-bit hash of the PositiveTimestamp.
35134  */
35135 uint64_t PositiveTimestamp_hash(const struct LDKPositiveTimestamp *NONNULL_PTR o);
35136
35137 /**
35138  * Creates a copy of the SiPrefix
35139  */
35140 enum LDKSiPrefix SiPrefix_clone(const enum LDKSiPrefix *NONNULL_PTR orig);
35141
35142 /**
35143  * Utility method to constructs a new Milli-variant SiPrefix
35144  */
35145 enum LDKSiPrefix SiPrefix_milli(void);
35146
35147 /**
35148  * Utility method to constructs a new Micro-variant SiPrefix
35149  */
35150 enum LDKSiPrefix SiPrefix_micro(void);
35151
35152 /**
35153  * Utility method to constructs a new Nano-variant SiPrefix
35154  */
35155 enum LDKSiPrefix SiPrefix_nano(void);
35156
35157 /**
35158  * Utility method to constructs a new Pico-variant SiPrefix
35159  */
35160 enum LDKSiPrefix SiPrefix_pico(void);
35161
35162 /**
35163  * Checks if two SiPrefixs contain equal inner contents.
35164  * This ignores pointers and is_owned flags and looks at the values in fields.
35165  */
35166 bool SiPrefix_eq(const enum LDKSiPrefix *NONNULL_PTR a, const enum LDKSiPrefix *NONNULL_PTR b);
35167
35168 /**
35169  * Generates a non-cryptographic 64-bit hash of the SiPrefix.
35170  */
35171 uint64_t SiPrefix_hash(const enum LDKSiPrefix *NONNULL_PTR o);
35172
35173 /**
35174  * Returns the multiplier to go from a BTC value to picoBTC implied by this SiPrefix.
35175  * This is effectively 10^12 * the prefix multiplier
35176  */
35177 MUST_USE_RES uint64_t SiPrefix_multiplier(const enum LDKSiPrefix *NONNULL_PTR this_arg);
35178
35179 /**
35180  * Creates a copy of the Currency
35181  */
35182 enum LDKCurrency Currency_clone(const enum LDKCurrency *NONNULL_PTR orig);
35183
35184 /**
35185  * Utility method to constructs a new Bitcoin-variant Currency
35186  */
35187 enum LDKCurrency Currency_bitcoin(void);
35188
35189 /**
35190  * Utility method to constructs a new BitcoinTestnet-variant Currency
35191  */
35192 enum LDKCurrency Currency_bitcoin_testnet(void);
35193
35194 /**
35195  * Utility method to constructs a new Regtest-variant Currency
35196  */
35197 enum LDKCurrency Currency_regtest(void);
35198
35199 /**
35200  * Utility method to constructs a new Simnet-variant Currency
35201  */
35202 enum LDKCurrency Currency_simnet(void);
35203
35204 /**
35205  * Utility method to constructs a new Signet-variant Currency
35206  */
35207 enum LDKCurrency Currency_signet(void);
35208
35209 /**
35210  * Generates a non-cryptographic 64-bit hash of the Currency.
35211  */
35212 uint64_t Currency_hash(const enum LDKCurrency *NONNULL_PTR o);
35213
35214 /**
35215  * Checks if two Currencys contain equal inner contents.
35216  * This ignores pointers and is_owned flags and looks at the values in fields.
35217  */
35218 bool Currency_eq(const enum LDKCurrency *NONNULL_PTR a, const enum LDKCurrency *NONNULL_PTR b);
35219
35220 /**
35221  * Frees any resources used by the Sha256, if is_owned is set and inner is non-NULL.
35222  */
35223 void Sha256_free(struct LDKSha256 this_obj);
35224
35225 /**
35226  * Creates a copy of the Sha256
35227  */
35228 struct LDKSha256 Sha256_clone(const struct LDKSha256 *NONNULL_PTR orig);
35229
35230 /**
35231  * Generates a non-cryptographic 64-bit hash of the Sha256.
35232  */
35233 uint64_t Sha256_hash(const struct LDKSha256 *NONNULL_PTR o);
35234
35235 /**
35236  * Checks if two Sha256s contain equal inner contents.
35237  * This ignores pointers and is_owned flags and looks at the values in fields.
35238  * Two objects with NULL inner values will be considered "equal" here.
35239  */
35240 bool Sha256_eq(const struct LDKSha256 *NONNULL_PTR a, const struct LDKSha256 *NONNULL_PTR b);
35241
35242 /**
35243  * Constructs a new [`Sha256`] from the given bytes, which are assumed to be the output of a
35244  * single sha256 hash.
35245  */
35246 MUST_USE_RES struct LDKSha256 Sha256_from_bytes(const uint8_t (*bytes)[32]);
35247
35248 /**
35249  * Frees any resources used by the Description, if is_owned is set and inner is non-NULL.
35250  */
35251 void Description_free(struct LDKDescription this_obj);
35252
35253 /**
35254  * Creates a copy of the Description
35255  */
35256 struct LDKDescription Description_clone(const struct LDKDescription *NONNULL_PTR orig);
35257
35258 /**
35259  * Generates a non-cryptographic 64-bit hash of the Description.
35260  */
35261 uint64_t Description_hash(const struct LDKDescription *NONNULL_PTR o);
35262
35263 /**
35264  * Checks if two Descriptions contain equal inner contents.
35265  * This ignores pointers and is_owned flags and looks at the values in fields.
35266  * Two objects with NULL inner values will be considered "equal" here.
35267  */
35268 bool Description_eq(const struct LDKDescription *NONNULL_PTR a, const struct LDKDescription *NONNULL_PTR b);
35269
35270 /**
35271  * Frees any resources used by the PayeePubKey, if is_owned is set and inner is non-NULL.
35272  */
35273 void PayeePubKey_free(struct LDKPayeePubKey this_obj);
35274
35275 struct LDKPublicKey PayeePubKey_get_a(const struct LDKPayeePubKey *NONNULL_PTR this_ptr);
35276
35277 void PayeePubKey_set_a(struct LDKPayeePubKey *NONNULL_PTR this_ptr, struct LDKPublicKey val);
35278
35279 /**
35280  * Constructs a new PayeePubKey given each field
35281  */
35282 MUST_USE_RES struct LDKPayeePubKey PayeePubKey_new(struct LDKPublicKey a_arg);
35283
35284 /**
35285  * Creates a copy of the PayeePubKey
35286  */
35287 struct LDKPayeePubKey PayeePubKey_clone(const struct LDKPayeePubKey *NONNULL_PTR orig);
35288
35289 /**
35290  * Generates a non-cryptographic 64-bit hash of the PayeePubKey.
35291  */
35292 uint64_t PayeePubKey_hash(const struct LDKPayeePubKey *NONNULL_PTR o);
35293
35294 /**
35295  * Checks if two PayeePubKeys contain equal inner contents.
35296  * This ignores pointers and is_owned flags and looks at the values in fields.
35297  * Two objects with NULL inner values will be considered "equal" here.
35298  */
35299 bool PayeePubKey_eq(const struct LDKPayeePubKey *NONNULL_PTR a, const struct LDKPayeePubKey *NONNULL_PTR b);
35300
35301 /**
35302  * Frees any resources used by the ExpiryTime, if is_owned is set and inner is non-NULL.
35303  */
35304 void ExpiryTime_free(struct LDKExpiryTime this_obj);
35305
35306 /**
35307  * Creates a copy of the ExpiryTime
35308  */
35309 struct LDKExpiryTime ExpiryTime_clone(const struct LDKExpiryTime *NONNULL_PTR orig);
35310
35311 /**
35312  * Generates a non-cryptographic 64-bit hash of the ExpiryTime.
35313  */
35314 uint64_t ExpiryTime_hash(const struct LDKExpiryTime *NONNULL_PTR o);
35315
35316 /**
35317  * Checks if two ExpiryTimes contain equal inner contents.
35318  * This ignores pointers and is_owned flags and looks at the values in fields.
35319  * Two objects with NULL inner values will be considered "equal" here.
35320  */
35321 bool ExpiryTime_eq(const struct LDKExpiryTime *NONNULL_PTR a, const struct LDKExpiryTime *NONNULL_PTR b);
35322
35323 /**
35324  * Frees any resources used by the MinFinalCltvExpiryDelta, if is_owned is set and inner is non-NULL.
35325  */
35326 void MinFinalCltvExpiryDelta_free(struct LDKMinFinalCltvExpiryDelta this_obj);
35327
35328 uint64_t MinFinalCltvExpiryDelta_get_a(const struct LDKMinFinalCltvExpiryDelta *NONNULL_PTR this_ptr);
35329
35330 void MinFinalCltvExpiryDelta_set_a(struct LDKMinFinalCltvExpiryDelta *NONNULL_PTR this_ptr, uint64_t val);
35331
35332 /**
35333  * Constructs a new MinFinalCltvExpiryDelta given each field
35334  */
35335 MUST_USE_RES struct LDKMinFinalCltvExpiryDelta MinFinalCltvExpiryDelta_new(uint64_t a_arg);
35336
35337 /**
35338  * Creates a copy of the MinFinalCltvExpiryDelta
35339  */
35340 struct LDKMinFinalCltvExpiryDelta MinFinalCltvExpiryDelta_clone(const struct LDKMinFinalCltvExpiryDelta *NONNULL_PTR orig);
35341
35342 /**
35343  * Generates a non-cryptographic 64-bit hash of the MinFinalCltvExpiryDelta.
35344  */
35345 uint64_t MinFinalCltvExpiryDelta_hash(const struct LDKMinFinalCltvExpiryDelta *NONNULL_PTR o);
35346
35347 /**
35348  * Checks if two MinFinalCltvExpiryDeltas contain equal inner contents.
35349  * This ignores pointers and is_owned flags and looks at the values in fields.
35350  * Two objects with NULL inner values will be considered "equal" here.
35351  */
35352 bool MinFinalCltvExpiryDelta_eq(const struct LDKMinFinalCltvExpiryDelta *NONNULL_PTR a, const struct LDKMinFinalCltvExpiryDelta *NONNULL_PTR b);
35353
35354 /**
35355  * Frees any resources used by the Fallback
35356  */
35357 void Fallback_free(struct LDKFallback this_ptr);
35358
35359 /**
35360  * Creates a copy of the Fallback
35361  */
35362 struct LDKFallback Fallback_clone(const struct LDKFallback *NONNULL_PTR orig);
35363
35364 /**
35365  * Utility method to constructs a new SegWitProgram-variant Fallback
35366  */
35367 struct LDKFallback Fallback_seg_wit_program(struct LDKWitnessVersion version, struct LDKCVec_u8Z program);
35368
35369 /**
35370  * Utility method to constructs a new PubKeyHash-variant Fallback
35371  */
35372 struct LDKFallback Fallback_pub_key_hash(struct LDKTwentyBytes a);
35373
35374 /**
35375  * Utility method to constructs a new ScriptHash-variant Fallback
35376  */
35377 struct LDKFallback Fallback_script_hash(struct LDKTwentyBytes a);
35378
35379 /**
35380  * Generates a non-cryptographic 64-bit hash of the Fallback.
35381  */
35382 uint64_t Fallback_hash(const struct LDKFallback *NONNULL_PTR o);
35383
35384 /**
35385  * Checks if two Fallbacks contain equal inner contents.
35386  * This ignores pointers and is_owned flags and looks at the values in fields.
35387  */
35388 bool Fallback_eq(const struct LDKFallback *NONNULL_PTR a, const struct LDKFallback *NONNULL_PTR b);
35389
35390 /**
35391  * Frees any resources used by the InvoiceSignature, if is_owned is set and inner is non-NULL.
35392  */
35393 void InvoiceSignature_free(struct LDKInvoiceSignature this_obj);
35394
35395 /**
35396  * Creates a copy of the InvoiceSignature
35397  */
35398 struct LDKInvoiceSignature InvoiceSignature_clone(const struct LDKInvoiceSignature *NONNULL_PTR orig);
35399
35400 /**
35401  * Generates a non-cryptographic 64-bit hash of the InvoiceSignature.
35402  */
35403 uint64_t InvoiceSignature_hash(const struct LDKInvoiceSignature *NONNULL_PTR o);
35404
35405 /**
35406  * Checks if two InvoiceSignatures contain equal inner contents.
35407  * This ignores pointers and is_owned flags and looks at the values in fields.
35408  * Two objects with NULL inner values will be considered "equal" here.
35409  */
35410 bool InvoiceSignature_eq(const struct LDKInvoiceSignature *NONNULL_PTR a, const struct LDKInvoiceSignature *NONNULL_PTR b);
35411
35412 /**
35413  * Frees any resources used by the PrivateRoute, if is_owned is set and inner is non-NULL.
35414  */
35415 void PrivateRoute_free(struct LDKPrivateRoute this_obj);
35416
35417 /**
35418  * Creates a copy of the PrivateRoute
35419  */
35420 struct LDKPrivateRoute PrivateRoute_clone(const struct LDKPrivateRoute *NONNULL_PTR orig);
35421
35422 /**
35423  * Generates a non-cryptographic 64-bit hash of the PrivateRoute.
35424  */
35425 uint64_t PrivateRoute_hash(const struct LDKPrivateRoute *NONNULL_PTR o);
35426
35427 /**
35428  * Checks if two PrivateRoutes contain equal inner contents.
35429  * This ignores pointers and is_owned flags and looks at the values in fields.
35430  * Two objects with NULL inner values will be considered "equal" here.
35431  */
35432 bool PrivateRoute_eq(const struct LDKPrivateRoute *NONNULL_PTR a, const struct LDKPrivateRoute *NONNULL_PTR b);
35433
35434 /**
35435  * Disassembles the `SignedRawInvoice` into its three parts:
35436  *  1. raw invoice
35437  *  2. hash of the raw invoice
35438  *  3. signature
35439  */
35440 MUST_USE_RES struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ SignedRawInvoice_into_parts(struct LDKSignedRawInvoice this_arg);
35441
35442 /**
35443  * The [`RawInvoice`] which was signed.
35444  */
35445 MUST_USE_RES struct LDKRawInvoice SignedRawInvoice_raw_invoice(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
35446
35447 /**
35448  * The hash of the [`RawInvoice`] that was signed.
35449  */
35450 MUST_USE_RES const uint8_t (*SignedRawInvoice_signable_hash(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg))[32];
35451
35452 /**
35453  * Signature for the invoice.
35454  */
35455 MUST_USE_RES struct LDKInvoiceSignature SignedRawInvoice_signature(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
35456
35457 /**
35458  * Recovers the public key used for signing the invoice from the recoverable signature.
35459  */
35460 MUST_USE_RES struct LDKCResult_PayeePubKeyErrorZ SignedRawInvoice_recover_payee_pub_key(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
35461
35462 /**
35463  * Checks if the signature is valid for the included payee public key or if none exists if it's
35464  * valid for the recovered signature (which should always be true?).
35465  */
35466 MUST_USE_RES bool SignedRawInvoice_check_signature(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
35467
35468 /**
35469  * Calculate the hash of the encoded `RawInvoice` which should be signed.
35470  */
35471 MUST_USE_RES struct LDKThirtyTwoBytes RawInvoice_signable_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg);
35472
35473 /**
35474  *
35475  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
35476  */
35477 MUST_USE_RES struct LDKSha256 RawInvoice_payment_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg);
35478
35479 /**
35480  *
35481  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
35482  */
35483 MUST_USE_RES struct LDKDescription RawInvoice_description(const struct LDKRawInvoice *NONNULL_PTR this_arg);
35484
35485 /**
35486  *
35487  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
35488  */
35489 MUST_USE_RES struct LDKPayeePubKey RawInvoice_payee_pub_key(const struct LDKRawInvoice *NONNULL_PTR this_arg);
35490
35491 /**
35492  *
35493  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
35494  */
35495 MUST_USE_RES struct LDKSha256 RawInvoice_description_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg);
35496
35497 /**
35498  *
35499  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
35500  */
35501 MUST_USE_RES struct LDKExpiryTime RawInvoice_expiry_time(const struct LDKRawInvoice *NONNULL_PTR this_arg);
35502
35503 /**
35504  *
35505  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
35506  */
35507 MUST_USE_RES struct LDKMinFinalCltvExpiryDelta RawInvoice_min_final_cltv_expiry_delta(const struct LDKRawInvoice *NONNULL_PTR this_arg);
35508
35509 /**
35510  *
35511  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
35512  */
35513 MUST_USE_RES struct LDKThirtyTwoBytes RawInvoice_payment_secret(const struct LDKRawInvoice *NONNULL_PTR this_arg);
35514
35515 MUST_USE_RES struct LDKCOption_CVec_u8ZZ RawInvoice_payment_metadata(const struct LDKRawInvoice *NONNULL_PTR this_arg);
35516
35517 /**
35518  *
35519  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
35520  */
35521 MUST_USE_RES struct LDKInvoiceFeatures RawInvoice_features(const struct LDKRawInvoice *NONNULL_PTR this_arg);
35522
35523 MUST_USE_RES struct LDKCVec_PrivateRouteZ RawInvoice_private_routes(const struct LDKRawInvoice *NONNULL_PTR this_arg);
35524
35525 MUST_USE_RES struct LDKCOption_u64Z RawInvoice_amount_pico_btc(const struct LDKRawInvoice *NONNULL_PTR this_arg);
35526
35527 MUST_USE_RES enum LDKCurrency RawInvoice_currency(const struct LDKRawInvoice *NONNULL_PTR this_arg);
35528
35529 /**
35530  * Creates a `PositiveTimestamp` from a Unix timestamp in the range `0..=MAX_TIMESTAMP`.
35531  *
35532  * Otherwise, returns a [`CreationError::TimestampOutOfBounds`].
35533  */
35534 MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp_from_unix_timestamp(uint64_t unix_seconds);
35535
35536 /**
35537  * Creates a `PositiveTimestamp` from a [`SystemTime`] with a corresponding Unix timestamp in
35538  * the range `0..=MAX_TIMESTAMP`.
35539  *
35540  * Note that the subsecond part is dropped as it is not representable in BOLT 11 invoices.
35541  *
35542  * Otherwise, returns a [`CreationError::TimestampOutOfBounds`].
35543  */
35544 MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp_from_system_time(uint64_t time);
35545
35546 /**
35547  * Creates a `PositiveTimestamp` from a [`Duration`] since the Unix epoch in the range
35548  * `0..=MAX_TIMESTAMP`.
35549  *
35550  * Note that the subsecond part is dropped as it is not representable in BOLT 11 invoices.
35551  *
35552  * Otherwise, returns a [`CreationError::TimestampOutOfBounds`].
35553  */
35554 MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp_from_duration_since_epoch(uint64_t duration);
35555
35556 /**
35557  * Returns the Unix timestamp representing the stored time
35558  */
35559 MUST_USE_RES uint64_t PositiveTimestamp_as_unix_timestamp(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg);
35560
35561 /**
35562  * Returns the duration of the stored time since the Unix epoch
35563  */
35564 MUST_USE_RES uint64_t PositiveTimestamp_as_duration_since_epoch(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg);
35565
35566 /**
35567  * Returns the [`SystemTime`] representing the stored time
35568  */
35569 MUST_USE_RES uint64_t PositiveTimestamp_as_time(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg);
35570
35571 /**
35572  * The hash of the [`RawInvoice`] that was signed.
35573  */
35574 MUST_USE_RES struct LDKThirtyTwoBytes Invoice_signable_hash(const struct LDKInvoice *NONNULL_PTR this_arg);
35575
35576 /**
35577  * Transform the `Invoice` into it's unchecked version
35578  */
35579 MUST_USE_RES struct LDKSignedRawInvoice Invoice_into_signed_raw(struct LDKInvoice this_arg);
35580
35581 /**
35582  * Check that the invoice is signed correctly and that key recovery works
35583  */
35584 MUST_USE_RES struct LDKCResult_NoneSemanticErrorZ Invoice_check_signature(const struct LDKInvoice *NONNULL_PTR this_arg);
35585
35586 /**
35587  * Constructs an `Invoice` from a [`SignedRawInvoice`] by checking all its invariants.
35588  * ```
35589  * use lightning_invoice::*;
35590  *
35591  * let invoice = \"lnbc100p1psj9jhxdqud3jxktt5w46x7unfv9kz6mn0v3jsnp4q0d3p2sfluzdx45tqcs\\
35592  * h2pu5qc7lgq0xs578ngs6s0s68ua4h7cvspp5q6rmq35js88zp5dvwrv9m459tnk2zunwj5jalqtyxqulh0l\\
35593  * 5gflssp5nf55ny5gcrfl30xuhzj3nphgj27rstekmr9fw3ny5989s300gyus9qyysgqcqpcrzjqw2sxwe993\\
35594  * h5pcm4dxzpvttgza8zhkqxpgffcrf5v25nwpr3cmfg7z54kuqq8rgqqqqqqqq2qqqqq9qq9qrzjqd0ylaqcl\\
35595  * j9424x9m8h2vcukcgnm6s56xfgu3j78zyqzhgs4hlpzvznlugqq9vsqqqqqqqlgqqqqqeqq9qrzjqwldmj9d\\
35596  * ha74df76zhx6l9we0vjdquygcdt3kssupehe64g6yyp5yz5rhuqqwccqqyqqqqlgqqqqjcqq9qrzjqf9e58a\\
35597  * guqr0rcun0ajlvmzq3ek63cw2w282gv3z5uupmuwvgjtq2z55qsqqg6qqqyqqqrtnqqqzq3cqygrzjqvphms\\
35598  * ywntrrhqjcraumvc4y6r8v4z5v593trte429v4hredj7ms5z52usqq9ngqqqqqqqlgqqqqqqgq9qrzjq2v0v\\
35599  * p62g49p7569ev48cmulecsxe59lvaw3wlxm7r982zxa9zzj7z5l0cqqxusqqyqqqqlgqqqqqzsqygarl9fh3\\
35600  * 8s0gyuxjjgux34w75dnc6xp2l35j7es3jd4ugt3lu0xzre26yg5m7ke54n2d5sym4xcmxtl8238xxvw5h5h5\\
35601  * j5r6drg6k6zcqj0fcwg\";
35602  *
35603  * let signed = invoice.parse::<SignedRawInvoice>().unwrap();
35604  *
35605  * assert!(Invoice::from_signed(signed).is_ok());
35606  * ```
35607  */
35608 MUST_USE_RES struct LDKCResult_InvoiceSemanticErrorZ Invoice_from_signed(struct LDKSignedRawInvoice signed_invoice);
35609
35610 /**
35611  * Returns the `Invoice`'s timestamp (should equal its creation time)
35612  */
35613 MUST_USE_RES uint64_t Invoice_timestamp(const struct LDKInvoice *NONNULL_PTR this_arg);
35614
35615 /**
35616  * Returns the `Invoice`'s timestamp as a duration since the Unix epoch
35617  */
35618 MUST_USE_RES uint64_t Invoice_duration_since_epoch(const struct LDKInvoice *NONNULL_PTR this_arg);
35619
35620 /**
35621  * Returns the hash to which we will receive the preimage on completion of the payment
35622  */
35623 MUST_USE_RES const uint8_t (*Invoice_payment_hash(const struct LDKInvoice *NONNULL_PTR this_arg))[32];
35624
35625 /**
35626  * Get the payee's public key if one was included in the invoice
35627  *
35628  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
35629  */
35630 MUST_USE_RES struct LDKPublicKey Invoice_payee_pub_key(const struct LDKInvoice *NONNULL_PTR this_arg);
35631
35632 /**
35633  * Get the payment secret if one was included in the invoice
35634  */
35635 MUST_USE_RES const uint8_t (*Invoice_payment_secret(const struct LDKInvoice *NONNULL_PTR this_arg))[32];
35636
35637 /**
35638  * Get the payment metadata blob if one was included in the invoice
35639  */
35640 MUST_USE_RES struct LDKCOption_CVec_u8ZZ Invoice_payment_metadata(const struct LDKInvoice *NONNULL_PTR this_arg);
35641
35642 /**
35643  * Get the invoice features if they were included in the invoice
35644  *
35645  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
35646  */
35647 MUST_USE_RES struct LDKInvoiceFeatures Invoice_features(const struct LDKInvoice *NONNULL_PTR this_arg);
35648
35649 /**
35650  * Recover the payee's public key (only to be used if none was included in the invoice)
35651  */
35652 MUST_USE_RES struct LDKPublicKey Invoice_recover_payee_pub_key(const struct LDKInvoice *NONNULL_PTR this_arg);
35653
35654 /**
35655  * Returns the Duration since the Unix epoch at which the invoice expires.
35656  * Returning None if overflow occurred.
35657  */
35658 MUST_USE_RES struct LDKCOption_DurationZ Invoice_expires_at(const struct LDKInvoice *NONNULL_PTR this_arg);
35659
35660 /**
35661  * Returns the invoice's expiry time, if present, otherwise [`DEFAULT_EXPIRY_TIME`].
35662  */
35663 MUST_USE_RES uint64_t Invoice_expiry_time(const struct LDKInvoice *NONNULL_PTR this_arg);
35664
35665 /**
35666  * Returns whether the invoice has expired.
35667  */
35668 MUST_USE_RES bool Invoice_is_expired(const struct LDKInvoice *NONNULL_PTR this_arg);
35669
35670 /**
35671  * Returns the Duration remaining until the invoice expires.
35672  */
35673 MUST_USE_RES uint64_t Invoice_duration_until_expiry(const struct LDKInvoice *NONNULL_PTR this_arg);
35674
35675 /**
35676  * Returns the Duration remaining until the invoice expires given the current time.
35677  * `time` is the timestamp as a duration since the Unix epoch.
35678  */
35679 MUST_USE_RES uint64_t Invoice_expiration_remaining_from_epoch(const struct LDKInvoice *NONNULL_PTR this_arg, uint64_t time);
35680
35681 /**
35682  * Returns whether the expiry time would pass at the given point in time.
35683  * `at_time` is the timestamp as a duration since the Unix epoch.
35684  */
35685 MUST_USE_RES bool Invoice_would_expire(const struct LDKInvoice *NONNULL_PTR this_arg, uint64_t at_time);
35686
35687 /**
35688  * Returns the invoice's `min_final_cltv_expiry_delta` time, if present, otherwise
35689  * [`DEFAULT_MIN_FINAL_CLTV_EXPIRY_DELTA`].
35690  */
35691 MUST_USE_RES uint64_t Invoice_min_final_cltv_expiry_delta(const struct LDKInvoice *NONNULL_PTR this_arg);
35692
35693 /**
35694  * Returns a list of all fallback addresses as [`Address`]es
35695  */
35696 MUST_USE_RES struct LDKCVec_AddressZ Invoice_fallback_addresses(const struct LDKInvoice *NONNULL_PTR this_arg);
35697
35698 /**
35699  * Returns a list of all routes included in the invoice
35700  */
35701 MUST_USE_RES struct LDKCVec_PrivateRouteZ Invoice_private_routes(const struct LDKInvoice *NONNULL_PTR this_arg);
35702
35703 /**
35704  * Returns a list of all routes included in the invoice as the underlying hints
35705  */
35706 MUST_USE_RES struct LDKCVec_RouteHintZ Invoice_route_hints(const struct LDKInvoice *NONNULL_PTR this_arg);
35707
35708 /**
35709  * Returns the currency for which the invoice was issued
35710  */
35711 MUST_USE_RES enum LDKCurrency Invoice_currency(const struct LDKInvoice *NONNULL_PTR this_arg);
35712
35713 /**
35714  * Returns the amount if specified in the invoice as millisatoshis.
35715  */
35716 MUST_USE_RES struct LDKCOption_u64Z Invoice_amount_milli_satoshis(const struct LDKInvoice *NONNULL_PTR this_arg);
35717
35718 /**
35719  * Creates a new `Description` if `description` is at most 1023 __bytes__ long,
35720  * returns [`CreationError::DescriptionTooLong`] otherwise
35721  *
35722  * Please note that single characters may use more than one byte due to UTF8 encoding.
35723  */
35724 MUST_USE_RES struct LDKCResult_DescriptionCreationErrorZ Description_new(struct LDKStr description);
35725
35726 /**
35727  * Returns the underlying description [`String`]
35728  */
35729 MUST_USE_RES struct LDKStr Description_into_inner(struct LDKDescription this_arg);
35730
35731 /**
35732  * Construct an `ExpiryTime` from seconds.
35733  */
35734 MUST_USE_RES struct LDKExpiryTime ExpiryTime_from_seconds(uint64_t seconds);
35735
35736 /**
35737  * Construct an `ExpiryTime` from a [`Duration`], dropping the sub-second part.
35738  */
35739 MUST_USE_RES struct LDKExpiryTime ExpiryTime_from_duration(uint64_t duration);
35740
35741 /**
35742  * Returns the expiry time in seconds
35743  */
35744 MUST_USE_RES uint64_t ExpiryTime_as_seconds(const struct LDKExpiryTime *NONNULL_PTR this_arg);
35745
35746 /**
35747  * Returns a reference to the underlying [`Duration`] (=expiry time)
35748  */
35749 MUST_USE_RES uint64_t ExpiryTime_as_duration(const struct LDKExpiryTime *NONNULL_PTR this_arg);
35750
35751 /**
35752  * Creates a new (partial) route from a list of hops
35753  */
35754 MUST_USE_RES struct LDKCResult_PrivateRouteCreationErrorZ PrivateRoute_new(struct LDKRouteHint hops);
35755
35756 /**
35757  * Returns the underlying list of hops
35758  */
35759 MUST_USE_RES struct LDKRouteHint PrivateRoute_into_inner(struct LDKPrivateRoute this_arg);
35760
35761 /**
35762  * Creates a copy of the CreationError
35763  */
35764 enum LDKCreationError CreationError_clone(const enum LDKCreationError *NONNULL_PTR orig);
35765
35766 /**
35767  * Utility method to constructs a new DescriptionTooLong-variant CreationError
35768  */
35769 enum LDKCreationError CreationError_description_too_long(void);
35770
35771 /**
35772  * Utility method to constructs a new RouteTooLong-variant CreationError
35773  */
35774 enum LDKCreationError CreationError_route_too_long(void);
35775
35776 /**
35777  * Utility method to constructs a new TimestampOutOfBounds-variant CreationError
35778  */
35779 enum LDKCreationError CreationError_timestamp_out_of_bounds(void);
35780
35781 /**
35782  * Utility method to constructs a new InvalidAmount-variant CreationError
35783  */
35784 enum LDKCreationError CreationError_invalid_amount(void);
35785
35786 /**
35787  * Utility method to constructs a new MissingRouteHints-variant CreationError
35788  */
35789 enum LDKCreationError CreationError_missing_route_hints(void);
35790
35791 /**
35792  * Utility method to constructs a new MinFinalCltvExpiryDeltaTooShort-variant CreationError
35793  */
35794 enum LDKCreationError CreationError_min_final_cltv_expiry_delta_too_short(void);
35795
35796 /**
35797  * Checks if two CreationErrors contain equal inner contents.
35798  * This ignores pointers and is_owned flags and looks at the values in fields.
35799  */
35800 bool CreationError_eq(const enum LDKCreationError *NONNULL_PTR a, const enum LDKCreationError *NONNULL_PTR b);
35801
35802 /**
35803  * Get the string representation of a CreationError object
35804  */
35805 struct LDKStr CreationError_to_str(const enum LDKCreationError *NONNULL_PTR o);
35806
35807 /**
35808  * Creates a copy of the SemanticError
35809  */
35810 enum LDKSemanticError SemanticError_clone(const enum LDKSemanticError *NONNULL_PTR orig);
35811
35812 /**
35813  * Utility method to constructs a new NoPaymentHash-variant SemanticError
35814  */
35815 enum LDKSemanticError SemanticError_no_payment_hash(void);
35816
35817 /**
35818  * Utility method to constructs a new MultiplePaymentHashes-variant SemanticError
35819  */
35820 enum LDKSemanticError SemanticError_multiple_payment_hashes(void);
35821
35822 /**
35823  * Utility method to constructs a new NoDescription-variant SemanticError
35824  */
35825 enum LDKSemanticError SemanticError_no_description(void);
35826
35827 /**
35828  * Utility method to constructs a new MultipleDescriptions-variant SemanticError
35829  */
35830 enum LDKSemanticError SemanticError_multiple_descriptions(void);
35831
35832 /**
35833  * Utility method to constructs a new NoPaymentSecret-variant SemanticError
35834  */
35835 enum LDKSemanticError SemanticError_no_payment_secret(void);
35836
35837 /**
35838  * Utility method to constructs a new MultiplePaymentSecrets-variant SemanticError
35839  */
35840 enum LDKSemanticError SemanticError_multiple_payment_secrets(void);
35841
35842 /**
35843  * Utility method to constructs a new InvalidFeatures-variant SemanticError
35844  */
35845 enum LDKSemanticError SemanticError_invalid_features(void);
35846
35847 /**
35848  * Utility method to constructs a new InvalidRecoveryId-variant SemanticError
35849  */
35850 enum LDKSemanticError SemanticError_invalid_recovery_id(void);
35851
35852 /**
35853  * Utility method to constructs a new InvalidSignature-variant SemanticError
35854  */
35855 enum LDKSemanticError SemanticError_invalid_signature(void);
35856
35857 /**
35858  * Utility method to constructs a new ImpreciseAmount-variant SemanticError
35859  */
35860 enum LDKSemanticError SemanticError_imprecise_amount(void);
35861
35862 /**
35863  * Checks if two SemanticErrors contain equal inner contents.
35864  * This ignores pointers and is_owned flags and looks at the values in fields.
35865  */
35866 bool SemanticError_eq(const enum LDKSemanticError *NONNULL_PTR a, const enum LDKSemanticError *NONNULL_PTR b);
35867
35868 /**
35869  * Get the string representation of a SemanticError object
35870  */
35871 struct LDKStr SemanticError_to_str(const enum LDKSemanticError *NONNULL_PTR o);
35872
35873 /**
35874  * Frees any resources used by the SignOrCreationError
35875  */
35876 void SignOrCreationError_free(struct LDKSignOrCreationError this_ptr);
35877
35878 /**
35879  * Creates a copy of the SignOrCreationError
35880  */
35881 struct LDKSignOrCreationError SignOrCreationError_clone(const struct LDKSignOrCreationError *NONNULL_PTR orig);
35882
35883 /**
35884  * Utility method to constructs a new SignError-variant SignOrCreationError
35885  */
35886 struct LDKSignOrCreationError SignOrCreationError_sign_error(void);
35887
35888 /**
35889  * Utility method to constructs a new CreationError-variant SignOrCreationError
35890  */
35891 struct LDKSignOrCreationError SignOrCreationError_creation_error(enum LDKCreationError a);
35892
35893 /**
35894  * Checks if two SignOrCreationErrors contain equal inner contents.
35895  * This ignores pointers and is_owned flags and looks at the values in fields.
35896  */
35897 bool SignOrCreationError_eq(const struct LDKSignOrCreationError *NONNULL_PTR a, const struct LDKSignOrCreationError *NONNULL_PTR b);
35898
35899 /**
35900  * Get the string representation of a SignOrCreationError object
35901  */
35902 struct LDKStr SignOrCreationError_to_str(const struct LDKSignOrCreationError *NONNULL_PTR o);
35903
35904 /**
35905  * Pays the given [`Invoice`], retrying if needed based on [`Retry`].
35906  *
35907  * [`Invoice::payment_hash`] is used as the [`PaymentId`], which ensures idempotency as long
35908  * as the payment is still pending. Once the payment completes or fails, you must ensure that
35909  * a second payment with the same [`PaymentHash`] is never sent.
35910  *
35911  * If you wish to use a different payment idempotency token, see [`pay_invoice_with_id`].
35912  */
35913 struct LDKCResult_PaymentIdPaymentErrorZ pay_invoice(const struct LDKInvoice *NONNULL_PTR invoice, struct LDKRetry retry_strategy, const struct LDKChannelManager *NONNULL_PTR channelmanager);
35914
35915 /**
35916  * Pays the given [`Invoice`] with a custom idempotency key, retrying if needed based on [`Retry`].
35917  *
35918  * Note that idempotency is only guaranteed as long as the payment is still pending. Once the
35919  * payment completes or fails, no idempotency guarantees are made.
35920  *
35921  * You should ensure that the [`Invoice::payment_hash`] is unique and the same [`PaymentHash`]
35922  * has never been paid before.
35923  *
35924  * See [`pay_invoice`] for a variant which uses the [`PaymentHash`] for the idempotency token.
35925  */
35926 struct LDKCResult_NonePaymentErrorZ pay_invoice_with_id(const struct LDKInvoice *NONNULL_PTR invoice, struct LDKThirtyTwoBytes payment_id, struct LDKRetry retry_strategy, const struct LDKChannelManager *NONNULL_PTR channelmanager);
35927
35928 /**
35929  * Pays the given zero-value [`Invoice`] using the given amount, retrying if needed based on
35930  * [`Retry`].
35931  *
35932  * [`Invoice::payment_hash`] is used as the [`PaymentId`], which ensures idempotency as long
35933  * as the payment is still pending. Once the payment completes or fails, you must ensure that
35934  * a second payment with the same [`PaymentHash`] is never sent.
35935  *
35936  * If you wish to use a different payment idempotency token, see
35937  * [`pay_zero_value_invoice_with_id`].
35938  */
35939 struct LDKCResult_PaymentIdPaymentErrorZ pay_zero_value_invoice(const struct LDKInvoice *NONNULL_PTR invoice, uint64_t amount_msats, struct LDKRetry retry_strategy, const struct LDKChannelManager *NONNULL_PTR channelmanager);
35940
35941 /**
35942  * Pays the given zero-value [`Invoice`] using the given amount and custom idempotency key,
35943  * , retrying if needed based on [`Retry`].
35944  *
35945  * Note that idempotency is only guaranteed as long as the payment is still pending. Once the
35946  * payment completes or fails, no idempotency guarantees are made.
35947  *
35948  * You should ensure that the [`Invoice::payment_hash`] is unique and the same [`PaymentHash`]
35949  * has never been paid before.
35950  *
35951  * See [`pay_zero_value_invoice`] for a variant which uses the [`PaymentHash`] for the
35952  * idempotency token.
35953  */
35954 struct LDKCResult_NonePaymentErrorZ pay_zero_value_invoice_with_id(const struct LDKInvoice *NONNULL_PTR invoice, uint64_t amount_msats, struct LDKThirtyTwoBytes payment_id, struct LDKRetry retry_strategy, const struct LDKChannelManager *NONNULL_PTR channelmanager);
35955
35956 /**
35957  * Frees any resources used by the PaymentError
35958  */
35959 void PaymentError_free(struct LDKPaymentError this_ptr);
35960
35961 /**
35962  * Creates a copy of the PaymentError
35963  */
35964 struct LDKPaymentError PaymentError_clone(const struct LDKPaymentError *NONNULL_PTR orig);
35965
35966 /**
35967  * Utility method to constructs a new Invoice-variant PaymentError
35968  */
35969 struct LDKPaymentError PaymentError_invoice(struct LDKStr a);
35970
35971 /**
35972  * Utility method to constructs a new Sending-variant PaymentError
35973  */
35974 struct LDKPaymentError PaymentError_sending(enum LDKRetryableSendFailure a);
35975
35976 /**
35977  * Utility to create an invoice that can be paid to one of multiple nodes, or a \"phantom invoice.\"
35978  * See [`PhantomKeysManager`] for more information on phantom node payments.
35979  *
35980  * `phantom_route_hints` parameter:
35981  * * Contains channel info for all nodes participating in the phantom invoice
35982  * * Entries are retrieved from a call to [`ChannelManager::get_phantom_route_hints`] on each
35983  *   participating node
35984  * * It is fine to cache `phantom_route_hints` and reuse it across invoices, as long as the data is
35985  *   updated when a channel becomes disabled or closes
35986  * * Note that if too many channels are included in [`PhantomRouteHints::channels`], the invoice
35987  *   may be too long for QR code scanning. To fix this, `PhantomRouteHints::channels` may be pared
35988  *   down
35989  *
35990  * `payment_hash` can be specified if you have a specific need for a custom payment hash (see the difference
35991  * between [`ChannelManager::create_inbound_payment`] and [`ChannelManager::create_inbound_payment_for_hash`]).
35992  * If `None` is provided for `payment_hash`, then one will be created.
35993  *
35994  * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
35995  * in excess of the current time.
35996  *
35997  * `duration_since_epoch` is the current time since epoch in seconds.
35998  *
35999  * You can specify a custom `min_final_cltv_expiry_delta`, or let LDK default it to
36000  * [`MIN_FINAL_CLTV_EXPIRY_DELTA`]. The provided expiry must be at least [`MIN_FINAL_CLTV_EXPIRY_DELTA`] - 3.
36001  * Note that LDK will add a buffer of 3 blocks to the delta to allow for up to a few new block
36002  * confirmations during routing.
36003  *
36004  * Note that the provided `keys_manager`'s `NodeSigner` implementation must support phantom
36005  * invoices in its `sign_invoice` implementation ([`PhantomKeysManager`] satisfies this
36006  * requirement).
36007  *
36008  * [`PhantomKeysManager`]: lightning::chain::keysinterface::PhantomKeysManager
36009  * [`ChannelManager::get_phantom_route_hints`]: lightning::ln::channelmanager::ChannelManager::get_phantom_route_hints
36010  * [`ChannelManager::create_inbound_payment`]: lightning::ln::channelmanager::ChannelManager::create_inbound_payment
36011  * [`ChannelManager::create_inbound_payment_for_hash`]: lightning::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
36012  * [`PhantomRouteHints::channels`]: lightning::ln::channelmanager::PhantomRouteHints::channels
36013  * [`MIN_FINAL_CLTV_EXPIRY_DETLA`]: lightning::ln::channelmanager::MIN_FINAL_CLTV_EXPIRY_DELTA
36014  *
36015  * This can be used in a `no_std` environment, where [`std::time::SystemTime`] is not
36016  * available and the current time is supplied by the caller.
36017  *
36018  * Note that payment_hash (or a relevant inner pointer) may be NULL or all-0s to represent None
36019  */
36020 struct LDKCResult_InvoiceSignOrCreationErrorZ create_phantom_invoice(struct LDKCOption_u64Z amt_msat, struct LDKThirtyTwoBytes payment_hash, struct LDKStr description, uint32_t invoice_expiry_delta_secs, struct LDKCVec_PhantomRouteHintsZ phantom_route_hints, struct LDKEntropySource entropy_source, struct LDKNodeSigner node_signer, struct LDKLogger logger, enum LDKCurrency network, struct LDKCOption_u16Z min_final_cltv_expiry_delta, uint64_t duration_since_epoch);
36021
36022 /**
36023  * Utility to create an invoice that can be paid to one of multiple nodes, or a \"phantom invoice.\"
36024  * See [`PhantomKeysManager`] for more information on phantom node payments.
36025  *
36026  * `phantom_route_hints` parameter:
36027  * * Contains channel info for all nodes participating in the phantom invoice
36028  * * Entries are retrieved from a call to [`ChannelManager::get_phantom_route_hints`] on each
36029  *   participating node
36030  * * It is fine to cache `phantom_route_hints` and reuse it across invoices, as long as the data is
36031  *   updated when a channel becomes disabled or closes
36032  * * Note that if too many channels are included in [`PhantomRouteHints::channels`], the invoice
36033  *   may be too long for QR code scanning. To fix this, `PhantomRouteHints::channels` may be pared
36034  *   down
36035  *
36036  * `description_hash` is a SHA-256 hash of the description text
36037  *
36038  * `payment_hash` can be specified if you have a specific need for a custom payment hash (see the difference
36039  * between [`ChannelManager::create_inbound_payment`] and [`ChannelManager::create_inbound_payment_for_hash`]).
36040  * If `None` is provided for `payment_hash`, then one will be created.
36041  *
36042  * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
36043  * in excess of the current time.
36044  *
36045  * `duration_since_epoch` is the current time since epoch in seconds.
36046  *
36047  * Note that the provided `keys_manager`'s `NodeSigner` implementation must support phantom
36048  * invoices in its `sign_invoice` implementation ([`PhantomKeysManager`] satisfies this
36049  * requirement).
36050  *
36051  * [`PhantomKeysManager`]: lightning::chain::keysinterface::PhantomKeysManager
36052  * [`ChannelManager::get_phantom_route_hints`]: lightning::ln::channelmanager::ChannelManager::get_phantom_route_hints
36053  * [`ChannelManager::create_inbound_payment`]: lightning::ln::channelmanager::ChannelManager::create_inbound_payment
36054  * [`ChannelManager::create_inbound_payment_for_hash`]: lightning::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
36055  * [`PhantomRouteHints::channels`]: lightning::ln::channelmanager::PhantomRouteHints::channels
36056  *
36057  * This can be used in a `no_std` environment, where [`std::time::SystemTime`] is not
36058  * available and the current time is supplied by the caller.
36059  *
36060  * Note that payment_hash (or a relevant inner pointer) may be NULL or all-0s to represent None
36061  */
36062 struct LDKCResult_InvoiceSignOrCreationErrorZ create_phantom_invoice_with_description_hash(struct LDKCOption_u64Z amt_msat, struct LDKThirtyTwoBytes payment_hash, uint32_t invoice_expiry_delta_secs, struct LDKSha256 description_hash, struct LDKCVec_PhantomRouteHintsZ phantom_route_hints, struct LDKEntropySource entropy_source, struct LDKNodeSigner node_signer, struct LDKLogger logger, enum LDKCurrency network, struct LDKCOption_u16Z min_final_cltv_expiry_delta, uint64_t duration_since_epoch);
36063
36064 /**
36065  * Utility to construct an invoice. Generally, unless you want to do something like a custom
36066  * cltv_expiry, this is what you should be using to create an invoice. The reason being, this
36067  * method stores the invoice's payment secret and preimage in `ChannelManager`, so (a) the user
36068  * doesn't have to store preimage/payment secret information and (b) `ChannelManager` can verify
36069  * that the payment secret is valid when the invoice is paid.
36070  *
36071  * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
36072  * in excess of the current time.
36073  *
36074  * You can specify a custom `min_final_cltv_expiry_delta`, or let LDK default it to
36075  * [`MIN_FINAL_CLTV_EXPIRY_DELTA`]. The provided expiry must be at least [`MIN_FINAL_CLTV_EXPIRY_DELTA`].
36076  * Note that LDK will add a buffer of 3 blocks to the delta to allow for up to a few new block
36077  * confirmations during routing.
36078  *
36079  * [`MIN_FINAL_CLTV_EXPIRY_DETLA`]: lightning::ln::channelmanager::MIN_FINAL_CLTV_EXPIRY_DELTA
36080  */
36081 struct LDKCResult_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKNodeSigner node_signer, struct LDKLogger logger, enum LDKCurrency network, struct LDKCOption_u64Z amt_msat, struct LDKStr description, uint32_t invoice_expiry_delta_secs, struct LDKCOption_u16Z min_final_cltv_expiry_delta);
36082
36083 /**
36084  * Utility to construct an invoice. Generally, unless you want to do something like a custom
36085  * cltv_expiry, this is what you should be using to create an invoice. The reason being, this
36086  * method stores the invoice's payment secret and preimage in `ChannelManager`, so (a) the user
36087  * doesn't have to store preimage/payment secret information and (b) `ChannelManager` can verify
36088  * that the payment secret is valid when the invoice is paid.
36089  * Use this variant if you want to pass the `description_hash` to the invoice.
36090  *
36091  * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
36092  * in excess of the current time.
36093  *
36094  * You can specify a custom `min_final_cltv_expiry_delta`, or let LDK default it to
36095  * [`MIN_FINAL_CLTV_EXPIRY_DELTA`]. The provided expiry must be at least [`MIN_FINAL_CLTV_EXPIRY_DELTA`].
36096  * Note that LDK will add a buffer of 3 blocks to the delta to allow for up to a few new block
36097  * confirmations during routing.
36098  *
36099  * [`MIN_FINAL_CLTV_EXPIRY_DETLA`]: lightning::ln::channelmanager::MIN_FINAL_CLTV_EXPIRY_DELTA
36100  */
36101 struct LDKCResult_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_with_description_hash(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKNodeSigner node_signer, struct LDKLogger logger, enum LDKCurrency network, struct LDKCOption_u64Z amt_msat, struct LDKSha256 description_hash, uint32_t invoice_expiry_delta_secs, struct LDKCOption_u16Z min_final_cltv_expiry_delta);
36102
36103 /**
36104  * See [`create_invoice_from_channelmanager_with_description_hash`]
36105  * This version can be used in a `no_std` environment, where [`std::time::SystemTime`] is not
36106  * available and the current time is supplied by the caller.
36107  */
36108 struct LDKCResult_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKNodeSigner node_signer, struct LDKLogger logger, enum LDKCurrency network, struct LDKCOption_u64Z amt_msat, struct LDKSha256 description_hash, uint64_t duration_since_epoch, uint32_t invoice_expiry_delta_secs, struct LDKCOption_u16Z min_final_cltv_expiry_delta);
36109
36110 /**
36111  * See [`create_invoice_from_channelmanager`]
36112  * This version can be used in a `no_std` environment, where [`std::time::SystemTime`] is not
36113  * available and the current time is supplied by the caller.
36114  */
36115 struct LDKCResult_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_and_duration_since_epoch(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKNodeSigner node_signer, struct LDKLogger logger, enum LDKCurrency network, struct LDKCOption_u64Z amt_msat, struct LDKStr description, uint64_t duration_since_epoch, uint32_t invoice_expiry_delta_secs, struct LDKCOption_u16Z min_final_cltv_expiry_delta);
36116
36117 /**
36118  * See [`create_invoice_from_channelmanager_and_duration_since_epoch`]
36119  * This version allows for providing a custom [`PaymentHash`] for the invoice.
36120  * This may be useful if you're building an on-chain swap or involving another protocol where
36121  * the payment hash is also involved outside the scope of lightning.
36122  */
36123 struct LDKCResult_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_and_duration_since_epoch_with_payment_hash(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKNodeSigner node_signer, struct LDKLogger logger, enum LDKCurrency network, struct LDKCOption_u64Z amt_msat, struct LDKStr description, uint64_t duration_since_epoch, uint32_t invoice_expiry_delta_secs, struct LDKThirtyTwoBytes payment_hash, struct LDKCOption_u16Z min_final_cltv_expiry_delta);
36124
36125 /**
36126  * Read a SiPrefix object from a string
36127  */
36128 struct LDKCResult_SiPrefixParseErrorZ SiPrefix_from_str(struct LDKStr s);
36129
36130 /**
36131  * Read a Invoice object from a string
36132  */
36133 struct LDKCResult_InvoiceParseOrSemanticErrorZ Invoice_from_str(struct LDKStr s);
36134
36135 /**
36136  * Read a SignedRawInvoice object from a string
36137  */
36138 struct LDKCResult_SignedRawInvoiceParseErrorZ SignedRawInvoice_from_str(struct LDKStr s);
36139
36140 /**
36141  * Get the string representation of a ParseError object
36142  */
36143 struct LDKStr ParseError_to_str(const struct LDKParseError *NONNULL_PTR o);
36144
36145 /**
36146  * Get the string representation of a ParseOrSemanticError object
36147  */
36148 struct LDKStr ParseOrSemanticError_to_str(const struct LDKParseOrSemanticError *NONNULL_PTR o);
36149
36150 /**
36151  * Get the string representation of a Invoice object
36152  */
36153 struct LDKStr Invoice_to_str(const struct LDKInvoice *NONNULL_PTR o);
36154
36155 /**
36156  * Get the string representation of a SignedRawInvoice object
36157  */
36158 struct LDKStr SignedRawInvoice_to_str(const struct LDKSignedRawInvoice *NONNULL_PTR o);
36159
36160 /**
36161  * Get the string representation of a Currency object
36162  */
36163 struct LDKStr Currency_to_str(const enum LDKCurrency *NONNULL_PTR o);
36164
36165 /**
36166  * Get the string representation of a SiPrefix object
36167  */
36168 struct LDKStr SiPrefix_to_str(const enum LDKSiPrefix *NONNULL_PTR o);
36169
36170 /**
36171  * Frees any resources used by the RapidGossipSync, if is_owned is set and inner is non-NULL.
36172  */
36173 void RapidGossipSync_free(struct LDKRapidGossipSync this_obj);
36174
36175 /**
36176  * Instantiate a new [`RapidGossipSync`] instance.
36177  */
36178 MUST_USE_RES struct LDKRapidGossipSync RapidGossipSync_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKLogger logger);
36179
36180 /**
36181  * Update network graph from binary data.
36182  * Returns the last sync timestamp to be used the next time rapid sync data is queried.
36183  *
36184  * `update_data`: `&[u8]` binary stream that comprises the update data
36185  * `current_time_unix`: `Option<u64>` optional current timestamp to verify data age
36186  */
36187 MUST_USE_RES struct LDKCResult_u32GraphSyncErrorZ RapidGossipSync_update_network_graph_no_std(const struct LDKRapidGossipSync *NONNULL_PTR this_arg, struct LDKu8slice update_data, struct LDKCOption_u64Z current_time_unix);
36188
36189 /**
36190  * Returns whether a rapid gossip sync has completed at least once.
36191  */
36192 MUST_USE_RES bool RapidGossipSync_is_initial_sync_complete(const struct LDKRapidGossipSync *NONNULL_PTR this_arg);
36193
36194 /**
36195  * Frees any resources used by the GraphSyncError
36196  */
36197 void GraphSyncError_free(struct LDKGraphSyncError this_ptr);
36198
36199 /**
36200  * Creates a copy of the GraphSyncError
36201  */
36202 struct LDKGraphSyncError GraphSyncError_clone(const struct LDKGraphSyncError *NONNULL_PTR orig);
36203
36204 /**
36205  * Utility method to constructs a new DecodeError-variant GraphSyncError
36206  */
36207 struct LDKGraphSyncError GraphSyncError_decode_error(struct LDKDecodeError a);
36208
36209 /**
36210  * Utility method to constructs a new LightningError-variant GraphSyncError
36211  */
36212 struct LDKGraphSyncError GraphSyncError_lightning_error(struct LDKLightningError a);
36213
36214 #endif /* LDK_C_BINDINGS_H */
36215
36216 #include "ldk_ver.h"