bf4f3ddb1dc658ed030156c69f8a3aa6ae962ee8
[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  * Errors that may occur when converting a [`RawBolt11Invoice`] to a [`Bolt11Invoice`]. They relate to
15  * the requirements sections in BOLT #11
16  */
17 typedef enum LDKBolt11SemanticError {
18    /**
19     * The invoice is missing the mandatory payment hash
20     */
21    LDKBolt11SemanticError_NoPaymentHash,
22    /**
23     * The invoice has multiple payment hashes which isn't allowed
24     */
25    LDKBolt11SemanticError_MultiplePaymentHashes,
26    /**
27     * No description or description hash are part of the invoice
28     */
29    LDKBolt11SemanticError_NoDescription,
30    /**
31     * The invoice contains multiple descriptions and/or description hashes which isn't allowed
32     */
33    LDKBolt11SemanticError_MultipleDescriptions,
34    /**
35     * The invoice is missing the mandatory payment secret, which all modern lightning nodes
36     * should provide.
37     */
38    LDKBolt11SemanticError_NoPaymentSecret,
39    /**
40     * The invoice contains multiple payment secrets
41     */
42    LDKBolt11SemanticError_MultiplePaymentSecrets,
43    /**
44     * The invoice's features are invalid
45     */
46    LDKBolt11SemanticError_InvalidFeatures,
47    /**
48     * The recovery id doesn't fit the signature/pub key
49     */
50    LDKBolt11SemanticError_InvalidRecoveryId,
51    /**
52     * The invoice's signature is invalid
53     */
54    LDKBolt11SemanticError_InvalidSignature,
55    /**
56     * The invoice's amount was not a whole number of millisatoshis
57     */
58    LDKBolt11SemanticError_ImpreciseAmount,
59    /**
60     * Must be last for serialization purposes
61     */
62    LDKBolt11SemanticError_Sentinel,
63 } LDKBolt11SemanticError;
64
65 /**
66  * Error when interpreting a TLV stream as a specific type.
67  */
68 typedef enum LDKBolt12SemanticError {
69    /**
70     * The current [`std::time::SystemTime`] is past the offer or invoice's expiration.
71     */
72    LDKBolt12SemanticError_AlreadyExpired,
73    /**
74     * The provided chain hash does not correspond to a supported chain.
75     */
76    LDKBolt12SemanticError_UnsupportedChain,
77    /**
78     * A chain was provided but was not expected.
79     */
80    LDKBolt12SemanticError_UnexpectedChain,
81    /**
82     * An amount was expected but was missing.
83     */
84    LDKBolt12SemanticError_MissingAmount,
85    /**
86     * The amount exceeded the total bitcoin supply.
87     */
88    LDKBolt12SemanticError_InvalidAmount,
89    /**
90     * An amount was provided but was not sufficient in value.
91     */
92    LDKBolt12SemanticError_InsufficientAmount,
93    /**
94     * An amount was provided but was not expected.
95     */
96    LDKBolt12SemanticError_UnexpectedAmount,
97    /**
98     * A currency was provided that is not supported.
99     */
100    LDKBolt12SemanticError_UnsupportedCurrency,
101    /**
102     * A feature was required but is unknown.
103     */
104    LDKBolt12SemanticError_UnknownRequiredFeatures,
105    /**
106     * Features were provided but were not expected.
107     */
108    LDKBolt12SemanticError_UnexpectedFeatures,
109    /**
110     * A required description was not provided.
111     */
112    LDKBolt12SemanticError_MissingDescription,
113    /**
114     * A signing pubkey was not provided.
115     */
116    LDKBolt12SemanticError_MissingSigningPubkey,
117    /**
118     * A signing pubkey was provided but a different one was expected.
119     */
120    LDKBolt12SemanticError_InvalidSigningPubkey,
121    /**
122     * A signing pubkey was provided but was not expected.
123     */
124    LDKBolt12SemanticError_UnexpectedSigningPubkey,
125    /**
126     * A quantity was expected but was missing.
127     */
128    LDKBolt12SemanticError_MissingQuantity,
129    /**
130     * An unsupported quantity was provided.
131     */
132    LDKBolt12SemanticError_InvalidQuantity,
133    /**
134     * A quantity or quantity bounds was provided but was not expected.
135     */
136    LDKBolt12SemanticError_UnexpectedQuantity,
137    /**
138     * Metadata could not be used to verify the offers message.
139     */
140    LDKBolt12SemanticError_InvalidMetadata,
141    /**
142     * Metadata was provided but was not expected.
143     */
144    LDKBolt12SemanticError_UnexpectedMetadata,
145    /**
146     * Payer metadata was expected but was missing.
147     */
148    LDKBolt12SemanticError_MissingPayerMetadata,
149    /**
150     * A payer id was expected but was missing.
151     */
152    LDKBolt12SemanticError_MissingPayerId,
153    /**
154     * Blinded paths were expected but were missing.
155     */
156    LDKBolt12SemanticError_MissingPaths,
157    /**
158     * The blinded payinfo given does not match the number of blinded path hops.
159     */
160    LDKBolt12SemanticError_InvalidPayInfo,
161    /**
162     * An invoice creation time was expected but was missing.
163     */
164    LDKBolt12SemanticError_MissingCreationTime,
165    /**
166     * An invoice payment hash was expected but was missing.
167     */
168    LDKBolt12SemanticError_MissingPaymentHash,
169    /**
170     * A signature was expected but was missing.
171     */
172    LDKBolt12SemanticError_MissingSignature,
173    /**
174     * Must be last for serialization purposes
175     */
176    LDKBolt12SemanticError_Sentinel,
177 } LDKBolt12SemanticError;
178
179 /**
180  * An enum which can either contain a  or not
181  */
182 typedef enum LDKCOption_NoneZ {
183    /**
184     * When we're in this state, this COption_NoneZ contains a
185     */
186    LDKCOption_NoneZ_Some,
187    /**
188     * When we're in this state, this COption_NoneZ contains nothing
189     */
190    LDKCOption_NoneZ_None,
191    /**
192     * Must be last for serialization purposes
193     */
194    LDKCOption_NoneZ_Sentinel,
195 } LDKCOption_NoneZ;
196
197 /**
198  * An enum representing the status of a channel monitor update persistence.
199  */
200 typedef enum LDKChannelMonitorUpdateStatus {
201    /**
202     * The update has been durably persisted and all copies of the relevant [`ChannelMonitor`]
203     * have been updated.
204     *
205     * This includes performing any `fsync()` calls required to ensure the update is guaranteed to
206     * be available on restart even if the application crashes.
207     */
208    LDKChannelMonitorUpdateStatus_Completed,
209    /**
210     * Used to indicate a temporary failure (eg connection to a watchtower or remote backup of
211     * our state failed, but is expected to succeed at some point in the future).
212     *
213     * Such a failure will \"freeze\" a channel, preventing us from revoking old states or
214     * submitting new commitment transactions to the counterparty. Once the update(s) which failed
215     * have been successfully applied, a [`MonitorEvent::Completed`] can be used to restore the
216     * channel to an operational state.
217     *
218     * Note that a given [`ChannelManager`] will *never* re-generate a [`ChannelMonitorUpdate`].
219     * If you return this error you must ensure that it is written to disk safely before writing
220     * the latest [`ChannelManager`] state, or you should return [`PermanentFailure`] instead.
221     *
222     * Even when a channel has been \"frozen\", updates to the [`ChannelMonitor`] can continue to
223     * occur (e.g. if an inbound HTLC which we forwarded was claimed upstream, resulting in us
224     * attempting to claim it on this channel) and those updates must still be persisted.
225     *
226     * No updates to the channel will be made which could invalidate other [`ChannelMonitor`]s
227     * until a [`MonitorEvent::Completed`] is provided, even if you return no error on a later
228     * monitor update for the same channel.
229     *
230     * For deployments where a copy of ChannelMonitors and other local state are backed up in a
231     * remote location (with local copies persisted immediately), it is anticipated that all
232     * updates will return [`InProgress`] until the remote copies could be updated.
233     *
234     * [`PermanentFailure`]: ChannelMonitorUpdateStatus::PermanentFailure
235     * [`InProgress`]: ChannelMonitorUpdateStatus::InProgress
236     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
237     */
238    LDKChannelMonitorUpdateStatus_InProgress,
239    /**
240     * Used to indicate no further channel monitor updates will be allowed (likely a disk failure
241     * or a remote copy of this [`ChannelMonitor`] is no longer reachable and thus not updatable).
242     *
243     * When this is returned, [`ChannelManager`] will force-close the channel but *not* broadcast
244     * our current commitment transaction. This avoids a dangerous case where a local disk failure
245     * (e.g. the Linux-default remounting of the disk as read-only) causes [`PermanentFailure`]s
246     * for all monitor updates. If we were to broadcast our latest commitment transaction and then
247     * restart, we could end up reading a previous [`ChannelMonitor`] and [`ChannelManager`],
248     * revoking our now-broadcasted state before seeing it confirm and losing all our funds.
249     *
250     * Note that this is somewhat of a tradeoff - if the disk is really gone and we may have lost
251     * the data permanently, we really should broadcast immediately. If the data can be recovered
252     * with manual intervention, we'd rather close the channel, rejecting future updates to it,
253     * and broadcast the latest state only if we have HTLCs to claim which are timing out (which
254     * we do as long as blocks are connected).
255     *
256     * In order to broadcast the latest local commitment transaction, you'll need to call
257     * [`ChannelMonitor::get_latest_holder_commitment_txn`] and broadcast the resulting
258     * transactions once you've safely ensured no further channel updates can be generated by your
259     * [`ChannelManager`].
260     *
261     * Note that at least one final [`ChannelMonitorUpdate`] may still be provided, which must
262     * still be processed by a running [`ChannelMonitor`]. This final update will mark the
263     * [`ChannelMonitor`] as finalized, ensuring no further updates (e.g. revocation of the latest
264     * commitment transaction) are allowed.
265     *
266     * Note that even if you return a [`PermanentFailure`] due to unavailability of secondary
267     * [`ChannelMonitor`] copies, you should still make an attempt to store the update where
268     * possible to ensure you can claim HTLC outputs on the latest commitment transaction
269     * broadcasted later.
270     *
271     * In case of distributed watchtowers deployment, the new version must be written to disk, as
272     * state may have been stored but rejected due to a block forcing a commitment broadcast. This
273     * storage is used to claim outputs of rejected state confirmed onchain by another watchtower,
274     * lagging behind on block processing.
275     *
276     * [`PermanentFailure`]: ChannelMonitorUpdateStatus::PermanentFailure
277     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
278     */
279    LDKChannelMonitorUpdateStatus_PermanentFailure,
280    /**
281     * Must be last for serialization purposes
282     */
283    LDKChannelMonitorUpdateStatus_Sentinel,
284 } LDKChannelMonitorUpdateStatus;
285
286 /**
287  * Further information on the details of the channel shutdown.
288  * Upon channels being forced closed (i.e. commitment transaction confirmation detected
289  * by `ChainMonitor`), ChannelShutdownState will be set to `ShutdownComplete` or
290  * the channel will be removed shortly.
291  * Also note, that in normal operation, peers could disconnect at any of these states
292  * and require peer re-connection before making progress onto other states
293  */
294 typedef enum LDKChannelShutdownState {
295    /**
296     * Channel has not sent or received a shutdown message.
297     */
298    LDKChannelShutdownState_NotShuttingDown,
299    /**
300     * Local node has sent a shutdown message for this channel.
301     */
302    LDKChannelShutdownState_ShutdownInitiated,
303    /**
304     * Shutdown message exchanges have concluded and the channels are in the midst of
305     * resolving all existing open HTLCs before closing can continue.
306     */
307    LDKChannelShutdownState_ResolvingHTLCs,
308    /**
309     * All HTLCs have been resolved, nodes are currently negotiating channel close onchain fee rates.
310     */
311    LDKChannelShutdownState_NegotiatingClosingFee,
312    /**
313     * We've successfully negotiated a closing_signed dance. At this point `ChannelManager` is about
314     * to drop the channel.
315     */
316    LDKChannelShutdownState_ShutdownComplete,
317    /**
318     * Must be last for serialization purposes
319     */
320    LDKChannelShutdownState_Sentinel,
321 } LDKChannelShutdownState;
322
323 /**
324  * An enum that represents the priority at which we want a transaction to confirm used for feerate
325  * estimation.
326  */
327 typedef enum LDKConfirmationTarget {
328    /**
329     * We'd like a transaction to confirm in the future, but don't want to commit most of the fees
330     * required to do so yet. The remaining fees will come via a Child-Pays-For-Parent (CPFP) fee
331     * bump of the transaction.
332     *
333     * The feerate returned should be the absolute minimum feerate required to enter most node
334     * mempools across the network. Note that if you are not able to obtain this feerate estimate,
335     * you should likely use the furthest-out estimate allowed by your fee estimator.
336     */
337    LDKConfirmationTarget_MempoolMinimum,
338    /**
339     * We are happy with a transaction confirming slowly, at least within a day or so worth of
340     * blocks.
341     */
342    LDKConfirmationTarget_Background,
343    /**
344     * We'd like a transaction to confirm without major delayed, i.e., within the next 12-24 blocks.
345     */
346    LDKConfirmationTarget_Normal,
347    /**
348     * We'd like a transaction to confirm in the next few blocks.
349     */
350    LDKConfirmationTarget_HighPriority,
351    /**
352     * Must be last for serialization purposes
353     */
354    LDKConfirmationTarget_Sentinel,
355 } LDKConfirmationTarget;
356
357 /**
358  * Errors that may occur when constructing a new [`RawBolt11Invoice`] or [`Bolt11Invoice`]
359  */
360 typedef enum LDKCreationError {
361    /**
362     * The supplied description string was longer than 639 __bytes__ (see [`Description::new`])
363     */
364    LDKCreationError_DescriptionTooLong,
365    /**
366     * The specified route has too many hops and can't be encoded
367     */
368    LDKCreationError_RouteTooLong,
369    /**
370     * The Unix timestamp of the supplied date is less than zero or greater than 35-bits
371     */
372    LDKCreationError_TimestampOutOfBounds,
373    /**
374     * The supplied millisatoshi amount was greater than the total bitcoin supply.
375     */
376    LDKCreationError_InvalidAmount,
377    /**
378     * Route hints were required for this invoice and were missing. Applies to
379     * [phantom invoices].
380     *
381     * [phantom invoices]: crate::utils::create_phantom_invoice
382     */
383    LDKCreationError_MissingRouteHints,
384    /**
385     * The provided `min_final_cltv_expiry_delta` was less than [`MIN_FINAL_CLTV_EXPIRY_DELTA`].
386     *
387     * [`MIN_FINAL_CLTV_EXPIRY_DELTA`]: lightning::ln::channelmanager::MIN_FINAL_CLTV_EXPIRY_DELTA
388     */
389    LDKCreationError_MinFinalCltvExpiryDeltaTooShort,
390    /**
391     * Must be last for serialization purposes
392     */
393    LDKCreationError_Sentinel,
394 } LDKCreationError;
395
396 /**
397  * Enum representing the crypto currencies (or networks) supported by this library
398  */
399 typedef enum LDKCurrency {
400    /**
401     * Bitcoin mainnet
402     */
403    LDKCurrency_Bitcoin,
404    /**
405     * Bitcoin testnet
406     */
407    LDKCurrency_BitcoinTestnet,
408    /**
409     * Bitcoin regtest
410     */
411    LDKCurrency_Regtest,
412    /**
413     * Bitcoin simnet
414     */
415    LDKCurrency_Simnet,
416    /**
417     * Bitcoin signet
418     */
419    LDKCurrency_Signet,
420    /**
421     * Must be last for serialization purposes
422     */
423    LDKCurrency_Sentinel,
424 } LDKCurrency;
425
426 /**
427  * This enum is used to specify which error data to send to peers when failing back an HTLC
428  * using [`ChannelManager::fail_htlc_backwards_with_reason`].
429  *
430  * For more info on failure codes, see <https://github.com/lightning/bolts/blob/master/04-onion-routing.md#failure-messages>.
431  */
432 typedef enum LDKFailureCode {
433    /**
434     * We had a temporary error processing the payment. Useful if no other error codes fit
435     * and you want to indicate that the payer may want to retry.
436     */
437    LDKFailureCode_TemporaryNodeFailure,
438    /**
439     * We have a required feature which was not in this onion. For example, you may require
440     * some additional metadata that was not provided with this payment.
441     */
442    LDKFailureCode_RequiredNodeFeatureMissing,
443    /**
444     * You may wish to use this when a `payment_preimage` is unknown, or the CLTV expiry of
445     * the HTLC is too close to the current block height for safe handling.
446     * Using this failure code in [`ChannelManager::fail_htlc_backwards_with_reason`] is
447     * equivalent to calling [`ChannelManager::fail_htlc_backwards`].
448     */
449    LDKFailureCode_IncorrectOrUnknownPaymentDetails,
450    /**
451     * Must be last for serialization purposes
452     */
453    LDKFailureCode_Sentinel,
454 } LDKFailureCode;
455
456 /**
457  * Describes the type of HTLC claim as determined by analyzing the witness.
458  */
459 typedef enum LDKHTLCClaim {
460    /**
461     * Claims an offered output on a commitment transaction through the timeout path.
462     */
463    LDKHTLCClaim_OfferedTimeout,
464    /**
465     * Claims an offered output on a commitment transaction through the success path.
466     */
467    LDKHTLCClaim_OfferedPreimage,
468    /**
469     * Claims an accepted output on a commitment transaction through the timeout path.
470     */
471    LDKHTLCClaim_AcceptedTimeout,
472    /**
473     * Claims an accepted output on a commitment transaction through the success path.
474     */
475    LDKHTLCClaim_AcceptedPreimage,
476    /**
477     * Claims an offered/accepted output on a commitment transaction through the revocation path.
478     */
479    LDKHTLCClaim_Revocation,
480    /**
481     * Must be last for serialization purposes
482     */
483    LDKHTLCClaim_Sentinel,
484 } LDKHTLCClaim;
485
486 /**
487  * Represents an IO Error. Note that some information is lost in the conversion from Rust.
488  */
489 typedef enum LDKIOError {
490    LDKIOError_NotFound,
491    LDKIOError_PermissionDenied,
492    LDKIOError_ConnectionRefused,
493    LDKIOError_ConnectionReset,
494    LDKIOError_ConnectionAborted,
495    LDKIOError_NotConnected,
496    LDKIOError_AddrInUse,
497    LDKIOError_AddrNotAvailable,
498    LDKIOError_BrokenPipe,
499    LDKIOError_AlreadyExists,
500    LDKIOError_WouldBlock,
501    LDKIOError_InvalidInput,
502    LDKIOError_InvalidData,
503    LDKIOError_TimedOut,
504    LDKIOError_WriteZero,
505    LDKIOError_Interrupted,
506    LDKIOError_Other,
507    LDKIOError_UnexpectedEof,
508    /**
509     * Must be last for serialization purposes
510     */
511    LDKIOError_Sentinel,
512 } LDKIOError;
513
514 /**
515  * An enum representing the available verbosity levels of the logger.
516  */
517 typedef enum LDKLevel {
518    /**
519     * Designates extremely verbose information, including gossip-induced messages
520     */
521    LDKLevel_Gossip,
522    /**
523     * Designates very low priority, often extremely verbose, information
524     */
525    LDKLevel_Trace,
526    /**
527     * Designates lower priority information
528     */
529    LDKLevel_Debug,
530    /**
531     * Designates useful information
532     */
533    LDKLevel_Info,
534    /**
535     * Designates hazardous situations
536     */
537    LDKLevel_Warn,
538    /**
539     * Designates very serious errors
540     */
541    LDKLevel_Error,
542    /**
543     * Must be last for serialization purposes
544     */
545    LDKLevel_Sentinel,
546 } LDKLevel;
547
548 /**
549  * An enum representing the possible Bitcoin or test networks which we can run on
550  */
551 typedef enum LDKNetwork {
552    /**
553     * The main Bitcoin blockchain.
554     */
555    LDKNetwork_Bitcoin,
556    /**
557     * The testnet3 blockchain.
558     */
559    LDKNetwork_Testnet,
560    /**
561     * A local test blockchain.
562     */
563    LDKNetwork_Regtest,
564    /**
565     * A blockchain on which blocks are signed instead of mined.
566     */
567    LDKNetwork_Signet,
568    /**
569     * Must be last for serialization purposes
570     */
571    LDKNetwork_Sentinel,
572 } LDKNetwork;
573
574 /**
575  * The reason the payment failed. Used in [`Event::PaymentFailed`].
576  */
577 typedef enum LDKPaymentFailureReason {
578    /**
579     * The intended recipient rejected our payment.
580     */
581    LDKPaymentFailureReason_RecipientRejected,
582    /**
583     * The user chose to abandon this payment by calling [`ChannelManager::abandon_payment`].
584     *
585     * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
586     */
587    LDKPaymentFailureReason_UserAbandoned,
588    /**
589     * We exhausted all of our retry attempts while trying to send the payment, or we
590     * exhausted the [`Retry::Timeout`] if the user set one. If at any point a retry
591     * attempt failed while being forwarded along the path, an [`Event::PaymentPathFailed`] will
592     * have come before this.
593     *
594     * [`Retry::Timeout`]: crate::ln::channelmanager::Retry::Timeout
595     */
596    LDKPaymentFailureReason_RetriesExhausted,
597    /**
598     * The payment expired while retrying, based on the provided
599     * [`PaymentParameters::expiry_time`].
600     *
601     * [`PaymentParameters::expiry_time`]: crate::routing::router::PaymentParameters::expiry_time
602     */
603    LDKPaymentFailureReason_PaymentExpired,
604    /**
605     * We failed to find a route while retrying the payment.
606     */
607    LDKPaymentFailureReason_RouteNotFound,
608    /**
609     * This error should generally never happen. This likely means that there is a problem with
610     * your router.
611     */
612    LDKPaymentFailureReason_UnexpectedError,
613    /**
614     * Must be last for serialization purposes
615     */
616    LDKPaymentFailureReason_Sentinel,
617 } LDKPaymentFailureReason;
618
619 /**
620  * Specifies the recipient of an invoice.
621  *
622  * This indicates to [`NodeSigner::sign_invoice`] what node secret key should be used to sign
623  * the invoice.
624  */
625 typedef enum LDKRecipient {
626    /**
627     * The invoice should be signed with the local node secret key.
628     */
629    LDKRecipient_Node,
630    /**
631     * The invoice should be signed with the phantom node secret key. This secret key must be the
632     * same for all nodes participating in the [phantom node payment].
633     *
634     * [phantom node payment]: PhantomKeysManager
635     */
636    LDKRecipient_PhantomNode,
637    /**
638     * Must be last for serialization purposes
639     */
640    LDKRecipient_Sentinel,
641 } LDKRecipient;
642
643 /**
644  * Indicates an immediate error on [`ChannelManager::send_payment`]. Further errors may be
645  * surfaced later via [`Event::PaymentPathFailed`] and [`Event::PaymentFailed`].
646  *
647  * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
648  * [`Event::PaymentPathFailed`]: crate::events::Event::PaymentPathFailed
649  * [`Event::PaymentFailed`]: crate::events::Event::PaymentFailed
650  */
651 typedef enum LDKRetryableSendFailure {
652    /**
653     * The provided [`PaymentParameters::expiry_time`] indicated that the payment has expired. Note
654     * that this error is *not* caused by [`Retry::Timeout`].
655     *
656     * [`PaymentParameters::expiry_time`]: crate::routing::router::PaymentParameters::expiry_time
657     */
658    LDKRetryableSendFailure_PaymentExpired,
659    /**
660     * We were unable to find a route to the destination.
661     */
662    LDKRetryableSendFailure_RouteNotFound,
663    /**
664     * Indicates that a payment for the provided [`PaymentId`] is already in-flight and has not
665     * yet completed (i.e. generated an [`Event::PaymentSent`] or [`Event::PaymentFailed`]).
666     *
667     * [`PaymentId`]: crate::ln::channelmanager::PaymentId
668     * [`Event::PaymentSent`]: crate::events::Event::PaymentSent
669     * [`Event::PaymentFailed`]: crate::events::Event::PaymentFailed
670     */
671    LDKRetryableSendFailure_DuplicatePayment,
672    /**
673     * Must be last for serialization purposes
674     */
675    LDKRetryableSendFailure_Sentinel,
676 } LDKRetryableSendFailure;
677
678 /**
679  * Represents an error returned from libsecp256k1 during validation of some secp256k1 data
680  */
681 typedef enum LDKSecp256k1Error {
682    /**
683     * Signature failed verification
684     */
685    LDKSecp256k1Error_IncorrectSignature,
686    /**
687     * Badly sized message ("messages" are actually fixed-sized digests; see the MESSAGE_SIZE constant)
688     */
689    LDKSecp256k1Error_InvalidMessage,
690    /**
691     * Bad public key
692     */
693    LDKSecp256k1Error_InvalidPublicKey,
694    /**
695     * Bad signature
696     */
697    LDKSecp256k1Error_InvalidSignature,
698    /**
699     * Bad secret key
700     */
701    LDKSecp256k1Error_InvalidSecretKey,
702    /**
703     * Bad shared secret.
704     */
705    LDKSecp256k1Error_InvalidSharedSecret,
706    /**
707     * Bad recovery id
708     */
709    LDKSecp256k1Error_InvalidRecoveryId,
710    /**
711     * Invalid tweak for add_assign or mul_assign
712     */
713    LDKSecp256k1Error_InvalidTweak,
714    /**
715     * Didn't pass enough memory to context creation with preallocated memory
716     */
717    LDKSecp256k1Error_NotEnoughMemory,
718    /**
719     * Bad set of public keys.
720     */
721    LDKSecp256k1Error_InvalidPublicKeySum,
722    /**
723     * The only valid parity values are 0 or 1.
724     */
725    LDKSecp256k1Error_InvalidParityValue,
726    /**
727     * Must be last for serialization purposes
728     */
729    LDKSecp256k1Error_Sentinel,
730 } LDKSecp256k1Error;
731
732 /**
733  * SI prefixes for the human readable part
734  */
735 typedef enum LDKSiPrefix {
736    /**
737     * 10^-3
738     */
739    LDKSiPrefix_Milli,
740    /**
741     * 10^-6
742     */
743    LDKSiPrefix_Micro,
744    /**
745     * 10^-9
746     */
747    LDKSiPrefix_Nano,
748    /**
749     * 10^-12
750     */
751    LDKSiPrefix_Pico,
752    /**
753     * Must be last for serialization purposes
754     */
755    LDKSiPrefix_Sentinel,
756 } LDKSiPrefix;
757
758 /**
759  * An error when accessing the chain via [`UtxoLookup`].
760  */
761 typedef enum LDKUtxoLookupError {
762    /**
763     * The requested chain is unknown.
764     */
765    LDKUtxoLookupError_UnknownChain,
766    /**
767     * The requested transaction doesn't exist or hasn't confirmed.
768     */
769    LDKUtxoLookupError_UnknownTx,
770    /**
771     * Must be last for serialization purposes
772     */
773    LDKUtxoLookupError_Sentinel,
774 } LDKUtxoLookupError;
775
776 /**
777  * A Rust str object, ie a reference to a UTF8-valid string.
778  * This is *not* null-terminated so cannot be used directly as a C string!
779  */
780 typedef struct LDKStr {
781    /**
782     * A pointer to the string's bytes, in UTF8 encoding
783     */
784    const uint8_t *chars;
785    /**
786     * The number of bytes (not characters!) pointed to by `chars`
787     */
788    uintptr_t len;
789    /**
790     * Whether the data pointed to by `chars` should be freed or not.
791     */
792    bool chars_is_owned;
793 } LDKStr;
794
795 /**
796  * A 16-byte byte array.
797  */
798 typedef struct LDKSixteenBytes {
799    /**
800     * The sixteen bytes
801     */
802    uint8_t data[16];
803 } LDKSixteenBytes;
804
805 /**
806  * Unsigned, 128-bit integer.
807  *
808  * Because LLVM implements an incorrect ABI for 128-bit integers, a wrapper type is defined here.
809  * See https://github.com/rust-lang/rust/issues/54341 for more details.
810  */
811 typedef struct LDKU128 {
812    /**
813     * The 128-bit integer, as 16 little-endian bytes
814     */
815    uint8_t le_bytes[16];
816 } LDKU128;
817
818 /**
819  * Represents a scalar value between zero and the secp256k1 curve order, in big endian.
820  */
821 typedef struct LDKBigEndianScalar {
822    /**
823     * The bytes of the scalar value.
824     */
825    uint8_t big_endian_bytes[32];
826 } LDKBigEndianScalar;
827
828 /**
829  * Arbitrary 32 bytes, which could represent one of a few different things. You probably want to
830  * look up the corresponding function in rust-lightning's docs.
831  */
832 typedef struct LDKThirtyTwoBytes {
833    /**
834     * The thirty-two bytes
835     */
836    uint8_t data[32];
837 } LDKThirtyTwoBytes;
838
839 /**
840  * Represents an error returned from the bech32 library during validation of some bech32 data
841  */
842 typedef enum LDKBech32Error_Tag {
843    /**
844     * String does not contain the separator character
845     */
846    LDKBech32Error_MissingSeparator,
847    /**
848     * The checksum does not match the rest of the data
849     */
850    LDKBech32Error_InvalidChecksum,
851    /**
852     * The data or human-readable part is too long or too short
853     */
854    LDKBech32Error_InvalidLength,
855    /**
856     * Some part of the string contains an invalid character
857     */
858    LDKBech32Error_InvalidChar,
859    /**
860     * Some part of the data has an invalid value
861     */
862    LDKBech32Error_InvalidData,
863    /**
864     * The bit conversion failed due to a padding issue
865     */
866    LDKBech32Error_InvalidPadding,
867    /**
868     * The whole string must be of one case
869     */
870    LDKBech32Error_MixedCase,
871    /**
872     * Must be last for serialization purposes
873     */
874    LDKBech32Error_Sentinel,
875 } LDKBech32Error_Tag;
876
877 typedef struct LDKBech32Error {
878    LDKBech32Error_Tag tag;
879    union {
880       struct {
881          uint32_t invalid_char;
882       };
883       struct {
884          uint8_t invalid_data;
885       };
886    };
887 } LDKBech32Error;
888
889 /**
890  * A serialized transaction, in (pointer, length) form.
891  *
892  * This type optionally owns its own memory, and thus the semantics around access change based on
893  * the `data_is_owned` flag. If `data_is_owned` is set, you must call `Transaction_free` to free
894  * the underlying buffer before the object goes out of scope. If `data_is_owned` is not set, any
895  * access to the buffer after the scope in which the object was provided to you is invalid. eg,
896  * access after you return from the call in which a `!data_is_owned` `Transaction` is provided to
897  * you would be invalid.
898  *
899  * Note that, while it may change in the future, because transactions on the Rust side are stored
900  * in a deserialized form, all `Transaction`s generated on the Rust side will have `data_is_owned`
901  * set. Similarly, while it may change in the future, all `Transaction`s you pass to Rust may have
902  * `data_is_owned` either set or unset at your discretion.
903  */
904 typedef struct LDKTransaction {
905    /**
906     * The serialized transaction data.
907     *
908     * This is non-const for your convenience, an object passed to Rust is never written to.
909     */
910    uint8_t *data;
911    /**
912     * The length of the serialized transaction
913     */
914    uintptr_t datalen;
915    /**
916     * Whether the data pointed to by `data` should be freed or not.
917     */
918    bool data_is_owned;
919 } LDKTransaction;
920
921 /**
922  * A serialized witness.
923  */
924 typedef struct LDKWitness {
925    /**
926     * The serialized transaction data.
927     *
928     * This is non-const for your convenience, an object passed to Rust is never written to.
929     */
930    uint8_t *data;
931    /**
932     * The length of the serialized transaction
933     */
934    uintptr_t datalen;
935    /**
936     * Whether the data pointed to by `data` should be freed or not.
937     */
938    bool data_is_owned;
939 } LDKWitness;
940
941 /**
942  * A dynamically-allocated array of u8s of arbitrary size.
943  * This corresponds to std::vector in C++
944  */
945 typedef struct LDKCVec_u8Z {
946    /**
947     * The elements in the array.
948     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
949     */
950    uint8_t *data;
951    /**
952     * The number of elements pointed to by `data`.
953     */
954    uintptr_t datalen;
955 } LDKCVec_u8Z;
956
957 /**
958  * An input to a transaction.
959  *
960  * This contains the witness, the scriptSig and the previous outpoint and represents a single
961  * input to a transaction
962  */
963 typedef struct LDKTxIn {
964    /**
965     * The witness which includes any signatures required to spend a segwit output.
966     */
967    struct LDKWitness witness;
968    /**
969     * The script_sig which includes signatures requires to spend a pre-segwit output (or a
970     * P2SH-wrapped segwit output).
971     */
972    struct LDKCVec_u8Z script_sig;
973    /**
974     * The sequence number of the transaction input
975     */
976    uint32_t sequence;
977    /**
978     * The txid of the transaction being spent.
979     */
980    struct LDKThirtyTwoBytes previous_txid;
981    /**
982     * The output index of the transaction being spent.
983     */
984    uint32_t previous_vout;
985 } LDKTxIn;
986
987 /**
988  * A transaction output including a scriptPubKey and value.
989  * This type *does* own its own memory, so must be free'd appropriately.
990  */
991 typedef struct LDKTxOut {
992    /**
993     * The script_pubkey in this output
994     */
995    struct LDKCVec_u8Z script_pubkey;
996    /**
997     * The value, in satoshis, of this output
998     */
999    uint64_t value;
1000 } LDKTxOut;
1001
1002 /**
1003  * An enum which can either contain a u64 or not
1004  */
1005 typedef enum LDKCOption_DurationZ_Tag {
1006    /**
1007     * When we're in this state, this COption_DurationZ contains a u64
1008     */
1009    LDKCOption_DurationZ_Some,
1010    /**
1011     * When we're in this state, this COption_DurationZ contains nothing
1012     */
1013    LDKCOption_DurationZ_None,
1014    /**
1015     * Must be last for serialization purposes
1016     */
1017    LDKCOption_DurationZ_Sentinel,
1018 } LDKCOption_DurationZ_Tag;
1019
1020 typedef struct LDKCOption_DurationZ {
1021    LDKCOption_DurationZ_Tag tag;
1022    union {
1023       struct {
1024          uint64_t some;
1025       };
1026    };
1027 } LDKCOption_DurationZ;
1028
1029
1030
1031 /**
1032  * Onion messages and payments can be sent and received to blinded paths, which serve to hide the
1033  * identity of the recipient.
1034  */
1035 typedef struct MUST_USE_STRUCT LDKBlindedPath {
1036    /**
1037     * A pointer to the opaque Rust object.
1038     * Nearly everywhere, inner must be non-null, however in places where
1039     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1040     */
1041    LDKnativeBlindedPath *inner;
1042    /**
1043     * Indicates that this is the only struct which contains the same pointer.
1044     * Rust functions which take ownership of an object provided via an argument require
1045     * this to be true and invalidate the object pointed to by inner.
1046     */
1047    bool is_owned;
1048 } LDKBlindedPath;
1049
1050 /**
1051  * A dynamically-allocated array of crate::lightning::blinded_path::BlindedPaths of arbitrary size.
1052  * This corresponds to std::vector in C++
1053  */
1054 typedef struct LDKCVec_BlindedPathZ {
1055    /**
1056     * The elements in the array.
1057     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1058     */
1059    struct LDKBlindedPath *data;
1060    /**
1061     * The number of elements pointed to by `data`.
1062     */
1063    uintptr_t datalen;
1064 } LDKCVec_BlindedPathZ;
1065
1066 /**
1067  * An enum which can either contain a u64 or not
1068  */
1069 typedef enum LDKCOption_u64Z_Tag {
1070    /**
1071     * When we're in this state, this COption_u64Z contains a u64
1072     */
1073    LDKCOption_u64Z_Some,
1074    /**
1075     * When we're in this state, this COption_u64Z contains nothing
1076     */
1077    LDKCOption_u64Z_None,
1078    /**
1079     * Must be last for serialization purposes
1080     */
1081    LDKCOption_u64Z_Sentinel,
1082 } LDKCOption_u64Z_Tag;
1083
1084 typedef struct LDKCOption_u64Z {
1085    LDKCOption_u64Z_Tag tag;
1086    union {
1087       struct {
1088          uint64_t some;
1089       };
1090    };
1091 } LDKCOption_u64Z;
1092
1093
1094
1095 /**
1096  * A `Refund` is a request to send an [`Bolt12Invoice`] without a preceding [`Offer`].
1097  *
1098  * Typically, after an invoice is paid, the recipient may publish a refund allowing the sender to
1099  * recoup their funds. A refund may be used more generally as an \"offer for money\", such as with a
1100  * bitcoin ATM.
1101  *
1102  * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
1103  * [`Offer`]: crate::offers::offer::Offer
1104  */
1105 typedef struct MUST_USE_STRUCT LDKRefund {
1106    /**
1107     * A pointer to the opaque Rust object.
1108     * Nearly everywhere, inner must be non-null, however in places where
1109     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1110     */
1111    LDKnativeRefund *inner;
1112    /**
1113     * Indicates that this is the only struct which contains the same pointer.
1114     * Rust functions which take ownership of an object provided via an argument require
1115     * this to be true and invalidate the object pointed to by inner.
1116     */
1117    bool is_owned;
1118 } LDKRefund;
1119
1120
1121
1122 /**
1123  * Error when parsing a bech32 encoded message using [`str::parse`].
1124  */
1125 typedef struct MUST_USE_STRUCT LDKBolt12ParseError {
1126    /**
1127     * A pointer to the opaque Rust object.
1128     * Nearly everywhere, inner must be non-null, however in places where
1129     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1130     */
1131    LDKnativeBolt12ParseError *inner;
1132    /**
1133     * Indicates that this is the only struct which contains the same pointer.
1134     * Rust functions which take ownership of an object provided via an argument require
1135     * this to be true and invalidate the object pointed to by inner.
1136     */
1137    bool is_owned;
1138 } LDKBolt12ParseError;
1139
1140 /**
1141  * The contents of CResult_RefundBolt12ParseErrorZ
1142  */
1143 typedef union LDKCResult_RefundBolt12ParseErrorZPtr {
1144    /**
1145     * A pointer to the contents in the success state.
1146     * Reading from this pointer when `result_ok` is not set is undefined.
1147     */
1148    struct LDKRefund *result;
1149    /**
1150     * A pointer to the contents in the error state.
1151     * Reading from this pointer when `result_ok` is set is undefined.
1152     */
1153    struct LDKBolt12ParseError *err;
1154 } LDKCResult_RefundBolt12ParseErrorZPtr;
1155
1156 /**
1157  * A CResult_RefundBolt12ParseErrorZ represents the result of a fallible operation,
1158  * containing a crate::lightning::offers::refund::Refund on success and a crate::lightning::offers::parse::Bolt12ParseError on failure.
1159  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1160  */
1161 typedef struct LDKCResult_RefundBolt12ParseErrorZ {
1162    /**
1163     * The contents of this CResult_RefundBolt12ParseErrorZ, accessible via either
1164     * `err` or `result` depending on the state of `result_ok`.
1165     */
1166    union LDKCResult_RefundBolt12ParseErrorZPtr contents;
1167    /**
1168     * Whether this CResult_RefundBolt12ParseErrorZ represents a success state.
1169     */
1170    bool result_ok;
1171 } LDKCResult_RefundBolt12ParseErrorZ;
1172
1173
1174
1175 /**
1176  * A script pubkey for shutting down a channel as defined by [BOLT #2].
1177  *
1178  * [BOLT #2]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md
1179  */
1180 typedef struct MUST_USE_STRUCT LDKShutdownScript {
1181    /**
1182     * A pointer to the opaque Rust object.
1183     * Nearly everywhere, inner must be non-null, however in places where
1184     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1185     */
1186    LDKnativeShutdownScript *inner;
1187    /**
1188     * Indicates that this is the only struct which contains the same pointer.
1189     * Rust functions which take ownership of an object provided via an argument require
1190     * this to be true and invalidate the object pointed to by inner.
1191     */
1192    bool is_owned;
1193 } LDKShutdownScript;
1194
1195 /**
1196  * Indicates an error on the client's part (usually some variant of attempting to use too-low or
1197  * too-high values)
1198  */
1199 typedef enum LDKAPIError_Tag {
1200    /**
1201     * Indicates the API was wholly misused (see err for more). Cases where these can be returned
1202     * are documented, but generally indicates some precondition of a function was violated.
1203     */
1204    LDKAPIError_APIMisuseError,
1205    /**
1206     * Due to a high feerate, we were unable to complete the request.
1207     * For example, this may be returned if the feerate implies we cannot open a channel at the
1208     * requested value, but opening a larger channel would succeed.
1209     */
1210    LDKAPIError_FeeRateTooHigh,
1211    /**
1212     * A malformed Route was provided (eg overflowed value, node id mismatch, overly-looped route,
1213     * too-many-hops, etc).
1214     */
1215    LDKAPIError_InvalidRoute,
1216    /**
1217     * We were unable to complete the request as the Channel required to do so is unable to
1218     * complete the request (or was not found). This can take many forms, including disconnected
1219     * peer, channel at capacity, channel shutting down, etc.
1220     */
1221    LDKAPIError_ChannelUnavailable,
1222    /**
1223     * An attempt to call [`chain::Watch::watch_channel`]/[`chain::Watch::update_channel`]
1224     * returned a [`ChannelMonitorUpdateStatus::InProgress`] indicating the persistence of a
1225     * monitor update is awaiting async resolution. Once it resolves the attempted action should
1226     * complete automatically.
1227     *
1228     * [`chain::Watch::watch_channel`]: crate::chain::Watch::watch_channel
1229     * [`chain::Watch::update_channel`]: crate::chain::Watch::update_channel
1230     * [`ChannelMonitorUpdateStatus::InProgress`]: crate::chain::ChannelMonitorUpdateStatus::InProgress
1231     */
1232    LDKAPIError_MonitorUpdateInProgress,
1233    /**
1234     * [`SignerProvider::get_shutdown_scriptpubkey`] returned a shutdown scriptpubkey incompatible
1235     * with the channel counterparty as negotiated in [`InitFeatures`].
1236     *
1237     * Using a SegWit v0 script should resolve this issue. If you cannot, you won't be able to open
1238     * a channel or cooperatively close one with this peer (and will have to force-close instead).
1239     *
1240     * [`SignerProvider::get_shutdown_scriptpubkey`]: crate::sign::SignerProvider::get_shutdown_scriptpubkey
1241     * [`InitFeatures`]: crate::ln::features::InitFeatures
1242     */
1243    LDKAPIError_IncompatibleShutdownScript,
1244    /**
1245     * Must be last for serialization purposes
1246     */
1247    LDKAPIError_Sentinel,
1248 } LDKAPIError_Tag;
1249
1250 typedef struct LDKAPIError_LDKAPIMisuseError_Body {
1251    /**
1252     * A human-readable error message
1253     */
1254    struct LDKStr err;
1255 } LDKAPIError_LDKAPIMisuseError_Body;
1256
1257 typedef struct LDKAPIError_LDKFeeRateTooHigh_Body {
1258    /**
1259     * A human-readable error message
1260     */
1261    struct LDKStr err;
1262    /**
1263     * The feerate which was too high.
1264     */
1265    uint32_t feerate;
1266 } LDKAPIError_LDKFeeRateTooHigh_Body;
1267
1268 typedef struct LDKAPIError_LDKInvalidRoute_Body {
1269    /**
1270     * A human-readable error message
1271     */
1272    struct LDKStr err;
1273 } LDKAPIError_LDKInvalidRoute_Body;
1274
1275 typedef struct LDKAPIError_LDKChannelUnavailable_Body {
1276    /**
1277     * A human-readable error message
1278     */
1279    struct LDKStr err;
1280 } LDKAPIError_LDKChannelUnavailable_Body;
1281
1282 typedef struct LDKAPIError_LDKIncompatibleShutdownScript_Body {
1283    /**
1284     * The incompatible shutdown script.
1285     */
1286    struct LDKShutdownScript script;
1287 } LDKAPIError_LDKIncompatibleShutdownScript_Body;
1288
1289 typedef struct MUST_USE_STRUCT LDKAPIError {
1290    LDKAPIError_Tag tag;
1291    union {
1292       LDKAPIError_LDKAPIMisuseError_Body api_misuse_error;
1293       LDKAPIError_LDKFeeRateTooHigh_Body fee_rate_too_high;
1294       LDKAPIError_LDKInvalidRoute_Body invalid_route;
1295       LDKAPIError_LDKChannelUnavailable_Body channel_unavailable;
1296       LDKAPIError_LDKIncompatibleShutdownScript_Body incompatible_shutdown_script;
1297    };
1298 } LDKAPIError;
1299
1300 /**
1301  * The contents of CResult_NoneAPIErrorZ
1302  */
1303 typedef union LDKCResult_NoneAPIErrorZPtr {
1304    /**
1305     * Note that this value is always NULL, as there are no contents in the OK variant
1306     */
1307    void *result;
1308    /**
1309     * A pointer to the contents in the error state.
1310     * Reading from this pointer when `result_ok` is set is undefined.
1311     */
1312    struct LDKAPIError *err;
1313 } LDKCResult_NoneAPIErrorZPtr;
1314
1315 /**
1316  * A CResult_NoneAPIErrorZ represents the result of a fallible operation,
1317  * containing a () on success and a crate::lightning::util::errors::APIError on failure.
1318  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1319  */
1320 typedef struct LDKCResult_NoneAPIErrorZ {
1321    /**
1322     * The contents of this CResult_NoneAPIErrorZ, accessible via either
1323     * `err` or `result` depending on the state of `result_ok`.
1324     */
1325    union LDKCResult_NoneAPIErrorZPtr contents;
1326    /**
1327     * Whether this CResult_NoneAPIErrorZ represents a success state.
1328     */
1329    bool result_ok;
1330 } LDKCResult_NoneAPIErrorZ;
1331
1332 /**
1333  * A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
1334  * This corresponds to std::vector in C++
1335  */
1336 typedef struct LDKCVec_CResult_NoneAPIErrorZZ {
1337    /**
1338     * The elements in the array.
1339     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1340     */
1341    struct LDKCResult_NoneAPIErrorZ *data;
1342    /**
1343     * The number of elements pointed to by `data`.
1344     */
1345    uintptr_t datalen;
1346 } LDKCVec_CResult_NoneAPIErrorZZ;
1347
1348 /**
1349  * A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
1350  * This corresponds to std::vector in C++
1351  */
1352 typedef struct LDKCVec_APIErrorZ {
1353    /**
1354     * The elements in the array.
1355     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1356     */
1357    struct LDKAPIError *data;
1358    /**
1359     * The number of elements pointed to by `data`.
1360     */
1361    uintptr_t datalen;
1362 } LDKCVec_APIErrorZ;
1363
1364 /**
1365  * An enum which can either contain a crate::c_types::ThirtyTwoBytes or not
1366  */
1367 typedef enum LDKCOption_PaymentSecretZ_Tag {
1368    /**
1369     * When we're in this state, this COption_PaymentSecretZ contains a crate::c_types::ThirtyTwoBytes
1370     */
1371    LDKCOption_PaymentSecretZ_Some,
1372    /**
1373     * When we're in this state, this COption_PaymentSecretZ contains nothing
1374     */
1375    LDKCOption_PaymentSecretZ_None,
1376    /**
1377     * Must be last for serialization purposes
1378     */
1379    LDKCOption_PaymentSecretZ_Sentinel,
1380 } LDKCOption_PaymentSecretZ_Tag;
1381
1382 typedef struct LDKCOption_PaymentSecretZ {
1383    LDKCOption_PaymentSecretZ_Tag tag;
1384    union {
1385       struct {
1386          struct LDKThirtyTwoBytes some;
1387       };
1388    };
1389 } LDKCOption_PaymentSecretZ;
1390
1391 /**
1392  * An enum which can either contain a crate::c_types::derived::CVec_u8Z or not
1393  */
1394 typedef enum LDKCOption_CVec_u8ZZ_Tag {
1395    /**
1396     * When we're in this state, this COption_CVec_u8ZZ contains a crate::c_types::derived::CVec_u8Z
1397     */
1398    LDKCOption_CVec_u8ZZ_Some,
1399    /**
1400     * When we're in this state, this COption_CVec_u8ZZ contains nothing
1401     */
1402    LDKCOption_CVec_u8ZZ_None,
1403    /**
1404     * Must be last for serialization purposes
1405     */
1406    LDKCOption_CVec_u8ZZ_Sentinel,
1407 } LDKCOption_CVec_u8ZZ_Tag;
1408
1409 typedef struct LDKCOption_CVec_u8ZZ {
1410    LDKCOption_CVec_u8ZZ_Tag tag;
1411    union {
1412       struct {
1413          struct LDKCVec_u8Z some;
1414       };
1415    };
1416 } LDKCOption_CVec_u8ZZ;
1417
1418
1419
1420 /**
1421  * Information which is provided, encrypted, to the payment recipient when sending HTLCs.
1422  *
1423  * This should generally be constructed with data communicated to us from the recipient (via a
1424  * BOLT11 or BOLT12 invoice).
1425  */
1426 typedef struct MUST_USE_STRUCT LDKRecipientOnionFields {
1427    /**
1428     * A pointer to the opaque Rust object.
1429     * Nearly everywhere, inner must be non-null, however in places where
1430     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1431     */
1432    LDKnativeRecipientOnionFields *inner;
1433    /**
1434     * Indicates that this is the only struct which contains the same pointer.
1435     * Rust functions which take ownership of an object provided via an argument require
1436     * this to be true and invalidate the object pointed to by inner.
1437     */
1438    bool is_owned;
1439 } LDKRecipientOnionFields;
1440
1441 /**
1442  * An error in decoding a message or struct.
1443  */
1444 typedef enum LDKDecodeError_Tag {
1445    /**
1446     * A version byte specified something we don't know how to handle.
1447     *
1448     * Includes unknown realm byte in an onion hop data packet.
1449     */
1450    LDKDecodeError_UnknownVersion,
1451    /**
1452     * Unknown feature mandating we fail to parse message (e.g., TLV with an even, unknown type)
1453     */
1454    LDKDecodeError_UnknownRequiredFeature,
1455    /**
1456     * Value was invalid.
1457     *
1458     * For example, a byte which was supposed to be a bool was something other than a 0
1459     * or 1, a public key/private key/signature was invalid, text wasn't UTF-8, TLV was
1460     * syntactically incorrect, etc.
1461     */
1462    LDKDecodeError_InvalidValue,
1463    /**
1464     * The buffer to be read was too short.
1465     */
1466    LDKDecodeError_ShortRead,
1467    /**
1468     * A length descriptor in the packet didn't describe the later data correctly.
1469     */
1470    LDKDecodeError_BadLengthDescriptor,
1471    /**
1472     * Error from [`std::io`].
1473     */
1474    LDKDecodeError_Io,
1475    /**
1476     * The message included zlib-compressed values, which we don't support.
1477     */
1478    LDKDecodeError_UnsupportedCompression,
1479    /**
1480     * Must be last for serialization purposes
1481     */
1482    LDKDecodeError_Sentinel,
1483 } LDKDecodeError_Tag;
1484
1485 typedef struct MUST_USE_STRUCT LDKDecodeError {
1486    LDKDecodeError_Tag tag;
1487    union {
1488       struct {
1489          enum LDKIOError io;
1490       };
1491    };
1492 } LDKDecodeError;
1493
1494 /**
1495  * The contents of CResult_RecipientOnionFieldsDecodeErrorZ
1496  */
1497 typedef union LDKCResult_RecipientOnionFieldsDecodeErrorZPtr {
1498    /**
1499     * A pointer to the contents in the success state.
1500     * Reading from this pointer when `result_ok` is not set is undefined.
1501     */
1502    struct LDKRecipientOnionFields *result;
1503    /**
1504     * A pointer to the contents in the error state.
1505     * Reading from this pointer when `result_ok` is set is undefined.
1506     */
1507    struct LDKDecodeError *err;
1508 } LDKCResult_RecipientOnionFieldsDecodeErrorZPtr;
1509
1510 /**
1511  * A CResult_RecipientOnionFieldsDecodeErrorZ represents the result of a fallible operation,
1512  * containing a crate::lightning::ln::outbound_payment::RecipientOnionFields on success and a crate::lightning::ln::msgs::DecodeError on failure.
1513  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1514  */
1515 typedef struct LDKCResult_RecipientOnionFieldsDecodeErrorZ {
1516    /**
1517     * The contents of this CResult_RecipientOnionFieldsDecodeErrorZ, accessible via either
1518     * `err` or `result` depending on the state of `result_ok`.
1519     */
1520    union LDKCResult_RecipientOnionFieldsDecodeErrorZPtr contents;
1521    /**
1522     * Whether this CResult_RecipientOnionFieldsDecodeErrorZ represents a success state.
1523     */
1524    bool result_ok;
1525 } LDKCResult_RecipientOnionFieldsDecodeErrorZ;
1526
1527
1528
1529 /**
1530  * Information needed to route a payment across a [`BlindedPath`].
1531  */
1532 typedef struct MUST_USE_STRUCT LDKBlindedPayInfo {
1533    /**
1534     * A pointer to the opaque Rust object.
1535     * Nearly everywhere, inner must be non-null, however in places where
1536     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1537     */
1538    LDKnativeBlindedPayInfo *inner;
1539    /**
1540     * Indicates that this is the only struct which contains the same pointer.
1541     * Rust functions which take ownership of an object provided via an argument require
1542     * this to be true and invalidate the object pointed to by inner.
1543     */
1544    bool is_owned;
1545 } LDKBlindedPayInfo;
1546
1547 /**
1548  * The contents of CResult_BlindedPayInfoDecodeErrorZ
1549  */
1550 typedef union LDKCResult_BlindedPayInfoDecodeErrorZPtr {
1551    /**
1552     * A pointer to the contents in the success state.
1553     * Reading from this pointer when `result_ok` is not set is undefined.
1554     */
1555    struct LDKBlindedPayInfo *result;
1556    /**
1557     * A pointer to the contents in the error state.
1558     * Reading from this pointer when `result_ok` is set is undefined.
1559     */
1560    struct LDKDecodeError *err;
1561 } LDKCResult_BlindedPayInfoDecodeErrorZPtr;
1562
1563 /**
1564  * A CResult_BlindedPayInfoDecodeErrorZ represents the result of a fallible operation,
1565  * containing a crate::lightning::offers::invoice::BlindedPayInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
1566  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1567  */
1568 typedef struct LDKCResult_BlindedPayInfoDecodeErrorZ {
1569    /**
1570     * The contents of this CResult_BlindedPayInfoDecodeErrorZ, accessible via either
1571     * `err` or `result` depending on the state of `result_ok`.
1572     */
1573    union LDKCResult_BlindedPayInfoDecodeErrorZPtr contents;
1574    /**
1575     * Whether this CResult_BlindedPayInfoDecodeErrorZ represents a success state.
1576     */
1577    bool result_ok;
1578 } LDKCResult_BlindedPayInfoDecodeErrorZ;
1579
1580
1581
1582 /**
1583  * Information about a spendable output to a P2WSH script.
1584  *
1585  * See [`SpendableOutputDescriptor::DelayedPaymentOutput`] for more details on how to spend this.
1586  */
1587 typedef struct MUST_USE_STRUCT LDKDelayedPaymentOutputDescriptor {
1588    /**
1589     * A pointer to the opaque Rust object.
1590     * Nearly everywhere, inner must be non-null, however in places where
1591     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1592     */
1593    LDKnativeDelayedPaymentOutputDescriptor *inner;
1594    /**
1595     * Indicates that this is the only struct which contains the same pointer.
1596     * Rust functions which take ownership of an object provided via an argument require
1597     * this to be true and invalidate the object pointed to by inner.
1598     */
1599    bool is_owned;
1600 } LDKDelayedPaymentOutputDescriptor;
1601
1602 /**
1603  * The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
1604  */
1605 typedef union LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
1606    /**
1607     * A pointer to the contents in the success state.
1608     * Reading from this pointer when `result_ok` is not set is undefined.
1609     */
1610    struct LDKDelayedPaymentOutputDescriptor *result;
1611    /**
1612     * A pointer to the contents in the error state.
1613     * Reading from this pointer when `result_ok` is set is undefined.
1614     */
1615    struct LDKDecodeError *err;
1616 } LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr;
1617
1618 /**
1619  * A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
1620  * containing a crate::lightning::sign::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
1621  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1622  */
1623 typedef struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
1624    /**
1625     * The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
1626     * `err` or `result` depending on the state of `result_ok`.
1627     */
1628    union LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr contents;
1629    /**
1630     * Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
1631     */
1632    bool result_ok;
1633 } LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ;
1634
1635
1636
1637 /**
1638  * Information about a spendable output to our \"payment key\".
1639  *
1640  * See [`SpendableOutputDescriptor::StaticPaymentOutput`] for more details on how to spend this.
1641  */
1642 typedef struct MUST_USE_STRUCT LDKStaticPaymentOutputDescriptor {
1643    /**
1644     * A pointer to the opaque Rust object.
1645     * Nearly everywhere, inner must be non-null, however in places where
1646     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1647     */
1648    LDKnativeStaticPaymentOutputDescriptor *inner;
1649    /**
1650     * Indicates that this is the only struct which contains the same pointer.
1651     * Rust functions which take ownership of an object provided via an argument require
1652     * this to be true and invalidate the object pointed to by inner.
1653     */
1654    bool is_owned;
1655 } LDKStaticPaymentOutputDescriptor;
1656
1657 /**
1658  * The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
1659  */
1660 typedef union LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
1661    /**
1662     * A pointer to the contents in the success state.
1663     * Reading from this pointer when `result_ok` is not set is undefined.
1664     */
1665    struct LDKStaticPaymentOutputDescriptor *result;
1666    /**
1667     * A pointer to the contents in the error state.
1668     * Reading from this pointer when `result_ok` is set is undefined.
1669     */
1670    struct LDKDecodeError *err;
1671 } LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr;
1672
1673 /**
1674  * A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
1675  * containing a crate::lightning::sign::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
1676  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1677  */
1678 typedef struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ {
1679    /**
1680     * The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
1681     * `err` or `result` depending on the state of `result_ok`.
1682     */
1683    union LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr contents;
1684    /**
1685     * Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
1686     */
1687    bool result_ok;
1688 } LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ;
1689
1690
1691
1692 /**
1693  * A reference to a transaction output.
1694  *
1695  * Differs from bitcoin::blockdata::transaction::OutPoint as the index is a u16 instead of u32
1696  * due to LN's restrictions on index values. Should reduce (possibly) unsafe conversions this way.
1697  */
1698 typedef struct MUST_USE_STRUCT LDKOutPoint {
1699    /**
1700     * A pointer to the opaque Rust object.
1701     * Nearly everywhere, inner must be non-null, however in places where
1702     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1703     */
1704    LDKnativeOutPoint *inner;
1705    /**
1706     * Indicates that this is the only struct which contains the same pointer.
1707     * Rust functions which take ownership of an object provided via an argument require
1708     * this to be true and invalidate the object pointed to by inner.
1709     */
1710    bool is_owned;
1711 } LDKOutPoint;
1712
1713 /**
1714  * Describes the necessary information to spend a spendable output.
1715  *
1716  * When on-chain outputs are created by LDK (which our counterparty is not able to claim at any
1717  * point in the future) a [`SpendableOutputs`] event is generated which you must track and be able
1718  * to spend on-chain. The information needed to do this is provided in this enum, including the
1719  * outpoint describing which `txid` and output `index` is available, the full output which exists
1720  * at that `txid`/`index`, and any keys or other information required to sign.
1721  *
1722  * [`SpendableOutputs`]: crate::events::Event::SpendableOutputs
1723  */
1724 typedef enum LDKSpendableOutputDescriptor_Tag {
1725    /**
1726     * An output to a script which was provided via [`SignerProvider`] directly, either from
1727     * [`get_destination_script`] or [`get_shutdown_scriptpubkey`], thus you should already
1728     * know how to spend it. No secret keys are provided as LDK was never given any key.
1729     * These may include outputs from a transaction punishing our counterparty or claiming an HTLC
1730     * on-chain using the payment preimage or after it has timed out.
1731     *
1732     * [`get_shutdown_scriptpubkey`]: SignerProvider::get_shutdown_scriptpubkey
1733     * [`get_destination_script`]: SignerProvider::get_shutdown_scriptpubkey
1734     */
1735    LDKSpendableOutputDescriptor_StaticOutput,
1736    /**
1737     * An output to a P2WSH script which can be spent with a single signature after an `OP_CSV`
1738     * delay.
1739     *
1740     * The witness in the spending input should be:
1741     * ```bitcoin
1742     * <BIP 143 signature> <empty vector> (MINIMALIF standard rule) <provided witnessScript>
1743     * ```
1744     *
1745     * Note that the `nSequence` field in the spending input must be set to
1746     * [`DelayedPaymentOutputDescriptor::to_self_delay`] (which means the transaction is not
1747     * broadcastable until at least [`DelayedPaymentOutputDescriptor::to_self_delay`] blocks after
1748     * the outpoint confirms, see [BIP
1749     * 68](https://github.com/bitcoin/bips/blob/master/bip-0068.mediawiki)). Also note that LDK
1750     * won't generate a [`SpendableOutputDescriptor`] until the corresponding block height
1751     * is reached.
1752     *
1753     * These are generally the result of a \"revocable\" output to us, spendable only by us unless
1754     * it is an output from an old state which we broadcast (which should never happen).
1755     *
1756     * To derive the delayed payment key which is used to sign this input, you must pass the
1757     * holder [`InMemorySigner::delayed_payment_base_key`] (i.e., the private key which corresponds to the
1758     * [`ChannelPublicKeys::delayed_payment_basepoint`] in [`ChannelSigner::pubkeys`]) and the provided
1759     * [`DelayedPaymentOutputDescriptor::per_commitment_point`] to [`chan_utils::derive_private_key`]. The public key can be
1760     * generated without the secret key using [`chan_utils::derive_public_key`] and only the
1761     * [`ChannelPublicKeys::delayed_payment_basepoint`] which appears in [`ChannelSigner::pubkeys`].
1762     *
1763     * To derive the [`DelayedPaymentOutputDescriptor::revocation_pubkey`] provided here (which is
1764     * used in the witness script generation), you must pass the counterparty
1765     * [`ChannelPublicKeys::revocation_basepoint`] (which appears in the call to
1766     * [`ChannelSigner::provide_channel_parameters`]) and the provided
1767     * [`DelayedPaymentOutputDescriptor::per_commitment_point`] to
1768     * [`chan_utils::derive_public_revocation_key`].
1769     *
1770     * The witness script which is hashed and included in the output `script_pubkey` may be
1771     * regenerated by passing the [`DelayedPaymentOutputDescriptor::revocation_pubkey`] (derived
1772     * as explained above), our delayed payment pubkey (derived as explained above), and the
1773     * [`DelayedPaymentOutputDescriptor::to_self_delay`] contained here to
1774     * [`chan_utils::get_revokeable_redeemscript`].
1775     */
1776    LDKSpendableOutputDescriptor_DelayedPaymentOutput,
1777    /**
1778     * An output to a P2WPKH, spendable exclusively by our payment key (i.e., the private key
1779     * which corresponds to the `payment_point` in [`ChannelSigner::pubkeys`]). The witness
1780     * in the spending input is, thus, simply:
1781     * ```bitcoin
1782     * <BIP 143 signature> <payment key>
1783     * ```
1784     *
1785     * These are generally the result of our counterparty having broadcast the current state,
1786     * allowing us to claim the non-HTLC-encumbered outputs immediately.
1787     */
1788    LDKSpendableOutputDescriptor_StaticPaymentOutput,
1789    /**
1790     * Must be last for serialization purposes
1791     */
1792    LDKSpendableOutputDescriptor_Sentinel,
1793 } LDKSpendableOutputDescriptor_Tag;
1794
1795 typedef struct LDKSpendableOutputDescriptor_LDKStaticOutput_Body {
1796    /**
1797     * The outpoint which is spendable.
1798     */
1799    struct LDKOutPoint outpoint;
1800    /**
1801     * The output which is referenced by the given outpoint.
1802     */
1803    struct LDKTxOut output;
1804 } LDKSpendableOutputDescriptor_LDKStaticOutput_Body;
1805
1806 typedef struct MUST_USE_STRUCT LDKSpendableOutputDescriptor {
1807    LDKSpendableOutputDescriptor_Tag tag;
1808    union {
1809       LDKSpendableOutputDescriptor_LDKStaticOutput_Body static_output;
1810       struct {
1811          struct LDKDelayedPaymentOutputDescriptor delayed_payment_output;
1812       };
1813       struct {
1814          struct LDKStaticPaymentOutputDescriptor static_payment_output;
1815       };
1816    };
1817 } LDKSpendableOutputDescriptor;
1818
1819 /**
1820  * The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
1821  */
1822 typedef union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr {
1823    /**
1824     * A pointer to the contents in the success state.
1825     * Reading from this pointer when `result_ok` is not set is undefined.
1826     */
1827    struct LDKSpendableOutputDescriptor *result;
1828    /**
1829     * A pointer to the contents in the error state.
1830     * Reading from this pointer when `result_ok` is set is undefined.
1831     */
1832    struct LDKDecodeError *err;
1833 } LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr;
1834
1835 /**
1836  * A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
1837  * containing a crate::lightning::sign::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
1838  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1839  */
1840 typedef struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ {
1841    /**
1842     * The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
1843     * `err` or `result` depending on the state of `result_ok`.
1844     */
1845    union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr contents;
1846    /**
1847     * Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
1848     */
1849    bool result_ok;
1850 } LDKCResult_SpendableOutputDescriptorDecodeErrorZ;
1851
1852 /**
1853  * A dynamically-allocated array of crate::lightning::sign::SpendableOutputDescriptors of arbitrary size.
1854  * This corresponds to std::vector in C++
1855  */
1856 typedef struct LDKCVec_SpendableOutputDescriptorZ {
1857    /**
1858     * The elements in the array.
1859     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1860     */
1861    struct LDKSpendableOutputDescriptor *data;
1862    /**
1863     * The number of elements pointed to by `data`.
1864     */
1865    uintptr_t datalen;
1866 } LDKCVec_SpendableOutputDescriptorZ;
1867
1868 /**
1869  * A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
1870  * This corresponds to std::vector in C++
1871  */
1872 typedef struct LDKCVec_TxOutZ {
1873    /**
1874     * The elements in the array.
1875     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1876     */
1877    struct LDKTxOut *data;
1878    /**
1879     * The number of elements pointed to by `data`.
1880     */
1881    uintptr_t datalen;
1882 } LDKCVec_TxOutZ;
1883
1884 /**
1885  * An enum which can either contain a u32 or not
1886  */
1887 typedef enum LDKCOption_PackedLockTimeZ_Tag {
1888    /**
1889     * When we're in this state, this COption_PackedLockTimeZ contains a u32
1890     */
1891    LDKCOption_PackedLockTimeZ_Some,
1892    /**
1893     * When we're in this state, this COption_PackedLockTimeZ contains nothing
1894     */
1895    LDKCOption_PackedLockTimeZ_None,
1896    /**
1897     * Must be last for serialization purposes
1898     */
1899    LDKCOption_PackedLockTimeZ_Sentinel,
1900 } LDKCOption_PackedLockTimeZ_Tag;
1901
1902 typedef struct LDKCOption_PackedLockTimeZ {
1903    LDKCOption_PackedLockTimeZ_Tag tag;
1904    union {
1905       struct {
1906          uint32_t some;
1907       };
1908    };
1909 } LDKCOption_PackedLockTimeZ;
1910
1911 /**
1912  * A tuple of 2 elements. See the individual fields for the types contained.
1913  */
1914 typedef struct LDKC2Tuple_PartiallySignedTransactionusizeZ {
1915    /**
1916     * The element at position 0
1917     */
1918    struct LDKCVec_u8Z a;
1919    /**
1920     * The element at position 1
1921     */
1922    uintptr_t b;
1923 } LDKC2Tuple_PartiallySignedTransactionusizeZ;
1924
1925 /**
1926  * The contents of CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ
1927  */
1928 typedef union LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZPtr {
1929    /**
1930     * A pointer to the contents in the success state.
1931     * Reading from this pointer when `result_ok` is not set is undefined.
1932     */
1933    struct LDKC2Tuple_PartiallySignedTransactionusizeZ *result;
1934    /**
1935     * Note that this value is always NULL, as there are no contents in the Err variant
1936     */
1937    void *err;
1938 } LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZPtr;
1939
1940 /**
1941  * A CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ represents the result of a fallible operation,
1942  * containing a crate::c_types::derived::C2Tuple_PartiallySignedTransactionusizeZ on success and a () on failure.
1943  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1944  */
1945 typedef struct LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ {
1946    /**
1947     * The contents of this CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ, accessible via either
1948     * `err` or `result` depending on the state of `result_ok`.
1949     */
1950    union LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZPtr contents;
1951    /**
1952     * Whether this CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ represents a success state.
1953     */
1954    bool result_ok;
1955 } LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ;
1956
1957 /**
1958  * A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
1959  * This corresponds to std::vector in C++
1960  */
1961 typedef struct LDKCVec_PaymentPreimageZ {
1962    /**
1963     * The elements in the array.
1964     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1965     */
1966    struct LDKThirtyTwoBytes *data;
1967    /**
1968     * The number of elements pointed to by `data`.
1969     */
1970    uintptr_t datalen;
1971 } LDKCVec_PaymentPreimageZ;
1972
1973 /**
1974  * The contents of CResult_NoneNoneZ
1975  */
1976 typedef union LDKCResult_NoneNoneZPtr {
1977    /**
1978     * Note that this value is always NULL, as there are no contents in the OK variant
1979     */
1980    void *result;
1981    /**
1982     * Note that this value is always NULL, as there are no contents in the Err variant
1983     */
1984    void *err;
1985 } LDKCResult_NoneNoneZPtr;
1986
1987 /**
1988  * A CResult_NoneNoneZ represents the result of a fallible operation,
1989  * containing a () on success and a () on failure.
1990  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1991  */
1992 typedef struct LDKCResult_NoneNoneZ {
1993    /**
1994     * The contents of this CResult_NoneNoneZ, accessible via either
1995     * `err` or `result` depending on the state of `result_ok`.
1996     */
1997    union LDKCResult_NoneNoneZPtr contents;
1998    /**
1999     * Whether this CResult_NoneNoneZ represents a success state.
2000     */
2001    bool result_ok;
2002 } LDKCResult_NoneNoneZ;
2003
2004 /**
2005  * Represents a secp256k1 signature serialized as two 32-byte numbers
2006  */
2007 typedef struct LDKSignature {
2008    /**
2009     * The bytes of the signature in "compact" form
2010     */
2011    uint8_t compact_form[64];
2012 } LDKSignature;
2013
2014 /**
2015  * A dynamically-allocated array of crate::c_types::Signatures of arbitrary size.
2016  * This corresponds to std::vector in C++
2017  */
2018 typedef struct LDKCVec_SignatureZ {
2019    /**
2020     * The elements in the array.
2021     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2022     */
2023    struct LDKSignature *data;
2024    /**
2025     * The number of elements pointed to by `data`.
2026     */
2027    uintptr_t datalen;
2028 } LDKCVec_SignatureZ;
2029
2030 /**
2031  * A tuple of 2 elements. See the individual fields for the types contained.
2032  */
2033 typedef struct LDKC2Tuple_SignatureCVec_SignatureZZ {
2034    /**
2035     * The element at position 0
2036     */
2037    struct LDKSignature a;
2038    /**
2039     * The element at position 1
2040     */
2041    struct LDKCVec_SignatureZ b;
2042 } LDKC2Tuple_SignatureCVec_SignatureZZ;
2043
2044 /**
2045  * The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
2046  */
2047 typedef union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
2048    /**
2049     * A pointer to the contents in the success state.
2050     * Reading from this pointer when `result_ok` is not set is undefined.
2051     */
2052    struct LDKC2Tuple_SignatureCVec_SignatureZZ *result;
2053    /**
2054     * Note that this value is always NULL, as there are no contents in the Err variant
2055     */
2056    void *err;
2057 } LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr;
2058
2059 /**
2060  * A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
2061  * containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
2062  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2063  */
2064 typedef struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
2065    /**
2066     * The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
2067     * `err` or `result` depending on the state of `result_ok`.
2068     */
2069    union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr contents;
2070    /**
2071     * Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
2072     */
2073    bool result_ok;
2074 } LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ;
2075
2076 /**
2077  * The contents of CResult_SignatureNoneZ
2078  */
2079 typedef union LDKCResult_SignatureNoneZPtr {
2080    /**
2081     * A pointer to the contents in the success state.
2082     * Reading from this pointer when `result_ok` is not set is undefined.
2083     */
2084    struct LDKSignature *result;
2085    /**
2086     * Note that this value is always NULL, as there are no contents in the Err variant
2087     */
2088    void *err;
2089 } LDKCResult_SignatureNoneZPtr;
2090
2091 /**
2092  * A CResult_SignatureNoneZ represents the result of a fallible operation,
2093  * containing a crate::c_types::Signature on success and a () on failure.
2094  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2095  */
2096 typedef struct LDKCResult_SignatureNoneZ {
2097    /**
2098     * The contents of this CResult_SignatureNoneZ, accessible via either
2099     * `err` or `result` depending on the state of `result_ok`.
2100     */
2101    union LDKCResult_SignatureNoneZPtr contents;
2102    /**
2103     * Whether this CResult_SignatureNoneZ represents a success state.
2104     */
2105    bool result_ok;
2106 } LDKCResult_SignatureNoneZ;
2107
2108 /**
2109  * Represents a valid secp256k1 public key serialized in "compressed form" as a 33 byte array.
2110  */
2111 typedef struct LDKPublicKey {
2112    /**
2113     * The bytes of the public key
2114     */
2115    uint8_t compressed_form[33];
2116 } LDKPublicKey;
2117
2118 /**
2119  * The contents of CResult_PublicKeyNoneZ
2120  */
2121 typedef union LDKCResult_PublicKeyNoneZPtr {
2122    /**
2123     * A pointer to the contents in the success state.
2124     * Reading from this pointer when `result_ok` is not set is undefined.
2125     */
2126    struct LDKPublicKey *result;
2127    /**
2128     * Note that this value is always NULL, as there are no contents in the Err variant
2129     */
2130    void *err;
2131 } LDKCResult_PublicKeyNoneZPtr;
2132
2133 /**
2134  * A CResult_PublicKeyNoneZ represents the result of a fallible operation,
2135  * containing a crate::c_types::PublicKey on success and a () on failure.
2136  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2137  */
2138 typedef struct LDKCResult_PublicKeyNoneZ {
2139    /**
2140     * The contents of this CResult_PublicKeyNoneZ, accessible via either
2141     * `err` or `result` depending on the state of `result_ok`.
2142     */
2143    union LDKCResult_PublicKeyNoneZPtr contents;
2144    /**
2145     * Whether this CResult_PublicKeyNoneZ represents a success state.
2146     */
2147    bool result_ok;
2148 } LDKCResult_PublicKeyNoneZ;
2149
2150 /**
2151  * An enum which can either contain a crate::c_types::BigEndianScalar or not
2152  */
2153 typedef enum LDKCOption_ScalarZ_Tag {
2154    /**
2155     * When we're in this state, this COption_ScalarZ contains a crate::c_types::BigEndianScalar
2156     */
2157    LDKCOption_ScalarZ_Some,
2158    /**
2159     * When we're in this state, this COption_ScalarZ contains nothing
2160     */
2161    LDKCOption_ScalarZ_None,
2162    /**
2163     * Must be last for serialization purposes
2164     */
2165    LDKCOption_ScalarZ_Sentinel,
2166 } LDKCOption_ScalarZ_Tag;
2167
2168 typedef struct LDKCOption_ScalarZ {
2169    LDKCOption_ScalarZ_Tag tag;
2170    union {
2171       struct {
2172          struct LDKBigEndianScalar some;
2173       };
2174    };
2175 } LDKCOption_ScalarZ;
2176
2177 /**
2178  * The contents of CResult_SharedSecretNoneZ
2179  */
2180 typedef union LDKCResult_SharedSecretNoneZPtr {
2181    /**
2182     * A pointer to the contents in the success state.
2183     * Reading from this pointer when `result_ok` is not set is undefined.
2184     */
2185    struct LDKThirtyTwoBytes *result;
2186    /**
2187     * Note that this value is always NULL, as there are no contents in the Err variant
2188     */
2189    void *err;
2190 } LDKCResult_SharedSecretNoneZPtr;
2191
2192 /**
2193  * A CResult_SharedSecretNoneZ represents the result of a fallible operation,
2194  * containing a crate::c_types::ThirtyTwoBytes on success and a () on failure.
2195  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2196  */
2197 typedef struct LDKCResult_SharedSecretNoneZ {
2198    /**
2199     * The contents of this CResult_SharedSecretNoneZ, accessible via either
2200     * `err` or `result` depending on the state of `result_ok`.
2201     */
2202    union LDKCResult_SharedSecretNoneZPtr contents;
2203    /**
2204     * Whether this CResult_SharedSecretNoneZ represents a success state.
2205     */
2206    bool result_ok;
2207 } LDKCResult_SharedSecretNoneZ;
2208
2209 /**
2210  * Integer in the range `0..32`
2211  */
2212 typedef struct LDKU5 {
2213    uint8_t _0;
2214 } LDKU5;
2215
2216 /**
2217  * A dynamically-allocated array of crate::c_types::U5s of arbitrary size.
2218  * This corresponds to std::vector in C++
2219  */
2220 typedef struct LDKCVec_U5Z {
2221    /**
2222     * The elements in the array.
2223     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2224     */
2225    struct LDKU5 *data;
2226    /**
2227     * The number of elements pointed to by `data`.
2228     */
2229    uintptr_t datalen;
2230 } LDKCVec_U5Z;
2231
2232 /**
2233  * Represents a secp256k1 signature serialized as two 32-byte numbers as well as a tag which
2234  * allows recovering the exact public key which created the signature given the message.
2235  */
2236 typedef struct LDKRecoverableSignature {
2237    /**
2238     * The bytes of the signature in "compact" form plus a "Recovery ID" which allows for
2239     * recovery.
2240     */
2241    uint8_t serialized_form[68];
2242 } LDKRecoverableSignature;
2243
2244 /**
2245  * The contents of CResult_RecoverableSignatureNoneZ
2246  */
2247 typedef union LDKCResult_RecoverableSignatureNoneZPtr {
2248    /**
2249     * A pointer to the contents in the success state.
2250     * Reading from this pointer when `result_ok` is not set is undefined.
2251     */
2252    struct LDKRecoverableSignature *result;
2253    /**
2254     * Note that this value is always NULL, as there are no contents in the Err variant
2255     */
2256    void *err;
2257 } LDKCResult_RecoverableSignatureNoneZPtr;
2258
2259 /**
2260  * A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
2261  * containing a crate::c_types::RecoverableSignature on success and a () on failure.
2262  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2263  */
2264 typedef struct LDKCResult_RecoverableSignatureNoneZ {
2265    /**
2266     * The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
2267     * `err` or `result` depending on the state of `result_ok`.
2268     */
2269    union LDKCResult_RecoverableSignatureNoneZPtr contents;
2270    /**
2271     * Whether this CResult_RecoverableSignatureNoneZ represents a success state.
2272     */
2273    bool result_ok;
2274 } LDKCResult_RecoverableSignatureNoneZ;
2275
2276
2277
2278 /**
2279  * This class tracks the per-transaction information needed to build a commitment transaction and will
2280  * actually build it and sign.  It is used for holder transactions that we sign only when needed
2281  * and for transactions we sign for the counterparty.
2282  *
2283  * This class can be used inside a signer implementation to generate a signature given the relevant
2284  * secret key.
2285  */
2286 typedef struct MUST_USE_STRUCT LDKCommitmentTransaction {
2287    /**
2288     * A pointer to the opaque Rust object.
2289     * Nearly everywhere, inner must be non-null, however in places where
2290     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2291     */
2292    LDKnativeCommitmentTransaction *inner;
2293    /**
2294     * Indicates that this is the only struct which contains the same pointer.
2295     * Rust functions which take ownership of an object provided via an argument require
2296     * this to be true and invalidate the object pointed to by inner.
2297     */
2298    bool is_owned;
2299 } LDKCommitmentTransaction;
2300
2301
2302
2303 /**
2304  * Information needed to build and sign a holder's commitment transaction.
2305  *
2306  * The transaction is only signed once we are ready to broadcast.
2307  */
2308 typedef struct MUST_USE_STRUCT LDKHolderCommitmentTransaction {
2309    /**
2310     * A pointer to the opaque Rust object.
2311     * Nearly everywhere, inner must be non-null, however in places where
2312     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2313     */
2314    LDKnativeHolderCommitmentTransaction *inner;
2315    /**
2316     * Indicates that this is the only struct which contains the same pointer.
2317     * Rust functions which take ownership of an object provided via an argument require
2318     * this to be true and invalidate the object pointed to by inner.
2319     */
2320    bool is_owned;
2321 } LDKHolderCommitmentTransaction;
2322
2323
2324
2325 /**
2326  * Information about an HTLC as it appears in a commitment transaction
2327  */
2328 typedef struct MUST_USE_STRUCT LDKHTLCOutputInCommitment {
2329    /**
2330     * A pointer to the opaque Rust object.
2331     * Nearly everywhere, inner must be non-null, however in places where
2332     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2333     */
2334    LDKnativeHTLCOutputInCommitment *inner;
2335    /**
2336     * Indicates that this is the only struct which contains the same pointer.
2337     * Rust functions which take ownership of an object provided via an argument require
2338     * this to be true and invalidate the object pointed to by inner.
2339     */
2340    bool is_owned;
2341 } LDKHTLCOutputInCommitment;
2342
2343
2344
2345 /**
2346  * A descriptor used to sign for a commitment transaction's HTLC output.
2347  */
2348 typedef struct MUST_USE_STRUCT LDKHTLCDescriptor {
2349    /**
2350     * A pointer to the opaque Rust object.
2351     * Nearly everywhere, inner must be non-null, however in places where
2352     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2353     */
2354    LDKnativeHTLCDescriptor *inner;
2355    /**
2356     * Indicates that this is the only struct which contains the same pointer.
2357     * Rust functions which take ownership of an object provided via an argument require
2358     * this to be true and invalidate the object pointed to by inner.
2359     */
2360    bool is_owned;
2361 } LDKHTLCDescriptor;
2362
2363
2364
2365 /**
2366  * This class tracks the per-transaction information needed to build a closing transaction and will
2367  * actually build it and sign.
2368  *
2369  * This class can be used inside a signer implementation to generate a signature given the relevant
2370  * secret key.
2371  */
2372 typedef struct MUST_USE_STRUCT LDKClosingTransaction {
2373    /**
2374     * A pointer to the opaque Rust object.
2375     * Nearly everywhere, inner must be non-null, however in places where
2376     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2377     */
2378    LDKnativeClosingTransaction *inner;
2379    /**
2380     * Indicates that this is the only struct which contains the same pointer.
2381     * Rust functions which take ownership of an object provided via an argument require
2382     * this to be true and invalidate the object pointed to by inner.
2383     */
2384    bool is_owned;
2385 } LDKClosingTransaction;
2386
2387
2388
2389 /**
2390  * The unsigned part of a [`channel_announcement`] message.
2391  *
2392  * [`channel_announcement`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-channel_announcement-message
2393  */
2394 typedef struct MUST_USE_STRUCT LDKUnsignedChannelAnnouncement {
2395    /**
2396     * A pointer to the opaque Rust object.
2397     * Nearly everywhere, inner must be non-null, however in places where
2398     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2399     */
2400    LDKnativeUnsignedChannelAnnouncement *inner;
2401    /**
2402     * Indicates that this is the only struct which contains the same pointer.
2403     * Rust functions which take ownership of an object provided via an argument require
2404     * this to be true and invalidate the object pointed to by inner.
2405     */
2406    bool is_owned;
2407 } LDKUnsignedChannelAnnouncement;
2408
2409
2410
2411 /**
2412  * One counterparty's public keys which do not change over the life of a channel.
2413  */
2414 typedef struct MUST_USE_STRUCT LDKChannelPublicKeys {
2415    /**
2416     * A pointer to the opaque Rust object.
2417     * Nearly everywhere, inner must be non-null, however in places where
2418     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2419     */
2420    LDKnativeChannelPublicKeys *inner;
2421    /**
2422     * Indicates that this is the only struct which contains the same pointer.
2423     * Rust functions which take ownership of an object provided via an argument require
2424     * this to be true and invalidate the object pointed to by inner.
2425     */
2426    bool is_owned;
2427 } LDKChannelPublicKeys;
2428
2429
2430
2431 /**
2432  * Per-channel data used to build transactions in conjunction with the per-commitment data (CommitmentTransaction).
2433  * The fields are organized by holder/counterparty.
2434  *
2435  * Normally, this is converted to the broadcaster/countersignatory-organized DirectedChannelTransactionParameters
2436  * before use, via the as_holder_broadcastable and as_counterparty_broadcastable functions.
2437  */
2438 typedef struct MUST_USE_STRUCT LDKChannelTransactionParameters {
2439    /**
2440     * A pointer to the opaque Rust object.
2441     * Nearly everywhere, inner must be non-null, however in places where
2442     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2443     */
2444    LDKnativeChannelTransactionParameters *inner;
2445    /**
2446     * Indicates that this is the only struct which contains the same pointer.
2447     * Rust functions which take ownership of an object provided via an argument require
2448     * this to be true and invalidate the object pointed to by inner.
2449     */
2450    bool is_owned;
2451 } LDKChannelTransactionParameters;
2452
2453 /**
2454  * A trait to handle Lightning channel key material without concretizing the channel type or
2455  * the signature mechanism.
2456  */
2457 typedef struct LDKChannelSigner {
2458    /**
2459     * An opaque pointer which is passed to your function implementations as an argument.
2460     * This has no meaning in the LDK, and can be NULL or any other value.
2461     */
2462    void *this_arg;
2463    /**
2464     * Gets the per-commitment point for a specific commitment number
2465     *
2466     * Note that the commitment number starts at `(1 << 48) - 1` and counts backwards.
2467     */
2468    struct LDKPublicKey (*get_per_commitment_point)(const void *this_arg, uint64_t idx);
2469    /**
2470     * Gets the commitment secret for a specific commitment number as part of the revocation process
2471     *
2472     * An external signer implementation should error here if the commitment was already signed
2473     * and should refuse to sign it in the future.
2474     *
2475     * May be called more than once for the same index.
2476     *
2477     * Note that the commitment number starts at `(1 << 48) - 1` and counts backwards.
2478     */
2479    struct LDKThirtyTwoBytes (*release_commitment_secret)(const void *this_arg, uint64_t idx);
2480    /**
2481     * Validate the counterparty's signatures on the holder commitment transaction and HTLCs.
2482     *
2483     * This is required in order for the signer to make sure that releasing a commitment
2484     * secret won't leave us without a broadcastable holder transaction.
2485     * Policy checks should be implemented in this function, including checking the amount
2486     * sent to us and checking the HTLCs.
2487     *
2488     * The preimages of outgoing HTLCs that were fulfilled since the last commitment are provided.
2489     * A validating signer should ensure that an HTLC output is removed only when the matching
2490     * preimage is provided, or when the value to holder is restored.
2491     *
2492     * Note that all the relevant preimages will be provided, but there may also be additional
2493     * irrelevant or duplicate preimages.
2494     */
2495    struct LDKCResult_NoneNoneZ (*validate_holder_commitment)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR holder_tx, struct LDKCVec_PaymentPreimageZ preimages);
2496    /**
2497     * Returns the holder's channel public keys and basepoints.
2498     */
2499    struct LDKChannelPublicKeys pubkeys;
2500    /**
2501     * Fill in the pubkeys field as a reference to it will be given to Rust after this returns
2502     * Note that this takes a pointer to this object, not the this_ptr like other methods do
2503     * This function pointer may be NULL if pubkeys is filled in when this object is created and never needs updating.
2504     */
2505    void (*set_pubkeys)(const struct LDKChannelSigner*NONNULL_PTR );
2506    /**
2507     * Returns an arbitrary identifier describing the set of keys which are provided back to you in
2508     * some [`SpendableOutputDescriptor`] types. This should be sufficient to identify this
2509     * [`EcdsaChannelSigner`] object uniquely and lookup or re-derive its keys.
2510     */
2511    struct LDKThirtyTwoBytes (*channel_keys_id)(const void *this_arg);
2512    /**
2513     * Set the counterparty static channel data, including basepoints,
2514     * `counterparty_selected`/`holder_selected_contest_delay` and funding outpoint.
2515     *
2516     * This data is static, and will never change for a channel once set. For a given [`ChannelSigner`]
2517     * instance, LDK will call this method exactly once - either immediately after construction
2518     * (not including if done via [`SignerProvider::read_chan_signer`]) or when the funding
2519     * information has been generated.
2520     *
2521     * channel_parameters.is_populated() MUST be true.
2522     */
2523    void (*provide_channel_parameters)(void *this_arg, const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters);
2524    /**
2525     * Frees any resources associated with this object given its this_arg pointer.
2526     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
2527     */
2528    void (*free)(void *this_arg);
2529 } LDKChannelSigner;
2530
2531 /**
2532  * A trait to sign Lightning channel transactions as described in
2533  * [BOLT 3](https://github.com/lightning/bolts/blob/master/03-transactions.md).
2534  *
2535  * Signing services could be implemented on a hardware wallet and should implement signing
2536  * policies in order to be secure. Please refer to the [VLS Policy
2537  * Controls](https://gitlab.com/lightning-signer/validating-lightning-signer/-/blob/main/docs/policy-controls.md)
2538  * for an example of such policies.
2539  */
2540 typedef struct LDKEcdsaChannelSigner {
2541    /**
2542     * An opaque pointer which is passed to your function implementations as an argument.
2543     * This has no meaning in the LDK, and can be NULL or any other value.
2544     */
2545    void *this_arg;
2546    /**
2547     * Create a signature for a counterparty's commitment transaction and associated HTLC transactions.
2548     *
2549     * Note that if signing fails or is rejected, the channel will be force-closed.
2550     *
2551     * Policy checks should be implemented in this function, including checking the amount
2552     * sent to us and checking the HTLCs.
2553     *
2554     * The preimages of outgoing HTLCs that were fulfilled since the last commitment are provided.
2555     * A validating signer should ensure that an HTLC output is removed only when the matching
2556     * preimage is provided, or when the value to holder is restored.
2557     *
2558     * Note that all the relevant preimages will be provided, but there may also be additional
2559     * irrelevant or duplicate preimages.
2560     */
2561    struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_counterparty_commitment)(const void *this_arg, const struct LDKCommitmentTransaction *NONNULL_PTR commitment_tx, struct LDKCVec_PaymentPreimageZ preimages);
2562    /**
2563     * Validate the counterparty's revocation.
2564     *
2565     * This is required in order for the signer to make sure that the state has moved
2566     * forward and it is safe to sign the next counterparty commitment.
2567     */
2568    struct LDKCResult_NoneNoneZ (*validate_counterparty_revocation)(const void *this_arg, uint64_t idx, const uint8_t (*secret)[32]);
2569    /**
2570     * Creates a signature for a holder's commitment transaction and its claiming HTLC transactions.
2571     *
2572     * This will be called
2573     * - with a non-revoked `commitment_tx`.
2574     * - with the latest `commitment_tx` when we initiate a force-close.
2575     * - with the previous `commitment_tx`, just to get claiming HTLC
2576     *   signatures, if we are reacting to a [`ChannelMonitor`]
2577     *   [replica](https://github.com/lightningdevkit/rust-lightning/blob/main/GLOSSARY.md#monitor-replicas)
2578     *   that decided to broadcast before it had been updated to the latest `commitment_tx`.
2579     *
2580     * This may be called multiple times for the same transaction.
2581     *
2582     * An external signer implementation should check that the commitment has not been revoked.
2583     *
2584     * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor
2585     */
2586    struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_holder_commitment_and_htlcs)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx);
2587    /**
2588     * Create a signature for the given input in a transaction spending an HTLC transaction output
2589     * or a commitment transaction `to_local` output when our counterparty broadcasts an old state.
2590     *
2591     * A justice transaction may claim multiple outputs at the same time if timelocks are
2592     * similar, but only a signature for the input at index `input` should be signed for here.
2593     * It may be called multiple times for same output(s) if a fee-bump is needed with regards
2594     * to an upcoming timelock expiration.
2595     *
2596     * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
2597     *
2598     * `per_commitment_key` is revocation secret which was provided by our counterparty when they
2599     * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
2600     * not allow the spending of any funds by itself (you need our holder `revocation_secret` to do
2601     * so).
2602     */
2603    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]);
2604    /**
2605     * Create a signature for the given input in a transaction spending a commitment transaction
2606     * HTLC output when our counterparty broadcasts an old state.
2607     *
2608     * A justice transaction may claim multiple outputs at the same time if timelocks are
2609     * similar, but only a signature for the input at index `input` should be signed for here.
2610     * It may be called multiple times for same output(s) if a fee-bump is needed with regards
2611     * to an upcoming timelock expiration.
2612     *
2613     * `amount` is the value of the output spent by this input, committed to in the BIP 143
2614     * signature.
2615     *
2616     * `per_commitment_key` is revocation secret which was provided by our counterparty when they
2617     * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
2618     * not allow the spending of any funds by itself (you need our holder revocation_secret to do
2619     * so).
2620     *
2621     * `htlc` holds HTLC elements (hash, timelock), thus changing the format of the witness script
2622     * (which is committed to in the BIP 143 signatures).
2623     */
2624    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);
2625    /**
2626     * Computes the signature for a commitment transaction's HTLC output used as an input within
2627     * `htlc_tx`, which spends the commitment transaction at index `input`. The signature returned
2628     * must be be computed using [`EcdsaSighashType::All`]. Note that this should only be used to
2629     * sign HTLC transactions from channels supporting anchor outputs after all additional
2630     * inputs/outputs have been added to the transaction.
2631     *
2632     * [`EcdsaSighashType::All`]: bitcoin::blockdata::transaction::EcdsaSighashType::All
2633     */
2634    struct LDKCResult_SignatureNoneZ (*sign_holder_htlc_transaction)(const void *this_arg, struct LDKTransaction htlc_tx, uintptr_t input, const struct LDKHTLCDescriptor *NONNULL_PTR htlc_descriptor);
2635    /**
2636     * Create a signature for a claiming transaction for a HTLC output on a counterparty's commitment
2637     * transaction, either offered or received.
2638     *
2639     * Such a transaction may claim multiples offered outputs at same time if we know the
2640     * preimage for each when we create it, but only the input at index `input` should be
2641     * signed for here. It may be called multiple times for same output(s) if a fee-bump is
2642     * needed with regards to an upcoming timelock expiration.
2643     *
2644     * `witness_script` is either an offered or received script as defined in BOLT3 for HTLC
2645     * outputs.
2646     *
2647     * `amount` is value of the output spent by this input, committed to in the BIP 143 signature.
2648     *
2649     * `per_commitment_point` is the dynamic point corresponding to the channel state
2650     * detected onchain. It has been generated by our counterparty and is used to derive
2651     * channel state keys, which are then included in the witness script and committed to in the
2652     * BIP 143 signature.
2653     */
2654    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);
2655    /**
2656     * Create a signature for a (proposed) closing transaction.
2657     *
2658     * Note that, due to rounding, there may be one \"missing\" satoshi, and either party may have
2659     * chosen to forgo their output as dust.
2660     */
2661    struct LDKCResult_SignatureNoneZ (*sign_closing_transaction)(const void *this_arg, const struct LDKClosingTransaction *NONNULL_PTR closing_tx);
2662    /**
2663     * Computes the signature for a commitment transaction's anchor output used as an
2664     * input within `anchor_tx`, which spends the commitment transaction, at index `input`.
2665     */
2666    struct LDKCResult_SignatureNoneZ (*sign_holder_anchor_input)(const void *this_arg, struct LDKTransaction anchor_tx, uintptr_t input);
2667    /**
2668     * Signs a channel announcement message with our funding key proving it comes from one of the
2669     * channel participants.
2670     *
2671     * Channel announcements also require a signature from each node's network key. Our node
2672     * signature is computed through [`NodeSigner::sign_gossip_message`].
2673     *
2674     * Note that if this fails or is rejected, the channel will not be publicly announced and
2675     * our counterparty may (though likely will not) close the channel on us for violating the
2676     * protocol.
2677     */
2678    struct LDKCResult_SignatureNoneZ (*sign_channel_announcement_with_funding_key)(const void *this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg);
2679    /**
2680     * Implementation of ChannelSigner for this object.
2681     */
2682    struct LDKChannelSigner ChannelSigner;
2683    /**
2684     * Frees any resources associated with this object given its this_arg pointer.
2685     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
2686     */
2687    void (*free)(void *this_arg);
2688 } LDKEcdsaChannelSigner;
2689
2690 /**
2691  * A writeable signer.
2692  *
2693  * There will always be two instances of a signer per channel, one occupied by the
2694  * [`ChannelManager`] and another by the channel's [`ChannelMonitor`].
2695  *
2696  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
2697  * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor
2698  */
2699 typedef struct LDKWriteableEcdsaChannelSigner {
2700    /**
2701     * An opaque pointer which is passed to your function implementations as an argument.
2702     * This has no meaning in the LDK, and can be NULL or any other value.
2703     */
2704    void *this_arg;
2705    /**
2706     * Implementation of EcdsaChannelSigner for this object.
2707     */
2708    struct LDKEcdsaChannelSigner EcdsaChannelSigner;
2709    /**
2710     * Serialize the object into a byte array
2711     */
2712    struct LDKCVec_u8Z (*write)(const void *this_arg);
2713    /**
2714     * Frees any resources associated with this object given its this_arg pointer.
2715     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
2716     */
2717    void (*free)(void *this_arg);
2718 } LDKWriteableEcdsaChannelSigner;
2719
2720 /**
2721  * The contents of CResult_WriteableEcdsaChannelSignerDecodeErrorZ
2722  */
2723 typedef union LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZPtr {
2724    /**
2725     * A pointer to the contents in the success state.
2726     * Reading from this pointer when `result_ok` is not set is undefined.
2727     */
2728    struct LDKWriteableEcdsaChannelSigner *result;
2729    /**
2730     * A pointer to the contents in the error state.
2731     * Reading from this pointer when `result_ok` is set is undefined.
2732     */
2733    struct LDKDecodeError *err;
2734 } LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZPtr;
2735
2736 /**
2737  * A CResult_WriteableEcdsaChannelSignerDecodeErrorZ represents the result of a fallible operation,
2738  * containing a crate::lightning::sign::WriteableEcdsaChannelSigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
2739  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2740  */
2741 typedef struct LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ {
2742    /**
2743     * The contents of this CResult_WriteableEcdsaChannelSignerDecodeErrorZ, accessible via either
2744     * `err` or `result` depending on the state of `result_ok`.
2745     */
2746    union LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZPtr contents;
2747    /**
2748     * Whether this CResult_WriteableEcdsaChannelSignerDecodeErrorZ represents a success state.
2749     */
2750    bool result_ok;
2751 } LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ;
2752
2753 /**
2754  * The contents of CResult_ScriptNoneZ
2755  */
2756 typedef union LDKCResult_ScriptNoneZPtr {
2757    /**
2758     * A pointer to the contents in the success state.
2759     * Reading from this pointer when `result_ok` is not set is undefined.
2760     */
2761    struct LDKCVec_u8Z *result;
2762    /**
2763     * Note that this value is always NULL, as there are no contents in the Err variant
2764     */
2765    void *err;
2766 } LDKCResult_ScriptNoneZPtr;
2767
2768 /**
2769  * A CResult_ScriptNoneZ represents the result of a fallible operation,
2770  * containing a crate::c_types::derived::CVec_u8Z on success and a () on failure.
2771  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2772  */
2773 typedef struct LDKCResult_ScriptNoneZ {
2774    /**
2775     * The contents of this CResult_ScriptNoneZ, accessible via either
2776     * `err` or `result` depending on the state of `result_ok`.
2777     */
2778    union LDKCResult_ScriptNoneZPtr contents;
2779    /**
2780     * Whether this CResult_ScriptNoneZ represents a success state.
2781     */
2782    bool result_ok;
2783 } LDKCResult_ScriptNoneZ;
2784
2785 /**
2786  * The contents of CResult_ShutdownScriptNoneZ
2787  */
2788 typedef union LDKCResult_ShutdownScriptNoneZPtr {
2789    /**
2790     * A pointer to the contents in the success state.
2791     * Reading from this pointer when `result_ok` is not set is undefined.
2792     */
2793    struct LDKShutdownScript *result;
2794    /**
2795     * Note that this value is always NULL, as there are no contents in the Err variant
2796     */
2797    void *err;
2798 } LDKCResult_ShutdownScriptNoneZPtr;
2799
2800 /**
2801  * A CResult_ShutdownScriptNoneZ represents the result of a fallible operation,
2802  * containing a crate::lightning::ln::script::ShutdownScript on success and a () on failure.
2803  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2804  */
2805 typedef struct LDKCResult_ShutdownScriptNoneZ {
2806    /**
2807     * The contents of this CResult_ShutdownScriptNoneZ, accessible via either
2808     * `err` or `result` depending on the state of `result_ok`.
2809     */
2810    union LDKCResult_ShutdownScriptNoneZPtr contents;
2811    /**
2812     * Whether this CResult_ShutdownScriptNoneZ represents a success state.
2813     */
2814    bool result_ok;
2815 } LDKCResult_ShutdownScriptNoneZ;
2816
2817 /**
2818  * A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
2819  * This corresponds to std::vector in C++
2820  */
2821 typedef struct LDKCVec_CVec_u8ZZ {
2822    /**
2823     * The elements in the array.
2824     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2825     */
2826    struct LDKCVec_u8Z *data;
2827    /**
2828     * The number of elements pointed to by `data`.
2829     */
2830    uintptr_t datalen;
2831 } LDKCVec_CVec_u8ZZ;
2832
2833 /**
2834  * The contents of CResult_CVec_CVec_u8ZZNoneZ
2835  */
2836 typedef union LDKCResult_CVec_CVec_u8ZZNoneZPtr {
2837    /**
2838     * A pointer to the contents in the success state.
2839     * Reading from this pointer when `result_ok` is not set is undefined.
2840     */
2841    struct LDKCVec_CVec_u8ZZ *result;
2842    /**
2843     * Note that this value is always NULL, as there are no contents in the Err variant
2844     */
2845    void *err;
2846 } LDKCResult_CVec_CVec_u8ZZNoneZPtr;
2847
2848 /**
2849  * A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
2850  * containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
2851  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2852  */
2853 typedef struct LDKCResult_CVec_CVec_u8ZZNoneZ {
2854    /**
2855     * The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
2856     * `err` or `result` depending on the state of `result_ok`.
2857     */
2858    union LDKCResult_CVec_CVec_u8ZZNoneZPtr contents;
2859    /**
2860     * Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
2861     */
2862    bool result_ok;
2863 } LDKCResult_CVec_CVec_u8ZZNoneZ;
2864
2865
2866
2867 /**
2868  * A simple implementation of [`WriteableEcdsaChannelSigner`] that just keeps the private keys in memory.
2869  *
2870  * This implementation performs no policy checks and is insufficient by itself as
2871  * a secure external signer.
2872  */
2873 typedef struct MUST_USE_STRUCT LDKInMemorySigner {
2874    /**
2875     * A pointer to the opaque Rust object.
2876     * Nearly everywhere, inner must be non-null, however in places where
2877     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2878     */
2879    LDKnativeInMemorySigner *inner;
2880    /**
2881     * Indicates that this is the only struct which contains the same pointer.
2882     * Rust functions which take ownership of an object provided via an argument require
2883     * this to be true and invalidate the object pointed to by inner.
2884     */
2885    bool is_owned;
2886 } LDKInMemorySigner;
2887
2888 /**
2889  * The contents of CResult_InMemorySignerDecodeErrorZ
2890  */
2891 typedef union LDKCResult_InMemorySignerDecodeErrorZPtr {
2892    /**
2893     * A pointer to the contents in the success state.
2894     * Reading from this pointer when `result_ok` is not set is undefined.
2895     */
2896    struct LDKInMemorySigner *result;
2897    /**
2898     * A pointer to the contents in the error state.
2899     * Reading from this pointer when `result_ok` is set is undefined.
2900     */
2901    struct LDKDecodeError *err;
2902 } LDKCResult_InMemorySignerDecodeErrorZPtr;
2903
2904 /**
2905  * A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
2906  * containing a crate::lightning::sign::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
2907  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2908  */
2909 typedef struct LDKCResult_InMemorySignerDecodeErrorZ {
2910    /**
2911     * The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
2912     * `err` or `result` depending on the state of `result_ok`.
2913     */
2914    union LDKCResult_InMemorySignerDecodeErrorZPtr contents;
2915    /**
2916     * Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
2917     */
2918    bool result_ok;
2919 } LDKCResult_InMemorySignerDecodeErrorZ;
2920
2921 /**
2922  * The contents of CResult_PartiallySignedTransactionNoneZ
2923  */
2924 typedef union LDKCResult_PartiallySignedTransactionNoneZPtr {
2925    /**
2926     * A pointer to the contents in the success state.
2927     * Reading from this pointer when `result_ok` is not set is undefined.
2928     */
2929    struct LDKCVec_u8Z *result;
2930    /**
2931     * Note that this value is always NULL, as there are no contents in the Err variant
2932     */
2933    void *err;
2934 } LDKCResult_PartiallySignedTransactionNoneZPtr;
2935
2936 /**
2937  * A CResult_PartiallySignedTransactionNoneZ represents the result of a fallible operation,
2938  * containing a crate::c_types::derived::CVec_u8Z on success and a () on failure.
2939  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2940  */
2941 typedef struct LDKCResult_PartiallySignedTransactionNoneZ {
2942    /**
2943     * The contents of this CResult_PartiallySignedTransactionNoneZ, accessible via either
2944     * `err` or `result` depending on the state of `result_ok`.
2945     */
2946    union LDKCResult_PartiallySignedTransactionNoneZPtr contents;
2947    /**
2948     * Whether this CResult_PartiallySignedTransactionNoneZ represents a success state.
2949     */
2950    bool result_ok;
2951 } LDKCResult_PartiallySignedTransactionNoneZ;
2952
2953 /**
2954  * The contents of CResult_TransactionNoneZ
2955  */
2956 typedef union LDKCResult_TransactionNoneZPtr {
2957    /**
2958     * A pointer to the contents in the success state.
2959     * Reading from this pointer when `result_ok` is not set is undefined.
2960     */
2961    struct LDKTransaction *result;
2962    /**
2963     * Note that this value is always NULL, as there are no contents in the Err variant
2964     */
2965    void *err;
2966 } LDKCResult_TransactionNoneZPtr;
2967
2968 /**
2969  * A CResult_TransactionNoneZ represents the result of a fallible operation,
2970  * containing a crate::c_types::Transaction on success and a () on failure.
2971  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2972  */
2973 typedef struct LDKCResult_TransactionNoneZ {
2974    /**
2975     * The contents of this CResult_TransactionNoneZ, accessible via either
2976     * `err` or `result` depending on the state of `result_ok`.
2977     */
2978    union LDKCResult_TransactionNoneZPtr contents;
2979    /**
2980     * Whether this CResult_TransactionNoneZ represents a success state.
2981     */
2982    bool result_ok;
2983 } LDKCResult_TransactionNoneZ;
2984
2985
2986
2987 /**
2988  * Represents the compressed public key of a node
2989  */
2990 typedef struct MUST_USE_STRUCT LDKNodeId {
2991    /**
2992     * A pointer to the opaque Rust object.
2993     * Nearly everywhere, inner must be non-null, however in places where
2994     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2995     */
2996    LDKnativeNodeId *inner;
2997    /**
2998     * Indicates that this is the only struct which contains the same pointer.
2999     * Rust functions which take ownership of an object provided via an argument require
3000     * this to be true and invalidate the object pointed to by inner.
3001     */
3002    bool is_owned;
3003 } LDKNodeId;
3004
3005
3006
3007 /**
3008  * Proposed use of a channel passed as a parameter to [`Score::channel_penalty_msat`].
3009  */
3010 typedef struct MUST_USE_STRUCT LDKChannelUsage {
3011    /**
3012     * A pointer to the opaque Rust object.
3013     * Nearly everywhere, inner must be non-null, however in places where
3014     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3015     */
3016    LDKnativeChannelUsage *inner;
3017    /**
3018     * Indicates that this is the only struct which contains the same pointer.
3019     * Rust functions which take ownership of an object provided via an argument require
3020     * this to be true and invalidate the object pointed to by inner.
3021     */
3022    bool is_owned;
3023 } LDKChannelUsage;
3024
3025
3026
3027 /**
3028  * Parameters for configuring [`ProbabilisticScorer`].
3029  *
3030  * Used to configure base, liquidity, and amount penalties, the sum of which comprises the channel
3031  * penalty (i.e., the amount in msats willing to be paid to avoid routing through the channel).
3032  *
3033  * The penalty applied to any channel by the [`ProbabilisticScorer`] is the sum of each of the
3034  * parameters here.
3035  */
3036 typedef struct MUST_USE_STRUCT LDKProbabilisticScoringFeeParameters {
3037    /**
3038     * A pointer to the opaque Rust object.
3039     * Nearly everywhere, inner must be non-null, however in places where
3040     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3041     */
3042    LDKnativeProbabilisticScoringFeeParameters *inner;
3043    /**
3044     * Indicates that this is the only struct which contains the same pointer.
3045     * Rust functions which take ownership of an object provided via an argument require
3046     * this to be true and invalidate the object pointed to by inner.
3047     */
3048    bool is_owned;
3049 } LDKProbabilisticScoringFeeParameters;
3050
3051
3052
3053 /**
3054  * A path in a [`Route`] to the payment recipient. Must always be at least length one.
3055  * If no [`Path::blinded_tail`] is present, then [`Path::hops`] length may be up to 19.
3056  */
3057 typedef struct MUST_USE_STRUCT LDKPath {
3058    /**
3059     * A pointer to the opaque Rust object.
3060     * Nearly everywhere, inner must be non-null, however in places where
3061     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3062     */
3063    LDKnativePath *inner;
3064    /**
3065     * Indicates that this is the only struct which contains the same pointer.
3066     * Rust functions which take ownership of an object provided via an argument require
3067     * this to be true and invalidate the object pointed to by inner.
3068     */
3069    bool is_owned;
3070 } LDKPath;
3071
3072 /**
3073  * An interface used to score payment channels for path finding.
3074  *
3075  *\tScoring is in terms of fees willing to be paid in order to avoid routing through a channel.
3076  */
3077 typedef struct LDKScore {
3078    /**
3079     * An opaque pointer which is passed to your function implementations as an argument.
3080     * This has no meaning in the LDK, and can be NULL or any other value.
3081     */
3082    void *this_arg;
3083    /**
3084     * Returns the fee in msats willing to be paid to avoid routing `send_amt_msat` through the
3085     * given channel in the direction from `source` to `target`.
3086     *
3087     * The channel's capacity (less any other MPP parts that are also being considered for use in
3088     * the same payment) is given by `capacity_msat`. It may be determined from various sources
3089     * such as a chain data, network gossip, or invoice hints. For invoice hints, a capacity near
3090     * [`u64::max_value`] is given to indicate sufficient capacity for the invoice's full amount.
3091     * Thus, implementations should be overflow-safe.
3092     */
3093    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, const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR score_params);
3094    /**
3095     * Handles updating channel penalties after failing to route through a channel.
3096     */
3097    void (*payment_path_failed)(void *this_arg, const struct LDKPath *NONNULL_PTR path, uint64_t short_channel_id);
3098    /**
3099     * Handles updating channel penalties after successfully routing along a path.
3100     */
3101    void (*payment_path_successful)(void *this_arg, const struct LDKPath *NONNULL_PTR path);
3102    /**
3103     * Handles updating channel penalties after a probe over the given path failed.
3104     */
3105    void (*probe_failed)(void *this_arg, const struct LDKPath *NONNULL_PTR path, uint64_t short_channel_id);
3106    /**
3107     * Handles updating channel penalties after a probe over the given path succeeded.
3108     */
3109    void (*probe_successful)(void *this_arg, const struct LDKPath *NONNULL_PTR path);
3110    /**
3111     * Serialize the object into a byte array
3112     */
3113    struct LDKCVec_u8Z (*write)(const void *this_arg);
3114    /**
3115     * Frees any resources associated with this object given its this_arg pointer.
3116     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
3117     */
3118    void (*free)(void *this_arg);
3119 } LDKScore;
3120
3121 /**
3122  * A scorer that is accessed under a lock.
3123  *
3124  * Needed so that calls to [`Score::channel_penalty_msat`] in [`find_route`] can be made while
3125  * having shared ownership of a scorer but without requiring internal locking in [`Score`]
3126  * implementations. Internal locking would be detrimental to route finding performance and could
3127  * result in [`Score::channel_penalty_msat`] returning a different value for the same channel.
3128  *
3129  * [`find_route`]: crate::routing::router::find_route
3130  */
3131 typedef struct LDKLockableScore {
3132    /**
3133     * An opaque pointer which is passed to your function implementations as an argument.
3134     * This has no meaning in the LDK, and can be NULL or any other value.
3135     */
3136    void *this_arg;
3137    /**
3138     * Returns the locked scorer.
3139     */
3140    struct LDKScore (*lock)(const void *this_arg);
3141    /**
3142     * Frees any resources associated with this object given its this_arg pointer.
3143     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
3144     */
3145    void (*free)(void *this_arg);
3146 } LDKLockableScore;
3147
3148 /**
3149  * Refers to a scorer that is accessible under lock and also writeable to disk
3150  *
3151  * We need this trait to be able to pass in a scorer to `lightning-background-processor` that will enable us to
3152  * use the Persister to persist it.
3153  */
3154 typedef struct LDKWriteableScore {
3155    /**
3156     * An opaque pointer which is passed to your function implementations as an argument.
3157     * This has no meaning in the LDK, and can be NULL or any other value.
3158     */
3159    void *this_arg;
3160    /**
3161     * Implementation of LockableScore for this object.
3162     */
3163    struct LDKLockableScore LockableScore;
3164    /**
3165     * Serialize the object into a byte array
3166     */
3167    struct LDKCVec_u8Z (*write)(const void *this_arg);
3168    /**
3169     * Frees any resources associated with this object given its this_arg pointer.
3170     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
3171     */
3172    void (*free)(void *this_arg);
3173 } LDKWriteableScore;
3174
3175 /**
3176  * An enum which can either contain a crate::lightning::routing::scoring::WriteableScore or not
3177  */
3178 typedef enum LDKCOption_WriteableScoreZ_Tag {
3179    /**
3180     * When we're in this state, this COption_WriteableScoreZ contains a crate::lightning::routing::scoring::WriteableScore
3181     */
3182    LDKCOption_WriteableScoreZ_Some,
3183    /**
3184     * When we're in this state, this COption_WriteableScoreZ contains nothing
3185     */
3186    LDKCOption_WriteableScoreZ_None,
3187    /**
3188     * Must be last for serialization purposes
3189     */
3190    LDKCOption_WriteableScoreZ_Sentinel,
3191 } LDKCOption_WriteableScoreZ_Tag;
3192
3193 typedef struct LDKCOption_WriteableScoreZ {
3194    LDKCOption_WriteableScoreZ_Tag tag;
3195    union {
3196       struct {
3197          struct LDKWriteableScore some;
3198       };
3199    };
3200 } LDKCOption_WriteableScoreZ;
3201
3202 /**
3203  * The contents of CResult_NoneErrorZ
3204  */
3205 typedef union LDKCResult_NoneErrorZPtr {
3206    /**
3207     * Note that this value is always NULL, as there are no contents in the OK variant
3208     */
3209    void *result;
3210    /**
3211     * A pointer to the contents in the error state.
3212     * Reading from this pointer when `result_ok` is set is undefined.
3213     */
3214    enum LDKIOError *err;
3215 } LDKCResult_NoneErrorZPtr;
3216
3217 /**
3218  * A CResult_NoneErrorZ represents the result of a fallible operation,
3219  * containing a () on success and a crate::c_types::IOError on failure.
3220  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3221  */
3222 typedef struct LDKCResult_NoneErrorZ {
3223    /**
3224     * The contents of this CResult_NoneErrorZ, accessible via either
3225     * `err` or `result` depending on the state of `result_ok`.
3226     */
3227    union LDKCResult_NoneErrorZPtr contents;
3228    /**
3229     * Whether this CResult_NoneErrorZ represents a success state.
3230     */
3231    bool result_ok;
3232 } LDKCResult_NoneErrorZ;
3233
3234
3235
3236 /**
3237  * Details of a channel, as returned by [`ChannelManager::list_channels`] and [`ChannelManager::list_usable_channels`]
3238  */
3239 typedef struct MUST_USE_STRUCT LDKChannelDetails {
3240    /**
3241     * A pointer to the opaque Rust object.
3242     * Nearly everywhere, inner must be non-null, however in places where
3243     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3244     */
3245    LDKnativeChannelDetails *inner;
3246    /**
3247     * Indicates that this is the only struct which contains the same pointer.
3248     * Rust functions which take ownership of an object provided via an argument require
3249     * this to be true and invalidate the object pointed to by inner.
3250     */
3251    bool is_owned;
3252 } LDKChannelDetails;
3253
3254 /**
3255  * A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
3256  * This corresponds to std::vector in C++
3257  */
3258 typedef struct LDKCVec_ChannelDetailsZ {
3259    /**
3260     * The elements in the array.
3261     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3262     */
3263    struct LDKChannelDetails *data;
3264    /**
3265     * The number of elements pointed to by `data`.
3266     */
3267    uintptr_t datalen;
3268 } LDKCVec_ChannelDetailsZ;
3269
3270
3271
3272 /**
3273  * A route directs a payment from the sender (us) to the recipient. If the recipient supports MPP,
3274  * it can take multiple paths. Each path is composed of one or more hops through the network.
3275  */
3276 typedef struct MUST_USE_STRUCT LDKRoute {
3277    /**
3278     * A pointer to the opaque Rust object.
3279     * Nearly everywhere, inner must be non-null, however in places where
3280     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3281     */
3282    LDKnativeRoute *inner;
3283    /**
3284     * Indicates that this is the only struct which contains the same pointer.
3285     * Rust functions which take ownership of an object provided via an argument require
3286     * this to be true and invalidate the object pointed to by inner.
3287     */
3288    bool is_owned;
3289 } LDKRoute;
3290
3291
3292
3293 /**
3294  * An Err type for failure to process messages.
3295  */
3296 typedef struct MUST_USE_STRUCT LDKLightningError {
3297    /**
3298     * A pointer to the opaque Rust object.
3299     * Nearly everywhere, inner must be non-null, however in places where
3300     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3301     */
3302    LDKnativeLightningError *inner;
3303    /**
3304     * Indicates that this is the only struct which contains the same pointer.
3305     * Rust functions which take ownership of an object provided via an argument require
3306     * this to be true and invalidate the object pointed to by inner.
3307     */
3308    bool is_owned;
3309 } LDKLightningError;
3310
3311 /**
3312  * The contents of CResult_RouteLightningErrorZ
3313  */
3314 typedef union LDKCResult_RouteLightningErrorZPtr {
3315    /**
3316     * A pointer to the contents in the success state.
3317     * Reading from this pointer when `result_ok` is not set is undefined.
3318     */
3319    struct LDKRoute *result;
3320    /**
3321     * A pointer to the contents in the error state.
3322     * Reading from this pointer when `result_ok` is set is undefined.
3323     */
3324    struct LDKLightningError *err;
3325 } LDKCResult_RouteLightningErrorZPtr;
3326
3327 /**
3328  * A CResult_RouteLightningErrorZ represents the result of a fallible operation,
3329  * containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
3330  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3331  */
3332 typedef struct LDKCResult_RouteLightningErrorZ {
3333    /**
3334     * The contents of this CResult_RouteLightningErrorZ, accessible via either
3335     * `err` or `result` depending on the state of `result_ok`.
3336     */
3337    union LDKCResult_RouteLightningErrorZPtr contents;
3338    /**
3339     * Whether this CResult_RouteLightningErrorZ represents a success state.
3340     */
3341    bool result_ok;
3342 } LDKCResult_RouteLightningErrorZ;
3343
3344
3345
3346 /**
3347  * A data structure for tracking in-flight HTLCs. May be used during pathfinding to account for
3348  * in-use channel liquidity.
3349  */
3350 typedef struct MUST_USE_STRUCT LDKInFlightHtlcs {
3351    /**
3352     * A pointer to the opaque Rust object.
3353     * Nearly everywhere, inner must be non-null, however in places where
3354     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3355     */
3356    LDKnativeInFlightHtlcs *inner;
3357    /**
3358     * Indicates that this is the only struct which contains the same pointer.
3359     * Rust functions which take ownership of an object provided via an argument require
3360     * this to be true and invalidate the object pointed to by inner.
3361     */
3362    bool is_owned;
3363 } LDKInFlightHtlcs;
3364
3365 /**
3366  * The contents of CResult_InFlightHtlcsDecodeErrorZ
3367  */
3368 typedef union LDKCResult_InFlightHtlcsDecodeErrorZPtr {
3369    /**
3370     * A pointer to the contents in the success state.
3371     * Reading from this pointer when `result_ok` is not set is undefined.
3372     */
3373    struct LDKInFlightHtlcs *result;
3374    /**
3375     * A pointer to the contents in the error state.
3376     * Reading from this pointer when `result_ok` is set is undefined.
3377     */
3378    struct LDKDecodeError *err;
3379 } LDKCResult_InFlightHtlcsDecodeErrorZPtr;
3380
3381 /**
3382  * A CResult_InFlightHtlcsDecodeErrorZ represents the result of a fallible operation,
3383  * containing a crate::lightning::routing::router::InFlightHtlcs on success and a crate::lightning::ln::msgs::DecodeError on failure.
3384  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3385  */
3386 typedef struct LDKCResult_InFlightHtlcsDecodeErrorZ {
3387    /**
3388     * The contents of this CResult_InFlightHtlcsDecodeErrorZ, accessible via either
3389     * `err` or `result` depending on the state of `result_ok`.
3390     */
3391    union LDKCResult_InFlightHtlcsDecodeErrorZPtr contents;
3392    /**
3393     * Whether this CResult_InFlightHtlcsDecodeErrorZ represents a success state.
3394     */
3395    bool result_ok;
3396 } LDKCResult_InFlightHtlcsDecodeErrorZ;
3397
3398
3399
3400 /**
3401  * A hop in a route, and additional metadata about it. \"Hop\" is defined as a node and the channel
3402  * that leads to it.
3403  */
3404 typedef struct MUST_USE_STRUCT LDKRouteHop {
3405    /**
3406     * A pointer to the opaque Rust object.
3407     * Nearly everywhere, inner must be non-null, however in places where
3408     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3409     */
3410    LDKnativeRouteHop *inner;
3411    /**
3412     * Indicates that this is the only struct which contains the same pointer.
3413     * Rust functions which take ownership of an object provided via an argument require
3414     * this to be true and invalidate the object pointed to by inner.
3415     */
3416    bool is_owned;
3417 } LDKRouteHop;
3418
3419 /**
3420  * The contents of CResult_RouteHopDecodeErrorZ
3421  */
3422 typedef union LDKCResult_RouteHopDecodeErrorZPtr {
3423    /**
3424     * A pointer to the contents in the success state.
3425     * Reading from this pointer when `result_ok` is not set is undefined.
3426     */
3427    struct LDKRouteHop *result;
3428    /**
3429     * A pointer to the contents in the error state.
3430     * Reading from this pointer when `result_ok` is set is undefined.
3431     */
3432    struct LDKDecodeError *err;
3433 } LDKCResult_RouteHopDecodeErrorZPtr;
3434
3435 /**
3436  * A CResult_RouteHopDecodeErrorZ represents the result of a fallible operation,
3437  * containing a crate::lightning::routing::router::RouteHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
3438  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3439  */
3440 typedef struct LDKCResult_RouteHopDecodeErrorZ {
3441    /**
3442     * The contents of this CResult_RouteHopDecodeErrorZ, accessible via either
3443     * `err` or `result` depending on the state of `result_ok`.
3444     */
3445    union LDKCResult_RouteHopDecodeErrorZPtr contents;
3446    /**
3447     * Whether this CResult_RouteHopDecodeErrorZ represents a success state.
3448     */
3449    bool result_ok;
3450 } LDKCResult_RouteHopDecodeErrorZ;
3451
3452
3453
3454 /**
3455  * Used to construct the blinded hops portion of a blinded path. These hops cannot be identified
3456  * by outside observers and thus can be used to hide the identity of the recipient.
3457  */
3458 typedef struct MUST_USE_STRUCT LDKBlindedHop {
3459    /**
3460     * A pointer to the opaque Rust object.
3461     * Nearly everywhere, inner must be non-null, however in places where
3462     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3463     */
3464    LDKnativeBlindedHop *inner;
3465    /**
3466     * Indicates that this is the only struct which contains the same pointer.
3467     * Rust functions which take ownership of an object provided via an argument require
3468     * this to be true and invalidate the object pointed to by inner.
3469     */
3470    bool is_owned;
3471 } LDKBlindedHop;
3472
3473 /**
3474  * A dynamically-allocated array of crate::lightning::blinded_path::BlindedHops of arbitrary size.
3475  * This corresponds to std::vector in C++
3476  */
3477 typedef struct LDKCVec_BlindedHopZ {
3478    /**
3479     * The elements in the array.
3480     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3481     */
3482    struct LDKBlindedHop *data;
3483    /**
3484     * The number of elements pointed to by `data`.
3485     */
3486    uintptr_t datalen;
3487 } LDKCVec_BlindedHopZ;
3488
3489
3490
3491 /**
3492  * The blinded portion of a [`Path`], if we're routing to a recipient who provided blinded paths in
3493  * their [`Bolt12Invoice`].
3494  *
3495  * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
3496  */
3497 typedef struct MUST_USE_STRUCT LDKBlindedTail {
3498    /**
3499     * A pointer to the opaque Rust object.
3500     * Nearly everywhere, inner must be non-null, however in places where
3501     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3502     */
3503    LDKnativeBlindedTail *inner;
3504    /**
3505     * Indicates that this is the only struct which contains the same pointer.
3506     * Rust functions which take ownership of an object provided via an argument require
3507     * this to be true and invalidate the object pointed to by inner.
3508     */
3509    bool is_owned;
3510 } LDKBlindedTail;
3511
3512 /**
3513  * The contents of CResult_BlindedTailDecodeErrorZ
3514  */
3515 typedef union LDKCResult_BlindedTailDecodeErrorZPtr {
3516    /**
3517     * A pointer to the contents in the success state.
3518     * Reading from this pointer when `result_ok` is not set is undefined.
3519     */
3520    struct LDKBlindedTail *result;
3521    /**
3522     * A pointer to the contents in the error state.
3523     * Reading from this pointer when `result_ok` is set is undefined.
3524     */
3525    struct LDKDecodeError *err;
3526 } LDKCResult_BlindedTailDecodeErrorZPtr;
3527
3528 /**
3529  * A CResult_BlindedTailDecodeErrorZ represents the result of a fallible operation,
3530  * containing a crate::lightning::routing::router::BlindedTail on success and a crate::lightning::ln::msgs::DecodeError on failure.
3531  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3532  */
3533 typedef struct LDKCResult_BlindedTailDecodeErrorZ {
3534    /**
3535     * The contents of this CResult_BlindedTailDecodeErrorZ, accessible via either
3536     * `err` or `result` depending on the state of `result_ok`.
3537     */
3538    union LDKCResult_BlindedTailDecodeErrorZPtr contents;
3539    /**
3540     * Whether this CResult_BlindedTailDecodeErrorZ represents a success state.
3541     */
3542    bool result_ok;
3543 } LDKCResult_BlindedTailDecodeErrorZ;
3544
3545 /**
3546  * A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
3547  * This corresponds to std::vector in C++
3548  */
3549 typedef struct LDKCVec_RouteHopZ {
3550    /**
3551     * The elements in the array.
3552     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3553     */
3554    struct LDKRouteHop *data;
3555    /**
3556     * The number of elements pointed to by `data`.
3557     */
3558    uintptr_t datalen;
3559 } LDKCVec_RouteHopZ;
3560
3561 /**
3562  * An enum which can either contain a u32 or not
3563  */
3564 typedef enum LDKCOption_u32Z_Tag {
3565    /**
3566     * When we're in this state, this COption_u32Z contains a u32
3567     */
3568    LDKCOption_u32Z_Some,
3569    /**
3570     * When we're in this state, this COption_u32Z contains nothing
3571     */
3572    LDKCOption_u32Z_None,
3573    /**
3574     * Must be last for serialization purposes
3575     */
3576    LDKCOption_u32Z_Sentinel,
3577 } LDKCOption_u32Z_Tag;
3578
3579 typedef struct LDKCOption_u32Z {
3580    LDKCOption_u32Z_Tag tag;
3581    union {
3582       struct {
3583          uint32_t some;
3584       };
3585    };
3586 } LDKCOption_u32Z;
3587
3588 /**
3589  * A dynamically-allocated array of crate::lightning::routing::router::Paths of arbitrary size.
3590  * This corresponds to std::vector in C++
3591  */
3592 typedef struct LDKCVec_PathZ {
3593    /**
3594     * The elements in the array.
3595     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3596     */
3597    struct LDKPath *data;
3598    /**
3599     * The number of elements pointed to by `data`.
3600     */
3601    uintptr_t datalen;
3602 } LDKCVec_PathZ;
3603
3604 /**
3605  * The contents of CResult_RouteDecodeErrorZ
3606  */
3607 typedef union LDKCResult_RouteDecodeErrorZPtr {
3608    /**
3609     * A pointer to the contents in the success state.
3610     * Reading from this pointer when `result_ok` is not set is undefined.
3611     */
3612    struct LDKRoute *result;
3613    /**
3614     * A pointer to the contents in the error state.
3615     * Reading from this pointer when `result_ok` is set is undefined.
3616     */
3617    struct LDKDecodeError *err;
3618 } LDKCResult_RouteDecodeErrorZPtr;
3619
3620 /**
3621  * A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
3622  * containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
3623  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3624  */
3625 typedef struct LDKCResult_RouteDecodeErrorZ {
3626    /**
3627     * The contents of this CResult_RouteDecodeErrorZ, accessible via either
3628     * `err` or `result` depending on the state of `result_ok`.
3629     */
3630    union LDKCResult_RouteDecodeErrorZPtr contents;
3631    /**
3632     * Whether this CResult_RouteDecodeErrorZ represents a success state.
3633     */
3634    bool result_ok;
3635 } LDKCResult_RouteDecodeErrorZ;
3636
3637
3638
3639 /**
3640  * Parameters needed to find a [`Route`].
3641  *
3642  * Passed to [`find_route`] and [`build_route_from_hops`].
3643  */
3644 typedef struct MUST_USE_STRUCT LDKRouteParameters {
3645    /**
3646     * A pointer to the opaque Rust object.
3647     * Nearly everywhere, inner must be non-null, however in places where
3648     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3649     */
3650    LDKnativeRouteParameters *inner;
3651    /**
3652     * Indicates that this is the only struct which contains the same pointer.
3653     * Rust functions which take ownership of an object provided via an argument require
3654     * this to be true and invalidate the object pointed to by inner.
3655     */
3656    bool is_owned;
3657 } LDKRouteParameters;
3658
3659 /**
3660  * The contents of CResult_RouteParametersDecodeErrorZ
3661  */
3662 typedef union LDKCResult_RouteParametersDecodeErrorZPtr {
3663    /**
3664     * A pointer to the contents in the success state.
3665     * Reading from this pointer when `result_ok` is not set is undefined.
3666     */
3667    struct LDKRouteParameters *result;
3668    /**
3669     * A pointer to the contents in the error state.
3670     * Reading from this pointer when `result_ok` is set is undefined.
3671     */
3672    struct LDKDecodeError *err;
3673 } LDKCResult_RouteParametersDecodeErrorZPtr;
3674
3675 /**
3676  * A CResult_RouteParametersDecodeErrorZ represents the result of a fallible operation,
3677  * containing a crate::lightning::routing::router::RouteParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
3678  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3679  */
3680 typedef struct LDKCResult_RouteParametersDecodeErrorZ {
3681    /**
3682     * The contents of this CResult_RouteParametersDecodeErrorZ, accessible via either
3683     * `err` or `result` depending on the state of `result_ok`.
3684     */
3685    union LDKCResult_RouteParametersDecodeErrorZPtr contents;
3686    /**
3687     * Whether this CResult_RouteParametersDecodeErrorZ represents a success state.
3688     */
3689    bool result_ok;
3690 } LDKCResult_RouteParametersDecodeErrorZ;
3691
3692 /**
3693  * A dynamically-allocated array of u64s of arbitrary size.
3694  * This corresponds to std::vector in C++
3695  */
3696 typedef struct LDKCVec_u64Z {
3697    /**
3698     * The elements in the array.
3699     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3700     */
3701    uint64_t *data;
3702    /**
3703     * The number of elements pointed to by `data`.
3704     */
3705    uintptr_t datalen;
3706 } LDKCVec_u64Z;
3707
3708
3709
3710 /**
3711  * Information used to route a payment.
3712  */
3713 typedef struct MUST_USE_STRUCT LDKPaymentParameters {
3714    /**
3715     * A pointer to the opaque Rust object.
3716     * Nearly everywhere, inner must be non-null, however in places where
3717     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3718     */
3719    LDKnativePaymentParameters *inner;
3720    /**
3721     * Indicates that this is the only struct which contains the same pointer.
3722     * Rust functions which take ownership of an object provided via an argument require
3723     * this to be true and invalidate the object pointed to by inner.
3724     */
3725    bool is_owned;
3726 } LDKPaymentParameters;
3727
3728 /**
3729  * The contents of CResult_PaymentParametersDecodeErrorZ
3730  */
3731 typedef union LDKCResult_PaymentParametersDecodeErrorZPtr {
3732    /**
3733     * A pointer to the contents in the success state.
3734     * Reading from this pointer when `result_ok` is not set is undefined.
3735     */
3736    struct LDKPaymentParameters *result;
3737    /**
3738     * A pointer to the contents in the error state.
3739     * Reading from this pointer when `result_ok` is set is undefined.
3740     */
3741    struct LDKDecodeError *err;
3742 } LDKCResult_PaymentParametersDecodeErrorZPtr;
3743
3744 /**
3745  * A CResult_PaymentParametersDecodeErrorZ represents the result of a fallible operation,
3746  * containing a crate::lightning::routing::router::PaymentParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
3747  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3748  */
3749 typedef struct LDKCResult_PaymentParametersDecodeErrorZ {
3750    /**
3751     * The contents of this CResult_PaymentParametersDecodeErrorZ, accessible via either
3752     * `err` or `result` depending on the state of `result_ok`.
3753     */
3754    union LDKCResult_PaymentParametersDecodeErrorZPtr contents;
3755    /**
3756     * Whether this CResult_PaymentParametersDecodeErrorZ represents a success state.
3757     */
3758    bool result_ok;
3759 } LDKCResult_PaymentParametersDecodeErrorZ;
3760
3761 /**
3762  * A tuple of 2 elements. See the individual fields for the types contained.
3763  */
3764 typedef struct LDKC2Tuple_BlindedPayInfoBlindedPathZ {
3765    /**
3766     * The element at position 0
3767     */
3768    struct LDKBlindedPayInfo a;
3769    /**
3770     * The element at position 1
3771     */
3772    struct LDKBlindedPath b;
3773 } LDKC2Tuple_BlindedPayInfoBlindedPathZ;
3774
3775 /**
3776  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZs of arbitrary size.
3777  * This corresponds to std::vector in C++
3778  */
3779 typedef struct LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ {
3780    /**
3781     * The elements in the array.
3782     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3783     */
3784    struct LDKC2Tuple_BlindedPayInfoBlindedPathZ *data;
3785    /**
3786     * The number of elements pointed to by `data`.
3787     */
3788    uintptr_t datalen;
3789 } LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ;
3790
3791
3792
3793 /**
3794  * A list of hops along a payment path terminating with a channel to the recipient.
3795  */
3796 typedef struct MUST_USE_STRUCT LDKRouteHint {
3797    /**
3798     * A pointer to the opaque Rust object.
3799     * Nearly everywhere, inner must be non-null, however in places where
3800     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3801     */
3802    LDKnativeRouteHint *inner;
3803    /**
3804     * Indicates that this is the only struct which contains the same pointer.
3805     * Rust functions which take ownership of an object provided via an argument require
3806     * this to be true and invalidate the object pointed to by inner.
3807     */
3808    bool is_owned;
3809 } LDKRouteHint;
3810
3811 /**
3812  * A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size.
3813  * This corresponds to std::vector in C++
3814  */
3815 typedef struct LDKCVec_RouteHintZ {
3816    /**
3817     * The elements in the array.
3818     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3819     */
3820    struct LDKRouteHint *data;
3821    /**
3822     * The number of elements pointed to by `data`.
3823     */
3824    uintptr_t datalen;
3825 } LDKCVec_RouteHintZ;
3826
3827
3828
3829 /**
3830  * A channel descriptor for a hop along a payment path.
3831  */
3832 typedef struct MUST_USE_STRUCT LDKRouteHintHop {
3833    /**
3834     * A pointer to the opaque Rust object.
3835     * Nearly everywhere, inner must be non-null, however in places where
3836     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3837     */
3838    LDKnativeRouteHintHop *inner;
3839    /**
3840     * Indicates that this is the only struct which contains the same pointer.
3841     * Rust functions which take ownership of an object provided via an argument require
3842     * this to be true and invalidate the object pointed to by inner.
3843     */
3844    bool is_owned;
3845 } LDKRouteHintHop;
3846
3847 /**
3848  * A dynamically-allocated array of crate::lightning::routing::router::RouteHintHops of arbitrary size.
3849  * This corresponds to std::vector in C++
3850  */
3851 typedef struct LDKCVec_RouteHintHopZ {
3852    /**
3853     * The elements in the array.
3854     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3855     */
3856    struct LDKRouteHintHop *data;
3857    /**
3858     * The number of elements pointed to by `data`.
3859     */
3860    uintptr_t datalen;
3861 } LDKCVec_RouteHintHopZ;
3862
3863 /**
3864  * The contents of CResult_RouteHintDecodeErrorZ
3865  */
3866 typedef union LDKCResult_RouteHintDecodeErrorZPtr {
3867    /**
3868     * A pointer to the contents in the success state.
3869     * Reading from this pointer when `result_ok` is not set is undefined.
3870     */
3871    struct LDKRouteHint *result;
3872    /**
3873     * A pointer to the contents in the error state.
3874     * Reading from this pointer when `result_ok` is set is undefined.
3875     */
3876    struct LDKDecodeError *err;
3877 } LDKCResult_RouteHintDecodeErrorZPtr;
3878
3879 /**
3880  * A CResult_RouteHintDecodeErrorZ represents the result of a fallible operation,
3881  * containing a crate::lightning::routing::router::RouteHint on success and a crate::lightning::ln::msgs::DecodeError on failure.
3882  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3883  */
3884 typedef struct LDKCResult_RouteHintDecodeErrorZ {
3885    /**
3886     * The contents of this CResult_RouteHintDecodeErrorZ, accessible via either
3887     * `err` or `result` depending on the state of `result_ok`.
3888     */
3889    union LDKCResult_RouteHintDecodeErrorZPtr contents;
3890    /**
3891     * Whether this CResult_RouteHintDecodeErrorZ represents a success state.
3892     */
3893    bool result_ok;
3894 } LDKCResult_RouteHintDecodeErrorZ;
3895
3896 /**
3897  * The contents of CResult_RouteHintHopDecodeErrorZ
3898  */
3899 typedef union LDKCResult_RouteHintHopDecodeErrorZPtr {
3900    /**
3901     * A pointer to the contents in the success state.
3902     * Reading from this pointer when `result_ok` is not set is undefined.
3903     */
3904    struct LDKRouteHintHop *result;
3905    /**
3906     * A pointer to the contents in the error state.
3907     * Reading from this pointer when `result_ok` is set is undefined.
3908     */
3909    struct LDKDecodeError *err;
3910 } LDKCResult_RouteHintHopDecodeErrorZPtr;
3911
3912 /**
3913  * A CResult_RouteHintHopDecodeErrorZ represents the result of a fallible operation,
3914  * containing a crate::lightning::routing::router::RouteHintHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
3915  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3916  */
3917 typedef struct LDKCResult_RouteHintHopDecodeErrorZ {
3918    /**
3919     * The contents of this CResult_RouteHintHopDecodeErrorZ, accessible via either
3920     * `err` or `result` depending on the state of `result_ok`.
3921     */
3922    union LDKCResult_RouteHintHopDecodeErrorZPtr contents;
3923    /**
3924     * Whether this CResult_RouteHintHopDecodeErrorZ represents a success state.
3925     */
3926    bool result_ok;
3927 } LDKCResult_RouteHintHopDecodeErrorZ;
3928
3929 /**
3930  * A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
3931  * This corresponds to std::vector in C++
3932  */
3933 typedef struct LDKCVec_PublicKeyZ {
3934    /**
3935     * The elements in the array.
3936     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3937     */
3938    struct LDKPublicKey *data;
3939    /**
3940     * The number of elements pointed to by `data`.
3941     */
3942    uintptr_t datalen;
3943 } LDKCVec_PublicKeyZ;
3944
3945
3946
3947 /**
3948  * [`Score`] implementation that uses a fixed penalty.
3949  */
3950 typedef struct MUST_USE_STRUCT LDKFixedPenaltyScorer {
3951    /**
3952     * A pointer to the opaque Rust object.
3953     * Nearly everywhere, inner must be non-null, however in places where
3954     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3955     */
3956    LDKnativeFixedPenaltyScorer *inner;
3957    /**
3958     * Indicates that this is the only struct which contains the same pointer.
3959     * Rust functions which take ownership of an object provided via an argument require
3960     * this to be true and invalidate the object pointed to by inner.
3961     */
3962    bool is_owned;
3963 } LDKFixedPenaltyScorer;
3964
3965 /**
3966  * The contents of CResult_FixedPenaltyScorerDecodeErrorZ
3967  */
3968 typedef union LDKCResult_FixedPenaltyScorerDecodeErrorZPtr {
3969    /**
3970     * A pointer to the contents in the success state.
3971     * Reading from this pointer when `result_ok` is not set is undefined.
3972     */
3973    struct LDKFixedPenaltyScorer *result;
3974    /**
3975     * A pointer to the contents in the error state.
3976     * Reading from this pointer when `result_ok` is set is undefined.
3977     */
3978    struct LDKDecodeError *err;
3979 } LDKCResult_FixedPenaltyScorerDecodeErrorZPtr;
3980
3981 /**
3982  * A CResult_FixedPenaltyScorerDecodeErrorZ represents the result of a fallible operation,
3983  * containing a crate::lightning::routing::scoring::FixedPenaltyScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
3984  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3985  */
3986 typedef struct LDKCResult_FixedPenaltyScorerDecodeErrorZ {
3987    /**
3988     * The contents of this CResult_FixedPenaltyScorerDecodeErrorZ, accessible via either
3989     * `err` or `result` depending on the state of `result_ok`.
3990     */
3991    union LDKCResult_FixedPenaltyScorerDecodeErrorZPtr contents;
3992    /**
3993     * Whether this CResult_FixedPenaltyScorerDecodeErrorZ represents a success state.
3994     */
3995    bool result_ok;
3996 } LDKCResult_FixedPenaltyScorerDecodeErrorZ;
3997
3998 /**
3999  * A dynamically-allocated array of crate::lightning::routing::gossip::NodeIds of arbitrary size.
4000  * This corresponds to std::vector in C++
4001  */
4002 typedef struct LDKCVec_NodeIdZ {
4003    /**
4004     * The elements in the array.
4005     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4006     */
4007    struct LDKNodeId *data;
4008    /**
4009     * The number of elements pointed to by `data`.
4010     */
4011    uintptr_t datalen;
4012 } LDKCVec_NodeIdZ;
4013
4014 /**
4015  * A tuple of 2 elements. See the individual fields for the types contained.
4016  */
4017 typedef struct LDKC2Tuple_u64u64Z {
4018    /**
4019     * The element at position 0
4020     */
4021    uint64_t a;
4022    /**
4023     * The element at position 1
4024     */
4025    uint64_t b;
4026 } LDKC2Tuple_u64u64Z;
4027
4028 /**
4029  * An enum which can either contain a crate::c_types::derived::C2Tuple_u64u64Z or not
4030  */
4031 typedef enum LDKCOption_C2Tuple_u64u64ZZ_Tag {
4032    /**
4033     * When we're in this state, this COption_C2Tuple_u64u64ZZ contains a crate::c_types::derived::C2Tuple_u64u64Z
4034     */
4035    LDKCOption_C2Tuple_u64u64ZZ_Some,
4036    /**
4037     * When we're in this state, this COption_C2Tuple_u64u64ZZ contains nothing
4038     */
4039    LDKCOption_C2Tuple_u64u64ZZ_None,
4040    /**
4041     * Must be last for serialization purposes
4042     */
4043    LDKCOption_C2Tuple_u64u64ZZ_Sentinel,
4044 } LDKCOption_C2Tuple_u64u64ZZ_Tag;
4045
4046 typedef struct LDKCOption_C2Tuple_u64u64ZZ {
4047    LDKCOption_C2Tuple_u64u64ZZ_Tag tag;
4048    union {
4049       struct {
4050          struct LDKC2Tuple_u64u64Z some;
4051       };
4052    };
4053 } LDKCOption_C2Tuple_u64u64ZZ;
4054
4055 /**
4056  * 8 u16s
4057  */
4058 typedef struct LDKEightU16s {
4059    /**
4060     * The eight 16-bit integers
4061     */
4062    uint16_t data[8];
4063 } LDKEightU16s;
4064
4065 /**
4066  * A tuple of 2 elements. See the individual fields for the types contained.
4067  */
4068 typedef struct LDKC2Tuple_Z {
4069    /**
4070     * The element at position 0
4071     */
4072    struct LDKEightU16s a;
4073    /**
4074     * The element at position 1
4075     */
4076    struct LDKEightU16s b;
4077 } LDKC2Tuple_Z;
4078
4079 /**
4080  * A tuple of 2 elements. See the individual fields for the types contained.
4081  */
4082 typedef struct LDKC2Tuple__u168_u168Z {
4083    /**
4084     * The element at position 0
4085     */
4086    struct LDKEightU16s a;
4087    /**
4088     * The element at position 1
4089     */
4090    struct LDKEightU16s b;
4091 } LDKC2Tuple__u168_u168Z;
4092
4093 /**
4094  * An enum which can either contain a crate::c_types::derived::C2Tuple__u168_u168Z or not
4095  */
4096 typedef enum LDKCOption_C2Tuple_EightU16sEightU16sZZ_Tag {
4097    /**
4098     * When we're in this state, this COption_C2Tuple_EightU16sEightU16sZZ contains a crate::c_types::derived::C2Tuple__u168_u168Z
4099     */
4100    LDKCOption_C2Tuple_EightU16sEightU16sZZ_Some,
4101    /**
4102     * When we're in this state, this COption_C2Tuple_EightU16sEightU16sZZ contains nothing
4103     */
4104    LDKCOption_C2Tuple_EightU16sEightU16sZZ_None,
4105    /**
4106     * Must be last for serialization purposes
4107     */
4108    LDKCOption_C2Tuple_EightU16sEightU16sZZ_Sentinel,
4109 } LDKCOption_C2Tuple_EightU16sEightU16sZZ_Tag;
4110
4111 typedef struct LDKCOption_C2Tuple_EightU16sEightU16sZZ {
4112    LDKCOption_C2Tuple_EightU16sEightU16sZZ_Tag tag;
4113    union {
4114       struct {
4115          struct LDKC2Tuple__u168_u168Z some;
4116       };
4117    };
4118 } LDKCOption_C2Tuple_EightU16sEightU16sZZ;
4119
4120
4121
4122 /**
4123  * A Record, unit of logging output with Metadata to enable filtering
4124  * Module_path, file, line to inform on log's source
4125  */
4126 typedef struct MUST_USE_STRUCT LDKRecord {
4127    /**
4128     * A pointer to the opaque Rust object.
4129     * Nearly everywhere, inner must be non-null, however in places where
4130     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4131     */
4132    LDKnativeRecord *inner;
4133    /**
4134     * Indicates that this is the only struct which contains the same pointer.
4135     * Rust functions which take ownership of an object provided via an argument require
4136     * this to be true and invalidate the object pointed to by inner.
4137     */
4138    bool is_owned;
4139 } LDKRecord;
4140
4141 /**
4142  * A trait encapsulating the operations required of a logger
4143  */
4144 typedef struct LDKLogger {
4145    /**
4146     * An opaque pointer which is passed to your function implementations as an argument.
4147     * This has no meaning in the LDK, and can be NULL or any other value.
4148     */
4149    void *this_arg;
4150    /**
4151     * Logs the `Record`
4152     */
4153    void (*log)(const void *this_arg, const struct LDKRecord *NONNULL_PTR record);
4154    /**
4155     * Frees any resources associated with this object given its this_arg pointer.
4156     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
4157     */
4158    void (*free)(void *this_arg);
4159 } LDKLogger;
4160
4161
4162
4163 /**
4164  * Represents the network as nodes and channels between them
4165  */
4166 typedef struct MUST_USE_STRUCT LDKNetworkGraph {
4167    /**
4168     * A pointer to the opaque Rust object.
4169     * Nearly everywhere, inner must be non-null, however in places where
4170     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4171     */
4172    LDKnativeNetworkGraph *inner;
4173    /**
4174     * Indicates that this is the only struct which contains the same pointer.
4175     * Rust functions which take ownership of an object provided via an argument require
4176     * this to be true and invalidate the object pointed to by inner.
4177     */
4178    bool is_owned;
4179 } LDKNetworkGraph;
4180
4181
4182
4183 /**
4184  * [`Score`] implementation using channel success probability distributions.
4185  *
4186  * Channels are tracked with upper and lower liquidity bounds - when an HTLC fails at a channel,
4187  * we learn that the upper-bound on the available liquidity is lower than the amount of the HTLC.
4188  * When a payment is forwarded through a channel (but fails later in the route), we learn the
4189  * lower-bound on the channel's available liquidity must be at least the value of the HTLC.
4190  *
4191  * These bounds are then used to determine a success probability using the formula from
4192  * *Optimally Reliable & Cheap Payment Flows on the Lightning Network* by Rene Pickhardt
4193  * and Stefan Richter [[1]] (i.e. `(upper_bound - payment_amount) / (upper_bound - lower_bound)`).
4194  *
4195  * This probability is combined with the [`liquidity_penalty_multiplier_msat`] and
4196  * [`liquidity_penalty_amount_multiplier_msat`] parameters to calculate a concrete penalty in
4197  * milli-satoshis. The penalties, when added across all hops, have the property of being linear in
4198  * terms of the entire path's success probability. This allows the router to directly compare
4199  * penalties for different paths. See the documentation of those parameters for the exact formulas.
4200  *
4201  * The liquidity bounds are decayed by halving them every [`liquidity_offset_half_life`].
4202  *
4203  * Further, we track the history of our upper and lower liquidity bounds for each channel,
4204  * allowing us to assign a second penalty (using [`historical_liquidity_penalty_multiplier_msat`]
4205  * and [`historical_liquidity_penalty_amount_multiplier_msat`]) based on the same probability
4206  * formula, but using the history of a channel rather than our latest estimates for the liquidity
4207  * bounds.
4208  *
4209  * # Note
4210  *
4211  * Mixing the `no-std` feature between serialization and deserialization results in undefined
4212  * behavior.
4213  *
4214  * [1]: https://arxiv.org/abs/2107.05322
4215  * [`liquidity_penalty_multiplier_msat`]: ProbabilisticScoringFeeParameters::liquidity_penalty_multiplier_msat
4216  * [`liquidity_penalty_amount_multiplier_msat`]: ProbabilisticScoringFeeParameters::liquidity_penalty_amount_multiplier_msat
4217  * [`liquidity_offset_half_life`]: ProbabilisticScoringDecayParameters::liquidity_offset_half_life
4218  * [`historical_liquidity_penalty_multiplier_msat`]: ProbabilisticScoringFeeParameters::historical_liquidity_penalty_multiplier_msat
4219  * [`historical_liquidity_penalty_amount_multiplier_msat`]: ProbabilisticScoringFeeParameters::historical_liquidity_penalty_amount_multiplier_msat
4220  */
4221 typedef struct MUST_USE_STRUCT LDKProbabilisticScorer {
4222    /**
4223     * A pointer to the opaque Rust object.
4224     * Nearly everywhere, inner must be non-null, however in places where
4225     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4226     */
4227    LDKnativeProbabilisticScorer *inner;
4228    /**
4229     * Indicates that this is the only struct which contains the same pointer.
4230     * Rust functions which take ownership of an object provided via an argument require
4231     * this to be true and invalidate the object pointed to by inner.
4232     */
4233    bool is_owned;
4234 } LDKProbabilisticScorer;
4235
4236 /**
4237  * The contents of CResult_ProbabilisticScorerDecodeErrorZ
4238  */
4239 typedef union LDKCResult_ProbabilisticScorerDecodeErrorZPtr {
4240    /**
4241     * A pointer to the contents in the success state.
4242     * Reading from this pointer when `result_ok` is not set is undefined.
4243     */
4244    struct LDKProbabilisticScorer *result;
4245    /**
4246     * A pointer to the contents in the error state.
4247     * Reading from this pointer when `result_ok` is set is undefined.
4248     */
4249    struct LDKDecodeError *err;
4250 } LDKCResult_ProbabilisticScorerDecodeErrorZPtr;
4251
4252 /**
4253  * A CResult_ProbabilisticScorerDecodeErrorZ represents the result of a fallible operation,
4254  * containing a crate::lightning::routing::scoring::ProbabilisticScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
4255  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4256  */
4257 typedef struct LDKCResult_ProbabilisticScorerDecodeErrorZ {
4258    /**
4259     * The contents of this CResult_ProbabilisticScorerDecodeErrorZ, accessible via either
4260     * `err` or `result` depending on the state of `result_ok`.
4261     */
4262    union LDKCResult_ProbabilisticScorerDecodeErrorZPtr contents;
4263    /**
4264     * Whether this CResult_ProbabilisticScorerDecodeErrorZ represents a success state.
4265     */
4266    bool result_ok;
4267 } LDKCResult_ProbabilisticScorerDecodeErrorZ;
4268
4269 /**
4270  * A tuple of 2 elements. See the individual fields for the types contained.
4271  */
4272 typedef struct LDKC2Tuple_usizeTransactionZ {
4273    /**
4274     * The element at position 0
4275     */
4276    uintptr_t a;
4277    /**
4278     * The element at position 1
4279     */
4280    struct LDKTransaction b;
4281 } LDKC2Tuple_usizeTransactionZ;
4282
4283 /**
4284  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
4285  * This corresponds to std::vector in C++
4286  */
4287 typedef struct LDKCVec_C2Tuple_usizeTransactionZZ {
4288    /**
4289     * The elements in the array.
4290     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4291     */
4292    struct LDKC2Tuple_usizeTransactionZ *data;
4293    /**
4294     * The number of elements pointed to by `data`.
4295     */
4296    uintptr_t datalen;
4297 } LDKCVec_C2Tuple_usizeTransactionZZ;
4298
4299 /**
4300  * An enum which can either contain a crate::c_types::ThirtyTwoBytes or not
4301  */
4302 typedef enum LDKCOption_BlockHashZ_Tag {
4303    /**
4304     * When we're in this state, this COption_BlockHashZ contains a crate::c_types::ThirtyTwoBytes
4305     */
4306    LDKCOption_BlockHashZ_Some,
4307    /**
4308     * When we're in this state, this COption_BlockHashZ contains nothing
4309     */
4310    LDKCOption_BlockHashZ_None,
4311    /**
4312     * Must be last for serialization purposes
4313     */
4314    LDKCOption_BlockHashZ_Sentinel,
4315 } LDKCOption_BlockHashZ_Tag;
4316
4317 typedef struct LDKCOption_BlockHashZ {
4318    LDKCOption_BlockHashZ_Tag tag;
4319    union {
4320       struct {
4321          struct LDKThirtyTwoBytes some;
4322       };
4323    };
4324 } LDKCOption_BlockHashZ;
4325
4326 /**
4327  * A tuple of 2 elements. See the individual fields for the types contained.
4328  */
4329 typedef struct LDKC2Tuple_TxidCOption_BlockHashZZ {
4330    /**
4331     * The element at position 0
4332     */
4333    struct LDKThirtyTwoBytes a;
4334    /**
4335     * The element at position 1
4336     */
4337    struct LDKCOption_BlockHashZ b;
4338 } LDKC2Tuple_TxidCOption_BlockHashZZ;
4339
4340 /**
4341  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCOption_BlockHashZZs of arbitrary size.
4342  * This corresponds to std::vector in C++
4343  */
4344 typedef struct LDKCVec_C2Tuple_TxidCOption_BlockHashZZZ {
4345    /**
4346     * The elements in the array.
4347     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4348     */
4349    struct LDKC2Tuple_TxidCOption_BlockHashZZ *data;
4350    /**
4351     * The number of elements pointed to by `data`.
4352     */
4353    uintptr_t datalen;
4354 } LDKCVec_C2Tuple_TxidCOption_BlockHashZZZ;
4355
4356
4357
4358 /**
4359  * Simple structure sent back by `chain::Watch` when an HTLC from a forward channel is detected on
4360  * chain. Used to update the corresponding HTLC in the backward channel. Failing to pass the
4361  * preimage claim backward will lead to loss of funds.
4362  */
4363 typedef struct MUST_USE_STRUCT LDKHTLCUpdate {
4364    /**
4365     * A pointer to the opaque Rust object.
4366     * Nearly everywhere, inner must be non-null, however in places where
4367     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4368     */
4369    LDKnativeHTLCUpdate *inner;
4370    /**
4371     * Indicates that this is the only struct which contains the same pointer.
4372     * Rust functions which take ownership of an object provided via an argument require
4373     * this to be true and invalidate the object pointed to by inner.
4374     */
4375    bool is_owned;
4376 } LDKHTLCUpdate;
4377
4378 /**
4379  * An event to be processed by the ChannelManager.
4380  */
4381 typedef enum LDKMonitorEvent_Tag {
4382    /**
4383     * A monitor event containing an HTLCUpdate.
4384     */
4385    LDKMonitorEvent_HTLCEvent,
4386    /**
4387     * A monitor event that the Channel's commitment transaction was confirmed.
4388     */
4389    LDKMonitorEvent_CommitmentTxConfirmed,
4390    /**
4391     * Indicates a [`ChannelMonitor`] update has completed. See
4392     * [`ChannelMonitorUpdateStatus::InProgress`] for more information on how this is used.
4393     *
4394     * [`ChannelMonitorUpdateStatus::InProgress`]: super::ChannelMonitorUpdateStatus::InProgress
4395     */
4396    LDKMonitorEvent_Completed,
4397    /**
4398     * Indicates a [`ChannelMonitor`] update has failed. See
4399     * [`ChannelMonitorUpdateStatus::PermanentFailure`] for more information on how this is used.
4400     *
4401     * [`ChannelMonitorUpdateStatus::PermanentFailure`]: super::ChannelMonitorUpdateStatus::PermanentFailure
4402     */
4403    LDKMonitorEvent_UpdateFailed,
4404    /**
4405     * Must be last for serialization purposes
4406     */
4407    LDKMonitorEvent_Sentinel,
4408 } LDKMonitorEvent_Tag;
4409
4410 typedef struct LDKMonitorEvent_LDKCompleted_Body {
4411    /**
4412     * The funding outpoint of the [`ChannelMonitor`] that was updated
4413     */
4414    struct LDKOutPoint funding_txo;
4415    /**
4416     * The Update ID from [`ChannelMonitorUpdate::update_id`] which was applied or
4417     * [`ChannelMonitor::get_latest_update_id`].
4418     *
4419     * Note that this should only be set to a given update's ID if all previous updates for the
4420     * same [`ChannelMonitor`] have been applied and persisted.
4421     */
4422    uint64_t monitor_update_id;
4423 } LDKMonitorEvent_LDKCompleted_Body;
4424
4425 typedef struct MUST_USE_STRUCT LDKMonitorEvent {
4426    LDKMonitorEvent_Tag tag;
4427    union {
4428       struct {
4429          struct LDKHTLCUpdate htlc_event;
4430       };
4431       struct {
4432          struct LDKOutPoint commitment_tx_confirmed;
4433       };
4434       LDKMonitorEvent_LDKCompleted_Body completed;
4435       struct {
4436          struct LDKOutPoint update_failed;
4437       };
4438    };
4439 } LDKMonitorEvent;
4440
4441 /**
4442  * A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
4443  * This corresponds to std::vector in C++
4444  */
4445 typedef struct LDKCVec_MonitorEventZ {
4446    /**
4447     * The elements in the array.
4448     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4449     */
4450    struct LDKMonitorEvent *data;
4451    /**
4452     * The number of elements pointed to by `data`.
4453     */
4454    uintptr_t datalen;
4455 } LDKCVec_MonitorEventZ;
4456
4457 /**
4458  * A tuple of 3 elements. See the individual fields for the types contained.
4459  */
4460 typedef struct LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
4461    /**
4462     * The element at position 0
4463     */
4464    struct LDKOutPoint a;
4465    /**
4466     * The element at position 1
4467     */
4468    struct LDKCVec_MonitorEventZ b;
4469    /**
4470     * The element at position 2
4471     */
4472    struct LDKPublicKey c;
4473 } LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ;
4474
4475 /**
4476  * A dynamically-allocated array of crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZs of arbitrary size.
4477  * This corresponds to std::vector in C++
4478  */
4479 typedef struct LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
4480    /**
4481     * The elements in the array.
4482     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4483     */
4484    struct LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *data;
4485    /**
4486     * The number of elements pointed to by `data`.
4487     */
4488    uintptr_t datalen;
4489 } LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ;
4490
4491
4492
4493 /**
4494  * Features used within an `init` message.
4495  */
4496 typedef struct MUST_USE_STRUCT LDKInitFeatures {
4497    /**
4498     * A pointer to the opaque Rust object.
4499     * Nearly everywhere, inner must be non-null, however in places where
4500     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4501     */
4502    LDKnativeInitFeatures *inner;
4503    /**
4504     * Indicates that this is the only struct which contains the same pointer.
4505     * Rust functions which take ownership of an object provided via an argument require
4506     * this to be true and invalidate the object pointed to by inner.
4507     */
4508    bool is_owned;
4509 } LDKInitFeatures;
4510
4511 /**
4512  * The contents of CResult_InitFeaturesDecodeErrorZ
4513  */
4514 typedef union LDKCResult_InitFeaturesDecodeErrorZPtr {
4515    /**
4516     * A pointer to the contents in the success state.
4517     * Reading from this pointer when `result_ok` is not set is undefined.
4518     */
4519    struct LDKInitFeatures *result;
4520    /**
4521     * A pointer to the contents in the error state.
4522     * Reading from this pointer when `result_ok` is set is undefined.
4523     */
4524    struct LDKDecodeError *err;
4525 } LDKCResult_InitFeaturesDecodeErrorZPtr;
4526
4527 /**
4528  * A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
4529  * containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4530  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4531  */
4532 typedef struct LDKCResult_InitFeaturesDecodeErrorZ {
4533    /**
4534     * The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
4535     * `err` or `result` depending on the state of `result_ok`.
4536     */
4537    union LDKCResult_InitFeaturesDecodeErrorZPtr contents;
4538    /**
4539     * Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
4540     */
4541    bool result_ok;
4542 } LDKCResult_InitFeaturesDecodeErrorZ;
4543
4544
4545
4546 /**
4547  * Features used within a `channel_announcement` message.
4548  */
4549 typedef struct MUST_USE_STRUCT LDKChannelFeatures {
4550    /**
4551     * A pointer to the opaque Rust object.
4552     * Nearly everywhere, inner must be non-null, however in places where
4553     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4554     */
4555    LDKnativeChannelFeatures *inner;
4556    /**
4557     * Indicates that this is the only struct which contains the same pointer.
4558     * Rust functions which take ownership of an object provided via an argument require
4559     * this to be true and invalidate the object pointed to by inner.
4560     */
4561    bool is_owned;
4562 } LDKChannelFeatures;
4563
4564 /**
4565  * The contents of CResult_ChannelFeaturesDecodeErrorZ
4566  */
4567 typedef union LDKCResult_ChannelFeaturesDecodeErrorZPtr {
4568    /**
4569     * A pointer to the contents in the success state.
4570     * Reading from this pointer when `result_ok` is not set is undefined.
4571     */
4572    struct LDKChannelFeatures *result;
4573    /**
4574     * A pointer to the contents in the error state.
4575     * Reading from this pointer when `result_ok` is set is undefined.
4576     */
4577    struct LDKDecodeError *err;
4578 } LDKCResult_ChannelFeaturesDecodeErrorZPtr;
4579
4580 /**
4581  * A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
4582  * containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4583  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4584  */
4585 typedef struct LDKCResult_ChannelFeaturesDecodeErrorZ {
4586    /**
4587     * The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
4588     * `err` or `result` depending on the state of `result_ok`.
4589     */
4590    union LDKCResult_ChannelFeaturesDecodeErrorZPtr contents;
4591    /**
4592     * Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
4593     */
4594    bool result_ok;
4595 } LDKCResult_ChannelFeaturesDecodeErrorZ;
4596
4597
4598
4599 /**
4600  * Features used within a `node_announcement` message.
4601  */
4602 typedef struct MUST_USE_STRUCT LDKNodeFeatures {
4603    /**
4604     * A pointer to the opaque Rust object.
4605     * Nearly everywhere, inner must be non-null, however in places where
4606     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4607     */
4608    LDKnativeNodeFeatures *inner;
4609    /**
4610     * Indicates that this is the only struct which contains the same pointer.
4611     * Rust functions which take ownership of an object provided via an argument require
4612     * this to be true and invalidate the object pointed to by inner.
4613     */
4614    bool is_owned;
4615 } LDKNodeFeatures;
4616
4617 /**
4618  * The contents of CResult_NodeFeaturesDecodeErrorZ
4619  */
4620 typedef union LDKCResult_NodeFeaturesDecodeErrorZPtr {
4621    /**
4622     * A pointer to the contents in the success state.
4623     * Reading from this pointer when `result_ok` is not set is undefined.
4624     */
4625    struct LDKNodeFeatures *result;
4626    /**
4627     * A pointer to the contents in the error state.
4628     * Reading from this pointer when `result_ok` is set is undefined.
4629     */
4630    struct LDKDecodeError *err;
4631 } LDKCResult_NodeFeaturesDecodeErrorZPtr;
4632
4633 /**
4634  * A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
4635  * containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4636  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4637  */
4638 typedef struct LDKCResult_NodeFeaturesDecodeErrorZ {
4639    /**
4640     * The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
4641     * `err` or `result` depending on the state of `result_ok`.
4642     */
4643    union LDKCResult_NodeFeaturesDecodeErrorZPtr contents;
4644    /**
4645     * Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
4646     */
4647    bool result_ok;
4648 } LDKCResult_NodeFeaturesDecodeErrorZ;
4649
4650
4651
4652 /**
4653  * Features used within an invoice.
4654  */
4655 typedef struct MUST_USE_STRUCT LDKBolt11InvoiceFeatures {
4656    /**
4657     * A pointer to the opaque Rust object.
4658     * Nearly everywhere, inner must be non-null, however in places where
4659     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4660     */
4661    LDKnativeBolt11InvoiceFeatures *inner;
4662    /**
4663     * Indicates that this is the only struct which contains the same pointer.
4664     * Rust functions which take ownership of an object provided via an argument require
4665     * this to be true and invalidate the object pointed to by inner.
4666     */
4667    bool is_owned;
4668 } LDKBolt11InvoiceFeatures;
4669
4670 /**
4671  * The contents of CResult_Bolt11InvoiceFeaturesDecodeErrorZ
4672  */
4673 typedef union LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZPtr {
4674    /**
4675     * A pointer to the contents in the success state.
4676     * Reading from this pointer when `result_ok` is not set is undefined.
4677     */
4678    struct LDKBolt11InvoiceFeatures *result;
4679    /**
4680     * A pointer to the contents in the error state.
4681     * Reading from this pointer when `result_ok` is set is undefined.
4682     */
4683    struct LDKDecodeError *err;
4684 } LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZPtr;
4685
4686 /**
4687  * A CResult_Bolt11InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
4688  * containing a crate::lightning::ln::features::Bolt11InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4689  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4690  */
4691 typedef struct LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ {
4692    /**
4693     * The contents of this CResult_Bolt11InvoiceFeaturesDecodeErrorZ, accessible via either
4694     * `err` or `result` depending on the state of `result_ok`.
4695     */
4696    union LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZPtr contents;
4697    /**
4698     * Whether this CResult_Bolt11InvoiceFeaturesDecodeErrorZ represents a success state.
4699     */
4700    bool result_ok;
4701 } LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ;
4702
4703
4704
4705 /**
4706  * Features used within an `invoice`.
4707  */
4708 typedef struct MUST_USE_STRUCT LDKBolt12InvoiceFeatures {
4709    /**
4710     * A pointer to the opaque Rust object.
4711     * Nearly everywhere, inner must be non-null, however in places where
4712     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4713     */
4714    LDKnativeBolt12InvoiceFeatures *inner;
4715    /**
4716     * Indicates that this is the only struct which contains the same pointer.
4717     * Rust functions which take ownership of an object provided via an argument require
4718     * this to be true and invalidate the object pointed to by inner.
4719     */
4720    bool is_owned;
4721 } LDKBolt12InvoiceFeatures;
4722
4723 /**
4724  * The contents of CResult_Bolt12InvoiceFeaturesDecodeErrorZ
4725  */
4726 typedef union LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZPtr {
4727    /**
4728     * A pointer to the contents in the success state.
4729     * Reading from this pointer when `result_ok` is not set is undefined.
4730     */
4731    struct LDKBolt12InvoiceFeatures *result;
4732    /**
4733     * A pointer to the contents in the error state.
4734     * Reading from this pointer when `result_ok` is set is undefined.
4735     */
4736    struct LDKDecodeError *err;
4737 } LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZPtr;
4738
4739 /**
4740  * A CResult_Bolt12InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
4741  * containing a crate::lightning::ln::features::Bolt12InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4742  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4743  */
4744 typedef struct LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ {
4745    /**
4746     * The contents of this CResult_Bolt12InvoiceFeaturesDecodeErrorZ, accessible via either
4747     * `err` or `result` depending on the state of `result_ok`.
4748     */
4749    union LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZPtr contents;
4750    /**
4751     * Whether this CResult_Bolt12InvoiceFeaturesDecodeErrorZ represents a success state.
4752     */
4753    bool result_ok;
4754 } LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ;
4755
4756
4757
4758 /**
4759  * Features used within BOLT 4 encrypted_data_tlv and BOLT 12 blinded_payinfo
4760  */
4761 typedef struct MUST_USE_STRUCT LDKBlindedHopFeatures {
4762    /**
4763     * A pointer to the opaque Rust object.
4764     * Nearly everywhere, inner must be non-null, however in places where
4765     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4766     */
4767    LDKnativeBlindedHopFeatures *inner;
4768    /**
4769     * Indicates that this is the only struct which contains the same pointer.
4770     * Rust functions which take ownership of an object provided via an argument require
4771     * this to be true and invalidate the object pointed to by inner.
4772     */
4773    bool is_owned;
4774 } LDKBlindedHopFeatures;
4775
4776 /**
4777  * The contents of CResult_BlindedHopFeaturesDecodeErrorZ
4778  */
4779 typedef union LDKCResult_BlindedHopFeaturesDecodeErrorZPtr {
4780    /**
4781     * A pointer to the contents in the success state.
4782     * Reading from this pointer when `result_ok` is not set is undefined.
4783     */
4784    struct LDKBlindedHopFeatures *result;
4785    /**
4786     * A pointer to the contents in the error state.
4787     * Reading from this pointer when `result_ok` is set is undefined.
4788     */
4789    struct LDKDecodeError *err;
4790 } LDKCResult_BlindedHopFeaturesDecodeErrorZPtr;
4791
4792 /**
4793  * A CResult_BlindedHopFeaturesDecodeErrorZ represents the result of a fallible operation,
4794  * containing a crate::lightning::ln::features::BlindedHopFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4795  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4796  */
4797 typedef struct LDKCResult_BlindedHopFeaturesDecodeErrorZ {
4798    /**
4799     * The contents of this CResult_BlindedHopFeaturesDecodeErrorZ, accessible via either
4800     * `err` or `result` depending on the state of `result_ok`.
4801     */
4802    union LDKCResult_BlindedHopFeaturesDecodeErrorZPtr contents;
4803    /**
4804     * Whether this CResult_BlindedHopFeaturesDecodeErrorZ represents a success state.
4805     */
4806    bool result_ok;
4807 } LDKCResult_BlindedHopFeaturesDecodeErrorZ;
4808
4809
4810
4811 /**
4812  * Features used within the channel_type field in an OpenChannel message.
4813  *
4814  * A channel is always of some known \"type\", describing the transaction formats used and the exact
4815  * semantics of our interaction with our peer.
4816  *
4817  * Note that because a channel is a specific type which is proposed by the opener and accepted by
4818  * the counterparty, only required features are allowed here.
4819  *
4820  * This is serialized differently from other feature types - it is not prefixed by a length, and
4821  * thus must only appear inside a TLV where its length is known in advance.
4822  */
4823 typedef struct MUST_USE_STRUCT LDKChannelTypeFeatures {
4824    /**
4825     * A pointer to the opaque Rust object.
4826     * Nearly everywhere, inner must be non-null, however in places where
4827     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4828     */
4829    LDKnativeChannelTypeFeatures *inner;
4830    /**
4831     * Indicates that this is the only struct which contains the same pointer.
4832     * Rust functions which take ownership of an object provided via an argument require
4833     * this to be true and invalidate the object pointed to by inner.
4834     */
4835    bool is_owned;
4836 } LDKChannelTypeFeatures;
4837
4838 /**
4839  * The contents of CResult_ChannelTypeFeaturesDecodeErrorZ
4840  */
4841 typedef union LDKCResult_ChannelTypeFeaturesDecodeErrorZPtr {
4842    /**
4843     * A pointer to the contents in the success state.
4844     * Reading from this pointer when `result_ok` is not set is undefined.
4845     */
4846    struct LDKChannelTypeFeatures *result;
4847    /**
4848     * A pointer to the contents in the error state.
4849     * Reading from this pointer when `result_ok` is set is undefined.
4850     */
4851    struct LDKDecodeError *err;
4852 } LDKCResult_ChannelTypeFeaturesDecodeErrorZPtr;
4853
4854 /**
4855  * A CResult_ChannelTypeFeaturesDecodeErrorZ represents the result of a fallible operation,
4856  * containing a crate::lightning::ln::features::ChannelTypeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4857  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4858  */
4859 typedef struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ {
4860    /**
4861     * The contents of this CResult_ChannelTypeFeaturesDecodeErrorZ, accessible via either
4862     * `err` or `result` depending on the state of `result_ok`.
4863     */
4864    union LDKCResult_ChannelTypeFeaturesDecodeErrorZPtr contents;
4865    /**
4866     * Whether this CResult_ChannelTypeFeaturesDecodeErrorZ represents a success state.
4867     */
4868    bool result_ok;
4869 } LDKCResult_ChannelTypeFeaturesDecodeErrorZ;
4870
4871 /**
4872  * A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
4873  * This corresponds to std::vector in C++
4874  */
4875 typedef struct LDKCVec_ChainHashZ {
4876    /**
4877     * The elements in the array.
4878     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4879     */
4880    struct LDKThirtyTwoBytes *data;
4881    /**
4882     * The number of elements pointed to by `data`.
4883     */
4884    uintptr_t datalen;
4885 } LDKCVec_ChainHashZ;
4886
4887
4888
4889 /**
4890  * An `Offer` is a potentially long-lived proposal for payment of a good or service.
4891  *
4892  * An offer is a precursor to an [`InvoiceRequest`]. A merchant publishes an offer from which a
4893  * customer may request an [`Bolt12Invoice`] for a specific quantity and using an amount sufficient
4894  * to cover that quantity (i.e., at least `quantity * amount`). See [`Offer::amount`].
4895  *
4896  * Offers may be denominated in currency other than bitcoin but are ultimately paid using the
4897  * latter.
4898  *
4899  * Through the use of [`BlindedPath`]s, offers provide recipient privacy.
4900  *
4901  * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
4902  * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
4903  */
4904 typedef struct MUST_USE_STRUCT LDKOffer {
4905    /**
4906     * A pointer to the opaque Rust object.
4907     * Nearly everywhere, inner must be non-null, however in places where
4908     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4909     */
4910    LDKnativeOffer *inner;
4911    /**
4912     * Indicates that this is the only struct which contains the same pointer.
4913     * Rust functions which take ownership of an object provided via an argument require
4914     * this to be true and invalidate the object pointed to by inner.
4915     */
4916    bool is_owned;
4917 } LDKOffer;
4918
4919 /**
4920  * The contents of CResult_OfferBolt12ParseErrorZ
4921  */
4922 typedef union LDKCResult_OfferBolt12ParseErrorZPtr {
4923    /**
4924     * A pointer to the contents in the success state.
4925     * Reading from this pointer when `result_ok` is not set is undefined.
4926     */
4927    struct LDKOffer *result;
4928    /**
4929     * A pointer to the contents in the error state.
4930     * Reading from this pointer when `result_ok` is set is undefined.
4931     */
4932    struct LDKBolt12ParseError *err;
4933 } LDKCResult_OfferBolt12ParseErrorZPtr;
4934
4935 /**
4936  * A CResult_OfferBolt12ParseErrorZ represents the result of a fallible operation,
4937  * containing a crate::lightning::offers::offer::Offer on success and a crate::lightning::offers::parse::Bolt12ParseError on failure.
4938  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4939  */
4940 typedef struct LDKCResult_OfferBolt12ParseErrorZ {
4941    /**
4942     * The contents of this CResult_OfferBolt12ParseErrorZ, accessible via either
4943     * `err` or `result` depending on the state of `result_ok`.
4944     */
4945    union LDKCResult_OfferBolt12ParseErrorZPtr contents;
4946    /**
4947     * Whether this CResult_OfferBolt12ParseErrorZ represents a success state.
4948     */
4949    bool result_ok;
4950 } LDKCResult_OfferBolt12ParseErrorZ;
4951
4952 /**
4953  * The contents of CResult_PublicKeyErrorZ
4954  */
4955 typedef union LDKCResult_PublicKeyErrorZPtr {
4956    /**
4957     * A pointer to the contents in the success state.
4958     * Reading from this pointer when `result_ok` is not set is undefined.
4959     */
4960    struct LDKPublicKey *result;
4961    /**
4962     * A pointer to the contents in the error state.
4963     * Reading from this pointer when `result_ok` is set is undefined.
4964     */
4965    enum LDKSecp256k1Error *err;
4966 } LDKCResult_PublicKeyErrorZPtr;
4967
4968 /**
4969  * A CResult_PublicKeyErrorZ represents the result of a fallible operation,
4970  * containing a crate::c_types::PublicKey on success and a crate::c_types::Secp256k1Error on failure.
4971  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4972  */
4973 typedef struct LDKCResult_PublicKeyErrorZ {
4974    /**
4975     * The contents of this CResult_PublicKeyErrorZ, accessible via either
4976     * `err` or `result` depending on the state of `result_ok`.
4977     */
4978    union LDKCResult_PublicKeyErrorZPtr contents;
4979    /**
4980     * Whether this CResult_PublicKeyErrorZ represents a success state.
4981     */
4982    bool result_ok;
4983 } LDKCResult_PublicKeyErrorZ;
4984
4985 /**
4986  * The contents of CResult_NodeIdDecodeErrorZ
4987  */
4988 typedef union LDKCResult_NodeIdDecodeErrorZPtr {
4989    /**
4990     * A pointer to the contents in the success state.
4991     * Reading from this pointer when `result_ok` is not set is undefined.
4992     */
4993    struct LDKNodeId *result;
4994    /**
4995     * A pointer to the contents in the error state.
4996     * Reading from this pointer when `result_ok` is set is undefined.
4997     */
4998    struct LDKDecodeError *err;
4999 } LDKCResult_NodeIdDecodeErrorZPtr;
5000
5001 /**
5002  * A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation,
5003  * containing a crate::lightning::routing::gossip::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure.
5004  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5005  */
5006 typedef struct LDKCResult_NodeIdDecodeErrorZ {
5007    /**
5008     * The contents of this CResult_NodeIdDecodeErrorZ, accessible via either
5009     * `err` or `result` depending on the state of `result_ok`.
5010     */
5011    union LDKCResult_NodeIdDecodeErrorZPtr contents;
5012    /**
5013     * Whether this CResult_NodeIdDecodeErrorZ represents a success state.
5014     */
5015    bool result_ok;
5016 } LDKCResult_NodeIdDecodeErrorZ;
5017
5018
5019
5020 /**
5021  * A [`channel_update`] message to be sent to or received from a peer.
5022  *
5023  * [`channel_update`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-channel_update-message
5024  */
5025 typedef struct MUST_USE_STRUCT LDKChannelUpdate {
5026    /**
5027     * A pointer to the opaque Rust object.
5028     * Nearly everywhere, inner must be non-null, however in places where
5029     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5030     */
5031    LDKnativeChannelUpdate *inner;
5032    /**
5033     * Indicates that this is the only struct which contains the same pointer.
5034     * Rust functions which take ownership of an object provided via an argument require
5035     * this to be true and invalidate the object pointed to by inner.
5036     */
5037    bool is_owned;
5038 } LDKChannelUpdate;
5039
5040 /**
5041  * Update to the [`NetworkGraph`] based on payment failure information conveyed via the Onion
5042  * return packet by a node along the route. See [BOLT #4] for details.
5043  *
5044  * [BOLT #4]: https://github.com/lightning/bolts/blob/master/04-onion-routing.md
5045  */
5046 typedef enum LDKNetworkUpdate_Tag {
5047    /**
5048     * An error indicating a `channel_update` messages should be applied via
5049     * [`NetworkGraph::update_channel`].
5050     */
5051    LDKNetworkUpdate_ChannelUpdateMessage,
5052    /**
5053     * An error indicating that a channel failed to route a payment, which should be applied via
5054     * [`NetworkGraph::channel_failed_permanent`] if permanent.
5055     */
5056    LDKNetworkUpdate_ChannelFailure,
5057    /**
5058     * An error indicating that a node failed to route a payment, which should be applied via
5059     * [`NetworkGraph::node_failed_permanent`] if permanent.
5060     */
5061    LDKNetworkUpdate_NodeFailure,
5062    /**
5063     * Must be last for serialization purposes
5064     */
5065    LDKNetworkUpdate_Sentinel,
5066 } LDKNetworkUpdate_Tag;
5067
5068 typedef struct LDKNetworkUpdate_LDKChannelUpdateMessage_Body {
5069    /**
5070     * The update to apply via [`NetworkGraph::update_channel`].
5071     */
5072    struct LDKChannelUpdate msg;
5073 } LDKNetworkUpdate_LDKChannelUpdateMessage_Body;
5074
5075 typedef struct LDKNetworkUpdate_LDKChannelFailure_Body {
5076    /**
5077     * The short channel id of the closed channel.
5078     */
5079    uint64_t short_channel_id;
5080    /**
5081     * Whether the channel should be permanently removed or temporarily disabled until a new
5082     * `channel_update` message is received.
5083     */
5084    bool is_permanent;
5085 } LDKNetworkUpdate_LDKChannelFailure_Body;
5086
5087 typedef struct LDKNetworkUpdate_LDKNodeFailure_Body {
5088    /**
5089     * The node id of the failed node.
5090     */
5091    struct LDKPublicKey node_id;
5092    /**
5093     * Whether the node should be permanently removed from consideration or can be restored
5094     * when a new `channel_update` message is received.
5095     */
5096    bool is_permanent;
5097 } LDKNetworkUpdate_LDKNodeFailure_Body;
5098
5099 typedef struct MUST_USE_STRUCT LDKNetworkUpdate {
5100    LDKNetworkUpdate_Tag tag;
5101    union {
5102       LDKNetworkUpdate_LDKChannelUpdateMessage_Body channel_update_message;
5103       LDKNetworkUpdate_LDKChannelFailure_Body channel_failure;
5104       LDKNetworkUpdate_LDKNodeFailure_Body node_failure;
5105    };
5106 } LDKNetworkUpdate;
5107
5108 /**
5109  * An enum which can either contain a crate::lightning::routing::gossip::NetworkUpdate or not
5110  */
5111 typedef enum LDKCOption_NetworkUpdateZ_Tag {
5112    /**
5113     * When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::gossip::NetworkUpdate
5114     */
5115    LDKCOption_NetworkUpdateZ_Some,
5116    /**
5117     * When we're in this state, this COption_NetworkUpdateZ contains nothing
5118     */
5119    LDKCOption_NetworkUpdateZ_None,
5120    /**
5121     * Must be last for serialization purposes
5122     */
5123    LDKCOption_NetworkUpdateZ_Sentinel,
5124 } LDKCOption_NetworkUpdateZ_Tag;
5125
5126 typedef struct LDKCOption_NetworkUpdateZ {
5127    LDKCOption_NetworkUpdateZ_Tag tag;
5128    union {
5129       struct {
5130          struct LDKNetworkUpdate some;
5131       };
5132    };
5133 } LDKCOption_NetworkUpdateZ;
5134
5135 /**
5136  * The contents of CResult_COption_NetworkUpdateZDecodeErrorZ
5137  */
5138 typedef union LDKCResult_COption_NetworkUpdateZDecodeErrorZPtr {
5139    /**
5140     * A pointer to the contents in the success state.
5141     * Reading from this pointer when `result_ok` is not set is undefined.
5142     */
5143    struct LDKCOption_NetworkUpdateZ *result;
5144    /**
5145     * A pointer to the contents in the error state.
5146     * Reading from this pointer when `result_ok` is set is undefined.
5147     */
5148    struct LDKDecodeError *err;
5149 } LDKCResult_COption_NetworkUpdateZDecodeErrorZPtr;
5150
5151 /**
5152  * A CResult_COption_NetworkUpdateZDecodeErrorZ represents the result of a fallible operation,
5153  * containing a crate::c_types::derived::COption_NetworkUpdateZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
5154  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5155  */
5156 typedef struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ {
5157    /**
5158     * The contents of this CResult_COption_NetworkUpdateZDecodeErrorZ, accessible via either
5159     * `err` or `result` depending on the state of `result_ok`.
5160     */
5161    union LDKCResult_COption_NetworkUpdateZDecodeErrorZPtr contents;
5162    /**
5163     * Whether this CResult_COption_NetworkUpdateZDecodeErrorZ represents a success state.
5164     */
5165    bool result_ok;
5166 } LDKCResult_COption_NetworkUpdateZDecodeErrorZ;
5167
5168 /**
5169  * The contents of CResult_TxOutUtxoLookupErrorZ
5170  */
5171 typedef union LDKCResult_TxOutUtxoLookupErrorZPtr {
5172    /**
5173     * A pointer to the contents in the success state.
5174     * Reading from this pointer when `result_ok` is not set is undefined.
5175     */
5176    struct LDKTxOut *result;
5177    /**
5178     * A pointer to the contents in the error state.
5179     * Reading from this pointer when `result_ok` is set is undefined.
5180     */
5181    enum LDKUtxoLookupError *err;
5182 } LDKCResult_TxOutUtxoLookupErrorZPtr;
5183
5184 /**
5185  * A CResult_TxOutUtxoLookupErrorZ represents the result of a fallible operation,
5186  * containing a crate::c_types::TxOut on success and a crate::lightning::routing::utxo::UtxoLookupError on failure.
5187  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5188  */
5189 typedef struct LDKCResult_TxOutUtxoLookupErrorZ {
5190    /**
5191     * The contents of this CResult_TxOutUtxoLookupErrorZ, accessible via either
5192     * `err` or `result` depending on the state of `result_ok`.
5193     */
5194    union LDKCResult_TxOutUtxoLookupErrorZPtr contents;
5195    /**
5196     * Whether this CResult_TxOutUtxoLookupErrorZ represents a success state.
5197     */
5198    bool result_ok;
5199 } LDKCResult_TxOutUtxoLookupErrorZ;
5200
5201
5202
5203 /**
5204  * Represents a future resolution of a [`UtxoLookup::get_utxo`] query resolving async.
5205  *
5206  * See [`UtxoResult::Async`] and [`UtxoFuture::resolve`] for more info.
5207  */
5208 typedef struct MUST_USE_STRUCT LDKUtxoFuture {
5209    /**
5210     * A pointer to the opaque Rust object.
5211     * Nearly everywhere, inner must be non-null, however in places where
5212     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5213     */
5214    LDKnativeUtxoFuture *inner;
5215    /**
5216     * Indicates that this is the only struct which contains the same pointer.
5217     * Rust functions which take ownership of an object provided via an argument require
5218     * this to be true and invalidate the object pointed to by inner.
5219     */
5220    bool is_owned;
5221 } LDKUtxoFuture;
5222
5223 /**
5224  * The result of a [`UtxoLookup::get_utxo`] call. A call may resolve either synchronously,
5225  * returning the `Sync` variant, or asynchronously, returning an [`UtxoFuture`] in the `Async`
5226  * variant.
5227  */
5228 typedef enum LDKUtxoResult_Tag {
5229    /**
5230     * A result which was resolved synchronously. It either includes a [`TxOut`] for the output
5231     * requested or a [`UtxoLookupError`].
5232     */
5233    LDKUtxoResult_Sync,
5234    /**
5235     * A result which will be resolved asynchronously. It includes a [`UtxoFuture`], a `clone` of
5236     * which you must keep locally and call [`UtxoFuture::resolve`] on once the lookup completes.
5237     *
5238     * Note that in order to avoid runaway memory usage, the number of parallel checks is limited,
5239     * but only fairly loosely. Because a pending checks block all message processing, leaving
5240     * checks pending for an extended time may cause DoS of other functions. It is recommended you
5241     * keep a tight timeout on lookups, on the order of a few seconds.
5242     */
5243    LDKUtxoResult_Async,
5244    /**
5245     * Must be last for serialization purposes
5246     */
5247    LDKUtxoResult_Sentinel,
5248 } LDKUtxoResult_Tag;
5249
5250 typedef struct MUST_USE_STRUCT LDKUtxoResult {
5251    LDKUtxoResult_Tag tag;
5252    union {
5253       struct {
5254          struct LDKCResult_TxOutUtxoLookupErrorZ sync;
5255       };
5256       struct {
5257          struct LDKUtxoFuture async;
5258       };
5259    };
5260 } LDKUtxoResult;
5261
5262 /**
5263  * The `UtxoLookup` trait defines behavior for accessing on-chain UTXOs.
5264  */
5265 typedef struct LDKUtxoLookup {
5266    /**
5267     * An opaque pointer which is passed to your function implementations as an argument.
5268     * This has no meaning in the LDK, and can be NULL or any other value.
5269     */
5270    void *this_arg;
5271    /**
5272     * Returns the transaction output of a funding transaction encoded by [`short_channel_id`].
5273     * Returns an error if `genesis_hash` is for a different chain or if such a transaction output
5274     * is unknown.
5275     *
5276     * [`short_channel_id`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#definition-of-short_channel_id
5277     */
5278    struct LDKUtxoResult (*get_utxo)(const void *this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id);
5279    /**
5280     * Frees any resources associated with this object given its this_arg pointer.
5281     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
5282     */
5283    void (*free)(void *this_arg);
5284 } LDKUtxoLookup;
5285
5286 /**
5287  * An enum which can either contain a crate::lightning::routing::utxo::UtxoLookup or not
5288  */
5289 typedef enum LDKCOption_UtxoLookupZ_Tag {
5290    /**
5291     * When we're in this state, this COption_UtxoLookupZ contains a crate::lightning::routing::utxo::UtxoLookup
5292     */
5293    LDKCOption_UtxoLookupZ_Some,
5294    /**
5295     * When we're in this state, this COption_UtxoLookupZ contains nothing
5296     */
5297    LDKCOption_UtxoLookupZ_None,
5298    /**
5299     * Must be last for serialization purposes
5300     */
5301    LDKCOption_UtxoLookupZ_Sentinel,
5302 } LDKCOption_UtxoLookupZ_Tag;
5303
5304 typedef struct LDKCOption_UtxoLookupZ {
5305    LDKCOption_UtxoLookupZ_Tag tag;
5306    union {
5307       struct {
5308          struct LDKUtxoLookup some;
5309       };
5310    };
5311 } LDKCOption_UtxoLookupZ;
5312
5313 /**
5314  * The contents of CResult_NoneLightningErrorZ
5315  */
5316 typedef union LDKCResult_NoneLightningErrorZPtr {
5317    /**
5318     * Note that this value is always NULL, as there are no contents in the OK variant
5319     */
5320    void *result;
5321    /**
5322     * A pointer to the contents in the error state.
5323     * Reading from this pointer when `result_ok` is set is undefined.
5324     */
5325    struct LDKLightningError *err;
5326 } LDKCResult_NoneLightningErrorZPtr;
5327
5328 /**
5329  * A CResult_NoneLightningErrorZ represents the result of a fallible operation,
5330  * containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
5331  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5332  */
5333 typedef struct LDKCResult_NoneLightningErrorZ {
5334    /**
5335     * The contents of this CResult_NoneLightningErrorZ, accessible via either
5336     * `err` or `result` depending on the state of `result_ok`.
5337     */
5338    union LDKCResult_NoneLightningErrorZPtr contents;
5339    /**
5340     * Whether this CResult_NoneLightningErrorZ represents a success state.
5341     */
5342    bool result_ok;
5343 } LDKCResult_NoneLightningErrorZ;
5344
5345 /**
5346  * The contents of CResult_boolLightningErrorZ
5347  */
5348 typedef union LDKCResult_boolLightningErrorZPtr {
5349    /**
5350     * A pointer to the contents in the success state.
5351     * Reading from this pointer when `result_ok` is not set is undefined.
5352     */
5353    bool *result;
5354    /**
5355     * A pointer to the contents in the error state.
5356     * Reading from this pointer when `result_ok` is set is undefined.
5357     */
5358    struct LDKLightningError *err;
5359 } LDKCResult_boolLightningErrorZPtr;
5360
5361 /**
5362  * A CResult_boolLightningErrorZ represents the result of a fallible operation,
5363  * containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
5364  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5365  */
5366 typedef struct LDKCResult_boolLightningErrorZ {
5367    /**
5368     * The contents of this CResult_boolLightningErrorZ, accessible via either
5369     * `err` or `result` depending on the state of `result_ok`.
5370     */
5371    union LDKCResult_boolLightningErrorZPtr contents;
5372    /**
5373     * Whether this CResult_boolLightningErrorZ represents a success state.
5374     */
5375    bool result_ok;
5376 } LDKCResult_boolLightningErrorZ;
5377
5378
5379
5380 /**
5381  * A [`channel_announcement`] message to be sent to or received from a peer.
5382  *
5383  * [`channel_announcement`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-channel_announcement-message
5384  */
5385 typedef struct MUST_USE_STRUCT LDKChannelAnnouncement {
5386    /**
5387     * A pointer to the opaque Rust object.
5388     * Nearly everywhere, inner must be non-null, however in places where
5389     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5390     */
5391    LDKnativeChannelAnnouncement *inner;
5392    /**
5393     * Indicates that this is the only struct which contains the same pointer.
5394     * Rust functions which take ownership of an object provided via an argument require
5395     * this to be true and invalidate the object pointed to by inner.
5396     */
5397    bool is_owned;
5398 } LDKChannelAnnouncement;
5399
5400 /**
5401  * A tuple of 3 elements. See the individual fields for the types contained.
5402  */
5403 typedef struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
5404    /**
5405     * The element at position 0
5406     */
5407    struct LDKChannelAnnouncement a;
5408    /**
5409     * The element at position 1
5410     */
5411    struct LDKChannelUpdate b;
5412    /**
5413     * The element at position 2
5414     */
5415    struct LDKChannelUpdate c;
5416 } LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ;
5417
5418 /**
5419  * An enum which can either contain a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ or not
5420  */
5421 typedef enum LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Tag {
5422    /**
5423     * When we're in this state, this COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ contains a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ
5424     */
5425    LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some,
5426    /**
5427     * When we're in this state, this COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ contains nothing
5428     */
5429    LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None,
5430    /**
5431     * Must be last for serialization purposes
5432     */
5433    LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Sentinel,
5434 } LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Tag;
5435
5436 typedef struct LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
5437    LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Tag tag;
5438    union {
5439       struct {
5440          struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ some;
5441       };
5442    };
5443 } LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ;
5444
5445
5446
5447 /**
5448  * An [`accept_channel`] message to be sent to or received from a peer.
5449  *
5450  * Used in V1 channel establishment
5451  *
5452  * [`accept_channel`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-accept_channel-message
5453  */
5454 typedef struct MUST_USE_STRUCT LDKAcceptChannel {
5455    /**
5456     * A pointer to the opaque Rust object.
5457     * Nearly everywhere, inner must be non-null, however in places where
5458     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5459     */
5460    LDKnativeAcceptChannel *inner;
5461    /**
5462     * Indicates that this is the only struct which contains the same pointer.
5463     * Rust functions which take ownership of an object provided via an argument require
5464     * this to be true and invalidate the object pointed to by inner.
5465     */
5466    bool is_owned;
5467 } LDKAcceptChannel;
5468
5469
5470
5471 /**
5472  * An accept_channel2 message to be sent by or received from the channel accepter.
5473  *
5474  * Used in V2 channel establishment
5475  *
5476  */
5477 typedef struct MUST_USE_STRUCT LDKAcceptChannelV2 {
5478    /**
5479     * A pointer to the opaque Rust object.
5480     * Nearly everywhere, inner must be non-null, however in places where
5481     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5482     */
5483    LDKnativeAcceptChannelV2 *inner;
5484    /**
5485     * Indicates that this is the only struct which contains the same pointer.
5486     * Rust functions which take ownership of an object provided via an argument require
5487     * this to be true and invalidate the object pointed to by inner.
5488     */
5489    bool is_owned;
5490 } LDKAcceptChannelV2;
5491
5492
5493
5494 /**
5495  * An [`open_channel`] message to be sent to or received from a peer.
5496  *
5497  * Used in V1 channel establishment
5498  *
5499  * [`open_channel`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-open_channel-message
5500  */
5501 typedef struct MUST_USE_STRUCT LDKOpenChannel {
5502    /**
5503     * A pointer to the opaque Rust object.
5504     * Nearly everywhere, inner must be non-null, however in places where
5505     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5506     */
5507    LDKnativeOpenChannel *inner;
5508    /**
5509     * Indicates that this is the only struct which contains the same pointer.
5510     * Rust functions which take ownership of an object provided via an argument require
5511     * this to be true and invalidate the object pointed to by inner.
5512     */
5513    bool is_owned;
5514 } LDKOpenChannel;
5515
5516
5517
5518 /**
5519  * An open_channel2 message to be sent by or received from the channel initiator.
5520  *
5521  * Used in V2 channel establishment
5522  *
5523  */
5524 typedef struct MUST_USE_STRUCT LDKOpenChannelV2 {
5525    /**
5526     * A pointer to the opaque Rust object.
5527     * Nearly everywhere, inner must be non-null, however in places where
5528     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5529     */
5530    LDKnativeOpenChannelV2 *inner;
5531    /**
5532     * Indicates that this is the only struct which contains the same pointer.
5533     * Rust functions which take ownership of an object provided via an argument require
5534     * this to be true and invalidate the object pointed to by inner.
5535     */
5536    bool is_owned;
5537 } LDKOpenChannelV2;
5538
5539
5540
5541 /**
5542  * A [`funding_created`] message to be sent to or received from a peer.
5543  *
5544  * Used in V1 channel establishment
5545  *
5546  * [`funding_created`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-funding_created-message
5547  */
5548 typedef struct MUST_USE_STRUCT LDKFundingCreated {
5549    /**
5550     * A pointer to the opaque Rust object.
5551     * Nearly everywhere, inner must be non-null, however in places where
5552     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5553     */
5554    LDKnativeFundingCreated *inner;
5555    /**
5556     * Indicates that this is the only struct which contains the same pointer.
5557     * Rust functions which take ownership of an object provided via an argument require
5558     * this to be true and invalidate the object pointed to by inner.
5559     */
5560    bool is_owned;
5561 } LDKFundingCreated;
5562
5563
5564
5565 /**
5566  * A [`funding_signed`] message to be sent to or received from a peer.
5567  *
5568  * Used in V1 channel establishment
5569  *
5570  * [`funding_signed`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-funding_signed-message
5571  */
5572 typedef struct MUST_USE_STRUCT LDKFundingSigned {
5573    /**
5574     * A pointer to the opaque Rust object.
5575     * Nearly everywhere, inner must be non-null, however in places where
5576     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5577     */
5578    LDKnativeFundingSigned *inner;
5579    /**
5580     * Indicates that this is the only struct which contains the same pointer.
5581     * Rust functions which take ownership of an object provided via an argument require
5582     * this to be true and invalidate the object pointed to by inner.
5583     */
5584    bool is_owned;
5585 } LDKFundingSigned;
5586
5587
5588
5589 /**
5590  * A tx_add_input message for adding an input during interactive transaction construction
5591  *
5592  */
5593 typedef struct MUST_USE_STRUCT LDKTxAddInput {
5594    /**
5595     * A pointer to the opaque Rust object.
5596     * Nearly everywhere, inner must be non-null, however in places where
5597     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5598     */
5599    LDKnativeTxAddInput *inner;
5600    /**
5601     * Indicates that this is the only struct which contains the same pointer.
5602     * Rust functions which take ownership of an object provided via an argument require
5603     * this to be true and invalidate the object pointed to by inner.
5604     */
5605    bool is_owned;
5606 } LDKTxAddInput;
5607
5608
5609
5610 /**
5611  * A tx_add_output message for adding an output during interactive transaction construction.
5612  *
5613  */
5614 typedef struct MUST_USE_STRUCT LDKTxAddOutput {
5615    /**
5616     * A pointer to the opaque Rust object.
5617     * Nearly everywhere, inner must be non-null, however in places where
5618     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5619     */
5620    LDKnativeTxAddOutput *inner;
5621    /**
5622     * Indicates that this is the only struct which contains the same pointer.
5623     * Rust functions which take ownership of an object provided via an argument require
5624     * this to be true and invalidate the object pointed to by inner.
5625     */
5626    bool is_owned;
5627 } LDKTxAddOutput;
5628
5629
5630
5631 /**
5632  * A tx_remove_input message for removing an input during interactive transaction construction.
5633  *
5634  */
5635 typedef struct MUST_USE_STRUCT LDKTxRemoveInput {
5636    /**
5637     * A pointer to the opaque Rust object.
5638     * Nearly everywhere, inner must be non-null, however in places where
5639     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5640     */
5641    LDKnativeTxRemoveInput *inner;
5642    /**
5643     * Indicates that this is the only struct which contains the same pointer.
5644     * Rust functions which take ownership of an object provided via an argument require
5645     * this to be true and invalidate the object pointed to by inner.
5646     */
5647    bool is_owned;
5648 } LDKTxRemoveInput;
5649
5650
5651
5652 /**
5653  * A tx_remove_output message for removing an output during interactive transaction construction.
5654  *
5655  */
5656 typedef struct MUST_USE_STRUCT LDKTxRemoveOutput {
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    LDKnativeTxRemoveOutput *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 } LDKTxRemoveOutput;
5670
5671
5672
5673 /**
5674  * A tx_complete message signalling the conclusion of a peer's transaction contributions during
5675  * interactive transaction construction.
5676  *
5677  */
5678 typedef struct MUST_USE_STRUCT LDKTxComplete {
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    LDKnativeTxComplete *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 } LDKTxComplete;
5692
5693
5694
5695 /**
5696  * A tx_signatures message containing the sender's signatures for a transaction constructed with
5697  * interactive transaction construction.
5698  *
5699  */
5700 typedef struct MUST_USE_STRUCT LDKTxSignatures {
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    LDKnativeTxSignatures *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 } LDKTxSignatures;
5714
5715
5716
5717 /**
5718  * A tx_init_rbf message which initiates a replacement of the transaction after it's been
5719  * completed.
5720  *
5721  */
5722 typedef struct MUST_USE_STRUCT LDKTxInitRbf {
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    LDKnativeTxInitRbf *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 } LDKTxInitRbf;
5736
5737
5738
5739 /**
5740  * A tx_ack_rbf message which acknowledges replacement of the transaction after it's been
5741  * completed.
5742  *
5743  */
5744 typedef struct MUST_USE_STRUCT LDKTxAckRbf {
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    LDKnativeTxAckRbf *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 } LDKTxAckRbf;
5758
5759
5760
5761 /**
5762  * A [`channel_ready`] message to be sent to or received from a peer.
5763  *
5764  * [`channel_ready`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-channel_ready-message
5765  */
5766 typedef struct MUST_USE_STRUCT LDKChannelReady {
5767    /**
5768     * A pointer to the opaque Rust object.
5769     * Nearly everywhere, inner must be non-null, however in places where
5770     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5771     */
5772    LDKnativeChannelReady *inner;
5773    /**
5774     * Indicates that this is the only struct which contains the same pointer.
5775     * Rust functions which take ownership of an object provided via an argument require
5776     * this to be true and invalidate the object pointed to by inner.
5777     */
5778    bool is_owned;
5779 } LDKChannelReady;
5780
5781
5782
5783 /**
5784  * An [`announcement_signatures`] message to be sent to or received from a peer.
5785  *
5786  * [`announcement_signatures`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-announcement_signatures-message
5787  */
5788 typedef struct MUST_USE_STRUCT LDKAnnouncementSignatures {
5789    /**
5790     * A pointer to the opaque Rust object.
5791     * Nearly everywhere, inner must be non-null, however in places where
5792     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5793     */
5794    LDKnativeAnnouncementSignatures *inner;
5795    /**
5796     * Indicates that this is the only struct which contains the same pointer.
5797     * Rust functions which take ownership of an object provided via an argument require
5798     * this to be true and invalidate the object pointed to by inner.
5799     */
5800    bool is_owned;
5801 } LDKAnnouncementSignatures;
5802
5803
5804
5805 /**
5806  * Struct used to return values from [`RevokeAndACK`] messages, containing a bunch of commitment
5807  * transaction updates if they were pending.
5808  */
5809 typedef struct MUST_USE_STRUCT LDKCommitmentUpdate {
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    LDKnativeCommitmentUpdate *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 } LDKCommitmentUpdate;
5823
5824
5825
5826 /**
5827  * A [`revoke_and_ack`] message to be sent to or received from a peer.
5828  *
5829  * [`revoke_and_ack`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#completing-the-transition-to-the-updated-state-revoke_and_ack
5830  */
5831 typedef struct MUST_USE_STRUCT LDKRevokeAndACK {
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    LDKnativeRevokeAndACK *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 } LDKRevokeAndACK;
5845
5846
5847
5848 /**
5849  * A [`closing_signed`] message to be sent to or received from a peer.
5850  *
5851  * [`closing_signed`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#closing-negotiation-closing_signed
5852  */
5853 typedef struct MUST_USE_STRUCT LDKClosingSigned {
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    LDKnativeClosingSigned *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 } LDKClosingSigned;
5867
5868
5869
5870 /**
5871  * A [`shutdown`] message to be sent to or received from a peer.
5872  *
5873  * [`shutdown`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#closing-initiation-shutdown
5874  */
5875 typedef struct MUST_USE_STRUCT LDKShutdown {
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    LDKnativeShutdown *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 } LDKShutdown;
5889
5890
5891
5892 /**
5893  * A [`channel_reestablish`] message to be sent to or received from a peer.
5894  *
5895  * [`channel_reestablish`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#message-retransmission
5896  */
5897 typedef struct MUST_USE_STRUCT LDKChannelReestablish {
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    LDKnativeChannelReestablish *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 } LDKChannelReestablish;
5911
5912
5913
5914 /**
5915  * A [`node_announcement`] message to be sent to or received from a peer.
5916  *
5917  * [`node_announcement`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-node_announcement-message
5918  */
5919 typedef struct MUST_USE_STRUCT LDKNodeAnnouncement {
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    LDKnativeNodeAnnouncement *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 } LDKNodeAnnouncement;
5933
5934
5935
5936 /**
5937  * An [`error`] message to be sent to or received from a peer.
5938  *
5939  * [`error`]: https://github.com/lightning/bolts/blob/master/01-messaging.md#the-error-and-warning-messages
5940  */
5941 typedef struct MUST_USE_STRUCT LDKErrorMessage {
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    LDKnativeErrorMessage *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 } LDKErrorMessage;
5955
5956
5957
5958 /**
5959  * A [`warning`] message to be sent to or received from a peer.
5960  *
5961  * [`warning`]: https://github.com/lightning/bolts/blob/master/01-messaging.md#the-error-and-warning-messages
5962  */
5963 typedef struct MUST_USE_STRUCT LDKWarningMessage {
5964    /**
5965     * A pointer to the opaque Rust object.
5966     * Nearly everywhere, inner must be non-null, however in places where
5967     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5968     */
5969    LDKnativeWarningMessage *inner;
5970    /**
5971     * Indicates that this is the only struct which contains the same pointer.
5972     * Rust functions which take ownership of an object provided via an argument require
5973     * this to be true and invalidate the object pointed to by inner.
5974     */
5975    bool is_owned;
5976 } LDKWarningMessage;
5977
5978 /**
5979  * Used to put an error message in a [`LightningError`].
5980  */
5981 typedef enum LDKErrorAction_Tag {
5982    /**
5983     * The peer took some action which made us think they were useless. Disconnect them.
5984     */
5985    LDKErrorAction_DisconnectPeer,
5986    /**
5987     * The peer did something incorrect. Tell them without closing any channels and disconnect them.
5988     */
5989    LDKErrorAction_DisconnectPeerWithWarning,
5990    /**
5991     * The peer did something harmless that we weren't able to process, just log and ignore
5992     */
5993    LDKErrorAction_IgnoreError,
5994    /**
5995     * The peer did something harmless that we weren't able to meaningfully process.
5996     * If the error is logged, log it at the given level.
5997     */
5998    LDKErrorAction_IgnoreAndLog,
5999    /**
6000     * The peer provided us with a gossip message which we'd already seen. In most cases this
6001     * should be ignored, but it may result in the message being forwarded if it is a duplicate of
6002     * our own channel announcements.
6003     */
6004    LDKErrorAction_IgnoreDuplicateGossip,
6005    /**
6006     * The peer did something incorrect. Tell them.
6007     */
6008    LDKErrorAction_SendErrorMessage,
6009    /**
6010     * The peer did something incorrect. Tell them without closing any channels.
6011     */
6012    LDKErrorAction_SendWarningMessage,
6013    /**
6014     * Must be last for serialization purposes
6015     */
6016    LDKErrorAction_Sentinel,
6017 } LDKErrorAction_Tag;
6018
6019 typedef struct LDKErrorAction_LDKDisconnectPeer_Body {
6020    /**
6021     * An error message which we should make an effort to send before we disconnect.
6022     *
6023     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
6024     */
6025    struct LDKErrorMessage msg;
6026 } LDKErrorAction_LDKDisconnectPeer_Body;
6027
6028 typedef struct LDKErrorAction_LDKDisconnectPeerWithWarning_Body {
6029    /**
6030     * A warning message which we should make an effort to send before we disconnect.
6031     */
6032    struct LDKWarningMessage msg;
6033 } LDKErrorAction_LDKDisconnectPeerWithWarning_Body;
6034
6035 typedef struct LDKErrorAction_LDKSendErrorMessage_Body {
6036    /**
6037     * The message to send.
6038     */
6039    struct LDKErrorMessage msg;
6040 } LDKErrorAction_LDKSendErrorMessage_Body;
6041
6042 typedef struct LDKErrorAction_LDKSendWarningMessage_Body {
6043    /**
6044     * The message to send.
6045     */
6046    struct LDKWarningMessage msg;
6047    /**
6048     * The peer may have done something harmless that we weren't able to meaningfully process,
6049     * though we should still tell them about it.
6050     * If this event is logged, log it at the given level.
6051     */
6052    enum LDKLevel log_level;
6053 } LDKErrorAction_LDKSendWarningMessage_Body;
6054
6055 typedef struct MUST_USE_STRUCT LDKErrorAction {
6056    LDKErrorAction_Tag tag;
6057    union {
6058       LDKErrorAction_LDKDisconnectPeer_Body disconnect_peer;
6059       LDKErrorAction_LDKDisconnectPeerWithWarning_Body disconnect_peer_with_warning;
6060       struct {
6061          enum LDKLevel ignore_and_log;
6062       };
6063       LDKErrorAction_LDKSendErrorMessage_Body send_error_message;
6064       LDKErrorAction_LDKSendWarningMessage_Body send_warning_message;
6065    };
6066 } LDKErrorAction;
6067
6068
6069
6070 /**
6071  * A [`query_channel_range`] message is used to query a peer for channel
6072  * UTXOs in a range of blocks. The recipient of a query makes a best
6073  * effort to reply to the query using one or more [`ReplyChannelRange`]
6074  * messages.
6075  *
6076  * [`query_channel_range`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-query_channel_range-and-reply_channel_range-messages
6077  */
6078 typedef struct MUST_USE_STRUCT LDKQueryChannelRange {
6079    /**
6080     * A pointer to the opaque Rust object.
6081     * Nearly everywhere, inner must be non-null, however in places where
6082     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6083     */
6084    LDKnativeQueryChannelRange *inner;
6085    /**
6086     * Indicates that this is the only struct which contains the same pointer.
6087     * Rust functions which take ownership of an object provided via an argument require
6088     * this to be true and invalidate the object pointed to by inner.
6089     */
6090    bool is_owned;
6091 } LDKQueryChannelRange;
6092
6093
6094
6095 /**
6096  * A [`query_short_channel_ids`] message is used to query a peer for
6097  * routing gossip messages related to one or more `short_channel_id`s.
6098  *
6099  * The query recipient will reply with the latest, if available,
6100  * [`ChannelAnnouncement`], [`ChannelUpdate`] and [`NodeAnnouncement`] messages
6101  * it maintains for the requested `short_channel_id`s followed by a
6102  * [`ReplyShortChannelIdsEnd`] message. The `short_channel_id`s sent in
6103  * this query are encoded. We only support `encoding_type=0` uncompressed
6104  * serialization and do not support `encoding_type=1` zlib serialization.
6105  *
6106  * [`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
6107  */
6108 typedef struct MUST_USE_STRUCT LDKQueryShortChannelIds {
6109    /**
6110     * A pointer to the opaque Rust object.
6111     * Nearly everywhere, inner must be non-null, however in places where
6112     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6113     */
6114    LDKnativeQueryShortChannelIds *inner;
6115    /**
6116     * Indicates that this is the only struct which contains the same pointer.
6117     * Rust functions which take ownership of an object provided via an argument require
6118     * this to be true and invalidate the object pointed to by inner.
6119     */
6120    bool is_owned;
6121 } LDKQueryShortChannelIds;
6122
6123
6124
6125 /**
6126  * A [`reply_channel_range`] message is a reply to a [`QueryChannelRange`]
6127  * message.
6128  *
6129  * Multiple `reply_channel_range` messages can be sent in reply
6130  * to a single [`QueryChannelRange`] message. The query recipient makes a
6131  * best effort to respond based on their local network view which may
6132  * not be a perfect view of the network. The `short_channel_id`s in the
6133  * reply are encoded. We only support `encoding_type=0` uncompressed
6134  * serialization and do not support `encoding_type=1` zlib serialization.
6135  *
6136  * [`reply_channel_range`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-query_channel_range-and-reply_channel_range-messages
6137  */
6138 typedef struct MUST_USE_STRUCT LDKReplyChannelRange {
6139    /**
6140     * A pointer to the opaque Rust object.
6141     * Nearly everywhere, inner must be non-null, however in places where
6142     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6143     */
6144    LDKnativeReplyChannelRange *inner;
6145    /**
6146     * Indicates that this is the only struct which contains the same pointer.
6147     * Rust functions which take ownership of an object provided via an argument require
6148     * this to be true and invalidate the object pointed to by inner.
6149     */
6150    bool is_owned;
6151 } LDKReplyChannelRange;
6152
6153
6154
6155 /**
6156  * A [`gossip_timestamp_filter`] message is used by a node to request
6157  * gossip relay for messages in the requested time range when the
6158  * `gossip_queries` feature has been negotiated.
6159  *
6160  * [`gossip_timestamp_filter`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-gossip_timestamp_filter-message
6161  */
6162 typedef struct MUST_USE_STRUCT LDKGossipTimestampFilter {
6163    /**
6164     * A pointer to the opaque Rust object.
6165     * Nearly everywhere, inner must be non-null, however in places where
6166     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6167     */
6168    LDKnativeGossipTimestampFilter *inner;
6169    /**
6170     * Indicates that this is the only struct which contains the same pointer.
6171     * Rust functions which take ownership of an object provided via an argument require
6172     * this to be true and invalidate the object pointed to by inner.
6173     */
6174    bool is_owned;
6175 } LDKGossipTimestampFilter;
6176
6177 /**
6178  * An event generated by ChannelManager which indicates a message should be sent to a peer (or
6179  * broadcast to most peers).
6180  * These events are handled by PeerManager::process_events if you are using a PeerManager.
6181  */
6182 typedef enum LDKMessageSendEvent_Tag {
6183    /**
6184     * Used to indicate that we've accepted a channel open and should send the accept_channel
6185     * message provided to the given peer.
6186     */
6187    LDKMessageSendEvent_SendAcceptChannel,
6188    /**
6189     * Used to indicate that we've accepted a V2 channel open and should send the accept_channel2
6190     * message provided to the given peer.
6191     */
6192    LDKMessageSendEvent_SendAcceptChannelV2,
6193    /**
6194     * Used to indicate that we've initiated a channel open and should send the open_channel
6195     * message provided to the given peer.
6196     */
6197    LDKMessageSendEvent_SendOpenChannel,
6198    /**
6199     * Used to indicate that we've initiated a V2 channel open and should send the open_channel2
6200     * message provided to the given peer.
6201     */
6202    LDKMessageSendEvent_SendOpenChannelV2,
6203    /**
6204     * Used to indicate that a funding_created message should be sent to the peer with the given node_id.
6205     */
6206    LDKMessageSendEvent_SendFundingCreated,
6207    /**
6208     * Used to indicate that a funding_signed message should be sent to the peer with the given node_id.
6209     */
6210    LDKMessageSendEvent_SendFundingSigned,
6211    /**
6212     * Used to indicate that a tx_add_input message should be sent to the peer with the given node_id.
6213     */
6214    LDKMessageSendEvent_SendTxAddInput,
6215    /**
6216     * Used to indicate that a tx_add_output message should be sent to the peer with the given node_id.
6217     */
6218    LDKMessageSendEvent_SendTxAddOutput,
6219    /**
6220     * Used to indicate that a tx_remove_input message should be sent to the peer with the given node_id.
6221     */
6222    LDKMessageSendEvent_SendTxRemoveInput,
6223    /**
6224     * Used to indicate that a tx_remove_output message should be sent to the peer with the given node_id.
6225     */
6226    LDKMessageSendEvent_SendTxRemoveOutput,
6227    /**
6228     * Used to indicate that a tx_complete message should be sent to the peer with the given node_id.
6229     */
6230    LDKMessageSendEvent_SendTxComplete,
6231    /**
6232     * Used to indicate that a tx_signatures message should be sent to the peer with the given node_id.
6233     */
6234    LDKMessageSendEvent_SendTxSignatures,
6235    /**
6236     * Used to indicate that a tx_init_rbf message should be sent to the peer with the given node_id.
6237     */
6238    LDKMessageSendEvent_SendTxInitRbf,
6239    /**
6240     * Used to indicate that a tx_ack_rbf message should be sent to the peer with the given node_id.
6241     */
6242    LDKMessageSendEvent_SendTxAckRbf,
6243    /**
6244     * Used to indicate that a tx_abort message should be sent to the peer with the given node_id.
6245     */
6246    LDKMessageSendEvent_SendTxAbort,
6247    /**
6248     * Used to indicate that a channel_ready message should be sent to the peer with the given node_id.
6249     */
6250    LDKMessageSendEvent_SendChannelReady,
6251    /**
6252     * Used to indicate that an announcement_signatures message should be sent to the peer with the given node_id.
6253     */
6254    LDKMessageSendEvent_SendAnnouncementSignatures,
6255    /**
6256     * Used to indicate that a series of HTLC update messages, as well as a commitment_signed
6257     * message should be sent to the peer with the given node_id.
6258     */
6259    LDKMessageSendEvent_UpdateHTLCs,
6260    /**
6261     * Used to indicate that a revoke_and_ack message should be sent to the peer with the given node_id.
6262     */
6263    LDKMessageSendEvent_SendRevokeAndACK,
6264    /**
6265     * Used to indicate that a closing_signed message should be sent to the peer with the given node_id.
6266     */
6267    LDKMessageSendEvent_SendClosingSigned,
6268    /**
6269     * Used to indicate that a shutdown message should be sent to the peer with the given node_id.
6270     */
6271    LDKMessageSendEvent_SendShutdown,
6272    /**
6273     * Used to indicate that a channel_reestablish message should be sent to the peer with the given node_id.
6274     */
6275    LDKMessageSendEvent_SendChannelReestablish,
6276    /**
6277     * Used to send a channel_announcement and channel_update to a specific peer, likely on
6278     * initial connection to ensure our peers know about our channels.
6279     */
6280    LDKMessageSendEvent_SendChannelAnnouncement,
6281    /**
6282     * Used to indicate that a channel_announcement and channel_update should be broadcast to all
6283     * peers (except the peer with node_id either msg.contents.node_id_1 or msg.contents.node_id_2).
6284     *
6285     * Note that after doing so, you very likely (unless you did so very recently) want to
6286     * broadcast a node_announcement (e.g. via [`PeerManager::broadcast_node_announcement`]). This
6287     * ensures that any nodes which see our channel_announcement also have a relevant
6288     * node_announcement, including relevant feature flags which may be important for routing
6289     * through or to us.
6290     *
6291     * [`PeerManager::broadcast_node_announcement`]: crate::ln::peer_handler::PeerManager::broadcast_node_announcement
6292     */
6293    LDKMessageSendEvent_BroadcastChannelAnnouncement,
6294    /**
6295     * Used to indicate that a channel_update should be broadcast to all peers.
6296     */
6297    LDKMessageSendEvent_BroadcastChannelUpdate,
6298    /**
6299     * Used to indicate that a node_announcement should be broadcast to all peers.
6300     */
6301    LDKMessageSendEvent_BroadcastNodeAnnouncement,
6302    /**
6303     * Used to indicate that a channel_update should be sent to a single peer.
6304     * In contrast to [`Self::BroadcastChannelUpdate`], this is used when the channel is a
6305     * private channel and we shouldn't be informing all of our peers of channel parameters.
6306     */
6307    LDKMessageSendEvent_SendChannelUpdate,
6308    /**
6309     * Broadcast an error downstream to be handled
6310     */
6311    LDKMessageSendEvent_HandleError,
6312    /**
6313     * Query a peer for channels with funding transaction UTXOs in a block range.
6314     */
6315    LDKMessageSendEvent_SendChannelRangeQuery,
6316    /**
6317     * Request routing gossip messages from a peer for a list of channels identified by
6318     * their short_channel_ids.
6319     */
6320    LDKMessageSendEvent_SendShortIdsQuery,
6321    /**
6322     * Sends a reply to a channel range query. This may be one of several SendReplyChannelRange events
6323     * emitted during processing of the query.
6324     */
6325    LDKMessageSendEvent_SendReplyChannelRange,
6326    /**
6327     * Sends a timestamp filter for inbound gossip. This should be sent on each new connection to
6328     * enable receiving gossip messages from the peer.
6329     */
6330    LDKMessageSendEvent_SendGossipTimestampFilter,
6331    /**
6332     * Must be last for serialization purposes
6333     */
6334    LDKMessageSendEvent_Sentinel,
6335 } LDKMessageSendEvent_Tag;
6336
6337 typedef struct LDKMessageSendEvent_LDKSendAcceptChannel_Body {
6338    /**
6339     * The node_id of the node which should receive this message
6340     */
6341    struct LDKPublicKey node_id;
6342    /**
6343     * The message which should be sent.
6344     */
6345    struct LDKAcceptChannel msg;
6346 } LDKMessageSendEvent_LDKSendAcceptChannel_Body;
6347
6348 typedef struct LDKMessageSendEvent_LDKSendAcceptChannelV2_Body {
6349    /**
6350     * The node_id of the node which should receive this message
6351     */
6352    struct LDKPublicKey node_id;
6353    /**
6354     * The message which should be sent.
6355     */
6356    struct LDKAcceptChannelV2 msg;
6357 } LDKMessageSendEvent_LDKSendAcceptChannelV2_Body;
6358
6359 typedef struct LDKMessageSendEvent_LDKSendOpenChannel_Body {
6360    /**
6361     * The node_id of the node which should receive this message
6362     */
6363    struct LDKPublicKey node_id;
6364    /**
6365     * The message which should be sent.
6366     */
6367    struct LDKOpenChannel msg;
6368 } LDKMessageSendEvent_LDKSendOpenChannel_Body;
6369
6370 typedef struct LDKMessageSendEvent_LDKSendOpenChannelV2_Body {
6371    /**
6372     * The node_id of the node which should receive this message
6373     */
6374    struct LDKPublicKey node_id;
6375    /**
6376     * The message which should be sent.
6377     */
6378    struct LDKOpenChannelV2 msg;
6379 } LDKMessageSendEvent_LDKSendOpenChannelV2_Body;
6380
6381 typedef struct LDKMessageSendEvent_LDKSendFundingCreated_Body {
6382    /**
6383     * The node_id of the node which should receive this message
6384     */
6385    struct LDKPublicKey node_id;
6386    /**
6387     * The message which should be sent.
6388     */
6389    struct LDKFundingCreated msg;
6390 } LDKMessageSendEvent_LDKSendFundingCreated_Body;
6391
6392 typedef struct LDKMessageSendEvent_LDKSendFundingSigned_Body {
6393    /**
6394     * The node_id of the node which should receive this message
6395     */
6396    struct LDKPublicKey node_id;
6397    /**
6398     * The message which should be sent.
6399     */
6400    struct LDKFundingSigned msg;
6401 } LDKMessageSendEvent_LDKSendFundingSigned_Body;
6402
6403 typedef struct LDKMessageSendEvent_LDKSendTxAddInput_Body {
6404    /**
6405     * The node_id of the node which should receive this message
6406     */
6407    struct LDKPublicKey node_id;
6408    /**
6409     * The message which should be sent.
6410     */
6411    struct LDKTxAddInput msg;
6412 } LDKMessageSendEvent_LDKSendTxAddInput_Body;
6413
6414 typedef struct LDKMessageSendEvent_LDKSendTxAddOutput_Body {
6415    /**
6416     * The node_id of the node which should receive this message
6417     */
6418    struct LDKPublicKey node_id;
6419    /**
6420     * The message which should be sent.
6421     */
6422    struct LDKTxAddOutput msg;
6423 } LDKMessageSendEvent_LDKSendTxAddOutput_Body;
6424
6425 typedef struct LDKMessageSendEvent_LDKSendTxRemoveInput_Body {
6426    /**
6427     * The node_id of the node which should receive this message
6428     */
6429    struct LDKPublicKey node_id;
6430    /**
6431     * The message which should be sent.
6432     */
6433    struct LDKTxRemoveInput msg;
6434 } LDKMessageSendEvent_LDKSendTxRemoveInput_Body;
6435
6436 typedef struct LDKMessageSendEvent_LDKSendTxRemoveOutput_Body {
6437    /**
6438     * The node_id of the node which should receive this message
6439     */
6440    struct LDKPublicKey node_id;
6441    /**
6442     * The message which should be sent.
6443     */
6444    struct LDKTxRemoveOutput msg;
6445 } LDKMessageSendEvent_LDKSendTxRemoveOutput_Body;
6446
6447 typedef struct LDKMessageSendEvent_LDKSendTxComplete_Body {
6448    /**
6449     * The node_id of the node which should receive this message
6450     */
6451    struct LDKPublicKey node_id;
6452    /**
6453     * The message which should be sent.
6454     */
6455    struct LDKTxComplete msg;
6456 } LDKMessageSendEvent_LDKSendTxComplete_Body;
6457
6458 typedef struct LDKMessageSendEvent_LDKSendTxSignatures_Body {
6459    /**
6460     * The node_id of the node which should receive this message
6461     */
6462    struct LDKPublicKey node_id;
6463    /**
6464     * The message which should be sent.
6465     */
6466    struct LDKTxSignatures msg;
6467 } LDKMessageSendEvent_LDKSendTxSignatures_Body;
6468
6469 typedef struct LDKMessageSendEvent_LDKSendTxInitRbf_Body {
6470    /**
6471     * The node_id of the node which should receive this message
6472     */
6473    struct LDKPublicKey node_id;
6474    /**
6475     * The message which should be sent.
6476     */
6477    struct LDKTxInitRbf msg;
6478 } LDKMessageSendEvent_LDKSendTxInitRbf_Body;
6479
6480 typedef struct LDKMessageSendEvent_LDKSendTxAckRbf_Body {
6481    /**
6482     * The node_id of the node which should receive this message
6483     */
6484    struct LDKPublicKey node_id;
6485    /**
6486     * The message which should be sent.
6487     */
6488    struct LDKTxAckRbf msg;
6489 } LDKMessageSendEvent_LDKSendTxAckRbf_Body;
6490
6491 typedef struct LDKMessageSendEvent_LDKSendTxAbort_Body {
6492    /**
6493     * The node_id of the node which should receive this message
6494     */
6495    struct LDKPublicKey node_id;
6496    /**
6497     * The message which should be sent.
6498     */
6499    struct LDKTxAddInput msg;
6500 } LDKMessageSendEvent_LDKSendTxAbort_Body;
6501
6502 typedef struct LDKMessageSendEvent_LDKSendChannelReady_Body {
6503    /**
6504     * The node_id of the node which should receive these message(s)
6505     */
6506    struct LDKPublicKey node_id;
6507    /**
6508     * The channel_ready message which should be sent.
6509     */
6510    struct LDKChannelReady msg;
6511 } LDKMessageSendEvent_LDKSendChannelReady_Body;
6512
6513 typedef struct LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body {
6514    /**
6515     * The node_id of the node which should receive these message(s)
6516     */
6517    struct LDKPublicKey node_id;
6518    /**
6519     * The announcement_signatures message which should be sent.
6520     */
6521    struct LDKAnnouncementSignatures msg;
6522 } LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body;
6523
6524 typedef struct LDKMessageSendEvent_LDKUpdateHTLCs_Body {
6525    /**
6526     * The node_id of the node which should receive these message(s)
6527     */
6528    struct LDKPublicKey node_id;
6529    /**
6530     * The update messages which should be sent. ALL messages in the struct should be sent!
6531     */
6532    struct LDKCommitmentUpdate updates;
6533 } LDKMessageSendEvent_LDKUpdateHTLCs_Body;
6534
6535 typedef struct LDKMessageSendEvent_LDKSendRevokeAndACK_Body {
6536    /**
6537     * The node_id of the node which should receive this message
6538     */
6539    struct LDKPublicKey node_id;
6540    /**
6541     * The message which should be sent.
6542     */
6543    struct LDKRevokeAndACK msg;
6544 } LDKMessageSendEvent_LDKSendRevokeAndACK_Body;
6545
6546 typedef struct LDKMessageSendEvent_LDKSendClosingSigned_Body {
6547    /**
6548     * The node_id of the node which should receive this message
6549     */
6550    struct LDKPublicKey node_id;
6551    /**
6552     * The message which should be sent.
6553     */
6554    struct LDKClosingSigned msg;
6555 } LDKMessageSendEvent_LDKSendClosingSigned_Body;
6556
6557 typedef struct LDKMessageSendEvent_LDKSendShutdown_Body {
6558    /**
6559     * The node_id of the node which should receive this message
6560     */
6561    struct LDKPublicKey node_id;
6562    /**
6563     * The message which should be sent.
6564     */
6565    struct LDKShutdown msg;
6566 } LDKMessageSendEvent_LDKSendShutdown_Body;
6567
6568 typedef struct LDKMessageSendEvent_LDKSendChannelReestablish_Body {
6569    /**
6570     * The node_id of the node which should receive this message
6571     */
6572    struct LDKPublicKey node_id;
6573    /**
6574     * The message which should be sent.
6575     */
6576    struct LDKChannelReestablish msg;
6577 } LDKMessageSendEvent_LDKSendChannelReestablish_Body;
6578
6579 typedef struct LDKMessageSendEvent_LDKSendChannelAnnouncement_Body {
6580    /**
6581     * The node_id of the node which should receive this message
6582     */
6583    struct LDKPublicKey node_id;
6584    /**
6585     * The channel_announcement which should be sent.
6586     */
6587    struct LDKChannelAnnouncement msg;
6588    /**
6589     * The followup channel_update which should be sent.
6590     */
6591    struct LDKChannelUpdate update_msg;
6592 } LDKMessageSendEvent_LDKSendChannelAnnouncement_Body;
6593
6594 typedef struct LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body {
6595    /**
6596     * The channel_announcement which should be sent.
6597     */
6598    struct LDKChannelAnnouncement msg;
6599    /**
6600     * The followup channel_update which should be sent.
6601     *
6602     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
6603     */
6604    struct LDKChannelUpdate update_msg;
6605 } LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body;
6606
6607 typedef struct LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body {
6608    /**
6609     * The channel_update which should be sent.
6610     */
6611    struct LDKChannelUpdate msg;
6612 } LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body;
6613
6614 typedef struct LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body {
6615    /**
6616     * The node_announcement which should be sent.
6617     */
6618    struct LDKNodeAnnouncement msg;
6619 } LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body;
6620
6621 typedef struct LDKMessageSendEvent_LDKSendChannelUpdate_Body {
6622    /**
6623     * The node_id of the node which should receive this message
6624     */
6625    struct LDKPublicKey node_id;
6626    /**
6627     * The channel_update which should be sent.
6628     */
6629    struct LDKChannelUpdate msg;
6630 } LDKMessageSendEvent_LDKSendChannelUpdate_Body;
6631
6632 typedef struct LDKMessageSendEvent_LDKHandleError_Body {
6633    /**
6634     * The node_id of the node which should receive this message
6635     */
6636    struct LDKPublicKey node_id;
6637    /**
6638     * The action which should be taken.
6639     */
6640    struct LDKErrorAction action;
6641 } LDKMessageSendEvent_LDKHandleError_Body;
6642
6643 typedef struct LDKMessageSendEvent_LDKSendChannelRangeQuery_Body {
6644    /**
6645     * The node_id of this message recipient
6646     */
6647    struct LDKPublicKey node_id;
6648    /**
6649     * The query_channel_range which should be sent.
6650     */
6651    struct LDKQueryChannelRange msg;
6652 } LDKMessageSendEvent_LDKSendChannelRangeQuery_Body;
6653
6654 typedef struct LDKMessageSendEvent_LDKSendShortIdsQuery_Body {
6655    /**
6656     * The node_id of this message recipient
6657     */
6658    struct LDKPublicKey node_id;
6659    /**
6660     * The query_short_channel_ids which should be sent.
6661     */
6662    struct LDKQueryShortChannelIds msg;
6663 } LDKMessageSendEvent_LDKSendShortIdsQuery_Body;
6664
6665 typedef struct LDKMessageSendEvent_LDKSendReplyChannelRange_Body {
6666    /**
6667     * The node_id of this message recipient
6668     */
6669    struct LDKPublicKey node_id;
6670    /**
6671     * The reply_channel_range which should be sent.
6672     */
6673    struct LDKReplyChannelRange msg;
6674 } LDKMessageSendEvent_LDKSendReplyChannelRange_Body;
6675
6676 typedef struct LDKMessageSendEvent_LDKSendGossipTimestampFilter_Body {
6677    /**
6678     * The node_id of this message recipient
6679     */
6680    struct LDKPublicKey node_id;
6681    /**
6682     * The gossip_timestamp_filter which should be sent.
6683     */
6684    struct LDKGossipTimestampFilter msg;
6685 } LDKMessageSendEvent_LDKSendGossipTimestampFilter_Body;
6686
6687 typedef struct MUST_USE_STRUCT LDKMessageSendEvent {
6688    LDKMessageSendEvent_Tag tag;
6689    union {
6690       LDKMessageSendEvent_LDKSendAcceptChannel_Body send_accept_channel;
6691       LDKMessageSendEvent_LDKSendAcceptChannelV2_Body send_accept_channel_v2;
6692       LDKMessageSendEvent_LDKSendOpenChannel_Body send_open_channel;
6693       LDKMessageSendEvent_LDKSendOpenChannelV2_Body send_open_channel_v2;
6694       LDKMessageSendEvent_LDKSendFundingCreated_Body send_funding_created;
6695       LDKMessageSendEvent_LDKSendFundingSigned_Body send_funding_signed;
6696       LDKMessageSendEvent_LDKSendTxAddInput_Body send_tx_add_input;
6697       LDKMessageSendEvent_LDKSendTxAddOutput_Body send_tx_add_output;
6698       LDKMessageSendEvent_LDKSendTxRemoveInput_Body send_tx_remove_input;
6699       LDKMessageSendEvent_LDKSendTxRemoveOutput_Body send_tx_remove_output;
6700       LDKMessageSendEvent_LDKSendTxComplete_Body send_tx_complete;
6701       LDKMessageSendEvent_LDKSendTxSignatures_Body send_tx_signatures;
6702       LDKMessageSendEvent_LDKSendTxInitRbf_Body send_tx_init_rbf;
6703       LDKMessageSendEvent_LDKSendTxAckRbf_Body send_tx_ack_rbf;
6704       LDKMessageSendEvent_LDKSendTxAbort_Body send_tx_abort;
6705       LDKMessageSendEvent_LDKSendChannelReady_Body send_channel_ready;
6706       LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body send_announcement_signatures;
6707       LDKMessageSendEvent_LDKUpdateHTLCs_Body update_htl_cs;
6708       LDKMessageSendEvent_LDKSendRevokeAndACK_Body send_revoke_and_ack;
6709       LDKMessageSendEvent_LDKSendClosingSigned_Body send_closing_signed;
6710       LDKMessageSendEvent_LDKSendShutdown_Body send_shutdown;
6711       LDKMessageSendEvent_LDKSendChannelReestablish_Body send_channel_reestablish;
6712       LDKMessageSendEvent_LDKSendChannelAnnouncement_Body send_channel_announcement;
6713       LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body broadcast_channel_announcement;
6714       LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body broadcast_channel_update;
6715       LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body broadcast_node_announcement;
6716       LDKMessageSendEvent_LDKSendChannelUpdate_Body send_channel_update;
6717       LDKMessageSendEvent_LDKHandleError_Body handle_error;
6718       LDKMessageSendEvent_LDKSendChannelRangeQuery_Body send_channel_range_query;
6719       LDKMessageSendEvent_LDKSendShortIdsQuery_Body send_short_ids_query;
6720       LDKMessageSendEvent_LDKSendReplyChannelRange_Body send_reply_channel_range;
6721       LDKMessageSendEvent_LDKSendGossipTimestampFilter_Body send_gossip_timestamp_filter;
6722    };
6723 } LDKMessageSendEvent;
6724
6725 /**
6726  * A dynamically-allocated array of crate::lightning::events::MessageSendEvents of arbitrary size.
6727  * This corresponds to std::vector in C++
6728  */
6729 typedef struct LDKCVec_MessageSendEventZ {
6730    /**
6731     * The elements in the array.
6732     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6733     */
6734    struct LDKMessageSendEvent *data;
6735    /**
6736     * The number of elements pointed to by `data`.
6737     */
6738    uintptr_t datalen;
6739 } LDKCVec_MessageSendEventZ;
6740
6741
6742
6743 /**
6744  * Details about one direction of a channel as received within a [`ChannelUpdate`].
6745  */
6746 typedef struct MUST_USE_STRUCT LDKChannelUpdateInfo {
6747    /**
6748     * A pointer to the opaque Rust object.
6749     * Nearly everywhere, inner must be non-null, however in places where
6750     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6751     */
6752    LDKnativeChannelUpdateInfo *inner;
6753    /**
6754     * Indicates that this is the only struct which contains the same pointer.
6755     * Rust functions which take ownership of an object provided via an argument require
6756     * this to be true and invalidate the object pointed to by inner.
6757     */
6758    bool is_owned;
6759 } LDKChannelUpdateInfo;
6760
6761 /**
6762  * The contents of CResult_ChannelUpdateInfoDecodeErrorZ
6763  */
6764 typedef union LDKCResult_ChannelUpdateInfoDecodeErrorZPtr {
6765    /**
6766     * A pointer to the contents in the success state.
6767     * Reading from this pointer when `result_ok` is not set is undefined.
6768     */
6769    struct LDKChannelUpdateInfo *result;
6770    /**
6771     * A pointer to the contents in the error state.
6772     * Reading from this pointer when `result_ok` is set is undefined.
6773     */
6774    struct LDKDecodeError *err;
6775 } LDKCResult_ChannelUpdateInfoDecodeErrorZPtr;
6776
6777 /**
6778  * A CResult_ChannelUpdateInfoDecodeErrorZ represents the result of a fallible operation,
6779  * containing a crate::lightning::routing::gossip::ChannelUpdateInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
6780  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6781  */
6782 typedef struct LDKCResult_ChannelUpdateInfoDecodeErrorZ {
6783    /**
6784     * The contents of this CResult_ChannelUpdateInfoDecodeErrorZ, accessible via either
6785     * `err` or `result` depending on the state of `result_ok`.
6786     */
6787    union LDKCResult_ChannelUpdateInfoDecodeErrorZPtr contents;
6788    /**
6789     * Whether this CResult_ChannelUpdateInfoDecodeErrorZ represents a success state.
6790     */
6791    bool result_ok;
6792 } LDKCResult_ChannelUpdateInfoDecodeErrorZ;
6793
6794
6795
6796 /**
6797  * Details about a channel (both directions).
6798  * Received within a channel announcement.
6799  */
6800 typedef struct MUST_USE_STRUCT LDKChannelInfo {
6801    /**
6802     * A pointer to the opaque Rust object.
6803     * Nearly everywhere, inner must be non-null, however in places where
6804     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6805     */
6806    LDKnativeChannelInfo *inner;
6807    /**
6808     * Indicates that this is the only struct which contains the same pointer.
6809     * Rust functions which take ownership of an object provided via an argument require
6810     * this to be true and invalidate the object pointed to by inner.
6811     */
6812    bool is_owned;
6813 } LDKChannelInfo;
6814
6815 /**
6816  * The contents of CResult_ChannelInfoDecodeErrorZ
6817  */
6818 typedef union LDKCResult_ChannelInfoDecodeErrorZPtr {
6819    /**
6820     * A pointer to the contents in the success state.
6821     * Reading from this pointer when `result_ok` is not set is undefined.
6822     */
6823    struct LDKChannelInfo *result;
6824    /**
6825     * A pointer to the contents in the error state.
6826     * Reading from this pointer when `result_ok` is set is undefined.
6827     */
6828    struct LDKDecodeError *err;
6829 } LDKCResult_ChannelInfoDecodeErrorZPtr;
6830
6831 /**
6832  * A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
6833  * containing a crate::lightning::routing::gossip::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
6834  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6835  */
6836 typedef struct LDKCResult_ChannelInfoDecodeErrorZ {
6837    /**
6838     * The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
6839     * `err` or `result` depending on the state of `result_ok`.
6840     */
6841    union LDKCResult_ChannelInfoDecodeErrorZPtr contents;
6842    /**
6843     * Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
6844     */
6845    bool result_ok;
6846 } LDKCResult_ChannelInfoDecodeErrorZ;
6847
6848
6849
6850 /**
6851  * Fees for routing via a given channel or a node
6852  */
6853 typedef struct MUST_USE_STRUCT LDKRoutingFees {
6854    /**
6855     * A pointer to the opaque Rust object.
6856     * Nearly everywhere, inner must be non-null, however in places where
6857     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6858     */
6859    LDKnativeRoutingFees *inner;
6860    /**
6861     * Indicates that this is the only struct which contains the same pointer.
6862     * Rust functions which take ownership of an object provided via an argument require
6863     * this to be true and invalidate the object pointed to by inner.
6864     */
6865    bool is_owned;
6866 } LDKRoutingFees;
6867
6868 /**
6869  * The contents of CResult_RoutingFeesDecodeErrorZ
6870  */
6871 typedef union LDKCResult_RoutingFeesDecodeErrorZPtr {
6872    /**
6873     * A pointer to the contents in the success state.
6874     * Reading from this pointer when `result_ok` is not set is undefined.
6875     */
6876    struct LDKRoutingFees *result;
6877    /**
6878     * A pointer to the contents in the error state.
6879     * Reading from this pointer when `result_ok` is set is undefined.
6880     */
6881    struct LDKDecodeError *err;
6882 } LDKCResult_RoutingFeesDecodeErrorZPtr;
6883
6884 /**
6885  * A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
6886  * containing a crate::lightning::routing::gossip::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
6887  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6888  */
6889 typedef struct LDKCResult_RoutingFeesDecodeErrorZ {
6890    /**
6891     * The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
6892     * `err` or `result` depending on the state of `result_ok`.
6893     */
6894    union LDKCResult_RoutingFeesDecodeErrorZPtr contents;
6895    /**
6896     * Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
6897     */
6898    bool result_ok;
6899 } LDKCResult_RoutingFeesDecodeErrorZ;
6900
6901 /**
6902  * A 4-byte byte array.
6903  */
6904 typedef struct LDKFourBytes {
6905    /**
6906     * The four bytes
6907     */
6908    uint8_t data[4];
6909 } LDKFourBytes;
6910
6911 /**
6912  * A 12-byte byte array.
6913  */
6914 typedef struct LDKTwelveBytes {
6915    /**
6916     * The twelve bytes
6917     */
6918    uint8_t data[12];
6919 } LDKTwelveBytes;
6920
6921
6922
6923 /**
6924  * Represents a hostname for serialization purposes.
6925  * Only the character set and length will be validated.
6926  * The character set consists of ASCII alphanumeric characters, hyphens, and periods.
6927  * Its length is guaranteed to be representable by a single byte.
6928  * This serialization is used by [`BOLT 7`] hostnames.
6929  *
6930  * [`BOLT 7`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md
6931  */
6932 typedef struct MUST_USE_STRUCT LDKHostname {
6933    /**
6934     * A pointer to the opaque Rust object.
6935     * Nearly everywhere, inner must be non-null, however in places where
6936     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6937     */
6938    LDKnativeHostname *inner;
6939    /**
6940     * Indicates that this is the only struct which contains the same pointer.
6941     * Rust functions which take ownership of an object provided via an argument require
6942     * this to be true and invalidate the object pointed to by inner.
6943     */
6944    bool is_owned;
6945 } LDKHostname;
6946
6947 /**
6948  * An address which can be used to connect to a remote peer.
6949  */
6950 typedef enum LDKNetAddress_Tag {
6951    /**
6952     * An IPv4 address/port on which the peer is listening.
6953     */
6954    LDKNetAddress_IPv4,
6955    /**
6956     * An IPv6 address/port on which the peer is listening.
6957     */
6958    LDKNetAddress_IPv6,
6959    /**
6960     * An old-style Tor onion address/port on which the peer is listening.
6961     *
6962     * This field is deprecated and the Tor network generally no longer supports V2 Onion
6963     * addresses. Thus, the details are not parsed here.
6964     */
6965    LDKNetAddress_OnionV2,
6966    /**
6967     * A new-style Tor onion address/port on which the peer is listening.
6968     *
6969     * To create the human-readable \"hostname\", concatenate the ED25519 pubkey, checksum, and version,
6970     * wrap as base32 and append \".onion\".
6971     */
6972    LDKNetAddress_OnionV3,
6973    /**
6974     * A hostname/port on which the peer is listening.
6975     */
6976    LDKNetAddress_Hostname,
6977    /**
6978     * Must be last for serialization purposes
6979     */
6980    LDKNetAddress_Sentinel,
6981 } LDKNetAddress_Tag;
6982
6983 typedef struct LDKNetAddress_LDKIPv4_Body {
6984    /**
6985     * The 4-byte IPv4 address
6986     */
6987    struct LDKFourBytes addr;
6988    /**
6989     * The port on which the node is listening
6990     */
6991    uint16_t port;
6992 } LDKNetAddress_LDKIPv4_Body;
6993
6994 typedef struct LDKNetAddress_LDKIPv6_Body {
6995    /**
6996     * The 16-byte IPv6 address
6997     */
6998    struct LDKSixteenBytes addr;
6999    /**
7000     * The port on which the node is listening
7001     */
7002    uint16_t port;
7003 } LDKNetAddress_LDKIPv6_Body;
7004
7005 typedef struct LDKNetAddress_LDKOnionV3_Body {
7006    /**
7007     * The ed25519 long-term public key of the peer
7008     */
7009    struct LDKThirtyTwoBytes ed25519_pubkey;
7010    /**
7011     * The checksum of the pubkey and version, as included in the onion address
7012     */
7013    uint16_t checksum;
7014    /**
7015     * The version byte, as defined by the Tor Onion v3 spec.
7016     */
7017    uint8_t version;
7018    /**
7019     * The port on which the node is listening
7020     */
7021    uint16_t port;
7022 } LDKNetAddress_LDKOnionV3_Body;
7023
7024 typedef struct LDKNetAddress_LDKHostname_Body {
7025    /**
7026     * The hostname on which the node is listening.
7027     */
7028    struct LDKHostname hostname;
7029    /**
7030     * The port on which the node is listening.
7031     */
7032    uint16_t port;
7033 } LDKNetAddress_LDKHostname_Body;
7034
7035 typedef struct MUST_USE_STRUCT LDKNetAddress {
7036    LDKNetAddress_Tag tag;
7037    union {
7038       LDKNetAddress_LDKIPv4_Body i_pv4;
7039       LDKNetAddress_LDKIPv6_Body i_pv6;
7040       struct {
7041          struct LDKTwelveBytes onion_v2;
7042       };
7043       LDKNetAddress_LDKOnionV3_Body onion_v3;
7044       LDKNetAddress_LDKHostname_Body hostname;
7045    };
7046 } LDKNetAddress;
7047
7048 /**
7049  * A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
7050  * This corresponds to std::vector in C++
7051  */
7052 typedef struct LDKCVec_NetAddressZ {
7053    /**
7054     * The elements in the array.
7055     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7056     */
7057    struct LDKNetAddress *data;
7058    /**
7059     * The number of elements pointed to by `data`.
7060     */
7061    uintptr_t datalen;
7062 } LDKCVec_NetAddressZ;
7063
7064
7065
7066 /**
7067  * Information received in the latest node_announcement from this node.
7068  */
7069 typedef struct MUST_USE_STRUCT LDKNodeAnnouncementInfo {
7070    /**
7071     * A pointer to the opaque Rust object.
7072     * Nearly everywhere, inner must be non-null, however in places where
7073     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7074     */
7075    LDKnativeNodeAnnouncementInfo *inner;
7076    /**
7077     * Indicates that this is the only struct which contains the same pointer.
7078     * Rust functions which take ownership of an object provided via an argument require
7079     * this to be true and invalidate the object pointed to by inner.
7080     */
7081    bool is_owned;
7082 } LDKNodeAnnouncementInfo;
7083
7084 /**
7085  * The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
7086  */
7087 typedef union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr {
7088    /**
7089     * A pointer to the contents in the success state.
7090     * Reading from this pointer when `result_ok` is not set is undefined.
7091     */
7092    struct LDKNodeAnnouncementInfo *result;
7093    /**
7094     * A pointer to the contents in the error state.
7095     * Reading from this pointer when `result_ok` is set is undefined.
7096     */
7097    struct LDKDecodeError *err;
7098 } LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr;
7099
7100 /**
7101  * A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
7102  * containing a crate::lightning::routing::gossip::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
7103  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7104  */
7105 typedef struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ {
7106    /**
7107     * The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
7108     * `err` or `result` depending on the state of `result_ok`.
7109     */
7110    union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr contents;
7111    /**
7112     * Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
7113     */
7114    bool result_ok;
7115 } LDKCResult_NodeAnnouncementInfoDecodeErrorZ;
7116
7117
7118
7119 /**
7120  * A user-defined name for a node, which may be used when displaying the node in a graph.
7121  *
7122  * Since node aliases are provided by third parties, they are a potential avenue for injection
7123  * attacks. Care must be taken when processing.
7124  */
7125 typedef struct MUST_USE_STRUCT LDKNodeAlias {
7126    /**
7127     * A pointer to the opaque Rust object.
7128     * Nearly everywhere, inner must be non-null, however in places where
7129     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7130     */
7131    LDKnativeNodeAlias *inner;
7132    /**
7133     * Indicates that this is the only struct which contains the same pointer.
7134     * Rust functions which take ownership of an object provided via an argument require
7135     * this to be true and invalidate the object pointed to by inner.
7136     */
7137    bool is_owned;
7138 } LDKNodeAlias;
7139
7140 /**
7141  * The contents of CResult_NodeAliasDecodeErrorZ
7142  */
7143 typedef union LDKCResult_NodeAliasDecodeErrorZPtr {
7144    /**
7145     * A pointer to the contents in the success state.
7146     * Reading from this pointer when `result_ok` is not set is undefined.
7147     */
7148    struct LDKNodeAlias *result;
7149    /**
7150     * A pointer to the contents in the error state.
7151     * Reading from this pointer when `result_ok` is set is undefined.
7152     */
7153    struct LDKDecodeError *err;
7154 } LDKCResult_NodeAliasDecodeErrorZPtr;
7155
7156 /**
7157  * A CResult_NodeAliasDecodeErrorZ represents the result of a fallible operation,
7158  * containing a crate::lightning::routing::gossip::NodeAlias on success and a crate::lightning::ln::msgs::DecodeError on failure.
7159  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7160  */
7161 typedef struct LDKCResult_NodeAliasDecodeErrorZ {
7162    /**
7163     * The contents of this CResult_NodeAliasDecodeErrorZ, accessible via either
7164     * `err` or `result` depending on the state of `result_ok`.
7165     */
7166    union LDKCResult_NodeAliasDecodeErrorZPtr contents;
7167    /**
7168     * Whether this CResult_NodeAliasDecodeErrorZ represents a success state.
7169     */
7170    bool result_ok;
7171 } LDKCResult_NodeAliasDecodeErrorZ;
7172
7173
7174
7175 /**
7176  * Details about a node in the network, known from the network announcement.
7177  */
7178 typedef struct MUST_USE_STRUCT LDKNodeInfo {
7179    /**
7180     * A pointer to the opaque Rust object.
7181     * Nearly everywhere, inner must be non-null, however in places where
7182     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7183     */
7184    LDKnativeNodeInfo *inner;
7185    /**
7186     * Indicates that this is the only struct which contains the same pointer.
7187     * Rust functions which take ownership of an object provided via an argument require
7188     * this to be true and invalidate the object pointed to by inner.
7189     */
7190    bool is_owned;
7191 } LDKNodeInfo;
7192
7193 /**
7194  * The contents of CResult_NodeInfoDecodeErrorZ
7195  */
7196 typedef union LDKCResult_NodeInfoDecodeErrorZPtr {
7197    /**
7198     * A pointer to the contents in the success state.
7199     * Reading from this pointer when `result_ok` is not set is undefined.
7200     */
7201    struct LDKNodeInfo *result;
7202    /**
7203     * A pointer to the contents in the error state.
7204     * Reading from this pointer when `result_ok` is set is undefined.
7205     */
7206    struct LDKDecodeError *err;
7207 } LDKCResult_NodeInfoDecodeErrorZPtr;
7208
7209 /**
7210  * A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
7211  * containing a crate::lightning::routing::gossip::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
7212  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7213  */
7214 typedef struct LDKCResult_NodeInfoDecodeErrorZ {
7215    /**
7216     * The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
7217     * `err` or `result` depending on the state of `result_ok`.
7218     */
7219    union LDKCResult_NodeInfoDecodeErrorZPtr contents;
7220    /**
7221     * Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
7222     */
7223    bool result_ok;
7224 } LDKCResult_NodeInfoDecodeErrorZ;
7225
7226 /**
7227  * The contents of CResult_NetworkGraphDecodeErrorZ
7228  */
7229 typedef union LDKCResult_NetworkGraphDecodeErrorZPtr {
7230    /**
7231     * A pointer to the contents in the success state.
7232     * Reading from this pointer when `result_ok` is not set is undefined.
7233     */
7234    struct LDKNetworkGraph *result;
7235    /**
7236     * A pointer to the contents in the error state.
7237     * Reading from this pointer when `result_ok` is set is undefined.
7238     */
7239    struct LDKDecodeError *err;
7240 } LDKCResult_NetworkGraphDecodeErrorZPtr;
7241
7242 /**
7243  * A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
7244  * containing a crate::lightning::routing::gossip::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
7245  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7246  */
7247 typedef struct LDKCResult_NetworkGraphDecodeErrorZ {
7248    /**
7249     * The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
7250     * `err` or `result` depending on the state of `result_ok`.
7251     */
7252    union LDKCResult_NetworkGraphDecodeErrorZPtr contents;
7253    /**
7254     * Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
7255     */
7256    bool result_ok;
7257 } LDKCResult_NetworkGraphDecodeErrorZ;
7258
7259 /**
7260  * An enum which can either contain a crate::c_types::derived::CVec_NetAddressZ or not
7261  */
7262 typedef enum LDKCOption_CVec_NetAddressZZ_Tag {
7263    /**
7264     * When we're in this state, this COption_CVec_NetAddressZZ contains a crate::c_types::derived::CVec_NetAddressZ
7265     */
7266    LDKCOption_CVec_NetAddressZZ_Some,
7267    /**
7268     * When we're in this state, this COption_CVec_NetAddressZZ contains nothing
7269     */
7270    LDKCOption_CVec_NetAddressZZ_None,
7271    /**
7272     * Must be last for serialization purposes
7273     */
7274    LDKCOption_CVec_NetAddressZZ_Sentinel,
7275 } LDKCOption_CVec_NetAddressZZ_Tag;
7276
7277 typedef struct LDKCOption_CVec_NetAddressZZ {
7278    LDKCOption_CVec_NetAddressZZ_Tag tag;
7279    union {
7280       struct {
7281          struct LDKCVec_NetAddressZ some;
7282       };
7283    };
7284 } LDKCOption_CVec_NetAddressZZ;
7285
7286 /**
7287  * An enum which can either contain a crate::c_types::ThirtyTwoBytes or not
7288  */
7289 typedef enum LDKCOption_PaymentPreimageZ_Tag {
7290    /**
7291     * When we're in this state, this COption_PaymentPreimageZ contains a crate::c_types::ThirtyTwoBytes
7292     */
7293    LDKCOption_PaymentPreimageZ_Some,
7294    /**
7295     * When we're in this state, this COption_PaymentPreimageZ contains nothing
7296     */
7297    LDKCOption_PaymentPreimageZ_None,
7298    /**
7299     * Must be last for serialization purposes
7300     */
7301    LDKCOption_PaymentPreimageZ_Sentinel,
7302 } LDKCOption_PaymentPreimageZ_Tag;
7303
7304 typedef struct LDKCOption_PaymentPreimageZ {
7305    LDKCOption_PaymentPreimageZ_Tag tag;
7306    union {
7307       struct {
7308          struct LDKThirtyTwoBytes some;
7309       };
7310    };
7311 } LDKCOption_PaymentPreimageZ;
7312
7313 /**
7314  * A dynamically-allocated array of crate::lightning::ln::chan_utils::HTLCOutputInCommitments of arbitrary size.
7315  * This corresponds to std::vector in C++
7316  */
7317 typedef struct LDKCVec_HTLCOutputInCommitmentZ {
7318    /**
7319     * The elements in the array.
7320     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7321     */
7322    struct LDKHTLCOutputInCommitment *data;
7323    /**
7324     * The number of elements pointed to by `data`.
7325     */
7326    uintptr_t datalen;
7327 } LDKCVec_HTLCOutputInCommitmentZ;
7328
7329 /**
7330  * A dynamically-allocated array of crate::lightning::events::bump_transaction::HTLCDescriptors of arbitrary size.
7331  * This corresponds to std::vector in C++
7332  */
7333 typedef struct LDKCVec_HTLCDescriptorZ {
7334    /**
7335     * The elements in the array.
7336     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7337     */
7338    struct LDKHTLCDescriptor *data;
7339    /**
7340     * The number of elements pointed to by `data`.
7341     */
7342    uintptr_t datalen;
7343 } LDKCVec_HTLCDescriptorZ;
7344
7345
7346
7347 /**
7348  * An unspent transaction output that is available to spend resulting from a successful
7349  * [`CoinSelection`] attempt.
7350  */
7351 typedef struct MUST_USE_STRUCT LDKUtxo {
7352    /**
7353     * A pointer to the opaque Rust object.
7354     * Nearly everywhere, inner must be non-null, however in places where
7355     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7356     */
7357    LDKnativeUtxo *inner;
7358    /**
7359     * Indicates that this is the only struct which contains the same pointer.
7360     * Rust functions which take ownership of an object provided via an argument require
7361     * this to be true and invalidate the object pointed to by inner.
7362     */
7363    bool is_owned;
7364 } LDKUtxo;
7365
7366 /**
7367  * A dynamically-allocated array of crate::lightning::events::bump_transaction::Utxos of arbitrary size.
7368  * This corresponds to std::vector in C++
7369  */
7370 typedef struct LDKCVec_UtxoZ {
7371    /**
7372     * The elements in the array.
7373     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7374     */
7375    struct LDKUtxo *data;
7376    /**
7377     * The number of elements pointed to by `data`.
7378     */
7379    uintptr_t datalen;
7380 } LDKCVec_UtxoZ;
7381
7382 /**
7383  * An enum which can either contain a crate::c_types::TxOut or not
7384  */
7385 typedef enum LDKCOption_TxOutZ_Tag {
7386    /**
7387     * When we're in this state, this COption_TxOutZ contains a crate::c_types::TxOut
7388     */
7389    LDKCOption_TxOutZ_Some,
7390    /**
7391     * When we're in this state, this COption_TxOutZ contains nothing
7392     */
7393    LDKCOption_TxOutZ_None,
7394    /**
7395     * Must be last for serialization purposes
7396     */
7397    LDKCOption_TxOutZ_Sentinel,
7398 } LDKCOption_TxOutZ_Tag;
7399
7400 typedef struct LDKCOption_TxOutZ {
7401    LDKCOption_TxOutZ_Tag tag;
7402    union {
7403       struct {
7404          struct LDKTxOut some;
7405       };
7406    };
7407 } LDKCOption_TxOutZ;
7408
7409
7410
7411 /**
7412  * An input that must be included in a transaction when performing coin selection through
7413  * [`CoinSelectionSource::select_confirmed_utxos`]. It is guaranteed to be a SegWit input, so it
7414  * must have an empty [`TxIn::script_sig`] when spent.
7415  */
7416 typedef struct MUST_USE_STRUCT LDKInput {
7417    /**
7418     * A pointer to the opaque Rust object.
7419     * Nearly everywhere, inner must be non-null, however in places where
7420     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7421     */
7422    LDKnativeInput *inner;
7423    /**
7424     * Indicates that this is the only struct which contains the same pointer.
7425     * Rust functions which take ownership of an object provided via an argument require
7426     * this to be true and invalidate the object pointed to by inner.
7427     */
7428    bool is_owned;
7429 } LDKInput;
7430
7431 /**
7432  * A dynamically-allocated array of crate::lightning::events::bump_transaction::Inputs of arbitrary size.
7433  * This corresponds to std::vector in C++
7434  */
7435 typedef struct LDKCVec_InputZ {
7436    /**
7437     * The elements in the array.
7438     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7439     */
7440    struct LDKInput *data;
7441    /**
7442     * The number of elements pointed to by `data`.
7443     */
7444    uintptr_t datalen;
7445 } LDKCVec_InputZ;
7446
7447
7448
7449 /**
7450  * The result of a successful coin selection attempt for a transaction requiring additional UTXOs
7451  * to cover its fees.
7452  */
7453 typedef struct MUST_USE_STRUCT LDKCoinSelection {
7454    /**
7455     * A pointer to the opaque Rust object.
7456     * Nearly everywhere, inner must be non-null, however in places where
7457     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7458     */
7459    LDKnativeCoinSelection *inner;
7460    /**
7461     * Indicates that this is the only struct which contains the same pointer.
7462     * Rust functions which take ownership of an object provided via an argument require
7463     * this to be true and invalidate the object pointed to by inner.
7464     */
7465    bool is_owned;
7466 } LDKCoinSelection;
7467
7468 /**
7469  * The contents of CResult_CoinSelectionNoneZ
7470  */
7471 typedef union LDKCResult_CoinSelectionNoneZPtr {
7472    /**
7473     * A pointer to the contents in the success state.
7474     * Reading from this pointer when `result_ok` is not set is undefined.
7475     */
7476    struct LDKCoinSelection *result;
7477    /**
7478     * Note that this value is always NULL, as there are no contents in the Err variant
7479     */
7480    void *err;
7481 } LDKCResult_CoinSelectionNoneZPtr;
7482
7483 /**
7484  * A CResult_CoinSelectionNoneZ represents the result of a fallible operation,
7485  * containing a crate::lightning::events::bump_transaction::CoinSelection on success and a () on failure.
7486  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7487  */
7488 typedef struct LDKCResult_CoinSelectionNoneZ {
7489    /**
7490     * The contents of this CResult_CoinSelectionNoneZ, accessible via either
7491     * `err` or `result` depending on the state of `result_ok`.
7492     */
7493    union LDKCResult_CoinSelectionNoneZPtr contents;
7494    /**
7495     * Whether this CResult_CoinSelectionNoneZ represents a success state.
7496     */
7497    bool result_ok;
7498 } LDKCResult_CoinSelectionNoneZ;
7499
7500 /**
7501  * The contents of CResult_CVec_UtxoZNoneZ
7502  */
7503 typedef union LDKCResult_CVec_UtxoZNoneZPtr {
7504    /**
7505     * A pointer to the contents in the success state.
7506     * Reading from this pointer when `result_ok` is not set is undefined.
7507     */
7508    struct LDKCVec_UtxoZ *result;
7509    /**
7510     * Note that this value is always NULL, as there are no contents in the Err variant
7511     */
7512    void *err;
7513 } LDKCResult_CVec_UtxoZNoneZPtr;
7514
7515 /**
7516  * A CResult_CVec_UtxoZNoneZ represents the result of a fallible operation,
7517  * containing a crate::c_types::derived::CVec_UtxoZ on success and a () on failure.
7518  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7519  */
7520 typedef struct LDKCResult_CVec_UtxoZNoneZ {
7521    /**
7522     * The contents of this CResult_CVec_UtxoZNoneZ, accessible via either
7523     * `err` or `result` depending on the state of `result_ok`.
7524     */
7525    union LDKCResult_CVec_UtxoZNoneZPtr contents;
7526    /**
7527     * Whether this CResult_CVec_UtxoZNoneZ represents a success state.
7528     */
7529    bool result_ok;
7530 } LDKCResult_CVec_UtxoZNoneZ;
7531
7532 /**
7533  * An enum which can either contain a u16 or not
7534  */
7535 typedef enum LDKCOption_u16Z_Tag {
7536    /**
7537     * When we're in this state, this COption_u16Z contains a u16
7538     */
7539    LDKCOption_u16Z_Some,
7540    /**
7541     * When we're in this state, this COption_u16Z contains nothing
7542     */
7543    LDKCOption_u16Z_None,
7544    /**
7545     * Must be last for serialization purposes
7546     */
7547    LDKCOption_u16Z_Sentinel,
7548 } LDKCOption_u16Z_Tag;
7549
7550 typedef struct LDKCOption_u16Z {
7551    LDKCOption_u16Z_Tag tag;
7552    union {
7553       struct {
7554          uint16_t some;
7555       };
7556    };
7557 } LDKCOption_u16Z;
7558
7559 /**
7560  * An enum which can either contain a crate::lightning::ln::channelmanager::ChannelShutdownState or not
7561  */
7562 typedef enum LDKCOption_ChannelShutdownStateZ_Tag {
7563    /**
7564     * When we're in this state, this COption_ChannelShutdownStateZ contains a crate::lightning::ln::channelmanager::ChannelShutdownState
7565     */
7566    LDKCOption_ChannelShutdownStateZ_Some,
7567    /**
7568     * When we're in this state, this COption_ChannelShutdownStateZ contains nothing
7569     */
7570    LDKCOption_ChannelShutdownStateZ_None,
7571    /**
7572     * Must be last for serialization purposes
7573     */
7574    LDKCOption_ChannelShutdownStateZ_Sentinel,
7575 } LDKCOption_ChannelShutdownStateZ_Tag;
7576
7577 typedef struct LDKCOption_ChannelShutdownStateZ {
7578    LDKCOption_ChannelShutdownStateZ_Tag tag;
7579    union {
7580       struct {
7581          enum LDKChannelShutdownState some;
7582       };
7583    };
7584 } LDKCOption_ChannelShutdownStateZ;
7585
7586 /**
7587  * An enum which can either contain a crate::c_types::ThirtyTwoBytes or not
7588  */
7589 typedef enum LDKCOption_PaymentHashZ_Tag {
7590    /**
7591     * When we're in this state, this COption_PaymentHashZ contains a crate::c_types::ThirtyTwoBytes
7592     */
7593    LDKCOption_PaymentHashZ_Some,
7594    /**
7595     * When we're in this state, this COption_PaymentHashZ contains nothing
7596     */
7597    LDKCOption_PaymentHashZ_None,
7598    /**
7599     * Must be last for serialization purposes
7600     */
7601    LDKCOption_PaymentHashZ_Sentinel,
7602 } LDKCOption_PaymentHashZ_Tag;
7603
7604 typedef struct LDKCOption_PaymentHashZ {
7605    LDKCOption_PaymentHashZ_Tag tag;
7606    union {
7607       struct {
7608          struct LDKThirtyTwoBytes some;
7609       };
7610    };
7611 } LDKCOption_PaymentHashZ;
7612
7613 /**
7614  * The contents of CResult__u832APIErrorZ
7615  */
7616 typedef union LDKCResult__u832APIErrorZPtr {
7617    /**
7618     * A pointer to the contents in the success state.
7619     * Reading from this pointer when `result_ok` is not set is undefined.
7620     */
7621    struct LDKThirtyTwoBytes *result;
7622    /**
7623     * A pointer to the contents in the error state.
7624     * Reading from this pointer when `result_ok` is set is undefined.
7625     */
7626    struct LDKAPIError *err;
7627 } LDKCResult__u832APIErrorZPtr;
7628
7629 /**
7630  * A CResult__u832APIErrorZ represents the result of a fallible operation,
7631  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
7632  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7633  */
7634 typedef struct LDKCResult__u832APIErrorZ {
7635    /**
7636     * The contents of this CResult__u832APIErrorZ, accessible via either
7637     * `err` or `result` depending on the state of `result_ok`.
7638     */
7639    union LDKCResult__u832APIErrorZPtr contents;
7640    /**
7641     * Whether this CResult__u832APIErrorZ represents a success state.
7642     */
7643    bool result_ok;
7644 } LDKCResult__u832APIErrorZ;
7645
7646 /**
7647  * Used by [`ChannelManager::list_recent_payments`] to express the status of recent payments.
7648  * These include payments that have yet to find a successful path, or have unresolved HTLCs.
7649  */
7650 typedef enum LDKRecentPaymentDetails_Tag {
7651    /**
7652     * When a payment is still being sent and awaiting successful delivery.
7653     */
7654    LDKRecentPaymentDetails_Pending,
7655    /**
7656     * When a pending payment is fulfilled, we continue tracking it until all pending HTLCs have
7657     * been resolved. Upon receiving [`Event::PaymentSent`], we delay for a few minutes before the
7658     * payment is removed from tracking.
7659     */
7660    LDKRecentPaymentDetails_Fulfilled,
7661    /**
7662     * After a payment's retries are exhausted per the provided [`Retry`], or it is explicitly
7663     * abandoned via [`ChannelManager::abandon_payment`], it is marked as abandoned until all
7664     * pending HTLCs for this payment resolve and an [`Event::PaymentFailed`] is generated.
7665     */
7666    LDKRecentPaymentDetails_Abandoned,
7667    /**
7668     * Must be last for serialization purposes
7669     */
7670    LDKRecentPaymentDetails_Sentinel,
7671 } LDKRecentPaymentDetails_Tag;
7672
7673 typedef struct LDKRecentPaymentDetails_LDKPending_Body {
7674    /**
7675     * Hash of the payment that is currently being sent but has yet to be fulfilled or
7676     * abandoned.
7677     */
7678    struct LDKThirtyTwoBytes payment_hash;
7679    /**
7680     * Total amount (in msat, excluding fees) across all paths for this payment,
7681     * not just the amount currently inflight.
7682     */
7683    uint64_t total_msat;
7684 } LDKRecentPaymentDetails_LDKPending_Body;
7685
7686 typedef struct LDKRecentPaymentDetails_LDKFulfilled_Body {
7687    /**
7688     * Hash of the payment that was claimed. `None` for serializations of [`ChannelManager`]
7689     * made before LDK version 0.0.104.
7690     */
7691    struct LDKCOption_PaymentHashZ payment_hash;
7692 } LDKRecentPaymentDetails_LDKFulfilled_Body;
7693
7694 typedef struct LDKRecentPaymentDetails_LDKAbandoned_Body {
7695    /**
7696     * Hash of the payment that we have given up trying to send.
7697     */
7698    struct LDKThirtyTwoBytes payment_hash;
7699 } LDKRecentPaymentDetails_LDKAbandoned_Body;
7700
7701 typedef struct MUST_USE_STRUCT LDKRecentPaymentDetails {
7702    LDKRecentPaymentDetails_Tag tag;
7703    union {
7704       LDKRecentPaymentDetails_LDKPending_Body pending;
7705       LDKRecentPaymentDetails_LDKFulfilled_Body fulfilled;
7706       LDKRecentPaymentDetails_LDKAbandoned_Body abandoned;
7707    };
7708 } LDKRecentPaymentDetails;
7709
7710 /**
7711  * A dynamically-allocated array of crate::lightning::ln::channelmanager::RecentPaymentDetailss of arbitrary size.
7712  * This corresponds to std::vector in C++
7713  */
7714 typedef struct LDKCVec_RecentPaymentDetailsZ {
7715    /**
7716     * The elements in the array.
7717     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7718     */
7719    struct LDKRecentPaymentDetails *data;
7720    /**
7721     * The number of elements pointed to by `data`.
7722     */
7723    uintptr_t datalen;
7724 } LDKCVec_RecentPaymentDetailsZ;
7725
7726 /**
7727  * If a payment fails to send with [`ChannelManager::send_payment_with_route`], it can be in one
7728  * of several states. This enum is returned as the Err() type describing which state the payment
7729  * is in, see the description of individual enum states for more.
7730  *
7731  * [`ChannelManager::send_payment_with_route`]: crate::ln::channelmanager::ChannelManager::send_payment_with_route
7732  */
7733 typedef enum LDKPaymentSendFailure_Tag {
7734    /**
7735     * A parameter which was passed to send_payment was invalid, preventing us from attempting to
7736     * send the payment at all.
7737     *
7738     * You can freely resend the payment in full (with the parameter error fixed).
7739     *
7740     * Because the payment failed outright, no payment tracking is done and no
7741     * [`Event::PaymentPathFailed`] or [`Event::PaymentFailed`] events will be generated.
7742     *
7743     * [`Event::PaymentPathFailed`]: crate::events::Event::PaymentPathFailed
7744     * [`Event::PaymentFailed`]: crate::events::Event::PaymentFailed
7745     */
7746    LDKPaymentSendFailure_ParameterError,
7747    /**
7748     * A parameter in a single path which was passed to send_payment was invalid, preventing us
7749     * from attempting to send the payment at all.
7750     *
7751     * You can freely resend the payment in full (with the parameter error fixed).
7752     *
7753     * Because the payment failed outright, no payment tracking is done and no
7754     * [`Event::PaymentPathFailed`] or [`Event::PaymentFailed`] events will be generated.
7755     *
7756     * The results here are ordered the same as the paths in the route object which was passed to
7757     * send_payment.
7758     *
7759     * [`Event::PaymentPathFailed`]: crate::events::Event::PaymentPathFailed
7760     * [`Event::PaymentFailed`]: crate::events::Event::PaymentFailed
7761     */
7762    LDKPaymentSendFailure_PathParameterError,
7763    /**
7764     * All paths which were attempted failed to send, with no channel state change taking place.
7765     * You can freely resend the payment in full (though you probably want to do so over different
7766     * paths than the ones selected).
7767     *
7768     * Because the payment failed outright, no payment tracking is done and no
7769     * [`Event::PaymentPathFailed`] or [`Event::PaymentFailed`] events will be generated.
7770     *
7771     * [`Event::PaymentPathFailed`]: crate::events::Event::PaymentPathFailed
7772     * [`Event::PaymentFailed`]: crate::events::Event::PaymentFailed
7773     */
7774    LDKPaymentSendFailure_AllFailedResendSafe,
7775    /**
7776     * Indicates that a payment for the provided [`PaymentId`] is already in-flight and has not
7777     * yet completed (i.e. generated an [`Event::PaymentSent`] or [`Event::PaymentFailed`]).
7778     *
7779     * [`PaymentId`]: crate::ln::channelmanager::PaymentId
7780     * [`Event::PaymentSent`]: crate::events::Event::PaymentSent
7781     * [`Event::PaymentFailed`]: crate::events::Event::PaymentFailed
7782     */
7783    LDKPaymentSendFailure_DuplicatePayment,
7784    /**
7785     * Some paths that were attempted failed to send, though some paths may have succeeded. At least
7786     * some paths have irrevocably committed to the HTLC.
7787     *
7788     * The results here are ordered the same as the paths in the route object that was passed to
7789     * send_payment.
7790     *
7791     * Any entries that contain `Err(APIError::MonitorUpdateInprogress)` will send once a
7792     * [`MonitorEvent::Completed`] is provided for the next-hop channel with the latest update_id.
7793     *
7794     * [`MonitorEvent::Completed`]: crate::chain::channelmonitor::MonitorEvent::Completed
7795     */
7796    LDKPaymentSendFailure_PartialFailure,
7797    /**
7798     * Must be last for serialization purposes
7799     */
7800    LDKPaymentSendFailure_Sentinel,
7801 } LDKPaymentSendFailure_Tag;
7802
7803 typedef struct LDKPaymentSendFailure_LDKPartialFailure_Body {
7804    /**
7805     * The errors themselves, in the same order as the paths from the route.
7806     */
7807    struct LDKCVec_CResult_NoneAPIErrorZZ results;
7808    /**
7809     * If some paths failed without irrevocably committing to the new HTLC(s), this will
7810     * contain a [`RouteParameters`] object for the failing paths.
7811     *
7812     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
7813     */
7814    struct LDKRouteParameters failed_paths_retry;
7815    /**
7816     * The payment id for the payment, which is now at least partially pending.
7817     */
7818    struct LDKThirtyTwoBytes payment_id;
7819 } LDKPaymentSendFailure_LDKPartialFailure_Body;
7820
7821 typedef struct MUST_USE_STRUCT LDKPaymentSendFailure {
7822    LDKPaymentSendFailure_Tag tag;
7823    union {
7824       struct {
7825          struct LDKAPIError parameter_error;
7826       };
7827       struct {
7828          struct LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error;
7829       };
7830       struct {
7831          struct LDKCVec_APIErrorZ all_failed_resend_safe;
7832       };
7833       LDKPaymentSendFailure_LDKPartialFailure_Body partial_failure;
7834    };
7835 } LDKPaymentSendFailure;
7836
7837 /**
7838  * The contents of CResult_NonePaymentSendFailureZ
7839  */
7840 typedef union LDKCResult_NonePaymentSendFailureZPtr {
7841    /**
7842     * Note that this value is always NULL, as there are no contents in the OK variant
7843     */
7844    void *result;
7845    /**
7846     * A pointer to the contents in the error state.
7847     * Reading from this pointer when `result_ok` is set is undefined.
7848     */
7849    struct LDKPaymentSendFailure *err;
7850 } LDKCResult_NonePaymentSendFailureZPtr;
7851
7852 /**
7853  * A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
7854  * containing a () on success and a crate::lightning::ln::outbound_payment::PaymentSendFailure on failure.
7855  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7856  */
7857 typedef struct LDKCResult_NonePaymentSendFailureZ {
7858    /**
7859     * The contents of this CResult_NonePaymentSendFailureZ, accessible via either
7860     * `err` or `result` depending on the state of `result_ok`.
7861     */
7862    union LDKCResult_NonePaymentSendFailureZPtr contents;
7863    /**
7864     * Whether this CResult_NonePaymentSendFailureZ represents a success state.
7865     */
7866    bool result_ok;
7867 } LDKCResult_NonePaymentSendFailureZ;
7868
7869 /**
7870  * The contents of CResult_NoneRetryableSendFailureZ
7871  */
7872 typedef union LDKCResult_NoneRetryableSendFailureZPtr {
7873    /**
7874     * Note that this value is always NULL, as there are no contents in the OK variant
7875     */
7876    void *result;
7877    /**
7878     * A pointer to the contents in the error state.
7879     * Reading from this pointer when `result_ok` is set is undefined.
7880     */
7881    enum LDKRetryableSendFailure *err;
7882 } LDKCResult_NoneRetryableSendFailureZPtr;
7883
7884 /**
7885  * A CResult_NoneRetryableSendFailureZ represents the result of a fallible operation,
7886  * containing a () on success and a crate::lightning::ln::outbound_payment::RetryableSendFailure on failure.
7887  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7888  */
7889 typedef struct LDKCResult_NoneRetryableSendFailureZ {
7890    /**
7891     * The contents of this CResult_NoneRetryableSendFailureZ, accessible via either
7892     * `err` or `result` depending on the state of `result_ok`.
7893     */
7894    union LDKCResult_NoneRetryableSendFailureZPtr contents;
7895    /**
7896     * Whether this CResult_NoneRetryableSendFailureZ represents a success state.
7897     */
7898    bool result_ok;
7899 } LDKCResult_NoneRetryableSendFailureZ;
7900
7901 /**
7902  * The contents of CResult_PaymentHashPaymentSendFailureZ
7903  */
7904 typedef union LDKCResult_PaymentHashPaymentSendFailureZPtr {
7905    /**
7906     * A pointer to the contents in the success state.
7907     * Reading from this pointer when `result_ok` is not set is undefined.
7908     */
7909    struct LDKThirtyTwoBytes *result;
7910    /**
7911     * A pointer to the contents in the error state.
7912     * Reading from this pointer when `result_ok` is set is undefined.
7913     */
7914    struct LDKPaymentSendFailure *err;
7915 } LDKCResult_PaymentHashPaymentSendFailureZPtr;
7916
7917 /**
7918  * A CResult_PaymentHashPaymentSendFailureZ represents the result of a fallible operation,
7919  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::outbound_payment::PaymentSendFailure on failure.
7920  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7921  */
7922 typedef struct LDKCResult_PaymentHashPaymentSendFailureZ {
7923    /**
7924     * The contents of this CResult_PaymentHashPaymentSendFailureZ, accessible via either
7925     * `err` or `result` depending on the state of `result_ok`.
7926     */
7927    union LDKCResult_PaymentHashPaymentSendFailureZPtr contents;
7928    /**
7929     * Whether this CResult_PaymentHashPaymentSendFailureZ represents a success state.
7930     */
7931    bool result_ok;
7932 } LDKCResult_PaymentHashPaymentSendFailureZ;
7933
7934 /**
7935  * The contents of CResult_PaymentHashRetryableSendFailureZ
7936  */
7937 typedef union LDKCResult_PaymentHashRetryableSendFailureZPtr {
7938    /**
7939     * A pointer to the contents in the success state.
7940     * Reading from this pointer when `result_ok` is not set is undefined.
7941     */
7942    struct LDKThirtyTwoBytes *result;
7943    /**
7944     * A pointer to the contents in the error state.
7945     * Reading from this pointer when `result_ok` is set is undefined.
7946     */
7947    enum LDKRetryableSendFailure *err;
7948 } LDKCResult_PaymentHashRetryableSendFailureZPtr;
7949
7950 /**
7951  * A CResult_PaymentHashRetryableSendFailureZ represents the result of a fallible operation,
7952  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::outbound_payment::RetryableSendFailure on failure.
7953  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7954  */
7955 typedef struct LDKCResult_PaymentHashRetryableSendFailureZ {
7956    /**
7957     * The contents of this CResult_PaymentHashRetryableSendFailureZ, accessible via either
7958     * `err` or `result` depending on the state of `result_ok`.
7959     */
7960    union LDKCResult_PaymentHashRetryableSendFailureZPtr contents;
7961    /**
7962     * Whether this CResult_PaymentHashRetryableSendFailureZ represents a success state.
7963     */
7964    bool result_ok;
7965 } LDKCResult_PaymentHashRetryableSendFailureZ;
7966
7967 /**
7968  * A tuple of 2 elements. See the individual fields for the types contained.
7969  */
7970 typedef struct LDKC2Tuple_PaymentHashPaymentIdZ {
7971    /**
7972     * The element at position 0
7973     */
7974    struct LDKThirtyTwoBytes a;
7975    /**
7976     * The element at position 1
7977     */
7978    struct LDKThirtyTwoBytes b;
7979 } LDKC2Tuple_PaymentHashPaymentIdZ;
7980
7981 /**
7982  * The contents of CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ
7983  */
7984 typedef union LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
7985    /**
7986     * A pointer to the contents in the success state.
7987     * Reading from this pointer when `result_ok` is not set is undefined.
7988     */
7989    struct LDKC2Tuple_PaymentHashPaymentIdZ *result;
7990    /**
7991     * A pointer to the contents in the error state.
7992     * Reading from this pointer when `result_ok` is set is undefined.
7993     */
7994    struct LDKPaymentSendFailure *err;
7995 } LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr;
7996
7997 /**
7998  * A CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents the result of a fallible operation,
7999  * containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ on success and a crate::lightning::ln::outbound_payment::PaymentSendFailure on failure.
8000  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8001  */
8002 typedef struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8003    /**
8004     * The contents of this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ, accessible via either
8005     * `err` or `result` depending on the state of `result_ok`.
8006     */
8007    union LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr contents;
8008    /**
8009     * Whether this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents a success state.
8010     */
8011    bool result_ok;
8012 } LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ;
8013
8014 /**
8015  * A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
8016  * This corresponds to std::vector in C++
8017  */
8018 typedef struct LDKCVec_ThirtyTwoBytesZ {
8019    /**
8020     * The elements in the array.
8021     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8022     */
8023    struct LDKThirtyTwoBytes *data;
8024    /**
8025     * The number of elements pointed to by `data`.
8026     */
8027    uintptr_t datalen;
8028 } LDKCVec_ThirtyTwoBytesZ;
8029
8030 /**
8031  * A tuple of 2 elements. See the individual fields for the types contained.
8032  */
8033 typedef struct LDKC2Tuple_PaymentHashPaymentSecretZ {
8034    /**
8035     * The element at position 0
8036     */
8037    struct LDKThirtyTwoBytes a;
8038    /**
8039     * The element at position 1
8040     */
8041    struct LDKThirtyTwoBytes b;
8042 } LDKC2Tuple_PaymentHashPaymentSecretZ;
8043
8044 /**
8045  * The contents of CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ
8046  */
8047 typedef union LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
8048    /**
8049     * A pointer to the contents in the success state.
8050     * Reading from this pointer when `result_ok` is not set is undefined.
8051     */
8052    struct LDKC2Tuple_PaymentHashPaymentSecretZ *result;
8053    /**
8054     * Note that this value is always NULL, as there are no contents in the Err variant
8055     */
8056    void *err;
8057 } LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr;
8058
8059 /**
8060  * A CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents the result of a fallible operation,
8061  * containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a () on failure.
8062  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8063  */
8064 typedef struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8065    /**
8066     * The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ, accessible via either
8067     * `err` or `result` depending on the state of `result_ok`.
8068     */
8069    union LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr contents;
8070    /**
8071     * Whether this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents a success state.
8072     */
8073    bool result_ok;
8074 } LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ;
8075
8076 /**
8077  * The contents of CResult_PaymentSecretNoneZ
8078  */
8079 typedef union LDKCResult_PaymentSecretNoneZPtr {
8080    /**
8081     * A pointer to the contents in the success state.
8082     * Reading from this pointer when `result_ok` is not set is undefined.
8083     */
8084    struct LDKThirtyTwoBytes *result;
8085    /**
8086     * Note that this value is always NULL, as there are no contents in the Err variant
8087     */
8088    void *err;
8089 } LDKCResult_PaymentSecretNoneZPtr;
8090
8091 /**
8092  * A CResult_PaymentSecretNoneZ represents the result of a fallible operation,
8093  * containing a crate::c_types::ThirtyTwoBytes on success and a () on failure.
8094  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8095  */
8096 typedef struct LDKCResult_PaymentSecretNoneZ {
8097    /**
8098     * The contents of this CResult_PaymentSecretNoneZ, accessible via either
8099     * `err` or `result` depending on the state of `result_ok`.
8100     */
8101    union LDKCResult_PaymentSecretNoneZPtr contents;
8102    /**
8103     * Whether this CResult_PaymentSecretNoneZ represents a success state.
8104     */
8105    bool result_ok;
8106 } LDKCResult_PaymentSecretNoneZ;
8107
8108 /**
8109  * The contents of CResult_PaymentPreimageAPIErrorZ
8110  */
8111 typedef union LDKCResult_PaymentPreimageAPIErrorZPtr {
8112    /**
8113     * A pointer to the contents in the success state.
8114     * Reading from this pointer when `result_ok` is not set is undefined.
8115     */
8116    struct LDKThirtyTwoBytes *result;
8117    /**
8118     * A pointer to the contents in the error state.
8119     * Reading from this pointer when `result_ok` is set is undefined.
8120     */
8121    struct LDKAPIError *err;
8122 } LDKCResult_PaymentPreimageAPIErrorZPtr;
8123
8124 /**
8125  * A CResult_PaymentPreimageAPIErrorZ represents the result of a fallible operation,
8126  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
8127  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8128  */
8129 typedef struct LDKCResult_PaymentPreimageAPIErrorZ {
8130    /**
8131     * The contents of this CResult_PaymentPreimageAPIErrorZ, accessible via either
8132     * `err` or `result` depending on the state of `result_ok`.
8133     */
8134    union LDKCResult_PaymentPreimageAPIErrorZPtr contents;
8135    /**
8136     * Whether this CResult_PaymentPreimageAPIErrorZ represents a success state.
8137     */
8138    bool result_ok;
8139 } LDKCResult_PaymentPreimageAPIErrorZ;
8140
8141 /**
8142  * An enum which can either contain a crate::c_types::derived::CVec_ChainHashZ or not
8143  */
8144 typedef enum LDKCOption_CVec_ChainHashZZ_Tag {
8145    /**
8146     * When we're in this state, this COption_CVec_ChainHashZZ contains a crate::c_types::derived::CVec_ChainHashZ
8147     */
8148    LDKCOption_CVec_ChainHashZZ_Some,
8149    /**
8150     * When we're in this state, this COption_CVec_ChainHashZZ contains nothing
8151     */
8152    LDKCOption_CVec_ChainHashZZ_None,
8153    /**
8154     * Must be last for serialization purposes
8155     */
8156    LDKCOption_CVec_ChainHashZZ_Sentinel,
8157 } LDKCOption_CVec_ChainHashZZ_Tag;
8158
8159 typedef struct LDKCOption_CVec_ChainHashZZ {
8160    LDKCOption_CVec_ChainHashZZ_Tag tag;
8161    union {
8162       struct {
8163          struct LDKCVec_ChainHashZ some;
8164       };
8165    };
8166 } LDKCOption_CVec_ChainHashZZ;
8167
8168
8169
8170 /**
8171  * Information needed for constructing an invoice route hint for this channel.
8172  */
8173 typedef struct MUST_USE_STRUCT LDKCounterpartyForwardingInfo {
8174    /**
8175     * A pointer to the opaque Rust object.
8176     * Nearly everywhere, inner must be non-null, however in places where
8177     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8178     */
8179    LDKnativeCounterpartyForwardingInfo *inner;
8180    /**
8181     * Indicates that this is the only struct which contains the same pointer.
8182     * Rust functions which take ownership of an object provided via an argument require
8183     * this to be true and invalidate the object pointed to by inner.
8184     */
8185    bool is_owned;
8186 } LDKCounterpartyForwardingInfo;
8187
8188 /**
8189  * The contents of CResult_CounterpartyForwardingInfoDecodeErrorZ
8190  */
8191 typedef union LDKCResult_CounterpartyForwardingInfoDecodeErrorZPtr {
8192    /**
8193     * A pointer to the contents in the success state.
8194     * Reading from this pointer when `result_ok` is not set is undefined.
8195     */
8196    struct LDKCounterpartyForwardingInfo *result;
8197    /**
8198     * A pointer to the contents in the error state.
8199     * Reading from this pointer when `result_ok` is set is undefined.
8200     */
8201    struct LDKDecodeError *err;
8202 } LDKCResult_CounterpartyForwardingInfoDecodeErrorZPtr;
8203
8204 /**
8205  * A CResult_CounterpartyForwardingInfoDecodeErrorZ represents the result of a fallible operation,
8206  * containing a crate::lightning::ln::channelmanager::CounterpartyForwardingInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
8207  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8208  */
8209 typedef struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ {
8210    /**
8211     * The contents of this CResult_CounterpartyForwardingInfoDecodeErrorZ, accessible via either
8212     * `err` or `result` depending on the state of `result_ok`.
8213     */
8214    union LDKCResult_CounterpartyForwardingInfoDecodeErrorZPtr contents;
8215    /**
8216     * Whether this CResult_CounterpartyForwardingInfoDecodeErrorZ represents a success state.
8217     */
8218    bool result_ok;
8219 } LDKCResult_CounterpartyForwardingInfoDecodeErrorZ;
8220
8221
8222
8223 /**
8224  * Channel parameters which apply to our counterparty. These are split out from [`ChannelDetails`]
8225  * to better separate parameters.
8226  */
8227 typedef struct MUST_USE_STRUCT LDKChannelCounterparty {
8228    /**
8229     * A pointer to the opaque Rust object.
8230     * Nearly everywhere, inner must be non-null, however in places where
8231     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8232     */
8233    LDKnativeChannelCounterparty *inner;
8234    /**
8235     * Indicates that this is the only struct which contains the same pointer.
8236     * Rust functions which take ownership of an object provided via an argument require
8237     * this to be true and invalidate the object pointed to by inner.
8238     */
8239    bool is_owned;
8240 } LDKChannelCounterparty;
8241
8242 /**
8243  * The contents of CResult_ChannelCounterpartyDecodeErrorZ
8244  */
8245 typedef union LDKCResult_ChannelCounterpartyDecodeErrorZPtr {
8246    /**
8247     * A pointer to the contents in the success state.
8248     * Reading from this pointer when `result_ok` is not set is undefined.
8249     */
8250    struct LDKChannelCounterparty *result;
8251    /**
8252     * A pointer to the contents in the error state.
8253     * Reading from this pointer when `result_ok` is set is undefined.
8254     */
8255    struct LDKDecodeError *err;
8256 } LDKCResult_ChannelCounterpartyDecodeErrorZPtr;
8257
8258 /**
8259  * A CResult_ChannelCounterpartyDecodeErrorZ represents the result of a fallible operation,
8260  * containing a crate::lightning::ln::channelmanager::ChannelCounterparty on success and a crate::lightning::ln::msgs::DecodeError on failure.
8261  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8262  */
8263 typedef struct LDKCResult_ChannelCounterpartyDecodeErrorZ {
8264    /**
8265     * The contents of this CResult_ChannelCounterpartyDecodeErrorZ, accessible via either
8266     * `err` or `result` depending on the state of `result_ok`.
8267     */
8268    union LDKCResult_ChannelCounterpartyDecodeErrorZPtr contents;
8269    /**
8270     * Whether this CResult_ChannelCounterpartyDecodeErrorZ represents a success state.
8271     */
8272    bool result_ok;
8273 } LDKCResult_ChannelCounterpartyDecodeErrorZ;
8274
8275 /**
8276  * The contents of CResult_ChannelDetailsDecodeErrorZ
8277  */
8278 typedef union LDKCResult_ChannelDetailsDecodeErrorZPtr {
8279    /**
8280     * A pointer to the contents in the success state.
8281     * Reading from this pointer when `result_ok` is not set is undefined.
8282     */
8283    struct LDKChannelDetails *result;
8284    /**
8285     * A pointer to the contents in the error state.
8286     * Reading from this pointer when `result_ok` is set is undefined.
8287     */
8288    struct LDKDecodeError *err;
8289 } LDKCResult_ChannelDetailsDecodeErrorZPtr;
8290
8291 /**
8292  * A CResult_ChannelDetailsDecodeErrorZ represents the result of a fallible operation,
8293  * containing a crate::lightning::ln::channelmanager::ChannelDetails on success and a crate::lightning::ln::msgs::DecodeError on failure.
8294  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8295  */
8296 typedef struct LDKCResult_ChannelDetailsDecodeErrorZ {
8297    /**
8298     * The contents of this CResult_ChannelDetailsDecodeErrorZ, accessible via either
8299     * `err` or `result` depending on the state of `result_ok`.
8300     */
8301    union LDKCResult_ChannelDetailsDecodeErrorZPtr contents;
8302    /**
8303     * Whether this CResult_ChannelDetailsDecodeErrorZ represents a success state.
8304     */
8305    bool result_ok;
8306 } LDKCResult_ChannelDetailsDecodeErrorZ;
8307
8308
8309
8310 /**
8311  * Route hints used in constructing invoices for [phantom node payents].
8312  *
8313  * [phantom node payments]: crate::sign::PhantomKeysManager
8314  */
8315 typedef struct MUST_USE_STRUCT LDKPhantomRouteHints {
8316    /**
8317     * A pointer to the opaque Rust object.
8318     * Nearly everywhere, inner must be non-null, however in places where
8319     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8320     */
8321    LDKnativePhantomRouteHints *inner;
8322    /**
8323     * Indicates that this is the only struct which contains the same pointer.
8324     * Rust functions which take ownership of an object provided via an argument require
8325     * this to be true and invalidate the object pointed to by inner.
8326     */
8327    bool is_owned;
8328 } LDKPhantomRouteHints;
8329
8330 /**
8331  * The contents of CResult_PhantomRouteHintsDecodeErrorZ
8332  */
8333 typedef union LDKCResult_PhantomRouteHintsDecodeErrorZPtr {
8334    /**
8335     * A pointer to the contents in the success state.
8336     * Reading from this pointer when `result_ok` is not set is undefined.
8337     */
8338    struct LDKPhantomRouteHints *result;
8339    /**
8340     * A pointer to the contents in the error state.
8341     * Reading from this pointer when `result_ok` is set is undefined.
8342     */
8343    struct LDKDecodeError *err;
8344 } LDKCResult_PhantomRouteHintsDecodeErrorZPtr;
8345
8346 /**
8347  * A CResult_PhantomRouteHintsDecodeErrorZ represents the result of a fallible operation,
8348  * containing a crate::lightning::ln::channelmanager::PhantomRouteHints on success and a crate::lightning::ln::msgs::DecodeError on failure.
8349  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8350  */
8351 typedef struct LDKCResult_PhantomRouteHintsDecodeErrorZ {
8352    /**
8353     * The contents of this CResult_PhantomRouteHintsDecodeErrorZ, accessible via either
8354     * `err` or `result` depending on the state of `result_ok`.
8355     */
8356    union LDKCResult_PhantomRouteHintsDecodeErrorZPtr contents;
8357    /**
8358     * Whether this CResult_PhantomRouteHintsDecodeErrorZ represents a success state.
8359     */
8360    bool result_ok;
8361 } LDKCResult_PhantomRouteHintsDecodeErrorZ;
8362
8363 /**
8364  * The contents of CResult_ChannelShutdownStateDecodeErrorZ
8365  */
8366 typedef union LDKCResult_ChannelShutdownStateDecodeErrorZPtr {
8367    /**
8368     * A pointer to the contents in the success state.
8369     * Reading from this pointer when `result_ok` is not set is undefined.
8370     */
8371    enum LDKChannelShutdownState *result;
8372    /**
8373     * A pointer to the contents in the error state.
8374     * Reading from this pointer when `result_ok` is set is undefined.
8375     */
8376    struct LDKDecodeError *err;
8377 } LDKCResult_ChannelShutdownStateDecodeErrorZPtr;
8378
8379 /**
8380  * A CResult_ChannelShutdownStateDecodeErrorZ represents the result of a fallible operation,
8381  * containing a crate::lightning::ln::channelmanager::ChannelShutdownState on success and a crate::lightning::ln::msgs::DecodeError on failure.
8382  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8383  */
8384 typedef struct LDKCResult_ChannelShutdownStateDecodeErrorZ {
8385    /**
8386     * The contents of this CResult_ChannelShutdownStateDecodeErrorZ, accessible via either
8387     * `err` or `result` depending on the state of `result_ok`.
8388     */
8389    union LDKCResult_ChannelShutdownStateDecodeErrorZPtr contents;
8390    /**
8391     * Whether this CResult_ChannelShutdownStateDecodeErrorZ represents a success state.
8392     */
8393    bool result_ok;
8394 } LDKCResult_ChannelShutdownStateDecodeErrorZ;
8395
8396
8397
8398 /**
8399  * A ChannelMonitor handles chain events (blocks connected and disconnected) and generates
8400  * on-chain transactions to ensure no loss of funds occurs.
8401  *
8402  * You MUST ensure that no ChannelMonitors for a given channel anywhere contain out-of-date
8403  * information and are actively monitoring the chain.
8404  *
8405  * Note that the deserializer is only implemented for (BlockHash, ChannelMonitor), which
8406  * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
8407  * the \"reorg path\" (ie disconnecting blocks until you find a common ancestor from both the
8408  * returned block hash and the the current chain and then reconnecting blocks to get to the
8409  * best chain) upon deserializing the object!
8410  */
8411 typedef struct MUST_USE_STRUCT LDKChannelMonitor {
8412    /**
8413     * A pointer to the opaque Rust object.
8414     * Nearly everywhere, inner must be non-null, however in places where
8415     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8416     */
8417    LDKnativeChannelMonitor *inner;
8418    /**
8419     * Indicates that this is the only struct which contains the same pointer.
8420     * Rust functions which take ownership of an object provided via an argument require
8421     * this to be true and invalidate the object pointed to by inner.
8422     */
8423    bool is_owned;
8424 } LDKChannelMonitor;
8425
8426 /**
8427  * A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
8428  * This corresponds to std::vector in C++
8429  */
8430 typedef struct LDKCVec_ChannelMonitorZ {
8431    /**
8432     * The elements in the array.
8433     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8434     */
8435    struct LDKChannelMonitor *data;
8436    /**
8437     * The number of elements pointed to by `data`.
8438     */
8439    uintptr_t datalen;
8440 } LDKCVec_ChannelMonitorZ;
8441
8442
8443
8444 /**
8445  * An update generated by the underlying channel itself which contains some new information the
8446  * [`ChannelMonitor`] should be made aware of.
8447  *
8448  * Because this represents only a small number of updates to the underlying state, it is generally
8449  * much smaller than a full [`ChannelMonitor`]. However, for large single commitment transaction
8450  * updates (e.g. ones during which there are hundreds of HTLCs pending on the commitment
8451  * transaction), a single update may reach upwards of 1 MiB in serialized size.
8452  */
8453 typedef struct MUST_USE_STRUCT LDKChannelMonitorUpdate {
8454    /**
8455     * A pointer to the opaque Rust object.
8456     * Nearly everywhere, inner must be non-null, however in places where
8457     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8458     */
8459    LDKnativeChannelMonitorUpdate *inner;
8460    /**
8461     * Indicates that this is the only struct which contains the same pointer.
8462     * Rust functions which take ownership of an object provided via an argument require
8463     * this to be true and invalidate the object pointed to by inner.
8464     */
8465    bool is_owned;
8466 } LDKChannelMonitorUpdate;
8467
8468 /**
8469  * The `Watch` trait defines behavior for watching on-chain activity pertaining to channels as
8470  * blocks are connected and disconnected.
8471  *
8472  * Each channel is associated with a [`ChannelMonitor`]. Implementations of this trait are
8473  * responsible for maintaining a set of monitors such that they can be updated accordingly as
8474  * channel state changes and HTLCs are resolved. See method documentation for specific
8475  * requirements.
8476  *
8477  * Implementations **must** ensure that updates are successfully applied and persisted upon method
8478  * completion. If an update fails with a [`PermanentFailure`], then it must immediately shut down
8479  * without taking any further action such as persisting the current state.
8480  *
8481  * If an implementation maintains multiple instances of a channel's monitor (e.g., by storing
8482  * backup copies), then it must ensure that updates are applied across all instances. Otherwise, it
8483  * could result in a revoked transaction being broadcast, allowing the counterparty to claim all
8484  * funds in the channel. See [`ChannelMonitorUpdateStatus`] for more details about how to handle
8485  * multiple instances.
8486  *
8487  * [`PermanentFailure`]: ChannelMonitorUpdateStatus::PermanentFailure
8488  */
8489 typedef struct LDKWatch {
8490    /**
8491     * An opaque pointer which is passed to your function implementations as an argument.
8492     * This has no meaning in the LDK, and can be NULL or any other value.
8493     */
8494    void *this_arg;
8495    /**
8496     * Watches a channel identified by `funding_txo` using `monitor`.
8497     *
8498     * Implementations are responsible for watching the chain for the funding transaction along
8499     * with any spends of outputs returned by [`get_outputs_to_watch`]. In practice, this means
8500     * calling [`block_connected`] and [`block_disconnected`] on the monitor.
8501     *
8502     * Note: this interface MUST error with [`ChannelMonitorUpdateStatus::PermanentFailure`] if
8503     * the given `funding_txo` has previously been registered via `watch_channel`.
8504     *
8505     * [`get_outputs_to_watch`]: channelmonitor::ChannelMonitor::get_outputs_to_watch
8506     * [`block_connected`]: channelmonitor::ChannelMonitor::block_connected
8507     * [`block_disconnected`]: channelmonitor::ChannelMonitor::block_disconnected
8508     */
8509    enum LDKChannelMonitorUpdateStatus (*watch_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitor monitor);
8510    /**
8511     * Updates a channel identified by `funding_txo` by applying `update` to its monitor.
8512     *
8513     * Implementations must call [`update_monitor`] with the given update. See
8514     * [`ChannelMonitorUpdateStatus`] for invariants around returning an error.
8515     *
8516     * [`update_monitor`]: channelmonitor::ChannelMonitor::update_monitor
8517     */
8518    enum LDKChannelMonitorUpdateStatus (*update_channel)(const void *this_arg, struct LDKOutPoint funding_txo, const struct LDKChannelMonitorUpdate *NONNULL_PTR update);
8519    /**
8520     * Returns any monitor events since the last call. Subsequent calls must only return new
8521     * events.
8522     *
8523     * Note that after any block- or transaction-connection calls to a [`ChannelMonitor`], no
8524     * further events may be returned here until the [`ChannelMonitor`] has been fully persisted
8525     * to disk.
8526     *
8527     * For details on asynchronous [`ChannelMonitor`] updating and returning
8528     * [`MonitorEvent::Completed`] here, see [`ChannelMonitorUpdateStatus::InProgress`].
8529     */
8530    struct LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ (*release_pending_monitor_events)(const void *this_arg);
8531    /**
8532     * Frees any resources associated with this object given its this_arg pointer.
8533     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8534     */
8535    void (*free)(void *this_arg);
8536 } LDKWatch;
8537
8538 /**
8539  * A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
8540  * This corresponds to std::vector in C++
8541  */
8542 typedef struct LDKCVec_TransactionZ {
8543    /**
8544     * The elements in the array.
8545     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8546     */
8547    struct LDKTransaction *data;
8548    /**
8549     * The number of elements pointed to by `data`.
8550     */
8551    uintptr_t datalen;
8552 } LDKCVec_TransactionZ;
8553
8554 /**
8555  * An interface to send a transaction to the Bitcoin network.
8556  */
8557 typedef struct LDKBroadcasterInterface {
8558    /**
8559     * An opaque pointer which is passed to your function implementations as an argument.
8560     * This has no meaning in the LDK, and can be NULL or any other value.
8561     */
8562    void *this_arg;
8563    /**
8564     * Sends a list of transactions out to (hopefully) be mined.
8565     * This only needs to handle the actual broadcasting of transactions, LDK will automatically
8566     * rebroadcast transactions that haven't made it into a block.
8567     *
8568     * In some cases LDK may attempt to broadcast a transaction which double-spends another
8569     * and this isn't a bug and can be safely ignored.
8570     *
8571     * If more than one transaction is given, these transactions should be considered to be a
8572     * package and broadcast together. Some of the transactions may or may not depend on each other,
8573     * be sure to manage both cases correctly.
8574     *
8575     * Bitcoin transaction packages are defined in BIP 331 and here:
8576     * https://github.com/bitcoin/bitcoin/blob/master/doc/policy/packages.md
8577     */
8578    void (*broadcast_transactions)(const void *this_arg, struct LDKCVec_TransactionZ txs);
8579    /**
8580     * Frees any resources associated with this object given its this_arg pointer.
8581     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8582     */
8583    void (*free)(void *this_arg);
8584 } LDKBroadcasterInterface;
8585
8586 /**
8587  * A trait that describes a source of entropy.
8588  */
8589 typedef struct LDKEntropySource {
8590    /**
8591     * An opaque pointer which is passed to your function implementations as an argument.
8592     * This has no meaning in the LDK, and can be NULL or any other value.
8593     */
8594    void *this_arg;
8595    /**
8596     * Gets a unique, cryptographically-secure, random 32-byte value. This method must return a
8597     * different value each time it is called.
8598     */
8599    struct LDKThirtyTwoBytes (*get_secure_random_bytes)(const void *this_arg);
8600    /**
8601     * Frees any resources associated with this object given its this_arg pointer.
8602     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8603     */
8604    void (*free)(void *this_arg);
8605 } LDKEntropySource;
8606
8607 /**
8608  * A "slice" referencing some byte array. This is simply a length-tagged pointer which does not
8609  * own the memory pointed to by data.
8610  */
8611 typedef struct LDKu8slice {
8612    /**
8613     * A pointer to the byte buffer
8614     */
8615    const uint8_t *data;
8616    /**
8617     * The number of bytes pointed to by `data`.
8618     */
8619    uintptr_t datalen;
8620 } LDKu8slice;
8621
8622
8623
8624 /**
8625  * The unsigned part of a [`channel_update`] message.
8626  *
8627  * [`channel_update`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-channel_update-message
8628  */
8629 typedef struct MUST_USE_STRUCT LDKUnsignedChannelUpdate {
8630    /**
8631     * A pointer to the opaque Rust object.
8632     * Nearly everywhere, inner must be non-null, however in places where
8633     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8634     */
8635    LDKnativeUnsignedChannelUpdate *inner;
8636    /**
8637     * Indicates that this is the only struct which contains the same pointer.
8638     * Rust functions which take ownership of an object provided via an argument require
8639     * this to be true and invalidate the object pointed to by inner.
8640     */
8641    bool is_owned;
8642 } LDKUnsignedChannelUpdate;
8643
8644
8645
8646 /**
8647  * The unsigned part of a [`node_announcement`] message.
8648  *
8649  * [`node_announcement`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-node_announcement-message
8650  */
8651 typedef struct MUST_USE_STRUCT LDKUnsignedNodeAnnouncement {
8652    /**
8653     * A pointer to the opaque Rust object.
8654     * Nearly everywhere, inner must be non-null, however in places where
8655     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8656     */
8657    LDKnativeUnsignedNodeAnnouncement *inner;
8658    /**
8659     * Indicates that this is the only struct which contains the same pointer.
8660     * Rust functions which take ownership of an object provided via an argument require
8661     * this to be true and invalidate the object pointed to by inner.
8662     */
8663    bool is_owned;
8664 } LDKUnsignedNodeAnnouncement;
8665
8666 /**
8667  * Represents the set of gossip messages that require a signature from a node's identity key.
8668  */
8669 typedef enum LDKUnsignedGossipMessage_Tag {
8670    /**
8671     * An unsigned channel announcement.
8672     */
8673    LDKUnsignedGossipMessage_ChannelAnnouncement,
8674    /**
8675     * An unsigned channel update.
8676     */
8677    LDKUnsignedGossipMessage_ChannelUpdate,
8678    /**
8679     * An unsigned node announcement.
8680     */
8681    LDKUnsignedGossipMessage_NodeAnnouncement,
8682    /**
8683     * Must be last for serialization purposes
8684     */
8685    LDKUnsignedGossipMessage_Sentinel,
8686 } LDKUnsignedGossipMessage_Tag;
8687
8688 typedef struct MUST_USE_STRUCT LDKUnsignedGossipMessage {
8689    LDKUnsignedGossipMessage_Tag tag;
8690    union {
8691       struct {
8692          struct LDKUnsignedChannelAnnouncement channel_announcement;
8693       };
8694       struct {
8695          struct LDKUnsignedChannelUpdate channel_update;
8696       };
8697       struct {
8698          struct LDKUnsignedNodeAnnouncement node_announcement;
8699       };
8700    };
8701 } LDKUnsignedGossipMessage;
8702
8703 /**
8704  * A trait that can handle cryptographic operations at the scope level of a node.
8705  */
8706 typedef struct LDKNodeSigner {
8707    /**
8708     * An opaque pointer which is passed to your function implementations as an argument.
8709     * This has no meaning in the LDK, and can be NULL or any other value.
8710     */
8711    void *this_arg;
8712    /**
8713     * Get secret key material as bytes for use in encrypting and decrypting inbound payment data.
8714     *
8715     * If the implementor of this trait supports [phantom node payments], then every node that is
8716     * intended to be included in the phantom invoice route hints must return the same value from
8717     * this method.
8718     *
8719     * This method must return the same value each time it is called.
8720     *
8721     * [phantom node payments]: PhantomKeysManager
8722     */
8723    struct LDKThirtyTwoBytes (*get_inbound_payment_key_material)(const void *this_arg);
8724    /**
8725     * Get node id based on the provided [`Recipient`].
8726     *
8727     * This method must return the same value each time it is called with a given [`Recipient`]
8728     * parameter.
8729     *
8730     * Errors if the [`Recipient`] variant is not supported by the implementation.
8731     */
8732    struct LDKCResult_PublicKeyNoneZ (*get_node_id)(const void *this_arg, enum LDKRecipient recipient);
8733    /**
8734     * Gets the ECDH shared secret of our node secret and `other_key`, multiplying by `tweak` if
8735     * one is provided. Note that this tweak can be applied to `other_key` instead of our node
8736     * secret, though this is less efficient.
8737     *
8738     * Note that if this fails while attempting to forward an HTLC, LDK will panic. The error
8739     * should be resolved to allow LDK to resume forwarding HTLCs.
8740     *
8741     * Errors if the [`Recipient`] variant is not supported by the implementation.
8742     */
8743    struct LDKCResult_SharedSecretNoneZ (*ecdh)(const void *this_arg, enum LDKRecipient recipient, struct LDKPublicKey other_key, struct LDKCOption_ScalarZ tweak);
8744    /**
8745     * Sign an invoice.
8746     *
8747     * By parameterizing by the raw invoice bytes instead of the hash, we allow implementors of
8748     * this trait to parse the invoice and make sure they're signing what they expect, rather than
8749     * blindly signing the hash.
8750     *
8751     * The `hrp_bytes` are ASCII bytes, while the `invoice_data` is base32.
8752     *
8753     * The secret key used to sign the invoice is dependent on the [`Recipient`].
8754     *
8755     * Errors if the [`Recipient`] variant is not supported by the implementation.
8756     */
8757    struct LDKCResult_RecoverableSignatureNoneZ (*sign_invoice)(const void *this_arg, struct LDKu8slice hrp_bytes, struct LDKCVec_U5Z invoice_data, enum LDKRecipient recipient);
8758    /**
8759     * Sign a gossip message.
8760     *
8761     * Note that if this fails, LDK may panic and the message will not be broadcast to the network
8762     * or a possible channel counterparty. If LDK panics, the error should be resolved to allow the
8763     * message to be broadcast, as otherwise it may prevent one from receiving funds over the
8764     * corresponding channel.
8765     */
8766    struct LDKCResult_SignatureNoneZ (*sign_gossip_message)(const void *this_arg, struct LDKUnsignedGossipMessage msg);
8767    /**
8768     * Frees any resources associated with this object given its this_arg pointer.
8769     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8770     */
8771    void (*free)(void *this_arg);
8772 } LDKNodeSigner;
8773
8774 /**
8775  * A trait that can return signer instances for individual channels.
8776  */
8777 typedef struct LDKSignerProvider {
8778    /**
8779     * An opaque pointer which is passed to your function implementations as an argument.
8780     * This has no meaning in the LDK, and can be NULL or any other value.
8781     */
8782    void *this_arg;
8783    /**
8784     * Generates a unique `channel_keys_id` that can be used to obtain a [`Self::Signer`] through
8785     * [`SignerProvider::derive_channel_signer`]. The `user_channel_id` is provided to allow
8786     * implementations of [`SignerProvider`] to maintain a mapping between itself and the generated
8787     * `channel_keys_id`.
8788     *
8789     * This method must return a different value each time it is called.
8790     */
8791    struct LDKThirtyTwoBytes (*generate_channel_keys_id)(const void *this_arg, bool inbound, uint64_t channel_value_satoshis, struct LDKU128 user_channel_id);
8792    /**
8793     * Derives the private key material backing a `Signer`.
8794     *
8795     * To derive a new `Signer`, a fresh `channel_keys_id` should be obtained through
8796     * [`SignerProvider::generate_channel_keys_id`]. Otherwise, an existing `Signer` can be
8797     * re-derived from its `channel_keys_id`, which can be obtained through its trait method
8798     * [`ChannelSigner::channel_keys_id`].
8799     */
8800    struct LDKWriteableEcdsaChannelSigner (*derive_channel_signer)(const void *this_arg, uint64_t channel_value_satoshis, struct LDKThirtyTwoBytes channel_keys_id);
8801    /**
8802     * Reads a [`Signer`] for this [`SignerProvider`] from the given input stream.
8803     * This is only called during deserialization of other objects which contain
8804     * [`WriteableEcdsaChannelSigner`]-implementing objects (i.e., [`ChannelMonitor`]s and [`ChannelManager`]s).
8805     * The bytes are exactly those which `<Self::Signer as Writeable>::write()` writes, and
8806     * contain no versioning scheme. You may wish to include your own version prefix and ensure
8807     * you've read all of the provided bytes to ensure no corruption occurred.
8808     *
8809     * This method is slowly being phased out -- it will only be called when reading objects
8810     * written by LDK versions prior to 0.0.113.
8811     *
8812     * [`Signer`]: Self::Signer
8813     * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor
8814     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
8815     */
8816    struct LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ (*read_chan_signer)(const void *this_arg, struct LDKu8slice reader);
8817    /**
8818     * Get a script pubkey which we send funds to when claiming on-chain contestable outputs.
8819     *
8820     * If this function returns an error, this will result in a channel failing to open.
8821     *
8822     * This method should return a different value each time it is called, to avoid linking
8823     * on-chain funds across channels as controlled to the same user.
8824     */
8825    struct LDKCResult_ScriptNoneZ (*get_destination_script)(const void *this_arg);
8826    /**
8827     * Get a script pubkey which we will send funds to when closing a channel.
8828     *
8829     * If this function returns an error, this will result in a channel failing to open or close.
8830     * In the event of a failure when the counterparty is initiating a close, this can result in a
8831     * channel force close.
8832     *
8833     * This method should return a different value each time it is called, to avoid linking
8834     * on-chain funds across channels as controlled to the same user.
8835     */
8836    struct LDKCResult_ShutdownScriptNoneZ (*get_shutdown_scriptpubkey)(const void *this_arg);
8837    /**
8838     * Frees any resources associated with this object given its this_arg pointer.
8839     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8840     */
8841    void (*free)(void *this_arg);
8842 } LDKSignerProvider;
8843
8844 /**
8845  * A trait which should be implemented to provide feerate information on a number of time
8846  * horizons.
8847  *
8848  * If access to a local mempool is not feasible, feerate estimates should be fetched from a set of
8849  * third-parties hosting them. Note that this enables them to affect the propagation of your
8850  * pre-signed transactions at any time and therefore endangers the safety of channels funds. It
8851  * should be considered carefully as a deployment.
8852  *
8853  * Note that all of the functions implemented here *must* be reentrant-safe (obviously - they're
8854  * called from inside the library in response to chain events, P2P events, or timer events).
8855  */
8856 typedef struct LDKFeeEstimator {
8857    /**
8858     * An opaque pointer which is passed to your function implementations as an argument.
8859     * This has no meaning in the LDK, and can be NULL or any other value.
8860     */
8861    void *this_arg;
8862    /**
8863     * Gets estimated satoshis of fee required per 1000 Weight-Units.
8864     *
8865     * LDK will wrap this method and ensure that the value returned is no smaller than 253
8866     * (ie 1 satoshi-per-byte rounded up to ensure later round-downs don't put us below 1 satoshi-per-byte).
8867     *
8868     * The following unit conversions can be used to convert to sats/KW:
8869     *  * satoshis-per-byte * 250
8870     *  * satoshis-per-kbyte / 4
8871     */
8872    uint32_t (*get_est_sat_per_1000_weight)(const void *this_arg, enum LDKConfirmationTarget confirmation_target);
8873    /**
8874     * Frees any resources associated with this object given its this_arg pointer.
8875     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8876     */
8877    void (*free)(void *this_arg);
8878 } LDKFeeEstimator;
8879
8880 /**
8881  * A trait defining behavior for routing a payment.
8882  */
8883 typedef struct LDKRouter {
8884    /**
8885     * An opaque pointer which is passed to your function implementations as an argument.
8886     * This has no meaning in the LDK, and can be NULL or any other value.
8887     */
8888    void *this_arg;
8889    /**
8890     * Finds a [`Route`] for a payment between the given `payer` and a payee.
8891     *
8892     * The `payee` and the payment's value are given in [`RouteParameters::payment_params`]
8893     * and [`RouteParameters::final_value_msat`], respectively.
8894     *
8895     * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None
8896     */
8897    struct LDKCResult_RouteLightningErrorZ (*find_route)(const void *this_arg, struct LDKPublicKey payer, const struct LDKRouteParameters *NONNULL_PTR route_params, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKInFlightHtlcs inflight_htlcs);
8898    /**
8899     * Finds a [`Route`] for a payment between the given `payer` and a payee.
8900     *
8901     * The `payee` and the payment's value are given in [`RouteParameters::payment_params`]
8902     * and [`RouteParameters::final_value_msat`], respectively.
8903     *
8904     * Includes a [`PaymentHash`] and a [`PaymentId`] to be able to correlate the request with a specific
8905     * payment.
8906     *
8907     * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None
8908     */
8909    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, struct LDKInFlightHtlcs inflight_htlcs, struct LDKThirtyTwoBytes _payment_hash, struct LDKThirtyTwoBytes _payment_id);
8910    /**
8911     * Frees any resources associated with this object given its this_arg pointer.
8912     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8913     */
8914    void (*free)(void *this_arg);
8915 } LDKRouter;
8916
8917
8918
8919 /**
8920  * Manager which keeps track of a number of channels and sends messages to the appropriate
8921  * channel, also tracking HTLC preimages and forwarding onion packets appropriately.
8922  *
8923  * Implements [`ChannelMessageHandler`], handling the multi-channel parts and passing things through
8924  * to individual Channels.
8925  *
8926  * Implements [`Writeable`] to write out all channel state to disk. Implies [`peer_disconnected`] for
8927  * all peers during write/read (though does not modify this instance, only the instance being
8928  * serialized). This will result in any channels which have not yet exchanged [`funding_created`] (i.e.,
8929  * called [`funding_transaction_generated`] for outbound channels) being closed.
8930  *
8931  * Note that you can be a bit lazier about writing out `ChannelManager` than you can be with
8932  * [`ChannelMonitor`]. With [`ChannelMonitor`] you MUST write each monitor update out to disk before
8933  * returning from [`chain::Watch::watch_channel`]/[`update_channel`], with ChannelManagers, writing updates
8934  * happens out-of-band (and will prevent any other `ChannelManager` operations from occurring during
8935  * the serialization process). If the deserialized version is out-of-date compared to the
8936  * [`ChannelMonitor`] passed by reference to [`read`], those channels will be force-closed based on the
8937  * `ChannelMonitor` state and no funds will be lost (mod on-chain transaction fees).
8938  *
8939  * Note that the deserializer is only implemented for `(`[`BlockHash`]`, `[`ChannelManager`]`)`, which
8940  * tells you the last block hash which was connected. You should get the best block tip before using the manager.
8941  * See [`chain::Listen`] and [`chain::Confirm`] for more details.
8942  *
8943  * Note that `ChannelManager` is responsible for tracking liveness of its channels and generating
8944  * [`ChannelUpdate`] messages informing peers that the channel is temporarily disabled. To avoid
8945  * spam due to quick disconnection/reconnection, updates are not sent until the channel has been
8946  * offline for a full minute. In order to track this, you must call
8947  * [`timer_tick_occurred`] roughly once per minute, though it doesn't have to be perfect.
8948  *
8949  * To avoid trivial DoS issues, `ChannelManager` limits the number of inbound connections and
8950  * inbound channels without confirmed funding transactions. This may result in nodes which we do
8951  * not have a channel with being unable to connect to us or open new channels with us if we have
8952  * many peers with unfunded channels.
8953  *
8954  * Because it is an indication of trust, inbound channels which we've accepted as 0conf are
8955  * exempted from the count of unfunded channels. Similarly, outbound channels and connections are
8956  * never limited. Please ensure you limit the count of such channels yourself.
8957  *
8958  * Rather than using a plain `ChannelManager`, it is preferable to use either a [`SimpleArcChannelManager`]
8959  * a [`SimpleRefChannelManager`], for conciseness. See their documentation for more details, but
8960  * essentially you should default to using a [`SimpleRefChannelManager`], and use a
8961  * [`SimpleArcChannelManager`] when you require a `ChannelManager` with a static lifetime, such as when
8962  * you're using lightning-net-tokio.
8963  *
8964  * [`peer_disconnected`]: msgs::ChannelMessageHandler::peer_disconnected
8965  * [`funding_created`]: msgs::FundingCreated
8966  * [`funding_transaction_generated`]: Self::funding_transaction_generated
8967  * [`BlockHash`]: bitcoin::hash_types::BlockHash
8968  * [`update_channel`]: chain::Watch::update_channel
8969  * [`ChannelUpdate`]: msgs::ChannelUpdate
8970  * [`timer_tick_occurred`]: Self::timer_tick_occurred
8971  * [`read`]: ReadableArgs::read
8972  */
8973 typedef struct MUST_USE_STRUCT LDKChannelManager {
8974    /**
8975     * A pointer to the opaque Rust object.
8976     * Nearly everywhere, inner must be non-null, however in places where
8977     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8978     */
8979    LDKnativeChannelManager *inner;
8980    /**
8981     * Indicates that this is the only struct which contains the same pointer.
8982     * Rust functions which take ownership of an object provided via an argument require
8983     * this to be true and invalidate the object pointed to by inner.
8984     */
8985    bool is_owned;
8986 } LDKChannelManager;
8987
8988 /**
8989  * A tuple of 2 elements. See the individual fields for the types contained.
8990  */
8991 typedef struct LDKC2Tuple_BlockHashChannelManagerZ {
8992    /**
8993     * The element at position 0
8994     */
8995    struct LDKThirtyTwoBytes a;
8996    /**
8997     * The element at position 1
8998     */
8999    struct LDKChannelManager b;
9000 } LDKC2Tuple_BlockHashChannelManagerZ;
9001
9002 /**
9003  * The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
9004  */
9005 typedef union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
9006    /**
9007     * A pointer to the contents in the success state.
9008     * Reading from this pointer when `result_ok` is not set is undefined.
9009     */
9010    struct LDKC2Tuple_BlockHashChannelManagerZ *result;
9011    /**
9012     * A pointer to the contents in the error state.
9013     * Reading from this pointer when `result_ok` is set is undefined.
9014     */
9015    struct LDKDecodeError *err;
9016 } LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr;
9017
9018 /**
9019  * A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
9020  * containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
9021  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9022  */
9023 typedef struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9024    /**
9025     * The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
9026     * `err` or `result` depending on the state of `result_ok`.
9027     */
9028    union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr contents;
9029    /**
9030     * Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
9031     */
9032    bool result_ok;
9033 } LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ;
9034
9035 /**
9036  * Options for how to set the max dust HTLC exposure allowed on a channel. See
9037  * [`ChannelConfig::max_dust_htlc_exposure`] for details.
9038  */
9039 typedef enum LDKMaxDustHTLCExposure_Tag {
9040    /**
9041     * This sets a fixed limit on the total dust exposure in millisatoshis. Setting this too low
9042     * may prevent the sending or receipt of low-value HTLCs on high-traffic nodes, however this
9043     * limit is very important to prevent stealing of large amounts of dust HTLCs by miners
9044     * through [fee griefing
9045     * attacks](https://lists.linuxfoundation.org/pipermail/lightning-dev/2020-May/002714.html).
9046     *
9047     * Note that if the feerate increases significantly, without a manual increase
9048     * to this maximum the channel may be unable to send/receive HTLCs between the maximum dust
9049     * exposure and the new minimum value for HTLCs to be economically viable to claim.
9050     */
9051    LDKMaxDustHTLCExposure_FixedLimitMsat,
9052    /**
9053     * This sets a multiplier on the estimated high priority feerate (sats/KW, as obtained from
9054     * [`FeeEstimator`]) to determine the maximum allowed dust exposure. If this variant is used
9055     * then the maximum dust exposure in millisatoshis is calculated as:
9056     * `high_priority_feerate_per_kw * value`. For example, with our default value
9057     * `FeeRateMultiplier(5000)`:
9058     *
9059     * - For the minimum fee rate of 1 sat/vByte (250 sat/KW, although the minimum
9060     * defaults to 253 sats/KW for rounding, see [`FeeEstimator`]), the max dust exposure would
9061     * be 253 * 5000 = 1,265,000 msats.
9062     * - For a fee rate of 30 sat/vByte (7500 sat/KW), the max dust exposure would be
9063     * 7500 * 5000 = 37,500,000 msats.
9064     *
9065     * This allows the maximum dust exposure to automatically scale with fee rate changes.
9066     *
9067     * Note, if you're using a third-party fee estimator, this may leave you more exposed to a
9068     * fee griefing attack, where your fee estimator may purposely overestimate the fee rate,
9069     * causing you to accept more dust HTLCs than you would otherwise.
9070     *
9071     * This variant is primarily meant to serve pre-anchor channels, as HTLC fees being included
9072     * on HTLC outputs means your channel may be subject to more dust exposure in the event of
9073     * increases in fee rate.
9074     *
9075     * # Backwards Compatibility
9076     * This variant only became available in LDK 0.0.116, so if you downgrade to a prior version
9077     * by default this will be set to a [`Self::FixedLimitMsat`] of 5,000,000 msat.
9078     *
9079     * [`FeeEstimator`]: crate::chain::chaininterface::FeeEstimator
9080     */
9081    LDKMaxDustHTLCExposure_FeeRateMultiplier,
9082    /**
9083     * Must be last for serialization purposes
9084     */
9085    LDKMaxDustHTLCExposure_Sentinel,
9086 } LDKMaxDustHTLCExposure_Tag;
9087
9088 typedef struct MUST_USE_STRUCT LDKMaxDustHTLCExposure {
9089    LDKMaxDustHTLCExposure_Tag tag;
9090    union {
9091       struct {
9092          uint64_t fixed_limit_msat;
9093       };
9094       struct {
9095          uint64_t fee_rate_multiplier;
9096       };
9097    };
9098 } LDKMaxDustHTLCExposure;
9099
9100 /**
9101  * The contents of CResult_MaxDustHTLCExposureDecodeErrorZ
9102  */
9103 typedef union LDKCResult_MaxDustHTLCExposureDecodeErrorZPtr {
9104    /**
9105     * A pointer to the contents in the success state.
9106     * Reading from this pointer when `result_ok` is not set is undefined.
9107     */
9108    struct LDKMaxDustHTLCExposure *result;
9109    /**
9110     * A pointer to the contents in the error state.
9111     * Reading from this pointer when `result_ok` is set is undefined.
9112     */
9113    struct LDKDecodeError *err;
9114 } LDKCResult_MaxDustHTLCExposureDecodeErrorZPtr;
9115
9116 /**
9117  * A CResult_MaxDustHTLCExposureDecodeErrorZ represents the result of a fallible operation,
9118  * containing a crate::lightning::util::config::MaxDustHTLCExposure on success and a crate::lightning::ln::msgs::DecodeError on failure.
9119  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9120  */
9121 typedef struct LDKCResult_MaxDustHTLCExposureDecodeErrorZ {
9122    /**
9123     * The contents of this CResult_MaxDustHTLCExposureDecodeErrorZ, accessible via either
9124     * `err` or `result` depending on the state of `result_ok`.
9125     */
9126    union LDKCResult_MaxDustHTLCExposureDecodeErrorZPtr contents;
9127    /**
9128     * Whether this CResult_MaxDustHTLCExposureDecodeErrorZ represents a success state.
9129     */
9130    bool result_ok;
9131 } LDKCResult_MaxDustHTLCExposureDecodeErrorZ;
9132
9133
9134
9135 /**
9136  * Options which apply on a per-channel basis and may change at runtime or based on negotiation
9137  * with our counterparty.
9138  */
9139 typedef struct MUST_USE_STRUCT LDKChannelConfig {
9140    /**
9141     * A pointer to the opaque Rust object.
9142     * Nearly everywhere, inner must be non-null, however in places where
9143     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9144     */
9145    LDKnativeChannelConfig *inner;
9146    /**
9147     * Indicates that this is the only struct which contains the same pointer.
9148     * Rust functions which take ownership of an object provided via an argument require
9149     * this to be true and invalidate the object pointed to by inner.
9150     */
9151    bool is_owned;
9152 } LDKChannelConfig;
9153
9154 /**
9155  * The contents of CResult_ChannelConfigDecodeErrorZ
9156  */
9157 typedef union LDKCResult_ChannelConfigDecodeErrorZPtr {
9158    /**
9159     * A pointer to the contents in the success state.
9160     * Reading from this pointer when `result_ok` is not set is undefined.
9161     */
9162    struct LDKChannelConfig *result;
9163    /**
9164     * A pointer to the contents in the error state.
9165     * Reading from this pointer when `result_ok` is set is undefined.
9166     */
9167    struct LDKDecodeError *err;
9168 } LDKCResult_ChannelConfigDecodeErrorZPtr;
9169
9170 /**
9171  * A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
9172  * containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
9173  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9174  */
9175 typedef struct LDKCResult_ChannelConfigDecodeErrorZ {
9176    /**
9177     * The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
9178     * `err` or `result` depending on the state of `result_ok`.
9179     */
9180    union LDKCResult_ChannelConfigDecodeErrorZPtr contents;
9181    /**
9182     * Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
9183     */
9184    bool result_ok;
9185 } LDKCResult_ChannelConfigDecodeErrorZ;
9186
9187 /**
9188  * An enum which can either contain a crate::lightning::util::config::MaxDustHTLCExposure or not
9189  */
9190 typedef enum LDKCOption_MaxDustHTLCExposureZ_Tag {
9191    /**
9192     * When we're in this state, this COption_MaxDustHTLCExposureZ contains a crate::lightning::util::config::MaxDustHTLCExposure
9193     */
9194    LDKCOption_MaxDustHTLCExposureZ_Some,
9195    /**
9196     * When we're in this state, this COption_MaxDustHTLCExposureZ contains nothing
9197     */
9198    LDKCOption_MaxDustHTLCExposureZ_None,
9199    /**
9200     * Must be last for serialization purposes
9201     */
9202    LDKCOption_MaxDustHTLCExposureZ_Sentinel,
9203 } LDKCOption_MaxDustHTLCExposureZ_Tag;
9204
9205 typedef struct LDKCOption_MaxDustHTLCExposureZ {
9206    LDKCOption_MaxDustHTLCExposureZ_Tag tag;
9207    union {
9208       struct {
9209          struct LDKMaxDustHTLCExposure some;
9210       };
9211    };
9212 } LDKCOption_MaxDustHTLCExposureZ;
9213
9214 /**
9215  * An enum which can either contain a crate::lightning::util::errors::APIError or not
9216  */
9217 typedef enum LDKCOption_APIErrorZ_Tag {
9218    /**
9219     * When we're in this state, this COption_APIErrorZ contains a crate::lightning::util::errors::APIError
9220     */
9221    LDKCOption_APIErrorZ_Some,
9222    /**
9223     * When we're in this state, this COption_APIErrorZ contains nothing
9224     */
9225    LDKCOption_APIErrorZ_None,
9226    /**
9227     * Must be last for serialization purposes
9228     */
9229    LDKCOption_APIErrorZ_Sentinel,
9230 } LDKCOption_APIErrorZ_Tag;
9231
9232 typedef struct LDKCOption_APIErrorZ {
9233    LDKCOption_APIErrorZ_Tag tag;
9234    union {
9235       struct {
9236          struct LDKAPIError some;
9237       };
9238    };
9239 } LDKCOption_APIErrorZ;
9240
9241 /**
9242  * The contents of CResult_COption_APIErrorZDecodeErrorZ
9243  */
9244 typedef union LDKCResult_COption_APIErrorZDecodeErrorZPtr {
9245    /**
9246     * A pointer to the contents in the success state.
9247     * Reading from this pointer when `result_ok` is not set is undefined.
9248     */
9249    struct LDKCOption_APIErrorZ *result;
9250    /**
9251     * A pointer to the contents in the error state.
9252     * Reading from this pointer when `result_ok` is set is undefined.
9253     */
9254    struct LDKDecodeError *err;
9255 } LDKCResult_COption_APIErrorZDecodeErrorZPtr;
9256
9257 /**
9258  * A CResult_COption_APIErrorZDecodeErrorZ represents the result of a fallible operation,
9259  * containing a crate::c_types::derived::COption_APIErrorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
9260  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9261  */
9262 typedef struct LDKCResult_COption_APIErrorZDecodeErrorZ {
9263    /**
9264     * The contents of this CResult_COption_APIErrorZDecodeErrorZ, accessible via either
9265     * `err` or `result` depending on the state of `result_ok`.
9266     */
9267    union LDKCResult_COption_APIErrorZDecodeErrorZPtr contents;
9268    /**
9269     * Whether this CResult_COption_APIErrorZDecodeErrorZ represents a success state.
9270     */
9271    bool result_ok;
9272 } LDKCResult_COption_APIErrorZDecodeErrorZ;
9273
9274 /**
9275  * The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
9276  */
9277 typedef union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr {
9278    /**
9279     * A pointer to the contents in the success state.
9280     * Reading from this pointer when `result_ok` is not set is undefined.
9281     */
9282    struct LDKChannelMonitorUpdate *result;
9283    /**
9284     * A pointer to the contents in the error state.
9285     * Reading from this pointer when `result_ok` is set is undefined.
9286     */
9287    struct LDKDecodeError *err;
9288 } LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr;
9289
9290 /**
9291  * A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
9292  * containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
9293  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9294  */
9295 typedef struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ {
9296    /**
9297     * The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
9298     * `err` or `result` depending on the state of `result_ok`.
9299     */
9300    union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr contents;
9301    /**
9302     * Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
9303     */
9304    bool result_ok;
9305 } LDKCResult_ChannelMonitorUpdateDecodeErrorZ;
9306
9307 /**
9308  * An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not
9309  */
9310 typedef enum LDKCOption_MonitorEventZ_Tag {
9311    /**
9312     * When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent
9313     */
9314    LDKCOption_MonitorEventZ_Some,
9315    /**
9316     * When we're in this state, this COption_MonitorEventZ contains nothing
9317     */
9318    LDKCOption_MonitorEventZ_None,
9319    /**
9320     * Must be last for serialization purposes
9321     */
9322    LDKCOption_MonitorEventZ_Sentinel,
9323 } LDKCOption_MonitorEventZ_Tag;
9324
9325 typedef struct LDKCOption_MonitorEventZ {
9326    LDKCOption_MonitorEventZ_Tag tag;
9327    union {
9328       struct {
9329          struct LDKMonitorEvent some;
9330       };
9331    };
9332 } LDKCOption_MonitorEventZ;
9333
9334 /**
9335  * The contents of CResult_COption_MonitorEventZDecodeErrorZ
9336  */
9337 typedef union LDKCResult_COption_MonitorEventZDecodeErrorZPtr {
9338    /**
9339     * A pointer to the contents in the success state.
9340     * Reading from this pointer when `result_ok` is not set is undefined.
9341     */
9342    struct LDKCOption_MonitorEventZ *result;
9343    /**
9344     * A pointer to the contents in the error state.
9345     * Reading from this pointer when `result_ok` is set is undefined.
9346     */
9347    struct LDKDecodeError *err;
9348 } LDKCResult_COption_MonitorEventZDecodeErrorZPtr;
9349
9350 /**
9351  * A CResult_COption_MonitorEventZDecodeErrorZ represents the result of a fallible operation,
9352  * containing a crate::c_types::derived::COption_MonitorEventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
9353  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9354  */
9355 typedef struct LDKCResult_COption_MonitorEventZDecodeErrorZ {
9356    /**
9357     * The contents of this CResult_COption_MonitorEventZDecodeErrorZ, accessible via either
9358     * `err` or `result` depending on the state of `result_ok`.
9359     */
9360    union LDKCResult_COption_MonitorEventZDecodeErrorZPtr contents;
9361    /**
9362     * Whether this CResult_COption_MonitorEventZDecodeErrorZ represents a success state.
9363     */
9364    bool result_ok;
9365 } LDKCResult_COption_MonitorEventZDecodeErrorZ;
9366
9367 /**
9368  * The contents of CResult_HTLCUpdateDecodeErrorZ
9369  */
9370 typedef union LDKCResult_HTLCUpdateDecodeErrorZPtr {
9371    /**
9372     * A pointer to the contents in the success state.
9373     * Reading from this pointer when `result_ok` is not set is undefined.
9374     */
9375    struct LDKHTLCUpdate *result;
9376    /**
9377     * A pointer to the contents in the error state.
9378     * Reading from this pointer when `result_ok` is set is undefined.
9379     */
9380    struct LDKDecodeError *err;
9381 } LDKCResult_HTLCUpdateDecodeErrorZPtr;
9382
9383 /**
9384  * A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
9385  * containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
9386  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9387  */
9388 typedef struct LDKCResult_HTLCUpdateDecodeErrorZ {
9389    /**
9390     * The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
9391     * `err` or `result` depending on the state of `result_ok`.
9392     */
9393    union LDKCResult_HTLCUpdateDecodeErrorZPtr contents;
9394    /**
9395     * Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
9396     */
9397    bool result_ok;
9398 } LDKCResult_HTLCUpdateDecodeErrorZ;
9399
9400 /**
9401  * A tuple of 2 elements. See the individual fields for the types contained.
9402  */
9403 typedef struct LDKC2Tuple_OutPointScriptZ {
9404    /**
9405     * The element at position 0
9406     */
9407    struct LDKOutPoint a;
9408    /**
9409     * The element at position 1
9410     */
9411    struct LDKCVec_u8Z b;
9412 } LDKC2Tuple_OutPointScriptZ;
9413
9414 /**
9415  * A tuple of 2 elements. See the individual fields for the types contained.
9416  */
9417 typedef struct LDKC2Tuple_u32ScriptZ {
9418    /**
9419     * The element at position 0
9420     */
9421    uint32_t a;
9422    /**
9423     * The element at position 1
9424     */
9425    struct LDKCVec_u8Z b;
9426 } LDKC2Tuple_u32ScriptZ;
9427
9428 /**
9429  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
9430  * This corresponds to std::vector in C++
9431  */
9432 typedef struct LDKCVec_C2Tuple_u32ScriptZZ {
9433    /**
9434     * The elements in the array.
9435     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9436     */
9437    struct LDKC2Tuple_u32ScriptZ *data;
9438    /**
9439     * The number of elements pointed to by `data`.
9440     */
9441    uintptr_t datalen;
9442 } LDKCVec_C2Tuple_u32ScriptZZ;
9443
9444 /**
9445  * A tuple of 2 elements. See the individual fields for the types contained.
9446  */
9447 typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
9448    /**
9449     * The element at position 0
9450     */
9451    struct LDKThirtyTwoBytes a;
9452    /**
9453     * The element at position 1
9454     */
9455    struct LDKCVec_C2Tuple_u32ScriptZZ b;
9456 } LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ;
9457
9458 /**
9459  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
9460  * This corresponds to std::vector in C++
9461  */
9462 typedef struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
9463    /**
9464     * The elements in the array.
9465     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9466     */
9467    struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *data;
9468    /**
9469     * The number of elements pointed to by `data`.
9470     */
9471    uintptr_t datalen;
9472 } LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ;
9473
9474 /**
9475  * A tuple of 2 elements. See the individual fields for the types contained.
9476  */
9477 typedef struct LDKC2Tuple_u32TxOutZ {
9478    /**
9479     * The element at position 0
9480     */
9481    uint32_t a;
9482    /**
9483     * The element at position 1
9484     */
9485    struct LDKTxOut b;
9486 } LDKC2Tuple_u32TxOutZ;
9487
9488 /**
9489  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
9490  * This corresponds to std::vector in C++
9491  */
9492 typedef struct LDKCVec_C2Tuple_u32TxOutZZ {
9493    /**
9494     * The elements in the array.
9495     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9496     */
9497    struct LDKC2Tuple_u32TxOutZ *data;
9498    /**
9499     * The number of elements pointed to by `data`.
9500     */
9501    uintptr_t datalen;
9502 } LDKCVec_C2Tuple_u32TxOutZZ;
9503
9504 /**
9505  * A tuple of 2 elements. See the individual fields for the types contained.
9506  */
9507 typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
9508    /**
9509     * The element at position 0
9510     */
9511    struct LDKThirtyTwoBytes a;
9512    /**
9513     * The element at position 1
9514     */
9515    struct LDKCVec_C2Tuple_u32TxOutZZ b;
9516 } LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ;
9517
9518 /**
9519  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
9520  * This corresponds to std::vector in C++
9521  */
9522 typedef struct LDKCVec_TransactionOutputsZ {
9523    /**
9524     * The elements in the array.
9525     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9526     */
9527    struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *data;
9528    /**
9529     * The number of elements pointed to by `data`.
9530     */
9531    uintptr_t datalen;
9532 } LDKCVec_TransactionOutputsZ;
9533
9534 /**
9535  * Details about the balance(s) available for spending once the channel appears on chain.
9536  *
9537  * See [`ChannelMonitor::get_claimable_balances`] for more details on when these will or will not
9538  * be provided.
9539  */
9540 typedef enum LDKBalance_Tag {
9541    /**
9542     * The channel is not yet closed (or the commitment or closing transaction has not yet
9543     * appeared in a block). The given balance is claimable (less on-chain fees) if the channel is
9544     * force-closed now.
9545     */
9546    LDKBalance_ClaimableOnChannelClose,
9547    /**
9548     * The channel has been closed, and the given balance is ours but awaiting confirmations until
9549     * we consider it spendable.
9550     */
9551    LDKBalance_ClaimableAwaitingConfirmations,
9552    /**
9553     * The channel has been closed, and the given balance should be ours but awaiting spending
9554     * transaction confirmation. If the spending transaction does not confirm in time, it is
9555     * possible our counterparty can take the funds by broadcasting an HTLC timeout on-chain.
9556     *
9557     * Once the spending transaction confirms, before it has reached enough confirmations to be
9558     * considered safe from chain reorganizations, the balance will instead be provided via
9559     * [`Balance::ClaimableAwaitingConfirmations`].
9560     */
9561    LDKBalance_ContentiousClaimable,
9562    /**
9563     * HTLCs which we sent to our counterparty which are claimable after a timeout (less on-chain
9564     * fees) if the counterparty does not know the preimage for the HTLCs. These are somewhat
9565     * likely to be claimed by our counterparty before we do.
9566     */
9567    LDKBalance_MaybeTimeoutClaimableHTLC,
9568    /**
9569     * HTLCs which we received from our counterparty which are claimable with a preimage which we
9570     * do not currently have. This will only be claimable if we receive the preimage from the node
9571     * to which we forwarded this HTLC before the timeout.
9572     */
9573    LDKBalance_MaybePreimageClaimableHTLC,
9574    /**
9575     * The channel has been closed, and our counterparty broadcasted a revoked commitment
9576     * transaction.
9577     *
9578     * Thus, we're able to claim all outputs in the commitment transaction, one of which has the
9579     * following amount.
9580     */
9581    LDKBalance_CounterpartyRevokedOutputClaimable,
9582    /**
9583     * Must be last for serialization purposes
9584     */
9585    LDKBalance_Sentinel,
9586 } LDKBalance_Tag;
9587
9588 typedef struct LDKBalance_LDKClaimableOnChannelClose_Body {
9589    /**
9590     * The amount available to claim, in satoshis, excluding the on-chain fees which will be
9591     * required to do so.
9592     */
9593    uint64_t claimable_amount_satoshis;
9594 } LDKBalance_LDKClaimableOnChannelClose_Body;
9595
9596 typedef struct LDKBalance_LDKClaimableAwaitingConfirmations_Body {
9597    /**
9598     * The amount available to claim, in satoshis, possibly excluding the on-chain fees which
9599     * were spent in broadcasting the transaction.
9600     */
9601    uint64_t claimable_amount_satoshis;
9602    /**
9603     * The height at which an [`Event::SpendableOutputs`] event will be generated for this
9604     * amount.
9605     */
9606    uint32_t confirmation_height;
9607 } LDKBalance_LDKClaimableAwaitingConfirmations_Body;
9608
9609 typedef struct LDKBalance_LDKContentiousClaimable_Body {
9610    /**
9611     * The amount available to claim, in satoshis, excluding the on-chain fees which will be
9612     * required to do so.
9613     */
9614    uint64_t claimable_amount_satoshis;
9615    /**
9616     * The height at which the counterparty may be able to claim the balance if we have not
9617     * done so.
9618     */
9619    uint32_t timeout_height;
9620    /**
9621     * The payment hash that locks this HTLC.
9622     */
9623    struct LDKThirtyTwoBytes payment_hash;
9624    /**
9625     * The preimage that can be used to claim this HTLC.
9626     */
9627    struct LDKThirtyTwoBytes payment_preimage;
9628 } LDKBalance_LDKContentiousClaimable_Body;
9629
9630 typedef struct LDKBalance_LDKMaybeTimeoutClaimableHTLC_Body {
9631    /**
9632     * The amount potentially available to claim, in satoshis, excluding the on-chain fees
9633     * which will be required to do so.
9634     */
9635    uint64_t claimable_amount_satoshis;
9636    /**
9637     * The height at which we will be able to claim the balance if our counterparty has not
9638     * done so.
9639     */
9640    uint32_t claimable_height;
9641    /**
9642     * The payment hash whose preimage our counterparty needs to claim this HTLC.
9643     */
9644    struct LDKThirtyTwoBytes payment_hash;
9645 } LDKBalance_LDKMaybeTimeoutClaimableHTLC_Body;
9646
9647 typedef struct LDKBalance_LDKMaybePreimageClaimableHTLC_Body {
9648    /**
9649     * The amount potentially available to claim, in satoshis, excluding the on-chain fees
9650     * which will be required to do so.
9651     */
9652    uint64_t claimable_amount_satoshis;
9653    /**
9654     * The height at which our counterparty will be able to claim the balance if we have not
9655     * yet received the preimage and claimed it ourselves.
9656     */
9657    uint32_t expiry_height;
9658    /**
9659     * The payment hash whose preimage we need to claim this HTLC.
9660     */
9661    struct LDKThirtyTwoBytes payment_hash;
9662 } LDKBalance_LDKMaybePreimageClaimableHTLC_Body;
9663
9664 typedef struct LDKBalance_LDKCounterpartyRevokedOutputClaimable_Body {
9665    /**
9666     * The amount, in satoshis, of the output which we can claim.
9667     *
9668     * Note that for outputs from HTLC balances this may be excluding some on-chain fees that
9669     * were already spent.
9670     */
9671    uint64_t claimable_amount_satoshis;
9672 } LDKBalance_LDKCounterpartyRevokedOutputClaimable_Body;
9673
9674 typedef struct MUST_USE_STRUCT LDKBalance {
9675    LDKBalance_Tag tag;
9676    union {
9677       LDKBalance_LDKClaimableOnChannelClose_Body claimable_on_channel_close;
9678       LDKBalance_LDKClaimableAwaitingConfirmations_Body claimable_awaiting_confirmations;
9679       LDKBalance_LDKContentiousClaimable_Body contentious_claimable;
9680       LDKBalance_LDKMaybeTimeoutClaimableHTLC_Body maybe_timeout_claimable_htlc;
9681       LDKBalance_LDKMaybePreimageClaimableHTLC_Body maybe_preimage_claimable_htlc;
9682       LDKBalance_LDKCounterpartyRevokedOutputClaimable_Body counterparty_revoked_output_claimable;
9683    };
9684 } LDKBalance;
9685
9686 /**
9687  * A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size.
9688  * This corresponds to std::vector in C++
9689  */
9690 typedef struct LDKCVec_BalanceZ {
9691    /**
9692     * The elements in the array.
9693     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9694     */
9695    struct LDKBalance *data;
9696    /**
9697     * The number of elements pointed to by `data`.
9698     */
9699    uintptr_t datalen;
9700 } LDKCVec_BalanceZ;
9701
9702 /**
9703  * A tuple of 2 elements. See the individual fields for the types contained.
9704  */
9705 typedef struct LDKC2Tuple_BlockHashChannelMonitorZ {
9706    /**
9707     * The element at position 0
9708     */
9709    struct LDKThirtyTwoBytes a;
9710    /**
9711     * The element at position 1
9712     */
9713    struct LDKChannelMonitor b;
9714 } LDKC2Tuple_BlockHashChannelMonitorZ;
9715
9716 /**
9717  * The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
9718  */
9719 typedef union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
9720    /**
9721     * A pointer to the contents in the success state.
9722     * Reading from this pointer when `result_ok` is not set is undefined.
9723     */
9724    struct LDKC2Tuple_BlockHashChannelMonitorZ *result;
9725    /**
9726     * A pointer to the contents in the error state.
9727     * Reading from this pointer when `result_ok` is set is undefined.
9728     */
9729    struct LDKDecodeError *err;
9730 } LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr;
9731
9732 /**
9733  * A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
9734  * containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
9735  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9736  */
9737 typedef struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
9738    /**
9739     * The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
9740     * `err` or `result` depending on the state of `result_ok`.
9741     */
9742    union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr contents;
9743    /**
9744     * Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
9745     */
9746    bool result_ok;
9747 } LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ;
9748
9749 /**
9750  * Defines a type identifier for sending messages over the wire.
9751  *
9752  * Messages implementing this trait specify a type and must be [`Writeable`].
9753  */
9754 typedef struct LDKType {
9755    /**
9756     * An opaque pointer which is passed to your function implementations as an argument.
9757     * This has no meaning in the LDK, and can be NULL or any other value.
9758     */
9759    void *this_arg;
9760    /**
9761     * Returns the type identifying the message payload.
9762     */
9763    uint16_t (*type_id)(const void *this_arg);
9764    /**
9765     * Return a human-readable "debug" string describing this object
9766     */
9767    struct LDKStr (*debug_str)(const void *this_arg);
9768    /**
9769     * Serialize the object into a byte array
9770     */
9771    struct LDKCVec_u8Z (*write)(const void *this_arg);
9772    /**
9773     * Frees any resources associated with this object given its this_arg pointer.
9774     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
9775     */
9776    void (*free)(void *this_arg);
9777 } LDKType;
9778
9779 /**
9780  * A tuple of 2 elements. See the individual fields for the types contained.
9781  */
9782 typedef struct LDKC2Tuple_PublicKeyTypeZ {
9783    /**
9784     * The element at position 0
9785     */
9786    struct LDKPublicKey a;
9787    /**
9788     * The element at position 1
9789     */
9790    struct LDKType b;
9791 } LDKC2Tuple_PublicKeyTypeZ;
9792
9793 /**
9794  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size.
9795  * This corresponds to std::vector in C++
9796  */
9797 typedef struct LDKCVec_C2Tuple_PublicKeyTypeZZ {
9798    /**
9799     * The elements in the array.
9800     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9801     */
9802    struct LDKC2Tuple_PublicKeyTypeZ *data;
9803    /**
9804     * The number of elements pointed to by `data`.
9805     */
9806    uintptr_t datalen;
9807 } LDKCVec_C2Tuple_PublicKeyTypeZZ;
9808
9809
9810
9811 /**
9812  * An `InvoiceRequest` is a request for a [`Bolt12Invoice`] formulated from an [`Offer`].
9813  *
9814  * An offer may provide choices such as quantity, amount, chain, features, etc. An invoice request
9815  * specifies these such that its recipient can send an invoice for payment.
9816  *
9817  * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
9818  * [`Offer`]: crate::offers::offer::Offer
9819  */
9820 typedef struct MUST_USE_STRUCT LDKInvoiceRequest {
9821    /**
9822     * A pointer to the opaque Rust object.
9823     * Nearly everywhere, inner must be non-null, however in places where
9824     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9825     */
9826    LDKnativeInvoiceRequest *inner;
9827    /**
9828     * Indicates that this is the only struct which contains the same pointer.
9829     * Rust functions which take ownership of an object provided via an argument require
9830     * this to be true and invalidate the object pointed to by inner.
9831     */
9832    bool is_owned;
9833 } LDKInvoiceRequest;
9834
9835
9836
9837 /**
9838  * A `Bolt12Invoice` is a payment request, typically corresponding to an [`Offer`] or a [`Refund`].
9839  *
9840  * An invoice may be sent in response to an [`InvoiceRequest`] in the case of an offer or sent
9841  * directly after scanning a refund. It includes all the information needed to pay a recipient.
9842  *
9843  * [`Offer`]: crate::offers::offer::Offer
9844  * [`Refund`]: crate::offers::refund::Refund
9845  * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
9846  */
9847 typedef struct MUST_USE_STRUCT LDKBolt12Invoice {
9848    /**
9849     * A pointer to the opaque Rust object.
9850     * Nearly everywhere, inner must be non-null, however in places where
9851     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9852     */
9853    LDKnativeBolt12Invoice *inner;
9854    /**
9855     * Indicates that this is the only struct which contains the same pointer.
9856     * Rust functions which take ownership of an object provided via an argument require
9857     * this to be true and invalidate the object pointed to by inner.
9858     */
9859    bool is_owned;
9860 } LDKBolt12Invoice;
9861
9862
9863
9864 /**
9865  * An error in response to an [`InvoiceRequest`] or an [`Bolt12Invoice`].
9866  *
9867  * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
9868  * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
9869  */
9870 typedef struct MUST_USE_STRUCT LDKInvoiceError {
9871    /**
9872     * A pointer to the opaque Rust object.
9873     * Nearly everywhere, inner must be non-null, however in places where
9874     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9875     */
9876    LDKnativeInvoiceError *inner;
9877    /**
9878     * Indicates that this is the only struct which contains the same pointer.
9879     * Rust functions which take ownership of an object provided via an argument require
9880     * this to be true and invalidate the object pointed to by inner.
9881     */
9882    bool is_owned;
9883 } LDKInvoiceError;
9884
9885 /**
9886  * Possible BOLT 12 Offers messages sent and received via an [`OnionMessage`].
9887  *
9888  * [`OnionMessage`]: crate::ln::msgs::OnionMessage
9889  */
9890 typedef enum LDKOffersMessage_Tag {
9891    /**
9892     * A request for a [`Bolt12Invoice`] for a particular [`Offer`].
9893     *
9894     * [`Offer`]: crate::offers::offer::Offer
9895     */
9896    LDKOffersMessage_InvoiceRequest,
9897    /**
9898     * A [`Bolt12Invoice`] sent in response to an [`InvoiceRequest`] or a [`Refund`].
9899     *
9900     * [`Refund`]: crate::offers::refund::Refund
9901     */
9902    LDKOffersMessage_Invoice,
9903    /**
9904     * An error from handling an [`OffersMessage`].
9905     */
9906    LDKOffersMessage_InvoiceError,
9907    /**
9908     * Must be last for serialization purposes
9909     */
9910    LDKOffersMessage_Sentinel,
9911 } LDKOffersMessage_Tag;
9912
9913 typedef struct MUST_USE_STRUCT LDKOffersMessage {
9914    LDKOffersMessage_Tag tag;
9915    union {
9916       struct {
9917          struct LDKInvoiceRequest invoice_request;
9918       };
9919       struct {
9920          struct LDKBolt12Invoice invoice;
9921       };
9922       struct {
9923          struct LDKInvoiceError invoice_error;
9924       };
9925    };
9926 } LDKOffersMessage;
9927
9928 /**
9929  * An enum which can either contain a crate::lightning::onion_message::offers::OffersMessage or not
9930  */
9931 typedef enum LDKCOption_OffersMessageZ_Tag {
9932    /**
9933     * When we're in this state, this COption_OffersMessageZ contains a crate::lightning::onion_message::offers::OffersMessage
9934     */
9935    LDKCOption_OffersMessageZ_Some,
9936    /**
9937     * When we're in this state, this COption_OffersMessageZ contains nothing
9938     */
9939    LDKCOption_OffersMessageZ_None,
9940    /**
9941     * Must be last for serialization purposes
9942     */
9943    LDKCOption_OffersMessageZ_Sentinel,
9944 } LDKCOption_OffersMessageZ_Tag;
9945
9946 typedef struct LDKCOption_OffersMessageZ {
9947    LDKCOption_OffersMessageZ_Tag tag;
9948    union {
9949       struct {
9950          struct LDKOffersMessage some;
9951       };
9952    };
9953 } LDKCOption_OffersMessageZ;
9954
9955 /**
9956  * The contents of a custom onion message.
9957  */
9958 typedef struct LDKCustomOnionMessageContents {
9959    /**
9960     * An opaque pointer which is passed to your function implementations as an argument.
9961     * This has no meaning in the LDK, and can be NULL or any other value.
9962     */
9963    void *this_arg;
9964    /**
9965     * Returns the TLV type identifying the message contents. MUST be >= 64.
9966     */
9967    uint64_t (*tlv_type)(const void *this_arg);
9968    /**
9969     * Serialize the object into a byte array
9970     */
9971    struct LDKCVec_u8Z (*write)(const void *this_arg);
9972    /**
9973     * Frees any resources associated with this object given its this_arg pointer.
9974     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
9975     */
9976    void (*free)(void *this_arg);
9977 } LDKCustomOnionMessageContents;
9978
9979 /**
9980  * An enum which can either contain a crate::lightning::onion_message::packet::CustomOnionMessageContents or not
9981  */
9982 typedef enum LDKCOption_CustomOnionMessageContentsZ_Tag {
9983    /**
9984     * When we're in this state, this COption_CustomOnionMessageContentsZ contains a crate::lightning::onion_message::packet::CustomOnionMessageContents
9985     */
9986    LDKCOption_CustomOnionMessageContentsZ_Some,
9987    /**
9988     * When we're in this state, this COption_CustomOnionMessageContentsZ contains nothing
9989     */
9990    LDKCOption_CustomOnionMessageContentsZ_None,
9991    /**
9992     * Must be last for serialization purposes
9993     */
9994    LDKCOption_CustomOnionMessageContentsZ_Sentinel,
9995 } LDKCOption_CustomOnionMessageContentsZ_Tag;
9996
9997 typedef struct LDKCOption_CustomOnionMessageContentsZ {
9998    LDKCOption_CustomOnionMessageContentsZ_Tag tag;
9999    union {
10000       struct {
10001          struct LDKCustomOnionMessageContents some;
10002       };
10003    };
10004 } LDKCOption_CustomOnionMessageContentsZ;
10005
10006 /**
10007  * The contents of CResult_COption_CustomOnionMessageContentsZDecodeErrorZ
10008  */
10009 typedef union LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr {
10010    /**
10011     * A pointer to the contents in the success state.
10012     * Reading from this pointer when `result_ok` is not set is undefined.
10013     */
10014    struct LDKCOption_CustomOnionMessageContentsZ *result;
10015    /**
10016     * A pointer to the contents in the error state.
10017     * Reading from this pointer when `result_ok` is set is undefined.
10018     */
10019    struct LDKDecodeError *err;
10020 } LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr;
10021
10022 /**
10023  * A CResult_COption_CustomOnionMessageContentsZDecodeErrorZ represents the result of a fallible operation,
10024  * containing a crate::c_types::derived::COption_CustomOnionMessageContentsZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
10025  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10026  */
10027 typedef struct LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
10028    /**
10029     * The contents of this CResult_COption_CustomOnionMessageContentsZDecodeErrorZ, accessible via either
10030     * `err` or `result` depending on the state of `result_ok`.
10031     */
10032    union LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr contents;
10033    /**
10034     * Whether this CResult_COption_CustomOnionMessageContentsZDecodeErrorZ represents a success state.
10035     */
10036    bool result_ok;
10037 } LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ;
10038
10039 /**
10040  * An enum which can either contain a crate::lightning::ln::wire::Type or not
10041  */
10042 typedef enum LDKCOption_TypeZ_Tag {
10043    /**
10044     * When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type
10045     */
10046    LDKCOption_TypeZ_Some,
10047    /**
10048     * When we're in this state, this COption_TypeZ contains nothing
10049     */
10050    LDKCOption_TypeZ_None,
10051    /**
10052     * Must be last for serialization purposes
10053     */
10054    LDKCOption_TypeZ_Sentinel,
10055 } LDKCOption_TypeZ_Tag;
10056
10057 typedef struct LDKCOption_TypeZ {
10058    LDKCOption_TypeZ_Tag tag;
10059    union {
10060       struct {
10061          struct LDKType some;
10062       };
10063    };
10064 } LDKCOption_TypeZ;
10065
10066 /**
10067  * The contents of CResult_COption_TypeZDecodeErrorZ
10068  */
10069 typedef union LDKCResult_COption_TypeZDecodeErrorZPtr {
10070    /**
10071     * A pointer to the contents in the success state.
10072     * Reading from this pointer when `result_ok` is not set is undefined.
10073     */
10074    struct LDKCOption_TypeZ *result;
10075    /**
10076     * A pointer to the contents in the error state.
10077     * Reading from this pointer when `result_ok` is set is undefined.
10078     */
10079    struct LDKDecodeError *err;
10080 } LDKCResult_COption_TypeZDecodeErrorZPtr;
10081
10082 /**
10083  * A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation,
10084  * containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
10085  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10086  */
10087 typedef struct LDKCResult_COption_TypeZDecodeErrorZ {
10088    /**
10089     * The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either
10090     * `err` or `result` depending on the state of `result_ok`.
10091     */
10092    union LDKCResult_COption_TypeZDecodeErrorZPtr contents;
10093    /**
10094     * Whether this CResult_COption_TypeZDecodeErrorZ represents a success state.
10095     */
10096    bool result_ok;
10097 } LDKCResult_COption_TypeZDecodeErrorZ;
10098
10099 /**
10100  * An enum which can either contain a crate::lightning::ln::msgs::NetAddress or not
10101  */
10102 typedef enum LDKCOption_NetAddressZ_Tag {
10103    /**
10104     * When we're in this state, this COption_NetAddressZ contains a crate::lightning::ln::msgs::NetAddress
10105     */
10106    LDKCOption_NetAddressZ_Some,
10107    /**
10108     * When we're in this state, this COption_NetAddressZ contains nothing
10109     */
10110    LDKCOption_NetAddressZ_None,
10111    /**
10112     * Must be last for serialization purposes
10113     */
10114    LDKCOption_NetAddressZ_Sentinel,
10115 } LDKCOption_NetAddressZ_Tag;
10116
10117 typedef struct LDKCOption_NetAddressZ {
10118    LDKCOption_NetAddressZ_Tag tag;
10119    union {
10120       struct {
10121          struct LDKNetAddress some;
10122       };
10123    };
10124 } LDKCOption_NetAddressZ;
10125
10126 /**
10127  * A tuple of 2 elements. See the individual fields for the types contained.
10128  */
10129 typedef struct LDKC2Tuple_PublicKeyCOption_NetAddressZZ {
10130    /**
10131     * The element at position 0
10132     */
10133    struct LDKPublicKey a;
10134    /**
10135     * The element at position 1
10136     */
10137    struct LDKCOption_NetAddressZ b;
10138 } LDKC2Tuple_PublicKeyCOption_NetAddressZZ;
10139
10140 /**
10141  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyCOption_NetAddressZZs of arbitrary size.
10142  * This corresponds to std::vector in C++
10143  */
10144 typedef struct LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ {
10145    /**
10146     * The elements in the array.
10147     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10148     */
10149    struct LDKC2Tuple_PublicKeyCOption_NetAddressZZ *data;
10150    /**
10151     * The number of elements pointed to by `data`.
10152     */
10153    uintptr_t datalen;
10154 } LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ;
10155
10156
10157
10158 /**
10159  * Error for PeerManager errors. If you get one of these, you must disconnect the socket and
10160  * generate no further read_event/write_buffer_space_avail/socket_disconnected calls for the
10161  * descriptor.
10162  */
10163 typedef struct MUST_USE_STRUCT LDKPeerHandleError {
10164    /**
10165     * A pointer to the opaque Rust object.
10166     * Nearly everywhere, inner must be non-null, however in places where
10167     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10168     */
10169    LDKnativePeerHandleError *inner;
10170    /**
10171     * Indicates that this is the only struct which contains the same pointer.
10172     * Rust functions which take ownership of an object provided via an argument require
10173     * this to be true and invalidate the object pointed to by inner.
10174     */
10175    bool is_owned;
10176 } LDKPeerHandleError;
10177
10178 /**
10179  * The contents of CResult_CVec_u8ZPeerHandleErrorZ
10180  */
10181 typedef union LDKCResult_CVec_u8ZPeerHandleErrorZPtr {
10182    /**
10183     * A pointer to the contents in the success state.
10184     * Reading from this pointer when `result_ok` is not set is undefined.
10185     */
10186    struct LDKCVec_u8Z *result;
10187    /**
10188     * A pointer to the contents in the error state.
10189     * Reading from this pointer when `result_ok` is set is undefined.
10190     */
10191    struct LDKPeerHandleError *err;
10192 } LDKCResult_CVec_u8ZPeerHandleErrorZPtr;
10193
10194 /**
10195  * A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
10196  * containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
10197  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10198  */
10199 typedef struct LDKCResult_CVec_u8ZPeerHandleErrorZ {
10200    /**
10201     * The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
10202     * `err` or `result` depending on the state of `result_ok`.
10203     */
10204    union LDKCResult_CVec_u8ZPeerHandleErrorZPtr contents;
10205    /**
10206     * Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
10207     */
10208    bool result_ok;
10209 } LDKCResult_CVec_u8ZPeerHandleErrorZ;
10210
10211 /**
10212  * The contents of CResult_NonePeerHandleErrorZ
10213  */
10214 typedef union LDKCResult_NonePeerHandleErrorZPtr {
10215    /**
10216     * Note that this value is always NULL, as there are no contents in the OK variant
10217     */
10218    void *result;
10219    /**
10220     * A pointer to the contents in the error state.
10221     * Reading from this pointer when `result_ok` is set is undefined.
10222     */
10223    struct LDKPeerHandleError *err;
10224 } LDKCResult_NonePeerHandleErrorZPtr;
10225
10226 /**
10227  * A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
10228  * containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
10229  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10230  */
10231 typedef struct LDKCResult_NonePeerHandleErrorZ {
10232    /**
10233     * The contents of this CResult_NonePeerHandleErrorZ, accessible via either
10234     * `err` or `result` depending on the state of `result_ok`.
10235     */
10236    union LDKCResult_NonePeerHandleErrorZPtr contents;
10237    /**
10238     * Whether this CResult_NonePeerHandleErrorZ represents a success state.
10239     */
10240    bool result_ok;
10241 } LDKCResult_NonePeerHandleErrorZ;
10242
10243 /**
10244  * The contents of CResult_boolPeerHandleErrorZ
10245  */
10246 typedef union LDKCResult_boolPeerHandleErrorZPtr {
10247    /**
10248     * A pointer to the contents in the success state.
10249     * Reading from this pointer when `result_ok` is not set is undefined.
10250     */
10251    bool *result;
10252    /**
10253     * A pointer to the contents in the error state.
10254     * Reading from this pointer when `result_ok` is set is undefined.
10255     */
10256    struct LDKPeerHandleError *err;
10257 } LDKCResult_boolPeerHandleErrorZPtr;
10258
10259 /**
10260  * A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
10261  * containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
10262  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10263  */
10264 typedef struct LDKCResult_boolPeerHandleErrorZ {
10265    /**
10266     * The contents of this CResult_boolPeerHandleErrorZ, accessible via either
10267     * `err` or `result` depending on the state of `result_ok`.
10268     */
10269    union LDKCResult_boolPeerHandleErrorZPtr contents;
10270    /**
10271     * Whether this CResult_boolPeerHandleErrorZ represents a success state.
10272     */
10273    bool result_ok;
10274 } LDKCResult_boolPeerHandleErrorZ;
10275
10276 /**
10277  * All-encompassing standard error type that processing can return
10278  */
10279 typedef enum LDKGraphSyncError_Tag {
10280    /**
10281     * Error trying to read the update data, typically due to an erroneous data length indication
10282     * that is greater than the actual amount of data provided
10283     */
10284    LDKGraphSyncError_DecodeError,
10285    /**
10286     * Error applying the patch to the network graph, usually the result of updates that are too
10287     * old or missing prerequisite data to the application of updates out of order
10288     */
10289    LDKGraphSyncError_LightningError,
10290    /**
10291     * Must be last for serialization purposes
10292     */
10293    LDKGraphSyncError_Sentinel,
10294 } LDKGraphSyncError_Tag;
10295
10296 typedef struct MUST_USE_STRUCT LDKGraphSyncError {
10297    LDKGraphSyncError_Tag tag;
10298    union {
10299       struct {
10300          struct LDKDecodeError decode_error;
10301       };
10302       struct {
10303          struct LDKLightningError lightning_error;
10304       };
10305    };
10306 } LDKGraphSyncError;
10307
10308 /**
10309  * The contents of CResult_u32GraphSyncErrorZ
10310  */
10311 typedef union LDKCResult_u32GraphSyncErrorZPtr {
10312    /**
10313     * A pointer to the contents in the success state.
10314     * Reading from this pointer when `result_ok` is not set is undefined.
10315     */
10316    uint32_t *result;
10317    /**
10318     * A pointer to the contents in the error state.
10319     * Reading from this pointer when `result_ok` is set is undefined.
10320     */
10321    struct LDKGraphSyncError *err;
10322 } LDKCResult_u32GraphSyncErrorZPtr;
10323
10324 /**
10325  * A CResult_u32GraphSyncErrorZ represents the result of a fallible operation,
10326  * containing a u32 on success and a crate::lightning_rapid_gossip_sync::error::GraphSyncError on failure.
10327  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10328  */
10329 typedef struct LDKCResult_u32GraphSyncErrorZ {
10330    /**
10331     * The contents of this CResult_u32GraphSyncErrorZ, accessible via either
10332     * `err` or `result` depending on the state of `result_ok`.
10333     */
10334    union LDKCResult_u32GraphSyncErrorZPtr contents;
10335    /**
10336     * Whether this CResult_u32GraphSyncErrorZ represents a success state.
10337     */
10338    bool result_ok;
10339 } LDKCResult_u32GraphSyncErrorZ;
10340
10341 /**
10342  * Represents a valid secp256k1 secret key serialized as a 32 byte array.
10343  */
10344 typedef struct LDKSecretKey {
10345    /**
10346     * The bytes of the secret key
10347     */
10348    uint8_t bytes[32];
10349 } LDKSecretKey;
10350
10351 /**
10352  * An enum which can either contain a crate::c_types::SecretKey or not
10353  */
10354 typedef enum LDKCOption_KeyPairZ_Tag {
10355    /**
10356     * When we're in this state, this COption_KeyPairZ contains a crate::c_types::SecretKey
10357     */
10358    LDKCOption_KeyPairZ_Some,
10359    /**
10360     * When we're in this state, this COption_KeyPairZ contains nothing
10361     */
10362    LDKCOption_KeyPairZ_None,
10363    /**
10364     * Must be last for serialization purposes
10365     */
10366    LDKCOption_KeyPairZ_Sentinel,
10367 } LDKCOption_KeyPairZ_Tag;
10368
10369 typedef struct LDKCOption_KeyPairZ {
10370    LDKCOption_KeyPairZ_Tag tag;
10371    union {
10372       struct {
10373          struct LDKSecretKey some;
10374       };
10375    };
10376 } LDKCOption_KeyPairZ;
10377
10378 /**
10379  * The contents of CResult_COption_KeyPairZNoneZ
10380  */
10381 typedef union LDKCResult_COption_KeyPairZNoneZPtr {
10382    /**
10383     * A pointer to the contents in the success state.
10384     * Reading from this pointer when `result_ok` is not set is undefined.
10385     */
10386    struct LDKCOption_KeyPairZ *result;
10387    /**
10388     * Note that this value is always NULL, as there are no contents in the Err variant
10389     */
10390    void *err;
10391 } LDKCResult_COption_KeyPairZNoneZPtr;
10392
10393 /**
10394  * A CResult_COption_KeyPairZNoneZ represents the result of a fallible operation,
10395  * containing a crate::c_types::derived::COption_KeyPairZ on success and a () on failure.
10396  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10397  */
10398 typedef struct LDKCResult_COption_KeyPairZNoneZ {
10399    /**
10400     * The contents of this CResult_COption_KeyPairZNoneZ, accessible via either
10401     * `err` or `result` depending on the state of `result_ok`.
10402     */
10403    union LDKCResult_COption_KeyPairZNoneZPtr contents;
10404    /**
10405     * Whether this CResult_COption_KeyPairZNoneZ represents a success state.
10406     */
10407    bool result_ok;
10408 } LDKCResult_COption_KeyPairZNoneZ;
10409
10410 /**
10411  * An enum which can either contain a crate::c_types::derived::CVec_u8Z or not
10412  */
10413 typedef enum LDKCOption_ScriptZ_Tag {
10414    /**
10415     * When we're in this state, this COption_ScriptZ contains a crate::c_types::derived::CVec_u8Z
10416     */
10417    LDKCOption_ScriptZ_Some,
10418    /**
10419     * When we're in this state, this COption_ScriptZ contains nothing
10420     */
10421    LDKCOption_ScriptZ_None,
10422    /**
10423     * Must be last for serialization purposes
10424     */
10425    LDKCOption_ScriptZ_Sentinel,
10426 } LDKCOption_ScriptZ_Tag;
10427
10428 typedef struct LDKCOption_ScriptZ {
10429    LDKCOption_ScriptZ_Tag tag;
10430    union {
10431       struct {
10432          struct LDKCVec_u8Z some;
10433       };
10434    };
10435 } LDKCOption_ScriptZ;
10436
10437 /**
10438  * A dynamically-allocated array of crate::c_types::Witnesss of arbitrary size.
10439  * This corresponds to std::vector in C++
10440  */
10441 typedef struct LDKCVec_WitnessZ {
10442    /**
10443     * The elements in the array.
10444     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10445     */
10446    struct LDKWitness *data;
10447    /**
10448     * The number of elements pointed to by `data`.
10449     */
10450    uintptr_t datalen;
10451 } LDKCVec_WitnessZ;
10452
10453 /**
10454  * An enum which can either contain a i64 or not
10455  */
10456 typedef enum LDKCOption_i64Z_Tag {
10457    /**
10458     * When we're in this state, this COption_i64Z contains a i64
10459     */
10460    LDKCOption_i64Z_Some,
10461    /**
10462     * When we're in this state, this COption_i64Z contains nothing
10463     */
10464    LDKCOption_i64Z_None,
10465    /**
10466     * Must be last for serialization purposes
10467     */
10468    LDKCOption_i64Z_Sentinel,
10469 } LDKCOption_i64Z_Tag;
10470
10471 typedef struct LDKCOption_i64Z {
10472    LDKCOption_i64Z_Tag tag;
10473    union {
10474       struct {
10475          int64_t some;
10476       };
10477    };
10478 } LDKCOption_i64Z;
10479
10480 /**
10481  * An enum which can either contain a crate::c_types::ThirtyTwoBytes or not
10482  */
10483 typedef enum LDKCOption_TxidZ_Tag {
10484    /**
10485     * When we're in this state, this COption_TxidZ contains a crate::c_types::ThirtyTwoBytes
10486     */
10487    LDKCOption_TxidZ_Some,
10488    /**
10489     * When we're in this state, this COption_TxidZ contains nothing
10490     */
10491    LDKCOption_TxidZ_None,
10492    /**
10493     * Must be last for serialization purposes
10494     */
10495    LDKCOption_TxidZ_Sentinel,
10496 } LDKCOption_TxidZ_Tag;
10497
10498 typedef struct LDKCOption_TxidZ {
10499    LDKCOption_TxidZ_Tag tag;
10500    union {
10501       struct {
10502          struct LDKThirtyTwoBytes some;
10503       };
10504    };
10505 } LDKCOption_TxidZ;
10506
10507 /**
10508  * The contents of CResult_NetAddressDecodeErrorZ
10509  */
10510 typedef union LDKCResult_NetAddressDecodeErrorZPtr {
10511    /**
10512     * A pointer to the contents in the success state.
10513     * Reading from this pointer when `result_ok` is not set is undefined.
10514     */
10515    struct LDKNetAddress *result;
10516    /**
10517     * A pointer to the contents in the error state.
10518     * Reading from this pointer when `result_ok` is set is undefined.
10519     */
10520    struct LDKDecodeError *err;
10521 } LDKCResult_NetAddressDecodeErrorZPtr;
10522
10523 /**
10524  * A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation,
10525  * containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
10526  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10527  */
10528 typedef struct LDKCResult_NetAddressDecodeErrorZ {
10529    /**
10530     * The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
10531     * `err` or `result` depending on the state of `result_ok`.
10532     */
10533    union LDKCResult_NetAddressDecodeErrorZPtr contents;
10534    /**
10535     * Whether this CResult_NetAddressDecodeErrorZ represents a success state.
10536     */
10537    bool result_ok;
10538 } LDKCResult_NetAddressDecodeErrorZ;
10539
10540
10541
10542 /**
10543  * An [`update_add_htlc`] message to be sent to or received from a peer.
10544  *
10545  * [`update_add_htlc`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#adding-an-htlc-update_add_htlc
10546  */
10547 typedef struct MUST_USE_STRUCT LDKUpdateAddHTLC {
10548    /**
10549     * A pointer to the opaque Rust object.
10550     * Nearly everywhere, inner must be non-null, however in places where
10551     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10552     */
10553    LDKnativeUpdateAddHTLC *inner;
10554    /**
10555     * Indicates that this is the only struct which contains the same pointer.
10556     * Rust functions which take ownership of an object provided via an argument require
10557     * this to be true and invalidate the object pointed to by inner.
10558     */
10559    bool is_owned;
10560 } LDKUpdateAddHTLC;
10561
10562 /**
10563  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
10564  * This corresponds to std::vector in C++
10565  */
10566 typedef struct LDKCVec_UpdateAddHTLCZ {
10567    /**
10568     * The elements in the array.
10569     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10570     */
10571    struct LDKUpdateAddHTLC *data;
10572    /**
10573     * The number of elements pointed to by `data`.
10574     */
10575    uintptr_t datalen;
10576 } LDKCVec_UpdateAddHTLCZ;
10577
10578
10579
10580 /**
10581  * An [`update_fulfill_htlc`] message to be sent to or received from a peer.
10582  *
10583  * [`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
10584  */
10585 typedef struct MUST_USE_STRUCT LDKUpdateFulfillHTLC {
10586    /**
10587     * A pointer to the opaque Rust object.
10588     * Nearly everywhere, inner must be non-null, however in places where
10589     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10590     */
10591    LDKnativeUpdateFulfillHTLC *inner;
10592    /**
10593     * Indicates that this is the only struct which contains the same pointer.
10594     * Rust functions which take ownership of an object provided via an argument require
10595     * this to be true and invalidate the object pointed to by inner.
10596     */
10597    bool is_owned;
10598 } LDKUpdateFulfillHTLC;
10599
10600 /**
10601  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
10602  * This corresponds to std::vector in C++
10603  */
10604 typedef struct LDKCVec_UpdateFulfillHTLCZ {
10605    /**
10606     * The elements in the array.
10607     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10608     */
10609    struct LDKUpdateFulfillHTLC *data;
10610    /**
10611     * The number of elements pointed to by `data`.
10612     */
10613    uintptr_t datalen;
10614 } LDKCVec_UpdateFulfillHTLCZ;
10615
10616
10617
10618 /**
10619  * An [`update_fail_htlc`] message to be sent to or received from a peer.
10620  *
10621  * [`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
10622  */
10623 typedef struct MUST_USE_STRUCT LDKUpdateFailHTLC {
10624    /**
10625     * A pointer to the opaque Rust object.
10626     * Nearly everywhere, inner must be non-null, however in places where
10627     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10628     */
10629    LDKnativeUpdateFailHTLC *inner;
10630    /**
10631     * Indicates that this is the only struct which contains the same pointer.
10632     * Rust functions which take ownership of an object provided via an argument require
10633     * this to be true and invalidate the object pointed to by inner.
10634     */
10635    bool is_owned;
10636 } LDKUpdateFailHTLC;
10637
10638 /**
10639  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
10640  * This corresponds to std::vector in C++
10641  */
10642 typedef struct LDKCVec_UpdateFailHTLCZ {
10643    /**
10644     * The elements in the array.
10645     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10646     */
10647    struct LDKUpdateFailHTLC *data;
10648    /**
10649     * The number of elements pointed to by `data`.
10650     */
10651    uintptr_t datalen;
10652 } LDKCVec_UpdateFailHTLCZ;
10653
10654
10655
10656 /**
10657  * An [`update_fail_malformed_htlc`] message to be sent to or received from a peer.
10658  *
10659  * [`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
10660  */
10661 typedef struct MUST_USE_STRUCT LDKUpdateFailMalformedHTLC {
10662    /**
10663     * A pointer to the opaque Rust object.
10664     * Nearly everywhere, inner must be non-null, however in places where
10665     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10666     */
10667    LDKnativeUpdateFailMalformedHTLC *inner;
10668    /**
10669     * Indicates that this is the only struct which contains the same pointer.
10670     * Rust functions which take ownership of an object provided via an argument require
10671     * this to be true and invalidate the object pointed to by inner.
10672     */
10673    bool is_owned;
10674 } LDKUpdateFailMalformedHTLC;
10675
10676 /**
10677  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
10678  * This corresponds to std::vector in C++
10679  */
10680 typedef struct LDKCVec_UpdateFailMalformedHTLCZ {
10681    /**
10682     * The elements in the array.
10683     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10684     */
10685    struct LDKUpdateFailMalformedHTLC *data;
10686    /**
10687     * The number of elements pointed to by `data`.
10688     */
10689    uintptr_t datalen;
10690 } LDKCVec_UpdateFailMalformedHTLCZ;
10691
10692 /**
10693  * The contents of CResult_AcceptChannelDecodeErrorZ
10694  */
10695 typedef union LDKCResult_AcceptChannelDecodeErrorZPtr {
10696    /**
10697     * A pointer to the contents in the success state.
10698     * Reading from this pointer when `result_ok` is not set is undefined.
10699     */
10700    struct LDKAcceptChannel *result;
10701    /**
10702     * A pointer to the contents in the error state.
10703     * Reading from this pointer when `result_ok` is set is undefined.
10704     */
10705    struct LDKDecodeError *err;
10706 } LDKCResult_AcceptChannelDecodeErrorZPtr;
10707
10708 /**
10709  * A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
10710  * containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
10711  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10712  */
10713 typedef struct LDKCResult_AcceptChannelDecodeErrorZ {
10714    /**
10715     * The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
10716     * `err` or `result` depending on the state of `result_ok`.
10717     */
10718    union LDKCResult_AcceptChannelDecodeErrorZPtr contents;
10719    /**
10720     * Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
10721     */
10722    bool result_ok;
10723 } LDKCResult_AcceptChannelDecodeErrorZ;
10724
10725 /**
10726  * The contents of CResult_AcceptChannelV2DecodeErrorZ
10727  */
10728 typedef union LDKCResult_AcceptChannelV2DecodeErrorZPtr {
10729    /**
10730     * A pointer to the contents in the success state.
10731     * Reading from this pointer when `result_ok` is not set is undefined.
10732     */
10733    struct LDKAcceptChannelV2 *result;
10734    /**
10735     * A pointer to the contents in the error state.
10736     * Reading from this pointer when `result_ok` is set is undefined.
10737     */
10738    struct LDKDecodeError *err;
10739 } LDKCResult_AcceptChannelV2DecodeErrorZPtr;
10740
10741 /**
10742  * A CResult_AcceptChannelV2DecodeErrorZ represents the result of a fallible operation,
10743  * containing a crate::lightning::ln::msgs::AcceptChannelV2 on success and a crate::lightning::ln::msgs::DecodeError on failure.
10744  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10745  */
10746 typedef struct LDKCResult_AcceptChannelV2DecodeErrorZ {
10747    /**
10748     * The contents of this CResult_AcceptChannelV2DecodeErrorZ, accessible via either
10749     * `err` or `result` depending on the state of `result_ok`.
10750     */
10751    union LDKCResult_AcceptChannelV2DecodeErrorZPtr contents;
10752    /**
10753     * Whether this CResult_AcceptChannelV2DecodeErrorZ represents a success state.
10754     */
10755    bool result_ok;
10756 } LDKCResult_AcceptChannelV2DecodeErrorZ;
10757
10758 /**
10759  * The contents of CResult_TxAddInputDecodeErrorZ
10760  */
10761 typedef union LDKCResult_TxAddInputDecodeErrorZPtr {
10762    /**
10763     * A pointer to the contents in the success state.
10764     * Reading from this pointer when `result_ok` is not set is undefined.
10765     */
10766    struct LDKTxAddInput *result;
10767    /**
10768     * A pointer to the contents in the error state.
10769     * Reading from this pointer when `result_ok` is set is undefined.
10770     */
10771    struct LDKDecodeError *err;
10772 } LDKCResult_TxAddInputDecodeErrorZPtr;
10773
10774 /**
10775  * A CResult_TxAddInputDecodeErrorZ represents the result of a fallible operation,
10776  * containing a crate::lightning::ln::msgs::TxAddInput on success and a crate::lightning::ln::msgs::DecodeError on failure.
10777  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10778  */
10779 typedef struct LDKCResult_TxAddInputDecodeErrorZ {
10780    /**
10781     * The contents of this CResult_TxAddInputDecodeErrorZ, accessible via either
10782     * `err` or `result` depending on the state of `result_ok`.
10783     */
10784    union LDKCResult_TxAddInputDecodeErrorZPtr contents;
10785    /**
10786     * Whether this CResult_TxAddInputDecodeErrorZ represents a success state.
10787     */
10788    bool result_ok;
10789 } LDKCResult_TxAddInputDecodeErrorZ;
10790
10791 /**
10792  * The contents of CResult_TxAddOutputDecodeErrorZ
10793  */
10794 typedef union LDKCResult_TxAddOutputDecodeErrorZPtr {
10795    /**
10796     * A pointer to the contents in the success state.
10797     * Reading from this pointer when `result_ok` is not set is undefined.
10798     */
10799    struct LDKTxAddOutput *result;
10800    /**
10801     * A pointer to the contents in the error state.
10802     * Reading from this pointer when `result_ok` is set is undefined.
10803     */
10804    struct LDKDecodeError *err;
10805 } LDKCResult_TxAddOutputDecodeErrorZPtr;
10806
10807 /**
10808  * A CResult_TxAddOutputDecodeErrorZ represents the result of a fallible operation,
10809  * containing a crate::lightning::ln::msgs::TxAddOutput on success and a crate::lightning::ln::msgs::DecodeError on failure.
10810  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10811  */
10812 typedef struct LDKCResult_TxAddOutputDecodeErrorZ {
10813    /**
10814     * The contents of this CResult_TxAddOutputDecodeErrorZ, accessible via either
10815     * `err` or `result` depending on the state of `result_ok`.
10816     */
10817    union LDKCResult_TxAddOutputDecodeErrorZPtr contents;
10818    /**
10819     * Whether this CResult_TxAddOutputDecodeErrorZ represents a success state.
10820     */
10821    bool result_ok;
10822 } LDKCResult_TxAddOutputDecodeErrorZ;
10823
10824 /**
10825  * The contents of CResult_TxRemoveInputDecodeErrorZ
10826  */
10827 typedef union LDKCResult_TxRemoveInputDecodeErrorZPtr {
10828    /**
10829     * A pointer to the contents in the success state.
10830     * Reading from this pointer when `result_ok` is not set is undefined.
10831     */
10832    struct LDKTxRemoveInput *result;
10833    /**
10834     * A pointer to the contents in the error state.
10835     * Reading from this pointer when `result_ok` is set is undefined.
10836     */
10837    struct LDKDecodeError *err;
10838 } LDKCResult_TxRemoveInputDecodeErrorZPtr;
10839
10840 /**
10841  * A CResult_TxRemoveInputDecodeErrorZ represents the result of a fallible operation,
10842  * containing a crate::lightning::ln::msgs::TxRemoveInput on success and a crate::lightning::ln::msgs::DecodeError on failure.
10843  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10844  */
10845 typedef struct LDKCResult_TxRemoveInputDecodeErrorZ {
10846    /**
10847     * The contents of this CResult_TxRemoveInputDecodeErrorZ, accessible via either
10848     * `err` or `result` depending on the state of `result_ok`.
10849     */
10850    union LDKCResult_TxRemoveInputDecodeErrorZPtr contents;
10851    /**
10852     * Whether this CResult_TxRemoveInputDecodeErrorZ represents a success state.
10853     */
10854    bool result_ok;
10855 } LDKCResult_TxRemoveInputDecodeErrorZ;
10856
10857 /**
10858  * The contents of CResult_TxRemoveOutputDecodeErrorZ
10859  */
10860 typedef union LDKCResult_TxRemoveOutputDecodeErrorZPtr {
10861    /**
10862     * A pointer to the contents in the success state.
10863     * Reading from this pointer when `result_ok` is not set is undefined.
10864     */
10865    struct LDKTxRemoveOutput *result;
10866    /**
10867     * A pointer to the contents in the error state.
10868     * Reading from this pointer when `result_ok` is set is undefined.
10869     */
10870    struct LDKDecodeError *err;
10871 } LDKCResult_TxRemoveOutputDecodeErrorZPtr;
10872
10873 /**
10874  * A CResult_TxRemoveOutputDecodeErrorZ represents the result of a fallible operation,
10875  * containing a crate::lightning::ln::msgs::TxRemoveOutput on success and a crate::lightning::ln::msgs::DecodeError on failure.
10876  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10877  */
10878 typedef struct LDKCResult_TxRemoveOutputDecodeErrorZ {
10879    /**
10880     * The contents of this CResult_TxRemoveOutputDecodeErrorZ, accessible via either
10881     * `err` or `result` depending on the state of `result_ok`.
10882     */
10883    union LDKCResult_TxRemoveOutputDecodeErrorZPtr contents;
10884    /**
10885     * Whether this CResult_TxRemoveOutputDecodeErrorZ represents a success state.
10886     */
10887    bool result_ok;
10888 } LDKCResult_TxRemoveOutputDecodeErrorZ;
10889
10890 /**
10891  * The contents of CResult_TxCompleteDecodeErrorZ
10892  */
10893 typedef union LDKCResult_TxCompleteDecodeErrorZPtr {
10894    /**
10895     * A pointer to the contents in the success state.
10896     * Reading from this pointer when `result_ok` is not set is undefined.
10897     */
10898    struct LDKTxComplete *result;
10899    /**
10900     * A pointer to the contents in the error state.
10901     * Reading from this pointer when `result_ok` is set is undefined.
10902     */
10903    struct LDKDecodeError *err;
10904 } LDKCResult_TxCompleteDecodeErrorZPtr;
10905
10906 /**
10907  * A CResult_TxCompleteDecodeErrorZ represents the result of a fallible operation,
10908  * containing a crate::lightning::ln::msgs::TxComplete on success and a crate::lightning::ln::msgs::DecodeError on failure.
10909  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10910  */
10911 typedef struct LDKCResult_TxCompleteDecodeErrorZ {
10912    /**
10913     * The contents of this CResult_TxCompleteDecodeErrorZ, accessible via either
10914     * `err` or `result` depending on the state of `result_ok`.
10915     */
10916    union LDKCResult_TxCompleteDecodeErrorZPtr contents;
10917    /**
10918     * Whether this CResult_TxCompleteDecodeErrorZ represents a success state.
10919     */
10920    bool result_ok;
10921 } LDKCResult_TxCompleteDecodeErrorZ;
10922
10923 /**
10924  * The contents of CResult_TxSignaturesDecodeErrorZ
10925  */
10926 typedef union LDKCResult_TxSignaturesDecodeErrorZPtr {
10927    /**
10928     * A pointer to the contents in the success state.
10929     * Reading from this pointer when `result_ok` is not set is undefined.
10930     */
10931    struct LDKTxSignatures *result;
10932    /**
10933     * A pointer to the contents in the error state.
10934     * Reading from this pointer when `result_ok` is set is undefined.
10935     */
10936    struct LDKDecodeError *err;
10937 } LDKCResult_TxSignaturesDecodeErrorZPtr;
10938
10939 /**
10940  * A CResult_TxSignaturesDecodeErrorZ represents the result of a fallible operation,
10941  * containing a crate::lightning::ln::msgs::TxSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
10942  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10943  */
10944 typedef struct LDKCResult_TxSignaturesDecodeErrorZ {
10945    /**
10946     * The contents of this CResult_TxSignaturesDecodeErrorZ, accessible via either
10947     * `err` or `result` depending on the state of `result_ok`.
10948     */
10949    union LDKCResult_TxSignaturesDecodeErrorZPtr contents;
10950    /**
10951     * Whether this CResult_TxSignaturesDecodeErrorZ represents a success state.
10952     */
10953    bool result_ok;
10954 } LDKCResult_TxSignaturesDecodeErrorZ;
10955
10956 /**
10957  * The contents of CResult_TxInitRbfDecodeErrorZ
10958  */
10959 typedef union LDKCResult_TxInitRbfDecodeErrorZPtr {
10960    /**
10961     * A pointer to the contents in the success state.
10962     * Reading from this pointer when `result_ok` is not set is undefined.
10963     */
10964    struct LDKTxInitRbf *result;
10965    /**
10966     * A pointer to the contents in the error state.
10967     * Reading from this pointer when `result_ok` is set is undefined.
10968     */
10969    struct LDKDecodeError *err;
10970 } LDKCResult_TxInitRbfDecodeErrorZPtr;
10971
10972 /**
10973  * A CResult_TxInitRbfDecodeErrorZ represents the result of a fallible operation,
10974  * containing a crate::lightning::ln::msgs::TxInitRbf on success and a crate::lightning::ln::msgs::DecodeError on failure.
10975  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10976  */
10977 typedef struct LDKCResult_TxInitRbfDecodeErrorZ {
10978    /**
10979     * The contents of this CResult_TxInitRbfDecodeErrorZ, accessible via either
10980     * `err` or `result` depending on the state of `result_ok`.
10981     */
10982    union LDKCResult_TxInitRbfDecodeErrorZPtr contents;
10983    /**
10984     * Whether this CResult_TxInitRbfDecodeErrorZ represents a success state.
10985     */
10986    bool result_ok;
10987 } LDKCResult_TxInitRbfDecodeErrorZ;
10988
10989 /**
10990  * The contents of CResult_TxAckRbfDecodeErrorZ
10991  */
10992 typedef union LDKCResult_TxAckRbfDecodeErrorZPtr {
10993    /**
10994     * A pointer to the contents in the success state.
10995     * Reading from this pointer when `result_ok` is not set is undefined.
10996     */
10997    struct LDKTxAckRbf *result;
10998    /**
10999     * A pointer to the contents in the error state.
11000     * Reading from this pointer when `result_ok` is set is undefined.
11001     */
11002    struct LDKDecodeError *err;
11003 } LDKCResult_TxAckRbfDecodeErrorZPtr;
11004
11005 /**
11006  * A CResult_TxAckRbfDecodeErrorZ represents the result of a fallible operation,
11007  * containing a crate::lightning::ln::msgs::TxAckRbf on success and a crate::lightning::ln::msgs::DecodeError on failure.
11008  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11009  */
11010 typedef struct LDKCResult_TxAckRbfDecodeErrorZ {
11011    /**
11012     * The contents of this CResult_TxAckRbfDecodeErrorZ, accessible via either
11013     * `err` or `result` depending on the state of `result_ok`.
11014     */
11015    union LDKCResult_TxAckRbfDecodeErrorZPtr contents;
11016    /**
11017     * Whether this CResult_TxAckRbfDecodeErrorZ represents a success state.
11018     */
11019    bool result_ok;
11020 } LDKCResult_TxAckRbfDecodeErrorZ;
11021
11022
11023
11024 /**
11025  * A tx_abort message which signals the cancellation of an in-progress transaction negotiation.
11026  *
11027  */
11028 typedef struct MUST_USE_STRUCT LDKTxAbort {
11029    /**
11030     * A pointer to the opaque Rust object.
11031     * Nearly everywhere, inner must be non-null, however in places where
11032     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11033     */
11034    LDKnativeTxAbort *inner;
11035    /**
11036     * Indicates that this is the only struct which contains the same pointer.
11037     * Rust functions which take ownership of an object provided via an argument require
11038     * this to be true and invalidate the object pointed to by inner.
11039     */
11040    bool is_owned;
11041 } LDKTxAbort;
11042
11043 /**
11044  * The contents of CResult_TxAbortDecodeErrorZ
11045  */
11046 typedef union LDKCResult_TxAbortDecodeErrorZPtr {
11047    /**
11048     * A pointer to the contents in the success state.
11049     * Reading from this pointer when `result_ok` is not set is undefined.
11050     */
11051    struct LDKTxAbort *result;
11052    /**
11053     * A pointer to the contents in the error state.
11054     * Reading from this pointer when `result_ok` is set is undefined.
11055     */
11056    struct LDKDecodeError *err;
11057 } LDKCResult_TxAbortDecodeErrorZPtr;
11058
11059 /**
11060  * A CResult_TxAbortDecodeErrorZ represents the result of a fallible operation,
11061  * containing a crate::lightning::ln::msgs::TxAbort on success and a crate::lightning::ln::msgs::DecodeError on failure.
11062  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11063  */
11064 typedef struct LDKCResult_TxAbortDecodeErrorZ {
11065    /**
11066     * The contents of this CResult_TxAbortDecodeErrorZ, accessible via either
11067     * `err` or `result` depending on the state of `result_ok`.
11068     */
11069    union LDKCResult_TxAbortDecodeErrorZPtr contents;
11070    /**
11071     * Whether this CResult_TxAbortDecodeErrorZ represents a success state.
11072     */
11073    bool result_ok;
11074 } LDKCResult_TxAbortDecodeErrorZ;
11075
11076 /**
11077  * The contents of CResult_AnnouncementSignaturesDecodeErrorZ
11078  */
11079 typedef union LDKCResult_AnnouncementSignaturesDecodeErrorZPtr {
11080    /**
11081     * A pointer to the contents in the success state.
11082     * Reading from this pointer when `result_ok` is not set is undefined.
11083     */
11084    struct LDKAnnouncementSignatures *result;
11085    /**
11086     * A pointer to the contents in the error state.
11087     * Reading from this pointer when `result_ok` is set is undefined.
11088     */
11089    struct LDKDecodeError *err;
11090 } LDKCResult_AnnouncementSignaturesDecodeErrorZPtr;
11091
11092 /**
11093  * A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
11094  * containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
11095  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11096  */
11097 typedef struct LDKCResult_AnnouncementSignaturesDecodeErrorZ {
11098    /**
11099     * The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
11100     * `err` or `result` depending on the state of `result_ok`.
11101     */
11102    union LDKCResult_AnnouncementSignaturesDecodeErrorZPtr contents;
11103    /**
11104     * Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
11105     */
11106    bool result_ok;
11107 } LDKCResult_AnnouncementSignaturesDecodeErrorZ;
11108
11109 /**
11110  * The contents of CResult_ChannelReestablishDecodeErrorZ
11111  */
11112 typedef union LDKCResult_ChannelReestablishDecodeErrorZPtr {
11113    /**
11114     * A pointer to the contents in the success state.
11115     * Reading from this pointer when `result_ok` is not set is undefined.
11116     */
11117    struct LDKChannelReestablish *result;
11118    /**
11119     * A pointer to the contents in the error state.
11120     * Reading from this pointer when `result_ok` is set is undefined.
11121     */
11122    struct LDKDecodeError *err;
11123 } LDKCResult_ChannelReestablishDecodeErrorZPtr;
11124
11125 /**
11126  * A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
11127  * containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
11128  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11129  */
11130 typedef struct LDKCResult_ChannelReestablishDecodeErrorZ {
11131    /**
11132     * The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
11133     * `err` or `result` depending on the state of `result_ok`.
11134     */
11135    union LDKCResult_ChannelReestablishDecodeErrorZPtr contents;
11136    /**
11137     * Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
11138     */
11139    bool result_ok;
11140 } LDKCResult_ChannelReestablishDecodeErrorZ;
11141
11142 /**
11143  * The contents of CResult_ClosingSignedDecodeErrorZ
11144  */
11145 typedef union LDKCResult_ClosingSignedDecodeErrorZPtr {
11146    /**
11147     * A pointer to the contents in the success state.
11148     * Reading from this pointer when `result_ok` is not set is undefined.
11149     */
11150    struct LDKClosingSigned *result;
11151    /**
11152     * A pointer to the contents in the error state.
11153     * Reading from this pointer when `result_ok` is set is undefined.
11154     */
11155    struct LDKDecodeError *err;
11156 } LDKCResult_ClosingSignedDecodeErrorZPtr;
11157
11158 /**
11159  * A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
11160  * containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
11161  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11162  */
11163 typedef struct LDKCResult_ClosingSignedDecodeErrorZ {
11164    /**
11165     * The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
11166     * `err` or `result` depending on the state of `result_ok`.
11167     */
11168    union LDKCResult_ClosingSignedDecodeErrorZPtr contents;
11169    /**
11170     * Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
11171     */
11172    bool result_ok;
11173 } LDKCResult_ClosingSignedDecodeErrorZ;
11174
11175
11176
11177 /**
11178  * The minimum and maximum fees which the sender is willing to place on the closing transaction.
11179  *
11180  * This is provided in [`ClosingSigned`] by both sides to indicate the fee range they are willing
11181  * to use.
11182  */
11183 typedef struct MUST_USE_STRUCT LDKClosingSignedFeeRange {
11184    /**
11185     * A pointer to the opaque Rust object.
11186     * Nearly everywhere, inner must be non-null, however in places where
11187     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11188     */
11189    LDKnativeClosingSignedFeeRange *inner;
11190    /**
11191     * Indicates that this is the only struct which contains the same pointer.
11192     * Rust functions which take ownership of an object provided via an argument require
11193     * this to be true and invalidate the object pointed to by inner.
11194     */
11195    bool is_owned;
11196 } LDKClosingSignedFeeRange;
11197
11198 /**
11199  * The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ
11200  */
11201 typedef union LDKCResult_ClosingSignedFeeRangeDecodeErrorZPtr {
11202    /**
11203     * A pointer to the contents in the success state.
11204     * Reading from this pointer when `result_ok` is not set is undefined.
11205     */
11206    struct LDKClosingSignedFeeRange *result;
11207    /**
11208     * A pointer to the contents in the error state.
11209     * Reading from this pointer when `result_ok` is set is undefined.
11210     */
11211    struct LDKDecodeError *err;
11212 } LDKCResult_ClosingSignedFeeRangeDecodeErrorZPtr;
11213
11214 /**
11215  * A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation,
11216  * containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
11217  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11218  */
11219 typedef struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ {
11220    /**
11221     * The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either
11222     * `err` or `result` depending on the state of `result_ok`.
11223     */
11224    union LDKCResult_ClosingSignedFeeRangeDecodeErrorZPtr contents;
11225    /**
11226     * Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state.
11227     */
11228    bool result_ok;
11229 } LDKCResult_ClosingSignedFeeRangeDecodeErrorZ;
11230
11231
11232
11233 /**
11234  * A [`commitment_signed`] message to be sent to or received from a peer.
11235  *
11236  * [`commitment_signed`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#committing-updates-so-far-commitment_signed
11237  */
11238 typedef struct MUST_USE_STRUCT LDKCommitmentSigned {
11239    /**
11240     * A pointer to the opaque Rust object.
11241     * Nearly everywhere, inner must be non-null, however in places where
11242     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11243     */
11244    LDKnativeCommitmentSigned *inner;
11245    /**
11246     * Indicates that this is the only struct which contains the same pointer.
11247     * Rust functions which take ownership of an object provided via an argument require
11248     * this to be true and invalidate the object pointed to by inner.
11249     */
11250    bool is_owned;
11251 } LDKCommitmentSigned;
11252
11253 /**
11254  * The contents of CResult_CommitmentSignedDecodeErrorZ
11255  */
11256 typedef union LDKCResult_CommitmentSignedDecodeErrorZPtr {
11257    /**
11258     * A pointer to the contents in the success state.
11259     * Reading from this pointer when `result_ok` is not set is undefined.
11260     */
11261    struct LDKCommitmentSigned *result;
11262    /**
11263     * A pointer to the contents in the error state.
11264     * Reading from this pointer when `result_ok` is set is undefined.
11265     */
11266    struct LDKDecodeError *err;
11267 } LDKCResult_CommitmentSignedDecodeErrorZPtr;
11268
11269 /**
11270  * A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
11271  * containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
11272  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11273  */
11274 typedef struct LDKCResult_CommitmentSignedDecodeErrorZ {
11275    /**
11276     * The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
11277     * `err` or `result` depending on the state of `result_ok`.
11278     */
11279    union LDKCResult_CommitmentSignedDecodeErrorZPtr contents;
11280    /**
11281     * Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
11282     */
11283    bool result_ok;
11284 } LDKCResult_CommitmentSignedDecodeErrorZ;
11285
11286 /**
11287  * The contents of CResult_FundingCreatedDecodeErrorZ
11288  */
11289 typedef union LDKCResult_FundingCreatedDecodeErrorZPtr {
11290    /**
11291     * A pointer to the contents in the success state.
11292     * Reading from this pointer when `result_ok` is not set is undefined.
11293     */
11294    struct LDKFundingCreated *result;
11295    /**
11296     * A pointer to the contents in the error state.
11297     * Reading from this pointer when `result_ok` is set is undefined.
11298     */
11299    struct LDKDecodeError *err;
11300 } LDKCResult_FundingCreatedDecodeErrorZPtr;
11301
11302 /**
11303  * A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
11304  * containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
11305  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11306  */
11307 typedef struct LDKCResult_FundingCreatedDecodeErrorZ {
11308    /**
11309     * The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
11310     * `err` or `result` depending on the state of `result_ok`.
11311     */
11312    union LDKCResult_FundingCreatedDecodeErrorZPtr contents;
11313    /**
11314     * Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
11315     */
11316    bool result_ok;
11317 } LDKCResult_FundingCreatedDecodeErrorZ;
11318
11319 /**
11320  * The contents of CResult_FundingSignedDecodeErrorZ
11321  */
11322 typedef union LDKCResult_FundingSignedDecodeErrorZPtr {
11323    /**
11324     * A pointer to the contents in the success state.
11325     * Reading from this pointer when `result_ok` is not set is undefined.
11326     */
11327    struct LDKFundingSigned *result;
11328    /**
11329     * A pointer to the contents in the error state.
11330     * Reading from this pointer when `result_ok` is set is undefined.
11331     */
11332    struct LDKDecodeError *err;
11333 } LDKCResult_FundingSignedDecodeErrorZPtr;
11334
11335 /**
11336  * A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
11337  * containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
11338  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11339  */
11340 typedef struct LDKCResult_FundingSignedDecodeErrorZ {
11341    /**
11342     * The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
11343     * `err` or `result` depending on the state of `result_ok`.
11344     */
11345    union LDKCResult_FundingSignedDecodeErrorZPtr contents;
11346    /**
11347     * Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
11348     */
11349    bool result_ok;
11350 } LDKCResult_FundingSignedDecodeErrorZ;
11351
11352 /**
11353  * The contents of CResult_ChannelReadyDecodeErrorZ
11354  */
11355 typedef union LDKCResult_ChannelReadyDecodeErrorZPtr {
11356    /**
11357     * A pointer to the contents in the success state.
11358     * Reading from this pointer when `result_ok` is not set is undefined.
11359     */
11360    struct LDKChannelReady *result;
11361    /**
11362     * A pointer to the contents in the error state.
11363     * Reading from this pointer when `result_ok` is set is undefined.
11364     */
11365    struct LDKDecodeError *err;
11366 } LDKCResult_ChannelReadyDecodeErrorZPtr;
11367
11368 /**
11369  * A CResult_ChannelReadyDecodeErrorZ represents the result of a fallible operation,
11370  * containing a crate::lightning::ln::msgs::ChannelReady on success and a crate::lightning::ln::msgs::DecodeError on failure.
11371  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11372  */
11373 typedef struct LDKCResult_ChannelReadyDecodeErrorZ {
11374    /**
11375     * The contents of this CResult_ChannelReadyDecodeErrorZ, accessible via either
11376     * `err` or `result` depending on the state of `result_ok`.
11377     */
11378    union LDKCResult_ChannelReadyDecodeErrorZPtr contents;
11379    /**
11380     * Whether this CResult_ChannelReadyDecodeErrorZ represents a success state.
11381     */
11382    bool result_ok;
11383 } LDKCResult_ChannelReadyDecodeErrorZ;
11384
11385
11386
11387 /**
11388  * An [`init`] message to be sent to or received from a peer.
11389  *
11390  * [`init`]: https://github.com/lightning/bolts/blob/master/01-messaging.md#the-init-message
11391  */
11392 typedef struct MUST_USE_STRUCT LDKInit {
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    LDKnativeInit *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 } LDKInit;
11406
11407 /**
11408  * The contents of CResult_InitDecodeErrorZ
11409  */
11410 typedef union LDKCResult_InitDecodeErrorZPtr {
11411    /**
11412     * A pointer to the contents in the success state.
11413     * Reading from this pointer when `result_ok` is not set is undefined.
11414     */
11415    struct LDKInit *result;
11416    /**
11417     * A pointer to the contents in the error state.
11418     * Reading from this pointer when `result_ok` is set is undefined.
11419     */
11420    struct LDKDecodeError *err;
11421 } LDKCResult_InitDecodeErrorZPtr;
11422
11423 /**
11424  * A CResult_InitDecodeErrorZ represents the result of a fallible operation,
11425  * containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
11426  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11427  */
11428 typedef struct LDKCResult_InitDecodeErrorZ {
11429    /**
11430     * The contents of this CResult_InitDecodeErrorZ, accessible via either
11431     * `err` or `result` depending on the state of `result_ok`.
11432     */
11433    union LDKCResult_InitDecodeErrorZPtr contents;
11434    /**
11435     * Whether this CResult_InitDecodeErrorZ represents a success state.
11436     */
11437    bool result_ok;
11438 } LDKCResult_InitDecodeErrorZ;
11439
11440 /**
11441  * The contents of CResult_OpenChannelDecodeErrorZ
11442  */
11443 typedef union LDKCResult_OpenChannelDecodeErrorZPtr {
11444    /**
11445     * A pointer to the contents in the success state.
11446     * Reading from this pointer when `result_ok` is not set is undefined.
11447     */
11448    struct LDKOpenChannel *result;
11449    /**
11450     * A pointer to the contents in the error state.
11451     * Reading from this pointer when `result_ok` is set is undefined.
11452     */
11453    struct LDKDecodeError *err;
11454 } LDKCResult_OpenChannelDecodeErrorZPtr;
11455
11456 /**
11457  * A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
11458  * containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
11459  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11460  */
11461 typedef struct LDKCResult_OpenChannelDecodeErrorZ {
11462    /**
11463     * The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
11464     * `err` or `result` depending on the state of `result_ok`.
11465     */
11466    union LDKCResult_OpenChannelDecodeErrorZPtr contents;
11467    /**
11468     * Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
11469     */
11470    bool result_ok;
11471 } LDKCResult_OpenChannelDecodeErrorZ;
11472
11473 /**
11474  * The contents of CResult_OpenChannelV2DecodeErrorZ
11475  */
11476 typedef union LDKCResult_OpenChannelV2DecodeErrorZPtr {
11477    /**
11478     * A pointer to the contents in the success state.
11479     * Reading from this pointer when `result_ok` is not set is undefined.
11480     */
11481    struct LDKOpenChannelV2 *result;
11482    /**
11483     * A pointer to the contents in the error state.
11484     * Reading from this pointer when `result_ok` is set is undefined.
11485     */
11486    struct LDKDecodeError *err;
11487 } LDKCResult_OpenChannelV2DecodeErrorZPtr;
11488
11489 /**
11490  * A CResult_OpenChannelV2DecodeErrorZ represents the result of a fallible operation,
11491  * containing a crate::lightning::ln::msgs::OpenChannelV2 on success and a crate::lightning::ln::msgs::DecodeError on failure.
11492  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11493  */
11494 typedef struct LDKCResult_OpenChannelV2DecodeErrorZ {
11495    /**
11496     * The contents of this CResult_OpenChannelV2DecodeErrorZ, accessible via either
11497     * `err` or `result` depending on the state of `result_ok`.
11498     */
11499    union LDKCResult_OpenChannelV2DecodeErrorZPtr contents;
11500    /**
11501     * Whether this CResult_OpenChannelV2DecodeErrorZ represents a success state.
11502     */
11503    bool result_ok;
11504 } LDKCResult_OpenChannelV2DecodeErrorZ;
11505
11506 /**
11507  * The contents of CResult_RevokeAndACKDecodeErrorZ
11508  */
11509 typedef union LDKCResult_RevokeAndACKDecodeErrorZPtr {
11510    /**
11511     * A pointer to the contents in the success state.
11512     * Reading from this pointer when `result_ok` is not set is undefined.
11513     */
11514    struct LDKRevokeAndACK *result;
11515    /**
11516     * A pointer to the contents in the error state.
11517     * Reading from this pointer when `result_ok` is set is undefined.
11518     */
11519    struct LDKDecodeError *err;
11520 } LDKCResult_RevokeAndACKDecodeErrorZPtr;
11521
11522 /**
11523  * A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
11524  * containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
11525  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11526  */
11527 typedef struct LDKCResult_RevokeAndACKDecodeErrorZ {
11528    /**
11529     * The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
11530     * `err` or `result` depending on the state of `result_ok`.
11531     */
11532    union LDKCResult_RevokeAndACKDecodeErrorZPtr contents;
11533    /**
11534     * Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
11535     */
11536    bool result_ok;
11537 } LDKCResult_RevokeAndACKDecodeErrorZ;
11538
11539 /**
11540  * The contents of CResult_ShutdownDecodeErrorZ
11541  */
11542 typedef union LDKCResult_ShutdownDecodeErrorZPtr {
11543    /**
11544     * A pointer to the contents in the success state.
11545     * Reading from this pointer when `result_ok` is not set is undefined.
11546     */
11547    struct LDKShutdown *result;
11548    /**
11549     * A pointer to the contents in the error state.
11550     * Reading from this pointer when `result_ok` is set is undefined.
11551     */
11552    struct LDKDecodeError *err;
11553 } LDKCResult_ShutdownDecodeErrorZPtr;
11554
11555 /**
11556  * A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
11557  * containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
11558  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11559  */
11560 typedef struct LDKCResult_ShutdownDecodeErrorZ {
11561    /**
11562     * The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
11563     * `err` or `result` depending on the state of `result_ok`.
11564     */
11565    union LDKCResult_ShutdownDecodeErrorZPtr contents;
11566    /**
11567     * Whether this CResult_ShutdownDecodeErrorZ represents a success state.
11568     */
11569    bool result_ok;
11570 } LDKCResult_ShutdownDecodeErrorZ;
11571
11572 /**
11573  * The contents of CResult_UpdateFailHTLCDecodeErrorZ
11574  */
11575 typedef union LDKCResult_UpdateFailHTLCDecodeErrorZPtr {
11576    /**
11577     * A pointer to the contents in the success state.
11578     * Reading from this pointer when `result_ok` is not set is undefined.
11579     */
11580    struct LDKUpdateFailHTLC *result;
11581    /**
11582     * A pointer to the contents in the error state.
11583     * Reading from this pointer when `result_ok` is set is undefined.
11584     */
11585    struct LDKDecodeError *err;
11586 } LDKCResult_UpdateFailHTLCDecodeErrorZPtr;
11587
11588 /**
11589  * A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
11590  * containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
11591  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11592  */
11593 typedef struct LDKCResult_UpdateFailHTLCDecodeErrorZ {
11594    /**
11595     * The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
11596     * `err` or `result` depending on the state of `result_ok`.
11597     */
11598    union LDKCResult_UpdateFailHTLCDecodeErrorZPtr contents;
11599    /**
11600     * Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
11601     */
11602    bool result_ok;
11603 } LDKCResult_UpdateFailHTLCDecodeErrorZ;
11604
11605 /**
11606  * The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
11607  */
11608 typedef union LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
11609    /**
11610     * A pointer to the contents in the success state.
11611     * Reading from this pointer when `result_ok` is not set is undefined.
11612     */
11613    struct LDKUpdateFailMalformedHTLC *result;
11614    /**
11615     * A pointer to the contents in the error state.
11616     * Reading from this pointer when `result_ok` is set is undefined.
11617     */
11618    struct LDKDecodeError *err;
11619 } LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr;
11620
11621 /**
11622  * A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
11623  * containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
11624  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11625  */
11626 typedef struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ {
11627    /**
11628     * The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
11629     * `err` or `result` depending on the state of `result_ok`.
11630     */
11631    union LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr contents;
11632    /**
11633     * Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
11634     */
11635    bool result_ok;
11636 } LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ;
11637
11638
11639
11640 /**
11641  * An [`update_fee`] message to be sent to or received from a peer
11642  *
11643  * [`update_fee`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#updating-fees-update_fee
11644  */
11645 typedef struct MUST_USE_STRUCT LDKUpdateFee {
11646    /**
11647     * A pointer to the opaque Rust object.
11648     * Nearly everywhere, inner must be non-null, however in places where
11649     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11650     */
11651    LDKnativeUpdateFee *inner;
11652    /**
11653     * Indicates that this is the only struct which contains the same pointer.
11654     * Rust functions which take ownership of an object provided via an argument require
11655     * this to be true and invalidate the object pointed to by inner.
11656     */
11657    bool is_owned;
11658 } LDKUpdateFee;
11659
11660 /**
11661  * The contents of CResult_UpdateFeeDecodeErrorZ
11662  */
11663 typedef union LDKCResult_UpdateFeeDecodeErrorZPtr {
11664    /**
11665     * A pointer to the contents in the success state.
11666     * Reading from this pointer when `result_ok` is not set is undefined.
11667     */
11668    struct LDKUpdateFee *result;
11669    /**
11670     * A pointer to the contents in the error state.
11671     * Reading from this pointer when `result_ok` is set is undefined.
11672     */
11673    struct LDKDecodeError *err;
11674 } LDKCResult_UpdateFeeDecodeErrorZPtr;
11675
11676 /**
11677  * A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
11678  * containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
11679  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11680  */
11681 typedef struct LDKCResult_UpdateFeeDecodeErrorZ {
11682    /**
11683     * The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
11684     * `err` or `result` depending on the state of `result_ok`.
11685     */
11686    union LDKCResult_UpdateFeeDecodeErrorZPtr contents;
11687    /**
11688     * Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
11689     */
11690    bool result_ok;
11691 } LDKCResult_UpdateFeeDecodeErrorZ;
11692
11693 /**
11694  * The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
11695  */
11696 typedef union LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr {
11697    /**
11698     * A pointer to the contents in the success state.
11699     * Reading from this pointer when `result_ok` is not set is undefined.
11700     */
11701    struct LDKUpdateFulfillHTLC *result;
11702    /**
11703     * A pointer to the contents in the error state.
11704     * Reading from this pointer when `result_ok` is set is undefined.
11705     */
11706    struct LDKDecodeError *err;
11707 } LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr;
11708
11709 /**
11710  * A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
11711  * containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
11712  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11713  */
11714 typedef struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ {
11715    /**
11716     * The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
11717     * `err` or `result` depending on the state of `result_ok`.
11718     */
11719    union LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr contents;
11720    /**
11721     * Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
11722     */
11723    bool result_ok;
11724 } LDKCResult_UpdateFulfillHTLCDecodeErrorZ;
11725
11726 /**
11727  * The contents of CResult_UpdateAddHTLCDecodeErrorZ
11728  */
11729 typedef union LDKCResult_UpdateAddHTLCDecodeErrorZPtr {
11730    /**
11731     * A pointer to the contents in the success state.
11732     * Reading from this pointer when `result_ok` is not set is undefined.
11733     */
11734    struct LDKUpdateAddHTLC *result;
11735    /**
11736     * A pointer to the contents in the error state.
11737     * Reading from this pointer when `result_ok` is set is undefined.
11738     */
11739    struct LDKDecodeError *err;
11740 } LDKCResult_UpdateAddHTLCDecodeErrorZPtr;
11741
11742 /**
11743  * A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
11744  * containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
11745  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11746  */
11747 typedef struct LDKCResult_UpdateAddHTLCDecodeErrorZ {
11748    /**
11749     * The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
11750     * `err` or `result` depending on the state of `result_ok`.
11751     */
11752    union LDKCResult_UpdateAddHTLCDecodeErrorZPtr contents;
11753    /**
11754     * Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
11755     */
11756    bool result_ok;
11757 } LDKCResult_UpdateAddHTLCDecodeErrorZ;
11758
11759
11760
11761 /**
11762  * An onion message to be sent to or received from a peer.
11763  *
11764  */
11765 typedef struct MUST_USE_STRUCT LDKOnionMessage {
11766    /**
11767     * A pointer to the opaque Rust object.
11768     * Nearly everywhere, inner must be non-null, however in places where
11769     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11770     */
11771    LDKnativeOnionMessage *inner;
11772    /**
11773     * Indicates that this is the only struct which contains the same pointer.
11774     * Rust functions which take ownership of an object provided via an argument require
11775     * this to be true and invalidate the object pointed to by inner.
11776     */
11777    bool is_owned;
11778 } LDKOnionMessage;
11779
11780 /**
11781  * The contents of CResult_OnionMessageDecodeErrorZ
11782  */
11783 typedef union LDKCResult_OnionMessageDecodeErrorZPtr {
11784    /**
11785     * A pointer to the contents in the success state.
11786     * Reading from this pointer when `result_ok` is not set is undefined.
11787     */
11788    struct LDKOnionMessage *result;
11789    /**
11790     * A pointer to the contents in the error state.
11791     * Reading from this pointer when `result_ok` is set is undefined.
11792     */
11793    struct LDKDecodeError *err;
11794 } LDKCResult_OnionMessageDecodeErrorZPtr;
11795
11796 /**
11797  * A CResult_OnionMessageDecodeErrorZ represents the result of a fallible operation,
11798  * containing a crate::lightning::ln::msgs::OnionMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
11799  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11800  */
11801 typedef struct LDKCResult_OnionMessageDecodeErrorZ {
11802    /**
11803     * The contents of this CResult_OnionMessageDecodeErrorZ, accessible via either
11804     * `err` or `result` depending on the state of `result_ok`.
11805     */
11806    union LDKCResult_OnionMessageDecodeErrorZPtr contents;
11807    /**
11808     * Whether this CResult_OnionMessageDecodeErrorZ represents a success state.
11809     */
11810    bool result_ok;
11811 } LDKCResult_OnionMessageDecodeErrorZ;
11812
11813
11814
11815 /**
11816  * A [`ping`] message to be sent to or received from a peer.
11817  *
11818  * [`ping`]: https://github.com/lightning/bolts/blob/master/01-messaging.md#the-ping-and-pong-messages
11819  */
11820 typedef struct MUST_USE_STRUCT LDKPing {
11821    /**
11822     * A pointer to the opaque Rust object.
11823     * Nearly everywhere, inner must be non-null, however in places where
11824     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11825     */
11826    LDKnativePing *inner;
11827    /**
11828     * Indicates that this is the only struct which contains the same pointer.
11829     * Rust functions which take ownership of an object provided via an argument require
11830     * this to be true and invalidate the object pointed to by inner.
11831     */
11832    bool is_owned;
11833 } LDKPing;
11834
11835 /**
11836  * The contents of CResult_PingDecodeErrorZ
11837  */
11838 typedef union LDKCResult_PingDecodeErrorZPtr {
11839    /**
11840     * A pointer to the contents in the success state.
11841     * Reading from this pointer when `result_ok` is not set is undefined.
11842     */
11843    struct LDKPing *result;
11844    /**
11845     * A pointer to the contents in the error state.
11846     * Reading from this pointer when `result_ok` is set is undefined.
11847     */
11848    struct LDKDecodeError *err;
11849 } LDKCResult_PingDecodeErrorZPtr;
11850
11851 /**
11852  * A CResult_PingDecodeErrorZ represents the result of a fallible operation,
11853  * containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
11854  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11855  */
11856 typedef struct LDKCResult_PingDecodeErrorZ {
11857    /**
11858     * The contents of this CResult_PingDecodeErrorZ, accessible via either
11859     * `err` or `result` depending on the state of `result_ok`.
11860     */
11861    union LDKCResult_PingDecodeErrorZPtr contents;
11862    /**
11863     * Whether this CResult_PingDecodeErrorZ represents a success state.
11864     */
11865    bool result_ok;
11866 } LDKCResult_PingDecodeErrorZ;
11867
11868
11869
11870 /**
11871  * A [`pong`] message to be sent to or received from a peer.
11872  *
11873  * [`pong`]: https://github.com/lightning/bolts/blob/master/01-messaging.md#the-ping-and-pong-messages
11874  */
11875 typedef struct MUST_USE_STRUCT LDKPong {
11876    /**
11877     * A pointer to the opaque Rust object.
11878     * Nearly everywhere, inner must be non-null, however in places where
11879     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11880     */
11881    LDKnativePong *inner;
11882    /**
11883     * Indicates that this is the only struct which contains the same pointer.
11884     * Rust functions which take ownership of an object provided via an argument require
11885     * this to be true and invalidate the object pointed to by inner.
11886     */
11887    bool is_owned;
11888 } LDKPong;
11889
11890 /**
11891  * The contents of CResult_PongDecodeErrorZ
11892  */
11893 typedef union LDKCResult_PongDecodeErrorZPtr {
11894    /**
11895     * A pointer to the contents in the success state.
11896     * Reading from this pointer when `result_ok` is not set is undefined.
11897     */
11898    struct LDKPong *result;
11899    /**
11900     * A pointer to the contents in the error state.
11901     * Reading from this pointer when `result_ok` is set is undefined.
11902     */
11903    struct LDKDecodeError *err;
11904 } LDKCResult_PongDecodeErrorZPtr;
11905
11906 /**
11907  * A CResult_PongDecodeErrorZ represents the result of a fallible operation,
11908  * containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
11909  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11910  */
11911 typedef struct LDKCResult_PongDecodeErrorZ {
11912    /**
11913     * The contents of this CResult_PongDecodeErrorZ, accessible via either
11914     * `err` or `result` depending on the state of `result_ok`.
11915     */
11916    union LDKCResult_PongDecodeErrorZPtr contents;
11917    /**
11918     * Whether this CResult_PongDecodeErrorZ represents a success state.
11919     */
11920    bool result_ok;
11921 } LDKCResult_PongDecodeErrorZ;
11922
11923 /**
11924  * The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
11925  */
11926 typedef union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
11927    /**
11928     * A pointer to the contents in the success state.
11929     * Reading from this pointer when `result_ok` is not set is undefined.
11930     */
11931    struct LDKUnsignedChannelAnnouncement *result;
11932    /**
11933     * A pointer to the contents in the error state.
11934     * Reading from this pointer when `result_ok` is set is undefined.
11935     */
11936    struct LDKDecodeError *err;
11937 } LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr;
11938
11939 /**
11940  * A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
11941  * containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
11942  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11943  */
11944 typedef struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ {
11945    /**
11946     * The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
11947     * `err` or `result` depending on the state of `result_ok`.
11948     */
11949    union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr contents;
11950    /**
11951     * Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
11952     */
11953    bool result_ok;
11954 } LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ;
11955
11956 /**
11957  * The contents of CResult_ChannelAnnouncementDecodeErrorZ
11958  */
11959 typedef union LDKCResult_ChannelAnnouncementDecodeErrorZPtr {
11960    /**
11961     * A pointer to the contents in the success state.
11962     * Reading from this pointer when `result_ok` is not set is undefined.
11963     */
11964    struct LDKChannelAnnouncement *result;
11965    /**
11966     * A pointer to the contents in the error state.
11967     * Reading from this pointer when `result_ok` is set is undefined.
11968     */
11969    struct LDKDecodeError *err;
11970 } LDKCResult_ChannelAnnouncementDecodeErrorZPtr;
11971
11972 /**
11973  * A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
11974  * containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
11975  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11976  */
11977 typedef struct LDKCResult_ChannelAnnouncementDecodeErrorZ {
11978    /**
11979     * The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
11980     * `err` or `result` depending on the state of `result_ok`.
11981     */
11982    union LDKCResult_ChannelAnnouncementDecodeErrorZPtr contents;
11983    /**
11984     * Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
11985     */
11986    bool result_ok;
11987 } LDKCResult_ChannelAnnouncementDecodeErrorZ;
11988
11989 /**
11990  * The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
11991  */
11992 typedef union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr {
11993    /**
11994     * A pointer to the contents in the success state.
11995     * Reading from this pointer when `result_ok` is not set is undefined.
11996     */
11997    struct LDKUnsignedChannelUpdate *result;
11998    /**
11999     * A pointer to the contents in the error state.
12000     * Reading from this pointer when `result_ok` is set is undefined.
12001     */
12002    struct LDKDecodeError *err;
12003 } LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr;
12004
12005 /**
12006  * A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
12007  * containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
12008  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
12009  */
12010 typedef struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ {
12011    /**
12012     * The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
12013     * `err` or `result` depending on the state of `result_ok`.
12014     */
12015    union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr contents;
12016    /**
12017     * Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
12018     */
12019    bool result_ok;
12020 } LDKCResult_UnsignedChannelUpdateDecodeErrorZ;
12021
12022 /**
12023  * The contents of CResult_ChannelUpdateDecodeErrorZ
12024  */
12025 typedef union LDKCResult_ChannelUpdateDecodeErrorZPtr {
12026    /**
12027     * A pointer to the contents in the success state.
12028     * Reading from this pointer when `result_ok` is not set is undefined.
12029     */
12030    struct LDKChannelUpdate *result;
12031    /**
12032     * A pointer to the contents in the error state.
12033     * Reading from this pointer when `result_ok` is set is undefined.
12034     */
12035    struct LDKDecodeError *err;
12036 } LDKCResult_ChannelUpdateDecodeErrorZPtr;
12037
12038 /**
12039  * A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
12040  * containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
12041  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
12042  */
12043 typedef struct LDKCResult_ChannelUpdateDecodeErrorZ {
12044    /**
12045     * The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
12046     * `err` or `result` depending on the state of `result_ok`.
12047     */
12048    union LDKCResult_ChannelUpdateDecodeErrorZPtr contents;
12049    /**
12050     * Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
12051     */
12052    bool result_ok;
12053 } LDKCResult_ChannelUpdateDecodeErrorZ;
12054
12055 /**
12056  * The contents of CResult_ErrorMessageDecodeErrorZ
12057  */
12058 typedef union LDKCResult_ErrorMessageDecodeErrorZPtr {
12059    /**
12060     * A pointer to the contents in the success state.
12061     * Reading from this pointer when `result_ok` is not set is undefined.
12062     */
12063    struct LDKErrorMessage *result;
12064    /**
12065     * A pointer to the contents in the error state.
12066     * Reading from this pointer when `result_ok` is set is undefined.
12067     */
12068    struct LDKDecodeError *err;
12069 } LDKCResult_ErrorMessageDecodeErrorZPtr;
12070
12071 /**
12072  * A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
12073  * containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
12074  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
12075  */
12076 typedef struct LDKCResult_ErrorMessageDecodeErrorZ {
12077    /**
12078     * The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
12079     * `err` or `result` depending on the state of `result_ok`.
12080     */
12081    union LDKCResult_ErrorMessageDecodeErrorZPtr contents;
12082    /**
12083     * Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
12084     */
12085    bool result_ok;
12086 } LDKCResult_ErrorMessageDecodeErrorZ;
12087
12088 /**
12089  * The contents of CResult_WarningMessageDecodeErrorZ
12090  */
12091 typedef union LDKCResult_WarningMessageDecodeErrorZPtr {
12092    /**
12093     * A pointer to the contents in the success state.
12094     * Reading from this pointer when `result_ok` is not set is undefined.
12095     */
12096    struct LDKWarningMessage *result;
12097    /**
12098     * A pointer to the contents in the error state.
12099     * Reading from this pointer when `result_ok` is set is undefined.
12100     */
12101    struct LDKDecodeError *err;
12102 } LDKCResult_WarningMessageDecodeErrorZPtr;
12103
12104 /**
12105  * A CResult_WarningMessageDecodeErrorZ represents the result of a fallible operation,
12106  * containing a crate::lightning::ln::msgs::WarningMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
12107  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
12108  */
12109 typedef struct LDKCResult_WarningMessageDecodeErrorZ {
12110    /**
12111     * The contents of this CResult_WarningMessageDecodeErrorZ, accessible via either
12112     * `err` or `result` depending on the state of `result_ok`.
12113     */
12114    union LDKCResult_WarningMessageDecodeErrorZPtr contents;
12115    /**
12116     * Whether this CResult_WarningMessageDecodeErrorZ represents a success state.
12117     */
12118    bool result_ok;
12119 } LDKCResult_WarningMessageDecodeErrorZ;
12120
12121 /**
12122  * The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
12123  */
12124 typedef union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
12125    /**
12126     * A pointer to the contents in the success state.
12127     * Reading from this pointer when `result_ok` is not set is undefined.
12128     */
12129    struct LDKUnsignedNodeAnnouncement *result;
12130    /**
12131     * A pointer to the contents in the error state.
12132     * Reading from this pointer when `result_ok` is set is undefined.
12133     */
12134    struct LDKDecodeError *err;
12135 } LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr;
12136
12137 /**
12138  * A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
12139  * containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
12140  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
12141  */
12142 typedef struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ {
12143    /**
12144     * The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
12145     * `err` or `result` depending on the state of `result_ok`.
12146     */
12147    union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr contents;
12148    /**
12149     * Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
12150     */
12151    bool result_ok;
12152 } LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ;
12153
12154 /**
12155  * The contents of CResult_NodeAnnouncementDecodeErrorZ
12156  */
12157 typedef union LDKCResult_NodeAnnouncementDecodeErrorZPtr {
12158    /**
12159     * A pointer to the contents in the success state.
12160     * Reading from this pointer when `result_ok` is not set is undefined.
12161     */
12162    struct LDKNodeAnnouncement *result;
12163    /**
12164     * A pointer to the contents in the error state.
12165     * Reading from this pointer when `result_ok` is set is undefined.
12166     */
12167    struct LDKDecodeError *err;
12168 } LDKCResult_NodeAnnouncementDecodeErrorZPtr;
12169
12170 /**
12171  * A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
12172  * containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
12173  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
12174  */
12175 typedef struct LDKCResult_NodeAnnouncementDecodeErrorZ {
12176    /**
12177     * The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
12178     * `err` or `result` depending on the state of `result_ok`.
12179     */
12180    union LDKCResult_NodeAnnouncementDecodeErrorZPtr contents;
12181    /**
12182     * Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
12183     */
12184    bool result_ok;
12185 } LDKCResult_NodeAnnouncementDecodeErrorZ;
12186
12187 /**
12188  * The contents of CResult_QueryShortChannelIdsDecodeErrorZ
12189  */
12190 typedef union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr {
12191    /**
12192     * A pointer to the contents in the success state.
12193     * Reading from this pointer when `result_ok` is not set is undefined.
12194     */
12195    struct LDKQueryShortChannelIds *result;
12196    /**
12197     * A pointer to the contents in the error state.
12198     * Reading from this pointer when `result_ok` is set is undefined.
12199     */
12200    struct LDKDecodeError *err;
12201 } LDKCResult_QueryShortChannelIdsDecodeErrorZPtr;
12202
12203 /**
12204  * A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
12205  * containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
12206  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
12207  */
12208 typedef struct LDKCResult_QueryShortChannelIdsDecodeErrorZ {
12209    /**
12210     * The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
12211     * `err` or `result` depending on the state of `result_ok`.
12212     */
12213    union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr contents;
12214    /**
12215     * Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
12216     */
12217    bool result_ok;
12218 } LDKCResult_QueryShortChannelIdsDecodeErrorZ;
12219
12220
12221
12222 /**
12223  * A [`reply_short_channel_ids_end`] message is sent as a reply to a
12224  * message. The query recipient makes a best
12225  * effort to respond based on their local network view which may not be
12226  * a perfect view of the network.
12227  *
12228  * [`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
12229  */
12230 typedef struct MUST_USE_STRUCT LDKReplyShortChannelIdsEnd {
12231    /**
12232     * A pointer to the opaque Rust object.
12233     * Nearly everywhere, inner must be non-null, however in places where
12234     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12235     */
12236    LDKnativeReplyShortChannelIdsEnd *inner;
12237    /**
12238     * Indicates that this is the only struct which contains the same pointer.
12239     * Rust functions which take ownership of an object provided via an argument require
12240     * this to be true and invalidate the object pointed to by inner.
12241     */
12242    bool is_owned;
12243 } LDKReplyShortChannelIdsEnd;
12244
12245 /**
12246  * The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
12247  */
12248 typedef union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
12249    /**
12250     * A pointer to the contents in the success state.
12251     * Reading from this pointer when `result_ok` is not set is undefined.
12252     */
12253    struct LDKReplyShortChannelIdsEnd *result;
12254    /**
12255     * A pointer to the contents in the error state.
12256     * Reading from this pointer when `result_ok` is set is undefined.
12257     */
12258    struct LDKDecodeError *err;
12259 } LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr;
12260
12261 /**
12262  * A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
12263  * containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
12264  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
12265  */
12266 typedef struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ {
12267    /**
12268     * The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
12269     * `err` or `result` depending on the state of `result_ok`.
12270     */
12271    union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr contents;
12272    /**
12273     * Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
12274     */
12275    bool result_ok;
12276 } LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ;
12277
12278 /**
12279  * The contents of CResult_QueryChannelRangeDecodeErrorZ
12280  */
12281 typedef union LDKCResult_QueryChannelRangeDecodeErrorZPtr {
12282    /**
12283     * A pointer to the contents in the success state.
12284     * Reading from this pointer when `result_ok` is not set is undefined.
12285     */
12286    struct LDKQueryChannelRange *result;
12287    /**
12288     * A pointer to the contents in the error state.
12289     * Reading from this pointer when `result_ok` is set is undefined.
12290     */
12291    struct LDKDecodeError *err;
12292 } LDKCResult_QueryChannelRangeDecodeErrorZPtr;
12293
12294 /**
12295  * A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
12296  * containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
12297  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
12298  */
12299 typedef struct LDKCResult_QueryChannelRangeDecodeErrorZ {
12300    /**
12301     * The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
12302     * `err` or `result` depending on the state of `result_ok`.
12303     */
12304    union LDKCResult_QueryChannelRangeDecodeErrorZPtr contents;
12305    /**
12306     * Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
12307     */
12308    bool result_ok;
12309 } LDKCResult_QueryChannelRangeDecodeErrorZ;
12310
12311 /**
12312  * The contents of CResult_ReplyChannelRangeDecodeErrorZ
12313  */
12314 typedef union LDKCResult_ReplyChannelRangeDecodeErrorZPtr {
12315    /**
12316     * A pointer to the contents in the success state.
12317     * Reading from this pointer when `result_ok` is not set is undefined.
12318     */
12319    struct LDKReplyChannelRange *result;
12320    /**
12321     * A pointer to the contents in the error state.
12322     * Reading from this pointer when `result_ok` is set is undefined.
12323     */
12324    struct LDKDecodeError *err;
12325 } LDKCResult_ReplyChannelRangeDecodeErrorZPtr;
12326
12327 /**
12328  * A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
12329  * containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
12330  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
12331  */
12332 typedef struct LDKCResult_ReplyChannelRangeDecodeErrorZ {
12333    /**
12334     * The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
12335     * `err` or `result` depending on the state of `result_ok`.
12336     */
12337    union LDKCResult_ReplyChannelRangeDecodeErrorZPtr contents;
12338    /**
12339     * Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
12340     */
12341    bool result_ok;
12342 } LDKCResult_ReplyChannelRangeDecodeErrorZ;
12343
12344 /**
12345  * The contents of CResult_GossipTimestampFilterDecodeErrorZ
12346  */
12347 typedef union LDKCResult_GossipTimestampFilterDecodeErrorZPtr {
12348    /**
12349     * A pointer to the contents in the success state.
12350     * Reading from this pointer when `result_ok` is not set is undefined.
12351     */
12352    struct LDKGossipTimestampFilter *result;
12353    /**
12354     * A pointer to the contents in the error state.
12355     * Reading from this pointer when `result_ok` is set is undefined.
12356     */
12357    struct LDKDecodeError *err;
12358 } LDKCResult_GossipTimestampFilterDecodeErrorZPtr;
12359
12360 /**
12361  * A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
12362  * containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
12363  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
12364  */
12365 typedef struct LDKCResult_GossipTimestampFilterDecodeErrorZ {
12366    /**
12367     * The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
12368     * `err` or `result` depending on the state of `result_ok`.
12369     */
12370    union LDKCResult_GossipTimestampFilterDecodeErrorZPtr contents;
12371    /**
12372     * Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
12373     */
12374    bool result_ok;
12375 } LDKCResult_GossipTimestampFilterDecodeErrorZ;
12376
12377 /**
12378  * A dynamically-allocated array of crate::lightning::ln::channelmanager::PhantomRouteHintss of arbitrary size.
12379  * This corresponds to std::vector in C++
12380  */
12381 typedef struct LDKCVec_PhantomRouteHintsZ {
12382    /**
12383     * The elements in the array.
12384     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12385     */
12386    struct LDKPhantomRouteHints *data;
12387    /**
12388     * The number of elements pointed to by `data`.
12389     */
12390    uintptr_t datalen;
12391 } LDKCVec_PhantomRouteHintsZ;
12392
12393
12394
12395 /**
12396  * Represents a syntactically and semantically correct lightning BOLT11 invoice.
12397  *
12398  * There are three ways to construct a `Bolt11Invoice`:
12399  *  1. using [`InvoiceBuilder`]
12400  *  2. using [`Bolt11Invoice::from_signed`]
12401  *  3. using `str::parse::<Bolt11Invoice>(&str)` (see [`Bolt11Invoice::from_str`])
12402  *
12403  * [`Bolt11Invoice::from_str`]: crate::Bolt11Invoice#impl-FromStr
12404  */
12405 typedef struct MUST_USE_STRUCT LDKBolt11Invoice {
12406    /**
12407     * A pointer to the opaque Rust object.
12408     * Nearly everywhere, inner must be non-null, however in places where
12409     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12410     */
12411    LDKnativeBolt11Invoice *inner;
12412    /**
12413     * Indicates that this is the only struct which contains the same pointer.
12414     * Rust functions which take ownership of an object provided via an argument require
12415     * this to be true and invalidate the object pointed to by inner.
12416     */
12417    bool is_owned;
12418 } LDKBolt11Invoice;
12419
12420 /**
12421  * When signing using a fallible method either an user-supplied `SignError` or a [`CreationError`]
12422  * may occur.
12423  */
12424 typedef enum LDKSignOrCreationError_Tag {
12425    /**
12426     * An error occurred during signing
12427     */
12428    LDKSignOrCreationError_SignError,
12429    /**
12430     * An error occurred while building the transaction
12431     */
12432    LDKSignOrCreationError_CreationError,
12433    /**
12434     * Must be last for serialization purposes
12435     */
12436    LDKSignOrCreationError_Sentinel,
12437 } LDKSignOrCreationError_Tag;
12438
12439 typedef struct MUST_USE_STRUCT LDKSignOrCreationError {
12440    LDKSignOrCreationError_Tag tag;
12441    union {
12442       struct {
12443          enum LDKCreationError creation_error;
12444       };
12445    };
12446 } LDKSignOrCreationError;
12447
12448 /**
12449  * The contents of CResult_Bolt11InvoiceSignOrCreationErrorZ
12450  */
12451 typedef union LDKCResult_Bolt11InvoiceSignOrCreationErrorZPtr {
12452    /**
12453     * A pointer to the contents in the success state.
12454     * Reading from this pointer when `result_ok` is not set is undefined.
12455     */
12456    struct LDKBolt11Invoice *result;
12457    /**
12458     * A pointer to the contents in the error state.
12459     * Reading from this pointer when `result_ok` is set is undefined.
12460     */
12461    struct LDKSignOrCreationError *err;
12462 } LDKCResult_Bolt11InvoiceSignOrCreationErrorZPtr;
12463
12464 /**
12465  * A CResult_Bolt11InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
12466  * containing a crate::lightning_invoice::Bolt11Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
12467  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
12468  */
12469 typedef struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ {
12470    /**
12471     * The contents of this CResult_Bolt11InvoiceSignOrCreationErrorZ, accessible via either
12472     * `err` or `result` depending on the state of `result_ok`.
12473     */
12474    union LDKCResult_Bolt11InvoiceSignOrCreationErrorZPtr contents;
12475    /**
12476     * Whether this CResult_Bolt11InvoiceSignOrCreationErrorZ represents a success state.
12477     */
12478    bool result_ok;
12479 } LDKCResult_Bolt11InvoiceSignOrCreationErrorZ;
12480
12481
12482
12483 /**
12484  * A simple future which can complete once, and calls some callback(s) when it does so.
12485  *
12486  * Clones can be made and all futures cloned from the same source will complete at the same time.
12487  */
12488 typedef struct MUST_USE_STRUCT LDKFuture {
12489    /**
12490     * A pointer to the opaque Rust object.
12491     * Nearly everywhere, inner must be non-null, however in places where
12492     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12493     */
12494    LDKnativeFuture *inner;
12495    /**
12496     * Indicates that this is the only struct which contains the same pointer.
12497     * Rust functions which take ownership of an object provided via an argument require
12498     * this to be true and invalidate the object pointed to by inner.
12499     */
12500    bool is_owned;
12501 } LDKFuture;
12502
12503 /**
12504  * A dynamically-allocated array of crate::lightning::util::wakers::Futures of arbitrary size.
12505  * This corresponds to std::vector in C++
12506  */
12507 typedef struct LDKCVec_FutureZ {
12508    /**
12509     * The elements in the array.
12510     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12511     */
12512    struct LDKFuture *data;
12513    /**
12514     * The number of elements pointed to by `data`.
12515     */
12516    uintptr_t datalen;
12517 } LDKCVec_FutureZ;
12518
12519 /**
12520  * The contents of CResult_OffersMessageDecodeErrorZ
12521  */
12522 typedef union LDKCResult_OffersMessageDecodeErrorZPtr {
12523    /**
12524     * A pointer to the contents in the success state.
12525     * Reading from this pointer when `result_ok` is not set is undefined.
12526     */
12527    struct LDKOffersMessage *result;
12528    /**
12529     * A pointer to the contents in the error state.
12530     * Reading from this pointer when `result_ok` is set is undefined.
12531     */
12532    struct LDKDecodeError *err;
12533 } LDKCResult_OffersMessageDecodeErrorZPtr;
12534
12535 /**
12536  * A CResult_OffersMessageDecodeErrorZ represents the result of a fallible operation,
12537  * containing a crate::lightning::onion_message::offers::OffersMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
12538  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
12539  */
12540 typedef struct LDKCResult_OffersMessageDecodeErrorZ {
12541    /**
12542     * The contents of this CResult_OffersMessageDecodeErrorZ, accessible via either
12543     * `err` or `result` depending on the state of `result_ok`.
12544     */
12545    union LDKCResult_OffersMessageDecodeErrorZPtr contents;
12546    /**
12547     * Whether this CResult_OffersMessageDecodeErrorZ represents a success state.
12548     */
12549    bool result_ok;
12550 } LDKCResult_OffersMessageDecodeErrorZ;
12551
12552 /**
12553  * An enum which can either contain a crate::lightning::ln::chan_utils::HTLCClaim or not
12554  */
12555 typedef enum LDKCOption_HTLCClaimZ_Tag {
12556    /**
12557     * When we're in this state, this COption_HTLCClaimZ contains a crate::lightning::ln::chan_utils::HTLCClaim
12558     */
12559    LDKCOption_HTLCClaimZ_Some,
12560    /**
12561     * When we're in this state, this COption_HTLCClaimZ contains nothing
12562     */
12563    LDKCOption_HTLCClaimZ_None,
12564    /**
12565     * Must be last for serialization purposes
12566     */
12567    LDKCOption_HTLCClaimZ_Sentinel,
12568 } LDKCOption_HTLCClaimZ_Tag;
12569
12570 typedef struct LDKCOption_HTLCClaimZ {
12571    LDKCOption_HTLCClaimZ_Tag tag;
12572    union {
12573       struct {
12574          enum LDKHTLCClaim some;
12575       };
12576    };
12577 } LDKCOption_HTLCClaimZ;
12578
12579
12580
12581 /**
12582  * Implements the per-commitment secret storage scheme from
12583  * [BOLT 3](https://github.com/lightning/bolts/blob/dcbf8583976df087c79c3ce0b535311212e6812d/03-transactions.md#efficient-per-commitment-secret-storage).
12584  *
12585  * Allows us to keep track of all of the revocation secrets of our counterparty in just 50*32 bytes
12586  * or so.
12587  */
12588 typedef struct MUST_USE_STRUCT LDKCounterpartyCommitmentSecrets {
12589    /**
12590     * A pointer to the opaque Rust object.
12591     * Nearly everywhere, inner must be non-null, however in places where
12592     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12593     */
12594    LDKnativeCounterpartyCommitmentSecrets *inner;
12595    /**
12596     * Indicates that this is the only struct which contains the same pointer.
12597     * Rust functions which take ownership of an object provided via an argument require
12598     * this to be true and invalidate the object pointed to by inner.
12599     */
12600    bool is_owned;
12601 } LDKCounterpartyCommitmentSecrets;
12602
12603 /**
12604  * The contents of CResult_CounterpartyCommitmentSecretsDecodeErrorZ
12605  */
12606 typedef union LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
12607    /**
12608     * A pointer to the contents in the success state.
12609     * Reading from this pointer when `result_ok` is not set is undefined.
12610     */
12611    struct LDKCounterpartyCommitmentSecrets *result;
12612    /**
12613     * A pointer to the contents in the error state.
12614     * Reading from this pointer when `result_ok` is set is undefined.
12615     */
12616    struct LDKDecodeError *err;
12617 } LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZPtr;
12618
12619 /**
12620  * A CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents the result of a fallible operation,
12621  * containing a crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets on success and a crate::lightning::ln::msgs::DecodeError on failure.
12622  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
12623  */
12624 typedef struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ {
12625    /**
12626     * The contents of this CResult_CounterpartyCommitmentSecretsDecodeErrorZ, accessible via either
12627     * `err` or `result` depending on the state of `result_ok`.
12628     */
12629    union LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZPtr contents;
12630    /**
12631     * Whether this CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents a success state.
12632     */
12633    bool result_ok;
12634 } LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ;
12635
12636
12637
12638 /**
12639  * The set of public keys which are used in the creation of one commitment transaction.
12640  * These are derived from the channel base keys and per-commitment data.
12641  *
12642  * A broadcaster key is provided from potential broadcaster of the computed transaction.
12643  * A countersignatory key is coming from a protocol participant unable to broadcast the
12644  * transaction.
12645  *
12646  * These keys are assumed to be good, either because the code derived them from
12647  * channel basepoints via the new function, or they were obtained via
12648  * CommitmentTransaction.trust().keys() because we trusted the source of the
12649  * pre-calculated keys.
12650  */
12651 typedef struct MUST_USE_STRUCT LDKTxCreationKeys {
12652    /**
12653     * A pointer to the opaque Rust object.
12654     * Nearly everywhere, inner must be non-null, however in places where
12655     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12656     */
12657    LDKnativeTxCreationKeys *inner;
12658    /**
12659     * Indicates that this is the only struct which contains the same pointer.
12660     * Rust functions which take ownership of an object provided via an argument require
12661     * this to be true and invalidate the object pointed to by inner.
12662     */
12663    bool is_owned;
12664 } LDKTxCreationKeys;
12665
12666 /**
12667  * The contents of CResult_TxCreationKeysDecodeErrorZ
12668  */
12669 typedef union LDKCResult_TxCreationKeysDecodeErrorZPtr {
12670    /**
12671     * A pointer to the contents in the success state.
12672     * Reading from this pointer when `result_ok` is not set is undefined.
12673     */
12674    struct LDKTxCreationKeys *result;
12675    /**
12676     * A pointer to the contents in the error state.
12677     * Reading from this pointer when `result_ok` is set is undefined.
12678     */
12679    struct LDKDecodeError *err;
12680 } LDKCResult_TxCreationKeysDecodeErrorZPtr;
12681
12682 /**
12683  * A CResult_TxCreationKeysDecodeErrorZ represents the result of a fallible operation,
12684  * containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
12685  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
12686  */
12687 typedef struct LDKCResult_TxCreationKeysDecodeErrorZ {
12688    /**
12689     * The contents of this CResult_TxCreationKeysDecodeErrorZ, accessible via either
12690     * `err` or `result` depending on the state of `result_ok`.
12691     */
12692    union LDKCResult_TxCreationKeysDecodeErrorZPtr contents;
12693    /**
12694     * Whether this CResult_TxCreationKeysDecodeErrorZ represents a success state.
12695     */
12696    bool result_ok;
12697 } LDKCResult_TxCreationKeysDecodeErrorZ;
12698
12699 /**
12700  * The contents of CResult_ChannelPublicKeysDecodeErrorZ
12701  */
12702 typedef union LDKCResult_ChannelPublicKeysDecodeErrorZPtr {
12703    /**
12704     * A pointer to the contents in the success state.
12705     * Reading from this pointer when `result_ok` is not set is undefined.
12706     */
12707    struct LDKChannelPublicKeys *result;
12708    /**
12709     * A pointer to the contents in the error state.
12710     * Reading from this pointer when `result_ok` is set is undefined.
12711     */
12712    struct LDKDecodeError *err;
12713 } LDKCResult_ChannelPublicKeysDecodeErrorZPtr;
12714
12715 /**
12716  * A CResult_ChannelPublicKeysDecodeErrorZ represents the result of a fallible operation,
12717  * containing a crate::lightning::ln::chan_utils::ChannelPublicKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
12718  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
12719  */
12720 typedef struct LDKCResult_ChannelPublicKeysDecodeErrorZ {
12721    /**
12722     * The contents of this CResult_ChannelPublicKeysDecodeErrorZ, accessible via either
12723     * `err` or `result` depending on the state of `result_ok`.
12724     */
12725    union LDKCResult_ChannelPublicKeysDecodeErrorZPtr contents;
12726    /**
12727     * Whether this CResult_ChannelPublicKeysDecodeErrorZ represents a success state.
12728     */
12729    bool result_ok;
12730 } LDKCResult_ChannelPublicKeysDecodeErrorZ;
12731
12732 /**
12733  * The contents of CResult_HTLCOutputInCommitmentDecodeErrorZ
12734  */
12735 typedef union LDKCResult_HTLCOutputInCommitmentDecodeErrorZPtr {
12736    /**
12737     * A pointer to the contents in the success state.
12738     * Reading from this pointer when `result_ok` is not set is undefined.
12739     */
12740    struct LDKHTLCOutputInCommitment *result;
12741    /**
12742     * A pointer to the contents in the error state.
12743     * Reading from this pointer when `result_ok` is set is undefined.
12744     */
12745    struct LDKDecodeError *err;
12746 } LDKCResult_HTLCOutputInCommitmentDecodeErrorZPtr;
12747
12748 /**
12749  * A CResult_HTLCOutputInCommitmentDecodeErrorZ represents the result of a fallible operation,
12750  * containing a crate::lightning::ln::chan_utils::HTLCOutputInCommitment on success and a crate::lightning::ln::msgs::DecodeError on failure.
12751  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
12752  */
12753 typedef struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ {
12754    /**
12755     * The contents of this CResult_HTLCOutputInCommitmentDecodeErrorZ, accessible via either
12756     * `err` or `result` depending on the state of `result_ok`.
12757     */
12758    union LDKCResult_HTLCOutputInCommitmentDecodeErrorZPtr contents;
12759    /**
12760     * Whether this CResult_HTLCOutputInCommitmentDecodeErrorZ represents a success state.
12761     */
12762    bool result_ok;
12763 } LDKCResult_HTLCOutputInCommitmentDecodeErrorZ;
12764
12765
12766
12767 /**
12768  * Late-bound per-channel counterparty data used to build transactions.
12769  */
12770 typedef struct MUST_USE_STRUCT LDKCounterpartyChannelTransactionParameters {
12771    /**
12772     * A pointer to the opaque Rust object.
12773     * Nearly everywhere, inner must be non-null, however in places where
12774     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12775     */
12776    LDKnativeCounterpartyChannelTransactionParameters *inner;
12777    /**
12778     * Indicates that this is the only struct which contains the same pointer.
12779     * Rust functions which take ownership of an object provided via an argument require
12780     * this to be true and invalidate the object pointed to by inner.
12781     */
12782    bool is_owned;
12783 } LDKCounterpartyChannelTransactionParameters;
12784
12785 /**
12786  * The contents of CResult_CounterpartyChannelTransactionParametersDecodeErrorZ
12787  */
12788 typedef union LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
12789    /**
12790     * A pointer to the contents in the success state.
12791     * Reading from this pointer when `result_ok` is not set is undefined.
12792     */
12793    struct LDKCounterpartyChannelTransactionParameters *result;
12794    /**
12795     * A pointer to the contents in the error state.
12796     * Reading from this pointer when `result_ok` is set is undefined.
12797     */
12798    struct LDKDecodeError *err;
12799 } LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr;
12800
12801 /**
12802  * A CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
12803  * containing a crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
12804  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
12805  */
12806 typedef struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
12807    /**
12808     * The contents of this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ, accessible via either
12809     * `err` or `result` depending on the state of `result_ok`.
12810     */
12811    union LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr contents;
12812    /**
12813     * Whether this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents a success state.
12814     */
12815    bool result_ok;
12816 } LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ;
12817
12818 /**
12819  * The contents of CResult_ChannelTransactionParametersDecodeErrorZ
12820  */
12821 typedef union LDKCResult_ChannelTransactionParametersDecodeErrorZPtr {
12822    /**
12823     * A pointer to the contents in the success state.
12824     * Reading from this pointer when `result_ok` is not set is undefined.
12825     */
12826    struct LDKChannelTransactionParameters *result;
12827    /**
12828     * A pointer to the contents in the error state.
12829     * Reading from this pointer when `result_ok` is set is undefined.
12830     */
12831    struct LDKDecodeError *err;
12832 } LDKCResult_ChannelTransactionParametersDecodeErrorZPtr;
12833
12834 /**
12835  * A CResult_ChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
12836  * containing a crate::lightning::ln::chan_utils::ChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
12837  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
12838  */
12839 typedef struct LDKCResult_ChannelTransactionParametersDecodeErrorZ {
12840    /**
12841     * The contents of this CResult_ChannelTransactionParametersDecodeErrorZ, accessible via either
12842     * `err` or `result` depending on the state of `result_ok`.
12843     */
12844    union LDKCResult_ChannelTransactionParametersDecodeErrorZPtr contents;
12845    /**
12846     * Whether this CResult_ChannelTransactionParametersDecodeErrorZ represents a success state.
12847     */
12848    bool result_ok;
12849 } LDKCResult_ChannelTransactionParametersDecodeErrorZ;
12850
12851 /**
12852  * The contents of CResult_HolderCommitmentTransactionDecodeErrorZ
12853  */
12854 typedef union LDKCResult_HolderCommitmentTransactionDecodeErrorZPtr {
12855    /**
12856     * A pointer to the contents in the success state.
12857     * Reading from this pointer when `result_ok` is not set is undefined.
12858     */
12859    struct LDKHolderCommitmentTransaction *result;
12860    /**
12861     * A pointer to the contents in the error state.
12862     * Reading from this pointer when `result_ok` is set is undefined.
12863     */
12864    struct LDKDecodeError *err;
12865 } LDKCResult_HolderCommitmentTransactionDecodeErrorZPtr;
12866
12867 /**
12868  * A CResult_HolderCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
12869  * containing a crate::lightning::ln::chan_utils::HolderCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
12870  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
12871  */
12872 typedef struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ {
12873    /**
12874     * The contents of this CResult_HolderCommitmentTransactionDecodeErrorZ, accessible via either
12875     * `err` or `result` depending on the state of `result_ok`.
12876     */
12877    union LDKCResult_HolderCommitmentTransactionDecodeErrorZPtr contents;
12878    /**
12879     * Whether this CResult_HolderCommitmentTransactionDecodeErrorZ represents a success state.
12880     */
12881    bool result_ok;
12882 } LDKCResult_HolderCommitmentTransactionDecodeErrorZ;
12883
12884
12885
12886 /**
12887  * A pre-built Bitcoin commitment transaction and its txid.
12888  */
12889 typedef struct MUST_USE_STRUCT LDKBuiltCommitmentTransaction {
12890    /**
12891     * A pointer to the opaque Rust object.
12892     * Nearly everywhere, inner must be non-null, however in places where
12893     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12894     */
12895    LDKnativeBuiltCommitmentTransaction *inner;
12896    /**
12897     * Indicates that this is the only struct which contains the same pointer.
12898     * Rust functions which take ownership of an object provided via an argument require
12899     * this to be true and invalidate the object pointed to by inner.
12900     */
12901    bool is_owned;
12902 } LDKBuiltCommitmentTransaction;
12903
12904 /**
12905  * The contents of CResult_BuiltCommitmentTransactionDecodeErrorZ
12906  */
12907 typedef union LDKCResult_BuiltCommitmentTransactionDecodeErrorZPtr {
12908    /**
12909     * A pointer to the contents in the success state.
12910     * Reading from this pointer when `result_ok` is not set is undefined.
12911     */
12912    struct LDKBuiltCommitmentTransaction *result;
12913    /**
12914     * A pointer to the contents in the error state.
12915     * Reading from this pointer when `result_ok` is set is undefined.
12916     */
12917    struct LDKDecodeError *err;
12918 } LDKCResult_BuiltCommitmentTransactionDecodeErrorZPtr;
12919
12920 /**
12921  * A CResult_BuiltCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
12922  * containing a crate::lightning::ln::chan_utils::BuiltCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
12923  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
12924  */
12925 typedef struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ {
12926    /**
12927     * The contents of this CResult_BuiltCommitmentTransactionDecodeErrorZ, accessible via either
12928     * `err` or `result` depending on the state of `result_ok`.
12929     */
12930    union LDKCResult_BuiltCommitmentTransactionDecodeErrorZPtr contents;
12931    /**
12932     * Whether this CResult_BuiltCommitmentTransactionDecodeErrorZ represents a success state.
12933     */
12934    bool result_ok;
12935 } LDKCResult_BuiltCommitmentTransactionDecodeErrorZ;
12936
12937
12938
12939 /**
12940  * A wrapper on ClosingTransaction indicating that the built bitcoin
12941  * transaction is trusted.
12942  *
12943  * See trust() and verify() functions on CommitmentTransaction.
12944  *
12945  * This structure implements Deref.
12946  */
12947 typedef struct MUST_USE_STRUCT LDKTrustedClosingTransaction {
12948    /**
12949     * A pointer to the opaque Rust object.
12950     * Nearly everywhere, inner must be non-null, however in places where
12951     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12952     */
12953    LDKnativeTrustedClosingTransaction *inner;
12954    /**
12955     * Indicates that this is the only struct which contains the same pointer.
12956     * Rust functions which take ownership of an object provided via an argument require
12957     * this to be true and invalidate the object pointed to by inner.
12958     */
12959    bool is_owned;
12960 } LDKTrustedClosingTransaction;
12961
12962 /**
12963  * The contents of CResult_TrustedClosingTransactionNoneZ
12964  */
12965 typedef union LDKCResult_TrustedClosingTransactionNoneZPtr {
12966    /**
12967     * A pointer to the contents in the success state.
12968     * Reading from this pointer when `result_ok` is not set is undefined.
12969     */
12970    struct LDKTrustedClosingTransaction *result;
12971    /**
12972     * Note that this value is always NULL, as there are no contents in the Err variant
12973     */
12974    void *err;
12975 } LDKCResult_TrustedClosingTransactionNoneZPtr;
12976
12977 /**
12978  * A CResult_TrustedClosingTransactionNoneZ represents the result of a fallible operation,
12979  * containing a crate::lightning::ln::chan_utils::TrustedClosingTransaction on success and a () on failure.
12980  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
12981  */
12982 typedef struct LDKCResult_TrustedClosingTransactionNoneZ {
12983    /**
12984     * The contents of this CResult_TrustedClosingTransactionNoneZ, accessible via either
12985     * `err` or `result` depending on the state of `result_ok`.
12986     */
12987    union LDKCResult_TrustedClosingTransactionNoneZPtr contents;
12988    /**
12989     * Whether this CResult_TrustedClosingTransactionNoneZ represents a success state.
12990     */
12991    bool result_ok;
12992 } LDKCResult_TrustedClosingTransactionNoneZ;
12993
12994 /**
12995  * The contents of CResult_CommitmentTransactionDecodeErrorZ
12996  */
12997 typedef union LDKCResult_CommitmentTransactionDecodeErrorZPtr {
12998    /**
12999     * A pointer to the contents in the success state.
13000     * Reading from this pointer when `result_ok` is not set is undefined.
13001     */
13002    struct LDKCommitmentTransaction *result;
13003    /**
13004     * A pointer to the contents in the error state.
13005     * Reading from this pointer when `result_ok` is set is undefined.
13006     */
13007    struct LDKDecodeError *err;
13008 } LDKCResult_CommitmentTransactionDecodeErrorZPtr;
13009
13010 /**
13011  * A CResult_CommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
13012  * containing a crate::lightning::ln::chan_utils::CommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
13013  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
13014  */
13015 typedef struct LDKCResult_CommitmentTransactionDecodeErrorZ {
13016    /**
13017     * The contents of this CResult_CommitmentTransactionDecodeErrorZ, accessible via either
13018     * `err` or `result` depending on the state of `result_ok`.
13019     */
13020    union LDKCResult_CommitmentTransactionDecodeErrorZPtr contents;
13021    /**
13022     * Whether this CResult_CommitmentTransactionDecodeErrorZ represents a success state.
13023     */
13024    bool result_ok;
13025 } LDKCResult_CommitmentTransactionDecodeErrorZ;
13026
13027
13028
13029 /**
13030  * A wrapper on CommitmentTransaction indicating that the derived fields (the built bitcoin
13031  * transaction and the transaction creation keys) are trusted.
13032  *
13033  * See trust() and verify() functions on CommitmentTransaction.
13034  *
13035  * This structure implements Deref.
13036  */
13037 typedef struct MUST_USE_STRUCT LDKTrustedCommitmentTransaction {
13038    /**
13039     * A pointer to the opaque Rust object.
13040     * Nearly everywhere, inner must be non-null, however in places where
13041     * the Rust equivalent takes an Option, it may be set to null to indicate None.
13042     */
13043    LDKnativeTrustedCommitmentTransaction *inner;
13044    /**
13045     * Indicates that this is the only struct which contains the same pointer.
13046     * Rust functions which take ownership of an object provided via an argument require
13047     * this to be true and invalidate the object pointed to by inner.
13048     */
13049    bool is_owned;
13050 } LDKTrustedCommitmentTransaction;
13051
13052 /**
13053  * The contents of CResult_TrustedCommitmentTransactionNoneZ
13054  */
13055 typedef union LDKCResult_TrustedCommitmentTransactionNoneZPtr {
13056    /**
13057     * A pointer to the contents in the success state.
13058     * Reading from this pointer when `result_ok` is not set is undefined.
13059     */
13060    struct LDKTrustedCommitmentTransaction *result;
13061    /**
13062     * Note that this value is always NULL, as there are no contents in the Err variant
13063     */
13064    void *err;
13065 } LDKCResult_TrustedCommitmentTransactionNoneZPtr;
13066
13067 /**
13068  * A CResult_TrustedCommitmentTransactionNoneZ represents the result of a fallible operation,
13069  * containing a crate::lightning::ln::chan_utils::TrustedCommitmentTransaction on success and a () on failure.
13070  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
13071  */
13072 typedef struct LDKCResult_TrustedCommitmentTransactionNoneZ {
13073    /**
13074     * The contents of this CResult_TrustedCommitmentTransactionNoneZ, accessible via either
13075     * `err` or `result` depending on the state of `result_ok`.
13076     */
13077    union LDKCResult_TrustedCommitmentTransactionNoneZPtr contents;
13078    /**
13079     * Whether this CResult_TrustedCommitmentTransactionNoneZ represents a success state.
13080     */
13081    bool result_ok;
13082 } LDKCResult_TrustedCommitmentTransactionNoneZ;
13083
13084 /**
13085  * The contents of CResult_CVec_SignatureZNoneZ
13086  */
13087 typedef union LDKCResult_CVec_SignatureZNoneZPtr {
13088    /**
13089     * A pointer to the contents in the success state.
13090     * Reading from this pointer when `result_ok` is not set is undefined.
13091     */
13092    struct LDKCVec_SignatureZ *result;
13093    /**
13094     * Note that this value is always NULL, as there are no contents in the Err variant
13095     */
13096    void *err;
13097 } LDKCResult_CVec_SignatureZNoneZPtr;
13098
13099 /**
13100  * A CResult_CVec_SignatureZNoneZ represents the result of a fallible operation,
13101  * containing a crate::c_types::derived::CVec_SignatureZ on success and a () on failure.
13102  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
13103  */
13104 typedef struct LDKCResult_CVec_SignatureZNoneZ {
13105    /**
13106     * The contents of this CResult_CVec_SignatureZNoneZ, accessible via either
13107     * `err` or `result` depending on the state of `result_ok`.
13108     */
13109    union LDKCResult_CVec_SignatureZNoneZPtr contents;
13110    /**
13111     * Whether this CResult_CVec_SignatureZNoneZ represents a success state.
13112     */
13113    bool result_ok;
13114 } LDKCResult_CVec_SignatureZNoneZ;
13115
13116 /**
13117  * The contents of CResult_ShutdownScriptDecodeErrorZ
13118  */
13119 typedef union LDKCResult_ShutdownScriptDecodeErrorZPtr {
13120    /**
13121     * A pointer to the contents in the success state.
13122     * Reading from this pointer when `result_ok` is not set is undefined.
13123     */
13124    struct LDKShutdownScript *result;
13125    /**
13126     * A pointer to the contents in the error state.
13127     * Reading from this pointer when `result_ok` is set is undefined.
13128     */
13129    struct LDKDecodeError *err;
13130 } LDKCResult_ShutdownScriptDecodeErrorZPtr;
13131
13132 /**
13133  * A CResult_ShutdownScriptDecodeErrorZ represents the result of a fallible operation,
13134  * containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::msgs::DecodeError on failure.
13135  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
13136  */
13137 typedef struct LDKCResult_ShutdownScriptDecodeErrorZ {
13138    /**
13139     * The contents of this CResult_ShutdownScriptDecodeErrorZ, accessible via either
13140     * `err` or `result` depending on the state of `result_ok`.
13141     */
13142    union LDKCResult_ShutdownScriptDecodeErrorZPtr contents;
13143    /**
13144     * Whether this CResult_ShutdownScriptDecodeErrorZ represents a success state.
13145     */
13146    bool result_ok;
13147 } LDKCResult_ShutdownScriptDecodeErrorZ;
13148
13149
13150
13151 /**
13152  * An error occurring when converting from [`Script`] to [`ShutdownScript`].
13153  */
13154 typedef struct MUST_USE_STRUCT LDKInvalidShutdownScript {
13155    /**
13156     * A pointer to the opaque Rust object.
13157     * Nearly everywhere, inner must be non-null, however in places where
13158     * the Rust equivalent takes an Option, it may be set to null to indicate None.
13159     */
13160    LDKnativeInvalidShutdownScript *inner;
13161    /**
13162     * Indicates that this is the only struct which contains the same pointer.
13163     * Rust functions which take ownership of an object provided via an argument require
13164     * this to be true and invalidate the object pointed to by inner.
13165     */
13166    bool is_owned;
13167 } LDKInvalidShutdownScript;
13168
13169 /**
13170  * The contents of CResult_ShutdownScriptInvalidShutdownScriptZ
13171  */
13172 typedef union LDKCResult_ShutdownScriptInvalidShutdownScriptZPtr {
13173    /**
13174     * A pointer to the contents in the success state.
13175     * Reading from this pointer when `result_ok` is not set is undefined.
13176     */
13177    struct LDKShutdownScript *result;
13178    /**
13179     * A pointer to the contents in the error state.
13180     * Reading from this pointer when `result_ok` is set is undefined.
13181     */
13182    struct LDKInvalidShutdownScript *err;
13183 } LDKCResult_ShutdownScriptInvalidShutdownScriptZPtr;
13184
13185 /**
13186  * A CResult_ShutdownScriptInvalidShutdownScriptZ represents the result of a fallible operation,
13187  * containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::script::InvalidShutdownScript on failure.
13188  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
13189  */
13190 typedef struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ {
13191    /**
13192     * The contents of this CResult_ShutdownScriptInvalidShutdownScriptZ, accessible via either
13193     * `err` or `result` depending on the state of `result_ok`.
13194     */
13195    union LDKCResult_ShutdownScriptInvalidShutdownScriptZPtr contents;
13196    /**
13197     * Whether this CResult_ShutdownScriptInvalidShutdownScriptZ represents a success state.
13198     */
13199    bool result_ok;
13200 } LDKCResult_ShutdownScriptInvalidShutdownScriptZ;
13201
13202 /**
13203  * Some information provided on receipt of payment depends on whether the payment received is a
13204  * spontaneous payment or a \"conventional\" lightning payment that's paying an invoice.
13205  */
13206 typedef enum LDKPaymentPurpose_Tag {
13207    /**
13208     * Information for receiving a payment that we generated an invoice for.
13209     */
13210    LDKPaymentPurpose_InvoicePayment,
13211    /**
13212     * Because this is a spontaneous payment, the payer generated their own preimage rather than us
13213     * (the payee) providing a preimage.
13214     */
13215    LDKPaymentPurpose_SpontaneousPayment,
13216    /**
13217     * Must be last for serialization purposes
13218     */
13219    LDKPaymentPurpose_Sentinel,
13220 } LDKPaymentPurpose_Tag;
13221
13222 typedef struct LDKPaymentPurpose_LDKInvoicePayment_Body {
13223    /**
13224     * The preimage to the payment_hash, if the payment hash (and secret) were fetched via
13225     * [`ChannelManager::create_inbound_payment`]. If provided, this can be handed directly to
13226     * [`ChannelManager::claim_funds`].
13227     *
13228     * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
13229     * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
13230     */
13231    struct LDKCOption_PaymentPreimageZ payment_preimage;
13232    /**
13233     * The \"payment secret\". This authenticates the sender to the recipient, preventing a
13234     * number of deanonymization attacks during the routing process.
13235     * It is provided here for your reference, however its accuracy is enforced directly by
13236     * [`ChannelManager`] using the values you previously provided to
13237     * [`ChannelManager::create_inbound_payment`] or
13238     * [`ChannelManager::create_inbound_payment_for_hash`].
13239     *
13240     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
13241     * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
13242     * [`ChannelManager::create_inbound_payment_for_hash`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
13243     */
13244    struct LDKThirtyTwoBytes payment_secret;
13245 } LDKPaymentPurpose_LDKInvoicePayment_Body;
13246
13247 typedef struct MUST_USE_STRUCT LDKPaymentPurpose {
13248    LDKPaymentPurpose_Tag tag;
13249    union {
13250       LDKPaymentPurpose_LDKInvoicePayment_Body invoice_payment;
13251       struct {
13252          struct LDKThirtyTwoBytes spontaneous_payment;
13253       };
13254    };
13255 } LDKPaymentPurpose;
13256
13257 /**
13258  * The contents of CResult_PaymentPurposeDecodeErrorZ
13259  */
13260 typedef union LDKCResult_PaymentPurposeDecodeErrorZPtr {
13261    /**
13262     * A pointer to the contents in the success state.
13263     * Reading from this pointer when `result_ok` is not set is undefined.
13264     */
13265    struct LDKPaymentPurpose *result;
13266    /**
13267     * A pointer to the contents in the error state.
13268     * Reading from this pointer when `result_ok` is set is undefined.
13269     */
13270    struct LDKDecodeError *err;
13271 } LDKCResult_PaymentPurposeDecodeErrorZPtr;
13272
13273 /**
13274  * A CResult_PaymentPurposeDecodeErrorZ represents the result of a fallible operation,
13275  * containing a crate::lightning::events::PaymentPurpose on success and a crate::lightning::ln::msgs::DecodeError on failure.
13276  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
13277  */
13278 typedef struct LDKCResult_PaymentPurposeDecodeErrorZ {
13279    /**
13280     * The contents of this CResult_PaymentPurposeDecodeErrorZ, accessible via either
13281     * `err` or `result` depending on the state of `result_ok`.
13282     */
13283    union LDKCResult_PaymentPurposeDecodeErrorZPtr contents;
13284    /**
13285     * Whether this CResult_PaymentPurposeDecodeErrorZ represents a success state.
13286     */
13287    bool result_ok;
13288 } LDKCResult_PaymentPurposeDecodeErrorZ;
13289
13290 /**
13291  * When the payment path failure took place and extra details about it. [`PathFailure::OnPath`] may
13292  * contain a [`NetworkUpdate`] that needs to be applied to the [`NetworkGraph`].
13293  *
13294  * [`NetworkUpdate`]: crate::routing::gossip::NetworkUpdate
13295  * [`NetworkGraph`]: crate::routing::gossip::NetworkGraph
13296  */
13297 typedef enum LDKPathFailure_Tag {
13298    /**
13299     * We failed to initially send the payment and no HTLC was committed to. Contains the relevant
13300     * error.
13301     */
13302    LDKPathFailure_InitialSend,
13303    /**
13304     * A hop on the path failed to forward our payment.
13305     */
13306    LDKPathFailure_OnPath,
13307    /**
13308     * Must be last for serialization purposes
13309     */
13310    LDKPathFailure_Sentinel,
13311 } LDKPathFailure_Tag;
13312
13313 typedef struct LDKPathFailure_LDKInitialSend_Body {
13314    /**
13315     * The error surfaced from initial send.
13316     */
13317    struct LDKAPIError err;
13318 } LDKPathFailure_LDKInitialSend_Body;
13319
13320 typedef struct LDKPathFailure_LDKOnPath_Body {
13321    /**
13322     * If present, this [`NetworkUpdate`] should be applied to the [`NetworkGraph`] so that routing
13323     * decisions can take into account the update.
13324     *
13325     * [`NetworkUpdate`]: crate::routing::gossip::NetworkUpdate
13326     * [`NetworkGraph`]: crate::routing::gossip::NetworkGraph
13327     */
13328    struct LDKCOption_NetworkUpdateZ network_update;
13329 } LDKPathFailure_LDKOnPath_Body;
13330
13331 typedef struct MUST_USE_STRUCT LDKPathFailure {
13332    LDKPathFailure_Tag tag;
13333    union {
13334       LDKPathFailure_LDKInitialSend_Body initial_send;
13335       LDKPathFailure_LDKOnPath_Body on_path;
13336    };
13337 } LDKPathFailure;
13338
13339 /**
13340  * An enum which can either contain a crate::lightning::events::PathFailure or not
13341  */
13342 typedef enum LDKCOption_PathFailureZ_Tag {
13343    /**
13344     * When we're in this state, this COption_PathFailureZ contains a crate::lightning::events::PathFailure
13345     */
13346    LDKCOption_PathFailureZ_Some,
13347    /**
13348     * When we're in this state, this COption_PathFailureZ contains nothing
13349     */
13350    LDKCOption_PathFailureZ_None,
13351    /**
13352     * Must be last for serialization purposes
13353     */
13354    LDKCOption_PathFailureZ_Sentinel,
13355 } LDKCOption_PathFailureZ_Tag;
13356
13357 typedef struct LDKCOption_PathFailureZ {
13358    LDKCOption_PathFailureZ_Tag tag;
13359    union {
13360       struct {
13361          struct LDKPathFailure some;
13362       };
13363    };
13364 } LDKCOption_PathFailureZ;
13365
13366 /**
13367  * The contents of CResult_COption_PathFailureZDecodeErrorZ
13368  */
13369 typedef union LDKCResult_COption_PathFailureZDecodeErrorZPtr {
13370    /**
13371     * A pointer to the contents in the success state.
13372     * Reading from this pointer when `result_ok` is not set is undefined.
13373     */
13374    struct LDKCOption_PathFailureZ *result;
13375    /**
13376     * A pointer to the contents in the error state.
13377     * Reading from this pointer when `result_ok` is set is undefined.
13378     */
13379    struct LDKDecodeError *err;
13380 } LDKCResult_COption_PathFailureZDecodeErrorZPtr;
13381
13382 /**
13383  * A CResult_COption_PathFailureZDecodeErrorZ represents the result of a fallible operation,
13384  * containing a crate::c_types::derived::COption_PathFailureZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
13385  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
13386  */
13387 typedef struct LDKCResult_COption_PathFailureZDecodeErrorZ {
13388    /**
13389     * The contents of this CResult_COption_PathFailureZDecodeErrorZ, accessible via either
13390     * `err` or `result` depending on the state of `result_ok`.
13391     */
13392    union LDKCResult_COption_PathFailureZDecodeErrorZPtr contents;
13393    /**
13394     * Whether this CResult_COption_PathFailureZDecodeErrorZ represents a success state.
13395     */
13396    bool result_ok;
13397 } LDKCResult_COption_PathFailureZDecodeErrorZ;
13398
13399
13400
13401 /**
13402  * Struct to `Display` fields in a safe way using `PrintableString`
13403  */
13404 typedef struct MUST_USE_STRUCT LDKUntrustedString {
13405    /**
13406     * A pointer to the opaque Rust object.
13407     * Nearly everywhere, inner must be non-null, however in places where
13408     * the Rust equivalent takes an Option, it may be set to null to indicate None.
13409     */
13410    LDKnativeUntrustedString *inner;
13411    /**
13412     * Indicates that this is the only struct which contains the same pointer.
13413     * Rust functions which take ownership of an object provided via an argument require
13414     * this to be true and invalidate the object pointed to by inner.
13415     */
13416    bool is_owned;
13417 } LDKUntrustedString;
13418
13419 /**
13420  * The reason the channel was closed. See individual variants for more details.
13421  */
13422 typedef enum LDKClosureReason_Tag {
13423    /**
13424     * Closure generated from receiving a peer error message.
13425     *
13426     * Our counterparty may have broadcasted their latest commitment state, and we have
13427     * as well.
13428     */
13429    LDKClosureReason_CounterpartyForceClosed,
13430    /**
13431     * Closure generated from [`ChannelManager::force_close_channel`], called by the user.
13432     *
13433     * [`ChannelManager::force_close_channel`]: crate::ln::channelmanager::ChannelManager::force_close_channel.
13434     */
13435    LDKClosureReason_HolderForceClosed,
13436    /**
13437     * The channel was closed after negotiating a cooperative close and we've now broadcasted
13438     * the cooperative close transaction. Note the shutdown may have been initiated by us.
13439     */
13440    LDKClosureReason_CooperativeClosure,
13441    /**
13442     * A commitment transaction was confirmed on chain, closing the channel. Most likely this
13443     * commitment transaction came from our counterparty, but it may also have come from
13444     * a copy of our own `ChannelMonitor`.
13445     */
13446    LDKClosureReason_CommitmentTxConfirmed,
13447    /**
13448     * The funding transaction failed to confirm in a timely manner on an inbound channel.
13449     */
13450    LDKClosureReason_FundingTimedOut,
13451    /**
13452     * Closure generated from processing an event, likely a HTLC forward/relay/reception.
13453     */
13454    LDKClosureReason_ProcessingError,
13455    /**
13456     * The peer disconnected prior to funding completing. In this case the spec mandates that we
13457     * forget the channel entirely - we can attempt again if the peer reconnects.
13458     *
13459     * This includes cases where we restarted prior to funding completion, including prior to the
13460     * initial [`ChannelMonitor`] persistence completing.
13461     *
13462     * In LDK versions prior to 0.0.107 this could also occur if we were unable to connect to the
13463     * peer because of mutual incompatibility between us and our channel counterparty.
13464     *
13465     * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor
13466     */
13467    LDKClosureReason_DisconnectedPeer,
13468    /**
13469     * Closure generated from `ChannelManager::read` if the [`ChannelMonitor`] is newer than
13470     * the [`ChannelManager`] deserialized.
13471     *
13472     * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor
13473     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
13474     */
13475    LDKClosureReason_OutdatedChannelManager,
13476    /**
13477     * The counterparty requested a cooperative close of a channel that had not been funded yet.
13478     * The channel has been immediately closed.
13479     */
13480    LDKClosureReason_CounterpartyCoopClosedUnfundedChannel,
13481    /**
13482     * Must be last for serialization purposes
13483     */
13484    LDKClosureReason_Sentinel,
13485 } LDKClosureReason_Tag;
13486
13487 typedef struct LDKClosureReason_LDKCounterpartyForceClosed_Body {
13488    /**
13489     * The error which the peer sent us.
13490     *
13491     * Be careful about printing the peer_msg, a well-crafted message could exploit
13492     * a security vulnerability in the terminal emulator or the logging subsystem.
13493     * To be safe, use `Display` on `UntrustedString`
13494     *
13495     * [`UntrustedString`]: crate::util::string::UntrustedString
13496     */
13497    struct LDKUntrustedString peer_msg;
13498 } LDKClosureReason_LDKCounterpartyForceClosed_Body;
13499
13500 typedef struct LDKClosureReason_LDKProcessingError_Body {
13501    /**
13502     * A developer-readable error message which we generated.
13503     */
13504    struct LDKStr err;
13505 } LDKClosureReason_LDKProcessingError_Body;
13506
13507 typedef struct MUST_USE_STRUCT LDKClosureReason {
13508    LDKClosureReason_Tag tag;
13509    union {
13510       LDKClosureReason_LDKCounterpartyForceClosed_Body counterparty_force_closed;
13511       LDKClosureReason_LDKProcessingError_Body processing_error;
13512    };
13513 } LDKClosureReason;
13514
13515 /**
13516  * An enum which can either contain a crate::lightning::events::ClosureReason or not
13517  */
13518 typedef enum LDKCOption_ClosureReasonZ_Tag {
13519    /**
13520     * When we're in this state, this COption_ClosureReasonZ contains a crate::lightning::events::ClosureReason
13521     */
13522    LDKCOption_ClosureReasonZ_Some,
13523    /**
13524     * When we're in this state, this COption_ClosureReasonZ contains nothing
13525     */
13526    LDKCOption_ClosureReasonZ_None,
13527    /**
13528     * Must be last for serialization purposes
13529     */
13530    LDKCOption_ClosureReasonZ_Sentinel,
13531 } LDKCOption_ClosureReasonZ_Tag;
13532
13533 typedef struct LDKCOption_ClosureReasonZ {
13534    LDKCOption_ClosureReasonZ_Tag tag;
13535    union {
13536       struct {
13537          struct LDKClosureReason some;
13538       };
13539    };
13540 } LDKCOption_ClosureReasonZ;
13541
13542 /**
13543  * The contents of CResult_COption_ClosureReasonZDecodeErrorZ
13544  */
13545 typedef union LDKCResult_COption_ClosureReasonZDecodeErrorZPtr {
13546    /**
13547     * A pointer to the contents in the success state.
13548     * Reading from this pointer when `result_ok` is not set is undefined.
13549     */
13550    struct LDKCOption_ClosureReasonZ *result;
13551    /**
13552     * A pointer to the contents in the error state.
13553     * Reading from this pointer when `result_ok` is set is undefined.
13554     */
13555    struct LDKDecodeError *err;
13556 } LDKCResult_COption_ClosureReasonZDecodeErrorZPtr;
13557
13558 /**
13559  * A CResult_COption_ClosureReasonZDecodeErrorZ represents the result of a fallible operation,
13560  * containing a crate::c_types::derived::COption_ClosureReasonZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
13561  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
13562  */
13563 typedef struct LDKCResult_COption_ClosureReasonZDecodeErrorZ {
13564    /**
13565     * The contents of this CResult_COption_ClosureReasonZDecodeErrorZ, accessible via either
13566     * `err` or `result` depending on the state of `result_ok`.
13567     */
13568    union LDKCResult_COption_ClosureReasonZDecodeErrorZPtr contents;
13569    /**
13570     * Whether this CResult_COption_ClosureReasonZDecodeErrorZ represents a success state.
13571     */
13572    bool result_ok;
13573 } LDKCResult_COption_ClosureReasonZDecodeErrorZ;
13574
13575 /**
13576  * Intended destination of a failed HTLC as indicated in [`Event::HTLCHandlingFailed`].
13577  */
13578 typedef enum LDKHTLCDestination_Tag {
13579    /**
13580     * We tried forwarding to a channel but failed to do so. An example of such an instance is when
13581     * there is insufficient capacity in our outbound channel.
13582     */
13583    LDKHTLCDestination_NextHopChannel,
13584    /**
13585     * Scenario where we are unsure of the next node to forward the HTLC to.
13586     */
13587    LDKHTLCDestination_UnknownNextHop,
13588    /**
13589     * We couldn't forward to the outgoing scid. An example would be attempting to send a duplicate
13590     * intercept HTLC.
13591     */
13592    LDKHTLCDestination_InvalidForward,
13593    /**
13594     * Failure scenario where an HTLC may have been forwarded to be intended for us,
13595     * but is invalid for some reason, so we reject it.
13596     *
13597     * Some of the reasons may include:
13598     * * HTLC Timeouts
13599     * * Excess HTLCs for a payment that we have already fully received, over-paying for the
13600     *   payment,
13601     * * The counterparty node modified the HTLC in transit,
13602     * * A probing attack where an intermediary node is trying to detect if we are the ultimate
13603     *   recipient for a payment.
13604     */
13605    LDKHTLCDestination_FailedPayment,
13606    /**
13607     * Must be last for serialization purposes
13608     */
13609    LDKHTLCDestination_Sentinel,
13610 } LDKHTLCDestination_Tag;
13611
13612 typedef struct LDKHTLCDestination_LDKNextHopChannel_Body {
13613    /**
13614     * The `node_id` of the next node. For backwards compatibility, this field is
13615     * marked as optional, versions prior to 0.0.110 may not always be able to provide
13616     * counterparty node information.
13617     *
13618     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
13619     */
13620    struct LDKPublicKey node_id;
13621    /**
13622     * The outgoing `channel_id` between us and the next node.
13623     */
13624    struct LDKThirtyTwoBytes channel_id;
13625 } LDKHTLCDestination_LDKNextHopChannel_Body;
13626
13627 typedef struct LDKHTLCDestination_LDKUnknownNextHop_Body {
13628    /**
13629     * Short channel id we are requesting to forward an HTLC to.
13630     */
13631    uint64_t requested_forward_scid;
13632 } LDKHTLCDestination_LDKUnknownNextHop_Body;
13633
13634 typedef struct LDKHTLCDestination_LDKInvalidForward_Body {
13635    /**
13636     * Short channel id we are requesting to forward an HTLC to.
13637     */
13638    uint64_t requested_forward_scid;
13639 } LDKHTLCDestination_LDKInvalidForward_Body;
13640
13641 typedef struct LDKHTLCDestination_LDKFailedPayment_Body {
13642    /**
13643     * The payment hash of the payment we attempted to process.
13644     */
13645    struct LDKThirtyTwoBytes payment_hash;
13646 } LDKHTLCDestination_LDKFailedPayment_Body;
13647
13648 typedef struct MUST_USE_STRUCT LDKHTLCDestination {
13649    LDKHTLCDestination_Tag tag;
13650    union {
13651       LDKHTLCDestination_LDKNextHopChannel_Body next_hop_channel;
13652       LDKHTLCDestination_LDKUnknownNextHop_Body unknown_next_hop;
13653       LDKHTLCDestination_LDKInvalidForward_Body invalid_forward;
13654       LDKHTLCDestination_LDKFailedPayment_Body failed_payment;
13655    };
13656 } LDKHTLCDestination;
13657
13658 /**
13659  * An enum which can either contain a crate::lightning::events::HTLCDestination or not
13660  */
13661 typedef enum LDKCOption_HTLCDestinationZ_Tag {
13662    /**
13663     * When we're in this state, this COption_HTLCDestinationZ contains a crate::lightning::events::HTLCDestination
13664     */
13665    LDKCOption_HTLCDestinationZ_Some,
13666    /**
13667     * When we're in this state, this COption_HTLCDestinationZ contains nothing
13668     */
13669    LDKCOption_HTLCDestinationZ_None,
13670    /**
13671     * Must be last for serialization purposes
13672     */
13673    LDKCOption_HTLCDestinationZ_Sentinel,
13674 } LDKCOption_HTLCDestinationZ_Tag;
13675
13676 typedef struct LDKCOption_HTLCDestinationZ {
13677    LDKCOption_HTLCDestinationZ_Tag tag;
13678    union {
13679       struct {
13680          struct LDKHTLCDestination some;
13681       };
13682    };
13683 } LDKCOption_HTLCDestinationZ;
13684
13685 /**
13686  * The contents of CResult_COption_HTLCDestinationZDecodeErrorZ
13687  */
13688 typedef union LDKCResult_COption_HTLCDestinationZDecodeErrorZPtr {
13689    /**
13690     * A pointer to the contents in the success state.
13691     * Reading from this pointer when `result_ok` is not set is undefined.
13692     */
13693    struct LDKCOption_HTLCDestinationZ *result;
13694    /**
13695     * A pointer to the contents in the error state.
13696     * Reading from this pointer when `result_ok` is set is undefined.
13697     */
13698    struct LDKDecodeError *err;
13699 } LDKCResult_COption_HTLCDestinationZDecodeErrorZPtr;
13700
13701 /**
13702  * A CResult_COption_HTLCDestinationZDecodeErrorZ represents the result of a fallible operation,
13703  * containing a crate::c_types::derived::COption_HTLCDestinationZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
13704  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
13705  */
13706 typedef struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ {
13707    /**
13708     * The contents of this CResult_COption_HTLCDestinationZDecodeErrorZ, accessible via either
13709     * `err` or `result` depending on the state of `result_ok`.
13710     */
13711    union LDKCResult_COption_HTLCDestinationZDecodeErrorZPtr contents;
13712    /**
13713     * Whether this CResult_COption_HTLCDestinationZDecodeErrorZ represents a success state.
13714     */
13715    bool result_ok;
13716 } LDKCResult_COption_HTLCDestinationZDecodeErrorZ;
13717
13718 /**
13719  * The contents of CResult_PaymentFailureReasonDecodeErrorZ
13720  */
13721 typedef union LDKCResult_PaymentFailureReasonDecodeErrorZPtr {
13722    /**
13723     * A pointer to the contents in the success state.
13724     * Reading from this pointer when `result_ok` is not set is undefined.
13725     */
13726    enum LDKPaymentFailureReason *result;
13727    /**
13728     * A pointer to the contents in the error state.
13729     * Reading from this pointer when `result_ok` is set is undefined.
13730     */
13731    struct LDKDecodeError *err;
13732 } LDKCResult_PaymentFailureReasonDecodeErrorZPtr;
13733
13734 /**
13735  * A CResult_PaymentFailureReasonDecodeErrorZ represents the result of a fallible operation,
13736  * containing a crate::lightning::events::PaymentFailureReason on success and a crate::lightning::ln::msgs::DecodeError on failure.
13737  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
13738  */
13739 typedef struct LDKCResult_PaymentFailureReasonDecodeErrorZ {
13740    /**
13741     * The contents of this CResult_PaymentFailureReasonDecodeErrorZ, accessible via either
13742     * `err` or `result` depending on the state of `result_ok`.
13743     */
13744    union LDKCResult_PaymentFailureReasonDecodeErrorZPtr contents;
13745    /**
13746     * Whether this CResult_PaymentFailureReasonDecodeErrorZ represents a success state.
13747     */
13748    bool result_ok;
13749 } LDKCResult_PaymentFailureReasonDecodeErrorZ;
13750
13751 /**
13752  * An enum which can either contain a crate::c_types::U128 or not
13753  */
13754 typedef enum LDKCOption_u128Z_Tag {
13755    /**
13756     * When we're in this state, this COption_u128Z contains a crate::c_types::U128
13757     */
13758    LDKCOption_u128Z_Some,
13759    /**
13760     * When we're in this state, this COption_u128Z contains nothing
13761     */
13762    LDKCOption_u128Z_None,
13763    /**
13764     * Must be last for serialization purposes
13765     */
13766    LDKCOption_u128Z_Sentinel,
13767 } LDKCOption_u128Z_Tag;
13768
13769 typedef struct LDKCOption_u128Z {
13770    LDKCOption_u128Z_Tag tag;
13771    union {
13772       struct {
13773          struct LDKU128 some;
13774       };
13775    };
13776 } LDKCOption_u128Z;
13777
13778 /**
13779  * An enum which can either contain a crate::c_types::ThirtyTwoBytes or not
13780  */
13781 typedef enum LDKCOption_PaymentIdZ_Tag {
13782    /**
13783     * When we're in this state, this COption_PaymentIdZ contains a crate::c_types::ThirtyTwoBytes
13784     */
13785    LDKCOption_PaymentIdZ_Some,
13786    /**
13787     * When we're in this state, this COption_PaymentIdZ contains nothing
13788     */
13789    LDKCOption_PaymentIdZ_None,
13790    /**
13791     * Must be last for serialization purposes
13792     */
13793    LDKCOption_PaymentIdZ_Sentinel,
13794 } LDKCOption_PaymentIdZ_Tag;
13795
13796 typedef struct LDKCOption_PaymentIdZ {
13797    LDKCOption_PaymentIdZ_Tag tag;
13798    union {
13799       struct {
13800          struct LDKThirtyTwoBytes some;
13801       };
13802    };
13803 } LDKCOption_PaymentIdZ;
13804
13805 /**
13806  * An enum which can either contain a crate::lightning::events::PaymentFailureReason or not
13807  */
13808 typedef enum LDKCOption_PaymentFailureReasonZ_Tag {
13809    /**
13810     * When we're in this state, this COption_PaymentFailureReasonZ contains a crate::lightning::events::PaymentFailureReason
13811     */
13812    LDKCOption_PaymentFailureReasonZ_Some,
13813    /**
13814     * When we're in this state, this COption_PaymentFailureReasonZ contains nothing
13815     */
13816    LDKCOption_PaymentFailureReasonZ_None,
13817    /**
13818     * Must be last for serialization purposes
13819     */
13820    LDKCOption_PaymentFailureReasonZ_Sentinel,
13821 } LDKCOption_PaymentFailureReasonZ_Tag;
13822
13823 typedef struct LDKCOption_PaymentFailureReasonZ {
13824    LDKCOption_PaymentFailureReasonZ_Tag tag;
13825    union {
13826       struct {
13827          enum LDKPaymentFailureReason some;
13828       };
13829    };
13830 } LDKCOption_PaymentFailureReasonZ;
13831
13832
13833
13834 /**
13835  * A descriptor used to sign for a commitment transaction's anchor output.
13836  */
13837 typedef struct MUST_USE_STRUCT LDKAnchorDescriptor {
13838    /**
13839     * A pointer to the opaque Rust object.
13840     * Nearly everywhere, inner must be non-null, however in places where
13841     * the Rust equivalent takes an Option, it may be set to null to indicate None.
13842     */
13843    LDKnativeAnchorDescriptor *inner;
13844    /**
13845     * Indicates that this is the only struct which contains the same pointer.
13846     * Rust functions which take ownership of an object provided via an argument require
13847     * this to be true and invalidate the object pointed to by inner.
13848     */
13849    bool is_owned;
13850 } LDKAnchorDescriptor;
13851
13852 /**
13853  * Represents the different types of transactions, originating from LDK, to be bumped.
13854  */
13855 typedef enum LDKBumpTransactionEvent_Tag {
13856    /**
13857     * Indicates that a channel featuring anchor outputs is to be closed by broadcasting the local
13858     * commitment transaction. Since commitment transactions have a static feerate pre-agreed upon,
13859     * they may need additional fees to be attached through a child transaction using the popular
13860     * [Child-Pays-For-Parent](https://bitcoinops.org/en/topics/cpfp) fee bumping technique. This
13861     * child transaction must include the anchor input described within `anchor_descriptor` along
13862     * with additional inputs to meet the target feerate. Failure to meet the target feerate
13863     * decreases the confirmation odds of the transaction package (which includes the commitment
13864     * and child anchor transactions), possibly resulting in a loss of funds. Once the transaction
13865     * is constructed, it must be fully signed for and broadcast by the consumer of the event
13866     * along with the `commitment_tx` enclosed. Note that the `commitment_tx` must always be
13867     * broadcast first, as the child anchor transaction depends on it.
13868     *
13869     * The consumer should be able to sign for any of the additional inputs included within the
13870     * child anchor transaction. To sign its anchor input, an [`EcdsaChannelSigner`] should be
13871     * re-derived through [`AnchorDescriptor::derive_channel_signer`]. The anchor input signature
13872     * can be computed with [`EcdsaChannelSigner::sign_holder_anchor_input`], which can then be
13873     * provided to [`build_anchor_input_witness`] along with the `funding_pubkey` to obtain the
13874     * full witness required to spend.
13875     *
13876     * It is possible to receive more than one instance of this event if a valid child anchor
13877     * transaction is never broadcast or is but not with a sufficient fee to be mined. Care should
13878     * be taken by the consumer of the event to ensure any future iterations of the child anchor
13879     * transaction adhere to the [Replace-By-Fee
13880     * rules](https://github.com/bitcoin/bitcoin/blob/master/doc/policy/mempool-replacements.md)
13881     * for fee bumps to be accepted into the mempool, and eventually the chain. As the frequency of
13882     * these events is not user-controlled, users may ignore/drop the event if they are no longer
13883     * able to commit external confirmed funds to the child anchor transaction.
13884     *
13885     * The set of `pending_htlcs` on the commitment transaction to be broadcast can be inspected to
13886     * determine whether a significant portion of the channel's funds are allocated to HTLCs,
13887     * enabling users to make their own decisions regarding the importance of the commitment
13888     * transaction's confirmation. Note that this is not required, but simply exists as an option
13889     * for users to override LDK's behavior. On commitments with no HTLCs (indicated by those with
13890     * an empty `pending_htlcs`), confirmation of the commitment transaction can be considered to
13891     * be not urgent.
13892     *
13893     * [`EcdsaChannelSigner`]: crate::sign::EcdsaChannelSigner
13894     * [`EcdsaChannelSigner::sign_holder_anchor_input`]: crate::sign::EcdsaChannelSigner::sign_holder_anchor_input
13895     * [`build_anchor_input_witness`]: crate::ln::chan_utils::build_anchor_input_witness
13896     */
13897    LDKBumpTransactionEvent_ChannelClose,
13898    /**
13899     * Indicates that a channel featuring anchor outputs has unilaterally closed on-chain by a
13900     * holder commitment transaction and its HTLC(s) need to be resolved on-chain. With the
13901     * zero-HTLC-transaction-fee variant of anchor outputs, the pre-signed HTLC
13902     * transactions have a zero fee, thus requiring additional inputs and/or outputs to be attached
13903     * for a timely confirmation within the chain. These additional inputs and/or outputs must be
13904     * appended to the resulting HTLC transaction to meet the target feerate. Failure to meet the
13905     * target feerate decreases the confirmation odds of the transaction, possibly resulting in a
13906     * loss of funds. Once the transaction meets the target feerate, it must be signed for and
13907     * broadcast by the consumer of the event.
13908     *
13909     * The consumer should be able to sign for any of the non-HTLC inputs added to the resulting
13910     * HTLC transaction. To sign HTLC inputs, an [`EcdsaChannelSigner`] should be re-derived
13911     * through [`HTLCDescriptor::derive_channel_signer`]. Each HTLC input's signature can be
13912     * computed with [`EcdsaChannelSigner::sign_holder_htlc_transaction`], which can then be
13913     * provided to [`HTLCDescriptor::tx_input_witness`] to obtain the fully signed witness required
13914     * to spend.
13915     *
13916     * It is possible to receive more than one instance of this event if a valid HTLC transaction
13917     * is never broadcast or is but not with a sufficient fee to be mined. Care should be taken by
13918     * the consumer of the event to ensure any future iterations of the HTLC transaction adhere to
13919     * the [Replace-By-Fee
13920     * rules](https://github.com/bitcoin/bitcoin/blob/master/doc/policy/mempool-replacements.md)
13921     * for fee bumps to be accepted into the mempool, and eventually the chain. As the frequency of
13922     * these events is not user-controlled, users may ignore/drop the event if either they are no
13923     * longer able to commit external confirmed funds to the HTLC transaction or the fee committed
13924     * to the HTLC transaction is greater in value than the HTLCs being claimed.
13925     *
13926     * [`EcdsaChannelSigner`]: crate::sign::EcdsaChannelSigner
13927     * [`EcdsaChannelSigner::sign_holder_htlc_transaction`]: crate::sign::EcdsaChannelSigner::sign_holder_htlc_transaction
13928     * [`HTLCDescriptor::tx_input_witness`]: HTLCDescriptor::tx_input_witness
13929     */
13930    LDKBumpTransactionEvent_HTLCResolution,
13931    /**
13932     * Must be last for serialization purposes
13933     */
13934    LDKBumpTransactionEvent_Sentinel,
13935 } LDKBumpTransactionEvent_Tag;
13936
13937 typedef struct LDKBumpTransactionEvent_LDKChannelClose_Body {
13938    /**
13939     * The unique identifier for the claim of the anchor output in the commitment transaction.
13940     *
13941     * The identifier must map to the set of external UTXOs assigned to the claim, such that
13942     * they can be reused when a new claim with the same identifier needs to be made, resulting
13943     * in a fee-bumping attempt.
13944     */
13945    struct LDKThirtyTwoBytes claim_id;
13946    /**
13947     * The target feerate that the transaction package, which consists of the commitment
13948     * transaction and the to-be-crafted child anchor transaction, must meet.
13949     */
13950    uint32_t package_target_feerate_sat_per_1000_weight;
13951    /**
13952     * The channel's commitment transaction to bump the fee of. This transaction should be
13953     * broadcast along with the anchor transaction constructed as a result of consuming this
13954     * event.
13955     */
13956    struct LDKTransaction commitment_tx;
13957    /**
13958     * The absolute fee in satoshis of the commitment transaction. This can be used along the
13959     * with weight of the commitment transaction to determine its feerate.
13960     */
13961    uint64_t commitment_tx_fee_satoshis;
13962    /**
13963     * The descriptor to sign the anchor input of the anchor transaction constructed as a
13964     * result of consuming this event.
13965     */
13966    struct LDKAnchorDescriptor anchor_descriptor;
13967    /**
13968     * The set of pending HTLCs on the commitment transaction that need to be resolved once the
13969     * commitment transaction confirms.
13970     */
13971    struct LDKCVec_HTLCOutputInCommitmentZ pending_htlcs;
13972 } LDKBumpTransactionEvent_LDKChannelClose_Body;
13973
13974 typedef struct LDKBumpTransactionEvent_LDKHTLCResolution_Body {
13975    /**
13976     * The unique identifier for the claim of the HTLCs in the confirmed commitment
13977     * transaction.
13978     *
13979     * The identifier must map to the set of external UTXOs assigned to the claim, such that
13980     * they can be reused when a new claim with the same identifier needs to be made, resulting
13981     * in a fee-bumping attempt.
13982     */
13983    struct LDKThirtyTwoBytes claim_id;
13984    /**
13985     * The target feerate that the resulting HTLC transaction must meet.
13986     */
13987    uint32_t target_feerate_sat_per_1000_weight;
13988    /**
13989     * The set of pending HTLCs on the confirmed commitment that need to be claimed, preferably
13990     * by the same transaction.
13991     */
13992    struct LDKCVec_HTLCDescriptorZ htlc_descriptors;
13993    /**
13994     * The locktime required for the resulting HTLC transaction.
13995     */
13996    uint32_t tx_lock_time;
13997 } LDKBumpTransactionEvent_LDKHTLCResolution_Body;
13998
13999 typedef struct MUST_USE_STRUCT LDKBumpTransactionEvent {
14000    LDKBumpTransactionEvent_Tag tag;
14001    union {
14002       LDKBumpTransactionEvent_LDKChannelClose_Body channel_close;
14003       LDKBumpTransactionEvent_LDKHTLCResolution_Body htlc_resolution;
14004    };
14005 } LDKBumpTransactionEvent;
14006
14007 /**
14008  * An Event which you should probably take some action in response to.
14009  *
14010  * Note that while Writeable and Readable are implemented for Event, you probably shouldn't use
14011  * them directly as they don't round-trip exactly (for example FundingGenerationReady is never
14012  * written as it makes no sense to respond to it after reconnecting to peers).
14013  */
14014 typedef enum LDKEvent_Tag {
14015    /**
14016     * Used to indicate that the client should generate a funding transaction with the given
14017     * parameters and then call [`ChannelManager::funding_transaction_generated`].
14018     * Generated in [`ChannelManager`] message handling.
14019     * Note that *all inputs* in the funding transaction must spend SegWit outputs or your
14020     * counterparty can steal your funds!
14021     *
14022     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
14023     * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated
14024     */
14025    LDKEvent_FundingGenerationReady,
14026    /**
14027     * Indicates that we've been offered a payment and it needs to be claimed via calling
14028     * [`ChannelManager::claim_funds`] with the preimage given in [`PaymentPurpose`].
14029     *
14030     * Note that if the preimage is not known, you should call
14031     * [`ChannelManager::fail_htlc_backwards`] or [`ChannelManager::fail_htlc_backwards_with_reason`]
14032     * to free up resources for this HTLC and avoid network congestion.
14033     * If you fail to call either [`ChannelManager::claim_funds`], [`ChannelManager::fail_htlc_backwards`],
14034     * or [`ChannelManager::fail_htlc_backwards_with_reason`] within the HTLC's timeout, the HTLC will be
14035     * automatically failed.
14036     *
14037     * # Note
14038     * LDK will not stop an inbound payment from being paid multiple times, so multiple
14039     * `PaymentClaimable` events may be generated for the same payment. In such a case it is
14040     * polite (and required in the lightning specification) to fail the payment the second time
14041     * and give the sender their money back rather than accepting double payment.
14042     *
14043     * # Note
14044     * This event used to be called `PaymentReceived` in LDK versions 0.0.112 and earlier.
14045     *
14046     * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
14047     * [`ChannelManager::fail_htlc_backwards`]: crate::ln::channelmanager::ChannelManager::fail_htlc_backwards
14048     * [`ChannelManager::fail_htlc_backwards_with_reason`]: crate::ln::channelmanager::ChannelManager::fail_htlc_backwards_with_reason
14049     */
14050    LDKEvent_PaymentClaimable,
14051    /**
14052     * Indicates a payment has been claimed and we've received money!
14053     *
14054     * This most likely occurs when [`ChannelManager::claim_funds`] has been called in response
14055     * to an [`Event::PaymentClaimable`]. However, if we previously crashed during a
14056     * [`ChannelManager::claim_funds`] call you may see this event without a corresponding
14057     * [`Event::PaymentClaimable`] event.
14058     *
14059     * # Note
14060     * LDK will not stop an inbound payment from being paid multiple times, so multiple
14061     * `PaymentClaimable` events may be generated for the same payment. If you then call
14062     * [`ChannelManager::claim_funds`] twice for the same [`Event::PaymentClaimable`] you may get
14063     * multiple `PaymentClaimed` events.
14064     *
14065     * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
14066     */
14067    LDKEvent_PaymentClaimed,
14068    /**
14069     * Indicates an outbound payment we made succeeded (i.e. it made it all the way to its target
14070     * and we got back the payment preimage for it).
14071     *
14072     * Note for MPP payments: in rare cases, this event may be preceded by a `PaymentPathFailed`
14073     * event. In this situation, you SHOULD treat this payment as having succeeded.
14074     */
14075    LDKEvent_PaymentSent,
14076    /**
14077     * Indicates an outbound payment failed. Individual [`Event::PaymentPathFailed`] events
14078     * provide failure information for each path attempt in the payment, including retries.
14079     *
14080     * This event is provided once there are no further pending HTLCs for the payment and the
14081     * payment is no longer retryable, due either to the [`Retry`] provided or
14082     * [`ChannelManager::abandon_payment`] having been called for the corresponding payment.
14083     *
14084     * [`Retry`]: crate::ln::channelmanager::Retry
14085     * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
14086     */
14087    LDKEvent_PaymentFailed,
14088    /**
14089     * Indicates that a path for an outbound payment was successful.
14090     *
14091     * Always generated after [`Event::PaymentSent`] and thus useful for scoring channels. See
14092     * [`Event::PaymentSent`] for obtaining the payment preimage.
14093     */
14094    LDKEvent_PaymentPathSuccessful,
14095    /**
14096     * Indicates an outbound HTLC we sent failed, likely due to an intermediary node being unable to
14097     * handle the HTLC.
14098     *
14099     * Note that this does *not* indicate that all paths for an MPP payment have failed, see
14100     * [`Event::PaymentFailed`].
14101     *
14102     * See [`ChannelManager::abandon_payment`] for giving up on this payment before its retries have
14103     * been exhausted.
14104     *
14105     * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
14106     */
14107    LDKEvent_PaymentPathFailed,
14108    /**
14109     * Indicates that a probe payment we sent returned successful, i.e., only failed at the destination.
14110     */
14111    LDKEvent_ProbeSuccessful,
14112    /**
14113     * Indicates that a probe payment we sent failed at an intermediary node on the path.
14114     */
14115    LDKEvent_ProbeFailed,
14116    /**
14117     * Used to indicate that [`ChannelManager::process_pending_htlc_forwards`] should be called at
14118     * a time in the future.
14119     *
14120     * [`ChannelManager::process_pending_htlc_forwards`]: crate::ln::channelmanager::ChannelManager::process_pending_htlc_forwards
14121     */
14122    LDKEvent_PendingHTLCsForwardable,
14123    /**
14124     * Used to indicate that we've intercepted an HTLC forward. This event will only be generated if
14125     * you've encoded an intercept scid in the receiver's invoice route hints using
14126     * [`ChannelManager::get_intercept_scid`] and have set [`UserConfig::accept_intercept_htlcs`].
14127     *
14128     * [`ChannelManager::forward_intercepted_htlc`] or
14129     * [`ChannelManager::fail_intercepted_htlc`] MUST be called in response to this event. See
14130     * their docs for more information.
14131     *
14132     * [`ChannelManager::get_intercept_scid`]: crate::ln::channelmanager::ChannelManager::get_intercept_scid
14133     * [`UserConfig::accept_intercept_htlcs`]: crate::util::config::UserConfig::accept_intercept_htlcs
14134     * [`ChannelManager::forward_intercepted_htlc`]: crate::ln::channelmanager::ChannelManager::forward_intercepted_htlc
14135     * [`ChannelManager::fail_intercepted_htlc`]: crate::ln::channelmanager::ChannelManager::fail_intercepted_htlc
14136     */
14137    LDKEvent_HTLCIntercepted,
14138    /**
14139     * Used to indicate that an output which you should know how to spend was confirmed on chain
14140     * and is now spendable.
14141     * Such an output will *not* ever be spent by rust-lightning, and are not at risk of your
14142     * counterparty spending them due to some kind of timeout. Thus, you need to store them
14143     * somewhere and spend them when you create on-chain transactions.
14144     */
14145    LDKEvent_SpendableOutputs,
14146    /**
14147     * This event is generated when a payment has been successfully forwarded through us and a
14148     * forwarding fee earned.
14149     */
14150    LDKEvent_PaymentForwarded,
14151    /**
14152     * Used to indicate that a channel with the given `channel_id` is being opened and pending
14153     * confirmation on-chain.
14154     *
14155     * This event is emitted when the funding transaction has been signed and is broadcast to the
14156     * network. For 0conf channels it will be immediately followed by the corresponding
14157     * [`Event::ChannelReady`] event.
14158     */
14159    LDKEvent_ChannelPending,
14160    /**
14161     * Used to indicate that a channel with the given `channel_id` is ready to
14162     * be used. This event is emitted either when the funding transaction has been confirmed
14163     * on-chain, or, in case of a 0conf channel, when both parties have confirmed the channel
14164     * establishment.
14165     */
14166    LDKEvent_ChannelReady,
14167    /**
14168     * Used to indicate that a previously opened channel with the given `channel_id` is in the
14169     * process of closure.
14170     */
14171    LDKEvent_ChannelClosed,
14172    /**
14173     * Used to indicate to the user that they can abandon the funding transaction and recycle the
14174     * inputs for another purpose.
14175     */
14176    LDKEvent_DiscardFunding,
14177    /**
14178     * Indicates a request to open a new channel by a peer.
14179     *
14180     * To accept the request, call [`ChannelManager::accept_inbound_channel`]. To reject the
14181     * request, call [`ChannelManager::force_close_without_broadcasting_txn`].
14182     *
14183     * The event is only triggered when a new open channel request is received and the
14184     * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true.
14185     *
14186     * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
14187     * [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn
14188     * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
14189     */
14190    LDKEvent_OpenChannelRequest,
14191    /**
14192     * Indicates that the HTLC was accepted, but could not be processed when or after attempting to
14193     * forward it.
14194     *
14195     * Some scenarios where this event may be sent include:
14196     * * Insufficient capacity in the outbound channel
14197     * * While waiting to forward the HTLC, the channel it is meant to be forwarded through closes
14198     * * When an unknown SCID is requested for forwarding a payment.
14199     * * Expected MPP amount has already been reached
14200     * * The HTLC has timed out
14201     *
14202     * This event, however, does not get generated if an HTLC fails to meet the forwarding
14203     * requirements (i.e. insufficient fees paid, or a CLTV that is too soon).
14204     */
14205    LDKEvent_HTLCHandlingFailed,
14206    /**
14207     * Indicates that a transaction originating from LDK needs to have its fee bumped. This event
14208     * requires confirmed external funds to be readily available to spend.
14209     *
14210     * LDK does not currently generate this event unless the
14211     * [`ChannelHandshakeConfig::negotiate_anchors_zero_fee_htlc_tx`] config flag is set to true.
14212     * It is limited to the scope of channels with anchor outputs.
14213     *
14214     * [`ChannelHandshakeConfig::negotiate_anchors_zero_fee_htlc_tx`]: crate::util::config::ChannelHandshakeConfig::negotiate_anchors_zero_fee_htlc_tx
14215     */
14216    LDKEvent_BumpTransaction,
14217    /**
14218     * Must be last for serialization purposes
14219     */
14220    LDKEvent_Sentinel,
14221 } LDKEvent_Tag;
14222
14223 typedef struct LDKEvent_LDKFundingGenerationReady_Body {
14224    /**
14225     * The random channel_id we picked which you'll need to pass into
14226     * [`ChannelManager::funding_transaction_generated`].
14227     *
14228     * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated
14229     */
14230    struct LDKThirtyTwoBytes temporary_channel_id;
14231    /**
14232     * The counterparty's node_id, which you'll need to pass back into
14233     * [`ChannelManager::funding_transaction_generated`].
14234     *
14235     * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated
14236     */
14237    struct LDKPublicKey counterparty_node_id;
14238    /**
14239     * The value, in satoshis, that the output should have.
14240     */
14241    uint64_t channel_value_satoshis;
14242    /**
14243     * The script which should be used in the transaction output.
14244     */
14245    struct LDKCVec_u8Z output_script;
14246    /**
14247     * The `user_channel_id` value passed in to [`ChannelManager::create_channel`], or a
14248     * random value for an inbound channel. This may be zero for objects serialized with LDK
14249     * versions prior to 0.0.113.
14250     *
14251     * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
14252     */
14253    struct LDKU128 user_channel_id;
14254 } LDKEvent_LDKFundingGenerationReady_Body;
14255
14256 typedef struct LDKEvent_LDKPaymentClaimable_Body {
14257    /**
14258     * The node that will receive the payment after it has been claimed.
14259     * This is useful to identify payments received via [phantom nodes].
14260     * This field will always be filled in when the event was generated by LDK versions
14261     * 0.0.113 and above.
14262     *
14263     * [phantom nodes]: crate::sign::PhantomKeysManager
14264     *
14265     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
14266     */
14267    struct LDKPublicKey receiver_node_id;
14268    /**
14269     * The hash for which the preimage should be handed to the ChannelManager. Note that LDK will
14270     * not stop you from registering duplicate payment hashes for inbound payments.
14271     */
14272    struct LDKThirtyTwoBytes payment_hash;
14273    /**
14274     * The fields in the onion which were received with each HTLC. Only fields which were
14275     * identical in each HTLC involved in the payment will be included here.
14276     *
14277     * Payments received on LDK versions prior to 0.0.115 will have this field unset.
14278     *
14279     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
14280     */
14281    struct LDKRecipientOnionFields onion_fields;
14282    /**
14283     * The value, in thousandths of a satoshi, that this payment is claimable for. May be greater
14284     * than the invoice amount.
14285     *
14286     * May be less than the invoice amount if [`ChannelConfig::accept_underpaying_htlcs`] is set
14287     * and the previous hop took an extra fee.
14288     *
14289     * # Note
14290     * If [`ChannelConfig::accept_underpaying_htlcs`] is set and you claim without verifying this
14291     * field, you may lose money!
14292     *
14293     * [`ChannelConfig::accept_underpaying_htlcs`]: crate::util::config::ChannelConfig::accept_underpaying_htlcs
14294     */
14295    uint64_t amount_msat;
14296    /**
14297     * The value, in thousands of a satoshi, that was skimmed off of this payment as an extra fee
14298     * taken by our channel counterparty.
14299     *
14300     * Will always be 0 unless [`ChannelConfig::accept_underpaying_htlcs`] is set.
14301     *
14302     * [`ChannelConfig::accept_underpaying_htlcs`]: crate::util::config::ChannelConfig::accept_underpaying_htlcs
14303     */
14304    uint64_t counterparty_skimmed_fee_msat;
14305    /**
14306     * Information for claiming this received payment, based on whether the purpose of the
14307     * payment is to pay an invoice or to send a spontaneous payment.
14308     */
14309    struct LDKPaymentPurpose purpose;
14310    /**
14311     * The `channel_id` indicating over which channel we received the payment.
14312     *
14313     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
14314     */
14315    struct LDKThirtyTwoBytes via_channel_id;
14316    /**
14317     * The `user_channel_id` indicating over which channel we received the payment.
14318     */
14319    struct LDKCOption_u128Z via_user_channel_id;
14320    /**
14321     * The block height at which this payment will be failed back and will no longer be
14322     * eligible for claiming.
14323     *
14324     * Prior to this height, a call to [`ChannelManager::claim_funds`] is guaranteed to
14325     * succeed, however you should wait for [`Event::PaymentClaimed`] to be sure.
14326     *
14327     * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
14328     */
14329    struct LDKCOption_u32Z claim_deadline;
14330 } LDKEvent_LDKPaymentClaimable_Body;
14331
14332 typedef struct LDKEvent_LDKPaymentClaimed_Body {
14333    /**
14334     * The node that received the payment.
14335     * This is useful to identify payments which were received via [phantom nodes].
14336     * This field will always be filled in when the event was generated by LDK versions
14337     * 0.0.113 and above.
14338     *
14339     * [phantom nodes]: crate::sign::PhantomKeysManager
14340     *
14341     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
14342     */
14343    struct LDKPublicKey receiver_node_id;
14344    /**
14345     * The payment hash of the claimed payment. Note that LDK will not stop you from
14346     * registering duplicate payment hashes for inbound payments.
14347     */
14348    struct LDKThirtyTwoBytes payment_hash;
14349    /**
14350     * The value, in thousandths of a satoshi, that this payment is for. May be greater than the
14351     * invoice amount.
14352     */
14353    uint64_t amount_msat;
14354    /**
14355     * The purpose of the claimed payment, i.e. whether the payment was for an invoice or a
14356     * spontaneous payment.
14357     */
14358    struct LDKPaymentPurpose purpose;
14359 } LDKEvent_LDKPaymentClaimed_Body;
14360
14361 typedef struct LDKEvent_LDKPaymentSent_Body {
14362    /**
14363     * The `payment_id` passed to [`ChannelManager::send_payment`].
14364     *
14365     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
14366     */
14367    struct LDKCOption_PaymentIdZ payment_id;
14368    /**
14369     * The preimage to the hash given to ChannelManager::send_payment.
14370     * Note that this serves as a payment receipt, if you wish to have such a thing, you must
14371     * store it somehow!
14372     */
14373    struct LDKThirtyTwoBytes payment_preimage;
14374    /**
14375     * The hash that was given to [`ChannelManager::send_payment`].
14376     *
14377     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
14378     */
14379    struct LDKThirtyTwoBytes payment_hash;
14380    /**
14381     * The total fee which was spent at intermediate hops in this payment, across all paths.
14382     *
14383     * Note that, like [`Route::get_total_fees`] this does *not* include any potential
14384     * overpayment to the recipient node.
14385     *
14386     * If the recipient or an intermediate node misbehaves and gives us free money, this may
14387     * overstate the amount paid, though this is unlikely.
14388     *
14389     * [`Route::get_total_fees`]: crate::routing::router::Route::get_total_fees
14390     */
14391    struct LDKCOption_u64Z fee_paid_msat;
14392 } LDKEvent_LDKPaymentSent_Body;
14393
14394 typedef struct LDKEvent_LDKPaymentFailed_Body {
14395    /**
14396     * The `payment_id` passed to [`ChannelManager::send_payment`].
14397     *
14398     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
14399     */
14400    struct LDKThirtyTwoBytes payment_id;
14401    /**
14402     * The hash that was given to [`ChannelManager::send_payment`].
14403     *
14404     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
14405     */
14406    struct LDKThirtyTwoBytes payment_hash;
14407    /**
14408     * The reason the payment failed. This is only `None` for events generated or serialized
14409     * by versions prior to 0.0.115.
14410     */
14411    struct LDKCOption_PaymentFailureReasonZ reason;
14412 } LDKEvent_LDKPaymentFailed_Body;
14413
14414 typedef struct LDKEvent_LDKPaymentPathSuccessful_Body {
14415    /**
14416     * The `payment_id` passed to [`ChannelManager::send_payment`].
14417     *
14418     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
14419     */
14420    struct LDKThirtyTwoBytes payment_id;
14421    /**
14422     * The hash that was given to [`ChannelManager::send_payment`].
14423     *
14424     * This will be `Some` for all payments which completed on LDK 0.0.104 or later.
14425     *
14426     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
14427     */
14428    struct LDKCOption_PaymentHashZ payment_hash;
14429    /**
14430     * The payment path that was successful.
14431     *
14432     * May contain a closed channel if the HTLC sent along the path was fulfilled on chain.
14433     */
14434    struct LDKPath path;
14435 } LDKEvent_LDKPaymentPathSuccessful_Body;
14436
14437 typedef struct LDKEvent_LDKPaymentPathFailed_Body {
14438    /**
14439     * The `payment_id` passed to [`ChannelManager::send_payment`].
14440     *
14441     * This will be `Some` for all payment paths which failed on LDK 0.0.103 or later.
14442     *
14443     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
14444     * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
14445     */
14446    struct LDKCOption_PaymentIdZ payment_id;
14447    /**
14448     * The hash that was given to [`ChannelManager::send_payment`].
14449     *
14450     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
14451     */
14452    struct LDKThirtyTwoBytes payment_hash;
14453    /**
14454     * Indicates the payment was rejected for some reason by the recipient. This implies that
14455     * the payment has failed, not just the route in question. If this is not set, the payment may
14456     * be retried via a different route.
14457     */
14458    bool payment_failed_permanently;
14459    /**
14460     * Extra error details based on the failure type. May contain an update that needs to be
14461     * applied to the [`NetworkGraph`].
14462     *
14463     * [`NetworkGraph`]: crate::routing::gossip::NetworkGraph
14464     */
14465    struct LDKPathFailure failure;
14466    /**
14467     * The payment path that failed.
14468     */
14469    struct LDKPath path;
14470    /**
14471     * The channel responsible for the failed payment path.
14472     *
14473     * Note that for route hints or for the first hop in a path this may be an SCID alias and
14474     * may not refer to a channel in the public network graph. These aliases may also collide
14475     * with channels in the public network graph.
14476     *
14477     * If this is `Some`, then the corresponding channel should be avoided when the payment is
14478     * retried. May be `None` for older [`Event`] serializations.
14479     */
14480    struct LDKCOption_u64Z short_channel_id;
14481 } LDKEvent_LDKPaymentPathFailed_Body;
14482
14483 typedef struct LDKEvent_LDKProbeSuccessful_Body {
14484    /**
14485     * The id returned by [`ChannelManager::send_probe`].
14486     *
14487     * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe
14488     */
14489    struct LDKThirtyTwoBytes payment_id;
14490    /**
14491     * The hash generated by [`ChannelManager::send_probe`].
14492     *
14493     * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe
14494     */
14495    struct LDKThirtyTwoBytes payment_hash;
14496    /**
14497     * The payment path that was successful.
14498     */
14499    struct LDKPath path;
14500 } LDKEvent_LDKProbeSuccessful_Body;
14501
14502 typedef struct LDKEvent_LDKProbeFailed_Body {
14503    /**
14504     * The id returned by [`ChannelManager::send_probe`].
14505     *
14506     * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe
14507     */
14508    struct LDKThirtyTwoBytes payment_id;
14509    /**
14510     * The hash generated by [`ChannelManager::send_probe`].
14511     *
14512     * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe
14513     */
14514    struct LDKThirtyTwoBytes payment_hash;
14515    /**
14516     * The payment path that failed.
14517     */
14518    struct LDKPath path;
14519    /**
14520     * The channel responsible for the failed probe.
14521     *
14522     * Note that for route hints or for the first hop in a path this may be an SCID alias and
14523     * may not refer to a channel in the public network graph. These aliases may also collide
14524     * with channels in the public network graph.
14525     */
14526    struct LDKCOption_u64Z short_channel_id;
14527 } LDKEvent_LDKProbeFailed_Body;
14528
14529 typedef struct LDKEvent_LDKPendingHTLCsForwardable_Body {
14530    /**
14531     * The minimum amount of time that should be waited prior to calling
14532     * process_pending_htlc_forwards. To increase the effort required to correlate payments,
14533     * you should wait a random amount of time in roughly the range (now + time_forwardable,
14534     * now + 5*time_forwardable).
14535     */
14536    uint64_t time_forwardable;
14537 } LDKEvent_LDKPendingHTLCsForwardable_Body;
14538
14539 typedef struct LDKEvent_LDKHTLCIntercepted_Body {
14540    /**
14541     * An id to help LDK identify which HTLC is being forwarded or failed.
14542     */
14543    struct LDKThirtyTwoBytes intercept_id;
14544    /**
14545     * The fake scid that was programmed as the next hop's scid, generated using
14546     * [`ChannelManager::get_intercept_scid`].
14547     *
14548     * [`ChannelManager::get_intercept_scid`]: crate::ln::channelmanager::ChannelManager::get_intercept_scid
14549     */
14550    uint64_t requested_next_hop_scid;
14551    /**
14552     * The payment hash used for this HTLC.
14553     */
14554    struct LDKThirtyTwoBytes payment_hash;
14555    /**
14556     * How many msats were received on the inbound edge of this HTLC.
14557     */
14558    uint64_t inbound_amount_msat;
14559    /**
14560     * How many msats the payer intended to route to the next node. Depending on the reason you are
14561     * intercepting this payment, you might take a fee by forwarding less than this amount.
14562     * Forwarding less than this amount may break compatibility with LDK versions prior to 0.0.116.
14563     *
14564     * Note that LDK will NOT check that expected fees were factored into this value. You MUST
14565     * check that whatever fee you want has been included here or subtract it as required. Further,
14566     * LDK will not stop you from forwarding more than you received.
14567     */
14568    uint64_t expected_outbound_amount_msat;
14569 } LDKEvent_LDKHTLCIntercepted_Body;
14570
14571 typedef struct LDKEvent_LDKSpendableOutputs_Body {
14572    /**
14573     * The outputs which you should store as spendable by you.
14574     */
14575    struct LDKCVec_SpendableOutputDescriptorZ outputs;
14576 } LDKEvent_LDKSpendableOutputs_Body;
14577
14578 typedef struct LDKEvent_LDKPaymentForwarded_Body {
14579    /**
14580     * The incoming channel between the previous node and us. This is only `None` for events
14581     * generated or serialized by versions prior to 0.0.107.
14582     *
14583     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
14584     */
14585    struct LDKThirtyTwoBytes prev_channel_id;
14586    /**
14587     * The outgoing channel between the next node and us. This is only `None` for events
14588     * generated or serialized by versions prior to 0.0.107.
14589     *
14590     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
14591     */
14592    struct LDKThirtyTwoBytes next_channel_id;
14593    /**
14594     * The fee, in milli-satoshis, which was earned as a result of the payment.
14595     *
14596     * Note that if we force-closed the channel over which we forwarded an HTLC while the HTLC
14597     * was pending, the amount the next hop claimed will have been rounded down to the nearest
14598     * whole satoshi. Thus, the fee calculated here may be higher than expected as we still
14599     * claimed the full value in millisatoshis from the source. In this case,
14600     * `claim_from_onchain_tx` will be set.
14601     *
14602     * If the channel which sent us the payment has been force-closed, we will claim the funds
14603     * via an on-chain transaction. In that case we do not yet know the on-chain transaction
14604     * fees which we will spend and will instead set this to `None`. It is possible duplicate
14605     * `PaymentForwarded` events are generated for the same payment iff `fee_earned_msat` is
14606     * `None`.
14607     */
14608    struct LDKCOption_u64Z fee_earned_msat;
14609    /**
14610     * If this is `true`, the forwarded HTLC was claimed by our counterparty via an on-chain
14611     * transaction.
14612     */
14613    bool claim_from_onchain_tx;
14614    /**
14615     * The final amount forwarded, in milli-satoshis, after the fee is deducted.
14616     *
14617     * The caveat described above the `fee_earned_msat` field applies here as well.
14618     */
14619    struct LDKCOption_u64Z outbound_amount_forwarded_msat;
14620 } LDKEvent_LDKPaymentForwarded_Body;
14621
14622 typedef struct LDKEvent_LDKChannelPending_Body {
14623    /**
14624     * The `channel_id` of the channel that is pending confirmation.
14625     */
14626    struct LDKThirtyTwoBytes channel_id;
14627    /**
14628     * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound
14629     * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if
14630     * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise
14631     * `user_channel_id` will be randomized for an inbound channel.
14632     *
14633     * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
14634     * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
14635     * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
14636     */
14637    struct LDKU128 user_channel_id;
14638    /**
14639     * The `temporary_channel_id` this channel used to be known by during channel establishment.
14640     *
14641     * Will be `None` for channels created prior to LDK version 0.0.115.
14642     *
14643     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
14644     */
14645    struct LDKThirtyTwoBytes former_temporary_channel_id;
14646    /**
14647     * The `node_id` of the channel counterparty.
14648     */
14649    struct LDKPublicKey counterparty_node_id;
14650    /**
14651     * The outpoint of the channel's funding transaction.
14652     */
14653    struct LDKOutPoint funding_txo;
14654 } LDKEvent_LDKChannelPending_Body;
14655
14656 typedef struct LDKEvent_LDKChannelReady_Body {
14657    /**
14658     * The `channel_id` of the channel that is ready.
14659     */
14660    struct LDKThirtyTwoBytes channel_id;
14661    /**
14662     * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound
14663     * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if
14664     * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise
14665     * `user_channel_id` will be randomized for an inbound channel.
14666     *
14667     * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
14668     * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
14669     * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
14670     */
14671    struct LDKU128 user_channel_id;
14672    /**
14673     * The `node_id` of the channel counterparty.
14674     */
14675    struct LDKPublicKey counterparty_node_id;
14676    /**
14677     * The features that this channel will operate with.
14678     */
14679    struct LDKChannelTypeFeatures channel_type;
14680 } LDKEvent_LDKChannelReady_Body;
14681
14682 typedef struct LDKEvent_LDKChannelClosed_Body {
14683    /**
14684     * The `channel_id` of the channel which has been closed. Note that on-chain transactions
14685     * resolving the channel are likely still awaiting confirmation.
14686     */
14687    struct LDKThirtyTwoBytes channel_id;
14688    /**
14689     * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound
14690     * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if
14691     * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise
14692     * `user_channel_id` will be randomized for inbound channels.
14693     * This may be zero for inbound channels serialized prior to 0.0.113 and will always be
14694     * zero for objects serialized with LDK versions prior to 0.0.102.
14695     *
14696     * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
14697     * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
14698     * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
14699     */
14700    struct LDKU128 user_channel_id;
14701    /**
14702     * The reason the channel was closed.
14703     */
14704    struct LDKClosureReason reason;
14705 } LDKEvent_LDKChannelClosed_Body;
14706
14707 typedef struct LDKEvent_LDKDiscardFunding_Body {
14708    /**
14709     * The channel_id of the channel which has been closed.
14710     */
14711    struct LDKThirtyTwoBytes channel_id;
14712    /**
14713     * The full transaction received from the user
14714     */
14715    struct LDKTransaction transaction;
14716 } LDKEvent_LDKDiscardFunding_Body;
14717
14718 typedef struct LDKEvent_LDKOpenChannelRequest_Body {
14719    /**
14720     * The temporary channel ID of the channel requested to be opened.
14721     *
14722     * When responding to the request, the `temporary_channel_id` should be passed
14723     * back to the ChannelManager through [`ChannelManager::accept_inbound_channel`] to accept,
14724     * or through [`ChannelManager::force_close_without_broadcasting_txn`] to reject.
14725     *
14726     * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
14727     * [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn
14728     */
14729    struct LDKThirtyTwoBytes temporary_channel_id;
14730    /**
14731     * The node_id of the counterparty requesting to open the channel.
14732     *
14733     * When responding to the request, the `counterparty_node_id` should be passed
14734     * back to the `ChannelManager` through [`ChannelManager::accept_inbound_channel`] to
14735     * accept the request, or through [`ChannelManager::force_close_without_broadcasting_txn`] to reject the
14736     * request.
14737     *
14738     * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
14739     * [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn
14740     */
14741    struct LDKPublicKey counterparty_node_id;
14742    /**
14743     * The channel value of the requested channel.
14744     */
14745    uint64_t funding_satoshis;
14746    /**
14747     * Our starting balance in the channel if the request is accepted, in milli-satoshi.
14748     */
14749    uint64_t push_msat;
14750    /**
14751     * The features that this channel will operate with. If you reject the channel, a
14752     * well-behaved counterparty may automatically re-attempt the channel with a new set of
14753     * feature flags.
14754     *
14755     * Note that if [`ChannelTypeFeatures::supports_scid_privacy`] returns true on this type,
14756     * the resulting [`ChannelManager`] will not be readable by versions of LDK prior to
14757     * 0.0.106.
14758     *
14759     * Furthermore, note that if [`ChannelTypeFeatures::supports_zero_conf`] returns true on this type,
14760     * the resulting [`ChannelManager`] will not be readable by versions of LDK prior to
14761     * 0.0.107. Channels setting this type also need to get manually accepted via
14762     * [`crate::ln::channelmanager::ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`],
14763     * or will be rejected otherwise.
14764     *
14765     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
14766     */
14767    struct LDKChannelTypeFeatures channel_type;
14768 } LDKEvent_LDKOpenChannelRequest_Body;
14769
14770 typedef struct LDKEvent_LDKHTLCHandlingFailed_Body {
14771    /**
14772     * The channel over which the HTLC was received.
14773     */
14774    struct LDKThirtyTwoBytes prev_channel_id;
14775    /**
14776     * Destination of the HTLC that failed to be processed.
14777     */
14778    struct LDKHTLCDestination failed_next_destination;
14779 } LDKEvent_LDKHTLCHandlingFailed_Body;
14780
14781 typedef struct MUST_USE_STRUCT LDKEvent {
14782    LDKEvent_Tag tag;
14783    union {
14784       LDKEvent_LDKFundingGenerationReady_Body funding_generation_ready;
14785       LDKEvent_LDKPaymentClaimable_Body payment_claimable;
14786       LDKEvent_LDKPaymentClaimed_Body payment_claimed;
14787       LDKEvent_LDKPaymentSent_Body payment_sent;
14788       LDKEvent_LDKPaymentFailed_Body payment_failed;
14789       LDKEvent_LDKPaymentPathSuccessful_Body payment_path_successful;
14790       LDKEvent_LDKPaymentPathFailed_Body payment_path_failed;
14791       LDKEvent_LDKProbeSuccessful_Body probe_successful;
14792       LDKEvent_LDKProbeFailed_Body probe_failed;
14793       LDKEvent_LDKPendingHTLCsForwardable_Body pending_htl_cs_forwardable;
14794       LDKEvent_LDKHTLCIntercepted_Body htlc_intercepted;
14795       LDKEvent_LDKSpendableOutputs_Body spendable_outputs;
14796       LDKEvent_LDKPaymentForwarded_Body payment_forwarded;
14797       LDKEvent_LDKChannelPending_Body channel_pending;
14798       LDKEvent_LDKChannelReady_Body channel_ready;
14799       LDKEvent_LDKChannelClosed_Body channel_closed;
14800       LDKEvent_LDKDiscardFunding_Body discard_funding;
14801       LDKEvent_LDKOpenChannelRequest_Body open_channel_request;
14802       LDKEvent_LDKHTLCHandlingFailed_Body htlc_handling_failed;
14803       struct {
14804          struct LDKBumpTransactionEvent bump_transaction;
14805       };
14806    };
14807 } LDKEvent;
14808
14809 /**
14810  * An enum which can either contain a crate::lightning::events::Event or not
14811  */
14812 typedef enum LDKCOption_EventZ_Tag {
14813    /**
14814     * When we're in this state, this COption_EventZ contains a crate::lightning::events::Event
14815     */
14816    LDKCOption_EventZ_Some,
14817    /**
14818     * When we're in this state, this COption_EventZ contains nothing
14819     */
14820    LDKCOption_EventZ_None,
14821    /**
14822     * Must be last for serialization purposes
14823     */
14824    LDKCOption_EventZ_Sentinel,
14825 } LDKCOption_EventZ_Tag;
14826
14827 typedef struct LDKCOption_EventZ {
14828    LDKCOption_EventZ_Tag tag;
14829    union {
14830       struct {
14831          struct LDKEvent some;
14832       };
14833    };
14834 } LDKCOption_EventZ;
14835
14836 /**
14837  * The contents of CResult_COption_EventZDecodeErrorZ
14838  */
14839 typedef union LDKCResult_COption_EventZDecodeErrorZPtr {
14840    /**
14841     * A pointer to the contents in the success state.
14842     * Reading from this pointer when `result_ok` is not set is undefined.
14843     */
14844    struct LDKCOption_EventZ *result;
14845    /**
14846     * A pointer to the contents in the error state.
14847     * Reading from this pointer when `result_ok` is set is undefined.
14848     */
14849    struct LDKDecodeError *err;
14850 } LDKCResult_COption_EventZDecodeErrorZPtr;
14851
14852 /**
14853  * A CResult_COption_EventZDecodeErrorZ represents the result of a fallible operation,
14854  * containing a crate::c_types::derived::COption_EventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
14855  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
14856  */
14857 typedef struct LDKCResult_COption_EventZDecodeErrorZ {
14858    /**
14859     * The contents of this CResult_COption_EventZDecodeErrorZ, accessible via either
14860     * `err` or `result` depending on the state of `result_ok`.
14861     */
14862    union LDKCResult_COption_EventZDecodeErrorZPtr contents;
14863    /**
14864     * Whether this CResult_COption_EventZDecodeErrorZ represents a success state.
14865     */
14866    bool result_ok;
14867 } LDKCResult_COption_EventZDecodeErrorZ;
14868
14869 /**
14870  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
14871  * This corresponds to std::vector in C++
14872  */
14873 typedef struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ {
14874    /**
14875     * The elements in the array.
14876     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
14877     */
14878    struct LDKC2Tuple_BlockHashChannelMonitorZ *data;
14879    /**
14880     * The number of elements pointed to by `data`.
14881     */
14882    uintptr_t datalen;
14883 } LDKCVec_C2Tuple_BlockHashChannelMonitorZZ;
14884
14885 /**
14886  * The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
14887  */
14888 typedef union LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
14889    /**
14890     * A pointer to the contents in the success state.
14891     * Reading from this pointer when `result_ok` is not set is undefined.
14892     */
14893    struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *result;
14894    /**
14895     * A pointer to the contents in the error state.
14896     * Reading from this pointer when `result_ok` is set is undefined.
14897     */
14898    enum LDKIOError *err;
14899 } LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr;
14900
14901 /**
14902  * A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
14903  * containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
14904  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
14905  */
14906 typedef struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
14907    /**
14908     * The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
14909     * `err` or `result` depending on the state of `result_ok`.
14910     */
14911    union LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr contents;
14912    /**
14913     * Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
14914     */
14915    bool result_ok;
14916 } LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ;
14917
14918 /**
14919  * Sub-errors which don't have specific information in them use this type.
14920  */
14921 typedef struct LDKError {
14922    /**
14923     * Zero-Sized_types aren't consistent across Rust/C/C++, so we add some size here
14924     */
14925    uint8_t _dummy;
14926 } LDKError;
14927
14928 /**
14929  * Errors that indicate what is wrong with the invoice. They have some granularity for debug
14930  * reasons, but should generally result in an \"invalid BOLT11 invoice\" message for the user.
14931  */
14932 typedef enum LDKBolt11ParseError_Tag {
14933    LDKBolt11ParseError_Bech32Error,
14934    LDKBolt11ParseError_ParseAmountError,
14935    LDKBolt11ParseError_MalformedSignature,
14936    LDKBolt11ParseError_BadPrefix,
14937    LDKBolt11ParseError_UnknownCurrency,
14938    LDKBolt11ParseError_UnknownSiPrefix,
14939    LDKBolt11ParseError_MalformedHRP,
14940    LDKBolt11ParseError_TooShortDataPart,
14941    LDKBolt11ParseError_UnexpectedEndOfTaggedFields,
14942    LDKBolt11ParseError_DescriptionDecodeError,
14943    LDKBolt11ParseError_PaddingError,
14944    LDKBolt11ParseError_IntegerOverflowError,
14945    LDKBolt11ParseError_InvalidSegWitProgramLength,
14946    LDKBolt11ParseError_InvalidPubKeyHashLength,
14947    LDKBolt11ParseError_InvalidScriptHashLength,
14948    LDKBolt11ParseError_InvalidRecoveryId,
14949    LDKBolt11ParseError_InvalidSliceLength,
14950    /**
14951     * Not an error, but used internally to signal that a part of the invoice should be ignored
14952     * according to BOLT11
14953     */
14954    LDKBolt11ParseError_Skip,
14955    /**
14956     * Must be last for serialization purposes
14957     */
14958    LDKBolt11ParseError_Sentinel,
14959 } LDKBolt11ParseError_Tag;
14960
14961 typedef struct MUST_USE_STRUCT LDKBolt11ParseError {
14962    LDKBolt11ParseError_Tag tag;
14963    union {
14964       struct {
14965          struct LDKBech32Error bech32_error;
14966       };
14967       struct {
14968          struct LDKError parse_amount_error;
14969       };
14970       struct {
14971          enum LDKSecp256k1Error malformed_signature;
14972       };
14973       struct {
14974          struct LDKError description_decode_error;
14975       };
14976       struct {
14977          struct LDKStr invalid_slice_length;
14978       };
14979    };
14980 } LDKBolt11ParseError;
14981
14982 /**
14983  * The contents of CResult_SiPrefixBolt11ParseErrorZ
14984  */
14985 typedef union LDKCResult_SiPrefixBolt11ParseErrorZPtr {
14986    /**
14987     * A pointer to the contents in the success state.
14988     * Reading from this pointer when `result_ok` is not set is undefined.
14989     */
14990    enum LDKSiPrefix *result;
14991    /**
14992     * A pointer to the contents in the error state.
14993     * Reading from this pointer when `result_ok` is set is undefined.
14994     */
14995    struct LDKBolt11ParseError *err;
14996 } LDKCResult_SiPrefixBolt11ParseErrorZPtr;
14997
14998 /**
14999  * A CResult_SiPrefixBolt11ParseErrorZ represents the result of a fallible operation,
15000  * containing a crate::lightning_invoice::SiPrefix on success and a crate::lightning_invoice::Bolt11ParseError on failure.
15001  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
15002  */
15003 typedef struct LDKCResult_SiPrefixBolt11ParseErrorZ {
15004    /**
15005     * The contents of this CResult_SiPrefixBolt11ParseErrorZ, accessible via either
15006     * `err` or `result` depending on the state of `result_ok`.
15007     */
15008    union LDKCResult_SiPrefixBolt11ParseErrorZPtr contents;
15009    /**
15010     * Whether this CResult_SiPrefixBolt11ParseErrorZ represents a success state.
15011     */
15012    bool result_ok;
15013 } LDKCResult_SiPrefixBolt11ParseErrorZ;
15014
15015 /**
15016  * Indicates that something went wrong while parsing or validating the invoice. Parsing errors
15017  * should be mostly seen as opaque and are only there for debugging reasons. Semantic errors
15018  * like wrong signatures, missing fields etc. could mean that someone tampered with the invoice.
15019  */
15020 typedef enum LDKParseOrSemanticError_Tag {
15021    /**
15022     * The invoice couldn't be decoded
15023     */
15024    LDKParseOrSemanticError_ParseError,
15025    /**
15026     * The invoice could be decoded but violates the BOLT11 standard
15027     */
15028    LDKParseOrSemanticError_SemanticError,
15029    /**
15030     * Must be last for serialization purposes
15031     */
15032    LDKParseOrSemanticError_Sentinel,
15033 } LDKParseOrSemanticError_Tag;
15034
15035 typedef struct MUST_USE_STRUCT LDKParseOrSemanticError {
15036    LDKParseOrSemanticError_Tag tag;
15037    union {
15038       struct {
15039          struct LDKBolt11ParseError parse_error;
15040       };
15041       struct {
15042          enum LDKBolt11SemanticError semantic_error;
15043       };
15044    };
15045 } LDKParseOrSemanticError;
15046
15047 /**
15048  * The contents of CResult_Bolt11InvoiceParseOrSemanticErrorZ
15049  */
15050 typedef union LDKCResult_Bolt11InvoiceParseOrSemanticErrorZPtr {
15051    /**
15052     * A pointer to the contents in the success state.
15053     * Reading from this pointer when `result_ok` is not set is undefined.
15054     */
15055    struct LDKBolt11Invoice *result;
15056    /**
15057     * A pointer to the contents in the error state.
15058     * Reading from this pointer when `result_ok` is set is undefined.
15059     */
15060    struct LDKParseOrSemanticError *err;
15061 } LDKCResult_Bolt11InvoiceParseOrSemanticErrorZPtr;
15062
15063 /**
15064  * A CResult_Bolt11InvoiceParseOrSemanticErrorZ represents the result of a fallible operation,
15065  * containing a crate::lightning_invoice::Bolt11Invoice on success and a crate::lightning_invoice::ParseOrSemanticError on failure.
15066  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
15067  */
15068 typedef struct LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ {
15069    /**
15070     * The contents of this CResult_Bolt11InvoiceParseOrSemanticErrorZ, accessible via either
15071     * `err` or `result` depending on the state of `result_ok`.
15072     */
15073    union LDKCResult_Bolt11InvoiceParseOrSemanticErrorZPtr contents;
15074    /**
15075     * Whether this CResult_Bolt11InvoiceParseOrSemanticErrorZ represents a success state.
15076     */
15077    bool result_ok;
15078 } LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ;
15079
15080
15081
15082 /**
15083  * Represents a signed [`RawBolt11Invoice`] with cached hash. The signature is not checked and may be
15084  * invalid.
15085  *
15086  * # Invariants
15087  * The hash has to be either from the deserialized invoice or from the serialized [`RawBolt11Invoice`].
15088  */
15089 typedef struct MUST_USE_STRUCT LDKSignedRawBolt11Invoice {
15090    /**
15091     * A pointer to the opaque Rust object.
15092     * Nearly everywhere, inner must be non-null, however in places where
15093     * the Rust equivalent takes an Option, it may be set to null to indicate None.
15094     */
15095    LDKnativeSignedRawBolt11Invoice *inner;
15096    /**
15097     * Indicates that this is the only struct which contains the same pointer.
15098     * Rust functions which take ownership of an object provided via an argument require
15099     * this to be true and invalidate the object pointed to by inner.
15100     */
15101    bool is_owned;
15102 } LDKSignedRawBolt11Invoice;
15103
15104 /**
15105  * The contents of CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ
15106  */
15107 typedef union LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr {
15108    /**
15109     * A pointer to the contents in the success state.
15110     * Reading from this pointer when `result_ok` is not set is undefined.
15111     */
15112    struct LDKSignedRawBolt11Invoice *result;
15113    /**
15114     * A pointer to the contents in the error state.
15115     * Reading from this pointer when `result_ok` is set is undefined.
15116     */
15117    struct LDKBolt11ParseError *err;
15118 } LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr;
15119
15120 /**
15121  * A CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ represents the result of a fallible operation,
15122  * containing a crate::lightning_invoice::SignedRawBolt11Invoice on success and a crate::lightning_invoice::Bolt11ParseError on failure.
15123  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
15124  */
15125 typedef struct LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
15126    /**
15127     * The contents of this CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ, accessible via either
15128     * `err` or `result` depending on the state of `result_ok`.
15129     */
15130    union LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr contents;
15131    /**
15132     * Whether this CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ represents a success state.
15133     */
15134    bool result_ok;
15135 } LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ;
15136
15137
15138
15139 /**
15140  * Represents an syntactically correct [`Bolt11Invoice`] for a payment on the lightning network,
15141  * but without the signature information.
15142  * Decoding and encoding should not lead to information loss but may lead to different hashes.
15143  *
15144  * For methods without docs see the corresponding methods in [`Bolt11Invoice`].
15145  */
15146 typedef struct MUST_USE_STRUCT LDKRawBolt11Invoice {
15147    /**
15148     * A pointer to the opaque Rust object.
15149     * Nearly everywhere, inner must be non-null, however in places where
15150     * the Rust equivalent takes an Option, it may be set to null to indicate None.
15151     */
15152    LDKnativeRawBolt11Invoice *inner;
15153    /**
15154     * Indicates that this is the only struct which contains the same pointer.
15155     * Rust functions which take ownership of an object provided via an argument require
15156     * this to be true and invalidate the object pointed to by inner.
15157     */
15158    bool is_owned;
15159 } LDKRawBolt11Invoice;
15160
15161
15162
15163 /**
15164  * Recoverable signature
15165  */
15166 typedef struct MUST_USE_STRUCT LDKBolt11InvoiceSignature {
15167    /**
15168     * A pointer to the opaque Rust object.
15169     * Nearly everywhere, inner must be non-null, however in places where
15170     * the Rust equivalent takes an Option, it may be set to null to indicate None.
15171     */
15172    LDKnativeBolt11InvoiceSignature *inner;
15173    /**
15174     * Indicates that this is the only struct which contains the same pointer.
15175     * Rust functions which take ownership of an object provided via an argument require
15176     * this to be true and invalidate the object pointed to by inner.
15177     */
15178    bool is_owned;
15179 } LDKBolt11InvoiceSignature;
15180
15181 /**
15182  * A tuple of 3 elements. See the individual fields for the types contained.
15183  */
15184 typedef struct LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ {
15185    /**
15186     * The element at position 0
15187     */
15188    struct LDKRawBolt11Invoice a;
15189    /**
15190     * The element at position 1
15191     */
15192    struct LDKThirtyTwoBytes b;
15193    /**
15194     * The element at position 2
15195     */
15196    struct LDKBolt11InvoiceSignature c;
15197 } LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ;
15198
15199
15200
15201 /**
15202  * Payee public key
15203  */
15204 typedef struct MUST_USE_STRUCT LDKPayeePubKey {
15205    /**
15206     * A pointer to the opaque Rust object.
15207     * Nearly everywhere, inner must be non-null, however in places where
15208     * the Rust equivalent takes an Option, it may be set to null to indicate None.
15209     */
15210    LDKnativePayeePubKey *inner;
15211    /**
15212     * Indicates that this is the only struct which contains the same pointer.
15213     * Rust functions which take ownership of an object provided via an argument require
15214     * this to be true and invalidate the object pointed to by inner.
15215     */
15216    bool is_owned;
15217 } LDKPayeePubKey;
15218
15219 /**
15220  * The contents of CResult_PayeePubKeyErrorZ
15221  */
15222 typedef union LDKCResult_PayeePubKeyErrorZPtr {
15223    /**
15224     * A pointer to the contents in the success state.
15225     * Reading from this pointer when `result_ok` is not set is undefined.
15226     */
15227    struct LDKPayeePubKey *result;
15228    /**
15229     * A pointer to the contents in the error state.
15230     * Reading from this pointer when `result_ok` is set is undefined.
15231     */
15232    enum LDKSecp256k1Error *err;
15233 } LDKCResult_PayeePubKeyErrorZPtr;
15234
15235 /**
15236  * A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
15237  * containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
15238  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
15239  */
15240 typedef struct LDKCResult_PayeePubKeyErrorZ {
15241    /**
15242     * The contents of this CResult_PayeePubKeyErrorZ, accessible via either
15243     * `err` or `result` depending on the state of `result_ok`.
15244     */
15245    union LDKCResult_PayeePubKeyErrorZPtr contents;
15246    /**
15247     * Whether this CResult_PayeePubKeyErrorZ represents a success state.
15248     */
15249    bool result_ok;
15250 } LDKCResult_PayeePubKeyErrorZ;
15251
15252
15253
15254 /**
15255  * Private routing information
15256  *
15257  * # Invariants
15258  * The encoded route has to be <1024 5bit characters long (<=639 bytes or <=12 hops)
15259  *
15260  */
15261 typedef struct MUST_USE_STRUCT LDKPrivateRoute {
15262    /**
15263     * A pointer to the opaque Rust object.
15264     * Nearly everywhere, inner must be non-null, however in places where
15265     * the Rust equivalent takes an Option, it may be set to null to indicate None.
15266     */
15267    LDKnativePrivateRoute *inner;
15268    /**
15269     * Indicates that this is the only struct which contains the same pointer.
15270     * Rust functions which take ownership of an object provided via an argument require
15271     * this to be true and invalidate the object pointed to by inner.
15272     */
15273    bool is_owned;
15274 } LDKPrivateRoute;
15275
15276 /**
15277  * A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
15278  * This corresponds to std::vector in C++
15279  */
15280 typedef struct LDKCVec_PrivateRouteZ {
15281    /**
15282     * The elements in the array.
15283     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
15284     */
15285    struct LDKPrivateRoute *data;
15286    /**
15287     * The number of elements pointed to by `data`.
15288     */
15289    uintptr_t datalen;
15290 } LDKCVec_PrivateRouteZ;
15291
15292
15293
15294 /**
15295  * A timestamp that refers to a date after 1 January 1970.
15296  *
15297  * # Invariants
15298  *
15299  * The Unix timestamp representing the stored time has to be positive and no greater than
15300  * [`MAX_TIMESTAMP`].
15301  */
15302 typedef struct MUST_USE_STRUCT LDKPositiveTimestamp {
15303    /**
15304     * A pointer to the opaque Rust object.
15305     * Nearly everywhere, inner must be non-null, however in places where
15306     * the Rust equivalent takes an Option, it may be set to null to indicate None.
15307     */
15308    LDKnativePositiveTimestamp *inner;
15309    /**
15310     * Indicates that this is the only struct which contains the same pointer.
15311     * Rust functions which take ownership of an object provided via an argument require
15312     * this to be true and invalidate the object pointed to by inner.
15313     */
15314    bool is_owned;
15315 } LDKPositiveTimestamp;
15316
15317 /**
15318  * The contents of CResult_PositiveTimestampCreationErrorZ
15319  */
15320 typedef union LDKCResult_PositiveTimestampCreationErrorZPtr {
15321    /**
15322     * A pointer to the contents in the success state.
15323     * Reading from this pointer when `result_ok` is not set is undefined.
15324     */
15325    struct LDKPositiveTimestamp *result;
15326    /**
15327     * A pointer to the contents in the error state.
15328     * Reading from this pointer when `result_ok` is set is undefined.
15329     */
15330    enum LDKCreationError *err;
15331 } LDKCResult_PositiveTimestampCreationErrorZPtr;
15332
15333 /**
15334  * A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
15335  * containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
15336  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
15337  */
15338 typedef struct LDKCResult_PositiveTimestampCreationErrorZ {
15339    /**
15340     * The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
15341     * `err` or `result` depending on the state of `result_ok`.
15342     */
15343    union LDKCResult_PositiveTimestampCreationErrorZPtr contents;
15344    /**
15345     * Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
15346     */
15347    bool result_ok;
15348 } LDKCResult_PositiveTimestampCreationErrorZ;
15349
15350 /**
15351  * The contents of CResult_NoneBolt11SemanticErrorZ
15352  */
15353 typedef union LDKCResult_NoneBolt11SemanticErrorZPtr {
15354    /**
15355     * Note that this value is always NULL, as there are no contents in the OK variant
15356     */
15357    void *result;
15358    /**
15359     * A pointer to the contents in the error state.
15360     * Reading from this pointer when `result_ok` is set is undefined.
15361     */
15362    enum LDKBolt11SemanticError *err;
15363 } LDKCResult_NoneBolt11SemanticErrorZPtr;
15364
15365 /**
15366  * A CResult_NoneBolt11SemanticErrorZ represents the result of a fallible operation,
15367  * containing a () on success and a crate::lightning_invoice::Bolt11SemanticError on failure.
15368  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
15369  */
15370 typedef struct LDKCResult_NoneBolt11SemanticErrorZ {
15371    /**
15372     * The contents of this CResult_NoneBolt11SemanticErrorZ, accessible via either
15373     * `err` or `result` depending on the state of `result_ok`.
15374     */
15375    union LDKCResult_NoneBolt11SemanticErrorZPtr contents;
15376    /**
15377     * Whether this CResult_NoneBolt11SemanticErrorZ represents a success state.
15378     */
15379    bool result_ok;
15380 } LDKCResult_NoneBolt11SemanticErrorZ;
15381
15382 /**
15383  * The contents of CResult_Bolt11InvoiceBolt11SemanticErrorZ
15384  */
15385 typedef union LDKCResult_Bolt11InvoiceBolt11SemanticErrorZPtr {
15386    /**
15387     * A pointer to the contents in the success state.
15388     * Reading from this pointer when `result_ok` is not set is undefined.
15389     */
15390    struct LDKBolt11Invoice *result;
15391    /**
15392     * A pointer to the contents in the error state.
15393     * Reading from this pointer when `result_ok` is set is undefined.
15394     */
15395    enum LDKBolt11SemanticError *err;
15396 } LDKCResult_Bolt11InvoiceBolt11SemanticErrorZPtr;
15397
15398 /**
15399  * A CResult_Bolt11InvoiceBolt11SemanticErrorZ represents the result of a fallible operation,
15400  * containing a crate::lightning_invoice::Bolt11Invoice on success and a crate::lightning_invoice::Bolt11SemanticError on failure.
15401  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
15402  */
15403 typedef struct LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ {
15404    /**
15405     * The contents of this CResult_Bolt11InvoiceBolt11SemanticErrorZ, accessible via either
15406     * `err` or `result` depending on the state of `result_ok`.
15407     */
15408    union LDKCResult_Bolt11InvoiceBolt11SemanticErrorZPtr contents;
15409    /**
15410     * Whether this CResult_Bolt11InvoiceBolt11SemanticErrorZ represents a success state.
15411     */
15412    bool result_ok;
15413 } LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ;
15414
15415 /**
15416  * A dynamically-allocated array of crate::c_types::Strs of arbitrary size.
15417  * This corresponds to std::vector in C++
15418  */
15419 typedef struct LDKCVec_AddressZ {
15420    /**
15421     * The elements in the array.
15422     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
15423     */
15424    struct LDKStr *data;
15425    /**
15426     * The number of elements pointed to by `data`.
15427     */
15428    uintptr_t datalen;
15429 } LDKCVec_AddressZ;
15430
15431
15432
15433 /**
15434  * Description string
15435  *
15436  * # Invariants
15437  * The description can be at most 639 __bytes__ long
15438  */
15439 typedef struct MUST_USE_STRUCT LDKDescription {
15440    /**
15441     * A pointer to the opaque Rust object.
15442     * Nearly everywhere, inner must be non-null, however in places where
15443     * the Rust equivalent takes an Option, it may be set to null to indicate None.
15444     */
15445    LDKnativeDescription *inner;
15446    /**
15447     * Indicates that this is the only struct which contains the same pointer.
15448     * Rust functions which take ownership of an object provided via an argument require
15449     * this to be true and invalidate the object pointed to by inner.
15450     */
15451    bool is_owned;
15452 } LDKDescription;
15453
15454 /**
15455  * The contents of CResult_DescriptionCreationErrorZ
15456  */
15457 typedef union LDKCResult_DescriptionCreationErrorZPtr {
15458    /**
15459     * A pointer to the contents in the success state.
15460     * Reading from this pointer when `result_ok` is not set is undefined.
15461     */
15462    struct LDKDescription *result;
15463    /**
15464     * A pointer to the contents in the error state.
15465     * Reading from this pointer when `result_ok` is set is undefined.
15466     */
15467    enum LDKCreationError *err;
15468 } LDKCResult_DescriptionCreationErrorZPtr;
15469
15470 /**
15471  * A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
15472  * containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
15473  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
15474  */
15475 typedef struct LDKCResult_DescriptionCreationErrorZ {
15476    /**
15477     * The contents of this CResult_DescriptionCreationErrorZ, accessible via either
15478     * `err` or `result` depending on the state of `result_ok`.
15479     */
15480    union LDKCResult_DescriptionCreationErrorZPtr contents;
15481    /**
15482     * Whether this CResult_DescriptionCreationErrorZ represents a success state.
15483     */
15484    bool result_ok;
15485 } LDKCResult_DescriptionCreationErrorZ;
15486
15487 /**
15488  * The contents of CResult_PrivateRouteCreationErrorZ
15489  */
15490 typedef union LDKCResult_PrivateRouteCreationErrorZPtr {
15491    /**
15492     * A pointer to the contents in the success state.
15493     * Reading from this pointer when `result_ok` is not set is undefined.
15494     */
15495    struct LDKPrivateRoute *result;
15496    /**
15497     * A pointer to the contents in the error state.
15498     * Reading from this pointer when `result_ok` is set is undefined.
15499     */
15500    enum LDKCreationError *err;
15501 } LDKCResult_PrivateRouteCreationErrorZPtr;
15502
15503 /**
15504  * A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
15505  * containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
15506  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
15507  */
15508 typedef struct LDKCResult_PrivateRouteCreationErrorZ {
15509    /**
15510     * The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
15511     * `err` or `result` depending on the state of `result_ok`.
15512     */
15513    union LDKCResult_PrivateRouteCreationErrorZPtr contents;
15514    /**
15515     * Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
15516     */
15517    bool result_ok;
15518 } LDKCResult_PrivateRouteCreationErrorZ;
15519
15520 /**
15521  * The contents of CResult_OutPointDecodeErrorZ
15522  */
15523 typedef union LDKCResult_OutPointDecodeErrorZPtr {
15524    /**
15525     * A pointer to the contents in the success state.
15526     * Reading from this pointer when `result_ok` is not set is undefined.
15527     */
15528    struct LDKOutPoint *result;
15529    /**
15530     * A pointer to the contents in the error state.
15531     * Reading from this pointer when `result_ok` is set is undefined.
15532     */
15533    struct LDKDecodeError *err;
15534 } LDKCResult_OutPointDecodeErrorZPtr;
15535
15536 /**
15537  * A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
15538  * containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
15539  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
15540  */
15541 typedef struct LDKCResult_OutPointDecodeErrorZ {
15542    /**
15543     * The contents of this CResult_OutPointDecodeErrorZ, accessible via either
15544     * `err` or `result` depending on the state of `result_ok`.
15545     */
15546    union LDKCResult_OutPointDecodeErrorZPtr contents;
15547    /**
15548     * Whether this CResult_OutPointDecodeErrorZ represents a success state.
15549     */
15550    bool result_ok;
15551 } LDKCResult_OutPointDecodeErrorZ;
15552
15553
15554
15555 /**
15556  * Lightning TLV uses a custom variable-length integer called `BigSize`. It is similar to Bitcoin's
15557  * variable-length integers except that it is serialized in big-endian instead of little-endian.
15558  *
15559  * Like Bitcoin's variable-length integer, it exhibits ambiguity in that certain values can be
15560  * encoded in several different ways, which we must check for at deserialization-time. Thus, if
15561  * you're looking for an example of a variable-length integer to use for your own project, move
15562  * along, this is a rather poor design.
15563  */
15564 typedef struct MUST_USE_STRUCT LDKBigSize {
15565    /**
15566     * A pointer to the opaque Rust object.
15567     * Nearly everywhere, inner must be non-null, however in places where
15568     * the Rust equivalent takes an Option, it may be set to null to indicate None.
15569     */
15570    LDKnativeBigSize *inner;
15571    /**
15572     * Indicates that this is the only struct which contains the same pointer.
15573     * Rust functions which take ownership of an object provided via an argument require
15574     * this to be true and invalidate the object pointed to by inner.
15575     */
15576    bool is_owned;
15577 } LDKBigSize;
15578
15579 /**
15580  * The contents of CResult_BigSizeDecodeErrorZ
15581  */
15582 typedef union LDKCResult_BigSizeDecodeErrorZPtr {
15583    /**
15584     * A pointer to the contents in the success state.
15585     * Reading from this pointer when `result_ok` is not set is undefined.
15586     */
15587    struct LDKBigSize *result;
15588    /**
15589     * A pointer to the contents in the error state.
15590     * Reading from this pointer when `result_ok` is set is undefined.
15591     */
15592    struct LDKDecodeError *err;
15593 } LDKCResult_BigSizeDecodeErrorZPtr;
15594
15595 /**
15596  * A CResult_BigSizeDecodeErrorZ represents the result of a fallible operation,
15597  * containing a crate::lightning::util::ser::BigSize on success and a crate::lightning::ln::msgs::DecodeError on failure.
15598  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
15599  */
15600 typedef struct LDKCResult_BigSizeDecodeErrorZ {
15601    /**
15602     * The contents of this CResult_BigSizeDecodeErrorZ, accessible via either
15603     * `err` or `result` depending on the state of `result_ok`.
15604     */
15605    union LDKCResult_BigSizeDecodeErrorZPtr contents;
15606    /**
15607     * Whether this CResult_BigSizeDecodeErrorZ represents a success state.
15608     */
15609    bool result_ok;
15610 } LDKCResult_BigSizeDecodeErrorZ;
15611
15612 /**
15613  * The contents of CResult_HostnameDecodeErrorZ
15614  */
15615 typedef union LDKCResult_HostnameDecodeErrorZPtr {
15616    /**
15617     * A pointer to the contents in the success state.
15618     * Reading from this pointer when `result_ok` is not set is undefined.
15619     */
15620    struct LDKHostname *result;
15621    /**
15622     * A pointer to the contents in the error state.
15623     * Reading from this pointer when `result_ok` is set is undefined.
15624     */
15625    struct LDKDecodeError *err;
15626 } LDKCResult_HostnameDecodeErrorZPtr;
15627
15628 /**
15629  * A CResult_HostnameDecodeErrorZ represents the result of a fallible operation,
15630  * containing a crate::lightning::util::ser::Hostname on success and a crate::lightning::ln::msgs::DecodeError on failure.
15631  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
15632  */
15633 typedef struct LDKCResult_HostnameDecodeErrorZ {
15634    /**
15635     * The contents of this CResult_HostnameDecodeErrorZ, accessible via either
15636     * `err` or `result` depending on the state of `result_ok`.
15637     */
15638    union LDKCResult_HostnameDecodeErrorZPtr contents;
15639    /**
15640     * Whether this CResult_HostnameDecodeErrorZ represents a success state.
15641     */
15642    bool result_ok;
15643 } LDKCResult_HostnameDecodeErrorZ;
15644
15645
15646
15647 /**
15648  * A wrapper for a `Transaction` which can only be constructed with [`TransactionU16LenLimited::new`]
15649  * if the `Transaction`'s consensus-serialized length is <= u16::MAX.
15650  *
15651  * Use [`TransactionU16LenLimited::into_transaction`] to convert into the contained `Transaction`.
15652  */
15653 typedef struct MUST_USE_STRUCT LDKTransactionU16LenLimited {
15654    /**
15655     * A pointer to the opaque Rust object.
15656     * Nearly everywhere, inner must be non-null, however in places where
15657     * the Rust equivalent takes an Option, it may be set to null to indicate None.
15658     */
15659    LDKnativeTransactionU16LenLimited *inner;
15660    /**
15661     * Indicates that this is the only struct which contains the same pointer.
15662     * Rust functions which take ownership of an object provided via an argument require
15663     * this to be true and invalidate the object pointed to by inner.
15664     */
15665    bool is_owned;
15666 } LDKTransactionU16LenLimited;
15667
15668 /**
15669  * The contents of CResult_TransactionU16LenLimitedNoneZ
15670  */
15671 typedef union LDKCResult_TransactionU16LenLimitedNoneZPtr {
15672    /**
15673     * A pointer to the contents in the success state.
15674     * Reading from this pointer when `result_ok` is not set is undefined.
15675     */
15676    struct LDKTransactionU16LenLimited *result;
15677    /**
15678     * Note that this value is always NULL, as there are no contents in the Err variant
15679     */
15680    void *err;
15681 } LDKCResult_TransactionU16LenLimitedNoneZPtr;
15682
15683 /**
15684  * A CResult_TransactionU16LenLimitedNoneZ represents the result of a fallible operation,
15685  * containing a crate::lightning::util::ser::TransactionU16LenLimited on success and a () on failure.
15686  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
15687  */
15688 typedef struct LDKCResult_TransactionU16LenLimitedNoneZ {
15689    /**
15690     * The contents of this CResult_TransactionU16LenLimitedNoneZ, accessible via either
15691     * `err` or `result` depending on the state of `result_ok`.
15692     */
15693    union LDKCResult_TransactionU16LenLimitedNoneZPtr contents;
15694    /**
15695     * Whether this CResult_TransactionU16LenLimitedNoneZ represents a success state.
15696     */
15697    bool result_ok;
15698 } LDKCResult_TransactionU16LenLimitedNoneZ;
15699
15700 /**
15701  * The contents of CResult_TransactionU16LenLimitedDecodeErrorZ
15702  */
15703 typedef union LDKCResult_TransactionU16LenLimitedDecodeErrorZPtr {
15704    /**
15705     * A pointer to the contents in the success state.
15706     * Reading from this pointer when `result_ok` is not set is undefined.
15707     */
15708    struct LDKTransactionU16LenLimited *result;
15709    /**
15710     * A pointer to the contents in the error state.
15711     * Reading from this pointer when `result_ok` is set is undefined.
15712     */
15713    struct LDKDecodeError *err;
15714 } LDKCResult_TransactionU16LenLimitedDecodeErrorZPtr;
15715
15716 /**
15717  * A CResult_TransactionU16LenLimitedDecodeErrorZ represents the result of a fallible operation,
15718  * containing a crate::lightning::util::ser::TransactionU16LenLimited on success and a crate::lightning::ln::msgs::DecodeError on failure.
15719  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
15720  */
15721 typedef struct LDKCResult_TransactionU16LenLimitedDecodeErrorZ {
15722    /**
15723     * The contents of this CResult_TransactionU16LenLimitedDecodeErrorZ, accessible via either
15724     * `err` or `result` depending on the state of `result_ok`.
15725     */
15726    union LDKCResult_TransactionU16LenLimitedDecodeErrorZPtr contents;
15727    /**
15728     * Whether this CResult_TransactionU16LenLimitedDecodeErrorZ represents a success state.
15729     */
15730    bool result_ok;
15731 } LDKCResult_TransactionU16LenLimitedDecodeErrorZ;
15732
15733 /**
15734  * The contents of CResult_UntrustedStringDecodeErrorZ
15735  */
15736 typedef union LDKCResult_UntrustedStringDecodeErrorZPtr {
15737    /**
15738     * A pointer to the contents in the success state.
15739     * Reading from this pointer when `result_ok` is not set is undefined.
15740     */
15741    struct LDKUntrustedString *result;
15742    /**
15743     * A pointer to the contents in the error state.
15744     * Reading from this pointer when `result_ok` is set is undefined.
15745     */
15746    struct LDKDecodeError *err;
15747 } LDKCResult_UntrustedStringDecodeErrorZPtr;
15748
15749 /**
15750  * A CResult_UntrustedStringDecodeErrorZ represents the result of a fallible operation,
15751  * containing a crate::lightning::util::string::UntrustedString on success and a crate::lightning::ln::msgs::DecodeError on failure.
15752  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
15753  */
15754 typedef struct LDKCResult_UntrustedStringDecodeErrorZ {
15755    /**
15756     * The contents of this CResult_UntrustedStringDecodeErrorZ, accessible via either
15757     * `err` or `result` depending on the state of `result_ok`.
15758     */
15759    union LDKCResult_UntrustedStringDecodeErrorZPtr contents;
15760    /**
15761     * Whether this CResult_UntrustedStringDecodeErrorZ represents a success state.
15762     */
15763    bool result_ok;
15764 } LDKCResult_UntrustedStringDecodeErrorZ;
15765
15766 /**
15767  * An error that may occur when making a payment.
15768  */
15769 typedef enum LDKPaymentError_Tag {
15770    /**
15771     * An error resulting from the provided [`Bolt11Invoice`] or payment hash.
15772     */
15773    LDKPaymentError_Invoice,
15774    /**
15775     * An error occurring when sending a payment.
15776     */
15777    LDKPaymentError_Sending,
15778    /**
15779     * Must be last for serialization purposes
15780     */
15781    LDKPaymentError_Sentinel,
15782 } LDKPaymentError_Tag;
15783
15784 typedef struct MUST_USE_STRUCT LDKPaymentError {
15785    LDKPaymentError_Tag tag;
15786    union {
15787       struct {
15788          struct LDKStr invoice;
15789       };
15790       struct {
15791          enum LDKRetryableSendFailure sending;
15792       };
15793    };
15794 } LDKPaymentError;
15795
15796 /**
15797  * The contents of CResult_PaymentIdPaymentErrorZ
15798  */
15799 typedef union LDKCResult_PaymentIdPaymentErrorZPtr {
15800    /**
15801     * A pointer to the contents in the success state.
15802     * Reading from this pointer when `result_ok` is not set is undefined.
15803     */
15804    struct LDKThirtyTwoBytes *result;
15805    /**
15806     * A pointer to the contents in the error state.
15807     * Reading from this pointer when `result_ok` is set is undefined.
15808     */
15809    struct LDKPaymentError *err;
15810 } LDKCResult_PaymentIdPaymentErrorZPtr;
15811
15812 /**
15813  * A CResult_PaymentIdPaymentErrorZ represents the result of a fallible operation,
15814  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning_invoice::payment::PaymentError on failure.
15815  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
15816  */
15817 typedef struct LDKCResult_PaymentIdPaymentErrorZ {
15818    /**
15819     * The contents of this CResult_PaymentIdPaymentErrorZ, accessible via either
15820     * `err` or `result` depending on the state of `result_ok`.
15821     */
15822    union LDKCResult_PaymentIdPaymentErrorZPtr contents;
15823    /**
15824     * Whether this CResult_PaymentIdPaymentErrorZ represents a success state.
15825     */
15826    bool result_ok;
15827 } LDKCResult_PaymentIdPaymentErrorZ;
15828
15829 /**
15830  * The contents of CResult_NonePaymentErrorZ
15831  */
15832 typedef union LDKCResult_NonePaymentErrorZPtr {
15833    /**
15834     * Note that this value is always NULL, as there are no contents in the OK variant
15835     */
15836    void *result;
15837    /**
15838     * A pointer to the contents in the error state.
15839     * Reading from this pointer when `result_ok` is set is undefined.
15840     */
15841    struct LDKPaymentError *err;
15842 } LDKCResult_NonePaymentErrorZPtr;
15843
15844 /**
15845  * A CResult_NonePaymentErrorZ represents the result of a fallible operation,
15846  * containing a () on success and a crate::lightning_invoice::payment::PaymentError on failure.
15847  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
15848  */
15849 typedef struct LDKCResult_NonePaymentErrorZ {
15850    /**
15851     * The contents of this CResult_NonePaymentErrorZ, accessible via either
15852     * `err` or `result` depending on the state of `result_ok`.
15853     */
15854    union LDKCResult_NonePaymentErrorZPtr contents;
15855    /**
15856     * Whether this CResult_NonePaymentErrorZ represents a success state.
15857     */
15858    bool result_ok;
15859 } LDKCResult_NonePaymentErrorZ;
15860
15861 /**
15862  * The contents of CResult_StringErrorZ
15863  */
15864 typedef union LDKCResult_StringErrorZPtr {
15865    /**
15866     * A pointer to the contents in the success state.
15867     * Reading from this pointer when `result_ok` is not set is undefined.
15868     */
15869    struct LDKStr *result;
15870    /**
15871     * A pointer to the contents in the error state.
15872     * Reading from this pointer when `result_ok` is set is undefined.
15873     */
15874    enum LDKSecp256k1Error *err;
15875 } LDKCResult_StringErrorZPtr;
15876
15877 /**
15878  * A CResult_StringErrorZ represents the result of a fallible operation,
15879  * containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
15880  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
15881  */
15882 typedef struct LDKCResult_StringErrorZ {
15883    /**
15884     * The contents of this CResult_StringErrorZ, accessible via either
15885     * `err` or `result` depending on the state of `result_ok`.
15886     */
15887    union LDKCResult_StringErrorZPtr contents;
15888    /**
15889     * Whether this CResult_StringErrorZ represents a success state.
15890     */
15891    bool result_ok;
15892 } LDKCResult_StringErrorZ;
15893
15894
15895
15896 /**
15897  * A path for sending an [`msgs::OnionMessage`].
15898  */
15899 typedef struct MUST_USE_STRUCT LDKOnionMessagePath {
15900    /**
15901     * A pointer to the opaque Rust object.
15902     * Nearly everywhere, inner must be non-null, however in places where
15903     * the Rust equivalent takes an Option, it may be set to null to indicate None.
15904     */
15905    LDKnativeOnionMessagePath *inner;
15906    /**
15907     * Indicates that this is the only struct which contains the same pointer.
15908     * Rust functions which take ownership of an object provided via an argument require
15909     * this to be true and invalidate the object pointed to by inner.
15910     */
15911    bool is_owned;
15912 } LDKOnionMessagePath;
15913
15914 /**
15915  * The contents of CResult_OnionMessagePathNoneZ
15916  */
15917 typedef union LDKCResult_OnionMessagePathNoneZPtr {
15918    /**
15919     * A pointer to the contents in the success state.
15920     * Reading from this pointer when `result_ok` is not set is undefined.
15921     */
15922    struct LDKOnionMessagePath *result;
15923    /**
15924     * Note that this value is always NULL, as there are no contents in the Err variant
15925     */
15926    void *err;
15927 } LDKCResult_OnionMessagePathNoneZPtr;
15928
15929 /**
15930  * A CResult_OnionMessagePathNoneZ represents the result of a fallible operation,
15931  * containing a crate::lightning::onion_message::messenger::OnionMessagePath on success and a () on failure.
15932  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
15933  */
15934 typedef struct LDKCResult_OnionMessagePathNoneZ {
15935    /**
15936     * The contents of this CResult_OnionMessagePathNoneZ, accessible via either
15937     * `err` or `result` depending on the state of `result_ok`.
15938     */
15939    union LDKCResult_OnionMessagePathNoneZPtr contents;
15940    /**
15941     * Whether this CResult_OnionMessagePathNoneZ represents a success state.
15942     */
15943    bool result_ok;
15944 } LDKCResult_OnionMessagePathNoneZ;
15945
15946 /**
15947  * Errors that may occur when [sending an onion message].
15948  *
15949  * [sending an onion message]: OnionMessenger::send_onion_message
15950  */
15951 typedef enum LDKSendError_Tag {
15952    /**
15953     * Errored computing onion message packet keys.
15954     */
15955    LDKSendError_Secp256k1,
15956    /**
15957     * Because implementations such as Eclair will drop onion messages where the message packet
15958     * exceeds 32834 bytes, we refuse to send messages where the packet exceeds this size.
15959     */
15960    LDKSendError_TooBigPacket,
15961    /**
15962     * The provided [`Destination`] was an invalid [`BlindedPath`], due to having fewer than two
15963     * blinded hops.
15964     */
15965    LDKSendError_TooFewBlindedHops,
15966    /**
15967     * Our next-hop peer was offline or does not support onion message forwarding.
15968     */
15969    LDKSendError_InvalidFirstHop,
15970    /**
15971     * Onion message contents must have a TLV type >= 64.
15972     */
15973    LDKSendError_InvalidMessage,
15974    /**
15975     * Our next-hop peer's buffer was full or our total outbound buffer was full.
15976     */
15977    LDKSendError_BufferFull,
15978    /**
15979     * Failed to retrieve our node id from the provided [`NodeSigner`].
15980     *
15981     * [`NodeSigner`]: crate::sign::NodeSigner
15982     */
15983    LDKSendError_GetNodeIdFailed,
15984    /**
15985     * We attempted to send to a blinded path where we are the introduction node, and failed to
15986     * advance the blinded path to make the second hop the new introduction node. Either
15987     * [`NodeSigner::ecdh`] failed, we failed to tweak the current blinding point to get the
15988     * new blinding point, or we were attempting to send to ourselves.
15989     */
15990    LDKSendError_BlindedPathAdvanceFailed,
15991    /**
15992     * Must be last for serialization purposes
15993     */
15994    LDKSendError_Sentinel,
15995 } LDKSendError_Tag;
15996
15997 typedef struct MUST_USE_STRUCT LDKSendError {
15998    LDKSendError_Tag tag;
15999    union {
16000       struct {
16001          enum LDKSecp256k1Error secp256k1;
16002       };
16003    };
16004 } LDKSendError;
16005
16006 /**
16007  * The contents of CResult_NoneSendErrorZ
16008  */
16009 typedef union LDKCResult_NoneSendErrorZPtr {
16010    /**
16011     * Note that this value is always NULL, as there are no contents in the OK variant
16012     */
16013    void *result;
16014    /**
16015     * A pointer to the contents in the error state.
16016     * Reading from this pointer when `result_ok` is set is undefined.
16017     */
16018    struct LDKSendError *err;
16019 } LDKCResult_NoneSendErrorZPtr;
16020
16021 /**
16022  * A CResult_NoneSendErrorZ represents the result of a fallible operation,
16023  * containing a () on success and a crate::lightning::onion_message::messenger::SendError on failure.
16024  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
16025  */
16026 typedef struct LDKCResult_NoneSendErrorZ {
16027    /**
16028     * The contents of this CResult_NoneSendErrorZ, accessible via either
16029     * `err` or `result` depending on the state of `result_ok`.
16030     */
16031    union LDKCResult_NoneSendErrorZPtr contents;
16032    /**
16033     * Whether this CResult_NoneSendErrorZ represents a success state.
16034     */
16035    bool result_ok;
16036 } LDKCResult_NoneSendErrorZ;
16037
16038 /**
16039  * The contents of CResult_BlindedPathNoneZ
16040  */
16041 typedef union LDKCResult_BlindedPathNoneZPtr {
16042    /**
16043     * A pointer to the contents in the success state.
16044     * Reading from this pointer when `result_ok` is not set is undefined.
16045     */
16046    struct LDKBlindedPath *result;
16047    /**
16048     * Note that this value is always NULL, as there are no contents in the Err variant
16049     */
16050    void *err;
16051 } LDKCResult_BlindedPathNoneZPtr;
16052
16053 /**
16054  * A CResult_BlindedPathNoneZ represents the result of a fallible operation,
16055  * containing a crate::lightning::blinded_path::BlindedPath on success and a () on failure.
16056  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
16057  */
16058 typedef struct LDKCResult_BlindedPathNoneZ {
16059    /**
16060     * The contents of this CResult_BlindedPathNoneZ, accessible via either
16061     * `err` or `result` depending on the state of `result_ok`.
16062     */
16063    union LDKCResult_BlindedPathNoneZPtr contents;
16064    /**
16065     * Whether this CResult_BlindedPathNoneZ represents a success state.
16066     */
16067    bool result_ok;
16068 } LDKCResult_BlindedPathNoneZ;
16069
16070 /**
16071  * The contents of CResult_BlindedPathDecodeErrorZ
16072  */
16073 typedef union LDKCResult_BlindedPathDecodeErrorZPtr {
16074    /**
16075     * A pointer to the contents in the success state.
16076     * Reading from this pointer when `result_ok` is not set is undefined.
16077     */
16078    struct LDKBlindedPath *result;
16079    /**
16080     * A pointer to the contents in the error state.
16081     * Reading from this pointer when `result_ok` is set is undefined.
16082     */
16083    struct LDKDecodeError *err;
16084 } LDKCResult_BlindedPathDecodeErrorZPtr;
16085
16086 /**
16087  * A CResult_BlindedPathDecodeErrorZ represents the result of a fallible operation,
16088  * containing a crate::lightning::blinded_path::BlindedPath on success and a crate::lightning::ln::msgs::DecodeError on failure.
16089  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
16090  */
16091 typedef struct LDKCResult_BlindedPathDecodeErrorZ {
16092    /**
16093     * The contents of this CResult_BlindedPathDecodeErrorZ, accessible via either
16094     * `err` or `result` depending on the state of `result_ok`.
16095     */
16096    union LDKCResult_BlindedPathDecodeErrorZPtr contents;
16097    /**
16098     * Whether this CResult_BlindedPathDecodeErrorZ represents a success state.
16099     */
16100    bool result_ok;
16101 } LDKCResult_BlindedPathDecodeErrorZ;
16102
16103 /**
16104  * The contents of CResult_BlindedHopDecodeErrorZ
16105  */
16106 typedef union LDKCResult_BlindedHopDecodeErrorZPtr {
16107    /**
16108     * A pointer to the contents in the success state.
16109     * Reading from this pointer when `result_ok` is not set is undefined.
16110     */
16111    struct LDKBlindedHop *result;
16112    /**
16113     * A pointer to the contents in the error state.
16114     * Reading from this pointer when `result_ok` is set is undefined.
16115     */
16116    struct LDKDecodeError *err;
16117 } LDKCResult_BlindedHopDecodeErrorZPtr;
16118
16119 /**
16120  * A CResult_BlindedHopDecodeErrorZ represents the result of a fallible operation,
16121  * containing a crate::lightning::blinded_path::BlindedHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
16122  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
16123  */
16124 typedef struct LDKCResult_BlindedHopDecodeErrorZ {
16125    /**
16126     * The contents of this CResult_BlindedHopDecodeErrorZ, accessible via either
16127     * `err` or `result` depending on the state of `result_ok`.
16128     */
16129    union LDKCResult_BlindedHopDecodeErrorZPtr contents;
16130    /**
16131     * Whether this CResult_BlindedHopDecodeErrorZ represents a success state.
16132     */
16133    bool result_ok;
16134 } LDKCResult_BlindedHopDecodeErrorZ;
16135
16136 /**
16137  * The contents of CResult_InvoiceErrorDecodeErrorZ
16138  */
16139 typedef union LDKCResult_InvoiceErrorDecodeErrorZPtr {
16140    /**
16141     * A pointer to the contents in the success state.
16142     * Reading from this pointer when `result_ok` is not set is undefined.
16143     */
16144    struct LDKInvoiceError *result;
16145    /**
16146     * A pointer to the contents in the error state.
16147     * Reading from this pointer when `result_ok` is set is undefined.
16148     */
16149    struct LDKDecodeError *err;
16150 } LDKCResult_InvoiceErrorDecodeErrorZPtr;
16151
16152 /**
16153  * A CResult_InvoiceErrorDecodeErrorZ represents the result of a fallible operation,
16154  * containing a crate::lightning::offers::invoice_error::InvoiceError on success and a crate::lightning::ln::msgs::DecodeError on failure.
16155  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
16156  */
16157 typedef struct LDKCResult_InvoiceErrorDecodeErrorZ {
16158    /**
16159     * The contents of this CResult_InvoiceErrorDecodeErrorZ, accessible via either
16160     * `err` or `result` depending on the state of `result_ok`.
16161     */
16162    union LDKCResult_InvoiceErrorDecodeErrorZPtr contents;
16163    /**
16164     * Whether this CResult_InvoiceErrorDecodeErrorZ represents a success state.
16165     */
16166    bool result_ok;
16167 } LDKCResult_InvoiceErrorDecodeErrorZ;
16168
16169
16170
16171 /**
16172  * A transaction output watched by a [`ChannelMonitor`] for spends on-chain.
16173  *
16174  * Used to convey to a [`Filter`] such an output with a given spending condition. Any transaction
16175  * spending the output must be given to [`ChannelMonitor::block_connected`] either directly or via
16176  * [`Confirm::transactions_confirmed`].
16177  *
16178  * If `block_hash` is `Some`, this indicates the output was created in the corresponding block and
16179  * may have been spent there. See [`Filter::register_output`] for details.
16180  *
16181  * [`ChannelMonitor`]: channelmonitor::ChannelMonitor
16182  * [`ChannelMonitor::block_connected`]: channelmonitor::ChannelMonitor::block_connected
16183  */
16184 typedef struct MUST_USE_STRUCT LDKWatchedOutput {
16185    /**
16186     * A pointer to the opaque Rust object.
16187     * Nearly everywhere, inner must be non-null, however in places where
16188     * the Rust equivalent takes an Option, it may be set to null to indicate None.
16189     */
16190    LDKnativeWatchedOutput *inner;
16191    /**
16192     * Indicates that this is the only struct which contains the same pointer.
16193     * Rust functions which take ownership of an object provided via an argument require
16194     * this to be true and invalidate the object pointed to by inner.
16195     */
16196    bool is_owned;
16197 } LDKWatchedOutput;
16198
16199 /**
16200  * The `Filter` trait defines behavior for indicating chain activity of interest pertaining to
16201  * channels.
16202  *
16203  * This is useful in order to have a [`Watch`] implementation convey to a chain source which
16204  * transactions to be notified of. Notification may take the form of pre-filtering blocks or, in
16205  * the case of [BIP 157]/[BIP 158], only fetching a block if the compact filter matches. If
16206  * receiving full blocks from a chain source, any further filtering is unnecessary.
16207  *
16208  * After an output has been registered, subsequent block retrievals from the chain source must not
16209  * exclude any transactions matching the new criteria nor any in-block descendants of such
16210  * transactions.
16211  *
16212  * Note that use as part of a [`Watch`] implementation involves reentrancy. Therefore, the `Filter`
16213  * should not block on I/O. Implementations should instead queue the newly monitored data to be
16214  * processed later. Then, in order to block until the data has been processed, any [`Watch`]
16215  * invocation that has called the `Filter` must return [`InProgress`].
16216  *
16217  * [`InProgress`]: ChannelMonitorUpdateStatus::InProgress
16218  * [BIP 157]: https://github.com/bitcoin/bips/blob/master/bip-0157.mediawiki
16219  * [BIP 158]: https://github.com/bitcoin/bips/blob/master/bip-0158.mediawiki
16220  */
16221 typedef struct LDKFilter {
16222    /**
16223     * An opaque pointer which is passed to your function implementations as an argument.
16224     * This has no meaning in the LDK, and can be NULL or any other value.
16225     */
16226    void *this_arg;
16227    /**
16228     * Registers interest in a transaction with `txid` and having an output with `script_pubkey` as
16229     * a spending condition.
16230     */
16231    void (*register_tx)(const void *this_arg, const uint8_t (*txid)[32], struct LDKu8slice script_pubkey);
16232    /**
16233     * Registers interest in spends of a transaction output.
16234     *
16235     * Note that this method might be called during processing of a new block. You therefore need
16236     * to ensure that also dependent output spents within an already connected block are correctly
16237     * handled, e.g., by re-scanning the block in question whenever new outputs have been
16238     * registered mid-processing.
16239     */
16240    void (*register_output)(const void *this_arg, struct LDKWatchedOutput output);
16241    /**
16242     * Frees any resources associated with this object given its this_arg pointer.
16243     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
16244     */
16245    void (*free)(void *this_arg);
16246 } LDKFilter;
16247
16248 /**
16249  * An enum which can either contain a crate::lightning::chain::Filter or not
16250  */
16251 typedef enum LDKCOption_FilterZ_Tag {
16252    /**
16253     * When we're in this state, this COption_FilterZ contains a crate::lightning::chain::Filter
16254     */
16255    LDKCOption_FilterZ_Some,
16256    /**
16257     * When we're in this state, this COption_FilterZ contains nothing
16258     */
16259    LDKCOption_FilterZ_None,
16260    /**
16261     * Must be last for serialization purposes
16262     */
16263    LDKCOption_FilterZ_Sentinel,
16264 } LDKCOption_FilterZ_Tag;
16265
16266 typedef struct LDKCOption_FilterZ {
16267    LDKCOption_FilterZ_Tag tag;
16268    union {
16269       struct {
16270          struct LDKFilter some;
16271       };
16272    };
16273 } LDKCOption_FilterZ;
16274
16275
16276
16277 /**
16278  * A read-only reference to a current ChannelMonitor.
16279  *
16280  * Note that this holds a mutex in [`ChainMonitor`] and may block other events until it is
16281  * released.
16282  */
16283 typedef struct MUST_USE_STRUCT LDKLockedChannelMonitor {
16284    /**
16285     * A pointer to the opaque Rust object.
16286     * Nearly everywhere, inner must be non-null, however in places where
16287     * the Rust equivalent takes an Option, it may be set to null to indicate None.
16288     */
16289    LDKnativeLockedChannelMonitor *inner;
16290    /**
16291     * Indicates that this is the only struct which contains the same pointer.
16292     * Rust functions which take ownership of an object provided via an argument require
16293     * this to be true and invalidate the object pointed to by inner.
16294     */
16295    bool is_owned;
16296 } LDKLockedChannelMonitor;
16297
16298 /**
16299  * The contents of CResult_LockedChannelMonitorNoneZ
16300  */
16301 typedef union LDKCResult_LockedChannelMonitorNoneZPtr {
16302    /**
16303     * A pointer to the contents in the success state.
16304     * Reading from this pointer when `result_ok` is not set is undefined.
16305     */
16306    struct LDKLockedChannelMonitor *result;
16307    /**
16308     * Note that this value is always NULL, as there are no contents in the Err variant
16309     */
16310    void *err;
16311 } LDKCResult_LockedChannelMonitorNoneZPtr;
16312
16313 /**
16314  * A CResult_LockedChannelMonitorNoneZ represents the result of a fallible operation,
16315  * containing a crate::lightning::chain::chainmonitor::LockedChannelMonitor on success and a () on failure.
16316  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
16317  */
16318 typedef struct LDKCResult_LockedChannelMonitorNoneZ {
16319    /**
16320     * The contents of this CResult_LockedChannelMonitorNoneZ, accessible via either
16321     * `err` or `result` depending on the state of `result_ok`.
16322     */
16323    union LDKCResult_LockedChannelMonitorNoneZPtr contents;
16324    /**
16325     * Whether this CResult_LockedChannelMonitorNoneZ represents a success state.
16326     */
16327    bool result_ok;
16328 } LDKCResult_LockedChannelMonitorNoneZ;
16329
16330 /**
16331  * A dynamically-allocated array of crate::lightning::chain::transaction::OutPoints of arbitrary size.
16332  * This corresponds to std::vector in C++
16333  */
16334 typedef struct LDKCVec_OutPointZ {
16335    /**
16336     * The elements in the array.
16337     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
16338     */
16339    struct LDKOutPoint *data;
16340    /**
16341     * The number of elements pointed to by `data`.
16342     */
16343    uintptr_t datalen;
16344 } LDKCVec_OutPointZ;
16345
16346
16347
16348 /**
16349  * An opaque identifier describing a specific [`Persist`] method call.
16350  */
16351 typedef struct MUST_USE_STRUCT LDKMonitorUpdateId {
16352    /**
16353     * A pointer to the opaque Rust object.
16354     * Nearly everywhere, inner must be non-null, however in places where
16355     * the Rust equivalent takes an Option, it may be set to null to indicate None.
16356     */
16357    LDKnativeMonitorUpdateId *inner;
16358    /**
16359     * Indicates that this is the only struct which contains the same pointer.
16360     * Rust functions which take ownership of an object provided via an argument require
16361     * this to be true and invalidate the object pointed to by inner.
16362     */
16363    bool is_owned;
16364 } LDKMonitorUpdateId;
16365
16366 /**
16367  * A dynamically-allocated array of crate::lightning::chain::chainmonitor::MonitorUpdateIds of arbitrary size.
16368  * This corresponds to std::vector in C++
16369  */
16370 typedef struct LDKCVec_MonitorUpdateIdZ {
16371    /**
16372     * The elements in the array.
16373     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
16374     */
16375    struct LDKMonitorUpdateId *data;
16376    /**
16377     * The number of elements pointed to by `data`.
16378     */
16379    uintptr_t datalen;
16380 } LDKCVec_MonitorUpdateIdZ;
16381
16382 /**
16383  * A tuple of 2 elements. See the individual fields for the types contained.
16384  */
16385 typedef struct LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ {
16386    /**
16387     * The element at position 0
16388     */
16389    struct LDKOutPoint a;
16390    /**
16391     * The element at position 1
16392     */
16393    struct LDKCVec_MonitorUpdateIdZ b;
16394 } LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ;
16395
16396 /**
16397  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZs of arbitrary size.
16398  * This corresponds to std::vector in C++
16399  */
16400 typedef struct LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
16401    /**
16402     * The elements in the array.
16403     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
16404     */
16405    struct LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *data;
16406    /**
16407     * The number of elements pointed to by `data`.
16408     */
16409    uintptr_t datalen;
16410 } LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ;
16411
16412 /**
16413  * Trait that handles persisting a [`ChannelManager`], [`NetworkGraph`], and [`WriteableScore`] to disk.
16414  */
16415 typedef struct LDKPersister {
16416    /**
16417     * An opaque pointer which is passed to your function implementations as an argument.
16418     * This has no meaning in the LDK, and can be NULL or any other value.
16419     */
16420    void *this_arg;
16421    /**
16422     * Persist the given ['ChannelManager'] to disk, returning an error if persistence failed.
16423     */
16424    struct LDKCResult_NoneErrorZ (*persist_manager)(const void *this_arg, const struct LDKChannelManager *NONNULL_PTR channel_manager);
16425    /**
16426     * Persist the given [`NetworkGraph`] to disk, returning an error if persistence failed.
16427     */
16428    struct LDKCResult_NoneErrorZ (*persist_graph)(const void *this_arg, const struct LDKNetworkGraph *NONNULL_PTR network_graph);
16429    /**
16430     * Persist the given [`WriteableScore`] to disk, returning an error if persistence failed.
16431     */
16432    struct LDKCResult_NoneErrorZ (*persist_scorer)(const void *this_arg, const struct LDKWriteableScore *NONNULL_PTR scorer);
16433    /**
16434     * Frees any resources associated with this object given its this_arg pointer.
16435     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
16436     */
16437    void (*free)(void *this_arg);
16438 } LDKPersister;
16439
16440
16441
16442 /**
16443  * A string that displays only printable characters, replacing control characters with
16444  * [`core::char::REPLACEMENT_CHARACTER`].
16445  */
16446 typedef struct MUST_USE_STRUCT LDKPrintableString {
16447    /**
16448     * A pointer to the opaque Rust object.
16449     * Nearly everywhere, inner must be non-null, however in places where
16450     * the Rust equivalent takes an Option, it may be set to null to indicate None.
16451     */
16452    LDKnativePrintableString *inner;
16453    /**
16454     * Indicates that this is the only struct which contains the same pointer.
16455     * Rust functions which take ownership of an object provided via an argument require
16456     * this to be true and invalidate the object pointed to by inner.
16457     */
16458    bool is_owned;
16459 } LDKPrintableString;
16460
16461 /**
16462  * A callback which is called when a [`Future`] completes.
16463  *
16464  * Note that this MUST NOT call back into LDK directly, it must instead schedule actions to be
16465  * taken later. Rust users should use the [`std::future::Future`] implementation for [`Future`]
16466  * instead.
16467  *
16468  * Note that the [`std::future::Future`] implementation may only work for runtimes which schedule
16469  * futures when they receive a wake, rather than immediately executing them.
16470  */
16471 typedef struct LDKFutureCallback {
16472    /**
16473     * An opaque pointer which is passed to your function implementations as an argument.
16474     * This has no meaning in the LDK, and can be NULL or any other value.
16475     */
16476    void *this_arg;
16477    /**
16478     * The method which is called.
16479     */
16480    void (*call)(const void *this_arg);
16481    /**
16482     * Frees any resources associated with this object given its this_arg pointer.
16483     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
16484     */
16485    void (*free)(void *this_arg);
16486 } LDKFutureCallback;
16487
16488
16489
16490 /**
16491  * A struct which can be used to select across many [`Future`]s at once without relying on a full
16492  * async context.
16493  */
16494 typedef struct MUST_USE_STRUCT LDKSleeper {
16495    /**
16496     * A pointer to the opaque Rust object.
16497     * Nearly everywhere, inner must be non-null, however in places where
16498     * the Rust equivalent takes an Option, it may be set to null to indicate None.
16499     */
16500    LDKnativeSleeper *inner;
16501    /**
16502     * Indicates that this is the only struct which contains the same pointer.
16503     * Rust functions which take ownership of an object provided via an argument require
16504     * this to be true and invalidate the object pointed to by inner.
16505     */
16506    bool is_owned;
16507 } LDKSleeper;
16508
16509
16510
16511 /**
16512  * Configuration we set when applicable.
16513  *
16514  * Default::default() provides sane defaults.
16515  */
16516 typedef struct MUST_USE_STRUCT LDKChannelHandshakeConfig {
16517    /**
16518     * A pointer to the opaque Rust object.
16519     * Nearly everywhere, inner must be non-null, however in places where
16520     * the Rust equivalent takes an Option, it may be set to null to indicate None.
16521     */
16522    LDKnativeChannelHandshakeConfig *inner;
16523    /**
16524     * Indicates that this is the only struct which contains the same pointer.
16525     * Rust functions which take ownership of an object provided via an argument require
16526     * this to be true and invalidate the object pointed to by inner.
16527     */
16528    bool is_owned;
16529 } LDKChannelHandshakeConfig;
16530
16531
16532
16533 /**
16534  * Optional channel limits which are applied during channel creation.
16535  *
16536  * These limits are only applied to our counterparty's limits, not our own.
16537  *
16538  * Use 0/`<type>::max_value()` as appropriate to skip checking.
16539  *
16540  * Provides sane defaults for most configurations.
16541  *
16542  * Most additional limits are disabled except those with which specify a default in individual
16543  * field documentation. Note that this may result in barely-usable channels, but since they
16544  * are applied mostly only to incoming channels that's not much of a problem.
16545  */
16546 typedef struct MUST_USE_STRUCT LDKChannelHandshakeLimits {
16547    /**
16548     * A pointer to the opaque Rust object.
16549     * Nearly everywhere, inner must be non-null, however in places where
16550     * the Rust equivalent takes an Option, it may be set to null to indicate None.
16551     */
16552    LDKnativeChannelHandshakeLimits *inner;
16553    /**
16554     * Indicates that this is the only struct which contains the same pointer.
16555     * Rust functions which take ownership of an object provided via an argument require
16556     * this to be true and invalidate the object pointed to by inner.
16557     */
16558    bool is_owned;
16559 } LDKChannelHandshakeLimits;
16560
16561
16562
16563 /**
16564  * A parallel struct to [`ChannelConfig`] to define partial updates.
16565  */
16566 typedef struct MUST_USE_STRUCT LDKChannelConfigUpdate {
16567    /**
16568     * A pointer to the opaque Rust object.
16569     * Nearly everywhere, inner must be non-null, however in places where
16570     * the Rust equivalent takes an Option, it may be set to null to indicate None.
16571     */
16572    LDKnativeChannelConfigUpdate *inner;
16573    /**
16574     * Indicates that this is the only struct which contains the same pointer.
16575     * Rust functions which take ownership of an object provided via an argument require
16576     * this to be true and invalidate the object pointed to by inner.
16577     */
16578    bool is_owned;
16579 } LDKChannelConfigUpdate;
16580
16581
16582
16583 /**
16584  * Top-level config which holds ChannelHandshakeLimits and ChannelConfig.
16585  *
16586  * Default::default() provides sane defaults for most configurations
16587  * (but currently with 0 relay fees!)
16588  */
16589 typedef struct MUST_USE_STRUCT LDKUserConfig {
16590    /**
16591     * A pointer to the opaque Rust object.
16592     * Nearly everywhere, inner must be non-null, however in places where
16593     * the Rust equivalent takes an Option, it may be set to null to indicate None.
16594     */
16595    LDKnativeUserConfig *inner;
16596    /**
16597     * Indicates that this is the only struct which contains the same pointer.
16598     * Rust functions which take ownership of an object provided via an argument require
16599     * this to be true and invalidate the object pointed to by inner.
16600     */
16601    bool is_owned;
16602 } LDKUserConfig;
16603
16604
16605
16606 /**
16607  * The best known block as identified by its hash and height.
16608  */
16609 typedef struct MUST_USE_STRUCT LDKBestBlock {
16610    /**
16611     * A pointer to the opaque Rust object.
16612     * Nearly everywhere, inner must be non-null, however in places where
16613     * the Rust equivalent takes an Option, it may be set to null to indicate None.
16614     */
16615    LDKnativeBestBlock *inner;
16616    /**
16617     * Indicates that this is the only struct which contains the same pointer.
16618     * Rust functions which take ownership of an object provided via an argument require
16619     * this to be true and invalidate the object pointed to by inner.
16620     */
16621    bool is_owned;
16622 } LDKBestBlock;
16623
16624 /**
16625  * The `Listen` trait is used to notify when blocks have been connected or disconnected from the
16626  * chain.
16627  *
16628  * Useful when needing to replay chain data upon startup or as new chain events occur. Clients
16629  * sourcing chain data using a block-oriented API should prefer this interface over [`Confirm`].
16630  * Such clients fetch the entire header chain whereas clients using [`Confirm`] only fetch headers
16631  * when needed.
16632  *
16633  * By using [`Listen::filtered_block_connected`] this interface supports clients fetching the
16634  * entire header chain and only blocks with matching transaction data using BIP 157 filters or
16635  * other similar filtering.
16636  */
16637 typedef struct LDKListen {
16638    /**
16639     * An opaque pointer which is passed to your function implementations as an argument.
16640     * This has no meaning in the LDK, and can be NULL or any other value.
16641     */
16642    void *this_arg;
16643    /**
16644     * Notifies the listener that a block was added at the given height, with the transaction data
16645     * possibly filtered.
16646     */
16647    void (*filtered_block_connected)(const void *this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height);
16648    /**
16649     * Notifies the listener that a block was added at the given height.
16650     */
16651    void (*block_connected)(const void *this_arg, struct LDKu8slice block, uint32_t height);
16652    /**
16653     * Notifies the listener that a block was removed at the given height.
16654     */
16655    void (*block_disconnected)(const void *this_arg, const uint8_t (*header)[80], uint32_t height);
16656    /**
16657     * Frees any resources associated with this object given its this_arg pointer.
16658     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
16659     */
16660    void (*free)(void *this_arg);
16661 } LDKListen;
16662
16663 /**
16664  * The `Confirm` trait is used to notify LDK when relevant transactions have been confirmed on
16665  * chain or unconfirmed during a chain reorganization.
16666  *
16667  * Clients sourcing chain data using a transaction-oriented API should prefer this interface over
16668  * [`Listen`]. For instance, an Electrum-based transaction sync implementation may implement
16669  * [`Filter`] to subscribe to relevant transactions and unspent outputs it should monitor for
16670  * on-chain activity. Then, it needs to notify LDK via this interface upon observing any changes
16671  * with reference to the confirmation status of the monitored objects.
16672  *
16673  * # Use
16674  * The intended use is as follows:
16675  * - Call [`transactions_confirmed`] to notify LDK whenever any of the registered transactions or
16676  *   outputs are, respectively, confirmed or spent on chain.
16677  * - Call [`transaction_unconfirmed`] to notify LDK whenever any transaction returned by
16678  *   [`get_relevant_txids`] is no longer confirmed in the block with the given block hash.
16679  * - Call [`best_block_updated`] to notify LDK whenever a new chain tip becomes available.
16680  *
16681  * # Order
16682  *
16683  * Clients must call these methods in chain order. Specifically:
16684  * - Transactions which are confirmed in a particular block must be given before transactions
16685  *   confirmed in a later block.
16686  * - Dependent transactions within the same block must be given in topological order, possibly in
16687  *   separate calls.
16688  * - All unconfirmed transactions must be given after the original confirmations and before *any*
16689  *   reconfirmations, i.e., [`transactions_confirmed`] and [`transaction_unconfirmed`] calls should
16690  *   never be interleaved, but always conduced *en bloc*.
16691  * - Any reconfirmed transactions need to be explicitly unconfirmed before they are reconfirmed
16692  *   in regard to the new block.
16693  *
16694  * See individual method documentation for further details.
16695  *
16696  * [`transactions_confirmed`]: Self::transactions_confirmed
16697  * [`transaction_unconfirmed`]: Self::transaction_unconfirmed
16698  * [`best_block_updated`]: Self::best_block_updated
16699  * [`get_relevant_txids`]: Self::get_relevant_txids
16700  */
16701 typedef struct LDKConfirm {
16702    /**
16703     * An opaque pointer which is passed to your function implementations as an argument.
16704     * This has no meaning in the LDK, and can be NULL or any other value.
16705     */
16706    void *this_arg;
16707    /**
16708     * Notifies LDK of transactions confirmed in a block with a given header and height.
16709     *
16710     * Must be called for any transactions registered by [`Filter::register_tx`] or any
16711     * transactions spending an output registered by [`Filter::register_output`]. Such transactions
16712     * appearing in the same block do not need to be included in the same call; instead, multiple
16713     * calls with additional transactions may be made so long as they are made in [chain order].
16714     *
16715     * May be called before or after [`best_block_updated`] for the corresponding block. However,
16716     * in the event of a chain reorganization, it must not be called with a `header` that is no
16717     * longer in the chain as of the last call to [`best_block_updated`].
16718     *
16719     * [chain order]: Confirm#order
16720     * [`best_block_updated`]: Self::best_block_updated
16721     */
16722    void (*transactions_confirmed)(const void *this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height);
16723    /**
16724     * Notifies LDK of a transaction that is no longer confirmed as result of a chain reorganization.
16725     *
16726     * Must be called for any transaction returned by [`get_relevant_txids`] if it has been
16727     * reorganized out of the best chain or if it is no longer confirmed in the block with the
16728     * given block hash. Once called, the given transaction will not be returned
16729     * by [`get_relevant_txids`], unless it has been reconfirmed via [`transactions_confirmed`].
16730     *
16731     * [`get_relevant_txids`]: Self::get_relevant_txids
16732     * [`transactions_confirmed`]: Self::transactions_confirmed
16733     */
16734    void (*transaction_unconfirmed)(const void *this_arg, const uint8_t (*txid)[32]);
16735    /**
16736     * Notifies LDK of an update to the best header connected at the given height.
16737     *
16738     * Must be called whenever a new chain tip becomes available. May be skipped for intermediary
16739     * blocks.
16740     */
16741    void (*best_block_updated)(const void *this_arg, const uint8_t (*header)[80], uint32_t height);
16742    /**
16743     * Returns transactions that must be monitored for reorganization out of the chain along
16744     * with the hash of the block as part of which it had been previously confirmed.
16745     *
16746     * Note that the returned `Option<BlockHash>` might be `None` for channels created with LDK
16747     * 0.0.112 and prior, in which case you need to manually track previous confirmations.
16748     *
16749     * Will include any transactions passed to [`transactions_confirmed`] that have insufficient
16750     * confirmations to be safe from a chain reorganization. Will not include any transactions
16751     * passed to [`transaction_unconfirmed`], unless later reconfirmed.
16752     *
16753     * Must be called to determine the subset of transactions that must be monitored for
16754     * reorganization. Will be idempotent between calls but may change as a result of calls to the
16755     * other interface methods. Thus, this is useful to determine which transactions must be
16756     * given to [`transaction_unconfirmed`].
16757     *
16758     * If any of the returned transactions are confirmed in a block other than the one with the
16759     * given hash, they need to be unconfirmed and reconfirmed via [`transaction_unconfirmed`] and
16760     * [`transactions_confirmed`], respectively.
16761     *
16762     * [`transactions_confirmed`]: Self::transactions_confirmed
16763     * [`transaction_unconfirmed`]: Self::transaction_unconfirmed
16764     */
16765    struct LDKCVec_C2Tuple_TxidCOption_BlockHashZZZ (*get_relevant_txids)(const void *this_arg);
16766    /**
16767     * Frees any resources associated with this object given its this_arg pointer.
16768     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
16769     */
16770    void (*free)(void *this_arg);
16771 } LDKConfirm;
16772
16773 /**
16774  * `Persist` defines behavior for persisting channel monitors: this could mean
16775  * writing once to disk, and/or uploading to one or more backup services.
16776  *
16777  * Each method can return three possible values:
16778  *  * If persistence (including any relevant `fsync()` calls) happens immediately, the
16779  *    implementation should return [`ChannelMonitorUpdateStatus::Completed`], indicating normal
16780  *    channel operation should continue.
16781  *  * If persistence happens asynchronously, implementations should first ensure the
16782  *    [`ChannelMonitor`] or [`ChannelMonitorUpdate`] are written durably to disk, and then return
16783  *    [`ChannelMonitorUpdateStatus::InProgress`] while the update continues in the background.
16784  *    Once the update completes, [`ChainMonitor::channel_monitor_updated`] should be called with
16785  *    the corresponding [`MonitorUpdateId`].
16786  *
16787  *    Note that unlike the direct [`chain::Watch`] interface,
16788  *    [`ChainMonitor::channel_monitor_updated`] must be called once for *each* update which occurs.
16789  *
16790  *  * If persistence fails for some reason, implementations should return
16791  *    [`ChannelMonitorUpdateStatus::PermanentFailure`], in which case the channel will likely be
16792  *    closed without broadcasting the latest state. See
16793  *    [`ChannelMonitorUpdateStatus::PermanentFailure`] for more details.
16794  */
16795 typedef struct LDKPersist {
16796    /**
16797     * An opaque pointer which is passed to your function implementations as an argument.
16798     * This has no meaning in the LDK, and can be NULL or any other value.
16799     */
16800    void *this_arg;
16801    /**
16802     * Persist a new channel's data in response to a [`chain::Watch::watch_channel`] call. This is
16803     * called by [`ChannelManager`] for new channels, or may be called directly, e.g. on startup.
16804     *
16805     * The data can be stored any way you want, but the identifier provided by LDK is the
16806     * channel's outpoint (and it is up to you to maintain a correct mapping between the outpoint
16807     * and the stored channel data). Note that you **must** persist every new monitor to disk.
16808     *
16809     * The `update_id` is used to identify this call to [`ChainMonitor::channel_monitor_updated`],
16810     * if you return [`ChannelMonitorUpdateStatus::InProgress`].
16811     *
16812     * See [`Writeable::write`] on [`ChannelMonitor`] for writing out a `ChannelMonitor`
16813     * and [`ChannelMonitorUpdateStatus`] for requirements when returning errors.
16814     *
16815     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
16816     * [`Writeable::write`]: crate::util::ser::Writeable::write
16817     */
16818    enum LDKChannelMonitorUpdateStatus (*persist_new_channel)(const void *this_arg, struct LDKOutPoint channel_id, const struct LDKChannelMonitor *NONNULL_PTR data, struct LDKMonitorUpdateId update_id);
16819    /**
16820     * Update one channel's data. The provided [`ChannelMonitor`] has already applied the given
16821     * update.
16822     *
16823     * Note that on every update, you **must** persist either the [`ChannelMonitorUpdate`] or the
16824     * updated monitor itself to disk/backups. See the [`Persist`] trait documentation for more
16825     * details.
16826     *
16827     * During blockchain synchronization operations, this may be called with no
16828     * [`ChannelMonitorUpdate`], in which case the full [`ChannelMonitor`] needs to be persisted.
16829     * Note that after the full [`ChannelMonitor`] is persisted any previous
16830     * [`ChannelMonitorUpdate`]s which were persisted should be discarded - they can no longer be
16831     * applied to the persisted [`ChannelMonitor`] as they were already applied.
16832     *
16833     * If an implementer chooses to persist the updates only, they need to make
16834     * sure that all the updates are applied to the `ChannelMonitors` *before*
16835     * the set of channel monitors is given to the `ChannelManager`
16836     * deserialization routine. See [`ChannelMonitor::update_monitor`] for
16837     * applying a monitor update to a monitor. If full `ChannelMonitors` are
16838     * persisted, then there is no need to persist individual updates.
16839     *
16840     * Note that there could be a performance tradeoff between persisting complete
16841     * channel monitors on every update vs. persisting only updates and applying
16842     * them in batches. The size of each monitor grows `O(number of state updates)`
16843     * whereas updates are small and `O(1)`.
16844     *
16845     * The `update_id` is used to identify this call to [`ChainMonitor::channel_monitor_updated`],
16846     * if you return [`ChannelMonitorUpdateStatus::InProgress`].
16847     *
16848     * See [`Writeable::write`] on [`ChannelMonitor`] for writing out a `ChannelMonitor`,
16849     * [`Writeable::write`] on [`ChannelMonitorUpdate`] for writing out an update, and
16850     * [`ChannelMonitorUpdateStatus`] for requirements when returning errors.
16851     *
16852     * [`Writeable::write`]: crate::util::ser::Writeable::write
16853     *
16854     * Note that update (or a relevant inner pointer) may be NULL or all-0s to represent None
16855     */
16856    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);
16857    /**
16858     * Frees any resources associated with this object given its this_arg pointer.
16859     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
16860     */
16861    void (*free)(void *this_arg);
16862 } LDKPersist;
16863
16864
16865
16866 /**
16867  * An implementation of [`chain::Watch`] for monitoring channels.
16868  *
16869  * Connected and disconnected blocks must be provided to `ChainMonitor` as documented by
16870  * [`chain::Watch`]. May be used in conjunction with [`ChannelManager`] to monitor channels locally
16871  * or used independently to monitor channels remotely. See the [module-level documentation] for
16872  * details.
16873  *
16874  * Note that `ChainMonitor` should regularly trigger rebroadcasts/fee bumps of pending claims from
16875  * a force-closed channel. This is crucial in preventing certain classes of pinning attacks,
16876  * detecting substantial mempool feerate changes between blocks, and ensuring reliability if
16877  * broadcasting fails. We recommend invoking this every 30 seconds, or lower if running in an
16878  * environment with spotty connections, like on mobile.
16879  *
16880  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
16881  * [module-level documentation]: crate::chain::chainmonitor
16882  * [`rebroadcast_pending_claims`]: Self::rebroadcast_pending_claims
16883  */
16884 typedef struct MUST_USE_STRUCT LDKChainMonitor {
16885    /**
16886     * A pointer to the opaque Rust object.
16887     * Nearly everywhere, inner must be non-null, however in places where
16888     * the Rust equivalent takes an Option, it may be set to null to indicate None.
16889     */
16890    LDKnativeChainMonitor *inner;
16891    /**
16892     * Indicates that this is the only struct which contains the same pointer.
16893     * Rust functions which take ownership of an object provided via an argument require
16894     * this to be true and invalidate the object pointed to by inner.
16895     */
16896    bool is_owned;
16897 } LDKChainMonitor;
16898
16899 /**
16900  * A trait implemented for objects handling events from [`EventsProvider`].
16901  *
16902  * An async variation also exists for implementations of [`EventsProvider`] that support async
16903  * event handling. The async event handler should satisfy the generic bounds: `F:
16904  * core::future::Future, H: Fn(Event) -> F`.
16905  */
16906 typedef struct LDKEventHandler {
16907    /**
16908     * An opaque pointer which is passed to your function implementations as an argument.
16909     * This has no meaning in the LDK, and can be NULL or any other value.
16910     */
16911    void *this_arg;
16912    /**
16913     * Handles the given [`Event`].
16914     *
16915     * See [`EventsProvider`] for details that must be considered when implementing this method.
16916     */
16917    void (*handle_event)(const void *this_arg, struct LDKEvent event);
16918    /**
16919     * Frees any resources associated with this object given its this_arg pointer.
16920     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
16921     */
16922    void (*free)(void *this_arg);
16923 } LDKEventHandler;
16924
16925 /**
16926  * A trait indicating an object may generate events.
16927  *
16928  * Events are processed by passing an [`EventHandler`] to [`process_pending_events`].
16929  *
16930  * Implementations of this trait may also feature an async version of event handling, as shown with
16931  * [`ChannelManager::process_pending_events_async`] and
16932  * [`ChainMonitor::process_pending_events_async`].
16933  *
16934  * # Requirements
16935  *
16936  * When using this trait, [`process_pending_events`] will call [`handle_event`] for each pending
16937  * event since the last invocation.
16938  *
16939  * In order to ensure no [`Event`]s are lost, implementors of this trait will persist [`Event`]s
16940  * and replay any unhandled events on startup. An [`Event`] is considered handled when
16941  * [`process_pending_events`] returns, thus handlers MUST fully handle [`Event`]s and persist any
16942  * relevant changes to disk *before* returning.
16943  *
16944  * Further, because an application may crash between an [`Event`] being handled and the
16945  * implementor of this trait being re-serialized, [`Event`] handling must be idempotent - in
16946  * effect, [`Event`]s may be replayed.
16947  *
16948  * Note, handlers may call back into the provider and thus deadlocking must be avoided. Be sure to
16949  * consult the provider's documentation on the implication of processing events and how a handler
16950  * may safely use the provider (e.g., see [`ChannelManager::process_pending_events`] and
16951  * [`ChainMonitor::process_pending_events`]).
16952  *
16953  * (C-not implementable) As there is likely no reason for a user to implement this trait on their
16954  * own type(s).
16955  *
16956  * [`process_pending_events`]: Self::process_pending_events
16957  * [`handle_event`]: EventHandler::handle_event
16958  * [`ChannelManager::process_pending_events`]: crate::ln::channelmanager::ChannelManager#method.process_pending_events
16959  * [`ChainMonitor::process_pending_events`]: crate::chain::chainmonitor::ChainMonitor#method.process_pending_events
16960  * [`ChannelManager::process_pending_events_async`]: crate::ln::channelmanager::ChannelManager::process_pending_events_async
16961  * [`ChainMonitor::process_pending_events_async`]: crate::chain::chainmonitor::ChainMonitor::process_pending_events_async
16962  */
16963 typedef struct LDKEventsProvider {
16964    /**
16965     * An opaque pointer which is passed to your function implementations as an argument.
16966     * This has no meaning in the LDK, and can be NULL or any other value.
16967     */
16968    void *this_arg;
16969    /**
16970     * Processes any events generated since the last call using the given event handler.
16971     *
16972     * See the trait-level documentation for requirements.
16973     */
16974    void (*process_pending_events)(const void *this_arg, struct LDKEventHandler handler);
16975    /**
16976     * Frees any resources associated with this object given its this_arg pointer.
16977     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
16978     */
16979    void (*free)(void *this_arg);
16980 } LDKEventsProvider;
16981
16982
16983
16984 /**
16985  * Chain-related parameters used to construct a new `ChannelManager`.
16986  *
16987  * Typically, the block-specific parameters are derived from the best block hash for the network,
16988  * as a newly constructed `ChannelManager` will not have created any channels yet. These parameters
16989  * are not needed when deserializing a previously constructed `ChannelManager`.
16990  */
16991 typedef struct MUST_USE_STRUCT LDKChainParameters {
16992    /**
16993     * A pointer to the opaque Rust object.
16994     * Nearly everywhere, inner must be non-null, however in places where
16995     * the Rust equivalent takes an Option, it may be set to null to indicate None.
16996     */
16997    LDKnativeChainParameters *inner;
16998    /**
16999     * Indicates that this is the only struct which contains the same pointer.
17000     * Rust functions which take ownership of an object provided via an argument require
17001     * this to be true and invalidate the object pointed to by inner.
17002     */
17003    bool is_owned;
17004 } LDKChainParameters;
17005
17006 /**
17007  * Strategies available to retry payment path failures.
17008  */
17009 typedef enum LDKRetry_Tag {
17010    /**
17011     * Max number of attempts to retry payment.
17012     *
17013     * Each attempt may be multiple HTLCs along multiple paths if the router decides to split up a
17014     * retry, and may retry multiple failed HTLCs at once if they failed around the same time and
17015     * were retried along a route from a single call to [`Router::find_route_with_id`].
17016     */
17017    LDKRetry_Attempts,
17018    /**
17019     * Time elapsed before abandoning retries for a payment. At least one attempt at payment is made;
17020     * see [`PaymentParameters::expiry_time`] to avoid any attempt at payment after a specific time.
17021     *
17022     * [`PaymentParameters::expiry_time`]: crate::routing::router::PaymentParameters::expiry_time
17023     */
17024    LDKRetry_Timeout,
17025    /**
17026     * Must be last for serialization purposes
17027     */
17028    LDKRetry_Sentinel,
17029 } LDKRetry_Tag;
17030
17031 typedef struct MUST_USE_STRUCT LDKRetry {
17032    LDKRetry_Tag tag;
17033    union {
17034       struct {
17035          uintptr_t attempts;
17036       };
17037       struct {
17038          uint64_t timeout;
17039       };
17040    };
17041 } LDKRetry;
17042
17043 /**
17044  * A trait indicating an object may generate message send events
17045  */
17046 typedef struct LDKMessageSendEventsProvider {
17047    /**
17048     * An opaque pointer which is passed to your function implementations as an argument.
17049     * This has no meaning in the LDK, and can be NULL or any other value.
17050     */
17051    void *this_arg;
17052    /**
17053     * Gets the list of pending events which were generated by previous actions, clearing the list
17054     * in the process.
17055     */
17056    struct LDKCVec_MessageSendEventZ (*get_and_clear_pending_msg_events)(const void *this_arg);
17057    /**
17058     * Frees any resources associated with this object given its this_arg pointer.
17059     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
17060     */
17061    void (*free)(void *this_arg);
17062 } LDKMessageSendEventsProvider;
17063
17064 /**
17065  * A trait to describe an object which can receive channel messages.
17066  *
17067  * Messages MAY be called in parallel when they originate from different `their_node_ids`, however
17068  * they MUST NOT be called in parallel when the two calls have the same `their_node_id`.
17069  */
17070 typedef struct LDKChannelMessageHandler {
17071    /**
17072     * An opaque pointer which is passed to your function implementations as an argument.
17073     * This has no meaning in the LDK, and can be NULL or any other value.
17074     */
17075    void *this_arg;
17076    /**
17077     * Handle an incoming `open_channel` message from the given peer.
17078     */
17079    void (*handle_open_channel)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKOpenChannel *NONNULL_PTR msg);
17080    /**
17081     * Handle an incoming `open_channel2` message from the given peer.
17082     */
17083    void (*handle_open_channel_v2)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKOpenChannelV2 *NONNULL_PTR msg);
17084    /**
17085     * Handle an incoming `accept_channel` message from the given peer.
17086     */
17087    void (*handle_accept_channel)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKAcceptChannel *NONNULL_PTR msg);
17088    /**
17089     * Handle an incoming `accept_channel2` message from the given peer.
17090     */
17091    void (*handle_accept_channel_v2)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKAcceptChannelV2 *NONNULL_PTR msg);
17092    /**
17093     * Handle an incoming `funding_created` message from the given peer.
17094     */
17095    void (*handle_funding_created)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingCreated *NONNULL_PTR msg);
17096    /**
17097     * Handle an incoming `funding_signed` message from the given peer.
17098     */
17099    void (*handle_funding_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingSigned *NONNULL_PTR msg);
17100    /**
17101     * Handle an incoming `channel_ready` message from the given peer.
17102     */
17103    void (*handle_channel_ready)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelReady *NONNULL_PTR msg);
17104    /**
17105     * Handle an incoming `shutdown` message from the given peer.
17106     */
17107    void (*handle_shutdown)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKShutdown *NONNULL_PTR msg);
17108    /**
17109     * Handle an incoming `closing_signed` message from the given peer.
17110     */
17111    void (*handle_closing_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKClosingSigned *NONNULL_PTR msg);
17112    /**
17113     * Handle an incoming `tx_add_input message` from the given peer.
17114     */
17115    void (*handle_tx_add_input)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKTxAddInput *NONNULL_PTR msg);
17116    /**
17117     * Handle an incoming `tx_add_output` message from the given peer.
17118     */
17119    void (*handle_tx_add_output)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKTxAddOutput *NONNULL_PTR msg);
17120    /**
17121     * Handle an incoming `tx_remove_input` message from the given peer.
17122     */
17123    void (*handle_tx_remove_input)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKTxRemoveInput *NONNULL_PTR msg);
17124    /**
17125     * Handle an incoming `tx_remove_output` message from the given peer.
17126     */
17127    void (*handle_tx_remove_output)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKTxRemoveOutput *NONNULL_PTR msg);
17128    /**
17129     * Handle an incoming `tx_complete message` from the given peer.
17130     */
17131    void (*handle_tx_complete)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKTxComplete *NONNULL_PTR msg);
17132    /**
17133     * Handle an incoming `tx_signatures` message from the given peer.
17134     */
17135    void (*handle_tx_signatures)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKTxSignatures *NONNULL_PTR msg);
17136    /**
17137     * Handle an incoming `tx_init_rbf` message from the given peer.
17138     */
17139    void (*handle_tx_init_rbf)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKTxInitRbf *NONNULL_PTR msg);
17140    /**
17141     * Handle an incoming `tx_ack_rbf` message from the given peer.
17142     */
17143    void (*handle_tx_ack_rbf)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKTxAckRbf *NONNULL_PTR msg);
17144    /**
17145     * Handle an incoming `tx_abort message` from the given peer.
17146     */
17147    void (*handle_tx_abort)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKTxAbort *NONNULL_PTR msg);
17148    /**
17149     * Handle an incoming `update_add_htlc` message from the given peer.
17150     */
17151    void (*handle_update_add_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateAddHTLC *NONNULL_PTR msg);
17152    /**
17153     * Handle an incoming `update_fulfill_htlc` message from the given peer.
17154     */
17155    void (*handle_update_fulfill_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFulfillHTLC *NONNULL_PTR msg);
17156    /**
17157     * Handle an incoming `update_fail_htlc` message from the given peer.
17158     */
17159    void (*handle_update_fail_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailHTLC *NONNULL_PTR msg);
17160    /**
17161     * Handle an incoming `update_fail_malformed_htlc` message from the given peer.
17162     */
17163    void (*handle_update_fail_malformed_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR msg);
17164    /**
17165     * Handle an incoming `commitment_signed` message from the given peer.
17166     */
17167    void (*handle_commitment_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKCommitmentSigned *NONNULL_PTR msg);
17168    /**
17169     * Handle an incoming `revoke_and_ack` message from the given peer.
17170     */
17171    void (*handle_revoke_and_ack)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKRevokeAndACK *NONNULL_PTR msg);
17172    /**
17173     * Handle an incoming `update_fee` message from the given peer.
17174     */
17175    void (*handle_update_fee)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFee *NONNULL_PTR msg);
17176    /**
17177     * Handle an incoming `announcement_signatures` message from the given peer.
17178     */
17179    void (*handle_announcement_signatures)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKAnnouncementSignatures *NONNULL_PTR msg);
17180    /**
17181     * Indicates a connection to the peer failed/an existing connection was lost.
17182     */
17183    void (*peer_disconnected)(const void *this_arg, struct LDKPublicKey their_node_id);
17184    /**
17185     * Handle a peer reconnecting, possibly generating `channel_reestablish` message(s).
17186     *
17187     * May return an `Err(())` if the features the peer supports are not sufficient to communicate
17188     * with us. Implementors should be somewhat conservative about doing so, however, as other
17189     * message handlers may still wish to communicate with this peer.
17190     */
17191    struct LDKCResult_NoneNoneZ (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR msg, bool inbound);
17192    /**
17193     * Handle an incoming `channel_reestablish` message from the given peer.
17194     */
17195    void (*handle_channel_reestablish)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelReestablish *NONNULL_PTR msg);
17196    /**
17197     * Handle an incoming `channel_update` message from the given peer.
17198     */
17199    void (*handle_channel_update)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelUpdate *NONNULL_PTR msg);
17200    /**
17201     * Handle an incoming `error` message from the given peer.
17202     */
17203    void (*handle_error)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKErrorMessage *NONNULL_PTR msg);
17204    /**
17205     * Gets the node feature flags which this handler itself supports. All available handlers are
17206     * queried similarly and their feature flags are OR'd together to form the [`NodeFeatures`]
17207     * which are broadcasted in our [`NodeAnnouncement`] message.
17208     */
17209    struct LDKNodeFeatures (*provided_node_features)(const void *this_arg);
17210    /**
17211     * Gets the init feature flags which should be sent to the given peer. All available handlers
17212     * are queried similarly and their feature flags are OR'd together to form the [`InitFeatures`]
17213     * which are sent in our [`Init`] message.
17214     *
17215     * Note that this method is called before [`Self::peer_connected`].
17216     */
17217    struct LDKInitFeatures (*provided_init_features)(const void *this_arg, struct LDKPublicKey their_node_id);
17218    /**
17219     * Gets the genesis hashes for this `ChannelMessageHandler` indicating which chains it supports.
17220     *
17221     * If it's `None`, then no particular network chain hash compatibility will be enforced when
17222     * connecting to peers.
17223     */
17224    struct LDKCOption_CVec_ChainHashZZ (*get_genesis_hashes)(const void *this_arg);
17225    /**
17226     * Implementation of MessageSendEventsProvider for this object.
17227     */
17228    struct LDKMessageSendEventsProvider MessageSendEventsProvider;
17229    /**
17230     * Frees any resources associated with this object given its this_arg pointer.
17231     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
17232     */
17233    void (*free)(void *this_arg);
17234 } LDKChannelMessageHandler;
17235
17236
17237
17238 /**
17239  * Arguments for the creation of a ChannelManager that are not deserialized.
17240  *
17241  * At a high-level, the process for deserializing a ChannelManager and resuming normal operation
17242  * is:
17243  * 1) Deserialize all stored [`ChannelMonitor`]s.
17244  * 2) Deserialize the [`ChannelManager`] by filling in this struct and calling:
17245  *    `<(BlockHash, ChannelManager)>::read(reader, args)`
17246  *    This may result in closing some channels if the [`ChannelMonitor`] is newer than the stored
17247  *    [`ChannelManager`] state to ensure no loss of funds. Thus, transactions may be broadcasted.
17248  * 3) If you are not fetching full blocks, register all relevant [`ChannelMonitor`] outpoints the
17249  *    same way you would handle a [`chain::Filter`] call using
17250  *    [`ChannelMonitor::get_outputs_to_watch`] and [`ChannelMonitor::get_funding_txo`].
17251  * 4) Reconnect blocks on your [`ChannelMonitor`]s.
17252  * 5) Disconnect/connect blocks on the [`ChannelManager`].
17253  * 6) Re-persist the [`ChannelMonitor`]s to ensure the latest state is on disk.
17254  *    Note that if you're using a [`ChainMonitor`] for your [`chain::Watch`] implementation, you
17255  *    will likely accomplish this as a side-effect of calling [`chain::Watch::watch_channel`] in
17256  *    the next step.
17257  * 7) Move the [`ChannelMonitor`]s into your local [`chain::Watch`]. If you're using a
17258  *    [`ChainMonitor`], this is done by calling [`chain::Watch::watch_channel`].
17259  *
17260  * Note that the ordering of #4-7 is not of importance, however all four must occur before you
17261  * call any other methods on the newly-deserialized [`ChannelManager`].
17262  *
17263  * Note that because some channels may be closed during deserialization, it is critical that you
17264  * always deserialize only the latest version of a ChannelManager and ChannelMonitors available to
17265  * you. If you deserialize an old ChannelManager (during which force-closure transactions may be
17266  * broadcast), and then later deserialize a newer version of the same ChannelManager (which will
17267  * not force-close the same channels but consider them live), you may end up revoking a state for
17268  * which you've already broadcasted the transaction.
17269  *
17270  * [`ChainMonitor`]: crate::chain::chainmonitor::ChainMonitor
17271  */
17272 typedef struct MUST_USE_STRUCT LDKChannelManagerReadArgs {
17273    /**
17274     * A pointer to the opaque Rust object.
17275     * Nearly everywhere, inner must be non-null, however in places where
17276     * the Rust equivalent takes an Option, it may be set to null to indicate None.
17277     */
17278    LDKnativeChannelManagerReadArgs *inner;
17279    /**
17280     * Indicates that this is the only struct which contains the same pointer.
17281     * Rust functions which take ownership of an object provided via an argument require
17282     * this to be true and invalidate the object pointed to by inner.
17283     */
17284    bool is_owned;
17285 } LDKChannelManagerReadArgs;
17286
17287
17288
17289 /**
17290  * A set of keys that were HKDF-expanded from an initial call to
17291  * [`NodeSigner::get_inbound_payment_key_material`].
17292  *
17293  * [`NodeSigner::get_inbound_payment_key_material`]: crate::sign::NodeSigner::get_inbound_payment_key_material
17294  */
17295 typedef struct MUST_USE_STRUCT LDKExpandedKey {
17296    /**
17297     * A pointer to the opaque Rust object.
17298     * Nearly everywhere, inner must be non-null, however in places where
17299     * the Rust equivalent takes an Option, it may be set to null to indicate None.
17300     */
17301    LDKnativeExpandedKey *inner;
17302    /**
17303     * Indicates that this is the only struct which contains the same pointer.
17304     * Rust functions which take ownership of an object provided via an argument require
17305     * this to be true and invalidate the object pointed to by inner.
17306     */
17307    bool is_owned;
17308 } LDKExpandedKey;
17309
17310 /**
17311  * A 3-byte byte array.
17312  */
17313 typedef struct LDKThreeBytes {
17314    /**
17315     * The three bytes
17316     */
17317    uint8_t data[3];
17318 } LDKThreeBytes;
17319
17320 /**
17321  * A trait to describe an object which can receive routing messages.
17322  *
17323  * # Implementor DoS Warnings
17324  *
17325  * For messages enabled with the `gossip_queries` feature there are potential DoS vectors when
17326  * handling inbound queries. Implementors using an on-disk network graph should be aware of
17327  * repeated disk I/O for queries accessing different parts of the network graph.
17328  */
17329 typedef struct LDKRoutingMessageHandler {
17330    /**
17331     * An opaque pointer which is passed to your function implementations as an argument.
17332     * This has no meaning in the LDK, and can be NULL or any other value.
17333     */
17334    void *this_arg;
17335    /**
17336     * Handle an incoming `node_announcement` message, returning `true` if it should be forwarded on,
17337     * `false` or returning an `Err` otherwise.
17338     */
17339    struct LDKCResult_boolLightningErrorZ (*handle_node_announcement)(const void *this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
17340    /**
17341     * Handle a `channel_announcement` message, returning `true` if it should be forwarded on, `false`
17342     * or returning an `Err` otherwise.
17343     */
17344    struct LDKCResult_boolLightningErrorZ (*handle_channel_announcement)(const void *this_arg, const struct LDKChannelAnnouncement *NONNULL_PTR msg);
17345    /**
17346     * Handle an incoming `channel_update` message, returning true if it should be forwarded on,
17347     * `false` or returning an `Err` otherwise.
17348     */
17349    struct LDKCResult_boolLightningErrorZ (*handle_channel_update)(const void *this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
17350    /**
17351     * Gets channel announcements and updates required to dump our routing table to a remote node,
17352     * starting at the `short_channel_id` indicated by `starting_point` and including announcements
17353     * for a single channel.
17354     */
17355    struct LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ (*get_next_channel_announcement)(const void *this_arg, uint64_t starting_point);
17356    /**
17357     * Gets a node announcement required to dump our routing table to a remote node, starting at
17358     * the node *after* the provided pubkey and including up to one announcement immediately
17359     * higher (as defined by `<PublicKey as Ord>::cmp`) than `starting_point`.
17360     * If `None` is provided for `starting_point`, we start at the first node.
17361     *
17362     * Note that starting_point (or a relevant inner pointer) may be NULL or all-0s to represent None
17363     * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
17364     */
17365    struct LDKNodeAnnouncement (*get_next_node_announcement)(const void *this_arg, struct LDKNodeId starting_point);
17366    /**
17367     * Called when a connection is established with a peer. This can be used to
17368     * perform routing table synchronization using a strategy defined by the
17369     * implementor.
17370     *
17371     * May return an `Err(())` if the features the peer supports are not sufficient to communicate
17372     * with us. Implementors should be somewhat conservative about doing so, however, as other
17373     * message handlers may still wish to communicate with this peer.
17374     */
17375    struct LDKCResult_NoneNoneZ (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR init, bool inbound);
17376    /**
17377     * Handles the reply of a query we initiated to learn about channels
17378     * for a given range of blocks. We can expect to receive one or more
17379     * replies to a single query.
17380     */
17381    struct LDKCResult_NoneLightningErrorZ (*handle_reply_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyChannelRange msg);
17382    /**
17383     * Handles the reply of a query we initiated asking for routing gossip
17384     * messages for a list of channels. We should receive this message when
17385     * a node has completed its best effort to send us the pertaining routing
17386     * gossip messages.
17387     */
17388    struct LDKCResult_NoneLightningErrorZ (*handle_reply_short_channel_ids_end)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyShortChannelIdsEnd msg);
17389    /**
17390     * Handles when a peer asks us to send a list of `short_channel_id`s
17391     * for the requested range of blocks.
17392     */
17393    struct LDKCResult_NoneLightningErrorZ (*handle_query_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryChannelRange msg);
17394    /**
17395     * Handles when a peer asks us to send routing gossip messages for a
17396     * list of `short_channel_id`s.
17397     */
17398    struct LDKCResult_NoneLightningErrorZ (*handle_query_short_channel_ids)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryShortChannelIds msg);
17399    /**
17400     * Indicates that there are a large number of [`ChannelAnnouncement`] (or other) messages
17401     * pending some async action. While there is no guarantee of the rate of future messages, the
17402     * caller should seek to reduce the rate of new gossip messages handled, especially
17403     * [`ChannelAnnouncement`]s.
17404     */
17405    bool (*processing_queue_high)(const void *this_arg);
17406    /**
17407     * Gets the node feature flags which this handler itself supports. All available handlers are
17408     * queried similarly and their feature flags are OR'd together to form the [`NodeFeatures`]
17409     * which are broadcasted in our [`NodeAnnouncement`] message.
17410     */
17411    struct LDKNodeFeatures (*provided_node_features)(const void *this_arg);
17412    /**
17413     * Gets the init feature flags which should be sent to the given peer. All available handlers
17414     * are queried similarly and their feature flags are OR'd together to form the [`InitFeatures`]
17415     * which are sent in our [`Init`] message.
17416     *
17417     * Note that this method is called before [`Self::peer_connected`].
17418     */
17419    struct LDKInitFeatures (*provided_init_features)(const void *this_arg, struct LDKPublicKey their_node_id);
17420    /**
17421     * Implementation of MessageSendEventsProvider for this object.
17422     */
17423    struct LDKMessageSendEventsProvider MessageSendEventsProvider;
17424    /**
17425     * Frees any resources associated with this object given its this_arg pointer.
17426     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
17427     */
17428    void (*free)(void *this_arg);
17429 } LDKRoutingMessageHandler;
17430
17431 /**
17432  * A trait indicating an object may generate onion messages to send
17433  */
17434 typedef struct LDKOnionMessageProvider {
17435    /**
17436     * An opaque pointer which is passed to your function implementations as an argument.
17437     * This has no meaning in the LDK, and can be NULL or any other value.
17438     */
17439    void *this_arg;
17440    /**
17441     * Gets the next pending onion message for the peer with the given node id.
17442     *
17443     * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
17444     */
17445    struct LDKOnionMessage (*next_onion_message_for_peer)(const void *this_arg, struct LDKPublicKey peer_node_id);
17446    /**
17447     * Frees any resources associated with this object given its this_arg pointer.
17448     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
17449     */
17450    void (*free)(void *this_arg);
17451 } LDKOnionMessageProvider;
17452
17453 /**
17454  * A trait to describe an object that can receive onion messages.
17455  */
17456 typedef struct LDKOnionMessageHandler {
17457    /**
17458     * An opaque pointer which is passed to your function implementations as an argument.
17459     * This has no meaning in the LDK, and can be NULL or any other value.
17460     */
17461    void *this_arg;
17462    /**
17463     * Handle an incoming `onion_message` message from the given peer.
17464     */
17465    void (*handle_onion_message)(const void *this_arg, struct LDKPublicKey peer_node_id, const struct LDKOnionMessage *NONNULL_PTR msg);
17466    /**
17467     * Called when a connection is established with a peer. Can be used to track which peers
17468     * advertise onion message support and are online.
17469     *
17470     * May return an `Err(())` if the features the peer supports are not sufficient to communicate
17471     * with us. Implementors should be somewhat conservative about doing so, however, as other
17472     * message handlers may still wish to communicate with this peer.
17473     */
17474    struct LDKCResult_NoneNoneZ (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR init, bool inbound);
17475    /**
17476     * Indicates a connection to the peer failed/an existing connection was lost. Allows handlers to
17477     * drop and refuse to forward onion messages to this peer.
17478     */
17479    void (*peer_disconnected)(const void *this_arg, struct LDKPublicKey their_node_id);
17480    /**
17481     * Gets the node feature flags which this handler itself supports. All available handlers are
17482     * queried similarly and their feature flags are OR'd together to form the [`NodeFeatures`]
17483     * which are broadcasted in our [`NodeAnnouncement`] message.
17484     */
17485    struct LDKNodeFeatures (*provided_node_features)(const void *this_arg);
17486    /**
17487     * Gets the init feature flags which should be sent to the given peer. All available handlers
17488     * are queried similarly and their feature flags are OR'd together to form the [`InitFeatures`]
17489     * which are sent in our [`Init`] message.
17490     *
17491     * Note that this method is called before [`Self::peer_connected`].
17492     */
17493    struct LDKInitFeatures (*provided_init_features)(const void *this_arg, struct LDKPublicKey their_node_id);
17494    /**
17495     * Implementation of OnionMessageProvider for this object.
17496     */
17497    struct LDKOnionMessageProvider OnionMessageProvider;
17498    /**
17499     * Frees any resources associated with this object given its this_arg pointer.
17500     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
17501     */
17502    void (*free)(void *this_arg);
17503 } LDKOnionMessageHandler;
17504
17505 /**
17506  * Trait to be implemented by custom message (unrelated to the channel/gossip LN layers)
17507  * decoders.
17508  */
17509 typedef struct LDKCustomMessageReader {
17510    /**
17511     * An opaque pointer which is passed to your function implementations as an argument.
17512     * This has no meaning in the LDK, and can be NULL or any other value.
17513     */
17514    void *this_arg;
17515    /**
17516     * Decodes a custom message to `CustomMessageType`. If the given message type is known to the
17517     * implementation and the message could be decoded, must return `Ok(Some(message))`. If the
17518     * message type is unknown to the implementation, must return `Ok(None)`. If a decoding error
17519     * occur, must return `Err(DecodeError::X)` where `X` details the encountered error.
17520     */
17521    struct LDKCResult_COption_TypeZDecodeErrorZ (*read)(const void *this_arg, uint16_t message_type, struct LDKu8slice buffer);
17522    /**
17523     * Frees any resources associated with this object given its this_arg pointer.
17524     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
17525     */
17526    void (*free)(void *this_arg);
17527 } LDKCustomMessageReader;
17528
17529 /**
17530  * A handler provided to [`PeerManager`] for reading and handling custom messages.
17531  *
17532  * [BOLT 1] specifies a custom message type range for use with experimental or application-specific
17533  * messages. `CustomMessageHandler` allows for user-defined handling of such types. See the
17534  * [`lightning_custom_message`] crate for tools useful in composing more than one custom handler.
17535  *
17536  * [BOLT 1]: https://github.com/lightning/bolts/blob/master/01-messaging.md
17537  * [`lightning_custom_message`]: https://docs.rs/lightning_custom_message/latest/lightning_custom_message
17538  */
17539 typedef struct LDKCustomMessageHandler {
17540    /**
17541     * An opaque pointer which is passed to your function implementations as an argument.
17542     * This has no meaning in the LDK, and can be NULL or any other value.
17543     */
17544    void *this_arg;
17545    /**
17546     * Handles the given message sent from `sender_node_id`, possibly producing messages for
17547     * [`CustomMessageHandler::get_and_clear_pending_msg`] to return and thus for [`PeerManager`]
17548     * to send.
17549     */
17550    struct LDKCResult_NoneLightningErrorZ (*handle_custom_message)(const void *this_arg, struct LDKType msg, struct LDKPublicKey sender_node_id);
17551    /**
17552     * Returns the list of pending messages that were generated by the handler, clearing the list
17553     * in the process. Each message is paired with the node id of the intended recipient. If no
17554     * connection to the node exists, then the message is simply not sent.
17555     */
17556    struct LDKCVec_C2Tuple_PublicKeyTypeZZ (*get_and_clear_pending_msg)(const void *this_arg);
17557    /**
17558     * Gets the node feature flags which this handler itself supports. All available handlers are
17559     * queried similarly and their feature flags are OR'd together to form the [`NodeFeatures`]
17560     * which are broadcasted in our [`NodeAnnouncement`] message.
17561     *
17562     * [`NodeAnnouncement`]: crate::ln::msgs::NodeAnnouncement
17563     */
17564    struct LDKNodeFeatures (*provided_node_features)(const void *this_arg);
17565    /**
17566     * Gets the init feature flags which should be sent to the given peer. All available handlers
17567     * are queried similarly and their feature flags are OR'd together to form the [`InitFeatures`]
17568     * which are sent in our [`Init`] message.
17569     *
17570     * [`Init`]: crate::ln::msgs::Init
17571     */
17572    struct LDKInitFeatures (*provided_init_features)(const void *this_arg, struct LDKPublicKey their_node_id);
17573    /**
17574     * Implementation of CustomMessageReader for this object.
17575     */
17576    struct LDKCustomMessageReader CustomMessageReader;
17577    /**
17578     * Frees any resources associated with this object given its this_arg pointer.
17579     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
17580     */
17581    void (*free)(void *this_arg);
17582 } LDKCustomMessageHandler;
17583
17584
17585
17586 /**
17587  * A dummy struct which implements `RoutingMessageHandler` without storing any routing information
17588  * or doing any processing. You can provide one of these as the route_handler in a MessageHandler.
17589  */
17590 typedef struct MUST_USE_STRUCT LDKIgnoringMessageHandler {
17591    /**
17592     * A pointer to the opaque Rust object.
17593     * Nearly everywhere, inner must be non-null, however in places where
17594     * the Rust equivalent takes an Option, it may be set to null to indicate None.
17595     */
17596    LDKnativeIgnoringMessageHandler *inner;
17597    /**
17598     * Indicates that this is the only struct which contains the same pointer.
17599     * Rust functions which take ownership of an object provided via an argument require
17600     * this to be true and invalidate the object pointed to by inner.
17601     */
17602    bool is_owned;
17603 } LDKIgnoringMessageHandler;
17604
17605 /**
17606  * A handler for an [`OnionMessage`] containing a BOLT 12 Offers message as its payload.
17607  *
17608  * [`OnionMessage`]: crate::ln::msgs::OnionMessage
17609  */
17610 typedef struct LDKOffersMessageHandler {
17611    /**
17612     * An opaque pointer which is passed to your function implementations as an argument.
17613     * This has no meaning in the LDK, and can be NULL or any other value.
17614     */
17615    void *this_arg;
17616    /**
17617     * Handles the given message by either responding with an [`Bolt12Invoice`], sending a payment,
17618     * or replying with an error.
17619     */
17620    struct LDKCOption_OffersMessageZ (*handle_message)(const void *this_arg, struct LDKOffersMessage message);
17621    /**
17622     * Frees any resources associated with this object given its this_arg pointer.
17623     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
17624     */
17625    void (*free)(void *this_arg);
17626 } LDKOffersMessageHandler;
17627
17628 /**
17629  * Handler for custom onion messages. If you are using [`SimpleArcOnionMessenger`],
17630  * [`SimpleRefOnionMessenger`], or prefer to ignore inbound custom onion messages,
17631  * [`IgnoringMessageHandler`] must be provided to [`OnionMessenger::new`]. Otherwise, a custom
17632  * implementation of this trait must be provided, with [`CustomMessage`] specifying the supported
17633  * message types.
17634  *
17635  * See [`OnionMessenger`] for example usage.
17636  *
17637  * [`IgnoringMessageHandler`]: crate::ln::peer_handler::IgnoringMessageHandler
17638  * [`CustomMessage`]: Self::CustomMessage
17639  */
17640 typedef struct LDKCustomOnionMessageHandler {
17641    /**
17642     * An opaque pointer which is passed to your function implementations as an argument.
17643     * This has no meaning in the LDK, and can be NULL or any other value.
17644     */
17645    void *this_arg;
17646    /**
17647     * Called with the custom message that was received, returning a response to send, if any.
17648     */
17649    struct LDKCOption_CustomOnionMessageContentsZ (*handle_custom_message)(const void *this_arg, struct LDKCustomOnionMessageContents msg);
17650    /**
17651     * Read a custom message of type `message_type` from `buffer`, returning `Ok(None)` if the
17652     * message type is unknown.
17653     */
17654    struct LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ (*read_custom_message)(const void *this_arg, uint64_t message_type, struct LDKu8slice buffer);
17655    /**
17656     * Frees any resources associated with this object given its this_arg pointer.
17657     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
17658     */
17659    void (*free)(void *this_arg);
17660 } LDKCustomOnionMessageHandler;
17661
17662
17663
17664 /**
17665  * A dummy struct which implements `ChannelMessageHandler` without having any channels.
17666  * You can provide one of these as the route_handler in a MessageHandler.
17667  */
17668 typedef struct MUST_USE_STRUCT LDKErroringMessageHandler {
17669    /**
17670     * A pointer to the opaque Rust object.
17671     * Nearly everywhere, inner must be non-null, however in places where
17672     * the Rust equivalent takes an Option, it may be set to null to indicate None.
17673     */
17674    LDKnativeErroringMessageHandler *inner;
17675    /**
17676     * Indicates that this is the only struct which contains the same pointer.
17677     * Rust functions which take ownership of an object provided via an argument require
17678     * this to be true and invalidate the object pointed to by inner.
17679     */
17680    bool is_owned;
17681 } LDKErroringMessageHandler;
17682
17683
17684
17685 /**
17686  * Provides references to trait impls which handle different types of messages.
17687  */
17688 typedef struct MUST_USE_STRUCT LDKMessageHandler {
17689    /**
17690     * A pointer to the opaque Rust object.
17691     * Nearly everywhere, inner must be non-null, however in places where
17692     * the Rust equivalent takes an Option, it may be set to null to indicate None.
17693     */
17694    LDKnativeMessageHandler *inner;
17695    /**
17696     * Indicates that this is the only struct which contains the same pointer.
17697     * Rust functions which take ownership of an object provided via an argument require
17698     * this to be true and invalidate the object pointed to by inner.
17699     */
17700    bool is_owned;
17701 } LDKMessageHandler;
17702
17703 /**
17704  * Provides an object which can be used to send data to and which uniquely identifies a connection
17705  * to a remote host. You will need to be able to generate multiple of these which meet Eq and
17706  * implement Hash to meet the PeerManager API.
17707  *
17708  * For efficiency, [`Clone`] should be relatively cheap for this type.
17709  *
17710  * Two descriptors may compare equal (by [`cmp::Eq`] and [`hash::Hash`]) as long as the original
17711  * has been disconnected, the [`PeerManager`] has been informed of the disconnection (either by it
17712  * having triggered the disconnection or a call to [`PeerManager::socket_disconnected`]), and no
17713  * further calls to the [`PeerManager`] related to the original socket occur. This allows you to
17714  * use a file descriptor for your SocketDescriptor directly, however for simplicity you may wish
17715  * to simply use another value which is guaranteed to be globally unique instead.
17716  */
17717 typedef struct LDKSocketDescriptor {
17718    /**
17719     * An opaque pointer which is passed to your function implementations as an argument.
17720     * This has no meaning in the LDK, and can be NULL or any other value.
17721     */
17722    void *this_arg;
17723    /**
17724     * Attempts to send some data from the given slice to the peer.
17725     *
17726     * Returns the amount of data which was sent, possibly 0 if the socket has since disconnected.
17727     * Note that in the disconnected case, [`PeerManager::socket_disconnected`] must still be
17728     * called and further write attempts may occur until that time.
17729     *
17730     * If the returned size is smaller than `data.len()`, a
17731     * [`PeerManager::write_buffer_space_avail`] call must be made the next time more data can be
17732     * written. Additionally, until a `send_data` event completes fully, no further
17733     * [`PeerManager::read_event`] calls should be made for the same peer! Because this is to
17734     * prevent denial-of-service issues, you should not read or buffer any data from the socket
17735     * until then.
17736     *
17737     * If a [`PeerManager::read_event`] call on this descriptor had previously returned true
17738     * (indicating that read events should be paused to prevent DoS in the send buffer),
17739     * `resume_read` may be set indicating that read events on this descriptor should resume. A
17740     * `resume_read` of false carries no meaning, and should not cause any action.
17741     */
17742    uintptr_t (*send_data)(void *this_arg, struct LDKu8slice data, bool resume_read);
17743    /**
17744     * Disconnect the socket pointed to by this SocketDescriptor.
17745     *
17746     * You do *not* need to call [`PeerManager::socket_disconnected`] with this socket after this
17747     * call (doing so is a noop).
17748     */
17749    void (*disconnect_socket)(void *this_arg);
17750    /**
17751     * Checks if two objects are equal given this object's this_arg pointer and another object.
17752     */
17753    bool (*eq)(const void *this_arg, const struct LDKSocketDescriptor *NONNULL_PTR other_arg);
17754    /**
17755     * Calculate a succinct non-cryptographic hash for an object given its this_arg pointer.
17756     * This is used, for example, for inclusion of this object in a hash map.
17757     */
17758    uint64_t (*hash)(const void *this_arg);
17759    /**
17760     * Called, if set, after this SocketDescriptor has been cloned into a duplicate object.
17761     * The new SocketDescriptor is provided, and should be mutated as needed to perform a
17762     * deep copy of the object pointed to by this_arg or avoid any double-freeing.
17763     */
17764    void (*cloned)(struct LDKSocketDescriptor *NONNULL_PTR new_SocketDescriptor);
17765    /**
17766     * Frees any resources associated with this object given its this_arg pointer.
17767     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
17768     */
17769    void (*free)(void *this_arg);
17770 } LDKSocketDescriptor;
17771
17772
17773
17774 /**
17775  * A PeerManager manages a set of peers, described by their [`SocketDescriptor`] and marshalls
17776  * socket events into messages which it passes on to its [`MessageHandler`].
17777  *
17778  * Locks are taken internally, so you must never assume that reentrancy from a
17779  * [`SocketDescriptor`] call back into [`PeerManager`] methods will not deadlock.
17780  *
17781  * Calls to [`read_event`] will decode relevant messages and pass them to the
17782  * [`ChannelMessageHandler`], likely doing message processing in-line. Thus, the primary form of
17783  * parallelism in Rust-Lightning is in calls to [`read_event`]. Note, however, that calls to any
17784  * [`PeerManager`] functions related to the same connection must occur only in serial, making new
17785  * calls only after previous ones have returned.
17786  *
17787  * Rather than using a plain [`PeerManager`], it is preferable to use either a [`SimpleArcPeerManager`]
17788  * a [`SimpleRefPeerManager`], for conciseness. See their documentation for more details, but
17789  * essentially you should default to using a [`SimpleRefPeerManager`], and use a
17790  * [`SimpleArcPeerManager`] when you require a `PeerManager` with a static lifetime, such as when
17791  * you're using lightning-net-tokio.
17792  *
17793  * [`read_event`]: PeerManager::read_event
17794  */
17795 typedef struct MUST_USE_STRUCT LDKPeerManager {
17796    /**
17797     * A pointer to the opaque Rust object.
17798     * Nearly everywhere, inner must be non-null, however in places where
17799     * the Rust equivalent takes an Option, it may be set to null to indicate None.
17800     */
17801    LDKnativePeerManager *inner;
17802    /**
17803     * Indicates that this is the only struct which contains the same pointer.
17804     * Rust functions which take ownership of an object provided via an argument require
17805     * this to be true and invalidate the object pointed to by inner.
17806     */
17807    bool is_owned;
17808 } LDKPeerManager;
17809
17810
17811
17812 /**
17813  * Static channel fields used to build transactions given per-commitment fields, organized by
17814  * broadcaster/countersignatory.
17815  *
17816  * This is derived from the holder/counterparty-organized ChannelTransactionParameters via the
17817  * as_holder_broadcastable and as_counterparty_broadcastable functions.
17818  */
17819 typedef struct MUST_USE_STRUCT LDKDirectedChannelTransactionParameters {
17820    /**
17821     * A pointer to the opaque Rust object.
17822     * Nearly everywhere, inner must be non-null, however in places where
17823     * the Rust equivalent takes an Option, it may be set to null to indicate None.
17824     */
17825    LDKnativeDirectedChannelTransactionParameters *inner;
17826    /**
17827     * Indicates that this is the only struct which contains the same pointer.
17828     * Rust functions which take ownership of an object provided via an argument require
17829     * this to be true and invalidate the object pointed to by inner.
17830     */
17831    bool is_owned;
17832 } LDKDirectedChannelTransactionParameters;
17833
17834
17835
17836 /**
17837  * Features used within an `offer`.
17838  */
17839 typedef struct MUST_USE_STRUCT LDKOfferFeatures {
17840    /**
17841     * A pointer to the opaque Rust object.
17842     * Nearly everywhere, inner must be non-null, however in places where
17843     * the Rust equivalent takes an Option, it may be set to null to indicate None.
17844     */
17845    LDKnativeOfferFeatures *inner;
17846    /**
17847     * Indicates that this is the only struct which contains the same pointer.
17848     * Rust functions which take ownership of an object provided via an argument require
17849     * this to be true and invalidate the object pointed to by inner.
17850     */
17851    bool is_owned;
17852 } LDKOfferFeatures;
17853
17854
17855
17856 /**
17857  * Features used within an `invoice_request`.
17858  */
17859 typedef struct MUST_USE_STRUCT LDKInvoiceRequestFeatures {
17860    /**
17861     * A pointer to the opaque Rust object.
17862     * Nearly everywhere, inner must be non-null, however in places where
17863     * the Rust equivalent takes an Option, it may be set to null to indicate None.
17864     */
17865    LDKnativeInvoiceRequestFeatures *inner;
17866    /**
17867     * Indicates that this is the only struct which contains the same pointer.
17868     * Rust functions which take ownership of an object provided via an argument require
17869     * this to be true and invalidate the object pointed to by inner.
17870     */
17871    bool is_owned;
17872 } LDKInvoiceRequestFeatures;
17873
17874 /**
17875  * Integer in the range `0..=16`
17876  */
17877 typedef struct LDKWitnessVersion {
17878    uint8_t _0;
17879 } LDKWitnessVersion;
17880
17881
17882
17883 /**
17884  * A semantically valid [`Bolt12Invoice`] that hasn't been signed.
17885  */
17886 typedef struct MUST_USE_STRUCT LDKUnsignedBolt12Invoice {
17887    /**
17888     * A pointer to the opaque Rust object.
17889     * Nearly everywhere, inner must be non-null, however in places where
17890     * the Rust equivalent takes an Option, it may be set to null to indicate None.
17891     */
17892    LDKnativeUnsignedBolt12Invoice *inner;
17893    /**
17894     * Indicates that this is the only struct which contains the same pointer.
17895     * Rust functions which take ownership of an object provided via an argument require
17896     * this to be true and invalidate the object pointed to by inner.
17897     */
17898    bool is_owned;
17899 } LDKUnsignedBolt12Invoice;
17900
17901
17902
17903 /**
17904  * The field in the [`InvoiceRequest`] or the [`Bolt12Invoice`] that contained an error.
17905  *
17906  * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
17907  * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
17908  */
17909 typedef struct MUST_USE_STRUCT LDKErroneousField {
17910    /**
17911     * A pointer to the opaque Rust object.
17912     * Nearly everywhere, inner must be non-null, however in places where
17913     * the Rust equivalent takes an Option, it may be set to null to indicate None.
17914     */
17915    LDKnativeErroneousField *inner;
17916    /**
17917     * Indicates that this is the only struct which contains the same pointer.
17918     * Rust functions which take ownership of an object provided via an argument require
17919     * this to be true and invalidate the object pointed to by inner.
17920     */
17921    bool is_owned;
17922 } LDKErroneousField;
17923
17924
17925
17926 /**
17927  * A semantically valid [`InvoiceRequest`] that hasn't been signed.
17928  */
17929 typedef struct MUST_USE_STRUCT LDKUnsignedInvoiceRequest {
17930    /**
17931     * A pointer to the opaque Rust object.
17932     * Nearly everywhere, inner must be non-null, however in places where
17933     * the Rust equivalent takes an Option, it may be set to null to indicate None.
17934     */
17935    LDKnativeUnsignedInvoiceRequest *inner;
17936    /**
17937     * Indicates that this is the only struct which contains the same pointer.
17938     * Rust functions which take ownership of an object provided via an argument require
17939     * this to be true and invalidate the object pointed to by inner.
17940     */
17941    bool is_owned;
17942 } LDKUnsignedInvoiceRequest;
17943
17944
17945
17946 /**
17947  * The minimum amount required for an item in an [`Offer`], denominated in either bitcoin or
17948  * another currency.
17949  */
17950 typedef struct MUST_USE_STRUCT LDKAmount {
17951    /**
17952     * A pointer to the opaque Rust object.
17953     * Nearly everywhere, inner must be non-null, however in places where
17954     * the Rust equivalent takes an Option, it may be set to null to indicate None.
17955     */
17956    LDKnativeAmount *inner;
17957    /**
17958     * Indicates that this is the only struct which contains the same pointer.
17959     * Rust functions which take ownership of an object provided via an argument require
17960     * this to be true and invalidate the object pointed to by inner.
17961     */
17962    bool is_owned;
17963 } LDKAmount;
17964
17965
17966
17967 /**
17968  * Quantity of items supported by an [`Offer`].
17969  */
17970 typedef struct MUST_USE_STRUCT LDKQuantity {
17971    /**
17972     * A pointer to the opaque Rust object.
17973     * Nearly everywhere, inner must be non-null, however in places where
17974     * the Rust equivalent takes an Option, it may be set to null to indicate None.
17975     */
17976    LDKnativeQuantity *inner;
17977    /**
17978     * Indicates that this is the only struct which contains the same pointer.
17979     * Rust functions which take ownership of an object provided via an argument require
17980     * this to be true and invalidate the object pointed to by inner.
17981     */
17982    bool is_owned;
17983 } LDKQuantity;
17984
17985
17986
17987 /**
17988  * Receives and validates network updates from peers,
17989  * stores authentic and relevant data as a network graph.
17990  * This network graph is then used for routing payments.
17991  * Provides interface to help with initial routing sync by
17992  * serving historical announcements.
17993  */
17994 typedef struct MUST_USE_STRUCT LDKP2PGossipSync {
17995    /**
17996     * A pointer to the opaque Rust object.
17997     * Nearly everywhere, inner must be non-null, however in places where
17998     * the Rust equivalent takes an Option, it may be set to null to indicate None.
17999     */
18000    LDKnativeP2PGossipSync *inner;
18001    /**
18002     * Indicates that this is the only struct which contains the same pointer.
18003     * Rust functions which take ownership of an object provided via an argument require
18004     * this to be true and invalidate the object pointed to by inner.
18005     */
18006    bool is_owned;
18007 } LDKP2PGossipSync;
18008
18009
18010
18011 /**
18012  * A read-only view of [`NetworkGraph`].
18013  */
18014 typedef struct MUST_USE_STRUCT LDKReadOnlyNetworkGraph {
18015    /**
18016     * A pointer to the opaque Rust object.
18017     * Nearly everywhere, inner must be non-null, however in places where
18018     * the Rust equivalent takes an Option, it may be set to null to indicate None.
18019     */
18020    LDKnativeReadOnlyNetworkGraph *inner;
18021    /**
18022     * Indicates that this is the only struct which contains the same pointer.
18023     * Rust functions which take ownership of an object provided via an argument require
18024     * this to be true and invalidate the object pointed to by inner.
18025     */
18026    bool is_owned;
18027 } LDKReadOnlyNetworkGraph;
18028
18029
18030
18031 /**
18032  * A wrapper around [`ChannelInfo`] representing information about the channel as directed from a
18033  * source node to a target node.
18034  */
18035 typedef struct MUST_USE_STRUCT LDKDirectedChannelInfo {
18036    /**
18037     * A pointer to the opaque Rust object.
18038     * Nearly everywhere, inner must be non-null, however in places where
18039     * the Rust equivalent takes an Option, it may be set to null to indicate None.
18040     */
18041    LDKnativeDirectedChannelInfo *inner;
18042    /**
18043     * Indicates that this is the only struct which contains the same pointer.
18044     * Rust functions which take ownership of an object provided via an argument require
18045     * this to be true and invalidate the object pointed to by inner.
18046     */
18047    bool is_owned;
18048 } LDKDirectedChannelInfo;
18049
18050 /**
18051  * The effective capacity of a channel for routing purposes.
18052  *
18053  * While this may be smaller than the actual channel capacity, amounts greater than
18054  * [`Self::as_msat`] should not be routed through the channel.
18055  */
18056 typedef enum LDKEffectiveCapacity_Tag {
18057    /**
18058     * The available liquidity in the channel known from being a channel counterparty, and thus a
18059     * direct hop.
18060     */
18061    LDKEffectiveCapacity_ExactLiquidity,
18062    /**
18063     * The maximum HTLC amount in one direction as advertised on the gossip network.
18064     */
18065    LDKEffectiveCapacity_AdvertisedMaxHTLC,
18066    /**
18067     * The total capacity of the channel as determined by the funding transaction.
18068     */
18069    LDKEffectiveCapacity_Total,
18070    /**
18071     * A capacity sufficient to route any payment, typically used for private channels provided by
18072     * an invoice.
18073     */
18074    LDKEffectiveCapacity_Infinite,
18075    /**
18076     * The maximum HTLC amount as provided by an invoice route hint.
18077     */
18078    LDKEffectiveCapacity_HintMaxHTLC,
18079    /**
18080     * A capacity that is unknown possibly because either the chain state is unavailable to know
18081     * the total capacity or the `htlc_maximum_msat` was not advertised on the gossip network.
18082     */
18083    LDKEffectiveCapacity_Unknown,
18084    /**
18085     * Must be last for serialization purposes
18086     */
18087    LDKEffectiveCapacity_Sentinel,
18088 } LDKEffectiveCapacity_Tag;
18089
18090 typedef struct LDKEffectiveCapacity_LDKExactLiquidity_Body {
18091    /**
18092     * Either the inbound or outbound liquidity depending on the direction, denominated in
18093     * millisatoshi.
18094     */
18095    uint64_t liquidity_msat;
18096 } LDKEffectiveCapacity_LDKExactLiquidity_Body;
18097
18098 typedef struct LDKEffectiveCapacity_LDKAdvertisedMaxHTLC_Body {
18099    /**
18100     * The maximum HTLC amount denominated in millisatoshi.
18101     */
18102    uint64_t amount_msat;
18103 } LDKEffectiveCapacity_LDKAdvertisedMaxHTLC_Body;
18104
18105 typedef struct LDKEffectiveCapacity_LDKTotal_Body {
18106    /**
18107     * The funding amount denominated in millisatoshi.
18108     */
18109    uint64_t capacity_msat;
18110    /**
18111     * The maximum HTLC amount denominated in millisatoshi.
18112     */
18113    uint64_t htlc_maximum_msat;
18114 } LDKEffectiveCapacity_LDKTotal_Body;
18115
18116 typedef struct LDKEffectiveCapacity_LDKHintMaxHTLC_Body {
18117    /**
18118     * The maximum HTLC amount denominated in millisatoshi.
18119     */
18120    uint64_t amount_msat;
18121 } LDKEffectiveCapacity_LDKHintMaxHTLC_Body;
18122
18123 typedef struct MUST_USE_STRUCT LDKEffectiveCapacity {
18124    LDKEffectiveCapacity_Tag tag;
18125    union {
18126       LDKEffectiveCapacity_LDKExactLiquidity_Body exact_liquidity;
18127       LDKEffectiveCapacity_LDKAdvertisedMaxHTLC_Body advertised_max_htlc;
18128       LDKEffectiveCapacity_LDKTotal_Body total;
18129       LDKEffectiveCapacity_LDKHintMaxHTLC_Body hint_max_htlc;
18130    };
18131 } LDKEffectiveCapacity;
18132
18133
18134
18135 /**
18136  * A [`Router`] implemented using [`find_route`].
18137  */
18138 typedef struct MUST_USE_STRUCT LDKDefaultRouter {
18139    /**
18140     * A pointer to the opaque Rust object.
18141     * Nearly everywhere, inner must be non-null, however in places where
18142     * the Rust equivalent takes an Option, it may be set to null to indicate None.
18143     */
18144    LDKnativeDefaultRouter *inner;
18145    /**
18146     * Indicates that this is the only struct which contains the same pointer.
18147     * Rust functions which take ownership of an object provided via an argument require
18148     * this to be true and invalidate the object pointed to by inner.
18149     */
18150    bool is_owned;
18151 } LDKDefaultRouter;
18152
18153
18154
18155 /**
18156  * [`Score`] implementation that factors in in-flight HTLC liquidity.
18157  *
18158  * Useful for custom [`Router`] implementations to wrap their [`Score`] on-the-fly when calling
18159  * [`find_route`].
18160  *
18161  * [`Score`]: crate::routing::scoring::Score
18162  */
18163 typedef struct MUST_USE_STRUCT LDKScorerAccountingForInFlightHtlcs {
18164    /**
18165     * A pointer to the opaque Rust object.
18166     * Nearly everywhere, inner must be non-null, however in places where
18167     * the Rust equivalent takes an Option, it may be set to null to indicate None.
18168     */
18169    LDKnativeScorerAccountingForInFlightHtlcs *inner;
18170    /**
18171     * Indicates that this is the only struct which contains the same pointer.
18172     * Rust functions which take ownership of an object provided via an argument require
18173     * this to be true and invalidate the object pointed to by inner.
18174     */
18175    bool is_owned;
18176 } LDKScorerAccountingForInFlightHtlcs;
18177
18178 /**
18179  * The recipient of a payment, differing based on whether they've hidden their identity with route
18180  * blinding.
18181  */
18182 typedef enum LDKPayee_Tag {
18183    /**
18184     * The recipient provided blinded paths and payinfo to reach them. The blinded paths themselves
18185     * will be included in the final [`Route`].
18186     */
18187    LDKPayee_Blinded,
18188    /**
18189     * The recipient included these route hints in their BOLT11 invoice.
18190     */
18191    LDKPayee_Clear,
18192    /**
18193     * Must be last for serialization purposes
18194     */
18195    LDKPayee_Sentinel,
18196 } LDKPayee_Tag;
18197
18198 typedef struct LDKPayee_LDKBlinded_Body {
18199    /**
18200     * Aggregated routing info and blinded paths, for routing to the payee without knowing their
18201     * node id.
18202     */
18203    struct LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ route_hints;
18204    /**
18205     * Features supported by the payee.
18206     *
18207     * May be set from the payee's invoice. May be `None` if the invoice does not contain any
18208     * features.
18209     *
18210     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
18211     */
18212    struct LDKBolt12InvoiceFeatures features;
18213 } LDKPayee_LDKBlinded_Body;
18214
18215 typedef struct LDKPayee_LDKClear_Body {
18216    /**
18217     * The node id of the payee.
18218     */
18219    struct LDKPublicKey node_id;
18220    /**
18221     * Hints for routing to the payee, containing channels connecting the payee to public nodes.
18222     */
18223    struct LDKCVec_RouteHintZ route_hints;
18224    /**
18225     * Features supported by the payee.
18226     *
18227     * May be set from the payee's invoice or via [`for_keysend`]. May be `None` if the invoice
18228     * does not contain any features.
18229     *
18230     * [`for_keysend`]: PaymentParameters::for_keysend
18231     *
18232     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
18233     */
18234    struct LDKBolt11InvoiceFeatures features;
18235    /**
18236     * The minimum CLTV delta at the end of the route. This value must not be zero.
18237     */
18238    uint32_t final_cltv_expiry_delta;
18239 } LDKPayee_LDKClear_Body;
18240
18241 typedef struct MUST_USE_STRUCT LDKPayee {
18242    LDKPayee_Tag tag;
18243    union {
18244       LDKPayee_LDKBlinded_Body blinded;
18245       LDKPayee_LDKClear_Body clear;
18246    };
18247 } LDKPayee;
18248
18249
18250
18251 /**
18252  * A concrete implementation of [`LockableScore`] which supports multi-threading.
18253  */
18254 typedef struct MUST_USE_STRUCT LDKMultiThreadedLockableScore {
18255    /**
18256     * A pointer to the opaque Rust object.
18257     * Nearly everywhere, inner must be non-null, however in places where
18258     * the Rust equivalent takes an Option, it may be set to null to indicate None.
18259     */
18260    LDKnativeMultiThreadedLockableScore *inner;
18261    /**
18262     * Indicates that this is the only struct which contains the same pointer.
18263     * Rust functions which take ownership of an object provided via an argument require
18264     * this to be true and invalidate the object pointed to by inner.
18265     */
18266    bool is_owned;
18267 } LDKMultiThreadedLockableScore;
18268
18269
18270
18271 /**
18272  * A locked `MultiThreadedLockableScore`.
18273  */
18274 typedef struct MUST_USE_STRUCT LDKMultiThreadedScoreLock {
18275    /**
18276     * A pointer to the opaque Rust object.
18277     * Nearly everywhere, inner must be non-null, however in places where
18278     * the Rust equivalent takes an Option, it may be set to null to indicate None.
18279     */
18280    LDKnativeMultiThreadedScoreLock *inner;
18281    /**
18282     * Indicates that this is the only struct which contains the same pointer.
18283     * Rust functions which take ownership of an object provided via an argument require
18284     * this to be true and invalidate the object pointed to by inner.
18285     */
18286    bool is_owned;
18287 } LDKMultiThreadedScoreLock;
18288
18289
18290
18291 /**
18292  * Parameters for configuring [`ProbabilisticScorer`].
18293  *
18294  * Used to configure decay parameters that are static throughout the lifetime of the scorer.
18295  * these decay parameters affect the score of the channel penalty and are not changed on a
18296  * per-route penalty cost call.
18297  */
18298 typedef struct MUST_USE_STRUCT LDKProbabilisticScoringDecayParameters {
18299    /**
18300     * A pointer to the opaque Rust object.
18301     * Nearly everywhere, inner must be non-null, however in places where
18302     * the Rust equivalent takes an Option, it may be set to null to indicate None.
18303     */
18304    LDKnativeProbabilisticScoringDecayParameters *inner;
18305    /**
18306     * Indicates that this is the only struct which contains the same pointer.
18307     * Rust functions which take ownership of an object provided via an argument require
18308     * this to be true and invalidate the object pointed to by inner.
18309     */
18310    bool is_owned;
18311 } LDKProbabilisticScoringDecayParameters;
18312
18313
18314
18315 /**
18316  * Simple implementation of [`EntropySource`], [`NodeSigner`], and [`SignerProvider`] that takes a
18317  * 32-byte seed for use as a BIP 32 extended key and derives keys from that.
18318  *
18319  * Your `node_id` is seed/0'.
18320  * Unilateral closes may use seed/1'.
18321  * Cooperative closes may use seed/2'.
18322  * The two close keys may be needed to claim on-chain funds!
18323  *
18324  * This struct cannot be used for nodes that wish to support receiving phantom payments;
18325  * [`PhantomKeysManager`] must be used instead.
18326  *
18327  * Note that switching between this struct and [`PhantomKeysManager`] will invalidate any
18328  * previously issued invoices and attempts to pay previous invoices will fail.
18329  */
18330 typedef struct MUST_USE_STRUCT LDKKeysManager {
18331    /**
18332     * A pointer to the opaque Rust object.
18333     * Nearly everywhere, inner must be non-null, however in places where
18334     * the Rust equivalent takes an Option, it may be set to null to indicate None.
18335     */
18336    LDKnativeKeysManager *inner;
18337    /**
18338     * Indicates that this is the only struct which contains the same pointer.
18339     * Rust functions which take ownership of an object provided via an argument require
18340     * this to be true and invalidate the object pointed to by inner.
18341     */
18342    bool is_owned;
18343 } LDKKeysManager;
18344
18345
18346
18347 /**
18348  * Similar to [`KeysManager`], but allows the node using this struct to receive phantom node
18349  * payments.
18350  *
18351  * A phantom node payment is a payment made to a phantom invoice, which is an invoice that can be
18352  * paid to one of multiple nodes. This works because we encode the invoice route hints such that
18353  * LDK will recognize an incoming payment as destined for a phantom node, and collect the payment
18354  * itself without ever needing to forward to this fake node.
18355  *
18356  * Phantom node payments are useful for load balancing between multiple LDK nodes. They also
18357  * provide some fault tolerance, because payers will automatically retry paying other provided
18358  * nodes in the case that one node goes down.
18359  *
18360  * Note that multi-path payments are not supported in phantom invoices for security reasons.
18361  * Switching between this struct and [`KeysManager`] will invalidate any previously issued
18362  * invoices and attempts to pay previous invoices will fail.
18363  */
18364 typedef struct MUST_USE_STRUCT LDKPhantomKeysManager {
18365    /**
18366     * A pointer to the opaque Rust object.
18367     * Nearly everywhere, inner must be non-null, however in places where
18368     * the Rust equivalent takes an Option, it may be set to null to indicate None.
18369     */
18370    LDKnativePhantomKeysManager *inner;
18371    /**
18372     * Indicates that this is the only struct which contains the same pointer.
18373     * Rust functions which take ownership of an object provided via an argument require
18374     * this to be true and invalidate the object pointed to by inner.
18375     */
18376    bool is_owned;
18377 } LDKPhantomKeysManager;
18378
18379 /**
18380  * The destination of an onion message.
18381  */
18382 typedef enum LDKDestination_Tag {
18383    /**
18384     * We're sending this onion message to a node.
18385     */
18386    LDKDestination_Node,
18387    /**
18388     * We're sending this onion message to a blinded path.
18389     */
18390    LDKDestination_BlindedPath,
18391    /**
18392     * Must be last for serialization purposes
18393     */
18394    LDKDestination_Sentinel,
18395 } LDKDestination_Tag;
18396
18397 typedef struct MUST_USE_STRUCT LDKDestination {
18398    LDKDestination_Tag tag;
18399    union {
18400       struct {
18401          struct LDKPublicKey node;
18402       };
18403       struct {
18404          struct LDKBlindedPath blinded_path;
18405       };
18406    };
18407 } LDKDestination;
18408
18409 /**
18410  * A trait defining behavior for routing an [`OnionMessage`].
18411  *
18412  * [`OnionMessage`]: msgs::OnionMessage
18413  */
18414 typedef struct LDKMessageRouter {
18415    /**
18416     * An opaque pointer which is passed to your function implementations as an argument.
18417     * This has no meaning in the LDK, and can be NULL or any other value.
18418     */
18419    void *this_arg;
18420    /**
18421     * Returns a route for sending an [`OnionMessage`] to the given [`Destination`].
18422     *
18423     * [`OnionMessage`]: msgs::OnionMessage
18424     */
18425    struct LDKCResult_OnionMessagePathNoneZ (*find_path)(const void *this_arg, struct LDKPublicKey sender, struct LDKCVec_PublicKeyZ peers, struct LDKDestination destination);
18426    /**
18427     * Frees any resources associated with this object given its this_arg pointer.
18428     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
18429     */
18430    void (*free)(void *this_arg);
18431 } LDKMessageRouter;
18432
18433
18434
18435 /**
18436  * A sender, receiver and forwarder of onion messages. In upcoming releases, this object will be
18437  * used to retrieve invoices and fulfill invoice requests from [offers]. Currently, only sending
18438  * and receiving custom onion messages is supported.
18439  *
18440  * # Example
18441  *
18442  * ```
18443  * # extern crate bitcoin;
18444  * # use bitcoin::hashes::_export::_core::time::Duration;
18445  * # use bitcoin::secp256k1::{PublicKey, Secp256k1, SecretKey};
18446  * # use lightning::blinded_path::BlindedPath;
18447  * # use lightning::sign::KeysManager;
18448  * # use lightning::ln::peer_handler::IgnoringMessageHandler;
18449  * # use lightning::onion_message::messenger::{Destination, MessageRouter, OnionMessenger, OnionMessagePath};
18450  * # use lightning::onion_message::packet::{CustomOnionMessageContents, OnionMessageContents};
18451  * # use lightning::util::logger::{Logger, Record};
18452  * # use lightning::util::ser::{Writeable, Writer};
18453  * # use lightning::io;
18454  * # use std::sync::Arc;
18455  * # struct FakeLogger;
18456  * # impl Logger for FakeLogger {
18457  * #     fn log(&self, record: &Record) { unimplemented!() }
18458  * # }
18459  * # struct FakeMessageRouter {}
18460  * # impl MessageRouter for FakeMessageRouter {
18461  * #     fn find_path(&self, sender: PublicKey, peers: Vec<PublicKey>, destination: Destination) -> Result<OnionMessagePath, ()> {
18462  * #         unimplemented!()
18463  * #     }
18464  * # }
18465  * # let seed = [42u8; 32];
18466  * # let time = Duration::from_secs(123456);
18467  * # let keys_manager = KeysManager::new(&seed, time.as_secs(), time.subsec_nanos());
18468  * # let logger = Arc::new(FakeLogger {});
18469  * # let node_secret = SecretKey::from_slice(&hex::decode(\"0101010101010101010101010101010101010101010101010101010101010101\").unwrap()[..]).unwrap();
18470  * # let secp_ctx = Secp256k1::new();
18471  * # let hop_node_id1 = PublicKey::from_secret_key(&secp_ctx, &node_secret);
18472  * # let (hop_node_id2, hop_node_id3, hop_node_id4) = (hop_node_id1, hop_node_id1, hop_node_id1);
18473  * # let destination_node_id = hop_node_id1;
18474  * # let message_router = Arc::new(FakeMessageRouter {});
18475  * # let custom_message_handler = IgnoringMessageHandler {};
18476  * # let offers_message_handler = IgnoringMessageHandler {};
18477  * // Create the onion messenger. This must use the same `keys_manager` as is passed to your
18478  * // ChannelManager.
18479  * let onion_messenger = OnionMessenger::new(
18480  *     &keys_manager, &keys_manager, logger, message_router, &offers_message_handler,
18481  *     &custom_message_handler
18482  * );
18483  *
18484  * # struct YourCustomMessage {}
18485  * impl Writeable for YourCustomMessage {
18486  * \tfn write<W: Writer>(&self, w: &mut W) -> Result<(), io::Error> {
18487  * \t\t# Ok(())
18488  * \t\t// Write your custom onion message to `w`
18489  * \t}
18490  * }
18491  * impl CustomOnionMessageContents for YourCustomMessage {
18492  * \tfn tlv_type(&self) -> u64 {
18493  * \t\t# let your_custom_message_type = 42;
18494  * \t\tyour_custom_message_type
18495  * \t}
18496  * }
18497  * // Send a custom onion message to a node id.
18498  * let path = OnionMessagePath {
18499  * \tintermediate_nodes: vec![hop_node_id1, hop_node_id2],
18500  * \tdestination: Destination::Node(destination_node_id),
18501  * };
18502  * let reply_path = None;
18503  * # let your_custom_message = YourCustomMessage {};
18504  * let message = OnionMessageContents::Custom(your_custom_message);
18505  * onion_messenger.send_onion_message(path, message, reply_path);
18506  *
18507  * // Create a blinded path to yourself, for someone to send an onion message to.
18508  * # let your_node_id = hop_node_id1;
18509  * let hops = [hop_node_id3, hop_node_id4, your_node_id];
18510  * let blinded_path = BlindedPath::new_for_message(&hops, &keys_manager, &secp_ctx).unwrap();
18511  *
18512  * // Send a custom onion message to a blinded path.
18513  * let path = OnionMessagePath {
18514  * \tintermediate_nodes: vec![hop_node_id1, hop_node_id2],
18515  * \tdestination: Destination::BlindedPath(blinded_path),
18516  * };
18517  * let reply_path = None;
18518  * # let your_custom_message = YourCustomMessage {};
18519  * let message = OnionMessageContents::Custom(your_custom_message);
18520  * onion_messenger.send_onion_message(path, message, reply_path);
18521  * ```
18522  *
18523  * [offers]: <https://github.com/lightning/bolts/pull/798>
18524  * [`OnionMessenger`]: crate::onion_message::OnionMessenger
18525  */
18526 typedef struct MUST_USE_STRUCT LDKOnionMessenger {
18527    /**
18528     * A pointer to the opaque Rust object.
18529     * Nearly everywhere, inner must be non-null, however in places where
18530     * the Rust equivalent takes an Option, it may be set to null to indicate None.
18531     */
18532    LDKnativeOnionMessenger *inner;
18533    /**
18534     * Indicates that this is the only struct which contains the same pointer.
18535     * Rust functions which take ownership of an object provided via an argument require
18536     * this to be true and invalidate the object pointed to by inner.
18537     */
18538    bool is_owned;
18539 } LDKOnionMessenger;
18540
18541
18542
18543 /**
18544  * A [`MessageRouter`] that always fails.
18545  */
18546 typedef struct MUST_USE_STRUCT LDKDefaultMessageRouter {
18547    /**
18548     * A pointer to the opaque Rust object.
18549     * Nearly everywhere, inner must be non-null, however in places where
18550     * the Rust equivalent takes an Option, it may be set to null to indicate None.
18551     */
18552    LDKnativeDefaultMessageRouter *inner;
18553    /**
18554     * Indicates that this is the only struct which contains the same pointer.
18555     * Rust functions which take ownership of an object provided via an argument require
18556     * this to be true and invalidate the object pointed to by inner.
18557     */
18558    bool is_owned;
18559 } LDKDefaultMessageRouter;
18560
18561 /**
18562  * The contents of an onion message. In the context of offers, this would be the invoice, invoice
18563  * request, or invoice error.
18564  */
18565 typedef enum LDKOnionMessageContents_Tag {
18566    /**
18567     * A message related to BOLT 12 Offers.
18568     */
18569    LDKOnionMessageContents_Offers,
18570    /**
18571     * A custom onion message specified by the user.
18572     */
18573    LDKOnionMessageContents_Custom,
18574    /**
18575     * Must be last for serialization purposes
18576     */
18577    LDKOnionMessageContents_Sentinel,
18578 } LDKOnionMessageContents_Tag;
18579
18580 typedef struct MUST_USE_STRUCT LDKOnionMessageContents {
18581    LDKOnionMessageContents_Tag tag;
18582    union {
18583       struct {
18584          struct LDKOffersMessage offers;
18585       };
18586       struct {
18587          struct LDKCustomOnionMessageContents custom;
18588       };
18589    };
18590 } LDKOnionMessageContents;
18591
18592
18593
18594 /**
18595  * The parameters required to derive a channel signer via [`SignerProvider`].
18596  */
18597 typedef struct MUST_USE_STRUCT LDKChannelDerivationParameters {
18598    /**
18599     * A pointer to the opaque Rust object.
18600     * Nearly everywhere, inner must be non-null, however in places where
18601     * the Rust equivalent takes an Option, it may be set to null to indicate None.
18602     */
18603    LDKnativeChannelDerivationParameters *inner;
18604    /**
18605     * Indicates that this is the only struct which contains the same pointer.
18606     * Rust functions which take ownership of an object provided via an argument require
18607     * this to be true and invalidate the object pointed to by inner.
18608     */
18609    bool is_owned;
18610 } LDKChannelDerivationParameters;
18611
18612 /**
18613  * An abstraction over a bitcoin wallet that can perform coin selection over a set of UTXOs and can
18614  * sign for them. The coin selection method aims to mimic Bitcoin Core's `fundrawtransaction` RPC,
18615  * which most wallets should be able to satisfy. Otherwise, consider implementing [`WalletSource`],
18616  * which can provide a default implementation of this trait when used with [`Wallet`].
18617  */
18618 typedef struct LDKCoinSelectionSource {
18619    /**
18620     * An opaque pointer which is passed to your function implementations as an argument.
18621     * This has no meaning in the LDK, and can be NULL or any other value.
18622     */
18623    void *this_arg;
18624    /**
18625     * Performs coin selection of a set of UTXOs, with at least 1 confirmation each, that are
18626     * available to spend. Implementations are free to pick their coin selection algorithm of
18627     * choice, as long as the following requirements are met:
18628     *
18629     * 1. `must_spend` contains a set of [`Input`]s that must be included in the transaction
18630     *    throughout coin selection, but must not be returned as part of the result.
18631     * 2. `must_pay_to` contains a set of [`TxOut`]s that must be included in the transaction
18632     *    throughout coin selection. In some cases, like when funding an anchor transaction, this
18633     *    set is empty. Implementations should ensure they handle this correctly on their end,
18634     *    e.g., Bitcoin Core's `fundrawtransaction` RPC requires at least one output to be
18635     *    provided, in which case a zero-value empty OP_RETURN output can be used instead.
18636     * 3. Enough inputs must be selected/contributed for the resulting transaction (including the
18637     *    inputs and outputs noted above) to meet `target_feerate_sat_per_1000_weight`.
18638     *
18639     * Implementations must take note that [`Input::satisfaction_weight`] only tracks the weight of
18640     * the input's `script_sig` and `witness`. Some wallets, like Bitcoin Core's, may require
18641     * providing the full input weight. Failing to do so may lead to underestimating fee bumps and
18642     * delaying block inclusion.
18643     *
18644     * The `claim_id` must map to the set of external UTXOs assigned to the claim, such that they
18645     * can be re-used within new fee-bumped iterations of the original claiming transaction,
18646     * ensuring that claims don't double spend each other. If a specific `claim_id` has never had a
18647     * transaction associated with it, and all of the available UTXOs have already been assigned to
18648     * other claims, implementations must be willing to double spend their UTXOs. The choice of
18649     * which UTXOs to double spend is left to the implementation, but it must strive to keep the
18650     * set of other claims being double spent to a minimum.
18651     */
18652    struct LDKCResult_CoinSelectionNoneZ (*select_confirmed_utxos)(const void *this_arg, struct LDKThirtyTwoBytes claim_id, struct LDKCVec_InputZ must_spend, struct LDKCVec_TxOutZ must_pay_to, uint32_t target_feerate_sat_per_1000_weight);
18653    /**
18654     * Signs and provides the full witness for all inputs within the transaction known to the
18655     * trait (i.e., any provided via [`CoinSelectionSource::select_confirmed_utxos`]).
18656     */
18657    struct LDKCResult_TransactionNoneZ (*sign_tx)(const void *this_arg, struct LDKTransaction tx);
18658    /**
18659     * Frees any resources associated with this object given its this_arg pointer.
18660     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
18661     */
18662    void (*free)(void *this_arg);
18663 } LDKCoinSelectionSource;
18664
18665 /**
18666  * An alternative to [`CoinSelectionSource`] that can be implemented and used along [`Wallet`] to
18667  * provide a default implementation to [`CoinSelectionSource`].
18668  */
18669 typedef struct LDKWalletSource {
18670    /**
18671     * An opaque pointer which is passed to your function implementations as an argument.
18672     * This has no meaning in the LDK, and can be NULL or any other value.
18673     */
18674    void *this_arg;
18675    /**
18676     * Returns all UTXOs, with at least 1 confirmation each, that are available to spend.
18677     */
18678    struct LDKCResult_CVec_UtxoZNoneZ (*list_confirmed_utxos)(const void *this_arg);
18679    /**
18680     * Returns a script to use for change above dust resulting from a successful coin selection
18681     * attempt.
18682     */
18683    struct LDKCResult_ScriptNoneZ (*get_change_script)(const void *this_arg);
18684    /**
18685     * Signs and provides the full [`TxIn::script_sig`] and [`TxIn::witness`] for all inputs within
18686     * the transaction known to the wallet (i.e., any provided via
18687     * [`WalletSource::list_confirmed_utxos`]).
18688     */
18689    struct LDKCResult_TransactionNoneZ (*sign_tx)(const void *this_arg, struct LDKTransaction tx);
18690    /**
18691     * Frees any resources associated with this object given its this_arg pointer.
18692     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
18693     */
18694    void (*free)(void *this_arg);
18695 } LDKWalletSource;
18696
18697
18698
18699 /**
18700  * A wrapper over [`WalletSource`] that implements [`CoinSelection`] by preferring UTXOs that would
18701  * avoid conflicting double spends. If not enough UTXOs are available to do so, conflicting double
18702  * spends may happen.
18703  */
18704 typedef struct MUST_USE_STRUCT LDKWallet {
18705    /**
18706     * A pointer to the opaque Rust object.
18707     * Nearly everywhere, inner must be non-null, however in places where
18708     * the Rust equivalent takes an Option, it may be set to null to indicate None.
18709     */
18710    LDKnativeWallet *inner;
18711    /**
18712     * Indicates that this is the only struct which contains the same pointer.
18713     * Rust functions which take ownership of an object provided via an argument require
18714     * this to be true and invalidate the object pointed to by inner.
18715     */
18716    bool is_owned;
18717 } LDKWallet;
18718
18719
18720
18721 /**
18722  * A handler for [`Event::BumpTransaction`] events that sources confirmed UTXOs from a
18723  * [`CoinSelectionSource`] to fee bump transactions via Child-Pays-For-Parent (CPFP) or
18724  * Replace-By-Fee (RBF).
18725  *
18726  * [`Event::BumpTransaction`]: crate::events::Event::BumpTransaction
18727  */
18728 typedef struct MUST_USE_STRUCT LDKBumpTransactionEventHandler {
18729    /**
18730     * A pointer to the opaque Rust object.
18731     * Nearly everywhere, inner must be non-null, however in places where
18732     * the Rust equivalent takes an Option, it may be set to null to indicate None.
18733     */
18734    LDKnativeBumpTransactionEventHandler *inner;
18735    /**
18736     * Indicates that this is the only struct which contains the same pointer.
18737     * Rust functions which take ownership of an object provided via an argument require
18738     * this to be true and invalidate the object pointed to by inner.
18739     */
18740    bool is_owned;
18741 } LDKBumpTransactionEventHandler;
18742
18743
18744
18745 /**
18746  * FilesystemPersister persists channel data on disk, where each channel's
18747  * data is stored in a file named after its funding outpoint.
18748  *
18749  * Warning: this module does the best it can with calls to persist data, but it
18750  * can only guarantee that the data is passed to the drive. It is up to the
18751  * drive manufacturers to do the actual persistence properly, which they often
18752  * don't (especially on consumer-grade hardware). Therefore, it is up to the
18753  * user to validate their entire storage stack, to ensure the writes are
18754  * persistent.
18755  * Corollary: especially when dealing with larger amounts of money, it is best
18756  * practice to have multiple channel data backups and not rely only on one
18757  * FilesystemPersister.
18758  */
18759 typedef struct MUST_USE_STRUCT LDKFilesystemPersister {
18760    /**
18761     * A pointer to the opaque Rust object.
18762     * Nearly everywhere, inner must be non-null, however in places where
18763     * the Rust equivalent takes an Option, it may be set to null to indicate None.
18764     */
18765    LDKnativeFilesystemPersister *inner;
18766    /**
18767     * Indicates that this is the only struct which contains the same pointer.
18768     * Rust functions which take ownership of an object provided via an argument require
18769     * this to be true and invalidate the object pointed to by inner.
18770     */
18771    bool is_owned;
18772 } LDKFilesystemPersister;
18773
18774
18775
18776 /**
18777  * `BackgroundProcessor` takes care of tasks that (1) need to happen periodically to keep
18778  * Rust-Lightning running properly, and (2) either can or should be run in the background. Its
18779  * responsibilities are:
18780  * * Processing [`Event`]s with a user-provided [`EventHandler`].
18781  * * Monitoring whether the [`ChannelManager`] needs to be re-persisted to disk, and if so,
18782  *   writing it to disk/backups by invoking the callback given to it at startup.
18783  *   [`ChannelManager`] persistence should be done in the background.
18784  * * Calling [`ChannelManager::timer_tick_occurred`], [`ChainMonitor::rebroadcast_pending_claims`]
18785  *   and [`PeerManager::timer_tick_occurred`] at the appropriate intervals.
18786  * * Calling [`NetworkGraph::remove_stale_channels_and_tracking`] (if a [`GossipSync`] with a
18787  *   [`NetworkGraph`] is provided to [`BackgroundProcessor::start`]).
18788  *
18789  * It will also call [`PeerManager::process_events`] periodically though this shouldn't be relied
18790  * upon as doing so may result in high latency.
18791  *
18792  * # Note
18793  *
18794  * If [`ChannelManager`] persistence fails and the persisted manager becomes out-of-date, then
18795  * there is a risk of channels force-closing on startup when the manager realizes it's outdated.
18796  * However, as long as [`ChannelMonitor`] backups are sound, no funds besides those used for
18797  * unilateral chain closure fees are at risk.
18798  *
18799  * [`ChannelMonitor`]: lightning::chain::channelmonitor::ChannelMonitor
18800  * [`Event`]: lightning::events::Event
18801  * [`PeerManager::timer_tick_occurred`]: lightning::ln::peer_handler::PeerManager::timer_tick_occurred
18802  * [`PeerManager::process_events`]: lightning::ln::peer_handler::PeerManager::process_events
18803  *BackgroundProcessor will immediately stop on drop. It should be stored until shutdown.
18804  */
18805 typedef struct MUST_USE_STRUCT LDKBackgroundProcessor {
18806    /**
18807     * A pointer to the opaque Rust object.
18808     * Nearly everywhere, inner must be non-null, however in places where
18809     * the Rust equivalent takes an Option, it may be set to null to indicate None.
18810     */
18811    LDKnativeBackgroundProcessor *inner;
18812    /**
18813     * Indicates that this is the only struct which contains the same pointer.
18814     * Rust functions which take ownership of an object provided via an argument require
18815     * this to be true and invalidate the object pointed to by inner.
18816     */
18817    bool is_owned;
18818 } LDKBackgroundProcessor;
18819
18820
18821
18822 /**
18823  * The main Rapid Gossip Sync object.
18824  *
18825  * See [crate-level documentation] for usage.
18826  *
18827  * [crate-level documentation]: crate
18828  */
18829 typedef struct MUST_USE_STRUCT LDKRapidGossipSync {
18830    /**
18831     * A pointer to the opaque Rust object.
18832     * Nearly everywhere, inner must be non-null, however in places where
18833     * the Rust equivalent takes an Option, it may be set to null to indicate None.
18834     */
18835    LDKnativeRapidGossipSync *inner;
18836    /**
18837     * Indicates that this is the only struct which contains the same pointer.
18838     * Rust functions which take ownership of an object provided via an argument require
18839     * this to be true and invalidate the object pointed to by inner.
18840     */
18841    bool is_owned;
18842 } LDKRapidGossipSync;
18843
18844 /**
18845  * Either [`P2PGossipSync`] or [`RapidGossipSync`].
18846  */
18847 typedef enum LDKGossipSync_Tag {
18848    /**
18849     * Gossip sync via the lightning peer-to-peer network as defined by BOLT 7.
18850     */
18851    LDKGossipSync_P2P,
18852    /**
18853     * Rapid gossip sync from a trusted server.
18854     */
18855    LDKGossipSync_Rapid,
18856    /**
18857     * No gossip sync.
18858     */
18859    LDKGossipSync_None,
18860    /**
18861     * Must be last for serialization purposes
18862     */
18863    LDKGossipSync_Sentinel,
18864 } LDKGossipSync_Tag;
18865
18866 typedef struct MUST_USE_STRUCT LDKGossipSync {
18867    LDKGossipSync_Tag tag;
18868    union {
18869       struct {
18870          /**
18871           * Note that this field is expected to be a reference.
18872           */
18873          struct LDKP2PGossipSync p2p;
18874       };
18875       struct {
18876          /**
18877           * Note that this field is expected to be a reference.
18878           */
18879          struct LDKRapidGossipSync rapid;
18880       };
18881    };
18882 } LDKGossipSync;
18883
18884
18885
18886 /**
18887  * Data of the [`RawBolt11Invoice`] that is encoded in the data part
18888  */
18889 typedef struct MUST_USE_STRUCT LDKRawDataPart {
18890    /**
18891     * A pointer to the opaque Rust object.
18892     * Nearly everywhere, inner must be non-null, however in places where
18893     * the Rust equivalent takes an Option, it may be set to null to indicate None.
18894     */
18895    LDKnativeRawDataPart *inner;
18896    /**
18897     * Indicates that this is the only struct which contains the same pointer.
18898     * Rust functions which take ownership of an object provided via an argument require
18899     * this to be true and invalidate the object pointed to by inner.
18900     */
18901    bool is_owned;
18902 } LDKRawDataPart;
18903
18904
18905
18906 /**
18907  * SHA-256 hash
18908  */
18909 typedef struct MUST_USE_STRUCT LDKSha256 {
18910    /**
18911     * A pointer to the opaque Rust object.
18912     * Nearly everywhere, inner must be non-null, however in places where
18913     * the Rust equivalent takes an Option, it may be set to null to indicate None.
18914     */
18915    LDKnativeSha256 *inner;
18916    /**
18917     * Indicates that this is the only struct which contains the same pointer.
18918     * Rust functions which take ownership of an object provided via an argument require
18919     * this to be true and invalidate the object pointed to by inner.
18920     */
18921    bool is_owned;
18922 } LDKSha256;
18923
18924
18925
18926 /**
18927  * Positive duration that defines when (relatively to the timestamp) in the future the invoice
18928  * expires
18929  */
18930 typedef struct MUST_USE_STRUCT LDKExpiryTime {
18931    /**
18932     * A pointer to the opaque Rust object.
18933     * Nearly everywhere, inner must be non-null, however in places where
18934     * the Rust equivalent takes an Option, it may be set to null to indicate None.
18935     */
18936    LDKnativeExpiryTime *inner;
18937    /**
18938     * Indicates that this is the only struct which contains the same pointer.
18939     * Rust functions which take ownership of an object provided via an argument require
18940     * this to be true and invalidate the object pointed to by inner.
18941     */
18942    bool is_owned;
18943 } LDKExpiryTime;
18944
18945
18946
18947 /**
18948  * `min_final_cltv_expiry_delta` to use for the last HTLC in the route
18949  */
18950 typedef struct MUST_USE_STRUCT LDKMinFinalCltvExpiryDelta {
18951    /**
18952     * A pointer to the opaque Rust object.
18953     * Nearly everywhere, inner must be non-null, however in places where
18954     * the Rust equivalent takes an Option, it may be set to null to indicate None.
18955     */
18956    LDKnativeMinFinalCltvExpiryDelta *inner;
18957    /**
18958     * Indicates that this is the only struct which contains the same pointer.
18959     * Rust functions which take ownership of an object provided via an argument require
18960     * this to be true and invalidate the object pointed to by inner.
18961     */
18962    bool is_owned;
18963 } LDKMinFinalCltvExpiryDelta;
18964
18965 /**
18966  * A 20-byte byte array.
18967  */
18968 typedef struct LDKTwentyBytes {
18969    /**
18970     * The twenty bytes
18971     */
18972    uint8_t data[20];
18973 } LDKTwentyBytes;
18974
18975 /**
18976  * Fallback address in case no LN payment is possible
18977  */
18978 typedef enum LDKFallback_Tag {
18979    LDKFallback_SegWitProgram,
18980    LDKFallback_PubKeyHash,
18981    LDKFallback_ScriptHash,
18982    /**
18983     * Must be last for serialization purposes
18984     */
18985    LDKFallback_Sentinel,
18986 } LDKFallback_Tag;
18987
18988 typedef struct LDKFallback_LDKSegWitProgram_Body {
18989    struct LDKWitnessVersion version;
18990    struct LDKCVec_u8Z program;
18991 } LDKFallback_LDKSegWitProgram_Body;
18992
18993 typedef struct MUST_USE_STRUCT LDKFallback {
18994    LDKFallback_Tag tag;
18995    union {
18996       LDKFallback_LDKSegWitProgram_Body seg_wit_program;
18997       struct {
18998          struct LDKTwentyBytes pub_key_hash;
18999       };
19000       struct {
19001          struct LDKTwentyBytes script_hash;
19002       };
19003    };
19004 } LDKFallback;
19005
19006 extern const uintptr_t MAX_BUF_SIZE;
19007
19008 extern const uint64_t MIN_RELAY_FEE_SAT_PER_1000_WEIGHT;
19009
19010 extern const uint32_t FEERATE_FLOOR_SATS_PER_KW;
19011
19012 extern const uint64_t CLOSED_CHANNEL_UPDATE_ID;
19013
19014 extern const uint32_t ANTI_REORG_DELAY;
19015
19016 extern const uint16_t BREAKDOWN_TIMEOUT;
19017
19018 extern const uint16_t MIN_CLTV_EXPIRY_DELTA;
19019
19020 extern const uint16_t MIN_FINAL_CLTV_EXPIRY_DELTA;
19021
19022 extern const uint16_t MAX_HTLCS;
19023
19024 extern const uintptr_t OFFERED_HTLC_SCRIPT_WEIGHT;
19025
19026 extern const uintptr_t OFFERED_HTLC_SCRIPT_WEIGHT_ANCHORS;
19027
19028 extern const uintptr_t MAX_ACCEPTED_HTLC_SCRIPT_WEIGHT;
19029
19030 extern const uint64_t ANCHOR_INPUT_WITNESS_WEIGHT;
19031
19032 extern const uint64_t HTLC_TIMEOUT_INPUT_ANCHOR_WITNESS_WEIGHT;
19033
19034 extern const uint64_t HTLC_SUCCESS_INPUT_ANCHOR_WITNESS_WEIGHT;
19035
19036 extern const uintptr_t REVOKEABLE_REDEEMSCRIPT_MAX_LENGTH;
19037
19038 extern const uint64_t UNKNOWN_CHANNEL_CAPACITY_MSAT;
19039
19040 extern const uint32_t DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA;
19041
19042 extern const uint8_t DEFAULT_MAX_PATH_COUNT;
19043
19044 extern const uint64_t MAX_TIMESTAMP;
19045
19046 extern const uint64_t DEFAULT_EXPIRY_TIME;
19047
19048 extern const uint64_t DEFAULT_MIN_FINAL_CLTV_EXPIRY_DELTA;
19049
19050 extern const uint8_t TAG_PAYMENT_HASH;
19051
19052 extern const uint8_t TAG_DESCRIPTION;
19053
19054 extern const uint8_t TAG_PAYEE_PUB_KEY;
19055
19056 extern const uint8_t TAG_DESCRIPTION_HASH;
19057
19058 extern const uint8_t TAG_EXPIRY_TIME;
19059
19060 extern const uint8_t TAG_MIN_FINAL_CLTV_EXPIRY_DELTA;
19061
19062 extern const uint8_t TAG_FALLBACK;
19063
19064 extern const uint8_t TAG_PRIVATE_ROUTE;
19065
19066 extern const uint8_t TAG_PAYMENT_SECRET;
19067
19068 extern const uint8_t TAG_PAYMENT_METADATA;
19069
19070 extern const uint8_t TAG_FEATURES;
19071
19072 struct LDKStr _ldk_get_compiled_version(void);
19073
19074 struct LDKStr _ldk_c_bindings_get_compiled_version(void);
19075
19076 /**
19077  * Gets the 128-bit integer, as 16 little-endian bytes
19078  */
19079 struct LDKSixteenBytes U128_le_bytes(struct LDKU128 val);
19080
19081 /**
19082  * Constructs a new U128 from 16 little-endian bytes
19083  */
19084 struct LDKU128 U128_new(struct LDKSixteenBytes le_bytes);
19085
19086 /**
19087  * Convenience function for constructing a new BigEndianScalar
19088  */
19089 struct LDKBigEndianScalar BigEndianScalar_new(struct LDKThirtyTwoBytes big_endian_bytes);
19090
19091 /**
19092  * Creates a new Bech32Error which has the same data as `orig`
19093  */
19094 struct LDKBech32Error Bech32Error_clone(const struct LDKBech32Error *NONNULL_PTR orig);
19095
19096 /**
19097  * Releases any memory held by the given `Bech32Error` (which is currently none)
19098  */
19099 void Bech32Error_free(struct LDKBech32Error o);
19100
19101 /**
19102  * Frees the data buffer, if data_is_owned is set and datalen > 0.
19103  */
19104 void Transaction_free(struct LDKTransaction _res);
19105
19106 /**
19107  * Creates a new Witness which has the same data as `orig` but with a new buffer.
19108  */
19109 struct LDKWitness Witness_clone(const struct LDKWitness *NONNULL_PTR orig);
19110
19111 /**
19112  * Frees the data pointed to by data
19113  */
19114 void Witness_free(struct LDKWitness _res);
19115
19116 /**
19117  * Frees the witness and script_sig in a TxIn
19118  */
19119 void TxIn_free(struct LDKTxIn _res);
19120
19121 /**
19122  * Convenience function for constructing a new TxIn
19123  */
19124 struct LDKTxIn TxIn_new(struct LDKWitness witness, struct LDKCVec_u8Z script_sig, uint32_t sequence, struct LDKThirtyTwoBytes previous_txid, uint32_t previous_vout);
19125
19126 /**
19127  * Convenience function for constructing a new TxOut
19128  */
19129 struct LDKTxOut TxOut_new(struct LDKCVec_u8Z script_pubkey, uint64_t value);
19130
19131 /**
19132  * Frees the data pointed to by script_pubkey.
19133  */
19134 void TxOut_free(struct LDKTxOut _res);
19135
19136 /**
19137  * Creates a new TxOut which has the same data as `orig` but with a new script buffer.
19138  */
19139 struct LDKTxOut TxOut_clone(const struct LDKTxOut *NONNULL_PTR orig);
19140
19141 /**
19142  * Frees the data buffer, if chars_is_owned is set and len > 0.
19143  */
19144 void Str_free(struct LDKStr _res);
19145
19146 #if defined(LDK_DEBUG_BUILD)
19147 /**
19148  * This function exists for memory safety testing purposes. It should never be used in production
19149  * code
19150  */
19151 const void *__unmangle_inner_ptr(const void *ptr);
19152 #endif
19153
19154 /**
19155  * Constructs a new COption_DurationZ containing a u64
19156  */
19157 struct LDKCOption_DurationZ COption_DurationZ_some(uint64_t o);
19158
19159 /**
19160  * Constructs a new COption_DurationZ containing nothing
19161  */
19162 struct LDKCOption_DurationZ COption_DurationZ_none(void);
19163
19164 /**
19165  * Frees any resources associated with the u64, if we are in the Some state
19166  */
19167 void COption_DurationZ_free(struct LDKCOption_DurationZ _res);
19168
19169 /**
19170  * Creates a new COption_DurationZ which has the same data as `orig`
19171  * but with all dynamically-allocated buffers duplicated in new buffers.
19172  */
19173 struct LDKCOption_DurationZ COption_DurationZ_clone(const struct LDKCOption_DurationZ *NONNULL_PTR orig);
19174
19175 /**
19176  * Frees the buffer pointed to by `data` if `datalen` is non-0.
19177  */
19178 void CVec_BlindedPathZ_free(struct LDKCVec_BlindedPathZ _res);
19179
19180 /**
19181  * Constructs a new COption_u64Z containing a u64
19182  */
19183 struct LDKCOption_u64Z COption_u64Z_some(uint64_t o);
19184
19185 /**
19186  * Constructs a new COption_u64Z containing nothing
19187  */
19188 struct LDKCOption_u64Z COption_u64Z_none(void);
19189
19190 /**
19191  * Frees any resources associated with the u64, if we are in the Some state
19192  */
19193 void COption_u64Z_free(struct LDKCOption_u64Z _res);
19194
19195 /**
19196  * Creates a new COption_u64Z which has the same data as `orig`
19197  * but with all dynamically-allocated buffers duplicated in new buffers.
19198  */
19199 struct LDKCOption_u64Z COption_u64Z_clone(const struct LDKCOption_u64Z *NONNULL_PTR orig);
19200
19201 /**
19202  * Creates a new CResult_RefundBolt12ParseErrorZ in the success state.
19203  */
19204 struct LDKCResult_RefundBolt12ParseErrorZ CResult_RefundBolt12ParseErrorZ_ok(struct LDKRefund o);
19205
19206 /**
19207  * Creates a new CResult_RefundBolt12ParseErrorZ in the error state.
19208  */
19209 struct LDKCResult_RefundBolt12ParseErrorZ CResult_RefundBolt12ParseErrorZ_err(struct LDKBolt12ParseError e);
19210
19211 /**
19212  * Checks if the given object is currently in the success state
19213  */
19214 bool CResult_RefundBolt12ParseErrorZ_is_ok(const struct LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR o);
19215
19216 /**
19217  * Frees any resources used by the CResult_RefundBolt12ParseErrorZ.
19218  */
19219 void CResult_RefundBolt12ParseErrorZ_free(struct LDKCResult_RefundBolt12ParseErrorZ _res);
19220
19221 /**
19222  * Creates a new CResult_RefundBolt12ParseErrorZ which has the same data as `orig`
19223  * but with all dynamically-allocated buffers duplicated in new buffers.
19224  */
19225 struct LDKCResult_RefundBolt12ParseErrorZ CResult_RefundBolt12ParseErrorZ_clone(const struct LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR orig);
19226
19227 /**
19228  * Creates a new CResult_NoneAPIErrorZ in the success state.
19229  */
19230 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_ok(void);
19231
19232 /**
19233  * Creates a new CResult_NoneAPIErrorZ in the error state.
19234  */
19235 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_err(struct LDKAPIError e);
19236
19237 /**
19238  * Checks if the given object is currently in the success state
19239  */
19240 bool CResult_NoneAPIErrorZ_is_ok(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR o);
19241
19242 /**
19243  * Frees any resources used by the CResult_NoneAPIErrorZ.
19244  */
19245 void CResult_NoneAPIErrorZ_free(struct LDKCResult_NoneAPIErrorZ _res);
19246
19247 /**
19248  * Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
19249  * but with all dynamically-allocated buffers duplicated in new buffers.
19250  */
19251 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_clone(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR orig);
19252
19253 /**
19254  * Frees the buffer pointed to by `data` if `datalen` is non-0.
19255  */
19256 void CVec_CResult_NoneAPIErrorZZ_free(struct LDKCVec_CResult_NoneAPIErrorZZ _res);
19257
19258 /**
19259  * Frees the buffer pointed to by `data` if `datalen` is non-0.
19260  */
19261 void CVec_APIErrorZ_free(struct LDKCVec_APIErrorZ _res);
19262
19263 /**
19264  * Constructs a new COption_PaymentSecretZ containing a crate::c_types::ThirtyTwoBytes
19265  */
19266 struct LDKCOption_PaymentSecretZ COption_PaymentSecretZ_some(struct LDKThirtyTwoBytes o);
19267
19268 /**
19269  * Constructs a new COption_PaymentSecretZ containing nothing
19270  */
19271 struct LDKCOption_PaymentSecretZ COption_PaymentSecretZ_none(void);
19272
19273 /**
19274  * Frees any resources associated with the crate::c_types::ThirtyTwoBytes, if we are in the Some state
19275  */
19276 void COption_PaymentSecretZ_free(struct LDKCOption_PaymentSecretZ _res);
19277
19278 /**
19279  * Creates a new COption_PaymentSecretZ which has the same data as `orig`
19280  * but with all dynamically-allocated buffers duplicated in new buffers.
19281  */
19282 struct LDKCOption_PaymentSecretZ COption_PaymentSecretZ_clone(const struct LDKCOption_PaymentSecretZ *NONNULL_PTR orig);
19283
19284 /**
19285  * Frees the buffer pointed to by `data` if `datalen` is non-0.
19286  */
19287 void CVec_u8Z_free(struct LDKCVec_u8Z _res);
19288
19289 /**
19290  * Constructs a new COption_CVec_u8ZZ containing a crate::c_types::derived::CVec_u8Z
19291  */
19292 struct LDKCOption_CVec_u8ZZ COption_CVec_u8ZZ_some(struct LDKCVec_u8Z o);
19293
19294 /**
19295  * Constructs a new COption_CVec_u8ZZ containing nothing
19296  */
19297 struct LDKCOption_CVec_u8ZZ COption_CVec_u8ZZ_none(void);
19298
19299 /**
19300  * Frees any resources associated with the crate::c_types::derived::CVec_u8Z, if we are in the Some state
19301  */
19302 void COption_CVec_u8ZZ_free(struct LDKCOption_CVec_u8ZZ _res);
19303
19304 /**
19305  * Creates a new COption_CVec_u8ZZ which has the same data as `orig`
19306  * but with all dynamically-allocated buffers duplicated in new buffers.
19307  */
19308 struct LDKCOption_CVec_u8ZZ COption_CVec_u8ZZ_clone(const struct LDKCOption_CVec_u8ZZ *NONNULL_PTR orig);
19309
19310 /**
19311  * Creates a new CResult_RecipientOnionFieldsDecodeErrorZ in the success state.
19312  */
19313 struct LDKCResult_RecipientOnionFieldsDecodeErrorZ CResult_RecipientOnionFieldsDecodeErrorZ_ok(struct LDKRecipientOnionFields o);
19314
19315 /**
19316  * Creates a new CResult_RecipientOnionFieldsDecodeErrorZ in the error state.
19317  */
19318 struct LDKCResult_RecipientOnionFieldsDecodeErrorZ CResult_RecipientOnionFieldsDecodeErrorZ_err(struct LDKDecodeError e);
19319
19320 /**
19321  * Checks if the given object is currently in the success state
19322  */
19323 bool CResult_RecipientOnionFieldsDecodeErrorZ_is_ok(const struct LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR o);
19324
19325 /**
19326  * Frees any resources used by the CResult_RecipientOnionFieldsDecodeErrorZ.
19327  */
19328 void CResult_RecipientOnionFieldsDecodeErrorZ_free(struct LDKCResult_RecipientOnionFieldsDecodeErrorZ _res);
19329
19330 /**
19331  * Creates a new CResult_RecipientOnionFieldsDecodeErrorZ which has the same data as `orig`
19332  * but with all dynamically-allocated buffers duplicated in new buffers.
19333  */
19334 struct LDKCResult_RecipientOnionFieldsDecodeErrorZ CResult_RecipientOnionFieldsDecodeErrorZ_clone(const struct LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR orig);
19335
19336 /**
19337  * Creates a new CResult_BlindedPayInfoDecodeErrorZ in the success state.
19338  */
19339 struct LDKCResult_BlindedPayInfoDecodeErrorZ CResult_BlindedPayInfoDecodeErrorZ_ok(struct LDKBlindedPayInfo o);
19340
19341 /**
19342  * Creates a new CResult_BlindedPayInfoDecodeErrorZ in the error state.
19343  */
19344 struct LDKCResult_BlindedPayInfoDecodeErrorZ CResult_BlindedPayInfoDecodeErrorZ_err(struct LDKDecodeError e);
19345
19346 /**
19347  * Checks if the given object is currently in the success state
19348  */
19349 bool CResult_BlindedPayInfoDecodeErrorZ_is_ok(const struct LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR o);
19350
19351 /**
19352  * Frees any resources used by the CResult_BlindedPayInfoDecodeErrorZ.
19353  */
19354 void CResult_BlindedPayInfoDecodeErrorZ_free(struct LDKCResult_BlindedPayInfoDecodeErrorZ _res);
19355
19356 /**
19357  * Creates a new CResult_BlindedPayInfoDecodeErrorZ which has the same data as `orig`
19358  * but with all dynamically-allocated buffers duplicated in new buffers.
19359  */
19360 struct LDKCResult_BlindedPayInfoDecodeErrorZ CResult_BlindedPayInfoDecodeErrorZ_clone(const struct LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR orig);
19361
19362 /**
19363  * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
19364  */
19365 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(struct LDKDelayedPaymentOutputDescriptor o);
19366
19367 /**
19368  * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
19369  */
19370 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
19371
19372 /**
19373  * Checks if the given object is currently in the success state
19374  */
19375 bool CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR o);
19376
19377 /**
19378  * Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
19379  */
19380 void CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res);
19381
19382 /**
19383  * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
19384  * but with all dynamically-allocated buffers duplicated in new buffers.
19385  */
19386 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
19387
19388 /**
19389  * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
19390  */
19391 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(struct LDKStaticPaymentOutputDescriptor o);
19392
19393 /**
19394  * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
19395  */
19396 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
19397
19398 /**
19399  * Checks if the given object is currently in the success state
19400  */
19401 bool CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR o);
19402
19403 /**
19404  * Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
19405  */
19406 void CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res);
19407
19408 /**
19409  * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
19410  * but with all dynamically-allocated buffers duplicated in new buffers.
19411  */
19412 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
19413
19414 /**
19415  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
19416  */
19417 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_ok(struct LDKSpendableOutputDescriptor o);
19418
19419 /**
19420  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
19421  */
19422 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
19423
19424 /**
19425  * Checks if the given object is currently in the success state
19426  */
19427 bool CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR o);
19428
19429 /**
19430  * Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
19431  */
19432 void CResult_SpendableOutputDescriptorDecodeErrorZ_free(struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res);
19433
19434 /**
19435  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
19436  * but with all dynamically-allocated buffers duplicated in new buffers.
19437  */
19438 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
19439
19440 /**
19441  * Frees the buffer pointed to by `data` if `datalen` is non-0.
19442  */
19443 void CVec_SpendableOutputDescriptorZ_free(struct LDKCVec_SpendableOutputDescriptorZ _res);
19444
19445 /**
19446  * Frees the buffer pointed to by `data` if `datalen` is non-0.
19447  */
19448 void CVec_TxOutZ_free(struct LDKCVec_TxOutZ _res);
19449
19450 /**
19451  * Constructs a new COption_PackedLockTimeZ containing a u32
19452  */
19453 struct LDKCOption_PackedLockTimeZ COption_PackedLockTimeZ_some(uint32_t o);
19454
19455 /**
19456  * Constructs a new COption_PackedLockTimeZ containing nothing
19457  */
19458 struct LDKCOption_PackedLockTimeZ COption_PackedLockTimeZ_none(void);
19459
19460 /**
19461  * Frees any resources associated with the u32, if we are in the Some state
19462  */
19463 void COption_PackedLockTimeZ_free(struct LDKCOption_PackedLockTimeZ _res);
19464
19465 /**
19466  * Creates a new COption_PackedLockTimeZ which has the same data as `orig`
19467  * but with all dynamically-allocated buffers duplicated in new buffers.
19468  */
19469 struct LDKCOption_PackedLockTimeZ COption_PackedLockTimeZ_clone(const struct LDKCOption_PackedLockTimeZ *NONNULL_PTR orig);
19470
19471 /**
19472  * Creates a new tuple which has the same data as `orig`
19473  * but with all dynamically-allocated buffers duplicated in new buffers.
19474  */
19475 struct LDKC2Tuple_PartiallySignedTransactionusizeZ C2Tuple_PartiallySignedTransactionusizeZ_clone(const struct LDKC2Tuple_PartiallySignedTransactionusizeZ *NONNULL_PTR orig);
19476
19477 /**
19478  * Creates a new C2Tuple_PartiallySignedTransactionusizeZ from the contained elements.
19479  */
19480 struct LDKC2Tuple_PartiallySignedTransactionusizeZ C2Tuple_PartiallySignedTransactionusizeZ_new(struct LDKCVec_u8Z a, uintptr_t b);
19481
19482 /**
19483  * Frees any resources used by the C2Tuple_PartiallySignedTransactionusizeZ.
19484  */
19485 void C2Tuple_PartiallySignedTransactionusizeZ_free(struct LDKC2Tuple_PartiallySignedTransactionusizeZ _res);
19486
19487 /**
19488  * Creates a new CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ in the success state.
19489  */
19490 struct LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_ok(struct LDKC2Tuple_PartiallySignedTransactionusizeZ o);
19491
19492 /**
19493  * Creates a new CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ in the error state.
19494  */
19495 struct LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_err(void);
19496
19497 /**
19498  * Checks if the given object is currently in the success state
19499  */
19500 bool CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_is_ok(const struct LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ *NONNULL_PTR o);
19501
19502 /**
19503  * Frees any resources used by the CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ.
19504  */
19505 void CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_free(struct LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ _res);
19506
19507 /**
19508  * Creates a new CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ which has the same data as `orig`
19509  * but with all dynamically-allocated buffers duplicated in new buffers.
19510  */
19511 struct LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_clone(const struct LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ *NONNULL_PTR orig);
19512
19513 /**
19514  * Frees the buffer pointed to by `data` if `datalen` is non-0.
19515  */
19516 void CVec_PaymentPreimageZ_free(struct LDKCVec_PaymentPreimageZ _res);
19517
19518 /**
19519  * Creates a new CResult_NoneNoneZ in the success state.
19520  */
19521 struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_ok(void);
19522
19523 /**
19524  * Creates a new CResult_NoneNoneZ in the error state.
19525  */
19526 struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_err(void);
19527
19528 /**
19529  * Checks if the given object is currently in the success state
19530  */
19531 bool CResult_NoneNoneZ_is_ok(const struct LDKCResult_NoneNoneZ *NONNULL_PTR o);
19532
19533 /**
19534  * Frees any resources used by the CResult_NoneNoneZ.
19535  */
19536 void CResult_NoneNoneZ_free(struct LDKCResult_NoneNoneZ _res);
19537
19538 /**
19539  * Creates a new CResult_NoneNoneZ which has the same data as `orig`
19540  * but with all dynamically-allocated buffers duplicated in new buffers.
19541  */
19542 struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_clone(const struct LDKCResult_NoneNoneZ *NONNULL_PTR orig);
19543
19544 /**
19545  * Frees the buffer pointed to by `data` if `datalen` is non-0.
19546  */
19547 void CVec_SignatureZ_free(struct LDKCVec_SignatureZ _res);
19548
19549 /**
19550  * Creates a new tuple which has the same data as `orig`
19551  * but with all dynamically-allocated buffers duplicated in new buffers.
19552  */
19553 struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_clone(const struct LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR orig);
19554
19555 /**
19556  * Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
19557  */
19558 struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_new(struct LDKSignature a, struct LDKCVec_SignatureZ b);
19559
19560 /**
19561  * Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
19562  */
19563 void C2Tuple_SignatureCVec_SignatureZZ_free(struct LDKC2Tuple_SignatureCVec_SignatureZZ _res);
19564
19565 /**
19566  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
19567  */
19568 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(struct LDKC2Tuple_SignatureCVec_SignatureZZ o);
19569
19570 /**
19571  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
19572  */
19573 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err(void);
19574
19575 /**
19576  * Checks if the given object is currently in the success state
19577  */
19578 bool CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(const struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR o);
19579
19580 /**
19581  * Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
19582  */
19583 void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res);
19584
19585 /**
19586  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
19587  * but with all dynamically-allocated buffers duplicated in new buffers.
19588  */
19589 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(const struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR orig);
19590
19591 /**
19592  * Creates a new CResult_SignatureNoneZ in the success state.
19593  */
19594 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_ok(struct LDKSignature o);
19595
19596 /**
19597  * Creates a new CResult_SignatureNoneZ in the error state.
19598  */
19599 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_err(void);
19600
19601 /**
19602  * Checks if the given object is currently in the success state
19603  */
19604 bool CResult_SignatureNoneZ_is_ok(const struct LDKCResult_SignatureNoneZ *NONNULL_PTR o);
19605
19606 /**
19607  * Frees any resources used by the CResult_SignatureNoneZ.
19608  */
19609 void CResult_SignatureNoneZ_free(struct LDKCResult_SignatureNoneZ _res);
19610
19611 /**
19612  * Creates a new CResult_SignatureNoneZ which has the same data as `orig`
19613  * but with all dynamically-allocated buffers duplicated in new buffers.
19614  */
19615 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_clone(const struct LDKCResult_SignatureNoneZ *NONNULL_PTR orig);
19616
19617 /**
19618  * Creates a new CResult_PublicKeyNoneZ in the success state.
19619  */
19620 struct LDKCResult_PublicKeyNoneZ CResult_PublicKeyNoneZ_ok(struct LDKPublicKey o);
19621
19622 /**
19623  * Creates a new CResult_PublicKeyNoneZ in the error state.
19624  */
19625 struct LDKCResult_PublicKeyNoneZ CResult_PublicKeyNoneZ_err(void);
19626
19627 /**
19628  * Checks if the given object is currently in the success state
19629  */
19630 bool CResult_PublicKeyNoneZ_is_ok(const struct LDKCResult_PublicKeyNoneZ *NONNULL_PTR o);
19631
19632 /**
19633  * Frees any resources used by the CResult_PublicKeyNoneZ.
19634  */
19635 void CResult_PublicKeyNoneZ_free(struct LDKCResult_PublicKeyNoneZ _res);
19636
19637 /**
19638  * Creates a new CResult_PublicKeyNoneZ which has the same data as `orig`
19639  * but with all dynamically-allocated buffers duplicated in new buffers.
19640  */
19641 struct LDKCResult_PublicKeyNoneZ CResult_PublicKeyNoneZ_clone(const struct LDKCResult_PublicKeyNoneZ *NONNULL_PTR orig);
19642
19643 /**
19644  * Constructs a new COption_ScalarZ containing a crate::c_types::BigEndianScalar
19645  */
19646 struct LDKCOption_ScalarZ COption_ScalarZ_some(struct LDKBigEndianScalar o);
19647
19648 /**
19649  * Constructs a new COption_ScalarZ containing nothing
19650  */
19651 struct LDKCOption_ScalarZ COption_ScalarZ_none(void);
19652
19653 /**
19654  * Frees any resources associated with the crate::c_types::BigEndianScalar, if we are in the Some state
19655  */
19656 void COption_ScalarZ_free(struct LDKCOption_ScalarZ _res);
19657
19658 /**
19659  * Creates a new COption_ScalarZ which has the same data as `orig`
19660  * but with all dynamically-allocated buffers duplicated in new buffers.
19661  */
19662 struct LDKCOption_ScalarZ COption_ScalarZ_clone(const struct LDKCOption_ScalarZ *NONNULL_PTR orig);
19663
19664 /**
19665  * Creates a new CResult_SharedSecretNoneZ in the success state.
19666  */
19667 struct LDKCResult_SharedSecretNoneZ CResult_SharedSecretNoneZ_ok(struct LDKThirtyTwoBytes o);
19668
19669 /**
19670  * Creates a new CResult_SharedSecretNoneZ in the error state.
19671  */
19672 struct LDKCResult_SharedSecretNoneZ CResult_SharedSecretNoneZ_err(void);
19673
19674 /**
19675  * Checks if the given object is currently in the success state
19676  */
19677 bool CResult_SharedSecretNoneZ_is_ok(const struct LDKCResult_SharedSecretNoneZ *NONNULL_PTR o);
19678
19679 /**
19680  * Frees any resources used by the CResult_SharedSecretNoneZ.
19681  */
19682 void CResult_SharedSecretNoneZ_free(struct LDKCResult_SharedSecretNoneZ _res);
19683
19684 /**
19685  * Creates a new CResult_SharedSecretNoneZ which has the same data as `orig`
19686  * but with all dynamically-allocated buffers duplicated in new buffers.
19687  */
19688 struct LDKCResult_SharedSecretNoneZ CResult_SharedSecretNoneZ_clone(const struct LDKCResult_SharedSecretNoneZ *NONNULL_PTR orig);
19689
19690 /**
19691  * Frees the buffer pointed to by `data` if `datalen` is non-0.
19692  */
19693 void CVec_U5Z_free(struct LDKCVec_U5Z _res);
19694
19695 /**
19696  * Creates a new CResult_RecoverableSignatureNoneZ in the success state.
19697  */
19698 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_ok(struct LDKRecoverableSignature o);
19699
19700 /**
19701  * Creates a new CResult_RecoverableSignatureNoneZ in the error state.
19702  */
19703 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_err(void);
19704
19705 /**
19706  * Checks if the given object is currently in the success state
19707  */
19708 bool CResult_RecoverableSignatureNoneZ_is_ok(const struct LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR o);
19709
19710 /**
19711  * Frees any resources used by the CResult_RecoverableSignatureNoneZ.
19712  */
19713 void CResult_RecoverableSignatureNoneZ_free(struct LDKCResult_RecoverableSignatureNoneZ _res);
19714
19715 /**
19716  * Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
19717  * but with all dynamically-allocated buffers duplicated in new buffers.
19718  */
19719 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_clone(const struct LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR orig);
19720
19721 /**
19722  * Creates a new CResult_WriteableEcdsaChannelSignerDecodeErrorZ in the success state.
19723  */
19724 struct LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(struct LDKWriteableEcdsaChannelSigner o);
19725
19726 /**
19727  * Creates a new CResult_WriteableEcdsaChannelSignerDecodeErrorZ in the error state.
19728  */
19729 struct LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err(struct LDKDecodeError e);
19730
19731 /**
19732  * Checks if the given object is currently in the success state
19733  */
19734 bool CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(const struct LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR o);
19735
19736 /**
19737  * Frees any resources used by the CResult_WriteableEcdsaChannelSignerDecodeErrorZ.
19738  */
19739 void CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(struct LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ _res);
19740
19741 /**
19742  * Creates a new CResult_ScriptNoneZ in the success state.
19743  */
19744 struct LDKCResult_ScriptNoneZ CResult_ScriptNoneZ_ok(struct LDKCVec_u8Z o);
19745
19746 /**
19747  * Creates a new CResult_ScriptNoneZ in the error state.
19748  */
19749 struct LDKCResult_ScriptNoneZ CResult_ScriptNoneZ_err(void);
19750
19751 /**
19752  * Checks if the given object is currently in the success state
19753  */
19754 bool CResult_ScriptNoneZ_is_ok(const struct LDKCResult_ScriptNoneZ *NONNULL_PTR o);
19755
19756 /**
19757  * Frees any resources used by the CResult_ScriptNoneZ.
19758  */
19759 void CResult_ScriptNoneZ_free(struct LDKCResult_ScriptNoneZ _res);
19760
19761 /**
19762  * Creates a new CResult_ScriptNoneZ which has the same data as `orig`
19763  * but with all dynamically-allocated buffers duplicated in new buffers.
19764  */
19765 struct LDKCResult_ScriptNoneZ CResult_ScriptNoneZ_clone(const struct LDKCResult_ScriptNoneZ *NONNULL_PTR orig);
19766
19767 /**
19768  * Creates a new CResult_ShutdownScriptNoneZ in the success state.
19769  */
19770 struct LDKCResult_ShutdownScriptNoneZ CResult_ShutdownScriptNoneZ_ok(struct LDKShutdownScript o);
19771
19772 /**
19773  * Creates a new CResult_ShutdownScriptNoneZ in the error state.
19774  */
19775 struct LDKCResult_ShutdownScriptNoneZ CResult_ShutdownScriptNoneZ_err(void);
19776
19777 /**
19778  * Checks if the given object is currently in the success state
19779  */
19780 bool CResult_ShutdownScriptNoneZ_is_ok(const struct LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR o);
19781
19782 /**
19783  * Frees any resources used by the CResult_ShutdownScriptNoneZ.
19784  */
19785 void CResult_ShutdownScriptNoneZ_free(struct LDKCResult_ShutdownScriptNoneZ _res);
19786
19787 /**
19788  * Creates a new CResult_ShutdownScriptNoneZ which has the same data as `orig`
19789  * but with all dynamically-allocated buffers duplicated in new buffers.
19790  */
19791 struct LDKCResult_ShutdownScriptNoneZ CResult_ShutdownScriptNoneZ_clone(const struct LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR orig);
19792
19793 /**
19794  * Frees the buffer pointed to by `data` if `datalen` is non-0.
19795  */
19796 void CVec_CVec_u8ZZ_free(struct LDKCVec_CVec_u8ZZ _res);
19797
19798 /**
19799  * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
19800  */
19801 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_ok(struct LDKCVec_CVec_u8ZZ o);
19802
19803 /**
19804  * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
19805  */
19806 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_err(void);
19807
19808 /**
19809  * Checks if the given object is currently in the success state
19810  */
19811 bool CResult_CVec_CVec_u8ZZNoneZ_is_ok(const struct LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR o);
19812
19813 /**
19814  * Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
19815  */
19816 void CResult_CVec_CVec_u8ZZNoneZ_free(struct LDKCResult_CVec_CVec_u8ZZNoneZ _res);
19817
19818 /**
19819  * Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
19820  * but with all dynamically-allocated buffers duplicated in new buffers.
19821  */
19822 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_clone(const struct LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR orig);
19823
19824 /**
19825  * Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
19826  */
19827 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_ok(struct LDKInMemorySigner o);
19828
19829 /**
19830  * Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
19831  */
19832 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_err(struct LDKDecodeError e);
19833
19834 /**
19835  * Checks if the given object is currently in the success state
19836  */
19837 bool CResult_InMemorySignerDecodeErrorZ_is_ok(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR o);
19838
19839 /**
19840  * Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
19841  */
19842 void CResult_InMemorySignerDecodeErrorZ_free(struct LDKCResult_InMemorySignerDecodeErrorZ _res);
19843
19844 /**
19845  * Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
19846  * but with all dynamically-allocated buffers duplicated in new buffers.
19847  */
19848 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_clone(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR orig);
19849
19850 /**
19851  * Creates a new CResult_PartiallySignedTransactionNoneZ in the success state.
19852  */
19853 struct LDKCResult_PartiallySignedTransactionNoneZ CResult_PartiallySignedTransactionNoneZ_ok(struct LDKCVec_u8Z o);
19854
19855 /**
19856  * Creates a new CResult_PartiallySignedTransactionNoneZ in the error state.
19857  */
19858 struct LDKCResult_PartiallySignedTransactionNoneZ CResult_PartiallySignedTransactionNoneZ_err(void);
19859
19860 /**
19861  * Checks if the given object is currently in the success state
19862  */
19863 bool CResult_PartiallySignedTransactionNoneZ_is_ok(const struct LDKCResult_PartiallySignedTransactionNoneZ *NONNULL_PTR o);
19864
19865 /**
19866  * Frees any resources used by the CResult_PartiallySignedTransactionNoneZ.
19867  */
19868 void CResult_PartiallySignedTransactionNoneZ_free(struct LDKCResult_PartiallySignedTransactionNoneZ _res);
19869
19870 /**
19871  * Creates a new CResult_PartiallySignedTransactionNoneZ which has the same data as `orig`
19872  * but with all dynamically-allocated buffers duplicated in new buffers.
19873  */
19874 struct LDKCResult_PartiallySignedTransactionNoneZ CResult_PartiallySignedTransactionNoneZ_clone(const struct LDKCResult_PartiallySignedTransactionNoneZ *NONNULL_PTR orig);
19875
19876 /**
19877  * Creates a new CResult_TransactionNoneZ in the success state.
19878  */
19879 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_ok(struct LDKTransaction o);
19880
19881 /**
19882  * Creates a new CResult_TransactionNoneZ in the error state.
19883  */
19884 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_err(void);
19885
19886 /**
19887  * Checks if the given object is currently in the success state
19888  */
19889 bool CResult_TransactionNoneZ_is_ok(const struct LDKCResult_TransactionNoneZ *NONNULL_PTR o);
19890
19891 /**
19892  * Frees any resources used by the CResult_TransactionNoneZ.
19893  */
19894 void CResult_TransactionNoneZ_free(struct LDKCResult_TransactionNoneZ _res);
19895
19896 /**
19897  * Creates a new CResult_TransactionNoneZ which has the same data as `orig`
19898  * but with all dynamically-allocated buffers duplicated in new buffers.
19899  */
19900 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_clone(const struct LDKCResult_TransactionNoneZ *NONNULL_PTR orig);
19901
19902 /**
19903  * Constructs a new COption_WriteableScoreZ containing a crate::lightning::routing::scoring::WriteableScore
19904  */
19905 struct LDKCOption_WriteableScoreZ COption_WriteableScoreZ_some(struct LDKWriteableScore o);
19906
19907 /**
19908  * Constructs a new COption_WriteableScoreZ containing nothing
19909  */
19910 struct LDKCOption_WriteableScoreZ COption_WriteableScoreZ_none(void);
19911
19912 /**
19913  * Frees any resources associated with the crate::lightning::routing::scoring::WriteableScore, if we are in the Some state
19914  */
19915 void COption_WriteableScoreZ_free(struct LDKCOption_WriteableScoreZ _res);
19916
19917 /**
19918  * Creates a new CResult_NoneErrorZ in the success state.
19919  */
19920 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_ok(void);
19921
19922 /**
19923  * Creates a new CResult_NoneErrorZ in the error state.
19924  */
19925 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_err(enum LDKIOError e);
19926
19927 /**
19928  * Checks if the given object is currently in the success state
19929  */
19930 bool CResult_NoneErrorZ_is_ok(const struct LDKCResult_NoneErrorZ *NONNULL_PTR o);
19931
19932 /**
19933  * Frees any resources used by the CResult_NoneErrorZ.
19934  */
19935 void CResult_NoneErrorZ_free(struct LDKCResult_NoneErrorZ _res);
19936
19937 /**
19938  * Creates a new CResult_NoneErrorZ which has the same data as `orig`
19939  * but with all dynamically-allocated buffers duplicated in new buffers.
19940  */
19941 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_clone(const struct LDKCResult_NoneErrorZ *NONNULL_PTR orig);
19942
19943 /**
19944  * Frees the buffer pointed to by `data` if `datalen` is non-0.
19945  */
19946 void CVec_ChannelDetailsZ_free(struct LDKCVec_ChannelDetailsZ _res);
19947
19948 /**
19949  * Creates a new CResult_RouteLightningErrorZ in the success state.
19950  */
19951 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_ok(struct LDKRoute o);
19952
19953 /**
19954  * Creates a new CResult_RouteLightningErrorZ in the error state.
19955  */
19956 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_err(struct LDKLightningError e);
19957
19958 /**
19959  * Checks if the given object is currently in the success state
19960  */
19961 bool CResult_RouteLightningErrorZ_is_ok(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR o);
19962
19963 /**
19964  * Frees any resources used by the CResult_RouteLightningErrorZ.
19965  */
19966 void CResult_RouteLightningErrorZ_free(struct LDKCResult_RouteLightningErrorZ _res);
19967
19968 /**
19969  * Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
19970  * but with all dynamically-allocated buffers duplicated in new buffers.
19971  */
19972 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_clone(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR orig);
19973
19974 /**
19975  * Creates a new CResult_InFlightHtlcsDecodeErrorZ in the success state.
19976  */
19977 struct LDKCResult_InFlightHtlcsDecodeErrorZ CResult_InFlightHtlcsDecodeErrorZ_ok(struct LDKInFlightHtlcs o);
19978
19979 /**
19980  * Creates a new CResult_InFlightHtlcsDecodeErrorZ in the error state.
19981  */
19982 struct LDKCResult_InFlightHtlcsDecodeErrorZ CResult_InFlightHtlcsDecodeErrorZ_err(struct LDKDecodeError e);
19983
19984 /**
19985  * Checks if the given object is currently in the success state
19986  */
19987 bool CResult_InFlightHtlcsDecodeErrorZ_is_ok(const struct LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR o);
19988
19989 /**
19990  * Frees any resources used by the CResult_InFlightHtlcsDecodeErrorZ.
19991  */
19992 void CResult_InFlightHtlcsDecodeErrorZ_free(struct LDKCResult_InFlightHtlcsDecodeErrorZ _res);
19993
19994 /**
19995  * Creates a new CResult_InFlightHtlcsDecodeErrorZ which has the same data as `orig`
19996  * but with all dynamically-allocated buffers duplicated in new buffers.
19997  */
19998 struct LDKCResult_InFlightHtlcsDecodeErrorZ CResult_InFlightHtlcsDecodeErrorZ_clone(const struct LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR orig);
19999
20000 /**
20001  * Creates a new CResult_RouteHopDecodeErrorZ in the success state.
20002  */
20003 struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_ok(struct LDKRouteHop o);
20004
20005 /**
20006  * Creates a new CResult_RouteHopDecodeErrorZ in the error state.
20007  */
20008 struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_err(struct LDKDecodeError e);
20009
20010 /**
20011  * Checks if the given object is currently in the success state
20012  */
20013 bool CResult_RouteHopDecodeErrorZ_is_ok(const struct LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR o);
20014
20015 /**
20016  * Frees any resources used by the CResult_RouteHopDecodeErrorZ.
20017  */
20018 void CResult_RouteHopDecodeErrorZ_free(struct LDKCResult_RouteHopDecodeErrorZ _res);
20019
20020 /**
20021  * Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig`
20022  * but with all dynamically-allocated buffers duplicated in new buffers.
20023  */
20024 struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_clone(const struct LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR orig);
20025
20026 /**
20027  * Frees the buffer pointed to by `data` if `datalen` is non-0.
20028  */
20029 void CVec_BlindedHopZ_free(struct LDKCVec_BlindedHopZ _res);
20030
20031 /**
20032  * Creates a new CResult_BlindedTailDecodeErrorZ in the success state.
20033  */
20034 struct LDKCResult_BlindedTailDecodeErrorZ CResult_BlindedTailDecodeErrorZ_ok(struct LDKBlindedTail o);
20035
20036 /**
20037  * Creates a new CResult_BlindedTailDecodeErrorZ in the error state.
20038  */
20039 struct LDKCResult_BlindedTailDecodeErrorZ CResult_BlindedTailDecodeErrorZ_err(struct LDKDecodeError e);
20040
20041 /**
20042  * Checks if the given object is currently in the success state
20043  */
20044 bool CResult_BlindedTailDecodeErrorZ_is_ok(const struct LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR o);
20045
20046 /**
20047  * Frees any resources used by the CResult_BlindedTailDecodeErrorZ.
20048  */
20049 void CResult_BlindedTailDecodeErrorZ_free(struct LDKCResult_BlindedTailDecodeErrorZ _res);
20050
20051 /**
20052  * Creates a new CResult_BlindedTailDecodeErrorZ which has the same data as `orig`
20053  * but with all dynamically-allocated buffers duplicated in new buffers.
20054  */
20055 struct LDKCResult_BlindedTailDecodeErrorZ CResult_BlindedTailDecodeErrorZ_clone(const struct LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR orig);
20056
20057 /**
20058  * Frees the buffer pointed to by `data` if `datalen` is non-0.
20059  */
20060 void CVec_RouteHopZ_free(struct LDKCVec_RouteHopZ _res);
20061
20062 /**
20063  * Constructs a new COption_u32Z containing a u32
20064  */
20065 struct LDKCOption_u32Z COption_u32Z_some(uint32_t o);
20066
20067 /**
20068  * Constructs a new COption_u32Z containing nothing
20069  */
20070 struct LDKCOption_u32Z COption_u32Z_none(void);
20071
20072 /**
20073  * Frees any resources associated with the u32, if we are in the Some state
20074  */
20075 void COption_u32Z_free(struct LDKCOption_u32Z _res);
20076
20077 /**
20078  * Creates a new COption_u32Z which has the same data as `orig`
20079  * but with all dynamically-allocated buffers duplicated in new buffers.
20080  */
20081 struct LDKCOption_u32Z COption_u32Z_clone(const struct LDKCOption_u32Z *NONNULL_PTR orig);
20082
20083 /**
20084  * Frees the buffer pointed to by `data` if `datalen` is non-0.
20085  */
20086 void CVec_PathZ_free(struct LDKCVec_PathZ _res);
20087
20088 /**
20089  * Creates a new CResult_RouteDecodeErrorZ in the success state.
20090  */
20091 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_ok(struct LDKRoute o);
20092
20093 /**
20094  * Creates a new CResult_RouteDecodeErrorZ in the error state.
20095  */
20096 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_err(struct LDKDecodeError e);
20097
20098 /**
20099  * Checks if the given object is currently in the success state
20100  */
20101 bool CResult_RouteDecodeErrorZ_is_ok(const struct LDKCResult_RouteDecodeErrorZ *NONNULL_PTR o);
20102
20103 /**
20104  * Frees any resources used by the CResult_RouteDecodeErrorZ.
20105  */
20106 void CResult_RouteDecodeErrorZ_free(struct LDKCResult_RouteDecodeErrorZ _res);
20107
20108 /**
20109  * Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
20110  * but with all dynamically-allocated buffers duplicated in new buffers.
20111  */
20112 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_clone(const struct LDKCResult_RouteDecodeErrorZ *NONNULL_PTR orig);
20113
20114 /**
20115  * Creates a new CResult_RouteParametersDecodeErrorZ in the success state.
20116  */
20117 struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_ok(struct LDKRouteParameters o);
20118
20119 /**
20120  * Creates a new CResult_RouteParametersDecodeErrorZ in the error state.
20121  */
20122 struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_err(struct LDKDecodeError e);
20123
20124 /**
20125  * Checks if the given object is currently in the success state
20126  */
20127 bool CResult_RouteParametersDecodeErrorZ_is_ok(const struct LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR o);
20128
20129 /**
20130  * Frees any resources used by the CResult_RouteParametersDecodeErrorZ.
20131  */
20132 void CResult_RouteParametersDecodeErrorZ_free(struct LDKCResult_RouteParametersDecodeErrorZ _res);
20133
20134 /**
20135  * Creates a new CResult_RouteParametersDecodeErrorZ which has the same data as `orig`
20136  * but with all dynamically-allocated buffers duplicated in new buffers.
20137  */
20138 struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_clone(const struct LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR orig);
20139
20140 /**
20141  * Frees the buffer pointed to by `data` if `datalen` is non-0.
20142  */
20143 void CVec_u64Z_free(struct LDKCVec_u64Z _res);
20144
20145 /**
20146  * Creates a new CResult_PaymentParametersDecodeErrorZ in the success state.
20147  */
20148 struct LDKCResult_PaymentParametersDecodeErrorZ CResult_PaymentParametersDecodeErrorZ_ok(struct LDKPaymentParameters o);
20149
20150 /**
20151  * Creates a new CResult_PaymentParametersDecodeErrorZ in the error state.
20152  */
20153 struct LDKCResult_PaymentParametersDecodeErrorZ CResult_PaymentParametersDecodeErrorZ_err(struct LDKDecodeError e);
20154
20155 /**
20156  * Checks if the given object is currently in the success state
20157  */
20158 bool CResult_PaymentParametersDecodeErrorZ_is_ok(const struct LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR o);
20159
20160 /**
20161  * Frees any resources used by the CResult_PaymentParametersDecodeErrorZ.
20162  */
20163 void CResult_PaymentParametersDecodeErrorZ_free(struct LDKCResult_PaymentParametersDecodeErrorZ _res);
20164
20165 /**
20166  * Creates a new CResult_PaymentParametersDecodeErrorZ which has the same data as `orig`
20167  * but with all dynamically-allocated buffers duplicated in new buffers.
20168  */
20169 struct LDKCResult_PaymentParametersDecodeErrorZ CResult_PaymentParametersDecodeErrorZ_clone(const struct LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR orig);
20170
20171 /**
20172  * Creates a new tuple which has the same data as `orig`
20173  * but with all dynamically-allocated buffers duplicated in new buffers.
20174  */
20175 struct LDKC2Tuple_BlindedPayInfoBlindedPathZ C2Tuple_BlindedPayInfoBlindedPathZ_clone(const struct LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR orig);
20176
20177 /**
20178  * Creates a new C2Tuple_BlindedPayInfoBlindedPathZ from the contained elements.
20179  */
20180 struct LDKC2Tuple_BlindedPayInfoBlindedPathZ C2Tuple_BlindedPayInfoBlindedPathZ_new(struct LDKBlindedPayInfo a, struct LDKBlindedPath b);
20181
20182 /**
20183  * Frees any resources used by the C2Tuple_BlindedPayInfoBlindedPathZ.
20184  */
20185 void C2Tuple_BlindedPayInfoBlindedPathZ_free(struct LDKC2Tuple_BlindedPayInfoBlindedPathZ _res);
20186
20187 /**
20188  * Frees the buffer pointed to by `data` if `datalen` is non-0.
20189  */
20190 void CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_free(struct LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ _res);
20191
20192 /**
20193  * Frees the buffer pointed to by `data` if `datalen` is non-0.
20194  */
20195 void CVec_RouteHintZ_free(struct LDKCVec_RouteHintZ _res);
20196
20197 /**
20198  * Frees the buffer pointed to by `data` if `datalen` is non-0.
20199  */
20200 void CVec_RouteHintHopZ_free(struct LDKCVec_RouteHintHopZ _res);
20201
20202 /**
20203  * Creates a new CResult_RouteHintDecodeErrorZ in the success state.
20204  */
20205 struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_ok(struct LDKRouteHint o);
20206
20207 /**
20208  * Creates a new CResult_RouteHintDecodeErrorZ in the error state.
20209  */
20210 struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_err(struct LDKDecodeError e);
20211
20212 /**
20213  * Checks if the given object is currently in the success state
20214  */
20215 bool CResult_RouteHintDecodeErrorZ_is_ok(const struct LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR o);
20216
20217 /**
20218  * Frees any resources used by the CResult_RouteHintDecodeErrorZ.
20219  */
20220 void CResult_RouteHintDecodeErrorZ_free(struct LDKCResult_RouteHintDecodeErrorZ _res);
20221
20222 /**
20223  * Creates a new CResult_RouteHintDecodeErrorZ which has the same data as `orig`
20224  * but with all dynamically-allocated buffers duplicated in new buffers.
20225  */
20226 struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_clone(const struct LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR orig);
20227
20228 /**
20229  * Creates a new CResult_RouteHintHopDecodeErrorZ in the success state.
20230  */
20231 struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_ok(struct LDKRouteHintHop o);
20232
20233 /**
20234  * Creates a new CResult_RouteHintHopDecodeErrorZ in the error state.
20235  */
20236 struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_err(struct LDKDecodeError e);
20237
20238 /**
20239  * Checks if the given object is currently in the success state
20240  */
20241 bool CResult_RouteHintHopDecodeErrorZ_is_ok(const struct LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR o);
20242
20243 /**
20244  * Frees any resources used by the CResult_RouteHintHopDecodeErrorZ.
20245  */
20246 void CResult_RouteHintHopDecodeErrorZ_free(struct LDKCResult_RouteHintHopDecodeErrorZ _res);
20247
20248 /**
20249  * Creates a new CResult_RouteHintHopDecodeErrorZ which has the same data as `orig`
20250  * but with all dynamically-allocated buffers duplicated in new buffers.
20251  */
20252 struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_clone(const struct LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR orig);
20253
20254 /**
20255  * Frees the buffer pointed to by `data` if `datalen` is non-0.
20256  */
20257 void CVec_PublicKeyZ_free(struct LDKCVec_PublicKeyZ _res);
20258
20259 /**
20260  * Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the success state.
20261  */
20262 struct LDKCResult_FixedPenaltyScorerDecodeErrorZ CResult_FixedPenaltyScorerDecodeErrorZ_ok(struct LDKFixedPenaltyScorer o);
20263
20264 /**
20265  * Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the error state.
20266  */
20267 struct LDKCResult_FixedPenaltyScorerDecodeErrorZ CResult_FixedPenaltyScorerDecodeErrorZ_err(struct LDKDecodeError e);
20268
20269 /**
20270  * Checks if the given object is currently in the success state
20271  */
20272 bool CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(const struct LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR o);
20273
20274 /**
20275  * Frees any resources used by the CResult_FixedPenaltyScorerDecodeErrorZ.
20276  */
20277 void CResult_FixedPenaltyScorerDecodeErrorZ_free(struct LDKCResult_FixedPenaltyScorerDecodeErrorZ _res);
20278
20279 /**
20280  * Creates a new CResult_FixedPenaltyScorerDecodeErrorZ which has the same data as `orig`
20281  * but with all dynamically-allocated buffers duplicated in new buffers.
20282  */
20283 struct LDKCResult_FixedPenaltyScorerDecodeErrorZ CResult_FixedPenaltyScorerDecodeErrorZ_clone(const struct LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR orig);
20284
20285 /**
20286  * Frees the buffer pointed to by `data` if `datalen` is non-0.
20287  */
20288 void CVec_NodeIdZ_free(struct LDKCVec_NodeIdZ _res);
20289
20290 /**
20291  * Creates a new tuple which has the same data as `orig`
20292  * but with all dynamically-allocated buffers duplicated in new buffers.
20293  */
20294 struct LDKC2Tuple_u64u64Z C2Tuple_u64u64Z_clone(const struct LDKC2Tuple_u64u64Z *NONNULL_PTR orig);
20295
20296 /**
20297  * Creates a new C2Tuple_u64u64Z from the contained elements.
20298  */
20299 struct LDKC2Tuple_u64u64Z C2Tuple_u64u64Z_new(uint64_t a, uint64_t b);
20300
20301 /**
20302  * Frees any resources used by the C2Tuple_u64u64Z.
20303  */
20304 void C2Tuple_u64u64Z_free(struct LDKC2Tuple_u64u64Z _res);
20305
20306 /**
20307  * Constructs a new COption_C2Tuple_u64u64ZZ containing a crate::c_types::derived::C2Tuple_u64u64Z
20308  */
20309 struct LDKCOption_C2Tuple_u64u64ZZ COption_C2Tuple_u64u64ZZ_some(struct LDKC2Tuple_u64u64Z o);
20310
20311 /**
20312  * Constructs a new COption_C2Tuple_u64u64ZZ containing nothing
20313  */
20314 struct LDKCOption_C2Tuple_u64u64ZZ COption_C2Tuple_u64u64ZZ_none(void);
20315
20316 /**
20317  * Frees any resources associated with the crate::c_types::derived::C2Tuple_u64u64Z, if we are in the Some state
20318  */
20319 void COption_C2Tuple_u64u64ZZ_free(struct LDKCOption_C2Tuple_u64u64ZZ _res);
20320
20321 /**
20322  * Creates a new COption_C2Tuple_u64u64ZZ which has the same data as `orig`
20323  * but with all dynamically-allocated buffers duplicated in new buffers.
20324  */
20325 struct LDKCOption_C2Tuple_u64u64ZZ COption_C2Tuple_u64u64ZZ_clone(const struct LDKCOption_C2Tuple_u64u64ZZ *NONNULL_PTR orig);
20326
20327 /**
20328  * Creates a new tuple which has the same data as `orig`
20329  * but with all dynamically-allocated buffers duplicated in new buffers.
20330  */
20331 struct LDKC2Tuple_Z C2Tuple_Z_clone(const struct LDKC2Tuple_Z *NONNULL_PTR orig);
20332
20333 /**
20334  * Creates a new C2Tuple_Z from the contained elements.
20335  */
20336 struct LDKC2Tuple_Z C2Tuple_Z_new(struct LDKEightU16s a, struct LDKEightU16s b);
20337
20338 /**
20339  * Frees any resources used by the C2Tuple_Z.
20340  */
20341 void C2Tuple_Z_free(struct LDKC2Tuple_Z _res);
20342
20343 /**
20344  * Creates a new tuple which has the same data as `orig`
20345  * but with all dynamically-allocated buffers duplicated in new buffers.
20346  */
20347 struct LDKC2Tuple__u168_u168Z C2Tuple__u168_u168Z_clone(const struct LDKC2Tuple__u168_u168Z *NONNULL_PTR orig);
20348
20349 /**
20350  * Creates a new C2Tuple__u168_u168Z from the contained elements.
20351  */
20352 struct LDKC2Tuple__u168_u168Z C2Tuple__u168_u168Z_new(struct LDKEightU16s a, struct LDKEightU16s b);
20353
20354 /**
20355  * Frees any resources used by the C2Tuple__u168_u168Z.
20356  */
20357 void C2Tuple__u168_u168Z_free(struct LDKC2Tuple__u168_u168Z _res);
20358
20359 /**
20360  * Constructs a new COption_C2Tuple_EightU16sEightU16sZZ containing a crate::c_types::derived::C2Tuple__u168_u168Z
20361  */
20362 struct LDKCOption_C2Tuple_EightU16sEightU16sZZ COption_C2Tuple_EightU16sEightU16sZZ_some(struct LDKC2Tuple__u168_u168Z o);
20363
20364 /**
20365  * Constructs a new COption_C2Tuple_EightU16sEightU16sZZ containing nothing
20366  */
20367 struct LDKCOption_C2Tuple_EightU16sEightU16sZZ COption_C2Tuple_EightU16sEightU16sZZ_none(void);
20368
20369 /**
20370  * Frees any resources associated with the crate::c_types::derived::C2Tuple__u168_u168Z, if we are in the Some state
20371  */
20372 void COption_C2Tuple_EightU16sEightU16sZZ_free(struct LDKCOption_C2Tuple_EightU16sEightU16sZZ _res);
20373
20374 /**
20375  * Creates a new COption_C2Tuple_EightU16sEightU16sZZ which has the same data as `orig`
20376  * but with all dynamically-allocated buffers duplicated in new buffers.
20377  */
20378 struct LDKCOption_C2Tuple_EightU16sEightU16sZZ COption_C2Tuple_EightU16sEightU16sZZ_clone(const struct LDKCOption_C2Tuple_EightU16sEightU16sZZ *NONNULL_PTR orig);
20379
20380 /**
20381  * Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the success state.
20382  */
20383 struct LDKCResult_ProbabilisticScorerDecodeErrorZ CResult_ProbabilisticScorerDecodeErrorZ_ok(struct LDKProbabilisticScorer o);
20384
20385 /**
20386  * Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the error state.
20387  */
20388 struct LDKCResult_ProbabilisticScorerDecodeErrorZ CResult_ProbabilisticScorerDecodeErrorZ_err(struct LDKDecodeError e);
20389
20390 /**
20391  * Checks if the given object is currently in the success state
20392  */
20393 bool CResult_ProbabilisticScorerDecodeErrorZ_is_ok(const struct LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR o);
20394
20395 /**
20396  * Frees any resources used by the CResult_ProbabilisticScorerDecodeErrorZ.
20397  */
20398 void CResult_ProbabilisticScorerDecodeErrorZ_free(struct LDKCResult_ProbabilisticScorerDecodeErrorZ _res);
20399
20400 /**
20401  * Creates a new tuple which has the same data as `orig`
20402  * but with all dynamically-allocated buffers duplicated in new buffers.
20403  */
20404 struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_clone(const struct LDKC2Tuple_usizeTransactionZ *NONNULL_PTR orig);
20405
20406 /**
20407  * Creates a new C2Tuple_usizeTransactionZ from the contained elements.
20408  */
20409 struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_new(uintptr_t a, struct LDKTransaction b);
20410
20411 /**
20412  * Frees any resources used by the C2Tuple_usizeTransactionZ.
20413  */
20414 void C2Tuple_usizeTransactionZ_free(struct LDKC2Tuple_usizeTransactionZ _res);
20415
20416 /**
20417  * Frees the buffer pointed to by `data` if `datalen` is non-0.
20418  */
20419 void CVec_C2Tuple_usizeTransactionZZ_free(struct LDKCVec_C2Tuple_usizeTransactionZZ _res);
20420
20421 /**
20422  * Constructs a new COption_BlockHashZ containing a crate::c_types::ThirtyTwoBytes
20423  */
20424 struct LDKCOption_BlockHashZ COption_BlockHashZ_some(struct LDKThirtyTwoBytes o);
20425
20426 /**
20427  * Constructs a new COption_BlockHashZ containing nothing
20428  */
20429 struct LDKCOption_BlockHashZ COption_BlockHashZ_none(void);
20430
20431 /**
20432  * Frees any resources associated with the crate::c_types::ThirtyTwoBytes, if we are in the Some state
20433  */
20434 void COption_BlockHashZ_free(struct LDKCOption_BlockHashZ _res);
20435
20436 /**
20437  * Creates a new COption_BlockHashZ which has the same data as `orig`
20438  * but with all dynamically-allocated buffers duplicated in new buffers.
20439  */
20440 struct LDKCOption_BlockHashZ COption_BlockHashZ_clone(const struct LDKCOption_BlockHashZ *NONNULL_PTR orig);
20441
20442 /**
20443  * Creates a new tuple which has the same data as `orig`
20444  * but with all dynamically-allocated buffers duplicated in new buffers.
20445  */
20446 struct LDKC2Tuple_TxidCOption_BlockHashZZ C2Tuple_TxidCOption_BlockHashZZ_clone(const struct LDKC2Tuple_TxidCOption_BlockHashZZ *NONNULL_PTR orig);
20447
20448 /**
20449  * Creates a new C2Tuple_TxidCOption_BlockHashZZ from the contained elements.
20450  */
20451 struct LDKC2Tuple_TxidCOption_BlockHashZZ C2Tuple_TxidCOption_BlockHashZZ_new(struct LDKThirtyTwoBytes a, struct LDKCOption_BlockHashZ b);
20452
20453 /**
20454  * Frees any resources used by the C2Tuple_TxidCOption_BlockHashZZ.
20455  */
20456 void C2Tuple_TxidCOption_BlockHashZZ_free(struct LDKC2Tuple_TxidCOption_BlockHashZZ _res);
20457
20458 /**
20459  * Frees the buffer pointed to by `data` if `datalen` is non-0.
20460  */
20461 void CVec_C2Tuple_TxidCOption_BlockHashZZZ_free(struct LDKCVec_C2Tuple_TxidCOption_BlockHashZZZ _res);
20462
20463 /**
20464  * Frees the buffer pointed to by `data` if `datalen` is non-0.
20465  */
20466 void CVec_MonitorEventZ_free(struct LDKCVec_MonitorEventZ _res);
20467
20468 /**
20469  * Creates a new tuple which has the same data as `orig`
20470  * but with all dynamically-allocated buffers duplicated in new buffers.
20471  */
20472 struct LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(const struct LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR orig);
20473
20474 /**
20475  * Creates a new C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ from the contained elements.
20476  */
20477 struct LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(struct LDKOutPoint a, struct LDKCVec_MonitorEventZ b, struct LDKPublicKey c);
20478
20479 /**
20480  * Frees any resources used by the C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ.
20481  */
20482 void C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(struct LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res);
20483
20484 /**
20485  * Frees the buffer pointed to by `data` if `datalen` is non-0.
20486  */
20487 void CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(struct LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ _res);
20488
20489 /**
20490  * Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
20491  */
20492 struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_ok(struct LDKInitFeatures o);
20493
20494 /**
20495  * Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
20496  */
20497 struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
20498
20499 /**
20500  * Checks if the given object is currently in the success state
20501  */
20502 bool CResult_InitFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR o);
20503
20504 /**
20505  * Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
20506  */
20507 void CResult_InitFeaturesDecodeErrorZ_free(struct LDKCResult_InitFeaturesDecodeErrorZ _res);
20508
20509 /**
20510  * Creates a new CResult_InitFeaturesDecodeErrorZ which has the same data as `orig`
20511  * but with all dynamically-allocated buffers duplicated in new buffers.
20512  */
20513 struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_clone(const struct LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR orig);
20514
20515 /**
20516  * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
20517  */
20518 struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_ok(struct LDKChannelFeatures o);
20519
20520 /**
20521  * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
20522  */
20523 struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
20524
20525 /**
20526  * Checks if the given object is currently in the success state
20527  */
20528 bool CResult_ChannelFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR o);
20529
20530 /**
20531  * Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
20532  */
20533 void CResult_ChannelFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelFeaturesDecodeErrorZ _res);
20534
20535 /**
20536  * Creates a new CResult_ChannelFeaturesDecodeErrorZ which has the same data as `orig`
20537  * but with all dynamically-allocated buffers duplicated in new buffers.
20538  */
20539 struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_clone(const struct LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR orig);
20540
20541 /**
20542  * Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
20543  */
20544 struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_ok(struct LDKNodeFeatures o);
20545
20546 /**
20547  * Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
20548  */
20549 struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
20550
20551 /**
20552  * Checks if the given object is currently in the success state
20553  */
20554 bool CResult_NodeFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR o);
20555
20556 /**
20557  * Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
20558  */
20559 void CResult_NodeFeaturesDecodeErrorZ_free(struct LDKCResult_NodeFeaturesDecodeErrorZ _res);
20560
20561 /**
20562  * Creates a new CResult_NodeFeaturesDecodeErrorZ which has the same data as `orig`
20563  * but with all dynamically-allocated buffers duplicated in new buffers.
20564  */
20565 struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_clone(const struct LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR orig);
20566
20567 /**
20568  * Creates a new CResult_Bolt11InvoiceFeaturesDecodeErrorZ in the success state.
20569  */
20570 struct LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ CResult_Bolt11InvoiceFeaturesDecodeErrorZ_ok(struct LDKBolt11InvoiceFeatures o);
20571
20572 /**
20573  * Creates a new CResult_Bolt11InvoiceFeaturesDecodeErrorZ in the error state.
20574  */
20575 struct LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ CResult_Bolt11InvoiceFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
20576
20577 /**
20578  * Checks if the given object is currently in the success state
20579  */
20580 bool CResult_Bolt11InvoiceFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR o);
20581
20582 /**
20583  * Frees any resources used by the CResult_Bolt11InvoiceFeaturesDecodeErrorZ.
20584  */
20585 void CResult_Bolt11InvoiceFeaturesDecodeErrorZ_free(struct LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ _res);
20586
20587 /**
20588  * Creates a new CResult_Bolt11InvoiceFeaturesDecodeErrorZ which has the same data as `orig`
20589  * but with all dynamically-allocated buffers duplicated in new buffers.
20590  */
20591 struct LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(const struct LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR orig);
20592
20593 /**
20594  * Creates a new CResult_Bolt12InvoiceFeaturesDecodeErrorZ in the success state.
20595  */
20596 struct LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ CResult_Bolt12InvoiceFeaturesDecodeErrorZ_ok(struct LDKBolt12InvoiceFeatures o);
20597
20598 /**
20599  * Creates a new CResult_Bolt12InvoiceFeaturesDecodeErrorZ in the error state.
20600  */
20601 struct LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ CResult_Bolt12InvoiceFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
20602
20603 /**
20604  * Checks if the given object is currently in the success state
20605  */
20606 bool CResult_Bolt12InvoiceFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR o);
20607
20608 /**
20609  * Frees any resources used by the CResult_Bolt12InvoiceFeaturesDecodeErrorZ.
20610  */
20611 void CResult_Bolt12InvoiceFeaturesDecodeErrorZ_free(struct LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ _res);
20612
20613 /**
20614  * Creates a new CResult_Bolt12InvoiceFeaturesDecodeErrorZ which has the same data as `orig`
20615  * but with all dynamically-allocated buffers duplicated in new buffers.
20616  */
20617 struct LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(const struct LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR orig);
20618
20619 /**
20620  * Creates a new CResult_BlindedHopFeaturesDecodeErrorZ in the success state.
20621  */
20622 struct LDKCResult_BlindedHopFeaturesDecodeErrorZ CResult_BlindedHopFeaturesDecodeErrorZ_ok(struct LDKBlindedHopFeatures o);
20623
20624 /**
20625  * Creates a new CResult_BlindedHopFeaturesDecodeErrorZ in the error state.
20626  */
20627 struct LDKCResult_BlindedHopFeaturesDecodeErrorZ CResult_BlindedHopFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
20628
20629 /**
20630  * Checks if the given object is currently in the success state
20631  */
20632 bool CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR o);
20633
20634 /**
20635  * Frees any resources used by the CResult_BlindedHopFeaturesDecodeErrorZ.
20636  */
20637 void CResult_BlindedHopFeaturesDecodeErrorZ_free(struct LDKCResult_BlindedHopFeaturesDecodeErrorZ _res);
20638
20639 /**
20640  * Creates a new CResult_BlindedHopFeaturesDecodeErrorZ which has the same data as `orig`
20641  * but with all dynamically-allocated buffers duplicated in new buffers.
20642  */
20643 struct LDKCResult_BlindedHopFeaturesDecodeErrorZ CResult_BlindedHopFeaturesDecodeErrorZ_clone(const struct LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR orig);
20644
20645 /**
20646  * Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the success state.
20647  */
20648 struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_ok(struct LDKChannelTypeFeatures o);
20649
20650 /**
20651  * Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the error state.
20652  */
20653 struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
20654
20655 /**
20656  * Checks if the given object is currently in the success state
20657  */
20658 bool CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR o);
20659
20660 /**
20661  * Frees any resources used by the CResult_ChannelTypeFeaturesDecodeErrorZ.
20662  */
20663 void CResult_ChannelTypeFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res);
20664
20665 /**
20666  * Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ which has the same data as `orig`
20667  * but with all dynamically-allocated buffers duplicated in new buffers.
20668  */
20669 struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_clone(const struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR orig);
20670
20671 /**
20672  * Frees the buffer pointed to by `data` if `datalen` is non-0.
20673  */
20674 void CVec_ChainHashZ_free(struct LDKCVec_ChainHashZ _res);
20675
20676 /**
20677  * Creates a new CResult_OfferBolt12ParseErrorZ in the success state.
20678  */
20679 struct LDKCResult_OfferBolt12ParseErrorZ CResult_OfferBolt12ParseErrorZ_ok(struct LDKOffer o);
20680
20681 /**
20682  * Creates a new CResult_OfferBolt12ParseErrorZ in the error state.
20683  */
20684 struct LDKCResult_OfferBolt12ParseErrorZ CResult_OfferBolt12ParseErrorZ_err(struct LDKBolt12ParseError e);
20685
20686 /**
20687  * Checks if the given object is currently in the success state
20688  */
20689 bool CResult_OfferBolt12ParseErrorZ_is_ok(const struct LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR o);
20690
20691 /**
20692  * Frees any resources used by the CResult_OfferBolt12ParseErrorZ.
20693  */
20694 void CResult_OfferBolt12ParseErrorZ_free(struct LDKCResult_OfferBolt12ParseErrorZ _res);
20695
20696 /**
20697  * Creates a new CResult_OfferBolt12ParseErrorZ which has the same data as `orig`
20698  * but with all dynamically-allocated buffers duplicated in new buffers.
20699  */
20700 struct LDKCResult_OfferBolt12ParseErrorZ CResult_OfferBolt12ParseErrorZ_clone(const struct LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR orig);
20701
20702 /**
20703  * Creates a new CResult_PublicKeyErrorZ in the success state.
20704  */
20705 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_ok(struct LDKPublicKey o);
20706
20707 /**
20708  * Creates a new CResult_PublicKeyErrorZ in the error state.
20709  */
20710 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_err(enum LDKSecp256k1Error e);
20711
20712 /**
20713  * Checks if the given object is currently in the success state
20714  */
20715 bool CResult_PublicKeyErrorZ_is_ok(const struct LDKCResult_PublicKeyErrorZ *NONNULL_PTR o);
20716
20717 /**
20718  * Frees any resources used by the CResult_PublicKeyErrorZ.
20719  */
20720 void CResult_PublicKeyErrorZ_free(struct LDKCResult_PublicKeyErrorZ _res);
20721
20722 /**
20723  * Creates a new CResult_PublicKeyErrorZ which has the same data as `orig`
20724  * but with all dynamically-allocated buffers duplicated in new buffers.
20725  */
20726 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_clone(const struct LDKCResult_PublicKeyErrorZ *NONNULL_PTR orig);
20727
20728 /**
20729  * Creates a new CResult_NodeIdDecodeErrorZ in the success state.
20730  */
20731 struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_ok(struct LDKNodeId o);
20732
20733 /**
20734  * Creates a new CResult_NodeIdDecodeErrorZ in the error state.
20735  */
20736 struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_err(struct LDKDecodeError e);
20737
20738 /**
20739  * Checks if the given object is currently in the success state
20740  */
20741 bool CResult_NodeIdDecodeErrorZ_is_ok(const struct LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR o);
20742
20743 /**
20744  * Frees any resources used by the CResult_NodeIdDecodeErrorZ.
20745  */
20746 void CResult_NodeIdDecodeErrorZ_free(struct LDKCResult_NodeIdDecodeErrorZ _res);
20747
20748 /**
20749  * Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig`
20750  * but with all dynamically-allocated buffers duplicated in new buffers.
20751  */
20752 struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_clone(const struct LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR orig);
20753
20754 /**
20755  * Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::gossip::NetworkUpdate
20756  */
20757 struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_some(struct LDKNetworkUpdate o);
20758
20759 /**
20760  * Constructs a new COption_NetworkUpdateZ containing nothing
20761  */
20762 struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_none(void);
20763
20764 /**
20765  * Frees any resources associated with the crate::lightning::routing::gossip::NetworkUpdate, if we are in the Some state
20766  */
20767 void COption_NetworkUpdateZ_free(struct LDKCOption_NetworkUpdateZ _res);
20768
20769 /**
20770  * Creates a new COption_NetworkUpdateZ which has the same data as `orig`
20771  * but with all dynamically-allocated buffers duplicated in new buffers.
20772  */
20773 struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_clone(const struct LDKCOption_NetworkUpdateZ *NONNULL_PTR orig);
20774
20775 /**
20776  * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state.
20777  */
20778 struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_ok(struct LDKCOption_NetworkUpdateZ o);
20779
20780 /**
20781  * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state.
20782  */
20783 struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_err(struct LDKDecodeError e);
20784
20785 /**
20786  * Checks if the given object is currently in the success state
20787  */
20788 bool CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(const struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR o);
20789
20790 /**
20791  * Frees any resources used by the CResult_COption_NetworkUpdateZDecodeErrorZ.
20792  */
20793 void CResult_COption_NetworkUpdateZDecodeErrorZ_free(struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res);
20794
20795 /**
20796  * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ which has the same data as `orig`
20797  * but with all dynamically-allocated buffers duplicated in new buffers.
20798  */
20799 struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_clone(const struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR orig);
20800
20801 /**
20802  * Constructs a new COption_UtxoLookupZ containing a crate::lightning::routing::utxo::UtxoLookup
20803  */
20804 struct LDKCOption_UtxoLookupZ COption_UtxoLookupZ_some(struct LDKUtxoLookup o);
20805
20806 /**
20807  * Constructs a new COption_UtxoLookupZ containing nothing
20808  */
20809 struct LDKCOption_UtxoLookupZ COption_UtxoLookupZ_none(void);
20810
20811 /**
20812  * Frees any resources associated with the crate::lightning::routing::utxo::UtxoLookup, if we are in the Some state
20813  */
20814 void COption_UtxoLookupZ_free(struct LDKCOption_UtxoLookupZ _res);
20815
20816 /**
20817  * Creates a new CResult_NoneLightningErrorZ in the success state.
20818  */
20819 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_ok(void);
20820
20821 /**
20822  * Creates a new CResult_NoneLightningErrorZ in the error state.
20823  */
20824 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_err(struct LDKLightningError e);
20825
20826 /**
20827  * Checks if the given object is currently in the success state
20828  */
20829 bool CResult_NoneLightningErrorZ_is_ok(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR o);
20830
20831 /**
20832  * Frees any resources used by the CResult_NoneLightningErrorZ.
20833  */
20834 void CResult_NoneLightningErrorZ_free(struct LDKCResult_NoneLightningErrorZ _res);
20835
20836 /**
20837  * Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
20838  * but with all dynamically-allocated buffers duplicated in new buffers.
20839  */
20840 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_clone(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR orig);
20841
20842 /**
20843  * Creates a new CResult_boolLightningErrorZ in the success state.
20844  */
20845 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_ok(bool o);
20846
20847 /**
20848  * Creates a new CResult_boolLightningErrorZ in the error state.
20849  */
20850 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_err(struct LDKLightningError e);
20851
20852 /**
20853  * Checks if the given object is currently in the success state
20854  */
20855 bool CResult_boolLightningErrorZ_is_ok(const struct LDKCResult_boolLightningErrorZ *NONNULL_PTR o);
20856
20857 /**
20858  * Frees any resources used by the CResult_boolLightningErrorZ.
20859  */
20860 void CResult_boolLightningErrorZ_free(struct LDKCResult_boolLightningErrorZ _res);
20861
20862 /**
20863  * Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
20864  * but with all dynamically-allocated buffers duplicated in new buffers.
20865  */
20866 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_clone(const struct LDKCResult_boolLightningErrorZ *NONNULL_PTR orig);
20867
20868 /**
20869  * Creates a new tuple which has the same data as `orig`
20870  * but with all dynamically-allocated buffers duplicated in new buffers.
20871  */
20872 struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(const struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR orig);
20873
20874 /**
20875  * Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
20876  */
20877 struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(struct LDKChannelAnnouncement a, struct LDKChannelUpdate b, struct LDKChannelUpdate c);
20878
20879 /**
20880  * Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
20881  */
20882 void C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res);
20883
20884 /**
20885  * Constructs a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ containing a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ
20886  */
20887 struct LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ o);
20888
20889 /**
20890  * Constructs a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ containing nothing
20891  */
20892 struct LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none(void);
20893
20894 /**
20895  * Frees any resources associated with the crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ, if we are in the Some state
20896  */
20897 void COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(struct LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res);
20898
20899 /**
20900  * Creates a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ which has the same data as `orig`
20901  * but with all dynamically-allocated buffers duplicated in new buffers.
20902  */
20903 struct LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(const struct LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *NONNULL_PTR orig);
20904
20905 /**
20906  * Frees the buffer pointed to by `data` if `datalen` is non-0.
20907  */
20908 void CVec_MessageSendEventZ_free(struct LDKCVec_MessageSendEventZ _res);
20909
20910 /**
20911  * Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the success state.
20912  */
20913 struct LDKCResult_ChannelUpdateInfoDecodeErrorZ CResult_ChannelUpdateInfoDecodeErrorZ_ok(struct LDKChannelUpdateInfo o);
20914
20915 /**
20916  * Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the error state.
20917  */
20918 struct LDKCResult_ChannelUpdateInfoDecodeErrorZ CResult_ChannelUpdateInfoDecodeErrorZ_err(struct LDKDecodeError e);
20919
20920 /**
20921  * Checks if the given object is currently in the success state
20922  */
20923 bool CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(const struct LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR o);
20924
20925 /**
20926  * Frees any resources used by the CResult_ChannelUpdateInfoDecodeErrorZ.
20927  */
20928 void CResult_ChannelUpdateInfoDecodeErrorZ_free(struct LDKCResult_ChannelUpdateInfoDecodeErrorZ _res);
20929
20930 /**
20931  * Creates a new CResult_ChannelUpdateInfoDecodeErrorZ which has the same data as `orig`
20932  * but with all dynamically-allocated buffers duplicated in new buffers.
20933  */
20934 struct LDKCResult_ChannelUpdateInfoDecodeErrorZ CResult_ChannelUpdateInfoDecodeErrorZ_clone(const struct LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR orig);
20935
20936 /**
20937  * Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
20938  */
20939 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_ok(struct LDKChannelInfo o);
20940
20941 /**
20942  * Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
20943  */
20944 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_err(struct LDKDecodeError e);
20945
20946 /**
20947  * Checks if the given object is currently in the success state
20948  */
20949 bool CResult_ChannelInfoDecodeErrorZ_is_ok(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR o);
20950
20951 /**
20952  * Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
20953  */
20954 void CResult_ChannelInfoDecodeErrorZ_free(struct LDKCResult_ChannelInfoDecodeErrorZ _res);
20955
20956 /**
20957  * Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
20958  * but with all dynamically-allocated buffers duplicated in new buffers.
20959  */
20960 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_clone(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR orig);
20961
20962 /**
20963  * Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
20964  */
20965 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_ok(struct LDKRoutingFees o);
20966
20967 /**
20968  * Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
20969  */
20970 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_err(struct LDKDecodeError e);
20971
20972 /**
20973  * Checks if the given object is currently in the success state
20974  */
20975 bool CResult_RoutingFeesDecodeErrorZ_is_ok(const struct LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR o);
20976
20977 /**
20978  * Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
20979  */
20980 void CResult_RoutingFeesDecodeErrorZ_free(struct LDKCResult_RoutingFeesDecodeErrorZ _res);
20981
20982 /**
20983  * Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
20984  * but with all dynamically-allocated buffers duplicated in new buffers.
20985  */
20986 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_clone(const struct LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR orig);
20987
20988 /**
20989  * Frees the buffer pointed to by `data` if `datalen` is non-0.
20990  */
20991 void CVec_NetAddressZ_free(struct LDKCVec_NetAddressZ _res);
20992
20993 /**
20994  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
20995  */
20996 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_ok(struct LDKNodeAnnouncementInfo o);
20997
20998 /**
20999  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
21000  */
21001 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_err(struct LDKDecodeError e);
21002
21003 /**
21004  * Checks if the given object is currently in the success state
21005  */
21006 bool CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(const struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR o);
21007
21008 /**
21009  * Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
21010  */
21011 void CResult_NodeAnnouncementInfoDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res);
21012
21013 /**
21014  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
21015  * but with all dynamically-allocated buffers duplicated in new buffers.
21016  */
21017 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR orig);
21018
21019 /**
21020  * Creates a new CResult_NodeAliasDecodeErrorZ in the success state.
21021  */
21022 struct LDKCResult_NodeAliasDecodeErrorZ CResult_NodeAliasDecodeErrorZ_ok(struct LDKNodeAlias o);
21023
21024 /**
21025  * Creates a new CResult_NodeAliasDecodeErrorZ in the error state.
21026  */
21027 struct LDKCResult_NodeAliasDecodeErrorZ CResult_NodeAliasDecodeErrorZ_err(struct LDKDecodeError e);
21028
21029 /**
21030  * Checks if the given object is currently in the success state
21031  */
21032 bool CResult_NodeAliasDecodeErrorZ_is_ok(const struct LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR o);
21033
21034 /**
21035  * Frees any resources used by the CResult_NodeAliasDecodeErrorZ.
21036  */
21037 void CResult_NodeAliasDecodeErrorZ_free(struct LDKCResult_NodeAliasDecodeErrorZ _res);
21038
21039 /**
21040  * Creates a new CResult_NodeAliasDecodeErrorZ which has the same data as `orig`
21041  * but with all dynamically-allocated buffers duplicated in new buffers.
21042  */
21043 struct LDKCResult_NodeAliasDecodeErrorZ CResult_NodeAliasDecodeErrorZ_clone(const struct LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR orig);
21044
21045 /**
21046  * Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
21047  */
21048 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_ok(struct LDKNodeInfo o);
21049
21050 /**
21051  * Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
21052  */
21053 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_err(struct LDKDecodeError e);
21054
21055 /**
21056  * Checks if the given object is currently in the success state
21057  */
21058 bool CResult_NodeInfoDecodeErrorZ_is_ok(const struct LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR o);
21059
21060 /**
21061  * Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
21062  */
21063 void CResult_NodeInfoDecodeErrorZ_free(struct LDKCResult_NodeInfoDecodeErrorZ _res);
21064
21065 /**
21066  * Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
21067  * but with all dynamically-allocated buffers duplicated in new buffers.
21068  */
21069 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_clone(const struct LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR orig);
21070
21071 /**
21072  * Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
21073  */
21074 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_ok(struct LDKNetworkGraph o);
21075
21076 /**
21077  * Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
21078  */
21079 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_err(struct LDKDecodeError e);
21080
21081 /**
21082  * Checks if the given object is currently in the success state
21083  */
21084 bool CResult_NetworkGraphDecodeErrorZ_is_ok(const struct LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR o);
21085
21086 /**
21087  * Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
21088  */
21089 void CResult_NetworkGraphDecodeErrorZ_free(struct LDKCResult_NetworkGraphDecodeErrorZ _res);
21090
21091 /**
21092  * Constructs a new COption_CVec_NetAddressZZ containing a crate::c_types::derived::CVec_NetAddressZ
21093  */
21094 struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_some(struct LDKCVec_NetAddressZ o);
21095
21096 /**
21097  * Constructs a new COption_CVec_NetAddressZZ containing nothing
21098  */
21099 struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_none(void);
21100
21101 /**
21102  * Frees any resources associated with the crate::c_types::derived::CVec_NetAddressZ, if we are in the Some state
21103  */
21104 void COption_CVec_NetAddressZZ_free(struct LDKCOption_CVec_NetAddressZZ _res);
21105
21106 /**
21107  * Creates a new COption_CVec_NetAddressZZ which has the same data as `orig`
21108  * but with all dynamically-allocated buffers duplicated in new buffers.
21109  */
21110 struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_clone(const struct LDKCOption_CVec_NetAddressZZ *NONNULL_PTR orig);
21111
21112 /**
21113  * Constructs a new COption_PaymentPreimageZ containing a crate::c_types::ThirtyTwoBytes
21114  */
21115 struct LDKCOption_PaymentPreimageZ COption_PaymentPreimageZ_some(struct LDKThirtyTwoBytes o);
21116
21117 /**
21118  * Constructs a new COption_PaymentPreimageZ containing nothing
21119  */
21120 struct LDKCOption_PaymentPreimageZ COption_PaymentPreimageZ_none(void);
21121
21122 /**
21123  * Frees any resources associated with the crate::c_types::ThirtyTwoBytes, if we are in the Some state
21124  */
21125 void COption_PaymentPreimageZ_free(struct LDKCOption_PaymentPreimageZ _res);
21126
21127 /**
21128  * Creates a new COption_PaymentPreimageZ which has the same data as `orig`
21129  * but with all dynamically-allocated buffers duplicated in new buffers.
21130  */
21131 struct LDKCOption_PaymentPreimageZ COption_PaymentPreimageZ_clone(const struct LDKCOption_PaymentPreimageZ *NONNULL_PTR orig);
21132
21133 /**
21134  * Frees the buffer pointed to by `data` if `datalen` is non-0.
21135  */
21136 void CVec_HTLCOutputInCommitmentZ_free(struct LDKCVec_HTLCOutputInCommitmentZ _res);
21137
21138 /**
21139  * Frees the buffer pointed to by `data` if `datalen` is non-0.
21140  */
21141 void CVec_HTLCDescriptorZ_free(struct LDKCVec_HTLCDescriptorZ _res);
21142
21143 /**
21144  * Frees the buffer pointed to by `data` if `datalen` is non-0.
21145  */
21146 void CVec_UtxoZ_free(struct LDKCVec_UtxoZ _res);
21147
21148 /**
21149  * Constructs a new COption_TxOutZ containing a crate::c_types::TxOut
21150  */
21151 struct LDKCOption_TxOutZ COption_TxOutZ_some(struct LDKTxOut o);
21152
21153 /**
21154  * Constructs a new COption_TxOutZ containing nothing
21155  */
21156 struct LDKCOption_TxOutZ COption_TxOutZ_none(void);
21157
21158 /**
21159  * Frees any resources associated with the crate::c_types::TxOut, if we are in the Some state
21160  */
21161 void COption_TxOutZ_free(struct LDKCOption_TxOutZ _res);
21162
21163 /**
21164  * Creates a new COption_TxOutZ which has the same data as `orig`
21165  * but with all dynamically-allocated buffers duplicated in new buffers.
21166  */
21167 struct LDKCOption_TxOutZ COption_TxOutZ_clone(const struct LDKCOption_TxOutZ *NONNULL_PTR orig);
21168
21169 /**
21170  * Frees the buffer pointed to by `data` if `datalen` is non-0.
21171  */
21172 void CVec_InputZ_free(struct LDKCVec_InputZ _res);
21173
21174 /**
21175  * Creates a new CResult_CoinSelectionNoneZ in the success state.
21176  */
21177 struct LDKCResult_CoinSelectionNoneZ CResult_CoinSelectionNoneZ_ok(struct LDKCoinSelection o);
21178
21179 /**
21180  * Creates a new CResult_CoinSelectionNoneZ in the error state.
21181  */
21182 struct LDKCResult_CoinSelectionNoneZ CResult_CoinSelectionNoneZ_err(void);
21183
21184 /**
21185  * Checks if the given object is currently in the success state
21186  */
21187 bool CResult_CoinSelectionNoneZ_is_ok(const struct LDKCResult_CoinSelectionNoneZ *NONNULL_PTR o);
21188
21189 /**
21190  * Frees any resources used by the CResult_CoinSelectionNoneZ.
21191  */
21192 void CResult_CoinSelectionNoneZ_free(struct LDKCResult_CoinSelectionNoneZ _res);
21193
21194 /**
21195  * Creates a new CResult_CoinSelectionNoneZ which has the same data as `orig`
21196  * but with all dynamically-allocated buffers duplicated in new buffers.
21197  */
21198 struct LDKCResult_CoinSelectionNoneZ CResult_CoinSelectionNoneZ_clone(const struct LDKCResult_CoinSelectionNoneZ *NONNULL_PTR orig);
21199
21200 /**
21201  * Creates a new CResult_CVec_UtxoZNoneZ in the success state.
21202  */
21203 struct LDKCResult_CVec_UtxoZNoneZ CResult_CVec_UtxoZNoneZ_ok(struct LDKCVec_UtxoZ o);
21204
21205 /**
21206  * Creates a new CResult_CVec_UtxoZNoneZ in the error state.
21207  */
21208 struct LDKCResult_CVec_UtxoZNoneZ CResult_CVec_UtxoZNoneZ_err(void);
21209
21210 /**
21211  * Checks if the given object is currently in the success state
21212  */
21213 bool CResult_CVec_UtxoZNoneZ_is_ok(const struct LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR o);
21214
21215 /**
21216  * Frees any resources used by the CResult_CVec_UtxoZNoneZ.
21217  */
21218 void CResult_CVec_UtxoZNoneZ_free(struct LDKCResult_CVec_UtxoZNoneZ _res);
21219
21220 /**
21221  * Creates a new CResult_CVec_UtxoZNoneZ which has the same data as `orig`
21222  * but with all dynamically-allocated buffers duplicated in new buffers.
21223  */
21224 struct LDKCResult_CVec_UtxoZNoneZ CResult_CVec_UtxoZNoneZ_clone(const struct LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR orig);
21225
21226 /**
21227  * Constructs a new COption_u16Z containing a u16
21228  */
21229 struct LDKCOption_u16Z COption_u16Z_some(uint16_t o);
21230
21231 /**
21232  * Constructs a new COption_u16Z containing nothing
21233  */
21234 struct LDKCOption_u16Z COption_u16Z_none(void);
21235
21236 /**
21237  * Frees any resources associated with the u16, if we are in the Some state
21238  */
21239 void COption_u16Z_free(struct LDKCOption_u16Z _res);
21240
21241 /**
21242  * Creates a new COption_u16Z which has the same data as `orig`
21243  * but with all dynamically-allocated buffers duplicated in new buffers.
21244  */
21245 struct LDKCOption_u16Z COption_u16Z_clone(const struct LDKCOption_u16Z *NONNULL_PTR orig);
21246
21247 /**
21248  * Constructs a new COption_ChannelShutdownStateZ containing a crate::lightning::ln::channelmanager::ChannelShutdownState
21249  */
21250 struct LDKCOption_ChannelShutdownStateZ COption_ChannelShutdownStateZ_some(enum LDKChannelShutdownState o);
21251
21252 /**
21253  * Constructs a new COption_ChannelShutdownStateZ containing nothing
21254  */
21255 struct LDKCOption_ChannelShutdownStateZ COption_ChannelShutdownStateZ_none(void);
21256
21257 /**
21258  * Frees any resources associated with the crate::lightning::ln::channelmanager::ChannelShutdownState, if we are in the Some state
21259  */
21260 void COption_ChannelShutdownStateZ_free(struct LDKCOption_ChannelShutdownStateZ _res);
21261
21262 /**
21263  * Creates a new COption_ChannelShutdownStateZ which has the same data as `orig`
21264  * but with all dynamically-allocated buffers duplicated in new buffers.
21265  */
21266 struct LDKCOption_ChannelShutdownStateZ COption_ChannelShutdownStateZ_clone(const struct LDKCOption_ChannelShutdownStateZ *NONNULL_PTR orig);
21267
21268 /**
21269  * Constructs a new COption_PaymentHashZ containing a crate::c_types::ThirtyTwoBytes
21270  */
21271 struct LDKCOption_PaymentHashZ COption_PaymentHashZ_some(struct LDKThirtyTwoBytes o);
21272
21273 /**
21274  * Constructs a new COption_PaymentHashZ containing nothing
21275  */
21276 struct LDKCOption_PaymentHashZ COption_PaymentHashZ_none(void);
21277
21278 /**
21279  * Frees any resources associated with the crate::c_types::ThirtyTwoBytes, if we are in the Some state
21280  */
21281 void COption_PaymentHashZ_free(struct LDKCOption_PaymentHashZ _res);
21282
21283 /**
21284  * Creates a new COption_PaymentHashZ which has the same data as `orig`
21285  * but with all dynamically-allocated buffers duplicated in new buffers.
21286  */
21287 struct LDKCOption_PaymentHashZ COption_PaymentHashZ_clone(const struct LDKCOption_PaymentHashZ *NONNULL_PTR orig);
21288
21289 /**
21290  * Creates a new CResult__u832APIErrorZ in the success state.
21291  */
21292 struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_ok(struct LDKThirtyTwoBytes o);
21293
21294 /**
21295  * Creates a new CResult__u832APIErrorZ in the error state.
21296  */
21297 struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_err(struct LDKAPIError e);
21298
21299 /**
21300  * Checks if the given object is currently in the success state
21301  */
21302 bool CResult__u832APIErrorZ_is_ok(const struct LDKCResult__u832APIErrorZ *NONNULL_PTR o);
21303
21304 /**
21305  * Frees any resources used by the CResult__u832APIErrorZ.
21306  */
21307 void CResult__u832APIErrorZ_free(struct LDKCResult__u832APIErrorZ _res);
21308
21309 /**
21310  * Creates a new CResult__u832APIErrorZ which has the same data as `orig`
21311  * but with all dynamically-allocated buffers duplicated in new buffers.
21312  */
21313 struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_clone(const struct LDKCResult__u832APIErrorZ *NONNULL_PTR orig);
21314
21315 /**
21316  * Frees the buffer pointed to by `data` if `datalen` is non-0.
21317  */
21318 void CVec_RecentPaymentDetailsZ_free(struct LDKCVec_RecentPaymentDetailsZ _res);
21319
21320 /**
21321  * Creates a new CResult_NonePaymentSendFailureZ in the success state.
21322  */
21323 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_ok(void);
21324
21325 /**
21326  * Creates a new CResult_NonePaymentSendFailureZ in the error state.
21327  */
21328 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
21329
21330 /**
21331  * Checks if the given object is currently in the success state
21332  */
21333 bool CResult_NonePaymentSendFailureZ_is_ok(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR o);
21334
21335 /**
21336  * Frees any resources used by the CResult_NonePaymentSendFailureZ.
21337  */
21338 void CResult_NonePaymentSendFailureZ_free(struct LDKCResult_NonePaymentSendFailureZ _res);
21339
21340 /**
21341  * Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
21342  * but with all dynamically-allocated buffers duplicated in new buffers.
21343  */
21344 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_clone(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR orig);
21345
21346 /**
21347  * Creates a new CResult_NoneRetryableSendFailureZ in the success state.
21348  */
21349 struct LDKCResult_NoneRetryableSendFailureZ CResult_NoneRetryableSendFailureZ_ok(void);
21350
21351 /**
21352  * Creates a new CResult_NoneRetryableSendFailureZ in the error state.
21353  */
21354 struct LDKCResult_NoneRetryableSendFailureZ CResult_NoneRetryableSendFailureZ_err(enum LDKRetryableSendFailure e);
21355
21356 /**
21357  * Checks if the given object is currently in the success state
21358  */
21359 bool CResult_NoneRetryableSendFailureZ_is_ok(const struct LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR o);
21360
21361 /**
21362  * Frees any resources used by the CResult_NoneRetryableSendFailureZ.
21363  */
21364 void CResult_NoneRetryableSendFailureZ_free(struct LDKCResult_NoneRetryableSendFailureZ _res);
21365
21366 /**
21367  * Creates a new CResult_NoneRetryableSendFailureZ which has the same data as `orig`
21368  * but with all dynamically-allocated buffers duplicated in new buffers.
21369  */
21370 struct LDKCResult_NoneRetryableSendFailureZ CResult_NoneRetryableSendFailureZ_clone(const struct LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR orig);
21371
21372 /**
21373  * Creates a new CResult_PaymentHashPaymentSendFailureZ in the success state.
21374  */
21375 struct LDKCResult_PaymentHashPaymentSendFailureZ CResult_PaymentHashPaymentSendFailureZ_ok(struct LDKThirtyTwoBytes o);
21376
21377 /**
21378  * Creates a new CResult_PaymentHashPaymentSendFailureZ in the error state.
21379  */
21380 struct LDKCResult_PaymentHashPaymentSendFailureZ CResult_PaymentHashPaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
21381
21382 /**
21383  * Checks if the given object is currently in the success state
21384  */
21385 bool CResult_PaymentHashPaymentSendFailureZ_is_ok(const struct LDKCResult_PaymentHashPaymentSendFailureZ *NONNULL_PTR o);
21386
21387 /**
21388  * Frees any resources used by the CResult_PaymentHashPaymentSendFailureZ.
21389  */
21390 void CResult_PaymentHashPaymentSendFailureZ_free(struct LDKCResult_PaymentHashPaymentSendFailureZ _res);
21391
21392 /**
21393  * Creates a new CResult_PaymentHashPaymentSendFailureZ which has the same data as `orig`
21394  * but with all dynamically-allocated buffers duplicated in new buffers.
21395  */
21396 struct LDKCResult_PaymentHashPaymentSendFailureZ CResult_PaymentHashPaymentSendFailureZ_clone(const struct LDKCResult_PaymentHashPaymentSendFailureZ *NONNULL_PTR orig);
21397
21398 /**
21399  * Creates a new CResult_PaymentHashRetryableSendFailureZ in the success state.
21400  */
21401 struct LDKCResult_PaymentHashRetryableSendFailureZ CResult_PaymentHashRetryableSendFailureZ_ok(struct LDKThirtyTwoBytes o);
21402
21403 /**
21404  * Creates a new CResult_PaymentHashRetryableSendFailureZ in the error state.
21405  */
21406 struct LDKCResult_PaymentHashRetryableSendFailureZ CResult_PaymentHashRetryableSendFailureZ_err(enum LDKRetryableSendFailure e);
21407
21408 /**
21409  * Checks if the given object is currently in the success state
21410  */
21411 bool CResult_PaymentHashRetryableSendFailureZ_is_ok(const struct LDKCResult_PaymentHashRetryableSendFailureZ *NONNULL_PTR o);
21412
21413 /**
21414  * Frees any resources used by the CResult_PaymentHashRetryableSendFailureZ.
21415  */
21416 void CResult_PaymentHashRetryableSendFailureZ_free(struct LDKCResult_PaymentHashRetryableSendFailureZ _res);
21417
21418 /**
21419  * Creates a new CResult_PaymentHashRetryableSendFailureZ which has the same data as `orig`
21420  * but with all dynamically-allocated buffers duplicated in new buffers.
21421  */
21422 struct LDKCResult_PaymentHashRetryableSendFailureZ CResult_PaymentHashRetryableSendFailureZ_clone(const struct LDKCResult_PaymentHashRetryableSendFailureZ *NONNULL_PTR orig);
21423
21424 /**
21425  * Creates a new tuple which has the same data as `orig`
21426  * but with all dynamically-allocated buffers duplicated in new buffers.
21427  */
21428 struct LDKC2Tuple_PaymentHashPaymentIdZ C2Tuple_PaymentHashPaymentIdZ_clone(const struct LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR orig);
21429
21430 /**
21431  * Creates a new C2Tuple_PaymentHashPaymentIdZ from the contained elements.
21432  */
21433 struct LDKC2Tuple_PaymentHashPaymentIdZ C2Tuple_PaymentHashPaymentIdZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b);
21434
21435 /**
21436  * Frees any resources used by the C2Tuple_PaymentHashPaymentIdZ.
21437  */
21438 void C2Tuple_PaymentHashPaymentIdZ_free(struct LDKC2Tuple_PaymentHashPaymentIdZ _res);
21439
21440 /**
21441  * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the success state.
21442  */
21443 struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(struct LDKC2Tuple_PaymentHashPaymentIdZ o);
21444
21445 /**
21446  * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the error state.
21447  */
21448 struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
21449
21450 /**
21451  * Checks if the given object is currently in the success state
21452  */
21453 bool CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(const struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR o);
21454
21455 /**
21456  * Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.
21457  */
21458 void CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res);
21459
21460 /**
21461  * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ which has the same data as `orig`
21462  * but with all dynamically-allocated buffers duplicated in new buffers.
21463  */
21464 struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR orig);
21465
21466 /**
21467  * Frees the buffer pointed to by `data` if `datalen` is non-0.
21468  */
21469 void CVec_ThirtyTwoBytesZ_free(struct LDKCVec_ThirtyTwoBytesZ _res);
21470
21471 /**
21472  * Creates a new tuple which has the same data as `orig`
21473  * but with all dynamically-allocated buffers duplicated in new buffers.
21474  */
21475 struct LDKC2Tuple_PaymentHashPaymentSecretZ C2Tuple_PaymentHashPaymentSecretZ_clone(const struct LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR orig);
21476
21477 /**
21478  * Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
21479  */
21480 struct LDKC2Tuple_PaymentHashPaymentSecretZ C2Tuple_PaymentHashPaymentSecretZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b);
21481
21482 /**
21483  * Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
21484  */
21485 void C2Tuple_PaymentHashPaymentSecretZ_free(struct LDKC2Tuple_PaymentHashPaymentSecretZ _res);
21486
21487 /**
21488  * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the success state.
21489  */
21490 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(struct LDKC2Tuple_PaymentHashPaymentSecretZ o);
21491
21492 /**
21493  * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the error state.
21494  */
21495 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err(void);
21496
21497 /**
21498  * Checks if the given object is currently in the success state
21499  */
21500 bool CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR o);
21501
21502 /**
21503  * Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ.
21504  */
21505 void CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ _res);
21506
21507 /**
21508  * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ which has the same data as `orig`
21509  * but with all dynamically-allocated buffers duplicated in new buffers.
21510  */
21511 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR orig);
21512
21513 /**
21514  * Creates a new CResult_PaymentSecretNoneZ in the success state.
21515  */
21516 struct LDKCResult_PaymentSecretNoneZ CResult_PaymentSecretNoneZ_ok(struct LDKThirtyTwoBytes o);
21517
21518 /**
21519  * Creates a new CResult_PaymentSecretNoneZ in the error state.
21520  */
21521 struct LDKCResult_PaymentSecretNoneZ CResult_PaymentSecretNoneZ_err(void);
21522
21523 /**
21524  * Checks if the given object is currently in the success state
21525  */
21526 bool CResult_PaymentSecretNoneZ_is_ok(const struct LDKCResult_PaymentSecretNoneZ *NONNULL_PTR o);
21527
21528 /**
21529  * Frees any resources used by the CResult_PaymentSecretNoneZ.
21530  */
21531 void CResult_PaymentSecretNoneZ_free(struct LDKCResult_PaymentSecretNoneZ _res);
21532
21533 /**
21534  * Creates a new CResult_PaymentSecretNoneZ which has the same data as `orig`
21535  * but with all dynamically-allocated buffers duplicated in new buffers.
21536  */
21537 struct LDKCResult_PaymentSecretNoneZ CResult_PaymentSecretNoneZ_clone(const struct LDKCResult_PaymentSecretNoneZ *NONNULL_PTR orig);
21538
21539 /**
21540  * Creates a new CResult_PaymentPreimageAPIErrorZ in the success state.
21541  */
21542 struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_ok(struct LDKThirtyTwoBytes o);
21543
21544 /**
21545  * Creates a new CResult_PaymentPreimageAPIErrorZ in the error state.
21546  */
21547 struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_err(struct LDKAPIError e);
21548
21549 /**
21550  * Checks if the given object is currently in the success state
21551  */
21552 bool CResult_PaymentPreimageAPIErrorZ_is_ok(const struct LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR o);
21553
21554 /**
21555  * Frees any resources used by the CResult_PaymentPreimageAPIErrorZ.
21556  */
21557 void CResult_PaymentPreimageAPIErrorZ_free(struct LDKCResult_PaymentPreimageAPIErrorZ _res);
21558
21559 /**
21560  * Creates a new CResult_PaymentPreimageAPIErrorZ which has the same data as `orig`
21561  * but with all dynamically-allocated buffers duplicated in new buffers.
21562  */
21563 struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_clone(const struct LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR orig);
21564
21565 /**
21566  * Constructs a new COption_CVec_ChainHashZZ containing a crate::c_types::derived::CVec_ChainHashZ
21567  */
21568 struct LDKCOption_CVec_ChainHashZZ COption_CVec_ChainHashZZ_some(struct LDKCVec_ChainHashZ o);
21569
21570 /**
21571  * Constructs a new COption_CVec_ChainHashZZ containing nothing
21572  */
21573 struct LDKCOption_CVec_ChainHashZZ COption_CVec_ChainHashZZ_none(void);
21574
21575 /**
21576  * Frees any resources associated with the crate::c_types::derived::CVec_ChainHashZ, if we are in the Some state
21577  */
21578 void COption_CVec_ChainHashZZ_free(struct LDKCOption_CVec_ChainHashZZ _res);
21579
21580 /**
21581  * Creates a new COption_CVec_ChainHashZZ which has the same data as `orig`
21582  * but with all dynamically-allocated buffers duplicated in new buffers.
21583  */
21584 struct LDKCOption_CVec_ChainHashZZ COption_CVec_ChainHashZZ_clone(const struct LDKCOption_CVec_ChainHashZZ *NONNULL_PTR orig);
21585
21586 /**
21587  * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the success state.
21588  */
21589 struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(struct LDKCounterpartyForwardingInfo o);
21590
21591 /**
21592  * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the error state.
21593  */
21594 struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_err(struct LDKDecodeError e);
21595
21596 /**
21597  * Checks if the given object is currently in the success state
21598  */
21599 bool CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(const struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR o);
21600
21601 /**
21602  * Frees any resources used by the CResult_CounterpartyForwardingInfoDecodeErrorZ.
21603  */
21604 void CResult_CounterpartyForwardingInfoDecodeErrorZ_free(struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res);
21605
21606 /**
21607  * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ which has the same data as `orig`
21608  * but with all dynamically-allocated buffers duplicated in new buffers.
21609  */
21610 struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(const struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR orig);
21611
21612 /**
21613  * Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the success state.
21614  */
21615 struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_ok(struct LDKChannelCounterparty o);
21616
21617 /**
21618  * Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the error state.
21619  */
21620 struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_err(struct LDKDecodeError e);
21621
21622 /**
21623  * Checks if the given object is currently in the success state
21624  */
21625 bool CResult_ChannelCounterpartyDecodeErrorZ_is_ok(const struct LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR o);
21626
21627 /**
21628  * Frees any resources used by the CResult_ChannelCounterpartyDecodeErrorZ.
21629  */
21630 void CResult_ChannelCounterpartyDecodeErrorZ_free(struct LDKCResult_ChannelCounterpartyDecodeErrorZ _res);
21631
21632 /**
21633  * Creates a new CResult_ChannelCounterpartyDecodeErrorZ which has the same data as `orig`
21634  * but with all dynamically-allocated buffers duplicated in new buffers.
21635  */
21636 struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_clone(const struct LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR orig);
21637
21638 /**
21639  * Creates a new CResult_ChannelDetailsDecodeErrorZ in the success state.
21640  */
21641 struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_ok(struct LDKChannelDetails o);
21642
21643 /**
21644  * Creates a new CResult_ChannelDetailsDecodeErrorZ in the error state.
21645  */
21646 struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_err(struct LDKDecodeError e);
21647
21648 /**
21649  * Checks if the given object is currently in the success state
21650  */
21651 bool CResult_ChannelDetailsDecodeErrorZ_is_ok(const struct LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR o);
21652
21653 /**
21654  * Frees any resources used by the CResult_ChannelDetailsDecodeErrorZ.
21655  */
21656 void CResult_ChannelDetailsDecodeErrorZ_free(struct LDKCResult_ChannelDetailsDecodeErrorZ _res);
21657
21658 /**
21659  * Creates a new CResult_ChannelDetailsDecodeErrorZ which has the same data as `orig`
21660  * but with all dynamically-allocated buffers duplicated in new buffers.
21661  */
21662 struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_clone(const struct LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR orig);
21663
21664 /**
21665  * Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the success state.
21666  */
21667 struct LDKCResult_PhantomRouteHintsDecodeErrorZ CResult_PhantomRouteHintsDecodeErrorZ_ok(struct LDKPhantomRouteHints o);
21668
21669 /**
21670  * Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the error state.
21671  */
21672 struct LDKCResult_PhantomRouteHintsDecodeErrorZ CResult_PhantomRouteHintsDecodeErrorZ_err(struct LDKDecodeError e);
21673
21674 /**
21675  * Checks if the given object is currently in the success state
21676  */
21677 bool CResult_PhantomRouteHintsDecodeErrorZ_is_ok(const struct LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR o);
21678
21679 /**
21680  * Frees any resources used by the CResult_PhantomRouteHintsDecodeErrorZ.
21681  */
21682 void CResult_PhantomRouteHintsDecodeErrorZ_free(struct LDKCResult_PhantomRouteHintsDecodeErrorZ _res);
21683
21684 /**
21685  * Creates a new CResult_PhantomRouteHintsDecodeErrorZ which has the same data as `orig`
21686  * but with all dynamically-allocated buffers duplicated in new buffers.
21687  */
21688 struct LDKCResult_PhantomRouteHintsDecodeErrorZ CResult_PhantomRouteHintsDecodeErrorZ_clone(const struct LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR orig);
21689
21690 /**
21691  * Creates a new CResult_ChannelShutdownStateDecodeErrorZ in the success state.
21692  */
21693 struct LDKCResult_ChannelShutdownStateDecodeErrorZ CResult_ChannelShutdownStateDecodeErrorZ_ok(enum LDKChannelShutdownState o);
21694
21695 /**
21696  * Creates a new CResult_ChannelShutdownStateDecodeErrorZ in the error state.
21697  */
21698 struct LDKCResult_ChannelShutdownStateDecodeErrorZ CResult_ChannelShutdownStateDecodeErrorZ_err(struct LDKDecodeError e);
21699
21700 /**
21701  * Checks if the given object is currently in the success state
21702  */
21703 bool CResult_ChannelShutdownStateDecodeErrorZ_is_ok(const struct LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR o);
21704
21705 /**
21706  * Frees any resources used by the CResult_ChannelShutdownStateDecodeErrorZ.
21707  */
21708 void CResult_ChannelShutdownStateDecodeErrorZ_free(struct LDKCResult_ChannelShutdownStateDecodeErrorZ _res);
21709
21710 /**
21711  * Creates a new CResult_ChannelShutdownStateDecodeErrorZ which has the same data as `orig`
21712  * but with all dynamically-allocated buffers duplicated in new buffers.
21713  */
21714 struct LDKCResult_ChannelShutdownStateDecodeErrorZ CResult_ChannelShutdownStateDecodeErrorZ_clone(const struct LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR orig);
21715
21716 /**
21717  * Frees the buffer pointed to by `data` if `datalen` is non-0.
21718  */
21719 void CVec_ChannelMonitorZ_free(struct LDKCVec_ChannelMonitorZ _res);
21720
21721 /**
21722  * Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
21723  */
21724 struct LDKC2Tuple_BlockHashChannelManagerZ C2Tuple_BlockHashChannelManagerZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelManager b);
21725
21726 /**
21727  * Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
21728  */
21729 void C2Tuple_BlockHashChannelManagerZ_free(struct LDKC2Tuple_BlockHashChannelManagerZ _res);
21730
21731 /**
21732  * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
21733  */
21734 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelManagerZ o);
21735
21736 /**
21737  * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
21738  */
21739 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(struct LDKDecodeError e);
21740
21741 /**
21742  * Checks if the given object is currently in the success state
21743  */
21744 bool CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(const struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR o);
21745
21746 /**
21747  * Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
21748  */
21749 void CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res);
21750
21751 /**
21752  * Creates a new CResult_MaxDustHTLCExposureDecodeErrorZ in the success state.
21753  */
21754 struct LDKCResult_MaxDustHTLCExposureDecodeErrorZ CResult_MaxDustHTLCExposureDecodeErrorZ_ok(struct LDKMaxDustHTLCExposure o);
21755
21756 /**
21757  * Creates a new CResult_MaxDustHTLCExposureDecodeErrorZ in the error state.
21758  */
21759 struct LDKCResult_MaxDustHTLCExposureDecodeErrorZ CResult_MaxDustHTLCExposureDecodeErrorZ_err(struct LDKDecodeError e);
21760
21761 /**
21762  * Checks if the given object is currently in the success state
21763  */
21764 bool CResult_MaxDustHTLCExposureDecodeErrorZ_is_ok(const struct LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR o);
21765
21766 /**
21767  * Frees any resources used by the CResult_MaxDustHTLCExposureDecodeErrorZ.
21768  */
21769 void CResult_MaxDustHTLCExposureDecodeErrorZ_free(struct LDKCResult_MaxDustHTLCExposureDecodeErrorZ _res);
21770
21771 /**
21772  * Creates a new CResult_MaxDustHTLCExposureDecodeErrorZ which has the same data as `orig`
21773  * but with all dynamically-allocated buffers duplicated in new buffers.
21774  */
21775 struct LDKCResult_MaxDustHTLCExposureDecodeErrorZ CResult_MaxDustHTLCExposureDecodeErrorZ_clone(const struct LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR orig);
21776
21777 /**
21778  * Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
21779  */
21780 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_ok(struct LDKChannelConfig o);
21781
21782 /**
21783  * Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
21784  */
21785 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_err(struct LDKDecodeError e);
21786
21787 /**
21788  * Checks if the given object is currently in the success state
21789  */
21790 bool CResult_ChannelConfigDecodeErrorZ_is_ok(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR o);
21791
21792 /**
21793  * Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
21794  */
21795 void CResult_ChannelConfigDecodeErrorZ_free(struct LDKCResult_ChannelConfigDecodeErrorZ _res);
21796
21797 /**
21798  * Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
21799  * but with all dynamically-allocated buffers duplicated in new buffers.
21800  */
21801 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_clone(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR orig);
21802
21803 /**
21804  * Constructs a new COption_MaxDustHTLCExposureZ containing a crate::lightning::util::config::MaxDustHTLCExposure
21805  */
21806 struct LDKCOption_MaxDustHTLCExposureZ COption_MaxDustHTLCExposureZ_some(struct LDKMaxDustHTLCExposure o);
21807
21808 /**
21809  * Constructs a new COption_MaxDustHTLCExposureZ containing nothing
21810  */
21811 struct LDKCOption_MaxDustHTLCExposureZ COption_MaxDustHTLCExposureZ_none(void);
21812
21813 /**
21814  * Frees any resources associated with the crate::lightning::util::config::MaxDustHTLCExposure, if we are in the Some state
21815  */
21816 void COption_MaxDustHTLCExposureZ_free(struct LDKCOption_MaxDustHTLCExposureZ _res);
21817
21818 /**
21819  * Creates a new COption_MaxDustHTLCExposureZ which has the same data as `orig`
21820  * but with all dynamically-allocated buffers duplicated in new buffers.
21821  */
21822 struct LDKCOption_MaxDustHTLCExposureZ COption_MaxDustHTLCExposureZ_clone(const struct LDKCOption_MaxDustHTLCExposureZ *NONNULL_PTR orig);
21823
21824 /**
21825  * Constructs a new COption_APIErrorZ containing a crate::lightning::util::errors::APIError
21826  */
21827 struct LDKCOption_APIErrorZ COption_APIErrorZ_some(struct LDKAPIError o);
21828
21829 /**
21830  * Constructs a new COption_APIErrorZ containing nothing
21831  */
21832 struct LDKCOption_APIErrorZ COption_APIErrorZ_none(void);
21833
21834 /**
21835  * Frees any resources associated with the crate::lightning::util::errors::APIError, if we are in the Some state
21836  */
21837 void COption_APIErrorZ_free(struct LDKCOption_APIErrorZ _res);
21838
21839 /**
21840  * Creates a new COption_APIErrorZ which has the same data as `orig`
21841  * but with all dynamically-allocated buffers duplicated in new buffers.
21842  */
21843 struct LDKCOption_APIErrorZ COption_APIErrorZ_clone(const struct LDKCOption_APIErrorZ *NONNULL_PTR orig);
21844
21845 /**
21846  * Creates a new CResult_COption_APIErrorZDecodeErrorZ in the success state.
21847  */
21848 struct LDKCResult_COption_APIErrorZDecodeErrorZ CResult_COption_APIErrorZDecodeErrorZ_ok(struct LDKCOption_APIErrorZ o);
21849
21850 /**
21851  * Creates a new CResult_COption_APIErrorZDecodeErrorZ in the error state.
21852  */
21853 struct LDKCResult_COption_APIErrorZDecodeErrorZ CResult_COption_APIErrorZDecodeErrorZ_err(struct LDKDecodeError e);
21854
21855 /**
21856  * Checks if the given object is currently in the success state
21857  */
21858 bool CResult_COption_APIErrorZDecodeErrorZ_is_ok(const struct LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR o);
21859
21860 /**
21861  * Frees any resources used by the CResult_COption_APIErrorZDecodeErrorZ.
21862  */
21863 void CResult_COption_APIErrorZDecodeErrorZ_free(struct LDKCResult_COption_APIErrorZDecodeErrorZ _res);
21864
21865 /**
21866  * Creates a new CResult_COption_APIErrorZDecodeErrorZ which has the same data as `orig`
21867  * but with all dynamically-allocated buffers duplicated in new buffers.
21868  */
21869 struct LDKCResult_COption_APIErrorZDecodeErrorZ CResult_COption_APIErrorZDecodeErrorZ_clone(const struct LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR orig);
21870
21871 /**
21872  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
21873  */
21874 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_ok(struct LDKChannelMonitorUpdate o);
21875
21876 /**
21877  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
21878  */
21879 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_err(struct LDKDecodeError e);
21880
21881 /**
21882  * Checks if the given object is currently in the success state
21883  */
21884 bool CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR o);
21885
21886 /**
21887  * Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
21888  */
21889 void CResult_ChannelMonitorUpdateDecodeErrorZ_free(struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res);
21890
21891 /**
21892  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
21893  * but with all dynamically-allocated buffers duplicated in new buffers.
21894  */
21895 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR orig);
21896
21897 /**
21898  * Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent
21899  */
21900 struct LDKCOption_MonitorEventZ COption_MonitorEventZ_some(struct LDKMonitorEvent o);
21901
21902 /**
21903  * Constructs a new COption_MonitorEventZ containing nothing
21904  */
21905 struct LDKCOption_MonitorEventZ COption_MonitorEventZ_none(void);
21906
21907 /**
21908  * Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state
21909  */
21910 void COption_MonitorEventZ_free(struct LDKCOption_MonitorEventZ _res);
21911
21912 /**
21913  * Creates a new COption_MonitorEventZ which has the same data as `orig`
21914  * but with all dynamically-allocated buffers duplicated in new buffers.
21915  */
21916 struct LDKCOption_MonitorEventZ COption_MonitorEventZ_clone(const struct LDKCOption_MonitorEventZ *NONNULL_PTR orig);
21917
21918 /**
21919  * Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state.
21920  */
21921 struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_ok(struct LDKCOption_MonitorEventZ o);
21922
21923 /**
21924  * Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state.
21925  */
21926 struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_err(struct LDKDecodeError e);
21927
21928 /**
21929  * Checks if the given object is currently in the success state
21930  */
21931 bool CResult_COption_MonitorEventZDecodeErrorZ_is_ok(const struct LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR o);
21932
21933 /**
21934  * Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ.
21935  */
21936 void CResult_COption_MonitorEventZDecodeErrorZ_free(struct LDKCResult_COption_MonitorEventZDecodeErrorZ _res);
21937
21938 /**
21939  * Creates a new CResult_COption_MonitorEventZDecodeErrorZ which has the same data as `orig`
21940  * but with all dynamically-allocated buffers duplicated in new buffers.
21941  */
21942 struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_clone(const struct LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR orig);
21943
21944 /**
21945  * Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
21946  */
21947 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_ok(struct LDKHTLCUpdate o);
21948
21949 /**
21950  * Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
21951  */
21952 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_err(struct LDKDecodeError e);
21953
21954 /**
21955  * Checks if the given object is currently in the success state
21956  */
21957 bool CResult_HTLCUpdateDecodeErrorZ_is_ok(const struct LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR o);
21958
21959 /**
21960  * Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
21961  */
21962 void CResult_HTLCUpdateDecodeErrorZ_free(struct LDKCResult_HTLCUpdateDecodeErrorZ _res);
21963
21964 /**
21965  * Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
21966  * but with all dynamically-allocated buffers duplicated in new buffers.
21967  */
21968 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_clone(const struct LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR orig);
21969
21970 /**
21971  * Creates a new tuple which has the same data as `orig`
21972  * but with all dynamically-allocated buffers duplicated in new buffers.
21973  */
21974 struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_clone(const struct LDKC2Tuple_OutPointScriptZ *NONNULL_PTR orig);
21975
21976 /**
21977  * Creates a new C2Tuple_OutPointScriptZ from the contained elements.
21978  */
21979 struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_new(struct LDKOutPoint a, struct LDKCVec_u8Z b);
21980
21981 /**
21982  * Frees any resources used by the C2Tuple_OutPointScriptZ.
21983  */
21984 void C2Tuple_OutPointScriptZ_free(struct LDKC2Tuple_OutPointScriptZ _res);
21985
21986 /**
21987  * Creates a new tuple which has the same data as `orig`
21988  * but with all dynamically-allocated buffers duplicated in new buffers.
21989  */
21990 struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_clone(const struct LDKC2Tuple_u32ScriptZ *NONNULL_PTR orig);
21991
21992 /**
21993  * Creates a new C2Tuple_u32ScriptZ from the contained elements.
21994  */
21995 struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_new(uint32_t a, struct LDKCVec_u8Z b);
21996
21997 /**
21998  * Frees any resources used by the C2Tuple_u32ScriptZ.
21999  */
22000 void C2Tuple_u32ScriptZ_free(struct LDKC2Tuple_u32ScriptZ _res);
22001
22002 /**
22003  * Frees the buffer pointed to by `data` if `datalen` is non-0.
22004  */
22005 void CVec_C2Tuple_u32ScriptZZ_free(struct LDKCVec_C2Tuple_u32ScriptZZ _res);
22006
22007 /**
22008  * Creates a new tuple which has the same data as `orig`
22009  * but with all dynamically-allocated buffers duplicated in new buffers.
22010  */
22011 struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(const struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR orig);
22012
22013 /**
22014  * Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
22015  */
22016 struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32ScriptZZ b);
22017
22018 /**
22019  * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
22020  */
22021 void C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res);
22022
22023 /**
22024  * Frees the buffer pointed to by `data` if `datalen` is non-0.
22025  */
22026 void CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res);
22027
22028 /**
22029  * Frees the buffer pointed to by `data` if `datalen` is non-0.
22030  */
22031 void CVec_TransactionZ_free(struct LDKCVec_TransactionZ _res);
22032
22033 /**
22034  * Creates a new tuple which has the same data as `orig`
22035  * but with all dynamically-allocated buffers duplicated in new buffers.
22036  */
22037 struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_clone(const struct LDKC2Tuple_u32TxOutZ *NONNULL_PTR orig);
22038
22039 /**
22040  * Creates a new C2Tuple_u32TxOutZ from the contained elements.
22041  */
22042 struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_new(uint32_t a, struct LDKTxOut b);
22043
22044 /**
22045  * Frees any resources used by the C2Tuple_u32TxOutZ.
22046  */
22047 void C2Tuple_u32TxOutZ_free(struct LDKC2Tuple_u32TxOutZ _res);
22048
22049 /**
22050  * Frees the buffer pointed to by `data` if `datalen` is non-0.
22051  */
22052 void CVec_C2Tuple_u32TxOutZZ_free(struct LDKCVec_C2Tuple_u32TxOutZZ _res);
22053
22054 /**
22055  * Creates a new tuple which has the same data as `orig`
22056  * but with all dynamically-allocated buffers duplicated in new buffers.
22057  */
22058 struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(const struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR orig);
22059
22060 /**
22061  * Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
22062  */
22063 struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32TxOutZZ b);
22064
22065 /**
22066  * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
22067  */
22068 void C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res);
22069
22070 /**
22071  * Frees the buffer pointed to by `data` if `datalen` is non-0.
22072  */
22073 void CVec_TransactionOutputsZ_free(struct LDKCVec_TransactionOutputsZ _res);
22074
22075 /**
22076  * Frees the buffer pointed to by `data` if `datalen` is non-0.
22077  */
22078 void CVec_BalanceZ_free(struct LDKCVec_BalanceZ _res);
22079
22080 /**
22081  * Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
22082  */
22083 struct LDKC2Tuple_BlockHashChannelMonitorZ C2Tuple_BlockHashChannelMonitorZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelMonitor b);
22084
22085 /**
22086  * Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
22087  */
22088 void C2Tuple_BlockHashChannelMonitorZ_free(struct LDKC2Tuple_BlockHashChannelMonitorZ _res);
22089
22090 /**
22091  * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
22092  */
22093 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelMonitorZ o);
22094
22095 /**
22096  * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
22097  */
22098 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(struct LDKDecodeError e);
22099
22100 /**
22101  * Checks if the given object is currently in the success state
22102  */
22103 bool CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(const struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR o);
22104
22105 /**
22106  * Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
22107  */
22108 void CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res);
22109
22110 /**
22111  * Creates a new C2Tuple_PublicKeyTypeZ from the contained elements.
22112  */
22113 struct LDKC2Tuple_PublicKeyTypeZ C2Tuple_PublicKeyTypeZ_new(struct LDKPublicKey a, struct LDKType b);
22114
22115 /**
22116  * Frees any resources used by the C2Tuple_PublicKeyTypeZ.
22117  */
22118 void C2Tuple_PublicKeyTypeZ_free(struct LDKC2Tuple_PublicKeyTypeZ _res);
22119
22120 /**
22121  * Frees the buffer pointed to by `data` if `datalen` is non-0.
22122  */
22123 void CVec_C2Tuple_PublicKeyTypeZZ_free(struct LDKCVec_C2Tuple_PublicKeyTypeZZ _res);
22124
22125 /**
22126  * Constructs a new COption_OffersMessageZ containing a crate::lightning::onion_message::offers::OffersMessage
22127  */
22128 struct LDKCOption_OffersMessageZ COption_OffersMessageZ_some(struct LDKOffersMessage o);
22129
22130 /**
22131  * Constructs a new COption_OffersMessageZ containing nothing
22132  */
22133 struct LDKCOption_OffersMessageZ COption_OffersMessageZ_none(void);
22134
22135 /**
22136  * Frees any resources associated with the crate::lightning::onion_message::offers::OffersMessage, if we are in the Some state
22137  */
22138 void COption_OffersMessageZ_free(struct LDKCOption_OffersMessageZ _res);
22139
22140 /**
22141  * Creates a new COption_OffersMessageZ which has the same data as `orig`
22142  * but with all dynamically-allocated buffers duplicated in new buffers.
22143  */
22144 struct LDKCOption_OffersMessageZ COption_OffersMessageZ_clone(const struct LDKCOption_OffersMessageZ *NONNULL_PTR orig);
22145
22146 /**
22147  * Constructs a new COption_CustomOnionMessageContentsZ containing a crate::lightning::onion_message::packet::CustomOnionMessageContents
22148  */
22149 struct LDKCOption_CustomOnionMessageContentsZ COption_CustomOnionMessageContentsZ_some(struct LDKCustomOnionMessageContents o);
22150
22151 /**
22152  * Constructs a new COption_CustomOnionMessageContentsZ containing nothing
22153  */
22154 struct LDKCOption_CustomOnionMessageContentsZ COption_CustomOnionMessageContentsZ_none(void);
22155
22156 /**
22157  * Frees any resources associated with the crate::lightning::onion_message::packet::CustomOnionMessageContents, if we are in the Some state
22158  */
22159 void COption_CustomOnionMessageContentsZ_free(struct LDKCOption_CustomOnionMessageContentsZ _res);
22160
22161 /**
22162  * Creates a new CResult_COption_CustomOnionMessageContentsZDecodeErrorZ in the success state.
22163  */
22164 struct LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok(struct LDKCOption_CustomOnionMessageContentsZ o);
22165
22166 /**
22167  * Creates a new CResult_COption_CustomOnionMessageContentsZDecodeErrorZ in the error state.
22168  */
22169 struct LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err(struct LDKDecodeError e);
22170
22171 /**
22172  * Checks if the given object is currently in the success state
22173  */
22174 bool CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok(const struct LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ *NONNULL_PTR o);
22175
22176 /**
22177  * Frees any resources used by the CResult_COption_CustomOnionMessageContentsZDecodeErrorZ.
22178  */
22179 void CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free(struct LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ _res);
22180
22181 /**
22182  * Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
22183  */
22184 struct LDKCOption_TypeZ COption_TypeZ_some(struct LDKType o);
22185
22186 /**
22187  * Constructs a new COption_TypeZ containing nothing
22188  */
22189 struct LDKCOption_TypeZ COption_TypeZ_none(void);
22190
22191 /**
22192  * Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state
22193  */
22194 void COption_TypeZ_free(struct LDKCOption_TypeZ _res);
22195
22196 /**
22197  * Creates a new CResult_COption_TypeZDecodeErrorZ in the success state.
22198  */
22199 struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_ok(struct LDKCOption_TypeZ o);
22200
22201 /**
22202  * Creates a new CResult_COption_TypeZDecodeErrorZ in the error state.
22203  */
22204 struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_err(struct LDKDecodeError e);
22205
22206 /**
22207  * Checks if the given object is currently in the success state
22208  */
22209 bool CResult_COption_TypeZDecodeErrorZ_is_ok(const struct LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR o);
22210
22211 /**
22212  * Frees any resources used by the CResult_COption_TypeZDecodeErrorZ.
22213  */
22214 void CResult_COption_TypeZDecodeErrorZ_free(struct LDKCResult_COption_TypeZDecodeErrorZ _res);
22215
22216 /**
22217  * Constructs a new COption_NetAddressZ containing a crate::lightning::ln::msgs::NetAddress
22218  */
22219 struct LDKCOption_NetAddressZ COption_NetAddressZ_some(struct LDKNetAddress o);
22220
22221 /**
22222  * Constructs a new COption_NetAddressZ containing nothing
22223  */
22224 struct LDKCOption_NetAddressZ COption_NetAddressZ_none(void);
22225
22226 /**
22227  * Frees any resources associated with the crate::lightning::ln::msgs::NetAddress, if we are in the Some state
22228  */
22229 void COption_NetAddressZ_free(struct LDKCOption_NetAddressZ _res);
22230
22231 /**
22232  * Creates a new COption_NetAddressZ which has the same data as `orig`
22233  * but with all dynamically-allocated buffers duplicated in new buffers.
22234  */
22235 struct LDKCOption_NetAddressZ COption_NetAddressZ_clone(const struct LDKCOption_NetAddressZ *NONNULL_PTR orig);
22236
22237 /**
22238  * Creates a new tuple which has the same data as `orig`
22239  * but with all dynamically-allocated buffers duplicated in new buffers.
22240  */
22241 struct LDKC2Tuple_PublicKeyCOption_NetAddressZZ C2Tuple_PublicKeyCOption_NetAddressZZ_clone(const struct LDKC2Tuple_PublicKeyCOption_NetAddressZZ *NONNULL_PTR orig);
22242
22243 /**
22244  * Creates a new C2Tuple_PublicKeyCOption_NetAddressZZ from the contained elements.
22245  */
22246 struct LDKC2Tuple_PublicKeyCOption_NetAddressZZ C2Tuple_PublicKeyCOption_NetAddressZZ_new(struct LDKPublicKey a, struct LDKCOption_NetAddressZ b);
22247
22248 /**
22249  * Frees any resources used by the C2Tuple_PublicKeyCOption_NetAddressZZ.
22250  */
22251 void C2Tuple_PublicKeyCOption_NetAddressZZ_free(struct LDKC2Tuple_PublicKeyCOption_NetAddressZZ _res);
22252
22253 /**
22254  * Frees the buffer pointed to by `data` if `datalen` is non-0.
22255  */
22256 void CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ_free(struct LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ _res);
22257
22258 /**
22259  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
22260  */
22261 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_ok(struct LDKCVec_u8Z o);
22262
22263 /**
22264  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
22265  */
22266 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_err(struct LDKPeerHandleError e);
22267
22268 /**
22269  * Checks if the given object is currently in the success state
22270  */
22271 bool CResult_CVec_u8ZPeerHandleErrorZ_is_ok(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR o);
22272
22273 /**
22274  * Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
22275  */
22276 void CResult_CVec_u8ZPeerHandleErrorZ_free(struct LDKCResult_CVec_u8ZPeerHandleErrorZ _res);
22277
22278 /**
22279  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
22280  * but with all dynamically-allocated buffers duplicated in new buffers.
22281  */
22282 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_clone(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR orig);
22283
22284 /**
22285  * Creates a new CResult_NonePeerHandleErrorZ in the success state.
22286  */
22287 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_ok(void);
22288
22289 /**
22290  * Creates a new CResult_NonePeerHandleErrorZ in the error state.
22291  */
22292 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_err(struct LDKPeerHandleError e);
22293
22294 /**
22295  * Checks if the given object is currently in the success state
22296  */
22297 bool CResult_NonePeerHandleErrorZ_is_ok(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR o);
22298
22299 /**
22300  * Frees any resources used by the CResult_NonePeerHandleErrorZ.
22301  */
22302 void CResult_NonePeerHandleErrorZ_free(struct LDKCResult_NonePeerHandleErrorZ _res);
22303
22304 /**
22305  * Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
22306  * but with all dynamically-allocated buffers duplicated in new buffers.
22307  */
22308 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_clone(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR orig);
22309
22310 /**
22311  * Creates a new CResult_boolPeerHandleErrorZ in the success state.
22312  */
22313 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_ok(bool o);
22314
22315 /**
22316  * Creates a new CResult_boolPeerHandleErrorZ in the error state.
22317  */
22318 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_err(struct LDKPeerHandleError e);
22319
22320 /**
22321  * Checks if the given object is currently in the success state
22322  */
22323 bool CResult_boolPeerHandleErrorZ_is_ok(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR o);
22324
22325 /**
22326  * Frees any resources used by the CResult_boolPeerHandleErrorZ.
22327  */
22328 void CResult_boolPeerHandleErrorZ_free(struct LDKCResult_boolPeerHandleErrorZ _res);
22329
22330 /**
22331  * Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
22332  * but with all dynamically-allocated buffers duplicated in new buffers.
22333  */
22334 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_clone(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR orig);
22335
22336 /**
22337  * Creates a new CResult_u32GraphSyncErrorZ in the success state.
22338  */
22339 struct LDKCResult_u32GraphSyncErrorZ CResult_u32GraphSyncErrorZ_ok(uint32_t o);
22340
22341 /**
22342  * Creates a new CResult_u32GraphSyncErrorZ in the error state.
22343  */
22344 struct LDKCResult_u32GraphSyncErrorZ CResult_u32GraphSyncErrorZ_err(struct LDKGraphSyncError e);
22345
22346 /**
22347  * Checks if the given object is currently in the success state
22348  */
22349 bool CResult_u32GraphSyncErrorZ_is_ok(const struct LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR o);
22350
22351 /**
22352  * Frees any resources used by the CResult_u32GraphSyncErrorZ.
22353  */
22354 void CResult_u32GraphSyncErrorZ_free(struct LDKCResult_u32GraphSyncErrorZ _res);
22355
22356 /**
22357  * Constructs a new COption_KeyPairZ containing a crate::c_types::SecretKey
22358  */
22359 struct LDKCOption_KeyPairZ COption_KeyPairZ_some(struct LDKSecretKey o);
22360
22361 /**
22362  * Constructs a new COption_KeyPairZ containing nothing
22363  */
22364 struct LDKCOption_KeyPairZ COption_KeyPairZ_none(void);
22365
22366 /**
22367  * Frees any resources associated with the crate::c_types::SecretKey, if we are in the Some state
22368  */
22369 void COption_KeyPairZ_free(struct LDKCOption_KeyPairZ _res);
22370
22371 /**
22372  * Creates a new COption_KeyPairZ which has the same data as `orig`
22373  * but with all dynamically-allocated buffers duplicated in new buffers.
22374  */
22375 struct LDKCOption_KeyPairZ COption_KeyPairZ_clone(const struct LDKCOption_KeyPairZ *NONNULL_PTR orig);
22376
22377 /**
22378  * Creates a new CResult_COption_KeyPairZNoneZ in the success state.
22379  */
22380 struct LDKCResult_COption_KeyPairZNoneZ CResult_COption_KeyPairZNoneZ_ok(struct LDKCOption_KeyPairZ o);
22381
22382 /**
22383  * Creates a new CResult_COption_KeyPairZNoneZ in the error state.
22384  */
22385 struct LDKCResult_COption_KeyPairZNoneZ CResult_COption_KeyPairZNoneZ_err(void);
22386
22387 /**
22388  * Checks if the given object is currently in the success state
22389  */
22390 bool CResult_COption_KeyPairZNoneZ_is_ok(const struct LDKCResult_COption_KeyPairZNoneZ *NONNULL_PTR o);
22391
22392 /**
22393  * Frees any resources used by the CResult_COption_KeyPairZNoneZ.
22394  */
22395 void CResult_COption_KeyPairZNoneZ_free(struct LDKCResult_COption_KeyPairZNoneZ _res);
22396
22397 /**
22398  * Creates a new CResult_COption_KeyPairZNoneZ which has the same data as `orig`
22399  * but with all dynamically-allocated buffers duplicated in new buffers.
22400  */
22401 struct LDKCResult_COption_KeyPairZNoneZ CResult_COption_KeyPairZNoneZ_clone(const struct LDKCResult_COption_KeyPairZNoneZ *NONNULL_PTR orig);
22402
22403 /**
22404  * Constructs a new COption_ScriptZ containing a crate::c_types::derived::CVec_u8Z
22405  */
22406 struct LDKCOption_ScriptZ COption_ScriptZ_some(struct LDKCVec_u8Z o);
22407
22408 /**
22409  * Constructs a new COption_ScriptZ containing nothing
22410  */
22411 struct LDKCOption_ScriptZ COption_ScriptZ_none(void);
22412
22413 /**
22414  * Frees any resources associated with the crate::c_types::derived::CVec_u8Z, if we are in the Some state
22415  */
22416 void COption_ScriptZ_free(struct LDKCOption_ScriptZ _res);
22417
22418 /**
22419  * Creates a new COption_ScriptZ which has the same data as `orig`
22420  * but with all dynamically-allocated buffers duplicated in new buffers.
22421  */
22422 struct LDKCOption_ScriptZ COption_ScriptZ_clone(const struct LDKCOption_ScriptZ *NONNULL_PTR orig);
22423
22424 /**
22425  * Constructs a new COption_NoneZ containing a
22426  */
22427 enum LDKCOption_NoneZ COption_NoneZ_some(void);
22428
22429 /**
22430  * Constructs a new COption_NoneZ containing nothing
22431  */
22432 enum LDKCOption_NoneZ COption_NoneZ_none(void);
22433
22434 /**
22435  * Frees any resources associated with the , if we are in the Some state
22436  */
22437 void COption_NoneZ_free(enum LDKCOption_NoneZ _res);
22438
22439 /**
22440  * Frees the buffer pointed to by `data` if `datalen` is non-0.
22441  */
22442 void CVec_WitnessZ_free(struct LDKCVec_WitnessZ _res);
22443
22444 /**
22445  * Constructs a new COption_i64Z containing a i64
22446  */
22447 struct LDKCOption_i64Z COption_i64Z_some(int64_t o);
22448
22449 /**
22450  * Constructs a new COption_i64Z containing nothing
22451  */
22452 struct LDKCOption_i64Z COption_i64Z_none(void);
22453
22454 /**
22455  * Frees any resources associated with the i64, if we are in the Some state
22456  */
22457 void COption_i64Z_free(struct LDKCOption_i64Z _res);
22458
22459 /**
22460  * Creates a new COption_i64Z which has the same data as `orig`
22461  * but with all dynamically-allocated buffers duplicated in new buffers.
22462  */
22463 struct LDKCOption_i64Z COption_i64Z_clone(const struct LDKCOption_i64Z *NONNULL_PTR orig);
22464
22465 /**
22466  * Constructs a new COption_TxidZ containing a crate::c_types::ThirtyTwoBytes
22467  */
22468 struct LDKCOption_TxidZ COption_TxidZ_some(struct LDKThirtyTwoBytes o);
22469
22470 /**
22471  * Constructs a new COption_TxidZ containing nothing
22472  */
22473 struct LDKCOption_TxidZ COption_TxidZ_none(void);
22474
22475 /**
22476  * Frees any resources associated with the crate::c_types::ThirtyTwoBytes, if we are in the Some state
22477  */
22478 void COption_TxidZ_free(struct LDKCOption_TxidZ _res);
22479
22480 /**
22481  * Creates a new COption_TxidZ which has the same data as `orig`
22482  * but with all dynamically-allocated buffers duplicated in new buffers.
22483  */
22484 struct LDKCOption_TxidZ COption_TxidZ_clone(const struct LDKCOption_TxidZ *NONNULL_PTR orig);
22485
22486 /**
22487  * Creates a new CResult_NetAddressDecodeErrorZ in the success state.
22488  */
22489 struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_ok(struct LDKNetAddress o);
22490
22491 /**
22492  * Creates a new CResult_NetAddressDecodeErrorZ in the error state.
22493  */
22494 struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_err(struct LDKDecodeError e);
22495
22496 /**
22497  * Checks if the given object is currently in the success state
22498  */
22499 bool CResult_NetAddressDecodeErrorZ_is_ok(const struct LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR o);
22500
22501 /**
22502  * Frees any resources used by the CResult_NetAddressDecodeErrorZ.
22503  */
22504 void CResult_NetAddressDecodeErrorZ_free(struct LDKCResult_NetAddressDecodeErrorZ _res);
22505
22506 /**
22507  * Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig`
22508  * but with all dynamically-allocated buffers duplicated in new buffers.
22509  */
22510 struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_clone(const struct LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR orig);
22511
22512 /**
22513  * Frees the buffer pointed to by `data` if `datalen` is non-0.
22514  */
22515 void CVec_UpdateAddHTLCZ_free(struct LDKCVec_UpdateAddHTLCZ _res);
22516
22517 /**
22518  * Frees the buffer pointed to by `data` if `datalen` is non-0.
22519  */
22520 void CVec_UpdateFulfillHTLCZ_free(struct LDKCVec_UpdateFulfillHTLCZ _res);
22521
22522 /**
22523  * Frees the buffer pointed to by `data` if `datalen` is non-0.
22524  */
22525 void CVec_UpdateFailHTLCZ_free(struct LDKCVec_UpdateFailHTLCZ _res);
22526
22527 /**
22528  * Frees the buffer pointed to by `data` if `datalen` is non-0.
22529  */
22530 void CVec_UpdateFailMalformedHTLCZ_free(struct LDKCVec_UpdateFailMalformedHTLCZ _res);
22531
22532 /**
22533  * Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
22534  */
22535 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_ok(struct LDKAcceptChannel o);
22536
22537 /**
22538  * Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
22539  */
22540 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_err(struct LDKDecodeError e);
22541
22542 /**
22543  * Checks if the given object is currently in the success state
22544  */
22545 bool CResult_AcceptChannelDecodeErrorZ_is_ok(const struct LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR o);
22546
22547 /**
22548  * Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
22549  */
22550 void CResult_AcceptChannelDecodeErrorZ_free(struct LDKCResult_AcceptChannelDecodeErrorZ _res);
22551
22552 /**
22553  * Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
22554  * but with all dynamically-allocated buffers duplicated in new buffers.
22555  */
22556 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_clone(const struct LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR orig);
22557
22558 /**
22559  * Creates a new CResult_AcceptChannelV2DecodeErrorZ in the success state.
22560  */
22561 struct LDKCResult_AcceptChannelV2DecodeErrorZ CResult_AcceptChannelV2DecodeErrorZ_ok(struct LDKAcceptChannelV2 o);
22562
22563 /**
22564  * Creates a new CResult_AcceptChannelV2DecodeErrorZ in the error state.
22565  */
22566 struct LDKCResult_AcceptChannelV2DecodeErrorZ CResult_AcceptChannelV2DecodeErrorZ_err(struct LDKDecodeError e);
22567
22568 /**
22569  * Checks if the given object is currently in the success state
22570  */
22571 bool CResult_AcceptChannelV2DecodeErrorZ_is_ok(const struct LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR o);
22572
22573 /**
22574  * Frees any resources used by the CResult_AcceptChannelV2DecodeErrorZ.
22575  */
22576 void CResult_AcceptChannelV2DecodeErrorZ_free(struct LDKCResult_AcceptChannelV2DecodeErrorZ _res);
22577
22578 /**
22579  * Creates a new CResult_AcceptChannelV2DecodeErrorZ which has the same data as `orig`
22580  * but with all dynamically-allocated buffers duplicated in new buffers.
22581  */
22582 struct LDKCResult_AcceptChannelV2DecodeErrorZ CResult_AcceptChannelV2DecodeErrorZ_clone(const struct LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR orig);
22583
22584 /**
22585  * Creates a new CResult_TxAddInputDecodeErrorZ in the success state.
22586  */
22587 struct LDKCResult_TxAddInputDecodeErrorZ CResult_TxAddInputDecodeErrorZ_ok(struct LDKTxAddInput o);
22588
22589 /**
22590  * Creates a new CResult_TxAddInputDecodeErrorZ in the error state.
22591  */
22592 struct LDKCResult_TxAddInputDecodeErrorZ CResult_TxAddInputDecodeErrorZ_err(struct LDKDecodeError e);
22593
22594 /**
22595  * Checks if the given object is currently in the success state
22596  */
22597 bool CResult_TxAddInputDecodeErrorZ_is_ok(const struct LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR o);
22598
22599 /**
22600  * Frees any resources used by the CResult_TxAddInputDecodeErrorZ.
22601  */
22602 void CResult_TxAddInputDecodeErrorZ_free(struct LDKCResult_TxAddInputDecodeErrorZ _res);
22603
22604 /**
22605  * Creates a new CResult_TxAddInputDecodeErrorZ which has the same data as `orig`
22606  * but with all dynamically-allocated buffers duplicated in new buffers.
22607  */
22608 struct LDKCResult_TxAddInputDecodeErrorZ CResult_TxAddInputDecodeErrorZ_clone(const struct LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR orig);
22609
22610 /**
22611  * Creates a new CResult_TxAddOutputDecodeErrorZ in the success state.
22612  */
22613 struct LDKCResult_TxAddOutputDecodeErrorZ CResult_TxAddOutputDecodeErrorZ_ok(struct LDKTxAddOutput o);
22614
22615 /**
22616  * Creates a new CResult_TxAddOutputDecodeErrorZ in the error state.
22617  */
22618 struct LDKCResult_TxAddOutputDecodeErrorZ CResult_TxAddOutputDecodeErrorZ_err(struct LDKDecodeError e);
22619
22620 /**
22621  * Checks if the given object is currently in the success state
22622  */
22623 bool CResult_TxAddOutputDecodeErrorZ_is_ok(const struct LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR o);
22624
22625 /**
22626  * Frees any resources used by the CResult_TxAddOutputDecodeErrorZ.
22627  */
22628 void CResult_TxAddOutputDecodeErrorZ_free(struct LDKCResult_TxAddOutputDecodeErrorZ _res);
22629
22630 /**
22631  * Creates a new CResult_TxAddOutputDecodeErrorZ which has the same data as `orig`
22632  * but with all dynamically-allocated buffers duplicated in new buffers.
22633  */
22634 struct LDKCResult_TxAddOutputDecodeErrorZ CResult_TxAddOutputDecodeErrorZ_clone(const struct LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR orig);
22635
22636 /**
22637  * Creates a new CResult_TxRemoveInputDecodeErrorZ in the success state.
22638  */
22639 struct LDKCResult_TxRemoveInputDecodeErrorZ CResult_TxRemoveInputDecodeErrorZ_ok(struct LDKTxRemoveInput o);
22640
22641 /**
22642  * Creates a new CResult_TxRemoveInputDecodeErrorZ in the error state.
22643  */
22644 struct LDKCResult_TxRemoveInputDecodeErrorZ CResult_TxRemoveInputDecodeErrorZ_err(struct LDKDecodeError e);
22645
22646 /**
22647  * Checks if the given object is currently in the success state
22648  */
22649 bool CResult_TxRemoveInputDecodeErrorZ_is_ok(const struct LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR o);
22650
22651 /**
22652  * Frees any resources used by the CResult_TxRemoveInputDecodeErrorZ.
22653  */
22654 void CResult_TxRemoveInputDecodeErrorZ_free(struct LDKCResult_TxRemoveInputDecodeErrorZ _res);
22655
22656 /**
22657  * Creates a new CResult_TxRemoveInputDecodeErrorZ which has the same data as `orig`
22658  * but with all dynamically-allocated buffers duplicated in new buffers.
22659  */
22660 struct LDKCResult_TxRemoveInputDecodeErrorZ CResult_TxRemoveInputDecodeErrorZ_clone(const struct LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR orig);
22661
22662 /**
22663  * Creates a new CResult_TxRemoveOutputDecodeErrorZ in the success state.
22664  */
22665 struct LDKCResult_TxRemoveOutputDecodeErrorZ CResult_TxRemoveOutputDecodeErrorZ_ok(struct LDKTxRemoveOutput o);
22666
22667 /**
22668  * Creates a new CResult_TxRemoveOutputDecodeErrorZ in the error state.
22669  */
22670 struct LDKCResult_TxRemoveOutputDecodeErrorZ CResult_TxRemoveOutputDecodeErrorZ_err(struct LDKDecodeError e);
22671
22672 /**
22673  * Checks if the given object is currently in the success state
22674  */
22675 bool CResult_TxRemoveOutputDecodeErrorZ_is_ok(const struct LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR o);
22676
22677 /**
22678  * Frees any resources used by the CResult_TxRemoveOutputDecodeErrorZ.
22679  */
22680 void CResult_TxRemoveOutputDecodeErrorZ_free(struct LDKCResult_TxRemoveOutputDecodeErrorZ _res);
22681
22682 /**
22683  * Creates a new CResult_TxRemoveOutputDecodeErrorZ which has the same data as `orig`
22684  * but with all dynamically-allocated buffers duplicated in new buffers.
22685  */
22686 struct LDKCResult_TxRemoveOutputDecodeErrorZ CResult_TxRemoveOutputDecodeErrorZ_clone(const struct LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR orig);
22687
22688 /**
22689  * Creates a new CResult_TxCompleteDecodeErrorZ in the success state.
22690  */
22691 struct LDKCResult_TxCompleteDecodeErrorZ CResult_TxCompleteDecodeErrorZ_ok(struct LDKTxComplete o);
22692
22693 /**
22694  * Creates a new CResult_TxCompleteDecodeErrorZ in the error state.
22695  */
22696 struct LDKCResult_TxCompleteDecodeErrorZ CResult_TxCompleteDecodeErrorZ_err(struct LDKDecodeError e);
22697
22698 /**
22699  * Checks if the given object is currently in the success state
22700  */
22701 bool CResult_TxCompleteDecodeErrorZ_is_ok(const struct LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR o);
22702
22703 /**
22704  * Frees any resources used by the CResult_TxCompleteDecodeErrorZ.
22705  */
22706 void CResult_TxCompleteDecodeErrorZ_free(struct LDKCResult_TxCompleteDecodeErrorZ _res);
22707
22708 /**
22709  * Creates a new CResult_TxCompleteDecodeErrorZ which has the same data as `orig`
22710  * but with all dynamically-allocated buffers duplicated in new buffers.
22711  */
22712 struct LDKCResult_TxCompleteDecodeErrorZ CResult_TxCompleteDecodeErrorZ_clone(const struct LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR orig);
22713
22714 /**
22715  * Creates a new CResult_TxSignaturesDecodeErrorZ in the success state.
22716  */
22717 struct LDKCResult_TxSignaturesDecodeErrorZ CResult_TxSignaturesDecodeErrorZ_ok(struct LDKTxSignatures o);
22718
22719 /**
22720  * Creates a new CResult_TxSignaturesDecodeErrorZ in the error state.
22721  */
22722 struct LDKCResult_TxSignaturesDecodeErrorZ CResult_TxSignaturesDecodeErrorZ_err(struct LDKDecodeError e);
22723
22724 /**
22725  * Checks if the given object is currently in the success state
22726  */
22727 bool CResult_TxSignaturesDecodeErrorZ_is_ok(const struct LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR o);
22728
22729 /**
22730  * Frees any resources used by the CResult_TxSignaturesDecodeErrorZ.
22731  */
22732 void CResult_TxSignaturesDecodeErrorZ_free(struct LDKCResult_TxSignaturesDecodeErrorZ _res);
22733
22734 /**
22735  * Creates a new CResult_TxSignaturesDecodeErrorZ which has the same data as `orig`
22736  * but with all dynamically-allocated buffers duplicated in new buffers.
22737  */
22738 struct LDKCResult_TxSignaturesDecodeErrorZ CResult_TxSignaturesDecodeErrorZ_clone(const struct LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR orig);
22739
22740 /**
22741  * Creates a new CResult_TxInitRbfDecodeErrorZ in the success state.
22742  */
22743 struct LDKCResult_TxInitRbfDecodeErrorZ CResult_TxInitRbfDecodeErrorZ_ok(struct LDKTxInitRbf o);
22744
22745 /**
22746  * Creates a new CResult_TxInitRbfDecodeErrorZ in the error state.
22747  */
22748 struct LDKCResult_TxInitRbfDecodeErrorZ CResult_TxInitRbfDecodeErrorZ_err(struct LDKDecodeError e);
22749
22750 /**
22751  * Checks if the given object is currently in the success state
22752  */
22753 bool CResult_TxInitRbfDecodeErrorZ_is_ok(const struct LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR o);
22754
22755 /**
22756  * Frees any resources used by the CResult_TxInitRbfDecodeErrorZ.
22757  */
22758 void CResult_TxInitRbfDecodeErrorZ_free(struct LDKCResult_TxInitRbfDecodeErrorZ _res);
22759
22760 /**
22761  * Creates a new CResult_TxInitRbfDecodeErrorZ which has the same data as `orig`
22762  * but with all dynamically-allocated buffers duplicated in new buffers.
22763  */
22764 struct LDKCResult_TxInitRbfDecodeErrorZ CResult_TxInitRbfDecodeErrorZ_clone(const struct LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR orig);
22765
22766 /**
22767  * Creates a new CResult_TxAckRbfDecodeErrorZ in the success state.
22768  */
22769 struct LDKCResult_TxAckRbfDecodeErrorZ CResult_TxAckRbfDecodeErrorZ_ok(struct LDKTxAckRbf o);
22770
22771 /**
22772  * Creates a new CResult_TxAckRbfDecodeErrorZ in the error state.
22773  */
22774 struct LDKCResult_TxAckRbfDecodeErrorZ CResult_TxAckRbfDecodeErrorZ_err(struct LDKDecodeError e);
22775
22776 /**
22777  * Checks if the given object is currently in the success state
22778  */
22779 bool CResult_TxAckRbfDecodeErrorZ_is_ok(const struct LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR o);
22780
22781 /**
22782  * Frees any resources used by the CResult_TxAckRbfDecodeErrorZ.
22783  */
22784 void CResult_TxAckRbfDecodeErrorZ_free(struct LDKCResult_TxAckRbfDecodeErrorZ _res);
22785
22786 /**
22787  * Creates a new CResult_TxAckRbfDecodeErrorZ which has the same data as `orig`
22788  * but with all dynamically-allocated buffers duplicated in new buffers.
22789  */
22790 struct LDKCResult_TxAckRbfDecodeErrorZ CResult_TxAckRbfDecodeErrorZ_clone(const struct LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR orig);
22791
22792 /**
22793  * Creates a new CResult_TxAbortDecodeErrorZ in the success state.
22794  */
22795 struct LDKCResult_TxAbortDecodeErrorZ CResult_TxAbortDecodeErrorZ_ok(struct LDKTxAbort o);
22796
22797 /**
22798  * Creates a new CResult_TxAbortDecodeErrorZ in the error state.
22799  */
22800 struct LDKCResult_TxAbortDecodeErrorZ CResult_TxAbortDecodeErrorZ_err(struct LDKDecodeError e);
22801
22802 /**
22803  * Checks if the given object is currently in the success state
22804  */
22805 bool CResult_TxAbortDecodeErrorZ_is_ok(const struct LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR o);
22806
22807 /**
22808  * Frees any resources used by the CResult_TxAbortDecodeErrorZ.
22809  */
22810 void CResult_TxAbortDecodeErrorZ_free(struct LDKCResult_TxAbortDecodeErrorZ _res);
22811
22812 /**
22813  * Creates a new CResult_TxAbortDecodeErrorZ which has the same data as `orig`
22814  * but with all dynamically-allocated buffers duplicated in new buffers.
22815  */
22816 struct LDKCResult_TxAbortDecodeErrorZ CResult_TxAbortDecodeErrorZ_clone(const struct LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR orig);
22817
22818 /**
22819  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
22820  */
22821 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_ok(struct LDKAnnouncementSignatures o);
22822
22823 /**
22824  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
22825  */
22826 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_err(struct LDKDecodeError e);
22827
22828 /**
22829  * Checks if the given object is currently in the success state
22830  */
22831 bool CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(const struct LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR o);
22832
22833 /**
22834  * Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
22835  */
22836 void CResult_AnnouncementSignaturesDecodeErrorZ_free(struct LDKCResult_AnnouncementSignaturesDecodeErrorZ _res);
22837
22838 /**
22839  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
22840  * but with all dynamically-allocated buffers duplicated in new buffers.
22841  */
22842 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_clone(const struct LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR orig);
22843
22844 /**
22845  * Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
22846  */
22847 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_ok(struct LDKChannelReestablish o);
22848
22849 /**
22850  * Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
22851  */
22852 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_err(struct LDKDecodeError e);
22853
22854 /**
22855  * Checks if the given object is currently in the success state
22856  */
22857 bool CResult_ChannelReestablishDecodeErrorZ_is_ok(const struct LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR o);
22858
22859 /**
22860  * Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
22861  */
22862 void CResult_ChannelReestablishDecodeErrorZ_free(struct LDKCResult_ChannelReestablishDecodeErrorZ _res);
22863
22864 /**
22865  * Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
22866  * but with all dynamically-allocated buffers duplicated in new buffers.
22867  */
22868 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_clone(const struct LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR orig);
22869
22870 /**
22871  * Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
22872  */
22873 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_ok(struct LDKClosingSigned o);
22874
22875 /**
22876  * Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
22877  */
22878 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_err(struct LDKDecodeError e);
22879
22880 /**
22881  * Checks if the given object is currently in the success state
22882  */
22883 bool CResult_ClosingSignedDecodeErrorZ_is_ok(const struct LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR o);
22884
22885 /**
22886  * Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
22887  */
22888 void CResult_ClosingSignedDecodeErrorZ_free(struct LDKCResult_ClosingSignedDecodeErrorZ _res);
22889
22890 /**
22891  * Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
22892  * but with all dynamically-allocated buffers duplicated in new buffers.
22893  */
22894 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_clone(const struct LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR orig);
22895
22896 /**
22897  * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state.
22898  */
22899 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(struct LDKClosingSignedFeeRange o);
22900
22901 /**
22902  * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state.
22903  */
22904 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_err(struct LDKDecodeError e);
22905
22906 /**
22907  * Checks if the given object is currently in the success state
22908  */
22909 bool CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(const struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR o);
22910
22911 /**
22912  * Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ.
22913  */
22914 void CResult_ClosingSignedFeeRangeDecodeErrorZ_free(struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res);
22915
22916 /**
22917  * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig`
22918  * but with all dynamically-allocated buffers duplicated in new buffers.
22919  */
22920 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(const struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR orig);
22921
22922 /**
22923  * Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
22924  */
22925 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_ok(struct LDKCommitmentSigned o);
22926
22927 /**
22928  * Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
22929  */
22930 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_err(struct LDKDecodeError e);
22931
22932 /**
22933  * Checks if the given object is currently in the success state
22934  */
22935 bool CResult_CommitmentSignedDecodeErrorZ_is_ok(const struct LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR o);
22936
22937 /**
22938  * Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
22939  */
22940 void CResult_CommitmentSignedDecodeErrorZ_free(struct LDKCResult_CommitmentSignedDecodeErrorZ _res);
22941
22942 /**
22943  * Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
22944  * but with all dynamically-allocated buffers duplicated in new buffers.
22945  */
22946 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_clone(const struct LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR orig);
22947
22948 /**
22949  * Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
22950  */
22951 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_ok(struct LDKFundingCreated o);
22952
22953 /**
22954  * Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
22955  */
22956 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_err(struct LDKDecodeError e);
22957
22958 /**
22959  * Checks if the given object is currently in the success state
22960  */
22961 bool CResult_FundingCreatedDecodeErrorZ_is_ok(const struct LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR o);
22962
22963 /**
22964  * Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
22965  */
22966 void CResult_FundingCreatedDecodeErrorZ_free(struct LDKCResult_FundingCreatedDecodeErrorZ _res);
22967
22968 /**
22969  * Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
22970  * but with all dynamically-allocated buffers duplicated in new buffers.
22971  */
22972 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_clone(const struct LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR orig);
22973
22974 /**
22975  * Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
22976  */
22977 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_ok(struct LDKFundingSigned o);
22978
22979 /**
22980  * Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
22981  */
22982 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_err(struct LDKDecodeError e);
22983
22984 /**
22985  * Checks if the given object is currently in the success state
22986  */
22987 bool CResult_FundingSignedDecodeErrorZ_is_ok(const struct LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR o);
22988
22989 /**
22990  * Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
22991  */
22992 void CResult_FundingSignedDecodeErrorZ_free(struct LDKCResult_FundingSignedDecodeErrorZ _res);
22993
22994 /**
22995  * Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
22996  * but with all dynamically-allocated buffers duplicated in new buffers.
22997  */
22998 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_clone(const struct LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR orig);
22999
23000 /**
23001  * Creates a new CResult_ChannelReadyDecodeErrorZ in the success state.
23002  */
23003 struct LDKCResult_ChannelReadyDecodeErrorZ CResult_ChannelReadyDecodeErrorZ_ok(struct LDKChannelReady o);
23004
23005 /**
23006  * Creates a new CResult_ChannelReadyDecodeErrorZ in the error state.
23007  */
23008 struct LDKCResult_ChannelReadyDecodeErrorZ CResult_ChannelReadyDecodeErrorZ_err(struct LDKDecodeError e);
23009
23010 /**
23011  * Checks if the given object is currently in the success state
23012  */
23013 bool CResult_ChannelReadyDecodeErrorZ_is_ok(const struct LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR o);
23014
23015 /**
23016  * Frees any resources used by the CResult_ChannelReadyDecodeErrorZ.
23017  */
23018 void CResult_ChannelReadyDecodeErrorZ_free(struct LDKCResult_ChannelReadyDecodeErrorZ _res);
23019
23020 /**
23021  * Creates a new CResult_ChannelReadyDecodeErrorZ which has the same data as `orig`
23022  * but with all dynamically-allocated buffers duplicated in new buffers.
23023  */
23024 struct LDKCResult_ChannelReadyDecodeErrorZ CResult_ChannelReadyDecodeErrorZ_clone(const struct LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR orig);
23025
23026 /**
23027  * Creates a new CResult_InitDecodeErrorZ in the success state.
23028  */
23029 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_ok(struct LDKInit o);
23030
23031 /**
23032  * Creates a new CResult_InitDecodeErrorZ in the error state.
23033  */
23034 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_err(struct LDKDecodeError e);
23035
23036 /**
23037  * Checks if the given object is currently in the success state
23038  */
23039 bool CResult_InitDecodeErrorZ_is_ok(const struct LDKCResult_InitDecodeErrorZ *NONNULL_PTR o);
23040
23041 /**
23042  * Frees any resources used by the CResult_InitDecodeErrorZ.
23043  */
23044 void CResult_InitDecodeErrorZ_free(struct LDKCResult_InitDecodeErrorZ _res);
23045
23046 /**
23047  * Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
23048  * but with all dynamically-allocated buffers duplicated in new buffers.
23049  */
23050 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_clone(const struct LDKCResult_InitDecodeErrorZ *NONNULL_PTR orig);
23051
23052 /**
23053  * Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
23054  */
23055 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_ok(struct LDKOpenChannel o);
23056
23057 /**
23058  * Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
23059  */
23060 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_err(struct LDKDecodeError e);
23061
23062 /**
23063  * Checks if the given object is currently in the success state
23064  */
23065 bool CResult_OpenChannelDecodeErrorZ_is_ok(const struct LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR o);
23066
23067 /**
23068  * Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
23069  */
23070 void CResult_OpenChannelDecodeErrorZ_free(struct LDKCResult_OpenChannelDecodeErrorZ _res);
23071
23072 /**
23073  * Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
23074  * but with all dynamically-allocated buffers duplicated in new buffers.
23075  */
23076 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_clone(const struct LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR orig);
23077
23078 /**
23079  * Creates a new CResult_OpenChannelV2DecodeErrorZ in the success state.
23080  */
23081 struct LDKCResult_OpenChannelV2DecodeErrorZ CResult_OpenChannelV2DecodeErrorZ_ok(struct LDKOpenChannelV2 o);
23082
23083 /**
23084  * Creates a new CResult_OpenChannelV2DecodeErrorZ in the error state.
23085  */
23086 struct LDKCResult_OpenChannelV2DecodeErrorZ CResult_OpenChannelV2DecodeErrorZ_err(struct LDKDecodeError e);
23087
23088 /**
23089  * Checks if the given object is currently in the success state
23090  */
23091 bool CResult_OpenChannelV2DecodeErrorZ_is_ok(const struct LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR o);
23092
23093 /**
23094  * Frees any resources used by the CResult_OpenChannelV2DecodeErrorZ.
23095  */
23096 void CResult_OpenChannelV2DecodeErrorZ_free(struct LDKCResult_OpenChannelV2DecodeErrorZ _res);
23097
23098 /**
23099  * Creates a new CResult_OpenChannelV2DecodeErrorZ which has the same data as `orig`
23100  * but with all dynamically-allocated buffers duplicated in new buffers.
23101  */
23102 struct LDKCResult_OpenChannelV2DecodeErrorZ CResult_OpenChannelV2DecodeErrorZ_clone(const struct LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR orig);
23103
23104 /**
23105  * Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
23106  */
23107 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_ok(struct LDKRevokeAndACK o);
23108
23109 /**
23110  * Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
23111  */
23112 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_err(struct LDKDecodeError e);
23113
23114 /**
23115  * Checks if the given object is currently in the success state
23116  */
23117 bool CResult_RevokeAndACKDecodeErrorZ_is_ok(const struct LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR o);
23118
23119 /**
23120  * Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
23121  */
23122 void CResult_RevokeAndACKDecodeErrorZ_free(struct LDKCResult_RevokeAndACKDecodeErrorZ _res);
23123
23124 /**
23125  * Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
23126  * but with all dynamically-allocated buffers duplicated in new buffers.
23127  */
23128 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_clone(const struct LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR orig);
23129
23130 /**
23131  * Creates a new CResult_ShutdownDecodeErrorZ in the success state.
23132  */
23133 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_ok(struct LDKShutdown o);
23134
23135 /**
23136  * Creates a new CResult_ShutdownDecodeErrorZ in the error state.
23137  */
23138 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_err(struct LDKDecodeError e);
23139
23140 /**
23141  * Checks if the given object is currently in the success state
23142  */
23143 bool CResult_ShutdownDecodeErrorZ_is_ok(const struct LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR o);
23144
23145 /**
23146  * Frees any resources used by the CResult_ShutdownDecodeErrorZ.
23147  */
23148 void CResult_ShutdownDecodeErrorZ_free(struct LDKCResult_ShutdownDecodeErrorZ _res);
23149
23150 /**
23151  * Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
23152  * but with all dynamically-allocated buffers duplicated in new buffers.
23153  */
23154 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_clone(const struct LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR orig);
23155
23156 /**
23157  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
23158  */
23159 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_ok(struct LDKUpdateFailHTLC o);
23160
23161 /**
23162  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
23163  */
23164 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_err(struct LDKDecodeError e);
23165
23166 /**
23167  * Checks if the given object is currently in the success state
23168  */
23169 bool CResult_UpdateFailHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR o);
23170
23171 /**
23172  * Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
23173  */
23174 void CResult_UpdateFailHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailHTLCDecodeErrorZ _res);
23175
23176 /**
23177  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
23178  * but with all dynamically-allocated buffers duplicated in new buffers.
23179  */
23180 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR orig);
23181
23182 /**
23183  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
23184  */
23185 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(struct LDKUpdateFailMalformedHTLC o);
23186
23187 /**
23188  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
23189  */
23190 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(struct LDKDecodeError e);
23191
23192 /**
23193  * Checks if the given object is currently in the success state
23194  */
23195 bool CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR o);
23196
23197 /**
23198  * Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
23199  */
23200 void CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res);
23201
23202 /**
23203  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
23204  * but with all dynamically-allocated buffers duplicated in new buffers.
23205  */
23206 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR orig);
23207
23208 /**
23209  * Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
23210  */
23211 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_ok(struct LDKUpdateFee o);
23212
23213 /**
23214  * Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
23215  */
23216 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_err(struct LDKDecodeError e);
23217
23218 /**
23219  * Checks if the given object is currently in the success state
23220  */
23221 bool CResult_UpdateFeeDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR o);
23222
23223 /**
23224  * Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
23225  */
23226 void CResult_UpdateFeeDecodeErrorZ_free(struct LDKCResult_UpdateFeeDecodeErrorZ _res);
23227
23228 /**
23229  * Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
23230  * but with all dynamically-allocated buffers duplicated in new buffers.
23231  */
23232 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_clone(const struct LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR orig);
23233
23234 /**
23235  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
23236  */
23237 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_ok(struct LDKUpdateFulfillHTLC o);
23238
23239 /**
23240  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
23241  */
23242 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_err(struct LDKDecodeError e);
23243
23244 /**
23245  * Checks if the given object is currently in the success state
23246  */
23247 bool CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR o);
23248
23249 /**
23250  * Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
23251  */
23252 void CResult_UpdateFulfillHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res);
23253
23254 /**
23255  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
23256  * but with all dynamically-allocated buffers duplicated in new buffers.
23257  */
23258 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR orig);
23259
23260 /**
23261  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
23262  */
23263 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_ok(struct LDKUpdateAddHTLC o);
23264
23265 /**
23266  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
23267  */
23268 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_err(struct LDKDecodeError e);
23269
23270 /**
23271  * Checks if the given object is currently in the success state
23272  */
23273 bool CResult_UpdateAddHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR o);
23274
23275 /**
23276  * Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
23277  */
23278 void CResult_UpdateAddHTLCDecodeErrorZ_free(struct LDKCResult_UpdateAddHTLCDecodeErrorZ _res);
23279
23280 /**
23281  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
23282  * but with all dynamically-allocated buffers duplicated in new buffers.
23283  */
23284 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR orig);
23285
23286 /**
23287  * Creates a new CResult_OnionMessageDecodeErrorZ in the success state.
23288  */
23289 struct LDKCResult_OnionMessageDecodeErrorZ CResult_OnionMessageDecodeErrorZ_ok(struct LDKOnionMessage o);
23290
23291 /**
23292  * Creates a new CResult_OnionMessageDecodeErrorZ in the error state.
23293  */
23294 struct LDKCResult_OnionMessageDecodeErrorZ CResult_OnionMessageDecodeErrorZ_err(struct LDKDecodeError e);
23295
23296 /**
23297  * Checks if the given object is currently in the success state
23298  */
23299 bool CResult_OnionMessageDecodeErrorZ_is_ok(const struct LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR o);
23300
23301 /**
23302  * Frees any resources used by the CResult_OnionMessageDecodeErrorZ.
23303  */
23304 void CResult_OnionMessageDecodeErrorZ_free(struct LDKCResult_OnionMessageDecodeErrorZ _res);
23305
23306 /**
23307  * Creates a new CResult_OnionMessageDecodeErrorZ which has the same data as `orig`
23308  * but with all dynamically-allocated buffers duplicated in new buffers.
23309  */
23310 struct LDKCResult_OnionMessageDecodeErrorZ CResult_OnionMessageDecodeErrorZ_clone(const struct LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR orig);
23311
23312 /**
23313  * Creates a new CResult_PingDecodeErrorZ in the success state.
23314  */
23315 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_ok(struct LDKPing o);
23316
23317 /**
23318  * Creates a new CResult_PingDecodeErrorZ in the error state.
23319  */
23320 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_err(struct LDKDecodeError e);
23321
23322 /**
23323  * Checks if the given object is currently in the success state
23324  */
23325 bool CResult_PingDecodeErrorZ_is_ok(const struct LDKCResult_PingDecodeErrorZ *NONNULL_PTR o);
23326
23327 /**
23328  * Frees any resources used by the CResult_PingDecodeErrorZ.
23329  */
23330 void CResult_PingDecodeErrorZ_free(struct LDKCResult_PingDecodeErrorZ _res);
23331
23332 /**
23333  * Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
23334  * but with all dynamically-allocated buffers duplicated in new buffers.
23335  */
23336 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_clone(const struct LDKCResult_PingDecodeErrorZ *NONNULL_PTR orig);
23337
23338 /**
23339  * Creates a new CResult_PongDecodeErrorZ in the success state.
23340  */
23341 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_ok(struct LDKPong o);
23342
23343 /**
23344  * Creates a new CResult_PongDecodeErrorZ in the error state.
23345  */
23346 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_err(struct LDKDecodeError e);
23347
23348 /**
23349  * Checks if the given object is currently in the success state
23350  */
23351 bool CResult_PongDecodeErrorZ_is_ok(const struct LDKCResult_PongDecodeErrorZ *NONNULL_PTR o);
23352
23353 /**
23354  * Frees any resources used by the CResult_PongDecodeErrorZ.
23355  */
23356 void CResult_PongDecodeErrorZ_free(struct LDKCResult_PongDecodeErrorZ _res);
23357
23358 /**
23359  * Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
23360  * but with all dynamically-allocated buffers duplicated in new buffers.
23361  */
23362 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_clone(const struct LDKCResult_PongDecodeErrorZ *NONNULL_PTR orig);
23363
23364 /**
23365  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
23366  */
23367 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(struct LDKUnsignedChannelAnnouncement o);
23368
23369 /**
23370  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
23371  */
23372 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
23373
23374 /**
23375  * Checks if the given object is currently in the success state
23376  */
23377 bool CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR o);
23378
23379 /**
23380  * Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
23381  */
23382 void CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res);
23383
23384 /**
23385  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
23386  * but with all dynamically-allocated buffers duplicated in new buffers.
23387  */
23388 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig);
23389
23390 /**
23391  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
23392  */
23393 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_ok(struct LDKChannelAnnouncement o);
23394
23395 /**
23396  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
23397  */
23398 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
23399
23400 /**
23401  * Checks if the given object is currently in the success state
23402  */
23403 bool CResult_ChannelAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR o);
23404
23405 /**
23406  * Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
23407  */
23408 void CResult_ChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_ChannelAnnouncementDecodeErrorZ _res);
23409
23410 /**
23411  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
23412  * but with all dynamically-allocated buffers duplicated in new buffers.
23413  */
23414 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig);
23415
23416 /**
23417  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
23418  */
23419 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_ok(struct LDKUnsignedChannelUpdate o);
23420
23421 /**
23422  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
23423  */
23424 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e);
23425
23426 /**
23427  * Checks if the given object is currently in the success state
23428  */
23429 bool CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(const struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR o);
23430
23431 /**
23432  * Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
23433  */
23434 void CResult_UnsignedChannelUpdateDecodeErrorZ_free(struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res);
23435
23436 /**
23437  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
23438  * but with all dynamically-allocated buffers duplicated in new buffers.
23439  */
23440 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR orig);
23441
23442 /**
23443  * Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
23444  */
23445 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_ok(struct LDKChannelUpdate o);
23446
23447 /**
23448  * Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
23449  */
23450 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e);
23451
23452 /**
23453  * Checks if the given object is currently in the success state
23454  */
23455 bool CResult_ChannelUpdateDecodeErrorZ_is_ok(const struct LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR o);
23456
23457 /**
23458  * Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
23459  */
23460 void CResult_ChannelUpdateDecodeErrorZ_free(struct LDKCResult_ChannelUpdateDecodeErrorZ _res);
23461
23462 /**
23463  * Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
23464  * but with all dynamically-allocated buffers duplicated in new buffers.
23465  */
23466 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR orig);
23467
23468 /**
23469  * Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
23470  */
23471 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_ok(struct LDKErrorMessage o);
23472
23473 /**
23474  * Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
23475  */
23476 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_err(struct LDKDecodeError e);
23477
23478 /**
23479  * Checks if the given object is currently in the success state
23480  */
23481 bool CResult_ErrorMessageDecodeErrorZ_is_ok(const struct LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR o);
23482
23483 /**
23484  * Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
23485  */
23486 void CResult_ErrorMessageDecodeErrorZ_free(struct LDKCResult_ErrorMessageDecodeErrorZ _res);
23487
23488 /**
23489  * Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
23490  * but with all dynamically-allocated buffers duplicated in new buffers.
23491  */
23492 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_clone(const struct LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR orig);
23493
23494 /**
23495  * Creates a new CResult_WarningMessageDecodeErrorZ in the success state.
23496  */
23497 struct LDKCResult_WarningMessageDecodeErrorZ CResult_WarningMessageDecodeErrorZ_ok(struct LDKWarningMessage o);
23498
23499 /**
23500  * Creates a new CResult_WarningMessageDecodeErrorZ in the error state.
23501  */
23502 struct LDKCResult_WarningMessageDecodeErrorZ CResult_WarningMessageDecodeErrorZ_err(struct LDKDecodeError e);
23503
23504 /**
23505  * Checks if the given object is currently in the success state
23506  */
23507 bool CResult_WarningMessageDecodeErrorZ_is_ok(const struct LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR o);
23508
23509 /**
23510  * Frees any resources used by the CResult_WarningMessageDecodeErrorZ.
23511  */
23512 void CResult_WarningMessageDecodeErrorZ_free(struct LDKCResult_WarningMessageDecodeErrorZ _res);
23513
23514 /**
23515  * Creates a new CResult_WarningMessageDecodeErrorZ which has the same data as `orig`
23516  * but with all dynamically-allocated buffers duplicated in new buffers.
23517  */
23518 struct LDKCResult_WarningMessageDecodeErrorZ CResult_WarningMessageDecodeErrorZ_clone(const struct LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR orig);
23519
23520 /**
23521  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
23522  */
23523 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(struct LDKUnsignedNodeAnnouncement o);
23524
23525 /**
23526  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
23527  */
23528 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
23529
23530 /**
23531  * Checks if the given object is currently in the success state
23532  */
23533 bool CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR o);
23534
23535 /**
23536  * Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
23537  */
23538 void CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res);
23539
23540 /**
23541  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
23542  * but with all dynamically-allocated buffers duplicated in new buffers.
23543  */
23544 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR orig);
23545
23546 /**
23547  * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
23548  */
23549 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_ok(struct LDKNodeAnnouncement o);
23550
23551 /**
23552  * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
23553  */
23554 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
23555
23556 /**
23557  * Checks if the given object is currently in the success state
23558  */
23559 bool CResult_NodeAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR o);
23560
23561 /**
23562  * Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
23563  */
23564 void CResult_NodeAnnouncementDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementDecodeErrorZ _res);
23565
23566 /**
23567  * Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
23568  * but with all dynamically-allocated buffers duplicated in new buffers.
23569  */
23570 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR orig);
23571
23572 /**
23573  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
23574  */
23575 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_ok(struct LDKQueryShortChannelIds o);
23576
23577 /**
23578  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
23579  */
23580 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_err(struct LDKDecodeError e);
23581
23582 /**
23583  * Checks if the given object is currently in the success state
23584  */
23585 bool CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(const struct LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR o);
23586
23587 /**
23588  * Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
23589  */
23590 void CResult_QueryShortChannelIdsDecodeErrorZ_free(struct LDKCResult_QueryShortChannelIdsDecodeErrorZ _res);
23591
23592 /**
23593  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
23594  * but with all dynamically-allocated buffers duplicated in new buffers.
23595  */
23596 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_clone(const struct LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR orig);
23597
23598 /**
23599  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
23600  */
23601 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(struct LDKReplyShortChannelIdsEnd o);
23602
23603 /**
23604  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
23605  */
23606 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(struct LDKDecodeError e);
23607
23608 /**
23609  * Checks if the given object is currently in the success state
23610  */
23611 bool CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(const struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR o);
23612
23613 /**
23614  * Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
23615  */
23616 void CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res);
23617
23618 /**
23619  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
23620  * but with all dynamically-allocated buffers duplicated in new buffers.
23621  */
23622 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(const struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR orig);
23623
23624 /**
23625  * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
23626  */
23627 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_ok(struct LDKQueryChannelRange o);
23628
23629 /**
23630  * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
23631  */
23632 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
23633
23634 /**
23635  * Checks if the given object is currently in the success state
23636  */
23637 bool CResult_QueryChannelRangeDecodeErrorZ_is_ok(const struct LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR o);
23638
23639 /**
23640  * Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
23641  */
23642 void CResult_QueryChannelRangeDecodeErrorZ_free(struct LDKCResult_QueryChannelRangeDecodeErrorZ _res);
23643
23644 /**
23645  * Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
23646  * but with all dynamically-allocated buffers duplicated in new buffers.
23647  */
23648 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_clone(const struct LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR orig);
23649
23650 /**
23651  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
23652  */
23653 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_ok(struct LDKReplyChannelRange o);
23654
23655 /**
23656  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
23657  */
23658 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
23659
23660 /**
23661  * Checks if the given object is currently in the success state
23662  */
23663 bool CResult_ReplyChannelRangeDecodeErrorZ_is_ok(const struct LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR o);
23664
23665 /**
23666  * Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
23667  */
23668 void CResult_ReplyChannelRangeDecodeErrorZ_free(struct LDKCResult_ReplyChannelRangeDecodeErrorZ _res);
23669
23670 /**
23671  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
23672  * but with all dynamically-allocated buffers duplicated in new buffers.
23673  */
23674 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_clone(const struct LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR orig);
23675
23676 /**
23677  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
23678  */
23679 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_ok(struct LDKGossipTimestampFilter o);
23680
23681 /**
23682  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
23683  */
23684 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_err(struct LDKDecodeError e);
23685
23686 /**
23687  * Checks if the given object is currently in the success state
23688  */
23689 bool CResult_GossipTimestampFilterDecodeErrorZ_is_ok(const struct LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR o);
23690
23691 /**
23692  * Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
23693  */
23694 void CResult_GossipTimestampFilterDecodeErrorZ_free(struct LDKCResult_GossipTimestampFilterDecodeErrorZ _res);
23695
23696 /**
23697  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
23698  * but with all dynamically-allocated buffers duplicated in new buffers.
23699  */
23700 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_clone(const struct LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR orig);
23701
23702 /**
23703  * Frees the buffer pointed to by `data` if `datalen` is non-0.
23704  */
23705 void CVec_PhantomRouteHintsZ_free(struct LDKCVec_PhantomRouteHintsZ _res);
23706
23707 /**
23708  * Creates a new CResult_Bolt11InvoiceSignOrCreationErrorZ in the success state.
23709  */
23710 struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ CResult_Bolt11InvoiceSignOrCreationErrorZ_ok(struct LDKBolt11Invoice o);
23711
23712 /**
23713  * Creates a new CResult_Bolt11InvoiceSignOrCreationErrorZ in the error state.
23714  */
23715 struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ CResult_Bolt11InvoiceSignOrCreationErrorZ_err(struct LDKSignOrCreationError e);
23716
23717 /**
23718  * Checks if the given object is currently in the success state
23719  */
23720 bool CResult_Bolt11InvoiceSignOrCreationErrorZ_is_ok(const struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR o);
23721
23722 /**
23723  * Frees any resources used by the CResult_Bolt11InvoiceSignOrCreationErrorZ.
23724  */
23725 void CResult_Bolt11InvoiceSignOrCreationErrorZ_free(struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ _res);
23726
23727 /**
23728  * Creates a new CResult_Bolt11InvoiceSignOrCreationErrorZ which has the same data as `orig`
23729  * but with all dynamically-allocated buffers duplicated in new buffers.
23730  */
23731 struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(const struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR orig);
23732
23733 /**
23734  * Frees the buffer pointed to by `data` if `datalen` is non-0.
23735  */
23736 void CVec_FutureZ_free(struct LDKCVec_FutureZ _res);
23737
23738 /**
23739  * Creates a new CResult_OffersMessageDecodeErrorZ in the success state.
23740  */
23741 struct LDKCResult_OffersMessageDecodeErrorZ CResult_OffersMessageDecodeErrorZ_ok(struct LDKOffersMessage o);
23742
23743 /**
23744  * Creates a new CResult_OffersMessageDecodeErrorZ in the error state.
23745  */
23746 struct LDKCResult_OffersMessageDecodeErrorZ CResult_OffersMessageDecodeErrorZ_err(struct LDKDecodeError e);
23747
23748 /**
23749  * Checks if the given object is currently in the success state
23750  */
23751 bool CResult_OffersMessageDecodeErrorZ_is_ok(const struct LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR o);
23752
23753 /**
23754  * Frees any resources used by the CResult_OffersMessageDecodeErrorZ.
23755  */
23756 void CResult_OffersMessageDecodeErrorZ_free(struct LDKCResult_OffersMessageDecodeErrorZ _res);
23757
23758 /**
23759  * Creates a new CResult_OffersMessageDecodeErrorZ which has the same data as `orig`
23760  * but with all dynamically-allocated buffers duplicated in new buffers.
23761  */
23762 struct LDKCResult_OffersMessageDecodeErrorZ CResult_OffersMessageDecodeErrorZ_clone(const struct LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR orig);
23763
23764 /**
23765  * Constructs a new COption_HTLCClaimZ containing a crate::lightning::ln::chan_utils::HTLCClaim
23766  */
23767 struct LDKCOption_HTLCClaimZ COption_HTLCClaimZ_some(enum LDKHTLCClaim o);
23768
23769 /**
23770  * Constructs a new COption_HTLCClaimZ containing nothing
23771  */
23772 struct LDKCOption_HTLCClaimZ COption_HTLCClaimZ_none(void);
23773
23774 /**
23775  * Frees any resources associated with the crate::lightning::ln::chan_utils::HTLCClaim, if we are in the Some state
23776  */
23777 void COption_HTLCClaimZ_free(struct LDKCOption_HTLCClaimZ _res);
23778
23779 /**
23780  * Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the success state.
23781  */
23782 struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(struct LDKCounterpartyCommitmentSecrets o);
23783
23784 /**
23785  * Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the error state.
23786  */
23787 struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(struct LDKDecodeError e);
23788
23789 /**
23790  * Checks if the given object is currently in the success state
23791  */
23792 bool CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(const struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR o);
23793
23794 /**
23795  * Frees any resources used by the CResult_CounterpartyCommitmentSecretsDecodeErrorZ.
23796  */
23797 void CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ _res);
23798
23799 /**
23800  * Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ which has the same data as `orig`
23801  * but with all dynamically-allocated buffers duplicated in new buffers.
23802  */
23803 struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(const struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR orig);
23804
23805 /**
23806  * Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state.
23807  */
23808 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_ok(struct LDKTxCreationKeys o);
23809
23810 /**
23811  * Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state.
23812  */
23813 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_err(struct LDKDecodeError e);
23814
23815 /**
23816  * Checks if the given object is currently in the success state
23817  */
23818 bool CResult_TxCreationKeysDecodeErrorZ_is_ok(const struct LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR o);
23819
23820 /**
23821  * Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
23822  */
23823 void CResult_TxCreationKeysDecodeErrorZ_free(struct LDKCResult_TxCreationKeysDecodeErrorZ _res);
23824
23825 /**
23826  * Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig`
23827  * but with all dynamically-allocated buffers duplicated in new buffers.
23828  */
23829 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_clone(const struct LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR orig);
23830
23831 /**
23832  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state.
23833  */
23834 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_ok(struct LDKChannelPublicKeys o);
23835
23836 /**
23837  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state.
23838  */
23839 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_err(struct LDKDecodeError e);
23840
23841 /**
23842  * Checks if the given object is currently in the success state
23843  */
23844 bool CResult_ChannelPublicKeysDecodeErrorZ_is_ok(const struct LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR o);
23845
23846 /**
23847  * Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
23848  */
23849 void CResult_ChannelPublicKeysDecodeErrorZ_free(struct LDKCResult_ChannelPublicKeysDecodeErrorZ _res);
23850
23851 /**
23852  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig`
23853  * but with all dynamically-allocated buffers duplicated in new buffers.
23854  */
23855 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_clone(const struct LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR orig);
23856
23857 /**
23858  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
23859  */
23860 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(struct LDKHTLCOutputInCommitment o);
23861
23862 /**
23863  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
23864  */
23865 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_err(struct LDKDecodeError e);
23866
23867 /**
23868  * Checks if the given object is currently in the success state
23869  */
23870 bool CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(const struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR o);
23871
23872 /**
23873  * Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
23874  */
23875 void CResult_HTLCOutputInCommitmentDecodeErrorZ_free(struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res);
23876
23877 /**
23878  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
23879  * but with all dynamically-allocated buffers duplicated in new buffers.
23880  */
23881 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(const struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR orig);
23882
23883 /**
23884  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
23885  */
23886 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(struct LDKCounterpartyChannelTransactionParameters o);
23887
23888 /**
23889  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
23890  */
23891 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e);
23892
23893 /**
23894  * Checks if the given object is currently in the success state
23895  */
23896 bool CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(const struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR o);
23897
23898 /**
23899  * Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
23900  */
23901 void CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res);
23902
23903 /**
23904  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
23905  * but with all dynamically-allocated buffers duplicated in new buffers.
23906  */
23907 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig);
23908
23909 /**
23910  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
23911  */
23912 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_ok(struct LDKChannelTransactionParameters o);
23913
23914 /**
23915  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
23916  */
23917 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e);
23918
23919 /**
23920  * Checks if the given object is currently in the success state
23921  */
23922 bool CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(const struct LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR o);
23923
23924 /**
23925  * Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
23926  */
23927 void CResult_ChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_ChannelTransactionParametersDecodeErrorZ _res);
23928
23929 /**
23930  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
23931  * but with all dynamically-allocated buffers duplicated in new buffers.
23932  */
23933 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig);
23934
23935 /**
23936  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
23937  */
23938 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_ok(struct LDKHolderCommitmentTransaction o);
23939
23940 /**
23941  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
23942  */
23943 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
23944
23945 /**
23946  * Checks if the given object is currently in the success state
23947  */
23948 bool CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR o);
23949
23950 /**
23951  * Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
23952  */
23953 void CResult_HolderCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res);
23954
23955 /**
23956  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
23957  * but with all dynamically-allocated buffers duplicated in new buffers.
23958  */
23959 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
23960
23961 /**
23962  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
23963  */
23964 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(struct LDKBuiltCommitmentTransaction o);
23965
23966 /**
23967  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
23968  */
23969 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
23970
23971 /**
23972  * Checks if the given object is currently in the success state
23973  */
23974 bool CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR o);
23975
23976 /**
23977  * Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
23978  */
23979 void CResult_BuiltCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res);
23980
23981 /**
23982  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
23983  * but with all dynamically-allocated buffers duplicated in new buffers.
23984  */
23985 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
23986
23987 /**
23988  * Creates a new CResult_TrustedClosingTransactionNoneZ in the success state.
23989  */
23990 struct LDKCResult_TrustedClosingTransactionNoneZ CResult_TrustedClosingTransactionNoneZ_ok(struct LDKTrustedClosingTransaction o);
23991
23992 /**
23993  * Creates a new CResult_TrustedClosingTransactionNoneZ in the error state.
23994  */
23995 struct LDKCResult_TrustedClosingTransactionNoneZ CResult_TrustedClosingTransactionNoneZ_err(void);
23996
23997 /**
23998  * Checks if the given object is currently in the success state
23999  */
24000 bool CResult_TrustedClosingTransactionNoneZ_is_ok(const struct LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR o);
24001
24002 /**
24003  * Frees any resources used by the CResult_TrustedClosingTransactionNoneZ.
24004  */
24005 void CResult_TrustedClosingTransactionNoneZ_free(struct LDKCResult_TrustedClosingTransactionNoneZ _res);
24006
24007 /**
24008  * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
24009  */
24010 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_ok(struct LDKCommitmentTransaction o);
24011
24012 /**
24013  * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
24014  */
24015 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
24016
24017 /**
24018  * Checks if the given object is currently in the success state
24019  */
24020 bool CResult_CommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR o);
24021
24022 /**
24023  * Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
24024  */
24025 void CResult_CommitmentTransactionDecodeErrorZ_free(struct LDKCResult_CommitmentTransactionDecodeErrorZ _res);
24026
24027 /**
24028  * Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
24029  * but with all dynamically-allocated buffers duplicated in new buffers.
24030  */
24031 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
24032
24033 /**
24034  * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
24035  */
24036 struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_ok(struct LDKTrustedCommitmentTransaction o);
24037
24038 /**
24039  * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
24040  */
24041 struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_err(void);
24042
24043 /**
24044  * Checks if the given object is currently in the success state
24045  */
24046 bool CResult_TrustedCommitmentTransactionNoneZ_is_ok(const struct LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR o);
24047
24048 /**
24049  * Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
24050  */
24051 void CResult_TrustedCommitmentTransactionNoneZ_free(struct LDKCResult_TrustedCommitmentTransactionNoneZ _res);
24052
24053 /**
24054  * Creates a new CResult_CVec_SignatureZNoneZ in the success state.
24055  */
24056 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_ok(struct LDKCVec_SignatureZ o);
24057
24058 /**
24059  * Creates a new CResult_CVec_SignatureZNoneZ in the error state.
24060  */
24061 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_err(void);
24062
24063 /**
24064  * Checks if the given object is currently in the success state
24065  */
24066 bool CResult_CVec_SignatureZNoneZ_is_ok(const struct LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR o);
24067
24068 /**
24069  * Frees any resources used by the CResult_CVec_SignatureZNoneZ.
24070  */
24071 void CResult_CVec_SignatureZNoneZ_free(struct LDKCResult_CVec_SignatureZNoneZ _res);
24072
24073 /**
24074  * Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig`
24075  * but with all dynamically-allocated buffers duplicated in new buffers.
24076  */
24077 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_clone(const struct LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR orig);
24078
24079 /**
24080  * Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state.
24081  */
24082 struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_ok(struct LDKShutdownScript o);
24083
24084 /**
24085  * Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state.
24086  */
24087 struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_err(struct LDKDecodeError e);
24088
24089 /**
24090  * Checks if the given object is currently in the success state
24091  */
24092 bool CResult_ShutdownScriptDecodeErrorZ_is_ok(const struct LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR o);
24093
24094 /**
24095  * Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ.
24096  */
24097 void CResult_ShutdownScriptDecodeErrorZ_free(struct LDKCResult_ShutdownScriptDecodeErrorZ _res);
24098
24099 /**
24100  * Creates a new CResult_ShutdownScriptDecodeErrorZ which has the same data as `orig`
24101  * but with all dynamically-allocated buffers duplicated in new buffers.
24102  */
24103 struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_clone(const struct LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR orig);
24104
24105 /**
24106  * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state.
24107  */
24108 struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_ok(struct LDKShutdownScript o);
24109
24110 /**
24111  * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state.
24112  */
24113 struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_err(struct LDKInvalidShutdownScript e);
24114
24115 /**
24116  * Checks if the given object is currently in the success state
24117  */
24118 bool CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(const struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR o);
24119
24120 /**
24121  * Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ.
24122  */
24123 void CResult_ShutdownScriptInvalidShutdownScriptZ_free(struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res);
24124
24125 /**
24126  * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ which has the same data as `orig`
24127  * but with all dynamically-allocated buffers duplicated in new buffers.
24128  */
24129 struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_clone(const struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR orig);
24130
24131 /**
24132  * Creates a new CResult_PaymentPurposeDecodeErrorZ in the success state.
24133  */
24134 struct LDKCResult_PaymentPurposeDecodeErrorZ CResult_PaymentPurposeDecodeErrorZ_ok(struct LDKPaymentPurpose o);
24135
24136 /**
24137  * Creates a new CResult_PaymentPurposeDecodeErrorZ in the error state.
24138  */
24139 struct LDKCResult_PaymentPurposeDecodeErrorZ CResult_PaymentPurposeDecodeErrorZ_err(struct LDKDecodeError e);
24140
24141 /**
24142  * Checks if the given object is currently in the success state
24143  */
24144 bool CResult_PaymentPurposeDecodeErrorZ_is_ok(const struct LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR o);
24145
24146 /**
24147  * Frees any resources used by the CResult_PaymentPurposeDecodeErrorZ.
24148  */
24149 void CResult_PaymentPurposeDecodeErrorZ_free(struct LDKCResult_PaymentPurposeDecodeErrorZ _res);
24150
24151 /**
24152  * Creates a new CResult_PaymentPurposeDecodeErrorZ which has the same data as `orig`
24153  * but with all dynamically-allocated buffers duplicated in new buffers.
24154  */
24155 struct LDKCResult_PaymentPurposeDecodeErrorZ CResult_PaymentPurposeDecodeErrorZ_clone(const struct LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR orig);
24156
24157 /**
24158  * Constructs a new COption_PathFailureZ containing a crate::lightning::events::PathFailure
24159  */
24160 struct LDKCOption_PathFailureZ COption_PathFailureZ_some(struct LDKPathFailure o);
24161
24162 /**
24163  * Constructs a new COption_PathFailureZ containing nothing
24164  */
24165 struct LDKCOption_PathFailureZ COption_PathFailureZ_none(void);
24166
24167 /**
24168  * Frees any resources associated with the crate::lightning::events::PathFailure, if we are in the Some state
24169  */
24170 void COption_PathFailureZ_free(struct LDKCOption_PathFailureZ _res);
24171
24172 /**
24173  * Creates a new COption_PathFailureZ which has the same data as `orig`
24174  * but with all dynamically-allocated buffers duplicated in new buffers.
24175  */
24176 struct LDKCOption_PathFailureZ COption_PathFailureZ_clone(const struct LDKCOption_PathFailureZ *NONNULL_PTR orig);
24177
24178 /**
24179  * Creates a new CResult_COption_PathFailureZDecodeErrorZ in the success state.
24180  */
24181 struct LDKCResult_COption_PathFailureZDecodeErrorZ CResult_COption_PathFailureZDecodeErrorZ_ok(struct LDKCOption_PathFailureZ o);
24182
24183 /**
24184  * Creates a new CResult_COption_PathFailureZDecodeErrorZ in the error state.
24185  */
24186 struct LDKCResult_COption_PathFailureZDecodeErrorZ CResult_COption_PathFailureZDecodeErrorZ_err(struct LDKDecodeError e);
24187
24188 /**
24189  * Checks if the given object is currently in the success state
24190  */
24191 bool CResult_COption_PathFailureZDecodeErrorZ_is_ok(const struct LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR o);
24192
24193 /**
24194  * Frees any resources used by the CResult_COption_PathFailureZDecodeErrorZ.
24195  */
24196 void CResult_COption_PathFailureZDecodeErrorZ_free(struct LDKCResult_COption_PathFailureZDecodeErrorZ _res);
24197
24198 /**
24199  * Creates a new CResult_COption_PathFailureZDecodeErrorZ which has the same data as `orig`
24200  * but with all dynamically-allocated buffers duplicated in new buffers.
24201  */
24202 struct LDKCResult_COption_PathFailureZDecodeErrorZ CResult_COption_PathFailureZDecodeErrorZ_clone(const struct LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR orig);
24203
24204 /**
24205  * Constructs a new COption_ClosureReasonZ containing a crate::lightning::events::ClosureReason
24206  */
24207 struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_some(struct LDKClosureReason o);
24208
24209 /**
24210  * Constructs a new COption_ClosureReasonZ containing nothing
24211  */
24212 struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_none(void);
24213
24214 /**
24215  * Frees any resources associated with the crate::lightning::events::ClosureReason, if we are in the Some state
24216  */
24217 void COption_ClosureReasonZ_free(struct LDKCOption_ClosureReasonZ _res);
24218
24219 /**
24220  * Creates a new COption_ClosureReasonZ which has the same data as `orig`
24221  * but with all dynamically-allocated buffers duplicated in new buffers.
24222  */
24223 struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_clone(const struct LDKCOption_ClosureReasonZ *NONNULL_PTR orig);
24224
24225 /**
24226  * Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the success state.
24227  */
24228 struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_ok(struct LDKCOption_ClosureReasonZ o);
24229
24230 /**
24231  * Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the error state.
24232  */
24233 struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_err(struct LDKDecodeError e);
24234
24235 /**
24236  * Checks if the given object is currently in the success state
24237  */
24238 bool CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(const struct LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR o);
24239
24240 /**
24241  * Frees any resources used by the CResult_COption_ClosureReasonZDecodeErrorZ.
24242  */
24243 void CResult_COption_ClosureReasonZDecodeErrorZ_free(struct LDKCResult_COption_ClosureReasonZDecodeErrorZ _res);
24244
24245 /**
24246  * Creates a new CResult_COption_ClosureReasonZDecodeErrorZ which has the same data as `orig`
24247  * but with all dynamically-allocated buffers duplicated in new buffers.
24248  */
24249 struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_clone(const struct LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR orig);
24250
24251 /**
24252  * Constructs a new COption_HTLCDestinationZ containing a crate::lightning::events::HTLCDestination
24253  */
24254 struct LDKCOption_HTLCDestinationZ COption_HTLCDestinationZ_some(struct LDKHTLCDestination o);
24255
24256 /**
24257  * Constructs a new COption_HTLCDestinationZ containing nothing
24258  */
24259 struct LDKCOption_HTLCDestinationZ COption_HTLCDestinationZ_none(void);
24260
24261 /**
24262  * Frees any resources associated with the crate::lightning::events::HTLCDestination, if we are in the Some state
24263  */
24264 void COption_HTLCDestinationZ_free(struct LDKCOption_HTLCDestinationZ _res);
24265
24266 /**
24267  * Creates a new COption_HTLCDestinationZ which has the same data as `orig`
24268  * but with all dynamically-allocated buffers duplicated in new buffers.
24269  */
24270 struct LDKCOption_HTLCDestinationZ COption_HTLCDestinationZ_clone(const struct LDKCOption_HTLCDestinationZ *NONNULL_PTR orig);
24271
24272 /**
24273  * Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the success state.
24274  */
24275 struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ CResult_COption_HTLCDestinationZDecodeErrorZ_ok(struct LDKCOption_HTLCDestinationZ o);
24276
24277 /**
24278  * Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the error state.
24279  */
24280 struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ CResult_COption_HTLCDestinationZDecodeErrorZ_err(struct LDKDecodeError e);
24281
24282 /**
24283  * Checks if the given object is currently in the success state
24284  */
24285 bool CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(const struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR o);
24286
24287 /**
24288  * Frees any resources used by the CResult_COption_HTLCDestinationZDecodeErrorZ.
24289  */
24290 void CResult_COption_HTLCDestinationZDecodeErrorZ_free(struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ _res);
24291
24292 /**
24293  * Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ which has the same data as `orig`
24294  * but with all dynamically-allocated buffers duplicated in new buffers.
24295  */
24296 struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ CResult_COption_HTLCDestinationZDecodeErrorZ_clone(const struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR orig);
24297
24298 /**
24299  * Creates a new CResult_PaymentFailureReasonDecodeErrorZ in the success state.
24300  */
24301 struct LDKCResult_PaymentFailureReasonDecodeErrorZ CResult_PaymentFailureReasonDecodeErrorZ_ok(enum LDKPaymentFailureReason o);
24302
24303 /**
24304  * Creates a new CResult_PaymentFailureReasonDecodeErrorZ in the error state.
24305  */
24306 struct LDKCResult_PaymentFailureReasonDecodeErrorZ CResult_PaymentFailureReasonDecodeErrorZ_err(struct LDKDecodeError e);
24307
24308 /**
24309  * Checks if the given object is currently in the success state
24310  */
24311 bool CResult_PaymentFailureReasonDecodeErrorZ_is_ok(const struct LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR o);
24312
24313 /**
24314  * Frees any resources used by the CResult_PaymentFailureReasonDecodeErrorZ.
24315  */
24316 void CResult_PaymentFailureReasonDecodeErrorZ_free(struct LDKCResult_PaymentFailureReasonDecodeErrorZ _res);
24317
24318 /**
24319  * Creates a new CResult_PaymentFailureReasonDecodeErrorZ which has the same data as `orig`
24320  * but with all dynamically-allocated buffers duplicated in new buffers.
24321  */
24322 struct LDKCResult_PaymentFailureReasonDecodeErrorZ CResult_PaymentFailureReasonDecodeErrorZ_clone(const struct LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR orig);
24323
24324 /**
24325  * Constructs a new COption_u128Z containing a crate::c_types::U128
24326  */
24327 struct LDKCOption_u128Z COption_u128Z_some(struct LDKU128 o);
24328
24329 /**
24330  * Constructs a new COption_u128Z containing nothing
24331  */
24332 struct LDKCOption_u128Z COption_u128Z_none(void);
24333
24334 /**
24335  * Frees any resources associated with the crate::c_types::U128, if we are in the Some state
24336  */
24337 void COption_u128Z_free(struct LDKCOption_u128Z _res);
24338
24339 /**
24340  * Creates a new COption_u128Z which has the same data as `orig`
24341  * but with all dynamically-allocated buffers duplicated in new buffers.
24342  */
24343 struct LDKCOption_u128Z COption_u128Z_clone(const struct LDKCOption_u128Z *NONNULL_PTR orig);
24344
24345 /**
24346  * Constructs a new COption_PaymentIdZ containing a crate::c_types::ThirtyTwoBytes
24347  */
24348 struct LDKCOption_PaymentIdZ COption_PaymentIdZ_some(struct LDKThirtyTwoBytes o);
24349
24350 /**
24351  * Constructs a new COption_PaymentIdZ containing nothing
24352  */
24353 struct LDKCOption_PaymentIdZ COption_PaymentIdZ_none(void);
24354
24355 /**
24356  * Frees any resources associated with the crate::c_types::ThirtyTwoBytes, if we are in the Some state
24357  */
24358 void COption_PaymentIdZ_free(struct LDKCOption_PaymentIdZ _res);
24359
24360 /**
24361  * Creates a new COption_PaymentIdZ which has the same data as `orig`
24362  * but with all dynamically-allocated buffers duplicated in new buffers.
24363  */
24364 struct LDKCOption_PaymentIdZ COption_PaymentIdZ_clone(const struct LDKCOption_PaymentIdZ *NONNULL_PTR orig);
24365
24366 /**
24367  * Constructs a new COption_PaymentFailureReasonZ containing a crate::lightning::events::PaymentFailureReason
24368  */
24369 struct LDKCOption_PaymentFailureReasonZ COption_PaymentFailureReasonZ_some(enum LDKPaymentFailureReason o);
24370
24371 /**
24372  * Constructs a new COption_PaymentFailureReasonZ containing nothing
24373  */
24374 struct LDKCOption_PaymentFailureReasonZ COption_PaymentFailureReasonZ_none(void);
24375
24376 /**
24377  * Frees any resources associated with the crate::lightning::events::PaymentFailureReason, if we are in the Some state
24378  */
24379 void COption_PaymentFailureReasonZ_free(struct LDKCOption_PaymentFailureReasonZ _res);
24380
24381 /**
24382  * Creates a new COption_PaymentFailureReasonZ which has the same data as `orig`
24383  * but with all dynamically-allocated buffers duplicated in new buffers.
24384  */
24385 struct LDKCOption_PaymentFailureReasonZ COption_PaymentFailureReasonZ_clone(const struct LDKCOption_PaymentFailureReasonZ *NONNULL_PTR orig);
24386
24387 /**
24388  * Constructs a new COption_EventZ containing a crate::lightning::events::Event
24389  */
24390 struct LDKCOption_EventZ COption_EventZ_some(struct LDKEvent o);
24391
24392 /**
24393  * Constructs a new COption_EventZ containing nothing
24394  */
24395 struct LDKCOption_EventZ COption_EventZ_none(void);
24396
24397 /**
24398  * Frees any resources associated with the crate::lightning::events::Event, if we are in the Some state
24399  */
24400 void COption_EventZ_free(struct LDKCOption_EventZ _res);
24401
24402 /**
24403  * Creates a new COption_EventZ which has the same data as `orig`
24404  * but with all dynamically-allocated buffers duplicated in new buffers.
24405  */
24406 struct LDKCOption_EventZ COption_EventZ_clone(const struct LDKCOption_EventZ *NONNULL_PTR orig);
24407
24408 /**
24409  * Creates a new CResult_COption_EventZDecodeErrorZ in the success state.
24410  */
24411 struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_ok(struct LDKCOption_EventZ o);
24412
24413 /**
24414  * Creates a new CResult_COption_EventZDecodeErrorZ in the error state.
24415  */
24416 struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_err(struct LDKDecodeError e);
24417
24418 /**
24419  * Checks if the given object is currently in the success state
24420  */
24421 bool CResult_COption_EventZDecodeErrorZ_is_ok(const struct LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR o);
24422
24423 /**
24424  * Frees any resources used by the CResult_COption_EventZDecodeErrorZ.
24425  */
24426 void CResult_COption_EventZDecodeErrorZ_free(struct LDKCResult_COption_EventZDecodeErrorZ _res);
24427
24428 /**
24429  * Creates a new CResult_COption_EventZDecodeErrorZ which has the same data as `orig`
24430  * but with all dynamically-allocated buffers duplicated in new buffers.
24431  */
24432 struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_clone(const struct LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR orig);
24433
24434 /**
24435  * Frees the buffer pointed to by `data` if `datalen` is non-0.
24436  */
24437 void CVec_C2Tuple_BlockHashChannelMonitorZZ_free(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res);
24438
24439 /**
24440  * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
24441  */
24442 struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o);
24443
24444 /**
24445  * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
24446  */
24447 struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(enum LDKIOError e);
24448
24449 /**
24450  * Checks if the given object is currently in the success state
24451  */
24452 bool CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(const struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *NONNULL_PTR o);
24453
24454 /**
24455  * Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
24456  */
24457 void CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res);
24458
24459 /**
24460  * Creates a new CResult_SiPrefixBolt11ParseErrorZ in the success state.
24461  */
24462 struct LDKCResult_SiPrefixBolt11ParseErrorZ CResult_SiPrefixBolt11ParseErrorZ_ok(enum LDKSiPrefix o);
24463
24464 /**
24465  * Creates a new CResult_SiPrefixBolt11ParseErrorZ in the error state.
24466  */
24467 struct LDKCResult_SiPrefixBolt11ParseErrorZ CResult_SiPrefixBolt11ParseErrorZ_err(struct LDKBolt11ParseError e);
24468
24469 /**
24470  * Checks if the given object is currently in the success state
24471  */
24472 bool CResult_SiPrefixBolt11ParseErrorZ_is_ok(const struct LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR o);
24473
24474 /**
24475  * Frees any resources used by the CResult_SiPrefixBolt11ParseErrorZ.
24476  */
24477 void CResult_SiPrefixBolt11ParseErrorZ_free(struct LDKCResult_SiPrefixBolt11ParseErrorZ _res);
24478
24479 /**
24480  * Creates a new CResult_SiPrefixBolt11ParseErrorZ which has the same data as `orig`
24481  * but with all dynamically-allocated buffers duplicated in new buffers.
24482  */
24483 struct LDKCResult_SiPrefixBolt11ParseErrorZ CResult_SiPrefixBolt11ParseErrorZ_clone(const struct LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR orig);
24484
24485 /**
24486  * Creates a new CResult_Bolt11InvoiceParseOrSemanticErrorZ in the success state.
24487  */
24488 struct LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ CResult_Bolt11InvoiceParseOrSemanticErrorZ_ok(struct LDKBolt11Invoice o);
24489
24490 /**
24491  * Creates a new CResult_Bolt11InvoiceParseOrSemanticErrorZ in the error state.
24492  */
24493 struct LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ CResult_Bolt11InvoiceParseOrSemanticErrorZ_err(struct LDKParseOrSemanticError e);
24494
24495 /**
24496  * Checks if the given object is currently in the success state
24497  */
24498 bool CResult_Bolt11InvoiceParseOrSemanticErrorZ_is_ok(const struct LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR o);
24499
24500 /**
24501  * Frees any resources used by the CResult_Bolt11InvoiceParseOrSemanticErrorZ.
24502  */
24503 void CResult_Bolt11InvoiceParseOrSemanticErrorZ_free(struct LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ _res);
24504
24505 /**
24506  * Creates a new CResult_Bolt11InvoiceParseOrSemanticErrorZ which has the same data as `orig`
24507  * but with all dynamically-allocated buffers duplicated in new buffers.
24508  */
24509 struct LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(const struct LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR orig);
24510
24511 /**
24512  * Creates a new CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ in the success state.
24513  */
24514 struct LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_ok(struct LDKSignedRawBolt11Invoice o);
24515
24516 /**
24517  * Creates a new CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ in the error state.
24518  */
24519 struct LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_err(struct LDKBolt11ParseError e);
24520
24521 /**
24522  * Checks if the given object is currently in the success state
24523  */
24524 bool CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_is_ok(const struct LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR o);
24525
24526 /**
24527  * Frees any resources used by the CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ.
24528  */
24529 void CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_free(struct LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ _res);
24530
24531 /**
24532  * Creates a new CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ which has the same data as `orig`
24533  * but with all dynamically-allocated buffers duplicated in new buffers.
24534  */
24535 struct LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(const struct LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR orig);
24536
24537 /**
24538  * Creates a new tuple which has the same data as `orig`
24539  * but with all dynamically-allocated buffers duplicated in new buffers.
24540  */
24541 struct LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(const struct LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR orig);
24542
24543 /**
24544  * Creates a new C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ from the contained elements.
24545  */
24546 struct LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_new(struct LDKRawBolt11Invoice a, struct LDKThirtyTwoBytes b, struct LDKBolt11InvoiceSignature c);
24547
24548 /**
24549  * Frees any resources used by the C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ.
24550  */
24551 void C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_free(struct LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ _res);
24552
24553 /**
24554  * Creates a new CResult_PayeePubKeyErrorZ in the success state.
24555  */
24556 struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_ok(struct LDKPayeePubKey o);
24557
24558 /**
24559  * Creates a new CResult_PayeePubKeyErrorZ in the error state.
24560  */
24561 struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_err(enum LDKSecp256k1Error e);
24562
24563 /**
24564  * Checks if the given object is currently in the success state
24565  */
24566 bool CResult_PayeePubKeyErrorZ_is_ok(const struct LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR o);
24567
24568 /**
24569  * Frees any resources used by the CResult_PayeePubKeyErrorZ.
24570  */
24571 void CResult_PayeePubKeyErrorZ_free(struct LDKCResult_PayeePubKeyErrorZ _res);
24572
24573 /**
24574  * Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig`
24575  * but with all dynamically-allocated buffers duplicated in new buffers.
24576  */
24577 struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_clone(const struct LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR orig);
24578
24579 /**
24580  * Frees the buffer pointed to by `data` if `datalen` is non-0.
24581  */
24582 void CVec_PrivateRouteZ_free(struct LDKCVec_PrivateRouteZ _res);
24583
24584 /**
24585  * Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
24586  */
24587 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_ok(struct LDKPositiveTimestamp o);
24588
24589 /**
24590  * Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
24591  */
24592 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_err(enum LDKCreationError e);
24593
24594 /**
24595  * Checks if the given object is currently in the success state
24596  */
24597 bool CResult_PositiveTimestampCreationErrorZ_is_ok(const struct LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR o);
24598
24599 /**
24600  * Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
24601  */
24602 void CResult_PositiveTimestampCreationErrorZ_free(struct LDKCResult_PositiveTimestampCreationErrorZ _res);
24603
24604 /**
24605  * Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
24606  * but with all dynamically-allocated buffers duplicated in new buffers.
24607  */
24608 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_clone(const struct LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR orig);
24609
24610 /**
24611  * Creates a new CResult_NoneBolt11SemanticErrorZ in the success state.
24612  */
24613 struct LDKCResult_NoneBolt11SemanticErrorZ CResult_NoneBolt11SemanticErrorZ_ok(void);
24614
24615 /**
24616  * Creates a new CResult_NoneBolt11SemanticErrorZ in the error state.
24617  */
24618 struct LDKCResult_NoneBolt11SemanticErrorZ CResult_NoneBolt11SemanticErrorZ_err(enum LDKBolt11SemanticError e);
24619
24620 /**
24621  * Checks if the given object is currently in the success state
24622  */
24623 bool CResult_NoneBolt11SemanticErrorZ_is_ok(const struct LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR o);
24624
24625 /**
24626  * Frees any resources used by the CResult_NoneBolt11SemanticErrorZ.
24627  */
24628 void CResult_NoneBolt11SemanticErrorZ_free(struct LDKCResult_NoneBolt11SemanticErrorZ _res);
24629
24630 /**
24631  * Creates a new CResult_NoneBolt11SemanticErrorZ which has the same data as `orig`
24632  * but with all dynamically-allocated buffers duplicated in new buffers.
24633  */
24634 struct LDKCResult_NoneBolt11SemanticErrorZ CResult_NoneBolt11SemanticErrorZ_clone(const struct LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR orig);
24635
24636 /**
24637  * Creates a new CResult_Bolt11InvoiceBolt11SemanticErrorZ in the success state.
24638  */
24639 struct LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ CResult_Bolt11InvoiceBolt11SemanticErrorZ_ok(struct LDKBolt11Invoice o);
24640
24641 /**
24642  * Creates a new CResult_Bolt11InvoiceBolt11SemanticErrorZ in the error state.
24643  */
24644 struct LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ CResult_Bolt11InvoiceBolt11SemanticErrorZ_err(enum LDKBolt11SemanticError e);
24645
24646 /**
24647  * Checks if the given object is currently in the success state
24648  */
24649 bool CResult_Bolt11InvoiceBolt11SemanticErrorZ_is_ok(const struct LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR o);
24650
24651 /**
24652  * Frees any resources used by the CResult_Bolt11InvoiceBolt11SemanticErrorZ.
24653  */
24654 void CResult_Bolt11InvoiceBolt11SemanticErrorZ_free(struct LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ _res);
24655
24656 /**
24657  * Creates a new CResult_Bolt11InvoiceBolt11SemanticErrorZ which has the same data as `orig`
24658  * but with all dynamically-allocated buffers duplicated in new buffers.
24659  */
24660 struct LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(const struct LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR orig);
24661
24662 /**
24663  * Frees the buffer pointed to by `data` if `datalen` is non-0.
24664  */
24665 void CVec_AddressZ_free(struct LDKCVec_AddressZ _res);
24666
24667 /**
24668  * Creates a new CResult_DescriptionCreationErrorZ in the success state.
24669  */
24670 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_ok(struct LDKDescription o);
24671
24672 /**
24673  * Creates a new CResult_DescriptionCreationErrorZ in the error state.
24674  */
24675 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_err(enum LDKCreationError e);
24676
24677 /**
24678  * Checks if the given object is currently in the success state
24679  */
24680 bool CResult_DescriptionCreationErrorZ_is_ok(const struct LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR o);
24681
24682 /**
24683  * Frees any resources used by the CResult_DescriptionCreationErrorZ.
24684  */
24685 void CResult_DescriptionCreationErrorZ_free(struct LDKCResult_DescriptionCreationErrorZ _res);
24686
24687 /**
24688  * Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
24689  * but with all dynamically-allocated buffers duplicated in new buffers.
24690  */
24691 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_clone(const struct LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR orig);
24692
24693 /**
24694  * Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
24695  */
24696 struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_ok(struct LDKPrivateRoute o);
24697
24698 /**
24699  * Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
24700  */
24701 struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_err(enum LDKCreationError e);
24702
24703 /**
24704  * Checks if the given object is currently in the success state
24705  */
24706 bool CResult_PrivateRouteCreationErrorZ_is_ok(const struct LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR o);
24707
24708 /**
24709  * Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
24710  */
24711 void CResult_PrivateRouteCreationErrorZ_free(struct LDKCResult_PrivateRouteCreationErrorZ _res);
24712
24713 /**
24714  * Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
24715  * but with all dynamically-allocated buffers duplicated in new buffers.
24716  */
24717 struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_clone(const struct LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR orig);
24718
24719 /**
24720  * Creates a new CResult_OutPointDecodeErrorZ in the success state.
24721  */
24722 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_ok(struct LDKOutPoint o);
24723
24724 /**
24725  * Creates a new CResult_OutPointDecodeErrorZ in the error state.
24726  */
24727 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_err(struct LDKDecodeError e);
24728
24729 /**
24730  * Checks if the given object is currently in the success state
24731  */
24732 bool CResult_OutPointDecodeErrorZ_is_ok(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR o);
24733
24734 /**
24735  * Frees any resources used by the CResult_OutPointDecodeErrorZ.
24736  */
24737 void CResult_OutPointDecodeErrorZ_free(struct LDKCResult_OutPointDecodeErrorZ _res);
24738
24739 /**
24740  * Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
24741  * but with all dynamically-allocated buffers duplicated in new buffers.
24742  */
24743 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_clone(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR orig);
24744
24745 /**
24746  * Creates a new CResult_BigSizeDecodeErrorZ in the success state.
24747  */
24748 struct LDKCResult_BigSizeDecodeErrorZ CResult_BigSizeDecodeErrorZ_ok(struct LDKBigSize o);
24749
24750 /**
24751  * Creates a new CResult_BigSizeDecodeErrorZ in the error state.
24752  */
24753 struct LDKCResult_BigSizeDecodeErrorZ CResult_BigSizeDecodeErrorZ_err(struct LDKDecodeError e);
24754
24755 /**
24756  * Checks if the given object is currently in the success state
24757  */
24758 bool CResult_BigSizeDecodeErrorZ_is_ok(const struct LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR o);
24759
24760 /**
24761  * Frees any resources used by the CResult_BigSizeDecodeErrorZ.
24762  */
24763 void CResult_BigSizeDecodeErrorZ_free(struct LDKCResult_BigSizeDecodeErrorZ _res);
24764
24765 /**
24766  * Creates a new CResult_BigSizeDecodeErrorZ which has the same data as `orig`
24767  * but with all dynamically-allocated buffers duplicated in new buffers.
24768  */
24769 struct LDKCResult_BigSizeDecodeErrorZ CResult_BigSizeDecodeErrorZ_clone(const struct LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR orig);
24770
24771 /**
24772  * Creates a new CResult_HostnameDecodeErrorZ in the success state.
24773  */
24774 struct LDKCResult_HostnameDecodeErrorZ CResult_HostnameDecodeErrorZ_ok(struct LDKHostname o);
24775
24776 /**
24777  * Creates a new CResult_HostnameDecodeErrorZ in the error state.
24778  */
24779 struct LDKCResult_HostnameDecodeErrorZ CResult_HostnameDecodeErrorZ_err(struct LDKDecodeError e);
24780
24781 /**
24782  * Checks if the given object is currently in the success state
24783  */
24784 bool CResult_HostnameDecodeErrorZ_is_ok(const struct LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR o);
24785
24786 /**
24787  * Frees any resources used by the CResult_HostnameDecodeErrorZ.
24788  */
24789 void CResult_HostnameDecodeErrorZ_free(struct LDKCResult_HostnameDecodeErrorZ _res);
24790
24791 /**
24792  * Creates a new CResult_HostnameDecodeErrorZ which has the same data as `orig`
24793  * but with all dynamically-allocated buffers duplicated in new buffers.
24794  */
24795 struct LDKCResult_HostnameDecodeErrorZ CResult_HostnameDecodeErrorZ_clone(const struct LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR orig);
24796
24797 /**
24798  * Creates a new CResult_TransactionU16LenLimitedNoneZ in the success state.
24799  */
24800 struct LDKCResult_TransactionU16LenLimitedNoneZ CResult_TransactionU16LenLimitedNoneZ_ok(struct LDKTransactionU16LenLimited o);
24801
24802 /**
24803  * Creates a new CResult_TransactionU16LenLimitedNoneZ in the error state.
24804  */
24805 struct LDKCResult_TransactionU16LenLimitedNoneZ CResult_TransactionU16LenLimitedNoneZ_err(void);
24806
24807 /**
24808  * Checks if the given object is currently in the success state
24809  */
24810 bool CResult_TransactionU16LenLimitedNoneZ_is_ok(const struct LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR o);
24811
24812 /**
24813  * Frees any resources used by the CResult_TransactionU16LenLimitedNoneZ.
24814  */
24815 void CResult_TransactionU16LenLimitedNoneZ_free(struct LDKCResult_TransactionU16LenLimitedNoneZ _res);
24816
24817 /**
24818  * Creates a new CResult_TransactionU16LenLimitedNoneZ which has the same data as `orig`
24819  * but with all dynamically-allocated buffers duplicated in new buffers.
24820  */
24821 struct LDKCResult_TransactionU16LenLimitedNoneZ CResult_TransactionU16LenLimitedNoneZ_clone(const struct LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR orig);
24822
24823 /**
24824  * Creates a new CResult_TransactionU16LenLimitedDecodeErrorZ in the success state.
24825  */
24826 struct LDKCResult_TransactionU16LenLimitedDecodeErrorZ CResult_TransactionU16LenLimitedDecodeErrorZ_ok(struct LDKTransactionU16LenLimited o);
24827
24828 /**
24829  * Creates a new CResult_TransactionU16LenLimitedDecodeErrorZ in the error state.
24830  */
24831 struct LDKCResult_TransactionU16LenLimitedDecodeErrorZ CResult_TransactionU16LenLimitedDecodeErrorZ_err(struct LDKDecodeError e);
24832
24833 /**
24834  * Checks if the given object is currently in the success state
24835  */
24836 bool CResult_TransactionU16LenLimitedDecodeErrorZ_is_ok(const struct LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR o);
24837
24838 /**
24839  * Frees any resources used by the CResult_TransactionU16LenLimitedDecodeErrorZ.
24840  */
24841 void CResult_TransactionU16LenLimitedDecodeErrorZ_free(struct LDKCResult_TransactionU16LenLimitedDecodeErrorZ _res);
24842
24843 /**
24844  * Creates a new CResult_TransactionU16LenLimitedDecodeErrorZ which has the same data as `orig`
24845  * but with all dynamically-allocated buffers duplicated in new buffers.
24846  */
24847 struct LDKCResult_TransactionU16LenLimitedDecodeErrorZ CResult_TransactionU16LenLimitedDecodeErrorZ_clone(const struct LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR orig);
24848
24849 /**
24850  * Creates a new CResult_UntrustedStringDecodeErrorZ in the success state.
24851  */
24852 struct LDKCResult_UntrustedStringDecodeErrorZ CResult_UntrustedStringDecodeErrorZ_ok(struct LDKUntrustedString o);
24853
24854 /**
24855  * Creates a new CResult_UntrustedStringDecodeErrorZ in the error state.
24856  */
24857 struct LDKCResult_UntrustedStringDecodeErrorZ CResult_UntrustedStringDecodeErrorZ_err(struct LDKDecodeError e);
24858
24859 /**
24860  * Checks if the given object is currently in the success state
24861  */
24862 bool CResult_UntrustedStringDecodeErrorZ_is_ok(const struct LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR o);
24863
24864 /**
24865  * Frees any resources used by the CResult_UntrustedStringDecodeErrorZ.
24866  */
24867 void CResult_UntrustedStringDecodeErrorZ_free(struct LDKCResult_UntrustedStringDecodeErrorZ _res);
24868
24869 /**
24870  * Creates a new CResult_UntrustedStringDecodeErrorZ which has the same data as `orig`
24871  * but with all dynamically-allocated buffers duplicated in new buffers.
24872  */
24873 struct LDKCResult_UntrustedStringDecodeErrorZ CResult_UntrustedStringDecodeErrorZ_clone(const struct LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR orig);
24874
24875 /**
24876  * Creates a new CResult_PaymentIdPaymentErrorZ in the success state.
24877  */
24878 struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_ok(struct LDKThirtyTwoBytes o);
24879
24880 /**
24881  * Creates a new CResult_PaymentIdPaymentErrorZ in the error state.
24882  */
24883 struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_err(struct LDKPaymentError e);
24884
24885 /**
24886  * Checks if the given object is currently in the success state
24887  */
24888 bool CResult_PaymentIdPaymentErrorZ_is_ok(const struct LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR o);
24889
24890 /**
24891  * Frees any resources used by the CResult_PaymentIdPaymentErrorZ.
24892  */
24893 void CResult_PaymentIdPaymentErrorZ_free(struct LDKCResult_PaymentIdPaymentErrorZ _res);
24894
24895 /**
24896  * Creates a new CResult_PaymentIdPaymentErrorZ which has the same data as `orig`
24897  * but with all dynamically-allocated buffers duplicated in new buffers.
24898  */
24899 struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_clone(const struct LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR orig);
24900
24901 /**
24902  * Creates a new CResult_NonePaymentErrorZ in the success state.
24903  */
24904 struct LDKCResult_NonePaymentErrorZ CResult_NonePaymentErrorZ_ok(void);
24905
24906 /**
24907  * Creates a new CResult_NonePaymentErrorZ in the error state.
24908  */
24909 struct LDKCResult_NonePaymentErrorZ CResult_NonePaymentErrorZ_err(struct LDKPaymentError e);
24910
24911 /**
24912  * Checks if the given object is currently in the success state
24913  */
24914 bool CResult_NonePaymentErrorZ_is_ok(const struct LDKCResult_NonePaymentErrorZ *NONNULL_PTR o);
24915
24916 /**
24917  * Frees any resources used by the CResult_NonePaymentErrorZ.
24918  */
24919 void CResult_NonePaymentErrorZ_free(struct LDKCResult_NonePaymentErrorZ _res);
24920
24921 /**
24922  * Creates a new CResult_NonePaymentErrorZ which has the same data as `orig`
24923  * but with all dynamically-allocated buffers duplicated in new buffers.
24924  */
24925 struct LDKCResult_NonePaymentErrorZ CResult_NonePaymentErrorZ_clone(const struct LDKCResult_NonePaymentErrorZ *NONNULL_PTR orig);
24926
24927 /**
24928  * Creates a new CResult_StringErrorZ in the success state.
24929  */
24930 struct LDKCResult_StringErrorZ CResult_StringErrorZ_ok(struct LDKStr o);
24931
24932 /**
24933  * Creates a new CResult_StringErrorZ in the error state.
24934  */
24935 struct LDKCResult_StringErrorZ CResult_StringErrorZ_err(enum LDKSecp256k1Error e);
24936
24937 /**
24938  * Checks if the given object is currently in the success state
24939  */
24940 bool CResult_StringErrorZ_is_ok(const struct LDKCResult_StringErrorZ *NONNULL_PTR o);
24941
24942 /**
24943  * Frees any resources used by the CResult_StringErrorZ.
24944  */
24945 void CResult_StringErrorZ_free(struct LDKCResult_StringErrorZ _res);
24946
24947 /**
24948  * Creates a new CResult_StringErrorZ which has the same data as `orig`
24949  * but with all dynamically-allocated buffers duplicated in new buffers.
24950  */
24951 struct LDKCResult_StringErrorZ CResult_StringErrorZ_clone(const struct LDKCResult_StringErrorZ *NONNULL_PTR orig);
24952
24953 /**
24954  * Creates a new CResult_TxOutUtxoLookupErrorZ in the success state.
24955  */
24956 struct LDKCResult_TxOutUtxoLookupErrorZ CResult_TxOutUtxoLookupErrorZ_ok(struct LDKTxOut o);
24957
24958 /**
24959  * Creates a new CResult_TxOutUtxoLookupErrorZ in the error state.
24960  */
24961 struct LDKCResult_TxOutUtxoLookupErrorZ CResult_TxOutUtxoLookupErrorZ_err(enum LDKUtxoLookupError e);
24962
24963 /**
24964  * Checks if the given object is currently in the success state
24965  */
24966 bool CResult_TxOutUtxoLookupErrorZ_is_ok(const struct LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR o);
24967
24968 /**
24969  * Frees any resources used by the CResult_TxOutUtxoLookupErrorZ.
24970  */
24971 void CResult_TxOutUtxoLookupErrorZ_free(struct LDKCResult_TxOutUtxoLookupErrorZ _res);
24972
24973 /**
24974  * Creates a new CResult_TxOutUtxoLookupErrorZ which has the same data as `orig`
24975  * but with all dynamically-allocated buffers duplicated in new buffers.
24976  */
24977 struct LDKCResult_TxOutUtxoLookupErrorZ CResult_TxOutUtxoLookupErrorZ_clone(const struct LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR orig);
24978
24979 /**
24980  * Creates a new CResult_OnionMessagePathNoneZ in the success state.
24981  */
24982 struct LDKCResult_OnionMessagePathNoneZ CResult_OnionMessagePathNoneZ_ok(struct LDKOnionMessagePath o);
24983
24984 /**
24985  * Creates a new CResult_OnionMessagePathNoneZ in the error state.
24986  */
24987 struct LDKCResult_OnionMessagePathNoneZ CResult_OnionMessagePathNoneZ_err(void);
24988
24989 /**
24990  * Checks if the given object is currently in the success state
24991  */
24992 bool CResult_OnionMessagePathNoneZ_is_ok(const struct LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR o);
24993
24994 /**
24995  * Frees any resources used by the CResult_OnionMessagePathNoneZ.
24996  */
24997 void CResult_OnionMessagePathNoneZ_free(struct LDKCResult_OnionMessagePathNoneZ _res);
24998
24999 /**
25000  * Creates a new CResult_OnionMessagePathNoneZ which has the same data as `orig`
25001  * but with all dynamically-allocated buffers duplicated in new buffers.
25002  */
25003 struct LDKCResult_OnionMessagePathNoneZ CResult_OnionMessagePathNoneZ_clone(const struct LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR orig);
25004
25005 /**
25006  * Creates a new CResult_NoneSendErrorZ in the success state.
25007  */
25008 struct LDKCResult_NoneSendErrorZ CResult_NoneSendErrorZ_ok(void);
25009
25010 /**
25011  * Creates a new CResult_NoneSendErrorZ in the error state.
25012  */
25013 struct LDKCResult_NoneSendErrorZ CResult_NoneSendErrorZ_err(struct LDKSendError e);
25014
25015 /**
25016  * Checks if the given object is currently in the success state
25017  */
25018 bool CResult_NoneSendErrorZ_is_ok(const struct LDKCResult_NoneSendErrorZ *NONNULL_PTR o);
25019
25020 /**
25021  * Frees any resources used by the CResult_NoneSendErrorZ.
25022  */
25023 void CResult_NoneSendErrorZ_free(struct LDKCResult_NoneSendErrorZ _res);
25024
25025 /**
25026  * Creates a new CResult_BlindedPathNoneZ in the success state.
25027  */
25028 struct LDKCResult_BlindedPathNoneZ CResult_BlindedPathNoneZ_ok(struct LDKBlindedPath o);
25029
25030 /**
25031  * Creates a new CResult_BlindedPathNoneZ in the error state.
25032  */
25033 struct LDKCResult_BlindedPathNoneZ CResult_BlindedPathNoneZ_err(void);
25034
25035 /**
25036  * Checks if the given object is currently in the success state
25037  */
25038 bool CResult_BlindedPathNoneZ_is_ok(const struct LDKCResult_BlindedPathNoneZ *NONNULL_PTR o);
25039
25040 /**
25041  * Frees any resources used by the CResult_BlindedPathNoneZ.
25042  */
25043 void CResult_BlindedPathNoneZ_free(struct LDKCResult_BlindedPathNoneZ _res);
25044
25045 /**
25046  * Creates a new CResult_BlindedPathNoneZ which has the same data as `orig`
25047  * but with all dynamically-allocated buffers duplicated in new buffers.
25048  */
25049 struct LDKCResult_BlindedPathNoneZ CResult_BlindedPathNoneZ_clone(const struct LDKCResult_BlindedPathNoneZ *NONNULL_PTR orig);
25050
25051 /**
25052  * Creates a new CResult_BlindedPathDecodeErrorZ in the success state.
25053  */
25054 struct LDKCResult_BlindedPathDecodeErrorZ CResult_BlindedPathDecodeErrorZ_ok(struct LDKBlindedPath o);
25055
25056 /**
25057  * Creates a new CResult_BlindedPathDecodeErrorZ in the error state.
25058  */
25059 struct LDKCResult_BlindedPathDecodeErrorZ CResult_BlindedPathDecodeErrorZ_err(struct LDKDecodeError e);
25060
25061 /**
25062  * Checks if the given object is currently in the success state
25063  */
25064 bool CResult_BlindedPathDecodeErrorZ_is_ok(const struct LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR o);
25065
25066 /**
25067  * Frees any resources used by the CResult_BlindedPathDecodeErrorZ.
25068  */
25069 void CResult_BlindedPathDecodeErrorZ_free(struct LDKCResult_BlindedPathDecodeErrorZ _res);
25070
25071 /**
25072  * Creates a new CResult_BlindedPathDecodeErrorZ which has the same data as `orig`
25073  * but with all dynamically-allocated buffers duplicated in new buffers.
25074  */
25075 struct LDKCResult_BlindedPathDecodeErrorZ CResult_BlindedPathDecodeErrorZ_clone(const struct LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR orig);
25076
25077 /**
25078  * Creates a new CResult_BlindedHopDecodeErrorZ in the success state.
25079  */
25080 struct LDKCResult_BlindedHopDecodeErrorZ CResult_BlindedHopDecodeErrorZ_ok(struct LDKBlindedHop o);
25081
25082 /**
25083  * Creates a new CResult_BlindedHopDecodeErrorZ in the error state.
25084  */
25085 struct LDKCResult_BlindedHopDecodeErrorZ CResult_BlindedHopDecodeErrorZ_err(struct LDKDecodeError e);
25086
25087 /**
25088  * Checks if the given object is currently in the success state
25089  */
25090 bool CResult_BlindedHopDecodeErrorZ_is_ok(const struct LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR o);
25091
25092 /**
25093  * Frees any resources used by the CResult_BlindedHopDecodeErrorZ.
25094  */
25095 void CResult_BlindedHopDecodeErrorZ_free(struct LDKCResult_BlindedHopDecodeErrorZ _res);
25096
25097 /**
25098  * Creates a new CResult_BlindedHopDecodeErrorZ which has the same data as `orig`
25099  * but with all dynamically-allocated buffers duplicated in new buffers.
25100  */
25101 struct LDKCResult_BlindedHopDecodeErrorZ CResult_BlindedHopDecodeErrorZ_clone(const struct LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR orig);
25102
25103 /**
25104  * Creates a new CResult_InvoiceErrorDecodeErrorZ in the success state.
25105  */
25106 struct LDKCResult_InvoiceErrorDecodeErrorZ CResult_InvoiceErrorDecodeErrorZ_ok(struct LDKInvoiceError o);
25107
25108 /**
25109  * Creates a new CResult_InvoiceErrorDecodeErrorZ in the error state.
25110  */
25111 struct LDKCResult_InvoiceErrorDecodeErrorZ CResult_InvoiceErrorDecodeErrorZ_err(struct LDKDecodeError e);
25112
25113 /**
25114  * Checks if the given object is currently in the success state
25115  */
25116 bool CResult_InvoiceErrorDecodeErrorZ_is_ok(const struct LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR o);
25117
25118 /**
25119  * Frees any resources used by the CResult_InvoiceErrorDecodeErrorZ.
25120  */
25121 void CResult_InvoiceErrorDecodeErrorZ_free(struct LDKCResult_InvoiceErrorDecodeErrorZ _res);
25122
25123 /**
25124  * Creates a new CResult_InvoiceErrorDecodeErrorZ which has the same data as `orig`
25125  * but with all dynamically-allocated buffers duplicated in new buffers.
25126  */
25127 struct LDKCResult_InvoiceErrorDecodeErrorZ CResult_InvoiceErrorDecodeErrorZ_clone(const struct LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR orig);
25128
25129 /**
25130  * Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter
25131  */
25132 struct LDKCOption_FilterZ COption_FilterZ_some(struct LDKFilter o);
25133
25134 /**
25135  * Constructs a new COption_FilterZ containing nothing
25136  */
25137 struct LDKCOption_FilterZ COption_FilterZ_none(void);
25138
25139 /**
25140  * Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state
25141  */
25142 void COption_FilterZ_free(struct LDKCOption_FilterZ _res);
25143
25144 /**
25145  * Creates a new CResult_LockedChannelMonitorNoneZ in the success state.
25146  */
25147 struct LDKCResult_LockedChannelMonitorNoneZ CResult_LockedChannelMonitorNoneZ_ok(struct LDKLockedChannelMonitor o);
25148
25149 /**
25150  * Creates a new CResult_LockedChannelMonitorNoneZ in the error state.
25151  */
25152 struct LDKCResult_LockedChannelMonitorNoneZ CResult_LockedChannelMonitorNoneZ_err(void);
25153
25154 /**
25155  * Checks if the given object is currently in the success state
25156  */
25157 bool CResult_LockedChannelMonitorNoneZ_is_ok(const struct LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR o);
25158
25159 /**
25160  * Frees any resources used by the CResult_LockedChannelMonitorNoneZ.
25161  */
25162 void CResult_LockedChannelMonitorNoneZ_free(struct LDKCResult_LockedChannelMonitorNoneZ _res);
25163
25164 /**
25165  * Frees the buffer pointed to by `data` if `datalen` is non-0.
25166  */
25167 void CVec_OutPointZ_free(struct LDKCVec_OutPointZ _res);
25168
25169 /**
25170  * Frees the buffer pointed to by `data` if `datalen` is non-0.
25171  */
25172 void CVec_MonitorUpdateIdZ_free(struct LDKCVec_MonitorUpdateIdZ _res);
25173
25174 /**
25175  * Creates a new tuple which has the same data as `orig`
25176  * but with all dynamically-allocated buffers duplicated in new buffers.
25177  */
25178 struct LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(const struct LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR orig);
25179
25180 /**
25181  * Creates a new C2Tuple_OutPointCVec_MonitorUpdateIdZZ from the contained elements.
25182  */
25183 struct LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(struct LDKOutPoint a, struct LDKCVec_MonitorUpdateIdZ b);
25184
25185 /**
25186  * Frees any resources used by the C2Tuple_OutPointCVec_MonitorUpdateIdZZ.
25187  */
25188 void C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(struct LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ _res);
25189
25190 /**
25191  * Frees the buffer pointed to by `data` if `datalen` is non-0.
25192  */
25193 void CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(struct LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ _res);
25194
25195 /**
25196  * Frees any resources used by the APIError
25197  */
25198 void APIError_free(struct LDKAPIError this_ptr);
25199
25200 /**
25201  * Creates a copy of the APIError
25202  */
25203 struct LDKAPIError APIError_clone(const struct LDKAPIError *NONNULL_PTR orig);
25204
25205 /**
25206  * Utility method to constructs a new APIMisuseError-variant APIError
25207  */
25208 struct LDKAPIError APIError_apimisuse_error(struct LDKStr err);
25209
25210 /**
25211  * Utility method to constructs a new FeeRateTooHigh-variant APIError
25212  */
25213 struct LDKAPIError APIError_fee_rate_too_high(struct LDKStr err, uint32_t feerate);
25214
25215 /**
25216  * Utility method to constructs a new InvalidRoute-variant APIError
25217  */
25218 struct LDKAPIError APIError_invalid_route(struct LDKStr err);
25219
25220 /**
25221  * Utility method to constructs a new ChannelUnavailable-variant APIError
25222  */
25223 struct LDKAPIError APIError_channel_unavailable(struct LDKStr err);
25224
25225 /**
25226  * Utility method to constructs a new MonitorUpdateInProgress-variant APIError
25227  */
25228 struct LDKAPIError APIError_monitor_update_in_progress(void);
25229
25230 /**
25231  * Utility method to constructs a new IncompatibleShutdownScript-variant APIError
25232  */
25233 struct LDKAPIError APIError_incompatible_shutdown_script(struct LDKShutdownScript script);
25234
25235 /**
25236  * Checks if two APIErrors contain equal inner contents.
25237  * This ignores pointers and is_owned flags and looks at the values in fields.
25238  */
25239 bool APIError_eq(const struct LDKAPIError *NONNULL_PTR a, const struct LDKAPIError *NONNULL_PTR b);
25240
25241 /**
25242  * Serialize the APIError object into a byte array which can be read by APIError_read
25243  */
25244 struct LDKCVec_u8Z APIError_write(const struct LDKAPIError *NONNULL_PTR obj);
25245
25246 /**
25247  * Read a APIError from a byte array, created by APIError_write
25248  */
25249 struct LDKCResult_COption_APIErrorZDecodeErrorZ APIError_read(struct LDKu8slice ser);
25250
25251 /**
25252  * Frees any resources used by the BigSize, if is_owned is set and inner is non-NULL.
25253  */
25254 void BigSize_free(struct LDKBigSize this_obj);
25255
25256 uint64_t BigSize_get_a(const struct LDKBigSize *NONNULL_PTR this_ptr);
25257
25258 void BigSize_set_a(struct LDKBigSize *NONNULL_PTR this_ptr, uint64_t val);
25259
25260 /**
25261  * Constructs a new BigSize given each field
25262  */
25263 MUST_USE_RES struct LDKBigSize BigSize_new(uint64_t a_arg);
25264
25265 /**
25266  * Creates a copy of the BigSize
25267  */
25268 struct LDKBigSize BigSize_clone(const struct LDKBigSize *NONNULL_PTR orig);
25269
25270 /**
25271  * Generates a non-cryptographic 64-bit hash of the BigSize.
25272  */
25273 uint64_t BigSize_hash(const struct LDKBigSize *NONNULL_PTR o);
25274
25275 /**
25276  * Checks if two BigSizes contain equal inner contents.
25277  * This ignores pointers and is_owned flags and looks at the values in fields.
25278  * Two objects with NULL inner values will be considered "equal" here.
25279  */
25280 bool BigSize_eq(const struct LDKBigSize *NONNULL_PTR a, const struct LDKBigSize *NONNULL_PTR b);
25281
25282 /**
25283  * Serialize the BigSize object into a byte array which can be read by BigSize_read
25284  */
25285 struct LDKCVec_u8Z BigSize_write(const struct LDKBigSize *NONNULL_PTR obj);
25286
25287 /**
25288  * Read a BigSize from a byte array, created by BigSize_write
25289  */
25290 struct LDKCResult_BigSizeDecodeErrorZ BigSize_read(struct LDKu8slice ser);
25291
25292 /**
25293  * Frees any resources used by the Hostname, if is_owned is set and inner is non-NULL.
25294  */
25295 void Hostname_free(struct LDKHostname this_obj);
25296
25297 /**
25298  * Creates a copy of the Hostname
25299  */
25300 struct LDKHostname Hostname_clone(const struct LDKHostname *NONNULL_PTR orig);
25301
25302 /**
25303  * Checks if two Hostnames contain equal inner contents.
25304  * This ignores pointers and is_owned flags and looks at the values in fields.
25305  * Two objects with NULL inner values will be considered "equal" here.
25306  */
25307 bool Hostname_eq(const struct LDKHostname *NONNULL_PTR a, const struct LDKHostname *NONNULL_PTR b);
25308
25309 /**
25310  * Returns the length of the hostname.
25311  */
25312 MUST_USE_RES uint8_t Hostname_len(const struct LDKHostname *NONNULL_PTR this_arg);
25313
25314 /**
25315  * Serialize the Hostname object into a byte array which can be read by Hostname_read
25316  */
25317 struct LDKCVec_u8Z Hostname_write(const struct LDKHostname *NONNULL_PTR obj);
25318
25319 /**
25320  * Read a Hostname from a byte array, created by Hostname_write
25321  */
25322 struct LDKCResult_HostnameDecodeErrorZ Hostname_read(struct LDKu8slice ser);
25323
25324 /**
25325  * Frees any resources used by the TransactionU16LenLimited, if is_owned is set and inner is non-NULL.
25326  */
25327 void TransactionU16LenLimited_free(struct LDKTransactionU16LenLimited this_obj);
25328
25329 /**
25330  * Creates a copy of the TransactionU16LenLimited
25331  */
25332 struct LDKTransactionU16LenLimited TransactionU16LenLimited_clone(const struct LDKTransactionU16LenLimited *NONNULL_PTR orig);
25333
25334 /**
25335  * Checks if two TransactionU16LenLimiteds contain equal inner contents.
25336  * This ignores pointers and is_owned flags and looks at the values in fields.
25337  * Two objects with NULL inner values will be considered "equal" here.
25338  */
25339 bool TransactionU16LenLimited_eq(const struct LDKTransactionU16LenLimited *NONNULL_PTR a, const struct LDKTransactionU16LenLimited *NONNULL_PTR b);
25340
25341 /**
25342  * Constructs a new `TransactionU16LenLimited` from a `Transaction` only if it's consensus-
25343  * serialized length is <= u16::MAX.
25344  */
25345 MUST_USE_RES struct LDKCResult_TransactionU16LenLimitedNoneZ TransactionU16LenLimited_new(struct LDKTransaction transaction);
25346
25347 /**
25348  * Consumes this `TransactionU16LenLimited` and returns its contained `Transaction`.
25349  */
25350 MUST_USE_RES struct LDKTransaction TransactionU16LenLimited_into_transaction(struct LDKTransactionU16LenLimited this_arg);
25351
25352 /**
25353  * Serialize the TransactionU16LenLimited object into a byte array which can be read by TransactionU16LenLimited_read
25354  */
25355 struct LDKCVec_u8Z TransactionU16LenLimited_write(const struct LDKTransactionU16LenLimited *NONNULL_PTR obj);
25356
25357 /**
25358  * Read a TransactionU16LenLimited from a byte array, created by TransactionU16LenLimited_write
25359  */
25360 struct LDKCResult_TransactionU16LenLimitedDecodeErrorZ TransactionU16LenLimited_read(struct LDKu8slice ser);
25361
25362 /**
25363  * Creates a digital signature of a message given a SecretKey, like the node's secret.
25364  * 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.
25365  * Signatures are EC recoverable, meaning that given the message and the signature the PublicKey of the signer can be extracted.
25366  */
25367 struct LDKCResult_StringErrorZ sign(struct LDKu8slice msg, const uint8_t (*sk)[32]);
25368
25369 /**
25370  * Recovers the PublicKey of the signer of the message given the message and the signature.
25371  */
25372 struct LDKCResult_PublicKeyErrorZ recover_pk(struct LDKu8slice msg, struct LDKStr sig);
25373
25374 /**
25375  * Verifies a message was signed by a PrivateKey that derives to a given PublicKey, given a message, a signature,
25376  * and the PublicKey.
25377  */
25378 bool verify(struct LDKu8slice msg, struct LDKStr sig, struct LDKPublicKey pk);
25379
25380 /**
25381  * Construct the invoice's HRP and signatureless data into a preimage to be hashed.
25382  */
25383 struct LDKCVec_u8Z construct_invoice_preimage(struct LDKu8slice hrp_bytes, struct LDKCVec_U5Z data_without_signature);
25384
25385 /**
25386  * Calls the free function if one is set
25387  */
25388 void Persister_free(struct LDKPersister this_ptr);
25389
25390 /**
25391  * Frees any resources used by the UntrustedString, if is_owned is set and inner is non-NULL.
25392  */
25393 void UntrustedString_free(struct LDKUntrustedString this_obj);
25394
25395 struct LDKStr UntrustedString_get_a(const struct LDKUntrustedString *NONNULL_PTR this_ptr);
25396
25397 void UntrustedString_set_a(struct LDKUntrustedString *NONNULL_PTR this_ptr, struct LDKStr val);
25398
25399 /**
25400  * Constructs a new UntrustedString given each field
25401  */
25402 MUST_USE_RES struct LDKUntrustedString UntrustedString_new(struct LDKStr a_arg);
25403
25404 /**
25405  * Creates a copy of the UntrustedString
25406  */
25407 struct LDKUntrustedString UntrustedString_clone(const struct LDKUntrustedString *NONNULL_PTR orig);
25408
25409 /**
25410  * Checks if two UntrustedStrings contain equal inner contents.
25411  * This ignores pointers and is_owned flags and looks at the values in fields.
25412  * Two objects with NULL inner values will be considered "equal" here.
25413  */
25414 bool UntrustedString_eq(const struct LDKUntrustedString *NONNULL_PTR a, const struct LDKUntrustedString *NONNULL_PTR b);
25415
25416 /**
25417  * Serialize the UntrustedString object into a byte array which can be read by UntrustedString_read
25418  */
25419 struct LDKCVec_u8Z UntrustedString_write(const struct LDKUntrustedString *NONNULL_PTR obj);
25420
25421 /**
25422  * Read a UntrustedString from a byte array, created by UntrustedString_write
25423  */
25424 struct LDKCResult_UntrustedStringDecodeErrorZ UntrustedString_read(struct LDKu8slice ser);
25425
25426 /**
25427  * Frees any resources used by the PrintableString, if is_owned is set and inner is non-NULL.
25428  */
25429 void PrintableString_free(struct LDKPrintableString this_obj);
25430
25431 struct LDKStr PrintableString_get_a(const struct LDKPrintableString *NONNULL_PTR this_ptr);
25432
25433 void PrintableString_set_a(struct LDKPrintableString *NONNULL_PTR this_ptr, struct LDKStr val);
25434
25435 /**
25436  * Constructs a new PrintableString given each field
25437  */
25438 MUST_USE_RES struct LDKPrintableString PrintableString_new(struct LDKStr a_arg);
25439
25440 /**
25441  * Calls the free function if one is set
25442  */
25443 void FutureCallback_free(struct LDKFutureCallback this_ptr);
25444
25445 /**
25446  * Frees any resources used by the Future, if is_owned is set and inner is non-NULL.
25447  */
25448 void Future_free(struct LDKFuture this_obj);
25449
25450 /**
25451  * Creates a copy of the Future
25452  */
25453 struct LDKFuture Future_clone(const struct LDKFuture *NONNULL_PTR orig);
25454
25455 /**
25456  * Registers a callback to be called upon completion of this future. If the future has already
25457  * completed, the callback will be called immediately.
25458  */
25459 void Future_register_callback_fn(const struct LDKFuture *NONNULL_PTR this_arg, struct LDKFutureCallback callback);
25460
25461 /**
25462  * Waits until this [`Future`] completes.
25463  */
25464 void Future_wait(struct LDKFuture this_arg);
25465
25466 /**
25467  * Waits until this [`Future`] completes or the given amount of time has elapsed.
25468  *
25469  * Returns true if the [`Future`] completed, false if the time elapsed.
25470  */
25471 MUST_USE_RES bool Future_wait_timeout(struct LDKFuture this_arg, uint64_t max_wait);
25472
25473 /**
25474  * Frees any resources used by the Sleeper, if is_owned is set and inner is non-NULL.
25475  */
25476 void Sleeper_free(struct LDKSleeper this_obj);
25477
25478 /**
25479  * Constructs a new sleeper from one future, allowing blocking on it.
25480  */
25481 MUST_USE_RES struct LDKSleeper Sleeper_from_single_future(struct LDKFuture future);
25482
25483 /**
25484  * Constructs a new sleeper from two futures, allowing blocking on both at once.
25485  */
25486 MUST_USE_RES struct LDKSleeper Sleeper_from_two_futures(struct LDKFuture fut_a, struct LDKFuture fut_b);
25487
25488 /**
25489  * Constructs a new sleeper on many futures, allowing blocking on all at once.
25490  */
25491 MUST_USE_RES struct LDKSleeper Sleeper_new(struct LDKCVec_FutureZ futures);
25492
25493 /**
25494  * Wait until one of the [`Future`]s registered with this [`Sleeper`] has completed.
25495  */
25496 void Sleeper_wait(const struct LDKSleeper *NONNULL_PTR this_arg);
25497
25498 /**
25499  * Wait until one of the [`Future`]s registered with this [`Sleeper`] has completed or the
25500  * given amount of time has elapsed. Returns true if a [`Future`] completed, false if the time
25501  * elapsed.
25502  */
25503 MUST_USE_RES bool Sleeper_wait_timeout(const struct LDKSleeper *NONNULL_PTR this_arg, uint64_t max_wait);
25504
25505 /**
25506  * Creates a copy of the Level
25507  */
25508 enum LDKLevel Level_clone(const enum LDKLevel *NONNULL_PTR orig);
25509
25510 /**
25511  * Utility method to constructs a new Gossip-variant Level
25512  */
25513 enum LDKLevel Level_gossip(void);
25514
25515 /**
25516  * Utility method to constructs a new Trace-variant Level
25517  */
25518 enum LDKLevel Level_trace(void);
25519
25520 /**
25521  * Utility method to constructs a new Debug-variant Level
25522  */
25523 enum LDKLevel Level_debug(void);
25524
25525 /**
25526  * Utility method to constructs a new Info-variant Level
25527  */
25528 enum LDKLevel Level_info(void);
25529
25530 /**
25531  * Utility method to constructs a new Warn-variant Level
25532  */
25533 enum LDKLevel Level_warn(void);
25534
25535 /**
25536  * Utility method to constructs a new Error-variant Level
25537  */
25538 enum LDKLevel Level_error(void);
25539
25540 /**
25541  * Checks if two Levels contain equal inner contents.
25542  * This ignores pointers and is_owned flags and looks at the values in fields.
25543  */
25544 bool Level_eq(const enum LDKLevel *NONNULL_PTR a, const enum LDKLevel *NONNULL_PTR b);
25545
25546 /**
25547  * Generates a non-cryptographic 64-bit hash of the Level.
25548  */
25549 uint64_t Level_hash(const enum LDKLevel *NONNULL_PTR o);
25550
25551 /**
25552  * Returns the most verbose logging level.
25553  */
25554 MUST_USE_RES enum LDKLevel Level_max(void);
25555
25556 /**
25557  * Frees any resources used by the Record, if is_owned is set and inner is non-NULL.
25558  */
25559 void Record_free(struct LDKRecord this_obj);
25560
25561 /**
25562  * The verbosity level of the message.
25563  */
25564 enum LDKLevel Record_get_level(const struct LDKRecord *NONNULL_PTR this_ptr);
25565
25566 /**
25567  * The verbosity level of the message.
25568  */
25569 void Record_set_level(struct LDKRecord *NONNULL_PTR this_ptr, enum LDKLevel val);
25570
25571 /**
25572  * The message body.
25573  */
25574 struct LDKStr Record_get_args(const struct LDKRecord *NONNULL_PTR this_ptr);
25575
25576 /**
25577  * The message body.
25578  */
25579 void Record_set_args(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKStr val);
25580
25581 /**
25582  * The module path of the message.
25583  */
25584 struct LDKStr Record_get_module_path(const struct LDKRecord *NONNULL_PTR this_ptr);
25585
25586 /**
25587  * The module path of the message.
25588  */
25589 void Record_set_module_path(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKStr val);
25590
25591 /**
25592  * The source file containing the message.
25593  */
25594 struct LDKStr Record_get_file(const struct LDKRecord *NONNULL_PTR this_ptr);
25595
25596 /**
25597  * The source file containing the message.
25598  */
25599 void Record_set_file(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKStr val);
25600
25601 /**
25602  * The line containing the message.
25603  */
25604 uint32_t Record_get_line(const struct LDKRecord *NONNULL_PTR this_ptr);
25605
25606 /**
25607  * The line containing the message.
25608  */
25609 void Record_set_line(struct LDKRecord *NONNULL_PTR this_ptr, uint32_t val);
25610
25611 /**
25612  * Creates a copy of the Record
25613  */
25614 struct LDKRecord Record_clone(const struct LDKRecord *NONNULL_PTR orig);
25615
25616 /**
25617  * Calls the free function if one is set
25618  */
25619 void Logger_free(struct LDKLogger this_ptr);
25620
25621 /**
25622  * Frees any resources used by the ChannelHandshakeConfig, if is_owned is set and inner is non-NULL.
25623  */
25624 void ChannelHandshakeConfig_free(struct LDKChannelHandshakeConfig this_obj);
25625
25626 /**
25627  * Confirmations we will wait for before considering the channel locked in.
25628  * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
25629  * equivalent limit applied to outbound channels).
25630  *
25631  * A lower-bound of 1 is applied, requiring all channels to have a confirmed commitment
25632  * transaction before operation. If you wish to accept channels with zero confirmations, see
25633  * [`UserConfig::manually_accept_inbound_channels`] and
25634  * [`ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`].
25635  *
25636  * Default value: 6.
25637  *
25638  * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
25639  * [`ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel_from_trusted_peer_0conf
25640  */
25641 uint32_t ChannelHandshakeConfig_get_minimum_depth(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
25642
25643 /**
25644  * Confirmations we will wait for before considering the channel locked in.
25645  * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
25646  * equivalent limit applied to outbound channels).
25647  *
25648  * A lower-bound of 1 is applied, requiring all channels to have a confirmed commitment
25649  * transaction before operation. If you wish to accept channels with zero confirmations, see
25650  * [`UserConfig::manually_accept_inbound_channels`] and
25651  * [`ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`].
25652  *
25653  * Default value: 6.
25654  *
25655  * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
25656  * [`ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel_from_trusted_peer_0conf
25657  */
25658 void ChannelHandshakeConfig_set_minimum_depth(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint32_t val);
25659
25660 /**
25661  * Set to the number of blocks we require our counterparty to wait to claim their money (ie
25662  * the number of blocks we have to punish our counterparty if they broadcast a revoked
25663  * transaction).
25664  *
25665  * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST
25666  * be online to check for revoked transactions on-chain at least once every our_to_self_delay
25667  * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction,
25668  * possibly with time in between to RBF the spending transaction).
25669  *
25670  * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
25671  * case of an honest unilateral channel close, which implicitly decrease the economic value of
25672  * our channel.
25673  *
25674  * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you
25675  * can tweak config to ask for more security, not less.
25676  */
25677 uint16_t ChannelHandshakeConfig_get_our_to_self_delay(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
25678
25679 /**
25680  * Set to the number of blocks we require our counterparty to wait to claim their money (ie
25681  * the number of blocks we have to punish our counterparty if they broadcast a revoked
25682  * transaction).
25683  *
25684  * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST
25685  * be online to check for revoked transactions on-chain at least once every our_to_self_delay
25686  * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction,
25687  * possibly with time in between to RBF the spending transaction).
25688  *
25689  * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
25690  * case of an honest unilateral channel close, which implicitly decrease the economic value of
25691  * our channel.
25692  *
25693  * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you
25694  * can tweak config to ask for more security, not less.
25695  */
25696 void ChannelHandshakeConfig_set_our_to_self_delay(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint16_t val);
25697
25698 /**
25699  * Set to the smallest value HTLC we will accept to process.
25700  *
25701  * This value is sent to our counterparty on channel-open and we close the channel any time
25702  * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
25703  *
25704  * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
25705  * by the protocol.
25706  */
25707 uint64_t ChannelHandshakeConfig_get_our_htlc_minimum_msat(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
25708
25709 /**
25710  * Set to the smallest value HTLC we will accept to process.
25711  *
25712  * This value is sent to our counterparty on channel-open and we close the channel any time
25713  * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
25714  *
25715  * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
25716  * by the protocol.
25717  */
25718 void ChannelHandshakeConfig_set_our_htlc_minimum_msat(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint64_t val);
25719
25720 /**
25721  * Sets the percentage of the channel value we will cap the total value of outstanding inbound
25722  * HTLCs to.
25723  *
25724  * This can be set to a value between 1-100, where the value corresponds to the percent of the
25725  * channel value in whole percentages.
25726  *
25727  * Note that:
25728  * * If configured to another value than the default value 10, any new channels created with
25729  * the non default value will cause versions of LDK prior to 0.0.104 to refuse to read the
25730  * `ChannelManager`.
25731  *
25732  * * This caps the total value for inbound HTLCs in-flight only, and there's currently
25733  * no way to configure the cap for the total value of outbound HTLCs in-flight.
25734  *
25735  * * The requirements for your node being online to ensure the safety of HTLC-encumbered funds
25736  * are different from the non-HTLC-encumbered funds. This makes this an important knob to
25737  * restrict exposure to loss due to being offline for too long.
25738  * See [`ChannelHandshakeConfig::our_to_self_delay`] and [`ChannelConfig::cltv_expiry_delta`]
25739  * for more information.
25740  *
25741  * Default value: 10.
25742  * Minimum value: 1, any values less than 1 will be treated as 1 instead.
25743  * Maximum value: 100, any values larger than 100 will be treated as 100 instead.
25744  */
25745 uint8_t ChannelHandshakeConfig_get_max_inbound_htlc_value_in_flight_percent_of_channel(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
25746
25747 /**
25748  * Sets the percentage of the channel value we will cap the total value of outstanding inbound
25749  * HTLCs to.
25750  *
25751  * This can be set to a value between 1-100, where the value corresponds to the percent of the
25752  * channel value in whole percentages.
25753  *
25754  * Note that:
25755  * * If configured to another value than the default value 10, any new channels created with
25756  * the non default value will cause versions of LDK prior to 0.0.104 to refuse to read the
25757  * `ChannelManager`.
25758  *
25759  * * This caps the total value for inbound HTLCs in-flight only, and there's currently
25760  * no way to configure the cap for the total value of outbound HTLCs in-flight.
25761  *
25762  * * The requirements for your node being online to ensure the safety of HTLC-encumbered funds
25763  * are different from the non-HTLC-encumbered funds. This makes this an important knob to
25764  * restrict exposure to loss due to being offline for too long.
25765  * See [`ChannelHandshakeConfig::our_to_self_delay`] and [`ChannelConfig::cltv_expiry_delta`]
25766  * for more information.
25767  *
25768  * Default value: 10.
25769  * Minimum value: 1, any values less than 1 will be treated as 1 instead.
25770  * Maximum value: 100, any values larger than 100 will be treated as 100 instead.
25771  */
25772 void ChannelHandshakeConfig_set_max_inbound_htlc_value_in_flight_percent_of_channel(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint8_t val);
25773
25774 /**
25775  * If set, we attempt to negotiate the `scid_privacy` (referred to as `scid_alias` in the
25776  * BOLTs) option for outbound private channels. This provides better privacy by not including
25777  * our real on-chain channel UTXO in each invoice and requiring that our counterparty only
25778  * relay HTLCs to us using the channel's SCID alias.
25779  *
25780  * If this option is set, channels may be created that will not be readable by LDK versions
25781  * prior to 0.0.106, causing [`ChannelManager`]'s read method to return a
25782  * [`DecodeError::InvalidValue`].
25783  *
25784  * Note that setting this to true does *not* prevent us from opening channels with
25785  * counterparties that do not support the `scid_alias` option; we will simply fall back to a
25786  * private channel without that option.
25787  *
25788  * Ignored if the channel is negotiated to be announced, see
25789  * [`ChannelHandshakeConfig::announced_channel`] and
25790  * [`ChannelHandshakeLimits::force_announced_channel_preference`] for more.
25791  *
25792  * Default value: false. This value is likely to change to true in the future.
25793  *
25794  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
25795  * [`DecodeError::InvalidValue`]: crate::ln::msgs::DecodeError::InvalidValue
25796  */
25797 bool ChannelHandshakeConfig_get_negotiate_scid_privacy(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
25798
25799 /**
25800  * If set, we attempt to negotiate the `scid_privacy` (referred to as `scid_alias` in the
25801  * BOLTs) option for outbound private channels. This provides better privacy by not including
25802  * our real on-chain channel UTXO in each invoice and requiring that our counterparty only
25803  * relay HTLCs to us using the channel's SCID alias.
25804  *
25805  * If this option is set, channels may be created that will not be readable by LDK versions
25806  * prior to 0.0.106, causing [`ChannelManager`]'s read method to return a
25807  * [`DecodeError::InvalidValue`].
25808  *
25809  * Note that setting this to true does *not* prevent us from opening channels with
25810  * counterparties that do not support the `scid_alias` option; we will simply fall back to a
25811  * private channel without that option.
25812  *
25813  * Ignored if the channel is negotiated to be announced, see
25814  * [`ChannelHandshakeConfig::announced_channel`] and
25815  * [`ChannelHandshakeLimits::force_announced_channel_preference`] for more.
25816  *
25817  * Default value: false. This value is likely to change to true in the future.
25818  *
25819  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
25820  * [`DecodeError::InvalidValue`]: crate::ln::msgs::DecodeError::InvalidValue
25821  */
25822 void ChannelHandshakeConfig_set_negotiate_scid_privacy(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, bool val);
25823
25824 /**
25825  * Set to announce the channel publicly and notify all nodes that they can route via this
25826  * channel.
25827  *
25828  * This should only be set to true for nodes which expect to be online reliably.
25829  *
25830  * As the node which funds a channel picks this value this will only apply for new outbound
25831  * channels unless [`ChannelHandshakeLimits::force_announced_channel_preference`] is set.
25832  *
25833  * Default value: false.
25834  */
25835 bool ChannelHandshakeConfig_get_announced_channel(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
25836
25837 /**
25838  * Set to announce the channel publicly and notify all nodes that they can route via this
25839  * channel.
25840  *
25841  * This should only be set to true for nodes which expect to be online reliably.
25842  *
25843  * As the node which funds a channel picks this value this will only apply for new outbound
25844  * channels unless [`ChannelHandshakeLimits::force_announced_channel_preference`] is set.
25845  *
25846  * Default value: false.
25847  */
25848 void ChannelHandshakeConfig_set_announced_channel(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, bool val);
25849
25850 /**
25851  * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
25852  * supports it, they will then enforce the mutual-close output to us matches what we provided
25853  * at intialization, preventing us from closing to an alternate pubkey.
25854  *
25855  * This is set to true by default to provide a slight increase in security, though ultimately
25856  * any attacker who is able to take control of a channel can just as easily send the funds via
25857  * lightning payments, so we never require that our counterparties support this option.
25858  *
25859  * The upfront key committed is provided from [`SignerProvider::get_shutdown_scriptpubkey`].
25860  *
25861  * Default value: true.
25862  *
25863  * [`SignerProvider::get_shutdown_scriptpubkey`]: crate::sign::SignerProvider::get_shutdown_scriptpubkey
25864  */
25865 bool ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
25866
25867 /**
25868  * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
25869  * supports it, they will then enforce the mutual-close output to us matches what we provided
25870  * at intialization, preventing us from closing to an alternate pubkey.
25871  *
25872  * This is set to true by default to provide a slight increase in security, though ultimately
25873  * any attacker who is able to take control of a channel can just as easily send the funds via
25874  * lightning payments, so we never require that our counterparties support this option.
25875  *
25876  * The upfront key committed is provided from [`SignerProvider::get_shutdown_scriptpubkey`].
25877  *
25878  * Default value: true.
25879  *
25880  * [`SignerProvider::get_shutdown_scriptpubkey`]: crate::sign::SignerProvider::get_shutdown_scriptpubkey
25881  */
25882 void ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, bool val);
25883
25884 /**
25885  * The Proportion of the channel value to configure as counterparty's channel reserve,
25886  * i.e., `their_channel_reserve_satoshis` for both outbound and inbound channels.
25887  *
25888  * `their_channel_reserve_satoshis` is the minimum balance that the other node has to maintain
25889  * on their side, at all times.
25890  * This ensures that if our counterparty broadcasts a revoked state, we can punish them by
25891  * claiming at least this value on chain.
25892  *
25893  * Channel reserve values greater than 30% could be considered highly unreasonable, since that
25894  * amount can never be used for payments.
25895  * Also, if our selected channel reserve for counterparty and counterparty's selected
25896  * channel reserve for us sum up to equal or greater than channel value, channel negotiations
25897  * will fail.
25898  *
25899  * Note: Versions of LDK earlier than v0.0.104 will fail to read channels with any channel reserve
25900  * other than the default value.
25901  *
25902  * Default value: 1% of channel value, i.e., configured as 10,000 millionths.
25903  * Minimum value: If the calculated proportional value is less than 1000 sats, it will be treated
25904  *                as 1000 sats instead, which is a safe implementation-specific lower bound.
25905  * Maximum value: 1,000,000, any values larger than 1 Million will be treated as 1 Million (or 100%)
25906  *                instead, although channel negotiations will fail in that case.
25907  */
25908 uint32_t ChannelHandshakeConfig_get_their_channel_reserve_proportional_millionths(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
25909
25910 /**
25911  * The Proportion of the channel value to configure as counterparty's channel reserve,
25912  * i.e., `their_channel_reserve_satoshis` for both outbound and inbound channels.
25913  *
25914  * `their_channel_reserve_satoshis` is the minimum balance that the other node has to maintain
25915  * on their side, at all times.
25916  * This ensures that if our counterparty broadcasts a revoked state, we can punish them by
25917  * claiming at least this value on chain.
25918  *
25919  * Channel reserve values greater than 30% could be considered highly unreasonable, since that
25920  * amount can never be used for payments.
25921  * Also, if our selected channel reserve for counterparty and counterparty's selected
25922  * channel reserve for us sum up to equal or greater than channel value, channel negotiations
25923  * will fail.
25924  *
25925  * Note: Versions of LDK earlier than v0.0.104 will fail to read channels with any channel reserve
25926  * other than the default value.
25927  *
25928  * Default value: 1% of channel value, i.e., configured as 10,000 millionths.
25929  * Minimum value: If the calculated proportional value is less than 1000 sats, it will be treated
25930  *                as 1000 sats instead, which is a safe implementation-specific lower bound.
25931  * Maximum value: 1,000,000, any values larger than 1 Million will be treated as 1 Million (or 100%)
25932  *                instead, although channel negotiations will fail in that case.
25933  */
25934 void ChannelHandshakeConfig_set_their_channel_reserve_proportional_millionths(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint32_t val);
25935
25936 /**
25937  * If set, we attempt to negotiate the `anchors_zero_fee_htlc_tx`option for all future
25938  * channels. This feature requires having a reserve of onchain funds readily available to bump
25939  * transactions in the event of a channel force close to avoid the possibility of losing funds.
25940  *
25941  * Note that if you wish accept inbound channels with anchor outputs, you must enable
25942  * [`UserConfig::manually_accept_inbound_channels`] and manually accept them with
25943  * [`ChannelManager::accept_inbound_channel`]. This is done to give you the chance to check
25944  * whether your reserve of onchain funds is enough to cover the fees for all existing and new
25945  * channels featuring anchor outputs in the event of a force close.
25946  *
25947  * If this option is set, channels may be created that will not be readable by LDK versions
25948  * prior to 0.0.116, causing [`ChannelManager`]'s read method to return a
25949  * [`DecodeError::InvalidValue`].
25950  *
25951  * Note that setting this to true does *not* prevent us from opening channels with
25952  * counterparties that do not support the `anchors_zero_fee_htlc_tx` option; we will simply
25953  * fall back to a `static_remote_key` channel.
25954  *
25955  * LDK will not support the legacy `option_anchors` commitment version due to a discovered
25956  * vulnerability after its deployment. For more context, see the [`SIGHASH_SINGLE + update_fee
25957  * Considered Harmful`] mailing list post.
25958  *
25959  * Default value: false. This value is likely to change to true in the future.
25960  *
25961  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
25962  * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
25963  * [`DecodeError::InvalidValue`]: crate::ln::msgs::DecodeError::InvalidValue
25964  * [`SIGHASH_SINGLE + update_fee Considered Harmful`]: https://lists.linuxfoundation.org/pipermail/lightning-dev/2020-September/002796.html
25965  */
25966 bool ChannelHandshakeConfig_get_negotiate_anchors_zero_fee_htlc_tx(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
25967
25968 /**
25969  * If set, we attempt to negotiate the `anchors_zero_fee_htlc_tx`option for all future
25970  * channels. This feature requires having a reserve of onchain funds readily available to bump
25971  * transactions in the event of a channel force close to avoid the possibility of losing funds.
25972  *
25973  * Note that if you wish accept inbound channels with anchor outputs, you must enable
25974  * [`UserConfig::manually_accept_inbound_channels`] and manually accept them with
25975  * [`ChannelManager::accept_inbound_channel`]. This is done to give you the chance to check
25976  * whether your reserve of onchain funds is enough to cover the fees for all existing and new
25977  * channels featuring anchor outputs in the event of a force close.
25978  *
25979  * If this option is set, channels may be created that will not be readable by LDK versions
25980  * prior to 0.0.116, causing [`ChannelManager`]'s read method to return a
25981  * [`DecodeError::InvalidValue`].
25982  *
25983  * Note that setting this to true does *not* prevent us from opening channels with
25984  * counterparties that do not support the `anchors_zero_fee_htlc_tx` option; we will simply
25985  * fall back to a `static_remote_key` channel.
25986  *
25987  * LDK will not support the legacy `option_anchors` commitment version due to a discovered
25988  * vulnerability after its deployment. For more context, see the [`SIGHASH_SINGLE + update_fee
25989  * Considered Harmful`] mailing list post.
25990  *
25991  * Default value: false. This value is likely to change to true in the future.
25992  *
25993  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
25994  * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
25995  * [`DecodeError::InvalidValue`]: crate::ln::msgs::DecodeError::InvalidValue
25996  * [`SIGHASH_SINGLE + update_fee Considered Harmful`]: https://lists.linuxfoundation.org/pipermail/lightning-dev/2020-September/002796.html
25997  */
25998 void ChannelHandshakeConfig_set_negotiate_anchors_zero_fee_htlc_tx(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, bool val);
25999
26000 /**
26001  * The maximum number of HTLCs in-flight from our counterparty towards us at the same time.
26002  *
26003  * Increasing the value can help improve liquidity and stability in
26004  * routing at the cost of higher long term disk / DB usage.
26005  *
26006  * Note: Versions of LDK earlier than v0.0.115 will fail to read channels with a configuration
26007  * other than the default value.
26008  *
26009  * Default value: 50
26010  * Maximum value: 483, any values larger will be treated as 483.
26011  *                     This is the BOLT #2 spec limit on `max_accepted_htlcs`.
26012  */
26013 uint16_t ChannelHandshakeConfig_get_our_max_accepted_htlcs(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
26014
26015 /**
26016  * The maximum number of HTLCs in-flight from our counterparty towards us at the same time.
26017  *
26018  * Increasing the value can help improve liquidity and stability in
26019  * routing at the cost of higher long term disk / DB usage.
26020  *
26021  * Note: Versions of LDK earlier than v0.0.115 will fail to read channels with a configuration
26022  * other than the default value.
26023  *
26024  * Default value: 50
26025  * Maximum value: 483, any values larger will be treated as 483.
26026  *                     This is the BOLT #2 spec limit on `max_accepted_htlcs`.
26027  */
26028 void ChannelHandshakeConfig_set_our_max_accepted_htlcs(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint16_t val);
26029
26030 /**
26031  * Constructs a new ChannelHandshakeConfig given each field
26032  */
26033 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, bool negotiate_anchors_zero_fee_htlc_tx_arg, uint16_t our_max_accepted_htlcs_arg);
26034
26035 /**
26036  * Creates a copy of the ChannelHandshakeConfig
26037  */
26038 struct LDKChannelHandshakeConfig ChannelHandshakeConfig_clone(const struct LDKChannelHandshakeConfig *NONNULL_PTR orig);
26039
26040 /**
26041  * Creates a "default" ChannelHandshakeConfig. See struct and individual field documentaiton for details on which values are used.
26042  */
26043 MUST_USE_RES struct LDKChannelHandshakeConfig ChannelHandshakeConfig_default(void);
26044
26045 /**
26046  * Frees any resources used by the ChannelHandshakeLimits, if is_owned is set and inner is non-NULL.
26047  */
26048 void ChannelHandshakeLimits_free(struct LDKChannelHandshakeLimits this_obj);
26049
26050 /**
26051  * Minimum allowed satoshis when a channel is funded. This is supplied by the sender and so
26052  * only applies to inbound channels.
26053  *
26054  * Default value: 0.
26055  */
26056 uint64_t ChannelHandshakeLimits_get_min_funding_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
26057
26058 /**
26059  * Minimum allowed satoshis when a channel is funded. This is supplied by the sender and so
26060  * only applies to inbound channels.
26061  *
26062  * Default value: 0.
26063  */
26064 void ChannelHandshakeLimits_set_min_funding_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
26065
26066 /**
26067  * Maximum allowed satoshis when a channel is funded. This is supplied by the sender and so
26068  * only applies to inbound channels.
26069  *
26070  * Default value: 2^24 - 1.
26071  */
26072 uint64_t ChannelHandshakeLimits_get_max_funding_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
26073
26074 /**
26075  * Maximum allowed satoshis when a channel is funded. This is supplied by the sender and so
26076  * only applies to inbound channels.
26077  *
26078  * Default value: 2^24 - 1.
26079  */
26080 void ChannelHandshakeLimits_set_max_funding_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
26081
26082 /**
26083  * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
26084  * you to limit the maximum minimum-size they can require.
26085  *
26086  * Default value: u64::max_value.
26087  */
26088 uint64_t ChannelHandshakeLimits_get_max_htlc_minimum_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
26089
26090 /**
26091  * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
26092  * you to limit the maximum minimum-size they can require.
26093  *
26094  * Default value: u64::max_value.
26095  */
26096 void ChannelHandshakeLimits_set_max_htlc_minimum_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
26097
26098 /**
26099  * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
26100  * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
26101  *
26102  * Default value: 0.
26103  */
26104 uint64_t ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
26105
26106 /**
26107  * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
26108  * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
26109  *
26110  * Default value: 0.
26111  */
26112 void ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
26113
26114 /**
26115  * The remote node will require we keep a certain amount in direct payment to ourselves at all
26116  * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
26117  * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
26118  *
26119  * Default value: u64::max_value.
26120  */
26121 uint64_t ChannelHandshakeLimits_get_max_channel_reserve_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
26122
26123 /**
26124  * The remote node will require we keep a certain amount in direct payment to ourselves at all
26125  * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
26126  * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
26127  *
26128  * Default value: u64::max_value.
26129  */
26130 void ChannelHandshakeLimits_set_max_channel_reserve_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
26131
26132 /**
26133  * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
26134  * time. This allows you to set a minimum such value.
26135  *
26136  * Default value: 0.
26137  */
26138 uint16_t ChannelHandshakeLimits_get_min_max_accepted_htlcs(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
26139
26140 /**
26141  * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
26142  * time. This allows you to set a minimum such value.
26143  *
26144  * Default value: 0.
26145  */
26146 void ChannelHandshakeLimits_set_min_max_accepted_htlcs(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
26147
26148 /**
26149  * Before a channel is usable the funding transaction will need to be confirmed by at least a
26150  * certain number of blocks, specified by the node which is not the funder (as the funder can
26151  * assume they aren't going to double-spend themselves).
26152  * This config allows you to set a limit on the maximum amount of time to wait.
26153  *
26154  * Default value: 144, or roughly one day and only applies to outbound channels.
26155  */
26156 uint32_t ChannelHandshakeLimits_get_max_minimum_depth(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
26157
26158 /**
26159  * Before a channel is usable the funding transaction will need to be confirmed by at least a
26160  * certain number of blocks, specified by the node which is not the funder (as the funder can
26161  * assume they aren't going to double-spend themselves).
26162  * This config allows you to set a limit on the maximum amount of time to wait.
26163  *
26164  * Default value: 144, or roughly one day and only applies to outbound channels.
26165  */
26166 void ChannelHandshakeLimits_set_max_minimum_depth(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint32_t val);
26167
26168 /**
26169  * Whether we implicitly trust funding transactions generated by us for our own outbound
26170  * channels to not be double-spent.
26171  *
26172  * If this is set, we assume that our own funding transactions are *never* double-spent, and
26173  * thus we can trust them without any confirmations. This is generally a reasonable
26174  * assumption, given we're the only ones who could ever double-spend it (assuming we have sole
26175  * control of the signing keys).
26176  *
26177  * You may wish to un-set this if you allow the user to (or do in an automated fashion)
26178  * double-spend the funding transaction to RBF with an alternative channel open.
26179  *
26180  * This only applies if our counterparty set their confirmations-required value to 0, and we
26181  * always trust our own funding transaction at 1 confirmation irrespective of this value.
26182  * Thus, this effectively acts as a `min_minimum_depth`, with the only possible values being
26183  * `true` (0) and `false` (1).
26184  *
26185  * Default value: true
26186  */
26187 bool ChannelHandshakeLimits_get_trust_own_funding_0conf(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
26188
26189 /**
26190  * Whether we implicitly trust funding transactions generated by us for our own outbound
26191  * channels to not be double-spent.
26192  *
26193  * If this is set, we assume that our own funding transactions are *never* double-spent, and
26194  * thus we can trust them without any confirmations. This is generally a reasonable
26195  * assumption, given we're the only ones who could ever double-spend it (assuming we have sole
26196  * control of the signing keys).
26197  *
26198  * You may wish to un-set this if you allow the user to (or do in an automated fashion)
26199  * double-spend the funding transaction to RBF with an alternative channel open.
26200  *
26201  * This only applies if our counterparty set their confirmations-required value to 0, and we
26202  * always trust our own funding transaction at 1 confirmation irrespective of this value.
26203  * Thus, this effectively acts as a `min_minimum_depth`, with the only possible values being
26204  * `true` (0) and `false` (1).
26205  *
26206  * Default value: true
26207  */
26208 void ChannelHandshakeLimits_set_trust_own_funding_0conf(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, bool val);
26209
26210 /**
26211  * Set to force an incoming channel to match our announced channel preference in
26212  * [`ChannelHandshakeConfig::announced_channel`].
26213  *
26214  * For a node which is not online reliably, this should be set to true and
26215  * [`ChannelHandshakeConfig::announced_channel`] set to false, ensuring that no announced (aka public)
26216  * channels will ever be opened.
26217  *
26218  * Default value: true.
26219  */
26220 bool ChannelHandshakeLimits_get_force_announced_channel_preference(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
26221
26222 /**
26223  * Set to force an incoming channel to match our announced channel preference in
26224  * [`ChannelHandshakeConfig::announced_channel`].
26225  *
26226  * For a node which is not online reliably, this should be set to true and
26227  * [`ChannelHandshakeConfig::announced_channel`] set to false, ensuring that no announced (aka public)
26228  * channels will ever be opened.
26229  *
26230  * Default value: true.
26231  */
26232 void ChannelHandshakeLimits_set_force_announced_channel_preference(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, bool val);
26233
26234 /**
26235  * Set to the amount of time we're willing to wait to claim money back to us.
26236  *
26237  * Not checking this value would be a security issue, as our peer would be able to set it to
26238  * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
26239  *
26240  * Default value: 2016, which we also enforce as a maximum value so you can tweak config to
26241  * reduce the loss of having useless locked funds (if your peer accepts)
26242  */
26243 uint16_t ChannelHandshakeLimits_get_their_to_self_delay(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
26244
26245 /**
26246  * Set to the amount of time we're willing to wait to claim money back to us.
26247  *
26248  * Not checking this value would be a security issue, as our peer would be able to set it to
26249  * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
26250  *
26251  * Default value: 2016, which we also enforce as a maximum value so you can tweak config to
26252  * reduce the loss of having useless locked funds (if your peer accepts)
26253  */
26254 void ChannelHandshakeLimits_set_their_to_self_delay(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
26255
26256 /**
26257  * Constructs a new ChannelHandshakeLimits given each field
26258  */
26259 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);
26260
26261 /**
26262  * Creates a copy of the ChannelHandshakeLimits
26263  */
26264 struct LDKChannelHandshakeLimits ChannelHandshakeLimits_clone(const struct LDKChannelHandshakeLimits *NONNULL_PTR orig);
26265
26266 /**
26267  * Creates a "default" ChannelHandshakeLimits. See struct and individual field documentaiton for details on which values are used.
26268  */
26269 MUST_USE_RES struct LDKChannelHandshakeLimits ChannelHandshakeLimits_default(void);
26270
26271 /**
26272  * Frees any resources used by the MaxDustHTLCExposure
26273  */
26274 void MaxDustHTLCExposure_free(struct LDKMaxDustHTLCExposure this_ptr);
26275
26276 /**
26277  * Creates a copy of the MaxDustHTLCExposure
26278  */
26279 struct LDKMaxDustHTLCExposure MaxDustHTLCExposure_clone(const struct LDKMaxDustHTLCExposure *NONNULL_PTR orig);
26280
26281 /**
26282  * Utility method to constructs a new FixedLimitMsat-variant MaxDustHTLCExposure
26283  */
26284 struct LDKMaxDustHTLCExposure MaxDustHTLCExposure_fixed_limit_msat(uint64_t a);
26285
26286 /**
26287  * Utility method to constructs a new FeeRateMultiplier-variant MaxDustHTLCExposure
26288  */
26289 struct LDKMaxDustHTLCExposure MaxDustHTLCExposure_fee_rate_multiplier(uint64_t a);
26290
26291 /**
26292  * Checks if two MaxDustHTLCExposures contain equal inner contents.
26293  * This ignores pointers and is_owned flags and looks at the values in fields.
26294  */
26295 bool MaxDustHTLCExposure_eq(const struct LDKMaxDustHTLCExposure *NONNULL_PTR a, const struct LDKMaxDustHTLCExposure *NONNULL_PTR b);
26296
26297 /**
26298  * Serialize the MaxDustHTLCExposure object into a byte array which can be read by MaxDustHTLCExposure_read
26299  */
26300 struct LDKCVec_u8Z MaxDustHTLCExposure_write(const struct LDKMaxDustHTLCExposure *NONNULL_PTR obj);
26301
26302 /**
26303  * Read a MaxDustHTLCExposure from a byte array, created by MaxDustHTLCExposure_write
26304  */
26305 struct LDKCResult_MaxDustHTLCExposureDecodeErrorZ MaxDustHTLCExposure_read(struct LDKu8slice ser);
26306
26307 /**
26308  * Frees any resources used by the ChannelConfig, if is_owned is set and inner is non-NULL.
26309  */
26310 void ChannelConfig_free(struct LDKChannelConfig this_obj);
26311
26312 /**
26313  * Amount (in millionths of a satoshi) charged per satoshi for payments forwarded outbound
26314  * over the channel.
26315  * This may be allowed to change at runtime in a later update, however doing so must result in
26316  * update messages sent to notify all nodes of our updated relay fee.
26317  *
26318  * Default value: 0.
26319  */
26320 uint32_t ChannelConfig_get_forwarding_fee_proportional_millionths(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
26321
26322 /**
26323  * Amount (in millionths of a satoshi) charged per satoshi for payments forwarded outbound
26324  * over the channel.
26325  * This may be allowed to change at runtime in a later update, however doing so must result in
26326  * update messages sent to notify all nodes of our updated relay fee.
26327  *
26328  * Default value: 0.
26329  */
26330 void ChannelConfig_set_forwarding_fee_proportional_millionths(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint32_t val);
26331
26332 /**
26333  * Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in
26334  * excess of [`forwarding_fee_proportional_millionths`].
26335  * This may be allowed to change at runtime in a later update, however doing so must result in
26336  * update messages sent to notify all nodes of our updated relay fee.
26337  *
26338  * The default value of a single satoshi roughly matches the market rate on many routing nodes
26339  * as of July 2021. Adjusting it upwards or downwards may change whether nodes route through
26340  * this node.
26341  *
26342  * Default value: 1000.
26343  *
26344  * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths
26345  */
26346 uint32_t ChannelConfig_get_forwarding_fee_base_msat(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
26347
26348 /**
26349  * Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in
26350  * excess of [`forwarding_fee_proportional_millionths`].
26351  * This may be allowed to change at runtime in a later update, however doing so must result in
26352  * update messages sent to notify all nodes of our updated relay fee.
26353  *
26354  * The default value of a single satoshi roughly matches the market rate on many routing nodes
26355  * as of July 2021. Adjusting it upwards or downwards may change whether nodes route through
26356  * this node.
26357  *
26358  * Default value: 1000.
26359  *
26360  * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths
26361  */
26362 void ChannelConfig_set_forwarding_fee_base_msat(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint32_t val);
26363
26364 /**
26365  * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over
26366  * the channel this config applies to.
26367  *
26368  * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight
26369  * HTLC balance when a channel appears on-chain whereas
26370  * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining
26371  * (non-HTLC-encumbered) balance.
26372  *
26373  * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed,
26374  * we (or one of our watchtowers) MUST be online to check for broadcast of the current
26375  * commitment transaction at least once per this many blocks (minus some margin to allow us
26376  * enough time to broadcast and confirm a transaction, possibly with time in between to RBF
26377  * the spending transaction).
26378  *
26379  * Default value: 72 (12 hours at an average of 6 blocks/hour).
26380  * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as
26381  *                [`MIN_CLTV_EXPIRY_DELTA`] instead.
26382  *
26383  * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA
26384  */
26385 uint16_t ChannelConfig_get_cltv_expiry_delta(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
26386
26387 /**
26388  * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over
26389  * the channel this config applies to.
26390  *
26391  * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight
26392  * HTLC balance when a channel appears on-chain whereas
26393  * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining
26394  * (non-HTLC-encumbered) balance.
26395  *
26396  * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed,
26397  * we (or one of our watchtowers) MUST be online to check for broadcast of the current
26398  * commitment transaction at least once per this many blocks (minus some margin to allow us
26399  * enough time to broadcast and confirm a transaction, possibly with time in between to RBF
26400  * the spending transaction).
26401  *
26402  * Default value: 72 (12 hours at an average of 6 blocks/hour).
26403  * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as
26404  *                [`MIN_CLTV_EXPIRY_DELTA`] instead.
26405  *
26406  * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA
26407  */
26408 void ChannelConfig_set_cltv_expiry_delta(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint16_t val);
26409
26410 /**
26411  * Limit our total exposure to in-flight HTLCs which are burned to fees as they are too
26412  * small to claim on-chain.
26413  *
26414  * When an HTLC present in one of our channels is below a \"dust\" threshold, the HTLC will
26415  * not be claimable on-chain, instead being turned into additional miner fees if either
26416  * party force-closes the channel. Because the threshold is per-HTLC, our total exposure
26417  * to such payments may be sustantial if there are many dust HTLCs present when the
26418  * channel is force-closed.
26419  *
26420  * The dust threshold for each HTLC is based on the `dust_limit_satoshis` for each party in a
26421  * channel negotiated throughout the channel open process, along with the fees required to have
26422  * a broadcastable HTLC spending transaction. When a channel supports anchor outputs
26423  * (specifically the zero fee HTLC transaction variant), this threshold no longer takes into
26424  * account the HTLC transaction fee as it is zero. Because of this, you may want to set this
26425  * value to a fixed limit for channels using anchor outputs, while the fee rate multiplier
26426  * variant is primarily intended for use with pre-anchor channels.
26427  *
26428  * The selected limit is applied for sent, forwarded, and received HTLCs and limits the total
26429  * exposure across all three types per-channel.
26430  *
26431  * Default value: [`MaxDustHTLCExposure::FeeRateMultiplier`] with a multiplier of 5000.
26432  */
26433 struct LDKMaxDustHTLCExposure ChannelConfig_get_max_dust_htlc_exposure(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
26434
26435 /**
26436  * Limit our total exposure to in-flight HTLCs which are burned to fees as they are too
26437  * small to claim on-chain.
26438  *
26439  * When an HTLC present in one of our channels is below a \"dust\" threshold, the HTLC will
26440  * not be claimable on-chain, instead being turned into additional miner fees if either
26441  * party force-closes the channel. Because the threshold is per-HTLC, our total exposure
26442  * to such payments may be sustantial if there are many dust HTLCs present when the
26443  * channel is force-closed.
26444  *
26445  * The dust threshold for each HTLC is based on the `dust_limit_satoshis` for each party in a
26446  * channel negotiated throughout the channel open process, along with the fees required to have
26447  * a broadcastable HTLC spending transaction. When a channel supports anchor outputs
26448  * (specifically the zero fee HTLC transaction variant), this threshold no longer takes into
26449  * account the HTLC transaction fee as it is zero. Because of this, you may want to set this
26450  * value to a fixed limit for channels using anchor outputs, while the fee rate multiplier
26451  * variant is primarily intended for use with pre-anchor channels.
26452  *
26453  * The selected limit is applied for sent, forwarded, and received HTLCs and limits the total
26454  * exposure across all three types per-channel.
26455  *
26456  * Default value: [`MaxDustHTLCExposure::FeeRateMultiplier`] with a multiplier of 5000.
26457  */
26458 void ChannelConfig_set_max_dust_htlc_exposure(struct LDKChannelConfig *NONNULL_PTR this_ptr, struct LDKMaxDustHTLCExposure val);
26459
26460 /**
26461  * The additional fee we're willing to pay to avoid waiting for the counterparty's
26462  * `to_self_delay` to reclaim funds.
26463  *
26464  * When we close a channel cooperatively with our counterparty, we negotiate a fee for the
26465  * closing transaction which both sides find acceptable, ultimately paid by the channel
26466  * funder/initiator.
26467  *
26468  * When we are the funder, because we have to pay the channel closing fee, we bound the
26469  * acceptable fee by our [`Background`] and [`Normal`] fees, with the upper bound increased by
26470  * this value. Because the on-chain fee we'd pay to force-close the channel is kept near our
26471  * [`Normal`] feerate during normal operation, this value represents the additional fee we're
26472  * willing to pay in order to avoid waiting for our counterparty's to_self_delay to reclaim our
26473  * funds.
26474  *
26475  * When we are not the funder, we require the closing transaction fee pay at least our
26476  * [`Background`] fee estimate, but allow our counterparty to pay as much fee as they like.
26477  * Thus, this value is ignored when we are not the funder.
26478  *
26479  * Default value: 1000 satoshis.
26480  *
26481  * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
26482  * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
26483  */
26484 uint64_t ChannelConfig_get_force_close_avoidance_max_fee_satoshis(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
26485
26486 /**
26487  * The additional fee we're willing to pay to avoid waiting for the counterparty's
26488  * `to_self_delay` to reclaim funds.
26489  *
26490  * When we close a channel cooperatively with our counterparty, we negotiate a fee for the
26491  * closing transaction which both sides find acceptable, ultimately paid by the channel
26492  * funder/initiator.
26493  *
26494  * When we are the funder, because we have to pay the channel closing fee, we bound the
26495  * acceptable fee by our [`Background`] and [`Normal`] fees, with the upper bound increased by
26496  * this value. Because the on-chain fee we'd pay to force-close the channel is kept near our
26497  * [`Normal`] feerate during normal operation, this value represents the additional fee we're
26498  * willing to pay in order to avoid waiting for our counterparty's to_self_delay to reclaim our
26499  * funds.
26500  *
26501  * When we are not the funder, we require the closing transaction fee pay at least our
26502  * [`Background`] fee estimate, but allow our counterparty to pay as much fee as they like.
26503  * Thus, this value is ignored when we are not the funder.
26504  *
26505  * Default value: 1000 satoshis.
26506  *
26507  * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
26508  * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
26509  */
26510 void ChannelConfig_set_force_close_avoidance_max_fee_satoshis(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint64_t val);
26511
26512 /**
26513  * If set, allows this channel's counterparty to skim an additional fee off this node's inbound
26514  * HTLCs. Useful for liquidity providers to offload on-chain channel costs to end users.
26515  *
26516  * Usage:
26517  * - The payee will set this option and set its invoice route hints to use [intercept scids]
26518  *   generated by this channel's counterparty.
26519  * - The counterparty will get an [`HTLCIntercepted`] event upon payment forward, and call
26520  *   [`forward_intercepted_htlc`] with less than the amount provided in
26521  *   [`HTLCIntercepted::expected_outbound_amount_msat`]. The difference between the expected and
26522  *   actual forward amounts is their fee.
26523  *
26524  * # Note
26525  * It's important for payee wallet software to verify that [`PaymentClaimable::amount_msat`] is
26526  * as-expected if this feature is activated, otherwise they may lose money!
26527  * [`PaymentClaimable::counterparty_skimmed_fee_msat`] provides the fee taken by the
26528  * counterparty.
26529  *
26530  * # Note
26531  * Switching this config flag on may break compatibility with versions of LDK prior to 0.0.116.
26532  * Unsetting this flag between restarts may lead to payment receive failures.
26533  *
26534  * Default value: false.
26535  *
26536  * [intercept scids]: crate::ln::channelmanager::ChannelManager::get_intercept_scid
26537  * [`forward_intercepted_htlc`]: crate::ln::channelmanager::ChannelManager::forward_intercepted_htlc
26538  * [`HTLCIntercepted`]: crate::events::Event::HTLCIntercepted
26539  * [`HTLCIntercepted::expected_outbound_amount_msat`]: crate::events::Event::HTLCIntercepted::expected_outbound_amount_msat
26540  * [`PaymentClaimable::amount_msat`]: crate::events::Event::PaymentClaimable::amount_msat
26541  * [`PaymentClaimable::counterparty_skimmed_fee_msat`]: crate::events::Event::PaymentClaimable::counterparty_skimmed_fee_msat
26542  */
26543 bool ChannelConfig_get_accept_underpaying_htlcs(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
26544
26545 /**
26546  * If set, allows this channel's counterparty to skim an additional fee off this node's inbound
26547  * HTLCs. Useful for liquidity providers to offload on-chain channel costs to end users.
26548  *
26549  * Usage:
26550  * - The payee will set this option and set its invoice route hints to use [intercept scids]
26551  *   generated by this channel's counterparty.
26552  * - The counterparty will get an [`HTLCIntercepted`] event upon payment forward, and call
26553  *   [`forward_intercepted_htlc`] with less than the amount provided in
26554  *   [`HTLCIntercepted::expected_outbound_amount_msat`]. The difference between the expected and
26555  *   actual forward amounts is their fee.
26556  *
26557  * # Note
26558  * It's important for payee wallet software to verify that [`PaymentClaimable::amount_msat`] is
26559  * as-expected if this feature is activated, otherwise they may lose money!
26560  * [`PaymentClaimable::counterparty_skimmed_fee_msat`] provides the fee taken by the
26561  * counterparty.
26562  *
26563  * # Note
26564  * Switching this config flag on may break compatibility with versions of LDK prior to 0.0.116.
26565  * Unsetting this flag between restarts may lead to payment receive failures.
26566  *
26567  * Default value: false.
26568  *
26569  * [intercept scids]: crate::ln::channelmanager::ChannelManager::get_intercept_scid
26570  * [`forward_intercepted_htlc`]: crate::ln::channelmanager::ChannelManager::forward_intercepted_htlc
26571  * [`HTLCIntercepted`]: crate::events::Event::HTLCIntercepted
26572  * [`HTLCIntercepted::expected_outbound_amount_msat`]: crate::events::Event::HTLCIntercepted::expected_outbound_amount_msat
26573  * [`PaymentClaimable::amount_msat`]: crate::events::Event::PaymentClaimable::amount_msat
26574  * [`PaymentClaimable::counterparty_skimmed_fee_msat`]: crate::events::Event::PaymentClaimable::counterparty_skimmed_fee_msat
26575  */
26576 void ChannelConfig_set_accept_underpaying_htlcs(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val);
26577
26578 /**
26579  * Constructs a new ChannelConfig given each field
26580  */
26581 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, struct LDKMaxDustHTLCExposure max_dust_htlc_exposure_arg, uint64_t force_close_avoidance_max_fee_satoshis_arg, bool accept_underpaying_htlcs_arg);
26582
26583 /**
26584  * Creates a copy of the ChannelConfig
26585  */
26586 struct LDKChannelConfig ChannelConfig_clone(const struct LDKChannelConfig *NONNULL_PTR orig);
26587
26588 /**
26589  * Checks if two ChannelConfigs contain equal inner contents.
26590  * This ignores pointers and is_owned flags and looks at the values in fields.
26591  * Two objects with NULL inner values will be considered "equal" here.
26592  */
26593 bool ChannelConfig_eq(const struct LDKChannelConfig *NONNULL_PTR a, const struct LDKChannelConfig *NONNULL_PTR b);
26594
26595 /**
26596  * Applies the given [`ChannelConfigUpdate`] as a partial update to the [`ChannelConfig`].
26597  */
26598 void ChannelConfig_apply(struct LDKChannelConfig *NONNULL_PTR this_arg, const struct LDKChannelConfigUpdate *NONNULL_PTR update);
26599
26600 /**
26601  * Creates a "default" ChannelConfig. See struct and individual field documentaiton for details on which values are used.
26602  */
26603 MUST_USE_RES struct LDKChannelConfig ChannelConfig_default(void);
26604
26605 /**
26606  * Serialize the ChannelConfig object into a byte array which can be read by ChannelConfig_read
26607  */
26608 struct LDKCVec_u8Z ChannelConfig_write(const struct LDKChannelConfig *NONNULL_PTR obj);
26609
26610 /**
26611  * Read a ChannelConfig from a byte array, created by ChannelConfig_write
26612  */
26613 struct LDKCResult_ChannelConfigDecodeErrorZ ChannelConfig_read(struct LDKu8slice ser);
26614
26615 /**
26616  * Frees any resources used by the ChannelConfigUpdate, if is_owned is set and inner is non-NULL.
26617  */
26618 void ChannelConfigUpdate_free(struct LDKChannelConfigUpdate this_obj);
26619
26620 struct LDKCOption_u32Z ChannelConfigUpdate_get_forwarding_fee_proportional_millionths(const struct LDKChannelConfigUpdate *NONNULL_PTR this_ptr);
26621
26622 void ChannelConfigUpdate_set_forwarding_fee_proportional_millionths(struct LDKChannelConfigUpdate *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val);
26623
26624 struct LDKCOption_u32Z ChannelConfigUpdate_get_forwarding_fee_base_msat(const struct LDKChannelConfigUpdate *NONNULL_PTR this_ptr);
26625
26626 void ChannelConfigUpdate_set_forwarding_fee_base_msat(struct LDKChannelConfigUpdate *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val);
26627
26628 struct LDKCOption_u16Z ChannelConfigUpdate_get_cltv_expiry_delta(const struct LDKChannelConfigUpdate *NONNULL_PTR this_ptr);
26629
26630 void ChannelConfigUpdate_set_cltv_expiry_delta(struct LDKChannelConfigUpdate *NONNULL_PTR this_ptr, struct LDKCOption_u16Z val);
26631
26632 /**
26633  *
26634  * Returns a copy of the field.
26635  */
26636 struct LDKCOption_MaxDustHTLCExposureZ ChannelConfigUpdate_get_max_dust_htlc_exposure_msat(const struct LDKChannelConfigUpdate *NONNULL_PTR this_ptr);
26637
26638 void ChannelConfigUpdate_set_max_dust_htlc_exposure_msat(struct LDKChannelConfigUpdate *NONNULL_PTR this_ptr, struct LDKCOption_MaxDustHTLCExposureZ val);
26639
26640 struct LDKCOption_u64Z ChannelConfigUpdate_get_force_close_avoidance_max_fee_satoshis(const struct LDKChannelConfigUpdate *NONNULL_PTR this_ptr);
26641
26642 void ChannelConfigUpdate_set_force_close_avoidance_max_fee_satoshis(struct LDKChannelConfigUpdate *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
26643
26644 /**
26645  * Constructs a new ChannelConfigUpdate given each field
26646  */
26647 MUST_USE_RES struct LDKChannelConfigUpdate ChannelConfigUpdate_new(struct LDKCOption_u32Z forwarding_fee_proportional_millionths_arg, struct LDKCOption_u32Z forwarding_fee_base_msat_arg, struct LDKCOption_u16Z cltv_expiry_delta_arg, struct LDKCOption_MaxDustHTLCExposureZ max_dust_htlc_exposure_msat_arg, struct LDKCOption_u64Z force_close_avoidance_max_fee_satoshis_arg);
26648
26649 /**
26650  * Creates a "default" ChannelConfigUpdate. See struct and individual field documentaiton for details on which values are used.
26651  */
26652 MUST_USE_RES struct LDKChannelConfigUpdate ChannelConfigUpdate_default(void);
26653
26654 /**
26655  * Frees any resources used by the UserConfig, if is_owned is set and inner is non-NULL.
26656  */
26657 void UserConfig_free(struct LDKUserConfig this_obj);
26658
26659 /**
26660  * Channel handshake config that we propose to our counterparty.
26661  */
26662 struct LDKChannelHandshakeConfig UserConfig_get_channel_handshake_config(const struct LDKUserConfig *NONNULL_PTR this_ptr);
26663
26664 /**
26665  * Channel handshake config that we propose to our counterparty.
26666  */
26667 void UserConfig_set_channel_handshake_config(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeConfig val);
26668
26669 /**
26670  * Limits applied to our counterparty's proposed channel handshake config settings.
26671  */
26672 struct LDKChannelHandshakeLimits UserConfig_get_channel_handshake_limits(const struct LDKUserConfig *NONNULL_PTR this_ptr);
26673
26674 /**
26675  * Limits applied to our counterparty's proposed channel handshake config settings.
26676  */
26677 void UserConfig_set_channel_handshake_limits(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeLimits val);
26678
26679 /**
26680  * Channel config which affects behavior during channel lifetime.
26681  */
26682 struct LDKChannelConfig UserConfig_get_channel_config(const struct LDKUserConfig *NONNULL_PTR this_ptr);
26683
26684 /**
26685  * Channel config which affects behavior during channel lifetime.
26686  */
26687 void UserConfig_set_channel_config(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelConfig val);
26688
26689 /**
26690  * If this is set to false, we will reject any HTLCs which were to be forwarded over private
26691  * channels. This prevents us from taking on HTLC-forwarding risk when we intend to run as a
26692  * node which is not online reliably.
26693  *
26694  * For nodes which are not online reliably, you should set all channels to *not* be announced
26695  * (using [`ChannelHandshakeConfig::announced_channel`] and
26696  * [`ChannelHandshakeLimits::force_announced_channel_preference`]) and set this to false to
26697  * ensure you are not exposed to any forwarding risk.
26698  *
26699  * Note that because you cannot change a channel's announced state after creation, there is no
26700  * way to disable forwarding on public channels retroactively. Thus, in order to change a node
26701  * from a publicly-announced forwarding node to a private non-forwarding node you must close
26702  * all your channels and open new ones. For privacy, you should also change your node_id
26703  * (swapping all private and public key material for new ones) at that time.
26704  *
26705  * Default value: false.
26706  */
26707 bool UserConfig_get_accept_forwards_to_priv_channels(const struct LDKUserConfig *NONNULL_PTR this_ptr);
26708
26709 /**
26710  * If this is set to false, we will reject any HTLCs which were to be forwarded over private
26711  * channels. This prevents us from taking on HTLC-forwarding risk when we intend to run as a
26712  * node which is not online reliably.
26713  *
26714  * For nodes which are not online reliably, you should set all channels to *not* be announced
26715  * (using [`ChannelHandshakeConfig::announced_channel`] and
26716  * [`ChannelHandshakeLimits::force_announced_channel_preference`]) and set this to false to
26717  * ensure you are not exposed to any forwarding risk.
26718  *
26719  * Note that because you cannot change a channel's announced state after creation, there is no
26720  * way to disable forwarding on public channels retroactively. Thus, in order to change a node
26721  * from a publicly-announced forwarding node to a private non-forwarding node you must close
26722  * all your channels and open new ones. For privacy, you should also change your node_id
26723  * (swapping all private and public key material for new ones) at that time.
26724  *
26725  * Default value: false.
26726  */
26727 void UserConfig_set_accept_forwards_to_priv_channels(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val);
26728
26729 /**
26730  * If this is set to false, we do not accept inbound requests to open a new channel.
26731  * Default value: true.
26732  */
26733 bool UserConfig_get_accept_inbound_channels(const struct LDKUserConfig *NONNULL_PTR this_ptr);
26734
26735 /**
26736  * If this is set to false, we do not accept inbound requests to open a new channel.
26737  * Default value: true.
26738  */
26739 void UserConfig_set_accept_inbound_channels(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val);
26740
26741 /**
26742  * If this is set to true, the user needs to manually accept inbound requests to open a new
26743  * channel.
26744  *
26745  * When set to true, [`Event::OpenChannelRequest`] will be triggered once a request to open a
26746  * new inbound channel is received through a [`msgs::OpenChannel`] message. In that case, a
26747  * [`msgs::AcceptChannel`] message will not be sent back to the counterparty node unless the
26748  * user explicitly chooses to accept the request.
26749  *
26750  * Default value: false.
26751  *
26752  * [`Event::OpenChannelRequest`]: crate::events::Event::OpenChannelRequest
26753  * [`msgs::OpenChannel`]: crate::ln::msgs::OpenChannel
26754  * [`msgs::AcceptChannel`]: crate::ln::msgs::AcceptChannel
26755  */
26756 bool UserConfig_get_manually_accept_inbound_channels(const struct LDKUserConfig *NONNULL_PTR this_ptr);
26757
26758 /**
26759  * If this is set to true, the user needs to manually accept inbound requests to open a new
26760  * channel.
26761  *
26762  * When set to true, [`Event::OpenChannelRequest`] will be triggered once a request to open a
26763  * new inbound channel is received through a [`msgs::OpenChannel`] message. In that case, a
26764  * [`msgs::AcceptChannel`] message will not be sent back to the counterparty node unless the
26765  * user explicitly chooses to accept the request.
26766  *
26767  * Default value: false.
26768  *
26769  * [`Event::OpenChannelRequest`]: crate::events::Event::OpenChannelRequest
26770  * [`msgs::OpenChannel`]: crate::ln::msgs::OpenChannel
26771  * [`msgs::AcceptChannel`]: crate::ln::msgs::AcceptChannel
26772  */
26773 void UserConfig_set_manually_accept_inbound_channels(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val);
26774
26775 /**
26776  *  If this is set to true, LDK will intercept HTLCs that are attempting to be forwarded over
26777  *  fake short channel ids generated via [`ChannelManager::get_intercept_scid`]. Upon HTLC
26778  *  intercept, LDK will generate an [`Event::HTLCIntercepted`] which MUST be handled by the user.
26779  *
26780  *  Setting this to true may break backwards compatibility with LDK versions < 0.0.113.
26781  *
26782  *  Default value: false.
26783  *
26784  * [`ChannelManager::get_intercept_scid`]: crate::ln::channelmanager::ChannelManager::get_intercept_scid
26785  * [`Event::HTLCIntercepted`]: crate::events::Event::HTLCIntercepted
26786  */
26787 bool UserConfig_get_accept_intercept_htlcs(const struct LDKUserConfig *NONNULL_PTR this_ptr);
26788
26789 /**
26790  *  If this is set to true, LDK will intercept HTLCs that are attempting to be forwarded over
26791  *  fake short channel ids generated via [`ChannelManager::get_intercept_scid`]. Upon HTLC
26792  *  intercept, LDK will generate an [`Event::HTLCIntercepted`] which MUST be handled by the user.
26793  *
26794  *  Setting this to true may break backwards compatibility with LDK versions < 0.0.113.
26795  *
26796  *  Default value: false.
26797  *
26798  * [`ChannelManager::get_intercept_scid`]: crate::ln::channelmanager::ChannelManager::get_intercept_scid
26799  * [`Event::HTLCIntercepted`]: crate::events::Event::HTLCIntercepted
26800  */
26801 void UserConfig_set_accept_intercept_htlcs(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val);
26802
26803 /**
26804  * If this is set to false, when receiving a keysend payment we'll fail it if it has multiple
26805  * parts. If this is set to true, we'll accept the payment.
26806  *
26807  * Setting this to true will break backwards compatibility upon downgrading to an LDK
26808  * version < 0.0.116 while receiving an MPP keysend. If we have already received an MPP
26809  * keysend, downgrading will cause us to fail to deserialize [`ChannelManager`].
26810  *
26811  * Default value: false.
26812  *
26813  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
26814  */
26815 bool UserConfig_get_accept_mpp_keysend(const struct LDKUserConfig *NONNULL_PTR this_ptr);
26816
26817 /**
26818  * If this is set to false, when receiving a keysend payment we'll fail it if it has multiple
26819  * parts. If this is set to true, we'll accept the payment.
26820  *
26821  * Setting this to true will break backwards compatibility upon downgrading to an LDK
26822  * version < 0.0.116 while receiving an MPP keysend. If we have already received an MPP
26823  * keysend, downgrading will cause us to fail to deserialize [`ChannelManager`].
26824  *
26825  * Default value: false.
26826  *
26827  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
26828  */
26829 void UserConfig_set_accept_mpp_keysend(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val);
26830
26831 /**
26832  * Constructs a new UserConfig given each field
26833  */
26834 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, bool accept_mpp_keysend_arg);
26835
26836 /**
26837  * Creates a copy of the UserConfig
26838  */
26839 struct LDKUserConfig UserConfig_clone(const struct LDKUserConfig *NONNULL_PTR orig);
26840
26841 /**
26842  * Creates a "default" UserConfig. See struct and individual field documentaiton for details on which values are used.
26843  */
26844 MUST_USE_RES struct LDKUserConfig UserConfig_default(void);
26845
26846 /**
26847  * Frees any resources used by the BestBlock, if is_owned is set and inner is non-NULL.
26848  */
26849 void BestBlock_free(struct LDKBestBlock this_obj);
26850
26851 /**
26852  * Creates a copy of the BestBlock
26853  */
26854 struct LDKBestBlock BestBlock_clone(const struct LDKBestBlock *NONNULL_PTR orig);
26855
26856 /**
26857  * Checks if two BestBlocks contain equal inner contents.
26858  * This ignores pointers and is_owned flags and looks at the values in fields.
26859  * Two objects with NULL inner values will be considered "equal" here.
26860  */
26861 bool BestBlock_eq(const struct LDKBestBlock *NONNULL_PTR a, const struct LDKBestBlock *NONNULL_PTR b);
26862
26863 /**
26864  * Constructs a `BestBlock` that represents the genesis block at height 0 of the given
26865  * network.
26866  */
26867 MUST_USE_RES struct LDKBestBlock BestBlock_from_network(enum LDKNetwork network);
26868
26869 /**
26870  * Returns a `BestBlock` as identified by the given block hash and height.
26871  */
26872 MUST_USE_RES struct LDKBestBlock BestBlock_new(struct LDKThirtyTwoBytes block_hash, uint32_t height);
26873
26874 /**
26875  * Returns the best block hash.
26876  */
26877 MUST_USE_RES struct LDKThirtyTwoBytes BestBlock_block_hash(const struct LDKBestBlock *NONNULL_PTR this_arg);
26878
26879 /**
26880  * Returns the best block height.
26881  */
26882 MUST_USE_RES uint32_t BestBlock_height(const struct LDKBestBlock *NONNULL_PTR this_arg);
26883
26884 /**
26885  * Calls the free function if one is set
26886  */
26887 void Listen_free(struct LDKListen this_ptr);
26888
26889 /**
26890  * Calls the free function if one is set
26891  */
26892 void Confirm_free(struct LDKConfirm this_ptr);
26893
26894 /**
26895  * Creates a copy of the ChannelMonitorUpdateStatus
26896  */
26897 enum LDKChannelMonitorUpdateStatus ChannelMonitorUpdateStatus_clone(const enum LDKChannelMonitorUpdateStatus *NONNULL_PTR orig);
26898
26899 /**
26900  * Utility method to constructs a new Completed-variant ChannelMonitorUpdateStatus
26901  */
26902 enum LDKChannelMonitorUpdateStatus ChannelMonitorUpdateStatus_completed(void);
26903
26904 /**
26905  * Utility method to constructs a new InProgress-variant ChannelMonitorUpdateStatus
26906  */
26907 enum LDKChannelMonitorUpdateStatus ChannelMonitorUpdateStatus_in_progress(void);
26908
26909 /**
26910  * Utility method to constructs a new PermanentFailure-variant ChannelMonitorUpdateStatus
26911  */
26912 enum LDKChannelMonitorUpdateStatus ChannelMonitorUpdateStatus_permanent_failure(void);
26913
26914 /**
26915  * Checks if two ChannelMonitorUpdateStatuss contain equal inner contents.
26916  * This ignores pointers and is_owned flags and looks at the values in fields.
26917  */
26918 bool ChannelMonitorUpdateStatus_eq(const enum LDKChannelMonitorUpdateStatus *NONNULL_PTR a, const enum LDKChannelMonitorUpdateStatus *NONNULL_PTR b);
26919
26920 /**
26921  * Calls the free function if one is set
26922  */
26923 void Watch_free(struct LDKWatch this_ptr);
26924
26925 /**
26926  * Calls the free function if one is set
26927  */
26928 void Filter_free(struct LDKFilter this_ptr);
26929
26930 /**
26931  * Frees any resources used by the WatchedOutput, if is_owned is set and inner is non-NULL.
26932  */
26933 void WatchedOutput_free(struct LDKWatchedOutput this_obj);
26934
26935 /**
26936  * First block where the transaction output may have been spent.
26937  */
26938 struct LDKCOption_BlockHashZ WatchedOutput_get_block_hash(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
26939
26940 /**
26941  * First block where the transaction output may have been spent.
26942  */
26943 void WatchedOutput_set_block_hash(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKCOption_BlockHashZ val);
26944
26945 /**
26946  * Outpoint identifying the transaction output.
26947  */
26948 struct LDKOutPoint WatchedOutput_get_outpoint(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
26949
26950 /**
26951  * Outpoint identifying the transaction output.
26952  */
26953 void WatchedOutput_set_outpoint(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKOutPoint val);
26954
26955 /**
26956  * Spending condition of the transaction output.
26957  */
26958 struct LDKu8slice WatchedOutput_get_script_pubkey(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
26959
26960 /**
26961  * Spending condition of the transaction output.
26962  */
26963 void WatchedOutput_set_script_pubkey(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
26964
26965 /**
26966  * Constructs a new WatchedOutput given each field
26967  */
26968 MUST_USE_RES struct LDKWatchedOutput WatchedOutput_new(struct LDKCOption_BlockHashZ block_hash_arg, struct LDKOutPoint outpoint_arg, struct LDKCVec_u8Z script_pubkey_arg);
26969
26970 /**
26971  * Creates a copy of the WatchedOutput
26972  */
26973 struct LDKWatchedOutput WatchedOutput_clone(const struct LDKWatchedOutput *NONNULL_PTR orig);
26974
26975 /**
26976  * Checks if two WatchedOutputs contain equal inner contents.
26977  * This ignores pointers and is_owned flags and looks at the values in fields.
26978  * Two objects with NULL inner values will be considered "equal" here.
26979  */
26980 bool WatchedOutput_eq(const struct LDKWatchedOutput *NONNULL_PTR a, const struct LDKWatchedOutput *NONNULL_PTR b);
26981
26982 /**
26983  * Generates a non-cryptographic 64-bit hash of the WatchedOutput.
26984  */
26985 uint64_t WatchedOutput_hash(const struct LDKWatchedOutput *NONNULL_PTR o);
26986
26987 /**
26988  * Calls the free function if one is set
26989  */
26990 void BroadcasterInterface_free(struct LDKBroadcasterInterface this_ptr);
26991
26992 /**
26993  * Creates a copy of the ConfirmationTarget
26994  */
26995 enum LDKConfirmationTarget ConfirmationTarget_clone(const enum LDKConfirmationTarget *NONNULL_PTR orig);
26996
26997 /**
26998  * Utility method to constructs a new MempoolMinimum-variant ConfirmationTarget
26999  */
27000 enum LDKConfirmationTarget ConfirmationTarget_mempool_minimum(void);
27001
27002 /**
27003  * Utility method to constructs a new Background-variant ConfirmationTarget
27004  */
27005 enum LDKConfirmationTarget ConfirmationTarget_background(void);
27006
27007 /**
27008  * Utility method to constructs a new Normal-variant ConfirmationTarget
27009  */
27010 enum LDKConfirmationTarget ConfirmationTarget_normal(void);
27011
27012 /**
27013  * Utility method to constructs a new HighPriority-variant ConfirmationTarget
27014  */
27015 enum LDKConfirmationTarget ConfirmationTarget_high_priority(void);
27016
27017 /**
27018  * Generates a non-cryptographic 64-bit hash of the ConfirmationTarget.
27019  */
27020 uint64_t ConfirmationTarget_hash(const enum LDKConfirmationTarget *NONNULL_PTR o);
27021
27022 /**
27023  * Checks if two ConfirmationTargets contain equal inner contents.
27024  * This ignores pointers and is_owned flags and looks at the values in fields.
27025  */
27026 bool ConfirmationTarget_eq(const enum LDKConfirmationTarget *NONNULL_PTR a, const enum LDKConfirmationTarget *NONNULL_PTR b);
27027
27028 /**
27029  * Calls the free function if one is set
27030  */
27031 void FeeEstimator_free(struct LDKFeeEstimator this_ptr);
27032
27033 /**
27034  * Frees any resources used by the MonitorUpdateId, if is_owned is set and inner is non-NULL.
27035  */
27036 void MonitorUpdateId_free(struct LDKMonitorUpdateId this_obj);
27037
27038 /**
27039  * Creates a copy of the MonitorUpdateId
27040  */
27041 struct LDKMonitorUpdateId MonitorUpdateId_clone(const struct LDKMonitorUpdateId *NONNULL_PTR orig);
27042
27043 /**
27044  * Generates a non-cryptographic 64-bit hash of the MonitorUpdateId.
27045  */
27046 uint64_t MonitorUpdateId_hash(const struct LDKMonitorUpdateId *NONNULL_PTR o);
27047
27048 /**
27049  * Checks if two MonitorUpdateIds contain equal inner contents.
27050  * This ignores pointers and is_owned flags and looks at the values in fields.
27051  * Two objects with NULL inner values will be considered "equal" here.
27052  */
27053 bool MonitorUpdateId_eq(const struct LDKMonitorUpdateId *NONNULL_PTR a, const struct LDKMonitorUpdateId *NONNULL_PTR b);
27054
27055 /**
27056  * Calls the free function if one is set
27057  */
27058 void Persist_free(struct LDKPersist this_ptr);
27059
27060 /**
27061  * Frees any resources used by the LockedChannelMonitor, if is_owned is set and inner is non-NULL.
27062  */
27063 void LockedChannelMonitor_free(struct LDKLockedChannelMonitor this_obj);
27064
27065 /**
27066  * Frees any resources used by the ChainMonitor, if is_owned is set and inner is non-NULL.
27067  */
27068 void ChainMonitor_free(struct LDKChainMonitor this_obj);
27069
27070 /**
27071  * Creates a new `ChainMonitor` used to watch on-chain activity pertaining to channels.
27072  *
27073  * When an optional chain source implementing [`chain::Filter`] is provided, the chain monitor
27074  * will call back to it indicating transactions and outputs of interest. This allows clients to
27075  * pre-filter blocks or only fetch blocks matching a compact filter. Otherwise, clients may
27076  * always need to fetch full blocks absent another means for determining which blocks contain
27077  * transactions relevant to the watched channels.
27078  */
27079 MUST_USE_RES struct LDKChainMonitor ChainMonitor_new(struct LDKCOption_FilterZ chain_source, struct LDKBroadcasterInterface broadcaster, struct LDKLogger logger, struct LDKFeeEstimator feeest, struct LDKPersist persister);
27080
27081 /**
27082  * Gets the balances in the contained [`ChannelMonitor`]s which are claimable on-chain or
27083  * claims which are awaiting confirmation.
27084  *
27085  * Includes the balances from each [`ChannelMonitor`] *except* those included in
27086  * `ignored_channels`, allowing you to filter out balances from channels which are still open
27087  * (and whose balance should likely be pulled from the [`ChannelDetails`]).
27088  *
27089  * See [`ChannelMonitor::get_claimable_balances`] for more details on the exact criteria for
27090  * inclusion in the return value.
27091  */
27092 MUST_USE_RES struct LDKCVec_BalanceZ ChainMonitor_get_claimable_balances(const struct LDKChainMonitor *NONNULL_PTR this_arg, struct LDKCVec_ChannelDetailsZ ignored_channels);
27093
27094 /**
27095  * Gets the [`LockedChannelMonitor`] for a given funding outpoint, returning an `Err` if no
27096  * such [`ChannelMonitor`] is currently being monitored for.
27097  *
27098  * Note that the result holds a mutex over our monitor set, and should not be held
27099  * indefinitely.
27100  */
27101 MUST_USE_RES struct LDKCResult_LockedChannelMonitorNoneZ ChainMonitor_get_monitor(const struct LDKChainMonitor *NONNULL_PTR this_arg, struct LDKOutPoint funding_txo);
27102
27103 /**
27104  * Lists the funding outpoint of each [`ChannelMonitor`] being monitored.
27105  *
27106  * Note that [`ChannelMonitor`]s are not removed when a channel is closed as they are always
27107  * monitoring for on-chain state resolutions.
27108  */
27109 MUST_USE_RES struct LDKCVec_OutPointZ ChainMonitor_list_monitors(const struct LDKChainMonitor *NONNULL_PTR this_arg);
27110
27111 /**
27112  * Lists the pending updates for each [`ChannelMonitor`] (by `OutPoint` being monitored).
27113  */
27114 MUST_USE_RES struct LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ ChainMonitor_list_pending_monitor_updates(const struct LDKChainMonitor *NONNULL_PTR this_arg);
27115
27116 /**
27117  * Indicates the persistence of a [`ChannelMonitor`] has completed after
27118  * [`ChannelMonitorUpdateStatus::InProgress`] was returned from an update operation.
27119  *
27120  * Thus, the anticipated use is, at a high level:
27121  *  1) This [`ChainMonitor`] calls [`Persist::update_persisted_channel`] which stores the
27122  *     update to disk and begins updating any remote (e.g. watchtower/backup) copies,
27123  *     returning [`ChannelMonitorUpdateStatus::InProgress`],
27124  *  2) once all remote copies are updated, you call this function with the
27125  *     `completed_update_id` that completed, and once all pending updates have completed the
27126  *     channel will be re-enabled.
27127  *
27128  * Returns an [`APIError::APIMisuseError`] if `funding_txo` does not match any currently
27129  * registered [`ChannelMonitor`]s.
27130  */
27131 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);
27132
27133 /**
27134  * Gets a [`Future`] that completes when an event is available either via
27135  * [`chain::Watch::release_pending_monitor_events`] or
27136  * [`EventsProvider::process_pending_events`].
27137  *
27138  * Note that callbacks registered on the [`Future`] MUST NOT call back into this
27139  * [`ChainMonitor`] and should instead register actions to be taken later.
27140  *
27141  * [`EventsProvider::process_pending_events`]: crate::events::EventsProvider::process_pending_events
27142  */
27143 MUST_USE_RES struct LDKFuture ChainMonitor_get_update_future(const struct LDKChainMonitor *NONNULL_PTR this_arg);
27144
27145 /**
27146  * Triggers rebroadcasts/fee-bumps of pending claims from a force-closed channel. This is
27147  * crucial in preventing certain classes of pinning attacks, detecting substantial mempool
27148  * feerate changes between blocks, and ensuring reliability if broadcasting fails. We recommend
27149  * invoking this every 30 seconds, or lower if running in an environment with spotty
27150  * connections, like on mobile.
27151  */
27152 void ChainMonitor_rebroadcast_pending_claims(const struct LDKChainMonitor *NONNULL_PTR this_arg);
27153
27154 /**
27155  * Constructs a new Listen which calls the relevant methods on this_arg.
27156  * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is
27157  */
27158 struct LDKListen ChainMonitor_as_Listen(const struct LDKChainMonitor *NONNULL_PTR this_arg);
27159
27160 /**
27161  * Constructs a new Confirm which calls the relevant methods on this_arg.
27162  * This copies the `inner` pointer in this_arg and thus the returned Confirm must be freed before this_arg is
27163  */
27164 struct LDKConfirm ChainMonitor_as_Confirm(const struct LDKChainMonitor *NONNULL_PTR this_arg);
27165
27166 /**
27167  * Constructs a new Watch which calls the relevant methods on this_arg.
27168  * This copies the `inner` pointer in this_arg and thus the returned Watch must be freed before this_arg is
27169  */
27170 struct LDKWatch ChainMonitor_as_Watch(const struct LDKChainMonitor *NONNULL_PTR this_arg);
27171
27172 /**
27173  * Constructs a new EventsProvider which calls the relevant methods on this_arg.
27174  * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is
27175  */
27176 struct LDKEventsProvider ChainMonitor_as_EventsProvider(const struct LDKChainMonitor *NONNULL_PTR this_arg);
27177
27178 /**
27179  * Frees any resources used by the ChannelMonitorUpdate, if is_owned is set and inner is non-NULL.
27180  */
27181 void ChannelMonitorUpdate_free(struct LDKChannelMonitorUpdate this_obj);
27182
27183 /**
27184  * The sequence number of this update. Updates *must* be replayed in-order according to this
27185  * sequence number (and updates may panic if they are not). The update_id values are strictly
27186  * increasing and increase by one for each new update, with two exceptions specified below.
27187  *
27188  * This sequence number is also used to track up to which points updates which returned
27189  * [`ChannelMonitorUpdateStatus::InProgress`] have been applied to all copies of a given
27190  * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
27191  *
27192  * The only instances we allow where update_id values are not strictly increasing have a
27193  * special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. This update ID is used for updates that
27194  * will force close the channel by broadcasting the latest commitment transaction or
27195  * special post-force-close updates, like providing preimages necessary to claim outputs on the
27196  * broadcast commitment transaction. See its docs for more details.
27197  *
27198  * [`ChannelMonitorUpdateStatus::InProgress`]: super::ChannelMonitorUpdateStatus::InProgress
27199  */
27200 uint64_t ChannelMonitorUpdate_get_update_id(const struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr);
27201
27202 /**
27203  * The sequence number of this update. Updates *must* be replayed in-order according to this
27204  * sequence number (and updates may panic if they are not). The update_id values are strictly
27205  * increasing and increase by one for each new update, with two exceptions specified below.
27206  *
27207  * This sequence number is also used to track up to which points updates which returned
27208  * [`ChannelMonitorUpdateStatus::InProgress`] have been applied to all copies of a given
27209  * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
27210  *
27211  * The only instances we allow where update_id values are not strictly increasing have a
27212  * special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. This update ID is used for updates that
27213  * will force close the channel by broadcasting the latest commitment transaction or
27214  * special post-force-close updates, like providing preimages necessary to claim outputs on the
27215  * broadcast commitment transaction. See its docs for more details.
27216  *
27217  * [`ChannelMonitorUpdateStatus::InProgress`]: super::ChannelMonitorUpdateStatus::InProgress
27218  */
27219 void ChannelMonitorUpdate_set_update_id(struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr, uint64_t val);
27220
27221 /**
27222  * Creates a copy of the ChannelMonitorUpdate
27223  */
27224 struct LDKChannelMonitorUpdate ChannelMonitorUpdate_clone(const struct LDKChannelMonitorUpdate *NONNULL_PTR orig);
27225
27226 /**
27227  * Checks if two ChannelMonitorUpdates contain equal inner contents.
27228  * This ignores pointers and is_owned flags and looks at the values in fields.
27229  * Two objects with NULL inner values will be considered "equal" here.
27230  */
27231 bool ChannelMonitorUpdate_eq(const struct LDKChannelMonitorUpdate *NONNULL_PTR a, const struct LDKChannelMonitorUpdate *NONNULL_PTR b);
27232
27233 /**
27234  * Serialize the ChannelMonitorUpdate object into a byte array which can be read by ChannelMonitorUpdate_read
27235  */
27236 struct LDKCVec_u8Z ChannelMonitorUpdate_write(const struct LDKChannelMonitorUpdate *NONNULL_PTR obj);
27237
27238 /**
27239  * Read a ChannelMonitorUpdate from a byte array, created by ChannelMonitorUpdate_write
27240  */
27241 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ ChannelMonitorUpdate_read(struct LDKu8slice ser);
27242
27243 /**
27244  * Frees any resources used by the MonitorEvent
27245  */
27246 void MonitorEvent_free(struct LDKMonitorEvent this_ptr);
27247
27248 /**
27249  * Creates a copy of the MonitorEvent
27250  */
27251 struct LDKMonitorEvent MonitorEvent_clone(const struct LDKMonitorEvent *NONNULL_PTR orig);
27252
27253 /**
27254  * Utility method to constructs a new HTLCEvent-variant MonitorEvent
27255  */
27256 struct LDKMonitorEvent MonitorEvent_htlcevent(struct LDKHTLCUpdate a);
27257
27258 /**
27259  * Utility method to constructs a new CommitmentTxConfirmed-variant MonitorEvent
27260  */
27261 struct LDKMonitorEvent MonitorEvent_commitment_tx_confirmed(struct LDKOutPoint a);
27262
27263 /**
27264  * Utility method to constructs a new Completed-variant MonitorEvent
27265  */
27266 struct LDKMonitorEvent MonitorEvent_completed(struct LDKOutPoint funding_txo, uint64_t monitor_update_id);
27267
27268 /**
27269  * Utility method to constructs a new UpdateFailed-variant MonitorEvent
27270  */
27271 struct LDKMonitorEvent MonitorEvent_update_failed(struct LDKOutPoint a);
27272
27273 /**
27274  * Checks if two MonitorEvents contain equal inner contents.
27275  * This ignores pointers and is_owned flags and looks at the values in fields.
27276  */
27277 bool MonitorEvent_eq(const struct LDKMonitorEvent *NONNULL_PTR a, const struct LDKMonitorEvent *NONNULL_PTR b);
27278
27279 /**
27280  * Serialize the MonitorEvent object into a byte array which can be read by MonitorEvent_read
27281  */
27282 struct LDKCVec_u8Z MonitorEvent_write(const struct LDKMonitorEvent *NONNULL_PTR obj);
27283
27284 /**
27285  * Read a MonitorEvent from a byte array, created by MonitorEvent_write
27286  */
27287 struct LDKCResult_COption_MonitorEventZDecodeErrorZ MonitorEvent_read(struct LDKu8slice ser);
27288
27289 /**
27290  * Frees any resources used by the HTLCUpdate, if is_owned is set and inner is non-NULL.
27291  */
27292 void HTLCUpdate_free(struct LDKHTLCUpdate this_obj);
27293
27294 /**
27295  * Creates a copy of the HTLCUpdate
27296  */
27297 struct LDKHTLCUpdate HTLCUpdate_clone(const struct LDKHTLCUpdate *NONNULL_PTR orig);
27298
27299 /**
27300  * Checks if two HTLCUpdates 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 HTLCUpdate_eq(const struct LDKHTLCUpdate *NONNULL_PTR a, const struct LDKHTLCUpdate *NONNULL_PTR b);
27305
27306 /**
27307  * Serialize the HTLCUpdate object into a byte array which can be read by HTLCUpdate_read
27308  */
27309 struct LDKCVec_u8Z HTLCUpdate_write(const struct LDKHTLCUpdate *NONNULL_PTR obj);
27310
27311 /**
27312  * Read a HTLCUpdate from a byte array, created by HTLCUpdate_write
27313  */
27314 struct LDKCResult_HTLCUpdateDecodeErrorZ HTLCUpdate_read(struct LDKu8slice ser);
27315
27316 /**
27317  * Frees any resources used by the Balance
27318  */
27319 void Balance_free(struct LDKBalance this_ptr);
27320
27321 /**
27322  * Creates a copy of the Balance
27323  */
27324 struct LDKBalance Balance_clone(const struct LDKBalance *NONNULL_PTR orig);
27325
27326 /**
27327  * Utility method to constructs a new ClaimableOnChannelClose-variant Balance
27328  */
27329 struct LDKBalance Balance_claimable_on_channel_close(uint64_t claimable_amount_satoshis);
27330
27331 /**
27332  * Utility method to constructs a new ClaimableAwaitingConfirmations-variant Balance
27333  */
27334 struct LDKBalance Balance_claimable_awaiting_confirmations(uint64_t claimable_amount_satoshis, uint32_t confirmation_height);
27335
27336 /**
27337  * Utility method to constructs a new ContentiousClaimable-variant Balance
27338  */
27339 struct LDKBalance Balance_contentious_claimable(uint64_t claimable_amount_satoshis, uint32_t timeout_height, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_preimage);
27340
27341 /**
27342  * Utility method to constructs a new MaybeTimeoutClaimableHTLC-variant Balance
27343  */
27344 struct LDKBalance Balance_maybe_timeout_claimable_htlc(uint64_t claimable_amount_satoshis, uint32_t claimable_height, struct LDKThirtyTwoBytes payment_hash);
27345
27346 /**
27347  * Utility method to constructs a new MaybePreimageClaimableHTLC-variant Balance
27348  */
27349 struct LDKBalance Balance_maybe_preimage_claimable_htlc(uint64_t claimable_amount_satoshis, uint32_t expiry_height, struct LDKThirtyTwoBytes payment_hash);
27350
27351 /**
27352  * Utility method to constructs a new CounterpartyRevokedOutputClaimable-variant Balance
27353  */
27354 struct LDKBalance Balance_counterparty_revoked_output_claimable(uint64_t claimable_amount_satoshis);
27355
27356 /**
27357  * Checks if two Balances contain equal inner contents.
27358  * This ignores pointers and is_owned flags and looks at the values in fields.
27359  */
27360 bool Balance_eq(const struct LDKBalance *NONNULL_PTR a, const struct LDKBalance *NONNULL_PTR b);
27361
27362 /**
27363  * The amount claimable, in satoshis. This excludes balances that we are unsure if we are able
27364  * to claim, this is because we are waiting for a preimage or for a timeout to expire. For more
27365  * information on these balances see [`Balance::MaybeTimeoutClaimableHTLC`] and
27366  * [`Balance::MaybePreimageClaimableHTLC`].
27367  *
27368  * On-chain fees required to claim the balance are not included in this amount.
27369  */
27370 MUST_USE_RES uint64_t Balance_claimable_amount_satoshis(const struct LDKBalance *NONNULL_PTR this_arg);
27371
27372 /**
27373  * Frees any resources used by the ChannelMonitor, if is_owned is set and inner is non-NULL.
27374  */
27375 void ChannelMonitor_free(struct LDKChannelMonitor this_obj);
27376
27377 /**
27378  * Serialize the ChannelMonitor object into a byte array which can be read by ChannelMonitor_read
27379  */
27380 struct LDKCVec_u8Z ChannelMonitor_write(const struct LDKChannelMonitor *NONNULL_PTR obj);
27381
27382 /**
27383  * Updates a ChannelMonitor on the basis of some new information provided by the Channel
27384  * itself.
27385  *
27386  * panics if the given update is not the next update by update_id.
27387  */
27388 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);
27389
27390 /**
27391  * Gets the update_id from the latest ChannelMonitorUpdate which was applied to this
27392  * ChannelMonitor.
27393  */
27394 MUST_USE_RES uint64_t ChannelMonitor_get_latest_update_id(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
27395
27396 /**
27397  * Gets the funding transaction outpoint of the channel this ChannelMonitor is monitoring for.
27398  */
27399 MUST_USE_RES struct LDKC2Tuple_OutPointScriptZ ChannelMonitor_get_funding_txo(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
27400
27401 /**
27402  * Gets a list of txids, with their output scripts (in the order they appear in the
27403  * transaction), which we must learn about spends of via block_connected().
27404  */
27405 MUST_USE_RES struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ChannelMonitor_get_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
27406
27407 /**
27408  * Loads the funding txo and outputs to watch into the given `chain::Filter` by repeatedly
27409  * calling `chain::Filter::register_output` and `chain::Filter::register_tx` until all outputs
27410  * have been registered.
27411  */
27412 void ChannelMonitor_load_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKFilter *NONNULL_PTR filter);
27413
27414 /**
27415  * Get the list of HTLCs who's status has been updated on chain. This should be called by
27416  * ChannelManager via [`chain::Watch::release_pending_monitor_events`].
27417  */
27418 MUST_USE_RES struct LDKCVec_MonitorEventZ ChannelMonitor_get_and_clear_pending_monitor_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
27419
27420 /**
27421  * Processes [`SpendableOutputs`] events produced from each [`ChannelMonitor`] upon maturity.
27422  *
27423  * For channels featuring anchor outputs, this method will also process [`BumpTransaction`]
27424  * events produced from each [`ChannelMonitor`] while there is a balance to claim onchain
27425  * within each channel. As the confirmation of a commitment transaction may be critical to the
27426  * safety of funds, we recommend invoking this every 30 seconds, or lower if running in an
27427  * environment with spotty connections, like on mobile.
27428  *
27429  * An [`EventHandler`] may safely call back to the provider, though this shouldn't be needed in
27430  * order to handle these events.
27431  *
27432  * [`SpendableOutputs`]: crate::events::Event::SpendableOutputs
27433  * [`BumpTransaction`]: crate::events::Event::BumpTransaction
27434  */
27435 void ChannelMonitor_process_pending_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKEventHandler *NONNULL_PTR handler);
27436
27437 /**
27438  * Gets the `node_id` of the counterparty for this channel.
27439  *
27440  * Will be `None` for channels constructed on LDK versions prior to 0.0.110 and always `Some`
27441  * otherwise.
27442  *
27443  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
27444  */
27445 MUST_USE_RES struct LDKPublicKey ChannelMonitor_get_counterparty_node_id(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
27446
27447 /**
27448  * Used by ChannelManager deserialization to broadcast the latest holder state if its copy of
27449  * the Channel was out-of-date.
27450  *
27451  * You may also use this to broadcast the latest local commitment transaction, either because
27452  * a monitor update failed with [`ChannelMonitorUpdateStatus::PermanentFailure`] or because we've
27453  * fallen behind (i.e. we've received proof that our counterparty side knows a revocation
27454  * secret we gave them that they shouldn't know).
27455  *
27456  * Broadcasting these transactions in the second case is UNSAFE, as they allow counterparty
27457  * side to punish you. Nevertheless you may want to broadcast them if counterparty doesn't
27458  * close channel with their commitment transaction after a substantial amount of time. Best
27459  * may be to contact the other node operator out-of-band to coordinate other options available
27460  * to you. In any-case, the choice is up to you.
27461  *
27462  * [`ChannelMonitorUpdateStatus::PermanentFailure`]: super::ChannelMonitorUpdateStatus::PermanentFailure
27463  */
27464 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);
27465
27466 /**
27467  * Processes transactions in a newly connected block, which may result in any of the following:
27468  * - update the monitor's state against resolved HTLCs
27469  * - punish the counterparty in the case of seeing a revoked commitment transaction
27470  * - force close the channel and claim/timeout incoming/outgoing HTLCs if near expiration
27471  * - detect settled outputs for later spending
27472  * - schedule and bump any in-flight claims
27473  *
27474  * Returns any new outputs to watch from `txdata`; after called, these are also included in
27475  * [`get_outputs_to_watch`].
27476  *
27477  * [`get_outputs_to_watch`]: #method.get_outputs_to_watch
27478  */
27479 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);
27480
27481 /**
27482  * Determines if the disconnected block contained any transactions of interest and updates
27483  * appropriately.
27484  */
27485 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);
27486
27487 /**
27488  * Processes transactions confirmed in a block with the given header and height, returning new
27489  * outputs to watch. See [`block_connected`] for details.
27490  *
27491  * Used instead of [`block_connected`] by clients that are notified of transactions rather than
27492  * blocks. See [`chain::Confirm`] for calling expectations.
27493  *
27494  * [`block_connected`]: Self::block_connected
27495  */
27496 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);
27497
27498 /**
27499  * Processes a transaction that was reorganized out of the chain.
27500  *
27501  * Used instead of [`block_disconnected`] by clients that are notified of transactions rather
27502  * than blocks. See [`chain::Confirm`] for calling expectations.
27503  *
27504  * [`block_disconnected`]: Self::block_disconnected
27505  */
27506 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);
27507
27508 /**
27509  * Updates the monitor with the current best chain tip, returning new outputs to watch. See
27510  * [`block_connected`] for details.
27511  *
27512  * Used instead of [`block_connected`] by clients that are notified of transactions rather than
27513  * blocks. See [`chain::Confirm`] for calling expectations.
27514  *
27515  * [`block_connected`]: Self::block_connected
27516  */
27517 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);
27518
27519 /**
27520  * Returns the set of txids that should be monitored for re-organization out of the chain.
27521  */
27522 MUST_USE_RES struct LDKCVec_C2Tuple_TxidCOption_BlockHashZZZ ChannelMonitor_get_relevant_txids(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
27523
27524 /**
27525  * Gets the latest best block which was connected either via the [`chain::Listen`] or
27526  * [`chain::Confirm`] interfaces.
27527  */
27528 MUST_USE_RES struct LDKBestBlock ChannelMonitor_current_best_block(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
27529
27530 /**
27531  * Triggers rebroadcasts/fee-bumps of pending claims from a force-closed channel. This is
27532  * crucial in preventing certain classes of pinning attacks, detecting substantial mempool
27533  * feerate changes between blocks, and ensuring reliability if broadcasting fails. We recommend
27534  * invoking this every 30 seconds, or lower if running in an environment with spotty
27535  * connections, like on mobile.
27536  */
27537 void ChannelMonitor_rebroadcast_pending_claims(const struct LDKChannelMonitor *NONNULL_PTR this_arg, struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator, struct LDKLogger logger);
27538
27539 /**
27540  * Gets the balances in this channel which are either claimable by us if we were to
27541  * force-close the channel now or which are claimable on-chain (possibly awaiting
27542  * confirmation).
27543  *
27544  * Any balances in the channel which are available on-chain (excluding on-chain fees) are
27545  * included here until an [`Event::SpendableOutputs`] event has been generated for the
27546  * balance, or until our counterparty has claimed the balance and accrued several
27547  * confirmations on the claim transaction.
27548  *
27549  * Note that for `ChannelMonitors` which track a channel which went on-chain with versions of
27550  * LDK prior to 0.0.111, balances may not be fully captured if our counterparty broadcasted
27551  * a revoked state.
27552  *
27553  * See [`Balance`] for additional details on the types of claimable balances which
27554  * may be returned here and their meanings.
27555  */
27556 MUST_USE_RES struct LDKCVec_BalanceZ ChannelMonitor_get_claimable_balances(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
27557
27558 /**
27559  * Read a C2Tuple_BlockHashChannelMonitorZ from a byte array, created by C2Tuple_BlockHashChannelMonitorZ_write
27560  */
27561 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ C2Tuple_BlockHashChannelMonitorZ_read(struct LDKu8slice ser, const struct LDKEntropySource *NONNULL_PTR arg_a, const struct LDKSignerProvider *NONNULL_PTR arg_b);
27562
27563 /**
27564  * Frees any resources used by the OutPoint, if is_owned is set and inner is non-NULL.
27565  */
27566 void OutPoint_free(struct LDKOutPoint this_obj);
27567
27568 /**
27569  * The referenced transaction's txid.
27570  */
27571 const uint8_t (*OutPoint_get_txid(const struct LDKOutPoint *NONNULL_PTR this_ptr))[32];
27572
27573 /**
27574  * The referenced transaction's txid.
27575  */
27576 void OutPoint_set_txid(struct LDKOutPoint *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
27577
27578 /**
27579  * The index of the referenced output in its transaction's vout.
27580  */
27581 uint16_t OutPoint_get_index(const struct LDKOutPoint *NONNULL_PTR this_ptr);
27582
27583 /**
27584  * The index of the referenced output in its transaction's vout.
27585  */
27586 void OutPoint_set_index(struct LDKOutPoint *NONNULL_PTR this_ptr, uint16_t val);
27587
27588 /**
27589  * Constructs a new OutPoint given each field
27590  */
27591 MUST_USE_RES struct LDKOutPoint OutPoint_new(struct LDKThirtyTwoBytes txid_arg, uint16_t index_arg);
27592
27593 /**
27594  * Creates a copy of the OutPoint
27595  */
27596 struct LDKOutPoint OutPoint_clone(const struct LDKOutPoint *NONNULL_PTR orig);
27597
27598 /**
27599  * Checks if two OutPoints contain equal inner contents.
27600  * This ignores pointers and is_owned flags and looks at the values in fields.
27601  * Two objects with NULL inner values will be considered "equal" here.
27602  */
27603 bool OutPoint_eq(const struct LDKOutPoint *NONNULL_PTR a, const struct LDKOutPoint *NONNULL_PTR b);
27604
27605 /**
27606  * Generates a non-cryptographic 64-bit hash of the OutPoint.
27607  */
27608 uint64_t OutPoint_hash(const struct LDKOutPoint *NONNULL_PTR o);
27609
27610 /**
27611  * Convert an `OutPoint` to a lightning channel id.
27612  */
27613 MUST_USE_RES struct LDKThirtyTwoBytes OutPoint_to_channel_id(const struct LDKOutPoint *NONNULL_PTR this_arg);
27614
27615 /**
27616  * Serialize the OutPoint object into a byte array which can be read by OutPoint_read
27617  */
27618 struct LDKCVec_u8Z OutPoint_write(const struct LDKOutPoint *NONNULL_PTR obj);
27619
27620 /**
27621  * Read a OutPoint from a byte array, created by OutPoint_write
27622  */
27623 struct LDKCResult_OutPointDecodeErrorZ OutPoint_read(struct LDKu8slice ser);
27624
27625 /**
27626  * Creates a copy of the FailureCode
27627  */
27628 enum LDKFailureCode FailureCode_clone(const enum LDKFailureCode *NONNULL_PTR orig);
27629
27630 /**
27631  * Utility method to constructs a new TemporaryNodeFailure-variant FailureCode
27632  */
27633 enum LDKFailureCode FailureCode_temporary_node_failure(void);
27634
27635 /**
27636  * Utility method to constructs a new RequiredNodeFeatureMissing-variant FailureCode
27637  */
27638 enum LDKFailureCode FailureCode_required_node_feature_missing(void);
27639
27640 /**
27641  * Utility method to constructs a new IncorrectOrUnknownPaymentDetails-variant FailureCode
27642  */
27643 enum LDKFailureCode FailureCode_incorrect_or_unknown_payment_details(void);
27644
27645 /**
27646  * Frees any resources used by the ChannelManager, if is_owned is set and inner is non-NULL.
27647  */
27648 void ChannelManager_free(struct LDKChannelManager this_obj);
27649
27650 /**
27651  * Frees any resources used by the ChainParameters, if is_owned is set and inner is non-NULL.
27652  */
27653 void ChainParameters_free(struct LDKChainParameters this_obj);
27654
27655 /**
27656  * The network for determining the `chain_hash` in Lightning messages.
27657  */
27658 enum LDKNetwork ChainParameters_get_network(const struct LDKChainParameters *NONNULL_PTR this_ptr);
27659
27660 /**
27661  * The network for determining the `chain_hash` in Lightning messages.
27662  */
27663 void ChainParameters_set_network(struct LDKChainParameters *NONNULL_PTR this_ptr, enum LDKNetwork val);
27664
27665 /**
27666  * The hash and height of the latest block successfully connected.
27667  *
27668  * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
27669  */
27670 struct LDKBestBlock ChainParameters_get_best_block(const struct LDKChainParameters *NONNULL_PTR this_ptr);
27671
27672 /**
27673  * The hash and height of the latest block successfully connected.
27674  *
27675  * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
27676  */
27677 void ChainParameters_set_best_block(struct LDKChainParameters *NONNULL_PTR this_ptr, struct LDKBestBlock val);
27678
27679 /**
27680  * Constructs a new ChainParameters given each field
27681  */
27682 MUST_USE_RES struct LDKChainParameters ChainParameters_new(enum LDKNetwork network_arg, struct LDKBestBlock best_block_arg);
27683
27684 /**
27685  * Creates a copy of the ChainParameters
27686  */
27687 struct LDKChainParameters ChainParameters_clone(const struct LDKChainParameters *NONNULL_PTR orig);
27688
27689 /**
27690  * Frees any resources used by the CounterpartyForwardingInfo, if is_owned is set and inner is non-NULL.
27691  */
27692 void CounterpartyForwardingInfo_free(struct LDKCounterpartyForwardingInfo this_obj);
27693
27694 /**
27695  * Base routing fee in millisatoshis.
27696  */
27697 uint32_t CounterpartyForwardingInfo_get_fee_base_msat(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr);
27698
27699 /**
27700  * Base routing fee in millisatoshis.
27701  */
27702 void CounterpartyForwardingInfo_set_fee_base_msat(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint32_t val);
27703
27704 /**
27705  * Amount in millionths of a satoshi the channel will charge per transferred satoshi.
27706  */
27707 uint32_t CounterpartyForwardingInfo_get_fee_proportional_millionths(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr);
27708
27709 /**
27710  * Amount in millionths of a satoshi the channel will charge per transferred satoshi.
27711  */
27712 void CounterpartyForwardingInfo_set_fee_proportional_millionths(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint32_t val);
27713
27714 /**
27715  * The minimum difference in cltv_expiry between an ingoing HTLC and its outgoing counterpart,
27716  * such that the outgoing HTLC is forwardable to this counterparty. See `msgs::ChannelUpdate`'s
27717  * `cltv_expiry_delta` for more details.
27718  */
27719 uint16_t CounterpartyForwardingInfo_get_cltv_expiry_delta(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr);
27720
27721 /**
27722  * The minimum difference in cltv_expiry between an ingoing HTLC and its outgoing counterpart,
27723  * such that the outgoing HTLC is forwardable to this counterparty. See `msgs::ChannelUpdate`'s
27724  * `cltv_expiry_delta` for more details.
27725  */
27726 void CounterpartyForwardingInfo_set_cltv_expiry_delta(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint16_t val);
27727
27728 /**
27729  * Constructs a new CounterpartyForwardingInfo given each field
27730  */
27731 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);
27732
27733 /**
27734  * Creates a copy of the CounterpartyForwardingInfo
27735  */
27736 struct LDKCounterpartyForwardingInfo CounterpartyForwardingInfo_clone(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR orig);
27737
27738 /**
27739  * Frees any resources used by the ChannelCounterparty, if is_owned is set and inner is non-NULL.
27740  */
27741 void ChannelCounterparty_free(struct LDKChannelCounterparty this_obj);
27742
27743 /**
27744  * The node_id of our counterparty
27745  */
27746 struct LDKPublicKey ChannelCounterparty_get_node_id(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
27747
27748 /**
27749  * The node_id of our counterparty
27750  */
27751 void ChannelCounterparty_set_node_id(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKPublicKey val);
27752
27753 /**
27754  * The Features the channel counterparty provided upon last connection.
27755  * Useful for routing as it is the most up-to-date copy of the counterparty's features and
27756  * many routing-relevant features are present in the init context.
27757  */
27758 struct LDKInitFeatures ChannelCounterparty_get_features(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
27759
27760 /**
27761  * The Features the channel counterparty provided upon last connection.
27762  * Useful for routing as it is the most up-to-date copy of the counterparty's features and
27763  * many routing-relevant features are present in the init context.
27764  */
27765 void ChannelCounterparty_set_features(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKInitFeatures val);
27766
27767 /**
27768  * The value, in satoshis, that must always be held in the channel for our counterparty. This
27769  * value ensures that if our counterparty broadcasts a revoked state, we can punish them by
27770  * claiming at least this value on chain.
27771  *
27772  * This value is not included in [`inbound_capacity_msat`] as it can never be spent.
27773  *
27774  * [`inbound_capacity_msat`]: ChannelDetails::inbound_capacity_msat
27775  */
27776 uint64_t ChannelCounterparty_get_unspendable_punishment_reserve(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
27777
27778 /**
27779  * The value, in satoshis, that must always be held in the channel for our counterparty. This
27780  * value ensures that if our counterparty broadcasts a revoked state, we can punish them by
27781  * claiming at least this value on chain.
27782  *
27783  * This value is not included in [`inbound_capacity_msat`] as it can never be spent.
27784  *
27785  * [`inbound_capacity_msat`]: ChannelDetails::inbound_capacity_msat
27786  */
27787 void ChannelCounterparty_set_unspendable_punishment_reserve(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, uint64_t val);
27788
27789 /**
27790  * Information on the fees and requirements that the counterparty requires when forwarding
27791  * payments to us through this channel.
27792  *
27793  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
27794  */
27795 struct LDKCounterpartyForwardingInfo ChannelCounterparty_get_forwarding_info(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
27796
27797 /**
27798  * Information on the fees and requirements that the counterparty requires when forwarding
27799  * payments to us through this channel.
27800  *
27801  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
27802  */
27803 void ChannelCounterparty_set_forwarding_info(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKCounterpartyForwardingInfo val);
27804
27805 /**
27806  * The smallest value HTLC (in msat) the remote peer will accept, for this channel. This field
27807  * is only `None` before we have received either the `OpenChannel` or `AcceptChannel` message
27808  * from the remote peer, or for `ChannelCounterparty` objects serialized prior to LDK 0.0.107.
27809  */
27810 struct LDKCOption_u64Z ChannelCounterparty_get_outbound_htlc_minimum_msat(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
27811
27812 /**
27813  * The smallest value HTLC (in msat) the remote peer will accept, for this channel. This field
27814  * is only `None` before we have received either the `OpenChannel` or `AcceptChannel` message
27815  * from the remote peer, or for `ChannelCounterparty` objects serialized prior to LDK 0.0.107.
27816  */
27817 void ChannelCounterparty_set_outbound_htlc_minimum_msat(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
27818
27819 /**
27820  * The largest value HTLC (in msat) the remote peer currently will accept, for this channel.
27821  */
27822 struct LDKCOption_u64Z ChannelCounterparty_get_outbound_htlc_maximum_msat(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
27823
27824 /**
27825  * The largest value HTLC (in msat) the remote peer currently will accept, for this channel.
27826  */
27827 void ChannelCounterparty_set_outbound_htlc_maximum_msat(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
27828
27829 /**
27830  * Constructs a new ChannelCounterparty given each field
27831  */
27832 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);
27833
27834 /**
27835  * Creates a copy of the ChannelCounterparty
27836  */
27837 struct LDKChannelCounterparty ChannelCounterparty_clone(const struct LDKChannelCounterparty *NONNULL_PTR orig);
27838
27839 /**
27840  * Frees any resources used by the ChannelDetails, if is_owned is set and inner is non-NULL.
27841  */
27842 void ChannelDetails_free(struct LDKChannelDetails this_obj);
27843
27844 /**
27845  * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
27846  * thereafter this is the txid of the funding transaction xor the funding transaction output).
27847  * Note that this means this value is *not* persistent - it can change once during the
27848  * lifetime of the channel.
27849  */
27850 const uint8_t (*ChannelDetails_get_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr))[32];
27851
27852 /**
27853  * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
27854  * thereafter this is the txid of the funding transaction xor the funding transaction output).
27855  * Note that this means this value is *not* persistent - it can change once during the
27856  * lifetime of the channel.
27857  */
27858 void ChannelDetails_set_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
27859
27860 /**
27861  * Parameters which apply to our counterparty. See individual fields for more information.
27862  */
27863 struct LDKChannelCounterparty ChannelDetails_get_counterparty(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
27864
27865 /**
27866  * Parameters which apply to our counterparty. See individual fields for more information.
27867  */
27868 void ChannelDetails_set_counterparty(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKChannelCounterparty val);
27869
27870 /**
27871  * The Channel's funding transaction output, if we've negotiated the funding transaction with
27872  * our counterparty already.
27873  *
27874  * Note that, if this has been set, `channel_id` will be equivalent to
27875  * `funding_txo.unwrap().to_channel_id()`.
27876  *
27877  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
27878  */
27879 struct LDKOutPoint ChannelDetails_get_funding_txo(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
27880
27881 /**
27882  * The Channel's funding transaction output, if we've negotiated the funding transaction with
27883  * our counterparty already.
27884  *
27885  * Note that, if this has been set, `channel_id` will be equivalent to
27886  * `funding_txo.unwrap().to_channel_id()`.
27887  *
27888  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
27889  */
27890 void ChannelDetails_set_funding_txo(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKOutPoint val);
27891
27892 /**
27893  * The features which this channel operates with. See individual features for more info.
27894  *
27895  * `None` until negotiation completes and the channel type is finalized.
27896  *
27897  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
27898  */
27899 struct LDKChannelTypeFeatures ChannelDetails_get_channel_type(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
27900
27901 /**
27902  * The features which this channel operates with. See individual features for more info.
27903  *
27904  * `None` until negotiation completes and the channel type is finalized.
27905  *
27906  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
27907  */
27908 void ChannelDetails_set_channel_type(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKChannelTypeFeatures val);
27909
27910 /**
27911  * The position of the funding transaction in the chain. None if the funding transaction has
27912  * not yet been confirmed and the channel fully opened.
27913  *
27914  * Note that if [`inbound_scid_alias`] is set, it must be used for invoices and inbound
27915  * payments instead of this. See [`get_inbound_payment_scid`].
27916  *
27917  * For channels with [`confirmations_required`] set to `Some(0)`, [`outbound_scid_alias`] may
27918  * be used in place of this in outbound routes. See [`get_outbound_payment_scid`].
27919  *
27920  * [`inbound_scid_alias`]: Self::inbound_scid_alias
27921  * [`outbound_scid_alias`]: Self::outbound_scid_alias
27922  * [`get_inbound_payment_scid`]: Self::get_inbound_payment_scid
27923  * [`get_outbound_payment_scid`]: Self::get_outbound_payment_scid
27924  * [`confirmations_required`]: Self::confirmations_required
27925  */
27926 struct LDKCOption_u64Z ChannelDetails_get_short_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
27927
27928 /**
27929  * The position of the funding transaction in the chain. None if the funding transaction has
27930  * not yet been confirmed and the channel fully opened.
27931  *
27932  * Note that if [`inbound_scid_alias`] is set, it must be used for invoices and inbound
27933  * payments instead of this. See [`get_inbound_payment_scid`].
27934  *
27935  * For channels with [`confirmations_required`] set to `Some(0)`, [`outbound_scid_alias`] may
27936  * be used in place of this in outbound routes. See [`get_outbound_payment_scid`].
27937  *
27938  * [`inbound_scid_alias`]: Self::inbound_scid_alias
27939  * [`outbound_scid_alias`]: Self::outbound_scid_alias
27940  * [`get_inbound_payment_scid`]: Self::get_inbound_payment_scid
27941  * [`get_outbound_payment_scid`]: Self::get_outbound_payment_scid
27942  * [`confirmations_required`]: Self::confirmations_required
27943  */
27944 void ChannelDetails_set_short_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
27945
27946 /**
27947  * An optional [`short_channel_id`] alias for this channel, randomly generated by us and
27948  * usable in place of [`short_channel_id`] to reference the channel in outbound routes when
27949  * the channel has not yet been confirmed (as long as [`confirmations_required`] is
27950  * `Some(0)`).
27951  *
27952  * This will be `None` as long as the channel is not available for routing outbound payments.
27953  *
27954  * [`short_channel_id`]: Self::short_channel_id
27955  * [`confirmations_required`]: Self::confirmations_required
27956  */
27957 struct LDKCOption_u64Z ChannelDetails_get_outbound_scid_alias(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
27958
27959 /**
27960  * An optional [`short_channel_id`] alias for this channel, randomly generated by us and
27961  * usable in place of [`short_channel_id`] to reference the channel in outbound routes when
27962  * the channel has not yet been confirmed (as long as [`confirmations_required`] is
27963  * `Some(0)`).
27964  *
27965  * This will be `None` as long as the channel is not available for routing outbound payments.
27966  *
27967  * [`short_channel_id`]: Self::short_channel_id
27968  * [`confirmations_required`]: Self::confirmations_required
27969  */
27970 void ChannelDetails_set_outbound_scid_alias(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
27971
27972 /**
27973  * An optional [`short_channel_id`] alias for this channel, randomly generated by our
27974  * counterparty and usable in place of [`short_channel_id`] in invoice route hints. Our
27975  * counterparty will recognize the alias provided here in place of the [`short_channel_id`]
27976  * when they see a payment to be routed to us.
27977  *
27978  * Our counterparty may choose to rotate this value at any time, though will always recognize
27979  * previous values for inbound payment forwarding.
27980  *
27981  * [`short_channel_id`]: Self::short_channel_id
27982  */
27983 struct LDKCOption_u64Z ChannelDetails_get_inbound_scid_alias(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
27984
27985 /**
27986  * An optional [`short_channel_id`] alias for this channel, randomly generated by our
27987  * counterparty and usable in place of [`short_channel_id`] in invoice route hints. Our
27988  * counterparty will recognize the alias provided here in place of the [`short_channel_id`]
27989  * when they see a payment to be routed to us.
27990  *
27991  * Our counterparty may choose to rotate this value at any time, though will always recognize
27992  * previous values for inbound payment forwarding.
27993  *
27994  * [`short_channel_id`]: Self::short_channel_id
27995  */
27996 void ChannelDetails_set_inbound_scid_alias(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
27997
27998 /**
27999  * The value, in satoshis, of this channel as appears in the funding output
28000  */
28001 uint64_t ChannelDetails_get_channel_value_satoshis(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
28002
28003 /**
28004  * The value, in satoshis, of this channel as appears in the funding output
28005  */
28006 void ChannelDetails_set_channel_value_satoshis(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
28007
28008 /**
28009  * The value, in satoshis, that must always be held in the channel for us. This value ensures
28010  * that if we broadcast a revoked state, our counterparty can punish us by claiming at least
28011  * this value on chain.
28012  *
28013  * This value is not included in [`outbound_capacity_msat`] as it can never be spent.
28014  *
28015  * This value will be `None` for outbound channels until the counterparty accepts the channel.
28016  *
28017  * [`outbound_capacity_msat`]: ChannelDetails::outbound_capacity_msat
28018  */
28019 struct LDKCOption_u64Z ChannelDetails_get_unspendable_punishment_reserve(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
28020
28021 /**
28022  * The value, in satoshis, that must always be held in the channel for us. This value ensures
28023  * that if we broadcast a revoked state, our counterparty can punish us by claiming at least
28024  * this value on chain.
28025  *
28026  * This value is not included in [`outbound_capacity_msat`] as it can never be spent.
28027  *
28028  * This value will be `None` for outbound channels until the counterparty accepts the channel.
28029  *
28030  * [`outbound_capacity_msat`]: ChannelDetails::outbound_capacity_msat
28031  */
28032 void ChannelDetails_set_unspendable_punishment_reserve(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
28033
28034 /**
28035  * The `user_channel_id` passed in to create_channel, or a random value if the channel was
28036  * inbound. This may be zero for inbound channels serialized with LDK versions prior to
28037  * 0.0.113.
28038  */
28039 struct LDKU128 ChannelDetails_get_user_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
28040
28041 /**
28042  * The `user_channel_id` passed in to create_channel, or a random value if the channel was
28043  * inbound. This may be zero for inbound channels serialized with LDK versions prior to
28044  * 0.0.113.
28045  */
28046 void ChannelDetails_set_user_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKU128 val);
28047
28048 /**
28049  * The currently negotiated fee rate denominated in satoshi per 1000 weight units,
28050  * which is applied to commitment and HTLC transactions.
28051  *
28052  * This value will be `None` for objects serialized with LDK versions prior to 0.0.115.
28053  */
28054 struct LDKCOption_u32Z ChannelDetails_get_feerate_sat_per_1000_weight(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
28055
28056 /**
28057  * The currently negotiated fee rate denominated in satoshi per 1000 weight units,
28058  * which is applied to commitment and HTLC transactions.
28059  *
28060  * This value will be `None` for objects serialized with LDK versions prior to 0.0.115.
28061  */
28062 void ChannelDetails_set_feerate_sat_per_1000_weight(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val);
28063
28064 /**
28065  * Our total balance.  This is the amount we would get if we close the channel.
28066  * This value is not exact. Due to various in-flight changes and feerate changes, exactly this
28067  * amount is not likely to be recoverable on close.
28068  *
28069  * This does not include any pending HTLCs which are not yet fully resolved (and, thus, whose
28070  * balance is not available for inclusion in new outbound HTLCs). This further does not include
28071  * any pending outgoing HTLCs which are awaiting some other resolution to be sent.
28072  * This does not consider any on-chain fees.
28073  *
28074  * See also [`ChannelDetails::outbound_capacity_msat`]
28075  */
28076 uint64_t ChannelDetails_get_balance_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
28077
28078 /**
28079  * Our total balance.  This is the amount we would get if we close the channel.
28080  * This value is not exact. Due to various in-flight changes and feerate changes, exactly this
28081  * amount is not likely to be recoverable on close.
28082  *
28083  * This does not include any pending HTLCs which are not yet fully resolved (and, thus, whose
28084  * balance is not available for inclusion in new outbound HTLCs). This further does not include
28085  * any pending outgoing HTLCs which are awaiting some other resolution to be sent.
28086  * This does not consider any on-chain fees.
28087  *
28088  * See also [`ChannelDetails::outbound_capacity_msat`]
28089  */
28090 void ChannelDetails_set_balance_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
28091
28092 /**
28093  * The available outbound capacity for sending HTLCs to the remote peer. This does not include
28094  * any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
28095  * available for inclusion in new outbound HTLCs). This further does not include any pending
28096  * outgoing HTLCs which are awaiting some other resolution to be sent.
28097  *
28098  * See also [`ChannelDetails::balance_msat`]
28099  *
28100  * This value is not exact. Due to various in-flight changes, feerate changes, and our
28101  * conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we
28102  * should be able to spend nearly this amount.
28103  */
28104 uint64_t ChannelDetails_get_outbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
28105
28106 /**
28107  * The available outbound capacity for sending HTLCs to the remote peer. This does not include
28108  * any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
28109  * available for inclusion in new outbound HTLCs). This further does not include any pending
28110  * outgoing HTLCs which are awaiting some other resolution to be sent.
28111  *
28112  * See also [`ChannelDetails::balance_msat`]
28113  *
28114  * This value is not exact. Due to various in-flight changes, feerate changes, and our
28115  * conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we
28116  * should be able to spend nearly this amount.
28117  */
28118 void ChannelDetails_set_outbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
28119
28120 /**
28121  * The available outbound capacity for sending a single HTLC to the remote peer. This is
28122  * similar to [`ChannelDetails::outbound_capacity_msat`] but it may be further restricted by
28123  * the current state and per-HTLC limit(s). This is intended for use when routing, allowing us
28124  * to use a limit as close as possible to the HTLC limit we can currently send.
28125  *
28126  * See also [`ChannelDetails::next_outbound_htlc_minimum_msat`],
28127  * [`ChannelDetails::balance_msat`], and [`ChannelDetails::outbound_capacity_msat`].
28128  */
28129 uint64_t ChannelDetails_get_next_outbound_htlc_limit_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
28130
28131 /**
28132  * The available outbound capacity for sending a single HTLC to the remote peer. This is
28133  * similar to [`ChannelDetails::outbound_capacity_msat`] but it may be further restricted by
28134  * the current state and per-HTLC limit(s). This is intended for use when routing, allowing us
28135  * to use a limit as close as possible to the HTLC limit we can currently send.
28136  *
28137  * See also [`ChannelDetails::next_outbound_htlc_minimum_msat`],
28138  * [`ChannelDetails::balance_msat`], and [`ChannelDetails::outbound_capacity_msat`].
28139  */
28140 void ChannelDetails_set_next_outbound_htlc_limit_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
28141
28142 /**
28143  * The minimum value for sending a single HTLC to the remote peer. This is the equivalent of
28144  * [`ChannelDetails::next_outbound_htlc_limit_msat`] but represents a lower-bound, rather than
28145  * an upper-bound. This is intended for use when routing, allowing us to ensure we pick a
28146  * route which is valid.
28147  */
28148 uint64_t ChannelDetails_get_next_outbound_htlc_minimum_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
28149
28150 /**
28151  * The minimum value for sending a single HTLC to the remote peer. This is the equivalent of
28152  * [`ChannelDetails::next_outbound_htlc_limit_msat`] but represents a lower-bound, rather than
28153  * an upper-bound. This is intended for use when routing, allowing us to ensure we pick a
28154  * route which is valid.
28155  */
28156 void ChannelDetails_set_next_outbound_htlc_minimum_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
28157
28158 /**
28159  * The available inbound capacity for the remote peer to send HTLCs to us. This does not
28160  * include any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
28161  * available for inclusion in new inbound HTLCs).
28162  * Note that there are some corner cases not fully handled here, so the actual available
28163  * inbound capacity may be slightly higher than this.
28164  *
28165  * This value is not exact. Due to various in-flight changes, feerate changes, and our
28166  * counterparty's conflict-avoidance policy, exactly this amount is not likely to be spendable.
28167  * However, our counterparty should be able to spend nearly this amount.
28168  */
28169 uint64_t ChannelDetails_get_inbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
28170
28171 /**
28172  * The available inbound capacity for the remote peer to send HTLCs to us. This does not
28173  * include any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
28174  * available for inclusion in new inbound HTLCs).
28175  * Note that there are some corner cases not fully handled here, so the actual available
28176  * inbound capacity may be slightly higher than this.
28177  *
28178  * This value is not exact. Due to various in-flight changes, feerate changes, and our
28179  * counterparty's conflict-avoidance policy, exactly this amount is not likely to be spendable.
28180  * However, our counterparty should be able to spend nearly this amount.
28181  */
28182 void ChannelDetails_set_inbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
28183
28184 /**
28185  * The number of required confirmations on the funding transaction before the funding will be
28186  * considered \"locked\". This number is selected by the channel fundee (i.e. us if
28187  * [`is_outbound`] is *not* set), and can be selected for inbound channels with
28188  * [`ChannelHandshakeConfig::minimum_depth`] or limited for outbound channels with
28189  * [`ChannelHandshakeLimits::max_minimum_depth`].
28190  *
28191  * This value will be `None` for outbound channels until the counterparty accepts the channel.
28192  *
28193  * [`is_outbound`]: ChannelDetails::is_outbound
28194  * [`ChannelHandshakeConfig::minimum_depth`]: crate::util::config::ChannelHandshakeConfig::minimum_depth
28195  * [`ChannelHandshakeLimits::max_minimum_depth`]: crate::util::config::ChannelHandshakeLimits::max_minimum_depth
28196  */
28197 struct LDKCOption_u32Z ChannelDetails_get_confirmations_required(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
28198
28199 /**
28200  * The number of required confirmations on the funding transaction before the funding will be
28201  * considered \"locked\". This number is selected by the channel fundee (i.e. us if
28202  * [`is_outbound`] is *not* set), and can be selected for inbound channels with
28203  * [`ChannelHandshakeConfig::minimum_depth`] or limited for outbound channels with
28204  * [`ChannelHandshakeLimits::max_minimum_depth`].
28205  *
28206  * This value will be `None` for outbound channels until the counterparty accepts the channel.
28207  *
28208  * [`is_outbound`]: ChannelDetails::is_outbound
28209  * [`ChannelHandshakeConfig::minimum_depth`]: crate::util::config::ChannelHandshakeConfig::minimum_depth
28210  * [`ChannelHandshakeLimits::max_minimum_depth`]: crate::util::config::ChannelHandshakeLimits::max_minimum_depth
28211  */
28212 void ChannelDetails_set_confirmations_required(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val);
28213
28214 /**
28215  * The current number of confirmations on the funding transaction.
28216  *
28217  * This value will be `None` for objects serialized with LDK versions prior to 0.0.113.
28218  */
28219 struct LDKCOption_u32Z ChannelDetails_get_confirmations(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
28220
28221 /**
28222  * The current number of confirmations on the funding transaction.
28223  *
28224  * This value will be `None` for objects serialized with LDK versions prior to 0.0.113.
28225  */
28226 void ChannelDetails_set_confirmations(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val);
28227
28228 /**
28229  * The number of blocks (after our commitment transaction confirms) that we will need to wait
28230  * until we can claim our funds after we force-close the channel. During this time our
28231  * counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty
28232  * force-closes the channel and broadcasts a commitment transaction we do not have to wait any
28233  * time to claim our non-HTLC-encumbered funds.
28234  *
28235  * This value will be `None` for outbound channels until the counterparty accepts the channel.
28236  */
28237 struct LDKCOption_u16Z ChannelDetails_get_force_close_spend_delay(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
28238
28239 /**
28240  * The number of blocks (after our commitment transaction confirms) that we will need to wait
28241  * until we can claim our funds after we force-close the channel. During this time our
28242  * counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty
28243  * force-closes the channel and broadcasts a commitment transaction we do not have to wait any
28244  * time to claim our non-HTLC-encumbered funds.
28245  *
28246  * This value will be `None` for outbound channels until the counterparty accepts the channel.
28247  */
28248 void ChannelDetails_set_force_close_spend_delay(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u16Z val);
28249
28250 /**
28251  * True if the channel was initiated (and thus funded) by us.
28252  */
28253 bool ChannelDetails_get_is_outbound(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
28254
28255 /**
28256  * True if the channel was initiated (and thus funded) by us.
28257  */
28258 void ChannelDetails_set_is_outbound(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
28259
28260 /**
28261  * True if the channel is confirmed, channel_ready messages have been exchanged, and the
28262  * channel is not currently being shut down. `channel_ready` message exchange implies the
28263  * required confirmation count has been reached (and we were connected to the peer at some
28264  * point after the funding transaction received enough confirmations). The required
28265  * confirmation count is provided in [`confirmations_required`].
28266  *
28267  * [`confirmations_required`]: ChannelDetails::confirmations_required
28268  */
28269 bool ChannelDetails_get_is_channel_ready(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
28270
28271 /**
28272  * True if the channel is confirmed, channel_ready messages have been exchanged, and the
28273  * channel is not currently being shut down. `channel_ready` message exchange implies the
28274  * required confirmation count has been reached (and we were connected to the peer at some
28275  * point after the funding transaction received enough confirmations). The required
28276  * confirmation count is provided in [`confirmations_required`].
28277  *
28278  * [`confirmations_required`]: ChannelDetails::confirmations_required
28279  */
28280 void ChannelDetails_set_is_channel_ready(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
28281
28282 /**
28283  * The stage of the channel's shutdown.
28284  * `None` for `ChannelDetails` serialized on LDK versions prior to 0.0.116.
28285  *
28286  * Returns a copy of the field.
28287  */
28288 struct LDKCOption_ChannelShutdownStateZ ChannelDetails_get_channel_shutdown_state(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
28289
28290 /**
28291  * The stage of the channel's shutdown.
28292  * `None` for `ChannelDetails` serialized on LDK versions prior to 0.0.116.
28293  */
28294 void ChannelDetails_set_channel_shutdown_state(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_ChannelShutdownStateZ val);
28295
28296 /**
28297  * True if the channel is (a) confirmed and channel_ready messages have been exchanged, (b)
28298  * the peer is connected, and (c) the channel is not currently negotiating a shutdown.
28299  *
28300  * This is a strict superset of `is_channel_ready`.
28301  */
28302 bool ChannelDetails_get_is_usable(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
28303
28304 /**
28305  * True if the channel is (a) confirmed and channel_ready messages have been exchanged, (b)
28306  * the peer is connected, and (c) the channel is not currently negotiating a shutdown.
28307  *
28308  * This is a strict superset of `is_channel_ready`.
28309  */
28310 void ChannelDetails_set_is_usable(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
28311
28312 /**
28313  * True if this channel is (or will be) publicly-announced.
28314  */
28315 bool ChannelDetails_get_is_public(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
28316
28317 /**
28318  * True if this channel is (or will be) publicly-announced.
28319  */
28320 void ChannelDetails_set_is_public(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
28321
28322 /**
28323  * The smallest value HTLC (in msat) we will accept, for this channel. This field
28324  * is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.107
28325  */
28326 struct LDKCOption_u64Z ChannelDetails_get_inbound_htlc_minimum_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
28327
28328 /**
28329  * The smallest value HTLC (in msat) we will accept, for this channel. This field
28330  * is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.107
28331  */
28332 void ChannelDetails_set_inbound_htlc_minimum_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
28333
28334 /**
28335  * The largest value HTLC (in msat) we currently will accept, for this channel.
28336  */
28337 struct LDKCOption_u64Z ChannelDetails_get_inbound_htlc_maximum_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
28338
28339 /**
28340  * The largest value HTLC (in msat) we currently will accept, for this channel.
28341  */
28342 void ChannelDetails_set_inbound_htlc_maximum_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
28343
28344 /**
28345  * Set of configurable parameters that affect channel operation.
28346  *
28347  * This field is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.109.
28348  *
28349  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
28350  */
28351 struct LDKChannelConfig ChannelDetails_get_config(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
28352
28353 /**
28354  * Set of configurable parameters that affect channel operation.
28355  *
28356  * This field is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.109.
28357  *
28358  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
28359  */
28360 void ChannelDetails_set_config(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKChannelConfig val);
28361
28362 /**
28363  * Constructs a new ChannelDetails given each field
28364  */
28365 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 next_outbound_htlc_minimum_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, struct LDKCOption_ChannelShutdownStateZ channel_shutdown_state_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);
28366
28367 /**
28368  * Creates a copy of the ChannelDetails
28369  */
28370 struct LDKChannelDetails ChannelDetails_clone(const struct LDKChannelDetails *NONNULL_PTR orig);
28371
28372 /**
28373  * Gets the current SCID which should be used to identify this channel for inbound payments.
28374  * This should be used for providing invoice hints or in any other context where our
28375  * counterparty will forward a payment to us.
28376  *
28377  * This is either the [`ChannelDetails::inbound_scid_alias`], if set, or the
28378  * [`ChannelDetails::short_channel_id`]. See those for more information.
28379  */
28380 MUST_USE_RES struct LDKCOption_u64Z ChannelDetails_get_inbound_payment_scid(const struct LDKChannelDetails *NONNULL_PTR this_arg);
28381
28382 /**
28383  * Gets the current SCID which should be used to identify this channel for outbound payments.
28384  * This should be used in [`Route`]s to describe the first hop or in other contexts where
28385  * we're sending or forwarding a payment outbound over this channel.
28386  *
28387  * This is either the [`ChannelDetails::short_channel_id`], if set, or the
28388  * [`ChannelDetails::outbound_scid_alias`]. See those for more information.
28389  */
28390 MUST_USE_RES struct LDKCOption_u64Z ChannelDetails_get_outbound_payment_scid(const struct LDKChannelDetails *NONNULL_PTR this_arg);
28391
28392 /**
28393  * Creates a copy of the ChannelShutdownState
28394  */
28395 enum LDKChannelShutdownState ChannelShutdownState_clone(const enum LDKChannelShutdownState *NONNULL_PTR orig);
28396
28397 /**
28398  * Utility method to constructs a new NotShuttingDown-variant ChannelShutdownState
28399  */
28400 enum LDKChannelShutdownState ChannelShutdownState_not_shutting_down(void);
28401
28402 /**
28403  * Utility method to constructs a new ShutdownInitiated-variant ChannelShutdownState
28404  */
28405 enum LDKChannelShutdownState ChannelShutdownState_shutdown_initiated(void);
28406
28407 /**
28408  * Utility method to constructs a new ResolvingHTLCs-variant ChannelShutdownState
28409  */
28410 enum LDKChannelShutdownState ChannelShutdownState_resolving_htlcs(void);
28411
28412 /**
28413  * Utility method to constructs a new NegotiatingClosingFee-variant ChannelShutdownState
28414  */
28415 enum LDKChannelShutdownState ChannelShutdownState_negotiating_closing_fee(void);
28416
28417 /**
28418  * Utility method to constructs a new ShutdownComplete-variant ChannelShutdownState
28419  */
28420 enum LDKChannelShutdownState ChannelShutdownState_shutdown_complete(void);
28421
28422 /**
28423  * Checks if two ChannelShutdownStates contain equal inner contents.
28424  * This ignores pointers and is_owned flags and looks at the values in fields.
28425  */
28426 bool ChannelShutdownState_eq(const enum LDKChannelShutdownState *NONNULL_PTR a, const enum LDKChannelShutdownState *NONNULL_PTR b);
28427
28428 /**
28429  * Frees any resources used by the RecentPaymentDetails
28430  */
28431 void RecentPaymentDetails_free(struct LDKRecentPaymentDetails this_ptr);
28432
28433 /**
28434  * Creates a copy of the RecentPaymentDetails
28435  */
28436 struct LDKRecentPaymentDetails RecentPaymentDetails_clone(const struct LDKRecentPaymentDetails *NONNULL_PTR orig);
28437
28438 /**
28439  * Utility method to constructs a new Pending-variant RecentPaymentDetails
28440  */
28441 struct LDKRecentPaymentDetails RecentPaymentDetails_pending(struct LDKThirtyTwoBytes payment_hash, uint64_t total_msat);
28442
28443 /**
28444  * Utility method to constructs a new Fulfilled-variant RecentPaymentDetails
28445  */
28446 struct LDKRecentPaymentDetails RecentPaymentDetails_fulfilled(struct LDKCOption_PaymentHashZ payment_hash);
28447
28448 /**
28449  * Utility method to constructs a new Abandoned-variant RecentPaymentDetails
28450  */
28451 struct LDKRecentPaymentDetails RecentPaymentDetails_abandoned(struct LDKThirtyTwoBytes payment_hash);
28452
28453 /**
28454  * Frees any resources used by the PhantomRouteHints, if is_owned is set and inner is non-NULL.
28455  */
28456 void PhantomRouteHints_free(struct LDKPhantomRouteHints this_obj);
28457
28458 /**
28459  * The list of channels to be included in the invoice route hints.
28460  */
28461 struct LDKCVec_ChannelDetailsZ PhantomRouteHints_get_channels(const struct LDKPhantomRouteHints *NONNULL_PTR this_ptr);
28462
28463 /**
28464  * The list of channels to be included in the invoice route hints.
28465  */
28466 void PhantomRouteHints_set_channels(struct LDKPhantomRouteHints *NONNULL_PTR this_ptr, struct LDKCVec_ChannelDetailsZ val);
28467
28468 /**
28469  * A fake scid used for representing the phantom node's fake channel in generating the invoice
28470  * route hints.
28471  */
28472 uint64_t PhantomRouteHints_get_phantom_scid(const struct LDKPhantomRouteHints *NONNULL_PTR this_ptr);
28473
28474 /**
28475  * A fake scid used for representing the phantom node's fake channel in generating the invoice
28476  * route hints.
28477  */
28478 void PhantomRouteHints_set_phantom_scid(struct LDKPhantomRouteHints *NONNULL_PTR this_ptr, uint64_t val);
28479
28480 /**
28481  * The pubkey of the real backing node that would ultimately receive the payment.
28482  */
28483 struct LDKPublicKey PhantomRouteHints_get_real_node_pubkey(const struct LDKPhantomRouteHints *NONNULL_PTR this_ptr);
28484
28485 /**
28486  * The pubkey of the real backing node that would ultimately receive the payment.
28487  */
28488 void PhantomRouteHints_set_real_node_pubkey(struct LDKPhantomRouteHints *NONNULL_PTR this_ptr, struct LDKPublicKey val);
28489
28490 /**
28491  * Constructs a new PhantomRouteHints given each field
28492  */
28493 MUST_USE_RES struct LDKPhantomRouteHints PhantomRouteHints_new(struct LDKCVec_ChannelDetailsZ channels_arg, uint64_t phantom_scid_arg, struct LDKPublicKey real_node_pubkey_arg);
28494
28495 /**
28496  * Creates a copy of the PhantomRouteHints
28497  */
28498 struct LDKPhantomRouteHints PhantomRouteHints_clone(const struct LDKPhantomRouteHints *NONNULL_PTR orig);
28499
28500 /**
28501  * Constructs a new `ChannelManager` to hold several channels and route between them.
28502  *
28503  * The current time or latest block header time can be provided as the `current_timestamp`.
28504  *
28505  * This is the main \"logic hub\" for all channel-related actions, and implements
28506  * [`ChannelMessageHandler`].
28507  *
28508  * Non-proportional fees are fixed according to our risk using the provided fee estimator.
28509  *
28510  * Users need to notify the new `ChannelManager` when a new block is connected or
28511  * disconnected using its [`block_connected`] and [`block_disconnected`] methods, starting
28512  * from after [`params.best_block.block_hash`]. See [`chain::Listen`] and [`chain::Confirm`] for
28513  * more details.
28514  *
28515  * [`block_connected`]: chain::Listen::block_connected
28516  * [`block_disconnected`]: chain::Listen::block_disconnected
28517  * [`params.best_block.block_hash`]: chain::BestBlock::block_hash
28518  */
28519 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, uint32_t current_timestamp);
28520
28521 /**
28522  * Gets the current configuration applied to all new channels.
28523  */
28524 MUST_USE_RES struct LDKUserConfig ChannelManager_get_current_default_configuration(const struct LDKChannelManager *NONNULL_PTR this_arg);
28525
28526 /**
28527  * Creates a new outbound channel to the given remote node and with the given value.
28528  *
28529  * `user_channel_id` will be provided back as in
28530  * [`Event::FundingGenerationReady::user_channel_id`] to allow tracking of which events
28531  * correspond with which `create_channel` call. Note that the `user_channel_id` defaults to a
28532  * randomized value for inbound channels. `user_channel_id` has no meaning inside of LDK, it
28533  * is simply copied to events and otherwise ignored.
28534  *
28535  * Raises [`APIError::APIMisuseError`] when `channel_value_satoshis` > 2**24 or `push_msat` is
28536  * greater than `channel_value_satoshis * 1k` or `channel_value_satoshis < 1000`.
28537  *
28538  * Raises [`APIError::ChannelUnavailable`] if the channel cannot be opened due to failing to
28539  * generate a shutdown scriptpubkey or destination script set by
28540  * [`SignerProvider::get_shutdown_scriptpubkey`] or [`SignerProvider::get_destination_script`].
28541  *
28542  * Note that we do not check if you are currently connected to the given peer. If no
28543  * connection is available, the outbound `open_channel` message may fail to send, resulting in
28544  * the channel eventually being silently forgotten (dropped on reload).
28545  *
28546  * Returns the new Channel's temporary `channel_id`. This ID will appear as
28547  * [`Event::FundingGenerationReady::temporary_channel_id`] and in
28548  * [`ChannelDetails::channel_id`] until after
28549  * [`ChannelManager::funding_transaction_generated`] is called, swapping the Channel's ID for
28550  * one derived from the funding transaction's TXID. If the counterparty rejects the channel
28551  * immediately, this temporary ID will appear in [`Event::ChannelClosed::channel_id`].
28552  *
28553  * [`Event::FundingGenerationReady::user_channel_id`]: events::Event::FundingGenerationReady::user_channel_id
28554  * [`Event::FundingGenerationReady::temporary_channel_id`]: events::Event::FundingGenerationReady::temporary_channel_id
28555  * [`Event::ChannelClosed::channel_id`]: events::Event::ChannelClosed::channel_id
28556  *
28557  * Note that override_config (or a relevant inner pointer) may be NULL or all-0s to represent None
28558  */
28559 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);
28560
28561 /**
28562  * Gets the list of open channels, in random order. See [`ChannelDetails`] field documentation for
28563  * more information.
28564  */
28565 MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
28566
28567 /**
28568  * Gets the list of usable channels, in random order. Useful as an argument to
28569  * [`Router::find_route`] to ensure non-announced channels are used.
28570  *
28571  * These are guaranteed to have their [`ChannelDetails::is_usable`] value set to true, see the
28572  * documentation for [`ChannelDetails::is_usable`] for more info on exactly what the criteria
28573  * are.
28574  */
28575 MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_usable_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
28576
28577 /**
28578  * Gets the list of channels we have with a given counterparty, in random order.
28579  */
28580 MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_channels_with_counterparty(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKPublicKey counterparty_node_id);
28581
28582 /**
28583  * Returns in an undefined order recent payments that -- if not fulfilled -- have yet to find a
28584  * successful path, or have unresolved HTLCs.
28585  *
28586  * This can be useful for payments that may have been prepared, but ultimately not sent, as a
28587  * result of a crash. If such a payment exists, is not listed here, and an
28588  * [`Event::PaymentSent`] has not been received, you may consider resending the payment.
28589  *
28590  * [`Event::PaymentSent`]: events::Event::PaymentSent
28591  */
28592 MUST_USE_RES struct LDKCVec_RecentPaymentDetailsZ ChannelManager_list_recent_payments(const struct LDKChannelManager *NONNULL_PTR this_arg);
28593
28594 /**
28595  * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs
28596  * will be accepted on the given channel, and after additional timeout/the closing of all
28597  * pending HTLCs, the channel will be closed on chain.
28598  *
28599  *  * If we are the channel initiator, we will pay between our [`Background`] and
28600  *    [`ChannelConfig::force_close_avoidance_max_fee_satoshis`] plus our [`Normal`] fee
28601  *    estimate.
28602  *  * If our counterparty is the channel initiator, we will require a channel closing
28603  *    transaction feerate of at least our [`Background`] feerate or the feerate which
28604  *    would appear on a force-closure transaction, whichever is lower. We will allow our
28605  *    counterparty to pay as much fee as they'd like, however.
28606  *
28607  * May generate a [`SendShutdown`] message event on success, which should be relayed.
28608  *
28609  * Raises [`APIError::ChannelUnavailable`] if the channel cannot be closed due to failing to
28610  * generate a shutdown scriptpubkey or destination script set by
28611  * [`SignerProvider::get_shutdown_scriptpubkey`]. A force-closure may be needed to close the
28612  * channel.
28613  *
28614  * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]: crate::util::config::ChannelConfig::force_close_avoidance_max_fee_satoshis
28615  * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
28616  * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
28617  * [`SendShutdown`]: crate::events::MessageSendEvent::SendShutdown
28618  */
28619 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);
28620
28621 /**
28622  * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs
28623  * will be accepted on the given channel, and after additional timeout/the closing of all
28624  * pending HTLCs, the channel will be closed on chain.
28625  *
28626  * `target_feerate_sat_per_1000_weight` has different meanings depending on if we initiated
28627  * the channel being closed or not:
28628  *  * If we are the channel initiator, we will pay at least this feerate on the closing
28629  *    transaction. The upper-bound is set by
28630  *    [`ChannelConfig::force_close_avoidance_max_fee_satoshis`] plus our [`Normal`] fee
28631  *    estimate (or `target_feerate_sat_per_1000_weight`, if it is greater).
28632  *  * If our counterparty is the channel initiator, we will refuse to accept a channel closure
28633  *    transaction feerate below `target_feerate_sat_per_1000_weight` (or the feerate which
28634  *    will appear on a force-closure transaction, whichever is lower).
28635  *
28636  * The `shutdown_script` provided  will be used as the `scriptPubKey` for the closing transaction.
28637  * Will fail if a shutdown script has already been set for this channel by
28638  * ['ChannelHandshakeConfig::commit_upfront_shutdown_pubkey`]. The given shutdown script must
28639  * also be compatible with our and the counterparty's features.
28640  *
28641  * May generate a [`SendShutdown`] message event on success, which should be relayed.
28642  *
28643  * Raises [`APIError::ChannelUnavailable`] if the channel cannot be closed due to failing to
28644  * generate a shutdown scriptpubkey or destination script set by
28645  * [`SignerProvider::get_shutdown_scriptpubkey`]. A force-closure may be needed to close the
28646  * channel.
28647  *
28648  * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]: crate::util::config::ChannelConfig::force_close_avoidance_max_fee_satoshis
28649  * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
28650  * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
28651  * [`SendShutdown`]: crate::events::MessageSendEvent::SendShutdown
28652  *
28653  * Note that shutdown_script (or a relevant inner pointer) may be NULL or all-0s to represent None
28654  */
28655 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_close_channel_with_feerate_and_script(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32], struct LDKPublicKey counterparty_node_id, struct LDKCOption_u32Z target_feerate_sats_per_1000_weight, struct LDKShutdownScript shutdown_script);
28656
28657 /**
28658  * Force closes a channel, immediately broadcasting the latest local transaction(s) and
28659  * rejecting new HTLCs on the given channel. Fails if `channel_id` is unknown to
28660  * the manager, or if the `counterparty_node_id` isn't the counterparty of the corresponding
28661  * channel.
28662  */
28663 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);
28664
28665 /**
28666  * Force closes a channel, rejecting new HTLCs on the given channel but skips broadcasting
28667  * the latest local transaction(s). Fails if `channel_id` is unknown to the manager, or if the
28668  * `counterparty_node_id` isn't the counterparty of the corresponding channel.
28669  *
28670  * You can always get the latest local transaction(s) to broadcast from
28671  * [`ChannelMonitor::get_latest_holder_commitment_txn`].
28672  */
28673 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);
28674
28675 /**
28676  * Force close all channels, immediately broadcasting the latest local commitment transaction
28677  * for each to the chain and rejecting new HTLCs on each.
28678  */
28679 void ChannelManager_force_close_all_channels_broadcasting_latest_txn(const struct LDKChannelManager *NONNULL_PTR this_arg);
28680
28681 /**
28682  * Force close all channels rejecting new HTLCs on each but without broadcasting the latest
28683  * local transaction(s).
28684  */
28685 void ChannelManager_force_close_all_channels_without_broadcasting_txn(const struct LDKChannelManager *NONNULL_PTR this_arg);
28686
28687 /**
28688  * Sends a payment along a given route.
28689  *
28690  * Value parameters are provided via the last hop in route, see documentation for [`RouteHop`]
28691  * fields for more info.
28692  *
28693  * May generate [`UpdateHTLCs`] message(s) event on success, which should be relayed (e.g. via
28694  * [`PeerManager::process_events`]).
28695  *
28696  * # Avoiding Duplicate Payments
28697  *
28698  * If a pending payment is currently in-flight with the same [`PaymentId`] provided, this
28699  * method will error with an [`APIError::InvalidRoute`]. Note, however, that once a payment
28700  * is no longer pending (either via [`ChannelManager::abandon_payment`], or handling of an
28701  * [`Event::PaymentSent`] or [`Event::PaymentFailed`]) LDK will not stop you from sending a
28702  * second payment with the same [`PaymentId`].
28703  *
28704  * Thus, in order to ensure duplicate payments are not sent, you should implement your own
28705  * tracking of payments, including state to indicate once a payment has completed. Because you
28706  * should also ensure that [`PaymentHash`]es are not re-used, for simplicity, you should
28707  * consider using the [`PaymentHash`] as the key for tracking payments. In that case, the
28708  * [`PaymentId`] should be a copy of the [`PaymentHash`] bytes.
28709  *
28710  * Additionally, in the scenario where we begin the process of sending a payment, but crash
28711  * before `send_payment` returns (or prior to [`ChannelMonitorUpdate`] persistence if you're
28712  * using [`ChannelMonitorUpdateStatus::InProgress`]), the payment may be lost on restart. See
28713  * [`ChannelManager::list_recent_payments`] for more information.
28714  *
28715  * # Possible Error States on [`PaymentSendFailure`]
28716  *
28717  * Each path may have a different return value, and [`PaymentSendFailure`] may return a `Vec` with
28718  * each entry matching the corresponding-index entry in the route paths, see
28719  * [`PaymentSendFailure`] for more info.
28720  *
28721  * In general, a path may raise:
28722  *  * [`APIError::InvalidRoute`] when an invalid route or forwarding parameter (cltv_delta, fee,
28723  *    node public key) is specified.
28724  *  * [`APIError::ChannelUnavailable`] if the next-hop channel is not available for updates
28725  *    (including due to previous monitor update failure or new permanent monitor update
28726  *    failure).
28727  *  * [`APIError::MonitorUpdateInProgress`] if a new monitor update failure prevented sending the
28728  *    relevant updates.
28729  *
28730  * Note that depending on the type of the [`PaymentSendFailure`] the HTLC may have been
28731  * irrevocably committed to on our end. In such a case, do NOT retry the payment with a
28732  * different route unless you intend to pay twice!
28733  *
28734  * [`RouteHop`]: crate::routing::router::RouteHop
28735  * [`Event::PaymentSent`]: events::Event::PaymentSent
28736  * [`Event::PaymentFailed`]: events::Event::PaymentFailed
28737  * [`UpdateHTLCs`]: events::MessageSendEvent::UpdateHTLCs
28738  * [`PeerManager::process_events`]: crate::ln::peer_handler::PeerManager::process_events
28739  * [`ChannelMonitorUpdateStatus::InProgress`]: crate::chain::ChannelMonitorUpdateStatus::InProgress
28740  */
28741 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);
28742
28743 /**
28744  * Similar to [`ChannelManager::send_payment_with_route`], but will automatically find a route based on
28745  * `route_params` and retry failed payment paths based on `retry_strategy`.
28746  */
28747 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);
28748
28749 /**
28750  * Signals that no further retries for the given payment should occur. Useful if you have a
28751  * pending outbound payment with retries remaining, but wish to stop retrying the payment before
28752  * retries are exhausted.
28753  *
28754  * If no [`Event::PaymentFailed`] event had been generated before, one will be generated as soon
28755  * as there are no remaining pending HTLCs for this payment.
28756  *
28757  * Note that calling this method does *not* prevent a payment from succeeding. You must still
28758  * wait until you receive either a [`Event::PaymentFailed`] or [`Event::PaymentSent`] event to
28759  * determine the ultimate status of a payment.
28760  *
28761  * If an [`Event::PaymentFailed`] event is generated and we restart without this
28762  * [`ChannelManager`] having been persisted, another [`Event::PaymentFailed`] may be generated.
28763  *
28764  * [`Event::PaymentFailed`]: events::Event::PaymentFailed
28765  * [`Event::PaymentSent`]: events::Event::PaymentSent
28766  */
28767 void ChannelManager_abandon_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_id);
28768
28769 /**
28770  * Send a spontaneous payment, which is a payment that does not require the recipient to have
28771  * generated an invoice. Optionally, you may specify the preimage. If you do choose to specify
28772  * the preimage, it must be a cryptographically secure random value that no intermediate node
28773  * would be able to guess -- otherwise, an intermediate node may claim the payment and it will
28774  * never reach the recipient.
28775  *
28776  * See [`send_payment`] documentation for more details on the return value of this function
28777  * and idempotency guarantees provided by the [`PaymentId`] key.
28778  *
28779  * Similar to regular payments, you MUST NOT reuse a `payment_preimage` value. See
28780  * [`send_payment`] for more information about the risks of duplicate preimage usage.
28781  *
28782  * [`send_payment`]: Self::send_payment
28783  */
28784 MUST_USE_RES struct LDKCResult_PaymentHashPaymentSendFailureZ ChannelManager_send_spontaneous_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKCOption_PaymentPreimageZ payment_preimage, struct LDKRecipientOnionFields recipient_onion, struct LDKThirtyTwoBytes payment_id);
28785
28786 /**
28787  * Similar to [`ChannelManager::send_spontaneous_payment`], but will automatically find a route
28788  * based on `route_params` and retry failed payment paths based on `retry_strategy`.
28789  *
28790  * See [`PaymentParameters::for_keysend`] for help in constructing `route_params` for spontaneous
28791  * payments.
28792  *
28793  * [`PaymentParameters::for_keysend`]: crate::routing::router::PaymentParameters::for_keysend
28794  */
28795 MUST_USE_RES struct LDKCResult_PaymentHashRetryableSendFailureZ ChannelManager_send_spontaneous_payment_with_retry(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKCOption_PaymentPreimageZ payment_preimage, struct LDKRecipientOnionFields recipient_onion, struct LDKThirtyTwoBytes payment_id, struct LDKRouteParameters route_params, struct LDKRetry retry_strategy);
28796
28797 /**
28798  * Send a payment that is probing the given route for liquidity. We calculate the
28799  * [`PaymentHash`] of probes based on a static secret and a random [`PaymentId`], which allows
28800  * us to easily discern them from real payments.
28801  */
28802 MUST_USE_RES struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ ChannelManager_send_probe(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKPath path);
28803
28804 /**
28805  * Call this upon creation of a funding transaction for the given channel.
28806  *
28807  * Returns an [`APIError::APIMisuseError`] if the funding_transaction spent non-SegWit outputs
28808  * or if no output was found which matches the parameters in [`Event::FundingGenerationReady`].
28809  *
28810  * Returns [`APIError::APIMisuseError`] if the funding transaction is not final for propagation
28811  * across the p2p network.
28812  *
28813  * Returns [`APIError::ChannelUnavailable`] if a funding transaction has already been provided
28814  * for the channel or if the channel has been closed as indicated by [`Event::ChannelClosed`].
28815  *
28816  * May panic if the output found in the funding transaction is duplicative with some other
28817  * channel (note that this should be trivially prevented by using unique funding transaction
28818  * keys per-channel).
28819  *
28820  * Do NOT broadcast the funding transaction yourself. When we have safely received our
28821  * counterparty's signature the funding transaction will automatically be broadcast via the
28822  * [`BroadcasterInterface`] provided when this `ChannelManager` was constructed.
28823  *
28824  * Note that this includes RBF or similar transaction replacement strategies - lightning does
28825  * not currently support replacing a funding transaction on an existing channel. Instead,
28826  * create a new channel with a conflicting funding transaction.
28827  *
28828  * Note to keep the miner incentives aligned in moving the blockchain forward, we recommend
28829  * the wallet software generating the funding transaction to apply anti-fee sniping as
28830  * implemented by Bitcoin Core wallet. See <https://bitcoinops.org/en/topics/fee-sniping/>
28831  * for more details.
28832  *
28833  * [`Event::FundingGenerationReady`]: crate::events::Event::FundingGenerationReady
28834  * [`Event::ChannelClosed`]: crate::events::Event::ChannelClosed
28835  */
28836 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);
28837
28838 /**
28839  * Atomically applies partial updates to the [`ChannelConfig`] of the given channels.
28840  *
28841  * Once the updates are applied, each eligible channel (advertised with a known short channel
28842  * ID and a change in [`forwarding_fee_proportional_millionths`], [`forwarding_fee_base_msat`],
28843  * or [`cltv_expiry_delta`]) has a [`BroadcastChannelUpdate`] event message generated
28844  * containing the new [`ChannelUpdate`] message which should be broadcast to the network.
28845  *
28846  * Returns [`ChannelUnavailable`] when a channel is not found or an incorrect
28847  * `counterparty_node_id` is provided.
28848  *
28849  * Returns [`APIMisuseError`] when a [`cltv_expiry_delta`] update is to be applied with a value
28850  * below [`MIN_CLTV_EXPIRY_DELTA`].
28851  *
28852  * If an error is returned, none of the updates should be considered applied.
28853  *
28854  * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths
28855  * [`forwarding_fee_base_msat`]: ChannelConfig::forwarding_fee_base_msat
28856  * [`cltv_expiry_delta`]: ChannelConfig::cltv_expiry_delta
28857  * [`BroadcastChannelUpdate`]: events::MessageSendEvent::BroadcastChannelUpdate
28858  * [`ChannelUpdate`]: msgs::ChannelUpdate
28859  * [`ChannelUnavailable`]: APIError::ChannelUnavailable
28860  * [`APIMisuseError`]: APIError::APIMisuseError
28861  */
28862 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_update_partial_channel_config(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKPublicKey counterparty_node_id, struct LDKCVec_ThirtyTwoBytesZ channel_ids, const struct LDKChannelConfigUpdate *NONNULL_PTR config_update);
28863
28864 /**
28865  * Atomically updates the [`ChannelConfig`] for the given channels.
28866  *
28867  * Once the updates are applied, each eligible channel (advertised with a known short channel
28868  * ID and a change in [`forwarding_fee_proportional_millionths`], [`forwarding_fee_base_msat`],
28869  * or [`cltv_expiry_delta`]) has a [`BroadcastChannelUpdate`] event message generated
28870  * containing the new [`ChannelUpdate`] message which should be broadcast to the network.
28871  *
28872  * Returns [`ChannelUnavailable`] when a channel is not found or an incorrect
28873  * `counterparty_node_id` is provided.
28874  *
28875  * Returns [`APIMisuseError`] when a [`cltv_expiry_delta`] update is to be applied with a value
28876  * below [`MIN_CLTV_EXPIRY_DELTA`].
28877  *
28878  * If an error is returned, none of the updates should be considered applied.
28879  *
28880  * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths
28881  * [`forwarding_fee_base_msat`]: ChannelConfig::forwarding_fee_base_msat
28882  * [`cltv_expiry_delta`]: ChannelConfig::cltv_expiry_delta
28883  * [`BroadcastChannelUpdate`]: events::MessageSendEvent::BroadcastChannelUpdate
28884  * [`ChannelUpdate`]: msgs::ChannelUpdate
28885  * [`ChannelUnavailable`]: APIError::ChannelUnavailable
28886  * [`APIMisuseError`]: APIError::APIMisuseError
28887  */
28888 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);
28889
28890 /**
28891  * Attempts to forward an intercepted HTLC over the provided channel id and with the provided
28892  * amount to forward. Should only be called in response to an [`HTLCIntercepted`] event.
28893  *
28894  * Intercepted HTLCs can be useful for Lightning Service Providers (LSPs) to open a just-in-time
28895  * channel to a receiving node if the node lacks sufficient inbound liquidity.
28896  *
28897  * To make use of intercepted HTLCs, set [`UserConfig::accept_intercept_htlcs`] and use
28898  * [`ChannelManager::get_intercept_scid`] to generate short channel id(s) to put in the
28899  * receiver's invoice route hints. These route hints will signal to LDK to generate an
28900  * [`HTLCIntercepted`] event when it receives the forwarded HTLC, and this method or
28901  * [`ChannelManager::fail_intercepted_htlc`] MUST be called in response to the event.
28902  *
28903  * Note that LDK does not enforce fee requirements in `amt_to_forward_msat`, and will not stop
28904  * you from forwarding more than you received. See
28905  * [`HTLCIntercepted::expected_outbound_amount_msat`] for more on forwarding a different amount
28906  * than expected.
28907  *
28908  * Errors if the event was not handled in time, in which case the HTLC was automatically failed
28909  * backwards.
28910  *
28911  * [`UserConfig::accept_intercept_htlcs`]: crate::util::config::UserConfig::accept_intercept_htlcs
28912  * [`HTLCIntercepted`]: events::Event::HTLCIntercepted
28913  * [`HTLCIntercepted::expected_outbound_amount_msat`]: events::Event::HTLCIntercepted::expected_outbound_amount_msat
28914  */
28915 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);
28916
28917 /**
28918  * Fails the intercepted HTLC indicated by intercept_id. Should only be called in response to
28919  * an [`HTLCIntercepted`] event. See [`ChannelManager::forward_intercepted_htlc`].
28920  *
28921  * Errors if the event was not handled in time, in which case the HTLC was automatically failed
28922  * backwards.
28923  *
28924  * [`HTLCIntercepted`]: events::Event::HTLCIntercepted
28925  */
28926 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_fail_intercepted_htlc(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes intercept_id);
28927
28928 /**
28929  * Processes HTLCs which are pending waiting on random forward delay.
28930  *
28931  * Should only really ever be called in response to a PendingHTLCsForwardable event.
28932  * Will likely generate further events.
28933  */
28934 void ChannelManager_process_pending_htlc_forwards(const struct LDKChannelManager *NONNULL_PTR this_arg);
28935
28936 /**
28937  * Performs actions which should happen on startup and roughly once per minute thereafter.
28938  *
28939  * This currently includes:
28940  *  * Increasing or decreasing the on-chain feerate estimates for our outbound channels,
28941  *  * Broadcasting [`ChannelUpdate`] messages if we've been disconnected from our peer for more
28942  *    than a minute, informing the network that they should no longer attempt to route over
28943  *    the channel.
28944  *  * Expiring a channel's previous [`ChannelConfig`] if necessary to only allow forwarding HTLCs
28945  *    with the current [`ChannelConfig`].
28946  *  * Removing peers which have disconnected but and no longer have any channels.
28947  *  * Force-closing and removing channels which have not completed establishment in a timely manner.
28948  *
28949  * Note that this may cause reentrancy through [`chain::Watch::update_channel`] calls or feerate
28950  * estimate fetches.
28951  *
28952  * [`ChannelUpdate`]: msgs::ChannelUpdate
28953  * [`ChannelConfig`]: crate::util::config::ChannelConfig
28954  */
28955 void ChannelManager_timer_tick_occurred(const struct LDKChannelManager *NONNULL_PTR this_arg);
28956
28957 /**
28958  * Indicates that the preimage for payment_hash is unknown or the received amount is incorrect
28959  * after a PaymentClaimable event, failing the HTLC back to its origin and freeing resources
28960  * along the path (including in our own channel on which we received it).
28961  *
28962  * Note that in some cases around unclean shutdown, it is possible the payment may have
28963  * already been claimed by you via [`ChannelManager::claim_funds`] prior to you seeing (a
28964  * second copy of) the [`events::Event::PaymentClaimable`] event. Alternatively, the payment
28965  * may have already been failed automatically by LDK if it was nearing its expiration time.
28966  *
28967  * While LDK will never claim a payment automatically on your behalf (i.e. without you calling
28968  * [`ChannelManager::claim_funds`]), you should still monitor for
28969  * [`events::Event::PaymentClaimed`] events even for payments you intend to fail, especially on
28970  * startup during which time claims that were in-progress at shutdown may be replayed.
28971  */
28972 void ChannelManager_fail_htlc_backwards(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32]);
28973
28974 /**
28975  * This is a variant of [`ChannelManager::fail_htlc_backwards`] that allows you to specify the
28976  * reason for the failure.
28977  *
28978  * See [`FailureCode`] for valid failure codes.
28979  */
28980 void ChannelManager_fail_htlc_backwards_with_reason(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32], enum LDKFailureCode failure_code);
28981
28982 /**
28983  * Provides a payment preimage in response to [`Event::PaymentClaimable`], generating any
28984  * [`MessageSendEvent`]s needed to claim the payment.
28985  *
28986  * This method is guaranteed to ensure the payment has been claimed but only if the current
28987  * height is strictly below [`Event::PaymentClaimable::claim_deadline`]. To avoid race
28988  * conditions, you should wait for an [`Event::PaymentClaimed`] before considering the payment
28989  * successful. It will generally be available in the next [`process_pending_events`] call.
28990  *
28991  * Note that if you did not set an `amount_msat` when calling [`create_inbound_payment`] or
28992  * [`create_inbound_payment_for_hash`] you must check that the amount in the `PaymentClaimable`
28993  * event matches your expectation. If you fail to do so and call this method, you may provide
28994  * the sender \"proof-of-payment\" when they did not fulfill the full expected payment.
28995  *
28996  * [`Event::PaymentClaimable`]: crate::events::Event::PaymentClaimable
28997  * [`Event::PaymentClaimable::claim_deadline`]: crate::events::Event::PaymentClaimable::claim_deadline
28998  * [`Event::PaymentClaimed`]: crate::events::Event::PaymentClaimed
28999  * [`process_pending_events`]: EventsProvider::process_pending_events
29000  * [`create_inbound_payment`]: Self::create_inbound_payment
29001  * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
29002  */
29003 void ChannelManager_claim_funds(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_preimage);
29004
29005 /**
29006  * Gets the node_id held by this ChannelManager
29007  */
29008 MUST_USE_RES struct LDKPublicKey ChannelManager_get_our_node_id(const struct LDKChannelManager *NONNULL_PTR this_arg);
29009
29010 /**
29011  * Accepts a request to open a channel after a [`Event::OpenChannelRequest`].
29012  *
29013  * The `temporary_channel_id` parameter indicates which inbound channel should be accepted,
29014  * and the `counterparty_node_id` parameter is the id of the peer which has requested to open
29015  * the channel.
29016  *
29017  * The `user_channel_id` parameter will be provided back in
29018  * [`Event::ChannelClosed::user_channel_id`] to allow tracking of which events correspond
29019  * with which `accept_inbound_channel`/`accept_inbound_channel_from_trusted_peer_0conf` call.
29020  *
29021  * Note that this method will return an error and reject the channel, if it requires support
29022  * for zero confirmations. Instead, `accept_inbound_channel_from_trusted_peer_0conf` must be
29023  * used to accept such channels.
29024  *
29025  * [`Event::OpenChannelRequest`]: events::Event::OpenChannelRequest
29026  * [`Event::ChannelClosed::user_channel_id`]: events::Event::ChannelClosed::user_channel_id
29027  */
29028 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);
29029
29030 /**
29031  * Accepts a request to open a channel after a [`events::Event::OpenChannelRequest`], treating
29032  * it as confirmed immediately.
29033  *
29034  * The `user_channel_id` parameter will be provided back in
29035  * [`Event::ChannelClosed::user_channel_id`] to allow tracking of which events correspond
29036  * with which `accept_inbound_channel`/`accept_inbound_channel_from_trusted_peer_0conf` call.
29037  *
29038  * Unlike [`ChannelManager::accept_inbound_channel`], this method accepts the incoming channel
29039  * and (if the counterparty agrees), enables forwarding of payments immediately.
29040  *
29041  * This fully trusts that the counterparty has honestly and correctly constructed the funding
29042  * transaction and blindly assumes that it will eventually confirm.
29043  *
29044  * If it does not confirm before we decide to close the channel, or if the funding transaction
29045  * does not pay to the correct script the correct amount, *you will lose funds*.
29046  *
29047  * [`Event::OpenChannelRequest`]: events::Event::OpenChannelRequest
29048  * [`Event::ChannelClosed::user_channel_id`]: events::Event::ChannelClosed::user_channel_id
29049  */
29050 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);
29051
29052 /**
29053  * Gets a payment secret and payment hash for use in an invoice given to a third party wishing
29054  * to pay us.
29055  *
29056  * This differs from [`create_inbound_payment_for_hash`] only in that it generates the
29057  * [`PaymentHash`] and [`PaymentPreimage`] for you.
29058  *
29059  * The [`PaymentPreimage`] will ultimately be returned to you in the [`PaymentClaimable`], which
29060  * will have the [`PaymentClaimable::purpose`] be [`PaymentPurpose::InvoicePayment`] with
29061  * its [`PaymentPurpose::InvoicePayment::payment_preimage`] field filled in. That should then be
29062  * passed directly to [`claim_funds`].
29063  *
29064  * See [`create_inbound_payment_for_hash`] for detailed documentation on behavior and requirements.
29065  *
29066  * Note that a malicious eavesdropper can intuit whether an inbound payment was created by
29067  * `create_inbound_payment` or `create_inbound_payment_for_hash` based on runtime.
29068  *
29069  * # Note
29070  *
29071  * If you register an inbound payment with this method, then serialize the `ChannelManager`, then
29072  * deserialize it with a node running 0.0.103 and earlier, the payment will fail to be received.
29073  *
29074  * Errors if `min_value_msat` is greater than total bitcoin supply.
29075  *
29076  * If `min_final_cltv_expiry_delta` is set to some value, then the payment will not be receivable
29077  * on versions of LDK prior to 0.0.114.
29078  *
29079  * [`claim_funds`]: Self::claim_funds
29080  * [`PaymentClaimable`]: events::Event::PaymentClaimable
29081  * [`PaymentClaimable::purpose`]: events::Event::PaymentClaimable::purpose
29082  * [`PaymentPurpose::InvoicePayment`]: events::PaymentPurpose::InvoicePayment
29083  * [`PaymentPurpose::InvoicePayment::payment_preimage`]: events::PaymentPurpose::InvoicePayment::payment_preimage
29084  * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
29085  */
29086 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);
29087
29088 /**
29089  * Gets a [`PaymentSecret`] for a given [`PaymentHash`], for which the payment preimage is
29090  * stored external to LDK.
29091  *
29092  * A [`PaymentClaimable`] event will only be generated if the [`PaymentSecret`] matches a
29093  * payment secret fetched via this method or [`create_inbound_payment`], and which is at least
29094  * the `min_value_msat` provided here, if one is provided.
29095  *
29096  * The [`PaymentHash`] (and corresponding [`PaymentPreimage`]) should be globally unique, though
29097  * note that LDK will not stop you from registering duplicate payment hashes for inbound
29098  * payments.
29099  *
29100  * `min_value_msat` should be set if the invoice being generated contains a value. Any payment
29101  * received for the returned [`PaymentHash`] will be required to be at least `min_value_msat`
29102  * before a [`PaymentClaimable`] event will be generated, ensuring that we do not provide the
29103  * sender \"proof-of-payment\" unless they have paid the required amount.
29104  *
29105  * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
29106  * in excess of the current time. This should roughly match the expiry time set in the invoice.
29107  * After this many seconds, we will remove the inbound payment, resulting in any attempts to
29108  * pay the invoice failing. The BOLT spec suggests 3,600 secs as a default validity time for
29109  * invoices when no timeout is set.
29110  *
29111  * Note that we use block header time to time-out pending inbound payments (with some margin
29112  * to compensate for the inaccuracy of block header timestamps). Thus, in practice we will
29113  * accept a payment and generate a [`PaymentClaimable`] event for some time after the expiry.
29114  * If you need exact expiry semantics, you should enforce them upon receipt of
29115  * [`PaymentClaimable`].
29116  *
29117  * Note that invoices generated for inbound payments should have their `min_final_cltv_expiry_delta`
29118  * set to at least [`MIN_FINAL_CLTV_EXPIRY_DELTA`].
29119  *
29120  * Note that a malicious eavesdropper can intuit whether an inbound payment was created by
29121  * `create_inbound_payment` or `create_inbound_payment_for_hash` based on runtime.
29122  *
29123  * # Note
29124  *
29125  * If you register an inbound payment with this method, then serialize the `ChannelManager`, then
29126  * deserialize it with a node running 0.0.103 and earlier, the payment will fail to be received.
29127  *
29128  * Errors if `min_value_msat` is greater than total bitcoin supply.
29129  *
29130  * If `min_final_cltv_expiry_delta` is set to some value, then the payment will not be receivable
29131  * on versions of LDK prior to 0.0.114.
29132  *
29133  * [`create_inbound_payment`]: Self::create_inbound_payment
29134  * [`PaymentClaimable`]: events::Event::PaymentClaimable
29135  */
29136 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);
29137
29138 /**
29139  * Gets an LDK-generated payment preimage from a payment hash and payment secret that were
29140  * previously returned from [`create_inbound_payment`].
29141  *
29142  * [`create_inbound_payment`]: Self::create_inbound_payment
29143  */
29144 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);
29145
29146 /**
29147  * Gets a fake short channel id for use in receiving [phantom node payments]. These fake scids
29148  * are used when constructing the phantom invoice's route hints.
29149  *
29150  * [phantom node payments]: crate::sign::PhantomKeysManager
29151  */
29152 MUST_USE_RES uint64_t ChannelManager_get_phantom_scid(const struct LDKChannelManager *NONNULL_PTR this_arg);
29153
29154 /**
29155  * Gets route hints for use in receiving [phantom node payments].
29156  *
29157  * [phantom node payments]: crate::sign::PhantomKeysManager
29158  */
29159 MUST_USE_RES struct LDKPhantomRouteHints ChannelManager_get_phantom_route_hints(const struct LDKChannelManager *NONNULL_PTR this_arg);
29160
29161 /**
29162  * Gets a fake short channel id for use in receiving intercepted payments. These fake scids are
29163  * used when constructing the route hints for HTLCs intended to be intercepted. See
29164  * [`ChannelManager::forward_intercepted_htlc`].
29165  *
29166  * Note that this method is not guaranteed to return unique values, you may need to call it a few
29167  * times to get a unique scid.
29168  */
29169 MUST_USE_RES uint64_t ChannelManager_get_intercept_scid(const struct LDKChannelManager *NONNULL_PTR this_arg);
29170
29171 /**
29172  * Gets inflight HTLC information by processing pending outbound payments that are in
29173  * our channels. May be used during pathfinding to account for in-use channel liquidity.
29174  */
29175 MUST_USE_RES struct LDKInFlightHtlcs ChannelManager_compute_inflight_htlcs(const struct LDKChannelManager *NONNULL_PTR this_arg);
29176
29177 /**
29178  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
29179  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
29180  */
29181 struct LDKMessageSendEventsProvider ChannelManager_as_MessageSendEventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
29182
29183 /**
29184  * Constructs a new EventsProvider which calls the relevant methods on this_arg.
29185  * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is
29186  */
29187 struct LDKEventsProvider ChannelManager_as_EventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
29188
29189 /**
29190  * Constructs a new Listen which calls the relevant methods on this_arg.
29191  * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is
29192  */
29193 struct LDKListen ChannelManager_as_Listen(const struct LDKChannelManager *NONNULL_PTR this_arg);
29194
29195 /**
29196  * Constructs a new Confirm which calls the relevant methods on this_arg.
29197  * This copies the `inner` pointer in this_arg and thus the returned Confirm must be freed before this_arg is
29198  */
29199 struct LDKConfirm ChannelManager_as_Confirm(const struct LDKChannelManager *NONNULL_PTR this_arg);
29200
29201 /**
29202  * Gets a [`Future`] that completes when this [`ChannelManager`] needs to be persisted.
29203  *
29204  * Note that callbacks registered on the [`Future`] MUST NOT call back into this
29205  * [`ChannelManager`] and should instead register actions to be taken later.
29206  *
29207  */
29208 MUST_USE_RES struct LDKFuture ChannelManager_get_persistable_update_future(const struct LDKChannelManager *NONNULL_PTR this_arg);
29209
29210 /**
29211  * Gets the latest best block which was connected either via the [`chain::Listen`] or
29212  * [`chain::Confirm`] interfaces.
29213  */
29214 MUST_USE_RES struct LDKBestBlock ChannelManager_current_best_block(const struct LDKChannelManager *NONNULL_PTR this_arg);
29215
29216 /**
29217  * Fetches the set of [`NodeFeatures`] flags which are provided by or required by
29218  * [`ChannelManager`].
29219  */
29220 MUST_USE_RES struct LDKNodeFeatures ChannelManager_node_features(const struct LDKChannelManager *NONNULL_PTR this_arg);
29221
29222 /**
29223  * Fetches the set of [`ChannelFeatures`] flags which are provided by or required by
29224  * [`ChannelManager`].
29225  */
29226 MUST_USE_RES struct LDKChannelFeatures ChannelManager_channel_features(const struct LDKChannelManager *NONNULL_PTR this_arg);
29227
29228 /**
29229  * Fetches the set of [`ChannelTypeFeatures`] flags which are provided by or required by
29230  * [`ChannelManager`].
29231  */
29232 MUST_USE_RES struct LDKChannelTypeFeatures ChannelManager_channel_type_features(const struct LDKChannelManager *NONNULL_PTR this_arg);
29233
29234 /**
29235  * Fetches the set of [`InitFeatures`] flags which are provided by or required by
29236  * [`ChannelManager`].
29237  */
29238 MUST_USE_RES struct LDKInitFeatures ChannelManager_init_features(const struct LDKChannelManager *NONNULL_PTR this_arg);
29239
29240 /**
29241  * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg.
29242  * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is
29243  */
29244 struct LDKChannelMessageHandler ChannelManager_as_ChannelMessageHandler(const struct LDKChannelManager *NONNULL_PTR this_arg);
29245
29246 /**
29247  * Fetches the set of [`InitFeatures`] flags which are provided by or required by
29248  * [`ChannelManager`].
29249  */
29250 struct LDKInitFeatures provided_init_features(const struct LDKUserConfig *NONNULL_PTR config);
29251
29252 /**
29253  * Serialize the CounterpartyForwardingInfo object into a byte array which can be read by CounterpartyForwardingInfo_read
29254  */
29255 struct LDKCVec_u8Z CounterpartyForwardingInfo_write(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR obj);
29256
29257 /**
29258  * Read a CounterpartyForwardingInfo from a byte array, created by CounterpartyForwardingInfo_write
29259  */
29260 struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CounterpartyForwardingInfo_read(struct LDKu8slice ser);
29261
29262 /**
29263  * Serialize the ChannelCounterparty object into a byte array which can be read by ChannelCounterparty_read
29264  */
29265 struct LDKCVec_u8Z ChannelCounterparty_write(const struct LDKChannelCounterparty *NONNULL_PTR obj);
29266
29267 /**
29268  * Read a ChannelCounterparty from a byte array, created by ChannelCounterparty_write
29269  */
29270 struct LDKCResult_ChannelCounterpartyDecodeErrorZ ChannelCounterparty_read(struct LDKu8slice ser);
29271
29272 /**
29273  * Serialize the ChannelDetails object into a byte array which can be read by ChannelDetails_read
29274  */
29275 struct LDKCVec_u8Z ChannelDetails_write(const struct LDKChannelDetails *NONNULL_PTR obj);
29276
29277 /**
29278  * Read a ChannelDetails from a byte array, created by ChannelDetails_write
29279  */
29280 struct LDKCResult_ChannelDetailsDecodeErrorZ ChannelDetails_read(struct LDKu8slice ser);
29281
29282 /**
29283  * Serialize the PhantomRouteHints object into a byte array which can be read by PhantomRouteHints_read
29284  */
29285 struct LDKCVec_u8Z PhantomRouteHints_write(const struct LDKPhantomRouteHints *NONNULL_PTR obj);
29286
29287 /**
29288  * Read a PhantomRouteHints from a byte array, created by PhantomRouteHints_write
29289  */
29290 struct LDKCResult_PhantomRouteHintsDecodeErrorZ PhantomRouteHints_read(struct LDKu8slice ser);
29291
29292 /**
29293  * Serialize the ChannelManager object into a byte array which can be read by ChannelManager_read
29294  */
29295 struct LDKCVec_u8Z ChannelManager_write(const struct LDKChannelManager *NONNULL_PTR obj);
29296
29297 /**
29298  * Serialize the ChannelShutdownState object into a byte array which can be read by ChannelShutdownState_read
29299  */
29300 struct LDKCVec_u8Z ChannelShutdownState_write(const enum LDKChannelShutdownState *NONNULL_PTR obj);
29301
29302 /**
29303  * Read a ChannelShutdownState from a byte array, created by ChannelShutdownState_write
29304  */
29305 struct LDKCResult_ChannelShutdownStateDecodeErrorZ ChannelShutdownState_read(struct LDKu8slice ser);
29306
29307 /**
29308  * Frees any resources used by the ChannelManagerReadArgs, if is_owned is set and inner is non-NULL.
29309  */
29310 void ChannelManagerReadArgs_free(struct LDKChannelManagerReadArgs this_obj);
29311
29312 /**
29313  * A cryptographically secure source of entropy.
29314  */
29315 const struct LDKEntropySource *ChannelManagerReadArgs_get_entropy_source(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
29316
29317 /**
29318  * A cryptographically secure source of entropy.
29319  */
29320 void ChannelManagerReadArgs_set_entropy_source(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKEntropySource val);
29321
29322 /**
29323  * A signer that is able to perform node-scoped cryptographic operations.
29324  */
29325 const struct LDKNodeSigner *ChannelManagerReadArgs_get_node_signer(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
29326
29327 /**
29328  * A signer that is able to perform node-scoped cryptographic operations.
29329  */
29330 void ChannelManagerReadArgs_set_node_signer(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKNodeSigner val);
29331
29332 /**
29333  * The keys provider which will give us relevant keys. Some keys will be loaded during
29334  * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
29335  * signing data.
29336  */
29337 const struct LDKSignerProvider *ChannelManagerReadArgs_get_signer_provider(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
29338
29339 /**
29340  * The keys provider which will give us relevant keys. Some keys will be loaded during
29341  * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
29342  * signing data.
29343  */
29344 void ChannelManagerReadArgs_set_signer_provider(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKSignerProvider val);
29345
29346 /**
29347  * The fee_estimator for use in the ChannelManager in the future.
29348  *
29349  * No calls to the FeeEstimator will be made during deserialization.
29350  */
29351 const struct LDKFeeEstimator *ChannelManagerReadArgs_get_fee_estimator(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
29352
29353 /**
29354  * The fee_estimator for use in the ChannelManager in the future.
29355  *
29356  * No calls to the FeeEstimator will be made during deserialization.
29357  */
29358 void ChannelManagerReadArgs_set_fee_estimator(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKFeeEstimator val);
29359
29360 /**
29361  * The chain::Watch for use in the ChannelManager in the future.
29362  *
29363  * No calls to the chain::Watch will be made during deserialization. It is assumed that
29364  * you have deserialized ChannelMonitors separately and will add them to your
29365  * chain::Watch after deserializing this ChannelManager.
29366  */
29367 const struct LDKWatch *ChannelManagerReadArgs_get_chain_monitor(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
29368
29369 /**
29370  * The chain::Watch for use in the ChannelManager in the future.
29371  *
29372  * No calls to the chain::Watch will be made during deserialization. It is assumed that
29373  * you have deserialized ChannelMonitors separately and will add them to your
29374  * chain::Watch after deserializing this ChannelManager.
29375  */
29376 void ChannelManagerReadArgs_set_chain_monitor(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKWatch val);
29377
29378 /**
29379  * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
29380  * used to broadcast the latest local commitment transactions of channels which must be
29381  * force-closed during deserialization.
29382  */
29383 const struct LDKBroadcasterInterface *ChannelManagerReadArgs_get_tx_broadcaster(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
29384
29385 /**
29386  * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
29387  * used to broadcast the latest local commitment transactions of channels which must be
29388  * force-closed during deserialization.
29389  */
29390 void ChannelManagerReadArgs_set_tx_broadcaster(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKBroadcasterInterface val);
29391
29392 /**
29393  * The router which will be used in the ChannelManager in the future for finding routes
29394  * on-the-fly for trampoline payments. Absent in private nodes that don't support forwarding.
29395  *
29396  * No calls to the router will be made during deserialization.
29397  */
29398 const struct LDKRouter *ChannelManagerReadArgs_get_router(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
29399
29400 /**
29401  * The router which will be used in the ChannelManager in the future for finding routes
29402  * on-the-fly for trampoline payments. Absent in private nodes that don't support forwarding.
29403  *
29404  * No calls to the router will be made during deserialization.
29405  */
29406 void ChannelManagerReadArgs_set_router(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKRouter val);
29407
29408 /**
29409  * The Logger for use in the ChannelManager and which may be used to log information during
29410  * deserialization.
29411  */
29412 const struct LDKLogger *ChannelManagerReadArgs_get_logger(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
29413
29414 /**
29415  * The Logger for use in the ChannelManager and which may be used to log information during
29416  * deserialization.
29417  */
29418 void ChannelManagerReadArgs_set_logger(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKLogger val);
29419
29420 /**
29421  * Default settings used for new channels. Any existing channels will continue to use the
29422  * runtime settings which were stored when the ChannelManager was serialized.
29423  */
29424 struct LDKUserConfig ChannelManagerReadArgs_get_default_config(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
29425
29426 /**
29427  * Default settings used for new channels. Any existing channels will continue to use the
29428  * runtime settings which were stored when the ChannelManager was serialized.
29429  */
29430 void ChannelManagerReadArgs_set_default_config(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKUserConfig val);
29431
29432 /**
29433  * Simple utility function to create a ChannelManagerReadArgs which creates the monitor
29434  * HashMap for you. This is primarily useful for C bindings where it is not practical to
29435  * populate a HashMap directly from C.
29436  */
29437 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);
29438
29439 /**
29440  * Read a C2Tuple_BlockHashChannelManagerZ from a byte array, created by C2Tuple_BlockHashChannelManagerZ_write
29441  */
29442 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ C2Tuple_BlockHashChannelManagerZ_read(struct LDKu8slice ser, struct LDKChannelManagerReadArgs arg);
29443
29444 /**
29445  * Frees any resources used by the ExpandedKey, if is_owned is set and inner is non-NULL.
29446  */
29447 void ExpandedKey_free(struct LDKExpandedKey this_obj);
29448
29449 /**
29450  * Create a  new [`ExpandedKey`] for generating an inbound payment hash and secret.
29451  *
29452  * It is recommended to cache this value and not regenerate it for each new inbound payment.
29453  */
29454 MUST_USE_RES struct LDKExpandedKey ExpandedKey_new(const uint8_t (*key_material)[32]);
29455
29456 /**
29457  * Equivalent to [`crate::ln::channelmanager::ChannelManager::create_inbound_payment`], but no
29458  * `ChannelManager` is required. Useful for generating invoices for [phantom node payments] without
29459  * a `ChannelManager`.
29460  *
29461  * `keys` is generated by calling [`NodeSigner::get_inbound_payment_key_material`] and then
29462  * calling [`ExpandedKey::new`] with its result. It is recommended to cache this value and not
29463  * regenerate it for each new inbound payment.
29464  *
29465  * `current_time` is a Unix timestamp representing the current time.
29466  *
29467  * Note that if `min_final_cltv_expiry_delta` is set to some value, then the payment will not be receivable
29468  * on versions of LDK prior to 0.0.114.
29469  *
29470  * [phantom node payments]: crate::sign::PhantomKeysManager
29471  * [`NodeSigner::get_inbound_payment_key_material`]: crate::sign::NodeSigner::get_inbound_payment_key_material
29472  */
29473 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);
29474
29475 /**
29476  * Equivalent to [`crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash`],
29477  * but no `ChannelManager` is required. Useful for generating invoices for [phantom node payments]
29478  * without a `ChannelManager`.
29479  *
29480  * See [`create`] for information on the `keys` and `current_time` parameters.
29481  *
29482  * Note that if `min_final_cltv_expiry_delta` is set to some value, then the payment will not be receivable
29483  * on versions of LDK prior to 0.0.114.
29484  *
29485  * [phantom node payments]: crate::sign::PhantomKeysManager
29486  */
29487 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);
29488
29489 /**
29490  * Frees any resources used by the DecodeError
29491  */
29492 void DecodeError_free(struct LDKDecodeError this_ptr);
29493
29494 /**
29495  * Creates a copy of the DecodeError
29496  */
29497 struct LDKDecodeError DecodeError_clone(const struct LDKDecodeError *NONNULL_PTR orig);
29498
29499 /**
29500  * Utility method to constructs a new UnknownVersion-variant DecodeError
29501  */
29502 struct LDKDecodeError DecodeError_unknown_version(void);
29503
29504 /**
29505  * Utility method to constructs a new UnknownRequiredFeature-variant DecodeError
29506  */
29507 struct LDKDecodeError DecodeError_unknown_required_feature(void);
29508
29509 /**
29510  * Utility method to constructs a new InvalidValue-variant DecodeError
29511  */
29512 struct LDKDecodeError DecodeError_invalid_value(void);
29513
29514 /**
29515  * Utility method to constructs a new ShortRead-variant DecodeError
29516  */
29517 struct LDKDecodeError DecodeError_short_read(void);
29518
29519 /**
29520  * Utility method to constructs a new BadLengthDescriptor-variant DecodeError
29521  */
29522 struct LDKDecodeError DecodeError_bad_length_descriptor(void);
29523
29524 /**
29525  * Utility method to constructs a new Io-variant DecodeError
29526  */
29527 struct LDKDecodeError DecodeError_io(enum LDKIOError a);
29528
29529 /**
29530  * Utility method to constructs a new UnsupportedCompression-variant DecodeError
29531  */
29532 struct LDKDecodeError DecodeError_unsupported_compression(void);
29533
29534 /**
29535  * Checks if two DecodeErrors contain equal inner contents.
29536  * This ignores pointers and is_owned flags and looks at the values in fields.
29537  */
29538 bool DecodeError_eq(const struct LDKDecodeError *NONNULL_PTR a, const struct LDKDecodeError *NONNULL_PTR b);
29539
29540 /**
29541  * Frees any resources used by the Init, if is_owned is set and inner is non-NULL.
29542  */
29543 void Init_free(struct LDKInit this_obj);
29544
29545 /**
29546  * The relevant features which the sender supports.
29547  */
29548 struct LDKInitFeatures Init_get_features(const struct LDKInit *NONNULL_PTR this_ptr);
29549
29550 /**
29551  * The relevant features which the sender supports.
29552  */
29553 void Init_set_features(struct LDKInit *NONNULL_PTR this_ptr, struct LDKInitFeatures val);
29554
29555 /**
29556  * Indicates chains the sender is interested in.
29557  *
29558  * If there are no common chains, the connection will be closed.
29559  *
29560  * Returns a copy of the field.
29561  */
29562 struct LDKCOption_CVec_ChainHashZZ Init_get_networks(const struct LDKInit *NONNULL_PTR this_ptr);
29563
29564 /**
29565  * Indicates chains the sender is interested in.
29566  *
29567  * If there are no common chains, the connection will be closed.
29568  */
29569 void Init_set_networks(struct LDKInit *NONNULL_PTR this_ptr, struct LDKCOption_CVec_ChainHashZZ val);
29570
29571 /**
29572  * The receipient's network address.
29573  *
29574  * This adds the option to report a remote IP address back to a connecting peer using the init
29575  * message. A node can decide to use that information to discover a potential update to its
29576  * public IPv4 address (NAT) and use that for a [`NodeAnnouncement`] update message containing
29577  * the new address.
29578  */
29579 struct LDKCOption_NetAddressZ Init_get_remote_network_address(const struct LDKInit *NONNULL_PTR this_ptr);
29580
29581 /**
29582  * The receipient's network address.
29583  *
29584  * This adds the option to report a remote IP address back to a connecting peer using the init
29585  * message. A node can decide to use that information to discover a potential update to its
29586  * public IPv4 address (NAT) and use that for a [`NodeAnnouncement`] update message containing
29587  * the new address.
29588  */
29589 void Init_set_remote_network_address(struct LDKInit *NONNULL_PTR this_ptr, struct LDKCOption_NetAddressZ val);
29590
29591 /**
29592  * Constructs a new Init given each field
29593  */
29594 MUST_USE_RES struct LDKInit Init_new(struct LDKInitFeatures features_arg, struct LDKCOption_CVec_ChainHashZZ networks_arg, struct LDKCOption_NetAddressZ remote_network_address_arg);
29595
29596 /**
29597  * Creates a copy of the Init
29598  */
29599 struct LDKInit Init_clone(const struct LDKInit *NONNULL_PTR orig);
29600
29601 /**
29602  * Checks if two Inits contain equal inner contents.
29603  * This ignores pointers and is_owned flags and looks at the values in fields.
29604  * Two objects with NULL inner values will be considered "equal" here.
29605  */
29606 bool Init_eq(const struct LDKInit *NONNULL_PTR a, const struct LDKInit *NONNULL_PTR b);
29607
29608 /**
29609  * Frees any resources used by the ErrorMessage, if is_owned is set and inner is non-NULL.
29610  */
29611 void ErrorMessage_free(struct LDKErrorMessage this_obj);
29612
29613 /**
29614  * The channel ID involved in the error.
29615  *
29616  * All-0s indicates a general error unrelated to a specific channel, after which all channels
29617  * with the sending peer should be closed.
29618  */
29619 const uint8_t (*ErrorMessage_get_channel_id(const struct LDKErrorMessage *NONNULL_PTR this_ptr))[32];
29620
29621 /**
29622  * The channel ID involved in the error.
29623  *
29624  * All-0s indicates a general error unrelated to a specific channel, after which all channels
29625  * with the sending peer should be closed.
29626  */
29627 void ErrorMessage_set_channel_id(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
29628
29629 /**
29630  * A possibly human-readable error description.
29631  *
29632  * The string should be sanitized before it is used (e.g., emitted to logs or printed to
29633  * `stdout`). Otherwise, a well crafted error message may trigger a security vulnerability in
29634  * the terminal emulator or the logging subsystem.
29635  */
29636 struct LDKStr ErrorMessage_get_data(const struct LDKErrorMessage *NONNULL_PTR this_ptr);
29637
29638 /**
29639  * A possibly human-readable error description.
29640  *
29641  * The string should be sanitized before it is used (e.g., emitted to logs or printed to
29642  * `stdout`). Otherwise, a well crafted error message may trigger a security vulnerability in
29643  * the terminal emulator or the logging subsystem.
29644  */
29645 void ErrorMessage_set_data(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKStr val);
29646
29647 /**
29648  * Constructs a new ErrorMessage given each field
29649  */
29650 MUST_USE_RES struct LDKErrorMessage ErrorMessage_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKStr data_arg);
29651
29652 /**
29653  * Creates a copy of the ErrorMessage
29654  */
29655 struct LDKErrorMessage ErrorMessage_clone(const struct LDKErrorMessage *NONNULL_PTR orig);
29656
29657 /**
29658  * Checks if two ErrorMessages contain equal inner contents.
29659  * This ignores pointers and is_owned flags and looks at the values in fields.
29660  * Two objects with NULL inner values will be considered "equal" here.
29661  */
29662 bool ErrorMessage_eq(const struct LDKErrorMessage *NONNULL_PTR a, const struct LDKErrorMessage *NONNULL_PTR b);
29663
29664 /**
29665  * Frees any resources used by the WarningMessage, if is_owned is set and inner is non-NULL.
29666  */
29667 void WarningMessage_free(struct LDKWarningMessage this_obj);
29668
29669 /**
29670  * The channel ID involved in the warning.
29671  *
29672  * All-0s indicates a warning unrelated to a specific channel.
29673  */
29674 const uint8_t (*WarningMessage_get_channel_id(const struct LDKWarningMessage *NONNULL_PTR this_ptr))[32];
29675
29676 /**
29677  * The channel ID involved in the warning.
29678  *
29679  * All-0s indicates a warning unrelated to a specific channel.
29680  */
29681 void WarningMessage_set_channel_id(struct LDKWarningMessage *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
29682
29683 /**
29684  * A possibly human-readable warning description.
29685  *
29686  * The string should be sanitized before it is used (e.g. emitted to logs or printed to
29687  * stdout). Otherwise, a well crafted error message may trigger a security vulnerability in
29688  * the terminal emulator or the logging subsystem.
29689  */
29690 struct LDKStr WarningMessage_get_data(const struct LDKWarningMessage *NONNULL_PTR this_ptr);
29691
29692 /**
29693  * A possibly human-readable warning description.
29694  *
29695  * The string should be sanitized before it is used (e.g. emitted to logs or printed to
29696  * stdout). Otherwise, a well crafted error message may trigger a security vulnerability in
29697  * the terminal emulator or the logging subsystem.
29698  */
29699 void WarningMessage_set_data(struct LDKWarningMessage *NONNULL_PTR this_ptr, struct LDKStr val);
29700
29701 /**
29702  * Constructs a new WarningMessage given each field
29703  */
29704 MUST_USE_RES struct LDKWarningMessage WarningMessage_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKStr data_arg);
29705
29706 /**
29707  * Creates a copy of the WarningMessage
29708  */
29709 struct LDKWarningMessage WarningMessage_clone(const struct LDKWarningMessage *NONNULL_PTR orig);
29710
29711 /**
29712  * Checks if two WarningMessages contain equal inner contents.
29713  * This ignores pointers and is_owned flags and looks at the values in fields.
29714  * Two objects with NULL inner values will be considered "equal" here.
29715  */
29716 bool WarningMessage_eq(const struct LDKWarningMessage *NONNULL_PTR a, const struct LDKWarningMessage *NONNULL_PTR b);
29717
29718 /**
29719  * Frees any resources used by the Ping, if is_owned is set and inner is non-NULL.
29720  */
29721 void Ping_free(struct LDKPing this_obj);
29722
29723 /**
29724  * The desired response length.
29725  */
29726 uint16_t Ping_get_ponglen(const struct LDKPing *NONNULL_PTR this_ptr);
29727
29728 /**
29729  * The desired response length.
29730  */
29731 void Ping_set_ponglen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
29732
29733 /**
29734  * The ping packet size.
29735  *
29736  * This field is not sent on the wire. byteslen zeros are sent.
29737  */
29738 uint16_t Ping_get_byteslen(const struct LDKPing *NONNULL_PTR this_ptr);
29739
29740 /**
29741  * The ping packet size.
29742  *
29743  * This field is not sent on the wire. byteslen zeros are sent.
29744  */
29745 void Ping_set_byteslen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
29746
29747 /**
29748  * Constructs a new Ping given each field
29749  */
29750 MUST_USE_RES struct LDKPing Ping_new(uint16_t ponglen_arg, uint16_t byteslen_arg);
29751
29752 /**
29753  * Creates a copy of the Ping
29754  */
29755 struct LDKPing Ping_clone(const struct LDKPing *NONNULL_PTR orig);
29756
29757 /**
29758  * Checks if two Pings contain equal inner contents.
29759  * This ignores pointers and is_owned flags and looks at the values in fields.
29760  * Two objects with NULL inner values will be considered "equal" here.
29761  */
29762 bool Ping_eq(const struct LDKPing *NONNULL_PTR a, const struct LDKPing *NONNULL_PTR b);
29763
29764 /**
29765  * Frees any resources used by the Pong, if is_owned is set and inner is non-NULL.
29766  */
29767 void Pong_free(struct LDKPong this_obj);
29768
29769 /**
29770  * The pong packet size.
29771  *
29772  * This field is not sent on the wire. byteslen zeros are sent.
29773  */
29774 uint16_t Pong_get_byteslen(const struct LDKPong *NONNULL_PTR this_ptr);
29775
29776 /**
29777  * The pong packet size.
29778  *
29779  * This field is not sent on the wire. byteslen zeros are sent.
29780  */
29781 void Pong_set_byteslen(struct LDKPong *NONNULL_PTR this_ptr, uint16_t val);
29782
29783 /**
29784  * Constructs a new Pong given each field
29785  */
29786 MUST_USE_RES struct LDKPong Pong_new(uint16_t byteslen_arg);
29787
29788 /**
29789  * Creates a copy of the Pong
29790  */
29791 struct LDKPong Pong_clone(const struct LDKPong *NONNULL_PTR orig);
29792
29793 /**
29794  * Checks if two Pongs contain equal inner contents.
29795  * This ignores pointers and is_owned flags and looks at the values in fields.
29796  * Two objects with NULL inner values will be considered "equal" here.
29797  */
29798 bool Pong_eq(const struct LDKPong *NONNULL_PTR a, const struct LDKPong *NONNULL_PTR b);
29799
29800 /**
29801  * Frees any resources used by the OpenChannel, if is_owned is set and inner is non-NULL.
29802  */
29803 void OpenChannel_free(struct LDKOpenChannel this_obj);
29804
29805 /**
29806  * The genesis hash of the blockchain where the channel is to be opened
29807  */
29808 const uint8_t (*OpenChannel_get_chain_hash(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32];
29809
29810 /**
29811  * The genesis hash of the blockchain where the channel is to be opened
29812  */
29813 void OpenChannel_set_chain_hash(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
29814
29815 /**
29816  * A temporary channel ID, until the funding outpoint is announced
29817  */
29818 const uint8_t (*OpenChannel_get_temporary_channel_id(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32];
29819
29820 /**
29821  * A temporary channel ID, until the funding outpoint is announced
29822  */
29823 void OpenChannel_set_temporary_channel_id(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
29824
29825 /**
29826  * The channel value
29827  */
29828 uint64_t OpenChannel_get_funding_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
29829
29830 /**
29831  * The channel value
29832  */
29833 void OpenChannel_set_funding_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
29834
29835 /**
29836  * The amount to push to the counterparty as part of the open, in milli-satoshi
29837  */
29838 uint64_t OpenChannel_get_push_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
29839
29840 /**
29841  * The amount to push to the counterparty as part of the open, in milli-satoshi
29842  */
29843 void OpenChannel_set_push_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
29844
29845 /**
29846  * The threshold below which outputs on transactions broadcast by sender will be omitted
29847  */
29848 uint64_t OpenChannel_get_dust_limit_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
29849
29850 /**
29851  * The threshold below which outputs on transactions broadcast by sender will be omitted
29852  */
29853 void OpenChannel_set_dust_limit_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
29854
29855 /**
29856  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
29857  */
29858 uint64_t OpenChannel_get_max_htlc_value_in_flight_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
29859
29860 /**
29861  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
29862  */
29863 void OpenChannel_set_max_htlc_value_in_flight_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
29864
29865 /**
29866  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
29867  */
29868 uint64_t OpenChannel_get_channel_reserve_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
29869
29870 /**
29871  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
29872  */
29873 void OpenChannel_set_channel_reserve_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
29874
29875 /**
29876  * The minimum HTLC size incoming to sender, in milli-satoshi
29877  */
29878 uint64_t OpenChannel_get_htlc_minimum_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
29879
29880 /**
29881  * The minimum HTLC size incoming to sender, in milli-satoshi
29882  */
29883 void OpenChannel_set_htlc_minimum_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
29884
29885 /**
29886  * The feerate per 1000-weight of sender generated transactions, until updated by
29887  * [`UpdateFee`]
29888  */
29889 uint32_t OpenChannel_get_feerate_per_kw(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
29890
29891 /**
29892  * The feerate per 1000-weight of sender generated transactions, until updated by
29893  * [`UpdateFee`]
29894  */
29895 void OpenChannel_set_feerate_per_kw(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint32_t val);
29896
29897 /**
29898  * The number of blocks which the counterparty will have to wait to claim on-chain funds if
29899  * they broadcast a commitment transaction
29900  */
29901 uint16_t OpenChannel_get_to_self_delay(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
29902
29903 /**
29904  * The number of blocks which the counterparty will have to wait to claim on-chain funds if
29905  * they broadcast a commitment transaction
29906  */
29907 void OpenChannel_set_to_self_delay(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val);
29908
29909 /**
29910  * The maximum number of inbound HTLCs towards sender
29911  */
29912 uint16_t OpenChannel_get_max_accepted_htlcs(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
29913
29914 /**
29915  * The maximum number of inbound HTLCs towards sender
29916  */
29917 void OpenChannel_set_max_accepted_htlcs(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val);
29918
29919 /**
29920  * The sender's key controlling the funding transaction
29921  */
29922 struct LDKPublicKey OpenChannel_get_funding_pubkey(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
29923
29924 /**
29925  * The sender's key controlling the funding transaction
29926  */
29927 void OpenChannel_set_funding_pubkey(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
29928
29929 /**
29930  * Used to derive a revocation key for transactions broadcast by counterparty
29931  */
29932 struct LDKPublicKey OpenChannel_get_revocation_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
29933
29934 /**
29935  * Used to derive a revocation key for transactions broadcast by counterparty
29936  */
29937 void OpenChannel_set_revocation_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
29938
29939 /**
29940  * A payment key to sender for transactions broadcast by counterparty
29941  */
29942 struct LDKPublicKey OpenChannel_get_payment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
29943
29944 /**
29945  * A payment key to sender for transactions broadcast by counterparty
29946  */
29947 void OpenChannel_set_payment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
29948
29949 /**
29950  * Used to derive a payment key to sender for transactions broadcast by sender
29951  */
29952 struct LDKPublicKey OpenChannel_get_delayed_payment_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
29953
29954 /**
29955  * Used to derive a payment key to sender for transactions broadcast by sender
29956  */
29957 void OpenChannel_set_delayed_payment_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
29958
29959 /**
29960  * Used to derive an HTLC payment key to sender
29961  */
29962 struct LDKPublicKey OpenChannel_get_htlc_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
29963
29964 /**
29965  * Used to derive an HTLC payment key to sender
29966  */
29967 void OpenChannel_set_htlc_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
29968
29969 /**
29970  * The first to-be-broadcast-by-sender transaction's per commitment point
29971  */
29972 struct LDKPublicKey OpenChannel_get_first_per_commitment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
29973
29974 /**
29975  * The first to-be-broadcast-by-sender transaction's per commitment point
29976  */
29977 void OpenChannel_set_first_per_commitment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
29978
29979 /**
29980  * The channel flags to be used
29981  */
29982 uint8_t OpenChannel_get_channel_flags(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
29983
29984 /**
29985  * The channel flags to be used
29986  */
29987 void OpenChannel_set_channel_flags(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint8_t val);
29988
29989 /**
29990  * A request to pre-set the to-sender output's `scriptPubkey` for when we collaboratively close
29991  */
29992 struct LDKCOption_ScriptZ OpenChannel_get_shutdown_scriptpubkey(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
29993
29994 /**
29995  * A request to pre-set the to-sender output's `scriptPubkey` for when we collaboratively close
29996  */
29997 void OpenChannel_set_shutdown_scriptpubkey(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKCOption_ScriptZ val);
29998
29999 /**
30000  * The channel type that this channel will represent
30001  *
30002  * If this is `None`, we derive the channel type from the intersection of our
30003  * feature bits with our counterparty's feature bits from the [`Init`] message.
30004  *
30005  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
30006  */
30007 struct LDKChannelTypeFeatures OpenChannel_get_channel_type(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
30008
30009 /**
30010  * The channel type that this channel will represent
30011  *
30012  * If this is `None`, we derive the channel type from the intersection of our
30013  * feature bits with our counterparty's feature bits from the [`Init`] message.
30014  *
30015  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
30016  */
30017 void OpenChannel_set_channel_type(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKChannelTypeFeatures val);
30018
30019 /**
30020  * Constructs a new OpenChannel given each field
30021  */
30022 MUST_USE_RES struct LDKOpenChannel OpenChannel_new(struct LDKThirtyTwoBytes chain_hash_arg, struct LDKThirtyTwoBytes temporary_channel_id_arg, uint64_t funding_satoshis_arg, uint64_t push_msat_arg, uint64_t dust_limit_satoshis_arg, uint64_t max_htlc_value_in_flight_msat_arg, uint64_t channel_reserve_satoshis_arg, uint64_t htlc_minimum_msat_arg, uint32_t feerate_per_kw_arg, uint16_t to_self_delay_arg, uint16_t max_accepted_htlcs_arg, 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, struct LDKPublicKey first_per_commitment_point_arg, uint8_t channel_flags_arg, struct LDKCOption_ScriptZ shutdown_scriptpubkey_arg, struct LDKChannelTypeFeatures channel_type_arg);
30023
30024 /**
30025  * Creates a copy of the OpenChannel
30026  */
30027 struct LDKOpenChannel OpenChannel_clone(const struct LDKOpenChannel *NONNULL_PTR orig);
30028
30029 /**
30030  * Checks if two OpenChannels contain equal inner contents.
30031  * This ignores pointers and is_owned flags and looks at the values in fields.
30032  * Two objects with NULL inner values will be considered "equal" here.
30033  */
30034 bool OpenChannel_eq(const struct LDKOpenChannel *NONNULL_PTR a, const struct LDKOpenChannel *NONNULL_PTR b);
30035
30036 /**
30037  * Frees any resources used by the OpenChannelV2, if is_owned is set and inner is non-NULL.
30038  */
30039 void OpenChannelV2_free(struct LDKOpenChannelV2 this_obj);
30040
30041 /**
30042  * The genesis hash of the blockchain where the channel is to be opened
30043  */
30044 const uint8_t (*OpenChannelV2_get_chain_hash(const struct LDKOpenChannelV2 *NONNULL_PTR this_ptr))[32];
30045
30046 /**
30047  * The genesis hash of the blockchain where the channel is to be opened
30048  */
30049 void OpenChannelV2_set_chain_hash(struct LDKOpenChannelV2 *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
30050
30051 /**
30052  * A temporary channel ID derived using a zeroed out value for the channel acceptor's revocation basepoint
30053  */
30054 const uint8_t (*OpenChannelV2_get_temporary_channel_id(const struct LDKOpenChannelV2 *NONNULL_PTR this_ptr))[32];
30055
30056 /**
30057  * A temporary channel ID derived using a zeroed out value for the channel acceptor's revocation basepoint
30058  */
30059 void OpenChannelV2_set_temporary_channel_id(struct LDKOpenChannelV2 *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
30060
30061 /**
30062  * The feerate for the funding transaction set by the channel initiator
30063  */
30064 uint32_t OpenChannelV2_get_funding_feerate_sat_per_1000_weight(const struct LDKOpenChannelV2 *NONNULL_PTR this_ptr);
30065
30066 /**
30067  * The feerate for the funding transaction set by the channel initiator
30068  */
30069 void OpenChannelV2_set_funding_feerate_sat_per_1000_weight(struct LDKOpenChannelV2 *NONNULL_PTR this_ptr, uint32_t val);
30070
30071 /**
30072  * The feerate for the commitment transaction set by the channel initiator
30073  */
30074 uint32_t OpenChannelV2_get_commitment_feerate_sat_per_1000_weight(const struct LDKOpenChannelV2 *NONNULL_PTR this_ptr);
30075
30076 /**
30077  * The feerate for the commitment transaction set by the channel initiator
30078  */
30079 void OpenChannelV2_set_commitment_feerate_sat_per_1000_weight(struct LDKOpenChannelV2 *NONNULL_PTR this_ptr, uint32_t val);
30080
30081 /**
30082  * Part of the channel value contributed by the channel initiator
30083  */
30084 uint64_t OpenChannelV2_get_funding_satoshis(const struct LDKOpenChannelV2 *NONNULL_PTR this_ptr);
30085
30086 /**
30087  * Part of the channel value contributed by the channel initiator
30088  */
30089 void OpenChannelV2_set_funding_satoshis(struct LDKOpenChannelV2 *NONNULL_PTR this_ptr, uint64_t val);
30090
30091 /**
30092  * The threshold below which outputs on transactions broadcast by the channel initiator will be
30093  * omitted
30094  */
30095 uint64_t OpenChannelV2_get_dust_limit_satoshis(const struct LDKOpenChannelV2 *NONNULL_PTR this_ptr);
30096
30097 /**
30098  * The threshold below which outputs on transactions broadcast by the channel initiator will be
30099  * omitted
30100  */
30101 void OpenChannelV2_set_dust_limit_satoshis(struct LDKOpenChannelV2 *NONNULL_PTR this_ptr, uint64_t val);
30102
30103 /**
30104  * The maximum inbound HTLC value in flight towards channel initiator, in milli-satoshi
30105  */
30106 uint64_t OpenChannelV2_get_max_htlc_value_in_flight_msat(const struct LDKOpenChannelV2 *NONNULL_PTR this_ptr);
30107
30108 /**
30109  * The maximum inbound HTLC value in flight towards channel initiator, in milli-satoshi
30110  */
30111 void OpenChannelV2_set_max_htlc_value_in_flight_msat(struct LDKOpenChannelV2 *NONNULL_PTR this_ptr, uint64_t val);
30112
30113 /**
30114  * The minimum HTLC size incoming to channel initiator, in milli-satoshi
30115  */
30116 uint64_t OpenChannelV2_get_htlc_minimum_msat(const struct LDKOpenChannelV2 *NONNULL_PTR this_ptr);
30117
30118 /**
30119  * The minimum HTLC size incoming to channel initiator, in milli-satoshi
30120  */
30121 void OpenChannelV2_set_htlc_minimum_msat(struct LDKOpenChannelV2 *NONNULL_PTR this_ptr, uint64_t val);
30122
30123 /**
30124  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they
30125  * broadcast a commitment transaction
30126  */
30127 uint16_t OpenChannelV2_get_to_self_delay(const struct LDKOpenChannelV2 *NONNULL_PTR this_ptr);
30128
30129 /**
30130  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they
30131  * broadcast a commitment transaction
30132  */
30133 void OpenChannelV2_set_to_self_delay(struct LDKOpenChannelV2 *NONNULL_PTR this_ptr, uint16_t val);
30134
30135 /**
30136  * The maximum number of inbound HTLCs towards channel initiator
30137  */
30138 uint16_t OpenChannelV2_get_max_accepted_htlcs(const struct LDKOpenChannelV2 *NONNULL_PTR this_ptr);
30139
30140 /**
30141  * The maximum number of inbound HTLCs towards channel initiator
30142  */
30143 void OpenChannelV2_set_max_accepted_htlcs(struct LDKOpenChannelV2 *NONNULL_PTR this_ptr, uint16_t val);
30144
30145 /**
30146  * The locktime for the funding transaction
30147  */
30148 uint32_t OpenChannelV2_get_locktime(const struct LDKOpenChannelV2 *NONNULL_PTR this_ptr);
30149
30150 /**
30151  * The locktime for the funding transaction
30152  */
30153 void OpenChannelV2_set_locktime(struct LDKOpenChannelV2 *NONNULL_PTR this_ptr, uint32_t val);
30154
30155 /**
30156  * The channel initiator's key controlling the funding transaction
30157  */
30158 struct LDKPublicKey OpenChannelV2_get_funding_pubkey(const struct LDKOpenChannelV2 *NONNULL_PTR this_ptr);
30159
30160 /**
30161  * The channel initiator's key controlling the funding transaction
30162  */
30163 void OpenChannelV2_set_funding_pubkey(struct LDKOpenChannelV2 *NONNULL_PTR this_ptr, struct LDKPublicKey val);
30164
30165 /**
30166  * Used to derive a revocation key for transactions broadcast by counterparty
30167  */
30168 struct LDKPublicKey OpenChannelV2_get_revocation_basepoint(const struct LDKOpenChannelV2 *NONNULL_PTR this_ptr);
30169
30170 /**
30171  * Used to derive a revocation key for transactions broadcast by counterparty
30172  */
30173 void OpenChannelV2_set_revocation_basepoint(struct LDKOpenChannelV2 *NONNULL_PTR this_ptr, struct LDKPublicKey val);
30174
30175 /**
30176  * A payment key to channel initiator for transactions broadcast by counterparty
30177  */
30178 struct LDKPublicKey OpenChannelV2_get_payment_basepoint(const struct LDKOpenChannelV2 *NONNULL_PTR this_ptr);
30179
30180 /**
30181  * A payment key to channel initiator for transactions broadcast by counterparty
30182  */
30183 void OpenChannelV2_set_payment_basepoint(struct LDKOpenChannelV2 *NONNULL_PTR this_ptr, struct LDKPublicKey val);
30184
30185 /**
30186  * Used to derive a payment key to channel initiator for transactions broadcast by channel
30187  * initiator
30188  */
30189 struct LDKPublicKey OpenChannelV2_get_delayed_payment_basepoint(const struct LDKOpenChannelV2 *NONNULL_PTR this_ptr);
30190
30191 /**
30192  * Used to derive a payment key to channel initiator for transactions broadcast by channel
30193  * initiator
30194  */
30195 void OpenChannelV2_set_delayed_payment_basepoint(struct LDKOpenChannelV2 *NONNULL_PTR this_ptr, struct LDKPublicKey val);
30196
30197 /**
30198  * Used to derive an HTLC payment key to channel initiator
30199  */
30200 struct LDKPublicKey OpenChannelV2_get_htlc_basepoint(const struct LDKOpenChannelV2 *NONNULL_PTR this_ptr);
30201
30202 /**
30203  * Used to derive an HTLC payment key to channel initiator
30204  */
30205 void OpenChannelV2_set_htlc_basepoint(struct LDKOpenChannelV2 *NONNULL_PTR this_ptr, struct LDKPublicKey val);
30206
30207 /**
30208  * The first to-be-broadcast-by-channel-initiator transaction's per commitment point
30209  */
30210 struct LDKPublicKey OpenChannelV2_get_first_per_commitment_point(const struct LDKOpenChannelV2 *NONNULL_PTR this_ptr);
30211
30212 /**
30213  * The first to-be-broadcast-by-channel-initiator transaction's per commitment point
30214  */
30215 void OpenChannelV2_set_first_per_commitment_point(struct LDKOpenChannelV2 *NONNULL_PTR this_ptr, struct LDKPublicKey val);
30216
30217 /**
30218  * The second to-be-broadcast-by-channel-initiator transaction's per commitment point
30219  */
30220 struct LDKPublicKey OpenChannelV2_get_second_per_commitment_point(const struct LDKOpenChannelV2 *NONNULL_PTR this_ptr);
30221
30222 /**
30223  * The second to-be-broadcast-by-channel-initiator transaction's per commitment point
30224  */
30225 void OpenChannelV2_set_second_per_commitment_point(struct LDKOpenChannelV2 *NONNULL_PTR this_ptr, struct LDKPublicKey val);
30226
30227 /**
30228  * Channel flags
30229  */
30230 uint8_t OpenChannelV2_get_channel_flags(const struct LDKOpenChannelV2 *NONNULL_PTR this_ptr);
30231
30232 /**
30233  * Channel flags
30234  */
30235 void OpenChannelV2_set_channel_flags(struct LDKOpenChannelV2 *NONNULL_PTR this_ptr, uint8_t val);
30236
30237 /**
30238  * Optionally, a request to pre-set the to-channel-initiator output's scriptPubkey for when we
30239  * collaboratively close
30240  */
30241 struct LDKCOption_ScriptZ OpenChannelV2_get_shutdown_scriptpubkey(const struct LDKOpenChannelV2 *NONNULL_PTR this_ptr);
30242
30243 /**
30244  * Optionally, a request to pre-set the to-channel-initiator output's scriptPubkey for when we
30245  * collaboratively close
30246  */
30247 void OpenChannelV2_set_shutdown_scriptpubkey(struct LDKOpenChannelV2 *NONNULL_PTR this_ptr, struct LDKCOption_ScriptZ val);
30248
30249 /**
30250  * The channel type that this channel will represent. If none is set, we derive the channel
30251  * type from the intersection of our feature bits with our counterparty's feature bits from
30252  * the Init message.
30253  *
30254  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
30255  */
30256 struct LDKChannelTypeFeatures OpenChannelV2_get_channel_type(const struct LDKOpenChannelV2 *NONNULL_PTR this_ptr);
30257
30258 /**
30259  * The channel type that this channel will represent. If none is set, we derive the channel
30260  * type from the intersection of our feature bits with our counterparty's feature bits from
30261  * the Init message.
30262  *
30263  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
30264  */
30265 void OpenChannelV2_set_channel_type(struct LDKOpenChannelV2 *NONNULL_PTR this_ptr, struct LDKChannelTypeFeatures val);
30266
30267 /**
30268  * Optionally, a requirement that only confirmed inputs can be added
30269  */
30270 enum LDKCOption_NoneZ OpenChannelV2_get_require_confirmed_inputs(const struct LDKOpenChannelV2 *NONNULL_PTR this_ptr);
30271
30272 /**
30273  * Optionally, a requirement that only confirmed inputs can be added
30274  */
30275 void OpenChannelV2_set_require_confirmed_inputs(struct LDKOpenChannelV2 *NONNULL_PTR this_ptr, enum LDKCOption_NoneZ val);
30276
30277 /**
30278  * Constructs a new OpenChannelV2 given each field
30279  */
30280 MUST_USE_RES struct LDKOpenChannelV2 OpenChannelV2_new(struct LDKThirtyTwoBytes chain_hash_arg, struct LDKThirtyTwoBytes temporary_channel_id_arg, uint32_t funding_feerate_sat_per_1000_weight_arg, uint32_t commitment_feerate_sat_per_1000_weight_arg, uint64_t funding_satoshis_arg, uint64_t dust_limit_satoshis_arg, uint64_t max_htlc_value_in_flight_msat_arg, uint64_t htlc_minimum_msat_arg, uint16_t to_self_delay_arg, uint16_t max_accepted_htlcs_arg, uint32_t locktime_arg, struct LDKPublicKey funding_pubkey_arg, struct LDKPublicKey revocation_basepoint_arg, struct LDKPublicKey payment_basepoint_arg, struct LDKPublicKey delayed_payment_basepoint_arg, struct LDKPublicKey htlc_basepoint_arg, struct LDKPublicKey first_per_commitment_point_arg, struct LDKPublicKey second_per_commitment_point_arg, uint8_t channel_flags_arg, struct LDKCOption_ScriptZ shutdown_scriptpubkey_arg, struct LDKChannelTypeFeatures channel_type_arg, enum LDKCOption_NoneZ require_confirmed_inputs_arg);
30281
30282 /**
30283  * Creates a copy of the OpenChannelV2
30284  */
30285 struct LDKOpenChannelV2 OpenChannelV2_clone(const struct LDKOpenChannelV2 *NONNULL_PTR orig);
30286
30287 /**
30288  * Checks if two OpenChannelV2s contain equal inner contents.
30289  * This ignores pointers and is_owned flags and looks at the values in fields.
30290  * Two objects with NULL inner values will be considered "equal" here.
30291  */
30292 bool OpenChannelV2_eq(const struct LDKOpenChannelV2 *NONNULL_PTR a, const struct LDKOpenChannelV2 *NONNULL_PTR b);
30293
30294 /**
30295  * Frees any resources used by the AcceptChannel, if is_owned is set and inner is non-NULL.
30296  */
30297 void AcceptChannel_free(struct LDKAcceptChannel this_obj);
30298
30299 /**
30300  * A temporary channel ID, until the funding outpoint is announced
30301  */
30302 const uint8_t (*AcceptChannel_get_temporary_channel_id(const struct LDKAcceptChannel *NONNULL_PTR this_ptr))[32];
30303
30304 /**
30305  * A temporary channel ID, until the funding outpoint is announced
30306  */
30307 void AcceptChannel_set_temporary_channel_id(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
30308
30309 /**
30310  * The threshold below which outputs on transactions broadcast by sender will be omitted
30311  */
30312 uint64_t AcceptChannel_get_dust_limit_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
30313
30314 /**
30315  * The threshold below which outputs on transactions broadcast by sender will be omitted
30316  */
30317 void AcceptChannel_set_dust_limit_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
30318
30319 /**
30320  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
30321  */
30322 uint64_t AcceptChannel_get_max_htlc_value_in_flight_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
30323
30324 /**
30325  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
30326  */
30327 void AcceptChannel_set_max_htlc_value_in_flight_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
30328
30329 /**
30330  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
30331  */
30332 uint64_t AcceptChannel_get_channel_reserve_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
30333
30334 /**
30335  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
30336  */
30337 void AcceptChannel_set_channel_reserve_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
30338
30339 /**
30340  * The minimum HTLC size incoming to sender, in milli-satoshi
30341  */
30342 uint64_t AcceptChannel_get_htlc_minimum_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
30343
30344 /**
30345  * The minimum HTLC size incoming to sender, in milli-satoshi
30346  */
30347 void AcceptChannel_set_htlc_minimum_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
30348
30349 /**
30350  * Minimum depth of the funding transaction before the channel is considered open
30351  */
30352 uint32_t AcceptChannel_get_minimum_depth(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
30353
30354 /**
30355  * Minimum depth of the funding transaction before the channel is considered open
30356  */
30357 void AcceptChannel_set_minimum_depth(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint32_t val);
30358
30359 /**
30360  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
30361  */
30362 uint16_t AcceptChannel_get_to_self_delay(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
30363
30364 /**
30365  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
30366  */
30367 void AcceptChannel_set_to_self_delay(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val);
30368
30369 /**
30370  * The maximum number of inbound HTLCs towards sender
30371  */
30372 uint16_t AcceptChannel_get_max_accepted_htlcs(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
30373
30374 /**
30375  * The maximum number of inbound HTLCs towards sender
30376  */
30377 void AcceptChannel_set_max_accepted_htlcs(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val);
30378
30379 /**
30380  * The sender's key controlling the funding transaction
30381  */
30382 struct LDKPublicKey AcceptChannel_get_funding_pubkey(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
30383
30384 /**
30385  * The sender's key controlling the funding transaction
30386  */
30387 void AcceptChannel_set_funding_pubkey(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
30388
30389 /**
30390  * Used to derive a revocation key for transactions broadcast by counterparty
30391  */
30392 struct LDKPublicKey AcceptChannel_get_revocation_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
30393
30394 /**
30395  * Used to derive a revocation key for transactions broadcast by counterparty
30396  */
30397 void AcceptChannel_set_revocation_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
30398
30399 /**
30400  * A payment key to sender for transactions broadcast by counterparty
30401  */
30402 struct LDKPublicKey AcceptChannel_get_payment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
30403
30404 /**
30405  * A payment key to sender for transactions broadcast by counterparty
30406  */
30407 void AcceptChannel_set_payment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
30408
30409 /**
30410  * Used to derive a payment key to sender for transactions broadcast by sender
30411  */
30412 struct LDKPublicKey AcceptChannel_get_delayed_payment_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
30413
30414 /**
30415  * Used to derive a payment key to sender for transactions broadcast by sender
30416  */
30417 void AcceptChannel_set_delayed_payment_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
30418
30419 /**
30420  * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
30421  */
30422 struct LDKPublicKey AcceptChannel_get_htlc_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
30423
30424 /**
30425  * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
30426  */
30427 void AcceptChannel_set_htlc_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
30428
30429 /**
30430  * The first to-be-broadcast-by-sender transaction's per commitment point
30431  */
30432 struct LDKPublicKey AcceptChannel_get_first_per_commitment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
30433
30434 /**
30435  * The first to-be-broadcast-by-sender transaction's per commitment point
30436  */
30437 void AcceptChannel_set_first_per_commitment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
30438
30439 /**
30440  * A request to pre-set the to-sender output's scriptPubkey for when we collaboratively close
30441  */
30442 struct LDKCOption_ScriptZ AcceptChannel_get_shutdown_scriptpubkey(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
30443
30444 /**
30445  * A request to pre-set the to-sender output's scriptPubkey for when we collaboratively close
30446  */
30447 void AcceptChannel_set_shutdown_scriptpubkey(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKCOption_ScriptZ val);
30448
30449 /**
30450  * The channel type that this channel will represent.
30451  *
30452  * If this is `None`, we derive the channel type from the intersection of
30453  * our feature bits with our counterparty's feature bits from the [`Init`] message.
30454  * This is required to match the equivalent field in [`OpenChannel::channel_type`].
30455  *
30456  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
30457  */
30458 struct LDKChannelTypeFeatures AcceptChannel_get_channel_type(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
30459
30460 /**
30461  * The channel type that this channel will represent.
30462  *
30463  * If this is `None`, we derive the channel type from the intersection of
30464  * our feature bits with our counterparty's feature bits from the [`Init`] message.
30465  * This is required to match the equivalent field in [`OpenChannel::channel_type`].
30466  *
30467  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
30468  */
30469 void AcceptChannel_set_channel_type(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKChannelTypeFeatures val);
30470
30471 /**
30472  * Constructs a new AcceptChannel given each field
30473  */
30474 MUST_USE_RES struct LDKAcceptChannel AcceptChannel_new(struct LDKThirtyTwoBytes temporary_channel_id_arg, uint64_t dust_limit_satoshis_arg, uint64_t max_htlc_value_in_flight_msat_arg, uint64_t channel_reserve_satoshis_arg, uint64_t htlc_minimum_msat_arg, uint32_t minimum_depth_arg, uint16_t to_self_delay_arg, uint16_t max_accepted_htlcs_arg, 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, struct LDKPublicKey first_per_commitment_point_arg, struct LDKCOption_ScriptZ shutdown_scriptpubkey_arg, struct LDKChannelTypeFeatures channel_type_arg);
30475
30476 /**
30477  * Creates a copy of the AcceptChannel
30478  */
30479 struct LDKAcceptChannel AcceptChannel_clone(const struct LDKAcceptChannel *NONNULL_PTR orig);
30480
30481 /**
30482  * Checks if two AcceptChannels contain equal inner contents.
30483  * This ignores pointers and is_owned flags and looks at the values in fields.
30484  * Two objects with NULL inner values will be considered "equal" here.
30485  */
30486 bool AcceptChannel_eq(const struct LDKAcceptChannel *NONNULL_PTR a, const struct LDKAcceptChannel *NONNULL_PTR b);
30487
30488 /**
30489  * Frees any resources used by the AcceptChannelV2, if is_owned is set and inner is non-NULL.
30490  */
30491 void AcceptChannelV2_free(struct LDKAcceptChannelV2 this_obj);
30492
30493 /**
30494  * The same `temporary_channel_id` received from the initiator's `open_channel2` message.
30495  */
30496 const uint8_t (*AcceptChannelV2_get_temporary_channel_id(const struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr))[32];
30497
30498 /**
30499  * The same `temporary_channel_id` received from the initiator's `open_channel2` message.
30500  */
30501 void AcceptChannelV2_set_temporary_channel_id(struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
30502
30503 /**
30504  * Part of the channel value contributed by the channel acceptor
30505  */
30506 uint64_t AcceptChannelV2_get_funding_satoshis(const struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr);
30507
30508 /**
30509  * Part of the channel value contributed by the channel acceptor
30510  */
30511 void AcceptChannelV2_set_funding_satoshis(struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr, uint64_t val);
30512
30513 /**
30514  * The threshold below which outputs on transactions broadcast by the channel acceptor will be
30515  * omitted
30516  */
30517 uint64_t AcceptChannelV2_get_dust_limit_satoshis(const struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr);
30518
30519 /**
30520  * The threshold below which outputs on transactions broadcast by the channel acceptor will be
30521  * omitted
30522  */
30523 void AcceptChannelV2_set_dust_limit_satoshis(struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr, uint64_t val);
30524
30525 /**
30526  * The maximum inbound HTLC value in flight towards channel acceptor, in milli-satoshi
30527  */
30528 uint64_t AcceptChannelV2_get_max_htlc_value_in_flight_msat(const struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr);
30529
30530 /**
30531  * The maximum inbound HTLC value in flight towards channel acceptor, in milli-satoshi
30532  */
30533 void AcceptChannelV2_set_max_htlc_value_in_flight_msat(struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr, uint64_t val);
30534
30535 /**
30536  * The minimum HTLC size incoming to channel acceptor, in milli-satoshi
30537  */
30538 uint64_t AcceptChannelV2_get_htlc_minimum_msat(const struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr);
30539
30540 /**
30541  * The minimum HTLC size incoming to channel acceptor, in milli-satoshi
30542  */
30543 void AcceptChannelV2_set_htlc_minimum_msat(struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr, uint64_t val);
30544
30545 /**
30546  * Minimum depth of the funding transaction before the channel is considered open
30547  */
30548 uint32_t AcceptChannelV2_get_minimum_depth(const struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr);
30549
30550 /**
30551  * Minimum depth of the funding transaction before the channel is considered open
30552  */
30553 void AcceptChannelV2_set_minimum_depth(struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr, uint32_t val);
30554
30555 /**
30556  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they
30557  * broadcast a commitment transaction
30558  */
30559 uint16_t AcceptChannelV2_get_to_self_delay(const struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr);
30560
30561 /**
30562  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they
30563  * broadcast a commitment transaction
30564  */
30565 void AcceptChannelV2_set_to_self_delay(struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr, uint16_t val);
30566
30567 /**
30568  * The maximum number of inbound HTLCs towards channel acceptor
30569  */
30570 uint16_t AcceptChannelV2_get_max_accepted_htlcs(const struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr);
30571
30572 /**
30573  * The maximum number of inbound HTLCs towards channel acceptor
30574  */
30575 void AcceptChannelV2_set_max_accepted_htlcs(struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr, uint16_t val);
30576
30577 /**
30578  * The channel acceptor's key controlling the funding transaction
30579  */
30580 struct LDKPublicKey AcceptChannelV2_get_funding_pubkey(const struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr);
30581
30582 /**
30583  * The channel acceptor's key controlling the funding transaction
30584  */
30585 void AcceptChannelV2_set_funding_pubkey(struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr, struct LDKPublicKey val);
30586
30587 /**
30588  * Used to derive a revocation key for transactions broadcast by counterparty
30589  */
30590 struct LDKPublicKey AcceptChannelV2_get_revocation_basepoint(const struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr);
30591
30592 /**
30593  * Used to derive a revocation key for transactions broadcast by counterparty
30594  */
30595 void AcceptChannelV2_set_revocation_basepoint(struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr, struct LDKPublicKey val);
30596
30597 /**
30598  * A payment key to channel acceptor for transactions broadcast by counterparty
30599  */
30600 struct LDKPublicKey AcceptChannelV2_get_payment_basepoint(const struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr);
30601
30602 /**
30603  * A payment key to channel acceptor for transactions broadcast by counterparty
30604  */
30605 void AcceptChannelV2_set_payment_basepoint(struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr, struct LDKPublicKey val);
30606
30607 /**
30608  * Used to derive a payment key to channel acceptor for transactions broadcast by channel
30609  * acceptor
30610  */
30611 struct LDKPublicKey AcceptChannelV2_get_delayed_payment_basepoint(const struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr);
30612
30613 /**
30614  * Used to derive a payment key to channel acceptor for transactions broadcast by channel
30615  * acceptor
30616  */
30617 void AcceptChannelV2_set_delayed_payment_basepoint(struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr, struct LDKPublicKey val);
30618
30619 /**
30620  * Used to derive an HTLC payment key to channel acceptor for transactions broadcast by counterparty
30621  */
30622 struct LDKPublicKey AcceptChannelV2_get_htlc_basepoint(const struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr);
30623
30624 /**
30625  * Used to derive an HTLC payment key to channel acceptor for transactions broadcast by counterparty
30626  */
30627 void AcceptChannelV2_set_htlc_basepoint(struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr, struct LDKPublicKey val);
30628
30629 /**
30630  * The first to-be-broadcast-by-channel-acceptor transaction's per commitment point
30631  */
30632 struct LDKPublicKey AcceptChannelV2_get_first_per_commitment_point(const struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr);
30633
30634 /**
30635  * The first to-be-broadcast-by-channel-acceptor transaction's per commitment point
30636  */
30637 void AcceptChannelV2_set_first_per_commitment_point(struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr, struct LDKPublicKey val);
30638
30639 /**
30640  * The second to-be-broadcast-by-channel-acceptor transaction's per commitment point
30641  */
30642 struct LDKPublicKey AcceptChannelV2_get_second_per_commitment_point(const struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr);
30643
30644 /**
30645  * The second to-be-broadcast-by-channel-acceptor transaction's per commitment point
30646  */
30647 void AcceptChannelV2_set_second_per_commitment_point(struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr, struct LDKPublicKey val);
30648
30649 /**
30650  * Optionally, a request to pre-set the to-channel-acceptor output's scriptPubkey for when we
30651  * collaboratively close
30652  */
30653 struct LDKCOption_ScriptZ AcceptChannelV2_get_shutdown_scriptpubkey(const struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr);
30654
30655 /**
30656  * Optionally, a request to pre-set the to-channel-acceptor output's scriptPubkey for when we
30657  * collaboratively close
30658  */
30659 void AcceptChannelV2_set_shutdown_scriptpubkey(struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr, struct LDKCOption_ScriptZ val);
30660
30661 /**
30662  * The channel type that this channel will represent. If none is set, we derive the channel
30663  * type from the intersection of our feature bits with our counterparty's feature bits from
30664  * the Init message.
30665  *
30666  * This is required to match the equivalent field in [`OpenChannelV2::channel_type`].
30667  *
30668  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
30669  */
30670 struct LDKChannelTypeFeatures AcceptChannelV2_get_channel_type(const struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr);
30671
30672 /**
30673  * The channel type that this channel will represent. If none is set, we derive the channel
30674  * type from the intersection of our feature bits with our counterparty's feature bits from
30675  * the Init message.
30676  *
30677  * This is required to match the equivalent field in [`OpenChannelV2::channel_type`].
30678  *
30679  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
30680  */
30681 void AcceptChannelV2_set_channel_type(struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr, struct LDKChannelTypeFeatures val);
30682
30683 /**
30684  * Optionally, a requirement that only confirmed inputs can be added
30685  */
30686 enum LDKCOption_NoneZ AcceptChannelV2_get_require_confirmed_inputs(const struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr);
30687
30688 /**
30689  * Optionally, a requirement that only confirmed inputs can be added
30690  */
30691 void AcceptChannelV2_set_require_confirmed_inputs(struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr, enum LDKCOption_NoneZ val);
30692
30693 /**
30694  * Constructs a new AcceptChannelV2 given each field
30695  */
30696 MUST_USE_RES struct LDKAcceptChannelV2 AcceptChannelV2_new(struct LDKThirtyTwoBytes temporary_channel_id_arg, uint64_t funding_satoshis_arg, uint64_t dust_limit_satoshis_arg, uint64_t max_htlc_value_in_flight_msat_arg, uint64_t htlc_minimum_msat_arg, uint32_t minimum_depth_arg, uint16_t to_self_delay_arg, uint16_t max_accepted_htlcs_arg, struct LDKPublicKey funding_pubkey_arg, struct LDKPublicKey revocation_basepoint_arg, struct LDKPublicKey payment_basepoint_arg, struct LDKPublicKey delayed_payment_basepoint_arg, struct LDKPublicKey htlc_basepoint_arg, struct LDKPublicKey first_per_commitment_point_arg, struct LDKPublicKey second_per_commitment_point_arg, struct LDKCOption_ScriptZ shutdown_scriptpubkey_arg, struct LDKChannelTypeFeatures channel_type_arg, enum LDKCOption_NoneZ require_confirmed_inputs_arg);
30697
30698 /**
30699  * Creates a copy of the AcceptChannelV2
30700  */
30701 struct LDKAcceptChannelV2 AcceptChannelV2_clone(const struct LDKAcceptChannelV2 *NONNULL_PTR orig);
30702
30703 /**
30704  * Checks if two AcceptChannelV2s contain equal inner contents.
30705  * This ignores pointers and is_owned flags and looks at the values in fields.
30706  * Two objects with NULL inner values will be considered "equal" here.
30707  */
30708 bool AcceptChannelV2_eq(const struct LDKAcceptChannelV2 *NONNULL_PTR a, const struct LDKAcceptChannelV2 *NONNULL_PTR b);
30709
30710 /**
30711  * Frees any resources used by the FundingCreated, if is_owned is set and inner is non-NULL.
30712  */
30713 void FundingCreated_free(struct LDKFundingCreated this_obj);
30714
30715 /**
30716  * A temporary channel ID, until the funding is established
30717  */
30718 const uint8_t (*FundingCreated_get_temporary_channel_id(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32];
30719
30720 /**
30721  * A temporary channel ID, until the funding is established
30722  */
30723 void FundingCreated_set_temporary_channel_id(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
30724
30725 /**
30726  * The funding transaction ID
30727  */
30728 const uint8_t (*FundingCreated_get_funding_txid(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32];
30729
30730 /**
30731  * The funding transaction ID
30732  */
30733 void FundingCreated_set_funding_txid(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
30734
30735 /**
30736  * The specific output index funding this channel
30737  */
30738 uint16_t FundingCreated_get_funding_output_index(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
30739
30740 /**
30741  * The specific output index funding this channel
30742  */
30743 void FundingCreated_set_funding_output_index(struct LDKFundingCreated *NONNULL_PTR this_ptr, uint16_t val);
30744
30745 /**
30746  * The signature of the channel initiator (funder) on the initial commitment transaction
30747  */
30748 struct LDKSignature FundingCreated_get_signature(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
30749
30750 /**
30751  * The signature of the channel initiator (funder) on the initial commitment transaction
30752  */
30753 void FundingCreated_set_signature(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKSignature val);
30754
30755 /**
30756  * Constructs a new FundingCreated given each field
30757  */
30758 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);
30759
30760 /**
30761  * Creates a copy of the FundingCreated
30762  */
30763 struct LDKFundingCreated FundingCreated_clone(const struct LDKFundingCreated *NONNULL_PTR orig);
30764
30765 /**
30766  * Checks if two FundingCreateds contain equal inner contents.
30767  * This ignores pointers and is_owned flags and looks at the values in fields.
30768  * Two objects with NULL inner values will be considered "equal" here.
30769  */
30770 bool FundingCreated_eq(const struct LDKFundingCreated *NONNULL_PTR a, const struct LDKFundingCreated *NONNULL_PTR b);
30771
30772 /**
30773  * Frees any resources used by the FundingSigned, if is_owned is set and inner is non-NULL.
30774  */
30775 void FundingSigned_free(struct LDKFundingSigned this_obj);
30776
30777 /**
30778  * The channel ID
30779  */
30780 const uint8_t (*FundingSigned_get_channel_id(const struct LDKFundingSigned *NONNULL_PTR this_ptr))[32];
30781
30782 /**
30783  * The channel ID
30784  */
30785 void FundingSigned_set_channel_id(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
30786
30787 /**
30788  * The signature of the channel acceptor (fundee) on the initial commitment transaction
30789  */
30790 struct LDKSignature FundingSigned_get_signature(const struct LDKFundingSigned *NONNULL_PTR this_ptr);
30791
30792 /**
30793  * The signature of the channel acceptor (fundee) on the initial commitment transaction
30794  */
30795 void FundingSigned_set_signature(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
30796
30797 /**
30798  * Constructs a new FundingSigned given each field
30799  */
30800 MUST_USE_RES struct LDKFundingSigned FundingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg);
30801
30802 /**
30803  * Creates a copy of the FundingSigned
30804  */
30805 struct LDKFundingSigned FundingSigned_clone(const struct LDKFundingSigned *NONNULL_PTR orig);
30806
30807 /**
30808  * Checks if two FundingSigneds contain equal inner contents.
30809  * This ignores pointers and is_owned flags and looks at the values in fields.
30810  * Two objects with NULL inner values will be considered "equal" here.
30811  */
30812 bool FundingSigned_eq(const struct LDKFundingSigned *NONNULL_PTR a, const struct LDKFundingSigned *NONNULL_PTR b);
30813
30814 /**
30815  * Frees any resources used by the ChannelReady, if is_owned is set and inner is non-NULL.
30816  */
30817 void ChannelReady_free(struct LDKChannelReady this_obj);
30818
30819 /**
30820  * The channel ID
30821  */
30822 const uint8_t (*ChannelReady_get_channel_id(const struct LDKChannelReady *NONNULL_PTR this_ptr))[32];
30823
30824 /**
30825  * The channel ID
30826  */
30827 void ChannelReady_set_channel_id(struct LDKChannelReady *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
30828
30829 /**
30830  * The per-commitment point of the second commitment transaction
30831  */
30832 struct LDKPublicKey ChannelReady_get_next_per_commitment_point(const struct LDKChannelReady *NONNULL_PTR this_ptr);
30833
30834 /**
30835  * The per-commitment point of the second commitment transaction
30836  */
30837 void ChannelReady_set_next_per_commitment_point(struct LDKChannelReady *NONNULL_PTR this_ptr, struct LDKPublicKey val);
30838
30839 /**
30840  * If set, provides a `short_channel_id` alias for this channel.
30841  *
30842  * The sender will accept payments to be forwarded over this SCID and forward them to this
30843  * messages' recipient.
30844  */
30845 struct LDKCOption_u64Z ChannelReady_get_short_channel_id_alias(const struct LDKChannelReady *NONNULL_PTR this_ptr);
30846
30847 /**
30848  * If set, provides a `short_channel_id` alias for this channel.
30849  *
30850  * The sender will accept payments to be forwarded over this SCID and forward them to this
30851  * messages' recipient.
30852  */
30853 void ChannelReady_set_short_channel_id_alias(struct LDKChannelReady *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
30854
30855 /**
30856  * Constructs a new ChannelReady given each field
30857  */
30858 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);
30859
30860 /**
30861  * Creates a copy of the ChannelReady
30862  */
30863 struct LDKChannelReady ChannelReady_clone(const struct LDKChannelReady *NONNULL_PTR orig);
30864
30865 /**
30866  * Checks if two ChannelReadys contain equal inner contents.
30867  * This ignores pointers and is_owned flags and looks at the values in fields.
30868  * Two objects with NULL inner values will be considered "equal" here.
30869  */
30870 bool ChannelReady_eq(const struct LDKChannelReady *NONNULL_PTR a, const struct LDKChannelReady *NONNULL_PTR b);
30871
30872 /**
30873  * Frees any resources used by the TxAddInput, if is_owned is set and inner is non-NULL.
30874  */
30875 void TxAddInput_free(struct LDKTxAddInput this_obj);
30876
30877 /**
30878  * The channel ID
30879  */
30880 const uint8_t (*TxAddInput_get_channel_id(const struct LDKTxAddInput *NONNULL_PTR this_ptr))[32];
30881
30882 /**
30883  * The channel ID
30884  */
30885 void TxAddInput_set_channel_id(struct LDKTxAddInput *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
30886
30887 /**
30888  * A randomly chosen unique identifier for this input, which is even for initiators and odd for
30889  * non-initiators.
30890  */
30891 uint64_t TxAddInput_get_serial_id(const struct LDKTxAddInput *NONNULL_PTR this_ptr);
30892
30893 /**
30894  * A randomly chosen unique identifier for this input, which is even for initiators and odd for
30895  * non-initiators.
30896  */
30897 void TxAddInput_set_serial_id(struct LDKTxAddInput *NONNULL_PTR this_ptr, uint64_t val);
30898
30899 /**
30900  * Serialized transaction that contains the output this input spends to verify that it is non
30901  * malleable.
30902  */
30903 struct LDKTransactionU16LenLimited TxAddInput_get_prevtx(const struct LDKTxAddInput *NONNULL_PTR this_ptr);
30904
30905 /**
30906  * Serialized transaction that contains the output this input spends to verify that it is non
30907  * malleable.
30908  */
30909 void TxAddInput_set_prevtx(struct LDKTxAddInput *NONNULL_PTR this_ptr, struct LDKTransactionU16LenLimited val);
30910
30911 /**
30912  * The index of the output being spent
30913  */
30914 uint32_t TxAddInput_get_prevtx_out(const struct LDKTxAddInput *NONNULL_PTR this_ptr);
30915
30916 /**
30917  * The index of the output being spent
30918  */
30919 void TxAddInput_set_prevtx_out(struct LDKTxAddInput *NONNULL_PTR this_ptr, uint32_t val);
30920
30921 /**
30922  * The sequence number of this input
30923  */
30924 uint32_t TxAddInput_get_sequence(const struct LDKTxAddInput *NONNULL_PTR this_ptr);
30925
30926 /**
30927  * The sequence number of this input
30928  */
30929 void TxAddInput_set_sequence(struct LDKTxAddInput *NONNULL_PTR this_ptr, uint32_t val);
30930
30931 /**
30932  * Constructs a new TxAddInput given each field
30933  */
30934 MUST_USE_RES struct LDKTxAddInput TxAddInput_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t serial_id_arg, struct LDKTransactionU16LenLimited prevtx_arg, uint32_t prevtx_out_arg, uint32_t sequence_arg);
30935
30936 /**
30937  * Creates a copy of the TxAddInput
30938  */
30939 struct LDKTxAddInput TxAddInput_clone(const struct LDKTxAddInput *NONNULL_PTR orig);
30940
30941 /**
30942  * Checks if two TxAddInputs contain equal inner contents.
30943  * This ignores pointers and is_owned flags and looks at the values in fields.
30944  * Two objects with NULL inner values will be considered "equal" here.
30945  */
30946 bool TxAddInput_eq(const struct LDKTxAddInput *NONNULL_PTR a, const struct LDKTxAddInput *NONNULL_PTR b);
30947
30948 /**
30949  * Frees any resources used by the TxAddOutput, if is_owned is set and inner is non-NULL.
30950  */
30951 void TxAddOutput_free(struct LDKTxAddOutput this_obj);
30952
30953 /**
30954  * The channel ID
30955  */
30956 const uint8_t (*TxAddOutput_get_channel_id(const struct LDKTxAddOutput *NONNULL_PTR this_ptr))[32];
30957
30958 /**
30959  * The channel ID
30960  */
30961 void TxAddOutput_set_channel_id(struct LDKTxAddOutput *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
30962
30963 /**
30964  * A randomly chosen unique identifier for this output, which is even for initiators and odd for
30965  * non-initiators.
30966  */
30967 uint64_t TxAddOutput_get_serial_id(const struct LDKTxAddOutput *NONNULL_PTR this_ptr);
30968
30969 /**
30970  * A randomly chosen unique identifier for this output, which is even for initiators and odd for
30971  * non-initiators.
30972  */
30973 void TxAddOutput_set_serial_id(struct LDKTxAddOutput *NONNULL_PTR this_ptr, uint64_t val);
30974
30975 /**
30976  * The satoshi value of the output
30977  */
30978 uint64_t TxAddOutput_get_sats(const struct LDKTxAddOutput *NONNULL_PTR this_ptr);
30979
30980 /**
30981  * The satoshi value of the output
30982  */
30983 void TxAddOutput_set_sats(struct LDKTxAddOutput *NONNULL_PTR this_ptr, uint64_t val);
30984
30985 /**
30986  * The scriptPubKey for the output
30987  */
30988 struct LDKu8slice TxAddOutput_get_script(const struct LDKTxAddOutput *NONNULL_PTR this_ptr);
30989
30990 /**
30991  * The scriptPubKey for the output
30992  */
30993 void TxAddOutput_set_script(struct LDKTxAddOutput *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
30994
30995 /**
30996  * Constructs a new TxAddOutput given each field
30997  */
30998 MUST_USE_RES struct LDKTxAddOutput TxAddOutput_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t serial_id_arg, uint64_t sats_arg, struct LDKCVec_u8Z script_arg);
30999
31000 /**
31001  * Creates a copy of the TxAddOutput
31002  */
31003 struct LDKTxAddOutput TxAddOutput_clone(const struct LDKTxAddOutput *NONNULL_PTR orig);
31004
31005 /**
31006  * Checks if two TxAddOutputs contain equal inner contents.
31007  * This ignores pointers and is_owned flags and looks at the values in fields.
31008  * Two objects with NULL inner values will be considered "equal" here.
31009  */
31010 bool TxAddOutput_eq(const struct LDKTxAddOutput *NONNULL_PTR a, const struct LDKTxAddOutput *NONNULL_PTR b);
31011
31012 /**
31013  * Frees any resources used by the TxRemoveInput, if is_owned is set and inner is non-NULL.
31014  */
31015 void TxRemoveInput_free(struct LDKTxRemoveInput this_obj);
31016
31017 /**
31018  * The channel ID
31019  */
31020 const uint8_t (*TxRemoveInput_get_channel_id(const struct LDKTxRemoveInput *NONNULL_PTR this_ptr))[32];
31021
31022 /**
31023  * The channel ID
31024  */
31025 void TxRemoveInput_set_channel_id(struct LDKTxRemoveInput *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
31026
31027 /**
31028  * The serial ID of the input to be removed
31029  */
31030 uint64_t TxRemoveInput_get_serial_id(const struct LDKTxRemoveInput *NONNULL_PTR this_ptr);
31031
31032 /**
31033  * The serial ID of the input to be removed
31034  */
31035 void TxRemoveInput_set_serial_id(struct LDKTxRemoveInput *NONNULL_PTR this_ptr, uint64_t val);
31036
31037 /**
31038  * Constructs a new TxRemoveInput given each field
31039  */
31040 MUST_USE_RES struct LDKTxRemoveInput TxRemoveInput_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t serial_id_arg);
31041
31042 /**
31043  * Creates a copy of the TxRemoveInput
31044  */
31045 struct LDKTxRemoveInput TxRemoveInput_clone(const struct LDKTxRemoveInput *NONNULL_PTR orig);
31046
31047 /**
31048  * Checks if two TxRemoveInputs contain equal inner contents.
31049  * This ignores pointers and is_owned flags and looks at the values in fields.
31050  * Two objects with NULL inner values will be considered "equal" here.
31051  */
31052 bool TxRemoveInput_eq(const struct LDKTxRemoveInput *NONNULL_PTR a, const struct LDKTxRemoveInput *NONNULL_PTR b);
31053
31054 /**
31055  * Frees any resources used by the TxRemoveOutput, if is_owned is set and inner is non-NULL.
31056  */
31057 void TxRemoveOutput_free(struct LDKTxRemoveOutput this_obj);
31058
31059 /**
31060  * The channel ID
31061  */
31062 const uint8_t (*TxRemoveOutput_get_channel_id(const struct LDKTxRemoveOutput *NONNULL_PTR this_ptr))[32];
31063
31064 /**
31065  * The channel ID
31066  */
31067 void TxRemoveOutput_set_channel_id(struct LDKTxRemoveOutput *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
31068
31069 /**
31070  * The serial ID of the output to be removed
31071  */
31072 uint64_t TxRemoveOutput_get_serial_id(const struct LDKTxRemoveOutput *NONNULL_PTR this_ptr);
31073
31074 /**
31075  * The serial ID of the output to be removed
31076  */
31077 void TxRemoveOutput_set_serial_id(struct LDKTxRemoveOutput *NONNULL_PTR this_ptr, uint64_t val);
31078
31079 /**
31080  * Constructs a new TxRemoveOutput given each field
31081  */
31082 MUST_USE_RES struct LDKTxRemoveOutput TxRemoveOutput_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t serial_id_arg);
31083
31084 /**
31085  * Creates a copy of the TxRemoveOutput
31086  */
31087 struct LDKTxRemoveOutput TxRemoveOutput_clone(const struct LDKTxRemoveOutput *NONNULL_PTR orig);
31088
31089 /**
31090  * Checks if two TxRemoveOutputs contain equal inner contents.
31091  * This ignores pointers and is_owned flags and looks at the values in fields.
31092  * Two objects with NULL inner values will be considered "equal" here.
31093  */
31094 bool TxRemoveOutput_eq(const struct LDKTxRemoveOutput *NONNULL_PTR a, const struct LDKTxRemoveOutput *NONNULL_PTR b);
31095
31096 /**
31097  * Frees any resources used by the TxComplete, if is_owned is set and inner is non-NULL.
31098  */
31099 void TxComplete_free(struct LDKTxComplete this_obj);
31100
31101 /**
31102  * The channel ID
31103  */
31104 const uint8_t (*TxComplete_get_channel_id(const struct LDKTxComplete *NONNULL_PTR this_ptr))[32];
31105
31106 /**
31107  * The channel ID
31108  */
31109 void TxComplete_set_channel_id(struct LDKTxComplete *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
31110
31111 /**
31112  * Constructs a new TxComplete given each field
31113  */
31114 MUST_USE_RES struct LDKTxComplete TxComplete_new(struct LDKThirtyTwoBytes channel_id_arg);
31115
31116 /**
31117  * Creates a copy of the TxComplete
31118  */
31119 struct LDKTxComplete TxComplete_clone(const struct LDKTxComplete *NONNULL_PTR orig);
31120
31121 /**
31122  * Checks if two TxCompletes contain equal inner contents.
31123  * This ignores pointers and is_owned flags and looks at the values in fields.
31124  * Two objects with NULL inner values will be considered "equal" here.
31125  */
31126 bool TxComplete_eq(const struct LDKTxComplete *NONNULL_PTR a, const struct LDKTxComplete *NONNULL_PTR b);
31127
31128 /**
31129  * Frees any resources used by the TxSignatures, if is_owned is set and inner is non-NULL.
31130  */
31131 void TxSignatures_free(struct LDKTxSignatures this_obj);
31132
31133 /**
31134  * The channel ID
31135  */
31136 const uint8_t (*TxSignatures_get_channel_id(const struct LDKTxSignatures *NONNULL_PTR this_ptr))[32];
31137
31138 /**
31139  * The channel ID
31140  */
31141 void TxSignatures_set_channel_id(struct LDKTxSignatures *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
31142
31143 /**
31144  * The TXID
31145  */
31146 const uint8_t (*TxSignatures_get_tx_hash(const struct LDKTxSignatures *NONNULL_PTR this_ptr))[32];
31147
31148 /**
31149  * The TXID
31150  */
31151 void TxSignatures_set_tx_hash(struct LDKTxSignatures *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
31152
31153 /**
31154  * The list of witnesses
31155  *
31156  * Returns a copy of the field.
31157  */
31158 struct LDKCVec_WitnessZ TxSignatures_get_witnesses(const struct LDKTxSignatures *NONNULL_PTR this_ptr);
31159
31160 /**
31161  * The list of witnesses
31162  */
31163 void TxSignatures_set_witnesses(struct LDKTxSignatures *NONNULL_PTR this_ptr, struct LDKCVec_WitnessZ val);
31164
31165 /**
31166  * Constructs a new TxSignatures given each field
31167  */
31168 MUST_USE_RES struct LDKTxSignatures TxSignatures_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKThirtyTwoBytes tx_hash_arg, struct LDKCVec_WitnessZ witnesses_arg);
31169
31170 /**
31171  * Creates a copy of the TxSignatures
31172  */
31173 struct LDKTxSignatures TxSignatures_clone(const struct LDKTxSignatures *NONNULL_PTR orig);
31174
31175 /**
31176  * Checks if two TxSignaturess 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 TxSignatures_eq(const struct LDKTxSignatures *NONNULL_PTR a, const struct LDKTxSignatures *NONNULL_PTR b);
31181
31182 /**
31183  * Frees any resources used by the TxInitRbf, if is_owned is set and inner is non-NULL.
31184  */
31185 void TxInitRbf_free(struct LDKTxInitRbf this_obj);
31186
31187 /**
31188  * The channel ID
31189  */
31190 const uint8_t (*TxInitRbf_get_channel_id(const struct LDKTxInitRbf *NONNULL_PTR this_ptr))[32];
31191
31192 /**
31193  * The channel ID
31194  */
31195 void TxInitRbf_set_channel_id(struct LDKTxInitRbf *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
31196
31197 /**
31198  * The locktime of the transaction
31199  */
31200 uint32_t TxInitRbf_get_locktime(const struct LDKTxInitRbf *NONNULL_PTR this_ptr);
31201
31202 /**
31203  * The locktime of the transaction
31204  */
31205 void TxInitRbf_set_locktime(struct LDKTxInitRbf *NONNULL_PTR this_ptr, uint32_t val);
31206
31207 /**
31208  * The feerate of the transaction
31209  */
31210 uint32_t TxInitRbf_get_feerate_sat_per_1000_weight(const struct LDKTxInitRbf *NONNULL_PTR this_ptr);
31211
31212 /**
31213  * The feerate of the transaction
31214  */
31215 void TxInitRbf_set_feerate_sat_per_1000_weight(struct LDKTxInitRbf *NONNULL_PTR this_ptr, uint32_t val);
31216
31217 /**
31218  * The number of satoshis the sender will contribute to or, if negative, remove from
31219  * (e.g. splice-out) the funding output of the transaction
31220  */
31221 struct LDKCOption_i64Z TxInitRbf_get_funding_output_contribution(const struct LDKTxInitRbf *NONNULL_PTR this_ptr);
31222
31223 /**
31224  * The number of satoshis the sender will contribute to or, if negative, remove from
31225  * (e.g. splice-out) the funding output of the transaction
31226  */
31227 void TxInitRbf_set_funding_output_contribution(struct LDKTxInitRbf *NONNULL_PTR this_ptr, struct LDKCOption_i64Z val);
31228
31229 /**
31230  * Constructs a new TxInitRbf given each field
31231  */
31232 MUST_USE_RES struct LDKTxInitRbf TxInitRbf_new(struct LDKThirtyTwoBytes channel_id_arg, uint32_t locktime_arg, uint32_t feerate_sat_per_1000_weight_arg, struct LDKCOption_i64Z funding_output_contribution_arg);
31233
31234 /**
31235  * Creates a copy of the TxInitRbf
31236  */
31237 struct LDKTxInitRbf TxInitRbf_clone(const struct LDKTxInitRbf *NONNULL_PTR orig);
31238
31239 /**
31240  * Checks if two TxInitRbfs contain equal inner contents.
31241  * This ignores pointers and is_owned flags and looks at the values in fields.
31242  * Two objects with NULL inner values will be considered "equal" here.
31243  */
31244 bool TxInitRbf_eq(const struct LDKTxInitRbf *NONNULL_PTR a, const struct LDKTxInitRbf *NONNULL_PTR b);
31245
31246 /**
31247  * Frees any resources used by the TxAckRbf, if is_owned is set and inner is non-NULL.
31248  */
31249 void TxAckRbf_free(struct LDKTxAckRbf this_obj);
31250
31251 /**
31252  * The channel ID
31253  */
31254 const uint8_t (*TxAckRbf_get_channel_id(const struct LDKTxAckRbf *NONNULL_PTR this_ptr))[32];
31255
31256 /**
31257  * The channel ID
31258  */
31259 void TxAckRbf_set_channel_id(struct LDKTxAckRbf *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
31260
31261 /**
31262  * The number of satoshis the sender will contribute to or, if negative, remove from
31263  * (e.g. splice-out) the funding output of the transaction
31264  */
31265 struct LDKCOption_i64Z TxAckRbf_get_funding_output_contribution(const struct LDKTxAckRbf *NONNULL_PTR this_ptr);
31266
31267 /**
31268  * The number of satoshis the sender will contribute to or, if negative, remove from
31269  * (e.g. splice-out) the funding output of the transaction
31270  */
31271 void TxAckRbf_set_funding_output_contribution(struct LDKTxAckRbf *NONNULL_PTR this_ptr, struct LDKCOption_i64Z val);
31272
31273 /**
31274  * Constructs a new TxAckRbf given each field
31275  */
31276 MUST_USE_RES struct LDKTxAckRbf TxAckRbf_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKCOption_i64Z funding_output_contribution_arg);
31277
31278 /**
31279  * Creates a copy of the TxAckRbf
31280  */
31281 struct LDKTxAckRbf TxAckRbf_clone(const struct LDKTxAckRbf *NONNULL_PTR orig);
31282
31283 /**
31284  * Checks if two TxAckRbfs contain equal inner contents.
31285  * This ignores pointers and is_owned flags and looks at the values in fields.
31286  * Two objects with NULL inner values will be considered "equal" here.
31287  */
31288 bool TxAckRbf_eq(const struct LDKTxAckRbf *NONNULL_PTR a, const struct LDKTxAckRbf *NONNULL_PTR b);
31289
31290 /**
31291  * Frees any resources used by the TxAbort, if is_owned is set and inner is non-NULL.
31292  */
31293 void TxAbort_free(struct LDKTxAbort this_obj);
31294
31295 /**
31296  * The channel ID
31297  */
31298 const uint8_t (*TxAbort_get_channel_id(const struct LDKTxAbort *NONNULL_PTR this_ptr))[32];
31299
31300 /**
31301  * The channel ID
31302  */
31303 void TxAbort_set_channel_id(struct LDKTxAbort *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
31304
31305 /**
31306  * Message data
31307  *
31308  * Returns a copy of the field.
31309  */
31310 struct LDKCVec_u8Z TxAbort_get_data(const struct LDKTxAbort *NONNULL_PTR this_ptr);
31311
31312 /**
31313  * Message data
31314  */
31315 void TxAbort_set_data(struct LDKTxAbort *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
31316
31317 /**
31318  * Constructs a new TxAbort given each field
31319  */
31320 MUST_USE_RES struct LDKTxAbort TxAbort_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKCVec_u8Z data_arg);
31321
31322 /**
31323  * Creates a copy of the TxAbort
31324  */
31325 struct LDKTxAbort TxAbort_clone(const struct LDKTxAbort *NONNULL_PTR orig);
31326
31327 /**
31328  * Checks if two TxAborts contain equal inner contents.
31329  * This ignores pointers and is_owned flags and looks at the values in fields.
31330  * Two objects with NULL inner values will be considered "equal" here.
31331  */
31332 bool TxAbort_eq(const struct LDKTxAbort *NONNULL_PTR a, const struct LDKTxAbort *NONNULL_PTR b);
31333
31334 /**
31335  * Frees any resources used by the Shutdown, if is_owned is set and inner is non-NULL.
31336  */
31337 void Shutdown_free(struct LDKShutdown this_obj);
31338
31339 /**
31340  * The channel ID
31341  */
31342 const uint8_t (*Shutdown_get_channel_id(const struct LDKShutdown *NONNULL_PTR this_ptr))[32];
31343
31344 /**
31345  * The channel ID
31346  */
31347 void Shutdown_set_channel_id(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
31348
31349 /**
31350  * The destination of this peer's funds on closing.
31351  *
31352  * Must be in one of these forms: P2PKH, P2SH, P2WPKH, P2WSH, P2TR.
31353  */
31354 struct LDKu8slice Shutdown_get_scriptpubkey(const struct LDKShutdown *NONNULL_PTR this_ptr);
31355
31356 /**
31357  * The destination of this peer's funds on closing.
31358  *
31359  * Must be in one of these forms: P2PKH, P2SH, P2WPKH, P2WSH, P2TR.
31360  */
31361 void Shutdown_set_scriptpubkey(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
31362
31363 /**
31364  * Constructs a new Shutdown given each field
31365  */
31366 MUST_USE_RES struct LDKShutdown Shutdown_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKCVec_u8Z scriptpubkey_arg);
31367
31368 /**
31369  * Creates a copy of the Shutdown
31370  */
31371 struct LDKShutdown Shutdown_clone(const struct LDKShutdown *NONNULL_PTR orig);
31372
31373 /**
31374  * Checks if two Shutdowns contain equal inner contents.
31375  * This ignores pointers and is_owned flags and looks at the values in fields.
31376  * Two objects with NULL inner values will be considered "equal" here.
31377  */
31378 bool Shutdown_eq(const struct LDKShutdown *NONNULL_PTR a, const struct LDKShutdown *NONNULL_PTR b);
31379
31380 /**
31381  * Frees any resources used by the ClosingSignedFeeRange, if is_owned is set and inner is non-NULL.
31382  */
31383 void ClosingSignedFeeRange_free(struct LDKClosingSignedFeeRange this_obj);
31384
31385 /**
31386  * The minimum absolute fee, in satoshis, which the sender is willing to place on the closing
31387  * transaction.
31388  */
31389 uint64_t ClosingSignedFeeRange_get_min_fee_satoshis(const struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr);
31390
31391 /**
31392  * The minimum absolute fee, in satoshis, which the sender is willing to place on the closing
31393  * transaction.
31394  */
31395 void ClosingSignedFeeRange_set_min_fee_satoshis(struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr, uint64_t val);
31396
31397 /**
31398  * The maximum absolute fee, in satoshis, which the sender is willing to place on the closing
31399  * transaction.
31400  */
31401 uint64_t ClosingSignedFeeRange_get_max_fee_satoshis(const struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr);
31402
31403 /**
31404  * The maximum absolute fee, in satoshis, which the sender is willing to place on the closing
31405  * transaction.
31406  */
31407 void ClosingSignedFeeRange_set_max_fee_satoshis(struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr, uint64_t val);
31408
31409 /**
31410  * Constructs a new ClosingSignedFeeRange given each field
31411  */
31412 MUST_USE_RES struct LDKClosingSignedFeeRange ClosingSignedFeeRange_new(uint64_t min_fee_satoshis_arg, uint64_t max_fee_satoshis_arg);
31413
31414 /**
31415  * Creates a copy of the ClosingSignedFeeRange
31416  */
31417 struct LDKClosingSignedFeeRange ClosingSignedFeeRange_clone(const struct LDKClosingSignedFeeRange *NONNULL_PTR orig);
31418
31419 /**
31420  * Checks if two ClosingSignedFeeRanges contain equal inner contents.
31421  * This ignores pointers and is_owned flags and looks at the values in fields.
31422  * Two objects with NULL inner values will be considered "equal" here.
31423  */
31424 bool ClosingSignedFeeRange_eq(const struct LDKClosingSignedFeeRange *NONNULL_PTR a, const struct LDKClosingSignedFeeRange *NONNULL_PTR b);
31425
31426 /**
31427  * Frees any resources used by the ClosingSigned, if is_owned is set and inner is non-NULL.
31428  */
31429 void ClosingSigned_free(struct LDKClosingSigned this_obj);
31430
31431 /**
31432  * The channel ID
31433  */
31434 const uint8_t (*ClosingSigned_get_channel_id(const struct LDKClosingSigned *NONNULL_PTR this_ptr))[32];
31435
31436 /**
31437  * The channel ID
31438  */
31439 void ClosingSigned_set_channel_id(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
31440
31441 /**
31442  * The proposed total fee for the closing transaction
31443  */
31444 uint64_t ClosingSigned_get_fee_satoshis(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
31445
31446 /**
31447  * The proposed total fee for the closing transaction
31448  */
31449 void ClosingSigned_set_fee_satoshis(struct LDKClosingSigned *NONNULL_PTR this_ptr, uint64_t val);
31450
31451 /**
31452  * A signature on the closing transaction
31453  */
31454 struct LDKSignature ClosingSigned_get_signature(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
31455
31456 /**
31457  * A signature on the closing transaction
31458  */
31459 void ClosingSigned_set_signature(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
31460
31461 /**
31462  * The minimum and maximum fees which the sender is willing to accept, provided only by new
31463  * nodes.
31464  *
31465  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
31466  */
31467 struct LDKClosingSignedFeeRange ClosingSigned_get_fee_range(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
31468
31469 /**
31470  * The minimum and maximum fees which the sender is willing to accept, provided only by new
31471  * nodes.
31472  *
31473  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
31474  */
31475 void ClosingSigned_set_fee_range(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKClosingSignedFeeRange val);
31476
31477 /**
31478  * Constructs a new ClosingSigned given each field
31479  */
31480 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);
31481
31482 /**
31483  * Creates a copy of the ClosingSigned
31484  */
31485 struct LDKClosingSigned ClosingSigned_clone(const struct LDKClosingSigned *NONNULL_PTR orig);
31486
31487 /**
31488  * Checks if two ClosingSigneds contain equal inner contents.
31489  * This ignores pointers and is_owned flags and looks at the values in fields.
31490  * Two objects with NULL inner values will be considered "equal" here.
31491  */
31492 bool ClosingSigned_eq(const struct LDKClosingSigned *NONNULL_PTR a, const struct LDKClosingSigned *NONNULL_PTR b);
31493
31494 /**
31495  * Frees any resources used by the UpdateAddHTLC, if is_owned is set and inner is non-NULL.
31496  */
31497 void UpdateAddHTLC_free(struct LDKUpdateAddHTLC this_obj);
31498
31499 /**
31500  * The channel ID
31501  */
31502 const uint8_t (*UpdateAddHTLC_get_channel_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32];
31503
31504 /**
31505  * The channel ID
31506  */
31507 void UpdateAddHTLC_set_channel_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
31508
31509 /**
31510  * The HTLC ID
31511  */
31512 uint64_t UpdateAddHTLC_get_htlc_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
31513
31514 /**
31515  * The HTLC ID
31516  */
31517 void UpdateAddHTLC_set_htlc_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
31518
31519 /**
31520  * The HTLC value in milli-satoshi
31521  */
31522 uint64_t UpdateAddHTLC_get_amount_msat(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
31523
31524 /**
31525  * The HTLC value in milli-satoshi
31526  */
31527 void UpdateAddHTLC_set_amount_msat(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
31528
31529 /**
31530  * The payment hash, the pre-image of which controls HTLC redemption
31531  */
31532 const uint8_t (*UpdateAddHTLC_get_payment_hash(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32];
31533
31534 /**
31535  * The payment hash, the pre-image of which controls HTLC redemption
31536  */
31537 void UpdateAddHTLC_set_payment_hash(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
31538
31539 /**
31540  * The expiry height of the HTLC
31541  */
31542 uint32_t UpdateAddHTLC_get_cltv_expiry(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
31543
31544 /**
31545  * The expiry height of the HTLC
31546  */
31547 void UpdateAddHTLC_set_cltv_expiry(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint32_t val);
31548
31549 /**
31550  * The extra fee skimmed by the sender of this message. See
31551  * [`ChannelConfig::accept_underpaying_htlcs`].
31552  *
31553  * [`ChannelConfig::accept_underpaying_htlcs`]: crate::util::config::ChannelConfig::accept_underpaying_htlcs
31554  */
31555 struct LDKCOption_u64Z UpdateAddHTLC_get_skimmed_fee_msat(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
31556
31557 /**
31558  * The extra fee skimmed by the sender of this message. See
31559  * [`ChannelConfig::accept_underpaying_htlcs`].
31560  *
31561  * [`ChannelConfig::accept_underpaying_htlcs`]: crate::util::config::ChannelConfig::accept_underpaying_htlcs
31562  */
31563 void UpdateAddHTLC_set_skimmed_fee_msat(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
31564
31565 /**
31566  * Creates a copy of the UpdateAddHTLC
31567  */
31568 struct LDKUpdateAddHTLC UpdateAddHTLC_clone(const struct LDKUpdateAddHTLC *NONNULL_PTR orig);
31569
31570 /**
31571  * Checks if two UpdateAddHTLCs contain equal inner contents.
31572  * This ignores pointers and is_owned flags and looks at the values in fields.
31573  * Two objects with NULL inner values will be considered "equal" here.
31574  */
31575 bool UpdateAddHTLC_eq(const struct LDKUpdateAddHTLC *NONNULL_PTR a, const struct LDKUpdateAddHTLC *NONNULL_PTR b);
31576
31577 /**
31578  * Frees any resources used by the OnionMessage, if is_owned is set and inner is non-NULL.
31579  */
31580 void OnionMessage_free(struct LDKOnionMessage this_obj);
31581
31582 /**
31583  * Used in decrypting the onion packet's payload.
31584  */
31585 struct LDKPublicKey OnionMessage_get_blinding_point(const struct LDKOnionMessage *NONNULL_PTR this_ptr);
31586
31587 /**
31588  * Used in decrypting the onion packet's payload.
31589  */
31590 void OnionMessage_set_blinding_point(struct LDKOnionMessage *NONNULL_PTR this_ptr, struct LDKPublicKey val);
31591
31592 /**
31593  * Creates a copy of the OnionMessage
31594  */
31595 struct LDKOnionMessage OnionMessage_clone(const struct LDKOnionMessage *NONNULL_PTR orig);
31596
31597 /**
31598  * Checks if two OnionMessages contain equal inner contents.
31599  * This ignores pointers and is_owned flags and looks at the values in fields.
31600  * Two objects with NULL inner values will be considered "equal" here.
31601  */
31602 bool OnionMessage_eq(const struct LDKOnionMessage *NONNULL_PTR a, const struct LDKOnionMessage *NONNULL_PTR b);
31603
31604 /**
31605  * Frees any resources used by the UpdateFulfillHTLC, if is_owned is set and inner is non-NULL.
31606  */
31607 void UpdateFulfillHTLC_free(struct LDKUpdateFulfillHTLC this_obj);
31608
31609 /**
31610  * The channel ID
31611  */
31612 const uint8_t (*UpdateFulfillHTLC_get_channel_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32];
31613
31614 /**
31615  * The channel ID
31616  */
31617 void UpdateFulfillHTLC_set_channel_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
31618
31619 /**
31620  * The HTLC ID
31621  */
31622 uint64_t UpdateFulfillHTLC_get_htlc_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr);
31623
31624 /**
31625  * The HTLC ID
31626  */
31627 void UpdateFulfillHTLC_set_htlc_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, uint64_t val);
31628
31629 /**
31630  * The pre-image of the payment hash, allowing HTLC redemption
31631  */
31632 const uint8_t (*UpdateFulfillHTLC_get_payment_preimage(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32];
31633
31634 /**
31635  * The pre-image of the payment hash, allowing HTLC redemption
31636  */
31637 void UpdateFulfillHTLC_set_payment_preimage(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
31638
31639 /**
31640  * Constructs a new UpdateFulfillHTLC given each field
31641  */
31642 MUST_USE_RES struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t htlc_id_arg, struct LDKThirtyTwoBytes payment_preimage_arg);
31643
31644 /**
31645  * Creates a copy of the UpdateFulfillHTLC
31646  */
31647 struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_clone(const struct LDKUpdateFulfillHTLC *NONNULL_PTR orig);
31648
31649 /**
31650  * Checks if two UpdateFulfillHTLCs contain equal inner contents.
31651  * This ignores pointers and is_owned flags and looks at the values in fields.
31652  * Two objects with NULL inner values will be considered "equal" here.
31653  */
31654 bool UpdateFulfillHTLC_eq(const struct LDKUpdateFulfillHTLC *NONNULL_PTR a, const struct LDKUpdateFulfillHTLC *NONNULL_PTR b);
31655
31656 /**
31657  * Frees any resources used by the UpdateFailHTLC, if is_owned is set and inner is non-NULL.
31658  */
31659 void UpdateFailHTLC_free(struct LDKUpdateFailHTLC this_obj);
31660
31661 /**
31662  * The channel ID
31663  */
31664 const uint8_t (*UpdateFailHTLC_get_channel_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr))[32];
31665
31666 /**
31667  * The channel ID
31668  */
31669 void UpdateFailHTLC_set_channel_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
31670
31671 /**
31672  * The HTLC ID
31673  */
31674 uint64_t UpdateFailHTLC_get_htlc_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr);
31675
31676 /**
31677  * The HTLC ID
31678  */
31679 void UpdateFailHTLC_set_htlc_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, uint64_t val);
31680
31681 /**
31682  * Creates a copy of the UpdateFailHTLC
31683  */
31684 struct LDKUpdateFailHTLC UpdateFailHTLC_clone(const struct LDKUpdateFailHTLC *NONNULL_PTR orig);
31685
31686 /**
31687  * Checks if two UpdateFailHTLCs contain equal inner contents.
31688  * This ignores pointers and is_owned flags and looks at the values in fields.
31689  * Two objects with NULL inner values will be considered "equal" here.
31690  */
31691 bool UpdateFailHTLC_eq(const struct LDKUpdateFailHTLC *NONNULL_PTR a, const struct LDKUpdateFailHTLC *NONNULL_PTR b);
31692
31693 /**
31694  * Frees any resources used by the UpdateFailMalformedHTLC, if is_owned is set and inner is non-NULL.
31695  */
31696 void UpdateFailMalformedHTLC_free(struct LDKUpdateFailMalformedHTLC this_obj);
31697
31698 /**
31699  * The channel ID
31700  */
31701 const uint8_t (*UpdateFailMalformedHTLC_get_channel_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr))[32];
31702
31703 /**
31704  * The channel ID
31705  */
31706 void UpdateFailMalformedHTLC_set_channel_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
31707
31708 /**
31709  * The HTLC ID
31710  */
31711 uint64_t UpdateFailMalformedHTLC_get_htlc_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
31712
31713 /**
31714  * The HTLC ID
31715  */
31716 void UpdateFailMalformedHTLC_set_htlc_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint64_t val);
31717
31718 /**
31719  * The failure code
31720  */
31721 uint16_t UpdateFailMalformedHTLC_get_failure_code(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
31722
31723 /**
31724  * The failure code
31725  */
31726 void UpdateFailMalformedHTLC_set_failure_code(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint16_t val);
31727
31728 /**
31729  * Creates a copy of the UpdateFailMalformedHTLC
31730  */
31731 struct LDKUpdateFailMalformedHTLC UpdateFailMalformedHTLC_clone(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR orig);
31732
31733 /**
31734  * Checks if two UpdateFailMalformedHTLCs contain equal inner contents.
31735  * This ignores pointers and is_owned flags and looks at the values in fields.
31736  * Two objects with NULL inner values will be considered "equal" here.
31737  */
31738 bool UpdateFailMalformedHTLC_eq(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR a, const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR b);
31739
31740 /**
31741  * Frees any resources used by the CommitmentSigned, if is_owned is set and inner is non-NULL.
31742  */
31743 void CommitmentSigned_free(struct LDKCommitmentSigned this_obj);
31744
31745 /**
31746  * The channel ID
31747  */
31748 const uint8_t (*CommitmentSigned_get_channel_id(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr))[32];
31749
31750 /**
31751  * The channel ID
31752  */
31753 void CommitmentSigned_set_channel_id(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
31754
31755 /**
31756  * A signature on the commitment transaction
31757  */
31758 struct LDKSignature CommitmentSigned_get_signature(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr);
31759
31760 /**
31761  * A signature on the commitment transaction
31762  */
31763 void CommitmentSigned_set_signature(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
31764
31765 /**
31766  * Signatures on the HTLC transactions
31767  *
31768  * Returns a copy of the field.
31769  */
31770 struct LDKCVec_SignatureZ CommitmentSigned_get_htlc_signatures(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr);
31771
31772 /**
31773  * Signatures on the HTLC transactions
31774  */
31775 void CommitmentSigned_set_htlc_signatures(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val);
31776
31777 /**
31778  * Constructs a new CommitmentSigned given each field
31779  */
31780 MUST_USE_RES struct LDKCommitmentSigned CommitmentSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg, struct LDKCVec_SignatureZ htlc_signatures_arg);
31781
31782 /**
31783  * Creates a copy of the CommitmentSigned
31784  */
31785 struct LDKCommitmentSigned CommitmentSigned_clone(const struct LDKCommitmentSigned *NONNULL_PTR orig);
31786
31787 /**
31788  * Checks if two CommitmentSigneds contain equal inner contents.
31789  * This ignores pointers and is_owned flags and looks at the values in fields.
31790  * Two objects with NULL inner values will be considered "equal" here.
31791  */
31792 bool CommitmentSigned_eq(const struct LDKCommitmentSigned *NONNULL_PTR a, const struct LDKCommitmentSigned *NONNULL_PTR b);
31793
31794 /**
31795  * Frees any resources used by the RevokeAndACK, if is_owned is set and inner is non-NULL.
31796  */
31797 void RevokeAndACK_free(struct LDKRevokeAndACK this_obj);
31798
31799 /**
31800  * The channel ID
31801  */
31802 const uint8_t (*RevokeAndACK_get_channel_id(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32];
31803
31804 /**
31805  * The channel ID
31806  */
31807 void RevokeAndACK_set_channel_id(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
31808
31809 /**
31810  * The secret corresponding to the per-commitment point
31811  */
31812 const uint8_t (*RevokeAndACK_get_per_commitment_secret(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32];
31813
31814 /**
31815  * The secret corresponding to the per-commitment point
31816  */
31817 void RevokeAndACK_set_per_commitment_secret(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
31818
31819 /**
31820  * The next sender-broadcast commitment transaction's per-commitment point
31821  */
31822 struct LDKPublicKey RevokeAndACK_get_next_per_commitment_point(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr);
31823
31824 /**
31825  * The next sender-broadcast commitment transaction's per-commitment point
31826  */
31827 void RevokeAndACK_set_next_per_commitment_point(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKPublicKey val);
31828
31829 /**
31830  * Constructs a new RevokeAndACK given each field
31831  */
31832 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);
31833
31834 /**
31835  * Creates a copy of the RevokeAndACK
31836  */
31837 struct LDKRevokeAndACK RevokeAndACK_clone(const struct LDKRevokeAndACK *NONNULL_PTR orig);
31838
31839 /**
31840  * Checks if two RevokeAndACKs contain equal inner contents.
31841  * This ignores pointers and is_owned flags and looks at the values in fields.
31842  * Two objects with NULL inner values will be considered "equal" here.
31843  */
31844 bool RevokeAndACK_eq(const struct LDKRevokeAndACK *NONNULL_PTR a, const struct LDKRevokeAndACK *NONNULL_PTR b);
31845
31846 /**
31847  * Frees any resources used by the UpdateFee, if is_owned is set and inner is non-NULL.
31848  */
31849 void UpdateFee_free(struct LDKUpdateFee this_obj);
31850
31851 /**
31852  * The channel ID
31853  */
31854 const uint8_t (*UpdateFee_get_channel_id(const struct LDKUpdateFee *NONNULL_PTR this_ptr))[32];
31855
31856 /**
31857  * The channel ID
31858  */
31859 void UpdateFee_set_channel_id(struct LDKUpdateFee *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
31860
31861 /**
31862  * Fee rate per 1000-weight of the transaction
31863  */
31864 uint32_t UpdateFee_get_feerate_per_kw(const struct LDKUpdateFee *NONNULL_PTR this_ptr);
31865
31866 /**
31867  * Fee rate per 1000-weight of the transaction
31868  */
31869 void UpdateFee_set_feerate_per_kw(struct LDKUpdateFee *NONNULL_PTR this_ptr, uint32_t val);
31870
31871 /**
31872  * Constructs a new UpdateFee given each field
31873  */
31874 MUST_USE_RES struct LDKUpdateFee UpdateFee_new(struct LDKThirtyTwoBytes channel_id_arg, uint32_t feerate_per_kw_arg);
31875
31876 /**
31877  * Creates a copy of the UpdateFee
31878  */
31879 struct LDKUpdateFee UpdateFee_clone(const struct LDKUpdateFee *NONNULL_PTR orig);
31880
31881 /**
31882  * Checks if two UpdateFees contain equal inner contents.
31883  * This ignores pointers and is_owned flags and looks at the values in fields.
31884  * Two objects with NULL inner values will be considered "equal" here.
31885  */
31886 bool UpdateFee_eq(const struct LDKUpdateFee *NONNULL_PTR a, const struct LDKUpdateFee *NONNULL_PTR b);
31887
31888 /**
31889  * Frees any resources used by the ChannelReestablish, if is_owned is set and inner is non-NULL.
31890  */
31891 void ChannelReestablish_free(struct LDKChannelReestablish this_obj);
31892
31893 /**
31894  * The channel ID
31895  */
31896 const uint8_t (*ChannelReestablish_get_channel_id(const struct LDKChannelReestablish *NONNULL_PTR this_ptr))[32];
31897
31898 /**
31899  * The channel ID
31900  */
31901 void ChannelReestablish_set_channel_id(struct LDKChannelReestablish *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
31902
31903 /**
31904  * The next commitment number for the sender
31905  */
31906 uint64_t ChannelReestablish_get_next_local_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
31907
31908 /**
31909  * The next commitment number for the sender
31910  */
31911 void ChannelReestablish_set_next_local_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
31912
31913 /**
31914  * The next commitment number for the recipient
31915  */
31916 uint64_t ChannelReestablish_get_next_remote_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
31917
31918 /**
31919  * The next commitment number for the recipient
31920  */
31921 void ChannelReestablish_set_next_remote_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
31922
31923 /**
31924  * Proof that the sender knows the per-commitment secret of a specific commitment transaction
31925  * belonging to the recipient
31926  */
31927 const uint8_t (*ChannelReestablish_get_your_last_per_commitment_secret(const struct LDKChannelReestablish *NONNULL_PTR this_ptr))[32];
31928
31929 /**
31930  * Proof that the sender knows the per-commitment secret of a specific commitment transaction
31931  * belonging to the recipient
31932  */
31933 void ChannelReestablish_set_your_last_per_commitment_secret(struct LDKChannelReestablish *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
31934
31935 /**
31936  * The sender's per-commitment point for their current commitment transaction
31937  */
31938 struct LDKPublicKey ChannelReestablish_get_my_current_per_commitment_point(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
31939
31940 /**
31941  * The sender's per-commitment point for their current commitment transaction
31942  */
31943 void ChannelReestablish_set_my_current_per_commitment_point(struct LDKChannelReestablish *NONNULL_PTR this_ptr, struct LDKPublicKey val);
31944
31945 /**
31946  * The next funding transaction ID
31947  */
31948 struct LDKCOption_TxidZ ChannelReestablish_get_next_funding_txid(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
31949
31950 /**
31951  * The next funding transaction ID
31952  */
31953 void ChannelReestablish_set_next_funding_txid(struct LDKChannelReestablish *NONNULL_PTR this_ptr, struct LDKCOption_TxidZ val);
31954
31955 /**
31956  * Constructs a new ChannelReestablish given each field
31957  */
31958 MUST_USE_RES struct LDKChannelReestablish ChannelReestablish_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t next_local_commitment_number_arg, uint64_t next_remote_commitment_number_arg, struct LDKThirtyTwoBytes your_last_per_commitment_secret_arg, struct LDKPublicKey my_current_per_commitment_point_arg, struct LDKCOption_TxidZ next_funding_txid_arg);
31959
31960 /**
31961  * Creates a copy of the ChannelReestablish
31962  */
31963 struct LDKChannelReestablish ChannelReestablish_clone(const struct LDKChannelReestablish *NONNULL_PTR orig);
31964
31965 /**
31966  * Checks if two ChannelReestablishs contain equal inner contents.
31967  * This ignores pointers and is_owned flags and looks at the values in fields.
31968  * Two objects with NULL inner values will be considered "equal" here.
31969  */
31970 bool ChannelReestablish_eq(const struct LDKChannelReestablish *NONNULL_PTR a, const struct LDKChannelReestablish *NONNULL_PTR b);
31971
31972 /**
31973  * Frees any resources used by the AnnouncementSignatures, if is_owned is set and inner is non-NULL.
31974  */
31975 void AnnouncementSignatures_free(struct LDKAnnouncementSignatures this_obj);
31976
31977 /**
31978  * The channel ID
31979  */
31980 const uint8_t (*AnnouncementSignatures_get_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr))[32];
31981
31982 /**
31983  * The channel ID
31984  */
31985 void AnnouncementSignatures_set_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
31986
31987 /**
31988  * The short channel ID
31989  */
31990 uint64_t AnnouncementSignatures_get_short_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
31991
31992 /**
31993  * The short channel ID
31994  */
31995 void AnnouncementSignatures_set_short_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, uint64_t val);
31996
31997 /**
31998  * A signature by the node key
31999  */
32000 struct LDKSignature AnnouncementSignatures_get_node_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
32001
32002 /**
32003  * A signature by the node key
32004  */
32005 void AnnouncementSignatures_set_node_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val);
32006
32007 /**
32008  * A signature by the funding key
32009  */
32010 struct LDKSignature AnnouncementSignatures_get_bitcoin_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
32011
32012 /**
32013  * A signature by the funding key
32014  */
32015 void AnnouncementSignatures_set_bitcoin_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val);
32016
32017 /**
32018  * Constructs a new AnnouncementSignatures given each field
32019  */
32020 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);
32021
32022 /**
32023  * Creates a copy of the AnnouncementSignatures
32024  */
32025 struct LDKAnnouncementSignatures AnnouncementSignatures_clone(const struct LDKAnnouncementSignatures *NONNULL_PTR orig);
32026
32027 /**
32028  * Checks if two AnnouncementSignaturess contain equal inner contents.
32029  * This ignores pointers and is_owned flags and looks at the values in fields.
32030  * Two objects with NULL inner values will be considered "equal" here.
32031  */
32032 bool AnnouncementSignatures_eq(const struct LDKAnnouncementSignatures *NONNULL_PTR a, const struct LDKAnnouncementSignatures *NONNULL_PTR b);
32033
32034 /**
32035  * Frees any resources used by the NetAddress
32036  */
32037 void NetAddress_free(struct LDKNetAddress this_ptr);
32038
32039 /**
32040  * Creates a copy of the NetAddress
32041  */
32042 struct LDKNetAddress NetAddress_clone(const struct LDKNetAddress *NONNULL_PTR orig);
32043
32044 /**
32045  * Utility method to constructs a new IPv4-variant NetAddress
32046  */
32047 struct LDKNetAddress NetAddress_ipv4(struct LDKFourBytes addr, uint16_t port);
32048
32049 /**
32050  * Utility method to constructs a new IPv6-variant NetAddress
32051  */
32052 struct LDKNetAddress NetAddress_ipv6(struct LDKSixteenBytes addr, uint16_t port);
32053
32054 /**
32055  * Utility method to constructs a new OnionV2-variant NetAddress
32056  */
32057 struct LDKNetAddress NetAddress_onion_v2(struct LDKTwelveBytes a);
32058
32059 /**
32060  * Utility method to constructs a new OnionV3-variant NetAddress
32061  */
32062 struct LDKNetAddress NetAddress_onion_v3(struct LDKThirtyTwoBytes ed25519_pubkey, uint16_t checksum, uint8_t version, uint16_t port);
32063
32064 /**
32065  * Utility method to constructs a new Hostname-variant NetAddress
32066  */
32067 struct LDKNetAddress NetAddress_hostname(struct LDKHostname hostname, uint16_t port);
32068
32069 /**
32070  * Checks if two NetAddresss contain equal inner contents.
32071  * This ignores pointers and is_owned flags and looks at the values in fields.
32072  */
32073 bool NetAddress_eq(const struct LDKNetAddress *NONNULL_PTR a, const struct LDKNetAddress *NONNULL_PTR b);
32074
32075 /**
32076  * Serialize the NetAddress object into a byte array which can be read by NetAddress_read
32077  */
32078 struct LDKCVec_u8Z NetAddress_write(const struct LDKNetAddress *NONNULL_PTR obj);
32079
32080 /**
32081  * Read a NetAddress from a byte array, created by NetAddress_write
32082  */
32083 struct LDKCResult_NetAddressDecodeErrorZ NetAddress_read(struct LDKu8slice ser);
32084
32085 /**
32086  * Frees any resources used by the UnsignedGossipMessage
32087  */
32088 void UnsignedGossipMessage_free(struct LDKUnsignedGossipMessage this_ptr);
32089
32090 /**
32091  * Creates a copy of the UnsignedGossipMessage
32092  */
32093 struct LDKUnsignedGossipMessage UnsignedGossipMessage_clone(const struct LDKUnsignedGossipMessage *NONNULL_PTR orig);
32094
32095 /**
32096  * Utility method to constructs a new ChannelAnnouncement-variant UnsignedGossipMessage
32097  */
32098 struct LDKUnsignedGossipMessage UnsignedGossipMessage_channel_announcement(struct LDKUnsignedChannelAnnouncement a);
32099
32100 /**
32101  * Utility method to constructs a new ChannelUpdate-variant UnsignedGossipMessage
32102  */
32103 struct LDKUnsignedGossipMessage UnsignedGossipMessage_channel_update(struct LDKUnsignedChannelUpdate a);
32104
32105 /**
32106  * Utility method to constructs a new NodeAnnouncement-variant UnsignedGossipMessage
32107  */
32108 struct LDKUnsignedGossipMessage UnsignedGossipMessage_node_announcement(struct LDKUnsignedNodeAnnouncement a);
32109
32110 /**
32111  * Serialize the UnsignedGossipMessage object into a byte array which can be read by UnsignedGossipMessage_read
32112  */
32113 struct LDKCVec_u8Z UnsignedGossipMessage_write(const struct LDKUnsignedGossipMessage *NONNULL_PTR obj);
32114
32115 /**
32116  * Frees any resources used by the UnsignedNodeAnnouncement, if is_owned is set and inner is non-NULL.
32117  */
32118 void UnsignedNodeAnnouncement_free(struct LDKUnsignedNodeAnnouncement this_obj);
32119
32120 /**
32121  * The advertised features
32122  */
32123 struct LDKNodeFeatures UnsignedNodeAnnouncement_get_features(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
32124
32125 /**
32126  * The advertised features
32127  */
32128 void UnsignedNodeAnnouncement_set_features(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
32129
32130 /**
32131  * A strictly monotonic announcement counter, with gaps allowed
32132  */
32133 uint32_t UnsignedNodeAnnouncement_get_timestamp(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
32134
32135 /**
32136  * A strictly monotonic announcement counter, with gaps allowed
32137  */
32138 void UnsignedNodeAnnouncement_set_timestamp(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, uint32_t val);
32139
32140 /**
32141  * The `node_id` this announcement originated from (don't rebroadcast the `node_announcement` back
32142  * to this node).
32143  */
32144 struct LDKNodeId UnsignedNodeAnnouncement_get_node_id(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
32145
32146 /**
32147  * The `node_id` this announcement originated from (don't rebroadcast the `node_announcement` back
32148  * to this node).
32149  */
32150 void UnsignedNodeAnnouncement_set_node_id(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeId val);
32151
32152 /**
32153  * An RGB color for UI purposes
32154  */
32155 const uint8_t (*UnsignedNodeAnnouncement_get_rgb(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[3];
32156
32157 /**
32158  * An RGB color for UI purposes
32159  */
32160 void UnsignedNodeAnnouncement_set_rgb(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
32161
32162 /**
32163  * An alias, for UI purposes.
32164  *
32165  * This should be sanitized before use. There is no guarantee of uniqueness.
32166  */
32167 struct LDKNodeAlias UnsignedNodeAnnouncement_get_alias(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
32168
32169 /**
32170  * An alias, for UI purposes.
32171  *
32172  * This should be sanitized before use. There is no guarantee of uniqueness.
32173  */
32174 void UnsignedNodeAnnouncement_set_alias(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeAlias val);
32175
32176 /**
32177  * List of addresses on which this node is reachable
32178  *
32179  * Returns a copy of the field.
32180  */
32181 struct LDKCVec_NetAddressZ UnsignedNodeAnnouncement_get_addresses(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
32182
32183 /**
32184  * List of addresses on which this node is reachable
32185  */
32186 void UnsignedNodeAnnouncement_set_addresses(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val);
32187
32188 /**
32189  * Creates a copy of the UnsignedNodeAnnouncement
32190  */
32191 struct LDKUnsignedNodeAnnouncement UnsignedNodeAnnouncement_clone(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR orig);
32192
32193 /**
32194  * Checks if two UnsignedNodeAnnouncements contain equal inner contents.
32195  * This ignores pointers and is_owned flags and looks at the values in fields.
32196  * Two objects with NULL inner values will be considered "equal" here.
32197  */
32198 bool UnsignedNodeAnnouncement_eq(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR a, const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR b);
32199
32200 /**
32201  * Frees any resources used by the NodeAnnouncement, if is_owned is set and inner is non-NULL.
32202  */
32203 void NodeAnnouncement_free(struct LDKNodeAnnouncement this_obj);
32204
32205 /**
32206  * The signature by the node key
32207  */
32208 struct LDKSignature NodeAnnouncement_get_signature(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
32209
32210 /**
32211  * The signature by the node key
32212  */
32213 void NodeAnnouncement_set_signature(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
32214
32215 /**
32216  * The actual content of the announcement
32217  */
32218 struct LDKUnsignedNodeAnnouncement NodeAnnouncement_get_contents(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
32219
32220 /**
32221  * The actual content of the announcement
32222  */
32223 void NodeAnnouncement_set_contents(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedNodeAnnouncement val);
32224
32225 /**
32226  * Constructs a new NodeAnnouncement given each field
32227  */
32228 MUST_USE_RES struct LDKNodeAnnouncement NodeAnnouncement_new(struct LDKSignature signature_arg, struct LDKUnsignedNodeAnnouncement contents_arg);
32229
32230 /**
32231  * Creates a copy of the NodeAnnouncement
32232  */
32233 struct LDKNodeAnnouncement NodeAnnouncement_clone(const struct LDKNodeAnnouncement *NONNULL_PTR orig);
32234
32235 /**
32236  * Checks if two NodeAnnouncements contain equal inner contents.
32237  * This ignores pointers and is_owned flags and looks at the values in fields.
32238  * Two objects with NULL inner values will be considered "equal" here.
32239  */
32240 bool NodeAnnouncement_eq(const struct LDKNodeAnnouncement *NONNULL_PTR a, const struct LDKNodeAnnouncement *NONNULL_PTR b);
32241
32242 /**
32243  * Frees any resources used by the UnsignedChannelAnnouncement, if is_owned is set and inner is non-NULL.
32244  */
32245 void UnsignedChannelAnnouncement_free(struct LDKUnsignedChannelAnnouncement this_obj);
32246
32247 /**
32248  * The advertised channel features
32249  */
32250 struct LDKChannelFeatures UnsignedChannelAnnouncement_get_features(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
32251
32252 /**
32253  * The advertised channel features
32254  */
32255 void UnsignedChannelAnnouncement_set_features(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
32256
32257 /**
32258  * The genesis hash of the blockchain where the channel is to be opened
32259  */
32260 const uint8_t (*UnsignedChannelAnnouncement_get_chain_hash(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr))[32];
32261
32262 /**
32263  * The genesis hash of the blockchain where the channel is to be opened
32264  */
32265 void UnsignedChannelAnnouncement_set_chain_hash(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
32266
32267 /**
32268  * The short channel ID
32269  */
32270 uint64_t UnsignedChannelAnnouncement_get_short_channel_id(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
32271
32272 /**
32273  * The short channel ID
32274  */
32275 void UnsignedChannelAnnouncement_set_short_channel_id(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, uint64_t val);
32276
32277 /**
32278  * One of the two `node_id`s which are endpoints of this channel
32279  */
32280 struct LDKNodeId UnsignedChannelAnnouncement_get_node_id_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
32281
32282 /**
32283  * One of the two `node_id`s which are endpoints of this channel
32284  */
32285 void UnsignedChannelAnnouncement_set_node_id_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeId val);
32286
32287 /**
32288  * The other of the two `node_id`s which are endpoints of this channel
32289  */
32290 struct LDKNodeId UnsignedChannelAnnouncement_get_node_id_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
32291
32292 /**
32293  * The other of the two `node_id`s which are endpoints of this channel
32294  */
32295 void UnsignedChannelAnnouncement_set_node_id_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeId val);
32296
32297 /**
32298  * The funding key for the first node
32299  */
32300 struct LDKNodeId UnsignedChannelAnnouncement_get_bitcoin_key_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
32301
32302 /**
32303  * The funding key for the first node
32304  */
32305 void UnsignedChannelAnnouncement_set_bitcoin_key_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeId val);
32306
32307 /**
32308  * The funding key for the second node
32309  */
32310 struct LDKNodeId UnsignedChannelAnnouncement_get_bitcoin_key_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
32311
32312 /**
32313  * The funding key for the second node
32314  */
32315 void UnsignedChannelAnnouncement_set_bitcoin_key_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeId val);
32316
32317 /**
32318  * Creates a copy of the UnsignedChannelAnnouncement
32319  */
32320 struct LDKUnsignedChannelAnnouncement UnsignedChannelAnnouncement_clone(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR orig);
32321
32322 /**
32323  * Checks if two UnsignedChannelAnnouncements contain equal inner contents.
32324  * This ignores pointers and is_owned flags and looks at the values in fields.
32325  * Two objects with NULL inner values will be considered "equal" here.
32326  */
32327 bool UnsignedChannelAnnouncement_eq(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR a, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR b);
32328
32329 /**
32330  * Frees any resources used by the ChannelAnnouncement, if is_owned is set and inner is non-NULL.
32331  */
32332 void ChannelAnnouncement_free(struct LDKChannelAnnouncement this_obj);
32333
32334 /**
32335  * Authentication of the announcement by the first public node
32336  */
32337 struct LDKSignature ChannelAnnouncement_get_node_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
32338
32339 /**
32340  * Authentication of the announcement by the first public node
32341  */
32342 void ChannelAnnouncement_set_node_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
32343
32344 /**
32345  * Authentication of the announcement by the second public node
32346  */
32347 struct LDKSignature ChannelAnnouncement_get_node_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
32348
32349 /**
32350  * Authentication of the announcement by the second public node
32351  */
32352 void ChannelAnnouncement_set_node_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
32353
32354 /**
32355  * Proof of funding UTXO ownership by the first public node
32356  */
32357 struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
32358
32359 /**
32360  * Proof of funding UTXO ownership by the first public node
32361  */
32362 void ChannelAnnouncement_set_bitcoin_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
32363
32364 /**
32365  * Proof of funding UTXO ownership by the second public node
32366  */
32367 struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
32368
32369 /**
32370  * Proof of funding UTXO ownership by the second public node
32371  */
32372 void ChannelAnnouncement_set_bitcoin_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
32373
32374 /**
32375  * The actual announcement
32376  */
32377 struct LDKUnsignedChannelAnnouncement ChannelAnnouncement_get_contents(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
32378
32379 /**
32380  * The actual announcement
32381  */
32382 void ChannelAnnouncement_set_contents(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedChannelAnnouncement val);
32383
32384 /**
32385  * Constructs a new ChannelAnnouncement given each field
32386  */
32387 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);
32388
32389 /**
32390  * Creates a copy of the ChannelAnnouncement
32391  */
32392 struct LDKChannelAnnouncement ChannelAnnouncement_clone(const struct LDKChannelAnnouncement *NONNULL_PTR orig);
32393
32394 /**
32395  * Checks if two ChannelAnnouncements contain equal inner contents.
32396  * This ignores pointers and is_owned flags and looks at the values in fields.
32397  * Two objects with NULL inner values will be considered "equal" here.
32398  */
32399 bool ChannelAnnouncement_eq(const struct LDKChannelAnnouncement *NONNULL_PTR a, const struct LDKChannelAnnouncement *NONNULL_PTR b);
32400
32401 /**
32402  * Frees any resources used by the UnsignedChannelUpdate, if is_owned is set and inner is non-NULL.
32403  */
32404 void UnsignedChannelUpdate_free(struct LDKUnsignedChannelUpdate this_obj);
32405
32406 /**
32407  * The genesis hash of the blockchain where the channel is to be opened
32408  */
32409 const uint8_t (*UnsignedChannelUpdate_get_chain_hash(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr))[32];
32410
32411 /**
32412  * The genesis hash of the blockchain where the channel is to be opened
32413  */
32414 void UnsignedChannelUpdate_set_chain_hash(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
32415
32416 /**
32417  * The short channel ID
32418  */
32419 uint64_t UnsignedChannelUpdate_get_short_channel_id(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
32420
32421 /**
32422  * The short channel ID
32423  */
32424 void UnsignedChannelUpdate_set_short_channel_id(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
32425
32426 /**
32427  * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
32428  */
32429 uint32_t UnsignedChannelUpdate_get_timestamp(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
32430
32431 /**
32432  * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
32433  */
32434 void UnsignedChannelUpdate_set_timestamp(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
32435
32436 /**
32437  * Channel flags
32438  */
32439 uint8_t UnsignedChannelUpdate_get_flags(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
32440
32441 /**
32442  * Channel flags
32443  */
32444 void UnsignedChannelUpdate_set_flags(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint8_t val);
32445
32446 /**
32447  * The number of blocks such that if:
32448  * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
32449  * then we need to fail the HTLC backwards. When forwarding an HTLC, `cltv_expiry_delta` determines
32450  * the outgoing HTLC's minimum `cltv_expiry` value -- so, if an incoming HTLC comes in with a
32451  * `cltv_expiry` of 100000, and the node we're forwarding to has a `cltv_expiry_delta` value of 10,
32452  * then we'll check that the outgoing HTLC's `cltv_expiry` value is at least 100010 before
32453  * forwarding. Note that the HTLC sender is the one who originally sets this value when
32454  * constructing the route.
32455  */
32456 uint16_t UnsignedChannelUpdate_get_cltv_expiry_delta(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
32457
32458 /**
32459  * The number of blocks such that if:
32460  * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
32461  * then we need to fail the HTLC backwards. When forwarding an HTLC, `cltv_expiry_delta` determines
32462  * the outgoing HTLC's minimum `cltv_expiry` value -- so, if an incoming HTLC comes in with a
32463  * `cltv_expiry` of 100000, and the node we're forwarding to has a `cltv_expiry_delta` value of 10,
32464  * then we'll check that the outgoing HTLC's `cltv_expiry` value is at least 100010 before
32465  * forwarding. Note that the HTLC sender is the one who originally sets this value when
32466  * constructing the route.
32467  */
32468 void UnsignedChannelUpdate_set_cltv_expiry_delta(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint16_t val);
32469
32470 /**
32471  * The minimum HTLC size incoming to sender, in milli-satoshi
32472  */
32473 uint64_t UnsignedChannelUpdate_get_htlc_minimum_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
32474
32475 /**
32476  * The minimum HTLC size incoming to sender, in milli-satoshi
32477  */
32478 void UnsignedChannelUpdate_set_htlc_minimum_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
32479
32480 /**
32481  * The maximum HTLC value incoming to sender, in milli-satoshi.
32482  *
32483  * This used to be optional.
32484  */
32485 uint64_t UnsignedChannelUpdate_get_htlc_maximum_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
32486
32487 /**
32488  * The maximum HTLC value incoming to sender, in milli-satoshi.
32489  *
32490  * This used to be optional.
32491  */
32492 void UnsignedChannelUpdate_set_htlc_maximum_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
32493
32494 /**
32495  * The base HTLC fee charged by sender, in milli-satoshi
32496  */
32497 uint32_t UnsignedChannelUpdate_get_fee_base_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
32498
32499 /**
32500  * The base HTLC fee charged by sender, in milli-satoshi
32501  */
32502 void UnsignedChannelUpdate_set_fee_base_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
32503
32504 /**
32505  * The amount to fee multiplier, in micro-satoshi
32506  */
32507 uint32_t UnsignedChannelUpdate_get_fee_proportional_millionths(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
32508
32509 /**
32510  * The amount to fee multiplier, in micro-satoshi
32511  */
32512 void UnsignedChannelUpdate_set_fee_proportional_millionths(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
32513
32514 /**
32515  * Excess data which was signed as a part of the message which we do not (yet) understand how
32516  * to decode.
32517  *
32518  * This is stored to ensure forward-compatibility as new fields are added to the lightning gossip protocol.
32519  *
32520  * Returns a copy of the field.
32521  */
32522 struct LDKCVec_u8Z UnsignedChannelUpdate_get_excess_data(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
32523
32524 /**
32525  * Excess data which was signed as a part of the message which we do not (yet) understand how
32526  * to decode.
32527  *
32528  * This is stored to ensure forward-compatibility as new fields are added to the lightning gossip protocol.
32529  */
32530 void UnsignedChannelUpdate_set_excess_data(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
32531
32532 /**
32533  * Constructs a new UnsignedChannelUpdate given each field
32534  */
32535 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);
32536
32537 /**
32538  * Creates a copy of the UnsignedChannelUpdate
32539  */
32540 struct LDKUnsignedChannelUpdate UnsignedChannelUpdate_clone(const struct LDKUnsignedChannelUpdate *NONNULL_PTR orig);
32541
32542 /**
32543  * Checks if two UnsignedChannelUpdates contain equal inner contents.
32544  * This ignores pointers and is_owned flags and looks at the values in fields.
32545  * Two objects with NULL inner values will be considered "equal" here.
32546  */
32547 bool UnsignedChannelUpdate_eq(const struct LDKUnsignedChannelUpdate *NONNULL_PTR a, const struct LDKUnsignedChannelUpdate *NONNULL_PTR b);
32548
32549 /**
32550  * Frees any resources used by the ChannelUpdate, if is_owned is set and inner is non-NULL.
32551  */
32552 void ChannelUpdate_free(struct LDKChannelUpdate this_obj);
32553
32554 /**
32555  * A signature of the channel update
32556  */
32557 struct LDKSignature ChannelUpdate_get_signature(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
32558
32559 /**
32560  * A signature of the channel update
32561  */
32562 void ChannelUpdate_set_signature(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKSignature val);
32563
32564 /**
32565  * The actual channel update
32566  */
32567 struct LDKUnsignedChannelUpdate ChannelUpdate_get_contents(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
32568
32569 /**
32570  * The actual channel update
32571  */
32572 void ChannelUpdate_set_contents(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKUnsignedChannelUpdate val);
32573
32574 /**
32575  * Constructs a new ChannelUpdate given each field
32576  */
32577 MUST_USE_RES struct LDKChannelUpdate ChannelUpdate_new(struct LDKSignature signature_arg, struct LDKUnsignedChannelUpdate contents_arg);
32578
32579 /**
32580  * Creates a copy of the ChannelUpdate
32581  */
32582 struct LDKChannelUpdate ChannelUpdate_clone(const struct LDKChannelUpdate *NONNULL_PTR orig);
32583
32584 /**
32585  * Checks if two ChannelUpdates contain equal inner contents.
32586  * This ignores pointers and is_owned flags and looks at the values in fields.
32587  * Two objects with NULL inner values will be considered "equal" here.
32588  */
32589 bool ChannelUpdate_eq(const struct LDKChannelUpdate *NONNULL_PTR a, const struct LDKChannelUpdate *NONNULL_PTR b);
32590
32591 /**
32592  * Frees any resources used by the QueryChannelRange, if is_owned is set and inner is non-NULL.
32593  */
32594 void QueryChannelRange_free(struct LDKQueryChannelRange this_obj);
32595
32596 /**
32597  * The genesis hash of the blockchain being queried
32598  */
32599 const uint8_t (*QueryChannelRange_get_chain_hash(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr))[32];
32600
32601 /**
32602  * The genesis hash of the blockchain being queried
32603  */
32604 void QueryChannelRange_set_chain_hash(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
32605
32606 /**
32607  * The height of the first block for the channel UTXOs being queried
32608  */
32609 uint32_t QueryChannelRange_get_first_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
32610
32611 /**
32612  * The height of the first block for the channel UTXOs being queried
32613  */
32614 void QueryChannelRange_set_first_blocknum(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
32615
32616 /**
32617  * The number of blocks to include in the query results
32618  */
32619 uint32_t QueryChannelRange_get_number_of_blocks(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
32620
32621 /**
32622  * The number of blocks to include in the query results
32623  */
32624 void QueryChannelRange_set_number_of_blocks(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
32625
32626 /**
32627  * Constructs a new QueryChannelRange given each field
32628  */
32629 MUST_USE_RES struct LDKQueryChannelRange QueryChannelRange_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_blocknum_arg, uint32_t number_of_blocks_arg);
32630
32631 /**
32632  * Creates a copy of the QueryChannelRange
32633  */
32634 struct LDKQueryChannelRange QueryChannelRange_clone(const struct LDKQueryChannelRange *NONNULL_PTR orig);
32635
32636 /**
32637  * Checks if two QueryChannelRanges contain equal inner contents.
32638  * This ignores pointers and is_owned flags and looks at the values in fields.
32639  * Two objects with NULL inner values will be considered "equal" here.
32640  */
32641 bool QueryChannelRange_eq(const struct LDKQueryChannelRange *NONNULL_PTR a, const struct LDKQueryChannelRange *NONNULL_PTR b);
32642
32643 /**
32644  * Frees any resources used by the ReplyChannelRange, if is_owned is set and inner is non-NULL.
32645  */
32646 void ReplyChannelRange_free(struct LDKReplyChannelRange this_obj);
32647
32648 /**
32649  * The genesis hash of the blockchain being queried
32650  */
32651 const uint8_t (*ReplyChannelRange_get_chain_hash(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr))[32];
32652
32653 /**
32654  * The genesis hash of the blockchain being queried
32655  */
32656 void ReplyChannelRange_set_chain_hash(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
32657
32658 /**
32659  * The height of the first block in the range of the reply
32660  */
32661 uint32_t ReplyChannelRange_get_first_blocknum(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
32662
32663 /**
32664  * The height of the first block in the range of the reply
32665  */
32666 void ReplyChannelRange_set_first_blocknum(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
32667
32668 /**
32669  * The number of blocks included in the range of the reply
32670  */
32671 uint32_t ReplyChannelRange_get_number_of_blocks(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
32672
32673 /**
32674  * The number of blocks included in the range of the reply
32675  */
32676 void ReplyChannelRange_set_number_of_blocks(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
32677
32678 /**
32679  * True when this is the final reply for a query
32680  */
32681 bool ReplyChannelRange_get_sync_complete(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
32682
32683 /**
32684  * True when this is the final reply for a query
32685  */
32686 void ReplyChannelRange_set_sync_complete(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, bool val);
32687
32688 /**
32689  * The `short_channel_id`s in the channel range
32690  *
32691  * Returns a copy of the field.
32692  */
32693 struct LDKCVec_u64Z ReplyChannelRange_get_short_channel_ids(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
32694
32695 /**
32696  * The `short_channel_id`s in the channel range
32697  */
32698 void ReplyChannelRange_set_short_channel_ids(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
32699
32700 /**
32701  * Constructs a new ReplyChannelRange given each field
32702  */
32703 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);
32704
32705 /**
32706  * Creates a copy of the ReplyChannelRange
32707  */
32708 struct LDKReplyChannelRange ReplyChannelRange_clone(const struct LDKReplyChannelRange *NONNULL_PTR orig);
32709
32710 /**
32711  * Checks if two ReplyChannelRanges contain equal inner contents.
32712  * This ignores pointers and is_owned flags and looks at the values in fields.
32713  * Two objects with NULL inner values will be considered "equal" here.
32714  */
32715 bool ReplyChannelRange_eq(const struct LDKReplyChannelRange *NONNULL_PTR a, const struct LDKReplyChannelRange *NONNULL_PTR b);
32716
32717 /**
32718  * Frees any resources used by the QueryShortChannelIds, if is_owned is set and inner is non-NULL.
32719  */
32720 void QueryShortChannelIds_free(struct LDKQueryShortChannelIds this_obj);
32721
32722 /**
32723  * The genesis hash of the blockchain being queried
32724  */
32725 const uint8_t (*QueryShortChannelIds_get_chain_hash(const struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr))[32];
32726
32727 /**
32728  * The genesis hash of the blockchain being queried
32729  */
32730 void QueryShortChannelIds_set_chain_hash(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
32731
32732 /**
32733  * The short_channel_ids that are being queried
32734  *
32735  * Returns a copy of the field.
32736  */
32737 struct LDKCVec_u64Z QueryShortChannelIds_get_short_channel_ids(const struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr);
32738
32739 /**
32740  * The short_channel_ids that are being queried
32741  */
32742 void QueryShortChannelIds_set_short_channel_ids(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
32743
32744 /**
32745  * Constructs a new QueryShortChannelIds given each field
32746  */
32747 MUST_USE_RES struct LDKQueryShortChannelIds QueryShortChannelIds_new(struct LDKThirtyTwoBytes chain_hash_arg, struct LDKCVec_u64Z short_channel_ids_arg);
32748
32749 /**
32750  * Creates a copy of the QueryShortChannelIds
32751  */
32752 struct LDKQueryShortChannelIds QueryShortChannelIds_clone(const struct LDKQueryShortChannelIds *NONNULL_PTR orig);
32753
32754 /**
32755  * Checks if two QueryShortChannelIdss contain equal inner contents.
32756  * This ignores pointers and is_owned flags and looks at the values in fields.
32757  * Two objects with NULL inner values will be considered "equal" here.
32758  */
32759 bool QueryShortChannelIds_eq(const struct LDKQueryShortChannelIds *NONNULL_PTR a, const struct LDKQueryShortChannelIds *NONNULL_PTR b);
32760
32761 /**
32762  * Frees any resources used by the ReplyShortChannelIdsEnd, if is_owned is set and inner is non-NULL.
32763  */
32764 void ReplyShortChannelIdsEnd_free(struct LDKReplyShortChannelIdsEnd this_obj);
32765
32766 /**
32767  * The genesis hash of the blockchain that was queried
32768  */
32769 const uint8_t (*ReplyShortChannelIdsEnd_get_chain_hash(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr))[32];
32770
32771 /**
32772  * The genesis hash of the blockchain that was queried
32773  */
32774 void ReplyShortChannelIdsEnd_set_chain_hash(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
32775
32776 /**
32777  * Indicates if the query recipient maintains up-to-date channel
32778  * information for the `chain_hash`
32779  */
32780 bool ReplyShortChannelIdsEnd_get_full_information(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr);
32781
32782 /**
32783  * Indicates if the query recipient maintains up-to-date channel
32784  * information for the `chain_hash`
32785  */
32786 void ReplyShortChannelIdsEnd_set_full_information(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, bool val);
32787
32788 /**
32789  * Constructs a new ReplyShortChannelIdsEnd given each field
32790  */
32791 MUST_USE_RES struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_new(struct LDKThirtyTwoBytes chain_hash_arg, bool full_information_arg);
32792
32793 /**
32794  * Creates a copy of the ReplyShortChannelIdsEnd
32795  */
32796 struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_clone(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR orig);
32797
32798 /**
32799  * Checks if two ReplyShortChannelIdsEnds contain equal inner contents.
32800  * This ignores pointers and is_owned flags and looks at the values in fields.
32801  * Two objects with NULL inner values will be considered "equal" here.
32802  */
32803 bool ReplyShortChannelIdsEnd_eq(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR a, const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR b);
32804
32805 /**
32806  * Frees any resources used by the GossipTimestampFilter, if is_owned is set and inner is non-NULL.
32807  */
32808 void GossipTimestampFilter_free(struct LDKGossipTimestampFilter this_obj);
32809
32810 /**
32811  * The genesis hash of the blockchain for channel and node information
32812  */
32813 const uint8_t (*GossipTimestampFilter_get_chain_hash(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr))[32];
32814
32815 /**
32816  * The genesis hash of the blockchain for channel and node information
32817  */
32818 void GossipTimestampFilter_set_chain_hash(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
32819
32820 /**
32821  * The starting unix timestamp
32822  */
32823 uint32_t GossipTimestampFilter_get_first_timestamp(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
32824
32825 /**
32826  * The starting unix timestamp
32827  */
32828 void GossipTimestampFilter_set_first_timestamp(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
32829
32830 /**
32831  * The range of information in seconds
32832  */
32833 uint32_t GossipTimestampFilter_get_timestamp_range(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
32834
32835 /**
32836  * The range of information in seconds
32837  */
32838 void GossipTimestampFilter_set_timestamp_range(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
32839
32840 /**
32841  * Constructs a new GossipTimestampFilter given each field
32842  */
32843 MUST_USE_RES struct LDKGossipTimestampFilter GossipTimestampFilter_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_timestamp_arg, uint32_t timestamp_range_arg);
32844
32845 /**
32846  * Creates a copy of the GossipTimestampFilter
32847  */
32848 struct LDKGossipTimestampFilter GossipTimestampFilter_clone(const struct LDKGossipTimestampFilter *NONNULL_PTR orig);
32849
32850 /**
32851  * Checks if two GossipTimestampFilters contain equal inner contents.
32852  * This ignores pointers and is_owned flags and looks at the values in fields.
32853  * Two objects with NULL inner values will be considered "equal" here.
32854  */
32855 bool GossipTimestampFilter_eq(const struct LDKGossipTimestampFilter *NONNULL_PTR a, const struct LDKGossipTimestampFilter *NONNULL_PTR b);
32856
32857 /**
32858  * Frees any resources used by the ErrorAction
32859  */
32860 void ErrorAction_free(struct LDKErrorAction this_ptr);
32861
32862 /**
32863  * Creates a copy of the ErrorAction
32864  */
32865 struct LDKErrorAction ErrorAction_clone(const struct LDKErrorAction *NONNULL_PTR orig);
32866
32867 /**
32868  * Utility method to constructs a new DisconnectPeer-variant ErrorAction
32869  */
32870 struct LDKErrorAction ErrorAction_disconnect_peer(struct LDKErrorMessage msg);
32871
32872 /**
32873  * Utility method to constructs a new DisconnectPeerWithWarning-variant ErrorAction
32874  */
32875 struct LDKErrorAction ErrorAction_disconnect_peer_with_warning(struct LDKWarningMessage msg);
32876
32877 /**
32878  * Utility method to constructs a new IgnoreError-variant ErrorAction
32879  */
32880 struct LDKErrorAction ErrorAction_ignore_error(void);
32881
32882 /**
32883  * Utility method to constructs a new IgnoreAndLog-variant ErrorAction
32884  */
32885 struct LDKErrorAction ErrorAction_ignore_and_log(enum LDKLevel a);
32886
32887 /**
32888  * Utility method to constructs a new IgnoreDuplicateGossip-variant ErrorAction
32889  */
32890 struct LDKErrorAction ErrorAction_ignore_duplicate_gossip(void);
32891
32892 /**
32893  * Utility method to constructs a new SendErrorMessage-variant ErrorAction
32894  */
32895 struct LDKErrorAction ErrorAction_send_error_message(struct LDKErrorMessage msg);
32896
32897 /**
32898  * Utility method to constructs a new SendWarningMessage-variant ErrorAction
32899  */
32900 struct LDKErrorAction ErrorAction_send_warning_message(struct LDKWarningMessage msg, enum LDKLevel log_level);
32901
32902 /**
32903  * Frees any resources used by the LightningError, if is_owned is set and inner is non-NULL.
32904  */
32905 void LightningError_free(struct LDKLightningError this_obj);
32906
32907 /**
32908  * A human-readable message describing the error
32909  */
32910 struct LDKStr LightningError_get_err(const struct LDKLightningError *NONNULL_PTR this_ptr);
32911
32912 /**
32913  * A human-readable message describing the error
32914  */
32915 void LightningError_set_err(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKStr val);
32916
32917 /**
32918  * The action which should be taken against the offending peer.
32919  */
32920 struct LDKErrorAction LightningError_get_action(const struct LDKLightningError *NONNULL_PTR this_ptr);
32921
32922 /**
32923  * The action which should be taken against the offending peer.
32924  */
32925 void LightningError_set_action(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKErrorAction val);
32926
32927 /**
32928  * Constructs a new LightningError given each field
32929  */
32930 MUST_USE_RES struct LDKLightningError LightningError_new(struct LDKStr err_arg, struct LDKErrorAction action_arg);
32931
32932 /**
32933  * Creates a copy of the LightningError
32934  */
32935 struct LDKLightningError LightningError_clone(const struct LDKLightningError *NONNULL_PTR orig);
32936
32937 /**
32938  * Frees any resources used by the CommitmentUpdate, if is_owned is set and inner is non-NULL.
32939  */
32940 void CommitmentUpdate_free(struct LDKCommitmentUpdate this_obj);
32941
32942 /**
32943  * `update_add_htlc` messages which should be sent
32944  */
32945 struct LDKCVec_UpdateAddHTLCZ CommitmentUpdate_get_update_add_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
32946
32947 /**
32948  * `update_add_htlc` messages which should be sent
32949  */
32950 void CommitmentUpdate_set_update_add_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateAddHTLCZ val);
32951
32952 /**
32953  * `update_fulfill_htlc` messages which should be sent
32954  */
32955 struct LDKCVec_UpdateFulfillHTLCZ CommitmentUpdate_get_update_fulfill_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
32956
32957 /**
32958  * `update_fulfill_htlc` messages which should be sent
32959  */
32960 void CommitmentUpdate_set_update_fulfill_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFulfillHTLCZ val);
32961
32962 /**
32963  * `update_fail_htlc` messages which should be sent
32964  */
32965 struct LDKCVec_UpdateFailHTLCZ CommitmentUpdate_get_update_fail_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
32966
32967 /**
32968  * `update_fail_htlc` messages which should be sent
32969  */
32970 void CommitmentUpdate_set_update_fail_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailHTLCZ val);
32971
32972 /**
32973  * `update_fail_malformed_htlc` messages which should be sent
32974  */
32975 struct LDKCVec_UpdateFailMalformedHTLCZ CommitmentUpdate_get_update_fail_malformed_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
32976
32977 /**
32978  * `update_fail_malformed_htlc` messages which should be sent
32979  */
32980 void CommitmentUpdate_set_update_fail_malformed_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailMalformedHTLCZ val);
32981
32982 /**
32983  * An `update_fee` message which should be sent
32984  *
32985  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
32986  */
32987 struct LDKUpdateFee CommitmentUpdate_get_update_fee(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
32988
32989 /**
32990  * An `update_fee` message which should be sent
32991  *
32992  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
32993  */
32994 void CommitmentUpdate_set_update_fee(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKUpdateFee val);
32995
32996 /**
32997  * A `commitment_signed` message which should be sent
32998  */
32999 struct LDKCommitmentSigned CommitmentUpdate_get_commitment_signed(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
33000
33001 /**
33002  * A `commitment_signed` message which should be sent
33003  */
33004 void CommitmentUpdate_set_commitment_signed(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCommitmentSigned val);
33005
33006 /**
33007  * Constructs a new CommitmentUpdate given each field
33008  */
33009 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);
33010
33011 /**
33012  * Creates a copy of the CommitmentUpdate
33013  */
33014 struct LDKCommitmentUpdate CommitmentUpdate_clone(const struct LDKCommitmentUpdate *NONNULL_PTR orig);
33015
33016 /**
33017  * Checks if two CommitmentUpdates contain equal inner contents.
33018  * This ignores pointers and is_owned flags and looks at the values in fields.
33019  * Two objects with NULL inner values will be considered "equal" here.
33020  */
33021 bool CommitmentUpdate_eq(const struct LDKCommitmentUpdate *NONNULL_PTR a, const struct LDKCommitmentUpdate *NONNULL_PTR b);
33022
33023 /**
33024  * Calls the free function if one is set
33025  */
33026 void ChannelMessageHandler_free(struct LDKChannelMessageHandler this_ptr);
33027
33028 /**
33029  * Calls the free function if one is set
33030  */
33031 void RoutingMessageHandler_free(struct LDKRoutingMessageHandler this_ptr);
33032
33033 /**
33034  * Calls the free function if one is set
33035  */
33036 void OnionMessageHandler_free(struct LDKOnionMessageHandler this_ptr);
33037
33038 /**
33039  * Serialize the AcceptChannel object into a byte array which can be read by AcceptChannel_read
33040  */
33041 struct LDKCVec_u8Z AcceptChannel_write(const struct LDKAcceptChannel *NONNULL_PTR obj);
33042
33043 /**
33044  * Read a AcceptChannel from a byte array, created by AcceptChannel_write
33045  */
33046 struct LDKCResult_AcceptChannelDecodeErrorZ AcceptChannel_read(struct LDKu8slice ser);
33047
33048 /**
33049  * Serialize the AcceptChannelV2 object into a byte array which can be read by AcceptChannelV2_read
33050  */
33051 struct LDKCVec_u8Z AcceptChannelV2_write(const struct LDKAcceptChannelV2 *NONNULL_PTR obj);
33052
33053 /**
33054  * Read a AcceptChannelV2 from a byte array, created by AcceptChannelV2_write
33055  */
33056 struct LDKCResult_AcceptChannelV2DecodeErrorZ AcceptChannelV2_read(struct LDKu8slice ser);
33057
33058 /**
33059  * Serialize the TxAddInput object into a byte array which can be read by TxAddInput_read
33060  */
33061 struct LDKCVec_u8Z TxAddInput_write(const struct LDKTxAddInput *NONNULL_PTR obj);
33062
33063 /**
33064  * Read a TxAddInput from a byte array, created by TxAddInput_write
33065  */
33066 struct LDKCResult_TxAddInputDecodeErrorZ TxAddInput_read(struct LDKu8slice ser);
33067
33068 /**
33069  * Serialize the TxAddOutput object into a byte array which can be read by TxAddOutput_read
33070  */
33071 struct LDKCVec_u8Z TxAddOutput_write(const struct LDKTxAddOutput *NONNULL_PTR obj);
33072
33073 /**
33074  * Read a TxAddOutput from a byte array, created by TxAddOutput_write
33075  */
33076 struct LDKCResult_TxAddOutputDecodeErrorZ TxAddOutput_read(struct LDKu8slice ser);
33077
33078 /**
33079  * Serialize the TxRemoveInput object into a byte array which can be read by TxRemoveInput_read
33080  */
33081 struct LDKCVec_u8Z TxRemoveInput_write(const struct LDKTxRemoveInput *NONNULL_PTR obj);
33082
33083 /**
33084  * Read a TxRemoveInput from a byte array, created by TxRemoveInput_write
33085  */
33086 struct LDKCResult_TxRemoveInputDecodeErrorZ TxRemoveInput_read(struct LDKu8slice ser);
33087
33088 /**
33089  * Serialize the TxRemoveOutput object into a byte array which can be read by TxRemoveOutput_read
33090  */
33091 struct LDKCVec_u8Z TxRemoveOutput_write(const struct LDKTxRemoveOutput *NONNULL_PTR obj);
33092
33093 /**
33094  * Read a TxRemoveOutput from a byte array, created by TxRemoveOutput_write
33095  */
33096 struct LDKCResult_TxRemoveOutputDecodeErrorZ TxRemoveOutput_read(struct LDKu8slice ser);
33097
33098 /**
33099  * Serialize the TxComplete object into a byte array which can be read by TxComplete_read
33100  */
33101 struct LDKCVec_u8Z TxComplete_write(const struct LDKTxComplete *NONNULL_PTR obj);
33102
33103 /**
33104  * Read a TxComplete from a byte array, created by TxComplete_write
33105  */
33106 struct LDKCResult_TxCompleteDecodeErrorZ TxComplete_read(struct LDKu8slice ser);
33107
33108 /**
33109  * Serialize the TxSignatures object into a byte array which can be read by TxSignatures_read
33110  */
33111 struct LDKCVec_u8Z TxSignatures_write(const struct LDKTxSignatures *NONNULL_PTR obj);
33112
33113 /**
33114  * Read a TxSignatures from a byte array, created by TxSignatures_write
33115  */
33116 struct LDKCResult_TxSignaturesDecodeErrorZ TxSignatures_read(struct LDKu8slice ser);
33117
33118 /**
33119  * Serialize the TxInitRbf object into a byte array which can be read by TxInitRbf_read
33120  */
33121 struct LDKCVec_u8Z TxInitRbf_write(const struct LDKTxInitRbf *NONNULL_PTR obj);
33122
33123 /**
33124  * Read a TxInitRbf from a byte array, created by TxInitRbf_write
33125  */
33126 struct LDKCResult_TxInitRbfDecodeErrorZ TxInitRbf_read(struct LDKu8slice ser);
33127
33128 /**
33129  * Serialize the TxAckRbf object into a byte array which can be read by TxAckRbf_read
33130  */
33131 struct LDKCVec_u8Z TxAckRbf_write(const struct LDKTxAckRbf *NONNULL_PTR obj);
33132
33133 /**
33134  * Read a TxAckRbf from a byte array, created by TxAckRbf_write
33135  */
33136 struct LDKCResult_TxAckRbfDecodeErrorZ TxAckRbf_read(struct LDKu8slice ser);
33137
33138 /**
33139  * Serialize the TxAbort object into a byte array which can be read by TxAbort_read
33140  */
33141 struct LDKCVec_u8Z TxAbort_write(const struct LDKTxAbort *NONNULL_PTR obj);
33142
33143 /**
33144  * Read a TxAbort from a byte array, created by TxAbort_write
33145  */
33146 struct LDKCResult_TxAbortDecodeErrorZ TxAbort_read(struct LDKu8slice ser);
33147
33148 /**
33149  * Serialize the AnnouncementSignatures object into a byte array which can be read by AnnouncementSignatures_read
33150  */
33151 struct LDKCVec_u8Z AnnouncementSignatures_write(const struct LDKAnnouncementSignatures *NONNULL_PTR obj);
33152
33153 /**
33154  * Read a AnnouncementSignatures from a byte array, created by AnnouncementSignatures_write
33155  */
33156 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ AnnouncementSignatures_read(struct LDKu8slice ser);
33157
33158 /**
33159  * Serialize the ChannelReestablish object into a byte array which can be read by ChannelReestablish_read
33160  */
33161 struct LDKCVec_u8Z ChannelReestablish_write(const struct LDKChannelReestablish *NONNULL_PTR obj);
33162
33163 /**
33164  * Read a ChannelReestablish from a byte array, created by ChannelReestablish_write
33165  */
33166 struct LDKCResult_ChannelReestablishDecodeErrorZ ChannelReestablish_read(struct LDKu8slice ser);
33167
33168 /**
33169  * Serialize the ClosingSigned object into a byte array which can be read by ClosingSigned_read
33170  */
33171 struct LDKCVec_u8Z ClosingSigned_write(const struct LDKClosingSigned *NONNULL_PTR obj);
33172
33173 /**
33174  * Read a ClosingSigned from a byte array, created by ClosingSigned_write
33175  */
33176 struct LDKCResult_ClosingSignedDecodeErrorZ ClosingSigned_read(struct LDKu8slice ser);
33177
33178 /**
33179  * Serialize the ClosingSignedFeeRange object into a byte array which can be read by ClosingSignedFeeRange_read
33180  */
33181 struct LDKCVec_u8Z ClosingSignedFeeRange_write(const struct LDKClosingSignedFeeRange *NONNULL_PTR obj);
33182
33183 /**
33184  * Read a ClosingSignedFeeRange from a byte array, created by ClosingSignedFeeRange_write
33185  */
33186 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ ClosingSignedFeeRange_read(struct LDKu8slice ser);
33187
33188 /**
33189  * Serialize the CommitmentSigned object into a byte array which can be read by CommitmentSigned_read
33190  */
33191 struct LDKCVec_u8Z CommitmentSigned_write(const struct LDKCommitmentSigned *NONNULL_PTR obj);
33192
33193 /**
33194  * Read a CommitmentSigned from a byte array, created by CommitmentSigned_write
33195  */
33196 struct LDKCResult_CommitmentSignedDecodeErrorZ CommitmentSigned_read(struct LDKu8slice ser);
33197
33198 /**
33199  * Serialize the FundingCreated object into a byte array which can be read by FundingCreated_read
33200  */
33201 struct LDKCVec_u8Z FundingCreated_write(const struct LDKFundingCreated *NONNULL_PTR obj);
33202
33203 /**
33204  * Read a FundingCreated from a byte array, created by FundingCreated_write
33205  */
33206 struct LDKCResult_FundingCreatedDecodeErrorZ FundingCreated_read(struct LDKu8slice ser);
33207
33208 /**
33209  * Serialize the FundingSigned object into a byte array which can be read by FundingSigned_read
33210  */
33211 struct LDKCVec_u8Z FundingSigned_write(const struct LDKFundingSigned *NONNULL_PTR obj);
33212
33213 /**
33214  * Read a FundingSigned from a byte array, created by FundingSigned_write
33215  */
33216 struct LDKCResult_FundingSignedDecodeErrorZ FundingSigned_read(struct LDKu8slice ser);
33217
33218 /**
33219  * Serialize the ChannelReady object into a byte array which can be read by ChannelReady_read
33220  */
33221 struct LDKCVec_u8Z ChannelReady_write(const struct LDKChannelReady *NONNULL_PTR obj);
33222
33223 /**
33224  * Read a ChannelReady from a byte array, created by ChannelReady_write
33225  */
33226 struct LDKCResult_ChannelReadyDecodeErrorZ ChannelReady_read(struct LDKu8slice ser);
33227
33228 /**
33229  * Serialize the Init object into a byte array which can be read by Init_read
33230  */
33231 struct LDKCVec_u8Z Init_write(const struct LDKInit *NONNULL_PTR obj);
33232
33233 /**
33234  * Read a Init from a byte array, created by Init_write
33235  */
33236 struct LDKCResult_InitDecodeErrorZ Init_read(struct LDKu8slice ser);
33237
33238 /**
33239  * Serialize the OpenChannel object into a byte array which can be read by OpenChannel_read
33240  */
33241 struct LDKCVec_u8Z OpenChannel_write(const struct LDKOpenChannel *NONNULL_PTR obj);
33242
33243 /**
33244  * Read a OpenChannel from a byte array, created by OpenChannel_write
33245  */
33246 struct LDKCResult_OpenChannelDecodeErrorZ OpenChannel_read(struct LDKu8slice ser);
33247
33248 /**
33249  * Serialize the OpenChannelV2 object into a byte array which can be read by OpenChannelV2_read
33250  */
33251 struct LDKCVec_u8Z OpenChannelV2_write(const struct LDKOpenChannelV2 *NONNULL_PTR obj);
33252
33253 /**
33254  * Read a OpenChannelV2 from a byte array, created by OpenChannelV2_write
33255  */
33256 struct LDKCResult_OpenChannelV2DecodeErrorZ OpenChannelV2_read(struct LDKu8slice ser);
33257
33258 /**
33259  * Serialize the RevokeAndACK object into a byte array which can be read by RevokeAndACK_read
33260  */
33261 struct LDKCVec_u8Z RevokeAndACK_write(const struct LDKRevokeAndACK *NONNULL_PTR obj);
33262
33263 /**
33264  * Read a RevokeAndACK from a byte array, created by RevokeAndACK_write
33265  */
33266 struct LDKCResult_RevokeAndACKDecodeErrorZ RevokeAndACK_read(struct LDKu8slice ser);
33267
33268 /**
33269  * Serialize the Shutdown object into a byte array which can be read by Shutdown_read
33270  */
33271 struct LDKCVec_u8Z Shutdown_write(const struct LDKShutdown *NONNULL_PTR obj);
33272
33273 /**
33274  * Read a Shutdown from a byte array, created by Shutdown_write
33275  */
33276 struct LDKCResult_ShutdownDecodeErrorZ Shutdown_read(struct LDKu8slice ser);
33277
33278 /**
33279  * Serialize the UpdateFailHTLC object into a byte array which can be read by UpdateFailHTLC_read
33280  */
33281 struct LDKCVec_u8Z UpdateFailHTLC_write(const struct LDKUpdateFailHTLC *NONNULL_PTR obj);
33282
33283 /**
33284  * Read a UpdateFailHTLC from a byte array, created by UpdateFailHTLC_write
33285  */
33286 struct LDKCResult_UpdateFailHTLCDecodeErrorZ UpdateFailHTLC_read(struct LDKu8slice ser);
33287
33288 /**
33289  * Serialize the UpdateFailMalformedHTLC object into a byte array which can be read by UpdateFailMalformedHTLC_read
33290  */
33291 struct LDKCVec_u8Z UpdateFailMalformedHTLC_write(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR obj);
33292
33293 /**
33294  * Read a UpdateFailMalformedHTLC from a byte array, created by UpdateFailMalformedHTLC_write
33295  */
33296 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ UpdateFailMalformedHTLC_read(struct LDKu8slice ser);
33297
33298 /**
33299  * Serialize the UpdateFee object into a byte array which can be read by UpdateFee_read
33300  */
33301 struct LDKCVec_u8Z UpdateFee_write(const struct LDKUpdateFee *NONNULL_PTR obj);
33302
33303 /**
33304  * Read a UpdateFee from a byte array, created by UpdateFee_write
33305  */
33306 struct LDKCResult_UpdateFeeDecodeErrorZ UpdateFee_read(struct LDKu8slice ser);
33307
33308 /**
33309  * Serialize the UpdateFulfillHTLC object into a byte array which can be read by UpdateFulfillHTLC_read
33310  */
33311 struct LDKCVec_u8Z UpdateFulfillHTLC_write(const struct LDKUpdateFulfillHTLC *NONNULL_PTR obj);
33312
33313 /**
33314  * Read a UpdateFulfillHTLC from a byte array, created by UpdateFulfillHTLC_write
33315  */
33316 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ UpdateFulfillHTLC_read(struct LDKu8slice ser);
33317
33318 /**
33319  * Serialize the UpdateAddHTLC object into a byte array which can be read by UpdateAddHTLC_read
33320  */
33321 struct LDKCVec_u8Z UpdateAddHTLC_write(const struct LDKUpdateAddHTLC *NONNULL_PTR obj);
33322
33323 /**
33324  * Read a UpdateAddHTLC from a byte array, created by UpdateAddHTLC_write
33325  */
33326 struct LDKCResult_UpdateAddHTLCDecodeErrorZ UpdateAddHTLC_read(struct LDKu8slice ser);
33327
33328 /**
33329  * Read a OnionMessage from a byte array, created by OnionMessage_write
33330  */
33331 struct LDKCResult_OnionMessageDecodeErrorZ OnionMessage_read(struct LDKu8slice ser);
33332
33333 /**
33334  * Serialize the OnionMessage object into a byte array which can be read by OnionMessage_read
33335  */
33336 struct LDKCVec_u8Z OnionMessage_write(const struct LDKOnionMessage *NONNULL_PTR obj);
33337
33338 /**
33339  * Serialize the Ping object into a byte array which can be read by Ping_read
33340  */
33341 struct LDKCVec_u8Z Ping_write(const struct LDKPing *NONNULL_PTR obj);
33342
33343 /**
33344  * Read a Ping from a byte array, created by Ping_write
33345  */
33346 struct LDKCResult_PingDecodeErrorZ Ping_read(struct LDKu8slice ser);
33347
33348 /**
33349  * Serialize the Pong object into a byte array which can be read by Pong_read
33350  */
33351 struct LDKCVec_u8Z Pong_write(const struct LDKPong *NONNULL_PTR obj);
33352
33353 /**
33354  * Read a Pong from a byte array, created by Pong_write
33355  */
33356 struct LDKCResult_PongDecodeErrorZ Pong_read(struct LDKu8slice ser);
33357
33358 /**
33359  * Serialize the UnsignedChannelAnnouncement object into a byte array which can be read by UnsignedChannelAnnouncement_read
33360  */
33361 struct LDKCVec_u8Z UnsignedChannelAnnouncement_write(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR obj);
33362
33363 /**
33364  * Read a UnsignedChannelAnnouncement from a byte array, created by UnsignedChannelAnnouncement_write
33365  */
33366 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ UnsignedChannelAnnouncement_read(struct LDKu8slice ser);
33367
33368 /**
33369  * Serialize the ChannelAnnouncement object into a byte array which can be read by ChannelAnnouncement_read
33370  */
33371 struct LDKCVec_u8Z ChannelAnnouncement_write(const struct LDKChannelAnnouncement *NONNULL_PTR obj);
33372
33373 /**
33374  * Read a ChannelAnnouncement from a byte array, created by ChannelAnnouncement_write
33375  */
33376 struct LDKCResult_ChannelAnnouncementDecodeErrorZ ChannelAnnouncement_read(struct LDKu8slice ser);
33377
33378 /**
33379  * Serialize the UnsignedChannelUpdate object into a byte array which can be read by UnsignedChannelUpdate_read
33380  */
33381 struct LDKCVec_u8Z UnsignedChannelUpdate_write(const struct LDKUnsignedChannelUpdate *NONNULL_PTR obj);
33382
33383 /**
33384  * Read a UnsignedChannelUpdate from a byte array, created by UnsignedChannelUpdate_write
33385  */
33386 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ UnsignedChannelUpdate_read(struct LDKu8slice ser);
33387
33388 /**
33389  * Serialize the ChannelUpdate object into a byte array which can be read by ChannelUpdate_read
33390  */
33391 struct LDKCVec_u8Z ChannelUpdate_write(const struct LDKChannelUpdate *NONNULL_PTR obj);
33392
33393 /**
33394  * Read a ChannelUpdate from a byte array, created by ChannelUpdate_write
33395  */
33396 struct LDKCResult_ChannelUpdateDecodeErrorZ ChannelUpdate_read(struct LDKu8slice ser);
33397
33398 /**
33399  * Serialize the ErrorMessage object into a byte array which can be read by ErrorMessage_read
33400  */
33401 struct LDKCVec_u8Z ErrorMessage_write(const struct LDKErrorMessage *NONNULL_PTR obj);
33402
33403 /**
33404  * Read a ErrorMessage from a byte array, created by ErrorMessage_write
33405  */
33406 struct LDKCResult_ErrorMessageDecodeErrorZ ErrorMessage_read(struct LDKu8slice ser);
33407
33408 /**
33409  * Serialize the WarningMessage object into a byte array which can be read by WarningMessage_read
33410  */
33411 struct LDKCVec_u8Z WarningMessage_write(const struct LDKWarningMessage *NONNULL_PTR obj);
33412
33413 /**
33414  * Read a WarningMessage from a byte array, created by WarningMessage_write
33415  */
33416 struct LDKCResult_WarningMessageDecodeErrorZ WarningMessage_read(struct LDKu8slice ser);
33417
33418 /**
33419  * Serialize the UnsignedNodeAnnouncement object into a byte array which can be read by UnsignedNodeAnnouncement_read
33420  */
33421 struct LDKCVec_u8Z UnsignedNodeAnnouncement_write(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR obj);
33422
33423 /**
33424  * Read a UnsignedNodeAnnouncement from a byte array, created by UnsignedNodeAnnouncement_write
33425  */
33426 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ UnsignedNodeAnnouncement_read(struct LDKu8slice ser);
33427
33428 /**
33429  * Serialize the NodeAnnouncement object into a byte array which can be read by NodeAnnouncement_read
33430  */
33431 struct LDKCVec_u8Z NodeAnnouncement_write(const struct LDKNodeAnnouncement *NONNULL_PTR obj);
33432
33433 /**
33434  * Read a NodeAnnouncement from a byte array, created by NodeAnnouncement_write
33435  */
33436 struct LDKCResult_NodeAnnouncementDecodeErrorZ NodeAnnouncement_read(struct LDKu8slice ser);
33437
33438 /**
33439  * Read a QueryShortChannelIds from a byte array, created by QueryShortChannelIds_write
33440  */
33441 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ QueryShortChannelIds_read(struct LDKu8slice ser);
33442
33443 /**
33444  * Serialize the QueryShortChannelIds object into a byte array which can be read by QueryShortChannelIds_read
33445  */
33446 struct LDKCVec_u8Z QueryShortChannelIds_write(const struct LDKQueryShortChannelIds *NONNULL_PTR obj);
33447
33448 /**
33449  * Serialize the ReplyShortChannelIdsEnd object into a byte array which can be read by ReplyShortChannelIdsEnd_read
33450  */
33451 struct LDKCVec_u8Z ReplyShortChannelIdsEnd_write(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR obj);
33452
33453 /**
33454  * Read a ReplyShortChannelIdsEnd from a byte array, created by ReplyShortChannelIdsEnd_write
33455  */
33456 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ ReplyShortChannelIdsEnd_read(struct LDKu8slice ser);
33457
33458 /**
33459  * Calculates the overflow safe ending block height for the query.
33460  *
33461  * Overflow returns `0xffffffff`, otherwise returns `first_blocknum + number_of_blocks`.
33462  */
33463 MUST_USE_RES uint32_t QueryChannelRange_end_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_arg);
33464
33465 /**
33466  * Serialize the QueryChannelRange object into a byte array which can be read by QueryChannelRange_read
33467  */
33468 struct LDKCVec_u8Z QueryChannelRange_write(const struct LDKQueryChannelRange *NONNULL_PTR obj);
33469
33470 /**
33471  * Read a QueryChannelRange from a byte array, created by QueryChannelRange_write
33472  */
33473 struct LDKCResult_QueryChannelRangeDecodeErrorZ QueryChannelRange_read(struct LDKu8slice ser);
33474
33475 /**
33476  * Read a ReplyChannelRange from a byte array, created by ReplyChannelRange_write
33477  */
33478 struct LDKCResult_ReplyChannelRangeDecodeErrorZ ReplyChannelRange_read(struct LDKu8slice ser);
33479
33480 /**
33481  * Serialize the ReplyChannelRange object into a byte array which can be read by ReplyChannelRange_read
33482  */
33483 struct LDKCVec_u8Z ReplyChannelRange_write(const struct LDKReplyChannelRange *NONNULL_PTR obj);
33484
33485 /**
33486  * Serialize the GossipTimestampFilter object into a byte array which can be read by GossipTimestampFilter_read
33487  */
33488 struct LDKCVec_u8Z GossipTimestampFilter_write(const struct LDKGossipTimestampFilter *NONNULL_PTR obj);
33489
33490 /**
33491  * Read a GossipTimestampFilter from a byte array, created by GossipTimestampFilter_write
33492  */
33493 struct LDKCResult_GossipTimestampFilterDecodeErrorZ GossipTimestampFilter_read(struct LDKu8slice ser);
33494
33495 /**
33496  * Calls the free function if one is set
33497  */
33498 void CustomMessageHandler_free(struct LDKCustomMessageHandler this_ptr);
33499
33500 /**
33501  * Frees any resources used by the IgnoringMessageHandler, if is_owned is set and inner is non-NULL.
33502  */
33503 void IgnoringMessageHandler_free(struct LDKIgnoringMessageHandler this_obj);
33504
33505 /**
33506  * Constructs a new IgnoringMessageHandler given each field
33507  */
33508 MUST_USE_RES struct LDKIgnoringMessageHandler IgnoringMessageHandler_new(void);
33509
33510 /**
33511  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
33512  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
33513  */
33514 struct LDKMessageSendEventsProvider IgnoringMessageHandler_as_MessageSendEventsProvider(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
33515
33516 /**
33517  * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg.
33518  * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is
33519  */
33520 struct LDKRoutingMessageHandler IgnoringMessageHandler_as_RoutingMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
33521
33522 /**
33523  * Constructs a new OnionMessageProvider which calls the relevant methods on this_arg.
33524  * This copies the `inner` pointer in this_arg and thus the returned OnionMessageProvider must be freed before this_arg is
33525  */
33526 struct LDKOnionMessageProvider IgnoringMessageHandler_as_OnionMessageProvider(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
33527
33528 /**
33529  * Constructs a new OnionMessageHandler which calls the relevant methods on this_arg.
33530  * This copies the `inner` pointer in this_arg and thus the returned OnionMessageHandler must be freed before this_arg is
33531  */
33532 struct LDKOnionMessageHandler IgnoringMessageHandler_as_OnionMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
33533
33534 /**
33535  * Constructs a new OffersMessageHandler which calls the relevant methods on this_arg.
33536  * This copies the `inner` pointer in this_arg and thus the returned OffersMessageHandler must be freed before this_arg is
33537  */
33538 struct LDKOffersMessageHandler IgnoringMessageHandler_as_OffersMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
33539
33540 /**
33541  * Constructs a new CustomOnionMessageHandler which calls the relevant methods on this_arg.
33542  * This copies the `inner` pointer in this_arg and thus the returned CustomOnionMessageHandler must be freed before this_arg is
33543  */
33544 struct LDKCustomOnionMessageHandler IgnoringMessageHandler_as_CustomOnionMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
33545
33546 /**
33547  * Constructs a new CustomMessageReader which calls the relevant methods on this_arg.
33548  * This copies the `inner` pointer in this_arg and thus the returned CustomMessageReader must be freed before this_arg is
33549  */
33550 struct LDKCustomMessageReader IgnoringMessageHandler_as_CustomMessageReader(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
33551
33552 /**
33553  * Constructs a new CustomMessageHandler which calls the relevant methods on this_arg.
33554  * This copies the `inner` pointer in this_arg and thus the returned CustomMessageHandler must be freed before this_arg is
33555  */
33556 struct LDKCustomMessageHandler IgnoringMessageHandler_as_CustomMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
33557
33558 /**
33559  * Frees any resources used by the ErroringMessageHandler, if is_owned is set and inner is non-NULL.
33560  */
33561 void ErroringMessageHandler_free(struct LDKErroringMessageHandler this_obj);
33562
33563 /**
33564  * Constructs a new ErroringMessageHandler
33565  */
33566 MUST_USE_RES struct LDKErroringMessageHandler ErroringMessageHandler_new(void);
33567
33568 /**
33569  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
33570  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
33571  */
33572 struct LDKMessageSendEventsProvider ErroringMessageHandler_as_MessageSendEventsProvider(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg);
33573
33574 /**
33575  * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg.
33576  * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is
33577  */
33578 struct LDKChannelMessageHandler ErroringMessageHandler_as_ChannelMessageHandler(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg);
33579
33580 /**
33581  * Frees any resources used by the MessageHandler, if is_owned is set and inner is non-NULL.
33582  */
33583 void MessageHandler_free(struct LDKMessageHandler this_obj);
33584
33585 /**
33586  * A message handler which handles messages specific to channels. Usually this is just a
33587  * [`ChannelManager`] object or an [`ErroringMessageHandler`].
33588  *
33589  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
33590  */
33591 const struct LDKChannelMessageHandler *MessageHandler_get_chan_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
33592
33593 /**
33594  * A message handler which handles messages specific to channels. Usually this is just a
33595  * [`ChannelManager`] object or an [`ErroringMessageHandler`].
33596  *
33597  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
33598  */
33599 void MessageHandler_set_chan_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKChannelMessageHandler val);
33600
33601 /**
33602  * A message handler which handles messages updating our knowledge of the network channel
33603  * graph. Usually this is just a [`P2PGossipSync`] object or an [`IgnoringMessageHandler`].
33604  *
33605  * [`P2PGossipSync`]: crate::routing::gossip::P2PGossipSync
33606  */
33607 const struct LDKRoutingMessageHandler *MessageHandler_get_route_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
33608
33609 /**
33610  * A message handler which handles messages updating our knowledge of the network channel
33611  * graph. Usually this is just a [`P2PGossipSync`] object or an [`IgnoringMessageHandler`].
33612  *
33613  * [`P2PGossipSync`]: crate::routing::gossip::P2PGossipSync
33614  */
33615 void MessageHandler_set_route_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKRoutingMessageHandler val);
33616
33617 /**
33618  * A message handler which handles onion messages. This should generally be an
33619  * [`OnionMessenger`], but can also be an [`IgnoringMessageHandler`].
33620  *
33621  * [`OnionMessenger`]: crate::onion_message::OnionMessenger
33622  */
33623 const struct LDKOnionMessageHandler *MessageHandler_get_onion_message_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
33624
33625 /**
33626  * A message handler which handles onion messages. This should generally be an
33627  * [`OnionMessenger`], but can also be an [`IgnoringMessageHandler`].
33628  *
33629  * [`OnionMessenger`]: crate::onion_message::OnionMessenger
33630  */
33631 void MessageHandler_set_onion_message_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKOnionMessageHandler val);
33632
33633 /**
33634  * A message handler which handles custom messages. The only LDK-provided implementation is
33635  * [`IgnoringMessageHandler`].
33636  */
33637 const struct LDKCustomMessageHandler *MessageHandler_get_custom_message_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
33638
33639 /**
33640  * A message handler which handles custom messages. The only LDK-provided implementation is
33641  * [`IgnoringMessageHandler`].
33642  */
33643 void MessageHandler_set_custom_message_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKCustomMessageHandler val);
33644
33645 /**
33646  * Constructs a new MessageHandler given each field
33647  */
33648 MUST_USE_RES struct LDKMessageHandler MessageHandler_new(struct LDKChannelMessageHandler chan_handler_arg, struct LDKRoutingMessageHandler route_handler_arg, struct LDKOnionMessageHandler onion_message_handler_arg, struct LDKCustomMessageHandler custom_message_handler_arg);
33649
33650 /**
33651  * Creates a copy of a SocketDescriptor
33652  */
33653 struct LDKSocketDescriptor SocketDescriptor_clone(const struct LDKSocketDescriptor *NONNULL_PTR orig);
33654
33655 /**
33656  * Calls the free function if one is set
33657  */
33658 void SocketDescriptor_free(struct LDKSocketDescriptor this_ptr);
33659
33660 /**
33661  * Frees any resources used by the PeerHandleError, if is_owned is set and inner is non-NULL.
33662  */
33663 void PeerHandleError_free(struct LDKPeerHandleError this_obj);
33664
33665 /**
33666  * Constructs a new PeerHandleError given each field
33667  */
33668 MUST_USE_RES struct LDKPeerHandleError PeerHandleError_new(void);
33669
33670 /**
33671  * Creates a copy of the PeerHandleError
33672  */
33673 struct LDKPeerHandleError PeerHandleError_clone(const struct LDKPeerHandleError *NONNULL_PTR orig);
33674
33675 /**
33676  * Frees any resources used by the PeerManager, if is_owned is set and inner is non-NULL.
33677  */
33678 void PeerManager_free(struct LDKPeerManager this_obj);
33679
33680 /**
33681  * Constructs a new `PeerManager` with the given message handlers.
33682  *
33683  * `ephemeral_random_data` is used to derive per-connection ephemeral keys and must be
33684  * cryptographically secure random bytes.
33685  *
33686  * `current_time` is used as an always-increasing counter that survives across restarts and is
33687  * incremented irregularly internally. In general it is best to simply use the current UNIX
33688  * timestamp, however if it is not available a persistent counter that increases once per
33689  * minute should suffice.
33690  */
33691 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 LDKNodeSigner node_signer);
33692
33693 /**
33694  * Get a list of tuples mapping from node id to network addresses for peers which have
33695  * completed the initial handshake.
33696  *
33697  * For outbound connections, the [`PublicKey`] will be the same as the `their_node_id` parameter
33698  * passed in to [`Self::new_outbound_connection`], however entries will only appear once the initial
33699  * handshake has completed and we are sure the remote peer has the private key for the given
33700  * [`PublicKey`].
33701  *
33702  * The returned `Option`s will only be `Some` if an address had been previously given via
33703  * [`Self::new_outbound_connection`] or [`Self::new_inbound_connection`].
33704  */
33705 MUST_USE_RES struct LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ PeerManager_get_peer_node_ids(const struct LDKPeerManager *NONNULL_PTR this_arg);
33706
33707 /**
33708  * Indicates a new outbound connection has been established to a node with the given `node_id`
33709  * and an optional remote network address.
33710  *
33711  * The remote network address adds the option to report a remote IP address back to a connecting
33712  * peer using the init message.
33713  * The user should pass the remote network address of the host they are connected to.
33714  *
33715  * If an `Err` is returned here you must disconnect the connection immediately.
33716  *
33717  * Returns a small number of bytes to send to the remote node (currently always 50).
33718  *
33719  * Panics if descriptor is duplicative with some other descriptor which has not yet been
33720  * [`socket_disconnected`].
33721  *
33722  * [`socket_disconnected`]: PeerManager::socket_disconnected
33723  */
33724 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);
33725
33726 /**
33727  * Indicates a new inbound connection has been established to a node with an optional remote
33728  * network address.
33729  *
33730  * The remote network address adds the option to report a remote IP address back to a connecting
33731  * peer using the init message.
33732  * The user should pass the remote network address of the host they are connected to.
33733  *
33734  * May refuse the connection by returning an Err, but will never write bytes to the remote end
33735  * (outbound connector always speaks first). If an `Err` is returned here you must disconnect
33736  * the connection immediately.
33737  *
33738  * Panics if descriptor is duplicative with some other descriptor which has not yet been
33739  * [`socket_disconnected`].
33740  *
33741  * [`socket_disconnected`]: PeerManager::socket_disconnected
33742  */
33743 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);
33744
33745 /**
33746  * Indicates that there is room to write data to the given socket descriptor.
33747  *
33748  * May return an Err to indicate that the connection should be closed.
33749  *
33750  * May call [`send_data`] on the descriptor passed in (or an equal descriptor) before
33751  * returning. Thus, be very careful with reentrancy issues! The invariants around calling
33752  * [`write_buffer_space_avail`] in case a write did not fully complete must still hold - be
33753  * ready to call [`write_buffer_space_avail`] again if a write call generated here isn't
33754  * sufficient!
33755  *
33756  * [`send_data`]: SocketDescriptor::send_data
33757  * [`write_buffer_space_avail`]: PeerManager::write_buffer_space_avail
33758  */
33759 MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_write_buffer_space_avail(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor *NONNULL_PTR descriptor);
33760
33761 /**
33762  * Indicates that data was read from the given socket descriptor.
33763  *
33764  * May return an Err to indicate that the connection should be closed.
33765  *
33766  * Will *not* call back into [`send_data`] on any descriptors to avoid reentrancy complexity.
33767  * Thus, however, you should call [`process_events`] after any `read_event` to generate
33768  * [`send_data`] calls to handle responses.
33769  *
33770  * If `Ok(true)` is returned, further read_events should not be triggered until a
33771  * [`send_data`] call on this descriptor has `resume_read` set (preventing DoS issues in the
33772  * send buffer).
33773  *
33774  * In order to avoid processing too many messages at once per peer, `data` should be on the
33775  * order of 4KiB.
33776  *
33777  * [`send_data`]: SocketDescriptor::send_data
33778  * [`process_events`]: PeerManager::process_events
33779  */
33780 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);
33781
33782 /**
33783  * Checks for any events generated by our handlers and processes them. Includes sending most
33784  * response messages as well as messages generated by calls to handler functions directly (eg
33785  * functions like [`ChannelManager::process_pending_htlc_forwards`] or [`send_payment`]).
33786  *
33787  * May call [`send_data`] on [`SocketDescriptor`]s. Thus, be very careful with reentrancy
33788  * issues!
33789  *
33790  * You don't have to call this function explicitly if you are using [`lightning-net-tokio`]
33791  * or one of the other clients provided in our language bindings.
33792  *
33793  * Note that if there are any other calls to this function waiting on lock(s) this may return
33794  * without doing any work. All available events that need handling will be handled before the
33795  * other calls return.
33796  *
33797  * [`send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
33798  * [`ChannelManager::process_pending_htlc_forwards`]: crate::ln::channelmanager::ChannelManager::process_pending_htlc_forwards
33799  * [`send_data`]: SocketDescriptor::send_data
33800  */
33801 void PeerManager_process_events(const struct LDKPeerManager *NONNULL_PTR this_arg);
33802
33803 /**
33804  * Indicates that the given socket descriptor's connection is now closed.
33805  */
33806 void PeerManager_socket_disconnected(const struct LDKPeerManager *NONNULL_PTR this_arg, const struct LDKSocketDescriptor *NONNULL_PTR descriptor);
33807
33808 /**
33809  * Disconnect a peer given its node id.
33810  *
33811  * If a peer is connected, this will call [`disconnect_socket`] on the descriptor for the
33812  * peer. Thus, be very careful about reentrancy issues.
33813  *
33814  * [`disconnect_socket`]: SocketDescriptor::disconnect_socket
33815  */
33816 void PeerManager_disconnect_by_node_id(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey node_id);
33817
33818 /**
33819  * Disconnects all currently-connected peers. This is useful on platforms where there may be
33820  * an indication that TCP sockets have stalled even if we weren't around to time them out
33821  * using regular ping/pongs.
33822  */
33823 void PeerManager_disconnect_all_peers(const struct LDKPeerManager *NONNULL_PTR this_arg);
33824
33825 /**
33826  * Send pings to each peer and disconnect those which did not respond to the last round of
33827  * pings.
33828  *
33829  * This may be called on any timescale you want, however, roughly once every ten seconds is
33830  * preferred. The call rate determines both how often we send a ping to our peers and how much
33831  * time they have to respond before we disconnect them.
33832  *
33833  * May call [`send_data`] on all [`SocketDescriptor`]s. Thus, be very careful with reentrancy
33834  * issues!
33835  *
33836  * [`send_data`]: SocketDescriptor::send_data
33837  */
33838 void PeerManager_timer_tick_occurred(const struct LDKPeerManager *NONNULL_PTR this_arg);
33839
33840 /**
33841  * Generates a signed node_announcement from the given arguments, sending it to all connected
33842  * peers. Note that peers will likely ignore this message unless we have at least one public
33843  * channel which has at least six confirmations on-chain.
33844  *
33845  * `rgb` is a node \"color\" and `alias` is a printable human-readable string to describe this
33846  * node to humans. They carry no in-protocol meaning.
33847  *
33848  * `addresses` represent the set (possibly empty) of socket addresses on which this node
33849  * accepts incoming connections. These will be included in the node_announcement, publicly
33850  * tying these addresses together and to this node. If you wish to preserve user privacy,
33851  * addresses should likely contain only Tor Onion addresses.
33852  *
33853  * Panics if `addresses` is absurdly large (more than 100).
33854  *
33855  * [`get_and_clear_pending_msg_events`]: MessageSendEventsProvider::get_and_clear_pending_msg_events
33856  */
33857 void PeerManager_broadcast_node_announcement(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKThreeBytes rgb, struct LDKThirtyTwoBytes alias, struct LDKCVec_NetAddressZ addresses);
33858
33859 /**
33860  * Gets the weight for an HTLC-Success transaction.
33861  */
33862 uint64_t htlc_success_tx_weight(const struct LDKChannelTypeFeatures *NONNULL_PTR channel_type_features);
33863
33864 /**
33865  * Gets the weight for an HTLC-Timeout transaction.
33866  */
33867 uint64_t htlc_timeout_tx_weight(const struct LDKChannelTypeFeatures *NONNULL_PTR channel_type_features);
33868
33869 /**
33870  * Creates a copy of the HTLCClaim
33871  */
33872 enum LDKHTLCClaim HTLCClaim_clone(const enum LDKHTLCClaim *NONNULL_PTR orig);
33873
33874 /**
33875  * Utility method to constructs a new OfferedTimeout-variant HTLCClaim
33876  */
33877 enum LDKHTLCClaim HTLCClaim_offered_timeout(void);
33878
33879 /**
33880  * Utility method to constructs a new OfferedPreimage-variant HTLCClaim
33881  */
33882 enum LDKHTLCClaim HTLCClaim_offered_preimage(void);
33883
33884 /**
33885  * Utility method to constructs a new AcceptedTimeout-variant HTLCClaim
33886  */
33887 enum LDKHTLCClaim HTLCClaim_accepted_timeout(void);
33888
33889 /**
33890  * Utility method to constructs a new AcceptedPreimage-variant HTLCClaim
33891  */
33892 enum LDKHTLCClaim HTLCClaim_accepted_preimage(void);
33893
33894 /**
33895  * Utility method to constructs a new Revocation-variant HTLCClaim
33896  */
33897 enum LDKHTLCClaim HTLCClaim_revocation(void);
33898
33899 /**
33900  * Checks if two HTLCClaims contain equal inner contents.
33901  * This ignores pointers and is_owned flags and looks at the values in fields.
33902  */
33903 bool HTLCClaim_eq(const enum LDKHTLCClaim *NONNULL_PTR a, const enum LDKHTLCClaim *NONNULL_PTR b);
33904
33905 /**
33906  * Check if a given input witness attempts to claim a HTLC.
33907  */
33908 MUST_USE_RES struct LDKCOption_HTLCClaimZ HTLCClaim_from_witness(struct LDKWitness witness);
33909
33910 /**
33911  * Build the commitment secret from the seed and the commitment number
33912  */
33913 struct LDKThirtyTwoBytes build_commitment_secret(const uint8_t (*commitment_seed)[32], uint64_t idx);
33914
33915 /**
33916  * Build a closing transaction
33917  */
33918 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);
33919
33920 /**
33921  * Frees any resources used by the CounterpartyCommitmentSecrets, if is_owned is set and inner is non-NULL.
33922  */
33923 void CounterpartyCommitmentSecrets_free(struct LDKCounterpartyCommitmentSecrets this_obj);
33924
33925 /**
33926  * Creates a copy of the CounterpartyCommitmentSecrets
33927  */
33928 struct LDKCounterpartyCommitmentSecrets CounterpartyCommitmentSecrets_clone(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR orig);
33929
33930 /**
33931  * Creates a new empty `CounterpartyCommitmentSecrets` structure.
33932  */
33933 MUST_USE_RES struct LDKCounterpartyCommitmentSecrets CounterpartyCommitmentSecrets_new(void);
33934
33935 /**
33936  * Returns the minimum index of all stored secrets. Note that indexes start
33937  * at 1 << 48 and get decremented by one for each new secret.
33938  */
33939 MUST_USE_RES uint64_t CounterpartyCommitmentSecrets_get_min_seen_secret(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR this_arg);
33940
33941 /**
33942  * Inserts the `secret` at `idx`. Returns `Ok(())` if the secret
33943  * was generated in accordance with BOLT 3 and is consistent with previous secrets.
33944  */
33945 MUST_USE_RES struct LDKCResult_NoneNoneZ CounterpartyCommitmentSecrets_provide_secret(struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR this_arg, uint64_t idx, struct LDKThirtyTwoBytes secret);
33946
33947 /**
33948  * Returns the secret at `idx`.
33949  * Returns `None` if `idx` is < [`CounterpartyCommitmentSecrets::get_min_seen_secret`].
33950  *
33951  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
33952  */
33953 MUST_USE_RES struct LDKThirtyTwoBytes CounterpartyCommitmentSecrets_get_secret(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR this_arg, uint64_t idx);
33954
33955 /**
33956  * Serialize the CounterpartyCommitmentSecrets object into a byte array which can be read by CounterpartyCommitmentSecrets_read
33957  */
33958 struct LDKCVec_u8Z CounterpartyCommitmentSecrets_write(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR obj);
33959
33960 /**
33961  * Read a CounterpartyCommitmentSecrets from a byte array, created by CounterpartyCommitmentSecrets_write
33962  */
33963 struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CounterpartyCommitmentSecrets_read(struct LDKu8slice ser);
33964
33965 /**
33966  * Derives a per-commitment-transaction private key (eg an htlc key or delayed_payment key)
33967  * from the base secret and the per_commitment_point.
33968  */
33969 struct LDKSecretKey derive_private_key(struct LDKPublicKey per_commitment_point, const uint8_t (*base_secret)[32]);
33970
33971 /**
33972  * Derives a per-commitment-transaction public key (eg an htlc key or a delayed_payment key)
33973  * from the base point and the per_commitment_key. This is the public equivalent of
33974  * derive_private_key - using only public keys to derive a public key instead of private keys.
33975  */
33976 struct LDKPublicKey derive_public_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey base_point);
33977
33978 /**
33979  * Derives a per-commitment-transaction revocation key from its constituent parts.
33980  *
33981  * Only the cheating participant owns a valid witness to propagate a revoked
33982  * commitment transaction, thus per_commitment_secret always come from cheater
33983  * and revocation_base_secret always come from punisher, which is the broadcaster
33984  * of the transaction spending with this key knowledge.
33985  */
33986 struct LDKSecretKey derive_private_revocation_key(const uint8_t (*per_commitment_secret)[32], const uint8_t (*countersignatory_revocation_base_secret)[32]);
33987
33988 /**
33989  * Derives a per-commitment-transaction revocation public key from its constituent parts. This is
33990  * the public equivalend of derive_private_revocation_key - using only public keys to derive a
33991  * public key instead of private keys.
33992  *
33993  * Only the cheating participant owns a valid witness to propagate a revoked
33994  * commitment transaction, thus per_commitment_point always come from cheater
33995  * and revocation_base_point always come from punisher, which is the broadcaster
33996  * of the transaction spending with this key knowledge.
33997  *
33998  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
33999  * generated (ie our own).
34000  */
34001 struct LDKPublicKey derive_public_revocation_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey countersignatory_revocation_base_point);
34002
34003 /**
34004  * Frees any resources used by the TxCreationKeys, if is_owned is set and inner is non-NULL.
34005  */
34006 void TxCreationKeys_free(struct LDKTxCreationKeys this_obj);
34007
34008 /**
34009  * The broadcaster's per-commitment public key which was used to derive the other keys.
34010  */
34011 struct LDKPublicKey TxCreationKeys_get_per_commitment_point(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
34012
34013 /**
34014  * The broadcaster's per-commitment public key which was used to derive the other keys.
34015  */
34016 void TxCreationKeys_set_per_commitment_point(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
34017
34018 /**
34019  * The revocation key which is used to allow the broadcaster of the commitment
34020  * transaction to provide their counterparty the ability to punish them if they broadcast
34021  * an old state.
34022  */
34023 struct LDKPublicKey TxCreationKeys_get_revocation_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
34024
34025 /**
34026  * The revocation key which is used to allow the broadcaster of the commitment
34027  * transaction to provide their counterparty the ability to punish them if they broadcast
34028  * an old state.
34029  */
34030 void TxCreationKeys_set_revocation_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
34031
34032 /**
34033  * Broadcaster's HTLC Key
34034  */
34035 struct LDKPublicKey TxCreationKeys_get_broadcaster_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
34036
34037 /**
34038  * Broadcaster's HTLC Key
34039  */
34040 void TxCreationKeys_set_broadcaster_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
34041
34042 /**
34043  * Countersignatory's HTLC Key
34044  */
34045 struct LDKPublicKey TxCreationKeys_get_countersignatory_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
34046
34047 /**
34048  * Countersignatory's HTLC Key
34049  */
34050 void TxCreationKeys_set_countersignatory_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
34051
34052 /**
34053  * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
34054  */
34055 struct LDKPublicKey TxCreationKeys_get_broadcaster_delayed_payment_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
34056
34057 /**
34058  * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
34059  */
34060 void TxCreationKeys_set_broadcaster_delayed_payment_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
34061
34062 /**
34063  * Constructs a new TxCreationKeys given each field
34064  */
34065 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);
34066
34067 /**
34068  * Checks if two TxCreationKeyss contain equal inner contents.
34069  * This ignores pointers and is_owned flags and looks at the values in fields.
34070  * Two objects with NULL inner values will be considered "equal" here.
34071  */
34072 bool TxCreationKeys_eq(const struct LDKTxCreationKeys *NONNULL_PTR a, const struct LDKTxCreationKeys *NONNULL_PTR b);
34073
34074 /**
34075  * Creates a copy of the TxCreationKeys
34076  */
34077 struct LDKTxCreationKeys TxCreationKeys_clone(const struct LDKTxCreationKeys *NONNULL_PTR orig);
34078
34079 /**
34080  * Serialize the TxCreationKeys object into a byte array which can be read by TxCreationKeys_read
34081  */
34082 struct LDKCVec_u8Z TxCreationKeys_write(const struct LDKTxCreationKeys *NONNULL_PTR obj);
34083
34084 /**
34085  * Read a TxCreationKeys from a byte array, created by TxCreationKeys_write
34086  */
34087 struct LDKCResult_TxCreationKeysDecodeErrorZ TxCreationKeys_read(struct LDKu8slice ser);
34088
34089 /**
34090  * Frees any resources used by the ChannelPublicKeys, if is_owned is set and inner is non-NULL.
34091  */
34092 void ChannelPublicKeys_free(struct LDKChannelPublicKeys this_obj);
34093
34094 /**
34095  * The public key which is used to sign all commitment transactions, as it appears in the
34096  * on-chain channel lock-in 2-of-2 multisig output.
34097  */
34098 struct LDKPublicKey ChannelPublicKeys_get_funding_pubkey(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
34099
34100 /**
34101  * The public key which is used to sign all commitment transactions, as it appears in the
34102  * on-chain channel lock-in 2-of-2 multisig output.
34103  */
34104 void ChannelPublicKeys_set_funding_pubkey(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
34105
34106 /**
34107  * The base point which is used (with derive_public_revocation_key) to derive per-commitment
34108  * revocation keys. This is combined with the per-commitment-secret generated by the
34109  * counterparty to create a secret which the counterparty can reveal to revoke previous
34110  * states.
34111  */
34112 struct LDKPublicKey ChannelPublicKeys_get_revocation_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
34113
34114 /**
34115  * The base point which is used (with derive_public_revocation_key) to derive per-commitment
34116  * revocation keys. This is combined with the per-commitment-secret generated by the
34117  * counterparty to create a secret which the counterparty can reveal to revoke previous
34118  * states.
34119  */
34120 void ChannelPublicKeys_set_revocation_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
34121
34122 /**
34123  * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
34124  * spendable primary channel balance on the broadcaster's commitment transaction. This key is
34125  * static across every commitment transaction.
34126  */
34127 struct LDKPublicKey ChannelPublicKeys_get_payment_point(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
34128
34129 /**
34130  * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
34131  * spendable primary channel balance on the broadcaster's commitment transaction. This key is
34132  * static across every commitment transaction.
34133  */
34134 void ChannelPublicKeys_set_payment_point(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
34135
34136 /**
34137  * The base point which is used (with derive_public_key) to derive a per-commitment payment
34138  * public key which receives non-HTLC-encumbered funds which are only available for spending
34139  * after some delay (or can be claimed via the revocation path).
34140  */
34141 struct LDKPublicKey ChannelPublicKeys_get_delayed_payment_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
34142
34143 /**
34144  * The base point which is used (with derive_public_key) to derive a per-commitment payment
34145  * public key which receives non-HTLC-encumbered funds which are only available for spending
34146  * after some delay (or can be claimed via the revocation path).
34147  */
34148 void ChannelPublicKeys_set_delayed_payment_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
34149
34150 /**
34151  * The base point which is used (with derive_public_key) to derive a per-commitment public key
34152  * which is used to encumber HTLC-in-flight outputs.
34153  */
34154 struct LDKPublicKey ChannelPublicKeys_get_htlc_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
34155
34156 /**
34157  * The base point which is used (with derive_public_key) to derive a per-commitment public key
34158  * which is used to encumber HTLC-in-flight outputs.
34159  */
34160 void ChannelPublicKeys_set_htlc_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
34161
34162 /**
34163  * Constructs a new ChannelPublicKeys given each field
34164  */
34165 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);
34166
34167 /**
34168  * Creates a copy of the ChannelPublicKeys
34169  */
34170 struct LDKChannelPublicKeys ChannelPublicKeys_clone(const struct LDKChannelPublicKeys *NONNULL_PTR orig);
34171
34172 /**
34173  * Checks if two ChannelPublicKeyss contain equal inner contents.
34174  * This ignores pointers and is_owned flags and looks at the values in fields.
34175  * Two objects with NULL inner values will be considered "equal" here.
34176  */
34177 bool ChannelPublicKeys_eq(const struct LDKChannelPublicKeys *NONNULL_PTR a, const struct LDKChannelPublicKeys *NONNULL_PTR b);
34178
34179 /**
34180  * Serialize the ChannelPublicKeys object into a byte array which can be read by ChannelPublicKeys_read
34181  */
34182 struct LDKCVec_u8Z ChannelPublicKeys_write(const struct LDKChannelPublicKeys *NONNULL_PTR obj);
34183
34184 /**
34185  * Read a ChannelPublicKeys from a byte array, created by ChannelPublicKeys_write
34186  */
34187 struct LDKCResult_ChannelPublicKeysDecodeErrorZ ChannelPublicKeys_read(struct LDKu8slice ser);
34188
34189 /**
34190  * Create per-state keys from channel base points and the per-commitment point.
34191  * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
34192  */
34193 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);
34194
34195 /**
34196  * Generate per-state keys from channel static keys.
34197  * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
34198  */
34199 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);
34200
34201 /**
34202  * A script either spendable by the revocation
34203  * key or the broadcaster_delayed_payment_key and satisfying the relative-locktime OP_CSV constrain.
34204  * Encumbering a `to_holder` output on a commitment transaction or 2nd-stage HTLC transactions.
34205  */
34206 struct LDKCVec_u8Z get_revokeable_redeemscript(struct LDKPublicKey revocation_key, uint16_t contest_delay, struct LDKPublicKey broadcaster_delayed_payment_key);
34207
34208 /**
34209  * Frees any resources used by the HTLCOutputInCommitment, if is_owned is set and inner is non-NULL.
34210  */
34211 void HTLCOutputInCommitment_free(struct LDKHTLCOutputInCommitment this_obj);
34212
34213 /**
34214  * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
34215  * Note that this is not the same as whether it is ountbound *from us*. To determine that you
34216  * need to compare this value to whether the commitment transaction in question is that of
34217  * the counterparty or our own.
34218  */
34219 bool HTLCOutputInCommitment_get_offered(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
34220
34221 /**
34222  * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
34223  * Note that this is not the same as whether it is ountbound *from us*. To determine that you
34224  * need to compare this value to whether the commitment transaction in question is that of
34225  * the counterparty or our own.
34226  */
34227 void HTLCOutputInCommitment_set_offered(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, bool val);
34228
34229 /**
34230  * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
34231  * this divided by 1000.
34232  */
34233 uint64_t HTLCOutputInCommitment_get_amount_msat(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
34234
34235 /**
34236  * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
34237  * this divided by 1000.
34238  */
34239 void HTLCOutputInCommitment_set_amount_msat(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint64_t val);
34240
34241 /**
34242  * The CLTV lock-time at which this HTLC expires.
34243  */
34244 uint32_t HTLCOutputInCommitment_get_cltv_expiry(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
34245
34246 /**
34247  * The CLTV lock-time at which this HTLC expires.
34248  */
34249 void HTLCOutputInCommitment_set_cltv_expiry(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint32_t val);
34250
34251 /**
34252  * The hash of the preimage which unlocks this HTLC.
34253  */
34254 const uint8_t (*HTLCOutputInCommitment_get_payment_hash(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr))[32];
34255
34256 /**
34257  * The hash of the preimage which unlocks this HTLC.
34258  */
34259 void HTLCOutputInCommitment_set_payment_hash(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
34260
34261 /**
34262  * The position within the commitment transactions' outputs. This may be None if the value is
34263  * below the dust limit (in which case no output appears in the commitment transaction and the
34264  * value is spent to additional transaction fees).
34265  */
34266 struct LDKCOption_u32Z HTLCOutputInCommitment_get_transaction_output_index(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
34267
34268 /**
34269  * The position within the commitment transactions' outputs. This may be None if the value is
34270  * below the dust limit (in which case no output appears in the commitment transaction and the
34271  * value is spent to additional transaction fees).
34272  */
34273 void HTLCOutputInCommitment_set_transaction_output_index(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val);
34274
34275 /**
34276  * Constructs a new HTLCOutputInCommitment given each field
34277  */
34278 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);
34279
34280 /**
34281  * Creates a copy of the HTLCOutputInCommitment
34282  */
34283 struct LDKHTLCOutputInCommitment HTLCOutputInCommitment_clone(const struct LDKHTLCOutputInCommitment *NONNULL_PTR orig);
34284
34285 /**
34286  * Checks if two HTLCOutputInCommitments contain equal inner contents.
34287  * This ignores pointers and is_owned flags and looks at the values in fields.
34288  * Two objects with NULL inner values will be considered "equal" here.
34289  */
34290 bool HTLCOutputInCommitment_eq(const struct LDKHTLCOutputInCommitment *NONNULL_PTR a, const struct LDKHTLCOutputInCommitment *NONNULL_PTR b);
34291
34292 /**
34293  * Serialize the HTLCOutputInCommitment object into a byte array which can be read by HTLCOutputInCommitment_read
34294  */
34295 struct LDKCVec_u8Z HTLCOutputInCommitment_write(const struct LDKHTLCOutputInCommitment *NONNULL_PTR obj);
34296
34297 /**
34298  * Read a HTLCOutputInCommitment from a byte array, created by HTLCOutputInCommitment_write
34299  */
34300 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ HTLCOutputInCommitment_read(struct LDKu8slice ser);
34301
34302 /**
34303  * Gets the witness redeemscript for an HTLC output in a commitment transaction. Note that htlc
34304  * does not need to have its previous_output_index filled.
34305  */
34306 struct LDKCVec_u8Z get_htlc_redeemscript(const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, const struct LDKChannelTypeFeatures *NONNULL_PTR channel_type_features, const struct LDKTxCreationKeys *NONNULL_PTR keys);
34307
34308 /**
34309  * Gets the redeemscript for a funding output from the two funding public keys.
34310  * Note that the order of funding public keys does not matter.
34311  */
34312 struct LDKCVec_u8Z make_funding_redeemscript(struct LDKPublicKey broadcaster, struct LDKPublicKey countersignatory);
34313
34314 /**
34315  * Builds an unsigned HTLC-Success or HTLC-Timeout transaction from the given channel and HTLC
34316  * parameters. This is used by [`TrustedCommitmentTransaction::get_htlc_sigs`] to fetch the
34317  * transaction which needs signing, and can be used to construct an HTLC transaction which is
34318  * broadcastable given a counterparty HTLC signature.
34319  *
34320  * Panics if htlc.transaction_output_index.is_none() (as such HTLCs do not appear in the
34321  * commitment transaction).
34322  */
34323 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, const struct LDKChannelTypeFeatures *NONNULL_PTR channel_type_features, struct LDKPublicKey broadcaster_delayed_payment_key, struct LDKPublicKey revocation_key);
34324
34325 /**
34326  * Returns the witness required to satisfy and spend a HTLC input.
34327  */
34328 struct LDKWitness build_htlc_input_witness(struct LDKSignature local_sig, struct LDKSignature remote_sig, struct LDKCOption_PaymentPreimageZ preimage, struct LDKu8slice redeem_script, const struct LDKChannelTypeFeatures *NONNULL_PTR channel_type_features);
34329
34330 /**
34331  * Gets the witnessScript for the to_remote output when anchors are enabled.
34332  */
34333 struct LDKCVec_u8Z get_to_countersignatory_with_anchors_redeemscript(struct LDKPublicKey payment_point);
34334
34335 /**
34336  * Gets the witnessScript for an anchor output from the funding public key.
34337  * The witness in the spending input must be:
34338  * <BIP 143 funding_signature>
34339  * After 16 blocks of confirmation, an alternative satisfying witness could be:
34340  * <>
34341  * (empty vector required to satisfy compliance with MINIMALIF-standard rule)
34342  */
34343 struct LDKCVec_u8Z get_anchor_redeemscript(struct LDKPublicKey funding_pubkey);
34344
34345 /**
34346  * Returns the witness required to satisfy and spend an anchor input.
34347  */
34348 struct LDKWitness build_anchor_input_witness(struct LDKPublicKey funding_key, struct LDKSignature funding_sig);
34349
34350 /**
34351  * Frees any resources used by the ChannelTransactionParameters, if is_owned is set and inner is non-NULL.
34352  */
34353 void ChannelTransactionParameters_free(struct LDKChannelTransactionParameters this_obj);
34354
34355 /**
34356  * Holder public keys
34357  */
34358 struct LDKChannelPublicKeys ChannelTransactionParameters_get_holder_pubkeys(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
34359
34360 /**
34361  * Holder public keys
34362  */
34363 void ChannelTransactionParameters_set_holder_pubkeys(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
34364
34365 /**
34366  * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
34367  */
34368 uint16_t ChannelTransactionParameters_get_holder_selected_contest_delay(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
34369
34370 /**
34371  * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
34372  */
34373 void ChannelTransactionParameters_set_holder_selected_contest_delay(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
34374
34375 /**
34376  * Whether the holder is the initiator of this channel.
34377  * This is an input to the commitment number obscure factor computation.
34378  */
34379 bool ChannelTransactionParameters_get_is_outbound_from_holder(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
34380
34381 /**
34382  * Whether the holder is the initiator of this channel.
34383  * This is an input to the commitment number obscure factor computation.
34384  */
34385 void ChannelTransactionParameters_set_is_outbound_from_holder(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, bool val);
34386
34387 /**
34388  * The late-bound counterparty channel transaction parameters.
34389  * These parameters are populated at the point in the protocol where the counterparty provides them.
34390  *
34391  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
34392  */
34393 struct LDKCounterpartyChannelTransactionParameters ChannelTransactionParameters_get_counterparty_parameters(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
34394
34395 /**
34396  * The late-bound counterparty channel transaction parameters.
34397  * These parameters are populated at the point in the protocol where the counterparty provides them.
34398  *
34399  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
34400  */
34401 void ChannelTransactionParameters_set_counterparty_parameters(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKCounterpartyChannelTransactionParameters val);
34402
34403 /**
34404  * The late-bound funding outpoint
34405  *
34406  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
34407  */
34408 struct LDKOutPoint ChannelTransactionParameters_get_funding_outpoint(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
34409
34410 /**
34411  * The late-bound funding outpoint
34412  *
34413  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
34414  */
34415 void ChannelTransactionParameters_set_funding_outpoint(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKOutPoint val);
34416
34417 /**
34418  * This channel's type, as negotiated during channel open. For old objects where this field
34419  * wasn't serialized, it will default to static_remote_key at deserialization.
34420  */
34421 struct LDKChannelTypeFeatures ChannelTransactionParameters_get_channel_type_features(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
34422
34423 /**
34424  * This channel's type, as negotiated during channel open. For old objects where this field
34425  * wasn't serialized, it will default to static_remote_key at deserialization.
34426  */
34427 void ChannelTransactionParameters_set_channel_type_features(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelTypeFeatures val);
34428
34429 /**
34430  * Constructs a new ChannelTransactionParameters given each field
34431  */
34432 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, struct LDKChannelTypeFeatures channel_type_features_arg);
34433
34434 /**
34435  * Creates a copy of the ChannelTransactionParameters
34436  */
34437 struct LDKChannelTransactionParameters ChannelTransactionParameters_clone(const struct LDKChannelTransactionParameters *NONNULL_PTR orig);
34438
34439 /**
34440  * Checks if two ChannelTransactionParameterss contain equal inner contents.
34441  * This ignores pointers and is_owned flags and looks at the values in fields.
34442  * Two objects with NULL inner values will be considered "equal" here.
34443  */
34444 bool ChannelTransactionParameters_eq(const struct LDKChannelTransactionParameters *NONNULL_PTR a, const struct LDKChannelTransactionParameters *NONNULL_PTR b);
34445
34446 /**
34447  * Frees any resources used by the CounterpartyChannelTransactionParameters, if is_owned is set and inner is non-NULL.
34448  */
34449 void CounterpartyChannelTransactionParameters_free(struct LDKCounterpartyChannelTransactionParameters this_obj);
34450
34451 /**
34452  * Counter-party public keys
34453  */
34454 struct LDKChannelPublicKeys CounterpartyChannelTransactionParameters_get_pubkeys(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
34455
34456 /**
34457  * Counter-party public keys
34458  */
34459 void CounterpartyChannelTransactionParameters_set_pubkeys(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
34460
34461 /**
34462  * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
34463  */
34464 uint16_t CounterpartyChannelTransactionParameters_get_selected_contest_delay(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
34465
34466 /**
34467  * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
34468  */
34469 void CounterpartyChannelTransactionParameters_set_selected_contest_delay(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
34470
34471 /**
34472  * Constructs a new CounterpartyChannelTransactionParameters given each field
34473  */
34474 MUST_USE_RES struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_new(struct LDKChannelPublicKeys pubkeys_arg, uint16_t selected_contest_delay_arg);
34475
34476 /**
34477  * Creates a copy of the CounterpartyChannelTransactionParameters
34478  */
34479 struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_clone(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR orig);
34480
34481 /**
34482  * Checks if two CounterpartyChannelTransactionParameterss contain equal inner contents.
34483  * This ignores pointers and is_owned flags and looks at the values in fields.
34484  * Two objects with NULL inner values will be considered "equal" here.
34485  */
34486 bool CounterpartyChannelTransactionParameters_eq(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR a, const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR b);
34487
34488 /**
34489  * Whether the late bound parameters are populated.
34490  */
34491 MUST_USE_RES bool ChannelTransactionParameters_is_populated(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
34492
34493 /**
34494  * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
34495  * given that the holder is the broadcaster.
34496  *
34497  * self.is_populated() must be true before calling this function.
34498  */
34499 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_holder_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
34500
34501 /**
34502  * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
34503  * given that the counterparty is the broadcaster.
34504  *
34505  * self.is_populated() must be true before calling this function.
34506  */
34507 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_counterparty_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
34508
34509 /**
34510  * Serialize the CounterpartyChannelTransactionParameters object into a byte array which can be read by CounterpartyChannelTransactionParameters_read
34511  */
34512 struct LDKCVec_u8Z CounterpartyChannelTransactionParameters_write(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR obj);
34513
34514 /**
34515  * Read a CounterpartyChannelTransactionParameters from a byte array, created by CounterpartyChannelTransactionParameters_write
34516  */
34517 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CounterpartyChannelTransactionParameters_read(struct LDKu8slice ser);
34518
34519 /**
34520  * Serialize the ChannelTransactionParameters object into a byte array which can be read by ChannelTransactionParameters_read
34521  */
34522 struct LDKCVec_u8Z ChannelTransactionParameters_write(const struct LDKChannelTransactionParameters *NONNULL_PTR obj);
34523
34524 /**
34525  * Read a ChannelTransactionParameters from a byte array, created by ChannelTransactionParameters_write
34526  */
34527 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ ChannelTransactionParameters_read(struct LDKu8slice ser);
34528
34529 /**
34530  * Frees any resources used by the DirectedChannelTransactionParameters, if is_owned is set and inner is non-NULL.
34531  */
34532 void DirectedChannelTransactionParameters_free(struct LDKDirectedChannelTransactionParameters this_obj);
34533
34534 /**
34535  * Get the channel pubkeys for the broadcaster
34536  */
34537 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_broadcaster_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
34538
34539 /**
34540  * Get the channel pubkeys for the countersignatory
34541  */
34542 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_countersignatory_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
34543
34544 /**
34545  * Get the contest delay applicable to the transactions.
34546  * Note that the contest delay was selected by the countersignatory.
34547  */
34548 MUST_USE_RES uint16_t DirectedChannelTransactionParameters_contest_delay(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
34549
34550 /**
34551  * Whether the channel is outbound from the broadcaster.
34552  *
34553  * The boolean representing the side that initiated the channel is
34554  * an input to the commitment number obscure factor computation.
34555  */
34556 MUST_USE_RES bool DirectedChannelTransactionParameters_is_outbound(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
34557
34558 /**
34559  * The funding outpoint
34560  */
34561 MUST_USE_RES struct LDKOutPoint DirectedChannelTransactionParameters_funding_outpoint(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
34562
34563 /**
34564  * Whether to use anchors for this channel
34565  */
34566 MUST_USE_RES struct LDKChannelTypeFeatures DirectedChannelTransactionParameters_channel_type_features(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
34567
34568 /**
34569  * Frees any resources used by the HolderCommitmentTransaction, if is_owned is set and inner is non-NULL.
34570  */
34571 void HolderCommitmentTransaction_free(struct LDKHolderCommitmentTransaction this_obj);
34572
34573 /**
34574  * Our counterparty's signature for the transaction
34575  */
34576 struct LDKSignature HolderCommitmentTransaction_get_counterparty_sig(const struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr);
34577
34578 /**
34579  * Our counterparty's signature for the transaction
34580  */
34581 void HolderCommitmentTransaction_set_counterparty_sig(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKSignature val);
34582
34583 /**
34584  * All non-dust counterparty HTLC signatures, in the order they appear in the transaction
34585  *
34586  * Returns a copy of the field.
34587  */
34588 struct LDKCVec_SignatureZ HolderCommitmentTransaction_get_counterparty_htlc_sigs(const struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr);
34589
34590 /**
34591  * All non-dust counterparty HTLC signatures, in the order they appear in the transaction
34592  */
34593 void HolderCommitmentTransaction_set_counterparty_htlc_sigs(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val);
34594
34595 /**
34596  * Creates a copy of the HolderCommitmentTransaction
34597  */
34598 struct LDKHolderCommitmentTransaction HolderCommitmentTransaction_clone(const struct LDKHolderCommitmentTransaction *NONNULL_PTR orig);
34599
34600 /**
34601  * Serialize the HolderCommitmentTransaction object into a byte array which can be read by HolderCommitmentTransaction_read
34602  */
34603 struct LDKCVec_u8Z HolderCommitmentTransaction_write(const struct LDKHolderCommitmentTransaction *NONNULL_PTR obj);
34604
34605 /**
34606  * Read a HolderCommitmentTransaction from a byte array, created by HolderCommitmentTransaction_write
34607  */
34608 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ HolderCommitmentTransaction_read(struct LDKu8slice ser);
34609
34610 /**
34611  * Create a new holder transaction with the given counterparty signatures.
34612  * The funding keys are used to figure out which signature should go first when building the transaction for broadcast.
34613  */
34614 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);
34615
34616 /**
34617  * Frees any resources used by the BuiltCommitmentTransaction, if is_owned is set and inner is non-NULL.
34618  */
34619 void BuiltCommitmentTransaction_free(struct LDKBuiltCommitmentTransaction this_obj);
34620
34621 /**
34622  * The commitment transaction
34623  */
34624 struct LDKTransaction BuiltCommitmentTransaction_get_transaction(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr);
34625
34626 /**
34627  * The commitment transaction
34628  */
34629 void BuiltCommitmentTransaction_set_transaction(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKTransaction val);
34630
34631 /**
34632  * The txid for the commitment transaction.
34633  *
34634  * This is provided as a performance optimization, instead of calling transaction.txid()
34635  * multiple times.
34636  */
34637 const uint8_t (*BuiltCommitmentTransaction_get_txid(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr))[32];
34638
34639 /**
34640  * The txid for the commitment transaction.
34641  *
34642  * This is provided as a performance optimization, instead of calling transaction.txid()
34643  * multiple times.
34644  */
34645 void BuiltCommitmentTransaction_set_txid(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
34646
34647 /**
34648  * Constructs a new BuiltCommitmentTransaction given each field
34649  */
34650 MUST_USE_RES struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_new(struct LDKTransaction transaction_arg, struct LDKThirtyTwoBytes txid_arg);
34651
34652 /**
34653  * Creates a copy of the BuiltCommitmentTransaction
34654  */
34655 struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_clone(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR orig);
34656
34657 /**
34658  * Serialize the BuiltCommitmentTransaction object into a byte array which can be read by BuiltCommitmentTransaction_read
34659  */
34660 struct LDKCVec_u8Z BuiltCommitmentTransaction_write(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR obj);
34661
34662 /**
34663  * Read a BuiltCommitmentTransaction from a byte array, created by BuiltCommitmentTransaction_write
34664  */
34665 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ BuiltCommitmentTransaction_read(struct LDKu8slice ser);
34666
34667 /**
34668  * Get the SIGHASH_ALL sighash value of the transaction.
34669  *
34670  * This can be used to verify a signature.
34671  */
34672 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);
34673
34674 /**
34675  * Signs the counterparty's commitment transaction.
34676  */
34677 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);
34678
34679 /**
34680  * Signs the holder commitment transaction because we are about to broadcast it.
34681  */
34682 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);
34683
34684 /**
34685  * Frees any resources used by the ClosingTransaction, if is_owned is set and inner is non-NULL.
34686  */
34687 void ClosingTransaction_free(struct LDKClosingTransaction this_obj);
34688
34689 /**
34690  * Creates a copy of the ClosingTransaction
34691  */
34692 struct LDKClosingTransaction ClosingTransaction_clone(const struct LDKClosingTransaction *NONNULL_PTR orig);
34693
34694 /**
34695  * Generates a non-cryptographic 64-bit hash of the ClosingTransaction.
34696  */
34697 uint64_t ClosingTransaction_hash(const struct LDKClosingTransaction *NONNULL_PTR o);
34698
34699 /**
34700  * Checks if two ClosingTransactions contain equal inner contents.
34701  * This ignores pointers and is_owned flags and looks at the values in fields.
34702  * Two objects with NULL inner values will be considered "equal" here.
34703  */
34704 bool ClosingTransaction_eq(const struct LDKClosingTransaction *NONNULL_PTR a, const struct LDKClosingTransaction *NONNULL_PTR b);
34705
34706 /**
34707  * Construct an object of the class
34708  */
34709 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);
34710
34711 /**
34712  * Trust our pre-built transaction.
34713  *
34714  * Applies a wrapper which allows access to the transaction.
34715  *
34716  * This should only be used if you fully trust the builder of this object. It should not
34717  * be used by an external signer - instead use the verify function.
34718  */
34719 MUST_USE_RES struct LDKTrustedClosingTransaction ClosingTransaction_trust(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
34720
34721 /**
34722  * Verify our pre-built transaction.
34723  *
34724  * Applies a wrapper which allows access to the transaction.
34725  *
34726  * An external validating signer must call this method before signing
34727  * or using the built transaction.
34728  */
34729 MUST_USE_RES struct LDKCResult_TrustedClosingTransactionNoneZ ClosingTransaction_verify(const struct LDKClosingTransaction *NONNULL_PTR this_arg, struct LDKOutPoint funding_outpoint);
34730
34731 /**
34732  * The value to be sent to the holder, or zero if the output will be omitted
34733  */
34734 MUST_USE_RES uint64_t ClosingTransaction_to_holder_value_sat(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
34735
34736 /**
34737  * The value to be sent to the counterparty, or zero if the output will be omitted
34738  */
34739 MUST_USE_RES uint64_t ClosingTransaction_to_counterparty_value_sat(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
34740
34741 /**
34742  * The destination of the holder's output
34743  */
34744 MUST_USE_RES struct LDKu8slice ClosingTransaction_to_holder_script(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
34745
34746 /**
34747  * The destination of the counterparty's output
34748  */
34749 MUST_USE_RES struct LDKu8slice ClosingTransaction_to_counterparty_script(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
34750
34751 /**
34752  * Frees any resources used by the TrustedClosingTransaction, if is_owned is set and inner is non-NULL.
34753  */
34754 void TrustedClosingTransaction_free(struct LDKTrustedClosingTransaction this_obj);
34755
34756 /**
34757  * The pre-built Bitcoin commitment transaction
34758  */
34759 MUST_USE_RES struct LDKTransaction TrustedClosingTransaction_built_transaction(const struct LDKTrustedClosingTransaction *NONNULL_PTR this_arg);
34760
34761 /**
34762  * Get the SIGHASH_ALL sighash value of the transaction.
34763  *
34764  * This can be used to verify a signature.
34765  */
34766 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);
34767
34768 /**
34769  * Sign a transaction, either because we are counter-signing the counterparty's transaction or
34770  * because we are about to broadcast a holder transaction.
34771  */
34772 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);
34773
34774 /**
34775  * Frees any resources used by the CommitmentTransaction, if is_owned is set and inner is non-NULL.
34776  */
34777 void CommitmentTransaction_free(struct LDKCommitmentTransaction this_obj);
34778
34779 /**
34780  * Creates a copy of the CommitmentTransaction
34781  */
34782 struct LDKCommitmentTransaction CommitmentTransaction_clone(const struct LDKCommitmentTransaction *NONNULL_PTR orig);
34783
34784 /**
34785  * Serialize the CommitmentTransaction object into a byte array which can be read by CommitmentTransaction_read
34786  */
34787 struct LDKCVec_u8Z CommitmentTransaction_write(const struct LDKCommitmentTransaction *NONNULL_PTR obj);
34788
34789 /**
34790  * Read a CommitmentTransaction from a byte array, created by CommitmentTransaction_write
34791  */
34792 struct LDKCResult_CommitmentTransactionDecodeErrorZ CommitmentTransaction_read(struct LDKu8slice ser);
34793
34794 /**
34795  * The backwards-counting commitment number
34796  */
34797 MUST_USE_RES uint64_t CommitmentTransaction_commitment_number(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
34798
34799 /**
34800  * The value to be sent to the broadcaster
34801  */
34802 MUST_USE_RES uint64_t CommitmentTransaction_to_broadcaster_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
34803
34804 /**
34805  * The value to be sent to the counterparty
34806  */
34807 MUST_USE_RES uint64_t CommitmentTransaction_to_countersignatory_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
34808
34809 /**
34810  * The feerate paid per 1000-weight-unit in this commitment transaction.
34811  */
34812 MUST_USE_RES uint32_t CommitmentTransaction_feerate_per_kw(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
34813
34814 /**
34815  * Trust our pre-built transaction and derived transaction creation public keys.
34816  *
34817  * Applies a wrapper which allows access to these fields.
34818  *
34819  * This should only be used if you fully trust the builder of this object.  It should not
34820  * be used by an external signer - instead use the verify function.
34821  */
34822 MUST_USE_RES struct LDKTrustedCommitmentTransaction CommitmentTransaction_trust(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
34823
34824 /**
34825  * Verify our pre-built transaction and derived transaction creation public keys.
34826  *
34827  * Applies a wrapper which allows access to these fields.
34828  *
34829  * An external validating signer must call this method before signing
34830  * or using the built transaction.
34831  */
34832 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);
34833
34834 /**
34835  * Frees any resources used by the TrustedCommitmentTransaction, if is_owned is set and inner is non-NULL.
34836  */
34837 void TrustedCommitmentTransaction_free(struct LDKTrustedCommitmentTransaction this_obj);
34838
34839 /**
34840  * The transaction ID of the built Bitcoin transaction
34841  */
34842 MUST_USE_RES struct LDKThirtyTwoBytes TrustedCommitmentTransaction_txid(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
34843
34844 /**
34845  * The pre-built Bitcoin commitment transaction
34846  */
34847 MUST_USE_RES struct LDKBuiltCommitmentTransaction TrustedCommitmentTransaction_built_transaction(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
34848
34849 /**
34850  * The pre-calculated transaction creation public keys.
34851  */
34852 MUST_USE_RES struct LDKTxCreationKeys TrustedCommitmentTransaction_keys(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
34853
34854 /**
34855  * Should anchors be used.
34856  */
34857 MUST_USE_RES struct LDKChannelTypeFeatures TrustedCommitmentTransaction_channel_type_features(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
34858
34859 /**
34860  * Get a signature for each HTLC which was included in the commitment transaction (ie for
34861  * which HTLCOutputInCommitment::transaction_output_index.is_some()).
34862  *
34863  * The returned Vec has one entry for each HTLC, and in the same order.
34864  *
34865  * This function is only valid in the holder commitment context, it always uses EcdsaSighashType::All.
34866  */
34867 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);
34868
34869 /**
34870  * Commitment transaction numbers which appear in the transactions themselves are XOR'd with a
34871  * shared secret first. This prevents on-chain observers from discovering how many commitment
34872  * transactions occurred in a channel before it was closed.
34873  *
34874  * This function gets the shared secret from relevant channel public keys and can be used to
34875  * \"decrypt\" the commitment transaction number given a commitment transaction on-chain.
34876  */
34877 uint64_t get_commitment_transaction_number_obscure_factor(struct LDKPublicKey broadcaster_payment_basepoint, struct LDKPublicKey countersignatory_payment_basepoint, bool outbound_from_broadcaster);
34878
34879 /**
34880  * Checks if two InitFeaturess contain equal inner contents.
34881  * This ignores pointers and is_owned flags and looks at the values in fields.
34882  * Two objects with NULL inner values will be considered "equal" here.
34883  */
34884 bool InitFeatures_eq(const struct LDKInitFeatures *NONNULL_PTR a, const struct LDKInitFeatures *NONNULL_PTR b);
34885
34886 /**
34887  * Checks if two NodeFeaturess contain equal inner contents.
34888  * This ignores pointers and is_owned flags and looks at the values in fields.
34889  * Two objects with NULL inner values will be considered "equal" here.
34890  */
34891 bool NodeFeatures_eq(const struct LDKNodeFeatures *NONNULL_PTR a, const struct LDKNodeFeatures *NONNULL_PTR b);
34892
34893 /**
34894  * Checks if two ChannelFeaturess contain equal inner contents.
34895  * This ignores pointers and is_owned flags and looks at the values in fields.
34896  * Two objects with NULL inner values will be considered "equal" here.
34897  */
34898 bool ChannelFeatures_eq(const struct LDKChannelFeatures *NONNULL_PTR a, const struct LDKChannelFeatures *NONNULL_PTR b);
34899
34900 /**
34901  * Checks if two Bolt11InvoiceFeaturess contain equal inner contents.
34902  * This ignores pointers and is_owned flags and looks at the values in fields.
34903  * Two objects with NULL inner values will be considered "equal" here.
34904  */
34905 bool Bolt11InvoiceFeatures_eq(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR a, const struct LDKBolt11InvoiceFeatures *NONNULL_PTR b);
34906
34907 /**
34908  * Checks if two OfferFeaturess contain equal inner contents.
34909  * This ignores pointers and is_owned flags and looks at the values in fields.
34910  * Two objects with NULL inner values will be considered "equal" here.
34911  */
34912 bool OfferFeatures_eq(const struct LDKOfferFeatures *NONNULL_PTR a, const struct LDKOfferFeatures *NONNULL_PTR b);
34913
34914 /**
34915  * Checks if two InvoiceRequestFeaturess contain equal inner contents.
34916  * This ignores pointers and is_owned flags and looks at the values in fields.
34917  * Two objects with NULL inner values will be considered "equal" here.
34918  */
34919 bool InvoiceRequestFeatures_eq(const struct LDKInvoiceRequestFeatures *NONNULL_PTR a, const struct LDKInvoiceRequestFeatures *NONNULL_PTR b);
34920
34921 /**
34922  * Checks if two Bolt12InvoiceFeaturess contain equal inner contents.
34923  * This ignores pointers and is_owned flags and looks at the values in fields.
34924  * Two objects with NULL inner values will be considered "equal" here.
34925  */
34926 bool Bolt12InvoiceFeatures_eq(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR a, const struct LDKBolt12InvoiceFeatures *NONNULL_PTR b);
34927
34928 /**
34929  * Checks if two BlindedHopFeaturess contain equal inner contents.
34930  * This ignores pointers and is_owned flags and looks at the values in fields.
34931  * Two objects with NULL inner values will be considered "equal" here.
34932  */
34933 bool BlindedHopFeatures_eq(const struct LDKBlindedHopFeatures *NONNULL_PTR a, const struct LDKBlindedHopFeatures *NONNULL_PTR b);
34934
34935 /**
34936  * Checks if two ChannelTypeFeaturess contain equal inner contents.
34937  * This ignores pointers and is_owned flags and looks at the values in fields.
34938  * Two objects with NULL inner values will be considered "equal" here.
34939  */
34940 bool ChannelTypeFeatures_eq(const struct LDKChannelTypeFeatures *NONNULL_PTR a, const struct LDKChannelTypeFeatures *NONNULL_PTR b);
34941
34942 /**
34943  * Creates a copy of the InitFeatures
34944  */
34945 struct LDKInitFeatures InitFeatures_clone(const struct LDKInitFeatures *NONNULL_PTR orig);
34946
34947 /**
34948  * Creates a copy of the NodeFeatures
34949  */
34950 struct LDKNodeFeatures NodeFeatures_clone(const struct LDKNodeFeatures *NONNULL_PTR orig);
34951
34952 /**
34953  * Creates a copy of the ChannelFeatures
34954  */
34955 struct LDKChannelFeatures ChannelFeatures_clone(const struct LDKChannelFeatures *NONNULL_PTR orig);
34956
34957 /**
34958  * Creates a copy of the Bolt11InvoiceFeatures
34959  */
34960 struct LDKBolt11InvoiceFeatures Bolt11InvoiceFeatures_clone(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR orig);
34961
34962 /**
34963  * Creates a copy of the OfferFeatures
34964  */
34965 struct LDKOfferFeatures OfferFeatures_clone(const struct LDKOfferFeatures *NONNULL_PTR orig);
34966
34967 /**
34968  * Creates a copy of the InvoiceRequestFeatures
34969  */
34970 struct LDKInvoiceRequestFeatures InvoiceRequestFeatures_clone(const struct LDKInvoiceRequestFeatures *NONNULL_PTR orig);
34971
34972 /**
34973  * Creates a copy of the Bolt12InvoiceFeatures
34974  */
34975 struct LDKBolt12InvoiceFeatures Bolt12InvoiceFeatures_clone(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR orig);
34976
34977 /**
34978  * Creates a copy of the BlindedHopFeatures
34979  */
34980 struct LDKBlindedHopFeatures BlindedHopFeatures_clone(const struct LDKBlindedHopFeatures *NONNULL_PTR orig);
34981
34982 /**
34983  * Creates a copy of the ChannelTypeFeatures
34984  */
34985 struct LDKChannelTypeFeatures ChannelTypeFeatures_clone(const struct LDKChannelTypeFeatures *NONNULL_PTR orig);
34986
34987 /**
34988  * Frees any resources used by the InitFeatures, if is_owned is set and inner is non-NULL.
34989  */
34990 void InitFeatures_free(struct LDKInitFeatures this_obj);
34991
34992 /**
34993  * Frees any resources used by the NodeFeatures, if is_owned is set and inner is non-NULL.
34994  */
34995 void NodeFeatures_free(struct LDKNodeFeatures this_obj);
34996
34997 /**
34998  * Frees any resources used by the ChannelFeatures, if is_owned is set and inner is non-NULL.
34999  */
35000 void ChannelFeatures_free(struct LDKChannelFeatures this_obj);
35001
35002 /**
35003  * Frees any resources used by the Bolt11InvoiceFeatures, if is_owned is set and inner is non-NULL.
35004  */
35005 void Bolt11InvoiceFeatures_free(struct LDKBolt11InvoiceFeatures this_obj);
35006
35007 /**
35008  * Frees any resources used by the OfferFeatures, if is_owned is set and inner is non-NULL.
35009  */
35010 void OfferFeatures_free(struct LDKOfferFeatures this_obj);
35011
35012 /**
35013  * Frees any resources used by the InvoiceRequestFeatures, if is_owned is set and inner is non-NULL.
35014  */
35015 void InvoiceRequestFeatures_free(struct LDKInvoiceRequestFeatures this_obj);
35016
35017 /**
35018  * Frees any resources used by the Bolt12InvoiceFeatures, if is_owned is set and inner is non-NULL.
35019  */
35020 void Bolt12InvoiceFeatures_free(struct LDKBolt12InvoiceFeatures this_obj);
35021
35022 /**
35023  * Frees any resources used by the BlindedHopFeatures, if is_owned is set and inner is non-NULL.
35024  */
35025 void BlindedHopFeatures_free(struct LDKBlindedHopFeatures this_obj);
35026
35027 /**
35028  * Frees any resources used by the ChannelTypeFeatures, if is_owned is set and inner is non-NULL.
35029  */
35030 void ChannelTypeFeatures_free(struct LDKChannelTypeFeatures this_obj);
35031
35032 /**
35033  * Create a blank Features with no features set
35034  */
35035 MUST_USE_RES struct LDKInitFeatures InitFeatures_empty(void);
35036
35037 /**
35038  * Returns true if this `Features` object contains required features unknown by `other`.
35039  */
35040 MUST_USE_RES bool InitFeatures_requires_unknown_bits_from(const struct LDKInitFeatures *NONNULL_PTR this_arg, const struct LDKInitFeatures *NONNULL_PTR other);
35041
35042 /**
35043  * Returns true if this `Features` object contains unknown feature flags which are set as
35044  * \"required\".
35045  */
35046 MUST_USE_RES bool InitFeatures_requires_unknown_bits(const struct LDKInitFeatures *NONNULL_PTR this_arg);
35047
35048 /**
35049  * Sets a required custom feature bit. Errors if `bit` is outside the custom range as defined
35050  * by [bLIP 2] or if it is a known `T` feature.
35051  *
35052  * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will
35053  * be set instead (i.e., `bit - 1`).
35054  *
35055  * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits
35056  */
35057 MUST_USE_RES struct LDKCResult_NoneNoneZ InitFeatures_set_required_custom_bit(struct LDKInitFeatures *NONNULL_PTR this_arg, uintptr_t bit);
35058
35059 /**
35060  * Sets an optional custom feature bit. Errors if `bit` is outside the custom range as defined
35061  * by [bLIP 2] or if it is a known `T` feature.
35062  *
35063  * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be
35064  * set instead (i.e., `bit + 1`).
35065  *
35066  * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits
35067  */
35068 MUST_USE_RES struct LDKCResult_NoneNoneZ InitFeatures_set_optional_custom_bit(struct LDKInitFeatures *NONNULL_PTR this_arg, uintptr_t bit);
35069
35070 /**
35071  * Create a blank Features with no features set
35072  */
35073 MUST_USE_RES struct LDKNodeFeatures NodeFeatures_empty(void);
35074
35075 /**
35076  * Returns true if this `Features` object contains required features unknown by `other`.
35077  */
35078 MUST_USE_RES bool NodeFeatures_requires_unknown_bits_from(const struct LDKNodeFeatures *NONNULL_PTR this_arg, const struct LDKNodeFeatures *NONNULL_PTR other);
35079
35080 /**
35081  * Returns true if this `Features` object contains unknown feature flags which are set as
35082  * \"required\".
35083  */
35084 MUST_USE_RES bool NodeFeatures_requires_unknown_bits(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
35085
35086 /**
35087  * Sets a required custom feature bit. Errors if `bit` is outside the custom range as defined
35088  * by [bLIP 2] or if it is a known `T` feature.
35089  *
35090  * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will
35091  * be set instead (i.e., `bit - 1`).
35092  *
35093  * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits
35094  */
35095 MUST_USE_RES struct LDKCResult_NoneNoneZ NodeFeatures_set_required_custom_bit(struct LDKNodeFeatures *NONNULL_PTR this_arg, uintptr_t bit);
35096
35097 /**
35098  * Sets an optional custom feature bit. Errors if `bit` is outside the custom range as defined
35099  * by [bLIP 2] or if it is a known `T` feature.
35100  *
35101  * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be
35102  * set instead (i.e., `bit + 1`).
35103  *
35104  * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits
35105  */
35106 MUST_USE_RES struct LDKCResult_NoneNoneZ NodeFeatures_set_optional_custom_bit(struct LDKNodeFeatures *NONNULL_PTR this_arg, uintptr_t bit);
35107
35108 /**
35109  * Create a blank Features with no features set
35110  */
35111 MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_empty(void);
35112
35113 /**
35114  * Returns true if this `Features` object contains required features unknown by `other`.
35115  */
35116 MUST_USE_RES bool ChannelFeatures_requires_unknown_bits_from(const struct LDKChannelFeatures *NONNULL_PTR this_arg, const struct LDKChannelFeatures *NONNULL_PTR other);
35117
35118 /**
35119  * Returns true if this `Features` object contains unknown feature flags which are set as
35120  * \"required\".
35121  */
35122 MUST_USE_RES bool ChannelFeatures_requires_unknown_bits(const struct LDKChannelFeatures *NONNULL_PTR this_arg);
35123
35124 /**
35125  * Sets a required custom feature bit. Errors if `bit` is outside the custom range as defined
35126  * by [bLIP 2] or if it is a known `T` feature.
35127  *
35128  * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will
35129  * be set instead (i.e., `bit - 1`).
35130  *
35131  * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits
35132  */
35133 MUST_USE_RES struct LDKCResult_NoneNoneZ ChannelFeatures_set_required_custom_bit(struct LDKChannelFeatures *NONNULL_PTR this_arg, uintptr_t bit);
35134
35135 /**
35136  * Sets an optional custom feature bit. Errors if `bit` is outside the custom range as defined
35137  * by [bLIP 2] or if it is a known `T` feature.
35138  *
35139  * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be
35140  * set instead (i.e., `bit + 1`).
35141  *
35142  * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits
35143  */
35144 MUST_USE_RES struct LDKCResult_NoneNoneZ ChannelFeatures_set_optional_custom_bit(struct LDKChannelFeatures *NONNULL_PTR this_arg, uintptr_t bit);
35145
35146 /**
35147  * Create a blank Features with no features set
35148  */
35149 MUST_USE_RES struct LDKBolt11InvoiceFeatures Bolt11InvoiceFeatures_empty(void);
35150
35151 /**
35152  * Returns true if this `Features` object contains required features unknown by `other`.
35153  */
35154 MUST_USE_RES bool Bolt11InvoiceFeatures_requires_unknown_bits_from(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg, const struct LDKBolt11InvoiceFeatures *NONNULL_PTR other);
35155
35156 /**
35157  * Returns true if this `Features` object contains unknown feature flags which are set as
35158  * \"required\".
35159  */
35160 MUST_USE_RES bool Bolt11InvoiceFeatures_requires_unknown_bits(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg);
35161
35162 /**
35163  * Sets a required custom feature bit. Errors if `bit` is outside the custom range as defined
35164  * by [bLIP 2] or if it is a known `T` feature.
35165  *
35166  * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will
35167  * be set instead (i.e., `bit - 1`).
35168  *
35169  * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits
35170  */
35171 MUST_USE_RES struct LDKCResult_NoneNoneZ Bolt11InvoiceFeatures_set_required_custom_bit(struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg, uintptr_t bit);
35172
35173 /**
35174  * Sets an optional custom feature bit. Errors if `bit` is outside the custom range as defined
35175  * by [bLIP 2] or if it is a known `T` feature.
35176  *
35177  * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be
35178  * set instead (i.e., `bit + 1`).
35179  *
35180  * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits
35181  */
35182 MUST_USE_RES struct LDKCResult_NoneNoneZ Bolt11InvoiceFeatures_set_optional_custom_bit(struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg, uintptr_t bit);
35183
35184 /**
35185  * Create a blank Features with no features set
35186  */
35187 MUST_USE_RES struct LDKOfferFeatures OfferFeatures_empty(void);
35188
35189 /**
35190  * Returns true if this `Features` object contains required features unknown by `other`.
35191  */
35192 MUST_USE_RES bool OfferFeatures_requires_unknown_bits_from(const struct LDKOfferFeatures *NONNULL_PTR this_arg, const struct LDKOfferFeatures *NONNULL_PTR other);
35193
35194 /**
35195  * Returns true if this `Features` object contains unknown feature flags which are set as
35196  * \"required\".
35197  */
35198 MUST_USE_RES bool OfferFeatures_requires_unknown_bits(const struct LDKOfferFeatures *NONNULL_PTR this_arg);
35199
35200 /**
35201  * Sets a required custom feature bit. Errors if `bit` is outside the custom range as defined
35202  * by [bLIP 2] or if it is a known `T` feature.
35203  *
35204  * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will
35205  * be set instead (i.e., `bit - 1`).
35206  *
35207  * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits
35208  */
35209 MUST_USE_RES struct LDKCResult_NoneNoneZ OfferFeatures_set_required_custom_bit(struct LDKOfferFeatures *NONNULL_PTR this_arg, uintptr_t bit);
35210
35211 /**
35212  * Sets an optional custom feature bit. Errors if `bit` is outside the custom range as defined
35213  * by [bLIP 2] or if it is a known `T` feature.
35214  *
35215  * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be
35216  * set instead (i.e., `bit + 1`).
35217  *
35218  * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits
35219  */
35220 MUST_USE_RES struct LDKCResult_NoneNoneZ OfferFeatures_set_optional_custom_bit(struct LDKOfferFeatures *NONNULL_PTR this_arg, uintptr_t bit);
35221
35222 /**
35223  * Create a blank Features with no features set
35224  */
35225 MUST_USE_RES struct LDKInvoiceRequestFeatures InvoiceRequestFeatures_empty(void);
35226
35227 /**
35228  * Returns true if this `Features` object contains required features unknown by `other`.
35229  */
35230 MUST_USE_RES bool InvoiceRequestFeatures_requires_unknown_bits_from(const struct LDKInvoiceRequestFeatures *NONNULL_PTR this_arg, const struct LDKInvoiceRequestFeatures *NONNULL_PTR other);
35231
35232 /**
35233  * Returns true if this `Features` object contains unknown feature flags which are set as
35234  * \"required\".
35235  */
35236 MUST_USE_RES bool InvoiceRequestFeatures_requires_unknown_bits(const struct LDKInvoiceRequestFeatures *NONNULL_PTR this_arg);
35237
35238 /**
35239  * Sets a required custom feature bit. Errors if `bit` is outside the custom range as defined
35240  * by [bLIP 2] or if it is a known `T` feature.
35241  *
35242  * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will
35243  * be set instead (i.e., `bit - 1`).
35244  *
35245  * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits
35246  */
35247 MUST_USE_RES struct LDKCResult_NoneNoneZ InvoiceRequestFeatures_set_required_custom_bit(struct LDKInvoiceRequestFeatures *NONNULL_PTR this_arg, uintptr_t bit);
35248
35249 /**
35250  * Sets an optional custom feature bit. Errors if `bit` is outside the custom range as defined
35251  * by [bLIP 2] or if it is a known `T` feature.
35252  *
35253  * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be
35254  * set instead (i.e., `bit + 1`).
35255  *
35256  * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits
35257  */
35258 MUST_USE_RES struct LDKCResult_NoneNoneZ InvoiceRequestFeatures_set_optional_custom_bit(struct LDKInvoiceRequestFeatures *NONNULL_PTR this_arg, uintptr_t bit);
35259
35260 /**
35261  * Create a blank Features with no features set
35262  */
35263 MUST_USE_RES struct LDKBolt12InvoiceFeatures Bolt12InvoiceFeatures_empty(void);
35264
35265 /**
35266  * Returns true if this `Features` object contains required features unknown by `other`.
35267  */
35268 MUST_USE_RES bool Bolt12InvoiceFeatures_requires_unknown_bits_from(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg, const struct LDKBolt12InvoiceFeatures *NONNULL_PTR other);
35269
35270 /**
35271  * Returns true if this `Features` object contains unknown feature flags which are set as
35272  * \"required\".
35273  */
35274 MUST_USE_RES bool Bolt12InvoiceFeatures_requires_unknown_bits(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg);
35275
35276 /**
35277  * Sets a required custom feature bit. Errors if `bit` is outside the custom range as defined
35278  * by [bLIP 2] or if it is a known `T` feature.
35279  *
35280  * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will
35281  * be set instead (i.e., `bit - 1`).
35282  *
35283  * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits
35284  */
35285 MUST_USE_RES struct LDKCResult_NoneNoneZ Bolt12InvoiceFeatures_set_required_custom_bit(struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg, uintptr_t bit);
35286
35287 /**
35288  * Sets an optional custom feature bit. Errors if `bit` is outside the custom range as defined
35289  * by [bLIP 2] or if it is a known `T` feature.
35290  *
35291  * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be
35292  * set instead (i.e., `bit + 1`).
35293  *
35294  * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits
35295  */
35296 MUST_USE_RES struct LDKCResult_NoneNoneZ Bolt12InvoiceFeatures_set_optional_custom_bit(struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg, uintptr_t bit);
35297
35298 /**
35299  * Create a blank Features with no features set
35300  */
35301 MUST_USE_RES struct LDKBlindedHopFeatures BlindedHopFeatures_empty(void);
35302
35303 /**
35304  * Returns true if this `Features` object contains required features unknown by `other`.
35305  */
35306 MUST_USE_RES bool BlindedHopFeatures_requires_unknown_bits_from(const struct LDKBlindedHopFeatures *NONNULL_PTR this_arg, const struct LDKBlindedHopFeatures *NONNULL_PTR other);
35307
35308 /**
35309  * Returns true if this `Features` object contains unknown feature flags which are set as
35310  * \"required\".
35311  */
35312 MUST_USE_RES bool BlindedHopFeatures_requires_unknown_bits(const struct LDKBlindedHopFeatures *NONNULL_PTR this_arg);
35313
35314 /**
35315  * Sets a required custom feature bit. Errors if `bit` is outside the custom range as defined
35316  * by [bLIP 2] or if it is a known `T` feature.
35317  *
35318  * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will
35319  * be set instead (i.e., `bit - 1`).
35320  *
35321  * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits
35322  */
35323 MUST_USE_RES struct LDKCResult_NoneNoneZ BlindedHopFeatures_set_required_custom_bit(struct LDKBlindedHopFeatures *NONNULL_PTR this_arg, uintptr_t bit);
35324
35325 /**
35326  * Sets an optional custom feature bit. Errors if `bit` is outside the custom range as defined
35327  * by [bLIP 2] or if it is a known `T` feature.
35328  *
35329  * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be
35330  * set instead (i.e., `bit + 1`).
35331  *
35332  * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits
35333  */
35334 MUST_USE_RES struct LDKCResult_NoneNoneZ BlindedHopFeatures_set_optional_custom_bit(struct LDKBlindedHopFeatures *NONNULL_PTR this_arg, uintptr_t bit);
35335
35336 /**
35337  * Create a blank Features with no features set
35338  */
35339 MUST_USE_RES struct LDKChannelTypeFeatures ChannelTypeFeatures_empty(void);
35340
35341 /**
35342  * Returns true if this `Features` object contains required features unknown by `other`.
35343  */
35344 MUST_USE_RES bool ChannelTypeFeatures_requires_unknown_bits_from(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg, const struct LDKChannelTypeFeatures *NONNULL_PTR other);
35345
35346 /**
35347  * Returns true if this `Features` object contains unknown feature flags which are set as
35348  * \"required\".
35349  */
35350 MUST_USE_RES bool ChannelTypeFeatures_requires_unknown_bits(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
35351
35352 /**
35353  * Sets a required custom feature bit. Errors if `bit` is outside the custom range as defined
35354  * by [bLIP 2] or if it is a known `T` feature.
35355  *
35356  * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will
35357  * be set instead (i.e., `bit - 1`).
35358  *
35359  * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits
35360  */
35361 MUST_USE_RES struct LDKCResult_NoneNoneZ ChannelTypeFeatures_set_required_custom_bit(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg, uintptr_t bit);
35362
35363 /**
35364  * Sets an optional custom feature bit. Errors if `bit` is outside the custom range as defined
35365  * by [bLIP 2] or if it is a known `T` feature.
35366  *
35367  * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be
35368  * set instead (i.e., `bit + 1`).
35369  *
35370  * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits
35371  */
35372 MUST_USE_RES struct LDKCResult_NoneNoneZ ChannelTypeFeatures_set_optional_custom_bit(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg, uintptr_t bit);
35373
35374 /**
35375  * Serialize the InitFeatures object into a byte array which can be read by InitFeatures_read
35376  */
35377 struct LDKCVec_u8Z InitFeatures_write(const struct LDKInitFeatures *NONNULL_PTR obj);
35378
35379 /**
35380  * Read a InitFeatures from a byte array, created by InitFeatures_write
35381  */
35382 struct LDKCResult_InitFeaturesDecodeErrorZ InitFeatures_read(struct LDKu8slice ser);
35383
35384 /**
35385  * Serialize the ChannelFeatures object into a byte array which can be read by ChannelFeatures_read
35386  */
35387 struct LDKCVec_u8Z ChannelFeatures_write(const struct LDKChannelFeatures *NONNULL_PTR obj);
35388
35389 /**
35390  * Read a ChannelFeatures from a byte array, created by ChannelFeatures_write
35391  */
35392 struct LDKCResult_ChannelFeaturesDecodeErrorZ ChannelFeatures_read(struct LDKu8slice ser);
35393
35394 /**
35395  * Serialize the NodeFeatures object into a byte array which can be read by NodeFeatures_read
35396  */
35397 struct LDKCVec_u8Z NodeFeatures_write(const struct LDKNodeFeatures *NONNULL_PTR obj);
35398
35399 /**
35400  * Read a NodeFeatures from a byte array, created by NodeFeatures_write
35401  */
35402 struct LDKCResult_NodeFeaturesDecodeErrorZ NodeFeatures_read(struct LDKu8slice ser);
35403
35404 /**
35405  * Serialize the Bolt11InvoiceFeatures object into a byte array which can be read by Bolt11InvoiceFeatures_read
35406  */
35407 struct LDKCVec_u8Z Bolt11InvoiceFeatures_write(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR obj);
35408
35409 /**
35410  * Read a Bolt11InvoiceFeatures from a byte array, created by Bolt11InvoiceFeatures_write
35411  */
35412 struct LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ Bolt11InvoiceFeatures_read(struct LDKu8slice ser);
35413
35414 /**
35415  * Serialize the Bolt12InvoiceFeatures object into a byte array which can be read by Bolt12InvoiceFeatures_read
35416  */
35417 struct LDKCVec_u8Z Bolt12InvoiceFeatures_write(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR obj);
35418
35419 /**
35420  * Read a Bolt12InvoiceFeatures from a byte array, created by Bolt12InvoiceFeatures_write
35421  */
35422 struct LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ Bolt12InvoiceFeatures_read(struct LDKu8slice ser);
35423
35424 /**
35425  * Serialize the BlindedHopFeatures object into a byte array which can be read by BlindedHopFeatures_read
35426  */
35427 struct LDKCVec_u8Z BlindedHopFeatures_write(const struct LDKBlindedHopFeatures *NONNULL_PTR obj);
35428
35429 /**
35430  * Read a BlindedHopFeatures from a byte array, created by BlindedHopFeatures_write
35431  */
35432 struct LDKCResult_BlindedHopFeaturesDecodeErrorZ BlindedHopFeatures_read(struct LDKu8slice ser);
35433
35434 /**
35435  * Serialize the ChannelTypeFeatures object into a byte array which can be read by ChannelTypeFeatures_read
35436  */
35437 struct LDKCVec_u8Z ChannelTypeFeatures_write(const struct LDKChannelTypeFeatures *NONNULL_PTR obj);
35438
35439 /**
35440  * Read a ChannelTypeFeatures from a byte array, created by ChannelTypeFeatures_write
35441  */
35442 struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ ChannelTypeFeatures_read(struct LDKu8slice ser);
35443
35444 /**
35445  * Set this feature as optional.
35446  */
35447 void InitFeatures_set_data_loss_protect_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
35448
35449 /**
35450  * Set this feature as required.
35451  */
35452 void InitFeatures_set_data_loss_protect_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
35453
35454 /**
35455  * Checks if this feature is supported.
35456  */
35457 MUST_USE_RES bool InitFeatures_supports_data_loss_protect(const struct LDKInitFeatures *NONNULL_PTR this_arg);
35458
35459 /**
35460  * Set this feature as optional.
35461  */
35462 void NodeFeatures_set_data_loss_protect_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
35463
35464 /**
35465  * Set this feature as required.
35466  */
35467 void NodeFeatures_set_data_loss_protect_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
35468
35469 /**
35470  * Checks if this feature is supported.
35471  */
35472 MUST_USE_RES bool NodeFeatures_supports_data_loss_protect(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
35473
35474 /**
35475  * Checks if this feature is required.
35476  */
35477 MUST_USE_RES bool InitFeatures_requires_data_loss_protect(const struct LDKInitFeatures *NONNULL_PTR this_arg);
35478
35479 /**
35480  * Checks if this feature is required.
35481  */
35482 MUST_USE_RES bool NodeFeatures_requires_data_loss_protect(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
35483
35484 /**
35485  * Set this feature as optional.
35486  */
35487 void InitFeatures_set_initial_routing_sync_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
35488
35489 /**
35490  * Set this feature as required.
35491  */
35492 void InitFeatures_set_initial_routing_sync_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
35493
35494 /**
35495  * Checks if this feature is supported.
35496  */
35497 MUST_USE_RES bool InitFeatures_initial_routing_sync(const struct LDKInitFeatures *NONNULL_PTR this_arg);
35498
35499 /**
35500  * Set this feature as optional.
35501  */
35502 void InitFeatures_set_upfront_shutdown_script_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
35503
35504 /**
35505  * Set this feature as required.
35506  */
35507 void InitFeatures_set_upfront_shutdown_script_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
35508
35509 /**
35510  * Checks if this feature is supported.
35511  */
35512 MUST_USE_RES bool InitFeatures_supports_upfront_shutdown_script(const struct LDKInitFeatures *NONNULL_PTR this_arg);
35513
35514 /**
35515  * Set this feature as optional.
35516  */
35517 void NodeFeatures_set_upfront_shutdown_script_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
35518
35519 /**
35520  * Set this feature as required.
35521  */
35522 void NodeFeatures_set_upfront_shutdown_script_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
35523
35524 /**
35525  * Checks if this feature is supported.
35526  */
35527 MUST_USE_RES bool NodeFeatures_supports_upfront_shutdown_script(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
35528
35529 /**
35530  * Checks if this feature is required.
35531  */
35532 MUST_USE_RES bool InitFeatures_requires_upfront_shutdown_script(const struct LDKInitFeatures *NONNULL_PTR this_arg);
35533
35534 /**
35535  * Checks if this feature is required.
35536  */
35537 MUST_USE_RES bool NodeFeatures_requires_upfront_shutdown_script(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
35538
35539 /**
35540  * Set this feature as optional.
35541  */
35542 void InitFeatures_set_gossip_queries_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
35543
35544 /**
35545  * Set this feature as required.
35546  */
35547 void InitFeatures_set_gossip_queries_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
35548
35549 /**
35550  * Checks if this feature is supported.
35551  */
35552 MUST_USE_RES bool InitFeatures_supports_gossip_queries(const struct LDKInitFeatures *NONNULL_PTR this_arg);
35553
35554 /**
35555  * Set this feature as optional.
35556  */
35557 void NodeFeatures_set_gossip_queries_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
35558
35559 /**
35560  * Set this feature as required.
35561  */
35562 void NodeFeatures_set_gossip_queries_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
35563
35564 /**
35565  * Checks if this feature is supported.
35566  */
35567 MUST_USE_RES bool NodeFeatures_supports_gossip_queries(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
35568
35569 /**
35570  * Checks if this feature is required.
35571  */
35572 MUST_USE_RES bool InitFeatures_requires_gossip_queries(const struct LDKInitFeatures *NONNULL_PTR this_arg);
35573
35574 /**
35575  * Checks if this feature is required.
35576  */
35577 MUST_USE_RES bool NodeFeatures_requires_gossip_queries(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
35578
35579 /**
35580  * Set this feature as optional.
35581  */
35582 void InitFeatures_set_variable_length_onion_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
35583
35584 /**
35585  * Set this feature as required.
35586  */
35587 void InitFeatures_set_variable_length_onion_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
35588
35589 /**
35590  * Checks if this feature is supported.
35591  */
35592 MUST_USE_RES bool InitFeatures_supports_variable_length_onion(const struct LDKInitFeatures *NONNULL_PTR this_arg);
35593
35594 /**
35595  * Set this feature as optional.
35596  */
35597 void NodeFeatures_set_variable_length_onion_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
35598
35599 /**
35600  * Set this feature as required.
35601  */
35602 void NodeFeatures_set_variable_length_onion_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
35603
35604 /**
35605  * Checks if this feature is supported.
35606  */
35607 MUST_USE_RES bool NodeFeatures_supports_variable_length_onion(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
35608
35609 /**
35610  * Set this feature as optional.
35611  */
35612 void Bolt11InvoiceFeatures_set_variable_length_onion_optional(struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg);
35613
35614 /**
35615  * Set this feature as required.
35616  */
35617 void Bolt11InvoiceFeatures_set_variable_length_onion_required(struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg);
35618
35619 /**
35620  * Checks if this feature is supported.
35621  */
35622 MUST_USE_RES bool Bolt11InvoiceFeatures_supports_variable_length_onion(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg);
35623
35624 /**
35625  * Checks if this feature is required.
35626  */
35627 MUST_USE_RES bool InitFeatures_requires_variable_length_onion(const struct LDKInitFeatures *NONNULL_PTR this_arg);
35628
35629 /**
35630  * Checks if this feature is required.
35631  */
35632 MUST_USE_RES bool NodeFeatures_requires_variable_length_onion(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
35633
35634 /**
35635  * Checks if this feature is required.
35636  */
35637 MUST_USE_RES bool Bolt11InvoiceFeatures_requires_variable_length_onion(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg);
35638
35639 /**
35640  * Set this feature as optional.
35641  */
35642 void InitFeatures_set_static_remote_key_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
35643
35644 /**
35645  * Set this feature as required.
35646  */
35647 void InitFeatures_set_static_remote_key_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
35648
35649 /**
35650  * Checks if this feature is supported.
35651  */
35652 MUST_USE_RES bool InitFeatures_supports_static_remote_key(const struct LDKInitFeatures *NONNULL_PTR this_arg);
35653
35654 /**
35655  * Set this feature as optional.
35656  */
35657 void NodeFeatures_set_static_remote_key_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
35658
35659 /**
35660  * Set this feature as required.
35661  */
35662 void NodeFeatures_set_static_remote_key_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
35663
35664 /**
35665  * Checks if this feature is supported.
35666  */
35667 MUST_USE_RES bool NodeFeatures_supports_static_remote_key(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
35668
35669 /**
35670  * Set this feature as optional.
35671  */
35672 void ChannelTypeFeatures_set_static_remote_key_optional(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
35673
35674 /**
35675  * Set this feature as required.
35676  */
35677 void ChannelTypeFeatures_set_static_remote_key_required(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
35678
35679 /**
35680  * Checks if this feature is supported.
35681  */
35682 MUST_USE_RES bool ChannelTypeFeatures_supports_static_remote_key(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
35683
35684 /**
35685  * Checks if this feature is required.
35686  */
35687 MUST_USE_RES bool InitFeatures_requires_static_remote_key(const struct LDKInitFeatures *NONNULL_PTR this_arg);
35688
35689 /**
35690  * Checks if this feature is required.
35691  */
35692 MUST_USE_RES bool NodeFeatures_requires_static_remote_key(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
35693
35694 /**
35695  * Checks if this feature is required.
35696  */
35697 MUST_USE_RES bool ChannelTypeFeatures_requires_static_remote_key(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
35698
35699 /**
35700  * Set this feature as optional.
35701  */
35702 void InitFeatures_set_payment_secret_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
35703
35704 /**
35705  * Set this feature as required.
35706  */
35707 void InitFeatures_set_payment_secret_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
35708
35709 /**
35710  * Checks if this feature is supported.
35711  */
35712 MUST_USE_RES bool InitFeatures_supports_payment_secret(const struct LDKInitFeatures *NONNULL_PTR this_arg);
35713
35714 /**
35715  * Set this feature as optional.
35716  */
35717 void NodeFeatures_set_payment_secret_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
35718
35719 /**
35720  * Set this feature as required.
35721  */
35722 void NodeFeatures_set_payment_secret_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
35723
35724 /**
35725  * Checks if this feature is supported.
35726  */
35727 MUST_USE_RES bool NodeFeatures_supports_payment_secret(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
35728
35729 /**
35730  * Set this feature as optional.
35731  */
35732 void Bolt11InvoiceFeatures_set_payment_secret_optional(struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg);
35733
35734 /**
35735  * Set this feature as required.
35736  */
35737 void Bolt11InvoiceFeatures_set_payment_secret_required(struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg);
35738
35739 /**
35740  * Checks if this feature is supported.
35741  */
35742 MUST_USE_RES bool Bolt11InvoiceFeatures_supports_payment_secret(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg);
35743
35744 /**
35745  * Checks if this feature is required.
35746  */
35747 MUST_USE_RES bool InitFeatures_requires_payment_secret(const struct LDKInitFeatures *NONNULL_PTR this_arg);
35748
35749 /**
35750  * Checks if this feature is required.
35751  */
35752 MUST_USE_RES bool NodeFeatures_requires_payment_secret(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
35753
35754 /**
35755  * Checks if this feature is required.
35756  */
35757 MUST_USE_RES bool Bolt11InvoiceFeatures_requires_payment_secret(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg);
35758
35759 /**
35760  * Set this feature as optional.
35761  */
35762 void InitFeatures_set_basic_mpp_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
35763
35764 /**
35765  * Set this feature as required.
35766  */
35767 void InitFeatures_set_basic_mpp_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
35768
35769 /**
35770  * Checks if this feature is supported.
35771  */
35772 MUST_USE_RES bool InitFeatures_supports_basic_mpp(const struct LDKInitFeatures *NONNULL_PTR this_arg);
35773
35774 /**
35775  * Set this feature as optional.
35776  */
35777 void NodeFeatures_set_basic_mpp_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
35778
35779 /**
35780  * Set this feature as required.
35781  */
35782 void NodeFeatures_set_basic_mpp_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
35783
35784 /**
35785  * Checks if this feature is supported.
35786  */
35787 MUST_USE_RES bool NodeFeatures_supports_basic_mpp(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
35788
35789 /**
35790  * Set this feature as optional.
35791  */
35792 void Bolt11InvoiceFeatures_set_basic_mpp_optional(struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg);
35793
35794 /**
35795  * Set this feature as required.
35796  */
35797 void Bolt11InvoiceFeatures_set_basic_mpp_required(struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg);
35798
35799 /**
35800  * Checks if this feature is supported.
35801  */
35802 MUST_USE_RES bool Bolt11InvoiceFeatures_supports_basic_mpp(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg);
35803
35804 /**
35805  * Set this feature as optional.
35806  */
35807 void Bolt12InvoiceFeatures_set_basic_mpp_optional(struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg);
35808
35809 /**
35810  * Set this feature as required.
35811  */
35812 void Bolt12InvoiceFeatures_set_basic_mpp_required(struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg);
35813
35814 /**
35815  * Checks if this feature is supported.
35816  */
35817 MUST_USE_RES bool Bolt12InvoiceFeatures_supports_basic_mpp(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg);
35818
35819 /**
35820  * Checks if this feature is required.
35821  */
35822 MUST_USE_RES bool InitFeatures_requires_basic_mpp(const struct LDKInitFeatures *NONNULL_PTR this_arg);
35823
35824 /**
35825  * Checks if this feature is required.
35826  */
35827 MUST_USE_RES bool NodeFeatures_requires_basic_mpp(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
35828
35829 /**
35830  * Checks if this feature is required.
35831  */
35832 MUST_USE_RES bool Bolt11InvoiceFeatures_requires_basic_mpp(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg);
35833
35834 /**
35835  * Checks if this feature is required.
35836  */
35837 MUST_USE_RES bool Bolt12InvoiceFeatures_requires_basic_mpp(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg);
35838
35839 /**
35840  * Set this feature as optional.
35841  */
35842 void InitFeatures_set_wumbo_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
35843
35844 /**
35845  * Set this feature as required.
35846  */
35847 void InitFeatures_set_wumbo_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
35848
35849 /**
35850  * Checks if this feature is supported.
35851  */
35852 MUST_USE_RES bool InitFeatures_supports_wumbo(const struct LDKInitFeatures *NONNULL_PTR this_arg);
35853
35854 /**
35855  * Set this feature as optional.
35856  */
35857 void NodeFeatures_set_wumbo_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
35858
35859 /**
35860  * Set this feature as required.
35861  */
35862 void NodeFeatures_set_wumbo_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
35863
35864 /**
35865  * Checks if this feature is supported.
35866  */
35867 MUST_USE_RES bool NodeFeatures_supports_wumbo(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
35868
35869 /**
35870  * Checks if this feature is required.
35871  */
35872 MUST_USE_RES bool InitFeatures_requires_wumbo(const struct LDKInitFeatures *NONNULL_PTR this_arg);
35873
35874 /**
35875  * Checks if this feature is required.
35876  */
35877 MUST_USE_RES bool NodeFeatures_requires_wumbo(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
35878
35879 /**
35880  * Set this feature as optional.
35881  */
35882 void InitFeatures_set_anchors_nonzero_fee_htlc_tx_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
35883
35884 /**
35885  * Set this feature as required.
35886  */
35887 void InitFeatures_set_anchors_nonzero_fee_htlc_tx_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
35888
35889 /**
35890  * Checks if this feature is supported.
35891  */
35892 MUST_USE_RES bool InitFeatures_supports_anchors_nonzero_fee_htlc_tx(const struct LDKInitFeatures *NONNULL_PTR this_arg);
35893
35894 /**
35895  * Set this feature as optional.
35896  */
35897 void NodeFeatures_set_anchors_nonzero_fee_htlc_tx_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
35898
35899 /**
35900  * Set this feature as required.
35901  */
35902 void NodeFeatures_set_anchors_nonzero_fee_htlc_tx_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
35903
35904 /**
35905  * Checks if this feature is supported.
35906  */
35907 MUST_USE_RES bool NodeFeatures_supports_anchors_nonzero_fee_htlc_tx(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
35908
35909 /**
35910  * Set this feature as optional.
35911  */
35912 void ChannelTypeFeatures_set_anchors_nonzero_fee_htlc_tx_optional(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
35913
35914 /**
35915  * Set this feature as required.
35916  */
35917 void ChannelTypeFeatures_set_anchors_nonzero_fee_htlc_tx_required(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
35918
35919 /**
35920  * Checks if this feature is supported.
35921  */
35922 MUST_USE_RES bool ChannelTypeFeatures_supports_anchors_nonzero_fee_htlc_tx(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
35923
35924 /**
35925  * Checks if this feature is required.
35926  */
35927 MUST_USE_RES bool InitFeatures_requires_anchors_nonzero_fee_htlc_tx(const struct LDKInitFeatures *NONNULL_PTR this_arg);
35928
35929 /**
35930  * Checks if this feature is required.
35931  */
35932 MUST_USE_RES bool NodeFeatures_requires_anchors_nonzero_fee_htlc_tx(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
35933
35934 /**
35935  * Checks if this feature is required.
35936  */
35937 MUST_USE_RES bool ChannelTypeFeatures_requires_anchors_nonzero_fee_htlc_tx(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
35938
35939 /**
35940  * Set this feature as optional.
35941  */
35942 void InitFeatures_set_anchors_zero_fee_htlc_tx_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
35943
35944 /**
35945  * Set this feature as required.
35946  */
35947 void InitFeatures_set_anchors_zero_fee_htlc_tx_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
35948
35949 /**
35950  * Checks if this feature is supported.
35951  */
35952 MUST_USE_RES bool InitFeatures_supports_anchors_zero_fee_htlc_tx(const struct LDKInitFeatures *NONNULL_PTR this_arg);
35953
35954 /**
35955  * Set this feature as optional.
35956  */
35957 void NodeFeatures_set_anchors_zero_fee_htlc_tx_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
35958
35959 /**
35960  * Set this feature as required.
35961  */
35962 void NodeFeatures_set_anchors_zero_fee_htlc_tx_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
35963
35964 /**
35965  * Checks if this feature is supported.
35966  */
35967 MUST_USE_RES bool NodeFeatures_supports_anchors_zero_fee_htlc_tx(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
35968
35969 /**
35970  * Set this feature as optional.
35971  */
35972 void ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_optional(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
35973
35974 /**
35975  * Set this feature as required.
35976  */
35977 void ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_required(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
35978
35979 /**
35980  * Checks if this feature is supported.
35981  */
35982 MUST_USE_RES bool ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
35983
35984 /**
35985  * Checks if this feature is required.
35986  */
35987 MUST_USE_RES bool InitFeatures_requires_anchors_zero_fee_htlc_tx(const struct LDKInitFeatures *NONNULL_PTR this_arg);
35988
35989 /**
35990  * Checks if this feature is required.
35991  */
35992 MUST_USE_RES bool NodeFeatures_requires_anchors_zero_fee_htlc_tx(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
35993
35994 /**
35995  * Checks if this feature is required.
35996  */
35997 MUST_USE_RES bool ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
35998
35999 /**
36000  * Set this feature as optional.
36001  */
36002 void InitFeatures_set_shutdown_any_segwit_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
36003
36004 /**
36005  * Set this feature as required.
36006  */
36007 void InitFeatures_set_shutdown_any_segwit_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
36008
36009 /**
36010  * Checks if this feature is supported.
36011  */
36012 MUST_USE_RES bool InitFeatures_supports_shutdown_anysegwit(const struct LDKInitFeatures *NONNULL_PTR this_arg);
36013
36014 /**
36015  * Set this feature as optional.
36016  */
36017 void NodeFeatures_set_shutdown_any_segwit_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
36018
36019 /**
36020  * Set this feature as required.
36021  */
36022 void NodeFeatures_set_shutdown_any_segwit_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
36023
36024 /**
36025  * Checks if this feature is supported.
36026  */
36027 MUST_USE_RES bool NodeFeatures_supports_shutdown_anysegwit(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
36028
36029 /**
36030  * Checks if this feature is required.
36031  */
36032 MUST_USE_RES bool InitFeatures_requires_shutdown_anysegwit(const struct LDKInitFeatures *NONNULL_PTR this_arg);
36033
36034 /**
36035  * Checks if this feature is required.
36036  */
36037 MUST_USE_RES bool NodeFeatures_requires_shutdown_anysegwit(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
36038
36039 /**
36040  * Set this feature as optional.
36041  */
36042 void InitFeatures_set_onion_messages_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
36043
36044 /**
36045  * Set this feature as required.
36046  */
36047 void InitFeatures_set_onion_messages_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
36048
36049 /**
36050  * Checks if this feature is supported.
36051  */
36052 MUST_USE_RES bool InitFeatures_supports_onion_messages(const struct LDKInitFeatures *NONNULL_PTR this_arg);
36053
36054 /**
36055  * Set this feature as optional.
36056  */
36057 void NodeFeatures_set_onion_messages_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
36058
36059 /**
36060  * Set this feature as required.
36061  */
36062 void NodeFeatures_set_onion_messages_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
36063
36064 /**
36065  * Checks if this feature is supported.
36066  */
36067 MUST_USE_RES bool NodeFeatures_supports_onion_messages(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
36068
36069 /**
36070  * Checks if this feature is required.
36071  */
36072 MUST_USE_RES bool InitFeatures_requires_onion_messages(const struct LDKInitFeatures *NONNULL_PTR this_arg);
36073
36074 /**
36075  * Checks if this feature is required.
36076  */
36077 MUST_USE_RES bool NodeFeatures_requires_onion_messages(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
36078
36079 /**
36080  * Set this feature as optional.
36081  */
36082 void InitFeatures_set_channel_type_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
36083
36084 /**
36085  * Set this feature as required.
36086  */
36087 void InitFeatures_set_channel_type_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
36088
36089 /**
36090  * Checks if this feature is supported.
36091  */
36092 MUST_USE_RES bool InitFeatures_supports_channel_type(const struct LDKInitFeatures *NONNULL_PTR this_arg);
36093
36094 /**
36095  * Set this feature as optional.
36096  */
36097 void NodeFeatures_set_channel_type_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
36098
36099 /**
36100  * Set this feature as required.
36101  */
36102 void NodeFeatures_set_channel_type_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
36103
36104 /**
36105  * Checks if this feature is supported.
36106  */
36107 MUST_USE_RES bool NodeFeatures_supports_channel_type(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
36108
36109 /**
36110  * Checks if this feature is required.
36111  */
36112 MUST_USE_RES bool InitFeatures_requires_channel_type(const struct LDKInitFeatures *NONNULL_PTR this_arg);
36113
36114 /**
36115  * Checks if this feature is required.
36116  */
36117 MUST_USE_RES bool NodeFeatures_requires_channel_type(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
36118
36119 /**
36120  * Set this feature as optional.
36121  */
36122 void InitFeatures_set_scid_privacy_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
36123
36124 /**
36125  * Set this feature as required.
36126  */
36127 void InitFeatures_set_scid_privacy_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
36128
36129 /**
36130  * Checks if this feature is supported.
36131  */
36132 MUST_USE_RES bool InitFeatures_supports_scid_privacy(const struct LDKInitFeatures *NONNULL_PTR this_arg);
36133
36134 /**
36135  * Set this feature as optional.
36136  */
36137 void NodeFeatures_set_scid_privacy_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
36138
36139 /**
36140  * Set this feature as required.
36141  */
36142 void NodeFeatures_set_scid_privacy_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
36143
36144 /**
36145  * Checks if this feature is supported.
36146  */
36147 MUST_USE_RES bool NodeFeatures_supports_scid_privacy(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
36148
36149 /**
36150  * Set this feature as optional.
36151  */
36152 void ChannelTypeFeatures_set_scid_privacy_optional(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
36153
36154 /**
36155  * Set this feature as required.
36156  */
36157 void ChannelTypeFeatures_set_scid_privacy_required(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
36158
36159 /**
36160  * Checks if this feature is supported.
36161  */
36162 MUST_USE_RES bool ChannelTypeFeatures_supports_scid_privacy(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
36163
36164 /**
36165  * Checks if this feature is required.
36166  */
36167 MUST_USE_RES bool InitFeatures_requires_scid_privacy(const struct LDKInitFeatures *NONNULL_PTR this_arg);
36168
36169 /**
36170  * Checks if this feature is required.
36171  */
36172 MUST_USE_RES bool NodeFeatures_requires_scid_privacy(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
36173
36174 /**
36175  * Checks if this feature is required.
36176  */
36177 MUST_USE_RES bool ChannelTypeFeatures_requires_scid_privacy(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
36178
36179 /**
36180  * Set this feature as optional.
36181  */
36182 void Bolt11InvoiceFeatures_set_payment_metadata_optional(struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg);
36183
36184 /**
36185  * Set this feature as required.
36186  */
36187 void Bolt11InvoiceFeatures_set_payment_metadata_required(struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg);
36188
36189 /**
36190  * Checks if this feature is supported.
36191  */
36192 MUST_USE_RES bool Bolt11InvoiceFeatures_supports_payment_metadata(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg);
36193
36194 /**
36195  * Checks if this feature is required.
36196  */
36197 MUST_USE_RES bool Bolt11InvoiceFeatures_requires_payment_metadata(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg);
36198
36199 /**
36200  * Set this feature as optional.
36201  */
36202 void InitFeatures_set_zero_conf_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
36203
36204 /**
36205  * Set this feature as required.
36206  */
36207 void InitFeatures_set_zero_conf_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
36208
36209 /**
36210  * Checks if this feature is supported.
36211  */
36212 MUST_USE_RES bool InitFeatures_supports_zero_conf(const struct LDKInitFeatures *NONNULL_PTR this_arg);
36213
36214 /**
36215  * Set this feature as optional.
36216  */
36217 void NodeFeatures_set_zero_conf_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
36218
36219 /**
36220  * Set this feature as required.
36221  */
36222 void NodeFeatures_set_zero_conf_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
36223
36224 /**
36225  * Checks if this feature is supported.
36226  */
36227 MUST_USE_RES bool NodeFeatures_supports_zero_conf(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
36228
36229 /**
36230  * Set this feature as optional.
36231  */
36232 void ChannelTypeFeatures_set_zero_conf_optional(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
36233
36234 /**
36235  * Set this feature as required.
36236  */
36237 void ChannelTypeFeatures_set_zero_conf_required(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
36238
36239 /**
36240  * Checks if this feature is supported.
36241  */
36242 MUST_USE_RES bool ChannelTypeFeatures_supports_zero_conf(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
36243
36244 /**
36245  * Checks if this feature is required.
36246  */
36247 MUST_USE_RES bool InitFeatures_requires_zero_conf(const struct LDKInitFeatures *NONNULL_PTR this_arg);
36248
36249 /**
36250  * Checks if this feature is required.
36251  */
36252 MUST_USE_RES bool NodeFeatures_requires_zero_conf(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
36253
36254 /**
36255  * Checks if this feature is required.
36256  */
36257 MUST_USE_RES bool ChannelTypeFeatures_requires_zero_conf(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
36258
36259 /**
36260  * Set this feature as optional.
36261  */
36262 void NodeFeatures_set_keysend_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
36263
36264 /**
36265  * Set this feature as required.
36266  */
36267 void NodeFeatures_set_keysend_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
36268
36269 /**
36270  * Checks if this feature is supported.
36271  */
36272 MUST_USE_RES bool NodeFeatures_supports_keysend(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
36273
36274 /**
36275  * Checks if this feature is required.
36276  */
36277 MUST_USE_RES bool NodeFeatures_requires_keysend(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
36278
36279 /**
36280  * Frees any resources used by the ShutdownScript, if is_owned is set and inner is non-NULL.
36281  */
36282 void ShutdownScript_free(struct LDKShutdownScript this_obj);
36283
36284 /**
36285  * Creates a copy of the ShutdownScript
36286  */
36287 struct LDKShutdownScript ShutdownScript_clone(const struct LDKShutdownScript *NONNULL_PTR orig);
36288
36289 /**
36290  * Checks if two ShutdownScripts contain equal inner contents.
36291  * This ignores pointers and is_owned flags and looks at the values in fields.
36292  * Two objects with NULL inner values will be considered "equal" here.
36293  */
36294 bool ShutdownScript_eq(const struct LDKShutdownScript *NONNULL_PTR a, const struct LDKShutdownScript *NONNULL_PTR b);
36295
36296 /**
36297  * Frees any resources used by the InvalidShutdownScript, if is_owned is set and inner is non-NULL.
36298  */
36299 void InvalidShutdownScript_free(struct LDKInvalidShutdownScript this_obj);
36300
36301 /**
36302  * The script that did not meet the requirements from [BOLT #2].
36303  *
36304  * [BOLT #2]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md
36305  */
36306 struct LDKu8slice InvalidShutdownScript_get_script(const struct LDKInvalidShutdownScript *NONNULL_PTR this_ptr);
36307
36308 /**
36309  * The script that did not meet the requirements from [BOLT #2].
36310  *
36311  * [BOLT #2]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md
36312  */
36313 void InvalidShutdownScript_set_script(struct LDKInvalidShutdownScript *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
36314
36315 /**
36316  * Constructs a new InvalidShutdownScript given each field
36317  */
36318 MUST_USE_RES struct LDKInvalidShutdownScript InvalidShutdownScript_new(struct LDKCVec_u8Z script_arg);
36319
36320 /**
36321  * Creates a copy of the InvalidShutdownScript
36322  */
36323 struct LDKInvalidShutdownScript InvalidShutdownScript_clone(const struct LDKInvalidShutdownScript *NONNULL_PTR orig);
36324
36325 /**
36326  * Serialize the ShutdownScript object into a byte array which can be read by ShutdownScript_read
36327  */
36328 struct LDKCVec_u8Z ShutdownScript_write(const struct LDKShutdownScript *NONNULL_PTR obj);
36329
36330 /**
36331  * Read a ShutdownScript from a byte array, created by ShutdownScript_write
36332  */
36333 struct LDKCResult_ShutdownScriptDecodeErrorZ ShutdownScript_read(struct LDKu8slice ser);
36334
36335 /**
36336  * Generates a P2WPKH script pubkey from the given [`WPubkeyHash`].
36337  */
36338 MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2wpkh(const uint8_t (*pubkey_hash)[20]);
36339
36340 /**
36341  * Generates a P2WSH script pubkey from the given [`WScriptHash`].
36342  */
36343 MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2wsh(const uint8_t (*script_hash)[32]);
36344
36345 /**
36346  * Generates a witness script pubkey from the given segwit version and program.
36347  *
36348  * Note for version-zero witness scripts you must use [`ShutdownScript::new_p2wpkh`] or
36349  * [`ShutdownScript::new_p2wsh`] instead.
36350  *
36351  * # Errors
36352  *
36353  * This function may return an error if `program` is invalid for the segwit `version`.
36354  */
36355 MUST_USE_RES struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ ShutdownScript_new_witness_program(struct LDKWitnessVersion version, struct LDKu8slice program);
36356
36357 /**
36358  * Converts the shutdown script into the underlying [`Script`].
36359  */
36360 MUST_USE_RES struct LDKCVec_u8Z ShutdownScript_into_inner(struct LDKShutdownScript this_arg);
36361
36362 /**
36363  * Returns the [`PublicKey`] used for a P2WPKH shutdown script if constructed directly from it.
36364  *
36365  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
36366  */
36367 MUST_USE_RES struct LDKPublicKey ShutdownScript_as_legacy_pubkey(const struct LDKShutdownScript *NONNULL_PTR this_arg);
36368
36369 /**
36370  * Returns whether the shutdown script is compatible with the features as defined by BOLT #2.
36371  *
36372  * Specifically, checks for compliance with feature `option_shutdown_anysegwit`.
36373  */
36374 MUST_USE_RES bool ShutdownScript_is_compatible(const struct LDKShutdownScript *NONNULL_PTR this_arg, const struct LDKInitFeatures *NONNULL_PTR features);
36375
36376 /**
36377  * Frees any resources used by the Retry
36378  */
36379 void Retry_free(struct LDKRetry this_ptr);
36380
36381 /**
36382  * Creates a copy of the Retry
36383  */
36384 struct LDKRetry Retry_clone(const struct LDKRetry *NONNULL_PTR orig);
36385
36386 /**
36387  * Utility method to constructs a new Attempts-variant Retry
36388  */
36389 struct LDKRetry Retry_attempts(uintptr_t a);
36390
36391 /**
36392  * Utility method to constructs a new Timeout-variant Retry
36393  */
36394 struct LDKRetry Retry_timeout(uint64_t a);
36395
36396 /**
36397  * Checks if two Retrys contain equal inner contents.
36398  * This ignores pointers and is_owned flags and looks at the values in fields.
36399  */
36400 bool Retry_eq(const struct LDKRetry *NONNULL_PTR a, const struct LDKRetry *NONNULL_PTR b);
36401
36402 /**
36403  * Generates a non-cryptographic 64-bit hash of the Retry.
36404  */
36405 uint64_t Retry_hash(const struct LDKRetry *NONNULL_PTR o);
36406
36407 /**
36408  * Creates a copy of the RetryableSendFailure
36409  */
36410 enum LDKRetryableSendFailure RetryableSendFailure_clone(const enum LDKRetryableSendFailure *NONNULL_PTR orig);
36411
36412 /**
36413  * Utility method to constructs a new PaymentExpired-variant RetryableSendFailure
36414  */
36415 enum LDKRetryableSendFailure RetryableSendFailure_payment_expired(void);
36416
36417 /**
36418  * Utility method to constructs a new RouteNotFound-variant RetryableSendFailure
36419  */
36420 enum LDKRetryableSendFailure RetryableSendFailure_route_not_found(void);
36421
36422 /**
36423  * Utility method to constructs a new DuplicatePayment-variant RetryableSendFailure
36424  */
36425 enum LDKRetryableSendFailure RetryableSendFailure_duplicate_payment(void);
36426
36427 /**
36428  * Checks if two RetryableSendFailures contain equal inner contents.
36429  * This ignores pointers and is_owned flags and looks at the values in fields.
36430  */
36431 bool RetryableSendFailure_eq(const enum LDKRetryableSendFailure *NONNULL_PTR a, const enum LDKRetryableSendFailure *NONNULL_PTR b);
36432
36433 /**
36434  * Frees any resources used by the PaymentSendFailure
36435  */
36436 void PaymentSendFailure_free(struct LDKPaymentSendFailure this_ptr);
36437
36438 /**
36439  * Creates a copy of the PaymentSendFailure
36440  */
36441 struct LDKPaymentSendFailure PaymentSendFailure_clone(const struct LDKPaymentSendFailure *NONNULL_PTR orig);
36442
36443 /**
36444  * Utility method to constructs a new ParameterError-variant PaymentSendFailure
36445  */
36446 struct LDKPaymentSendFailure PaymentSendFailure_parameter_error(struct LDKAPIError a);
36447
36448 /**
36449  * Utility method to constructs a new PathParameterError-variant PaymentSendFailure
36450  */
36451 struct LDKPaymentSendFailure PaymentSendFailure_path_parameter_error(struct LDKCVec_CResult_NoneAPIErrorZZ a);
36452
36453 /**
36454  * Utility method to constructs a new AllFailedResendSafe-variant PaymentSendFailure
36455  */
36456 struct LDKPaymentSendFailure PaymentSendFailure_all_failed_resend_safe(struct LDKCVec_APIErrorZ a);
36457
36458 /**
36459  * Utility method to constructs a new DuplicatePayment-variant PaymentSendFailure
36460  */
36461 struct LDKPaymentSendFailure PaymentSendFailure_duplicate_payment(void);
36462
36463 /**
36464  * Utility method to constructs a new PartialFailure-variant PaymentSendFailure
36465  */
36466 struct LDKPaymentSendFailure PaymentSendFailure_partial_failure(struct LDKCVec_CResult_NoneAPIErrorZZ results, struct LDKRouteParameters failed_paths_retry, struct LDKThirtyTwoBytes payment_id);
36467
36468 /**
36469  * Frees any resources used by the RecipientOnionFields, if is_owned is set and inner is non-NULL.
36470  */
36471 void RecipientOnionFields_free(struct LDKRecipientOnionFields this_obj);
36472
36473 /**
36474  * The [`PaymentSecret`] is an arbitrary 32 bytes provided by the recipient for us to repeat
36475  * in the onion. It is unrelated to `payment_hash` (or [`PaymentPreimage`]) and exists to
36476  * authenticate the sender to the recipient and prevent payment-probing (deanonymization)
36477  * attacks.
36478  *
36479  * If you do not have one, the [`Route`] you pay over must not contain multiple paths as
36480  * multi-path payments require a recipient-provided secret.
36481  *
36482  * Some implementations may reject spontaneous payments with payment secrets, so you may only
36483  * want to provide a secret for a spontaneous payment if MPP is needed and you know your
36484  * recipient will not reject it.
36485  */
36486 struct LDKCOption_PaymentSecretZ RecipientOnionFields_get_payment_secret(const struct LDKRecipientOnionFields *NONNULL_PTR this_ptr);
36487
36488 /**
36489  * The [`PaymentSecret`] is an arbitrary 32 bytes provided by the recipient for us to repeat
36490  * in the onion. It is unrelated to `payment_hash` (or [`PaymentPreimage`]) and exists to
36491  * authenticate the sender to the recipient and prevent payment-probing (deanonymization)
36492  * attacks.
36493  *
36494  * If you do not have one, the [`Route`] you pay over must not contain multiple paths as
36495  * multi-path payments require a recipient-provided secret.
36496  *
36497  * Some implementations may reject spontaneous payments with payment secrets, so you may only
36498  * want to provide a secret for a spontaneous payment if MPP is needed and you know your
36499  * recipient will not reject it.
36500  */
36501 void RecipientOnionFields_set_payment_secret(struct LDKRecipientOnionFields *NONNULL_PTR this_ptr, struct LDKCOption_PaymentSecretZ val);
36502
36503 /**
36504  * The payment metadata serves a similar purpose as [`Self::payment_secret`] but is of
36505  * arbitrary length. This gives recipients substantially more flexibility to receive
36506  * additional data.
36507  *
36508  * In LDK, while the [`Self::payment_secret`] is fixed based on an internal authentication
36509  * scheme to authenticate received payments against expected payments and invoices, this field
36510  * is not used in LDK for received payments, and can be used to store arbitrary data in
36511  * invoices which will be received with the payment.
36512  *
36513  * Note that this field was added to the lightning specification more recently than
36514  * [`Self::payment_secret`] and while nearly all lightning senders support secrets, metadata
36515  * may not be supported as universally.
36516  *
36517  * Returns a copy of the field.
36518  */
36519 struct LDKCOption_CVec_u8ZZ RecipientOnionFields_get_payment_metadata(const struct LDKRecipientOnionFields *NONNULL_PTR this_ptr);
36520
36521 /**
36522  * The payment metadata serves a similar purpose as [`Self::payment_secret`] but is of
36523  * arbitrary length. This gives recipients substantially more flexibility to receive
36524  * additional data.
36525  *
36526  * In LDK, while the [`Self::payment_secret`] is fixed based on an internal authentication
36527  * scheme to authenticate received payments against expected payments and invoices, this field
36528  * is not used in LDK for received payments, and can be used to store arbitrary data in
36529  * invoices which will be received with the payment.
36530  *
36531  * Note that this field was added to the lightning specification more recently than
36532  * [`Self::payment_secret`] and while nearly all lightning senders support secrets, metadata
36533  * may not be supported as universally.
36534  */
36535 void RecipientOnionFields_set_payment_metadata(struct LDKRecipientOnionFields *NONNULL_PTR this_ptr, struct LDKCOption_CVec_u8ZZ val);
36536
36537 /**
36538  * Constructs a new RecipientOnionFields given each field
36539  */
36540 MUST_USE_RES struct LDKRecipientOnionFields RecipientOnionFields_new(struct LDKCOption_PaymentSecretZ payment_secret_arg, struct LDKCOption_CVec_u8ZZ payment_metadata_arg);
36541
36542 /**
36543  * Creates a copy of the RecipientOnionFields
36544  */
36545 struct LDKRecipientOnionFields RecipientOnionFields_clone(const struct LDKRecipientOnionFields *NONNULL_PTR orig);
36546
36547 /**
36548  * Checks if two RecipientOnionFieldss contain equal inner contents.
36549  * This ignores pointers and is_owned flags and looks at the values in fields.
36550  * Two objects with NULL inner values will be considered "equal" here.
36551  */
36552 bool RecipientOnionFields_eq(const struct LDKRecipientOnionFields *NONNULL_PTR a, const struct LDKRecipientOnionFields *NONNULL_PTR b);
36553
36554 /**
36555  * Serialize the RecipientOnionFields object into a byte array which can be read by RecipientOnionFields_read
36556  */
36557 struct LDKCVec_u8Z RecipientOnionFields_write(const struct LDKRecipientOnionFields *NONNULL_PTR obj);
36558
36559 /**
36560  * Read a RecipientOnionFields from a byte array, created by RecipientOnionFields_write
36561  */
36562 struct LDKCResult_RecipientOnionFieldsDecodeErrorZ RecipientOnionFields_read(struct LDKu8slice ser);
36563
36564 /**
36565  * Creates a [`RecipientOnionFields`] from only a [`PaymentSecret`]. This is the most common
36566  * set of onion fields for today's BOLT11 invoices - most nodes require a [`PaymentSecret`]
36567  * but do not require or provide any further data.
36568  */
36569 MUST_USE_RES struct LDKRecipientOnionFields RecipientOnionFields_secret_only(struct LDKThirtyTwoBytes payment_secret);
36570
36571 /**
36572  * Creates a new [`RecipientOnionFields`] with no fields. This generally does not create
36573  * payable HTLCs except for single-path spontaneous payments, i.e. this should generally
36574  * only be used for calls to [`ChannelManager::send_spontaneous_payment`]. If you are sending
36575  * a spontaneous MPP this will not work as all MPP require payment secrets; you may
36576  * instead want to use [`RecipientOnionFields::secret_only`].
36577  *
36578  * [`ChannelManager::send_spontaneous_payment`]: super::channelmanager::ChannelManager::send_spontaneous_payment
36579  * [`RecipientOnionFields::secret_only`]: RecipientOnionFields::secret_only
36580  */
36581 MUST_USE_RES struct LDKRecipientOnionFields RecipientOnionFields_spontaneous_empty(void);
36582
36583 /**
36584  * Calls the free function if one is set
36585  */
36586 void CustomMessageReader_free(struct LDKCustomMessageReader this_ptr);
36587
36588 /**
36589  * Calls the free function if one is set
36590  */
36591 void Type_free(struct LDKType this_ptr);
36592
36593 /**
36594  * Frees any resources used by the UnsignedBolt12Invoice, if is_owned is set and inner is non-NULL.
36595  */
36596 void UnsignedBolt12Invoice_free(struct LDKUnsignedBolt12Invoice this_obj);
36597
36598 /**
36599  * The public key corresponding to the key needed to sign the invoice.
36600  */
36601 MUST_USE_RES struct LDKPublicKey UnsignedBolt12Invoice_signing_pubkey(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg);
36602
36603 /**
36604  * Frees any resources used by the Bolt12Invoice, if is_owned is set and inner is non-NULL.
36605  */
36606 void Bolt12Invoice_free(struct LDKBolt12Invoice this_obj);
36607
36608 /**
36609  * Creates a copy of the Bolt12Invoice
36610  */
36611 struct LDKBolt12Invoice Bolt12Invoice_clone(const struct LDKBolt12Invoice *NONNULL_PTR orig);
36612
36613 /**
36614  * A complete description of the purpose of the originating offer or refund. Intended to be
36615  * displayed to the user but with the caveat that it has not been verified in any way.
36616  */
36617 MUST_USE_RES struct LDKPrintableString Bolt12Invoice_description(const struct LDKBolt12Invoice *NONNULL_PTR this_arg);
36618
36619 /**
36620  * Duration since the Unix epoch when the invoice was created.
36621  */
36622 MUST_USE_RES uint64_t Bolt12Invoice_created_at(const struct LDKBolt12Invoice *NONNULL_PTR this_arg);
36623
36624 /**
36625  * Duration since [`Bolt12Invoice::created_at`] when the invoice has expired and therefore
36626  * should no longer be paid.
36627  */
36628 MUST_USE_RES uint64_t Bolt12Invoice_relative_expiry(const struct LDKBolt12Invoice *NONNULL_PTR this_arg);
36629
36630 /**
36631  * Whether the invoice has expired.
36632  */
36633 MUST_USE_RES bool Bolt12Invoice_is_expired(const struct LDKBolt12Invoice *NONNULL_PTR this_arg);
36634
36635 /**
36636  * SHA256 hash of the payment preimage that will be given in return for paying the invoice.
36637  */
36638 MUST_USE_RES struct LDKThirtyTwoBytes Bolt12Invoice_payment_hash(const struct LDKBolt12Invoice *NONNULL_PTR this_arg);
36639
36640 /**
36641  * The minimum amount required for a successful payment of the invoice.
36642  */
36643 MUST_USE_RES uint64_t Bolt12Invoice_amount_msats(const struct LDKBolt12Invoice *NONNULL_PTR this_arg);
36644
36645 /**
36646  * Features pertaining to paying an invoice.
36647  */
36648 MUST_USE_RES struct LDKBolt12InvoiceFeatures Bolt12Invoice_features(const struct LDKBolt12Invoice *NONNULL_PTR this_arg);
36649
36650 /**
36651  * The public key corresponding to the key used to sign the invoice.
36652  */
36653 MUST_USE_RES struct LDKPublicKey Bolt12Invoice_signing_pubkey(const struct LDKBolt12Invoice *NONNULL_PTR this_arg);
36654
36655 /**
36656  * Hash that was used for signing the invoice.
36657  */
36658 MUST_USE_RES struct LDKThirtyTwoBytes Bolt12Invoice_signable_hash(const struct LDKBolt12Invoice *NONNULL_PTR this_arg);
36659
36660 /**
36661  * Verifies that the invoice was for a request or refund created using the given key.
36662  */
36663 MUST_USE_RES bool Bolt12Invoice_verify(const struct LDKBolt12Invoice *NONNULL_PTR this_arg, const struct LDKExpandedKey *NONNULL_PTR key);
36664
36665 /**
36666  * Serialize the Bolt12Invoice object into a byte array which can be read by Bolt12Invoice_read
36667  */
36668 struct LDKCVec_u8Z Bolt12Invoice_write(const struct LDKBolt12Invoice *NONNULL_PTR obj);
36669
36670 /**
36671  * Frees any resources used by the BlindedPayInfo, if is_owned is set and inner is non-NULL.
36672  */
36673 void BlindedPayInfo_free(struct LDKBlindedPayInfo this_obj);
36674
36675 /**
36676  * Base fee charged (in millisatoshi) for the entire blinded path.
36677  */
36678 uint32_t BlindedPayInfo_get_fee_base_msat(const struct LDKBlindedPayInfo *NONNULL_PTR this_ptr);
36679
36680 /**
36681  * Base fee charged (in millisatoshi) for the entire blinded path.
36682  */
36683 void BlindedPayInfo_set_fee_base_msat(struct LDKBlindedPayInfo *NONNULL_PTR this_ptr, uint32_t val);
36684
36685 /**
36686  * Liquidity fee charged (in millionths of the amount transferred) for the entire blinded path
36687  * (i.e., 10,000 is 1%).
36688  */
36689 uint32_t BlindedPayInfo_get_fee_proportional_millionths(const struct LDKBlindedPayInfo *NONNULL_PTR this_ptr);
36690
36691 /**
36692  * Liquidity fee charged (in millionths of the amount transferred) for the entire blinded path
36693  * (i.e., 10,000 is 1%).
36694  */
36695 void BlindedPayInfo_set_fee_proportional_millionths(struct LDKBlindedPayInfo *NONNULL_PTR this_ptr, uint32_t val);
36696
36697 /**
36698  * Number of blocks subtracted from an incoming HTLC's `cltv_expiry` for the entire blinded
36699  * path.
36700  */
36701 uint16_t BlindedPayInfo_get_cltv_expiry_delta(const struct LDKBlindedPayInfo *NONNULL_PTR this_ptr);
36702
36703 /**
36704  * Number of blocks subtracted from an incoming HTLC's `cltv_expiry` for the entire blinded
36705  * path.
36706  */
36707 void BlindedPayInfo_set_cltv_expiry_delta(struct LDKBlindedPayInfo *NONNULL_PTR this_ptr, uint16_t val);
36708
36709 /**
36710  * The minimum HTLC value (in millisatoshi) that is acceptable to all channel peers on the
36711  * blinded path from the introduction node to the recipient, accounting for any fees, i.e., as
36712  * seen by the recipient.
36713  */
36714 uint64_t BlindedPayInfo_get_htlc_minimum_msat(const struct LDKBlindedPayInfo *NONNULL_PTR this_ptr);
36715
36716 /**
36717  * The minimum HTLC value (in millisatoshi) that is acceptable to all channel peers on the
36718  * blinded path from the introduction node to the recipient, accounting for any fees, i.e., as
36719  * seen by the recipient.
36720  */
36721 void BlindedPayInfo_set_htlc_minimum_msat(struct LDKBlindedPayInfo *NONNULL_PTR this_ptr, uint64_t val);
36722
36723 /**
36724  * The maximum HTLC value (in millisatoshi) that is acceptable to all channel peers on the
36725  * blinded path from the introduction node to the recipient, accounting for any fees, i.e., as
36726  * seen by the recipient.
36727  */
36728 uint64_t BlindedPayInfo_get_htlc_maximum_msat(const struct LDKBlindedPayInfo *NONNULL_PTR this_ptr);
36729
36730 /**
36731  * The maximum HTLC value (in millisatoshi) that is acceptable to all channel peers on the
36732  * blinded path from the introduction node to the recipient, accounting for any fees, i.e., as
36733  * seen by the recipient.
36734  */
36735 void BlindedPayInfo_set_htlc_maximum_msat(struct LDKBlindedPayInfo *NONNULL_PTR this_ptr, uint64_t val);
36736
36737 /**
36738  * Features set in `encrypted_data_tlv` for the `encrypted_recipient_data` TLV record in an
36739  * onion payload.
36740  */
36741 struct LDKBlindedHopFeatures BlindedPayInfo_get_features(const struct LDKBlindedPayInfo *NONNULL_PTR this_ptr);
36742
36743 /**
36744  * Features set in `encrypted_data_tlv` for the `encrypted_recipient_data` TLV record in an
36745  * onion payload.
36746  */
36747 void BlindedPayInfo_set_features(struct LDKBlindedPayInfo *NONNULL_PTR this_ptr, struct LDKBlindedHopFeatures val);
36748
36749 /**
36750  * Constructs a new BlindedPayInfo given each field
36751  */
36752 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);
36753
36754 /**
36755  * Creates a copy of the BlindedPayInfo
36756  */
36757 struct LDKBlindedPayInfo BlindedPayInfo_clone(const struct LDKBlindedPayInfo *NONNULL_PTR orig);
36758
36759 /**
36760  * Generates a non-cryptographic 64-bit hash of the BlindedPayInfo.
36761  */
36762 uint64_t BlindedPayInfo_hash(const struct LDKBlindedPayInfo *NONNULL_PTR o);
36763
36764 /**
36765  * Checks if two BlindedPayInfos contain equal inner contents.
36766  * This ignores pointers and is_owned flags and looks at the values in fields.
36767  * Two objects with NULL inner values will be considered "equal" here.
36768  */
36769 bool BlindedPayInfo_eq(const struct LDKBlindedPayInfo *NONNULL_PTR a, const struct LDKBlindedPayInfo *NONNULL_PTR b);
36770
36771 /**
36772  * Serialize the BlindedPayInfo object into a byte array which can be read by BlindedPayInfo_read
36773  */
36774 struct LDKCVec_u8Z BlindedPayInfo_write(const struct LDKBlindedPayInfo *NONNULL_PTR obj);
36775
36776 /**
36777  * Read a BlindedPayInfo from a byte array, created by BlindedPayInfo_write
36778  */
36779 struct LDKCResult_BlindedPayInfoDecodeErrorZ BlindedPayInfo_read(struct LDKu8slice ser);
36780
36781 /**
36782  * Frees any resources used by the InvoiceError, if is_owned is set and inner is non-NULL.
36783  */
36784 void InvoiceError_free(struct LDKInvoiceError this_obj);
36785
36786 /**
36787  * The field in the [`InvoiceRequest`] or the [`Bolt12Invoice`] that contained an error.
36788  *
36789  * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
36790  * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
36791  *
36792  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
36793  */
36794 struct LDKErroneousField InvoiceError_get_erroneous_field(const struct LDKInvoiceError *NONNULL_PTR this_ptr);
36795
36796 /**
36797  * The field in the [`InvoiceRequest`] or the [`Bolt12Invoice`] that contained an error.
36798  *
36799  * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
36800  * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
36801  *
36802  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
36803  */
36804 void InvoiceError_set_erroneous_field(struct LDKInvoiceError *NONNULL_PTR this_ptr, struct LDKErroneousField val);
36805
36806 /**
36807  * An explanation of the error.
36808  */
36809 struct LDKUntrustedString InvoiceError_get_message(const struct LDKInvoiceError *NONNULL_PTR this_ptr);
36810
36811 /**
36812  * An explanation of the error.
36813  */
36814 void InvoiceError_set_message(struct LDKInvoiceError *NONNULL_PTR this_ptr, struct LDKUntrustedString val);
36815
36816 /**
36817  * Constructs a new InvoiceError given each field
36818  */
36819 MUST_USE_RES struct LDKInvoiceError InvoiceError_new(struct LDKErroneousField erroneous_field_arg, struct LDKUntrustedString message_arg);
36820
36821 /**
36822  * Creates a copy of the InvoiceError
36823  */
36824 struct LDKInvoiceError InvoiceError_clone(const struct LDKInvoiceError *NONNULL_PTR orig);
36825
36826 /**
36827  * Frees any resources used by the ErroneousField, if is_owned is set and inner is non-NULL.
36828  */
36829 void ErroneousField_free(struct LDKErroneousField this_obj);
36830
36831 /**
36832  * The type number of the TLV field containing the error.
36833  */
36834 uint64_t ErroneousField_get_tlv_fieldnum(const struct LDKErroneousField *NONNULL_PTR this_ptr);
36835
36836 /**
36837  * The type number of the TLV field containing the error.
36838  */
36839 void ErroneousField_set_tlv_fieldnum(struct LDKErroneousField *NONNULL_PTR this_ptr, uint64_t val);
36840
36841 /**
36842  * A value to use for the TLV field to avoid the error.
36843  *
36844  * Returns a copy of the field.
36845  */
36846 struct LDKCOption_CVec_u8ZZ ErroneousField_get_suggested_value(const struct LDKErroneousField *NONNULL_PTR this_ptr);
36847
36848 /**
36849  * A value to use for the TLV field to avoid the error.
36850  */
36851 void ErroneousField_set_suggested_value(struct LDKErroneousField *NONNULL_PTR this_ptr, struct LDKCOption_CVec_u8ZZ val);
36852
36853 /**
36854  * Constructs a new ErroneousField given each field
36855  */
36856 MUST_USE_RES struct LDKErroneousField ErroneousField_new(uint64_t tlv_fieldnum_arg, struct LDKCOption_CVec_u8ZZ suggested_value_arg);
36857
36858 /**
36859  * Creates a copy of the ErroneousField
36860  */
36861 struct LDKErroneousField ErroneousField_clone(const struct LDKErroneousField *NONNULL_PTR orig);
36862
36863 /**
36864  * Serialize the InvoiceError object into a byte array which can be read by InvoiceError_read
36865  */
36866 struct LDKCVec_u8Z InvoiceError_write(const struct LDKInvoiceError *NONNULL_PTR obj);
36867
36868 /**
36869  * Read a InvoiceError from a byte array, created by InvoiceError_write
36870  */
36871 struct LDKCResult_InvoiceErrorDecodeErrorZ InvoiceError_read(struct LDKu8slice ser);
36872
36873 /**
36874  * Frees any resources used by the UnsignedInvoiceRequest, if is_owned is set and inner is non-NULL.
36875  */
36876 void UnsignedInvoiceRequest_free(struct LDKUnsignedInvoiceRequest this_obj);
36877
36878 /**
36879  * Frees any resources used by the InvoiceRequest, if is_owned is set and inner is non-NULL.
36880  */
36881 void InvoiceRequest_free(struct LDKInvoiceRequest this_obj);
36882
36883 /**
36884  * Creates a copy of the InvoiceRequest
36885  */
36886 struct LDKInvoiceRequest InvoiceRequest_clone(const struct LDKInvoiceRequest *NONNULL_PTR orig);
36887
36888 /**
36889  * An unpredictable series of bytes, typically containing information about the derivation of
36890  * [`payer_id`].
36891  *
36892  * [`payer_id`]: Self::payer_id
36893  */
36894 MUST_USE_RES struct LDKu8slice InvoiceRequest_metadata(const struct LDKInvoiceRequest *NONNULL_PTR this_arg);
36895
36896 /**
36897  * A chain from [`Offer::chains`] that the offer is valid for.
36898  */
36899 MUST_USE_RES struct LDKThirtyTwoBytes InvoiceRequest_chain(const struct LDKInvoiceRequest *NONNULL_PTR this_arg);
36900
36901 /**
36902  * The amount to pay in msats (i.e., the minimum lightning-payable unit for [`chain`]), which
36903  * must be greater than or equal to [`Offer::amount`], converted if necessary.
36904  *
36905  * [`chain`]: Self::chain
36906  */
36907 MUST_USE_RES struct LDKCOption_u64Z InvoiceRequest_amount_msats(const struct LDKInvoiceRequest *NONNULL_PTR this_arg);
36908
36909 /**
36910  * Features pertaining to requesting an invoice.
36911  */
36912 MUST_USE_RES struct LDKInvoiceRequestFeatures InvoiceRequest_features(const struct LDKInvoiceRequest *NONNULL_PTR this_arg);
36913
36914 /**
36915  * The quantity of the offer's item conforming to [`Offer::is_valid_quantity`].
36916  */
36917 MUST_USE_RES struct LDKCOption_u64Z InvoiceRequest_quantity(const struct LDKInvoiceRequest *NONNULL_PTR this_arg);
36918
36919 /**
36920  * A possibly transient pubkey used to sign the invoice request.
36921  */
36922 MUST_USE_RES struct LDKPublicKey InvoiceRequest_payer_id(const struct LDKInvoiceRequest *NONNULL_PTR this_arg);
36923
36924 /**
36925  * A payer-provided note which will be seen by the recipient and reflected back in the invoice
36926  * response.
36927  *
36928  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
36929  */
36930 MUST_USE_RES struct LDKPrintableString InvoiceRequest_payer_note(const struct LDKInvoiceRequest *NONNULL_PTR this_arg);
36931
36932 /**
36933  * Verifies that the request was for an offer created using the given key. Returns the derived
36934  * keys need to sign an [`Bolt12Invoice`] for the request if they could be extracted from the
36935  * metadata.
36936  *
36937  * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
36938  */
36939 MUST_USE_RES struct LDKCResult_COption_KeyPairZNoneZ InvoiceRequest_verify(const struct LDKInvoiceRequest *NONNULL_PTR this_arg, const struct LDKExpandedKey *NONNULL_PTR key);
36940
36941 /**
36942  * Serialize the InvoiceRequest object into a byte array which can be read by InvoiceRequest_read
36943  */
36944 struct LDKCVec_u8Z InvoiceRequest_write(const struct LDKInvoiceRequest *NONNULL_PTR obj);
36945
36946 /**
36947  * Frees any resources used by the Offer, if is_owned is set and inner is non-NULL.
36948  */
36949 void Offer_free(struct LDKOffer this_obj);
36950
36951 /**
36952  * Creates a copy of the Offer
36953  */
36954 struct LDKOffer Offer_clone(const struct LDKOffer *NONNULL_PTR orig);
36955
36956 /**
36957  * The chains that may be used when paying a requested invoice (e.g., bitcoin mainnet).
36958  * Payments must be denominated in units of the minimal lightning-payable unit (e.g., msats)
36959  * for the selected chain.
36960  */
36961 MUST_USE_RES struct LDKCVec_ChainHashZ Offer_chains(const struct LDKOffer *NONNULL_PTR this_arg);
36962
36963 /**
36964  * Returns whether the given chain is supported by the offer.
36965  */
36966 MUST_USE_RES bool Offer_supports_chain(const struct LDKOffer *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes chain);
36967
36968 /**
36969  * Opaque bytes set by the originator. Useful for authentication and validating fields since it
36970  * is reflected in `invoice_request` messages along with all the other fields from the `offer`.
36971  */
36972 MUST_USE_RES struct LDKCOption_CVec_u8ZZ Offer_metadata(const struct LDKOffer *NONNULL_PTR this_arg);
36973
36974 /**
36975  * The minimum amount required for a successful payment of a single item.
36976  *
36977  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
36978  */
36979 MUST_USE_RES struct LDKAmount Offer_amount(const struct LDKOffer *NONNULL_PTR this_arg);
36980
36981 /**
36982  * A complete description of the purpose of the payment. Intended to be displayed to the user
36983  * but with the caveat that it has not been verified in any way.
36984  */
36985 MUST_USE_RES struct LDKPrintableString Offer_description(const struct LDKOffer *NONNULL_PTR this_arg);
36986
36987 /**
36988  * Features pertaining to the offer.
36989  */
36990 MUST_USE_RES struct LDKOfferFeatures Offer_features(const struct LDKOffer *NONNULL_PTR this_arg);
36991
36992 /**
36993  * Duration since the Unix epoch when an invoice should no longer be requested.
36994  *
36995  * If `None`, the offer does not expire.
36996  */
36997 MUST_USE_RES struct LDKCOption_DurationZ Offer_absolute_expiry(const struct LDKOffer *NONNULL_PTR this_arg);
36998
36999 /**
37000  * Whether the offer has expired.
37001  */
37002 MUST_USE_RES bool Offer_is_expired(const struct LDKOffer *NONNULL_PTR this_arg);
37003
37004 /**
37005  * The issuer of the offer, possibly beginning with `user@domain` or `domain`. Intended to be
37006  * displayed to the user but with the caveat that it has not been verified in any way.
37007  *
37008  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
37009  */
37010 MUST_USE_RES struct LDKPrintableString Offer_issuer(const struct LDKOffer *NONNULL_PTR this_arg);
37011
37012 /**
37013  * Paths to the recipient originating from publicly reachable nodes. Blinded paths provide
37014  * recipient privacy by obfuscating its node id.
37015  */
37016 MUST_USE_RES struct LDKCVec_BlindedPathZ Offer_paths(const struct LDKOffer *NONNULL_PTR this_arg);
37017
37018 /**
37019  * The quantity of items supported.
37020  */
37021 MUST_USE_RES struct LDKQuantity Offer_supported_quantity(const struct LDKOffer *NONNULL_PTR this_arg);
37022
37023 /**
37024  * Returns whether the given quantity is valid for the offer.
37025  */
37026 MUST_USE_RES bool Offer_is_valid_quantity(const struct LDKOffer *NONNULL_PTR this_arg, uint64_t quantity);
37027
37028 /**
37029  * Returns whether a quantity is expected in an [`InvoiceRequest`] for the offer.
37030  *
37031  * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
37032  */
37033 MUST_USE_RES bool Offer_expects_quantity(const struct LDKOffer *NONNULL_PTR this_arg);
37034
37035 /**
37036  * The public key used by the recipient to sign invoices.
37037  */
37038 MUST_USE_RES struct LDKPublicKey Offer_signing_pubkey(const struct LDKOffer *NONNULL_PTR this_arg);
37039
37040 /**
37041  * Serialize the Offer object into a byte array which can be read by Offer_read
37042  */
37043 struct LDKCVec_u8Z Offer_write(const struct LDKOffer *NONNULL_PTR obj);
37044
37045 /**
37046  * Frees any resources used by the Amount, if is_owned is set and inner is non-NULL.
37047  */
37048 void Amount_free(struct LDKAmount this_obj);
37049
37050 /**
37051  * Creates a copy of the Amount
37052  */
37053 struct LDKAmount Amount_clone(const struct LDKAmount *NONNULL_PTR orig);
37054
37055 /**
37056  * Frees any resources used by the Quantity, if is_owned is set and inner is non-NULL.
37057  */
37058 void Quantity_free(struct LDKQuantity this_obj);
37059
37060 /**
37061  * Creates a copy of the Quantity
37062  */
37063 struct LDKQuantity Quantity_clone(const struct LDKQuantity *NONNULL_PTR orig);
37064
37065 /**
37066  * Read a Offer object from a string
37067  */
37068 struct LDKCResult_OfferBolt12ParseErrorZ Offer_from_str(struct LDKStr s);
37069
37070 /**
37071  * Frees any resources used by the Bolt12ParseError, if is_owned is set and inner is non-NULL.
37072  */
37073 void Bolt12ParseError_free(struct LDKBolt12ParseError this_obj);
37074
37075 /**
37076  * Creates a copy of the Bolt12ParseError
37077  */
37078 struct LDKBolt12ParseError Bolt12ParseError_clone(const struct LDKBolt12ParseError *NONNULL_PTR orig);
37079
37080 /**
37081  * Creates a copy of the Bolt12SemanticError
37082  */
37083 enum LDKBolt12SemanticError Bolt12SemanticError_clone(const enum LDKBolt12SemanticError *NONNULL_PTR orig);
37084
37085 /**
37086  * Utility method to constructs a new AlreadyExpired-variant Bolt12SemanticError
37087  */
37088 enum LDKBolt12SemanticError Bolt12SemanticError_already_expired(void);
37089
37090 /**
37091  * Utility method to constructs a new UnsupportedChain-variant Bolt12SemanticError
37092  */
37093 enum LDKBolt12SemanticError Bolt12SemanticError_unsupported_chain(void);
37094
37095 /**
37096  * Utility method to constructs a new UnexpectedChain-variant Bolt12SemanticError
37097  */
37098 enum LDKBolt12SemanticError Bolt12SemanticError_unexpected_chain(void);
37099
37100 /**
37101  * Utility method to constructs a new MissingAmount-variant Bolt12SemanticError
37102  */
37103 enum LDKBolt12SemanticError Bolt12SemanticError_missing_amount(void);
37104
37105 /**
37106  * Utility method to constructs a new InvalidAmount-variant Bolt12SemanticError
37107  */
37108 enum LDKBolt12SemanticError Bolt12SemanticError_invalid_amount(void);
37109
37110 /**
37111  * Utility method to constructs a new InsufficientAmount-variant Bolt12SemanticError
37112  */
37113 enum LDKBolt12SemanticError Bolt12SemanticError_insufficient_amount(void);
37114
37115 /**
37116  * Utility method to constructs a new UnexpectedAmount-variant Bolt12SemanticError
37117  */
37118 enum LDKBolt12SemanticError Bolt12SemanticError_unexpected_amount(void);
37119
37120 /**
37121  * Utility method to constructs a new UnsupportedCurrency-variant Bolt12SemanticError
37122  */
37123 enum LDKBolt12SemanticError Bolt12SemanticError_unsupported_currency(void);
37124
37125 /**
37126  * Utility method to constructs a new UnknownRequiredFeatures-variant Bolt12SemanticError
37127  */
37128 enum LDKBolt12SemanticError Bolt12SemanticError_unknown_required_features(void);
37129
37130 /**
37131  * Utility method to constructs a new UnexpectedFeatures-variant Bolt12SemanticError
37132  */
37133 enum LDKBolt12SemanticError Bolt12SemanticError_unexpected_features(void);
37134
37135 /**
37136  * Utility method to constructs a new MissingDescription-variant Bolt12SemanticError
37137  */
37138 enum LDKBolt12SemanticError Bolt12SemanticError_missing_description(void);
37139
37140 /**
37141  * Utility method to constructs a new MissingSigningPubkey-variant Bolt12SemanticError
37142  */
37143 enum LDKBolt12SemanticError Bolt12SemanticError_missing_signing_pubkey(void);
37144
37145 /**
37146  * Utility method to constructs a new InvalidSigningPubkey-variant Bolt12SemanticError
37147  */
37148 enum LDKBolt12SemanticError Bolt12SemanticError_invalid_signing_pubkey(void);
37149
37150 /**
37151  * Utility method to constructs a new UnexpectedSigningPubkey-variant Bolt12SemanticError
37152  */
37153 enum LDKBolt12SemanticError Bolt12SemanticError_unexpected_signing_pubkey(void);
37154
37155 /**
37156  * Utility method to constructs a new MissingQuantity-variant Bolt12SemanticError
37157  */
37158 enum LDKBolt12SemanticError Bolt12SemanticError_missing_quantity(void);
37159
37160 /**
37161  * Utility method to constructs a new InvalidQuantity-variant Bolt12SemanticError
37162  */
37163 enum LDKBolt12SemanticError Bolt12SemanticError_invalid_quantity(void);
37164
37165 /**
37166  * Utility method to constructs a new UnexpectedQuantity-variant Bolt12SemanticError
37167  */
37168 enum LDKBolt12SemanticError Bolt12SemanticError_unexpected_quantity(void);
37169
37170 /**
37171  * Utility method to constructs a new InvalidMetadata-variant Bolt12SemanticError
37172  */
37173 enum LDKBolt12SemanticError Bolt12SemanticError_invalid_metadata(void);
37174
37175 /**
37176  * Utility method to constructs a new UnexpectedMetadata-variant Bolt12SemanticError
37177  */
37178 enum LDKBolt12SemanticError Bolt12SemanticError_unexpected_metadata(void);
37179
37180 /**
37181  * Utility method to constructs a new MissingPayerMetadata-variant Bolt12SemanticError
37182  */
37183 enum LDKBolt12SemanticError Bolt12SemanticError_missing_payer_metadata(void);
37184
37185 /**
37186  * Utility method to constructs a new MissingPayerId-variant Bolt12SemanticError
37187  */
37188 enum LDKBolt12SemanticError Bolt12SemanticError_missing_payer_id(void);
37189
37190 /**
37191  * Utility method to constructs a new MissingPaths-variant Bolt12SemanticError
37192  */
37193 enum LDKBolt12SemanticError Bolt12SemanticError_missing_paths(void);
37194
37195 /**
37196  * Utility method to constructs a new InvalidPayInfo-variant Bolt12SemanticError
37197  */
37198 enum LDKBolt12SemanticError Bolt12SemanticError_invalid_pay_info(void);
37199
37200 /**
37201  * Utility method to constructs a new MissingCreationTime-variant Bolt12SemanticError
37202  */
37203 enum LDKBolt12SemanticError Bolt12SemanticError_missing_creation_time(void);
37204
37205 /**
37206  * Utility method to constructs a new MissingPaymentHash-variant Bolt12SemanticError
37207  */
37208 enum LDKBolt12SemanticError Bolt12SemanticError_missing_payment_hash(void);
37209
37210 /**
37211  * Utility method to constructs a new MissingSignature-variant Bolt12SemanticError
37212  */
37213 enum LDKBolt12SemanticError Bolt12SemanticError_missing_signature(void);
37214
37215 /**
37216  * Frees any resources used by the Refund, if is_owned is set and inner is non-NULL.
37217  */
37218 void Refund_free(struct LDKRefund this_obj);
37219
37220 /**
37221  * Creates a copy of the Refund
37222  */
37223 struct LDKRefund Refund_clone(const struct LDKRefund *NONNULL_PTR orig);
37224
37225 /**
37226  * A complete description of the purpose of the refund. Intended to be displayed to the user
37227  * but with the caveat that it has not been verified in any way.
37228  */
37229 MUST_USE_RES struct LDKPrintableString Refund_description(const struct LDKRefund *NONNULL_PTR this_arg);
37230
37231 /**
37232  * Duration since the Unix epoch when an invoice should no longer be sent.
37233  *
37234  * If `None`, the refund does not expire.
37235  */
37236 MUST_USE_RES struct LDKCOption_DurationZ Refund_absolute_expiry(const struct LDKRefund *NONNULL_PTR this_arg);
37237
37238 /**
37239  * Whether the refund has expired.
37240  */
37241 MUST_USE_RES bool Refund_is_expired(const struct LDKRefund *NONNULL_PTR this_arg);
37242
37243 /**
37244  * The issuer of the refund, possibly beginning with `user@domain` or `domain`. Intended to be
37245  * displayed to the user but with the caveat that it has not been verified in any way.
37246  *
37247  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
37248  */
37249 MUST_USE_RES struct LDKPrintableString Refund_issuer(const struct LDKRefund *NONNULL_PTR this_arg);
37250
37251 /**
37252  * Paths to the sender originating from publicly reachable nodes. Blinded paths provide sender
37253  * privacy by obfuscating its node id.
37254  */
37255 MUST_USE_RES struct LDKCVec_BlindedPathZ Refund_paths(const struct LDKRefund *NONNULL_PTR this_arg);
37256
37257 /**
37258  * An unpredictable series of bytes, typically containing information about the derivation of
37259  * [`payer_id`].
37260  *
37261  * [`payer_id`]: Self::payer_id
37262  */
37263 MUST_USE_RES struct LDKu8slice Refund_metadata(const struct LDKRefund *NONNULL_PTR this_arg);
37264
37265 /**
37266  * A chain that the refund is valid for.
37267  */
37268 MUST_USE_RES struct LDKThirtyTwoBytes Refund_chain(const struct LDKRefund *NONNULL_PTR this_arg);
37269
37270 /**
37271  * The amount to refund in msats (i.e., the minimum lightning-payable unit for [`chain`]).
37272  *
37273  * [`chain`]: Self::chain
37274  */
37275 MUST_USE_RES uint64_t Refund_amount_msats(const struct LDKRefund *NONNULL_PTR this_arg);
37276
37277 /**
37278  * Features pertaining to requesting an invoice.
37279  */
37280 MUST_USE_RES struct LDKInvoiceRequestFeatures Refund_features(const struct LDKRefund *NONNULL_PTR this_arg);
37281
37282 /**
37283  * The quantity of an item that refund is for.
37284  */
37285 MUST_USE_RES struct LDKCOption_u64Z Refund_quantity(const struct LDKRefund *NONNULL_PTR this_arg);
37286
37287 /**
37288  * A public node id to send to in the case where there are no [`paths`]. Otherwise, a possibly
37289  * transient pubkey.
37290  *
37291  * [`paths`]: Self::paths
37292  */
37293 MUST_USE_RES struct LDKPublicKey Refund_payer_id(const struct LDKRefund *NONNULL_PTR this_arg);
37294
37295 /**
37296  * Payer provided note to include in the invoice.
37297  *
37298  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
37299  */
37300 MUST_USE_RES struct LDKPrintableString Refund_payer_note(const struct LDKRefund *NONNULL_PTR this_arg);
37301
37302 /**
37303  * Serialize the Refund object into a byte array which can be read by Refund_read
37304  */
37305 struct LDKCVec_u8Z Refund_write(const struct LDKRefund *NONNULL_PTR obj);
37306
37307 /**
37308  * Read a Refund object from a string
37309  */
37310 struct LDKCResult_RefundBolt12ParseErrorZ Refund_from_str(struct LDKStr s);
37311
37312 /**
37313  * Creates a copy of the UtxoLookupError
37314  */
37315 enum LDKUtxoLookupError UtxoLookupError_clone(const enum LDKUtxoLookupError *NONNULL_PTR orig);
37316
37317 /**
37318  * Utility method to constructs a new UnknownChain-variant UtxoLookupError
37319  */
37320 enum LDKUtxoLookupError UtxoLookupError_unknown_chain(void);
37321
37322 /**
37323  * Utility method to constructs a new UnknownTx-variant UtxoLookupError
37324  */
37325 enum LDKUtxoLookupError UtxoLookupError_unknown_tx(void);
37326
37327 /**
37328  * Frees any resources used by the UtxoResult
37329  */
37330 void UtxoResult_free(struct LDKUtxoResult this_ptr);
37331
37332 /**
37333  * Creates a copy of the UtxoResult
37334  */
37335 struct LDKUtxoResult UtxoResult_clone(const struct LDKUtxoResult *NONNULL_PTR orig);
37336
37337 /**
37338  * Utility method to constructs a new Sync-variant UtxoResult
37339  */
37340 struct LDKUtxoResult UtxoResult_sync(struct LDKCResult_TxOutUtxoLookupErrorZ a);
37341
37342 /**
37343  * Utility method to constructs a new Async-variant UtxoResult
37344  */
37345 struct LDKUtxoResult UtxoResult_async(struct LDKUtxoFuture a);
37346
37347 /**
37348  * Calls the free function if one is set
37349  */
37350 void UtxoLookup_free(struct LDKUtxoLookup this_ptr);
37351
37352 /**
37353  * Frees any resources used by the UtxoFuture, if is_owned is set and inner is non-NULL.
37354  */
37355 void UtxoFuture_free(struct LDKUtxoFuture this_obj);
37356
37357 /**
37358  * Creates a copy of the UtxoFuture
37359  */
37360 struct LDKUtxoFuture UtxoFuture_clone(const struct LDKUtxoFuture *NONNULL_PTR orig);
37361
37362 /**
37363  * Builds a new future for later resolution.
37364  */
37365 MUST_USE_RES struct LDKUtxoFuture UtxoFuture_new(void);
37366
37367 /**
37368  * Resolves this future against the given `graph` and with the given `result`.
37369  *
37370  * This is identical to calling [`UtxoFuture::resolve`] with a dummy `gossip`, disabling
37371  * forwarding the validated gossip message onwards to peers.
37372  *
37373  * Because this may cause the [`NetworkGraph`]'s [`processing_queue_high`] to flip, in order
37374  * to allow us to interact with peers again, you should call [`PeerManager::process_events`]
37375  * after this.
37376  *
37377  * [`processing_queue_high`]: crate::ln::msgs::RoutingMessageHandler::processing_queue_high
37378  * [`PeerManager::process_events`]: crate::ln::peer_handler::PeerManager::process_events
37379  */
37380 void UtxoFuture_resolve_without_forwarding(const struct LDKUtxoFuture *NONNULL_PTR this_arg, const struct LDKNetworkGraph *NONNULL_PTR graph, struct LDKCResult_TxOutUtxoLookupErrorZ result);
37381
37382 /**
37383  * Resolves this future against the given `graph` and with the given `result`.
37384  *
37385  * The given `gossip` is used to broadcast any validated messages onwards to all peers which
37386  * have available buffer space.
37387  *
37388  * Because this may cause the [`NetworkGraph`]'s [`processing_queue_high`] to flip, in order
37389  * to allow us to interact with peers again, you should call [`PeerManager::process_events`]
37390  * after this.
37391  *
37392  * [`processing_queue_high`]: crate::ln::msgs::RoutingMessageHandler::processing_queue_high
37393  * [`PeerManager::process_events`]: crate::ln::peer_handler::PeerManager::process_events
37394  */
37395 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);
37396
37397 /**
37398  * Frees any resources used by the NodeId, if is_owned is set and inner is non-NULL.
37399  */
37400 void NodeId_free(struct LDKNodeId this_obj);
37401
37402 /**
37403  * Creates a copy of the NodeId
37404  */
37405 struct LDKNodeId NodeId_clone(const struct LDKNodeId *NONNULL_PTR orig);
37406
37407 /**
37408  * Create a new NodeId from a public key
37409  */
37410 MUST_USE_RES struct LDKNodeId NodeId_from_pubkey(struct LDKPublicKey pubkey);
37411
37412 /**
37413  * Get the public key slice from this NodeId
37414  */
37415 MUST_USE_RES struct LDKu8slice NodeId_as_slice(const struct LDKNodeId *NONNULL_PTR this_arg);
37416
37417 /**
37418  * Get the public key from this NodeId
37419  */
37420 MUST_USE_RES struct LDKCResult_PublicKeyErrorZ NodeId_as_pubkey(const struct LDKNodeId *NONNULL_PTR this_arg);
37421
37422 /**
37423  * Generates a non-cryptographic 64-bit hash of the NodeId.
37424  */
37425 uint64_t NodeId_hash(const struct LDKNodeId *NONNULL_PTR o);
37426
37427 /**
37428  * Serialize the NodeId object into a byte array which can be read by NodeId_read
37429  */
37430 struct LDKCVec_u8Z NodeId_write(const struct LDKNodeId *NONNULL_PTR obj);
37431
37432 /**
37433  * Read a NodeId from a byte array, created by NodeId_write
37434  */
37435 struct LDKCResult_NodeIdDecodeErrorZ NodeId_read(struct LDKu8slice ser);
37436
37437 /**
37438  * Frees any resources used by the NetworkGraph, if is_owned is set and inner is non-NULL.
37439  */
37440 void NetworkGraph_free(struct LDKNetworkGraph this_obj);
37441
37442 /**
37443  * Frees any resources used by the ReadOnlyNetworkGraph, if is_owned is set and inner is non-NULL.
37444  */
37445 void ReadOnlyNetworkGraph_free(struct LDKReadOnlyNetworkGraph this_obj);
37446
37447 /**
37448  * Frees any resources used by the NetworkUpdate
37449  */
37450 void NetworkUpdate_free(struct LDKNetworkUpdate this_ptr);
37451
37452 /**
37453  * Creates a copy of the NetworkUpdate
37454  */
37455 struct LDKNetworkUpdate NetworkUpdate_clone(const struct LDKNetworkUpdate *NONNULL_PTR orig);
37456
37457 /**
37458  * Utility method to constructs a new ChannelUpdateMessage-variant NetworkUpdate
37459  */
37460 struct LDKNetworkUpdate NetworkUpdate_channel_update_message(struct LDKChannelUpdate msg);
37461
37462 /**
37463  * Utility method to constructs a new ChannelFailure-variant NetworkUpdate
37464  */
37465 struct LDKNetworkUpdate NetworkUpdate_channel_failure(uint64_t short_channel_id, bool is_permanent);
37466
37467 /**
37468  * Utility method to constructs a new NodeFailure-variant NetworkUpdate
37469  */
37470 struct LDKNetworkUpdate NetworkUpdate_node_failure(struct LDKPublicKey node_id, bool is_permanent);
37471
37472 /**
37473  * Checks if two NetworkUpdates contain equal inner contents.
37474  * This ignores pointers and is_owned flags and looks at the values in fields.
37475  */
37476 bool NetworkUpdate_eq(const struct LDKNetworkUpdate *NONNULL_PTR a, const struct LDKNetworkUpdate *NONNULL_PTR b);
37477
37478 /**
37479  * Serialize the NetworkUpdate object into a byte array which can be read by NetworkUpdate_read
37480  */
37481 struct LDKCVec_u8Z NetworkUpdate_write(const struct LDKNetworkUpdate *NONNULL_PTR obj);
37482
37483 /**
37484  * Read a NetworkUpdate from a byte array, created by NetworkUpdate_write
37485  */
37486 struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ NetworkUpdate_read(struct LDKu8slice ser);
37487
37488 /**
37489  * Frees any resources used by the P2PGossipSync, if is_owned is set and inner is non-NULL.
37490  */
37491 void P2PGossipSync_free(struct LDKP2PGossipSync this_obj);
37492
37493 /**
37494  * Creates a new tracker of the actual state of the network of channels and nodes,
37495  * assuming an existing [`NetworkGraph`].
37496  * UTXO lookup is used to make sure announced channels exist on-chain, channel data is
37497  * correct, and the announcement is signed with channel owners' keys.
37498  */
37499 MUST_USE_RES struct LDKP2PGossipSync P2PGossipSync_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKCOption_UtxoLookupZ utxo_lookup, struct LDKLogger logger);
37500
37501 /**
37502  * Adds a provider used to check new announcements. Does not affect
37503  * existing announcements unless they are updated.
37504  * Add, update or remove the provider would replace the current one.
37505  */
37506 void P2PGossipSync_add_utxo_lookup(struct LDKP2PGossipSync *NONNULL_PTR this_arg, struct LDKCOption_UtxoLookupZ utxo_lookup);
37507
37508 /**
37509  * Handles any network updates originating from [`Event`]s.
37510  *
37511  * [`Event`]: crate::events::Event
37512  */
37513 void NetworkGraph_handle_network_update(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKNetworkUpdate *NONNULL_PTR network_update);
37514
37515 /**
37516  * Gets the genesis hash for this network graph.
37517  */
37518 MUST_USE_RES struct LDKThirtyTwoBytes NetworkGraph_get_genesis_hash(const struct LDKNetworkGraph *NONNULL_PTR this_arg);
37519
37520 /**
37521  * Verifies the signature of a [`NodeAnnouncement`].
37522  *
37523  * Returns an error if it is invalid.
37524  */
37525 struct LDKCResult_NoneLightningErrorZ verify_node_announcement(const struct LDKNodeAnnouncement *NONNULL_PTR msg);
37526
37527 /**
37528  * Verifies all signatures included in a [`ChannelAnnouncement`].
37529  *
37530  * Returns an error if one of the signatures is invalid.
37531  */
37532 struct LDKCResult_NoneLightningErrorZ verify_channel_announcement(const struct LDKChannelAnnouncement *NONNULL_PTR msg);
37533
37534 /**
37535  * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg.
37536  * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is
37537  */
37538 struct LDKRoutingMessageHandler P2PGossipSync_as_RoutingMessageHandler(const struct LDKP2PGossipSync *NONNULL_PTR this_arg);
37539
37540 /**
37541  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
37542  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
37543  */
37544 struct LDKMessageSendEventsProvider P2PGossipSync_as_MessageSendEventsProvider(const struct LDKP2PGossipSync *NONNULL_PTR this_arg);
37545
37546 /**
37547  * Frees any resources used by the ChannelUpdateInfo, if is_owned is set and inner is non-NULL.
37548  */
37549 void ChannelUpdateInfo_free(struct LDKChannelUpdateInfo this_obj);
37550
37551 /**
37552  * When the last update to the channel direction was issued.
37553  * Value is opaque, as set in the announcement.
37554  */
37555 uint32_t ChannelUpdateInfo_get_last_update(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
37556
37557 /**
37558  * When the last update to the channel direction was issued.
37559  * Value is opaque, as set in the announcement.
37560  */
37561 void ChannelUpdateInfo_set_last_update(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, uint32_t val);
37562
37563 /**
37564  * Whether the channel can be currently used for payments (in this one direction).
37565  */
37566 bool ChannelUpdateInfo_get_enabled(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
37567
37568 /**
37569  * Whether the channel can be currently used for payments (in this one direction).
37570  */
37571 void ChannelUpdateInfo_set_enabled(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, bool val);
37572
37573 /**
37574  * The difference in CLTV values that you must have when routing through this channel.
37575  */
37576 uint16_t ChannelUpdateInfo_get_cltv_expiry_delta(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
37577
37578 /**
37579  * The difference in CLTV values that you must have when routing through this channel.
37580  */
37581 void ChannelUpdateInfo_set_cltv_expiry_delta(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, uint16_t val);
37582
37583 /**
37584  * The minimum value, which must be relayed to the next hop via the channel
37585  */
37586 uint64_t ChannelUpdateInfo_get_htlc_minimum_msat(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
37587
37588 /**
37589  * The minimum value, which must be relayed to the next hop via the channel
37590  */
37591 void ChannelUpdateInfo_set_htlc_minimum_msat(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, uint64_t val);
37592
37593 /**
37594  * The maximum value which may be relayed to the next hop via the channel.
37595  */
37596 uint64_t ChannelUpdateInfo_get_htlc_maximum_msat(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
37597
37598 /**
37599  * The maximum value which may be relayed to the next hop via the channel.
37600  */
37601 void ChannelUpdateInfo_set_htlc_maximum_msat(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, uint64_t val);
37602
37603 /**
37604  * Fees charged when the channel is used for routing
37605  */
37606 struct LDKRoutingFees ChannelUpdateInfo_get_fees(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
37607
37608 /**
37609  * Fees charged when the channel is used for routing
37610  */
37611 void ChannelUpdateInfo_set_fees(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
37612
37613 /**
37614  * Most recent update for the channel received from the network
37615  * Mostly redundant with the data we store in fields explicitly.
37616  * Everything else is useful only for sending out for initial routing sync.
37617  * Not stored if contains excess data to prevent DoS.
37618  *
37619  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
37620  */
37621 struct LDKChannelUpdate ChannelUpdateInfo_get_last_update_message(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
37622
37623 /**
37624  * Most recent update for the channel received from the network
37625  * Mostly redundant with the data we store in fields explicitly.
37626  * Everything else is useful only for sending out for initial routing sync.
37627  * Not stored if contains excess data to prevent DoS.
37628  *
37629  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
37630  */
37631 void ChannelUpdateInfo_set_last_update_message(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdate val);
37632
37633 /**
37634  * Constructs a new ChannelUpdateInfo given each field
37635  */
37636 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);
37637
37638 /**
37639  * Creates a copy of the ChannelUpdateInfo
37640  */
37641 struct LDKChannelUpdateInfo ChannelUpdateInfo_clone(const struct LDKChannelUpdateInfo *NONNULL_PTR orig);
37642
37643 /**
37644  * Checks if two ChannelUpdateInfos contain equal inner contents.
37645  * This ignores pointers and is_owned flags and looks at the values in fields.
37646  * Two objects with NULL inner values will be considered "equal" here.
37647  */
37648 bool ChannelUpdateInfo_eq(const struct LDKChannelUpdateInfo *NONNULL_PTR a, const struct LDKChannelUpdateInfo *NONNULL_PTR b);
37649
37650 /**
37651  * Serialize the ChannelUpdateInfo object into a byte array which can be read by ChannelUpdateInfo_read
37652  */
37653 struct LDKCVec_u8Z ChannelUpdateInfo_write(const struct LDKChannelUpdateInfo *NONNULL_PTR obj);
37654
37655 /**
37656  * Read a ChannelUpdateInfo from a byte array, created by ChannelUpdateInfo_write
37657  */
37658 struct LDKCResult_ChannelUpdateInfoDecodeErrorZ ChannelUpdateInfo_read(struct LDKu8slice ser);
37659
37660 /**
37661  * Frees any resources used by the ChannelInfo, if is_owned is set and inner is non-NULL.
37662  */
37663 void ChannelInfo_free(struct LDKChannelInfo this_obj);
37664
37665 /**
37666  * Protocol features of a channel communicated during its announcement
37667  */
37668 struct LDKChannelFeatures ChannelInfo_get_features(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
37669
37670 /**
37671  * Protocol features of a channel communicated during its announcement
37672  */
37673 void ChannelInfo_set_features(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
37674
37675 /**
37676  * Source node of the first direction of a channel
37677  */
37678 struct LDKNodeId ChannelInfo_get_node_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
37679
37680 /**
37681  * Source node of the first direction of a channel
37682  */
37683 void ChannelInfo_set_node_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKNodeId val);
37684
37685 /**
37686  * Details about the first direction of a channel
37687  *
37688  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
37689  */
37690 struct LDKChannelUpdateInfo ChannelInfo_get_one_to_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
37691
37692 /**
37693  * Details about the first direction of a channel
37694  *
37695  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
37696  */
37697 void ChannelInfo_set_one_to_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdateInfo val);
37698
37699 /**
37700  * Source node of the second direction of a channel
37701  */
37702 struct LDKNodeId ChannelInfo_get_node_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
37703
37704 /**
37705  * Source node of the second direction of a channel
37706  */
37707 void ChannelInfo_set_node_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKNodeId val);
37708
37709 /**
37710  * Details about the second direction of a channel
37711  *
37712  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
37713  */
37714 struct LDKChannelUpdateInfo ChannelInfo_get_two_to_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
37715
37716 /**
37717  * Details about the second direction of a channel
37718  *
37719  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
37720  */
37721 void ChannelInfo_set_two_to_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdateInfo val);
37722
37723 /**
37724  * The channel capacity as seen on-chain, if chain lookup is available.
37725  */
37726 struct LDKCOption_u64Z ChannelInfo_get_capacity_sats(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
37727
37728 /**
37729  * The channel capacity as seen on-chain, if chain lookup is available.
37730  */
37731 void ChannelInfo_set_capacity_sats(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
37732
37733 /**
37734  * An initial announcement of the channel
37735  * Mostly redundant with the data we store in fields explicitly.
37736  * Everything else is useful only for sending out for initial routing sync.
37737  * Not stored if contains excess data to prevent DoS.
37738  *
37739  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
37740  */
37741 struct LDKChannelAnnouncement ChannelInfo_get_announcement_message(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
37742
37743 /**
37744  * An initial announcement of the channel
37745  * Mostly redundant with the data we store in fields explicitly.
37746  * Everything else is useful only for sending out for initial routing sync.
37747  * Not stored if contains excess data to prevent DoS.
37748  *
37749  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
37750  */
37751 void ChannelInfo_set_announcement_message(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelAnnouncement val);
37752
37753 /**
37754  * Creates a copy of the ChannelInfo
37755  */
37756 struct LDKChannelInfo ChannelInfo_clone(const struct LDKChannelInfo *NONNULL_PTR orig);
37757
37758 /**
37759  * Checks if two ChannelInfos contain equal inner contents.
37760  * This ignores pointers and is_owned flags and looks at the values in fields.
37761  * Two objects with NULL inner values will be considered "equal" here.
37762  */
37763 bool ChannelInfo_eq(const struct LDKChannelInfo *NONNULL_PTR a, const struct LDKChannelInfo *NONNULL_PTR b);
37764
37765 /**
37766  * Returns a [`ChannelUpdateInfo`] based on the direction implied by the channel_flag.
37767  *
37768  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
37769  */
37770 MUST_USE_RES struct LDKChannelUpdateInfo ChannelInfo_get_directional_info(const struct LDKChannelInfo *NONNULL_PTR this_arg, uint8_t channel_flags);
37771
37772 /**
37773  * Serialize the ChannelInfo object into a byte array which can be read by ChannelInfo_read
37774  */
37775 struct LDKCVec_u8Z ChannelInfo_write(const struct LDKChannelInfo *NONNULL_PTR obj);
37776
37777 /**
37778  * Read a ChannelInfo from a byte array, created by ChannelInfo_write
37779  */
37780 struct LDKCResult_ChannelInfoDecodeErrorZ ChannelInfo_read(struct LDKu8slice ser);
37781
37782 /**
37783  * Frees any resources used by the DirectedChannelInfo, if is_owned is set and inner is non-NULL.
37784  */
37785 void DirectedChannelInfo_free(struct LDKDirectedChannelInfo this_obj);
37786
37787 /**
37788  * Creates a copy of the DirectedChannelInfo
37789  */
37790 struct LDKDirectedChannelInfo DirectedChannelInfo_clone(const struct LDKDirectedChannelInfo *NONNULL_PTR orig);
37791
37792 /**
37793  * Returns information for the channel.
37794  */
37795 MUST_USE_RES struct LDKChannelInfo DirectedChannelInfo_channel(const struct LDKDirectedChannelInfo *NONNULL_PTR this_arg);
37796
37797 /**
37798  * Returns the maximum HTLC amount allowed over the channel in the direction.
37799  */
37800 MUST_USE_RES uint64_t DirectedChannelInfo_htlc_maximum_msat(const struct LDKDirectedChannelInfo *NONNULL_PTR this_arg);
37801
37802 /**
37803  * Returns the [`EffectiveCapacity`] of the channel in the direction.
37804  *
37805  * This is either the total capacity from the funding transaction, if known, or the
37806  * `htlc_maximum_msat` for the direction as advertised by the gossip network, if known,
37807  * otherwise.
37808  */
37809 MUST_USE_RES struct LDKEffectiveCapacity DirectedChannelInfo_effective_capacity(const struct LDKDirectedChannelInfo *NONNULL_PTR this_arg);
37810
37811 /**
37812  * Frees any resources used by the EffectiveCapacity
37813  */
37814 void EffectiveCapacity_free(struct LDKEffectiveCapacity this_ptr);
37815
37816 /**
37817  * Creates a copy of the EffectiveCapacity
37818  */
37819 struct LDKEffectiveCapacity EffectiveCapacity_clone(const struct LDKEffectiveCapacity *NONNULL_PTR orig);
37820
37821 /**
37822  * Utility method to constructs a new ExactLiquidity-variant EffectiveCapacity
37823  */
37824 struct LDKEffectiveCapacity EffectiveCapacity_exact_liquidity(uint64_t liquidity_msat);
37825
37826 /**
37827  * Utility method to constructs a new AdvertisedMaxHTLC-variant EffectiveCapacity
37828  */
37829 struct LDKEffectiveCapacity EffectiveCapacity_advertised_max_htlc(uint64_t amount_msat);
37830
37831 /**
37832  * Utility method to constructs a new Total-variant EffectiveCapacity
37833  */
37834 struct LDKEffectiveCapacity EffectiveCapacity_total(uint64_t capacity_msat, uint64_t htlc_maximum_msat);
37835
37836 /**
37837  * Utility method to constructs a new Infinite-variant EffectiveCapacity
37838  */
37839 struct LDKEffectiveCapacity EffectiveCapacity_infinite(void);
37840
37841 /**
37842  * Utility method to constructs a new HintMaxHTLC-variant EffectiveCapacity
37843  */
37844 struct LDKEffectiveCapacity EffectiveCapacity_hint_max_htlc(uint64_t amount_msat);
37845
37846 /**
37847  * Utility method to constructs a new Unknown-variant EffectiveCapacity
37848  */
37849 struct LDKEffectiveCapacity EffectiveCapacity_unknown(void);
37850
37851 /**
37852  * Returns the effective capacity denominated in millisatoshi.
37853  */
37854 MUST_USE_RES uint64_t EffectiveCapacity_as_msat(const struct LDKEffectiveCapacity *NONNULL_PTR this_arg);
37855
37856 /**
37857  * Frees any resources used by the RoutingFees, if is_owned is set and inner is non-NULL.
37858  */
37859 void RoutingFees_free(struct LDKRoutingFees this_obj);
37860
37861 /**
37862  * Flat routing fee in millisatoshis.
37863  */
37864 uint32_t RoutingFees_get_base_msat(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
37865
37866 /**
37867  * Flat routing fee in millisatoshis.
37868  */
37869 void RoutingFees_set_base_msat(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
37870
37871 /**
37872  * Liquidity-based routing fee in millionths of a routed amount.
37873  * In other words, 10000 is 1%.
37874  */
37875 uint32_t RoutingFees_get_proportional_millionths(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
37876
37877 /**
37878  * Liquidity-based routing fee in millionths of a routed amount.
37879  * In other words, 10000 is 1%.
37880  */
37881 void RoutingFees_set_proportional_millionths(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
37882
37883 /**
37884  * Constructs a new RoutingFees given each field
37885  */
37886 MUST_USE_RES struct LDKRoutingFees RoutingFees_new(uint32_t base_msat_arg, uint32_t proportional_millionths_arg);
37887
37888 /**
37889  * Checks if two RoutingFeess contain equal inner contents.
37890  * This ignores pointers and is_owned flags and looks at the values in fields.
37891  * Two objects with NULL inner values will be considered "equal" here.
37892  */
37893 bool RoutingFees_eq(const struct LDKRoutingFees *NONNULL_PTR a, const struct LDKRoutingFees *NONNULL_PTR b);
37894
37895 /**
37896  * Creates a copy of the RoutingFees
37897  */
37898 struct LDKRoutingFees RoutingFees_clone(const struct LDKRoutingFees *NONNULL_PTR orig);
37899
37900 /**
37901  * Generates a non-cryptographic 64-bit hash of the RoutingFees.
37902  */
37903 uint64_t RoutingFees_hash(const struct LDKRoutingFees *NONNULL_PTR o);
37904
37905 /**
37906  * Serialize the RoutingFees object into a byte array which can be read by RoutingFees_read
37907  */
37908 struct LDKCVec_u8Z RoutingFees_write(const struct LDKRoutingFees *NONNULL_PTR obj);
37909
37910 /**
37911  * Read a RoutingFees from a byte array, created by RoutingFees_write
37912  */
37913 struct LDKCResult_RoutingFeesDecodeErrorZ RoutingFees_read(struct LDKu8slice ser);
37914
37915 /**
37916  * Frees any resources used by the NodeAnnouncementInfo, if is_owned is set and inner is non-NULL.
37917  */
37918 void NodeAnnouncementInfo_free(struct LDKNodeAnnouncementInfo this_obj);
37919
37920 /**
37921  * Protocol features the node announced support for
37922  */
37923 struct LDKNodeFeatures NodeAnnouncementInfo_get_features(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
37924
37925 /**
37926  * Protocol features the node announced support for
37927  */
37928 void NodeAnnouncementInfo_set_features(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
37929
37930 /**
37931  * When the last known update to the node state was issued.
37932  * Value is opaque, as set in the announcement.
37933  */
37934 uint32_t NodeAnnouncementInfo_get_last_update(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
37935
37936 /**
37937  * When the last known update to the node state was issued.
37938  * Value is opaque, as set in the announcement.
37939  */
37940 void NodeAnnouncementInfo_set_last_update(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, uint32_t val);
37941
37942 /**
37943  * Color assigned to the node
37944  */
37945 const uint8_t (*NodeAnnouncementInfo_get_rgb(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[3];
37946
37947 /**
37948  * Color assigned to the node
37949  */
37950 void NodeAnnouncementInfo_set_rgb(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
37951
37952 /**
37953  * Moniker assigned to the node.
37954  * May be invalid or malicious (eg control chars),
37955  * should not be exposed to the user.
37956  */
37957 struct LDKNodeAlias NodeAnnouncementInfo_get_alias(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
37958
37959 /**
37960  * Moniker assigned to the node.
37961  * May be invalid or malicious (eg control chars),
37962  * should not be exposed to the user.
37963  */
37964 void NodeAnnouncementInfo_set_alias(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeAlias val);
37965
37966 /**
37967  * An initial announcement of the node
37968  * Mostly redundant with the data we store in fields explicitly.
37969  * Everything else is useful only for sending out for initial routing sync.
37970  * Not stored if contains excess data to prevent DoS.
37971  *
37972  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
37973  */
37974 struct LDKNodeAnnouncement NodeAnnouncementInfo_get_announcement_message(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
37975
37976 /**
37977  * An initial announcement of the node
37978  * Mostly redundant with the data we store in fields explicitly.
37979  * Everything else is useful only for sending out for initial routing sync.
37980  * Not stored if contains excess data to prevent DoS.
37981  *
37982  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
37983  */
37984 void NodeAnnouncementInfo_set_announcement_message(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncement val);
37985
37986 /**
37987  * Constructs a new NodeAnnouncementInfo given each field
37988  */
37989 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);
37990
37991 /**
37992  * Creates a copy of the NodeAnnouncementInfo
37993  */
37994 struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_clone(const struct LDKNodeAnnouncementInfo *NONNULL_PTR orig);
37995
37996 /**
37997  * Checks if two NodeAnnouncementInfos contain equal inner contents.
37998  * This ignores pointers and is_owned flags and looks at the values in fields.
37999  * Two objects with NULL inner values will be considered "equal" here.
38000  */
38001 bool NodeAnnouncementInfo_eq(const struct LDKNodeAnnouncementInfo *NONNULL_PTR a, const struct LDKNodeAnnouncementInfo *NONNULL_PTR b);
38002
38003 /**
38004  * Internet-level addresses via which one can connect to the node
38005  */
38006 MUST_USE_RES struct LDKCVec_NetAddressZ NodeAnnouncementInfo_addresses(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_arg);
38007
38008 /**
38009  * Serialize the NodeAnnouncementInfo object into a byte array which can be read by NodeAnnouncementInfo_read
38010  */
38011 struct LDKCVec_u8Z NodeAnnouncementInfo_write(const struct LDKNodeAnnouncementInfo *NONNULL_PTR obj);
38012
38013 /**
38014  * Read a NodeAnnouncementInfo from a byte array, created by NodeAnnouncementInfo_write
38015  */
38016 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ NodeAnnouncementInfo_read(struct LDKu8slice ser);
38017
38018 /**
38019  * Frees any resources used by the NodeAlias, if is_owned is set and inner is non-NULL.
38020  */
38021 void NodeAlias_free(struct LDKNodeAlias this_obj);
38022
38023 const uint8_t (*NodeAlias_get_a(const struct LDKNodeAlias *NONNULL_PTR this_ptr))[32];
38024
38025 void NodeAlias_set_a(struct LDKNodeAlias *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
38026
38027 /**
38028  * Constructs a new NodeAlias given each field
38029  */
38030 MUST_USE_RES struct LDKNodeAlias NodeAlias_new(struct LDKThirtyTwoBytes a_arg);
38031
38032 /**
38033  * Creates a copy of the NodeAlias
38034  */
38035 struct LDKNodeAlias NodeAlias_clone(const struct LDKNodeAlias *NONNULL_PTR orig);
38036
38037 /**
38038  * Checks if two NodeAliass contain equal inner contents.
38039  * This ignores pointers and is_owned flags and looks at the values in fields.
38040  * Two objects with NULL inner values will be considered "equal" here.
38041  */
38042 bool NodeAlias_eq(const struct LDKNodeAlias *NONNULL_PTR a, const struct LDKNodeAlias *NONNULL_PTR b);
38043
38044 /**
38045  * Serialize the NodeAlias object into a byte array which can be read by NodeAlias_read
38046  */
38047 struct LDKCVec_u8Z NodeAlias_write(const struct LDKNodeAlias *NONNULL_PTR obj);
38048
38049 /**
38050  * Read a NodeAlias from a byte array, created by NodeAlias_write
38051  */
38052 struct LDKCResult_NodeAliasDecodeErrorZ NodeAlias_read(struct LDKu8slice ser);
38053
38054 /**
38055  * Frees any resources used by the NodeInfo, if is_owned is set and inner is non-NULL.
38056  */
38057 void NodeInfo_free(struct LDKNodeInfo this_obj);
38058
38059 /**
38060  * All valid channels a node has announced
38061  *
38062  * Returns a copy of the field.
38063  */
38064 struct LDKCVec_u64Z NodeInfo_get_channels(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
38065
38066 /**
38067  * All valid channels a node has announced
38068  */
38069 void NodeInfo_set_channels(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
38070
38071 /**
38072  * More information about a node from node_announcement.
38073  * Optional because we store a Node entry after learning about it from
38074  * a channel announcement, but before receiving a node announcement.
38075  *
38076  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
38077  */
38078 struct LDKNodeAnnouncementInfo NodeInfo_get_announcement_info(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
38079
38080 /**
38081  * More information about a node from node_announcement.
38082  * Optional because we store a Node entry after learning about it from
38083  * a channel announcement, but before receiving a node announcement.
38084  *
38085  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
38086  */
38087 void NodeInfo_set_announcement_info(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncementInfo val);
38088
38089 /**
38090  * Constructs a new NodeInfo given each field
38091  */
38092 MUST_USE_RES struct LDKNodeInfo NodeInfo_new(struct LDKCVec_u64Z channels_arg, struct LDKNodeAnnouncementInfo announcement_info_arg);
38093
38094 /**
38095  * Creates a copy of the NodeInfo
38096  */
38097 struct LDKNodeInfo NodeInfo_clone(const struct LDKNodeInfo *NONNULL_PTR orig);
38098
38099 /**
38100  * Checks if two NodeInfos contain equal inner contents.
38101  * This ignores pointers and is_owned flags and looks at the values in fields.
38102  * Two objects with NULL inner values will be considered "equal" here.
38103  */
38104 bool NodeInfo_eq(const struct LDKNodeInfo *NONNULL_PTR a, const struct LDKNodeInfo *NONNULL_PTR b);
38105
38106 /**
38107  * Serialize the NodeInfo object into a byte array which can be read by NodeInfo_read
38108  */
38109 struct LDKCVec_u8Z NodeInfo_write(const struct LDKNodeInfo *NONNULL_PTR obj);
38110
38111 /**
38112  * Read a NodeInfo from a byte array, created by NodeInfo_write
38113  */
38114 struct LDKCResult_NodeInfoDecodeErrorZ NodeInfo_read(struct LDKu8slice ser);
38115
38116 /**
38117  * Serialize the NetworkGraph object into a byte array which can be read by NetworkGraph_read
38118  */
38119 struct LDKCVec_u8Z NetworkGraph_write(const struct LDKNetworkGraph *NONNULL_PTR obj);
38120
38121 /**
38122  * Read a NetworkGraph from a byte array, created by NetworkGraph_write
38123  */
38124 struct LDKCResult_NetworkGraphDecodeErrorZ NetworkGraph_read(struct LDKu8slice ser, struct LDKLogger arg);
38125
38126 /**
38127  * Creates a new, empty, network graph.
38128  */
38129 MUST_USE_RES struct LDKNetworkGraph NetworkGraph_new(enum LDKNetwork network, struct LDKLogger logger);
38130
38131 /**
38132  * Returns a read-only view of the network graph.
38133  */
38134 MUST_USE_RES struct LDKReadOnlyNetworkGraph NetworkGraph_read_only(const struct LDKNetworkGraph *NONNULL_PTR this_arg);
38135
38136 /**
38137  * The unix timestamp provided by the most recent rapid gossip sync.
38138  * It will be set by the rapid sync process after every sync completion.
38139  */
38140 MUST_USE_RES struct LDKCOption_u32Z NetworkGraph_get_last_rapid_gossip_sync_timestamp(const struct LDKNetworkGraph *NONNULL_PTR this_arg);
38141
38142 /**
38143  * Update the unix timestamp provided by the most recent rapid gossip sync.
38144  * This should be done automatically by the rapid sync process after every sync completion.
38145  */
38146 void NetworkGraph_set_last_rapid_gossip_sync_timestamp(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint32_t last_rapid_gossip_sync_timestamp);
38147
38148 /**
38149  * For an already known node (from channel announcements), update its stored properties from a
38150  * given node announcement.
38151  *
38152  * You probably don't want to call this directly, instead relying on a P2PGossipSync's
38153  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
38154  * routing messages from a source using a protocol other than the lightning P2P protocol.
38155  */
38156 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_announcement(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
38157
38158 /**
38159  * For an already known node (from channel announcements), update its stored properties from a
38160  * given node announcement without verifying the associated signatures. Because we aren't
38161  * given the associated signatures here we cannot relay the node announcement to any of our
38162  * peers.
38163  */
38164 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);
38165
38166 /**
38167  * Store or update channel info from a channel announcement.
38168  *
38169  * You probably don't want to call this directly, instead relying on a [`P2PGossipSync`]'s
38170  * [`RoutingMessageHandler`] implementation to call it indirectly. This may be useful to accept
38171  * routing messages from a source using a protocol other than the lightning P2P protocol.
38172  *
38173  * If a [`UtxoLookup`] object is provided via `utxo_lookup`, it will be called to verify
38174  * the corresponding UTXO exists on chain and is correctly-formatted.
38175  */
38176 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);
38177
38178 /**
38179  * Store or update channel info from a channel announcement.
38180  *
38181  * You probably don't want to call this directly, instead relying on a [`P2PGossipSync`]'s
38182  * [`RoutingMessageHandler`] implementation to call it indirectly. This may be useful to accept
38183  * routing messages from a source using a protocol other than the lightning P2P protocol.
38184  *
38185  * This will skip verification of if the channel is actually on-chain.
38186  */
38187 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_from_announcement_no_lookup(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelAnnouncement *NONNULL_PTR msg);
38188
38189 /**
38190  * Store or update channel info from a channel announcement without verifying the associated
38191  * signatures. Because we aren't given the associated signatures here we cannot relay the
38192  * channel announcement to any of our peers.
38193  *
38194  * If a [`UtxoLookup`] object is provided via `utxo_lookup`, it will be called to verify
38195  * the corresponding UTXO exists on chain and is correctly-formatted.
38196  */
38197 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);
38198
38199 /**
38200  * Update channel from partial announcement data received via rapid gossip sync
38201  *
38202  * `timestamp: u64`: Timestamp emulating the backdated original announcement receipt (by the
38203  * rapid gossip sync server)
38204  *
38205  * All other parameters as used in [`msgs::UnsignedChannelAnnouncement`] fields.
38206  */
38207 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);
38208
38209 /**
38210  * Marks a channel in the graph as failed permanently.
38211  *
38212  * The channel and any node for which this was their last channel are removed from the graph.
38213  */
38214 void NetworkGraph_channel_failed_permanent(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id);
38215
38216 /**
38217  * Marks a node in the graph as permanently failed, effectively removing it and its channels
38218  * from local storage.
38219  */
38220 void NetworkGraph_node_failed_permanent(const struct LDKNetworkGraph *NONNULL_PTR this_arg, struct LDKPublicKey node_id);
38221
38222 /**
38223  * Removes information about channels that we haven't heard any updates about in some time.
38224  * This can be used regularly to prune the network graph of channels that likely no longer
38225  * exist.
38226  *
38227  * While there is no formal requirement that nodes regularly re-broadcast their channel
38228  * updates every two weeks, the non-normative section of BOLT 7 currently suggests that
38229  * pruning occur for updates which are at least two weeks old, which we implement here.
38230  *
38231  * Note that for users of the `lightning-background-processor` crate this method may be
38232  * automatically called regularly for you.
38233  *
38234  * This method will also cause us to stop tracking removed nodes and channels if they have been
38235  * in the map for a while so that these can be resynced from gossip in the future.
38236  *
38237  * This method is only available with the `std` feature. See
38238  * [`NetworkGraph::remove_stale_channels_and_tracking_with_time`] for `no-std` use.
38239  */
38240 void NetworkGraph_remove_stale_channels_and_tracking(const struct LDKNetworkGraph *NONNULL_PTR this_arg);
38241
38242 /**
38243  * Removes information about channels that we haven't heard any updates about in some time.
38244  * This can be used regularly to prune the network graph of channels that likely no longer
38245  * exist.
38246  *
38247  * While there is no formal requirement that nodes regularly re-broadcast their channel
38248  * updates every two weeks, the non-normative section of BOLT 7 currently suggests that
38249  * pruning occur for updates which are at least two weeks old, which we implement here.
38250  *
38251  * This method will also cause us to stop tracking removed nodes and channels if they have been
38252  * in the map for a while so that these can be resynced from gossip in the future.
38253  *
38254  * This function takes the current unix time as an argument. For users with the `std` feature
38255  * enabled, [`NetworkGraph::remove_stale_channels_and_tracking`] may be preferable.
38256  */
38257 void NetworkGraph_remove_stale_channels_and_tracking_with_time(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t current_time_unix);
38258
38259 /**
38260  * For an already known (from announcement) channel, update info about one of the directions
38261  * of the channel.
38262  *
38263  * You probably don't want to call this directly, instead relying on a P2PGossipSync's
38264  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
38265  * routing messages from a source using a protocol other than the lightning P2P protocol.
38266  *
38267  * If built with `no-std`, any updates with a timestamp more than two weeks in the past or
38268  * materially in the future will be rejected.
38269  */
38270 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
38271
38272 /**
38273  * For an already known (from announcement) channel, update info about one of the directions
38274  * of the channel without verifying the associated signatures. Because we aren't given the
38275  * associated signatures here we cannot relay the channel update to any of our peers.
38276  *
38277  * If built with `no-std`, any updates with a timestamp more than two weeks in the past or
38278  * materially in the future will be rejected.
38279  */
38280 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_unsigned(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelUpdate *NONNULL_PTR msg);
38281
38282 /**
38283  * Returns information on a channel with the given id.
38284  *
38285  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
38286  */
38287 MUST_USE_RES struct LDKChannelInfo ReadOnlyNetworkGraph_channel(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id);
38288
38289 /**
38290  * Returns the list of channels in the graph
38291  */
38292 MUST_USE_RES struct LDKCVec_u64Z ReadOnlyNetworkGraph_list_channels(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg);
38293
38294 /**
38295  * Returns information on a node with the given id.
38296  *
38297  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
38298  */
38299 MUST_USE_RES struct LDKNodeInfo ReadOnlyNetworkGraph_node(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR node_id);
38300
38301 /**
38302  * Returns the list of nodes in the graph
38303  */
38304 MUST_USE_RES struct LDKCVec_NodeIdZ ReadOnlyNetworkGraph_list_nodes(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg);
38305
38306 /**
38307  * Get network addresses by node id.
38308  * Returns None if the requested node is completely unknown,
38309  * or if node announcement for the node was never received.
38310  */
38311 MUST_USE_RES struct LDKCOption_CVec_NetAddressZZ ReadOnlyNetworkGraph_get_addresses(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg, struct LDKPublicKey pubkey);
38312
38313 /**
38314  * Frees any resources used by the DefaultRouter, if is_owned is set and inner is non-NULL.
38315  */
38316 void DefaultRouter_free(struct LDKDefaultRouter this_obj);
38317
38318 /**
38319  * Creates a new router.
38320  */
38321 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, struct LDKProbabilisticScoringFeeParameters score_params);
38322
38323 /**
38324  * Constructs a new Router which calls the relevant methods on this_arg.
38325  * This copies the `inner` pointer in this_arg and thus the returned Router must be freed before this_arg is
38326  */
38327 struct LDKRouter DefaultRouter_as_Router(const struct LDKDefaultRouter *NONNULL_PTR this_arg);
38328
38329 /**
38330  * Calls the free function if one is set
38331  */
38332 void Router_free(struct LDKRouter this_ptr);
38333
38334 /**
38335  * Frees any resources used by the ScorerAccountingForInFlightHtlcs, if is_owned is set and inner is non-NULL.
38336  */
38337 void ScorerAccountingForInFlightHtlcs_free(struct LDKScorerAccountingForInFlightHtlcs this_obj);
38338
38339 /**
38340  * Initialize a new `ScorerAccountingForInFlightHtlcs`.
38341  */
38342 MUST_USE_RES struct LDKScorerAccountingForInFlightHtlcs ScorerAccountingForInFlightHtlcs_new(struct LDKScore scorer, const struct LDKInFlightHtlcs *NONNULL_PTR inflight_htlcs);
38343
38344 /**
38345  * Serialize the ScorerAccountingForInFlightHtlcs object into a byte array which can be read by ScorerAccountingForInFlightHtlcs_read
38346  */
38347 struct LDKCVec_u8Z ScorerAccountingForInFlightHtlcs_write(const struct LDKScorerAccountingForInFlightHtlcs *NONNULL_PTR obj);
38348
38349 /**
38350  * Constructs a new Score which calls the relevant methods on this_arg.
38351  * This copies the `inner` pointer in this_arg and thus the returned Score must be freed before this_arg is
38352  */
38353 struct LDKScore ScorerAccountingForInFlightHtlcs_as_Score(const struct LDKScorerAccountingForInFlightHtlcs *NONNULL_PTR this_arg);
38354
38355 /**
38356  * Frees any resources used by the InFlightHtlcs, if is_owned is set and inner is non-NULL.
38357  */
38358 void InFlightHtlcs_free(struct LDKInFlightHtlcs this_obj);
38359
38360 /**
38361  * Creates a copy of the InFlightHtlcs
38362  */
38363 struct LDKInFlightHtlcs InFlightHtlcs_clone(const struct LDKInFlightHtlcs *NONNULL_PTR orig);
38364
38365 /**
38366  * Constructs an empty `InFlightHtlcs`.
38367  */
38368 MUST_USE_RES struct LDKInFlightHtlcs InFlightHtlcs_new(void);
38369
38370 /**
38371  * Takes in a path with payer's node id and adds the path's details to `InFlightHtlcs`.
38372  */
38373 void InFlightHtlcs_process_path(struct LDKInFlightHtlcs *NONNULL_PTR this_arg, const struct LDKPath *NONNULL_PTR path, struct LDKPublicKey payer_node_id);
38374
38375 /**
38376  * Adds a known HTLC given the public key of the HTLC source, target, and short channel
38377  * id.
38378  */
38379 void InFlightHtlcs_add_inflight_htlc(struct LDKInFlightHtlcs *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR source, const struct LDKNodeId *NONNULL_PTR target, uint64_t channel_scid, uint64_t used_msat);
38380
38381 /**
38382  * Returns liquidity in msat given the public key of the HTLC source, target, and short channel
38383  * id.
38384  */
38385 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);
38386
38387 /**
38388  * Serialize the InFlightHtlcs object into a byte array which can be read by InFlightHtlcs_read
38389  */
38390 struct LDKCVec_u8Z InFlightHtlcs_write(const struct LDKInFlightHtlcs *NONNULL_PTR obj);
38391
38392 /**
38393  * Read a InFlightHtlcs from a byte array, created by InFlightHtlcs_write
38394  */
38395 struct LDKCResult_InFlightHtlcsDecodeErrorZ InFlightHtlcs_read(struct LDKu8slice ser);
38396
38397 /**
38398  * Frees any resources used by the RouteHop, if is_owned is set and inner is non-NULL.
38399  */
38400 void RouteHop_free(struct LDKRouteHop this_obj);
38401
38402 /**
38403  * The node_id of the node at this hop.
38404  */
38405 struct LDKPublicKey RouteHop_get_pubkey(const struct LDKRouteHop *NONNULL_PTR this_ptr);
38406
38407 /**
38408  * The node_id of the node at this hop.
38409  */
38410 void RouteHop_set_pubkey(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKPublicKey val);
38411
38412 /**
38413  * The node_announcement features of the node at this hop. For the last hop, these may be
38414  * amended to match the features present in the invoice this node generated.
38415  */
38416 struct LDKNodeFeatures RouteHop_get_node_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
38417
38418 /**
38419  * The node_announcement features of the node at this hop. For the last hop, these may be
38420  * amended to match the features present in the invoice this node generated.
38421  */
38422 void RouteHop_set_node_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
38423
38424 /**
38425  * The channel that should be used from the previous hop to reach this node.
38426  */
38427 uint64_t RouteHop_get_short_channel_id(const struct LDKRouteHop *NONNULL_PTR this_ptr);
38428
38429 /**
38430  * The channel that should be used from the previous hop to reach this node.
38431  */
38432 void RouteHop_set_short_channel_id(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
38433
38434 /**
38435  * The channel_announcement features of the channel that should be used from the previous hop
38436  * to reach this node.
38437  */
38438 struct LDKChannelFeatures RouteHop_get_channel_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
38439
38440 /**
38441  * The channel_announcement features of the channel that should be used from the previous hop
38442  * to reach this node.
38443  */
38444 void RouteHop_set_channel_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
38445
38446 /**
38447  * The fee taken on this hop (for paying for the use of the *next* channel in the path).
38448  * If this is the last hop in [`Path::hops`]:
38449  * * if we're sending to a [`BlindedPath`], this is the fee paid for use of the entire blinded path
38450  * * otherwise, this is the full value of this [`Path`]'s part of the payment
38451  *
38452  * [`BlindedPath`]: crate::blinded_path::BlindedPath
38453  */
38454 uint64_t RouteHop_get_fee_msat(const struct LDKRouteHop *NONNULL_PTR this_ptr);
38455
38456 /**
38457  * The fee taken on this hop (for paying for the use of the *next* channel in the path).
38458  * If this is the last hop in [`Path::hops`]:
38459  * * if we're sending to a [`BlindedPath`], this is the fee paid for use of the entire blinded path
38460  * * otherwise, this is the full value of this [`Path`]'s part of the payment
38461  *
38462  * [`BlindedPath`]: crate::blinded_path::BlindedPath
38463  */
38464 void RouteHop_set_fee_msat(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
38465
38466 /**
38467  * The CLTV delta added for this hop.
38468  * If this is the last hop in [`Path::hops`]:
38469  * * if we're sending to a [`BlindedPath`], this is the CLTV delta for the entire blinded path
38470  * * otherwise, this is the CLTV delta expected at the destination
38471  *
38472  * [`BlindedPath`]: crate::blinded_path::BlindedPath
38473  */
38474 uint32_t RouteHop_get_cltv_expiry_delta(const struct LDKRouteHop *NONNULL_PTR this_ptr);
38475
38476 /**
38477  * The CLTV delta added for this hop.
38478  * If this is the last hop in [`Path::hops`]:
38479  * * if we're sending to a [`BlindedPath`], this is the CLTV delta for the entire blinded path
38480  * * otherwise, this is the CLTV delta expected at the destination
38481  *
38482  * [`BlindedPath`]: crate::blinded_path::BlindedPath
38483  */
38484 void RouteHop_set_cltv_expiry_delta(struct LDKRouteHop *NONNULL_PTR this_ptr, uint32_t val);
38485
38486 /**
38487  * Constructs a new RouteHop given each field
38488  */
38489 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);
38490
38491 /**
38492  * Creates a copy of the RouteHop
38493  */
38494 struct LDKRouteHop RouteHop_clone(const struct LDKRouteHop *NONNULL_PTR orig);
38495
38496 /**
38497  * Generates a non-cryptographic 64-bit hash of the RouteHop.
38498  */
38499 uint64_t RouteHop_hash(const struct LDKRouteHop *NONNULL_PTR o);
38500
38501 /**
38502  * Checks if two RouteHops contain equal inner contents.
38503  * This ignores pointers and is_owned flags and looks at the values in fields.
38504  * Two objects with NULL inner values will be considered "equal" here.
38505  */
38506 bool RouteHop_eq(const struct LDKRouteHop *NONNULL_PTR a, const struct LDKRouteHop *NONNULL_PTR b);
38507
38508 /**
38509  * Serialize the RouteHop object into a byte array which can be read by RouteHop_read
38510  */
38511 struct LDKCVec_u8Z RouteHop_write(const struct LDKRouteHop *NONNULL_PTR obj);
38512
38513 /**
38514  * Read a RouteHop from a byte array, created by RouteHop_write
38515  */
38516 struct LDKCResult_RouteHopDecodeErrorZ RouteHop_read(struct LDKu8slice ser);
38517
38518 /**
38519  * Frees any resources used by the BlindedTail, if is_owned is set and inner is non-NULL.
38520  */
38521 void BlindedTail_free(struct LDKBlindedTail this_obj);
38522
38523 /**
38524  * The hops of the [`BlindedPath`] provided by the recipient.
38525  *
38526  * [`BlindedPath`]: crate::blinded_path::BlindedPath
38527  */
38528 struct LDKCVec_BlindedHopZ BlindedTail_get_hops(const struct LDKBlindedTail *NONNULL_PTR this_ptr);
38529
38530 /**
38531  * The hops of the [`BlindedPath`] provided by the recipient.
38532  *
38533  * [`BlindedPath`]: crate::blinded_path::BlindedPath
38534  */
38535 void BlindedTail_set_hops(struct LDKBlindedTail *NONNULL_PTR this_ptr, struct LDKCVec_BlindedHopZ val);
38536
38537 /**
38538  * The blinding point of the [`BlindedPath`] provided by the recipient.
38539  *
38540  * [`BlindedPath`]: crate::blinded_path::BlindedPath
38541  */
38542 struct LDKPublicKey BlindedTail_get_blinding_point(const struct LDKBlindedTail *NONNULL_PTR this_ptr);
38543
38544 /**
38545  * The blinding point of the [`BlindedPath`] provided by the recipient.
38546  *
38547  * [`BlindedPath`]: crate::blinded_path::BlindedPath
38548  */
38549 void BlindedTail_set_blinding_point(struct LDKBlindedTail *NONNULL_PTR this_ptr, struct LDKPublicKey val);
38550
38551 /**
38552  * Excess CLTV delta added to the recipient's CLTV expiry to deter intermediate nodes from
38553  * inferring the destination. May be 0.
38554  */
38555 uint32_t BlindedTail_get_excess_final_cltv_expiry_delta(const struct LDKBlindedTail *NONNULL_PTR this_ptr);
38556
38557 /**
38558  * Excess CLTV delta added to the recipient's CLTV expiry to deter intermediate nodes from
38559  * inferring the destination. May be 0.
38560  */
38561 void BlindedTail_set_excess_final_cltv_expiry_delta(struct LDKBlindedTail *NONNULL_PTR this_ptr, uint32_t val);
38562
38563 /**
38564  * The total amount paid on this [`Path`], excluding the fees.
38565  */
38566 uint64_t BlindedTail_get_final_value_msat(const struct LDKBlindedTail *NONNULL_PTR this_ptr);
38567
38568 /**
38569  * The total amount paid on this [`Path`], excluding the fees.
38570  */
38571 void BlindedTail_set_final_value_msat(struct LDKBlindedTail *NONNULL_PTR this_ptr, uint64_t val);
38572
38573 /**
38574  * Constructs a new BlindedTail given each field
38575  */
38576 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);
38577
38578 /**
38579  * Creates a copy of the BlindedTail
38580  */
38581 struct LDKBlindedTail BlindedTail_clone(const struct LDKBlindedTail *NONNULL_PTR orig);
38582
38583 /**
38584  * Generates a non-cryptographic 64-bit hash of the BlindedTail.
38585  */
38586 uint64_t BlindedTail_hash(const struct LDKBlindedTail *NONNULL_PTR o);
38587
38588 /**
38589  * Checks if two BlindedTails contain equal inner contents.
38590  * This ignores pointers and is_owned flags and looks at the values in fields.
38591  * Two objects with NULL inner values will be considered "equal" here.
38592  */
38593 bool BlindedTail_eq(const struct LDKBlindedTail *NONNULL_PTR a, const struct LDKBlindedTail *NONNULL_PTR b);
38594
38595 /**
38596  * Serialize the BlindedTail object into a byte array which can be read by BlindedTail_read
38597  */
38598 struct LDKCVec_u8Z BlindedTail_write(const struct LDKBlindedTail *NONNULL_PTR obj);
38599
38600 /**
38601  * Read a BlindedTail from a byte array, created by BlindedTail_write
38602  */
38603 struct LDKCResult_BlindedTailDecodeErrorZ BlindedTail_read(struct LDKu8slice ser);
38604
38605 /**
38606  * Frees any resources used by the Path, if is_owned is set and inner is non-NULL.
38607  */
38608 void Path_free(struct LDKPath this_obj);
38609
38610 /**
38611  * The list of unblinded hops in this [`Path`]. Must be at least length one.
38612  */
38613 struct LDKCVec_RouteHopZ Path_get_hops(const struct LDKPath *NONNULL_PTR this_ptr);
38614
38615 /**
38616  * The list of unblinded hops in this [`Path`]. Must be at least length one.
38617  */
38618 void Path_set_hops(struct LDKPath *NONNULL_PTR this_ptr, struct LDKCVec_RouteHopZ val);
38619
38620 /**
38621  * The blinded path at which this path terminates, if we're sending to one, and its metadata.
38622  *
38623  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
38624  */
38625 struct LDKBlindedTail Path_get_blinded_tail(const struct LDKPath *NONNULL_PTR this_ptr);
38626
38627 /**
38628  * The blinded path at which this path terminates, if we're sending to one, and its metadata.
38629  *
38630  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
38631  */
38632 void Path_set_blinded_tail(struct LDKPath *NONNULL_PTR this_ptr, struct LDKBlindedTail val);
38633
38634 /**
38635  * Constructs a new Path given each field
38636  */
38637 MUST_USE_RES struct LDKPath Path_new(struct LDKCVec_RouteHopZ hops_arg, struct LDKBlindedTail blinded_tail_arg);
38638
38639 /**
38640  * Creates a copy of the Path
38641  */
38642 struct LDKPath Path_clone(const struct LDKPath *NONNULL_PTR orig);
38643
38644 /**
38645  * Generates a non-cryptographic 64-bit hash of the Path.
38646  */
38647 uint64_t Path_hash(const struct LDKPath *NONNULL_PTR o);
38648
38649 /**
38650  * Checks if two Paths contain equal inner contents.
38651  * This ignores pointers and is_owned flags and looks at the values in fields.
38652  * Two objects with NULL inner values will be considered "equal" here.
38653  */
38654 bool Path_eq(const struct LDKPath *NONNULL_PTR a, const struct LDKPath *NONNULL_PTR b);
38655
38656 /**
38657  * Gets the fees for a given path, excluding any excess paid to the recipient.
38658  */
38659 MUST_USE_RES uint64_t Path_fee_msat(const struct LDKPath *NONNULL_PTR this_arg);
38660
38661 /**
38662  * Gets the total amount paid on this [`Path`], excluding the fees.
38663  */
38664 MUST_USE_RES uint64_t Path_final_value_msat(const struct LDKPath *NONNULL_PTR this_arg);
38665
38666 /**
38667  * Gets the final hop's CLTV expiry delta.
38668  */
38669 MUST_USE_RES struct LDKCOption_u32Z Path_final_cltv_expiry_delta(const struct LDKPath *NONNULL_PTR this_arg);
38670
38671 /**
38672  * Frees any resources used by the Route, if is_owned is set and inner is non-NULL.
38673  */
38674 void Route_free(struct LDKRoute this_obj);
38675
38676 /**
38677  * The list of [`Path`]s taken for a single (potentially-)multi-part payment. If no
38678  * [`BlindedTail`]s are present, then the pubkey of the last [`RouteHop`] in each path must be
38679  * the same.
38680  */
38681 struct LDKCVec_PathZ Route_get_paths(const struct LDKRoute *NONNULL_PTR this_ptr);
38682
38683 /**
38684  * The list of [`Path`]s taken for a single (potentially-)multi-part payment. If no
38685  * [`BlindedTail`]s are present, then the pubkey of the last [`RouteHop`] in each path must be
38686  * the same.
38687  */
38688 void Route_set_paths(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKCVec_PathZ val);
38689
38690 /**
38691  * The `payment_params` parameter passed via [`RouteParameters`] to [`find_route`].
38692  *
38693  * This is used by `ChannelManager` to track information which may be required for retries.
38694  *
38695  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
38696  */
38697 struct LDKPaymentParameters Route_get_payment_params(const struct LDKRoute *NONNULL_PTR this_ptr);
38698
38699 /**
38700  * The `payment_params` parameter passed via [`RouteParameters`] to [`find_route`].
38701  *
38702  * This is used by `ChannelManager` to track information which may be required for retries.
38703  *
38704  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
38705  */
38706 void Route_set_payment_params(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKPaymentParameters val);
38707
38708 /**
38709  * Constructs a new Route given each field
38710  */
38711 MUST_USE_RES struct LDKRoute Route_new(struct LDKCVec_PathZ paths_arg, struct LDKPaymentParameters payment_params_arg);
38712
38713 /**
38714  * Creates a copy of the Route
38715  */
38716 struct LDKRoute Route_clone(const struct LDKRoute *NONNULL_PTR orig);
38717
38718 /**
38719  * Generates a non-cryptographic 64-bit hash of the Route.
38720  */
38721 uint64_t Route_hash(const struct LDKRoute *NONNULL_PTR o);
38722
38723 /**
38724  * Checks if two Routes contain equal inner contents.
38725  * This ignores pointers and is_owned flags and looks at the values in fields.
38726  * Two objects with NULL inner values will be considered "equal" here.
38727  */
38728 bool Route_eq(const struct LDKRoute *NONNULL_PTR a, const struct LDKRoute *NONNULL_PTR b);
38729
38730 /**
38731  * Returns the total amount of fees paid on this [`Route`].
38732  *
38733  * This doesn't include any extra payment made to the recipient, which can happen in excess of
38734  * the amount passed to [`find_route`]'s `route_params.final_value_msat`.
38735  */
38736 MUST_USE_RES uint64_t Route_get_total_fees(const struct LDKRoute *NONNULL_PTR this_arg);
38737
38738 /**
38739  * Returns the total amount paid on this [`Route`], excluding the fees. Might be more than
38740  * requested if we had to reach htlc_minimum_msat.
38741  */
38742 MUST_USE_RES uint64_t Route_get_total_amount(const struct LDKRoute *NONNULL_PTR this_arg);
38743
38744 /**
38745  * Serialize the Route object into a byte array which can be read by Route_read
38746  */
38747 struct LDKCVec_u8Z Route_write(const struct LDKRoute *NONNULL_PTR obj);
38748
38749 /**
38750  * Read a Route from a byte array, created by Route_write
38751  */
38752 struct LDKCResult_RouteDecodeErrorZ Route_read(struct LDKu8slice ser);
38753
38754 /**
38755  * Frees any resources used by the RouteParameters, if is_owned is set and inner is non-NULL.
38756  */
38757 void RouteParameters_free(struct LDKRouteParameters this_obj);
38758
38759 /**
38760  * The parameters of the failed payment path.
38761  */
38762 struct LDKPaymentParameters RouteParameters_get_payment_params(const struct LDKRouteParameters *NONNULL_PTR this_ptr);
38763
38764 /**
38765  * The parameters of the failed payment path.
38766  */
38767 void RouteParameters_set_payment_params(struct LDKRouteParameters *NONNULL_PTR this_ptr, struct LDKPaymentParameters val);
38768
38769 /**
38770  * The amount in msats sent on the failed payment path.
38771  */
38772 uint64_t RouteParameters_get_final_value_msat(const struct LDKRouteParameters *NONNULL_PTR this_ptr);
38773
38774 /**
38775  * The amount in msats sent on the failed payment path.
38776  */
38777 void RouteParameters_set_final_value_msat(struct LDKRouteParameters *NONNULL_PTR this_ptr, uint64_t val);
38778
38779 /**
38780  * Constructs a new RouteParameters given each field
38781  */
38782 MUST_USE_RES struct LDKRouteParameters RouteParameters_new(struct LDKPaymentParameters payment_params_arg, uint64_t final_value_msat_arg);
38783
38784 /**
38785  * Creates a copy of the RouteParameters
38786  */
38787 struct LDKRouteParameters RouteParameters_clone(const struct LDKRouteParameters *NONNULL_PTR orig);
38788
38789 /**
38790  * Checks if two RouteParameterss contain equal inner contents.
38791  * This ignores pointers and is_owned flags and looks at the values in fields.
38792  * Two objects with NULL inner values will be considered "equal" here.
38793  */
38794 bool RouteParameters_eq(const struct LDKRouteParameters *NONNULL_PTR a, const struct LDKRouteParameters *NONNULL_PTR b);
38795
38796 /**
38797  * Serialize the RouteParameters object into a byte array which can be read by RouteParameters_read
38798  */
38799 struct LDKCVec_u8Z RouteParameters_write(const struct LDKRouteParameters *NONNULL_PTR obj);
38800
38801 /**
38802  * Read a RouteParameters from a byte array, created by RouteParameters_write
38803  */
38804 struct LDKCResult_RouteParametersDecodeErrorZ RouteParameters_read(struct LDKu8slice ser);
38805
38806 /**
38807  * Frees any resources used by the PaymentParameters, if is_owned is set and inner is non-NULL.
38808  */
38809 void PaymentParameters_free(struct LDKPaymentParameters this_obj);
38810
38811 /**
38812  * Information about the payee, such as their features and route hints for their channels.
38813  */
38814 struct LDKPayee PaymentParameters_get_payee(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
38815
38816 /**
38817  * Information about the payee, such as their features and route hints for their channels.
38818  */
38819 void PaymentParameters_set_payee(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKPayee val);
38820
38821 /**
38822  * Expiration of a payment to the payee, in seconds relative to the UNIX epoch.
38823  */
38824 struct LDKCOption_u64Z PaymentParameters_get_expiry_time(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
38825
38826 /**
38827  * Expiration of a payment to the payee, in seconds relative to the UNIX epoch.
38828  */
38829 void PaymentParameters_set_expiry_time(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
38830
38831 /**
38832  * The maximum total CLTV delta we accept for the route.
38833  * Defaults to [`DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA`].
38834  */
38835 uint32_t PaymentParameters_get_max_total_cltv_expiry_delta(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
38836
38837 /**
38838  * The maximum total CLTV delta we accept for the route.
38839  * Defaults to [`DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA`].
38840  */
38841 void PaymentParameters_set_max_total_cltv_expiry_delta(struct LDKPaymentParameters *NONNULL_PTR this_ptr, uint32_t val);
38842
38843 /**
38844  * The maximum number of paths that may be used by (MPP) payments.
38845  * Defaults to [`DEFAULT_MAX_PATH_COUNT`].
38846  */
38847 uint8_t PaymentParameters_get_max_path_count(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
38848
38849 /**
38850  * The maximum number of paths that may be used by (MPP) payments.
38851  * Defaults to [`DEFAULT_MAX_PATH_COUNT`].
38852  */
38853 void PaymentParameters_set_max_path_count(struct LDKPaymentParameters *NONNULL_PTR this_ptr, uint8_t val);
38854
38855 /**
38856  * Selects the maximum share of a channel's total capacity which will be sent over a channel,
38857  * as a power of 1/2. A higher value prefers to send the payment using more MPP parts whereas
38858  * a lower value prefers to send larger MPP parts, potentially saturating channels and
38859  * increasing failure probability for those paths.
38860  *
38861  * Note that this restriction will be relaxed during pathfinding after paths which meet this
38862  * restriction have been found. While paths which meet this criteria will be searched for, it
38863  * is ultimately up to the scorer to select them over other paths.
38864  *
38865  * A value of 0 will allow payments up to and including a channel's total announced usable
38866  * capacity, a value of one will only use up to half its capacity, two 1/4, etc.
38867  *
38868  * Default value: 2
38869  */
38870 uint8_t PaymentParameters_get_max_channel_saturation_power_of_half(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
38871
38872 /**
38873  * Selects the maximum share of a channel's total capacity which will be sent over a channel,
38874  * as a power of 1/2. A higher value prefers to send the payment using more MPP parts whereas
38875  * a lower value prefers to send larger MPP parts, potentially saturating channels and
38876  * increasing failure probability for those paths.
38877  *
38878  * Note that this restriction will be relaxed during pathfinding after paths which meet this
38879  * restriction have been found. While paths which meet this criteria will be searched for, it
38880  * is ultimately up to the scorer to select them over other paths.
38881  *
38882  * A value of 0 will allow payments up to and including a channel's total announced usable
38883  * capacity, a value of one will only use up to half its capacity, two 1/4, etc.
38884  *
38885  * Default value: 2
38886  */
38887 void PaymentParameters_set_max_channel_saturation_power_of_half(struct LDKPaymentParameters *NONNULL_PTR this_ptr, uint8_t val);
38888
38889 /**
38890  * A list of SCIDs which this payment was previously attempted over and which caused the
38891  * payment to fail. Future attempts for the same payment shouldn't be relayed through any of
38892  * these SCIDs.
38893  *
38894  * Returns a copy of the field.
38895  */
38896 struct LDKCVec_u64Z PaymentParameters_get_previously_failed_channels(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
38897
38898 /**
38899  * A list of SCIDs which this payment was previously attempted over and which caused the
38900  * payment to fail. Future attempts for the same payment shouldn't be relayed through any of
38901  * these SCIDs.
38902  */
38903 void PaymentParameters_set_previously_failed_channels(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
38904
38905 /**
38906  * Constructs a new PaymentParameters given each field
38907  */
38908 MUST_USE_RES struct LDKPaymentParameters PaymentParameters_new(struct LDKPayee payee_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);
38909
38910 /**
38911  * Creates a copy of the PaymentParameters
38912  */
38913 struct LDKPaymentParameters PaymentParameters_clone(const struct LDKPaymentParameters *NONNULL_PTR orig);
38914
38915 /**
38916  * Generates a non-cryptographic 64-bit hash of the PaymentParameters.
38917  */
38918 uint64_t PaymentParameters_hash(const struct LDKPaymentParameters *NONNULL_PTR o);
38919
38920 /**
38921  * Checks if two PaymentParameterss contain equal inner contents.
38922  * This ignores pointers and is_owned flags and looks at the values in fields.
38923  * Two objects with NULL inner values will be considered "equal" here.
38924  */
38925 bool PaymentParameters_eq(const struct LDKPaymentParameters *NONNULL_PTR a, const struct LDKPaymentParameters *NONNULL_PTR b);
38926
38927 /**
38928  * Serialize the PaymentParameters object into a byte array which can be read by PaymentParameters_read
38929  */
38930 struct LDKCVec_u8Z PaymentParameters_write(const struct LDKPaymentParameters *NONNULL_PTR obj);
38931
38932 /**
38933  * Read a PaymentParameters from a byte array, created by PaymentParameters_write
38934  */
38935 struct LDKCResult_PaymentParametersDecodeErrorZ PaymentParameters_read(struct LDKu8slice ser, uint32_t arg);
38936
38937 /**
38938  * Creates a payee with the node id of the given `pubkey`.
38939  *
38940  * The `final_cltv_expiry_delta` should match the expected final CLTV delta the recipient has
38941  * provided.
38942  */
38943 MUST_USE_RES struct LDKPaymentParameters PaymentParameters_from_node_id(struct LDKPublicKey payee_pubkey, uint32_t final_cltv_expiry_delta);
38944
38945 /**
38946  * Creates a payee with the node id of the given `pubkey` to use for keysend payments.
38947  *
38948  * The `final_cltv_expiry_delta` should match the expected final CLTV delta the recipient has
38949  * provided.
38950  *
38951  * Note that MPP keysend is not widely supported yet. The `allow_mpp` lets you choose
38952  * whether your router will be allowed to find a multi-part route for this payment. If you
38953  * set `allow_mpp` to true, you should ensure a payment secret is set on send, likely via
38954  * [`RecipientOnionFields::secret_only`].
38955  *
38956  * [`RecipientOnionFields::secret_only`]: crate::ln::channelmanager::RecipientOnionFields::secret_only
38957  */
38958 MUST_USE_RES struct LDKPaymentParameters PaymentParameters_for_keysend(struct LDKPublicKey payee_pubkey, uint32_t final_cltv_expiry_delta, bool allow_mpp);
38959
38960 /**
38961  * Creates parameters for paying to a blinded payee from the provided invoice. Sets
38962  * [`Payee::Blinded::route_hints`], [`Payee::Blinded::features`], and
38963  * [`PaymentParameters::expiry_time`].
38964  */
38965 MUST_USE_RES struct LDKPaymentParameters PaymentParameters_from_bolt12_invoice(const struct LDKBolt12Invoice *NONNULL_PTR invoice);
38966
38967 /**
38968  * Frees any resources used by the Payee
38969  */
38970 void Payee_free(struct LDKPayee this_ptr);
38971
38972 /**
38973  * Creates a copy of the Payee
38974  */
38975 struct LDKPayee Payee_clone(const struct LDKPayee *NONNULL_PTR orig);
38976
38977 /**
38978  * Utility method to constructs a new Blinded-variant Payee
38979  */
38980 struct LDKPayee Payee_blinded(struct LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ route_hints, struct LDKBolt12InvoiceFeatures features);
38981
38982 /**
38983  * Utility method to constructs a new Clear-variant Payee
38984  */
38985 struct LDKPayee Payee_clear(struct LDKPublicKey node_id, struct LDKCVec_RouteHintZ route_hints, struct LDKBolt11InvoiceFeatures features, uint32_t final_cltv_expiry_delta);
38986
38987 /**
38988  * Generates a non-cryptographic 64-bit hash of the Payee.
38989  */
38990 uint64_t Payee_hash(const struct LDKPayee *NONNULL_PTR o);
38991
38992 /**
38993  * Checks if two Payees contain equal inner contents.
38994  * This ignores pointers and is_owned flags and looks at the values in fields.
38995  */
38996 bool Payee_eq(const struct LDKPayee *NONNULL_PTR a, const struct LDKPayee *NONNULL_PTR b);
38997
38998 /**
38999  * Frees any resources used by the RouteHint, if is_owned is set and inner is non-NULL.
39000  */
39001 void RouteHint_free(struct LDKRouteHint this_obj);
39002
39003 struct LDKCVec_RouteHintHopZ RouteHint_get_a(const struct LDKRouteHint *NONNULL_PTR this_ptr);
39004
39005 void RouteHint_set_a(struct LDKRouteHint *NONNULL_PTR this_ptr, struct LDKCVec_RouteHintHopZ val);
39006
39007 /**
39008  * Constructs a new RouteHint given each field
39009  */
39010 MUST_USE_RES struct LDKRouteHint RouteHint_new(struct LDKCVec_RouteHintHopZ a_arg);
39011
39012 /**
39013  * Creates a copy of the RouteHint
39014  */
39015 struct LDKRouteHint RouteHint_clone(const struct LDKRouteHint *NONNULL_PTR orig);
39016
39017 /**
39018  * Generates a non-cryptographic 64-bit hash of the RouteHint.
39019  */
39020 uint64_t RouteHint_hash(const struct LDKRouteHint *NONNULL_PTR o);
39021
39022 /**
39023  * Checks if two RouteHints contain equal inner contents.
39024  * This ignores pointers and is_owned flags and looks at the values in fields.
39025  * Two objects with NULL inner values will be considered "equal" here.
39026  */
39027 bool RouteHint_eq(const struct LDKRouteHint *NONNULL_PTR a, const struct LDKRouteHint *NONNULL_PTR b);
39028
39029 /**
39030  * Serialize the RouteHint object into a byte array which can be read by RouteHint_read
39031  */
39032 struct LDKCVec_u8Z RouteHint_write(const struct LDKRouteHint *NONNULL_PTR obj);
39033
39034 /**
39035  * Read a RouteHint from a byte array, created by RouteHint_write
39036  */
39037 struct LDKCResult_RouteHintDecodeErrorZ RouteHint_read(struct LDKu8slice ser);
39038
39039 /**
39040  * Frees any resources used by the RouteHintHop, if is_owned is set and inner is non-NULL.
39041  */
39042 void RouteHintHop_free(struct LDKRouteHintHop this_obj);
39043
39044 /**
39045  * The node_id of the non-target end of the route
39046  */
39047 struct LDKPublicKey RouteHintHop_get_src_node_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
39048
39049 /**
39050  * The node_id of the non-target end of the route
39051  */
39052 void RouteHintHop_set_src_node_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKPublicKey val);
39053
39054 /**
39055  * The short_channel_id of this channel
39056  */
39057 uint64_t RouteHintHop_get_short_channel_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
39058
39059 /**
39060  * The short_channel_id of this channel
39061  */
39062 void RouteHintHop_set_short_channel_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint64_t val);
39063
39064 /**
39065  * The fees which must be paid to use this channel
39066  */
39067 struct LDKRoutingFees RouteHintHop_get_fees(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
39068
39069 /**
39070  * The fees which must be paid to use this channel
39071  */
39072 void RouteHintHop_set_fees(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
39073
39074 /**
39075  * The difference in CLTV values between this node and the next node.
39076  */
39077 uint16_t RouteHintHop_get_cltv_expiry_delta(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
39078
39079 /**
39080  * The difference in CLTV values between this node and the next node.
39081  */
39082 void RouteHintHop_set_cltv_expiry_delta(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint16_t val);
39083
39084 /**
39085  * The minimum value, in msat, which must be relayed to the next hop.
39086  */
39087 struct LDKCOption_u64Z RouteHintHop_get_htlc_minimum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
39088
39089 /**
39090  * The minimum value, in msat, which must be relayed to the next hop.
39091  */
39092 void RouteHintHop_set_htlc_minimum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
39093
39094 /**
39095  * The maximum value in msat available for routing with a single HTLC.
39096  */
39097 struct LDKCOption_u64Z RouteHintHop_get_htlc_maximum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
39098
39099 /**
39100  * The maximum value in msat available for routing with a single HTLC.
39101  */
39102 void RouteHintHop_set_htlc_maximum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
39103
39104 /**
39105  * Constructs a new RouteHintHop given each field
39106  */
39107 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);
39108
39109 /**
39110  * Creates a copy of the RouteHintHop
39111  */
39112 struct LDKRouteHintHop RouteHintHop_clone(const struct LDKRouteHintHop *NONNULL_PTR orig);
39113
39114 /**
39115  * Generates a non-cryptographic 64-bit hash of the RouteHintHop.
39116  */
39117 uint64_t RouteHintHop_hash(const struct LDKRouteHintHop *NONNULL_PTR o);
39118
39119 /**
39120  * Checks if two RouteHintHops contain equal inner contents.
39121  * This ignores pointers and is_owned flags and looks at the values in fields.
39122  * Two objects with NULL inner values will be considered "equal" here.
39123  */
39124 bool RouteHintHop_eq(const struct LDKRouteHintHop *NONNULL_PTR a, const struct LDKRouteHintHop *NONNULL_PTR b);
39125
39126 /**
39127  * Serialize the RouteHintHop object into a byte array which can be read by RouteHintHop_read
39128  */
39129 struct LDKCVec_u8Z RouteHintHop_write(const struct LDKRouteHintHop *NONNULL_PTR obj);
39130
39131 /**
39132  * Read a RouteHintHop from a byte array, created by RouteHintHop_write
39133  */
39134 struct LDKCResult_RouteHintHopDecodeErrorZ RouteHintHop_read(struct LDKu8slice ser);
39135
39136 /**
39137  * Finds a route from us (payer) to the given target node (payee).
39138  *
39139  * If the payee provided features in their invoice, they should be provided via the `payee` field
39140  * in the given [`RouteParameters::payment_params`].
39141  * Without this, MPP will only be used if the payee's features are available in the network graph.
39142  *
39143  * Private routing paths between a public node and the target may be included in the `payee` field
39144  * of [`RouteParameters::payment_params`].
39145  *
39146  * If some channels aren't announced, it may be useful to fill in `first_hops` with the results
39147  * from [`ChannelManager::list_usable_channels`]. If it is filled in, the view of these channels
39148  * from `network_graph` will be ignored, and only those in `first_hops` will be used.
39149  *
39150  * The fees on channels from us to the next hop are ignored as they are assumed to all be equal.
39151  * However, the enabled/disabled bit on such channels as well as the `htlc_minimum_msat` /
39152  * `htlc_maximum_msat` *are* checked as they may change based on the receiving node.
39153  *
39154  * # Panics
39155  *
39156  * Panics if first_hops contains channels without `short_channel_id`s;
39157  * [`ChannelManager::list_usable_channels`] will never include such channels.
39158  *
39159  * [`ChannelManager::list_usable_channels`]: crate::ln::channelmanager::ChannelManager::list_usable_channels
39160  * [`Event::PaymentPathFailed`]: crate::events::Event::PaymentPathFailed
39161  * [`NetworkGraph`]: crate::routing::gossip::NetworkGraph
39162  *
39163  * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None
39164  */
39165 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 struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR score_params, const uint8_t (*random_seed_bytes)[32]);
39166
39167 /**
39168  * Construct a route from us (payer) to the target node (payee) via the given hops (which should
39169  * exclude the payer, but include the payee). This may be useful, e.g., for probing the chosen path.
39170  *
39171  * Re-uses logic from `find_route`, so the restrictions described there also apply here.
39172  */
39173 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]);
39174
39175 /**
39176  * Calls the free function if one is set
39177  */
39178 void Score_free(struct LDKScore this_ptr);
39179
39180 /**
39181  * Calls the free function if one is set
39182  */
39183 void LockableScore_free(struct LDKLockableScore this_ptr);
39184
39185 /**
39186  * Calls the free function if one is set
39187  */
39188 void WriteableScore_free(struct LDKWriteableScore this_ptr);
39189
39190 /**
39191  * Frees any resources used by the MultiThreadedLockableScore, if is_owned is set and inner is non-NULL.
39192  */
39193 void MultiThreadedLockableScore_free(struct LDKMultiThreadedLockableScore this_obj);
39194
39195 /**
39196  * Constructs a new LockableScore which calls the relevant methods on this_arg.
39197  * This copies the `inner` pointer in this_arg and thus the returned LockableScore must be freed before this_arg is
39198  */
39199 struct LDKLockableScore MultiThreadedLockableScore_as_LockableScore(const struct LDKMultiThreadedLockableScore *NONNULL_PTR this_arg);
39200
39201 /**
39202  * Serialize the MultiThreadedLockableScore object into a byte array which can be read by MultiThreadedLockableScore_read
39203  */
39204 struct LDKCVec_u8Z MultiThreadedLockableScore_write(const struct LDKMultiThreadedLockableScore *NONNULL_PTR obj);
39205
39206 /**
39207  * Constructs a new WriteableScore which calls the relevant methods on this_arg.
39208  * This copies the `inner` pointer in this_arg and thus the returned WriteableScore must be freed before this_arg is
39209  */
39210 struct LDKWriteableScore MultiThreadedLockableScore_as_WriteableScore(const struct LDKMultiThreadedLockableScore *NONNULL_PTR this_arg);
39211
39212 /**
39213  * Creates a new [`MultiThreadedLockableScore`] given an underlying [`Score`].
39214  */
39215 MUST_USE_RES struct LDKMultiThreadedLockableScore MultiThreadedLockableScore_new(struct LDKScore score);
39216
39217 /**
39218  * Frees any resources used by the MultiThreadedScoreLock, if is_owned is set and inner is non-NULL.
39219  */
39220 void MultiThreadedScoreLock_free(struct LDKMultiThreadedScoreLock this_obj);
39221
39222 /**
39223  * Serialize the MultiThreadedScoreLock object into a byte array which can be read by MultiThreadedScoreLock_read
39224  */
39225 struct LDKCVec_u8Z MultiThreadedScoreLock_write(const struct LDKMultiThreadedScoreLock *NONNULL_PTR obj);
39226
39227 /**
39228  * Constructs a new Score which calls the relevant methods on this_arg.
39229  * This copies the `inner` pointer in this_arg and thus the returned Score must be freed before this_arg is
39230  */
39231 struct LDKScore MultiThreadedScoreLock_as_Score(const struct LDKMultiThreadedScoreLock *NONNULL_PTR this_arg);
39232
39233 /**
39234  * Frees any resources used by the ChannelUsage, if is_owned is set and inner is non-NULL.
39235  */
39236 void ChannelUsage_free(struct LDKChannelUsage this_obj);
39237
39238 /**
39239  * The amount to send through the channel, denominated in millisatoshis.
39240  */
39241 uint64_t ChannelUsage_get_amount_msat(const struct LDKChannelUsage *NONNULL_PTR this_ptr);
39242
39243 /**
39244  * The amount to send through the channel, denominated in millisatoshis.
39245  */
39246 void ChannelUsage_set_amount_msat(struct LDKChannelUsage *NONNULL_PTR this_ptr, uint64_t val);
39247
39248 /**
39249  * Total amount, denominated in millisatoshis, already allocated to send through the channel
39250  * as part of a multi-path payment.
39251  */
39252 uint64_t ChannelUsage_get_inflight_htlc_msat(const struct LDKChannelUsage *NONNULL_PTR this_ptr);
39253
39254 /**
39255  * Total amount, denominated in millisatoshis, already allocated to send through the channel
39256  * as part of a multi-path payment.
39257  */
39258 void ChannelUsage_set_inflight_htlc_msat(struct LDKChannelUsage *NONNULL_PTR this_ptr, uint64_t val);
39259
39260 /**
39261  * The effective capacity of the channel.
39262  */
39263 struct LDKEffectiveCapacity ChannelUsage_get_effective_capacity(const struct LDKChannelUsage *NONNULL_PTR this_ptr);
39264
39265 /**
39266  * The effective capacity of the channel.
39267  */
39268 void ChannelUsage_set_effective_capacity(struct LDKChannelUsage *NONNULL_PTR this_ptr, struct LDKEffectiveCapacity val);
39269
39270 /**
39271  * Constructs a new ChannelUsage given each field
39272  */
39273 MUST_USE_RES struct LDKChannelUsage ChannelUsage_new(uint64_t amount_msat_arg, uint64_t inflight_htlc_msat_arg, struct LDKEffectiveCapacity effective_capacity_arg);
39274
39275 /**
39276  * Creates a copy of the ChannelUsage
39277  */
39278 struct LDKChannelUsage ChannelUsage_clone(const struct LDKChannelUsage *NONNULL_PTR orig);
39279
39280 /**
39281  * Frees any resources used by the FixedPenaltyScorer, if is_owned is set and inner is non-NULL.
39282  */
39283 void FixedPenaltyScorer_free(struct LDKFixedPenaltyScorer this_obj);
39284
39285 /**
39286  * Creates a copy of the FixedPenaltyScorer
39287  */
39288 struct LDKFixedPenaltyScorer FixedPenaltyScorer_clone(const struct LDKFixedPenaltyScorer *NONNULL_PTR orig);
39289
39290 /**
39291  * Creates a new scorer using `penalty_msat`.
39292  */
39293 MUST_USE_RES struct LDKFixedPenaltyScorer FixedPenaltyScorer_with_penalty(uint64_t penalty_msat);
39294
39295 /**
39296  * Constructs a new Score which calls the relevant methods on this_arg.
39297  * This copies the `inner` pointer in this_arg and thus the returned Score must be freed before this_arg is
39298  */
39299 struct LDKScore FixedPenaltyScorer_as_Score(const struct LDKFixedPenaltyScorer *NONNULL_PTR this_arg);
39300
39301 /**
39302  * Serialize the FixedPenaltyScorer object into a byte array which can be read by FixedPenaltyScorer_read
39303  */
39304 struct LDKCVec_u8Z FixedPenaltyScorer_write(const struct LDKFixedPenaltyScorer *NONNULL_PTR obj);
39305
39306 /**
39307  * Read a FixedPenaltyScorer from a byte array, created by FixedPenaltyScorer_write
39308  */
39309 struct LDKCResult_FixedPenaltyScorerDecodeErrorZ FixedPenaltyScorer_read(struct LDKu8slice ser, uint64_t arg);
39310
39311 /**
39312  * Frees any resources used by the ProbabilisticScorer, if is_owned is set and inner is non-NULL.
39313  */
39314 void ProbabilisticScorer_free(struct LDKProbabilisticScorer this_obj);
39315
39316 /**
39317  * Frees any resources used by the ProbabilisticScoringFeeParameters, if is_owned is set and inner is non-NULL.
39318  */
39319 void ProbabilisticScoringFeeParameters_free(struct LDKProbabilisticScoringFeeParameters this_obj);
39320
39321 /**
39322  * A fixed penalty in msats to apply to each channel.
39323  *
39324  * Default value: 500 msat
39325  */
39326 uint64_t ProbabilisticScoringFeeParameters_get_base_penalty_msat(const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr);
39327
39328 /**
39329  * A fixed penalty in msats to apply to each channel.
39330  *
39331  * Default value: 500 msat
39332  */
39333 void ProbabilisticScoringFeeParameters_set_base_penalty_msat(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr, uint64_t val);
39334
39335 /**
39336  * A multiplier used with the payment amount to calculate a fixed penalty applied to each
39337  * channel, in excess of the [`base_penalty_msat`].
39338  *
39339  * The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e.,
39340  * fees plus penalty) for large payments. The penalty is computed as the product of this
39341  * multiplier and `2^30`ths of the payment amount.
39342  *
39343  * ie `base_penalty_amount_multiplier_msat * amount_msat / 2^30`
39344  *
39345  * Default value: 8,192 msat
39346  *
39347  * [`base_penalty_msat`]: Self::base_penalty_msat
39348  */
39349 uint64_t ProbabilisticScoringFeeParameters_get_base_penalty_amount_multiplier_msat(const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr);
39350
39351 /**
39352  * A multiplier used with the payment amount to calculate a fixed penalty applied to each
39353  * channel, in excess of the [`base_penalty_msat`].
39354  *
39355  * The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e.,
39356  * fees plus penalty) for large payments. The penalty is computed as the product of this
39357  * multiplier and `2^30`ths of the payment amount.
39358  *
39359  * ie `base_penalty_amount_multiplier_msat * amount_msat / 2^30`
39360  *
39361  * Default value: 8,192 msat
39362  *
39363  * [`base_penalty_msat`]: Self::base_penalty_msat
39364  */
39365 void ProbabilisticScoringFeeParameters_set_base_penalty_amount_multiplier_msat(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr, uint64_t val);
39366
39367 /**
39368  * A multiplier used in conjunction with the negative `log10` of the channel's success
39369  * probability for a payment, as determined by our latest estimates of the channel's
39370  * liquidity, to determine the liquidity penalty.
39371  *
39372  * The penalty is based in part on the knowledge learned from prior successful and unsuccessful
39373  * payments. This knowledge is decayed over time based on [`liquidity_offset_half_life`]. The
39374  * penalty is effectively limited to `2 * liquidity_penalty_multiplier_msat` (corresponding to
39375  * lower bounding the success probability to `0.01`) when the amount falls within the
39376  * uncertainty bounds of the channel liquidity balance. Amounts above the upper bound will
39377  * result in a `u64::max_value` penalty, however.
39378  *
39379  * `-log10(success_probability) * liquidity_penalty_multiplier_msat`
39380  *
39381  * Default value: 30,000 msat
39382  *
39383  * [`liquidity_offset_half_life`]: ProbabilisticScoringDecayParameters::liquidity_offset_half_life
39384  */
39385 uint64_t ProbabilisticScoringFeeParameters_get_liquidity_penalty_multiplier_msat(const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr);
39386
39387 /**
39388  * A multiplier used in conjunction with the negative `log10` of the channel's success
39389  * probability for a payment, as determined by our latest estimates of the channel's
39390  * liquidity, to determine the liquidity penalty.
39391  *
39392  * The penalty is based in part on the knowledge learned from prior successful and unsuccessful
39393  * payments. This knowledge is decayed over time based on [`liquidity_offset_half_life`]. The
39394  * penalty is effectively limited to `2 * liquidity_penalty_multiplier_msat` (corresponding to
39395  * lower bounding the success probability to `0.01`) when the amount falls within the
39396  * uncertainty bounds of the channel liquidity balance. Amounts above the upper bound will
39397  * result in a `u64::max_value` penalty, however.
39398  *
39399  * `-log10(success_probability) * liquidity_penalty_multiplier_msat`
39400  *
39401  * Default value: 30,000 msat
39402  *
39403  * [`liquidity_offset_half_life`]: ProbabilisticScoringDecayParameters::liquidity_offset_half_life
39404  */
39405 void ProbabilisticScoringFeeParameters_set_liquidity_penalty_multiplier_msat(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr, uint64_t val);
39406
39407 /**
39408  * A multiplier used in conjunction with a payment amount and the negative `log10` of the
39409  * channel's success probability for the payment, as determined by our latest estimates of the
39410  * channel's liquidity, to determine the amount penalty.
39411  *
39412  * The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e.,
39413  * fees plus penalty) for large payments. The penalty is computed as the product of this
39414  * multiplier and `2^20`ths of the payment amount, weighted by the negative `log10` of the
39415  * success probability.
39416  *
39417  * `-log10(success_probability) * liquidity_penalty_amount_multiplier_msat * amount_msat / 2^20`
39418  *
39419  * In practice, this means for 0.1 success probability (`-log10(0.1) == 1`) each `2^20`th of
39420  * the amount will result in a penalty of the multiplier. And, as the success probability
39421  * decreases, the negative `log10` weighting will increase dramatically. For higher success
39422  * probabilities, the multiplier will have a decreasing effect as the negative `log10` will
39423  * fall below `1`.
39424  *
39425  * Default value: 192 msat
39426  */
39427 uint64_t ProbabilisticScoringFeeParameters_get_liquidity_penalty_amount_multiplier_msat(const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr);
39428
39429 /**
39430  * A multiplier used in conjunction with a payment amount and the negative `log10` of the
39431  * channel's success probability for the payment, as determined by our latest estimates of the
39432  * channel's liquidity, to determine the amount penalty.
39433  *
39434  * The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e.,
39435  * fees plus penalty) for large payments. The penalty is computed as the product of this
39436  * multiplier and `2^20`ths of the payment amount, weighted by the negative `log10` of the
39437  * success probability.
39438  *
39439  * `-log10(success_probability) * liquidity_penalty_amount_multiplier_msat * amount_msat / 2^20`
39440  *
39441  * In practice, this means for 0.1 success probability (`-log10(0.1) == 1`) each `2^20`th of
39442  * the amount will result in a penalty of the multiplier. And, as the success probability
39443  * decreases, the negative `log10` weighting will increase dramatically. For higher success
39444  * probabilities, the multiplier will have a decreasing effect as the negative `log10` will
39445  * fall below `1`.
39446  *
39447  * Default value: 192 msat
39448  */
39449 void ProbabilisticScoringFeeParameters_set_liquidity_penalty_amount_multiplier_msat(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr, uint64_t val);
39450
39451 /**
39452  * A multiplier used in conjunction with the negative `log10` of the channel's success
39453  * probability for the payment, as determined based on the history of our estimates of the
39454  * channel's available liquidity, to determine a penalty.
39455  *
39456  * This penalty is similar to [`liquidity_penalty_multiplier_msat`], however, instead of using
39457  * only our latest estimate for the current liquidity available in the channel, it estimates
39458  * success probability based on the estimated liquidity available in the channel through
39459  * history. Specifically, every time we update our liquidity bounds on a given channel, we
39460  * track which of several buckets those bounds fall into, exponentially decaying the
39461  * probability of each bucket as new samples are added.
39462  *
39463  * Default value: 10,000 msat
39464  *
39465  * [`liquidity_penalty_multiplier_msat`]: Self::liquidity_penalty_multiplier_msat
39466  */
39467 uint64_t ProbabilisticScoringFeeParameters_get_historical_liquidity_penalty_multiplier_msat(const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr);
39468
39469 /**
39470  * A multiplier used in conjunction with the negative `log10` of the channel's success
39471  * probability for the payment, as determined based on the history of our estimates of the
39472  * channel's available liquidity, to determine a penalty.
39473  *
39474  * This penalty is similar to [`liquidity_penalty_multiplier_msat`], however, instead of using
39475  * only our latest estimate for the current liquidity available in the channel, it estimates
39476  * success probability based on the estimated liquidity available in the channel through
39477  * history. Specifically, every time we update our liquidity bounds on a given channel, we
39478  * track which of several buckets those bounds fall into, exponentially decaying the
39479  * probability of each bucket as new samples are added.
39480  *
39481  * Default value: 10,000 msat
39482  *
39483  * [`liquidity_penalty_multiplier_msat`]: Self::liquidity_penalty_multiplier_msat
39484  */
39485 void ProbabilisticScoringFeeParameters_set_historical_liquidity_penalty_multiplier_msat(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr, uint64_t val);
39486
39487 /**
39488  * A multiplier used in conjunction with the payment amount and the negative `log10` of the
39489  * channel's success probability for the payment, as determined based on the history of our
39490  * estimates of the channel's available liquidity, to determine a penalty.
39491  *
39492  * The purpose of the amount penalty is to avoid having fees dominate the channel cost for
39493  * large payments. The penalty is computed as the product of this multiplier and the `2^20`ths
39494  * of the payment amount, weighted by the negative `log10` of the success probability.
39495  *
39496  * This penalty is similar to [`liquidity_penalty_amount_multiplier_msat`], however, instead
39497  * of using only our latest estimate for the current liquidity available in the channel, it
39498  * estimates success probability based on the estimated liquidity available in the channel
39499  * through history. Specifically, every time we update our liquidity bounds on a given
39500  * channel, we track which of several buckets those bounds fall into, exponentially decaying
39501  * the probability of each bucket as new samples are added.
39502  *
39503  * Default value: 64 msat
39504  *
39505  * [`liquidity_penalty_amount_multiplier_msat`]: Self::liquidity_penalty_amount_multiplier_msat
39506  */
39507 uint64_t ProbabilisticScoringFeeParameters_get_historical_liquidity_penalty_amount_multiplier_msat(const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr);
39508
39509 /**
39510  * A multiplier used in conjunction with the payment amount and the negative `log10` of the
39511  * channel's success probability for the payment, as determined based on the history of our
39512  * estimates of the channel's available liquidity, to determine a penalty.
39513  *
39514  * The purpose of the amount penalty is to avoid having fees dominate the channel cost for
39515  * large payments. The penalty is computed as the product of this multiplier and the `2^20`ths
39516  * of the payment amount, weighted by the negative `log10` of the success probability.
39517  *
39518  * This penalty is similar to [`liquidity_penalty_amount_multiplier_msat`], however, instead
39519  * of using only our latest estimate for the current liquidity available in the channel, it
39520  * estimates success probability based on the estimated liquidity available in the channel
39521  * through history. Specifically, every time we update our liquidity bounds on a given
39522  * channel, we track which of several buckets those bounds fall into, exponentially decaying
39523  * the probability of each bucket as new samples are added.
39524  *
39525  * Default value: 64 msat
39526  *
39527  * [`liquidity_penalty_amount_multiplier_msat`]: Self::liquidity_penalty_amount_multiplier_msat
39528  */
39529 void ProbabilisticScoringFeeParameters_set_historical_liquidity_penalty_amount_multiplier_msat(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr, uint64_t val);
39530
39531 /**
39532  * This penalty is applied when `htlc_maximum_msat` is equal to or larger than half of the
39533  * channel's capacity, (ie. htlc_maximum_msat â‰¥ 0.5 * channel_capacity) which makes us
39534  * prefer nodes with a smaller `htlc_maximum_msat`. We treat such nodes preferentially
39535  * as this makes balance discovery attacks harder to execute, thereby creating an incentive
39536  * to restrict `htlc_maximum_msat` and improve privacy.
39537  *
39538  * Default value: 250 msat
39539  */
39540 uint64_t ProbabilisticScoringFeeParameters_get_anti_probing_penalty_msat(const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr);
39541
39542 /**
39543  * This penalty is applied when `htlc_maximum_msat` is equal to or larger than half of the
39544  * channel's capacity, (ie. htlc_maximum_msat â‰¥ 0.5 * channel_capacity) which makes us
39545  * prefer nodes with a smaller `htlc_maximum_msat`. We treat such nodes preferentially
39546  * as this makes balance discovery attacks harder to execute, thereby creating an incentive
39547  * to restrict `htlc_maximum_msat` and improve privacy.
39548  *
39549  * Default value: 250 msat
39550  */
39551 void ProbabilisticScoringFeeParameters_set_anti_probing_penalty_msat(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr, uint64_t val);
39552
39553 /**
39554  * This penalty is applied when the amount we're attempting to send over a channel exceeds our
39555  * current estimate of the channel's available liquidity.
39556  *
39557  * Note that in this case all other penalties, including the
39558  * [`liquidity_penalty_multiplier_msat`] and [`liquidity_penalty_amount_multiplier_msat`]-based
39559  * penalties, as well as the [`base_penalty_msat`] and the [`anti_probing_penalty_msat`], if
39560  * applicable, are still included in the overall penalty.
39561  *
39562  * If you wish to avoid creating paths with such channels entirely, setting this to a value of
39563  * `u64::max_value()` will guarantee that.
39564  *
39565  * Default value: 1_0000_0000_000 msat (1 Bitcoin)
39566  *
39567  * [`liquidity_penalty_multiplier_msat`]: Self::liquidity_penalty_multiplier_msat
39568  * [`liquidity_penalty_amount_multiplier_msat`]: Self::liquidity_penalty_amount_multiplier_msat
39569  * [`base_penalty_msat`]: Self::base_penalty_msat
39570  * [`anti_probing_penalty_msat`]: Self::anti_probing_penalty_msat
39571  */
39572 uint64_t ProbabilisticScoringFeeParameters_get_considered_impossible_penalty_msat(const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr);
39573
39574 /**
39575  * This penalty is applied when the amount we're attempting to send over a channel exceeds our
39576  * current estimate of the channel's available liquidity.
39577  *
39578  * Note that in this case all other penalties, including the
39579  * [`liquidity_penalty_multiplier_msat`] and [`liquidity_penalty_amount_multiplier_msat`]-based
39580  * penalties, as well as the [`base_penalty_msat`] and the [`anti_probing_penalty_msat`], if
39581  * applicable, are still included in the overall penalty.
39582  *
39583  * If you wish to avoid creating paths with such channels entirely, setting this to a value of
39584  * `u64::max_value()` will guarantee that.
39585  *
39586  * Default value: 1_0000_0000_000 msat (1 Bitcoin)
39587  *
39588  * [`liquidity_penalty_multiplier_msat`]: Self::liquidity_penalty_multiplier_msat
39589  * [`liquidity_penalty_amount_multiplier_msat`]: Self::liquidity_penalty_amount_multiplier_msat
39590  * [`base_penalty_msat`]: Self::base_penalty_msat
39591  * [`anti_probing_penalty_msat`]: Self::anti_probing_penalty_msat
39592  */
39593 void ProbabilisticScoringFeeParameters_set_considered_impossible_penalty_msat(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr, uint64_t val);
39594
39595 /**
39596  * Creates a copy of the ProbabilisticScoringFeeParameters
39597  */
39598 struct LDKProbabilisticScoringFeeParameters ProbabilisticScoringFeeParameters_clone(const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR orig);
39599
39600 /**
39601  * Creates a "default" ProbabilisticScoringFeeParameters. See struct and individual field documentaiton for details on which values are used.
39602  */
39603 MUST_USE_RES struct LDKProbabilisticScoringFeeParameters ProbabilisticScoringFeeParameters_default(void);
39604
39605 /**
39606  * Marks the node with the given `node_id` as banned,
39607  * i.e it will be avoided during path finding.
39608  */
39609 void ProbabilisticScoringFeeParameters_add_banned(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR node_id);
39610
39611 /**
39612  * Marks all nodes in the given list as banned, i.e.,
39613  * they will be avoided during path finding.
39614  */
39615 void ProbabilisticScoringFeeParameters_add_banned_from_list(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_arg, struct LDKCVec_NodeIdZ node_ids);
39616
39617 /**
39618  * Removes the node with the given `node_id` from the list of nodes to avoid.
39619  */
39620 void ProbabilisticScoringFeeParameters_remove_banned(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR node_id);
39621
39622 /**
39623  * Sets a manual penalty for the given node.
39624  */
39625 void ProbabilisticScoringFeeParameters_set_manual_penalty(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR node_id, uint64_t penalty);
39626
39627 /**
39628  * Removes the node with the given `node_id` from the list of manual penalties.
39629  */
39630 void ProbabilisticScoringFeeParameters_remove_manual_penalty(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR node_id);
39631
39632 /**
39633  * Clears the list of manual penalties that are applied during path finding.
39634  */
39635 void ProbabilisticScoringFeeParameters_clear_manual_penalties(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_arg);
39636
39637 /**
39638  * Frees any resources used by the ProbabilisticScoringDecayParameters, if is_owned is set and inner is non-NULL.
39639  */
39640 void ProbabilisticScoringDecayParameters_free(struct LDKProbabilisticScoringDecayParameters this_obj);
39641
39642 /**
39643  * If we aren't learning any new datapoints for a channel, the historical liquidity bounds
39644  * tracking can simply live on with increasingly stale data. Instead, when a channel has not
39645  * seen a liquidity estimate update for this amount of time, the historical datapoints are
39646  * decayed by half.
39647  * For an example of historical_no_updates_half_life being used see [`historical_estimated_channel_liquidity_probabilities`]
39648  *
39649  * Note that after 16 or more half lives all historical data will be completely gone.
39650  *
39651  * Default value: 14 days
39652  *
39653  * [`historical_estimated_channel_liquidity_probabilities`]: ProbabilisticScorerUsingTime::historical_estimated_channel_liquidity_probabilities
39654  */
39655 uint64_t ProbabilisticScoringDecayParameters_get_historical_no_updates_half_life(const struct LDKProbabilisticScoringDecayParameters *NONNULL_PTR this_ptr);
39656
39657 /**
39658  * If we aren't learning any new datapoints for a channel, the historical liquidity bounds
39659  * tracking can simply live on with increasingly stale data. Instead, when a channel has not
39660  * seen a liquidity estimate update for this amount of time, the historical datapoints are
39661  * decayed by half.
39662  * For an example of historical_no_updates_half_life being used see [`historical_estimated_channel_liquidity_probabilities`]
39663  *
39664  * Note that after 16 or more half lives all historical data will be completely gone.
39665  *
39666  * Default value: 14 days
39667  *
39668  * [`historical_estimated_channel_liquidity_probabilities`]: ProbabilisticScorerUsingTime::historical_estimated_channel_liquidity_probabilities
39669  */
39670 void ProbabilisticScoringDecayParameters_set_historical_no_updates_half_life(struct LDKProbabilisticScoringDecayParameters *NONNULL_PTR this_ptr, uint64_t val);
39671
39672 /**
39673  * Whenever this amount of time elapses since the last update to a channel's liquidity bounds,
39674  * the distance from the bounds to \"zero\" is cut in half. In other words, the lower-bound on
39675  * the available liquidity is halved and the upper-bound moves half-way to the channel's total
39676  * capacity.
39677  *
39678  * Because halving the liquidity bounds grows the uncertainty on the channel's liquidity,
39679  * the penalty for an amount within the new bounds may change. See the [`ProbabilisticScorer`]
39680  * struct documentation for more info on the way the liquidity bounds are used.
39681  *
39682  * For example, if the channel's capacity is 1 million sats, and the current upper and lower
39683  * liquidity bounds are 200,000 sats and 600,000 sats, after this amount of time the upper
39684  * and lower liquidity bounds will be decayed to 100,000 and 800,000 sats.
39685  *
39686  * Default value: 6 hours
39687  *
39688  * # Note
39689  *
39690  * When built with the `no-std` feature, time will never elapse. Therefore, the channel
39691  * liquidity knowledge will never decay except when the bounds cross.
39692  */
39693 uint64_t ProbabilisticScoringDecayParameters_get_liquidity_offset_half_life(const struct LDKProbabilisticScoringDecayParameters *NONNULL_PTR this_ptr);
39694
39695 /**
39696  * Whenever this amount of time elapses since the last update to a channel's liquidity bounds,
39697  * the distance from the bounds to \"zero\" is cut in half. In other words, the lower-bound on
39698  * the available liquidity is halved and the upper-bound moves half-way to the channel's total
39699  * capacity.
39700  *
39701  * Because halving the liquidity bounds grows the uncertainty on the channel's liquidity,
39702  * the penalty for an amount within the new bounds may change. See the [`ProbabilisticScorer`]
39703  * struct documentation for more info on the way the liquidity bounds are used.
39704  *
39705  * For example, if the channel's capacity is 1 million sats, and the current upper and lower
39706  * liquidity bounds are 200,000 sats and 600,000 sats, after this amount of time the upper
39707  * and lower liquidity bounds will be decayed to 100,000 and 800,000 sats.
39708  *
39709  * Default value: 6 hours
39710  *
39711  * # Note
39712  *
39713  * When built with the `no-std` feature, time will never elapse. Therefore, the channel
39714  * liquidity knowledge will never decay except when the bounds cross.
39715  */
39716 void ProbabilisticScoringDecayParameters_set_liquidity_offset_half_life(struct LDKProbabilisticScoringDecayParameters *NONNULL_PTR this_ptr, uint64_t val);
39717
39718 /**
39719  * Constructs a new ProbabilisticScoringDecayParameters given each field
39720  */
39721 MUST_USE_RES struct LDKProbabilisticScoringDecayParameters ProbabilisticScoringDecayParameters_new(uint64_t historical_no_updates_half_life_arg, uint64_t liquidity_offset_half_life_arg);
39722
39723 /**
39724  * Creates a copy of the ProbabilisticScoringDecayParameters
39725  */
39726 struct LDKProbabilisticScoringDecayParameters ProbabilisticScoringDecayParameters_clone(const struct LDKProbabilisticScoringDecayParameters *NONNULL_PTR orig);
39727
39728 /**
39729  * Creates a "default" ProbabilisticScoringDecayParameters. See struct and individual field documentaiton for details on which values are used.
39730  */
39731 MUST_USE_RES struct LDKProbabilisticScoringDecayParameters ProbabilisticScoringDecayParameters_default(void);
39732
39733 /**
39734  * Creates a new scorer using the given scoring parameters for sending payments from a node
39735  * through a network graph.
39736  */
39737 MUST_USE_RES struct LDKProbabilisticScorer ProbabilisticScorer_new(struct LDKProbabilisticScoringDecayParameters decay_params, const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKLogger logger);
39738
39739 /**
39740  * Dump the contents of this scorer into the configured logger.
39741  *
39742  * Note that this writes roughly one line per channel for which we have a liquidity estimate,
39743  * which may be a substantial amount of log output.
39744  */
39745 void ProbabilisticScorer_debug_log_liquidity_stats(const struct LDKProbabilisticScorer *NONNULL_PTR this_arg);
39746
39747 /**
39748  * Query the estimated minimum and maximum liquidity available for sending a payment over the
39749  * channel with `scid` towards the given `target` node.
39750  */
39751 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);
39752
39753 /**
39754  * Query the historical estimated minimum and maximum liquidity available for sending a
39755  * payment over the channel with `scid` towards the given `target` node.
39756  *
39757  * Returns two sets of 8 buckets. The first set describes the octiles for lower-bound
39758  * liquidity estimates, the second set describes the octiles for upper-bound liquidity
39759  * estimates. Each bucket describes the relative frequency at which we've seen a liquidity
39760  * bound in the octile relative to the channel's total capacity, on an arbitrary scale.
39761  * Because the values are slowly decayed, more recent data points are weighted more heavily
39762  * than older datapoints.
39763  *
39764  * When scoring, the estimated probability that an upper-/lower-bound lies in a given octile
39765  * relative to the channel's total capacity is calculated by dividing that bucket's value with
39766  * the total of all buckets for the given bound.
39767  *
39768  * For example, a value of `[0, 0, 0, 0, 0, 0, 32]` indicates that we believe the probability
39769  * of a bound being in the top octile to be 100%, and have never (recently) seen it in any
39770  * other octiles. A value of `[31, 0, 0, 0, 0, 0, 0, 32]` indicates we've seen the bound being
39771  * both in the top and bottom octile, and roughly with similar (recent) frequency.
39772  *
39773  * Because the datapoints are decayed slowly over time, values will eventually return to
39774  * `Some(([0; 8], [0; 8]))`.
39775  */
39776 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);
39777
39778 /**
39779  * Constructs a new Score which calls the relevant methods on this_arg.
39780  * This copies the `inner` pointer in this_arg and thus the returned Score must be freed before this_arg is
39781  */
39782 struct LDKScore ProbabilisticScorer_as_Score(const struct LDKProbabilisticScorer *NONNULL_PTR this_arg);
39783
39784 /**
39785  * Serialize the ProbabilisticScorer object into a byte array which can be read by ProbabilisticScorer_read
39786  */
39787 struct LDKCVec_u8Z ProbabilisticScorer_write(const struct LDKProbabilisticScorer *NONNULL_PTR obj);
39788
39789 /**
39790  * Read a ProbabilisticScorer from a byte array, created by ProbabilisticScorer_write
39791  */
39792 struct LDKCResult_ProbabilisticScorerDecodeErrorZ ProbabilisticScorer_read(struct LDKu8slice ser, struct LDKProbabilisticScoringDecayParameters arg_a, const struct LDKNetworkGraph *NONNULL_PTR arg_b, struct LDKLogger arg_c);
39793
39794 /**
39795  * Frees any resources used by the DelayedPaymentOutputDescriptor, if is_owned is set and inner is non-NULL.
39796  */
39797 void DelayedPaymentOutputDescriptor_free(struct LDKDelayedPaymentOutputDescriptor this_obj);
39798
39799 /**
39800  * The outpoint which is spendable.
39801  */
39802 struct LDKOutPoint DelayedPaymentOutputDescriptor_get_outpoint(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
39803
39804 /**
39805  * The outpoint which is spendable.
39806  */
39807 void DelayedPaymentOutputDescriptor_set_outpoint(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val);
39808
39809 /**
39810  * Per commitment point to derive the delayed payment key by key holder.
39811  */
39812 struct LDKPublicKey DelayedPaymentOutputDescriptor_get_per_commitment_point(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
39813
39814 /**
39815  * Per commitment point to derive the delayed payment key by key holder.
39816  */
39817 void DelayedPaymentOutputDescriptor_set_per_commitment_point(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val);
39818
39819 /**
39820  * The `nSequence` value which must be set in the spending input to satisfy the `OP_CSV` in
39821  * the witness_script.
39822  */
39823 uint16_t DelayedPaymentOutputDescriptor_get_to_self_delay(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
39824
39825 /**
39826  * The `nSequence` value which must be set in the spending input to satisfy the `OP_CSV` in
39827  * the witness_script.
39828  */
39829 void DelayedPaymentOutputDescriptor_set_to_self_delay(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint16_t val);
39830
39831 /**
39832  * The output which is referenced by the given outpoint.
39833  */
39834 struct LDKTxOut DelayedPaymentOutputDescriptor_get_output(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
39835
39836 /**
39837  * The output which is referenced by the given outpoint.
39838  */
39839 void DelayedPaymentOutputDescriptor_set_output(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val);
39840
39841 /**
39842  * The revocation point specific to the commitment transaction which was broadcast. Used to
39843  * derive the witnessScript for this output.
39844  */
39845 struct LDKPublicKey DelayedPaymentOutputDescriptor_get_revocation_pubkey(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
39846
39847 /**
39848  * The revocation point specific to the commitment transaction which was broadcast. Used to
39849  * derive the witnessScript for this output.
39850  */
39851 void DelayedPaymentOutputDescriptor_set_revocation_pubkey(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val);
39852
39853 /**
39854  * Arbitrary identification information returned by a call to [`ChannelSigner::channel_keys_id`].
39855  * This may be useful in re-deriving keys used in the channel to spend the output.
39856  */
39857 const uint8_t (*DelayedPaymentOutputDescriptor_get_channel_keys_id(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32];
39858
39859 /**
39860  * Arbitrary identification information returned by a call to [`ChannelSigner::channel_keys_id`].
39861  * This may be useful in re-deriving keys used in the channel to spend the output.
39862  */
39863 void DelayedPaymentOutputDescriptor_set_channel_keys_id(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
39864
39865 /**
39866  * The value of the channel which this output originated from, possibly indirectly.
39867  */
39868 uint64_t DelayedPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
39869
39870 /**
39871  * The value of the channel which this output originated from, possibly indirectly.
39872  */
39873 void DelayedPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val);
39874
39875 /**
39876  * Constructs a new DelayedPaymentOutputDescriptor given each field
39877  */
39878 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);
39879
39880 /**
39881  * Creates a copy of the DelayedPaymentOutputDescriptor
39882  */
39883 struct LDKDelayedPaymentOutputDescriptor DelayedPaymentOutputDescriptor_clone(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR orig);
39884
39885 /**
39886  * Checks if two DelayedPaymentOutputDescriptors contain equal inner contents.
39887  * This ignores pointers and is_owned flags and looks at the values in fields.
39888  * Two objects with NULL inner values will be considered "equal" here.
39889  */
39890 bool DelayedPaymentOutputDescriptor_eq(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR a, const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR b);
39891
39892 /**
39893  * Serialize the DelayedPaymentOutputDescriptor object into a byte array which can be read by DelayedPaymentOutputDescriptor_read
39894  */
39895 struct LDKCVec_u8Z DelayedPaymentOutputDescriptor_write(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR obj);
39896
39897 /**
39898  * Read a DelayedPaymentOutputDescriptor from a byte array, created by DelayedPaymentOutputDescriptor_write
39899  */
39900 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ DelayedPaymentOutputDescriptor_read(struct LDKu8slice ser);
39901
39902 /**
39903  * Frees any resources used by the StaticPaymentOutputDescriptor, if is_owned is set and inner is non-NULL.
39904  */
39905 void StaticPaymentOutputDescriptor_free(struct LDKStaticPaymentOutputDescriptor this_obj);
39906
39907 /**
39908  * The outpoint which is spendable.
39909  */
39910 struct LDKOutPoint StaticPaymentOutputDescriptor_get_outpoint(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr);
39911
39912 /**
39913  * The outpoint which is spendable.
39914  */
39915 void StaticPaymentOutputDescriptor_set_outpoint(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val);
39916
39917 /**
39918  * The output which is referenced by the given outpoint.
39919  */
39920 struct LDKTxOut StaticPaymentOutputDescriptor_get_output(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr);
39921
39922 /**
39923  * The output which is referenced by the given outpoint.
39924  */
39925 void StaticPaymentOutputDescriptor_set_output(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val);
39926
39927 /**
39928  * Arbitrary identification information returned by a call to [`ChannelSigner::channel_keys_id`].
39929  * This may be useful in re-deriving keys used in the channel to spend the output.
39930  */
39931 const uint8_t (*StaticPaymentOutputDescriptor_get_channel_keys_id(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32];
39932
39933 /**
39934  * Arbitrary identification information returned by a call to [`ChannelSigner::channel_keys_id`].
39935  * This may be useful in re-deriving keys used in the channel to spend the output.
39936  */
39937 void StaticPaymentOutputDescriptor_set_channel_keys_id(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
39938
39939 /**
39940  * The value of the channel which this transactions spends.
39941  */
39942 uint64_t StaticPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr);
39943
39944 /**
39945  * The value of the channel which this transactions spends.
39946  */
39947 void StaticPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val);
39948
39949 /**
39950  * Constructs a new StaticPaymentOutputDescriptor given each field
39951  */
39952 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);
39953
39954 /**
39955  * Creates a copy of the StaticPaymentOutputDescriptor
39956  */
39957 struct LDKStaticPaymentOutputDescriptor StaticPaymentOutputDescriptor_clone(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR orig);
39958
39959 /**
39960  * Checks if two StaticPaymentOutputDescriptors contain equal inner contents.
39961  * This ignores pointers and is_owned flags and looks at the values in fields.
39962  * Two objects with NULL inner values will be considered "equal" here.
39963  */
39964 bool StaticPaymentOutputDescriptor_eq(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR a, const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR b);
39965
39966 /**
39967  * Serialize the StaticPaymentOutputDescriptor object into a byte array which can be read by StaticPaymentOutputDescriptor_read
39968  */
39969 struct LDKCVec_u8Z StaticPaymentOutputDescriptor_write(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR obj);
39970
39971 /**
39972  * Read a StaticPaymentOutputDescriptor from a byte array, created by StaticPaymentOutputDescriptor_write
39973  */
39974 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ StaticPaymentOutputDescriptor_read(struct LDKu8slice ser);
39975
39976 /**
39977  * Frees any resources used by the SpendableOutputDescriptor
39978  */
39979 void SpendableOutputDescriptor_free(struct LDKSpendableOutputDescriptor this_ptr);
39980
39981 /**
39982  * Creates a copy of the SpendableOutputDescriptor
39983  */
39984 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_clone(const struct LDKSpendableOutputDescriptor *NONNULL_PTR orig);
39985
39986 /**
39987  * Utility method to constructs a new StaticOutput-variant SpendableOutputDescriptor
39988  */
39989 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_static_output(struct LDKOutPoint outpoint, struct LDKTxOut output);
39990
39991 /**
39992  * Utility method to constructs a new DelayedPaymentOutput-variant SpendableOutputDescriptor
39993  */
39994 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_delayed_payment_output(struct LDKDelayedPaymentOutputDescriptor a);
39995
39996 /**
39997  * Utility method to constructs a new StaticPaymentOutput-variant SpendableOutputDescriptor
39998  */
39999 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_static_payment_output(struct LDKStaticPaymentOutputDescriptor a);
40000
40001 /**
40002  * Checks if two SpendableOutputDescriptors contain equal inner contents.
40003  * This ignores pointers and is_owned flags and looks at the values in fields.
40004  */
40005 bool SpendableOutputDescriptor_eq(const struct LDKSpendableOutputDescriptor *NONNULL_PTR a, const struct LDKSpendableOutputDescriptor *NONNULL_PTR b);
40006
40007 /**
40008  * Serialize the SpendableOutputDescriptor object into a byte array which can be read by SpendableOutputDescriptor_read
40009  */
40010 struct LDKCVec_u8Z SpendableOutputDescriptor_write(const struct LDKSpendableOutputDescriptor *NONNULL_PTR obj);
40011
40012 /**
40013  * Read a SpendableOutputDescriptor from a byte array, created by SpendableOutputDescriptor_write
40014  */
40015 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ SpendableOutputDescriptor_read(struct LDKu8slice ser);
40016
40017 /**
40018  * Creates an unsigned [`PartiallySignedTransaction`] which spends the given descriptors to
40019  * the given outputs, plus an output to the given change destination (if sufficient
40020  * change value remains). The PSBT will have a feerate, at least, of the given value.
40021  *
40022  * The `locktime` argument is used to set the transaction's locktime. If `None`, the
40023  * transaction will have a locktime of 0. It it recommended to set this to the current block
40024  * height to avoid fee sniping, unless you have some specific reason to use a different
40025  * locktime.
40026  *
40027  * Returns the PSBT and expected max transaction weight.
40028  *
40029  * Returns `Err(())` if the output value is greater than the input value minus required fee,
40030  * if a descriptor was duplicated, or if an output descriptor `script_pubkey`
40031  * does not match the one we can spend.
40032  *
40033  * We do not enforce that outputs meet the dust limit or that any output scripts are standard.
40034  */
40035 MUST_USE_RES struct LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ SpendableOutputDescriptor_create_spendable_outputs_psbt(struct LDKCVec_SpendableOutputDescriptorZ descriptors, struct LDKCVec_TxOutZ outputs, struct LDKCVec_u8Z change_destination_script, uint32_t feerate_sat_per_1000_weight, struct LDKCOption_PackedLockTimeZ locktime);
40036
40037 /**
40038  * Calls the free function if one is set
40039  */
40040 void ChannelSigner_free(struct LDKChannelSigner this_ptr);
40041
40042 /**
40043  * Calls the free function if one is set
40044  */
40045 void EcdsaChannelSigner_free(struct LDKEcdsaChannelSigner this_ptr);
40046
40047 /**
40048  * Calls the free function if one is set
40049  */
40050 void WriteableEcdsaChannelSigner_free(struct LDKWriteableEcdsaChannelSigner this_ptr);
40051
40052 /**
40053  * Creates a copy of the Recipient
40054  */
40055 enum LDKRecipient Recipient_clone(const enum LDKRecipient *NONNULL_PTR orig);
40056
40057 /**
40058  * Utility method to constructs a new Node-variant Recipient
40059  */
40060 enum LDKRecipient Recipient_node(void);
40061
40062 /**
40063  * Utility method to constructs a new PhantomNode-variant Recipient
40064  */
40065 enum LDKRecipient Recipient_phantom_node(void);
40066
40067 /**
40068  * Calls the free function if one is set
40069  */
40070 void EntropySource_free(struct LDKEntropySource this_ptr);
40071
40072 /**
40073  * Calls the free function if one is set
40074  */
40075 void NodeSigner_free(struct LDKNodeSigner this_ptr);
40076
40077 /**
40078  * Calls the free function if one is set
40079  */
40080 void SignerProvider_free(struct LDKSignerProvider this_ptr);
40081
40082 /**
40083  * Frees any resources used by the InMemorySigner, if is_owned is set and inner is non-NULL.
40084  */
40085 void InMemorySigner_free(struct LDKInMemorySigner this_obj);
40086
40087 /**
40088  * Holder secret key in the 2-of-2 multisig script of a channel. This key also backs the
40089  * holder's anchor output in a commitment transaction, if one is present.
40090  */
40091 const uint8_t (*InMemorySigner_get_funding_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
40092
40093 /**
40094  * Holder secret key in the 2-of-2 multisig script of a channel. This key also backs the
40095  * holder's anchor output in a commitment transaction, if one is present.
40096  */
40097 void InMemorySigner_set_funding_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
40098
40099 /**
40100  * Holder secret key for blinded revocation pubkey.
40101  */
40102 const uint8_t (*InMemorySigner_get_revocation_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
40103
40104 /**
40105  * Holder secret key for blinded revocation pubkey.
40106  */
40107 void InMemorySigner_set_revocation_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
40108
40109 /**
40110  * Holder secret key used for our balance in counterparty-broadcasted commitment transactions.
40111  */
40112 const uint8_t (*InMemorySigner_get_payment_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
40113
40114 /**
40115  * Holder secret key used for our balance in counterparty-broadcasted commitment transactions.
40116  */
40117 void InMemorySigner_set_payment_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
40118
40119 /**
40120  * Holder secret key used in an HTLC transaction.
40121  */
40122 const uint8_t (*InMemorySigner_get_delayed_payment_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
40123
40124 /**
40125  * Holder secret key used in an HTLC transaction.
40126  */
40127 void InMemorySigner_set_delayed_payment_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
40128
40129 /**
40130  * Holder HTLC secret key used in commitment transaction HTLC outputs.
40131  */
40132 const uint8_t (*InMemorySigner_get_htlc_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
40133
40134 /**
40135  * Holder HTLC secret key used in commitment transaction HTLC outputs.
40136  */
40137 void InMemorySigner_set_htlc_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
40138
40139 /**
40140  * Commitment seed.
40141  */
40142 const uint8_t (*InMemorySigner_get_commitment_seed(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
40143
40144 /**
40145  * Commitment seed.
40146  */
40147 void InMemorySigner_set_commitment_seed(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
40148
40149 /**
40150  * Creates a copy of the InMemorySigner
40151  */
40152 struct LDKInMemorySigner InMemorySigner_clone(const struct LDKInMemorySigner *NONNULL_PTR orig);
40153
40154 /**
40155  * Creates a new [`InMemorySigner`].
40156  */
40157 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);
40158
40159 /**
40160  * Returns the counterparty's pubkeys.
40161  *
40162  * Will panic if [`ChannelSigner::provide_channel_parameters`] has not been called before.
40163  */
40164 MUST_USE_RES struct LDKChannelPublicKeys InMemorySigner_counterparty_pubkeys(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
40165
40166 /**
40167  * Returns the `contest_delay` value specified by our counterparty and applied on holder-broadcastable
40168  * transactions, i.e., the amount of time that we have to wait to recover our funds if we
40169  * broadcast a transaction.
40170  *
40171  * Will panic if [`ChannelSigner::provide_channel_parameters`] has not been called before.
40172  */
40173 MUST_USE_RES uint16_t InMemorySigner_counterparty_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
40174
40175 /**
40176  * Returns the `contest_delay` value specified by us and applied on transactions broadcastable
40177  * by our counterparty, i.e., the amount of time that they have to wait to recover their funds
40178  * if they broadcast a transaction.
40179  *
40180  * Will panic if [`ChannelSigner::provide_channel_parameters`] has not been called before.
40181  */
40182 MUST_USE_RES uint16_t InMemorySigner_holder_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
40183
40184 /**
40185  * Returns whether the holder is the initiator.
40186  *
40187  * Will panic if [`ChannelSigner::provide_channel_parameters`] has not been called before.
40188  */
40189 MUST_USE_RES bool InMemorySigner_is_outbound(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
40190
40191 /**
40192  * Funding outpoint
40193  *
40194  * Will panic if [`ChannelSigner::provide_channel_parameters`] has not been called before.
40195  */
40196 MUST_USE_RES struct LDKOutPoint InMemorySigner_funding_outpoint(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
40197
40198 /**
40199  * Returns a [`ChannelTransactionParameters`] for this channel, to be used when verifying or
40200  * building transactions.
40201  *
40202  * Will panic if [`ChannelSigner::provide_channel_parameters`] has not been called before.
40203  */
40204 MUST_USE_RES struct LDKChannelTransactionParameters InMemorySigner_get_channel_parameters(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
40205
40206 /**
40207  * Returns the channel type features of the channel parameters. Should be helpful for
40208  * determining a channel's category, i. e. legacy/anchors/taproot/etc.
40209  *
40210  * Will panic if [`ChannelSigner::provide_channel_parameters`] has not been called before.
40211  */
40212 MUST_USE_RES struct LDKChannelTypeFeatures InMemorySigner_channel_type_features(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
40213
40214 /**
40215  * Sign the single input of `spend_tx` at index `input_idx`, which spends the output described
40216  * by `descriptor`, returning the witness stack for the input.
40217  *
40218  * Returns an error if the input at `input_idx` does not exist, has a non-empty `script_sig`,
40219  * is not spending the outpoint described by [`descriptor.outpoint`],
40220  * or if an output descriptor `script_pubkey` does not match the one we can spend.
40221  *
40222  * [`descriptor.outpoint`]: StaticPaymentOutputDescriptor::outpoint
40223  */
40224 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);
40225
40226 /**
40227  * Sign the single input of `spend_tx` at index `input_idx` which spends the output
40228  * described by `descriptor`, returning the witness stack for the input.
40229  *
40230  * Returns an error if the input at `input_idx` does not exist, has a non-empty `script_sig`,
40231  * is not spending the outpoint described by [`descriptor.outpoint`], does not have a
40232  * sequence set to [`descriptor.to_self_delay`], or if an output descriptor
40233  * `script_pubkey` does not match the one we can spend.
40234  *
40235  * [`descriptor.outpoint`]: DelayedPaymentOutputDescriptor::outpoint
40236  * [`descriptor.to_self_delay`]: DelayedPaymentOutputDescriptor::to_self_delay
40237  */
40238 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);
40239
40240 /**
40241  * Constructs a new EntropySource which calls the relevant methods on this_arg.
40242  * This copies the `inner` pointer in this_arg and thus the returned EntropySource must be freed before this_arg is
40243  */
40244 struct LDKEntropySource InMemorySigner_as_EntropySource(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
40245
40246 /**
40247  * Constructs a new ChannelSigner which calls the relevant methods on this_arg.
40248  * This copies the `inner` pointer in this_arg and thus the returned ChannelSigner must be freed before this_arg is
40249  */
40250 struct LDKChannelSigner InMemorySigner_as_ChannelSigner(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
40251
40252 /**
40253  * Constructs a new EcdsaChannelSigner which calls the relevant methods on this_arg.
40254  * This copies the `inner` pointer in this_arg and thus the returned EcdsaChannelSigner must be freed before this_arg is
40255  */
40256 struct LDKEcdsaChannelSigner InMemorySigner_as_EcdsaChannelSigner(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
40257
40258 /**
40259  * Constructs a new WriteableEcdsaChannelSigner which calls the relevant methods on this_arg.
40260  * This copies the `inner` pointer in this_arg and thus the returned WriteableEcdsaChannelSigner must be freed before this_arg is
40261  */
40262 struct LDKWriteableEcdsaChannelSigner InMemorySigner_as_WriteableEcdsaChannelSigner(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
40263
40264 /**
40265  * Serialize the InMemorySigner object into a byte array which can be read by InMemorySigner_read
40266  */
40267 struct LDKCVec_u8Z InMemorySigner_write(const struct LDKInMemorySigner *NONNULL_PTR obj);
40268
40269 /**
40270  * Read a InMemorySigner from a byte array, created by InMemorySigner_write
40271  */
40272 struct LDKCResult_InMemorySignerDecodeErrorZ InMemorySigner_read(struct LDKu8slice ser, struct LDKEntropySource arg);
40273
40274 /**
40275  * Frees any resources used by the KeysManager, if is_owned is set and inner is non-NULL.
40276  */
40277 void KeysManager_free(struct LDKKeysManager this_obj);
40278
40279 /**
40280  * Constructs a [`KeysManager`] from a 32-byte seed. If the seed is in some way biased (e.g.,
40281  * your CSRNG is busted) this may panic (but more importantly, you will possibly lose funds).
40282  * `starting_time` isn't strictly required to actually be a time, but it must absolutely,
40283  * without a doubt, be unique to this instance. ie if you start multiple times with the same
40284  * `seed`, `starting_time` must be unique to each run. Thus, the easiest way to achieve this
40285  * is to simply use the current time (with very high precision).
40286  *
40287  * The `seed` MUST be backed up safely prior to use so that the keys can be re-created, however,
40288  * obviously, `starting_time` should be unique every time you reload the library - it is only
40289  * used to generate new ephemeral key data (which will be stored by the individual channel if
40290  * necessary).
40291  *
40292  * Note that the seed is required to recover certain on-chain funds independent of
40293  * [`ChannelMonitor`] data, though a current copy of [`ChannelMonitor`] data is also required
40294  * for any channel, and some on-chain during-closing funds.
40295  *
40296  * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor
40297  */
40298 MUST_USE_RES struct LDKKeysManager KeysManager_new(const uint8_t (*seed)[32], uint64_t starting_time_secs, uint32_t starting_time_nanos);
40299
40300 /**
40301  * Gets the \"node_id\" secret key used to sign gossip announcements, decode onion data, etc.
40302  */
40303 MUST_USE_RES struct LDKSecretKey KeysManager_get_node_secret_key(const struct LDKKeysManager *NONNULL_PTR this_arg);
40304
40305 /**
40306  * Derive an old [`WriteableEcdsaChannelSigner`] containing per-channel secrets based on a key derivation parameters.
40307  */
40308 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]);
40309
40310 /**
40311  * Signs the given [`PartiallySignedTransaction`] which spends the given [`SpendableOutputDescriptor`]s.
40312  * The resulting inputs will be finalized and the PSBT will be ready for broadcast if there
40313  * are no other inputs that need signing.
40314  *
40315  * Returns `Err(())` if the PSBT is missing a descriptor or if we fail to sign.
40316  *
40317  * May panic if the [`SpendableOutputDescriptor`]s were not generated by channels which used
40318  * this [`KeysManager`] or one of the [`InMemorySigner`] created by this [`KeysManager`].
40319  */
40320 MUST_USE_RES struct LDKCResult_PartiallySignedTransactionNoneZ KeysManager_sign_spendable_outputs_psbt(const struct LDKKeysManager *NONNULL_PTR this_arg, struct LDKCVec_SpendableOutputDescriptorZ descriptors, struct LDKCVec_u8Z psbt);
40321
40322 /**
40323  * Creates a [`Transaction`] which spends the given descriptors to the given outputs, plus an
40324  * output to the given change destination (if sufficient change value remains). The
40325  * transaction will have a feerate, at least, of the given value.
40326  *
40327  * The `locktime` argument is used to set the transaction's locktime. If `None`, the
40328  * transaction will have a locktime of 0. It it recommended to set this to the current block
40329  * height to avoid fee sniping, unless you have some specific reason to use a different
40330  * locktime.
40331  *
40332  * Returns `Err(())` if the output value is greater than the input value minus required fee,
40333  * if a descriptor was duplicated, or if an output descriptor `script_pubkey`
40334  * does not match the one we can spend.
40335  *
40336  * We do not enforce that outputs meet the dust limit or that any output scripts are standard.
40337  *
40338  * May panic if the [`SpendableOutputDescriptor`]s were not generated by channels which used
40339  * this [`KeysManager`] or one of the [`InMemorySigner`] created by this [`KeysManager`].
40340  */
40341 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, struct LDKCOption_PackedLockTimeZ locktime);
40342
40343 /**
40344  * Constructs a new EntropySource which calls the relevant methods on this_arg.
40345  * This copies the `inner` pointer in this_arg and thus the returned EntropySource must be freed before this_arg is
40346  */
40347 struct LDKEntropySource KeysManager_as_EntropySource(const struct LDKKeysManager *NONNULL_PTR this_arg);
40348
40349 /**
40350  * Constructs a new NodeSigner which calls the relevant methods on this_arg.
40351  * This copies the `inner` pointer in this_arg and thus the returned NodeSigner must be freed before this_arg is
40352  */
40353 struct LDKNodeSigner KeysManager_as_NodeSigner(const struct LDKKeysManager *NONNULL_PTR this_arg);
40354
40355 /**
40356  * Constructs a new SignerProvider which calls the relevant methods on this_arg.
40357  * This copies the `inner` pointer in this_arg and thus the returned SignerProvider must be freed before this_arg is
40358  */
40359 struct LDKSignerProvider KeysManager_as_SignerProvider(const struct LDKKeysManager *NONNULL_PTR this_arg);
40360
40361 /**
40362  * Frees any resources used by the PhantomKeysManager, if is_owned is set and inner is non-NULL.
40363  */
40364 void PhantomKeysManager_free(struct LDKPhantomKeysManager this_obj);
40365
40366 /**
40367  * Constructs a new EntropySource which calls the relevant methods on this_arg.
40368  * This copies the `inner` pointer in this_arg and thus the returned EntropySource must be freed before this_arg is
40369  */
40370 struct LDKEntropySource PhantomKeysManager_as_EntropySource(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg);
40371
40372 /**
40373  * Constructs a new NodeSigner which calls the relevant methods on this_arg.
40374  * This copies the `inner` pointer in this_arg and thus the returned NodeSigner must be freed before this_arg is
40375  */
40376 struct LDKNodeSigner PhantomKeysManager_as_NodeSigner(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg);
40377
40378 /**
40379  * Constructs a new SignerProvider which calls the relevant methods on this_arg.
40380  * This copies the `inner` pointer in this_arg and thus the returned SignerProvider must be freed before this_arg is
40381  */
40382 struct LDKSignerProvider PhantomKeysManager_as_SignerProvider(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg);
40383
40384 /**
40385  * Constructs a [`PhantomKeysManager`] given a 32-byte seed and an additional `cross_node_seed`
40386  * that is shared across all nodes that intend to participate in [phantom node payments]
40387  * together.
40388  *
40389  * See [`KeysManager::new`] for more information on `seed`, `starting_time_secs`, and
40390  * `starting_time_nanos`.
40391  *
40392  * `cross_node_seed` must be the same across all phantom payment-receiving nodes and also the
40393  * same across restarts, or else inbound payments may fail.
40394  *
40395  * [phantom node payments]: PhantomKeysManager
40396  */
40397 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]);
40398
40399 /**
40400  * See [`KeysManager::spend_spendable_outputs`] for documentation on this method.
40401  */
40402 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, struct LDKCOption_PackedLockTimeZ locktime);
40403
40404 /**
40405  * See [`KeysManager::derive_channel_keys`] for documentation on this method.
40406  */
40407 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]);
40408
40409 /**
40410  * Gets the \"node_id\" secret key used to sign gossip announcements, decode onion data, etc.
40411  */
40412 MUST_USE_RES struct LDKSecretKey PhantomKeysManager_get_node_secret_key(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg);
40413
40414 /**
40415  * Gets the \"node_id\" secret key of the phantom node used to sign invoices, decode the
40416  * last-hop onion data, etc.
40417  */
40418 MUST_USE_RES struct LDKSecretKey PhantomKeysManager_get_phantom_node_secret_key(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg);
40419
40420 /**
40421  * Frees any resources used by the OnionMessenger, if is_owned is set and inner is non-NULL.
40422  */
40423 void OnionMessenger_free(struct LDKOnionMessenger this_obj);
40424
40425 /**
40426  * Calls the free function if one is set
40427  */
40428 void MessageRouter_free(struct LDKMessageRouter this_ptr);
40429
40430 /**
40431  * Frees any resources used by the DefaultMessageRouter, if is_owned is set and inner is non-NULL.
40432  */
40433 void DefaultMessageRouter_free(struct LDKDefaultMessageRouter this_obj);
40434
40435 /**
40436  * Constructs a new DefaultMessageRouter given each field
40437  */
40438 MUST_USE_RES struct LDKDefaultMessageRouter DefaultMessageRouter_new(void);
40439
40440 /**
40441  * Constructs a new MessageRouter which calls the relevant methods on this_arg.
40442  * This copies the `inner` pointer in this_arg and thus the returned MessageRouter must be freed before this_arg is
40443  */
40444 struct LDKMessageRouter DefaultMessageRouter_as_MessageRouter(const struct LDKDefaultMessageRouter *NONNULL_PTR this_arg);
40445
40446 /**
40447  * Frees any resources used by the OnionMessagePath, if is_owned is set and inner is non-NULL.
40448  */
40449 void OnionMessagePath_free(struct LDKOnionMessagePath this_obj);
40450
40451 /**
40452  * Nodes on the path between the sender and the destination.
40453  *
40454  * Returns a copy of the field.
40455  */
40456 struct LDKCVec_PublicKeyZ OnionMessagePath_get_intermediate_nodes(const struct LDKOnionMessagePath *NONNULL_PTR this_ptr);
40457
40458 /**
40459  * Nodes on the path between the sender and the destination.
40460  */
40461 void OnionMessagePath_set_intermediate_nodes(struct LDKOnionMessagePath *NONNULL_PTR this_ptr, struct LDKCVec_PublicKeyZ val);
40462
40463 /**
40464  * The recipient of the message.
40465  */
40466 struct LDKDestination OnionMessagePath_get_destination(const struct LDKOnionMessagePath *NONNULL_PTR this_ptr);
40467
40468 /**
40469  * The recipient of the message.
40470  */
40471 void OnionMessagePath_set_destination(struct LDKOnionMessagePath *NONNULL_PTR this_ptr, struct LDKDestination val);
40472
40473 /**
40474  * Constructs a new OnionMessagePath given each field
40475  */
40476 MUST_USE_RES struct LDKOnionMessagePath OnionMessagePath_new(struct LDKCVec_PublicKeyZ intermediate_nodes_arg, struct LDKDestination destination_arg);
40477
40478 /**
40479  * Creates a copy of the OnionMessagePath
40480  */
40481 struct LDKOnionMessagePath OnionMessagePath_clone(const struct LDKOnionMessagePath *NONNULL_PTR orig);
40482
40483 /**
40484  * Frees any resources used by the Destination
40485  */
40486 void Destination_free(struct LDKDestination this_ptr);
40487
40488 /**
40489  * Creates a copy of the Destination
40490  */
40491 struct LDKDestination Destination_clone(const struct LDKDestination *NONNULL_PTR orig);
40492
40493 /**
40494  * Utility method to constructs a new Node-variant Destination
40495  */
40496 struct LDKDestination Destination_node(struct LDKPublicKey a);
40497
40498 /**
40499  * Utility method to constructs a new BlindedPath-variant Destination
40500  */
40501 struct LDKDestination Destination_blinded_path(struct LDKBlindedPath a);
40502
40503 /**
40504  * Frees any resources used by the SendError
40505  */
40506 void SendError_free(struct LDKSendError this_ptr);
40507
40508 /**
40509  * Creates a copy of the SendError
40510  */
40511 struct LDKSendError SendError_clone(const struct LDKSendError *NONNULL_PTR orig);
40512
40513 /**
40514  * Utility method to constructs a new Secp256k1-variant SendError
40515  */
40516 struct LDKSendError SendError_secp256k1(enum LDKSecp256k1Error a);
40517
40518 /**
40519  * Utility method to constructs a new TooBigPacket-variant SendError
40520  */
40521 struct LDKSendError SendError_too_big_packet(void);
40522
40523 /**
40524  * Utility method to constructs a new TooFewBlindedHops-variant SendError
40525  */
40526 struct LDKSendError SendError_too_few_blinded_hops(void);
40527
40528 /**
40529  * Utility method to constructs a new InvalidFirstHop-variant SendError
40530  */
40531 struct LDKSendError SendError_invalid_first_hop(void);
40532
40533 /**
40534  * Utility method to constructs a new InvalidMessage-variant SendError
40535  */
40536 struct LDKSendError SendError_invalid_message(void);
40537
40538 /**
40539  * Utility method to constructs a new BufferFull-variant SendError
40540  */
40541 struct LDKSendError SendError_buffer_full(void);
40542
40543 /**
40544  * Utility method to constructs a new GetNodeIdFailed-variant SendError
40545  */
40546 struct LDKSendError SendError_get_node_id_failed(void);
40547
40548 /**
40549  * Utility method to constructs a new BlindedPathAdvanceFailed-variant SendError
40550  */
40551 struct LDKSendError SendError_blinded_path_advance_failed(void);
40552
40553 /**
40554  * Checks if two SendErrors contain equal inner contents.
40555  * This ignores pointers and is_owned flags and looks at the values in fields.
40556  */
40557 bool SendError_eq(const struct LDKSendError *NONNULL_PTR a, const struct LDKSendError *NONNULL_PTR b);
40558
40559 /**
40560  * Calls the free function if one is set
40561  */
40562 void CustomOnionMessageHandler_free(struct LDKCustomOnionMessageHandler this_ptr);
40563
40564 /**
40565  * Constructs a new `OnionMessenger` to send, forward, and delegate received onion messages to
40566  * their respective handlers.
40567  */
40568 MUST_USE_RES struct LDKOnionMessenger OnionMessenger_new(struct LDKEntropySource entropy_source, struct LDKNodeSigner node_signer, struct LDKLogger logger, struct LDKMessageRouter message_router, struct LDKOffersMessageHandler offers_handler, struct LDKCustomOnionMessageHandler custom_handler);
40569
40570 /**
40571  * Send an onion message with contents `message` to the destination of `path`.
40572  *
40573  * See [`OnionMessenger`] for example usage.
40574  *
40575  * Note that reply_path (or a relevant inner pointer) may be NULL or all-0s to represent None
40576  */
40577 MUST_USE_RES struct LDKCResult_NoneSendErrorZ OnionMessenger_send_onion_message(const struct LDKOnionMessenger *NONNULL_PTR this_arg, struct LDKOnionMessagePath path, struct LDKOnionMessageContents message, struct LDKBlindedPath reply_path);
40578
40579 /**
40580  * Constructs a new OnionMessageHandler which calls the relevant methods on this_arg.
40581  * This copies the `inner` pointer in this_arg and thus the returned OnionMessageHandler must be freed before this_arg is
40582  */
40583 struct LDKOnionMessageHandler OnionMessenger_as_OnionMessageHandler(const struct LDKOnionMessenger *NONNULL_PTR this_arg);
40584
40585 /**
40586  * Constructs a new OnionMessageProvider which calls the relevant methods on this_arg.
40587  * This copies the `inner` pointer in this_arg and thus the returned OnionMessageProvider must be freed before this_arg is
40588  */
40589 struct LDKOnionMessageProvider OnionMessenger_as_OnionMessageProvider(const struct LDKOnionMessenger *NONNULL_PTR this_arg);
40590
40591 /**
40592  * Calls the free function if one is set
40593  */
40594 void OffersMessageHandler_free(struct LDKOffersMessageHandler this_ptr);
40595
40596 /**
40597  * Frees any resources used by the OffersMessage
40598  */
40599 void OffersMessage_free(struct LDKOffersMessage this_ptr);
40600
40601 /**
40602  * Creates a copy of the OffersMessage
40603  */
40604 struct LDKOffersMessage OffersMessage_clone(const struct LDKOffersMessage *NONNULL_PTR orig);
40605
40606 /**
40607  * Utility method to constructs a new InvoiceRequest-variant OffersMessage
40608  */
40609 struct LDKOffersMessage OffersMessage_invoice_request(struct LDKInvoiceRequest a);
40610
40611 /**
40612  * Utility method to constructs a new Invoice-variant OffersMessage
40613  */
40614 struct LDKOffersMessage OffersMessage_invoice(struct LDKBolt12Invoice a);
40615
40616 /**
40617  * Utility method to constructs a new InvoiceError-variant OffersMessage
40618  */
40619 struct LDKOffersMessage OffersMessage_invoice_error(struct LDKInvoiceError a);
40620
40621 /**
40622  * Returns whether `tlv_type` corresponds to a TLV record for Offers.
40623  */
40624 MUST_USE_RES bool OffersMessage_is_known_type(uint64_t tlv_type);
40625
40626 /**
40627  * The TLV record type for the message as used in an `onionmsg_tlv` TLV stream.
40628  */
40629 MUST_USE_RES uint64_t OffersMessage_tlv_type(const struct LDKOffersMessage *NONNULL_PTR this_arg);
40630
40631 /**
40632  * Serialize the OffersMessage object into a byte array which can be read by OffersMessage_read
40633  */
40634 struct LDKCVec_u8Z OffersMessage_write(const struct LDKOffersMessage *NONNULL_PTR obj);
40635
40636 /**
40637  * Read a OffersMessage from a byte array, created by OffersMessage_write
40638  */
40639 struct LDKCResult_OffersMessageDecodeErrorZ OffersMessage_read(struct LDKu8slice ser, uint64_t arg_a, const struct LDKLogger *NONNULL_PTR arg_b);
40640
40641 /**
40642  * Frees any resources used by the OnionMessageContents
40643  */
40644 void OnionMessageContents_free(struct LDKOnionMessageContents this_ptr);
40645
40646 /**
40647  * Utility method to constructs a new Offers-variant OnionMessageContents
40648  */
40649 struct LDKOnionMessageContents OnionMessageContents_offers(struct LDKOffersMessage a);
40650
40651 /**
40652  * Utility method to constructs a new Custom-variant OnionMessageContents
40653  */
40654 struct LDKOnionMessageContents OnionMessageContents_custom(struct LDKCustomOnionMessageContents a);
40655
40656 /**
40657  * Calls the free function if one is set
40658  */
40659 void CustomOnionMessageContents_free(struct LDKCustomOnionMessageContents this_ptr);
40660
40661 /**
40662  * Frees any resources used by the BlindedPath, if is_owned is set and inner is non-NULL.
40663  */
40664 void BlindedPath_free(struct LDKBlindedPath this_obj);
40665
40666 /**
40667  * Creates a copy of the BlindedPath
40668  */
40669 struct LDKBlindedPath BlindedPath_clone(const struct LDKBlindedPath *NONNULL_PTR orig);
40670
40671 /**
40672  * Generates a non-cryptographic 64-bit hash of the BlindedPath.
40673  */
40674 uint64_t BlindedPath_hash(const struct LDKBlindedPath *NONNULL_PTR o);
40675
40676 /**
40677  * Checks if two BlindedPaths contain equal inner contents.
40678  * This ignores pointers and is_owned flags and looks at the values in fields.
40679  * Two objects with NULL inner values will be considered "equal" here.
40680  */
40681 bool BlindedPath_eq(const struct LDKBlindedPath *NONNULL_PTR a, const struct LDKBlindedPath *NONNULL_PTR b);
40682
40683 /**
40684  * Frees any resources used by the BlindedHop, if is_owned is set and inner is non-NULL.
40685  */
40686 void BlindedHop_free(struct LDKBlindedHop this_obj);
40687
40688 /**
40689  * Creates a copy of the BlindedHop
40690  */
40691 struct LDKBlindedHop BlindedHop_clone(const struct LDKBlindedHop *NONNULL_PTR orig);
40692
40693 /**
40694  * Generates a non-cryptographic 64-bit hash of the BlindedHop.
40695  */
40696 uint64_t BlindedHop_hash(const struct LDKBlindedHop *NONNULL_PTR o);
40697
40698 /**
40699  * Checks if two BlindedHops contain equal inner contents.
40700  * This ignores pointers and is_owned flags and looks at the values in fields.
40701  * Two objects with NULL inner values will be considered "equal" here.
40702  */
40703 bool BlindedHop_eq(const struct LDKBlindedHop *NONNULL_PTR a, const struct LDKBlindedHop *NONNULL_PTR b);
40704
40705 /**
40706  * Create a blinded path for an onion message, to be forwarded along `node_pks`. The last node
40707  * pubkey in `node_pks` will be the destination node.
40708  *
40709  * Errors if less than two hops are provided or if `node_pk`(s) are invalid.
40710  */
40711 MUST_USE_RES struct LDKCResult_BlindedPathNoneZ BlindedPath_new_for_message(struct LDKCVec_PublicKeyZ node_pks, const struct LDKEntropySource *NONNULL_PTR entropy_source);
40712
40713 /**
40714  * Serialize the BlindedPath object into a byte array which can be read by BlindedPath_read
40715  */
40716 struct LDKCVec_u8Z BlindedPath_write(const struct LDKBlindedPath *NONNULL_PTR obj);
40717
40718 /**
40719  * Read a BlindedPath from a byte array, created by BlindedPath_write
40720  */
40721 struct LDKCResult_BlindedPathDecodeErrorZ BlindedPath_read(struct LDKu8slice ser);
40722
40723 /**
40724  * Serialize the BlindedHop object into a byte array which can be read by BlindedHop_read
40725  */
40726 struct LDKCVec_u8Z BlindedHop_write(const struct LDKBlindedHop *NONNULL_PTR obj);
40727
40728 /**
40729  * Read a BlindedHop from a byte array, created by BlindedHop_write
40730  */
40731 struct LDKCResult_BlindedHopDecodeErrorZ BlindedHop_read(struct LDKu8slice ser);
40732
40733 /**
40734  * Frees any resources used by the PaymentPurpose
40735  */
40736 void PaymentPurpose_free(struct LDKPaymentPurpose this_ptr);
40737
40738 /**
40739  * Creates a copy of the PaymentPurpose
40740  */
40741 struct LDKPaymentPurpose PaymentPurpose_clone(const struct LDKPaymentPurpose *NONNULL_PTR orig);
40742
40743 /**
40744  * Utility method to constructs a new InvoicePayment-variant PaymentPurpose
40745  */
40746 struct LDKPaymentPurpose PaymentPurpose_invoice_payment(struct LDKCOption_PaymentPreimageZ payment_preimage, struct LDKThirtyTwoBytes payment_secret);
40747
40748 /**
40749  * Utility method to constructs a new SpontaneousPayment-variant PaymentPurpose
40750  */
40751 struct LDKPaymentPurpose PaymentPurpose_spontaneous_payment(struct LDKThirtyTwoBytes a);
40752
40753 /**
40754  * Checks if two PaymentPurposes contain equal inner contents.
40755  * This ignores pointers and is_owned flags and looks at the values in fields.
40756  */
40757 bool PaymentPurpose_eq(const struct LDKPaymentPurpose *NONNULL_PTR a, const struct LDKPaymentPurpose *NONNULL_PTR b);
40758
40759 /**
40760  * Serialize the PaymentPurpose object into a byte array which can be read by PaymentPurpose_read
40761  */
40762 struct LDKCVec_u8Z PaymentPurpose_write(const struct LDKPaymentPurpose *NONNULL_PTR obj);
40763
40764 /**
40765  * Read a PaymentPurpose from a byte array, created by PaymentPurpose_write
40766  */
40767 struct LDKCResult_PaymentPurposeDecodeErrorZ PaymentPurpose_read(struct LDKu8slice ser);
40768
40769 /**
40770  * Frees any resources used by the PathFailure
40771  */
40772 void PathFailure_free(struct LDKPathFailure this_ptr);
40773
40774 /**
40775  * Creates a copy of the PathFailure
40776  */
40777 struct LDKPathFailure PathFailure_clone(const struct LDKPathFailure *NONNULL_PTR orig);
40778
40779 /**
40780  * Utility method to constructs a new InitialSend-variant PathFailure
40781  */
40782 struct LDKPathFailure PathFailure_initial_send(struct LDKAPIError err);
40783
40784 /**
40785  * Utility method to constructs a new OnPath-variant PathFailure
40786  */
40787 struct LDKPathFailure PathFailure_on_path(struct LDKCOption_NetworkUpdateZ network_update);
40788
40789 /**
40790  * Checks if two PathFailures contain equal inner contents.
40791  * This ignores pointers and is_owned flags and looks at the values in fields.
40792  */
40793 bool PathFailure_eq(const struct LDKPathFailure *NONNULL_PTR a, const struct LDKPathFailure *NONNULL_PTR b);
40794
40795 /**
40796  * Serialize the PathFailure object into a byte array which can be read by PathFailure_read
40797  */
40798 struct LDKCVec_u8Z PathFailure_write(const struct LDKPathFailure *NONNULL_PTR obj);
40799
40800 /**
40801  * Read a PathFailure from a byte array, created by PathFailure_write
40802  */
40803 struct LDKCResult_COption_PathFailureZDecodeErrorZ PathFailure_read(struct LDKu8slice ser);
40804
40805 /**
40806  * Frees any resources used by the ClosureReason
40807  */
40808 void ClosureReason_free(struct LDKClosureReason this_ptr);
40809
40810 /**
40811  * Creates a copy of the ClosureReason
40812  */
40813 struct LDKClosureReason ClosureReason_clone(const struct LDKClosureReason *NONNULL_PTR orig);
40814
40815 /**
40816  * Utility method to constructs a new CounterpartyForceClosed-variant ClosureReason
40817  */
40818 struct LDKClosureReason ClosureReason_counterparty_force_closed(struct LDKUntrustedString peer_msg);
40819
40820 /**
40821  * Utility method to constructs a new HolderForceClosed-variant ClosureReason
40822  */
40823 struct LDKClosureReason ClosureReason_holder_force_closed(void);
40824
40825 /**
40826  * Utility method to constructs a new CooperativeClosure-variant ClosureReason
40827  */
40828 struct LDKClosureReason ClosureReason_cooperative_closure(void);
40829
40830 /**
40831  * Utility method to constructs a new CommitmentTxConfirmed-variant ClosureReason
40832  */
40833 struct LDKClosureReason ClosureReason_commitment_tx_confirmed(void);
40834
40835 /**
40836  * Utility method to constructs a new FundingTimedOut-variant ClosureReason
40837  */
40838 struct LDKClosureReason ClosureReason_funding_timed_out(void);
40839
40840 /**
40841  * Utility method to constructs a new ProcessingError-variant ClosureReason
40842  */
40843 struct LDKClosureReason ClosureReason_processing_error(struct LDKStr err);
40844
40845 /**
40846  * Utility method to constructs a new DisconnectedPeer-variant ClosureReason
40847  */
40848 struct LDKClosureReason ClosureReason_disconnected_peer(void);
40849
40850 /**
40851  * Utility method to constructs a new OutdatedChannelManager-variant ClosureReason
40852  */
40853 struct LDKClosureReason ClosureReason_outdated_channel_manager(void);
40854
40855 /**
40856  * Utility method to constructs a new CounterpartyCoopClosedUnfundedChannel-variant ClosureReason
40857  */
40858 struct LDKClosureReason ClosureReason_counterparty_coop_closed_unfunded_channel(void);
40859
40860 /**
40861  * Checks if two ClosureReasons contain equal inner contents.
40862  * This ignores pointers and is_owned flags and looks at the values in fields.
40863  */
40864 bool ClosureReason_eq(const struct LDKClosureReason *NONNULL_PTR a, const struct LDKClosureReason *NONNULL_PTR b);
40865
40866 /**
40867  * Serialize the ClosureReason object into a byte array which can be read by ClosureReason_read
40868  */
40869 struct LDKCVec_u8Z ClosureReason_write(const struct LDKClosureReason *NONNULL_PTR obj);
40870
40871 /**
40872  * Read a ClosureReason from a byte array, created by ClosureReason_write
40873  */
40874 struct LDKCResult_COption_ClosureReasonZDecodeErrorZ ClosureReason_read(struct LDKu8slice ser);
40875
40876 /**
40877  * Frees any resources used by the HTLCDestination
40878  */
40879 void HTLCDestination_free(struct LDKHTLCDestination this_ptr);
40880
40881 /**
40882  * Creates a copy of the HTLCDestination
40883  */
40884 struct LDKHTLCDestination HTLCDestination_clone(const struct LDKHTLCDestination *NONNULL_PTR orig);
40885
40886 /**
40887  * Utility method to constructs a new NextHopChannel-variant HTLCDestination
40888  */
40889 struct LDKHTLCDestination HTLCDestination_next_hop_channel(struct LDKPublicKey node_id, struct LDKThirtyTwoBytes channel_id);
40890
40891 /**
40892  * Utility method to constructs a new UnknownNextHop-variant HTLCDestination
40893  */
40894 struct LDKHTLCDestination HTLCDestination_unknown_next_hop(uint64_t requested_forward_scid);
40895
40896 /**
40897  * Utility method to constructs a new InvalidForward-variant HTLCDestination
40898  */
40899 struct LDKHTLCDestination HTLCDestination_invalid_forward(uint64_t requested_forward_scid);
40900
40901 /**
40902  * Utility method to constructs a new FailedPayment-variant HTLCDestination
40903  */
40904 struct LDKHTLCDestination HTLCDestination_failed_payment(struct LDKThirtyTwoBytes payment_hash);
40905
40906 /**
40907  * Checks if two HTLCDestinations contain equal inner contents.
40908  * This ignores pointers and is_owned flags and looks at the values in fields.
40909  */
40910 bool HTLCDestination_eq(const struct LDKHTLCDestination *NONNULL_PTR a, const struct LDKHTLCDestination *NONNULL_PTR b);
40911
40912 /**
40913  * Serialize the HTLCDestination object into a byte array which can be read by HTLCDestination_read
40914  */
40915 struct LDKCVec_u8Z HTLCDestination_write(const struct LDKHTLCDestination *NONNULL_PTR obj);
40916
40917 /**
40918  * Read a HTLCDestination from a byte array, created by HTLCDestination_write
40919  */
40920 struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ HTLCDestination_read(struct LDKu8slice ser);
40921
40922 /**
40923  * Creates a copy of the PaymentFailureReason
40924  */
40925 enum LDKPaymentFailureReason PaymentFailureReason_clone(const enum LDKPaymentFailureReason *NONNULL_PTR orig);
40926
40927 /**
40928  * Utility method to constructs a new RecipientRejected-variant PaymentFailureReason
40929  */
40930 enum LDKPaymentFailureReason PaymentFailureReason_recipient_rejected(void);
40931
40932 /**
40933  * Utility method to constructs a new UserAbandoned-variant PaymentFailureReason
40934  */
40935 enum LDKPaymentFailureReason PaymentFailureReason_user_abandoned(void);
40936
40937 /**
40938  * Utility method to constructs a new RetriesExhausted-variant PaymentFailureReason
40939  */
40940 enum LDKPaymentFailureReason PaymentFailureReason_retries_exhausted(void);
40941
40942 /**
40943  * Utility method to constructs a new PaymentExpired-variant PaymentFailureReason
40944  */
40945 enum LDKPaymentFailureReason PaymentFailureReason_payment_expired(void);
40946
40947 /**
40948  * Utility method to constructs a new RouteNotFound-variant PaymentFailureReason
40949  */
40950 enum LDKPaymentFailureReason PaymentFailureReason_route_not_found(void);
40951
40952 /**
40953  * Utility method to constructs a new UnexpectedError-variant PaymentFailureReason
40954  */
40955 enum LDKPaymentFailureReason PaymentFailureReason_unexpected_error(void);
40956
40957 /**
40958  * Checks if two PaymentFailureReasons contain equal inner contents.
40959  * This ignores pointers and is_owned flags and looks at the values in fields.
40960  */
40961 bool PaymentFailureReason_eq(const enum LDKPaymentFailureReason *NONNULL_PTR a, const enum LDKPaymentFailureReason *NONNULL_PTR b);
40962
40963 /**
40964  * Serialize the PaymentFailureReason object into a byte array which can be read by PaymentFailureReason_read
40965  */
40966 struct LDKCVec_u8Z PaymentFailureReason_write(const enum LDKPaymentFailureReason *NONNULL_PTR obj);
40967
40968 /**
40969  * Read a PaymentFailureReason from a byte array, created by PaymentFailureReason_write
40970  */
40971 struct LDKCResult_PaymentFailureReasonDecodeErrorZ PaymentFailureReason_read(struct LDKu8slice ser);
40972
40973 /**
40974  * Frees any resources used by the Event
40975  */
40976 void Event_free(struct LDKEvent this_ptr);
40977
40978 /**
40979  * Creates a copy of the Event
40980  */
40981 struct LDKEvent Event_clone(const struct LDKEvent *NONNULL_PTR orig);
40982
40983 /**
40984  * Utility method to constructs a new FundingGenerationReady-variant Event
40985  */
40986 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);
40987
40988 /**
40989  * Utility method to constructs a new PaymentClaimable-variant Event
40990  */
40991 struct LDKEvent Event_payment_claimable(struct LDKPublicKey receiver_node_id, struct LDKThirtyTwoBytes payment_hash, struct LDKRecipientOnionFields onion_fields, uint64_t amount_msat, uint64_t counterparty_skimmed_fee_msat, struct LDKPaymentPurpose purpose, struct LDKThirtyTwoBytes via_channel_id, struct LDKCOption_u128Z via_user_channel_id, struct LDKCOption_u32Z claim_deadline);
40992
40993 /**
40994  * Utility method to constructs a new PaymentClaimed-variant Event
40995  */
40996 struct LDKEvent Event_payment_claimed(struct LDKPublicKey receiver_node_id, struct LDKThirtyTwoBytes payment_hash, uint64_t amount_msat, struct LDKPaymentPurpose purpose);
40997
40998 /**
40999  * Utility method to constructs a new PaymentSent-variant Event
41000  */
41001 struct LDKEvent Event_payment_sent(struct LDKCOption_PaymentIdZ payment_id, struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_hash, struct LDKCOption_u64Z fee_paid_msat);
41002
41003 /**
41004  * Utility method to constructs a new PaymentFailed-variant Event
41005  */
41006 struct LDKEvent Event_payment_failed(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, struct LDKCOption_PaymentFailureReasonZ reason);
41007
41008 /**
41009  * Utility method to constructs a new PaymentPathSuccessful-variant Event
41010  */
41011 struct LDKEvent Event_payment_path_successful(struct LDKThirtyTwoBytes payment_id, struct LDKCOption_PaymentHashZ payment_hash, struct LDKPath path);
41012
41013 /**
41014  * Utility method to constructs a new PaymentPathFailed-variant Event
41015  */
41016 struct LDKEvent Event_payment_path_failed(struct LDKCOption_PaymentIdZ payment_id, struct LDKThirtyTwoBytes payment_hash, bool payment_failed_permanently, struct LDKPathFailure failure, struct LDKPath path, struct LDKCOption_u64Z short_channel_id);
41017
41018 /**
41019  * Utility method to constructs a new ProbeSuccessful-variant Event
41020  */
41021 struct LDKEvent Event_probe_successful(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, struct LDKPath path);
41022
41023 /**
41024  * Utility method to constructs a new ProbeFailed-variant Event
41025  */
41026 struct LDKEvent Event_probe_failed(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, struct LDKPath path, struct LDKCOption_u64Z short_channel_id);
41027
41028 /**
41029  * Utility method to constructs a new PendingHTLCsForwardable-variant Event
41030  */
41031 struct LDKEvent Event_pending_htlcs_forwardable(uint64_t time_forwardable);
41032
41033 /**
41034  * Utility method to constructs a new HTLCIntercepted-variant Event
41035  */
41036 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);
41037
41038 /**
41039  * Utility method to constructs a new SpendableOutputs-variant Event
41040  */
41041 struct LDKEvent Event_spendable_outputs(struct LDKCVec_SpendableOutputDescriptorZ outputs);
41042
41043 /**
41044  * Utility method to constructs a new PaymentForwarded-variant Event
41045  */
41046 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);
41047
41048 /**
41049  * Utility method to constructs a new ChannelPending-variant Event
41050  */
41051 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);
41052
41053 /**
41054  * Utility method to constructs a new ChannelReady-variant Event
41055  */
41056 struct LDKEvent Event_channel_ready(struct LDKThirtyTwoBytes channel_id, struct LDKU128 user_channel_id, struct LDKPublicKey counterparty_node_id, struct LDKChannelTypeFeatures channel_type);
41057
41058 /**
41059  * Utility method to constructs a new ChannelClosed-variant Event
41060  */
41061 struct LDKEvent Event_channel_closed(struct LDKThirtyTwoBytes channel_id, struct LDKU128 user_channel_id, struct LDKClosureReason reason);
41062
41063 /**
41064  * Utility method to constructs a new DiscardFunding-variant Event
41065  */
41066 struct LDKEvent Event_discard_funding(struct LDKThirtyTwoBytes channel_id, struct LDKTransaction transaction);
41067
41068 /**
41069  * Utility method to constructs a new OpenChannelRequest-variant Event
41070  */
41071 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);
41072
41073 /**
41074  * Utility method to constructs a new HTLCHandlingFailed-variant Event
41075  */
41076 struct LDKEvent Event_htlchandling_failed(struct LDKThirtyTwoBytes prev_channel_id, struct LDKHTLCDestination failed_next_destination);
41077
41078 /**
41079  * Utility method to constructs a new BumpTransaction-variant Event
41080  */
41081 struct LDKEvent Event_bump_transaction(struct LDKBumpTransactionEvent a);
41082
41083 /**
41084  * Checks if two Events contain equal inner contents.
41085  * This ignores pointers and is_owned flags and looks at the values in fields.
41086  */
41087 bool Event_eq(const struct LDKEvent *NONNULL_PTR a, const struct LDKEvent *NONNULL_PTR b);
41088
41089 /**
41090  * Serialize the Event object into a byte array which can be read by Event_read
41091  */
41092 struct LDKCVec_u8Z Event_write(const struct LDKEvent *NONNULL_PTR obj);
41093
41094 /**
41095  * Read a Event from a byte array, created by Event_write
41096  */
41097 struct LDKCResult_COption_EventZDecodeErrorZ Event_read(struct LDKu8slice ser);
41098
41099 /**
41100  * Frees any resources used by the MessageSendEvent
41101  */
41102 void MessageSendEvent_free(struct LDKMessageSendEvent this_ptr);
41103
41104 /**
41105  * Creates a copy of the MessageSendEvent
41106  */
41107 struct LDKMessageSendEvent MessageSendEvent_clone(const struct LDKMessageSendEvent *NONNULL_PTR orig);
41108
41109 /**
41110  * Utility method to constructs a new SendAcceptChannel-variant MessageSendEvent
41111  */
41112 struct LDKMessageSendEvent MessageSendEvent_send_accept_channel(struct LDKPublicKey node_id, struct LDKAcceptChannel msg);
41113
41114 /**
41115  * Utility method to constructs a new SendAcceptChannelV2-variant MessageSendEvent
41116  */
41117 struct LDKMessageSendEvent MessageSendEvent_send_accept_channel_v2(struct LDKPublicKey node_id, struct LDKAcceptChannelV2 msg);
41118
41119 /**
41120  * Utility method to constructs a new SendOpenChannel-variant MessageSendEvent
41121  */
41122 struct LDKMessageSendEvent MessageSendEvent_send_open_channel(struct LDKPublicKey node_id, struct LDKOpenChannel msg);
41123
41124 /**
41125  * Utility method to constructs a new SendOpenChannelV2-variant MessageSendEvent
41126  */
41127 struct LDKMessageSendEvent MessageSendEvent_send_open_channel_v2(struct LDKPublicKey node_id, struct LDKOpenChannelV2 msg);
41128
41129 /**
41130  * Utility method to constructs a new SendFundingCreated-variant MessageSendEvent
41131  */
41132 struct LDKMessageSendEvent MessageSendEvent_send_funding_created(struct LDKPublicKey node_id, struct LDKFundingCreated msg);
41133
41134 /**
41135  * Utility method to constructs a new SendFundingSigned-variant MessageSendEvent
41136  */
41137 struct LDKMessageSendEvent MessageSendEvent_send_funding_signed(struct LDKPublicKey node_id, struct LDKFundingSigned msg);
41138
41139 /**
41140  * Utility method to constructs a new SendTxAddInput-variant MessageSendEvent
41141  */
41142 struct LDKMessageSendEvent MessageSendEvent_send_tx_add_input(struct LDKPublicKey node_id, struct LDKTxAddInput msg);
41143
41144 /**
41145  * Utility method to constructs a new SendTxAddOutput-variant MessageSendEvent
41146  */
41147 struct LDKMessageSendEvent MessageSendEvent_send_tx_add_output(struct LDKPublicKey node_id, struct LDKTxAddOutput msg);
41148
41149 /**
41150  * Utility method to constructs a new SendTxRemoveInput-variant MessageSendEvent
41151  */
41152 struct LDKMessageSendEvent MessageSendEvent_send_tx_remove_input(struct LDKPublicKey node_id, struct LDKTxRemoveInput msg);
41153
41154 /**
41155  * Utility method to constructs a new SendTxRemoveOutput-variant MessageSendEvent
41156  */
41157 struct LDKMessageSendEvent MessageSendEvent_send_tx_remove_output(struct LDKPublicKey node_id, struct LDKTxRemoveOutput msg);
41158
41159 /**
41160  * Utility method to constructs a new SendTxComplete-variant MessageSendEvent
41161  */
41162 struct LDKMessageSendEvent MessageSendEvent_send_tx_complete(struct LDKPublicKey node_id, struct LDKTxComplete msg);
41163
41164 /**
41165  * Utility method to constructs a new SendTxSignatures-variant MessageSendEvent
41166  */
41167 struct LDKMessageSendEvent MessageSendEvent_send_tx_signatures(struct LDKPublicKey node_id, struct LDKTxSignatures msg);
41168
41169 /**
41170  * Utility method to constructs a new SendTxInitRbf-variant MessageSendEvent
41171  */
41172 struct LDKMessageSendEvent MessageSendEvent_send_tx_init_rbf(struct LDKPublicKey node_id, struct LDKTxInitRbf msg);
41173
41174 /**
41175  * Utility method to constructs a new SendTxAckRbf-variant MessageSendEvent
41176  */
41177 struct LDKMessageSendEvent MessageSendEvent_send_tx_ack_rbf(struct LDKPublicKey node_id, struct LDKTxAckRbf msg);
41178
41179 /**
41180  * Utility method to constructs a new SendTxAbort-variant MessageSendEvent
41181  */
41182 struct LDKMessageSendEvent MessageSendEvent_send_tx_abort(struct LDKPublicKey node_id, struct LDKTxAddInput msg);
41183
41184 /**
41185  * Utility method to constructs a new SendChannelReady-variant MessageSendEvent
41186  */
41187 struct LDKMessageSendEvent MessageSendEvent_send_channel_ready(struct LDKPublicKey node_id, struct LDKChannelReady msg);
41188
41189 /**
41190  * Utility method to constructs a new SendAnnouncementSignatures-variant MessageSendEvent
41191  */
41192 struct LDKMessageSendEvent MessageSendEvent_send_announcement_signatures(struct LDKPublicKey node_id, struct LDKAnnouncementSignatures msg);
41193
41194 /**
41195  * Utility method to constructs a new UpdateHTLCs-variant MessageSendEvent
41196  */
41197 struct LDKMessageSendEvent MessageSendEvent_update_htlcs(struct LDKPublicKey node_id, struct LDKCommitmentUpdate updates);
41198
41199 /**
41200  * Utility method to constructs a new SendRevokeAndACK-variant MessageSendEvent
41201  */
41202 struct LDKMessageSendEvent MessageSendEvent_send_revoke_and_ack(struct LDKPublicKey node_id, struct LDKRevokeAndACK msg);
41203
41204 /**
41205  * Utility method to constructs a new SendClosingSigned-variant MessageSendEvent
41206  */
41207 struct LDKMessageSendEvent MessageSendEvent_send_closing_signed(struct LDKPublicKey node_id, struct LDKClosingSigned msg);
41208
41209 /**
41210  * Utility method to constructs a new SendShutdown-variant MessageSendEvent
41211  */
41212 struct LDKMessageSendEvent MessageSendEvent_send_shutdown(struct LDKPublicKey node_id, struct LDKShutdown msg);
41213
41214 /**
41215  * Utility method to constructs a new SendChannelReestablish-variant MessageSendEvent
41216  */
41217 struct LDKMessageSendEvent MessageSendEvent_send_channel_reestablish(struct LDKPublicKey node_id, struct LDKChannelReestablish msg);
41218
41219 /**
41220  * Utility method to constructs a new SendChannelAnnouncement-variant MessageSendEvent
41221  */
41222 struct LDKMessageSendEvent MessageSendEvent_send_channel_announcement(struct LDKPublicKey node_id, struct LDKChannelAnnouncement msg, struct LDKChannelUpdate update_msg);
41223
41224 /**
41225  * Utility method to constructs a new BroadcastChannelAnnouncement-variant MessageSendEvent
41226  */
41227 struct LDKMessageSendEvent MessageSendEvent_broadcast_channel_announcement(struct LDKChannelAnnouncement msg, struct LDKChannelUpdate update_msg);
41228
41229 /**
41230  * Utility method to constructs a new BroadcastChannelUpdate-variant MessageSendEvent
41231  */
41232 struct LDKMessageSendEvent MessageSendEvent_broadcast_channel_update(struct LDKChannelUpdate msg);
41233
41234 /**
41235  * Utility method to constructs a new BroadcastNodeAnnouncement-variant MessageSendEvent
41236  */
41237 struct LDKMessageSendEvent MessageSendEvent_broadcast_node_announcement(struct LDKNodeAnnouncement msg);
41238
41239 /**
41240  * Utility method to constructs a new SendChannelUpdate-variant MessageSendEvent
41241  */
41242 struct LDKMessageSendEvent MessageSendEvent_send_channel_update(struct LDKPublicKey node_id, struct LDKChannelUpdate msg);
41243
41244 /**
41245  * Utility method to constructs a new HandleError-variant MessageSendEvent
41246  */
41247 struct LDKMessageSendEvent MessageSendEvent_handle_error(struct LDKPublicKey node_id, struct LDKErrorAction action);
41248
41249 /**
41250  * Utility method to constructs a new SendChannelRangeQuery-variant MessageSendEvent
41251  */
41252 struct LDKMessageSendEvent MessageSendEvent_send_channel_range_query(struct LDKPublicKey node_id, struct LDKQueryChannelRange msg);
41253
41254 /**
41255  * Utility method to constructs a new SendShortIdsQuery-variant MessageSendEvent
41256  */
41257 struct LDKMessageSendEvent MessageSendEvent_send_short_ids_query(struct LDKPublicKey node_id, struct LDKQueryShortChannelIds msg);
41258
41259 /**
41260  * Utility method to constructs a new SendReplyChannelRange-variant MessageSendEvent
41261  */
41262 struct LDKMessageSendEvent MessageSendEvent_send_reply_channel_range(struct LDKPublicKey node_id, struct LDKReplyChannelRange msg);
41263
41264 /**
41265  * Utility method to constructs a new SendGossipTimestampFilter-variant MessageSendEvent
41266  */
41267 struct LDKMessageSendEvent MessageSendEvent_send_gossip_timestamp_filter(struct LDKPublicKey node_id, struct LDKGossipTimestampFilter msg);
41268
41269 /**
41270  * Calls the free function if one is set
41271  */
41272 void MessageSendEventsProvider_free(struct LDKMessageSendEventsProvider this_ptr);
41273
41274 /**
41275  * Calls the free function if one is set
41276  */
41277 void OnionMessageProvider_free(struct LDKOnionMessageProvider this_ptr);
41278
41279 /**
41280  * Calls the free function if one is set
41281  */
41282 void EventsProvider_free(struct LDKEventsProvider this_ptr);
41283
41284 /**
41285  * Calls the free function if one is set
41286  */
41287 void EventHandler_free(struct LDKEventHandler this_ptr);
41288
41289 /**
41290  * Frees any resources used by the ChannelDerivationParameters, if is_owned is set and inner is non-NULL.
41291  */
41292 void ChannelDerivationParameters_free(struct LDKChannelDerivationParameters this_obj);
41293
41294 /**
41295  * The value in satoshis of the channel we're attempting to spend the anchor output of.
41296  */
41297 uint64_t ChannelDerivationParameters_get_value_satoshis(const struct LDKChannelDerivationParameters *NONNULL_PTR this_ptr);
41298
41299 /**
41300  * The value in satoshis of the channel we're attempting to spend the anchor output of.
41301  */
41302 void ChannelDerivationParameters_set_value_satoshis(struct LDKChannelDerivationParameters *NONNULL_PTR this_ptr, uint64_t val);
41303
41304 /**
41305  * The unique identifier to re-derive the signer for the associated channel.
41306  */
41307 const uint8_t (*ChannelDerivationParameters_get_keys_id(const struct LDKChannelDerivationParameters *NONNULL_PTR this_ptr))[32];
41308
41309 /**
41310  * The unique identifier to re-derive the signer for the associated channel.
41311  */
41312 void ChannelDerivationParameters_set_keys_id(struct LDKChannelDerivationParameters *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
41313
41314 /**
41315  * The necessary channel parameters that need to be provided to the re-derived signer through
41316  * [`ChannelSigner::provide_channel_parameters`].
41317  *
41318  * [`ChannelSigner::provide_channel_parameters`]: crate::sign::ChannelSigner::provide_channel_parameters
41319  */
41320 struct LDKChannelTransactionParameters ChannelDerivationParameters_get_transaction_parameters(const struct LDKChannelDerivationParameters *NONNULL_PTR this_ptr);
41321
41322 /**
41323  * The necessary channel parameters that need to be provided to the re-derived signer through
41324  * [`ChannelSigner::provide_channel_parameters`].
41325  *
41326  * [`ChannelSigner::provide_channel_parameters`]: crate::sign::ChannelSigner::provide_channel_parameters
41327  */
41328 void ChannelDerivationParameters_set_transaction_parameters(struct LDKChannelDerivationParameters *NONNULL_PTR this_ptr, struct LDKChannelTransactionParameters val);
41329
41330 /**
41331  * Constructs a new ChannelDerivationParameters given each field
41332  */
41333 MUST_USE_RES struct LDKChannelDerivationParameters ChannelDerivationParameters_new(uint64_t value_satoshis_arg, struct LDKThirtyTwoBytes keys_id_arg, struct LDKChannelTransactionParameters transaction_parameters_arg);
41334
41335 /**
41336  * Creates a copy of the ChannelDerivationParameters
41337  */
41338 struct LDKChannelDerivationParameters ChannelDerivationParameters_clone(const struct LDKChannelDerivationParameters *NONNULL_PTR orig);
41339
41340 /**
41341  * Checks if two ChannelDerivationParameterss contain equal inner contents.
41342  * This ignores pointers and is_owned flags and looks at the values in fields.
41343  * Two objects with NULL inner values will be considered "equal" here.
41344  */
41345 bool ChannelDerivationParameters_eq(const struct LDKChannelDerivationParameters *NONNULL_PTR a, const struct LDKChannelDerivationParameters *NONNULL_PTR b);
41346
41347 /**
41348  * Frees any resources used by the AnchorDescriptor, if is_owned is set and inner is non-NULL.
41349  */
41350 void AnchorDescriptor_free(struct LDKAnchorDescriptor this_obj);
41351
41352 /**
41353  * The parameters required to derive the signer for the anchor input.
41354  */
41355 struct LDKChannelDerivationParameters AnchorDescriptor_get_channel_derivation_parameters(const struct LDKAnchorDescriptor *NONNULL_PTR this_ptr);
41356
41357 /**
41358  * The parameters required to derive the signer for the anchor input.
41359  */
41360 void AnchorDescriptor_set_channel_derivation_parameters(struct LDKAnchorDescriptor *NONNULL_PTR this_ptr, struct LDKChannelDerivationParameters val);
41361
41362 /**
41363  * The transaction input's outpoint corresponding to the commitment transaction's anchor
41364  * output.
41365  */
41366 struct LDKOutPoint AnchorDescriptor_get_outpoint(const struct LDKAnchorDescriptor *NONNULL_PTR this_ptr);
41367
41368 /**
41369  * The transaction input's outpoint corresponding to the commitment transaction's anchor
41370  * output.
41371  */
41372 void AnchorDescriptor_set_outpoint(struct LDKAnchorDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val);
41373
41374 /**
41375  * Constructs a new AnchorDescriptor given each field
41376  */
41377 MUST_USE_RES struct LDKAnchorDescriptor AnchorDescriptor_new(struct LDKChannelDerivationParameters channel_derivation_parameters_arg, struct LDKOutPoint outpoint_arg);
41378
41379 /**
41380  * Creates a copy of the AnchorDescriptor
41381  */
41382 struct LDKAnchorDescriptor AnchorDescriptor_clone(const struct LDKAnchorDescriptor *NONNULL_PTR orig);
41383
41384 /**
41385  * Checks if two AnchorDescriptors contain equal inner contents.
41386  * This ignores pointers and is_owned flags and looks at the values in fields.
41387  * Two objects with NULL inner values will be considered "equal" here.
41388  */
41389 bool AnchorDescriptor_eq(const struct LDKAnchorDescriptor *NONNULL_PTR a, const struct LDKAnchorDescriptor *NONNULL_PTR b);
41390
41391 /**
41392  * Returns the UTXO to be spent by the anchor input, which can be obtained via
41393  * [`Self::unsigned_tx_input`].
41394  */
41395 MUST_USE_RES struct LDKTxOut AnchorDescriptor_previous_utxo(const struct LDKAnchorDescriptor *NONNULL_PTR this_arg);
41396
41397 /**
41398  * Returns the unsigned transaction input spending the anchor output in the commitment
41399  * transaction.
41400  */
41401 MUST_USE_RES struct LDKTxIn AnchorDescriptor_unsigned_tx_input(const struct LDKAnchorDescriptor *NONNULL_PTR this_arg);
41402
41403 /**
41404  * Returns the witness script of the anchor output in the commitment transaction.
41405  */
41406 MUST_USE_RES struct LDKCVec_u8Z AnchorDescriptor_witness_script(const struct LDKAnchorDescriptor *NONNULL_PTR this_arg);
41407
41408 /**
41409  * Returns the fully signed witness required to spend the anchor output in the commitment
41410  * transaction.
41411  */
41412 MUST_USE_RES struct LDKWitness AnchorDescriptor_tx_input_witness(const struct LDKAnchorDescriptor *NONNULL_PTR this_arg, struct LDKSignature signature);
41413
41414 /**
41415  * Derives the channel signer required to sign the anchor input.
41416  */
41417 MUST_USE_RES struct LDKWriteableEcdsaChannelSigner AnchorDescriptor_derive_channel_signer(const struct LDKAnchorDescriptor *NONNULL_PTR this_arg, const struct LDKSignerProvider *NONNULL_PTR signer_provider);
41418
41419 /**
41420  * Frees any resources used by the HTLCDescriptor, if is_owned is set and inner is non-NULL.
41421  */
41422 void HTLCDescriptor_free(struct LDKHTLCDescriptor this_obj);
41423
41424 /**
41425  * The parameters required to derive the signer for the HTLC input.
41426  */
41427 struct LDKChannelDerivationParameters HTLCDescriptor_get_channel_derivation_parameters(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr);
41428
41429 /**
41430  * The parameters required to derive the signer for the HTLC input.
41431  */
41432 void HTLCDescriptor_set_channel_derivation_parameters(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, struct LDKChannelDerivationParameters val);
41433
41434 /**
41435  * The number of the commitment transaction in which the HTLC output lives.
41436  */
41437 uint64_t HTLCDescriptor_get_per_commitment_number(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr);
41438
41439 /**
41440  * The number of the commitment transaction in which the HTLC output lives.
41441  */
41442 void HTLCDescriptor_set_per_commitment_number(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, uint64_t val);
41443
41444 /**
41445  * The key tweak corresponding to the number of the commitment transaction in which the HTLC
41446  * output lives. This tweak is applied to all the basepoints for both parties in the channel to
41447  * arrive at unique keys per commitment.
41448  *
41449  * See <https://github.com/lightning/bolts/blob/master/03-transactions.md#keys> for more info.
41450  */
41451 struct LDKPublicKey HTLCDescriptor_get_per_commitment_point(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr);
41452
41453 /**
41454  * The key tweak corresponding to the number of the commitment transaction in which the HTLC
41455  * output lives. This tweak is applied to all the basepoints for both parties in the channel to
41456  * arrive at unique keys per commitment.
41457  *
41458  * See <https://github.com/lightning/bolts/blob/master/03-transactions.md#keys> for more info.
41459  */
41460 void HTLCDescriptor_set_per_commitment_point(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val);
41461
41462 /**
41463  * The details of the HTLC as it appears in the commitment transaction.
41464  */
41465 struct LDKHTLCOutputInCommitment HTLCDescriptor_get_htlc(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr);
41466
41467 /**
41468  * The details of the HTLC as it appears in the commitment transaction.
41469  */
41470 void HTLCDescriptor_set_htlc(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, struct LDKHTLCOutputInCommitment val);
41471
41472 /**
41473  * The preimage, if `Some`, to claim the HTLC output with. If `None`, the timeout path must be
41474  * taken.
41475  */
41476 struct LDKCOption_PaymentPreimageZ HTLCDescriptor_get_preimage(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr);
41477
41478 /**
41479  * The preimage, if `Some`, to claim the HTLC output with. If `None`, the timeout path must be
41480  * taken.
41481  */
41482 void HTLCDescriptor_set_preimage(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, struct LDKCOption_PaymentPreimageZ val);
41483
41484 /**
41485  * The counterparty's signature required to spend the HTLC output.
41486  */
41487 struct LDKSignature HTLCDescriptor_get_counterparty_sig(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr);
41488
41489 /**
41490  * The counterparty's signature required to spend the HTLC output.
41491  */
41492 void HTLCDescriptor_set_counterparty_sig(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, struct LDKSignature val);
41493
41494 /**
41495  * Creates a copy of the HTLCDescriptor
41496  */
41497 struct LDKHTLCDescriptor HTLCDescriptor_clone(const struct LDKHTLCDescriptor *NONNULL_PTR orig);
41498
41499 /**
41500  * Checks if two HTLCDescriptors contain equal inner contents.
41501  * This ignores pointers and is_owned flags and looks at the values in fields.
41502  * Two objects with NULL inner values will be considered "equal" here.
41503  */
41504 bool HTLCDescriptor_eq(const struct LDKHTLCDescriptor *NONNULL_PTR a, const struct LDKHTLCDescriptor *NONNULL_PTR b);
41505
41506 /**
41507  * Returns the outpoint of the HTLC output in the commitment transaction. This is the outpoint
41508  * being spent by the HTLC input in the HTLC transaction.
41509  */
41510 MUST_USE_RES struct LDKOutPoint HTLCDescriptor_outpoint(const struct LDKHTLCDescriptor *NONNULL_PTR this_arg);
41511
41512 /**
41513  * Returns the UTXO to be spent by the HTLC input, which can be obtained via
41514  * [`Self::unsigned_tx_input`].
41515  */
41516 MUST_USE_RES struct LDKTxOut HTLCDescriptor_previous_utxo(const struct LDKHTLCDescriptor *NONNULL_PTR this_arg);
41517
41518 /**
41519  * Returns the unsigned transaction input spending the HTLC output in the commitment
41520  * transaction.
41521  */
41522 MUST_USE_RES struct LDKTxIn HTLCDescriptor_unsigned_tx_input(const struct LDKHTLCDescriptor *NONNULL_PTR this_arg);
41523
41524 /**
41525  * Returns the delayed output created as a result of spending the HTLC output in the commitment
41526  * transaction.
41527  */
41528 MUST_USE_RES struct LDKTxOut HTLCDescriptor_tx_output(const struct LDKHTLCDescriptor *NONNULL_PTR this_arg);
41529
41530 /**
41531  * Returns the witness script of the HTLC output in the commitment transaction.
41532  */
41533 MUST_USE_RES struct LDKCVec_u8Z HTLCDescriptor_witness_script(const struct LDKHTLCDescriptor *NONNULL_PTR this_arg);
41534
41535 /**
41536  * Returns the fully signed witness required to spend the HTLC output in the commitment
41537  * transaction.
41538  */
41539 MUST_USE_RES struct LDKWitness HTLCDescriptor_tx_input_witness(const struct LDKHTLCDescriptor *NONNULL_PTR this_arg, struct LDKSignature signature, struct LDKu8slice witness_script);
41540
41541 /**
41542  * Derives the channel signer required to sign the HTLC input.
41543  */
41544 MUST_USE_RES struct LDKWriteableEcdsaChannelSigner HTLCDescriptor_derive_channel_signer(const struct LDKHTLCDescriptor *NONNULL_PTR this_arg, const struct LDKSignerProvider *NONNULL_PTR signer_provider);
41545
41546 /**
41547  * Frees any resources used by the BumpTransactionEvent
41548  */
41549 void BumpTransactionEvent_free(struct LDKBumpTransactionEvent this_ptr);
41550
41551 /**
41552  * Creates a copy of the BumpTransactionEvent
41553  */
41554 struct LDKBumpTransactionEvent BumpTransactionEvent_clone(const struct LDKBumpTransactionEvent *NONNULL_PTR orig);
41555
41556 /**
41557  * Utility method to constructs a new ChannelClose-variant BumpTransactionEvent
41558  */
41559 struct LDKBumpTransactionEvent BumpTransactionEvent_channel_close(struct LDKThirtyTwoBytes claim_id, uint32_t package_target_feerate_sat_per_1000_weight, struct LDKTransaction commitment_tx, uint64_t commitment_tx_fee_satoshis, struct LDKAnchorDescriptor anchor_descriptor, struct LDKCVec_HTLCOutputInCommitmentZ pending_htlcs);
41560
41561 /**
41562  * Utility method to constructs a new HTLCResolution-variant BumpTransactionEvent
41563  */
41564 struct LDKBumpTransactionEvent BumpTransactionEvent_htlcresolution(struct LDKThirtyTwoBytes claim_id, uint32_t target_feerate_sat_per_1000_weight, struct LDKCVec_HTLCDescriptorZ htlc_descriptors, uint32_t tx_lock_time);
41565
41566 /**
41567  * Checks if two BumpTransactionEvents contain equal inner contents.
41568  * This ignores pointers and is_owned flags and looks at the values in fields.
41569  */
41570 bool BumpTransactionEvent_eq(const struct LDKBumpTransactionEvent *NONNULL_PTR a, const struct LDKBumpTransactionEvent *NONNULL_PTR b);
41571
41572 /**
41573  * Frees any resources used by the Input, if is_owned is set and inner is non-NULL.
41574  */
41575 void Input_free(struct LDKInput this_obj);
41576
41577 /**
41578  * The unique identifier of the input.
41579  */
41580 struct LDKOutPoint Input_get_outpoint(const struct LDKInput *NONNULL_PTR this_ptr);
41581
41582 /**
41583  * The unique identifier of the input.
41584  */
41585 void Input_set_outpoint(struct LDKInput *NONNULL_PTR this_ptr, struct LDKOutPoint val);
41586
41587 /**
41588  * The UTXO being spent by the input.
41589  */
41590 struct LDKTxOut Input_get_previous_utxo(const struct LDKInput *NONNULL_PTR this_ptr);
41591
41592 /**
41593  * The UTXO being spent by the input.
41594  */
41595 void Input_set_previous_utxo(struct LDKInput *NONNULL_PTR this_ptr, struct LDKTxOut val);
41596
41597 /**
41598  * The upper-bound weight consumed by the input's full [`TxIn::script_sig`] and
41599  * [`TxIn::witness`], each with their lengths included, required to satisfy the output's
41600  * script.
41601  */
41602 uint64_t Input_get_satisfaction_weight(const struct LDKInput *NONNULL_PTR this_ptr);
41603
41604 /**
41605  * The upper-bound weight consumed by the input's full [`TxIn::script_sig`] and
41606  * [`TxIn::witness`], each with their lengths included, required to satisfy the output's
41607  * script.
41608  */
41609 void Input_set_satisfaction_weight(struct LDKInput *NONNULL_PTR this_ptr, uint64_t val);
41610
41611 /**
41612  * Constructs a new Input given each field
41613  */
41614 MUST_USE_RES struct LDKInput Input_new(struct LDKOutPoint outpoint_arg, struct LDKTxOut previous_utxo_arg, uint64_t satisfaction_weight_arg);
41615
41616 /**
41617  * Creates a copy of the Input
41618  */
41619 struct LDKInput Input_clone(const struct LDKInput *NONNULL_PTR orig);
41620
41621 /**
41622  * Generates a non-cryptographic 64-bit hash of the Input.
41623  */
41624 uint64_t Input_hash(const struct LDKInput *NONNULL_PTR o);
41625
41626 /**
41627  * Checks if two Inputs contain equal inner contents.
41628  * This ignores pointers and is_owned flags and looks at the values in fields.
41629  * Two objects with NULL inner values will be considered "equal" here.
41630  */
41631 bool Input_eq(const struct LDKInput *NONNULL_PTR a, const struct LDKInput *NONNULL_PTR b);
41632
41633 /**
41634  * Frees any resources used by the Utxo, if is_owned is set and inner is non-NULL.
41635  */
41636 void Utxo_free(struct LDKUtxo this_obj);
41637
41638 /**
41639  * The unique identifier of the output.
41640  */
41641 struct LDKOutPoint Utxo_get_outpoint(const struct LDKUtxo *NONNULL_PTR this_ptr);
41642
41643 /**
41644  * The unique identifier of the output.
41645  */
41646 void Utxo_set_outpoint(struct LDKUtxo *NONNULL_PTR this_ptr, struct LDKOutPoint val);
41647
41648 /**
41649  * The output to spend.
41650  */
41651 struct LDKTxOut Utxo_get_output(const struct LDKUtxo *NONNULL_PTR this_ptr);
41652
41653 /**
41654  * The output to spend.
41655  */
41656 void Utxo_set_output(struct LDKUtxo *NONNULL_PTR this_ptr, struct LDKTxOut val);
41657
41658 /**
41659  * The upper-bound weight consumed by the input's full [`TxIn::script_sig`] and [`TxIn::witness`], each
41660  * with their lengths included, required to satisfy the output's script. The weight consumed by
41661  * the input's `script_sig` must account for [`WITNESS_SCALE_FACTOR`].
41662  */
41663 uint64_t Utxo_get_satisfaction_weight(const struct LDKUtxo *NONNULL_PTR this_ptr);
41664
41665 /**
41666  * The upper-bound weight consumed by the input's full [`TxIn::script_sig`] and [`TxIn::witness`], each
41667  * with their lengths included, required to satisfy the output's script. The weight consumed by
41668  * the input's `script_sig` must account for [`WITNESS_SCALE_FACTOR`].
41669  */
41670 void Utxo_set_satisfaction_weight(struct LDKUtxo *NONNULL_PTR this_ptr, uint64_t val);
41671
41672 /**
41673  * Constructs a new Utxo given each field
41674  */
41675 MUST_USE_RES struct LDKUtxo Utxo_new(struct LDKOutPoint outpoint_arg, struct LDKTxOut output_arg, uint64_t satisfaction_weight_arg);
41676
41677 /**
41678  * Creates a copy of the Utxo
41679  */
41680 struct LDKUtxo Utxo_clone(const struct LDKUtxo *NONNULL_PTR orig);
41681
41682 /**
41683  * Generates a non-cryptographic 64-bit hash of the Utxo.
41684  */
41685 uint64_t Utxo_hash(const struct LDKUtxo *NONNULL_PTR o);
41686
41687 /**
41688  * Checks if two Utxos contain equal inner contents.
41689  * This ignores pointers and is_owned flags and looks at the values in fields.
41690  * Two objects with NULL inner values will be considered "equal" here.
41691  */
41692 bool Utxo_eq(const struct LDKUtxo *NONNULL_PTR a, const struct LDKUtxo *NONNULL_PTR b);
41693
41694 /**
41695  * Returns a `Utxo` with the `satisfaction_weight` estimate for a legacy P2PKH output.
41696  */
41697 MUST_USE_RES struct LDKUtxo Utxo_new_p2pkh(struct LDKOutPoint outpoint, uint64_t value, const uint8_t (*pubkey_hash)[20]);
41698
41699 /**
41700  * Frees any resources used by the CoinSelection, if is_owned is set and inner is non-NULL.
41701  */
41702 void CoinSelection_free(struct LDKCoinSelection this_obj);
41703
41704 /**
41705  * The set of UTXOs (with at least 1 confirmation) to spend and use within a transaction
41706  * requiring additional fees.
41707  */
41708 struct LDKCVec_UtxoZ CoinSelection_get_confirmed_utxos(const struct LDKCoinSelection *NONNULL_PTR this_ptr);
41709
41710 /**
41711  * The set of UTXOs (with at least 1 confirmation) to spend and use within a transaction
41712  * requiring additional fees.
41713  */
41714 void CoinSelection_set_confirmed_utxos(struct LDKCoinSelection *NONNULL_PTR this_ptr, struct LDKCVec_UtxoZ val);
41715
41716 /**
41717  * An additional output tracking whether any change remained after coin selection. This output
41718  * should always have a value above dust for its given `script_pubkey`. It should not be
41719  * spent until the transaction it belongs to confirms to ensure mempool descendant limits are
41720  * not met. This implies no other party should be able to spend it except us.
41721  */
41722 struct LDKCOption_TxOutZ CoinSelection_get_change_output(const struct LDKCoinSelection *NONNULL_PTR this_ptr);
41723
41724 /**
41725  * An additional output tracking whether any change remained after coin selection. This output
41726  * should always have a value above dust for its given `script_pubkey`. It should not be
41727  * spent until the transaction it belongs to confirms to ensure mempool descendant limits are
41728  * not met. This implies no other party should be able to spend it except us.
41729  */
41730 void CoinSelection_set_change_output(struct LDKCoinSelection *NONNULL_PTR this_ptr, struct LDKCOption_TxOutZ val);
41731
41732 /**
41733  * Constructs a new CoinSelection given each field
41734  */
41735 MUST_USE_RES struct LDKCoinSelection CoinSelection_new(struct LDKCVec_UtxoZ confirmed_utxos_arg, struct LDKCOption_TxOutZ change_output_arg);
41736
41737 /**
41738  * Creates a copy of the CoinSelection
41739  */
41740 struct LDKCoinSelection CoinSelection_clone(const struct LDKCoinSelection *NONNULL_PTR orig);
41741
41742 /**
41743  * Calls the free function if one is set
41744  */
41745 void CoinSelectionSource_free(struct LDKCoinSelectionSource this_ptr);
41746
41747 /**
41748  * Calls the free function if one is set
41749  */
41750 void WalletSource_free(struct LDKWalletSource this_ptr);
41751
41752 /**
41753  * Frees any resources used by the Wallet, if is_owned is set and inner is non-NULL.
41754  */
41755 void Wallet_free(struct LDKWallet this_obj);
41756
41757 /**
41758  * Returns a new instance backed by the given [`WalletSource`] that serves as an implementation
41759  * of [`CoinSelectionSource`].
41760  */
41761 MUST_USE_RES struct LDKWallet Wallet_new(struct LDKWalletSource source, struct LDKLogger logger);
41762
41763 /**
41764  * Constructs a new CoinSelectionSource which calls the relevant methods on this_arg.
41765  * This copies the `inner` pointer in this_arg and thus the returned CoinSelectionSource must be freed before this_arg is
41766  */
41767 struct LDKCoinSelectionSource Wallet_as_CoinSelectionSource(const struct LDKWallet *NONNULL_PTR this_arg);
41768
41769 /**
41770  * Frees any resources used by the BumpTransactionEventHandler, if is_owned is set and inner is non-NULL.
41771  */
41772 void BumpTransactionEventHandler_free(struct LDKBumpTransactionEventHandler this_obj);
41773
41774 /**
41775  * Returns a new instance capable of handling [`Event::BumpTransaction`] events.
41776  *
41777  * [`Event::BumpTransaction`]: crate::events::Event::BumpTransaction
41778  */
41779 MUST_USE_RES struct LDKBumpTransactionEventHandler BumpTransactionEventHandler_new(struct LDKBroadcasterInterface broadcaster, struct LDKCoinSelectionSource utxo_source, struct LDKSignerProvider signer_provider, struct LDKLogger logger);
41780
41781 /**
41782  * Handles all variants of [`BumpTransactionEvent`].
41783  */
41784 void BumpTransactionEventHandler_handle_event(const struct LDKBumpTransactionEventHandler *NONNULL_PTR this_arg, const struct LDKBumpTransactionEvent *NONNULL_PTR event);
41785
41786 /**
41787  * Frees any resources used by the FilesystemPersister, if is_owned is set and inner is non-NULL.
41788  */
41789 void FilesystemPersister_free(struct LDKFilesystemPersister this_obj);
41790
41791 /**
41792  * Initialize a new FilesystemPersister and set the path to the individual channels'
41793  * files.
41794  */
41795 MUST_USE_RES struct LDKFilesystemPersister FilesystemPersister_new(struct LDKStr path_to_channel_data);
41796
41797 /**
41798  * Get the directory which was provided when this persister was initialized.
41799  */
41800 MUST_USE_RES struct LDKStr FilesystemPersister_get_data_dir(const struct LDKFilesystemPersister *NONNULL_PTR this_arg);
41801
41802 /**
41803  * Read `ChannelMonitor`s from disk.
41804  */
41805 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);
41806
41807 /**
41808  * Frees any resources used by the BackgroundProcessor, if is_owned is set and inner is non-NULL.
41809  */
41810 void BackgroundProcessor_free(struct LDKBackgroundProcessor this_obj);
41811
41812 /**
41813  * Frees any resources used by the GossipSync
41814  */
41815 void GossipSync_free(struct LDKGossipSync this_ptr);
41816
41817 /**
41818  * Utility method to constructs a new P2P-variant GossipSync
41819  */
41820 struct LDKGossipSync GossipSync_p2_p(const struct LDKP2PGossipSync *NONNULL_PTR a);
41821
41822 /**
41823  * Utility method to constructs a new Rapid-variant GossipSync
41824  */
41825 struct LDKGossipSync GossipSync_rapid(const struct LDKRapidGossipSync *NONNULL_PTR a);
41826
41827 /**
41828  * Utility method to constructs a new None-variant GossipSync
41829  */
41830 struct LDKGossipSync GossipSync_none(void);
41831
41832 /**
41833  * Start a background thread that takes care of responsibilities enumerated in the [top-level
41834  * documentation].
41835  *
41836  * The thread runs indefinitely unless the object is dropped, [`stop`] is called, or
41837  * [`Persister::persist_manager`] returns an error. In case of an error, the error is retrieved by calling
41838  * either [`join`] or [`stop`].
41839  *
41840  * # Data Persistence
41841  *
41842  * [`Persister::persist_manager`] is responsible for writing out the [`ChannelManager`] to disk, and/or
41843  * uploading to one or more backup services. See [`ChannelManager::write`] for writing out a
41844  * [`ChannelManager`]. See the `lightning-persister` crate for LDK's
41845  * provided implementation.
41846  *
41847  * [`Persister::persist_graph`] is responsible for writing out the [`NetworkGraph`] to disk, if
41848  * [`GossipSync`] is supplied. See [`NetworkGraph::write`] for writing out a [`NetworkGraph`].
41849  * See the `lightning-persister` crate for LDK's provided implementation.
41850  *
41851  * Typically, users should either implement [`Persister::persist_manager`] to never return an
41852  * error or call [`join`] and handle any error that may arise. For the latter case,
41853  * `BackgroundProcessor` must be restarted by calling `start` again after handling the error.
41854  *
41855  * # Event Handling
41856  *
41857  * `event_handler` is responsible for handling events that users should be notified of (e.g.,
41858  * payment failed). [`BackgroundProcessor`] may decorate the given [`EventHandler`] with common
41859  * functionality implemented by other handlers.
41860  * * [`P2PGossipSync`] if given will update the [`NetworkGraph`] based on payment failures.
41861  *
41862  * # Rapid Gossip Sync
41863  *
41864  * If rapid gossip sync is meant to run at startup, pass [`RapidGossipSync`] via `gossip_sync`
41865  * to indicate that the [`BackgroundProcessor`] should not prune the [`NetworkGraph`] instance
41866  * until the [`RapidGossipSync`] instance completes its first sync.
41867  *
41868  * [top-level documentation]: BackgroundProcessor
41869  * [`join`]: Self::join
41870  * [`stop`]: Self::stop
41871  * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
41872  * [`ChannelManager::write`]: lightning::ln::channelmanager::ChannelManager#impl-Writeable
41873  * [`Persister::persist_manager`]: lightning::util::persist::Persister::persist_manager
41874  * [`Persister::persist_graph`]: lightning::util::persist::Persister::persist_graph
41875  * [`NetworkGraph`]: lightning::routing::gossip::NetworkGraph
41876  * [`NetworkGraph::write`]: lightning::routing::gossip::NetworkGraph#impl-Writeable
41877  */
41878 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);
41879
41880 /**
41881  * Join `BackgroundProcessor`'s thread, returning any error that occurred while persisting
41882  * [`ChannelManager`].
41883  *
41884  * # Panics
41885  *
41886  * This function panics if the background thread has panicked such as while persisting or
41887  * handling events.
41888  *
41889  * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
41890  */
41891 MUST_USE_RES struct LDKCResult_NoneErrorZ BackgroundProcessor_join(struct LDKBackgroundProcessor this_arg);
41892
41893 /**
41894  * Stop `BackgroundProcessor`'s thread, returning any error that occurred while persisting
41895  * [`ChannelManager`].
41896  *
41897  * # Panics
41898  *
41899  * This function panics if the background thread has panicked such as while persisting or
41900  * handling events.
41901  *
41902  * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
41903  */
41904 MUST_USE_RES struct LDKCResult_NoneErrorZ BackgroundProcessor_stop(struct LDKBackgroundProcessor this_arg);
41905
41906 /**
41907  * Frees any resources used by the Bolt11ParseError
41908  */
41909 void Bolt11ParseError_free(struct LDKBolt11ParseError this_ptr);
41910
41911 /**
41912  * Creates a copy of the Bolt11ParseError
41913  */
41914 struct LDKBolt11ParseError Bolt11ParseError_clone(const struct LDKBolt11ParseError *NONNULL_PTR orig);
41915
41916 /**
41917  * Utility method to constructs a new Bech32Error-variant Bolt11ParseError
41918  */
41919 struct LDKBolt11ParseError Bolt11ParseError_bech32_error(struct LDKBech32Error a);
41920
41921 /**
41922  * Utility method to constructs a new ParseAmountError-variant Bolt11ParseError
41923  */
41924 struct LDKBolt11ParseError Bolt11ParseError_parse_amount_error(struct LDKError a);
41925
41926 /**
41927  * Utility method to constructs a new MalformedSignature-variant Bolt11ParseError
41928  */
41929 struct LDKBolt11ParseError Bolt11ParseError_malformed_signature(enum LDKSecp256k1Error a);
41930
41931 /**
41932  * Utility method to constructs a new BadPrefix-variant Bolt11ParseError
41933  */
41934 struct LDKBolt11ParseError Bolt11ParseError_bad_prefix(void);
41935
41936 /**
41937  * Utility method to constructs a new UnknownCurrency-variant Bolt11ParseError
41938  */
41939 struct LDKBolt11ParseError Bolt11ParseError_unknown_currency(void);
41940
41941 /**
41942  * Utility method to constructs a new UnknownSiPrefix-variant Bolt11ParseError
41943  */
41944 struct LDKBolt11ParseError Bolt11ParseError_unknown_si_prefix(void);
41945
41946 /**
41947  * Utility method to constructs a new MalformedHRP-variant Bolt11ParseError
41948  */
41949 struct LDKBolt11ParseError Bolt11ParseError_malformed_hrp(void);
41950
41951 /**
41952  * Utility method to constructs a new TooShortDataPart-variant Bolt11ParseError
41953  */
41954 struct LDKBolt11ParseError Bolt11ParseError_too_short_data_part(void);
41955
41956 /**
41957  * Utility method to constructs a new UnexpectedEndOfTaggedFields-variant Bolt11ParseError
41958  */
41959 struct LDKBolt11ParseError Bolt11ParseError_unexpected_end_of_tagged_fields(void);
41960
41961 /**
41962  * Utility method to constructs a new DescriptionDecodeError-variant Bolt11ParseError
41963  */
41964 struct LDKBolt11ParseError Bolt11ParseError_description_decode_error(struct LDKError a);
41965
41966 /**
41967  * Utility method to constructs a new PaddingError-variant Bolt11ParseError
41968  */
41969 struct LDKBolt11ParseError Bolt11ParseError_padding_error(void);
41970
41971 /**
41972  * Utility method to constructs a new IntegerOverflowError-variant Bolt11ParseError
41973  */
41974 struct LDKBolt11ParseError Bolt11ParseError_integer_overflow_error(void);
41975
41976 /**
41977  * Utility method to constructs a new InvalidSegWitProgramLength-variant Bolt11ParseError
41978  */
41979 struct LDKBolt11ParseError Bolt11ParseError_invalid_seg_wit_program_length(void);
41980
41981 /**
41982  * Utility method to constructs a new InvalidPubKeyHashLength-variant Bolt11ParseError
41983  */
41984 struct LDKBolt11ParseError Bolt11ParseError_invalid_pub_key_hash_length(void);
41985
41986 /**
41987  * Utility method to constructs a new InvalidScriptHashLength-variant Bolt11ParseError
41988  */
41989 struct LDKBolt11ParseError Bolt11ParseError_invalid_script_hash_length(void);
41990
41991 /**
41992  * Utility method to constructs a new InvalidRecoveryId-variant Bolt11ParseError
41993  */
41994 struct LDKBolt11ParseError Bolt11ParseError_invalid_recovery_id(void);
41995
41996 /**
41997  * Utility method to constructs a new InvalidSliceLength-variant Bolt11ParseError
41998  */
41999 struct LDKBolt11ParseError Bolt11ParseError_invalid_slice_length(struct LDKStr a);
42000
42001 /**
42002  * Utility method to constructs a new Skip-variant Bolt11ParseError
42003  */
42004 struct LDKBolt11ParseError Bolt11ParseError_skip(void);
42005
42006 /**
42007  * Checks if two Bolt11ParseErrors contain equal inner contents.
42008  * This ignores pointers and is_owned flags and looks at the values in fields.
42009  */
42010 bool Bolt11ParseError_eq(const struct LDKBolt11ParseError *NONNULL_PTR a, const struct LDKBolt11ParseError *NONNULL_PTR b);
42011
42012 /**
42013  * Frees any resources used by the ParseOrSemanticError
42014  */
42015 void ParseOrSemanticError_free(struct LDKParseOrSemanticError this_ptr);
42016
42017 /**
42018  * Creates a copy of the ParseOrSemanticError
42019  */
42020 struct LDKParseOrSemanticError ParseOrSemanticError_clone(const struct LDKParseOrSemanticError *NONNULL_PTR orig);
42021
42022 /**
42023  * Utility method to constructs a new ParseError-variant ParseOrSemanticError
42024  */
42025 struct LDKParseOrSemanticError ParseOrSemanticError_parse_error(struct LDKBolt11ParseError a);
42026
42027 /**
42028  * Utility method to constructs a new SemanticError-variant ParseOrSemanticError
42029  */
42030 struct LDKParseOrSemanticError ParseOrSemanticError_semantic_error(enum LDKBolt11SemanticError a);
42031
42032 /**
42033  * Checks if two ParseOrSemanticErrors contain equal inner contents.
42034  * This ignores pointers and is_owned flags and looks at the values in fields.
42035  */
42036 bool ParseOrSemanticError_eq(const struct LDKParseOrSemanticError *NONNULL_PTR a, const struct LDKParseOrSemanticError *NONNULL_PTR b);
42037
42038 /**
42039  * Frees any resources used by the Bolt11Invoice, if is_owned is set and inner is non-NULL.
42040  */
42041 void Bolt11Invoice_free(struct LDKBolt11Invoice this_obj);
42042
42043 /**
42044  * Checks if two Bolt11Invoices contain equal inner contents.
42045  * This ignores pointers and is_owned flags and looks at the values in fields.
42046  * Two objects with NULL inner values will be considered "equal" here.
42047  */
42048 bool Bolt11Invoice_eq(const struct LDKBolt11Invoice *NONNULL_PTR a, const struct LDKBolt11Invoice *NONNULL_PTR b);
42049
42050 /**
42051  * Creates a copy of the Bolt11Invoice
42052  */
42053 struct LDKBolt11Invoice Bolt11Invoice_clone(const struct LDKBolt11Invoice *NONNULL_PTR orig);
42054
42055 /**
42056  * Generates a non-cryptographic 64-bit hash of the Bolt11Invoice.
42057  */
42058 uint64_t Bolt11Invoice_hash(const struct LDKBolt11Invoice *NONNULL_PTR o);
42059
42060 /**
42061  * Frees any resources used by the SignedRawBolt11Invoice, if is_owned is set and inner is non-NULL.
42062  */
42063 void SignedRawBolt11Invoice_free(struct LDKSignedRawBolt11Invoice this_obj);
42064
42065 /**
42066  * Checks if two SignedRawBolt11Invoices contain equal inner contents.
42067  * This ignores pointers and is_owned flags and looks at the values in fields.
42068  * Two objects with NULL inner values will be considered "equal" here.
42069  */
42070 bool SignedRawBolt11Invoice_eq(const struct LDKSignedRawBolt11Invoice *NONNULL_PTR a, const struct LDKSignedRawBolt11Invoice *NONNULL_PTR b);
42071
42072 /**
42073  * Creates a copy of the SignedRawBolt11Invoice
42074  */
42075 struct LDKSignedRawBolt11Invoice SignedRawBolt11Invoice_clone(const struct LDKSignedRawBolt11Invoice *NONNULL_PTR orig);
42076
42077 /**
42078  * Generates a non-cryptographic 64-bit hash of the SignedRawBolt11Invoice.
42079  */
42080 uint64_t SignedRawBolt11Invoice_hash(const struct LDKSignedRawBolt11Invoice *NONNULL_PTR o);
42081
42082 /**
42083  * Frees any resources used by the RawBolt11Invoice, if is_owned is set and inner is non-NULL.
42084  */
42085 void RawBolt11Invoice_free(struct LDKRawBolt11Invoice this_obj);
42086
42087 /**
42088  * data part
42089  */
42090 struct LDKRawDataPart RawBolt11Invoice_get_data(const struct LDKRawBolt11Invoice *NONNULL_PTR this_ptr);
42091
42092 /**
42093  * data part
42094  */
42095 void RawBolt11Invoice_set_data(struct LDKRawBolt11Invoice *NONNULL_PTR this_ptr, struct LDKRawDataPart val);
42096
42097 /**
42098  * Checks if two RawBolt11Invoices contain equal inner contents.
42099  * This ignores pointers and is_owned flags and looks at the values in fields.
42100  * Two objects with NULL inner values will be considered "equal" here.
42101  */
42102 bool RawBolt11Invoice_eq(const struct LDKRawBolt11Invoice *NONNULL_PTR a, const struct LDKRawBolt11Invoice *NONNULL_PTR b);
42103
42104 /**
42105  * Creates a copy of the RawBolt11Invoice
42106  */
42107 struct LDKRawBolt11Invoice RawBolt11Invoice_clone(const struct LDKRawBolt11Invoice *NONNULL_PTR orig);
42108
42109 /**
42110  * Generates a non-cryptographic 64-bit hash of the RawBolt11Invoice.
42111  */
42112 uint64_t RawBolt11Invoice_hash(const struct LDKRawBolt11Invoice *NONNULL_PTR o);
42113
42114 /**
42115  * Frees any resources used by the RawDataPart, if is_owned is set and inner is non-NULL.
42116  */
42117 void RawDataPart_free(struct LDKRawDataPart this_obj);
42118
42119 /**
42120  * generation time of the invoice
42121  */
42122 struct LDKPositiveTimestamp RawDataPart_get_timestamp(const struct LDKRawDataPart *NONNULL_PTR this_ptr);
42123
42124 /**
42125  * generation time of the invoice
42126  */
42127 void RawDataPart_set_timestamp(struct LDKRawDataPart *NONNULL_PTR this_ptr, struct LDKPositiveTimestamp val);
42128
42129 /**
42130  * Checks if two RawDataParts contain equal inner contents.
42131  * This ignores pointers and is_owned flags and looks at the values in fields.
42132  * Two objects with NULL inner values will be considered "equal" here.
42133  */
42134 bool RawDataPart_eq(const struct LDKRawDataPart *NONNULL_PTR a, const struct LDKRawDataPart *NONNULL_PTR b);
42135
42136 /**
42137  * Creates a copy of the RawDataPart
42138  */
42139 struct LDKRawDataPart RawDataPart_clone(const struct LDKRawDataPart *NONNULL_PTR orig);
42140
42141 /**
42142  * Generates a non-cryptographic 64-bit hash of the RawDataPart.
42143  */
42144 uint64_t RawDataPart_hash(const struct LDKRawDataPart *NONNULL_PTR o);
42145
42146 /**
42147  * Frees any resources used by the PositiveTimestamp, if is_owned is set and inner is non-NULL.
42148  */
42149 void PositiveTimestamp_free(struct LDKPositiveTimestamp this_obj);
42150
42151 /**
42152  * Checks if two PositiveTimestamps contain equal inner contents.
42153  * This ignores pointers and is_owned flags and looks at the values in fields.
42154  * Two objects with NULL inner values will be considered "equal" here.
42155  */
42156 bool PositiveTimestamp_eq(const struct LDKPositiveTimestamp *NONNULL_PTR a, const struct LDKPositiveTimestamp *NONNULL_PTR b);
42157
42158 /**
42159  * Creates a copy of the PositiveTimestamp
42160  */
42161 struct LDKPositiveTimestamp PositiveTimestamp_clone(const struct LDKPositiveTimestamp *NONNULL_PTR orig);
42162
42163 /**
42164  * Generates a non-cryptographic 64-bit hash of the PositiveTimestamp.
42165  */
42166 uint64_t PositiveTimestamp_hash(const struct LDKPositiveTimestamp *NONNULL_PTR o);
42167
42168 /**
42169  * Creates a copy of the SiPrefix
42170  */
42171 enum LDKSiPrefix SiPrefix_clone(const enum LDKSiPrefix *NONNULL_PTR orig);
42172
42173 /**
42174  * Utility method to constructs a new Milli-variant SiPrefix
42175  */
42176 enum LDKSiPrefix SiPrefix_milli(void);
42177
42178 /**
42179  * Utility method to constructs a new Micro-variant SiPrefix
42180  */
42181 enum LDKSiPrefix SiPrefix_micro(void);
42182
42183 /**
42184  * Utility method to constructs a new Nano-variant SiPrefix
42185  */
42186 enum LDKSiPrefix SiPrefix_nano(void);
42187
42188 /**
42189  * Utility method to constructs a new Pico-variant SiPrefix
42190  */
42191 enum LDKSiPrefix SiPrefix_pico(void);
42192
42193 /**
42194  * Checks if two SiPrefixs contain equal inner contents.
42195  * This ignores pointers and is_owned flags and looks at the values in fields.
42196  */
42197 bool SiPrefix_eq(const enum LDKSiPrefix *NONNULL_PTR a, const enum LDKSiPrefix *NONNULL_PTR b);
42198
42199 /**
42200  * Generates a non-cryptographic 64-bit hash of the SiPrefix.
42201  */
42202 uint64_t SiPrefix_hash(const enum LDKSiPrefix *NONNULL_PTR o);
42203
42204 /**
42205  * Returns the multiplier to go from a BTC value to picoBTC implied by this SiPrefix.
42206  * This is effectively 10^12 * the prefix multiplier
42207  */
42208 MUST_USE_RES uint64_t SiPrefix_multiplier(const enum LDKSiPrefix *NONNULL_PTR this_arg);
42209
42210 /**
42211  * Creates a copy of the Currency
42212  */
42213 enum LDKCurrency Currency_clone(const enum LDKCurrency *NONNULL_PTR orig);
42214
42215 /**
42216  * Utility method to constructs a new Bitcoin-variant Currency
42217  */
42218 enum LDKCurrency Currency_bitcoin(void);
42219
42220 /**
42221  * Utility method to constructs a new BitcoinTestnet-variant Currency
42222  */
42223 enum LDKCurrency Currency_bitcoin_testnet(void);
42224
42225 /**
42226  * Utility method to constructs a new Regtest-variant Currency
42227  */
42228 enum LDKCurrency Currency_regtest(void);
42229
42230 /**
42231  * Utility method to constructs a new Simnet-variant Currency
42232  */
42233 enum LDKCurrency Currency_simnet(void);
42234
42235 /**
42236  * Utility method to constructs a new Signet-variant Currency
42237  */
42238 enum LDKCurrency Currency_signet(void);
42239
42240 /**
42241  * Generates a non-cryptographic 64-bit hash of the Currency.
42242  */
42243 uint64_t Currency_hash(const enum LDKCurrency *NONNULL_PTR o);
42244
42245 /**
42246  * Checks if two Currencys contain equal inner contents.
42247  * This ignores pointers and is_owned flags and looks at the values in fields.
42248  */
42249 bool Currency_eq(const enum LDKCurrency *NONNULL_PTR a, const enum LDKCurrency *NONNULL_PTR b);
42250
42251 /**
42252  * Frees any resources used by the Sha256, if is_owned is set and inner is non-NULL.
42253  */
42254 void Sha256_free(struct LDKSha256 this_obj);
42255
42256 /**
42257  * Creates a copy of the Sha256
42258  */
42259 struct LDKSha256 Sha256_clone(const struct LDKSha256 *NONNULL_PTR orig);
42260
42261 /**
42262  * Generates a non-cryptographic 64-bit hash of the Sha256.
42263  */
42264 uint64_t Sha256_hash(const struct LDKSha256 *NONNULL_PTR o);
42265
42266 /**
42267  * Checks if two Sha256s contain equal inner contents.
42268  * This ignores pointers and is_owned flags and looks at the values in fields.
42269  * Two objects with NULL inner values will be considered "equal" here.
42270  */
42271 bool Sha256_eq(const struct LDKSha256 *NONNULL_PTR a, const struct LDKSha256 *NONNULL_PTR b);
42272
42273 /**
42274  * Constructs a new [`Sha256`] from the given bytes, which are assumed to be the output of a
42275  * single sha256 hash.
42276  */
42277 MUST_USE_RES struct LDKSha256 Sha256_from_bytes(const uint8_t (*bytes)[32]);
42278
42279 /**
42280  * Frees any resources used by the Description, if is_owned is set and inner is non-NULL.
42281  */
42282 void Description_free(struct LDKDescription this_obj);
42283
42284 /**
42285  * Creates a copy of the Description
42286  */
42287 struct LDKDescription Description_clone(const struct LDKDescription *NONNULL_PTR orig);
42288
42289 /**
42290  * Generates a non-cryptographic 64-bit hash of the Description.
42291  */
42292 uint64_t Description_hash(const struct LDKDescription *NONNULL_PTR o);
42293
42294 /**
42295  * Checks if two Descriptions contain equal inner contents.
42296  * This ignores pointers and is_owned flags and looks at the values in fields.
42297  * Two objects with NULL inner values will be considered "equal" here.
42298  */
42299 bool Description_eq(const struct LDKDescription *NONNULL_PTR a, const struct LDKDescription *NONNULL_PTR b);
42300
42301 /**
42302  * Frees any resources used by the PayeePubKey, if is_owned is set and inner is non-NULL.
42303  */
42304 void PayeePubKey_free(struct LDKPayeePubKey this_obj);
42305
42306 struct LDKPublicKey PayeePubKey_get_a(const struct LDKPayeePubKey *NONNULL_PTR this_ptr);
42307
42308 void PayeePubKey_set_a(struct LDKPayeePubKey *NONNULL_PTR this_ptr, struct LDKPublicKey val);
42309
42310 /**
42311  * Constructs a new PayeePubKey given each field
42312  */
42313 MUST_USE_RES struct LDKPayeePubKey PayeePubKey_new(struct LDKPublicKey a_arg);
42314
42315 /**
42316  * Creates a copy of the PayeePubKey
42317  */
42318 struct LDKPayeePubKey PayeePubKey_clone(const struct LDKPayeePubKey *NONNULL_PTR orig);
42319
42320 /**
42321  * Generates a non-cryptographic 64-bit hash of the PayeePubKey.
42322  */
42323 uint64_t PayeePubKey_hash(const struct LDKPayeePubKey *NONNULL_PTR o);
42324
42325 /**
42326  * Checks if two PayeePubKeys contain equal inner contents.
42327  * This ignores pointers and is_owned flags and looks at the values in fields.
42328  * Two objects with NULL inner values will be considered "equal" here.
42329  */
42330 bool PayeePubKey_eq(const struct LDKPayeePubKey *NONNULL_PTR a, const struct LDKPayeePubKey *NONNULL_PTR b);
42331
42332 /**
42333  * Frees any resources used by the ExpiryTime, if is_owned is set and inner is non-NULL.
42334  */
42335 void ExpiryTime_free(struct LDKExpiryTime this_obj);
42336
42337 /**
42338  * Creates a copy of the ExpiryTime
42339  */
42340 struct LDKExpiryTime ExpiryTime_clone(const struct LDKExpiryTime *NONNULL_PTR orig);
42341
42342 /**
42343  * Generates a non-cryptographic 64-bit hash of the ExpiryTime.
42344  */
42345 uint64_t ExpiryTime_hash(const struct LDKExpiryTime *NONNULL_PTR o);
42346
42347 /**
42348  * Checks if two ExpiryTimes contain equal inner contents.
42349  * This ignores pointers and is_owned flags and looks at the values in fields.
42350  * Two objects with NULL inner values will be considered "equal" here.
42351  */
42352 bool ExpiryTime_eq(const struct LDKExpiryTime *NONNULL_PTR a, const struct LDKExpiryTime *NONNULL_PTR b);
42353
42354 /**
42355  * Frees any resources used by the MinFinalCltvExpiryDelta, if is_owned is set and inner is non-NULL.
42356  */
42357 void MinFinalCltvExpiryDelta_free(struct LDKMinFinalCltvExpiryDelta this_obj);
42358
42359 uint64_t MinFinalCltvExpiryDelta_get_a(const struct LDKMinFinalCltvExpiryDelta *NONNULL_PTR this_ptr);
42360
42361 void MinFinalCltvExpiryDelta_set_a(struct LDKMinFinalCltvExpiryDelta *NONNULL_PTR this_ptr, uint64_t val);
42362
42363 /**
42364  * Constructs a new MinFinalCltvExpiryDelta given each field
42365  */
42366 MUST_USE_RES struct LDKMinFinalCltvExpiryDelta MinFinalCltvExpiryDelta_new(uint64_t a_arg);
42367
42368 /**
42369  * Creates a copy of the MinFinalCltvExpiryDelta
42370  */
42371 struct LDKMinFinalCltvExpiryDelta MinFinalCltvExpiryDelta_clone(const struct LDKMinFinalCltvExpiryDelta *NONNULL_PTR orig);
42372
42373 /**
42374  * Generates a non-cryptographic 64-bit hash of the MinFinalCltvExpiryDelta.
42375  */
42376 uint64_t MinFinalCltvExpiryDelta_hash(const struct LDKMinFinalCltvExpiryDelta *NONNULL_PTR o);
42377
42378 /**
42379  * Checks if two MinFinalCltvExpiryDeltas contain equal inner contents.
42380  * This ignores pointers and is_owned flags and looks at the values in fields.
42381  * Two objects with NULL inner values will be considered "equal" here.
42382  */
42383 bool MinFinalCltvExpiryDelta_eq(const struct LDKMinFinalCltvExpiryDelta *NONNULL_PTR a, const struct LDKMinFinalCltvExpiryDelta *NONNULL_PTR b);
42384
42385 /**
42386  * Frees any resources used by the Fallback
42387  */
42388 void Fallback_free(struct LDKFallback this_ptr);
42389
42390 /**
42391  * Creates a copy of the Fallback
42392  */
42393 struct LDKFallback Fallback_clone(const struct LDKFallback *NONNULL_PTR orig);
42394
42395 /**
42396  * Utility method to constructs a new SegWitProgram-variant Fallback
42397  */
42398 struct LDKFallback Fallback_seg_wit_program(struct LDKWitnessVersion version, struct LDKCVec_u8Z program);
42399
42400 /**
42401  * Utility method to constructs a new PubKeyHash-variant Fallback
42402  */
42403 struct LDKFallback Fallback_pub_key_hash(struct LDKTwentyBytes a);
42404
42405 /**
42406  * Utility method to constructs a new ScriptHash-variant Fallback
42407  */
42408 struct LDKFallback Fallback_script_hash(struct LDKTwentyBytes a);
42409
42410 /**
42411  * Generates a non-cryptographic 64-bit hash of the Fallback.
42412  */
42413 uint64_t Fallback_hash(const struct LDKFallback *NONNULL_PTR o);
42414
42415 /**
42416  * Checks if two Fallbacks contain equal inner contents.
42417  * This ignores pointers and is_owned flags and looks at the values in fields.
42418  */
42419 bool Fallback_eq(const struct LDKFallback *NONNULL_PTR a, const struct LDKFallback *NONNULL_PTR b);
42420
42421 /**
42422  * Frees any resources used by the Bolt11InvoiceSignature, if is_owned is set and inner is non-NULL.
42423  */
42424 void Bolt11InvoiceSignature_free(struct LDKBolt11InvoiceSignature this_obj);
42425
42426 /**
42427  * Creates a copy of the Bolt11InvoiceSignature
42428  */
42429 struct LDKBolt11InvoiceSignature Bolt11InvoiceSignature_clone(const struct LDKBolt11InvoiceSignature *NONNULL_PTR orig);
42430
42431 /**
42432  * Generates a non-cryptographic 64-bit hash of the Bolt11InvoiceSignature.
42433  */
42434 uint64_t Bolt11InvoiceSignature_hash(const struct LDKBolt11InvoiceSignature *NONNULL_PTR o);
42435
42436 /**
42437  * Checks if two Bolt11InvoiceSignatures contain equal inner contents.
42438  * This ignores pointers and is_owned flags and looks at the values in fields.
42439  * Two objects with NULL inner values will be considered "equal" here.
42440  */
42441 bool Bolt11InvoiceSignature_eq(const struct LDKBolt11InvoiceSignature *NONNULL_PTR a, const struct LDKBolt11InvoiceSignature *NONNULL_PTR b);
42442
42443 /**
42444  * Frees any resources used by the PrivateRoute, if is_owned is set and inner is non-NULL.
42445  */
42446 void PrivateRoute_free(struct LDKPrivateRoute this_obj);
42447
42448 /**
42449  * Creates a copy of the PrivateRoute
42450  */
42451 struct LDKPrivateRoute PrivateRoute_clone(const struct LDKPrivateRoute *NONNULL_PTR orig);
42452
42453 /**
42454  * Generates a non-cryptographic 64-bit hash of the PrivateRoute.
42455  */
42456 uint64_t PrivateRoute_hash(const struct LDKPrivateRoute *NONNULL_PTR o);
42457
42458 /**
42459  * Checks if two PrivateRoutes contain equal inner contents.
42460  * This ignores pointers and is_owned flags and looks at the values in fields.
42461  * Two objects with NULL inner values will be considered "equal" here.
42462  */
42463 bool PrivateRoute_eq(const struct LDKPrivateRoute *NONNULL_PTR a, const struct LDKPrivateRoute *NONNULL_PTR b);
42464
42465 /**
42466  * Disassembles the `SignedRawBolt11Invoice` into its three parts:
42467  *  1. raw invoice
42468  *  2. hash of the raw invoice
42469  *  3. signature
42470  */
42471 MUST_USE_RES struct LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ SignedRawBolt11Invoice_into_parts(struct LDKSignedRawBolt11Invoice this_arg);
42472
42473 /**
42474  * The [`RawBolt11Invoice`] which was signed.
42475  */
42476 MUST_USE_RES struct LDKRawBolt11Invoice SignedRawBolt11Invoice_raw_invoice(const struct LDKSignedRawBolt11Invoice *NONNULL_PTR this_arg);
42477
42478 /**
42479  * The hash of the [`RawBolt11Invoice`] that was signed.
42480  */
42481 MUST_USE_RES const uint8_t (*SignedRawBolt11Invoice_signable_hash(const struct LDKSignedRawBolt11Invoice *NONNULL_PTR this_arg))[32];
42482
42483 /**
42484  * Signature for the invoice.
42485  */
42486 MUST_USE_RES struct LDKBolt11InvoiceSignature SignedRawBolt11Invoice_signature(const struct LDKSignedRawBolt11Invoice *NONNULL_PTR this_arg);
42487
42488 /**
42489  * Recovers the public key used for signing the invoice from the recoverable signature.
42490  */
42491 MUST_USE_RES struct LDKCResult_PayeePubKeyErrorZ SignedRawBolt11Invoice_recover_payee_pub_key(const struct LDKSignedRawBolt11Invoice *NONNULL_PTR this_arg);
42492
42493 /**
42494  * Checks if the signature is valid for the included payee public key or if none exists if it's
42495  * valid for the recovered signature (which should always be true?).
42496  */
42497 MUST_USE_RES bool SignedRawBolt11Invoice_check_signature(const struct LDKSignedRawBolt11Invoice *NONNULL_PTR this_arg);
42498
42499 /**
42500  * Calculate the hash of the encoded `RawBolt11Invoice` which should be signed.
42501  */
42502 MUST_USE_RES struct LDKThirtyTwoBytes RawBolt11Invoice_signable_hash(const struct LDKRawBolt11Invoice *NONNULL_PTR this_arg);
42503
42504 /**
42505  *
42506  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
42507  */
42508 MUST_USE_RES struct LDKSha256 RawBolt11Invoice_payment_hash(const struct LDKRawBolt11Invoice *NONNULL_PTR this_arg);
42509
42510 /**
42511  *
42512  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
42513  */
42514 MUST_USE_RES struct LDKDescription RawBolt11Invoice_description(const struct LDKRawBolt11Invoice *NONNULL_PTR this_arg);
42515
42516 /**
42517  *
42518  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
42519  */
42520 MUST_USE_RES struct LDKPayeePubKey RawBolt11Invoice_payee_pub_key(const struct LDKRawBolt11Invoice *NONNULL_PTR this_arg);
42521
42522 /**
42523  *
42524  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
42525  */
42526 MUST_USE_RES struct LDKSha256 RawBolt11Invoice_description_hash(const struct LDKRawBolt11Invoice *NONNULL_PTR this_arg);
42527
42528 /**
42529  *
42530  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
42531  */
42532 MUST_USE_RES struct LDKExpiryTime RawBolt11Invoice_expiry_time(const struct LDKRawBolt11Invoice *NONNULL_PTR this_arg);
42533
42534 /**
42535  *
42536  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
42537  */
42538 MUST_USE_RES struct LDKMinFinalCltvExpiryDelta RawBolt11Invoice_min_final_cltv_expiry_delta(const struct LDKRawBolt11Invoice *NONNULL_PTR this_arg);
42539
42540 MUST_USE_RES struct LDKCOption_PaymentSecretZ RawBolt11Invoice_payment_secret(const struct LDKRawBolt11Invoice *NONNULL_PTR this_arg);
42541
42542 MUST_USE_RES struct LDKCOption_CVec_u8ZZ RawBolt11Invoice_payment_metadata(const struct LDKRawBolt11Invoice *NONNULL_PTR this_arg);
42543
42544 /**
42545  *
42546  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
42547  */
42548 MUST_USE_RES struct LDKBolt11InvoiceFeatures RawBolt11Invoice_features(const struct LDKRawBolt11Invoice *NONNULL_PTR this_arg);
42549
42550 MUST_USE_RES struct LDKCVec_PrivateRouteZ RawBolt11Invoice_private_routes(const struct LDKRawBolt11Invoice *NONNULL_PTR this_arg);
42551
42552 MUST_USE_RES struct LDKCOption_u64Z RawBolt11Invoice_amount_pico_btc(const struct LDKRawBolt11Invoice *NONNULL_PTR this_arg);
42553
42554 MUST_USE_RES enum LDKCurrency RawBolt11Invoice_currency(const struct LDKRawBolt11Invoice *NONNULL_PTR this_arg);
42555
42556 /**
42557  * Creates a `PositiveTimestamp` from a Unix timestamp in the range `0..=MAX_TIMESTAMP`.
42558  *
42559  * Otherwise, returns a [`CreationError::TimestampOutOfBounds`].
42560  */
42561 MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp_from_unix_timestamp(uint64_t unix_seconds);
42562
42563 /**
42564  * Creates a `PositiveTimestamp` from a [`SystemTime`] with a corresponding Unix timestamp in
42565  * the range `0..=MAX_TIMESTAMP`.
42566  *
42567  * Note that the subsecond part is dropped as it is not representable in BOLT 11 invoices.
42568  *
42569  * Otherwise, returns a [`CreationError::TimestampOutOfBounds`].
42570  */
42571 MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp_from_system_time(uint64_t time);
42572
42573 /**
42574  * Creates a `PositiveTimestamp` from a [`Duration`] since the Unix epoch in the range
42575  * `0..=MAX_TIMESTAMP`.
42576  *
42577  * Note that the subsecond part is dropped as it is not representable in BOLT 11 invoices.
42578  *
42579  * Otherwise, returns a [`CreationError::TimestampOutOfBounds`].
42580  */
42581 MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp_from_duration_since_epoch(uint64_t duration);
42582
42583 /**
42584  * Returns the Unix timestamp representing the stored time
42585  */
42586 MUST_USE_RES uint64_t PositiveTimestamp_as_unix_timestamp(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg);
42587
42588 /**
42589  * Returns the duration of the stored time since the Unix epoch
42590  */
42591 MUST_USE_RES uint64_t PositiveTimestamp_as_duration_since_epoch(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg);
42592
42593 /**
42594  * Returns the [`SystemTime`] representing the stored time
42595  */
42596 MUST_USE_RES uint64_t PositiveTimestamp_as_time(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg);
42597
42598 /**
42599  * The hash of the [`RawBolt11Invoice`] that was signed.
42600  */
42601 MUST_USE_RES struct LDKThirtyTwoBytes Bolt11Invoice_signable_hash(const struct LDKBolt11Invoice *NONNULL_PTR this_arg);
42602
42603 /**
42604  * Transform the `Bolt11Invoice` into its unchecked version.
42605  */
42606 MUST_USE_RES struct LDKSignedRawBolt11Invoice Bolt11Invoice_into_signed_raw(struct LDKBolt11Invoice this_arg);
42607
42608 /**
42609  * Check that the invoice is signed correctly and that key recovery works
42610  */
42611 MUST_USE_RES struct LDKCResult_NoneBolt11SemanticErrorZ Bolt11Invoice_check_signature(const struct LDKBolt11Invoice *NONNULL_PTR this_arg);
42612
42613 /**
42614  * Constructs a `Bolt11Invoice` from a [`SignedRawBolt11Invoice`] by checking all its invariants.
42615  * ```
42616  * use lightning_invoice::*;
42617  *
42618  * let invoice = \"lnbc100p1psj9jhxdqud3jxktt5w46x7unfv9kz6mn0v3jsnp4q0d3p2sfluzdx45tqcs\\
42619  * h2pu5qc7lgq0xs578ngs6s0s68ua4h7cvspp5q6rmq35js88zp5dvwrv9m459tnk2zunwj5jalqtyxqulh0l\\
42620  * 5gflssp5nf55ny5gcrfl30xuhzj3nphgj27rstekmr9fw3ny5989s300gyus9qyysgqcqpcrzjqw2sxwe993\\
42621  * h5pcm4dxzpvttgza8zhkqxpgffcrf5v25nwpr3cmfg7z54kuqq8rgqqqqqqqq2qqqqq9qq9qrzjqd0ylaqcl\\
42622  * j9424x9m8h2vcukcgnm6s56xfgu3j78zyqzhgs4hlpzvznlugqq9vsqqqqqqqlgqqqqqeqq9qrzjqwldmj9d\\
42623  * ha74df76zhx6l9we0vjdquygcdt3kssupehe64g6yyp5yz5rhuqqwccqqyqqqqlgqqqqjcqq9qrzjqf9e58a\\
42624  * guqr0rcun0ajlvmzq3ek63cw2w282gv3z5uupmuwvgjtq2z55qsqqg6qqqyqqqrtnqqqzq3cqygrzjqvphms\\
42625  * ywntrrhqjcraumvc4y6r8v4z5v593trte429v4hredj7ms5z52usqq9ngqqqqqqqlgqqqqqqgq9qrzjq2v0v\\
42626  * p62g49p7569ev48cmulecsxe59lvaw3wlxm7r982zxa9zzj7z5l0cqqxusqqyqqqqlgqqqqqzsqygarl9fh3\\
42627  * 8s0gyuxjjgux34w75dnc6xp2l35j7es3jd4ugt3lu0xzre26yg5m7ke54n2d5sym4xcmxtl8238xxvw5h5h5\\
42628  * j5r6drg6k6zcqj0fcwg\";
42629  *
42630  * let signed = invoice.parse::<SignedRawBolt11Invoice>().unwrap();
42631  *
42632  * assert!(Bolt11Invoice::from_signed(signed).is_ok());
42633  * ```
42634  */
42635 MUST_USE_RES struct LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ Bolt11Invoice_from_signed(struct LDKSignedRawBolt11Invoice signed_invoice);
42636
42637 /**
42638  * Returns the `Bolt11Invoice`'s timestamp (should equal its creation time)
42639  */
42640 MUST_USE_RES uint64_t Bolt11Invoice_timestamp(const struct LDKBolt11Invoice *NONNULL_PTR this_arg);
42641
42642 /**
42643  * Returns the `Bolt11Invoice`'s timestamp as a duration since the Unix epoch
42644  */
42645 MUST_USE_RES uint64_t Bolt11Invoice_duration_since_epoch(const struct LDKBolt11Invoice *NONNULL_PTR this_arg);
42646
42647 /**
42648  * Returns the hash to which we will receive the preimage on completion of the payment
42649  */
42650 MUST_USE_RES const uint8_t (*Bolt11Invoice_payment_hash(const struct LDKBolt11Invoice *NONNULL_PTR this_arg))[32];
42651
42652 /**
42653  * Get the payee's public key if one was included in the invoice
42654  *
42655  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
42656  */
42657 MUST_USE_RES struct LDKPublicKey Bolt11Invoice_payee_pub_key(const struct LDKBolt11Invoice *NONNULL_PTR this_arg);
42658
42659 /**
42660  * Get the payment secret if one was included in the invoice
42661  */
42662 MUST_USE_RES const uint8_t (*Bolt11Invoice_payment_secret(const struct LDKBolt11Invoice *NONNULL_PTR this_arg))[32];
42663
42664 /**
42665  * Get the payment metadata blob if one was included in the invoice
42666  */
42667 MUST_USE_RES struct LDKCOption_CVec_u8ZZ Bolt11Invoice_payment_metadata(const struct LDKBolt11Invoice *NONNULL_PTR this_arg);
42668
42669 /**
42670  * Get the invoice features if they were included in the invoice
42671  *
42672  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
42673  */
42674 MUST_USE_RES struct LDKBolt11InvoiceFeatures Bolt11Invoice_features(const struct LDKBolt11Invoice *NONNULL_PTR this_arg);
42675
42676 /**
42677  * Recover the payee's public key (only to be used if none was included in the invoice)
42678  */
42679 MUST_USE_RES struct LDKPublicKey Bolt11Invoice_recover_payee_pub_key(const struct LDKBolt11Invoice *NONNULL_PTR this_arg);
42680
42681 /**
42682  * Returns the Duration since the Unix epoch at which the invoice expires.
42683  * Returning None if overflow occurred.
42684  */
42685 MUST_USE_RES struct LDKCOption_DurationZ Bolt11Invoice_expires_at(const struct LDKBolt11Invoice *NONNULL_PTR this_arg);
42686
42687 /**
42688  * Returns the invoice's expiry time, if present, otherwise [`DEFAULT_EXPIRY_TIME`].
42689  */
42690 MUST_USE_RES uint64_t Bolt11Invoice_expiry_time(const struct LDKBolt11Invoice *NONNULL_PTR this_arg);
42691
42692 /**
42693  * Returns whether the invoice has expired.
42694  */
42695 MUST_USE_RES bool Bolt11Invoice_is_expired(const struct LDKBolt11Invoice *NONNULL_PTR this_arg);
42696
42697 /**
42698  * Returns the Duration remaining until the invoice expires.
42699  */
42700 MUST_USE_RES uint64_t Bolt11Invoice_duration_until_expiry(const struct LDKBolt11Invoice *NONNULL_PTR this_arg);
42701
42702 /**
42703  * Returns the Duration remaining until the invoice expires given the current time.
42704  * `time` is the timestamp as a duration since the Unix epoch.
42705  */
42706 MUST_USE_RES uint64_t Bolt11Invoice_expiration_remaining_from_epoch(const struct LDKBolt11Invoice *NONNULL_PTR this_arg, uint64_t time);
42707
42708 /**
42709  * Returns whether the expiry time would pass at the given point in time.
42710  * `at_time` is the timestamp as a duration since the Unix epoch.
42711  */
42712 MUST_USE_RES bool Bolt11Invoice_would_expire(const struct LDKBolt11Invoice *NONNULL_PTR this_arg, uint64_t at_time);
42713
42714 /**
42715  * Returns the invoice's `min_final_cltv_expiry_delta` time, if present, otherwise
42716  * [`DEFAULT_MIN_FINAL_CLTV_EXPIRY_DELTA`].
42717  */
42718 MUST_USE_RES uint64_t Bolt11Invoice_min_final_cltv_expiry_delta(const struct LDKBolt11Invoice *NONNULL_PTR this_arg);
42719
42720 /**
42721  * Returns a list of all fallback addresses as [`Address`]es
42722  */
42723 MUST_USE_RES struct LDKCVec_AddressZ Bolt11Invoice_fallback_addresses(const struct LDKBolt11Invoice *NONNULL_PTR this_arg);
42724
42725 /**
42726  * Returns a list of all routes included in the invoice
42727  */
42728 MUST_USE_RES struct LDKCVec_PrivateRouteZ Bolt11Invoice_private_routes(const struct LDKBolt11Invoice *NONNULL_PTR this_arg);
42729
42730 /**
42731  * Returns a list of all routes included in the invoice as the underlying hints
42732  */
42733 MUST_USE_RES struct LDKCVec_RouteHintZ Bolt11Invoice_route_hints(const struct LDKBolt11Invoice *NONNULL_PTR this_arg);
42734
42735 /**
42736  * Returns the currency for which the invoice was issued
42737  */
42738 MUST_USE_RES enum LDKCurrency Bolt11Invoice_currency(const struct LDKBolt11Invoice *NONNULL_PTR this_arg);
42739
42740 /**
42741  * Returns the amount if specified in the invoice as millisatoshis.
42742  */
42743 MUST_USE_RES struct LDKCOption_u64Z Bolt11Invoice_amount_milli_satoshis(const struct LDKBolt11Invoice *NONNULL_PTR this_arg);
42744
42745 /**
42746  * Creates a new `Description` if `description` is at most 1023 __bytes__ long,
42747  * returns [`CreationError::DescriptionTooLong`] otherwise
42748  *
42749  * Please note that single characters may use more than one byte due to UTF8 encoding.
42750  */
42751 MUST_USE_RES struct LDKCResult_DescriptionCreationErrorZ Description_new(struct LDKStr description);
42752
42753 /**
42754  * Returns the underlying description [`String`]
42755  */
42756 MUST_USE_RES struct LDKStr Description_into_inner(struct LDKDescription this_arg);
42757
42758 /**
42759  * Construct an `ExpiryTime` from seconds.
42760  */
42761 MUST_USE_RES struct LDKExpiryTime ExpiryTime_from_seconds(uint64_t seconds);
42762
42763 /**
42764  * Construct an `ExpiryTime` from a [`Duration`], dropping the sub-second part.
42765  */
42766 MUST_USE_RES struct LDKExpiryTime ExpiryTime_from_duration(uint64_t duration);
42767
42768 /**
42769  * Returns the expiry time in seconds
42770  */
42771 MUST_USE_RES uint64_t ExpiryTime_as_seconds(const struct LDKExpiryTime *NONNULL_PTR this_arg);
42772
42773 /**
42774  * Returns a reference to the underlying [`Duration`] (=expiry time)
42775  */
42776 MUST_USE_RES uint64_t ExpiryTime_as_duration(const struct LDKExpiryTime *NONNULL_PTR this_arg);
42777
42778 /**
42779  * Creates a new (partial) route from a list of hops
42780  */
42781 MUST_USE_RES struct LDKCResult_PrivateRouteCreationErrorZ PrivateRoute_new(struct LDKRouteHint hops);
42782
42783 /**
42784  * Returns the underlying list of hops
42785  */
42786 MUST_USE_RES struct LDKRouteHint PrivateRoute_into_inner(struct LDKPrivateRoute this_arg);
42787
42788 /**
42789  * Creates a copy of the CreationError
42790  */
42791 enum LDKCreationError CreationError_clone(const enum LDKCreationError *NONNULL_PTR orig);
42792
42793 /**
42794  * Utility method to constructs a new DescriptionTooLong-variant CreationError
42795  */
42796 enum LDKCreationError CreationError_description_too_long(void);
42797
42798 /**
42799  * Utility method to constructs a new RouteTooLong-variant CreationError
42800  */
42801 enum LDKCreationError CreationError_route_too_long(void);
42802
42803 /**
42804  * Utility method to constructs a new TimestampOutOfBounds-variant CreationError
42805  */
42806 enum LDKCreationError CreationError_timestamp_out_of_bounds(void);
42807
42808 /**
42809  * Utility method to constructs a new InvalidAmount-variant CreationError
42810  */
42811 enum LDKCreationError CreationError_invalid_amount(void);
42812
42813 /**
42814  * Utility method to constructs a new MissingRouteHints-variant CreationError
42815  */
42816 enum LDKCreationError CreationError_missing_route_hints(void);
42817
42818 /**
42819  * Utility method to constructs a new MinFinalCltvExpiryDeltaTooShort-variant CreationError
42820  */
42821 enum LDKCreationError CreationError_min_final_cltv_expiry_delta_too_short(void);
42822
42823 /**
42824  * Checks if two CreationErrors contain equal inner contents.
42825  * This ignores pointers and is_owned flags and looks at the values in fields.
42826  */
42827 bool CreationError_eq(const enum LDKCreationError *NONNULL_PTR a, const enum LDKCreationError *NONNULL_PTR b);
42828
42829 /**
42830  * Get the string representation of a CreationError object
42831  */
42832 struct LDKStr CreationError_to_str(const enum LDKCreationError *NONNULL_PTR o);
42833
42834 /**
42835  * Creates a copy of the Bolt11SemanticError
42836  */
42837 enum LDKBolt11SemanticError Bolt11SemanticError_clone(const enum LDKBolt11SemanticError *NONNULL_PTR orig);
42838
42839 /**
42840  * Utility method to constructs a new NoPaymentHash-variant Bolt11SemanticError
42841  */
42842 enum LDKBolt11SemanticError Bolt11SemanticError_no_payment_hash(void);
42843
42844 /**
42845  * Utility method to constructs a new MultiplePaymentHashes-variant Bolt11SemanticError
42846  */
42847 enum LDKBolt11SemanticError Bolt11SemanticError_multiple_payment_hashes(void);
42848
42849 /**
42850  * Utility method to constructs a new NoDescription-variant Bolt11SemanticError
42851  */
42852 enum LDKBolt11SemanticError Bolt11SemanticError_no_description(void);
42853
42854 /**
42855  * Utility method to constructs a new MultipleDescriptions-variant Bolt11SemanticError
42856  */
42857 enum LDKBolt11SemanticError Bolt11SemanticError_multiple_descriptions(void);
42858
42859 /**
42860  * Utility method to constructs a new NoPaymentSecret-variant Bolt11SemanticError
42861  */
42862 enum LDKBolt11SemanticError Bolt11SemanticError_no_payment_secret(void);
42863
42864 /**
42865  * Utility method to constructs a new MultiplePaymentSecrets-variant Bolt11SemanticError
42866  */
42867 enum LDKBolt11SemanticError Bolt11SemanticError_multiple_payment_secrets(void);
42868
42869 /**
42870  * Utility method to constructs a new InvalidFeatures-variant Bolt11SemanticError
42871  */
42872 enum LDKBolt11SemanticError Bolt11SemanticError_invalid_features(void);
42873
42874 /**
42875  * Utility method to constructs a new InvalidRecoveryId-variant Bolt11SemanticError
42876  */
42877 enum LDKBolt11SemanticError Bolt11SemanticError_invalid_recovery_id(void);
42878
42879 /**
42880  * Utility method to constructs a new InvalidSignature-variant Bolt11SemanticError
42881  */
42882 enum LDKBolt11SemanticError Bolt11SemanticError_invalid_signature(void);
42883
42884 /**
42885  * Utility method to constructs a new ImpreciseAmount-variant Bolt11SemanticError
42886  */
42887 enum LDKBolt11SemanticError Bolt11SemanticError_imprecise_amount(void);
42888
42889 /**
42890  * Checks if two Bolt11SemanticErrors contain equal inner contents.
42891  * This ignores pointers and is_owned flags and looks at the values in fields.
42892  */
42893 bool Bolt11SemanticError_eq(const enum LDKBolt11SemanticError *NONNULL_PTR a, const enum LDKBolt11SemanticError *NONNULL_PTR b);
42894
42895 /**
42896  * Get the string representation of a Bolt11SemanticError object
42897  */
42898 struct LDKStr Bolt11SemanticError_to_str(const enum LDKBolt11SemanticError *NONNULL_PTR o);
42899
42900 /**
42901  * Frees any resources used by the SignOrCreationError
42902  */
42903 void SignOrCreationError_free(struct LDKSignOrCreationError this_ptr);
42904
42905 /**
42906  * Creates a copy of the SignOrCreationError
42907  */
42908 struct LDKSignOrCreationError SignOrCreationError_clone(const struct LDKSignOrCreationError *NONNULL_PTR orig);
42909
42910 /**
42911  * Utility method to constructs a new SignError-variant SignOrCreationError
42912  */
42913 struct LDKSignOrCreationError SignOrCreationError_sign_error(void);
42914
42915 /**
42916  * Utility method to constructs a new CreationError-variant SignOrCreationError
42917  */
42918 struct LDKSignOrCreationError SignOrCreationError_creation_error(enum LDKCreationError a);
42919
42920 /**
42921  * Checks if two SignOrCreationErrors contain equal inner contents.
42922  * This ignores pointers and is_owned flags and looks at the values in fields.
42923  */
42924 bool SignOrCreationError_eq(const struct LDKSignOrCreationError *NONNULL_PTR a, const struct LDKSignOrCreationError *NONNULL_PTR b);
42925
42926 /**
42927  * Get the string representation of a SignOrCreationError object
42928  */
42929 struct LDKStr SignOrCreationError_to_str(const struct LDKSignOrCreationError *NONNULL_PTR o);
42930
42931 /**
42932  * Pays the given [`Bolt11Invoice`], retrying if needed based on [`Retry`].
42933  *
42934  * [`Bolt11Invoice::payment_hash`] is used as the [`PaymentId`], which ensures idempotency as long
42935  * as the payment is still pending. If the payment succeeds, you must ensure that a second payment
42936  * with the same [`PaymentHash`] is never sent.
42937  *
42938  * If you wish to use a different payment idempotency token, see [`pay_invoice_with_id`].
42939  */
42940 struct LDKCResult_PaymentIdPaymentErrorZ pay_invoice(const struct LDKBolt11Invoice *NONNULL_PTR invoice, struct LDKRetry retry_strategy, const struct LDKChannelManager *NONNULL_PTR channelmanager);
42941
42942 /**
42943  * Pays the given [`Bolt11Invoice`] with a custom idempotency key, retrying if needed based on
42944  * [`Retry`].
42945  *
42946  * Note that idempotency is only guaranteed as long as the payment is still pending. Once the
42947  * payment completes or fails, no idempotency guarantees are made.
42948  *
42949  * You should ensure that the [`Bolt11Invoice::payment_hash`] is unique and the same
42950  * [`PaymentHash`] has never been paid before.
42951  *
42952  * See [`pay_invoice`] for a variant which uses the [`PaymentHash`] for the idempotency token.
42953  */
42954 struct LDKCResult_NonePaymentErrorZ pay_invoice_with_id(const struct LDKBolt11Invoice *NONNULL_PTR invoice, struct LDKThirtyTwoBytes payment_id, struct LDKRetry retry_strategy, const struct LDKChannelManager *NONNULL_PTR channelmanager);
42955
42956 /**
42957  * Pays the given zero-value [`Bolt11Invoice`] using the given amount, retrying if needed based on
42958  * [`Retry`].
42959  *
42960  * [`Bolt11Invoice::payment_hash`] is used as the [`PaymentId`], which ensures idempotency as long
42961  * as the payment is still pending. If the payment succeeds, you must ensure that a second payment
42962  * with the same [`PaymentHash`] is never sent.
42963  *
42964  * If you wish to use a different payment idempotency token, see
42965  * [`pay_zero_value_invoice_with_id`].
42966  */
42967 struct LDKCResult_PaymentIdPaymentErrorZ pay_zero_value_invoice(const struct LDKBolt11Invoice *NONNULL_PTR invoice, uint64_t amount_msats, struct LDKRetry retry_strategy, const struct LDKChannelManager *NONNULL_PTR channelmanager);
42968
42969 /**
42970  * Pays the given zero-value [`Bolt11Invoice`] using the given amount and custom idempotency key,
42971  * retrying if needed based on [`Retry`].
42972  *
42973  * Note that idempotency is only guaranteed as long as the payment is still pending. Once the
42974  * payment completes or fails, no idempotency guarantees are made.
42975  *
42976  * You should ensure that the [`Bolt11Invoice::payment_hash`] is unique and the same
42977  * [`PaymentHash`] has never been paid before.
42978  *
42979  * See [`pay_zero_value_invoice`] for a variant which uses the [`PaymentHash`] for the
42980  * idempotency token.
42981  */
42982 struct LDKCResult_NonePaymentErrorZ pay_zero_value_invoice_with_id(const struct LDKBolt11Invoice *NONNULL_PTR invoice, uint64_t amount_msats, struct LDKThirtyTwoBytes payment_id, struct LDKRetry retry_strategy, const struct LDKChannelManager *NONNULL_PTR channelmanager);
42983
42984 /**
42985  * Frees any resources used by the PaymentError
42986  */
42987 void PaymentError_free(struct LDKPaymentError this_ptr);
42988
42989 /**
42990  * Creates a copy of the PaymentError
42991  */
42992 struct LDKPaymentError PaymentError_clone(const struct LDKPaymentError *NONNULL_PTR orig);
42993
42994 /**
42995  * Utility method to constructs a new Invoice-variant PaymentError
42996  */
42997 struct LDKPaymentError PaymentError_invoice(struct LDKStr a);
42998
42999 /**
43000  * Utility method to constructs a new Sending-variant PaymentError
43001  */
43002 struct LDKPaymentError PaymentError_sending(enum LDKRetryableSendFailure a);
43003
43004 /**
43005  * Checks if two PaymentErrors contain equal inner contents.
43006  * This ignores pointers and is_owned flags and looks at the values in fields.
43007  */
43008 bool PaymentError_eq(const struct LDKPaymentError *NONNULL_PTR a, const struct LDKPaymentError *NONNULL_PTR b);
43009
43010 /**
43011  * Utility to create an invoice that can be paid to one of multiple nodes, or a \"phantom invoice.\"
43012  * See [`PhantomKeysManager`] for more information on phantom node payments.
43013  *
43014  * `phantom_route_hints` parameter:
43015  * * Contains channel info for all nodes participating in the phantom invoice
43016  * * Entries are retrieved from a call to [`ChannelManager::get_phantom_route_hints`] on each
43017  *   participating node
43018  * * It is fine to cache `phantom_route_hints` and reuse it across invoices, as long as the data is
43019  *   updated when a channel becomes disabled or closes
43020  * * Note that if too many channels are included in [`PhantomRouteHints::channels`], the invoice
43021  *   may be too long for QR code scanning. To fix this, `PhantomRouteHints::channels` may be pared
43022  *   down
43023  *
43024  * `payment_hash` can be specified if you have a specific need for a custom payment hash (see the difference
43025  * between [`ChannelManager::create_inbound_payment`] and [`ChannelManager::create_inbound_payment_for_hash`]).
43026  * If `None` is provided for `payment_hash`, then one will be created.
43027  *
43028  * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
43029  * in excess of the current time.
43030  *
43031  * `duration_since_epoch` is the current time since epoch in seconds.
43032  *
43033  * You can specify a custom `min_final_cltv_expiry_delta`, or let LDK default it to
43034  * [`MIN_FINAL_CLTV_EXPIRY_DELTA`]. The provided expiry must be at least [`MIN_FINAL_CLTV_EXPIRY_DELTA`] - 3.
43035  * Note that LDK will add a buffer of 3 blocks to the delta to allow for up to a few new block
43036  * confirmations during routing.
43037  *
43038  * Note that the provided `keys_manager`'s `NodeSigner` implementation must support phantom
43039  * invoices in its `sign_invoice` implementation ([`PhantomKeysManager`] satisfies this
43040  * requirement).
43041  *
43042  * [`PhantomKeysManager`]: lightning::sign::PhantomKeysManager
43043  * [`ChannelManager::get_phantom_route_hints`]: lightning::ln::channelmanager::ChannelManager::get_phantom_route_hints
43044  * [`ChannelManager::create_inbound_payment`]: lightning::ln::channelmanager::ChannelManager::create_inbound_payment
43045  * [`ChannelManager::create_inbound_payment_for_hash`]: lightning::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
43046  * [`PhantomRouteHints::channels`]: lightning::ln::channelmanager::PhantomRouteHints::channels
43047  * [`MIN_FINAL_CLTV_EXPIRY_DETLA`]: lightning::ln::channelmanager::MIN_FINAL_CLTV_EXPIRY_DELTA
43048  *
43049  * This can be used in a `no_std` environment, where [`std::time::SystemTime`] is not
43050  * available and the current time is supplied by the caller.
43051  */
43052 struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ create_phantom_invoice(struct LDKCOption_u64Z amt_msat, struct LDKCOption_PaymentHashZ 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);
43053
43054 /**
43055  * Utility to create an invoice that can be paid to one of multiple nodes, or a \"phantom invoice.\"
43056  * See [`PhantomKeysManager`] for more information on phantom node payments.
43057  *
43058  * `phantom_route_hints` parameter:
43059  * * Contains channel info for all nodes participating in the phantom invoice
43060  * * Entries are retrieved from a call to [`ChannelManager::get_phantom_route_hints`] on each
43061  *   participating node
43062  * * It is fine to cache `phantom_route_hints` and reuse it across invoices, as long as the data is
43063  *   updated when a channel becomes disabled or closes
43064  * * Note that the route hints generated from `phantom_route_hints` will be limited to a maximum
43065  *   of 3 hints to ensure that the invoice can be scanned in a QR code. These hints are selected
43066  *   in the order that the nodes in `PhantomRouteHints` are specified, selecting one hint per node
43067  *   until the maximum is hit. Callers may provide as many `PhantomRouteHints::channels` as
43068  *   desired, but note that some nodes will be trimmed if more than 3 nodes are provided.
43069  *
43070  * `description_hash` is a SHA-256 hash of the description text
43071  *
43072  * `payment_hash` can be specified if you have a specific need for a custom payment hash (see the difference
43073  * between [`ChannelManager::create_inbound_payment`] and [`ChannelManager::create_inbound_payment_for_hash`]).
43074  * If `None` is provided for `payment_hash`, then one will be created.
43075  *
43076  * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
43077  * in excess of the current time.
43078  *
43079  * `duration_since_epoch` is the current time since epoch in seconds.
43080  *
43081  * Note that the provided `keys_manager`'s `NodeSigner` implementation must support phantom
43082  * invoices in its `sign_invoice` implementation ([`PhantomKeysManager`] satisfies this
43083  * requirement).
43084  *
43085  * [`PhantomKeysManager`]: lightning::sign::PhantomKeysManager
43086  * [`ChannelManager::get_phantom_route_hints`]: lightning::ln::channelmanager::ChannelManager::get_phantom_route_hints
43087  * [`ChannelManager::create_inbound_payment`]: lightning::ln::channelmanager::ChannelManager::create_inbound_payment
43088  * [`ChannelManager::create_inbound_payment_for_hash`]: lightning::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
43089  * [`PhantomRouteHints::channels`]: lightning::ln::channelmanager::PhantomRouteHints::channels
43090  *
43091  * This can be used in a `no_std` environment, where [`std::time::SystemTime`] is not
43092  * available and the current time is supplied by the caller.
43093  */
43094 struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ create_phantom_invoice_with_description_hash(struct LDKCOption_u64Z amt_msat, struct LDKCOption_PaymentHashZ 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);
43095
43096 /**
43097  * Utility to construct an invoice. Generally, unless you want to do something like a custom
43098  * cltv_expiry, this is what you should be using to create an invoice. The reason being, this
43099  * method stores the invoice's payment secret and preimage in `ChannelManager`, so (a) the user
43100  * doesn't have to store preimage/payment secret information and (b) `ChannelManager` can verify
43101  * that the payment secret is valid when the invoice is paid.
43102  *
43103  * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
43104  * in excess of the current time.
43105  *
43106  * You can specify a custom `min_final_cltv_expiry_delta`, or let LDK default it to
43107  * [`MIN_FINAL_CLTV_EXPIRY_DELTA`]. The provided expiry must be at least [`MIN_FINAL_CLTV_EXPIRY_DELTA`].
43108  * Note that LDK will add a buffer of 3 blocks to the delta to allow for up to a few new block
43109  * confirmations during routing.
43110  *
43111  * [`MIN_FINAL_CLTV_EXPIRY_DETLA`]: lightning::ln::channelmanager::MIN_FINAL_CLTV_EXPIRY_DELTA
43112  */
43113 struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ 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);
43114
43115 /**
43116  * Utility to construct an invoice. Generally, unless you want to do something like a custom
43117  * cltv_expiry, this is what you should be using to create an invoice. The reason being, this
43118  * method stores the invoice's payment secret and preimage in `ChannelManager`, so (a) the user
43119  * doesn't have to store preimage/payment secret information and (b) `ChannelManager` can verify
43120  * that the payment secret is valid when the invoice is paid.
43121  * Use this variant if you want to pass the `description_hash` to the invoice.
43122  *
43123  * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
43124  * in excess of the current time.
43125  *
43126  * You can specify a custom `min_final_cltv_expiry_delta`, or let LDK default it to
43127  * [`MIN_FINAL_CLTV_EXPIRY_DELTA`]. The provided expiry must be at least [`MIN_FINAL_CLTV_EXPIRY_DELTA`].
43128  * Note that LDK will add a buffer of 3 blocks to the delta to allow for up to a few new block
43129  * confirmations during routing.
43130  *
43131  * [`MIN_FINAL_CLTV_EXPIRY_DETLA`]: lightning::ln::channelmanager::MIN_FINAL_CLTV_EXPIRY_DELTA
43132  */
43133 struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ 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);
43134
43135 /**
43136  * See [`create_invoice_from_channelmanager_with_description_hash`]
43137  * This version can be used in a `no_std` environment, where [`std::time::SystemTime`] is not
43138  * available and the current time is supplied by the caller.
43139  */
43140 struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ 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);
43141
43142 /**
43143  * See [`create_invoice_from_channelmanager`]
43144  * This version can be used in a `no_std` environment, where [`std::time::SystemTime`] is not
43145  * available and the current time is supplied by the caller.
43146  */
43147 struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ 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);
43148
43149 /**
43150  * See [`create_invoice_from_channelmanager_and_duration_since_epoch`]
43151  * This version allows for providing a custom [`PaymentHash`] for the invoice.
43152  * This may be useful if you're building an on-chain swap or involving another protocol where
43153  * the payment hash is also involved outside the scope of lightning.
43154  */
43155 struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ 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);
43156
43157 /**
43158  * Read a SiPrefix object from a string
43159  */
43160 struct LDKCResult_SiPrefixBolt11ParseErrorZ SiPrefix_from_str(struct LDKStr s);
43161
43162 /**
43163  * Read a Bolt11Invoice object from a string
43164  */
43165 struct LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ Bolt11Invoice_from_str(struct LDKStr s);
43166
43167 /**
43168  * Read a SignedRawBolt11Invoice object from a string
43169  */
43170 struct LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ SignedRawBolt11Invoice_from_str(struct LDKStr s);
43171
43172 /**
43173  * Get the string representation of a Bolt11ParseError object
43174  */
43175 struct LDKStr Bolt11ParseError_to_str(const struct LDKBolt11ParseError *NONNULL_PTR o);
43176
43177 /**
43178  * Get the string representation of a ParseOrSemanticError object
43179  */
43180 struct LDKStr ParseOrSemanticError_to_str(const struct LDKParseOrSemanticError *NONNULL_PTR o);
43181
43182 /**
43183  * Get the string representation of a Bolt11Invoice object
43184  */
43185 struct LDKStr Bolt11Invoice_to_str(const struct LDKBolt11Invoice *NONNULL_PTR o);
43186
43187 /**
43188  * Get the string representation of a SignedRawBolt11Invoice object
43189  */
43190 struct LDKStr SignedRawBolt11Invoice_to_str(const struct LDKSignedRawBolt11Invoice *NONNULL_PTR o);
43191
43192 /**
43193  * Get the string representation of a Currency object
43194  */
43195 struct LDKStr Currency_to_str(const enum LDKCurrency *NONNULL_PTR o);
43196
43197 /**
43198  * Get the string representation of a SiPrefix object
43199  */
43200 struct LDKStr SiPrefix_to_str(const enum LDKSiPrefix *NONNULL_PTR o);
43201
43202 /**
43203  * Frees any resources used by the RapidGossipSync, if is_owned is set and inner is non-NULL.
43204  */
43205 void RapidGossipSync_free(struct LDKRapidGossipSync this_obj);
43206
43207 /**
43208  * Instantiate a new [`RapidGossipSync`] instance.
43209  */
43210 MUST_USE_RES struct LDKRapidGossipSync RapidGossipSync_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKLogger logger);
43211
43212 /**
43213  * Sync gossip data from a file.
43214  * Returns the last sync timestamp to be used the next time rapid sync data is queried.
43215  *
43216  * `network_graph`: The network graph to apply the updates to
43217  *
43218  * `sync_path`: Path to the file where the gossip update data is located
43219  *
43220  */
43221 MUST_USE_RES struct LDKCResult_u32GraphSyncErrorZ RapidGossipSync_sync_network_graph_with_file_path(const struct LDKRapidGossipSync *NONNULL_PTR this_arg, struct LDKStr sync_path);
43222
43223 /**
43224  * Update network graph from binary data.
43225  * Returns the last sync timestamp to be used the next time rapid sync data is queried.
43226  *
43227  * `update_data`: `&[u8]` binary stream that comprises the update data
43228  */
43229 MUST_USE_RES struct LDKCResult_u32GraphSyncErrorZ RapidGossipSync_update_network_graph(const struct LDKRapidGossipSync *NONNULL_PTR this_arg, struct LDKu8slice update_data);
43230
43231 /**
43232  * Update network graph from binary data.
43233  * Returns the last sync timestamp to be used the next time rapid sync data is queried.
43234  *
43235  * `update_data`: `&[u8]` binary stream that comprises the update data
43236  * `current_time_unix`: `Option<u64>` optional current timestamp to verify data age
43237  */
43238 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);
43239
43240 /**
43241  * Returns whether a rapid gossip sync has completed at least once.
43242  */
43243 MUST_USE_RES bool RapidGossipSync_is_initial_sync_complete(const struct LDKRapidGossipSync *NONNULL_PTR this_arg);
43244
43245 /**
43246  * Frees any resources used by the GraphSyncError
43247  */
43248 void GraphSyncError_free(struct LDKGraphSyncError this_ptr);
43249
43250 /**
43251  * Creates a copy of the GraphSyncError
43252  */
43253 struct LDKGraphSyncError GraphSyncError_clone(const struct LDKGraphSyncError *NONNULL_PTR orig);
43254
43255 /**
43256  * Utility method to constructs a new DecodeError-variant GraphSyncError
43257  */
43258 struct LDKGraphSyncError GraphSyncError_decode_error(struct LDKDecodeError a);
43259
43260 /**
43261  * Utility method to constructs a new LightningError-variant GraphSyncError
43262  */
43263 struct LDKGraphSyncError GraphSyncError_lightning_error(struct LDKLightningError a);
43264
43265 #endif /* LDK_C_BINDINGS_H */
43266
43267 #include "ldk_ver.h"