Pin compiler_builtins to 0.1.109 when building std
[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.5 */
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  * Whether this blinded HTLC is being failed backwards by the introduction node or a blinded node,
15  * which determines the failure message that should be used.
16  */
17 typedef enum LDKBlindedFailure {
18    /**
19     * This HTLC is being failed backwards by the introduction node, and thus should be failed with
20     * [`msgs::UpdateFailHTLC`] and error code `0x8000|0x4000|24`.
21     */
22    LDKBlindedFailure_FromIntroductionNode,
23    /**
24     * This HTLC is being failed backwards by a blinded node within the path, and thus should be
25     * failed with [`msgs::UpdateFailMalformedHTLC`] and error code `0x8000|0x4000|24`.
26     */
27    LDKBlindedFailure_FromBlindedNode,
28    /**
29     * Must be last for serialization purposes
30     */
31    LDKBlindedFailure_Sentinel,
32 } LDKBlindedFailure;
33
34 /**
35  * Errors that may occur when converting a [`RawBolt11Invoice`] to a [`Bolt11Invoice`]. They relate to
36  * the requirements sections in BOLT #11
37  */
38 typedef enum LDKBolt11SemanticError {
39    /**
40     * The invoice is missing the mandatory payment hash
41     */
42    LDKBolt11SemanticError_NoPaymentHash,
43    /**
44     * The invoice has multiple payment hashes which isn't allowed
45     */
46    LDKBolt11SemanticError_MultiplePaymentHashes,
47    /**
48     * No description or description hash are part of the invoice
49     */
50    LDKBolt11SemanticError_NoDescription,
51    /**
52     * The invoice contains multiple descriptions and/or description hashes which isn't allowed
53     */
54    LDKBolt11SemanticError_MultipleDescriptions,
55    /**
56     * The invoice is missing the mandatory payment secret, which all modern lightning nodes
57     * should provide.
58     */
59    LDKBolt11SemanticError_NoPaymentSecret,
60    /**
61     * The invoice contains multiple payment secrets
62     */
63    LDKBolt11SemanticError_MultiplePaymentSecrets,
64    /**
65     * The invoice's features are invalid
66     */
67    LDKBolt11SemanticError_InvalidFeatures,
68    /**
69     * The recovery id doesn't fit the signature/pub key
70     */
71    LDKBolt11SemanticError_InvalidRecoveryId,
72    /**
73     * The invoice's signature is invalid
74     */
75    LDKBolt11SemanticError_InvalidSignature,
76    /**
77     * The invoice's amount was not a whole number of millisatoshis
78     */
79    LDKBolt11SemanticError_ImpreciseAmount,
80    /**
81     * Must be last for serialization purposes
82     */
83    LDKBolt11SemanticError_Sentinel,
84 } LDKBolt11SemanticError;
85
86 /**
87  * Error when interpreting a TLV stream as a specific type.
88  */
89 typedef enum LDKBolt12SemanticError {
90    /**
91     * The current [`std::time::SystemTime`] is past the offer or invoice's expiration.
92     */
93    LDKBolt12SemanticError_AlreadyExpired,
94    /**
95     * The provided chain hash does not correspond to a supported chain.
96     */
97    LDKBolt12SemanticError_UnsupportedChain,
98    /**
99     * A chain was provided but was not expected.
100     */
101    LDKBolt12SemanticError_UnexpectedChain,
102    /**
103     * An amount was expected but was missing.
104     */
105    LDKBolt12SemanticError_MissingAmount,
106    /**
107     * The amount exceeded the total bitcoin supply.
108     */
109    LDKBolt12SemanticError_InvalidAmount,
110    /**
111     * An amount was provided but was not sufficient in value.
112     */
113    LDKBolt12SemanticError_InsufficientAmount,
114    /**
115     * An amount was provided but was not expected.
116     */
117    LDKBolt12SemanticError_UnexpectedAmount,
118    /**
119     * A currency was provided that is not supported.
120     */
121    LDKBolt12SemanticError_UnsupportedCurrency,
122    /**
123     * A feature was required but is unknown.
124     */
125    LDKBolt12SemanticError_UnknownRequiredFeatures,
126    /**
127     * Features were provided but were not expected.
128     */
129    LDKBolt12SemanticError_UnexpectedFeatures,
130    /**
131     * A required description was not provided.
132     */
133    LDKBolt12SemanticError_MissingDescription,
134    /**
135     * A signing pubkey was not provided.
136     */
137    LDKBolt12SemanticError_MissingSigningPubkey,
138    /**
139     * A signing pubkey was provided but a different one was expected.
140     */
141    LDKBolt12SemanticError_InvalidSigningPubkey,
142    /**
143     * A signing pubkey was provided but was not expected.
144     */
145    LDKBolt12SemanticError_UnexpectedSigningPubkey,
146    /**
147     * A quantity was expected but was missing.
148     */
149    LDKBolt12SemanticError_MissingQuantity,
150    /**
151     * An unsupported quantity was provided.
152     */
153    LDKBolt12SemanticError_InvalidQuantity,
154    /**
155     * A quantity or quantity bounds was provided but was not expected.
156     */
157    LDKBolt12SemanticError_UnexpectedQuantity,
158    /**
159     * Metadata could not be used to verify the offers message.
160     */
161    LDKBolt12SemanticError_InvalidMetadata,
162    /**
163     * Metadata was provided but was not expected.
164     */
165    LDKBolt12SemanticError_UnexpectedMetadata,
166    /**
167     * Payer metadata was expected but was missing.
168     */
169    LDKBolt12SemanticError_MissingPayerMetadata,
170    /**
171     * A payer id was expected but was missing.
172     */
173    LDKBolt12SemanticError_MissingPayerId,
174    /**
175     * The payment id for a refund or request is already in use.
176     */
177    LDKBolt12SemanticError_DuplicatePaymentId,
178    /**
179     * Blinded paths were expected but were missing.
180     */
181    LDKBolt12SemanticError_MissingPaths,
182    /**
183     * Blinded paths were provided but were not expected.
184     */
185    LDKBolt12SemanticError_UnexpectedPaths,
186    /**
187     * The blinded payinfo given does not match the number of blinded path hops.
188     */
189    LDKBolt12SemanticError_InvalidPayInfo,
190    /**
191     * An invoice creation time was expected but was missing.
192     */
193    LDKBolt12SemanticError_MissingCreationTime,
194    /**
195     * An invoice payment hash was expected but was missing.
196     */
197    LDKBolt12SemanticError_MissingPaymentHash,
198    /**
199     * A signature was expected but was missing.
200     */
201    LDKBolt12SemanticError_MissingSignature,
202    /**
203     * Must be last for serialization purposes
204     */
205    LDKBolt12SemanticError_Sentinel,
206 } LDKBolt12SemanticError;
207
208 /**
209  * An enum which can either contain a  or not
210  */
211 typedef enum LDKCOption_NoneZ {
212    /**
213     * When we're in this state, this COption_NoneZ contains a
214     */
215    LDKCOption_NoneZ_Some,
216    /**
217     * When we're in this state, this COption_NoneZ contains nothing
218     */
219    LDKCOption_NoneZ_None,
220    /**
221     * Must be last for serialization purposes
222     */
223    LDKCOption_NoneZ_Sentinel,
224 } LDKCOption_NoneZ;
225
226 /**
227  * An enum representing the status of a channel monitor update persistence.
228  *
229  * These are generally used as the return value for an implementation of [`Persist`] which is used
230  * as the storage layer for a [`ChainMonitor`]. See the docs on [`Persist`] for a high-level
231  * explanation of how to handle different cases.
232  *
233  * While `UnrecoverableError` is provided as a failure variant, it is not truly \"handled\" on the
234  * calling side, and generally results in an immediate panic. For those who prefer to avoid
235  * panics, `InProgress` can be used and you can retry the update operation in the background or
236  * shut down cleanly.
237  *
238  * Note that channels should generally *not* be force-closed after a persistence failure.
239  * Force-closing with the latest [`ChannelMonitorUpdate`] applied may result in a transaction
240  * being broadcast which can only be spent by the latest [`ChannelMonitor`]! Thus, if the
241  * latest [`ChannelMonitor`] is not durably persisted anywhere and exists only in memory, naively
242  * calling [`ChannelManager::force_close_broadcasting_latest_txn`] *may result in loss of funds*!
243  *
244  * [`Persist`]: chainmonitor::Persist
245  * [`ChainMonitor`]: chainmonitor::ChainMonitor
246  * [`ChannelManager::force_close_broadcasting_latest_txn`]: crate::ln::channelmanager::ChannelManager::force_close_broadcasting_latest_txn
247  */
248 typedef enum LDKChannelMonitorUpdateStatus {
249    /**
250     * The update has been durably persisted and all copies of the relevant [`ChannelMonitor`]
251     * have been updated.
252     *
253     * This includes performing any `fsync()` calls required to ensure the update is guaranteed to
254     * be available on restart even if the application crashes.
255     */
256    LDKChannelMonitorUpdateStatus_Completed,
257    /**
258     * Indicates that the update will happen asynchronously in the background or that a transient
259     * failure occurred which is being retried in the background and will eventually complete.
260     *
261     * This will \"freeze\" a channel, preventing us from revoking old states or submitting a new
262     * commitment transaction to the counterparty. Once the update(s) which are `InProgress` have
263     * been completed, a [`MonitorEvent::Completed`] can be used to restore the channel to an
264     * operational state.
265     *
266     * Even when a channel has been \"frozen\", updates to the [`ChannelMonitor`] can continue to
267     * occur (e.g. if an inbound HTLC which we forwarded was claimed upstream, resulting in us
268     * attempting to claim it on this channel) and those updates must still be persisted.
269     *
270     * No updates to the channel will be made which could invalidate other [`ChannelMonitor`]s
271     * until a [`MonitorEvent::Completed`] is provided, even if you return no error on a later
272     * monitor update for the same channel.
273     *
274     * For deployments where a copy of [`ChannelMonitor`]s and other local state are backed up in
275     * a remote location (with local copies persisted immediately), it is anticipated that all
276     * updates will return [`InProgress`] until the remote copies could be updated.
277     *
278     * Note that while fully asynchronous persistence of [`ChannelMonitor`] data is generally
279     * reliable, this feature is considered beta, and a handful of edge-cases remain. Until the
280     * remaining cases are fixed, in rare cases, *using this feature may lead to funds loss*.
281     *
282     * [`InProgress`]: ChannelMonitorUpdateStatus::InProgress
283     */
284    LDKChannelMonitorUpdateStatus_InProgress,
285    /**
286     * Indicates that an update has failed and will not complete at any point in the future.
287     *
288     * Currently returning this variant will cause LDK to immediately panic to encourage immediate
289     * shutdown. In the future this may be updated to disconnect peers and refuse to continue
290     * normal operation without a panic.
291     *
292     * Applications which wish to perform an orderly shutdown after failure should consider
293     * returning [`InProgress`] instead and simply shut down without ever marking the update
294     * complete.
295     *
296     * [`InProgress`]: ChannelMonitorUpdateStatus::InProgress
297     */
298    LDKChannelMonitorUpdateStatus_UnrecoverableError,
299    /**
300     * Must be last for serialization purposes
301     */
302    LDKChannelMonitorUpdateStatus_Sentinel,
303 } LDKChannelMonitorUpdateStatus;
304
305 /**
306  * Further information on the details of the channel shutdown.
307  * Upon channels being forced closed (i.e. commitment transaction confirmation detected
308  * by `ChainMonitor`), ChannelShutdownState will be set to `ShutdownComplete` or
309  * the channel will be removed shortly.
310  * Also note, that in normal operation, peers could disconnect at any of these states
311  * and require peer re-connection before making progress onto other states
312  */
313 typedef enum LDKChannelShutdownState {
314    /**
315     * Channel has not sent or received a shutdown message.
316     */
317    LDKChannelShutdownState_NotShuttingDown,
318    /**
319     * Local node has sent a shutdown message for this channel.
320     */
321    LDKChannelShutdownState_ShutdownInitiated,
322    /**
323     * Shutdown message exchanges have concluded and the channels are in the midst of
324     * resolving all existing open HTLCs before closing can continue.
325     */
326    LDKChannelShutdownState_ResolvingHTLCs,
327    /**
328     * All HTLCs have been resolved, nodes are currently negotiating channel close onchain fee rates.
329     */
330    LDKChannelShutdownState_NegotiatingClosingFee,
331    /**
332     * We've successfully negotiated a closing_signed dance. At this point `ChannelManager` is about
333     * to drop the channel.
334     */
335    LDKChannelShutdownState_ShutdownComplete,
336    /**
337     * Must be last for serialization purposes
338     */
339    LDKChannelShutdownState_Sentinel,
340 } LDKChannelShutdownState;
341
342 /**
343  * An enum that represents the priority at which we want a transaction to confirm used for feerate
344  * estimation.
345  */
346 typedef enum LDKConfirmationTarget {
347    /**
348     * We have some funds available on chain which we need to spend prior to some expiry time at
349     * which point our counterparty may be able to steal them. Generally we have in the high tens
350     * to low hundreds of blocks to get our transaction on-chain, but we shouldn't risk too low a
351     * fee - this should be a relatively high priority feerate.
352     */
353    LDKConfirmationTarget_OnChainSweep,
354    /**
355     * This is the lowest feerate we will allow our channel counterparty to have in an anchor
356     * channel in order to close the channel if a channel party goes away.
357     *
358     * This needs to be sufficient to get into the mempool when the channel needs to
359     * be force-closed. Setting too high may result in force-closures if our counterparty attempts
360     * to use a lower feerate. Because this is for anchor channels, we can always bump the feerate
361     * later; the feerate here only needs to be sufficient to enter the mempool.
362     *
363     * A good estimate is the expected mempool minimum at the time of force-closure. Obviously this
364     * is not an estimate which is very easy to calculate because we do not know the future. Using
365     * a simple long-term fee estimate or tracking of the mempool minimum is a good approach to
366     * ensure you can always close the channel. A future change to Bitcoin's P2P network
367     * (package relay) may obviate the need for this entirely.
368     */
369    LDKConfirmationTarget_MinAllowedAnchorChannelRemoteFee,
370    /**
371     * The lowest feerate we will allow our channel counterparty to have in a non-anchor channel.
372     *
373     * This is the feerate on the transaction which we (or our counterparty) will broadcast in
374     * order to close the channel if a channel party goes away. Setting this value too high will
375     * cause immediate force-closures in order to avoid having an unbroadcastable state.
376     *
377     * This feerate represents the fee we pick now, which must be sufficient to enter a block at an
378     * arbitrary time in the future. Obviously this is not an estimate which is very easy to
379     * calculate. This can leave channels subject to being unable to close if feerates rise, and in
380     * general you should prefer anchor channels to ensure you can increase the feerate when the
381     * transactions need broadcasting.
382     *
383     * Do note some fee estimators round up to the next full sat/vbyte (ie 250 sats per kw),
384     * causing occasional issues with feerate disagreements between an initiator that wants a
385     * feerate of 1.1 sat/vbyte and a receiver that wants 1.1 rounded up to 2. If your fee
386     * estimator rounds subtracting 250 to your desired feerate here can help avoid this issue.
387     *
388     * [`ChannelConfig::max_dust_htlc_exposure`]: crate::util::config::ChannelConfig::max_dust_htlc_exposure
389     */
390    LDKConfirmationTarget_MinAllowedNonAnchorChannelRemoteFee,
391    /**
392     * This is the feerate on the transaction which we (or our counterparty) will broadcast in
393     * order to close the channel if a channel party goes away.
394     *
395     * This needs to be sufficient to get into the mempool when the channel needs to
396     * be force-closed. Setting too low may result in force-closures. Because this is for anchor
397     * channels, it can be a low value as we can always bump the feerate later.
398     *
399     * A good estimate is the expected mempool minimum at the time of force-closure. Obviously this
400     * is not an estimate which is very easy to calculate because we do not know the future. Using
401     * a simple long-term fee estimate or tracking of the mempool minimum is a good approach to
402     * ensure you can always close the channel. A future change to Bitcoin's P2P network
403     * (package relay) may obviate the need for this entirely.
404     */
405    LDKConfirmationTarget_AnchorChannelFee,
406    /**
407     * Lightning is built around the ability to broadcast a transaction in the future to close our
408     * channel and claim all pending funds. In order to do so, non-anchor channels are built with
409     * transactions which we need to be able to broadcast at some point in the future.
410     *
411     * This feerate represents the fee we pick now, which must be sufficient to enter a block at an
412     * arbitrary time in the future. Obviously this is not an estimate which is very easy to
413     * calculate, so most lightning nodes use some relatively high-priority feerate using the
414     * current mempool. This leaves channels subject to being unable to close if feerates rise, and
415     * in general you should prefer anchor channels to ensure you can increase the feerate when the
416     * transactions need broadcasting.
417     *
418     * Since this should represent the feerate of a channel close that does not need fee
419     * bumping, this is also used as an upper bound for our attempted feerate when doing cooperative
420     * closure of any channel.
421     */
422    LDKConfirmationTarget_NonAnchorChannelFee,
423    /**
424     * When cooperatively closing a channel, this is the minimum feerate we will accept.
425     * Recommended at least within a day or so worth of blocks.
426     *
427     * This will also be used when initiating a cooperative close of a channel. When closing a
428     * channel you can override this fee by using
429     * [`ChannelManager::close_channel_with_feerate_and_script`].
430     *
431     * [`ChannelManager::close_channel_with_feerate_and_script`]: crate::ln::channelmanager::ChannelManager::close_channel_with_feerate_and_script
432     */
433    LDKConfirmationTarget_ChannelCloseMinimum,
434    /**
435     * The feerate [`OutputSweeper`] will use on transactions spending
436     * [`SpendableOutputDescriptor`]s after a channel closure.
437     *
438     * Generally spending these outputs is safe as long as they eventually confirm, so a value
439     * (slightly above) the mempool minimum should suffice. However, as this value will influence
440     * how long funds will be unavailable after channel closure, [`FeeEstimator`] implementors
441     * might want to choose a higher feerate to regain control over funds faster.
442     *
443     * [`OutputSweeper`]: crate::util::sweep::OutputSweeper
444     * [`SpendableOutputDescriptor`]: crate::sign::SpendableOutputDescriptor
445     */
446    LDKConfirmationTarget_OutputSpendingFee,
447    /**
448     * Must be last for serialization purposes
449     */
450    LDKConfirmationTarget_Sentinel,
451 } LDKConfirmationTarget;
452
453 /**
454  * Errors that may occur when constructing a new [`RawBolt11Invoice`] or [`Bolt11Invoice`]
455  */
456 typedef enum LDKCreationError {
457    /**
458     * The supplied description string was longer than 639 __bytes__ (see [`Description::new`])
459     */
460    LDKCreationError_DescriptionTooLong,
461    /**
462     * The specified route has too many hops and can't be encoded
463     */
464    LDKCreationError_RouteTooLong,
465    /**
466     * The Unix timestamp of the supplied date is less than zero or greater than 35-bits
467     */
468    LDKCreationError_TimestampOutOfBounds,
469    /**
470     * The supplied millisatoshi amount was greater than the total bitcoin supply.
471     */
472    LDKCreationError_InvalidAmount,
473    /**
474     * Route hints were required for this invoice and were missing. Applies to
475     * [phantom invoices].
476     *
477     * [phantom invoices]: crate::utils::create_phantom_invoice
478     */
479    LDKCreationError_MissingRouteHints,
480    /**
481     * The provided `min_final_cltv_expiry_delta` was less than [`MIN_FINAL_CLTV_EXPIRY_DELTA`].
482     *
483     * [`MIN_FINAL_CLTV_EXPIRY_DELTA`]: lightning::ln::channelmanager::MIN_FINAL_CLTV_EXPIRY_DELTA
484     */
485    LDKCreationError_MinFinalCltvExpiryDeltaTooShort,
486    /**
487     * Must be last for serialization purposes
488     */
489    LDKCreationError_Sentinel,
490 } LDKCreationError;
491
492 /**
493  * Enum representing the crypto currencies (or networks) supported by this library
494  */
495 typedef enum LDKCurrency {
496    /**
497     * Bitcoin mainnet
498     */
499    LDKCurrency_Bitcoin,
500    /**
501     * Bitcoin testnet
502     */
503    LDKCurrency_BitcoinTestnet,
504    /**
505     * Bitcoin regtest
506     */
507    LDKCurrency_Regtest,
508    /**
509     * Bitcoin simnet
510     */
511    LDKCurrency_Simnet,
512    /**
513     * Bitcoin signet
514     */
515    LDKCurrency_Signet,
516    /**
517     * Must be last for serialization purposes
518     */
519    LDKCurrency_Sentinel,
520 } LDKCurrency;
521
522 /**
523  * The side of a channel that is the [`IntroductionNode`] in a [`BlindedPath`]. [BOLT 7] defines
524  * which nodes is which in the [`ChannelAnnouncement`] message.
525  *
526  * [BOLT 7]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-channel_announcement-message
527  * [`ChannelAnnouncement`]: crate::ln::msgs::ChannelAnnouncement
528  */
529 typedef enum LDKDirection {
530    /**
531     * The lesser node id when compared lexicographically in ascending order.
532     */
533    LDKDirection_NodeOne,
534    /**
535     * The greater node id when compared lexicographically in ascending order.
536     */
537    LDKDirection_NodeTwo,
538    /**
539     * Must be last for serialization purposes
540     */
541    LDKDirection_Sentinel,
542 } LDKDirection;
543
544 /**
545  * Describes the type of HTLC claim as determined by analyzing the witness.
546  */
547 typedef enum LDKHTLCClaim {
548    /**
549     * Claims an offered output on a commitment transaction through the timeout path.
550     */
551    LDKHTLCClaim_OfferedTimeout,
552    /**
553     * Claims an offered output on a commitment transaction through the success path.
554     */
555    LDKHTLCClaim_OfferedPreimage,
556    /**
557     * Claims an accepted output on a commitment transaction through the timeout path.
558     */
559    LDKHTLCClaim_AcceptedTimeout,
560    /**
561     * Claims an accepted output on a commitment transaction through the success path.
562     */
563    LDKHTLCClaim_AcceptedPreimage,
564    /**
565     * Claims an offered/accepted output on a commitment transaction through the revocation path.
566     */
567    LDKHTLCClaim_Revocation,
568    /**
569     * Must be last for serialization purposes
570     */
571    LDKHTLCClaim_Sentinel,
572 } LDKHTLCClaim;
573
574 /**
575  * Represents an IO Error. Note that some information is lost in the conversion from Rust.
576  */
577 typedef enum LDKIOError {
578    LDKIOError_NotFound,
579    LDKIOError_PermissionDenied,
580    LDKIOError_ConnectionRefused,
581    LDKIOError_ConnectionReset,
582    LDKIOError_ConnectionAborted,
583    LDKIOError_NotConnected,
584    LDKIOError_AddrInUse,
585    LDKIOError_AddrNotAvailable,
586    LDKIOError_BrokenPipe,
587    LDKIOError_AlreadyExists,
588    LDKIOError_WouldBlock,
589    LDKIOError_InvalidInput,
590    LDKIOError_InvalidData,
591    LDKIOError_TimedOut,
592    LDKIOError_WriteZero,
593    LDKIOError_Interrupted,
594    LDKIOError_Other,
595    LDKIOError_UnexpectedEof,
596    /**
597     * Must be last for serialization purposes
598     */
599    LDKIOError_Sentinel,
600 } LDKIOError;
601
602 /**
603  * An enum representing the available verbosity levels of the logger.
604  */
605 typedef enum LDKLevel {
606    /**
607     * Designates extremely verbose information, including gossip-induced messages
608     */
609    LDKLevel_Gossip,
610    /**
611     * Designates very low priority, often extremely verbose, information
612     */
613    LDKLevel_Trace,
614    /**
615     * Designates lower priority information
616     */
617    LDKLevel_Debug,
618    /**
619     * Designates useful information
620     */
621    LDKLevel_Info,
622    /**
623     * Designates hazardous situations
624     */
625    LDKLevel_Warn,
626    /**
627     * Designates very serious errors
628     */
629    LDKLevel_Error,
630    /**
631     * Must be last for serialization purposes
632     */
633    LDKLevel_Sentinel,
634 } LDKLevel;
635
636 /**
637  * An enum representing the possible Bitcoin or test networks which we can run on
638  */
639 typedef enum LDKNetwork {
640    /**
641     * The main Bitcoin blockchain.
642     */
643    LDKNetwork_Bitcoin,
644    /**
645     * The testnet3 blockchain.
646     */
647    LDKNetwork_Testnet,
648    /**
649     * A local test blockchain.
650     */
651    LDKNetwork_Regtest,
652    /**
653     * A blockchain on which blocks are signed instead of mined.
654     */
655    LDKNetwork_Signet,
656    /**
657     * Must be last for serialization purposes
658     */
659    LDKNetwork_Sentinel,
660 } LDKNetwork;
661
662 /**
663  * The reason the payment failed. Used in [`Event::PaymentFailed`].
664  */
665 typedef enum LDKPaymentFailureReason {
666    /**
667     * The intended recipient rejected our payment.
668     */
669    LDKPaymentFailureReason_RecipientRejected,
670    /**
671     * The user chose to abandon this payment by calling [`ChannelManager::abandon_payment`].
672     *
673     * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
674     */
675    LDKPaymentFailureReason_UserAbandoned,
676    /**
677     * We exhausted all of our retry attempts while trying to send the payment, or we
678     * exhausted the [`Retry::Timeout`] if the user set one. If at any point a retry
679     * attempt failed while being forwarded along the path, an [`Event::PaymentPathFailed`] will
680     * have come before this.
681     *
682     * [`Retry::Timeout`]: crate::ln::channelmanager::Retry::Timeout
683     */
684    LDKPaymentFailureReason_RetriesExhausted,
685    /**
686     * The payment expired while retrying, based on the provided
687     * [`PaymentParameters::expiry_time`].
688     *
689     * [`PaymentParameters::expiry_time`]: crate::routing::router::PaymentParameters::expiry_time
690     */
691    LDKPaymentFailureReason_PaymentExpired,
692    /**
693     * We failed to find a route while retrying the payment.
694     *
695     * Note that this generally indicates that we've exhausted the available set of possible
696     * routes - we tried the payment over a few routes but were not able to find any further
697     * candidate routes beyond those.
698     */
699    LDKPaymentFailureReason_RouteNotFound,
700    /**
701     * This error should generally never happen. This likely means that there is a problem with
702     * your router.
703     */
704    LDKPaymentFailureReason_UnexpectedError,
705    /**
706     * Must be last for serialization purposes
707     */
708    LDKPaymentFailureReason_Sentinel,
709 } LDKPaymentFailureReason;
710
711 /**
712  * Specifies the recipient of an invoice.
713  *
714  * This indicates to [`NodeSigner::sign_invoice`] what node secret key should be used to sign
715  * the invoice.
716  */
717 typedef enum LDKRecipient {
718    /**
719     * The invoice should be signed with the local node secret key.
720     */
721    LDKRecipient_Node,
722    /**
723     * The invoice should be signed with the phantom node secret key. This secret key must be the
724     * same for all nodes participating in the [phantom node payment].
725     *
726     * [phantom node payment]: PhantomKeysManager
727     */
728    LDKRecipient_PhantomNode,
729    /**
730     * Must be last for serialization purposes
731     */
732    LDKRecipient_Sentinel,
733 } LDKRecipient;
734
735 /**
736  * Indicates an immediate error on [`ChannelManager::send_payment`]. Further errors may be
737  * surfaced later via [`Event::PaymentPathFailed`] and [`Event::PaymentFailed`].
738  *
739  * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
740  * [`Event::PaymentPathFailed`]: crate::events::Event::PaymentPathFailed
741  * [`Event::PaymentFailed`]: crate::events::Event::PaymentFailed
742  */
743 typedef enum LDKRetryableSendFailure {
744    /**
745     * The provided [`PaymentParameters::expiry_time`] indicated that the payment has expired. Note
746     * that this error is *not* caused by [`Retry::Timeout`].
747     *
748     * [`PaymentParameters::expiry_time`]: crate::routing::router::PaymentParameters::expiry_time
749     */
750    LDKRetryableSendFailure_PaymentExpired,
751    /**
752     * We were unable to find a route to the destination.
753     */
754    LDKRetryableSendFailure_RouteNotFound,
755    /**
756     * Indicates that a payment for the provided [`PaymentId`] is already in-flight and has not
757     * yet completed (i.e. generated an [`Event::PaymentSent`] or [`Event::PaymentFailed`]).
758     *
759     * [`PaymentId`]: crate::ln::channelmanager::PaymentId
760     * [`Event::PaymentSent`]: crate::events::Event::PaymentSent
761     * [`Event::PaymentFailed`]: crate::events::Event::PaymentFailed
762     */
763    LDKRetryableSendFailure_DuplicatePayment,
764    /**
765     * Must be last for serialization purposes
766     */
767    LDKRetryableSendFailure_Sentinel,
768 } LDKRetryableSendFailure;
769
770 /**
771  * Represents an error returned from libsecp256k1 during validation of some secp256k1 data
772  */
773 typedef enum LDKSecp256k1Error {
774    /**
775     * Signature failed verification
776     */
777    LDKSecp256k1Error_IncorrectSignature,
778    /**
779     * Badly sized message ("messages" are actually fixed-sized digests; see the MESSAGE_SIZE constant)
780     */
781    LDKSecp256k1Error_InvalidMessage,
782    /**
783     * Bad public key
784     */
785    LDKSecp256k1Error_InvalidPublicKey,
786    /**
787     * Bad signature
788     */
789    LDKSecp256k1Error_InvalidSignature,
790    /**
791     * Bad secret key
792     */
793    LDKSecp256k1Error_InvalidSecretKey,
794    /**
795     * Bad shared secret.
796     */
797    LDKSecp256k1Error_InvalidSharedSecret,
798    /**
799     * Bad recovery id
800     */
801    LDKSecp256k1Error_InvalidRecoveryId,
802    /**
803     * Invalid tweak for add_assign or mul_assign
804     */
805    LDKSecp256k1Error_InvalidTweak,
806    /**
807     * Didn't pass enough memory to context creation with preallocated memory
808     */
809    LDKSecp256k1Error_NotEnoughMemory,
810    /**
811     * Bad set of public keys.
812     */
813    LDKSecp256k1Error_InvalidPublicKeySum,
814    /**
815     * The only valid parity values are 0 or 1.
816     */
817    LDKSecp256k1Error_InvalidParityValue,
818    /**
819     * Must be last for serialization purposes
820     */
821    LDKSecp256k1Error_Sentinel,
822 } LDKSecp256k1Error;
823
824 /**
825  * A `short_channel_id` construction error
826  */
827 typedef enum LDKShortChannelIdError {
828    /**
829     * Block height too high
830     */
831    LDKShortChannelIdError_BlockOverflow,
832    /**
833     * Tx index too high
834     */
835    LDKShortChannelIdError_TxIndexOverflow,
836    /**
837     * Vout index too high
838     */
839    LDKShortChannelIdError_VoutIndexOverflow,
840    /**
841     * Must be last for serialization purposes
842     */
843    LDKShortChannelIdError_Sentinel,
844 } LDKShortChannelIdError;
845
846 /**
847  * SI prefixes for the human readable part
848  */
849 typedef enum LDKSiPrefix {
850    /**
851     * 10^-3
852     */
853    LDKSiPrefix_Milli,
854    /**
855     * 10^-6
856     */
857    LDKSiPrefix_Micro,
858    /**
859     * 10^-9
860     */
861    LDKSiPrefix_Nano,
862    /**
863     * 10^-12
864     */
865    LDKSiPrefix_Pico,
866    /**
867     * Must be last for serialization purposes
868     */
869    LDKSiPrefix_Sentinel,
870 } LDKSiPrefix;
871
872 /**
873  * [`SocketAddress`] error variants
874  */
875 typedef enum LDKSocketAddressParseError {
876    /**
877     * Socket address (IPv4/IPv6) parsing error
878     */
879    LDKSocketAddressParseError_SocketAddrParse,
880    /**
881     * Invalid input format
882     */
883    LDKSocketAddressParseError_InvalidInput,
884    /**
885     * Invalid port
886     */
887    LDKSocketAddressParseError_InvalidPort,
888    /**
889     * Invalid onion v3 address
890     */
891    LDKSocketAddressParseError_InvalidOnionV3,
892    /**
893     * Must be last for serialization purposes
894     */
895    LDKSocketAddressParseError_Sentinel,
896 } LDKSocketAddressParseError;
897
898 /**
899  * An error when accessing the chain via [`UtxoLookup`].
900  */
901 typedef enum LDKUtxoLookupError {
902    /**
903     * The requested chain is unknown.
904     */
905    LDKUtxoLookupError_UnknownChain,
906    /**
907     * The requested transaction doesn't exist or hasn't confirmed.
908     */
909    LDKUtxoLookupError_UnknownTx,
910    /**
911     * Must be last for serialization purposes
912     */
913    LDKUtxoLookupError_Sentinel,
914 } LDKUtxoLookupError;
915
916 /**
917  * A Rust str object, ie a reference to a UTF8-valid string.
918  * This is *not* null-terminated so cannot be used directly as a C string!
919  */
920 typedef struct LDKStr {
921    /**
922     * A pointer to the string's bytes, in UTF8 encoding
923     */
924    const uint8_t *chars;
925    /**
926     * The number of bytes (not characters!) pointed to by `chars`
927     */
928    uintptr_t len;
929    /**
930     * Whether the data pointed to by `chars` should be freed or not.
931     */
932    bool chars_is_owned;
933 } LDKStr;
934
935 /**
936  * A 16-byte byte array.
937  */
938 typedef struct LDKSixteenBytes {
939    /**
940     * The sixteen bytes
941     */
942    uint8_t data[16];
943 } LDKSixteenBytes;
944
945 /**
946  * Unsigned, 128-bit integer.
947  *
948  * Because LLVM implements an incorrect ABI for 128-bit integers, a wrapper type is defined here.
949  * See https://github.com/rust-lang/rust/issues/54341 for more details.
950  */
951 typedef struct LDKU128 {
952    /**
953     * The 128-bit integer, as 16 little-endian bytes
954     */
955    uint8_t le_bytes[16];
956 } LDKU128;
957
958 /**
959  * Integer in the range `0..=16`
960  */
961 typedef struct LDKWitnessVersion {
962    uint8_t _0;
963 } LDKWitnessVersion;
964
965 /**
966  * A dynamically-allocated array of u8s of arbitrary size.
967  * This corresponds to std::vector in C++
968  */
969 typedef struct LDKCVec_u8Z {
970    /**
971     * The elements in the array.
972     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
973     */
974    uint8_t *data;
975    /**
976     * The number of elements pointed to by `data`.
977     */
978    uintptr_t datalen;
979 } LDKCVec_u8Z;
980
981 /**
982  * A segregated witness version byte and script bytes
983  */
984 typedef struct LDKWitnessProgram {
985    struct LDKWitnessVersion version;
986    struct LDKCVec_u8Z program;
987 } LDKWitnessProgram;
988
989 /**
990  * A "slice" referencing some byte array. This is simply a length-tagged pointer which does not
991  * own the memory pointed to by data.
992  */
993 typedef struct LDKu8slice {
994    /**
995     * A pointer to the byte buffer
996     */
997    const uint8_t *data;
998    /**
999     * The number of bytes pointed to by `data`.
1000     */
1001    uintptr_t datalen;
1002 } LDKu8slice;
1003
1004 /**
1005  * Represents a scalar value between zero and the secp256k1 curve order, in big endian.
1006  */
1007 typedef struct LDKBigEndianScalar {
1008    /**
1009     * The bytes of the scalar value.
1010     */
1011    uint8_t big_endian_bytes[32];
1012 } LDKBigEndianScalar;
1013
1014 /**
1015  * Arbitrary 32 bytes, which could represent one of a few different things. You probably want to
1016  * look up the corresponding function in rust-lightning's docs.
1017  */
1018 typedef struct LDKThirtyTwoBytes {
1019    /**
1020     * The thirty-two bytes
1021     */
1022    uint8_t data[32];
1023 } LDKThirtyTwoBytes;
1024
1025 /**
1026  * Represents an error returned from the bech32 library during validation of some bech32 data
1027  */
1028 typedef enum LDKBech32Error_Tag {
1029    /**
1030     * String does not contain the separator character
1031     */
1032    LDKBech32Error_MissingSeparator,
1033    /**
1034     * The checksum does not match the rest of the data
1035     */
1036    LDKBech32Error_InvalidChecksum,
1037    /**
1038     * The data or human-readable part is too long or too short
1039     */
1040    LDKBech32Error_InvalidLength,
1041    /**
1042     * Some part of the string contains an invalid character
1043     */
1044    LDKBech32Error_InvalidChar,
1045    /**
1046     * Some part of the data has an invalid value
1047     */
1048    LDKBech32Error_InvalidData,
1049    /**
1050     * The bit conversion failed due to a padding issue
1051     */
1052    LDKBech32Error_InvalidPadding,
1053    /**
1054     * The whole string must be of one case
1055     */
1056    LDKBech32Error_MixedCase,
1057    /**
1058     * Must be last for serialization purposes
1059     */
1060    LDKBech32Error_Sentinel,
1061 } LDKBech32Error_Tag;
1062
1063 typedef struct LDKBech32Error {
1064    LDKBech32Error_Tag tag;
1065    union {
1066       struct {
1067          uint32_t invalid_char;
1068       };
1069       struct {
1070          uint8_t invalid_data;
1071       };
1072    };
1073 } LDKBech32Error;
1074
1075 /**
1076  * A serialized transaction, in (pointer, length) form.
1077  *
1078  * This type optionally owns its own memory, and thus the semantics around access change based on
1079  * the `data_is_owned` flag. If `data_is_owned` is set, you must call `Transaction_free` to free
1080  * the underlying buffer before the object goes out of scope. If `data_is_owned` is not set, any
1081  * access to the buffer after the scope in which the object was provided to you is invalid. eg,
1082  * access after you return from the call in which a `!data_is_owned` `Transaction` is provided to
1083  * you would be invalid.
1084  *
1085  * Note that, while it may change in the future, because transactions on the Rust side are stored
1086  * in a deserialized form, all `Transaction`s generated on the Rust side will have `data_is_owned`
1087  * set. Similarly, while it may change in the future, all `Transaction`s you pass to Rust may have
1088  * `data_is_owned` either set or unset at your discretion.
1089  */
1090 typedef struct LDKTransaction {
1091    /**
1092     * The serialized transaction data.
1093     *
1094     * This is non-const for your convenience, an object passed to Rust is never written to.
1095     */
1096    uint8_t *data;
1097    /**
1098     * The length of the serialized transaction
1099     */
1100    uintptr_t datalen;
1101    /**
1102     * Whether the data pointed to by `data` should be freed or not.
1103     */
1104    bool data_is_owned;
1105 } LDKTransaction;
1106
1107 /**
1108  * A serialized witness.
1109  */
1110 typedef struct LDKWitness {
1111    /**
1112     * The serialized transaction data.
1113     *
1114     * This is non-const for your convenience, an object passed to Rust is never written to.
1115     */
1116    uint8_t *data;
1117    /**
1118     * The length of the serialized transaction
1119     */
1120    uintptr_t datalen;
1121    /**
1122     * Whether the data pointed to by `data` should be freed or not.
1123     */
1124    bool data_is_owned;
1125 } LDKWitness;
1126
1127 /**
1128  * An input to a transaction.
1129  *
1130  * This contains the witness, the scriptSig and the previous outpoint and represents a single
1131  * input to a transaction
1132  */
1133 typedef struct LDKTxIn {
1134    /**
1135     * The witness which includes any signatures required to spend a segwit output.
1136     */
1137    struct LDKWitness witness;
1138    /**
1139     * The script_sig which includes signatures requires to spend a pre-segwit output (or a
1140     * P2SH-wrapped segwit output).
1141     */
1142    struct LDKCVec_u8Z script_sig;
1143    /**
1144     * The sequence number of the transaction input
1145     */
1146    uint32_t sequence;
1147    /**
1148     * The txid of the transaction being spent.
1149     */
1150    struct LDKThirtyTwoBytes previous_txid;
1151    /**
1152     * The output index of the transaction being spent.
1153     */
1154    uint32_t previous_vout;
1155 } LDKTxIn;
1156
1157 /**
1158  * A transaction output including a scriptPubKey and value.
1159  * This type *does* own its own memory, so must be free'd appropriately.
1160  */
1161 typedef struct LDKTxOut {
1162    /**
1163     * The script_pubkey in this output
1164     */
1165    struct LDKCVec_u8Z script_pubkey;
1166    /**
1167     * The value, in satoshis, of this output
1168     */
1169    uint64_t value;
1170 } LDKTxOut;
1171
1172
1173
1174 /**
1175  * Builds a [`Refund`] for the \"offer for money\" flow.
1176  *
1177  * See [module-level documentation] for usage.
1178  *
1179  * [module-level documentation]: self
1180  */
1181 typedef struct MUST_USE_STRUCT LDKRefundMaybeWithDerivedMetadataBuilder {
1182    /**
1183     * A pointer to the opaque Rust object.
1184     * Nearly everywhere, inner must be non-null, however in places where
1185     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1186     */
1187    LDKnativeRefundMaybeWithDerivedMetadataBuilder *inner;
1188    /**
1189     * Indicates that this is the only struct which contains the same pointer.
1190     * Rust functions which take ownership of an object provided via an argument require
1191     * this to be true and invalidate the object pointed to by inner.
1192     */
1193    bool is_owned;
1194 } LDKRefundMaybeWithDerivedMetadataBuilder;
1195
1196 /**
1197  * The contents of CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ
1198  */
1199 typedef union LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZPtr {
1200    /**
1201     * A pointer to the contents in the success state.
1202     * Reading from this pointer when `result_ok` is not set is undefined.
1203     */
1204    struct LDKRefundMaybeWithDerivedMetadataBuilder *result;
1205    /**
1206     * A pointer to the contents in the error state.
1207     * Reading from this pointer when `result_ok` is set is undefined.
1208     */
1209    enum LDKBolt12SemanticError *err;
1210 } LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZPtr;
1211
1212 /**
1213  * A CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ represents the result of a fallible operation,
1214  * containing a crate::lightning::offers::refund::RefundMaybeWithDerivedMetadataBuilder on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure.
1215  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1216  */
1217 typedef struct LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ {
1218    /**
1219     * The contents of this CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ, accessible via either
1220     * `err` or `result` depending on the state of `result_ok`.
1221     */
1222    union LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZPtr contents;
1223    /**
1224     * Whether this CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ represents a success state.
1225     */
1226    bool result_ok;
1227 } LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ;
1228
1229
1230
1231 /**
1232  * A `Refund` is a request to send an [`Bolt12Invoice`] without a preceding [`Offer`].
1233  *
1234  * Typically, after an invoice is paid, the recipient may publish a refund allowing the sender to
1235  * recoup their funds. A refund may be used more generally as an \"offer for money\", such as with a
1236  * bitcoin ATM.
1237  *
1238  * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
1239  * [`Offer`]: crate::offers::offer::Offer
1240  */
1241 typedef struct MUST_USE_STRUCT LDKRefund {
1242    /**
1243     * A pointer to the opaque Rust object.
1244     * Nearly everywhere, inner must be non-null, however in places where
1245     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1246     */
1247    LDKnativeRefund *inner;
1248    /**
1249     * Indicates that this is the only struct which contains the same pointer.
1250     * Rust functions which take ownership of an object provided via an argument require
1251     * this to be true and invalidate the object pointed to by inner.
1252     */
1253    bool is_owned;
1254 } LDKRefund;
1255
1256 /**
1257  * The contents of CResult_RefundBolt12SemanticErrorZ
1258  */
1259 typedef union LDKCResult_RefundBolt12SemanticErrorZPtr {
1260    /**
1261     * A pointer to the contents in the success state.
1262     * Reading from this pointer when `result_ok` is not set is undefined.
1263     */
1264    struct LDKRefund *result;
1265    /**
1266     * A pointer to the contents in the error state.
1267     * Reading from this pointer when `result_ok` is set is undefined.
1268     */
1269    enum LDKBolt12SemanticError *err;
1270 } LDKCResult_RefundBolt12SemanticErrorZPtr;
1271
1272 /**
1273  * A CResult_RefundBolt12SemanticErrorZ represents the result of a fallible operation,
1274  * containing a crate::lightning::offers::refund::Refund on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure.
1275  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1276  */
1277 typedef struct LDKCResult_RefundBolt12SemanticErrorZ {
1278    /**
1279     * The contents of this CResult_RefundBolt12SemanticErrorZ, accessible via either
1280     * `err` or `result` depending on the state of `result_ok`.
1281     */
1282    union LDKCResult_RefundBolt12SemanticErrorZPtr contents;
1283    /**
1284     * Whether this CResult_RefundBolt12SemanticErrorZ represents a success state.
1285     */
1286    bool result_ok;
1287 } LDKCResult_RefundBolt12SemanticErrorZ;
1288
1289 /**
1290  * An enum which can either contain a u64 or not
1291  */
1292 typedef enum LDKCOption_u64Z_Tag {
1293    /**
1294     * When we're in this state, this COption_u64Z contains a u64
1295     */
1296    LDKCOption_u64Z_Some,
1297    /**
1298     * When we're in this state, this COption_u64Z contains nothing
1299     */
1300    LDKCOption_u64Z_None,
1301    /**
1302     * Must be last for serialization purposes
1303     */
1304    LDKCOption_u64Z_Sentinel,
1305 } LDKCOption_u64Z_Tag;
1306
1307 typedef struct LDKCOption_u64Z {
1308    LDKCOption_u64Z_Tag tag;
1309    union {
1310       struct {
1311          uint64_t some;
1312       };
1313    };
1314 } LDKCOption_u64Z;
1315
1316
1317
1318 /**
1319  * Onion messages and payments can be sent and received to blinded paths, which serve to hide the
1320  * identity of the recipient.
1321  */
1322 typedef struct MUST_USE_STRUCT LDKBlindedPath {
1323    /**
1324     * A pointer to the opaque Rust object.
1325     * Nearly everywhere, inner must be non-null, however in places where
1326     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1327     */
1328    LDKnativeBlindedPath *inner;
1329    /**
1330     * Indicates that this is the only struct which contains the same pointer.
1331     * Rust functions which take ownership of an object provided via an argument require
1332     * this to be true and invalidate the object pointed to by inner.
1333     */
1334    bool is_owned;
1335 } LDKBlindedPath;
1336
1337 /**
1338  * A dynamically-allocated array of crate::lightning::blinded_path::BlindedPaths of arbitrary size.
1339  * This corresponds to std::vector in C++
1340  */
1341 typedef struct LDKCVec_BlindedPathZ {
1342    /**
1343     * The elements in the array.
1344     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1345     */
1346    struct LDKBlindedPath *data;
1347    /**
1348     * The number of elements pointed to by `data`.
1349     */
1350    uintptr_t datalen;
1351 } LDKCVec_BlindedPathZ;
1352
1353
1354
1355 /**
1356  * Error when parsing a bech32 encoded message using [`str::parse`].
1357  */
1358 typedef struct MUST_USE_STRUCT LDKBolt12ParseError {
1359    /**
1360     * A pointer to the opaque Rust object.
1361     * Nearly everywhere, inner must be non-null, however in places where
1362     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1363     */
1364    LDKnativeBolt12ParseError *inner;
1365    /**
1366     * Indicates that this is the only struct which contains the same pointer.
1367     * Rust functions which take ownership of an object provided via an argument require
1368     * this to be true and invalidate the object pointed to by inner.
1369     */
1370    bool is_owned;
1371 } LDKBolt12ParseError;
1372
1373 /**
1374  * The contents of CResult_RefundBolt12ParseErrorZ
1375  */
1376 typedef union LDKCResult_RefundBolt12ParseErrorZPtr {
1377    /**
1378     * A pointer to the contents in the success state.
1379     * Reading from this pointer when `result_ok` is not set is undefined.
1380     */
1381    struct LDKRefund *result;
1382    /**
1383     * A pointer to the contents in the error state.
1384     * Reading from this pointer when `result_ok` is set is undefined.
1385     */
1386    struct LDKBolt12ParseError *err;
1387 } LDKCResult_RefundBolt12ParseErrorZPtr;
1388
1389 /**
1390  * A CResult_RefundBolt12ParseErrorZ represents the result of a fallible operation,
1391  * containing a crate::lightning::offers::refund::Refund on success and a crate::lightning::offers::parse::Bolt12ParseError on failure.
1392  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1393  */
1394 typedef struct LDKCResult_RefundBolt12ParseErrorZ {
1395    /**
1396     * The contents of this CResult_RefundBolt12ParseErrorZ, accessible via either
1397     * `err` or `result` depending on the state of `result_ok`.
1398     */
1399    union LDKCResult_RefundBolt12ParseErrorZPtr contents;
1400    /**
1401     * Whether this CResult_RefundBolt12ParseErrorZ represents a success state.
1402     */
1403    bool result_ok;
1404 } LDKCResult_RefundBolt12ParseErrorZ;
1405
1406 /**
1407  * Strategies available to retry payment path failures.
1408  */
1409 typedef enum LDKRetry_Tag {
1410    /**
1411     * Max number of attempts to retry payment.
1412     *
1413     * Each attempt may be multiple HTLCs along multiple paths if the router decides to split up a
1414     * retry, and may retry multiple failed HTLCs at once if they failed around the same time and
1415     * were retried along a route from a single call to [`Router::find_route_with_id`].
1416     */
1417    LDKRetry_Attempts,
1418    /**
1419     * Time elapsed before abandoning retries for a payment. At least one attempt at payment is made;
1420     * see [`PaymentParameters::expiry_time`] to avoid any attempt at payment after a specific time.
1421     *
1422     * [`PaymentParameters::expiry_time`]: crate::routing::router::PaymentParameters::expiry_time
1423     */
1424    LDKRetry_Timeout,
1425    /**
1426     * Must be last for serialization purposes
1427     */
1428    LDKRetry_Sentinel,
1429 } LDKRetry_Tag;
1430
1431 typedef struct MUST_USE_STRUCT LDKRetry {
1432    LDKRetry_Tag tag;
1433    union {
1434       struct {
1435          uint32_t attempts;
1436       };
1437       struct {
1438          uint64_t timeout;
1439       };
1440    };
1441 } LDKRetry;
1442
1443 /**
1444  * An error in decoding a message or struct.
1445  */
1446 typedef enum LDKDecodeError_Tag {
1447    /**
1448     * A version byte specified something we don't know how to handle.
1449     *
1450     * Includes unknown realm byte in an onion hop data packet.
1451     */
1452    LDKDecodeError_UnknownVersion,
1453    /**
1454     * Unknown feature mandating we fail to parse message (e.g., TLV with an even, unknown type)
1455     */
1456    LDKDecodeError_UnknownRequiredFeature,
1457    /**
1458     * Value was invalid.
1459     *
1460     * For example, a byte which was supposed to be a bool was something other than a 0
1461     * or 1, a public key/private key/signature was invalid, text wasn't UTF-8, TLV was
1462     * syntactically incorrect, etc.
1463     */
1464    LDKDecodeError_InvalidValue,
1465    /**
1466     * The buffer to be read was too short.
1467     */
1468    LDKDecodeError_ShortRead,
1469    /**
1470     * A length descriptor in the packet didn't describe the later data correctly.
1471     */
1472    LDKDecodeError_BadLengthDescriptor,
1473    /**
1474     * Error from [`std::io`].
1475     */
1476    LDKDecodeError_Io,
1477    /**
1478     * The message included zlib-compressed values, which we don't support.
1479     */
1480    LDKDecodeError_UnsupportedCompression,
1481    /**
1482     * Value is validly encoded but is dangerous to use.
1483     *
1484     * This is used for things like [`ChannelManager`] deserialization where we want to ensure
1485     * that we don't use a [`ChannelManager`] which is in out of sync with the [`ChannelMonitor`].
1486     * This indicates that there is a critical implementation flaw in the storage implementation
1487     * and it's unsafe to continue.
1488     *
1489     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
1490     * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor
1491     */
1492    LDKDecodeError_DangerousValue,
1493    /**
1494     * Must be last for serialization purposes
1495     */
1496    LDKDecodeError_Sentinel,
1497 } LDKDecodeError_Tag;
1498
1499 typedef struct MUST_USE_STRUCT LDKDecodeError {
1500    LDKDecodeError_Tag tag;
1501    union {
1502       struct {
1503          enum LDKIOError io;
1504       };
1505    };
1506 } LDKDecodeError;
1507
1508 /**
1509  * The contents of CResult_RetryDecodeErrorZ
1510  */
1511 typedef union LDKCResult_RetryDecodeErrorZPtr {
1512    /**
1513     * A pointer to the contents in the success state.
1514     * Reading from this pointer when `result_ok` is not set is undefined.
1515     */
1516    struct LDKRetry *result;
1517    /**
1518     * A pointer to the contents in the error state.
1519     * Reading from this pointer when `result_ok` is set is undefined.
1520     */
1521    struct LDKDecodeError *err;
1522 } LDKCResult_RetryDecodeErrorZPtr;
1523
1524 /**
1525  * A CResult_RetryDecodeErrorZ represents the result of a fallible operation,
1526  * containing a crate::lightning::ln::outbound_payment::Retry on success and a crate::lightning::ln::msgs::DecodeError on failure.
1527  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1528  */
1529 typedef struct LDKCResult_RetryDecodeErrorZ {
1530    /**
1531     * The contents of this CResult_RetryDecodeErrorZ, accessible via either
1532     * `err` or `result` depending on the state of `result_ok`.
1533     */
1534    union LDKCResult_RetryDecodeErrorZPtr contents;
1535    /**
1536     * Whether this CResult_RetryDecodeErrorZ represents a success state.
1537     */
1538    bool result_ok;
1539 } LDKCResult_RetryDecodeErrorZ;
1540
1541
1542
1543 /**
1544  * A script pubkey for shutting down a channel as defined by [BOLT #2].
1545  *
1546  * [BOLT #2]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md
1547  */
1548 typedef struct MUST_USE_STRUCT LDKShutdownScript {
1549    /**
1550     * A pointer to the opaque Rust object.
1551     * Nearly everywhere, inner must be non-null, however in places where
1552     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1553     */
1554    LDKnativeShutdownScript *inner;
1555    /**
1556     * Indicates that this is the only struct which contains the same pointer.
1557     * Rust functions which take ownership of an object provided via an argument require
1558     * this to be true and invalidate the object pointed to by inner.
1559     */
1560    bool is_owned;
1561 } LDKShutdownScript;
1562
1563 /**
1564  * Indicates an error on the client's part (usually some variant of attempting to use too-low or
1565  * too-high values)
1566  */
1567 typedef enum LDKAPIError_Tag {
1568    /**
1569     * Indicates the API was wholly misused (see err for more). Cases where these can be returned
1570     * are documented, but generally indicates some precondition of a function was violated.
1571     */
1572    LDKAPIError_APIMisuseError,
1573    /**
1574     * Due to a high feerate, we were unable to complete the request.
1575     * For example, this may be returned if the feerate implies we cannot open a channel at the
1576     * requested value, but opening a larger channel would succeed.
1577     */
1578    LDKAPIError_FeeRateTooHigh,
1579    /**
1580     * A malformed Route was provided (eg overflowed value, node id mismatch, overly-looped route,
1581     * too-many-hops, etc).
1582     */
1583    LDKAPIError_InvalidRoute,
1584    /**
1585     * We were unable to complete the request as the Channel required to do so is unable to
1586     * complete the request (or was not found). This can take many forms, including disconnected
1587     * peer, channel at capacity, channel shutting down, etc.
1588     */
1589    LDKAPIError_ChannelUnavailable,
1590    /**
1591     * An attempt to call [`chain::Watch::watch_channel`]/[`chain::Watch::update_channel`]
1592     * returned a [`ChannelMonitorUpdateStatus::InProgress`] indicating the persistence of a
1593     * monitor update is awaiting async resolution. Once it resolves the attempted action should
1594     * complete automatically.
1595     *
1596     * [`chain::Watch::watch_channel`]: crate::chain::Watch::watch_channel
1597     * [`chain::Watch::update_channel`]: crate::chain::Watch::update_channel
1598     * [`ChannelMonitorUpdateStatus::InProgress`]: crate::chain::ChannelMonitorUpdateStatus::InProgress
1599     */
1600    LDKAPIError_MonitorUpdateInProgress,
1601    /**
1602     * [`SignerProvider::get_shutdown_scriptpubkey`] returned a shutdown scriptpubkey incompatible
1603     * with the channel counterparty as negotiated in [`InitFeatures`].
1604     *
1605     * Using a SegWit v0 script should resolve this issue. If you cannot, you won't be able to open
1606     * a channel or cooperatively close one with this peer (and will have to force-close instead).
1607     *
1608     * [`SignerProvider::get_shutdown_scriptpubkey`]: crate::sign::SignerProvider::get_shutdown_scriptpubkey
1609     * [`InitFeatures`]: crate::ln::features::InitFeatures
1610     */
1611    LDKAPIError_IncompatibleShutdownScript,
1612    /**
1613     * Must be last for serialization purposes
1614     */
1615    LDKAPIError_Sentinel,
1616 } LDKAPIError_Tag;
1617
1618 typedef struct LDKAPIError_LDKAPIMisuseError_Body {
1619    /**
1620     * A human-readable error message
1621     */
1622    struct LDKStr err;
1623 } LDKAPIError_LDKAPIMisuseError_Body;
1624
1625 typedef struct LDKAPIError_LDKFeeRateTooHigh_Body {
1626    /**
1627     * A human-readable error message
1628     */
1629    struct LDKStr err;
1630    /**
1631     * The feerate which was too high.
1632     */
1633    uint32_t feerate;
1634 } LDKAPIError_LDKFeeRateTooHigh_Body;
1635
1636 typedef struct LDKAPIError_LDKInvalidRoute_Body {
1637    /**
1638     * A human-readable error message
1639     */
1640    struct LDKStr err;
1641 } LDKAPIError_LDKInvalidRoute_Body;
1642
1643 typedef struct LDKAPIError_LDKChannelUnavailable_Body {
1644    /**
1645     * A human-readable error message
1646     */
1647    struct LDKStr err;
1648 } LDKAPIError_LDKChannelUnavailable_Body;
1649
1650 typedef struct LDKAPIError_LDKIncompatibleShutdownScript_Body {
1651    /**
1652     * The incompatible shutdown script.
1653     */
1654    struct LDKShutdownScript script;
1655 } LDKAPIError_LDKIncompatibleShutdownScript_Body;
1656
1657 typedef struct MUST_USE_STRUCT LDKAPIError {
1658    LDKAPIError_Tag tag;
1659    union {
1660       LDKAPIError_LDKAPIMisuseError_Body api_misuse_error;
1661       LDKAPIError_LDKFeeRateTooHigh_Body fee_rate_too_high;
1662       LDKAPIError_LDKInvalidRoute_Body invalid_route;
1663       LDKAPIError_LDKChannelUnavailable_Body channel_unavailable;
1664       LDKAPIError_LDKIncompatibleShutdownScript_Body incompatible_shutdown_script;
1665    };
1666 } LDKAPIError;
1667
1668 /**
1669  * The contents of CResult_NoneAPIErrorZ
1670  */
1671 typedef union LDKCResult_NoneAPIErrorZPtr {
1672    /**
1673     * Note that this value is always NULL, as there are no contents in the OK variant
1674     */
1675    void *result;
1676    /**
1677     * A pointer to the contents in the error state.
1678     * Reading from this pointer when `result_ok` is set is undefined.
1679     */
1680    struct LDKAPIError *err;
1681 } LDKCResult_NoneAPIErrorZPtr;
1682
1683 /**
1684  * A CResult_NoneAPIErrorZ represents the result of a fallible operation,
1685  * containing a () on success and a crate::lightning::util::errors::APIError on failure.
1686  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1687  */
1688 typedef struct LDKCResult_NoneAPIErrorZ {
1689    /**
1690     * The contents of this CResult_NoneAPIErrorZ, accessible via either
1691     * `err` or `result` depending on the state of `result_ok`.
1692     */
1693    union LDKCResult_NoneAPIErrorZPtr contents;
1694    /**
1695     * Whether this CResult_NoneAPIErrorZ represents a success state.
1696     */
1697    bool result_ok;
1698 } LDKCResult_NoneAPIErrorZ;
1699
1700 /**
1701  * A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
1702  * This corresponds to std::vector in C++
1703  */
1704 typedef struct LDKCVec_CResult_NoneAPIErrorZZ {
1705    /**
1706     * The elements in the array.
1707     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1708     */
1709    struct LDKCResult_NoneAPIErrorZ *data;
1710    /**
1711     * The number of elements pointed to by `data`.
1712     */
1713    uintptr_t datalen;
1714 } LDKCVec_CResult_NoneAPIErrorZZ;
1715
1716 /**
1717  * A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
1718  * This corresponds to std::vector in C++
1719  */
1720 typedef struct LDKCVec_APIErrorZ {
1721    /**
1722     * The elements in the array.
1723     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1724     */
1725    struct LDKAPIError *data;
1726    /**
1727     * The number of elements pointed to by `data`.
1728     */
1729    uintptr_t datalen;
1730 } LDKCVec_APIErrorZ;
1731
1732 /**
1733  * An enum which can either contain a crate::c_types::ThirtyTwoBytes or not
1734  */
1735 typedef enum LDKCOption_ThirtyTwoBytesZ_Tag {
1736    /**
1737     * When we're in this state, this COption_ThirtyTwoBytesZ contains a crate::c_types::ThirtyTwoBytes
1738     */
1739    LDKCOption_ThirtyTwoBytesZ_Some,
1740    /**
1741     * When we're in this state, this COption_ThirtyTwoBytesZ contains nothing
1742     */
1743    LDKCOption_ThirtyTwoBytesZ_None,
1744    /**
1745     * Must be last for serialization purposes
1746     */
1747    LDKCOption_ThirtyTwoBytesZ_Sentinel,
1748 } LDKCOption_ThirtyTwoBytesZ_Tag;
1749
1750 typedef struct LDKCOption_ThirtyTwoBytesZ {
1751    LDKCOption_ThirtyTwoBytesZ_Tag tag;
1752    union {
1753       struct {
1754          struct LDKThirtyTwoBytes some;
1755       };
1756    };
1757 } LDKCOption_ThirtyTwoBytesZ;
1758
1759 /**
1760  * An enum which can either contain a crate::c_types::derived::CVec_u8Z or not
1761  */
1762 typedef enum LDKCOption_CVec_u8ZZ_Tag {
1763    /**
1764     * When we're in this state, this COption_CVec_u8ZZ contains a crate::c_types::derived::CVec_u8Z
1765     */
1766    LDKCOption_CVec_u8ZZ_Some,
1767    /**
1768     * When we're in this state, this COption_CVec_u8ZZ contains nothing
1769     */
1770    LDKCOption_CVec_u8ZZ_None,
1771    /**
1772     * Must be last for serialization purposes
1773     */
1774    LDKCOption_CVec_u8ZZ_Sentinel,
1775 } LDKCOption_CVec_u8ZZ_Tag;
1776
1777 typedef struct LDKCOption_CVec_u8ZZ {
1778    LDKCOption_CVec_u8ZZ_Tag tag;
1779    union {
1780       struct {
1781          struct LDKCVec_u8Z some;
1782       };
1783    };
1784 } LDKCOption_CVec_u8ZZ;
1785
1786
1787
1788 /**
1789  * Information which is provided, encrypted, to the payment recipient when sending HTLCs.
1790  *
1791  * This should generally be constructed with data communicated to us from the recipient (via a
1792  * BOLT11 or BOLT12 invoice).
1793  */
1794 typedef struct MUST_USE_STRUCT LDKRecipientOnionFields {
1795    /**
1796     * A pointer to the opaque Rust object.
1797     * Nearly everywhere, inner must be non-null, however in places where
1798     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1799     */
1800    LDKnativeRecipientOnionFields *inner;
1801    /**
1802     * Indicates that this is the only struct which contains the same pointer.
1803     * Rust functions which take ownership of an object provided via an argument require
1804     * this to be true and invalidate the object pointed to by inner.
1805     */
1806    bool is_owned;
1807 } LDKRecipientOnionFields;
1808
1809 /**
1810  * The contents of CResult_RecipientOnionFieldsDecodeErrorZ
1811  */
1812 typedef union LDKCResult_RecipientOnionFieldsDecodeErrorZPtr {
1813    /**
1814     * A pointer to the contents in the success state.
1815     * Reading from this pointer when `result_ok` is not set is undefined.
1816     */
1817    struct LDKRecipientOnionFields *result;
1818    /**
1819     * A pointer to the contents in the error state.
1820     * Reading from this pointer when `result_ok` is set is undefined.
1821     */
1822    struct LDKDecodeError *err;
1823 } LDKCResult_RecipientOnionFieldsDecodeErrorZPtr;
1824
1825 /**
1826  * A CResult_RecipientOnionFieldsDecodeErrorZ represents the result of a fallible operation,
1827  * containing a crate::lightning::ln::outbound_payment::RecipientOnionFields on success and a crate::lightning::ln::msgs::DecodeError on failure.
1828  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1829  */
1830 typedef struct LDKCResult_RecipientOnionFieldsDecodeErrorZ {
1831    /**
1832     * The contents of this CResult_RecipientOnionFieldsDecodeErrorZ, accessible via either
1833     * `err` or `result` depending on the state of `result_ok`.
1834     */
1835    union LDKCResult_RecipientOnionFieldsDecodeErrorZPtr contents;
1836    /**
1837     * Whether this CResult_RecipientOnionFieldsDecodeErrorZ represents a success state.
1838     */
1839    bool result_ok;
1840 } LDKCResult_RecipientOnionFieldsDecodeErrorZ;
1841
1842 /**
1843  * A tuple of 2 elements. See the individual fields for the types contained.
1844  */
1845 typedef struct LDKC2Tuple_u64CVec_u8ZZ {
1846    /**
1847     * The element at position 0
1848     */
1849    uint64_t a;
1850    /**
1851     * The element at position 1
1852     */
1853    struct LDKCVec_u8Z b;
1854 } LDKC2Tuple_u64CVec_u8ZZ;
1855
1856 /**
1857  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u64CVec_u8ZZs of arbitrary size.
1858  * This corresponds to std::vector in C++
1859  */
1860 typedef struct LDKCVec_C2Tuple_u64CVec_u8ZZZ {
1861    /**
1862     * The elements in the array.
1863     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1864     */
1865    struct LDKC2Tuple_u64CVec_u8ZZ *data;
1866    /**
1867     * The number of elements pointed to by `data`.
1868     */
1869    uintptr_t datalen;
1870 } LDKCVec_C2Tuple_u64CVec_u8ZZZ;
1871
1872 /**
1873  * The contents of CResult_RecipientOnionFieldsNoneZ
1874  */
1875 typedef union LDKCResult_RecipientOnionFieldsNoneZPtr {
1876    /**
1877     * A pointer to the contents in the success state.
1878     * Reading from this pointer when `result_ok` is not set is undefined.
1879     */
1880    struct LDKRecipientOnionFields *result;
1881    /**
1882     * Note that this value is always NULL, as there are no contents in the Err variant
1883     */
1884    void *err;
1885 } LDKCResult_RecipientOnionFieldsNoneZPtr;
1886
1887 /**
1888  * A CResult_RecipientOnionFieldsNoneZ represents the result of a fallible operation,
1889  * containing a crate::lightning::ln::outbound_payment::RecipientOnionFields on success and a () on failure.
1890  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1891  */
1892 typedef struct LDKCResult_RecipientOnionFieldsNoneZ {
1893    /**
1894     * The contents of this CResult_RecipientOnionFieldsNoneZ, accessible via either
1895     * `err` or `result` depending on the state of `result_ok`.
1896     */
1897    union LDKCResult_RecipientOnionFieldsNoneZPtr contents;
1898    /**
1899     * Whether this CResult_RecipientOnionFieldsNoneZ represents a success state.
1900     */
1901    bool result_ok;
1902 } LDKCResult_RecipientOnionFieldsNoneZ;
1903
1904
1905
1906 /**
1907  * A semantically valid [`Bolt12Invoice`] that hasn't been signed.
1908  *
1909  * # Serialization
1910  *
1911  * This is serialized as a TLV stream, which includes TLV records from the originating message. As
1912  * such, it may include unknown, odd TLV records.
1913  */
1914 typedef struct MUST_USE_STRUCT LDKUnsignedBolt12Invoice {
1915    /**
1916     * A pointer to the opaque Rust object.
1917     * Nearly everywhere, inner must be non-null, however in places where
1918     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1919     */
1920    LDKnativeUnsignedBolt12Invoice *inner;
1921    /**
1922     * Indicates that this is the only struct which contains the same pointer.
1923     * Rust functions which take ownership of an object provided via an argument require
1924     * this to be true and invalidate the object pointed to by inner.
1925     */
1926    bool is_owned;
1927 } LDKUnsignedBolt12Invoice;
1928
1929 /**
1930  * The contents of CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ
1931  */
1932 typedef union LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZPtr {
1933    /**
1934     * A pointer to the contents in the success state.
1935     * Reading from this pointer when `result_ok` is not set is undefined.
1936     */
1937    struct LDKUnsignedBolt12Invoice *result;
1938    /**
1939     * A pointer to the contents in the error state.
1940     * Reading from this pointer when `result_ok` is set is undefined.
1941     */
1942    enum LDKBolt12SemanticError *err;
1943 } LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZPtr;
1944
1945 /**
1946  * A CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ represents the result of a fallible operation,
1947  * containing a crate::lightning::offers::invoice::UnsignedBolt12Invoice on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure.
1948  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1949  */
1950 typedef struct LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ {
1951    /**
1952     * The contents of this CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ, accessible via either
1953     * `err` or `result` depending on the state of `result_ok`.
1954     */
1955    union LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZPtr contents;
1956    /**
1957     * Whether this CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ represents a success state.
1958     */
1959    bool result_ok;
1960 } LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ;
1961
1962
1963
1964 /**
1965  * A `Bolt12Invoice` is a payment request, typically corresponding to an [`Offer`] or a [`Refund`].
1966  *
1967  * An invoice may be sent in response to an [`InvoiceRequest`] in the case of an offer or sent
1968  * directly after scanning a refund. It includes all the information needed to pay a recipient.
1969  *
1970  * [`Offer`]: crate::offers::offer::Offer
1971  * [`Refund`]: crate::offers::refund::Refund
1972  * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
1973  */
1974 typedef struct MUST_USE_STRUCT LDKBolt12Invoice {
1975    /**
1976     * A pointer to the opaque Rust object.
1977     * Nearly everywhere, inner must be non-null, however in places where
1978     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1979     */
1980    LDKnativeBolt12Invoice *inner;
1981    /**
1982     * Indicates that this is the only struct which contains the same pointer.
1983     * Rust functions which take ownership of an object provided via an argument require
1984     * this to be true and invalidate the object pointed to by inner.
1985     */
1986    bool is_owned;
1987 } LDKBolt12Invoice;
1988
1989 /**
1990  * The contents of CResult_Bolt12InvoiceBolt12SemanticErrorZ
1991  */
1992 typedef union LDKCResult_Bolt12InvoiceBolt12SemanticErrorZPtr {
1993    /**
1994     * A pointer to the contents in the success state.
1995     * Reading from this pointer when `result_ok` is not set is undefined.
1996     */
1997    struct LDKBolt12Invoice *result;
1998    /**
1999     * A pointer to the contents in the error state.
2000     * Reading from this pointer when `result_ok` is set is undefined.
2001     */
2002    enum LDKBolt12SemanticError *err;
2003 } LDKCResult_Bolt12InvoiceBolt12SemanticErrorZPtr;
2004
2005 /**
2006  * A CResult_Bolt12InvoiceBolt12SemanticErrorZ represents the result of a fallible operation,
2007  * containing a crate::lightning::offers::invoice::Bolt12Invoice on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure.
2008  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2009  */
2010 typedef struct LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ {
2011    /**
2012     * The contents of this CResult_Bolt12InvoiceBolt12SemanticErrorZ, accessible via either
2013     * `err` or `result` depending on the state of `result_ok`.
2014     */
2015    union LDKCResult_Bolt12InvoiceBolt12SemanticErrorZPtr contents;
2016    /**
2017     * Whether this CResult_Bolt12InvoiceBolt12SemanticErrorZ represents a success state.
2018     */
2019    bool result_ok;
2020 } LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ;
2021
2022 /**
2023  * Represents a secp256k1 Schnorr signature serialized as two 32-byte numbers
2024  */
2025 typedef struct LDKSchnorrSignature {
2026    /**
2027     * The bytes of the signature as two 32-byte numbers
2028     */
2029    uint8_t compact_form[64];
2030 } LDKSchnorrSignature;
2031
2032 /**
2033  * The contents of CResult_SchnorrSignatureNoneZ
2034  */
2035 typedef union LDKCResult_SchnorrSignatureNoneZPtr {
2036    /**
2037     * A pointer to the contents in the success state.
2038     * Reading from this pointer when `result_ok` is not set is undefined.
2039     */
2040    struct LDKSchnorrSignature *result;
2041    /**
2042     * Note that this value is always NULL, as there are no contents in the Err variant
2043     */
2044    void *err;
2045 } LDKCResult_SchnorrSignatureNoneZPtr;
2046
2047 /**
2048  * A CResult_SchnorrSignatureNoneZ represents the result of a fallible operation,
2049  * containing a crate::c_types::SchnorrSignature on success and a () on failure.
2050  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2051  */
2052 typedef struct LDKCResult_SchnorrSignatureNoneZ {
2053    /**
2054     * The contents of this CResult_SchnorrSignatureNoneZ, accessible via either
2055     * `err` or `result` depending on the state of `result_ok`.
2056     */
2057    union LDKCResult_SchnorrSignatureNoneZPtr contents;
2058    /**
2059     * Whether this CResult_SchnorrSignatureNoneZ represents a success state.
2060     */
2061    bool result_ok;
2062 } LDKCResult_SchnorrSignatureNoneZ;
2063
2064 /**
2065  * A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
2066  * This corresponds to std::vector in C++
2067  */
2068 typedef struct LDKCVec_ThirtyTwoBytesZ {
2069    /**
2070     * The elements in the array.
2071     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2072     */
2073    struct LDKThirtyTwoBytes *data;
2074    /**
2075     * The number of elements pointed to by `data`.
2076     */
2077    uintptr_t datalen;
2078 } LDKCVec_ThirtyTwoBytesZ;
2079
2080 /**
2081  * An enum which can either contain a crate::c_types::derived::CVec_ThirtyTwoBytesZ or not
2082  */
2083 typedef enum LDKCOption_CVec_ThirtyTwoBytesZZ_Tag {
2084    /**
2085     * When we're in this state, this COption_CVec_ThirtyTwoBytesZZ contains a crate::c_types::derived::CVec_ThirtyTwoBytesZ
2086     */
2087    LDKCOption_CVec_ThirtyTwoBytesZZ_Some,
2088    /**
2089     * When we're in this state, this COption_CVec_ThirtyTwoBytesZZ contains nothing
2090     */
2091    LDKCOption_CVec_ThirtyTwoBytesZZ_None,
2092    /**
2093     * Must be last for serialization purposes
2094     */
2095    LDKCOption_CVec_ThirtyTwoBytesZZ_Sentinel,
2096 } LDKCOption_CVec_ThirtyTwoBytesZZ_Tag;
2097
2098 typedef struct LDKCOption_CVec_ThirtyTwoBytesZZ {
2099    LDKCOption_CVec_ThirtyTwoBytesZZ_Tag tag;
2100    union {
2101       struct {
2102          struct LDKCVec_ThirtyTwoBytesZ some;
2103       };
2104    };
2105 } LDKCOption_CVec_ThirtyTwoBytesZZ;
2106
2107 /**
2108  * A 3-byte byte array.
2109  */
2110 typedef struct LDKThreeBytes {
2111    /**
2112     * The three bytes
2113     */
2114    uint8_t data[3];
2115 } LDKThreeBytes;
2116
2117 /**
2118  * The minimum amount required for an item in an [`Offer`], denominated in either bitcoin or
2119  * another currency.
2120  */
2121 typedef enum LDKAmount_Tag {
2122    /**
2123     * An amount of bitcoin.
2124     */
2125    LDKAmount_Bitcoin,
2126    /**
2127     * An amount of currency specified using ISO 4712.
2128     */
2129    LDKAmount_Currency,
2130    /**
2131     * Must be last for serialization purposes
2132     */
2133    LDKAmount_Sentinel,
2134 } LDKAmount_Tag;
2135
2136 typedef struct LDKAmount_LDKBitcoin_Body {
2137    /**
2138     * The amount in millisatoshi.
2139     */
2140    uint64_t amount_msats;
2141 } LDKAmount_LDKBitcoin_Body;
2142
2143 typedef struct LDKAmount_LDKCurrency_Body {
2144    /**
2145     * The currency that the amount is denominated in.
2146     */
2147    struct LDKThreeBytes iso4217_code;
2148    /**
2149     * The amount in the currency unit adjusted by the ISO 4712 exponent (e.g., USD cents).
2150     */
2151    uint64_t amount;
2152 } LDKAmount_LDKCurrency_Body;
2153
2154 typedef struct MUST_USE_STRUCT LDKAmount {
2155    LDKAmount_Tag tag;
2156    union {
2157       LDKAmount_LDKBitcoin_Body bitcoin;
2158       LDKAmount_LDKCurrency_Body currency;
2159    };
2160 } LDKAmount;
2161
2162 /**
2163  * An enum which can either contain a crate::lightning::offers::offer::Amount or not
2164  */
2165 typedef enum LDKCOption_AmountZ_Tag {
2166    /**
2167     * When we're in this state, this COption_AmountZ contains a crate::lightning::offers::offer::Amount
2168     */
2169    LDKCOption_AmountZ_Some,
2170    /**
2171     * When we're in this state, this COption_AmountZ contains nothing
2172     */
2173    LDKCOption_AmountZ_None,
2174    /**
2175     * Must be last for serialization purposes
2176     */
2177    LDKCOption_AmountZ_Sentinel,
2178 } LDKCOption_AmountZ_Tag;
2179
2180 typedef struct LDKCOption_AmountZ {
2181    LDKCOption_AmountZ_Tag tag;
2182    union {
2183       struct {
2184          struct LDKAmount some;
2185       };
2186    };
2187 } LDKCOption_AmountZ;
2188
2189 /**
2190  * Quantity of items supported by an [`Offer`].
2191  */
2192 typedef enum LDKQuantity_Tag {
2193    /**
2194     * Up to a specific number of items (inclusive). Use when more than one item can be requested
2195     * but is limited (e.g., because of per customer or inventory limits).
2196     *
2197     * May be used with `NonZeroU64::new(1)` but prefer to use [`Quantity::One`] if only one item
2198     * is supported.
2199     */
2200    LDKQuantity_Bounded,
2201    /**
2202     * One or more items. Use when more than one item can be requested without any limit.
2203     */
2204    LDKQuantity_Unbounded,
2205    /**
2206     * Only one item. Use when only a single item can be requested.
2207     */
2208    LDKQuantity_One,
2209    /**
2210     * Must be last for serialization purposes
2211     */
2212    LDKQuantity_Sentinel,
2213 } LDKQuantity_Tag;
2214
2215 typedef struct MUST_USE_STRUCT LDKQuantity {
2216    LDKQuantity_Tag tag;
2217    union {
2218       struct {
2219          uint64_t bounded;
2220       };
2221    };
2222 } LDKQuantity;
2223
2224 /**
2225  * An enum which can either contain a crate::lightning::offers::offer::Quantity or not
2226  */
2227 typedef enum LDKCOption_QuantityZ_Tag {
2228    /**
2229     * When we're in this state, this COption_QuantityZ contains a crate::lightning::offers::offer::Quantity
2230     */
2231    LDKCOption_QuantityZ_Some,
2232    /**
2233     * When we're in this state, this COption_QuantityZ contains nothing
2234     */
2235    LDKCOption_QuantityZ_None,
2236    /**
2237     * Must be last for serialization purposes
2238     */
2239    LDKCOption_QuantityZ_Sentinel,
2240 } LDKCOption_QuantityZ_Tag;
2241
2242 typedef struct LDKCOption_QuantityZ {
2243    LDKCOption_QuantityZ_Tag tag;
2244    union {
2245       struct {
2246          struct LDKQuantity some;
2247       };
2248    };
2249 } LDKCOption_QuantityZ;
2250
2251 /**
2252  * The contents of CResult_ThirtyTwoBytesNoneZ
2253  */
2254 typedef union LDKCResult_ThirtyTwoBytesNoneZPtr {
2255    /**
2256     * A pointer to the contents in the success state.
2257     * Reading from this pointer when `result_ok` is not set is undefined.
2258     */
2259    struct LDKThirtyTwoBytes *result;
2260    /**
2261     * Note that this value is always NULL, as there are no contents in the Err variant
2262     */
2263    void *err;
2264 } LDKCResult_ThirtyTwoBytesNoneZPtr;
2265
2266 /**
2267  * A CResult_ThirtyTwoBytesNoneZ represents the result of a fallible operation,
2268  * containing a crate::c_types::ThirtyTwoBytes on success and a () on failure.
2269  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2270  */
2271 typedef struct LDKCResult_ThirtyTwoBytesNoneZ {
2272    /**
2273     * The contents of this CResult_ThirtyTwoBytesNoneZ, accessible via either
2274     * `err` or `result` depending on the state of `result_ok`.
2275     */
2276    union LDKCResult_ThirtyTwoBytesNoneZPtr contents;
2277    /**
2278     * Whether this CResult_ThirtyTwoBytesNoneZ represents a success state.
2279     */
2280    bool result_ok;
2281 } LDKCResult_ThirtyTwoBytesNoneZ;
2282
2283
2284
2285 /**
2286  * Information needed to route a payment across a [`BlindedPath`].
2287  */
2288 typedef struct MUST_USE_STRUCT LDKBlindedPayInfo {
2289    /**
2290     * A pointer to the opaque Rust object.
2291     * Nearly everywhere, inner must be non-null, however in places where
2292     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2293     */
2294    LDKnativeBlindedPayInfo *inner;
2295    /**
2296     * Indicates that this is the only struct which contains the same pointer.
2297     * Rust functions which take ownership of an object provided via an argument require
2298     * this to be true and invalidate the object pointed to by inner.
2299     */
2300    bool is_owned;
2301 } LDKBlindedPayInfo;
2302
2303 /**
2304  * The contents of CResult_BlindedPayInfoDecodeErrorZ
2305  */
2306 typedef union LDKCResult_BlindedPayInfoDecodeErrorZPtr {
2307    /**
2308     * A pointer to the contents in the success state.
2309     * Reading from this pointer when `result_ok` is not set is undefined.
2310     */
2311    struct LDKBlindedPayInfo *result;
2312    /**
2313     * A pointer to the contents in the error state.
2314     * Reading from this pointer when `result_ok` is set is undefined.
2315     */
2316    struct LDKDecodeError *err;
2317 } LDKCResult_BlindedPayInfoDecodeErrorZPtr;
2318
2319 /**
2320  * A CResult_BlindedPayInfoDecodeErrorZ represents the result of a fallible operation,
2321  * containing a crate::lightning::offers::invoice::BlindedPayInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
2322  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2323  */
2324 typedef struct LDKCResult_BlindedPayInfoDecodeErrorZ {
2325    /**
2326     * The contents of this CResult_BlindedPayInfoDecodeErrorZ, accessible via either
2327     * `err` or `result` depending on the state of `result_ok`.
2328     */
2329    union LDKCResult_BlindedPayInfoDecodeErrorZPtr contents;
2330    /**
2331     * Whether this CResult_BlindedPayInfoDecodeErrorZ represents a success state.
2332     */
2333    bool result_ok;
2334 } LDKCResult_BlindedPayInfoDecodeErrorZ;
2335
2336
2337
2338 /**
2339  * Information about a spendable output to a P2WSH script.
2340  *
2341  * See [`SpendableOutputDescriptor::DelayedPaymentOutput`] for more details on how to spend this.
2342  */
2343 typedef struct MUST_USE_STRUCT LDKDelayedPaymentOutputDescriptor {
2344    /**
2345     * A pointer to the opaque Rust object.
2346     * Nearly everywhere, inner must be non-null, however in places where
2347     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2348     */
2349    LDKnativeDelayedPaymentOutputDescriptor *inner;
2350    /**
2351     * Indicates that this is the only struct which contains the same pointer.
2352     * Rust functions which take ownership of an object provided via an argument require
2353     * this to be true and invalidate the object pointed to by inner.
2354     */
2355    bool is_owned;
2356 } LDKDelayedPaymentOutputDescriptor;
2357
2358 /**
2359  * The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
2360  */
2361 typedef union LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
2362    /**
2363     * A pointer to the contents in the success state.
2364     * Reading from this pointer when `result_ok` is not set is undefined.
2365     */
2366    struct LDKDelayedPaymentOutputDescriptor *result;
2367    /**
2368     * A pointer to the contents in the error state.
2369     * Reading from this pointer when `result_ok` is set is undefined.
2370     */
2371    struct LDKDecodeError *err;
2372 } LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr;
2373
2374 /**
2375  * A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
2376  * containing a crate::lightning::sign::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
2377  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2378  */
2379 typedef struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
2380    /**
2381     * The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
2382     * `err` or `result` depending on the state of `result_ok`.
2383     */
2384    union LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr contents;
2385    /**
2386     * Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
2387     */
2388    bool result_ok;
2389 } LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ;
2390
2391
2392
2393 /**
2394  * Information about a spendable output to our \"payment key\".
2395  *
2396  * See [`SpendableOutputDescriptor::StaticPaymentOutput`] for more details on how to spend this.
2397  */
2398 typedef struct MUST_USE_STRUCT LDKStaticPaymentOutputDescriptor {
2399    /**
2400     * A pointer to the opaque Rust object.
2401     * Nearly everywhere, inner must be non-null, however in places where
2402     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2403     */
2404    LDKnativeStaticPaymentOutputDescriptor *inner;
2405    /**
2406     * Indicates that this is the only struct which contains the same pointer.
2407     * Rust functions which take ownership of an object provided via an argument require
2408     * this to be true and invalidate the object pointed to by inner.
2409     */
2410    bool is_owned;
2411 } LDKStaticPaymentOutputDescriptor;
2412
2413 /**
2414  * The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
2415  */
2416 typedef union LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
2417    /**
2418     * A pointer to the contents in the success state.
2419     * Reading from this pointer when `result_ok` is not set is undefined.
2420     */
2421    struct LDKStaticPaymentOutputDescriptor *result;
2422    /**
2423     * A pointer to the contents in the error state.
2424     * Reading from this pointer when `result_ok` is set is undefined.
2425     */
2426    struct LDKDecodeError *err;
2427 } LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr;
2428
2429 /**
2430  * A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
2431  * containing a crate::lightning::sign::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
2432  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2433  */
2434 typedef struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ {
2435    /**
2436     * The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
2437     * `err` or `result` depending on the state of `result_ok`.
2438     */
2439    union LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr contents;
2440    /**
2441     * Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
2442     */
2443    bool result_ok;
2444 } LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ;
2445
2446
2447
2448 /**
2449  * A reference to a transaction output.
2450  *
2451  * Differs from bitcoin::blockdata::transaction::OutPoint as the index is a u16 instead of u32
2452  * due to LN's restrictions on index values. Should reduce (possibly) unsafe conversions this way.
2453  */
2454 typedef struct MUST_USE_STRUCT LDKOutPoint {
2455    /**
2456     * A pointer to the opaque Rust object.
2457     * Nearly everywhere, inner must be non-null, however in places where
2458     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2459     */
2460    LDKnativeOutPoint *inner;
2461    /**
2462     * Indicates that this is the only struct which contains the same pointer.
2463     * Rust functions which take ownership of an object provided via an argument require
2464     * this to be true and invalidate the object pointed to by inner.
2465     */
2466    bool is_owned;
2467 } LDKOutPoint;
2468
2469 /**
2470  * Describes the necessary information to spend a spendable output.
2471  *
2472  * When on-chain outputs are created by LDK (which our counterparty is not able to claim at any
2473  * point in the future) a [`SpendableOutputs`] event is generated which you must track and be able
2474  * to spend on-chain. The information needed to do this is provided in this enum, including the
2475  * outpoint describing which `txid` and output `index` is available, the full output which exists
2476  * at that `txid`/`index`, and any keys or other information required to sign.
2477  *
2478  * [`SpendableOutputs`]: crate::events::Event::SpendableOutputs
2479  */
2480 typedef enum LDKSpendableOutputDescriptor_Tag {
2481    /**
2482     * An output to a script which was provided via [`SignerProvider`] directly, either from
2483     * [`get_destination_script`] or [`get_shutdown_scriptpubkey`], thus you should already
2484     * know how to spend it. No secret keys are provided as LDK was never given any key.
2485     * These may include outputs from a transaction punishing our counterparty or claiming an HTLC
2486     * on-chain using the payment preimage or after it has timed out.
2487     *
2488     * [`get_shutdown_scriptpubkey`]: SignerProvider::get_shutdown_scriptpubkey
2489     * [`get_destination_script`]: SignerProvider::get_shutdown_scriptpubkey
2490     */
2491    LDKSpendableOutputDescriptor_StaticOutput,
2492    /**
2493     * An output to a P2WSH script which can be spent with a single signature after an `OP_CSV`
2494     * delay.
2495     *
2496     * The witness in the spending input should be:
2497     * ```bitcoin
2498     * <BIP 143 signature> <empty vector> (MINIMALIF standard rule) <provided witnessScript>
2499     * ```
2500     *
2501     * Note that the `nSequence` field in the spending input must be set to
2502     * [`DelayedPaymentOutputDescriptor::to_self_delay`] (which means the transaction is not
2503     * broadcastable until at least [`DelayedPaymentOutputDescriptor::to_self_delay`] blocks after
2504     * the outpoint confirms, see [BIP
2505     * 68](https://github.com/bitcoin/bips/blob/master/bip-0068.mediawiki)). Also note that LDK
2506     * won't generate a [`SpendableOutputDescriptor`] until the corresponding block height
2507     * is reached.
2508     *
2509     * These are generally the result of a \"revocable\" output to us, spendable only by us unless
2510     * it is an output from an old state which we broadcast (which should never happen).
2511     *
2512     * To derive the delayed payment key which is used to sign this input, you must pass the
2513     * holder [`InMemorySigner::delayed_payment_base_key`] (i.e., the private key which corresponds to the
2514     * [`ChannelPublicKeys::delayed_payment_basepoint`] in [`ChannelSigner::pubkeys`]) and the provided
2515     * [`DelayedPaymentOutputDescriptor::per_commitment_point`] to [`chan_utils::derive_private_key`]. The DelayedPaymentKey can be
2516     * generated without the secret key using [`DelayedPaymentKey::from_basepoint`] and only the
2517     * [`ChannelPublicKeys::delayed_payment_basepoint`] which appears in [`ChannelSigner::pubkeys`].
2518     *
2519     * To derive the [`DelayedPaymentOutputDescriptor::revocation_pubkey`] provided here (which is
2520     * used in the witness script generation), you must pass the counterparty
2521     * [`ChannelPublicKeys::revocation_basepoint`] (which appears in the call to
2522     * [`ChannelSigner::provide_channel_parameters`]) and the provided
2523     * [`DelayedPaymentOutputDescriptor::per_commitment_point`] to
2524     * [`RevocationKey`].
2525     *
2526     * The witness script which is hashed and included in the output `script_pubkey` may be
2527     * regenerated by passing the [`DelayedPaymentOutputDescriptor::revocation_pubkey`] (derived
2528     * as explained above), our delayed payment pubkey (derived as explained above), and the
2529     * [`DelayedPaymentOutputDescriptor::to_self_delay`] contained here to
2530     * [`chan_utils::get_revokeable_redeemscript`].
2531     */
2532    LDKSpendableOutputDescriptor_DelayedPaymentOutput,
2533    /**
2534     * An output spendable exclusively by our payment key (i.e., the private key that corresponds
2535     * to the `payment_point` in [`ChannelSigner::pubkeys`]). The output type depends on the
2536     * channel type negotiated.
2537     *
2538     * On an anchor outputs channel, the witness in the spending input is:
2539     * ```bitcoin
2540     * <BIP 143 signature> <witness script>
2541     * ```
2542     *
2543     * Otherwise, it is:
2544     * ```bitcoin
2545     * <BIP 143 signature> <payment key>
2546     * ```
2547     *
2548     * These are generally the result of our counterparty having broadcast the current state,
2549     * allowing us to claim the non-HTLC-encumbered outputs immediately, or after one confirmation
2550     * in the case of anchor outputs channels.
2551     */
2552    LDKSpendableOutputDescriptor_StaticPaymentOutput,
2553    /**
2554     * Must be last for serialization purposes
2555     */
2556    LDKSpendableOutputDescriptor_Sentinel,
2557 } LDKSpendableOutputDescriptor_Tag;
2558
2559 typedef struct LDKSpendableOutputDescriptor_LDKStaticOutput_Body {
2560    /**
2561     * The outpoint which is spendable.
2562     */
2563    struct LDKOutPoint outpoint;
2564    /**
2565     * The output which is referenced by the given outpoint.
2566     */
2567    struct LDKTxOut output;
2568    /**
2569     * The `channel_keys_id` for the channel which this output came from.
2570     *
2571     * For channels which were generated on LDK 0.0.119 or later, this is the value which was
2572     * passed to the [`SignerProvider::get_destination_script`] call which provided this
2573     * output script.
2574     *
2575     * For channels which were generated prior to LDK 0.0.119, no such argument existed,
2576     * however this field may still be filled in if such data is available.
2577     *
2578     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
2579     */
2580    struct LDKThirtyTwoBytes channel_keys_id;
2581 } LDKSpendableOutputDescriptor_LDKStaticOutput_Body;
2582
2583 typedef struct MUST_USE_STRUCT LDKSpendableOutputDescriptor {
2584    LDKSpendableOutputDescriptor_Tag tag;
2585    union {
2586       LDKSpendableOutputDescriptor_LDKStaticOutput_Body static_output;
2587       struct {
2588          struct LDKDelayedPaymentOutputDescriptor delayed_payment_output;
2589       };
2590       struct {
2591          struct LDKStaticPaymentOutputDescriptor static_payment_output;
2592       };
2593    };
2594 } LDKSpendableOutputDescriptor;
2595
2596 /**
2597  * The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
2598  */
2599 typedef union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr {
2600    /**
2601     * A pointer to the contents in the success state.
2602     * Reading from this pointer when `result_ok` is not set is undefined.
2603     */
2604    struct LDKSpendableOutputDescriptor *result;
2605    /**
2606     * A pointer to the contents in the error state.
2607     * Reading from this pointer when `result_ok` is set is undefined.
2608     */
2609    struct LDKDecodeError *err;
2610 } LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr;
2611
2612 /**
2613  * A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
2614  * containing a crate::lightning::sign::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
2615  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2616  */
2617 typedef struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ {
2618    /**
2619     * The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
2620     * `err` or `result` depending on the state of `result_ok`.
2621     */
2622    union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr contents;
2623    /**
2624     * Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
2625     */
2626    bool result_ok;
2627 } LDKCResult_SpendableOutputDescriptorDecodeErrorZ;
2628
2629 /**
2630  * A dynamically-allocated array of crate::lightning::sign::SpendableOutputDescriptors of arbitrary size.
2631  * This corresponds to std::vector in C++
2632  */
2633 typedef struct LDKCVec_SpendableOutputDescriptorZ {
2634    /**
2635     * The elements in the array.
2636     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2637     */
2638    struct LDKSpendableOutputDescriptor *data;
2639    /**
2640     * The number of elements pointed to by `data`.
2641     */
2642    uintptr_t datalen;
2643 } LDKCVec_SpendableOutputDescriptorZ;
2644
2645 /**
2646  * A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
2647  * This corresponds to std::vector in C++
2648  */
2649 typedef struct LDKCVec_TxOutZ {
2650    /**
2651     * The elements in the array.
2652     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2653     */
2654    struct LDKTxOut *data;
2655    /**
2656     * The number of elements pointed to by `data`.
2657     */
2658    uintptr_t datalen;
2659 } LDKCVec_TxOutZ;
2660
2661 /**
2662  * An enum which can either contain a u32 or not
2663  */
2664 typedef enum LDKCOption_u32Z_Tag {
2665    /**
2666     * When we're in this state, this COption_u32Z contains a u32
2667     */
2668    LDKCOption_u32Z_Some,
2669    /**
2670     * When we're in this state, this COption_u32Z contains nothing
2671     */
2672    LDKCOption_u32Z_None,
2673    /**
2674     * Must be last for serialization purposes
2675     */
2676    LDKCOption_u32Z_Sentinel,
2677 } LDKCOption_u32Z_Tag;
2678
2679 typedef struct LDKCOption_u32Z {
2680    LDKCOption_u32Z_Tag tag;
2681    union {
2682       struct {
2683          uint32_t some;
2684       };
2685    };
2686 } LDKCOption_u32Z;
2687
2688 /**
2689  * A tuple of 2 elements. See the individual fields for the types contained.
2690  */
2691 typedef struct LDKC2Tuple_CVec_u8Zu64Z {
2692    /**
2693     * The element at position 0
2694     */
2695    struct LDKCVec_u8Z a;
2696    /**
2697     * The element at position 1
2698     */
2699    uint64_t b;
2700 } LDKC2Tuple_CVec_u8Zu64Z;
2701
2702 /**
2703  * The contents of CResult_C2Tuple_CVec_u8Zu64ZNoneZ
2704  */
2705 typedef union LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZPtr {
2706    /**
2707     * A pointer to the contents in the success state.
2708     * Reading from this pointer when `result_ok` is not set is undefined.
2709     */
2710    struct LDKC2Tuple_CVec_u8Zu64Z *result;
2711    /**
2712     * Note that this value is always NULL, as there are no contents in the Err variant
2713     */
2714    void *err;
2715 } LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZPtr;
2716
2717 /**
2718  * A CResult_C2Tuple_CVec_u8Zu64ZNoneZ represents the result of a fallible operation,
2719  * containing a crate::c_types::derived::C2Tuple_CVec_u8Zu64Z on success and a () on failure.
2720  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2721  */
2722 typedef struct LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ {
2723    /**
2724     * The contents of this CResult_C2Tuple_CVec_u8Zu64ZNoneZ, accessible via either
2725     * `err` or `result` depending on the state of `result_ok`.
2726     */
2727    union LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZPtr contents;
2728    /**
2729     * Whether this CResult_C2Tuple_CVec_u8Zu64ZNoneZ represents a success state.
2730     */
2731    bool result_ok;
2732 } LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ;
2733
2734
2735
2736 /**
2737  * The parameters required to derive a channel signer via [`SignerProvider`].
2738  */
2739 typedef struct MUST_USE_STRUCT LDKChannelDerivationParameters {
2740    /**
2741     * A pointer to the opaque Rust object.
2742     * Nearly everywhere, inner must be non-null, however in places where
2743     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2744     */
2745    LDKnativeChannelDerivationParameters *inner;
2746    /**
2747     * Indicates that this is the only struct which contains the same pointer.
2748     * Rust functions which take ownership of an object provided via an argument require
2749     * this to be true and invalidate the object pointed to by inner.
2750     */
2751    bool is_owned;
2752 } LDKChannelDerivationParameters;
2753
2754 /**
2755  * The contents of CResult_ChannelDerivationParametersDecodeErrorZ
2756  */
2757 typedef union LDKCResult_ChannelDerivationParametersDecodeErrorZPtr {
2758    /**
2759     * A pointer to the contents in the success state.
2760     * Reading from this pointer when `result_ok` is not set is undefined.
2761     */
2762    struct LDKChannelDerivationParameters *result;
2763    /**
2764     * A pointer to the contents in the error state.
2765     * Reading from this pointer when `result_ok` is set is undefined.
2766     */
2767    struct LDKDecodeError *err;
2768 } LDKCResult_ChannelDerivationParametersDecodeErrorZPtr;
2769
2770 /**
2771  * A CResult_ChannelDerivationParametersDecodeErrorZ represents the result of a fallible operation,
2772  * containing a crate::lightning::sign::ChannelDerivationParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
2773  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2774  */
2775 typedef struct LDKCResult_ChannelDerivationParametersDecodeErrorZ {
2776    /**
2777     * The contents of this CResult_ChannelDerivationParametersDecodeErrorZ, accessible via either
2778     * `err` or `result` depending on the state of `result_ok`.
2779     */
2780    union LDKCResult_ChannelDerivationParametersDecodeErrorZPtr contents;
2781    /**
2782     * Whether this CResult_ChannelDerivationParametersDecodeErrorZ represents a success state.
2783     */
2784    bool result_ok;
2785 } LDKCResult_ChannelDerivationParametersDecodeErrorZ;
2786
2787
2788
2789 /**
2790  * A descriptor used to sign for a commitment transaction's HTLC output.
2791  */
2792 typedef struct MUST_USE_STRUCT LDKHTLCDescriptor {
2793    /**
2794     * A pointer to the opaque Rust object.
2795     * Nearly everywhere, inner must be non-null, however in places where
2796     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2797     */
2798    LDKnativeHTLCDescriptor *inner;
2799    /**
2800     * Indicates that this is the only struct which contains the same pointer.
2801     * Rust functions which take ownership of an object provided via an argument require
2802     * this to be true and invalidate the object pointed to by inner.
2803     */
2804    bool is_owned;
2805 } LDKHTLCDescriptor;
2806
2807 /**
2808  * The contents of CResult_HTLCDescriptorDecodeErrorZ
2809  */
2810 typedef union LDKCResult_HTLCDescriptorDecodeErrorZPtr {
2811    /**
2812     * A pointer to the contents in the success state.
2813     * Reading from this pointer when `result_ok` is not set is undefined.
2814     */
2815    struct LDKHTLCDescriptor *result;
2816    /**
2817     * A pointer to the contents in the error state.
2818     * Reading from this pointer when `result_ok` is set is undefined.
2819     */
2820    struct LDKDecodeError *err;
2821 } LDKCResult_HTLCDescriptorDecodeErrorZPtr;
2822
2823 /**
2824  * A CResult_HTLCDescriptorDecodeErrorZ represents the result of a fallible operation,
2825  * containing a crate::lightning::sign::HTLCDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
2826  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2827  */
2828 typedef struct LDKCResult_HTLCDescriptorDecodeErrorZ {
2829    /**
2830     * The contents of this CResult_HTLCDescriptorDecodeErrorZ, accessible via either
2831     * `err` or `result` depending on the state of `result_ok`.
2832     */
2833    union LDKCResult_HTLCDescriptorDecodeErrorZPtr contents;
2834    /**
2835     * Whether this CResult_HTLCDescriptorDecodeErrorZ represents a success state.
2836     */
2837    bool result_ok;
2838 } LDKCResult_HTLCDescriptorDecodeErrorZ;
2839
2840 /**
2841  * The contents of CResult_NoneNoneZ
2842  */
2843 typedef union LDKCResult_NoneNoneZPtr {
2844    /**
2845     * Note that this value is always NULL, as there are no contents in the OK variant
2846     */
2847    void *result;
2848    /**
2849     * Note that this value is always NULL, as there are no contents in the Err variant
2850     */
2851    void *err;
2852 } LDKCResult_NoneNoneZPtr;
2853
2854 /**
2855  * A CResult_NoneNoneZ represents the result of a fallible operation,
2856  * containing a () on success and a () on failure.
2857  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2858  */
2859 typedef struct LDKCResult_NoneNoneZ {
2860    /**
2861     * The contents of this CResult_NoneNoneZ, accessible via either
2862     * `err` or `result` depending on the state of `result_ok`.
2863     */
2864    union LDKCResult_NoneNoneZPtr contents;
2865    /**
2866     * Whether this CResult_NoneNoneZ represents a success state.
2867     */
2868    bool result_ok;
2869 } LDKCResult_NoneNoneZ;
2870
2871 /**
2872  * Represents a valid secp256k1 public key serialized in "compressed form" as a 33 byte array.
2873  */
2874 typedef struct LDKPublicKey {
2875    /**
2876     * The bytes of the public key
2877     */
2878    uint8_t compressed_form[33];
2879 } LDKPublicKey;
2880
2881 /**
2882  * The contents of CResult_PublicKeyNoneZ
2883  */
2884 typedef union LDKCResult_PublicKeyNoneZPtr {
2885    /**
2886     * A pointer to the contents in the success state.
2887     * Reading from this pointer when `result_ok` is not set is undefined.
2888     */
2889    struct LDKPublicKey *result;
2890    /**
2891     * Note that this value is always NULL, as there are no contents in the Err variant
2892     */
2893    void *err;
2894 } LDKCResult_PublicKeyNoneZPtr;
2895
2896 /**
2897  * A CResult_PublicKeyNoneZ represents the result of a fallible operation,
2898  * containing a crate::c_types::PublicKey on success and a () on failure.
2899  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2900  */
2901 typedef struct LDKCResult_PublicKeyNoneZ {
2902    /**
2903     * The contents of this CResult_PublicKeyNoneZ, accessible via either
2904     * `err` or `result` depending on the state of `result_ok`.
2905     */
2906    union LDKCResult_PublicKeyNoneZPtr contents;
2907    /**
2908     * Whether this CResult_PublicKeyNoneZ represents a success state.
2909     */
2910    bool result_ok;
2911 } LDKCResult_PublicKeyNoneZ;
2912
2913 /**
2914  * An enum which can either contain a crate::c_types::BigEndianScalar or not
2915  */
2916 typedef enum LDKCOption_BigEndianScalarZ_Tag {
2917    /**
2918     * When we're in this state, this COption_BigEndianScalarZ contains a crate::c_types::BigEndianScalar
2919     */
2920    LDKCOption_BigEndianScalarZ_Some,
2921    /**
2922     * When we're in this state, this COption_BigEndianScalarZ contains nothing
2923     */
2924    LDKCOption_BigEndianScalarZ_None,
2925    /**
2926     * Must be last for serialization purposes
2927     */
2928    LDKCOption_BigEndianScalarZ_Sentinel,
2929 } LDKCOption_BigEndianScalarZ_Tag;
2930
2931 typedef struct LDKCOption_BigEndianScalarZ {
2932    LDKCOption_BigEndianScalarZ_Tag tag;
2933    union {
2934       struct {
2935          struct LDKBigEndianScalar some;
2936       };
2937    };
2938 } LDKCOption_BigEndianScalarZ;
2939
2940 /**
2941  * Integer in the range `0..32`
2942  */
2943 typedef struct LDKU5 {
2944    uint8_t _0;
2945 } LDKU5;
2946
2947 /**
2948  * A dynamically-allocated array of crate::c_types::U5s of arbitrary size.
2949  * This corresponds to std::vector in C++
2950  */
2951 typedef struct LDKCVec_U5Z {
2952    /**
2953     * The elements in the array.
2954     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2955     */
2956    struct LDKU5 *data;
2957    /**
2958     * The number of elements pointed to by `data`.
2959     */
2960    uintptr_t datalen;
2961 } LDKCVec_U5Z;
2962
2963 /**
2964  * Represents a secp256k1 signature serialized as two 32-byte numbers as well as a tag which
2965  * allows recovering the exact public key which created the signature given the message.
2966  */
2967 typedef struct LDKRecoverableSignature {
2968    /**
2969     * The bytes of the signature in "compact" form plus a "Recovery ID" which allows for
2970     * recovery.
2971     */
2972    uint8_t serialized_form[68];
2973 } LDKRecoverableSignature;
2974
2975 /**
2976  * The contents of CResult_RecoverableSignatureNoneZ
2977  */
2978 typedef union LDKCResult_RecoverableSignatureNoneZPtr {
2979    /**
2980     * A pointer to the contents in the success state.
2981     * Reading from this pointer when `result_ok` is not set is undefined.
2982     */
2983    struct LDKRecoverableSignature *result;
2984    /**
2985     * Note that this value is always NULL, as there are no contents in the Err variant
2986     */
2987    void *err;
2988 } LDKCResult_RecoverableSignatureNoneZPtr;
2989
2990 /**
2991  * A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
2992  * containing a crate::c_types::RecoverableSignature on success and a () on failure.
2993  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2994  */
2995 typedef struct LDKCResult_RecoverableSignatureNoneZ {
2996    /**
2997     * The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
2998     * `err` or `result` depending on the state of `result_ok`.
2999     */
3000    union LDKCResult_RecoverableSignatureNoneZPtr contents;
3001    /**
3002     * Whether this CResult_RecoverableSignatureNoneZ represents a success state.
3003     */
3004    bool result_ok;
3005 } LDKCResult_RecoverableSignatureNoneZ;
3006
3007 /**
3008  * Represents a secp256k1 ECDSA signature serialized as two 32-byte numbers
3009  */
3010 typedef struct LDKECDSASignature {
3011    /**
3012     * The bytes of the signature in "compact" form
3013     */
3014    uint8_t compact_form[64];
3015 } LDKECDSASignature;
3016
3017 /**
3018  * The contents of CResult_ECDSASignatureNoneZ
3019  */
3020 typedef union LDKCResult_ECDSASignatureNoneZPtr {
3021    /**
3022     * A pointer to the contents in the success state.
3023     * Reading from this pointer when `result_ok` is not set is undefined.
3024     */
3025    struct LDKECDSASignature *result;
3026    /**
3027     * Note that this value is always NULL, as there are no contents in the Err variant
3028     */
3029    void *err;
3030 } LDKCResult_ECDSASignatureNoneZPtr;
3031
3032 /**
3033  * A CResult_ECDSASignatureNoneZ represents the result of a fallible operation,
3034  * containing a crate::c_types::ECDSASignature on success and a () on failure.
3035  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3036  */
3037 typedef struct LDKCResult_ECDSASignatureNoneZ {
3038    /**
3039     * The contents of this CResult_ECDSASignatureNoneZ, accessible via either
3040     * `err` or `result` depending on the state of `result_ok`.
3041     */
3042    union LDKCResult_ECDSASignatureNoneZPtr contents;
3043    /**
3044     * Whether this CResult_ECDSASignatureNoneZ represents a success state.
3045     */
3046    bool result_ok;
3047 } LDKCResult_ECDSASignatureNoneZ;
3048
3049 /**
3050  * The contents of CResult_TransactionNoneZ
3051  */
3052 typedef union LDKCResult_TransactionNoneZPtr {
3053    /**
3054     * A pointer to the contents in the success state.
3055     * Reading from this pointer when `result_ok` is not set is undefined.
3056     */
3057    struct LDKTransaction *result;
3058    /**
3059     * Note that this value is always NULL, as there are no contents in the Err variant
3060     */
3061    void *err;
3062 } LDKCResult_TransactionNoneZPtr;
3063
3064 /**
3065  * A CResult_TransactionNoneZ represents the result of a fallible operation,
3066  * containing a crate::c_types::Transaction on success and a () on failure.
3067  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3068  */
3069 typedef struct LDKCResult_TransactionNoneZ {
3070    /**
3071     * The contents of this CResult_TransactionNoneZ, accessible via either
3072     * `err` or `result` depending on the state of `result_ok`.
3073     */
3074    union LDKCResult_TransactionNoneZPtr contents;
3075    /**
3076     * Whether this CResult_TransactionNoneZ represents a success state.
3077     */
3078    bool result_ok;
3079 } LDKCResult_TransactionNoneZ;
3080
3081 /**
3082  * A dynamically-allocated array of crate::c_types::ECDSASignatures of arbitrary size.
3083  * This corresponds to std::vector in C++
3084  */
3085 typedef struct LDKCVec_ECDSASignatureZ {
3086    /**
3087     * The elements in the array.
3088     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3089     */
3090    struct LDKECDSASignature *data;
3091    /**
3092     * The number of elements pointed to by `data`.
3093     */
3094    uintptr_t datalen;
3095 } LDKCVec_ECDSASignatureZ;
3096
3097 /**
3098  * A tuple of 2 elements. See the individual fields for the types contained.
3099  */
3100 typedef struct LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ {
3101    /**
3102     * The element at position 0
3103     */
3104    struct LDKECDSASignature a;
3105    /**
3106     * The element at position 1
3107     */
3108    struct LDKCVec_ECDSASignatureZ b;
3109 } LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ;
3110
3111 /**
3112  * The contents of CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ
3113  */
3114 typedef union LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr {
3115    /**
3116     * A pointer to the contents in the success state.
3117     * Reading from this pointer when `result_ok` is not set is undefined.
3118     */
3119    struct LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ *result;
3120    /**
3121     * Note that this value is always NULL, as there are no contents in the Err variant
3122     */
3123    void *err;
3124 } LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr;
3125
3126 /**
3127  * A CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ represents the result of a fallible operation,
3128  * containing a crate::c_types::derived::C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ on success and a () on failure.
3129  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3130  */
3131 typedef struct LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ {
3132    /**
3133     * The contents of this CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ, accessible via either
3134     * `err` or `result` depending on the state of `result_ok`.
3135     */
3136    union LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr contents;
3137    /**
3138     * Whether this CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ represents a success state.
3139     */
3140    bool result_ok;
3141 } LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ;
3142
3143
3144
3145 /**
3146  * This class tracks the per-transaction information needed to build a commitment transaction and will
3147  * actually build it and sign.  It is used for holder transactions that we sign only when needed
3148  * and for transactions we sign for the counterparty.
3149  *
3150  * This class can be used inside a signer implementation to generate a signature given the relevant
3151  * secret key.
3152  */
3153 typedef struct MUST_USE_STRUCT LDKCommitmentTransaction {
3154    /**
3155     * A pointer to the opaque Rust object.
3156     * Nearly everywhere, inner must be non-null, however in places where
3157     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3158     */
3159    LDKnativeCommitmentTransaction *inner;
3160    /**
3161     * Indicates that this is the only struct which contains the same pointer.
3162     * Rust functions which take ownership of an object provided via an argument require
3163     * this to be true and invalidate the object pointed to by inner.
3164     */
3165    bool is_owned;
3166 } LDKCommitmentTransaction;
3167
3168
3169
3170 /**
3171  * Information needed to build and sign a holder's commitment transaction.
3172  *
3173  * The transaction is only signed once we are ready to broadcast.
3174  */
3175 typedef struct MUST_USE_STRUCT LDKHolderCommitmentTransaction {
3176    /**
3177     * A pointer to the opaque Rust object.
3178     * Nearly everywhere, inner must be non-null, however in places where
3179     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3180     */
3181    LDKnativeHolderCommitmentTransaction *inner;
3182    /**
3183     * Indicates that this is the only struct which contains the same pointer.
3184     * Rust functions which take ownership of an object provided via an argument require
3185     * this to be true and invalidate the object pointed to by inner.
3186     */
3187    bool is_owned;
3188 } LDKHolderCommitmentTransaction;
3189
3190
3191
3192 /**
3193  * Information about an HTLC as it appears in a commitment transaction
3194  */
3195 typedef struct MUST_USE_STRUCT LDKHTLCOutputInCommitment {
3196    /**
3197     * A pointer to the opaque Rust object.
3198     * Nearly everywhere, inner must be non-null, however in places where
3199     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3200     */
3201    LDKnativeHTLCOutputInCommitment *inner;
3202    /**
3203     * Indicates that this is the only struct which contains the same pointer.
3204     * Rust functions which take ownership of an object provided via an argument require
3205     * this to be true and invalidate the object pointed to by inner.
3206     */
3207    bool is_owned;
3208 } LDKHTLCOutputInCommitment;
3209
3210
3211
3212 /**
3213  * This class tracks the per-transaction information needed to build a closing transaction and will
3214  * actually build it and sign.
3215  *
3216  * This class can be used inside a signer implementation to generate a signature given the relevant
3217  * secret key.
3218  */
3219 typedef struct MUST_USE_STRUCT LDKClosingTransaction {
3220    /**
3221     * A pointer to the opaque Rust object.
3222     * Nearly everywhere, inner must be non-null, however in places where
3223     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3224     */
3225    LDKnativeClosingTransaction *inner;
3226    /**
3227     * Indicates that this is the only struct which contains the same pointer.
3228     * Rust functions which take ownership of an object provided via an argument require
3229     * this to be true and invalidate the object pointed to by inner.
3230     */
3231    bool is_owned;
3232 } LDKClosingTransaction;
3233
3234
3235
3236 /**
3237  * The unsigned part of a [`channel_announcement`] message.
3238  *
3239  * [`channel_announcement`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-channel_announcement-message
3240  */
3241 typedef struct MUST_USE_STRUCT LDKUnsignedChannelAnnouncement {
3242    /**
3243     * A pointer to the opaque Rust object.
3244     * Nearly everywhere, inner must be non-null, however in places where
3245     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3246     */
3247    LDKnativeUnsignedChannelAnnouncement *inner;
3248    /**
3249     * Indicates that this is the only struct which contains the same pointer.
3250     * Rust functions which take ownership of an object provided via an argument require
3251     * this to be true and invalidate the object pointed to by inner.
3252     */
3253    bool is_owned;
3254 } LDKUnsignedChannelAnnouncement;
3255
3256
3257
3258 /**
3259  * One counterparty's public keys which do not change over the life of a channel.
3260  */
3261 typedef struct MUST_USE_STRUCT LDKChannelPublicKeys {
3262    /**
3263     * A pointer to the opaque Rust object.
3264     * Nearly everywhere, inner must be non-null, however in places where
3265     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3266     */
3267    LDKnativeChannelPublicKeys *inner;
3268    /**
3269     * Indicates that this is the only struct which contains the same pointer.
3270     * Rust functions which take ownership of an object provided via an argument require
3271     * this to be true and invalidate the object pointed to by inner.
3272     */
3273    bool is_owned;
3274 } LDKChannelPublicKeys;
3275
3276
3277
3278 /**
3279  * Per-channel data used to build transactions in conjunction with the per-commitment data (CommitmentTransaction).
3280  * The fields are organized by holder/counterparty.
3281  *
3282  * Normally, this is converted to the broadcaster/countersignatory-organized DirectedChannelTransactionParameters
3283  * before use, via the as_holder_broadcastable and as_counterparty_broadcastable functions.
3284  */
3285 typedef struct MUST_USE_STRUCT LDKChannelTransactionParameters {
3286    /**
3287     * A pointer to the opaque Rust object.
3288     * Nearly everywhere, inner must be non-null, however in places where
3289     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3290     */
3291    LDKnativeChannelTransactionParameters *inner;
3292    /**
3293     * Indicates that this is the only struct which contains the same pointer.
3294     * Rust functions which take ownership of an object provided via an argument require
3295     * this to be true and invalidate the object pointed to by inner.
3296     */
3297    bool is_owned;
3298 } LDKChannelTransactionParameters;
3299
3300 /**
3301  * A trait to handle Lightning channel key material without concretizing the channel type or
3302  * the signature mechanism.
3303  */
3304 typedef struct LDKChannelSigner {
3305    /**
3306     * An opaque pointer which is passed to your function implementations as an argument.
3307     * This has no meaning in the LDK, and can be NULL or any other value.
3308     */
3309    void *this_arg;
3310    /**
3311     * Gets the per-commitment point for a specific commitment number
3312     *
3313     * Note that the commitment number starts at `(1 << 48) - 1` and counts backwards.
3314     */
3315    struct LDKPublicKey (*get_per_commitment_point)(const void *this_arg, uint64_t idx);
3316    /**
3317     * Gets the commitment secret for a specific commitment number as part of the revocation process
3318     *
3319     * An external signer implementation should error here if the commitment was already signed
3320     * and should refuse to sign it in the future.
3321     *
3322     * May be called more than once for the same index.
3323     *
3324     * Note that the commitment number starts at `(1 << 48) - 1` and counts backwards.
3325     */
3326    struct LDKThirtyTwoBytes (*release_commitment_secret)(const void *this_arg, uint64_t idx);
3327    /**
3328     * Validate the counterparty's signatures on the holder commitment transaction and HTLCs.
3329     *
3330     * This is required in order for the signer to make sure that releasing a commitment
3331     * secret won't leave us without a broadcastable holder transaction.
3332     * Policy checks should be implemented in this function, including checking the amount
3333     * sent to us and checking the HTLCs.
3334     *
3335     * The preimages of outbound HTLCs that were fulfilled since the last commitment are provided.
3336     * A validating signer should ensure that an HTLC output is removed only when the matching
3337     * preimage is provided, or when the value to holder is restored.
3338     *
3339     * Note that all the relevant preimages will be provided, but there may also be additional
3340     * irrelevant or duplicate preimages.
3341     */
3342    struct LDKCResult_NoneNoneZ (*validate_holder_commitment)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR holder_tx, struct LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages);
3343    /**
3344     * Validate the counterparty's revocation.
3345     *
3346     * This is required in order for the signer to make sure that the state has moved
3347     * forward and it is safe to sign the next counterparty commitment.
3348     */
3349    struct LDKCResult_NoneNoneZ (*validate_counterparty_revocation)(const void *this_arg, uint64_t idx, const uint8_t (*secret)[32]);
3350    /**
3351     * Returns the holder's channel public keys and basepoints.
3352     */
3353    struct LDKChannelPublicKeys pubkeys;
3354    /**
3355     * Fill in the pubkeys field as a reference to it will be given to Rust after this returns
3356     * Note that this takes a pointer to this object, not the this_ptr like other methods do
3357     * This function pointer may be NULL if pubkeys is filled in when this object is created and never needs updating.
3358     */
3359    void (*set_pubkeys)(const struct LDKChannelSigner*NONNULL_PTR );
3360    /**
3361     * Returns an arbitrary identifier describing the set of keys which are provided back to you in
3362     * some [`SpendableOutputDescriptor`] types. This should be sufficient to identify this
3363     * [`EcdsaChannelSigner`] object uniquely and lookup or re-derive its keys.
3364     */
3365    struct LDKThirtyTwoBytes (*channel_keys_id)(const void *this_arg);
3366    /**
3367     * Set the counterparty static channel data, including basepoints,
3368     * `counterparty_selected`/`holder_selected_contest_delay` and funding outpoint.
3369     *
3370     * This data is static, and will never change for a channel once set. For a given [`ChannelSigner`]
3371     * instance, LDK will call this method exactly once - either immediately after construction
3372     * (not including if done via [`SignerProvider::read_chan_signer`]) or when the funding
3373     * information has been generated.
3374     *
3375     * channel_parameters.is_populated() MUST be true.
3376     */
3377    void (*provide_channel_parameters)(void *this_arg, const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters);
3378    /**
3379     * Frees any resources associated with this object given its this_arg pointer.
3380     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
3381     */
3382    void (*free)(void *this_arg);
3383 } LDKChannelSigner;
3384
3385 /**
3386  * A trait to sign Lightning channel transactions as described in
3387  * [BOLT 3](https://github.com/lightning/bolts/blob/master/03-transactions.md).
3388  *
3389  * Signing services could be implemented on a hardware wallet and should implement signing
3390  * policies in order to be secure. Please refer to the [VLS Policy
3391  * Controls](https://gitlab.com/lightning-signer/validating-lightning-signer/-/blob/main/docs/policy-controls.md)
3392  * for an example of such policies.
3393  */
3394 typedef struct LDKEcdsaChannelSigner {
3395    /**
3396     * An opaque pointer which is passed to your function implementations as an argument.
3397     * This has no meaning in the LDK, and can be NULL or any other value.
3398     */
3399    void *this_arg;
3400    /**
3401     * Create a signature for a counterparty's commitment transaction and associated HTLC transactions.
3402     *
3403     * Note that if signing fails or is rejected, the channel will be force-closed.
3404     *
3405     * Policy checks should be implemented in this function, including checking the amount
3406     * sent to us and checking the HTLCs.
3407     *
3408     * The preimages of outbound and inbound HTLCs that were fulfilled since the last commitment
3409     * are provided. A validating signer should ensure that an outbound HTLC output is removed
3410     * only when the matching preimage is provided and after the corresponding inbound HTLC has
3411     * been removed for forwarded payments.
3412     *
3413     * Note that all the relevant preimages will be provided, but there may also be additional
3414     * irrelevant or duplicate preimages.
3415     */
3416    struct LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ (*sign_counterparty_commitment)(const void *this_arg, const struct LDKCommitmentTransaction *NONNULL_PTR commitment_tx, struct LDKCVec_ThirtyTwoBytesZ inbound_htlc_preimages, struct LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages);
3417    /**
3418     * Creates a signature for a holder's commitment transaction.
3419     *
3420     * This will be called
3421     * - with a non-revoked `commitment_tx`.
3422     * - with the latest `commitment_tx` when we initiate a force-close.
3423     *
3424     * This may be called multiple times for the same transaction.
3425     *
3426     * An external signer implementation should check that the commitment has not been revoked.
3427     *
3428     * An `Err` can be returned to signal that the signer is unavailable/cannot produce a valid
3429     * signature and should be retried later. Once the signer is ready to provide a signature after
3430     * previously returning an `Err`, [`ChannelMonitor::signer_unblocked`] must be called on its
3431     * monitor.
3432     *
3433     * [`ChannelMonitor::signer_unblocked`]: crate::chain::channelmonitor::ChannelMonitor::signer_unblocked
3434     */
3435    struct LDKCResult_ECDSASignatureNoneZ (*sign_holder_commitment)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx);
3436    /**
3437     * Create a signature for the given input in a transaction spending an HTLC transaction output
3438     * or a commitment transaction `to_local` output when our counterparty broadcasts an old state.
3439     *
3440     * A justice transaction may claim multiple outputs at the same time if timelocks are
3441     * similar, but only a signature for the input at index `input` should be signed for here.
3442     * It may be called multiple times for same output(s) if a fee-bump is needed with regards
3443     * to an upcoming timelock expiration.
3444     *
3445     * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
3446     *
3447     * `per_commitment_key` is revocation secret which was provided by our counterparty when they
3448     * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
3449     * not allow the spending of any funds by itself (you need our holder `revocation_secret` to do
3450     * so).
3451     *
3452     * An `Err` can be returned to signal that the signer is unavailable/cannot produce a valid
3453     * signature and should be retried later. Once the signer is ready to provide a signature after
3454     * previously returning an `Err`, [`ChannelMonitor::signer_unblocked`] must be called on its
3455     * monitor.
3456     *
3457     * [`ChannelMonitor::signer_unblocked`]: crate::chain::channelmonitor::ChannelMonitor::signer_unblocked
3458     */
3459    struct LDKCResult_ECDSASignatureNoneZ (*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]);
3460    /**
3461     * Create a signature for the given input in a transaction spending a commitment transaction
3462     * HTLC output when our counterparty broadcasts an old state.
3463     *
3464     * A justice transaction may claim multiple outputs at the same time if timelocks are
3465     * similar, but only a signature for the input at index `input` should be signed for here.
3466     * It may be called multiple times for same output(s) if a fee-bump is needed with regards
3467     * to an upcoming timelock expiration.
3468     *
3469     * `amount` is the value of the output spent by this input, committed to in the BIP 143
3470     * signature.
3471     *
3472     * `per_commitment_key` is revocation secret which was provided by our counterparty when they
3473     * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
3474     * not allow the spending of any funds by itself (you need our holder revocation_secret to do
3475     * so).
3476     *
3477     * `htlc` holds HTLC elements (hash, timelock), thus changing the format of the witness script
3478     * (which is committed to in the BIP 143 signatures).
3479     *
3480     * An `Err` can be returned to signal that the signer is unavailable/cannot produce a valid
3481     * signature and should be retried later. Once the signer is ready to provide a signature after
3482     * previously returning an `Err`, [`ChannelMonitor::signer_unblocked`] must be called on its
3483     * monitor.
3484     *
3485     * [`ChannelMonitor::signer_unblocked`]: crate::chain::channelmonitor::ChannelMonitor::signer_unblocked
3486     */
3487    struct LDKCResult_ECDSASignatureNoneZ (*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);
3488    /**
3489     * Computes the signature for a commitment transaction's HTLC output used as an input within
3490     * `htlc_tx`, which spends the commitment transaction at index `input`. The signature returned
3491     * must be be computed using [`EcdsaSighashType::All`].
3492     *
3493     * Note that this may be called for HTLCs in the penultimate commitment transaction if a
3494     * [`ChannelMonitor`] [replica](https://github.com/lightningdevkit/rust-lightning/blob/main/GLOSSARY.md#monitor-replicas)
3495     * broadcasts it before receiving the update for the latest commitment transaction.
3496     *
3497     * An `Err` can be returned to signal that the signer is unavailable/cannot produce a valid
3498     * signature and should be retried later. Once the signer is ready to provide a signature after
3499     * previously returning an `Err`, [`ChannelMonitor::signer_unblocked`] must be called on its
3500     * monitor.
3501     *
3502     * [`EcdsaSighashType::All`]: bitcoin::sighash::EcdsaSighashType::All
3503     * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor
3504     * [`ChannelMonitor::signer_unblocked`]: crate::chain::channelmonitor::ChannelMonitor::signer_unblocked
3505     */
3506    struct LDKCResult_ECDSASignatureNoneZ (*sign_holder_htlc_transaction)(const void *this_arg, struct LDKTransaction htlc_tx, uintptr_t input, const struct LDKHTLCDescriptor *NONNULL_PTR htlc_descriptor);
3507    /**
3508     * Create a signature for a claiming transaction for a HTLC output on a counterparty's commitment
3509     * transaction, either offered or received.
3510     *
3511     * Such a transaction may claim multiples offered outputs at same time if we know the
3512     * preimage for each when we create it, but only the input at index `input` should be
3513     * signed for here. It may be called multiple times for same output(s) if a fee-bump is
3514     * needed with regards to an upcoming timelock expiration.
3515     *
3516     * `witness_script` is either an offered or received script as defined in BOLT3 for HTLC
3517     * outputs.
3518     *
3519     * `amount` is value of the output spent by this input, committed to in the BIP 143 signature.
3520     *
3521     * `per_commitment_point` is the dynamic point corresponding to the channel state
3522     * detected onchain. It has been generated by our counterparty and is used to derive
3523     * channel state keys, which are then included in the witness script and committed to in the
3524     * BIP 143 signature.
3525     *
3526     * An `Err` can be returned to signal that the signer is unavailable/cannot produce a valid
3527     * signature and should be retried later. Once the signer is ready to provide a signature after
3528     * previously returning an `Err`, [`ChannelMonitor::signer_unblocked`] must be called on its
3529     * monitor.
3530     *
3531     * [`ChannelMonitor::signer_unblocked`]: crate::chain::channelmonitor::ChannelMonitor::signer_unblocked
3532     */
3533    struct LDKCResult_ECDSASignatureNoneZ (*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);
3534    /**
3535     * Create a signature for a (proposed) closing transaction.
3536     *
3537     * Note that, due to rounding, there may be one \"missing\" satoshi, and either party may have
3538     * chosen to forgo their output as dust.
3539     */
3540    struct LDKCResult_ECDSASignatureNoneZ (*sign_closing_transaction)(const void *this_arg, const struct LDKClosingTransaction *NONNULL_PTR closing_tx);
3541    /**
3542     * Computes the signature for a commitment transaction's anchor output used as an
3543     * input within `anchor_tx`, which spends the commitment transaction, at index `input`.
3544     *
3545     * An `Err` can be returned to signal that the signer is unavailable/cannot produce a valid
3546     * signature and should be retried later. Once the signer is ready to provide a signature after
3547     * previously returning an `Err`, [`ChannelMonitor::signer_unblocked`] must be called on its
3548     * monitor.
3549     *
3550     * [`ChannelMonitor::signer_unblocked`]: crate::chain::channelmonitor::ChannelMonitor::signer_unblocked
3551     */
3552    struct LDKCResult_ECDSASignatureNoneZ (*sign_holder_anchor_input)(const void *this_arg, struct LDKTransaction anchor_tx, uintptr_t input);
3553    /**
3554     * Signs a channel announcement message with our funding key proving it comes from one of the
3555     * channel participants.
3556     *
3557     * Channel announcements also require a signature from each node's network key. Our node
3558     * signature is computed through [`NodeSigner::sign_gossip_message`].
3559     *
3560     * Note that if this fails or is rejected, the channel will not be publicly announced and
3561     * our counterparty may (though likely will not) close the channel on us for violating the
3562     * protocol.
3563     *
3564     * [`NodeSigner::sign_gossip_message`]: crate::sign::NodeSigner::sign_gossip_message
3565     */
3566    struct LDKCResult_ECDSASignatureNoneZ (*sign_channel_announcement_with_funding_key)(const void *this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg);
3567    /**
3568     * Implementation of ChannelSigner for this object.
3569     */
3570    struct LDKChannelSigner ChannelSigner;
3571    /**
3572     * Frees any resources associated with this object given its this_arg pointer.
3573     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
3574     */
3575    void (*free)(void *this_arg);
3576 } LDKEcdsaChannelSigner;
3577
3578 /**
3579  * A writeable signer.
3580  *
3581  * There will always be two instances of a signer per channel, one occupied by the
3582  * [`ChannelManager`] and another by the channel's [`ChannelMonitor`].
3583  *
3584  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
3585  * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor
3586  */
3587 typedef struct LDKWriteableEcdsaChannelSigner {
3588    /**
3589     * An opaque pointer which is passed to your function implementations as an argument.
3590     * This has no meaning in the LDK, and can be NULL or any other value.
3591     */
3592    void *this_arg;
3593    /**
3594     * Implementation of EcdsaChannelSigner for this object.
3595     */
3596    struct LDKEcdsaChannelSigner EcdsaChannelSigner;
3597    /**
3598     * Serialize the object into a byte array
3599     */
3600    struct LDKCVec_u8Z (*write)(const void *this_arg);
3601    /**
3602     * Called, if set, after this WriteableEcdsaChannelSigner has been cloned into a duplicate object.
3603     * The new WriteableEcdsaChannelSigner is provided, and should be mutated as needed to perform a
3604     * deep copy of the object pointed to by this_arg or avoid any double-freeing.
3605     */
3606    void (*cloned)(struct LDKWriteableEcdsaChannelSigner *NONNULL_PTR new_WriteableEcdsaChannelSigner);
3607    /**
3608     * Frees any resources associated with this object given its this_arg pointer.
3609     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
3610     */
3611    void (*free)(void *this_arg);
3612 } LDKWriteableEcdsaChannelSigner;
3613
3614 /**
3615  * The contents of CResult_WriteableEcdsaChannelSignerDecodeErrorZ
3616  */
3617 typedef union LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZPtr {
3618    /**
3619     * A pointer to the contents in the success state.
3620     * Reading from this pointer when `result_ok` is not set is undefined.
3621     */
3622    struct LDKWriteableEcdsaChannelSigner *result;
3623    /**
3624     * A pointer to the contents in the error state.
3625     * Reading from this pointer when `result_ok` is set is undefined.
3626     */
3627    struct LDKDecodeError *err;
3628 } LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZPtr;
3629
3630 /**
3631  * A CResult_WriteableEcdsaChannelSignerDecodeErrorZ represents the result of a fallible operation,
3632  * containing a crate::lightning::sign::ecdsa::WriteableEcdsaChannelSigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
3633  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3634  */
3635 typedef struct LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ {
3636    /**
3637     * The contents of this CResult_WriteableEcdsaChannelSignerDecodeErrorZ, accessible via either
3638     * `err` or `result` depending on the state of `result_ok`.
3639     */
3640    union LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZPtr contents;
3641    /**
3642     * Whether this CResult_WriteableEcdsaChannelSignerDecodeErrorZ represents a success state.
3643     */
3644    bool result_ok;
3645 } LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ;
3646
3647 /**
3648  * The contents of CResult_CVec_u8ZNoneZ
3649  */
3650 typedef union LDKCResult_CVec_u8ZNoneZPtr {
3651    /**
3652     * A pointer to the contents in the success state.
3653     * Reading from this pointer when `result_ok` is not set is undefined.
3654     */
3655    struct LDKCVec_u8Z *result;
3656    /**
3657     * Note that this value is always NULL, as there are no contents in the Err variant
3658     */
3659    void *err;
3660 } LDKCResult_CVec_u8ZNoneZPtr;
3661
3662 /**
3663  * A CResult_CVec_u8ZNoneZ represents the result of a fallible operation,
3664  * containing a crate::c_types::derived::CVec_u8Z on success and a () on failure.
3665  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3666  */
3667 typedef struct LDKCResult_CVec_u8ZNoneZ {
3668    /**
3669     * The contents of this CResult_CVec_u8ZNoneZ, accessible via either
3670     * `err` or `result` depending on the state of `result_ok`.
3671     */
3672    union LDKCResult_CVec_u8ZNoneZPtr contents;
3673    /**
3674     * Whether this CResult_CVec_u8ZNoneZ represents a success state.
3675     */
3676    bool result_ok;
3677 } LDKCResult_CVec_u8ZNoneZ;
3678
3679 /**
3680  * The contents of CResult_ShutdownScriptNoneZ
3681  */
3682 typedef union LDKCResult_ShutdownScriptNoneZPtr {
3683    /**
3684     * A pointer to the contents in the success state.
3685     * Reading from this pointer when `result_ok` is not set is undefined.
3686     */
3687    struct LDKShutdownScript *result;
3688    /**
3689     * Note that this value is always NULL, as there are no contents in the Err variant
3690     */
3691    void *err;
3692 } LDKCResult_ShutdownScriptNoneZPtr;
3693
3694 /**
3695  * A CResult_ShutdownScriptNoneZ represents the result of a fallible operation,
3696  * containing a crate::lightning::ln::script::ShutdownScript on success and a () on failure.
3697  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3698  */
3699 typedef struct LDKCResult_ShutdownScriptNoneZ {
3700    /**
3701     * The contents of this CResult_ShutdownScriptNoneZ, accessible via either
3702     * `err` or `result` depending on the state of `result_ok`.
3703     */
3704    union LDKCResult_ShutdownScriptNoneZPtr contents;
3705    /**
3706     * Whether this CResult_ShutdownScriptNoneZ represents a success state.
3707     */
3708    bool result_ok;
3709 } LDKCResult_ShutdownScriptNoneZ;
3710
3711 /**
3712  * An enum which can either contain a u16 or not
3713  */
3714 typedef enum LDKCOption_u16Z_Tag {
3715    /**
3716     * When we're in this state, this COption_u16Z contains a u16
3717     */
3718    LDKCOption_u16Z_Some,
3719    /**
3720     * When we're in this state, this COption_u16Z contains nothing
3721     */
3722    LDKCOption_u16Z_None,
3723    /**
3724     * Must be last for serialization purposes
3725     */
3726    LDKCOption_u16Z_Sentinel,
3727 } LDKCOption_u16Z_Tag;
3728
3729 typedef struct LDKCOption_u16Z {
3730    LDKCOption_u16Z_Tag tag;
3731    union {
3732       struct {
3733          uint16_t some;
3734       };
3735    };
3736 } LDKCOption_u16Z;
3737
3738 /**
3739  * An enum which can either contain a bool or not
3740  */
3741 typedef enum LDKCOption_boolZ_Tag {
3742    /**
3743     * When we're in this state, this COption_boolZ contains a bool
3744     */
3745    LDKCOption_boolZ_Some,
3746    /**
3747     * When we're in this state, this COption_boolZ contains nothing
3748     */
3749    LDKCOption_boolZ_None,
3750    /**
3751     * Must be last for serialization purposes
3752     */
3753    LDKCOption_boolZ_Sentinel,
3754 } LDKCOption_boolZ_Tag;
3755
3756 typedef struct LDKCOption_boolZ {
3757    LDKCOption_boolZ_Tag tag;
3758    union {
3759       struct {
3760          bool some;
3761       };
3762    };
3763 } LDKCOption_boolZ;
3764
3765 /**
3766  * The contents of CResult_WitnessNoneZ
3767  */
3768 typedef union LDKCResult_WitnessNoneZPtr {
3769    /**
3770     * A pointer to the contents in the success state.
3771     * Reading from this pointer when `result_ok` is not set is undefined.
3772     */
3773    struct LDKWitness *result;
3774    /**
3775     * Note that this value is always NULL, as there are no contents in the Err variant
3776     */
3777    void *err;
3778 } LDKCResult_WitnessNoneZPtr;
3779
3780 /**
3781  * A CResult_WitnessNoneZ represents the result of a fallible operation,
3782  * containing a crate::c_types::Witness on success and a () on failure.
3783  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3784  */
3785 typedef struct LDKCResult_WitnessNoneZ {
3786    /**
3787     * The contents of this CResult_WitnessNoneZ, accessible via either
3788     * `err` or `result` depending on the state of `result_ok`.
3789     */
3790    union LDKCResult_WitnessNoneZPtr contents;
3791    /**
3792     * Whether this CResult_WitnessNoneZ represents a success state.
3793     */
3794    bool result_ok;
3795 } LDKCResult_WitnessNoneZ;
3796
3797
3798
3799 /**
3800  * A simple implementation of [`WriteableEcdsaChannelSigner`] that just keeps the private keys in memory.
3801  *
3802  * This implementation performs no policy checks and is insufficient by itself as
3803  * a secure external signer.
3804  */
3805 typedef struct MUST_USE_STRUCT LDKInMemorySigner {
3806    /**
3807     * A pointer to the opaque Rust object.
3808     * Nearly everywhere, inner must be non-null, however in places where
3809     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3810     */
3811    LDKnativeInMemorySigner *inner;
3812    /**
3813     * Indicates that this is the only struct which contains the same pointer.
3814     * Rust functions which take ownership of an object provided via an argument require
3815     * this to be true and invalidate the object pointed to by inner.
3816     */
3817    bool is_owned;
3818 } LDKInMemorySigner;
3819
3820 /**
3821  * The contents of CResult_InMemorySignerDecodeErrorZ
3822  */
3823 typedef union LDKCResult_InMemorySignerDecodeErrorZPtr {
3824    /**
3825     * A pointer to the contents in the success state.
3826     * Reading from this pointer when `result_ok` is not set is undefined.
3827     */
3828    struct LDKInMemorySigner *result;
3829    /**
3830     * A pointer to the contents in the error state.
3831     * Reading from this pointer when `result_ok` is set is undefined.
3832     */
3833    struct LDKDecodeError *err;
3834 } LDKCResult_InMemorySignerDecodeErrorZPtr;
3835
3836 /**
3837  * A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
3838  * containing a crate::lightning::sign::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
3839  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3840  */
3841 typedef struct LDKCResult_InMemorySignerDecodeErrorZ {
3842    /**
3843     * The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
3844     * `err` or `result` depending on the state of `result_ok`.
3845     */
3846    union LDKCResult_InMemorySignerDecodeErrorZPtr contents;
3847    /**
3848     * Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
3849     */
3850    bool result_ok;
3851 } LDKCResult_InMemorySignerDecodeErrorZ;
3852
3853
3854
3855 /**
3856  * A [`CandidateRouteHop::FirstHop`] entry.
3857  */
3858 typedef struct MUST_USE_STRUCT LDKFirstHopCandidate {
3859    /**
3860     * A pointer to the opaque Rust object.
3861     * Nearly everywhere, inner must be non-null, however in places where
3862     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3863     */
3864    LDKnativeFirstHopCandidate *inner;
3865    /**
3866     * Indicates that this is the only struct which contains the same pointer.
3867     * Rust functions which take ownership of an object provided via an argument require
3868     * this to be true and invalidate the object pointed to by inner.
3869     */
3870    bool is_owned;
3871 } LDKFirstHopCandidate;
3872
3873
3874
3875 /**
3876  * A [`CandidateRouteHop::PublicHop`] entry.
3877  */
3878 typedef struct MUST_USE_STRUCT LDKPublicHopCandidate {
3879    /**
3880     * A pointer to the opaque Rust object.
3881     * Nearly everywhere, inner must be non-null, however in places where
3882     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3883     */
3884    LDKnativePublicHopCandidate *inner;
3885    /**
3886     * Indicates that this is the only struct which contains the same pointer.
3887     * Rust functions which take ownership of an object provided via an argument require
3888     * this to be true and invalidate the object pointed to by inner.
3889     */
3890    bool is_owned;
3891 } LDKPublicHopCandidate;
3892
3893
3894
3895 /**
3896  * A [`CandidateRouteHop::PrivateHop`] entry.
3897  */
3898 typedef struct MUST_USE_STRUCT LDKPrivateHopCandidate {
3899    /**
3900     * A pointer to the opaque Rust object.
3901     * Nearly everywhere, inner must be non-null, however in places where
3902     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3903     */
3904    LDKnativePrivateHopCandidate *inner;
3905    /**
3906     * Indicates that this is the only struct which contains the same pointer.
3907     * Rust functions which take ownership of an object provided via an argument require
3908     * this to be true and invalidate the object pointed to by inner.
3909     */
3910    bool is_owned;
3911 } LDKPrivateHopCandidate;
3912
3913
3914
3915 /**
3916  * A [`CandidateRouteHop::Blinded`] entry.
3917  */
3918 typedef struct MUST_USE_STRUCT LDKBlindedPathCandidate {
3919    /**
3920     * A pointer to the opaque Rust object.
3921     * Nearly everywhere, inner must be non-null, however in places where
3922     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3923     */
3924    LDKnativeBlindedPathCandidate *inner;
3925    /**
3926     * Indicates that this is the only struct which contains the same pointer.
3927     * Rust functions which take ownership of an object provided via an argument require
3928     * this to be true and invalidate the object pointed to by inner.
3929     */
3930    bool is_owned;
3931 } LDKBlindedPathCandidate;
3932
3933
3934
3935 /**
3936  * A [`CandidateRouteHop::OneHopBlinded`] entry.
3937  */
3938 typedef struct MUST_USE_STRUCT LDKOneHopBlindedPathCandidate {
3939    /**
3940     * A pointer to the opaque Rust object.
3941     * Nearly everywhere, inner must be non-null, however in places where
3942     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3943     */
3944    LDKnativeOneHopBlindedPathCandidate *inner;
3945    /**
3946     * Indicates that this is the only struct which contains the same pointer.
3947     * Rust functions which take ownership of an object provided via an argument require
3948     * this to be true and invalidate the object pointed to by inner.
3949     */
3950    bool is_owned;
3951 } LDKOneHopBlindedPathCandidate;
3952
3953 /**
3954  * A wrapper around the various hop representations.
3955  *
3956  * Can be used to examine the properties of a hop,
3957  * potentially to decide whether to include it in a route.
3958  */
3959 typedef enum LDKCandidateRouteHop_Tag {
3960    /**
3961     * A hop from the payer, where the outbound liquidity is known.
3962     */
3963    LDKCandidateRouteHop_FirstHop,
3964    /**
3965     * A hop found in the [`ReadOnlyNetworkGraph`].
3966     */
3967    LDKCandidateRouteHop_PublicHop,
3968    /**
3969     * A private hop communicated by the payee, generally via a BOLT 11 invoice.
3970     *
3971     * Because BOLT 11 route hints can take multiple hops to get to the destination, this may not
3972     * terminate at the payee.
3973     */
3974    LDKCandidateRouteHop_PrivateHop,
3975    /**
3976     * A blinded path which starts with an introduction point and ultimately terminates with the
3977     * payee.
3978     *
3979     * Because we don't know the payee's identity, [`CandidateRouteHop::target`] will return
3980     * `None` in this state.
3981     *
3982     * Because blinded paths are \"all or nothing\", and we cannot use just one part of a blinded
3983     * path, the full path is treated as a single [`CandidateRouteHop`].
3984     */
3985    LDKCandidateRouteHop_Blinded,
3986    /**
3987     * Similar to [`Self::Blinded`], but the path here only has one hop.
3988     *
3989     * While we treat this similarly to [`CandidateRouteHop::Blinded`] in many respects (e.g.
3990     * returning `None` from [`CandidateRouteHop::target`]), in this case we do actually know the
3991     * payee's identity - it's the introduction point!
3992     *
3993     * [`BlindedPayInfo`] provided for 1-hop blinded paths is ignored because it is meant to apply
3994     * to the hops *between* the introduction node and the destination.
3995     *
3996     * This primarily exists to track that we need to included a blinded path at the end of our
3997     * [`Route`], even though it doesn't actually add an additional hop in the payment.
3998     */
3999    LDKCandidateRouteHop_OneHopBlinded,
4000    /**
4001     * Must be last for serialization purposes
4002     */
4003    LDKCandidateRouteHop_Sentinel,
4004 } LDKCandidateRouteHop_Tag;
4005
4006 typedef struct MUST_USE_STRUCT LDKCandidateRouteHop {
4007    LDKCandidateRouteHop_Tag tag;
4008    union {
4009       struct {
4010          struct LDKFirstHopCandidate first_hop;
4011       };
4012       struct {
4013          struct LDKPublicHopCandidate public_hop;
4014       };
4015       struct {
4016          struct LDKPrivateHopCandidate private_hop;
4017       };
4018       struct {
4019          struct LDKBlindedPathCandidate blinded;
4020       };
4021       struct {
4022          struct LDKOneHopBlindedPathCandidate one_hop_blinded;
4023       };
4024    };
4025 } LDKCandidateRouteHop;
4026
4027
4028
4029 /**
4030  * Proposed use of a channel passed as a parameter to [`ScoreLookUp::channel_penalty_msat`].
4031  */
4032 typedef struct MUST_USE_STRUCT LDKChannelUsage {
4033    /**
4034     * A pointer to the opaque Rust object.
4035     * Nearly everywhere, inner must be non-null, however in places where
4036     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4037     */
4038    LDKnativeChannelUsage *inner;
4039    /**
4040     * Indicates that this is the only struct which contains the same pointer.
4041     * Rust functions which take ownership of an object provided via an argument require
4042     * this to be true and invalidate the object pointed to by inner.
4043     */
4044    bool is_owned;
4045 } LDKChannelUsage;
4046
4047
4048
4049 /**
4050  * Parameters for configuring [`ProbabilisticScorer`].
4051  *
4052  * Used to configure base, liquidity, and amount penalties, the sum of which comprises the channel
4053  * penalty (i.e., the amount in msats willing to be paid to avoid routing through the channel).
4054  *
4055  * The penalty applied to any channel by the [`ProbabilisticScorer`] is the sum of each of the
4056  * parameters here.
4057  */
4058 typedef struct MUST_USE_STRUCT LDKProbabilisticScoringFeeParameters {
4059    /**
4060     * A pointer to the opaque Rust object.
4061     * Nearly everywhere, inner must be non-null, however in places where
4062     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4063     */
4064    LDKnativeProbabilisticScoringFeeParameters *inner;
4065    /**
4066     * Indicates that this is the only struct which contains the same pointer.
4067     * Rust functions which take ownership of an object provided via an argument require
4068     * this to be true and invalidate the object pointed to by inner.
4069     */
4070    bool is_owned;
4071 } LDKProbabilisticScoringFeeParameters;
4072
4073 /**
4074  * An interface used to score payment channels for path finding.
4075  *
4076  * `ScoreLookUp` is used to determine the penalty for a given channel.
4077  *
4078  * Scoring is in terms of fees willing to be paid in order to avoid routing through a channel.
4079  */
4080 typedef struct LDKScoreLookUp {
4081    /**
4082     * An opaque pointer which is passed to your function implementations as an argument.
4083     * This has no meaning in the LDK, and can be NULL or any other value.
4084     */
4085    void *this_arg;
4086    /**
4087     * Returns the fee in msats willing to be paid to avoid routing `send_amt_msat` through the
4088     * given channel in the direction from `source` to `target`.
4089     *
4090     * The channel's capacity (less any other MPP parts that are also being considered for use in
4091     * the same payment) is given by `capacity_msat`. It may be determined from various sources
4092     * such as a chain data, network gossip, or invoice hints. For invoice hints, a capacity near
4093     * [`u64::max_value`] is given to indicate sufficient capacity for the invoice's full amount.
4094     * Thus, implementations should be overflow-safe.
4095     */
4096    uint64_t (*channel_penalty_msat)(const void *this_arg, const struct LDKCandidateRouteHop *NONNULL_PTR candidate, struct LDKChannelUsage usage, const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR score_params);
4097    /**
4098     * Frees any resources associated with this object given its this_arg pointer.
4099     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
4100     */
4101    void (*free)(void *this_arg);
4102 } LDKScoreLookUp;
4103
4104
4105
4106 /**
4107  * A path in a [`Route`] to the payment recipient. Must always be at least length one.
4108  * If no [`Path::blinded_tail`] is present, then [`Path::hops`] length may be up to 19.
4109  */
4110 typedef struct MUST_USE_STRUCT LDKPath {
4111    /**
4112     * A pointer to the opaque Rust object.
4113     * Nearly everywhere, inner must be non-null, however in places where
4114     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4115     */
4116    LDKnativePath *inner;
4117    /**
4118     * Indicates that this is the only struct which contains the same pointer.
4119     * Rust functions which take ownership of an object provided via an argument require
4120     * this to be true and invalidate the object pointed to by inner.
4121     */
4122    bool is_owned;
4123 } LDKPath;
4124
4125 /**
4126  * `ScoreUpdate` is used to update the scorer's internal state after a payment attempt.
4127  */
4128 typedef struct LDKScoreUpdate {
4129    /**
4130     * An opaque pointer which is passed to your function implementations as an argument.
4131     * This has no meaning in the LDK, and can be NULL or any other value.
4132     */
4133    void *this_arg;
4134    /**
4135     * Handles updating channel penalties after failing to route through a channel.
4136     */
4137    void (*payment_path_failed)(void *this_arg, const struct LDKPath *NONNULL_PTR path, uint64_t short_channel_id, uint64_t duration_since_epoch);
4138    /**
4139     * Handles updating channel penalties after successfully routing along a path.
4140     */
4141    void (*payment_path_successful)(void *this_arg, const struct LDKPath *NONNULL_PTR path, uint64_t duration_since_epoch);
4142    /**
4143     * Handles updating channel penalties after a probe over the given path failed.
4144     */
4145    void (*probe_failed)(void *this_arg, const struct LDKPath *NONNULL_PTR path, uint64_t short_channel_id, uint64_t duration_since_epoch);
4146    /**
4147     * Handles updating channel penalties after a probe over the given path succeeded.
4148     */
4149    void (*probe_successful)(void *this_arg, const struct LDKPath *NONNULL_PTR path, uint64_t duration_since_epoch);
4150    /**
4151     * Scorers may wish to reduce their certainty of channel liquidity information over time.
4152     * Thus, this method is provided to allow scorers to observe the passage of time - the holder
4153     * of this object should call this method regularly (generally via the
4154     * `lightning-background-processor` crate).
4155     */
4156    void (*time_passed)(void *this_arg, uint64_t duration_since_epoch);
4157    /**
4158     * Frees any resources associated with this object given its this_arg pointer.
4159     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
4160     */
4161    void (*free)(void *this_arg);
4162 } LDKScoreUpdate;
4163
4164 /**
4165  * A scorer that is accessed under a lock.
4166  *
4167  * Needed so that calls to [`ScoreLookUp::channel_penalty_msat`] in [`find_route`] can be made while
4168  * having shared ownership of a scorer but without requiring internal locking in [`ScoreUpdate`]
4169  * implementations. Internal locking would be detrimental to route finding performance and could
4170  * result in [`ScoreLookUp::channel_penalty_msat`] returning a different value for the same channel.
4171  *
4172  * [`find_route`]: crate::routing::router::find_route
4173  */
4174 typedef struct LDKLockableScore {
4175    /**
4176     * An opaque pointer which is passed to your function implementations as an argument.
4177     * This has no meaning in the LDK, and can be NULL or any other value.
4178     */
4179    void *this_arg;
4180    /**
4181     * Returns read locked scorer.
4182     */
4183    struct LDKScoreLookUp (*read_lock)(const void *this_arg);
4184    /**
4185     * Returns write locked scorer.
4186     */
4187    struct LDKScoreUpdate (*write_lock)(const void *this_arg);
4188    /**
4189     * Frees any resources associated with this object given its this_arg pointer.
4190     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
4191     */
4192    void (*free)(void *this_arg);
4193 } LDKLockableScore;
4194
4195 /**
4196  * Refers to a scorer that is accessible under lock and also writeable to disk
4197  *
4198  * We need this trait to be able to pass in a scorer to `lightning-background-processor` that will enable us to
4199  * use the Persister to persist it.
4200  */
4201 typedef struct LDKWriteableScore {
4202    /**
4203     * An opaque pointer which is passed to your function implementations as an argument.
4204     * This has no meaning in the LDK, and can be NULL or any other value.
4205     */
4206    void *this_arg;
4207    /**
4208     * Implementation of LockableScore for this object.
4209     */
4210    struct LDKLockableScore LockableScore;
4211    /**
4212     * Serialize the object into a byte array
4213     */
4214    struct LDKCVec_u8Z (*write)(const void *this_arg);
4215    /**
4216     * Frees any resources associated with this object given its this_arg pointer.
4217     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
4218     */
4219    void (*free)(void *this_arg);
4220 } LDKWriteableScore;
4221
4222 /**
4223  * An enum which can either contain a crate::lightning::routing::scoring::WriteableScore or not
4224  */
4225 typedef enum LDKCOption_WriteableScoreZ_Tag {
4226    /**
4227     * When we're in this state, this COption_WriteableScoreZ contains a crate::lightning::routing::scoring::WriteableScore
4228     */
4229    LDKCOption_WriteableScoreZ_Some,
4230    /**
4231     * When we're in this state, this COption_WriteableScoreZ contains nothing
4232     */
4233    LDKCOption_WriteableScoreZ_None,
4234    /**
4235     * Must be last for serialization purposes
4236     */
4237    LDKCOption_WriteableScoreZ_Sentinel,
4238 } LDKCOption_WriteableScoreZ_Tag;
4239
4240 typedef struct LDKCOption_WriteableScoreZ {
4241    LDKCOption_WriteableScoreZ_Tag tag;
4242    union {
4243       struct {
4244          struct LDKWriteableScore some;
4245       };
4246    };
4247 } LDKCOption_WriteableScoreZ;
4248
4249 /**
4250  * The contents of CResult_NoneIOErrorZ
4251  */
4252 typedef union LDKCResult_NoneIOErrorZPtr {
4253    /**
4254     * Note that this value is always NULL, as there are no contents in the OK variant
4255     */
4256    void *result;
4257    /**
4258     * A pointer to the contents in the error state.
4259     * Reading from this pointer when `result_ok` is set is undefined.
4260     */
4261    enum LDKIOError *err;
4262 } LDKCResult_NoneIOErrorZPtr;
4263
4264 /**
4265  * A CResult_NoneIOErrorZ represents the result of a fallible operation,
4266  * containing a () on success and a crate::c_types::IOError on failure.
4267  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4268  */
4269 typedef struct LDKCResult_NoneIOErrorZ {
4270    /**
4271     * The contents of this CResult_NoneIOErrorZ, accessible via either
4272     * `err` or `result` depending on the state of `result_ok`.
4273     */
4274    union LDKCResult_NoneIOErrorZPtr contents;
4275    /**
4276     * Whether this CResult_NoneIOErrorZ represents a success state.
4277     */
4278    bool result_ok;
4279 } LDKCResult_NoneIOErrorZ;
4280
4281
4282
4283 /**
4284  * Details of a channel, as returned by [`ChannelManager::list_channels`] and [`ChannelManager::list_usable_channels`]
4285  */
4286 typedef struct MUST_USE_STRUCT LDKChannelDetails {
4287    /**
4288     * A pointer to the opaque Rust object.
4289     * Nearly everywhere, inner must be non-null, however in places where
4290     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4291     */
4292    LDKnativeChannelDetails *inner;
4293    /**
4294     * Indicates that this is the only struct which contains the same pointer.
4295     * Rust functions which take ownership of an object provided via an argument require
4296     * this to be true and invalidate the object pointed to by inner.
4297     */
4298    bool is_owned;
4299 } LDKChannelDetails;
4300
4301 /**
4302  * A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
4303  * This corresponds to std::vector in C++
4304  */
4305 typedef struct LDKCVec_ChannelDetailsZ {
4306    /**
4307     * The elements in the array.
4308     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4309     */
4310    struct LDKChannelDetails *data;
4311    /**
4312     * The number of elements pointed to by `data`.
4313     */
4314    uintptr_t datalen;
4315 } LDKCVec_ChannelDetailsZ;
4316
4317
4318
4319 /**
4320  * A route directs a payment from the sender (us) to the recipient. If the recipient supports MPP,
4321  * it can take multiple paths. Each path is composed of one or more hops through the network.
4322  */
4323 typedef struct MUST_USE_STRUCT LDKRoute {
4324    /**
4325     * A pointer to the opaque Rust object.
4326     * Nearly everywhere, inner must be non-null, however in places where
4327     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4328     */
4329    LDKnativeRoute *inner;
4330    /**
4331     * Indicates that this is the only struct which contains the same pointer.
4332     * Rust functions which take ownership of an object provided via an argument require
4333     * this to be true and invalidate the object pointed to by inner.
4334     */
4335    bool is_owned;
4336 } LDKRoute;
4337
4338
4339
4340 /**
4341  * An Err type for failure to process messages.
4342  */
4343 typedef struct MUST_USE_STRUCT LDKLightningError {
4344    /**
4345     * A pointer to the opaque Rust object.
4346     * Nearly everywhere, inner must be non-null, however in places where
4347     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4348     */
4349    LDKnativeLightningError *inner;
4350    /**
4351     * Indicates that this is the only struct which contains the same pointer.
4352     * Rust functions which take ownership of an object provided via an argument require
4353     * this to be true and invalidate the object pointed to by inner.
4354     */
4355    bool is_owned;
4356 } LDKLightningError;
4357
4358 /**
4359  * The contents of CResult_RouteLightningErrorZ
4360  */
4361 typedef union LDKCResult_RouteLightningErrorZPtr {
4362    /**
4363     * A pointer to the contents in the success state.
4364     * Reading from this pointer when `result_ok` is not set is undefined.
4365     */
4366    struct LDKRoute *result;
4367    /**
4368     * A pointer to the contents in the error state.
4369     * Reading from this pointer when `result_ok` is set is undefined.
4370     */
4371    struct LDKLightningError *err;
4372 } LDKCResult_RouteLightningErrorZPtr;
4373
4374 /**
4375  * A CResult_RouteLightningErrorZ represents the result of a fallible operation,
4376  * containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
4377  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4378  */
4379 typedef struct LDKCResult_RouteLightningErrorZ {
4380    /**
4381     * The contents of this CResult_RouteLightningErrorZ, accessible via either
4382     * `err` or `result` depending on the state of `result_ok`.
4383     */
4384    union LDKCResult_RouteLightningErrorZPtr contents;
4385    /**
4386     * Whether this CResult_RouteLightningErrorZ represents a success state.
4387     */
4388    bool result_ok;
4389 } LDKCResult_RouteLightningErrorZ;
4390
4391 /**
4392  * A tuple of 2 elements. See the individual fields for the types contained.
4393  */
4394 typedef struct LDKC2Tuple_BlindedPayInfoBlindedPathZ {
4395    /**
4396     * The element at position 0
4397     */
4398    struct LDKBlindedPayInfo a;
4399    /**
4400     * The element at position 1
4401     */
4402    struct LDKBlindedPath b;
4403 } LDKC2Tuple_BlindedPayInfoBlindedPathZ;
4404
4405 /**
4406  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZs of arbitrary size.
4407  * This corresponds to std::vector in C++
4408  */
4409 typedef struct LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ {
4410    /**
4411     * The elements in the array.
4412     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4413     */
4414    struct LDKC2Tuple_BlindedPayInfoBlindedPathZ *data;
4415    /**
4416     * The number of elements pointed to by `data`.
4417     */
4418    uintptr_t datalen;
4419 } LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ;
4420
4421 /**
4422  * The contents of CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ
4423  */
4424 typedef union LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZPtr {
4425    /**
4426     * A pointer to the contents in the success state.
4427     * Reading from this pointer when `result_ok` is not set is undefined.
4428     */
4429    struct LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ *result;
4430    /**
4431     * Note that this value is always NULL, as there are no contents in the Err variant
4432     */
4433    void *err;
4434 } LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZPtr;
4435
4436 /**
4437  * A CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ represents the result of a fallible operation,
4438  * containing a crate::c_types::derived::CVec_C2Tuple_BlindedPayInfoBlindedPathZZ on success and a () on failure.
4439  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4440  */
4441 typedef struct LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ {
4442    /**
4443     * The contents of this CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ, accessible via either
4444     * `err` or `result` depending on the state of `result_ok`.
4445     */
4446    union LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZPtr contents;
4447    /**
4448     * Whether this CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ represents a success state.
4449     */
4450    bool result_ok;
4451 } LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ;
4452
4453 /**
4454  * A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
4455  * This corresponds to std::vector in C++
4456  */
4457 typedef struct LDKCVec_PublicKeyZ {
4458    /**
4459     * The elements in the array.
4460     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4461     */
4462    struct LDKPublicKey *data;
4463    /**
4464     * The number of elements pointed to by `data`.
4465     */
4466    uintptr_t datalen;
4467 } LDKCVec_PublicKeyZ;
4468
4469
4470
4471 /**
4472  * A path for sending an [`OnionMessage`].
4473  */
4474 typedef struct MUST_USE_STRUCT LDKOnionMessagePath {
4475    /**
4476     * A pointer to the opaque Rust object.
4477     * Nearly everywhere, inner must be non-null, however in places where
4478     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4479     */
4480    LDKnativeOnionMessagePath *inner;
4481    /**
4482     * Indicates that this is the only struct which contains the same pointer.
4483     * Rust functions which take ownership of an object provided via an argument require
4484     * this to be true and invalidate the object pointed to by inner.
4485     */
4486    bool is_owned;
4487 } LDKOnionMessagePath;
4488
4489 /**
4490  * The contents of CResult_OnionMessagePathNoneZ
4491  */
4492 typedef union LDKCResult_OnionMessagePathNoneZPtr {
4493    /**
4494     * A pointer to the contents in the success state.
4495     * Reading from this pointer when `result_ok` is not set is undefined.
4496     */
4497    struct LDKOnionMessagePath *result;
4498    /**
4499     * Note that this value is always NULL, as there are no contents in the Err variant
4500     */
4501    void *err;
4502 } LDKCResult_OnionMessagePathNoneZPtr;
4503
4504 /**
4505  * A CResult_OnionMessagePathNoneZ represents the result of a fallible operation,
4506  * containing a crate::lightning::onion_message::messenger::OnionMessagePath on success and a () on failure.
4507  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4508  */
4509 typedef struct LDKCResult_OnionMessagePathNoneZ {
4510    /**
4511     * The contents of this CResult_OnionMessagePathNoneZ, accessible via either
4512     * `err` or `result` depending on the state of `result_ok`.
4513     */
4514    union LDKCResult_OnionMessagePathNoneZPtr contents;
4515    /**
4516     * Whether this CResult_OnionMessagePathNoneZ represents a success state.
4517     */
4518    bool result_ok;
4519 } LDKCResult_OnionMessagePathNoneZ;
4520
4521 /**
4522  * The contents of CResult_CVec_BlindedPathZNoneZ
4523  */
4524 typedef union LDKCResult_CVec_BlindedPathZNoneZPtr {
4525    /**
4526     * A pointer to the contents in the success state.
4527     * Reading from this pointer when `result_ok` is not set is undefined.
4528     */
4529    struct LDKCVec_BlindedPathZ *result;
4530    /**
4531     * Note that this value is always NULL, as there are no contents in the Err variant
4532     */
4533    void *err;
4534 } LDKCResult_CVec_BlindedPathZNoneZPtr;
4535
4536 /**
4537  * A CResult_CVec_BlindedPathZNoneZ represents the result of a fallible operation,
4538  * containing a crate::c_types::derived::CVec_BlindedPathZ on success and a () on failure.
4539  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4540  */
4541 typedef struct LDKCResult_CVec_BlindedPathZNoneZ {
4542    /**
4543     * The contents of this CResult_CVec_BlindedPathZNoneZ, accessible via either
4544     * `err` or `result` depending on the state of `result_ok`.
4545     */
4546    union LDKCResult_CVec_BlindedPathZNoneZPtr contents;
4547    /**
4548     * Whether this CResult_CVec_BlindedPathZNoneZ represents a success state.
4549     */
4550    bool result_ok;
4551 } LDKCResult_CVec_BlindedPathZNoneZ;
4552
4553
4554
4555 /**
4556  * A data structure for tracking in-flight HTLCs. May be used during pathfinding to account for
4557  * in-use channel liquidity.
4558  */
4559 typedef struct MUST_USE_STRUCT LDKInFlightHtlcs {
4560    /**
4561     * A pointer to the opaque Rust object.
4562     * Nearly everywhere, inner must be non-null, however in places where
4563     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4564     */
4565    LDKnativeInFlightHtlcs *inner;
4566    /**
4567     * Indicates that this is the only struct which contains the same pointer.
4568     * Rust functions which take ownership of an object provided via an argument require
4569     * this to be true and invalidate the object pointed to by inner.
4570     */
4571    bool is_owned;
4572 } LDKInFlightHtlcs;
4573
4574 /**
4575  * The contents of CResult_InFlightHtlcsDecodeErrorZ
4576  */
4577 typedef union LDKCResult_InFlightHtlcsDecodeErrorZPtr {
4578    /**
4579     * A pointer to the contents in the success state.
4580     * Reading from this pointer when `result_ok` is not set is undefined.
4581     */
4582    struct LDKInFlightHtlcs *result;
4583    /**
4584     * A pointer to the contents in the error state.
4585     * Reading from this pointer when `result_ok` is set is undefined.
4586     */
4587    struct LDKDecodeError *err;
4588 } LDKCResult_InFlightHtlcsDecodeErrorZPtr;
4589
4590 /**
4591  * A CResult_InFlightHtlcsDecodeErrorZ represents the result of a fallible operation,
4592  * containing a crate::lightning::routing::router::InFlightHtlcs on success and a crate::lightning::ln::msgs::DecodeError on failure.
4593  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4594  */
4595 typedef struct LDKCResult_InFlightHtlcsDecodeErrorZ {
4596    /**
4597     * The contents of this CResult_InFlightHtlcsDecodeErrorZ, accessible via either
4598     * `err` or `result` depending on the state of `result_ok`.
4599     */
4600    union LDKCResult_InFlightHtlcsDecodeErrorZPtr contents;
4601    /**
4602     * Whether this CResult_InFlightHtlcsDecodeErrorZ represents a success state.
4603     */
4604    bool result_ok;
4605 } LDKCResult_InFlightHtlcsDecodeErrorZ;
4606
4607
4608
4609 /**
4610  * A hop in a route, and additional metadata about it. \"Hop\" is defined as a node and the channel
4611  * that leads to it.
4612  */
4613 typedef struct MUST_USE_STRUCT LDKRouteHop {
4614    /**
4615     * A pointer to the opaque Rust object.
4616     * Nearly everywhere, inner must be non-null, however in places where
4617     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4618     */
4619    LDKnativeRouteHop *inner;
4620    /**
4621     * Indicates that this is the only struct which contains the same pointer.
4622     * Rust functions which take ownership of an object provided via an argument require
4623     * this to be true and invalidate the object pointed to by inner.
4624     */
4625    bool is_owned;
4626 } LDKRouteHop;
4627
4628 /**
4629  * The contents of CResult_RouteHopDecodeErrorZ
4630  */
4631 typedef union LDKCResult_RouteHopDecodeErrorZPtr {
4632    /**
4633     * A pointer to the contents in the success state.
4634     * Reading from this pointer when `result_ok` is not set is undefined.
4635     */
4636    struct LDKRouteHop *result;
4637    /**
4638     * A pointer to the contents in the error state.
4639     * Reading from this pointer when `result_ok` is set is undefined.
4640     */
4641    struct LDKDecodeError *err;
4642 } LDKCResult_RouteHopDecodeErrorZPtr;
4643
4644 /**
4645  * A CResult_RouteHopDecodeErrorZ represents the result of a fallible operation,
4646  * containing a crate::lightning::routing::router::RouteHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
4647  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4648  */
4649 typedef struct LDKCResult_RouteHopDecodeErrorZ {
4650    /**
4651     * The contents of this CResult_RouteHopDecodeErrorZ, accessible via either
4652     * `err` or `result` depending on the state of `result_ok`.
4653     */
4654    union LDKCResult_RouteHopDecodeErrorZPtr contents;
4655    /**
4656     * Whether this CResult_RouteHopDecodeErrorZ represents a success state.
4657     */
4658    bool result_ok;
4659 } LDKCResult_RouteHopDecodeErrorZ;
4660
4661
4662
4663 /**
4664  * An encrypted payload and node id corresponding to a hop in a payment or onion message path, to
4665  * be encoded in the sender's onion packet. These hops cannot be identified by outside observers
4666  * and thus can be used to hide the identity of the recipient.
4667  */
4668 typedef struct MUST_USE_STRUCT LDKBlindedHop {
4669    /**
4670     * A pointer to the opaque Rust object.
4671     * Nearly everywhere, inner must be non-null, however in places where
4672     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4673     */
4674    LDKnativeBlindedHop *inner;
4675    /**
4676     * Indicates that this is the only struct which contains the same pointer.
4677     * Rust functions which take ownership of an object provided via an argument require
4678     * this to be true and invalidate the object pointed to by inner.
4679     */
4680    bool is_owned;
4681 } LDKBlindedHop;
4682
4683 /**
4684  * A dynamically-allocated array of crate::lightning::blinded_path::BlindedHops of arbitrary size.
4685  * This corresponds to std::vector in C++
4686  */
4687 typedef struct LDKCVec_BlindedHopZ {
4688    /**
4689     * The elements in the array.
4690     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4691     */
4692    struct LDKBlindedHop *data;
4693    /**
4694     * The number of elements pointed to by `data`.
4695     */
4696    uintptr_t datalen;
4697 } LDKCVec_BlindedHopZ;
4698
4699
4700
4701 /**
4702  * The blinded portion of a [`Path`], if we're routing to a recipient who provided blinded paths in
4703  * their [`Bolt12Invoice`].
4704  *
4705  * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
4706  */
4707 typedef struct MUST_USE_STRUCT LDKBlindedTail {
4708    /**
4709     * A pointer to the opaque Rust object.
4710     * Nearly everywhere, inner must be non-null, however in places where
4711     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4712     */
4713    LDKnativeBlindedTail *inner;
4714    /**
4715     * Indicates that this is the only struct which contains the same pointer.
4716     * Rust functions which take ownership of an object provided via an argument require
4717     * this to be true and invalidate the object pointed to by inner.
4718     */
4719    bool is_owned;
4720 } LDKBlindedTail;
4721
4722 /**
4723  * The contents of CResult_BlindedTailDecodeErrorZ
4724  */
4725 typedef union LDKCResult_BlindedTailDecodeErrorZPtr {
4726    /**
4727     * A pointer to the contents in the success state.
4728     * Reading from this pointer when `result_ok` is not set is undefined.
4729     */
4730    struct LDKBlindedTail *result;
4731    /**
4732     * A pointer to the contents in the error state.
4733     * Reading from this pointer when `result_ok` is set is undefined.
4734     */
4735    struct LDKDecodeError *err;
4736 } LDKCResult_BlindedTailDecodeErrorZPtr;
4737
4738 /**
4739  * A CResult_BlindedTailDecodeErrorZ represents the result of a fallible operation,
4740  * containing a crate::lightning::routing::router::BlindedTail on success and a crate::lightning::ln::msgs::DecodeError on failure.
4741  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4742  */
4743 typedef struct LDKCResult_BlindedTailDecodeErrorZ {
4744    /**
4745     * The contents of this CResult_BlindedTailDecodeErrorZ, accessible via either
4746     * `err` or `result` depending on the state of `result_ok`.
4747     */
4748    union LDKCResult_BlindedTailDecodeErrorZPtr contents;
4749    /**
4750     * Whether this CResult_BlindedTailDecodeErrorZ represents a success state.
4751     */
4752    bool result_ok;
4753 } LDKCResult_BlindedTailDecodeErrorZ;
4754
4755 /**
4756  * A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
4757  * This corresponds to std::vector in C++
4758  */
4759 typedef struct LDKCVec_RouteHopZ {
4760    /**
4761     * The elements in the array.
4762     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4763     */
4764    struct LDKRouteHop *data;
4765    /**
4766     * The number of elements pointed to by `data`.
4767     */
4768    uintptr_t datalen;
4769 } LDKCVec_RouteHopZ;
4770
4771 /**
4772  * A dynamically-allocated array of crate::lightning::routing::router::Paths of arbitrary size.
4773  * This corresponds to std::vector in C++
4774  */
4775 typedef struct LDKCVec_PathZ {
4776    /**
4777     * The elements in the array.
4778     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4779     */
4780    struct LDKPath *data;
4781    /**
4782     * The number of elements pointed to by `data`.
4783     */
4784    uintptr_t datalen;
4785 } LDKCVec_PathZ;
4786
4787 /**
4788  * The contents of CResult_RouteDecodeErrorZ
4789  */
4790 typedef union LDKCResult_RouteDecodeErrorZPtr {
4791    /**
4792     * A pointer to the contents in the success state.
4793     * Reading from this pointer when `result_ok` is not set is undefined.
4794     */
4795    struct LDKRoute *result;
4796    /**
4797     * A pointer to the contents in the error state.
4798     * Reading from this pointer when `result_ok` is set is undefined.
4799     */
4800    struct LDKDecodeError *err;
4801 } LDKCResult_RouteDecodeErrorZPtr;
4802
4803 /**
4804  * A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
4805  * containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
4806  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4807  */
4808 typedef struct LDKCResult_RouteDecodeErrorZ {
4809    /**
4810     * The contents of this CResult_RouteDecodeErrorZ, accessible via either
4811     * `err` or `result` depending on the state of `result_ok`.
4812     */
4813    union LDKCResult_RouteDecodeErrorZPtr contents;
4814    /**
4815     * Whether this CResult_RouteDecodeErrorZ represents a success state.
4816     */
4817    bool result_ok;
4818 } LDKCResult_RouteDecodeErrorZ;
4819
4820
4821
4822 /**
4823  * Parameters needed to find a [`Route`].
4824  *
4825  * Passed to [`find_route`] and [`build_route_from_hops`].
4826  */
4827 typedef struct MUST_USE_STRUCT LDKRouteParameters {
4828    /**
4829     * A pointer to the opaque Rust object.
4830     * Nearly everywhere, inner must be non-null, however in places where
4831     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4832     */
4833    LDKnativeRouteParameters *inner;
4834    /**
4835     * Indicates that this is the only struct which contains the same pointer.
4836     * Rust functions which take ownership of an object provided via an argument require
4837     * this to be true and invalidate the object pointed to by inner.
4838     */
4839    bool is_owned;
4840 } LDKRouteParameters;
4841
4842 /**
4843  * The contents of CResult_RouteParametersDecodeErrorZ
4844  */
4845 typedef union LDKCResult_RouteParametersDecodeErrorZPtr {
4846    /**
4847     * A pointer to the contents in the success state.
4848     * Reading from this pointer when `result_ok` is not set is undefined.
4849     */
4850    struct LDKRouteParameters *result;
4851    /**
4852     * A pointer to the contents in the error state.
4853     * Reading from this pointer when `result_ok` is set is undefined.
4854     */
4855    struct LDKDecodeError *err;
4856 } LDKCResult_RouteParametersDecodeErrorZPtr;
4857
4858 /**
4859  * A CResult_RouteParametersDecodeErrorZ represents the result of a fallible operation,
4860  * containing a crate::lightning::routing::router::RouteParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
4861  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4862  */
4863 typedef struct LDKCResult_RouteParametersDecodeErrorZ {
4864    /**
4865     * The contents of this CResult_RouteParametersDecodeErrorZ, accessible via either
4866     * `err` or `result` depending on the state of `result_ok`.
4867     */
4868    union LDKCResult_RouteParametersDecodeErrorZPtr contents;
4869    /**
4870     * Whether this CResult_RouteParametersDecodeErrorZ represents a success state.
4871     */
4872    bool result_ok;
4873 } LDKCResult_RouteParametersDecodeErrorZ;
4874
4875 /**
4876  * A dynamically-allocated array of u64s of arbitrary size.
4877  * This corresponds to std::vector in C++
4878  */
4879 typedef struct LDKCVec_u64Z {
4880    /**
4881     * The elements in the array.
4882     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4883     */
4884    uint64_t *data;
4885    /**
4886     * The number of elements pointed to by `data`.
4887     */
4888    uintptr_t datalen;
4889 } LDKCVec_u64Z;
4890
4891
4892
4893 /**
4894  * Information used to route a payment.
4895  */
4896 typedef struct MUST_USE_STRUCT LDKPaymentParameters {
4897    /**
4898     * A pointer to the opaque Rust object.
4899     * Nearly everywhere, inner must be non-null, however in places where
4900     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4901     */
4902    LDKnativePaymentParameters *inner;
4903    /**
4904     * Indicates that this is the only struct which contains the same pointer.
4905     * Rust functions which take ownership of an object provided via an argument require
4906     * this to be true and invalidate the object pointed to by inner.
4907     */
4908    bool is_owned;
4909 } LDKPaymentParameters;
4910
4911 /**
4912  * The contents of CResult_PaymentParametersDecodeErrorZ
4913  */
4914 typedef union LDKCResult_PaymentParametersDecodeErrorZPtr {
4915    /**
4916     * A pointer to the contents in the success state.
4917     * Reading from this pointer when `result_ok` is not set is undefined.
4918     */
4919    struct LDKPaymentParameters *result;
4920    /**
4921     * A pointer to the contents in the error state.
4922     * Reading from this pointer when `result_ok` is set is undefined.
4923     */
4924    struct LDKDecodeError *err;
4925 } LDKCResult_PaymentParametersDecodeErrorZPtr;
4926
4927 /**
4928  * A CResult_PaymentParametersDecodeErrorZ represents the result of a fallible operation,
4929  * containing a crate::lightning::routing::router::PaymentParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
4930  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4931  */
4932 typedef struct LDKCResult_PaymentParametersDecodeErrorZ {
4933    /**
4934     * The contents of this CResult_PaymentParametersDecodeErrorZ, accessible via either
4935     * `err` or `result` depending on the state of `result_ok`.
4936     */
4937    union LDKCResult_PaymentParametersDecodeErrorZPtr contents;
4938    /**
4939     * Whether this CResult_PaymentParametersDecodeErrorZ represents a success state.
4940     */
4941    bool result_ok;
4942 } LDKCResult_PaymentParametersDecodeErrorZ;
4943
4944
4945
4946 /**
4947  * A list of hops along a payment path terminating with a channel to the recipient.
4948  */
4949 typedef struct MUST_USE_STRUCT LDKRouteHint {
4950    /**
4951     * A pointer to the opaque Rust object.
4952     * Nearly everywhere, inner must be non-null, however in places where
4953     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4954     */
4955    LDKnativeRouteHint *inner;
4956    /**
4957     * Indicates that this is the only struct which contains the same pointer.
4958     * Rust functions which take ownership of an object provided via an argument require
4959     * this to be true and invalidate the object pointed to by inner.
4960     */
4961    bool is_owned;
4962 } LDKRouteHint;
4963
4964 /**
4965  * A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size.
4966  * This corresponds to std::vector in C++
4967  */
4968 typedef struct LDKCVec_RouteHintZ {
4969    /**
4970     * The elements in the array.
4971     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4972     */
4973    struct LDKRouteHint *data;
4974    /**
4975     * The number of elements pointed to by `data`.
4976     */
4977    uintptr_t datalen;
4978 } LDKCVec_RouteHintZ;
4979
4980
4981
4982 /**
4983  * A channel descriptor for a hop along a payment path.
4984  *
4985  * While this generally comes from BOLT 11's `r` field, this struct includes more fields than are
4986  * available in BOLT 11. Thus, encoding and decoding this via `lightning-invoice` is lossy, as
4987  * fields not supported in BOLT 11 will be stripped.
4988  */
4989 typedef struct MUST_USE_STRUCT LDKRouteHintHop {
4990    /**
4991     * A pointer to the opaque Rust object.
4992     * Nearly everywhere, inner must be non-null, however in places where
4993     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4994     */
4995    LDKnativeRouteHintHop *inner;
4996    /**
4997     * Indicates that this is the only struct which contains the same pointer.
4998     * Rust functions which take ownership of an object provided via an argument require
4999     * this to be true and invalidate the object pointed to by inner.
5000     */
5001    bool is_owned;
5002 } LDKRouteHintHop;
5003
5004 /**
5005  * A dynamically-allocated array of crate::lightning::routing::router::RouteHintHops of arbitrary size.
5006  * This corresponds to std::vector in C++
5007  */
5008 typedef struct LDKCVec_RouteHintHopZ {
5009    /**
5010     * The elements in the array.
5011     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5012     */
5013    struct LDKRouteHintHop *data;
5014    /**
5015     * The number of elements pointed to by `data`.
5016     */
5017    uintptr_t datalen;
5018 } LDKCVec_RouteHintHopZ;
5019
5020 /**
5021  * The contents of CResult_RouteHintDecodeErrorZ
5022  */
5023 typedef union LDKCResult_RouteHintDecodeErrorZPtr {
5024    /**
5025     * A pointer to the contents in the success state.
5026     * Reading from this pointer when `result_ok` is not set is undefined.
5027     */
5028    struct LDKRouteHint *result;
5029    /**
5030     * A pointer to the contents in the error state.
5031     * Reading from this pointer when `result_ok` is set is undefined.
5032     */
5033    struct LDKDecodeError *err;
5034 } LDKCResult_RouteHintDecodeErrorZPtr;
5035
5036 /**
5037  * A CResult_RouteHintDecodeErrorZ represents the result of a fallible operation,
5038  * containing a crate::lightning::routing::router::RouteHint on success and a crate::lightning::ln::msgs::DecodeError on failure.
5039  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5040  */
5041 typedef struct LDKCResult_RouteHintDecodeErrorZ {
5042    /**
5043     * The contents of this CResult_RouteHintDecodeErrorZ, accessible via either
5044     * `err` or `result` depending on the state of `result_ok`.
5045     */
5046    union LDKCResult_RouteHintDecodeErrorZPtr contents;
5047    /**
5048     * Whether this CResult_RouteHintDecodeErrorZ represents a success state.
5049     */
5050    bool result_ok;
5051 } LDKCResult_RouteHintDecodeErrorZ;
5052
5053 /**
5054  * The contents of CResult_RouteHintHopDecodeErrorZ
5055  */
5056 typedef union LDKCResult_RouteHintHopDecodeErrorZPtr {
5057    /**
5058     * A pointer to the contents in the success state.
5059     * Reading from this pointer when `result_ok` is not set is undefined.
5060     */
5061    struct LDKRouteHintHop *result;
5062    /**
5063     * A pointer to the contents in the error state.
5064     * Reading from this pointer when `result_ok` is set is undefined.
5065     */
5066    struct LDKDecodeError *err;
5067 } LDKCResult_RouteHintHopDecodeErrorZPtr;
5068
5069 /**
5070  * A CResult_RouteHintHopDecodeErrorZ represents the result of a fallible operation,
5071  * containing a crate::lightning::routing::router::RouteHintHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
5072  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5073  */
5074 typedef struct LDKCResult_RouteHintHopDecodeErrorZ {
5075    /**
5076     * The contents of this CResult_RouteHintHopDecodeErrorZ, accessible via either
5077     * `err` or `result` depending on the state of `result_ok`.
5078     */
5079    union LDKCResult_RouteHintHopDecodeErrorZPtr contents;
5080    /**
5081     * Whether this CResult_RouteHintHopDecodeErrorZ represents a success state.
5082     */
5083    bool result_ok;
5084 } LDKCResult_RouteHintHopDecodeErrorZ;
5085
5086
5087
5088 /**
5089  * [`ScoreLookUp`] implementation that uses a fixed penalty.
5090  */
5091 typedef struct MUST_USE_STRUCT LDKFixedPenaltyScorer {
5092    /**
5093     * A pointer to the opaque Rust object.
5094     * Nearly everywhere, inner must be non-null, however in places where
5095     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5096     */
5097    LDKnativeFixedPenaltyScorer *inner;
5098    /**
5099     * Indicates that this is the only struct which contains the same pointer.
5100     * Rust functions which take ownership of an object provided via an argument require
5101     * this to be true and invalidate the object pointed to by inner.
5102     */
5103    bool is_owned;
5104 } LDKFixedPenaltyScorer;
5105
5106 /**
5107  * The contents of CResult_FixedPenaltyScorerDecodeErrorZ
5108  */
5109 typedef union LDKCResult_FixedPenaltyScorerDecodeErrorZPtr {
5110    /**
5111     * A pointer to the contents in the success state.
5112     * Reading from this pointer when `result_ok` is not set is undefined.
5113     */
5114    struct LDKFixedPenaltyScorer *result;
5115    /**
5116     * A pointer to the contents in the error state.
5117     * Reading from this pointer when `result_ok` is set is undefined.
5118     */
5119    struct LDKDecodeError *err;
5120 } LDKCResult_FixedPenaltyScorerDecodeErrorZPtr;
5121
5122 /**
5123  * A CResult_FixedPenaltyScorerDecodeErrorZ represents the result of a fallible operation,
5124  * containing a crate::lightning::routing::scoring::FixedPenaltyScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
5125  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5126  */
5127 typedef struct LDKCResult_FixedPenaltyScorerDecodeErrorZ {
5128    /**
5129     * The contents of this CResult_FixedPenaltyScorerDecodeErrorZ, accessible via either
5130     * `err` or `result` depending on the state of `result_ok`.
5131     */
5132    union LDKCResult_FixedPenaltyScorerDecodeErrorZPtr contents;
5133    /**
5134     * Whether this CResult_FixedPenaltyScorerDecodeErrorZ represents a success state.
5135     */
5136    bool result_ok;
5137 } LDKCResult_FixedPenaltyScorerDecodeErrorZ;
5138
5139
5140
5141 /**
5142  * Represents the compressed public key of a node
5143  */
5144 typedef struct MUST_USE_STRUCT LDKNodeId {
5145    /**
5146     * A pointer to the opaque Rust object.
5147     * Nearly everywhere, inner must be non-null, however in places where
5148     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5149     */
5150    LDKnativeNodeId *inner;
5151    /**
5152     * Indicates that this is the only struct which contains the same pointer.
5153     * Rust functions which take ownership of an object provided via an argument require
5154     * this to be true and invalidate the object pointed to by inner.
5155     */
5156    bool is_owned;
5157 } LDKNodeId;
5158
5159 /**
5160  * A dynamically-allocated array of crate::lightning::routing::gossip::NodeIds of arbitrary size.
5161  * This corresponds to std::vector in C++
5162  */
5163 typedef struct LDKCVec_NodeIdZ {
5164    /**
5165     * The elements in the array.
5166     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5167     */
5168    struct LDKNodeId *data;
5169    /**
5170     * The number of elements pointed to by `data`.
5171     */
5172    uintptr_t datalen;
5173 } LDKCVec_NodeIdZ;
5174
5175 /**
5176  * A tuple of 2 elements. See the individual fields for the types contained.
5177  */
5178 typedef struct LDKC2Tuple_u64u64Z {
5179    /**
5180     * The element at position 0
5181     */
5182    uint64_t a;
5183    /**
5184     * The element at position 1
5185     */
5186    uint64_t b;
5187 } LDKC2Tuple_u64u64Z;
5188
5189 /**
5190  * An enum which can either contain a crate::c_types::derived::C2Tuple_u64u64Z or not
5191  */
5192 typedef enum LDKCOption_C2Tuple_u64u64ZZ_Tag {
5193    /**
5194     * When we're in this state, this COption_C2Tuple_u64u64ZZ contains a crate::c_types::derived::C2Tuple_u64u64Z
5195     */
5196    LDKCOption_C2Tuple_u64u64ZZ_Some,
5197    /**
5198     * When we're in this state, this COption_C2Tuple_u64u64ZZ contains nothing
5199     */
5200    LDKCOption_C2Tuple_u64u64ZZ_None,
5201    /**
5202     * Must be last for serialization purposes
5203     */
5204    LDKCOption_C2Tuple_u64u64ZZ_Sentinel,
5205 } LDKCOption_C2Tuple_u64u64ZZ_Tag;
5206
5207 typedef struct LDKCOption_C2Tuple_u64u64ZZ {
5208    LDKCOption_C2Tuple_u64u64ZZ_Tag tag;
5209    union {
5210       struct {
5211          struct LDKC2Tuple_u64u64Z some;
5212       };
5213    };
5214 } LDKCOption_C2Tuple_u64u64ZZ;
5215
5216 /**
5217  * 32 u16s
5218  */
5219 typedef struct LDKThirtyTwoU16s {
5220    /**
5221     * The thirty-two 16-bit integers
5222     */
5223    uint16_t data[32];
5224 } LDKThirtyTwoU16s;
5225
5226 /**
5227  * A tuple of 2 elements. See the individual fields for the types contained.
5228  */
5229 typedef struct LDKC2Tuple_Z {
5230    /**
5231     * The element at position 0
5232     */
5233    struct LDKThirtyTwoU16s a;
5234    /**
5235     * The element at position 1
5236     */
5237    struct LDKThirtyTwoU16s b;
5238 } LDKC2Tuple_Z;
5239
5240 /**
5241  * A tuple of 2 elements. See the individual fields for the types contained.
5242  */
5243 typedef struct LDKC2Tuple__u1632_u1632Z {
5244    /**
5245     * The element at position 0
5246     */
5247    struct LDKThirtyTwoU16s a;
5248    /**
5249     * The element at position 1
5250     */
5251    struct LDKThirtyTwoU16s b;
5252 } LDKC2Tuple__u1632_u1632Z;
5253
5254 /**
5255  * An enum which can either contain a crate::c_types::derived::C2Tuple__u1632_u1632Z or not
5256  */
5257 typedef enum LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Tag {
5258    /**
5259     * When we're in this state, this COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ contains a crate::c_types::derived::C2Tuple__u1632_u1632Z
5260     */
5261    LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some,
5262    /**
5263     * When we're in this state, this COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ contains nothing
5264     */
5265    LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None,
5266    /**
5267     * Must be last for serialization purposes
5268     */
5269    LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Sentinel,
5270 } LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Tag;
5271
5272 typedef struct LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ {
5273    LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Tag tag;
5274    union {
5275       struct {
5276          struct LDKC2Tuple__u1632_u1632Z some;
5277       };
5278    };
5279 } LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ;
5280
5281 /**
5282  * An enum which can either contain a f64 or not
5283  */
5284 typedef enum LDKCOption_f64Z_Tag {
5285    /**
5286     * When we're in this state, this COption_f64Z contains a f64
5287     */
5288    LDKCOption_f64Z_Some,
5289    /**
5290     * When we're in this state, this COption_f64Z contains nothing
5291     */
5292    LDKCOption_f64Z_None,
5293    /**
5294     * Must be last for serialization purposes
5295     */
5296    LDKCOption_f64Z_Sentinel,
5297 } LDKCOption_f64Z_Tag;
5298
5299 typedef struct LDKCOption_f64Z {
5300    LDKCOption_f64Z_Tag tag;
5301    union {
5302       struct {
5303          double some;
5304       };
5305    };
5306 } LDKCOption_f64Z;
5307
5308
5309
5310 /**
5311  * A Record, unit of logging output with Metadata to enable filtering
5312  * Module_path, file, line to inform on log's source
5313  */
5314 typedef struct MUST_USE_STRUCT LDKRecord {
5315    /**
5316     * A pointer to the opaque Rust object.
5317     * Nearly everywhere, inner must be non-null, however in places where
5318     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5319     */
5320    LDKnativeRecord *inner;
5321    /**
5322     * Indicates that this is the only struct which contains the same pointer.
5323     * Rust functions which take ownership of an object provided via an argument require
5324     * this to be true and invalidate the object pointed to by inner.
5325     */
5326    bool is_owned;
5327 } LDKRecord;
5328
5329 /**
5330  * A trait encapsulating the operations required of a logger.
5331  */
5332 typedef struct LDKLogger {
5333    /**
5334     * An opaque pointer which is passed to your function implementations as an argument.
5335     * This has no meaning in the LDK, and can be NULL or any other value.
5336     */
5337    void *this_arg;
5338    /**
5339     * Logs the [`Record`].
5340     */
5341    void (*log)(const void *this_arg, struct LDKRecord record);
5342    /**
5343     * Frees any resources associated with this object given its this_arg pointer.
5344     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
5345     */
5346    void (*free)(void *this_arg);
5347 } LDKLogger;
5348
5349
5350
5351 /**
5352  * Represents the network as nodes and channels between them
5353  */
5354 typedef struct MUST_USE_STRUCT LDKNetworkGraph {
5355    /**
5356     * A pointer to the opaque Rust object.
5357     * Nearly everywhere, inner must be non-null, however in places where
5358     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5359     */
5360    LDKnativeNetworkGraph *inner;
5361    /**
5362     * Indicates that this is the only struct which contains the same pointer.
5363     * Rust functions which take ownership of an object provided via an argument require
5364     * this to be true and invalidate the object pointed to by inner.
5365     */
5366    bool is_owned;
5367 } LDKNetworkGraph;
5368
5369
5370
5371 /**
5372  * [`ScoreLookUp`] implementation using channel success probability distributions.
5373  *
5374  * Channels are tracked with upper and lower liquidity bounds - when an HTLC fails at a channel,
5375  * we learn that the upper-bound on the available liquidity is lower than the amount of the HTLC.
5376  * When a payment is forwarded through a channel (but fails later in the route), we learn the
5377  * lower-bound on the channel's available liquidity must be at least the value of the HTLC.
5378  *
5379  * These bounds are then used to determine a success probability using the formula from
5380  * *Optimally Reliable & Cheap Payment Flows on the Lightning Network* by Rene Pickhardt
5381  * and Stefan Richter [[1]] (i.e. `(upper_bound - payment_amount) / (upper_bound - lower_bound)`).
5382  *
5383  * This probability is combined with the [`liquidity_penalty_multiplier_msat`] and
5384  * [`liquidity_penalty_amount_multiplier_msat`] parameters to calculate a concrete penalty in
5385  * milli-satoshis. The penalties, when added across all hops, have the property of being linear in
5386  * terms of the entire path's success probability. This allows the router to directly compare
5387  * penalties for different paths. See the documentation of those parameters for the exact formulas.
5388  *
5389  * The liquidity bounds are decayed by halving them every [`liquidity_offset_half_life`].
5390  *
5391  * Further, we track the history of our upper and lower liquidity bounds for each channel,
5392  * allowing us to assign a second penalty (using [`historical_liquidity_penalty_multiplier_msat`]
5393  * and [`historical_liquidity_penalty_amount_multiplier_msat`]) based on the same probability
5394  * formula, but using the history of a channel rather than our latest estimates for the liquidity
5395  * bounds.
5396  *
5397  * [1]: https://arxiv.org/abs/2107.05322
5398  * [`liquidity_penalty_multiplier_msat`]: ProbabilisticScoringFeeParameters::liquidity_penalty_multiplier_msat
5399  * [`liquidity_penalty_amount_multiplier_msat`]: ProbabilisticScoringFeeParameters::liquidity_penalty_amount_multiplier_msat
5400  * [`liquidity_offset_half_life`]: ProbabilisticScoringDecayParameters::liquidity_offset_half_life
5401  * [`historical_liquidity_penalty_multiplier_msat`]: ProbabilisticScoringFeeParameters::historical_liquidity_penalty_multiplier_msat
5402  * [`historical_liquidity_penalty_amount_multiplier_msat`]: ProbabilisticScoringFeeParameters::historical_liquidity_penalty_amount_multiplier_msat
5403  */
5404 typedef struct MUST_USE_STRUCT LDKProbabilisticScorer {
5405    /**
5406     * A pointer to the opaque Rust object.
5407     * Nearly everywhere, inner must be non-null, however in places where
5408     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5409     */
5410    LDKnativeProbabilisticScorer *inner;
5411    /**
5412     * Indicates that this is the only struct which contains the same pointer.
5413     * Rust functions which take ownership of an object provided via an argument require
5414     * this to be true and invalidate the object pointed to by inner.
5415     */
5416    bool is_owned;
5417 } LDKProbabilisticScorer;
5418
5419 /**
5420  * The contents of CResult_ProbabilisticScorerDecodeErrorZ
5421  */
5422 typedef union LDKCResult_ProbabilisticScorerDecodeErrorZPtr {
5423    /**
5424     * A pointer to the contents in the success state.
5425     * Reading from this pointer when `result_ok` is not set is undefined.
5426     */
5427    struct LDKProbabilisticScorer *result;
5428    /**
5429     * A pointer to the contents in the error state.
5430     * Reading from this pointer when `result_ok` is set is undefined.
5431     */
5432    struct LDKDecodeError *err;
5433 } LDKCResult_ProbabilisticScorerDecodeErrorZPtr;
5434
5435 /**
5436  * A CResult_ProbabilisticScorerDecodeErrorZ represents the result of a fallible operation,
5437  * containing a crate::lightning::routing::scoring::ProbabilisticScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
5438  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5439  */
5440 typedef struct LDKCResult_ProbabilisticScorerDecodeErrorZ {
5441    /**
5442     * The contents of this CResult_ProbabilisticScorerDecodeErrorZ, accessible via either
5443     * `err` or `result` depending on the state of `result_ok`.
5444     */
5445    union LDKCResult_ProbabilisticScorerDecodeErrorZPtr contents;
5446    /**
5447     * Whether this CResult_ProbabilisticScorerDecodeErrorZ represents a success state.
5448     */
5449    bool result_ok;
5450 } LDKCResult_ProbabilisticScorerDecodeErrorZ;
5451
5452
5453
5454 /**
5455  * The best known block as identified by its hash and height.
5456  */
5457 typedef struct MUST_USE_STRUCT LDKBestBlock {
5458    /**
5459     * A pointer to the opaque Rust object.
5460     * Nearly everywhere, inner must be non-null, however in places where
5461     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5462     */
5463    LDKnativeBestBlock *inner;
5464    /**
5465     * Indicates that this is the only struct which contains the same pointer.
5466     * Rust functions which take ownership of an object provided via an argument require
5467     * this to be true and invalidate the object pointed to by inner.
5468     */
5469    bool is_owned;
5470 } LDKBestBlock;
5471
5472 /**
5473  * The contents of CResult_BestBlockDecodeErrorZ
5474  */
5475 typedef union LDKCResult_BestBlockDecodeErrorZPtr {
5476    /**
5477     * A pointer to the contents in the success state.
5478     * Reading from this pointer when `result_ok` is not set is undefined.
5479     */
5480    struct LDKBestBlock *result;
5481    /**
5482     * A pointer to the contents in the error state.
5483     * Reading from this pointer when `result_ok` is set is undefined.
5484     */
5485    struct LDKDecodeError *err;
5486 } LDKCResult_BestBlockDecodeErrorZPtr;
5487
5488 /**
5489  * A CResult_BestBlockDecodeErrorZ represents the result of a fallible operation,
5490  * containing a crate::lightning::chain::BestBlock on success and a crate::lightning::ln::msgs::DecodeError on failure.
5491  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5492  */
5493 typedef struct LDKCResult_BestBlockDecodeErrorZ {
5494    /**
5495     * The contents of this CResult_BestBlockDecodeErrorZ, accessible via either
5496     * `err` or `result` depending on the state of `result_ok`.
5497     */
5498    union LDKCResult_BestBlockDecodeErrorZPtr contents;
5499    /**
5500     * Whether this CResult_BestBlockDecodeErrorZ represents a success state.
5501     */
5502    bool result_ok;
5503 } LDKCResult_BestBlockDecodeErrorZ;
5504
5505 /**
5506  * A tuple of 2 elements. See the individual fields for the types contained.
5507  */
5508 typedef struct LDKC2Tuple_usizeTransactionZ {
5509    /**
5510     * The element at position 0
5511     */
5512    uintptr_t a;
5513    /**
5514     * The element at position 1
5515     */
5516    struct LDKTransaction b;
5517 } LDKC2Tuple_usizeTransactionZ;
5518
5519 /**
5520  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
5521  * This corresponds to std::vector in C++
5522  */
5523 typedef struct LDKCVec_C2Tuple_usizeTransactionZZ {
5524    /**
5525     * The elements in the array.
5526     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5527     */
5528    struct LDKC2Tuple_usizeTransactionZ *data;
5529    /**
5530     * The number of elements pointed to by `data`.
5531     */
5532    uintptr_t datalen;
5533 } LDKCVec_C2Tuple_usizeTransactionZZ;
5534
5535 /**
5536  * A tuple of 3 elements. See the individual fields for the types contained.
5537  */
5538 typedef struct LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ {
5539    /**
5540     * The element at position 0
5541     */
5542    struct LDKThirtyTwoBytes a;
5543    /**
5544     * The element at position 1
5545     */
5546    uint32_t b;
5547    /**
5548     * The element at position 2
5549     */
5550    struct LDKCOption_ThirtyTwoBytesZ c;
5551 } LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ;
5552
5553 /**
5554  * A dynamically-allocated array of crate::c_types::derived::C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZs of arbitrary size.
5555  * This corresponds to std::vector in C++
5556  */
5557 typedef struct LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ {
5558    /**
5559     * The elements in the array.
5560     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5561     */
5562    struct LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ *data;
5563    /**
5564     * The number of elements pointed to by `data`.
5565     */
5566    uintptr_t datalen;
5567 } LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ;
5568
5569 /**
5570  * The contents of CResult_ChannelMonitorUpdateStatusNoneZ
5571  */
5572 typedef union LDKCResult_ChannelMonitorUpdateStatusNoneZPtr {
5573    /**
5574     * A pointer to the contents in the success state.
5575     * Reading from this pointer when `result_ok` is not set is undefined.
5576     */
5577    enum LDKChannelMonitorUpdateStatus *result;
5578    /**
5579     * Note that this value is always NULL, as there are no contents in the Err variant
5580     */
5581    void *err;
5582 } LDKCResult_ChannelMonitorUpdateStatusNoneZPtr;
5583
5584 /**
5585  * A CResult_ChannelMonitorUpdateStatusNoneZ represents the result of a fallible operation,
5586  * containing a crate::lightning::chain::ChannelMonitorUpdateStatus on success and a () on failure.
5587  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5588  */
5589 typedef struct LDKCResult_ChannelMonitorUpdateStatusNoneZ {
5590    /**
5591     * The contents of this CResult_ChannelMonitorUpdateStatusNoneZ, accessible via either
5592     * `err` or `result` depending on the state of `result_ok`.
5593     */
5594    union LDKCResult_ChannelMonitorUpdateStatusNoneZPtr contents;
5595    /**
5596     * Whether this CResult_ChannelMonitorUpdateStatusNoneZ represents a success state.
5597     */
5598    bool result_ok;
5599 } LDKCResult_ChannelMonitorUpdateStatusNoneZ;
5600
5601
5602
5603 /**
5604  * Simple structure sent back by `chain::Watch` when an HTLC from a forward channel is detected on
5605  * chain. Used to update the corresponding HTLC in the backward channel. Failing to pass the
5606  * preimage claim backward will lead to loss of funds.
5607  */
5608 typedef struct MUST_USE_STRUCT LDKHTLCUpdate {
5609    /**
5610     * A pointer to the opaque Rust object.
5611     * Nearly everywhere, inner must be non-null, however in places where
5612     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5613     */
5614    LDKnativeHTLCUpdate *inner;
5615    /**
5616     * Indicates that this is the only struct which contains the same pointer.
5617     * Rust functions which take ownership of an object provided via an argument require
5618     * this to be true and invalidate the object pointed to by inner.
5619     */
5620    bool is_owned;
5621 } LDKHTLCUpdate;
5622
5623
5624
5625 /**
5626  * Struct to `Display` fields in a safe way using `PrintableString`
5627  */
5628 typedef struct MUST_USE_STRUCT LDKUntrustedString {
5629    /**
5630     * A pointer to the opaque Rust object.
5631     * Nearly everywhere, inner must be non-null, however in places where
5632     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5633     */
5634    LDKnativeUntrustedString *inner;
5635    /**
5636     * Indicates that this is the only struct which contains the same pointer.
5637     * Rust functions which take ownership of an object provided via an argument require
5638     * this to be true and invalidate the object pointed to by inner.
5639     */
5640    bool is_owned;
5641 } LDKUntrustedString;
5642
5643 /**
5644  * The reason the channel was closed. See individual variants for more details.
5645  */
5646 typedef enum LDKClosureReason_Tag {
5647    /**
5648     * Closure generated from receiving a peer error message.
5649     *
5650     * Our counterparty may have broadcasted their latest commitment state, and we have
5651     * as well.
5652     */
5653    LDKClosureReason_CounterpartyForceClosed,
5654    /**
5655     * Closure generated from [`ChannelManager::force_close_channel`], called by the user.
5656     *
5657     * [`ChannelManager::force_close_channel`]: crate::ln::channelmanager::ChannelManager::force_close_channel.
5658     */
5659    LDKClosureReason_HolderForceClosed,
5660    /**
5661     * The channel was closed after negotiating a cooperative close and we've now broadcasted
5662     * the cooperative close transaction. Note the shutdown may have been initiated by us.
5663     *
5664     * This was only set in versions of LDK prior to 0.0.122.
5665     */
5666    LDKClosureReason_LegacyCooperativeClosure,
5667    /**
5668     * The channel was closed after negotiating a cooperative close and we've now broadcasted
5669     * the cooperative close transaction. This indicates that the shutdown was initiated by our
5670     * counterparty.
5671     *
5672     * In rare cases where we initiated closure immediately prior to shutting down without
5673     * persisting, this value may be provided for channels we initiated closure for.
5674     */
5675    LDKClosureReason_CounterpartyInitiatedCooperativeClosure,
5676    /**
5677     * The channel was closed after negotiating a cooperative close and we've now broadcasted
5678     * the cooperative close transaction. This indicates that the shutdown was initiated by us.
5679     */
5680    LDKClosureReason_LocallyInitiatedCooperativeClosure,
5681    /**
5682     * A commitment transaction was confirmed on chain, closing the channel. Most likely this
5683     * commitment transaction came from our counterparty, but it may also have come from
5684     * a copy of our own `ChannelMonitor`.
5685     */
5686    LDKClosureReason_CommitmentTxConfirmed,
5687    /**
5688     * The funding transaction failed to confirm in a timely manner on an inbound channel.
5689     */
5690    LDKClosureReason_FundingTimedOut,
5691    /**
5692     * Closure generated from processing an event, likely a HTLC forward/relay/reception.
5693     */
5694    LDKClosureReason_ProcessingError,
5695    /**
5696     * The peer disconnected prior to funding completing. In this case the spec mandates that we
5697     * forget the channel entirely - we can attempt again if the peer reconnects.
5698     *
5699     * This includes cases where we restarted prior to funding completion, including prior to the
5700     * initial [`ChannelMonitor`] persistence completing.
5701     *
5702     * In LDK versions prior to 0.0.107 this could also occur if we were unable to connect to the
5703     * peer because of mutual incompatibility between us and our channel counterparty.
5704     *
5705     * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor
5706     */
5707    LDKClosureReason_DisconnectedPeer,
5708    /**
5709     * Closure generated from `ChannelManager::read` if the [`ChannelMonitor`] is newer than
5710     * the [`ChannelManager`] deserialized.
5711     *
5712     * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor
5713     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
5714     */
5715    LDKClosureReason_OutdatedChannelManager,
5716    /**
5717     * The counterparty requested a cooperative close of a channel that had not been funded yet.
5718     * The channel has been immediately closed.
5719     */
5720    LDKClosureReason_CounterpartyCoopClosedUnfundedChannel,
5721    /**
5722     * Another channel in the same funding batch closed before the funding transaction
5723     * was ready to be broadcast.
5724     */
5725    LDKClosureReason_FundingBatchClosure,
5726    /**
5727     * One of our HTLCs timed out in a channel, causing us to force close the channel.
5728     */
5729    LDKClosureReason_HTLCsTimedOut,
5730    /**
5731     * Must be last for serialization purposes
5732     */
5733    LDKClosureReason_Sentinel,
5734 } LDKClosureReason_Tag;
5735
5736 typedef struct LDKClosureReason_LDKCounterpartyForceClosed_Body {
5737    /**
5738     * The error which the peer sent us.
5739     *
5740     * Be careful about printing the peer_msg, a well-crafted message could exploit
5741     * a security vulnerability in the terminal emulator or the logging subsystem.
5742     * To be safe, use `Display` on `UntrustedString`
5743     *
5744     * [`UntrustedString`]: crate::util::string::UntrustedString
5745     */
5746    struct LDKUntrustedString peer_msg;
5747 } LDKClosureReason_LDKCounterpartyForceClosed_Body;
5748
5749 typedef struct LDKClosureReason_LDKProcessingError_Body {
5750    /**
5751     * A developer-readable error message which we generated.
5752     */
5753    struct LDKStr err;
5754 } LDKClosureReason_LDKProcessingError_Body;
5755
5756 typedef struct MUST_USE_STRUCT LDKClosureReason {
5757    LDKClosureReason_Tag tag;
5758    union {
5759       LDKClosureReason_LDKCounterpartyForceClosed_Body counterparty_force_closed;
5760       LDKClosureReason_LDKProcessingError_Body processing_error;
5761    };
5762 } LDKClosureReason;
5763
5764
5765
5766 /**
5767  * A unique 32-byte identifier for a channel.
5768  * Depending on how the ID is generated, several varieties are distinguished
5769  * (but all are stored as 32 bytes):
5770  *   _v1_ and _temporary_.
5771  * A _v1_ channel ID is generated based on funding tx outpoint (txid & index).
5772  * A _temporary_ ID is generated randomly.
5773  * (Later revocation-point-based _v2_ is a possibility.)
5774  * The variety (context) is not stored, it is relevant only at creation.
5775  */
5776 typedef struct MUST_USE_STRUCT LDKChannelId {
5777    /**
5778     * A pointer to the opaque Rust object.
5779     * Nearly everywhere, inner must be non-null, however in places where
5780     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5781     */
5782    LDKnativeChannelId *inner;
5783    /**
5784     * Indicates that this is the only struct which contains the same pointer.
5785     * Rust functions which take ownership of an object provided via an argument require
5786     * this to be true and invalidate the object pointed to by inner.
5787     */
5788    bool is_owned;
5789 } LDKChannelId;
5790
5791 /**
5792  * An event to be processed by the ChannelManager.
5793  */
5794 typedef enum LDKMonitorEvent_Tag {
5795    /**
5796     * A monitor event containing an HTLCUpdate.
5797     */
5798    LDKMonitorEvent_HTLCEvent,
5799    /**
5800     * Indicates we broadcasted the channel's latest commitment transaction and thus closed the
5801     * channel. Holds information about the channel and why it was closed.
5802     */
5803    LDKMonitorEvent_HolderForceClosedWithInfo,
5804    /**
5805     * Indicates we broadcasted the channel's latest commitment transaction and thus closed the
5806     * channel.
5807     */
5808    LDKMonitorEvent_HolderForceClosed,
5809    /**
5810     * Indicates a [`ChannelMonitor`] update has completed. See
5811     * [`ChannelMonitorUpdateStatus::InProgress`] for more information on how this is used.
5812     *
5813     * [`ChannelMonitorUpdateStatus::InProgress`]: super::ChannelMonitorUpdateStatus::InProgress
5814     */
5815    LDKMonitorEvent_Completed,
5816    /**
5817     * Must be last for serialization purposes
5818     */
5819    LDKMonitorEvent_Sentinel,
5820 } LDKMonitorEvent_Tag;
5821
5822 typedef struct LDKMonitorEvent_LDKHolderForceClosedWithInfo_Body {
5823    /**
5824     * The reason the channel was closed.
5825     */
5826    struct LDKClosureReason reason;
5827    /**
5828     * The funding outpoint of the channel.
5829     */
5830    struct LDKOutPoint outpoint;
5831    /**
5832     * The channel ID of the channel.
5833     */
5834    struct LDKChannelId channel_id;
5835 } LDKMonitorEvent_LDKHolderForceClosedWithInfo_Body;
5836
5837 typedef struct LDKMonitorEvent_LDKCompleted_Body {
5838    /**
5839     * The funding outpoint of the [`ChannelMonitor`] that was updated
5840     */
5841    struct LDKOutPoint funding_txo;
5842    /**
5843     * The channel ID of the channel associated with the [`ChannelMonitor`]
5844     */
5845    struct LDKChannelId channel_id;
5846    /**
5847     * The Update ID from [`ChannelMonitorUpdate::update_id`] which was applied or
5848     * [`ChannelMonitor::get_latest_update_id`].
5849     *
5850     * Note that this should only be set to a given update's ID if all previous updates for the
5851     * same [`ChannelMonitor`] have been applied and persisted.
5852     */
5853    uint64_t monitor_update_id;
5854 } LDKMonitorEvent_LDKCompleted_Body;
5855
5856 typedef struct MUST_USE_STRUCT LDKMonitorEvent {
5857    LDKMonitorEvent_Tag tag;
5858    union {
5859       struct {
5860          struct LDKHTLCUpdate htlc_event;
5861       };
5862       LDKMonitorEvent_LDKHolderForceClosedWithInfo_Body holder_force_closed_with_info;
5863       struct {
5864          struct LDKOutPoint holder_force_closed;
5865       };
5866       LDKMonitorEvent_LDKCompleted_Body completed;
5867    };
5868 } LDKMonitorEvent;
5869
5870 /**
5871  * A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
5872  * This corresponds to std::vector in C++
5873  */
5874 typedef struct LDKCVec_MonitorEventZ {
5875    /**
5876     * The elements in the array.
5877     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5878     */
5879    struct LDKMonitorEvent *data;
5880    /**
5881     * The number of elements pointed to by `data`.
5882     */
5883    uintptr_t datalen;
5884 } LDKCVec_MonitorEventZ;
5885
5886 /**
5887  * A tuple of 4 elements. See the individual fields for the types contained.
5888  */
5889 typedef struct LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ {
5890    /**
5891     * The element at position 0
5892     */
5893    struct LDKOutPoint a;
5894    /**
5895     * The element at position 1
5896     */
5897    struct LDKChannelId b;
5898    /**
5899     * The element at position 2
5900     */
5901    struct LDKCVec_MonitorEventZ c;
5902    /**
5903     * The element at position 3
5904     */
5905    struct LDKPublicKey d;
5906 } LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ;
5907
5908 /**
5909  * A dynamically-allocated array of crate::c_types::derived::C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZs of arbitrary size.
5910  * This corresponds to std::vector in C++
5911  */
5912 typedef struct LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ {
5913    /**
5914     * The elements in the array.
5915     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5916     */
5917    struct LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ *data;
5918    /**
5919     * The number of elements pointed to by `data`.
5920     */
5921    uintptr_t datalen;
5922 } LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ;
5923
5924
5925
5926 /**
5927  * Features used within an `init` message.
5928  */
5929 typedef struct MUST_USE_STRUCT LDKInitFeatures {
5930    /**
5931     * A pointer to the opaque Rust object.
5932     * Nearly everywhere, inner must be non-null, however in places where
5933     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5934     */
5935    LDKnativeInitFeatures *inner;
5936    /**
5937     * Indicates that this is the only struct which contains the same pointer.
5938     * Rust functions which take ownership of an object provided via an argument require
5939     * this to be true and invalidate the object pointed to by inner.
5940     */
5941    bool is_owned;
5942 } LDKInitFeatures;
5943
5944 /**
5945  * The contents of CResult_InitFeaturesDecodeErrorZ
5946  */
5947 typedef union LDKCResult_InitFeaturesDecodeErrorZPtr {
5948    /**
5949     * A pointer to the contents in the success state.
5950     * Reading from this pointer when `result_ok` is not set is undefined.
5951     */
5952    struct LDKInitFeatures *result;
5953    /**
5954     * A pointer to the contents in the error state.
5955     * Reading from this pointer when `result_ok` is set is undefined.
5956     */
5957    struct LDKDecodeError *err;
5958 } LDKCResult_InitFeaturesDecodeErrorZPtr;
5959
5960 /**
5961  * A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
5962  * containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5963  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5964  */
5965 typedef struct LDKCResult_InitFeaturesDecodeErrorZ {
5966    /**
5967     * The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
5968     * `err` or `result` depending on the state of `result_ok`.
5969     */
5970    union LDKCResult_InitFeaturesDecodeErrorZPtr contents;
5971    /**
5972     * Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
5973     */
5974    bool result_ok;
5975 } LDKCResult_InitFeaturesDecodeErrorZ;
5976
5977
5978
5979 /**
5980  * Features used within a `channel_announcement` message.
5981  */
5982 typedef struct MUST_USE_STRUCT LDKChannelFeatures {
5983    /**
5984     * A pointer to the opaque Rust object.
5985     * Nearly everywhere, inner must be non-null, however in places where
5986     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5987     */
5988    LDKnativeChannelFeatures *inner;
5989    /**
5990     * Indicates that this is the only struct which contains the same pointer.
5991     * Rust functions which take ownership of an object provided via an argument require
5992     * this to be true and invalidate the object pointed to by inner.
5993     */
5994    bool is_owned;
5995 } LDKChannelFeatures;
5996
5997 /**
5998  * The contents of CResult_ChannelFeaturesDecodeErrorZ
5999  */
6000 typedef union LDKCResult_ChannelFeaturesDecodeErrorZPtr {
6001    /**
6002     * A pointer to the contents in the success state.
6003     * Reading from this pointer when `result_ok` is not set is undefined.
6004     */
6005    struct LDKChannelFeatures *result;
6006    /**
6007     * A pointer to the contents in the error state.
6008     * Reading from this pointer when `result_ok` is set is undefined.
6009     */
6010    struct LDKDecodeError *err;
6011 } LDKCResult_ChannelFeaturesDecodeErrorZPtr;
6012
6013 /**
6014  * A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
6015  * containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
6016  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6017  */
6018 typedef struct LDKCResult_ChannelFeaturesDecodeErrorZ {
6019    /**
6020     * The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
6021     * `err` or `result` depending on the state of `result_ok`.
6022     */
6023    union LDKCResult_ChannelFeaturesDecodeErrorZPtr contents;
6024    /**
6025     * Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
6026     */
6027    bool result_ok;
6028 } LDKCResult_ChannelFeaturesDecodeErrorZ;
6029
6030
6031
6032 /**
6033  * Features used within a `node_announcement` message.
6034  */
6035 typedef struct MUST_USE_STRUCT LDKNodeFeatures {
6036    /**
6037     * A pointer to the opaque Rust object.
6038     * Nearly everywhere, inner must be non-null, however in places where
6039     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6040     */
6041    LDKnativeNodeFeatures *inner;
6042    /**
6043     * Indicates that this is the only struct which contains the same pointer.
6044     * Rust functions which take ownership of an object provided via an argument require
6045     * this to be true and invalidate the object pointed to by inner.
6046     */
6047    bool is_owned;
6048 } LDKNodeFeatures;
6049
6050 /**
6051  * The contents of CResult_NodeFeaturesDecodeErrorZ
6052  */
6053 typedef union LDKCResult_NodeFeaturesDecodeErrorZPtr {
6054    /**
6055     * A pointer to the contents in the success state.
6056     * Reading from this pointer when `result_ok` is not set is undefined.
6057     */
6058    struct LDKNodeFeatures *result;
6059    /**
6060     * A pointer to the contents in the error state.
6061     * Reading from this pointer when `result_ok` is set is undefined.
6062     */
6063    struct LDKDecodeError *err;
6064 } LDKCResult_NodeFeaturesDecodeErrorZPtr;
6065
6066 /**
6067  * A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
6068  * containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
6069  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6070  */
6071 typedef struct LDKCResult_NodeFeaturesDecodeErrorZ {
6072    /**
6073     * The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
6074     * `err` or `result` depending on the state of `result_ok`.
6075     */
6076    union LDKCResult_NodeFeaturesDecodeErrorZPtr contents;
6077    /**
6078     * Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
6079     */
6080    bool result_ok;
6081 } LDKCResult_NodeFeaturesDecodeErrorZ;
6082
6083
6084
6085 /**
6086  * Features used within an invoice.
6087  */
6088 typedef struct MUST_USE_STRUCT LDKBolt11InvoiceFeatures {
6089    /**
6090     * A pointer to the opaque Rust object.
6091     * Nearly everywhere, inner must be non-null, however in places where
6092     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6093     */
6094    LDKnativeBolt11InvoiceFeatures *inner;
6095    /**
6096     * Indicates that this is the only struct which contains the same pointer.
6097     * Rust functions which take ownership of an object provided via an argument require
6098     * this to be true and invalidate the object pointed to by inner.
6099     */
6100    bool is_owned;
6101 } LDKBolt11InvoiceFeatures;
6102
6103 /**
6104  * The contents of CResult_Bolt11InvoiceFeaturesDecodeErrorZ
6105  */
6106 typedef union LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZPtr {
6107    /**
6108     * A pointer to the contents in the success state.
6109     * Reading from this pointer when `result_ok` is not set is undefined.
6110     */
6111    struct LDKBolt11InvoiceFeatures *result;
6112    /**
6113     * A pointer to the contents in the error state.
6114     * Reading from this pointer when `result_ok` is set is undefined.
6115     */
6116    struct LDKDecodeError *err;
6117 } LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZPtr;
6118
6119 /**
6120  * A CResult_Bolt11InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
6121  * containing a crate::lightning::ln::features::Bolt11InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
6122  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6123  */
6124 typedef struct LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ {
6125    /**
6126     * The contents of this CResult_Bolt11InvoiceFeaturesDecodeErrorZ, accessible via either
6127     * `err` or `result` depending on the state of `result_ok`.
6128     */
6129    union LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZPtr contents;
6130    /**
6131     * Whether this CResult_Bolt11InvoiceFeaturesDecodeErrorZ represents a success state.
6132     */
6133    bool result_ok;
6134 } LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ;
6135
6136
6137
6138 /**
6139  * Features used within an `invoice`.
6140  */
6141 typedef struct MUST_USE_STRUCT LDKBolt12InvoiceFeatures {
6142    /**
6143     * A pointer to the opaque Rust object.
6144     * Nearly everywhere, inner must be non-null, however in places where
6145     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6146     */
6147    LDKnativeBolt12InvoiceFeatures *inner;
6148    /**
6149     * Indicates that this is the only struct which contains the same pointer.
6150     * Rust functions which take ownership of an object provided via an argument require
6151     * this to be true and invalidate the object pointed to by inner.
6152     */
6153    bool is_owned;
6154 } LDKBolt12InvoiceFeatures;
6155
6156 /**
6157  * The contents of CResult_Bolt12InvoiceFeaturesDecodeErrorZ
6158  */
6159 typedef union LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZPtr {
6160    /**
6161     * A pointer to the contents in the success state.
6162     * Reading from this pointer when `result_ok` is not set is undefined.
6163     */
6164    struct LDKBolt12InvoiceFeatures *result;
6165    /**
6166     * A pointer to the contents in the error state.
6167     * Reading from this pointer when `result_ok` is set is undefined.
6168     */
6169    struct LDKDecodeError *err;
6170 } LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZPtr;
6171
6172 /**
6173  * A CResult_Bolt12InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
6174  * containing a crate::lightning::ln::features::Bolt12InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
6175  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6176  */
6177 typedef struct LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ {
6178    /**
6179     * The contents of this CResult_Bolt12InvoiceFeaturesDecodeErrorZ, accessible via either
6180     * `err` or `result` depending on the state of `result_ok`.
6181     */
6182    union LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZPtr contents;
6183    /**
6184     * Whether this CResult_Bolt12InvoiceFeaturesDecodeErrorZ represents a success state.
6185     */
6186    bool result_ok;
6187 } LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ;
6188
6189
6190
6191 /**
6192  * Features used within BOLT 4 encrypted_data_tlv and BOLT 12 blinded_payinfo
6193  */
6194 typedef struct MUST_USE_STRUCT LDKBlindedHopFeatures {
6195    /**
6196     * A pointer to the opaque Rust object.
6197     * Nearly everywhere, inner must be non-null, however in places where
6198     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6199     */
6200    LDKnativeBlindedHopFeatures *inner;
6201    /**
6202     * Indicates that this is the only struct which contains the same pointer.
6203     * Rust functions which take ownership of an object provided via an argument require
6204     * this to be true and invalidate the object pointed to by inner.
6205     */
6206    bool is_owned;
6207 } LDKBlindedHopFeatures;
6208
6209 /**
6210  * The contents of CResult_BlindedHopFeaturesDecodeErrorZ
6211  */
6212 typedef union LDKCResult_BlindedHopFeaturesDecodeErrorZPtr {
6213    /**
6214     * A pointer to the contents in the success state.
6215     * Reading from this pointer when `result_ok` is not set is undefined.
6216     */
6217    struct LDKBlindedHopFeatures *result;
6218    /**
6219     * A pointer to the contents in the error state.
6220     * Reading from this pointer when `result_ok` is set is undefined.
6221     */
6222    struct LDKDecodeError *err;
6223 } LDKCResult_BlindedHopFeaturesDecodeErrorZPtr;
6224
6225 /**
6226  * A CResult_BlindedHopFeaturesDecodeErrorZ represents the result of a fallible operation,
6227  * containing a crate::lightning::ln::features::BlindedHopFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
6228  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6229  */
6230 typedef struct LDKCResult_BlindedHopFeaturesDecodeErrorZ {
6231    /**
6232     * The contents of this CResult_BlindedHopFeaturesDecodeErrorZ, accessible via either
6233     * `err` or `result` depending on the state of `result_ok`.
6234     */
6235    union LDKCResult_BlindedHopFeaturesDecodeErrorZPtr contents;
6236    /**
6237     * Whether this CResult_BlindedHopFeaturesDecodeErrorZ represents a success state.
6238     */
6239    bool result_ok;
6240 } LDKCResult_BlindedHopFeaturesDecodeErrorZ;
6241
6242
6243
6244 /**
6245  * Features used within the channel_type field in an OpenChannel message.
6246  *
6247  * A channel is always of some known \"type\", describing the transaction formats used and the exact
6248  * semantics of our interaction with our peer.
6249  *
6250  * Note that because a channel is a specific type which is proposed by the opener and accepted by
6251  * the counterparty, only required features are allowed here.
6252  *
6253  * This is serialized differently from other feature types - it is not prefixed by a length, and
6254  * thus must only appear inside a TLV where its length is known in advance.
6255  */
6256 typedef struct MUST_USE_STRUCT LDKChannelTypeFeatures {
6257    /**
6258     * A pointer to the opaque Rust object.
6259     * Nearly everywhere, inner must be non-null, however in places where
6260     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6261     */
6262    LDKnativeChannelTypeFeatures *inner;
6263    /**
6264     * Indicates that this is the only struct which contains the same pointer.
6265     * Rust functions which take ownership of an object provided via an argument require
6266     * this to be true and invalidate the object pointed to by inner.
6267     */
6268    bool is_owned;
6269 } LDKChannelTypeFeatures;
6270
6271 /**
6272  * The contents of CResult_ChannelTypeFeaturesDecodeErrorZ
6273  */
6274 typedef union LDKCResult_ChannelTypeFeaturesDecodeErrorZPtr {
6275    /**
6276     * A pointer to the contents in the success state.
6277     * Reading from this pointer when `result_ok` is not set is undefined.
6278     */
6279    struct LDKChannelTypeFeatures *result;
6280    /**
6281     * A pointer to the contents in the error state.
6282     * Reading from this pointer when `result_ok` is set is undefined.
6283     */
6284    struct LDKDecodeError *err;
6285 } LDKCResult_ChannelTypeFeaturesDecodeErrorZPtr;
6286
6287 /**
6288  * A CResult_ChannelTypeFeaturesDecodeErrorZ represents the result of a fallible operation,
6289  * containing a crate::lightning::ln::features::ChannelTypeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
6290  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6291  */
6292 typedef struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ {
6293    /**
6294     * The contents of this CResult_ChannelTypeFeaturesDecodeErrorZ, accessible via either
6295     * `err` or `result` depending on the state of `result_ok`.
6296     */
6297    union LDKCResult_ChannelTypeFeaturesDecodeErrorZPtr contents;
6298    /**
6299     * Whether this CResult_ChannelTypeFeaturesDecodeErrorZ represents a success state.
6300     */
6301    bool result_ok;
6302 } LDKCResult_ChannelTypeFeaturesDecodeErrorZ;
6303
6304
6305
6306 /**
6307  * An identifier for an [`Offer`] built using [`DerivedMetadata`].
6308  */
6309 typedef struct MUST_USE_STRUCT LDKOfferId {
6310    /**
6311     * A pointer to the opaque Rust object.
6312     * Nearly everywhere, inner must be non-null, however in places where
6313     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6314     */
6315    LDKnativeOfferId *inner;
6316    /**
6317     * Indicates that this is the only struct which contains the same pointer.
6318     * Rust functions which take ownership of an object provided via an argument require
6319     * this to be true and invalidate the object pointed to by inner.
6320     */
6321    bool is_owned;
6322 } LDKOfferId;
6323
6324 /**
6325  * The contents of CResult_OfferIdDecodeErrorZ
6326  */
6327 typedef union LDKCResult_OfferIdDecodeErrorZPtr {
6328    /**
6329     * A pointer to the contents in the success state.
6330     * Reading from this pointer when `result_ok` is not set is undefined.
6331     */
6332    struct LDKOfferId *result;
6333    /**
6334     * A pointer to the contents in the error state.
6335     * Reading from this pointer when `result_ok` is set is undefined.
6336     */
6337    struct LDKDecodeError *err;
6338 } LDKCResult_OfferIdDecodeErrorZPtr;
6339
6340 /**
6341  * A CResult_OfferIdDecodeErrorZ represents the result of a fallible operation,
6342  * containing a crate::lightning::offers::offer::OfferId on success and a crate::lightning::ln::msgs::DecodeError on failure.
6343  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6344  */
6345 typedef struct LDKCResult_OfferIdDecodeErrorZ {
6346    /**
6347     * The contents of this CResult_OfferIdDecodeErrorZ, accessible via either
6348     * `err` or `result` depending on the state of `result_ok`.
6349     */
6350    union LDKCResult_OfferIdDecodeErrorZPtr contents;
6351    /**
6352     * Whether this CResult_OfferIdDecodeErrorZ represents a success state.
6353     */
6354    bool result_ok;
6355 } LDKCResult_OfferIdDecodeErrorZ;
6356
6357 /**
6358  * The contents of CResult_NoneBolt12SemanticErrorZ
6359  */
6360 typedef union LDKCResult_NoneBolt12SemanticErrorZPtr {
6361    /**
6362     * Note that this value is always NULL, as there are no contents in the OK variant
6363     */
6364    void *result;
6365    /**
6366     * A pointer to the contents in the error state.
6367     * Reading from this pointer when `result_ok` is set is undefined.
6368     */
6369    enum LDKBolt12SemanticError *err;
6370 } LDKCResult_NoneBolt12SemanticErrorZPtr;
6371
6372 /**
6373  * A CResult_NoneBolt12SemanticErrorZ represents the result of a fallible operation,
6374  * containing a () on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure.
6375  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6376  */
6377 typedef struct LDKCResult_NoneBolt12SemanticErrorZ {
6378    /**
6379     * The contents of this CResult_NoneBolt12SemanticErrorZ, accessible via either
6380     * `err` or `result` depending on the state of `result_ok`.
6381     */
6382    union LDKCResult_NoneBolt12SemanticErrorZPtr contents;
6383    /**
6384     * Whether this CResult_NoneBolt12SemanticErrorZ represents a success state.
6385     */
6386    bool result_ok;
6387 } LDKCResult_NoneBolt12SemanticErrorZ;
6388
6389
6390
6391 /**
6392  * An `Offer` is a potentially long-lived proposal for payment of a good or service.
6393  *
6394  * An offer is a precursor to an [`InvoiceRequest`]. A merchant publishes an offer from which a
6395  * customer may request an [`Bolt12Invoice`] for a specific quantity and using an amount sufficient
6396  * to cover that quantity (i.e., at least `quantity * amount`). See [`Offer::amount`].
6397  *
6398  * Offers may be denominated in currency other than bitcoin but are ultimately paid using the
6399  * latter.
6400  *
6401  * Through the use of [`BlindedPath`]s, offers provide recipient privacy.
6402  *
6403  * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
6404  * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
6405  */
6406 typedef struct MUST_USE_STRUCT LDKOffer {
6407    /**
6408     * A pointer to the opaque Rust object.
6409     * Nearly everywhere, inner must be non-null, however in places where
6410     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6411     */
6412    LDKnativeOffer *inner;
6413    /**
6414     * Indicates that this is the only struct which contains the same pointer.
6415     * Rust functions which take ownership of an object provided via an argument require
6416     * this to be true and invalidate the object pointed to by inner.
6417     */
6418    bool is_owned;
6419 } LDKOffer;
6420
6421 /**
6422  * The contents of CResult_OfferBolt12SemanticErrorZ
6423  */
6424 typedef union LDKCResult_OfferBolt12SemanticErrorZPtr {
6425    /**
6426     * A pointer to the contents in the success state.
6427     * Reading from this pointer when `result_ok` is not set is undefined.
6428     */
6429    struct LDKOffer *result;
6430    /**
6431     * A pointer to the contents in the error state.
6432     * Reading from this pointer when `result_ok` is set is undefined.
6433     */
6434    enum LDKBolt12SemanticError *err;
6435 } LDKCResult_OfferBolt12SemanticErrorZPtr;
6436
6437 /**
6438  * A CResult_OfferBolt12SemanticErrorZ represents the result of a fallible operation,
6439  * containing a crate::lightning::offers::offer::Offer on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure.
6440  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6441  */
6442 typedef struct LDKCResult_OfferBolt12SemanticErrorZ {
6443    /**
6444     * The contents of this CResult_OfferBolt12SemanticErrorZ, accessible via either
6445     * `err` or `result` depending on the state of `result_ok`.
6446     */
6447    union LDKCResult_OfferBolt12SemanticErrorZPtr contents;
6448    /**
6449     * Whether this CResult_OfferBolt12SemanticErrorZ represents a success state.
6450     */
6451    bool result_ok;
6452 } LDKCResult_OfferBolt12SemanticErrorZ;
6453
6454
6455
6456 /**
6457  * Builds an [`InvoiceRequest`] from an [`Offer`] for the \"offer to be paid\" flow.
6458  *
6459  * See [module-level documentation] for usage.
6460  *
6461  * [module-level documentation]: self
6462  */
6463 typedef struct MUST_USE_STRUCT LDKInvoiceRequestWithDerivedPayerIdBuilder {
6464    /**
6465     * A pointer to the opaque Rust object.
6466     * Nearly everywhere, inner must be non-null, however in places where
6467     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6468     */
6469    LDKnativeInvoiceRequestWithDerivedPayerIdBuilder *inner;
6470    /**
6471     * Indicates that this is the only struct which contains the same pointer.
6472     * Rust functions which take ownership of an object provided via an argument require
6473     * this to be true and invalidate the object pointed to by inner.
6474     */
6475    bool is_owned;
6476 } LDKInvoiceRequestWithDerivedPayerIdBuilder;
6477
6478 /**
6479  * The contents of CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ
6480  */
6481 typedef union LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZPtr {
6482    /**
6483     * A pointer to the contents in the success state.
6484     * Reading from this pointer when `result_ok` is not set is undefined.
6485     */
6486    struct LDKInvoiceRequestWithDerivedPayerIdBuilder *result;
6487    /**
6488     * A pointer to the contents in the error state.
6489     * Reading from this pointer when `result_ok` is set is undefined.
6490     */
6491    enum LDKBolt12SemanticError *err;
6492 } LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZPtr;
6493
6494 /**
6495  * A CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ represents the result of a fallible operation,
6496  * containing a crate::lightning::offers::invoice_request::InvoiceRequestWithDerivedPayerIdBuilder on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure.
6497  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6498  */
6499 typedef struct LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ {
6500    /**
6501     * The contents of this CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ, accessible via either
6502     * `err` or `result` depending on the state of `result_ok`.
6503     */
6504    union LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZPtr contents;
6505    /**
6506     * Whether this CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ represents a success state.
6507     */
6508    bool result_ok;
6509 } LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ;
6510
6511
6512
6513 /**
6514  * Builds an [`InvoiceRequest`] from an [`Offer`] for the \"offer to be paid\" flow.
6515  *
6516  * See [module-level documentation] for usage.
6517  *
6518  * [module-level documentation]: self
6519  */
6520 typedef struct MUST_USE_STRUCT LDKInvoiceRequestWithExplicitPayerIdBuilder {
6521    /**
6522     * A pointer to the opaque Rust object.
6523     * Nearly everywhere, inner must be non-null, however in places where
6524     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6525     */
6526    LDKnativeInvoiceRequestWithExplicitPayerIdBuilder *inner;
6527    /**
6528     * Indicates that this is the only struct which contains the same pointer.
6529     * Rust functions which take ownership of an object provided via an argument require
6530     * this to be true and invalidate the object pointed to by inner.
6531     */
6532    bool is_owned;
6533 } LDKInvoiceRequestWithExplicitPayerIdBuilder;
6534
6535 /**
6536  * The contents of CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ
6537  */
6538 typedef union LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZPtr {
6539    /**
6540     * A pointer to the contents in the success state.
6541     * Reading from this pointer when `result_ok` is not set is undefined.
6542     */
6543    struct LDKInvoiceRequestWithExplicitPayerIdBuilder *result;
6544    /**
6545     * A pointer to the contents in the error state.
6546     * Reading from this pointer when `result_ok` is set is undefined.
6547     */
6548    enum LDKBolt12SemanticError *err;
6549 } LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZPtr;
6550
6551 /**
6552  * A CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ represents the result of a fallible operation,
6553  * containing a crate::lightning::offers::invoice_request::InvoiceRequestWithExplicitPayerIdBuilder on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure.
6554  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6555  */
6556 typedef struct LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ {
6557    /**
6558     * The contents of this CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ, accessible via either
6559     * `err` or `result` depending on the state of `result_ok`.
6560     */
6561    union LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZPtr contents;
6562    /**
6563     * Whether this CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ represents a success state.
6564     */
6565    bool result_ok;
6566 } LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ;
6567
6568 /**
6569  * The contents of CResult_OfferBolt12ParseErrorZ
6570  */
6571 typedef union LDKCResult_OfferBolt12ParseErrorZPtr {
6572    /**
6573     * A pointer to the contents in the success state.
6574     * Reading from this pointer when `result_ok` is not set is undefined.
6575     */
6576    struct LDKOffer *result;
6577    /**
6578     * A pointer to the contents in the error state.
6579     * Reading from this pointer when `result_ok` is set is undefined.
6580     */
6581    struct LDKBolt12ParseError *err;
6582 } LDKCResult_OfferBolt12ParseErrorZPtr;
6583
6584 /**
6585  * A CResult_OfferBolt12ParseErrorZ represents the result of a fallible operation,
6586  * containing a crate::lightning::offers::offer::Offer on success and a crate::lightning::offers::parse::Bolt12ParseError on failure.
6587  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6588  */
6589 typedef struct LDKCResult_OfferBolt12ParseErrorZ {
6590    /**
6591     * The contents of this CResult_OfferBolt12ParseErrorZ, accessible via either
6592     * `err` or `result` depending on the state of `result_ok`.
6593     */
6594    union LDKCResult_OfferBolt12ParseErrorZPtr contents;
6595    /**
6596     * Whether this CResult_OfferBolt12ParseErrorZ represents a success state.
6597     */
6598    bool result_ok;
6599 } LDKCResult_OfferBolt12ParseErrorZ;
6600
6601 /**
6602  * The contents of CResult_NodeIdDecodeErrorZ
6603  */
6604 typedef union LDKCResult_NodeIdDecodeErrorZPtr {
6605    /**
6606     * A pointer to the contents in the success state.
6607     * Reading from this pointer when `result_ok` is not set is undefined.
6608     */
6609    struct LDKNodeId *result;
6610    /**
6611     * A pointer to the contents in the error state.
6612     * Reading from this pointer when `result_ok` is set is undefined.
6613     */
6614    struct LDKDecodeError *err;
6615 } LDKCResult_NodeIdDecodeErrorZPtr;
6616
6617 /**
6618  * A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation,
6619  * containing a crate::lightning::routing::gossip::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure.
6620  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6621  */
6622 typedef struct LDKCResult_NodeIdDecodeErrorZ {
6623    /**
6624     * The contents of this CResult_NodeIdDecodeErrorZ, accessible via either
6625     * `err` or `result` depending on the state of `result_ok`.
6626     */
6627    union LDKCResult_NodeIdDecodeErrorZPtr contents;
6628    /**
6629     * Whether this CResult_NodeIdDecodeErrorZ represents a success state.
6630     */
6631    bool result_ok;
6632 } LDKCResult_NodeIdDecodeErrorZ;
6633
6634 /**
6635  * The contents of CResult_PublicKeySecp256k1ErrorZ
6636  */
6637 typedef union LDKCResult_PublicKeySecp256k1ErrorZPtr {
6638    /**
6639     * A pointer to the contents in the success state.
6640     * Reading from this pointer when `result_ok` is not set is undefined.
6641     */
6642    struct LDKPublicKey *result;
6643    /**
6644     * A pointer to the contents in the error state.
6645     * Reading from this pointer when `result_ok` is set is undefined.
6646     */
6647    enum LDKSecp256k1Error *err;
6648 } LDKCResult_PublicKeySecp256k1ErrorZPtr;
6649
6650 /**
6651  * A CResult_PublicKeySecp256k1ErrorZ represents the result of a fallible operation,
6652  * containing a crate::c_types::PublicKey on success and a crate::c_types::Secp256k1Error on failure.
6653  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6654  */
6655 typedef struct LDKCResult_PublicKeySecp256k1ErrorZ {
6656    /**
6657     * The contents of this CResult_PublicKeySecp256k1ErrorZ, accessible via either
6658     * `err` or `result` depending on the state of `result_ok`.
6659     */
6660    union LDKCResult_PublicKeySecp256k1ErrorZPtr contents;
6661    /**
6662     * Whether this CResult_PublicKeySecp256k1ErrorZ represents a success state.
6663     */
6664    bool result_ok;
6665 } LDKCResult_PublicKeySecp256k1ErrorZ;
6666
6667
6668
6669 /**
6670  * A [`channel_update`] message to be sent to or received from a peer.
6671  *
6672  * [`channel_update`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-channel_update-message
6673  */
6674 typedef struct MUST_USE_STRUCT LDKChannelUpdate {
6675    /**
6676     * A pointer to the opaque Rust object.
6677     * Nearly everywhere, inner must be non-null, however in places where
6678     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6679     */
6680    LDKnativeChannelUpdate *inner;
6681    /**
6682     * Indicates that this is the only struct which contains the same pointer.
6683     * Rust functions which take ownership of an object provided via an argument require
6684     * this to be true and invalidate the object pointed to by inner.
6685     */
6686    bool is_owned;
6687 } LDKChannelUpdate;
6688
6689 /**
6690  * Update to the [`NetworkGraph`] based on payment failure information conveyed via the Onion
6691  * return packet by a node along the route. See [BOLT #4] for details.
6692  *
6693  * [BOLT #4]: https://github.com/lightning/bolts/blob/master/04-onion-routing.md
6694  */
6695 typedef enum LDKNetworkUpdate_Tag {
6696    /**
6697     * An error indicating a `channel_update` messages should be applied via
6698     * [`NetworkGraph::update_channel`].
6699     */
6700    LDKNetworkUpdate_ChannelUpdateMessage,
6701    /**
6702     * An error indicating that a channel failed to route a payment, which should be applied via
6703     * [`NetworkGraph::channel_failed_permanent`] if permanent.
6704     */
6705    LDKNetworkUpdate_ChannelFailure,
6706    /**
6707     * An error indicating that a node failed to route a payment, which should be applied via
6708     * [`NetworkGraph::node_failed_permanent`] if permanent.
6709     */
6710    LDKNetworkUpdate_NodeFailure,
6711    /**
6712     * Must be last for serialization purposes
6713     */
6714    LDKNetworkUpdate_Sentinel,
6715 } LDKNetworkUpdate_Tag;
6716
6717 typedef struct LDKNetworkUpdate_LDKChannelUpdateMessage_Body {
6718    /**
6719     * The update to apply via [`NetworkGraph::update_channel`].
6720     */
6721    struct LDKChannelUpdate msg;
6722 } LDKNetworkUpdate_LDKChannelUpdateMessage_Body;
6723
6724 typedef struct LDKNetworkUpdate_LDKChannelFailure_Body {
6725    /**
6726     * The short channel id of the closed channel.
6727     */
6728    uint64_t short_channel_id;
6729    /**
6730     * Whether the channel should be permanently removed or temporarily disabled until a new
6731     * `channel_update` message is received.
6732     */
6733    bool is_permanent;
6734 } LDKNetworkUpdate_LDKChannelFailure_Body;
6735
6736 typedef struct LDKNetworkUpdate_LDKNodeFailure_Body {
6737    /**
6738     * The node id of the failed node.
6739     */
6740    struct LDKPublicKey node_id;
6741    /**
6742     * Whether the node should be permanently removed from consideration or can be restored
6743     * when a new `channel_update` message is received.
6744     */
6745    bool is_permanent;
6746 } LDKNetworkUpdate_LDKNodeFailure_Body;
6747
6748 typedef struct MUST_USE_STRUCT LDKNetworkUpdate {
6749    LDKNetworkUpdate_Tag tag;
6750    union {
6751       LDKNetworkUpdate_LDKChannelUpdateMessage_Body channel_update_message;
6752       LDKNetworkUpdate_LDKChannelFailure_Body channel_failure;
6753       LDKNetworkUpdate_LDKNodeFailure_Body node_failure;
6754    };
6755 } LDKNetworkUpdate;
6756
6757 /**
6758  * An enum which can either contain a crate::lightning::routing::gossip::NetworkUpdate or not
6759  */
6760 typedef enum LDKCOption_NetworkUpdateZ_Tag {
6761    /**
6762     * When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::gossip::NetworkUpdate
6763     */
6764    LDKCOption_NetworkUpdateZ_Some,
6765    /**
6766     * When we're in this state, this COption_NetworkUpdateZ contains nothing
6767     */
6768    LDKCOption_NetworkUpdateZ_None,
6769    /**
6770     * Must be last for serialization purposes
6771     */
6772    LDKCOption_NetworkUpdateZ_Sentinel,
6773 } LDKCOption_NetworkUpdateZ_Tag;
6774
6775 typedef struct LDKCOption_NetworkUpdateZ {
6776    LDKCOption_NetworkUpdateZ_Tag tag;
6777    union {
6778       struct {
6779          struct LDKNetworkUpdate some;
6780       };
6781    };
6782 } LDKCOption_NetworkUpdateZ;
6783
6784 /**
6785  * The contents of CResult_COption_NetworkUpdateZDecodeErrorZ
6786  */
6787 typedef union LDKCResult_COption_NetworkUpdateZDecodeErrorZPtr {
6788    /**
6789     * A pointer to the contents in the success state.
6790     * Reading from this pointer when `result_ok` is not set is undefined.
6791     */
6792    struct LDKCOption_NetworkUpdateZ *result;
6793    /**
6794     * A pointer to the contents in the error state.
6795     * Reading from this pointer when `result_ok` is set is undefined.
6796     */
6797    struct LDKDecodeError *err;
6798 } LDKCResult_COption_NetworkUpdateZDecodeErrorZPtr;
6799
6800 /**
6801  * A CResult_COption_NetworkUpdateZDecodeErrorZ represents the result of a fallible operation,
6802  * containing a crate::c_types::derived::COption_NetworkUpdateZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
6803  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6804  */
6805 typedef struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ {
6806    /**
6807     * The contents of this CResult_COption_NetworkUpdateZDecodeErrorZ, accessible via either
6808     * `err` or `result` depending on the state of `result_ok`.
6809     */
6810    union LDKCResult_COption_NetworkUpdateZDecodeErrorZPtr contents;
6811    /**
6812     * Whether this CResult_COption_NetworkUpdateZDecodeErrorZ represents a success state.
6813     */
6814    bool result_ok;
6815 } LDKCResult_COption_NetworkUpdateZDecodeErrorZ;
6816
6817 /**
6818  * The contents of CResult_TxOutUtxoLookupErrorZ
6819  */
6820 typedef union LDKCResult_TxOutUtxoLookupErrorZPtr {
6821    /**
6822     * A pointer to the contents in the success state.
6823     * Reading from this pointer when `result_ok` is not set is undefined.
6824     */
6825    struct LDKTxOut *result;
6826    /**
6827     * A pointer to the contents in the error state.
6828     * Reading from this pointer when `result_ok` is set is undefined.
6829     */
6830    enum LDKUtxoLookupError *err;
6831 } LDKCResult_TxOutUtxoLookupErrorZPtr;
6832
6833 /**
6834  * A CResult_TxOutUtxoLookupErrorZ represents the result of a fallible operation,
6835  * containing a crate::c_types::TxOut on success and a crate::lightning::routing::utxo::UtxoLookupError on failure.
6836  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6837  */
6838 typedef struct LDKCResult_TxOutUtxoLookupErrorZ {
6839    /**
6840     * The contents of this CResult_TxOutUtxoLookupErrorZ, accessible via either
6841     * `err` or `result` depending on the state of `result_ok`.
6842     */
6843    union LDKCResult_TxOutUtxoLookupErrorZPtr contents;
6844    /**
6845     * Whether this CResult_TxOutUtxoLookupErrorZ represents a success state.
6846     */
6847    bool result_ok;
6848 } LDKCResult_TxOutUtxoLookupErrorZ;
6849
6850
6851
6852 /**
6853  * Represents a future resolution of a [`UtxoLookup::get_utxo`] query resolving async.
6854  *
6855  * See [`UtxoResult::Async`] and [`UtxoFuture::resolve`] for more info.
6856  */
6857 typedef struct MUST_USE_STRUCT LDKUtxoFuture {
6858    /**
6859     * A pointer to the opaque Rust object.
6860     * Nearly everywhere, inner must be non-null, however in places where
6861     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6862     */
6863    LDKnativeUtxoFuture *inner;
6864    /**
6865     * Indicates that this is the only struct which contains the same pointer.
6866     * Rust functions which take ownership of an object provided via an argument require
6867     * this to be true and invalidate the object pointed to by inner.
6868     */
6869    bool is_owned;
6870 } LDKUtxoFuture;
6871
6872 /**
6873  * The result of a [`UtxoLookup::get_utxo`] call. A call may resolve either synchronously,
6874  * returning the `Sync` variant, or asynchronously, returning an [`UtxoFuture`] in the `Async`
6875  * variant.
6876  */
6877 typedef enum LDKUtxoResult_Tag {
6878    /**
6879     * A result which was resolved synchronously. It either includes a [`TxOut`] for the output
6880     * requested or a [`UtxoLookupError`].
6881     */
6882    LDKUtxoResult_Sync,
6883    /**
6884     * A result which will be resolved asynchronously. It includes a [`UtxoFuture`], a `clone` of
6885     * which you must keep locally and call [`UtxoFuture::resolve`] on once the lookup completes.
6886     *
6887     * Note that in order to avoid runaway memory usage, the number of parallel checks is limited,
6888     * but only fairly loosely. Because a pending checks block all message processing, leaving
6889     * checks pending for an extended time may cause DoS of other functions. It is recommended you
6890     * keep a tight timeout on lookups, on the order of a few seconds.
6891     */
6892    LDKUtxoResult_Async,
6893    /**
6894     * Must be last for serialization purposes
6895     */
6896    LDKUtxoResult_Sentinel,
6897 } LDKUtxoResult_Tag;
6898
6899 typedef struct MUST_USE_STRUCT LDKUtxoResult {
6900    LDKUtxoResult_Tag tag;
6901    union {
6902       struct {
6903          struct LDKCResult_TxOutUtxoLookupErrorZ sync;
6904       };
6905       struct {
6906          struct LDKUtxoFuture async;
6907       };
6908    };
6909 } LDKUtxoResult;
6910
6911 /**
6912  * The `UtxoLookup` trait defines behavior for accessing on-chain UTXOs.
6913  */
6914 typedef struct LDKUtxoLookup {
6915    /**
6916     * An opaque pointer which is passed to your function implementations as an argument.
6917     * This has no meaning in the LDK, and can be NULL or any other value.
6918     */
6919    void *this_arg;
6920    /**
6921     * Returns the transaction output of a funding transaction encoded by [`short_channel_id`].
6922     * Returns an error if `chain_hash` is for a different chain or if such a transaction output is
6923     * unknown.
6924     *
6925     * [`short_channel_id`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#definition-of-short_channel_id
6926     */
6927    struct LDKUtxoResult (*get_utxo)(const void *this_arg, const uint8_t (*chain_hash)[32], uint64_t short_channel_id);
6928    /**
6929     * Frees any resources associated with this object given its this_arg pointer.
6930     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
6931     */
6932    void (*free)(void *this_arg);
6933 } LDKUtxoLookup;
6934
6935 /**
6936  * An enum which can either contain a crate::lightning::routing::utxo::UtxoLookup or not
6937  */
6938 typedef enum LDKCOption_UtxoLookupZ_Tag {
6939    /**
6940     * When we're in this state, this COption_UtxoLookupZ contains a crate::lightning::routing::utxo::UtxoLookup
6941     */
6942    LDKCOption_UtxoLookupZ_Some,
6943    /**
6944     * When we're in this state, this COption_UtxoLookupZ contains nothing
6945     */
6946    LDKCOption_UtxoLookupZ_None,
6947    /**
6948     * Must be last for serialization purposes
6949     */
6950    LDKCOption_UtxoLookupZ_Sentinel,
6951 } LDKCOption_UtxoLookupZ_Tag;
6952
6953 typedef struct LDKCOption_UtxoLookupZ {
6954    LDKCOption_UtxoLookupZ_Tag tag;
6955    union {
6956       struct {
6957          struct LDKUtxoLookup some;
6958       };
6959    };
6960 } LDKCOption_UtxoLookupZ;
6961
6962 /**
6963  * The contents of CResult_NoneLightningErrorZ
6964  */
6965 typedef union LDKCResult_NoneLightningErrorZPtr {
6966    /**
6967     * Note that this value is always NULL, as there are no contents in the OK variant
6968     */
6969    void *result;
6970    /**
6971     * A pointer to the contents in the error state.
6972     * Reading from this pointer when `result_ok` is set is undefined.
6973     */
6974    struct LDKLightningError *err;
6975 } LDKCResult_NoneLightningErrorZPtr;
6976
6977 /**
6978  * A CResult_NoneLightningErrorZ represents the result of a fallible operation,
6979  * containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
6980  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6981  */
6982 typedef struct LDKCResult_NoneLightningErrorZ {
6983    /**
6984     * The contents of this CResult_NoneLightningErrorZ, accessible via either
6985     * `err` or `result` depending on the state of `result_ok`.
6986     */
6987    union LDKCResult_NoneLightningErrorZPtr contents;
6988    /**
6989     * Whether this CResult_NoneLightningErrorZ represents a success state.
6990     */
6991    bool result_ok;
6992 } LDKCResult_NoneLightningErrorZ;
6993
6994 /**
6995  * The contents of CResult_boolLightningErrorZ
6996  */
6997 typedef union LDKCResult_boolLightningErrorZPtr {
6998    /**
6999     * A pointer to the contents in the success state.
7000     * Reading from this pointer when `result_ok` is not set is undefined.
7001     */
7002    bool *result;
7003    /**
7004     * A pointer to the contents in the error state.
7005     * Reading from this pointer when `result_ok` is set is undefined.
7006     */
7007    struct LDKLightningError *err;
7008 } LDKCResult_boolLightningErrorZPtr;
7009
7010 /**
7011  * A CResult_boolLightningErrorZ represents the result of a fallible operation,
7012  * containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
7013  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7014  */
7015 typedef struct LDKCResult_boolLightningErrorZ {
7016    /**
7017     * The contents of this CResult_boolLightningErrorZ, accessible via either
7018     * `err` or `result` depending on the state of `result_ok`.
7019     */
7020    union LDKCResult_boolLightningErrorZPtr contents;
7021    /**
7022     * Whether this CResult_boolLightningErrorZ represents a success state.
7023     */
7024    bool result_ok;
7025 } LDKCResult_boolLightningErrorZ;
7026
7027
7028
7029 /**
7030  * A [`channel_announcement`] message to be sent to or received from a peer.
7031  *
7032  * [`channel_announcement`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-channel_announcement-message
7033  */
7034 typedef struct MUST_USE_STRUCT LDKChannelAnnouncement {
7035    /**
7036     * A pointer to the opaque Rust object.
7037     * Nearly everywhere, inner must be non-null, however in places where
7038     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7039     */
7040    LDKnativeChannelAnnouncement *inner;
7041    /**
7042     * Indicates that this is the only struct which contains the same pointer.
7043     * Rust functions which take ownership of an object provided via an argument require
7044     * this to be true and invalidate the object pointed to by inner.
7045     */
7046    bool is_owned;
7047 } LDKChannelAnnouncement;
7048
7049 /**
7050  * A tuple of 3 elements. See the individual fields for the types contained.
7051  */
7052 typedef struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
7053    /**
7054     * The element at position 0
7055     */
7056    struct LDKChannelAnnouncement a;
7057    /**
7058     * The element at position 1
7059     */
7060    struct LDKChannelUpdate b;
7061    /**
7062     * The element at position 2
7063     */
7064    struct LDKChannelUpdate c;
7065 } LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ;
7066
7067 /**
7068  * An enum which can either contain a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ or not
7069  */
7070 typedef enum LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Tag {
7071    /**
7072     * When we're in this state, this COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ contains a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ
7073     */
7074    LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some,
7075    /**
7076     * When we're in this state, this COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ contains nothing
7077     */
7078    LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None,
7079    /**
7080     * Must be last for serialization purposes
7081     */
7082    LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Sentinel,
7083 } LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Tag;
7084
7085 typedef struct LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
7086    LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Tag tag;
7087    union {
7088       struct {
7089          struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ some;
7090       };
7091    };
7092 } LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ;
7093
7094
7095
7096 /**
7097  * An [`accept_channel`] message to be sent to or received from a peer.
7098  *
7099  * Used in V1 channel establishment
7100  *
7101  * [`accept_channel`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-accept_channel-message
7102  */
7103 typedef struct MUST_USE_STRUCT LDKAcceptChannel {
7104    /**
7105     * A pointer to the opaque Rust object.
7106     * Nearly everywhere, inner must be non-null, however in places where
7107     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7108     */
7109    LDKnativeAcceptChannel *inner;
7110    /**
7111     * Indicates that this is the only struct which contains the same pointer.
7112     * Rust functions which take ownership of an object provided via an argument require
7113     * this to be true and invalidate the object pointed to by inner.
7114     */
7115    bool is_owned;
7116 } LDKAcceptChannel;
7117
7118
7119
7120 /**
7121  * An accept_channel2 message to be sent by or received from the channel accepter.
7122  *
7123  * Used in V2 channel establishment
7124  *
7125  */
7126 typedef struct MUST_USE_STRUCT LDKAcceptChannelV2 {
7127    /**
7128     * A pointer to the opaque Rust object.
7129     * Nearly everywhere, inner must be non-null, however in places where
7130     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7131     */
7132    LDKnativeAcceptChannelV2 *inner;
7133    /**
7134     * Indicates that this is the only struct which contains the same pointer.
7135     * Rust functions which take ownership of an object provided via an argument require
7136     * this to be true and invalidate the object pointed to by inner.
7137     */
7138    bool is_owned;
7139 } LDKAcceptChannelV2;
7140
7141
7142
7143 /**
7144  * An [`open_channel`] message to be sent to or received from a peer.
7145  *
7146  * Used in V1 channel establishment
7147  *
7148  * [`open_channel`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-open_channel-message
7149  */
7150 typedef struct MUST_USE_STRUCT LDKOpenChannel {
7151    /**
7152     * A pointer to the opaque Rust object.
7153     * Nearly everywhere, inner must be non-null, however in places where
7154     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7155     */
7156    LDKnativeOpenChannel *inner;
7157    /**
7158     * Indicates that this is the only struct which contains the same pointer.
7159     * Rust functions which take ownership of an object provided via an argument require
7160     * this to be true and invalidate the object pointed to by inner.
7161     */
7162    bool is_owned;
7163 } LDKOpenChannel;
7164
7165
7166
7167 /**
7168  * An open_channel2 message to be sent by or received from the channel initiator.
7169  *
7170  * Used in V2 channel establishment
7171  *
7172  */
7173 typedef struct MUST_USE_STRUCT LDKOpenChannelV2 {
7174    /**
7175     * A pointer to the opaque Rust object.
7176     * Nearly everywhere, inner must be non-null, however in places where
7177     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7178     */
7179    LDKnativeOpenChannelV2 *inner;
7180    /**
7181     * Indicates that this is the only struct which contains the same pointer.
7182     * Rust functions which take ownership of an object provided via an argument require
7183     * this to be true and invalidate the object pointed to by inner.
7184     */
7185    bool is_owned;
7186 } LDKOpenChannelV2;
7187
7188
7189
7190 /**
7191  * A [`funding_created`] message to be sent to or received from a peer.
7192  *
7193  * Used in V1 channel establishment
7194  *
7195  * [`funding_created`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-funding_created-message
7196  */
7197 typedef struct MUST_USE_STRUCT LDKFundingCreated {
7198    /**
7199     * A pointer to the opaque Rust object.
7200     * Nearly everywhere, inner must be non-null, however in places where
7201     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7202     */
7203    LDKnativeFundingCreated *inner;
7204    /**
7205     * Indicates that this is the only struct which contains the same pointer.
7206     * Rust functions which take ownership of an object provided via an argument require
7207     * this to be true and invalidate the object pointed to by inner.
7208     */
7209    bool is_owned;
7210 } LDKFundingCreated;
7211
7212
7213
7214 /**
7215  * A [`funding_signed`] message to be sent to or received from a peer.
7216  *
7217  * Used in V1 channel establishment
7218  *
7219  * [`funding_signed`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-funding_signed-message
7220  */
7221 typedef struct MUST_USE_STRUCT LDKFundingSigned {
7222    /**
7223     * A pointer to the opaque Rust object.
7224     * Nearly everywhere, inner must be non-null, however in places where
7225     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7226     */
7227    LDKnativeFundingSigned *inner;
7228    /**
7229     * Indicates that this is the only struct which contains the same pointer.
7230     * Rust functions which take ownership of an object provided via an argument require
7231     * this to be true and invalidate the object pointed to by inner.
7232     */
7233    bool is_owned;
7234 } LDKFundingSigned;
7235
7236
7237
7238 /**
7239  * An stfu (quiescence) message to be sent by or received from the stfu initiator.
7240  */
7241 typedef struct MUST_USE_STRUCT LDKStfu {
7242    /**
7243     * A pointer to the opaque Rust object.
7244     * Nearly everywhere, inner must be non-null, however in places where
7245     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7246     */
7247    LDKnativeStfu *inner;
7248    /**
7249     * Indicates that this is the only struct which contains the same pointer.
7250     * Rust functions which take ownership of an object provided via an argument require
7251     * this to be true and invalidate the object pointed to by inner.
7252     */
7253    bool is_owned;
7254 } LDKStfu;
7255
7256
7257
7258 /**
7259  * A splice message to be sent by or received from the stfu initiator (splice initiator).
7260  */
7261 typedef struct MUST_USE_STRUCT LDKSplice {
7262    /**
7263     * A pointer to the opaque Rust object.
7264     * Nearly everywhere, inner must be non-null, however in places where
7265     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7266     */
7267    LDKnativeSplice *inner;
7268    /**
7269     * Indicates that this is the only struct which contains the same pointer.
7270     * Rust functions which take ownership of an object provided via an argument require
7271     * this to be true and invalidate the object pointed to by inner.
7272     */
7273    bool is_owned;
7274 } LDKSplice;
7275
7276
7277
7278 /**
7279  * A splice_ack message to be received by or sent to the splice initiator.
7280  *
7281  */
7282 typedef struct MUST_USE_STRUCT LDKSpliceAck {
7283    /**
7284     * A pointer to the opaque Rust object.
7285     * Nearly everywhere, inner must be non-null, however in places where
7286     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7287     */
7288    LDKnativeSpliceAck *inner;
7289    /**
7290     * Indicates that this is the only struct which contains the same pointer.
7291     * Rust functions which take ownership of an object provided via an argument require
7292     * this to be true and invalidate the object pointed to by inner.
7293     */
7294    bool is_owned;
7295 } LDKSpliceAck;
7296
7297
7298
7299 /**
7300  * A splice_locked message to be sent to or received from a peer.
7301  *
7302  */
7303 typedef struct MUST_USE_STRUCT LDKSpliceLocked {
7304    /**
7305     * A pointer to the opaque Rust object.
7306     * Nearly everywhere, inner must be non-null, however in places where
7307     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7308     */
7309    LDKnativeSpliceLocked *inner;
7310    /**
7311     * Indicates that this is the only struct which contains the same pointer.
7312     * Rust functions which take ownership of an object provided via an argument require
7313     * this to be true and invalidate the object pointed to by inner.
7314     */
7315    bool is_owned;
7316 } LDKSpliceLocked;
7317
7318
7319
7320 /**
7321  * A tx_add_input message for adding an input during interactive transaction construction
7322  *
7323  */
7324 typedef struct MUST_USE_STRUCT LDKTxAddInput {
7325    /**
7326     * A pointer to the opaque Rust object.
7327     * Nearly everywhere, inner must be non-null, however in places where
7328     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7329     */
7330    LDKnativeTxAddInput *inner;
7331    /**
7332     * Indicates that this is the only struct which contains the same pointer.
7333     * Rust functions which take ownership of an object provided via an argument require
7334     * this to be true and invalidate the object pointed to by inner.
7335     */
7336    bool is_owned;
7337 } LDKTxAddInput;
7338
7339
7340
7341 /**
7342  * A tx_add_output message for adding an output during interactive transaction construction.
7343  *
7344  */
7345 typedef struct MUST_USE_STRUCT LDKTxAddOutput {
7346    /**
7347     * A pointer to the opaque Rust object.
7348     * Nearly everywhere, inner must be non-null, however in places where
7349     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7350     */
7351    LDKnativeTxAddOutput *inner;
7352    /**
7353     * Indicates that this is the only struct which contains the same pointer.
7354     * Rust functions which take ownership of an object provided via an argument require
7355     * this to be true and invalidate the object pointed to by inner.
7356     */
7357    bool is_owned;
7358 } LDKTxAddOutput;
7359
7360
7361
7362 /**
7363  * A tx_remove_input message for removing an input during interactive transaction construction.
7364  *
7365  */
7366 typedef struct MUST_USE_STRUCT LDKTxRemoveInput {
7367    /**
7368     * A pointer to the opaque Rust object.
7369     * Nearly everywhere, inner must be non-null, however in places where
7370     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7371     */
7372    LDKnativeTxRemoveInput *inner;
7373    /**
7374     * Indicates that this is the only struct which contains the same pointer.
7375     * Rust functions which take ownership of an object provided via an argument require
7376     * this to be true and invalidate the object pointed to by inner.
7377     */
7378    bool is_owned;
7379 } LDKTxRemoveInput;
7380
7381
7382
7383 /**
7384  * A tx_remove_output message for removing an output during interactive transaction construction.
7385  *
7386  */
7387 typedef struct MUST_USE_STRUCT LDKTxRemoveOutput {
7388    /**
7389     * A pointer to the opaque Rust object.
7390     * Nearly everywhere, inner must be non-null, however in places where
7391     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7392     */
7393    LDKnativeTxRemoveOutput *inner;
7394    /**
7395     * Indicates that this is the only struct which contains the same pointer.
7396     * Rust functions which take ownership of an object provided via an argument require
7397     * this to be true and invalidate the object pointed to by inner.
7398     */
7399    bool is_owned;
7400 } LDKTxRemoveOutput;
7401
7402
7403
7404 /**
7405  * A tx_complete message signalling the conclusion of a peer's transaction contributions during
7406  * interactive transaction construction.
7407  *
7408  */
7409 typedef struct MUST_USE_STRUCT LDKTxComplete {
7410    /**
7411     * A pointer to the opaque Rust object.
7412     * Nearly everywhere, inner must be non-null, however in places where
7413     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7414     */
7415    LDKnativeTxComplete *inner;
7416    /**
7417     * Indicates that this is the only struct which contains the same pointer.
7418     * Rust functions which take ownership of an object provided via an argument require
7419     * this to be true and invalidate the object pointed to by inner.
7420     */
7421    bool is_owned;
7422 } LDKTxComplete;
7423
7424
7425
7426 /**
7427  * A tx_signatures message containing the sender's signatures for a transaction constructed with
7428  * interactive transaction construction.
7429  *
7430  */
7431 typedef struct MUST_USE_STRUCT LDKTxSignatures {
7432    /**
7433     * A pointer to the opaque Rust object.
7434     * Nearly everywhere, inner must be non-null, however in places where
7435     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7436     */
7437    LDKnativeTxSignatures *inner;
7438    /**
7439     * Indicates that this is the only struct which contains the same pointer.
7440     * Rust functions which take ownership of an object provided via an argument require
7441     * this to be true and invalidate the object pointed to by inner.
7442     */
7443    bool is_owned;
7444 } LDKTxSignatures;
7445
7446
7447
7448 /**
7449  * A tx_init_rbf message which initiates a replacement of the transaction after it's been
7450  * completed.
7451  *
7452  */
7453 typedef struct MUST_USE_STRUCT LDKTxInitRbf {
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    LDKnativeTxInitRbf *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 } LDKTxInitRbf;
7467
7468
7469
7470 /**
7471  * A tx_ack_rbf message which acknowledges replacement of the transaction after it's been
7472  * completed.
7473  *
7474  */
7475 typedef struct MUST_USE_STRUCT LDKTxAckRbf {
7476    /**
7477     * A pointer to the opaque Rust object.
7478     * Nearly everywhere, inner must be non-null, however in places where
7479     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7480     */
7481    LDKnativeTxAckRbf *inner;
7482    /**
7483     * Indicates that this is the only struct which contains the same pointer.
7484     * Rust functions which take ownership of an object provided via an argument require
7485     * this to be true and invalidate the object pointed to by inner.
7486     */
7487    bool is_owned;
7488 } LDKTxAckRbf;
7489
7490
7491
7492 /**
7493  * A tx_abort message which signals the cancellation of an in-progress transaction negotiation.
7494  *
7495  */
7496 typedef struct MUST_USE_STRUCT LDKTxAbort {
7497    /**
7498     * A pointer to the opaque Rust object.
7499     * Nearly everywhere, inner must be non-null, however in places where
7500     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7501     */
7502    LDKnativeTxAbort *inner;
7503    /**
7504     * Indicates that this is the only struct which contains the same pointer.
7505     * Rust functions which take ownership of an object provided via an argument require
7506     * this to be true and invalidate the object pointed to by inner.
7507     */
7508    bool is_owned;
7509 } LDKTxAbort;
7510
7511
7512
7513 /**
7514  * A [`channel_ready`] message to be sent to or received from a peer.
7515  *
7516  * [`channel_ready`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-channel_ready-message
7517  */
7518 typedef struct MUST_USE_STRUCT LDKChannelReady {
7519    /**
7520     * A pointer to the opaque Rust object.
7521     * Nearly everywhere, inner must be non-null, however in places where
7522     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7523     */
7524    LDKnativeChannelReady *inner;
7525    /**
7526     * Indicates that this is the only struct which contains the same pointer.
7527     * Rust functions which take ownership of an object provided via an argument require
7528     * this to be true and invalidate the object pointed to by inner.
7529     */
7530    bool is_owned;
7531 } LDKChannelReady;
7532
7533
7534
7535 /**
7536  * An [`announcement_signatures`] message to be sent to or received from a peer.
7537  *
7538  * [`announcement_signatures`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-announcement_signatures-message
7539  */
7540 typedef struct MUST_USE_STRUCT LDKAnnouncementSignatures {
7541    /**
7542     * A pointer to the opaque Rust object.
7543     * Nearly everywhere, inner must be non-null, however in places where
7544     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7545     */
7546    LDKnativeAnnouncementSignatures *inner;
7547    /**
7548     * Indicates that this is the only struct which contains the same pointer.
7549     * Rust functions which take ownership of an object provided via an argument require
7550     * this to be true and invalidate the object pointed to by inner.
7551     */
7552    bool is_owned;
7553 } LDKAnnouncementSignatures;
7554
7555
7556
7557 /**
7558  * Struct used to return values from [`RevokeAndACK`] messages, containing a bunch of commitment
7559  * transaction updates if they were pending.
7560  */
7561 typedef struct MUST_USE_STRUCT LDKCommitmentUpdate {
7562    /**
7563     * A pointer to the opaque Rust object.
7564     * Nearly everywhere, inner must be non-null, however in places where
7565     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7566     */
7567    LDKnativeCommitmentUpdate *inner;
7568    /**
7569     * Indicates that this is the only struct which contains the same pointer.
7570     * Rust functions which take ownership of an object provided via an argument require
7571     * this to be true and invalidate the object pointed to by inner.
7572     */
7573    bool is_owned;
7574 } LDKCommitmentUpdate;
7575
7576
7577
7578 /**
7579  * A [`revoke_and_ack`] message to be sent to or received from a peer.
7580  *
7581  * [`revoke_and_ack`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#completing-the-transition-to-the-updated-state-revoke_and_ack
7582  */
7583 typedef struct MUST_USE_STRUCT LDKRevokeAndACK {
7584    /**
7585     * A pointer to the opaque Rust object.
7586     * Nearly everywhere, inner must be non-null, however in places where
7587     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7588     */
7589    LDKnativeRevokeAndACK *inner;
7590    /**
7591     * Indicates that this is the only struct which contains the same pointer.
7592     * Rust functions which take ownership of an object provided via an argument require
7593     * this to be true and invalidate the object pointed to by inner.
7594     */
7595    bool is_owned;
7596 } LDKRevokeAndACK;
7597
7598
7599
7600 /**
7601  * A [`closing_signed`] message to be sent to or received from a peer.
7602  *
7603  * [`closing_signed`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#closing-negotiation-closing_signed
7604  */
7605 typedef struct MUST_USE_STRUCT LDKClosingSigned {
7606    /**
7607     * A pointer to the opaque Rust object.
7608     * Nearly everywhere, inner must be non-null, however in places where
7609     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7610     */
7611    LDKnativeClosingSigned *inner;
7612    /**
7613     * Indicates that this is the only struct which contains the same pointer.
7614     * Rust functions which take ownership of an object provided via an argument require
7615     * this to be true and invalidate the object pointed to by inner.
7616     */
7617    bool is_owned;
7618 } LDKClosingSigned;
7619
7620
7621
7622 /**
7623  * A [`shutdown`] message to be sent to or received from a peer.
7624  *
7625  * [`shutdown`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#closing-initiation-shutdown
7626  */
7627 typedef struct MUST_USE_STRUCT LDKShutdown {
7628    /**
7629     * A pointer to the opaque Rust object.
7630     * Nearly everywhere, inner must be non-null, however in places where
7631     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7632     */
7633    LDKnativeShutdown *inner;
7634    /**
7635     * Indicates that this is the only struct which contains the same pointer.
7636     * Rust functions which take ownership of an object provided via an argument require
7637     * this to be true and invalidate the object pointed to by inner.
7638     */
7639    bool is_owned;
7640 } LDKShutdown;
7641
7642
7643
7644 /**
7645  * A [`channel_reestablish`] message to be sent to or received from a peer.
7646  *
7647  * [`channel_reestablish`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#message-retransmission
7648  */
7649 typedef struct MUST_USE_STRUCT LDKChannelReestablish {
7650    /**
7651     * A pointer to the opaque Rust object.
7652     * Nearly everywhere, inner must be non-null, however in places where
7653     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7654     */
7655    LDKnativeChannelReestablish *inner;
7656    /**
7657     * Indicates that this is the only struct which contains the same pointer.
7658     * Rust functions which take ownership of an object provided via an argument require
7659     * this to be true and invalidate the object pointed to by inner.
7660     */
7661    bool is_owned;
7662 } LDKChannelReestablish;
7663
7664
7665
7666 /**
7667  * A [`node_announcement`] message to be sent to or received from a peer.
7668  *
7669  * [`node_announcement`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-node_announcement-message
7670  */
7671 typedef struct MUST_USE_STRUCT LDKNodeAnnouncement {
7672    /**
7673     * A pointer to the opaque Rust object.
7674     * Nearly everywhere, inner must be non-null, however in places where
7675     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7676     */
7677    LDKnativeNodeAnnouncement *inner;
7678    /**
7679     * Indicates that this is the only struct which contains the same pointer.
7680     * Rust functions which take ownership of an object provided via an argument require
7681     * this to be true and invalidate the object pointed to by inner.
7682     */
7683    bool is_owned;
7684 } LDKNodeAnnouncement;
7685
7686
7687
7688 /**
7689  * An [`error`] message to be sent to or received from a peer.
7690  *
7691  * [`error`]: https://github.com/lightning/bolts/blob/master/01-messaging.md#the-error-and-warning-messages
7692  */
7693 typedef struct MUST_USE_STRUCT LDKErrorMessage {
7694    /**
7695     * A pointer to the opaque Rust object.
7696     * Nearly everywhere, inner must be non-null, however in places where
7697     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7698     */
7699    LDKnativeErrorMessage *inner;
7700    /**
7701     * Indicates that this is the only struct which contains the same pointer.
7702     * Rust functions which take ownership of an object provided via an argument require
7703     * this to be true and invalidate the object pointed to by inner.
7704     */
7705    bool is_owned;
7706 } LDKErrorMessage;
7707
7708
7709
7710 /**
7711  * A [`warning`] message to be sent to or received from a peer.
7712  *
7713  * [`warning`]: https://github.com/lightning/bolts/blob/master/01-messaging.md#the-error-and-warning-messages
7714  */
7715 typedef struct MUST_USE_STRUCT LDKWarningMessage {
7716    /**
7717     * A pointer to the opaque Rust object.
7718     * Nearly everywhere, inner must be non-null, however in places where
7719     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7720     */
7721    LDKnativeWarningMessage *inner;
7722    /**
7723     * Indicates that this is the only struct which contains the same pointer.
7724     * Rust functions which take ownership of an object provided via an argument require
7725     * this to be true and invalidate the object pointed to by inner.
7726     */
7727    bool is_owned;
7728 } LDKWarningMessage;
7729
7730 /**
7731  * Used to put an error message in a [`LightningError`].
7732  */
7733 typedef enum LDKErrorAction_Tag {
7734    /**
7735     * The peer took some action which made us think they were useless. Disconnect them.
7736     */
7737    LDKErrorAction_DisconnectPeer,
7738    /**
7739     * The peer did something incorrect. Tell them without closing any channels and disconnect them.
7740     */
7741    LDKErrorAction_DisconnectPeerWithWarning,
7742    /**
7743     * The peer did something harmless that we weren't able to process, just log and ignore
7744     */
7745    LDKErrorAction_IgnoreError,
7746    /**
7747     * The peer did something harmless that we weren't able to meaningfully process.
7748     * If the error is logged, log it at the given level.
7749     */
7750    LDKErrorAction_IgnoreAndLog,
7751    /**
7752     * The peer provided us with a gossip message which we'd already seen. In most cases this
7753     * should be ignored, but it may result in the message being forwarded if it is a duplicate of
7754     * our own channel announcements.
7755     */
7756    LDKErrorAction_IgnoreDuplicateGossip,
7757    /**
7758     * The peer did something incorrect. Tell them.
7759     */
7760    LDKErrorAction_SendErrorMessage,
7761    /**
7762     * The peer did something incorrect. Tell them without closing any channels.
7763     */
7764    LDKErrorAction_SendWarningMessage,
7765    /**
7766     * Must be last for serialization purposes
7767     */
7768    LDKErrorAction_Sentinel,
7769 } LDKErrorAction_Tag;
7770
7771 typedef struct LDKErrorAction_LDKDisconnectPeer_Body {
7772    /**
7773     * An error message which we should make an effort to send before we disconnect.
7774     *
7775     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
7776     */
7777    struct LDKErrorMessage msg;
7778 } LDKErrorAction_LDKDisconnectPeer_Body;
7779
7780 typedef struct LDKErrorAction_LDKDisconnectPeerWithWarning_Body {
7781    /**
7782     * A warning message which we should make an effort to send before we disconnect.
7783     */
7784    struct LDKWarningMessage msg;
7785 } LDKErrorAction_LDKDisconnectPeerWithWarning_Body;
7786
7787 typedef struct LDKErrorAction_LDKSendErrorMessage_Body {
7788    /**
7789     * The message to send.
7790     */
7791    struct LDKErrorMessage msg;
7792 } LDKErrorAction_LDKSendErrorMessage_Body;
7793
7794 typedef struct LDKErrorAction_LDKSendWarningMessage_Body {
7795    /**
7796     * The message to send.
7797     */
7798    struct LDKWarningMessage msg;
7799    /**
7800     * The peer may have done something harmless that we weren't able to meaningfully process,
7801     * though we should still tell them about it.
7802     * If this event is logged, log it at the given level.
7803     */
7804    enum LDKLevel log_level;
7805 } LDKErrorAction_LDKSendWarningMessage_Body;
7806
7807 typedef struct MUST_USE_STRUCT LDKErrorAction {
7808    LDKErrorAction_Tag tag;
7809    union {
7810       LDKErrorAction_LDKDisconnectPeer_Body disconnect_peer;
7811       LDKErrorAction_LDKDisconnectPeerWithWarning_Body disconnect_peer_with_warning;
7812       struct {
7813          enum LDKLevel ignore_and_log;
7814       };
7815       LDKErrorAction_LDKSendErrorMessage_Body send_error_message;
7816       LDKErrorAction_LDKSendWarningMessage_Body send_warning_message;
7817    };
7818 } LDKErrorAction;
7819
7820
7821
7822 /**
7823  * A [`query_channel_range`] message is used to query a peer for channel
7824  * UTXOs in a range of blocks. The recipient of a query makes a best
7825  * effort to reply to the query using one or more [`ReplyChannelRange`]
7826  * messages.
7827  *
7828  * [`query_channel_range`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-query_channel_range-and-reply_channel_range-messages
7829  */
7830 typedef struct MUST_USE_STRUCT LDKQueryChannelRange {
7831    /**
7832     * A pointer to the opaque Rust object.
7833     * Nearly everywhere, inner must be non-null, however in places where
7834     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7835     */
7836    LDKnativeQueryChannelRange *inner;
7837    /**
7838     * Indicates that this is the only struct which contains the same pointer.
7839     * Rust functions which take ownership of an object provided via an argument require
7840     * this to be true and invalidate the object pointed to by inner.
7841     */
7842    bool is_owned;
7843 } LDKQueryChannelRange;
7844
7845
7846
7847 /**
7848  * A [`query_short_channel_ids`] message is used to query a peer for
7849  * routing gossip messages related to one or more `short_channel_id`s.
7850  *
7851  * The query recipient will reply with the latest, if available,
7852  * [`ChannelAnnouncement`], [`ChannelUpdate`] and [`NodeAnnouncement`] messages
7853  * it maintains for the requested `short_channel_id`s followed by a
7854  * [`ReplyShortChannelIdsEnd`] message. The `short_channel_id`s sent in
7855  * this query are encoded. We only support `encoding_type=0` uncompressed
7856  * serialization and do not support `encoding_type=1` zlib serialization.
7857  *
7858  * [`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
7859  */
7860 typedef struct MUST_USE_STRUCT LDKQueryShortChannelIds {
7861    /**
7862     * A pointer to the opaque Rust object.
7863     * Nearly everywhere, inner must be non-null, however in places where
7864     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7865     */
7866    LDKnativeQueryShortChannelIds *inner;
7867    /**
7868     * Indicates that this is the only struct which contains the same pointer.
7869     * Rust functions which take ownership of an object provided via an argument require
7870     * this to be true and invalidate the object pointed to by inner.
7871     */
7872    bool is_owned;
7873 } LDKQueryShortChannelIds;
7874
7875
7876
7877 /**
7878  * A [`reply_channel_range`] message is a reply to a [`QueryChannelRange`]
7879  * message.
7880  *
7881  * Multiple `reply_channel_range` messages can be sent in reply
7882  * to a single [`QueryChannelRange`] message. The query recipient makes a
7883  * best effort to respond based on their local network view which may
7884  * not be a perfect view of the network. The `short_channel_id`s in the
7885  * reply are encoded. We only support `encoding_type=0` uncompressed
7886  * serialization and do not support `encoding_type=1` zlib serialization.
7887  *
7888  * [`reply_channel_range`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-query_channel_range-and-reply_channel_range-messages
7889  */
7890 typedef struct MUST_USE_STRUCT LDKReplyChannelRange {
7891    /**
7892     * A pointer to the opaque Rust object.
7893     * Nearly everywhere, inner must be non-null, however in places where
7894     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7895     */
7896    LDKnativeReplyChannelRange *inner;
7897    /**
7898     * Indicates that this is the only struct which contains the same pointer.
7899     * Rust functions which take ownership of an object provided via an argument require
7900     * this to be true and invalidate the object pointed to by inner.
7901     */
7902    bool is_owned;
7903 } LDKReplyChannelRange;
7904
7905
7906
7907 /**
7908  * A [`gossip_timestamp_filter`] message is used by a node to request
7909  * gossip relay for messages in the requested time range when the
7910  * `gossip_queries` feature has been negotiated.
7911  *
7912  * [`gossip_timestamp_filter`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-gossip_timestamp_filter-message
7913  */
7914 typedef struct MUST_USE_STRUCT LDKGossipTimestampFilter {
7915    /**
7916     * A pointer to the opaque Rust object.
7917     * Nearly everywhere, inner must be non-null, however in places where
7918     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7919     */
7920    LDKnativeGossipTimestampFilter *inner;
7921    /**
7922     * Indicates that this is the only struct which contains the same pointer.
7923     * Rust functions which take ownership of an object provided via an argument require
7924     * this to be true and invalidate the object pointed to by inner.
7925     */
7926    bool is_owned;
7927 } LDKGossipTimestampFilter;
7928
7929 /**
7930  * An event generated by ChannelManager which indicates a message should be sent to a peer (or
7931  * broadcast to most peers).
7932  * These events are handled by PeerManager::process_events if you are using a PeerManager.
7933  */
7934 typedef enum LDKMessageSendEvent_Tag {
7935    /**
7936     * Used to indicate that we've accepted a channel open and should send the accept_channel
7937     * message provided to the given peer.
7938     */
7939    LDKMessageSendEvent_SendAcceptChannel,
7940    /**
7941     * Used to indicate that we've accepted a V2 channel open and should send the accept_channel2
7942     * message provided to the given peer.
7943     */
7944    LDKMessageSendEvent_SendAcceptChannelV2,
7945    /**
7946     * Used to indicate that we've initiated a channel open and should send the open_channel
7947     * message provided to the given peer.
7948     */
7949    LDKMessageSendEvent_SendOpenChannel,
7950    /**
7951     * Used to indicate that we've initiated a V2 channel open and should send the open_channel2
7952     * message provided to the given peer.
7953     */
7954    LDKMessageSendEvent_SendOpenChannelV2,
7955    /**
7956     * Used to indicate that a funding_created message should be sent to the peer with the given node_id.
7957     */
7958    LDKMessageSendEvent_SendFundingCreated,
7959    /**
7960     * Used to indicate that a funding_signed message should be sent to the peer with the given node_id.
7961     */
7962    LDKMessageSendEvent_SendFundingSigned,
7963    /**
7964     * Used to indicate that a stfu message should be sent to the peer with the given node id.
7965     */
7966    LDKMessageSendEvent_SendStfu,
7967    /**
7968     * Used to indicate that a splice message should be sent to the peer with the given node id.
7969     */
7970    LDKMessageSendEvent_SendSplice,
7971    /**
7972     * Used to indicate that a splice_ack message should be sent to the peer with the given node id.
7973     */
7974    LDKMessageSendEvent_SendSpliceAck,
7975    /**
7976     * Used to indicate that a splice_locked message should be sent to the peer with the given node id.
7977     */
7978    LDKMessageSendEvent_SendSpliceLocked,
7979    /**
7980     * Used to indicate that a tx_add_input message should be sent to the peer with the given node_id.
7981     */
7982    LDKMessageSendEvent_SendTxAddInput,
7983    /**
7984     * Used to indicate that a tx_add_output message should be sent to the peer with the given node_id.
7985     */
7986    LDKMessageSendEvent_SendTxAddOutput,
7987    /**
7988     * Used to indicate that a tx_remove_input message should be sent to the peer with the given node_id.
7989     */
7990    LDKMessageSendEvent_SendTxRemoveInput,
7991    /**
7992     * Used to indicate that a tx_remove_output message should be sent to the peer with the given node_id.
7993     */
7994    LDKMessageSendEvent_SendTxRemoveOutput,
7995    /**
7996     * Used to indicate that a tx_complete message should be sent to the peer with the given node_id.
7997     */
7998    LDKMessageSendEvent_SendTxComplete,
7999    /**
8000     * Used to indicate that a tx_signatures message should be sent to the peer with the given node_id.
8001     */
8002    LDKMessageSendEvent_SendTxSignatures,
8003    /**
8004     * Used to indicate that a tx_init_rbf message should be sent to the peer with the given node_id.
8005     */
8006    LDKMessageSendEvent_SendTxInitRbf,
8007    /**
8008     * Used to indicate that a tx_ack_rbf message should be sent to the peer with the given node_id.
8009     */
8010    LDKMessageSendEvent_SendTxAckRbf,
8011    /**
8012     * Used to indicate that a tx_abort message should be sent to the peer with the given node_id.
8013     */
8014    LDKMessageSendEvent_SendTxAbort,
8015    /**
8016     * Used to indicate that a channel_ready message should be sent to the peer with the given node_id.
8017     */
8018    LDKMessageSendEvent_SendChannelReady,
8019    /**
8020     * Used to indicate that an announcement_signatures message should be sent to the peer with the given node_id.
8021     */
8022    LDKMessageSendEvent_SendAnnouncementSignatures,
8023    /**
8024     * Used to indicate that a series of HTLC update messages, as well as a commitment_signed
8025     * message should be sent to the peer with the given node_id.
8026     */
8027    LDKMessageSendEvent_UpdateHTLCs,
8028    /**
8029     * Used to indicate that a revoke_and_ack message should be sent to the peer with the given node_id.
8030     */
8031    LDKMessageSendEvent_SendRevokeAndACK,
8032    /**
8033     * Used to indicate that a closing_signed message should be sent to the peer with the given node_id.
8034     */
8035    LDKMessageSendEvent_SendClosingSigned,
8036    /**
8037     * Used to indicate that a shutdown message should be sent to the peer with the given node_id.
8038     */
8039    LDKMessageSendEvent_SendShutdown,
8040    /**
8041     * Used to indicate that a channel_reestablish message should be sent to the peer with the given node_id.
8042     */
8043    LDKMessageSendEvent_SendChannelReestablish,
8044    /**
8045     * Used to send a channel_announcement and channel_update to a specific peer, likely on
8046     * initial connection to ensure our peers know about our channels.
8047     */
8048    LDKMessageSendEvent_SendChannelAnnouncement,
8049    /**
8050     * Used to indicate that a channel_announcement and channel_update should be broadcast to all
8051     * peers (except the peer with node_id either msg.contents.node_id_1 or msg.contents.node_id_2).
8052     *
8053     * Note that after doing so, you very likely (unless you did so very recently) want to
8054     * broadcast a node_announcement (e.g. via [`PeerManager::broadcast_node_announcement`]). This
8055     * ensures that any nodes which see our channel_announcement also have a relevant
8056     * node_announcement, including relevant feature flags which may be important for routing
8057     * through or to us.
8058     *
8059     * [`PeerManager::broadcast_node_announcement`]: crate::ln::peer_handler::PeerManager::broadcast_node_announcement
8060     */
8061    LDKMessageSendEvent_BroadcastChannelAnnouncement,
8062    /**
8063     * Used to indicate that a channel_update should be broadcast to all peers.
8064     */
8065    LDKMessageSendEvent_BroadcastChannelUpdate,
8066    /**
8067     * Used to indicate that a node_announcement should be broadcast to all peers.
8068     */
8069    LDKMessageSendEvent_BroadcastNodeAnnouncement,
8070    /**
8071     * Used to indicate that a channel_update should be sent to a single peer.
8072     * In contrast to [`Self::BroadcastChannelUpdate`], this is used when the channel is a
8073     * private channel and we shouldn't be informing all of our peers of channel parameters.
8074     */
8075    LDKMessageSendEvent_SendChannelUpdate,
8076    /**
8077     * Broadcast an error downstream to be handled
8078     */
8079    LDKMessageSendEvent_HandleError,
8080    /**
8081     * Query a peer for channels with funding transaction UTXOs in a block range.
8082     */
8083    LDKMessageSendEvent_SendChannelRangeQuery,
8084    /**
8085     * Request routing gossip messages from a peer for a list of channels identified by
8086     * their short_channel_ids.
8087     */
8088    LDKMessageSendEvent_SendShortIdsQuery,
8089    /**
8090     * Sends a reply to a channel range query. This may be one of several SendReplyChannelRange events
8091     * emitted during processing of the query.
8092     */
8093    LDKMessageSendEvent_SendReplyChannelRange,
8094    /**
8095     * Sends a timestamp filter for inbound gossip. This should be sent on each new connection to
8096     * enable receiving gossip messages from the peer.
8097     */
8098    LDKMessageSendEvent_SendGossipTimestampFilter,
8099    /**
8100     * Must be last for serialization purposes
8101     */
8102    LDKMessageSendEvent_Sentinel,
8103 } LDKMessageSendEvent_Tag;
8104
8105 typedef struct LDKMessageSendEvent_LDKSendAcceptChannel_Body {
8106    /**
8107     * The node_id of the node which should receive this message
8108     */
8109    struct LDKPublicKey node_id;
8110    /**
8111     * The message which should be sent.
8112     */
8113    struct LDKAcceptChannel msg;
8114 } LDKMessageSendEvent_LDKSendAcceptChannel_Body;
8115
8116 typedef struct LDKMessageSendEvent_LDKSendAcceptChannelV2_Body {
8117    /**
8118     * The node_id of the node which should receive this message
8119     */
8120    struct LDKPublicKey node_id;
8121    /**
8122     * The message which should be sent.
8123     */
8124    struct LDKAcceptChannelV2 msg;
8125 } LDKMessageSendEvent_LDKSendAcceptChannelV2_Body;
8126
8127 typedef struct LDKMessageSendEvent_LDKSendOpenChannel_Body {
8128    /**
8129     * The node_id of the node which should receive this message
8130     */
8131    struct LDKPublicKey node_id;
8132    /**
8133     * The message which should be sent.
8134     */
8135    struct LDKOpenChannel msg;
8136 } LDKMessageSendEvent_LDKSendOpenChannel_Body;
8137
8138 typedef struct LDKMessageSendEvent_LDKSendOpenChannelV2_Body {
8139    /**
8140     * The node_id of the node which should receive this message
8141     */
8142    struct LDKPublicKey node_id;
8143    /**
8144     * The message which should be sent.
8145     */
8146    struct LDKOpenChannelV2 msg;
8147 } LDKMessageSendEvent_LDKSendOpenChannelV2_Body;
8148
8149 typedef struct LDKMessageSendEvent_LDKSendFundingCreated_Body {
8150    /**
8151     * The node_id of the node which should receive this message
8152     */
8153    struct LDKPublicKey node_id;
8154    /**
8155     * The message which should be sent.
8156     */
8157    struct LDKFundingCreated msg;
8158 } LDKMessageSendEvent_LDKSendFundingCreated_Body;
8159
8160 typedef struct LDKMessageSendEvent_LDKSendFundingSigned_Body {
8161    /**
8162     * The node_id of the node which should receive this message
8163     */
8164    struct LDKPublicKey node_id;
8165    /**
8166     * The message which should be sent.
8167     */
8168    struct LDKFundingSigned msg;
8169 } LDKMessageSendEvent_LDKSendFundingSigned_Body;
8170
8171 typedef struct LDKMessageSendEvent_LDKSendStfu_Body {
8172    /**
8173     * The node_id of the node which should receive this message
8174     */
8175    struct LDKPublicKey node_id;
8176    /**
8177     * The message which should be sent.
8178     */
8179    struct LDKStfu msg;
8180 } LDKMessageSendEvent_LDKSendStfu_Body;
8181
8182 typedef struct LDKMessageSendEvent_LDKSendSplice_Body {
8183    /**
8184     * The node_id of the node which should receive this message
8185     */
8186    struct LDKPublicKey node_id;
8187    /**
8188     * The message which should be sent.
8189     */
8190    struct LDKSplice msg;
8191 } LDKMessageSendEvent_LDKSendSplice_Body;
8192
8193 typedef struct LDKMessageSendEvent_LDKSendSpliceAck_Body {
8194    /**
8195     * The node_id of the node which should receive this message
8196     */
8197    struct LDKPublicKey node_id;
8198    /**
8199     * The message which should be sent.
8200     */
8201    struct LDKSpliceAck msg;
8202 } LDKMessageSendEvent_LDKSendSpliceAck_Body;
8203
8204 typedef struct LDKMessageSendEvent_LDKSendSpliceLocked_Body {
8205    /**
8206     * The node_id of the node which should receive this message
8207     */
8208    struct LDKPublicKey node_id;
8209    /**
8210     * The message which should be sent.
8211     */
8212    struct LDKSpliceLocked msg;
8213 } LDKMessageSendEvent_LDKSendSpliceLocked_Body;
8214
8215 typedef struct LDKMessageSendEvent_LDKSendTxAddInput_Body {
8216    /**
8217     * The node_id of the node which should receive this message
8218     */
8219    struct LDKPublicKey node_id;
8220    /**
8221     * The message which should be sent.
8222     */
8223    struct LDKTxAddInput msg;
8224 } LDKMessageSendEvent_LDKSendTxAddInput_Body;
8225
8226 typedef struct LDKMessageSendEvent_LDKSendTxAddOutput_Body {
8227    /**
8228     * The node_id of the node which should receive this message
8229     */
8230    struct LDKPublicKey node_id;
8231    /**
8232     * The message which should be sent.
8233     */
8234    struct LDKTxAddOutput msg;
8235 } LDKMessageSendEvent_LDKSendTxAddOutput_Body;
8236
8237 typedef struct LDKMessageSendEvent_LDKSendTxRemoveInput_Body {
8238    /**
8239     * The node_id of the node which should receive this message
8240     */
8241    struct LDKPublicKey node_id;
8242    /**
8243     * The message which should be sent.
8244     */
8245    struct LDKTxRemoveInput msg;
8246 } LDKMessageSendEvent_LDKSendTxRemoveInput_Body;
8247
8248 typedef struct LDKMessageSendEvent_LDKSendTxRemoveOutput_Body {
8249    /**
8250     * The node_id of the node which should receive this message
8251     */
8252    struct LDKPublicKey node_id;
8253    /**
8254     * The message which should be sent.
8255     */
8256    struct LDKTxRemoveOutput msg;
8257 } LDKMessageSendEvent_LDKSendTxRemoveOutput_Body;
8258
8259 typedef struct LDKMessageSendEvent_LDKSendTxComplete_Body {
8260    /**
8261     * The node_id of the node which should receive this message
8262     */
8263    struct LDKPublicKey node_id;
8264    /**
8265     * The message which should be sent.
8266     */
8267    struct LDKTxComplete msg;
8268 } LDKMessageSendEvent_LDKSendTxComplete_Body;
8269
8270 typedef struct LDKMessageSendEvent_LDKSendTxSignatures_Body {
8271    /**
8272     * The node_id of the node which should receive this message
8273     */
8274    struct LDKPublicKey node_id;
8275    /**
8276     * The message which should be sent.
8277     */
8278    struct LDKTxSignatures msg;
8279 } LDKMessageSendEvent_LDKSendTxSignatures_Body;
8280
8281 typedef struct LDKMessageSendEvent_LDKSendTxInitRbf_Body {
8282    /**
8283     * The node_id of the node which should receive this message
8284     */
8285    struct LDKPublicKey node_id;
8286    /**
8287     * The message which should be sent.
8288     */
8289    struct LDKTxInitRbf msg;
8290 } LDKMessageSendEvent_LDKSendTxInitRbf_Body;
8291
8292 typedef struct LDKMessageSendEvent_LDKSendTxAckRbf_Body {
8293    /**
8294     * The node_id of the node which should receive this message
8295     */
8296    struct LDKPublicKey node_id;
8297    /**
8298     * The message which should be sent.
8299     */
8300    struct LDKTxAckRbf msg;
8301 } LDKMessageSendEvent_LDKSendTxAckRbf_Body;
8302
8303 typedef struct LDKMessageSendEvent_LDKSendTxAbort_Body {
8304    /**
8305     * The node_id of the node which should receive this message
8306     */
8307    struct LDKPublicKey node_id;
8308    /**
8309     * The message which should be sent.
8310     */
8311    struct LDKTxAbort msg;
8312 } LDKMessageSendEvent_LDKSendTxAbort_Body;
8313
8314 typedef struct LDKMessageSendEvent_LDKSendChannelReady_Body {
8315    /**
8316     * The node_id of the node which should receive these message(s)
8317     */
8318    struct LDKPublicKey node_id;
8319    /**
8320     * The channel_ready message which should be sent.
8321     */
8322    struct LDKChannelReady msg;
8323 } LDKMessageSendEvent_LDKSendChannelReady_Body;
8324
8325 typedef struct LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body {
8326    /**
8327     * The node_id of the node which should receive these message(s)
8328     */
8329    struct LDKPublicKey node_id;
8330    /**
8331     * The announcement_signatures message which should be sent.
8332     */
8333    struct LDKAnnouncementSignatures msg;
8334 } LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body;
8335
8336 typedef struct LDKMessageSendEvent_LDKUpdateHTLCs_Body {
8337    /**
8338     * The node_id of the node which should receive these message(s)
8339     */
8340    struct LDKPublicKey node_id;
8341    /**
8342     * The update messages which should be sent. ALL messages in the struct should be sent!
8343     */
8344    struct LDKCommitmentUpdate updates;
8345 } LDKMessageSendEvent_LDKUpdateHTLCs_Body;
8346
8347 typedef struct LDKMessageSendEvent_LDKSendRevokeAndACK_Body {
8348    /**
8349     * The node_id of the node which should receive this message
8350     */
8351    struct LDKPublicKey node_id;
8352    /**
8353     * The message which should be sent.
8354     */
8355    struct LDKRevokeAndACK msg;
8356 } LDKMessageSendEvent_LDKSendRevokeAndACK_Body;
8357
8358 typedef struct LDKMessageSendEvent_LDKSendClosingSigned_Body {
8359    /**
8360     * The node_id of the node which should receive this message
8361     */
8362    struct LDKPublicKey node_id;
8363    /**
8364     * The message which should be sent.
8365     */
8366    struct LDKClosingSigned msg;
8367 } LDKMessageSendEvent_LDKSendClosingSigned_Body;
8368
8369 typedef struct LDKMessageSendEvent_LDKSendShutdown_Body {
8370    /**
8371     * The node_id of the node which should receive this message
8372     */
8373    struct LDKPublicKey node_id;
8374    /**
8375     * The message which should be sent.
8376     */
8377    struct LDKShutdown msg;
8378 } LDKMessageSendEvent_LDKSendShutdown_Body;
8379
8380 typedef struct LDKMessageSendEvent_LDKSendChannelReestablish_Body {
8381    /**
8382     * The node_id of the node which should receive this message
8383     */
8384    struct LDKPublicKey node_id;
8385    /**
8386     * The message which should be sent.
8387     */
8388    struct LDKChannelReestablish msg;
8389 } LDKMessageSendEvent_LDKSendChannelReestablish_Body;
8390
8391 typedef struct LDKMessageSendEvent_LDKSendChannelAnnouncement_Body {
8392    /**
8393     * The node_id of the node which should receive this message
8394     */
8395    struct LDKPublicKey node_id;
8396    /**
8397     * The channel_announcement which should be sent.
8398     */
8399    struct LDKChannelAnnouncement msg;
8400    /**
8401     * The followup channel_update which should be sent.
8402     */
8403    struct LDKChannelUpdate update_msg;
8404 } LDKMessageSendEvent_LDKSendChannelAnnouncement_Body;
8405
8406 typedef struct LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body {
8407    /**
8408     * The channel_announcement which should be sent.
8409     */
8410    struct LDKChannelAnnouncement msg;
8411    /**
8412     * The followup channel_update which should be sent.
8413     *
8414     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
8415     */
8416    struct LDKChannelUpdate update_msg;
8417 } LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body;
8418
8419 typedef struct LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body {
8420    /**
8421     * The channel_update which should be sent.
8422     */
8423    struct LDKChannelUpdate msg;
8424 } LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body;
8425
8426 typedef struct LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body {
8427    /**
8428     * The node_announcement which should be sent.
8429     */
8430    struct LDKNodeAnnouncement msg;
8431 } LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body;
8432
8433 typedef struct LDKMessageSendEvent_LDKSendChannelUpdate_Body {
8434    /**
8435     * The node_id of the node which should receive this message
8436     */
8437    struct LDKPublicKey node_id;
8438    /**
8439     * The channel_update which should be sent.
8440     */
8441    struct LDKChannelUpdate msg;
8442 } LDKMessageSendEvent_LDKSendChannelUpdate_Body;
8443
8444 typedef struct LDKMessageSendEvent_LDKHandleError_Body {
8445    /**
8446     * The node_id of the node which should receive this message
8447     */
8448    struct LDKPublicKey node_id;
8449    /**
8450     * The action which should be taken.
8451     */
8452    struct LDKErrorAction action;
8453 } LDKMessageSendEvent_LDKHandleError_Body;
8454
8455 typedef struct LDKMessageSendEvent_LDKSendChannelRangeQuery_Body {
8456    /**
8457     * The node_id of this message recipient
8458     */
8459    struct LDKPublicKey node_id;
8460    /**
8461     * The query_channel_range which should be sent.
8462     */
8463    struct LDKQueryChannelRange msg;
8464 } LDKMessageSendEvent_LDKSendChannelRangeQuery_Body;
8465
8466 typedef struct LDKMessageSendEvent_LDKSendShortIdsQuery_Body {
8467    /**
8468     * The node_id of this message recipient
8469     */
8470    struct LDKPublicKey node_id;
8471    /**
8472     * The query_short_channel_ids which should be sent.
8473     */
8474    struct LDKQueryShortChannelIds msg;
8475 } LDKMessageSendEvent_LDKSendShortIdsQuery_Body;
8476
8477 typedef struct LDKMessageSendEvent_LDKSendReplyChannelRange_Body {
8478    /**
8479     * The node_id of this message recipient
8480     */
8481    struct LDKPublicKey node_id;
8482    /**
8483     * The reply_channel_range which should be sent.
8484     */
8485    struct LDKReplyChannelRange msg;
8486 } LDKMessageSendEvent_LDKSendReplyChannelRange_Body;
8487
8488 typedef struct LDKMessageSendEvent_LDKSendGossipTimestampFilter_Body {
8489    /**
8490     * The node_id of this message recipient
8491     */
8492    struct LDKPublicKey node_id;
8493    /**
8494     * The gossip_timestamp_filter which should be sent.
8495     */
8496    struct LDKGossipTimestampFilter msg;
8497 } LDKMessageSendEvent_LDKSendGossipTimestampFilter_Body;
8498
8499 typedef struct MUST_USE_STRUCT LDKMessageSendEvent {
8500    LDKMessageSendEvent_Tag tag;
8501    union {
8502       LDKMessageSendEvent_LDKSendAcceptChannel_Body send_accept_channel;
8503       LDKMessageSendEvent_LDKSendAcceptChannelV2_Body send_accept_channel_v2;
8504       LDKMessageSendEvent_LDKSendOpenChannel_Body send_open_channel;
8505       LDKMessageSendEvent_LDKSendOpenChannelV2_Body send_open_channel_v2;
8506       LDKMessageSendEvent_LDKSendFundingCreated_Body send_funding_created;
8507       LDKMessageSendEvent_LDKSendFundingSigned_Body send_funding_signed;
8508       LDKMessageSendEvent_LDKSendStfu_Body send_stfu;
8509       LDKMessageSendEvent_LDKSendSplice_Body send_splice;
8510       LDKMessageSendEvent_LDKSendSpliceAck_Body send_splice_ack;
8511       LDKMessageSendEvent_LDKSendSpliceLocked_Body send_splice_locked;
8512       LDKMessageSendEvent_LDKSendTxAddInput_Body send_tx_add_input;
8513       LDKMessageSendEvent_LDKSendTxAddOutput_Body send_tx_add_output;
8514       LDKMessageSendEvent_LDKSendTxRemoveInput_Body send_tx_remove_input;
8515       LDKMessageSendEvent_LDKSendTxRemoveOutput_Body send_tx_remove_output;
8516       LDKMessageSendEvent_LDKSendTxComplete_Body send_tx_complete;
8517       LDKMessageSendEvent_LDKSendTxSignatures_Body send_tx_signatures;
8518       LDKMessageSendEvent_LDKSendTxInitRbf_Body send_tx_init_rbf;
8519       LDKMessageSendEvent_LDKSendTxAckRbf_Body send_tx_ack_rbf;
8520       LDKMessageSendEvent_LDKSendTxAbort_Body send_tx_abort;
8521       LDKMessageSendEvent_LDKSendChannelReady_Body send_channel_ready;
8522       LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body send_announcement_signatures;
8523       LDKMessageSendEvent_LDKUpdateHTLCs_Body update_htl_cs;
8524       LDKMessageSendEvent_LDKSendRevokeAndACK_Body send_revoke_and_ack;
8525       LDKMessageSendEvent_LDKSendClosingSigned_Body send_closing_signed;
8526       LDKMessageSendEvent_LDKSendShutdown_Body send_shutdown;
8527       LDKMessageSendEvent_LDKSendChannelReestablish_Body send_channel_reestablish;
8528       LDKMessageSendEvent_LDKSendChannelAnnouncement_Body send_channel_announcement;
8529       LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body broadcast_channel_announcement;
8530       LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body broadcast_channel_update;
8531       LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body broadcast_node_announcement;
8532       LDKMessageSendEvent_LDKSendChannelUpdate_Body send_channel_update;
8533       LDKMessageSendEvent_LDKHandleError_Body handle_error;
8534       LDKMessageSendEvent_LDKSendChannelRangeQuery_Body send_channel_range_query;
8535       LDKMessageSendEvent_LDKSendShortIdsQuery_Body send_short_ids_query;
8536       LDKMessageSendEvent_LDKSendReplyChannelRange_Body send_reply_channel_range;
8537       LDKMessageSendEvent_LDKSendGossipTimestampFilter_Body send_gossip_timestamp_filter;
8538    };
8539 } LDKMessageSendEvent;
8540
8541 /**
8542  * A dynamically-allocated array of crate::lightning::events::MessageSendEvents of arbitrary size.
8543  * This corresponds to std::vector in C++
8544  */
8545 typedef struct LDKCVec_MessageSendEventZ {
8546    /**
8547     * The elements in the array.
8548     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8549     */
8550    struct LDKMessageSendEvent *data;
8551    /**
8552     * The number of elements pointed to by `data`.
8553     */
8554    uintptr_t datalen;
8555 } LDKCVec_MessageSendEventZ;
8556
8557
8558
8559 /**
8560  * Details about one direction of a channel as received within a [`ChannelUpdate`].
8561  */
8562 typedef struct MUST_USE_STRUCT LDKChannelUpdateInfo {
8563    /**
8564     * A pointer to the opaque Rust object.
8565     * Nearly everywhere, inner must be non-null, however in places where
8566     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8567     */
8568    LDKnativeChannelUpdateInfo *inner;
8569    /**
8570     * Indicates that this is the only struct which contains the same pointer.
8571     * Rust functions which take ownership of an object provided via an argument require
8572     * this to be true and invalidate the object pointed to by inner.
8573     */
8574    bool is_owned;
8575 } LDKChannelUpdateInfo;
8576
8577 /**
8578  * The contents of CResult_ChannelUpdateInfoDecodeErrorZ
8579  */
8580 typedef union LDKCResult_ChannelUpdateInfoDecodeErrorZPtr {
8581    /**
8582     * A pointer to the contents in the success state.
8583     * Reading from this pointer when `result_ok` is not set is undefined.
8584     */
8585    struct LDKChannelUpdateInfo *result;
8586    /**
8587     * A pointer to the contents in the error state.
8588     * Reading from this pointer when `result_ok` is set is undefined.
8589     */
8590    struct LDKDecodeError *err;
8591 } LDKCResult_ChannelUpdateInfoDecodeErrorZPtr;
8592
8593 /**
8594  * A CResult_ChannelUpdateInfoDecodeErrorZ represents the result of a fallible operation,
8595  * containing a crate::lightning::routing::gossip::ChannelUpdateInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
8596  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8597  */
8598 typedef struct LDKCResult_ChannelUpdateInfoDecodeErrorZ {
8599    /**
8600     * The contents of this CResult_ChannelUpdateInfoDecodeErrorZ, accessible via either
8601     * `err` or `result` depending on the state of `result_ok`.
8602     */
8603    union LDKCResult_ChannelUpdateInfoDecodeErrorZPtr contents;
8604    /**
8605     * Whether this CResult_ChannelUpdateInfoDecodeErrorZ represents a success state.
8606     */
8607    bool result_ok;
8608 } LDKCResult_ChannelUpdateInfoDecodeErrorZ;
8609
8610
8611
8612 /**
8613  * Details about a channel (both directions).
8614  * Received within a channel announcement.
8615  */
8616 typedef struct MUST_USE_STRUCT LDKChannelInfo {
8617    /**
8618     * A pointer to the opaque Rust object.
8619     * Nearly everywhere, inner must be non-null, however in places where
8620     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8621     */
8622    LDKnativeChannelInfo *inner;
8623    /**
8624     * Indicates that this is the only struct which contains the same pointer.
8625     * Rust functions which take ownership of an object provided via an argument require
8626     * this to be true and invalidate the object pointed to by inner.
8627     */
8628    bool is_owned;
8629 } LDKChannelInfo;
8630
8631 /**
8632  * The contents of CResult_ChannelInfoDecodeErrorZ
8633  */
8634 typedef union LDKCResult_ChannelInfoDecodeErrorZPtr {
8635    /**
8636     * A pointer to the contents in the success state.
8637     * Reading from this pointer when `result_ok` is not set is undefined.
8638     */
8639    struct LDKChannelInfo *result;
8640    /**
8641     * A pointer to the contents in the error state.
8642     * Reading from this pointer when `result_ok` is set is undefined.
8643     */
8644    struct LDKDecodeError *err;
8645 } LDKCResult_ChannelInfoDecodeErrorZPtr;
8646
8647 /**
8648  * A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
8649  * containing a crate::lightning::routing::gossip::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
8650  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8651  */
8652 typedef struct LDKCResult_ChannelInfoDecodeErrorZ {
8653    /**
8654     * The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
8655     * `err` or `result` depending on the state of `result_ok`.
8656     */
8657    union LDKCResult_ChannelInfoDecodeErrorZPtr contents;
8658    /**
8659     * Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
8660     */
8661    bool result_ok;
8662 } LDKCResult_ChannelInfoDecodeErrorZ;
8663
8664
8665
8666 /**
8667  * Fees for routing via a given channel or a node
8668  */
8669 typedef struct MUST_USE_STRUCT LDKRoutingFees {
8670    /**
8671     * A pointer to the opaque Rust object.
8672     * Nearly everywhere, inner must be non-null, however in places where
8673     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8674     */
8675    LDKnativeRoutingFees *inner;
8676    /**
8677     * Indicates that this is the only struct which contains the same pointer.
8678     * Rust functions which take ownership of an object provided via an argument require
8679     * this to be true and invalidate the object pointed to by inner.
8680     */
8681    bool is_owned;
8682 } LDKRoutingFees;
8683
8684 /**
8685  * The contents of CResult_RoutingFeesDecodeErrorZ
8686  */
8687 typedef union LDKCResult_RoutingFeesDecodeErrorZPtr {
8688    /**
8689     * A pointer to the contents in the success state.
8690     * Reading from this pointer when `result_ok` is not set is undefined.
8691     */
8692    struct LDKRoutingFees *result;
8693    /**
8694     * A pointer to the contents in the error state.
8695     * Reading from this pointer when `result_ok` is set is undefined.
8696     */
8697    struct LDKDecodeError *err;
8698 } LDKCResult_RoutingFeesDecodeErrorZPtr;
8699
8700 /**
8701  * A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
8702  * containing a crate::lightning::routing::gossip::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
8703  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8704  */
8705 typedef struct LDKCResult_RoutingFeesDecodeErrorZ {
8706    /**
8707     * The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
8708     * `err` or `result` depending on the state of `result_ok`.
8709     */
8710    union LDKCResult_RoutingFeesDecodeErrorZPtr contents;
8711    /**
8712     * Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
8713     */
8714    bool result_ok;
8715 } LDKCResult_RoutingFeesDecodeErrorZ;
8716
8717 /**
8718  * A 4-byte byte array.
8719  */
8720 typedef struct LDKFourBytes {
8721    /**
8722     * The four bytes
8723     */
8724    uint8_t data[4];
8725 } LDKFourBytes;
8726
8727 /**
8728  * A 12-byte byte array.
8729  */
8730 typedef struct LDKTwelveBytes {
8731    /**
8732     * The twelve bytes
8733     */
8734    uint8_t data[12];
8735 } LDKTwelveBytes;
8736
8737
8738
8739 /**
8740  * Represents a hostname for serialization purposes.
8741  * Only the character set and length will be validated.
8742  * The character set consists of ASCII alphanumeric characters, hyphens, and periods.
8743  * Its length is guaranteed to be representable by a single byte.
8744  * This serialization is used by [`BOLT 7`] hostnames.
8745  *
8746  * [`BOLT 7`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md
8747  */
8748 typedef struct MUST_USE_STRUCT LDKHostname {
8749    /**
8750     * A pointer to the opaque Rust object.
8751     * Nearly everywhere, inner must be non-null, however in places where
8752     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8753     */
8754    LDKnativeHostname *inner;
8755    /**
8756     * Indicates that this is the only struct which contains the same pointer.
8757     * Rust functions which take ownership of an object provided via an argument require
8758     * this to be true and invalidate the object pointed to by inner.
8759     */
8760    bool is_owned;
8761 } LDKHostname;
8762
8763 /**
8764  * An address which can be used to connect to a remote peer.
8765  */
8766 typedef enum LDKSocketAddress_Tag {
8767    /**
8768     * An IPv4 address and port on which the peer is listening.
8769     */
8770    LDKSocketAddress_TcpIpV4,
8771    /**
8772     * An IPv6 address and port on which the peer is listening.
8773     */
8774    LDKSocketAddress_TcpIpV6,
8775    /**
8776     * An old-style Tor onion address/port on which the peer is listening.
8777     *
8778     * This field is deprecated and the Tor network generally no longer supports V2 Onion
8779     * addresses. Thus, the details are not parsed here.
8780     */
8781    LDKSocketAddress_OnionV2,
8782    /**
8783     * A new-style Tor onion address/port on which the peer is listening.
8784     *
8785     * To create the human-readable \"hostname\", concatenate the ED25519 pubkey, checksum, and version,
8786     * wrap as base32 and append \".onion\".
8787     */
8788    LDKSocketAddress_OnionV3,
8789    /**
8790     * A hostname/port on which the peer is listening.
8791     */
8792    LDKSocketAddress_Hostname,
8793    /**
8794     * Must be last for serialization purposes
8795     */
8796    LDKSocketAddress_Sentinel,
8797 } LDKSocketAddress_Tag;
8798
8799 typedef struct LDKSocketAddress_LDKTcpIpV4_Body {
8800    /**
8801     * The 4-byte IPv4 address
8802     */
8803    struct LDKFourBytes addr;
8804    /**
8805     * The port on which the node is listening
8806     */
8807    uint16_t port;
8808 } LDKSocketAddress_LDKTcpIpV4_Body;
8809
8810 typedef struct LDKSocketAddress_LDKTcpIpV6_Body {
8811    /**
8812     * The 16-byte IPv6 address
8813     */
8814    struct LDKSixteenBytes addr;
8815    /**
8816     * The port on which the node is listening
8817     */
8818    uint16_t port;
8819 } LDKSocketAddress_LDKTcpIpV6_Body;
8820
8821 typedef struct LDKSocketAddress_LDKOnionV3_Body {
8822    /**
8823     * The ed25519 long-term public key of the peer
8824     */
8825    struct LDKThirtyTwoBytes ed25519_pubkey;
8826    /**
8827     * The checksum of the pubkey and version, as included in the onion address
8828     */
8829    uint16_t checksum;
8830    /**
8831     * The version byte, as defined by the Tor Onion v3 spec.
8832     */
8833    uint8_t version;
8834    /**
8835     * The port on which the node is listening
8836     */
8837    uint16_t port;
8838 } LDKSocketAddress_LDKOnionV3_Body;
8839
8840 typedef struct LDKSocketAddress_LDKHostname_Body {
8841    /**
8842     * The hostname on which the node is listening.
8843     */
8844    struct LDKHostname hostname;
8845    /**
8846     * The port on which the node is listening.
8847     */
8848    uint16_t port;
8849 } LDKSocketAddress_LDKHostname_Body;
8850
8851 typedef struct MUST_USE_STRUCT LDKSocketAddress {
8852    LDKSocketAddress_Tag tag;
8853    union {
8854       LDKSocketAddress_LDKTcpIpV4_Body tcp_ip_v4;
8855       LDKSocketAddress_LDKTcpIpV6_Body tcp_ip_v6;
8856       struct {
8857          struct LDKTwelveBytes onion_v2;
8858       };
8859       LDKSocketAddress_LDKOnionV3_Body onion_v3;
8860       LDKSocketAddress_LDKHostname_Body hostname;
8861    };
8862 } LDKSocketAddress;
8863
8864 /**
8865  * A dynamically-allocated array of crate::lightning::ln::msgs::SocketAddresss of arbitrary size.
8866  * This corresponds to std::vector in C++
8867  */
8868 typedef struct LDKCVec_SocketAddressZ {
8869    /**
8870     * The elements in the array.
8871     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8872     */
8873    struct LDKSocketAddress *data;
8874    /**
8875     * The number of elements pointed to by `data`.
8876     */
8877    uintptr_t datalen;
8878 } LDKCVec_SocketAddressZ;
8879
8880
8881
8882 /**
8883  * Information received in the latest node_announcement from this node.
8884  */
8885 typedef struct MUST_USE_STRUCT LDKNodeAnnouncementInfo {
8886    /**
8887     * A pointer to the opaque Rust object.
8888     * Nearly everywhere, inner must be non-null, however in places where
8889     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8890     */
8891    LDKnativeNodeAnnouncementInfo *inner;
8892    /**
8893     * Indicates that this is the only struct which contains the same pointer.
8894     * Rust functions which take ownership of an object provided via an argument require
8895     * this to be true and invalidate the object pointed to by inner.
8896     */
8897    bool is_owned;
8898 } LDKNodeAnnouncementInfo;
8899
8900 /**
8901  * The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
8902  */
8903 typedef union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr {
8904    /**
8905     * A pointer to the contents in the success state.
8906     * Reading from this pointer when `result_ok` is not set is undefined.
8907     */
8908    struct LDKNodeAnnouncementInfo *result;
8909    /**
8910     * A pointer to the contents in the error state.
8911     * Reading from this pointer when `result_ok` is set is undefined.
8912     */
8913    struct LDKDecodeError *err;
8914 } LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr;
8915
8916 /**
8917  * A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
8918  * containing a crate::lightning::routing::gossip::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
8919  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8920  */
8921 typedef struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ {
8922    /**
8923     * The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
8924     * `err` or `result` depending on the state of `result_ok`.
8925     */
8926    union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr contents;
8927    /**
8928     * Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
8929     */
8930    bool result_ok;
8931 } LDKCResult_NodeAnnouncementInfoDecodeErrorZ;
8932
8933
8934
8935 /**
8936  * A user-defined name for a node, which may be used when displaying the node in a graph.
8937  *
8938  * Since node aliases are provided by third parties, they are a potential avenue for injection
8939  * attacks. Care must be taken when processing.
8940  */
8941 typedef struct MUST_USE_STRUCT LDKNodeAlias {
8942    /**
8943     * A pointer to the opaque Rust object.
8944     * Nearly everywhere, inner must be non-null, however in places where
8945     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8946     */
8947    LDKnativeNodeAlias *inner;
8948    /**
8949     * Indicates that this is the only struct which contains the same pointer.
8950     * Rust functions which take ownership of an object provided via an argument require
8951     * this to be true and invalidate the object pointed to by inner.
8952     */
8953    bool is_owned;
8954 } LDKNodeAlias;
8955
8956 /**
8957  * The contents of CResult_NodeAliasDecodeErrorZ
8958  */
8959 typedef union LDKCResult_NodeAliasDecodeErrorZPtr {
8960    /**
8961     * A pointer to the contents in the success state.
8962     * Reading from this pointer when `result_ok` is not set is undefined.
8963     */
8964    struct LDKNodeAlias *result;
8965    /**
8966     * A pointer to the contents in the error state.
8967     * Reading from this pointer when `result_ok` is set is undefined.
8968     */
8969    struct LDKDecodeError *err;
8970 } LDKCResult_NodeAliasDecodeErrorZPtr;
8971
8972 /**
8973  * A CResult_NodeAliasDecodeErrorZ represents the result of a fallible operation,
8974  * containing a crate::lightning::routing::gossip::NodeAlias on success and a crate::lightning::ln::msgs::DecodeError on failure.
8975  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8976  */
8977 typedef struct LDKCResult_NodeAliasDecodeErrorZ {
8978    /**
8979     * The contents of this CResult_NodeAliasDecodeErrorZ, accessible via either
8980     * `err` or `result` depending on the state of `result_ok`.
8981     */
8982    union LDKCResult_NodeAliasDecodeErrorZPtr contents;
8983    /**
8984     * Whether this CResult_NodeAliasDecodeErrorZ represents a success state.
8985     */
8986    bool result_ok;
8987 } LDKCResult_NodeAliasDecodeErrorZ;
8988
8989
8990
8991 /**
8992  * Details about a node in the network, known from the network announcement.
8993  */
8994 typedef struct MUST_USE_STRUCT LDKNodeInfo {
8995    /**
8996     * A pointer to the opaque Rust object.
8997     * Nearly everywhere, inner must be non-null, however in places where
8998     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8999     */
9000    LDKnativeNodeInfo *inner;
9001    /**
9002     * Indicates that this is the only struct which contains the same pointer.
9003     * Rust functions which take ownership of an object provided via an argument require
9004     * this to be true and invalidate the object pointed to by inner.
9005     */
9006    bool is_owned;
9007 } LDKNodeInfo;
9008
9009 /**
9010  * The contents of CResult_NodeInfoDecodeErrorZ
9011  */
9012 typedef union LDKCResult_NodeInfoDecodeErrorZPtr {
9013    /**
9014     * A pointer to the contents in the success state.
9015     * Reading from this pointer when `result_ok` is not set is undefined.
9016     */
9017    struct LDKNodeInfo *result;
9018    /**
9019     * A pointer to the contents in the error state.
9020     * Reading from this pointer when `result_ok` is set is undefined.
9021     */
9022    struct LDKDecodeError *err;
9023 } LDKCResult_NodeInfoDecodeErrorZPtr;
9024
9025 /**
9026  * A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
9027  * containing a crate::lightning::routing::gossip::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
9028  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9029  */
9030 typedef struct LDKCResult_NodeInfoDecodeErrorZ {
9031    /**
9032     * The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
9033     * `err` or `result` depending on the state of `result_ok`.
9034     */
9035    union LDKCResult_NodeInfoDecodeErrorZPtr contents;
9036    /**
9037     * Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
9038     */
9039    bool result_ok;
9040 } LDKCResult_NodeInfoDecodeErrorZ;
9041
9042 /**
9043  * The contents of CResult_NetworkGraphDecodeErrorZ
9044  */
9045 typedef union LDKCResult_NetworkGraphDecodeErrorZPtr {
9046    /**
9047     * A pointer to the contents in the success state.
9048     * Reading from this pointer when `result_ok` is not set is undefined.
9049     */
9050    struct LDKNetworkGraph *result;
9051    /**
9052     * A pointer to the contents in the error state.
9053     * Reading from this pointer when `result_ok` is set is undefined.
9054     */
9055    struct LDKDecodeError *err;
9056 } LDKCResult_NetworkGraphDecodeErrorZPtr;
9057
9058 /**
9059  * A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
9060  * containing a crate::lightning::routing::gossip::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
9061  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9062  */
9063 typedef struct LDKCResult_NetworkGraphDecodeErrorZ {
9064    /**
9065     * The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
9066     * `err` or `result` depending on the state of `result_ok`.
9067     */
9068    union LDKCResult_NetworkGraphDecodeErrorZPtr contents;
9069    /**
9070     * Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
9071     */
9072    bool result_ok;
9073 } LDKCResult_NetworkGraphDecodeErrorZ;
9074
9075 /**
9076  * An enum which can either contain a crate::c_types::derived::CVec_SocketAddressZ or not
9077  */
9078 typedef enum LDKCOption_CVec_SocketAddressZZ_Tag {
9079    /**
9080     * When we're in this state, this COption_CVec_SocketAddressZZ contains a crate::c_types::derived::CVec_SocketAddressZ
9081     */
9082    LDKCOption_CVec_SocketAddressZZ_Some,
9083    /**
9084     * When we're in this state, this COption_CVec_SocketAddressZZ contains nothing
9085     */
9086    LDKCOption_CVec_SocketAddressZZ_None,
9087    /**
9088     * Must be last for serialization purposes
9089     */
9090    LDKCOption_CVec_SocketAddressZZ_Sentinel,
9091 } LDKCOption_CVec_SocketAddressZZ_Tag;
9092
9093 typedef struct LDKCOption_CVec_SocketAddressZZ {
9094    LDKCOption_CVec_SocketAddressZZ_Tag tag;
9095    union {
9096       struct {
9097          struct LDKCVec_SocketAddressZ some;
9098       };
9099    };
9100 } LDKCOption_CVec_SocketAddressZZ;
9101
9102 /**
9103  * The contents of CResult_u64ShortChannelIdErrorZ
9104  */
9105 typedef union LDKCResult_u64ShortChannelIdErrorZPtr {
9106    /**
9107     * A pointer to the contents in the success state.
9108     * Reading from this pointer when `result_ok` is not set is undefined.
9109     */
9110    uint64_t *result;
9111    /**
9112     * A pointer to the contents in the error state.
9113     * Reading from this pointer when `result_ok` is set is undefined.
9114     */
9115    enum LDKShortChannelIdError *err;
9116 } LDKCResult_u64ShortChannelIdErrorZPtr;
9117
9118 /**
9119  * A CResult_u64ShortChannelIdErrorZ represents the result of a fallible operation,
9120  * containing a u64 on success and a crate::lightning::util::scid_utils::ShortChannelIdError on failure.
9121  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9122  */
9123 typedef struct LDKCResult_u64ShortChannelIdErrorZ {
9124    /**
9125     * The contents of this CResult_u64ShortChannelIdErrorZ, accessible via either
9126     * `err` or `result` depending on the state of `result_ok`.
9127     */
9128    union LDKCResult_u64ShortChannelIdErrorZPtr contents;
9129    /**
9130     * Whether this CResult_u64ShortChannelIdErrorZ represents a success state.
9131     */
9132    bool result_ok;
9133 } LDKCResult_u64ShortChannelIdErrorZ;
9134
9135
9136
9137 /**
9138  * Information about an incoming HTLC, including the [`PendingHTLCRouting`] describing where it
9139  * should go next.
9140  */
9141 typedef struct MUST_USE_STRUCT LDKPendingHTLCInfo {
9142    /**
9143     * A pointer to the opaque Rust object.
9144     * Nearly everywhere, inner must be non-null, however in places where
9145     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9146     */
9147    LDKnativePendingHTLCInfo *inner;
9148    /**
9149     * Indicates that this is the only struct which contains the same pointer.
9150     * Rust functions which take ownership of an object provided via an argument require
9151     * this to be true and invalidate the object pointed to by inner.
9152     */
9153    bool is_owned;
9154 } LDKPendingHTLCInfo;
9155
9156
9157
9158 /**
9159  * Invalid inbound onion payment.
9160  */
9161 typedef struct MUST_USE_STRUCT LDKInboundHTLCErr {
9162    /**
9163     * A pointer to the opaque Rust object.
9164     * Nearly everywhere, inner must be non-null, however in places where
9165     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9166     */
9167    LDKnativeInboundHTLCErr *inner;
9168    /**
9169     * Indicates that this is the only struct which contains the same pointer.
9170     * Rust functions which take ownership of an object provided via an argument require
9171     * this to be true and invalidate the object pointed to by inner.
9172     */
9173    bool is_owned;
9174 } LDKInboundHTLCErr;
9175
9176 /**
9177  * The contents of CResult_PendingHTLCInfoInboundHTLCErrZ
9178  */
9179 typedef union LDKCResult_PendingHTLCInfoInboundHTLCErrZPtr {
9180    /**
9181     * A pointer to the contents in the success state.
9182     * Reading from this pointer when `result_ok` is not set is undefined.
9183     */
9184    struct LDKPendingHTLCInfo *result;
9185    /**
9186     * A pointer to the contents in the error state.
9187     * Reading from this pointer when `result_ok` is set is undefined.
9188     */
9189    struct LDKInboundHTLCErr *err;
9190 } LDKCResult_PendingHTLCInfoInboundHTLCErrZPtr;
9191
9192 /**
9193  * A CResult_PendingHTLCInfoInboundHTLCErrZ represents the result of a fallible operation,
9194  * containing a crate::lightning::ln::channelmanager::PendingHTLCInfo on success and a crate::lightning::ln::onion_payment::InboundHTLCErr on failure.
9195  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9196  */
9197 typedef struct LDKCResult_PendingHTLCInfoInboundHTLCErrZ {
9198    /**
9199     * The contents of this CResult_PendingHTLCInfoInboundHTLCErrZ, accessible via either
9200     * `err` or `result` depending on the state of `result_ok`.
9201     */
9202    union LDKCResult_PendingHTLCInfoInboundHTLCErrZPtr contents;
9203    /**
9204     * Whether this CResult_PendingHTLCInfoInboundHTLCErrZ represents a success state.
9205     */
9206    bool result_ok;
9207 } LDKCResult_PendingHTLCInfoInboundHTLCErrZ;
9208
9209 /**
9210  * A dynamically-allocated array of crate::lightning::ln::chan_utils::HTLCOutputInCommitments of arbitrary size.
9211  * This corresponds to std::vector in C++
9212  */
9213 typedef struct LDKCVec_HTLCOutputInCommitmentZ {
9214    /**
9215     * The elements in the array.
9216     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9217     */
9218    struct LDKHTLCOutputInCommitment *data;
9219    /**
9220     * The number of elements pointed to by `data`.
9221     */
9222    uintptr_t datalen;
9223 } LDKCVec_HTLCOutputInCommitmentZ;
9224
9225 /**
9226  * A dynamically-allocated array of crate::lightning::sign::HTLCDescriptors of arbitrary size.
9227  * This corresponds to std::vector in C++
9228  */
9229 typedef struct LDKCVec_HTLCDescriptorZ {
9230    /**
9231     * The elements in the array.
9232     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9233     */
9234    struct LDKHTLCDescriptor *data;
9235    /**
9236     * The number of elements pointed to by `data`.
9237     */
9238    uintptr_t datalen;
9239 } LDKCVec_HTLCDescriptorZ;
9240
9241
9242
9243 /**
9244  * An unspent transaction output that is available to spend resulting from a successful
9245  * [`CoinSelection`] attempt.
9246  */
9247 typedef struct MUST_USE_STRUCT LDKUtxo {
9248    /**
9249     * A pointer to the opaque Rust object.
9250     * Nearly everywhere, inner must be non-null, however in places where
9251     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9252     */
9253    LDKnativeUtxo *inner;
9254    /**
9255     * Indicates that this is the only struct which contains the same pointer.
9256     * Rust functions which take ownership of an object provided via an argument require
9257     * this to be true and invalidate the object pointed to by inner.
9258     */
9259    bool is_owned;
9260 } LDKUtxo;
9261
9262 /**
9263  * A dynamically-allocated array of crate::lightning::events::bump_transaction::Utxos of arbitrary size.
9264  * This corresponds to std::vector in C++
9265  */
9266 typedef struct LDKCVec_UtxoZ {
9267    /**
9268     * The elements in the array.
9269     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9270     */
9271    struct LDKUtxo *data;
9272    /**
9273     * The number of elements pointed to by `data`.
9274     */
9275    uintptr_t datalen;
9276 } LDKCVec_UtxoZ;
9277
9278 /**
9279  * An enum which can either contain a crate::c_types::TxOut or not
9280  */
9281 typedef enum LDKCOption_TxOutZ_Tag {
9282    /**
9283     * When we're in this state, this COption_TxOutZ contains a crate::c_types::TxOut
9284     */
9285    LDKCOption_TxOutZ_Some,
9286    /**
9287     * When we're in this state, this COption_TxOutZ contains nothing
9288     */
9289    LDKCOption_TxOutZ_None,
9290    /**
9291     * Must be last for serialization purposes
9292     */
9293    LDKCOption_TxOutZ_Sentinel,
9294 } LDKCOption_TxOutZ_Tag;
9295
9296 typedef struct LDKCOption_TxOutZ {
9297    LDKCOption_TxOutZ_Tag tag;
9298    union {
9299       struct {
9300          struct LDKTxOut some;
9301       };
9302    };
9303 } LDKCOption_TxOutZ;
9304
9305
9306
9307 /**
9308  * An input that must be included in a transaction when performing coin selection through
9309  * [`CoinSelectionSource::select_confirmed_utxos`]. It is guaranteed to be a SegWit input, so it
9310  * must have an empty [`TxIn::script_sig`] when spent.
9311  */
9312 typedef struct MUST_USE_STRUCT LDKInput {
9313    /**
9314     * A pointer to the opaque Rust object.
9315     * Nearly everywhere, inner must be non-null, however in places where
9316     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9317     */
9318    LDKnativeInput *inner;
9319    /**
9320     * Indicates that this is the only struct which contains the same pointer.
9321     * Rust functions which take ownership of an object provided via an argument require
9322     * this to be true and invalidate the object pointed to by inner.
9323     */
9324    bool is_owned;
9325 } LDKInput;
9326
9327 /**
9328  * A dynamically-allocated array of crate::lightning::events::bump_transaction::Inputs of arbitrary size.
9329  * This corresponds to std::vector in C++
9330  */
9331 typedef struct LDKCVec_InputZ {
9332    /**
9333     * The elements in the array.
9334     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9335     */
9336    struct LDKInput *data;
9337    /**
9338     * The number of elements pointed to by `data`.
9339     */
9340    uintptr_t datalen;
9341 } LDKCVec_InputZ;
9342
9343
9344
9345 /**
9346  * The result of a successful coin selection attempt for a transaction requiring additional UTXOs
9347  * to cover its fees.
9348  */
9349 typedef struct MUST_USE_STRUCT LDKCoinSelection {
9350    /**
9351     * A pointer to the opaque Rust object.
9352     * Nearly everywhere, inner must be non-null, however in places where
9353     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9354     */
9355    LDKnativeCoinSelection *inner;
9356    /**
9357     * Indicates that this is the only struct which contains the same pointer.
9358     * Rust functions which take ownership of an object provided via an argument require
9359     * this to be true and invalidate the object pointed to by inner.
9360     */
9361    bool is_owned;
9362 } LDKCoinSelection;
9363
9364 /**
9365  * The contents of CResult_CoinSelectionNoneZ
9366  */
9367 typedef union LDKCResult_CoinSelectionNoneZPtr {
9368    /**
9369     * A pointer to the contents in the success state.
9370     * Reading from this pointer when `result_ok` is not set is undefined.
9371     */
9372    struct LDKCoinSelection *result;
9373    /**
9374     * Note that this value is always NULL, as there are no contents in the Err variant
9375     */
9376    void *err;
9377 } LDKCResult_CoinSelectionNoneZPtr;
9378
9379 /**
9380  * A CResult_CoinSelectionNoneZ represents the result of a fallible operation,
9381  * containing a crate::lightning::events::bump_transaction::CoinSelection on success and a () on failure.
9382  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9383  */
9384 typedef struct LDKCResult_CoinSelectionNoneZ {
9385    /**
9386     * The contents of this CResult_CoinSelectionNoneZ, accessible via either
9387     * `err` or `result` depending on the state of `result_ok`.
9388     */
9389    union LDKCResult_CoinSelectionNoneZPtr contents;
9390    /**
9391     * Whether this CResult_CoinSelectionNoneZ represents a success state.
9392     */
9393    bool result_ok;
9394 } LDKCResult_CoinSelectionNoneZ;
9395
9396 /**
9397  * The contents of CResult_CVec_UtxoZNoneZ
9398  */
9399 typedef union LDKCResult_CVec_UtxoZNoneZPtr {
9400    /**
9401     * A pointer to the contents in the success state.
9402     * Reading from this pointer when `result_ok` is not set is undefined.
9403     */
9404    struct LDKCVec_UtxoZ *result;
9405    /**
9406     * Note that this value is always NULL, as there are no contents in the Err variant
9407     */
9408    void *err;
9409 } LDKCResult_CVec_UtxoZNoneZPtr;
9410
9411 /**
9412  * A CResult_CVec_UtxoZNoneZ represents the result of a fallible operation,
9413  * containing a crate::c_types::derived::CVec_UtxoZ on success and a () on failure.
9414  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9415  */
9416 typedef struct LDKCResult_CVec_UtxoZNoneZ {
9417    /**
9418     * The contents of this CResult_CVec_UtxoZNoneZ, accessible via either
9419     * `err` or `result` depending on the state of `result_ok`.
9420     */
9421    union LDKCResult_CVec_UtxoZNoneZPtr contents;
9422    /**
9423     * Whether this CResult_CVec_UtxoZNoneZ represents a success state.
9424     */
9425    bool result_ok;
9426 } LDKCResult_CVec_UtxoZNoneZ;
9427
9428
9429
9430 /**
9431  * An unknown payment context.
9432  */
9433 typedef struct MUST_USE_STRUCT LDKUnknownPaymentContext {
9434    /**
9435     * A pointer to the opaque Rust object.
9436     * Nearly everywhere, inner must be non-null, however in places where
9437     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9438     */
9439    LDKnativeUnknownPaymentContext *inner;
9440    /**
9441     * Indicates that this is the only struct which contains the same pointer.
9442     * Rust functions which take ownership of an object provided via an argument require
9443     * this to be true and invalidate the object pointed to by inner.
9444     */
9445    bool is_owned;
9446 } LDKUnknownPaymentContext;
9447
9448
9449
9450 /**
9451  * The context of a payment made for an invoice requested from a BOLT 12 [`Offer`].
9452  *
9453  * [`Offer`]: crate::offers::offer::Offer
9454  */
9455 typedef struct MUST_USE_STRUCT LDKBolt12OfferContext {
9456    /**
9457     * A pointer to the opaque Rust object.
9458     * Nearly everywhere, inner must be non-null, however in places where
9459     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9460     */
9461    LDKnativeBolt12OfferContext *inner;
9462    /**
9463     * Indicates that this is the only struct which contains the same pointer.
9464     * Rust functions which take ownership of an object provided via an argument require
9465     * this to be true and invalidate the object pointed to by inner.
9466     */
9467    bool is_owned;
9468 } LDKBolt12OfferContext;
9469
9470
9471
9472 /**
9473  * The context of a payment made for an invoice sent for a BOLT 12 [`Refund`].
9474  *
9475  * [`Refund`]: crate::offers::refund::Refund
9476  */
9477 typedef struct MUST_USE_STRUCT LDKBolt12RefundContext {
9478    /**
9479     * A pointer to the opaque Rust object.
9480     * Nearly everywhere, inner must be non-null, however in places where
9481     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9482     */
9483    LDKnativeBolt12RefundContext *inner;
9484    /**
9485     * Indicates that this is the only struct which contains the same pointer.
9486     * Rust functions which take ownership of an object provided via an argument require
9487     * this to be true and invalidate the object pointed to by inner.
9488     */
9489    bool is_owned;
9490 } LDKBolt12RefundContext;
9491
9492 /**
9493  * The context of an inbound payment, which is included in a [`BlindedPath`] via [`ReceiveTlvs`]
9494  * and surfaced in [`PaymentPurpose`].
9495  *
9496  * [`BlindedPath`]: crate::blinded_path::BlindedPath
9497  * [`PaymentPurpose`]: crate::events::PaymentPurpose
9498  */
9499 typedef enum LDKPaymentContext_Tag {
9500    /**
9501     * The payment context was unknown.
9502     */
9503    LDKPaymentContext_Unknown,
9504    /**
9505     * The payment was made for an invoice requested from a BOLT 12 [`Offer`].
9506     *
9507     * [`Offer`]: crate::offers::offer::Offer
9508     */
9509    LDKPaymentContext_Bolt12Offer,
9510    /**
9511     * The payment was made for an invoice sent for a BOLT 12 [`Refund`].
9512     *
9513     * [`Refund`]: crate::offers::refund::Refund
9514     */
9515    LDKPaymentContext_Bolt12Refund,
9516    /**
9517     * Must be last for serialization purposes
9518     */
9519    LDKPaymentContext_Sentinel,
9520 } LDKPaymentContext_Tag;
9521
9522 typedef struct MUST_USE_STRUCT LDKPaymentContext {
9523    LDKPaymentContext_Tag tag;
9524    union {
9525       struct {
9526          struct LDKUnknownPaymentContext unknown;
9527       };
9528       struct {
9529          struct LDKBolt12OfferContext bolt12_offer;
9530       };
9531       struct {
9532          struct LDKBolt12RefundContext bolt12_refund;
9533       };
9534    };
9535 } LDKPaymentContext;
9536
9537 /**
9538  * An enum which can either contain a crate::lightning::blinded_path::payment::PaymentContext or not
9539  */
9540 typedef enum LDKCOption_PaymentContextZ_Tag {
9541    /**
9542     * When we're in this state, this COption_PaymentContextZ contains a crate::lightning::blinded_path::payment::PaymentContext
9543     */
9544    LDKCOption_PaymentContextZ_Some,
9545    /**
9546     * When we're in this state, this COption_PaymentContextZ contains nothing
9547     */
9548    LDKCOption_PaymentContextZ_None,
9549    /**
9550     * Must be last for serialization purposes
9551     */
9552    LDKCOption_PaymentContextZ_Sentinel,
9553 } LDKCOption_PaymentContextZ_Tag;
9554
9555 typedef struct LDKCOption_PaymentContextZ {
9556    LDKCOption_PaymentContextZ_Tag tag;
9557    union {
9558       struct {
9559          struct LDKPaymentContext some;
9560       };
9561    };
9562 } LDKCOption_PaymentContextZ;
9563
9564 /**
9565  * A tuple of 2 elements. See the individual fields for the types contained.
9566  */
9567 typedef struct LDKC2Tuple_u64u16Z {
9568    /**
9569     * The element at position 0
9570     */
9571    uint64_t a;
9572    /**
9573     * The element at position 1
9574     */
9575    uint16_t b;
9576 } LDKC2Tuple_u64u16Z;
9577
9578 /**
9579  * An enum which can either contain a crate::c_types::derived::C2Tuple_u64u16Z or not
9580  */
9581 typedef enum LDKCOption_C2Tuple_u64u16ZZ_Tag {
9582    /**
9583     * When we're in this state, this COption_C2Tuple_u64u16ZZ contains a crate::c_types::derived::C2Tuple_u64u16Z
9584     */
9585    LDKCOption_C2Tuple_u64u16ZZ_Some,
9586    /**
9587     * When we're in this state, this COption_C2Tuple_u64u16ZZ contains nothing
9588     */
9589    LDKCOption_C2Tuple_u64u16ZZ_None,
9590    /**
9591     * Must be last for serialization purposes
9592     */
9593    LDKCOption_C2Tuple_u64u16ZZ_Sentinel,
9594 } LDKCOption_C2Tuple_u64u16ZZ_Tag;
9595
9596 typedef struct LDKCOption_C2Tuple_u64u16ZZ {
9597    LDKCOption_C2Tuple_u64u16ZZ_Tag tag;
9598    union {
9599       struct {
9600          struct LDKC2Tuple_u64u16Z some;
9601       };
9602    };
9603 } LDKCOption_C2Tuple_u64u16ZZ;
9604
9605 /**
9606  * An enum which can either contain a crate::lightning::ln::channelmanager::ChannelShutdownState or not
9607  */
9608 typedef enum LDKCOption_ChannelShutdownStateZ_Tag {
9609    /**
9610     * When we're in this state, this COption_ChannelShutdownStateZ contains a crate::lightning::ln::channelmanager::ChannelShutdownState
9611     */
9612    LDKCOption_ChannelShutdownStateZ_Some,
9613    /**
9614     * When we're in this state, this COption_ChannelShutdownStateZ contains nothing
9615     */
9616    LDKCOption_ChannelShutdownStateZ_None,
9617    /**
9618     * Must be last for serialization purposes
9619     */
9620    LDKCOption_ChannelShutdownStateZ_Sentinel,
9621 } LDKCOption_ChannelShutdownStateZ_Tag;
9622
9623 typedef struct LDKCOption_ChannelShutdownStateZ {
9624    LDKCOption_ChannelShutdownStateZ_Tag tag;
9625    union {
9626       struct {
9627          enum LDKChannelShutdownState some;
9628       };
9629    };
9630 } LDKCOption_ChannelShutdownStateZ;
9631
9632 /**
9633  * The contents of CResult_ChannelIdAPIErrorZ
9634  */
9635 typedef union LDKCResult_ChannelIdAPIErrorZPtr {
9636    /**
9637     * A pointer to the contents in the success state.
9638     * Reading from this pointer when `result_ok` is not set is undefined.
9639     */
9640    struct LDKChannelId *result;
9641    /**
9642     * A pointer to the contents in the error state.
9643     * Reading from this pointer when `result_ok` is set is undefined.
9644     */
9645    struct LDKAPIError *err;
9646 } LDKCResult_ChannelIdAPIErrorZPtr;
9647
9648 /**
9649  * A CResult_ChannelIdAPIErrorZ represents the result of a fallible operation,
9650  * containing a crate::lightning::ln::types::ChannelId on success and a crate::lightning::util::errors::APIError on failure.
9651  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9652  */
9653 typedef struct LDKCResult_ChannelIdAPIErrorZ {
9654    /**
9655     * The contents of this CResult_ChannelIdAPIErrorZ, accessible via either
9656     * `err` or `result` depending on the state of `result_ok`.
9657     */
9658    union LDKCResult_ChannelIdAPIErrorZPtr contents;
9659    /**
9660     * Whether this CResult_ChannelIdAPIErrorZ represents a success state.
9661     */
9662    bool result_ok;
9663 } LDKCResult_ChannelIdAPIErrorZ;
9664
9665 /**
9666  * Used by [`ChannelManager::list_recent_payments`] to express the status of recent payments.
9667  * These include payments that have yet to find a successful path, or have unresolved HTLCs.
9668  */
9669 typedef enum LDKRecentPaymentDetails_Tag {
9670    /**
9671     * When an invoice was requested and thus a payment has not yet been sent.
9672     */
9673    LDKRecentPaymentDetails_AwaitingInvoice,
9674    /**
9675     * When a payment is still being sent and awaiting successful delivery.
9676     */
9677    LDKRecentPaymentDetails_Pending,
9678    /**
9679     * When a pending payment is fulfilled, we continue tracking it until all pending HTLCs have
9680     * been resolved. Upon receiving [`Event::PaymentSent`], we delay for a few minutes before the
9681     * payment is removed from tracking.
9682     */
9683    LDKRecentPaymentDetails_Fulfilled,
9684    /**
9685     * After a payment's retries are exhausted per the provided [`Retry`], or it is explicitly
9686     * abandoned via [`ChannelManager::abandon_payment`], it is marked as abandoned until all
9687     * pending HTLCs for this payment resolve and an [`Event::PaymentFailed`] is generated.
9688     */
9689    LDKRecentPaymentDetails_Abandoned,
9690    /**
9691     * Must be last for serialization purposes
9692     */
9693    LDKRecentPaymentDetails_Sentinel,
9694 } LDKRecentPaymentDetails_Tag;
9695
9696 typedef struct LDKRecentPaymentDetails_LDKAwaitingInvoice_Body {
9697    /**
9698     * A user-provided identifier in [`ChannelManager::send_payment`] used to uniquely identify
9699     * a payment and ensure idempotency in LDK.
9700     */
9701    struct LDKThirtyTwoBytes payment_id;
9702 } LDKRecentPaymentDetails_LDKAwaitingInvoice_Body;
9703
9704 typedef struct LDKRecentPaymentDetails_LDKPending_Body {
9705    /**
9706     * A user-provided identifier in [`ChannelManager::send_payment`] used to uniquely identify
9707     * a payment and ensure idempotency in LDK.
9708     */
9709    struct LDKThirtyTwoBytes payment_id;
9710    /**
9711     * Hash of the payment that is currently being sent but has yet to be fulfilled or
9712     * abandoned.
9713     */
9714    struct LDKThirtyTwoBytes payment_hash;
9715    /**
9716     * Total amount (in msat, excluding fees) across all paths for this payment,
9717     * not just the amount currently inflight.
9718     */
9719    uint64_t total_msat;
9720 } LDKRecentPaymentDetails_LDKPending_Body;
9721
9722 typedef struct LDKRecentPaymentDetails_LDKFulfilled_Body {
9723    /**
9724     * A user-provided identifier in [`ChannelManager::send_payment`] used to uniquely identify
9725     * a payment and ensure idempotency in LDK.
9726     */
9727    struct LDKThirtyTwoBytes payment_id;
9728    /**
9729     * Hash of the payment that was claimed. `None` for serializations of [`ChannelManager`]
9730     * made before LDK version 0.0.104.
9731     */
9732    struct LDKCOption_ThirtyTwoBytesZ payment_hash;
9733 } LDKRecentPaymentDetails_LDKFulfilled_Body;
9734
9735 typedef struct LDKRecentPaymentDetails_LDKAbandoned_Body {
9736    /**
9737     * A user-provided identifier in [`ChannelManager::send_payment`] used to uniquely identify
9738     * a payment and ensure idempotency in LDK.
9739     */
9740    struct LDKThirtyTwoBytes payment_id;
9741    /**
9742     * Hash of the payment that we have given up trying to send.
9743     */
9744    struct LDKThirtyTwoBytes payment_hash;
9745 } LDKRecentPaymentDetails_LDKAbandoned_Body;
9746
9747 typedef struct MUST_USE_STRUCT LDKRecentPaymentDetails {
9748    LDKRecentPaymentDetails_Tag tag;
9749    union {
9750       LDKRecentPaymentDetails_LDKAwaitingInvoice_Body awaiting_invoice;
9751       LDKRecentPaymentDetails_LDKPending_Body pending;
9752       LDKRecentPaymentDetails_LDKFulfilled_Body fulfilled;
9753       LDKRecentPaymentDetails_LDKAbandoned_Body abandoned;
9754    };
9755 } LDKRecentPaymentDetails;
9756
9757 /**
9758  * A dynamically-allocated array of crate::lightning::ln::channelmanager::RecentPaymentDetailss of arbitrary size.
9759  * This corresponds to std::vector in C++
9760  */
9761 typedef struct LDKCVec_RecentPaymentDetailsZ {
9762    /**
9763     * The elements in the array.
9764     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9765     */
9766    struct LDKRecentPaymentDetails *data;
9767    /**
9768     * The number of elements pointed to by `data`.
9769     */
9770    uintptr_t datalen;
9771 } LDKCVec_RecentPaymentDetailsZ;
9772
9773 /**
9774  * If a payment fails to send with [`ChannelManager::send_payment_with_route`], it can be in one
9775  * of several states. This enum is returned as the Err() type describing which state the payment
9776  * is in, see the description of individual enum states for more.
9777  *
9778  * [`ChannelManager::send_payment_with_route`]: crate::ln::channelmanager::ChannelManager::send_payment_with_route
9779  */
9780 typedef enum LDKPaymentSendFailure_Tag {
9781    /**
9782     * A parameter which was passed to send_payment was invalid, preventing us from attempting to
9783     * send the payment at all.
9784     *
9785     * You can freely resend the payment in full (with the parameter error fixed).
9786     *
9787     * Because the payment failed outright, no payment tracking is done and no
9788     * [`Event::PaymentPathFailed`] or [`Event::PaymentFailed`] events will be generated.
9789     *
9790     * [`Event::PaymentPathFailed`]: crate::events::Event::PaymentPathFailed
9791     * [`Event::PaymentFailed`]: crate::events::Event::PaymentFailed
9792     */
9793    LDKPaymentSendFailure_ParameterError,
9794    /**
9795     * A parameter in a single path which was passed to send_payment was invalid, preventing us
9796     * from attempting to send the payment at all.
9797     *
9798     * You can freely resend the payment in full (with the parameter error fixed).
9799     *
9800     * Because the payment failed outright, no payment tracking is done and no
9801     * [`Event::PaymentPathFailed`] or [`Event::PaymentFailed`] events will be generated.
9802     *
9803     * The results here are ordered the same as the paths in the route object which was passed to
9804     * send_payment.
9805     *
9806     * [`Event::PaymentPathFailed`]: crate::events::Event::PaymentPathFailed
9807     * [`Event::PaymentFailed`]: crate::events::Event::PaymentFailed
9808     */
9809    LDKPaymentSendFailure_PathParameterError,
9810    /**
9811     * All paths which were attempted failed to send, with no channel state change taking place.
9812     * You can freely resend the payment in full (though you probably want to do so over different
9813     * paths than the ones selected).
9814     *
9815     * Because the payment failed outright, no payment tracking is done and no
9816     * [`Event::PaymentPathFailed`] or [`Event::PaymentFailed`] events will be generated.
9817     *
9818     * [`Event::PaymentPathFailed`]: crate::events::Event::PaymentPathFailed
9819     * [`Event::PaymentFailed`]: crate::events::Event::PaymentFailed
9820     */
9821    LDKPaymentSendFailure_AllFailedResendSafe,
9822    /**
9823     * Indicates that a payment for the provided [`PaymentId`] is already in-flight and has not
9824     * yet completed (i.e. generated an [`Event::PaymentSent`] or [`Event::PaymentFailed`]).
9825     *
9826     * [`PaymentId`]: crate::ln::channelmanager::PaymentId
9827     * [`Event::PaymentSent`]: crate::events::Event::PaymentSent
9828     * [`Event::PaymentFailed`]: crate::events::Event::PaymentFailed
9829     */
9830    LDKPaymentSendFailure_DuplicatePayment,
9831    /**
9832     * Some paths that were attempted failed to send, though some paths may have succeeded. At least
9833     * some paths have irrevocably committed to the HTLC.
9834     *
9835     * The results here are ordered the same as the paths in the route object that was passed to
9836     * send_payment.
9837     *
9838     * Any entries that contain `Err(APIError::MonitorUpdateInprogress)` will send once a
9839     * [`MonitorEvent::Completed`] is provided for the next-hop channel with the latest update_id.
9840     *
9841     * [`MonitorEvent::Completed`]: crate::chain::channelmonitor::MonitorEvent::Completed
9842     */
9843    LDKPaymentSendFailure_PartialFailure,
9844    /**
9845     * Must be last for serialization purposes
9846     */
9847    LDKPaymentSendFailure_Sentinel,
9848 } LDKPaymentSendFailure_Tag;
9849
9850 typedef struct LDKPaymentSendFailure_LDKPartialFailure_Body {
9851    /**
9852     * The errors themselves, in the same order as the paths from the route.
9853     */
9854    struct LDKCVec_CResult_NoneAPIErrorZZ results;
9855    /**
9856     * If some paths failed without irrevocably committing to the new HTLC(s), this will
9857     * contain a [`RouteParameters`] object for the failing paths.
9858     *
9859     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
9860     */
9861    struct LDKRouteParameters failed_paths_retry;
9862    /**
9863     * The payment id for the payment, which is now at least partially pending.
9864     */
9865    struct LDKThirtyTwoBytes payment_id;
9866 } LDKPaymentSendFailure_LDKPartialFailure_Body;
9867
9868 typedef struct MUST_USE_STRUCT LDKPaymentSendFailure {
9869    LDKPaymentSendFailure_Tag tag;
9870    union {
9871       struct {
9872          struct LDKAPIError parameter_error;
9873       };
9874       struct {
9875          struct LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error;
9876       };
9877       struct {
9878          struct LDKCVec_APIErrorZ all_failed_resend_safe;
9879       };
9880       LDKPaymentSendFailure_LDKPartialFailure_Body partial_failure;
9881    };
9882 } LDKPaymentSendFailure;
9883
9884 /**
9885  * The contents of CResult_NonePaymentSendFailureZ
9886  */
9887 typedef union LDKCResult_NonePaymentSendFailureZPtr {
9888    /**
9889     * Note that this value is always NULL, as there are no contents in the OK variant
9890     */
9891    void *result;
9892    /**
9893     * A pointer to the contents in the error state.
9894     * Reading from this pointer when `result_ok` is set is undefined.
9895     */
9896    struct LDKPaymentSendFailure *err;
9897 } LDKCResult_NonePaymentSendFailureZPtr;
9898
9899 /**
9900  * A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
9901  * containing a () on success and a crate::lightning::ln::outbound_payment::PaymentSendFailure on failure.
9902  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9903  */
9904 typedef struct LDKCResult_NonePaymentSendFailureZ {
9905    /**
9906     * The contents of this CResult_NonePaymentSendFailureZ, accessible via either
9907     * `err` or `result` depending on the state of `result_ok`.
9908     */
9909    union LDKCResult_NonePaymentSendFailureZPtr contents;
9910    /**
9911     * Whether this CResult_NonePaymentSendFailureZ represents a success state.
9912     */
9913    bool result_ok;
9914 } LDKCResult_NonePaymentSendFailureZ;
9915
9916 /**
9917  * The contents of CResult_NoneRetryableSendFailureZ
9918  */
9919 typedef union LDKCResult_NoneRetryableSendFailureZPtr {
9920    /**
9921     * Note that this value is always NULL, as there are no contents in the OK variant
9922     */
9923    void *result;
9924    /**
9925     * A pointer to the contents in the error state.
9926     * Reading from this pointer when `result_ok` is set is undefined.
9927     */
9928    enum LDKRetryableSendFailure *err;
9929 } LDKCResult_NoneRetryableSendFailureZPtr;
9930
9931 /**
9932  * A CResult_NoneRetryableSendFailureZ represents the result of a fallible operation,
9933  * containing a () on success and a crate::lightning::ln::outbound_payment::RetryableSendFailure on failure.
9934  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9935  */
9936 typedef struct LDKCResult_NoneRetryableSendFailureZ {
9937    /**
9938     * The contents of this CResult_NoneRetryableSendFailureZ, accessible via either
9939     * `err` or `result` depending on the state of `result_ok`.
9940     */
9941    union LDKCResult_NoneRetryableSendFailureZPtr contents;
9942    /**
9943     * Whether this CResult_NoneRetryableSendFailureZ represents a success state.
9944     */
9945    bool result_ok;
9946 } LDKCResult_NoneRetryableSendFailureZ;
9947
9948 /**
9949  * The contents of CResult_ThirtyTwoBytesPaymentSendFailureZ
9950  */
9951 typedef union LDKCResult_ThirtyTwoBytesPaymentSendFailureZPtr {
9952    /**
9953     * A pointer to the contents in the success state.
9954     * Reading from this pointer when `result_ok` is not set is undefined.
9955     */
9956    struct LDKThirtyTwoBytes *result;
9957    /**
9958     * A pointer to the contents in the error state.
9959     * Reading from this pointer when `result_ok` is set is undefined.
9960     */
9961    struct LDKPaymentSendFailure *err;
9962 } LDKCResult_ThirtyTwoBytesPaymentSendFailureZPtr;
9963
9964 /**
9965  * A CResult_ThirtyTwoBytesPaymentSendFailureZ represents the result of a fallible operation,
9966  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::outbound_payment::PaymentSendFailure on failure.
9967  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9968  */
9969 typedef struct LDKCResult_ThirtyTwoBytesPaymentSendFailureZ {
9970    /**
9971     * The contents of this CResult_ThirtyTwoBytesPaymentSendFailureZ, accessible via either
9972     * `err` or `result` depending on the state of `result_ok`.
9973     */
9974    union LDKCResult_ThirtyTwoBytesPaymentSendFailureZPtr contents;
9975    /**
9976     * Whether this CResult_ThirtyTwoBytesPaymentSendFailureZ represents a success state.
9977     */
9978    bool result_ok;
9979 } LDKCResult_ThirtyTwoBytesPaymentSendFailureZ;
9980
9981 /**
9982  * The contents of CResult_ThirtyTwoBytesRetryableSendFailureZ
9983  */
9984 typedef union LDKCResult_ThirtyTwoBytesRetryableSendFailureZPtr {
9985    /**
9986     * A pointer to the contents in the success state.
9987     * Reading from this pointer when `result_ok` is not set is undefined.
9988     */
9989    struct LDKThirtyTwoBytes *result;
9990    /**
9991     * A pointer to the contents in the error state.
9992     * Reading from this pointer when `result_ok` is set is undefined.
9993     */
9994    enum LDKRetryableSendFailure *err;
9995 } LDKCResult_ThirtyTwoBytesRetryableSendFailureZPtr;
9996
9997 /**
9998  * A CResult_ThirtyTwoBytesRetryableSendFailureZ represents the result of a fallible operation,
9999  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::outbound_payment::RetryableSendFailure on failure.
10000  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10001  */
10002 typedef struct LDKCResult_ThirtyTwoBytesRetryableSendFailureZ {
10003    /**
10004     * The contents of this CResult_ThirtyTwoBytesRetryableSendFailureZ, accessible via either
10005     * `err` or `result` depending on the state of `result_ok`.
10006     */
10007    union LDKCResult_ThirtyTwoBytesRetryableSendFailureZPtr contents;
10008    /**
10009     * Whether this CResult_ThirtyTwoBytesRetryableSendFailureZ represents a success state.
10010     */
10011    bool result_ok;
10012 } LDKCResult_ThirtyTwoBytesRetryableSendFailureZ;
10013
10014 /**
10015  * A tuple of 2 elements. See the individual fields for the types contained.
10016  */
10017 typedef struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ {
10018    /**
10019     * The element at position 0
10020     */
10021    struct LDKThirtyTwoBytes a;
10022    /**
10023     * The element at position 1
10024     */
10025    struct LDKThirtyTwoBytes b;
10026 } LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ;
10027
10028 /**
10029  * The contents of CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ
10030  */
10031 typedef union LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr {
10032    /**
10033     * A pointer to the contents in the success state.
10034     * Reading from this pointer when `result_ok` is not set is undefined.
10035     */
10036    struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ *result;
10037    /**
10038     * A pointer to the contents in the error state.
10039     * Reading from this pointer when `result_ok` is set is undefined.
10040     */
10041    struct LDKPaymentSendFailure *err;
10042 } LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr;
10043
10044 /**
10045  * A CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ represents the result of a fallible operation,
10046  * containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ on success and a crate::lightning::ln::outbound_payment::PaymentSendFailure on failure.
10047  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10048  */
10049 typedef struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ {
10050    /**
10051     * The contents of this CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ, accessible via either
10052     * `err` or `result` depending on the state of `result_ok`.
10053     */
10054    union LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr contents;
10055    /**
10056     * Whether this CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ represents a success state.
10057     */
10058    bool result_ok;
10059 } LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ;
10060
10061 /**
10062  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZs of arbitrary size.
10063  * This corresponds to std::vector in C++
10064  */
10065 typedef struct LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ {
10066    /**
10067     * The elements in the array.
10068     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10069     */
10070    struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ *data;
10071    /**
10072     * The number of elements pointed to by `data`.
10073     */
10074    uintptr_t datalen;
10075 } LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ;
10076
10077 /**
10078  * Indicates that we failed to send a payment probe. Further errors may be surfaced later via
10079  * [`Event::ProbeFailed`].
10080  *
10081  * [`Event::ProbeFailed`]: crate::events::Event::ProbeFailed
10082  */
10083 typedef enum LDKProbeSendFailure_Tag {
10084    /**
10085     * We were unable to find a route to the destination.
10086     */
10087    LDKProbeSendFailure_RouteNotFound,
10088    /**
10089     * We failed to send the payment probes.
10090     */
10091    LDKProbeSendFailure_SendingFailed,
10092    /**
10093     * Must be last for serialization purposes
10094     */
10095    LDKProbeSendFailure_Sentinel,
10096 } LDKProbeSendFailure_Tag;
10097
10098 typedef struct MUST_USE_STRUCT LDKProbeSendFailure {
10099    LDKProbeSendFailure_Tag tag;
10100    union {
10101       struct {
10102          struct LDKPaymentSendFailure sending_failed;
10103       };
10104    };
10105 } LDKProbeSendFailure;
10106
10107 /**
10108  * The contents of CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ
10109  */
10110 typedef union LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr {
10111    /**
10112     * A pointer to the contents in the success state.
10113     * Reading from this pointer when `result_ok` is not set is undefined.
10114     */
10115    struct LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ *result;
10116    /**
10117     * A pointer to the contents in the error state.
10118     * Reading from this pointer when `result_ok` is set is undefined.
10119     */
10120    struct LDKProbeSendFailure *err;
10121 } LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr;
10122
10123 /**
10124  * A CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ represents the result of a fallible operation,
10125  * containing a crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ on success and a crate::lightning::ln::outbound_payment::ProbeSendFailure on failure.
10126  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10127  */
10128 typedef struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ {
10129    /**
10130     * The contents of this CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ, accessible via either
10131     * `err` or `result` depending on the state of `result_ok`.
10132     */
10133    union LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr contents;
10134    /**
10135     * Whether this CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ represents a success state.
10136     */
10137    bool result_ok;
10138 } LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ;
10139
10140 /**
10141  * A tuple of 2 elements. See the individual fields for the types contained.
10142  */
10143 typedef struct LDKC2Tuple_ChannelIdPublicKeyZ {
10144    /**
10145     * The element at position 0
10146     */
10147    struct LDKChannelId a;
10148    /**
10149     * The element at position 1
10150     */
10151    struct LDKPublicKey b;
10152 } LDKC2Tuple_ChannelIdPublicKeyZ;
10153
10154 /**
10155  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_ChannelIdPublicKeyZs of arbitrary size.
10156  * This corresponds to std::vector in C++
10157  */
10158 typedef struct LDKCVec_C2Tuple_ChannelIdPublicKeyZZ {
10159    /**
10160     * The elements in the array.
10161     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10162     */
10163    struct LDKC2Tuple_ChannelIdPublicKeyZ *data;
10164    /**
10165     * The number of elements pointed to by `data`.
10166     */
10167    uintptr_t datalen;
10168 } LDKCVec_C2Tuple_ChannelIdPublicKeyZZ;
10169
10170 /**
10171  * A dynamically-allocated array of crate::lightning::ln::types::ChannelIds of arbitrary size.
10172  * This corresponds to std::vector in C++
10173  */
10174 typedef struct LDKCVec_ChannelIdZ {
10175    /**
10176     * The elements in the array.
10177     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10178     */
10179    struct LDKChannelId *data;
10180    /**
10181     * The number of elements pointed to by `data`.
10182     */
10183    uintptr_t datalen;
10184 } LDKCVec_ChannelIdZ;
10185
10186
10187
10188 /**
10189  * Builds an [`Offer`] for the \"offer to be paid\" flow.
10190  *
10191  * See [module-level documentation] for usage.
10192  *
10193  * [module-level documentation]: self
10194  */
10195 typedef struct MUST_USE_STRUCT LDKOfferWithDerivedMetadataBuilder {
10196    /**
10197     * A pointer to the opaque Rust object.
10198     * Nearly everywhere, inner must be non-null, however in places where
10199     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10200     */
10201    LDKnativeOfferWithDerivedMetadataBuilder *inner;
10202    /**
10203     * Indicates that this is the only struct which contains the same pointer.
10204     * Rust functions which take ownership of an object provided via an argument require
10205     * this to be true and invalidate the object pointed to by inner.
10206     */
10207    bool is_owned;
10208 } LDKOfferWithDerivedMetadataBuilder;
10209
10210 /**
10211  * The contents of CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ
10212  */
10213 typedef union LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZPtr {
10214    /**
10215     * A pointer to the contents in the success state.
10216     * Reading from this pointer when `result_ok` is not set is undefined.
10217     */
10218    struct LDKOfferWithDerivedMetadataBuilder *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    enum LDKBolt12SemanticError *err;
10224 } LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZPtr;
10225
10226 /**
10227  * A CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ represents the result of a fallible operation,
10228  * containing a crate::lightning::offers::offer::OfferWithDerivedMetadataBuilder on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure.
10229  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10230  */
10231 typedef struct LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ {
10232    /**
10233     * The contents of this CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ, accessible via either
10234     * `err` or `result` depending on the state of `result_ok`.
10235     */
10236    union LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZPtr contents;
10237    /**
10238     * Whether this CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ represents a success state.
10239     */
10240    bool result_ok;
10241 } LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ;
10242
10243 /**
10244  * An enum which can either contain a crate::c_types::Str or not
10245  */
10246 typedef enum LDKCOption_StrZ_Tag {
10247    /**
10248     * When we're in this state, this COption_StrZ contains a crate::c_types::Str
10249     */
10250    LDKCOption_StrZ_Some,
10251    /**
10252     * When we're in this state, this COption_StrZ contains nothing
10253     */
10254    LDKCOption_StrZ_None,
10255    /**
10256     * Must be last for serialization purposes
10257     */
10258    LDKCOption_StrZ_Sentinel,
10259 } LDKCOption_StrZ_Tag;
10260
10261 typedef struct LDKCOption_StrZ {
10262    LDKCOption_StrZ_Tag tag;
10263    union {
10264       struct {
10265          struct LDKStr some;
10266       };
10267    };
10268 } LDKCOption_StrZ;
10269
10270 /**
10271  * The contents of CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ
10272  */
10273 typedef union LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr {
10274    /**
10275     * A pointer to the contents in the success state.
10276     * Reading from this pointer when `result_ok` is not set is undefined.
10277     */
10278    struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ *result;
10279    /**
10280     * Note that this value is always NULL, as there are no contents in the Err variant
10281     */
10282    void *err;
10283 } LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr;
10284
10285 /**
10286  * A CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ represents the result of a fallible operation,
10287  * containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ on success and a () on failure.
10288  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10289  */
10290 typedef struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
10291    /**
10292     * The contents of this CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ, accessible via either
10293     * `err` or `result` depending on the state of `result_ok`.
10294     */
10295    union LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr contents;
10296    /**
10297     * Whether this CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ represents a success state.
10298     */
10299    bool result_ok;
10300 } LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ;
10301
10302 /**
10303  * The contents of CResult_ThirtyTwoBytesAPIErrorZ
10304  */
10305 typedef union LDKCResult_ThirtyTwoBytesAPIErrorZPtr {
10306    /**
10307     * A pointer to the contents in the success state.
10308     * Reading from this pointer when `result_ok` is not set is undefined.
10309     */
10310    struct LDKThirtyTwoBytes *result;
10311    /**
10312     * A pointer to the contents in the error state.
10313     * Reading from this pointer when `result_ok` is set is undefined.
10314     */
10315    struct LDKAPIError *err;
10316 } LDKCResult_ThirtyTwoBytesAPIErrorZPtr;
10317
10318 /**
10319  * A CResult_ThirtyTwoBytesAPIErrorZ represents the result of a fallible operation,
10320  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
10321  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10322  */
10323 typedef struct LDKCResult_ThirtyTwoBytesAPIErrorZ {
10324    /**
10325     * The contents of this CResult_ThirtyTwoBytesAPIErrorZ, accessible via either
10326     * `err` or `result` depending on the state of `result_ok`.
10327     */
10328    union LDKCResult_ThirtyTwoBytesAPIErrorZPtr contents;
10329    /**
10330     * Whether this CResult_ThirtyTwoBytesAPIErrorZ represents a success state.
10331     */
10332    bool result_ok;
10333 } LDKCResult_ThirtyTwoBytesAPIErrorZ;
10334
10335
10336
10337 /**
10338  * An `InvoiceRequest` is a request for a [`Bolt12Invoice`] formulated from an [`Offer`].
10339  *
10340  * An offer may provide choices such as quantity, amount, chain, features, etc. An invoice request
10341  * specifies these such that its recipient can send an invoice for payment.
10342  *
10343  * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
10344  * [`Offer`]: crate::offers::offer::Offer
10345  */
10346 typedef struct MUST_USE_STRUCT LDKInvoiceRequest {
10347    /**
10348     * A pointer to the opaque Rust object.
10349     * Nearly everywhere, inner must be non-null, however in places where
10350     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10351     */
10352    LDKnativeInvoiceRequest *inner;
10353    /**
10354     * Indicates that this is the only struct which contains the same pointer.
10355     * Rust functions which take ownership of an object provided via an argument require
10356     * this to be true and invalidate the object pointed to by inner.
10357     */
10358    bool is_owned;
10359 } LDKInvoiceRequest;
10360
10361
10362
10363 /**
10364  * An error in response to an [`InvoiceRequest`] or an [`Bolt12Invoice`].
10365  *
10366  * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
10367  * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
10368  */
10369 typedef struct MUST_USE_STRUCT LDKInvoiceError {
10370    /**
10371     * A pointer to the opaque Rust object.
10372     * Nearly everywhere, inner must be non-null, however in places where
10373     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10374     */
10375    LDKnativeInvoiceError *inner;
10376    /**
10377     * Indicates that this is the only struct which contains the same pointer.
10378     * Rust functions which take ownership of an object provided via an argument require
10379     * this to be true and invalidate the object pointed to by inner.
10380     */
10381    bool is_owned;
10382 } LDKInvoiceError;
10383
10384 /**
10385  * Possible BOLT 12 Offers messages sent and received via an [`OnionMessage`].
10386  *
10387  * [`OnionMessage`]: crate::ln::msgs::OnionMessage
10388  */
10389 typedef enum LDKOffersMessage_Tag {
10390    /**
10391     * A request for a [`Bolt12Invoice`] for a particular [`Offer`].
10392     *
10393     * [`Offer`]: crate::offers::offer::Offer
10394     */
10395    LDKOffersMessage_InvoiceRequest,
10396    /**
10397     * A [`Bolt12Invoice`] sent in response to an [`InvoiceRequest`] or a [`Refund`].
10398     *
10399     * [`Refund`]: crate::offers::refund::Refund
10400     */
10401    LDKOffersMessage_Invoice,
10402    /**
10403     * An error from handling an [`OffersMessage`].
10404     */
10405    LDKOffersMessage_InvoiceError,
10406    /**
10407     * Must be last for serialization purposes
10408     */
10409    LDKOffersMessage_Sentinel,
10410 } LDKOffersMessage_Tag;
10411
10412 typedef struct MUST_USE_STRUCT LDKOffersMessage {
10413    LDKOffersMessage_Tag tag;
10414    union {
10415       struct {
10416          struct LDKInvoiceRequest invoice_request;
10417       };
10418       struct {
10419          struct LDKBolt12Invoice invoice;
10420       };
10421       struct {
10422          struct LDKInvoiceError invoice_error;
10423       };
10424    };
10425 } LDKOffersMessage;
10426
10427 /**
10428  * An enum which can either contain a crate::lightning::onion_message::offers::OffersMessage or not
10429  */
10430 typedef enum LDKCOption_OffersMessageZ_Tag {
10431    /**
10432     * When we're in this state, this COption_OffersMessageZ contains a crate::lightning::onion_message::offers::OffersMessage
10433     */
10434    LDKCOption_OffersMessageZ_Some,
10435    /**
10436     * When we're in this state, this COption_OffersMessageZ contains nothing
10437     */
10438    LDKCOption_OffersMessageZ_None,
10439    /**
10440     * Must be last for serialization purposes
10441     */
10442    LDKCOption_OffersMessageZ_Sentinel,
10443 } LDKCOption_OffersMessageZ_Tag;
10444
10445 typedef struct LDKCOption_OffersMessageZ {
10446    LDKCOption_OffersMessageZ_Tag tag;
10447    union {
10448       struct {
10449          struct LDKOffersMessage some;
10450       };
10451    };
10452 } LDKCOption_OffersMessageZ;
10453
10454 /**
10455  * The destination of an onion message.
10456  */
10457 typedef enum LDKDestination_Tag {
10458    /**
10459     * We're sending this onion message to a node.
10460     */
10461    LDKDestination_Node,
10462    /**
10463     * We're sending this onion message to a blinded path.
10464     */
10465    LDKDestination_BlindedPath,
10466    /**
10467     * Must be last for serialization purposes
10468     */
10469    LDKDestination_Sentinel,
10470 } LDKDestination_Tag;
10471
10472 typedef struct MUST_USE_STRUCT LDKDestination {
10473    LDKDestination_Tag tag;
10474    union {
10475       struct {
10476          struct LDKPublicKey node;
10477       };
10478       struct {
10479          struct LDKBlindedPath blinded_path;
10480       };
10481    };
10482 } LDKDestination;
10483
10484 /**
10485  * A tuple of 3 elements. See the individual fields for the types contained.
10486  */
10487 typedef struct LDKC3Tuple_OffersMessageDestinationBlindedPathZ {
10488    /**
10489     * The element at position 0
10490     */
10491    struct LDKOffersMessage a;
10492    /**
10493     * The element at position 1
10494     */
10495    struct LDKDestination b;
10496    /**
10497     * The element at position 2
10498     */
10499    struct LDKBlindedPath c;
10500 } LDKC3Tuple_OffersMessageDestinationBlindedPathZ;
10501
10502 /**
10503  * A dynamically-allocated array of crate::c_types::derived::C3Tuple_OffersMessageDestinationBlindedPathZs of arbitrary size.
10504  * This corresponds to std::vector in C++
10505  */
10506 typedef struct LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ {
10507    /**
10508     * The elements in the array.
10509     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10510     */
10511    struct LDKC3Tuple_OffersMessageDestinationBlindedPathZ *data;
10512    /**
10513     * The number of elements pointed to by `data`.
10514     */
10515    uintptr_t datalen;
10516 } LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ;
10517
10518
10519
10520 /**
10521  * Information needed for constructing an invoice route hint for this channel.
10522  */
10523 typedef struct MUST_USE_STRUCT LDKCounterpartyForwardingInfo {
10524    /**
10525     * A pointer to the opaque Rust object.
10526     * Nearly everywhere, inner must be non-null, however in places where
10527     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10528     */
10529    LDKnativeCounterpartyForwardingInfo *inner;
10530    /**
10531     * Indicates that this is the only struct which contains the same pointer.
10532     * Rust functions which take ownership of an object provided via an argument require
10533     * this to be true and invalidate the object pointed to by inner.
10534     */
10535    bool is_owned;
10536 } LDKCounterpartyForwardingInfo;
10537
10538 /**
10539  * The contents of CResult_CounterpartyForwardingInfoDecodeErrorZ
10540  */
10541 typedef union LDKCResult_CounterpartyForwardingInfoDecodeErrorZPtr {
10542    /**
10543     * A pointer to the contents in the success state.
10544     * Reading from this pointer when `result_ok` is not set is undefined.
10545     */
10546    struct LDKCounterpartyForwardingInfo *result;
10547    /**
10548     * A pointer to the contents in the error state.
10549     * Reading from this pointer when `result_ok` is set is undefined.
10550     */
10551    struct LDKDecodeError *err;
10552 } LDKCResult_CounterpartyForwardingInfoDecodeErrorZPtr;
10553
10554 /**
10555  * A CResult_CounterpartyForwardingInfoDecodeErrorZ represents the result of a fallible operation,
10556  * containing a crate::lightning::ln::channelmanager::CounterpartyForwardingInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
10557  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10558  */
10559 typedef struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ {
10560    /**
10561     * The contents of this CResult_CounterpartyForwardingInfoDecodeErrorZ, accessible via either
10562     * `err` or `result` depending on the state of `result_ok`.
10563     */
10564    union LDKCResult_CounterpartyForwardingInfoDecodeErrorZPtr contents;
10565    /**
10566     * Whether this CResult_CounterpartyForwardingInfoDecodeErrorZ represents a success state.
10567     */
10568    bool result_ok;
10569 } LDKCResult_CounterpartyForwardingInfoDecodeErrorZ;
10570
10571
10572
10573 /**
10574  * Channel parameters which apply to our counterparty. These are split out from [`ChannelDetails`]
10575  * to better separate parameters.
10576  */
10577 typedef struct MUST_USE_STRUCT LDKChannelCounterparty {
10578    /**
10579     * A pointer to the opaque Rust object.
10580     * Nearly everywhere, inner must be non-null, however in places where
10581     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10582     */
10583    LDKnativeChannelCounterparty *inner;
10584    /**
10585     * Indicates that this is the only struct which contains the same pointer.
10586     * Rust functions which take ownership of an object provided via an argument require
10587     * this to be true and invalidate the object pointed to by inner.
10588     */
10589    bool is_owned;
10590 } LDKChannelCounterparty;
10591
10592 /**
10593  * The contents of CResult_ChannelCounterpartyDecodeErrorZ
10594  */
10595 typedef union LDKCResult_ChannelCounterpartyDecodeErrorZPtr {
10596    /**
10597     * A pointer to the contents in the success state.
10598     * Reading from this pointer when `result_ok` is not set is undefined.
10599     */
10600    struct LDKChannelCounterparty *result;
10601    /**
10602     * A pointer to the contents in the error state.
10603     * Reading from this pointer when `result_ok` is set is undefined.
10604     */
10605    struct LDKDecodeError *err;
10606 } LDKCResult_ChannelCounterpartyDecodeErrorZPtr;
10607
10608 /**
10609  * A CResult_ChannelCounterpartyDecodeErrorZ represents the result of a fallible operation,
10610  * containing a crate::lightning::ln::channelmanager::ChannelCounterparty on success and a crate::lightning::ln::msgs::DecodeError on failure.
10611  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10612  */
10613 typedef struct LDKCResult_ChannelCounterpartyDecodeErrorZ {
10614    /**
10615     * The contents of this CResult_ChannelCounterpartyDecodeErrorZ, accessible via either
10616     * `err` or `result` depending on the state of `result_ok`.
10617     */
10618    union LDKCResult_ChannelCounterpartyDecodeErrorZPtr contents;
10619    /**
10620     * Whether this CResult_ChannelCounterpartyDecodeErrorZ represents a success state.
10621     */
10622    bool result_ok;
10623 } LDKCResult_ChannelCounterpartyDecodeErrorZ;
10624
10625 /**
10626  * The contents of CResult_ChannelDetailsDecodeErrorZ
10627  */
10628 typedef union LDKCResult_ChannelDetailsDecodeErrorZPtr {
10629    /**
10630     * A pointer to the contents in the success state.
10631     * Reading from this pointer when `result_ok` is not set is undefined.
10632     */
10633    struct LDKChannelDetails *result;
10634    /**
10635     * A pointer to the contents in the error state.
10636     * Reading from this pointer when `result_ok` is set is undefined.
10637     */
10638    struct LDKDecodeError *err;
10639 } LDKCResult_ChannelDetailsDecodeErrorZPtr;
10640
10641 /**
10642  * A CResult_ChannelDetailsDecodeErrorZ represents the result of a fallible operation,
10643  * containing a crate::lightning::ln::channelmanager::ChannelDetails on success and a crate::lightning::ln::msgs::DecodeError on failure.
10644  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10645  */
10646 typedef struct LDKCResult_ChannelDetailsDecodeErrorZ {
10647    /**
10648     * The contents of this CResult_ChannelDetailsDecodeErrorZ, accessible via either
10649     * `err` or `result` depending on the state of `result_ok`.
10650     */
10651    union LDKCResult_ChannelDetailsDecodeErrorZPtr contents;
10652    /**
10653     * Whether this CResult_ChannelDetailsDecodeErrorZ represents a success state.
10654     */
10655    bool result_ok;
10656 } LDKCResult_ChannelDetailsDecodeErrorZ;
10657
10658
10659
10660 /**
10661  * Route hints used in constructing invoices for [phantom node payents].
10662  *
10663  * [phantom node payments]: crate::sign::PhantomKeysManager
10664  */
10665 typedef struct MUST_USE_STRUCT LDKPhantomRouteHints {
10666    /**
10667     * A pointer to the opaque Rust object.
10668     * Nearly everywhere, inner must be non-null, however in places where
10669     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10670     */
10671    LDKnativePhantomRouteHints *inner;
10672    /**
10673     * Indicates that this is the only struct which contains the same pointer.
10674     * Rust functions which take ownership of an object provided via an argument require
10675     * this to be true and invalidate the object pointed to by inner.
10676     */
10677    bool is_owned;
10678 } LDKPhantomRouteHints;
10679
10680 /**
10681  * The contents of CResult_PhantomRouteHintsDecodeErrorZ
10682  */
10683 typedef union LDKCResult_PhantomRouteHintsDecodeErrorZPtr {
10684    /**
10685     * A pointer to the contents in the success state.
10686     * Reading from this pointer when `result_ok` is not set is undefined.
10687     */
10688    struct LDKPhantomRouteHints *result;
10689    /**
10690     * A pointer to the contents in the error state.
10691     * Reading from this pointer when `result_ok` is set is undefined.
10692     */
10693    struct LDKDecodeError *err;
10694 } LDKCResult_PhantomRouteHintsDecodeErrorZPtr;
10695
10696 /**
10697  * A CResult_PhantomRouteHintsDecodeErrorZ represents the result of a fallible operation,
10698  * containing a crate::lightning::ln::channelmanager::PhantomRouteHints on success and a crate::lightning::ln::msgs::DecodeError on failure.
10699  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10700  */
10701 typedef struct LDKCResult_PhantomRouteHintsDecodeErrorZ {
10702    /**
10703     * The contents of this CResult_PhantomRouteHintsDecodeErrorZ, accessible via either
10704     * `err` or `result` depending on the state of `result_ok`.
10705     */
10706    union LDKCResult_PhantomRouteHintsDecodeErrorZPtr contents;
10707    /**
10708     * Whether this CResult_PhantomRouteHintsDecodeErrorZ represents a success state.
10709     */
10710    bool result_ok;
10711 } LDKCResult_PhantomRouteHintsDecodeErrorZ;
10712
10713
10714
10715 /**
10716  * Information used to forward or fail this HTLC that is being forwarded within a blinded path.
10717  */
10718 typedef struct MUST_USE_STRUCT LDKBlindedForward {
10719    /**
10720     * A pointer to the opaque Rust object.
10721     * Nearly everywhere, inner must be non-null, however in places where
10722     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10723     */
10724    LDKnativeBlindedForward *inner;
10725    /**
10726     * Indicates that this is the only struct which contains the same pointer.
10727     * Rust functions which take ownership of an object provided via an argument require
10728     * this to be true and invalidate the object pointed to by inner.
10729     */
10730    bool is_owned;
10731 } LDKBlindedForward;
10732
10733 /**
10734  * The contents of CResult_BlindedForwardDecodeErrorZ
10735  */
10736 typedef union LDKCResult_BlindedForwardDecodeErrorZPtr {
10737    /**
10738     * A pointer to the contents in the success state.
10739     * Reading from this pointer when `result_ok` is not set is undefined.
10740     */
10741    struct LDKBlindedForward *result;
10742    /**
10743     * A pointer to the contents in the error state.
10744     * Reading from this pointer when `result_ok` is set is undefined.
10745     */
10746    struct LDKDecodeError *err;
10747 } LDKCResult_BlindedForwardDecodeErrorZPtr;
10748
10749 /**
10750  * A CResult_BlindedForwardDecodeErrorZ represents the result of a fallible operation,
10751  * containing a crate::lightning::ln::channelmanager::BlindedForward on success and a crate::lightning::ln::msgs::DecodeError on failure.
10752  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10753  */
10754 typedef struct LDKCResult_BlindedForwardDecodeErrorZ {
10755    /**
10756     * The contents of this CResult_BlindedForwardDecodeErrorZ, accessible via either
10757     * `err` or `result` depending on the state of `result_ok`.
10758     */
10759    union LDKCResult_BlindedForwardDecodeErrorZPtr contents;
10760    /**
10761     * Whether this CResult_BlindedForwardDecodeErrorZ represents a success state.
10762     */
10763    bool result_ok;
10764 } LDKCResult_BlindedForwardDecodeErrorZ;
10765
10766
10767
10768 /**
10769  * BOLT 4 onion packet including hop data for the next peer.
10770  */
10771 typedef struct MUST_USE_STRUCT LDKOnionPacket {
10772    /**
10773     * A pointer to the opaque Rust object.
10774     * Nearly everywhere, inner must be non-null, however in places where
10775     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10776     */
10777    LDKnativeOnionPacket *inner;
10778    /**
10779     * Indicates that this is the only struct which contains the same pointer.
10780     * Rust functions which take ownership of an object provided via an argument require
10781     * this to be true and invalidate the object pointed to by inner.
10782     */
10783    bool is_owned;
10784 } LDKOnionPacket;
10785
10786
10787
10788 /**
10789  * Information communicated in the onion to the recipient for multi-part tracking and proof that
10790  * the payment is associated with an invoice.
10791  */
10792 typedef struct MUST_USE_STRUCT LDKFinalOnionHopData {
10793    /**
10794     * A pointer to the opaque Rust object.
10795     * Nearly everywhere, inner must be non-null, however in places where
10796     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10797     */
10798    LDKnativeFinalOnionHopData *inner;
10799    /**
10800     * Indicates that this is the only struct which contains the same pointer.
10801     * Rust functions which take ownership of an object provided via an argument require
10802     * this to be true and invalidate the object pointed to by inner.
10803     */
10804    bool is_owned;
10805 } LDKFinalOnionHopData;
10806
10807 /**
10808  * Information about where a received HTLC('s onion) has indicated the HTLC should go.
10809  */
10810 typedef enum LDKPendingHTLCRouting_Tag {
10811    /**
10812     * An HTLC which should be forwarded on to another node.
10813     */
10814    LDKPendingHTLCRouting_Forward,
10815    /**
10816     * The onion indicates that this is a payment for an invoice (supposedly) generated by us.
10817     *
10818     * Note that at this point, we have not checked that the invoice being paid was actually
10819     * generated by us, but rather it's claiming to pay an invoice of ours.
10820     */
10821    LDKPendingHTLCRouting_Receive,
10822    /**
10823     * The onion indicates that this is for payment to us but which contains the preimage for
10824     * claiming included, and is unrelated to any invoice we'd previously generated (aka a
10825     * \"keysend\" or \"spontaneous\" payment).
10826     */
10827    LDKPendingHTLCRouting_ReceiveKeysend,
10828    /**
10829     * Must be last for serialization purposes
10830     */
10831    LDKPendingHTLCRouting_Sentinel,
10832 } LDKPendingHTLCRouting_Tag;
10833
10834 typedef struct LDKPendingHTLCRouting_LDKForward_Body {
10835    /**
10836     * The onion which should be included in the forwarded HTLC, telling the next hop what to
10837     * do with the HTLC.
10838     */
10839    struct LDKOnionPacket onion_packet;
10840    /**
10841     * The short channel ID of the channel which we were instructed to forward this HTLC to.
10842     *
10843     * This could be a real on-chain SCID, an SCID alias, or some other SCID which has meaning
10844     * to the receiving node, such as one returned from
10845     * [`ChannelManager::get_intercept_scid`] or [`ChannelManager::get_phantom_scid`].
10846     */
10847    uint64_t short_channel_id;
10848    /**
10849     * Set if this HTLC is being forwarded within a blinded path.
10850     *
10851     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
10852     */
10853    struct LDKBlindedForward blinded;
10854 } LDKPendingHTLCRouting_LDKForward_Body;
10855
10856 typedef struct LDKPendingHTLCRouting_LDKReceive_Body {
10857    /**
10858     * Information about the amount the sender intended to pay and (potential) proof that this
10859     * is a payment for an invoice we generated. This proof of payment is is also used for
10860     * linking MPP parts of a larger payment.
10861     */
10862    struct LDKFinalOnionHopData payment_data;
10863    /**
10864     * Additional data which we (allegedly) instructed the sender to include in the onion.
10865     *
10866     * For HTLCs received by LDK, this will ultimately be exposed in
10867     * [`Event::PaymentClaimable::onion_fields`] as
10868     * [`RecipientOnionFields::payment_metadata`].
10869     */
10870    struct LDKCOption_CVec_u8ZZ payment_metadata;
10871    /**
10872     * The context of the payment included by the recipient in a blinded path, or `None` if a
10873     * blinded path was not used.
10874     *
10875     * Used in part to determine the [`events::PaymentPurpose`].
10876     */
10877    struct LDKCOption_PaymentContextZ payment_context;
10878    /**
10879     * CLTV expiry of the received HTLC.
10880     *
10881     * Used to track when we should expire pending HTLCs that go unclaimed.
10882     */
10883    uint32_t incoming_cltv_expiry;
10884    /**
10885     * If the onion had forwarding instructions to one of our phantom node SCIDs, this will
10886     * provide the onion shared secret used to decrypt the next level of forwarding
10887     * instructions.
10888     *
10889     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
10890     */
10891    struct LDKThirtyTwoBytes phantom_shared_secret;
10892    /**
10893     * Custom TLVs which were set by the sender.
10894     *
10895     * For HTLCs received by LDK, this will ultimately be exposed in
10896     * [`Event::PaymentClaimable::onion_fields`] as
10897     * [`RecipientOnionFields::custom_tlvs`].
10898     */
10899    struct LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs;
10900    /**
10901     * Set if this HTLC is the final hop in a multi-hop blinded path.
10902     */
10903    bool requires_blinded_error;
10904 } LDKPendingHTLCRouting_LDKReceive_Body;
10905
10906 typedef struct LDKPendingHTLCRouting_LDKReceiveKeysend_Body {
10907    /**
10908     * Information about the amount the sender intended to pay and possibly a token to
10909     * associate MPP parts of a larger payment.
10910     *
10911     * This will only be filled in if receiving MPP keysend payments is enabled, and it being
10912     * present will cause deserialization to fail on versions of LDK prior to 0.0.116.
10913     *
10914     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
10915     */
10916    struct LDKFinalOnionHopData payment_data;
10917    /**
10918     * Preimage for this onion payment. This preimage is provided by the sender and will be
10919     * used to settle the spontaneous payment.
10920     */
10921    struct LDKThirtyTwoBytes payment_preimage;
10922    /**
10923     * Additional data which we (allegedly) instructed the sender to include in the onion.
10924     *
10925     * For HTLCs received by LDK, this will ultimately bubble back up as
10926     * [`RecipientOnionFields::payment_metadata`].
10927     */
10928    struct LDKCOption_CVec_u8ZZ payment_metadata;
10929    /**
10930     * CLTV expiry of the received HTLC.
10931     *
10932     * Used to track when we should expire pending HTLCs that go unclaimed.
10933     */
10934    uint32_t incoming_cltv_expiry;
10935    /**
10936     * Custom TLVs which were set by the sender.
10937     *
10938     * For HTLCs received by LDK, these will ultimately bubble back up as
10939     * [`RecipientOnionFields::custom_tlvs`].
10940     */
10941    struct LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs;
10942    /**
10943     * Set if this HTLC is the final hop in a multi-hop blinded path.
10944     */
10945    bool requires_blinded_error;
10946 } LDKPendingHTLCRouting_LDKReceiveKeysend_Body;
10947
10948 typedef struct MUST_USE_STRUCT LDKPendingHTLCRouting {
10949    LDKPendingHTLCRouting_Tag tag;
10950    union {
10951       LDKPendingHTLCRouting_LDKForward_Body forward;
10952       LDKPendingHTLCRouting_LDKReceive_Body receive;
10953       LDKPendingHTLCRouting_LDKReceiveKeysend_Body receive_keysend;
10954    };
10955 } LDKPendingHTLCRouting;
10956
10957 /**
10958  * The contents of CResult_PendingHTLCRoutingDecodeErrorZ
10959  */
10960 typedef union LDKCResult_PendingHTLCRoutingDecodeErrorZPtr {
10961    /**
10962     * A pointer to the contents in the success state.
10963     * Reading from this pointer when `result_ok` is not set is undefined.
10964     */
10965    struct LDKPendingHTLCRouting *result;
10966    /**
10967     * A pointer to the contents in the error state.
10968     * Reading from this pointer when `result_ok` is set is undefined.
10969     */
10970    struct LDKDecodeError *err;
10971 } LDKCResult_PendingHTLCRoutingDecodeErrorZPtr;
10972
10973 /**
10974  * A CResult_PendingHTLCRoutingDecodeErrorZ represents the result of a fallible operation,
10975  * containing a crate::lightning::ln::channelmanager::PendingHTLCRouting on success and a crate::lightning::ln::msgs::DecodeError on failure.
10976  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10977  */
10978 typedef struct LDKCResult_PendingHTLCRoutingDecodeErrorZ {
10979    /**
10980     * The contents of this CResult_PendingHTLCRoutingDecodeErrorZ, accessible via either
10981     * `err` or `result` depending on the state of `result_ok`.
10982     */
10983    union LDKCResult_PendingHTLCRoutingDecodeErrorZPtr contents;
10984    /**
10985     * Whether this CResult_PendingHTLCRoutingDecodeErrorZ represents a success state.
10986     */
10987    bool result_ok;
10988 } LDKCResult_PendingHTLCRoutingDecodeErrorZ;
10989
10990 /**
10991  * The contents of CResult_PendingHTLCInfoDecodeErrorZ
10992  */
10993 typedef union LDKCResult_PendingHTLCInfoDecodeErrorZPtr {
10994    /**
10995     * A pointer to the contents in the success state.
10996     * Reading from this pointer when `result_ok` is not set is undefined.
10997     */
10998    struct LDKPendingHTLCInfo *result;
10999    /**
11000     * A pointer to the contents in the error state.
11001     * Reading from this pointer when `result_ok` is set is undefined.
11002     */
11003    struct LDKDecodeError *err;
11004 } LDKCResult_PendingHTLCInfoDecodeErrorZPtr;
11005
11006 /**
11007  * A CResult_PendingHTLCInfoDecodeErrorZ represents the result of a fallible operation,
11008  * containing a crate::lightning::ln::channelmanager::PendingHTLCInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
11009  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11010  */
11011 typedef struct LDKCResult_PendingHTLCInfoDecodeErrorZ {
11012    /**
11013     * The contents of this CResult_PendingHTLCInfoDecodeErrorZ, accessible via either
11014     * `err` or `result` depending on the state of `result_ok`.
11015     */
11016    union LDKCResult_PendingHTLCInfoDecodeErrorZPtr contents;
11017    /**
11018     * Whether this CResult_PendingHTLCInfoDecodeErrorZ represents a success state.
11019     */
11020    bool result_ok;
11021 } LDKCResult_PendingHTLCInfoDecodeErrorZ;
11022
11023 /**
11024  * The contents of CResult_BlindedFailureDecodeErrorZ
11025  */
11026 typedef union LDKCResult_BlindedFailureDecodeErrorZPtr {
11027    /**
11028     * A pointer to the contents in the success state.
11029     * Reading from this pointer when `result_ok` is not set is undefined.
11030     */
11031    enum LDKBlindedFailure *result;
11032    /**
11033     * A pointer to the contents in the error state.
11034     * Reading from this pointer when `result_ok` is set is undefined.
11035     */
11036    struct LDKDecodeError *err;
11037 } LDKCResult_BlindedFailureDecodeErrorZPtr;
11038
11039 /**
11040  * A CResult_BlindedFailureDecodeErrorZ represents the result of a fallible operation,
11041  * containing a crate::lightning::ln::channelmanager::BlindedFailure on success and a crate::lightning::ln::msgs::DecodeError on failure.
11042  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11043  */
11044 typedef struct LDKCResult_BlindedFailureDecodeErrorZ {
11045    /**
11046     * The contents of this CResult_BlindedFailureDecodeErrorZ, accessible via either
11047     * `err` or `result` depending on the state of `result_ok`.
11048     */
11049    union LDKCResult_BlindedFailureDecodeErrorZPtr contents;
11050    /**
11051     * Whether this CResult_BlindedFailureDecodeErrorZ represents a success state.
11052     */
11053    bool result_ok;
11054 } LDKCResult_BlindedFailureDecodeErrorZ;
11055
11056 /**
11057  * The contents of CResult_ChannelShutdownStateDecodeErrorZ
11058  */
11059 typedef union LDKCResult_ChannelShutdownStateDecodeErrorZPtr {
11060    /**
11061     * A pointer to the contents in the success state.
11062     * Reading from this pointer when `result_ok` is not set is undefined.
11063     */
11064    enum LDKChannelShutdownState *result;
11065    /**
11066     * A pointer to the contents in the error state.
11067     * Reading from this pointer when `result_ok` is set is undefined.
11068     */
11069    struct LDKDecodeError *err;
11070 } LDKCResult_ChannelShutdownStateDecodeErrorZPtr;
11071
11072 /**
11073  * A CResult_ChannelShutdownStateDecodeErrorZ represents the result of a fallible operation,
11074  * containing a crate::lightning::ln::channelmanager::ChannelShutdownState on success and a crate::lightning::ln::msgs::DecodeError on failure.
11075  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11076  */
11077 typedef struct LDKCResult_ChannelShutdownStateDecodeErrorZ {
11078    /**
11079     * The contents of this CResult_ChannelShutdownStateDecodeErrorZ, accessible via either
11080     * `err` or `result` depending on the state of `result_ok`.
11081     */
11082    union LDKCResult_ChannelShutdownStateDecodeErrorZPtr contents;
11083    /**
11084     * Whether this CResult_ChannelShutdownStateDecodeErrorZ represents a success state.
11085     */
11086    bool result_ok;
11087 } LDKCResult_ChannelShutdownStateDecodeErrorZ;
11088
11089
11090
11091 /**
11092  * A ChannelMonitor handles chain events (blocks connected and disconnected) and generates
11093  * on-chain transactions to ensure no loss of funds occurs.
11094  *
11095  * You MUST ensure that no ChannelMonitors for a given channel anywhere contain out-of-date
11096  * information and are actively monitoring the chain.
11097  *
11098  * Note that the deserializer is only implemented for (BlockHash, ChannelMonitor), which
11099  * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
11100  * the \"reorg path\" (ie disconnecting blocks until you find a common ancestor from both the
11101  * returned block hash and the the current chain and then reconnecting blocks to get to the
11102  * best chain) upon deserializing the object!
11103  */
11104 typedef struct MUST_USE_STRUCT LDKChannelMonitor {
11105    /**
11106     * A pointer to the opaque Rust object.
11107     * Nearly everywhere, inner must be non-null, however in places where
11108     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11109     */
11110    LDKnativeChannelMonitor *inner;
11111    /**
11112     * Indicates that this is the only struct which contains the same pointer.
11113     * Rust functions which take ownership of an object provided via an argument require
11114     * this to be true and invalidate the object pointed to by inner.
11115     */
11116    bool is_owned;
11117 } LDKChannelMonitor;
11118
11119 /**
11120  * A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
11121  * This corresponds to std::vector in C++
11122  */
11123 typedef struct LDKCVec_ChannelMonitorZ {
11124    /**
11125     * The elements in the array.
11126     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11127     */
11128    struct LDKChannelMonitor *data;
11129    /**
11130     * The number of elements pointed to by `data`.
11131     */
11132    uintptr_t datalen;
11133 } LDKCVec_ChannelMonitorZ;
11134
11135
11136
11137 /**
11138  * An update generated by the underlying channel itself which contains some new information the
11139  * [`ChannelMonitor`] should be made aware of.
11140  *
11141  * Because this represents only a small number of updates to the underlying state, it is generally
11142  * much smaller than a full [`ChannelMonitor`]. However, for large single commitment transaction
11143  * updates (e.g. ones during which there are hundreds of HTLCs pending on the commitment
11144  * transaction), a single update may reach upwards of 1 MiB in serialized size.
11145  */
11146 typedef struct MUST_USE_STRUCT LDKChannelMonitorUpdate {
11147    /**
11148     * A pointer to the opaque Rust object.
11149     * Nearly everywhere, inner must be non-null, however in places where
11150     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11151     */
11152    LDKnativeChannelMonitorUpdate *inner;
11153    /**
11154     * Indicates that this is the only struct which contains the same pointer.
11155     * Rust functions which take ownership of an object provided via an argument require
11156     * this to be true and invalidate the object pointed to by inner.
11157     */
11158    bool is_owned;
11159 } LDKChannelMonitorUpdate;
11160
11161 /**
11162  * The `Watch` trait defines behavior for watching on-chain activity pertaining to channels as
11163  * blocks are connected and disconnected.
11164  *
11165  * Each channel is associated with a [`ChannelMonitor`]. Implementations of this trait are
11166  * responsible for maintaining a set of monitors such that they can be updated as channel state
11167  * changes. On each update, *all copies* of a [`ChannelMonitor`] must be updated and the update
11168  * persisted to disk to ensure that the latest [`ChannelMonitor`] state can be reloaded if the
11169  * application crashes.
11170  *
11171  * See method documentation and [`ChannelMonitorUpdateStatus`] for specific requirements.
11172  */
11173 typedef struct LDKWatch {
11174    /**
11175     * An opaque pointer which is passed to your function implementations as an argument.
11176     * This has no meaning in the LDK, and can be NULL or any other value.
11177     */
11178    void *this_arg;
11179    /**
11180     * Watches a channel identified by `funding_txo` using `monitor`.
11181     *
11182     * Implementations are responsible for watching the chain for the funding transaction along
11183     * with any spends of outputs returned by [`get_outputs_to_watch`]. In practice, this means
11184     * calling [`block_connected`] and [`block_disconnected`] on the monitor.
11185     *
11186     * A return of `Err(())` indicates that the channel should immediately be force-closed without
11187     * broadcasting the funding transaction.
11188     *
11189     * If the given `funding_txo` has previously been registered via `watch_channel`, `Err(())`
11190     * must be returned.
11191     *
11192     * [`get_outputs_to_watch`]: channelmonitor::ChannelMonitor::get_outputs_to_watch
11193     * [`block_connected`]: channelmonitor::ChannelMonitor::block_connected
11194     * [`block_disconnected`]: channelmonitor::ChannelMonitor::block_disconnected
11195     */
11196    struct LDKCResult_ChannelMonitorUpdateStatusNoneZ (*watch_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitor monitor);
11197    /**
11198     * Updates a channel identified by `funding_txo` by applying `update` to its monitor.
11199     *
11200     * Implementations must call [`ChannelMonitor::update_monitor`] with the given update. This
11201     * may fail (returning an `Err(())`), in which case this should return
11202     * [`ChannelMonitorUpdateStatus::InProgress`] (and the update should never complete). This
11203     * generally implies the channel has been closed (either by the funding outpoint being spent
11204     * on-chain or the [`ChannelMonitor`] having decided to do so and broadcasted a transaction),
11205     * and the [`ChannelManager`] state will be updated once it sees the funding spend on-chain.
11206     *
11207     * In general, persistence failures should be retried after returning
11208     * [`ChannelMonitorUpdateStatus::InProgress`] and eventually complete. If a failure truly
11209     * cannot be retried, the node should shut down immediately after returning
11210     * [`ChannelMonitorUpdateStatus::UnrecoverableError`], see its documentation for more info.
11211     *
11212     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
11213     */
11214    enum LDKChannelMonitorUpdateStatus (*update_channel)(const void *this_arg, struct LDKOutPoint funding_txo, const struct LDKChannelMonitorUpdate *NONNULL_PTR update);
11215    /**
11216     * Returns any monitor events since the last call. Subsequent calls must only return new
11217     * events.
11218     *
11219     * Note that after any block- or transaction-connection calls to a [`ChannelMonitor`], no
11220     * further events may be returned here until the [`ChannelMonitor`] has been fully persisted
11221     * to disk.
11222     *
11223     * For details on asynchronous [`ChannelMonitor`] updating and returning
11224     * [`MonitorEvent::Completed`] here, see [`ChannelMonitorUpdateStatus::InProgress`].
11225     */
11226    struct LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ (*release_pending_monitor_events)(const void *this_arg);
11227    /**
11228     * Frees any resources associated with this object given its this_arg pointer.
11229     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11230     */
11231    void (*free)(void *this_arg);
11232 } LDKWatch;
11233
11234 /**
11235  * A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
11236  * This corresponds to std::vector in C++
11237  */
11238 typedef struct LDKCVec_TransactionZ {
11239    /**
11240     * The elements in the array.
11241     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11242     */
11243    struct LDKTransaction *data;
11244    /**
11245     * The number of elements pointed to by `data`.
11246     */
11247    uintptr_t datalen;
11248 } LDKCVec_TransactionZ;
11249
11250 /**
11251  * An interface to send a transaction to the Bitcoin network.
11252  */
11253 typedef struct LDKBroadcasterInterface {
11254    /**
11255     * An opaque pointer which is passed to your function implementations as an argument.
11256     * This has no meaning in the LDK, and can be NULL or any other value.
11257     */
11258    void *this_arg;
11259    /**
11260     * Sends a list of transactions out to (hopefully) be mined.
11261     * This only needs to handle the actual broadcasting of transactions, LDK will automatically
11262     * rebroadcast transactions that haven't made it into a block.
11263     *
11264     * In some cases LDK may attempt to broadcast a transaction which double-spends another
11265     * and this isn't a bug and can be safely ignored.
11266     *
11267     * If more than one transaction is given, these transactions should be considered to be a
11268     * package and broadcast together. Some of the transactions may or may not depend on each other,
11269     * be sure to manage both cases correctly.
11270     *
11271     * Bitcoin transaction packages are defined in BIP 331 and here:
11272     * <https://github.com/bitcoin/bitcoin/blob/master/doc/policy/packages.md>
11273     */
11274    void (*broadcast_transactions)(const void *this_arg, struct LDKCVec_TransactionZ txs);
11275    /**
11276     * Frees any resources associated with this object given its this_arg pointer.
11277     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11278     */
11279    void (*free)(void *this_arg);
11280 } LDKBroadcasterInterface;
11281
11282 /**
11283  * A trait that describes a source of entropy.
11284  */
11285 typedef struct LDKEntropySource {
11286    /**
11287     * An opaque pointer which is passed to your function implementations as an argument.
11288     * This has no meaning in the LDK, and can be NULL or any other value.
11289     */
11290    void *this_arg;
11291    /**
11292     * Gets a unique, cryptographically-secure, random 32-byte value. This method must return a
11293     * different value each time it is called.
11294     */
11295    struct LDKThirtyTwoBytes (*get_secure_random_bytes)(const void *this_arg);
11296    /**
11297     * Frees any resources associated with this object given its this_arg pointer.
11298     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11299     */
11300    void (*free)(void *this_arg);
11301 } LDKEntropySource;
11302
11303
11304
11305 /**
11306  * A semantically valid [`InvoiceRequest`] that hasn't been signed.
11307  *
11308  * # Serialization
11309  *
11310  * This is serialized as a TLV stream, which includes TLV records from the originating message. As
11311  * such, it may include unknown, odd TLV records.
11312  */
11313 typedef struct MUST_USE_STRUCT LDKUnsignedInvoiceRequest {
11314    /**
11315     * A pointer to the opaque Rust object.
11316     * Nearly everywhere, inner must be non-null, however in places where
11317     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11318     */
11319    LDKnativeUnsignedInvoiceRequest *inner;
11320    /**
11321     * Indicates that this is the only struct which contains the same pointer.
11322     * Rust functions which take ownership of an object provided via an argument require
11323     * this to be true and invalidate the object pointed to by inner.
11324     */
11325    bool is_owned;
11326 } LDKUnsignedInvoiceRequest;
11327
11328
11329
11330 /**
11331  * The unsigned part of a [`channel_update`] message.
11332  *
11333  * [`channel_update`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-channel_update-message
11334  */
11335 typedef struct MUST_USE_STRUCT LDKUnsignedChannelUpdate {
11336    /**
11337     * A pointer to the opaque Rust object.
11338     * Nearly everywhere, inner must be non-null, however in places where
11339     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11340     */
11341    LDKnativeUnsignedChannelUpdate *inner;
11342    /**
11343     * Indicates that this is the only struct which contains the same pointer.
11344     * Rust functions which take ownership of an object provided via an argument require
11345     * this to be true and invalidate the object pointed to by inner.
11346     */
11347    bool is_owned;
11348 } LDKUnsignedChannelUpdate;
11349
11350
11351
11352 /**
11353  * The unsigned part of a [`node_announcement`] message.
11354  *
11355  * [`node_announcement`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-node_announcement-message
11356  */
11357 typedef struct MUST_USE_STRUCT LDKUnsignedNodeAnnouncement {
11358    /**
11359     * A pointer to the opaque Rust object.
11360     * Nearly everywhere, inner must be non-null, however in places where
11361     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11362     */
11363    LDKnativeUnsignedNodeAnnouncement *inner;
11364    /**
11365     * Indicates that this is the only struct which contains the same pointer.
11366     * Rust functions which take ownership of an object provided via an argument require
11367     * this to be true and invalidate the object pointed to by inner.
11368     */
11369    bool is_owned;
11370 } LDKUnsignedNodeAnnouncement;
11371
11372 /**
11373  * Represents the set of gossip messages that require a signature from a node's identity key.
11374  */
11375 typedef enum LDKUnsignedGossipMessage_Tag {
11376    /**
11377     * An unsigned channel announcement.
11378     */
11379    LDKUnsignedGossipMessage_ChannelAnnouncement,
11380    /**
11381     * An unsigned channel update.
11382     */
11383    LDKUnsignedGossipMessage_ChannelUpdate,
11384    /**
11385     * An unsigned node announcement.
11386     */
11387    LDKUnsignedGossipMessage_NodeAnnouncement,
11388    /**
11389     * Must be last for serialization purposes
11390     */
11391    LDKUnsignedGossipMessage_Sentinel,
11392 } LDKUnsignedGossipMessage_Tag;
11393
11394 typedef struct MUST_USE_STRUCT LDKUnsignedGossipMessage {
11395    LDKUnsignedGossipMessage_Tag tag;
11396    union {
11397       struct {
11398          struct LDKUnsignedChannelAnnouncement channel_announcement;
11399       };
11400       struct {
11401          struct LDKUnsignedChannelUpdate channel_update;
11402       };
11403       struct {
11404          struct LDKUnsignedNodeAnnouncement node_announcement;
11405       };
11406    };
11407 } LDKUnsignedGossipMessage;
11408
11409 /**
11410  * A trait that can handle cryptographic operations at the scope level of a node.
11411  */
11412 typedef struct LDKNodeSigner {
11413    /**
11414     * An opaque pointer which is passed to your function implementations as an argument.
11415     * This has no meaning in the LDK, and can be NULL or any other value.
11416     */
11417    void *this_arg;
11418    /**
11419     * Get secret key material as bytes for use in encrypting and decrypting inbound payment data.
11420     *
11421     * If the implementor of this trait supports [phantom node payments], then every node that is
11422     * intended to be included in the phantom invoice route hints must return the same value from
11423     * this method.
11424     *
11425     * This method must return the same value each time it is called.
11426     *
11427     * [phantom node payments]: PhantomKeysManager
11428     */
11429    struct LDKThirtyTwoBytes (*get_inbound_payment_key_material)(const void *this_arg);
11430    /**
11431     * Get node id based on the provided [`Recipient`].
11432     *
11433     * This method must return the same value each time it is called with a given [`Recipient`]
11434     * parameter.
11435     *
11436     * Errors if the [`Recipient`] variant is not supported by the implementation.
11437     */
11438    struct LDKCResult_PublicKeyNoneZ (*get_node_id)(const void *this_arg, enum LDKRecipient recipient);
11439    /**
11440     * Gets the ECDH shared secret of our node secret and `other_key`, multiplying by `tweak` if
11441     * one is provided. Note that this tweak can be applied to `other_key` instead of our node
11442     * secret, though this is less efficient.
11443     *
11444     * Note that if this fails while attempting to forward an HTLC, LDK will panic. The error
11445     * should be resolved to allow LDK to resume forwarding HTLCs.
11446     *
11447     * Errors if the [`Recipient`] variant is not supported by the implementation.
11448     */
11449    struct LDKCResult_ThirtyTwoBytesNoneZ (*ecdh)(const void *this_arg, enum LDKRecipient recipient, struct LDKPublicKey other_key, struct LDKCOption_BigEndianScalarZ tweak);
11450    /**
11451     * Sign an invoice.
11452     *
11453     * By parameterizing by the raw invoice bytes instead of the hash, we allow implementors of
11454     * this trait to parse the invoice and make sure they're signing what they expect, rather than
11455     * blindly signing the hash.
11456     *
11457     * The `hrp_bytes` are ASCII bytes, while the `invoice_data` is base32.
11458     *
11459     * The secret key used to sign the invoice is dependent on the [`Recipient`].
11460     *
11461     * Errors if the [`Recipient`] variant is not supported by the implementation.
11462     */
11463    struct LDKCResult_RecoverableSignatureNoneZ (*sign_invoice)(const void *this_arg, struct LDKu8slice hrp_bytes, struct LDKCVec_U5Z invoice_data, enum LDKRecipient recipient);
11464    /**
11465     * Signs the [`TaggedHash`] of a BOLT 12 invoice request.
11466     *
11467     * May be called by a function passed to [`UnsignedInvoiceRequest::sign`] where
11468     * `invoice_request` is the callee.
11469     *
11470     * Implementors may check that the `invoice_request` is expected rather than blindly signing
11471     * the tagged hash. An `Ok` result should sign `invoice_request.tagged_hash().as_digest()` with
11472     * the node's signing key or an ephemeral key to preserve privacy, whichever is associated with
11473     * [`UnsignedInvoiceRequest::payer_id`].
11474     *
11475     * [`TaggedHash`]: crate::offers::merkle::TaggedHash
11476     */
11477    struct LDKCResult_SchnorrSignatureNoneZ (*sign_bolt12_invoice_request)(const void *this_arg, const struct LDKUnsignedInvoiceRequest *NONNULL_PTR invoice_request);
11478    /**
11479     * Signs the [`TaggedHash`] of a BOLT 12 invoice.
11480     *
11481     * May be called by a function passed to [`UnsignedBolt12Invoice::sign`] where `invoice` is the
11482     * callee.
11483     *
11484     * Implementors may check that the `invoice` is expected rather than blindly signing the tagged
11485     * hash. An `Ok` result should sign `invoice.tagged_hash().as_digest()` with the node's signing
11486     * key or an ephemeral key to preserve privacy, whichever is associated with
11487     * [`UnsignedBolt12Invoice::signing_pubkey`].
11488     *
11489     * [`TaggedHash`]: crate::offers::merkle::TaggedHash
11490     */
11491    struct LDKCResult_SchnorrSignatureNoneZ (*sign_bolt12_invoice)(const void *this_arg, const struct LDKUnsignedBolt12Invoice *NONNULL_PTR invoice);
11492    /**
11493     * Sign a gossip message.
11494     *
11495     * Note that if this fails, LDK may panic and the message will not be broadcast to the network
11496     * or a possible channel counterparty. If LDK panics, the error should be resolved to allow the
11497     * message to be broadcast, as otherwise it may prevent one from receiving funds over the
11498     * corresponding channel.
11499     */
11500    struct LDKCResult_ECDSASignatureNoneZ (*sign_gossip_message)(const void *this_arg, struct LDKUnsignedGossipMessage msg);
11501    /**
11502     * Frees any resources associated with this object given its this_arg pointer.
11503     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11504     */
11505    void (*free)(void *this_arg);
11506 } LDKNodeSigner;
11507
11508 /**
11509  * A trait that can return signer instances for individual channels.
11510  */
11511 typedef struct LDKSignerProvider {
11512    /**
11513     * An opaque pointer which is passed to your function implementations as an argument.
11514     * This has no meaning in the LDK, and can be NULL or any other value.
11515     */
11516    void *this_arg;
11517    /**
11518     * Generates a unique `channel_keys_id` that can be used to obtain a [`Self::EcdsaSigner`] through
11519     * [`SignerProvider::derive_channel_signer`]. The `user_channel_id` is provided to allow
11520     * implementations of [`SignerProvider`] to maintain a mapping between itself and the generated
11521     * `channel_keys_id`.
11522     *
11523     * This method must return a different value each time it is called.
11524     */
11525    struct LDKThirtyTwoBytes (*generate_channel_keys_id)(const void *this_arg, bool inbound, uint64_t channel_value_satoshis, struct LDKU128 user_channel_id);
11526    /**
11527     * Derives the private key material backing a `Signer`.
11528     *
11529     * To derive a new `Signer`, a fresh `channel_keys_id` should be obtained through
11530     * [`SignerProvider::generate_channel_keys_id`]. Otherwise, an existing `Signer` can be
11531     * re-derived from its `channel_keys_id`, which can be obtained through its trait method
11532     * [`ChannelSigner::channel_keys_id`].
11533     */
11534    struct LDKWriteableEcdsaChannelSigner (*derive_channel_signer)(const void *this_arg, uint64_t channel_value_satoshis, struct LDKThirtyTwoBytes channel_keys_id);
11535    /**
11536     * Reads a [`Signer`] for this [`SignerProvider`] from the given input stream.
11537     * This is only called during deserialization of other objects which contain
11538     * [`WriteableEcdsaChannelSigner`]-implementing objects (i.e., [`ChannelMonitor`]s and [`ChannelManager`]s).
11539     * The bytes are exactly those which `<Self::Signer as Writeable>::write()` writes, and
11540     * contain no versioning scheme. You may wish to include your own version prefix and ensure
11541     * you've read all of the provided bytes to ensure no corruption occurred.
11542     *
11543     * This method is slowly being phased out -- it will only be called when reading objects
11544     * written by LDK versions prior to 0.0.113.
11545     *
11546     * [`Signer`]: Self::EcdsaSigner
11547     * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor
11548     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
11549     */
11550    struct LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ (*read_chan_signer)(const void *this_arg, struct LDKu8slice reader);
11551    /**
11552     * Get a script pubkey which we send funds to when claiming on-chain contestable outputs.
11553     *
11554     * If this function returns an error, this will result in a channel failing to open.
11555     *
11556     * This method should return a different value each time it is called, to avoid linking
11557     * on-chain funds across channels as controlled to the same user. `channel_keys_id` may be
11558     * used to derive a unique value for each channel.
11559     */
11560    struct LDKCResult_CVec_u8ZNoneZ (*get_destination_script)(const void *this_arg, struct LDKThirtyTwoBytes channel_keys_id);
11561    /**
11562     * Get a script pubkey which we will send funds to when closing a channel.
11563     *
11564     * If this function returns an error, this will result in a channel failing to open or close.
11565     * In the event of a failure when the counterparty is initiating a close, this can result in a
11566     * channel force close.
11567     *
11568     * This method should return a different value each time it is called, to avoid linking
11569     * on-chain funds across channels as controlled to the same user.
11570     */
11571    struct LDKCResult_ShutdownScriptNoneZ (*get_shutdown_scriptpubkey)(const void *this_arg);
11572    /**
11573     * Frees any resources associated with this object given its this_arg pointer.
11574     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11575     */
11576    void (*free)(void *this_arg);
11577 } LDKSignerProvider;
11578
11579 /**
11580  * A trait which should be implemented to provide feerate information on a number of time
11581  * horizons.
11582  *
11583  * If access to a local mempool is not feasible, feerate estimates should be fetched from a set of
11584  * third-parties hosting them. Note that this enables them to affect the propagation of your
11585  * pre-signed transactions at any time and therefore endangers the safety of channels funds. It
11586  * should be considered carefully as a deployment.
11587  *
11588  * Note that all of the functions implemented here *must* be reentrant-safe (obviously - they're
11589  * called from inside the library in response to chain events, P2P events, or timer events).
11590  *
11591  * LDK may generate a substantial number of fee-estimation calls in some cases. You should
11592  * pre-calculate and cache the fee estimate results to ensure you don't substantially slow HTLC
11593  * handling.
11594  */
11595 typedef struct LDKFeeEstimator {
11596    /**
11597     * An opaque pointer which is passed to your function implementations as an argument.
11598     * This has no meaning in the LDK, and can be NULL or any other value.
11599     */
11600    void *this_arg;
11601    /**
11602     * Gets estimated satoshis of fee required per 1000 Weight-Units.
11603     *
11604     * LDK will wrap this method and ensure that the value returned is no smaller than 253
11605     * (ie 1 satoshi-per-byte rounded up to ensure later round-downs don't put us below 1 satoshi-per-byte).
11606     *
11607     * The following unit conversions can be used to convert to sats/KW:
11608     *  * satoshis-per-byte * 250
11609     *  * satoshis-per-kbyte / 4
11610     */
11611    uint32_t (*get_est_sat_per_1000_weight)(const void *this_arg, enum LDKConfirmationTarget confirmation_target);
11612    /**
11613     * Frees any resources associated with this object given its this_arg pointer.
11614     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11615     */
11616    void (*free)(void *this_arg);
11617 } LDKFeeEstimator;
11618
11619
11620
11621 /**
11622  * Data to construct a [`BlindedHop`] for receiving a payment. This payload is custom to LDK and
11623  * may not be valid if received by another lightning implementation.
11624  */
11625 typedef struct MUST_USE_STRUCT LDKReceiveTlvs {
11626    /**
11627     * A pointer to the opaque Rust object.
11628     * Nearly everywhere, inner must be non-null, however in places where
11629     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11630     */
11631    LDKnativeReceiveTlvs *inner;
11632    /**
11633     * Indicates that this is the only struct which contains the same pointer.
11634     * Rust functions which take ownership of an object provided via an argument require
11635     * this to be true and invalidate the object pointed to by inner.
11636     */
11637    bool is_owned;
11638 } LDKReceiveTlvs;
11639
11640 /**
11641  * A trait defining behavior for routing an [`OnionMessage`].
11642  */
11643 typedef struct LDKMessageRouter {
11644    /**
11645     * An opaque pointer which is passed to your function implementations as an argument.
11646     * This has no meaning in the LDK, and can be NULL or any other value.
11647     */
11648    void *this_arg;
11649    /**
11650     * Returns a route for sending an [`OnionMessage`] to the given [`Destination`].
11651     */
11652    struct LDKCResult_OnionMessagePathNoneZ (*find_path)(const void *this_arg, struct LDKPublicKey sender, struct LDKCVec_PublicKeyZ peers, struct LDKDestination destination);
11653    /**
11654     * Creates [`BlindedPath`]s to the `recipient` node. The nodes in `peers` are assumed to be
11655     * direct peers with the `recipient`.
11656     */
11657    struct LDKCResult_CVec_BlindedPathZNoneZ (*create_blinded_paths)(const void *this_arg, struct LDKPublicKey recipient, struct LDKCVec_PublicKeyZ peers);
11658    /**
11659     * Frees any resources associated with this object given its this_arg pointer.
11660     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11661     */
11662    void (*free)(void *this_arg);
11663 } LDKMessageRouter;
11664
11665 /**
11666  * A trait defining behavior for routing a payment.
11667  */
11668 typedef struct LDKRouter {
11669    /**
11670     * An opaque pointer which is passed to your function implementations as an argument.
11671     * This has no meaning in the LDK, and can be NULL or any other value.
11672     */
11673    void *this_arg;
11674    /**
11675     * Finds a [`Route`] for a payment between the given `payer` and a payee.
11676     *
11677     * The `payee` and the payment's value are given in [`RouteParameters::payment_params`]
11678     * and [`RouteParameters::final_value_msat`], respectively.
11679     *
11680     * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None
11681     */
11682    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);
11683    /**
11684     * Finds a [`Route`] for a payment between the given `payer` and a payee.
11685     *
11686     * The `payee` and the payment's value are given in [`RouteParameters::payment_params`]
11687     * and [`RouteParameters::final_value_msat`], respectively.
11688     *
11689     * Includes a [`PaymentHash`] and a [`PaymentId`] to be able to correlate the request with a specific
11690     * payment.
11691     *
11692     * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None
11693     */
11694    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);
11695    /**
11696     * Creates [`BlindedPath`]s for payment to the `recipient` node. The channels in `first_hops`
11697     * are assumed to be with the `recipient`'s peers. The payment secret and any constraints are
11698     * given in `tlvs`.
11699     */
11700    struct LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ (*create_blinded_payment_paths)(const void *this_arg, struct LDKPublicKey recipient, struct LDKCVec_ChannelDetailsZ first_hops, struct LDKReceiveTlvs tlvs, uint64_t amount_msats);
11701    /**
11702     * Implementation of MessageRouter for this object.
11703     */
11704    struct LDKMessageRouter MessageRouter;
11705    /**
11706     * Frees any resources associated with this object given its this_arg pointer.
11707     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11708     */
11709    void (*free)(void *this_arg);
11710 } LDKRouter;
11711
11712
11713
11714 /**
11715  * A lightning node's channel state machine and payment management logic, which facilitates
11716  * sending, forwarding, and receiving payments through lightning channels.
11717  *
11718  * [`ChannelManager`] is parameterized by a number of components to achieve this.
11719  * - [`chain::Watch`] (typically [`ChainMonitor`]) for on-chain monitoring and enforcement of each
11720  *   channel
11721  * - [`BroadcasterInterface`] for broadcasting transactions related to opening, funding, and
11722  *   closing channels
11723  * - [`EntropySource`] for providing random data needed for cryptographic operations
11724  * - [`NodeSigner`] for cryptographic operations scoped to the node
11725  * - [`SignerProvider`] for providing signers whose operations are scoped to individual channels
11726  * - [`FeeEstimator`] to determine transaction fee rates needed to have a transaction mined in a
11727  *   timely manner
11728  * - [`Router`] for finding payment paths when initiating and retrying payments
11729  * - [`Logger`] for logging operational information of varying degrees
11730  *
11731  * Additionally, it implements the following traits:
11732  * - [`ChannelMessageHandler`] to handle off-chain channel activity from peers
11733  * - [`MessageSendEventsProvider`] to similarly send such messages to peers
11734  * - [`OffersMessageHandler`] for BOLT 12 message handling and sending
11735  * - [`EventsProvider`] to generate user-actionable [`Event`]s
11736  * - [`chain::Listen`] and [`chain::Confirm`] for notification of on-chain activity
11737  *
11738  * Thus, [`ChannelManager`] is typically used to parameterize a [`MessageHandler`] and an
11739  * [`OnionMessenger`]. The latter is required to support BOLT 12 functionality.
11740  *
11741  * # `ChannelManager` vs `ChannelMonitor`
11742  *
11743  * It's important to distinguish between the *off-chain* management and *on-chain* enforcement of
11744  * lightning channels. [`ChannelManager`] exchanges messages with peers to manage the off-chain
11745  * state of each channel. During this process, it generates a [`ChannelMonitor`] for each channel
11746  * and a [`ChannelMonitorUpdate`] for each relevant change, notifying its parameterized
11747  * [`chain::Watch`] of them.
11748  *
11749  * An implementation of [`chain::Watch`], such as [`ChainMonitor`], is responsible for aggregating
11750  * these [`ChannelMonitor`]s and applying any [`ChannelMonitorUpdate`]s to them. It then monitors
11751  * for any pertinent on-chain activity, enforcing claims as needed.
11752  *
11753  * This division of off-chain management and on-chain enforcement allows for interesting node
11754  * setups. For instance, on-chain enforcement could be moved to a separate host or have added
11755  * redundancy, possibly as a watchtower. See [`chain::Watch`] for the relevant interface.
11756  *
11757  * # Initialization
11758  *
11759  * Use [`ChannelManager::new`] with the most recent [`BlockHash`] when creating a fresh instance.
11760  * Otherwise, if restarting, construct [`ChannelManagerReadArgs`] with the necessary parameters and
11761  * references to any deserialized [`ChannelMonitor`]s that were previously persisted. Use this to
11762  * deserialize the [`ChannelManager`] and feed it any new chain data since it was last online, as
11763  * detailed in the [`ChannelManagerReadArgs`] documentation.
11764  *
11765  * ```
11766  * use bitcoin::BlockHash;
11767  * use bitcoin::network::constants::Network;
11768  * use lightning::chain::BestBlock;
11769  * # use lightning::chain::channelmonitor::ChannelMonitor;
11770  * use lightning::ln::channelmanager::{ChainParameters, ChannelManager, ChannelManagerReadArgs};
11771  * # use lightning::routing::gossip::NetworkGraph;
11772  * use lightning::util::config::UserConfig;
11773  * use lightning::util::ser::ReadableArgs;
11774  *
11775  * # fn read_channel_monitors() -> Vec<ChannelMonitor<lightning::sign::InMemorySigner>> { vec![] }
11776  * # fn example<
11777  * #     'a,
11778  * #     L: lightning::util::logger::Logger,
11779  * #     ES: lightning::sign::EntropySource,
11780  * #     S: for <'b> lightning::routing::scoring::LockableScore<'b, ScoreLookUp = SL>,
11781  * #     SL: lightning::routing::scoring::ScoreLookUp<ScoreParams = SP>,
11782  * #     SP: Sized,
11783  * #     R: lightning::io::Read,
11784  * # >(
11785  * #     fee_estimator: &dyn lightning::chain::chaininterface::FeeEstimator,
11786  * #     chain_monitor: &dyn lightning::chain::Watch<lightning::sign::InMemorySigner>,
11787  * #     tx_broadcaster: &dyn lightning::chain::chaininterface::BroadcasterInterface,
11788  * #     router: &lightning::routing::router::DefaultRouter<&NetworkGraph<&'a L>, &'a L, &ES, &S, SP, SL>,
11789  * #     logger: &L,
11790  * #     entropy_source: &ES,
11791  * #     node_signer: &dyn lightning::sign::NodeSigner,
11792  * #     signer_provider: &lightning::sign::DynSignerProvider,
11793  * #     best_block: lightning::chain::BestBlock,
11794  * #     current_timestamp: u32,
11795  * #     mut reader: R,
11796  * # ) -> Result<(), lightning::ln::msgs::DecodeError> {
11797  * // Fresh start with no channels
11798  * let params = ChainParameters {
11799  *     network: Network::Bitcoin,
11800  *     best_block,
11801  * };
11802  * let default_config = UserConfig::default();
11803  * let channel_manager = ChannelManager::new(
11804  *     fee_estimator, chain_monitor, tx_broadcaster, router, logger, entropy_source, node_signer,
11805  *     signer_provider, default_config, params, current_timestamp
11806  * );
11807  *
11808  * // Restart from deserialized data
11809  * let mut channel_monitors = read_channel_monitors();
11810  * let args = ChannelManagerReadArgs::new(
11811  *     entropy_source, node_signer, signer_provider, fee_estimator, chain_monitor, tx_broadcaster,
11812  *     router, logger, default_config, channel_monitors.iter_mut().collect()
11813  * );
11814  * let (block_hash, channel_manager) =
11815  *     <(BlockHash, ChannelManager<_, _, _, _, _, _, _, _>)>::read(&mut reader, args)?;
11816  *
11817  * // Update the ChannelManager and ChannelMonitors with the latest chain data
11818  * // ...
11819  *
11820  * // Move the monitors to the ChannelManager's chain::Watch parameter
11821  * for monitor in channel_monitors {
11822  *     chain_monitor.watch_channel(monitor.get_funding_txo().0, monitor);
11823  * }
11824  * # Ok(())
11825  * # }
11826  * ```
11827  *
11828  * # Operation
11829  *
11830  * The following is required for [`ChannelManager`] to function properly:
11831  * - Handle messages from peers using its [`ChannelMessageHandler`] implementation (typically
11832  *   called by [`PeerManager::read_event`] when processing network I/O)
11833  * - Send messages to peers obtained via its [`MessageSendEventsProvider`] implementation
11834  *   (typically initiated when [`PeerManager::process_events`] is called)
11835  * - Feed on-chain activity using either its [`chain::Listen`] or [`chain::Confirm`] implementation
11836  *   as documented by those traits
11837  * - Perform any periodic channel and payment checks by calling [`timer_tick_occurred`] roughly
11838  *   every minute
11839  * - Persist to disk whenever [`get_and_clear_needs_persistence`] returns `true` using a
11840  *   [`Persister`] such as a [`KVStore`] implementation
11841  * - Handle [`Event`]s obtained via its [`EventsProvider`] implementation
11842  *
11843  * The [`Future`] returned by [`get_event_or_persistence_needed_future`] is useful in determining
11844  * when the last two requirements need to be checked.
11845  *
11846  * The [`lightning-block-sync`] and [`lightning-transaction-sync`] crates provide utilities that
11847  * simplify feeding in on-chain activity using the [`chain::Listen`] and [`chain::Confirm`] traits,
11848  * respectively. The remaining requirements can be met using the [`lightning-background-processor`]
11849  * crate. For languages other than Rust, the availability of similar utilities may vary.
11850  *
11851  * # Channels
11852  *
11853  * [`ChannelManager`]'s primary function involves managing a channel state. Without channels,
11854  * payments can't be sent. Use [`list_channels`] or [`list_usable_channels`] for a snapshot of the
11855  * currently open channels.
11856  *
11857  * ```
11858  * # use lightning::ln::channelmanager::AChannelManager;
11859  * #
11860  * # fn example<T: AChannelManager>(channel_manager: T) {
11861  * # let channel_manager = channel_manager.get_cm();
11862  * let channels = channel_manager.list_usable_channels();
11863  * for details in channels {
11864  *     println!(\"{:?}\", details);
11865  * }
11866  * # }
11867  * ```
11868  *
11869  * Each channel is identified using a [`ChannelId`], which will change throughout the channel's
11870  * life cycle. Additionally, channels are assigned a `user_channel_id`, which is given in
11871  * [`Event`]s associated with the channel and serves as a fixed identifier but is otherwise unused
11872  * by [`ChannelManager`].
11873  *
11874  * ## Opening Channels
11875  *
11876  * To an open a channel with a peer, call [`create_channel`]. This will initiate the process of
11877  * opening an outbound channel, which requires self-funding when handling
11878  * [`Event::FundingGenerationReady`].
11879  *
11880  * ```
11881  * # use bitcoin::{ScriptBuf, Transaction};
11882  * # use bitcoin::secp256k1::PublicKey;
11883  * # use lightning::ln::channelmanager::AChannelManager;
11884  * # use lightning::events::{Event, EventsProvider};
11885  * #
11886  * # trait Wallet {
11887  * #     fn create_funding_transaction(
11888  * #         &self, _amount_sats: u64, _output_script: ScriptBuf
11889  * #     ) -> Transaction;
11890  * # }
11891  * #
11892  * # fn example<T: AChannelManager, W: Wallet>(channel_manager: T, wallet: W, peer_id: PublicKey) {
11893  * # let channel_manager = channel_manager.get_cm();
11894  * let value_sats = 1_000_000;
11895  * let push_msats = 10_000_000;
11896  * match channel_manager.create_channel(peer_id, value_sats, push_msats, 42, None, None) {
11897  *     Ok(channel_id) => println!(\"Opening channel {}\", channel_id),
11898  *     Err(e) => println!(\"Error opening channel: {:?}\", e),
11899  * }
11900  *
11901  * // On the event processing thread once the peer has responded
11902  * channel_manager.process_pending_events(&|event| match event {
11903  *     Event::FundingGenerationReady {
11904  *         temporary_channel_id, counterparty_node_id, channel_value_satoshis, output_script,
11905  *         user_channel_id, ..
11906  *     } => {
11907  *         assert_eq!(user_channel_id, 42);
11908  *         let funding_transaction = wallet.create_funding_transaction(
11909  *             channel_value_satoshis, output_script
11910  *         );
11911  *         match channel_manager.funding_transaction_generated(
11912  *             &temporary_channel_id, &counterparty_node_id, funding_transaction
11913  *         ) {
11914  *             Ok(()) => println!(\"Funding channel {}\", temporary_channel_id),
11915  *             Err(e) => println!(\"Error funding channel {}: {:?}\", temporary_channel_id, e),
11916  *         }
11917  *     },
11918  *     Event::ChannelPending { channel_id, user_channel_id, former_temporary_channel_id, .. } => {
11919  *         assert_eq!(user_channel_id, 42);
11920  *         println!(
11921  *             \"Channel {} now {} pending (funding transaction has been broadcasted)\", channel_id,
11922  *             former_temporary_channel_id.unwrap()
11923  *         );
11924  *     },
11925  *     Event::ChannelReady { channel_id, user_channel_id, .. } => {
11926  *         assert_eq!(user_channel_id, 42);
11927  *         println!(\"Channel {} ready\", channel_id);
11928  *     },
11929  *     // ...
11930  * #     _ => {},
11931  * });
11932  * # }
11933  * ```
11934  *
11935  * ## Accepting Channels
11936  *
11937  * Inbound channels are initiated by peers and are automatically accepted unless [`ChannelManager`]
11938  * has [`UserConfig::manually_accept_inbound_channels`] set. In that case, the channel may be
11939  * either accepted or rejected when handling [`Event::OpenChannelRequest`].
11940  *
11941  * ```
11942  * # use bitcoin::secp256k1::PublicKey;
11943  * # use lightning::ln::channelmanager::AChannelManager;
11944  * # use lightning::events::{Event, EventsProvider};
11945  * #
11946  * # fn is_trusted(counterparty_node_id: PublicKey) -> bool {
11947  * #     // ...
11948  * #     unimplemented!()
11949  * # }
11950  * #
11951  * # fn example<T: AChannelManager>(channel_manager: T) {
11952  * # let channel_manager = channel_manager.get_cm();
11953  * channel_manager.process_pending_events(&|event| match event {
11954  *     Event::OpenChannelRequest { temporary_channel_id, counterparty_node_id, ..  } => {
11955  *         if !is_trusted(counterparty_node_id) {
11956  *             match channel_manager.force_close_without_broadcasting_txn(
11957  *                 &temporary_channel_id, &counterparty_node_id
11958  *             ) {
11959  *                 Ok(()) => println!(\"Rejecting channel {}\", temporary_channel_id),
11960  *                 Err(e) => println!(\"Error rejecting channel {}: {:?}\", temporary_channel_id, e),
11961  *             }
11962  *             return;
11963  *         }
11964  *
11965  *         let user_channel_id = 43;
11966  *         match channel_manager.accept_inbound_channel(
11967  *             &temporary_channel_id, &counterparty_node_id, user_channel_id
11968  *         ) {
11969  *             Ok(()) => println!(\"Accepting channel {}\", temporary_channel_id),
11970  *             Err(e) => println!(\"Error accepting channel {}: {:?}\", temporary_channel_id, e),
11971  *         }
11972  *     },
11973  *     // ...
11974  * #     _ => {},
11975  * });
11976  * # }
11977  * ```
11978  *
11979  * ## Closing Channels
11980  *
11981  * There are two ways to close a channel: either cooperatively using [`close_channel`] or
11982  * unilaterally using [`force_close_broadcasting_latest_txn`]. The former is ideal as it makes for
11983  * lower fees and immediate access to funds. However, the latter may be necessary if the
11984  * counterparty isn't behaving properly or has gone offline. [`Event::ChannelClosed`] is generated
11985  * once the channel has been closed successfully.
11986  *
11987  * ```
11988  * # use bitcoin::secp256k1::PublicKey;
11989  * # use lightning::ln::types::ChannelId;
11990  * # use lightning::ln::channelmanager::AChannelManager;
11991  * # use lightning::events::{Event, EventsProvider};
11992  * #
11993  * # fn example<T: AChannelManager>(
11994  * #     channel_manager: T, channel_id: ChannelId, counterparty_node_id: PublicKey
11995  * # ) {
11996  * # let channel_manager = channel_manager.get_cm();
11997  * match channel_manager.close_channel(&channel_id, &counterparty_node_id) {
11998  *     Ok(()) => println!(\"Closing channel {}\", channel_id),
11999  *     Err(e) => println!(\"Error closing channel {}: {:?}\", channel_id, e),
12000  * }
12001  *
12002  * // On the event processing thread
12003  * channel_manager.process_pending_events(&|event| match event {
12004  *     Event::ChannelClosed { channel_id, user_channel_id, ..  } => {
12005  *         assert_eq!(user_channel_id, 42);
12006  *         println!(\"Channel {} closed\", channel_id);
12007  *     },
12008  *     // ...
12009  * #     _ => {},
12010  * });
12011  * # }
12012  * ```
12013  *
12014  * # Payments
12015  *
12016  * [`ChannelManager`] is responsible for sending, forwarding, and receiving payments through its
12017  * channels. A payment is typically initiated from a [BOLT 11] invoice or a [BOLT 12] offer, though
12018  * spontaneous (i.e., keysend) payments are also possible. Incoming payments don't require
12019  * maintaining any additional state as [`ChannelManager`] can reconstruct the [`PaymentPreimage`]
12020  * from the [`PaymentSecret`]. Sending payments, however, require tracking in order to retry failed
12021  * HTLCs.
12022  *
12023  * After a payment is initiated, it will appear in [`list_recent_payments`] until a short time
12024  * after either an [`Event::PaymentSent`] or [`Event::PaymentFailed`] is handled. Failed HTLCs
12025  * for a payment will be retried according to the payment's [`Retry`] strategy or until
12026  * [`abandon_payment`] is called.
12027  *
12028  * ## BOLT 11 Invoices
12029  *
12030  * The [`lightning-invoice`] crate is useful for creating BOLT 11 invoices. Specifically, use the
12031  * functions in its `utils` module for constructing invoices that are compatible with
12032  * [`ChannelManager`]. These functions serve as a convenience for building invoices with the
12033  * [`PaymentHash`] and [`PaymentSecret`] returned from [`create_inbound_payment`]. To provide your
12034  * own [`PaymentHash`], use [`create_inbound_payment_for_hash`] or the corresponding functions in
12035  * the [`lightning-invoice`] `utils` module.
12036  *
12037  * [`ChannelManager`] generates an [`Event::PaymentClaimable`] once the full payment has been
12038  * received. Call [`claim_funds`] to release the [`PaymentPreimage`], which in turn will result in
12039  * an [`Event::PaymentClaimed`].
12040  *
12041  * ```
12042  * # use lightning::events::{Event, EventsProvider, PaymentPurpose};
12043  * # use lightning::ln::channelmanager::AChannelManager;
12044  * #
12045  * # fn example<T: AChannelManager>(channel_manager: T) {
12046  * # let channel_manager = channel_manager.get_cm();
12047  * // Or use utils::create_invoice_from_channelmanager
12048  * let known_payment_hash = match channel_manager.create_inbound_payment(
12049  *     Some(10_000_000), 3600, None
12050  * ) {
12051  *     Ok((payment_hash, _payment_secret)) => {
12052  *         println!(\"Creating inbound payment {}\", payment_hash);
12053  *         payment_hash
12054  *     },
12055  *     Err(()) => panic!(\"Error creating inbound payment\"),
12056  * };
12057  *
12058  * // On the event processing thread
12059  * channel_manager.process_pending_events(&|event| match event {
12060  *     Event::PaymentClaimable { payment_hash, purpose, .. } => match purpose {
12061  *         PaymentPurpose::Bolt11InvoicePayment { payment_preimage: Some(payment_preimage), .. } => {
12062  *             assert_eq!(payment_hash, known_payment_hash);
12063  *             println!(\"Claiming payment {}\", payment_hash);
12064  *             channel_manager.claim_funds(payment_preimage);
12065  *         },
12066  *         PaymentPurpose::Bolt11InvoicePayment { payment_preimage: None, .. } => {
12067  *             println!(\"Unknown payment hash: {}\", payment_hash);
12068  *         },
12069  *         PaymentPurpose::SpontaneousPayment(payment_preimage) => {
12070  *             assert_ne!(payment_hash, known_payment_hash);
12071  *             println!(\"Claiming spontaneous payment {}\", payment_hash);
12072  *             channel_manager.claim_funds(payment_preimage);
12073  *         },
12074  *         // ...
12075  * #         _ => {},
12076  *     },
12077  *     Event::PaymentClaimed { payment_hash, amount_msat, .. } => {
12078  *         assert_eq!(payment_hash, known_payment_hash);
12079  *         println!(\"Claimed {} msats\", amount_msat);
12080  *     },
12081  *     // ...
12082  * #     _ => {},
12083  * });
12084  * # }
12085  * ```
12086  *
12087  * For paying an invoice, [`lightning-invoice`] provides a `payment` module with convenience
12088  * functions for use with [`send_payment`].
12089  *
12090  * ```
12091  * # use lightning::events::{Event, EventsProvider};
12092  * # use lightning::ln::types::PaymentHash;
12093  * # use lightning::ln::channelmanager::{AChannelManager, PaymentId, RecentPaymentDetails, RecipientOnionFields, Retry};
12094  * # use lightning::routing::router::RouteParameters;
12095  * #
12096  * # fn example<T: AChannelManager>(
12097  * #     channel_manager: T, payment_hash: PaymentHash, recipient_onion: RecipientOnionFields,
12098  * #     route_params: RouteParameters, retry: Retry
12099  * # ) {
12100  * # let channel_manager = channel_manager.get_cm();
12101  * // let (payment_hash, recipient_onion, route_params) =
12102  * //     payment::payment_parameters_from_invoice(&invoice);
12103  * let payment_id = PaymentId([42; 32]);
12104  * match channel_manager.send_payment(
12105  *     payment_hash, recipient_onion, payment_id, route_params, retry
12106  * ) {
12107  *     Ok(()) => println!(\"Sending payment with hash {}\", payment_hash),
12108  *     Err(e) => println!(\"Failed sending payment with hash {}: {:?}\", payment_hash, e),
12109  * }
12110  *
12111  * let expected_payment_id = payment_id;
12112  * let expected_payment_hash = payment_hash;
12113  * assert!(
12114  *     channel_manager.list_recent_payments().iter().find(|details| matches!(
12115  *         details,
12116  *         RecentPaymentDetails::Pending {
12117  *             payment_id: expected_payment_id,
12118  *             payment_hash: expected_payment_hash,
12119  *             ..
12120  *         }
12121  *     )).is_some()
12122  * );
12123  *
12124  * // On the event processing thread
12125  * channel_manager.process_pending_events(&|event| match event {
12126  *     Event::PaymentSent { payment_hash, .. } => println!(\"Paid {}\", payment_hash),
12127  *     Event::PaymentFailed { payment_hash, .. } => println!(\"Failed paying {}\", payment_hash),
12128  *     // ...
12129  * #     _ => {},
12130  * });
12131  * # }
12132  * ```
12133  *
12134  * ## BOLT 12 Offers
12135  *
12136  * The [`offers`] module is useful for creating BOLT 12 offers. An [`Offer`] is a precursor to a
12137  * [`Bolt12Invoice`], which must first be requested by the payer. The interchange of these messages
12138  * as defined in the specification is handled by [`ChannelManager`] and its implementation of
12139  * [`OffersMessageHandler`]. However, this only works with an [`Offer`] created using a builder
12140  * returned by [`create_offer_builder`]. With this approach, BOLT 12 offers and invoices are
12141  * stateless just as BOLT 11 invoices are.
12142  *
12143  * ```
12144  * # use lightning::events::{Event, EventsProvider, PaymentPurpose};
12145  * # use lightning::ln::channelmanager::AChannelManager;
12146  * # use lightning::offers::parse::Bolt12SemanticError;
12147  * #
12148  * # fn example<T: AChannelManager>(channel_manager: T) -> Result<(), Bolt12SemanticError> {
12149  * # let channel_manager = channel_manager.get_cm();
12150  * let offer = channel_manager
12151  *     .create_offer_builder()?
12152  * # ;
12153  * # // Needed for compiling for c_bindings
12154  * # let builder: lightning::offers::offer::OfferBuilder<_, _> = offer.into();
12155  * # let offer = builder
12156  *     .description(\"coffee\".to_string())
12157  *     .amount_msats(10_000_000)
12158  *     .build()?;
12159  * let bech32_offer = offer.to_string();
12160  *
12161  * // On the event processing thread
12162  * channel_manager.process_pending_events(&|event| match event {
12163  *     Event::PaymentClaimable { payment_hash, purpose, .. } => match purpose {
12164  *         PaymentPurpose::Bolt12OfferPayment { payment_preimage: Some(payment_preimage), .. } => {
12165  *             println!(\"Claiming payment {}\", payment_hash);
12166  *             channel_manager.claim_funds(payment_preimage);
12167  *         },
12168  *         PaymentPurpose::Bolt12OfferPayment { payment_preimage: None, .. } => {
12169  *             println!(\"Unknown payment hash: {}\", payment_hash);
12170  *         },
12171  *         // ...
12172  * #         _ => {},
12173  *     },
12174  *     Event::PaymentClaimed { payment_hash, amount_msat, .. } => {
12175  *         println!(\"Claimed {} msats\", amount_msat);
12176  *     },
12177  *     // ...
12178  * #     _ => {},
12179  * });
12180  * # Ok(())
12181  * # }
12182  * ```
12183  *
12184  * Use [`pay_for_offer`] to initiated payment, which sends an [`InvoiceRequest`] for an [`Offer`]
12185  * and pays the [`Bolt12Invoice`] response. In addition to success and failure events,
12186  * [`ChannelManager`] may also generate an [`Event::InvoiceRequestFailed`].
12187  *
12188  * ```
12189  * # use lightning::events::{Event, EventsProvider};
12190  * # use lightning::ln::channelmanager::{AChannelManager, PaymentId, RecentPaymentDetails, Retry};
12191  * # use lightning::offers::offer::Offer;
12192  * #
12193  * # fn example<T: AChannelManager>(
12194  * #     channel_manager: T, offer: &Offer, quantity: Option<u64>, amount_msats: Option<u64>,
12195  * #     payer_note: Option<String>, retry: Retry, max_total_routing_fee_msat: Option<u64>
12196  * # ) {
12197  * # let channel_manager = channel_manager.get_cm();
12198  * let payment_id = PaymentId([42; 32]);
12199  * match channel_manager.pay_for_offer(
12200  *     offer, quantity, amount_msats, payer_note, payment_id, retry, max_total_routing_fee_msat
12201  * ) {
12202  *     Ok(()) => println!(\"Requesting invoice for offer\"),
12203  *     Err(e) => println!(\"Unable to request invoice for offer: {:?}\", e),
12204  * }
12205  *
12206  * // First the payment will be waiting on an invoice
12207  * let expected_payment_id = payment_id;
12208  * assert!(
12209  *     channel_manager.list_recent_payments().iter().find(|details| matches!(
12210  *         details,
12211  *         RecentPaymentDetails::AwaitingInvoice { payment_id: expected_payment_id }
12212  *     )).is_some()
12213  * );
12214  *
12215  * // Once the invoice is received, a payment will be sent
12216  * assert!(
12217  *     channel_manager.list_recent_payments().iter().find(|details| matches!(
12218  *         details,
12219  *         RecentPaymentDetails::Pending { payment_id: expected_payment_id, ..  }
12220  *     )).is_some()
12221  * );
12222  *
12223  * // On the event processing thread
12224  * channel_manager.process_pending_events(&|event| match event {
12225  *     Event::PaymentSent { payment_id: Some(payment_id), .. } => println!(\"Paid {}\", payment_id),
12226  *     Event::PaymentFailed { payment_id, .. } => println!(\"Failed paying {}\", payment_id),
12227  *     Event::InvoiceRequestFailed { payment_id, .. } => println!(\"Failed paying {}\", payment_id),
12228  *     // ...
12229  * #     _ => {},
12230  * });
12231  * # }
12232  * ```
12233  *
12234  * ## BOLT 12 Refunds
12235  *
12236  * A [`Refund`] is a request for an invoice to be paid. Like *paying* for an [`Offer`], *creating*
12237  * a [`Refund`] involves maintaining state since it represents a future outbound payment.
12238  * Therefore, use [`create_refund_builder`] when creating one, otherwise [`ChannelManager`] will
12239  * refuse to pay any corresponding [`Bolt12Invoice`] that it receives.
12240  *
12241  * ```
12242  * # use core::time::Duration;
12243  * # use lightning::events::{Event, EventsProvider};
12244  * # use lightning::ln::channelmanager::{AChannelManager, PaymentId, RecentPaymentDetails, Retry};
12245  * # use lightning::offers::parse::Bolt12SemanticError;
12246  * #
12247  * # fn example<T: AChannelManager>(
12248  * #     channel_manager: T, amount_msats: u64, absolute_expiry: Duration, retry: Retry,
12249  * #     max_total_routing_fee_msat: Option<u64>
12250  * # ) -> Result<(), Bolt12SemanticError> {
12251  * # let channel_manager = channel_manager.get_cm();
12252  * let payment_id = PaymentId([42; 32]);
12253  * let refund = channel_manager
12254  *     .create_refund_builder(
12255  *         amount_msats, absolute_expiry, payment_id, retry, max_total_routing_fee_msat
12256  *     )?
12257  * # ;
12258  * # // Needed for compiling for c_bindings
12259  * # let builder: lightning::offers::refund::RefundBuilder<_> = refund.into();
12260  * # let refund = builder
12261  *     .description(\"coffee\".to_string())
12262  *     .payer_note(\"refund for order 1234\".to_string())
12263  *     .build()?;
12264  * let bech32_refund = refund.to_string();
12265  *
12266  * // First the payment will be waiting on an invoice
12267  * let expected_payment_id = payment_id;
12268  * assert!(
12269  *     channel_manager.list_recent_payments().iter().find(|details| matches!(
12270  *         details,
12271  *         RecentPaymentDetails::AwaitingInvoice { payment_id: expected_payment_id }
12272  *     )).is_some()
12273  * );
12274  *
12275  * // Once the invoice is received, a payment will be sent
12276  * assert!(
12277  *     channel_manager.list_recent_payments().iter().find(|details| matches!(
12278  *         details,
12279  *         RecentPaymentDetails::Pending { payment_id: expected_payment_id, ..  }
12280  *     )).is_some()
12281  * );
12282  *
12283  * // On the event processing thread
12284  * channel_manager.process_pending_events(&|event| match event {
12285  *     Event::PaymentSent { payment_id: Some(payment_id), .. } => println!(\"Paid {}\", payment_id),
12286  *     Event::PaymentFailed { payment_id, .. } => println!(\"Failed paying {}\", payment_id),
12287  *     // ...
12288  * #     _ => {},
12289  * });
12290  * # Ok(())
12291  * # }
12292  * ```
12293  *
12294  * Use [`request_refund_payment`] to send a [`Bolt12Invoice`] for receiving the refund. Similar to
12295  * *creating* an [`Offer`], this is stateless as it represents an inbound payment.
12296  *
12297  * ```
12298  * # use lightning::events::{Event, EventsProvider, PaymentPurpose};
12299  * # use lightning::ln::channelmanager::AChannelManager;
12300  * # use lightning::offers::refund::Refund;
12301  * #
12302  * # fn example<T: AChannelManager>(channel_manager: T, refund: &Refund) {
12303  * # let channel_manager = channel_manager.get_cm();
12304  * let known_payment_hash = match channel_manager.request_refund_payment(refund) {
12305  *     Ok(invoice) => {
12306  *         let payment_hash = invoice.payment_hash();
12307  *         println!(\"Requesting refund payment {}\", payment_hash);
12308  *         payment_hash
12309  *     },
12310  *     Err(e) => panic!(\"Unable to request payment for refund: {:?}\", e),
12311  * };
12312  *
12313  * // On the event processing thread
12314  * channel_manager.process_pending_events(&|event| match event {
12315  *     Event::PaymentClaimable { payment_hash, purpose, .. } => match purpose {
12316  *     \tPaymentPurpose::Bolt12RefundPayment { payment_preimage: Some(payment_preimage), .. } => {
12317  *             assert_eq!(payment_hash, known_payment_hash);
12318  *             println!(\"Claiming payment {}\", payment_hash);
12319  *             channel_manager.claim_funds(payment_preimage);
12320  *         },
12321  *     \tPaymentPurpose::Bolt12RefundPayment { payment_preimage: None, .. } => {
12322  *             println!(\"Unknown payment hash: {}\", payment_hash);
12323  *     \t},
12324  *         // ...
12325  * #         _ => {},
12326  *     },
12327  *     Event::PaymentClaimed { payment_hash, amount_msat, .. } => {
12328  *         assert_eq!(payment_hash, known_payment_hash);
12329  *         println!(\"Claimed {} msats\", amount_msat);
12330  *     },
12331  *     // ...
12332  * #     _ => {},
12333  * });
12334  * # }
12335  * ```
12336  *
12337  * # Persistence
12338  *
12339  * Implements [`Writeable`] to write out all channel state to disk. Implies [`peer_disconnected`] for
12340  * all peers during write/read (though does not modify this instance, only the instance being
12341  * serialized). This will result in any channels which have not yet exchanged [`funding_created`] (i.e.,
12342  * called [`funding_transaction_generated`] for outbound channels) being closed.
12343  *
12344  * Note that you can be a bit lazier about writing out `ChannelManager` than you can be with
12345  * [`ChannelMonitor`]. With [`ChannelMonitor`] you MUST durably write each
12346  * [`ChannelMonitorUpdate`] before returning from
12347  * [`chain::Watch::watch_channel`]/[`update_channel`] or before completing async writes. With
12348  * `ChannelManager`s, writing updates happens out-of-band (and will prevent any other
12349  * `ChannelManager` operations from occurring during the serialization process). If the
12350  * deserialized version is out-of-date compared to the [`ChannelMonitor`] passed by reference to
12351  * [`read`], those channels will be force-closed based on the `ChannelMonitor` state and no funds
12352  * will be lost (modulo on-chain transaction fees).
12353  *
12354  * Note that the deserializer is only implemented for `(`[`BlockHash`]`, `[`ChannelManager`]`)`, which
12355  * tells you the last block hash which was connected. You should get the best block tip before using the manager.
12356  * See [`chain::Listen`] and [`chain::Confirm`] for more details.
12357  *
12358  * # `ChannelUpdate` Messages
12359  *
12360  * Note that `ChannelManager` is responsible for tracking liveness of its channels and generating
12361  * [`ChannelUpdate`] messages informing peers that the channel is temporarily disabled. To avoid
12362  * spam due to quick disconnection/reconnection, updates are not sent until the channel has been
12363  * offline for a full minute. In order to track this, you must call
12364  * [`timer_tick_occurred`] roughly once per minute, though it doesn't have to be perfect.
12365  *
12366  * # DoS Mitigation
12367  *
12368  * To avoid trivial DoS issues, `ChannelManager` limits the number of inbound connections and
12369  * inbound channels without confirmed funding transactions. This may result in nodes which we do
12370  * not have a channel with being unable to connect to us or open new channels with us if we have
12371  * many peers with unfunded channels.
12372  *
12373  * Because it is an indication of trust, inbound channels which we've accepted as 0conf are
12374  * exempted from the count of unfunded channels. Similarly, outbound channels and connections are
12375  * never limited. Please ensure you limit the count of such channels yourself.
12376  *
12377  * # Type Aliases
12378  *
12379  * Rather than using a plain `ChannelManager`, it is preferable to use either a [`SimpleArcChannelManager`]
12380  * a [`SimpleRefChannelManager`], for conciseness. See their documentation for more details, but
12381  * essentially you should default to using a [`SimpleRefChannelManager`], and use a
12382  * [`SimpleArcChannelManager`] when you require a `ChannelManager` with a static lifetime, such as when
12383  * you're using lightning-net-tokio.
12384  *
12385  * [`ChainMonitor`]: crate::chain::chainmonitor::ChainMonitor
12386  * [`MessageHandler`]: crate::ln::peer_handler::MessageHandler
12387  * [`OnionMessenger`]: crate::onion_message::messenger::OnionMessenger
12388  * [`PeerManager::read_event`]: crate::ln::peer_handler::PeerManager::read_event
12389  * [`PeerManager::process_events`]: crate::ln::peer_handler::PeerManager::process_events
12390  * [`timer_tick_occurred`]: Self::timer_tick_occurred
12391  * [`get_and_clear_needs_persistence`]: Self::get_and_clear_needs_persistence
12392  * [`Persister`]: crate::util::persist::Persister
12393  * [`KVStore`]: crate::util::persist::KVStore
12394  * [`get_event_or_persistence_needed_future`]: Self::get_event_or_persistence_needed_future
12395  * [`lightning-block-sync`]: https://docs.rs/lightning_block_sync/latest/lightning_block_sync
12396  * [`lightning-transaction-sync`]: https://docs.rs/lightning_transaction_sync/latest/lightning_transaction_sync
12397  * [`lightning-background-processor`]: https://docs.rs/lightning_background_processor/lightning_background_processor
12398  * [`list_channels`]: Self::list_channels
12399  * [`list_usable_channels`]: Self::list_usable_channels
12400  * [`create_channel`]: Self::create_channel
12401  * [`close_channel`]: Self::force_close_broadcasting_latest_txn
12402  * [`force_close_broadcasting_latest_txn`]: Self::force_close_broadcasting_latest_txn
12403  * [BOLT 11]: https://github.com/lightning/bolts/blob/master/11-payment-encoding.md
12404  * [BOLT 12]: https://github.com/rustyrussell/lightning-rfc/blob/guilt/offers/12-offer-encoding.md
12405  * [`list_recent_payments`]: Self::list_recent_payments
12406  * [`abandon_payment`]: Self::abandon_payment
12407  * [`lightning-invoice`]: https://docs.rs/lightning_invoice/latest/lightning_invoice
12408  * [`create_inbound_payment`]: Self::create_inbound_payment
12409  * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
12410  * [`claim_funds`]: Self::claim_funds
12411  * [`send_payment`]: Self::send_payment
12412  * [`offers`]: crate::offers
12413  * [`create_offer_builder`]: Self::create_offer_builder
12414  * [`pay_for_offer`]: Self::pay_for_offer
12415  * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
12416  * [`create_refund_builder`]: Self::create_refund_builder
12417  * [`request_refund_payment`]: Self::request_refund_payment
12418  * [`peer_disconnected`]: msgs::ChannelMessageHandler::peer_disconnected
12419  * [`funding_created`]: msgs::FundingCreated
12420  * [`funding_transaction_generated`]: Self::funding_transaction_generated
12421  * [`BlockHash`]: bitcoin::hash_types::BlockHash
12422  * [`update_channel`]: chain::Watch::update_channel
12423  * [`ChannelUpdate`]: msgs::ChannelUpdate
12424  * [`read`]: ReadableArgs::read
12425  */
12426 typedef struct MUST_USE_STRUCT LDKChannelManager {
12427    /**
12428     * A pointer to the opaque Rust object.
12429     * Nearly everywhere, inner must be non-null, however in places where
12430     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12431     */
12432    LDKnativeChannelManager *inner;
12433    /**
12434     * Indicates that this is the only struct which contains the same pointer.
12435     * Rust functions which take ownership of an object provided via an argument require
12436     * this to be true and invalidate the object pointed to by inner.
12437     */
12438    bool is_owned;
12439 } LDKChannelManager;
12440
12441 /**
12442  * A tuple of 2 elements. See the individual fields for the types contained.
12443  */
12444 typedef struct LDKC2Tuple_ThirtyTwoBytesChannelManagerZ {
12445    /**
12446     * The element at position 0
12447     */
12448    struct LDKThirtyTwoBytes a;
12449    /**
12450     * The element at position 1
12451     */
12452    struct LDKChannelManager b;
12453 } LDKC2Tuple_ThirtyTwoBytesChannelManagerZ;
12454
12455 /**
12456  * The contents of CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ
12457  */
12458 typedef union LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr {
12459    /**
12460     * A pointer to the contents in the success state.
12461     * Reading from this pointer when `result_ok` is not set is undefined.
12462     */
12463    struct LDKC2Tuple_ThirtyTwoBytesChannelManagerZ *result;
12464    /**
12465     * A pointer to the contents in the error state.
12466     * Reading from this pointer when `result_ok` is set is undefined.
12467     */
12468    struct LDKDecodeError *err;
12469 } LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr;
12470
12471 /**
12472  * A CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ represents the result of a fallible operation,
12473  * containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
12474  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
12475  */
12476 typedef struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ {
12477    /**
12478     * The contents of this CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ, accessible via either
12479     * `err` or `result` depending on the state of `result_ok`.
12480     */
12481    union LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr contents;
12482    /**
12483     * Whether this CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ represents a success state.
12484     */
12485    bool result_ok;
12486 } LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ;
12487
12488 /**
12489  * Options for how to set the max dust exposure allowed on a channel. See
12490  * [`ChannelConfig::max_dust_htlc_exposure`] for details.
12491  */
12492 typedef enum LDKMaxDustHTLCExposure_Tag {
12493    /**
12494     * This sets a fixed limit on the total dust exposure in millisatoshis. Setting this too low
12495     * may prevent the sending or receipt of low-value HTLCs on high-traffic nodes, however this
12496     * limit is very important to prevent stealing of large amounts of dust HTLCs by miners
12497     * through [fee griefing
12498     * attacks](https://lists.linuxfoundation.org/pipermail/lightning-dev/2020-May/002714.html).
12499     *
12500     * Note that if the feerate increases significantly, without a manual increase
12501     * to this maximum the channel may be unable to send/receive HTLCs between the maximum dust
12502     * exposure and the new minimum value for HTLCs to be economically viable to claim.
12503     */
12504    LDKMaxDustHTLCExposure_FixedLimitMsat,
12505    /**
12506     * This sets a multiplier on the [`ConfirmationTarget::OnChainSweep`] feerate (in sats/KW) to
12507     * determine the maximum allowed dust exposure. If this variant is used then the maximum dust
12508     * exposure in millisatoshis is calculated as:
12509     * `feerate_per_kw * value`. For example, with our default value
12510     * `FeeRateMultiplier(10_000)`:
12511     *
12512     * - For the minimum fee rate of 1 sat/vByte (250 sat/KW, although the minimum
12513     * defaults to 253 sats/KW for rounding, see [`FeeEstimator`]), the max dust exposure would
12514     * be 253 * 10_000 = 2,530,000 msats.
12515     * - For a fee rate of 30 sat/vByte (7500 sat/KW), the max dust exposure would be
12516     * 7500 * 50_000 = 75,000,000 msats (0.00075 BTC).
12517     *
12518     * Note, if you're using a third-party fee estimator, this may leave you more exposed to a
12519     * fee griefing attack, where your fee estimator may purposely overestimate the fee rate,
12520     * causing you to accept more dust HTLCs than you would otherwise.
12521     *
12522     * This variant is primarily meant to serve pre-anchor channels, as HTLC fees being included
12523     * on HTLC outputs means your channel may be subject to more dust exposure in the event of
12524     * increases in fee rate.
12525     *
12526     * # Backwards Compatibility
12527     * This variant only became available in LDK 0.0.116, so if you downgrade to a prior version
12528     * by default this will be set to a [`Self::FixedLimitMsat`] of 5,000,000 msat.
12529     *
12530     * [`FeeEstimator`]: crate::chain::chaininterface::FeeEstimator
12531     * [`ConfirmationTarget::OnChainSweep`]: crate::chain::chaininterface::ConfirmationTarget::OnChainSweep
12532     */
12533    LDKMaxDustHTLCExposure_FeeRateMultiplier,
12534    /**
12535     * Must be last for serialization purposes
12536     */
12537    LDKMaxDustHTLCExposure_Sentinel,
12538 } LDKMaxDustHTLCExposure_Tag;
12539
12540 typedef struct MUST_USE_STRUCT LDKMaxDustHTLCExposure {
12541    LDKMaxDustHTLCExposure_Tag tag;
12542    union {
12543       struct {
12544          uint64_t fixed_limit_msat;
12545       };
12546       struct {
12547          uint64_t fee_rate_multiplier;
12548       };
12549    };
12550 } LDKMaxDustHTLCExposure;
12551
12552 /**
12553  * The contents of CResult_MaxDustHTLCExposureDecodeErrorZ
12554  */
12555 typedef union LDKCResult_MaxDustHTLCExposureDecodeErrorZPtr {
12556    /**
12557     * A pointer to the contents in the success state.
12558     * Reading from this pointer when `result_ok` is not set is undefined.
12559     */
12560    struct LDKMaxDustHTLCExposure *result;
12561    /**
12562     * A pointer to the contents in the error state.
12563     * Reading from this pointer when `result_ok` is set is undefined.
12564     */
12565    struct LDKDecodeError *err;
12566 } LDKCResult_MaxDustHTLCExposureDecodeErrorZPtr;
12567
12568 /**
12569  * A CResult_MaxDustHTLCExposureDecodeErrorZ represents the result of a fallible operation,
12570  * containing a crate::lightning::util::config::MaxDustHTLCExposure on success and a crate::lightning::ln::msgs::DecodeError on failure.
12571  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
12572  */
12573 typedef struct LDKCResult_MaxDustHTLCExposureDecodeErrorZ {
12574    /**
12575     * The contents of this CResult_MaxDustHTLCExposureDecodeErrorZ, accessible via either
12576     * `err` or `result` depending on the state of `result_ok`.
12577     */
12578    union LDKCResult_MaxDustHTLCExposureDecodeErrorZPtr contents;
12579    /**
12580     * Whether this CResult_MaxDustHTLCExposureDecodeErrorZ represents a success state.
12581     */
12582    bool result_ok;
12583 } LDKCResult_MaxDustHTLCExposureDecodeErrorZ;
12584
12585
12586
12587 /**
12588  * Options which apply on a per-channel basis and may change at runtime or based on negotiation
12589  * with our counterparty.
12590  */
12591 typedef struct MUST_USE_STRUCT LDKChannelConfig {
12592    /**
12593     * A pointer to the opaque Rust object.
12594     * Nearly everywhere, inner must be non-null, however in places where
12595     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12596     */
12597    LDKnativeChannelConfig *inner;
12598    /**
12599     * Indicates that this is the only struct which contains the same pointer.
12600     * Rust functions which take ownership of an object provided via an argument require
12601     * this to be true and invalidate the object pointed to by inner.
12602     */
12603    bool is_owned;
12604 } LDKChannelConfig;
12605
12606 /**
12607  * The contents of CResult_ChannelConfigDecodeErrorZ
12608  */
12609 typedef union LDKCResult_ChannelConfigDecodeErrorZPtr {
12610    /**
12611     * A pointer to the contents in the success state.
12612     * Reading from this pointer when `result_ok` is not set is undefined.
12613     */
12614    struct LDKChannelConfig *result;
12615    /**
12616     * A pointer to the contents in the error state.
12617     * Reading from this pointer when `result_ok` is set is undefined.
12618     */
12619    struct LDKDecodeError *err;
12620 } LDKCResult_ChannelConfigDecodeErrorZPtr;
12621
12622 /**
12623  * A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
12624  * containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
12625  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
12626  */
12627 typedef struct LDKCResult_ChannelConfigDecodeErrorZ {
12628    /**
12629     * The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
12630     * `err` or `result` depending on the state of `result_ok`.
12631     */
12632    union LDKCResult_ChannelConfigDecodeErrorZPtr contents;
12633    /**
12634     * Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
12635     */
12636    bool result_ok;
12637 } LDKCResult_ChannelConfigDecodeErrorZ;
12638
12639 /**
12640  * An enum which can either contain a crate::lightning::util::config::MaxDustHTLCExposure or not
12641  */
12642 typedef enum LDKCOption_MaxDustHTLCExposureZ_Tag {
12643    /**
12644     * When we're in this state, this COption_MaxDustHTLCExposureZ contains a crate::lightning::util::config::MaxDustHTLCExposure
12645     */
12646    LDKCOption_MaxDustHTLCExposureZ_Some,
12647    /**
12648     * When we're in this state, this COption_MaxDustHTLCExposureZ contains nothing
12649     */
12650    LDKCOption_MaxDustHTLCExposureZ_None,
12651    /**
12652     * Must be last for serialization purposes
12653     */
12654    LDKCOption_MaxDustHTLCExposureZ_Sentinel,
12655 } LDKCOption_MaxDustHTLCExposureZ_Tag;
12656
12657 typedef struct LDKCOption_MaxDustHTLCExposureZ {
12658    LDKCOption_MaxDustHTLCExposureZ_Tag tag;
12659    union {
12660       struct {
12661          struct LDKMaxDustHTLCExposure some;
12662       };
12663    };
12664 } LDKCOption_MaxDustHTLCExposureZ;
12665
12666 /**
12667  * An enum which can either contain a crate::lightning::util::errors::APIError or not
12668  */
12669 typedef enum LDKCOption_APIErrorZ_Tag {
12670    /**
12671     * When we're in this state, this COption_APIErrorZ contains a crate::lightning::util::errors::APIError
12672     */
12673    LDKCOption_APIErrorZ_Some,
12674    /**
12675     * When we're in this state, this COption_APIErrorZ contains nothing
12676     */
12677    LDKCOption_APIErrorZ_None,
12678    /**
12679     * Must be last for serialization purposes
12680     */
12681    LDKCOption_APIErrorZ_Sentinel,
12682 } LDKCOption_APIErrorZ_Tag;
12683
12684 typedef struct LDKCOption_APIErrorZ {
12685    LDKCOption_APIErrorZ_Tag tag;
12686    union {
12687       struct {
12688          struct LDKAPIError some;
12689       };
12690    };
12691 } LDKCOption_APIErrorZ;
12692
12693 /**
12694  * The contents of CResult_COption_APIErrorZDecodeErrorZ
12695  */
12696 typedef union LDKCResult_COption_APIErrorZDecodeErrorZPtr {
12697    /**
12698     * A pointer to the contents in the success state.
12699     * Reading from this pointer when `result_ok` is not set is undefined.
12700     */
12701    struct LDKCOption_APIErrorZ *result;
12702    /**
12703     * A pointer to the contents in the error state.
12704     * Reading from this pointer when `result_ok` is set is undefined.
12705     */
12706    struct LDKDecodeError *err;
12707 } LDKCResult_COption_APIErrorZDecodeErrorZPtr;
12708
12709 /**
12710  * A CResult_COption_APIErrorZDecodeErrorZ represents the result of a fallible operation,
12711  * containing a crate::c_types::derived::COption_APIErrorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
12712  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
12713  */
12714 typedef struct LDKCResult_COption_APIErrorZDecodeErrorZ {
12715    /**
12716     * The contents of this CResult_COption_APIErrorZDecodeErrorZ, accessible via either
12717     * `err` or `result` depending on the state of `result_ok`.
12718     */
12719    union LDKCResult_COption_APIErrorZDecodeErrorZPtr contents;
12720    /**
12721     * Whether this CResult_COption_APIErrorZDecodeErrorZ represents a success state.
12722     */
12723    bool result_ok;
12724 } LDKCResult_COption_APIErrorZDecodeErrorZ;
12725
12726 /**
12727  * The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
12728  */
12729 typedef union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr {
12730    /**
12731     * A pointer to the contents in the success state.
12732     * Reading from this pointer when `result_ok` is not set is undefined.
12733     */
12734    struct LDKChannelMonitorUpdate *result;
12735    /**
12736     * A pointer to the contents in the error state.
12737     * Reading from this pointer when `result_ok` is set is undefined.
12738     */
12739    struct LDKDecodeError *err;
12740 } LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr;
12741
12742 /**
12743  * A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
12744  * containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
12745  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
12746  */
12747 typedef struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ {
12748    /**
12749     * The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
12750     * `err` or `result` depending on the state of `result_ok`.
12751     */
12752    union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr contents;
12753    /**
12754     * Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
12755     */
12756    bool result_ok;
12757 } LDKCResult_ChannelMonitorUpdateDecodeErrorZ;
12758
12759 /**
12760  * An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not
12761  */
12762 typedef enum LDKCOption_MonitorEventZ_Tag {
12763    /**
12764     * When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent
12765     */
12766    LDKCOption_MonitorEventZ_Some,
12767    /**
12768     * When we're in this state, this COption_MonitorEventZ contains nothing
12769     */
12770    LDKCOption_MonitorEventZ_None,
12771    /**
12772     * Must be last for serialization purposes
12773     */
12774    LDKCOption_MonitorEventZ_Sentinel,
12775 } LDKCOption_MonitorEventZ_Tag;
12776
12777 typedef struct LDKCOption_MonitorEventZ {
12778    LDKCOption_MonitorEventZ_Tag tag;
12779    union {
12780       struct {
12781          struct LDKMonitorEvent some;
12782       };
12783    };
12784 } LDKCOption_MonitorEventZ;
12785
12786 /**
12787  * The contents of CResult_COption_MonitorEventZDecodeErrorZ
12788  */
12789 typedef union LDKCResult_COption_MonitorEventZDecodeErrorZPtr {
12790    /**
12791     * A pointer to the contents in the success state.
12792     * Reading from this pointer when `result_ok` is not set is undefined.
12793     */
12794    struct LDKCOption_MonitorEventZ *result;
12795    /**
12796     * A pointer to the contents in the error state.
12797     * Reading from this pointer when `result_ok` is set is undefined.
12798     */
12799    struct LDKDecodeError *err;
12800 } LDKCResult_COption_MonitorEventZDecodeErrorZPtr;
12801
12802 /**
12803  * A CResult_COption_MonitorEventZDecodeErrorZ represents the result of a fallible operation,
12804  * containing a crate::c_types::derived::COption_MonitorEventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
12805  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
12806  */
12807 typedef struct LDKCResult_COption_MonitorEventZDecodeErrorZ {
12808    /**
12809     * The contents of this CResult_COption_MonitorEventZDecodeErrorZ, accessible via either
12810     * `err` or `result` depending on the state of `result_ok`.
12811     */
12812    union LDKCResult_COption_MonitorEventZDecodeErrorZPtr contents;
12813    /**
12814     * Whether this CResult_COption_MonitorEventZDecodeErrorZ represents a success state.
12815     */
12816    bool result_ok;
12817 } LDKCResult_COption_MonitorEventZDecodeErrorZ;
12818
12819 /**
12820  * The contents of CResult_HTLCUpdateDecodeErrorZ
12821  */
12822 typedef union LDKCResult_HTLCUpdateDecodeErrorZPtr {
12823    /**
12824     * A pointer to the contents in the success state.
12825     * Reading from this pointer when `result_ok` is not set is undefined.
12826     */
12827    struct LDKHTLCUpdate *result;
12828    /**
12829     * A pointer to the contents in the error state.
12830     * Reading from this pointer when `result_ok` is set is undefined.
12831     */
12832    struct LDKDecodeError *err;
12833 } LDKCResult_HTLCUpdateDecodeErrorZPtr;
12834
12835 /**
12836  * A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
12837  * containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
12838  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
12839  */
12840 typedef struct LDKCResult_HTLCUpdateDecodeErrorZ {
12841    /**
12842     * The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
12843     * `err` or `result` depending on the state of `result_ok`.
12844     */
12845    union LDKCResult_HTLCUpdateDecodeErrorZPtr contents;
12846    /**
12847     * Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
12848     */
12849    bool result_ok;
12850 } LDKCResult_HTLCUpdateDecodeErrorZ;
12851
12852 /**
12853  * A tuple of 2 elements. See the individual fields for the types contained.
12854  */
12855 typedef struct LDKC2Tuple_OutPointCVec_u8ZZ {
12856    /**
12857     * The element at position 0
12858     */
12859    struct LDKOutPoint a;
12860    /**
12861     * The element at position 1
12862     */
12863    struct LDKCVec_u8Z b;
12864 } LDKC2Tuple_OutPointCVec_u8ZZ;
12865
12866 /**
12867  * A tuple of 2 elements. See the individual fields for the types contained.
12868  */
12869 typedef struct LDKC2Tuple_u32CVec_u8ZZ {
12870    /**
12871     * The element at position 0
12872     */
12873    uint32_t a;
12874    /**
12875     * The element at position 1
12876     */
12877    struct LDKCVec_u8Z b;
12878 } LDKC2Tuple_u32CVec_u8ZZ;
12879
12880 /**
12881  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32CVec_u8ZZs of arbitrary size.
12882  * This corresponds to std::vector in C++
12883  */
12884 typedef struct LDKCVec_C2Tuple_u32CVec_u8ZZZ {
12885    /**
12886     * The elements in the array.
12887     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12888     */
12889    struct LDKC2Tuple_u32CVec_u8ZZ *data;
12890    /**
12891     * The number of elements pointed to by `data`.
12892     */
12893    uintptr_t datalen;
12894 } LDKCVec_C2Tuple_u32CVec_u8ZZZ;
12895
12896 /**
12897  * A tuple of 2 elements. See the individual fields for the types contained.
12898  */
12899 typedef struct LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ {
12900    /**
12901     * The element at position 0
12902     */
12903    struct LDKThirtyTwoBytes a;
12904    /**
12905     * The element at position 1
12906     */
12907    struct LDKCVec_C2Tuple_u32CVec_u8ZZZ b;
12908 } LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ;
12909
12910 /**
12911  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZs of arbitrary size.
12912  * This corresponds to std::vector in C++
12913  */
12914 typedef struct LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ {
12915    /**
12916     * The elements in the array.
12917     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12918     */
12919    struct LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ *data;
12920    /**
12921     * The number of elements pointed to by `data`.
12922     */
12923    uintptr_t datalen;
12924 } LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ;
12925
12926 /**
12927  * A dynamically-allocated array of crate::lightning::ln::chan_utils::CommitmentTransactions of arbitrary size.
12928  * This corresponds to std::vector in C++
12929  */
12930 typedef struct LDKCVec_CommitmentTransactionZ {
12931    /**
12932     * The elements in the array.
12933     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12934     */
12935    struct LDKCommitmentTransaction *data;
12936    /**
12937     * The number of elements pointed to by `data`.
12938     */
12939    uintptr_t datalen;
12940 } LDKCVec_CommitmentTransactionZ;
12941
12942 /**
12943  * A tuple of 2 elements. See the individual fields for the types contained.
12944  */
12945 typedef struct LDKC2Tuple_u32TxOutZ {
12946    /**
12947     * The element at position 0
12948     */
12949    uint32_t a;
12950    /**
12951     * The element at position 1
12952     */
12953    struct LDKTxOut b;
12954 } LDKC2Tuple_u32TxOutZ;
12955
12956 /**
12957  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
12958  * This corresponds to std::vector in C++
12959  */
12960 typedef struct LDKCVec_C2Tuple_u32TxOutZZ {
12961    /**
12962     * The elements in the array.
12963     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12964     */
12965    struct LDKC2Tuple_u32TxOutZ *data;
12966    /**
12967     * The number of elements pointed to by `data`.
12968     */
12969    uintptr_t datalen;
12970 } LDKCVec_C2Tuple_u32TxOutZZ;
12971
12972 /**
12973  * A tuple of 2 elements. See the individual fields for the types contained.
12974  */
12975 typedef struct LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ {
12976    /**
12977     * The element at position 0
12978     */
12979    struct LDKThirtyTwoBytes a;
12980    /**
12981     * The element at position 1
12982     */
12983    struct LDKCVec_C2Tuple_u32TxOutZZ b;
12984 } LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ;
12985
12986 /**
12987  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
12988  * This corresponds to std::vector in C++
12989  */
12990 typedef struct LDKCVec_TransactionOutputsZ {
12991    /**
12992     * The elements in the array.
12993     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12994     */
12995    struct LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ *data;
12996    /**
12997     * The number of elements pointed to by `data`.
12998     */
12999    uintptr_t datalen;
13000 } LDKCVec_TransactionOutputsZ;
13001
13002 /**
13003  * Details about the balance(s) available for spending once the channel appears on chain.
13004  *
13005  * See [`ChannelMonitor::get_claimable_balances`] for more details on when these will or will not
13006  * be provided.
13007  */
13008 typedef enum LDKBalance_Tag {
13009    /**
13010     * The channel is not yet closed (or the commitment or closing transaction has not yet
13011     * appeared in a block). The given balance is claimable (less on-chain fees) if the channel is
13012     * force-closed now.
13013     */
13014    LDKBalance_ClaimableOnChannelClose,
13015    /**
13016     * The channel has been closed, and the given balance is ours but awaiting confirmations until
13017     * we consider it spendable.
13018     */
13019    LDKBalance_ClaimableAwaitingConfirmations,
13020    /**
13021     * The channel has been closed, and the given balance should be ours but awaiting spending
13022     * transaction confirmation. If the spending transaction does not confirm in time, it is
13023     * possible our counterparty can take the funds by broadcasting an HTLC timeout on-chain.
13024     *
13025     * Once the spending transaction confirms, before it has reached enough confirmations to be
13026     * considered safe from chain reorganizations, the balance will instead be provided via
13027     * [`Balance::ClaimableAwaitingConfirmations`].
13028     */
13029    LDKBalance_ContentiousClaimable,
13030    /**
13031     * HTLCs which we sent to our counterparty which are claimable after a timeout (less on-chain
13032     * fees) if the counterparty does not know the preimage for the HTLCs. These are somewhat
13033     * likely to be claimed by our counterparty before we do.
13034     */
13035    LDKBalance_MaybeTimeoutClaimableHTLC,
13036    /**
13037     * HTLCs which we received from our counterparty which are claimable with a preimage which we
13038     * do not currently have. This will only be claimable if we receive the preimage from the node
13039     * to which we forwarded this HTLC before the timeout.
13040     */
13041    LDKBalance_MaybePreimageClaimableHTLC,
13042    /**
13043     * The channel has been closed, and our counterparty broadcasted a revoked commitment
13044     * transaction.
13045     *
13046     * Thus, we're able to claim all outputs in the commitment transaction, one of which has the
13047     * following amount.
13048     */
13049    LDKBalance_CounterpartyRevokedOutputClaimable,
13050    /**
13051     * Must be last for serialization purposes
13052     */
13053    LDKBalance_Sentinel,
13054 } LDKBalance_Tag;
13055
13056 typedef struct LDKBalance_LDKClaimableOnChannelClose_Body {
13057    /**
13058     * The amount available to claim, in satoshis, excluding the on-chain fees which will be
13059     * required to do so.
13060     */
13061    uint64_t amount_satoshis;
13062 } LDKBalance_LDKClaimableOnChannelClose_Body;
13063
13064 typedef struct LDKBalance_LDKClaimableAwaitingConfirmations_Body {
13065    /**
13066     * The amount available to claim, in satoshis, possibly excluding the on-chain fees which
13067     * were spent in broadcasting the transaction.
13068     */
13069    uint64_t amount_satoshis;
13070    /**
13071     * The height at which an [`Event::SpendableOutputs`] event will be generated for this
13072     * amount.
13073     */
13074    uint32_t confirmation_height;
13075 } LDKBalance_LDKClaimableAwaitingConfirmations_Body;
13076
13077 typedef struct LDKBalance_LDKContentiousClaimable_Body {
13078    /**
13079     * The amount available to claim, in satoshis, excluding the on-chain fees which will be
13080     * required to do so.
13081     */
13082    uint64_t amount_satoshis;
13083    /**
13084     * The height at which the counterparty may be able to claim the balance if we have not
13085     * done so.
13086     */
13087    uint32_t timeout_height;
13088    /**
13089     * The payment hash that locks this HTLC.
13090     */
13091    struct LDKThirtyTwoBytes payment_hash;
13092    /**
13093     * The preimage that can be used to claim this HTLC.
13094     */
13095    struct LDKThirtyTwoBytes payment_preimage;
13096 } LDKBalance_LDKContentiousClaimable_Body;
13097
13098 typedef struct LDKBalance_LDKMaybeTimeoutClaimableHTLC_Body {
13099    /**
13100     * The amount potentially available to claim, in satoshis, excluding the on-chain fees
13101     * which will be required to do so.
13102     */
13103    uint64_t amount_satoshis;
13104    /**
13105     * The height at which we will be able to claim the balance if our counterparty has not
13106     * done so.
13107     */
13108    uint32_t claimable_height;
13109    /**
13110     * The payment hash whose preimage our counterparty needs to claim this HTLC.
13111     */
13112    struct LDKThirtyTwoBytes payment_hash;
13113 } LDKBalance_LDKMaybeTimeoutClaimableHTLC_Body;
13114
13115 typedef struct LDKBalance_LDKMaybePreimageClaimableHTLC_Body {
13116    /**
13117     * The amount potentially available to claim, in satoshis, excluding the on-chain fees
13118     * which will be required to do so.
13119     */
13120    uint64_t amount_satoshis;
13121    /**
13122     * The height at which our counterparty will be able to claim the balance if we have not
13123     * yet received the preimage and claimed it ourselves.
13124     */
13125    uint32_t expiry_height;
13126    /**
13127     * The payment hash whose preimage we need to claim this HTLC.
13128     */
13129    struct LDKThirtyTwoBytes payment_hash;
13130 } LDKBalance_LDKMaybePreimageClaimableHTLC_Body;
13131
13132 typedef struct LDKBalance_LDKCounterpartyRevokedOutputClaimable_Body {
13133    /**
13134     * The amount, in satoshis, of the output which we can claim.
13135     *
13136     * Note that for outputs from HTLC balances this may be excluding some on-chain fees that
13137     * were already spent.
13138     */
13139    uint64_t amount_satoshis;
13140 } LDKBalance_LDKCounterpartyRevokedOutputClaimable_Body;
13141
13142 typedef struct MUST_USE_STRUCT LDKBalance {
13143    LDKBalance_Tag tag;
13144    union {
13145       LDKBalance_LDKClaimableOnChannelClose_Body claimable_on_channel_close;
13146       LDKBalance_LDKClaimableAwaitingConfirmations_Body claimable_awaiting_confirmations;
13147       LDKBalance_LDKContentiousClaimable_Body contentious_claimable;
13148       LDKBalance_LDKMaybeTimeoutClaimableHTLC_Body maybe_timeout_claimable_htlc;
13149       LDKBalance_LDKMaybePreimageClaimableHTLC_Body maybe_preimage_claimable_htlc;
13150       LDKBalance_LDKCounterpartyRevokedOutputClaimable_Body counterparty_revoked_output_claimable;
13151    };
13152 } LDKBalance;
13153
13154 /**
13155  * A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size.
13156  * This corresponds to std::vector in C++
13157  */
13158 typedef struct LDKCVec_BalanceZ {
13159    /**
13160     * The elements in the array.
13161     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13162     */
13163    struct LDKBalance *data;
13164    /**
13165     * The number of elements pointed to by `data`.
13166     */
13167    uintptr_t datalen;
13168 } LDKCVec_BalanceZ;
13169
13170 /**
13171  * A tuple of 2 elements. See the individual fields for the types contained.
13172  */
13173 typedef struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ {
13174    /**
13175     * The element at position 0
13176     */
13177    struct LDKThirtyTwoBytes a;
13178    /**
13179     * The element at position 1
13180     */
13181    struct LDKChannelMonitor b;
13182 } LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ;
13183
13184 /**
13185  * The contents of CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ
13186  */
13187 typedef union LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr {
13188    /**
13189     * A pointer to the contents in the success state.
13190     * Reading from this pointer when `result_ok` is not set is undefined.
13191     */
13192    struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ *result;
13193    /**
13194     * A pointer to the contents in the error state.
13195     * Reading from this pointer when `result_ok` is set is undefined.
13196     */
13197    struct LDKDecodeError *err;
13198 } LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr;
13199
13200 /**
13201  * A CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
13202  * containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
13203  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
13204  */
13205 typedef struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
13206    /**
13207     * The contents of this CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ, accessible via either
13208     * `err` or `result` depending on the state of `result_ok`.
13209     */
13210    union LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr contents;
13211    /**
13212     * Whether this CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ represents a success state.
13213     */
13214    bool result_ok;
13215 } LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ;
13216
13217 /**
13218  * Defines a type identifier for sending messages over the wire.
13219  *
13220  * Messages implementing this trait specify a type and must be [`Writeable`].
13221  */
13222 typedef struct LDKType {
13223    /**
13224     * An opaque pointer which is passed to your function implementations as an argument.
13225     * This has no meaning in the LDK, and can be NULL or any other value.
13226     */
13227    void *this_arg;
13228    /**
13229     * Returns the type identifying the message payload.
13230     */
13231    uint16_t (*type_id)(const void *this_arg);
13232    /**
13233     * Return a human-readable "debug" string describing this object
13234     */
13235    struct LDKStr (*debug_str)(const void *this_arg);
13236    /**
13237     * Serialize the object into a byte array
13238     */
13239    struct LDKCVec_u8Z (*write)(const void *this_arg);
13240    /**
13241     * Called, if set, after this Type has been cloned into a duplicate object.
13242     * The new Type is provided, and should be mutated as needed to perform a
13243     * deep copy of the object pointed to by this_arg or avoid any double-freeing.
13244     */
13245    void (*cloned)(struct LDKType *NONNULL_PTR new_Type);
13246    /**
13247     * Frees any resources associated with this object given its this_arg pointer.
13248     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
13249     */
13250    void (*free)(void *this_arg);
13251 } LDKType;
13252
13253 /**
13254  * A tuple of 2 elements. See the individual fields for the types contained.
13255  */
13256 typedef struct LDKC2Tuple_PublicKeyTypeZ {
13257    /**
13258     * The element at position 0
13259     */
13260    struct LDKPublicKey a;
13261    /**
13262     * The element at position 1
13263     */
13264    struct LDKType b;
13265 } LDKC2Tuple_PublicKeyTypeZ;
13266
13267 /**
13268  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size.
13269  * This corresponds to std::vector in C++
13270  */
13271 typedef struct LDKCVec_C2Tuple_PublicKeyTypeZZ {
13272    /**
13273     * The elements in the array.
13274     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13275     */
13276    struct LDKC2Tuple_PublicKeyTypeZ *data;
13277    /**
13278     * The number of elements pointed to by `data`.
13279     */
13280    uintptr_t datalen;
13281 } LDKCVec_C2Tuple_PublicKeyTypeZZ;
13282
13283 /**
13284  * A tuple of 2 elements. See the individual fields for the types contained.
13285  */
13286 typedef struct LDKC2Tuple_PublicKeyCVec_SocketAddressZZ {
13287    /**
13288     * The element at position 0
13289     */
13290    struct LDKPublicKey a;
13291    /**
13292     * The element at position 1
13293     */
13294    struct LDKCVec_SocketAddressZ b;
13295 } LDKC2Tuple_PublicKeyCVec_SocketAddressZZ;
13296
13297 /**
13298  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyCVec_SocketAddressZZs of arbitrary size.
13299  * This corresponds to std::vector in C++
13300  */
13301 typedef struct LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ {
13302    /**
13303     * The elements in the array.
13304     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13305     */
13306    struct LDKC2Tuple_PublicKeyCVec_SocketAddressZZ *data;
13307    /**
13308     * The number of elements pointed to by `data`.
13309     */
13310    uintptr_t datalen;
13311 } LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ;
13312
13313 /**
13314  * The contents of an onion message.
13315  */
13316 typedef struct LDKOnionMessageContents {
13317    /**
13318     * An opaque pointer which is passed to your function implementations as an argument.
13319     * This has no meaning in the LDK, and can be NULL or any other value.
13320     */
13321    void *this_arg;
13322    /**
13323     * Returns the TLV type identifying the message contents. MUST be >= 64.
13324     */
13325    uint64_t (*tlv_type)(const void *this_arg);
13326    /**
13327     * Serialize the object into a byte array
13328     */
13329    struct LDKCVec_u8Z (*write)(const void *this_arg);
13330    /**
13331     * Return a human-readable "debug" string describing this object
13332     */
13333    struct LDKStr (*debug_str)(const void *this_arg);
13334    /**
13335     * Called, if set, after this OnionMessageContents has been cloned into a duplicate object.
13336     * The new OnionMessageContents is provided, and should be mutated as needed to perform a
13337     * deep copy of the object pointed to by this_arg or avoid any double-freeing.
13338     */
13339    void (*cloned)(struct LDKOnionMessageContents *NONNULL_PTR new_OnionMessageContents);
13340    /**
13341     * Frees any resources associated with this object given its this_arg pointer.
13342     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
13343     */
13344    void (*free)(void *this_arg);
13345 } LDKOnionMessageContents;
13346
13347 /**
13348  * An enum which can either contain a crate::lightning::onion_message::packet::OnionMessageContents or not
13349  */
13350 typedef enum LDKCOption_OnionMessageContentsZ_Tag {
13351    /**
13352     * When we're in this state, this COption_OnionMessageContentsZ contains a crate::lightning::onion_message::packet::OnionMessageContents
13353     */
13354    LDKCOption_OnionMessageContentsZ_Some,
13355    /**
13356     * When we're in this state, this COption_OnionMessageContentsZ contains nothing
13357     */
13358    LDKCOption_OnionMessageContentsZ_None,
13359    /**
13360     * Must be last for serialization purposes
13361     */
13362    LDKCOption_OnionMessageContentsZ_Sentinel,
13363 } LDKCOption_OnionMessageContentsZ_Tag;
13364
13365 typedef struct LDKCOption_OnionMessageContentsZ {
13366    LDKCOption_OnionMessageContentsZ_Tag tag;
13367    union {
13368       struct {
13369          struct LDKOnionMessageContents some;
13370       };
13371    };
13372 } LDKCOption_OnionMessageContentsZ;
13373
13374 /**
13375  * The contents of CResult_COption_OnionMessageContentsZDecodeErrorZ
13376  */
13377 typedef union LDKCResult_COption_OnionMessageContentsZDecodeErrorZPtr {
13378    /**
13379     * A pointer to the contents in the success state.
13380     * Reading from this pointer when `result_ok` is not set is undefined.
13381     */
13382    struct LDKCOption_OnionMessageContentsZ *result;
13383    /**
13384     * A pointer to the contents in the error state.
13385     * Reading from this pointer when `result_ok` is set is undefined.
13386     */
13387    struct LDKDecodeError *err;
13388 } LDKCResult_COption_OnionMessageContentsZDecodeErrorZPtr;
13389
13390 /**
13391  * A CResult_COption_OnionMessageContentsZDecodeErrorZ represents the result of a fallible operation,
13392  * containing a crate::c_types::derived::COption_OnionMessageContentsZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
13393  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
13394  */
13395 typedef struct LDKCResult_COption_OnionMessageContentsZDecodeErrorZ {
13396    /**
13397     * The contents of this CResult_COption_OnionMessageContentsZDecodeErrorZ, accessible via either
13398     * `err` or `result` depending on the state of `result_ok`.
13399     */
13400    union LDKCResult_COption_OnionMessageContentsZDecodeErrorZPtr contents;
13401    /**
13402     * Whether this CResult_COption_OnionMessageContentsZDecodeErrorZ represents a success state.
13403     */
13404    bool result_ok;
13405 } LDKCResult_COption_OnionMessageContentsZDecodeErrorZ;
13406
13407 /**
13408  * A tuple of 3 elements. See the individual fields for the types contained.
13409  */
13410 typedef struct LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ {
13411    /**
13412     * The element at position 0
13413     */
13414    struct LDKOnionMessageContents a;
13415    /**
13416     * The element at position 1
13417     */
13418    struct LDKDestination b;
13419    /**
13420     * The element at position 2
13421     */
13422    struct LDKBlindedPath c;
13423 } LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ;
13424
13425 /**
13426  * A dynamically-allocated array of crate::c_types::derived::C3Tuple_OnionMessageContentsDestinationBlindedPathZs of arbitrary size.
13427  * This corresponds to std::vector in C++
13428  */
13429 typedef struct LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ {
13430    /**
13431     * The elements in the array.
13432     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13433     */
13434    struct LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *data;
13435    /**
13436     * The number of elements pointed to by `data`.
13437     */
13438    uintptr_t datalen;
13439 } LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ;
13440
13441 /**
13442  * An enum which can either contain a crate::lightning::ln::wire::Type or not
13443  */
13444 typedef enum LDKCOption_TypeZ_Tag {
13445    /**
13446     * When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type
13447     */
13448    LDKCOption_TypeZ_Some,
13449    /**
13450     * When we're in this state, this COption_TypeZ contains nothing
13451     */
13452    LDKCOption_TypeZ_None,
13453    /**
13454     * Must be last for serialization purposes
13455     */
13456    LDKCOption_TypeZ_Sentinel,
13457 } LDKCOption_TypeZ_Tag;
13458
13459 typedef struct LDKCOption_TypeZ {
13460    LDKCOption_TypeZ_Tag tag;
13461    union {
13462       struct {
13463          struct LDKType some;
13464       };
13465    };
13466 } LDKCOption_TypeZ;
13467
13468 /**
13469  * The contents of CResult_COption_TypeZDecodeErrorZ
13470  */
13471 typedef union LDKCResult_COption_TypeZDecodeErrorZPtr {
13472    /**
13473     * A pointer to the contents in the success state.
13474     * Reading from this pointer when `result_ok` is not set is undefined.
13475     */
13476    struct LDKCOption_TypeZ *result;
13477    /**
13478     * A pointer to the contents in the error state.
13479     * Reading from this pointer when `result_ok` is set is undefined.
13480     */
13481    struct LDKDecodeError *err;
13482 } LDKCResult_COption_TypeZDecodeErrorZPtr;
13483
13484 /**
13485  * A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation,
13486  * containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
13487  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
13488  */
13489 typedef struct LDKCResult_COption_TypeZDecodeErrorZ {
13490    /**
13491     * The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either
13492     * `err` or `result` depending on the state of `result_ok`.
13493     */
13494    union LDKCResult_COption_TypeZDecodeErrorZPtr contents;
13495    /**
13496     * Whether this CResult_COption_TypeZDecodeErrorZ represents a success state.
13497     */
13498    bool result_ok;
13499 } LDKCResult_COption_TypeZDecodeErrorZ;
13500
13501 /**
13502  * An enum which can either contain a crate::lightning::ln::msgs::SocketAddress or not
13503  */
13504 typedef enum LDKCOption_SocketAddressZ_Tag {
13505    /**
13506     * When we're in this state, this COption_SocketAddressZ contains a crate::lightning::ln::msgs::SocketAddress
13507     */
13508    LDKCOption_SocketAddressZ_Some,
13509    /**
13510     * When we're in this state, this COption_SocketAddressZ contains nothing
13511     */
13512    LDKCOption_SocketAddressZ_None,
13513    /**
13514     * Must be last for serialization purposes
13515     */
13516    LDKCOption_SocketAddressZ_Sentinel,
13517 } LDKCOption_SocketAddressZ_Tag;
13518
13519 typedef struct LDKCOption_SocketAddressZ {
13520    LDKCOption_SocketAddressZ_Tag tag;
13521    union {
13522       struct {
13523          struct LDKSocketAddress some;
13524       };
13525    };
13526 } LDKCOption_SocketAddressZ;
13527
13528
13529
13530 /**
13531  * Details of a connected peer as returned by [`PeerManager::list_peers`].
13532  */
13533 typedef struct MUST_USE_STRUCT LDKPeerDetails {
13534    /**
13535     * A pointer to the opaque Rust object.
13536     * Nearly everywhere, inner must be non-null, however in places where
13537     * the Rust equivalent takes an Option, it may be set to null to indicate None.
13538     */
13539    LDKnativePeerDetails *inner;
13540    /**
13541     * Indicates that this is the only struct which contains the same pointer.
13542     * Rust functions which take ownership of an object provided via an argument require
13543     * this to be true and invalidate the object pointed to by inner.
13544     */
13545    bool is_owned;
13546 } LDKPeerDetails;
13547
13548 /**
13549  * A dynamically-allocated array of crate::lightning::ln::peer_handler::PeerDetailss of arbitrary size.
13550  * This corresponds to std::vector in C++
13551  */
13552 typedef struct LDKCVec_PeerDetailsZ {
13553    /**
13554     * The elements in the array.
13555     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13556     */
13557    struct LDKPeerDetails *data;
13558    /**
13559     * The number of elements pointed to by `data`.
13560     */
13561    uintptr_t datalen;
13562 } LDKCVec_PeerDetailsZ;
13563
13564
13565
13566 /**
13567  * Error for PeerManager errors. If you get one of these, you must disconnect the socket and
13568  * generate no further read_event/write_buffer_space_avail/socket_disconnected calls for the
13569  * descriptor.
13570  */
13571 typedef struct MUST_USE_STRUCT LDKPeerHandleError {
13572    /**
13573     * A pointer to the opaque Rust object.
13574     * Nearly everywhere, inner must be non-null, however in places where
13575     * the Rust equivalent takes an Option, it may be set to null to indicate None.
13576     */
13577    LDKnativePeerHandleError *inner;
13578    /**
13579     * Indicates that this is the only struct which contains the same pointer.
13580     * Rust functions which take ownership of an object provided via an argument require
13581     * this to be true and invalidate the object pointed to by inner.
13582     */
13583    bool is_owned;
13584 } LDKPeerHandleError;
13585
13586 /**
13587  * The contents of CResult_CVec_u8ZPeerHandleErrorZ
13588  */
13589 typedef union LDKCResult_CVec_u8ZPeerHandleErrorZPtr {
13590    /**
13591     * A pointer to the contents in the success state.
13592     * Reading from this pointer when `result_ok` is not set is undefined.
13593     */
13594    struct LDKCVec_u8Z *result;
13595    /**
13596     * A pointer to the contents in the error state.
13597     * Reading from this pointer when `result_ok` is set is undefined.
13598     */
13599    struct LDKPeerHandleError *err;
13600 } LDKCResult_CVec_u8ZPeerHandleErrorZPtr;
13601
13602 /**
13603  * A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
13604  * containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
13605  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
13606  */
13607 typedef struct LDKCResult_CVec_u8ZPeerHandleErrorZ {
13608    /**
13609     * The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
13610     * `err` or `result` depending on the state of `result_ok`.
13611     */
13612    union LDKCResult_CVec_u8ZPeerHandleErrorZPtr contents;
13613    /**
13614     * Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
13615     */
13616    bool result_ok;
13617 } LDKCResult_CVec_u8ZPeerHandleErrorZ;
13618
13619 /**
13620  * The contents of CResult_NonePeerHandleErrorZ
13621  */
13622 typedef union LDKCResult_NonePeerHandleErrorZPtr {
13623    /**
13624     * Note that this value is always NULL, as there are no contents in the OK variant
13625     */
13626    void *result;
13627    /**
13628     * A pointer to the contents in the error state.
13629     * Reading from this pointer when `result_ok` is set is undefined.
13630     */
13631    struct LDKPeerHandleError *err;
13632 } LDKCResult_NonePeerHandleErrorZPtr;
13633
13634 /**
13635  * A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
13636  * containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
13637  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
13638  */
13639 typedef struct LDKCResult_NonePeerHandleErrorZ {
13640    /**
13641     * The contents of this CResult_NonePeerHandleErrorZ, accessible via either
13642     * `err` or `result` depending on the state of `result_ok`.
13643     */
13644    union LDKCResult_NonePeerHandleErrorZPtr contents;
13645    /**
13646     * Whether this CResult_NonePeerHandleErrorZ represents a success state.
13647     */
13648    bool result_ok;
13649 } LDKCResult_NonePeerHandleErrorZ;
13650
13651 /**
13652  * The contents of CResult_boolPeerHandleErrorZ
13653  */
13654 typedef union LDKCResult_boolPeerHandleErrorZPtr {
13655    /**
13656     * A pointer to the contents in the success state.
13657     * Reading from this pointer when `result_ok` is not set is undefined.
13658     */
13659    bool *result;
13660    /**
13661     * A pointer to the contents in the error state.
13662     * Reading from this pointer when `result_ok` is set is undefined.
13663     */
13664    struct LDKPeerHandleError *err;
13665 } LDKCResult_boolPeerHandleErrorZPtr;
13666
13667 /**
13668  * A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
13669  * containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
13670  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
13671  */
13672 typedef struct LDKCResult_boolPeerHandleErrorZ {
13673    /**
13674     * The contents of this CResult_boolPeerHandleErrorZ, accessible via either
13675     * `err` or `result` depending on the state of `result_ok`.
13676     */
13677    union LDKCResult_boolPeerHandleErrorZPtr contents;
13678    /**
13679     * Whether this CResult_boolPeerHandleErrorZ represents a success state.
13680     */
13681    bool result_ok;
13682 } LDKCResult_boolPeerHandleErrorZ;
13683
13684 /**
13685  * All-encompassing standard error type that processing can return
13686  */
13687 typedef enum LDKGraphSyncError_Tag {
13688    /**
13689     * Error trying to read the update data, typically due to an erroneous data length indication
13690     * that is greater than the actual amount of data provided
13691     */
13692    LDKGraphSyncError_DecodeError,
13693    /**
13694     * Error applying the patch to the network graph, usually the result of updates that are too
13695     * old or missing prerequisite data to the application of updates out of order
13696     */
13697    LDKGraphSyncError_LightningError,
13698    /**
13699     * Must be last for serialization purposes
13700     */
13701    LDKGraphSyncError_Sentinel,
13702 } LDKGraphSyncError_Tag;
13703
13704 typedef struct MUST_USE_STRUCT LDKGraphSyncError {
13705    LDKGraphSyncError_Tag tag;
13706    union {
13707       struct {
13708          struct LDKDecodeError decode_error;
13709       };
13710       struct {
13711          struct LDKLightningError lightning_error;
13712       };
13713    };
13714 } LDKGraphSyncError;
13715
13716 /**
13717  * The contents of CResult_u32GraphSyncErrorZ
13718  */
13719 typedef union LDKCResult_u32GraphSyncErrorZPtr {
13720    /**
13721     * A pointer to the contents in the success state.
13722     * Reading from this pointer when `result_ok` is not set is undefined.
13723     */
13724    uint32_t *result;
13725    /**
13726     * A pointer to the contents in the error state.
13727     * Reading from this pointer when `result_ok` is set is undefined.
13728     */
13729    struct LDKGraphSyncError *err;
13730 } LDKCResult_u32GraphSyncErrorZPtr;
13731
13732 /**
13733  * A CResult_u32GraphSyncErrorZ represents the result of a fallible operation,
13734  * containing a u32 on success and a crate::lightning_rapid_gossip_sync::GraphSyncError on failure.
13735  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
13736  */
13737 typedef struct LDKCResult_u32GraphSyncErrorZ {
13738    /**
13739     * The contents of this CResult_u32GraphSyncErrorZ, accessible via either
13740     * `err` or `result` depending on the state of `result_ok`.
13741     */
13742    union LDKCResult_u32GraphSyncErrorZPtr contents;
13743    /**
13744     * Whether this CResult_u32GraphSyncErrorZ represents a success state.
13745     */
13746    bool result_ok;
13747 } LDKCResult_u32GraphSyncErrorZ;
13748
13749 /**
13750  * The contents of CResult_CVec_u8ZIOErrorZ
13751  */
13752 typedef union LDKCResult_CVec_u8ZIOErrorZPtr {
13753    /**
13754     * A pointer to the contents in the success state.
13755     * Reading from this pointer when `result_ok` is not set is undefined.
13756     */
13757    struct LDKCVec_u8Z *result;
13758    /**
13759     * A pointer to the contents in the error state.
13760     * Reading from this pointer when `result_ok` is set is undefined.
13761     */
13762    enum LDKIOError *err;
13763 } LDKCResult_CVec_u8ZIOErrorZPtr;
13764
13765 /**
13766  * A CResult_CVec_u8ZIOErrorZ represents the result of a fallible operation,
13767  * containing a crate::c_types::derived::CVec_u8Z on success and a crate::c_types::IOError on failure.
13768  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
13769  */
13770 typedef struct LDKCResult_CVec_u8ZIOErrorZ {
13771    /**
13772     * The contents of this CResult_CVec_u8ZIOErrorZ, accessible via either
13773     * `err` or `result` depending on the state of `result_ok`.
13774     */
13775    union LDKCResult_CVec_u8ZIOErrorZPtr contents;
13776    /**
13777     * Whether this CResult_CVec_u8ZIOErrorZ represents a success state.
13778     */
13779    bool result_ok;
13780 } LDKCResult_CVec_u8ZIOErrorZ;
13781
13782 /**
13783  * A dynamically-allocated array of crate::c_types::Strs of arbitrary size.
13784  * This corresponds to std::vector in C++
13785  */
13786 typedef struct LDKCVec_StrZ {
13787    /**
13788     * The elements in the array.
13789     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13790     */
13791    struct LDKStr *data;
13792    /**
13793     * The number of elements pointed to by `data`.
13794     */
13795    uintptr_t datalen;
13796 } LDKCVec_StrZ;
13797
13798 /**
13799  * The contents of CResult_CVec_StrZIOErrorZ
13800  */
13801 typedef union LDKCResult_CVec_StrZIOErrorZPtr {
13802    /**
13803     * A pointer to the contents in the success state.
13804     * Reading from this pointer when `result_ok` is not set is undefined.
13805     */
13806    struct LDKCVec_StrZ *result;
13807    /**
13808     * A pointer to the contents in the error state.
13809     * Reading from this pointer when `result_ok` is set is undefined.
13810     */
13811    enum LDKIOError *err;
13812 } LDKCResult_CVec_StrZIOErrorZPtr;
13813
13814 /**
13815  * A CResult_CVec_StrZIOErrorZ represents the result of a fallible operation,
13816  * containing a crate::c_types::derived::CVec_StrZ on success and a crate::c_types::IOError on failure.
13817  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
13818  */
13819 typedef struct LDKCResult_CVec_StrZIOErrorZ {
13820    /**
13821     * The contents of this CResult_CVec_StrZIOErrorZ, accessible via either
13822     * `err` or `result` depending on the state of `result_ok`.
13823     */
13824    union LDKCResult_CVec_StrZIOErrorZPtr contents;
13825    /**
13826     * Whether this CResult_CVec_StrZIOErrorZ represents a success state.
13827     */
13828    bool result_ok;
13829 } LDKCResult_CVec_StrZIOErrorZ;
13830
13831 /**
13832  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZs of arbitrary size.
13833  * This corresponds to std::vector in C++
13834  */
13835 typedef struct LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ {
13836    /**
13837     * The elements in the array.
13838     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13839     */
13840    struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ *data;
13841    /**
13842     * The number of elements pointed to by `data`.
13843     */
13844    uintptr_t datalen;
13845 } LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ;
13846
13847 /**
13848  * The contents of CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ
13849  */
13850 typedef union LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr {
13851    /**
13852     * A pointer to the contents in the success state.
13853     * Reading from this pointer when `result_ok` is not set is undefined.
13854     */
13855    struct LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ *result;
13856    /**
13857     * A pointer to the contents in the error state.
13858     * Reading from this pointer when `result_ok` is set is undefined.
13859     */
13860    enum LDKIOError *err;
13861 } LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr;
13862
13863 /**
13864  * A CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ represents the result of a fallible operation,
13865  * containing a crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ on success and a crate::c_types::IOError on failure.
13866  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
13867  */
13868 typedef struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
13869    /**
13870     * The contents of this CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ, accessible via either
13871     * `err` or `result` depending on the state of `result_ok`.
13872     */
13873    union LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr contents;
13874    /**
13875     * Whether this CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ represents a success state.
13876     */
13877    bool result_ok;
13878 } LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ;
13879
13880 /**
13881  * The contents of CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ
13882  */
13883 typedef union LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr {
13884    /**
13885     * A pointer to the contents in the success state.
13886     * Reading from this pointer when `result_ok` is not set is undefined.
13887     */
13888    struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ *result;
13889    /**
13890     * A pointer to the contents in the error state.
13891     * Reading from this pointer when `result_ok` is set is undefined.
13892     */
13893    enum LDKIOError *err;
13894 } LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr;
13895
13896 /**
13897  * A CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ represents the result of a fallible operation,
13898  * containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ on success and a crate::c_types::IOError on failure.
13899  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
13900  */
13901 typedef struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
13902    /**
13903     * The contents of this CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ, accessible via either
13904     * `err` or `result` depending on the state of `result_ok`.
13905     */
13906    union LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr contents;
13907    /**
13908     * Whether this CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ represents a success state.
13909     */
13910    bool result_ok;
13911 } LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ;
13912
13913 /**
13914  * The contents of CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ
13915  */
13916 typedef union LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZPtr {
13917    /**
13918     * A pointer to the contents in the success state.
13919     * Reading from this pointer when `result_ok` is not set is undefined.
13920     */
13921    struct LDKUnsignedInvoiceRequest *result;
13922    /**
13923     * A pointer to the contents in the error state.
13924     * Reading from this pointer when `result_ok` is set is undefined.
13925     */
13926    enum LDKBolt12SemanticError *err;
13927 } LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZPtr;
13928
13929 /**
13930  * A CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ represents the result of a fallible operation,
13931  * containing a crate::lightning::offers::invoice_request::UnsignedInvoiceRequest on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure.
13932  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
13933  */
13934 typedef struct LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ {
13935    /**
13936     * The contents of this CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ, accessible via either
13937     * `err` or `result` depending on the state of `result_ok`.
13938     */
13939    union LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZPtr contents;
13940    /**
13941     * Whether this CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ represents a success state.
13942     */
13943    bool result_ok;
13944 } LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ;
13945
13946 /**
13947  * The contents of CResult_InvoiceRequestBolt12SemanticErrorZ
13948  */
13949 typedef union LDKCResult_InvoiceRequestBolt12SemanticErrorZPtr {
13950    /**
13951     * A pointer to the contents in the success state.
13952     * Reading from this pointer when `result_ok` is not set is undefined.
13953     */
13954    struct LDKInvoiceRequest *result;
13955    /**
13956     * A pointer to the contents in the error state.
13957     * Reading from this pointer when `result_ok` is set is undefined.
13958     */
13959    enum LDKBolt12SemanticError *err;
13960 } LDKCResult_InvoiceRequestBolt12SemanticErrorZPtr;
13961
13962 /**
13963  * A CResult_InvoiceRequestBolt12SemanticErrorZ represents the result of a fallible operation,
13964  * containing a crate::lightning::offers::invoice_request::InvoiceRequest on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure.
13965  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
13966  */
13967 typedef struct LDKCResult_InvoiceRequestBolt12SemanticErrorZ {
13968    /**
13969     * The contents of this CResult_InvoiceRequestBolt12SemanticErrorZ, accessible via either
13970     * `err` or `result` depending on the state of `result_ok`.
13971     */
13972    union LDKCResult_InvoiceRequestBolt12SemanticErrorZPtr contents;
13973    /**
13974     * Whether this CResult_InvoiceRequestBolt12SemanticErrorZ represents a success state.
13975     */
13976    bool result_ok;
13977 } LDKCResult_InvoiceRequestBolt12SemanticErrorZ;
13978
13979 /**
13980  * Represents a valid secp256k1 secret key serialized as a 32 byte array.
13981  */
13982 typedef struct LDKSecretKey {
13983    /**
13984     * The bytes of the secret key
13985     */
13986    uint8_t bytes[32];
13987 } LDKSecretKey;
13988
13989 /**
13990  * An enum which can either contain a crate::c_types::SecretKey or not
13991  */
13992 typedef enum LDKCOption_SecretKeyZ_Tag {
13993    /**
13994     * When we're in this state, this COption_SecretKeyZ contains a crate::c_types::SecretKey
13995     */
13996    LDKCOption_SecretKeyZ_Some,
13997    /**
13998     * When we're in this state, this COption_SecretKeyZ contains nothing
13999     */
14000    LDKCOption_SecretKeyZ_None,
14001    /**
14002     * Must be last for serialization purposes
14003     */
14004    LDKCOption_SecretKeyZ_Sentinel,
14005 } LDKCOption_SecretKeyZ_Tag;
14006
14007 typedef struct LDKCOption_SecretKeyZ {
14008    LDKCOption_SecretKeyZ_Tag tag;
14009    union {
14010       struct {
14011          struct LDKSecretKey some;
14012       };
14013    };
14014 } LDKCOption_SecretKeyZ;
14015
14016
14017
14018 /**
14019  * Builds a [`Bolt12Invoice`] from either:
14020  * - an [`InvoiceRequest`] for the \"offer to be paid\" flow or
14021  * - a [`Refund`] for the \"offer for money\" flow.
14022  *
14023  * See [module-level documentation] for usage.
14024  *
14025  * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
14026  * [`Refund`]: crate::offers::refund::Refund
14027  * [module-level documentation]: self
14028  */
14029 typedef struct MUST_USE_STRUCT LDKInvoiceWithExplicitSigningPubkeyBuilder {
14030    /**
14031     * A pointer to the opaque Rust object.
14032     * Nearly everywhere, inner must be non-null, however in places where
14033     * the Rust equivalent takes an Option, it may be set to null to indicate None.
14034     */
14035    LDKnativeInvoiceWithExplicitSigningPubkeyBuilder *inner;
14036    /**
14037     * Indicates that this is the only struct which contains the same pointer.
14038     * Rust functions which take ownership of an object provided via an argument require
14039     * this to be true and invalidate the object pointed to by inner.
14040     */
14041    bool is_owned;
14042 } LDKInvoiceWithExplicitSigningPubkeyBuilder;
14043
14044 /**
14045  * The contents of CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ
14046  */
14047 typedef union LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZPtr {
14048    /**
14049     * A pointer to the contents in the success state.
14050     * Reading from this pointer when `result_ok` is not set is undefined.
14051     */
14052    struct LDKInvoiceWithExplicitSigningPubkeyBuilder *result;
14053    /**
14054     * A pointer to the contents in the error state.
14055     * Reading from this pointer when `result_ok` is set is undefined.
14056     */
14057    enum LDKBolt12SemanticError *err;
14058 } LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZPtr;
14059
14060 /**
14061  * A CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ represents the result of a fallible operation,
14062  * containing a crate::lightning::offers::invoice::InvoiceWithExplicitSigningPubkeyBuilder on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure.
14063  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
14064  */
14065 typedef struct LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ {
14066    /**
14067     * The contents of this CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ, accessible via either
14068     * `err` or `result` depending on the state of `result_ok`.
14069     */
14070    union LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZPtr contents;
14071    /**
14072     * Whether this CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ represents a success state.
14073     */
14074    bool result_ok;
14075 } LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ;
14076
14077
14078
14079 /**
14080  * An [`InvoiceRequest`] that has been verified by [`InvoiceRequest::verify`] and exposes different
14081  * ways to respond depending on whether the signing keys were derived.
14082  */
14083 typedef struct MUST_USE_STRUCT LDKVerifiedInvoiceRequest {
14084    /**
14085     * A pointer to the opaque Rust object.
14086     * Nearly everywhere, inner must be non-null, however in places where
14087     * the Rust equivalent takes an Option, it may be set to null to indicate None.
14088     */
14089    LDKnativeVerifiedInvoiceRequest *inner;
14090    /**
14091     * Indicates that this is the only struct which contains the same pointer.
14092     * Rust functions which take ownership of an object provided via an argument require
14093     * this to be true and invalidate the object pointed to by inner.
14094     */
14095    bool is_owned;
14096 } LDKVerifiedInvoiceRequest;
14097
14098 /**
14099  * The contents of CResult_VerifiedInvoiceRequestNoneZ
14100  */
14101 typedef union LDKCResult_VerifiedInvoiceRequestNoneZPtr {
14102    /**
14103     * A pointer to the contents in the success state.
14104     * Reading from this pointer when `result_ok` is not set is undefined.
14105     */
14106    struct LDKVerifiedInvoiceRequest *result;
14107    /**
14108     * Note that this value is always NULL, as there are no contents in the Err variant
14109     */
14110    void *err;
14111 } LDKCResult_VerifiedInvoiceRequestNoneZPtr;
14112
14113 /**
14114  * A CResult_VerifiedInvoiceRequestNoneZ represents the result of a fallible operation,
14115  * containing a crate::lightning::offers::invoice_request::VerifiedInvoiceRequest on success and a () on failure.
14116  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
14117  */
14118 typedef struct LDKCResult_VerifiedInvoiceRequestNoneZ {
14119    /**
14120     * The contents of this CResult_VerifiedInvoiceRequestNoneZ, accessible via either
14121     * `err` or `result` depending on the state of `result_ok`.
14122     */
14123    union LDKCResult_VerifiedInvoiceRequestNoneZPtr contents;
14124    /**
14125     * Whether this CResult_VerifiedInvoiceRequestNoneZ represents a success state.
14126     */
14127    bool result_ok;
14128 } LDKCResult_VerifiedInvoiceRequestNoneZ;
14129
14130
14131
14132 /**
14133  * Builds a [`Bolt12Invoice`] from either:
14134  * - an [`InvoiceRequest`] for the \"offer to be paid\" flow or
14135  * - a [`Refund`] for the \"offer for money\" flow.
14136  *
14137  * See [module-level documentation] for usage.
14138  *
14139  * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
14140  * [`Refund`]: crate::offers::refund::Refund
14141  * [module-level documentation]: self
14142  */
14143 typedef struct MUST_USE_STRUCT LDKInvoiceWithDerivedSigningPubkeyBuilder {
14144    /**
14145     * A pointer to the opaque Rust object.
14146     * Nearly everywhere, inner must be non-null, however in places where
14147     * the Rust equivalent takes an Option, it may be set to null to indicate None.
14148     */
14149    LDKnativeInvoiceWithDerivedSigningPubkeyBuilder *inner;
14150    /**
14151     * Indicates that this is the only struct which contains the same pointer.
14152     * Rust functions which take ownership of an object provided via an argument require
14153     * this to be true and invalidate the object pointed to by inner.
14154     */
14155    bool is_owned;
14156 } LDKInvoiceWithDerivedSigningPubkeyBuilder;
14157
14158 /**
14159  * The contents of CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ
14160  */
14161 typedef union LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZPtr {
14162    /**
14163     * A pointer to the contents in the success state.
14164     * Reading from this pointer when `result_ok` is not set is undefined.
14165     */
14166    struct LDKInvoiceWithDerivedSigningPubkeyBuilder *result;
14167    /**
14168     * A pointer to the contents in the error state.
14169     * Reading from this pointer when `result_ok` is set is undefined.
14170     */
14171    enum LDKBolt12SemanticError *err;
14172 } LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZPtr;
14173
14174 /**
14175  * A CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ represents the result of a fallible operation,
14176  * containing a crate::lightning::offers::invoice::InvoiceWithDerivedSigningPubkeyBuilder on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure.
14177  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
14178  */
14179 typedef struct LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ {
14180    /**
14181     * The contents of this CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ, accessible via either
14182     * `err` or `result` depending on the state of `result_ok`.
14183     */
14184    union LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZPtr contents;
14185    /**
14186     * Whether this CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ represents a success state.
14187     */
14188    bool result_ok;
14189 } LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ;
14190
14191
14192
14193 /**
14194  * Fields sent in an [`InvoiceRequest`] message to include in [`PaymentContext::Bolt12Offer`].
14195  *
14196  * [`PaymentContext::Bolt12Offer`]: crate::blinded_path::payment::PaymentContext::Bolt12Offer
14197  */
14198 typedef struct MUST_USE_STRUCT LDKInvoiceRequestFields {
14199    /**
14200     * A pointer to the opaque Rust object.
14201     * Nearly everywhere, inner must be non-null, however in places where
14202     * the Rust equivalent takes an Option, it may be set to null to indicate None.
14203     */
14204    LDKnativeInvoiceRequestFields *inner;
14205    /**
14206     * Indicates that this is the only struct which contains the same pointer.
14207     * Rust functions which take ownership of an object provided via an argument require
14208     * this to be true and invalidate the object pointed to by inner.
14209     */
14210    bool is_owned;
14211 } LDKInvoiceRequestFields;
14212
14213 /**
14214  * The contents of CResult_InvoiceRequestFieldsDecodeErrorZ
14215  */
14216 typedef union LDKCResult_InvoiceRequestFieldsDecodeErrorZPtr {
14217    /**
14218     * A pointer to the contents in the success state.
14219     * Reading from this pointer when `result_ok` is not set is undefined.
14220     */
14221    struct LDKInvoiceRequestFields *result;
14222    /**
14223     * A pointer to the contents in the error state.
14224     * Reading from this pointer when `result_ok` is set is undefined.
14225     */
14226    struct LDKDecodeError *err;
14227 } LDKCResult_InvoiceRequestFieldsDecodeErrorZPtr;
14228
14229 /**
14230  * A CResult_InvoiceRequestFieldsDecodeErrorZ represents the result of a fallible operation,
14231  * containing a crate::lightning::offers::invoice_request::InvoiceRequestFields on success and a crate::lightning::ln::msgs::DecodeError on failure.
14232  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
14233  */
14234 typedef struct LDKCResult_InvoiceRequestFieldsDecodeErrorZ {
14235    /**
14236     * The contents of this CResult_InvoiceRequestFieldsDecodeErrorZ, accessible via either
14237     * `err` or `result` depending on the state of `result_ok`.
14238     */
14239    union LDKCResult_InvoiceRequestFieldsDecodeErrorZPtr contents;
14240    /**
14241     * Whether this CResult_InvoiceRequestFieldsDecodeErrorZ represents a success state.
14242     */
14243    bool result_ok;
14244 } LDKCResult_InvoiceRequestFieldsDecodeErrorZ;
14245
14246 /**
14247  * A dynamically-allocated array of crate::c_types::Witnesss of arbitrary size.
14248  * This corresponds to std::vector in C++
14249  */
14250 typedef struct LDKCVec_WitnessZ {
14251    /**
14252     * The elements in the array.
14253     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
14254     */
14255    struct LDKWitness *data;
14256    /**
14257     * The number of elements pointed to by `data`.
14258     */
14259    uintptr_t datalen;
14260 } LDKCVec_WitnessZ;
14261
14262 /**
14263  * An enum which can either contain a crate::c_types::ECDSASignature or not
14264  */
14265 typedef enum LDKCOption_ECDSASignatureZ_Tag {
14266    /**
14267     * When we're in this state, this COption_ECDSASignatureZ contains a crate::c_types::ECDSASignature
14268     */
14269    LDKCOption_ECDSASignatureZ_Some,
14270    /**
14271     * When we're in this state, this COption_ECDSASignatureZ contains nothing
14272     */
14273    LDKCOption_ECDSASignatureZ_None,
14274    /**
14275     * Must be last for serialization purposes
14276     */
14277    LDKCOption_ECDSASignatureZ_Sentinel,
14278 } LDKCOption_ECDSASignatureZ_Tag;
14279
14280 typedef struct LDKCOption_ECDSASignatureZ {
14281    LDKCOption_ECDSASignatureZ_Tag tag;
14282    union {
14283       struct {
14284          struct LDKECDSASignature some;
14285       };
14286    };
14287 } LDKCOption_ECDSASignatureZ;
14288
14289 /**
14290  * An enum which can either contain a i64 or not
14291  */
14292 typedef enum LDKCOption_i64Z_Tag {
14293    /**
14294     * When we're in this state, this COption_i64Z contains a i64
14295     */
14296    LDKCOption_i64Z_Some,
14297    /**
14298     * When we're in this state, this COption_i64Z contains nothing
14299     */
14300    LDKCOption_i64Z_None,
14301    /**
14302     * Must be last for serialization purposes
14303     */
14304    LDKCOption_i64Z_Sentinel,
14305 } LDKCOption_i64Z_Tag;
14306
14307 typedef struct LDKCOption_i64Z {
14308    LDKCOption_i64Z_Tag tag;
14309    union {
14310       struct {
14311          int64_t some;
14312       };
14313    };
14314 } LDKCOption_i64Z;
14315
14316 /**
14317  * The contents of CResult_SocketAddressDecodeErrorZ
14318  */
14319 typedef union LDKCResult_SocketAddressDecodeErrorZPtr {
14320    /**
14321     * A pointer to the contents in the success state.
14322     * Reading from this pointer when `result_ok` is not set is undefined.
14323     */
14324    struct LDKSocketAddress *result;
14325    /**
14326     * A pointer to the contents in the error state.
14327     * Reading from this pointer when `result_ok` is set is undefined.
14328     */
14329    struct LDKDecodeError *err;
14330 } LDKCResult_SocketAddressDecodeErrorZPtr;
14331
14332 /**
14333  * A CResult_SocketAddressDecodeErrorZ represents the result of a fallible operation,
14334  * containing a crate::lightning::ln::msgs::SocketAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
14335  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
14336  */
14337 typedef struct LDKCResult_SocketAddressDecodeErrorZ {
14338    /**
14339     * The contents of this CResult_SocketAddressDecodeErrorZ, accessible via either
14340     * `err` or `result` depending on the state of `result_ok`.
14341     */
14342    union LDKCResult_SocketAddressDecodeErrorZPtr contents;
14343    /**
14344     * Whether this CResult_SocketAddressDecodeErrorZ represents a success state.
14345     */
14346    bool result_ok;
14347 } LDKCResult_SocketAddressDecodeErrorZ;
14348
14349 /**
14350  * The contents of CResult_SocketAddressSocketAddressParseErrorZ
14351  */
14352 typedef union LDKCResult_SocketAddressSocketAddressParseErrorZPtr {
14353    /**
14354     * A pointer to the contents in the success state.
14355     * Reading from this pointer when `result_ok` is not set is undefined.
14356     */
14357    struct LDKSocketAddress *result;
14358    /**
14359     * A pointer to the contents in the error state.
14360     * Reading from this pointer when `result_ok` is set is undefined.
14361     */
14362    enum LDKSocketAddressParseError *err;
14363 } LDKCResult_SocketAddressSocketAddressParseErrorZPtr;
14364
14365 /**
14366  * A CResult_SocketAddressSocketAddressParseErrorZ represents the result of a fallible operation,
14367  * containing a crate::lightning::ln::msgs::SocketAddress on success and a crate::lightning::ln::msgs::SocketAddressParseError on failure.
14368  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
14369  */
14370 typedef struct LDKCResult_SocketAddressSocketAddressParseErrorZ {
14371    /**
14372     * The contents of this CResult_SocketAddressSocketAddressParseErrorZ, accessible via either
14373     * `err` or `result` depending on the state of `result_ok`.
14374     */
14375    union LDKCResult_SocketAddressSocketAddressParseErrorZPtr contents;
14376    /**
14377     * Whether this CResult_SocketAddressSocketAddressParseErrorZ represents a success state.
14378     */
14379    bool result_ok;
14380 } LDKCResult_SocketAddressSocketAddressParseErrorZ;
14381
14382
14383
14384 /**
14385  * An [`update_add_htlc`] message to be sent to or received from a peer.
14386  *
14387  * [`update_add_htlc`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#adding-an-htlc-update_add_htlc
14388  */
14389 typedef struct MUST_USE_STRUCT LDKUpdateAddHTLC {
14390    /**
14391     * A pointer to the opaque Rust object.
14392     * Nearly everywhere, inner must be non-null, however in places where
14393     * the Rust equivalent takes an Option, it may be set to null to indicate None.
14394     */
14395    LDKnativeUpdateAddHTLC *inner;
14396    /**
14397     * Indicates that this is the only struct which contains the same pointer.
14398     * Rust functions which take ownership of an object provided via an argument require
14399     * this to be true and invalidate the object pointed to by inner.
14400     */
14401    bool is_owned;
14402 } LDKUpdateAddHTLC;
14403
14404 /**
14405  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
14406  * This corresponds to std::vector in C++
14407  */
14408 typedef struct LDKCVec_UpdateAddHTLCZ {
14409    /**
14410     * The elements in the array.
14411     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
14412     */
14413    struct LDKUpdateAddHTLC *data;
14414    /**
14415     * The number of elements pointed to by `data`.
14416     */
14417    uintptr_t datalen;
14418 } LDKCVec_UpdateAddHTLCZ;
14419
14420
14421
14422 /**
14423  * An [`update_fulfill_htlc`] message to be sent to or received from a peer.
14424  *
14425  * [`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
14426  */
14427 typedef struct MUST_USE_STRUCT LDKUpdateFulfillHTLC {
14428    /**
14429     * A pointer to the opaque Rust object.
14430     * Nearly everywhere, inner must be non-null, however in places where
14431     * the Rust equivalent takes an Option, it may be set to null to indicate None.
14432     */
14433    LDKnativeUpdateFulfillHTLC *inner;
14434    /**
14435     * Indicates that this is the only struct which contains the same pointer.
14436     * Rust functions which take ownership of an object provided via an argument require
14437     * this to be true and invalidate the object pointed to by inner.
14438     */
14439    bool is_owned;
14440 } LDKUpdateFulfillHTLC;
14441
14442 /**
14443  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
14444  * This corresponds to std::vector in C++
14445  */
14446 typedef struct LDKCVec_UpdateFulfillHTLCZ {
14447    /**
14448     * The elements in the array.
14449     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
14450     */
14451    struct LDKUpdateFulfillHTLC *data;
14452    /**
14453     * The number of elements pointed to by `data`.
14454     */
14455    uintptr_t datalen;
14456 } LDKCVec_UpdateFulfillHTLCZ;
14457
14458
14459
14460 /**
14461  * An [`update_fail_htlc`] message to be sent to or received from a peer.
14462  *
14463  * [`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
14464  */
14465 typedef struct MUST_USE_STRUCT LDKUpdateFailHTLC {
14466    /**
14467     * A pointer to the opaque Rust object.
14468     * Nearly everywhere, inner must be non-null, however in places where
14469     * the Rust equivalent takes an Option, it may be set to null to indicate None.
14470     */
14471    LDKnativeUpdateFailHTLC *inner;
14472    /**
14473     * Indicates that this is the only struct which contains the same pointer.
14474     * Rust functions which take ownership of an object provided via an argument require
14475     * this to be true and invalidate the object pointed to by inner.
14476     */
14477    bool is_owned;
14478 } LDKUpdateFailHTLC;
14479
14480 /**
14481  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
14482  * This corresponds to std::vector in C++
14483  */
14484 typedef struct LDKCVec_UpdateFailHTLCZ {
14485    /**
14486     * The elements in the array.
14487     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
14488     */
14489    struct LDKUpdateFailHTLC *data;
14490    /**
14491     * The number of elements pointed to by `data`.
14492     */
14493    uintptr_t datalen;
14494 } LDKCVec_UpdateFailHTLCZ;
14495
14496
14497
14498 /**
14499  * An [`update_fail_malformed_htlc`] message to be sent to or received from a peer.
14500  *
14501  * [`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
14502  */
14503 typedef struct MUST_USE_STRUCT LDKUpdateFailMalformedHTLC {
14504    /**
14505     * A pointer to the opaque Rust object.
14506     * Nearly everywhere, inner must be non-null, however in places where
14507     * the Rust equivalent takes an Option, it may be set to null to indicate None.
14508     */
14509    LDKnativeUpdateFailMalformedHTLC *inner;
14510    /**
14511     * Indicates that this is the only struct which contains the same pointer.
14512     * Rust functions which take ownership of an object provided via an argument require
14513     * this to be true and invalidate the object pointed to by inner.
14514     */
14515    bool is_owned;
14516 } LDKUpdateFailMalformedHTLC;
14517
14518 /**
14519  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
14520  * This corresponds to std::vector in C++
14521  */
14522 typedef struct LDKCVec_UpdateFailMalformedHTLCZ {
14523    /**
14524     * The elements in the array.
14525     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
14526     */
14527    struct LDKUpdateFailMalformedHTLC *data;
14528    /**
14529     * The number of elements pointed to by `data`.
14530     */
14531    uintptr_t datalen;
14532 } LDKCVec_UpdateFailMalformedHTLCZ;
14533
14534 /**
14535  * The contents of CResult_AcceptChannelDecodeErrorZ
14536  */
14537 typedef union LDKCResult_AcceptChannelDecodeErrorZPtr {
14538    /**
14539     * A pointer to the contents in the success state.
14540     * Reading from this pointer when `result_ok` is not set is undefined.
14541     */
14542    struct LDKAcceptChannel *result;
14543    /**
14544     * A pointer to the contents in the error state.
14545     * Reading from this pointer when `result_ok` is set is undefined.
14546     */
14547    struct LDKDecodeError *err;
14548 } LDKCResult_AcceptChannelDecodeErrorZPtr;
14549
14550 /**
14551  * A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
14552  * containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
14553  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
14554  */
14555 typedef struct LDKCResult_AcceptChannelDecodeErrorZ {
14556    /**
14557     * The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
14558     * `err` or `result` depending on the state of `result_ok`.
14559     */
14560    union LDKCResult_AcceptChannelDecodeErrorZPtr contents;
14561    /**
14562     * Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
14563     */
14564    bool result_ok;
14565 } LDKCResult_AcceptChannelDecodeErrorZ;
14566
14567 /**
14568  * The contents of CResult_AcceptChannelV2DecodeErrorZ
14569  */
14570 typedef union LDKCResult_AcceptChannelV2DecodeErrorZPtr {
14571    /**
14572     * A pointer to the contents in the success state.
14573     * Reading from this pointer when `result_ok` is not set is undefined.
14574     */
14575    struct LDKAcceptChannelV2 *result;
14576    /**
14577     * A pointer to the contents in the error state.
14578     * Reading from this pointer when `result_ok` is set is undefined.
14579     */
14580    struct LDKDecodeError *err;
14581 } LDKCResult_AcceptChannelV2DecodeErrorZPtr;
14582
14583 /**
14584  * A CResult_AcceptChannelV2DecodeErrorZ represents the result of a fallible operation,
14585  * containing a crate::lightning::ln::msgs::AcceptChannelV2 on success and a crate::lightning::ln::msgs::DecodeError on failure.
14586  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
14587  */
14588 typedef struct LDKCResult_AcceptChannelV2DecodeErrorZ {
14589    /**
14590     * The contents of this CResult_AcceptChannelV2DecodeErrorZ, accessible via either
14591     * `err` or `result` depending on the state of `result_ok`.
14592     */
14593    union LDKCResult_AcceptChannelV2DecodeErrorZPtr contents;
14594    /**
14595     * Whether this CResult_AcceptChannelV2DecodeErrorZ represents a success state.
14596     */
14597    bool result_ok;
14598 } LDKCResult_AcceptChannelV2DecodeErrorZ;
14599
14600 /**
14601  * The contents of CResult_StfuDecodeErrorZ
14602  */
14603 typedef union LDKCResult_StfuDecodeErrorZPtr {
14604    /**
14605     * A pointer to the contents in the success state.
14606     * Reading from this pointer when `result_ok` is not set is undefined.
14607     */
14608    struct LDKStfu *result;
14609    /**
14610     * A pointer to the contents in the error state.
14611     * Reading from this pointer when `result_ok` is set is undefined.
14612     */
14613    struct LDKDecodeError *err;
14614 } LDKCResult_StfuDecodeErrorZPtr;
14615
14616 /**
14617  * A CResult_StfuDecodeErrorZ represents the result of a fallible operation,
14618  * containing a crate::lightning::ln::msgs::Stfu on success and a crate::lightning::ln::msgs::DecodeError on failure.
14619  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
14620  */
14621 typedef struct LDKCResult_StfuDecodeErrorZ {
14622    /**
14623     * The contents of this CResult_StfuDecodeErrorZ, accessible via either
14624     * `err` or `result` depending on the state of `result_ok`.
14625     */
14626    union LDKCResult_StfuDecodeErrorZPtr contents;
14627    /**
14628     * Whether this CResult_StfuDecodeErrorZ represents a success state.
14629     */
14630    bool result_ok;
14631 } LDKCResult_StfuDecodeErrorZ;
14632
14633 /**
14634  * The contents of CResult_SpliceDecodeErrorZ
14635  */
14636 typedef union LDKCResult_SpliceDecodeErrorZPtr {
14637    /**
14638     * A pointer to the contents in the success state.
14639     * Reading from this pointer when `result_ok` is not set is undefined.
14640     */
14641    struct LDKSplice *result;
14642    /**
14643     * A pointer to the contents in the error state.
14644     * Reading from this pointer when `result_ok` is set is undefined.
14645     */
14646    struct LDKDecodeError *err;
14647 } LDKCResult_SpliceDecodeErrorZPtr;
14648
14649 /**
14650  * A CResult_SpliceDecodeErrorZ represents the result of a fallible operation,
14651  * containing a crate::lightning::ln::msgs::Splice on success and a crate::lightning::ln::msgs::DecodeError on failure.
14652  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
14653  */
14654 typedef struct LDKCResult_SpliceDecodeErrorZ {
14655    /**
14656     * The contents of this CResult_SpliceDecodeErrorZ, accessible via either
14657     * `err` or `result` depending on the state of `result_ok`.
14658     */
14659    union LDKCResult_SpliceDecodeErrorZPtr contents;
14660    /**
14661     * Whether this CResult_SpliceDecodeErrorZ represents a success state.
14662     */
14663    bool result_ok;
14664 } LDKCResult_SpliceDecodeErrorZ;
14665
14666 /**
14667  * The contents of CResult_SpliceAckDecodeErrorZ
14668  */
14669 typedef union LDKCResult_SpliceAckDecodeErrorZPtr {
14670    /**
14671     * A pointer to the contents in the success state.
14672     * Reading from this pointer when `result_ok` is not set is undefined.
14673     */
14674    struct LDKSpliceAck *result;
14675    /**
14676     * A pointer to the contents in the error state.
14677     * Reading from this pointer when `result_ok` is set is undefined.
14678     */
14679    struct LDKDecodeError *err;
14680 } LDKCResult_SpliceAckDecodeErrorZPtr;
14681
14682 /**
14683  * A CResult_SpliceAckDecodeErrorZ represents the result of a fallible operation,
14684  * containing a crate::lightning::ln::msgs::SpliceAck on success and a crate::lightning::ln::msgs::DecodeError on failure.
14685  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
14686  */
14687 typedef struct LDKCResult_SpliceAckDecodeErrorZ {
14688    /**
14689     * The contents of this CResult_SpliceAckDecodeErrorZ, accessible via either
14690     * `err` or `result` depending on the state of `result_ok`.
14691     */
14692    union LDKCResult_SpliceAckDecodeErrorZPtr contents;
14693    /**
14694     * Whether this CResult_SpliceAckDecodeErrorZ represents a success state.
14695     */
14696    bool result_ok;
14697 } LDKCResult_SpliceAckDecodeErrorZ;
14698
14699 /**
14700  * The contents of CResult_SpliceLockedDecodeErrorZ
14701  */
14702 typedef union LDKCResult_SpliceLockedDecodeErrorZPtr {
14703    /**
14704     * A pointer to the contents in the success state.
14705     * Reading from this pointer when `result_ok` is not set is undefined.
14706     */
14707    struct LDKSpliceLocked *result;
14708    /**
14709     * A pointer to the contents in the error state.
14710     * Reading from this pointer when `result_ok` is set is undefined.
14711     */
14712    struct LDKDecodeError *err;
14713 } LDKCResult_SpliceLockedDecodeErrorZPtr;
14714
14715 /**
14716  * A CResult_SpliceLockedDecodeErrorZ represents the result of a fallible operation,
14717  * containing a crate::lightning::ln::msgs::SpliceLocked on success and a crate::lightning::ln::msgs::DecodeError on failure.
14718  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
14719  */
14720 typedef struct LDKCResult_SpliceLockedDecodeErrorZ {
14721    /**
14722     * The contents of this CResult_SpliceLockedDecodeErrorZ, accessible via either
14723     * `err` or `result` depending on the state of `result_ok`.
14724     */
14725    union LDKCResult_SpliceLockedDecodeErrorZPtr contents;
14726    /**
14727     * Whether this CResult_SpliceLockedDecodeErrorZ represents a success state.
14728     */
14729    bool result_ok;
14730 } LDKCResult_SpliceLockedDecodeErrorZ;
14731
14732 /**
14733  * The contents of CResult_TxAddInputDecodeErrorZ
14734  */
14735 typedef union LDKCResult_TxAddInputDecodeErrorZPtr {
14736    /**
14737     * A pointer to the contents in the success state.
14738     * Reading from this pointer when `result_ok` is not set is undefined.
14739     */
14740    struct LDKTxAddInput *result;
14741    /**
14742     * A pointer to the contents in the error state.
14743     * Reading from this pointer when `result_ok` is set is undefined.
14744     */
14745    struct LDKDecodeError *err;
14746 } LDKCResult_TxAddInputDecodeErrorZPtr;
14747
14748 /**
14749  * A CResult_TxAddInputDecodeErrorZ represents the result of a fallible operation,
14750  * containing a crate::lightning::ln::msgs::TxAddInput on success and a crate::lightning::ln::msgs::DecodeError on failure.
14751  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
14752  */
14753 typedef struct LDKCResult_TxAddInputDecodeErrorZ {
14754    /**
14755     * The contents of this CResult_TxAddInputDecodeErrorZ, accessible via either
14756     * `err` or `result` depending on the state of `result_ok`.
14757     */
14758    union LDKCResult_TxAddInputDecodeErrorZPtr contents;
14759    /**
14760     * Whether this CResult_TxAddInputDecodeErrorZ represents a success state.
14761     */
14762    bool result_ok;
14763 } LDKCResult_TxAddInputDecodeErrorZ;
14764
14765 /**
14766  * The contents of CResult_TxAddOutputDecodeErrorZ
14767  */
14768 typedef union LDKCResult_TxAddOutputDecodeErrorZPtr {
14769    /**
14770     * A pointer to the contents in the success state.
14771     * Reading from this pointer when `result_ok` is not set is undefined.
14772     */
14773    struct LDKTxAddOutput *result;
14774    /**
14775     * A pointer to the contents in the error state.
14776     * Reading from this pointer when `result_ok` is set is undefined.
14777     */
14778    struct LDKDecodeError *err;
14779 } LDKCResult_TxAddOutputDecodeErrorZPtr;
14780
14781 /**
14782  * A CResult_TxAddOutputDecodeErrorZ represents the result of a fallible operation,
14783  * containing a crate::lightning::ln::msgs::TxAddOutput on success and a crate::lightning::ln::msgs::DecodeError on failure.
14784  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
14785  */
14786 typedef struct LDKCResult_TxAddOutputDecodeErrorZ {
14787    /**
14788     * The contents of this CResult_TxAddOutputDecodeErrorZ, accessible via either
14789     * `err` or `result` depending on the state of `result_ok`.
14790     */
14791    union LDKCResult_TxAddOutputDecodeErrorZPtr contents;
14792    /**
14793     * Whether this CResult_TxAddOutputDecodeErrorZ represents a success state.
14794     */
14795    bool result_ok;
14796 } LDKCResult_TxAddOutputDecodeErrorZ;
14797
14798 /**
14799  * The contents of CResult_TxRemoveInputDecodeErrorZ
14800  */
14801 typedef union LDKCResult_TxRemoveInputDecodeErrorZPtr {
14802    /**
14803     * A pointer to the contents in the success state.
14804     * Reading from this pointer when `result_ok` is not set is undefined.
14805     */
14806    struct LDKTxRemoveInput *result;
14807    /**
14808     * A pointer to the contents in the error state.
14809     * Reading from this pointer when `result_ok` is set is undefined.
14810     */
14811    struct LDKDecodeError *err;
14812 } LDKCResult_TxRemoveInputDecodeErrorZPtr;
14813
14814 /**
14815  * A CResult_TxRemoveInputDecodeErrorZ represents the result of a fallible operation,
14816  * containing a crate::lightning::ln::msgs::TxRemoveInput on success and a crate::lightning::ln::msgs::DecodeError on failure.
14817  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
14818  */
14819 typedef struct LDKCResult_TxRemoveInputDecodeErrorZ {
14820    /**
14821     * The contents of this CResult_TxRemoveInputDecodeErrorZ, accessible via either
14822     * `err` or `result` depending on the state of `result_ok`.
14823     */
14824    union LDKCResult_TxRemoveInputDecodeErrorZPtr contents;
14825    /**
14826     * Whether this CResult_TxRemoveInputDecodeErrorZ represents a success state.
14827     */
14828    bool result_ok;
14829 } LDKCResult_TxRemoveInputDecodeErrorZ;
14830
14831 /**
14832  * The contents of CResult_TxRemoveOutputDecodeErrorZ
14833  */
14834 typedef union LDKCResult_TxRemoveOutputDecodeErrorZPtr {
14835    /**
14836     * A pointer to the contents in the success state.
14837     * Reading from this pointer when `result_ok` is not set is undefined.
14838     */
14839    struct LDKTxRemoveOutput *result;
14840    /**
14841     * A pointer to the contents in the error state.
14842     * Reading from this pointer when `result_ok` is set is undefined.
14843     */
14844    struct LDKDecodeError *err;
14845 } LDKCResult_TxRemoveOutputDecodeErrorZPtr;
14846
14847 /**
14848  * A CResult_TxRemoveOutputDecodeErrorZ represents the result of a fallible operation,
14849  * containing a crate::lightning::ln::msgs::TxRemoveOutput on success and a crate::lightning::ln::msgs::DecodeError on failure.
14850  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
14851  */
14852 typedef struct LDKCResult_TxRemoveOutputDecodeErrorZ {
14853    /**
14854     * The contents of this CResult_TxRemoveOutputDecodeErrorZ, accessible via either
14855     * `err` or `result` depending on the state of `result_ok`.
14856     */
14857    union LDKCResult_TxRemoveOutputDecodeErrorZPtr contents;
14858    /**
14859     * Whether this CResult_TxRemoveOutputDecodeErrorZ represents a success state.
14860     */
14861    bool result_ok;
14862 } LDKCResult_TxRemoveOutputDecodeErrorZ;
14863
14864 /**
14865  * The contents of CResult_TxCompleteDecodeErrorZ
14866  */
14867 typedef union LDKCResult_TxCompleteDecodeErrorZPtr {
14868    /**
14869     * A pointer to the contents in the success state.
14870     * Reading from this pointer when `result_ok` is not set is undefined.
14871     */
14872    struct LDKTxComplete *result;
14873    /**
14874     * A pointer to the contents in the error state.
14875     * Reading from this pointer when `result_ok` is set is undefined.
14876     */
14877    struct LDKDecodeError *err;
14878 } LDKCResult_TxCompleteDecodeErrorZPtr;
14879
14880 /**
14881  * A CResult_TxCompleteDecodeErrorZ represents the result of a fallible operation,
14882  * containing a crate::lightning::ln::msgs::TxComplete on success and a crate::lightning::ln::msgs::DecodeError on failure.
14883  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
14884  */
14885 typedef struct LDKCResult_TxCompleteDecodeErrorZ {
14886    /**
14887     * The contents of this CResult_TxCompleteDecodeErrorZ, accessible via either
14888     * `err` or `result` depending on the state of `result_ok`.
14889     */
14890    union LDKCResult_TxCompleteDecodeErrorZPtr contents;
14891    /**
14892     * Whether this CResult_TxCompleteDecodeErrorZ represents a success state.
14893     */
14894    bool result_ok;
14895 } LDKCResult_TxCompleteDecodeErrorZ;
14896
14897 /**
14898  * The contents of CResult_TxSignaturesDecodeErrorZ
14899  */
14900 typedef union LDKCResult_TxSignaturesDecodeErrorZPtr {
14901    /**
14902     * A pointer to the contents in the success state.
14903     * Reading from this pointer when `result_ok` is not set is undefined.
14904     */
14905    struct LDKTxSignatures *result;
14906    /**
14907     * A pointer to the contents in the error state.
14908     * Reading from this pointer when `result_ok` is set is undefined.
14909     */
14910    struct LDKDecodeError *err;
14911 } LDKCResult_TxSignaturesDecodeErrorZPtr;
14912
14913 /**
14914  * A CResult_TxSignaturesDecodeErrorZ represents the result of a fallible operation,
14915  * containing a crate::lightning::ln::msgs::TxSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
14916  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
14917  */
14918 typedef struct LDKCResult_TxSignaturesDecodeErrorZ {
14919    /**
14920     * The contents of this CResult_TxSignaturesDecodeErrorZ, accessible via either
14921     * `err` or `result` depending on the state of `result_ok`.
14922     */
14923    union LDKCResult_TxSignaturesDecodeErrorZPtr contents;
14924    /**
14925     * Whether this CResult_TxSignaturesDecodeErrorZ represents a success state.
14926     */
14927    bool result_ok;
14928 } LDKCResult_TxSignaturesDecodeErrorZ;
14929
14930 /**
14931  * The contents of CResult_TxInitRbfDecodeErrorZ
14932  */
14933 typedef union LDKCResult_TxInitRbfDecodeErrorZPtr {
14934    /**
14935     * A pointer to the contents in the success state.
14936     * Reading from this pointer when `result_ok` is not set is undefined.
14937     */
14938    struct LDKTxInitRbf *result;
14939    /**
14940     * A pointer to the contents in the error state.
14941     * Reading from this pointer when `result_ok` is set is undefined.
14942     */
14943    struct LDKDecodeError *err;
14944 } LDKCResult_TxInitRbfDecodeErrorZPtr;
14945
14946 /**
14947  * A CResult_TxInitRbfDecodeErrorZ represents the result of a fallible operation,
14948  * containing a crate::lightning::ln::msgs::TxInitRbf on success and a crate::lightning::ln::msgs::DecodeError on failure.
14949  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
14950  */
14951 typedef struct LDKCResult_TxInitRbfDecodeErrorZ {
14952    /**
14953     * The contents of this CResult_TxInitRbfDecodeErrorZ, accessible via either
14954     * `err` or `result` depending on the state of `result_ok`.
14955     */
14956    union LDKCResult_TxInitRbfDecodeErrorZPtr contents;
14957    /**
14958     * Whether this CResult_TxInitRbfDecodeErrorZ represents a success state.
14959     */
14960    bool result_ok;
14961 } LDKCResult_TxInitRbfDecodeErrorZ;
14962
14963 /**
14964  * The contents of CResult_TxAckRbfDecodeErrorZ
14965  */
14966 typedef union LDKCResult_TxAckRbfDecodeErrorZPtr {
14967    /**
14968     * A pointer to the contents in the success state.
14969     * Reading from this pointer when `result_ok` is not set is undefined.
14970     */
14971    struct LDKTxAckRbf *result;
14972    /**
14973     * A pointer to the contents in the error state.
14974     * Reading from this pointer when `result_ok` is set is undefined.
14975     */
14976    struct LDKDecodeError *err;
14977 } LDKCResult_TxAckRbfDecodeErrorZPtr;
14978
14979 /**
14980  * A CResult_TxAckRbfDecodeErrorZ represents the result of a fallible operation,
14981  * containing a crate::lightning::ln::msgs::TxAckRbf on success and a crate::lightning::ln::msgs::DecodeError on failure.
14982  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
14983  */
14984 typedef struct LDKCResult_TxAckRbfDecodeErrorZ {
14985    /**
14986     * The contents of this CResult_TxAckRbfDecodeErrorZ, accessible via either
14987     * `err` or `result` depending on the state of `result_ok`.
14988     */
14989    union LDKCResult_TxAckRbfDecodeErrorZPtr contents;
14990    /**
14991     * Whether this CResult_TxAckRbfDecodeErrorZ represents a success state.
14992     */
14993    bool result_ok;
14994 } LDKCResult_TxAckRbfDecodeErrorZ;
14995
14996 /**
14997  * The contents of CResult_TxAbortDecodeErrorZ
14998  */
14999 typedef union LDKCResult_TxAbortDecodeErrorZPtr {
15000    /**
15001     * A pointer to the contents in the success state.
15002     * Reading from this pointer when `result_ok` is not set is undefined.
15003     */
15004    struct LDKTxAbort *result;
15005    /**
15006     * A pointer to the contents in the error state.
15007     * Reading from this pointer when `result_ok` is set is undefined.
15008     */
15009    struct LDKDecodeError *err;
15010 } LDKCResult_TxAbortDecodeErrorZPtr;
15011
15012 /**
15013  * A CResult_TxAbortDecodeErrorZ represents the result of a fallible operation,
15014  * containing a crate::lightning::ln::msgs::TxAbort on success and a crate::lightning::ln::msgs::DecodeError on failure.
15015  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
15016  */
15017 typedef struct LDKCResult_TxAbortDecodeErrorZ {
15018    /**
15019     * The contents of this CResult_TxAbortDecodeErrorZ, accessible via either
15020     * `err` or `result` depending on the state of `result_ok`.
15021     */
15022    union LDKCResult_TxAbortDecodeErrorZPtr contents;
15023    /**
15024     * Whether this CResult_TxAbortDecodeErrorZ represents a success state.
15025     */
15026    bool result_ok;
15027 } LDKCResult_TxAbortDecodeErrorZ;
15028
15029 /**
15030  * The contents of CResult_AnnouncementSignaturesDecodeErrorZ
15031  */
15032 typedef union LDKCResult_AnnouncementSignaturesDecodeErrorZPtr {
15033    /**
15034     * A pointer to the contents in the success state.
15035     * Reading from this pointer when `result_ok` is not set is undefined.
15036     */
15037    struct LDKAnnouncementSignatures *result;
15038    /**
15039     * A pointer to the contents in the error state.
15040     * Reading from this pointer when `result_ok` is set is undefined.
15041     */
15042    struct LDKDecodeError *err;
15043 } LDKCResult_AnnouncementSignaturesDecodeErrorZPtr;
15044
15045 /**
15046  * A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
15047  * containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
15048  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
15049  */
15050 typedef struct LDKCResult_AnnouncementSignaturesDecodeErrorZ {
15051    /**
15052     * The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
15053     * `err` or `result` depending on the state of `result_ok`.
15054     */
15055    union LDKCResult_AnnouncementSignaturesDecodeErrorZPtr contents;
15056    /**
15057     * Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
15058     */
15059    bool result_ok;
15060 } LDKCResult_AnnouncementSignaturesDecodeErrorZ;
15061
15062 /**
15063  * The contents of CResult_ChannelReestablishDecodeErrorZ
15064  */
15065 typedef union LDKCResult_ChannelReestablishDecodeErrorZPtr {
15066    /**
15067     * A pointer to the contents in the success state.
15068     * Reading from this pointer when `result_ok` is not set is undefined.
15069     */
15070    struct LDKChannelReestablish *result;
15071    /**
15072     * A pointer to the contents in the error state.
15073     * Reading from this pointer when `result_ok` is set is undefined.
15074     */
15075    struct LDKDecodeError *err;
15076 } LDKCResult_ChannelReestablishDecodeErrorZPtr;
15077
15078 /**
15079  * A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
15080  * containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
15081  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
15082  */
15083 typedef struct LDKCResult_ChannelReestablishDecodeErrorZ {
15084    /**
15085     * The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
15086     * `err` or `result` depending on the state of `result_ok`.
15087     */
15088    union LDKCResult_ChannelReestablishDecodeErrorZPtr contents;
15089    /**
15090     * Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
15091     */
15092    bool result_ok;
15093 } LDKCResult_ChannelReestablishDecodeErrorZ;
15094
15095 /**
15096  * The contents of CResult_ClosingSignedDecodeErrorZ
15097  */
15098 typedef union LDKCResult_ClosingSignedDecodeErrorZPtr {
15099    /**
15100     * A pointer to the contents in the success state.
15101     * Reading from this pointer when `result_ok` is not set is undefined.
15102     */
15103    struct LDKClosingSigned *result;
15104    /**
15105     * A pointer to the contents in the error state.
15106     * Reading from this pointer when `result_ok` is set is undefined.
15107     */
15108    struct LDKDecodeError *err;
15109 } LDKCResult_ClosingSignedDecodeErrorZPtr;
15110
15111 /**
15112  * A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
15113  * containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
15114  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
15115  */
15116 typedef struct LDKCResult_ClosingSignedDecodeErrorZ {
15117    /**
15118     * The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
15119     * `err` or `result` depending on the state of `result_ok`.
15120     */
15121    union LDKCResult_ClosingSignedDecodeErrorZPtr contents;
15122    /**
15123     * Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
15124     */
15125    bool result_ok;
15126 } LDKCResult_ClosingSignedDecodeErrorZ;
15127
15128
15129
15130 /**
15131  * The minimum and maximum fees which the sender is willing to place on the closing transaction.
15132  *
15133  * This is provided in [`ClosingSigned`] by both sides to indicate the fee range they are willing
15134  * to use.
15135  */
15136 typedef struct MUST_USE_STRUCT LDKClosingSignedFeeRange {
15137    /**
15138     * A pointer to the opaque Rust object.
15139     * Nearly everywhere, inner must be non-null, however in places where
15140     * the Rust equivalent takes an Option, it may be set to null to indicate None.
15141     */
15142    LDKnativeClosingSignedFeeRange *inner;
15143    /**
15144     * Indicates that this is the only struct which contains the same pointer.
15145     * Rust functions which take ownership of an object provided via an argument require
15146     * this to be true and invalidate the object pointed to by inner.
15147     */
15148    bool is_owned;
15149 } LDKClosingSignedFeeRange;
15150
15151 /**
15152  * The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ
15153  */
15154 typedef union LDKCResult_ClosingSignedFeeRangeDecodeErrorZPtr {
15155    /**
15156     * A pointer to the contents in the success state.
15157     * Reading from this pointer when `result_ok` is not set is undefined.
15158     */
15159    struct LDKClosingSignedFeeRange *result;
15160    /**
15161     * A pointer to the contents in the error state.
15162     * Reading from this pointer when `result_ok` is set is undefined.
15163     */
15164    struct LDKDecodeError *err;
15165 } LDKCResult_ClosingSignedFeeRangeDecodeErrorZPtr;
15166
15167 /**
15168  * A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation,
15169  * containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
15170  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
15171  */
15172 typedef struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ {
15173    /**
15174     * The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either
15175     * `err` or `result` depending on the state of `result_ok`.
15176     */
15177    union LDKCResult_ClosingSignedFeeRangeDecodeErrorZPtr contents;
15178    /**
15179     * Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state.
15180     */
15181    bool result_ok;
15182 } LDKCResult_ClosingSignedFeeRangeDecodeErrorZ;
15183
15184
15185
15186 /**
15187  * A [`commitment_signed`] message to be sent to or received from a peer.
15188  *
15189  * [`commitment_signed`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#committing-updates-so-far-commitment_signed
15190  */
15191 typedef struct MUST_USE_STRUCT LDKCommitmentSigned {
15192    /**
15193     * A pointer to the opaque Rust object.
15194     * Nearly everywhere, inner must be non-null, however in places where
15195     * the Rust equivalent takes an Option, it may be set to null to indicate None.
15196     */
15197    LDKnativeCommitmentSigned *inner;
15198    /**
15199     * Indicates that this is the only struct which contains the same pointer.
15200     * Rust functions which take ownership of an object provided via an argument require
15201     * this to be true and invalidate the object pointed to by inner.
15202     */
15203    bool is_owned;
15204 } LDKCommitmentSigned;
15205
15206 /**
15207  * The contents of CResult_CommitmentSignedDecodeErrorZ
15208  */
15209 typedef union LDKCResult_CommitmentSignedDecodeErrorZPtr {
15210    /**
15211     * A pointer to the contents in the success state.
15212     * Reading from this pointer when `result_ok` is not set is undefined.
15213     */
15214    struct LDKCommitmentSigned *result;
15215    /**
15216     * A pointer to the contents in the error state.
15217     * Reading from this pointer when `result_ok` is set is undefined.
15218     */
15219    struct LDKDecodeError *err;
15220 } LDKCResult_CommitmentSignedDecodeErrorZPtr;
15221
15222 /**
15223  * A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
15224  * containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
15225  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
15226  */
15227 typedef struct LDKCResult_CommitmentSignedDecodeErrorZ {
15228    /**
15229     * The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
15230     * `err` or `result` depending on the state of `result_ok`.
15231     */
15232    union LDKCResult_CommitmentSignedDecodeErrorZPtr contents;
15233    /**
15234     * Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
15235     */
15236    bool result_ok;
15237 } LDKCResult_CommitmentSignedDecodeErrorZ;
15238
15239 /**
15240  * The contents of CResult_FundingCreatedDecodeErrorZ
15241  */
15242 typedef union LDKCResult_FundingCreatedDecodeErrorZPtr {
15243    /**
15244     * A pointer to the contents in the success state.
15245     * Reading from this pointer when `result_ok` is not set is undefined.
15246     */
15247    struct LDKFundingCreated *result;
15248    /**
15249     * A pointer to the contents in the error state.
15250     * Reading from this pointer when `result_ok` is set is undefined.
15251     */
15252    struct LDKDecodeError *err;
15253 } LDKCResult_FundingCreatedDecodeErrorZPtr;
15254
15255 /**
15256  * A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
15257  * containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
15258  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
15259  */
15260 typedef struct LDKCResult_FundingCreatedDecodeErrorZ {
15261    /**
15262     * The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
15263     * `err` or `result` depending on the state of `result_ok`.
15264     */
15265    union LDKCResult_FundingCreatedDecodeErrorZPtr contents;
15266    /**
15267     * Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
15268     */
15269    bool result_ok;
15270 } LDKCResult_FundingCreatedDecodeErrorZ;
15271
15272 /**
15273  * The contents of CResult_FundingSignedDecodeErrorZ
15274  */
15275 typedef union LDKCResult_FundingSignedDecodeErrorZPtr {
15276    /**
15277     * A pointer to the contents in the success state.
15278     * Reading from this pointer when `result_ok` is not set is undefined.
15279     */
15280    struct LDKFundingSigned *result;
15281    /**
15282     * A pointer to the contents in the error state.
15283     * Reading from this pointer when `result_ok` is set is undefined.
15284     */
15285    struct LDKDecodeError *err;
15286 } LDKCResult_FundingSignedDecodeErrorZPtr;
15287
15288 /**
15289  * A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
15290  * containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
15291  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
15292  */
15293 typedef struct LDKCResult_FundingSignedDecodeErrorZ {
15294    /**
15295     * The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
15296     * `err` or `result` depending on the state of `result_ok`.
15297     */
15298    union LDKCResult_FundingSignedDecodeErrorZPtr contents;
15299    /**
15300     * Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
15301     */
15302    bool result_ok;
15303 } LDKCResult_FundingSignedDecodeErrorZ;
15304
15305 /**
15306  * The contents of CResult_ChannelReadyDecodeErrorZ
15307  */
15308 typedef union LDKCResult_ChannelReadyDecodeErrorZPtr {
15309    /**
15310     * A pointer to the contents in the success state.
15311     * Reading from this pointer when `result_ok` is not set is undefined.
15312     */
15313    struct LDKChannelReady *result;
15314    /**
15315     * A pointer to the contents in the error state.
15316     * Reading from this pointer when `result_ok` is set is undefined.
15317     */
15318    struct LDKDecodeError *err;
15319 } LDKCResult_ChannelReadyDecodeErrorZPtr;
15320
15321 /**
15322  * A CResult_ChannelReadyDecodeErrorZ represents the result of a fallible operation,
15323  * containing a crate::lightning::ln::msgs::ChannelReady on success and a crate::lightning::ln::msgs::DecodeError on failure.
15324  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
15325  */
15326 typedef struct LDKCResult_ChannelReadyDecodeErrorZ {
15327    /**
15328     * The contents of this CResult_ChannelReadyDecodeErrorZ, accessible via either
15329     * `err` or `result` depending on the state of `result_ok`.
15330     */
15331    union LDKCResult_ChannelReadyDecodeErrorZPtr contents;
15332    /**
15333     * Whether this CResult_ChannelReadyDecodeErrorZ represents a success state.
15334     */
15335    bool result_ok;
15336 } LDKCResult_ChannelReadyDecodeErrorZ;
15337
15338
15339
15340 /**
15341  * An [`init`] message to be sent to or received from a peer.
15342  *
15343  * [`init`]: https://github.com/lightning/bolts/blob/master/01-messaging.md#the-init-message
15344  */
15345 typedef struct MUST_USE_STRUCT LDKInit {
15346    /**
15347     * A pointer to the opaque Rust object.
15348     * Nearly everywhere, inner must be non-null, however in places where
15349     * the Rust equivalent takes an Option, it may be set to null to indicate None.
15350     */
15351    LDKnativeInit *inner;
15352    /**
15353     * Indicates that this is the only struct which contains the same pointer.
15354     * Rust functions which take ownership of an object provided via an argument require
15355     * this to be true and invalidate the object pointed to by inner.
15356     */
15357    bool is_owned;
15358 } LDKInit;
15359
15360 /**
15361  * The contents of CResult_InitDecodeErrorZ
15362  */
15363 typedef union LDKCResult_InitDecodeErrorZPtr {
15364    /**
15365     * A pointer to the contents in the success state.
15366     * Reading from this pointer when `result_ok` is not set is undefined.
15367     */
15368    struct LDKInit *result;
15369    /**
15370     * A pointer to the contents in the error state.
15371     * Reading from this pointer when `result_ok` is set is undefined.
15372     */
15373    struct LDKDecodeError *err;
15374 } LDKCResult_InitDecodeErrorZPtr;
15375
15376 /**
15377  * A CResult_InitDecodeErrorZ represents the result of a fallible operation,
15378  * containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
15379  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
15380  */
15381 typedef struct LDKCResult_InitDecodeErrorZ {
15382    /**
15383     * The contents of this CResult_InitDecodeErrorZ, accessible via either
15384     * `err` or `result` depending on the state of `result_ok`.
15385     */
15386    union LDKCResult_InitDecodeErrorZPtr contents;
15387    /**
15388     * Whether this CResult_InitDecodeErrorZ represents a success state.
15389     */
15390    bool result_ok;
15391 } LDKCResult_InitDecodeErrorZ;
15392
15393 /**
15394  * The contents of CResult_OpenChannelDecodeErrorZ
15395  */
15396 typedef union LDKCResult_OpenChannelDecodeErrorZPtr {
15397    /**
15398     * A pointer to the contents in the success state.
15399     * Reading from this pointer when `result_ok` is not set is undefined.
15400     */
15401    struct LDKOpenChannel *result;
15402    /**
15403     * A pointer to the contents in the error state.
15404     * Reading from this pointer when `result_ok` is set is undefined.
15405     */
15406    struct LDKDecodeError *err;
15407 } LDKCResult_OpenChannelDecodeErrorZPtr;
15408
15409 /**
15410  * A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
15411  * containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
15412  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
15413  */
15414 typedef struct LDKCResult_OpenChannelDecodeErrorZ {
15415    /**
15416     * The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
15417     * `err` or `result` depending on the state of `result_ok`.
15418     */
15419    union LDKCResult_OpenChannelDecodeErrorZPtr contents;
15420    /**
15421     * Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
15422     */
15423    bool result_ok;
15424 } LDKCResult_OpenChannelDecodeErrorZ;
15425
15426 /**
15427  * The contents of CResult_OpenChannelV2DecodeErrorZ
15428  */
15429 typedef union LDKCResult_OpenChannelV2DecodeErrorZPtr {
15430    /**
15431     * A pointer to the contents in the success state.
15432     * Reading from this pointer when `result_ok` is not set is undefined.
15433     */
15434    struct LDKOpenChannelV2 *result;
15435    /**
15436     * A pointer to the contents in the error state.
15437     * Reading from this pointer when `result_ok` is set is undefined.
15438     */
15439    struct LDKDecodeError *err;
15440 } LDKCResult_OpenChannelV2DecodeErrorZPtr;
15441
15442 /**
15443  * A CResult_OpenChannelV2DecodeErrorZ represents the result of a fallible operation,
15444  * containing a crate::lightning::ln::msgs::OpenChannelV2 on success and a crate::lightning::ln::msgs::DecodeError on failure.
15445  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
15446  */
15447 typedef struct LDKCResult_OpenChannelV2DecodeErrorZ {
15448    /**
15449     * The contents of this CResult_OpenChannelV2DecodeErrorZ, accessible via either
15450     * `err` or `result` depending on the state of `result_ok`.
15451     */
15452    union LDKCResult_OpenChannelV2DecodeErrorZPtr contents;
15453    /**
15454     * Whether this CResult_OpenChannelV2DecodeErrorZ represents a success state.
15455     */
15456    bool result_ok;
15457 } LDKCResult_OpenChannelV2DecodeErrorZ;
15458
15459 /**
15460  * The contents of CResult_RevokeAndACKDecodeErrorZ
15461  */
15462 typedef union LDKCResult_RevokeAndACKDecodeErrorZPtr {
15463    /**
15464     * A pointer to the contents in the success state.
15465     * Reading from this pointer when `result_ok` is not set is undefined.
15466     */
15467    struct LDKRevokeAndACK *result;
15468    /**
15469     * A pointer to the contents in the error state.
15470     * Reading from this pointer when `result_ok` is set is undefined.
15471     */
15472    struct LDKDecodeError *err;
15473 } LDKCResult_RevokeAndACKDecodeErrorZPtr;
15474
15475 /**
15476  * A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
15477  * containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
15478  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
15479  */
15480 typedef struct LDKCResult_RevokeAndACKDecodeErrorZ {
15481    /**
15482     * The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
15483     * `err` or `result` depending on the state of `result_ok`.
15484     */
15485    union LDKCResult_RevokeAndACKDecodeErrorZPtr contents;
15486    /**
15487     * Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
15488     */
15489    bool result_ok;
15490 } LDKCResult_RevokeAndACKDecodeErrorZ;
15491
15492 /**
15493  * The contents of CResult_ShutdownDecodeErrorZ
15494  */
15495 typedef union LDKCResult_ShutdownDecodeErrorZPtr {
15496    /**
15497     * A pointer to the contents in the success state.
15498     * Reading from this pointer when `result_ok` is not set is undefined.
15499     */
15500    struct LDKShutdown *result;
15501    /**
15502     * A pointer to the contents in the error state.
15503     * Reading from this pointer when `result_ok` is set is undefined.
15504     */
15505    struct LDKDecodeError *err;
15506 } LDKCResult_ShutdownDecodeErrorZPtr;
15507
15508 /**
15509  * A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
15510  * containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
15511  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
15512  */
15513 typedef struct LDKCResult_ShutdownDecodeErrorZ {
15514    /**
15515     * The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
15516     * `err` or `result` depending on the state of `result_ok`.
15517     */
15518    union LDKCResult_ShutdownDecodeErrorZPtr contents;
15519    /**
15520     * Whether this CResult_ShutdownDecodeErrorZ represents a success state.
15521     */
15522    bool result_ok;
15523 } LDKCResult_ShutdownDecodeErrorZ;
15524
15525 /**
15526  * The contents of CResult_UpdateFailHTLCDecodeErrorZ
15527  */
15528 typedef union LDKCResult_UpdateFailHTLCDecodeErrorZPtr {
15529    /**
15530     * A pointer to the contents in the success state.
15531     * Reading from this pointer when `result_ok` is not set is undefined.
15532     */
15533    struct LDKUpdateFailHTLC *result;
15534    /**
15535     * A pointer to the contents in the error state.
15536     * Reading from this pointer when `result_ok` is set is undefined.
15537     */
15538    struct LDKDecodeError *err;
15539 } LDKCResult_UpdateFailHTLCDecodeErrorZPtr;
15540
15541 /**
15542  * A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
15543  * containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
15544  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
15545  */
15546 typedef struct LDKCResult_UpdateFailHTLCDecodeErrorZ {
15547    /**
15548     * The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
15549     * `err` or `result` depending on the state of `result_ok`.
15550     */
15551    union LDKCResult_UpdateFailHTLCDecodeErrorZPtr contents;
15552    /**
15553     * Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
15554     */
15555    bool result_ok;
15556 } LDKCResult_UpdateFailHTLCDecodeErrorZ;
15557
15558 /**
15559  * The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
15560  */
15561 typedef union LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
15562    /**
15563     * A pointer to the contents in the success state.
15564     * Reading from this pointer when `result_ok` is not set is undefined.
15565     */
15566    struct LDKUpdateFailMalformedHTLC *result;
15567    /**
15568     * A pointer to the contents in the error state.
15569     * Reading from this pointer when `result_ok` is set is undefined.
15570     */
15571    struct LDKDecodeError *err;
15572 } LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr;
15573
15574 /**
15575  * A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
15576  * containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
15577  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
15578  */
15579 typedef struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ {
15580    /**
15581     * The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
15582     * `err` or `result` depending on the state of `result_ok`.
15583     */
15584    union LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr contents;
15585    /**
15586     * Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
15587     */
15588    bool result_ok;
15589 } LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ;
15590
15591
15592
15593 /**
15594  * An [`update_fee`] message to be sent to or received from a peer
15595  *
15596  * [`update_fee`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#updating-fees-update_fee
15597  */
15598 typedef struct MUST_USE_STRUCT LDKUpdateFee {
15599    /**
15600     * A pointer to the opaque Rust object.
15601     * Nearly everywhere, inner must be non-null, however in places where
15602     * the Rust equivalent takes an Option, it may be set to null to indicate None.
15603     */
15604    LDKnativeUpdateFee *inner;
15605    /**
15606     * Indicates that this is the only struct which contains the same pointer.
15607     * Rust functions which take ownership of an object provided via an argument require
15608     * this to be true and invalidate the object pointed to by inner.
15609     */
15610    bool is_owned;
15611 } LDKUpdateFee;
15612
15613 /**
15614  * The contents of CResult_UpdateFeeDecodeErrorZ
15615  */
15616 typedef union LDKCResult_UpdateFeeDecodeErrorZPtr {
15617    /**
15618     * A pointer to the contents in the success state.
15619     * Reading from this pointer when `result_ok` is not set is undefined.
15620     */
15621    struct LDKUpdateFee *result;
15622    /**
15623     * A pointer to the contents in the error state.
15624     * Reading from this pointer when `result_ok` is set is undefined.
15625     */
15626    struct LDKDecodeError *err;
15627 } LDKCResult_UpdateFeeDecodeErrorZPtr;
15628
15629 /**
15630  * A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
15631  * containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
15632  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
15633  */
15634 typedef struct LDKCResult_UpdateFeeDecodeErrorZ {
15635    /**
15636     * The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
15637     * `err` or `result` depending on the state of `result_ok`.
15638     */
15639    union LDKCResult_UpdateFeeDecodeErrorZPtr contents;
15640    /**
15641     * Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
15642     */
15643    bool result_ok;
15644 } LDKCResult_UpdateFeeDecodeErrorZ;
15645
15646 /**
15647  * The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
15648  */
15649 typedef union LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr {
15650    /**
15651     * A pointer to the contents in the success state.
15652     * Reading from this pointer when `result_ok` is not set is undefined.
15653     */
15654    struct LDKUpdateFulfillHTLC *result;
15655    /**
15656     * A pointer to the contents in the error state.
15657     * Reading from this pointer when `result_ok` is set is undefined.
15658     */
15659    struct LDKDecodeError *err;
15660 } LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr;
15661
15662 /**
15663  * A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
15664  * containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
15665  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
15666  */
15667 typedef struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ {
15668    /**
15669     * The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
15670     * `err` or `result` depending on the state of `result_ok`.
15671     */
15672    union LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr contents;
15673    /**
15674     * Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
15675     */
15676    bool result_ok;
15677 } LDKCResult_UpdateFulfillHTLCDecodeErrorZ;
15678
15679 /**
15680  * The contents of CResult_OnionPacketDecodeErrorZ
15681  */
15682 typedef union LDKCResult_OnionPacketDecodeErrorZPtr {
15683    /**
15684     * A pointer to the contents in the success state.
15685     * Reading from this pointer when `result_ok` is not set is undefined.
15686     */
15687    struct LDKOnionPacket *result;
15688    /**
15689     * A pointer to the contents in the error state.
15690     * Reading from this pointer when `result_ok` is set is undefined.
15691     */
15692    struct LDKDecodeError *err;
15693 } LDKCResult_OnionPacketDecodeErrorZPtr;
15694
15695 /**
15696  * A CResult_OnionPacketDecodeErrorZ represents the result of a fallible operation,
15697  * containing a crate::lightning::ln::msgs::OnionPacket on success and a crate::lightning::ln::msgs::DecodeError on failure.
15698  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
15699  */
15700 typedef struct LDKCResult_OnionPacketDecodeErrorZ {
15701    /**
15702     * The contents of this CResult_OnionPacketDecodeErrorZ, accessible via either
15703     * `err` or `result` depending on the state of `result_ok`.
15704     */
15705    union LDKCResult_OnionPacketDecodeErrorZPtr contents;
15706    /**
15707     * Whether this CResult_OnionPacketDecodeErrorZ represents a success state.
15708     */
15709    bool result_ok;
15710 } LDKCResult_OnionPacketDecodeErrorZ;
15711
15712 /**
15713  * The contents of CResult_UpdateAddHTLCDecodeErrorZ
15714  */
15715 typedef union LDKCResult_UpdateAddHTLCDecodeErrorZPtr {
15716    /**
15717     * A pointer to the contents in the success state.
15718     * Reading from this pointer when `result_ok` is not set is undefined.
15719     */
15720    struct LDKUpdateAddHTLC *result;
15721    /**
15722     * A pointer to the contents in the error state.
15723     * Reading from this pointer when `result_ok` is set is undefined.
15724     */
15725    struct LDKDecodeError *err;
15726 } LDKCResult_UpdateAddHTLCDecodeErrorZPtr;
15727
15728 /**
15729  * A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
15730  * containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
15731  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
15732  */
15733 typedef struct LDKCResult_UpdateAddHTLCDecodeErrorZ {
15734    /**
15735     * The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
15736     * `err` or `result` depending on the state of `result_ok`.
15737     */
15738    union LDKCResult_UpdateAddHTLCDecodeErrorZPtr contents;
15739    /**
15740     * Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
15741     */
15742    bool result_ok;
15743 } LDKCResult_UpdateAddHTLCDecodeErrorZ;
15744
15745
15746
15747 /**
15748  * An onion message to be sent to or received from a peer.
15749  *
15750  */
15751 typedef struct MUST_USE_STRUCT LDKOnionMessage {
15752    /**
15753     * A pointer to the opaque Rust object.
15754     * Nearly everywhere, inner must be non-null, however in places where
15755     * the Rust equivalent takes an Option, it may be set to null to indicate None.
15756     */
15757    LDKnativeOnionMessage *inner;
15758    /**
15759     * Indicates that this is the only struct which contains the same pointer.
15760     * Rust functions which take ownership of an object provided via an argument require
15761     * this to be true and invalidate the object pointed to by inner.
15762     */
15763    bool is_owned;
15764 } LDKOnionMessage;
15765
15766 /**
15767  * The contents of CResult_OnionMessageDecodeErrorZ
15768  */
15769 typedef union LDKCResult_OnionMessageDecodeErrorZPtr {
15770    /**
15771     * A pointer to the contents in the success state.
15772     * Reading from this pointer when `result_ok` is not set is undefined.
15773     */
15774    struct LDKOnionMessage *result;
15775    /**
15776     * A pointer to the contents in the error state.
15777     * Reading from this pointer when `result_ok` is set is undefined.
15778     */
15779    struct LDKDecodeError *err;
15780 } LDKCResult_OnionMessageDecodeErrorZPtr;
15781
15782 /**
15783  * A CResult_OnionMessageDecodeErrorZ represents the result of a fallible operation,
15784  * containing a crate::lightning::ln::msgs::OnionMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
15785  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
15786  */
15787 typedef struct LDKCResult_OnionMessageDecodeErrorZ {
15788    /**
15789     * The contents of this CResult_OnionMessageDecodeErrorZ, accessible via either
15790     * `err` or `result` depending on the state of `result_ok`.
15791     */
15792    union LDKCResult_OnionMessageDecodeErrorZPtr contents;
15793    /**
15794     * Whether this CResult_OnionMessageDecodeErrorZ represents a success state.
15795     */
15796    bool result_ok;
15797 } LDKCResult_OnionMessageDecodeErrorZ;
15798
15799 /**
15800  * The contents of CResult_FinalOnionHopDataDecodeErrorZ
15801  */
15802 typedef union LDKCResult_FinalOnionHopDataDecodeErrorZPtr {
15803    /**
15804     * A pointer to the contents in the success state.
15805     * Reading from this pointer when `result_ok` is not set is undefined.
15806     */
15807    struct LDKFinalOnionHopData *result;
15808    /**
15809     * A pointer to the contents in the error state.
15810     * Reading from this pointer when `result_ok` is set is undefined.
15811     */
15812    struct LDKDecodeError *err;
15813 } LDKCResult_FinalOnionHopDataDecodeErrorZPtr;
15814
15815 /**
15816  * A CResult_FinalOnionHopDataDecodeErrorZ represents the result of a fallible operation,
15817  * containing a crate::lightning::ln::msgs::FinalOnionHopData on success and a crate::lightning::ln::msgs::DecodeError on failure.
15818  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
15819  */
15820 typedef struct LDKCResult_FinalOnionHopDataDecodeErrorZ {
15821    /**
15822     * The contents of this CResult_FinalOnionHopDataDecodeErrorZ, accessible via either
15823     * `err` or `result` depending on the state of `result_ok`.
15824     */
15825    union LDKCResult_FinalOnionHopDataDecodeErrorZPtr contents;
15826    /**
15827     * Whether this CResult_FinalOnionHopDataDecodeErrorZ represents a success state.
15828     */
15829    bool result_ok;
15830 } LDKCResult_FinalOnionHopDataDecodeErrorZ;
15831
15832
15833
15834 /**
15835  * A [`ping`] message to be sent to or received from a peer.
15836  *
15837  * [`ping`]: https://github.com/lightning/bolts/blob/master/01-messaging.md#the-ping-and-pong-messages
15838  */
15839 typedef struct MUST_USE_STRUCT LDKPing {
15840    /**
15841     * A pointer to the opaque Rust object.
15842     * Nearly everywhere, inner must be non-null, however in places where
15843     * the Rust equivalent takes an Option, it may be set to null to indicate None.
15844     */
15845    LDKnativePing *inner;
15846    /**
15847     * Indicates that this is the only struct which contains the same pointer.
15848     * Rust functions which take ownership of an object provided via an argument require
15849     * this to be true and invalidate the object pointed to by inner.
15850     */
15851    bool is_owned;
15852 } LDKPing;
15853
15854 /**
15855  * The contents of CResult_PingDecodeErrorZ
15856  */
15857 typedef union LDKCResult_PingDecodeErrorZPtr {
15858    /**
15859     * A pointer to the contents in the success state.
15860     * Reading from this pointer when `result_ok` is not set is undefined.
15861     */
15862    struct LDKPing *result;
15863    /**
15864     * A pointer to the contents in the error state.
15865     * Reading from this pointer when `result_ok` is set is undefined.
15866     */
15867    struct LDKDecodeError *err;
15868 } LDKCResult_PingDecodeErrorZPtr;
15869
15870 /**
15871  * A CResult_PingDecodeErrorZ represents the result of a fallible operation,
15872  * containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
15873  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
15874  */
15875 typedef struct LDKCResult_PingDecodeErrorZ {
15876    /**
15877     * The contents of this CResult_PingDecodeErrorZ, accessible via either
15878     * `err` or `result` depending on the state of `result_ok`.
15879     */
15880    union LDKCResult_PingDecodeErrorZPtr contents;
15881    /**
15882     * Whether this CResult_PingDecodeErrorZ represents a success state.
15883     */
15884    bool result_ok;
15885 } LDKCResult_PingDecodeErrorZ;
15886
15887
15888
15889 /**
15890  * A [`pong`] message to be sent to or received from a peer.
15891  *
15892  * [`pong`]: https://github.com/lightning/bolts/blob/master/01-messaging.md#the-ping-and-pong-messages
15893  */
15894 typedef struct MUST_USE_STRUCT LDKPong {
15895    /**
15896     * A pointer to the opaque Rust object.
15897     * Nearly everywhere, inner must be non-null, however in places where
15898     * the Rust equivalent takes an Option, it may be set to null to indicate None.
15899     */
15900    LDKnativePong *inner;
15901    /**
15902     * Indicates that this is the only struct which contains the same pointer.
15903     * Rust functions which take ownership of an object provided via an argument require
15904     * this to be true and invalidate the object pointed to by inner.
15905     */
15906    bool is_owned;
15907 } LDKPong;
15908
15909 /**
15910  * The contents of CResult_PongDecodeErrorZ
15911  */
15912 typedef union LDKCResult_PongDecodeErrorZPtr {
15913    /**
15914     * A pointer to the contents in the success state.
15915     * Reading from this pointer when `result_ok` is not set is undefined.
15916     */
15917    struct LDKPong *result;
15918    /**
15919     * A pointer to the contents in the error state.
15920     * Reading from this pointer when `result_ok` is set is undefined.
15921     */
15922    struct LDKDecodeError *err;
15923 } LDKCResult_PongDecodeErrorZPtr;
15924
15925 /**
15926  * A CResult_PongDecodeErrorZ represents the result of a fallible operation,
15927  * containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
15928  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
15929  */
15930 typedef struct LDKCResult_PongDecodeErrorZ {
15931    /**
15932     * The contents of this CResult_PongDecodeErrorZ, accessible via either
15933     * `err` or `result` depending on the state of `result_ok`.
15934     */
15935    union LDKCResult_PongDecodeErrorZPtr contents;
15936    /**
15937     * Whether this CResult_PongDecodeErrorZ represents a success state.
15938     */
15939    bool result_ok;
15940 } LDKCResult_PongDecodeErrorZ;
15941
15942 /**
15943  * The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
15944  */
15945 typedef union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
15946    /**
15947     * A pointer to the contents in the success state.
15948     * Reading from this pointer when `result_ok` is not set is undefined.
15949     */
15950    struct LDKUnsignedChannelAnnouncement *result;
15951    /**
15952     * A pointer to the contents in the error state.
15953     * Reading from this pointer when `result_ok` is set is undefined.
15954     */
15955    struct LDKDecodeError *err;
15956 } LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr;
15957
15958 /**
15959  * A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
15960  * containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
15961  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
15962  */
15963 typedef struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ {
15964    /**
15965     * The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
15966     * `err` or `result` depending on the state of `result_ok`.
15967     */
15968    union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr contents;
15969    /**
15970     * Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
15971     */
15972    bool result_ok;
15973 } LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ;
15974
15975 /**
15976  * The contents of CResult_ChannelAnnouncementDecodeErrorZ
15977  */
15978 typedef union LDKCResult_ChannelAnnouncementDecodeErrorZPtr {
15979    /**
15980     * A pointer to the contents in the success state.
15981     * Reading from this pointer when `result_ok` is not set is undefined.
15982     */
15983    struct LDKChannelAnnouncement *result;
15984    /**
15985     * A pointer to the contents in the error state.
15986     * Reading from this pointer when `result_ok` is set is undefined.
15987     */
15988    struct LDKDecodeError *err;
15989 } LDKCResult_ChannelAnnouncementDecodeErrorZPtr;
15990
15991 /**
15992  * A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
15993  * containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
15994  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
15995  */
15996 typedef struct LDKCResult_ChannelAnnouncementDecodeErrorZ {
15997    /**
15998     * The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
15999     * `err` or `result` depending on the state of `result_ok`.
16000     */
16001    union LDKCResult_ChannelAnnouncementDecodeErrorZPtr contents;
16002    /**
16003     * Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
16004     */
16005    bool result_ok;
16006 } LDKCResult_ChannelAnnouncementDecodeErrorZ;
16007
16008 /**
16009  * The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
16010  */
16011 typedef union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr {
16012    /**
16013     * A pointer to the contents in the success state.
16014     * Reading from this pointer when `result_ok` is not set is undefined.
16015     */
16016    struct LDKUnsignedChannelUpdate *result;
16017    /**
16018     * A pointer to the contents in the error state.
16019     * Reading from this pointer when `result_ok` is set is undefined.
16020     */
16021    struct LDKDecodeError *err;
16022 } LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr;
16023
16024 /**
16025  * A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
16026  * containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
16027  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
16028  */
16029 typedef struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ {
16030    /**
16031     * The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
16032     * `err` or `result` depending on the state of `result_ok`.
16033     */
16034    union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr contents;
16035    /**
16036     * Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
16037     */
16038    bool result_ok;
16039 } LDKCResult_UnsignedChannelUpdateDecodeErrorZ;
16040
16041 /**
16042  * The contents of CResult_ChannelUpdateDecodeErrorZ
16043  */
16044 typedef union LDKCResult_ChannelUpdateDecodeErrorZPtr {
16045    /**
16046     * A pointer to the contents in the success state.
16047     * Reading from this pointer when `result_ok` is not set is undefined.
16048     */
16049    struct LDKChannelUpdate *result;
16050    /**
16051     * A pointer to the contents in the error state.
16052     * Reading from this pointer when `result_ok` is set is undefined.
16053     */
16054    struct LDKDecodeError *err;
16055 } LDKCResult_ChannelUpdateDecodeErrorZPtr;
16056
16057 /**
16058  * A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
16059  * containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
16060  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
16061  */
16062 typedef struct LDKCResult_ChannelUpdateDecodeErrorZ {
16063    /**
16064     * The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
16065     * `err` or `result` depending on the state of `result_ok`.
16066     */
16067    union LDKCResult_ChannelUpdateDecodeErrorZPtr contents;
16068    /**
16069     * Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
16070     */
16071    bool result_ok;
16072 } LDKCResult_ChannelUpdateDecodeErrorZ;
16073
16074 /**
16075  * The contents of CResult_ErrorMessageDecodeErrorZ
16076  */
16077 typedef union LDKCResult_ErrorMessageDecodeErrorZPtr {
16078    /**
16079     * A pointer to the contents in the success state.
16080     * Reading from this pointer when `result_ok` is not set is undefined.
16081     */
16082    struct LDKErrorMessage *result;
16083    /**
16084     * A pointer to the contents in the error state.
16085     * Reading from this pointer when `result_ok` is set is undefined.
16086     */
16087    struct LDKDecodeError *err;
16088 } LDKCResult_ErrorMessageDecodeErrorZPtr;
16089
16090 /**
16091  * A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
16092  * containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
16093  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
16094  */
16095 typedef struct LDKCResult_ErrorMessageDecodeErrorZ {
16096    /**
16097     * The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
16098     * `err` or `result` depending on the state of `result_ok`.
16099     */
16100    union LDKCResult_ErrorMessageDecodeErrorZPtr contents;
16101    /**
16102     * Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
16103     */
16104    bool result_ok;
16105 } LDKCResult_ErrorMessageDecodeErrorZ;
16106
16107 /**
16108  * The contents of CResult_WarningMessageDecodeErrorZ
16109  */
16110 typedef union LDKCResult_WarningMessageDecodeErrorZPtr {
16111    /**
16112     * A pointer to the contents in the success state.
16113     * Reading from this pointer when `result_ok` is not set is undefined.
16114     */
16115    struct LDKWarningMessage *result;
16116    /**
16117     * A pointer to the contents in the error state.
16118     * Reading from this pointer when `result_ok` is set is undefined.
16119     */
16120    struct LDKDecodeError *err;
16121 } LDKCResult_WarningMessageDecodeErrorZPtr;
16122
16123 /**
16124  * A CResult_WarningMessageDecodeErrorZ represents the result of a fallible operation,
16125  * containing a crate::lightning::ln::msgs::WarningMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
16126  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
16127  */
16128 typedef struct LDKCResult_WarningMessageDecodeErrorZ {
16129    /**
16130     * The contents of this CResult_WarningMessageDecodeErrorZ, accessible via either
16131     * `err` or `result` depending on the state of `result_ok`.
16132     */
16133    union LDKCResult_WarningMessageDecodeErrorZPtr contents;
16134    /**
16135     * Whether this CResult_WarningMessageDecodeErrorZ represents a success state.
16136     */
16137    bool result_ok;
16138 } LDKCResult_WarningMessageDecodeErrorZ;
16139
16140 /**
16141  * The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
16142  */
16143 typedef union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
16144    /**
16145     * A pointer to the contents in the success state.
16146     * Reading from this pointer when `result_ok` is not set is undefined.
16147     */
16148    struct LDKUnsignedNodeAnnouncement *result;
16149    /**
16150     * A pointer to the contents in the error state.
16151     * Reading from this pointer when `result_ok` is set is undefined.
16152     */
16153    struct LDKDecodeError *err;
16154 } LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr;
16155
16156 /**
16157  * A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
16158  * containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
16159  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
16160  */
16161 typedef struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ {
16162    /**
16163     * The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
16164     * `err` or `result` depending on the state of `result_ok`.
16165     */
16166    union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr contents;
16167    /**
16168     * Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
16169     */
16170    bool result_ok;
16171 } LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ;
16172
16173 /**
16174  * The contents of CResult_NodeAnnouncementDecodeErrorZ
16175  */
16176 typedef union LDKCResult_NodeAnnouncementDecodeErrorZPtr {
16177    /**
16178     * A pointer to the contents in the success state.
16179     * Reading from this pointer when `result_ok` is not set is undefined.
16180     */
16181    struct LDKNodeAnnouncement *result;
16182    /**
16183     * A pointer to the contents in the error state.
16184     * Reading from this pointer when `result_ok` is set is undefined.
16185     */
16186    struct LDKDecodeError *err;
16187 } LDKCResult_NodeAnnouncementDecodeErrorZPtr;
16188
16189 /**
16190  * A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
16191  * containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
16192  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
16193  */
16194 typedef struct LDKCResult_NodeAnnouncementDecodeErrorZ {
16195    /**
16196     * The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
16197     * `err` or `result` depending on the state of `result_ok`.
16198     */
16199    union LDKCResult_NodeAnnouncementDecodeErrorZPtr contents;
16200    /**
16201     * Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
16202     */
16203    bool result_ok;
16204 } LDKCResult_NodeAnnouncementDecodeErrorZ;
16205
16206 /**
16207  * The contents of CResult_QueryShortChannelIdsDecodeErrorZ
16208  */
16209 typedef union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr {
16210    /**
16211     * A pointer to the contents in the success state.
16212     * Reading from this pointer when `result_ok` is not set is undefined.
16213     */
16214    struct LDKQueryShortChannelIds *result;
16215    /**
16216     * A pointer to the contents in the error state.
16217     * Reading from this pointer when `result_ok` is set is undefined.
16218     */
16219    struct LDKDecodeError *err;
16220 } LDKCResult_QueryShortChannelIdsDecodeErrorZPtr;
16221
16222 /**
16223  * A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
16224  * containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
16225  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
16226  */
16227 typedef struct LDKCResult_QueryShortChannelIdsDecodeErrorZ {
16228    /**
16229     * The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
16230     * `err` or `result` depending on the state of `result_ok`.
16231     */
16232    union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr contents;
16233    /**
16234     * Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
16235     */
16236    bool result_ok;
16237 } LDKCResult_QueryShortChannelIdsDecodeErrorZ;
16238
16239
16240
16241 /**
16242  * A [`reply_short_channel_ids_end`] message is sent as a reply to a
16243  * message. The query recipient makes a best
16244  * effort to respond based on their local network view which may not be
16245  * a perfect view of the network.
16246  *
16247  * [`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
16248  */
16249 typedef struct MUST_USE_STRUCT LDKReplyShortChannelIdsEnd {
16250    /**
16251     * A pointer to the opaque Rust object.
16252     * Nearly everywhere, inner must be non-null, however in places where
16253     * the Rust equivalent takes an Option, it may be set to null to indicate None.
16254     */
16255    LDKnativeReplyShortChannelIdsEnd *inner;
16256    /**
16257     * Indicates that this is the only struct which contains the same pointer.
16258     * Rust functions which take ownership of an object provided via an argument require
16259     * this to be true and invalidate the object pointed to by inner.
16260     */
16261    bool is_owned;
16262 } LDKReplyShortChannelIdsEnd;
16263
16264 /**
16265  * The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
16266  */
16267 typedef union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
16268    /**
16269     * A pointer to the contents in the success state.
16270     * Reading from this pointer when `result_ok` is not set is undefined.
16271     */
16272    struct LDKReplyShortChannelIdsEnd *result;
16273    /**
16274     * A pointer to the contents in the error state.
16275     * Reading from this pointer when `result_ok` is set is undefined.
16276     */
16277    struct LDKDecodeError *err;
16278 } LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr;
16279
16280 /**
16281  * A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
16282  * containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
16283  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
16284  */
16285 typedef struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ {
16286    /**
16287     * The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
16288     * `err` or `result` depending on the state of `result_ok`.
16289     */
16290    union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr contents;
16291    /**
16292     * Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
16293     */
16294    bool result_ok;
16295 } LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ;
16296
16297 /**
16298  * The contents of CResult_QueryChannelRangeDecodeErrorZ
16299  */
16300 typedef union LDKCResult_QueryChannelRangeDecodeErrorZPtr {
16301    /**
16302     * A pointer to the contents in the success state.
16303     * Reading from this pointer when `result_ok` is not set is undefined.
16304     */
16305    struct LDKQueryChannelRange *result;
16306    /**
16307     * A pointer to the contents in the error state.
16308     * Reading from this pointer when `result_ok` is set is undefined.
16309     */
16310    struct LDKDecodeError *err;
16311 } LDKCResult_QueryChannelRangeDecodeErrorZPtr;
16312
16313 /**
16314  * A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
16315  * containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
16316  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
16317  */
16318 typedef struct LDKCResult_QueryChannelRangeDecodeErrorZ {
16319    /**
16320     * The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
16321     * `err` or `result` depending on the state of `result_ok`.
16322     */
16323    union LDKCResult_QueryChannelRangeDecodeErrorZPtr contents;
16324    /**
16325     * Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
16326     */
16327    bool result_ok;
16328 } LDKCResult_QueryChannelRangeDecodeErrorZ;
16329
16330 /**
16331  * The contents of CResult_ReplyChannelRangeDecodeErrorZ
16332  */
16333 typedef union LDKCResult_ReplyChannelRangeDecodeErrorZPtr {
16334    /**
16335     * A pointer to the contents in the success state.
16336     * Reading from this pointer when `result_ok` is not set is undefined.
16337     */
16338    struct LDKReplyChannelRange *result;
16339    /**
16340     * A pointer to the contents in the error state.
16341     * Reading from this pointer when `result_ok` is set is undefined.
16342     */
16343    struct LDKDecodeError *err;
16344 } LDKCResult_ReplyChannelRangeDecodeErrorZPtr;
16345
16346 /**
16347  * A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
16348  * containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
16349  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
16350  */
16351 typedef struct LDKCResult_ReplyChannelRangeDecodeErrorZ {
16352    /**
16353     * The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
16354     * `err` or `result` depending on the state of `result_ok`.
16355     */
16356    union LDKCResult_ReplyChannelRangeDecodeErrorZPtr contents;
16357    /**
16358     * Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
16359     */
16360    bool result_ok;
16361 } LDKCResult_ReplyChannelRangeDecodeErrorZ;
16362
16363 /**
16364  * The contents of CResult_GossipTimestampFilterDecodeErrorZ
16365  */
16366 typedef union LDKCResult_GossipTimestampFilterDecodeErrorZPtr {
16367    /**
16368     * A pointer to the contents in the success state.
16369     * Reading from this pointer when `result_ok` is not set is undefined.
16370     */
16371    struct LDKGossipTimestampFilter *result;
16372    /**
16373     * A pointer to the contents in the error state.
16374     * Reading from this pointer when `result_ok` is set is undefined.
16375     */
16376    struct LDKDecodeError *err;
16377 } LDKCResult_GossipTimestampFilterDecodeErrorZPtr;
16378
16379 /**
16380  * A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
16381  * containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
16382  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
16383  */
16384 typedef struct LDKCResult_GossipTimestampFilterDecodeErrorZ {
16385    /**
16386     * The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
16387     * `err` or `result` depending on the state of `result_ok`.
16388     */
16389    union LDKCResult_GossipTimestampFilterDecodeErrorZPtr contents;
16390    /**
16391     * Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
16392     */
16393    bool result_ok;
16394 } LDKCResult_GossipTimestampFilterDecodeErrorZ;
16395
16396 /**
16397  * A dynamically-allocated array of crate::lightning::ln::channelmanager::PhantomRouteHintss of arbitrary size.
16398  * This corresponds to std::vector in C++
16399  */
16400 typedef struct LDKCVec_PhantomRouteHintsZ {
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 LDKPhantomRouteHints *data;
16406    /**
16407     * The number of elements pointed to by `data`.
16408     */
16409    uintptr_t datalen;
16410 } LDKCVec_PhantomRouteHintsZ;
16411
16412
16413
16414 /**
16415  * Represents a syntactically and semantically correct lightning BOLT11 invoice.
16416  *
16417  * There are three ways to construct a `Bolt11Invoice`:
16418  *  1. using [`InvoiceBuilder`]
16419  *  2. using [`Bolt11Invoice::from_signed`]
16420  *  3. using `str::parse::<Bolt11Invoice>(&str)` (see [`Bolt11Invoice::from_str`])
16421  *
16422  * [`Bolt11Invoice::from_str`]: crate::Bolt11Invoice#impl-FromStr
16423  */
16424 typedef struct MUST_USE_STRUCT LDKBolt11Invoice {
16425    /**
16426     * A pointer to the opaque Rust object.
16427     * Nearly everywhere, inner must be non-null, however in places where
16428     * the Rust equivalent takes an Option, it may be set to null to indicate None.
16429     */
16430    LDKnativeBolt11Invoice *inner;
16431    /**
16432     * Indicates that this is the only struct which contains the same pointer.
16433     * Rust functions which take ownership of an object provided via an argument require
16434     * this to be true and invalidate the object pointed to by inner.
16435     */
16436    bool is_owned;
16437 } LDKBolt11Invoice;
16438
16439 /**
16440  * When signing using a fallible method either an user-supplied `SignError` or a [`CreationError`]
16441  * may occur.
16442  */
16443 typedef enum LDKSignOrCreationError_Tag {
16444    /**
16445     * An error occurred during signing
16446     */
16447    LDKSignOrCreationError_SignError,
16448    /**
16449     * An error occurred while building the transaction
16450     */
16451    LDKSignOrCreationError_CreationError,
16452    /**
16453     * Must be last for serialization purposes
16454     */
16455    LDKSignOrCreationError_Sentinel,
16456 } LDKSignOrCreationError_Tag;
16457
16458 typedef struct MUST_USE_STRUCT LDKSignOrCreationError {
16459    LDKSignOrCreationError_Tag tag;
16460    union {
16461       struct {
16462          enum LDKCreationError creation_error;
16463       };
16464    };
16465 } LDKSignOrCreationError;
16466
16467 /**
16468  * The contents of CResult_Bolt11InvoiceSignOrCreationErrorZ
16469  */
16470 typedef union LDKCResult_Bolt11InvoiceSignOrCreationErrorZPtr {
16471    /**
16472     * A pointer to the contents in the success state.
16473     * Reading from this pointer when `result_ok` is not set is undefined.
16474     */
16475    struct LDKBolt11Invoice *result;
16476    /**
16477     * A pointer to the contents in the error state.
16478     * Reading from this pointer when `result_ok` is set is undefined.
16479     */
16480    struct LDKSignOrCreationError *err;
16481 } LDKCResult_Bolt11InvoiceSignOrCreationErrorZPtr;
16482
16483 /**
16484  * A CResult_Bolt11InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
16485  * containing a crate::lightning_invoice::Bolt11Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
16486  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
16487  */
16488 typedef struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ {
16489    /**
16490     * The contents of this CResult_Bolt11InvoiceSignOrCreationErrorZ, accessible via either
16491     * `err` or `result` depending on the state of `result_ok`.
16492     */
16493    union LDKCResult_Bolt11InvoiceSignOrCreationErrorZPtr contents;
16494    /**
16495     * Whether this CResult_Bolt11InvoiceSignOrCreationErrorZ represents a success state.
16496     */
16497    bool result_ok;
16498 } LDKCResult_Bolt11InvoiceSignOrCreationErrorZ;
16499
16500
16501
16502 /**
16503  * A simple future which can complete once, and calls some callback(s) when it does so.
16504  */
16505 typedef struct MUST_USE_STRUCT LDKFuture {
16506    /**
16507     * A pointer to the opaque Rust object.
16508     * Nearly everywhere, inner must be non-null, however in places where
16509     * the Rust equivalent takes an Option, it may be set to null to indicate None.
16510     */
16511    LDKnativeFuture *inner;
16512    /**
16513     * Indicates that this is the only struct which contains the same pointer.
16514     * Rust functions which take ownership of an object provided via an argument require
16515     * this to be true and invalidate the object pointed to by inner.
16516     */
16517    bool is_owned;
16518 } LDKFuture;
16519
16520 /**
16521  * A dynamically-allocated array of crate::lightning::util::wakers::Futures of arbitrary size.
16522  * This corresponds to std::vector in C++
16523  */
16524 typedef struct LDKCVec_FutureZ {
16525    /**
16526     * The elements in the array.
16527     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
16528     */
16529    struct LDKFuture *data;
16530    /**
16531     * The number of elements pointed to by `data`.
16532     */
16533    uintptr_t datalen;
16534 } LDKCVec_FutureZ;
16535
16536 /**
16537  * The contents of CResult_OffersMessageDecodeErrorZ
16538  */
16539 typedef union LDKCResult_OffersMessageDecodeErrorZPtr {
16540    /**
16541     * A pointer to the contents in the success state.
16542     * Reading from this pointer when `result_ok` is not set is undefined.
16543     */
16544    struct LDKOffersMessage *result;
16545    /**
16546     * A pointer to the contents in the error state.
16547     * Reading from this pointer when `result_ok` is set is undefined.
16548     */
16549    struct LDKDecodeError *err;
16550 } LDKCResult_OffersMessageDecodeErrorZPtr;
16551
16552 /**
16553  * A CResult_OffersMessageDecodeErrorZ represents the result of a fallible operation,
16554  * containing a crate::lightning::onion_message::offers::OffersMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
16555  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
16556  */
16557 typedef struct LDKCResult_OffersMessageDecodeErrorZ {
16558    /**
16559     * The contents of this CResult_OffersMessageDecodeErrorZ, accessible via either
16560     * `err` or `result` depending on the state of `result_ok`.
16561     */
16562    union LDKCResult_OffersMessageDecodeErrorZPtr contents;
16563    /**
16564     * Whether this CResult_OffersMessageDecodeErrorZ represents a success state.
16565     */
16566    bool result_ok;
16567 } LDKCResult_OffersMessageDecodeErrorZ;
16568
16569 /**
16570  * An enum which can either contain a crate::lightning::ln::chan_utils::HTLCClaim or not
16571  */
16572 typedef enum LDKCOption_HTLCClaimZ_Tag {
16573    /**
16574     * When we're in this state, this COption_HTLCClaimZ contains a crate::lightning::ln::chan_utils::HTLCClaim
16575     */
16576    LDKCOption_HTLCClaimZ_Some,
16577    /**
16578     * When we're in this state, this COption_HTLCClaimZ contains nothing
16579     */
16580    LDKCOption_HTLCClaimZ_None,
16581    /**
16582     * Must be last for serialization purposes
16583     */
16584    LDKCOption_HTLCClaimZ_Sentinel,
16585 } LDKCOption_HTLCClaimZ_Tag;
16586
16587 typedef struct LDKCOption_HTLCClaimZ {
16588    LDKCOption_HTLCClaimZ_Tag tag;
16589    union {
16590       struct {
16591          enum LDKHTLCClaim some;
16592       };
16593    };
16594 } LDKCOption_HTLCClaimZ;
16595
16596
16597
16598 /**
16599  * Implements the per-commitment secret storage scheme from
16600  * [BOLT 3](https://github.com/lightning/bolts/blob/dcbf8583976df087c79c3ce0b535311212e6812d/03-transactions.md#efficient-per-commitment-secret-storage).
16601  *
16602  * Allows us to keep track of all of the revocation secrets of our counterparty in just 50*32 bytes
16603  * or so.
16604  */
16605 typedef struct MUST_USE_STRUCT LDKCounterpartyCommitmentSecrets {
16606    /**
16607     * A pointer to the opaque Rust object.
16608     * Nearly everywhere, inner must be non-null, however in places where
16609     * the Rust equivalent takes an Option, it may be set to null to indicate None.
16610     */
16611    LDKnativeCounterpartyCommitmentSecrets *inner;
16612    /**
16613     * Indicates that this is the only struct which contains the same pointer.
16614     * Rust functions which take ownership of an object provided via an argument require
16615     * this to be true and invalidate the object pointed to by inner.
16616     */
16617    bool is_owned;
16618 } LDKCounterpartyCommitmentSecrets;
16619
16620 /**
16621  * The contents of CResult_CounterpartyCommitmentSecretsDecodeErrorZ
16622  */
16623 typedef union LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
16624    /**
16625     * A pointer to the contents in the success state.
16626     * Reading from this pointer when `result_ok` is not set is undefined.
16627     */
16628    struct LDKCounterpartyCommitmentSecrets *result;
16629    /**
16630     * A pointer to the contents in the error state.
16631     * Reading from this pointer when `result_ok` is set is undefined.
16632     */
16633    struct LDKDecodeError *err;
16634 } LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZPtr;
16635
16636 /**
16637  * A CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents the result of a fallible operation,
16638  * containing a crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets on success and a crate::lightning::ln::msgs::DecodeError on failure.
16639  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
16640  */
16641 typedef struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ {
16642    /**
16643     * The contents of this CResult_CounterpartyCommitmentSecretsDecodeErrorZ, accessible via either
16644     * `err` or `result` depending on the state of `result_ok`.
16645     */
16646    union LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZPtr contents;
16647    /**
16648     * Whether this CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents a success state.
16649     */
16650    bool result_ok;
16651 } LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ;
16652
16653
16654
16655 /**
16656  * The set of public keys which are used in the creation of one commitment transaction.
16657  * These are derived from the channel base keys and per-commitment data.
16658  *
16659  * A broadcaster key is provided from potential broadcaster of the computed transaction.
16660  * A countersignatory key is coming from a protocol participant unable to broadcast the
16661  * transaction.
16662  *
16663  * These keys are assumed to be good, either because the code derived them from
16664  * channel basepoints via the new function, or they were obtained via
16665  * CommitmentTransaction.trust().keys() because we trusted the source of the
16666  * pre-calculated keys.
16667  */
16668 typedef struct MUST_USE_STRUCT LDKTxCreationKeys {
16669    /**
16670     * A pointer to the opaque Rust object.
16671     * Nearly everywhere, inner must be non-null, however in places where
16672     * the Rust equivalent takes an Option, it may be set to null to indicate None.
16673     */
16674    LDKnativeTxCreationKeys *inner;
16675    /**
16676     * Indicates that this is the only struct which contains the same pointer.
16677     * Rust functions which take ownership of an object provided via an argument require
16678     * this to be true and invalidate the object pointed to by inner.
16679     */
16680    bool is_owned;
16681 } LDKTxCreationKeys;
16682
16683 /**
16684  * The contents of CResult_TxCreationKeysDecodeErrorZ
16685  */
16686 typedef union LDKCResult_TxCreationKeysDecodeErrorZPtr {
16687    /**
16688     * A pointer to the contents in the success state.
16689     * Reading from this pointer when `result_ok` is not set is undefined.
16690     */
16691    struct LDKTxCreationKeys *result;
16692    /**
16693     * A pointer to the contents in the error state.
16694     * Reading from this pointer when `result_ok` is set is undefined.
16695     */
16696    struct LDKDecodeError *err;
16697 } LDKCResult_TxCreationKeysDecodeErrorZPtr;
16698
16699 /**
16700  * A CResult_TxCreationKeysDecodeErrorZ represents the result of a fallible operation,
16701  * containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
16702  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
16703  */
16704 typedef struct LDKCResult_TxCreationKeysDecodeErrorZ {
16705    /**
16706     * The contents of this CResult_TxCreationKeysDecodeErrorZ, accessible via either
16707     * `err` or `result` depending on the state of `result_ok`.
16708     */
16709    union LDKCResult_TxCreationKeysDecodeErrorZPtr contents;
16710    /**
16711     * Whether this CResult_TxCreationKeysDecodeErrorZ represents a success state.
16712     */
16713    bool result_ok;
16714 } LDKCResult_TxCreationKeysDecodeErrorZ;
16715
16716 /**
16717  * The contents of CResult_ChannelPublicKeysDecodeErrorZ
16718  */
16719 typedef union LDKCResult_ChannelPublicKeysDecodeErrorZPtr {
16720    /**
16721     * A pointer to the contents in the success state.
16722     * Reading from this pointer when `result_ok` is not set is undefined.
16723     */
16724    struct LDKChannelPublicKeys *result;
16725    /**
16726     * A pointer to the contents in the error state.
16727     * Reading from this pointer when `result_ok` is set is undefined.
16728     */
16729    struct LDKDecodeError *err;
16730 } LDKCResult_ChannelPublicKeysDecodeErrorZPtr;
16731
16732 /**
16733  * A CResult_ChannelPublicKeysDecodeErrorZ represents the result of a fallible operation,
16734  * containing a crate::lightning::ln::chan_utils::ChannelPublicKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
16735  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
16736  */
16737 typedef struct LDKCResult_ChannelPublicKeysDecodeErrorZ {
16738    /**
16739     * The contents of this CResult_ChannelPublicKeysDecodeErrorZ, accessible via either
16740     * `err` or `result` depending on the state of `result_ok`.
16741     */
16742    union LDKCResult_ChannelPublicKeysDecodeErrorZPtr contents;
16743    /**
16744     * Whether this CResult_ChannelPublicKeysDecodeErrorZ represents a success state.
16745     */
16746    bool result_ok;
16747 } LDKCResult_ChannelPublicKeysDecodeErrorZ;
16748
16749 /**
16750  * The contents of CResult_HTLCOutputInCommitmentDecodeErrorZ
16751  */
16752 typedef union LDKCResult_HTLCOutputInCommitmentDecodeErrorZPtr {
16753    /**
16754     * A pointer to the contents in the success state.
16755     * Reading from this pointer when `result_ok` is not set is undefined.
16756     */
16757    struct LDKHTLCOutputInCommitment *result;
16758    /**
16759     * A pointer to the contents in the error state.
16760     * Reading from this pointer when `result_ok` is set is undefined.
16761     */
16762    struct LDKDecodeError *err;
16763 } LDKCResult_HTLCOutputInCommitmentDecodeErrorZPtr;
16764
16765 /**
16766  * A CResult_HTLCOutputInCommitmentDecodeErrorZ represents the result of a fallible operation,
16767  * containing a crate::lightning::ln::chan_utils::HTLCOutputInCommitment on success and a crate::lightning::ln::msgs::DecodeError on failure.
16768  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
16769  */
16770 typedef struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ {
16771    /**
16772     * The contents of this CResult_HTLCOutputInCommitmentDecodeErrorZ, accessible via either
16773     * `err` or `result` depending on the state of `result_ok`.
16774     */
16775    union LDKCResult_HTLCOutputInCommitmentDecodeErrorZPtr contents;
16776    /**
16777     * Whether this CResult_HTLCOutputInCommitmentDecodeErrorZ represents a success state.
16778     */
16779    bool result_ok;
16780 } LDKCResult_HTLCOutputInCommitmentDecodeErrorZ;
16781
16782
16783
16784 /**
16785  * Late-bound per-channel counterparty data used to build transactions.
16786  */
16787 typedef struct MUST_USE_STRUCT LDKCounterpartyChannelTransactionParameters {
16788    /**
16789     * A pointer to the opaque Rust object.
16790     * Nearly everywhere, inner must be non-null, however in places where
16791     * the Rust equivalent takes an Option, it may be set to null to indicate None.
16792     */
16793    LDKnativeCounterpartyChannelTransactionParameters *inner;
16794    /**
16795     * Indicates that this is the only struct which contains the same pointer.
16796     * Rust functions which take ownership of an object provided via an argument require
16797     * this to be true and invalidate the object pointed to by inner.
16798     */
16799    bool is_owned;
16800 } LDKCounterpartyChannelTransactionParameters;
16801
16802 /**
16803  * The contents of CResult_CounterpartyChannelTransactionParametersDecodeErrorZ
16804  */
16805 typedef union LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
16806    /**
16807     * A pointer to the contents in the success state.
16808     * Reading from this pointer when `result_ok` is not set is undefined.
16809     */
16810    struct LDKCounterpartyChannelTransactionParameters *result;
16811    /**
16812     * A pointer to the contents in the error state.
16813     * Reading from this pointer when `result_ok` is set is undefined.
16814     */
16815    struct LDKDecodeError *err;
16816 } LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr;
16817
16818 /**
16819  * A CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
16820  * containing a crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
16821  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
16822  */
16823 typedef struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
16824    /**
16825     * The contents of this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ, accessible via either
16826     * `err` or `result` depending on the state of `result_ok`.
16827     */
16828    union LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr contents;
16829    /**
16830     * Whether this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents a success state.
16831     */
16832    bool result_ok;
16833 } LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ;
16834
16835 /**
16836  * The contents of CResult_ChannelTransactionParametersDecodeErrorZ
16837  */
16838 typedef union LDKCResult_ChannelTransactionParametersDecodeErrorZPtr {
16839    /**
16840     * A pointer to the contents in the success state.
16841     * Reading from this pointer when `result_ok` is not set is undefined.
16842     */
16843    struct LDKChannelTransactionParameters *result;
16844    /**
16845     * A pointer to the contents in the error state.
16846     * Reading from this pointer when `result_ok` is set is undefined.
16847     */
16848    struct LDKDecodeError *err;
16849 } LDKCResult_ChannelTransactionParametersDecodeErrorZPtr;
16850
16851 /**
16852  * A CResult_ChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
16853  * containing a crate::lightning::ln::chan_utils::ChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
16854  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
16855  */
16856 typedef struct LDKCResult_ChannelTransactionParametersDecodeErrorZ {
16857    /**
16858     * The contents of this CResult_ChannelTransactionParametersDecodeErrorZ, accessible via either
16859     * `err` or `result` depending on the state of `result_ok`.
16860     */
16861    union LDKCResult_ChannelTransactionParametersDecodeErrorZPtr contents;
16862    /**
16863     * Whether this CResult_ChannelTransactionParametersDecodeErrorZ represents a success state.
16864     */
16865    bool result_ok;
16866 } LDKCResult_ChannelTransactionParametersDecodeErrorZ;
16867
16868 /**
16869  * The contents of CResult_HolderCommitmentTransactionDecodeErrorZ
16870  */
16871 typedef union LDKCResult_HolderCommitmentTransactionDecodeErrorZPtr {
16872    /**
16873     * A pointer to the contents in the success state.
16874     * Reading from this pointer when `result_ok` is not set is undefined.
16875     */
16876    struct LDKHolderCommitmentTransaction *result;
16877    /**
16878     * A pointer to the contents in the error state.
16879     * Reading from this pointer when `result_ok` is set is undefined.
16880     */
16881    struct LDKDecodeError *err;
16882 } LDKCResult_HolderCommitmentTransactionDecodeErrorZPtr;
16883
16884 /**
16885  * A CResult_HolderCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
16886  * containing a crate::lightning::ln::chan_utils::HolderCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
16887  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
16888  */
16889 typedef struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ {
16890    /**
16891     * The contents of this CResult_HolderCommitmentTransactionDecodeErrorZ, accessible via either
16892     * `err` or `result` depending on the state of `result_ok`.
16893     */
16894    union LDKCResult_HolderCommitmentTransactionDecodeErrorZPtr contents;
16895    /**
16896     * Whether this CResult_HolderCommitmentTransactionDecodeErrorZ represents a success state.
16897     */
16898    bool result_ok;
16899 } LDKCResult_HolderCommitmentTransactionDecodeErrorZ;
16900
16901
16902
16903 /**
16904  * A pre-built Bitcoin commitment transaction and its txid.
16905  */
16906 typedef struct MUST_USE_STRUCT LDKBuiltCommitmentTransaction {
16907    /**
16908     * A pointer to the opaque Rust object.
16909     * Nearly everywhere, inner must be non-null, however in places where
16910     * the Rust equivalent takes an Option, it may be set to null to indicate None.
16911     */
16912    LDKnativeBuiltCommitmentTransaction *inner;
16913    /**
16914     * Indicates that this is the only struct which contains the same pointer.
16915     * Rust functions which take ownership of an object provided via an argument require
16916     * this to be true and invalidate the object pointed to by inner.
16917     */
16918    bool is_owned;
16919 } LDKBuiltCommitmentTransaction;
16920
16921 /**
16922  * The contents of CResult_BuiltCommitmentTransactionDecodeErrorZ
16923  */
16924 typedef union LDKCResult_BuiltCommitmentTransactionDecodeErrorZPtr {
16925    /**
16926     * A pointer to the contents in the success state.
16927     * Reading from this pointer when `result_ok` is not set is undefined.
16928     */
16929    struct LDKBuiltCommitmentTransaction *result;
16930    /**
16931     * A pointer to the contents in the error state.
16932     * Reading from this pointer when `result_ok` is set is undefined.
16933     */
16934    struct LDKDecodeError *err;
16935 } LDKCResult_BuiltCommitmentTransactionDecodeErrorZPtr;
16936
16937 /**
16938  * A CResult_BuiltCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
16939  * containing a crate::lightning::ln::chan_utils::BuiltCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
16940  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
16941  */
16942 typedef struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ {
16943    /**
16944     * The contents of this CResult_BuiltCommitmentTransactionDecodeErrorZ, accessible via either
16945     * `err` or `result` depending on the state of `result_ok`.
16946     */
16947    union LDKCResult_BuiltCommitmentTransactionDecodeErrorZPtr contents;
16948    /**
16949     * Whether this CResult_BuiltCommitmentTransactionDecodeErrorZ represents a success state.
16950     */
16951    bool result_ok;
16952 } LDKCResult_BuiltCommitmentTransactionDecodeErrorZ;
16953
16954
16955
16956 /**
16957  * A wrapper on ClosingTransaction indicating that the built bitcoin
16958  * transaction is trusted.
16959  *
16960  * See trust() and verify() functions on CommitmentTransaction.
16961  *
16962  * This structure implements Deref.
16963  */
16964 typedef struct MUST_USE_STRUCT LDKTrustedClosingTransaction {
16965    /**
16966     * A pointer to the opaque Rust object.
16967     * Nearly everywhere, inner must be non-null, however in places where
16968     * the Rust equivalent takes an Option, it may be set to null to indicate None.
16969     */
16970    LDKnativeTrustedClosingTransaction *inner;
16971    /**
16972     * Indicates that this is the only struct which contains the same pointer.
16973     * Rust functions which take ownership of an object provided via an argument require
16974     * this to be true and invalidate the object pointed to by inner.
16975     */
16976    bool is_owned;
16977 } LDKTrustedClosingTransaction;
16978
16979 /**
16980  * The contents of CResult_TrustedClosingTransactionNoneZ
16981  */
16982 typedef union LDKCResult_TrustedClosingTransactionNoneZPtr {
16983    /**
16984     * A pointer to the contents in the success state.
16985     * Reading from this pointer when `result_ok` is not set is undefined.
16986     */
16987    struct LDKTrustedClosingTransaction *result;
16988    /**
16989     * Note that this value is always NULL, as there are no contents in the Err variant
16990     */
16991    void *err;
16992 } LDKCResult_TrustedClosingTransactionNoneZPtr;
16993
16994 /**
16995  * A CResult_TrustedClosingTransactionNoneZ represents the result of a fallible operation,
16996  * containing a crate::lightning::ln::chan_utils::TrustedClosingTransaction on success and a () on failure.
16997  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
16998  */
16999 typedef struct LDKCResult_TrustedClosingTransactionNoneZ {
17000    /**
17001     * The contents of this CResult_TrustedClosingTransactionNoneZ, accessible via either
17002     * `err` or `result` depending on the state of `result_ok`.
17003     */
17004    union LDKCResult_TrustedClosingTransactionNoneZPtr contents;
17005    /**
17006     * Whether this CResult_TrustedClosingTransactionNoneZ represents a success state.
17007     */
17008    bool result_ok;
17009 } LDKCResult_TrustedClosingTransactionNoneZ;
17010
17011 /**
17012  * The contents of CResult_CommitmentTransactionDecodeErrorZ
17013  */
17014 typedef union LDKCResult_CommitmentTransactionDecodeErrorZPtr {
17015    /**
17016     * A pointer to the contents in the success state.
17017     * Reading from this pointer when `result_ok` is not set is undefined.
17018     */
17019    struct LDKCommitmentTransaction *result;
17020    /**
17021     * A pointer to the contents in the error state.
17022     * Reading from this pointer when `result_ok` is set is undefined.
17023     */
17024    struct LDKDecodeError *err;
17025 } LDKCResult_CommitmentTransactionDecodeErrorZPtr;
17026
17027 /**
17028  * A CResult_CommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
17029  * containing a crate::lightning::ln::chan_utils::CommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
17030  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
17031  */
17032 typedef struct LDKCResult_CommitmentTransactionDecodeErrorZ {
17033    /**
17034     * The contents of this CResult_CommitmentTransactionDecodeErrorZ, accessible via either
17035     * `err` or `result` depending on the state of `result_ok`.
17036     */
17037    union LDKCResult_CommitmentTransactionDecodeErrorZPtr contents;
17038    /**
17039     * Whether this CResult_CommitmentTransactionDecodeErrorZ represents a success state.
17040     */
17041    bool result_ok;
17042 } LDKCResult_CommitmentTransactionDecodeErrorZ;
17043
17044
17045
17046 /**
17047  * A wrapper on CommitmentTransaction indicating that the derived fields (the built bitcoin
17048  * transaction and the transaction creation keys) are trusted.
17049  *
17050  * See trust() and verify() functions on CommitmentTransaction.
17051  *
17052  * This structure implements Deref.
17053  */
17054 typedef struct MUST_USE_STRUCT LDKTrustedCommitmentTransaction {
17055    /**
17056     * A pointer to the opaque Rust object.
17057     * Nearly everywhere, inner must be non-null, however in places where
17058     * the Rust equivalent takes an Option, it may be set to null to indicate None.
17059     */
17060    LDKnativeTrustedCommitmentTransaction *inner;
17061    /**
17062     * Indicates that this is the only struct which contains the same pointer.
17063     * Rust functions which take ownership of an object provided via an argument require
17064     * this to be true and invalidate the object pointed to by inner.
17065     */
17066    bool is_owned;
17067 } LDKTrustedCommitmentTransaction;
17068
17069 /**
17070  * The contents of CResult_TrustedCommitmentTransactionNoneZ
17071  */
17072 typedef union LDKCResult_TrustedCommitmentTransactionNoneZPtr {
17073    /**
17074     * A pointer to the contents in the success state.
17075     * Reading from this pointer when `result_ok` is not set is undefined.
17076     */
17077    struct LDKTrustedCommitmentTransaction *result;
17078    /**
17079     * Note that this value is always NULL, as there are no contents in the Err variant
17080     */
17081    void *err;
17082 } LDKCResult_TrustedCommitmentTransactionNoneZPtr;
17083
17084 /**
17085  * A CResult_TrustedCommitmentTransactionNoneZ represents the result of a fallible operation,
17086  * containing a crate::lightning::ln::chan_utils::TrustedCommitmentTransaction on success and a () on failure.
17087  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
17088  */
17089 typedef struct LDKCResult_TrustedCommitmentTransactionNoneZ {
17090    /**
17091     * The contents of this CResult_TrustedCommitmentTransactionNoneZ, accessible via either
17092     * `err` or `result` depending on the state of `result_ok`.
17093     */
17094    union LDKCResult_TrustedCommitmentTransactionNoneZPtr contents;
17095    /**
17096     * Whether this CResult_TrustedCommitmentTransactionNoneZ represents a success state.
17097     */
17098    bool result_ok;
17099 } LDKCResult_TrustedCommitmentTransactionNoneZ;
17100
17101 /**
17102  * The contents of CResult_CVec_ECDSASignatureZNoneZ
17103  */
17104 typedef union LDKCResult_CVec_ECDSASignatureZNoneZPtr {
17105    /**
17106     * A pointer to the contents in the success state.
17107     * Reading from this pointer when `result_ok` is not set is undefined.
17108     */
17109    struct LDKCVec_ECDSASignatureZ *result;
17110    /**
17111     * Note that this value is always NULL, as there are no contents in the Err variant
17112     */
17113    void *err;
17114 } LDKCResult_CVec_ECDSASignatureZNoneZPtr;
17115
17116 /**
17117  * A CResult_CVec_ECDSASignatureZNoneZ represents the result of a fallible operation,
17118  * containing a crate::c_types::derived::CVec_ECDSASignatureZ on success and a () on failure.
17119  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
17120  */
17121 typedef struct LDKCResult_CVec_ECDSASignatureZNoneZ {
17122    /**
17123     * The contents of this CResult_CVec_ECDSASignatureZNoneZ, accessible via either
17124     * `err` or `result` depending on the state of `result_ok`.
17125     */
17126    union LDKCResult_CVec_ECDSASignatureZNoneZPtr contents;
17127    /**
17128     * Whether this CResult_CVec_ECDSASignatureZNoneZ represents a success state.
17129     */
17130    bool result_ok;
17131 } LDKCResult_CVec_ECDSASignatureZNoneZ;
17132
17133 /**
17134  * An enum which can either contain a usize or not
17135  */
17136 typedef enum LDKCOption_usizeZ_Tag {
17137    /**
17138     * When we're in this state, this COption_usizeZ contains a usize
17139     */
17140    LDKCOption_usizeZ_Some,
17141    /**
17142     * When we're in this state, this COption_usizeZ contains nothing
17143     */
17144    LDKCOption_usizeZ_None,
17145    /**
17146     * Must be last for serialization purposes
17147     */
17148    LDKCOption_usizeZ_Sentinel,
17149 } LDKCOption_usizeZ_Tag;
17150
17151 typedef struct LDKCOption_usizeZ {
17152    LDKCOption_usizeZ_Tag tag;
17153    union {
17154       struct {
17155          uintptr_t some;
17156       };
17157    };
17158 } LDKCOption_usizeZ;
17159
17160 /**
17161  * The contents of CResult_ShutdownScriptDecodeErrorZ
17162  */
17163 typedef union LDKCResult_ShutdownScriptDecodeErrorZPtr {
17164    /**
17165     * A pointer to the contents in the success state.
17166     * Reading from this pointer when `result_ok` is not set is undefined.
17167     */
17168    struct LDKShutdownScript *result;
17169    /**
17170     * A pointer to the contents in the error state.
17171     * Reading from this pointer when `result_ok` is set is undefined.
17172     */
17173    struct LDKDecodeError *err;
17174 } LDKCResult_ShutdownScriptDecodeErrorZPtr;
17175
17176 /**
17177  * A CResult_ShutdownScriptDecodeErrorZ represents the result of a fallible operation,
17178  * containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::msgs::DecodeError on failure.
17179  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
17180  */
17181 typedef struct LDKCResult_ShutdownScriptDecodeErrorZ {
17182    /**
17183     * The contents of this CResult_ShutdownScriptDecodeErrorZ, accessible via either
17184     * `err` or `result` depending on the state of `result_ok`.
17185     */
17186    union LDKCResult_ShutdownScriptDecodeErrorZPtr contents;
17187    /**
17188     * Whether this CResult_ShutdownScriptDecodeErrorZ represents a success state.
17189     */
17190    bool result_ok;
17191 } LDKCResult_ShutdownScriptDecodeErrorZ;
17192
17193
17194
17195 /**
17196  * An error occurring when converting from [`ScriptBuf`] to [`ShutdownScript`].
17197  */
17198 typedef struct MUST_USE_STRUCT LDKInvalidShutdownScript {
17199    /**
17200     * A pointer to the opaque Rust object.
17201     * Nearly everywhere, inner must be non-null, however in places where
17202     * the Rust equivalent takes an Option, it may be set to null to indicate None.
17203     */
17204    LDKnativeInvalidShutdownScript *inner;
17205    /**
17206     * Indicates that this is the only struct which contains the same pointer.
17207     * Rust functions which take ownership of an object provided via an argument require
17208     * this to be true and invalidate the object pointed to by inner.
17209     */
17210    bool is_owned;
17211 } LDKInvalidShutdownScript;
17212
17213 /**
17214  * The contents of CResult_ShutdownScriptInvalidShutdownScriptZ
17215  */
17216 typedef union LDKCResult_ShutdownScriptInvalidShutdownScriptZPtr {
17217    /**
17218     * A pointer to the contents in the success state.
17219     * Reading from this pointer when `result_ok` is not set is undefined.
17220     */
17221    struct LDKShutdownScript *result;
17222    /**
17223     * A pointer to the contents in the error state.
17224     * Reading from this pointer when `result_ok` is set is undefined.
17225     */
17226    struct LDKInvalidShutdownScript *err;
17227 } LDKCResult_ShutdownScriptInvalidShutdownScriptZPtr;
17228
17229 /**
17230  * A CResult_ShutdownScriptInvalidShutdownScriptZ represents the result of a fallible operation,
17231  * containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::script::InvalidShutdownScript on failure.
17232  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
17233  */
17234 typedef struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ {
17235    /**
17236     * The contents of this CResult_ShutdownScriptInvalidShutdownScriptZ, accessible via either
17237     * `err` or `result` depending on the state of `result_ok`.
17238     */
17239    union LDKCResult_ShutdownScriptInvalidShutdownScriptZPtr contents;
17240    /**
17241     * Whether this CResult_ShutdownScriptInvalidShutdownScriptZ represents a success state.
17242     */
17243    bool result_ok;
17244 } LDKCResult_ShutdownScriptInvalidShutdownScriptZ;
17245
17246 /**
17247  * Some information provided on receipt of payment depends on whether the payment received is a
17248  * spontaneous payment or a \"conventional\" lightning payment that's paying an invoice.
17249  */
17250 typedef enum LDKPaymentPurpose_Tag {
17251    /**
17252     * A payment for a BOLT 11 invoice.
17253     */
17254    LDKPaymentPurpose_Bolt11InvoicePayment,
17255    /**
17256     * A payment for a BOLT 12 [`Offer`].
17257     *
17258     * [`Offer`]: crate::offers::offer::Offer
17259     */
17260    LDKPaymentPurpose_Bolt12OfferPayment,
17261    /**
17262     * A payment for a BOLT 12 [`Refund`].
17263     *
17264     * [`Refund`]: crate::offers::refund::Refund
17265     */
17266    LDKPaymentPurpose_Bolt12RefundPayment,
17267    /**
17268     * Because this is a spontaneous payment, the payer generated their own preimage rather than us
17269     * (the payee) providing a preimage.
17270     */
17271    LDKPaymentPurpose_SpontaneousPayment,
17272    /**
17273     * Must be last for serialization purposes
17274     */
17275    LDKPaymentPurpose_Sentinel,
17276 } LDKPaymentPurpose_Tag;
17277
17278 typedef struct LDKPaymentPurpose_LDKBolt11InvoicePayment_Body {
17279    /**
17280     * The preimage to the payment_hash, if the payment hash (and secret) were fetched via
17281     * [`ChannelManager::create_inbound_payment`]. When handling [`Event::PaymentClaimable`],
17282     * this can be passed directly to [`ChannelManager::claim_funds`] to claim the payment. No
17283     * action is needed when seen in [`Event::PaymentClaimed`].
17284     *
17285     * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
17286     * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
17287     */
17288    struct LDKCOption_ThirtyTwoBytesZ payment_preimage;
17289    /**
17290     * The \"payment secret\". This authenticates the sender to the recipient, preventing a
17291     * number of deanonymization attacks during the routing process.
17292     * It is provided here for your reference, however its accuracy is enforced directly by
17293     * [`ChannelManager`] using the values you previously provided to
17294     * [`ChannelManager::create_inbound_payment`] or
17295     * [`ChannelManager::create_inbound_payment_for_hash`].
17296     *
17297     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
17298     * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
17299     * [`ChannelManager::create_inbound_payment_for_hash`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
17300     */
17301    struct LDKThirtyTwoBytes payment_secret;
17302 } LDKPaymentPurpose_LDKBolt11InvoicePayment_Body;
17303
17304 typedef struct LDKPaymentPurpose_LDKBolt12OfferPayment_Body {
17305    /**
17306     * The preimage to the payment hash. When handling [`Event::PaymentClaimable`], this can be
17307     * passed directly to [`ChannelManager::claim_funds`], if provided. No action is needed
17308     * when seen in [`Event::PaymentClaimed`].
17309     *
17310     * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
17311     */
17312    struct LDKCOption_ThirtyTwoBytesZ payment_preimage;
17313    /**
17314     * The secret used to authenticate the sender to the recipient, preventing a number of
17315     * de-anonymization attacks while routing a payment.
17316     *
17317     * See [`PaymentPurpose::Bolt11InvoicePayment::payment_secret`] for further details.
17318     */
17319    struct LDKThirtyTwoBytes payment_secret;
17320    /**
17321     * The context of the payment such as information about the corresponding [`Offer`] and
17322     * [`InvoiceRequest`].
17323     *
17324     * [`Offer`]: crate::offers::offer::Offer
17325     * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
17326     */
17327    struct LDKBolt12OfferContext payment_context;
17328 } LDKPaymentPurpose_LDKBolt12OfferPayment_Body;
17329
17330 typedef struct LDKPaymentPurpose_LDKBolt12RefundPayment_Body {
17331    /**
17332     * The preimage to the payment hash. When handling [`Event::PaymentClaimable`], this can be
17333     * passed directly to [`ChannelManager::claim_funds`], if provided. No action is needed
17334     * when seen in [`Event::PaymentClaimed`].
17335     *
17336     * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
17337     */
17338    struct LDKCOption_ThirtyTwoBytesZ payment_preimage;
17339    /**
17340     * The secret used to authenticate the sender to the recipient, preventing a number of
17341     * de-anonymization attacks while routing a payment.
17342     *
17343     * See [`PaymentPurpose::Bolt11InvoicePayment::payment_secret`] for further details.
17344     */
17345    struct LDKThirtyTwoBytes payment_secret;
17346    /**
17347     * The context of the payment such as information about the corresponding [`Refund`].
17348     *
17349     * [`Refund`]: crate::offers::refund::Refund
17350     */
17351    struct LDKBolt12RefundContext payment_context;
17352 } LDKPaymentPurpose_LDKBolt12RefundPayment_Body;
17353
17354 typedef struct MUST_USE_STRUCT LDKPaymentPurpose {
17355    LDKPaymentPurpose_Tag tag;
17356    union {
17357       LDKPaymentPurpose_LDKBolt11InvoicePayment_Body bolt11_invoice_payment;
17358       LDKPaymentPurpose_LDKBolt12OfferPayment_Body bolt12_offer_payment;
17359       LDKPaymentPurpose_LDKBolt12RefundPayment_Body bolt12_refund_payment;
17360       struct {
17361          struct LDKThirtyTwoBytes spontaneous_payment;
17362       };
17363    };
17364 } LDKPaymentPurpose;
17365
17366 /**
17367  * The contents of CResult_PaymentPurposeDecodeErrorZ
17368  */
17369 typedef union LDKCResult_PaymentPurposeDecodeErrorZPtr {
17370    /**
17371     * A pointer to the contents in the success state.
17372     * Reading from this pointer when `result_ok` is not set is undefined.
17373     */
17374    struct LDKPaymentPurpose *result;
17375    /**
17376     * A pointer to the contents in the error state.
17377     * Reading from this pointer when `result_ok` is set is undefined.
17378     */
17379    struct LDKDecodeError *err;
17380 } LDKCResult_PaymentPurposeDecodeErrorZPtr;
17381
17382 /**
17383  * A CResult_PaymentPurposeDecodeErrorZ represents the result of a fallible operation,
17384  * containing a crate::lightning::events::PaymentPurpose on success and a crate::lightning::ln::msgs::DecodeError on failure.
17385  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
17386  */
17387 typedef struct LDKCResult_PaymentPurposeDecodeErrorZ {
17388    /**
17389     * The contents of this CResult_PaymentPurposeDecodeErrorZ, accessible via either
17390     * `err` or `result` depending on the state of `result_ok`.
17391     */
17392    union LDKCResult_PaymentPurposeDecodeErrorZPtr contents;
17393    /**
17394     * Whether this CResult_PaymentPurposeDecodeErrorZ represents a success state.
17395     */
17396    bool result_ok;
17397 } LDKCResult_PaymentPurposeDecodeErrorZ;
17398
17399
17400
17401 /**
17402  * Information about an HTLC that is part of a payment that can be claimed.
17403  */
17404 typedef struct MUST_USE_STRUCT LDKClaimedHTLC {
17405    /**
17406     * A pointer to the opaque Rust object.
17407     * Nearly everywhere, inner must be non-null, however in places where
17408     * the Rust equivalent takes an Option, it may be set to null to indicate None.
17409     */
17410    LDKnativeClaimedHTLC *inner;
17411    /**
17412     * Indicates that this is the only struct which contains the same pointer.
17413     * Rust functions which take ownership of an object provided via an argument require
17414     * this to be true and invalidate the object pointed to by inner.
17415     */
17416    bool is_owned;
17417 } LDKClaimedHTLC;
17418
17419 /**
17420  * The contents of CResult_ClaimedHTLCDecodeErrorZ
17421  */
17422 typedef union LDKCResult_ClaimedHTLCDecodeErrorZPtr {
17423    /**
17424     * A pointer to the contents in the success state.
17425     * Reading from this pointer when `result_ok` is not set is undefined.
17426     */
17427    struct LDKClaimedHTLC *result;
17428    /**
17429     * A pointer to the contents in the error state.
17430     * Reading from this pointer when `result_ok` is set is undefined.
17431     */
17432    struct LDKDecodeError *err;
17433 } LDKCResult_ClaimedHTLCDecodeErrorZPtr;
17434
17435 /**
17436  * A CResult_ClaimedHTLCDecodeErrorZ represents the result of a fallible operation,
17437  * containing a crate::lightning::events::ClaimedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
17438  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
17439  */
17440 typedef struct LDKCResult_ClaimedHTLCDecodeErrorZ {
17441    /**
17442     * The contents of this CResult_ClaimedHTLCDecodeErrorZ, accessible via either
17443     * `err` or `result` depending on the state of `result_ok`.
17444     */
17445    union LDKCResult_ClaimedHTLCDecodeErrorZPtr contents;
17446    /**
17447     * Whether this CResult_ClaimedHTLCDecodeErrorZ represents a success state.
17448     */
17449    bool result_ok;
17450 } LDKCResult_ClaimedHTLCDecodeErrorZ;
17451
17452 /**
17453  * When the payment path failure took place and extra details about it. [`PathFailure::OnPath`] may
17454  * contain a [`NetworkUpdate`] that needs to be applied to the [`NetworkGraph`].
17455  *
17456  * [`NetworkUpdate`]: crate::routing::gossip::NetworkUpdate
17457  * [`NetworkGraph`]: crate::routing::gossip::NetworkGraph
17458  */
17459 typedef enum LDKPathFailure_Tag {
17460    /**
17461     * We failed to initially send the payment and no HTLC was committed to. Contains the relevant
17462     * error.
17463     */
17464    LDKPathFailure_InitialSend,
17465    /**
17466     * A hop on the path failed to forward our payment.
17467     */
17468    LDKPathFailure_OnPath,
17469    /**
17470     * Must be last for serialization purposes
17471     */
17472    LDKPathFailure_Sentinel,
17473 } LDKPathFailure_Tag;
17474
17475 typedef struct LDKPathFailure_LDKInitialSend_Body {
17476    /**
17477     * The error surfaced from initial send.
17478     */
17479    struct LDKAPIError err;
17480 } LDKPathFailure_LDKInitialSend_Body;
17481
17482 typedef struct LDKPathFailure_LDKOnPath_Body {
17483    /**
17484     * If present, this [`NetworkUpdate`] should be applied to the [`NetworkGraph`] so that routing
17485     * decisions can take into account the update.
17486     *
17487     * [`NetworkUpdate`]: crate::routing::gossip::NetworkUpdate
17488     * [`NetworkGraph`]: crate::routing::gossip::NetworkGraph
17489     */
17490    struct LDKCOption_NetworkUpdateZ network_update;
17491 } LDKPathFailure_LDKOnPath_Body;
17492
17493 typedef struct MUST_USE_STRUCT LDKPathFailure {
17494    LDKPathFailure_Tag tag;
17495    union {
17496       LDKPathFailure_LDKInitialSend_Body initial_send;
17497       LDKPathFailure_LDKOnPath_Body on_path;
17498    };
17499 } LDKPathFailure;
17500
17501 /**
17502  * An enum which can either contain a crate::lightning::events::PathFailure or not
17503  */
17504 typedef enum LDKCOption_PathFailureZ_Tag {
17505    /**
17506     * When we're in this state, this COption_PathFailureZ contains a crate::lightning::events::PathFailure
17507     */
17508    LDKCOption_PathFailureZ_Some,
17509    /**
17510     * When we're in this state, this COption_PathFailureZ contains nothing
17511     */
17512    LDKCOption_PathFailureZ_None,
17513    /**
17514     * Must be last for serialization purposes
17515     */
17516    LDKCOption_PathFailureZ_Sentinel,
17517 } LDKCOption_PathFailureZ_Tag;
17518
17519 typedef struct LDKCOption_PathFailureZ {
17520    LDKCOption_PathFailureZ_Tag tag;
17521    union {
17522       struct {
17523          struct LDKPathFailure some;
17524       };
17525    };
17526 } LDKCOption_PathFailureZ;
17527
17528 /**
17529  * The contents of CResult_COption_PathFailureZDecodeErrorZ
17530  */
17531 typedef union LDKCResult_COption_PathFailureZDecodeErrorZPtr {
17532    /**
17533     * A pointer to the contents in the success state.
17534     * Reading from this pointer when `result_ok` is not set is undefined.
17535     */
17536    struct LDKCOption_PathFailureZ *result;
17537    /**
17538     * A pointer to the contents in the error state.
17539     * Reading from this pointer when `result_ok` is set is undefined.
17540     */
17541    struct LDKDecodeError *err;
17542 } LDKCResult_COption_PathFailureZDecodeErrorZPtr;
17543
17544 /**
17545  * A CResult_COption_PathFailureZDecodeErrorZ represents the result of a fallible operation,
17546  * containing a crate::c_types::derived::COption_PathFailureZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
17547  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
17548  */
17549 typedef struct LDKCResult_COption_PathFailureZDecodeErrorZ {
17550    /**
17551     * The contents of this CResult_COption_PathFailureZDecodeErrorZ, accessible via either
17552     * `err` or `result` depending on the state of `result_ok`.
17553     */
17554    union LDKCResult_COption_PathFailureZDecodeErrorZPtr contents;
17555    /**
17556     * Whether this CResult_COption_PathFailureZDecodeErrorZ represents a success state.
17557     */
17558    bool result_ok;
17559 } LDKCResult_COption_PathFailureZDecodeErrorZ;
17560
17561 /**
17562  * An enum which can either contain a crate::lightning::events::ClosureReason or not
17563  */
17564 typedef enum LDKCOption_ClosureReasonZ_Tag {
17565    /**
17566     * When we're in this state, this COption_ClosureReasonZ contains a crate::lightning::events::ClosureReason
17567     */
17568    LDKCOption_ClosureReasonZ_Some,
17569    /**
17570     * When we're in this state, this COption_ClosureReasonZ contains nothing
17571     */
17572    LDKCOption_ClosureReasonZ_None,
17573    /**
17574     * Must be last for serialization purposes
17575     */
17576    LDKCOption_ClosureReasonZ_Sentinel,
17577 } LDKCOption_ClosureReasonZ_Tag;
17578
17579 typedef struct LDKCOption_ClosureReasonZ {
17580    LDKCOption_ClosureReasonZ_Tag tag;
17581    union {
17582       struct {
17583          struct LDKClosureReason some;
17584       };
17585    };
17586 } LDKCOption_ClosureReasonZ;
17587
17588 /**
17589  * The contents of CResult_COption_ClosureReasonZDecodeErrorZ
17590  */
17591 typedef union LDKCResult_COption_ClosureReasonZDecodeErrorZPtr {
17592    /**
17593     * A pointer to the contents in the success state.
17594     * Reading from this pointer when `result_ok` is not set is undefined.
17595     */
17596    struct LDKCOption_ClosureReasonZ *result;
17597    /**
17598     * A pointer to the contents in the error state.
17599     * Reading from this pointer when `result_ok` is set is undefined.
17600     */
17601    struct LDKDecodeError *err;
17602 } LDKCResult_COption_ClosureReasonZDecodeErrorZPtr;
17603
17604 /**
17605  * A CResult_COption_ClosureReasonZDecodeErrorZ represents the result of a fallible operation,
17606  * containing a crate::c_types::derived::COption_ClosureReasonZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
17607  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
17608  */
17609 typedef struct LDKCResult_COption_ClosureReasonZDecodeErrorZ {
17610    /**
17611     * The contents of this CResult_COption_ClosureReasonZDecodeErrorZ, accessible via either
17612     * `err` or `result` depending on the state of `result_ok`.
17613     */
17614    union LDKCResult_COption_ClosureReasonZDecodeErrorZPtr contents;
17615    /**
17616     * Whether this CResult_COption_ClosureReasonZDecodeErrorZ represents a success state.
17617     */
17618    bool result_ok;
17619 } LDKCResult_COption_ClosureReasonZDecodeErrorZ;
17620
17621 /**
17622  * Intended destination of a failed HTLC as indicated in [`Event::HTLCHandlingFailed`].
17623  */
17624 typedef enum LDKHTLCDestination_Tag {
17625    /**
17626     * We tried forwarding to a channel but failed to do so. An example of such an instance is when
17627     * there is insufficient capacity in our outbound channel.
17628     */
17629    LDKHTLCDestination_NextHopChannel,
17630    /**
17631     * Scenario where we are unsure of the next node to forward the HTLC to.
17632     */
17633    LDKHTLCDestination_UnknownNextHop,
17634    /**
17635     * We couldn't forward to the outgoing scid. An example would be attempting to send a duplicate
17636     * intercept HTLC.
17637     */
17638    LDKHTLCDestination_InvalidForward,
17639    /**
17640     * We couldn't decode the incoming onion to obtain the forwarding details.
17641     */
17642    LDKHTLCDestination_InvalidOnion,
17643    /**
17644     * Failure scenario where an HTLC may have been forwarded to be intended for us,
17645     * but is invalid for some reason, so we reject it.
17646     *
17647     * Some of the reasons may include:
17648     * * HTLC Timeouts
17649     * * Excess HTLCs for a payment that we have already fully received, over-paying for the
17650     *   payment,
17651     * * The counterparty node modified the HTLC in transit,
17652     * * A probing attack where an intermediary node is trying to detect if we are the ultimate
17653     *   recipient for a payment.
17654     */
17655    LDKHTLCDestination_FailedPayment,
17656    /**
17657     * Must be last for serialization purposes
17658     */
17659    LDKHTLCDestination_Sentinel,
17660 } LDKHTLCDestination_Tag;
17661
17662 typedef struct LDKHTLCDestination_LDKNextHopChannel_Body {
17663    /**
17664     * The `node_id` of the next node. For backwards compatibility, this field is
17665     * marked as optional, versions prior to 0.0.110 may not always be able to provide
17666     * counterparty node information.
17667     *
17668     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
17669     */
17670    struct LDKPublicKey node_id;
17671    /**
17672     * The outgoing `channel_id` between us and the next node.
17673     */
17674    struct LDKChannelId channel_id;
17675 } LDKHTLCDestination_LDKNextHopChannel_Body;
17676
17677 typedef struct LDKHTLCDestination_LDKUnknownNextHop_Body {
17678    /**
17679     * Short channel id we are requesting to forward an HTLC to.
17680     */
17681    uint64_t requested_forward_scid;
17682 } LDKHTLCDestination_LDKUnknownNextHop_Body;
17683
17684 typedef struct LDKHTLCDestination_LDKInvalidForward_Body {
17685    /**
17686     * Short channel id we are requesting to forward an HTLC to.
17687     */
17688    uint64_t requested_forward_scid;
17689 } LDKHTLCDestination_LDKInvalidForward_Body;
17690
17691 typedef struct LDKHTLCDestination_LDKFailedPayment_Body {
17692    /**
17693     * The payment hash of the payment we attempted to process.
17694     */
17695    struct LDKThirtyTwoBytes payment_hash;
17696 } LDKHTLCDestination_LDKFailedPayment_Body;
17697
17698 typedef struct MUST_USE_STRUCT LDKHTLCDestination {
17699    LDKHTLCDestination_Tag tag;
17700    union {
17701       LDKHTLCDestination_LDKNextHopChannel_Body next_hop_channel;
17702       LDKHTLCDestination_LDKUnknownNextHop_Body unknown_next_hop;
17703       LDKHTLCDestination_LDKInvalidForward_Body invalid_forward;
17704       LDKHTLCDestination_LDKFailedPayment_Body failed_payment;
17705    };
17706 } LDKHTLCDestination;
17707
17708 /**
17709  * An enum which can either contain a crate::lightning::events::HTLCDestination or not
17710  */
17711 typedef enum LDKCOption_HTLCDestinationZ_Tag {
17712    /**
17713     * When we're in this state, this COption_HTLCDestinationZ contains a crate::lightning::events::HTLCDestination
17714     */
17715    LDKCOption_HTLCDestinationZ_Some,
17716    /**
17717     * When we're in this state, this COption_HTLCDestinationZ contains nothing
17718     */
17719    LDKCOption_HTLCDestinationZ_None,
17720    /**
17721     * Must be last for serialization purposes
17722     */
17723    LDKCOption_HTLCDestinationZ_Sentinel,
17724 } LDKCOption_HTLCDestinationZ_Tag;
17725
17726 typedef struct LDKCOption_HTLCDestinationZ {
17727    LDKCOption_HTLCDestinationZ_Tag tag;
17728    union {
17729       struct {
17730          struct LDKHTLCDestination some;
17731       };
17732    };
17733 } LDKCOption_HTLCDestinationZ;
17734
17735 /**
17736  * The contents of CResult_COption_HTLCDestinationZDecodeErrorZ
17737  */
17738 typedef union LDKCResult_COption_HTLCDestinationZDecodeErrorZPtr {
17739    /**
17740     * A pointer to the contents in the success state.
17741     * Reading from this pointer when `result_ok` is not set is undefined.
17742     */
17743    struct LDKCOption_HTLCDestinationZ *result;
17744    /**
17745     * A pointer to the contents in the error state.
17746     * Reading from this pointer when `result_ok` is set is undefined.
17747     */
17748    struct LDKDecodeError *err;
17749 } LDKCResult_COption_HTLCDestinationZDecodeErrorZPtr;
17750
17751 /**
17752  * A CResult_COption_HTLCDestinationZDecodeErrorZ represents the result of a fallible operation,
17753  * containing a crate::c_types::derived::COption_HTLCDestinationZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
17754  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
17755  */
17756 typedef struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ {
17757    /**
17758     * The contents of this CResult_COption_HTLCDestinationZDecodeErrorZ, accessible via either
17759     * `err` or `result` depending on the state of `result_ok`.
17760     */
17761    union LDKCResult_COption_HTLCDestinationZDecodeErrorZPtr contents;
17762    /**
17763     * Whether this CResult_COption_HTLCDestinationZDecodeErrorZ represents a success state.
17764     */
17765    bool result_ok;
17766 } LDKCResult_COption_HTLCDestinationZDecodeErrorZ;
17767
17768 /**
17769  * The contents of CResult_PaymentFailureReasonDecodeErrorZ
17770  */
17771 typedef union LDKCResult_PaymentFailureReasonDecodeErrorZPtr {
17772    /**
17773     * A pointer to the contents in the success state.
17774     * Reading from this pointer when `result_ok` is not set is undefined.
17775     */
17776    enum LDKPaymentFailureReason *result;
17777    /**
17778     * A pointer to the contents in the error state.
17779     * Reading from this pointer when `result_ok` is set is undefined.
17780     */
17781    struct LDKDecodeError *err;
17782 } LDKCResult_PaymentFailureReasonDecodeErrorZPtr;
17783
17784 /**
17785  * A CResult_PaymentFailureReasonDecodeErrorZ represents the result of a fallible operation,
17786  * containing a crate::lightning::events::PaymentFailureReason on success and a crate::lightning::ln::msgs::DecodeError on failure.
17787  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
17788  */
17789 typedef struct LDKCResult_PaymentFailureReasonDecodeErrorZ {
17790    /**
17791     * The contents of this CResult_PaymentFailureReasonDecodeErrorZ, accessible via either
17792     * `err` or `result` depending on the state of `result_ok`.
17793     */
17794    union LDKCResult_PaymentFailureReasonDecodeErrorZPtr contents;
17795    /**
17796     * Whether this CResult_PaymentFailureReasonDecodeErrorZ represents a success state.
17797     */
17798    bool result_ok;
17799 } LDKCResult_PaymentFailureReasonDecodeErrorZ;
17800
17801 /**
17802  * An enum which can either contain a crate::c_types::U128 or not
17803  */
17804 typedef enum LDKCOption_U128Z_Tag {
17805    /**
17806     * When we're in this state, this COption_U128Z contains a crate::c_types::U128
17807     */
17808    LDKCOption_U128Z_Some,
17809    /**
17810     * When we're in this state, this COption_U128Z contains nothing
17811     */
17812    LDKCOption_U128Z_None,
17813    /**
17814     * Must be last for serialization purposes
17815     */
17816    LDKCOption_U128Z_Sentinel,
17817 } LDKCOption_U128Z_Tag;
17818
17819 typedef struct LDKCOption_U128Z {
17820    LDKCOption_U128Z_Tag tag;
17821    union {
17822       struct {
17823          struct LDKU128 some;
17824       };
17825    };
17826 } LDKCOption_U128Z;
17827
17828 /**
17829  * A dynamically-allocated array of crate::lightning::events::ClaimedHTLCs of arbitrary size.
17830  * This corresponds to std::vector in C++
17831  */
17832 typedef struct LDKCVec_ClaimedHTLCZ {
17833    /**
17834     * The elements in the array.
17835     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
17836     */
17837    struct LDKClaimedHTLC *data;
17838    /**
17839     * The number of elements pointed to by `data`.
17840     */
17841    uintptr_t datalen;
17842 } LDKCVec_ClaimedHTLCZ;
17843
17844 /**
17845  * An enum which can either contain a crate::lightning::events::PaymentFailureReason or not
17846  */
17847 typedef enum LDKCOption_PaymentFailureReasonZ_Tag {
17848    /**
17849     * When we're in this state, this COption_PaymentFailureReasonZ contains a crate::lightning::events::PaymentFailureReason
17850     */
17851    LDKCOption_PaymentFailureReasonZ_Some,
17852    /**
17853     * When we're in this state, this COption_PaymentFailureReasonZ contains nothing
17854     */
17855    LDKCOption_PaymentFailureReasonZ_None,
17856    /**
17857     * Must be last for serialization purposes
17858     */
17859    LDKCOption_PaymentFailureReasonZ_Sentinel,
17860 } LDKCOption_PaymentFailureReasonZ_Tag;
17861
17862 typedef struct LDKCOption_PaymentFailureReasonZ {
17863    LDKCOption_PaymentFailureReasonZ_Tag tag;
17864    union {
17865       struct {
17866          enum LDKPaymentFailureReason some;
17867       };
17868    };
17869 } LDKCOption_PaymentFailureReasonZ;
17870
17871
17872
17873 /**
17874  * A descriptor used to sign for a commitment transaction's anchor output.
17875  */
17876 typedef struct MUST_USE_STRUCT LDKAnchorDescriptor {
17877    /**
17878     * A pointer to the opaque Rust object.
17879     * Nearly everywhere, inner must be non-null, however in places where
17880     * the Rust equivalent takes an Option, it may be set to null to indicate None.
17881     */
17882    LDKnativeAnchorDescriptor *inner;
17883    /**
17884     * Indicates that this is the only struct which contains the same pointer.
17885     * Rust functions which take ownership of an object provided via an argument require
17886     * this to be true and invalidate the object pointed to by inner.
17887     */
17888    bool is_owned;
17889 } LDKAnchorDescriptor;
17890
17891 /**
17892  * Represents the different types of transactions, originating from LDK, to be bumped.
17893  */
17894 typedef enum LDKBumpTransactionEvent_Tag {
17895    /**
17896     * Indicates that a channel featuring anchor outputs is to be closed by broadcasting the local
17897     * commitment transaction. Since commitment transactions have a static feerate pre-agreed upon,
17898     * they may need additional fees to be attached through a child transaction using the popular
17899     * [Child-Pays-For-Parent](https://bitcoinops.org/en/topics/cpfp) fee bumping technique. This
17900     * child transaction must include the anchor input described within `anchor_descriptor` along
17901     * with additional inputs to meet the target feerate. Failure to meet the target feerate
17902     * decreases the confirmation odds of the transaction package (which includes the commitment
17903     * and child anchor transactions), possibly resulting in a loss of funds. Once the transaction
17904     * is constructed, it must be fully signed for and broadcast by the consumer of the event
17905     * along with the `commitment_tx` enclosed. Note that the `commitment_tx` must always be
17906     * broadcast first, as the child anchor transaction depends on it.
17907     *
17908     * The consumer should be able to sign for any of the additional inputs included within the
17909     * child anchor transaction. To sign its anchor input, an [`EcdsaChannelSigner`] should be
17910     * re-derived through [`AnchorDescriptor::derive_channel_signer`]. The anchor input signature
17911     * can be computed with [`EcdsaChannelSigner::sign_holder_anchor_input`], which can then be
17912     * provided to [`build_anchor_input_witness`] along with the `funding_pubkey` to obtain the
17913     * full witness required to spend.
17914     *
17915     * It is possible to receive more than one instance of this event if a valid child anchor
17916     * transaction is never broadcast or is but not with a sufficient fee to be mined. Care should
17917     * be taken by the consumer of the event to ensure any future iterations of the child anchor
17918     * transaction adhere to the [Replace-By-Fee
17919     * rules](https://github.com/bitcoin/bitcoin/blob/master/doc/policy/mempool-replacements.md)
17920     * for fee bumps to be accepted into the mempool, and eventually the chain. As the frequency of
17921     * these events is not user-controlled, users may ignore/drop the event if they are no longer
17922     * able to commit external confirmed funds to the child anchor transaction.
17923     *
17924     * The set of `pending_htlcs` on the commitment transaction to be broadcast can be inspected to
17925     * determine whether a significant portion of the channel's funds are allocated to HTLCs,
17926     * enabling users to make their own decisions regarding the importance of the commitment
17927     * transaction's confirmation. Note that this is not required, but simply exists as an option
17928     * for users to override LDK's behavior. On commitments with no HTLCs (indicated by those with
17929     * an empty `pending_htlcs`), confirmation of the commitment transaction can be considered to
17930     * be not urgent.
17931     *
17932     * [`EcdsaChannelSigner`]: crate::sign::ecdsa::EcdsaChannelSigner
17933     * [`EcdsaChannelSigner::sign_holder_anchor_input`]: crate::sign::ecdsa::EcdsaChannelSigner::sign_holder_anchor_input
17934     * [`build_anchor_input_witness`]: crate::ln::chan_utils::build_anchor_input_witness
17935     */
17936    LDKBumpTransactionEvent_ChannelClose,
17937    /**
17938     * Indicates that a channel featuring anchor outputs has unilaterally closed on-chain by a
17939     * holder commitment transaction and its HTLC(s) need to be resolved on-chain. With the
17940     * zero-HTLC-transaction-fee variant of anchor outputs, the pre-signed HTLC
17941     * transactions have a zero fee, thus requiring additional inputs and/or outputs to be attached
17942     * for a timely confirmation within the chain. These additional inputs and/or outputs must be
17943     * appended to the resulting HTLC transaction to meet the target feerate. Failure to meet the
17944     * target feerate decreases the confirmation odds of the transaction, possibly resulting in a
17945     * loss of funds. Once the transaction meets the target feerate, it must be signed for and
17946     * broadcast by the consumer of the event.
17947     *
17948     * The consumer should be able to sign for any of the non-HTLC inputs added to the resulting
17949     * HTLC transaction. To sign HTLC inputs, an [`EcdsaChannelSigner`] should be re-derived
17950     * through [`HTLCDescriptor::derive_channel_signer`]. Each HTLC input's signature can be
17951     * computed with [`EcdsaChannelSigner::sign_holder_htlc_transaction`], which can then be
17952     * provided to [`HTLCDescriptor::tx_input_witness`] to obtain the fully signed witness required
17953     * to spend.
17954     *
17955     * It is possible to receive more than one instance of this event if a valid HTLC transaction
17956     * is never broadcast or is but not with a sufficient fee to be mined. Care should be taken by
17957     * the consumer of the event to ensure any future iterations of the HTLC transaction adhere to
17958     * the [Replace-By-Fee
17959     * rules](https://github.com/bitcoin/bitcoin/blob/master/doc/policy/mempool-replacements.md)
17960     * for fee bumps to be accepted into the mempool, and eventually the chain. As the frequency of
17961     * these events is not user-controlled, users may ignore/drop the event if either they are no
17962     * longer able to commit external confirmed funds to the HTLC transaction or the fee committed
17963     * to the HTLC transaction is greater in value than the HTLCs being claimed.
17964     *
17965     * [`EcdsaChannelSigner`]: crate::sign::ecdsa::EcdsaChannelSigner
17966     * [`EcdsaChannelSigner::sign_holder_htlc_transaction`]: crate::sign::ecdsa::EcdsaChannelSigner::sign_holder_htlc_transaction
17967     */
17968    LDKBumpTransactionEvent_HTLCResolution,
17969    /**
17970     * Must be last for serialization purposes
17971     */
17972    LDKBumpTransactionEvent_Sentinel,
17973 } LDKBumpTransactionEvent_Tag;
17974
17975 typedef struct LDKBumpTransactionEvent_LDKChannelClose_Body {
17976    /**
17977     * The `channel_id` of the channel which has been closed.
17978     */
17979    struct LDKChannelId channel_id;
17980    /**
17981     * Counterparty in the closed channel.
17982     */
17983    struct LDKPublicKey counterparty_node_id;
17984    /**
17985     * The unique identifier for the claim of the anchor output in the commitment transaction.
17986     *
17987     * The identifier must map to the set of external UTXOs assigned to the claim, such that
17988     * they can be reused when a new claim with the same identifier needs to be made, resulting
17989     * in a fee-bumping attempt.
17990     */
17991    struct LDKThirtyTwoBytes claim_id;
17992    /**
17993     * The target feerate that the transaction package, which consists of the commitment
17994     * transaction and the to-be-crafted child anchor transaction, must meet.
17995     */
17996    uint32_t package_target_feerate_sat_per_1000_weight;
17997    /**
17998     * The channel's commitment transaction to bump the fee of. This transaction should be
17999     * broadcast along with the anchor transaction constructed as a result of consuming this
18000     * event.
18001     */
18002    struct LDKTransaction commitment_tx;
18003    /**
18004     * The absolute fee in satoshis of the commitment transaction. This can be used along the
18005     * with weight of the commitment transaction to determine its feerate.
18006     */
18007    uint64_t commitment_tx_fee_satoshis;
18008    /**
18009     * The descriptor to sign the anchor input of the anchor transaction constructed as a
18010     * result of consuming this event.
18011     */
18012    struct LDKAnchorDescriptor anchor_descriptor;
18013    /**
18014     * The set of pending HTLCs on the commitment transaction that need to be resolved once the
18015     * commitment transaction confirms.
18016     */
18017    struct LDKCVec_HTLCOutputInCommitmentZ pending_htlcs;
18018 } LDKBumpTransactionEvent_LDKChannelClose_Body;
18019
18020 typedef struct LDKBumpTransactionEvent_LDKHTLCResolution_Body {
18021    /**
18022     * The `channel_id` of the channel which has been closed.
18023     */
18024    struct LDKChannelId channel_id;
18025    /**
18026     * Counterparty in the closed channel.
18027     */
18028    struct LDKPublicKey counterparty_node_id;
18029    /**
18030     * The unique identifier for the claim of the HTLCs in the confirmed commitment
18031     * transaction.
18032     *
18033     * The identifier must map to the set of external UTXOs assigned to the claim, such that
18034     * they can be reused when a new claim with the same identifier needs to be made, resulting
18035     * in a fee-bumping attempt.
18036     */
18037    struct LDKThirtyTwoBytes claim_id;
18038    /**
18039     * The target feerate that the resulting HTLC transaction must meet.
18040     */
18041    uint32_t target_feerate_sat_per_1000_weight;
18042    /**
18043     * The set of pending HTLCs on the confirmed commitment that need to be claimed, preferably
18044     * by the same transaction.
18045     */
18046    struct LDKCVec_HTLCDescriptorZ htlc_descriptors;
18047    /**
18048     * The locktime required for the resulting HTLC transaction.
18049     */
18050    uint32_t tx_lock_time;
18051 } LDKBumpTransactionEvent_LDKHTLCResolution_Body;
18052
18053 typedef struct MUST_USE_STRUCT LDKBumpTransactionEvent {
18054    LDKBumpTransactionEvent_Tag tag;
18055    union {
18056       LDKBumpTransactionEvent_LDKChannelClose_Body channel_close;
18057       LDKBumpTransactionEvent_LDKHTLCResolution_Body htlc_resolution;
18058    };
18059 } LDKBumpTransactionEvent;
18060
18061 /**
18062  * An Event which you should probably take some action in response to.
18063  *
18064  * Note that while Writeable and Readable are implemented for Event, you probably shouldn't use
18065  * them directly as they don't round-trip exactly (for example FundingGenerationReady is never
18066  * written as it makes no sense to respond to it after reconnecting to peers).
18067  */
18068 typedef enum LDKEvent_Tag {
18069    /**
18070     * Used to indicate that the client should generate a funding transaction with the given
18071     * parameters and then call [`ChannelManager::funding_transaction_generated`].
18072     * Generated in [`ChannelManager`] message handling.
18073     * Note that *all inputs* in the funding transaction must spend SegWit outputs or your
18074     * counterparty can steal your funds!
18075     *
18076     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
18077     * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated
18078     */
18079    LDKEvent_FundingGenerationReady,
18080    /**
18081     * Indicates that we've been offered a payment and it needs to be claimed via calling
18082     * [`ChannelManager::claim_funds`] with the preimage given in [`PaymentPurpose`].
18083     *
18084     * Note that if the preimage is not known, you should call
18085     * [`ChannelManager::fail_htlc_backwards`] or [`ChannelManager::fail_htlc_backwards_with_reason`]
18086     * to free up resources for this HTLC and avoid network congestion.
18087     *
18088     * If [`Event::PaymentClaimable::onion_fields`] is `Some`, and includes custom TLVs with even type
18089     * numbers, you should use [`ChannelManager::fail_htlc_backwards_with_reason`] with
18090     * [`FailureCode::InvalidOnionPayload`] if you fail to understand and handle the contents, or
18091     * [`ChannelManager::claim_funds_with_known_custom_tlvs`] upon successful handling.
18092     * If you don't intend to check for custom TLVs, you can simply use
18093     * [`ChannelManager::claim_funds`], which will automatically fail back even custom TLVs.
18094     *
18095     * If you fail to call [`ChannelManager::claim_funds`],
18096     * [`ChannelManager::claim_funds_with_known_custom_tlvs`],
18097     * [`ChannelManager::fail_htlc_backwards`], or
18098     * [`ChannelManager::fail_htlc_backwards_with_reason`] within the HTLC's timeout, the HTLC will
18099     * be automatically failed.
18100     *
18101     * # Note
18102     * LDK will not stop an inbound payment from being paid multiple times, so multiple
18103     * `PaymentClaimable` events may be generated for the same payment. In such a case it is
18104     * polite (and required in the lightning specification) to fail the payment the second time
18105     * and give the sender their money back rather than accepting double payment.
18106     *
18107     * # Note
18108     * This event used to be called `PaymentReceived` in LDK versions 0.0.112 and earlier.
18109     *
18110     * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
18111     * [`ChannelManager::claim_funds_with_known_custom_tlvs`]: crate::ln::channelmanager::ChannelManager::claim_funds_with_known_custom_tlvs
18112     * [`FailureCode::InvalidOnionPayload`]: crate::ln::channelmanager::FailureCode::InvalidOnionPayload
18113     * [`ChannelManager::fail_htlc_backwards`]: crate::ln::channelmanager::ChannelManager::fail_htlc_backwards
18114     * [`ChannelManager::fail_htlc_backwards_with_reason`]: crate::ln::channelmanager::ChannelManager::fail_htlc_backwards_with_reason
18115     */
18116    LDKEvent_PaymentClaimable,
18117    /**
18118     * Indicates a payment has been claimed and we've received money!
18119     *
18120     * This most likely occurs when [`ChannelManager::claim_funds`] has been called in response
18121     * to an [`Event::PaymentClaimable`]. However, if we previously crashed during a
18122     * [`ChannelManager::claim_funds`] call you may see this event without a corresponding
18123     * [`Event::PaymentClaimable`] event.
18124     *
18125     * # Note
18126     * LDK will not stop an inbound payment from being paid multiple times, so multiple
18127     * `PaymentClaimable` events may be generated for the same payment. If you then call
18128     * [`ChannelManager::claim_funds`] twice for the same [`Event::PaymentClaimable`] you may get
18129     * multiple `PaymentClaimed` events.
18130     *
18131     * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
18132     */
18133    LDKEvent_PaymentClaimed,
18134    /**
18135     * Indicates that a peer connection with a node is needed in order to send an [`OnionMessage`].
18136     *
18137     * Typically, this happens when a [`MessageRouter`] is unable to find a complete path to a
18138     * [`Destination`]. Once a connection is established, any messages buffered by an
18139     * [`OnionMessageHandler`] may be sent.
18140     *
18141     * This event will not be generated for onion message forwards; only for sends including
18142     * replies. Handlers should connect to the node otherwise any buffered messages may be lost.
18143     *
18144     * [`OnionMessage`]: msgs::OnionMessage
18145     * [`MessageRouter`]: crate::onion_message::messenger::MessageRouter
18146     * [`Destination`]: crate::onion_message::messenger::Destination
18147     * [`OnionMessageHandler`]: crate::ln::msgs::OnionMessageHandler
18148     */
18149    LDKEvent_ConnectionNeeded,
18150    /**
18151     * Indicates a request for an invoice failed to yield a response in a reasonable amount of time
18152     * or was explicitly abandoned by [`ChannelManager::abandon_payment`]. This may be for an
18153     * [`InvoiceRequest`] sent for an [`Offer`] or for a [`Refund`] that hasn't been redeemed.
18154     *
18155     * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
18156     * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
18157     * [`Offer`]: crate::offers::offer::Offer
18158     * [`Refund`]: crate::offers::refund::Refund
18159     */
18160    LDKEvent_InvoiceRequestFailed,
18161    /**
18162     * Indicates an outbound payment we made succeeded (i.e. it made it all the way to its target
18163     * and we got back the payment preimage for it).
18164     *
18165     * Note for MPP payments: in rare cases, this event may be preceded by a `PaymentPathFailed`
18166     * event. In this situation, you SHOULD treat this payment as having succeeded.
18167     */
18168    LDKEvent_PaymentSent,
18169    /**
18170     * Indicates an outbound payment failed. Individual [`Event::PaymentPathFailed`] events
18171     * provide failure information for each path attempt in the payment, including retries.
18172     *
18173     * This event is provided once there are no further pending HTLCs for the payment and the
18174     * payment is no longer retryable, due either to the [`Retry`] provided or
18175     * [`ChannelManager::abandon_payment`] having been called for the corresponding payment.
18176     *
18177     * In exceedingly rare cases, it is possible that an [`Event::PaymentFailed`] is generated for
18178     * a payment after an [`Event::PaymentSent`] event for this same payment has already been
18179     * received and processed. In this case, the [`Event::PaymentFailed`] event MUST be ignored,
18180     * and the payment MUST be treated as having succeeded.
18181     *
18182     * [`Retry`]: crate::ln::channelmanager::Retry
18183     * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
18184     */
18185    LDKEvent_PaymentFailed,
18186    /**
18187     * Indicates that a path for an outbound payment was successful.
18188     *
18189     * Always generated after [`Event::PaymentSent`] and thus useful for scoring channels. See
18190     * [`Event::PaymentSent`] for obtaining the payment preimage.
18191     */
18192    LDKEvent_PaymentPathSuccessful,
18193    /**
18194     * Indicates an outbound HTLC we sent failed, likely due to an intermediary node being unable to
18195     * handle the HTLC.
18196     *
18197     * Note that this does *not* indicate that all paths for an MPP payment have failed, see
18198     * [`Event::PaymentFailed`].
18199     *
18200     * See [`ChannelManager::abandon_payment`] for giving up on this payment before its retries have
18201     * been exhausted.
18202     *
18203     * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
18204     */
18205    LDKEvent_PaymentPathFailed,
18206    /**
18207     * Indicates that a probe payment we sent returned successful, i.e., only failed at the destination.
18208     */
18209    LDKEvent_ProbeSuccessful,
18210    /**
18211     * Indicates that a probe payment we sent failed at an intermediary node on the path.
18212     */
18213    LDKEvent_ProbeFailed,
18214    /**
18215     * Used to indicate that [`ChannelManager::process_pending_htlc_forwards`] should be called at
18216     * a time in the future.
18217     *
18218     * [`ChannelManager::process_pending_htlc_forwards`]: crate::ln::channelmanager::ChannelManager::process_pending_htlc_forwards
18219     */
18220    LDKEvent_PendingHTLCsForwardable,
18221    /**
18222     * Used to indicate that we've intercepted an HTLC forward. This event will only be generated if
18223     * you've encoded an intercept scid in the receiver's invoice route hints using
18224     * [`ChannelManager::get_intercept_scid`] and have set [`UserConfig::accept_intercept_htlcs`].
18225     *
18226     * [`ChannelManager::forward_intercepted_htlc`] or
18227     * [`ChannelManager::fail_intercepted_htlc`] MUST be called in response to this event. See
18228     * their docs for more information.
18229     *
18230     * [`ChannelManager::get_intercept_scid`]: crate::ln::channelmanager::ChannelManager::get_intercept_scid
18231     * [`UserConfig::accept_intercept_htlcs`]: crate::util::config::UserConfig::accept_intercept_htlcs
18232     * [`ChannelManager::forward_intercepted_htlc`]: crate::ln::channelmanager::ChannelManager::forward_intercepted_htlc
18233     * [`ChannelManager::fail_intercepted_htlc`]: crate::ln::channelmanager::ChannelManager::fail_intercepted_htlc
18234     */
18235    LDKEvent_HTLCIntercepted,
18236    /**
18237     * Used to indicate that an output which you should know how to spend was confirmed on chain
18238     * and is now spendable.
18239     *
18240     * Such an output will *never* be spent directly by LDK, and are not at risk of your
18241     * counterparty spending them due to some kind of timeout. Thus, you need to store them
18242     * somewhere and spend them when you create on-chain transactions.
18243     *
18244     * You may hand them to the [`OutputSweeper`] utility which will store and (re-)generate spending
18245     * transactions for you.
18246     *
18247     * [`OutputSweeper`]: crate::util::sweep::OutputSweeper
18248     */
18249    LDKEvent_SpendableOutputs,
18250    /**
18251     * This event is generated when a payment has been successfully forwarded through us and a
18252     * forwarding fee earned.
18253     */
18254    LDKEvent_PaymentForwarded,
18255    /**
18256     * Used to indicate that a channel with the given `channel_id` is being opened and pending
18257     * confirmation on-chain.
18258     *
18259     * This event is emitted when the funding transaction has been signed and is broadcast to the
18260     * network. For 0conf channels it will be immediately followed by the corresponding
18261     * [`Event::ChannelReady`] event.
18262     */
18263    LDKEvent_ChannelPending,
18264    /**
18265     * Used to indicate that a channel with the given `channel_id` is ready to
18266     * be used. This event is emitted either when the funding transaction has been confirmed
18267     * on-chain, or, in case of a 0conf channel, when both parties have confirmed the channel
18268     * establishment.
18269     */
18270    LDKEvent_ChannelReady,
18271    /**
18272     * Used to indicate that a channel that got past the initial handshake with the given `channel_id` is in the
18273     * process of closure. This includes previously opened channels, and channels that time out from not being funded.
18274     *
18275     * Note that this event is only triggered for accepted channels: if the
18276     * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true and the channel is
18277     * rejected, no `ChannelClosed` event will be sent.
18278     *
18279     * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
18280     * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
18281     */
18282    LDKEvent_ChannelClosed,
18283    /**
18284     * Used to indicate to the user that they can abandon the funding transaction and recycle the
18285     * inputs for another purpose.
18286     *
18287     * This event is not guaranteed to be generated for channels that are closed due to a restart.
18288     */
18289    LDKEvent_DiscardFunding,
18290    /**
18291     * Indicates a request to open a new channel by a peer.
18292     *
18293     * To accept the request, call [`ChannelManager::accept_inbound_channel`]. To reject the request,
18294     * call [`ChannelManager::force_close_without_broadcasting_txn`]. Note that a ['ChannelClosed`]
18295     * event will _not_ be triggered if the channel is rejected.
18296     *
18297     * The event is only triggered when a new open channel request is received and the
18298     * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true.
18299     *
18300     * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
18301     * [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn
18302     * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
18303     */
18304    LDKEvent_OpenChannelRequest,
18305    /**
18306     * Indicates that the HTLC was accepted, but could not be processed when or after attempting to
18307     * forward it.
18308     *
18309     * Some scenarios where this event may be sent include:
18310     * * Insufficient capacity in the outbound channel
18311     * * While waiting to forward the HTLC, the channel it is meant to be forwarded through closes
18312     * * When an unknown SCID is requested for forwarding a payment.
18313     * * Expected MPP amount has already been reached
18314     * * The HTLC has timed out
18315     *
18316     * This event, however, does not get generated if an HTLC fails to meet the forwarding
18317     * requirements (i.e. insufficient fees paid, or a CLTV that is too soon).
18318     */
18319    LDKEvent_HTLCHandlingFailed,
18320    /**
18321     * Indicates that a transaction originating from LDK needs to have its fee bumped. This event
18322     * requires confirmed external funds to be readily available to spend.
18323     *
18324     * LDK does not currently generate this event unless the
18325     * [`ChannelHandshakeConfig::negotiate_anchors_zero_fee_htlc_tx`] config flag is set to true.
18326     * It is limited to the scope of channels with anchor outputs.
18327     *
18328     * [`ChannelHandshakeConfig::negotiate_anchors_zero_fee_htlc_tx`]: crate::util::config::ChannelHandshakeConfig::negotiate_anchors_zero_fee_htlc_tx
18329     */
18330    LDKEvent_BumpTransaction,
18331    /**
18332     * Must be last for serialization purposes
18333     */
18334    LDKEvent_Sentinel,
18335 } LDKEvent_Tag;
18336
18337 typedef struct LDKEvent_LDKFundingGenerationReady_Body {
18338    /**
18339     * The random channel_id we picked which you'll need to pass into
18340     * [`ChannelManager::funding_transaction_generated`].
18341     *
18342     * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated
18343     */
18344    struct LDKChannelId temporary_channel_id;
18345    /**
18346     * The counterparty's node_id, which you'll need to pass back into
18347     * [`ChannelManager::funding_transaction_generated`].
18348     *
18349     * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated
18350     */
18351    struct LDKPublicKey counterparty_node_id;
18352    /**
18353     * The value, in satoshis, that the output should have.
18354     */
18355    uint64_t channel_value_satoshis;
18356    /**
18357     * The script which should be used in the transaction output.
18358     */
18359    struct LDKCVec_u8Z output_script;
18360    /**
18361     * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound
18362     * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if
18363     * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise
18364     * `user_channel_id` will be randomized for an inbound channel.  This may be zero for objects
18365     * serialized with LDK versions prior to 0.0.113.
18366     *
18367     * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
18368     * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
18369     * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
18370     */
18371    struct LDKU128 user_channel_id;
18372 } LDKEvent_LDKFundingGenerationReady_Body;
18373
18374 typedef struct LDKEvent_LDKPaymentClaimable_Body {
18375    /**
18376     * The node that will receive the payment after it has been claimed.
18377     * This is useful to identify payments received via [phantom nodes].
18378     * This field will always be filled in when the event was generated by LDK versions
18379     * 0.0.113 and above.
18380     *
18381     * [phantom nodes]: crate::sign::PhantomKeysManager
18382     *
18383     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
18384     */
18385    struct LDKPublicKey receiver_node_id;
18386    /**
18387     * The hash for which the preimage should be handed to the ChannelManager. Note that LDK will
18388     * not stop you from registering duplicate payment hashes for inbound payments.
18389     */
18390    struct LDKThirtyTwoBytes payment_hash;
18391    /**
18392     * The fields in the onion which were received with each HTLC. Only fields which were
18393     * identical in each HTLC involved in the payment will be included here.
18394     *
18395     * Payments received on LDK versions prior to 0.0.115 will have this field unset.
18396     *
18397     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
18398     */
18399    struct LDKRecipientOnionFields onion_fields;
18400    /**
18401     * The value, in thousandths of a satoshi, that this payment is claimable for. May be greater
18402     * than the invoice amount.
18403     *
18404     * May be less than the invoice amount if [`ChannelConfig::accept_underpaying_htlcs`] is set
18405     * and the previous hop took an extra fee.
18406     *
18407     * # Note
18408     * If [`ChannelConfig::accept_underpaying_htlcs`] is set and you claim without verifying this
18409     * field, you may lose money!
18410     *
18411     * [`ChannelConfig::accept_underpaying_htlcs`]: crate::util::config::ChannelConfig::accept_underpaying_htlcs
18412     */
18413    uint64_t amount_msat;
18414    /**
18415     * The value, in thousands of a satoshi, that was skimmed off of this payment as an extra fee
18416     * taken by our channel counterparty.
18417     *
18418     * Will always be 0 unless [`ChannelConfig::accept_underpaying_htlcs`] is set.
18419     *
18420     * [`ChannelConfig::accept_underpaying_htlcs`]: crate::util::config::ChannelConfig::accept_underpaying_htlcs
18421     */
18422    uint64_t counterparty_skimmed_fee_msat;
18423    /**
18424     * Information for claiming this received payment, based on whether the purpose of the
18425     * payment is to pay an invoice or to send a spontaneous payment.
18426     */
18427    struct LDKPaymentPurpose purpose;
18428    /**
18429     * The `channel_id` indicating over which channel we received the payment.
18430     *
18431     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
18432     */
18433    struct LDKChannelId via_channel_id;
18434    /**
18435     * The `user_channel_id` indicating over which channel we received the payment.
18436     */
18437    struct LDKCOption_U128Z via_user_channel_id;
18438    /**
18439     * The block height at which this payment will be failed back and will no longer be
18440     * eligible for claiming.
18441     *
18442     * Prior to this height, a call to [`ChannelManager::claim_funds`] is guaranteed to
18443     * succeed, however you should wait for [`Event::PaymentClaimed`] to be sure.
18444     *
18445     * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
18446     */
18447    struct LDKCOption_u32Z claim_deadline;
18448 } LDKEvent_LDKPaymentClaimable_Body;
18449
18450 typedef struct LDKEvent_LDKPaymentClaimed_Body {
18451    /**
18452     * The node that received the payment.
18453     * This is useful to identify payments which were received via [phantom nodes].
18454     * This field will always be filled in when the event was generated by LDK versions
18455     * 0.0.113 and above.
18456     *
18457     * [phantom nodes]: crate::sign::PhantomKeysManager
18458     *
18459     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
18460     */
18461    struct LDKPublicKey receiver_node_id;
18462    /**
18463     * The payment hash of the claimed payment. Note that LDK will not stop you from
18464     * registering duplicate payment hashes for inbound payments.
18465     */
18466    struct LDKThirtyTwoBytes payment_hash;
18467    /**
18468     * The value, in thousandths of a satoshi, that this payment is for. May be greater than the
18469     * invoice amount.
18470     */
18471    uint64_t amount_msat;
18472    /**
18473     * The purpose of the claimed payment, i.e. whether the payment was for an invoice or a
18474     * spontaneous payment.
18475     */
18476    struct LDKPaymentPurpose purpose;
18477    /**
18478     * The HTLCs that comprise the claimed payment. This will be empty for events serialized prior
18479     * to LDK version 0.0.117.
18480     */
18481    struct LDKCVec_ClaimedHTLCZ htlcs;
18482    /**
18483     * The sender-intended sum total of all the MPP parts. This will be `None` for events
18484     * serialized prior to LDK version 0.0.117.
18485     */
18486    struct LDKCOption_u64Z sender_intended_total_msat;
18487 } LDKEvent_LDKPaymentClaimed_Body;
18488
18489 typedef struct LDKEvent_LDKConnectionNeeded_Body {
18490    /**
18491     * The node id for the node needing a connection.
18492     */
18493    struct LDKPublicKey node_id;
18494    /**
18495     * Sockets for connecting to the node.
18496     */
18497    struct LDKCVec_SocketAddressZ addresses;
18498 } LDKEvent_LDKConnectionNeeded_Body;
18499
18500 typedef struct LDKEvent_LDKInvoiceRequestFailed_Body {
18501    /**
18502     * The `payment_id` to have been associated with payment for the requested invoice.
18503     */
18504    struct LDKThirtyTwoBytes payment_id;
18505 } LDKEvent_LDKInvoiceRequestFailed_Body;
18506
18507 typedef struct LDKEvent_LDKPaymentSent_Body {
18508    /**
18509     * The `payment_id` passed to [`ChannelManager::send_payment`].
18510     *
18511     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
18512     */
18513    struct LDKCOption_ThirtyTwoBytesZ payment_id;
18514    /**
18515     * The preimage to the hash given to ChannelManager::send_payment.
18516     * Note that this serves as a payment receipt, if you wish to have such a thing, you must
18517     * store it somehow!
18518     */
18519    struct LDKThirtyTwoBytes payment_preimage;
18520    /**
18521     * The hash that was given to [`ChannelManager::send_payment`].
18522     *
18523     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
18524     */
18525    struct LDKThirtyTwoBytes payment_hash;
18526    /**
18527     * The total fee which was spent at intermediate hops in this payment, across all paths.
18528     *
18529     * Note that, like [`Route::get_total_fees`] this does *not* include any potential
18530     * overpayment to the recipient node.
18531     *
18532     * If the recipient or an intermediate node misbehaves and gives us free money, this may
18533     * overstate the amount paid, though this is unlikely.
18534     *
18535     * [`Route::get_total_fees`]: crate::routing::router::Route::get_total_fees
18536     */
18537    struct LDKCOption_u64Z fee_paid_msat;
18538 } LDKEvent_LDKPaymentSent_Body;
18539
18540 typedef struct LDKEvent_LDKPaymentFailed_Body {
18541    /**
18542     * The `payment_id` passed to [`ChannelManager::send_payment`].
18543     *
18544     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
18545     */
18546    struct LDKThirtyTwoBytes payment_id;
18547    /**
18548     * The hash that was given to [`ChannelManager::send_payment`].
18549     *
18550     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
18551     */
18552    struct LDKThirtyTwoBytes payment_hash;
18553    /**
18554     * The reason the payment failed. This is only `None` for events generated or serialized
18555     * by versions prior to 0.0.115.
18556     */
18557    struct LDKCOption_PaymentFailureReasonZ reason;
18558 } LDKEvent_LDKPaymentFailed_Body;
18559
18560 typedef struct LDKEvent_LDKPaymentPathSuccessful_Body {
18561    /**
18562     * The `payment_id` passed to [`ChannelManager::send_payment`].
18563     *
18564     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
18565     */
18566    struct LDKThirtyTwoBytes payment_id;
18567    /**
18568     * The hash that was given to [`ChannelManager::send_payment`].
18569     *
18570     * This will be `Some` for all payments which completed on LDK 0.0.104 or later.
18571     *
18572     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
18573     */
18574    struct LDKCOption_ThirtyTwoBytesZ payment_hash;
18575    /**
18576     * The payment path that was successful.
18577     *
18578     * May contain a closed channel if the HTLC sent along the path was fulfilled on chain.
18579     */
18580    struct LDKPath path;
18581 } LDKEvent_LDKPaymentPathSuccessful_Body;
18582
18583 typedef struct LDKEvent_LDKPaymentPathFailed_Body {
18584    /**
18585     * The `payment_id` passed to [`ChannelManager::send_payment`].
18586     *
18587     * This will be `Some` for all payment paths which failed on LDK 0.0.103 or later.
18588     *
18589     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
18590     * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
18591     */
18592    struct LDKCOption_ThirtyTwoBytesZ payment_id;
18593    /**
18594     * The hash that was given to [`ChannelManager::send_payment`].
18595     *
18596     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
18597     */
18598    struct LDKThirtyTwoBytes payment_hash;
18599    /**
18600     * Indicates the payment was rejected for some reason by the recipient. This implies that
18601     * the payment has failed, not just the route in question. If this is not set, the payment may
18602     * be retried via a different route.
18603     */
18604    bool payment_failed_permanently;
18605    /**
18606     * Extra error details based on the failure type. May contain an update that needs to be
18607     * applied to the [`NetworkGraph`].
18608     *
18609     * [`NetworkGraph`]: crate::routing::gossip::NetworkGraph
18610     */
18611    struct LDKPathFailure failure;
18612    /**
18613     * The payment path that failed.
18614     */
18615    struct LDKPath path;
18616    /**
18617     * The channel responsible for the failed payment path.
18618     *
18619     * Note that for route hints or for the first hop in a path this may be an SCID alias and
18620     * may not refer to a channel in the public network graph. These aliases may also collide
18621     * with channels in the public network graph.
18622     *
18623     * If this is `Some`, then the corresponding channel should be avoided when the payment is
18624     * retried. May be `None` for older [`Event`] serializations.
18625     */
18626    struct LDKCOption_u64Z short_channel_id;
18627 } LDKEvent_LDKPaymentPathFailed_Body;
18628
18629 typedef struct LDKEvent_LDKProbeSuccessful_Body {
18630    /**
18631     * The id returned by [`ChannelManager::send_probe`].
18632     *
18633     * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe
18634     */
18635    struct LDKThirtyTwoBytes payment_id;
18636    /**
18637     * The hash generated by [`ChannelManager::send_probe`].
18638     *
18639     * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe
18640     */
18641    struct LDKThirtyTwoBytes payment_hash;
18642    /**
18643     * The payment path that was successful.
18644     */
18645    struct LDKPath path;
18646 } LDKEvent_LDKProbeSuccessful_Body;
18647
18648 typedef struct LDKEvent_LDKProbeFailed_Body {
18649    /**
18650     * The id returned by [`ChannelManager::send_probe`].
18651     *
18652     * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe
18653     */
18654    struct LDKThirtyTwoBytes payment_id;
18655    /**
18656     * The hash generated by [`ChannelManager::send_probe`].
18657     *
18658     * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe
18659     */
18660    struct LDKThirtyTwoBytes payment_hash;
18661    /**
18662     * The payment path that failed.
18663     */
18664    struct LDKPath path;
18665    /**
18666     * The channel responsible for the failed probe.
18667     *
18668     * Note that for route hints or for the first hop in a path this may be an SCID alias and
18669     * may not refer to a channel in the public network graph. These aliases may also collide
18670     * with channels in the public network graph.
18671     */
18672    struct LDKCOption_u64Z short_channel_id;
18673 } LDKEvent_LDKProbeFailed_Body;
18674
18675 typedef struct LDKEvent_LDKPendingHTLCsForwardable_Body {
18676    /**
18677     * The minimum amount of time that should be waited prior to calling
18678     * process_pending_htlc_forwards. To increase the effort required to correlate payments,
18679     * you should wait a random amount of time in roughly the range (now + time_forwardable,
18680     * now + 5*time_forwardable).
18681     */
18682    uint64_t time_forwardable;
18683 } LDKEvent_LDKPendingHTLCsForwardable_Body;
18684
18685 typedef struct LDKEvent_LDKHTLCIntercepted_Body {
18686    /**
18687     * An id to help LDK identify which HTLC is being forwarded or failed.
18688     */
18689    struct LDKThirtyTwoBytes intercept_id;
18690    /**
18691     * The fake scid that was programmed as the next hop's scid, generated using
18692     * [`ChannelManager::get_intercept_scid`].
18693     *
18694     * [`ChannelManager::get_intercept_scid`]: crate::ln::channelmanager::ChannelManager::get_intercept_scid
18695     */
18696    uint64_t requested_next_hop_scid;
18697    /**
18698     * The payment hash used for this HTLC.
18699     */
18700    struct LDKThirtyTwoBytes payment_hash;
18701    /**
18702     * How many msats were received on the inbound edge of this HTLC.
18703     */
18704    uint64_t inbound_amount_msat;
18705    /**
18706     * How many msats the payer intended to route to the next node. Depending on the reason you are
18707     * intercepting this payment, you might take a fee by forwarding less than this amount.
18708     * Forwarding less than this amount may break compatibility with LDK versions prior to 0.0.116.
18709     *
18710     * Note that LDK will NOT check that expected fees were factored into this value. You MUST
18711     * check that whatever fee you want has been included here or subtract it as required. Further,
18712     * LDK will not stop you from forwarding more than you received.
18713     */
18714    uint64_t expected_outbound_amount_msat;
18715 } LDKEvent_LDKHTLCIntercepted_Body;
18716
18717 typedef struct LDKEvent_LDKSpendableOutputs_Body {
18718    /**
18719     * The outputs which you should store as spendable by you.
18720     */
18721    struct LDKCVec_SpendableOutputDescriptorZ outputs;
18722    /**
18723     * The `channel_id` indicating which channel the spendable outputs belong to.
18724     *
18725     * This will always be `Some` for events generated by LDK versions 0.0.117 and above.
18726     *
18727     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
18728     */
18729    struct LDKChannelId channel_id;
18730 } LDKEvent_LDKSpendableOutputs_Body;
18731
18732 typedef struct LDKEvent_LDKPaymentForwarded_Body {
18733    /**
18734     * The channel id of the incoming channel between the previous node and us.
18735     *
18736     * This is only `None` for events generated or serialized by versions prior to 0.0.107.
18737     *
18738     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
18739     */
18740    struct LDKChannelId prev_channel_id;
18741    /**
18742     * The channel id of the outgoing channel between the next node and us.
18743     *
18744     * This is only `None` for events generated or serialized by versions prior to 0.0.107.
18745     *
18746     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
18747     */
18748    struct LDKChannelId next_channel_id;
18749    /**
18750     * The `user_channel_id` of the incoming channel between the previous node and us.
18751     *
18752     * This is only `None` for events generated or serialized by versions prior to 0.0.122.
18753     */
18754    struct LDKCOption_U128Z prev_user_channel_id;
18755    /**
18756     * The `user_channel_id` of the outgoing channel between the next node and us.
18757     *
18758     * This will be `None` if the payment was settled via an on-chain transaction. See the
18759     * caveat described for the `total_fee_earned_msat` field. Moreover it will be `None` for
18760     * events generated or serialized by versions prior to 0.0.122.
18761     */
18762    struct LDKCOption_U128Z next_user_channel_id;
18763    /**
18764     * The total fee, in milli-satoshis, which was earned as a result of the payment.
18765     *
18766     * Note that if we force-closed the channel over which we forwarded an HTLC while the HTLC
18767     * was pending, the amount the next hop claimed will have been rounded down to the nearest
18768     * whole satoshi. Thus, the fee calculated here may be higher than expected as we still
18769     * claimed the full value in millisatoshis from the source. In this case,
18770     * `claim_from_onchain_tx` will be set.
18771     *
18772     * If the channel which sent us the payment has been force-closed, we will claim the funds
18773     * via an on-chain transaction. In that case we do not yet know the on-chain transaction
18774     * fees which we will spend and will instead set this to `None`. It is possible duplicate
18775     * `PaymentForwarded` events are generated for the same payment iff `total_fee_earned_msat` is
18776     * `None`.
18777     */
18778    struct LDKCOption_u64Z total_fee_earned_msat;
18779    /**
18780     * The share of the total fee, in milli-satoshis, which was withheld in addition to the
18781     * forwarding fee.
18782     *
18783     * This will only be `Some` if we forwarded an intercepted HTLC with less than the
18784     * expected amount. This means our counterparty accepted to receive less than the invoice
18785     * amount, e.g., by claiming the payment featuring a corresponding
18786     * [`PaymentClaimable::counterparty_skimmed_fee_msat`].
18787     *
18788     * Will also always be `None` for events serialized with LDK prior to version 0.0.122.
18789     *
18790     * The caveat described above the `total_fee_earned_msat` field applies here as well.
18791     *
18792     * [`PaymentClaimable::counterparty_skimmed_fee_msat`]: Self::PaymentClaimable::counterparty_skimmed_fee_msat
18793     */
18794    struct LDKCOption_u64Z skimmed_fee_msat;
18795    /**
18796     * If this is `true`, the forwarded HTLC was claimed by our counterparty via an on-chain
18797     * transaction.
18798     */
18799    bool claim_from_onchain_tx;
18800    /**
18801     * The final amount forwarded, in milli-satoshis, after the fee is deducted.
18802     *
18803     * The caveat described above the `total_fee_earned_msat` field applies here as well.
18804     */
18805    struct LDKCOption_u64Z outbound_amount_forwarded_msat;
18806 } LDKEvent_LDKPaymentForwarded_Body;
18807
18808 typedef struct LDKEvent_LDKChannelPending_Body {
18809    /**
18810     * The `channel_id` of the channel that is pending confirmation.
18811     */
18812    struct LDKChannelId channel_id;
18813    /**
18814     * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound
18815     * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if
18816     * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise
18817     * `user_channel_id` will be randomized for an inbound channel.
18818     *
18819     * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
18820     * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
18821     * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
18822     */
18823    struct LDKU128 user_channel_id;
18824    /**
18825     * The `temporary_channel_id` this channel used to be known by during channel establishment.
18826     *
18827     * Will be `None` for channels created prior to LDK version 0.0.115.
18828     *
18829     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
18830     */
18831    struct LDKChannelId former_temporary_channel_id;
18832    /**
18833     * The `node_id` of the channel counterparty.
18834     */
18835    struct LDKPublicKey counterparty_node_id;
18836    /**
18837     * The outpoint of the channel's funding transaction.
18838     */
18839    struct LDKOutPoint funding_txo;
18840    /**
18841     * The features that this channel will operate with.
18842     *
18843     * Will be `None` for channels created prior to LDK version 0.0.122.
18844     *
18845     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
18846     */
18847    struct LDKChannelTypeFeatures channel_type;
18848 } LDKEvent_LDKChannelPending_Body;
18849
18850 typedef struct LDKEvent_LDKChannelReady_Body {
18851    /**
18852     * The `channel_id` of the channel that is ready.
18853     */
18854    struct LDKChannelId channel_id;
18855    /**
18856     * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound
18857     * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if
18858     * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise
18859     * `user_channel_id` will be randomized for an inbound channel.
18860     *
18861     * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
18862     * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
18863     * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
18864     */
18865    struct LDKU128 user_channel_id;
18866    /**
18867     * The `node_id` of the channel counterparty.
18868     */
18869    struct LDKPublicKey counterparty_node_id;
18870    /**
18871     * The features that this channel will operate with.
18872     */
18873    struct LDKChannelTypeFeatures channel_type;
18874 } LDKEvent_LDKChannelReady_Body;
18875
18876 typedef struct LDKEvent_LDKChannelClosed_Body {
18877    /**
18878     * The `channel_id` of the channel which has been closed. Note that on-chain transactions
18879     * resolving the channel are likely still awaiting confirmation.
18880     */
18881    struct LDKChannelId channel_id;
18882    /**
18883     * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound
18884     * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if
18885     * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise
18886     * `user_channel_id` will be randomized for inbound channels.
18887     * This may be zero for inbound channels serialized prior to 0.0.113 and will always be
18888     * zero for objects serialized with LDK versions prior to 0.0.102.
18889     *
18890     * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
18891     * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
18892     * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
18893     */
18894    struct LDKU128 user_channel_id;
18895    /**
18896     * The reason the channel was closed.
18897     */
18898    struct LDKClosureReason reason;
18899    /**
18900     * Counterparty in the closed channel.
18901     *
18902     * This field will be `None` for objects serialized prior to LDK 0.0.117.
18903     *
18904     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
18905     */
18906    struct LDKPublicKey counterparty_node_id;
18907    /**
18908     * Channel capacity of the closing channel (sats).
18909     *
18910     * This field will be `None` for objects serialized prior to LDK 0.0.117.
18911     */
18912    struct LDKCOption_u64Z channel_capacity_sats;
18913    /**
18914     * The original channel funding TXO; this helps checking for the existence and confirmation
18915     * status of the closing tx.
18916     * Note that for instances serialized in v0.0.119 or prior this will be missing (None).
18917     *
18918     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
18919     */
18920    struct LDKOutPoint channel_funding_txo;
18921 } LDKEvent_LDKChannelClosed_Body;
18922
18923 typedef struct LDKEvent_LDKDiscardFunding_Body {
18924    /**
18925     * The channel_id of the channel which has been closed.
18926     */
18927    struct LDKChannelId channel_id;
18928    /**
18929     * The full transaction received from the user
18930     */
18931    struct LDKTransaction transaction;
18932 } LDKEvent_LDKDiscardFunding_Body;
18933
18934 typedef struct LDKEvent_LDKOpenChannelRequest_Body {
18935    /**
18936     * The temporary channel ID of the channel requested to be opened.
18937     *
18938     * When responding to the request, the `temporary_channel_id` should be passed
18939     * back to the ChannelManager through [`ChannelManager::accept_inbound_channel`] to accept,
18940     * or through [`ChannelManager::force_close_without_broadcasting_txn`] to reject.
18941     *
18942     * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
18943     * [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn
18944     */
18945    struct LDKChannelId temporary_channel_id;
18946    /**
18947     * The node_id of the counterparty requesting to open the channel.
18948     *
18949     * When responding to the request, the `counterparty_node_id` should be passed
18950     * back to the `ChannelManager` through [`ChannelManager::accept_inbound_channel`] to
18951     * accept the request, or through [`ChannelManager::force_close_without_broadcasting_txn`] to reject the
18952     * request.
18953     *
18954     * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
18955     * [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn
18956     */
18957    struct LDKPublicKey counterparty_node_id;
18958    /**
18959     * The channel value of the requested channel.
18960     */
18961    uint64_t funding_satoshis;
18962    /**
18963     * Our starting balance in the channel if the request is accepted, in milli-satoshi.
18964     */
18965    uint64_t push_msat;
18966    /**
18967     * The features that this channel will operate with. If you reject the channel, a
18968     * well-behaved counterparty may automatically re-attempt the channel with a new set of
18969     * feature flags.
18970     *
18971     * Note that if [`ChannelTypeFeatures::supports_scid_privacy`] returns true on this type,
18972     * the resulting [`ChannelManager`] will not be readable by versions of LDK prior to
18973     * 0.0.106.
18974     *
18975     * Furthermore, note that if [`ChannelTypeFeatures::supports_zero_conf`] returns true on this type,
18976     * the resulting [`ChannelManager`] will not be readable by versions of LDK prior to
18977     * 0.0.107. Channels setting this type also need to get manually accepted via
18978     * [`crate::ln::channelmanager::ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`],
18979     * or will be rejected otherwise.
18980     *
18981     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
18982     */
18983    struct LDKChannelTypeFeatures channel_type;
18984 } LDKEvent_LDKOpenChannelRequest_Body;
18985
18986 typedef struct LDKEvent_LDKHTLCHandlingFailed_Body {
18987    /**
18988     * The channel over which the HTLC was received.
18989     */
18990    struct LDKChannelId prev_channel_id;
18991    /**
18992     * Destination of the HTLC that failed to be processed.
18993     */
18994    struct LDKHTLCDestination failed_next_destination;
18995 } LDKEvent_LDKHTLCHandlingFailed_Body;
18996
18997 typedef struct MUST_USE_STRUCT LDKEvent {
18998    LDKEvent_Tag tag;
18999    union {
19000       LDKEvent_LDKFundingGenerationReady_Body funding_generation_ready;
19001       LDKEvent_LDKPaymentClaimable_Body payment_claimable;
19002       LDKEvent_LDKPaymentClaimed_Body payment_claimed;
19003       LDKEvent_LDKConnectionNeeded_Body connection_needed;
19004       LDKEvent_LDKInvoiceRequestFailed_Body invoice_request_failed;
19005       LDKEvent_LDKPaymentSent_Body payment_sent;
19006       LDKEvent_LDKPaymentFailed_Body payment_failed;
19007       LDKEvent_LDKPaymentPathSuccessful_Body payment_path_successful;
19008       LDKEvent_LDKPaymentPathFailed_Body payment_path_failed;
19009       LDKEvent_LDKProbeSuccessful_Body probe_successful;
19010       LDKEvent_LDKProbeFailed_Body probe_failed;
19011       LDKEvent_LDKPendingHTLCsForwardable_Body pending_htl_cs_forwardable;
19012       LDKEvent_LDKHTLCIntercepted_Body htlc_intercepted;
19013       LDKEvent_LDKSpendableOutputs_Body spendable_outputs;
19014       LDKEvent_LDKPaymentForwarded_Body payment_forwarded;
19015       LDKEvent_LDKChannelPending_Body channel_pending;
19016       LDKEvent_LDKChannelReady_Body channel_ready;
19017       LDKEvent_LDKChannelClosed_Body channel_closed;
19018       LDKEvent_LDKDiscardFunding_Body discard_funding;
19019       LDKEvent_LDKOpenChannelRequest_Body open_channel_request;
19020       LDKEvent_LDKHTLCHandlingFailed_Body htlc_handling_failed;
19021       struct {
19022          struct LDKBumpTransactionEvent bump_transaction;
19023       };
19024    };
19025 } LDKEvent;
19026
19027 /**
19028  * An enum which can either contain a crate::lightning::events::Event or not
19029  */
19030 typedef enum LDKCOption_EventZ_Tag {
19031    /**
19032     * When we're in this state, this COption_EventZ contains a crate::lightning::events::Event
19033     */
19034    LDKCOption_EventZ_Some,
19035    /**
19036     * When we're in this state, this COption_EventZ contains nothing
19037     */
19038    LDKCOption_EventZ_None,
19039    /**
19040     * Must be last for serialization purposes
19041     */
19042    LDKCOption_EventZ_Sentinel,
19043 } LDKCOption_EventZ_Tag;
19044
19045 typedef struct LDKCOption_EventZ {
19046    LDKCOption_EventZ_Tag tag;
19047    union {
19048       struct {
19049          struct LDKEvent some;
19050       };
19051    };
19052 } LDKCOption_EventZ;
19053
19054 /**
19055  * The contents of CResult_COption_EventZDecodeErrorZ
19056  */
19057 typedef union LDKCResult_COption_EventZDecodeErrorZPtr {
19058    /**
19059     * A pointer to the contents in the success state.
19060     * Reading from this pointer when `result_ok` is not set is undefined.
19061     */
19062    struct LDKCOption_EventZ *result;
19063    /**
19064     * A pointer to the contents in the error state.
19065     * Reading from this pointer when `result_ok` is set is undefined.
19066     */
19067    struct LDKDecodeError *err;
19068 } LDKCResult_COption_EventZDecodeErrorZPtr;
19069
19070 /**
19071  * A CResult_COption_EventZDecodeErrorZ represents the result of a fallible operation,
19072  * containing a crate::c_types::derived::COption_EventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
19073  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
19074  */
19075 typedef struct LDKCResult_COption_EventZDecodeErrorZ {
19076    /**
19077     * The contents of this CResult_COption_EventZDecodeErrorZ, accessible via either
19078     * `err` or `result` depending on the state of `result_ok`.
19079     */
19080    union LDKCResult_COption_EventZDecodeErrorZPtr contents;
19081    /**
19082     * Whether this CResult_COption_EventZDecodeErrorZ represents a success state.
19083     */
19084    bool result_ok;
19085 } LDKCResult_COption_EventZDecodeErrorZ;
19086
19087 /**
19088  * Sub-errors which don't have specific information in them use this type.
19089  */
19090 typedef struct LDKError {
19091    /**
19092     * Zero-Sized_types aren't consistent across Rust/C/C++, so we add some size here
19093     */
19094    uint8_t _dummy;
19095 } LDKError;
19096
19097 /**
19098  * Errors that indicate what is wrong with the invoice. They have some granularity for debug
19099  * reasons, but should generally result in an \"invalid BOLT11 invoice\" message for the user.
19100  */
19101 typedef enum LDKBolt11ParseError_Tag {
19102    LDKBolt11ParseError_Bech32Error,
19103    LDKBolt11ParseError_ParseAmountError,
19104    LDKBolt11ParseError_MalformedSignature,
19105    LDKBolt11ParseError_BadPrefix,
19106    LDKBolt11ParseError_UnknownCurrency,
19107    LDKBolt11ParseError_UnknownSiPrefix,
19108    LDKBolt11ParseError_MalformedHRP,
19109    LDKBolt11ParseError_TooShortDataPart,
19110    LDKBolt11ParseError_UnexpectedEndOfTaggedFields,
19111    LDKBolt11ParseError_DescriptionDecodeError,
19112    LDKBolt11ParseError_PaddingError,
19113    LDKBolt11ParseError_IntegerOverflowError,
19114    LDKBolt11ParseError_InvalidSegWitProgramLength,
19115    LDKBolt11ParseError_InvalidPubKeyHashLength,
19116    LDKBolt11ParseError_InvalidScriptHashLength,
19117    LDKBolt11ParseError_InvalidRecoveryId,
19118    LDKBolt11ParseError_InvalidSliceLength,
19119    /**
19120     * Not an error, but used internally to signal that a part of the invoice should be ignored
19121     * according to BOLT11
19122     */
19123    LDKBolt11ParseError_Skip,
19124    /**
19125     * Must be last for serialization purposes
19126     */
19127    LDKBolt11ParseError_Sentinel,
19128 } LDKBolt11ParseError_Tag;
19129
19130 typedef struct MUST_USE_STRUCT LDKBolt11ParseError {
19131    LDKBolt11ParseError_Tag tag;
19132    union {
19133       struct {
19134          struct LDKBech32Error bech32_error;
19135       };
19136       struct {
19137          struct LDKError parse_amount_error;
19138       };
19139       struct {
19140          enum LDKSecp256k1Error malformed_signature;
19141       };
19142       struct {
19143          struct LDKError description_decode_error;
19144       };
19145       struct {
19146          struct LDKStr invalid_slice_length;
19147       };
19148    };
19149 } LDKBolt11ParseError;
19150
19151 /**
19152  * The contents of CResult_SiPrefixBolt11ParseErrorZ
19153  */
19154 typedef union LDKCResult_SiPrefixBolt11ParseErrorZPtr {
19155    /**
19156     * A pointer to the contents in the success state.
19157     * Reading from this pointer when `result_ok` is not set is undefined.
19158     */
19159    enum LDKSiPrefix *result;
19160    /**
19161     * A pointer to the contents in the error state.
19162     * Reading from this pointer when `result_ok` is set is undefined.
19163     */
19164    struct LDKBolt11ParseError *err;
19165 } LDKCResult_SiPrefixBolt11ParseErrorZPtr;
19166
19167 /**
19168  * A CResult_SiPrefixBolt11ParseErrorZ represents the result of a fallible operation,
19169  * containing a crate::lightning_invoice::SiPrefix on success and a crate::lightning_invoice::Bolt11ParseError on failure.
19170  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
19171  */
19172 typedef struct LDKCResult_SiPrefixBolt11ParseErrorZ {
19173    /**
19174     * The contents of this CResult_SiPrefixBolt11ParseErrorZ, accessible via either
19175     * `err` or `result` depending on the state of `result_ok`.
19176     */
19177    union LDKCResult_SiPrefixBolt11ParseErrorZPtr contents;
19178    /**
19179     * Whether this CResult_SiPrefixBolt11ParseErrorZ represents a success state.
19180     */
19181    bool result_ok;
19182 } LDKCResult_SiPrefixBolt11ParseErrorZ;
19183
19184 /**
19185  * Indicates that something went wrong while parsing or validating the invoice. Parsing errors
19186  * should be mostly seen as opaque and are only there for debugging reasons. Semantic errors
19187  * like wrong signatures, missing fields etc. could mean that someone tampered with the invoice.
19188  */
19189 typedef enum LDKParseOrSemanticError_Tag {
19190    /**
19191     * The invoice couldn't be decoded
19192     */
19193    LDKParseOrSemanticError_ParseError,
19194    /**
19195     * The invoice could be decoded but violates the BOLT11 standard
19196     */
19197    LDKParseOrSemanticError_SemanticError,
19198    /**
19199     * Must be last for serialization purposes
19200     */
19201    LDKParseOrSemanticError_Sentinel,
19202 } LDKParseOrSemanticError_Tag;
19203
19204 typedef struct MUST_USE_STRUCT LDKParseOrSemanticError {
19205    LDKParseOrSemanticError_Tag tag;
19206    union {
19207       struct {
19208          struct LDKBolt11ParseError parse_error;
19209       };
19210       struct {
19211          enum LDKBolt11SemanticError semantic_error;
19212       };
19213    };
19214 } LDKParseOrSemanticError;
19215
19216 /**
19217  * The contents of CResult_Bolt11InvoiceParseOrSemanticErrorZ
19218  */
19219 typedef union LDKCResult_Bolt11InvoiceParseOrSemanticErrorZPtr {
19220    /**
19221     * A pointer to the contents in the success state.
19222     * Reading from this pointer when `result_ok` is not set is undefined.
19223     */
19224    struct LDKBolt11Invoice *result;
19225    /**
19226     * A pointer to the contents in the error state.
19227     * Reading from this pointer when `result_ok` is set is undefined.
19228     */
19229    struct LDKParseOrSemanticError *err;
19230 } LDKCResult_Bolt11InvoiceParseOrSemanticErrorZPtr;
19231
19232 /**
19233  * A CResult_Bolt11InvoiceParseOrSemanticErrorZ represents the result of a fallible operation,
19234  * containing a crate::lightning_invoice::Bolt11Invoice on success and a crate::lightning_invoice::ParseOrSemanticError on failure.
19235  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
19236  */
19237 typedef struct LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ {
19238    /**
19239     * The contents of this CResult_Bolt11InvoiceParseOrSemanticErrorZ, accessible via either
19240     * `err` or `result` depending on the state of `result_ok`.
19241     */
19242    union LDKCResult_Bolt11InvoiceParseOrSemanticErrorZPtr contents;
19243    /**
19244     * Whether this CResult_Bolt11InvoiceParseOrSemanticErrorZ represents a success state.
19245     */
19246    bool result_ok;
19247 } LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ;
19248
19249
19250
19251 /**
19252  * Represents a signed [`RawBolt11Invoice`] with cached hash. The signature is not checked and may be
19253  * invalid.
19254  *
19255  * # Invariants
19256  * The hash has to be either from the deserialized invoice or from the serialized [`RawBolt11Invoice`].
19257  */
19258 typedef struct MUST_USE_STRUCT LDKSignedRawBolt11Invoice {
19259    /**
19260     * A pointer to the opaque Rust object.
19261     * Nearly everywhere, inner must be non-null, however in places where
19262     * the Rust equivalent takes an Option, it may be set to null to indicate None.
19263     */
19264    LDKnativeSignedRawBolt11Invoice *inner;
19265    /**
19266     * Indicates that this is the only struct which contains the same pointer.
19267     * Rust functions which take ownership of an object provided via an argument require
19268     * this to be true and invalidate the object pointed to by inner.
19269     */
19270    bool is_owned;
19271 } LDKSignedRawBolt11Invoice;
19272
19273 /**
19274  * The contents of CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ
19275  */
19276 typedef union LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr {
19277    /**
19278     * A pointer to the contents in the success state.
19279     * Reading from this pointer when `result_ok` is not set is undefined.
19280     */
19281    struct LDKSignedRawBolt11Invoice *result;
19282    /**
19283     * A pointer to the contents in the error state.
19284     * Reading from this pointer when `result_ok` is set is undefined.
19285     */
19286    struct LDKBolt11ParseError *err;
19287 } LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr;
19288
19289 /**
19290  * A CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ represents the result of a fallible operation,
19291  * containing a crate::lightning_invoice::SignedRawBolt11Invoice on success and a crate::lightning_invoice::Bolt11ParseError on failure.
19292  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
19293  */
19294 typedef struct LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
19295    /**
19296     * The contents of this CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ, accessible via either
19297     * `err` or `result` depending on the state of `result_ok`.
19298     */
19299    union LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr contents;
19300    /**
19301     * Whether this CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ represents a success state.
19302     */
19303    bool result_ok;
19304 } LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ;
19305
19306
19307
19308 /**
19309  * Represents an syntactically correct [`Bolt11Invoice`] for a payment on the lightning network,
19310  * but without the signature information.
19311  * Decoding and encoding should not lead to information loss but may lead to different hashes.
19312  *
19313  * For methods without docs see the corresponding methods in [`Bolt11Invoice`].
19314  */
19315 typedef struct MUST_USE_STRUCT LDKRawBolt11Invoice {
19316    /**
19317     * A pointer to the opaque Rust object.
19318     * Nearly everywhere, inner must be non-null, however in places where
19319     * the Rust equivalent takes an Option, it may be set to null to indicate None.
19320     */
19321    LDKnativeRawBolt11Invoice *inner;
19322    /**
19323     * Indicates that this is the only struct which contains the same pointer.
19324     * Rust functions which take ownership of an object provided via an argument require
19325     * this to be true and invalidate the object pointed to by inner.
19326     */
19327    bool is_owned;
19328 } LDKRawBolt11Invoice;
19329
19330
19331
19332 /**
19333  * Recoverable signature
19334  */
19335 typedef struct MUST_USE_STRUCT LDKBolt11InvoiceSignature {
19336    /**
19337     * A pointer to the opaque Rust object.
19338     * Nearly everywhere, inner must be non-null, however in places where
19339     * the Rust equivalent takes an Option, it may be set to null to indicate None.
19340     */
19341    LDKnativeBolt11InvoiceSignature *inner;
19342    /**
19343     * Indicates that this is the only struct which contains the same pointer.
19344     * Rust functions which take ownership of an object provided via an argument require
19345     * this to be true and invalidate the object pointed to by inner.
19346     */
19347    bool is_owned;
19348 } LDKBolt11InvoiceSignature;
19349
19350 /**
19351  * A tuple of 3 elements. See the individual fields for the types contained.
19352  */
19353 typedef struct LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ {
19354    /**
19355     * The element at position 0
19356     */
19357    struct LDKRawBolt11Invoice a;
19358    /**
19359     * The element at position 1
19360     */
19361    struct LDKThirtyTwoBytes b;
19362    /**
19363     * The element at position 2
19364     */
19365    struct LDKBolt11InvoiceSignature c;
19366 } LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ;
19367
19368
19369
19370 /**
19371  * Payee public key
19372  */
19373 typedef struct MUST_USE_STRUCT LDKPayeePubKey {
19374    /**
19375     * A pointer to the opaque Rust object.
19376     * Nearly everywhere, inner must be non-null, however in places where
19377     * the Rust equivalent takes an Option, it may be set to null to indicate None.
19378     */
19379    LDKnativePayeePubKey *inner;
19380    /**
19381     * Indicates that this is the only struct which contains the same pointer.
19382     * Rust functions which take ownership of an object provided via an argument require
19383     * this to be true and invalidate the object pointed to by inner.
19384     */
19385    bool is_owned;
19386 } LDKPayeePubKey;
19387
19388 /**
19389  * The contents of CResult_PayeePubKeySecp256k1ErrorZ
19390  */
19391 typedef union LDKCResult_PayeePubKeySecp256k1ErrorZPtr {
19392    /**
19393     * A pointer to the contents in the success state.
19394     * Reading from this pointer when `result_ok` is not set is undefined.
19395     */
19396    struct LDKPayeePubKey *result;
19397    /**
19398     * A pointer to the contents in the error state.
19399     * Reading from this pointer when `result_ok` is set is undefined.
19400     */
19401    enum LDKSecp256k1Error *err;
19402 } LDKCResult_PayeePubKeySecp256k1ErrorZPtr;
19403
19404 /**
19405  * A CResult_PayeePubKeySecp256k1ErrorZ represents the result of a fallible operation,
19406  * containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
19407  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
19408  */
19409 typedef struct LDKCResult_PayeePubKeySecp256k1ErrorZ {
19410    /**
19411     * The contents of this CResult_PayeePubKeySecp256k1ErrorZ, accessible via either
19412     * `err` or `result` depending on the state of `result_ok`.
19413     */
19414    union LDKCResult_PayeePubKeySecp256k1ErrorZPtr contents;
19415    /**
19416     * Whether this CResult_PayeePubKeySecp256k1ErrorZ represents a success state.
19417     */
19418    bool result_ok;
19419 } LDKCResult_PayeePubKeySecp256k1ErrorZ;
19420
19421
19422
19423 /**
19424  * Private routing information
19425  *
19426  * # Invariants
19427  * The encoded route has to be <1024 5bit characters long (<=639 bytes or <=12 hops)
19428  *
19429  */
19430 typedef struct MUST_USE_STRUCT LDKPrivateRoute {
19431    /**
19432     * A pointer to the opaque Rust object.
19433     * Nearly everywhere, inner must be non-null, however in places where
19434     * the Rust equivalent takes an Option, it may be set to null to indicate None.
19435     */
19436    LDKnativePrivateRoute *inner;
19437    /**
19438     * Indicates that this is the only struct which contains the same pointer.
19439     * Rust functions which take ownership of an object provided via an argument require
19440     * this to be true and invalidate the object pointed to by inner.
19441     */
19442    bool is_owned;
19443 } LDKPrivateRoute;
19444
19445 /**
19446  * A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
19447  * This corresponds to std::vector in C++
19448  */
19449 typedef struct LDKCVec_PrivateRouteZ {
19450    /**
19451     * The elements in the array.
19452     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
19453     */
19454    struct LDKPrivateRoute *data;
19455    /**
19456     * The number of elements pointed to by `data`.
19457     */
19458    uintptr_t datalen;
19459 } LDKCVec_PrivateRouteZ;
19460
19461
19462
19463 /**
19464  * A timestamp that refers to a date after 1 January 1970.
19465  *
19466  * # Invariants
19467  *
19468  * The Unix timestamp representing the stored time has to be positive and no greater than
19469  * [`MAX_TIMESTAMP`].
19470  */
19471 typedef struct MUST_USE_STRUCT LDKPositiveTimestamp {
19472    /**
19473     * A pointer to the opaque Rust object.
19474     * Nearly everywhere, inner must be non-null, however in places where
19475     * the Rust equivalent takes an Option, it may be set to null to indicate None.
19476     */
19477    LDKnativePositiveTimestamp *inner;
19478    /**
19479     * Indicates that this is the only struct which contains the same pointer.
19480     * Rust functions which take ownership of an object provided via an argument require
19481     * this to be true and invalidate the object pointed to by inner.
19482     */
19483    bool is_owned;
19484 } LDKPositiveTimestamp;
19485
19486 /**
19487  * The contents of CResult_PositiveTimestampCreationErrorZ
19488  */
19489 typedef union LDKCResult_PositiveTimestampCreationErrorZPtr {
19490    /**
19491     * A pointer to the contents in the success state.
19492     * Reading from this pointer when `result_ok` is not set is undefined.
19493     */
19494    struct LDKPositiveTimestamp *result;
19495    /**
19496     * A pointer to the contents in the error state.
19497     * Reading from this pointer when `result_ok` is set is undefined.
19498     */
19499    enum LDKCreationError *err;
19500 } LDKCResult_PositiveTimestampCreationErrorZPtr;
19501
19502 /**
19503  * A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
19504  * containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
19505  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
19506  */
19507 typedef struct LDKCResult_PositiveTimestampCreationErrorZ {
19508    /**
19509     * The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
19510     * `err` or `result` depending on the state of `result_ok`.
19511     */
19512    union LDKCResult_PositiveTimestampCreationErrorZPtr contents;
19513    /**
19514     * Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
19515     */
19516    bool result_ok;
19517 } LDKCResult_PositiveTimestampCreationErrorZ;
19518
19519 /**
19520  * The contents of CResult_NoneBolt11SemanticErrorZ
19521  */
19522 typedef union LDKCResult_NoneBolt11SemanticErrorZPtr {
19523    /**
19524     * Note that this value is always NULL, as there are no contents in the OK variant
19525     */
19526    void *result;
19527    /**
19528     * A pointer to the contents in the error state.
19529     * Reading from this pointer when `result_ok` is set is undefined.
19530     */
19531    enum LDKBolt11SemanticError *err;
19532 } LDKCResult_NoneBolt11SemanticErrorZPtr;
19533
19534 /**
19535  * A CResult_NoneBolt11SemanticErrorZ represents the result of a fallible operation,
19536  * containing a () on success and a crate::lightning_invoice::Bolt11SemanticError on failure.
19537  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
19538  */
19539 typedef struct LDKCResult_NoneBolt11SemanticErrorZ {
19540    /**
19541     * The contents of this CResult_NoneBolt11SemanticErrorZ, accessible via either
19542     * `err` or `result` depending on the state of `result_ok`.
19543     */
19544    union LDKCResult_NoneBolt11SemanticErrorZPtr contents;
19545    /**
19546     * Whether this CResult_NoneBolt11SemanticErrorZ represents a success state.
19547     */
19548    bool result_ok;
19549 } LDKCResult_NoneBolt11SemanticErrorZ;
19550
19551 /**
19552  * The contents of CResult_Bolt11InvoiceBolt11SemanticErrorZ
19553  */
19554 typedef union LDKCResult_Bolt11InvoiceBolt11SemanticErrorZPtr {
19555    /**
19556     * A pointer to the contents in the success state.
19557     * Reading from this pointer when `result_ok` is not set is undefined.
19558     */
19559    struct LDKBolt11Invoice *result;
19560    /**
19561     * A pointer to the contents in the error state.
19562     * Reading from this pointer when `result_ok` is set is undefined.
19563     */
19564    enum LDKBolt11SemanticError *err;
19565 } LDKCResult_Bolt11InvoiceBolt11SemanticErrorZPtr;
19566
19567 /**
19568  * A CResult_Bolt11InvoiceBolt11SemanticErrorZ represents the result of a fallible operation,
19569  * containing a crate::lightning_invoice::Bolt11Invoice on success and a crate::lightning_invoice::Bolt11SemanticError on failure.
19570  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
19571  */
19572 typedef struct LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ {
19573    /**
19574     * The contents of this CResult_Bolt11InvoiceBolt11SemanticErrorZ, accessible via either
19575     * `err` or `result` depending on the state of `result_ok`.
19576     */
19577    union LDKCResult_Bolt11InvoiceBolt11SemanticErrorZPtr contents;
19578    /**
19579     * Whether this CResult_Bolt11InvoiceBolt11SemanticErrorZ represents a success state.
19580     */
19581    bool result_ok;
19582 } LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ;
19583
19584
19585
19586 /**
19587  * Description string
19588  *
19589  * # Invariants
19590  * The description can be at most 639 __bytes__ long
19591  */
19592 typedef struct MUST_USE_STRUCT LDKDescription {
19593    /**
19594     * A pointer to the opaque Rust object.
19595     * Nearly everywhere, inner must be non-null, however in places where
19596     * the Rust equivalent takes an Option, it may be set to null to indicate None.
19597     */
19598    LDKnativeDescription *inner;
19599    /**
19600     * Indicates that this is the only struct which contains the same pointer.
19601     * Rust functions which take ownership of an object provided via an argument require
19602     * this to be true and invalidate the object pointed to by inner.
19603     */
19604    bool is_owned;
19605 } LDKDescription;
19606
19607 /**
19608  * The contents of CResult_DescriptionCreationErrorZ
19609  */
19610 typedef union LDKCResult_DescriptionCreationErrorZPtr {
19611    /**
19612     * A pointer to the contents in the success state.
19613     * Reading from this pointer when `result_ok` is not set is undefined.
19614     */
19615    struct LDKDescription *result;
19616    /**
19617     * A pointer to the contents in the error state.
19618     * Reading from this pointer when `result_ok` is set is undefined.
19619     */
19620    enum LDKCreationError *err;
19621 } LDKCResult_DescriptionCreationErrorZPtr;
19622
19623 /**
19624  * A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
19625  * containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
19626  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
19627  */
19628 typedef struct LDKCResult_DescriptionCreationErrorZ {
19629    /**
19630     * The contents of this CResult_DescriptionCreationErrorZ, accessible via either
19631     * `err` or `result` depending on the state of `result_ok`.
19632     */
19633    union LDKCResult_DescriptionCreationErrorZPtr contents;
19634    /**
19635     * Whether this CResult_DescriptionCreationErrorZ represents a success state.
19636     */
19637    bool result_ok;
19638 } LDKCResult_DescriptionCreationErrorZ;
19639
19640 /**
19641  * The contents of CResult_PrivateRouteCreationErrorZ
19642  */
19643 typedef union LDKCResult_PrivateRouteCreationErrorZPtr {
19644    /**
19645     * A pointer to the contents in the success state.
19646     * Reading from this pointer when `result_ok` is not set is undefined.
19647     */
19648    struct LDKPrivateRoute *result;
19649    /**
19650     * A pointer to the contents in the error state.
19651     * Reading from this pointer when `result_ok` is set is undefined.
19652     */
19653    enum LDKCreationError *err;
19654 } LDKCResult_PrivateRouteCreationErrorZPtr;
19655
19656 /**
19657  * A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
19658  * containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
19659  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
19660  */
19661 typedef struct LDKCResult_PrivateRouteCreationErrorZ {
19662    /**
19663     * The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
19664     * `err` or `result` depending on the state of `result_ok`.
19665     */
19666    union LDKCResult_PrivateRouteCreationErrorZPtr contents;
19667    /**
19668     * Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
19669     */
19670    bool result_ok;
19671 } LDKCResult_PrivateRouteCreationErrorZ;
19672
19673 /**
19674  * The contents of CResult_OutPointDecodeErrorZ
19675  */
19676 typedef union LDKCResult_OutPointDecodeErrorZPtr {
19677    /**
19678     * A pointer to the contents in the success state.
19679     * Reading from this pointer when `result_ok` is not set is undefined.
19680     */
19681    struct LDKOutPoint *result;
19682    /**
19683     * A pointer to the contents in the error state.
19684     * Reading from this pointer when `result_ok` is set is undefined.
19685     */
19686    struct LDKDecodeError *err;
19687 } LDKCResult_OutPointDecodeErrorZPtr;
19688
19689 /**
19690  * A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
19691  * containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
19692  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
19693  */
19694 typedef struct LDKCResult_OutPointDecodeErrorZ {
19695    /**
19696     * The contents of this CResult_OutPointDecodeErrorZ, accessible via either
19697     * `err` or `result` depending on the state of `result_ok`.
19698     */
19699    union LDKCResult_OutPointDecodeErrorZPtr contents;
19700    /**
19701     * Whether this CResult_OutPointDecodeErrorZ represents a success state.
19702     */
19703    bool result_ok;
19704 } LDKCResult_OutPointDecodeErrorZ;
19705
19706
19707
19708 /**
19709  * Lightning TLV uses a custom variable-length integer called `BigSize`. It is similar to Bitcoin's
19710  * variable-length integers except that it is serialized in big-endian instead of little-endian.
19711  *
19712  * Like Bitcoin's variable-length integer, it exhibits ambiguity in that certain values can be
19713  * encoded in several different ways, which we must check for at deserialization-time. Thus, if
19714  * you're looking for an example of a variable-length integer to use for your own project, move
19715  * along, this is a rather poor design.
19716  */
19717 typedef struct MUST_USE_STRUCT LDKBigSize {
19718    /**
19719     * A pointer to the opaque Rust object.
19720     * Nearly everywhere, inner must be non-null, however in places where
19721     * the Rust equivalent takes an Option, it may be set to null to indicate None.
19722     */
19723    LDKnativeBigSize *inner;
19724    /**
19725     * Indicates that this is the only struct which contains the same pointer.
19726     * Rust functions which take ownership of an object provided via an argument require
19727     * this to be true and invalidate the object pointed to by inner.
19728     */
19729    bool is_owned;
19730 } LDKBigSize;
19731
19732 /**
19733  * The contents of CResult_BigSizeDecodeErrorZ
19734  */
19735 typedef union LDKCResult_BigSizeDecodeErrorZPtr {
19736    /**
19737     * A pointer to the contents in the success state.
19738     * Reading from this pointer when `result_ok` is not set is undefined.
19739     */
19740    struct LDKBigSize *result;
19741    /**
19742     * A pointer to the contents in the error state.
19743     * Reading from this pointer when `result_ok` is set is undefined.
19744     */
19745    struct LDKDecodeError *err;
19746 } LDKCResult_BigSizeDecodeErrorZPtr;
19747
19748 /**
19749  * A CResult_BigSizeDecodeErrorZ represents the result of a fallible operation,
19750  * containing a crate::lightning::util::ser::BigSize on success and a crate::lightning::ln::msgs::DecodeError on failure.
19751  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
19752  */
19753 typedef struct LDKCResult_BigSizeDecodeErrorZ {
19754    /**
19755     * The contents of this CResult_BigSizeDecodeErrorZ, accessible via either
19756     * `err` or `result` depending on the state of `result_ok`.
19757     */
19758    union LDKCResult_BigSizeDecodeErrorZPtr contents;
19759    /**
19760     * Whether this CResult_BigSizeDecodeErrorZ represents a success state.
19761     */
19762    bool result_ok;
19763 } LDKCResult_BigSizeDecodeErrorZ;
19764
19765 /**
19766  * The contents of CResult_HostnameDecodeErrorZ
19767  */
19768 typedef union LDKCResult_HostnameDecodeErrorZPtr {
19769    /**
19770     * A pointer to the contents in the success state.
19771     * Reading from this pointer when `result_ok` is not set is undefined.
19772     */
19773    struct LDKHostname *result;
19774    /**
19775     * A pointer to the contents in the error state.
19776     * Reading from this pointer when `result_ok` is set is undefined.
19777     */
19778    struct LDKDecodeError *err;
19779 } LDKCResult_HostnameDecodeErrorZPtr;
19780
19781 /**
19782  * A CResult_HostnameDecodeErrorZ represents the result of a fallible operation,
19783  * containing a crate::lightning::util::ser::Hostname on success and a crate::lightning::ln::msgs::DecodeError on failure.
19784  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
19785  */
19786 typedef struct LDKCResult_HostnameDecodeErrorZ {
19787    /**
19788     * The contents of this CResult_HostnameDecodeErrorZ, accessible via either
19789     * `err` or `result` depending on the state of `result_ok`.
19790     */
19791    union LDKCResult_HostnameDecodeErrorZPtr contents;
19792    /**
19793     * Whether this CResult_HostnameDecodeErrorZ represents a success state.
19794     */
19795    bool result_ok;
19796 } LDKCResult_HostnameDecodeErrorZ;
19797
19798
19799
19800 /**
19801  * A wrapper for a `Transaction` which can only be constructed with [`TransactionU16LenLimited::new`]
19802  * if the `Transaction`'s consensus-serialized length is <= u16::MAX.
19803  *
19804  * Use [`TransactionU16LenLimited::into_transaction`] to convert into the contained `Transaction`.
19805  */
19806 typedef struct MUST_USE_STRUCT LDKTransactionU16LenLimited {
19807    /**
19808     * A pointer to the opaque Rust object.
19809     * Nearly everywhere, inner must be non-null, however in places where
19810     * the Rust equivalent takes an Option, it may be set to null to indicate None.
19811     */
19812    LDKnativeTransactionU16LenLimited *inner;
19813    /**
19814     * Indicates that this is the only struct which contains the same pointer.
19815     * Rust functions which take ownership of an object provided via an argument require
19816     * this to be true and invalidate the object pointed to by inner.
19817     */
19818    bool is_owned;
19819 } LDKTransactionU16LenLimited;
19820
19821 /**
19822  * The contents of CResult_TransactionU16LenLimitedNoneZ
19823  */
19824 typedef union LDKCResult_TransactionU16LenLimitedNoneZPtr {
19825    /**
19826     * A pointer to the contents in the success state.
19827     * Reading from this pointer when `result_ok` is not set is undefined.
19828     */
19829    struct LDKTransactionU16LenLimited *result;
19830    /**
19831     * Note that this value is always NULL, as there are no contents in the Err variant
19832     */
19833    void *err;
19834 } LDKCResult_TransactionU16LenLimitedNoneZPtr;
19835
19836 /**
19837  * A CResult_TransactionU16LenLimitedNoneZ represents the result of a fallible operation,
19838  * containing a crate::lightning::util::ser::TransactionU16LenLimited on success and a () on failure.
19839  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
19840  */
19841 typedef struct LDKCResult_TransactionU16LenLimitedNoneZ {
19842    /**
19843     * The contents of this CResult_TransactionU16LenLimitedNoneZ, accessible via either
19844     * `err` or `result` depending on the state of `result_ok`.
19845     */
19846    union LDKCResult_TransactionU16LenLimitedNoneZPtr contents;
19847    /**
19848     * Whether this CResult_TransactionU16LenLimitedNoneZ represents a success state.
19849     */
19850    bool result_ok;
19851 } LDKCResult_TransactionU16LenLimitedNoneZ;
19852
19853 /**
19854  * The contents of CResult_TransactionU16LenLimitedDecodeErrorZ
19855  */
19856 typedef union LDKCResult_TransactionU16LenLimitedDecodeErrorZPtr {
19857    /**
19858     * A pointer to the contents in the success state.
19859     * Reading from this pointer when `result_ok` is not set is undefined.
19860     */
19861    struct LDKTransactionU16LenLimited *result;
19862    /**
19863     * A pointer to the contents in the error state.
19864     * Reading from this pointer when `result_ok` is set is undefined.
19865     */
19866    struct LDKDecodeError *err;
19867 } LDKCResult_TransactionU16LenLimitedDecodeErrorZPtr;
19868
19869 /**
19870  * A CResult_TransactionU16LenLimitedDecodeErrorZ represents the result of a fallible operation,
19871  * containing a crate::lightning::util::ser::TransactionU16LenLimited on success and a crate::lightning::ln::msgs::DecodeError on failure.
19872  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
19873  */
19874 typedef struct LDKCResult_TransactionU16LenLimitedDecodeErrorZ {
19875    /**
19876     * The contents of this CResult_TransactionU16LenLimitedDecodeErrorZ, accessible via either
19877     * `err` or `result` depending on the state of `result_ok`.
19878     */
19879    union LDKCResult_TransactionU16LenLimitedDecodeErrorZPtr contents;
19880    /**
19881     * Whether this CResult_TransactionU16LenLimitedDecodeErrorZ represents a success state.
19882     */
19883    bool result_ok;
19884 } LDKCResult_TransactionU16LenLimitedDecodeErrorZ;
19885
19886 /**
19887  * The contents of CResult_UntrustedStringDecodeErrorZ
19888  */
19889 typedef union LDKCResult_UntrustedStringDecodeErrorZPtr {
19890    /**
19891     * A pointer to the contents in the success state.
19892     * Reading from this pointer when `result_ok` is not set is undefined.
19893     */
19894    struct LDKUntrustedString *result;
19895    /**
19896     * A pointer to the contents in the error state.
19897     * Reading from this pointer when `result_ok` is set is undefined.
19898     */
19899    struct LDKDecodeError *err;
19900 } LDKCResult_UntrustedStringDecodeErrorZPtr;
19901
19902 /**
19903  * A CResult_UntrustedStringDecodeErrorZ represents the result of a fallible operation,
19904  * containing a crate::lightning::util::string::UntrustedString on success and a crate::lightning::ln::msgs::DecodeError on failure.
19905  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
19906  */
19907 typedef struct LDKCResult_UntrustedStringDecodeErrorZ {
19908    /**
19909     * The contents of this CResult_UntrustedStringDecodeErrorZ, accessible via either
19910     * `err` or `result` depending on the state of `result_ok`.
19911     */
19912    union LDKCResult_UntrustedStringDecodeErrorZPtr contents;
19913    /**
19914     * Whether this CResult_UntrustedStringDecodeErrorZ represents a success state.
19915     */
19916    bool result_ok;
19917 } LDKCResult_UntrustedStringDecodeErrorZ;
19918
19919 /**
19920  * The contents of CResult_ChannelIdDecodeErrorZ
19921  */
19922 typedef union LDKCResult_ChannelIdDecodeErrorZPtr {
19923    /**
19924     * A pointer to the contents in the success state.
19925     * Reading from this pointer when `result_ok` is not set is undefined.
19926     */
19927    struct LDKChannelId *result;
19928    /**
19929     * A pointer to the contents in the error state.
19930     * Reading from this pointer when `result_ok` is set is undefined.
19931     */
19932    struct LDKDecodeError *err;
19933 } LDKCResult_ChannelIdDecodeErrorZPtr;
19934
19935 /**
19936  * A CResult_ChannelIdDecodeErrorZ represents the result of a fallible operation,
19937  * containing a crate::lightning::ln::types::ChannelId on success and a crate::lightning::ln::msgs::DecodeError on failure.
19938  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
19939  */
19940 typedef struct LDKCResult_ChannelIdDecodeErrorZ {
19941    /**
19942     * The contents of this CResult_ChannelIdDecodeErrorZ, accessible via either
19943     * `err` or `result` depending on the state of `result_ok`.
19944     */
19945    union LDKCResult_ChannelIdDecodeErrorZPtr contents;
19946    /**
19947     * Whether this CResult_ChannelIdDecodeErrorZ represents a success state.
19948     */
19949    bool result_ok;
19950 } LDKCResult_ChannelIdDecodeErrorZ;
19951
19952 /**
19953  * A tuple of 2 elements. See the individual fields for the types contained.
19954  */
19955 typedef struct LDKC2Tuple__u832u16Z {
19956    /**
19957     * The element at position 0
19958     */
19959    struct LDKThirtyTwoBytes a;
19960    /**
19961     * The element at position 1
19962     */
19963    uint16_t b;
19964 } LDKC2Tuple__u832u16Z;
19965
19966
19967
19968 /**
19969  * Parameters for relaying over a given [`BlindedHop`].
19970  *
19971  * [`BlindedHop`]: crate::blinded_path::BlindedHop
19972  */
19973 typedef struct MUST_USE_STRUCT LDKPaymentRelay {
19974    /**
19975     * A pointer to the opaque Rust object.
19976     * Nearly everywhere, inner must be non-null, however in places where
19977     * the Rust equivalent takes an Option, it may be set to null to indicate None.
19978     */
19979    LDKnativePaymentRelay *inner;
19980    /**
19981     * Indicates that this is the only struct which contains the same pointer.
19982     * Rust functions which take ownership of an object provided via an argument require
19983     * this to be true and invalidate the object pointed to by inner.
19984     */
19985    bool is_owned;
19986 } LDKPaymentRelay;
19987
19988 /**
19989  * The contents of CResult_PaymentRelayDecodeErrorZ
19990  */
19991 typedef union LDKCResult_PaymentRelayDecodeErrorZPtr {
19992    /**
19993     * A pointer to the contents in the success state.
19994     * Reading from this pointer when `result_ok` is not set is undefined.
19995     */
19996    struct LDKPaymentRelay *result;
19997    /**
19998     * A pointer to the contents in the error state.
19999     * Reading from this pointer when `result_ok` is set is undefined.
20000     */
20001    struct LDKDecodeError *err;
20002 } LDKCResult_PaymentRelayDecodeErrorZPtr;
20003
20004 /**
20005  * A CResult_PaymentRelayDecodeErrorZ represents the result of a fallible operation,
20006  * containing a crate::lightning::blinded_path::payment::PaymentRelay on success and a crate::lightning::ln::msgs::DecodeError on failure.
20007  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
20008  */
20009 typedef struct LDKCResult_PaymentRelayDecodeErrorZ {
20010    /**
20011     * The contents of this CResult_PaymentRelayDecodeErrorZ, accessible via either
20012     * `err` or `result` depending on the state of `result_ok`.
20013     */
20014    union LDKCResult_PaymentRelayDecodeErrorZPtr contents;
20015    /**
20016     * Whether this CResult_PaymentRelayDecodeErrorZ represents a success state.
20017     */
20018    bool result_ok;
20019 } LDKCResult_PaymentRelayDecodeErrorZ;
20020
20021
20022
20023 /**
20024  * Constraints for relaying over a given [`BlindedHop`].
20025  *
20026  * [`BlindedHop`]: crate::blinded_path::BlindedHop
20027  */
20028 typedef struct MUST_USE_STRUCT LDKPaymentConstraints {
20029    /**
20030     * A pointer to the opaque Rust object.
20031     * Nearly everywhere, inner must be non-null, however in places where
20032     * the Rust equivalent takes an Option, it may be set to null to indicate None.
20033     */
20034    LDKnativePaymentConstraints *inner;
20035    /**
20036     * Indicates that this is the only struct which contains the same pointer.
20037     * Rust functions which take ownership of an object provided via an argument require
20038     * this to be true and invalidate the object pointed to by inner.
20039     */
20040    bool is_owned;
20041 } LDKPaymentConstraints;
20042
20043 /**
20044  * The contents of CResult_PaymentConstraintsDecodeErrorZ
20045  */
20046 typedef union LDKCResult_PaymentConstraintsDecodeErrorZPtr {
20047    /**
20048     * A pointer to the contents in the success state.
20049     * Reading from this pointer when `result_ok` is not set is undefined.
20050     */
20051    struct LDKPaymentConstraints *result;
20052    /**
20053     * A pointer to the contents in the error state.
20054     * Reading from this pointer when `result_ok` is set is undefined.
20055     */
20056    struct LDKDecodeError *err;
20057 } LDKCResult_PaymentConstraintsDecodeErrorZPtr;
20058
20059 /**
20060  * A CResult_PaymentConstraintsDecodeErrorZ represents the result of a fallible operation,
20061  * containing a crate::lightning::blinded_path::payment::PaymentConstraints on success and a crate::lightning::ln::msgs::DecodeError on failure.
20062  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
20063  */
20064 typedef struct LDKCResult_PaymentConstraintsDecodeErrorZ {
20065    /**
20066     * The contents of this CResult_PaymentConstraintsDecodeErrorZ, accessible via either
20067     * `err` or `result` depending on the state of `result_ok`.
20068     */
20069    union LDKCResult_PaymentConstraintsDecodeErrorZPtr contents;
20070    /**
20071     * Whether this CResult_PaymentConstraintsDecodeErrorZ represents a success state.
20072     */
20073    bool result_ok;
20074 } LDKCResult_PaymentConstraintsDecodeErrorZ;
20075
20076 /**
20077  * The contents of CResult_PaymentContextDecodeErrorZ
20078  */
20079 typedef union LDKCResult_PaymentContextDecodeErrorZPtr {
20080    /**
20081     * A pointer to the contents in the success state.
20082     * Reading from this pointer when `result_ok` is not set is undefined.
20083     */
20084    struct LDKPaymentContext *result;
20085    /**
20086     * A pointer to the contents in the error state.
20087     * Reading from this pointer when `result_ok` is set is undefined.
20088     */
20089    struct LDKDecodeError *err;
20090 } LDKCResult_PaymentContextDecodeErrorZPtr;
20091
20092 /**
20093  * A CResult_PaymentContextDecodeErrorZ represents the result of a fallible operation,
20094  * containing a crate::lightning::blinded_path::payment::PaymentContext on success and a crate::lightning::ln::msgs::DecodeError on failure.
20095  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
20096  */
20097 typedef struct LDKCResult_PaymentContextDecodeErrorZ {
20098    /**
20099     * The contents of this CResult_PaymentContextDecodeErrorZ, accessible via either
20100     * `err` or `result` depending on the state of `result_ok`.
20101     */
20102    union LDKCResult_PaymentContextDecodeErrorZPtr contents;
20103    /**
20104     * Whether this CResult_PaymentContextDecodeErrorZ represents a success state.
20105     */
20106    bool result_ok;
20107 } LDKCResult_PaymentContextDecodeErrorZ;
20108
20109 /**
20110  * The contents of CResult_UnknownPaymentContextDecodeErrorZ
20111  */
20112 typedef union LDKCResult_UnknownPaymentContextDecodeErrorZPtr {
20113    /**
20114     * A pointer to the contents in the success state.
20115     * Reading from this pointer when `result_ok` is not set is undefined.
20116     */
20117    struct LDKUnknownPaymentContext *result;
20118    /**
20119     * A pointer to the contents in the error state.
20120     * Reading from this pointer when `result_ok` is set is undefined.
20121     */
20122    struct LDKDecodeError *err;
20123 } LDKCResult_UnknownPaymentContextDecodeErrorZPtr;
20124
20125 /**
20126  * A CResult_UnknownPaymentContextDecodeErrorZ represents the result of a fallible operation,
20127  * containing a crate::lightning::blinded_path::payment::UnknownPaymentContext on success and a crate::lightning::ln::msgs::DecodeError on failure.
20128  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
20129  */
20130 typedef struct LDKCResult_UnknownPaymentContextDecodeErrorZ {
20131    /**
20132     * The contents of this CResult_UnknownPaymentContextDecodeErrorZ, accessible via either
20133     * `err` or `result` depending on the state of `result_ok`.
20134     */
20135    union LDKCResult_UnknownPaymentContextDecodeErrorZPtr contents;
20136    /**
20137     * Whether this CResult_UnknownPaymentContextDecodeErrorZ represents a success state.
20138     */
20139    bool result_ok;
20140 } LDKCResult_UnknownPaymentContextDecodeErrorZ;
20141
20142 /**
20143  * The contents of CResult_Bolt12OfferContextDecodeErrorZ
20144  */
20145 typedef union LDKCResult_Bolt12OfferContextDecodeErrorZPtr {
20146    /**
20147     * A pointer to the contents in the success state.
20148     * Reading from this pointer when `result_ok` is not set is undefined.
20149     */
20150    struct LDKBolt12OfferContext *result;
20151    /**
20152     * A pointer to the contents in the error state.
20153     * Reading from this pointer when `result_ok` is set is undefined.
20154     */
20155    struct LDKDecodeError *err;
20156 } LDKCResult_Bolt12OfferContextDecodeErrorZPtr;
20157
20158 /**
20159  * A CResult_Bolt12OfferContextDecodeErrorZ represents the result of a fallible operation,
20160  * containing a crate::lightning::blinded_path::payment::Bolt12OfferContext on success and a crate::lightning::ln::msgs::DecodeError on failure.
20161  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
20162  */
20163 typedef struct LDKCResult_Bolt12OfferContextDecodeErrorZ {
20164    /**
20165     * The contents of this CResult_Bolt12OfferContextDecodeErrorZ, accessible via either
20166     * `err` or `result` depending on the state of `result_ok`.
20167     */
20168    union LDKCResult_Bolt12OfferContextDecodeErrorZPtr contents;
20169    /**
20170     * Whether this CResult_Bolt12OfferContextDecodeErrorZ represents a success state.
20171     */
20172    bool result_ok;
20173 } LDKCResult_Bolt12OfferContextDecodeErrorZ;
20174
20175 /**
20176  * The contents of CResult_Bolt12RefundContextDecodeErrorZ
20177  */
20178 typedef union LDKCResult_Bolt12RefundContextDecodeErrorZPtr {
20179    /**
20180     * A pointer to the contents in the success state.
20181     * Reading from this pointer when `result_ok` is not set is undefined.
20182     */
20183    struct LDKBolt12RefundContext *result;
20184    /**
20185     * A pointer to the contents in the error state.
20186     * Reading from this pointer when `result_ok` is set is undefined.
20187     */
20188    struct LDKDecodeError *err;
20189 } LDKCResult_Bolt12RefundContextDecodeErrorZPtr;
20190
20191 /**
20192  * A CResult_Bolt12RefundContextDecodeErrorZ represents the result of a fallible operation,
20193  * containing a crate::lightning::blinded_path::payment::Bolt12RefundContext on success and a crate::lightning::ln::msgs::DecodeError on failure.
20194  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
20195  */
20196 typedef struct LDKCResult_Bolt12RefundContextDecodeErrorZ {
20197    /**
20198     * The contents of this CResult_Bolt12RefundContextDecodeErrorZ, accessible via either
20199     * `err` or `result` depending on the state of `result_ok`.
20200     */
20201    union LDKCResult_Bolt12RefundContextDecodeErrorZPtr contents;
20202    /**
20203     * Whether this CResult_Bolt12RefundContextDecodeErrorZ represents a success state.
20204     */
20205    bool result_ok;
20206 } LDKCResult_Bolt12RefundContextDecodeErrorZ;
20207
20208 /**
20209  * The contents of CResult_StrSecp256k1ErrorZ
20210  */
20211 typedef union LDKCResult_StrSecp256k1ErrorZPtr {
20212    /**
20213     * A pointer to the contents in the success state.
20214     * Reading from this pointer when `result_ok` is not set is undefined.
20215     */
20216    struct LDKStr *result;
20217    /**
20218     * A pointer to the contents in the error state.
20219     * Reading from this pointer when `result_ok` is set is undefined.
20220     */
20221    enum LDKSecp256k1Error *err;
20222 } LDKCResult_StrSecp256k1ErrorZPtr;
20223
20224 /**
20225  * A CResult_StrSecp256k1ErrorZ represents the result of a fallible operation,
20226  * containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
20227  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
20228  */
20229 typedef struct LDKCResult_StrSecp256k1ErrorZ {
20230    /**
20231     * The contents of this CResult_StrSecp256k1ErrorZ, accessible via either
20232     * `err` or `result` depending on the state of `result_ok`.
20233     */
20234    union LDKCResult_StrSecp256k1ErrorZPtr contents;
20235    /**
20236     * Whether this CResult_StrSecp256k1ErrorZ represents a success state.
20237     */
20238    bool result_ok;
20239 } LDKCResult_StrSecp256k1ErrorZ;
20240
20241 /**
20242  * A tuple of 3 elements. See the individual fields for the types contained.
20243  */
20244 typedef struct LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ {
20245    /**
20246     * The element at position 0
20247     */
20248    struct LDKThirtyTwoBytes a;
20249    /**
20250     * The element at position 1
20251     */
20252    struct LDKRecipientOnionFields b;
20253    /**
20254     * The element at position 2
20255     */
20256    struct LDKRouteParameters c;
20257 } LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ;
20258
20259 /**
20260  * The contents of CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ
20261  */
20262 typedef union LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr {
20263    /**
20264     * A pointer to the contents in the success state.
20265     * Reading from this pointer when `result_ok` is not set is undefined.
20266     */
20267    struct LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ *result;
20268    /**
20269     * Note that this value is always NULL, as there are no contents in the Err variant
20270     */
20271    void *err;
20272 } LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr;
20273
20274 /**
20275  * A CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ represents the result of a fallible operation,
20276  * containing a crate::c_types::derived::C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ on success and a () on failure.
20277  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
20278  */
20279 typedef struct LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ {
20280    /**
20281     * The contents of this CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ, accessible via either
20282     * `err` or `result` depending on the state of `result_ok`.
20283     */
20284    union LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr contents;
20285    /**
20286     * Whether this CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ represents a success state.
20287     */
20288    bool result_ok;
20289 } LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ;
20290
20291 /**
20292  * A tuple of 3 elements. See the individual fields for the types contained.
20293  */
20294 typedef struct LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ {
20295    /**
20296     * The element at position 0
20297     */
20298    struct LDKPublicKey a;
20299    /**
20300     * The element at position 1
20301     */
20302    struct LDKOnionMessage b;
20303    /**
20304     * The element at position 2
20305     */
20306    struct LDKCOption_CVec_SocketAddressZZ c;
20307 } LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ;
20308
20309 /**
20310  * Errors that may occur when [sending an onion message].
20311  *
20312  * [sending an onion message]: OnionMessenger::send_onion_message
20313  */
20314 typedef enum LDKSendError_Tag {
20315    /**
20316     * Errored computing onion message packet keys.
20317     */
20318    LDKSendError_Secp256k1,
20319    /**
20320     * Because implementations such as Eclair will drop onion messages where the message packet
20321     * exceeds 32834 bytes, we refuse to send messages where the packet exceeds this size.
20322     */
20323    LDKSendError_TooBigPacket,
20324    /**
20325     * The provided [`Destination`] was an invalid [`BlindedPath`] due to not having any blinded
20326     * hops.
20327     */
20328    LDKSendError_TooFewBlindedHops,
20329    /**
20330     * The first hop is not a peer and doesn't have a known [`SocketAddress`].
20331     */
20332    LDKSendError_InvalidFirstHop,
20333    /**
20334     * A path from the sender to the destination could not be found by the [`MessageRouter`].
20335     */
20336    LDKSendError_PathNotFound,
20337    /**
20338     * Onion message contents must have a TLV type >= 64.
20339     */
20340    LDKSendError_InvalidMessage,
20341    /**
20342     * Our next-hop peer's buffer was full or our total outbound buffer was full.
20343     */
20344    LDKSendError_BufferFull,
20345    /**
20346     * Failed to retrieve our node id from the provided [`NodeSigner`].
20347     *
20348     * [`NodeSigner`]: crate::sign::NodeSigner
20349     */
20350    LDKSendError_GetNodeIdFailed,
20351    /**
20352     * The provided [`Destination`] has a blinded path with an unresolved introduction node. An
20353     * attempt to resolve it in the [`MessageRouter`] when finding an [`OnionMessagePath`] likely
20354     * failed.
20355     */
20356    LDKSendError_UnresolvedIntroductionNode,
20357    /**
20358     * We attempted to send to a blinded path where we are the introduction node, and failed to
20359     * advance the blinded path to make the second hop the new introduction node. Either
20360     * [`NodeSigner::ecdh`] failed, we failed to tweak the current blinding point to get the
20361     * new blinding point, or we were attempting to send to ourselves.
20362     */
20363    LDKSendError_BlindedPathAdvanceFailed,
20364    /**
20365     * Must be last for serialization purposes
20366     */
20367    LDKSendError_Sentinel,
20368 } LDKSendError_Tag;
20369
20370 typedef struct MUST_USE_STRUCT LDKSendError {
20371    LDKSendError_Tag tag;
20372    union {
20373       struct {
20374          enum LDKSecp256k1Error secp256k1;
20375       };
20376       struct {
20377          struct LDKPublicKey invalid_first_hop;
20378       };
20379    };
20380 } LDKSendError;
20381
20382 /**
20383  * The contents of CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ
20384  */
20385 typedef union LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZPtr {
20386    /**
20387     * A pointer to the contents in the success state.
20388     * Reading from this pointer when `result_ok` is not set is undefined.
20389     */
20390    struct LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ *result;
20391    /**
20392     * A pointer to the contents in the error state.
20393     * Reading from this pointer when `result_ok` is set is undefined.
20394     */
20395    struct LDKSendError *err;
20396 } LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZPtr;
20397
20398 /**
20399  * A CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ represents the result of a fallible operation,
20400  * containing a crate::c_types::derived::C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ on success and a crate::lightning::onion_message::messenger::SendError on failure.
20401  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
20402  */
20403 typedef struct LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ {
20404    /**
20405     * The contents of this CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ, accessible via either
20406     * `err` or `result` depending on the state of `result_ok`.
20407     */
20408    union LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZPtr contents;
20409    /**
20410     * Whether this CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ represents a success state.
20411     */
20412    bool result_ok;
20413 } LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ;
20414
20415 /**
20416  * The next hop to forward an onion message along its path.
20417  *
20418  * Note that payment blinded paths always specify their next hop using an explicit node id.
20419  */
20420 typedef enum LDKNextMessageHop_Tag {
20421    /**
20422     * The node id of the next hop.
20423     */
20424    LDKNextMessageHop_NodeId,
20425    /**
20426     * The short channel id leading to the next hop.
20427     */
20428    LDKNextMessageHop_ShortChannelId,
20429    /**
20430     * Must be last for serialization purposes
20431     */
20432    LDKNextMessageHop_Sentinel,
20433 } LDKNextMessageHop_Tag;
20434
20435 typedef struct MUST_USE_STRUCT LDKNextMessageHop {
20436    LDKNextMessageHop_Tag tag;
20437    union {
20438       struct {
20439          struct LDKPublicKey node_id;
20440       };
20441       struct {
20442          uint64_t short_channel_id;
20443       };
20444    };
20445 } LDKNextMessageHop;
20446
20447 /**
20448  * The contents of an [`OnionMessage`] as read from the wire.
20449  *
20450  * [`OnionMessage`]: crate::ln::msgs::OnionMessage
20451  */
20452 typedef enum LDKParsedOnionMessageContents_Tag {
20453    /**
20454     * A message related to BOLT 12 Offers.
20455     */
20456    LDKParsedOnionMessageContents_Offers,
20457    /**
20458     * A custom onion message specified by the user.
20459     */
20460    LDKParsedOnionMessageContents_Custom,
20461    /**
20462     * Must be last for serialization purposes
20463     */
20464    LDKParsedOnionMessageContents_Sentinel,
20465 } LDKParsedOnionMessageContents_Tag;
20466
20467 typedef struct MUST_USE_STRUCT LDKParsedOnionMessageContents {
20468    LDKParsedOnionMessageContents_Tag tag;
20469    union {
20470       struct {
20471          struct LDKOffersMessage offers;
20472       };
20473       struct {
20474          struct LDKOnionMessageContents custom;
20475       };
20476    };
20477 } LDKParsedOnionMessageContents;
20478
20479 /**
20480  * A processed incoming onion message, containing either a Forward (another onion message)
20481  * or a Receive payload with decrypted contents.
20482  */
20483 typedef enum LDKPeeledOnion_Tag {
20484    /**
20485     * Forwarded onion, with the next node id and a new onion
20486     */
20487    LDKPeeledOnion_Forward,
20488    /**
20489     * Received onion message, with decrypted contents, path_id, and reply path
20490     */
20491    LDKPeeledOnion_Receive,
20492    /**
20493     * Must be last for serialization purposes
20494     */
20495    LDKPeeledOnion_Sentinel,
20496 } LDKPeeledOnion_Tag;
20497
20498 typedef struct LDKPeeledOnion_LDKForward_Body {
20499    struct LDKNextMessageHop _0;
20500    struct LDKOnionMessage _1;
20501 } LDKPeeledOnion_LDKForward_Body;
20502
20503 typedef struct LDKPeeledOnion_LDKReceive_Body {
20504    struct LDKParsedOnionMessageContents _0;
20505    /**
20506     *
20507     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
20508     */
20509    struct LDKThirtyTwoBytes _1;
20510    /**
20511     *
20512     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
20513     */
20514    struct LDKBlindedPath _2;
20515 } LDKPeeledOnion_LDKReceive_Body;
20516
20517 typedef struct MUST_USE_STRUCT LDKPeeledOnion {
20518    LDKPeeledOnion_Tag tag;
20519    union {
20520       LDKPeeledOnion_LDKForward_Body forward;
20521       LDKPeeledOnion_LDKReceive_Body receive;
20522    };
20523 } LDKPeeledOnion;
20524
20525 /**
20526  * The contents of CResult_PeeledOnionNoneZ
20527  */
20528 typedef union LDKCResult_PeeledOnionNoneZPtr {
20529    /**
20530     * A pointer to the contents in the success state.
20531     * Reading from this pointer when `result_ok` is not set is undefined.
20532     */
20533    struct LDKPeeledOnion *result;
20534    /**
20535     * Note that this value is always NULL, as there are no contents in the Err variant
20536     */
20537    void *err;
20538 } LDKCResult_PeeledOnionNoneZPtr;
20539
20540 /**
20541  * A CResult_PeeledOnionNoneZ represents the result of a fallible operation,
20542  * containing a crate::lightning::onion_message::messenger::PeeledOnion on success and a () on failure.
20543  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
20544  */
20545 typedef struct LDKCResult_PeeledOnionNoneZ {
20546    /**
20547     * The contents of this CResult_PeeledOnionNoneZ, accessible via either
20548     * `err` or `result` depending on the state of `result_ok`.
20549     */
20550    union LDKCResult_PeeledOnionNoneZPtr contents;
20551    /**
20552     * Whether this CResult_PeeledOnionNoneZ represents a success state.
20553     */
20554    bool result_ok;
20555 } LDKCResult_PeeledOnionNoneZ;
20556
20557 /**
20558  * Result of successfully [sending an onion message].
20559  *
20560  * [sending an onion message]: OnionMessenger::send_onion_message
20561  */
20562 typedef enum LDKSendSuccess_Tag {
20563    /**
20564     * The message was buffered and will be sent once it is processed by
20565     * [`OnionMessageHandler::next_onion_message_for_peer`].
20566     */
20567    LDKSendSuccess_Buffered,
20568    /**
20569     * The message was buffered and will be sent once the node is connected as a peer and it is
20570     * processed by [`OnionMessageHandler::next_onion_message_for_peer`].
20571     */
20572    LDKSendSuccess_BufferedAwaitingConnection,
20573    /**
20574     * Must be last for serialization purposes
20575     */
20576    LDKSendSuccess_Sentinel,
20577 } LDKSendSuccess_Tag;
20578
20579 typedef struct MUST_USE_STRUCT LDKSendSuccess {
20580    LDKSendSuccess_Tag tag;
20581    union {
20582       struct {
20583          struct LDKPublicKey buffered_awaiting_connection;
20584       };
20585    };
20586 } LDKSendSuccess;
20587
20588 /**
20589  * The contents of CResult_SendSuccessSendErrorZ
20590  */
20591 typedef union LDKCResult_SendSuccessSendErrorZPtr {
20592    /**
20593     * A pointer to the contents in the success state.
20594     * Reading from this pointer when `result_ok` is not set is undefined.
20595     */
20596    struct LDKSendSuccess *result;
20597    /**
20598     * A pointer to the contents in the error state.
20599     * Reading from this pointer when `result_ok` is set is undefined.
20600     */
20601    struct LDKSendError *err;
20602 } LDKCResult_SendSuccessSendErrorZPtr;
20603
20604 /**
20605  * A CResult_SendSuccessSendErrorZ represents the result of a fallible operation,
20606  * containing a crate::lightning::onion_message::messenger::SendSuccess on success and a crate::lightning::onion_message::messenger::SendError on failure.
20607  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
20608  */
20609 typedef struct LDKCResult_SendSuccessSendErrorZ {
20610    /**
20611     * The contents of this CResult_SendSuccessSendErrorZ, accessible via either
20612     * `err` or `result` depending on the state of `result_ok`.
20613     */
20614    union LDKCResult_SendSuccessSendErrorZPtr contents;
20615    /**
20616     * Whether this CResult_SendSuccessSendErrorZ represents a success state.
20617     */
20618    bool result_ok;
20619 } LDKCResult_SendSuccessSendErrorZ;
20620
20621 /**
20622  * The contents of CResult_BlindedPathNoneZ
20623  */
20624 typedef union LDKCResult_BlindedPathNoneZPtr {
20625    /**
20626     * A pointer to the contents in the success state.
20627     * Reading from this pointer when `result_ok` is not set is undefined.
20628     */
20629    struct LDKBlindedPath *result;
20630    /**
20631     * Note that this value is always NULL, as there are no contents in the Err variant
20632     */
20633    void *err;
20634 } LDKCResult_BlindedPathNoneZPtr;
20635
20636 /**
20637  * A CResult_BlindedPathNoneZ represents the result of a fallible operation,
20638  * containing a crate::lightning::blinded_path::BlindedPath on success and a () on failure.
20639  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
20640  */
20641 typedef struct LDKCResult_BlindedPathNoneZ {
20642    /**
20643     * The contents of this CResult_BlindedPathNoneZ, accessible via either
20644     * `err` or `result` depending on the state of `result_ok`.
20645     */
20646    union LDKCResult_BlindedPathNoneZPtr contents;
20647    /**
20648     * Whether this CResult_BlindedPathNoneZ represents a success state.
20649     */
20650    bool result_ok;
20651 } LDKCResult_BlindedPathNoneZ;
20652
20653 /**
20654  * The contents of CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ
20655  */
20656 typedef union LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr {
20657    /**
20658     * A pointer to the contents in the success state.
20659     * Reading from this pointer when `result_ok` is not set is undefined.
20660     */
20661    struct LDKC2Tuple_BlindedPayInfoBlindedPathZ *result;
20662    /**
20663     * Note that this value is always NULL, as there are no contents in the Err variant
20664     */
20665    void *err;
20666 } LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr;
20667
20668 /**
20669  * A CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ represents the result of a fallible operation,
20670  * containing a crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ on success and a () on failure.
20671  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
20672  */
20673 typedef struct LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
20674    /**
20675     * The contents of this CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ, accessible via either
20676     * `err` or `result` depending on the state of `result_ok`.
20677     */
20678    union LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr contents;
20679    /**
20680     * Whether this CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ represents a success state.
20681     */
20682    bool result_ok;
20683 } LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ;
20684
20685
20686
20687 /**
20688  * An intermediate node, its outbound channel, and relay parameters.
20689  */
20690 typedef struct MUST_USE_STRUCT LDKForwardNode {
20691    /**
20692     * A pointer to the opaque Rust object.
20693     * Nearly everywhere, inner must be non-null, however in places where
20694     * the Rust equivalent takes an Option, it may be set to null to indicate None.
20695     */
20696    LDKnativeForwardNode *inner;
20697    /**
20698     * Indicates that this is the only struct which contains the same pointer.
20699     * Rust functions which take ownership of an object provided via an argument require
20700     * this to be true and invalidate the object pointed to by inner.
20701     */
20702    bool is_owned;
20703 } LDKForwardNode;
20704
20705 /**
20706  * A dynamically-allocated array of crate::lightning::blinded_path::payment::ForwardNodes of arbitrary size.
20707  * This corresponds to std::vector in C++
20708  */
20709 typedef struct LDKCVec_ForwardNodeZ {
20710    /**
20711     * The elements in the array.
20712     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
20713     */
20714    struct LDKForwardNode *data;
20715    /**
20716     * The number of elements pointed to by `data`.
20717     */
20718    uintptr_t datalen;
20719 } LDKCVec_ForwardNodeZ;
20720
20721 /**
20722  * The contents of CResult_BlindedPathDecodeErrorZ
20723  */
20724 typedef union LDKCResult_BlindedPathDecodeErrorZPtr {
20725    /**
20726     * A pointer to the contents in the success state.
20727     * Reading from this pointer when `result_ok` is not set is undefined.
20728     */
20729    struct LDKBlindedPath *result;
20730    /**
20731     * A pointer to the contents in the error state.
20732     * Reading from this pointer when `result_ok` is set is undefined.
20733     */
20734    struct LDKDecodeError *err;
20735 } LDKCResult_BlindedPathDecodeErrorZPtr;
20736
20737 /**
20738  * A CResult_BlindedPathDecodeErrorZ represents the result of a fallible operation,
20739  * containing a crate::lightning::blinded_path::BlindedPath on success and a crate::lightning::ln::msgs::DecodeError on failure.
20740  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
20741  */
20742 typedef struct LDKCResult_BlindedPathDecodeErrorZ {
20743    /**
20744     * The contents of this CResult_BlindedPathDecodeErrorZ, accessible via either
20745     * `err` or `result` depending on the state of `result_ok`.
20746     */
20747    union LDKCResult_BlindedPathDecodeErrorZPtr contents;
20748    /**
20749     * Whether this CResult_BlindedPathDecodeErrorZ represents a success state.
20750     */
20751    bool result_ok;
20752 } LDKCResult_BlindedPathDecodeErrorZ;
20753
20754 /**
20755  * The contents of CResult_BlindedHopDecodeErrorZ
20756  */
20757 typedef union LDKCResult_BlindedHopDecodeErrorZPtr {
20758    /**
20759     * A pointer to the contents in the success state.
20760     * Reading from this pointer when `result_ok` is not set is undefined.
20761     */
20762    struct LDKBlindedHop *result;
20763    /**
20764     * A pointer to the contents in the error state.
20765     * Reading from this pointer when `result_ok` is set is undefined.
20766     */
20767    struct LDKDecodeError *err;
20768 } LDKCResult_BlindedHopDecodeErrorZPtr;
20769
20770 /**
20771  * A CResult_BlindedHopDecodeErrorZ represents the result of a fallible operation,
20772  * containing a crate::lightning::blinded_path::BlindedHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
20773  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
20774  */
20775 typedef struct LDKCResult_BlindedHopDecodeErrorZ {
20776    /**
20777     * The contents of this CResult_BlindedHopDecodeErrorZ, accessible via either
20778     * `err` or `result` depending on the state of `result_ok`.
20779     */
20780    union LDKCResult_BlindedHopDecodeErrorZPtr contents;
20781    /**
20782     * Whether this CResult_BlindedHopDecodeErrorZ represents a success state.
20783     */
20784    bool result_ok;
20785 } LDKCResult_BlindedHopDecodeErrorZ;
20786
20787 /**
20788  * The contents of CResult_InvoiceErrorDecodeErrorZ
20789  */
20790 typedef union LDKCResult_InvoiceErrorDecodeErrorZPtr {
20791    /**
20792     * A pointer to the contents in the success state.
20793     * Reading from this pointer when `result_ok` is not set is undefined.
20794     */
20795    struct LDKInvoiceError *result;
20796    /**
20797     * A pointer to the contents in the error state.
20798     * Reading from this pointer when `result_ok` is set is undefined.
20799     */
20800    struct LDKDecodeError *err;
20801 } LDKCResult_InvoiceErrorDecodeErrorZPtr;
20802
20803 /**
20804  * A CResult_InvoiceErrorDecodeErrorZ represents the result of a fallible operation,
20805  * containing a crate::lightning::offers::invoice_error::InvoiceError on success and a crate::lightning::ln::msgs::DecodeError on failure.
20806  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
20807  */
20808 typedef struct LDKCResult_InvoiceErrorDecodeErrorZ {
20809    /**
20810     * The contents of this CResult_InvoiceErrorDecodeErrorZ, accessible via either
20811     * `err` or `result` depending on the state of `result_ok`.
20812     */
20813    union LDKCResult_InvoiceErrorDecodeErrorZPtr contents;
20814    /**
20815     * Whether this CResult_InvoiceErrorDecodeErrorZ represents a success state.
20816     */
20817    bool result_ok;
20818 } LDKCResult_InvoiceErrorDecodeErrorZ;
20819
20820
20821
20822 /**
20823  * The state of a spendable output currently tracked by an [`OutputSweeper`].
20824  */
20825 typedef struct MUST_USE_STRUCT LDKTrackedSpendableOutput {
20826    /**
20827     * A pointer to the opaque Rust object.
20828     * Nearly everywhere, inner must be non-null, however in places where
20829     * the Rust equivalent takes an Option, it may be set to null to indicate None.
20830     */
20831    LDKnativeTrackedSpendableOutput *inner;
20832    /**
20833     * Indicates that this is the only struct which contains the same pointer.
20834     * Rust functions which take ownership of an object provided via an argument require
20835     * this to be true and invalidate the object pointed to by inner.
20836     */
20837    bool is_owned;
20838 } LDKTrackedSpendableOutput;
20839
20840 /**
20841  * The contents of CResult_TrackedSpendableOutputDecodeErrorZ
20842  */
20843 typedef union LDKCResult_TrackedSpendableOutputDecodeErrorZPtr {
20844    /**
20845     * A pointer to the contents in the success state.
20846     * Reading from this pointer when `result_ok` is not set is undefined.
20847     */
20848    struct LDKTrackedSpendableOutput *result;
20849    /**
20850     * A pointer to the contents in the error state.
20851     * Reading from this pointer when `result_ok` is set is undefined.
20852     */
20853    struct LDKDecodeError *err;
20854 } LDKCResult_TrackedSpendableOutputDecodeErrorZPtr;
20855
20856 /**
20857  * A CResult_TrackedSpendableOutputDecodeErrorZ represents the result of a fallible operation,
20858  * containing a crate::lightning::util::sweep::TrackedSpendableOutput on success and a crate::lightning::ln::msgs::DecodeError on failure.
20859  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
20860  */
20861 typedef struct LDKCResult_TrackedSpendableOutputDecodeErrorZ {
20862    /**
20863     * The contents of this CResult_TrackedSpendableOutputDecodeErrorZ, accessible via either
20864     * `err` or `result` depending on the state of `result_ok`.
20865     */
20866    union LDKCResult_TrackedSpendableOutputDecodeErrorZPtr contents;
20867    /**
20868     * Whether this CResult_TrackedSpendableOutputDecodeErrorZ represents a success state.
20869     */
20870    bool result_ok;
20871 } LDKCResult_TrackedSpendableOutputDecodeErrorZ;
20872
20873 /**
20874  * The current status of the output spend.
20875  */
20876 typedef enum LDKOutputSpendStatus_Tag {
20877    /**
20878     * The output is tracked but an initial spending transaction hasn't been generated and
20879     * broadcasted yet.
20880     */
20881    LDKOutputSpendStatus_PendingInitialBroadcast,
20882    /**
20883     * A transaction spending the output has been broadcasted but is pending its first confirmation on-chain.
20884     */
20885    LDKOutputSpendStatus_PendingFirstConfirmation,
20886    /**
20887     * A transaction spending the output has been confirmed on-chain but will be tracked until it
20888     * reaches [`ANTI_REORG_DELAY`] confirmations.
20889     */
20890    LDKOutputSpendStatus_PendingThresholdConfirmations,
20891    /**
20892     * Must be last for serialization purposes
20893     */
20894    LDKOutputSpendStatus_Sentinel,
20895 } LDKOutputSpendStatus_Tag;
20896
20897 typedef struct LDKOutputSpendStatus_LDKPendingInitialBroadcast_Body {
20898    /**
20899     * The height at which we will first generate and broadcast a spending transaction.
20900     */
20901    struct LDKCOption_u32Z delayed_until_height;
20902 } LDKOutputSpendStatus_LDKPendingInitialBroadcast_Body;
20903
20904 typedef struct LDKOutputSpendStatus_LDKPendingFirstConfirmation_Body {
20905    /**
20906     * The hash of the chain tip when we first broadcast a transaction spending this output.
20907     */
20908    struct LDKThirtyTwoBytes first_broadcast_hash;
20909    /**
20910     * The best height when we last broadcast a transaction spending this output.
20911     */
20912    uint32_t latest_broadcast_height;
20913    /**
20914     * The transaction spending this output we last broadcasted.
20915     */
20916    struct LDKTransaction latest_spending_tx;
20917 } LDKOutputSpendStatus_LDKPendingFirstConfirmation_Body;
20918
20919 typedef struct LDKOutputSpendStatus_LDKPendingThresholdConfirmations_Body {
20920    /**
20921     * The hash of the chain tip when we first broadcast a transaction spending this output.
20922     */
20923    struct LDKThirtyTwoBytes first_broadcast_hash;
20924    /**
20925     * The best height when we last broadcast a transaction spending this output.
20926     */
20927    uint32_t latest_broadcast_height;
20928    /**
20929     * The transaction spending this output we saw confirmed on-chain.
20930     */
20931    struct LDKTransaction latest_spending_tx;
20932    /**
20933     * The height at which the spending transaction was confirmed.
20934     */
20935    uint32_t confirmation_height;
20936    /**
20937     * The hash of the block in which the spending transaction was confirmed.
20938     */
20939    struct LDKThirtyTwoBytes confirmation_hash;
20940 } LDKOutputSpendStatus_LDKPendingThresholdConfirmations_Body;
20941
20942 typedef struct MUST_USE_STRUCT LDKOutputSpendStatus {
20943    LDKOutputSpendStatus_Tag tag;
20944    union {
20945       LDKOutputSpendStatus_LDKPendingInitialBroadcast_Body pending_initial_broadcast;
20946       LDKOutputSpendStatus_LDKPendingFirstConfirmation_Body pending_first_confirmation;
20947       LDKOutputSpendStatus_LDKPendingThresholdConfirmations_Body pending_threshold_confirmations;
20948    };
20949 } LDKOutputSpendStatus;
20950
20951 /**
20952  * The contents of CResult_OutputSpendStatusDecodeErrorZ
20953  */
20954 typedef union LDKCResult_OutputSpendStatusDecodeErrorZPtr {
20955    /**
20956     * A pointer to the contents in the success state.
20957     * Reading from this pointer when `result_ok` is not set is undefined.
20958     */
20959    struct LDKOutputSpendStatus *result;
20960    /**
20961     * A pointer to the contents in the error state.
20962     * Reading from this pointer when `result_ok` is set is undefined.
20963     */
20964    struct LDKDecodeError *err;
20965 } LDKCResult_OutputSpendStatusDecodeErrorZPtr;
20966
20967 /**
20968  * A CResult_OutputSpendStatusDecodeErrorZ represents the result of a fallible operation,
20969  * containing a crate::lightning::util::sweep::OutputSpendStatus on success and a crate::lightning::ln::msgs::DecodeError on failure.
20970  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
20971  */
20972 typedef struct LDKCResult_OutputSpendStatusDecodeErrorZ {
20973    /**
20974     * The contents of this CResult_OutputSpendStatusDecodeErrorZ, accessible via either
20975     * `err` or `result` depending on the state of `result_ok`.
20976     */
20977    union LDKCResult_OutputSpendStatusDecodeErrorZPtr contents;
20978    /**
20979     * Whether this CResult_OutputSpendStatusDecodeErrorZ represents a success state.
20980     */
20981    bool result_ok;
20982 } LDKCResult_OutputSpendStatusDecodeErrorZ;
20983
20984
20985
20986 /**
20987  * A transaction output watched by a [`ChannelMonitor`] for spends on-chain.
20988  *
20989  * Used to convey to a [`Filter`] such an output with a given spending condition. Any transaction
20990  * spending the output must be given to [`ChannelMonitor::block_connected`] either directly or via
20991  * [`Confirm::transactions_confirmed`].
20992  *
20993  * If `block_hash` is `Some`, this indicates the output was created in the corresponding block and
20994  * may have been spent there. See [`Filter::register_output`] for details.
20995  *
20996  * [`ChannelMonitor`]: channelmonitor::ChannelMonitor
20997  * [`ChannelMonitor::block_connected`]: channelmonitor::ChannelMonitor::block_connected
20998  */
20999 typedef struct MUST_USE_STRUCT LDKWatchedOutput {
21000    /**
21001     * A pointer to the opaque Rust object.
21002     * Nearly everywhere, inner must be non-null, however in places where
21003     * the Rust equivalent takes an Option, it may be set to null to indicate None.
21004     */
21005    LDKnativeWatchedOutput *inner;
21006    /**
21007     * Indicates that this is the only struct which contains the same pointer.
21008     * Rust functions which take ownership of an object provided via an argument require
21009     * this to be true and invalidate the object pointed to by inner.
21010     */
21011    bool is_owned;
21012 } LDKWatchedOutput;
21013
21014 /**
21015  * The `Filter` trait defines behavior for indicating chain activity of interest pertaining to
21016  * channels.
21017  *
21018  * This is useful in order to have a [`Watch`] implementation convey to a chain source which
21019  * transactions to be notified of. Notification may take the form of pre-filtering blocks or, in
21020  * the case of [BIP 157]/[BIP 158], only fetching a block if the compact filter matches. If
21021  * receiving full blocks from a chain source, any further filtering is unnecessary.
21022  *
21023  * After an output has been registered, subsequent block retrievals from the chain source must not
21024  * exclude any transactions matching the new criteria nor any in-block descendants of such
21025  * transactions.
21026  *
21027  * Note that use as part of a [`Watch`] implementation involves reentrancy. Therefore, the `Filter`
21028  * should not block on I/O. Implementations should instead queue the newly monitored data to be
21029  * processed later. Then, in order to block until the data has been processed, any [`Watch`]
21030  * invocation that has called the `Filter` must return [`InProgress`].
21031  *
21032  * [`InProgress`]: ChannelMonitorUpdateStatus::InProgress
21033  * [BIP 157]: https://github.com/bitcoin/bips/blob/master/bip-0157.mediawiki
21034  * [BIP 158]: https://github.com/bitcoin/bips/blob/master/bip-0158.mediawiki
21035  */
21036 typedef struct LDKFilter {
21037    /**
21038     * An opaque pointer which is passed to your function implementations as an argument.
21039     * This has no meaning in the LDK, and can be NULL or any other value.
21040     */
21041    void *this_arg;
21042    /**
21043     * Registers interest in a transaction with `txid` and having an output with `script_pubkey` as
21044     * a spending condition.
21045     */
21046    void (*register_tx)(const void *this_arg, const uint8_t (*txid)[32], struct LDKu8slice script_pubkey);
21047    /**
21048     * Registers interest in spends of a transaction output.
21049     *
21050     * Note that this method might be called during processing of a new block. You therefore need
21051     * to ensure that also dependent output spents within an already connected block are correctly
21052     * handled, e.g., by re-scanning the block in question whenever new outputs have been
21053     * registered mid-processing.
21054     */
21055    void (*register_output)(const void *this_arg, struct LDKWatchedOutput output);
21056    /**
21057     * Frees any resources associated with this object given its this_arg pointer.
21058     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
21059     */
21060    void (*free)(void *this_arg);
21061 } LDKFilter;
21062
21063 /**
21064  * An enum which can either contain a crate::lightning::chain::Filter or not
21065  */
21066 typedef enum LDKCOption_FilterZ_Tag {
21067    /**
21068     * When we're in this state, this COption_FilterZ contains a crate::lightning::chain::Filter
21069     */
21070    LDKCOption_FilterZ_Some,
21071    /**
21072     * When we're in this state, this COption_FilterZ contains nothing
21073     */
21074    LDKCOption_FilterZ_None,
21075    /**
21076     * Must be last for serialization purposes
21077     */
21078    LDKCOption_FilterZ_Sentinel,
21079 } LDKCOption_FilterZ_Tag;
21080
21081 typedef struct LDKCOption_FilterZ {
21082    LDKCOption_FilterZ_Tag tag;
21083    union {
21084       struct {
21085          struct LDKFilter some;
21086       };
21087    };
21088 } LDKCOption_FilterZ;
21089
21090 /**
21091  * A dynamically-allocated array of crate::lightning::util::sweep::TrackedSpendableOutputs of arbitrary size.
21092  * This corresponds to std::vector in C++
21093  */
21094 typedef struct LDKCVec_TrackedSpendableOutputZ {
21095    /**
21096     * The elements in the array.
21097     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
21098     */
21099    struct LDKTrackedSpendableOutput *data;
21100    /**
21101     * The number of elements pointed to by `data`.
21102     */
21103    uintptr_t datalen;
21104 } LDKCVec_TrackedSpendableOutputZ;
21105
21106 /**
21107  * A helper trait that describes an on-chain wallet capable of returning a (change) destination
21108  * script.
21109  */
21110 typedef struct LDKChangeDestinationSource {
21111    /**
21112     * An opaque pointer which is passed to your function implementations as an argument.
21113     * This has no meaning in the LDK, and can be NULL or any other value.
21114     */
21115    void *this_arg;
21116    /**
21117     * Returns a script pubkey which can be used as a change destination for
21118     * [`OutputSpender::spend_spendable_outputs`].
21119     *
21120     * This method should return a different value each time it is called, to avoid linking
21121     * on-chain funds controlled to the same user.
21122     */
21123    struct LDKCResult_CVec_u8ZNoneZ (*get_change_destination_script)(const void *this_arg);
21124    /**
21125     * Frees any resources associated with this object given its this_arg pointer.
21126     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
21127     */
21128    void (*free)(void *this_arg);
21129 } LDKChangeDestinationSource;
21130
21131 /**
21132  * Provides an interface that allows storage and retrieval of persisted values that are associated
21133  * with given keys.
21134  *
21135  * In order to avoid collisions the key space is segmented based on the given `primary_namespace`s
21136  * and `secondary_namespace`s. Implementations of this trait are free to handle them in different
21137  * ways, as long as per-namespace key uniqueness is asserted.
21138  *
21139  * Keys and namespaces are required to be valid ASCII strings in the range of
21140  * [`KVSTORE_NAMESPACE_KEY_ALPHABET`] and no longer than [`KVSTORE_NAMESPACE_KEY_MAX_LEN`]. Empty
21141  * primary namespaces and secondary namespaces (`\"\"`) are assumed to be a valid, however, if
21142  * `primary_namespace` is empty, `secondary_namespace` is required to be empty, too. This means
21143  * that concerns should always be separated by primary namespace first, before secondary
21144  * namespaces are used. While the number of primary namespaces will be relatively small and is
21145  * determined at compile time, there may be many secondary namespaces per primary namespace. Note
21146  * that per-namespace uniqueness needs to also hold for keys *and* namespaces in any given
21147  * namespace, i.e., conflicts between keys and equally named
21148  * primary namespaces/secondary namespaces must be avoided.
21149  *
21150  * **Note:** Users migrating custom persistence backends from the pre-v0.0.117 `KVStorePersister`
21151  * interface can use a concatenation of `[{primary_namespace}/[{secondary_namespace}/]]{key}` to
21152  * recover a `key` compatible with the data model previously assumed by `KVStorePersister::persist`.
21153  */
21154 typedef struct LDKKVStore {
21155    /**
21156     * An opaque pointer which is passed to your function implementations as an argument.
21157     * This has no meaning in the LDK, and can be NULL or any other value.
21158     */
21159    void *this_arg;
21160    /**
21161     * Returns the data stored for the given `primary_namespace`, `secondary_namespace`, and
21162     * `key`.
21163     *
21164     * Returns an [`ErrorKind::NotFound`] if the given `key` could not be found in the given
21165     * `primary_namespace` and `secondary_namespace`.
21166     *
21167     * [`ErrorKind::NotFound`]: io::ErrorKind::NotFound
21168     */
21169    struct LDKCResult_CVec_u8ZIOErrorZ (*read)(const void *this_arg, struct LDKStr primary_namespace, struct LDKStr secondary_namespace, struct LDKStr key);
21170    /**
21171     * Persists the given data under the given `key`.
21172     *
21173     * Will create the given `primary_namespace` and `secondary_namespace` if not already present
21174     * in the store.
21175     */
21176    struct LDKCResult_NoneIOErrorZ (*write)(const void *this_arg, struct LDKStr primary_namespace, struct LDKStr secondary_namespace, struct LDKStr key, struct LDKu8slice buf);
21177    /**
21178     * Removes any data that had previously been persisted under the given `key`.
21179     *
21180     * If the `lazy` flag is set to `true`, the backend implementation might choose to lazily
21181     * remove the given `key` at some point in time after the method returns, e.g., as part of an
21182     * eventual batch deletion of multiple keys. As a consequence, subsequent calls to
21183     * [`KVStore::list`] might include the removed key until the changes are actually persisted.
21184     *
21185     * Note that while setting the `lazy` flag reduces the I/O burden of multiple subsequent
21186     * `remove` calls, it also influences the atomicity guarantees as lazy `remove`s could
21187     * potentially get lost on crash after the method returns. Therefore, this flag should only be
21188     * set for `remove` operations that can be safely replayed at a later time.
21189     *
21190     * Returns successfully if no data will be stored for the given `primary_namespace`,
21191     * `secondary_namespace`, and `key`, independently of whether it was present before its
21192     * invokation or not.
21193     */
21194    struct LDKCResult_NoneIOErrorZ (*remove)(const void *this_arg, struct LDKStr primary_namespace, struct LDKStr secondary_namespace, struct LDKStr key, bool lazy);
21195    /**
21196     * Returns a list of keys that are stored under the given `secondary_namespace` in
21197     * `primary_namespace`.
21198     *
21199     * Returns the keys in arbitrary order, so users requiring a particular order need to sort the
21200     * returned keys. Returns an empty list if `primary_namespace` or `secondary_namespace` is unknown.
21201     */
21202    struct LDKCResult_CVec_StrZIOErrorZ (*list)(const void *this_arg, struct LDKStr primary_namespace, struct LDKStr secondary_namespace);
21203    /**
21204     * Frees any resources associated with this object given its this_arg pointer.
21205     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
21206     */
21207    void (*free)(void *this_arg);
21208 } LDKKVStore;
21209
21210 /**
21211  * A trait that describes a wallet capable of creating a spending [`Transaction`] from a set of
21212  * [`SpendableOutputDescriptor`]s.
21213  */
21214 typedef struct LDKOutputSpender {
21215    /**
21216     * An opaque pointer which is passed to your function implementations as an argument.
21217     * This has no meaning in the LDK, and can be NULL or any other value.
21218     */
21219    void *this_arg;
21220    /**
21221     * Creates a [`Transaction`] which spends the given descriptors to the given outputs, plus an
21222     * output to the given change destination (if sufficient change value remains). The
21223     * transaction will have a feerate, at least, of the given value.
21224     *
21225     * The `locktime` argument is used to set the transaction's locktime. If `None`, the
21226     * transaction will have a locktime of 0. It it recommended to set this to the current block
21227     * height to avoid fee sniping, unless you have some specific reason to use a different
21228     * locktime.
21229     *
21230     * Returns `Err(())` if the output value is greater than the input value minus required fee,
21231     * if a descriptor was duplicated, or if an output descriptor `script_pubkey`
21232     * does not match the one we can spend.
21233     */
21234    struct LDKCResult_TransactionNoneZ (*spend_spendable_outputs)(const void *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_u32Z locktime);
21235    /**
21236     * Frees any resources associated with this object given its this_arg pointer.
21237     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
21238     */
21239    void (*free)(void *this_arg);
21240 } LDKOutputSpender;
21241
21242
21243
21244 /**
21245  * A utility that keeps track of [`SpendableOutputDescriptor`]s, persists them in a given
21246  * [`KVStore`] and regularly retries sweeping them based on a callback given to the constructor
21247  * methods.
21248  *
21249  * Users should call [`Self::track_spendable_outputs`] for any [`SpendableOutputDescriptor`]s received via [`Event::SpendableOutputs`].
21250  *
21251  * This needs to be notified of chain state changes either via its [`Listen`] or [`Confirm`]
21252  * implementation and hence has to be connected with the utilized chain data sources.
21253  *
21254  * If chain data is provided via the [`Confirm`] interface or via filtered blocks, users are
21255  * required to give their chain data sources (i.e., [`Filter`] implementation) to the respective
21256  * constructor.
21257  *
21258  * [`Event::SpendableOutputs`]: crate::events::Event::SpendableOutputs
21259  */
21260 typedef struct MUST_USE_STRUCT LDKOutputSweeper {
21261    /**
21262     * A pointer to the opaque Rust object.
21263     * Nearly everywhere, inner must be non-null, however in places where
21264     * the Rust equivalent takes an Option, it may be set to null to indicate None.
21265     */
21266    LDKnativeOutputSweeper *inner;
21267    /**
21268     * Indicates that this is the only struct which contains the same pointer.
21269     * Rust functions which take ownership of an object provided via an argument require
21270     * this to be true and invalidate the object pointed to by inner.
21271     */
21272    bool is_owned;
21273 } LDKOutputSweeper;
21274
21275 /**
21276  * The contents of CResult_OutputSweeperDecodeErrorZ
21277  */
21278 typedef union LDKCResult_OutputSweeperDecodeErrorZPtr {
21279    /**
21280     * A pointer to the contents in the success state.
21281     * Reading from this pointer when `result_ok` is not set is undefined.
21282     */
21283    struct LDKOutputSweeper *result;
21284    /**
21285     * A pointer to the contents in the error state.
21286     * Reading from this pointer when `result_ok` is set is undefined.
21287     */
21288    struct LDKDecodeError *err;
21289 } LDKCResult_OutputSweeperDecodeErrorZPtr;
21290
21291 /**
21292  * A CResult_OutputSweeperDecodeErrorZ represents the result of a fallible operation,
21293  * containing a crate::lightning::util::sweep::OutputSweeper on success and a crate::lightning::ln::msgs::DecodeError on failure.
21294  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
21295  */
21296 typedef struct LDKCResult_OutputSweeperDecodeErrorZ {
21297    /**
21298     * The contents of this CResult_OutputSweeperDecodeErrorZ, accessible via either
21299     * `err` or `result` depending on the state of `result_ok`.
21300     */
21301    union LDKCResult_OutputSweeperDecodeErrorZPtr contents;
21302    /**
21303     * Whether this CResult_OutputSweeperDecodeErrorZ represents a success state.
21304     */
21305    bool result_ok;
21306 } LDKCResult_OutputSweeperDecodeErrorZ;
21307
21308 /**
21309  * A tuple of 2 elements. See the individual fields for the types contained.
21310  */
21311 typedef struct LDKC2Tuple_BestBlockOutputSweeperZ {
21312    /**
21313     * The element at position 0
21314     */
21315    struct LDKBestBlock a;
21316    /**
21317     * The element at position 1
21318     */
21319    struct LDKOutputSweeper b;
21320 } LDKC2Tuple_BestBlockOutputSweeperZ;
21321
21322 /**
21323  * The contents of CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ
21324  */
21325 typedef union LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZPtr {
21326    /**
21327     * A pointer to the contents in the success state.
21328     * Reading from this pointer when `result_ok` is not set is undefined.
21329     */
21330    struct LDKC2Tuple_BestBlockOutputSweeperZ *result;
21331    /**
21332     * A pointer to the contents in the error state.
21333     * Reading from this pointer when `result_ok` is set is undefined.
21334     */
21335    struct LDKDecodeError *err;
21336 } LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZPtr;
21337
21338 /**
21339  * A CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ represents the result of a fallible operation,
21340  * containing a crate::c_types::derived::C2Tuple_BestBlockOutputSweeperZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
21341  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
21342  */
21343 typedef struct LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ {
21344    /**
21345     * The contents of this CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ, accessible via either
21346     * `err` or `result` depending on the state of `result_ok`.
21347     */
21348    union LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZPtr contents;
21349    /**
21350     * Whether this CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ represents a success state.
21351     */
21352    bool result_ok;
21353 } LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ;
21354
21355
21356
21357 /**
21358  * Base key used in conjunction with a `per_commitment_point` to generate a [`DelayedPaymentKey`].
21359  *
21360  * The delayed payment key is used to pay the commitment state broadcaster their
21361  * non-HTLC-encumbered funds after a delay to give their counterparty a chance to punish if the
21362  * state broadcasted was previously revoked.
21363  */
21364 typedef struct MUST_USE_STRUCT LDKDelayedPaymentBasepoint {
21365    /**
21366     * A pointer to the opaque Rust object.
21367     * Nearly everywhere, inner must be non-null, however in places where
21368     * the Rust equivalent takes an Option, it may be set to null to indicate None.
21369     */
21370    LDKnativeDelayedPaymentBasepoint *inner;
21371    /**
21372     * Indicates that this is the only struct which contains the same pointer.
21373     * Rust functions which take ownership of an object provided via an argument require
21374     * this to be true and invalidate the object pointed to by inner.
21375     */
21376    bool is_owned;
21377 } LDKDelayedPaymentBasepoint;
21378
21379 /**
21380  * The contents of CResult_DelayedPaymentBasepointDecodeErrorZ
21381  */
21382 typedef union LDKCResult_DelayedPaymentBasepointDecodeErrorZPtr {
21383    /**
21384     * A pointer to the contents in the success state.
21385     * Reading from this pointer when `result_ok` is not set is undefined.
21386     */
21387    struct LDKDelayedPaymentBasepoint *result;
21388    /**
21389     * A pointer to the contents in the error state.
21390     * Reading from this pointer when `result_ok` is set is undefined.
21391     */
21392    struct LDKDecodeError *err;
21393 } LDKCResult_DelayedPaymentBasepointDecodeErrorZPtr;
21394
21395 /**
21396  * A CResult_DelayedPaymentBasepointDecodeErrorZ represents the result of a fallible operation,
21397  * containing a crate::lightning::ln::channel_keys::DelayedPaymentBasepoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
21398  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
21399  */
21400 typedef struct LDKCResult_DelayedPaymentBasepointDecodeErrorZ {
21401    /**
21402     * The contents of this CResult_DelayedPaymentBasepointDecodeErrorZ, accessible via either
21403     * `err` or `result` depending on the state of `result_ok`.
21404     */
21405    union LDKCResult_DelayedPaymentBasepointDecodeErrorZPtr contents;
21406    /**
21407     * Whether this CResult_DelayedPaymentBasepointDecodeErrorZ represents a success state.
21408     */
21409    bool result_ok;
21410 } LDKCResult_DelayedPaymentBasepointDecodeErrorZ;
21411
21412
21413
21414 /**
21415  * A derived key built from a [`DelayedPaymentBasepoint`] and `per_commitment_point`.
21416  *
21417  * The delayed payment key is used to pay the commitment state broadcaster their
21418  * non-HTLC-encumbered funds after a delay. This delay gives their counterparty a chance to
21419  * punish and claim all the channel funds if the state broadcasted was previously revoked.
21420  *
21421  * [See the BOLT specs]
21422  * (https://github.com/lightning/bolts/blob/master/03-transactions.md#localpubkey-local_htlcpubkey-remote_htlcpubkey-local_delayedpubkey-and-remote_delayedpubkey-derivation)
21423  * for more information on key derivation details.
21424  */
21425 typedef struct MUST_USE_STRUCT LDKDelayedPaymentKey {
21426    /**
21427     * A pointer to the opaque Rust object.
21428     * Nearly everywhere, inner must be non-null, however in places where
21429     * the Rust equivalent takes an Option, it may be set to null to indicate None.
21430     */
21431    LDKnativeDelayedPaymentKey *inner;
21432    /**
21433     * Indicates that this is the only struct which contains the same pointer.
21434     * Rust functions which take ownership of an object provided via an argument require
21435     * this to be true and invalidate the object pointed to by inner.
21436     */
21437    bool is_owned;
21438 } LDKDelayedPaymentKey;
21439
21440 /**
21441  * The contents of CResult_DelayedPaymentKeyDecodeErrorZ
21442  */
21443 typedef union LDKCResult_DelayedPaymentKeyDecodeErrorZPtr {
21444    /**
21445     * A pointer to the contents in the success state.
21446     * Reading from this pointer when `result_ok` is not set is undefined.
21447     */
21448    struct LDKDelayedPaymentKey *result;
21449    /**
21450     * A pointer to the contents in the error state.
21451     * Reading from this pointer when `result_ok` is set is undefined.
21452     */
21453    struct LDKDecodeError *err;
21454 } LDKCResult_DelayedPaymentKeyDecodeErrorZPtr;
21455
21456 /**
21457  * A CResult_DelayedPaymentKeyDecodeErrorZ represents the result of a fallible operation,
21458  * containing a crate::lightning::ln::channel_keys::DelayedPaymentKey on success and a crate::lightning::ln::msgs::DecodeError on failure.
21459  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
21460  */
21461 typedef struct LDKCResult_DelayedPaymentKeyDecodeErrorZ {
21462    /**
21463     * The contents of this CResult_DelayedPaymentKeyDecodeErrorZ, accessible via either
21464     * `err` or `result` depending on the state of `result_ok`.
21465     */
21466    union LDKCResult_DelayedPaymentKeyDecodeErrorZPtr contents;
21467    /**
21468     * Whether this CResult_DelayedPaymentKeyDecodeErrorZ represents a success state.
21469     */
21470    bool result_ok;
21471 } LDKCResult_DelayedPaymentKeyDecodeErrorZ;
21472
21473
21474
21475 /**
21476  * Base key used in conjunction with a `per_commitment_point` to generate an [`HtlcKey`].
21477  *
21478  * HTLC keys are used to ensure only the recipient of an HTLC can claim it on-chain with the HTLC
21479  * preimage and that only the sender of an HTLC can claim it on-chain after it has timed out.
21480  * Thus, both channel counterparties' HTLC keys will appears in each HTLC output's script.
21481  */
21482 typedef struct MUST_USE_STRUCT LDKHtlcBasepoint {
21483    /**
21484     * A pointer to the opaque Rust object.
21485     * Nearly everywhere, inner must be non-null, however in places where
21486     * the Rust equivalent takes an Option, it may be set to null to indicate None.
21487     */
21488    LDKnativeHtlcBasepoint *inner;
21489    /**
21490     * Indicates that this is the only struct which contains the same pointer.
21491     * Rust functions which take ownership of an object provided via an argument require
21492     * this to be true and invalidate the object pointed to by inner.
21493     */
21494    bool is_owned;
21495 } LDKHtlcBasepoint;
21496
21497 /**
21498  * The contents of CResult_HtlcBasepointDecodeErrorZ
21499  */
21500 typedef union LDKCResult_HtlcBasepointDecodeErrorZPtr {
21501    /**
21502     * A pointer to the contents in the success state.
21503     * Reading from this pointer when `result_ok` is not set is undefined.
21504     */
21505    struct LDKHtlcBasepoint *result;
21506    /**
21507     * A pointer to the contents in the error state.
21508     * Reading from this pointer when `result_ok` is set is undefined.
21509     */
21510    struct LDKDecodeError *err;
21511 } LDKCResult_HtlcBasepointDecodeErrorZPtr;
21512
21513 /**
21514  * A CResult_HtlcBasepointDecodeErrorZ represents the result of a fallible operation,
21515  * containing a crate::lightning::ln::channel_keys::HtlcBasepoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
21516  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
21517  */
21518 typedef struct LDKCResult_HtlcBasepointDecodeErrorZ {
21519    /**
21520     * The contents of this CResult_HtlcBasepointDecodeErrorZ, accessible via either
21521     * `err` or `result` depending on the state of `result_ok`.
21522     */
21523    union LDKCResult_HtlcBasepointDecodeErrorZPtr contents;
21524    /**
21525     * Whether this CResult_HtlcBasepointDecodeErrorZ represents a success state.
21526     */
21527    bool result_ok;
21528 } LDKCResult_HtlcBasepointDecodeErrorZ;
21529
21530
21531
21532 /**
21533  * A derived key built from a [`HtlcBasepoint`] and `per_commitment_point`.
21534  *
21535  * HTLC keys are used to ensure only the recipient of an HTLC can claim it on-chain with the HTLC
21536  * preimage and that only the sender of an HTLC can claim it on-chain after it has timed out.
21537  * Thus, both channel counterparties' HTLC keys will appears in each HTLC output's script.
21538  *
21539  * [See the BOLT specs]
21540  * (https://github.com/lightning/bolts/blob/master/03-transactions.md#localpubkey-local_htlcpubkey-remote_htlcpubkey-local_delayedpubkey-and-remote_delayedpubkey-derivation)
21541  * for more information on key derivation details.
21542  */
21543 typedef struct MUST_USE_STRUCT LDKHtlcKey {
21544    /**
21545     * A pointer to the opaque Rust object.
21546     * Nearly everywhere, inner must be non-null, however in places where
21547     * the Rust equivalent takes an Option, it may be set to null to indicate None.
21548     */
21549    LDKnativeHtlcKey *inner;
21550    /**
21551     * Indicates that this is the only struct which contains the same pointer.
21552     * Rust functions which take ownership of an object provided via an argument require
21553     * this to be true and invalidate the object pointed to by inner.
21554     */
21555    bool is_owned;
21556 } LDKHtlcKey;
21557
21558 /**
21559  * The contents of CResult_HtlcKeyDecodeErrorZ
21560  */
21561 typedef union LDKCResult_HtlcKeyDecodeErrorZPtr {
21562    /**
21563     * A pointer to the contents in the success state.
21564     * Reading from this pointer when `result_ok` is not set is undefined.
21565     */
21566    struct LDKHtlcKey *result;
21567    /**
21568     * A pointer to the contents in the error state.
21569     * Reading from this pointer when `result_ok` is set is undefined.
21570     */
21571    struct LDKDecodeError *err;
21572 } LDKCResult_HtlcKeyDecodeErrorZPtr;
21573
21574 /**
21575  * A CResult_HtlcKeyDecodeErrorZ represents the result of a fallible operation,
21576  * containing a crate::lightning::ln::channel_keys::HtlcKey on success and a crate::lightning::ln::msgs::DecodeError on failure.
21577  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
21578  */
21579 typedef struct LDKCResult_HtlcKeyDecodeErrorZ {
21580    /**
21581     * The contents of this CResult_HtlcKeyDecodeErrorZ, accessible via either
21582     * `err` or `result` depending on the state of `result_ok`.
21583     */
21584    union LDKCResult_HtlcKeyDecodeErrorZPtr contents;
21585    /**
21586     * Whether this CResult_HtlcKeyDecodeErrorZ represents a success state.
21587     */
21588    bool result_ok;
21589 } LDKCResult_HtlcKeyDecodeErrorZ;
21590
21591
21592
21593 /**
21594  * Master key used in conjunction with per_commitment_point to generate [htlcpubkey](https://github.com/lightning/bolts/blob/master/03-transactions.md#key-derivation) for the latest state of a channel.
21595  * A watcher can be given a [RevocationBasepoint] to generate per commitment [RevocationKey] to create justice transactions.
21596  */
21597 typedef struct MUST_USE_STRUCT LDKRevocationBasepoint {
21598    /**
21599     * A pointer to the opaque Rust object.
21600     * Nearly everywhere, inner must be non-null, however in places where
21601     * the Rust equivalent takes an Option, it may be set to null to indicate None.
21602     */
21603    LDKnativeRevocationBasepoint *inner;
21604    /**
21605     * Indicates that this is the only struct which contains the same pointer.
21606     * Rust functions which take ownership of an object provided via an argument require
21607     * this to be true and invalidate the object pointed to by inner.
21608     */
21609    bool is_owned;
21610 } LDKRevocationBasepoint;
21611
21612 /**
21613  * The contents of CResult_RevocationBasepointDecodeErrorZ
21614  */
21615 typedef union LDKCResult_RevocationBasepointDecodeErrorZPtr {
21616    /**
21617     * A pointer to the contents in the success state.
21618     * Reading from this pointer when `result_ok` is not set is undefined.
21619     */
21620    struct LDKRevocationBasepoint *result;
21621    /**
21622     * A pointer to the contents in the error state.
21623     * Reading from this pointer when `result_ok` is set is undefined.
21624     */
21625    struct LDKDecodeError *err;
21626 } LDKCResult_RevocationBasepointDecodeErrorZPtr;
21627
21628 /**
21629  * A CResult_RevocationBasepointDecodeErrorZ represents the result of a fallible operation,
21630  * containing a crate::lightning::ln::channel_keys::RevocationBasepoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
21631  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
21632  */
21633 typedef struct LDKCResult_RevocationBasepointDecodeErrorZ {
21634    /**
21635     * The contents of this CResult_RevocationBasepointDecodeErrorZ, accessible via either
21636     * `err` or `result` depending on the state of `result_ok`.
21637     */
21638    union LDKCResult_RevocationBasepointDecodeErrorZPtr contents;
21639    /**
21640     * Whether this CResult_RevocationBasepointDecodeErrorZ represents a success state.
21641     */
21642    bool result_ok;
21643 } LDKCResult_RevocationBasepointDecodeErrorZ;
21644
21645
21646
21647 /**
21648  * The revocation key is used to allow a channel party to revoke their state - giving their
21649  * counterparty the required material to claim all of their funds if they broadcast that state.
21650  *
21651  * Each commitment transaction has a revocation key based on the basepoint and
21652  * per_commitment_point which is used in both commitment and HTLC transactions.
21653  *
21654  * See [the BOLT spec for derivation details]
21655  * (https://github.com/lightning/bolts/blob/master/03-transactions.md#revocationpubkey-derivation)
21656  */
21657 typedef struct MUST_USE_STRUCT LDKRevocationKey {
21658    /**
21659     * A pointer to the opaque Rust object.
21660     * Nearly everywhere, inner must be non-null, however in places where
21661     * the Rust equivalent takes an Option, it may be set to null to indicate None.
21662     */
21663    LDKnativeRevocationKey *inner;
21664    /**
21665     * Indicates that this is the only struct which contains the same pointer.
21666     * Rust functions which take ownership of an object provided via an argument require
21667     * this to be true and invalidate the object pointed to by inner.
21668     */
21669    bool is_owned;
21670 } LDKRevocationKey;
21671
21672 /**
21673  * The contents of CResult_RevocationKeyDecodeErrorZ
21674  */
21675 typedef union LDKCResult_RevocationKeyDecodeErrorZPtr {
21676    /**
21677     * A pointer to the contents in the success state.
21678     * Reading from this pointer when `result_ok` is not set is undefined.
21679     */
21680    struct LDKRevocationKey *result;
21681    /**
21682     * A pointer to the contents in the error state.
21683     * Reading from this pointer when `result_ok` is set is undefined.
21684     */
21685    struct LDKDecodeError *err;
21686 } LDKCResult_RevocationKeyDecodeErrorZPtr;
21687
21688 /**
21689  * A CResult_RevocationKeyDecodeErrorZ represents the result of a fallible operation,
21690  * containing a crate::lightning::ln::channel_keys::RevocationKey on success and a crate::lightning::ln::msgs::DecodeError on failure.
21691  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
21692  */
21693 typedef struct LDKCResult_RevocationKeyDecodeErrorZ {
21694    /**
21695     * The contents of this CResult_RevocationKeyDecodeErrorZ, accessible via either
21696     * `err` or `result` depending on the state of `result_ok`.
21697     */
21698    union LDKCResult_RevocationKeyDecodeErrorZPtr contents;
21699    /**
21700     * Whether this CResult_RevocationKeyDecodeErrorZ represents a success state.
21701     */
21702    bool result_ok;
21703 } LDKCResult_RevocationKeyDecodeErrorZ;
21704
21705
21706
21707 /**
21708  * A read-only reference to a current ChannelMonitor.
21709  *
21710  * Note that this holds a mutex in [`ChainMonitor`] and may block other events until it is
21711  * released.
21712  */
21713 typedef struct MUST_USE_STRUCT LDKLockedChannelMonitor {
21714    /**
21715     * A pointer to the opaque Rust object.
21716     * Nearly everywhere, inner must be non-null, however in places where
21717     * the Rust equivalent takes an Option, it may be set to null to indicate None.
21718     */
21719    LDKnativeLockedChannelMonitor *inner;
21720    /**
21721     * Indicates that this is the only struct which contains the same pointer.
21722     * Rust functions which take ownership of an object provided via an argument require
21723     * this to be true and invalidate the object pointed to by inner.
21724     */
21725    bool is_owned;
21726 } LDKLockedChannelMonitor;
21727
21728 /**
21729  * The contents of CResult_LockedChannelMonitorNoneZ
21730  */
21731 typedef union LDKCResult_LockedChannelMonitorNoneZPtr {
21732    /**
21733     * A pointer to the contents in the success state.
21734     * Reading from this pointer when `result_ok` is not set is undefined.
21735     */
21736    struct LDKLockedChannelMonitor *result;
21737    /**
21738     * Note that this value is always NULL, as there are no contents in the Err variant
21739     */
21740    void *err;
21741 } LDKCResult_LockedChannelMonitorNoneZPtr;
21742
21743 /**
21744  * A CResult_LockedChannelMonitorNoneZ represents the result of a fallible operation,
21745  * containing a crate::lightning::chain::chainmonitor::LockedChannelMonitor on success and a () on failure.
21746  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
21747  */
21748 typedef struct LDKCResult_LockedChannelMonitorNoneZ {
21749    /**
21750     * The contents of this CResult_LockedChannelMonitorNoneZ, accessible via either
21751     * `err` or `result` depending on the state of `result_ok`.
21752     */
21753    union LDKCResult_LockedChannelMonitorNoneZPtr contents;
21754    /**
21755     * Whether this CResult_LockedChannelMonitorNoneZ represents a success state.
21756     */
21757    bool result_ok;
21758 } LDKCResult_LockedChannelMonitorNoneZ;
21759
21760 /**
21761  * A tuple of 2 elements. See the individual fields for the types contained.
21762  */
21763 typedef struct LDKC2Tuple_OutPointChannelIdZ {
21764    /**
21765     * The element at position 0
21766     */
21767    struct LDKOutPoint a;
21768    /**
21769     * The element at position 1
21770     */
21771    struct LDKChannelId b;
21772 } LDKC2Tuple_OutPointChannelIdZ;
21773
21774 /**
21775  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_OutPointChannelIdZs of arbitrary size.
21776  * This corresponds to std::vector in C++
21777  */
21778 typedef struct LDKCVec_C2Tuple_OutPointChannelIdZZ {
21779    /**
21780     * The elements in the array.
21781     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
21782     */
21783    struct LDKC2Tuple_OutPointChannelIdZ *data;
21784    /**
21785     * The number of elements pointed to by `data`.
21786     */
21787    uintptr_t datalen;
21788 } LDKCVec_C2Tuple_OutPointChannelIdZZ;
21789
21790
21791
21792 /**
21793  * An opaque identifier describing a specific [`Persist`] method call.
21794  */
21795 typedef struct MUST_USE_STRUCT LDKMonitorUpdateId {
21796    /**
21797     * A pointer to the opaque Rust object.
21798     * Nearly everywhere, inner must be non-null, however in places where
21799     * the Rust equivalent takes an Option, it may be set to null to indicate None.
21800     */
21801    LDKnativeMonitorUpdateId *inner;
21802    /**
21803     * Indicates that this is the only struct which contains the same pointer.
21804     * Rust functions which take ownership of an object provided via an argument require
21805     * this to be true and invalidate the object pointed to by inner.
21806     */
21807    bool is_owned;
21808 } LDKMonitorUpdateId;
21809
21810 /**
21811  * A dynamically-allocated array of crate::lightning::chain::chainmonitor::MonitorUpdateIds of arbitrary size.
21812  * This corresponds to std::vector in C++
21813  */
21814 typedef struct LDKCVec_MonitorUpdateIdZ {
21815    /**
21816     * The elements in the array.
21817     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
21818     */
21819    struct LDKMonitorUpdateId *data;
21820    /**
21821     * The number of elements pointed to by `data`.
21822     */
21823    uintptr_t datalen;
21824 } LDKCVec_MonitorUpdateIdZ;
21825
21826 /**
21827  * A tuple of 2 elements. See the individual fields for the types contained.
21828  */
21829 typedef struct LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ {
21830    /**
21831     * The element at position 0
21832     */
21833    struct LDKOutPoint a;
21834    /**
21835     * The element at position 1
21836     */
21837    struct LDKCVec_MonitorUpdateIdZ b;
21838 } LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ;
21839
21840 /**
21841  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZs of arbitrary size.
21842  * This corresponds to std::vector in C++
21843  */
21844 typedef struct LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
21845    /**
21846     * The elements in the array.
21847     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
21848     */
21849    struct LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *data;
21850    /**
21851     * The number of elements pointed to by `data`.
21852     */
21853    uintptr_t datalen;
21854 } LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ;
21855
21856 /**
21857  * Trait that handles persisting a [`ChannelManager`], [`NetworkGraph`], and [`WriteableScore`] to disk.
21858  *
21859  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
21860  */
21861 typedef struct LDKPersister {
21862    /**
21863     * An opaque pointer which is passed to your function implementations as an argument.
21864     * This has no meaning in the LDK, and can be NULL or any other value.
21865     */
21866    void *this_arg;
21867    /**
21868     * Persist the given ['ChannelManager'] to disk, returning an error if persistence failed.
21869     *
21870     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
21871     */
21872    struct LDKCResult_NoneIOErrorZ (*persist_manager)(const void *this_arg, const struct LDKChannelManager *NONNULL_PTR channel_manager);
21873    /**
21874     * Persist the given [`NetworkGraph`] to disk, returning an error if persistence failed.
21875     */
21876    struct LDKCResult_NoneIOErrorZ (*persist_graph)(const void *this_arg, const struct LDKNetworkGraph *NONNULL_PTR network_graph);
21877    /**
21878     * Persist the given [`WriteableScore`] to disk, returning an error if persistence failed.
21879     */
21880    struct LDKCResult_NoneIOErrorZ (*persist_scorer)(const void *this_arg, const struct LDKWriteableScore *NONNULL_PTR scorer);
21881    /**
21882     * Frees any resources associated with this object given its this_arg pointer.
21883     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
21884     */
21885    void (*free)(void *this_arg);
21886 } LDKPersister;
21887
21888
21889
21890 /**
21891  * Implements [`Persist`] in a way that writes and reads both [`ChannelMonitor`]s and
21892  * [`ChannelMonitorUpdate`]s.
21893  *
21894  * # Overview
21895  *
21896  * The main benefit this provides over the [`KVStore`]'s [`Persist`] implementation is decreased
21897  * I/O bandwidth and storage churn, at the expense of more IOPS (including listing, reading, and
21898  * deleting) and complexity. This is because it writes channel monitor differential updates,
21899  * whereas the other (default) implementation rewrites the entire monitor on each update. For
21900  * routing nodes, updates can happen many times per second to a channel, and monitors can be tens
21901  * of megabytes (or more). Updates can be as small as a few hundred bytes.
21902  *
21903  * Note that monitors written with `MonitorUpdatingPersister` are _not_ backward-compatible with
21904  * the default [`KVStore`]'s [`Persist`] implementation. They have a prepended byte sequence,
21905  * [`MONITOR_UPDATING_PERSISTER_PREPEND_SENTINEL`], applied to prevent deserialization with other
21906  * persisters. This is because monitors written by this struct _may_ have unapplied updates. In
21907  * order to downgrade, you must ensure that all updates are applied to the monitor, and remove the
21908  * sentinel bytes.
21909  *
21910  * # Storing monitors
21911  *
21912  * Monitors are stored by implementing the [`Persist`] trait, which has two functions:
21913  *
21914  *   - [`Persist::persist_new_channel`], which persists whole [`ChannelMonitor`]s.
21915  *   - [`Persist::update_persisted_channel`], which persists only a [`ChannelMonitorUpdate`]
21916  *
21917  * Whole [`ChannelMonitor`]s are stored in the [`CHANNEL_MONITOR_PERSISTENCE_PRIMARY_NAMESPACE`],
21918  * using the familiar encoding of an [`OutPoint`] (for example, `[SOME-64-CHAR-HEX-STRING]_1`).
21919  *
21920  * Each [`ChannelMonitorUpdate`] is stored in a dynamic secondary namespace, as follows:
21921  *
21922  *   - primary namespace: [`CHANNEL_MONITOR_UPDATE_PERSISTENCE_PRIMARY_NAMESPACE`]
21923  *   - secondary namespace: [the monitor's encoded outpoint name]
21924  *
21925  * Under that secondary namespace, each update is stored with a number string, like `21`, which
21926  * represents its `update_id` value.
21927  *
21928  * For example, consider this channel, named for its transaction ID and index, or [`OutPoint`]:
21929  *
21930  *   - Transaction ID: `deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef`
21931  *   - Index: `1`
21932  *
21933  * Full channel monitors would be stored at a single key:
21934  *
21935  * `[CHANNEL_MONITOR_PERSISTENCE_PRIMARY_NAMESPACE]/deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef_1`
21936  *
21937  * Updates would be stored as follows (with `/` delimiting primary_namespace/secondary_namespace/key):
21938  *
21939  * ```text
21940  * [CHANNEL_MONITOR_UPDATE_PERSISTENCE_PRIMARY_NAMESPACE]/deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef_1/1
21941  * [CHANNEL_MONITOR_UPDATE_PERSISTENCE_PRIMARY_NAMESPACE]/deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef_1/2
21942  * [CHANNEL_MONITOR_UPDATE_PERSISTENCE_PRIMARY_NAMESPACE]/deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef_1/3
21943  * ```
21944  * ... and so on.
21945  *
21946  * # Reading channel state from storage
21947  *
21948  * Channel state can be reconstructed by calling
21949  * [`MonitorUpdatingPersister::read_all_channel_monitors_with_updates`]. Alternatively, users can
21950  * list channel monitors themselves and load channels individually using
21951  * [`MonitorUpdatingPersister::read_channel_monitor_with_updates`].
21952  *
21953  * ## EXTREMELY IMPORTANT
21954  *
21955  * It is extremely important that your [`KVStore::read`] implementation uses the
21956  * [`io::ErrorKind::NotFound`] variant correctly: that is, when a file is not found, and _only_ in
21957  * that circumstance (not when there is really a permissions error, for example). This is because
21958  * neither channel monitor reading function lists updates. Instead, either reads the monitor, and
21959  * using its stored `update_id`, synthesizes update storage keys, and tries them in sequence until
21960  * one is not found. All _other_ errors will be bubbled up in the function's [`Result`].
21961  *
21962  * # Pruning stale channel updates
21963  *
21964  * Stale updates are pruned when the consolidation threshold is reached according to `maximum_pending_updates`.
21965  * Monitor updates in the range between the latest `update_id` and `update_id - maximum_pending_updates`
21966  * are deleted.
21967  * The `lazy` flag is used on the [`KVStore::remove`] method, so there are no guarantees that the deletions
21968  * will complete. However, stale updates are not a problem for data integrity, since updates are
21969  * only read that are higher than the stored [`ChannelMonitor`]'s `update_id`.
21970  *
21971  * If you have many stale updates stored (such as after a crash with pending lazy deletes), and
21972  * would like to get rid of them, consider using the
21973  * [`MonitorUpdatingPersister::cleanup_stale_updates`] function.
21974  */
21975 typedef struct MUST_USE_STRUCT LDKMonitorUpdatingPersister {
21976    /**
21977     * A pointer to the opaque Rust object.
21978     * Nearly everywhere, inner must be non-null, however in places where
21979     * the Rust equivalent takes an Option, it may be set to null to indicate None.
21980     */
21981    LDKnativeMonitorUpdatingPersister *inner;
21982    /**
21983     * Indicates that this is the only struct which contains the same pointer.
21984     * Rust functions which take ownership of an object provided via an argument require
21985     * this to be true and invalidate the object pointed to by inner.
21986     */
21987    bool is_owned;
21988 } LDKMonitorUpdatingPersister;
21989
21990 /**
21991  * `Persist` defines behavior for persisting channel monitors: this could mean
21992  * writing once to disk, and/or uploading to one or more backup services.
21993  *
21994  * Persistence can happen in one of two ways - synchronously completing before the trait method
21995  * calls return or asynchronously in the background.
21996  *
21997  * # For those implementing synchronous persistence
21998  *
21999  *  * If persistence completes fully (including any relevant `fsync()` calls), the implementation
22000  *    should return [`ChannelMonitorUpdateStatus::Completed`], indicating normal channel operation
22001  *    should continue.
22002  *
22003  *  * If persistence fails for some reason, implementations should consider returning
22004  *    [`ChannelMonitorUpdateStatus::InProgress`] and retry all pending persistence operations in
22005  *    the background with [`ChainMonitor::list_pending_monitor_updates`] and
22006  *    [`ChainMonitor::get_monitor`].
22007  *
22008  *    Once a full [`ChannelMonitor`] has been persisted, all pending updates for that channel can
22009  *    be marked as complete via [`ChainMonitor::channel_monitor_updated`].
22010  *
22011  *    If at some point no further progress can be made towards persisting the pending updates, the
22012  *    node should simply shut down.
22013  *
22014  *  * If the persistence has failed and cannot be retried further (e.g. because of an outage),
22015  *    [`ChannelMonitorUpdateStatus::UnrecoverableError`] can be used, though this will result in
22016  *    an immediate panic and future operations in LDK generally failing.
22017  *
22018  * # For those implementing asynchronous persistence
22019  *
22020  *  All calls should generally spawn a background task and immediately return
22021  *  [`ChannelMonitorUpdateStatus::InProgress`]. Once the update completes,
22022  *  [`ChainMonitor::channel_monitor_updated`] should be called with the corresponding
22023  *  [`MonitorUpdateId`].
22024  *
22025  *  Note that unlike the direct [`chain::Watch`] interface,
22026  *  [`ChainMonitor::channel_monitor_updated`] must be called once for *each* update which occurs.
22027  *
22028  *  If at some point no further progress can be made towards persisting a pending update, the node
22029  *  should simply shut down. Until then, the background task should either loop indefinitely, or
22030  *  persistence should be regularly retried with [`ChainMonitor::list_pending_monitor_updates`]
22031  *  and [`ChainMonitor::get_monitor`] (note that if a full monitor is persisted all pending
22032  *  monitor updates may be marked completed).
22033  *
22034  * # Using remote watchtowers
22035  *
22036  * Watchtowers may be updated as a part of an implementation of this trait, utilizing the async
22037  * update process described above while the watchtower is being updated. The following methods are
22038  * provided for bulding transactions for a watchtower:
22039  * [`ChannelMonitor::initial_counterparty_commitment_tx`],
22040  * [`ChannelMonitor::counterparty_commitment_txs_from_update`],
22041  * [`ChannelMonitor::sign_to_local_justice_tx`], [`TrustedCommitmentTransaction::revokeable_output_index`],
22042  * [`TrustedCommitmentTransaction::build_to_local_justice_tx`].
22043  *
22044  * [`TrustedCommitmentTransaction::revokeable_output_index`]: crate::ln::chan_utils::TrustedCommitmentTransaction::revokeable_output_index
22045  * [`TrustedCommitmentTransaction::build_to_local_justice_tx`]: crate::ln::chan_utils::TrustedCommitmentTransaction::build_to_local_justice_tx
22046  */
22047 typedef struct LDKPersist {
22048    /**
22049     * An opaque pointer which is passed to your function implementations as an argument.
22050     * This has no meaning in the LDK, and can be NULL or any other value.
22051     */
22052    void *this_arg;
22053    /**
22054     * Persist a new channel's data in response to a [`chain::Watch::watch_channel`] call. This is
22055     * called by [`ChannelManager`] for new channels, or may be called directly, e.g. on startup.
22056     *
22057     * The data can be stored any way you want, but the identifier provided by LDK is the
22058     * channel's outpoint (and it is up to you to maintain a correct mapping between the outpoint
22059     * and the stored channel data). Note that you **must** persist every new monitor to disk.
22060     *
22061     * The `update_id` is used to identify this call to [`ChainMonitor::channel_monitor_updated`],
22062     * if you return [`ChannelMonitorUpdateStatus::InProgress`].
22063     *
22064     * See [`Writeable::write`] on [`ChannelMonitor`] for writing out a `ChannelMonitor`
22065     * and [`ChannelMonitorUpdateStatus`] for requirements when returning errors.
22066     *
22067     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
22068     * [`Writeable::write`]: crate::util::ser::Writeable::write
22069     */
22070    enum LDKChannelMonitorUpdateStatus (*persist_new_channel)(const void *this_arg, struct LDKOutPoint channel_funding_outpoint, const struct LDKChannelMonitor *NONNULL_PTR data, struct LDKMonitorUpdateId update_id);
22071    /**
22072     * Update one channel's data. The provided [`ChannelMonitor`] has already applied the given
22073     * update.
22074     *
22075     * Note that on every update, you **must** persist either the [`ChannelMonitorUpdate`] or the
22076     * updated monitor itself to disk/backups. See the [`Persist`] trait documentation for more
22077     * details.
22078     *
22079     * During blockchain synchronization operations, and in some rare cases, this may be called with
22080     * no [`ChannelMonitorUpdate`], in which case the full [`ChannelMonitor`] needs to be persisted.
22081     * Note that after the full [`ChannelMonitor`] is persisted any previous
22082     * [`ChannelMonitorUpdate`]s which were persisted should be discarded - they can no longer be
22083     * applied to the persisted [`ChannelMonitor`] as they were already applied.
22084     *
22085     * If an implementer chooses to persist the updates only, they need to make
22086     * sure that all the updates are applied to the `ChannelMonitors` *before*
22087     * the set of channel monitors is given to the `ChannelManager`
22088     * deserialization routine. See [`ChannelMonitor::update_monitor`] for
22089     * applying a monitor update to a monitor. If full `ChannelMonitors` are
22090     * persisted, then there is no need to persist individual updates.
22091     *
22092     * Note that there could be a performance tradeoff between persisting complete
22093     * channel monitors on every update vs. persisting only updates and applying
22094     * them in batches. The size of each monitor grows `O(number of state updates)`
22095     * whereas updates are small and `O(1)`.
22096     *
22097     * The `update_id` is used to identify this call to [`ChainMonitor::channel_monitor_updated`],
22098     * if you return [`ChannelMonitorUpdateStatus::InProgress`].
22099     *
22100     * See [`Writeable::write`] on [`ChannelMonitor`] for writing out a `ChannelMonitor`,
22101     * [`Writeable::write`] on [`ChannelMonitorUpdate`] for writing out an update, and
22102     * [`ChannelMonitorUpdateStatus`] for requirements when returning errors.
22103     *
22104     * [`Writeable::write`]: crate::util::ser::Writeable::write
22105     *
22106     * Note that update (or a relevant inner pointer) may be NULL or all-0s to represent None
22107     */
22108    enum LDKChannelMonitorUpdateStatus (*update_persisted_channel)(const void *this_arg, struct LDKOutPoint channel_funding_outpoint, struct LDKChannelMonitorUpdate update, const struct LDKChannelMonitor *NONNULL_PTR data, struct LDKMonitorUpdateId update_id);
22109    /**
22110     * Prevents the channel monitor from being loaded on startup.
22111     *
22112     * Archiving the data in a backup location (rather than deleting it fully) is useful for
22113     * hedging against data loss in case of unexpected failure.
22114     */
22115    void (*archive_persisted_channel)(const void *this_arg, struct LDKOutPoint channel_funding_outpoint);
22116    /**
22117     * Frees any resources associated with this object given its this_arg pointer.
22118     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
22119     */
22120    void (*free)(void *this_arg);
22121 } LDKPersist;
22122
22123
22124
22125 /**
22126  * A string that displays only printable characters, replacing control characters with
22127  * [`core::char::REPLACEMENT_CHARACTER`].
22128  */
22129 typedef struct MUST_USE_STRUCT LDKPrintableString {
22130    /**
22131     * A pointer to the opaque Rust object.
22132     * Nearly everywhere, inner must be non-null, however in places where
22133     * the Rust equivalent takes an Option, it may be set to null to indicate None.
22134     */
22135    LDKnativePrintableString *inner;
22136    /**
22137     * Indicates that this is the only struct which contains the same pointer.
22138     * Rust functions which take ownership of an object provided via an argument require
22139     * this to be true and invalidate the object pointed to by inner.
22140     */
22141    bool is_owned;
22142 } LDKPrintableString;
22143
22144 /**
22145  * The `Listen` trait is used to notify when blocks have been connected or disconnected from the
22146  * chain.
22147  *
22148  * Useful when needing to replay chain data upon startup or as new chain events occur. Clients
22149  * sourcing chain data using a block-oriented API should prefer this interface over [`Confirm`].
22150  * Such clients fetch the entire header chain whereas clients using [`Confirm`] only fetch headers
22151  * when needed.
22152  *
22153  * By using [`Listen::filtered_block_connected`] this interface supports clients fetching the
22154  * entire header chain and only blocks with matching transaction data using BIP 157 filters or
22155  * other similar filtering.
22156  */
22157 typedef struct LDKListen {
22158    /**
22159     * An opaque pointer which is passed to your function implementations as an argument.
22160     * This has no meaning in the LDK, and can be NULL or any other value.
22161     */
22162    void *this_arg;
22163    /**
22164     * Notifies the listener that a block was added at the given height, with the transaction data
22165     * possibly filtered.
22166     */
22167    void (*filtered_block_connected)(const void *this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height);
22168    /**
22169     * Notifies the listener that a block was added at the given height.
22170     */
22171    void (*block_connected)(const void *this_arg, struct LDKu8slice block, uint32_t height);
22172    /**
22173     * Notifies the listener that a block was removed at the given height.
22174     */
22175    void (*block_disconnected)(const void *this_arg, const uint8_t (*header)[80], uint32_t height);
22176    /**
22177     * Frees any resources associated with this object given its this_arg pointer.
22178     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
22179     */
22180    void (*free)(void *this_arg);
22181 } LDKListen;
22182
22183 /**
22184  * The `Confirm` trait is used to notify LDK when relevant transactions have been confirmed on
22185  * chain or unconfirmed during a chain reorganization.
22186  *
22187  * Clients sourcing chain data using a transaction-oriented API should prefer this interface over
22188  * [`Listen`]. For instance, an Electrum-based transaction sync implementation may implement
22189  * [`Filter`] to subscribe to relevant transactions and unspent outputs it should monitor for
22190  * on-chain activity. Then, it needs to notify LDK via this interface upon observing any changes
22191  * with reference to the confirmation status of the monitored objects.
22192  *
22193  * # Use
22194  * The intended use is as follows:
22195  * - Call [`transactions_confirmed`] to notify LDK whenever any of the registered transactions or
22196  *   outputs are, respectively, confirmed or spent on chain.
22197  * - Call [`transaction_unconfirmed`] to notify LDK whenever any transaction returned by
22198  *   [`get_relevant_txids`] is no longer confirmed in the block with the given block hash.
22199  * - Call [`best_block_updated`] to notify LDK whenever a new chain tip becomes available.
22200  *
22201  * # Order
22202  *
22203  * Clients must call these methods in chain order. Specifically:
22204  * - Transactions which are confirmed in a particular block must be given before transactions
22205  *   confirmed in a later block.
22206  * - Dependent transactions within the same block must be given in topological order, possibly in
22207  *   separate calls.
22208  * - All unconfirmed transactions must be given after the original confirmations and before *any*
22209  *   reconfirmations, i.e., [`transactions_confirmed`] and [`transaction_unconfirmed`] calls should
22210  *   never be interleaved, but always conduced *en bloc*.
22211  * - Any reconfirmed transactions need to be explicitly unconfirmed before they are reconfirmed
22212  *   in regard to the new block.
22213  *
22214  * See individual method documentation for further details.
22215  *
22216  * [`transactions_confirmed`]: Self::transactions_confirmed
22217  * [`transaction_unconfirmed`]: Self::transaction_unconfirmed
22218  * [`best_block_updated`]: Self::best_block_updated
22219  * [`get_relevant_txids`]: Self::get_relevant_txids
22220  */
22221 typedef struct LDKConfirm {
22222    /**
22223     * An opaque pointer which is passed to your function implementations as an argument.
22224     * This has no meaning in the LDK, and can be NULL or any other value.
22225     */
22226    void *this_arg;
22227    /**
22228     * Notifies LDK of transactions confirmed in a block with a given header and height.
22229     *
22230     * Must be called for any transactions registered by [`Filter::register_tx`] or any
22231     * transactions spending an output registered by [`Filter::register_output`]. Such transactions
22232     * appearing in the same block do not need to be included in the same call; instead, multiple
22233     * calls with additional transactions may be made so long as they are made in [chain order].
22234     *
22235     * May be called before or after [`best_block_updated`] for the corresponding block. However,
22236     * in the event of a chain reorganization, it must not be called with a `header` that is no
22237     * longer in the chain as of the last call to [`best_block_updated`].
22238     *
22239     * [chain order]: Confirm#order
22240     * [`best_block_updated`]: Self::best_block_updated
22241     */
22242    void (*transactions_confirmed)(const void *this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height);
22243    /**
22244     * Notifies LDK of a transaction that is no longer confirmed as result of a chain reorganization.
22245     *
22246     * Must be called for any transaction returned by [`get_relevant_txids`] if it has been
22247     * reorganized out of the best chain or if it is no longer confirmed in the block with the
22248     * given block hash. Once called, the given transaction will not be returned
22249     * by [`get_relevant_txids`], unless it has been reconfirmed via [`transactions_confirmed`].
22250     *
22251     * [`get_relevant_txids`]: Self::get_relevant_txids
22252     * [`transactions_confirmed`]: Self::transactions_confirmed
22253     */
22254    void (*transaction_unconfirmed)(const void *this_arg, const uint8_t (*txid)[32]);
22255    /**
22256     * Notifies LDK of an update to the best header connected at the given height.
22257     *
22258     * Must be called whenever a new chain tip becomes available. May be skipped for intermediary
22259     * blocks.
22260     */
22261    void (*best_block_updated)(const void *this_arg, const uint8_t (*header)[80], uint32_t height);
22262    /**
22263     * Returns transactions that must be monitored for reorganization out of the chain along
22264     * with the height and the hash of the block as part of which it had been previously confirmed.
22265     *
22266     * Note that the returned `Option<BlockHash>` might be `None` for channels created with LDK
22267     * 0.0.112 and prior, in which case you need to manually track previous confirmations.
22268     *
22269     * Will include any transactions passed to [`transactions_confirmed`] that have insufficient
22270     * confirmations to be safe from a chain reorganization. Will not include any transactions
22271     * passed to [`transaction_unconfirmed`], unless later reconfirmed.
22272     *
22273     * Must be called to determine the subset of transactions that must be monitored for
22274     * reorganization. Will be idempotent between calls but may change as a result of calls to the
22275     * other interface methods. Thus, this is useful to determine which transactions must be
22276     * given to [`transaction_unconfirmed`].
22277     *
22278     * If any of the returned transactions are confirmed in a block other than the one with the
22279     * given hash at the given height, they need to be unconfirmed and reconfirmed via
22280     * [`transaction_unconfirmed`] and [`transactions_confirmed`], respectively.
22281     *
22282     * [`transactions_confirmed`]: Self::transactions_confirmed
22283     * [`transaction_unconfirmed`]: Self::transaction_unconfirmed
22284     */
22285    struct LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ (*get_relevant_txids)(const void *this_arg);
22286    /**
22287     * Frees any resources associated with this object given its this_arg pointer.
22288     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
22289     */
22290    void (*free)(void *this_arg);
22291 } LDKConfirm;
22292
22293 /**
22294  * A `enum` signalling to the [`OutputSweeper`] that it should delay spending an output until a
22295  * future block height is reached.
22296  */
22297 typedef enum LDKSpendingDelay_Tag {
22298    /**
22299     * A relative delay indicating we shouldn't spend the output before `cur_height + num_blocks`
22300     * is reached.
22301     */
22302    LDKSpendingDelay_Relative,
22303    /**
22304     * An absolute delay indicating we shouldn't spend the output before `height` is reached.
22305     */
22306    LDKSpendingDelay_Absolute,
22307    /**
22308     * Must be last for serialization purposes
22309     */
22310    LDKSpendingDelay_Sentinel,
22311 } LDKSpendingDelay_Tag;
22312
22313 typedef struct LDKSpendingDelay_LDKRelative_Body {
22314    /**
22315     * The number of blocks until we'll generate and broadcast the spending transaction.
22316     */
22317    uint32_t num_blocks;
22318 } LDKSpendingDelay_LDKRelative_Body;
22319
22320 typedef struct LDKSpendingDelay_LDKAbsolute_Body {
22321    /**
22322     * The height at which we'll generate and broadcast the spending transaction.
22323     */
22324    uint32_t height;
22325 } LDKSpendingDelay_LDKAbsolute_Body;
22326
22327 typedef struct MUST_USE_STRUCT LDKSpendingDelay {
22328    LDKSpendingDelay_Tag tag;
22329    union {
22330       LDKSpendingDelay_LDKRelative_Body relative;
22331       LDKSpendingDelay_LDKAbsolute_Body absolute;
22332    };
22333 } LDKSpendingDelay;
22334
22335 /**
22336  * A callback which is called when a [`Future`] completes.
22337  *
22338  * Note that this MUST NOT call back into LDK directly, it must instead schedule actions to be
22339  * taken later. Rust users should use the [`std::future::Future`] implementation for [`Future`]
22340  * instead.
22341  *
22342  * Note that the [`std::future::Future`] implementation may only work for runtimes which schedule
22343  * futures when they receive a wake, rather than immediately executing them.
22344  */
22345 typedef struct LDKFutureCallback {
22346    /**
22347     * An opaque pointer which is passed to your function implementations as an argument.
22348     * This has no meaning in the LDK, and can be NULL or any other value.
22349     */
22350    void *this_arg;
22351    /**
22352     * The method which is called.
22353     */
22354    void (*call)(const void *this_arg);
22355    /**
22356     * Frees any resources associated with this object given its this_arg pointer.
22357     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
22358     */
22359    void (*free)(void *this_arg);
22360 } LDKFutureCallback;
22361
22362
22363
22364 /**
22365  * A struct which can be used to select across many [`Future`]s at once without relying on a full
22366  * async context.
22367  */
22368 typedef struct MUST_USE_STRUCT LDKSleeper {
22369    /**
22370     * A pointer to the opaque Rust object.
22371     * Nearly everywhere, inner must be non-null, however in places where
22372     * the Rust equivalent takes an Option, it may be set to null to indicate None.
22373     */
22374    LDKnativeSleeper *inner;
22375    /**
22376     * Indicates that this is the only struct which contains the same pointer.
22377     * Rust functions which take ownership of an object provided via an argument require
22378     * this to be true and invalidate the object pointed to by inner.
22379     */
22380    bool is_owned;
22381 } LDKSleeper;
22382
22383
22384
22385 /**
22386  * Configuration we set when applicable.
22387  *
22388  * Default::default() provides sane defaults.
22389  */
22390 typedef struct MUST_USE_STRUCT LDKChannelHandshakeConfig {
22391    /**
22392     * A pointer to the opaque Rust object.
22393     * Nearly everywhere, inner must be non-null, however in places where
22394     * the Rust equivalent takes an Option, it may be set to null to indicate None.
22395     */
22396    LDKnativeChannelHandshakeConfig *inner;
22397    /**
22398     * Indicates that this is the only struct which contains the same pointer.
22399     * Rust functions which take ownership of an object provided via an argument require
22400     * this to be true and invalidate the object pointed to by inner.
22401     */
22402    bool is_owned;
22403 } LDKChannelHandshakeConfig;
22404
22405
22406
22407 /**
22408  * Optional channel limits which are applied during channel creation.
22409  *
22410  * These limits are only applied to our counterparty's limits, not our own.
22411  *
22412  * Use 0/`<type>::max_value()` as appropriate to skip checking.
22413  *
22414  * Provides sane defaults for most configurations.
22415  *
22416  * Most additional limits are disabled except those with which specify a default in individual
22417  * field documentation. Note that this may result in barely-usable channels, but since they
22418  * are applied mostly only to incoming channels that's not much of a problem.
22419  */
22420 typedef struct MUST_USE_STRUCT LDKChannelHandshakeLimits {
22421    /**
22422     * A pointer to the opaque Rust object.
22423     * Nearly everywhere, inner must be non-null, however in places where
22424     * the Rust equivalent takes an Option, it may be set to null to indicate None.
22425     */
22426    LDKnativeChannelHandshakeLimits *inner;
22427    /**
22428     * Indicates that this is the only struct which contains the same pointer.
22429     * Rust functions which take ownership of an object provided via an argument require
22430     * this to be true and invalidate the object pointed to by inner.
22431     */
22432    bool is_owned;
22433 } LDKChannelHandshakeLimits;
22434
22435
22436
22437 /**
22438  * A parallel struct to [`ChannelConfig`] to define partial updates.
22439  */
22440 typedef struct MUST_USE_STRUCT LDKChannelConfigUpdate {
22441    /**
22442     * A pointer to the opaque Rust object.
22443     * Nearly everywhere, inner must be non-null, however in places where
22444     * the Rust equivalent takes an Option, it may be set to null to indicate None.
22445     */
22446    LDKnativeChannelConfigUpdate *inner;
22447    /**
22448     * Indicates that this is the only struct which contains the same pointer.
22449     * Rust functions which take ownership of an object provided via an argument require
22450     * this to be true and invalidate the object pointed to by inner.
22451     */
22452    bool is_owned;
22453 } LDKChannelConfigUpdate;
22454
22455
22456
22457 /**
22458  * Top-level config which holds ChannelHandshakeLimits and ChannelConfig.
22459  *
22460  * Default::default() provides sane defaults for most configurations
22461  * (but currently with 0 relay fees!)
22462  */
22463 typedef struct MUST_USE_STRUCT LDKUserConfig {
22464    /**
22465     * A pointer to the opaque Rust object.
22466     * Nearly everywhere, inner must be non-null, however in places where
22467     * the Rust equivalent takes an Option, it may be set to null to indicate None.
22468     */
22469    LDKnativeUserConfig *inner;
22470    /**
22471     * Indicates that this is the only struct which contains the same pointer.
22472     * Rust functions which take ownership of an object provided via an argument require
22473     * this to be true and invalidate the object pointed to by inner.
22474     */
22475    bool is_owned;
22476 } LDKUserConfig;
22477
22478
22479
22480 /**
22481  * An implementation of [`chain::Watch`] for monitoring channels.
22482  *
22483  * Connected and disconnected blocks must be provided to `ChainMonitor` as documented by
22484  * [`chain::Watch`]. May be used in conjunction with [`ChannelManager`] to monitor channels locally
22485  * or used independently to monitor channels remotely. See the [module-level documentation] for
22486  * details.
22487  *
22488  * Note that `ChainMonitor` should regularly trigger rebroadcasts/fee bumps of pending claims from
22489  * a force-closed channel. This is crucial in preventing certain classes of pinning attacks,
22490  * detecting substantial mempool feerate changes between blocks, and ensuring reliability if
22491  * broadcasting fails. We recommend invoking this every 30 seconds, or lower if running in an
22492  * environment with spotty connections, like on mobile.
22493  *
22494  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
22495  * [module-level documentation]: crate::chain::chainmonitor
22496  * [`rebroadcast_pending_claims`]: Self::rebroadcast_pending_claims
22497  */
22498 typedef struct MUST_USE_STRUCT LDKChainMonitor {
22499    /**
22500     * A pointer to the opaque Rust object.
22501     * Nearly everywhere, inner must be non-null, however in places where
22502     * the Rust equivalent takes an Option, it may be set to null to indicate None.
22503     */
22504    LDKnativeChainMonitor *inner;
22505    /**
22506     * Indicates that this is the only struct which contains the same pointer.
22507     * Rust functions which take ownership of an object provided via an argument require
22508     * this to be true and invalidate the object pointed to by inner.
22509     */
22510    bool is_owned;
22511 } LDKChainMonitor;
22512
22513 /**
22514  * A trait implemented for objects handling events from [`EventsProvider`].
22515  *
22516  * An async variation also exists for implementations of [`EventsProvider`] that support async
22517  * event handling. The async event handler should satisfy the generic bounds: `F:
22518  * core::future::Future, H: Fn(Event) -> F`.
22519  */
22520 typedef struct LDKEventHandler {
22521    /**
22522     * An opaque pointer which is passed to your function implementations as an argument.
22523     * This has no meaning in the LDK, and can be NULL or any other value.
22524     */
22525    void *this_arg;
22526    /**
22527     * Handles the given [`Event`].
22528     *
22529     * See [`EventsProvider`] for details that must be considered when implementing this method.
22530     */
22531    void (*handle_event)(const void *this_arg, struct LDKEvent event);
22532    /**
22533     * Frees any resources associated with this object given its this_arg pointer.
22534     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
22535     */
22536    void (*free)(void *this_arg);
22537 } LDKEventHandler;
22538
22539 /**
22540  * A trait indicating an object may generate events.
22541  *
22542  * Events are processed by passing an [`EventHandler`] to [`process_pending_events`].
22543  *
22544  * Implementations of this trait may also feature an async version of event handling, as shown with
22545  * [`ChannelManager::process_pending_events_async`] and
22546  * [`ChainMonitor::process_pending_events_async`].
22547  *
22548  * # Requirements
22549  *
22550  * When using this trait, [`process_pending_events`] will call [`handle_event`] for each pending
22551  * event since the last invocation.
22552  *
22553  * In order to ensure no [`Event`]s are lost, implementors of this trait will persist [`Event`]s
22554  * and replay any unhandled events on startup. An [`Event`] is considered handled when
22555  * [`process_pending_events`] returns, thus handlers MUST fully handle [`Event`]s and persist any
22556  * relevant changes to disk *before* returning.
22557  *
22558  * Further, because an application may crash between an [`Event`] being handled and the
22559  * implementor of this trait being re-serialized, [`Event`] handling must be idempotent - in
22560  * effect, [`Event`]s may be replayed.
22561  *
22562  * Note, handlers may call back into the provider and thus deadlocking must be avoided. Be sure to
22563  * consult the provider's documentation on the implication of processing events and how a handler
22564  * may safely use the provider (e.g., see [`ChannelManager::process_pending_events`] and
22565  * [`ChainMonitor::process_pending_events`]).
22566  *
22567  * (C-not implementable) As there is likely no reason for a user to implement this trait on their
22568  * own type(s).
22569  *
22570  * [`process_pending_events`]: Self::process_pending_events
22571  * [`handle_event`]: EventHandler::handle_event
22572  * [`ChannelManager::process_pending_events`]: crate::ln::channelmanager::ChannelManager#method.process_pending_events
22573  * [`ChainMonitor::process_pending_events`]: crate::chain::chainmonitor::ChainMonitor#method.process_pending_events
22574  * [`ChannelManager::process_pending_events_async`]: crate::ln::channelmanager::ChannelManager::process_pending_events_async
22575  * [`ChainMonitor::process_pending_events_async`]: crate::chain::chainmonitor::ChainMonitor::process_pending_events_async
22576  */
22577 typedef struct LDKEventsProvider {
22578    /**
22579     * An opaque pointer which is passed to your function implementations as an argument.
22580     * This has no meaning in the LDK, and can be NULL or any other value.
22581     */
22582    void *this_arg;
22583    /**
22584     * Processes any events generated since the last call using the given event handler.
22585     *
22586     * See the trait-level documentation for requirements.
22587     */
22588    void (*process_pending_events)(const void *this_arg, struct LDKEventHandler handler);
22589    /**
22590     * Frees any resources associated with this object given its this_arg pointer.
22591     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
22592     */
22593    void (*free)(void *this_arg);
22594 } LDKEventsProvider;
22595
22596 /**
22597  * This enum is used to specify which error data to send to peers when failing back an HTLC
22598  * using [`ChannelManager::fail_htlc_backwards_with_reason`].
22599  *
22600  * For more info on failure codes, see <https://github.com/lightning/bolts/blob/master/04-onion-routing.md#failure-messages>.
22601  */
22602 typedef enum LDKFailureCode_Tag {
22603    /**
22604     * We had a temporary error processing the payment. Useful if no other error codes fit
22605     * and you want to indicate that the payer may want to retry.
22606     */
22607    LDKFailureCode_TemporaryNodeFailure,
22608    /**
22609     * We have a required feature which was not in this onion. For example, you may require
22610     * some additional metadata that was not provided with this payment.
22611     */
22612    LDKFailureCode_RequiredNodeFeatureMissing,
22613    /**
22614     * You may wish to use this when a `payment_preimage` is unknown, or the CLTV expiry of
22615     * the HTLC is too close to the current block height for safe handling.
22616     * Using this failure code in [`ChannelManager::fail_htlc_backwards_with_reason`] is
22617     * equivalent to calling [`ChannelManager::fail_htlc_backwards`].
22618     */
22619    LDKFailureCode_IncorrectOrUnknownPaymentDetails,
22620    /**
22621     * We failed to process the payload after the onion was decrypted. You may wish to
22622     * use this when receiving custom HTLC TLVs with even type numbers that you don't recognize.
22623     *
22624     * If available, the tuple data may include the type number and byte offset in the
22625     * decrypted byte stream where the failure occurred.
22626     */
22627    LDKFailureCode_InvalidOnionPayload,
22628    /**
22629     * Must be last for serialization purposes
22630     */
22631    LDKFailureCode_Sentinel,
22632 } LDKFailureCode_Tag;
22633
22634 typedef struct MUST_USE_STRUCT LDKFailureCode {
22635    LDKFailureCode_Tag tag;
22636    union {
22637       struct {
22638          struct LDKCOption_C2Tuple_u64u16ZZ invalid_onion_payload;
22639       };
22640    };
22641 } LDKFailureCode;
22642
22643
22644
22645 /**
22646  * Chain-related parameters used to construct a new `ChannelManager`.
22647  *
22648  * Typically, the block-specific parameters are derived from the best block hash for the network,
22649  * as a newly constructed `ChannelManager` will not have created any channels yet. These parameters
22650  * are not needed when deserializing a previously constructed `ChannelManager`.
22651  */
22652 typedef struct MUST_USE_STRUCT LDKChainParameters {
22653    /**
22654     * A pointer to the opaque Rust object.
22655     * Nearly everywhere, inner must be non-null, however in places where
22656     * the Rust equivalent takes an Option, it may be set to null to indicate None.
22657     */
22658    LDKnativeChainParameters *inner;
22659    /**
22660     * Indicates that this is the only struct which contains the same pointer.
22661     * Rust functions which take ownership of an object provided via an argument require
22662     * this to be true and invalidate the object pointed to by inner.
22663     */
22664    bool is_owned;
22665 } LDKChainParameters;
22666
22667 /**
22668  * A trait indicating an object may generate message send events
22669  */
22670 typedef struct LDKMessageSendEventsProvider {
22671    /**
22672     * An opaque pointer which is passed to your function implementations as an argument.
22673     * This has no meaning in the LDK, and can be NULL or any other value.
22674     */
22675    void *this_arg;
22676    /**
22677     * Gets the list of pending events which were generated by previous actions, clearing the list
22678     * in the process.
22679     */
22680    struct LDKCVec_MessageSendEventZ (*get_and_clear_pending_msg_events)(const void *this_arg);
22681    /**
22682     * Frees any resources associated with this object given its this_arg pointer.
22683     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
22684     */
22685    void (*free)(void *this_arg);
22686 } LDKMessageSendEventsProvider;
22687
22688 /**
22689  * A trait to describe an object which can receive channel messages.
22690  *
22691  * Messages MAY be called in parallel when they originate from different `their_node_ids`, however
22692  * they MUST NOT be called in parallel when the two calls have the same `their_node_id`.
22693  */
22694 typedef struct LDKChannelMessageHandler {
22695    /**
22696     * An opaque pointer which is passed to your function implementations as an argument.
22697     * This has no meaning in the LDK, and can be NULL or any other value.
22698     */
22699    void *this_arg;
22700    /**
22701     * Handle an incoming `open_channel` message from the given peer.
22702     */
22703    void (*handle_open_channel)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKOpenChannel *NONNULL_PTR msg);
22704    /**
22705     * Handle an incoming `open_channel2` message from the given peer.
22706     */
22707    void (*handle_open_channel_v2)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKOpenChannelV2 *NONNULL_PTR msg);
22708    /**
22709     * Handle an incoming `accept_channel` message from the given peer.
22710     */
22711    void (*handle_accept_channel)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKAcceptChannel *NONNULL_PTR msg);
22712    /**
22713     * Handle an incoming `accept_channel2` message from the given peer.
22714     */
22715    void (*handle_accept_channel_v2)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKAcceptChannelV2 *NONNULL_PTR msg);
22716    /**
22717     * Handle an incoming `funding_created` message from the given peer.
22718     */
22719    void (*handle_funding_created)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingCreated *NONNULL_PTR msg);
22720    /**
22721     * Handle an incoming `funding_signed` message from the given peer.
22722     */
22723    void (*handle_funding_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingSigned *NONNULL_PTR msg);
22724    /**
22725     * Handle an incoming `channel_ready` message from the given peer.
22726     */
22727    void (*handle_channel_ready)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelReady *NONNULL_PTR msg);
22728    /**
22729     * Handle an incoming `shutdown` message from the given peer.
22730     */
22731    void (*handle_shutdown)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKShutdown *NONNULL_PTR msg);
22732    /**
22733     * Handle an incoming `closing_signed` message from the given peer.
22734     */
22735    void (*handle_closing_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKClosingSigned *NONNULL_PTR msg);
22736    /**
22737     * Handle an incoming `stfu` message from the given peer.
22738     */
22739    void (*handle_stfu)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKStfu *NONNULL_PTR msg);
22740    /**
22741     * Handle an incoming `tx_add_input message` from the given peer.
22742     */
22743    void (*handle_tx_add_input)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKTxAddInput *NONNULL_PTR msg);
22744    /**
22745     * Handle an incoming `tx_add_output` message from the given peer.
22746     */
22747    void (*handle_tx_add_output)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKTxAddOutput *NONNULL_PTR msg);
22748    /**
22749     * Handle an incoming `tx_remove_input` message from the given peer.
22750     */
22751    void (*handle_tx_remove_input)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKTxRemoveInput *NONNULL_PTR msg);
22752    /**
22753     * Handle an incoming `tx_remove_output` message from the given peer.
22754     */
22755    void (*handle_tx_remove_output)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKTxRemoveOutput *NONNULL_PTR msg);
22756    /**
22757     * Handle an incoming `tx_complete message` from the given peer.
22758     */
22759    void (*handle_tx_complete)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKTxComplete *NONNULL_PTR msg);
22760    /**
22761     * Handle an incoming `tx_signatures` message from the given peer.
22762     */
22763    void (*handle_tx_signatures)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKTxSignatures *NONNULL_PTR msg);
22764    /**
22765     * Handle an incoming `tx_init_rbf` message from the given peer.
22766     */
22767    void (*handle_tx_init_rbf)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKTxInitRbf *NONNULL_PTR msg);
22768    /**
22769     * Handle an incoming `tx_ack_rbf` message from the given peer.
22770     */
22771    void (*handle_tx_ack_rbf)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKTxAckRbf *NONNULL_PTR msg);
22772    /**
22773     * Handle an incoming `tx_abort message` from the given peer.
22774     */
22775    void (*handle_tx_abort)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKTxAbort *NONNULL_PTR msg);
22776    /**
22777     * Handle an incoming `update_add_htlc` message from the given peer.
22778     */
22779    void (*handle_update_add_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateAddHTLC *NONNULL_PTR msg);
22780    /**
22781     * Handle an incoming `update_fulfill_htlc` message from the given peer.
22782     */
22783    void (*handle_update_fulfill_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFulfillHTLC *NONNULL_PTR msg);
22784    /**
22785     * Handle an incoming `update_fail_htlc` message from the given peer.
22786     */
22787    void (*handle_update_fail_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailHTLC *NONNULL_PTR msg);
22788    /**
22789     * Handle an incoming `update_fail_malformed_htlc` message from the given peer.
22790     */
22791    void (*handle_update_fail_malformed_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR msg);
22792    /**
22793     * Handle an incoming `commitment_signed` message from the given peer.
22794     */
22795    void (*handle_commitment_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKCommitmentSigned *NONNULL_PTR msg);
22796    /**
22797     * Handle an incoming `revoke_and_ack` message from the given peer.
22798     */
22799    void (*handle_revoke_and_ack)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKRevokeAndACK *NONNULL_PTR msg);
22800    /**
22801     * Handle an incoming `update_fee` message from the given peer.
22802     */
22803    void (*handle_update_fee)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFee *NONNULL_PTR msg);
22804    /**
22805     * Handle an incoming `announcement_signatures` message from the given peer.
22806     */
22807    void (*handle_announcement_signatures)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKAnnouncementSignatures *NONNULL_PTR msg);
22808    /**
22809     * Indicates a connection to the peer failed/an existing connection was lost.
22810     */
22811    void (*peer_disconnected)(const void *this_arg, struct LDKPublicKey their_node_id);
22812    /**
22813     * Handle a peer reconnecting, possibly generating `channel_reestablish` message(s).
22814     *
22815     * May return an `Err(())` if the features the peer supports are not sufficient to communicate
22816     * with us. Implementors should be somewhat conservative about doing so, however, as other
22817     * message handlers may still wish to communicate with this peer.
22818     */
22819    struct LDKCResult_NoneNoneZ (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR msg, bool inbound);
22820    /**
22821     * Handle an incoming `channel_reestablish` message from the given peer.
22822     */
22823    void (*handle_channel_reestablish)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelReestablish *NONNULL_PTR msg);
22824    /**
22825     * Handle an incoming `channel_update` message from the given peer.
22826     */
22827    void (*handle_channel_update)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelUpdate *NONNULL_PTR msg);
22828    /**
22829     * Handle an incoming `error` message from the given peer.
22830     */
22831    void (*handle_error)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKErrorMessage *NONNULL_PTR msg);
22832    /**
22833     * Gets the node feature flags which this handler itself supports. All available handlers are
22834     * queried similarly and their feature flags are OR'd together to form the [`NodeFeatures`]
22835     * which are broadcasted in our [`NodeAnnouncement`] message.
22836     */
22837    struct LDKNodeFeatures (*provided_node_features)(const void *this_arg);
22838    /**
22839     * Gets the init feature flags which should be sent to the given peer. All available handlers
22840     * are queried similarly and their feature flags are OR'd together to form the [`InitFeatures`]
22841     * which are sent in our [`Init`] message.
22842     *
22843     * Note that this method is called before [`Self::peer_connected`].
22844     */
22845    struct LDKInitFeatures (*provided_init_features)(const void *this_arg, struct LDKPublicKey their_node_id);
22846    /**
22847     * Gets the chain hashes for this `ChannelMessageHandler` indicating which chains it supports.
22848     *
22849     * If it's `None`, then no particular network chain hash compatibility will be enforced when
22850     * connecting to peers.
22851     */
22852    struct LDKCOption_CVec_ThirtyTwoBytesZZ (*get_chain_hashes)(const void *this_arg);
22853    /**
22854     * Implementation of MessageSendEventsProvider for this object.
22855     */
22856    struct LDKMessageSendEventsProvider MessageSendEventsProvider;
22857    /**
22858     * Frees any resources associated with this object given its this_arg pointer.
22859     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
22860     */
22861    void (*free)(void *this_arg);
22862 } LDKChannelMessageHandler;
22863
22864 /**
22865  * A handler for an [`OnionMessage`] containing a BOLT 12 Offers message as its payload.
22866  *
22867  * [`OnionMessage`]: crate::ln::msgs::OnionMessage
22868  */
22869 typedef struct LDKOffersMessageHandler {
22870    /**
22871     * An opaque pointer which is passed to your function implementations as an argument.
22872     * This has no meaning in the LDK, and can be NULL or any other value.
22873     */
22874    void *this_arg;
22875    /**
22876     * Handles the given message by either responding with an [`Bolt12Invoice`], sending a payment,
22877     * or replying with an error.
22878     *
22879     * The returned [`OffersMessage`], if any, is enqueued to be sent by [`OnionMessenger`].
22880     *
22881     * [`OnionMessenger`]: crate::onion_message::messenger::OnionMessenger
22882     */
22883    struct LDKCOption_OffersMessageZ (*handle_message)(const void *this_arg, struct LDKOffersMessage message);
22884    /**
22885     * Releases any [`OffersMessage`]s that need to be sent.
22886     *
22887     * Typically, this is used for messages initiating a payment flow rather than in response to
22888     * another message. The latter should use the return value of [`Self::handle_message`].
22889     */
22890    struct LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ (*release_pending_messages)(const void *this_arg);
22891    /**
22892     * Frees any resources associated with this object given its this_arg pointer.
22893     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
22894     */
22895    void (*free)(void *this_arg);
22896 } LDKOffersMessageHandler;
22897
22898 /**
22899  * An interface for looking up the node id of a channel counterparty for the purpose of forwarding
22900  * an [`OnionMessage`].
22901  *
22902  * [`OnionMessage`]: crate::ln::msgs::OnionMessage
22903  */
22904 typedef struct LDKNodeIdLookUp {
22905    /**
22906     * An opaque pointer which is passed to your function implementations as an argument.
22907     * This has no meaning in the LDK, and can be NULL or any other value.
22908     */
22909    void *this_arg;
22910    /**
22911     * Returns the node id of the forwarding node's channel counterparty with `short_channel_id`.
22912     *
22913     * Here, the forwarding node is referring to the node of the [`OnionMessenger`] parameterized
22914     * by the [`NodeIdLookUp`] and the counterparty to one of that node's peers.
22915     *
22916     * [`OnionMessenger`]: crate::onion_message::messenger::OnionMessenger
22917     *
22918     * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
22919     */
22920    struct LDKPublicKey (*next_node_id)(const void *this_arg, uint64_t short_channel_id);
22921    /**
22922     * Frees any resources associated with this object given its this_arg pointer.
22923     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
22924     */
22925    void (*free)(void *this_arg);
22926 } LDKNodeIdLookUp;
22927
22928
22929
22930 /**
22931  * Arguments for the creation of a ChannelManager that are not deserialized.
22932  *
22933  * At a high-level, the process for deserializing a ChannelManager and resuming normal operation
22934  * is:
22935  * 1) Deserialize all stored [`ChannelMonitor`]s.
22936  * 2) Deserialize the [`ChannelManager`] by filling in this struct and calling:
22937  *    `<(BlockHash, ChannelManager)>::read(reader, args)`
22938  *    This may result in closing some channels if the [`ChannelMonitor`] is newer than the stored
22939  *    [`ChannelManager`] state to ensure no loss of funds. Thus, transactions may be broadcasted.
22940  * 3) If you are not fetching full blocks, register all relevant [`ChannelMonitor`] outpoints the
22941  *    same way you would handle a [`chain::Filter`] call using
22942  *    [`ChannelMonitor::get_outputs_to_watch`] and [`ChannelMonitor::get_funding_txo`].
22943  * 4) Reconnect blocks on your [`ChannelMonitor`]s.
22944  * 5) Disconnect/connect blocks on the [`ChannelManager`].
22945  * 6) Re-persist the [`ChannelMonitor`]s to ensure the latest state is on disk.
22946  *    Note that if you're using a [`ChainMonitor`] for your [`chain::Watch`] implementation, you
22947  *    will likely accomplish this as a side-effect of calling [`chain::Watch::watch_channel`] in
22948  *    the next step.
22949  * 7) Move the [`ChannelMonitor`]s into your local [`chain::Watch`]. If you're using a
22950  *    [`ChainMonitor`], this is done by calling [`chain::Watch::watch_channel`].
22951  *
22952  * Note that the ordering of #4-7 is not of importance, however all four must occur before you
22953  * call any other methods on the newly-deserialized [`ChannelManager`].
22954  *
22955  * Note that because some channels may be closed during deserialization, it is critical that you
22956  * always deserialize only the latest version of a ChannelManager and ChannelMonitors available to
22957  * you. If you deserialize an old ChannelManager (during which force-closure transactions may be
22958  * broadcast), and then later deserialize a newer version of the same ChannelManager (which will
22959  * not force-close the same channels but consider them live), you may end up revoking a state for
22960  * which you've already broadcasted the transaction.
22961  *
22962  * [`ChainMonitor`]: crate::chain::chainmonitor::ChainMonitor
22963  */
22964 typedef struct MUST_USE_STRUCT LDKChannelManagerReadArgs {
22965    /**
22966     * A pointer to the opaque Rust object.
22967     * Nearly everywhere, inner must be non-null, however in places where
22968     * the Rust equivalent takes an Option, it may be set to null to indicate None.
22969     */
22970    LDKnativeChannelManagerReadArgs *inner;
22971    /**
22972     * Indicates that this is the only struct which contains the same pointer.
22973     * Rust functions which take ownership of an object provided via an argument require
22974     * this to be true and invalidate the object pointed to by inner.
22975     */
22976    bool is_owned;
22977 } LDKChannelManagerReadArgs;
22978
22979
22980
22981 /**
22982  * A set of keys that were HKDF-expanded from an initial call to
22983  * [`NodeSigner::get_inbound_payment_key_material`].
22984  *
22985  * [`NodeSigner::get_inbound_payment_key_material`]: crate::sign::NodeSigner::get_inbound_payment_key_material
22986  */
22987 typedef struct MUST_USE_STRUCT LDKExpandedKey {
22988    /**
22989     * A pointer to the opaque Rust object.
22990     * Nearly everywhere, inner must be non-null, however in places where
22991     * the Rust equivalent takes an Option, it may be set to null to indicate None.
22992     */
22993    LDKnativeExpandedKey *inner;
22994    /**
22995     * Indicates that this is the only struct which contains the same pointer.
22996     * Rust functions which take ownership of an object provided via an argument require
22997     * this to be true and invalidate the object pointed to by inner.
22998     */
22999    bool is_owned;
23000 } LDKExpandedKey;
23001
23002
23003
23004 /**
23005  * Contains fields that are both common to [`open_channel`] and `open_channel2` messages.
23006  *
23007  * [`open_channel`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-open_channel-message
23008  */
23009 typedef struct MUST_USE_STRUCT LDKCommonOpenChannelFields {
23010    /**
23011     * A pointer to the opaque Rust object.
23012     * Nearly everywhere, inner must be non-null, however in places where
23013     * the Rust equivalent takes an Option, it may be set to null to indicate None.
23014     */
23015    LDKnativeCommonOpenChannelFields *inner;
23016    /**
23017     * Indicates that this is the only struct which contains the same pointer.
23018     * Rust functions which take ownership of an object provided via an argument require
23019     * this to be true and invalidate the object pointed to by inner.
23020     */
23021    bool is_owned;
23022 } LDKCommonOpenChannelFields;
23023
23024
23025
23026 /**
23027  * Contains fields that are both common to [`accept_channel`] and `accept_channel2` messages.
23028  *
23029  * [`accept_channel`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-accept_channel-message
23030  */
23031 typedef struct MUST_USE_STRUCT LDKCommonAcceptChannelFields {
23032    /**
23033     * A pointer to the opaque Rust object.
23034     * Nearly everywhere, inner must be non-null, however in places where
23035     * the Rust equivalent takes an Option, it may be set to null to indicate None.
23036     */
23037    LDKnativeCommonAcceptChannelFields *inner;
23038    /**
23039     * Indicates that this is the only struct which contains the same pointer.
23040     * Rust functions which take ownership of an object provided via an argument require
23041     * this to be true and invalidate the object pointed to by inner.
23042     */
23043    bool is_owned;
23044 } LDKCommonAcceptChannelFields;
23045
23046
23047
23048 /**
23049  * Packet of hop data for next peer
23050  */
23051 typedef struct MUST_USE_STRUCT LDKPacket {
23052    /**
23053     * A pointer to the opaque Rust object.
23054     * Nearly everywhere, inner must be non-null, however in places where
23055     * the Rust equivalent takes an Option, it may be set to null to indicate None.
23056     */
23057    LDKnativePacket *inner;
23058    /**
23059     * Indicates that this is the only struct which contains the same pointer.
23060     * Rust functions which take ownership of an object provided via an argument require
23061     * this to be true and invalidate the object pointed to by inner.
23062     */
23063    bool is_owned;
23064 } LDKPacket;
23065
23066 /**
23067  * A trait to describe an object which can receive routing messages.
23068  *
23069  * # Implementor DoS Warnings
23070  *
23071  * For messages enabled with the `gossip_queries` feature there are potential DoS vectors when
23072  * handling inbound queries. Implementors using an on-disk network graph should be aware of
23073  * repeated disk I/O for queries accessing different parts of the network graph.
23074  */
23075 typedef struct LDKRoutingMessageHandler {
23076    /**
23077     * An opaque pointer which is passed to your function implementations as an argument.
23078     * This has no meaning in the LDK, and can be NULL or any other value.
23079     */
23080    void *this_arg;
23081    /**
23082     * Handle an incoming `node_announcement` message, returning `true` if it should be forwarded on,
23083     * `false` or returning an `Err` otherwise.
23084     */
23085    struct LDKCResult_boolLightningErrorZ (*handle_node_announcement)(const void *this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
23086    /**
23087     * Handle a `channel_announcement` message, returning `true` if it should be forwarded on, `false`
23088     * or returning an `Err` otherwise.
23089     */
23090    struct LDKCResult_boolLightningErrorZ (*handle_channel_announcement)(const void *this_arg, const struct LDKChannelAnnouncement *NONNULL_PTR msg);
23091    /**
23092     * Handle an incoming `channel_update` message, returning true if it should be forwarded on,
23093     * `false` or returning an `Err` otherwise.
23094     */
23095    struct LDKCResult_boolLightningErrorZ (*handle_channel_update)(const void *this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
23096    /**
23097     * Gets channel announcements and updates required to dump our routing table to a remote node,
23098     * starting at the `short_channel_id` indicated by `starting_point` and including announcements
23099     * for a single channel.
23100     */
23101    struct LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ (*get_next_channel_announcement)(const void *this_arg, uint64_t starting_point);
23102    /**
23103     * Gets a node announcement required to dump our routing table to a remote node, starting at
23104     * the node *after* the provided pubkey and including up to one announcement immediately
23105     * higher (as defined by `<PublicKey as Ord>::cmp`) than `starting_point`.
23106     * If `None` is provided for `starting_point`, we start at the first node.
23107     *
23108     * Note that starting_point (or a relevant inner pointer) may be NULL or all-0s to represent None
23109     * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
23110     */
23111    struct LDKNodeAnnouncement (*get_next_node_announcement)(const void *this_arg, struct LDKNodeId starting_point);
23112    /**
23113     * Called when a connection is established with a peer. This can be used to
23114     * perform routing table synchronization using a strategy defined by the
23115     * implementor.
23116     *
23117     * May return an `Err(())` if the features the peer supports are not sufficient to communicate
23118     * with us. Implementors should be somewhat conservative about doing so, however, as other
23119     * message handlers may still wish to communicate with this peer.
23120     */
23121    struct LDKCResult_NoneNoneZ (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR init, bool inbound);
23122    /**
23123     * Handles the reply of a query we initiated to learn about channels
23124     * for a given range of blocks. We can expect to receive one or more
23125     * replies to a single query.
23126     */
23127    struct LDKCResult_NoneLightningErrorZ (*handle_reply_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyChannelRange msg);
23128    /**
23129     * Handles the reply of a query we initiated asking for routing gossip
23130     * messages for a list of channels. We should receive this message when
23131     * a node has completed its best effort to send us the pertaining routing
23132     * gossip messages.
23133     */
23134    struct LDKCResult_NoneLightningErrorZ (*handle_reply_short_channel_ids_end)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyShortChannelIdsEnd msg);
23135    /**
23136     * Handles when a peer asks us to send a list of `short_channel_id`s
23137     * for the requested range of blocks.
23138     */
23139    struct LDKCResult_NoneLightningErrorZ (*handle_query_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryChannelRange msg);
23140    /**
23141     * Handles when a peer asks us to send routing gossip messages for a
23142     * list of `short_channel_id`s.
23143     */
23144    struct LDKCResult_NoneLightningErrorZ (*handle_query_short_channel_ids)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryShortChannelIds msg);
23145    /**
23146     * Indicates that there are a large number of [`ChannelAnnouncement`] (or other) messages
23147     * pending some async action. While there is no guarantee of the rate of future messages, the
23148     * caller should seek to reduce the rate of new gossip messages handled, especially
23149     * [`ChannelAnnouncement`]s.
23150     */
23151    bool (*processing_queue_high)(const void *this_arg);
23152    /**
23153     * Gets the node feature flags which this handler itself supports. All available handlers are
23154     * queried similarly and their feature flags are OR'd together to form the [`NodeFeatures`]
23155     * which are broadcasted in our [`NodeAnnouncement`] message.
23156     */
23157    struct LDKNodeFeatures (*provided_node_features)(const void *this_arg);
23158    /**
23159     * Gets the init feature flags which should be sent to the given peer. All available handlers
23160     * are queried similarly and their feature flags are OR'd together to form the [`InitFeatures`]
23161     * which are sent in our [`Init`] message.
23162     *
23163     * Note that this method is called before [`Self::peer_connected`].
23164     */
23165    struct LDKInitFeatures (*provided_init_features)(const void *this_arg, struct LDKPublicKey their_node_id);
23166    /**
23167     * Implementation of MessageSendEventsProvider for this object.
23168     */
23169    struct LDKMessageSendEventsProvider MessageSendEventsProvider;
23170    /**
23171     * Frees any resources associated with this object given its this_arg pointer.
23172     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
23173     */
23174    void (*free)(void *this_arg);
23175 } LDKRoutingMessageHandler;
23176
23177 /**
23178  * A handler for received [`OnionMessage`]s and for providing generated ones to send.
23179  */
23180 typedef struct LDKOnionMessageHandler {
23181    /**
23182     * An opaque pointer which is passed to your function implementations as an argument.
23183     * This has no meaning in the LDK, and can be NULL or any other value.
23184     */
23185    void *this_arg;
23186    /**
23187     * Because much of the lightning network does not yet support forwarding onion messages, we
23188     * may need to directly connect to a node which will forward a message for us. In such a case,
23189     * this method will return the set of nodes which need connection by node_id and the
23190     * corresponding socket addresses where they may accept incoming connections.
23191     *
23192     * Thus, this method should be polled regularly to detect messages await such a direct
23193     * connection.
23194     */
23195    struct LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ (*get_and_clear_connections_needed)(const void *this_arg);
23196    /**
23197     * Handle an incoming `onion_message` message from the given peer.
23198     */
23199    void (*handle_onion_message)(const void *this_arg, struct LDKPublicKey peer_node_id, const struct LDKOnionMessage *NONNULL_PTR msg);
23200    /**
23201     * Returns the next pending onion message for the peer with the given node id.
23202     *
23203     * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
23204     */
23205    struct LDKOnionMessage (*next_onion_message_for_peer)(const void *this_arg, struct LDKPublicKey peer_node_id);
23206    /**
23207     * Called when a connection is established with a peer. Can be used to track which peers
23208     * advertise onion message support and are online.
23209     *
23210     * May return an `Err(())` if the features the peer supports are not sufficient to communicate
23211     * with us. Implementors should be somewhat conservative about doing so, however, as other
23212     * message handlers may still wish to communicate with this peer.
23213     */
23214    struct LDKCResult_NoneNoneZ (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR init, bool inbound);
23215    /**
23216     * Indicates a connection to the peer failed/an existing connection was lost. Allows handlers to
23217     * drop and refuse to forward onion messages to this peer.
23218     */
23219    void (*peer_disconnected)(const void *this_arg, struct LDKPublicKey their_node_id);
23220    /**
23221     * Performs actions that should happen roughly every ten seconds after startup. Allows handlers
23222     * to drop any buffered onion messages intended for prospective peers.
23223     */
23224    void (*timer_tick_occurred)(const void *this_arg);
23225    /**
23226     * Gets the node feature flags which this handler itself supports. All available handlers are
23227     * queried similarly and their feature flags are OR'd together to form the [`NodeFeatures`]
23228     * which are broadcasted in our [`NodeAnnouncement`] message.
23229     */
23230    struct LDKNodeFeatures (*provided_node_features)(const void *this_arg);
23231    /**
23232     * Gets the init feature flags which should be sent to the given peer. All available handlers
23233     * are queried similarly and their feature flags are OR'd together to form the [`InitFeatures`]
23234     * which are sent in our [`Init`] message.
23235     *
23236     * Note that this method is called before [`Self::peer_connected`].
23237     */
23238    struct LDKInitFeatures (*provided_init_features)(const void *this_arg, struct LDKPublicKey their_node_id);
23239    /**
23240     * Frees any resources associated with this object given its this_arg pointer.
23241     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
23242     */
23243    void (*free)(void *this_arg);
23244 } LDKOnionMessageHandler;
23245
23246
23247
23248 /**
23249  * BOLT 4 onion packet including hop data for the next peer.
23250  */
23251 typedef struct MUST_USE_STRUCT LDKTrampolineOnionPacket {
23252    /**
23253     * A pointer to the opaque Rust object.
23254     * Nearly everywhere, inner must be non-null, however in places where
23255     * the Rust equivalent takes an Option, it may be set to null to indicate None.
23256     */
23257    LDKnativeTrampolineOnionPacket *inner;
23258    /**
23259     * Indicates that this is the only struct which contains the same pointer.
23260     * Rust functions which take ownership of an object provided via an argument require
23261     * this to be true and invalidate the object pointed to by inner.
23262     */
23263    bool is_owned;
23264 } LDKTrampolineOnionPacket;
23265
23266 /**
23267  * Trait to be implemented by custom message (unrelated to the channel/gossip LN layers)
23268  * decoders.
23269  */
23270 typedef struct LDKCustomMessageReader {
23271    /**
23272     * An opaque pointer which is passed to your function implementations as an argument.
23273     * This has no meaning in the LDK, and can be NULL or any other value.
23274     */
23275    void *this_arg;
23276    /**
23277     * Decodes a custom message to `CustomMessageType`. If the given message type is known to the
23278     * implementation and the message could be decoded, must return `Ok(Some(message))`. If the
23279     * message type is unknown to the implementation, must return `Ok(None)`. If a decoding error
23280     * occur, must return `Err(DecodeError::X)` where `X` details the encountered error.
23281     */
23282    struct LDKCResult_COption_TypeZDecodeErrorZ (*read)(const void *this_arg, uint16_t message_type, struct LDKu8slice buffer);
23283    /**
23284     * Frees any resources associated with this object given its this_arg pointer.
23285     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
23286     */
23287    void (*free)(void *this_arg);
23288 } LDKCustomMessageReader;
23289
23290 /**
23291  * A handler provided to [`PeerManager`] for reading and handling custom messages.
23292  *
23293  * [BOLT 1] specifies a custom message type range for use with experimental or application-specific
23294  * messages. `CustomMessageHandler` allows for user-defined handling of such types. See the
23295  * [`lightning_custom_message`] crate for tools useful in composing more than one custom handler.
23296  *
23297  * [BOLT 1]: https://github.com/lightning/bolts/blob/master/01-messaging.md
23298  * [`lightning_custom_message`]: https://docs.rs/lightning_custom_message/latest/lightning_custom_message
23299  */
23300 typedef struct LDKCustomMessageHandler {
23301    /**
23302     * An opaque pointer which is passed to your function implementations as an argument.
23303     * This has no meaning in the LDK, and can be NULL or any other value.
23304     */
23305    void *this_arg;
23306    /**
23307     * Handles the given message sent from `sender_node_id`, possibly producing messages for
23308     * [`CustomMessageHandler::get_and_clear_pending_msg`] to return and thus for [`PeerManager`]
23309     * to send.
23310     */
23311    struct LDKCResult_NoneLightningErrorZ (*handle_custom_message)(const void *this_arg, struct LDKType msg, struct LDKPublicKey sender_node_id);
23312    /**
23313     * Returns the list of pending messages that were generated by the handler, clearing the list
23314     * in the process. Each message is paired with the node id of the intended recipient. If no
23315     * connection to the node exists, then the message is simply not sent.
23316     */
23317    struct LDKCVec_C2Tuple_PublicKeyTypeZZ (*get_and_clear_pending_msg)(const void *this_arg);
23318    /**
23319     * Gets the node feature flags which this handler itself supports. All available handlers are
23320     * queried similarly and their feature flags are OR'd together to form the [`NodeFeatures`]
23321     * which are broadcasted in our [`NodeAnnouncement`] message.
23322     *
23323     * [`NodeAnnouncement`]: crate::ln::msgs::NodeAnnouncement
23324     */
23325    struct LDKNodeFeatures (*provided_node_features)(const void *this_arg);
23326    /**
23327     * Gets the init feature flags which should be sent to the given peer. All available handlers
23328     * are queried similarly and their feature flags are OR'd together to form the [`InitFeatures`]
23329     * which are sent in our [`Init`] message.
23330     *
23331     * [`Init`]: crate::ln::msgs::Init
23332     */
23333    struct LDKInitFeatures (*provided_init_features)(const void *this_arg, struct LDKPublicKey their_node_id);
23334    /**
23335     * Implementation of CustomMessageReader for this object.
23336     */
23337    struct LDKCustomMessageReader CustomMessageReader;
23338    /**
23339     * Frees any resources associated with this object given its this_arg pointer.
23340     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
23341     */
23342    void (*free)(void *this_arg);
23343 } LDKCustomMessageHandler;
23344
23345
23346
23347 /**
23348  * A dummy struct which implements `RoutingMessageHandler` without storing any routing information
23349  * or doing any processing. You can provide one of these as the route_handler in a MessageHandler.
23350  */
23351 typedef struct MUST_USE_STRUCT LDKIgnoringMessageHandler {
23352    /**
23353     * A pointer to the opaque Rust object.
23354     * Nearly everywhere, inner must be non-null, however in places where
23355     * the Rust equivalent takes an Option, it may be set to null to indicate None.
23356     */
23357    LDKnativeIgnoringMessageHandler *inner;
23358    /**
23359     * Indicates that this is the only struct which contains the same pointer.
23360     * Rust functions which take ownership of an object provided via an argument require
23361     * this to be true and invalidate the object pointed to by inner.
23362     */
23363    bool is_owned;
23364 } LDKIgnoringMessageHandler;
23365
23366 /**
23367  * Handler for custom onion messages. If you are using [`SimpleArcOnionMessenger`],
23368  * [`SimpleRefOnionMessenger`], or prefer to ignore inbound custom onion messages,
23369  * [`IgnoringMessageHandler`] must be provided to [`OnionMessenger::new`]. Otherwise, a custom
23370  * implementation of this trait must be provided, with [`CustomMessage`] specifying the supported
23371  * message types.
23372  *
23373  * See [`OnionMessenger`] for example usage.
23374  *
23375  * [`IgnoringMessageHandler`]: crate::ln::peer_handler::IgnoringMessageHandler
23376  * [`CustomMessage`]: Self::CustomMessage
23377  */
23378 typedef struct LDKCustomOnionMessageHandler {
23379    /**
23380     * An opaque pointer which is passed to your function implementations as an argument.
23381     * This has no meaning in the LDK, and can be NULL or any other value.
23382     */
23383    void *this_arg;
23384    /**
23385     * Called with the custom message that was received, returning a response to send, if any.
23386     *
23387     * The returned [`Self::CustomMessage`], if any, is enqueued to be sent by [`OnionMessenger`].
23388     */
23389    struct LDKCOption_OnionMessageContentsZ (*handle_custom_message)(const void *this_arg, struct LDKOnionMessageContents msg);
23390    /**
23391     * Read a custom message of type `message_type` from `buffer`, returning `Ok(None)` if the
23392     * message type is unknown.
23393     */
23394    struct LDKCResult_COption_OnionMessageContentsZDecodeErrorZ (*read_custom_message)(const void *this_arg, uint64_t message_type, struct LDKu8slice buffer);
23395    /**
23396     * Releases any [`Self::CustomMessage`]s that need to be sent.
23397     *
23398     * Typically, this is used for messages initiating a message flow rather than in response to
23399     * another message. The latter should use the return value of [`Self::handle_custom_message`].
23400     */
23401    struct LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ (*release_pending_custom_messages)(const void *this_arg);
23402    /**
23403     * Frees any resources associated with this object given its this_arg pointer.
23404     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
23405     */
23406    void (*free)(void *this_arg);
23407 } LDKCustomOnionMessageHandler;
23408
23409
23410
23411 /**
23412  * A dummy struct which implements `ChannelMessageHandler` without having any channels.
23413  * You can provide one of these as the route_handler in a MessageHandler.
23414  */
23415 typedef struct MUST_USE_STRUCT LDKErroringMessageHandler {
23416    /**
23417     * A pointer to the opaque Rust object.
23418     * Nearly everywhere, inner must be non-null, however in places where
23419     * the Rust equivalent takes an Option, it may be set to null to indicate None.
23420     */
23421    LDKnativeErroringMessageHandler *inner;
23422    /**
23423     * Indicates that this is the only struct which contains the same pointer.
23424     * Rust functions which take ownership of an object provided via an argument require
23425     * this to be true and invalidate the object pointed to by inner.
23426     */
23427    bool is_owned;
23428 } LDKErroringMessageHandler;
23429
23430
23431
23432 /**
23433  * Provides references to trait impls which handle different types of messages.
23434  */
23435 typedef struct MUST_USE_STRUCT LDKMessageHandler {
23436    /**
23437     * A pointer to the opaque Rust object.
23438     * Nearly everywhere, inner must be non-null, however in places where
23439     * the Rust equivalent takes an Option, it may be set to null to indicate None.
23440     */
23441    LDKnativeMessageHandler *inner;
23442    /**
23443     * Indicates that this is the only struct which contains the same pointer.
23444     * Rust functions which take ownership of an object provided via an argument require
23445     * this to be true and invalidate the object pointed to by inner.
23446     */
23447    bool is_owned;
23448 } LDKMessageHandler;
23449
23450 /**
23451  * Provides an object which can be used to send data to and which uniquely identifies a connection
23452  * to a remote host. You will need to be able to generate multiple of these which meet Eq and
23453  * implement Hash to meet the PeerManager API.
23454  *
23455  * For efficiency, [`Clone`] should be relatively cheap for this type.
23456  *
23457  * Two descriptors may compare equal (by [`cmp::Eq`] and [`hash::Hash`]) as long as the original
23458  * has been disconnected, the [`PeerManager`] has been informed of the disconnection (either by it
23459  * having triggered the disconnection or a call to [`PeerManager::socket_disconnected`]), and no
23460  * further calls to the [`PeerManager`] related to the original socket occur. This allows you to
23461  * use a file descriptor for your SocketDescriptor directly, however for simplicity you may wish
23462  * to simply use another value which is guaranteed to be globally unique instead.
23463  */
23464 typedef struct LDKSocketDescriptor {
23465    /**
23466     * An opaque pointer which is passed to your function implementations as an argument.
23467     * This has no meaning in the LDK, and can be NULL or any other value.
23468     */
23469    void *this_arg;
23470    /**
23471     * Attempts to send some data from the given slice to the peer.
23472     *
23473     * Returns the amount of data which was sent, possibly 0 if the socket has since disconnected.
23474     * Note that in the disconnected case, [`PeerManager::socket_disconnected`] must still be
23475     * called and further write attempts may occur until that time.
23476     *
23477     * If the returned size is smaller than `data.len()`, a
23478     * [`PeerManager::write_buffer_space_avail`] call must be made the next time more data can be
23479     * written. Additionally, until a `send_data` event completes fully, no further
23480     * [`PeerManager::read_event`] calls should be made for the same peer! Because this is to
23481     * prevent denial-of-service issues, you should not read or buffer any data from the socket
23482     * until then.
23483     *
23484     * If a [`PeerManager::read_event`] call on this descriptor had previously returned true
23485     * (indicating that read events should be paused to prevent DoS in the send buffer),
23486     * `resume_read` may be set indicating that read events on this descriptor should resume. A
23487     * `resume_read` of false carries no meaning, and should not cause any action.
23488     */
23489    uintptr_t (*send_data)(void *this_arg, struct LDKu8slice data, bool resume_read);
23490    /**
23491     * Disconnect the socket pointed to by this SocketDescriptor.
23492     *
23493     * You do *not* need to call [`PeerManager::socket_disconnected`] with this socket after this
23494     * call (doing so is a noop).
23495     */
23496    void (*disconnect_socket)(void *this_arg);
23497    /**
23498     * Checks if two objects are equal given this object's this_arg pointer and another object.
23499     */
23500    bool (*eq)(const void *this_arg, const struct LDKSocketDescriptor *NONNULL_PTR other_arg);
23501    /**
23502     * Calculate a succinct non-cryptographic hash for an object given its this_arg pointer.
23503     * This is used, for example, for inclusion of this object in a hash map.
23504     */
23505    uint64_t (*hash)(const void *this_arg);
23506    /**
23507     * Called, if set, after this SocketDescriptor has been cloned into a duplicate object.
23508     * The new SocketDescriptor is provided, and should be mutated as needed to perform a
23509     * deep copy of the object pointed to by this_arg or avoid any double-freeing.
23510     */
23511    void (*cloned)(struct LDKSocketDescriptor *NONNULL_PTR new_SocketDescriptor);
23512    /**
23513     * Frees any resources associated with this object given its this_arg pointer.
23514     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
23515     */
23516    void (*free)(void *this_arg);
23517 } LDKSocketDescriptor;
23518
23519
23520
23521 /**
23522  * A PeerManager manages a set of peers, described by their [`SocketDescriptor`] and marshalls
23523  * socket events into messages which it passes on to its [`MessageHandler`].
23524  *
23525  * Locks are taken internally, so you must never assume that reentrancy from a
23526  * [`SocketDescriptor`] call back into [`PeerManager`] methods will not deadlock.
23527  *
23528  * Calls to [`read_event`] will decode relevant messages and pass them to the
23529  * [`ChannelMessageHandler`], likely doing message processing in-line. Thus, the primary form of
23530  * parallelism in Rust-Lightning is in calls to [`read_event`]. Note, however, that calls to any
23531  * [`PeerManager`] functions related to the same connection must occur only in serial, making new
23532  * calls only after previous ones have returned.
23533  *
23534  * Rather than using a plain [`PeerManager`], it is preferable to use either a [`SimpleArcPeerManager`]
23535  * a [`SimpleRefPeerManager`], for conciseness. See their documentation for more details, but
23536  * essentially you should default to using a [`SimpleRefPeerManager`], and use a
23537  * [`SimpleArcPeerManager`] when you require a `PeerManager` with a static lifetime, such as when
23538  * you're using lightning-net-tokio.
23539  *
23540  * [`read_event`]: PeerManager::read_event
23541  */
23542 typedef struct MUST_USE_STRUCT LDKPeerManager {
23543    /**
23544     * A pointer to the opaque Rust object.
23545     * Nearly everywhere, inner must be non-null, however in places where
23546     * the Rust equivalent takes an Option, it may be set to null to indicate None.
23547     */
23548    LDKnativePeerManager *inner;
23549    /**
23550     * Indicates that this is the only struct which contains the same pointer.
23551     * Rust functions which take ownership of an object provided via an argument require
23552     * this to be true and invalidate the object pointed to by inner.
23553     */
23554    bool is_owned;
23555 } LDKPeerManager;
23556
23557
23558
23559 /**
23560  * Static channel fields used to build transactions given per-commitment fields, organized by
23561  * broadcaster/countersignatory.
23562  *
23563  * This is derived from the holder/counterparty-organized ChannelTransactionParameters via the
23564  * as_holder_broadcastable and as_counterparty_broadcastable functions.
23565  */
23566 typedef struct MUST_USE_STRUCT LDKDirectedChannelTransactionParameters {
23567    /**
23568     * A pointer to the opaque Rust object.
23569     * Nearly everywhere, inner must be non-null, however in places where
23570     * the Rust equivalent takes an Option, it may be set to null to indicate None.
23571     */
23572    LDKnativeDirectedChannelTransactionParameters *inner;
23573    /**
23574     * Indicates that this is the only struct which contains the same pointer.
23575     * Rust functions which take ownership of an object provided via an argument require
23576     * this to be true and invalidate the object pointed to by inner.
23577     */
23578    bool is_owned;
23579 } LDKDirectedChannelTransactionParameters;
23580
23581
23582
23583 /**
23584  * Features used within an `offer`.
23585  */
23586 typedef struct MUST_USE_STRUCT LDKOfferFeatures {
23587    /**
23588     * A pointer to the opaque Rust object.
23589     * Nearly everywhere, inner must be non-null, however in places where
23590     * the Rust equivalent takes an Option, it may be set to null to indicate None.
23591     */
23592    LDKnativeOfferFeatures *inner;
23593    /**
23594     * Indicates that this is the only struct which contains the same pointer.
23595     * Rust functions which take ownership of an object provided via an argument require
23596     * this to be true and invalidate the object pointed to by inner.
23597     */
23598    bool is_owned;
23599 } LDKOfferFeatures;
23600
23601
23602
23603 /**
23604  * Features used within an `invoice_request`.
23605  */
23606 typedef struct MUST_USE_STRUCT LDKInvoiceRequestFeatures {
23607    /**
23608     * A pointer to the opaque Rust object.
23609     * Nearly everywhere, inner must be non-null, however in places where
23610     * the Rust equivalent takes an Option, it may be set to null to indicate None.
23611     */
23612    LDKnativeInvoiceRequestFeatures *inner;
23613    /**
23614     * Indicates that this is the only struct which contains the same pointer.
23615     * Rust functions which take ownership of an object provided via an argument require
23616     * this to be true and invalidate the object pointed to by inner.
23617     */
23618    bool is_owned;
23619 } LDKInvoiceRequestFeatures;
23620
23621
23622
23623 /**
23624  * Builds an [`Offer`] for the \"offer to be paid\" flow.
23625  *
23626  * See [module-level documentation] for usage.
23627  *
23628  * [module-level documentation]: self
23629  */
23630 typedef struct MUST_USE_STRUCT LDKOfferWithExplicitMetadataBuilder {
23631    /**
23632     * A pointer to the opaque Rust object.
23633     * Nearly everywhere, inner must be non-null, however in places where
23634     * the Rust equivalent takes an Option, it may be set to null to indicate None.
23635     */
23636    LDKnativeOfferWithExplicitMetadataBuilder *inner;
23637    /**
23638     * Indicates that this is the only struct which contains the same pointer.
23639     * Rust functions which take ownership of an object provided via an argument require
23640     * this to be true and invalidate the object pointed to by inner.
23641     */
23642    bool is_owned;
23643 } LDKOfferWithExplicitMetadataBuilder;
23644
23645 /**
23646  * Represents a tweaked X-only public key as required for BIP 340 (Taproot).
23647  */
23648 typedef struct LDKTweakedPublicKey {
23649    /**
23650     * The bytes of the public key X coordinate
23651     */
23652    uint8_t x_coordinate[32];
23653 } LDKTweakedPublicKey;
23654
23655 /**
23656  * A function for signing an [`UnsignedBolt12Invoice`].
23657  */
23658 typedef struct LDKSignBolt12InvoiceFn {
23659    /**
23660     * An opaque pointer which is passed to your function implementations as an argument.
23661     * This has no meaning in the LDK, and can be NULL or any other value.
23662     */
23663    void *this_arg;
23664    /**
23665     * Signs a [`TaggedHash`] computed over the merkle root of `message`'s TLV stream.
23666     */
23667    struct LDKCResult_SchnorrSignatureNoneZ (*sign_invoice)(const void *this_arg, const struct LDKUnsignedBolt12Invoice *NONNULL_PTR message);
23668    /**
23669     * Frees any resources associated with this object given its this_arg pointer.
23670     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
23671     */
23672    void (*free)(void *this_arg);
23673 } LDKSignBolt12InvoiceFn;
23674
23675
23676
23677 /**
23678  * A hash for use in a specific context by tweaking with a context-dependent tag as per [BIP 340]
23679  * and computed over the merkle root of a TLV stream to sign as defined in [BOLT 12].
23680  *
23681  * [BIP 340]: https://github.com/bitcoin/bips/blob/master/bip-0340.mediawiki
23682  * [BOLT 12]: https://github.com/rustyrussell/lightning-rfc/blob/guilt/offers/12-offer-encoding.md#signature-calculation
23683  */
23684 typedef struct MUST_USE_STRUCT LDKTaggedHash {
23685    /**
23686     * A pointer to the opaque Rust object.
23687     * Nearly everywhere, inner must be non-null, however in places where
23688     * the Rust equivalent takes an Option, it may be set to null to indicate None.
23689     */
23690    LDKnativeTaggedHash *inner;
23691    /**
23692     * Indicates that this is the only struct which contains the same pointer.
23693     * Rust functions which take ownership of an object provided via an argument require
23694     * this to be true and invalidate the object pointed to by inner.
23695     */
23696    bool is_owned;
23697 } LDKTaggedHash;
23698
23699
23700
23701 /**
23702  * The field in the [`InvoiceRequest`] or the [`Bolt12Invoice`] that contained an error.
23703  *
23704  * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
23705  * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
23706  */
23707 typedef struct MUST_USE_STRUCT LDKErroneousField {
23708    /**
23709     * A pointer to the opaque Rust object.
23710     * Nearly everywhere, inner must be non-null, however in places where
23711     * the Rust equivalent takes an Option, it may be set to null to indicate None.
23712     */
23713    LDKnativeErroneousField *inner;
23714    /**
23715     * Indicates that this is the only struct which contains the same pointer.
23716     * Rust functions which take ownership of an object provided via an argument require
23717     * this to be true and invalidate the object pointed to by inner.
23718     */
23719    bool is_owned;
23720 } LDKErroneousField;
23721
23722 /**
23723  * A function for signing an [`UnsignedInvoiceRequest`].
23724  */
23725 typedef struct LDKSignInvoiceRequestFn {
23726    /**
23727     * An opaque pointer which is passed to your function implementations as an argument.
23728     * This has no meaning in the LDK, and can be NULL or any other value.
23729     */
23730    void *this_arg;
23731    /**
23732     * Signs a [`TaggedHash`] computed over the merkle root of `message`'s TLV stream.
23733     */
23734    struct LDKCResult_SchnorrSignatureNoneZ (*sign_invoice_request)(const void *this_arg, const struct LDKUnsignedInvoiceRequest *NONNULL_PTR message);
23735    /**
23736     * Frees any resources associated with this object given its this_arg pointer.
23737     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
23738     */
23739    void (*free)(void *this_arg);
23740 } LDKSignInvoiceRequestFn;
23741
23742 /**
23743  * Error when signing messages.
23744  */
23745 typedef enum LDKSignError_Tag {
23746    /**
23747     * User-defined error when signing the message.
23748     */
23749    LDKSignError_Signing,
23750    /**
23751     * Error when verifying the produced signature using the given pubkey.
23752     */
23753    LDKSignError_Verification,
23754    /**
23755     * Must be last for serialization purposes
23756     */
23757    LDKSignError_Sentinel,
23758 } LDKSignError_Tag;
23759
23760 typedef struct MUST_USE_STRUCT LDKSignError {
23761    LDKSignError_Tag tag;
23762    union {
23763       struct {
23764          enum LDKSecp256k1Error verification;
23765       };
23766    };
23767 } LDKSignError;
23768
23769
23770
23771 /**
23772  * Receives and validates network updates from peers,
23773  * stores authentic and relevant data as a network graph.
23774  * This network graph is then used for routing payments.
23775  * Provides interface to help with initial routing sync by
23776  * serving historical announcements.
23777  */
23778 typedef struct MUST_USE_STRUCT LDKP2PGossipSync {
23779    /**
23780     * A pointer to the opaque Rust object.
23781     * Nearly everywhere, inner must be non-null, however in places where
23782     * the Rust equivalent takes an Option, it may be set to null to indicate None.
23783     */
23784    LDKnativeP2PGossipSync *inner;
23785    /**
23786     * Indicates that this is the only struct which contains the same pointer.
23787     * Rust functions which take ownership of an object provided via an argument require
23788     * this to be true and invalidate the object pointed to by inner.
23789     */
23790    bool is_owned;
23791 } LDKP2PGossipSync;
23792
23793
23794
23795 /**
23796  * A read-only view of [`NetworkGraph`].
23797  */
23798 typedef struct MUST_USE_STRUCT LDKReadOnlyNetworkGraph {
23799    /**
23800     * A pointer to the opaque Rust object.
23801     * Nearly everywhere, inner must be non-null, however in places where
23802     * the Rust equivalent takes an Option, it may be set to null to indicate None.
23803     */
23804    LDKnativeReadOnlyNetworkGraph *inner;
23805    /**
23806     * Indicates that this is the only struct which contains the same pointer.
23807     * Rust functions which take ownership of an object provided via an argument require
23808     * this to be true and invalidate the object pointed to by inner.
23809     */
23810    bool is_owned;
23811 } LDKReadOnlyNetworkGraph;
23812
23813
23814
23815 /**
23816  * A wrapper around [`ChannelInfo`] representing information about the channel as directed from a
23817  * source node to a target node.
23818  */
23819 typedef struct MUST_USE_STRUCT LDKDirectedChannelInfo {
23820    /**
23821     * A pointer to the opaque Rust object.
23822     * Nearly everywhere, inner must be non-null, however in places where
23823     * the Rust equivalent takes an Option, it may be set to null to indicate None.
23824     */
23825    LDKnativeDirectedChannelInfo *inner;
23826    /**
23827     * Indicates that this is the only struct which contains the same pointer.
23828     * Rust functions which take ownership of an object provided via an argument require
23829     * this to be true and invalidate the object pointed to by inner.
23830     */
23831    bool is_owned;
23832 } LDKDirectedChannelInfo;
23833
23834 /**
23835  * The effective capacity of a channel for routing purposes.
23836  *
23837  * While this may be smaller than the actual channel capacity, amounts greater than
23838  * [`Self::as_msat`] should not be routed through the channel.
23839  */
23840 typedef enum LDKEffectiveCapacity_Tag {
23841    /**
23842     * The available liquidity in the channel known from being a channel counterparty, and thus a
23843     * direct hop.
23844     */
23845    LDKEffectiveCapacity_ExactLiquidity,
23846    /**
23847     * The maximum HTLC amount in one direction as advertised on the gossip network.
23848     */
23849    LDKEffectiveCapacity_AdvertisedMaxHTLC,
23850    /**
23851     * The total capacity of the channel as determined by the funding transaction.
23852     */
23853    LDKEffectiveCapacity_Total,
23854    /**
23855     * A capacity sufficient to route any payment, typically used for private channels provided by
23856     * an invoice.
23857     */
23858    LDKEffectiveCapacity_Infinite,
23859    /**
23860     * The maximum HTLC amount as provided by an invoice route hint.
23861     */
23862    LDKEffectiveCapacity_HintMaxHTLC,
23863    /**
23864     * A capacity that is unknown possibly because either the chain state is unavailable to know
23865     * the total capacity or the `htlc_maximum_msat` was not advertised on the gossip network.
23866     */
23867    LDKEffectiveCapacity_Unknown,
23868    /**
23869     * Must be last for serialization purposes
23870     */
23871    LDKEffectiveCapacity_Sentinel,
23872 } LDKEffectiveCapacity_Tag;
23873
23874 typedef struct LDKEffectiveCapacity_LDKExactLiquidity_Body {
23875    /**
23876     * Either the inbound or outbound liquidity depending on the direction, denominated in
23877     * millisatoshi.
23878     */
23879    uint64_t liquidity_msat;
23880 } LDKEffectiveCapacity_LDKExactLiquidity_Body;
23881
23882 typedef struct LDKEffectiveCapacity_LDKAdvertisedMaxHTLC_Body {
23883    /**
23884     * The maximum HTLC amount denominated in millisatoshi.
23885     */
23886    uint64_t amount_msat;
23887 } LDKEffectiveCapacity_LDKAdvertisedMaxHTLC_Body;
23888
23889 typedef struct LDKEffectiveCapacity_LDKTotal_Body {
23890    /**
23891     * The funding amount denominated in millisatoshi.
23892     */
23893    uint64_t capacity_msat;
23894    /**
23895     * The maximum HTLC amount denominated in millisatoshi.
23896     */
23897    uint64_t htlc_maximum_msat;
23898 } LDKEffectiveCapacity_LDKTotal_Body;
23899
23900 typedef struct LDKEffectiveCapacity_LDKHintMaxHTLC_Body {
23901    /**
23902     * The maximum HTLC amount denominated in millisatoshi.
23903     */
23904    uint64_t amount_msat;
23905 } LDKEffectiveCapacity_LDKHintMaxHTLC_Body;
23906
23907 typedef struct MUST_USE_STRUCT LDKEffectiveCapacity {
23908    LDKEffectiveCapacity_Tag tag;
23909    union {
23910       LDKEffectiveCapacity_LDKExactLiquidity_Body exact_liquidity;
23911       LDKEffectiveCapacity_LDKAdvertisedMaxHTLC_Body advertised_max_htlc;
23912       LDKEffectiveCapacity_LDKTotal_Body total;
23913       LDKEffectiveCapacity_LDKHintMaxHTLC_Body hint_max_htlc;
23914    };
23915 } LDKEffectiveCapacity;
23916
23917
23918
23919 /**
23920  * A [`Router`] implemented using [`find_route`].
23921  */
23922 typedef struct MUST_USE_STRUCT LDKDefaultRouter {
23923    /**
23924     * A pointer to the opaque Rust object.
23925     * Nearly everywhere, inner must be non-null, however in places where
23926     * the Rust equivalent takes an Option, it may be set to null to indicate None.
23927     */
23928    LDKnativeDefaultRouter *inner;
23929    /**
23930     * Indicates that this is the only struct which contains the same pointer.
23931     * Rust functions which take ownership of an object provided via an argument require
23932     * this to be true and invalidate the object pointed to by inner.
23933     */
23934    bool is_owned;
23935 } LDKDefaultRouter;
23936
23937
23938
23939 /**
23940  * [`ScoreLookUp`] implementation that factors in in-flight HTLC liquidity.
23941  *
23942  * Useful for custom [`Router`] implementations to wrap their [`ScoreLookUp`] on-the-fly when calling
23943  * [`find_route`].
23944  *
23945  * [`ScoreLookUp`]: crate::routing::scoring::ScoreLookUp
23946  */
23947 typedef struct MUST_USE_STRUCT LDKScorerAccountingForInFlightHtlcs {
23948    /**
23949     * A pointer to the opaque Rust object.
23950     * Nearly everywhere, inner must be non-null, however in places where
23951     * the Rust equivalent takes an Option, it may be set to null to indicate None.
23952     */
23953    LDKnativeScorerAccountingForInFlightHtlcs *inner;
23954    /**
23955     * Indicates that this is the only struct which contains the same pointer.
23956     * Rust functions which take ownership of an object provided via an argument require
23957     * this to be true and invalidate the object pointed to by inner.
23958     */
23959    bool is_owned;
23960 } LDKScorerAccountingForInFlightHtlcs;
23961
23962 /**
23963  * The recipient of a payment, differing based on whether they've hidden their identity with route
23964  * blinding.
23965  */
23966 typedef enum LDKPayee_Tag {
23967    /**
23968     * The recipient provided blinded paths and payinfo to reach them. The blinded paths themselves
23969     * will be included in the final [`Route`].
23970     */
23971    LDKPayee_Blinded,
23972    /**
23973     * The recipient included these route hints in their BOLT11 invoice.
23974     */
23975    LDKPayee_Clear,
23976    /**
23977     * Must be last for serialization purposes
23978     */
23979    LDKPayee_Sentinel,
23980 } LDKPayee_Tag;
23981
23982 typedef struct LDKPayee_LDKBlinded_Body {
23983    /**
23984     * Aggregated routing info and blinded paths, for routing to the payee without knowing their
23985     * node id.
23986     */
23987    struct LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ route_hints;
23988    /**
23989     * Features supported by the payee.
23990     *
23991     * May be set from the payee's invoice. May be `None` if the invoice does not contain any
23992     * features.
23993     *
23994     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
23995     */
23996    struct LDKBolt12InvoiceFeatures features;
23997 } LDKPayee_LDKBlinded_Body;
23998
23999 typedef struct LDKPayee_LDKClear_Body {
24000    /**
24001     * The node id of the payee.
24002     */
24003    struct LDKPublicKey node_id;
24004    /**
24005     * Hints for routing to the payee, containing channels connecting the payee to public nodes.
24006     */
24007    struct LDKCVec_RouteHintZ route_hints;
24008    /**
24009     * Features supported by the payee.
24010     *
24011     * May be set from the payee's invoice or via [`for_keysend`]. May be `None` if the invoice
24012     * does not contain any features.
24013     *
24014     * [`for_keysend`]: PaymentParameters::for_keysend
24015     *
24016     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
24017     */
24018    struct LDKBolt11InvoiceFeatures features;
24019    /**
24020     * The minimum CLTV delta at the end of the route. This value must not be zero.
24021     */
24022    uint32_t final_cltv_expiry_delta;
24023 } LDKPayee_LDKClear_Body;
24024
24025 typedef struct MUST_USE_STRUCT LDKPayee {
24026    LDKPayee_Tag tag;
24027    union {
24028       LDKPayee_LDKBlinded_Body blinded;
24029       LDKPayee_LDKClear_Body clear;
24030    };
24031 } LDKPayee;
24032
24033 /**
24034  * A trait which can both lookup and update routing channel penalty scores.
24035  *
24036  * This is used in places where both bounds are required and implemented for all types which
24037  * implement [`ScoreLookUp`] and [`ScoreUpdate`].
24038  *
24039  * Bindings users may need to manually implement this for their custom scoring implementations.
24040  */
24041 typedef struct LDKScore {
24042    /**
24043     * An opaque pointer which is passed to your function implementations as an argument.
24044     * This has no meaning in the LDK, and can be NULL or any other value.
24045     */
24046    void *this_arg;
24047    /**
24048     * Implementation of ScoreLookUp for this object.
24049     */
24050    struct LDKScoreLookUp ScoreLookUp;
24051    /**
24052     * Implementation of ScoreUpdate for this object.
24053     */
24054    struct LDKScoreUpdate ScoreUpdate;
24055    /**
24056     * Serialize the object into a byte array
24057     */
24058    struct LDKCVec_u8Z (*write)(const void *this_arg);
24059    /**
24060     * Frees any resources associated with this object given its this_arg pointer.
24061     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
24062     */
24063    void (*free)(void *this_arg);
24064 } LDKScore;
24065
24066
24067
24068 /**
24069  * A concrete implementation of [`LockableScore`] which supports multi-threading.
24070  */
24071 typedef struct MUST_USE_STRUCT LDKMultiThreadedLockableScore {
24072    /**
24073     * A pointer to the opaque Rust object.
24074     * Nearly everywhere, inner must be non-null, however in places where
24075     * the Rust equivalent takes an Option, it may be set to null to indicate None.
24076     */
24077    LDKnativeMultiThreadedLockableScore *inner;
24078    /**
24079     * Indicates that this is the only struct which contains the same pointer.
24080     * Rust functions which take ownership of an object provided via an argument require
24081     * this to be true and invalidate the object pointed to by inner.
24082     */
24083    bool is_owned;
24084 } LDKMultiThreadedLockableScore;
24085
24086
24087
24088 /**
24089  * A locked `MultiThreadedLockableScore`.
24090  */
24091 typedef struct MUST_USE_STRUCT LDKMultiThreadedScoreLockRead {
24092    /**
24093     * A pointer to the opaque Rust object.
24094     * Nearly everywhere, inner must be non-null, however in places where
24095     * the Rust equivalent takes an Option, it may be set to null to indicate None.
24096     */
24097    LDKnativeMultiThreadedScoreLockRead *inner;
24098    /**
24099     * Indicates that this is the only struct which contains the same pointer.
24100     * Rust functions which take ownership of an object provided via an argument require
24101     * this to be true and invalidate the object pointed to by inner.
24102     */
24103    bool is_owned;
24104 } LDKMultiThreadedScoreLockRead;
24105
24106
24107
24108 /**
24109  * A locked `MultiThreadedLockableScore`.
24110  */
24111 typedef struct MUST_USE_STRUCT LDKMultiThreadedScoreLockWrite {
24112    /**
24113     * A pointer to the opaque Rust object.
24114     * Nearly everywhere, inner must be non-null, however in places where
24115     * the Rust equivalent takes an Option, it may be set to null to indicate None.
24116     */
24117    LDKnativeMultiThreadedScoreLockWrite *inner;
24118    /**
24119     * Indicates that this is the only struct which contains the same pointer.
24120     * Rust functions which take ownership of an object provided via an argument require
24121     * this to be true and invalidate the object pointed to by inner.
24122     */
24123    bool is_owned;
24124 } LDKMultiThreadedScoreLockWrite;
24125
24126
24127
24128 /**
24129  * Parameters for configuring [`ProbabilisticScorer`].
24130  *
24131  * Used to configure decay parameters that are static throughout the lifetime of the scorer.
24132  * these decay parameters affect the score of the channel penalty and are not changed on a
24133  * per-route penalty cost call.
24134  */
24135 typedef struct MUST_USE_STRUCT LDKProbabilisticScoringDecayParameters {
24136    /**
24137     * A pointer to the opaque Rust object.
24138     * Nearly everywhere, inner must be non-null, however in places where
24139     * the Rust equivalent takes an Option, it may be set to null to indicate None.
24140     */
24141    LDKnativeProbabilisticScoringDecayParameters *inner;
24142    /**
24143     * Indicates that this is the only struct which contains the same pointer.
24144     * Rust functions which take ownership of an object provided via an argument require
24145     * this to be true and invalidate the object pointed to by inner.
24146     */
24147    bool is_owned;
24148 } LDKProbabilisticScoringDecayParameters;
24149
24150
24151
24152 /**
24153  * Simple implementation of [`EntropySource`], [`NodeSigner`], and [`SignerProvider`] that takes a
24154  * 32-byte seed for use as a BIP 32 extended key and derives keys from that.
24155  *
24156  * Your `node_id` is seed/0'.
24157  * Unilateral closes may use seed/1'.
24158  * Cooperative closes may use seed/2'.
24159  * The two close keys may be needed to claim on-chain funds!
24160  *
24161  * This struct cannot be used for nodes that wish to support receiving phantom payments;
24162  * [`PhantomKeysManager`] must be used instead.
24163  *
24164  * Note that switching between this struct and [`PhantomKeysManager`] will invalidate any
24165  * previously issued invoices and attempts to pay previous invoices will fail.
24166  */
24167 typedef struct MUST_USE_STRUCT LDKKeysManager {
24168    /**
24169     * A pointer to the opaque Rust object.
24170     * Nearly everywhere, inner must be non-null, however in places where
24171     * the Rust equivalent takes an Option, it may be set to null to indicate None.
24172     */
24173    LDKnativeKeysManager *inner;
24174    /**
24175     * Indicates that this is the only struct which contains the same pointer.
24176     * Rust functions which take ownership of an object provided via an argument require
24177     * this to be true and invalidate the object pointed to by inner.
24178     */
24179    bool is_owned;
24180 } LDKKeysManager;
24181
24182
24183
24184 /**
24185  * Similar to [`KeysManager`], but allows the node using this struct to receive phantom node
24186  * payments.
24187  *
24188  * A phantom node payment is a payment made to a phantom invoice, which is an invoice that can be
24189  * paid to one of multiple nodes. This works because we encode the invoice route hints such that
24190  * LDK will recognize an incoming payment as destined for a phantom node, and collect the payment
24191  * itself without ever needing to forward to this fake node.
24192  *
24193  * Phantom node payments are useful for load balancing between multiple LDK nodes. They also
24194  * provide some fault tolerance, because payers will automatically retry paying other provided
24195  * nodes in the case that one node goes down.
24196  *
24197  * Note that multi-path payments are not supported in phantom invoices for security reasons.
24198  * Switching between this struct and [`KeysManager`] will invalidate any previously issued
24199  * invoices and attempts to pay previous invoices will fail.
24200  */
24201 typedef struct MUST_USE_STRUCT LDKPhantomKeysManager {
24202    /**
24203     * A pointer to the opaque Rust object.
24204     * Nearly everywhere, inner must be non-null, however in places where
24205     * the Rust equivalent takes an Option, it may be set to null to indicate None.
24206     */
24207    LDKnativePhantomKeysManager *inner;
24208    /**
24209     * Indicates that this is the only struct which contains the same pointer.
24210     * Rust functions which take ownership of an object provided via an argument require
24211     * this to be true and invalidate the object pointed to by inner.
24212     */
24213    bool is_owned;
24214 } LDKPhantomKeysManager;
24215
24216
24217
24218 /**
24219  * An implementation of [`EntropySource`] using ChaCha20.
24220  */
24221 typedef struct MUST_USE_STRUCT LDKRandomBytes {
24222    /**
24223     * A pointer to the opaque Rust object.
24224     * Nearly everywhere, inner must be non-null, however in places where
24225     * the Rust equivalent takes an Option, it may be set to null to indicate None.
24226     */
24227    LDKnativeRandomBytes *inner;
24228    /**
24229     * Indicates that this is the only struct which contains the same pointer.
24230     * Rust functions which take ownership of an object provided via an argument require
24231     * this to be true and invalidate the object pointed to by inner.
24232     */
24233    bool is_owned;
24234 } LDKRandomBytes;
24235
24236
24237
24238 /**
24239  * A sender, receiver and forwarder of [`OnionMessage`]s.
24240  *
24241  * # Handling Messages
24242  *
24243  * `OnionMessenger` implements [`OnionMessageHandler`], making it responsible for either forwarding
24244  * messages to peers or delegating to the appropriate handler for the message type. Currently, the
24245  * available handlers are:
24246  * * [`OffersMessageHandler`], for responding to [`InvoiceRequest`]s and paying [`Bolt12Invoice`]s
24247  * * [`CustomOnionMessageHandler`], for handling user-defined message types
24248  *
24249  * # Sending Messages
24250  *
24251  * [`OnionMessage`]s are sent initially using [`OnionMessenger::send_onion_message`]. When handling
24252  * a message, the matched handler may return a response message which `OnionMessenger` will send
24253  * on its behalf.
24254  *
24255  * # Example
24256  *
24257  * ```
24258  * # extern crate bitcoin;
24259  * # use bitcoin::hashes::_export::_core::time::Duration;
24260  * # use bitcoin::hashes::hex::FromHex;
24261  * # use bitcoin::secp256k1::{PublicKey, Secp256k1, SecretKey, self};
24262  * # use lightning::blinded_path::{BlindedPath, EmptyNodeIdLookUp};
24263  * # use lightning::sign::{EntropySource, KeysManager};
24264  * # use lightning::ln::peer_handler::IgnoringMessageHandler;
24265  * # use lightning::onion_message::messenger::{Destination, MessageRouter, OnionMessagePath, OnionMessenger};
24266  * # use lightning::onion_message::packet::OnionMessageContents;
24267  * # use lightning::util::logger::{Logger, Record};
24268  * # use lightning::util::ser::{Writeable, Writer};
24269  * # use lightning::io;
24270  * # use std::sync::Arc;
24271  * # struct FakeLogger;
24272  * # impl Logger for FakeLogger {
24273  * #     fn log(&self, record: Record) { println!(\"{:?}\" , record); }
24274  * # }
24275  * # struct FakeMessageRouter {}
24276  * # impl MessageRouter for FakeMessageRouter {
24277  * #     fn find_path(&self, sender: PublicKey, peers: Vec<PublicKey>, destination: Destination) -> Result<OnionMessagePath, ()> {
24278  * #         let secp_ctx = Secp256k1::new();
24279  * #         let node_secret = SecretKey::from_slice(&<Vec<u8>>::from_hex(\"0101010101010101010101010101010101010101010101010101010101010101\").unwrap()[..]).unwrap();
24280  * #         let hop_node_id1 = PublicKey::from_secret_key(&secp_ctx, &node_secret);
24281  * #         let hop_node_id2 = hop_node_id1;
24282  * #         Ok(OnionMessagePath {
24283  * #             intermediate_nodes: vec![hop_node_id1, hop_node_id2],
24284  * #             destination,
24285  * #             first_node_addresses: None,
24286  * #         })
24287  * #     }
24288  * #     fn create_blinded_paths<T: secp256k1::Signing + secp256k1::Verification>(
24289  * #         &self, _recipient: PublicKey, _peers: Vec<PublicKey>, _secp_ctx: &Secp256k1<T>
24290  * #     ) -> Result<Vec<BlindedPath>, ()> {
24291  * #         unreachable!()
24292  * #     }
24293  * # }
24294  * # let seed = [42u8; 32];
24295  * # let time = Duration::from_secs(123456);
24296  * # let keys_manager = KeysManager::new(&seed, time.as_secs(), time.subsec_nanos());
24297  * # let logger = Arc::new(FakeLogger {});
24298  * # let node_secret = SecretKey::from_slice(&<Vec<u8>>::from_hex(\"0101010101010101010101010101010101010101010101010101010101010101\").unwrap()[..]).unwrap();
24299  * # let secp_ctx = Secp256k1::new();
24300  * # let hop_node_id1 = PublicKey::from_secret_key(&secp_ctx, &node_secret);
24301  * # let (hop_node_id3, hop_node_id4) = (hop_node_id1, hop_node_id1);
24302  * # let destination_node_id = hop_node_id1;
24303  * # let node_id_lookup = EmptyNodeIdLookUp {};
24304  * # let message_router = Arc::new(FakeMessageRouter {});
24305  * # let custom_message_handler = IgnoringMessageHandler {};
24306  * # let offers_message_handler = IgnoringMessageHandler {};
24307  * // Create the onion messenger. This must use the same `keys_manager` as is passed to your
24308  * // ChannelManager.
24309  * let onion_messenger = OnionMessenger::new(
24310  *     &keys_manager, &keys_manager, logger, &node_id_lookup, message_router,
24311  *     &offers_message_handler, &custom_message_handler
24312  * );
24313  *
24314  * # #[derive(Debug, Clone)]
24315  * # struct YourCustomMessage {}
24316  * impl Writeable for YourCustomMessage {
24317  * \tfn write<W: Writer>(&self, w: &mut W) -> Result<(), io::Error> {
24318  * \t\t# Ok(())
24319  * \t\t// Write your custom onion message to `w`
24320  * \t}
24321  * }
24322  * impl OnionMessageContents for YourCustomMessage {
24323  * \tfn tlv_type(&self) -> u64 {
24324  * \t\t# let your_custom_message_type = 42;
24325  * \t\tyour_custom_message_type
24326  * \t}
24327  * }
24328  * // Send a custom onion message to a node id.
24329  * let destination = Destination::Node(destination_node_id);
24330  * let reply_path = None;
24331  * # let message = YourCustomMessage {};
24332  * onion_messenger.send_onion_message(message, destination, reply_path);
24333  *
24334  * // Create a blinded path to yourself, for someone to send an onion message to.
24335  * # let your_node_id = hop_node_id1;
24336  * let hops = [hop_node_id3, hop_node_id4, your_node_id];
24337  * let blinded_path = BlindedPath::new_for_message(&hops, &keys_manager, &secp_ctx).unwrap();
24338  *
24339  * // Send a custom onion message to a blinded path.
24340  * let destination = Destination::BlindedPath(blinded_path);
24341  * let reply_path = None;
24342  * # let message = YourCustomMessage {};
24343  * onion_messenger.send_onion_message(message, destination, reply_path);
24344  * ```
24345  *
24346  * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
24347  * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
24348  */
24349 typedef struct MUST_USE_STRUCT LDKOnionMessenger {
24350    /**
24351     * A pointer to the opaque Rust object.
24352     * Nearly everywhere, inner must be non-null, however in places where
24353     * the Rust equivalent takes an Option, it may be set to null to indicate None.
24354     */
24355    LDKnativeOnionMessenger *inner;
24356    /**
24357     * Indicates that this is the only struct which contains the same pointer.
24358     * Rust functions which take ownership of an object provided via an argument require
24359     * this to be true and invalidate the object pointed to by inner.
24360     */
24361    bool is_owned;
24362 } LDKOnionMessenger;
24363
24364
24365
24366 /**
24367  * A [`MessageRouter`] that can only route to a directly connected [`Destination`].
24368  */
24369 typedef struct MUST_USE_STRUCT LDKDefaultMessageRouter {
24370    /**
24371     * A pointer to the opaque Rust object.
24372     * Nearly everywhere, inner must be non-null, however in places where
24373     * the Rust equivalent takes an Option, it may be set to null to indicate None.
24374     */
24375    LDKnativeDefaultMessageRouter *inner;
24376    /**
24377     * Indicates that this is the only struct which contains the same pointer.
24378     * Rust functions which take ownership of an object provided via an argument require
24379     * this to be true and invalidate the object pointed to by inner.
24380     */
24381    bool is_owned;
24382 } LDKDefaultMessageRouter;
24383
24384 /**
24385  * The unblinded node in a [`BlindedPath`].
24386  */
24387 typedef enum LDKIntroductionNode_Tag {
24388    /**
24389     * The node id of the introduction node.
24390     */
24391    LDKIntroductionNode_NodeId,
24392    /**
24393     * The short channel id of the channel leading to the introduction node. The [`Direction`]
24394     * identifies which side of the channel is the introduction node.
24395     */
24396    LDKIntroductionNode_DirectedShortChannelId,
24397    /**
24398     * Must be last for serialization purposes
24399     */
24400    LDKIntroductionNode_Sentinel,
24401 } LDKIntroductionNode_Tag;
24402
24403 typedef struct LDKIntroductionNode_LDKDirectedShortChannelId_Body {
24404    enum LDKDirection _0;
24405    uint64_t _1;
24406 } LDKIntroductionNode_LDKDirectedShortChannelId_Body;
24407
24408 typedef struct MUST_USE_STRUCT LDKIntroductionNode {
24409    LDKIntroductionNode_Tag tag;
24410    union {
24411       struct {
24412          struct LDKPublicKey node_id;
24413       };
24414       LDKIntroductionNode_LDKDirectedShortChannelId_Body directed_short_channel_id;
24415    };
24416 } LDKIntroductionNode;
24417
24418
24419
24420 /**
24421  * A [`NodeIdLookUp`] that always returns `None`.
24422  */
24423 typedef struct MUST_USE_STRUCT LDKEmptyNodeIdLookUp {
24424    /**
24425     * A pointer to the opaque Rust object.
24426     * Nearly everywhere, inner must be non-null, however in places where
24427     * the Rust equivalent takes an Option, it may be set to null to indicate None.
24428     */
24429    LDKnativeEmptyNodeIdLookUp *inner;
24430    /**
24431     * Indicates that this is the only struct which contains the same pointer.
24432     * Rust functions which take ownership of an object provided via an argument require
24433     * this to be true and invalidate the object pointed to by inner.
24434     */
24435    bool is_owned;
24436 } LDKEmptyNodeIdLookUp;
24437
24438
24439
24440 /**
24441  * Data to construct a [`BlindedHop`] for forwarding a payment.
24442  */
24443 typedef struct MUST_USE_STRUCT LDKForwardTlvs {
24444    /**
24445     * A pointer to the opaque Rust object.
24446     * Nearly everywhere, inner must be non-null, however in places where
24447     * the Rust equivalent takes an Option, it may be set to null to indicate None.
24448     */
24449    LDKnativeForwardTlvs *inner;
24450    /**
24451     * Indicates that this is the only struct which contains the same pointer.
24452     * Rust functions which take ownership of an object provided via an argument require
24453     * this to be true and invalidate the object pointed to by inner.
24454     */
24455    bool is_owned;
24456 } LDKForwardTlvs;
24457
24458 /**
24459  * An abstraction over a bitcoin wallet that can perform coin selection over a set of UTXOs and can
24460  * sign for them. The coin selection method aims to mimic Bitcoin Core's `fundrawtransaction` RPC,
24461  * which most wallets should be able to satisfy. Otherwise, consider implementing [`WalletSource`],
24462  * which can provide a default implementation of this trait when used with [`Wallet`].
24463  */
24464 typedef struct LDKCoinSelectionSource {
24465    /**
24466     * An opaque pointer which is passed to your function implementations as an argument.
24467     * This has no meaning in the LDK, and can be NULL or any other value.
24468     */
24469    void *this_arg;
24470    /**
24471     * Performs coin selection of a set of UTXOs, with at least 1 confirmation each, that are
24472     * available to spend. Implementations are free to pick their coin selection algorithm of
24473     * choice, as long as the following requirements are met:
24474     *
24475     * 1. `must_spend` contains a set of [`Input`]s that must be included in the transaction
24476     *    throughout coin selection, but must not be returned as part of the result.
24477     * 2. `must_pay_to` contains a set of [`TxOut`]s that must be included in the transaction
24478     *    throughout coin selection. In some cases, like when funding an anchor transaction, this
24479     *    set is empty. Implementations should ensure they handle this correctly on their end,
24480     *    e.g., Bitcoin Core's `fundrawtransaction` RPC requires at least one output to be
24481     *    provided, in which case a zero-value empty OP_RETURN output can be used instead.
24482     * 3. Enough inputs must be selected/contributed for the resulting transaction (including the
24483     *    inputs and outputs noted above) to meet `target_feerate_sat_per_1000_weight`.
24484     *
24485     * Implementations must take note that [`Input::satisfaction_weight`] only tracks the weight of
24486     * the input's `script_sig` and `witness`. Some wallets, like Bitcoin Core's, may require
24487     * providing the full input weight. Failing to do so may lead to underestimating fee bumps and
24488     * delaying block inclusion.
24489     *
24490     * The `claim_id` must map to the set of external UTXOs assigned to the claim, such that they
24491     * can be re-used within new fee-bumped iterations of the original claiming transaction,
24492     * ensuring that claims don't double spend each other. If a specific `claim_id` has never had a
24493     * transaction associated with it, and all of the available UTXOs have already been assigned to
24494     * other claims, implementations must be willing to double spend their UTXOs. The choice of
24495     * which UTXOs to double spend is left to the implementation, but it must strive to keep the
24496     * set of other claims being double spent to a minimum.
24497     */
24498    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);
24499    /**
24500     * Signs and provides the full witness for all inputs within the transaction known to the
24501     * trait (i.e., any provided via [`CoinSelectionSource::select_confirmed_utxos`]).
24502     *
24503     * If your wallet does not support signing PSBTs you can call `psbt.extract_tx()` to get the
24504     * unsigned transaction and then sign it with your wallet.
24505     */
24506    struct LDKCResult_TransactionNoneZ (*sign_psbt)(const void *this_arg, struct LDKCVec_u8Z psbt);
24507    /**
24508     * Frees any resources associated with this object given its this_arg pointer.
24509     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
24510     */
24511    void (*free)(void *this_arg);
24512 } LDKCoinSelectionSource;
24513
24514 /**
24515  * An alternative to [`CoinSelectionSource`] that can be implemented and used along [`Wallet`] to
24516  * provide a default implementation to [`CoinSelectionSource`].
24517  */
24518 typedef struct LDKWalletSource {
24519    /**
24520     * An opaque pointer which is passed to your function implementations as an argument.
24521     * This has no meaning in the LDK, and can be NULL or any other value.
24522     */
24523    void *this_arg;
24524    /**
24525     * Returns all UTXOs, with at least 1 confirmation each, that are available to spend.
24526     */
24527    struct LDKCResult_CVec_UtxoZNoneZ (*list_confirmed_utxos)(const void *this_arg);
24528    /**
24529     * Returns a script to use for change above dust resulting from a successful coin selection
24530     * attempt.
24531     */
24532    struct LDKCResult_CVec_u8ZNoneZ (*get_change_script)(const void *this_arg);
24533    /**
24534     * Signs and provides the full [`TxIn::script_sig`] and [`TxIn::witness`] for all inputs within
24535     * the transaction known to the wallet (i.e., any provided via
24536     * [`WalletSource::list_confirmed_utxos`]).
24537     *
24538     * If your wallet does not support signing PSBTs you can call `psbt.extract_tx()` to get the
24539     * unsigned transaction and then sign it with your wallet.
24540     */
24541    struct LDKCResult_TransactionNoneZ (*sign_psbt)(const void *this_arg, struct LDKCVec_u8Z psbt);
24542    /**
24543     * Frees any resources associated with this object given its this_arg pointer.
24544     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
24545     */
24546    void (*free)(void *this_arg);
24547 } LDKWalletSource;
24548
24549
24550
24551 /**
24552  * A wrapper over [`WalletSource`] that implements [`CoinSelection`] by preferring UTXOs that would
24553  * avoid conflicting double spends. If not enough UTXOs are available to do so, conflicting double
24554  * spends may happen.
24555  */
24556 typedef struct MUST_USE_STRUCT LDKWallet {
24557    /**
24558     * A pointer to the opaque Rust object.
24559     * Nearly everywhere, inner must be non-null, however in places where
24560     * the Rust equivalent takes an Option, it may be set to null to indicate None.
24561     */
24562    LDKnativeWallet *inner;
24563    /**
24564     * Indicates that this is the only struct which contains the same pointer.
24565     * Rust functions which take ownership of an object provided via an argument require
24566     * this to be true and invalidate the object pointed to by inner.
24567     */
24568    bool is_owned;
24569 } LDKWallet;
24570
24571
24572
24573 /**
24574  * A handler for [`Event::BumpTransaction`] events that sources confirmed UTXOs from a
24575  * [`CoinSelectionSource`] to fee bump transactions via Child-Pays-For-Parent (CPFP) or
24576  * Replace-By-Fee (RBF).
24577  *
24578  * [`Event::BumpTransaction`]: crate::events::Event::BumpTransaction
24579  */
24580 typedef struct MUST_USE_STRUCT LDKBumpTransactionEventHandler {
24581    /**
24582     * A pointer to the opaque Rust object.
24583     * Nearly everywhere, inner must be non-null, however in places where
24584     * the Rust equivalent takes an Option, it may be set to null to indicate None.
24585     */
24586    LDKnativeBumpTransactionEventHandler *inner;
24587    /**
24588     * Indicates that this is the only struct which contains the same pointer.
24589     * Rust functions which take ownership of an object provided via an argument require
24590     * this to be true and invalidate the object pointed to by inner.
24591     */
24592    bool is_owned;
24593 } LDKBumpTransactionEventHandler;
24594
24595
24596
24597 /**
24598  * A [`KVStore`] implementation that writes to and reads from the file system.
24599  */
24600 typedef struct MUST_USE_STRUCT LDKFilesystemStore {
24601    /**
24602     * A pointer to the opaque Rust object.
24603     * Nearly everywhere, inner must be non-null, however in places where
24604     * the Rust equivalent takes an Option, it may be set to null to indicate None.
24605     */
24606    LDKnativeFilesystemStore *inner;
24607    /**
24608     * Indicates that this is the only struct which contains the same pointer.
24609     * Rust functions which take ownership of an object provided via an argument require
24610     * this to be true and invalidate the object pointed to by inner.
24611     */
24612    bool is_owned;
24613 } LDKFilesystemStore;
24614
24615
24616
24617 /**
24618  * `BackgroundProcessor` takes care of tasks that (1) need to happen periodically to keep
24619  * Rust-Lightning running properly, and (2) either can or should be run in the background. Its
24620  * responsibilities are:
24621  * * Processing [`Event`]s with a user-provided [`EventHandler`].
24622  * * Monitoring whether the [`ChannelManager`] needs to be re-persisted to disk, and if so,
24623  *   writing it to disk/backups by invoking the callback given to it at startup.
24624  *   [`ChannelManager`] persistence should be done in the background.
24625  * * Calling [`ChannelManager::timer_tick_occurred`], [`ChainMonitor::rebroadcast_pending_claims`]
24626  *   and [`PeerManager::timer_tick_occurred`] at the appropriate intervals.
24627  * * Calling [`NetworkGraph::remove_stale_channels_and_tracking`] (if a [`GossipSync`] with a
24628  *   [`NetworkGraph`] is provided to [`BackgroundProcessor::start`]).
24629  *
24630  * It will also call [`PeerManager::process_events`] periodically though this shouldn't be relied
24631  * upon as doing so may result in high latency.
24632  *
24633  * # Note
24634  *
24635  * If [`ChannelManager`] persistence fails and the persisted manager becomes out-of-date, then
24636  * there is a risk of channels force-closing on startup when the manager realizes it's outdated.
24637  * However, as long as [`ChannelMonitor`] backups are sound, no funds besides those used for
24638  * unilateral chain closure fees are at risk.
24639  *
24640  * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
24641  * [`ChannelManager::timer_tick_occurred`]: lightning::ln::channelmanager::ChannelManager::timer_tick_occurred
24642  * [`ChannelMonitor`]: lightning::chain::channelmonitor::ChannelMonitor
24643  * [`Event`]: lightning::events::Event
24644  * [`PeerManager::timer_tick_occurred`]: lightning::ln::peer_handler::PeerManager::timer_tick_occurred
24645  * [`PeerManager::process_events`]: lightning::ln::peer_handler::PeerManager::process_events
24646  *BackgroundProcessor will immediately stop on drop. It should be stored until shutdown.
24647  */
24648 typedef struct MUST_USE_STRUCT LDKBackgroundProcessor {
24649    /**
24650     * A pointer to the opaque Rust object.
24651     * Nearly everywhere, inner must be non-null, however in places where
24652     * the Rust equivalent takes an Option, it may be set to null to indicate None.
24653     */
24654    LDKnativeBackgroundProcessor *inner;
24655    /**
24656     * Indicates that this is the only struct which contains the same pointer.
24657     * Rust functions which take ownership of an object provided via an argument require
24658     * this to be true and invalidate the object pointed to by inner.
24659     */
24660    bool is_owned;
24661 } LDKBackgroundProcessor;
24662
24663
24664
24665 /**
24666  * The main Rapid Gossip Sync object.
24667  *
24668  * See [crate-level documentation] for usage.
24669  *
24670  * [crate-level documentation]: crate
24671  */
24672 typedef struct MUST_USE_STRUCT LDKRapidGossipSync {
24673    /**
24674     * A pointer to the opaque Rust object.
24675     * Nearly everywhere, inner must be non-null, however in places where
24676     * the Rust equivalent takes an Option, it may be set to null to indicate None.
24677     */
24678    LDKnativeRapidGossipSync *inner;
24679    /**
24680     * Indicates that this is the only struct which contains the same pointer.
24681     * Rust functions which take ownership of an object provided via an argument require
24682     * this to be true and invalidate the object pointed to by inner.
24683     */
24684    bool is_owned;
24685 } LDKRapidGossipSync;
24686
24687 /**
24688  * Either [`P2PGossipSync`] or [`RapidGossipSync`].
24689  */
24690 typedef enum LDKGossipSync_Tag {
24691    /**
24692     * Gossip sync via the lightning peer-to-peer network as defined by BOLT 7.
24693     */
24694    LDKGossipSync_P2P,
24695    /**
24696     * Rapid gossip sync from a trusted server.
24697     */
24698    LDKGossipSync_Rapid,
24699    /**
24700     * No gossip sync.
24701     */
24702    LDKGossipSync_None,
24703    /**
24704     * Must be last for serialization purposes
24705     */
24706    LDKGossipSync_Sentinel,
24707 } LDKGossipSync_Tag;
24708
24709 typedef struct MUST_USE_STRUCT LDKGossipSync {
24710    LDKGossipSync_Tag tag;
24711    union {
24712       struct {
24713          /**
24714           * Note that this field is expected to be a reference.
24715           */
24716          struct LDKP2PGossipSync p2p;
24717       };
24718       struct {
24719          /**
24720           * Note that this field is expected to be a reference.
24721           */
24722          struct LDKRapidGossipSync rapid;
24723       };
24724    };
24725 } LDKGossipSync;
24726
24727
24728
24729 /**
24730  * Data of the [`RawBolt11Invoice`] that is encoded in the data part
24731  */
24732 typedef struct MUST_USE_STRUCT LDKRawDataPart {
24733    /**
24734     * A pointer to the opaque Rust object.
24735     * Nearly everywhere, inner must be non-null, however in places where
24736     * the Rust equivalent takes an Option, it may be set to null to indicate None.
24737     */
24738    LDKnativeRawDataPart *inner;
24739    /**
24740     * Indicates that this is the only struct which contains the same pointer.
24741     * Rust functions which take ownership of an object provided via an argument require
24742     * this to be true and invalidate the object pointed to by inner.
24743     */
24744    bool is_owned;
24745 } LDKRawDataPart;
24746
24747
24748
24749 /**
24750  * SHA-256 hash
24751  */
24752 typedef struct MUST_USE_STRUCT LDKSha256 {
24753    /**
24754     * A pointer to the opaque Rust object.
24755     * Nearly everywhere, inner must be non-null, however in places where
24756     * the Rust equivalent takes an Option, it may be set to null to indicate None.
24757     */
24758    LDKnativeSha256 *inner;
24759    /**
24760     * Indicates that this is the only struct which contains the same pointer.
24761     * Rust functions which take ownership of an object provided via an argument require
24762     * this to be true and invalidate the object pointed to by inner.
24763     */
24764    bool is_owned;
24765 } LDKSha256;
24766
24767
24768
24769 /**
24770  * Positive duration that defines when (relatively to the timestamp) in the future the invoice
24771  * expires
24772  */
24773 typedef struct MUST_USE_STRUCT LDKExpiryTime {
24774    /**
24775     * A pointer to the opaque Rust object.
24776     * Nearly everywhere, inner must be non-null, however in places where
24777     * the Rust equivalent takes an Option, it may be set to null to indicate None.
24778     */
24779    LDKnativeExpiryTime *inner;
24780    /**
24781     * Indicates that this is the only struct which contains the same pointer.
24782     * Rust functions which take ownership of an object provided via an argument require
24783     * this to be true and invalidate the object pointed to by inner.
24784     */
24785    bool is_owned;
24786 } LDKExpiryTime;
24787
24788
24789
24790 /**
24791  * `min_final_cltv_expiry_delta` to use for the last HTLC in the route
24792  */
24793 typedef struct MUST_USE_STRUCT LDKMinFinalCltvExpiryDelta {
24794    /**
24795     * A pointer to the opaque Rust object.
24796     * Nearly everywhere, inner must be non-null, however in places where
24797     * the Rust equivalent takes an Option, it may be set to null to indicate None.
24798     */
24799    LDKnativeMinFinalCltvExpiryDelta *inner;
24800    /**
24801     * Indicates that this is the only struct which contains the same pointer.
24802     * Rust functions which take ownership of an object provided via an argument require
24803     * this to be true and invalidate the object pointed to by inner.
24804     */
24805    bool is_owned;
24806 } LDKMinFinalCltvExpiryDelta;
24807
24808 /**
24809  * A 20-byte byte array.
24810  */
24811 typedef struct LDKTwentyBytes {
24812    /**
24813     * The twenty bytes
24814     */
24815    uint8_t data[20];
24816 } LDKTwentyBytes;
24817
24818 /**
24819  * Fallback address in case no LN payment is possible
24820  */
24821 typedef enum LDKFallback_Tag {
24822    LDKFallback_SegWitProgram,
24823    LDKFallback_PubKeyHash,
24824    LDKFallback_ScriptHash,
24825    /**
24826     * Must be last for serialization purposes
24827     */
24828    LDKFallback_Sentinel,
24829 } LDKFallback_Tag;
24830
24831 typedef struct LDKFallback_LDKSegWitProgram_Body {
24832    struct LDKWitnessVersion version;
24833    struct LDKCVec_u8Z program;
24834 } LDKFallback_LDKSegWitProgram_Body;
24835
24836 typedef struct MUST_USE_STRUCT LDKFallback {
24837    LDKFallback_Tag tag;
24838    union {
24839       LDKFallback_LDKSegWitProgram_Body seg_wit_program;
24840       struct {
24841          struct LDKTwentyBytes pub_key_hash;
24842       };
24843       struct {
24844          struct LDKTwentyBytes script_hash;
24845       };
24846    };
24847 } LDKFallback;
24848
24849 extern const uintptr_t MAX_BUF_SIZE;
24850
24851 extern const uintptr_t KVSTORE_NAMESPACE_KEY_MAX_LEN;
24852
24853 extern const uint64_t MAX_SCID_BLOCK;
24854
24855 extern const uint64_t MAX_SCID_TX_INDEX;
24856
24857 extern const uint64_t MAX_SCID_VOUT_INDEX;
24858
24859 extern const uint64_t MIN_RELAY_FEE_SAT_PER_1000_WEIGHT;
24860
24861 extern const uint32_t FEERATE_FLOOR_SATS_PER_KW;
24862
24863 extern const uint64_t CLOSED_CHANNEL_UPDATE_ID;
24864
24865 extern const uint32_t ANTI_REORG_DELAY;
24866
24867 extern const uint16_t BREAKDOWN_TIMEOUT;
24868
24869 extern const uint16_t MIN_CLTV_EXPIRY_DELTA;
24870
24871 extern const uint16_t MIN_FINAL_CLTV_EXPIRY_DELTA;
24872
24873 extern const uint16_t MAX_HTLCS;
24874
24875 extern const uintptr_t OFFERED_HTLC_SCRIPT_WEIGHT;
24876
24877 extern const uintptr_t OFFERED_HTLC_SCRIPT_WEIGHT_ANCHORS;
24878
24879 extern const uintptr_t MAX_ACCEPTED_HTLC_SCRIPT_WEIGHT;
24880
24881 extern const uint64_t ANCHOR_INPUT_WITNESS_WEIGHT;
24882
24883 extern const uint64_t HTLC_TIMEOUT_INPUT_ANCHOR_WITNESS_WEIGHT;
24884
24885 extern const uint64_t HTLC_SUCCESS_INPUT_ANCHOR_WITNESS_WEIGHT;
24886
24887 extern const uintptr_t REVOKEABLE_REDEEMSCRIPT_MAX_LENGTH;
24888
24889 extern const uintptr_t PAYER_NOTE_LIMIT;
24890
24891 extern const uint64_t UNKNOWN_CHANNEL_CAPACITY_MSAT;
24892
24893 extern const uint32_t DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA;
24894
24895 extern const uint8_t DEFAULT_MAX_PATH_COUNT;
24896
24897 extern const uint64_t MAX_TIMESTAMP;
24898
24899 extern const uint64_t DEFAULT_EXPIRY_TIME;
24900
24901 extern const uint64_t DEFAULT_MIN_FINAL_CLTV_EXPIRY_DELTA;
24902
24903 extern const uint8_t TAG_PAYMENT_HASH;
24904
24905 extern const uint8_t TAG_DESCRIPTION;
24906
24907 extern const uint8_t TAG_PAYEE_PUB_KEY;
24908
24909 extern const uint8_t TAG_DESCRIPTION_HASH;
24910
24911 extern const uint8_t TAG_EXPIRY_TIME;
24912
24913 extern const uint8_t TAG_MIN_FINAL_CLTV_EXPIRY_DELTA;
24914
24915 extern const uint8_t TAG_FALLBACK;
24916
24917 extern const uint8_t TAG_PRIVATE_ROUTE;
24918
24919 extern const uint8_t TAG_PAYMENT_SECRET;
24920
24921 extern const uint8_t TAG_PAYMENT_METADATA;
24922
24923 extern const uint8_t TAG_FEATURES;
24924
24925 struct LDKStr _ldk_get_compiled_version(void);
24926
24927 struct LDKStr _ldk_c_bindings_get_compiled_version(void);
24928
24929 /**
24930  * Gets the 128-bit integer, as 16 little-endian bytes
24931  */
24932 struct LDKSixteenBytes U128_le_bytes(struct LDKU128 val);
24933
24934 /**
24935  * Constructs a new U128 from 16 little-endian bytes
24936  */
24937 struct LDKU128 U128_new(struct LDKSixteenBytes le_bytes);
24938
24939 /**
24940  * Constructs a new WitnessProgram given a version and program bytes.
24941  *
24942  * The program MUST be at least 2 bytes and no longer than 40 bytes long.
24943  * Further, if the version is 0, the program MUST be either exactly 20 or exactly 32 bytes long.
24944  */
24945 struct LDKWitnessProgram WitnessProgram_new(struct LDKWitnessVersion version, struct LDKCVec_u8Z program);
24946
24947 /**
24948  * Gets the `WitnessVersion` of the given `WitnessProgram`
24949  */
24950 struct LDKWitnessVersion WitnessProgram_get_version(const struct LDKWitnessProgram *NONNULL_PTR prog);
24951
24952 /**
24953  * Gets the witness program bytes of the given `WitnessProgram`
24954  */
24955 struct LDKu8slice WitnessProgram_get_program(const struct LDKWitnessProgram *NONNULL_PTR prog);
24956
24957 /**
24958  * Creates a new WitnessProgram which has the same data as `orig`
24959  */
24960 struct LDKWitnessProgram WitnessProgram_clone(const struct LDKWitnessProgram *NONNULL_PTR orig);
24961
24962 /**
24963  * Releases any memory held by the given `WitnessProgram` (which is currently none)
24964  */
24965 void WitnessProgram_free(struct LDKWitnessProgram o);
24966
24967 /**
24968  * Convenience function for constructing a new BigEndianScalar
24969  */
24970 struct LDKBigEndianScalar BigEndianScalar_new(struct LDKThirtyTwoBytes big_endian_bytes);
24971
24972 /**
24973  * Creates a new BigEndianScalar which has the same data as `orig`
24974  */
24975 struct LDKBigEndianScalar BigEndianScalar_clone(const struct LDKBigEndianScalar *NONNULL_PTR orig);
24976
24977 /**
24978  * Creates a new Bech32Error which has the same data as `orig`
24979  */
24980 struct LDKBech32Error Bech32Error_clone(const struct LDKBech32Error *NONNULL_PTR orig);
24981
24982 /**
24983  * Releases any memory held by the given `Bech32Error` (which is currently none)
24984  */
24985 void Bech32Error_free(struct LDKBech32Error o);
24986
24987 /**
24988  * Frees the data buffer, if data_is_owned is set and datalen > 0.
24989  */
24990 void Transaction_free(struct LDKTransaction _res);
24991
24992 /**
24993  * Creates a new Witness which has the same data as `orig` but with a new buffer.
24994  */
24995 struct LDKWitness Witness_clone(const struct LDKWitness *NONNULL_PTR orig);
24996
24997 /**
24998  * Frees the data pointed to by data
24999  */
25000 void Witness_free(struct LDKWitness _res);
25001
25002 /**
25003  * Convenience function for constructing a new TxIn
25004  */
25005 struct LDKTxIn TxIn_new(struct LDKWitness witness, struct LDKCVec_u8Z script_sig, uint32_t sequence, struct LDKThirtyTwoBytes previous_txid, uint32_t previous_vout);
25006
25007 /**
25008  * Gets the `witness` in the given `TxIn`.
25009  */
25010 struct LDKWitness TxIn_get_witness(const struct LDKTxIn *NONNULL_PTR txin);
25011
25012 /**
25013  * Gets the `script_sig` in the given `TxIn`.
25014  */
25015 struct LDKu8slice TxIn_get_script_sig(const struct LDKTxIn *NONNULL_PTR txin);
25016
25017 /**
25018  * Gets the `sequence` in the given `TxIn`.
25019  */
25020 uint32_t TxIn_get_sequence(const struct LDKTxIn *NONNULL_PTR txin);
25021
25022 /**
25023  * Gets the previous outpoint txid in the given `TxIn`.
25024  */
25025 struct LDKThirtyTwoBytes TxIn_get_previous_txid(const struct LDKTxIn *NONNULL_PTR txin);
25026
25027 /**
25028  * Gets the previout outpoint index in the given `TxIn`.
25029  */
25030 uint32_t TxIn_get_previous_vout(const struct LDKTxIn *NONNULL_PTR txin);
25031
25032 /**
25033  * Frees the witness and script_sig in a TxIn
25034  */
25035 void TxIn_free(struct LDKTxIn _res);
25036
25037 /**
25038  * Convenience function for constructing a new TxOut
25039  */
25040 struct LDKTxOut TxOut_new(struct LDKCVec_u8Z script_pubkey, uint64_t value);
25041
25042 /**
25043  * Gets the `script_pubkey` in the given `TxOut`.
25044  */
25045 struct LDKu8slice TxOut_get_script_pubkey(const struct LDKTxOut *NONNULL_PTR txout);
25046
25047 /**
25048  * Gets the value in the given `TxOut`.
25049  */
25050 uint64_t TxOut_get_value(const struct LDKTxOut *NONNULL_PTR txout);
25051
25052 /**
25053  * Frees the data pointed to by script_pubkey.
25054  */
25055 void TxOut_free(struct LDKTxOut _res);
25056
25057 /**
25058  * Creates a new TxOut which has the same data as `orig` but with a new script buffer.
25059  */
25060 struct LDKTxOut TxOut_clone(const struct LDKTxOut *NONNULL_PTR orig);
25061
25062 /**
25063  * Frees the data buffer, if chars_is_owned is set and len > 0.
25064  */
25065 void Str_free(struct LDKStr _res);
25066
25067 #if defined(LDK_DEBUG_BUILD)
25068 /**
25069  * This function exists for memory safety testing purposes. It should never be used in production
25070  * code
25071  */
25072 const void *__unmangle_inner_ptr(const void *ptr);
25073 #endif
25074
25075 /**
25076  * Frees the buffer pointed to by `data` if `datalen` is non-0.
25077  */
25078 void CVec_u8Z_free(struct LDKCVec_u8Z _res);
25079
25080 /**
25081  * Creates a new CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ in the success state.
25082  */
25083 struct LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_ok(struct LDKRefundMaybeWithDerivedMetadataBuilder o);
25084
25085 /**
25086  * Creates a new CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ in the error state.
25087  */
25088 struct LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_err(enum LDKBolt12SemanticError e);
25089
25090 /**
25091  * Checks if the given object is currently in the success state
25092  */
25093 bool CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_is_ok(const struct LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ *NONNULL_PTR o);
25094
25095 /**
25096  * Frees any resources used by the CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ.
25097  */
25098 void CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_free(struct LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ _res);
25099
25100 /**
25101  * Creates a new CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ which has the same data as `orig`
25102  * but with all dynamically-allocated buffers duplicated in new buffers.
25103  */
25104 struct LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone(const struct LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ *NONNULL_PTR orig);
25105
25106 /**
25107  * Creates a new CResult_RefundBolt12SemanticErrorZ in the success state.
25108  */
25109 struct LDKCResult_RefundBolt12SemanticErrorZ CResult_RefundBolt12SemanticErrorZ_ok(struct LDKRefund o);
25110
25111 /**
25112  * Creates a new CResult_RefundBolt12SemanticErrorZ in the error state.
25113  */
25114 struct LDKCResult_RefundBolt12SemanticErrorZ CResult_RefundBolt12SemanticErrorZ_err(enum LDKBolt12SemanticError e);
25115
25116 /**
25117  * Checks if the given object is currently in the success state
25118  */
25119 bool CResult_RefundBolt12SemanticErrorZ_is_ok(const struct LDKCResult_RefundBolt12SemanticErrorZ *NONNULL_PTR o);
25120
25121 /**
25122  * Frees any resources used by the CResult_RefundBolt12SemanticErrorZ.
25123  */
25124 void CResult_RefundBolt12SemanticErrorZ_free(struct LDKCResult_RefundBolt12SemanticErrorZ _res);
25125
25126 /**
25127  * Creates a new CResult_RefundBolt12SemanticErrorZ which has the same data as `orig`
25128  * but with all dynamically-allocated buffers duplicated in new buffers.
25129  */
25130 struct LDKCResult_RefundBolt12SemanticErrorZ CResult_RefundBolt12SemanticErrorZ_clone(const struct LDKCResult_RefundBolt12SemanticErrorZ *NONNULL_PTR orig);
25131
25132 /**
25133  * Constructs a new COption_u64Z containing a u64
25134  */
25135 struct LDKCOption_u64Z COption_u64Z_some(uint64_t o);
25136
25137 /**
25138  * Constructs a new COption_u64Z containing nothing
25139  */
25140 struct LDKCOption_u64Z COption_u64Z_none(void);
25141
25142 /**
25143  * Frees any resources associated with the u64, if we are in the Some state
25144  */
25145 void COption_u64Z_free(struct LDKCOption_u64Z _res);
25146
25147 /**
25148  * Creates a new COption_u64Z which has the same data as `orig`
25149  * but with all dynamically-allocated buffers duplicated in new buffers.
25150  */
25151 struct LDKCOption_u64Z COption_u64Z_clone(const struct LDKCOption_u64Z *NONNULL_PTR orig);
25152
25153 /**
25154  * Frees the buffer pointed to by `data` if `datalen` is non-0.
25155  */
25156 void CVec_BlindedPathZ_free(struct LDKCVec_BlindedPathZ _res);
25157
25158 /**
25159  * Creates a new CResult_RefundBolt12ParseErrorZ in the success state.
25160  */
25161 struct LDKCResult_RefundBolt12ParseErrorZ CResult_RefundBolt12ParseErrorZ_ok(struct LDKRefund o);
25162
25163 /**
25164  * Creates a new CResult_RefundBolt12ParseErrorZ in the error state.
25165  */
25166 struct LDKCResult_RefundBolt12ParseErrorZ CResult_RefundBolt12ParseErrorZ_err(struct LDKBolt12ParseError e);
25167
25168 /**
25169  * Checks if the given object is currently in the success state
25170  */
25171 bool CResult_RefundBolt12ParseErrorZ_is_ok(const struct LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR o);
25172
25173 /**
25174  * Frees any resources used by the CResult_RefundBolt12ParseErrorZ.
25175  */
25176 void CResult_RefundBolt12ParseErrorZ_free(struct LDKCResult_RefundBolt12ParseErrorZ _res);
25177
25178 /**
25179  * Creates a new CResult_RefundBolt12ParseErrorZ which has the same data as `orig`
25180  * but with all dynamically-allocated buffers duplicated in new buffers.
25181  */
25182 struct LDKCResult_RefundBolt12ParseErrorZ CResult_RefundBolt12ParseErrorZ_clone(const struct LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR orig);
25183
25184 /**
25185  * Creates a new CResult_RetryDecodeErrorZ in the success state.
25186  */
25187 struct LDKCResult_RetryDecodeErrorZ CResult_RetryDecodeErrorZ_ok(struct LDKRetry o);
25188
25189 /**
25190  * Creates a new CResult_RetryDecodeErrorZ in the error state.
25191  */
25192 struct LDKCResult_RetryDecodeErrorZ CResult_RetryDecodeErrorZ_err(struct LDKDecodeError e);
25193
25194 /**
25195  * Checks if the given object is currently in the success state
25196  */
25197 bool CResult_RetryDecodeErrorZ_is_ok(const struct LDKCResult_RetryDecodeErrorZ *NONNULL_PTR o);
25198
25199 /**
25200  * Frees any resources used by the CResult_RetryDecodeErrorZ.
25201  */
25202 void CResult_RetryDecodeErrorZ_free(struct LDKCResult_RetryDecodeErrorZ _res);
25203
25204 /**
25205  * Creates a new CResult_RetryDecodeErrorZ which has the same data as `orig`
25206  * but with all dynamically-allocated buffers duplicated in new buffers.
25207  */
25208 struct LDKCResult_RetryDecodeErrorZ CResult_RetryDecodeErrorZ_clone(const struct LDKCResult_RetryDecodeErrorZ *NONNULL_PTR orig);
25209
25210 /**
25211  * Creates a new CResult_NoneAPIErrorZ in the success state.
25212  */
25213 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_ok(void);
25214
25215 /**
25216  * Creates a new CResult_NoneAPIErrorZ in the error state.
25217  */
25218 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_err(struct LDKAPIError e);
25219
25220 /**
25221  * Checks if the given object is currently in the success state
25222  */
25223 bool CResult_NoneAPIErrorZ_is_ok(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR o);
25224
25225 /**
25226  * Frees any resources used by the CResult_NoneAPIErrorZ.
25227  */
25228 void CResult_NoneAPIErrorZ_free(struct LDKCResult_NoneAPIErrorZ _res);
25229
25230 /**
25231  * Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
25232  * but with all dynamically-allocated buffers duplicated in new buffers.
25233  */
25234 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_clone(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR orig);
25235
25236 /**
25237  * Frees the buffer pointed to by `data` if `datalen` is non-0.
25238  */
25239 void CVec_CResult_NoneAPIErrorZZ_free(struct LDKCVec_CResult_NoneAPIErrorZZ _res);
25240
25241 /**
25242  * Frees the buffer pointed to by `data` if `datalen` is non-0.
25243  */
25244 void CVec_APIErrorZ_free(struct LDKCVec_APIErrorZ _res);
25245
25246 /**
25247  * Constructs a new COption_ThirtyTwoBytesZ containing a crate::c_types::ThirtyTwoBytes
25248  */
25249 struct LDKCOption_ThirtyTwoBytesZ COption_ThirtyTwoBytesZ_some(struct LDKThirtyTwoBytes o);
25250
25251 /**
25252  * Constructs a new COption_ThirtyTwoBytesZ containing nothing
25253  */
25254 struct LDKCOption_ThirtyTwoBytesZ COption_ThirtyTwoBytesZ_none(void);
25255
25256 /**
25257  * Frees any resources associated with the crate::c_types::ThirtyTwoBytes, if we are in the Some state
25258  */
25259 void COption_ThirtyTwoBytesZ_free(struct LDKCOption_ThirtyTwoBytesZ _res);
25260
25261 /**
25262  * Creates a new COption_ThirtyTwoBytesZ which has the same data as `orig`
25263  * but with all dynamically-allocated buffers duplicated in new buffers.
25264  */
25265 struct LDKCOption_ThirtyTwoBytesZ COption_ThirtyTwoBytesZ_clone(const struct LDKCOption_ThirtyTwoBytesZ *NONNULL_PTR orig);
25266
25267 /**
25268  * Constructs a new COption_CVec_u8ZZ containing a crate::c_types::derived::CVec_u8Z
25269  */
25270 struct LDKCOption_CVec_u8ZZ COption_CVec_u8ZZ_some(struct LDKCVec_u8Z o);
25271
25272 /**
25273  * Constructs a new COption_CVec_u8ZZ containing nothing
25274  */
25275 struct LDKCOption_CVec_u8ZZ COption_CVec_u8ZZ_none(void);
25276
25277 /**
25278  * Frees any resources associated with the crate::c_types::derived::CVec_u8Z, if we are in the Some state
25279  */
25280 void COption_CVec_u8ZZ_free(struct LDKCOption_CVec_u8ZZ _res);
25281
25282 /**
25283  * Creates a new COption_CVec_u8ZZ which has the same data as `orig`
25284  * but with all dynamically-allocated buffers duplicated in new buffers.
25285  */
25286 struct LDKCOption_CVec_u8ZZ COption_CVec_u8ZZ_clone(const struct LDKCOption_CVec_u8ZZ *NONNULL_PTR orig);
25287
25288 /**
25289  * Creates a new CResult_RecipientOnionFieldsDecodeErrorZ in the success state.
25290  */
25291 struct LDKCResult_RecipientOnionFieldsDecodeErrorZ CResult_RecipientOnionFieldsDecodeErrorZ_ok(struct LDKRecipientOnionFields o);
25292
25293 /**
25294  * Creates a new CResult_RecipientOnionFieldsDecodeErrorZ in the error state.
25295  */
25296 struct LDKCResult_RecipientOnionFieldsDecodeErrorZ CResult_RecipientOnionFieldsDecodeErrorZ_err(struct LDKDecodeError e);
25297
25298 /**
25299  * Checks if the given object is currently in the success state
25300  */
25301 bool CResult_RecipientOnionFieldsDecodeErrorZ_is_ok(const struct LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR o);
25302
25303 /**
25304  * Frees any resources used by the CResult_RecipientOnionFieldsDecodeErrorZ.
25305  */
25306 void CResult_RecipientOnionFieldsDecodeErrorZ_free(struct LDKCResult_RecipientOnionFieldsDecodeErrorZ _res);
25307
25308 /**
25309  * Creates a new CResult_RecipientOnionFieldsDecodeErrorZ which has the same data as `orig`
25310  * but with all dynamically-allocated buffers duplicated in new buffers.
25311  */
25312 struct LDKCResult_RecipientOnionFieldsDecodeErrorZ CResult_RecipientOnionFieldsDecodeErrorZ_clone(const struct LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR orig);
25313
25314 /**
25315  * Creates a new tuple which has the same data as `orig`
25316  * but with all dynamically-allocated buffers duplicated in new buffers.
25317  */
25318 struct LDKC2Tuple_u64CVec_u8ZZ C2Tuple_u64CVec_u8ZZ_clone(const struct LDKC2Tuple_u64CVec_u8ZZ *NONNULL_PTR orig);
25319
25320 /**
25321  * Creates a new C2Tuple_u64CVec_u8ZZ from the contained elements.
25322  */
25323 struct LDKC2Tuple_u64CVec_u8ZZ C2Tuple_u64CVec_u8ZZ_new(uint64_t a, struct LDKCVec_u8Z b);
25324
25325 /**
25326  * Frees any resources used by the C2Tuple_u64CVec_u8ZZ.
25327  */
25328 void C2Tuple_u64CVec_u8ZZ_free(struct LDKC2Tuple_u64CVec_u8ZZ _res);
25329
25330 /**
25331  * Frees the buffer pointed to by `data` if `datalen` is non-0.
25332  */
25333 void CVec_C2Tuple_u64CVec_u8ZZZ_free(struct LDKCVec_C2Tuple_u64CVec_u8ZZZ _res);
25334
25335 /**
25336  * Creates a new CResult_RecipientOnionFieldsNoneZ in the success state.
25337  */
25338 struct LDKCResult_RecipientOnionFieldsNoneZ CResult_RecipientOnionFieldsNoneZ_ok(struct LDKRecipientOnionFields o);
25339
25340 /**
25341  * Creates a new CResult_RecipientOnionFieldsNoneZ in the error state.
25342  */
25343 struct LDKCResult_RecipientOnionFieldsNoneZ CResult_RecipientOnionFieldsNoneZ_err(void);
25344
25345 /**
25346  * Checks if the given object is currently in the success state
25347  */
25348 bool CResult_RecipientOnionFieldsNoneZ_is_ok(const struct LDKCResult_RecipientOnionFieldsNoneZ *NONNULL_PTR o);
25349
25350 /**
25351  * Frees any resources used by the CResult_RecipientOnionFieldsNoneZ.
25352  */
25353 void CResult_RecipientOnionFieldsNoneZ_free(struct LDKCResult_RecipientOnionFieldsNoneZ _res);
25354
25355 /**
25356  * Creates a new CResult_RecipientOnionFieldsNoneZ which has the same data as `orig`
25357  * but with all dynamically-allocated buffers duplicated in new buffers.
25358  */
25359 struct LDKCResult_RecipientOnionFieldsNoneZ CResult_RecipientOnionFieldsNoneZ_clone(const struct LDKCResult_RecipientOnionFieldsNoneZ *NONNULL_PTR orig);
25360
25361 /**
25362  * Creates a new CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ in the success state.
25363  */
25364 struct LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_ok(struct LDKUnsignedBolt12Invoice o);
25365
25366 /**
25367  * Creates a new CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ in the error state.
25368  */
25369 struct LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_err(enum LDKBolt12SemanticError e);
25370
25371 /**
25372  * Checks if the given object is currently in the success state
25373  */
25374 bool CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_is_ok(const struct LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ *NONNULL_PTR o);
25375
25376 /**
25377  * Frees any resources used by the CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ.
25378  */
25379 void CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_free(struct LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ _res);
25380
25381 /**
25382  * Creates a new CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ which has the same data as `orig`
25383  * but with all dynamically-allocated buffers duplicated in new buffers.
25384  */
25385 struct LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_clone(const struct LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ *NONNULL_PTR orig);
25386
25387 /**
25388  * Creates a new CResult_Bolt12InvoiceBolt12SemanticErrorZ in the success state.
25389  */
25390 struct LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ CResult_Bolt12InvoiceBolt12SemanticErrorZ_ok(struct LDKBolt12Invoice o);
25391
25392 /**
25393  * Creates a new CResult_Bolt12InvoiceBolt12SemanticErrorZ in the error state.
25394  */
25395 struct LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ CResult_Bolt12InvoiceBolt12SemanticErrorZ_err(enum LDKBolt12SemanticError e);
25396
25397 /**
25398  * Checks if the given object is currently in the success state
25399  */
25400 bool CResult_Bolt12InvoiceBolt12SemanticErrorZ_is_ok(const struct LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ *NONNULL_PTR o);
25401
25402 /**
25403  * Frees any resources used by the CResult_Bolt12InvoiceBolt12SemanticErrorZ.
25404  */
25405 void CResult_Bolt12InvoiceBolt12SemanticErrorZ_free(struct LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ _res);
25406
25407 /**
25408  * Creates a new CResult_Bolt12InvoiceBolt12SemanticErrorZ which has the same data as `orig`
25409  * but with all dynamically-allocated buffers duplicated in new buffers.
25410  */
25411 struct LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ CResult_Bolt12InvoiceBolt12SemanticErrorZ_clone(const struct LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ *NONNULL_PTR orig);
25412
25413 /**
25414  * Creates a new CResult_SchnorrSignatureNoneZ in the success state.
25415  */
25416 struct LDKCResult_SchnorrSignatureNoneZ CResult_SchnorrSignatureNoneZ_ok(struct LDKSchnorrSignature o);
25417
25418 /**
25419  * Creates a new CResult_SchnorrSignatureNoneZ in the error state.
25420  */
25421 struct LDKCResult_SchnorrSignatureNoneZ CResult_SchnorrSignatureNoneZ_err(void);
25422
25423 /**
25424  * Checks if the given object is currently in the success state
25425  */
25426 bool CResult_SchnorrSignatureNoneZ_is_ok(const struct LDKCResult_SchnorrSignatureNoneZ *NONNULL_PTR o);
25427
25428 /**
25429  * Frees any resources used by the CResult_SchnorrSignatureNoneZ.
25430  */
25431 void CResult_SchnorrSignatureNoneZ_free(struct LDKCResult_SchnorrSignatureNoneZ _res);
25432
25433 /**
25434  * Creates a new CResult_SchnorrSignatureNoneZ which has the same data as `orig`
25435  * but with all dynamically-allocated buffers duplicated in new buffers.
25436  */
25437 struct LDKCResult_SchnorrSignatureNoneZ CResult_SchnorrSignatureNoneZ_clone(const struct LDKCResult_SchnorrSignatureNoneZ *NONNULL_PTR orig);
25438
25439 /**
25440  * Frees the buffer pointed to by `data` if `datalen` is non-0.
25441  */
25442 void CVec_ThirtyTwoBytesZ_free(struct LDKCVec_ThirtyTwoBytesZ _res);
25443
25444 /**
25445  * Constructs a new COption_CVec_ThirtyTwoBytesZZ containing a crate::c_types::derived::CVec_ThirtyTwoBytesZ
25446  */
25447 struct LDKCOption_CVec_ThirtyTwoBytesZZ COption_CVec_ThirtyTwoBytesZZ_some(struct LDKCVec_ThirtyTwoBytesZ o);
25448
25449 /**
25450  * Constructs a new COption_CVec_ThirtyTwoBytesZZ containing nothing
25451  */
25452 struct LDKCOption_CVec_ThirtyTwoBytesZZ COption_CVec_ThirtyTwoBytesZZ_none(void);
25453
25454 /**
25455  * Frees any resources associated with the crate::c_types::derived::CVec_ThirtyTwoBytesZ, if we are in the Some state
25456  */
25457 void COption_CVec_ThirtyTwoBytesZZ_free(struct LDKCOption_CVec_ThirtyTwoBytesZZ _res);
25458
25459 /**
25460  * Creates a new COption_CVec_ThirtyTwoBytesZZ which has the same data as `orig`
25461  * but with all dynamically-allocated buffers duplicated in new buffers.
25462  */
25463 struct LDKCOption_CVec_ThirtyTwoBytesZZ COption_CVec_ThirtyTwoBytesZZ_clone(const struct LDKCOption_CVec_ThirtyTwoBytesZZ *NONNULL_PTR orig);
25464
25465 /**
25466  * Constructs a new COption_AmountZ containing a crate::lightning::offers::offer::Amount
25467  */
25468 struct LDKCOption_AmountZ COption_AmountZ_some(struct LDKAmount o);
25469
25470 /**
25471  * Constructs a new COption_AmountZ containing nothing
25472  */
25473 struct LDKCOption_AmountZ COption_AmountZ_none(void);
25474
25475 /**
25476  * Frees any resources associated with the crate::lightning::offers::offer::Amount, if we are in the Some state
25477  */
25478 void COption_AmountZ_free(struct LDKCOption_AmountZ _res);
25479
25480 /**
25481  * Creates a new COption_AmountZ which has the same data as `orig`
25482  * but with all dynamically-allocated buffers duplicated in new buffers.
25483  */
25484 struct LDKCOption_AmountZ COption_AmountZ_clone(const struct LDKCOption_AmountZ *NONNULL_PTR orig);
25485
25486 /**
25487  * Constructs a new COption_QuantityZ containing a crate::lightning::offers::offer::Quantity
25488  */
25489 struct LDKCOption_QuantityZ COption_QuantityZ_some(struct LDKQuantity o);
25490
25491 /**
25492  * Constructs a new COption_QuantityZ containing nothing
25493  */
25494 struct LDKCOption_QuantityZ COption_QuantityZ_none(void);
25495
25496 /**
25497  * Frees any resources associated with the crate::lightning::offers::offer::Quantity, if we are in the Some state
25498  */
25499 void COption_QuantityZ_free(struct LDKCOption_QuantityZ _res);
25500
25501 /**
25502  * Creates a new COption_QuantityZ which has the same data as `orig`
25503  * but with all dynamically-allocated buffers duplicated in new buffers.
25504  */
25505 struct LDKCOption_QuantityZ COption_QuantityZ_clone(const struct LDKCOption_QuantityZ *NONNULL_PTR orig);
25506
25507 /**
25508  * Creates a new CResult_ThirtyTwoBytesNoneZ in the success state.
25509  */
25510 struct LDKCResult_ThirtyTwoBytesNoneZ CResult_ThirtyTwoBytesNoneZ_ok(struct LDKThirtyTwoBytes o);
25511
25512 /**
25513  * Creates a new CResult_ThirtyTwoBytesNoneZ in the error state.
25514  */
25515 struct LDKCResult_ThirtyTwoBytesNoneZ CResult_ThirtyTwoBytesNoneZ_err(void);
25516
25517 /**
25518  * Checks if the given object is currently in the success state
25519  */
25520 bool CResult_ThirtyTwoBytesNoneZ_is_ok(const struct LDKCResult_ThirtyTwoBytesNoneZ *NONNULL_PTR o);
25521
25522 /**
25523  * Frees any resources used by the CResult_ThirtyTwoBytesNoneZ.
25524  */
25525 void CResult_ThirtyTwoBytesNoneZ_free(struct LDKCResult_ThirtyTwoBytesNoneZ _res);
25526
25527 /**
25528  * Creates a new CResult_ThirtyTwoBytesNoneZ which has the same data as `orig`
25529  * but with all dynamically-allocated buffers duplicated in new buffers.
25530  */
25531 struct LDKCResult_ThirtyTwoBytesNoneZ CResult_ThirtyTwoBytesNoneZ_clone(const struct LDKCResult_ThirtyTwoBytesNoneZ *NONNULL_PTR orig);
25532
25533 /**
25534  * Creates a new CResult_BlindedPayInfoDecodeErrorZ in the success state.
25535  */
25536 struct LDKCResult_BlindedPayInfoDecodeErrorZ CResult_BlindedPayInfoDecodeErrorZ_ok(struct LDKBlindedPayInfo o);
25537
25538 /**
25539  * Creates a new CResult_BlindedPayInfoDecodeErrorZ in the error state.
25540  */
25541 struct LDKCResult_BlindedPayInfoDecodeErrorZ CResult_BlindedPayInfoDecodeErrorZ_err(struct LDKDecodeError e);
25542
25543 /**
25544  * Checks if the given object is currently in the success state
25545  */
25546 bool CResult_BlindedPayInfoDecodeErrorZ_is_ok(const struct LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR o);
25547
25548 /**
25549  * Frees any resources used by the CResult_BlindedPayInfoDecodeErrorZ.
25550  */
25551 void CResult_BlindedPayInfoDecodeErrorZ_free(struct LDKCResult_BlindedPayInfoDecodeErrorZ _res);
25552
25553 /**
25554  * Creates a new CResult_BlindedPayInfoDecodeErrorZ which has the same data as `orig`
25555  * but with all dynamically-allocated buffers duplicated in new buffers.
25556  */
25557 struct LDKCResult_BlindedPayInfoDecodeErrorZ CResult_BlindedPayInfoDecodeErrorZ_clone(const struct LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR orig);
25558
25559 /**
25560  * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
25561  */
25562 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(struct LDKDelayedPaymentOutputDescriptor o);
25563
25564 /**
25565  * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
25566  */
25567 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
25568
25569 /**
25570  * Checks if the given object is currently in the success state
25571  */
25572 bool CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR o);
25573
25574 /**
25575  * Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
25576  */
25577 void CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res);
25578
25579 /**
25580  * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
25581  * but with all dynamically-allocated buffers duplicated in new buffers.
25582  */
25583 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
25584
25585 /**
25586  * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
25587  */
25588 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(struct LDKStaticPaymentOutputDescriptor o);
25589
25590 /**
25591  * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
25592  */
25593 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
25594
25595 /**
25596  * Checks if the given object is currently in the success state
25597  */
25598 bool CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR o);
25599
25600 /**
25601  * Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
25602  */
25603 void CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res);
25604
25605 /**
25606  * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
25607  * but with all dynamically-allocated buffers duplicated in new buffers.
25608  */
25609 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
25610
25611 /**
25612  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
25613  */
25614 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_ok(struct LDKSpendableOutputDescriptor o);
25615
25616 /**
25617  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
25618  */
25619 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
25620
25621 /**
25622  * Checks if the given object is currently in the success state
25623  */
25624 bool CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR o);
25625
25626 /**
25627  * Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
25628  */
25629 void CResult_SpendableOutputDescriptorDecodeErrorZ_free(struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res);
25630
25631 /**
25632  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
25633  * but with all dynamically-allocated buffers duplicated in new buffers.
25634  */
25635 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
25636
25637 /**
25638  * Frees the buffer pointed to by `data` if `datalen` is non-0.
25639  */
25640 void CVec_SpendableOutputDescriptorZ_free(struct LDKCVec_SpendableOutputDescriptorZ _res);
25641
25642 /**
25643  * Frees the buffer pointed to by `data` if `datalen` is non-0.
25644  */
25645 void CVec_TxOutZ_free(struct LDKCVec_TxOutZ _res);
25646
25647 /**
25648  * Constructs a new COption_u32Z containing a u32
25649  */
25650 struct LDKCOption_u32Z COption_u32Z_some(uint32_t o);
25651
25652 /**
25653  * Constructs a new COption_u32Z containing nothing
25654  */
25655 struct LDKCOption_u32Z COption_u32Z_none(void);
25656
25657 /**
25658  * Frees any resources associated with the u32, if we are in the Some state
25659  */
25660 void COption_u32Z_free(struct LDKCOption_u32Z _res);
25661
25662 /**
25663  * Creates a new COption_u32Z which has the same data as `orig`
25664  * but with all dynamically-allocated buffers duplicated in new buffers.
25665  */
25666 struct LDKCOption_u32Z COption_u32Z_clone(const struct LDKCOption_u32Z *NONNULL_PTR orig);
25667
25668 /**
25669  * Creates a new tuple which has the same data as `orig`
25670  * but with all dynamically-allocated buffers duplicated in new buffers.
25671  */
25672 struct LDKC2Tuple_CVec_u8Zu64Z C2Tuple_CVec_u8Zu64Z_clone(const struct LDKC2Tuple_CVec_u8Zu64Z *NONNULL_PTR orig);
25673
25674 /**
25675  * Creates a new C2Tuple_CVec_u8Zu64Z from the contained elements.
25676  */
25677 struct LDKC2Tuple_CVec_u8Zu64Z C2Tuple_CVec_u8Zu64Z_new(struct LDKCVec_u8Z a, uint64_t b);
25678
25679 /**
25680  * Frees any resources used by the C2Tuple_CVec_u8Zu64Z.
25681  */
25682 void C2Tuple_CVec_u8Zu64Z_free(struct LDKC2Tuple_CVec_u8Zu64Z _res);
25683
25684 /**
25685  * Creates a new CResult_C2Tuple_CVec_u8Zu64ZNoneZ in the success state.
25686  */
25687 struct LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ CResult_C2Tuple_CVec_u8Zu64ZNoneZ_ok(struct LDKC2Tuple_CVec_u8Zu64Z o);
25688
25689 /**
25690  * Creates a new CResult_C2Tuple_CVec_u8Zu64ZNoneZ in the error state.
25691  */
25692 struct LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ CResult_C2Tuple_CVec_u8Zu64ZNoneZ_err(void);
25693
25694 /**
25695  * Checks if the given object is currently in the success state
25696  */
25697 bool CResult_C2Tuple_CVec_u8Zu64ZNoneZ_is_ok(const struct LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ *NONNULL_PTR o);
25698
25699 /**
25700  * Frees any resources used by the CResult_C2Tuple_CVec_u8Zu64ZNoneZ.
25701  */
25702 void CResult_C2Tuple_CVec_u8Zu64ZNoneZ_free(struct LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ _res);
25703
25704 /**
25705  * Creates a new CResult_C2Tuple_CVec_u8Zu64ZNoneZ which has the same data as `orig`
25706  * but with all dynamically-allocated buffers duplicated in new buffers.
25707  */
25708 struct LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone(const struct LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ *NONNULL_PTR orig);
25709
25710 /**
25711  * Creates a new CResult_ChannelDerivationParametersDecodeErrorZ in the success state.
25712  */
25713 struct LDKCResult_ChannelDerivationParametersDecodeErrorZ CResult_ChannelDerivationParametersDecodeErrorZ_ok(struct LDKChannelDerivationParameters o);
25714
25715 /**
25716  * Creates a new CResult_ChannelDerivationParametersDecodeErrorZ in the error state.
25717  */
25718 struct LDKCResult_ChannelDerivationParametersDecodeErrorZ CResult_ChannelDerivationParametersDecodeErrorZ_err(struct LDKDecodeError e);
25719
25720 /**
25721  * Checks if the given object is currently in the success state
25722  */
25723 bool CResult_ChannelDerivationParametersDecodeErrorZ_is_ok(const struct LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR o);
25724
25725 /**
25726  * Frees any resources used by the CResult_ChannelDerivationParametersDecodeErrorZ.
25727  */
25728 void CResult_ChannelDerivationParametersDecodeErrorZ_free(struct LDKCResult_ChannelDerivationParametersDecodeErrorZ _res);
25729
25730 /**
25731  * Creates a new CResult_ChannelDerivationParametersDecodeErrorZ which has the same data as `orig`
25732  * but with all dynamically-allocated buffers duplicated in new buffers.
25733  */
25734 struct LDKCResult_ChannelDerivationParametersDecodeErrorZ CResult_ChannelDerivationParametersDecodeErrorZ_clone(const struct LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR orig);
25735
25736 /**
25737  * Creates a new CResult_HTLCDescriptorDecodeErrorZ in the success state.
25738  */
25739 struct LDKCResult_HTLCDescriptorDecodeErrorZ CResult_HTLCDescriptorDecodeErrorZ_ok(struct LDKHTLCDescriptor o);
25740
25741 /**
25742  * Creates a new CResult_HTLCDescriptorDecodeErrorZ in the error state.
25743  */
25744 struct LDKCResult_HTLCDescriptorDecodeErrorZ CResult_HTLCDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
25745
25746 /**
25747  * Checks if the given object is currently in the success state
25748  */
25749 bool CResult_HTLCDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR o);
25750
25751 /**
25752  * Frees any resources used by the CResult_HTLCDescriptorDecodeErrorZ.
25753  */
25754 void CResult_HTLCDescriptorDecodeErrorZ_free(struct LDKCResult_HTLCDescriptorDecodeErrorZ _res);
25755
25756 /**
25757  * Creates a new CResult_HTLCDescriptorDecodeErrorZ which has the same data as `orig`
25758  * but with all dynamically-allocated buffers duplicated in new buffers.
25759  */
25760 struct LDKCResult_HTLCDescriptorDecodeErrorZ CResult_HTLCDescriptorDecodeErrorZ_clone(const struct LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR orig);
25761
25762 /**
25763  * Creates a new CResult_NoneNoneZ in the success state.
25764  */
25765 struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_ok(void);
25766
25767 /**
25768  * Creates a new CResult_NoneNoneZ in the error state.
25769  */
25770 struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_err(void);
25771
25772 /**
25773  * Checks if the given object is currently in the success state
25774  */
25775 bool CResult_NoneNoneZ_is_ok(const struct LDKCResult_NoneNoneZ *NONNULL_PTR o);
25776
25777 /**
25778  * Frees any resources used by the CResult_NoneNoneZ.
25779  */
25780 void CResult_NoneNoneZ_free(struct LDKCResult_NoneNoneZ _res);
25781
25782 /**
25783  * Creates a new CResult_NoneNoneZ which has the same data as `orig`
25784  * but with all dynamically-allocated buffers duplicated in new buffers.
25785  */
25786 struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_clone(const struct LDKCResult_NoneNoneZ *NONNULL_PTR orig);
25787
25788 /**
25789  * Creates a new CResult_PublicKeyNoneZ in the success state.
25790  */
25791 struct LDKCResult_PublicKeyNoneZ CResult_PublicKeyNoneZ_ok(struct LDKPublicKey o);
25792
25793 /**
25794  * Creates a new CResult_PublicKeyNoneZ in the error state.
25795  */
25796 struct LDKCResult_PublicKeyNoneZ CResult_PublicKeyNoneZ_err(void);
25797
25798 /**
25799  * Checks if the given object is currently in the success state
25800  */
25801 bool CResult_PublicKeyNoneZ_is_ok(const struct LDKCResult_PublicKeyNoneZ *NONNULL_PTR o);
25802
25803 /**
25804  * Frees any resources used by the CResult_PublicKeyNoneZ.
25805  */
25806 void CResult_PublicKeyNoneZ_free(struct LDKCResult_PublicKeyNoneZ _res);
25807
25808 /**
25809  * Creates a new CResult_PublicKeyNoneZ which has the same data as `orig`
25810  * but with all dynamically-allocated buffers duplicated in new buffers.
25811  */
25812 struct LDKCResult_PublicKeyNoneZ CResult_PublicKeyNoneZ_clone(const struct LDKCResult_PublicKeyNoneZ *NONNULL_PTR orig);
25813
25814 /**
25815  * Constructs a new COption_BigEndianScalarZ containing a crate::c_types::BigEndianScalar
25816  */
25817 struct LDKCOption_BigEndianScalarZ COption_BigEndianScalarZ_some(struct LDKBigEndianScalar o);
25818
25819 /**
25820  * Constructs a new COption_BigEndianScalarZ containing nothing
25821  */
25822 struct LDKCOption_BigEndianScalarZ COption_BigEndianScalarZ_none(void);
25823
25824 /**
25825  * Frees any resources associated with the crate::c_types::BigEndianScalar, if we are in the Some state
25826  */
25827 void COption_BigEndianScalarZ_free(struct LDKCOption_BigEndianScalarZ _res);
25828
25829 /**
25830  * Creates a new COption_BigEndianScalarZ which has the same data as `orig`
25831  * but with all dynamically-allocated buffers duplicated in new buffers.
25832  */
25833 struct LDKCOption_BigEndianScalarZ COption_BigEndianScalarZ_clone(const struct LDKCOption_BigEndianScalarZ *NONNULL_PTR orig);
25834
25835 /**
25836  * Frees the buffer pointed to by `data` if `datalen` is non-0.
25837  */
25838 void CVec_U5Z_free(struct LDKCVec_U5Z _res);
25839
25840 /**
25841  * Creates a new CResult_RecoverableSignatureNoneZ in the success state.
25842  */
25843 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_ok(struct LDKRecoverableSignature o);
25844
25845 /**
25846  * Creates a new CResult_RecoverableSignatureNoneZ in the error state.
25847  */
25848 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_err(void);
25849
25850 /**
25851  * Checks if the given object is currently in the success state
25852  */
25853 bool CResult_RecoverableSignatureNoneZ_is_ok(const struct LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR o);
25854
25855 /**
25856  * Frees any resources used by the CResult_RecoverableSignatureNoneZ.
25857  */
25858 void CResult_RecoverableSignatureNoneZ_free(struct LDKCResult_RecoverableSignatureNoneZ _res);
25859
25860 /**
25861  * Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
25862  * but with all dynamically-allocated buffers duplicated in new buffers.
25863  */
25864 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_clone(const struct LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR orig);
25865
25866 /**
25867  * Creates a new CResult_ECDSASignatureNoneZ in the success state.
25868  */
25869 struct LDKCResult_ECDSASignatureNoneZ CResult_ECDSASignatureNoneZ_ok(struct LDKECDSASignature o);
25870
25871 /**
25872  * Creates a new CResult_ECDSASignatureNoneZ in the error state.
25873  */
25874 struct LDKCResult_ECDSASignatureNoneZ CResult_ECDSASignatureNoneZ_err(void);
25875
25876 /**
25877  * Checks if the given object is currently in the success state
25878  */
25879 bool CResult_ECDSASignatureNoneZ_is_ok(const struct LDKCResult_ECDSASignatureNoneZ *NONNULL_PTR o);
25880
25881 /**
25882  * Frees any resources used by the CResult_ECDSASignatureNoneZ.
25883  */
25884 void CResult_ECDSASignatureNoneZ_free(struct LDKCResult_ECDSASignatureNoneZ _res);
25885
25886 /**
25887  * Creates a new CResult_ECDSASignatureNoneZ which has the same data as `orig`
25888  * but with all dynamically-allocated buffers duplicated in new buffers.
25889  */
25890 struct LDKCResult_ECDSASignatureNoneZ CResult_ECDSASignatureNoneZ_clone(const struct LDKCResult_ECDSASignatureNoneZ *NONNULL_PTR orig);
25891
25892 /**
25893  * Creates a new CResult_TransactionNoneZ in the success state.
25894  */
25895 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_ok(struct LDKTransaction o);
25896
25897 /**
25898  * Creates a new CResult_TransactionNoneZ in the error state.
25899  */
25900 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_err(void);
25901
25902 /**
25903  * Checks if the given object is currently in the success state
25904  */
25905 bool CResult_TransactionNoneZ_is_ok(const struct LDKCResult_TransactionNoneZ *NONNULL_PTR o);
25906
25907 /**
25908  * Frees any resources used by the CResult_TransactionNoneZ.
25909  */
25910 void CResult_TransactionNoneZ_free(struct LDKCResult_TransactionNoneZ _res);
25911
25912 /**
25913  * Creates a new CResult_TransactionNoneZ which has the same data as `orig`
25914  * but with all dynamically-allocated buffers duplicated in new buffers.
25915  */
25916 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_clone(const struct LDKCResult_TransactionNoneZ *NONNULL_PTR orig);
25917
25918 /**
25919  * Creates a new CResult_WriteableEcdsaChannelSignerDecodeErrorZ in the success state.
25920  */
25921 struct LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(struct LDKWriteableEcdsaChannelSigner o);
25922
25923 /**
25924  * Creates a new CResult_WriteableEcdsaChannelSignerDecodeErrorZ in the error state.
25925  */
25926 struct LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err(struct LDKDecodeError e);
25927
25928 /**
25929  * Checks if the given object is currently in the success state
25930  */
25931 bool CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(const struct LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR o);
25932
25933 /**
25934  * Frees any resources used by the CResult_WriteableEcdsaChannelSignerDecodeErrorZ.
25935  */
25936 void CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(struct LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ _res);
25937
25938 /**
25939  * Creates a new CResult_WriteableEcdsaChannelSignerDecodeErrorZ which has the same data as `orig`
25940  * but with all dynamically-allocated buffers duplicated in new buffers.
25941  */
25942 struct LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(const struct LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR orig);
25943
25944 /**
25945  * Creates a new CResult_CVec_u8ZNoneZ in the success state.
25946  */
25947 struct LDKCResult_CVec_u8ZNoneZ CResult_CVec_u8ZNoneZ_ok(struct LDKCVec_u8Z o);
25948
25949 /**
25950  * Creates a new CResult_CVec_u8ZNoneZ in the error state.
25951  */
25952 struct LDKCResult_CVec_u8ZNoneZ CResult_CVec_u8ZNoneZ_err(void);
25953
25954 /**
25955  * Checks if the given object is currently in the success state
25956  */
25957 bool CResult_CVec_u8ZNoneZ_is_ok(const struct LDKCResult_CVec_u8ZNoneZ *NONNULL_PTR o);
25958
25959 /**
25960  * Frees any resources used by the CResult_CVec_u8ZNoneZ.
25961  */
25962 void CResult_CVec_u8ZNoneZ_free(struct LDKCResult_CVec_u8ZNoneZ _res);
25963
25964 /**
25965  * Creates a new CResult_CVec_u8ZNoneZ which has the same data as `orig`
25966  * but with all dynamically-allocated buffers duplicated in new buffers.
25967  */
25968 struct LDKCResult_CVec_u8ZNoneZ CResult_CVec_u8ZNoneZ_clone(const struct LDKCResult_CVec_u8ZNoneZ *NONNULL_PTR orig);
25969
25970 /**
25971  * Creates a new CResult_ShutdownScriptNoneZ in the success state.
25972  */
25973 struct LDKCResult_ShutdownScriptNoneZ CResult_ShutdownScriptNoneZ_ok(struct LDKShutdownScript o);
25974
25975 /**
25976  * Creates a new CResult_ShutdownScriptNoneZ in the error state.
25977  */
25978 struct LDKCResult_ShutdownScriptNoneZ CResult_ShutdownScriptNoneZ_err(void);
25979
25980 /**
25981  * Checks if the given object is currently in the success state
25982  */
25983 bool CResult_ShutdownScriptNoneZ_is_ok(const struct LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR o);
25984
25985 /**
25986  * Frees any resources used by the CResult_ShutdownScriptNoneZ.
25987  */
25988 void CResult_ShutdownScriptNoneZ_free(struct LDKCResult_ShutdownScriptNoneZ _res);
25989
25990 /**
25991  * Creates a new CResult_ShutdownScriptNoneZ which has the same data as `orig`
25992  * but with all dynamically-allocated buffers duplicated in new buffers.
25993  */
25994 struct LDKCResult_ShutdownScriptNoneZ CResult_ShutdownScriptNoneZ_clone(const struct LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR orig);
25995
25996 /**
25997  * Constructs a new COption_u16Z containing a u16
25998  */
25999 struct LDKCOption_u16Z COption_u16Z_some(uint16_t o);
26000
26001 /**
26002  * Constructs a new COption_u16Z containing nothing
26003  */
26004 struct LDKCOption_u16Z COption_u16Z_none(void);
26005
26006 /**
26007  * Frees any resources associated with the u16, if we are in the Some state
26008  */
26009 void COption_u16Z_free(struct LDKCOption_u16Z _res);
26010
26011 /**
26012  * Creates a new COption_u16Z which has the same data as `orig`
26013  * but with all dynamically-allocated buffers duplicated in new buffers.
26014  */
26015 struct LDKCOption_u16Z COption_u16Z_clone(const struct LDKCOption_u16Z *NONNULL_PTR orig);
26016
26017 /**
26018  * Constructs a new COption_boolZ containing a bool
26019  */
26020 struct LDKCOption_boolZ COption_boolZ_some(bool o);
26021
26022 /**
26023  * Constructs a new COption_boolZ containing nothing
26024  */
26025 struct LDKCOption_boolZ COption_boolZ_none(void);
26026
26027 /**
26028  * Frees any resources associated with the bool, if we are in the Some state
26029  */
26030 void COption_boolZ_free(struct LDKCOption_boolZ _res);
26031
26032 /**
26033  * Creates a new COption_boolZ which has the same data as `orig`
26034  * but with all dynamically-allocated buffers duplicated in new buffers.
26035  */
26036 struct LDKCOption_boolZ COption_boolZ_clone(const struct LDKCOption_boolZ *NONNULL_PTR orig);
26037
26038 /**
26039  * Creates a new CResult_WitnessNoneZ in the success state.
26040  */
26041 struct LDKCResult_WitnessNoneZ CResult_WitnessNoneZ_ok(struct LDKWitness o);
26042
26043 /**
26044  * Creates a new CResult_WitnessNoneZ in the error state.
26045  */
26046 struct LDKCResult_WitnessNoneZ CResult_WitnessNoneZ_err(void);
26047
26048 /**
26049  * Checks if the given object is currently in the success state
26050  */
26051 bool CResult_WitnessNoneZ_is_ok(const struct LDKCResult_WitnessNoneZ *NONNULL_PTR o);
26052
26053 /**
26054  * Frees any resources used by the CResult_WitnessNoneZ.
26055  */
26056 void CResult_WitnessNoneZ_free(struct LDKCResult_WitnessNoneZ _res);
26057
26058 /**
26059  * Creates a new CResult_WitnessNoneZ which has the same data as `orig`
26060  * but with all dynamically-allocated buffers duplicated in new buffers.
26061  */
26062 struct LDKCResult_WitnessNoneZ CResult_WitnessNoneZ_clone(const struct LDKCResult_WitnessNoneZ *NONNULL_PTR orig);
26063
26064 /**
26065  * Frees the buffer pointed to by `data` if `datalen` is non-0.
26066  */
26067 void CVec_ECDSASignatureZ_free(struct LDKCVec_ECDSASignatureZ _res);
26068
26069 /**
26070  * Creates a new tuple which has the same data as `orig`
26071  * but with all dynamically-allocated buffers duplicated in new buffers.
26072  */
26073 struct LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(const struct LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ *NONNULL_PTR orig);
26074
26075 /**
26076  * Creates a new C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ from the contained elements.
26077  */
26078 struct LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_new(struct LDKECDSASignature a, struct LDKCVec_ECDSASignatureZ b);
26079
26080 /**
26081  * Frees any resources used by the C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ.
26082  */
26083 void C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_free(struct LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ _res);
26084
26085 /**
26086  * Creates a new CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ in the success state.
26087  */
26088 struct LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_ok(struct LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ o);
26089
26090 /**
26091  * Creates a new CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ in the error state.
26092  */
26093 struct LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_err(void);
26094
26095 /**
26096  * Checks if the given object is currently in the success state
26097  */
26098 bool CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_is_ok(const struct LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ *NONNULL_PTR o);
26099
26100 /**
26101  * Frees any resources used by the CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ.
26102  */
26103 void CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_free(struct LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ _res);
26104
26105 /**
26106  * Creates a new CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ which has the same data as `orig`
26107  * but with all dynamically-allocated buffers duplicated in new buffers.
26108  */
26109 struct LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone(const struct LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ *NONNULL_PTR orig);
26110
26111 /**
26112  * Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
26113  */
26114 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_ok(struct LDKInMemorySigner o);
26115
26116 /**
26117  * Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
26118  */
26119 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_err(struct LDKDecodeError e);
26120
26121 /**
26122  * Checks if the given object is currently in the success state
26123  */
26124 bool CResult_InMemorySignerDecodeErrorZ_is_ok(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR o);
26125
26126 /**
26127  * Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
26128  */
26129 void CResult_InMemorySignerDecodeErrorZ_free(struct LDKCResult_InMemorySignerDecodeErrorZ _res);
26130
26131 /**
26132  * Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
26133  * but with all dynamically-allocated buffers duplicated in new buffers.
26134  */
26135 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_clone(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR orig);
26136
26137 /**
26138  * Constructs a new COption_WriteableScoreZ containing a crate::lightning::routing::scoring::WriteableScore
26139  */
26140 struct LDKCOption_WriteableScoreZ COption_WriteableScoreZ_some(struct LDKWriteableScore o);
26141
26142 /**
26143  * Constructs a new COption_WriteableScoreZ containing nothing
26144  */
26145 struct LDKCOption_WriteableScoreZ COption_WriteableScoreZ_none(void);
26146
26147 /**
26148  * Frees any resources associated with the crate::lightning::routing::scoring::WriteableScore, if we are in the Some state
26149  */
26150 void COption_WriteableScoreZ_free(struct LDKCOption_WriteableScoreZ _res);
26151
26152 /**
26153  * Creates a new CResult_NoneIOErrorZ in the success state.
26154  */
26155 struct LDKCResult_NoneIOErrorZ CResult_NoneIOErrorZ_ok(void);
26156
26157 /**
26158  * Creates a new CResult_NoneIOErrorZ in the error state.
26159  */
26160 struct LDKCResult_NoneIOErrorZ CResult_NoneIOErrorZ_err(enum LDKIOError e);
26161
26162 /**
26163  * Checks if the given object is currently in the success state
26164  */
26165 bool CResult_NoneIOErrorZ_is_ok(const struct LDKCResult_NoneIOErrorZ *NONNULL_PTR o);
26166
26167 /**
26168  * Frees any resources used by the CResult_NoneIOErrorZ.
26169  */
26170 void CResult_NoneIOErrorZ_free(struct LDKCResult_NoneIOErrorZ _res);
26171
26172 /**
26173  * Creates a new CResult_NoneIOErrorZ which has the same data as `orig`
26174  * but with all dynamically-allocated buffers duplicated in new buffers.
26175  */
26176 struct LDKCResult_NoneIOErrorZ CResult_NoneIOErrorZ_clone(const struct LDKCResult_NoneIOErrorZ *NONNULL_PTR orig);
26177
26178 /**
26179  * Frees the buffer pointed to by `data` if `datalen` is non-0.
26180  */
26181 void CVec_ChannelDetailsZ_free(struct LDKCVec_ChannelDetailsZ _res);
26182
26183 /**
26184  * Creates a new CResult_RouteLightningErrorZ in the success state.
26185  */
26186 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_ok(struct LDKRoute o);
26187
26188 /**
26189  * Creates a new CResult_RouteLightningErrorZ in the error state.
26190  */
26191 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_err(struct LDKLightningError e);
26192
26193 /**
26194  * Checks if the given object is currently in the success state
26195  */
26196 bool CResult_RouteLightningErrorZ_is_ok(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR o);
26197
26198 /**
26199  * Frees any resources used by the CResult_RouteLightningErrorZ.
26200  */
26201 void CResult_RouteLightningErrorZ_free(struct LDKCResult_RouteLightningErrorZ _res);
26202
26203 /**
26204  * Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
26205  * but with all dynamically-allocated buffers duplicated in new buffers.
26206  */
26207 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_clone(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR orig);
26208
26209 /**
26210  * Creates a new tuple which has the same data as `orig`
26211  * but with all dynamically-allocated buffers duplicated in new buffers.
26212  */
26213 struct LDKC2Tuple_BlindedPayInfoBlindedPathZ C2Tuple_BlindedPayInfoBlindedPathZ_clone(const struct LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR orig);
26214
26215 /**
26216  * Creates a new C2Tuple_BlindedPayInfoBlindedPathZ from the contained elements.
26217  */
26218 struct LDKC2Tuple_BlindedPayInfoBlindedPathZ C2Tuple_BlindedPayInfoBlindedPathZ_new(struct LDKBlindedPayInfo a, struct LDKBlindedPath b);
26219
26220 /**
26221  * Frees any resources used by the C2Tuple_BlindedPayInfoBlindedPathZ.
26222  */
26223 void C2Tuple_BlindedPayInfoBlindedPathZ_free(struct LDKC2Tuple_BlindedPayInfoBlindedPathZ _res);
26224
26225 /**
26226  * Frees the buffer pointed to by `data` if `datalen` is non-0.
26227  */
26228 void CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_free(struct LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ _res);
26229
26230 /**
26231  * Creates a new CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ in the success state.
26232  */
26233 struct LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_ok(struct LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ o);
26234
26235 /**
26236  * Creates a new CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ in the error state.
26237  */
26238 struct LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_err(void);
26239
26240 /**
26241  * Checks if the given object is currently in the success state
26242  */
26243 bool CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_is_ok(const struct LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ *NONNULL_PTR o);
26244
26245 /**
26246  * Frees any resources used by the CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ.
26247  */
26248 void CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_free(struct LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ _res);
26249
26250 /**
26251  * Creates a new CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ which has the same data as `orig`
26252  * but with all dynamically-allocated buffers duplicated in new buffers.
26253  */
26254 struct LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone(const struct LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ *NONNULL_PTR orig);
26255
26256 /**
26257  * Frees the buffer pointed to by `data` if `datalen` is non-0.
26258  */
26259 void CVec_PublicKeyZ_free(struct LDKCVec_PublicKeyZ _res);
26260
26261 /**
26262  * Creates a new CResult_OnionMessagePathNoneZ in the success state.
26263  */
26264 struct LDKCResult_OnionMessagePathNoneZ CResult_OnionMessagePathNoneZ_ok(struct LDKOnionMessagePath o);
26265
26266 /**
26267  * Creates a new CResult_OnionMessagePathNoneZ in the error state.
26268  */
26269 struct LDKCResult_OnionMessagePathNoneZ CResult_OnionMessagePathNoneZ_err(void);
26270
26271 /**
26272  * Checks if the given object is currently in the success state
26273  */
26274 bool CResult_OnionMessagePathNoneZ_is_ok(const struct LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR o);
26275
26276 /**
26277  * Frees any resources used by the CResult_OnionMessagePathNoneZ.
26278  */
26279 void CResult_OnionMessagePathNoneZ_free(struct LDKCResult_OnionMessagePathNoneZ _res);
26280
26281 /**
26282  * Creates a new CResult_OnionMessagePathNoneZ which has the same data as `orig`
26283  * but with all dynamically-allocated buffers duplicated in new buffers.
26284  */
26285 struct LDKCResult_OnionMessagePathNoneZ CResult_OnionMessagePathNoneZ_clone(const struct LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR orig);
26286
26287 /**
26288  * Creates a new CResult_CVec_BlindedPathZNoneZ in the success state.
26289  */
26290 struct LDKCResult_CVec_BlindedPathZNoneZ CResult_CVec_BlindedPathZNoneZ_ok(struct LDKCVec_BlindedPathZ o);
26291
26292 /**
26293  * Creates a new CResult_CVec_BlindedPathZNoneZ in the error state.
26294  */
26295 struct LDKCResult_CVec_BlindedPathZNoneZ CResult_CVec_BlindedPathZNoneZ_err(void);
26296
26297 /**
26298  * Checks if the given object is currently in the success state
26299  */
26300 bool CResult_CVec_BlindedPathZNoneZ_is_ok(const struct LDKCResult_CVec_BlindedPathZNoneZ *NONNULL_PTR o);
26301
26302 /**
26303  * Frees any resources used by the CResult_CVec_BlindedPathZNoneZ.
26304  */
26305 void CResult_CVec_BlindedPathZNoneZ_free(struct LDKCResult_CVec_BlindedPathZNoneZ _res);
26306
26307 /**
26308  * Creates a new CResult_CVec_BlindedPathZNoneZ which has the same data as `orig`
26309  * but with all dynamically-allocated buffers duplicated in new buffers.
26310  */
26311 struct LDKCResult_CVec_BlindedPathZNoneZ CResult_CVec_BlindedPathZNoneZ_clone(const struct LDKCResult_CVec_BlindedPathZNoneZ *NONNULL_PTR orig);
26312
26313 /**
26314  * Creates a new CResult_InFlightHtlcsDecodeErrorZ in the success state.
26315  */
26316 struct LDKCResult_InFlightHtlcsDecodeErrorZ CResult_InFlightHtlcsDecodeErrorZ_ok(struct LDKInFlightHtlcs o);
26317
26318 /**
26319  * Creates a new CResult_InFlightHtlcsDecodeErrorZ in the error state.
26320  */
26321 struct LDKCResult_InFlightHtlcsDecodeErrorZ CResult_InFlightHtlcsDecodeErrorZ_err(struct LDKDecodeError e);
26322
26323 /**
26324  * Checks if the given object is currently in the success state
26325  */
26326 bool CResult_InFlightHtlcsDecodeErrorZ_is_ok(const struct LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR o);
26327
26328 /**
26329  * Frees any resources used by the CResult_InFlightHtlcsDecodeErrorZ.
26330  */
26331 void CResult_InFlightHtlcsDecodeErrorZ_free(struct LDKCResult_InFlightHtlcsDecodeErrorZ _res);
26332
26333 /**
26334  * Creates a new CResult_InFlightHtlcsDecodeErrorZ which has the same data as `orig`
26335  * but with all dynamically-allocated buffers duplicated in new buffers.
26336  */
26337 struct LDKCResult_InFlightHtlcsDecodeErrorZ CResult_InFlightHtlcsDecodeErrorZ_clone(const struct LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR orig);
26338
26339 /**
26340  * Creates a new CResult_RouteHopDecodeErrorZ in the success state.
26341  */
26342 struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_ok(struct LDKRouteHop o);
26343
26344 /**
26345  * Creates a new CResult_RouteHopDecodeErrorZ in the error state.
26346  */
26347 struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_err(struct LDKDecodeError e);
26348
26349 /**
26350  * Checks if the given object is currently in the success state
26351  */
26352 bool CResult_RouteHopDecodeErrorZ_is_ok(const struct LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR o);
26353
26354 /**
26355  * Frees any resources used by the CResult_RouteHopDecodeErrorZ.
26356  */
26357 void CResult_RouteHopDecodeErrorZ_free(struct LDKCResult_RouteHopDecodeErrorZ _res);
26358
26359 /**
26360  * Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig`
26361  * but with all dynamically-allocated buffers duplicated in new buffers.
26362  */
26363 struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_clone(const struct LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR orig);
26364
26365 /**
26366  * Frees the buffer pointed to by `data` if `datalen` is non-0.
26367  */
26368 void CVec_BlindedHopZ_free(struct LDKCVec_BlindedHopZ _res);
26369
26370 /**
26371  * Creates a new CResult_BlindedTailDecodeErrorZ in the success state.
26372  */
26373 struct LDKCResult_BlindedTailDecodeErrorZ CResult_BlindedTailDecodeErrorZ_ok(struct LDKBlindedTail o);
26374
26375 /**
26376  * Creates a new CResult_BlindedTailDecodeErrorZ in the error state.
26377  */
26378 struct LDKCResult_BlindedTailDecodeErrorZ CResult_BlindedTailDecodeErrorZ_err(struct LDKDecodeError e);
26379
26380 /**
26381  * Checks if the given object is currently in the success state
26382  */
26383 bool CResult_BlindedTailDecodeErrorZ_is_ok(const struct LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR o);
26384
26385 /**
26386  * Frees any resources used by the CResult_BlindedTailDecodeErrorZ.
26387  */
26388 void CResult_BlindedTailDecodeErrorZ_free(struct LDKCResult_BlindedTailDecodeErrorZ _res);
26389
26390 /**
26391  * Creates a new CResult_BlindedTailDecodeErrorZ which has the same data as `orig`
26392  * but with all dynamically-allocated buffers duplicated in new buffers.
26393  */
26394 struct LDKCResult_BlindedTailDecodeErrorZ CResult_BlindedTailDecodeErrorZ_clone(const struct LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR orig);
26395
26396 /**
26397  * Frees the buffer pointed to by `data` if `datalen` is non-0.
26398  */
26399 void CVec_RouteHopZ_free(struct LDKCVec_RouteHopZ _res);
26400
26401 /**
26402  * Frees the buffer pointed to by `data` if `datalen` is non-0.
26403  */
26404 void CVec_PathZ_free(struct LDKCVec_PathZ _res);
26405
26406 /**
26407  * Creates a new CResult_RouteDecodeErrorZ in the success state.
26408  */
26409 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_ok(struct LDKRoute o);
26410
26411 /**
26412  * Creates a new CResult_RouteDecodeErrorZ in the error state.
26413  */
26414 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_err(struct LDKDecodeError e);
26415
26416 /**
26417  * Checks if the given object is currently in the success state
26418  */
26419 bool CResult_RouteDecodeErrorZ_is_ok(const struct LDKCResult_RouteDecodeErrorZ *NONNULL_PTR o);
26420
26421 /**
26422  * Frees any resources used by the CResult_RouteDecodeErrorZ.
26423  */
26424 void CResult_RouteDecodeErrorZ_free(struct LDKCResult_RouteDecodeErrorZ _res);
26425
26426 /**
26427  * Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
26428  * but with all dynamically-allocated buffers duplicated in new buffers.
26429  */
26430 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_clone(const struct LDKCResult_RouteDecodeErrorZ *NONNULL_PTR orig);
26431
26432 /**
26433  * Creates a new CResult_RouteParametersDecodeErrorZ in the success state.
26434  */
26435 struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_ok(struct LDKRouteParameters o);
26436
26437 /**
26438  * Creates a new CResult_RouteParametersDecodeErrorZ in the error state.
26439  */
26440 struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_err(struct LDKDecodeError e);
26441
26442 /**
26443  * Checks if the given object is currently in the success state
26444  */
26445 bool CResult_RouteParametersDecodeErrorZ_is_ok(const struct LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR o);
26446
26447 /**
26448  * Frees any resources used by the CResult_RouteParametersDecodeErrorZ.
26449  */
26450 void CResult_RouteParametersDecodeErrorZ_free(struct LDKCResult_RouteParametersDecodeErrorZ _res);
26451
26452 /**
26453  * Creates a new CResult_RouteParametersDecodeErrorZ which has the same data as `orig`
26454  * but with all dynamically-allocated buffers duplicated in new buffers.
26455  */
26456 struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_clone(const struct LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR orig);
26457
26458 /**
26459  * Frees the buffer pointed to by `data` if `datalen` is non-0.
26460  */
26461 void CVec_u64Z_free(struct LDKCVec_u64Z _res);
26462
26463 /**
26464  * Creates a new CResult_PaymentParametersDecodeErrorZ in the success state.
26465  */
26466 struct LDKCResult_PaymentParametersDecodeErrorZ CResult_PaymentParametersDecodeErrorZ_ok(struct LDKPaymentParameters o);
26467
26468 /**
26469  * Creates a new CResult_PaymentParametersDecodeErrorZ in the error state.
26470  */
26471 struct LDKCResult_PaymentParametersDecodeErrorZ CResult_PaymentParametersDecodeErrorZ_err(struct LDKDecodeError e);
26472
26473 /**
26474  * Checks if the given object is currently in the success state
26475  */
26476 bool CResult_PaymentParametersDecodeErrorZ_is_ok(const struct LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR o);
26477
26478 /**
26479  * Frees any resources used by the CResult_PaymentParametersDecodeErrorZ.
26480  */
26481 void CResult_PaymentParametersDecodeErrorZ_free(struct LDKCResult_PaymentParametersDecodeErrorZ _res);
26482
26483 /**
26484  * Creates a new CResult_PaymentParametersDecodeErrorZ which has the same data as `orig`
26485  * but with all dynamically-allocated buffers duplicated in new buffers.
26486  */
26487 struct LDKCResult_PaymentParametersDecodeErrorZ CResult_PaymentParametersDecodeErrorZ_clone(const struct LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR orig);
26488
26489 /**
26490  * Frees the buffer pointed to by `data` if `datalen` is non-0.
26491  */
26492 void CVec_RouteHintZ_free(struct LDKCVec_RouteHintZ _res);
26493
26494 /**
26495  * Frees the buffer pointed to by `data` if `datalen` is non-0.
26496  */
26497 void CVec_RouteHintHopZ_free(struct LDKCVec_RouteHintHopZ _res);
26498
26499 /**
26500  * Creates a new CResult_RouteHintDecodeErrorZ in the success state.
26501  */
26502 struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_ok(struct LDKRouteHint o);
26503
26504 /**
26505  * Creates a new CResult_RouteHintDecodeErrorZ in the error state.
26506  */
26507 struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_err(struct LDKDecodeError e);
26508
26509 /**
26510  * Checks if the given object is currently in the success state
26511  */
26512 bool CResult_RouteHintDecodeErrorZ_is_ok(const struct LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR o);
26513
26514 /**
26515  * Frees any resources used by the CResult_RouteHintDecodeErrorZ.
26516  */
26517 void CResult_RouteHintDecodeErrorZ_free(struct LDKCResult_RouteHintDecodeErrorZ _res);
26518
26519 /**
26520  * Creates a new CResult_RouteHintDecodeErrorZ which has the same data as `orig`
26521  * but with all dynamically-allocated buffers duplicated in new buffers.
26522  */
26523 struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_clone(const struct LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR orig);
26524
26525 /**
26526  * Creates a new CResult_RouteHintHopDecodeErrorZ in the success state.
26527  */
26528 struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_ok(struct LDKRouteHintHop o);
26529
26530 /**
26531  * Creates a new CResult_RouteHintHopDecodeErrorZ in the error state.
26532  */
26533 struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_err(struct LDKDecodeError e);
26534
26535 /**
26536  * Checks if the given object is currently in the success state
26537  */
26538 bool CResult_RouteHintHopDecodeErrorZ_is_ok(const struct LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR o);
26539
26540 /**
26541  * Frees any resources used by the CResult_RouteHintHopDecodeErrorZ.
26542  */
26543 void CResult_RouteHintHopDecodeErrorZ_free(struct LDKCResult_RouteHintHopDecodeErrorZ _res);
26544
26545 /**
26546  * Creates a new CResult_RouteHintHopDecodeErrorZ which has the same data as `orig`
26547  * but with all dynamically-allocated buffers duplicated in new buffers.
26548  */
26549 struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_clone(const struct LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR orig);
26550
26551 /**
26552  * Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the success state.
26553  */
26554 struct LDKCResult_FixedPenaltyScorerDecodeErrorZ CResult_FixedPenaltyScorerDecodeErrorZ_ok(struct LDKFixedPenaltyScorer o);
26555
26556 /**
26557  * Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the error state.
26558  */
26559 struct LDKCResult_FixedPenaltyScorerDecodeErrorZ CResult_FixedPenaltyScorerDecodeErrorZ_err(struct LDKDecodeError e);
26560
26561 /**
26562  * Checks if the given object is currently in the success state
26563  */
26564 bool CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(const struct LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR o);
26565
26566 /**
26567  * Frees any resources used by the CResult_FixedPenaltyScorerDecodeErrorZ.
26568  */
26569 void CResult_FixedPenaltyScorerDecodeErrorZ_free(struct LDKCResult_FixedPenaltyScorerDecodeErrorZ _res);
26570
26571 /**
26572  * Creates a new CResult_FixedPenaltyScorerDecodeErrorZ which has the same data as `orig`
26573  * but with all dynamically-allocated buffers duplicated in new buffers.
26574  */
26575 struct LDKCResult_FixedPenaltyScorerDecodeErrorZ CResult_FixedPenaltyScorerDecodeErrorZ_clone(const struct LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR orig);
26576
26577 /**
26578  * Frees the buffer pointed to by `data` if `datalen` is non-0.
26579  */
26580 void CVec_NodeIdZ_free(struct LDKCVec_NodeIdZ _res);
26581
26582 /**
26583  * Creates a new tuple which has the same data as `orig`
26584  * but with all dynamically-allocated buffers duplicated in new buffers.
26585  */
26586 struct LDKC2Tuple_u64u64Z C2Tuple_u64u64Z_clone(const struct LDKC2Tuple_u64u64Z *NONNULL_PTR orig);
26587
26588 /**
26589  * Creates a new C2Tuple_u64u64Z from the contained elements.
26590  */
26591 struct LDKC2Tuple_u64u64Z C2Tuple_u64u64Z_new(uint64_t a, uint64_t b);
26592
26593 /**
26594  * Frees any resources used by the C2Tuple_u64u64Z.
26595  */
26596 void C2Tuple_u64u64Z_free(struct LDKC2Tuple_u64u64Z _res);
26597
26598 /**
26599  * Constructs a new COption_C2Tuple_u64u64ZZ containing a crate::c_types::derived::C2Tuple_u64u64Z
26600  */
26601 struct LDKCOption_C2Tuple_u64u64ZZ COption_C2Tuple_u64u64ZZ_some(struct LDKC2Tuple_u64u64Z o);
26602
26603 /**
26604  * Constructs a new COption_C2Tuple_u64u64ZZ containing nothing
26605  */
26606 struct LDKCOption_C2Tuple_u64u64ZZ COption_C2Tuple_u64u64ZZ_none(void);
26607
26608 /**
26609  * Frees any resources associated with the crate::c_types::derived::C2Tuple_u64u64Z, if we are in the Some state
26610  */
26611 void COption_C2Tuple_u64u64ZZ_free(struct LDKCOption_C2Tuple_u64u64ZZ _res);
26612
26613 /**
26614  * Creates a new COption_C2Tuple_u64u64ZZ which has the same data as `orig`
26615  * but with all dynamically-allocated buffers duplicated in new buffers.
26616  */
26617 struct LDKCOption_C2Tuple_u64u64ZZ COption_C2Tuple_u64u64ZZ_clone(const struct LDKCOption_C2Tuple_u64u64ZZ *NONNULL_PTR orig);
26618
26619 /**
26620  * Creates a new C2Tuple_Z from the contained elements.
26621  */
26622 struct LDKC2Tuple_Z C2Tuple_Z_new(struct LDKThirtyTwoU16s a, struct LDKThirtyTwoU16s b);
26623
26624 /**
26625  * Frees any resources used by the C2Tuple_Z.
26626  */
26627 void C2Tuple_Z_free(struct LDKC2Tuple_Z _res);
26628
26629 /**
26630  * Creates a new C2Tuple__u1632_u1632Z from the contained elements.
26631  */
26632 struct LDKC2Tuple__u1632_u1632Z C2Tuple__u1632_u1632Z_new(struct LDKThirtyTwoU16s a, struct LDKThirtyTwoU16s b);
26633
26634 /**
26635  * Frees any resources used by the C2Tuple__u1632_u1632Z.
26636  */
26637 void C2Tuple__u1632_u1632Z_free(struct LDKC2Tuple__u1632_u1632Z _res);
26638
26639 /**
26640  * Constructs a new COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ containing a crate::c_types::derived::C2Tuple__u1632_u1632Z
26641  */
26642 struct LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_some(struct LDKC2Tuple__u1632_u1632Z o);
26643
26644 /**
26645  * Constructs a new COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ containing nothing
26646  */
26647 struct LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_none(void);
26648
26649 /**
26650  * Frees any resources associated with the crate::c_types::derived::C2Tuple__u1632_u1632Z, if we are in the Some state
26651  */
26652 void COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_free(struct LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ _res);
26653
26654 /**
26655  * Constructs a new COption_f64Z containing a f64
26656  */
26657 struct LDKCOption_f64Z COption_f64Z_some(double o);
26658
26659 /**
26660  * Constructs a new COption_f64Z containing nothing
26661  */
26662 struct LDKCOption_f64Z COption_f64Z_none(void);
26663
26664 /**
26665  * Frees any resources associated with the f64, if we are in the Some state
26666  */
26667 void COption_f64Z_free(struct LDKCOption_f64Z _res);
26668
26669 /**
26670  * Creates a new COption_f64Z which has the same data as `orig`
26671  * but with all dynamically-allocated buffers duplicated in new buffers.
26672  */
26673 struct LDKCOption_f64Z COption_f64Z_clone(const struct LDKCOption_f64Z *NONNULL_PTR orig);
26674
26675 /**
26676  * Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the success state.
26677  */
26678 struct LDKCResult_ProbabilisticScorerDecodeErrorZ CResult_ProbabilisticScorerDecodeErrorZ_ok(struct LDKProbabilisticScorer o);
26679
26680 /**
26681  * Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the error state.
26682  */
26683 struct LDKCResult_ProbabilisticScorerDecodeErrorZ CResult_ProbabilisticScorerDecodeErrorZ_err(struct LDKDecodeError e);
26684
26685 /**
26686  * Checks if the given object is currently in the success state
26687  */
26688 bool CResult_ProbabilisticScorerDecodeErrorZ_is_ok(const struct LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR o);
26689
26690 /**
26691  * Frees any resources used by the CResult_ProbabilisticScorerDecodeErrorZ.
26692  */
26693 void CResult_ProbabilisticScorerDecodeErrorZ_free(struct LDKCResult_ProbabilisticScorerDecodeErrorZ _res);
26694
26695 /**
26696  * Creates a new CResult_BestBlockDecodeErrorZ in the success state.
26697  */
26698 struct LDKCResult_BestBlockDecodeErrorZ CResult_BestBlockDecodeErrorZ_ok(struct LDKBestBlock o);
26699
26700 /**
26701  * Creates a new CResult_BestBlockDecodeErrorZ in the error state.
26702  */
26703 struct LDKCResult_BestBlockDecodeErrorZ CResult_BestBlockDecodeErrorZ_err(struct LDKDecodeError e);
26704
26705 /**
26706  * Checks if the given object is currently in the success state
26707  */
26708 bool CResult_BestBlockDecodeErrorZ_is_ok(const struct LDKCResult_BestBlockDecodeErrorZ *NONNULL_PTR o);
26709
26710 /**
26711  * Frees any resources used by the CResult_BestBlockDecodeErrorZ.
26712  */
26713 void CResult_BestBlockDecodeErrorZ_free(struct LDKCResult_BestBlockDecodeErrorZ _res);
26714
26715 /**
26716  * Creates a new CResult_BestBlockDecodeErrorZ which has the same data as `orig`
26717  * but with all dynamically-allocated buffers duplicated in new buffers.
26718  */
26719 struct LDKCResult_BestBlockDecodeErrorZ CResult_BestBlockDecodeErrorZ_clone(const struct LDKCResult_BestBlockDecodeErrorZ *NONNULL_PTR orig);
26720
26721 /**
26722  * Creates a new tuple which has the same data as `orig`
26723  * but with all dynamically-allocated buffers duplicated in new buffers.
26724  */
26725 struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_clone(const struct LDKC2Tuple_usizeTransactionZ *NONNULL_PTR orig);
26726
26727 /**
26728  * Creates a new C2Tuple_usizeTransactionZ from the contained elements.
26729  */
26730 struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_new(uintptr_t a, struct LDKTransaction b);
26731
26732 /**
26733  * Frees any resources used by the C2Tuple_usizeTransactionZ.
26734  */
26735 void C2Tuple_usizeTransactionZ_free(struct LDKC2Tuple_usizeTransactionZ _res);
26736
26737 /**
26738  * Frees the buffer pointed to by `data` if `datalen` is non-0.
26739  */
26740 void CVec_C2Tuple_usizeTransactionZZ_free(struct LDKCVec_C2Tuple_usizeTransactionZZ _res);
26741
26742 /**
26743  * Creates a new tuple which has the same data as `orig`
26744  * but with all dynamically-allocated buffers duplicated in new buffers.
26745  */
26746 struct LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone(const struct LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ *NONNULL_PTR orig);
26747
26748 /**
26749  * Creates a new C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ from the contained elements.
26750  */
26751 struct LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_new(struct LDKThirtyTwoBytes a, uint32_t b, struct LDKCOption_ThirtyTwoBytesZ c);
26752
26753 /**
26754  * Frees any resources used by the C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ.
26755  */
26756 void C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_free(struct LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ _res);
26757
26758 /**
26759  * Frees the buffer pointed to by `data` if `datalen` is non-0.
26760  */
26761 void CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ_free(struct LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ _res);
26762
26763 /**
26764  * Creates a new CResult_ChannelMonitorUpdateStatusNoneZ in the success state.
26765  */
26766 struct LDKCResult_ChannelMonitorUpdateStatusNoneZ CResult_ChannelMonitorUpdateStatusNoneZ_ok(enum LDKChannelMonitorUpdateStatus o);
26767
26768 /**
26769  * Creates a new CResult_ChannelMonitorUpdateStatusNoneZ in the error state.
26770  */
26771 struct LDKCResult_ChannelMonitorUpdateStatusNoneZ CResult_ChannelMonitorUpdateStatusNoneZ_err(void);
26772
26773 /**
26774  * Checks if the given object is currently in the success state
26775  */
26776 bool CResult_ChannelMonitorUpdateStatusNoneZ_is_ok(const struct LDKCResult_ChannelMonitorUpdateStatusNoneZ *NONNULL_PTR o);
26777
26778 /**
26779  * Frees any resources used by the CResult_ChannelMonitorUpdateStatusNoneZ.
26780  */
26781 void CResult_ChannelMonitorUpdateStatusNoneZ_free(struct LDKCResult_ChannelMonitorUpdateStatusNoneZ _res);
26782
26783 /**
26784  * Creates a new CResult_ChannelMonitorUpdateStatusNoneZ which has the same data as `orig`
26785  * but with all dynamically-allocated buffers duplicated in new buffers.
26786  */
26787 struct LDKCResult_ChannelMonitorUpdateStatusNoneZ CResult_ChannelMonitorUpdateStatusNoneZ_clone(const struct LDKCResult_ChannelMonitorUpdateStatusNoneZ *NONNULL_PTR orig);
26788
26789 /**
26790  * Frees the buffer pointed to by `data` if `datalen` is non-0.
26791  */
26792 void CVec_MonitorEventZ_free(struct LDKCVec_MonitorEventZ _res);
26793
26794 /**
26795  * Creates a new tuple which has the same data as `orig`
26796  * but with all dynamically-allocated buffers duplicated in new buffers.
26797  */
26798 struct LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_clone(const struct LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ *NONNULL_PTR orig);
26799
26800 /**
26801  * Creates a new C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ from the contained elements.
26802  */
26803 struct LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_new(struct LDKOutPoint a, struct LDKChannelId b, struct LDKCVec_MonitorEventZ c, struct LDKPublicKey d);
26804
26805 /**
26806  * Frees any resources used by the C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ.
26807  */
26808 void C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_free(struct LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ _res);
26809
26810 /**
26811  * Frees the buffer pointed to by `data` if `datalen` is non-0.
26812  */
26813 void CVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ_free(struct LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ _res);
26814
26815 /**
26816  * Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
26817  */
26818 struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_ok(struct LDKInitFeatures o);
26819
26820 /**
26821  * Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
26822  */
26823 struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
26824
26825 /**
26826  * Checks if the given object is currently in the success state
26827  */
26828 bool CResult_InitFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR o);
26829
26830 /**
26831  * Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
26832  */
26833 void CResult_InitFeaturesDecodeErrorZ_free(struct LDKCResult_InitFeaturesDecodeErrorZ _res);
26834
26835 /**
26836  * Creates a new CResult_InitFeaturesDecodeErrorZ which has the same data as `orig`
26837  * but with all dynamically-allocated buffers duplicated in new buffers.
26838  */
26839 struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_clone(const struct LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR orig);
26840
26841 /**
26842  * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
26843  */
26844 struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_ok(struct LDKChannelFeatures o);
26845
26846 /**
26847  * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
26848  */
26849 struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
26850
26851 /**
26852  * Checks if the given object is currently in the success state
26853  */
26854 bool CResult_ChannelFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR o);
26855
26856 /**
26857  * Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
26858  */
26859 void CResult_ChannelFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelFeaturesDecodeErrorZ _res);
26860
26861 /**
26862  * Creates a new CResult_ChannelFeaturesDecodeErrorZ which has the same data as `orig`
26863  * but with all dynamically-allocated buffers duplicated in new buffers.
26864  */
26865 struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_clone(const struct LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR orig);
26866
26867 /**
26868  * Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
26869  */
26870 struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_ok(struct LDKNodeFeatures o);
26871
26872 /**
26873  * Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
26874  */
26875 struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
26876
26877 /**
26878  * Checks if the given object is currently in the success state
26879  */
26880 bool CResult_NodeFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR o);
26881
26882 /**
26883  * Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
26884  */
26885 void CResult_NodeFeaturesDecodeErrorZ_free(struct LDKCResult_NodeFeaturesDecodeErrorZ _res);
26886
26887 /**
26888  * Creates a new CResult_NodeFeaturesDecodeErrorZ which has the same data as `orig`
26889  * but with all dynamically-allocated buffers duplicated in new buffers.
26890  */
26891 struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_clone(const struct LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR orig);
26892
26893 /**
26894  * Creates a new CResult_Bolt11InvoiceFeaturesDecodeErrorZ in the success state.
26895  */
26896 struct LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ CResult_Bolt11InvoiceFeaturesDecodeErrorZ_ok(struct LDKBolt11InvoiceFeatures o);
26897
26898 /**
26899  * Creates a new CResult_Bolt11InvoiceFeaturesDecodeErrorZ in the error state.
26900  */
26901 struct LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ CResult_Bolt11InvoiceFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
26902
26903 /**
26904  * Checks if the given object is currently in the success state
26905  */
26906 bool CResult_Bolt11InvoiceFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR o);
26907
26908 /**
26909  * Frees any resources used by the CResult_Bolt11InvoiceFeaturesDecodeErrorZ.
26910  */
26911 void CResult_Bolt11InvoiceFeaturesDecodeErrorZ_free(struct LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ _res);
26912
26913 /**
26914  * Creates a new CResult_Bolt11InvoiceFeaturesDecodeErrorZ which has the same data as `orig`
26915  * but with all dynamically-allocated buffers duplicated in new buffers.
26916  */
26917 struct LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(const struct LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR orig);
26918
26919 /**
26920  * Creates a new CResult_Bolt12InvoiceFeaturesDecodeErrorZ in the success state.
26921  */
26922 struct LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ CResult_Bolt12InvoiceFeaturesDecodeErrorZ_ok(struct LDKBolt12InvoiceFeatures o);
26923
26924 /**
26925  * Creates a new CResult_Bolt12InvoiceFeaturesDecodeErrorZ in the error state.
26926  */
26927 struct LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ CResult_Bolt12InvoiceFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
26928
26929 /**
26930  * Checks if the given object is currently in the success state
26931  */
26932 bool CResult_Bolt12InvoiceFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR o);
26933
26934 /**
26935  * Frees any resources used by the CResult_Bolt12InvoiceFeaturesDecodeErrorZ.
26936  */
26937 void CResult_Bolt12InvoiceFeaturesDecodeErrorZ_free(struct LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ _res);
26938
26939 /**
26940  * Creates a new CResult_Bolt12InvoiceFeaturesDecodeErrorZ which has the same data as `orig`
26941  * but with all dynamically-allocated buffers duplicated in new buffers.
26942  */
26943 struct LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(const struct LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR orig);
26944
26945 /**
26946  * Creates a new CResult_BlindedHopFeaturesDecodeErrorZ in the success state.
26947  */
26948 struct LDKCResult_BlindedHopFeaturesDecodeErrorZ CResult_BlindedHopFeaturesDecodeErrorZ_ok(struct LDKBlindedHopFeatures o);
26949
26950 /**
26951  * Creates a new CResult_BlindedHopFeaturesDecodeErrorZ in the error state.
26952  */
26953 struct LDKCResult_BlindedHopFeaturesDecodeErrorZ CResult_BlindedHopFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
26954
26955 /**
26956  * Checks if the given object is currently in the success state
26957  */
26958 bool CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR o);
26959
26960 /**
26961  * Frees any resources used by the CResult_BlindedHopFeaturesDecodeErrorZ.
26962  */
26963 void CResult_BlindedHopFeaturesDecodeErrorZ_free(struct LDKCResult_BlindedHopFeaturesDecodeErrorZ _res);
26964
26965 /**
26966  * Creates a new CResult_BlindedHopFeaturesDecodeErrorZ which has the same data as `orig`
26967  * but with all dynamically-allocated buffers duplicated in new buffers.
26968  */
26969 struct LDKCResult_BlindedHopFeaturesDecodeErrorZ CResult_BlindedHopFeaturesDecodeErrorZ_clone(const struct LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR orig);
26970
26971 /**
26972  * Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the success state.
26973  */
26974 struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_ok(struct LDKChannelTypeFeatures o);
26975
26976 /**
26977  * Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the error state.
26978  */
26979 struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
26980
26981 /**
26982  * Checks if the given object is currently in the success state
26983  */
26984 bool CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR o);
26985
26986 /**
26987  * Frees any resources used by the CResult_ChannelTypeFeaturesDecodeErrorZ.
26988  */
26989 void CResult_ChannelTypeFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res);
26990
26991 /**
26992  * Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ which has the same data as `orig`
26993  * but with all dynamically-allocated buffers duplicated in new buffers.
26994  */
26995 struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_clone(const struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR orig);
26996
26997 /**
26998  * Creates a new CResult_OfferIdDecodeErrorZ in the success state.
26999  */
27000 struct LDKCResult_OfferIdDecodeErrorZ CResult_OfferIdDecodeErrorZ_ok(struct LDKOfferId o);
27001
27002 /**
27003  * Creates a new CResult_OfferIdDecodeErrorZ in the error state.
27004  */
27005 struct LDKCResult_OfferIdDecodeErrorZ CResult_OfferIdDecodeErrorZ_err(struct LDKDecodeError e);
27006
27007 /**
27008  * Checks if the given object is currently in the success state
27009  */
27010 bool CResult_OfferIdDecodeErrorZ_is_ok(const struct LDKCResult_OfferIdDecodeErrorZ *NONNULL_PTR o);
27011
27012 /**
27013  * Frees any resources used by the CResult_OfferIdDecodeErrorZ.
27014  */
27015 void CResult_OfferIdDecodeErrorZ_free(struct LDKCResult_OfferIdDecodeErrorZ _res);
27016
27017 /**
27018  * Creates a new CResult_OfferIdDecodeErrorZ which has the same data as `orig`
27019  * but with all dynamically-allocated buffers duplicated in new buffers.
27020  */
27021 struct LDKCResult_OfferIdDecodeErrorZ CResult_OfferIdDecodeErrorZ_clone(const struct LDKCResult_OfferIdDecodeErrorZ *NONNULL_PTR orig);
27022
27023 /**
27024  * Creates a new CResult_NoneBolt12SemanticErrorZ in the success state.
27025  */
27026 struct LDKCResult_NoneBolt12SemanticErrorZ CResult_NoneBolt12SemanticErrorZ_ok(void);
27027
27028 /**
27029  * Creates a new CResult_NoneBolt12SemanticErrorZ in the error state.
27030  */
27031 struct LDKCResult_NoneBolt12SemanticErrorZ CResult_NoneBolt12SemanticErrorZ_err(enum LDKBolt12SemanticError e);
27032
27033 /**
27034  * Checks if the given object is currently in the success state
27035  */
27036 bool CResult_NoneBolt12SemanticErrorZ_is_ok(const struct LDKCResult_NoneBolt12SemanticErrorZ *NONNULL_PTR o);
27037
27038 /**
27039  * Frees any resources used by the CResult_NoneBolt12SemanticErrorZ.
27040  */
27041 void CResult_NoneBolt12SemanticErrorZ_free(struct LDKCResult_NoneBolt12SemanticErrorZ _res);
27042
27043 /**
27044  * Creates a new CResult_NoneBolt12SemanticErrorZ which has the same data as `orig`
27045  * but with all dynamically-allocated buffers duplicated in new buffers.
27046  */
27047 struct LDKCResult_NoneBolt12SemanticErrorZ CResult_NoneBolt12SemanticErrorZ_clone(const struct LDKCResult_NoneBolt12SemanticErrorZ *NONNULL_PTR orig);
27048
27049 /**
27050  * Creates a new CResult_OfferBolt12SemanticErrorZ in the success state.
27051  */
27052 struct LDKCResult_OfferBolt12SemanticErrorZ CResult_OfferBolt12SemanticErrorZ_ok(struct LDKOffer o);
27053
27054 /**
27055  * Creates a new CResult_OfferBolt12SemanticErrorZ in the error state.
27056  */
27057 struct LDKCResult_OfferBolt12SemanticErrorZ CResult_OfferBolt12SemanticErrorZ_err(enum LDKBolt12SemanticError e);
27058
27059 /**
27060  * Checks if the given object is currently in the success state
27061  */
27062 bool CResult_OfferBolt12SemanticErrorZ_is_ok(const struct LDKCResult_OfferBolt12SemanticErrorZ *NONNULL_PTR o);
27063
27064 /**
27065  * Frees any resources used by the CResult_OfferBolt12SemanticErrorZ.
27066  */
27067 void CResult_OfferBolt12SemanticErrorZ_free(struct LDKCResult_OfferBolt12SemanticErrorZ _res);
27068
27069 /**
27070  * Creates a new CResult_OfferBolt12SemanticErrorZ which has the same data as `orig`
27071  * but with all dynamically-allocated buffers duplicated in new buffers.
27072  */
27073 struct LDKCResult_OfferBolt12SemanticErrorZ CResult_OfferBolt12SemanticErrorZ_clone(const struct LDKCResult_OfferBolt12SemanticErrorZ *NONNULL_PTR orig);
27074
27075 /**
27076  * Creates a new CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ in the success state.
27077  */
27078 struct LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_ok(struct LDKInvoiceRequestWithDerivedPayerIdBuilder o);
27079
27080 /**
27081  * Creates a new CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ in the error state.
27082  */
27083 struct LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_err(enum LDKBolt12SemanticError e);
27084
27085 /**
27086  * Checks if the given object is currently in the success state
27087  */
27088 bool CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_is_ok(const struct LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ *NONNULL_PTR o);
27089
27090 /**
27091  * Frees any resources used by the CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ.
27092  */
27093 void CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_free(struct LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ _res);
27094
27095 /**
27096  * Creates a new CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ in the success state.
27097  */
27098 struct LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_ok(struct LDKInvoiceRequestWithExplicitPayerIdBuilder o);
27099
27100 /**
27101  * Creates a new CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ in the error state.
27102  */
27103 struct LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_err(enum LDKBolt12SemanticError e);
27104
27105 /**
27106  * Checks if the given object is currently in the success state
27107  */
27108 bool CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_is_ok(const struct LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ *NONNULL_PTR o);
27109
27110 /**
27111  * Frees any resources used by the CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ.
27112  */
27113 void CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_free(struct LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ _res);
27114
27115 /**
27116  * Creates a new CResult_OfferBolt12ParseErrorZ in the success state.
27117  */
27118 struct LDKCResult_OfferBolt12ParseErrorZ CResult_OfferBolt12ParseErrorZ_ok(struct LDKOffer o);
27119
27120 /**
27121  * Creates a new CResult_OfferBolt12ParseErrorZ in the error state.
27122  */
27123 struct LDKCResult_OfferBolt12ParseErrorZ CResult_OfferBolt12ParseErrorZ_err(struct LDKBolt12ParseError e);
27124
27125 /**
27126  * Checks if the given object is currently in the success state
27127  */
27128 bool CResult_OfferBolt12ParseErrorZ_is_ok(const struct LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR o);
27129
27130 /**
27131  * Frees any resources used by the CResult_OfferBolt12ParseErrorZ.
27132  */
27133 void CResult_OfferBolt12ParseErrorZ_free(struct LDKCResult_OfferBolt12ParseErrorZ _res);
27134
27135 /**
27136  * Creates a new CResult_OfferBolt12ParseErrorZ which has the same data as `orig`
27137  * but with all dynamically-allocated buffers duplicated in new buffers.
27138  */
27139 struct LDKCResult_OfferBolt12ParseErrorZ CResult_OfferBolt12ParseErrorZ_clone(const struct LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR orig);
27140
27141 /**
27142  * Creates a new CResult_NodeIdDecodeErrorZ in the success state.
27143  */
27144 struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_ok(struct LDKNodeId o);
27145
27146 /**
27147  * Creates a new CResult_NodeIdDecodeErrorZ in the error state.
27148  */
27149 struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_err(struct LDKDecodeError e);
27150
27151 /**
27152  * Checks if the given object is currently in the success state
27153  */
27154 bool CResult_NodeIdDecodeErrorZ_is_ok(const struct LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR o);
27155
27156 /**
27157  * Frees any resources used by the CResult_NodeIdDecodeErrorZ.
27158  */
27159 void CResult_NodeIdDecodeErrorZ_free(struct LDKCResult_NodeIdDecodeErrorZ _res);
27160
27161 /**
27162  * Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig`
27163  * but with all dynamically-allocated buffers duplicated in new buffers.
27164  */
27165 struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_clone(const struct LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR orig);
27166
27167 /**
27168  * Creates a new CResult_PublicKeySecp256k1ErrorZ in the success state.
27169  */
27170 struct LDKCResult_PublicKeySecp256k1ErrorZ CResult_PublicKeySecp256k1ErrorZ_ok(struct LDKPublicKey o);
27171
27172 /**
27173  * Creates a new CResult_PublicKeySecp256k1ErrorZ in the error state.
27174  */
27175 struct LDKCResult_PublicKeySecp256k1ErrorZ CResult_PublicKeySecp256k1ErrorZ_err(enum LDKSecp256k1Error e);
27176
27177 /**
27178  * Checks if the given object is currently in the success state
27179  */
27180 bool CResult_PublicKeySecp256k1ErrorZ_is_ok(const struct LDKCResult_PublicKeySecp256k1ErrorZ *NONNULL_PTR o);
27181
27182 /**
27183  * Frees any resources used by the CResult_PublicKeySecp256k1ErrorZ.
27184  */
27185 void CResult_PublicKeySecp256k1ErrorZ_free(struct LDKCResult_PublicKeySecp256k1ErrorZ _res);
27186
27187 /**
27188  * Creates a new CResult_PublicKeySecp256k1ErrorZ which has the same data as `orig`
27189  * but with all dynamically-allocated buffers duplicated in new buffers.
27190  */
27191 struct LDKCResult_PublicKeySecp256k1ErrorZ CResult_PublicKeySecp256k1ErrorZ_clone(const struct LDKCResult_PublicKeySecp256k1ErrorZ *NONNULL_PTR orig);
27192
27193 /**
27194  * Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::gossip::NetworkUpdate
27195  */
27196 struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_some(struct LDKNetworkUpdate o);
27197
27198 /**
27199  * Constructs a new COption_NetworkUpdateZ containing nothing
27200  */
27201 struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_none(void);
27202
27203 /**
27204  * Frees any resources associated with the crate::lightning::routing::gossip::NetworkUpdate, if we are in the Some state
27205  */
27206 void COption_NetworkUpdateZ_free(struct LDKCOption_NetworkUpdateZ _res);
27207
27208 /**
27209  * Creates a new COption_NetworkUpdateZ which has the same data as `orig`
27210  * but with all dynamically-allocated buffers duplicated in new buffers.
27211  */
27212 struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_clone(const struct LDKCOption_NetworkUpdateZ *NONNULL_PTR orig);
27213
27214 /**
27215  * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state.
27216  */
27217 struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_ok(struct LDKCOption_NetworkUpdateZ o);
27218
27219 /**
27220  * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state.
27221  */
27222 struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_err(struct LDKDecodeError e);
27223
27224 /**
27225  * Checks if the given object is currently in the success state
27226  */
27227 bool CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(const struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR o);
27228
27229 /**
27230  * Frees any resources used by the CResult_COption_NetworkUpdateZDecodeErrorZ.
27231  */
27232 void CResult_COption_NetworkUpdateZDecodeErrorZ_free(struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res);
27233
27234 /**
27235  * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ which has the same data as `orig`
27236  * but with all dynamically-allocated buffers duplicated in new buffers.
27237  */
27238 struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_clone(const struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR orig);
27239
27240 /**
27241  * Constructs a new COption_UtxoLookupZ containing a crate::lightning::routing::utxo::UtxoLookup
27242  */
27243 struct LDKCOption_UtxoLookupZ COption_UtxoLookupZ_some(struct LDKUtxoLookup o);
27244
27245 /**
27246  * Constructs a new COption_UtxoLookupZ containing nothing
27247  */
27248 struct LDKCOption_UtxoLookupZ COption_UtxoLookupZ_none(void);
27249
27250 /**
27251  * Frees any resources associated with the crate::lightning::routing::utxo::UtxoLookup, if we are in the Some state
27252  */
27253 void COption_UtxoLookupZ_free(struct LDKCOption_UtxoLookupZ _res);
27254
27255 /**
27256  * Creates a new CResult_NoneLightningErrorZ in the success state.
27257  */
27258 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_ok(void);
27259
27260 /**
27261  * Creates a new CResult_NoneLightningErrorZ in the error state.
27262  */
27263 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_err(struct LDKLightningError e);
27264
27265 /**
27266  * Checks if the given object is currently in the success state
27267  */
27268 bool CResult_NoneLightningErrorZ_is_ok(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR o);
27269
27270 /**
27271  * Frees any resources used by the CResult_NoneLightningErrorZ.
27272  */
27273 void CResult_NoneLightningErrorZ_free(struct LDKCResult_NoneLightningErrorZ _res);
27274
27275 /**
27276  * Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
27277  * but with all dynamically-allocated buffers duplicated in new buffers.
27278  */
27279 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_clone(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR orig);
27280
27281 /**
27282  * Creates a new CResult_boolLightningErrorZ in the success state.
27283  */
27284 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_ok(bool o);
27285
27286 /**
27287  * Creates a new CResult_boolLightningErrorZ in the error state.
27288  */
27289 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_err(struct LDKLightningError e);
27290
27291 /**
27292  * Checks if the given object is currently in the success state
27293  */
27294 bool CResult_boolLightningErrorZ_is_ok(const struct LDKCResult_boolLightningErrorZ *NONNULL_PTR o);
27295
27296 /**
27297  * Frees any resources used by the CResult_boolLightningErrorZ.
27298  */
27299 void CResult_boolLightningErrorZ_free(struct LDKCResult_boolLightningErrorZ _res);
27300
27301 /**
27302  * Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
27303  * but with all dynamically-allocated buffers duplicated in new buffers.
27304  */
27305 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_clone(const struct LDKCResult_boolLightningErrorZ *NONNULL_PTR orig);
27306
27307 /**
27308  * Creates a new tuple which has the same data as `orig`
27309  * but with all dynamically-allocated buffers duplicated in new buffers.
27310  */
27311 struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(const struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR orig);
27312
27313 /**
27314  * Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
27315  */
27316 struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(struct LDKChannelAnnouncement a, struct LDKChannelUpdate b, struct LDKChannelUpdate c);
27317
27318 /**
27319  * Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
27320  */
27321 void C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res);
27322
27323 /**
27324  * Constructs a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ containing a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ
27325  */
27326 struct LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ o);
27327
27328 /**
27329  * Constructs a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ containing nothing
27330  */
27331 struct LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none(void);
27332
27333 /**
27334  * Frees any resources associated with the crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ, if we are in the Some state
27335  */
27336 void COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(struct LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res);
27337
27338 /**
27339  * Creates a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ which has the same data as `orig`
27340  * but with all dynamically-allocated buffers duplicated in new buffers.
27341  */
27342 struct LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(const struct LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *NONNULL_PTR orig);
27343
27344 /**
27345  * Frees the buffer pointed to by `data` if `datalen` is non-0.
27346  */
27347 void CVec_MessageSendEventZ_free(struct LDKCVec_MessageSendEventZ _res);
27348
27349 /**
27350  * Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the success state.
27351  */
27352 struct LDKCResult_ChannelUpdateInfoDecodeErrorZ CResult_ChannelUpdateInfoDecodeErrorZ_ok(struct LDKChannelUpdateInfo o);
27353
27354 /**
27355  * Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the error state.
27356  */
27357 struct LDKCResult_ChannelUpdateInfoDecodeErrorZ CResult_ChannelUpdateInfoDecodeErrorZ_err(struct LDKDecodeError e);
27358
27359 /**
27360  * Checks if the given object is currently in the success state
27361  */
27362 bool CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(const struct LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR o);
27363
27364 /**
27365  * Frees any resources used by the CResult_ChannelUpdateInfoDecodeErrorZ.
27366  */
27367 void CResult_ChannelUpdateInfoDecodeErrorZ_free(struct LDKCResult_ChannelUpdateInfoDecodeErrorZ _res);
27368
27369 /**
27370  * Creates a new CResult_ChannelUpdateInfoDecodeErrorZ which has the same data as `orig`
27371  * but with all dynamically-allocated buffers duplicated in new buffers.
27372  */
27373 struct LDKCResult_ChannelUpdateInfoDecodeErrorZ CResult_ChannelUpdateInfoDecodeErrorZ_clone(const struct LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR orig);
27374
27375 /**
27376  * Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
27377  */
27378 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_ok(struct LDKChannelInfo o);
27379
27380 /**
27381  * Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
27382  */
27383 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_err(struct LDKDecodeError e);
27384
27385 /**
27386  * Checks if the given object is currently in the success state
27387  */
27388 bool CResult_ChannelInfoDecodeErrorZ_is_ok(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR o);
27389
27390 /**
27391  * Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
27392  */
27393 void CResult_ChannelInfoDecodeErrorZ_free(struct LDKCResult_ChannelInfoDecodeErrorZ _res);
27394
27395 /**
27396  * Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
27397  * but with all dynamically-allocated buffers duplicated in new buffers.
27398  */
27399 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_clone(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR orig);
27400
27401 /**
27402  * Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
27403  */
27404 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_ok(struct LDKRoutingFees o);
27405
27406 /**
27407  * Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
27408  */
27409 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_err(struct LDKDecodeError e);
27410
27411 /**
27412  * Checks if the given object is currently in the success state
27413  */
27414 bool CResult_RoutingFeesDecodeErrorZ_is_ok(const struct LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR o);
27415
27416 /**
27417  * Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
27418  */
27419 void CResult_RoutingFeesDecodeErrorZ_free(struct LDKCResult_RoutingFeesDecodeErrorZ _res);
27420
27421 /**
27422  * Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
27423  * but with all dynamically-allocated buffers duplicated in new buffers.
27424  */
27425 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_clone(const struct LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR orig);
27426
27427 /**
27428  * Frees the buffer pointed to by `data` if `datalen` is non-0.
27429  */
27430 void CVec_SocketAddressZ_free(struct LDKCVec_SocketAddressZ _res);
27431
27432 /**
27433  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
27434  */
27435 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_ok(struct LDKNodeAnnouncementInfo o);
27436
27437 /**
27438  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
27439  */
27440 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_err(struct LDKDecodeError e);
27441
27442 /**
27443  * Checks if the given object is currently in the success state
27444  */
27445 bool CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(const struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR o);
27446
27447 /**
27448  * Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
27449  */
27450 void CResult_NodeAnnouncementInfoDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res);
27451
27452 /**
27453  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
27454  * but with all dynamically-allocated buffers duplicated in new buffers.
27455  */
27456 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR orig);
27457
27458 /**
27459  * Creates a new CResult_NodeAliasDecodeErrorZ in the success state.
27460  */
27461 struct LDKCResult_NodeAliasDecodeErrorZ CResult_NodeAliasDecodeErrorZ_ok(struct LDKNodeAlias o);
27462
27463 /**
27464  * Creates a new CResult_NodeAliasDecodeErrorZ in the error state.
27465  */
27466 struct LDKCResult_NodeAliasDecodeErrorZ CResult_NodeAliasDecodeErrorZ_err(struct LDKDecodeError e);
27467
27468 /**
27469  * Checks if the given object is currently in the success state
27470  */
27471 bool CResult_NodeAliasDecodeErrorZ_is_ok(const struct LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR o);
27472
27473 /**
27474  * Frees any resources used by the CResult_NodeAliasDecodeErrorZ.
27475  */
27476 void CResult_NodeAliasDecodeErrorZ_free(struct LDKCResult_NodeAliasDecodeErrorZ _res);
27477
27478 /**
27479  * Creates a new CResult_NodeAliasDecodeErrorZ which has the same data as `orig`
27480  * but with all dynamically-allocated buffers duplicated in new buffers.
27481  */
27482 struct LDKCResult_NodeAliasDecodeErrorZ CResult_NodeAliasDecodeErrorZ_clone(const struct LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR orig);
27483
27484 /**
27485  * Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
27486  */
27487 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_ok(struct LDKNodeInfo o);
27488
27489 /**
27490  * Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
27491  */
27492 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_err(struct LDKDecodeError e);
27493
27494 /**
27495  * Checks if the given object is currently in the success state
27496  */
27497 bool CResult_NodeInfoDecodeErrorZ_is_ok(const struct LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR o);
27498
27499 /**
27500  * Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
27501  */
27502 void CResult_NodeInfoDecodeErrorZ_free(struct LDKCResult_NodeInfoDecodeErrorZ _res);
27503
27504 /**
27505  * Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
27506  * but with all dynamically-allocated buffers duplicated in new buffers.
27507  */
27508 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_clone(const struct LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR orig);
27509
27510 /**
27511  * Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
27512  */
27513 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_ok(struct LDKNetworkGraph o);
27514
27515 /**
27516  * Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
27517  */
27518 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_err(struct LDKDecodeError e);
27519
27520 /**
27521  * Checks if the given object is currently in the success state
27522  */
27523 bool CResult_NetworkGraphDecodeErrorZ_is_ok(const struct LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR o);
27524
27525 /**
27526  * Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
27527  */
27528 void CResult_NetworkGraphDecodeErrorZ_free(struct LDKCResult_NetworkGraphDecodeErrorZ _res);
27529
27530 /**
27531  * Constructs a new COption_CVec_SocketAddressZZ containing a crate::c_types::derived::CVec_SocketAddressZ
27532  */
27533 struct LDKCOption_CVec_SocketAddressZZ COption_CVec_SocketAddressZZ_some(struct LDKCVec_SocketAddressZ o);
27534
27535 /**
27536  * Constructs a new COption_CVec_SocketAddressZZ containing nothing
27537  */
27538 struct LDKCOption_CVec_SocketAddressZZ COption_CVec_SocketAddressZZ_none(void);
27539
27540 /**
27541  * Frees any resources associated with the crate::c_types::derived::CVec_SocketAddressZ, if we are in the Some state
27542  */
27543 void COption_CVec_SocketAddressZZ_free(struct LDKCOption_CVec_SocketAddressZZ _res);
27544
27545 /**
27546  * Creates a new COption_CVec_SocketAddressZZ which has the same data as `orig`
27547  * but with all dynamically-allocated buffers duplicated in new buffers.
27548  */
27549 struct LDKCOption_CVec_SocketAddressZZ COption_CVec_SocketAddressZZ_clone(const struct LDKCOption_CVec_SocketAddressZZ *NONNULL_PTR orig);
27550
27551 /**
27552  * Creates a new CResult_u64ShortChannelIdErrorZ in the success state.
27553  */
27554 struct LDKCResult_u64ShortChannelIdErrorZ CResult_u64ShortChannelIdErrorZ_ok(uint64_t o);
27555
27556 /**
27557  * Creates a new CResult_u64ShortChannelIdErrorZ in the error state.
27558  */
27559 struct LDKCResult_u64ShortChannelIdErrorZ CResult_u64ShortChannelIdErrorZ_err(enum LDKShortChannelIdError e);
27560
27561 /**
27562  * Checks if the given object is currently in the success state
27563  */
27564 bool CResult_u64ShortChannelIdErrorZ_is_ok(const struct LDKCResult_u64ShortChannelIdErrorZ *NONNULL_PTR o);
27565
27566 /**
27567  * Frees any resources used by the CResult_u64ShortChannelIdErrorZ.
27568  */
27569 void CResult_u64ShortChannelIdErrorZ_free(struct LDKCResult_u64ShortChannelIdErrorZ _res);
27570
27571 /**
27572  * Creates a new CResult_PendingHTLCInfoInboundHTLCErrZ in the success state.
27573  */
27574 struct LDKCResult_PendingHTLCInfoInboundHTLCErrZ CResult_PendingHTLCInfoInboundHTLCErrZ_ok(struct LDKPendingHTLCInfo o);
27575
27576 /**
27577  * Creates a new CResult_PendingHTLCInfoInboundHTLCErrZ in the error state.
27578  */
27579 struct LDKCResult_PendingHTLCInfoInboundHTLCErrZ CResult_PendingHTLCInfoInboundHTLCErrZ_err(struct LDKInboundHTLCErr e);
27580
27581 /**
27582  * Checks if the given object is currently in the success state
27583  */
27584 bool CResult_PendingHTLCInfoInboundHTLCErrZ_is_ok(const struct LDKCResult_PendingHTLCInfoInboundHTLCErrZ *NONNULL_PTR o);
27585
27586 /**
27587  * Frees any resources used by the CResult_PendingHTLCInfoInboundHTLCErrZ.
27588  */
27589 void CResult_PendingHTLCInfoInboundHTLCErrZ_free(struct LDKCResult_PendingHTLCInfoInboundHTLCErrZ _res);
27590
27591 /**
27592  * Creates a new CResult_PendingHTLCInfoInboundHTLCErrZ which has the same data as `orig`
27593  * but with all dynamically-allocated buffers duplicated in new buffers.
27594  */
27595 struct LDKCResult_PendingHTLCInfoInboundHTLCErrZ CResult_PendingHTLCInfoInboundHTLCErrZ_clone(const struct LDKCResult_PendingHTLCInfoInboundHTLCErrZ *NONNULL_PTR orig);
27596
27597 /**
27598  * Frees the buffer pointed to by `data` if `datalen` is non-0.
27599  */
27600 void CVec_HTLCOutputInCommitmentZ_free(struct LDKCVec_HTLCOutputInCommitmentZ _res);
27601
27602 /**
27603  * Frees the buffer pointed to by `data` if `datalen` is non-0.
27604  */
27605 void CVec_HTLCDescriptorZ_free(struct LDKCVec_HTLCDescriptorZ _res);
27606
27607 /**
27608  * Frees the buffer pointed to by `data` if `datalen` is non-0.
27609  */
27610 void CVec_UtxoZ_free(struct LDKCVec_UtxoZ _res);
27611
27612 /**
27613  * Constructs a new COption_TxOutZ containing a crate::c_types::TxOut
27614  */
27615 struct LDKCOption_TxOutZ COption_TxOutZ_some(struct LDKTxOut o);
27616
27617 /**
27618  * Constructs a new COption_TxOutZ containing nothing
27619  */
27620 struct LDKCOption_TxOutZ COption_TxOutZ_none(void);
27621
27622 /**
27623  * Frees any resources associated with the crate::c_types::TxOut, if we are in the Some state
27624  */
27625 void COption_TxOutZ_free(struct LDKCOption_TxOutZ _res);
27626
27627 /**
27628  * Creates a new COption_TxOutZ which has the same data as `orig`
27629  * but with all dynamically-allocated buffers duplicated in new buffers.
27630  */
27631 struct LDKCOption_TxOutZ COption_TxOutZ_clone(const struct LDKCOption_TxOutZ *NONNULL_PTR orig);
27632
27633 /**
27634  * Frees the buffer pointed to by `data` if `datalen` is non-0.
27635  */
27636 void CVec_InputZ_free(struct LDKCVec_InputZ _res);
27637
27638 /**
27639  * Creates a new CResult_CoinSelectionNoneZ in the success state.
27640  */
27641 struct LDKCResult_CoinSelectionNoneZ CResult_CoinSelectionNoneZ_ok(struct LDKCoinSelection o);
27642
27643 /**
27644  * Creates a new CResult_CoinSelectionNoneZ in the error state.
27645  */
27646 struct LDKCResult_CoinSelectionNoneZ CResult_CoinSelectionNoneZ_err(void);
27647
27648 /**
27649  * Checks if the given object is currently in the success state
27650  */
27651 bool CResult_CoinSelectionNoneZ_is_ok(const struct LDKCResult_CoinSelectionNoneZ *NONNULL_PTR o);
27652
27653 /**
27654  * Frees any resources used by the CResult_CoinSelectionNoneZ.
27655  */
27656 void CResult_CoinSelectionNoneZ_free(struct LDKCResult_CoinSelectionNoneZ _res);
27657
27658 /**
27659  * Creates a new CResult_CoinSelectionNoneZ which has the same data as `orig`
27660  * but with all dynamically-allocated buffers duplicated in new buffers.
27661  */
27662 struct LDKCResult_CoinSelectionNoneZ CResult_CoinSelectionNoneZ_clone(const struct LDKCResult_CoinSelectionNoneZ *NONNULL_PTR orig);
27663
27664 /**
27665  * Creates a new CResult_CVec_UtxoZNoneZ in the success state.
27666  */
27667 struct LDKCResult_CVec_UtxoZNoneZ CResult_CVec_UtxoZNoneZ_ok(struct LDKCVec_UtxoZ o);
27668
27669 /**
27670  * Creates a new CResult_CVec_UtxoZNoneZ in the error state.
27671  */
27672 struct LDKCResult_CVec_UtxoZNoneZ CResult_CVec_UtxoZNoneZ_err(void);
27673
27674 /**
27675  * Checks if the given object is currently in the success state
27676  */
27677 bool CResult_CVec_UtxoZNoneZ_is_ok(const struct LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR o);
27678
27679 /**
27680  * Frees any resources used by the CResult_CVec_UtxoZNoneZ.
27681  */
27682 void CResult_CVec_UtxoZNoneZ_free(struct LDKCResult_CVec_UtxoZNoneZ _res);
27683
27684 /**
27685  * Creates a new CResult_CVec_UtxoZNoneZ which has the same data as `orig`
27686  * but with all dynamically-allocated buffers duplicated in new buffers.
27687  */
27688 struct LDKCResult_CVec_UtxoZNoneZ CResult_CVec_UtxoZNoneZ_clone(const struct LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR orig);
27689
27690 /**
27691  * Constructs a new COption_PaymentContextZ containing a crate::lightning::blinded_path::payment::PaymentContext
27692  */
27693 struct LDKCOption_PaymentContextZ COption_PaymentContextZ_some(struct LDKPaymentContext o);
27694
27695 /**
27696  * Constructs a new COption_PaymentContextZ containing nothing
27697  */
27698 struct LDKCOption_PaymentContextZ COption_PaymentContextZ_none(void);
27699
27700 /**
27701  * Frees any resources associated with the crate::lightning::blinded_path::payment::PaymentContext, if we are in the Some state
27702  */
27703 void COption_PaymentContextZ_free(struct LDKCOption_PaymentContextZ _res);
27704
27705 /**
27706  * Creates a new COption_PaymentContextZ which has the same data as `orig`
27707  * but with all dynamically-allocated buffers duplicated in new buffers.
27708  */
27709 struct LDKCOption_PaymentContextZ COption_PaymentContextZ_clone(const struct LDKCOption_PaymentContextZ *NONNULL_PTR orig);
27710
27711 /**
27712  * Creates a new tuple which has the same data as `orig`
27713  * but with all dynamically-allocated buffers duplicated in new buffers.
27714  */
27715 struct LDKC2Tuple_u64u16Z C2Tuple_u64u16Z_clone(const struct LDKC2Tuple_u64u16Z *NONNULL_PTR orig);
27716
27717 /**
27718  * Creates a new C2Tuple_u64u16Z from the contained elements.
27719  */
27720 struct LDKC2Tuple_u64u16Z C2Tuple_u64u16Z_new(uint64_t a, uint16_t b);
27721
27722 /**
27723  * Frees any resources used by the C2Tuple_u64u16Z.
27724  */
27725 void C2Tuple_u64u16Z_free(struct LDKC2Tuple_u64u16Z _res);
27726
27727 /**
27728  * Constructs a new COption_C2Tuple_u64u16ZZ containing a crate::c_types::derived::C2Tuple_u64u16Z
27729  */
27730 struct LDKCOption_C2Tuple_u64u16ZZ COption_C2Tuple_u64u16ZZ_some(struct LDKC2Tuple_u64u16Z o);
27731
27732 /**
27733  * Constructs a new COption_C2Tuple_u64u16ZZ containing nothing
27734  */
27735 struct LDKCOption_C2Tuple_u64u16ZZ COption_C2Tuple_u64u16ZZ_none(void);
27736
27737 /**
27738  * Frees any resources associated with the crate::c_types::derived::C2Tuple_u64u16Z, if we are in the Some state
27739  */
27740 void COption_C2Tuple_u64u16ZZ_free(struct LDKCOption_C2Tuple_u64u16ZZ _res);
27741
27742 /**
27743  * Creates a new COption_C2Tuple_u64u16ZZ which has the same data as `orig`
27744  * but with all dynamically-allocated buffers duplicated in new buffers.
27745  */
27746 struct LDKCOption_C2Tuple_u64u16ZZ COption_C2Tuple_u64u16ZZ_clone(const struct LDKCOption_C2Tuple_u64u16ZZ *NONNULL_PTR orig);
27747
27748 /**
27749  * Constructs a new COption_ChannelShutdownStateZ containing a crate::lightning::ln::channelmanager::ChannelShutdownState
27750  */
27751 struct LDKCOption_ChannelShutdownStateZ COption_ChannelShutdownStateZ_some(enum LDKChannelShutdownState o);
27752
27753 /**
27754  * Constructs a new COption_ChannelShutdownStateZ containing nothing
27755  */
27756 struct LDKCOption_ChannelShutdownStateZ COption_ChannelShutdownStateZ_none(void);
27757
27758 /**
27759  * Frees any resources associated with the crate::lightning::ln::channelmanager::ChannelShutdownState, if we are in the Some state
27760  */
27761 void COption_ChannelShutdownStateZ_free(struct LDKCOption_ChannelShutdownStateZ _res);
27762
27763 /**
27764  * Creates a new COption_ChannelShutdownStateZ which has the same data as `orig`
27765  * but with all dynamically-allocated buffers duplicated in new buffers.
27766  */
27767 struct LDKCOption_ChannelShutdownStateZ COption_ChannelShutdownStateZ_clone(const struct LDKCOption_ChannelShutdownStateZ *NONNULL_PTR orig);
27768
27769 /**
27770  * Creates a new CResult_ChannelIdAPIErrorZ in the success state.
27771  */
27772 struct LDKCResult_ChannelIdAPIErrorZ CResult_ChannelIdAPIErrorZ_ok(struct LDKChannelId o);
27773
27774 /**
27775  * Creates a new CResult_ChannelIdAPIErrorZ in the error state.
27776  */
27777 struct LDKCResult_ChannelIdAPIErrorZ CResult_ChannelIdAPIErrorZ_err(struct LDKAPIError e);
27778
27779 /**
27780  * Checks if the given object is currently in the success state
27781  */
27782 bool CResult_ChannelIdAPIErrorZ_is_ok(const struct LDKCResult_ChannelIdAPIErrorZ *NONNULL_PTR o);
27783
27784 /**
27785  * Frees any resources used by the CResult_ChannelIdAPIErrorZ.
27786  */
27787 void CResult_ChannelIdAPIErrorZ_free(struct LDKCResult_ChannelIdAPIErrorZ _res);
27788
27789 /**
27790  * Creates a new CResult_ChannelIdAPIErrorZ which has the same data as `orig`
27791  * but with all dynamically-allocated buffers duplicated in new buffers.
27792  */
27793 struct LDKCResult_ChannelIdAPIErrorZ CResult_ChannelIdAPIErrorZ_clone(const struct LDKCResult_ChannelIdAPIErrorZ *NONNULL_PTR orig);
27794
27795 /**
27796  * Frees the buffer pointed to by `data` if `datalen` is non-0.
27797  */
27798 void CVec_RecentPaymentDetailsZ_free(struct LDKCVec_RecentPaymentDetailsZ _res);
27799
27800 /**
27801  * Creates a new CResult_NonePaymentSendFailureZ in the success state.
27802  */
27803 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_ok(void);
27804
27805 /**
27806  * Creates a new CResult_NonePaymentSendFailureZ in the error state.
27807  */
27808 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
27809
27810 /**
27811  * Checks if the given object is currently in the success state
27812  */
27813 bool CResult_NonePaymentSendFailureZ_is_ok(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR o);
27814
27815 /**
27816  * Frees any resources used by the CResult_NonePaymentSendFailureZ.
27817  */
27818 void CResult_NonePaymentSendFailureZ_free(struct LDKCResult_NonePaymentSendFailureZ _res);
27819
27820 /**
27821  * Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
27822  * but with all dynamically-allocated buffers duplicated in new buffers.
27823  */
27824 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_clone(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR orig);
27825
27826 /**
27827  * Creates a new CResult_NoneRetryableSendFailureZ in the success state.
27828  */
27829 struct LDKCResult_NoneRetryableSendFailureZ CResult_NoneRetryableSendFailureZ_ok(void);
27830
27831 /**
27832  * Creates a new CResult_NoneRetryableSendFailureZ in the error state.
27833  */
27834 struct LDKCResult_NoneRetryableSendFailureZ CResult_NoneRetryableSendFailureZ_err(enum LDKRetryableSendFailure e);
27835
27836 /**
27837  * Checks if the given object is currently in the success state
27838  */
27839 bool CResult_NoneRetryableSendFailureZ_is_ok(const struct LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR o);
27840
27841 /**
27842  * Frees any resources used by the CResult_NoneRetryableSendFailureZ.
27843  */
27844 void CResult_NoneRetryableSendFailureZ_free(struct LDKCResult_NoneRetryableSendFailureZ _res);
27845
27846 /**
27847  * Creates a new CResult_NoneRetryableSendFailureZ which has the same data as `orig`
27848  * but with all dynamically-allocated buffers duplicated in new buffers.
27849  */
27850 struct LDKCResult_NoneRetryableSendFailureZ CResult_NoneRetryableSendFailureZ_clone(const struct LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR orig);
27851
27852 /**
27853  * Creates a new CResult_ThirtyTwoBytesPaymentSendFailureZ in the success state.
27854  */
27855 struct LDKCResult_ThirtyTwoBytesPaymentSendFailureZ CResult_ThirtyTwoBytesPaymentSendFailureZ_ok(struct LDKThirtyTwoBytes o);
27856
27857 /**
27858  * Creates a new CResult_ThirtyTwoBytesPaymentSendFailureZ in the error state.
27859  */
27860 struct LDKCResult_ThirtyTwoBytesPaymentSendFailureZ CResult_ThirtyTwoBytesPaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
27861
27862 /**
27863  * Checks if the given object is currently in the success state
27864  */
27865 bool CResult_ThirtyTwoBytesPaymentSendFailureZ_is_ok(const struct LDKCResult_ThirtyTwoBytesPaymentSendFailureZ *NONNULL_PTR o);
27866
27867 /**
27868  * Frees any resources used by the CResult_ThirtyTwoBytesPaymentSendFailureZ.
27869  */
27870 void CResult_ThirtyTwoBytesPaymentSendFailureZ_free(struct LDKCResult_ThirtyTwoBytesPaymentSendFailureZ _res);
27871
27872 /**
27873  * Creates a new CResult_ThirtyTwoBytesPaymentSendFailureZ which has the same data as `orig`
27874  * but with all dynamically-allocated buffers duplicated in new buffers.
27875  */
27876 struct LDKCResult_ThirtyTwoBytesPaymentSendFailureZ CResult_ThirtyTwoBytesPaymentSendFailureZ_clone(const struct LDKCResult_ThirtyTwoBytesPaymentSendFailureZ *NONNULL_PTR orig);
27877
27878 /**
27879  * Creates a new CResult_ThirtyTwoBytesRetryableSendFailureZ in the success state.
27880  */
27881 struct LDKCResult_ThirtyTwoBytesRetryableSendFailureZ CResult_ThirtyTwoBytesRetryableSendFailureZ_ok(struct LDKThirtyTwoBytes o);
27882
27883 /**
27884  * Creates a new CResult_ThirtyTwoBytesRetryableSendFailureZ in the error state.
27885  */
27886 struct LDKCResult_ThirtyTwoBytesRetryableSendFailureZ CResult_ThirtyTwoBytesRetryableSendFailureZ_err(enum LDKRetryableSendFailure e);
27887
27888 /**
27889  * Checks if the given object is currently in the success state
27890  */
27891 bool CResult_ThirtyTwoBytesRetryableSendFailureZ_is_ok(const struct LDKCResult_ThirtyTwoBytesRetryableSendFailureZ *NONNULL_PTR o);
27892
27893 /**
27894  * Frees any resources used by the CResult_ThirtyTwoBytesRetryableSendFailureZ.
27895  */
27896 void CResult_ThirtyTwoBytesRetryableSendFailureZ_free(struct LDKCResult_ThirtyTwoBytesRetryableSendFailureZ _res);
27897
27898 /**
27899  * Creates a new CResult_ThirtyTwoBytesRetryableSendFailureZ which has the same data as `orig`
27900  * but with all dynamically-allocated buffers duplicated in new buffers.
27901  */
27902 struct LDKCResult_ThirtyTwoBytesRetryableSendFailureZ CResult_ThirtyTwoBytesRetryableSendFailureZ_clone(const struct LDKCResult_ThirtyTwoBytesRetryableSendFailureZ *NONNULL_PTR orig);
27903
27904 /**
27905  * Creates a new tuple which has the same data as `orig`
27906  * but with all dynamically-allocated buffers duplicated in new buffers.
27907  */
27908 struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(const struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ *NONNULL_PTR orig);
27909
27910 /**
27911  * Creates a new C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ from the contained elements.
27912  */
27913 struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b);
27914
27915 /**
27916  * Frees any resources used by the C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ.
27917  */
27918 void C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_free(struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ _res);
27919
27920 /**
27921  * Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ in the success state.
27922  */
27923 struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_ok(struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o);
27924
27925 /**
27926  * Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ in the error state.
27927  */
27928 struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
27929
27930 /**
27931  * Checks if the given object is currently in the success state
27932  */
27933 bool CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_is_ok(const struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ *NONNULL_PTR o);
27934
27935 /**
27936  * Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ.
27937  */
27938 void CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_free(struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ _res);
27939
27940 /**
27941  * Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ which has the same data as `orig`
27942  * but with all dynamically-allocated buffers duplicated in new buffers.
27943  */
27944 struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone(const struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ *NONNULL_PTR orig);
27945
27946 /**
27947  * Frees the buffer pointed to by `data` if `datalen` is non-0.
27948  */
27949 void CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_free(struct LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ _res);
27950
27951 /**
27952  * Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ in the success state.
27953  */
27954 struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_ok(struct LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ o);
27955
27956 /**
27957  * Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ in the error state.
27958  */
27959 struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_err(struct LDKProbeSendFailure e);
27960
27961 /**
27962  * Checks if the given object is currently in the success state
27963  */
27964 bool CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_is_ok(const struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ *NONNULL_PTR o);
27965
27966 /**
27967  * Frees any resources used by the CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ.
27968  */
27969 void CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_free(struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ _res);
27970
27971 /**
27972  * Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ which has the same data as `orig`
27973  * but with all dynamically-allocated buffers duplicated in new buffers.
27974  */
27975 struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone(const struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ *NONNULL_PTR orig);
27976
27977 /**
27978  * Creates a new tuple which has the same data as `orig`
27979  * but with all dynamically-allocated buffers duplicated in new buffers.
27980  */
27981 struct LDKC2Tuple_ChannelIdPublicKeyZ C2Tuple_ChannelIdPublicKeyZ_clone(const struct LDKC2Tuple_ChannelIdPublicKeyZ *NONNULL_PTR orig);
27982
27983 /**
27984  * Creates a new C2Tuple_ChannelIdPublicKeyZ from the contained elements.
27985  */
27986 struct LDKC2Tuple_ChannelIdPublicKeyZ C2Tuple_ChannelIdPublicKeyZ_new(struct LDKChannelId a, struct LDKPublicKey b);
27987
27988 /**
27989  * Frees any resources used by the C2Tuple_ChannelIdPublicKeyZ.
27990  */
27991 void C2Tuple_ChannelIdPublicKeyZ_free(struct LDKC2Tuple_ChannelIdPublicKeyZ _res);
27992
27993 /**
27994  * Frees the buffer pointed to by `data` if `datalen` is non-0.
27995  */
27996 void CVec_C2Tuple_ChannelIdPublicKeyZZ_free(struct LDKCVec_C2Tuple_ChannelIdPublicKeyZZ _res);
27997
27998 /**
27999  * Frees the buffer pointed to by `data` if `datalen` is non-0.
28000  */
28001 void CVec_ChannelIdZ_free(struct LDKCVec_ChannelIdZ _res);
28002
28003 /**
28004  * Creates a new CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ in the success state.
28005  */
28006 struct LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_ok(struct LDKOfferWithDerivedMetadataBuilder o);
28007
28008 /**
28009  * Creates a new CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ in the error state.
28010  */
28011 struct LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_err(enum LDKBolt12SemanticError e);
28012
28013 /**
28014  * Checks if the given object is currently in the success state
28015  */
28016 bool CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_is_ok(const struct LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ *NONNULL_PTR o);
28017
28018 /**
28019  * Frees any resources used by the CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ.
28020  */
28021 void CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_free(struct LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ _res);
28022
28023 /**
28024  * Creates a new CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ which has the same data as `orig`
28025  * but with all dynamically-allocated buffers duplicated in new buffers.
28026  */
28027 struct LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone(const struct LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ *NONNULL_PTR orig);
28028
28029 /**
28030  * Constructs a new COption_StrZ containing a crate::c_types::Str
28031  */
28032 struct LDKCOption_StrZ COption_StrZ_some(struct LDKStr o);
28033
28034 /**
28035  * Constructs a new COption_StrZ containing nothing
28036  */
28037 struct LDKCOption_StrZ COption_StrZ_none(void);
28038
28039 /**
28040  * Frees any resources associated with the crate::c_types::Str, if we are in the Some state
28041  */
28042 void COption_StrZ_free(struct LDKCOption_StrZ _res);
28043
28044 /**
28045  * Creates a new COption_StrZ which has the same data as `orig`
28046  * but with all dynamically-allocated buffers duplicated in new buffers.
28047  */
28048 struct LDKCOption_StrZ COption_StrZ_clone(const struct LDKCOption_StrZ *NONNULL_PTR orig);
28049
28050 /**
28051  * Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ in the success state.
28052  */
28053 struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_ok(struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o);
28054
28055 /**
28056  * Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ in the error state.
28057  */
28058 struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_err(void);
28059
28060 /**
28061  * Checks if the given object is currently in the success state
28062  */
28063 bool CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_is_ok(const struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR o);
28064
28065 /**
28066  * Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ.
28067  */
28068 void CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_free(struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ _res);
28069
28070 /**
28071  * Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ which has the same data as `orig`
28072  * but with all dynamically-allocated buffers duplicated in new buffers.
28073  */
28074 struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone(const struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR orig);
28075
28076 /**
28077  * Creates a new CResult_ThirtyTwoBytesAPIErrorZ in the success state.
28078  */
28079 struct LDKCResult_ThirtyTwoBytesAPIErrorZ CResult_ThirtyTwoBytesAPIErrorZ_ok(struct LDKThirtyTwoBytes o);
28080
28081 /**
28082  * Creates a new CResult_ThirtyTwoBytesAPIErrorZ in the error state.
28083  */
28084 struct LDKCResult_ThirtyTwoBytesAPIErrorZ CResult_ThirtyTwoBytesAPIErrorZ_err(struct LDKAPIError e);
28085
28086 /**
28087  * Checks if the given object is currently in the success state
28088  */
28089 bool CResult_ThirtyTwoBytesAPIErrorZ_is_ok(const struct LDKCResult_ThirtyTwoBytesAPIErrorZ *NONNULL_PTR o);
28090
28091 /**
28092  * Frees any resources used by the CResult_ThirtyTwoBytesAPIErrorZ.
28093  */
28094 void CResult_ThirtyTwoBytesAPIErrorZ_free(struct LDKCResult_ThirtyTwoBytesAPIErrorZ _res);
28095
28096 /**
28097  * Creates a new CResult_ThirtyTwoBytesAPIErrorZ which has the same data as `orig`
28098  * but with all dynamically-allocated buffers duplicated in new buffers.
28099  */
28100 struct LDKCResult_ThirtyTwoBytesAPIErrorZ CResult_ThirtyTwoBytesAPIErrorZ_clone(const struct LDKCResult_ThirtyTwoBytesAPIErrorZ *NONNULL_PTR orig);
28101
28102 /**
28103  * Constructs a new COption_OffersMessageZ containing a crate::lightning::onion_message::offers::OffersMessage
28104  */
28105 struct LDKCOption_OffersMessageZ COption_OffersMessageZ_some(struct LDKOffersMessage o);
28106
28107 /**
28108  * Constructs a new COption_OffersMessageZ containing nothing
28109  */
28110 struct LDKCOption_OffersMessageZ COption_OffersMessageZ_none(void);
28111
28112 /**
28113  * Frees any resources associated with the crate::lightning::onion_message::offers::OffersMessage, if we are in the Some state
28114  */
28115 void COption_OffersMessageZ_free(struct LDKCOption_OffersMessageZ _res);
28116
28117 /**
28118  * Creates a new COption_OffersMessageZ which has the same data as `orig`
28119  * but with all dynamically-allocated buffers duplicated in new buffers.
28120  */
28121 struct LDKCOption_OffersMessageZ COption_OffersMessageZ_clone(const struct LDKCOption_OffersMessageZ *NONNULL_PTR orig);
28122
28123 /**
28124  * Creates a new tuple which has the same data as `orig`
28125  * but with all dynamically-allocated buffers duplicated in new buffers.
28126  */
28127 struct LDKC3Tuple_OffersMessageDestinationBlindedPathZ C3Tuple_OffersMessageDestinationBlindedPathZ_clone(const struct LDKC3Tuple_OffersMessageDestinationBlindedPathZ *NONNULL_PTR orig);
28128
28129 /**
28130  * Creates a new C3Tuple_OffersMessageDestinationBlindedPathZ from the contained elements.
28131  */
28132 struct LDKC3Tuple_OffersMessageDestinationBlindedPathZ C3Tuple_OffersMessageDestinationBlindedPathZ_new(struct LDKOffersMessage a, struct LDKDestination b, struct LDKBlindedPath c);
28133
28134 /**
28135  * Frees any resources used by the C3Tuple_OffersMessageDestinationBlindedPathZ.
28136  */
28137 void C3Tuple_OffersMessageDestinationBlindedPathZ_free(struct LDKC3Tuple_OffersMessageDestinationBlindedPathZ _res);
28138
28139 /**
28140  * Frees the buffer pointed to by `data` if `datalen` is non-0.
28141  */
28142 void CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ_free(struct LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ _res);
28143
28144 /**
28145  * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the success state.
28146  */
28147 struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(struct LDKCounterpartyForwardingInfo o);
28148
28149 /**
28150  * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the error state.
28151  */
28152 struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_err(struct LDKDecodeError e);
28153
28154 /**
28155  * Checks if the given object is currently in the success state
28156  */
28157 bool CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(const struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR o);
28158
28159 /**
28160  * Frees any resources used by the CResult_CounterpartyForwardingInfoDecodeErrorZ.
28161  */
28162 void CResult_CounterpartyForwardingInfoDecodeErrorZ_free(struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res);
28163
28164 /**
28165  * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ which has the same data as `orig`
28166  * but with all dynamically-allocated buffers duplicated in new buffers.
28167  */
28168 struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(const struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR orig);
28169
28170 /**
28171  * Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the success state.
28172  */
28173 struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_ok(struct LDKChannelCounterparty o);
28174
28175 /**
28176  * Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the error state.
28177  */
28178 struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_err(struct LDKDecodeError e);
28179
28180 /**
28181  * Checks if the given object is currently in the success state
28182  */
28183 bool CResult_ChannelCounterpartyDecodeErrorZ_is_ok(const struct LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR o);
28184
28185 /**
28186  * Frees any resources used by the CResult_ChannelCounterpartyDecodeErrorZ.
28187  */
28188 void CResult_ChannelCounterpartyDecodeErrorZ_free(struct LDKCResult_ChannelCounterpartyDecodeErrorZ _res);
28189
28190 /**
28191  * Creates a new CResult_ChannelCounterpartyDecodeErrorZ which has the same data as `orig`
28192  * but with all dynamically-allocated buffers duplicated in new buffers.
28193  */
28194 struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_clone(const struct LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR orig);
28195
28196 /**
28197  * Creates a new CResult_ChannelDetailsDecodeErrorZ in the success state.
28198  */
28199 struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_ok(struct LDKChannelDetails o);
28200
28201 /**
28202  * Creates a new CResult_ChannelDetailsDecodeErrorZ in the error state.
28203  */
28204 struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_err(struct LDKDecodeError e);
28205
28206 /**
28207  * Checks if the given object is currently in the success state
28208  */
28209 bool CResult_ChannelDetailsDecodeErrorZ_is_ok(const struct LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR o);
28210
28211 /**
28212  * Frees any resources used by the CResult_ChannelDetailsDecodeErrorZ.
28213  */
28214 void CResult_ChannelDetailsDecodeErrorZ_free(struct LDKCResult_ChannelDetailsDecodeErrorZ _res);
28215
28216 /**
28217  * Creates a new CResult_ChannelDetailsDecodeErrorZ which has the same data as `orig`
28218  * but with all dynamically-allocated buffers duplicated in new buffers.
28219  */
28220 struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_clone(const struct LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR orig);
28221
28222 /**
28223  * Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the success state.
28224  */
28225 struct LDKCResult_PhantomRouteHintsDecodeErrorZ CResult_PhantomRouteHintsDecodeErrorZ_ok(struct LDKPhantomRouteHints o);
28226
28227 /**
28228  * Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the error state.
28229  */
28230 struct LDKCResult_PhantomRouteHintsDecodeErrorZ CResult_PhantomRouteHintsDecodeErrorZ_err(struct LDKDecodeError e);
28231
28232 /**
28233  * Checks if the given object is currently in the success state
28234  */
28235 bool CResult_PhantomRouteHintsDecodeErrorZ_is_ok(const struct LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR o);
28236
28237 /**
28238  * Frees any resources used by the CResult_PhantomRouteHintsDecodeErrorZ.
28239  */
28240 void CResult_PhantomRouteHintsDecodeErrorZ_free(struct LDKCResult_PhantomRouteHintsDecodeErrorZ _res);
28241
28242 /**
28243  * Creates a new CResult_PhantomRouteHintsDecodeErrorZ which has the same data as `orig`
28244  * but with all dynamically-allocated buffers duplicated in new buffers.
28245  */
28246 struct LDKCResult_PhantomRouteHintsDecodeErrorZ CResult_PhantomRouteHintsDecodeErrorZ_clone(const struct LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR orig);
28247
28248 /**
28249  * Creates a new CResult_BlindedForwardDecodeErrorZ in the success state.
28250  */
28251 struct LDKCResult_BlindedForwardDecodeErrorZ CResult_BlindedForwardDecodeErrorZ_ok(struct LDKBlindedForward o);
28252
28253 /**
28254  * Creates a new CResult_BlindedForwardDecodeErrorZ in the error state.
28255  */
28256 struct LDKCResult_BlindedForwardDecodeErrorZ CResult_BlindedForwardDecodeErrorZ_err(struct LDKDecodeError e);
28257
28258 /**
28259  * Checks if the given object is currently in the success state
28260  */
28261 bool CResult_BlindedForwardDecodeErrorZ_is_ok(const struct LDKCResult_BlindedForwardDecodeErrorZ *NONNULL_PTR o);
28262
28263 /**
28264  * Frees any resources used by the CResult_BlindedForwardDecodeErrorZ.
28265  */
28266 void CResult_BlindedForwardDecodeErrorZ_free(struct LDKCResult_BlindedForwardDecodeErrorZ _res);
28267
28268 /**
28269  * Creates a new CResult_BlindedForwardDecodeErrorZ which has the same data as `orig`
28270  * but with all dynamically-allocated buffers duplicated in new buffers.
28271  */
28272 struct LDKCResult_BlindedForwardDecodeErrorZ CResult_BlindedForwardDecodeErrorZ_clone(const struct LDKCResult_BlindedForwardDecodeErrorZ *NONNULL_PTR orig);
28273
28274 /**
28275  * Creates a new CResult_PendingHTLCRoutingDecodeErrorZ in the success state.
28276  */
28277 struct LDKCResult_PendingHTLCRoutingDecodeErrorZ CResult_PendingHTLCRoutingDecodeErrorZ_ok(struct LDKPendingHTLCRouting o);
28278
28279 /**
28280  * Creates a new CResult_PendingHTLCRoutingDecodeErrorZ in the error state.
28281  */
28282 struct LDKCResult_PendingHTLCRoutingDecodeErrorZ CResult_PendingHTLCRoutingDecodeErrorZ_err(struct LDKDecodeError e);
28283
28284 /**
28285  * Checks if the given object is currently in the success state
28286  */
28287 bool CResult_PendingHTLCRoutingDecodeErrorZ_is_ok(const struct LDKCResult_PendingHTLCRoutingDecodeErrorZ *NONNULL_PTR o);
28288
28289 /**
28290  * Frees any resources used by the CResult_PendingHTLCRoutingDecodeErrorZ.
28291  */
28292 void CResult_PendingHTLCRoutingDecodeErrorZ_free(struct LDKCResult_PendingHTLCRoutingDecodeErrorZ _res);
28293
28294 /**
28295  * Creates a new CResult_PendingHTLCRoutingDecodeErrorZ which has the same data as `orig`
28296  * but with all dynamically-allocated buffers duplicated in new buffers.
28297  */
28298 struct LDKCResult_PendingHTLCRoutingDecodeErrorZ CResult_PendingHTLCRoutingDecodeErrorZ_clone(const struct LDKCResult_PendingHTLCRoutingDecodeErrorZ *NONNULL_PTR orig);
28299
28300 /**
28301  * Creates a new CResult_PendingHTLCInfoDecodeErrorZ in the success state.
28302  */
28303 struct LDKCResult_PendingHTLCInfoDecodeErrorZ CResult_PendingHTLCInfoDecodeErrorZ_ok(struct LDKPendingHTLCInfo o);
28304
28305 /**
28306  * Creates a new CResult_PendingHTLCInfoDecodeErrorZ in the error state.
28307  */
28308 struct LDKCResult_PendingHTLCInfoDecodeErrorZ CResult_PendingHTLCInfoDecodeErrorZ_err(struct LDKDecodeError e);
28309
28310 /**
28311  * Checks if the given object is currently in the success state
28312  */
28313 bool CResult_PendingHTLCInfoDecodeErrorZ_is_ok(const struct LDKCResult_PendingHTLCInfoDecodeErrorZ *NONNULL_PTR o);
28314
28315 /**
28316  * Frees any resources used by the CResult_PendingHTLCInfoDecodeErrorZ.
28317  */
28318 void CResult_PendingHTLCInfoDecodeErrorZ_free(struct LDKCResult_PendingHTLCInfoDecodeErrorZ _res);
28319
28320 /**
28321  * Creates a new CResult_PendingHTLCInfoDecodeErrorZ which has the same data as `orig`
28322  * but with all dynamically-allocated buffers duplicated in new buffers.
28323  */
28324 struct LDKCResult_PendingHTLCInfoDecodeErrorZ CResult_PendingHTLCInfoDecodeErrorZ_clone(const struct LDKCResult_PendingHTLCInfoDecodeErrorZ *NONNULL_PTR orig);
28325
28326 /**
28327  * Creates a new CResult_BlindedFailureDecodeErrorZ in the success state.
28328  */
28329 struct LDKCResult_BlindedFailureDecodeErrorZ CResult_BlindedFailureDecodeErrorZ_ok(enum LDKBlindedFailure o);
28330
28331 /**
28332  * Creates a new CResult_BlindedFailureDecodeErrorZ in the error state.
28333  */
28334 struct LDKCResult_BlindedFailureDecodeErrorZ CResult_BlindedFailureDecodeErrorZ_err(struct LDKDecodeError e);
28335
28336 /**
28337  * Checks if the given object is currently in the success state
28338  */
28339 bool CResult_BlindedFailureDecodeErrorZ_is_ok(const struct LDKCResult_BlindedFailureDecodeErrorZ *NONNULL_PTR o);
28340
28341 /**
28342  * Frees any resources used by the CResult_BlindedFailureDecodeErrorZ.
28343  */
28344 void CResult_BlindedFailureDecodeErrorZ_free(struct LDKCResult_BlindedFailureDecodeErrorZ _res);
28345
28346 /**
28347  * Creates a new CResult_BlindedFailureDecodeErrorZ which has the same data as `orig`
28348  * but with all dynamically-allocated buffers duplicated in new buffers.
28349  */
28350 struct LDKCResult_BlindedFailureDecodeErrorZ CResult_BlindedFailureDecodeErrorZ_clone(const struct LDKCResult_BlindedFailureDecodeErrorZ *NONNULL_PTR orig);
28351
28352 /**
28353  * Creates a new CResult_ChannelShutdownStateDecodeErrorZ in the success state.
28354  */
28355 struct LDKCResult_ChannelShutdownStateDecodeErrorZ CResult_ChannelShutdownStateDecodeErrorZ_ok(enum LDKChannelShutdownState o);
28356
28357 /**
28358  * Creates a new CResult_ChannelShutdownStateDecodeErrorZ in the error state.
28359  */
28360 struct LDKCResult_ChannelShutdownStateDecodeErrorZ CResult_ChannelShutdownStateDecodeErrorZ_err(struct LDKDecodeError e);
28361
28362 /**
28363  * Checks if the given object is currently in the success state
28364  */
28365 bool CResult_ChannelShutdownStateDecodeErrorZ_is_ok(const struct LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR o);
28366
28367 /**
28368  * Frees any resources used by the CResult_ChannelShutdownStateDecodeErrorZ.
28369  */
28370 void CResult_ChannelShutdownStateDecodeErrorZ_free(struct LDKCResult_ChannelShutdownStateDecodeErrorZ _res);
28371
28372 /**
28373  * Creates a new CResult_ChannelShutdownStateDecodeErrorZ which has the same data as `orig`
28374  * but with all dynamically-allocated buffers duplicated in new buffers.
28375  */
28376 struct LDKCResult_ChannelShutdownStateDecodeErrorZ CResult_ChannelShutdownStateDecodeErrorZ_clone(const struct LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR orig);
28377
28378 /**
28379  * Frees the buffer pointed to by `data` if `datalen` is non-0.
28380  */
28381 void CVec_ChannelMonitorZ_free(struct LDKCVec_ChannelMonitorZ _res);
28382
28383 /**
28384  * Creates a new C2Tuple_ThirtyTwoBytesChannelManagerZ from the contained elements.
28385  */
28386 struct LDKC2Tuple_ThirtyTwoBytesChannelManagerZ C2Tuple_ThirtyTwoBytesChannelManagerZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelManager b);
28387
28388 /**
28389  * Frees any resources used by the C2Tuple_ThirtyTwoBytesChannelManagerZ.
28390  */
28391 void C2Tuple_ThirtyTwoBytesChannelManagerZ_free(struct LDKC2Tuple_ThirtyTwoBytesChannelManagerZ _res);
28392
28393 /**
28394  * Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ in the success state.
28395  */
28396 struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_ok(struct LDKC2Tuple_ThirtyTwoBytesChannelManagerZ o);
28397
28398 /**
28399  * Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ in the error state.
28400  */
28401 struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_err(struct LDKDecodeError e);
28402
28403 /**
28404  * Checks if the given object is currently in the success state
28405  */
28406 bool CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_is_ok(const struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ *NONNULL_PTR o);
28407
28408 /**
28409  * Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ.
28410  */
28411 void CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_free(struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ _res);
28412
28413 /**
28414  * Creates a new CResult_MaxDustHTLCExposureDecodeErrorZ in the success state.
28415  */
28416 struct LDKCResult_MaxDustHTLCExposureDecodeErrorZ CResult_MaxDustHTLCExposureDecodeErrorZ_ok(struct LDKMaxDustHTLCExposure o);
28417
28418 /**
28419  * Creates a new CResult_MaxDustHTLCExposureDecodeErrorZ in the error state.
28420  */
28421 struct LDKCResult_MaxDustHTLCExposureDecodeErrorZ CResult_MaxDustHTLCExposureDecodeErrorZ_err(struct LDKDecodeError e);
28422
28423 /**
28424  * Checks if the given object is currently in the success state
28425  */
28426 bool CResult_MaxDustHTLCExposureDecodeErrorZ_is_ok(const struct LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR o);
28427
28428 /**
28429  * Frees any resources used by the CResult_MaxDustHTLCExposureDecodeErrorZ.
28430  */
28431 void CResult_MaxDustHTLCExposureDecodeErrorZ_free(struct LDKCResult_MaxDustHTLCExposureDecodeErrorZ _res);
28432
28433 /**
28434  * Creates a new CResult_MaxDustHTLCExposureDecodeErrorZ which has the same data as `orig`
28435  * but with all dynamically-allocated buffers duplicated in new buffers.
28436  */
28437 struct LDKCResult_MaxDustHTLCExposureDecodeErrorZ CResult_MaxDustHTLCExposureDecodeErrorZ_clone(const struct LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR orig);
28438
28439 /**
28440  * Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
28441  */
28442 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_ok(struct LDKChannelConfig o);
28443
28444 /**
28445  * Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
28446  */
28447 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_err(struct LDKDecodeError e);
28448
28449 /**
28450  * Checks if the given object is currently in the success state
28451  */
28452 bool CResult_ChannelConfigDecodeErrorZ_is_ok(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR o);
28453
28454 /**
28455  * Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
28456  */
28457 void CResult_ChannelConfigDecodeErrorZ_free(struct LDKCResult_ChannelConfigDecodeErrorZ _res);
28458
28459 /**
28460  * Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
28461  * but with all dynamically-allocated buffers duplicated in new buffers.
28462  */
28463 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_clone(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR orig);
28464
28465 /**
28466  * Constructs a new COption_MaxDustHTLCExposureZ containing a crate::lightning::util::config::MaxDustHTLCExposure
28467  */
28468 struct LDKCOption_MaxDustHTLCExposureZ COption_MaxDustHTLCExposureZ_some(struct LDKMaxDustHTLCExposure o);
28469
28470 /**
28471  * Constructs a new COption_MaxDustHTLCExposureZ containing nothing
28472  */
28473 struct LDKCOption_MaxDustHTLCExposureZ COption_MaxDustHTLCExposureZ_none(void);
28474
28475 /**
28476  * Frees any resources associated with the crate::lightning::util::config::MaxDustHTLCExposure, if we are in the Some state
28477  */
28478 void COption_MaxDustHTLCExposureZ_free(struct LDKCOption_MaxDustHTLCExposureZ _res);
28479
28480 /**
28481  * Creates a new COption_MaxDustHTLCExposureZ which has the same data as `orig`
28482  * but with all dynamically-allocated buffers duplicated in new buffers.
28483  */
28484 struct LDKCOption_MaxDustHTLCExposureZ COption_MaxDustHTLCExposureZ_clone(const struct LDKCOption_MaxDustHTLCExposureZ *NONNULL_PTR orig);
28485
28486 /**
28487  * Constructs a new COption_APIErrorZ containing a crate::lightning::util::errors::APIError
28488  */
28489 struct LDKCOption_APIErrorZ COption_APIErrorZ_some(struct LDKAPIError o);
28490
28491 /**
28492  * Constructs a new COption_APIErrorZ containing nothing
28493  */
28494 struct LDKCOption_APIErrorZ COption_APIErrorZ_none(void);
28495
28496 /**
28497  * Frees any resources associated with the crate::lightning::util::errors::APIError, if we are in the Some state
28498  */
28499 void COption_APIErrorZ_free(struct LDKCOption_APIErrorZ _res);
28500
28501 /**
28502  * Creates a new COption_APIErrorZ which has the same data as `orig`
28503  * but with all dynamically-allocated buffers duplicated in new buffers.
28504  */
28505 struct LDKCOption_APIErrorZ COption_APIErrorZ_clone(const struct LDKCOption_APIErrorZ *NONNULL_PTR orig);
28506
28507 /**
28508  * Creates a new CResult_COption_APIErrorZDecodeErrorZ in the success state.
28509  */
28510 struct LDKCResult_COption_APIErrorZDecodeErrorZ CResult_COption_APIErrorZDecodeErrorZ_ok(struct LDKCOption_APIErrorZ o);
28511
28512 /**
28513  * Creates a new CResult_COption_APIErrorZDecodeErrorZ in the error state.
28514  */
28515 struct LDKCResult_COption_APIErrorZDecodeErrorZ CResult_COption_APIErrorZDecodeErrorZ_err(struct LDKDecodeError e);
28516
28517 /**
28518  * Checks if the given object is currently in the success state
28519  */
28520 bool CResult_COption_APIErrorZDecodeErrorZ_is_ok(const struct LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR o);
28521
28522 /**
28523  * Frees any resources used by the CResult_COption_APIErrorZDecodeErrorZ.
28524  */
28525 void CResult_COption_APIErrorZDecodeErrorZ_free(struct LDKCResult_COption_APIErrorZDecodeErrorZ _res);
28526
28527 /**
28528  * Creates a new CResult_COption_APIErrorZDecodeErrorZ which has the same data as `orig`
28529  * but with all dynamically-allocated buffers duplicated in new buffers.
28530  */
28531 struct LDKCResult_COption_APIErrorZDecodeErrorZ CResult_COption_APIErrorZDecodeErrorZ_clone(const struct LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR orig);
28532
28533 /**
28534  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
28535  */
28536 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_ok(struct LDKChannelMonitorUpdate o);
28537
28538 /**
28539  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
28540  */
28541 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_err(struct LDKDecodeError e);
28542
28543 /**
28544  * Checks if the given object is currently in the success state
28545  */
28546 bool CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR o);
28547
28548 /**
28549  * Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
28550  */
28551 void CResult_ChannelMonitorUpdateDecodeErrorZ_free(struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res);
28552
28553 /**
28554  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
28555  * but with all dynamically-allocated buffers duplicated in new buffers.
28556  */
28557 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR orig);
28558
28559 /**
28560  * Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent
28561  */
28562 struct LDKCOption_MonitorEventZ COption_MonitorEventZ_some(struct LDKMonitorEvent o);
28563
28564 /**
28565  * Constructs a new COption_MonitorEventZ containing nothing
28566  */
28567 struct LDKCOption_MonitorEventZ COption_MonitorEventZ_none(void);
28568
28569 /**
28570  * Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state
28571  */
28572 void COption_MonitorEventZ_free(struct LDKCOption_MonitorEventZ _res);
28573
28574 /**
28575  * Creates a new COption_MonitorEventZ which has the same data as `orig`
28576  * but with all dynamically-allocated buffers duplicated in new buffers.
28577  */
28578 struct LDKCOption_MonitorEventZ COption_MonitorEventZ_clone(const struct LDKCOption_MonitorEventZ *NONNULL_PTR orig);
28579
28580 /**
28581  * Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state.
28582  */
28583 struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_ok(struct LDKCOption_MonitorEventZ o);
28584
28585 /**
28586  * Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state.
28587  */
28588 struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_err(struct LDKDecodeError e);
28589
28590 /**
28591  * Checks if the given object is currently in the success state
28592  */
28593 bool CResult_COption_MonitorEventZDecodeErrorZ_is_ok(const struct LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR o);
28594
28595 /**
28596  * Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ.
28597  */
28598 void CResult_COption_MonitorEventZDecodeErrorZ_free(struct LDKCResult_COption_MonitorEventZDecodeErrorZ _res);
28599
28600 /**
28601  * Creates a new CResult_COption_MonitorEventZDecodeErrorZ which has the same data as `orig`
28602  * but with all dynamically-allocated buffers duplicated in new buffers.
28603  */
28604 struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_clone(const struct LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR orig);
28605
28606 /**
28607  * Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
28608  */
28609 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_ok(struct LDKHTLCUpdate o);
28610
28611 /**
28612  * Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
28613  */
28614 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_err(struct LDKDecodeError e);
28615
28616 /**
28617  * Checks if the given object is currently in the success state
28618  */
28619 bool CResult_HTLCUpdateDecodeErrorZ_is_ok(const struct LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR o);
28620
28621 /**
28622  * Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
28623  */
28624 void CResult_HTLCUpdateDecodeErrorZ_free(struct LDKCResult_HTLCUpdateDecodeErrorZ _res);
28625
28626 /**
28627  * Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
28628  * but with all dynamically-allocated buffers duplicated in new buffers.
28629  */
28630 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_clone(const struct LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR orig);
28631
28632 /**
28633  * Creates a new tuple which has the same data as `orig`
28634  * but with all dynamically-allocated buffers duplicated in new buffers.
28635  */
28636 struct LDKC2Tuple_OutPointCVec_u8ZZ C2Tuple_OutPointCVec_u8ZZ_clone(const struct LDKC2Tuple_OutPointCVec_u8ZZ *NONNULL_PTR orig);
28637
28638 /**
28639  * Creates a new C2Tuple_OutPointCVec_u8ZZ from the contained elements.
28640  */
28641 struct LDKC2Tuple_OutPointCVec_u8ZZ C2Tuple_OutPointCVec_u8ZZ_new(struct LDKOutPoint a, struct LDKCVec_u8Z b);
28642
28643 /**
28644  * Frees any resources used by the C2Tuple_OutPointCVec_u8ZZ.
28645  */
28646 void C2Tuple_OutPointCVec_u8ZZ_free(struct LDKC2Tuple_OutPointCVec_u8ZZ _res);
28647
28648 /**
28649  * Creates a new tuple which has the same data as `orig`
28650  * but with all dynamically-allocated buffers duplicated in new buffers.
28651  */
28652 struct LDKC2Tuple_u32CVec_u8ZZ C2Tuple_u32CVec_u8ZZ_clone(const struct LDKC2Tuple_u32CVec_u8ZZ *NONNULL_PTR orig);
28653
28654 /**
28655  * Creates a new C2Tuple_u32CVec_u8ZZ from the contained elements.
28656  */
28657 struct LDKC2Tuple_u32CVec_u8ZZ C2Tuple_u32CVec_u8ZZ_new(uint32_t a, struct LDKCVec_u8Z b);
28658
28659 /**
28660  * Frees any resources used by the C2Tuple_u32CVec_u8ZZ.
28661  */
28662 void C2Tuple_u32CVec_u8ZZ_free(struct LDKC2Tuple_u32CVec_u8ZZ _res);
28663
28664 /**
28665  * Frees the buffer pointed to by `data` if `datalen` is non-0.
28666  */
28667 void CVec_C2Tuple_u32CVec_u8ZZZ_free(struct LDKCVec_C2Tuple_u32CVec_u8ZZZ _res);
28668
28669 /**
28670  * Creates a new tuple which has the same data as `orig`
28671  * but with all dynamically-allocated buffers duplicated in new buffers.
28672  */
28673 struct LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(const struct LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ *NONNULL_PTR orig);
28674
28675 /**
28676  * Creates a new C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ from the contained elements.
28677  */
28678 struct LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32CVec_u8ZZZ b);
28679
28680 /**
28681  * Frees any resources used by the C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ.
28682  */
28683 void C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_free(struct LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ _res);
28684
28685 /**
28686  * Frees the buffer pointed to by `data` if `datalen` is non-0.
28687  */
28688 void CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_free(struct LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ _res);
28689
28690 /**
28691  * Frees the buffer pointed to by `data` if `datalen` is non-0.
28692  */
28693 void CVec_CommitmentTransactionZ_free(struct LDKCVec_CommitmentTransactionZ _res);
28694
28695 /**
28696  * Creates a new tuple which has the same data as `orig`
28697  * but with all dynamically-allocated buffers duplicated in new buffers.
28698  */
28699 struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_clone(const struct LDKC2Tuple_u32TxOutZ *NONNULL_PTR orig);
28700
28701 /**
28702  * Creates a new C2Tuple_u32TxOutZ from the contained elements.
28703  */
28704 struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_new(uint32_t a, struct LDKTxOut b);
28705
28706 /**
28707  * Frees any resources used by the C2Tuple_u32TxOutZ.
28708  */
28709 void C2Tuple_u32TxOutZ_free(struct LDKC2Tuple_u32TxOutZ _res);
28710
28711 /**
28712  * Frees the buffer pointed to by `data` if `datalen` is non-0.
28713  */
28714 void CVec_C2Tuple_u32TxOutZZ_free(struct LDKCVec_C2Tuple_u32TxOutZZ _res);
28715
28716 /**
28717  * Creates a new tuple which has the same data as `orig`
28718  * but with all dynamically-allocated buffers duplicated in new buffers.
28719  */
28720 struct LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(const struct LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR orig);
28721
28722 /**
28723  * Creates a new C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ from the contained elements.
28724  */
28725 struct LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32TxOutZZ b);
28726
28727 /**
28728  * Frees any resources used by the C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ.
28729  */
28730 void C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_free(struct LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ _res);
28731
28732 /**
28733  * Frees the buffer pointed to by `data` if `datalen` is non-0.
28734  */
28735 void CVec_TransactionOutputsZ_free(struct LDKCVec_TransactionOutputsZ _res);
28736
28737 /**
28738  * Frees the buffer pointed to by `data` if `datalen` is non-0.
28739  */
28740 void CVec_BalanceZ_free(struct LDKCVec_BalanceZ _res);
28741
28742 /**
28743  * Creates a new tuple which has the same data as `orig`
28744  * but with all dynamically-allocated buffers duplicated in new buffers.
28745  */
28746 struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(const struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ *NONNULL_PTR orig);
28747
28748 /**
28749  * Creates a new C2Tuple_ThirtyTwoBytesChannelMonitorZ from the contained elements.
28750  */
28751 struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ C2Tuple_ThirtyTwoBytesChannelMonitorZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelMonitor b);
28752
28753 /**
28754  * Frees any resources used by the C2Tuple_ThirtyTwoBytesChannelMonitorZ.
28755  */
28756 void C2Tuple_ThirtyTwoBytesChannelMonitorZ_free(struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ _res);
28757
28758 /**
28759  * Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ in the success state.
28760  */
28761 struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_ok(struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ o);
28762
28763 /**
28764  * Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ in the error state.
28765  */
28766 struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_err(struct LDKDecodeError e);
28767
28768 /**
28769  * Checks if the given object is currently in the success state
28770  */
28771 bool CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_is_ok(const struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ *NONNULL_PTR o);
28772
28773 /**
28774  * Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ.
28775  */
28776 void CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_free(struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ _res);
28777
28778 /**
28779  * Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ which has the same data as `orig`
28780  * but with all dynamically-allocated buffers duplicated in new buffers.
28781  */
28782 struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone(const struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ *NONNULL_PTR orig);
28783
28784 /**
28785  * Creates a new tuple which has the same data as `orig`
28786  * but with all dynamically-allocated buffers duplicated in new buffers.
28787  */
28788 struct LDKC2Tuple_PublicKeyTypeZ C2Tuple_PublicKeyTypeZ_clone(const struct LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR orig);
28789
28790 /**
28791  * Creates a new C2Tuple_PublicKeyTypeZ from the contained elements.
28792  */
28793 struct LDKC2Tuple_PublicKeyTypeZ C2Tuple_PublicKeyTypeZ_new(struct LDKPublicKey a, struct LDKType b);
28794
28795 /**
28796  * Frees any resources used by the C2Tuple_PublicKeyTypeZ.
28797  */
28798 void C2Tuple_PublicKeyTypeZ_free(struct LDKC2Tuple_PublicKeyTypeZ _res);
28799
28800 /**
28801  * Frees the buffer pointed to by `data` if `datalen` is non-0.
28802  */
28803 void CVec_C2Tuple_PublicKeyTypeZZ_free(struct LDKCVec_C2Tuple_PublicKeyTypeZZ _res);
28804
28805 /**
28806  * Creates a new tuple which has the same data as `orig`
28807  * but with all dynamically-allocated buffers duplicated in new buffers.
28808  */
28809 struct LDKC2Tuple_PublicKeyCVec_SocketAddressZZ C2Tuple_PublicKeyCVec_SocketAddressZZ_clone(const struct LDKC2Tuple_PublicKeyCVec_SocketAddressZZ *NONNULL_PTR orig);
28810
28811 /**
28812  * Creates a new C2Tuple_PublicKeyCVec_SocketAddressZZ from the contained elements.
28813  */
28814 struct LDKC2Tuple_PublicKeyCVec_SocketAddressZZ C2Tuple_PublicKeyCVec_SocketAddressZZ_new(struct LDKPublicKey a, struct LDKCVec_SocketAddressZ b);
28815
28816 /**
28817  * Frees any resources used by the C2Tuple_PublicKeyCVec_SocketAddressZZ.
28818  */
28819 void C2Tuple_PublicKeyCVec_SocketAddressZZ_free(struct LDKC2Tuple_PublicKeyCVec_SocketAddressZZ _res);
28820
28821 /**
28822  * Frees the buffer pointed to by `data` if `datalen` is non-0.
28823  */
28824 void CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ_free(struct LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ _res);
28825
28826 /**
28827  * Constructs a new COption_OnionMessageContentsZ containing a crate::lightning::onion_message::packet::OnionMessageContents
28828  */
28829 struct LDKCOption_OnionMessageContentsZ COption_OnionMessageContentsZ_some(struct LDKOnionMessageContents o);
28830
28831 /**
28832  * Constructs a new COption_OnionMessageContentsZ containing nothing
28833  */
28834 struct LDKCOption_OnionMessageContentsZ COption_OnionMessageContentsZ_none(void);
28835
28836 /**
28837  * Frees any resources associated with the crate::lightning::onion_message::packet::OnionMessageContents, if we are in the Some state
28838  */
28839 void COption_OnionMessageContentsZ_free(struct LDKCOption_OnionMessageContentsZ _res);
28840
28841 /**
28842  * Creates a new COption_OnionMessageContentsZ which has the same data as `orig`
28843  * but with all dynamically-allocated buffers duplicated in new buffers.
28844  */
28845 struct LDKCOption_OnionMessageContentsZ COption_OnionMessageContentsZ_clone(const struct LDKCOption_OnionMessageContentsZ *NONNULL_PTR orig);
28846
28847 /**
28848  * Creates a new CResult_COption_OnionMessageContentsZDecodeErrorZ in the success state.
28849  */
28850 struct LDKCResult_COption_OnionMessageContentsZDecodeErrorZ CResult_COption_OnionMessageContentsZDecodeErrorZ_ok(struct LDKCOption_OnionMessageContentsZ o);
28851
28852 /**
28853  * Creates a new CResult_COption_OnionMessageContentsZDecodeErrorZ in the error state.
28854  */
28855 struct LDKCResult_COption_OnionMessageContentsZDecodeErrorZ CResult_COption_OnionMessageContentsZDecodeErrorZ_err(struct LDKDecodeError e);
28856
28857 /**
28858  * Checks if the given object is currently in the success state
28859  */
28860 bool CResult_COption_OnionMessageContentsZDecodeErrorZ_is_ok(const struct LDKCResult_COption_OnionMessageContentsZDecodeErrorZ *NONNULL_PTR o);
28861
28862 /**
28863  * Frees any resources used by the CResult_COption_OnionMessageContentsZDecodeErrorZ.
28864  */
28865 void CResult_COption_OnionMessageContentsZDecodeErrorZ_free(struct LDKCResult_COption_OnionMessageContentsZDecodeErrorZ _res);
28866
28867 /**
28868  * Creates a new CResult_COption_OnionMessageContentsZDecodeErrorZ which has the same data as `orig`
28869  * but with all dynamically-allocated buffers duplicated in new buffers.
28870  */
28871 struct LDKCResult_COption_OnionMessageContentsZDecodeErrorZ CResult_COption_OnionMessageContentsZDecodeErrorZ_clone(const struct LDKCResult_COption_OnionMessageContentsZDecodeErrorZ *NONNULL_PTR orig);
28872
28873 /**
28874  * Creates a new tuple which has the same data as `orig`
28875  * but with all dynamically-allocated buffers duplicated in new buffers.
28876  */
28877 struct LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone(const struct LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *NONNULL_PTR orig);
28878
28879 /**
28880  * Creates a new C3Tuple_OnionMessageContentsDestinationBlindedPathZ from the contained elements.
28881  */
28882 struct LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ C3Tuple_OnionMessageContentsDestinationBlindedPathZ_new(struct LDKOnionMessageContents a, struct LDKDestination b, struct LDKBlindedPath c);
28883
28884 /**
28885  * Frees any resources used by the C3Tuple_OnionMessageContentsDestinationBlindedPathZ.
28886  */
28887 void C3Tuple_OnionMessageContentsDestinationBlindedPathZ_free(struct LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ _res);
28888
28889 /**
28890  * Frees the buffer pointed to by `data` if `datalen` is non-0.
28891  */
28892 void CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ_free(struct LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ _res);
28893
28894 /**
28895  * Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
28896  */
28897 struct LDKCOption_TypeZ COption_TypeZ_some(struct LDKType o);
28898
28899 /**
28900  * Constructs a new COption_TypeZ containing nothing
28901  */
28902 struct LDKCOption_TypeZ COption_TypeZ_none(void);
28903
28904 /**
28905  * Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state
28906  */
28907 void COption_TypeZ_free(struct LDKCOption_TypeZ _res);
28908
28909 /**
28910  * Creates a new COption_TypeZ which has the same data as `orig`
28911  * but with all dynamically-allocated buffers duplicated in new buffers.
28912  */
28913 struct LDKCOption_TypeZ COption_TypeZ_clone(const struct LDKCOption_TypeZ *NONNULL_PTR orig);
28914
28915 /**
28916  * Creates a new CResult_COption_TypeZDecodeErrorZ in the success state.
28917  */
28918 struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_ok(struct LDKCOption_TypeZ o);
28919
28920 /**
28921  * Creates a new CResult_COption_TypeZDecodeErrorZ in the error state.
28922  */
28923 struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_err(struct LDKDecodeError e);
28924
28925 /**
28926  * Checks if the given object is currently in the success state
28927  */
28928 bool CResult_COption_TypeZDecodeErrorZ_is_ok(const struct LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR o);
28929
28930 /**
28931  * Frees any resources used by the CResult_COption_TypeZDecodeErrorZ.
28932  */
28933 void CResult_COption_TypeZDecodeErrorZ_free(struct LDKCResult_COption_TypeZDecodeErrorZ _res);
28934
28935 /**
28936  * Creates a new CResult_COption_TypeZDecodeErrorZ which has the same data as `orig`
28937  * but with all dynamically-allocated buffers duplicated in new buffers.
28938  */
28939 struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_clone(const struct LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR orig);
28940
28941 /**
28942  * Constructs a new COption_SocketAddressZ containing a crate::lightning::ln::msgs::SocketAddress
28943  */
28944 struct LDKCOption_SocketAddressZ COption_SocketAddressZ_some(struct LDKSocketAddress o);
28945
28946 /**
28947  * Constructs a new COption_SocketAddressZ containing nothing
28948  */
28949 struct LDKCOption_SocketAddressZ COption_SocketAddressZ_none(void);
28950
28951 /**
28952  * Frees any resources associated with the crate::lightning::ln::msgs::SocketAddress, if we are in the Some state
28953  */
28954 void COption_SocketAddressZ_free(struct LDKCOption_SocketAddressZ _res);
28955
28956 /**
28957  * Creates a new COption_SocketAddressZ which has the same data as `orig`
28958  * but with all dynamically-allocated buffers duplicated in new buffers.
28959  */
28960 struct LDKCOption_SocketAddressZ COption_SocketAddressZ_clone(const struct LDKCOption_SocketAddressZ *NONNULL_PTR orig);
28961
28962 /**
28963  * Frees the buffer pointed to by `data` if `datalen` is non-0.
28964  */
28965 void CVec_PeerDetailsZ_free(struct LDKCVec_PeerDetailsZ _res);
28966
28967 /**
28968  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
28969  */
28970 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_ok(struct LDKCVec_u8Z o);
28971
28972 /**
28973  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
28974  */
28975 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_err(struct LDKPeerHandleError e);
28976
28977 /**
28978  * Checks if the given object is currently in the success state
28979  */
28980 bool CResult_CVec_u8ZPeerHandleErrorZ_is_ok(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR o);
28981
28982 /**
28983  * Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
28984  */
28985 void CResult_CVec_u8ZPeerHandleErrorZ_free(struct LDKCResult_CVec_u8ZPeerHandleErrorZ _res);
28986
28987 /**
28988  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
28989  * but with all dynamically-allocated buffers duplicated in new buffers.
28990  */
28991 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_clone(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR orig);
28992
28993 /**
28994  * Creates a new CResult_NonePeerHandleErrorZ in the success state.
28995  */
28996 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_ok(void);
28997
28998 /**
28999  * Creates a new CResult_NonePeerHandleErrorZ in the error state.
29000  */
29001 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_err(struct LDKPeerHandleError e);
29002
29003 /**
29004  * Checks if the given object is currently in the success state
29005  */
29006 bool CResult_NonePeerHandleErrorZ_is_ok(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR o);
29007
29008 /**
29009  * Frees any resources used by the CResult_NonePeerHandleErrorZ.
29010  */
29011 void CResult_NonePeerHandleErrorZ_free(struct LDKCResult_NonePeerHandleErrorZ _res);
29012
29013 /**
29014  * Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
29015  * but with all dynamically-allocated buffers duplicated in new buffers.
29016  */
29017 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_clone(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR orig);
29018
29019 /**
29020  * Creates a new CResult_boolPeerHandleErrorZ in the success state.
29021  */
29022 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_ok(bool o);
29023
29024 /**
29025  * Creates a new CResult_boolPeerHandleErrorZ in the error state.
29026  */
29027 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_err(struct LDKPeerHandleError e);
29028
29029 /**
29030  * Checks if the given object is currently in the success state
29031  */
29032 bool CResult_boolPeerHandleErrorZ_is_ok(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR o);
29033
29034 /**
29035  * Frees any resources used by the CResult_boolPeerHandleErrorZ.
29036  */
29037 void CResult_boolPeerHandleErrorZ_free(struct LDKCResult_boolPeerHandleErrorZ _res);
29038
29039 /**
29040  * Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
29041  * but with all dynamically-allocated buffers duplicated in new buffers.
29042  */
29043 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_clone(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR orig);
29044
29045 /**
29046  * Creates a new CResult_u32GraphSyncErrorZ in the success state.
29047  */
29048 struct LDKCResult_u32GraphSyncErrorZ CResult_u32GraphSyncErrorZ_ok(uint32_t o);
29049
29050 /**
29051  * Creates a new CResult_u32GraphSyncErrorZ in the error state.
29052  */
29053 struct LDKCResult_u32GraphSyncErrorZ CResult_u32GraphSyncErrorZ_err(struct LDKGraphSyncError e);
29054
29055 /**
29056  * Checks if the given object is currently in the success state
29057  */
29058 bool CResult_u32GraphSyncErrorZ_is_ok(const struct LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR o);
29059
29060 /**
29061  * Frees any resources used by the CResult_u32GraphSyncErrorZ.
29062  */
29063 void CResult_u32GraphSyncErrorZ_free(struct LDKCResult_u32GraphSyncErrorZ _res);
29064
29065 /**
29066  * Creates a new CResult_CVec_u8ZIOErrorZ in the success state.
29067  */
29068 struct LDKCResult_CVec_u8ZIOErrorZ CResult_CVec_u8ZIOErrorZ_ok(struct LDKCVec_u8Z o);
29069
29070 /**
29071  * Creates a new CResult_CVec_u8ZIOErrorZ in the error state.
29072  */
29073 struct LDKCResult_CVec_u8ZIOErrorZ CResult_CVec_u8ZIOErrorZ_err(enum LDKIOError e);
29074
29075 /**
29076  * Checks if the given object is currently in the success state
29077  */
29078 bool CResult_CVec_u8ZIOErrorZ_is_ok(const struct LDKCResult_CVec_u8ZIOErrorZ *NONNULL_PTR o);
29079
29080 /**
29081  * Frees any resources used by the CResult_CVec_u8ZIOErrorZ.
29082  */
29083 void CResult_CVec_u8ZIOErrorZ_free(struct LDKCResult_CVec_u8ZIOErrorZ _res);
29084
29085 /**
29086  * Creates a new CResult_CVec_u8ZIOErrorZ which has the same data as `orig`
29087  * but with all dynamically-allocated buffers duplicated in new buffers.
29088  */
29089 struct LDKCResult_CVec_u8ZIOErrorZ CResult_CVec_u8ZIOErrorZ_clone(const struct LDKCResult_CVec_u8ZIOErrorZ *NONNULL_PTR orig);
29090
29091 /**
29092  * Frees the buffer pointed to by `data` if `datalen` is non-0.
29093  */
29094 void CVec_StrZ_free(struct LDKCVec_StrZ _res);
29095
29096 /**
29097  * Creates a new CResult_CVec_StrZIOErrorZ in the success state.
29098  */
29099 struct LDKCResult_CVec_StrZIOErrorZ CResult_CVec_StrZIOErrorZ_ok(struct LDKCVec_StrZ o);
29100
29101 /**
29102  * Creates a new CResult_CVec_StrZIOErrorZ in the error state.
29103  */
29104 struct LDKCResult_CVec_StrZIOErrorZ CResult_CVec_StrZIOErrorZ_err(enum LDKIOError e);
29105
29106 /**
29107  * Checks if the given object is currently in the success state
29108  */
29109 bool CResult_CVec_StrZIOErrorZ_is_ok(const struct LDKCResult_CVec_StrZIOErrorZ *NONNULL_PTR o);
29110
29111 /**
29112  * Frees any resources used by the CResult_CVec_StrZIOErrorZ.
29113  */
29114 void CResult_CVec_StrZIOErrorZ_free(struct LDKCResult_CVec_StrZIOErrorZ _res);
29115
29116 /**
29117  * Creates a new CResult_CVec_StrZIOErrorZ which has the same data as `orig`
29118  * but with all dynamically-allocated buffers duplicated in new buffers.
29119  */
29120 struct LDKCResult_CVec_StrZIOErrorZ CResult_CVec_StrZIOErrorZ_clone(const struct LDKCResult_CVec_StrZIOErrorZ *NONNULL_PTR orig);
29121
29122 /**
29123  * Frees the buffer pointed to by `data` if `datalen` is non-0.
29124  */
29125 void CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_free(struct LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ _res);
29126
29127 /**
29128  * Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ in the success state.
29129  */
29130 struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_ok(struct LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ o);
29131
29132 /**
29133  * Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ in the error state.
29134  */
29135 struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_err(enum LDKIOError e);
29136
29137 /**
29138  * Checks if the given object is currently in the success state
29139  */
29140 bool CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_is_ok(const struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ *NONNULL_PTR o);
29141
29142 /**
29143  * Frees any resources used by the CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ.
29144  */
29145 void CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_free(struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ _res);
29146
29147 /**
29148  * Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ which has the same data as `orig`
29149  * but with all dynamically-allocated buffers duplicated in new buffers.
29150  */
29151 struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone(const struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ *NONNULL_PTR orig);
29152
29153 /**
29154  * Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ in the success state.
29155  */
29156 struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_ok(struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ o);
29157
29158 /**
29159  * Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ in the error state.
29160  */
29161 struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_err(enum LDKIOError e);
29162
29163 /**
29164  * Checks if the given object is currently in the success state
29165  */
29166 bool CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_is_ok(const struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ *NONNULL_PTR o);
29167
29168 /**
29169  * Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ.
29170  */
29171 void CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_free(struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ _res);
29172
29173 /**
29174  * Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ which has the same data as `orig`
29175  * but with all dynamically-allocated buffers duplicated in new buffers.
29176  */
29177 struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone(const struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ *NONNULL_PTR orig);
29178
29179 /**
29180  * Creates a new CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ in the success state.
29181  */
29182 struct LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_ok(struct LDKUnsignedInvoiceRequest o);
29183
29184 /**
29185  * Creates a new CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ in the error state.
29186  */
29187 struct LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_err(enum LDKBolt12SemanticError e);
29188
29189 /**
29190  * Checks if the given object is currently in the success state
29191  */
29192 bool CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_is_ok(const struct LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ *NONNULL_PTR o);
29193
29194 /**
29195  * Frees any resources used by the CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ.
29196  */
29197 void CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_free(struct LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ _res);
29198
29199 /**
29200  * Creates a new CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ which has the same data as `orig`
29201  * but with all dynamically-allocated buffers duplicated in new buffers.
29202  */
29203 struct LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_clone(const struct LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ *NONNULL_PTR orig);
29204
29205 /**
29206  * Creates a new CResult_InvoiceRequestBolt12SemanticErrorZ in the success state.
29207  */
29208 struct LDKCResult_InvoiceRequestBolt12SemanticErrorZ CResult_InvoiceRequestBolt12SemanticErrorZ_ok(struct LDKInvoiceRequest o);
29209
29210 /**
29211  * Creates a new CResult_InvoiceRequestBolt12SemanticErrorZ in the error state.
29212  */
29213 struct LDKCResult_InvoiceRequestBolt12SemanticErrorZ CResult_InvoiceRequestBolt12SemanticErrorZ_err(enum LDKBolt12SemanticError e);
29214
29215 /**
29216  * Checks if the given object is currently in the success state
29217  */
29218 bool CResult_InvoiceRequestBolt12SemanticErrorZ_is_ok(const struct LDKCResult_InvoiceRequestBolt12SemanticErrorZ *NONNULL_PTR o);
29219
29220 /**
29221  * Frees any resources used by the CResult_InvoiceRequestBolt12SemanticErrorZ.
29222  */
29223 void CResult_InvoiceRequestBolt12SemanticErrorZ_free(struct LDKCResult_InvoiceRequestBolt12SemanticErrorZ _res);
29224
29225 /**
29226  * Creates a new CResult_InvoiceRequestBolt12SemanticErrorZ which has the same data as `orig`
29227  * but with all dynamically-allocated buffers duplicated in new buffers.
29228  */
29229 struct LDKCResult_InvoiceRequestBolt12SemanticErrorZ CResult_InvoiceRequestBolt12SemanticErrorZ_clone(const struct LDKCResult_InvoiceRequestBolt12SemanticErrorZ *NONNULL_PTR orig);
29230
29231 /**
29232  * Constructs a new COption_SecretKeyZ containing a crate::c_types::SecretKey
29233  */
29234 struct LDKCOption_SecretKeyZ COption_SecretKeyZ_some(struct LDKSecretKey o);
29235
29236 /**
29237  * Constructs a new COption_SecretKeyZ containing nothing
29238  */
29239 struct LDKCOption_SecretKeyZ COption_SecretKeyZ_none(void);
29240
29241 /**
29242  * Frees any resources associated with the crate::c_types::SecretKey, if we are in the Some state
29243  */
29244 void COption_SecretKeyZ_free(struct LDKCOption_SecretKeyZ _res);
29245
29246 /**
29247  * Creates a new COption_SecretKeyZ which has the same data as `orig`
29248  * but with all dynamically-allocated buffers duplicated in new buffers.
29249  */
29250 struct LDKCOption_SecretKeyZ COption_SecretKeyZ_clone(const struct LDKCOption_SecretKeyZ *NONNULL_PTR orig);
29251
29252 /**
29253  * Creates a new CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ in the success state.
29254  */
29255 struct LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_ok(struct LDKInvoiceWithExplicitSigningPubkeyBuilder o);
29256
29257 /**
29258  * Creates a new CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ in the error state.
29259  */
29260 struct LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_err(enum LDKBolt12SemanticError e);
29261
29262 /**
29263  * Checks if the given object is currently in the success state
29264  */
29265 bool CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_is_ok(const struct LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ *NONNULL_PTR o);
29266
29267 /**
29268  * Frees any resources used by the CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ.
29269  */
29270 void CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_free(struct LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ _res);
29271
29272 /**
29273  * Creates a new CResult_VerifiedInvoiceRequestNoneZ in the success state.
29274  */
29275 struct LDKCResult_VerifiedInvoiceRequestNoneZ CResult_VerifiedInvoiceRequestNoneZ_ok(struct LDKVerifiedInvoiceRequest o);
29276
29277 /**
29278  * Creates a new CResult_VerifiedInvoiceRequestNoneZ in the error state.
29279  */
29280 struct LDKCResult_VerifiedInvoiceRequestNoneZ CResult_VerifiedInvoiceRequestNoneZ_err(void);
29281
29282 /**
29283  * Checks if the given object is currently in the success state
29284  */
29285 bool CResult_VerifiedInvoiceRequestNoneZ_is_ok(const struct LDKCResult_VerifiedInvoiceRequestNoneZ *NONNULL_PTR o);
29286
29287 /**
29288  * Frees any resources used by the CResult_VerifiedInvoiceRequestNoneZ.
29289  */
29290 void CResult_VerifiedInvoiceRequestNoneZ_free(struct LDKCResult_VerifiedInvoiceRequestNoneZ _res);
29291
29292 /**
29293  * Creates a new CResult_VerifiedInvoiceRequestNoneZ which has the same data as `orig`
29294  * but with all dynamically-allocated buffers duplicated in new buffers.
29295  */
29296 struct LDKCResult_VerifiedInvoiceRequestNoneZ CResult_VerifiedInvoiceRequestNoneZ_clone(const struct LDKCResult_VerifiedInvoiceRequestNoneZ *NONNULL_PTR orig);
29297
29298 /**
29299  * Creates a new CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ in the success state.
29300  */
29301 struct LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_ok(struct LDKInvoiceWithDerivedSigningPubkeyBuilder o);
29302
29303 /**
29304  * Creates a new CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ in the error state.
29305  */
29306 struct LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_err(enum LDKBolt12SemanticError e);
29307
29308 /**
29309  * Checks if the given object is currently in the success state
29310  */
29311 bool CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_is_ok(const struct LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ *NONNULL_PTR o);
29312
29313 /**
29314  * Frees any resources used by the CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ.
29315  */
29316 void CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_free(struct LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ _res);
29317
29318 /**
29319  * Creates a new CResult_InvoiceRequestFieldsDecodeErrorZ in the success state.
29320  */
29321 struct LDKCResult_InvoiceRequestFieldsDecodeErrorZ CResult_InvoiceRequestFieldsDecodeErrorZ_ok(struct LDKInvoiceRequestFields o);
29322
29323 /**
29324  * Creates a new CResult_InvoiceRequestFieldsDecodeErrorZ in the error state.
29325  */
29326 struct LDKCResult_InvoiceRequestFieldsDecodeErrorZ CResult_InvoiceRequestFieldsDecodeErrorZ_err(struct LDKDecodeError e);
29327
29328 /**
29329  * Checks if the given object is currently in the success state
29330  */
29331 bool CResult_InvoiceRequestFieldsDecodeErrorZ_is_ok(const struct LDKCResult_InvoiceRequestFieldsDecodeErrorZ *NONNULL_PTR o);
29332
29333 /**
29334  * Frees any resources used by the CResult_InvoiceRequestFieldsDecodeErrorZ.
29335  */
29336 void CResult_InvoiceRequestFieldsDecodeErrorZ_free(struct LDKCResult_InvoiceRequestFieldsDecodeErrorZ _res);
29337
29338 /**
29339  * Creates a new CResult_InvoiceRequestFieldsDecodeErrorZ which has the same data as `orig`
29340  * but with all dynamically-allocated buffers duplicated in new buffers.
29341  */
29342 struct LDKCResult_InvoiceRequestFieldsDecodeErrorZ CResult_InvoiceRequestFieldsDecodeErrorZ_clone(const struct LDKCResult_InvoiceRequestFieldsDecodeErrorZ *NONNULL_PTR orig);
29343
29344 /**
29345  * Constructs a new COption_NoneZ containing a
29346  */
29347 enum LDKCOption_NoneZ COption_NoneZ_some(void);
29348
29349 /**
29350  * Constructs a new COption_NoneZ containing nothing
29351  */
29352 enum LDKCOption_NoneZ COption_NoneZ_none(void);
29353
29354 /**
29355  * Frees any resources associated with the , if we are in the Some state
29356  */
29357 void COption_NoneZ_free(enum LDKCOption_NoneZ _res);
29358
29359 /**
29360  * Frees the buffer pointed to by `data` if `datalen` is non-0.
29361  */
29362 void CVec_WitnessZ_free(struct LDKCVec_WitnessZ _res);
29363
29364 /**
29365  * Constructs a new COption_ECDSASignatureZ containing a crate::c_types::ECDSASignature
29366  */
29367 struct LDKCOption_ECDSASignatureZ COption_ECDSASignatureZ_some(struct LDKECDSASignature o);
29368
29369 /**
29370  * Constructs a new COption_ECDSASignatureZ containing nothing
29371  */
29372 struct LDKCOption_ECDSASignatureZ COption_ECDSASignatureZ_none(void);
29373
29374 /**
29375  * Frees any resources associated with the crate::c_types::ECDSASignature, if we are in the Some state
29376  */
29377 void COption_ECDSASignatureZ_free(struct LDKCOption_ECDSASignatureZ _res);
29378
29379 /**
29380  * Creates a new COption_ECDSASignatureZ which has the same data as `orig`
29381  * but with all dynamically-allocated buffers duplicated in new buffers.
29382  */
29383 struct LDKCOption_ECDSASignatureZ COption_ECDSASignatureZ_clone(const struct LDKCOption_ECDSASignatureZ *NONNULL_PTR orig);
29384
29385 /**
29386  * Constructs a new COption_i64Z containing a i64
29387  */
29388 struct LDKCOption_i64Z COption_i64Z_some(int64_t o);
29389
29390 /**
29391  * Constructs a new COption_i64Z containing nothing
29392  */
29393 struct LDKCOption_i64Z COption_i64Z_none(void);
29394
29395 /**
29396  * Frees any resources associated with the i64, if we are in the Some state
29397  */
29398 void COption_i64Z_free(struct LDKCOption_i64Z _res);
29399
29400 /**
29401  * Creates a new COption_i64Z which has the same data as `orig`
29402  * but with all dynamically-allocated buffers duplicated in new buffers.
29403  */
29404 struct LDKCOption_i64Z COption_i64Z_clone(const struct LDKCOption_i64Z *NONNULL_PTR orig);
29405
29406 /**
29407  * Creates a new CResult_SocketAddressDecodeErrorZ in the success state.
29408  */
29409 struct LDKCResult_SocketAddressDecodeErrorZ CResult_SocketAddressDecodeErrorZ_ok(struct LDKSocketAddress o);
29410
29411 /**
29412  * Creates a new CResult_SocketAddressDecodeErrorZ in the error state.
29413  */
29414 struct LDKCResult_SocketAddressDecodeErrorZ CResult_SocketAddressDecodeErrorZ_err(struct LDKDecodeError e);
29415
29416 /**
29417  * Checks if the given object is currently in the success state
29418  */
29419 bool CResult_SocketAddressDecodeErrorZ_is_ok(const struct LDKCResult_SocketAddressDecodeErrorZ *NONNULL_PTR o);
29420
29421 /**
29422  * Frees any resources used by the CResult_SocketAddressDecodeErrorZ.
29423  */
29424 void CResult_SocketAddressDecodeErrorZ_free(struct LDKCResult_SocketAddressDecodeErrorZ _res);
29425
29426 /**
29427  * Creates a new CResult_SocketAddressDecodeErrorZ which has the same data as `orig`
29428  * but with all dynamically-allocated buffers duplicated in new buffers.
29429  */
29430 struct LDKCResult_SocketAddressDecodeErrorZ CResult_SocketAddressDecodeErrorZ_clone(const struct LDKCResult_SocketAddressDecodeErrorZ *NONNULL_PTR orig);
29431
29432 /**
29433  * Creates a new CResult_SocketAddressSocketAddressParseErrorZ in the success state.
29434  */
29435 struct LDKCResult_SocketAddressSocketAddressParseErrorZ CResult_SocketAddressSocketAddressParseErrorZ_ok(struct LDKSocketAddress o);
29436
29437 /**
29438  * Creates a new CResult_SocketAddressSocketAddressParseErrorZ in the error state.
29439  */
29440 struct LDKCResult_SocketAddressSocketAddressParseErrorZ CResult_SocketAddressSocketAddressParseErrorZ_err(enum LDKSocketAddressParseError e);
29441
29442 /**
29443  * Checks if the given object is currently in the success state
29444  */
29445 bool CResult_SocketAddressSocketAddressParseErrorZ_is_ok(const struct LDKCResult_SocketAddressSocketAddressParseErrorZ *NONNULL_PTR o);
29446
29447 /**
29448  * Frees any resources used by the CResult_SocketAddressSocketAddressParseErrorZ.
29449  */
29450 void CResult_SocketAddressSocketAddressParseErrorZ_free(struct LDKCResult_SocketAddressSocketAddressParseErrorZ _res);
29451
29452 /**
29453  * Creates a new CResult_SocketAddressSocketAddressParseErrorZ which has the same data as `orig`
29454  * but with all dynamically-allocated buffers duplicated in new buffers.
29455  */
29456 struct LDKCResult_SocketAddressSocketAddressParseErrorZ CResult_SocketAddressSocketAddressParseErrorZ_clone(const struct LDKCResult_SocketAddressSocketAddressParseErrorZ *NONNULL_PTR orig);
29457
29458 /**
29459  * Frees the buffer pointed to by `data` if `datalen` is non-0.
29460  */
29461 void CVec_UpdateAddHTLCZ_free(struct LDKCVec_UpdateAddHTLCZ _res);
29462
29463 /**
29464  * Frees the buffer pointed to by `data` if `datalen` is non-0.
29465  */
29466 void CVec_UpdateFulfillHTLCZ_free(struct LDKCVec_UpdateFulfillHTLCZ _res);
29467
29468 /**
29469  * Frees the buffer pointed to by `data` if `datalen` is non-0.
29470  */
29471 void CVec_UpdateFailHTLCZ_free(struct LDKCVec_UpdateFailHTLCZ _res);
29472
29473 /**
29474  * Frees the buffer pointed to by `data` if `datalen` is non-0.
29475  */
29476 void CVec_UpdateFailMalformedHTLCZ_free(struct LDKCVec_UpdateFailMalformedHTLCZ _res);
29477
29478 /**
29479  * Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
29480  */
29481 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_ok(struct LDKAcceptChannel o);
29482
29483 /**
29484  * Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
29485  */
29486 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_err(struct LDKDecodeError e);
29487
29488 /**
29489  * Checks if the given object is currently in the success state
29490  */
29491 bool CResult_AcceptChannelDecodeErrorZ_is_ok(const struct LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR o);
29492
29493 /**
29494  * Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
29495  */
29496 void CResult_AcceptChannelDecodeErrorZ_free(struct LDKCResult_AcceptChannelDecodeErrorZ _res);
29497
29498 /**
29499  * Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
29500  * but with all dynamically-allocated buffers duplicated in new buffers.
29501  */
29502 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_clone(const struct LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR orig);
29503
29504 /**
29505  * Creates a new CResult_AcceptChannelV2DecodeErrorZ in the success state.
29506  */
29507 struct LDKCResult_AcceptChannelV2DecodeErrorZ CResult_AcceptChannelV2DecodeErrorZ_ok(struct LDKAcceptChannelV2 o);
29508
29509 /**
29510  * Creates a new CResult_AcceptChannelV2DecodeErrorZ in the error state.
29511  */
29512 struct LDKCResult_AcceptChannelV2DecodeErrorZ CResult_AcceptChannelV2DecodeErrorZ_err(struct LDKDecodeError e);
29513
29514 /**
29515  * Checks if the given object is currently in the success state
29516  */
29517 bool CResult_AcceptChannelV2DecodeErrorZ_is_ok(const struct LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR o);
29518
29519 /**
29520  * Frees any resources used by the CResult_AcceptChannelV2DecodeErrorZ.
29521  */
29522 void CResult_AcceptChannelV2DecodeErrorZ_free(struct LDKCResult_AcceptChannelV2DecodeErrorZ _res);
29523
29524 /**
29525  * Creates a new CResult_AcceptChannelV2DecodeErrorZ which has the same data as `orig`
29526  * but with all dynamically-allocated buffers duplicated in new buffers.
29527  */
29528 struct LDKCResult_AcceptChannelV2DecodeErrorZ CResult_AcceptChannelV2DecodeErrorZ_clone(const struct LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR orig);
29529
29530 /**
29531  * Creates a new CResult_StfuDecodeErrorZ in the success state.
29532  */
29533 struct LDKCResult_StfuDecodeErrorZ CResult_StfuDecodeErrorZ_ok(struct LDKStfu o);
29534
29535 /**
29536  * Creates a new CResult_StfuDecodeErrorZ in the error state.
29537  */
29538 struct LDKCResult_StfuDecodeErrorZ CResult_StfuDecodeErrorZ_err(struct LDKDecodeError e);
29539
29540 /**
29541  * Checks if the given object is currently in the success state
29542  */
29543 bool CResult_StfuDecodeErrorZ_is_ok(const struct LDKCResult_StfuDecodeErrorZ *NONNULL_PTR o);
29544
29545 /**
29546  * Frees any resources used by the CResult_StfuDecodeErrorZ.
29547  */
29548 void CResult_StfuDecodeErrorZ_free(struct LDKCResult_StfuDecodeErrorZ _res);
29549
29550 /**
29551  * Creates a new CResult_StfuDecodeErrorZ which has the same data as `orig`
29552  * but with all dynamically-allocated buffers duplicated in new buffers.
29553  */
29554 struct LDKCResult_StfuDecodeErrorZ CResult_StfuDecodeErrorZ_clone(const struct LDKCResult_StfuDecodeErrorZ *NONNULL_PTR orig);
29555
29556 /**
29557  * Creates a new CResult_SpliceDecodeErrorZ in the success state.
29558  */
29559 struct LDKCResult_SpliceDecodeErrorZ CResult_SpliceDecodeErrorZ_ok(struct LDKSplice o);
29560
29561 /**
29562  * Creates a new CResult_SpliceDecodeErrorZ in the error state.
29563  */
29564 struct LDKCResult_SpliceDecodeErrorZ CResult_SpliceDecodeErrorZ_err(struct LDKDecodeError e);
29565
29566 /**
29567  * Checks if the given object is currently in the success state
29568  */
29569 bool CResult_SpliceDecodeErrorZ_is_ok(const struct LDKCResult_SpliceDecodeErrorZ *NONNULL_PTR o);
29570
29571 /**
29572  * Frees any resources used by the CResult_SpliceDecodeErrorZ.
29573  */
29574 void CResult_SpliceDecodeErrorZ_free(struct LDKCResult_SpliceDecodeErrorZ _res);
29575
29576 /**
29577  * Creates a new CResult_SpliceDecodeErrorZ which has the same data as `orig`
29578  * but with all dynamically-allocated buffers duplicated in new buffers.
29579  */
29580 struct LDKCResult_SpliceDecodeErrorZ CResult_SpliceDecodeErrorZ_clone(const struct LDKCResult_SpliceDecodeErrorZ *NONNULL_PTR orig);
29581
29582 /**
29583  * Creates a new CResult_SpliceAckDecodeErrorZ in the success state.
29584  */
29585 struct LDKCResult_SpliceAckDecodeErrorZ CResult_SpliceAckDecodeErrorZ_ok(struct LDKSpliceAck o);
29586
29587 /**
29588  * Creates a new CResult_SpliceAckDecodeErrorZ in the error state.
29589  */
29590 struct LDKCResult_SpliceAckDecodeErrorZ CResult_SpliceAckDecodeErrorZ_err(struct LDKDecodeError e);
29591
29592 /**
29593  * Checks if the given object is currently in the success state
29594  */
29595 bool CResult_SpliceAckDecodeErrorZ_is_ok(const struct LDKCResult_SpliceAckDecodeErrorZ *NONNULL_PTR o);
29596
29597 /**
29598  * Frees any resources used by the CResult_SpliceAckDecodeErrorZ.
29599  */
29600 void CResult_SpliceAckDecodeErrorZ_free(struct LDKCResult_SpliceAckDecodeErrorZ _res);
29601
29602 /**
29603  * Creates a new CResult_SpliceAckDecodeErrorZ which has the same data as `orig`
29604  * but with all dynamically-allocated buffers duplicated in new buffers.
29605  */
29606 struct LDKCResult_SpliceAckDecodeErrorZ CResult_SpliceAckDecodeErrorZ_clone(const struct LDKCResult_SpliceAckDecodeErrorZ *NONNULL_PTR orig);
29607
29608 /**
29609  * Creates a new CResult_SpliceLockedDecodeErrorZ in the success state.
29610  */
29611 struct LDKCResult_SpliceLockedDecodeErrorZ CResult_SpliceLockedDecodeErrorZ_ok(struct LDKSpliceLocked o);
29612
29613 /**
29614  * Creates a new CResult_SpliceLockedDecodeErrorZ in the error state.
29615  */
29616 struct LDKCResult_SpliceLockedDecodeErrorZ CResult_SpliceLockedDecodeErrorZ_err(struct LDKDecodeError e);
29617
29618 /**
29619  * Checks if the given object is currently in the success state
29620  */
29621 bool CResult_SpliceLockedDecodeErrorZ_is_ok(const struct LDKCResult_SpliceLockedDecodeErrorZ *NONNULL_PTR o);
29622
29623 /**
29624  * Frees any resources used by the CResult_SpliceLockedDecodeErrorZ.
29625  */
29626 void CResult_SpliceLockedDecodeErrorZ_free(struct LDKCResult_SpliceLockedDecodeErrorZ _res);
29627
29628 /**
29629  * Creates a new CResult_SpliceLockedDecodeErrorZ which has the same data as `orig`
29630  * but with all dynamically-allocated buffers duplicated in new buffers.
29631  */
29632 struct LDKCResult_SpliceLockedDecodeErrorZ CResult_SpliceLockedDecodeErrorZ_clone(const struct LDKCResult_SpliceLockedDecodeErrorZ *NONNULL_PTR orig);
29633
29634 /**
29635  * Creates a new CResult_TxAddInputDecodeErrorZ in the success state.
29636  */
29637 struct LDKCResult_TxAddInputDecodeErrorZ CResult_TxAddInputDecodeErrorZ_ok(struct LDKTxAddInput o);
29638
29639 /**
29640  * Creates a new CResult_TxAddInputDecodeErrorZ in the error state.
29641  */
29642 struct LDKCResult_TxAddInputDecodeErrorZ CResult_TxAddInputDecodeErrorZ_err(struct LDKDecodeError e);
29643
29644 /**
29645  * Checks if the given object is currently in the success state
29646  */
29647 bool CResult_TxAddInputDecodeErrorZ_is_ok(const struct LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR o);
29648
29649 /**
29650  * Frees any resources used by the CResult_TxAddInputDecodeErrorZ.
29651  */
29652 void CResult_TxAddInputDecodeErrorZ_free(struct LDKCResult_TxAddInputDecodeErrorZ _res);
29653
29654 /**
29655  * Creates a new CResult_TxAddInputDecodeErrorZ which has the same data as `orig`
29656  * but with all dynamically-allocated buffers duplicated in new buffers.
29657  */
29658 struct LDKCResult_TxAddInputDecodeErrorZ CResult_TxAddInputDecodeErrorZ_clone(const struct LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR orig);
29659
29660 /**
29661  * Creates a new CResult_TxAddOutputDecodeErrorZ in the success state.
29662  */
29663 struct LDKCResult_TxAddOutputDecodeErrorZ CResult_TxAddOutputDecodeErrorZ_ok(struct LDKTxAddOutput o);
29664
29665 /**
29666  * Creates a new CResult_TxAddOutputDecodeErrorZ in the error state.
29667  */
29668 struct LDKCResult_TxAddOutputDecodeErrorZ CResult_TxAddOutputDecodeErrorZ_err(struct LDKDecodeError e);
29669
29670 /**
29671  * Checks if the given object is currently in the success state
29672  */
29673 bool CResult_TxAddOutputDecodeErrorZ_is_ok(const struct LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR o);
29674
29675 /**
29676  * Frees any resources used by the CResult_TxAddOutputDecodeErrorZ.
29677  */
29678 void CResult_TxAddOutputDecodeErrorZ_free(struct LDKCResult_TxAddOutputDecodeErrorZ _res);
29679
29680 /**
29681  * Creates a new CResult_TxAddOutputDecodeErrorZ which has the same data as `orig`
29682  * but with all dynamically-allocated buffers duplicated in new buffers.
29683  */
29684 struct LDKCResult_TxAddOutputDecodeErrorZ CResult_TxAddOutputDecodeErrorZ_clone(const struct LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR orig);
29685
29686 /**
29687  * Creates a new CResult_TxRemoveInputDecodeErrorZ in the success state.
29688  */
29689 struct LDKCResult_TxRemoveInputDecodeErrorZ CResult_TxRemoveInputDecodeErrorZ_ok(struct LDKTxRemoveInput o);
29690
29691 /**
29692  * Creates a new CResult_TxRemoveInputDecodeErrorZ in the error state.
29693  */
29694 struct LDKCResult_TxRemoveInputDecodeErrorZ CResult_TxRemoveInputDecodeErrorZ_err(struct LDKDecodeError e);
29695
29696 /**
29697  * Checks if the given object is currently in the success state
29698  */
29699 bool CResult_TxRemoveInputDecodeErrorZ_is_ok(const struct LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR o);
29700
29701 /**
29702  * Frees any resources used by the CResult_TxRemoveInputDecodeErrorZ.
29703  */
29704 void CResult_TxRemoveInputDecodeErrorZ_free(struct LDKCResult_TxRemoveInputDecodeErrorZ _res);
29705
29706 /**
29707  * Creates a new CResult_TxRemoveInputDecodeErrorZ which has the same data as `orig`
29708  * but with all dynamically-allocated buffers duplicated in new buffers.
29709  */
29710 struct LDKCResult_TxRemoveInputDecodeErrorZ CResult_TxRemoveInputDecodeErrorZ_clone(const struct LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR orig);
29711
29712 /**
29713  * Creates a new CResult_TxRemoveOutputDecodeErrorZ in the success state.
29714  */
29715 struct LDKCResult_TxRemoveOutputDecodeErrorZ CResult_TxRemoveOutputDecodeErrorZ_ok(struct LDKTxRemoveOutput o);
29716
29717 /**
29718  * Creates a new CResult_TxRemoveOutputDecodeErrorZ in the error state.
29719  */
29720 struct LDKCResult_TxRemoveOutputDecodeErrorZ CResult_TxRemoveOutputDecodeErrorZ_err(struct LDKDecodeError e);
29721
29722 /**
29723  * Checks if the given object is currently in the success state
29724  */
29725 bool CResult_TxRemoveOutputDecodeErrorZ_is_ok(const struct LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR o);
29726
29727 /**
29728  * Frees any resources used by the CResult_TxRemoveOutputDecodeErrorZ.
29729  */
29730 void CResult_TxRemoveOutputDecodeErrorZ_free(struct LDKCResult_TxRemoveOutputDecodeErrorZ _res);
29731
29732 /**
29733  * Creates a new CResult_TxRemoveOutputDecodeErrorZ which has the same data as `orig`
29734  * but with all dynamically-allocated buffers duplicated in new buffers.
29735  */
29736 struct LDKCResult_TxRemoveOutputDecodeErrorZ CResult_TxRemoveOutputDecodeErrorZ_clone(const struct LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR orig);
29737
29738 /**
29739  * Creates a new CResult_TxCompleteDecodeErrorZ in the success state.
29740  */
29741 struct LDKCResult_TxCompleteDecodeErrorZ CResult_TxCompleteDecodeErrorZ_ok(struct LDKTxComplete o);
29742
29743 /**
29744  * Creates a new CResult_TxCompleteDecodeErrorZ in the error state.
29745  */
29746 struct LDKCResult_TxCompleteDecodeErrorZ CResult_TxCompleteDecodeErrorZ_err(struct LDKDecodeError e);
29747
29748 /**
29749  * Checks if the given object is currently in the success state
29750  */
29751 bool CResult_TxCompleteDecodeErrorZ_is_ok(const struct LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR o);
29752
29753 /**
29754  * Frees any resources used by the CResult_TxCompleteDecodeErrorZ.
29755  */
29756 void CResult_TxCompleteDecodeErrorZ_free(struct LDKCResult_TxCompleteDecodeErrorZ _res);
29757
29758 /**
29759  * Creates a new CResult_TxCompleteDecodeErrorZ which has the same data as `orig`
29760  * but with all dynamically-allocated buffers duplicated in new buffers.
29761  */
29762 struct LDKCResult_TxCompleteDecodeErrorZ CResult_TxCompleteDecodeErrorZ_clone(const struct LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR orig);
29763
29764 /**
29765  * Creates a new CResult_TxSignaturesDecodeErrorZ in the success state.
29766  */
29767 struct LDKCResult_TxSignaturesDecodeErrorZ CResult_TxSignaturesDecodeErrorZ_ok(struct LDKTxSignatures o);
29768
29769 /**
29770  * Creates a new CResult_TxSignaturesDecodeErrorZ in the error state.
29771  */
29772 struct LDKCResult_TxSignaturesDecodeErrorZ CResult_TxSignaturesDecodeErrorZ_err(struct LDKDecodeError e);
29773
29774 /**
29775  * Checks if the given object is currently in the success state
29776  */
29777 bool CResult_TxSignaturesDecodeErrorZ_is_ok(const struct LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR o);
29778
29779 /**
29780  * Frees any resources used by the CResult_TxSignaturesDecodeErrorZ.
29781  */
29782 void CResult_TxSignaturesDecodeErrorZ_free(struct LDKCResult_TxSignaturesDecodeErrorZ _res);
29783
29784 /**
29785  * Creates a new CResult_TxSignaturesDecodeErrorZ which has the same data as `orig`
29786  * but with all dynamically-allocated buffers duplicated in new buffers.
29787  */
29788 struct LDKCResult_TxSignaturesDecodeErrorZ CResult_TxSignaturesDecodeErrorZ_clone(const struct LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR orig);
29789
29790 /**
29791  * Creates a new CResult_TxInitRbfDecodeErrorZ in the success state.
29792  */
29793 struct LDKCResult_TxInitRbfDecodeErrorZ CResult_TxInitRbfDecodeErrorZ_ok(struct LDKTxInitRbf o);
29794
29795 /**
29796  * Creates a new CResult_TxInitRbfDecodeErrorZ in the error state.
29797  */
29798 struct LDKCResult_TxInitRbfDecodeErrorZ CResult_TxInitRbfDecodeErrorZ_err(struct LDKDecodeError e);
29799
29800 /**
29801  * Checks if the given object is currently in the success state
29802  */
29803 bool CResult_TxInitRbfDecodeErrorZ_is_ok(const struct LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR o);
29804
29805 /**
29806  * Frees any resources used by the CResult_TxInitRbfDecodeErrorZ.
29807  */
29808 void CResult_TxInitRbfDecodeErrorZ_free(struct LDKCResult_TxInitRbfDecodeErrorZ _res);
29809
29810 /**
29811  * Creates a new CResult_TxInitRbfDecodeErrorZ which has the same data as `orig`
29812  * but with all dynamically-allocated buffers duplicated in new buffers.
29813  */
29814 struct LDKCResult_TxInitRbfDecodeErrorZ CResult_TxInitRbfDecodeErrorZ_clone(const struct LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR orig);
29815
29816 /**
29817  * Creates a new CResult_TxAckRbfDecodeErrorZ in the success state.
29818  */
29819 struct LDKCResult_TxAckRbfDecodeErrorZ CResult_TxAckRbfDecodeErrorZ_ok(struct LDKTxAckRbf o);
29820
29821 /**
29822  * Creates a new CResult_TxAckRbfDecodeErrorZ in the error state.
29823  */
29824 struct LDKCResult_TxAckRbfDecodeErrorZ CResult_TxAckRbfDecodeErrorZ_err(struct LDKDecodeError e);
29825
29826 /**
29827  * Checks if the given object is currently in the success state
29828  */
29829 bool CResult_TxAckRbfDecodeErrorZ_is_ok(const struct LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR o);
29830
29831 /**
29832  * Frees any resources used by the CResult_TxAckRbfDecodeErrorZ.
29833  */
29834 void CResult_TxAckRbfDecodeErrorZ_free(struct LDKCResult_TxAckRbfDecodeErrorZ _res);
29835
29836 /**
29837  * Creates a new CResult_TxAckRbfDecodeErrorZ which has the same data as `orig`
29838  * but with all dynamically-allocated buffers duplicated in new buffers.
29839  */
29840 struct LDKCResult_TxAckRbfDecodeErrorZ CResult_TxAckRbfDecodeErrorZ_clone(const struct LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR orig);
29841
29842 /**
29843  * Creates a new CResult_TxAbortDecodeErrorZ in the success state.
29844  */
29845 struct LDKCResult_TxAbortDecodeErrorZ CResult_TxAbortDecodeErrorZ_ok(struct LDKTxAbort o);
29846
29847 /**
29848  * Creates a new CResult_TxAbortDecodeErrorZ in the error state.
29849  */
29850 struct LDKCResult_TxAbortDecodeErrorZ CResult_TxAbortDecodeErrorZ_err(struct LDKDecodeError e);
29851
29852 /**
29853  * Checks if the given object is currently in the success state
29854  */
29855 bool CResult_TxAbortDecodeErrorZ_is_ok(const struct LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR o);
29856
29857 /**
29858  * Frees any resources used by the CResult_TxAbortDecodeErrorZ.
29859  */
29860 void CResult_TxAbortDecodeErrorZ_free(struct LDKCResult_TxAbortDecodeErrorZ _res);
29861
29862 /**
29863  * Creates a new CResult_TxAbortDecodeErrorZ which has the same data as `orig`
29864  * but with all dynamically-allocated buffers duplicated in new buffers.
29865  */
29866 struct LDKCResult_TxAbortDecodeErrorZ CResult_TxAbortDecodeErrorZ_clone(const struct LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR orig);
29867
29868 /**
29869  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
29870  */
29871 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_ok(struct LDKAnnouncementSignatures o);
29872
29873 /**
29874  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
29875  */
29876 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_err(struct LDKDecodeError e);
29877
29878 /**
29879  * Checks if the given object is currently in the success state
29880  */
29881 bool CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(const struct LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR o);
29882
29883 /**
29884  * Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
29885  */
29886 void CResult_AnnouncementSignaturesDecodeErrorZ_free(struct LDKCResult_AnnouncementSignaturesDecodeErrorZ _res);
29887
29888 /**
29889  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
29890  * but with all dynamically-allocated buffers duplicated in new buffers.
29891  */
29892 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_clone(const struct LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR orig);
29893
29894 /**
29895  * Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
29896  */
29897 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_ok(struct LDKChannelReestablish o);
29898
29899 /**
29900  * Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
29901  */
29902 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_err(struct LDKDecodeError e);
29903
29904 /**
29905  * Checks if the given object is currently in the success state
29906  */
29907 bool CResult_ChannelReestablishDecodeErrorZ_is_ok(const struct LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR o);
29908
29909 /**
29910  * Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
29911  */
29912 void CResult_ChannelReestablishDecodeErrorZ_free(struct LDKCResult_ChannelReestablishDecodeErrorZ _res);
29913
29914 /**
29915  * Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
29916  * but with all dynamically-allocated buffers duplicated in new buffers.
29917  */
29918 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_clone(const struct LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR orig);
29919
29920 /**
29921  * Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
29922  */
29923 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_ok(struct LDKClosingSigned o);
29924
29925 /**
29926  * Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
29927  */
29928 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_err(struct LDKDecodeError e);
29929
29930 /**
29931  * Checks if the given object is currently in the success state
29932  */
29933 bool CResult_ClosingSignedDecodeErrorZ_is_ok(const struct LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR o);
29934
29935 /**
29936  * Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
29937  */
29938 void CResult_ClosingSignedDecodeErrorZ_free(struct LDKCResult_ClosingSignedDecodeErrorZ _res);
29939
29940 /**
29941  * Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
29942  * but with all dynamically-allocated buffers duplicated in new buffers.
29943  */
29944 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_clone(const struct LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR orig);
29945
29946 /**
29947  * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state.
29948  */
29949 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(struct LDKClosingSignedFeeRange o);
29950
29951 /**
29952  * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state.
29953  */
29954 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_err(struct LDKDecodeError e);
29955
29956 /**
29957  * Checks if the given object is currently in the success state
29958  */
29959 bool CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(const struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR o);
29960
29961 /**
29962  * Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ.
29963  */
29964 void CResult_ClosingSignedFeeRangeDecodeErrorZ_free(struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res);
29965
29966 /**
29967  * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig`
29968  * but with all dynamically-allocated buffers duplicated in new buffers.
29969  */
29970 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(const struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR orig);
29971
29972 /**
29973  * Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
29974  */
29975 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_ok(struct LDKCommitmentSigned o);
29976
29977 /**
29978  * Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
29979  */
29980 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_err(struct LDKDecodeError e);
29981
29982 /**
29983  * Checks if the given object is currently in the success state
29984  */
29985 bool CResult_CommitmentSignedDecodeErrorZ_is_ok(const struct LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR o);
29986
29987 /**
29988  * Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
29989  */
29990 void CResult_CommitmentSignedDecodeErrorZ_free(struct LDKCResult_CommitmentSignedDecodeErrorZ _res);
29991
29992 /**
29993  * Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
29994  * but with all dynamically-allocated buffers duplicated in new buffers.
29995  */
29996 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_clone(const struct LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR orig);
29997
29998 /**
29999  * Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
30000  */
30001 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_ok(struct LDKFundingCreated o);
30002
30003 /**
30004  * Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
30005  */
30006 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_err(struct LDKDecodeError e);
30007
30008 /**
30009  * Checks if the given object is currently in the success state
30010  */
30011 bool CResult_FundingCreatedDecodeErrorZ_is_ok(const struct LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR o);
30012
30013 /**
30014  * Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
30015  */
30016 void CResult_FundingCreatedDecodeErrorZ_free(struct LDKCResult_FundingCreatedDecodeErrorZ _res);
30017
30018 /**
30019  * Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
30020  * but with all dynamically-allocated buffers duplicated in new buffers.
30021  */
30022 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_clone(const struct LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR orig);
30023
30024 /**
30025  * Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
30026  */
30027 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_ok(struct LDKFundingSigned o);
30028
30029 /**
30030  * Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
30031  */
30032 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_err(struct LDKDecodeError e);
30033
30034 /**
30035  * Checks if the given object is currently in the success state
30036  */
30037 bool CResult_FundingSignedDecodeErrorZ_is_ok(const struct LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR o);
30038
30039 /**
30040  * Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
30041  */
30042 void CResult_FundingSignedDecodeErrorZ_free(struct LDKCResult_FundingSignedDecodeErrorZ _res);
30043
30044 /**
30045  * Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
30046  * but with all dynamically-allocated buffers duplicated in new buffers.
30047  */
30048 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_clone(const struct LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR orig);
30049
30050 /**
30051  * Creates a new CResult_ChannelReadyDecodeErrorZ in the success state.
30052  */
30053 struct LDKCResult_ChannelReadyDecodeErrorZ CResult_ChannelReadyDecodeErrorZ_ok(struct LDKChannelReady o);
30054
30055 /**
30056  * Creates a new CResult_ChannelReadyDecodeErrorZ in the error state.
30057  */
30058 struct LDKCResult_ChannelReadyDecodeErrorZ CResult_ChannelReadyDecodeErrorZ_err(struct LDKDecodeError e);
30059
30060 /**
30061  * Checks if the given object is currently in the success state
30062  */
30063 bool CResult_ChannelReadyDecodeErrorZ_is_ok(const struct LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR o);
30064
30065 /**
30066  * Frees any resources used by the CResult_ChannelReadyDecodeErrorZ.
30067  */
30068 void CResult_ChannelReadyDecodeErrorZ_free(struct LDKCResult_ChannelReadyDecodeErrorZ _res);
30069
30070 /**
30071  * Creates a new CResult_ChannelReadyDecodeErrorZ which has the same data as `orig`
30072  * but with all dynamically-allocated buffers duplicated in new buffers.
30073  */
30074 struct LDKCResult_ChannelReadyDecodeErrorZ CResult_ChannelReadyDecodeErrorZ_clone(const struct LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR orig);
30075
30076 /**
30077  * Creates a new CResult_InitDecodeErrorZ in the success state.
30078  */
30079 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_ok(struct LDKInit o);
30080
30081 /**
30082  * Creates a new CResult_InitDecodeErrorZ in the error state.
30083  */
30084 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_err(struct LDKDecodeError e);
30085
30086 /**
30087  * Checks if the given object is currently in the success state
30088  */
30089 bool CResult_InitDecodeErrorZ_is_ok(const struct LDKCResult_InitDecodeErrorZ *NONNULL_PTR o);
30090
30091 /**
30092  * Frees any resources used by the CResult_InitDecodeErrorZ.
30093  */
30094 void CResult_InitDecodeErrorZ_free(struct LDKCResult_InitDecodeErrorZ _res);
30095
30096 /**
30097  * Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
30098  * but with all dynamically-allocated buffers duplicated in new buffers.
30099  */
30100 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_clone(const struct LDKCResult_InitDecodeErrorZ *NONNULL_PTR orig);
30101
30102 /**
30103  * Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
30104  */
30105 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_ok(struct LDKOpenChannel o);
30106
30107 /**
30108  * Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
30109  */
30110 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_err(struct LDKDecodeError e);
30111
30112 /**
30113  * Checks if the given object is currently in the success state
30114  */
30115 bool CResult_OpenChannelDecodeErrorZ_is_ok(const struct LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR o);
30116
30117 /**
30118  * Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
30119  */
30120 void CResult_OpenChannelDecodeErrorZ_free(struct LDKCResult_OpenChannelDecodeErrorZ _res);
30121
30122 /**
30123  * Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
30124  * but with all dynamically-allocated buffers duplicated in new buffers.
30125  */
30126 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_clone(const struct LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR orig);
30127
30128 /**
30129  * Creates a new CResult_OpenChannelV2DecodeErrorZ in the success state.
30130  */
30131 struct LDKCResult_OpenChannelV2DecodeErrorZ CResult_OpenChannelV2DecodeErrorZ_ok(struct LDKOpenChannelV2 o);
30132
30133 /**
30134  * Creates a new CResult_OpenChannelV2DecodeErrorZ in the error state.
30135  */
30136 struct LDKCResult_OpenChannelV2DecodeErrorZ CResult_OpenChannelV2DecodeErrorZ_err(struct LDKDecodeError e);
30137
30138 /**
30139  * Checks if the given object is currently in the success state
30140  */
30141 bool CResult_OpenChannelV2DecodeErrorZ_is_ok(const struct LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR o);
30142
30143 /**
30144  * Frees any resources used by the CResult_OpenChannelV2DecodeErrorZ.
30145  */
30146 void CResult_OpenChannelV2DecodeErrorZ_free(struct LDKCResult_OpenChannelV2DecodeErrorZ _res);
30147
30148 /**
30149  * Creates a new CResult_OpenChannelV2DecodeErrorZ which has the same data as `orig`
30150  * but with all dynamically-allocated buffers duplicated in new buffers.
30151  */
30152 struct LDKCResult_OpenChannelV2DecodeErrorZ CResult_OpenChannelV2DecodeErrorZ_clone(const struct LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR orig);
30153
30154 /**
30155  * Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
30156  */
30157 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_ok(struct LDKRevokeAndACK o);
30158
30159 /**
30160  * Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
30161  */
30162 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_err(struct LDKDecodeError e);
30163
30164 /**
30165  * Checks if the given object is currently in the success state
30166  */
30167 bool CResult_RevokeAndACKDecodeErrorZ_is_ok(const struct LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR o);
30168
30169 /**
30170  * Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
30171  */
30172 void CResult_RevokeAndACKDecodeErrorZ_free(struct LDKCResult_RevokeAndACKDecodeErrorZ _res);
30173
30174 /**
30175  * Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
30176  * but with all dynamically-allocated buffers duplicated in new buffers.
30177  */
30178 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_clone(const struct LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR orig);
30179
30180 /**
30181  * Creates a new CResult_ShutdownDecodeErrorZ in the success state.
30182  */
30183 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_ok(struct LDKShutdown o);
30184
30185 /**
30186  * Creates a new CResult_ShutdownDecodeErrorZ in the error state.
30187  */
30188 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_err(struct LDKDecodeError e);
30189
30190 /**
30191  * Checks if the given object is currently in the success state
30192  */
30193 bool CResult_ShutdownDecodeErrorZ_is_ok(const struct LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR o);
30194
30195 /**
30196  * Frees any resources used by the CResult_ShutdownDecodeErrorZ.
30197  */
30198 void CResult_ShutdownDecodeErrorZ_free(struct LDKCResult_ShutdownDecodeErrorZ _res);
30199
30200 /**
30201  * Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
30202  * but with all dynamically-allocated buffers duplicated in new buffers.
30203  */
30204 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_clone(const struct LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR orig);
30205
30206 /**
30207  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
30208  */
30209 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_ok(struct LDKUpdateFailHTLC o);
30210
30211 /**
30212  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
30213  */
30214 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_err(struct LDKDecodeError e);
30215
30216 /**
30217  * Checks if the given object is currently in the success state
30218  */
30219 bool CResult_UpdateFailHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR o);
30220
30221 /**
30222  * Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
30223  */
30224 void CResult_UpdateFailHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailHTLCDecodeErrorZ _res);
30225
30226 /**
30227  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
30228  * but with all dynamically-allocated buffers duplicated in new buffers.
30229  */
30230 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR orig);
30231
30232 /**
30233  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
30234  */
30235 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(struct LDKUpdateFailMalformedHTLC o);
30236
30237 /**
30238  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
30239  */
30240 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(struct LDKDecodeError e);
30241
30242 /**
30243  * Checks if the given object is currently in the success state
30244  */
30245 bool CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR o);
30246
30247 /**
30248  * Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
30249  */
30250 void CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res);
30251
30252 /**
30253  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
30254  * but with all dynamically-allocated buffers duplicated in new buffers.
30255  */
30256 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR orig);
30257
30258 /**
30259  * Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
30260  */
30261 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_ok(struct LDKUpdateFee o);
30262
30263 /**
30264  * Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
30265  */
30266 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_err(struct LDKDecodeError e);
30267
30268 /**
30269  * Checks if the given object is currently in the success state
30270  */
30271 bool CResult_UpdateFeeDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR o);
30272
30273 /**
30274  * Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
30275  */
30276 void CResult_UpdateFeeDecodeErrorZ_free(struct LDKCResult_UpdateFeeDecodeErrorZ _res);
30277
30278 /**
30279  * Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
30280  * but with all dynamically-allocated buffers duplicated in new buffers.
30281  */
30282 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_clone(const struct LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR orig);
30283
30284 /**
30285  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
30286  */
30287 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_ok(struct LDKUpdateFulfillHTLC o);
30288
30289 /**
30290  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
30291  */
30292 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_err(struct LDKDecodeError e);
30293
30294 /**
30295  * Checks if the given object is currently in the success state
30296  */
30297 bool CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR o);
30298
30299 /**
30300  * Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
30301  */
30302 void CResult_UpdateFulfillHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res);
30303
30304 /**
30305  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
30306  * but with all dynamically-allocated buffers duplicated in new buffers.
30307  */
30308 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR orig);
30309
30310 /**
30311  * Creates a new CResult_OnionPacketDecodeErrorZ in the success state.
30312  */
30313 struct LDKCResult_OnionPacketDecodeErrorZ CResult_OnionPacketDecodeErrorZ_ok(struct LDKOnionPacket o);
30314
30315 /**
30316  * Creates a new CResult_OnionPacketDecodeErrorZ in the error state.
30317  */
30318 struct LDKCResult_OnionPacketDecodeErrorZ CResult_OnionPacketDecodeErrorZ_err(struct LDKDecodeError e);
30319
30320 /**
30321  * Checks if the given object is currently in the success state
30322  */
30323 bool CResult_OnionPacketDecodeErrorZ_is_ok(const struct LDKCResult_OnionPacketDecodeErrorZ *NONNULL_PTR o);
30324
30325 /**
30326  * Frees any resources used by the CResult_OnionPacketDecodeErrorZ.
30327  */
30328 void CResult_OnionPacketDecodeErrorZ_free(struct LDKCResult_OnionPacketDecodeErrorZ _res);
30329
30330 /**
30331  * Creates a new CResult_OnionPacketDecodeErrorZ which has the same data as `orig`
30332  * but with all dynamically-allocated buffers duplicated in new buffers.
30333  */
30334 struct LDKCResult_OnionPacketDecodeErrorZ CResult_OnionPacketDecodeErrorZ_clone(const struct LDKCResult_OnionPacketDecodeErrorZ *NONNULL_PTR orig);
30335
30336 /**
30337  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
30338  */
30339 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_ok(struct LDKUpdateAddHTLC o);
30340
30341 /**
30342  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
30343  */
30344 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_err(struct LDKDecodeError e);
30345
30346 /**
30347  * Checks if the given object is currently in the success state
30348  */
30349 bool CResult_UpdateAddHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR o);
30350
30351 /**
30352  * Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
30353  */
30354 void CResult_UpdateAddHTLCDecodeErrorZ_free(struct LDKCResult_UpdateAddHTLCDecodeErrorZ _res);
30355
30356 /**
30357  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
30358  * but with all dynamically-allocated buffers duplicated in new buffers.
30359  */
30360 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR orig);
30361
30362 /**
30363  * Creates a new CResult_OnionMessageDecodeErrorZ in the success state.
30364  */
30365 struct LDKCResult_OnionMessageDecodeErrorZ CResult_OnionMessageDecodeErrorZ_ok(struct LDKOnionMessage o);
30366
30367 /**
30368  * Creates a new CResult_OnionMessageDecodeErrorZ in the error state.
30369  */
30370 struct LDKCResult_OnionMessageDecodeErrorZ CResult_OnionMessageDecodeErrorZ_err(struct LDKDecodeError e);
30371
30372 /**
30373  * Checks if the given object is currently in the success state
30374  */
30375 bool CResult_OnionMessageDecodeErrorZ_is_ok(const struct LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR o);
30376
30377 /**
30378  * Frees any resources used by the CResult_OnionMessageDecodeErrorZ.
30379  */
30380 void CResult_OnionMessageDecodeErrorZ_free(struct LDKCResult_OnionMessageDecodeErrorZ _res);
30381
30382 /**
30383  * Creates a new CResult_OnionMessageDecodeErrorZ which has the same data as `orig`
30384  * but with all dynamically-allocated buffers duplicated in new buffers.
30385  */
30386 struct LDKCResult_OnionMessageDecodeErrorZ CResult_OnionMessageDecodeErrorZ_clone(const struct LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR orig);
30387
30388 /**
30389  * Creates a new CResult_FinalOnionHopDataDecodeErrorZ in the success state.
30390  */
30391 struct LDKCResult_FinalOnionHopDataDecodeErrorZ CResult_FinalOnionHopDataDecodeErrorZ_ok(struct LDKFinalOnionHopData o);
30392
30393 /**
30394  * Creates a new CResult_FinalOnionHopDataDecodeErrorZ in the error state.
30395  */
30396 struct LDKCResult_FinalOnionHopDataDecodeErrorZ CResult_FinalOnionHopDataDecodeErrorZ_err(struct LDKDecodeError e);
30397
30398 /**
30399  * Checks if the given object is currently in the success state
30400  */
30401 bool CResult_FinalOnionHopDataDecodeErrorZ_is_ok(const struct LDKCResult_FinalOnionHopDataDecodeErrorZ *NONNULL_PTR o);
30402
30403 /**
30404  * Frees any resources used by the CResult_FinalOnionHopDataDecodeErrorZ.
30405  */
30406 void CResult_FinalOnionHopDataDecodeErrorZ_free(struct LDKCResult_FinalOnionHopDataDecodeErrorZ _res);
30407
30408 /**
30409  * Creates a new CResult_FinalOnionHopDataDecodeErrorZ which has the same data as `orig`
30410  * but with all dynamically-allocated buffers duplicated in new buffers.
30411  */
30412 struct LDKCResult_FinalOnionHopDataDecodeErrorZ CResult_FinalOnionHopDataDecodeErrorZ_clone(const struct LDKCResult_FinalOnionHopDataDecodeErrorZ *NONNULL_PTR orig);
30413
30414 /**
30415  * Creates a new CResult_PingDecodeErrorZ in the success state.
30416  */
30417 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_ok(struct LDKPing o);
30418
30419 /**
30420  * Creates a new CResult_PingDecodeErrorZ in the error state.
30421  */
30422 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_err(struct LDKDecodeError e);
30423
30424 /**
30425  * Checks if the given object is currently in the success state
30426  */
30427 bool CResult_PingDecodeErrorZ_is_ok(const struct LDKCResult_PingDecodeErrorZ *NONNULL_PTR o);
30428
30429 /**
30430  * Frees any resources used by the CResult_PingDecodeErrorZ.
30431  */
30432 void CResult_PingDecodeErrorZ_free(struct LDKCResult_PingDecodeErrorZ _res);
30433
30434 /**
30435  * Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
30436  * but with all dynamically-allocated buffers duplicated in new buffers.
30437  */
30438 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_clone(const struct LDKCResult_PingDecodeErrorZ *NONNULL_PTR orig);
30439
30440 /**
30441  * Creates a new CResult_PongDecodeErrorZ in the success state.
30442  */
30443 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_ok(struct LDKPong o);
30444
30445 /**
30446  * Creates a new CResult_PongDecodeErrorZ in the error state.
30447  */
30448 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_err(struct LDKDecodeError e);
30449
30450 /**
30451  * Checks if the given object is currently in the success state
30452  */
30453 bool CResult_PongDecodeErrorZ_is_ok(const struct LDKCResult_PongDecodeErrorZ *NONNULL_PTR o);
30454
30455 /**
30456  * Frees any resources used by the CResult_PongDecodeErrorZ.
30457  */
30458 void CResult_PongDecodeErrorZ_free(struct LDKCResult_PongDecodeErrorZ _res);
30459
30460 /**
30461  * Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
30462  * but with all dynamically-allocated buffers duplicated in new buffers.
30463  */
30464 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_clone(const struct LDKCResult_PongDecodeErrorZ *NONNULL_PTR orig);
30465
30466 /**
30467  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
30468  */
30469 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(struct LDKUnsignedChannelAnnouncement o);
30470
30471 /**
30472  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
30473  */
30474 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
30475
30476 /**
30477  * Checks if the given object is currently in the success state
30478  */
30479 bool CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR o);
30480
30481 /**
30482  * Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
30483  */
30484 void CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res);
30485
30486 /**
30487  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
30488  * but with all dynamically-allocated buffers duplicated in new buffers.
30489  */
30490 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig);
30491
30492 /**
30493  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
30494  */
30495 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_ok(struct LDKChannelAnnouncement o);
30496
30497 /**
30498  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
30499  */
30500 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
30501
30502 /**
30503  * Checks if the given object is currently in the success state
30504  */
30505 bool CResult_ChannelAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR o);
30506
30507 /**
30508  * Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
30509  */
30510 void CResult_ChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_ChannelAnnouncementDecodeErrorZ _res);
30511
30512 /**
30513  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
30514  * but with all dynamically-allocated buffers duplicated in new buffers.
30515  */
30516 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig);
30517
30518 /**
30519  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
30520  */
30521 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_ok(struct LDKUnsignedChannelUpdate o);
30522
30523 /**
30524  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
30525  */
30526 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e);
30527
30528 /**
30529  * Checks if the given object is currently in the success state
30530  */
30531 bool CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(const struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR o);
30532
30533 /**
30534  * Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
30535  */
30536 void CResult_UnsignedChannelUpdateDecodeErrorZ_free(struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res);
30537
30538 /**
30539  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
30540  * but with all dynamically-allocated buffers duplicated in new buffers.
30541  */
30542 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR orig);
30543
30544 /**
30545  * Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
30546  */
30547 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_ok(struct LDKChannelUpdate o);
30548
30549 /**
30550  * Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
30551  */
30552 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e);
30553
30554 /**
30555  * Checks if the given object is currently in the success state
30556  */
30557 bool CResult_ChannelUpdateDecodeErrorZ_is_ok(const struct LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR o);
30558
30559 /**
30560  * Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
30561  */
30562 void CResult_ChannelUpdateDecodeErrorZ_free(struct LDKCResult_ChannelUpdateDecodeErrorZ _res);
30563
30564 /**
30565  * Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
30566  * but with all dynamically-allocated buffers duplicated in new buffers.
30567  */
30568 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR orig);
30569
30570 /**
30571  * Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
30572  */
30573 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_ok(struct LDKErrorMessage o);
30574
30575 /**
30576  * Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
30577  */
30578 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_err(struct LDKDecodeError e);
30579
30580 /**
30581  * Checks if the given object is currently in the success state
30582  */
30583 bool CResult_ErrorMessageDecodeErrorZ_is_ok(const struct LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR o);
30584
30585 /**
30586  * Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
30587  */
30588 void CResult_ErrorMessageDecodeErrorZ_free(struct LDKCResult_ErrorMessageDecodeErrorZ _res);
30589
30590 /**
30591  * Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
30592  * but with all dynamically-allocated buffers duplicated in new buffers.
30593  */
30594 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_clone(const struct LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR orig);
30595
30596 /**
30597  * Creates a new CResult_WarningMessageDecodeErrorZ in the success state.
30598  */
30599 struct LDKCResult_WarningMessageDecodeErrorZ CResult_WarningMessageDecodeErrorZ_ok(struct LDKWarningMessage o);
30600
30601 /**
30602  * Creates a new CResult_WarningMessageDecodeErrorZ in the error state.
30603  */
30604 struct LDKCResult_WarningMessageDecodeErrorZ CResult_WarningMessageDecodeErrorZ_err(struct LDKDecodeError e);
30605
30606 /**
30607  * Checks if the given object is currently in the success state
30608  */
30609 bool CResult_WarningMessageDecodeErrorZ_is_ok(const struct LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR o);
30610
30611 /**
30612  * Frees any resources used by the CResult_WarningMessageDecodeErrorZ.
30613  */
30614 void CResult_WarningMessageDecodeErrorZ_free(struct LDKCResult_WarningMessageDecodeErrorZ _res);
30615
30616 /**
30617  * Creates a new CResult_WarningMessageDecodeErrorZ which has the same data as `orig`
30618  * but with all dynamically-allocated buffers duplicated in new buffers.
30619  */
30620 struct LDKCResult_WarningMessageDecodeErrorZ CResult_WarningMessageDecodeErrorZ_clone(const struct LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR orig);
30621
30622 /**
30623  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
30624  */
30625 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(struct LDKUnsignedNodeAnnouncement o);
30626
30627 /**
30628  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
30629  */
30630 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
30631
30632 /**
30633  * Checks if the given object is currently in the success state
30634  */
30635 bool CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR o);
30636
30637 /**
30638  * Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
30639  */
30640 void CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res);
30641
30642 /**
30643  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
30644  * but with all dynamically-allocated buffers duplicated in new buffers.
30645  */
30646 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR orig);
30647
30648 /**
30649  * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
30650  */
30651 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_ok(struct LDKNodeAnnouncement o);
30652
30653 /**
30654  * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
30655  */
30656 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
30657
30658 /**
30659  * Checks if the given object is currently in the success state
30660  */
30661 bool CResult_NodeAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR o);
30662
30663 /**
30664  * Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
30665  */
30666 void CResult_NodeAnnouncementDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementDecodeErrorZ _res);
30667
30668 /**
30669  * Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
30670  * but with all dynamically-allocated buffers duplicated in new buffers.
30671  */
30672 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR orig);
30673
30674 /**
30675  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
30676  */
30677 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_ok(struct LDKQueryShortChannelIds o);
30678
30679 /**
30680  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
30681  */
30682 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_err(struct LDKDecodeError e);
30683
30684 /**
30685  * Checks if the given object is currently in the success state
30686  */
30687 bool CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(const struct LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR o);
30688
30689 /**
30690  * Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
30691  */
30692 void CResult_QueryShortChannelIdsDecodeErrorZ_free(struct LDKCResult_QueryShortChannelIdsDecodeErrorZ _res);
30693
30694 /**
30695  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
30696  * but with all dynamically-allocated buffers duplicated in new buffers.
30697  */
30698 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_clone(const struct LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR orig);
30699
30700 /**
30701  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
30702  */
30703 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(struct LDKReplyShortChannelIdsEnd o);
30704
30705 /**
30706  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
30707  */
30708 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(struct LDKDecodeError e);
30709
30710 /**
30711  * Checks if the given object is currently in the success state
30712  */
30713 bool CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(const struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR o);
30714
30715 /**
30716  * Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
30717  */
30718 void CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res);
30719
30720 /**
30721  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
30722  * but with all dynamically-allocated buffers duplicated in new buffers.
30723  */
30724 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(const struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR orig);
30725
30726 /**
30727  * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
30728  */
30729 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_ok(struct LDKQueryChannelRange o);
30730
30731 /**
30732  * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
30733  */
30734 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
30735
30736 /**
30737  * Checks if the given object is currently in the success state
30738  */
30739 bool CResult_QueryChannelRangeDecodeErrorZ_is_ok(const struct LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR o);
30740
30741 /**
30742  * Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
30743  */
30744 void CResult_QueryChannelRangeDecodeErrorZ_free(struct LDKCResult_QueryChannelRangeDecodeErrorZ _res);
30745
30746 /**
30747  * Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
30748  * but with all dynamically-allocated buffers duplicated in new buffers.
30749  */
30750 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_clone(const struct LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR orig);
30751
30752 /**
30753  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
30754  */
30755 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_ok(struct LDKReplyChannelRange o);
30756
30757 /**
30758  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
30759  */
30760 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
30761
30762 /**
30763  * Checks if the given object is currently in the success state
30764  */
30765 bool CResult_ReplyChannelRangeDecodeErrorZ_is_ok(const struct LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR o);
30766
30767 /**
30768  * Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
30769  */
30770 void CResult_ReplyChannelRangeDecodeErrorZ_free(struct LDKCResult_ReplyChannelRangeDecodeErrorZ _res);
30771
30772 /**
30773  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
30774  * but with all dynamically-allocated buffers duplicated in new buffers.
30775  */
30776 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_clone(const struct LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR orig);
30777
30778 /**
30779  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
30780  */
30781 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_ok(struct LDKGossipTimestampFilter o);
30782
30783 /**
30784  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
30785  */
30786 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_err(struct LDKDecodeError e);
30787
30788 /**
30789  * Checks if the given object is currently in the success state
30790  */
30791 bool CResult_GossipTimestampFilterDecodeErrorZ_is_ok(const struct LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR o);
30792
30793 /**
30794  * Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
30795  */
30796 void CResult_GossipTimestampFilterDecodeErrorZ_free(struct LDKCResult_GossipTimestampFilterDecodeErrorZ _res);
30797
30798 /**
30799  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
30800  * but with all dynamically-allocated buffers duplicated in new buffers.
30801  */
30802 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_clone(const struct LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR orig);
30803
30804 /**
30805  * Frees the buffer pointed to by `data` if `datalen` is non-0.
30806  */
30807 void CVec_PhantomRouteHintsZ_free(struct LDKCVec_PhantomRouteHintsZ _res);
30808
30809 /**
30810  * Creates a new CResult_Bolt11InvoiceSignOrCreationErrorZ in the success state.
30811  */
30812 struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ CResult_Bolt11InvoiceSignOrCreationErrorZ_ok(struct LDKBolt11Invoice o);
30813
30814 /**
30815  * Creates a new CResult_Bolt11InvoiceSignOrCreationErrorZ in the error state.
30816  */
30817 struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ CResult_Bolt11InvoiceSignOrCreationErrorZ_err(struct LDKSignOrCreationError e);
30818
30819 /**
30820  * Checks if the given object is currently in the success state
30821  */
30822 bool CResult_Bolt11InvoiceSignOrCreationErrorZ_is_ok(const struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR o);
30823
30824 /**
30825  * Frees any resources used by the CResult_Bolt11InvoiceSignOrCreationErrorZ.
30826  */
30827 void CResult_Bolt11InvoiceSignOrCreationErrorZ_free(struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ _res);
30828
30829 /**
30830  * Creates a new CResult_Bolt11InvoiceSignOrCreationErrorZ which has the same data as `orig`
30831  * but with all dynamically-allocated buffers duplicated in new buffers.
30832  */
30833 struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(const struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR orig);
30834
30835 /**
30836  * Frees the buffer pointed to by `data` if `datalen` is non-0.
30837  */
30838 void CVec_FutureZ_free(struct LDKCVec_FutureZ _res);
30839
30840 /**
30841  * Creates a new CResult_OffersMessageDecodeErrorZ in the success state.
30842  */
30843 struct LDKCResult_OffersMessageDecodeErrorZ CResult_OffersMessageDecodeErrorZ_ok(struct LDKOffersMessage o);
30844
30845 /**
30846  * Creates a new CResult_OffersMessageDecodeErrorZ in the error state.
30847  */
30848 struct LDKCResult_OffersMessageDecodeErrorZ CResult_OffersMessageDecodeErrorZ_err(struct LDKDecodeError e);
30849
30850 /**
30851  * Checks if the given object is currently in the success state
30852  */
30853 bool CResult_OffersMessageDecodeErrorZ_is_ok(const struct LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR o);
30854
30855 /**
30856  * Frees any resources used by the CResult_OffersMessageDecodeErrorZ.
30857  */
30858 void CResult_OffersMessageDecodeErrorZ_free(struct LDKCResult_OffersMessageDecodeErrorZ _res);
30859
30860 /**
30861  * Creates a new CResult_OffersMessageDecodeErrorZ which has the same data as `orig`
30862  * but with all dynamically-allocated buffers duplicated in new buffers.
30863  */
30864 struct LDKCResult_OffersMessageDecodeErrorZ CResult_OffersMessageDecodeErrorZ_clone(const struct LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR orig);
30865
30866 /**
30867  * Constructs a new COption_HTLCClaimZ containing a crate::lightning::ln::chan_utils::HTLCClaim
30868  */
30869 struct LDKCOption_HTLCClaimZ COption_HTLCClaimZ_some(enum LDKHTLCClaim o);
30870
30871 /**
30872  * Constructs a new COption_HTLCClaimZ containing nothing
30873  */
30874 struct LDKCOption_HTLCClaimZ COption_HTLCClaimZ_none(void);
30875
30876 /**
30877  * Frees any resources associated with the crate::lightning::ln::chan_utils::HTLCClaim, if we are in the Some state
30878  */
30879 void COption_HTLCClaimZ_free(struct LDKCOption_HTLCClaimZ _res);
30880
30881 /**
30882  * Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the success state.
30883  */
30884 struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(struct LDKCounterpartyCommitmentSecrets o);
30885
30886 /**
30887  * Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the error state.
30888  */
30889 struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(struct LDKDecodeError e);
30890
30891 /**
30892  * Checks if the given object is currently in the success state
30893  */
30894 bool CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(const struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR o);
30895
30896 /**
30897  * Frees any resources used by the CResult_CounterpartyCommitmentSecretsDecodeErrorZ.
30898  */
30899 void CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ _res);
30900
30901 /**
30902  * Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ which has the same data as `orig`
30903  * but with all dynamically-allocated buffers duplicated in new buffers.
30904  */
30905 struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(const struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR orig);
30906
30907 /**
30908  * Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state.
30909  */
30910 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_ok(struct LDKTxCreationKeys o);
30911
30912 /**
30913  * Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state.
30914  */
30915 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_err(struct LDKDecodeError e);
30916
30917 /**
30918  * Checks if the given object is currently in the success state
30919  */
30920 bool CResult_TxCreationKeysDecodeErrorZ_is_ok(const struct LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR o);
30921
30922 /**
30923  * Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
30924  */
30925 void CResult_TxCreationKeysDecodeErrorZ_free(struct LDKCResult_TxCreationKeysDecodeErrorZ _res);
30926
30927 /**
30928  * Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig`
30929  * but with all dynamically-allocated buffers duplicated in new buffers.
30930  */
30931 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_clone(const struct LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR orig);
30932
30933 /**
30934  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state.
30935  */
30936 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_ok(struct LDKChannelPublicKeys o);
30937
30938 /**
30939  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state.
30940  */
30941 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_err(struct LDKDecodeError e);
30942
30943 /**
30944  * Checks if the given object is currently in the success state
30945  */
30946 bool CResult_ChannelPublicKeysDecodeErrorZ_is_ok(const struct LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR o);
30947
30948 /**
30949  * Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
30950  */
30951 void CResult_ChannelPublicKeysDecodeErrorZ_free(struct LDKCResult_ChannelPublicKeysDecodeErrorZ _res);
30952
30953 /**
30954  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig`
30955  * but with all dynamically-allocated buffers duplicated in new buffers.
30956  */
30957 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_clone(const struct LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR orig);
30958
30959 /**
30960  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
30961  */
30962 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(struct LDKHTLCOutputInCommitment o);
30963
30964 /**
30965  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
30966  */
30967 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_err(struct LDKDecodeError e);
30968
30969 /**
30970  * Checks if the given object is currently in the success state
30971  */
30972 bool CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(const struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR o);
30973
30974 /**
30975  * Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
30976  */
30977 void CResult_HTLCOutputInCommitmentDecodeErrorZ_free(struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res);
30978
30979 /**
30980  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
30981  * but with all dynamically-allocated buffers duplicated in new buffers.
30982  */
30983 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(const struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR orig);
30984
30985 /**
30986  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
30987  */
30988 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(struct LDKCounterpartyChannelTransactionParameters o);
30989
30990 /**
30991  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
30992  */
30993 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e);
30994
30995 /**
30996  * Checks if the given object is currently in the success state
30997  */
30998 bool CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(const struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR o);
30999
31000 /**
31001  * Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
31002  */
31003 void CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res);
31004
31005 /**
31006  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
31007  * but with all dynamically-allocated buffers duplicated in new buffers.
31008  */
31009 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig);
31010
31011 /**
31012  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
31013  */
31014 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_ok(struct LDKChannelTransactionParameters o);
31015
31016 /**
31017  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
31018  */
31019 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e);
31020
31021 /**
31022  * Checks if the given object is currently in the success state
31023  */
31024 bool CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(const struct LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR o);
31025
31026 /**
31027  * Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
31028  */
31029 void CResult_ChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_ChannelTransactionParametersDecodeErrorZ _res);
31030
31031 /**
31032  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
31033  * but with all dynamically-allocated buffers duplicated in new buffers.
31034  */
31035 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig);
31036
31037 /**
31038  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
31039  */
31040 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_ok(struct LDKHolderCommitmentTransaction o);
31041
31042 /**
31043  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
31044  */
31045 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
31046
31047 /**
31048  * Checks if the given object is currently in the success state
31049  */
31050 bool CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR o);
31051
31052 /**
31053  * Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
31054  */
31055 void CResult_HolderCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res);
31056
31057 /**
31058  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
31059  * but with all dynamically-allocated buffers duplicated in new buffers.
31060  */
31061 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
31062
31063 /**
31064  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
31065  */
31066 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(struct LDKBuiltCommitmentTransaction o);
31067
31068 /**
31069  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
31070  */
31071 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
31072
31073 /**
31074  * Checks if the given object is currently in the success state
31075  */
31076 bool CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR o);
31077
31078 /**
31079  * Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
31080  */
31081 void CResult_BuiltCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res);
31082
31083 /**
31084  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
31085  * but with all dynamically-allocated buffers duplicated in new buffers.
31086  */
31087 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
31088
31089 /**
31090  * Creates a new CResult_TrustedClosingTransactionNoneZ in the success state.
31091  */
31092 struct LDKCResult_TrustedClosingTransactionNoneZ CResult_TrustedClosingTransactionNoneZ_ok(struct LDKTrustedClosingTransaction o);
31093
31094 /**
31095  * Creates a new CResult_TrustedClosingTransactionNoneZ in the error state.
31096  */
31097 struct LDKCResult_TrustedClosingTransactionNoneZ CResult_TrustedClosingTransactionNoneZ_err(void);
31098
31099 /**
31100  * Checks if the given object is currently in the success state
31101  */
31102 bool CResult_TrustedClosingTransactionNoneZ_is_ok(const struct LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR o);
31103
31104 /**
31105  * Frees any resources used by the CResult_TrustedClosingTransactionNoneZ.
31106  */
31107 void CResult_TrustedClosingTransactionNoneZ_free(struct LDKCResult_TrustedClosingTransactionNoneZ _res);
31108
31109 /**
31110  * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
31111  */
31112 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_ok(struct LDKCommitmentTransaction o);
31113
31114 /**
31115  * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
31116  */
31117 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
31118
31119 /**
31120  * Checks if the given object is currently in the success state
31121  */
31122 bool CResult_CommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR o);
31123
31124 /**
31125  * Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
31126  */
31127 void CResult_CommitmentTransactionDecodeErrorZ_free(struct LDKCResult_CommitmentTransactionDecodeErrorZ _res);
31128
31129 /**
31130  * Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
31131  * but with all dynamically-allocated buffers duplicated in new buffers.
31132  */
31133 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
31134
31135 /**
31136  * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
31137  */
31138 struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_ok(struct LDKTrustedCommitmentTransaction o);
31139
31140 /**
31141  * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
31142  */
31143 struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_err(void);
31144
31145 /**
31146  * Checks if the given object is currently in the success state
31147  */
31148 bool CResult_TrustedCommitmentTransactionNoneZ_is_ok(const struct LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR o);
31149
31150 /**
31151  * Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
31152  */
31153 void CResult_TrustedCommitmentTransactionNoneZ_free(struct LDKCResult_TrustedCommitmentTransactionNoneZ _res);
31154
31155 /**
31156  * Creates a new CResult_CVec_ECDSASignatureZNoneZ in the success state.
31157  */
31158 struct LDKCResult_CVec_ECDSASignatureZNoneZ CResult_CVec_ECDSASignatureZNoneZ_ok(struct LDKCVec_ECDSASignatureZ o);
31159
31160 /**
31161  * Creates a new CResult_CVec_ECDSASignatureZNoneZ in the error state.
31162  */
31163 struct LDKCResult_CVec_ECDSASignatureZNoneZ CResult_CVec_ECDSASignatureZNoneZ_err(void);
31164
31165 /**
31166  * Checks if the given object is currently in the success state
31167  */
31168 bool CResult_CVec_ECDSASignatureZNoneZ_is_ok(const struct LDKCResult_CVec_ECDSASignatureZNoneZ *NONNULL_PTR o);
31169
31170 /**
31171  * Frees any resources used by the CResult_CVec_ECDSASignatureZNoneZ.
31172  */
31173 void CResult_CVec_ECDSASignatureZNoneZ_free(struct LDKCResult_CVec_ECDSASignatureZNoneZ _res);
31174
31175 /**
31176  * Creates a new CResult_CVec_ECDSASignatureZNoneZ which has the same data as `orig`
31177  * but with all dynamically-allocated buffers duplicated in new buffers.
31178  */
31179 struct LDKCResult_CVec_ECDSASignatureZNoneZ CResult_CVec_ECDSASignatureZNoneZ_clone(const struct LDKCResult_CVec_ECDSASignatureZNoneZ *NONNULL_PTR orig);
31180
31181 /**
31182  * Constructs a new COption_usizeZ containing a usize
31183  */
31184 struct LDKCOption_usizeZ COption_usizeZ_some(uintptr_t o);
31185
31186 /**
31187  * Constructs a new COption_usizeZ containing nothing
31188  */
31189 struct LDKCOption_usizeZ COption_usizeZ_none(void);
31190
31191 /**
31192  * Frees any resources associated with the usize, if we are in the Some state
31193  */
31194 void COption_usizeZ_free(struct LDKCOption_usizeZ _res);
31195
31196 /**
31197  * Creates a new COption_usizeZ which has the same data as `orig`
31198  * but with all dynamically-allocated buffers duplicated in new buffers.
31199  */
31200 struct LDKCOption_usizeZ COption_usizeZ_clone(const struct LDKCOption_usizeZ *NONNULL_PTR orig);
31201
31202 /**
31203  * Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state.
31204  */
31205 struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_ok(struct LDKShutdownScript o);
31206
31207 /**
31208  * Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state.
31209  */
31210 struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_err(struct LDKDecodeError e);
31211
31212 /**
31213  * Checks if the given object is currently in the success state
31214  */
31215 bool CResult_ShutdownScriptDecodeErrorZ_is_ok(const struct LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR o);
31216
31217 /**
31218  * Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ.
31219  */
31220 void CResult_ShutdownScriptDecodeErrorZ_free(struct LDKCResult_ShutdownScriptDecodeErrorZ _res);
31221
31222 /**
31223  * Creates a new CResult_ShutdownScriptDecodeErrorZ which has the same data as `orig`
31224  * but with all dynamically-allocated buffers duplicated in new buffers.
31225  */
31226 struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_clone(const struct LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR orig);
31227
31228 /**
31229  * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state.
31230  */
31231 struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_ok(struct LDKShutdownScript o);
31232
31233 /**
31234  * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state.
31235  */
31236 struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_err(struct LDKInvalidShutdownScript e);
31237
31238 /**
31239  * Checks if the given object is currently in the success state
31240  */
31241 bool CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(const struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR o);
31242
31243 /**
31244  * Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ.
31245  */
31246 void CResult_ShutdownScriptInvalidShutdownScriptZ_free(struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res);
31247
31248 /**
31249  * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ which has the same data as `orig`
31250  * but with all dynamically-allocated buffers duplicated in new buffers.
31251  */
31252 struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_clone(const struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR orig);
31253
31254 /**
31255  * Frees the buffer pointed to by `data` if `datalen` is non-0.
31256  */
31257 void CVec_TransactionZ_free(struct LDKCVec_TransactionZ _res);
31258
31259 /**
31260  * Creates a new CResult_PaymentPurposeDecodeErrorZ in the success state.
31261  */
31262 struct LDKCResult_PaymentPurposeDecodeErrorZ CResult_PaymentPurposeDecodeErrorZ_ok(struct LDKPaymentPurpose o);
31263
31264 /**
31265  * Creates a new CResult_PaymentPurposeDecodeErrorZ in the error state.
31266  */
31267 struct LDKCResult_PaymentPurposeDecodeErrorZ CResult_PaymentPurposeDecodeErrorZ_err(struct LDKDecodeError e);
31268
31269 /**
31270  * Checks if the given object is currently in the success state
31271  */
31272 bool CResult_PaymentPurposeDecodeErrorZ_is_ok(const struct LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR o);
31273
31274 /**
31275  * Frees any resources used by the CResult_PaymentPurposeDecodeErrorZ.
31276  */
31277 void CResult_PaymentPurposeDecodeErrorZ_free(struct LDKCResult_PaymentPurposeDecodeErrorZ _res);
31278
31279 /**
31280  * Creates a new CResult_PaymentPurposeDecodeErrorZ which has the same data as `orig`
31281  * but with all dynamically-allocated buffers duplicated in new buffers.
31282  */
31283 struct LDKCResult_PaymentPurposeDecodeErrorZ CResult_PaymentPurposeDecodeErrorZ_clone(const struct LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR orig);
31284
31285 /**
31286  * Creates a new CResult_ClaimedHTLCDecodeErrorZ in the success state.
31287  */
31288 struct LDKCResult_ClaimedHTLCDecodeErrorZ CResult_ClaimedHTLCDecodeErrorZ_ok(struct LDKClaimedHTLC o);
31289
31290 /**
31291  * Creates a new CResult_ClaimedHTLCDecodeErrorZ in the error state.
31292  */
31293 struct LDKCResult_ClaimedHTLCDecodeErrorZ CResult_ClaimedHTLCDecodeErrorZ_err(struct LDKDecodeError e);
31294
31295 /**
31296  * Checks if the given object is currently in the success state
31297  */
31298 bool CResult_ClaimedHTLCDecodeErrorZ_is_ok(const struct LDKCResult_ClaimedHTLCDecodeErrorZ *NONNULL_PTR o);
31299
31300 /**
31301  * Frees any resources used by the CResult_ClaimedHTLCDecodeErrorZ.
31302  */
31303 void CResult_ClaimedHTLCDecodeErrorZ_free(struct LDKCResult_ClaimedHTLCDecodeErrorZ _res);
31304
31305 /**
31306  * Creates a new CResult_ClaimedHTLCDecodeErrorZ which has the same data as `orig`
31307  * but with all dynamically-allocated buffers duplicated in new buffers.
31308  */
31309 struct LDKCResult_ClaimedHTLCDecodeErrorZ CResult_ClaimedHTLCDecodeErrorZ_clone(const struct LDKCResult_ClaimedHTLCDecodeErrorZ *NONNULL_PTR orig);
31310
31311 /**
31312  * Constructs a new COption_PathFailureZ containing a crate::lightning::events::PathFailure
31313  */
31314 struct LDKCOption_PathFailureZ COption_PathFailureZ_some(struct LDKPathFailure o);
31315
31316 /**
31317  * Constructs a new COption_PathFailureZ containing nothing
31318  */
31319 struct LDKCOption_PathFailureZ COption_PathFailureZ_none(void);
31320
31321 /**
31322  * Frees any resources associated with the crate::lightning::events::PathFailure, if we are in the Some state
31323  */
31324 void COption_PathFailureZ_free(struct LDKCOption_PathFailureZ _res);
31325
31326 /**
31327  * Creates a new COption_PathFailureZ which has the same data as `orig`
31328  * but with all dynamically-allocated buffers duplicated in new buffers.
31329  */
31330 struct LDKCOption_PathFailureZ COption_PathFailureZ_clone(const struct LDKCOption_PathFailureZ *NONNULL_PTR orig);
31331
31332 /**
31333  * Creates a new CResult_COption_PathFailureZDecodeErrorZ in the success state.
31334  */
31335 struct LDKCResult_COption_PathFailureZDecodeErrorZ CResult_COption_PathFailureZDecodeErrorZ_ok(struct LDKCOption_PathFailureZ o);
31336
31337 /**
31338  * Creates a new CResult_COption_PathFailureZDecodeErrorZ in the error state.
31339  */
31340 struct LDKCResult_COption_PathFailureZDecodeErrorZ CResult_COption_PathFailureZDecodeErrorZ_err(struct LDKDecodeError e);
31341
31342 /**
31343  * Checks if the given object is currently in the success state
31344  */
31345 bool CResult_COption_PathFailureZDecodeErrorZ_is_ok(const struct LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR o);
31346
31347 /**
31348  * Frees any resources used by the CResult_COption_PathFailureZDecodeErrorZ.
31349  */
31350 void CResult_COption_PathFailureZDecodeErrorZ_free(struct LDKCResult_COption_PathFailureZDecodeErrorZ _res);
31351
31352 /**
31353  * Creates a new CResult_COption_PathFailureZDecodeErrorZ which has the same data as `orig`
31354  * but with all dynamically-allocated buffers duplicated in new buffers.
31355  */
31356 struct LDKCResult_COption_PathFailureZDecodeErrorZ CResult_COption_PathFailureZDecodeErrorZ_clone(const struct LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR orig);
31357
31358 /**
31359  * Constructs a new COption_ClosureReasonZ containing a crate::lightning::events::ClosureReason
31360  */
31361 struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_some(struct LDKClosureReason o);
31362
31363 /**
31364  * Constructs a new COption_ClosureReasonZ containing nothing
31365  */
31366 struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_none(void);
31367
31368 /**
31369  * Frees any resources associated with the crate::lightning::events::ClosureReason, if we are in the Some state
31370  */
31371 void COption_ClosureReasonZ_free(struct LDKCOption_ClosureReasonZ _res);
31372
31373 /**
31374  * Creates a new COption_ClosureReasonZ which has the same data as `orig`
31375  * but with all dynamically-allocated buffers duplicated in new buffers.
31376  */
31377 struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_clone(const struct LDKCOption_ClosureReasonZ *NONNULL_PTR orig);
31378
31379 /**
31380  * Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the success state.
31381  */
31382 struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_ok(struct LDKCOption_ClosureReasonZ o);
31383
31384 /**
31385  * Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the error state.
31386  */
31387 struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_err(struct LDKDecodeError e);
31388
31389 /**
31390  * Checks if the given object is currently in the success state
31391  */
31392 bool CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(const struct LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR o);
31393
31394 /**
31395  * Frees any resources used by the CResult_COption_ClosureReasonZDecodeErrorZ.
31396  */
31397 void CResult_COption_ClosureReasonZDecodeErrorZ_free(struct LDKCResult_COption_ClosureReasonZDecodeErrorZ _res);
31398
31399 /**
31400  * Creates a new CResult_COption_ClosureReasonZDecodeErrorZ which has the same data as `orig`
31401  * but with all dynamically-allocated buffers duplicated in new buffers.
31402  */
31403 struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_clone(const struct LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR orig);
31404
31405 /**
31406  * Constructs a new COption_HTLCDestinationZ containing a crate::lightning::events::HTLCDestination
31407  */
31408 struct LDKCOption_HTLCDestinationZ COption_HTLCDestinationZ_some(struct LDKHTLCDestination o);
31409
31410 /**
31411  * Constructs a new COption_HTLCDestinationZ containing nothing
31412  */
31413 struct LDKCOption_HTLCDestinationZ COption_HTLCDestinationZ_none(void);
31414
31415 /**
31416  * Frees any resources associated with the crate::lightning::events::HTLCDestination, if we are in the Some state
31417  */
31418 void COption_HTLCDestinationZ_free(struct LDKCOption_HTLCDestinationZ _res);
31419
31420 /**
31421  * Creates a new COption_HTLCDestinationZ which has the same data as `orig`
31422  * but with all dynamically-allocated buffers duplicated in new buffers.
31423  */
31424 struct LDKCOption_HTLCDestinationZ COption_HTLCDestinationZ_clone(const struct LDKCOption_HTLCDestinationZ *NONNULL_PTR orig);
31425
31426 /**
31427  * Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the success state.
31428  */
31429 struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ CResult_COption_HTLCDestinationZDecodeErrorZ_ok(struct LDKCOption_HTLCDestinationZ o);
31430
31431 /**
31432  * Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the error state.
31433  */
31434 struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ CResult_COption_HTLCDestinationZDecodeErrorZ_err(struct LDKDecodeError e);
31435
31436 /**
31437  * Checks if the given object is currently in the success state
31438  */
31439 bool CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(const struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR o);
31440
31441 /**
31442  * Frees any resources used by the CResult_COption_HTLCDestinationZDecodeErrorZ.
31443  */
31444 void CResult_COption_HTLCDestinationZDecodeErrorZ_free(struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ _res);
31445
31446 /**
31447  * Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ which has the same data as `orig`
31448  * but with all dynamically-allocated buffers duplicated in new buffers.
31449  */
31450 struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ CResult_COption_HTLCDestinationZDecodeErrorZ_clone(const struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR orig);
31451
31452 /**
31453  * Creates a new CResult_PaymentFailureReasonDecodeErrorZ in the success state.
31454  */
31455 struct LDKCResult_PaymentFailureReasonDecodeErrorZ CResult_PaymentFailureReasonDecodeErrorZ_ok(enum LDKPaymentFailureReason o);
31456
31457 /**
31458  * Creates a new CResult_PaymentFailureReasonDecodeErrorZ in the error state.
31459  */
31460 struct LDKCResult_PaymentFailureReasonDecodeErrorZ CResult_PaymentFailureReasonDecodeErrorZ_err(struct LDKDecodeError e);
31461
31462 /**
31463  * Checks if the given object is currently in the success state
31464  */
31465 bool CResult_PaymentFailureReasonDecodeErrorZ_is_ok(const struct LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR o);
31466
31467 /**
31468  * Frees any resources used by the CResult_PaymentFailureReasonDecodeErrorZ.
31469  */
31470 void CResult_PaymentFailureReasonDecodeErrorZ_free(struct LDKCResult_PaymentFailureReasonDecodeErrorZ _res);
31471
31472 /**
31473  * Creates a new CResult_PaymentFailureReasonDecodeErrorZ which has the same data as `orig`
31474  * but with all dynamically-allocated buffers duplicated in new buffers.
31475  */
31476 struct LDKCResult_PaymentFailureReasonDecodeErrorZ CResult_PaymentFailureReasonDecodeErrorZ_clone(const struct LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR orig);
31477
31478 /**
31479  * Constructs a new COption_U128Z containing a crate::c_types::U128
31480  */
31481 struct LDKCOption_U128Z COption_U128Z_some(struct LDKU128 o);
31482
31483 /**
31484  * Constructs a new COption_U128Z containing nothing
31485  */
31486 struct LDKCOption_U128Z COption_U128Z_none(void);
31487
31488 /**
31489  * Frees any resources associated with the crate::c_types::U128, if we are in the Some state
31490  */
31491 void COption_U128Z_free(struct LDKCOption_U128Z _res);
31492
31493 /**
31494  * Creates a new COption_U128Z which has the same data as `orig`
31495  * but with all dynamically-allocated buffers duplicated in new buffers.
31496  */
31497 struct LDKCOption_U128Z COption_U128Z_clone(const struct LDKCOption_U128Z *NONNULL_PTR orig);
31498
31499 /**
31500  * Frees the buffer pointed to by `data` if `datalen` is non-0.
31501  */
31502 void CVec_ClaimedHTLCZ_free(struct LDKCVec_ClaimedHTLCZ _res);
31503
31504 /**
31505  * Constructs a new COption_PaymentFailureReasonZ containing a crate::lightning::events::PaymentFailureReason
31506  */
31507 struct LDKCOption_PaymentFailureReasonZ COption_PaymentFailureReasonZ_some(enum LDKPaymentFailureReason o);
31508
31509 /**
31510  * Constructs a new COption_PaymentFailureReasonZ containing nothing
31511  */
31512 struct LDKCOption_PaymentFailureReasonZ COption_PaymentFailureReasonZ_none(void);
31513
31514 /**
31515  * Frees any resources associated with the crate::lightning::events::PaymentFailureReason, if we are in the Some state
31516  */
31517 void COption_PaymentFailureReasonZ_free(struct LDKCOption_PaymentFailureReasonZ _res);
31518
31519 /**
31520  * Creates a new COption_PaymentFailureReasonZ which has the same data as `orig`
31521  * but with all dynamically-allocated buffers duplicated in new buffers.
31522  */
31523 struct LDKCOption_PaymentFailureReasonZ COption_PaymentFailureReasonZ_clone(const struct LDKCOption_PaymentFailureReasonZ *NONNULL_PTR orig);
31524
31525 /**
31526  * Constructs a new COption_EventZ containing a crate::lightning::events::Event
31527  */
31528 struct LDKCOption_EventZ COption_EventZ_some(struct LDKEvent o);
31529
31530 /**
31531  * Constructs a new COption_EventZ containing nothing
31532  */
31533 struct LDKCOption_EventZ COption_EventZ_none(void);
31534
31535 /**
31536  * Frees any resources associated with the crate::lightning::events::Event, if we are in the Some state
31537  */
31538 void COption_EventZ_free(struct LDKCOption_EventZ _res);
31539
31540 /**
31541  * Creates a new COption_EventZ which has the same data as `orig`
31542  * but with all dynamically-allocated buffers duplicated in new buffers.
31543  */
31544 struct LDKCOption_EventZ COption_EventZ_clone(const struct LDKCOption_EventZ *NONNULL_PTR orig);
31545
31546 /**
31547  * Creates a new CResult_COption_EventZDecodeErrorZ in the success state.
31548  */
31549 struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_ok(struct LDKCOption_EventZ o);
31550
31551 /**
31552  * Creates a new CResult_COption_EventZDecodeErrorZ in the error state.
31553  */
31554 struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_err(struct LDKDecodeError e);
31555
31556 /**
31557  * Checks if the given object is currently in the success state
31558  */
31559 bool CResult_COption_EventZDecodeErrorZ_is_ok(const struct LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR o);
31560
31561 /**
31562  * Frees any resources used by the CResult_COption_EventZDecodeErrorZ.
31563  */
31564 void CResult_COption_EventZDecodeErrorZ_free(struct LDKCResult_COption_EventZDecodeErrorZ _res);
31565
31566 /**
31567  * Creates a new CResult_COption_EventZDecodeErrorZ which has the same data as `orig`
31568  * but with all dynamically-allocated buffers duplicated in new buffers.
31569  */
31570 struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_clone(const struct LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR orig);
31571
31572 /**
31573  * Creates a new CResult_SiPrefixBolt11ParseErrorZ in the success state.
31574  */
31575 struct LDKCResult_SiPrefixBolt11ParseErrorZ CResult_SiPrefixBolt11ParseErrorZ_ok(enum LDKSiPrefix o);
31576
31577 /**
31578  * Creates a new CResult_SiPrefixBolt11ParseErrorZ in the error state.
31579  */
31580 struct LDKCResult_SiPrefixBolt11ParseErrorZ CResult_SiPrefixBolt11ParseErrorZ_err(struct LDKBolt11ParseError e);
31581
31582 /**
31583  * Checks if the given object is currently in the success state
31584  */
31585 bool CResult_SiPrefixBolt11ParseErrorZ_is_ok(const struct LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR o);
31586
31587 /**
31588  * Frees any resources used by the CResult_SiPrefixBolt11ParseErrorZ.
31589  */
31590 void CResult_SiPrefixBolt11ParseErrorZ_free(struct LDKCResult_SiPrefixBolt11ParseErrorZ _res);
31591
31592 /**
31593  * Creates a new CResult_SiPrefixBolt11ParseErrorZ which has the same data as `orig`
31594  * but with all dynamically-allocated buffers duplicated in new buffers.
31595  */
31596 struct LDKCResult_SiPrefixBolt11ParseErrorZ CResult_SiPrefixBolt11ParseErrorZ_clone(const struct LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR orig);
31597
31598 /**
31599  * Creates a new CResult_Bolt11InvoiceParseOrSemanticErrorZ in the success state.
31600  */
31601 struct LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ CResult_Bolt11InvoiceParseOrSemanticErrorZ_ok(struct LDKBolt11Invoice o);
31602
31603 /**
31604  * Creates a new CResult_Bolt11InvoiceParseOrSemanticErrorZ in the error state.
31605  */
31606 struct LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ CResult_Bolt11InvoiceParseOrSemanticErrorZ_err(struct LDKParseOrSemanticError e);
31607
31608 /**
31609  * Checks if the given object is currently in the success state
31610  */
31611 bool CResult_Bolt11InvoiceParseOrSemanticErrorZ_is_ok(const struct LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR o);
31612
31613 /**
31614  * Frees any resources used by the CResult_Bolt11InvoiceParseOrSemanticErrorZ.
31615  */
31616 void CResult_Bolt11InvoiceParseOrSemanticErrorZ_free(struct LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ _res);
31617
31618 /**
31619  * Creates a new CResult_Bolt11InvoiceParseOrSemanticErrorZ which has the same data as `orig`
31620  * but with all dynamically-allocated buffers duplicated in new buffers.
31621  */
31622 struct LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(const struct LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR orig);
31623
31624 /**
31625  * Creates a new CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ in the success state.
31626  */
31627 struct LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_ok(struct LDKSignedRawBolt11Invoice o);
31628
31629 /**
31630  * Creates a new CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ in the error state.
31631  */
31632 struct LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_err(struct LDKBolt11ParseError e);
31633
31634 /**
31635  * Checks if the given object is currently in the success state
31636  */
31637 bool CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_is_ok(const struct LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR o);
31638
31639 /**
31640  * Frees any resources used by the CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ.
31641  */
31642 void CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_free(struct LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ _res);
31643
31644 /**
31645  * Creates a new CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ which has the same data as `orig`
31646  * but with all dynamically-allocated buffers duplicated in new buffers.
31647  */
31648 struct LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(const struct LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR orig);
31649
31650 /**
31651  * Creates a new tuple which has the same data as `orig`
31652  * but with all dynamically-allocated buffers duplicated in new buffers.
31653  */
31654 struct LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(const struct LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR orig);
31655
31656 /**
31657  * Creates a new C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ from the contained elements.
31658  */
31659 struct LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_new(struct LDKRawBolt11Invoice a, struct LDKThirtyTwoBytes b, struct LDKBolt11InvoiceSignature c);
31660
31661 /**
31662  * Frees any resources used by the C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ.
31663  */
31664 void C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_free(struct LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ _res);
31665
31666 /**
31667  * Creates a new CResult_PayeePubKeySecp256k1ErrorZ in the success state.
31668  */
31669 struct LDKCResult_PayeePubKeySecp256k1ErrorZ CResult_PayeePubKeySecp256k1ErrorZ_ok(struct LDKPayeePubKey o);
31670
31671 /**
31672  * Creates a new CResult_PayeePubKeySecp256k1ErrorZ in the error state.
31673  */
31674 struct LDKCResult_PayeePubKeySecp256k1ErrorZ CResult_PayeePubKeySecp256k1ErrorZ_err(enum LDKSecp256k1Error e);
31675
31676 /**
31677  * Checks if the given object is currently in the success state
31678  */
31679 bool CResult_PayeePubKeySecp256k1ErrorZ_is_ok(const struct LDKCResult_PayeePubKeySecp256k1ErrorZ *NONNULL_PTR o);
31680
31681 /**
31682  * Frees any resources used by the CResult_PayeePubKeySecp256k1ErrorZ.
31683  */
31684 void CResult_PayeePubKeySecp256k1ErrorZ_free(struct LDKCResult_PayeePubKeySecp256k1ErrorZ _res);
31685
31686 /**
31687  * Creates a new CResult_PayeePubKeySecp256k1ErrorZ which has the same data as `orig`
31688  * but with all dynamically-allocated buffers duplicated in new buffers.
31689  */
31690 struct LDKCResult_PayeePubKeySecp256k1ErrorZ CResult_PayeePubKeySecp256k1ErrorZ_clone(const struct LDKCResult_PayeePubKeySecp256k1ErrorZ *NONNULL_PTR orig);
31691
31692 /**
31693  * Frees the buffer pointed to by `data` if `datalen` is non-0.
31694  */
31695 void CVec_PrivateRouteZ_free(struct LDKCVec_PrivateRouteZ _res);
31696
31697 /**
31698  * Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
31699  */
31700 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_ok(struct LDKPositiveTimestamp o);
31701
31702 /**
31703  * Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
31704  */
31705 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_err(enum LDKCreationError e);
31706
31707 /**
31708  * Checks if the given object is currently in the success state
31709  */
31710 bool CResult_PositiveTimestampCreationErrorZ_is_ok(const struct LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR o);
31711
31712 /**
31713  * Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
31714  */
31715 void CResult_PositiveTimestampCreationErrorZ_free(struct LDKCResult_PositiveTimestampCreationErrorZ _res);
31716
31717 /**
31718  * Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
31719  * but with all dynamically-allocated buffers duplicated in new buffers.
31720  */
31721 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_clone(const struct LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR orig);
31722
31723 /**
31724  * Creates a new CResult_NoneBolt11SemanticErrorZ in the success state.
31725  */
31726 struct LDKCResult_NoneBolt11SemanticErrorZ CResult_NoneBolt11SemanticErrorZ_ok(void);
31727
31728 /**
31729  * Creates a new CResult_NoneBolt11SemanticErrorZ in the error state.
31730  */
31731 struct LDKCResult_NoneBolt11SemanticErrorZ CResult_NoneBolt11SemanticErrorZ_err(enum LDKBolt11SemanticError e);
31732
31733 /**
31734  * Checks if the given object is currently in the success state
31735  */
31736 bool CResult_NoneBolt11SemanticErrorZ_is_ok(const struct LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR o);
31737
31738 /**
31739  * Frees any resources used by the CResult_NoneBolt11SemanticErrorZ.
31740  */
31741 void CResult_NoneBolt11SemanticErrorZ_free(struct LDKCResult_NoneBolt11SemanticErrorZ _res);
31742
31743 /**
31744  * Creates a new CResult_NoneBolt11SemanticErrorZ which has the same data as `orig`
31745  * but with all dynamically-allocated buffers duplicated in new buffers.
31746  */
31747 struct LDKCResult_NoneBolt11SemanticErrorZ CResult_NoneBolt11SemanticErrorZ_clone(const struct LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR orig);
31748
31749 /**
31750  * Creates a new CResult_Bolt11InvoiceBolt11SemanticErrorZ in the success state.
31751  */
31752 struct LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ CResult_Bolt11InvoiceBolt11SemanticErrorZ_ok(struct LDKBolt11Invoice o);
31753
31754 /**
31755  * Creates a new CResult_Bolt11InvoiceBolt11SemanticErrorZ in the error state.
31756  */
31757 struct LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ CResult_Bolt11InvoiceBolt11SemanticErrorZ_err(enum LDKBolt11SemanticError e);
31758
31759 /**
31760  * Checks if the given object is currently in the success state
31761  */
31762 bool CResult_Bolt11InvoiceBolt11SemanticErrorZ_is_ok(const struct LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR o);
31763
31764 /**
31765  * Frees any resources used by the CResult_Bolt11InvoiceBolt11SemanticErrorZ.
31766  */
31767 void CResult_Bolt11InvoiceBolt11SemanticErrorZ_free(struct LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ _res);
31768
31769 /**
31770  * Creates a new CResult_Bolt11InvoiceBolt11SemanticErrorZ which has the same data as `orig`
31771  * but with all dynamically-allocated buffers duplicated in new buffers.
31772  */
31773 struct LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(const struct LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR orig);
31774
31775 /**
31776  * Creates a new CResult_DescriptionCreationErrorZ in the success state.
31777  */
31778 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_ok(struct LDKDescription o);
31779
31780 /**
31781  * Creates a new CResult_DescriptionCreationErrorZ in the error state.
31782  */
31783 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_err(enum LDKCreationError e);
31784
31785 /**
31786  * Checks if the given object is currently in the success state
31787  */
31788 bool CResult_DescriptionCreationErrorZ_is_ok(const struct LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR o);
31789
31790 /**
31791  * Frees any resources used by the CResult_DescriptionCreationErrorZ.
31792  */
31793 void CResult_DescriptionCreationErrorZ_free(struct LDKCResult_DescriptionCreationErrorZ _res);
31794
31795 /**
31796  * Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
31797  * but with all dynamically-allocated buffers duplicated in new buffers.
31798  */
31799 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_clone(const struct LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR orig);
31800
31801 /**
31802  * Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
31803  */
31804 struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_ok(struct LDKPrivateRoute o);
31805
31806 /**
31807  * Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
31808  */
31809 struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_err(enum LDKCreationError e);
31810
31811 /**
31812  * Checks if the given object is currently in the success state
31813  */
31814 bool CResult_PrivateRouteCreationErrorZ_is_ok(const struct LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR o);
31815
31816 /**
31817  * Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
31818  */
31819 void CResult_PrivateRouteCreationErrorZ_free(struct LDKCResult_PrivateRouteCreationErrorZ _res);
31820
31821 /**
31822  * Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
31823  * but with all dynamically-allocated buffers duplicated in new buffers.
31824  */
31825 struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_clone(const struct LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR orig);
31826
31827 /**
31828  * Creates a new CResult_OutPointDecodeErrorZ in the success state.
31829  */
31830 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_ok(struct LDKOutPoint o);
31831
31832 /**
31833  * Creates a new CResult_OutPointDecodeErrorZ in the error state.
31834  */
31835 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_err(struct LDKDecodeError e);
31836
31837 /**
31838  * Checks if the given object is currently in the success state
31839  */
31840 bool CResult_OutPointDecodeErrorZ_is_ok(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR o);
31841
31842 /**
31843  * Frees any resources used by the CResult_OutPointDecodeErrorZ.
31844  */
31845 void CResult_OutPointDecodeErrorZ_free(struct LDKCResult_OutPointDecodeErrorZ _res);
31846
31847 /**
31848  * Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
31849  * but with all dynamically-allocated buffers duplicated in new buffers.
31850  */
31851 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_clone(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR orig);
31852
31853 /**
31854  * Creates a new CResult_BigSizeDecodeErrorZ in the success state.
31855  */
31856 struct LDKCResult_BigSizeDecodeErrorZ CResult_BigSizeDecodeErrorZ_ok(struct LDKBigSize o);
31857
31858 /**
31859  * Creates a new CResult_BigSizeDecodeErrorZ in the error state.
31860  */
31861 struct LDKCResult_BigSizeDecodeErrorZ CResult_BigSizeDecodeErrorZ_err(struct LDKDecodeError e);
31862
31863 /**
31864  * Checks if the given object is currently in the success state
31865  */
31866 bool CResult_BigSizeDecodeErrorZ_is_ok(const struct LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR o);
31867
31868 /**
31869  * Frees any resources used by the CResult_BigSizeDecodeErrorZ.
31870  */
31871 void CResult_BigSizeDecodeErrorZ_free(struct LDKCResult_BigSizeDecodeErrorZ _res);
31872
31873 /**
31874  * Creates a new CResult_BigSizeDecodeErrorZ which has the same data as `orig`
31875  * but with all dynamically-allocated buffers duplicated in new buffers.
31876  */
31877 struct LDKCResult_BigSizeDecodeErrorZ CResult_BigSizeDecodeErrorZ_clone(const struct LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR orig);
31878
31879 /**
31880  * Creates a new CResult_HostnameDecodeErrorZ in the success state.
31881  */
31882 struct LDKCResult_HostnameDecodeErrorZ CResult_HostnameDecodeErrorZ_ok(struct LDKHostname o);
31883
31884 /**
31885  * Creates a new CResult_HostnameDecodeErrorZ in the error state.
31886  */
31887 struct LDKCResult_HostnameDecodeErrorZ CResult_HostnameDecodeErrorZ_err(struct LDKDecodeError e);
31888
31889 /**
31890  * Checks if the given object is currently in the success state
31891  */
31892 bool CResult_HostnameDecodeErrorZ_is_ok(const struct LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR o);
31893
31894 /**
31895  * Frees any resources used by the CResult_HostnameDecodeErrorZ.
31896  */
31897 void CResult_HostnameDecodeErrorZ_free(struct LDKCResult_HostnameDecodeErrorZ _res);
31898
31899 /**
31900  * Creates a new CResult_HostnameDecodeErrorZ which has the same data as `orig`
31901  * but with all dynamically-allocated buffers duplicated in new buffers.
31902  */
31903 struct LDKCResult_HostnameDecodeErrorZ CResult_HostnameDecodeErrorZ_clone(const struct LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR orig);
31904
31905 /**
31906  * Creates a new CResult_TransactionU16LenLimitedNoneZ in the success state.
31907  */
31908 struct LDKCResult_TransactionU16LenLimitedNoneZ CResult_TransactionU16LenLimitedNoneZ_ok(struct LDKTransactionU16LenLimited o);
31909
31910 /**
31911  * Creates a new CResult_TransactionU16LenLimitedNoneZ in the error state.
31912  */
31913 struct LDKCResult_TransactionU16LenLimitedNoneZ CResult_TransactionU16LenLimitedNoneZ_err(void);
31914
31915 /**
31916  * Checks if the given object is currently in the success state
31917  */
31918 bool CResult_TransactionU16LenLimitedNoneZ_is_ok(const struct LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR o);
31919
31920 /**
31921  * Frees any resources used by the CResult_TransactionU16LenLimitedNoneZ.
31922  */
31923 void CResult_TransactionU16LenLimitedNoneZ_free(struct LDKCResult_TransactionU16LenLimitedNoneZ _res);
31924
31925 /**
31926  * Creates a new CResult_TransactionU16LenLimitedNoneZ which has the same data as `orig`
31927  * but with all dynamically-allocated buffers duplicated in new buffers.
31928  */
31929 struct LDKCResult_TransactionU16LenLimitedNoneZ CResult_TransactionU16LenLimitedNoneZ_clone(const struct LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR orig);
31930
31931 /**
31932  * Creates a new CResult_TransactionU16LenLimitedDecodeErrorZ in the success state.
31933  */
31934 struct LDKCResult_TransactionU16LenLimitedDecodeErrorZ CResult_TransactionU16LenLimitedDecodeErrorZ_ok(struct LDKTransactionU16LenLimited o);
31935
31936 /**
31937  * Creates a new CResult_TransactionU16LenLimitedDecodeErrorZ in the error state.
31938  */
31939 struct LDKCResult_TransactionU16LenLimitedDecodeErrorZ CResult_TransactionU16LenLimitedDecodeErrorZ_err(struct LDKDecodeError e);
31940
31941 /**
31942  * Checks if the given object is currently in the success state
31943  */
31944 bool CResult_TransactionU16LenLimitedDecodeErrorZ_is_ok(const struct LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR o);
31945
31946 /**
31947  * Frees any resources used by the CResult_TransactionU16LenLimitedDecodeErrorZ.
31948  */
31949 void CResult_TransactionU16LenLimitedDecodeErrorZ_free(struct LDKCResult_TransactionU16LenLimitedDecodeErrorZ _res);
31950
31951 /**
31952  * Creates a new CResult_TransactionU16LenLimitedDecodeErrorZ which has the same data as `orig`
31953  * but with all dynamically-allocated buffers duplicated in new buffers.
31954  */
31955 struct LDKCResult_TransactionU16LenLimitedDecodeErrorZ CResult_TransactionU16LenLimitedDecodeErrorZ_clone(const struct LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR orig);
31956
31957 /**
31958  * Creates a new CResult_UntrustedStringDecodeErrorZ in the success state.
31959  */
31960 struct LDKCResult_UntrustedStringDecodeErrorZ CResult_UntrustedStringDecodeErrorZ_ok(struct LDKUntrustedString o);
31961
31962 /**
31963  * Creates a new CResult_UntrustedStringDecodeErrorZ in the error state.
31964  */
31965 struct LDKCResult_UntrustedStringDecodeErrorZ CResult_UntrustedStringDecodeErrorZ_err(struct LDKDecodeError e);
31966
31967 /**
31968  * Checks if the given object is currently in the success state
31969  */
31970 bool CResult_UntrustedStringDecodeErrorZ_is_ok(const struct LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR o);
31971
31972 /**
31973  * Frees any resources used by the CResult_UntrustedStringDecodeErrorZ.
31974  */
31975 void CResult_UntrustedStringDecodeErrorZ_free(struct LDKCResult_UntrustedStringDecodeErrorZ _res);
31976
31977 /**
31978  * Creates a new CResult_UntrustedStringDecodeErrorZ which has the same data as `orig`
31979  * but with all dynamically-allocated buffers duplicated in new buffers.
31980  */
31981 struct LDKCResult_UntrustedStringDecodeErrorZ CResult_UntrustedStringDecodeErrorZ_clone(const struct LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR orig);
31982
31983 /**
31984  * Creates a new CResult_ChannelIdDecodeErrorZ in the success state.
31985  */
31986 struct LDKCResult_ChannelIdDecodeErrorZ CResult_ChannelIdDecodeErrorZ_ok(struct LDKChannelId o);
31987
31988 /**
31989  * Creates a new CResult_ChannelIdDecodeErrorZ in the error state.
31990  */
31991 struct LDKCResult_ChannelIdDecodeErrorZ CResult_ChannelIdDecodeErrorZ_err(struct LDKDecodeError e);
31992
31993 /**
31994  * Checks if the given object is currently in the success state
31995  */
31996 bool CResult_ChannelIdDecodeErrorZ_is_ok(const struct LDKCResult_ChannelIdDecodeErrorZ *NONNULL_PTR o);
31997
31998 /**
31999  * Frees any resources used by the CResult_ChannelIdDecodeErrorZ.
32000  */
32001 void CResult_ChannelIdDecodeErrorZ_free(struct LDKCResult_ChannelIdDecodeErrorZ _res);
32002
32003 /**
32004  * Creates a new CResult_ChannelIdDecodeErrorZ which has the same data as `orig`
32005  * but with all dynamically-allocated buffers duplicated in new buffers.
32006  */
32007 struct LDKCResult_ChannelIdDecodeErrorZ CResult_ChannelIdDecodeErrorZ_clone(const struct LDKCResult_ChannelIdDecodeErrorZ *NONNULL_PTR orig);
32008
32009 /**
32010  * Creates a new tuple which has the same data as `orig`
32011  * but with all dynamically-allocated buffers duplicated in new buffers.
32012  */
32013 struct LDKC2Tuple__u832u16Z C2Tuple__u832u16Z_clone(const struct LDKC2Tuple__u832u16Z *NONNULL_PTR orig);
32014
32015 /**
32016  * Creates a new C2Tuple__u832u16Z from the contained elements.
32017  */
32018 struct LDKC2Tuple__u832u16Z C2Tuple__u832u16Z_new(struct LDKThirtyTwoBytes a, uint16_t b);
32019
32020 /**
32021  * Frees any resources used by the C2Tuple__u832u16Z.
32022  */
32023 void C2Tuple__u832u16Z_free(struct LDKC2Tuple__u832u16Z _res);
32024
32025 /**
32026  * Creates a new CResult_PaymentRelayDecodeErrorZ in the success state.
32027  */
32028 struct LDKCResult_PaymentRelayDecodeErrorZ CResult_PaymentRelayDecodeErrorZ_ok(struct LDKPaymentRelay o);
32029
32030 /**
32031  * Creates a new CResult_PaymentRelayDecodeErrorZ in the error state.
32032  */
32033 struct LDKCResult_PaymentRelayDecodeErrorZ CResult_PaymentRelayDecodeErrorZ_err(struct LDKDecodeError e);
32034
32035 /**
32036  * Checks if the given object is currently in the success state
32037  */
32038 bool CResult_PaymentRelayDecodeErrorZ_is_ok(const struct LDKCResult_PaymentRelayDecodeErrorZ *NONNULL_PTR o);
32039
32040 /**
32041  * Frees any resources used by the CResult_PaymentRelayDecodeErrorZ.
32042  */
32043 void CResult_PaymentRelayDecodeErrorZ_free(struct LDKCResult_PaymentRelayDecodeErrorZ _res);
32044
32045 /**
32046  * Creates a new CResult_PaymentRelayDecodeErrorZ which has the same data as `orig`
32047  * but with all dynamically-allocated buffers duplicated in new buffers.
32048  */
32049 struct LDKCResult_PaymentRelayDecodeErrorZ CResult_PaymentRelayDecodeErrorZ_clone(const struct LDKCResult_PaymentRelayDecodeErrorZ *NONNULL_PTR orig);
32050
32051 /**
32052  * Creates a new CResult_PaymentConstraintsDecodeErrorZ in the success state.
32053  */
32054 struct LDKCResult_PaymentConstraintsDecodeErrorZ CResult_PaymentConstraintsDecodeErrorZ_ok(struct LDKPaymentConstraints o);
32055
32056 /**
32057  * Creates a new CResult_PaymentConstraintsDecodeErrorZ in the error state.
32058  */
32059 struct LDKCResult_PaymentConstraintsDecodeErrorZ CResult_PaymentConstraintsDecodeErrorZ_err(struct LDKDecodeError e);
32060
32061 /**
32062  * Checks if the given object is currently in the success state
32063  */
32064 bool CResult_PaymentConstraintsDecodeErrorZ_is_ok(const struct LDKCResult_PaymentConstraintsDecodeErrorZ *NONNULL_PTR o);
32065
32066 /**
32067  * Frees any resources used by the CResult_PaymentConstraintsDecodeErrorZ.
32068  */
32069 void CResult_PaymentConstraintsDecodeErrorZ_free(struct LDKCResult_PaymentConstraintsDecodeErrorZ _res);
32070
32071 /**
32072  * Creates a new CResult_PaymentConstraintsDecodeErrorZ which has the same data as `orig`
32073  * but with all dynamically-allocated buffers duplicated in new buffers.
32074  */
32075 struct LDKCResult_PaymentConstraintsDecodeErrorZ CResult_PaymentConstraintsDecodeErrorZ_clone(const struct LDKCResult_PaymentConstraintsDecodeErrorZ *NONNULL_PTR orig);
32076
32077 /**
32078  * Creates a new CResult_PaymentContextDecodeErrorZ in the success state.
32079  */
32080 struct LDKCResult_PaymentContextDecodeErrorZ CResult_PaymentContextDecodeErrorZ_ok(struct LDKPaymentContext o);
32081
32082 /**
32083  * Creates a new CResult_PaymentContextDecodeErrorZ in the error state.
32084  */
32085 struct LDKCResult_PaymentContextDecodeErrorZ CResult_PaymentContextDecodeErrorZ_err(struct LDKDecodeError e);
32086
32087 /**
32088  * Checks if the given object is currently in the success state
32089  */
32090 bool CResult_PaymentContextDecodeErrorZ_is_ok(const struct LDKCResult_PaymentContextDecodeErrorZ *NONNULL_PTR o);
32091
32092 /**
32093  * Frees any resources used by the CResult_PaymentContextDecodeErrorZ.
32094  */
32095 void CResult_PaymentContextDecodeErrorZ_free(struct LDKCResult_PaymentContextDecodeErrorZ _res);
32096
32097 /**
32098  * Creates a new CResult_PaymentContextDecodeErrorZ which has the same data as `orig`
32099  * but with all dynamically-allocated buffers duplicated in new buffers.
32100  */
32101 struct LDKCResult_PaymentContextDecodeErrorZ CResult_PaymentContextDecodeErrorZ_clone(const struct LDKCResult_PaymentContextDecodeErrorZ *NONNULL_PTR orig);
32102
32103 /**
32104  * Creates a new CResult_UnknownPaymentContextDecodeErrorZ in the success state.
32105  */
32106 struct LDKCResult_UnknownPaymentContextDecodeErrorZ CResult_UnknownPaymentContextDecodeErrorZ_ok(struct LDKUnknownPaymentContext o);
32107
32108 /**
32109  * Creates a new CResult_UnknownPaymentContextDecodeErrorZ in the error state.
32110  */
32111 struct LDKCResult_UnknownPaymentContextDecodeErrorZ CResult_UnknownPaymentContextDecodeErrorZ_err(struct LDKDecodeError e);
32112
32113 /**
32114  * Checks if the given object is currently in the success state
32115  */
32116 bool CResult_UnknownPaymentContextDecodeErrorZ_is_ok(const struct LDKCResult_UnknownPaymentContextDecodeErrorZ *NONNULL_PTR o);
32117
32118 /**
32119  * Frees any resources used by the CResult_UnknownPaymentContextDecodeErrorZ.
32120  */
32121 void CResult_UnknownPaymentContextDecodeErrorZ_free(struct LDKCResult_UnknownPaymentContextDecodeErrorZ _res);
32122
32123 /**
32124  * Creates a new CResult_UnknownPaymentContextDecodeErrorZ which has the same data as `orig`
32125  * but with all dynamically-allocated buffers duplicated in new buffers.
32126  */
32127 struct LDKCResult_UnknownPaymentContextDecodeErrorZ CResult_UnknownPaymentContextDecodeErrorZ_clone(const struct LDKCResult_UnknownPaymentContextDecodeErrorZ *NONNULL_PTR orig);
32128
32129 /**
32130  * Creates a new CResult_Bolt12OfferContextDecodeErrorZ in the success state.
32131  */
32132 struct LDKCResult_Bolt12OfferContextDecodeErrorZ CResult_Bolt12OfferContextDecodeErrorZ_ok(struct LDKBolt12OfferContext o);
32133
32134 /**
32135  * Creates a new CResult_Bolt12OfferContextDecodeErrorZ in the error state.
32136  */
32137 struct LDKCResult_Bolt12OfferContextDecodeErrorZ CResult_Bolt12OfferContextDecodeErrorZ_err(struct LDKDecodeError e);
32138
32139 /**
32140  * Checks if the given object is currently in the success state
32141  */
32142 bool CResult_Bolt12OfferContextDecodeErrorZ_is_ok(const struct LDKCResult_Bolt12OfferContextDecodeErrorZ *NONNULL_PTR o);
32143
32144 /**
32145  * Frees any resources used by the CResult_Bolt12OfferContextDecodeErrorZ.
32146  */
32147 void CResult_Bolt12OfferContextDecodeErrorZ_free(struct LDKCResult_Bolt12OfferContextDecodeErrorZ _res);
32148
32149 /**
32150  * Creates a new CResult_Bolt12OfferContextDecodeErrorZ which has the same data as `orig`
32151  * but with all dynamically-allocated buffers duplicated in new buffers.
32152  */
32153 struct LDKCResult_Bolt12OfferContextDecodeErrorZ CResult_Bolt12OfferContextDecodeErrorZ_clone(const struct LDKCResult_Bolt12OfferContextDecodeErrorZ *NONNULL_PTR orig);
32154
32155 /**
32156  * Creates a new CResult_Bolt12RefundContextDecodeErrorZ in the success state.
32157  */
32158 struct LDKCResult_Bolt12RefundContextDecodeErrorZ CResult_Bolt12RefundContextDecodeErrorZ_ok(struct LDKBolt12RefundContext o);
32159
32160 /**
32161  * Creates a new CResult_Bolt12RefundContextDecodeErrorZ in the error state.
32162  */
32163 struct LDKCResult_Bolt12RefundContextDecodeErrorZ CResult_Bolt12RefundContextDecodeErrorZ_err(struct LDKDecodeError e);
32164
32165 /**
32166  * Checks if the given object is currently in the success state
32167  */
32168 bool CResult_Bolt12RefundContextDecodeErrorZ_is_ok(const struct LDKCResult_Bolt12RefundContextDecodeErrorZ *NONNULL_PTR o);
32169
32170 /**
32171  * Frees any resources used by the CResult_Bolt12RefundContextDecodeErrorZ.
32172  */
32173 void CResult_Bolt12RefundContextDecodeErrorZ_free(struct LDKCResult_Bolt12RefundContextDecodeErrorZ _res);
32174
32175 /**
32176  * Creates a new CResult_Bolt12RefundContextDecodeErrorZ which has the same data as `orig`
32177  * but with all dynamically-allocated buffers duplicated in new buffers.
32178  */
32179 struct LDKCResult_Bolt12RefundContextDecodeErrorZ CResult_Bolt12RefundContextDecodeErrorZ_clone(const struct LDKCResult_Bolt12RefundContextDecodeErrorZ *NONNULL_PTR orig);
32180
32181 /**
32182  * Creates a new CResult_StrSecp256k1ErrorZ in the success state.
32183  */
32184 struct LDKCResult_StrSecp256k1ErrorZ CResult_StrSecp256k1ErrorZ_ok(struct LDKStr o);
32185
32186 /**
32187  * Creates a new CResult_StrSecp256k1ErrorZ in the error state.
32188  */
32189 struct LDKCResult_StrSecp256k1ErrorZ CResult_StrSecp256k1ErrorZ_err(enum LDKSecp256k1Error e);
32190
32191 /**
32192  * Checks if the given object is currently in the success state
32193  */
32194 bool CResult_StrSecp256k1ErrorZ_is_ok(const struct LDKCResult_StrSecp256k1ErrorZ *NONNULL_PTR o);
32195
32196 /**
32197  * Frees any resources used by the CResult_StrSecp256k1ErrorZ.
32198  */
32199 void CResult_StrSecp256k1ErrorZ_free(struct LDKCResult_StrSecp256k1ErrorZ _res);
32200
32201 /**
32202  * Creates a new CResult_StrSecp256k1ErrorZ which has the same data as `orig`
32203  * but with all dynamically-allocated buffers duplicated in new buffers.
32204  */
32205 struct LDKCResult_StrSecp256k1ErrorZ CResult_StrSecp256k1ErrorZ_clone(const struct LDKCResult_StrSecp256k1ErrorZ *NONNULL_PTR orig);
32206
32207 /**
32208  * Creates a new tuple which has the same data as `orig`
32209  * but with all dynamically-allocated buffers duplicated in new buffers.
32210  */
32211 struct LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone(const struct LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ *NONNULL_PTR orig);
32212
32213 /**
32214  * Creates a new C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ from the contained elements.
32215  */
32216 struct LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_new(struct LDKThirtyTwoBytes a, struct LDKRecipientOnionFields b, struct LDKRouteParameters c);
32217
32218 /**
32219  * Frees any resources used by the C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ.
32220  */
32221 void C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_free(struct LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ _res);
32222
32223 /**
32224  * Creates a new CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ in the success state.
32225  */
32226 struct LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_ok(struct LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ o);
32227
32228 /**
32229  * Creates a new CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ in the error state.
32230  */
32231 struct LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_err(void);
32232
32233 /**
32234  * Checks if the given object is currently in the success state
32235  */
32236 bool CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_is_ok(const struct LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ *NONNULL_PTR o);
32237
32238 /**
32239  * Frees any resources used by the CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ.
32240  */
32241 void CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_free(struct LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ _res);
32242
32243 /**
32244  * Creates a new CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ which has the same data as `orig`
32245  * but with all dynamically-allocated buffers duplicated in new buffers.
32246  */
32247 struct LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone(const struct LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ *NONNULL_PTR orig);
32248
32249 /**
32250  * Creates a new CResult_TxOutUtxoLookupErrorZ in the success state.
32251  */
32252 struct LDKCResult_TxOutUtxoLookupErrorZ CResult_TxOutUtxoLookupErrorZ_ok(struct LDKTxOut o);
32253
32254 /**
32255  * Creates a new CResult_TxOutUtxoLookupErrorZ in the error state.
32256  */
32257 struct LDKCResult_TxOutUtxoLookupErrorZ CResult_TxOutUtxoLookupErrorZ_err(enum LDKUtxoLookupError e);
32258
32259 /**
32260  * Checks if the given object is currently in the success state
32261  */
32262 bool CResult_TxOutUtxoLookupErrorZ_is_ok(const struct LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR o);
32263
32264 /**
32265  * Frees any resources used by the CResult_TxOutUtxoLookupErrorZ.
32266  */
32267 void CResult_TxOutUtxoLookupErrorZ_free(struct LDKCResult_TxOutUtxoLookupErrorZ _res);
32268
32269 /**
32270  * Creates a new CResult_TxOutUtxoLookupErrorZ which has the same data as `orig`
32271  * but with all dynamically-allocated buffers duplicated in new buffers.
32272  */
32273 struct LDKCResult_TxOutUtxoLookupErrorZ CResult_TxOutUtxoLookupErrorZ_clone(const struct LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR orig);
32274
32275 /**
32276  * Creates a new tuple which has the same data as `orig`
32277  * but with all dynamically-allocated buffers duplicated in new buffers.
32278  */
32279 struct LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone(const struct LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ *NONNULL_PTR orig);
32280
32281 /**
32282  * Creates a new C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ from the contained elements.
32283  */
32284 struct LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_new(struct LDKPublicKey a, struct LDKOnionMessage b, struct LDKCOption_CVec_SocketAddressZZ c);
32285
32286 /**
32287  * Frees any resources used by the C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ.
32288  */
32289 void C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_free(struct LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ _res);
32290
32291 /**
32292  * Creates a new CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ in the success state.
32293  */
32294 struct LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_ok(struct LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ o);
32295
32296 /**
32297  * Creates a new CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ in the error state.
32298  */
32299 struct LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_err(struct LDKSendError e);
32300
32301 /**
32302  * Checks if the given object is currently in the success state
32303  */
32304 bool CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_is_ok(const struct LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ *NONNULL_PTR o);
32305
32306 /**
32307  * Frees any resources used by the CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ.
32308  */
32309 void CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_free(struct LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ _res);
32310
32311 /**
32312  * Creates a new CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ which has the same data as `orig`
32313  * but with all dynamically-allocated buffers duplicated in new buffers.
32314  */
32315 struct LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_clone(const struct LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ *NONNULL_PTR orig);
32316
32317 /**
32318  * Creates a new CResult_PeeledOnionNoneZ in the success state.
32319  */
32320 struct LDKCResult_PeeledOnionNoneZ CResult_PeeledOnionNoneZ_ok(struct LDKPeeledOnion o);
32321
32322 /**
32323  * Creates a new CResult_PeeledOnionNoneZ in the error state.
32324  */
32325 struct LDKCResult_PeeledOnionNoneZ CResult_PeeledOnionNoneZ_err(void);
32326
32327 /**
32328  * Checks if the given object is currently in the success state
32329  */
32330 bool CResult_PeeledOnionNoneZ_is_ok(const struct LDKCResult_PeeledOnionNoneZ *NONNULL_PTR o);
32331
32332 /**
32333  * Frees any resources used by the CResult_PeeledOnionNoneZ.
32334  */
32335 void CResult_PeeledOnionNoneZ_free(struct LDKCResult_PeeledOnionNoneZ _res);
32336
32337 /**
32338  * Creates a new CResult_PeeledOnionNoneZ which has the same data as `orig`
32339  * but with all dynamically-allocated buffers duplicated in new buffers.
32340  */
32341 struct LDKCResult_PeeledOnionNoneZ CResult_PeeledOnionNoneZ_clone(const struct LDKCResult_PeeledOnionNoneZ *NONNULL_PTR orig);
32342
32343 /**
32344  * Creates a new CResult_SendSuccessSendErrorZ in the success state.
32345  */
32346 struct LDKCResult_SendSuccessSendErrorZ CResult_SendSuccessSendErrorZ_ok(struct LDKSendSuccess o);
32347
32348 /**
32349  * Creates a new CResult_SendSuccessSendErrorZ in the error state.
32350  */
32351 struct LDKCResult_SendSuccessSendErrorZ CResult_SendSuccessSendErrorZ_err(struct LDKSendError e);
32352
32353 /**
32354  * Checks if the given object is currently in the success state
32355  */
32356 bool CResult_SendSuccessSendErrorZ_is_ok(const struct LDKCResult_SendSuccessSendErrorZ *NONNULL_PTR o);
32357
32358 /**
32359  * Frees any resources used by the CResult_SendSuccessSendErrorZ.
32360  */
32361 void CResult_SendSuccessSendErrorZ_free(struct LDKCResult_SendSuccessSendErrorZ _res);
32362
32363 /**
32364  * Creates a new CResult_SendSuccessSendErrorZ which has the same data as `orig`
32365  * but with all dynamically-allocated buffers duplicated in new buffers.
32366  */
32367 struct LDKCResult_SendSuccessSendErrorZ CResult_SendSuccessSendErrorZ_clone(const struct LDKCResult_SendSuccessSendErrorZ *NONNULL_PTR orig);
32368
32369 /**
32370  * Creates a new CResult_BlindedPathNoneZ in the success state.
32371  */
32372 struct LDKCResult_BlindedPathNoneZ CResult_BlindedPathNoneZ_ok(struct LDKBlindedPath o);
32373
32374 /**
32375  * Creates a new CResult_BlindedPathNoneZ in the error state.
32376  */
32377 struct LDKCResult_BlindedPathNoneZ CResult_BlindedPathNoneZ_err(void);
32378
32379 /**
32380  * Checks if the given object is currently in the success state
32381  */
32382 bool CResult_BlindedPathNoneZ_is_ok(const struct LDKCResult_BlindedPathNoneZ *NONNULL_PTR o);
32383
32384 /**
32385  * Frees any resources used by the CResult_BlindedPathNoneZ.
32386  */
32387 void CResult_BlindedPathNoneZ_free(struct LDKCResult_BlindedPathNoneZ _res);
32388
32389 /**
32390  * Creates a new CResult_BlindedPathNoneZ which has the same data as `orig`
32391  * but with all dynamically-allocated buffers duplicated in new buffers.
32392  */
32393 struct LDKCResult_BlindedPathNoneZ CResult_BlindedPathNoneZ_clone(const struct LDKCResult_BlindedPathNoneZ *NONNULL_PTR orig);
32394
32395 /**
32396  * Creates a new CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ in the success state.
32397  */
32398 struct LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_ok(struct LDKC2Tuple_BlindedPayInfoBlindedPathZ o);
32399
32400 /**
32401  * Creates a new CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ in the error state.
32402  */
32403 struct LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_err(void);
32404
32405 /**
32406  * Checks if the given object is currently in the success state
32407  */
32408 bool CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_is_ok(const struct LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ *NONNULL_PTR o);
32409
32410 /**
32411  * Frees any resources used by the CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ.
32412  */
32413 void CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_free(struct LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ _res);
32414
32415 /**
32416  * Creates a new CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ which has the same data as `orig`
32417  * but with all dynamically-allocated buffers duplicated in new buffers.
32418  */
32419 struct LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone(const struct LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ *NONNULL_PTR orig);
32420
32421 /**
32422  * Frees the buffer pointed to by `data` if `datalen` is non-0.
32423  */
32424 void CVec_ForwardNodeZ_free(struct LDKCVec_ForwardNodeZ _res);
32425
32426 /**
32427  * Creates a new CResult_BlindedPathDecodeErrorZ in the success state.
32428  */
32429 struct LDKCResult_BlindedPathDecodeErrorZ CResult_BlindedPathDecodeErrorZ_ok(struct LDKBlindedPath o);
32430
32431 /**
32432  * Creates a new CResult_BlindedPathDecodeErrorZ in the error state.
32433  */
32434 struct LDKCResult_BlindedPathDecodeErrorZ CResult_BlindedPathDecodeErrorZ_err(struct LDKDecodeError e);
32435
32436 /**
32437  * Checks if the given object is currently in the success state
32438  */
32439 bool CResult_BlindedPathDecodeErrorZ_is_ok(const struct LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR o);
32440
32441 /**
32442  * Frees any resources used by the CResult_BlindedPathDecodeErrorZ.
32443  */
32444 void CResult_BlindedPathDecodeErrorZ_free(struct LDKCResult_BlindedPathDecodeErrorZ _res);
32445
32446 /**
32447  * Creates a new CResult_BlindedPathDecodeErrorZ which has the same data as `orig`
32448  * but with all dynamically-allocated buffers duplicated in new buffers.
32449  */
32450 struct LDKCResult_BlindedPathDecodeErrorZ CResult_BlindedPathDecodeErrorZ_clone(const struct LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR orig);
32451
32452 /**
32453  * Creates a new CResult_BlindedHopDecodeErrorZ in the success state.
32454  */
32455 struct LDKCResult_BlindedHopDecodeErrorZ CResult_BlindedHopDecodeErrorZ_ok(struct LDKBlindedHop o);
32456
32457 /**
32458  * Creates a new CResult_BlindedHopDecodeErrorZ in the error state.
32459  */
32460 struct LDKCResult_BlindedHopDecodeErrorZ CResult_BlindedHopDecodeErrorZ_err(struct LDKDecodeError e);
32461
32462 /**
32463  * Checks if the given object is currently in the success state
32464  */
32465 bool CResult_BlindedHopDecodeErrorZ_is_ok(const struct LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR o);
32466
32467 /**
32468  * Frees any resources used by the CResult_BlindedHopDecodeErrorZ.
32469  */
32470 void CResult_BlindedHopDecodeErrorZ_free(struct LDKCResult_BlindedHopDecodeErrorZ _res);
32471
32472 /**
32473  * Creates a new CResult_BlindedHopDecodeErrorZ which has the same data as `orig`
32474  * but with all dynamically-allocated buffers duplicated in new buffers.
32475  */
32476 struct LDKCResult_BlindedHopDecodeErrorZ CResult_BlindedHopDecodeErrorZ_clone(const struct LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR orig);
32477
32478 /**
32479  * Creates a new CResult_InvoiceErrorDecodeErrorZ in the success state.
32480  */
32481 struct LDKCResult_InvoiceErrorDecodeErrorZ CResult_InvoiceErrorDecodeErrorZ_ok(struct LDKInvoiceError o);
32482
32483 /**
32484  * Creates a new CResult_InvoiceErrorDecodeErrorZ in the error state.
32485  */
32486 struct LDKCResult_InvoiceErrorDecodeErrorZ CResult_InvoiceErrorDecodeErrorZ_err(struct LDKDecodeError e);
32487
32488 /**
32489  * Checks if the given object is currently in the success state
32490  */
32491 bool CResult_InvoiceErrorDecodeErrorZ_is_ok(const struct LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR o);
32492
32493 /**
32494  * Frees any resources used by the CResult_InvoiceErrorDecodeErrorZ.
32495  */
32496 void CResult_InvoiceErrorDecodeErrorZ_free(struct LDKCResult_InvoiceErrorDecodeErrorZ _res);
32497
32498 /**
32499  * Creates a new CResult_InvoiceErrorDecodeErrorZ which has the same data as `orig`
32500  * but with all dynamically-allocated buffers duplicated in new buffers.
32501  */
32502 struct LDKCResult_InvoiceErrorDecodeErrorZ CResult_InvoiceErrorDecodeErrorZ_clone(const struct LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR orig);
32503
32504 /**
32505  * Creates a new CResult_TrackedSpendableOutputDecodeErrorZ in the success state.
32506  */
32507 struct LDKCResult_TrackedSpendableOutputDecodeErrorZ CResult_TrackedSpendableOutputDecodeErrorZ_ok(struct LDKTrackedSpendableOutput o);
32508
32509 /**
32510  * Creates a new CResult_TrackedSpendableOutputDecodeErrorZ in the error state.
32511  */
32512 struct LDKCResult_TrackedSpendableOutputDecodeErrorZ CResult_TrackedSpendableOutputDecodeErrorZ_err(struct LDKDecodeError e);
32513
32514 /**
32515  * Checks if the given object is currently in the success state
32516  */
32517 bool CResult_TrackedSpendableOutputDecodeErrorZ_is_ok(const struct LDKCResult_TrackedSpendableOutputDecodeErrorZ *NONNULL_PTR o);
32518
32519 /**
32520  * Frees any resources used by the CResult_TrackedSpendableOutputDecodeErrorZ.
32521  */
32522 void CResult_TrackedSpendableOutputDecodeErrorZ_free(struct LDKCResult_TrackedSpendableOutputDecodeErrorZ _res);
32523
32524 /**
32525  * Creates a new CResult_TrackedSpendableOutputDecodeErrorZ which has the same data as `orig`
32526  * but with all dynamically-allocated buffers duplicated in new buffers.
32527  */
32528 struct LDKCResult_TrackedSpendableOutputDecodeErrorZ CResult_TrackedSpendableOutputDecodeErrorZ_clone(const struct LDKCResult_TrackedSpendableOutputDecodeErrorZ *NONNULL_PTR orig);
32529
32530 /**
32531  * Creates a new CResult_OutputSpendStatusDecodeErrorZ in the success state.
32532  */
32533 struct LDKCResult_OutputSpendStatusDecodeErrorZ CResult_OutputSpendStatusDecodeErrorZ_ok(struct LDKOutputSpendStatus o);
32534
32535 /**
32536  * Creates a new CResult_OutputSpendStatusDecodeErrorZ in the error state.
32537  */
32538 struct LDKCResult_OutputSpendStatusDecodeErrorZ CResult_OutputSpendStatusDecodeErrorZ_err(struct LDKDecodeError e);
32539
32540 /**
32541  * Checks if the given object is currently in the success state
32542  */
32543 bool CResult_OutputSpendStatusDecodeErrorZ_is_ok(const struct LDKCResult_OutputSpendStatusDecodeErrorZ *NONNULL_PTR o);
32544
32545 /**
32546  * Frees any resources used by the CResult_OutputSpendStatusDecodeErrorZ.
32547  */
32548 void CResult_OutputSpendStatusDecodeErrorZ_free(struct LDKCResult_OutputSpendStatusDecodeErrorZ _res);
32549
32550 /**
32551  * Creates a new CResult_OutputSpendStatusDecodeErrorZ which has the same data as `orig`
32552  * but with all dynamically-allocated buffers duplicated in new buffers.
32553  */
32554 struct LDKCResult_OutputSpendStatusDecodeErrorZ CResult_OutputSpendStatusDecodeErrorZ_clone(const struct LDKCResult_OutputSpendStatusDecodeErrorZ *NONNULL_PTR orig);
32555
32556 /**
32557  * Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter
32558  */
32559 struct LDKCOption_FilterZ COption_FilterZ_some(struct LDKFilter o);
32560
32561 /**
32562  * Constructs a new COption_FilterZ containing nothing
32563  */
32564 struct LDKCOption_FilterZ COption_FilterZ_none(void);
32565
32566 /**
32567  * Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state
32568  */
32569 void COption_FilterZ_free(struct LDKCOption_FilterZ _res);
32570
32571 /**
32572  * Frees the buffer pointed to by `data` if `datalen` is non-0.
32573  */
32574 void CVec_TrackedSpendableOutputZ_free(struct LDKCVec_TrackedSpendableOutputZ _res);
32575
32576 /**
32577  * Creates a new CResult_OutputSweeperDecodeErrorZ in the success state.
32578  */
32579 struct LDKCResult_OutputSweeperDecodeErrorZ CResult_OutputSweeperDecodeErrorZ_ok(struct LDKOutputSweeper o);
32580
32581 /**
32582  * Creates a new CResult_OutputSweeperDecodeErrorZ in the error state.
32583  */
32584 struct LDKCResult_OutputSweeperDecodeErrorZ CResult_OutputSweeperDecodeErrorZ_err(struct LDKDecodeError e);
32585
32586 /**
32587  * Checks if the given object is currently in the success state
32588  */
32589 bool CResult_OutputSweeperDecodeErrorZ_is_ok(const struct LDKCResult_OutputSweeperDecodeErrorZ *NONNULL_PTR o);
32590
32591 /**
32592  * Frees any resources used by the CResult_OutputSweeperDecodeErrorZ.
32593  */
32594 void CResult_OutputSweeperDecodeErrorZ_free(struct LDKCResult_OutputSweeperDecodeErrorZ _res);
32595
32596 /**
32597  * Creates a new C2Tuple_BestBlockOutputSweeperZ from the contained elements.
32598  */
32599 struct LDKC2Tuple_BestBlockOutputSweeperZ C2Tuple_BestBlockOutputSweeperZ_new(struct LDKBestBlock a, struct LDKOutputSweeper b);
32600
32601 /**
32602  * Frees any resources used by the C2Tuple_BestBlockOutputSweeperZ.
32603  */
32604 void C2Tuple_BestBlockOutputSweeperZ_free(struct LDKC2Tuple_BestBlockOutputSweeperZ _res);
32605
32606 /**
32607  * Creates a new CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ in the success state.
32608  */
32609 struct LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_ok(struct LDKC2Tuple_BestBlockOutputSweeperZ o);
32610
32611 /**
32612  * Creates a new CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ in the error state.
32613  */
32614 struct LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_err(struct LDKDecodeError e);
32615
32616 /**
32617  * Checks if the given object is currently in the success state
32618  */
32619 bool CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_is_ok(const struct LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ *NONNULL_PTR o);
32620
32621 /**
32622  * Frees any resources used by the CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ.
32623  */
32624 void CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ _res);
32625
32626 /**
32627  * Creates a new CResult_DelayedPaymentBasepointDecodeErrorZ in the success state.
32628  */
32629 struct LDKCResult_DelayedPaymentBasepointDecodeErrorZ CResult_DelayedPaymentBasepointDecodeErrorZ_ok(struct LDKDelayedPaymentBasepoint o);
32630
32631 /**
32632  * Creates a new CResult_DelayedPaymentBasepointDecodeErrorZ in the error state.
32633  */
32634 struct LDKCResult_DelayedPaymentBasepointDecodeErrorZ CResult_DelayedPaymentBasepointDecodeErrorZ_err(struct LDKDecodeError e);
32635
32636 /**
32637  * Checks if the given object is currently in the success state
32638  */
32639 bool CResult_DelayedPaymentBasepointDecodeErrorZ_is_ok(const struct LDKCResult_DelayedPaymentBasepointDecodeErrorZ *NONNULL_PTR o);
32640
32641 /**
32642  * Frees any resources used by the CResult_DelayedPaymentBasepointDecodeErrorZ.
32643  */
32644 void CResult_DelayedPaymentBasepointDecodeErrorZ_free(struct LDKCResult_DelayedPaymentBasepointDecodeErrorZ _res);
32645
32646 /**
32647  * Creates a new CResult_DelayedPaymentBasepointDecodeErrorZ which has the same data as `orig`
32648  * but with all dynamically-allocated buffers duplicated in new buffers.
32649  */
32650 struct LDKCResult_DelayedPaymentBasepointDecodeErrorZ CResult_DelayedPaymentBasepointDecodeErrorZ_clone(const struct LDKCResult_DelayedPaymentBasepointDecodeErrorZ *NONNULL_PTR orig);
32651
32652 /**
32653  * Creates a new CResult_DelayedPaymentKeyDecodeErrorZ in the success state.
32654  */
32655 struct LDKCResult_DelayedPaymentKeyDecodeErrorZ CResult_DelayedPaymentKeyDecodeErrorZ_ok(struct LDKDelayedPaymentKey o);
32656
32657 /**
32658  * Creates a new CResult_DelayedPaymentKeyDecodeErrorZ in the error state.
32659  */
32660 struct LDKCResult_DelayedPaymentKeyDecodeErrorZ CResult_DelayedPaymentKeyDecodeErrorZ_err(struct LDKDecodeError e);
32661
32662 /**
32663  * Checks if the given object is currently in the success state
32664  */
32665 bool CResult_DelayedPaymentKeyDecodeErrorZ_is_ok(const struct LDKCResult_DelayedPaymentKeyDecodeErrorZ *NONNULL_PTR o);
32666
32667 /**
32668  * Frees any resources used by the CResult_DelayedPaymentKeyDecodeErrorZ.
32669  */
32670 void CResult_DelayedPaymentKeyDecodeErrorZ_free(struct LDKCResult_DelayedPaymentKeyDecodeErrorZ _res);
32671
32672 /**
32673  * Creates a new CResult_DelayedPaymentKeyDecodeErrorZ which has the same data as `orig`
32674  * but with all dynamically-allocated buffers duplicated in new buffers.
32675  */
32676 struct LDKCResult_DelayedPaymentKeyDecodeErrorZ CResult_DelayedPaymentKeyDecodeErrorZ_clone(const struct LDKCResult_DelayedPaymentKeyDecodeErrorZ *NONNULL_PTR orig);
32677
32678 /**
32679  * Creates a new CResult_HtlcBasepointDecodeErrorZ in the success state.
32680  */
32681 struct LDKCResult_HtlcBasepointDecodeErrorZ CResult_HtlcBasepointDecodeErrorZ_ok(struct LDKHtlcBasepoint o);
32682
32683 /**
32684  * Creates a new CResult_HtlcBasepointDecodeErrorZ in the error state.
32685  */
32686 struct LDKCResult_HtlcBasepointDecodeErrorZ CResult_HtlcBasepointDecodeErrorZ_err(struct LDKDecodeError e);
32687
32688 /**
32689  * Checks if the given object is currently in the success state
32690  */
32691 bool CResult_HtlcBasepointDecodeErrorZ_is_ok(const struct LDKCResult_HtlcBasepointDecodeErrorZ *NONNULL_PTR o);
32692
32693 /**
32694  * Frees any resources used by the CResult_HtlcBasepointDecodeErrorZ.
32695  */
32696 void CResult_HtlcBasepointDecodeErrorZ_free(struct LDKCResult_HtlcBasepointDecodeErrorZ _res);
32697
32698 /**
32699  * Creates a new CResult_HtlcBasepointDecodeErrorZ which has the same data as `orig`
32700  * but with all dynamically-allocated buffers duplicated in new buffers.
32701  */
32702 struct LDKCResult_HtlcBasepointDecodeErrorZ CResult_HtlcBasepointDecodeErrorZ_clone(const struct LDKCResult_HtlcBasepointDecodeErrorZ *NONNULL_PTR orig);
32703
32704 /**
32705  * Creates a new CResult_HtlcKeyDecodeErrorZ in the success state.
32706  */
32707 struct LDKCResult_HtlcKeyDecodeErrorZ CResult_HtlcKeyDecodeErrorZ_ok(struct LDKHtlcKey o);
32708
32709 /**
32710  * Creates a new CResult_HtlcKeyDecodeErrorZ in the error state.
32711  */
32712 struct LDKCResult_HtlcKeyDecodeErrorZ CResult_HtlcKeyDecodeErrorZ_err(struct LDKDecodeError e);
32713
32714 /**
32715  * Checks if the given object is currently in the success state
32716  */
32717 bool CResult_HtlcKeyDecodeErrorZ_is_ok(const struct LDKCResult_HtlcKeyDecodeErrorZ *NONNULL_PTR o);
32718
32719 /**
32720  * Frees any resources used by the CResult_HtlcKeyDecodeErrorZ.
32721  */
32722 void CResult_HtlcKeyDecodeErrorZ_free(struct LDKCResult_HtlcKeyDecodeErrorZ _res);
32723
32724 /**
32725  * Creates a new CResult_HtlcKeyDecodeErrorZ which has the same data as `orig`
32726  * but with all dynamically-allocated buffers duplicated in new buffers.
32727  */
32728 struct LDKCResult_HtlcKeyDecodeErrorZ CResult_HtlcKeyDecodeErrorZ_clone(const struct LDKCResult_HtlcKeyDecodeErrorZ *NONNULL_PTR orig);
32729
32730 /**
32731  * Creates a new CResult_RevocationBasepointDecodeErrorZ in the success state.
32732  */
32733 struct LDKCResult_RevocationBasepointDecodeErrorZ CResult_RevocationBasepointDecodeErrorZ_ok(struct LDKRevocationBasepoint o);
32734
32735 /**
32736  * Creates a new CResult_RevocationBasepointDecodeErrorZ in the error state.
32737  */
32738 struct LDKCResult_RevocationBasepointDecodeErrorZ CResult_RevocationBasepointDecodeErrorZ_err(struct LDKDecodeError e);
32739
32740 /**
32741  * Checks if the given object is currently in the success state
32742  */
32743 bool CResult_RevocationBasepointDecodeErrorZ_is_ok(const struct LDKCResult_RevocationBasepointDecodeErrorZ *NONNULL_PTR o);
32744
32745 /**
32746  * Frees any resources used by the CResult_RevocationBasepointDecodeErrorZ.
32747  */
32748 void CResult_RevocationBasepointDecodeErrorZ_free(struct LDKCResult_RevocationBasepointDecodeErrorZ _res);
32749
32750 /**
32751  * Creates a new CResult_RevocationBasepointDecodeErrorZ which has the same data as `orig`
32752  * but with all dynamically-allocated buffers duplicated in new buffers.
32753  */
32754 struct LDKCResult_RevocationBasepointDecodeErrorZ CResult_RevocationBasepointDecodeErrorZ_clone(const struct LDKCResult_RevocationBasepointDecodeErrorZ *NONNULL_PTR orig);
32755
32756 /**
32757  * Creates a new CResult_RevocationKeyDecodeErrorZ in the success state.
32758  */
32759 struct LDKCResult_RevocationKeyDecodeErrorZ CResult_RevocationKeyDecodeErrorZ_ok(struct LDKRevocationKey o);
32760
32761 /**
32762  * Creates a new CResult_RevocationKeyDecodeErrorZ in the error state.
32763  */
32764 struct LDKCResult_RevocationKeyDecodeErrorZ CResult_RevocationKeyDecodeErrorZ_err(struct LDKDecodeError e);
32765
32766 /**
32767  * Checks if the given object is currently in the success state
32768  */
32769 bool CResult_RevocationKeyDecodeErrorZ_is_ok(const struct LDKCResult_RevocationKeyDecodeErrorZ *NONNULL_PTR o);
32770
32771 /**
32772  * Frees any resources used by the CResult_RevocationKeyDecodeErrorZ.
32773  */
32774 void CResult_RevocationKeyDecodeErrorZ_free(struct LDKCResult_RevocationKeyDecodeErrorZ _res);
32775
32776 /**
32777  * Creates a new CResult_RevocationKeyDecodeErrorZ which has the same data as `orig`
32778  * but with all dynamically-allocated buffers duplicated in new buffers.
32779  */
32780 struct LDKCResult_RevocationKeyDecodeErrorZ CResult_RevocationKeyDecodeErrorZ_clone(const struct LDKCResult_RevocationKeyDecodeErrorZ *NONNULL_PTR orig);
32781
32782 /**
32783  * Creates a new CResult_LockedChannelMonitorNoneZ in the success state.
32784  */
32785 struct LDKCResult_LockedChannelMonitorNoneZ CResult_LockedChannelMonitorNoneZ_ok(struct LDKLockedChannelMonitor o);
32786
32787 /**
32788  * Creates a new CResult_LockedChannelMonitorNoneZ in the error state.
32789  */
32790 struct LDKCResult_LockedChannelMonitorNoneZ CResult_LockedChannelMonitorNoneZ_err(void);
32791
32792 /**
32793  * Checks if the given object is currently in the success state
32794  */
32795 bool CResult_LockedChannelMonitorNoneZ_is_ok(const struct LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR o);
32796
32797 /**
32798  * Frees any resources used by the CResult_LockedChannelMonitorNoneZ.
32799  */
32800 void CResult_LockedChannelMonitorNoneZ_free(struct LDKCResult_LockedChannelMonitorNoneZ _res);
32801
32802 /**
32803  * Creates a new tuple which has the same data as `orig`
32804  * but with all dynamically-allocated buffers duplicated in new buffers.
32805  */
32806 struct LDKC2Tuple_OutPointChannelIdZ C2Tuple_OutPointChannelIdZ_clone(const struct LDKC2Tuple_OutPointChannelIdZ *NONNULL_PTR orig);
32807
32808 /**
32809  * Creates a new C2Tuple_OutPointChannelIdZ from the contained elements.
32810  */
32811 struct LDKC2Tuple_OutPointChannelIdZ C2Tuple_OutPointChannelIdZ_new(struct LDKOutPoint a, struct LDKChannelId b);
32812
32813 /**
32814  * Frees any resources used by the C2Tuple_OutPointChannelIdZ.
32815  */
32816 void C2Tuple_OutPointChannelIdZ_free(struct LDKC2Tuple_OutPointChannelIdZ _res);
32817
32818 /**
32819  * Frees the buffer pointed to by `data` if `datalen` is non-0.
32820  */
32821 void CVec_C2Tuple_OutPointChannelIdZZ_free(struct LDKCVec_C2Tuple_OutPointChannelIdZZ _res);
32822
32823 /**
32824  * Frees the buffer pointed to by `data` if `datalen` is non-0.
32825  */
32826 void CVec_MonitorUpdateIdZ_free(struct LDKCVec_MonitorUpdateIdZ _res);
32827
32828 /**
32829  * Creates a new tuple which has the same data as `orig`
32830  * but with all dynamically-allocated buffers duplicated in new buffers.
32831  */
32832 struct LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(const struct LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR orig);
32833
32834 /**
32835  * Creates a new C2Tuple_OutPointCVec_MonitorUpdateIdZZ from the contained elements.
32836  */
32837 struct LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(struct LDKOutPoint a, struct LDKCVec_MonitorUpdateIdZ b);
32838
32839 /**
32840  * Frees any resources used by the C2Tuple_OutPointCVec_MonitorUpdateIdZZ.
32841  */
32842 void C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(struct LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ _res);
32843
32844 /**
32845  * Frees the buffer pointed to by `data` if `datalen` is non-0.
32846  */
32847 void CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(struct LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ _res);
32848
32849 /**
32850  * Frees any resources used by the APIError
32851  */
32852 void APIError_free(struct LDKAPIError this_ptr);
32853
32854 /**
32855  * Creates a copy of the APIError
32856  */
32857 struct LDKAPIError APIError_clone(const struct LDKAPIError *NONNULL_PTR orig);
32858
32859 /**
32860  * Utility method to constructs a new APIMisuseError-variant APIError
32861  */
32862 struct LDKAPIError APIError_apimisuse_error(struct LDKStr err);
32863
32864 /**
32865  * Utility method to constructs a new FeeRateTooHigh-variant APIError
32866  */
32867 struct LDKAPIError APIError_fee_rate_too_high(struct LDKStr err, uint32_t feerate);
32868
32869 /**
32870  * Utility method to constructs a new InvalidRoute-variant APIError
32871  */
32872 struct LDKAPIError APIError_invalid_route(struct LDKStr err);
32873
32874 /**
32875  * Utility method to constructs a new ChannelUnavailable-variant APIError
32876  */
32877 struct LDKAPIError APIError_channel_unavailable(struct LDKStr err);
32878
32879 /**
32880  * Utility method to constructs a new MonitorUpdateInProgress-variant APIError
32881  */
32882 struct LDKAPIError APIError_monitor_update_in_progress(void);
32883
32884 /**
32885  * Utility method to constructs a new IncompatibleShutdownScript-variant APIError
32886  */
32887 struct LDKAPIError APIError_incompatible_shutdown_script(struct LDKShutdownScript script);
32888
32889 /**
32890  * Checks if two APIErrors contain equal inner contents.
32891  * This ignores pointers and is_owned flags and looks at the values in fields.
32892  */
32893 bool APIError_eq(const struct LDKAPIError *NONNULL_PTR a, const struct LDKAPIError *NONNULL_PTR b);
32894
32895 /**
32896  * Serialize the APIError object into a byte array which can be read by APIError_read
32897  */
32898 struct LDKCVec_u8Z APIError_write(const struct LDKAPIError *NONNULL_PTR obj);
32899
32900 /**
32901  * Read a APIError from a byte array, created by APIError_write
32902  */
32903 struct LDKCResult_COption_APIErrorZDecodeErrorZ APIError_read(struct LDKu8slice ser);
32904
32905 /**
32906  * Frees any resources used by the BigSize, if is_owned is set and inner is non-NULL.
32907  */
32908 void BigSize_free(struct LDKBigSize this_obj);
32909
32910 uint64_t BigSize_get_a(const struct LDKBigSize *NONNULL_PTR this_ptr);
32911
32912 void BigSize_set_a(struct LDKBigSize *NONNULL_PTR this_ptr, uint64_t val);
32913
32914 /**
32915  * Constructs a new BigSize given each field
32916  */
32917 MUST_USE_RES struct LDKBigSize BigSize_new(uint64_t a_arg);
32918
32919 /**
32920  * Creates a copy of the BigSize
32921  */
32922 struct LDKBigSize BigSize_clone(const struct LDKBigSize *NONNULL_PTR orig);
32923
32924 /**
32925  * Generates a non-cryptographic 64-bit hash of the BigSize.
32926  */
32927 uint64_t BigSize_hash(const struct LDKBigSize *NONNULL_PTR o);
32928
32929 /**
32930  * Checks if two BigSizes contain equal inner contents.
32931  * This ignores pointers and is_owned flags and looks at the values in fields.
32932  * Two objects with NULL inner values will be considered "equal" here.
32933  */
32934 bool BigSize_eq(const struct LDKBigSize *NONNULL_PTR a, const struct LDKBigSize *NONNULL_PTR b);
32935
32936 /**
32937  * Serialize the BigSize object into a byte array which can be read by BigSize_read
32938  */
32939 struct LDKCVec_u8Z BigSize_write(const struct LDKBigSize *NONNULL_PTR obj);
32940
32941 /**
32942  * Read a BigSize from a byte array, created by BigSize_write
32943  */
32944 struct LDKCResult_BigSizeDecodeErrorZ BigSize_read(struct LDKu8slice ser);
32945
32946 /**
32947  * Frees any resources used by the Hostname, if is_owned is set and inner is non-NULL.
32948  */
32949 void Hostname_free(struct LDKHostname this_obj);
32950
32951 /**
32952  * Creates a copy of the Hostname
32953  */
32954 struct LDKHostname Hostname_clone(const struct LDKHostname *NONNULL_PTR orig);
32955
32956 /**
32957  * Generates a non-cryptographic 64-bit hash of the Hostname.
32958  */
32959 uint64_t Hostname_hash(const struct LDKHostname *NONNULL_PTR o);
32960
32961 /**
32962  * Checks if two Hostnames contain equal inner contents.
32963  * This ignores pointers and is_owned flags and looks at the values in fields.
32964  * Two objects with NULL inner values will be considered "equal" here.
32965  */
32966 bool Hostname_eq(const struct LDKHostname *NONNULL_PTR a, const struct LDKHostname *NONNULL_PTR b);
32967
32968 /**
32969  * Returns the length of the hostname.
32970  */
32971 MUST_USE_RES uint8_t Hostname_len(const struct LDKHostname *NONNULL_PTR this_arg);
32972
32973 /**
32974  * Serialize the Hostname object into a byte array which can be read by Hostname_read
32975  */
32976 struct LDKCVec_u8Z Hostname_write(const struct LDKHostname *NONNULL_PTR obj);
32977
32978 /**
32979  * Read a Hostname from a byte array, created by Hostname_write
32980  */
32981 struct LDKCResult_HostnameDecodeErrorZ Hostname_read(struct LDKu8slice ser);
32982
32983 /**
32984  * Frees any resources used by the TransactionU16LenLimited, if is_owned is set and inner is non-NULL.
32985  */
32986 void TransactionU16LenLimited_free(struct LDKTransactionU16LenLimited this_obj);
32987
32988 /**
32989  * Creates a copy of the TransactionU16LenLimited
32990  */
32991 struct LDKTransactionU16LenLimited TransactionU16LenLimited_clone(const struct LDKTransactionU16LenLimited *NONNULL_PTR orig);
32992
32993 /**
32994  * Generates a non-cryptographic 64-bit hash of the TransactionU16LenLimited.
32995  */
32996 uint64_t TransactionU16LenLimited_hash(const struct LDKTransactionU16LenLimited *NONNULL_PTR o);
32997
32998 /**
32999  * Checks if two TransactionU16LenLimiteds contain equal inner contents.
33000  * This ignores pointers and is_owned flags and looks at the values in fields.
33001  * Two objects with NULL inner values will be considered "equal" here.
33002  */
33003 bool TransactionU16LenLimited_eq(const struct LDKTransactionU16LenLimited *NONNULL_PTR a, const struct LDKTransactionU16LenLimited *NONNULL_PTR b);
33004
33005 /**
33006  * Constructs a new `TransactionU16LenLimited` from a `Transaction` only if it's consensus-
33007  * serialized length is <= u16::MAX.
33008  */
33009 MUST_USE_RES struct LDKCResult_TransactionU16LenLimitedNoneZ TransactionU16LenLimited_new(struct LDKTransaction transaction);
33010
33011 /**
33012  * Consumes this `TransactionU16LenLimited` and returns its contained `Transaction`.
33013  */
33014 MUST_USE_RES struct LDKTransaction TransactionU16LenLimited_into_transaction(struct LDKTransactionU16LenLimited this_arg);
33015
33016 /**
33017  * Returns a reference to the contained `Transaction`
33018  */
33019 MUST_USE_RES struct LDKTransaction TransactionU16LenLimited_as_transaction(const struct LDKTransactionU16LenLimited *NONNULL_PTR this_arg);
33020
33021 /**
33022  * Serialize the TransactionU16LenLimited object into a byte array which can be read by TransactionU16LenLimited_read
33023  */
33024 struct LDKCVec_u8Z TransactionU16LenLimited_write(const struct LDKTransactionU16LenLimited *NONNULL_PTR obj);
33025
33026 /**
33027  * Read a TransactionU16LenLimited from a byte array, created by TransactionU16LenLimited_write
33028  */
33029 struct LDKCResult_TransactionU16LenLimitedDecodeErrorZ TransactionU16LenLimited_read(struct LDKu8slice ser);
33030
33031 /**
33032  * Creates a digital signature of a message given a SecretKey, like the node's secret.
33033  * 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.
33034  * Signatures are EC recoverable, meaning that given the message and the signature the PublicKey of the signer can be extracted.
33035  */
33036 struct LDKCResult_StrSecp256k1ErrorZ sign(struct LDKu8slice msg, const uint8_t (*sk)[32]);
33037
33038 /**
33039  * Recovers the PublicKey of the signer of the message given the message and the signature.
33040  */
33041 struct LDKCResult_PublicKeySecp256k1ErrorZ recover_pk(struct LDKu8slice msg, struct LDKStr sig);
33042
33043 /**
33044  * Verifies a message was signed by a PrivateKey that derives to a given PublicKey, given a message, a signature,
33045  * and the PublicKey.
33046  */
33047 bool verify(struct LDKu8slice msg, struct LDKStr sig, struct LDKPublicKey pk);
33048
33049 /**
33050  * Construct the invoice's HRP and signatureless data into a preimage to be hashed.
33051  */
33052 struct LDKCVec_u8Z construct_invoice_preimage(struct LDKu8slice hrp_bytes, struct LDKCVec_U5Z data_without_signature);
33053
33054 /**
33055  * Calls the free function if one is set
33056  */
33057 void KVStore_free(struct LDKKVStore this_ptr);
33058
33059 /**
33060  * Calls the free function if one is set
33061  */
33062 void Persister_free(struct LDKPersister this_ptr);
33063
33064 /**
33065  * Read previously persisted [`ChannelMonitor`]s from the store.
33066  */
33067 struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ read_channel_monitors(struct LDKKVStore kv_store, struct LDKEntropySource entropy_source, struct LDKSignerProvider signer_provider);
33068
33069 /**
33070  * Frees any resources used by the MonitorUpdatingPersister, if is_owned is set and inner is non-NULL.
33071  */
33072 void MonitorUpdatingPersister_free(struct LDKMonitorUpdatingPersister this_obj);
33073
33074 /**
33075  * Constructs a new [`MonitorUpdatingPersister`].
33076  *
33077  * The `maximum_pending_updates` parameter controls how many updates may be stored before a
33078  * [`MonitorUpdatingPersister`] consolidates updates by writing a full monitor. Note that
33079  * consolidation will frequently occur with fewer updates than what you set here; this number
33080  * is merely the maximum that may be stored. When setting this value, consider that for higher
33081  * values of `maximum_pending_updates`:
33082  *
33083  *   - [`MonitorUpdatingPersister`] will tend to write more [`ChannelMonitorUpdate`]s than
33084  * [`ChannelMonitor`]s, approaching one [`ChannelMonitor`] write for every
33085  * `maximum_pending_updates` [`ChannelMonitorUpdate`]s.
33086  *   - [`MonitorUpdatingPersister`] will issue deletes differently. Lazy deletes will come in
33087  * \"waves\" for each [`ChannelMonitor`] write. A larger `maximum_pending_updates` means bigger,
33088  * less frequent \"waves.\"
33089  *   - [`MonitorUpdatingPersister`] will potentially have more listing to do if you need to run
33090  * [`MonitorUpdatingPersister::cleanup_stale_updates`].
33091  */
33092 MUST_USE_RES struct LDKMonitorUpdatingPersister MonitorUpdatingPersister_new(struct LDKKVStore kv_store, struct LDKLogger logger, uint64_t maximum_pending_updates, struct LDKEntropySource entropy_source, struct LDKSignerProvider signer_provider);
33093
33094 /**
33095  * Reads all stored channel monitors, along with any stored updates for them.
33096  *
33097  * It is extremely important that your [`KVStore::read`] implementation uses the
33098  * [`io::ErrorKind::NotFound`] variant correctly. For more information, please see the
33099  * documentation for [`MonitorUpdatingPersister`].
33100  */
33101 MUST_USE_RES struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ MonitorUpdatingPersister_read_all_channel_monitors_with_updates(const struct LDKMonitorUpdatingPersister *NONNULL_PTR this_arg, const struct LDKBroadcasterInterface *NONNULL_PTR broadcaster, const struct LDKFeeEstimator *NONNULL_PTR fee_estimator);
33102
33103 /**
33104  * Read a single channel monitor, along with any stored updates for it.
33105  *
33106  * It is extremely important that your [`KVStore::read`] implementation uses the
33107  * [`io::ErrorKind::NotFound`] variant correctly. For more information, please see the
33108  * documentation for [`MonitorUpdatingPersister`].
33109  *
33110  * For `monitor_key`, channel storage keys be the channel's transaction ID and index, or
33111  * [`OutPoint`], with an underscore `_` between them. For example, given:
33112  *
33113  *   - Transaction ID: `deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef`
33114  *   - Index: `1`
33115  *
33116  * The correct `monitor_key` would be:
33117  * `deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef_1`
33118  *
33119  * Loading a large number of monitors will be faster if done in parallel. You can use this
33120  * function to accomplish this. Take care to limit the number of parallel readers.
33121  */
33122 MUST_USE_RES struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ MonitorUpdatingPersister_read_channel_monitor_with_updates(const struct LDKMonitorUpdatingPersister *NONNULL_PTR this_arg, const struct LDKBroadcasterInterface *NONNULL_PTR broadcaster, const struct LDKFeeEstimator *NONNULL_PTR fee_estimator, struct LDKStr monitor_key);
33123
33124 /**
33125  * Cleans up stale updates for all monitors.
33126  *
33127  * This function works by first listing all monitors, and then for each of them, listing all
33128  * updates. The updates that have an `update_id` less than or equal to than the stored monitor
33129  * are deleted. The deletion can either be lazy or non-lazy based on the `lazy` flag; this will
33130  * be passed to [`KVStore::remove`].
33131  */
33132 MUST_USE_RES struct LDKCResult_NoneIOErrorZ MonitorUpdatingPersister_cleanup_stale_updates(const struct LDKMonitorUpdatingPersister *NONNULL_PTR this_arg, bool lazy);
33133
33134 /**
33135  * Constructs a new Persist which calls the relevant methods on this_arg.
33136  * This copies the `inner` pointer in this_arg and thus the returned Persist must be freed before this_arg is
33137  */
33138 struct LDKPersist MonitorUpdatingPersister_as_Persist(const struct LDKMonitorUpdatingPersister *NONNULL_PTR this_arg);
33139
33140 /**
33141  * Creates a copy of the ShortChannelIdError
33142  */
33143 enum LDKShortChannelIdError ShortChannelIdError_clone(const enum LDKShortChannelIdError *NONNULL_PTR orig);
33144
33145 /**
33146  * Utility method to constructs a new BlockOverflow-variant ShortChannelIdError
33147  */
33148 enum LDKShortChannelIdError ShortChannelIdError_block_overflow(void);
33149
33150 /**
33151  * Utility method to constructs a new TxIndexOverflow-variant ShortChannelIdError
33152  */
33153 enum LDKShortChannelIdError ShortChannelIdError_tx_index_overflow(void);
33154
33155 /**
33156  * Utility method to constructs a new VoutIndexOverflow-variant ShortChannelIdError
33157  */
33158 enum LDKShortChannelIdError ShortChannelIdError_vout_index_overflow(void);
33159
33160 /**
33161  * Checks if two ShortChannelIdErrors contain equal inner contents.
33162  * This ignores pointers and is_owned flags and looks at the values in fields.
33163  */
33164 bool ShortChannelIdError_eq(const enum LDKShortChannelIdError *NONNULL_PTR a, const enum LDKShortChannelIdError *NONNULL_PTR b);
33165
33166 /**
33167  * Extracts the block height (most significant 3-bytes) from the `short_channel_id`
33168  */
33169 uint32_t block_from_scid(uint64_t short_channel_id);
33170
33171 /**
33172  * Extracts the tx index (bytes [2..4]) from the `short_channel_id`
33173  */
33174 uint32_t tx_index_from_scid(uint64_t short_channel_id);
33175
33176 /**
33177  * Extracts the vout (bytes [0..2]) from the `short_channel_id`
33178  */
33179 uint16_t vout_from_scid(uint64_t short_channel_id);
33180
33181 /**
33182  * Constructs a `short_channel_id` using the components pieces. Results in an error
33183  * if the block height, tx index, or vout index overflow the maximum sizes.
33184  */
33185 struct LDKCResult_u64ShortChannelIdErrorZ scid_from_parts(uint64_t block, uint64_t tx_index, uint64_t vout_index);
33186
33187 /**
33188  * Frees any resources used by the UntrustedString, if is_owned is set and inner is non-NULL.
33189  */
33190 void UntrustedString_free(struct LDKUntrustedString this_obj);
33191
33192 struct LDKStr UntrustedString_get_a(const struct LDKUntrustedString *NONNULL_PTR this_ptr);
33193
33194 void UntrustedString_set_a(struct LDKUntrustedString *NONNULL_PTR this_ptr, struct LDKStr val);
33195
33196 /**
33197  * Constructs a new UntrustedString given each field
33198  */
33199 MUST_USE_RES struct LDKUntrustedString UntrustedString_new(struct LDKStr a_arg);
33200
33201 /**
33202  * Creates a copy of the UntrustedString
33203  */
33204 struct LDKUntrustedString UntrustedString_clone(const struct LDKUntrustedString *NONNULL_PTR orig);
33205
33206 /**
33207  * Checks if two UntrustedStrings contain equal inner contents.
33208  * This ignores pointers and is_owned flags and looks at the values in fields.
33209  * Two objects with NULL inner values will be considered "equal" here.
33210  */
33211 bool UntrustedString_eq(const struct LDKUntrustedString *NONNULL_PTR a, const struct LDKUntrustedString *NONNULL_PTR b);
33212
33213 /**
33214  * Generates a non-cryptographic 64-bit hash of the UntrustedString.
33215  */
33216 uint64_t UntrustedString_hash(const struct LDKUntrustedString *NONNULL_PTR o);
33217
33218 /**
33219  * Serialize the UntrustedString object into a byte array which can be read by UntrustedString_read
33220  */
33221 struct LDKCVec_u8Z UntrustedString_write(const struct LDKUntrustedString *NONNULL_PTR obj);
33222
33223 /**
33224  * Read a UntrustedString from a byte array, created by UntrustedString_write
33225  */
33226 struct LDKCResult_UntrustedStringDecodeErrorZ UntrustedString_read(struct LDKu8slice ser);
33227
33228 /**
33229  * Frees any resources used by the PrintableString, if is_owned is set and inner is non-NULL.
33230  */
33231 void PrintableString_free(struct LDKPrintableString this_obj);
33232
33233 struct LDKStr PrintableString_get_a(const struct LDKPrintableString *NONNULL_PTR this_ptr);
33234
33235 void PrintableString_set_a(struct LDKPrintableString *NONNULL_PTR this_ptr, struct LDKStr val);
33236
33237 /**
33238  * Constructs a new PrintableString given each field
33239  */
33240 MUST_USE_RES struct LDKPrintableString PrintableString_new(struct LDKStr a_arg);
33241
33242 /**
33243  * Frees any resources used by the TrackedSpendableOutput, if is_owned is set and inner is non-NULL.
33244  */
33245 void TrackedSpendableOutput_free(struct LDKTrackedSpendableOutput this_obj);
33246
33247 /**
33248  * The tracked output descriptor.
33249  */
33250 struct LDKSpendableOutputDescriptor TrackedSpendableOutput_get_descriptor(const struct LDKTrackedSpendableOutput *NONNULL_PTR this_ptr);
33251
33252 /**
33253  * The tracked output descriptor.
33254  */
33255 void TrackedSpendableOutput_set_descriptor(struct LDKTrackedSpendableOutput *NONNULL_PTR this_ptr, struct LDKSpendableOutputDescriptor val);
33256
33257 /**
33258  * The channel this output belongs to.
33259  *
33260  * Will be `None` if no `channel_id` was given to [`OutputSweeper::track_spendable_outputs`]
33261  *
33262  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
33263  */
33264 struct LDKChannelId TrackedSpendableOutput_get_channel_id(const struct LDKTrackedSpendableOutput *NONNULL_PTR this_ptr);
33265
33266 /**
33267  * The channel this output belongs to.
33268  *
33269  * Will be `None` if no `channel_id` was given to [`OutputSweeper::track_spendable_outputs`]
33270  *
33271  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
33272  */
33273 void TrackedSpendableOutput_set_channel_id(struct LDKTrackedSpendableOutput *NONNULL_PTR this_ptr, struct LDKChannelId val);
33274
33275 /**
33276  * The current status of the output spend.
33277  */
33278 struct LDKOutputSpendStatus TrackedSpendableOutput_get_status(const struct LDKTrackedSpendableOutput *NONNULL_PTR this_ptr);
33279
33280 /**
33281  * The current status of the output spend.
33282  */
33283 void TrackedSpendableOutput_set_status(struct LDKTrackedSpendableOutput *NONNULL_PTR this_ptr, struct LDKOutputSpendStatus val);
33284
33285 /**
33286  * Constructs a new TrackedSpendableOutput given each field
33287  *
33288  * Note that channel_id_arg (or a relevant inner pointer) may be NULL or all-0s to represent None
33289  */
33290 MUST_USE_RES struct LDKTrackedSpendableOutput TrackedSpendableOutput_new(struct LDKSpendableOutputDescriptor descriptor_arg, struct LDKChannelId channel_id_arg, struct LDKOutputSpendStatus status_arg);
33291
33292 /**
33293  * Creates a copy of the TrackedSpendableOutput
33294  */
33295 struct LDKTrackedSpendableOutput TrackedSpendableOutput_clone(const struct LDKTrackedSpendableOutput *NONNULL_PTR orig);
33296
33297 /**
33298  * Checks if two TrackedSpendableOutputs contain equal inner contents.
33299  * This ignores pointers and is_owned flags and looks at the values in fields.
33300  * Two objects with NULL inner values will be considered "equal" here.
33301  */
33302 bool TrackedSpendableOutput_eq(const struct LDKTrackedSpendableOutput *NONNULL_PTR a, const struct LDKTrackedSpendableOutput *NONNULL_PTR b);
33303
33304 /**
33305  * Returns whether the output is spent in the given transaction.
33306  */
33307 MUST_USE_RES bool TrackedSpendableOutput_is_spent_in(const struct LDKTrackedSpendableOutput *NONNULL_PTR this_arg, struct LDKTransaction tx);
33308
33309 /**
33310  * Serialize the TrackedSpendableOutput object into a byte array which can be read by TrackedSpendableOutput_read
33311  */
33312 struct LDKCVec_u8Z TrackedSpendableOutput_write(const struct LDKTrackedSpendableOutput *NONNULL_PTR obj);
33313
33314 /**
33315  * Read a TrackedSpendableOutput from a byte array, created by TrackedSpendableOutput_write
33316  */
33317 struct LDKCResult_TrackedSpendableOutputDecodeErrorZ TrackedSpendableOutput_read(struct LDKu8slice ser);
33318
33319 /**
33320  * Frees any resources used by the OutputSpendStatus
33321  */
33322 void OutputSpendStatus_free(struct LDKOutputSpendStatus this_ptr);
33323
33324 /**
33325  * Creates a copy of the OutputSpendStatus
33326  */
33327 struct LDKOutputSpendStatus OutputSpendStatus_clone(const struct LDKOutputSpendStatus *NONNULL_PTR orig);
33328
33329 /**
33330  * Utility method to constructs a new PendingInitialBroadcast-variant OutputSpendStatus
33331  */
33332 struct LDKOutputSpendStatus OutputSpendStatus_pending_initial_broadcast(struct LDKCOption_u32Z delayed_until_height);
33333
33334 /**
33335  * Utility method to constructs a new PendingFirstConfirmation-variant OutputSpendStatus
33336  */
33337 struct LDKOutputSpendStatus OutputSpendStatus_pending_first_confirmation(struct LDKThirtyTwoBytes first_broadcast_hash, uint32_t latest_broadcast_height, struct LDKTransaction latest_spending_tx);
33338
33339 /**
33340  * Utility method to constructs a new PendingThresholdConfirmations-variant OutputSpendStatus
33341  */
33342 struct LDKOutputSpendStatus OutputSpendStatus_pending_threshold_confirmations(struct LDKThirtyTwoBytes first_broadcast_hash, uint32_t latest_broadcast_height, struct LDKTransaction latest_spending_tx, uint32_t confirmation_height, struct LDKThirtyTwoBytes confirmation_hash);
33343
33344 /**
33345  * Checks if two OutputSpendStatuss contain equal inner contents.
33346  * This ignores pointers and is_owned flags and looks at the values in fields.
33347  */
33348 bool OutputSpendStatus_eq(const struct LDKOutputSpendStatus *NONNULL_PTR a, const struct LDKOutputSpendStatus *NONNULL_PTR b);
33349
33350 /**
33351  * Serialize the OutputSpendStatus object into a byte array which can be read by OutputSpendStatus_read
33352  */
33353 struct LDKCVec_u8Z OutputSpendStatus_write(const struct LDKOutputSpendStatus *NONNULL_PTR obj);
33354
33355 /**
33356  * Read a OutputSpendStatus from a byte array, created by OutputSpendStatus_write
33357  */
33358 struct LDKCResult_OutputSpendStatusDecodeErrorZ OutputSpendStatus_read(struct LDKu8slice ser);
33359
33360 /**
33361  * Frees any resources used by the OutputSweeper, if is_owned is set and inner is non-NULL.
33362  */
33363 void OutputSweeper_free(struct LDKOutputSweeper this_obj);
33364
33365 /**
33366  * Constructs a new [`OutputSweeper`].
33367  *
33368  * If chain data is provided via the [`Confirm`] interface or via filtered blocks, users also
33369  * need to register their [`Filter`] implementation via the given `chain_data_source`.
33370  */
33371 MUST_USE_RES struct LDKOutputSweeper OutputSweeper_new(struct LDKBestBlock best_block, struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator, struct LDKCOption_FilterZ chain_data_source, struct LDKOutputSpender output_spender, struct LDKChangeDestinationSource change_destination_source, struct LDKKVStore kv_store, struct LDKLogger logger);
33372
33373 /**
33374  * Tells the sweeper to track the given outputs descriptors.
33375  *
33376  * Usually, this should be called based on the values emitted by the
33377  * [`Event::SpendableOutputs`].
33378  *
33379  * The given `exclude_static_outputs` flag controls whether the sweeper will filter out
33380  * [`SpendableOutputDescriptor::StaticOutput`]s, which may be handled directly by the on-chain
33381  * wallet implementation.
33382  *
33383  * If `delay_until_height` is set, we will delay the spending until the respective block
33384  * height is reached. This can be used to batch spends, e.g., to reduce on-chain fees.
33385  *
33386  * Returns `Err` on persistence failure, in which case the call may be safely retried.
33387  *
33388  * [`Event::SpendableOutputs`]: crate::events::Event::SpendableOutputs
33389  *
33390  * Note that channel_id (or a relevant inner pointer) may be NULL or all-0s to represent None
33391  */
33392 MUST_USE_RES struct LDKCResult_NoneNoneZ OutputSweeper_track_spendable_outputs(const struct LDKOutputSweeper *NONNULL_PTR this_arg, struct LDKCVec_SpendableOutputDescriptorZ output_descriptors, struct LDKChannelId channel_id, bool exclude_static_outputs, struct LDKCOption_u32Z delay_until_height);
33393
33394 /**
33395  * Returns a list of the currently tracked spendable outputs.
33396  */
33397 MUST_USE_RES struct LDKCVec_TrackedSpendableOutputZ OutputSweeper_tracked_spendable_outputs(const struct LDKOutputSweeper *NONNULL_PTR this_arg);
33398
33399 /**
33400  * Gets the latest best block which was connected either via the [`Listen`] or
33401  * [`Confirm`] interfaces.
33402  */
33403 MUST_USE_RES struct LDKBestBlock OutputSweeper_current_best_block(const struct LDKOutputSweeper *NONNULL_PTR this_arg);
33404
33405 /**
33406  * Constructs a new Listen which calls the relevant methods on this_arg.
33407  * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is
33408  */
33409 struct LDKListen OutputSweeper_as_Listen(const struct LDKOutputSweeper *NONNULL_PTR this_arg);
33410
33411 /**
33412  * Constructs a new Confirm which calls the relevant methods on this_arg.
33413  * This copies the `inner` pointer in this_arg and thus the returned Confirm must be freed before this_arg is
33414  */
33415 struct LDKConfirm OutputSweeper_as_Confirm(const struct LDKOutputSweeper *NONNULL_PTR this_arg);
33416
33417 /**
33418  * Frees any resources used by the SpendingDelay
33419  */
33420 void SpendingDelay_free(struct LDKSpendingDelay this_ptr);
33421
33422 /**
33423  * Creates a copy of the SpendingDelay
33424  */
33425 struct LDKSpendingDelay SpendingDelay_clone(const struct LDKSpendingDelay *NONNULL_PTR orig);
33426
33427 /**
33428  * Utility method to constructs a new Relative-variant SpendingDelay
33429  */
33430 struct LDKSpendingDelay SpendingDelay_relative(uint32_t num_blocks);
33431
33432 /**
33433  * Utility method to constructs a new Absolute-variant SpendingDelay
33434  */
33435 struct LDKSpendingDelay SpendingDelay_absolute(uint32_t height);
33436
33437 /**
33438  * Read a OutputSweeper from a byte array, created by OutputSweeper_write
33439  */
33440 struct LDKCResult_OutputSweeperDecodeErrorZ OutputSweeper_read(struct LDKu8slice ser, struct LDKBroadcasterInterface arg_a, struct LDKFeeEstimator arg_b, struct LDKCOption_FilterZ arg_c, struct LDKOutputSpender arg_d, struct LDKChangeDestinationSource arg_e, struct LDKKVStore arg_f, struct LDKLogger arg_g);
33441
33442 /**
33443  * Read a C2Tuple_BestBlockOutputSweeperZ from a byte array, created by C2Tuple_BestBlockOutputSweeperZ_write
33444  */
33445 struct LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ C2Tuple_BestBlockOutputSweeperZ_read(struct LDKu8slice ser, struct LDKBroadcasterInterface arg_a, struct LDKFeeEstimator arg_b, struct LDKCOption_FilterZ arg_c, struct LDKOutputSpender arg_d, struct LDKChangeDestinationSource arg_e, struct LDKKVStore arg_f, struct LDKLogger arg_g);
33446
33447 /**
33448  * Calls the free function if one is set
33449  */
33450 void FutureCallback_free(struct LDKFutureCallback this_ptr);
33451
33452 /**
33453  * Frees any resources used by the Future, if is_owned is set and inner is non-NULL.
33454  */
33455 void Future_free(struct LDKFuture this_obj);
33456
33457 /**
33458  * Registers a callback to be called upon completion of this future. If the future has already
33459  * completed, the callback will be called immediately.
33460  */
33461 void Future_register_callback_fn(const struct LDKFuture *NONNULL_PTR this_arg, struct LDKFutureCallback callback);
33462
33463 /**
33464  * Waits until this [`Future`] completes.
33465  */
33466 void Future_wait(const struct LDKFuture *NONNULL_PTR this_arg);
33467
33468 /**
33469  * Waits until this [`Future`] completes or the given amount of time has elapsed.
33470  *
33471  * Returns true if the [`Future`] completed, false if the time elapsed.
33472  */
33473 MUST_USE_RES bool Future_wait_timeout(const struct LDKFuture *NONNULL_PTR this_arg, uint64_t max_wait);
33474
33475 /**
33476  * Frees any resources used by the Sleeper, if is_owned is set and inner is non-NULL.
33477  */
33478 void Sleeper_free(struct LDKSleeper this_obj);
33479
33480 /**
33481  * Constructs a new sleeper from one future, allowing blocking on it.
33482  */
33483 MUST_USE_RES struct LDKSleeper Sleeper_from_single_future(const struct LDKFuture *NONNULL_PTR future);
33484
33485 /**
33486  * Constructs a new sleeper from two futures, allowing blocking on both at once.
33487  */
33488 MUST_USE_RES struct LDKSleeper Sleeper_from_two_futures(const struct LDKFuture *NONNULL_PTR fut_a, const struct LDKFuture *NONNULL_PTR fut_b);
33489
33490 /**
33491  * Constructs a new sleeper on many futures, allowing blocking on all at once.
33492  */
33493 MUST_USE_RES struct LDKSleeper Sleeper_new(struct LDKCVec_FutureZ futures);
33494
33495 /**
33496  * Wait until one of the [`Future`]s registered with this [`Sleeper`] has completed.
33497  */
33498 void Sleeper_wait(const struct LDKSleeper *NONNULL_PTR this_arg);
33499
33500 /**
33501  * Wait until one of the [`Future`]s registered with this [`Sleeper`] has completed or the
33502  * given amount of time has elapsed. Returns true if a [`Future`] completed, false if the time
33503  * elapsed.
33504  */
33505 MUST_USE_RES bool Sleeper_wait_timeout(const struct LDKSleeper *NONNULL_PTR this_arg, uint64_t max_wait);
33506
33507 /**
33508  * Creates a copy of the Level
33509  */
33510 enum LDKLevel Level_clone(const enum LDKLevel *NONNULL_PTR orig);
33511
33512 /**
33513  * Utility method to constructs a new Gossip-variant Level
33514  */
33515 enum LDKLevel Level_gossip(void);
33516
33517 /**
33518  * Utility method to constructs a new Trace-variant Level
33519  */
33520 enum LDKLevel Level_trace(void);
33521
33522 /**
33523  * Utility method to constructs a new Debug-variant Level
33524  */
33525 enum LDKLevel Level_debug(void);
33526
33527 /**
33528  * Utility method to constructs a new Info-variant Level
33529  */
33530 enum LDKLevel Level_info(void);
33531
33532 /**
33533  * Utility method to constructs a new Warn-variant Level
33534  */
33535 enum LDKLevel Level_warn(void);
33536
33537 /**
33538  * Utility method to constructs a new Error-variant Level
33539  */
33540 enum LDKLevel Level_error(void);
33541
33542 /**
33543  * Checks if two Levels contain equal inner contents.
33544  * This ignores pointers and is_owned flags and looks at the values in fields.
33545  */
33546 bool Level_eq(const enum LDKLevel *NONNULL_PTR a, const enum LDKLevel *NONNULL_PTR b);
33547
33548 /**
33549  * Generates a non-cryptographic 64-bit hash of the Level.
33550  */
33551 uint64_t Level_hash(const enum LDKLevel *NONNULL_PTR o);
33552
33553 /**
33554  * Returns the most verbose logging level.
33555  */
33556 MUST_USE_RES enum LDKLevel Level_max(void);
33557
33558 /**
33559  * Frees any resources used by the Record, if is_owned is set and inner is non-NULL.
33560  */
33561 void Record_free(struct LDKRecord this_obj);
33562
33563 /**
33564  * The verbosity level of the message.
33565  */
33566 enum LDKLevel Record_get_level(const struct LDKRecord *NONNULL_PTR this_ptr);
33567
33568 /**
33569  * The verbosity level of the message.
33570  */
33571 void Record_set_level(struct LDKRecord *NONNULL_PTR this_ptr, enum LDKLevel val);
33572
33573 /**
33574  * The node id of the peer pertaining to the logged record.
33575  *
33576  * Note that in some cases a [`Self::channel_id`] may be filled in but this may still be
33577  * `None`, depending on if the peer information is readily available in LDK when the log is
33578  * generated.
33579  *
33580  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
33581  */
33582 struct LDKPublicKey Record_get_peer_id(const struct LDKRecord *NONNULL_PTR this_ptr);
33583
33584 /**
33585  * The node id of the peer pertaining to the logged record.
33586  *
33587  * Note that in some cases a [`Self::channel_id`] may be filled in but this may still be
33588  * `None`, depending on if the peer information is readily available in LDK when the log is
33589  * generated.
33590  *
33591  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
33592  */
33593 void Record_set_peer_id(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKPublicKey val);
33594
33595 /**
33596  * The channel id of the channel pertaining to the logged record. May be a temporary id before
33597  * the channel has been funded.
33598  *
33599  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
33600  */
33601 struct LDKChannelId Record_get_channel_id(const struct LDKRecord *NONNULL_PTR this_ptr);
33602
33603 /**
33604  * The channel id of the channel pertaining to the logged record. May be a temporary id before
33605  * the channel has been funded.
33606  *
33607  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
33608  */
33609 void Record_set_channel_id(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKChannelId val);
33610
33611 /**
33612  * The message body.
33613  */
33614 struct LDKStr Record_get_args(const struct LDKRecord *NONNULL_PTR this_ptr);
33615
33616 /**
33617  * The message body.
33618  */
33619 void Record_set_args(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKStr val);
33620
33621 /**
33622  * The module path of the message.
33623  */
33624 struct LDKStr Record_get_module_path(const struct LDKRecord *NONNULL_PTR this_ptr);
33625
33626 /**
33627  * The module path of the message.
33628  */
33629 void Record_set_module_path(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKStr val);
33630
33631 /**
33632  * The source file containing the message.
33633  */
33634 struct LDKStr Record_get_file(const struct LDKRecord *NONNULL_PTR this_ptr);
33635
33636 /**
33637  * The source file containing the message.
33638  */
33639 void Record_set_file(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKStr val);
33640
33641 /**
33642  * The line containing the message.
33643  */
33644 uint32_t Record_get_line(const struct LDKRecord *NONNULL_PTR this_ptr);
33645
33646 /**
33647  * The line containing the message.
33648  */
33649 void Record_set_line(struct LDKRecord *NONNULL_PTR this_ptr, uint32_t val);
33650
33651 /**
33652  * Constructs a new Record given each field
33653  *
33654  * Note that peer_id_arg (or a relevant inner pointer) may be NULL or all-0s to represent None
33655  * Note that channel_id_arg (or a relevant inner pointer) may be NULL or all-0s to represent None
33656  */
33657 MUST_USE_RES struct LDKRecord Record_new(enum LDKLevel level_arg, struct LDKPublicKey peer_id_arg, struct LDKChannelId channel_id_arg, struct LDKStr args_arg, struct LDKStr module_path_arg, struct LDKStr file_arg, uint32_t line_arg);
33658
33659 /**
33660  * Creates a copy of the Record
33661  */
33662 struct LDKRecord Record_clone(const struct LDKRecord *NONNULL_PTR orig);
33663
33664 /**
33665  * Calls the free function if one is set
33666  */
33667 void Logger_free(struct LDKLogger this_ptr);
33668
33669 /**
33670  * Frees any resources used by the ChannelHandshakeConfig, if is_owned is set and inner is non-NULL.
33671  */
33672 void ChannelHandshakeConfig_free(struct LDKChannelHandshakeConfig this_obj);
33673
33674 /**
33675  * Confirmations we will wait for before considering the channel locked in.
33676  * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
33677  * equivalent limit applied to outbound channels).
33678  *
33679  * A lower-bound of 1 is applied, requiring all channels to have a confirmed commitment
33680  * transaction before operation. If you wish to accept channels with zero confirmations, see
33681  * [`UserConfig::manually_accept_inbound_channels`] and
33682  * [`ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`].
33683  *
33684  * Default value: 6.
33685  *
33686  * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
33687  * [`ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel_from_trusted_peer_0conf
33688  */
33689 uint32_t ChannelHandshakeConfig_get_minimum_depth(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
33690
33691 /**
33692  * Confirmations we will wait for before considering the channel locked in.
33693  * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
33694  * equivalent limit applied to outbound channels).
33695  *
33696  * A lower-bound of 1 is applied, requiring all channels to have a confirmed commitment
33697  * transaction before operation. If you wish to accept channels with zero confirmations, see
33698  * [`UserConfig::manually_accept_inbound_channels`] and
33699  * [`ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`].
33700  *
33701  * Default value: 6.
33702  *
33703  * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
33704  * [`ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel_from_trusted_peer_0conf
33705  */
33706 void ChannelHandshakeConfig_set_minimum_depth(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint32_t val);
33707
33708 /**
33709  * Set to the number of blocks we require our counterparty to wait to claim their money (ie
33710  * the number of blocks we have to punish our counterparty if they broadcast a revoked
33711  * transaction).
33712  *
33713  * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST
33714  * be online to check for revoked transactions on-chain at least once every our_to_self_delay
33715  * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction,
33716  * possibly with time in between to RBF the spending transaction).
33717  *
33718  * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
33719  * case of an honest unilateral channel close, which implicitly decrease the economic value of
33720  * our channel.
33721  *
33722  * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you
33723  * can tweak config to ask for more security, not less.
33724  */
33725 uint16_t ChannelHandshakeConfig_get_our_to_self_delay(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
33726
33727 /**
33728  * Set to the number of blocks we require our counterparty to wait to claim their money (ie
33729  * the number of blocks we have to punish our counterparty if they broadcast a revoked
33730  * transaction).
33731  *
33732  * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST
33733  * be online to check for revoked transactions on-chain at least once every our_to_self_delay
33734  * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction,
33735  * possibly with time in between to RBF the spending transaction).
33736  *
33737  * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
33738  * case of an honest unilateral channel close, which implicitly decrease the economic value of
33739  * our channel.
33740  *
33741  * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you
33742  * can tweak config to ask for more security, not less.
33743  */
33744 void ChannelHandshakeConfig_set_our_to_self_delay(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint16_t val);
33745
33746 /**
33747  * Set to the smallest value HTLC we will accept to process.
33748  *
33749  * This value is sent to our counterparty on channel-open and we close the channel any time
33750  * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
33751  *
33752  * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
33753  * by the protocol.
33754  */
33755 uint64_t ChannelHandshakeConfig_get_our_htlc_minimum_msat(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
33756
33757 /**
33758  * Set to the smallest value HTLC we will accept to process.
33759  *
33760  * This value is sent to our counterparty on channel-open and we close the channel any time
33761  * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
33762  *
33763  * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
33764  * by the protocol.
33765  */
33766 void ChannelHandshakeConfig_set_our_htlc_minimum_msat(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint64_t val);
33767
33768 /**
33769  * Sets the percentage of the channel value we will cap the total value of outstanding inbound
33770  * HTLCs to.
33771  *
33772  * This can be set to a value between 1-100, where the value corresponds to the percent of the
33773  * channel value in whole percentages.
33774  *
33775  * Note that:
33776  * * If configured to another value than the default value 10, any new channels created with
33777  * the non default value will cause versions of LDK prior to 0.0.104 to refuse to read the
33778  * `ChannelManager`.
33779  *
33780  * * This caps the total value for inbound HTLCs in-flight only, and there's currently
33781  * no way to configure the cap for the total value of outbound HTLCs in-flight.
33782  *
33783  * * The requirements for your node being online to ensure the safety of HTLC-encumbered funds
33784  * are different from the non-HTLC-encumbered funds. This makes this an important knob to
33785  * restrict exposure to loss due to being offline for too long.
33786  * See [`ChannelHandshakeConfig::our_to_self_delay`] and [`ChannelConfig::cltv_expiry_delta`]
33787  * for more information.
33788  *
33789  * Default value: 10.
33790  * Minimum value: 1, any values less than 1 will be treated as 1 instead.
33791  * Maximum value: 100, any values larger than 100 will be treated as 100 instead.
33792  */
33793 uint8_t ChannelHandshakeConfig_get_max_inbound_htlc_value_in_flight_percent_of_channel(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
33794
33795 /**
33796  * Sets the percentage of the channel value we will cap the total value of outstanding inbound
33797  * HTLCs to.
33798  *
33799  * This can be set to a value between 1-100, where the value corresponds to the percent of the
33800  * channel value in whole percentages.
33801  *
33802  * Note that:
33803  * * If configured to another value than the default value 10, any new channels created with
33804  * the non default value will cause versions of LDK prior to 0.0.104 to refuse to read the
33805  * `ChannelManager`.
33806  *
33807  * * This caps the total value for inbound HTLCs in-flight only, and there's currently
33808  * no way to configure the cap for the total value of outbound HTLCs in-flight.
33809  *
33810  * * The requirements for your node being online to ensure the safety of HTLC-encumbered funds
33811  * are different from the non-HTLC-encumbered funds. This makes this an important knob to
33812  * restrict exposure to loss due to being offline for too long.
33813  * See [`ChannelHandshakeConfig::our_to_self_delay`] and [`ChannelConfig::cltv_expiry_delta`]
33814  * for more information.
33815  *
33816  * Default value: 10.
33817  * Minimum value: 1, any values less than 1 will be treated as 1 instead.
33818  * Maximum value: 100, any values larger than 100 will be treated as 100 instead.
33819  */
33820 void ChannelHandshakeConfig_set_max_inbound_htlc_value_in_flight_percent_of_channel(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint8_t val);
33821
33822 /**
33823  * If set, we attempt to negotiate the `scid_privacy` (referred to as `scid_alias` in the
33824  * BOLTs) option for outbound private channels. This provides better privacy by not including
33825  * our real on-chain channel UTXO in each invoice and requiring that our counterparty only
33826  * relay HTLCs to us using the channel's SCID alias.
33827  *
33828  * If this option is set, channels may be created that will not be readable by LDK versions
33829  * prior to 0.0.106, causing [`ChannelManager`]'s read method to return a
33830  * [`DecodeError::InvalidValue`].
33831  *
33832  * Note that setting this to true does *not* prevent us from opening channels with
33833  * counterparties that do not support the `scid_alias` option; we will simply fall back to a
33834  * private channel without that option.
33835  *
33836  * Ignored if the channel is negotiated to be announced, see
33837  * [`ChannelHandshakeConfig::announced_channel`] and
33838  * [`ChannelHandshakeLimits::force_announced_channel_preference`] for more.
33839  *
33840  * Default value: false. This value is likely to change to true in the future.
33841  *
33842  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
33843  * [`DecodeError::InvalidValue`]: crate::ln::msgs::DecodeError::InvalidValue
33844  */
33845 bool ChannelHandshakeConfig_get_negotiate_scid_privacy(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
33846
33847 /**
33848  * If set, we attempt to negotiate the `scid_privacy` (referred to as `scid_alias` in the
33849  * BOLTs) option for outbound private channels. This provides better privacy by not including
33850  * our real on-chain channel UTXO in each invoice and requiring that our counterparty only
33851  * relay HTLCs to us using the channel's SCID alias.
33852  *
33853  * If this option is set, channels may be created that will not be readable by LDK versions
33854  * prior to 0.0.106, causing [`ChannelManager`]'s read method to return a
33855  * [`DecodeError::InvalidValue`].
33856  *
33857  * Note that setting this to true does *not* prevent us from opening channels with
33858  * counterparties that do not support the `scid_alias` option; we will simply fall back to a
33859  * private channel without that option.
33860  *
33861  * Ignored if the channel is negotiated to be announced, see
33862  * [`ChannelHandshakeConfig::announced_channel`] and
33863  * [`ChannelHandshakeLimits::force_announced_channel_preference`] for more.
33864  *
33865  * Default value: false. This value is likely to change to true in the future.
33866  *
33867  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
33868  * [`DecodeError::InvalidValue`]: crate::ln::msgs::DecodeError::InvalidValue
33869  */
33870 void ChannelHandshakeConfig_set_negotiate_scid_privacy(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, bool val);
33871
33872 /**
33873  * Set to announce the channel publicly and notify all nodes that they can route via this
33874  * channel.
33875  *
33876  * This should only be set to true for nodes which expect to be online reliably.
33877  *
33878  * As the node which funds a channel picks this value this will only apply for new outbound
33879  * channels unless [`ChannelHandshakeLimits::force_announced_channel_preference`] is set.
33880  *
33881  * Default value: false.
33882  */
33883 bool ChannelHandshakeConfig_get_announced_channel(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
33884
33885 /**
33886  * Set to announce the channel publicly and notify all nodes that they can route via this
33887  * channel.
33888  *
33889  * This should only be set to true for nodes which expect to be online reliably.
33890  *
33891  * As the node which funds a channel picks this value this will only apply for new outbound
33892  * channels unless [`ChannelHandshakeLimits::force_announced_channel_preference`] is set.
33893  *
33894  * Default value: false.
33895  */
33896 void ChannelHandshakeConfig_set_announced_channel(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, bool val);
33897
33898 /**
33899  * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
33900  * supports it, they will then enforce the mutual-close output to us matches what we provided
33901  * at intialization, preventing us from closing to an alternate pubkey.
33902  *
33903  * This is set to true by default to provide a slight increase in security, though ultimately
33904  * any attacker who is able to take control of a channel can just as easily send the funds via
33905  * lightning payments, so we never require that our counterparties support this option.
33906  *
33907  * The upfront key committed is provided from [`SignerProvider::get_shutdown_scriptpubkey`].
33908  *
33909  * Default value: true.
33910  *
33911  * [`SignerProvider::get_shutdown_scriptpubkey`]: crate::sign::SignerProvider::get_shutdown_scriptpubkey
33912  */
33913 bool ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
33914
33915 /**
33916  * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
33917  * supports it, they will then enforce the mutual-close output to us matches what we provided
33918  * at intialization, preventing us from closing to an alternate pubkey.
33919  *
33920  * This is set to true by default to provide a slight increase in security, though ultimately
33921  * any attacker who is able to take control of a channel can just as easily send the funds via
33922  * lightning payments, so we never require that our counterparties support this option.
33923  *
33924  * The upfront key committed is provided from [`SignerProvider::get_shutdown_scriptpubkey`].
33925  *
33926  * Default value: true.
33927  *
33928  * [`SignerProvider::get_shutdown_scriptpubkey`]: crate::sign::SignerProvider::get_shutdown_scriptpubkey
33929  */
33930 void ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, bool val);
33931
33932 /**
33933  * The Proportion of the channel value to configure as counterparty's channel reserve,
33934  * i.e., `their_channel_reserve_satoshis` for both outbound and inbound channels.
33935  *
33936  * `their_channel_reserve_satoshis` is the minimum balance that the other node has to maintain
33937  * on their side, at all times.
33938  * This ensures that if our counterparty broadcasts a revoked state, we can punish them by
33939  * claiming at least this value on chain.
33940  *
33941  * Channel reserve values greater than 30% could be considered highly unreasonable, since that
33942  * amount can never be used for payments.
33943  * Also, if our selected channel reserve for counterparty and counterparty's selected
33944  * channel reserve for us sum up to equal or greater than channel value, channel negotiations
33945  * will fail.
33946  *
33947  * Note: Versions of LDK earlier than v0.0.104 will fail to read channels with any channel reserve
33948  * other than the default value.
33949  *
33950  * Default value: 1% of channel value, i.e., configured as 10,000 millionths.
33951  * Minimum value: If the calculated proportional value is less than 1000 sats, it will be treated
33952  *                as 1000 sats instead, which is a safe implementation-specific lower bound.
33953  * Maximum value: 1,000,000, any values larger than 1 Million will be treated as 1 Million (or 100%)
33954  *                instead, although channel negotiations will fail in that case.
33955  */
33956 uint32_t ChannelHandshakeConfig_get_their_channel_reserve_proportional_millionths(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
33957
33958 /**
33959  * The Proportion of the channel value to configure as counterparty's channel reserve,
33960  * i.e., `their_channel_reserve_satoshis` for both outbound and inbound channels.
33961  *
33962  * `their_channel_reserve_satoshis` is the minimum balance that the other node has to maintain
33963  * on their side, at all times.
33964  * This ensures that if our counterparty broadcasts a revoked state, we can punish them by
33965  * claiming at least this value on chain.
33966  *
33967  * Channel reserve values greater than 30% could be considered highly unreasonable, since that
33968  * amount can never be used for payments.
33969  * Also, if our selected channel reserve for counterparty and counterparty's selected
33970  * channel reserve for us sum up to equal or greater than channel value, channel negotiations
33971  * will fail.
33972  *
33973  * Note: Versions of LDK earlier than v0.0.104 will fail to read channels with any channel reserve
33974  * other than the default value.
33975  *
33976  * Default value: 1% of channel value, i.e., configured as 10,000 millionths.
33977  * Minimum value: If the calculated proportional value is less than 1000 sats, it will be treated
33978  *                as 1000 sats instead, which is a safe implementation-specific lower bound.
33979  * Maximum value: 1,000,000, any values larger than 1 Million will be treated as 1 Million (or 100%)
33980  *                instead, although channel negotiations will fail in that case.
33981  */
33982 void ChannelHandshakeConfig_set_their_channel_reserve_proportional_millionths(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint32_t val);
33983
33984 /**
33985  * If set, we attempt to negotiate the `anchors_zero_fee_htlc_tx`option for all future
33986  * channels. This feature requires having a reserve of onchain funds readily available to bump
33987  * transactions in the event of a channel force close to avoid the possibility of losing funds.
33988  *
33989  * Note that if you wish accept inbound channels with anchor outputs, you must enable
33990  * [`UserConfig::manually_accept_inbound_channels`] and manually accept them with
33991  * [`ChannelManager::accept_inbound_channel`]. This is done to give you the chance to check
33992  * whether your reserve of onchain funds is enough to cover the fees for all existing and new
33993  * channels featuring anchor outputs in the event of a force close.
33994  *
33995  * If this option is set, channels may be created that will not be readable by LDK versions
33996  * prior to 0.0.116, causing [`ChannelManager`]'s read method to return a
33997  * [`DecodeError::InvalidValue`].
33998  *
33999  * Note that setting this to true does *not* prevent us from opening channels with
34000  * counterparties that do not support the `anchors_zero_fee_htlc_tx` option; we will simply
34001  * fall back to a `static_remote_key` channel.
34002  *
34003  * LDK will not support the legacy `option_anchors` commitment version due to a discovered
34004  * vulnerability after its deployment. For more context, see the [`SIGHASH_SINGLE + update_fee
34005  * Considered Harmful`] mailing list post.
34006  *
34007  * Default value: false. This value is likely to change to true in the future.
34008  *
34009  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
34010  * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
34011  * [`DecodeError::InvalidValue`]: crate::ln::msgs::DecodeError::InvalidValue
34012  * [`SIGHASH_SINGLE + update_fee Considered Harmful`]: https://lists.linuxfoundation.org/pipermail/lightning-dev/2020-September/002796.html
34013  */
34014 bool ChannelHandshakeConfig_get_negotiate_anchors_zero_fee_htlc_tx(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
34015
34016 /**
34017  * If set, we attempt to negotiate the `anchors_zero_fee_htlc_tx`option for all future
34018  * channels. This feature requires having a reserve of onchain funds readily available to bump
34019  * transactions in the event of a channel force close to avoid the possibility of losing funds.
34020  *
34021  * Note that if you wish accept inbound channels with anchor outputs, you must enable
34022  * [`UserConfig::manually_accept_inbound_channels`] and manually accept them with
34023  * [`ChannelManager::accept_inbound_channel`]. This is done to give you the chance to check
34024  * whether your reserve of onchain funds is enough to cover the fees for all existing and new
34025  * channels featuring anchor outputs in the event of a force close.
34026  *
34027  * If this option is set, channels may be created that will not be readable by LDK versions
34028  * prior to 0.0.116, causing [`ChannelManager`]'s read method to return a
34029  * [`DecodeError::InvalidValue`].
34030  *
34031  * Note that setting this to true does *not* prevent us from opening channels with
34032  * counterparties that do not support the `anchors_zero_fee_htlc_tx` option; we will simply
34033  * fall back to a `static_remote_key` channel.
34034  *
34035  * LDK will not support the legacy `option_anchors` commitment version due to a discovered
34036  * vulnerability after its deployment. For more context, see the [`SIGHASH_SINGLE + update_fee
34037  * Considered Harmful`] mailing list post.
34038  *
34039  * Default value: false. This value is likely to change to true in the future.
34040  *
34041  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
34042  * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
34043  * [`DecodeError::InvalidValue`]: crate::ln::msgs::DecodeError::InvalidValue
34044  * [`SIGHASH_SINGLE + update_fee Considered Harmful`]: https://lists.linuxfoundation.org/pipermail/lightning-dev/2020-September/002796.html
34045  */
34046 void ChannelHandshakeConfig_set_negotiate_anchors_zero_fee_htlc_tx(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, bool val);
34047
34048 /**
34049  * The maximum number of HTLCs in-flight from our counterparty towards us at the same time.
34050  *
34051  * Increasing the value can help improve liquidity and stability in
34052  * routing at the cost of higher long term disk / DB usage.
34053  *
34054  * Note: Versions of LDK earlier than v0.0.115 will fail to read channels with a configuration
34055  * other than the default value.
34056  *
34057  * Default value: 50
34058  * Maximum value: 483, any values larger will be treated as 483.
34059  *                     This is the BOLT #2 spec limit on `max_accepted_htlcs`.
34060  */
34061 uint16_t ChannelHandshakeConfig_get_our_max_accepted_htlcs(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
34062
34063 /**
34064  * The maximum number of HTLCs in-flight from our counterparty towards us at the same time.
34065  *
34066  * Increasing the value can help improve liquidity and stability in
34067  * routing at the cost of higher long term disk / DB usage.
34068  *
34069  * Note: Versions of LDK earlier than v0.0.115 will fail to read channels with a configuration
34070  * other than the default value.
34071  *
34072  * Default value: 50
34073  * Maximum value: 483, any values larger will be treated as 483.
34074  *                     This is the BOLT #2 spec limit on `max_accepted_htlcs`.
34075  */
34076 void ChannelHandshakeConfig_set_our_max_accepted_htlcs(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint16_t val);
34077
34078 /**
34079  * Constructs a new ChannelHandshakeConfig given each field
34080  */
34081 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);
34082
34083 /**
34084  * Creates a copy of the ChannelHandshakeConfig
34085  */
34086 struct LDKChannelHandshakeConfig ChannelHandshakeConfig_clone(const struct LDKChannelHandshakeConfig *NONNULL_PTR orig);
34087
34088 /**
34089  * Creates a "default" ChannelHandshakeConfig. See struct and individual field documentaiton for details on which values are used.
34090  */
34091 MUST_USE_RES struct LDKChannelHandshakeConfig ChannelHandshakeConfig_default(void);
34092
34093 /**
34094  * Frees any resources used by the ChannelHandshakeLimits, if is_owned is set and inner is non-NULL.
34095  */
34096 void ChannelHandshakeLimits_free(struct LDKChannelHandshakeLimits this_obj);
34097
34098 /**
34099  * Minimum allowed satoshis when a channel is funded. This is supplied by the sender and so
34100  * only applies to inbound channels.
34101  *
34102  * Default value: 0.
34103  */
34104 uint64_t ChannelHandshakeLimits_get_min_funding_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
34105
34106 /**
34107  * Minimum allowed satoshis when a channel is funded. This is supplied by the sender and so
34108  * only applies to inbound channels.
34109  *
34110  * Default value: 0.
34111  */
34112 void ChannelHandshakeLimits_set_min_funding_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
34113
34114 /**
34115  * Maximum allowed satoshis when a channel is funded. This is supplied by the sender and so
34116  * only applies to inbound channels.
34117  *
34118  * Default value: 2^24 - 1.
34119  */
34120 uint64_t ChannelHandshakeLimits_get_max_funding_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
34121
34122 /**
34123  * Maximum allowed satoshis when a channel is funded. This is supplied by the sender and so
34124  * only applies to inbound channels.
34125  *
34126  * Default value: 2^24 - 1.
34127  */
34128 void ChannelHandshakeLimits_set_max_funding_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
34129
34130 /**
34131  * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
34132  * you to limit the maximum minimum-size they can require.
34133  *
34134  * Default value: u64::max_value.
34135  */
34136 uint64_t ChannelHandshakeLimits_get_max_htlc_minimum_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
34137
34138 /**
34139  * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
34140  * you to limit the maximum minimum-size they can require.
34141  *
34142  * Default value: u64::max_value.
34143  */
34144 void ChannelHandshakeLimits_set_max_htlc_minimum_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
34145
34146 /**
34147  * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
34148  * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
34149  *
34150  * Default value: 0.
34151  */
34152 uint64_t ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
34153
34154 /**
34155  * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
34156  * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
34157  *
34158  * Default value: 0.
34159  */
34160 void ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
34161
34162 /**
34163  * The remote node will require we keep a certain amount in direct payment to ourselves at all
34164  * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
34165  * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
34166  *
34167  * Default value: u64::max_value.
34168  */
34169 uint64_t ChannelHandshakeLimits_get_max_channel_reserve_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
34170
34171 /**
34172  * The remote node will require we keep a certain amount in direct payment to ourselves at all
34173  * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
34174  * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
34175  *
34176  * Default value: u64::max_value.
34177  */
34178 void ChannelHandshakeLimits_set_max_channel_reserve_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
34179
34180 /**
34181  * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
34182  * time. This allows you to set a minimum such value.
34183  *
34184  * Default value: 0.
34185  */
34186 uint16_t ChannelHandshakeLimits_get_min_max_accepted_htlcs(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
34187
34188 /**
34189  * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
34190  * time. This allows you to set a minimum such value.
34191  *
34192  * Default value: 0.
34193  */
34194 void ChannelHandshakeLimits_set_min_max_accepted_htlcs(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
34195
34196 /**
34197  * Before a channel is usable the funding transaction will need to be confirmed by at least a
34198  * certain number of blocks, specified by the node which is not the funder (as the funder can
34199  * assume they aren't going to double-spend themselves).
34200  * This config allows you to set a limit on the maximum amount of time to wait.
34201  *
34202  * Default value: 144, or roughly one day and only applies to outbound channels.
34203  */
34204 uint32_t ChannelHandshakeLimits_get_max_minimum_depth(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
34205
34206 /**
34207  * Before a channel is usable the funding transaction will need to be confirmed by at least a
34208  * certain number of blocks, specified by the node which is not the funder (as the funder can
34209  * assume they aren't going to double-spend themselves).
34210  * This config allows you to set a limit on the maximum amount of time to wait.
34211  *
34212  * Default value: 144, or roughly one day and only applies to outbound channels.
34213  */
34214 void ChannelHandshakeLimits_set_max_minimum_depth(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint32_t val);
34215
34216 /**
34217  * Whether we implicitly trust funding transactions generated by us for our own outbound
34218  * channels to not be double-spent.
34219  *
34220  * If this is set, we assume that our own funding transactions are *never* double-spent, and
34221  * thus we can trust them without any confirmations. This is generally a reasonable
34222  * assumption, given we're the only ones who could ever double-spend it (assuming we have sole
34223  * control of the signing keys).
34224  *
34225  * You may wish to un-set this if you allow the user to (or do in an automated fashion)
34226  * double-spend the funding transaction to RBF with an alternative channel open.
34227  *
34228  * This only applies if our counterparty set their confirmations-required value to 0, and we
34229  * always trust our own funding transaction at 1 confirmation irrespective of this value.
34230  * Thus, this effectively acts as a `min_minimum_depth`, with the only possible values being
34231  * `true` (0) and `false` (1).
34232  *
34233  * Default value: true
34234  */
34235 bool ChannelHandshakeLimits_get_trust_own_funding_0conf(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
34236
34237 /**
34238  * Whether we implicitly trust funding transactions generated by us for our own outbound
34239  * channels to not be double-spent.
34240  *
34241  * If this is set, we assume that our own funding transactions are *never* double-spent, and
34242  * thus we can trust them without any confirmations. This is generally a reasonable
34243  * assumption, given we're the only ones who could ever double-spend it (assuming we have sole
34244  * control of the signing keys).
34245  *
34246  * You may wish to un-set this if you allow the user to (or do in an automated fashion)
34247  * double-spend the funding transaction to RBF with an alternative channel open.
34248  *
34249  * This only applies if our counterparty set their confirmations-required value to 0, and we
34250  * always trust our own funding transaction at 1 confirmation irrespective of this value.
34251  * Thus, this effectively acts as a `min_minimum_depth`, with the only possible values being
34252  * `true` (0) and `false` (1).
34253  *
34254  * Default value: true
34255  */
34256 void ChannelHandshakeLimits_set_trust_own_funding_0conf(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, bool val);
34257
34258 /**
34259  * Set to force an incoming channel to match our announced channel preference in
34260  * [`ChannelHandshakeConfig::announced_channel`].
34261  *
34262  * For a node which is not online reliably, this should be set to true and
34263  * [`ChannelHandshakeConfig::announced_channel`] set to false, ensuring that no announced (aka public)
34264  * channels will ever be opened.
34265  *
34266  * Default value: true.
34267  */
34268 bool ChannelHandshakeLimits_get_force_announced_channel_preference(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
34269
34270 /**
34271  * Set to force an incoming channel to match our announced channel preference in
34272  * [`ChannelHandshakeConfig::announced_channel`].
34273  *
34274  * For a node which is not online reliably, this should be set to true and
34275  * [`ChannelHandshakeConfig::announced_channel`] set to false, ensuring that no announced (aka public)
34276  * channels will ever be opened.
34277  *
34278  * Default value: true.
34279  */
34280 void ChannelHandshakeLimits_set_force_announced_channel_preference(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, bool val);
34281
34282 /**
34283  * Set to the amount of time we're willing to wait to claim money back to us.
34284  *
34285  * Not checking this value would be a security issue, as our peer would be able to set it to
34286  * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
34287  *
34288  * Default value: 2016, which we also enforce as a maximum value so you can tweak config to
34289  * reduce the loss of having useless locked funds (if your peer accepts)
34290  */
34291 uint16_t ChannelHandshakeLimits_get_their_to_self_delay(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
34292
34293 /**
34294  * Set to the amount of time we're willing to wait to claim money back to us.
34295  *
34296  * Not checking this value would be a security issue, as our peer would be able to set it to
34297  * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
34298  *
34299  * Default value: 2016, which we also enforce as a maximum value so you can tweak config to
34300  * reduce the loss of having useless locked funds (if your peer accepts)
34301  */
34302 void ChannelHandshakeLimits_set_their_to_self_delay(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
34303
34304 /**
34305  * Constructs a new ChannelHandshakeLimits given each field
34306  */
34307 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);
34308
34309 /**
34310  * Creates a copy of the ChannelHandshakeLimits
34311  */
34312 struct LDKChannelHandshakeLimits ChannelHandshakeLimits_clone(const struct LDKChannelHandshakeLimits *NONNULL_PTR orig);
34313
34314 /**
34315  * Creates a "default" ChannelHandshakeLimits. See struct and individual field documentaiton for details on which values are used.
34316  */
34317 MUST_USE_RES struct LDKChannelHandshakeLimits ChannelHandshakeLimits_default(void);
34318
34319 /**
34320  * Frees any resources used by the MaxDustHTLCExposure
34321  */
34322 void MaxDustHTLCExposure_free(struct LDKMaxDustHTLCExposure this_ptr);
34323
34324 /**
34325  * Creates a copy of the MaxDustHTLCExposure
34326  */
34327 struct LDKMaxDustHTLCExposure MaxDustHTLCExposure_clone(const struct LDKMaxDustHTLCExposure *NONNULL_PTR orig);
34328
34329 /**
34330  * Utility method to constructs a new FixedLimitMsat-variant MaxDustHTLCExposure
34331  */
34332 struct LDKMaxDustHTLCExposure MaxDustHTLCExposure_fixed_limit_msat(uint64_t a);
34333
34334 /**
34335  * Utility method to constructs a new FeeRateMultiplier-variant MaxDustHTLCExposure
34336  */
34337 struct LDKMaxDustHTLCExposure MaxDustHTLCExposure_fee_rate_multiplier(uint64_t a);
34338
34339 /**
34340  * Checks if two MaxDustHTLCExposures contain equal inner contents.
34341  * This ignores pointers and is_owned flags and looks at the values in fields.
34342  */
34343 bool MaxDustHTLCExposure_eq(const struct LDKMaxDustHTLCExposure *NONNULL_PTR a, const struct LDKMaxDustHTLCExposure *NONNULL_PTR b);
34344
34345 /**
34346  * Serialize the MaxDustHTLCExposure object into a byte array which can be read by MaxDustHTLCExposure_read
34347  */
34348 struct LDKCVec_u8Z MaxDustHTLCExposure_write(const struct LDKMaxDustHTLCExposure *NONNULL_PTR obj);
34349
34350 /**
34351  * Read a MaxDustHTLCExposure from a byte array, created by MaxDustHTLCExposure_write
34352  */
34353 struct LDKCResult_MaxDustHTLCExposureDecodeErrorZ MaxDustHTLCExposure_read(struct LDKu8slice ser);
34354
34355 /**
34356  * Frees any resources used by the ChannelConfig, if is_owned is set and inner is non-NULL.
34357  */
34358 void ChannelConfig_free(struct LDKChannelConfig this_obj);
34359
34360 /**
34361  * Amount (in millionths of a satoshi) charged per satoshi for payments forwarded outbound
34362  * over the channel.
34363  * This may be allowed to change at runtime in a later update, however doing so must result in
34364  * update messages sent to notify all nodes of our updated relay fee.
34365  *
34366  * Default value: 0.
34367  */
34368 uint32_t ChannelConfig_get_forwarding_fee_proportional_millionths(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
34369
34370 /**
34371  * Amount (in millionths of a satoshi) charged per satoshi for payments forwarded outbound
34372  * over the channel.
34373  * This may be allowed to change at runtime in a later update, however doing so must result in
34374  * update messages sent to notify all nodes of our updated relay fee.
34375  *
34376  * Default value: 0.
34377  */
34378 void ChannelConfig_set_forwarding_fee_proportional_millionths(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint32_t val);
34379
34380 /**
34381  * Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in
34382  * excess of [`forwarding_fee_proportional_millionths`].
34383  * This may be allowed to change at runtime in a later update, however doing so must result in
34384  * update messages sent to notify all nodes of our updated relay fee.
34385  *
34386  * The default value of a single satoshi roughly matches the market rate on many routing nodes
34387  * as of July 2021. Adjusting it upwards or downwards may change whether nodes route through
34388  * this node.
34389  *
34390  * Default value: 1000.
34391  *
34392  * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths
34393  */
34394 uint32_t ChannelConfig_get_forwarding_fee_base_msat(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
34395
34396 /**
34397  * Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in
34398  * excess of [`forwarding_fee_proportional_millionths`].
34399  * This may be allowed to change at runtime in a later update, however doing so must result in
34400  * update messages sent to notify all nodes of our updated relay fee.
34401  *
34402  * The default value of a single satoshi roughly matches the market rate on many routing nodes
34403  * as of July 2021. Adjusting it upwards or downwards may change whether nodes route through
34404  * this node.
34405  *
34406  * Default value: 1000.
34407  *
34408  * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths
34409  */
34410 void ChannelConfig_set_forwarding_fee_base_msat(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint32_t val);
34411
34412 /**
34413  * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over
34414  * the channel this config applies to.
34415  *
34416  * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight
34417  * HTLC balance when a channel appears on-chain whereas
34418  * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining
34419  * (non-HTLC-encumbered) balance.
34420  *
34421  * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed,
34422  * we (or one of our watchtowers) MUST be online to check for broadcast of the current
34423  * commitment transaction at least once per this many blocks (minus some margin to allow us
34424  * enough time to broadcast and confirm a transaction, possibly with time in between to RBF
34425  * the spending transaction).
34426  *
34427  * Default value: 72 (12 hours at an average of 6 blocks/hour).
34428  * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as
34429  *                [`MIN_CLTV_EXPIRY_DELTA`] instead.
34430  *
34431  * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA
34432  */
34433 uint16_t ChannelConfig_get_cltv_expiry_delta(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
34434
34435 /**
34436  * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over
34437  * the channel this config applies to.
34438  *
34439  * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight
34440  * HTLC balance when a channel appears on-chain whereas
34441  * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining
34442  * (non-HTLC-encumbered) balance.
34443  *
34444  * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed,
34445  * we (or one of our watchtowers) MUST be online to check for broadcast of the current
34446  * commitment transaction at least once per this many blocks (minus some margin to allow us
34447  * enough time to broadcast and confirm a transaction, possibly with time in between to RBF
34448  * the spending transaction).
34449  *
34450  * Default value: 72 (12 hours at an average of 6 blocks/hour).
34451  * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as
34452  *                [`MIN_CLTV_EXPIRY_DELTA`] instead.
34453  *
34454  * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA
34455  */
34456 void ChannelConfig_set_cltv_expiry_delta(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint16_t val);
34457
34458 /**
34459  * Limit our total exposure to potential loss to on-chain fees on close, including in-flight
34460  * HTLCs which are burned to fees as they are too small to claim on-chain and fees on
34461  * commitment transaction(s) broadcasted by our counterparty in excess of our own fee estimate.
34462  *
34463  * # HTLC-based Dust Exposure
34464  *
34465  * When an HTLC present in one of our channels is below a \"dust\" threshold, the HTLC will
34466  * not be claimable on-chain, instead being turned into additional miner fees if either
34467  * party force-closes the channel. Because the threshold is per-HTLC, our total exposure
34468  * to such payments may be substantial if there are many dust HTLCs present when the
34469  * channel is force-closed.
34470  *
34471  * The dust threshold for each HTLC is based on the `dust_limit_satoshis` for each party in a
34472  * channel negotiated throughout the channel open process, along with the fees required to have
34473  * a broadcastable HTLC spending transaction. When a channel supports anchor outputs
34474  * (specifically the zero fee HTLC transaction variant), this threshold no longer takes into
34475  * account the HTLC transaction fee as it is zero. Because of this, you may want to set this
34476  * value to a fixed limit for channels using anchor outputs, while the fee rate multiplier
34477  * variant is primarily intended for use with pre-anchor channels.
34478  *
34479  * The selected limit is applied for sent, forwarded, and received HTLCs and limits the total
34480  * exposure across all three types per-channel.
34481  *
34482  * # Transaction Fee Dust Exposure
34483  *
34484  * Further, counterparties broadcasting a commitment transaction in a force-close may result
34485  * in other balance being burned to fees, and thus all fees on commitment and HTLC
34486  * transactions in excess of our local fee estimates are included in the dust calculation.
34487  *
34488  * Because of this, another way to look at this limit is to divide it by 43,000 (or 218,750
34489  * for non-anchor channels) and see it as the maximum feerate disagreement (in sats/vB) per
34490  * non-dust HTLC we're allowed to have with our peers before risking a force-closure for
34491  * inbound channels.
34492  *
34493  * Thus, for the default value of 10_000 * a current feerate estimate of 10 sat/vB (or 2,500
34494  * sat/KW), we risk force-closure if we disagree with our peer by:
34495  * * `10_000 * 2_500 / 43_000 / (483*2)` = 0.6 sat/vB for anchor channels with 483 HTLCs in
34496  *   both directions (the maximum),
34497  * * `10_000 * 2_500 / 43_000 / (50*2)` = 5.8 sat/vB for anchor channels with 50 HTLCs in both
34498  *   directions (the LDK default max from [`ChannelHandshakeConfig::our_max_accepted_htlcs`])
34499  * * `10_000 * 2_500 / 218_750 / (483*2)` = 0.1 sat/vB for non-anchor channels with 483 HTLCs
34500  *   in both directions (the maximum),
34501  * * `10_000 * 2_500 / 218_750 / (50*2)` = 1.1 sat/vB for non-anchor channels with 50 HTLCs
34502  *   in both (the LDK default maximum from [`ChannelHandshakeConfig::our_max_accepted_htlcs`])
34503  *
34504  * Note that when using [`MaxDustHTLCExposure::FeeRateMultiplier`] this maximum disagreement
34505  * will scale linearly with increases (or decreases) in the our feerate estimates. Further,
34506  * for anchor channels we expect our counterparty to use a relatively low feerate estimate
34507  * while we use [`ConfirmationTarget::OnChainSweep`] (which should be relatively high) and
34508  * feerate disagreement force-closures should only occur when theirs is higher than ours.
34509  *
34510  * Default value: [`MaxDustHTLCExposure::FeeRateMultiplier`] with a multiplier of 10_000.
34511  *
34512  * [`ConfirmationTarget::OnChainSweep`]: crate::chain::chaininterface::ConfirmationTarget::OnChainSweep
34513  */
34514 struct LDKMaxDustHTLCExposure ChannelConfig_get_max_dust_htlc_exposure(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
34515
34516 /**
34517  * Limit our total exposure to potential loss to on-chain fees on close, including in-flight
34518  * HTLCs which are burned to fees as they are too small to claim on-chain and fees on
34519  * commitment transaction(s) broadcasted by our counterparty in excess of our own fee estimate.
34520  *
34521  * # HTLC-based Dust Exposure
34522  *
34523  * When an HTLC present in one of our channels is below a \"dust\" threshold, the HTLC will
34524  * not be claimable on-chain, instead being turned into additional miner fees if either
34525  * party force-closes the channel. Because the threshold is per-HTLC, our total exposure
34526  * to such payments may be substantial if there are many dust HTLCs present when the
34527  * channel is force-closed.
34528  *
34529  * The dust threshold for each HTLC is based on the `dust_limit_satoshis` for each party in a
34530  * channel negotiated throughout the channel open process, along with the fees required to have
34531  * a broadcastable HTLC spending transaction. When a channel supports anchor outputs
34532  * (specifically the zero fee HTLC transaction variant), this threshold no longer takes into
34533  * account the HTLC transaction fee as it is zero. Because of this, you may want to set this
34534  * value to a fixed limit for channels using anchor outputs, while the fee rate multiplier
34535  * variant is primarily intended for use with pre-anchor channels.
34536  *
34537  * The selected limit is applied for sent, forwarded, and received HTLCs and limits the total
34538  * exposure across all three types per-channel.
34539  *
34540  * # Transaction Fee Dust Exposure
34541  *
34542  * Further, counterparties broadcasting a commitment transaction in a force-close may result
34543  * in other balance being burned to fees, and thus all fees on commitment and HTLC
34544  * transactions in excess of our local fee estimates are included in the dust calculation.
34545  *
34546  * Because of this, another way to look at this limit is to divide it by 43,000 (or 218,750
34547  * for non-anchor channels) and see it as the maximum feerate disagreement (in sats/vB) per
34548  * non-dust HTLC we're allowed to have with our peers before risking a force-closure for
34549  * inbound channels.
34550  *
34551  * Thus, for the default value of 10_000 * a current feerate estimate of 10 sat/vB (or 2,500
34552  * sat/KW), we risk force-closure if we disagree with our peer by:
34553  * * `10_000 * 2_500 / 43_000 / (483*2)` = 0.6 sat/vB for anchor channels with 483 HTLCs in
34554  *   both directions (the maximum),
34555  * * `10_000 * 2_500 / 43_000 / (50*2)` = 5.8 sat/vB for anchor channels with 50 HTLCs in both
34556  *   directions (the LDK default max from [`ChannelHandshakeConfig::our_max_accepted_htlcs`])
34557  * * `10_000 * 2_500 / 218_750 / (483*2)` = 0.1 sat/vB for non-anchor channels with 483 HTLCs
34558  *   in both directions (the maximum),
34559  * * `10_000 * 2_500 / 218_750 / (50*2)` = 1.1 sat/vB for non-anchor channels with 50 HTLCs
34560  *   in both (the LDK default maximum from [`ChannelHandshakeConfig::our_max_accepted_htlcs`])
34561  *
34562  * Note that when using [`MaxDustHTLCExposure::FeeRateMultiplier`] this maximum disagreement
34563  * will scale linearly with increases (or decreases) in the our feerate estimates. Further,
34564  * for anchor channels we expect our counterparty to use a relatively low feerate estimate
34565  * while we use [`ConfirmationTarget::OnChainSweep`] (which should be relatively high) and
34566  * feerate disagreement force-closures should only occur when theirs is higher than ours.
34567  *
34568  * Default value: [`MaxDustHTLCExposure::FeeRateMultiplier`] with a multiplier of 10_000.
34569  *
34570  * [`ConfirmationTarget::OnChainSweep`]: crate::chain::chaininterface::ConfirmationTarget::OnChainSweep
34571  */
34572 void ChannelConfig_set_max_dust_htlc_exposure(struct LDKChannelConfig *NONNULL_PTR this_ptr, struct LDKMaxDustHTLCExposure val);
34573
34574 /**
34575  * The additional fee we're willing to pay to avoid waiting for the counterparty's
34576  * `to_self_delay` to reclaim funds.
34577  *
34578  * When we close a channel cooperatively with our counterparty, we negotiate a fee for the
34579  * closing transaction which both sides find acceptable, ultimately paid by the channel
34580  * funder/initiator.
34581  *
34582  * When we are the funder, because we have to pay the channel closing fee, we bound the
34583  * acceptable fee by our [`ChannelCloseMinimum`] and [`NonAnchorChannelFee`] fees, with the upper bound increased by
34584  * this value. Because the on-chain fee we'd pay to force-close the channel is kept near our
34585  * [`NonAnchorChannelFee`] feerate during normal operation, this value represents the additional fee we're
34586  * willing to pay in order to avoid waiting for our counterparty's to_self_delay to reclaim our
34587  * funds.
34588  *
34589  * When we are not the funder, we require the closing transaction fee pay at least our
34590  * [`ChannelCloseMinimum`] fee estimate, but allow our counterparty to pay as much fee as they like.
34591  * Thus, this value is ignored when we are not the funder.
34592  *
34593  * Default value: 1000 satoshis.
34594  *
34595  * [`NonAnchorChannelFee`]: crate::chain::chaininterface::ConfirmationTarget::NonAnchorChannelFee
34596  * [`ChannelCloseMinimum`]: crate::chain::chaininterface::ConfirmationTarget::ChannelCloseMinimum
34597  */
34598 uint64_t ChannelConfig_get_force_close_avoidance_max_fee_satoshis(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
34599
34600 /**
34601  * The additional fee we're willing to pay to avoid waiting for the counterparty's
34602  * `to_self_delay` to reclaim funds.
34603  *
34604  * When we close a channel cooperatively with our counterparty, we negotiate a fee for the
34605  * closing transaction which both sides find acceptable, ultimately paid by the channel
34606  * funder/initiator.
34607  *
34608  * When we are the funder, because we have to pay the channel closing fee, we bound the
34609  * acceptable fee by our [`ChannelCloseMinimum`] and [`NonAnchorChannelFee`] fees, with the upper bound increased by
34610  * this value. Because the on-chain fee we'd pay to force-close the channel is kept near our
34611  * [`NonAnchorChannelFee`] feerate during normal operation, this value represents the additional fee we're
34612  * willing to pay in order to avoid waiting for our counterparty's to_self_delay to reclaim our
34613  * funds.
34614  *
34615  * When we are not the funder, we require the closing transaction fee pay at least our
34616  * [`ChannelCloseMinimum`] fee estimate, but allow our counterparty to pay as much fee as they like.
34617  * Thus, this value is ignored when we are not the funder.
34618  *
34619  * Default value: 1000 satoshis.
34620  *
34621  * [`NonAnchorChannelFee`]: crate::chain::chaininterface::ConfirmationTarget::NonAnchorChannelFee
34622  * [`ChannelCloseMinimum`]: crate::chain::chaininterface::ConfirmationTarget::ChannelCloseMinimum
34623  */
34624 void ChannelConfig_set_force_close_avoidance_max_fee_satoshis(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint64_t val);
34625
34626 /**
34627  * If set, allows this channel's counterparty to skim an additional fee off this node's inbound
34628  * HTLCs. Useful for liquidity providers to offload on-chain channel costs to end users.
34629  *
34630  * Usage:
34631  * - The payee will set this option and set its invoice route hints to use [intercept scids]
34632  *   generated by this channel's counterparty.
34633  * - The counterparty will get an [`HTLCIntercepted`] event upon payment forward, and call
34634  *   [`forward_intercepted_htlc`] with less than the amount provided in
34635  *   [`HTLCIntercepted::expected_outbound_amount_msat`]. The difference between the expected and
34636  *   actual forward amounts is their fee. See
34637  *   <https://github.com/BitcoinAndLightningLayerSpecs/lsp/tree/main/LSPS2#flow-lsp-trusts-client-model>
34638  *   for how this feature may be used in the LSP use case.
34639  *
34640  * # Note
34641  * It's important for payee wallet software to verify that [`PaymentClaimable::amount_msat`] is
34642  * as-expected if this feature is activated, otherwise they may lose money!
34643  * [`PaymentClaimable::counterparty_skimmed_fee_msat`] provides the fee taken by the
34644  * counterparty.
34645  *
34646  * # Note
34647  * Switching this config flag on may break compatibility with versions of LDK prior to 0.0.116.
34648  * Unsetting this flag between restarts may lead to payment receive failures.
34649  *
34650  * Default value: false.
34651  *
34652  * [intercept scids]: crate::ln::channelmanager::ChannelManager::get_intercept_scid
34653  * [`forward_intercepted_htlc`]: crate::ln::channelmanager::ChannelManager::forward_intercepted_htlc
34654  * [`HTLCIntercepted`]: crate::events::Event::HTLCIntercepted
34655  * [`HTLCIntercepted::expected_outbound_amount_msat`]: crate::events::Event::HTLCIntercepted::expected_outbound_amount_msat
34656  * [`PaymentClaimable::amount_msat`]: crate::events::Event::PaymentClaimable::amount_msat
34657  * [`PaymentClaimable::counterparty_skimmed_fee_msat`]: crate::events::Event::PaymentClaimable::counterparty_skimmed_fee_msat
34658  */
34659 bool ChannelConfig_get_accept_underpaying_htlcs(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
34660
34661 /**
34662  * If set, allows this channel's counterparty to skim an additional fee off this node's inbound
34663  * HTLCs. Useful for liquidity providers to offload on-chain channel costs to end users.
34664  *
34665  * Usage:
34666  * - The payee will set this option and set its invoice route hints to use [intercept scids]
34667  *   generated by this channel's counterparty.
34668  * - The counterparty will get an [`HTLCIntercepted`] event upon payment forward, and call
34669  *   [`forward_intercepted_htlc`] with less than the amount provided in
34670  *   [`HTLCIntercepted::expected_outbound_amount_msat`]. The difference between the expected and
34671  *   actual forward amounts is their fee. See
34672  *   <https://github.com/BitcoinAndLightningLayerSpecs/lsp/tree/main/LSPS2#flow-lsp-trusts-client-model>
34673  *   for how this feature may be used in the LSP use case.
34674  *
34675  * # Note
34676  * It's important for payee wallet software to verify that [`PaymentClaimable::amount_msat`] is
34677  * as-expected if this feature is activated, otherwise they may lose money!
34678  * [`PaymentClaimable::counterparty_skimmed_fee_msat`] provides the fee taken by the
34679  * counterparty.
34680  *
34681  * # Note
34682  * Switching this config flag on may break compatibility with versions of LDK prior to 0.0.116.
34683  * Unsetting this flag between restarts may lead to payment receive failures.
34684  *
34685  * Default value: false.
34686  *
34687  * [intercept scids]: crate::ln::channelmanager::ChannelManager::get_intercept_scid
34688  * [`forward_intercepted_htlc`]: crate::ln::channelmanager::ChannelManager::forward_intercepted_htlc
34689  * [`HTLCIntercepted`]: crate::events::Event::HTLCIntercepted
34690  * [`HTLCIntercepted::expected_outbound_amount_msat`]: crate::events::Event::HTLCIntercepted::expected_outbound_amount_msat
34691  * [`PaymentClaimable::amount_msat`]: crate::events::Event::PaymentClaimable::amount_msat
34692  * [`PaymentClaimable::counterparty_skimmed_fee_msat`]: crate::events::Event::PaymentClaimable::counterparty_skimmed_fee_msat
34693  */
34694 void ChannelConfig_set_accept_underpaying_htlcs(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val);
34695
34696 /**
34697  * Constructs a new ChannelConfig given each field
34698  */
34699 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);
34700
34701 /**
34702  * Creates a copy of the ChannelConfig
34703  */
34704 struct LDKChannelConfig ChannelConfig_clone(const struct LDKChannelConfig *NONNULL_PTR orig);
34705
34706 /**
34707  * Checks if two ChannelConfigs contain equal inner contents.
34708  * This ignores pointers and is_owned flags and looks at the values in fields.
34709  * Two objects with NULL inner values will be considered "equal" here.
34710  */
34711 bool ChannelConfig_eq(const struct LDKChannelConfig *NONNULL_PTR a, const struct LDKChannelConfig *NONNULL_PTR b);
34712
34713 /**
34714  * Applies the given [`ChannelConfigUpdate`] as a partial update to the [`ChannelConfig`].
34715  */
34716 void ChannelConfig_apply(struct LDKChannelConfig *NONNULL_PTR this_arg, const struct LDKChannelConfigUpdate *NONNULL_PTR update);
34717
34718 /**
34719  * Creates a "default" ChannelConfig. See struct and individual field documentaiton for details on which values are used.
34720  */
34721 MUST_USE_RES struct LDKChannelConfig ChannelConfig_default(void);
34722
34723 /**
34724  * Serialize the ChannelConfig object into a byte array which can be read by ChannelConfig_read
34725  */
34726 struct LDKCVec_u8Z ChannelConfig_write(const struct LDKChannelConfig *NONNULL_PTR obj);
34727
34728 /**
34729  * Read a ChannelConfig from a byte array, created by ChannelConfig_write
34730  */
34731 struct LDKCResult_ChannelConfigDecodeErrorZ ChannelConfig_read(struct LDKu8slice ser);
34732
34733 /**
34734  * Frees any resources used by the ChannelConfigUpdate, if is_owned is set and inner is non-NULL.
34735  */
34736 void ChannelConfigUpdate_free(struct LDKChannelConfigUpdate this_obj);
34737
34738 struct LDKCOption_u32Z ChannelConfigUpdate_get_forwarding_fee_proportional_millionths(const struct LDKChannelConfigUpdate *NONNULL_PTR this_ptr);
34739
34740 void ChannelConfigUpdate_set_forwarding_fee_proportional_millionths(struct LDKChannelConfigUpdate *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val);
34741
34742 struct LDKCOption_u32Z ChannelConfigUpdate_get_forwarding_fee_base_msat(const struct LDKChannelConfigUpdate *NONNULL_PTR this_ptr);
34743
34744 void ChannelConfigUpdate_set_forwarding_fee_base_msat(struct LDKChannelConfigUpdate *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val);
34745
34746 struct LDKCOption_u16Z ChannelConfigUpdate_get_cltv_expiry_delta(const struct LDKChannelConfigUpdate *NONNULL_PTR this_ptr);
34747
34748 void ChannelConfigUpdate_set_cltv_expiry_delta(struct LDKChannelConfigUpdate *NONNULL_PTR this_ptr, struct LDKCOption_u16Z val);
34749
34750 /**
34751  *
34752  * Returns a copy of the field.
34753  */
34754 struct LDKCOption_MaxDustHTLCExposureZ ChannelConfigUpdate_get_max_dust_htlc_exposure_msat(const struct LDKChannelConfigUpdate *NONNULL_PTR this_ptr);
34755
34756 void ChannelConfigUpdate_set_max_dust_htlc_exposure_msat(struct LDKChannelConfigUpdate *NONNULL_PTR this_ptr, struct LDKCOption_MaxDustHTLCExposureZ val);
34757
34758 struct LDKCOption_u64Z ChannelConfigUpdate_get_force_close_avoidance_max_fee_satoshis(const struct LDKChannelConfigUpdate *NONNULL_PTR this_ptr);
34759
34760 void ChannelConfigUpdate_set_force_close_avoidance_max_fee_satoshis(struct LDKChannelConfigUpdate *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
34761
34762 /**
34763  * Constructs a new ChannelConfigUpdate given each field
34764  */
34765 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);
34766
34767 /**
34768  * Creates a "default" ChannelConfigUpdate. See struct and individual field documentaiton for details on which values are used.
34769  */
34770 MUST_USE_RES struct LDKChannelConfigUpdate ChannelConfigUpdate_default(void);
34771
34772 /**
34773  * Frees any resources used by the UserConfig, if is_owned is set and inner is non-NULL.
34774  */
34775 void UserConfig_free(struct LDKUserConfig this_obj);
34776
34777 /**
34778  * Channel handshake config that we propose to our counterparty.
34779  */
34780 struct LDKChannelHandshakeConfig UserConfig_get_channel_handshake_config(const struct LDKUserConfig *NONNULL_PTR this_ptr);
34781
34782 /**
34783  * Channel handshake config that we propose to our counterparty.
34784  */
34785 void UserConfig_set_channel_handshake_config(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeConfig val);
34786
34787 /**
34788  * Limits applied to our counterparty's proposed channel handshake config settings.
34789  */
34790 struct LDKChannelHandshakeLimits UserConfig_get_channel_handshake_limits(const struct LDKUserConfig *NONNULL_PTR this_ptr);
34791
34792 /**
34793  * Limits applied to our counterparty's proposed channel handshake config settings.
34794  */
34795 void UserConfig_set_channel_handshake_limits(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeLimits val);
34796
34797 /**
34798  * Channel config which affects behavior during channel lifetime.
34799  */
34800 struct LDKChannelConfig UserConfig_get_channel_config(const struct LDKUserConfig *NONNULL_PTR this_ptr);
34801
34802 /**
34803  * Channel config which affects behavior during channel lifetime.
34804  */
34805 void UserConfig_set_channel_config(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelConfig val);
34806
34807 /**
34808  * If this is set to false, we will reject any HTLCs which were to be forwarded over private
34809  * channels. This prevents us from taking on HTLC-forwarding risk when we intend to run as a
34810  * node which is not online reliably.
34811  *
34812  * For nodes which are not online reliably, you should set all channels to *not* be announced
34813  * (using [`ChannelHandshakeConfig::announced_channel`] and
34814  * [`ChannelHandshakeLimits::force_announced_channel_preference`]) and set this to false to
34815  * ensure you are not exposed to any forwarding risk.
34816  *
34817  * Note that because you cannot change a channel's announced state after creation, there is no
34818  * way to disable forwarding on public channels retroactively. Thus, in order to change a node
34819  * from a publicly-announced forwarding node to a private non-forwarding node you must close
34820  * all your channels and open new ones. For privacy, you should also change your node_id
34821  * (swapping all private and public key material for new ones) at that time.
34822  *
34823  * Default value: false.
34824  */
34825 bool UserConfig_get_accept_forwards_to_priv_channels(const struct LDKUserConfig *NONNULL_PTR this_ptr);
34826
34827 /**
34828  * If this is set to false, we will reject any HTLCs which were to be forwarded over private
34829  * channels. This prevents us from taking on HTLC-forwarding risk when we intend to run as a
34830  * node which is not online reliably.
34831  *
34832  * For nodes which are not online reliably, you should set all channels to *not* be announced
34833  * (using [`ChannelHandshakeConfig::announced_channel`] and
34834  * [`ChannelHandshakeLimits::force_announced_channel_preference`]) and set this to false to
34835  * ensure you are not exposed to any forwarding risk.
34836  *
34837  * Note that because you cannot change a channel's announced state after creation, there is no
34838  * way to disable forwarding on public channels retroactively. Thus, in order to change a node
34839  * from a publicly-announced forwarding node to a private non-forwarding node you must close
34840  * all your channels and open new ones. For privacy, you should also change your node_id
34841  * (swapping all private and public key material for new ones) at that time.
34842  *
34843  * Default value: false.
34844  */
34845 void UserConfig_set_accept_forwards_to_priv_channels(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val);
34846
34847 /**
34848  * If this is set to false, we do not accept inbound requests to open a new channel.
34849  * Default value: true.
34850  */
34851 bool UserConfig_get_accept_inbound_channels(const struct LDKUserConfig *NONNULL_PTR this_ptr);
34852
34853 /**
34854  * If this is set to false, we do not accept inbound requests to open a new channel.
34855  * Default value: true.
34856  */
34857 void UserConfig_set_accept_inbound_channels(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val);
34858
34859 /**
34860  * If this is set to true, the user needs to manually accept inbound requests to open a new
34861  * channel.
34862  *
34863  * When set to true, [`Event::OpenChannelRequest`] will be triggered once a request to open a
34864  * new inbound channel is received through a [`msgs::OpenChannel`] message. In that case, a
34865  * [`msgs::AcceptChannel`] message will not be sent back to the counterparty node unless the
34866  * user explicitly chooses to accept the request.
34867  *
34868  * Default value: false.
34869  *
34870  * [`Event::OpenChannelRequest`]: crate::events::Event::OpenChannelRequest
34871  * [`msgs::OpenChannel`]: crate::ln::msgs::OpenChannel
34872  * [`msgs::AcceptChannel`]: crate::ln::msgs::AcceptChannel
34873  */
34874 bool UserConfig_get_manually_accept_inbound_channels(const struct LDKUserConfig *NONNULL_PTR this_ptr);
34875
34876 /**
34877  * If this is set to true, the user needs to manually accept inbound requests to open a new
34878  * channel.
34879  *
34880  * When set to true, [`Event::OpenChannelRequest`] will be triggered once a request to open a
34881  * new inbound channel is received through a [`msgs::OpenChannel`] message. In that case, a
34882  * [`msgs::AcceptChannel`] message will not be sent back to the counterparty node unless the
34883  * user explicitly chooses to accept the request.
34884  *
34885  * Default value: false.
34886  *
34887  * [`Event::OpenChannelRequest`]: crate::events::Event::OpenChannelRequest
34888  * [`msgs::OpenChannel`]: crate::ln::msgs::OpenChannel
34889  * [`msgs::AcceptChannel`]: crate::ln::msgs::AcceptChannel
34890  */
34891 void UserConfig_set_manually_accept_inbound_channels(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val);
34892
34893 /**
34894  *  If this is set to true, LDK will intercept HTLCs that are attempting to be forwarded over
34895  *  fake short channel ids generated via [`ChannelManager::get_intercept_scid`]. Upon HTLC
34896  *  intercept, LDK will generate an [`Event::HTLCIntercepted`] which MUST be handled by the user.
34897  *
34898  *  Setting this to true may break backwards compatibility with LDK versions < 0.0.113.
34899  *
34900  *  Default value: false.
34901  *
34902  * [`ChannelManager::get_intercept_scid`]: crate::ln::channelmanager::ChannelManager::get_intercept_scid
34903  * [`Event::HTLCIntercepted`]: crate::events::Event::HTLCIntercepted
34904  */
34905 bool UserConfig_get_accept_intercept_htlcs(const struct LDKUserConfig *NONNULL_PTR this_ptr);
34906
34907 /**
34908  *  If this is set to true, LDK will intercept HTLCs that are attempting to be forwarded over
34909  *  fake short channel ids generated via [`ChannelManager::get_intercept_scid`]. Upon HTLC
34910  *  intercept, LDK will generate an [`Event::HTLCIntercepted`] which MUST be handled by the user.
34911  *
34912  *  Setting this to true may break backwards compatibility with LDK versions < 0.0.113.
34913  *
34914  *  Default value: false.
34915  *
34916  * [`ChannelManager::get_intercept_scid`]: crate::ln::channelmanager::ChannelManager::get_intercept_scid
34917  * [`Event::HTLCIntercepted`]: crate::events::Event::HTLCIntercepted
34918  */
34919 void UserConfig_set_accept_intercept_htlcs(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val);
34920
34921 /**
34922  * If this is set to false, when receiving a keysend payment we'll fail it if it has multiple
34923  * parts. If this is set to true, we'll accept the payment.
34924  *
34925  * Setting this to true will break backwards compatibility upon downgrading to an LDK
34926  * version < 0.0.116 while receiving an MPP keysend. If we have already received an MPP
34927  * keysend, downgrading will cause us to fail to deserialize [`ChannelManager`].
34928  *
34929  * Default value: false.
34930  *
34931  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
34932  */
34933 bool UserConfig_get_accept_mpp_keysend(const struct LDKUserConfig *NONNULL_PTR this_ptr);
34934
34935 /**
34936  * If this is set to false, when receiving a keysend payment we'll fail it if it has multiple
34937  * parts. If this is set to true, we'll accept the payment.
34938  *
34939  * Setting this to true will break backwards compatibility upon downgrading to an LDK
34940  * version < 0.0.116 while receiving an MPP keysend. If we have already received an MPP
34941  * keysend, downgrading will cause us to fail to deserialize [`ChannelManager`].
34942  *
34943  * Default value: false.
34944  *
34945  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
34946  */
34947 void UserConfig_set_accept_mpp_keysend(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val);
34948
34949 /**
34950  * Constructs a new UserConfig given each field
34951  */
34952 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);
34953
34954 /**
34955  * Creates a copy of the UserConfig
34956  */
34957 struct LDKUserConfig UserConfig_clone(const struct LDKUserConfig *NONNULL_PTR orig);
34958
34959 /**
34960  * Creates a "default" UserConfig. See struct and individual field documentaiton for details on which values are used.
34961  */
34962 MUST_USE_RES struct LDKUserConfig UserConfig_default(void);
34963
34964 /**
34965  * Frees any resources used by the BestBlock, if is_owned is set and inner is non-NULL.
34966  */
34967 void BestBlock_free(struct LDKBestBlock this_obj);
34968
34969 /**
34970  * The block's hash
34971  */
34972 const uint8_t (*BestBlock_get_block_hash(const struct LDKBestBlock *NONNULL_PTR this_ptr))[32];
34973
34974 /**
34975  * The block's hash
34976  */
34977 void BestBlock_set_block_hash(struct LDKBestBlock *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
34978
34979 /**
34980  * The height at which the block was confirmed.
34981  */
34982 uint32_t BestBlock_get_height(const struct LDKBestBlock *NONNULL_PTR this_ptr);
34983
34984 /**
34985  * The height at which the block was confirmed.
34986  */
34987 void BestBlock_set_height(struct LDKBestBlock *NONNULL_PTR this_ptr, uint32_t val);
34988
34989 /**
34990  * Constructs a new BestBlock given each field
34991  */
34992 MUST_USE_RES struct LDKBestBlock BestBlock_new(struct LDKThirtyTwoBytes block_hash_arg, uint32_t height_arg);
34993
34994 /**
34995  * Creates a copy of the BestBlock
34996  */
34997 struct LDKBestBlock BestBlock_clone(const struct LDKBestBlock *NONNULL_PTR orig);
34998
34999 /**
35000  * Generates a non-cryptographic 64-bit hash of the BestBlock.
35001  */
35002 uint64_t BestBlock_hash(const struct LDKBestBlock *NONNULL_PTR o);
35003
35004 /**
35005  * Checks if two BestBlocks contain equal inner contents.
35006  * This ignores pointers and is_owned flags and looks at the values in fields.
35007  * Two objects with NULL inner values will be considered "equal" here.
35008  */
35009 bool BestBlock_eq(const struct LDKBestBlock *NONNULL_PTR a, const struct LDKBestBlock *NONNULL_PTR b);
35010
35011 /**
35012  * Constructs a `BestBlock` that represents the genesis block at height 0 of the given
35013  * network.
35014  */
35015 MUST_USE_RES struct LDKBestBlock BestBlock_from_network(enum LDKNetwork network);
35016
35017 /**
35018  * Serialize the BestBlock object into a byte array which can be read by BestBlock_read
35019  */
35020 struct LDKCVec_u8Z BestBlock_write(const struct LDKBestBlock *NONNULL_PTR obj);
35021
35022 /**
35023  * Read a BestBlock from a byte array, created by BestBlock_write
35024  */
35025 struct LDKCResult_BestBlockDecodeErrorZ BestBlock_read(struct LDKu8slice ser);
35026
35027 /**
35028  * Calls the free function if one is set
35029  */
35030 void Listen_free(struct LDKListen this_ptr);
35031
35032 /**
35033  * Calls the free function if one is set
35034  */
35035 void Confirm_free(struct LDKConfirm this_ptr);
35036
35037 /**
35038  * Creates a copy of the ChannelMonitorUpdateStatus
35039  */
35040 enum LDKChannelMonitorUpdateStatus ChannelMonitorUpdateStatus_clone(const enum LDKChannelMonitorUpdateStatus *NONNULL_PTR orig);
35041
35042 /**
35043  * Utility method to constructs a new Completed-variant ChannelMonitorUpdateStatus
35044  */
35045 enum LDKChannelMonitorUpdateStatus ChannelMonitorUpdateStatus_completed(void);
35046
35047 /**
35048  * Utility method to constructs a new InProgress-variant ChannelMonitorUpdateStatus
35049  */
35050 enum LDKChannelMonitorUpdateStatus ChannelMonitorUpdateStatus_in_progress(void);
35051
35052 /**
35053  * Utility method to constructs a new UnrecoverableError-variant ChannelMonitorUpdateStatus
35054  */
35055 enum LDKChannelMonitorUpdateStatus ChannelMonitorUpdateStatus_unrecoverable_error(void);
35056
35057 /**
35058  * Checks if two ChannelMonitorUpdateStatuss contain equal inner contents.
35059  * This ignores pointers and is_owned flags and looks at the values in fields.
35060  */
35061 bool ChannelMonitorUpdateStatus_eq(const enum LDKChannelMonitorUpdateStatus *NONNULL_PTR a, const enum LDKChannelMonitorUpdateStatus *NONNULL_PTR b);
35062
35063 /**
35064  * Calls the free function if one is set
35065  */
35066 void Watch_free(struct LDKWatch this_ptr);
35067
35068 /**
35069  * Calls the free function if one is set
35070  */
35071 void Filter_free(struct LDKFilter this_ptr);
35072
35073 /**
35074  * Frees any resources used by the WatchedOutput, if is_owned is set and inner is non-NULL.
35075  */
35076 void WatchedOutput_free(struct LDKWatchedOutput this_obj);
35077
35078 /**
35079  * First block where the transaction output may have been spent.
35080  */
35081 struct LDKCOption_ThirtyTwoBytesZ WatchedOutput_get_block_hash(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
35082
35083 /**
35084  * First block where the transaction output may have been spent.
35085  */
35086 void WatchedOutput_set_block_hash(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKCOption_ThirtyTwoBytesZ val);
35087
35088 /**
35089  * Outpoint identifying the transaction output.
35090  */
35091 struct LDKOutPoint WatchedOutput_get_outpoint(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
35092
35093 /**
35094  * Outpoint identifying the transaction output.
35095  */
35096 void WatchedOutput_set_outpoint(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKOutPoint val);
35097
35098 /**
35099  * Spending condition of the transaction output.
35100  */
35101 struct LDKCVec_u8Z WatchedOutput_get_script_pubkey(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
35102
35103 /**
35104  * Spending condition of the transaction output.
35105  */
35106 void WatchedOutput_set_script_pubkey(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
35107
35108 /**
35109  * Constructs a new WatchedOutput given each field
35110  */
35111 MUST_USE_RES struct LDKWatchedOutput WatchedOutput_new(struct LDKCOption_ThirtyTwoBytesZ block_hash_arg, struct LDKOutPoint outpoint_arg, struct LDKCVec_u8Z script_pubkey_arg);
35112
35113 /**
35114  * Creates a copy of the WatchedOutput
35115  */
35116 struct LDKWatchedOutput WatchedOutput_clone(const struct LDKWatchedOutput *NONNULL_PTR orig);
35117
35118 /**
35119  * Checks if two WatchedOutputs contain equal inner contents.
35120  * This ignores pointers and is_owned flags and looks at the values in fields.
35121  * Two objects with NULL inner values will be considered "equal" here.
35122  */
35123 bool WatchedOutput_eq(const struct LDKWatchedOutput *NONNULL_PTR a, const struct LDKWatchedOutput *NONNULL_PTR b);
35124
35125 /**
35126  * Generates a non-cryptographic 64-bit hash of the WatchedOutput.
35127  */
35128 uint64_t WatchedOutput_hash(const struct LDKWatchedOutput *NONNULL_PTR o);
35129
35130 /**
35131  * Calls the free function if one is set
35132  */
35133 void BroadcasterInterface_free(struct LDKBroadcasterInterface this_ptr);
35134
35135 /**
35136  * Creates a copy of the ConfirmationTarget
35137  */
35138 enum LDKConfirmationTarget ConfirmationTarget_clone(const enum LDKConfirmationTarget *NONNULL_PTR orig);
35139
35140 /**
35141  * Utility method to constructs a new OnChainSweep-variant ConfirmationTarget
35142  */
35143 enum LDKConfirmationTarget ConfirmationTarget_on_chain_sweep(void);
35144
35145 /**
35146  * Utility method to constructs a new MinAllowedAnchorChannelRemoteFee-variant ConfirmationTarget
35147  */
35148 enum LDKConfirmationTarget ConfirmationTarget_min_allowed_anchor_channel_remote_fee(void);
35149
35150 /**
35151  * Utility method to constructs a new MinAllowedNonAnchorChannelRemoteFee-variant ConfirmationTarget
35152  */
35153 enum LDKConfirmationTarget ConfirmationTarget_min_allowed_non_anchor_channel_remote_fee(void);
35154
35155 /**
35156  * Utility method to constructs a new AnchorChannelFee-variant ConfirmationTarget
35157  */
35158 enum LDKConfirmationTarget ConfirmationTarget_anchor_channel_fee(void);
35159
35160 /**
35161  * Utility method to constructs a new NonAnchorChannelFee-variant ConfirmationTarget
35162  */
35163 enum LDKConfirmationTarget ConfirmationTarget_non_anchor_channel_fee(void);
35164
35165 /**
35166  * Utility method to constructs a new ChannelCloseMinimum-variant ConfirmationTarget
35167  */
35168 enum LDKConfirmationTarget ConfirmationTarget_channel_close_minimum(void);
35169
35170 /**
35171  * Utility method to constructs a new OutputSpendingFee-variant ConfirmationTarget
35172  */
35173 enum LDKConfirmationTarget ConfirmationTarget_output_spending_fee(void);
35174
35175 /**
35176  * Generates a non-cryptographic 64-bit hash of the ConfirmationTarget.
35177  */
35178 uint64_t ConfirmationTarget_hash(const enum LDKConfirmationTarget *NONNULL_PTR o);
35179
35180 /**
35181  * Checks if two ConfirmationTargets contain equal inner contents.
35182  * This ignores pointers and is_owned flags and looks at the values in fields.
35183  */
35184 bool ConfirmationTarget_eq(const enum LDKConfirmationTarget *NONNULL_PTR a, const enum LDKConfirmationTarget *NONNULL_PTR b);
35185
35186 /**
35187  * Calls the free function if one is set
35188  */
35189 void FeeEstimator_free(struct LDKFeeEstimator this_ptr);
35190
35191 /**
35192  * Frees any resources used by the MonitorUpdateId, if is_owned is set and inner is non-NULL.
35193  */
35194 void MonitorUpdateId_free(struct LDKMonitorUpdateId this_obj);
35195
35196 /**
35197  * Creates a copy of the MonitorUpdateId
35198  */
35199 struct LDKMonitorUpdateId MonitorUpdateId_clone(const struct LDKMonitorUpdateId *NONNULL_PTR orig);
35200
35201 /**
35202  * Generates a non-cryptographic 64-bit hash of the MonitorUpdateId.
35203  */
35204 uint64_t MonitorUpdateId_hash(const struct LDKMonitorUpdateId *NONNULL_PTR o);
35205
35206 /**
35207  * Checks if two MonitorUpdateIds contain equal inner contents.
35208  * This ignores pointers and is_owned flags and looks at the values in fields.
35209  * Two objects with NULL inner values will be considered "equal" here.
35210  */
35211 bool MonitorUpdateId_eq(const struct LDKMonitorUpdateId *NONNULL_PTR a, const struct LDKMonitorUpdateId *NONNULL_PTR b);
35212
35213 /**
35214  * Calls the free function if one is set
35215  */
35216 void Persist_free(struct LDKPersist this_ptr);
35217
35218 /**
35219  * Frees any resources used by the LockedChannelMonitor, if is_owned is set and inner is non-NULL.
35220  */
35221 void LockedChannelMonitor_free(struct LDKLockedChannelMonitor this_obj);
35222
35223 /**
35224  * Frees any resources used by the ChainMonitor, if is_owned is set and inner is non-NULL.
35225  */
35226 void ChainMonitor_free(struct LDKChainMonitor this_obj);
35227
35228 /**
35229  * Creates a new `ChainMonitor` used to watch on-chain activity pertaining to channels.
35230  *
35231  * When an optional chain source implementing [`chain::Filter`] is provided, the chain monitor
35232  * will call back to it indicating transactions and outputs of interest. This allows clients to
35233  * pre-filter blocks or only fetch blocks matching a compact filter. Otherwise, clients may
35234  * always need to fetch full blocks absent another means for determining which blocks contain
35235  * transactions relevant to the watched channels.
35236  */
35237 MUST_USE_RES struct LDKChainMonitor ChainMonitor_new(struct LDKCOption_FilterZ chain_source, struct LDKBroadcasterInterface broadcaster, struct LDKLogger logger, struct LDKFeeEstimator feeest, struct LDKPersist persister);
35238
35239 /**
35240  * Gets the balances in the contained [`ChannelMonitor`]s which are claimable on-chain or
35241  * claims which are awaiting confirmation.
35242  *
35243  * Includes the balances from each [`ChannelMonitor`] *except* those included in
35244  * `ignored_channels`, allowing you to filter out balances from channels which are still open
35245  * (and whose balance should likely be pulled from the [`ChannelDetails`]).
35246  *
35247  * See [`ChannelMonitor::get_claimable_balances`] for more details on the exact criteria for
35248  * inclusion in the return value.
35249  */
35250 MUST_USE_RES struct LDKCVec_BalanceZ ChainMonitor_get_claimable_balances(const struct LDKChainMonitor *NONNULL_PTR this_arg, struct LDKCVec_ChannelDetailsZ ignored_channels);
35251
35252 /**
35253  * Gets the [`LockedChannelMonitor`] for a given funding outpoint, returning an `Err` if no
35254  * such [`ChannelMonitor`] is currently being monitored for.
35255  *
35256  * Note that the result holds a mutex over our monitor set, and should not be held
35257  * indefinitely.
35258  */
35259 MUST_USE_RES struct LDKCResult_LockedChannelMonitorNoneZ ChainMonitor_get_monitor(const struct LDKChainMonitor *NONNULL_PTR this_arg, struct LDKOutPoint funding_txo);
35260
35261 /**
35262  * Lists the funding outpoint and channel ID of each [`ChannelMonitor`] being monitored.
35263  *
35264  * Note that [`ChannelMonitor`]s are not removed when a channel is closed as they are always
35265  * monitoring for on-chain state resolutions.
35266  */
35267 MUST_USE_RES struct LDKCVec_C2Tuple_OutPointChannelIdZZ ChainMonitor_list_monitors(const struct LDKChainMonitor *NONNULL_PTR this_arg);
35268
35269 /**
35270  * Lists the pending updates for each [`ChannelMonitor`] (by `OutPoint` being monitored).
35271  */
35272 MUST_USE_RES struct LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ ChainMonitor_list_pending_monitor_updates(const struct LDKChainMonitor *NONNULL_PTR this_arg);
35273
35274 /**
35275  * Indicates the persistence of a [`ChannelMonitor`] has completed after
35276  * [`ChannelMonitorUpdateStatus::InProgress`] was returned from an update operation.
35277  *
35278  * Thus, the anticipated use is, at a high level:
35279  *  1) This [`ChainMonitor`] calls [`Persist::update_persisted_channel`] which stores the
35280  *     update to disk and begins updating any remote (e.g. watchtower/backup) copies,
35281  *     returning [`ChannelMonitorUpdateStatus::InProgress`],
35282  *  2) once all remote copies are updated, you call this function with the
35283  *     `completed_update_id` that completed, and once all pending updates have completed the
35284  *     channel will be re-enabled.
35285  *
35286  * Returns an [`APIError::APIMisuseError`] if `funding_txo` does not match any currently
35287  * registered [`ChannelMonitor`]s.
35288  */
35289 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);
35290
35291 /**
35292  * Gets a [`Future`] that completes when an event is available either via
35293  * [`chain::Watch::release_pending_monitor_events`] or
35294  * [`EventsProvider::process_pending_events`].
35295  *
35296  * Note that callbacks registered on the [`Future`] MUST NOT call back into this
35297  * [`ChainMonitor`] and should instead register actions to be taken later.
35298  *
35299  * [`EventsProvider::process_pending_events`]: crate::events::EventsProvider::process_pending_events
35300  */
35301 MUST_USE_RES struct LDKFuture ChainMonitor_get_update_future(const struct LDKChainMonitor *NONNULL_PTR this_arg);
35302
35303 /**
35304  * Triggers rebroadcasts/fee-bumps of pending claims from a force-closed channel. This is
35305  * crucial in preventing certain classes of pinning attacks, detecting substantial mempool
35306  * feerate changes between blocks, and ensuring reliability if broadcasting fails. We recommend
35307  * invoking this every 30 seconds, or lower if running in an environment with spotty
35308  * connections, like on mobile.
35309  */
35310 void ChainMonitor_rebroadcast_pending_claims(const struct LDKChainMonitor *NONNULL_PTR this_arg);
35311
35312 /**
35313  * Triggers rebroadcasts of pending claims from force-closed channels after a transaction
35314  * signature generation failure.
35315  *
35316  * `monitor_opt` can be used as a filter to only trigger them for a specific channel monitor.
35317  *
35318  * Note that monitor_opt (or a relevant inner pointer) may be NULL or all-0s to represent None
35319  */
35320 void ChainMonitor_signer_unblocked(const struct LDKChainMonitor *NONNULL_PTR this_arg, struct LDKOutPoint monitor_opt);
35321
35322 /**
35323  * Archives fully resolved channel monitors by calling [`Persist::archive_persisted_channel`].
35324  *
35325  * This is useful for pruning fully resolved monitors from the monitor set and primary
35326  * storage so they are not kept in memory and reloaded on restart.
35327  *
35328  * Should be called occasionally (once every handful of blocks or on startup).
35329  *
35330  * Depending on the implementation of [`Persist::archive_persisted_channel`] the monitor
35331  * data could be moved to an archive location or removed entirely.
35332  */
35333 void ChainMonitor_archive_fully_resolved_channel_monitors(const struct LDKChainMonitor *NONNULL_PTR this_arg);
35334
35335 /**
35336  * Constructs a new Listen which calls the relevant methods on this_arg.
35337  * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is
35338  */
35339 struct LDKListen ChainMonitor_as_Listen(const struct LDKChainMonitor *NONNULL_PTR this_arg);
35340
35341 /**
35342  * Constructs a new Confirm which calls the relevant methods on this_arg.
35343  * This copies the `inner` pointer in this_arg and thus the returned Confirm must be freed before this_arg is
35344  */
35345 struct LDKConfirm ChainMonitor_as_Confirm(const struct LDKChainMonitor *NONNULL_PTR this_arg);
35346
35347 /**
35348  * Constructs a new Watch which calls the relevant methods on this_arg.
35349  * This copies the `inner` pointer in this_arg and thus the returned Watch must be freed before this_arg is
35350  */
35351 struct LDKWatch ChainMonitor_as_Watch(const struct LDKChainMonitor *NONNULL_PTR this_arg);
35352
35353 /**
35354  * Constructs a new EventsProvider which calls the relevant methods on this_arg.
35355  * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is
35356  */
35357 struct LDKEventsProvider ChainMonitor_as_EventsProvider(const struct LDKChainMonitor *NONNULL_PTR this_arg);
35358
35359 /**
35360  * Frees any resources used by the ChannelMonitorUpdate, if is_owned is set and inner is non-NULL.
35361  */
35362 void ChannelMonitorUpdate_free(struct LDKChannelMonitorUpdate this_obj);
35363
35364 /**
35365  * The sequence number of this update. Updates *must* be replayed in-order according to this
35366  * sequence number (and updates may panic if they are not). The update_id values are strictly
35367  * increasing and increase by one for each new update, with two exceptions specified below.
35368  *
35369  * This sequence number is also used to track up to which points updates which returned
35370  * [`ChannelMonitorUpdateStatus::InProgress`] have been applied to all copies of a given
35371  * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
35372  *
35373  * The only instances we allow where update_id values are not strictly increasing have a
35374  * special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. This update ID is used for updates that
35375  * will force close the channel by broadcasting the latest commitment transaction or
35376  * special post-force-close updates, like providing preimages necessary to claim outputs on the
35377  * broadcast commitment transaction. See its docs for more details.
35378  *
35379  * [`ChannelMonitorUpdateStatus::InProgress`]: super::ChannelMonitorUpdateStatus::InProgress
35380  */
35381 uint64_t ChannelMonitorUpdate_get_update_id(const struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr);
35382
35383 /**
35384  * The sequence number of this update. Updates *must* be replayed in-order according to this
35385  * sequence number (and updates may panic if they are not). The update_id values are strictly
35386  * increasing and increase by one for each new update, with two exceptions specified below.
35387  *
35388  * This sequence number is also used to track up to which points updates which returned
35389  * [`ChannelMonitorUpdateStatus::InProgress`] have been applied to all copies of a given
35390  * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
35391  *
35392  * The only instances we allow where update_id values are not strictly increasing have a
35393  * special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. This update ID is used for updates that
35394  * will force close the channel by broadcasting the latest commitment transaction or
35395  * special post-force-close updates, like providing preimages necessary to claim outputs on the
35396  * broadcast commitment transaction. See its docs for more details.
35397  *
35398  * [`ChannelMonitorUpdateStatus::InProgress`]: super::ChannelMonitorUpdateStatus::InProgress
35399  */
35400 void ChannelMonitorUpdate_set_update_id(struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr, uint64_t val);
35401
35402 /**
35403  * The channel ID associated with these updates.
35404  *
35405  * Will be `None` for `ChannelMonitorUpdate`s constructed on LDK versions prior to 0.0.121 and
35406  * always `Some` otherwise.
35407  *
35408  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
35409  */
35410 struct LDKChannelId ChannelMonitorUpdate_get_channel_id(const struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr);
35411
35412 /**
35413  * The channel ID associated with these updates.
35414  *
35415  * Will be `None` for `ChannelMonitorUpdate`s constructed on LDK versions prior to 0.0.121 and
35416  * always `Some` otherwise.
35417  *
35418  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
35419  */
35420 void ChannelMonitorUpdate_set_channel_id(struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr, struct LDKChannelId val);
35421
35422 /**
35423  * Creates a copy of the ChannelMonitorUpdate
35424  */
35425 struct LDKChannelMonitorUpdate ChannelMonitorUpdate_clone(const struct LDKChannelMonitorUpdate *NONNULL_PTR orig);
35426
35427 /**
35428  * Checks if two ChannelMonitorUpdates contain equal inner contents.
35429  * This ignores pointers and is_owned flags and looks at the values in fields.
35430  * Two objects with NULL inner values will be considered "equal" here.
35431  */
35432 bool ChannelMonitorUpdate_eq(const struct LDKChannelMonitorUpdate *NONNULL_PTR a, const struct LDKChannelMonitorUpdate *NONNULL_PTR b);
35433
35434 /**
35435  * Serialize the ChannelMonitorUpdate object into a byte array which can be read by ChannelMonitorUpdate_read
35436  */
35437 struct LDKCVec_u8Z ChannelMonitorUpdate_write(const struct LDKChannelMonitorUpdate *NONNULL_PTR obj);
35438
35439 /**
35440  * Read a ChannelMonitorUpdate from a byte array, created by ChannelMonitorUpdate_write
35441  */
35442 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ ChannelMonitorUpdate_read(struct LDKu8slice ser);
35443
35444 /**
35445  * Frees any resources used by the MonitorEvent
35446  */
35447 void MonitorEvent_free(struct LDKMonitorEvent this_ptr);
35448
35449 /**
35450  * Creates a copy of the MonitorEvent
35451  */
35452 struct LDKMonitorEvent MonitorEvent_clone(const struct LDKMonitorEvent *NONNULL_PTR orig);
35453
35454 /**
35455  * Utility method to constructs a new HTLCEvent-variant MonitorEvent
35456  */
35457 struct LDKMonitorEvent MonitorEvent_htlcevent(struct LDKHTLCUpdate a);
35458
35459 /**
35460  * Utility method to constructs a new HolderForceClosedWithInfo-variant MonitorEvent
35461  */
35462 struct LDKMonitorEvent MonitorEvent_holder_force_closed_with_info(struct LDKClosureReason reason, struct LDKOutPoint outpoint, struct LDKChannelId channel_id);
35463
35464 /**
35465  * Utility method to constructs a new HolderForceClosed-variant MonitorEvent
35466  */
35467 struct LDKMonitorEvent MonitorEvent_holder_force_closed(struct LDKOutPoint a);
35468
35469 /**
35470  * Utility method to constructs a new Completed-variant MonitorEvent
35471  */
35472 struct LDKMonitorEvent MonitorEvent_completed(struct LDKOutPoint funding_txo, struct LDKChannelId channel_id, uint64_t monitor_update_id);
35473
35474 /**
35475  * Checks if two MonitorEvents contain equal inner contents.
35476  * This ignores pointers and is_owned flags and looks at the values in fields.
35477  */
35478 bool MonitorEvent_eq(const struct LDKMonitorEvent *NONNULL_PTR a, const struct LDKMonitorEvent *NONNULL_PTR b);
35479
35480 /**
35481  * Serialize the MonitorEvent object into a byte array which can be read by MonitorEvent_read
35482  */
35483 struct LDKCVec_u8Z MonitorEvent_write(const struct LDKMonitorEvent *NONNULL_PTR obj);
35484
35485 /**
35486  * Read a MonitorEvent from a byte array, created by MonitorEvent_write
35487  */
35488 struct LDKCResult_COption_MonitorEventZDecodeErrorZ MonitorEvent_read(struct LDKu8slice ser);
35489
35490 /**
35491  * Frees any resources used by the HTLCUpdate, if is_owned is set and inner is non-NULL.
35492  */
35493 void HTLCUpdate_free(struct LDKHTLCUpdate this_obj);
35494
35495 /**
35496  * Creates a copy of the HTLCUpdate
35497  */
35498 struct LDKHTLCUpdate HTLCUpdate_clone(const struct LDKHTLCUpdate *NONNULL_PTR orig);
35499
35500 /**
35501  * Checks if two HTLCUpdates contain equal inner contents.
35502  * This ignores pointers and is_owned flags and looks at the values in fields.
35503  * Two objects with NULL inner values will be considered "equal" here.
35504  */
35505 bool HTLCUpdate_eq(const struct LDKHTLCUpdate *NONNULL_PTR a, const struct LDKHTLCUpdate *NONNULL_PTR b);
35506
35507 /**
35508  * Serialize the HTLCUpdate object into a byte array which can be read by HTLCUpdate_read
35509  */
35510 struct LDKCVec_u8Z HTLCUpdate_write(const struct LDKHTLCUpdate *NONNULL_PTR obj);
35511
35512 /**
35513  * Read a HTLCUpdate from a byte array, created by HTLCUpdate_write
35514  */
35515 struct LDKCResult_HTLCUpdateDecodeErrorZ HTLCUpdate_read(struct LDKu8slice ser);
35516
35517 /**
35518  * Frees any resources used by the Balance
35519  */
35520 void Balance_free(struct LDKBalance this_ptr);
35521
35522 /**
35523  * Creates a copy of the Balance
35524  */
35525 struct LDKBalance Balance_clone(const struct LDKBalance *NONNULL_PTR orig);
35526
35527 /**
35528  * Utility method to constructs a new ClaimableOnChannelClose-variant Balance
35529  */
35530 struct LDKBalance Balance_claimable_on_channel_close(uint64_t amount_satoshis);
35531
35532 /**
35533  * Utility method to constructs a new ClaimableAwaitingConfirmations-variant Balance
35534  */
35535 struct LDKBalance Balance_claimable_awaiting_confirmations(uint64_t amount_satoshis, uint32_t confirmation_height);
35536
35537 /**
35538  * Utility method to constructs a new ContentiousClaimable-variant Balance
35539  */
35540 struct LDKBalance Balance_contentious_claimable(uint64_t amount_satoshis, uint32_t timeout_height, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_preimage);
35541
35542 /**
35543  * Utility method to constructs a new MaybeTimeoutClaimableHTLC-variant Balance
35544  */
35545 struct LDKBalance Balance_maybe_timeout_claimable_htlc(uint64_t amount_satoshis, uint32_t claimable_height, struct LDKThirtyTwoBytes payment_hash);
35546
35547 /**
35548  * Utility method to constructs a new MaybePreimageClaimableHTLC-variant Balance
35549  */
35550 struct LDKBalance Balance_maybe_preimage_claimable_htlc(uint64_t amount_satoshis, uint32_t expiry_height, struct LDKThirtyTwoBytes payment_hash);
35551
35552 /**
35553  * Utility method to constructs a new CounterpartyRevokedOutputClaimable-variant Balance
35554  */
35555 struct LDKBalance Balance_counterparty_revoked_output_claimable(uint64_t amount_satoshis);
35556
35557 /**
35558  * Checks if two Balances contain equal inner contents.
35559  * This ignores pointers and is_owned flags and looks at the values in fields.
35560  */
35561 bool Balance_eq(const struct LDKBalance *NONNULL_PTR a, const struct LDKBalance *NONNULL_PTR b);
35562
35563 /**
35564  * The amount claimable, in satoshis. This excludes balances that we are unsure if we are able
35565  * to claim, this is because we are waiting for a preimage or for a timeout to expire. For more
35566  * information on these balances see [`Balance::MaybeTimeoutClaimableHTLC`] and
35567  * [`Balance::MaybePreimageClaimableHTLC`].
35568  *
35569  * On-chain fees required to claim the balance are not included in this amount.
35570  */
35571 MUST_USE_RES uint64_t Balance_claimable_amount_satoshis(const struct LDKBalance *NONNULL_PTR this_arg);
35572
35573 /**
35574  * Frees any resources used by the ChannelMonitor, if is_owned is set and inner is non-NULL.
35575  */
35576 void ChannelMonitor_free(struct LDKChannelMonitor this_obj);
35577
35578 /**
35579  * Creates a copy of the ChannelMonitor
35580  */
35581 struct LDKChannelMonitor ChannelMonitor_clone(const struct LDKChannelMonitor *NONNULL_PTR orig);
35582
35583 /**
35584  * Serialize the ChannelMonitor object into a byte array which can be read by ChannelMonitor_read
35585  */
35586 struct LDKCVec_u8Z ChannelMonitor_write(const struct LDKChannelMonitor *NONNULL_PTR obj);
35587
35588 /**
35589  * Updates a ChannelMonitor on the basis of some new information provided by the Channel
35590  * itself.
35591  *
35592  * panics if the given update is not the next update by update_id.
35593  */
35594 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, const struct LDKFeeEstimator *NONNULL_PTR fee_estimator, const struct LDKLogger *NONNULL_PTR logger);
35595
35596 /**
35597  * Gets the update_id from the latest ChannelMonitorUpdate which was applied to this
35598  * ChannelMonitor.
35599  */
35600 MUST_USE_RES uint64_t ChannelMonitor_get_latest_update_id(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
35601
35602 /**
35603  * Gets the funding transaction outpoint of the channel this ChannelMonitor is monitoring for.
35604  */
35605 MUST_USE_RES struct LDKC2Tuple_OutPointCVec_u8ZZ ChannelMonitor_get_funding_txo(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
35606
35607 /**
35608  * Gets the channel_id of the channel this ChannelMonitor is monitoring for.
35609  */
35610 MUST_USE_RES struct LDKChannelId ChannelMonitor_channel_id(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
35611
35612 /**
35613  * Gets a list of txids, with their output scripts (in the order they appear in the
35614  * transaction), which we must learn about spends of via block_connected().
35615  */
35616 MUST_USE_RES struct LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ ChannelMonitor_get_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
35617
35618 /**
35619  * Loads the funding txo and outputs to watch into the given `chain::Filter` by repeatedly
35620  * calling `chain::Filter::register_output` and `chain::Filter::register_tx` until all outputs
35621  * have been registered.
35622  */
35623 void ChannelMonitor_load_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKFilter *NONNULL_PTR filter, const struct LDKLogger *NONNULL_PTR logger);
35624
35625 /**
35626  * Get the list of HTLCs who's status has been updated on chain. This should be called by
35627  * ChannelManager via [`chain::Watch::release_pending_monitor_events`].
35628  */
35629 MUST_USE_RES struct LDKCVec_MonitorEventZ ChannelMonitor_get_and_clear_pending_monitor_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
35630
35631 /**
35632  * Processes [`SpendableOutputs`] events produced from each [`ChannelMonitor`] upon maturity.
35633  *
35634  * For channels featuring anchor outputs, this method will also process [`BumpTransaction`]
35635  * events produced from each [`ChannelMonitor`] while there is a balance to claim onchain
35636  * within each channel. As the confirmation of a commitment transaction may be critical to the
35637  * safety of funds, we recommend invoking this every 30 seconds, or lower if running in an
35638  * environment with spotty connections, like on mobile.
35639  *
35640  * An [`EventHandler`] may safely call back to the provider, though this shouldn't be needed in
35641  * order to handle these events.
35642  *
35643  * [`SpendableOutputs`]: crate::events::Event::SpendableOutputs
35644  * [`BumpTransaction`]: crate::events::Event::BumpTransaction
35645  */
35646 void ChannelMonitor_process_pending_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKEventHandler *NONNULL_PTR handler);
35647
35648 /**
35649  * Gets the counterparty's initial commitment transaction. The returned commitment
35650  * transaction is unsigned. This is intended to be called during the initial persistence of
35651  * the monitor (inside an implementation of [`Persist::persist_new_channel`]), to allow for
35652  * watchtowers in the persistence pipeline to have enough data to form justice transactions.
35653  *
35654  * This is similar to [`Self::counterparty_commitment_txs_from_update`], except
35655  * that for the initial commitment transaction, we don't have a corresponding update.
35656  *
35657  * This will only return `Some` for channel monitors that have been created after upgrading
35658  * to LDK 0.0.117+.
35659  *
35660  * [`Persist::persist_new_channel`]: crate::chain::chainmonitor::Persist::persist_new_channel
35661  *
35662  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
35663  */
35664 MUST_USE_RES struct LDKCommitmentTransaction ChannelMonitor_initial_counterparty_commitment_tx(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
35665
35666 /**
35667  * Gets all of the counterparty commitment transactions provided by the given update. This
35668  * may be empty if the update doesn't include any new counterparty commitments. Returned
35669  * commitment transactions are unsigned.
35670  *
35671  * This is provided so that watchtower clients in the persistence pipeline are able to build
35672  * justice transactions for each counterparty commitment upon each update. It's intended to be
35673  * used within an implementation of [`Persist::update_persisted_channel`], which is provided
35674  * with a monitor and an update. Once revoked, signing a justice transaction can be done using
35675  * [`Self::sign_to_local_justice_tx`].
35676  *
35677  * It is expected that a watchtower client may use this method to retrieve the latest counterparty
35678  * commitment transaction(s), and then hold the necessary data until a later update in which
35679  * the monitor has been updated with the corresponding revocation data, at which point the
35680  * monitor can sign the justice transaction.
35681  *
35682  * This will only return a non-empty list for monitor updates that have been created after
35683  * upgrading to LDK 0.0.117+. Note that no restriction lies on the monitors themselves, which
35684  * may have been created prior to upgrading.
35685  *
35686  * [`Persist::update_persisted_channel`]: crate::chain::chainmonitor::Persist::update_persisted_channel
35687  */
35688 MUST_USE_RES struct LDKCVec_CommitmentTransactionZ ChannelMonitor_counterparty_commitment_txs_from_update(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKChannelMonitorUpdate *NONNULL_PTR update);
35689
35690 /**
35691  * Wrapper around [`EcdsaChannelSigner::sign_justice_revoked_output`] to make
35692  * signing the justice transaction easier for implementors of
35693  * [`chain::chainmonitor::Persist`]. On success this method returns the provided transaction
35694  * signing the input at `input_idx`. This method will only produce a valid signature for
35695  * a transaction spending the `to_local` output of a commitment transaction, i.e. this cannot
35696  * be used for revoked HTLC outputs.
35697  *
35698  * `Value` is the value of the output being spent by the input at `input_idx`, committed
35699  * in the BIP 143 signature.
35700  *
35701  * This method will only succeed if this monitor has received the revocation secret for the
35702  * provided `commitment_number`. If a commitment number is provided that does not correspond
35703  * to the commitment transaction being revoked, this will return a signed transaction, but
35704  * the signature will not be valid.
35705  *
35706  * [`EcdsaChannelSigner::sign_justice_revoked_output`]: crate::sign::ecdsa::EcdsaChannelSigner::sign_justice_revoked_output
35707  * [`Persist`]: crate::chain::chainmonitor::Persist
35708  */
35709 MUST_USE_RES struct LDKCResult_TransactionNoneZ ChannelMonitor_sign_to_local_justice_tx(const struct LDKChannelMonitor *NONNULL_PTR this_arg, struct LDKTransaction justice_tx, uintptr_t input_idx, uint64_t value, uint64_t commitment_number);
35710
35711 /**
35712  * Gets the `node_id` of the counterparty for this channel.
35713  *
35714  * Will be `None` for channels constructed on LDK versions prior to 0.0.110 and always `Some`
35715  * otherwise.
35716  *
35717  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
35718  */
35719 MUST_USE_RES struct LDKPublicKey ChannelMonitor_get_counterparty_node_id(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
35720
35721 /**
35722  * You may use this to broadcast the latest local commitment transaction, either because
35723  * a monitor update failed or because we've fallen behind (i.e. we've received proof that our
35724  * counterparty side knows a revocation secret we gave them that they shouldn't know).
35725  *
35726  * Broadcasting these transactions in this manner is UNSAFE, as they allow counterparty
35727  * side to punish you. Nevertheless you may want to broadcast them if counterparty doesn't
35728  * close channel with their commitment transaction after a substantial amount of time. Best
35729  * may be to contact the other node operator out-of-band to coordinate other options available
35730  * to you.
35731  */
35732 void ChannelMonitor_broadcast_latest_holder_commitment_txn(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKBroadcasterInterface *NONNULL_PTR broadcaster, const struct LDKFeeEstimator *NONNULL_PTR fee_estimator, const struct LDKLogger *NONNULL_PTR logger);
35733
35734 /**
35735  * Processes transactions in a newly connected block, which may result in any of the following:
35736  * - update the monitor's state against resolved HTLCs
35737  * - punish the counterparty in the case of seeing a revoked commitment transaction
35738  * - force close the channel and claim/timeout incoming/outgoing HTLCs if near expiration
35739  * - detect settled outputs for later spending
35740  * - schedule and bump any in-flight claims
35741  *
35742  * Returns any new outputs to watch from `txdata`; after called, these are also included in
35743  * [`get_outputs_to_watch`].
35744  *
35745  * [`get_outputs_to_watch`]: #method.get_outputs_to_watch
35746  */
35747 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, const struct LDKLogger *NONNULL_PTR logger);
35748
35749 /**
35750  * Determines if the disconnected block contained any transactions of interest and updates
35751  * appropriately.
35752  */
35753 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, const struct LDKLogger *NONNULL_PTR logger);
35754
35755 /**
35756  * Processes transactions confirmed in a block with the given header and height, returning new
35757  * outputs to watch. See [`block_connected`] for details.
35758  *
35759  * Used instead of [`block_connected`] by clients that are notified of transactions rather than
35760  * blocks. See [`chain::Confirm`] for calling expectations.
35761  *
35762  * [`block_connected`]: Self::block_connected
35763  */
35764 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, const struct LDKLogger *NONNULL_PTR logger);
35765
35766 /**
35767  * Processes a transaction that was reorganized out of the chain.
35768  *
35769  * Used instead of [`block_disconnected`] by clients that are notified of transactions rather
35770  * than blocks. See [`chain::Confirm`] for calling expectations.
35771  *
35772  * [`block_disconnected`]: Self::block_disconnected
35773  */
35774 void ChannelMonitor_transaction_unconfirmed(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const uint8_t (*txid)[32], struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator, const struct LDKLogger *NONNULL_PTR logger);
35775
35776 /**
35777  * Updates the monitor with the current best chain tip, returning new outputs to watch. See
35778  * [`block_connected`] for details.
35779  *
35780  * Used instead of [`block_connected`] by clients that are notified of transactions rather than
35781  * blocks. See [`chain::Confirm`] for calling expectations.
35782  *
35783  * [`block_connected`]: Self::block_connected
35784  */
35785 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, const struct LDKLogger *NONNULL_PTR logger);
35786
35787 /**
35788  * Returns the set of txids that should be monitored for re-organization out of the chain.
35789  */
35790 MUST_USE_RES struct LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ ChannelMonitor_get_relevant_txids(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
35791
35792 /**
35793  * Gets the latest best block which was connected either via the [`chain::Listen`] or
35794  * [`chain::Confirm`] interfaces.
35795  */
35796 MUST_USE_RES struct LDKBestBlock ChannelMonitor_current_best_block(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
35797
35798 /**
35799  * Triggers rebroadcasts/fee-bumps of pending claims from a force-closed channel. This is
35800  * crucial in preventing certain classes of pinning attacks, detecting substantial mempool
35801  * feerate changes between blocks, and ensuring reliability if broadcasting fails. We recommend
35802  * invoking this every 30 seconds, or lower if running in an environment with spotty
35803  * connections, like on mobile.
35804  */
35805 void ChannelMonitor_rebroadcast_pending_claims(const struct LDKChannelMonitor *NONNULL_PTR this_arg, struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator, const struct LDKLogger *NONNULL_PTR logger);
35806
35807 /**
35808  * Triggers rebroadcasts of pending claims from a force-closed channel after a transaction
35809  * signature generation failure.
35810  */
35811 void ChannelMonitor_signer_unblocked(const struct LDKChannelMonitor *NONNULL_PTR this_arg, struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator, const struct LDKLogger *NONNULL_PTR logger);
35812
35813 /**
35814  * Returns the descriptors for relevant outputs (i.e., those that we can spend) within the
35815  * transaction if they exist and the transaction has at least [`ANTI_REORG_DELAY`]
35816  * confirmations. For [`SpendableOutputDescriptor::DelayedPaymentOutput`] descriptors to be
35817  * returned, the transaction must have at least `max(ANTI_REORG_DELAY, to_self_delay)`
35818  * confirmations.
35819  *
35820  * Descriptors returned by this method are primarily exposed via [`Event::SpendableOutputs`]
35821  * once they are no longer under reorg risk. This method serves as a way to retrieve these
35822  * descriptors at a later time, either for historical purposes, or to replay any
35823  * missed/unhandled descriptors. For the purpose of gathering historical records, if the
35824  * channel close has fully resolved (i.e., [`ChannelMonitor::get_claimable_balances`] returns
35825  * an empty set), you can retrieve all spendable outputs by providing all descendant spending
35826  * transactions starting from the channel's funding transaction and going down three levels.
35827  *
35828  * `tx` is a transaction we'll scan the outputs of. Any transaction can be provided. If any
35829  * outputs which can be spent by us are found, at least one descriptor is returned.
35830  *
35831  * `confirmation_height` must be the height of the block in which `tx` was included in.
35832  */
35833 MUST_USE_RES struct LDKCVec_SpendableOutputDescriptorZ ChannelMonitor_get_spendable_outputs(const struct LDKChannelMonitor *NONNULL_PTR this_arg, struct LDKTransaction tx, uint32_t confirmation_height);
35834
35835 /**
35836  * Checks if the monitor is fully resolved. Resolved monitor is one that has claimed all of
35837  * its outputs and balances (i.e. [`Self::get_claimable_balances`] returns an empty set).
35838  *
35839  * This function returns true only if [`Self::get_claimable_balances`] has been empty for at least
35840  * 4032 blocks as an additional protection against any bugs resulting in spuriously empty balance sets.
35841  */
35842 MUST_USE_RES bool ChannelMonitor_is_fully_resolved(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKLogger *NONNULL_PTR logger);
35843
35844 /**
35845  * Gets the balances in this channel which are either claimable by us if we were to
35846  * force-close the channel now or which are claimable on-chain (possibly awaiting
35847  * confirmation).
35848  *
35849  * Any balances in the channel which are available on-chain (excluding on-chain fees) are
35850  * included here until an [`Event::SpendableOutputs`] event has been generated for the
35851  * balance, or until our counterparty has claimed the balance and accrued several
35852  * confirmations on the claim transaction.
35853  *
35854  * Note that for `ChannelMonitors` which track a channel which went on-chain with versions of
35855  * LDK prior to 0.0.111, not all or excess balances may be included.
35856  *
35857  * See [`Balance`] for additional details on the types of claimable balances which
35858  * may be returned here and their meanings.
35859  */
35860 MUST_USE_RES struct LDKCVec_BalanceZ ChannelMonitor_get_claimable_balances(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
35861
35862 /**
35863  * Read a C2Tuple_ThirtyTwoBytesChannelMonitorZ from a byte array, created by C2Tuple_ThirtyTwoBytesChannelMonitorZ_write
35864  */
35865 struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ C2Tuple_ThirtyTwoBytesChannelMonitorZ_read(struct LDKu8slice ser, const struct LDKEntropySource *NONNULL_PTR arg_a, const struct LDKSignerProvider *NONNULL_PTR arg_b);
35866
35867 /**
35868  * Frees any resources used by the OutPoint, if is_owned is set and inner is non-NULL.
35869  */
35870 void OutPoint_free(struct LDKOutPoint this_obj);
35871
35872 /**
35873  * The referenced transaction's txid.
35874  */
35875 const uint8_t (*OutPoint_get_txid(const struct LDKOutPoint *NONNULL_PTR this_ptr))[32];
35876
35877 /**
35878  * The referenced transaction's txid.
35879  */
35880 void OutPoint_set_txid(struct LDKOutPoint *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
35881
35882 /**
35883  * The index of the referenced output in its transaction's vout.
35884  */
35885 uint16_t OutPoint_get_index(const struct LDKOutPoint *NONNULL_PTR this_ptr);
35886
35887 /**
35888  * The index of the referenced output in its transaction's vout.
35889  */
35890 void OutPoint_set_index(struct LDKOutPoint *NONNULL_PTR this_ptr, uint16_t val);
35891
35892 /**
35893  * Constructs a new OutPoint given each field
35894  */
35895 MUST_USE_RES struct LDKOutPoint OutPoint_new(struct LDKThirtyTwoBytes txid_arg, uint16_t index_arg);
35896
35897 /**
35898  * Creates a copy of the OutPoint
35899  */
35900 struct LDKOutPoint OutPoint_clone(const struct LDKOutPoint *NONNULL_PTR orig);
35901
35902 /**
35903  * Checks if two OutPoints contain equal inner contents.
35904  * This ignores pointers and is_owned flags and looks at the values in fields.
35905  * Two objects with NULL inner values will be considered "equal" here.
35906  */
35907 bool OutPoint_eq(const struct LDKOutPoint *NONNULL_PTR a, const struct LDKOutPoint *NONNULL_PTR b);
35908
35909 /**
35910  * Generates a non-cryptographic 64-bit hash of the OutPoint.
35911  */
35912 uint64_t OutPoint_hash(const struct LDKOutPoint *NONNULL_PTR o);
35913
35914 /**
35915  * Serialize the OutPoint object into a byte array which can be read by OutPoint_read
35916  */
35917 struct LDKCVec_u8Z OutPoint_write(const struct LDKOutPoint *NONNULL_PTR obj);
35918
35919 /**
35920  * Read a OutPoint from a byte array, created by OutPoint_write
35921  */
35922 struct LDKCResult_OutPointDecodeErrorZ OutPoint_read(struct LDKu8slice ser);
35923
35924 /**
35925  * Frees any resources used by the InboundHTLCErr, if is_owned is set and inner is non-NULL.
35926  */
35927 void InboundHTLCErr_free(struct LDKInboundHTLCErr this_obj);
35928
35929 /**
35930  * BOLT 4 error code.
35931  */
35932 uint16_t InboundHTLCErr_get_err_code(const struct LDKInboundHTLCErr *NONNULL_PTR this_ptr);
35933
35934 /**
35935  * BOLT 4 error code.
35936  */
35937 void InboundHTLCErr_set_err_code(struct LDKInboundHTLCErr *NONNULL_PTR this_ptr, uint16_t val);
35938
35939 /**
35940  * Data attached to this error.
35941  *
35942  * Returns a copy of the field.
35943  */
35944 struct LDKCVec_u8Z InboundHTLCErr_get_err_data(const struct LDKInboundHTLCErr *NONNULL_PTR this_ptr);
35945
35946 /**
35947  * Data attached to this error.
35948  */
35949 void InboundHTLCErr_set_err_data(struct LDKInboundHTLCErr *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
35950
35951 /**
35952  * Error message text.
35953  */
35954 struct LDKStr InboundHTLCErr_get_msg(const struct LDKInboundHTLCErr *NONNULL_PTR this_ptr);
35955
35956 /**
35957  * Error message text.
35958  */
35959 void InboundHTLCErr_set_msg(struct LDKInboundHTLCErr *NONNULL_PTR this_ptr, struct LDKStr val);
35960
35961 /**
35962  * Constructs a new InboundHTLCErr given each field
35963  */
35964 MUST_USE_RES struct LDKInboundHTLCErr InboundHTLCErr_new(uint16_t err_code_arg, struct LDKCVec_u8Z err_data_arg, struct LDKStr msg_arg);
35965
35966 /**
35967  * Creates a copy of the InboundHTLCErr
35968  */
35969 struct LDKInboundHTLCErr InboundHTLCErr_clone(const struct LDKInboundHTLCErr *NONNULL_PTR orig);
35970
35971 /**
35972  * Generates a non-cryptographic 64-bit hash of the InboundHTLCErr.
35973  */
35974 uint64_t InboundHTLCErr_hash(const struct LDKInboundHTLCErr *NONNULL_PTR o);
35975
35976 /**
35977  * Checks if two InboundHTLCErrs contain equal inner contents.
35978  * This ignores pointers and is_owned flags and looks at the values in fields.
35979  * Two objects with NULL inner values will be considered "equal" here.
35980  */
35981 bool InboundHTLCErr_eq(const struct LDKInboundHTLCErr *NONNULL_PTR a, const struct LDKInboundHTLCErr *NONNULL_PTR b);
35982
35983 /**
35984  * Peel one layer off an incoming onion, returning a [`PendingHTLCInfo`] that contains information
35985  * about the intended next-hop for the HTLC.
35986  *
35987  * This does all the relevant context-free checks that LDK requires for payment relay or
35988  * acceptance. If the payment is to be received, and the amount matches the expected amount for
35989  * a given invoice, this indicates the [`msgs::UpdateAddHTLC`], once fully committed in the
35990  * channel, will generate an [`Event::PaymentClaimable`].
35991  *
35992  * [`Event::PaymentClaimable`]: crate::events::Event::PaymentClaimable
35993  */
35994 struct LDKCResult_PendingHTLCInfoInboundHTLCErrZ peel_payment_onion(const struct LDKUpdateAddHTLC *NONNULL_PTR msg, const struct LDKNodeSigner *NONNULL_PTR node_signer, const struct LDKLogger *NONNULL_PTR logger, uint32_t cur_height, bool accept_mpp_keysend, bool allow_skimmed_fees);
35995
35996 /**
35997  * Frees any resources used by the PendingHTLCRouting
35998  */
35999 void PendingHTLCRouting_free(struct LDKPendingHTLCRouting this_ptr);
36000
36001 /**
36002  * Creates a copy of the PendingHTLCRouting
36003  */
36004 struct LDKPendingHTLCRouting PendingHTLCRouting_clone(const struct LDKPendingHTLCRouting *NONNULL_PTR orig);
36005
36006 /**
36007  * Utility method to constructs a new Forward-variant PendingHTLCRouting
36008  */
36009 struct LDKPendingHTLCRouting PendingHTLCRouting_forward(struct LDKOnionPacket onion_packet, uint64_t short_channel_id, struct LDKBlindedForward blinded);
36010
36011 /**
36012  * Utility method to constructs a new Receive-variant PendingHTLCRouting
36013  */
36014 struct LDKPendingHTLCRouting PendingHTLCRouting_receive(struct LDKFinalOnionHopData payment_data, struct LDKCOption_CVec_u8ZZ payment_metadata, struct LDKCOption_PaymentContextZ payment_context, uint32_t incoming_cltv_expiry, struct LDKThirtyTwoBytes phantom_shared_secret, struct LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs, bool requires_blinded_error);
36015
36016 /**
36017  * Utility method to constructs a new ReceiveKeysend-variant PendingHTLCRouting
36018  */
36019 struct LDKPendingHTLCRouting PendingHTLCRouting_receive_keysend(struct LDKFinalOnionHopData payment_data, struct LDKThirtyTwoBytes payment_preimage, struct LDKCOption_CVec_u8ZZ payment_metadata, uint32_t incoming_cltv_expiry, struct LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs, bool requires_blinded_error);
36020
36021 /**
36022  * Frees any resources used by the BlindedForward, if is_owned is set and inner is non-NULL.
36023  */
36024 void BlindedForward_free(struct LDKBlindedForward this_obj);
36025
36026 /**
36027  * The `blinding_point` that was set in the inbound [`msgs::UpdateAddHTLC`], or in the inbound
36028  * onion payload if we're the introduction node. Useful for calculating the next hop's
36029  * [`msgs::UpdateAddHTLC::blinding_point`].
36030  */
36031 struct LDKPublicKey BlindedForward_get_inbound_blinding_point(const struct LDKBlindedForward *NONNULL_PTR this_ptr);
36032
36033 /**
36034  * The `blinding_point` that was set in the inbound [`msgs::UpdateAddHTLC`], or in the inbound
36035  * onion payload if we're the introduction node. Useful for calculating the next hop's
36036  * [`msgs::UpdateAddHTLC::blinding_point`].
36037  */
36038 void BlindedForward_set_inbound_blinding_point(struct LDKBlindedForward *NONNULL_PTR this_ptr, struct LDKPublicKey val);
36039
36040 /**
36041  * If needed, this determines how this HTLC should be failed backwards, based on whether we are
36042  * the introduction node.
36043  */
36044 enum LDKBlindedFailure BlindedForward_get_failure(const struct LDKBlindedForward *NONNULL_PTR this_ptr);
36045
36046 /**
36047  * If needed, this determines how this HTLC should be failed backwards, based on whether we are
36048  * the introduction node.
36049  */
36050 void BlindedForward_set_failure(struct LDKBlindedForward *NONNULL_PTR this_ptr, enum LDKBlindedFailure val);
36051
36052 /**
36053  * Constructs a new BlindedForward given each field
36054  */
36055 MUST_USE_RES struct LDKBlindedForward BlindedForward_new(struct LDKPublicKey inbound_blinding_point_arg, enum LDKBlindedFailure failure_arg);
36056
36057 /**
36058  * Creates a copy of the BlindedForward
36059  */
36060 struct LDKBlindedForward BlindedForward_clone(const struct LDKBlindedForward *NONNULL_PTR orig);
36061
36062 /**
36063  * Generates a non-cryptographic 64-bit hash of the BlindedForward.
36064  */
36065 uint64_t BlindedForward_hash(const struct LDKBlindedForward *NONNULL_PTR o);
36066
36067 /**
36068  * Checks if two BlindedForwards contain equal inner contents.
36069  * This ignores pointers and is_owned flags and looks at the values in fields.
36070  * Two objects with NULL inner values will be considered "equal" here.
36071  */
36072 bool BlindedForward_eq(const struct LDKBlindedForward *NONNULL_PTR a, const struct LDKBlindedForward *NONNULL_PTR b);
36073
36074 /**
36075  * Frees any resources used by the PendingHTLCInfo, if is_owned is set and inner is non-NULL.
36076  */
36077 void PendingHTLCInfo_free(struct LDKPendingHTLCInfo this_obj);
36078
36079 /**
36080  * Further routing details based on whether the HTLC is being forwarded or received.
36081  */
36082 struct LDKPendingHTLCRouting PendingHTLCInfo_get_routing(const struct LDKPendingHTLCInfo *NONNULL_PTR this_ptr);
36083
36084 /**
36085  * Further routing details based on whether the HTLC is being forwarded or received.
36086  */
36087 void PendingHTLCInfo_set_routing(struct LDKPendingHTLCInfo *NONNULL_PTR this_ptr, struct LDKPendingHTLCRouting val);
36088
36089 /**
36090  * The onion shared secret we build with the sender used to decrypt the onion.
36091  *
36092  * This is later used to encrypt failure packets in the event that the HTLC is failed.
36093  */
36094 const uint8_t (*PendingHTLCInfo_get_incoming_shared_secret(const struct LDKPendingHTLCInfo *NONNULL_PTR this_ptr))[32];
36095
36096 /**
36097  * The onion shared secret we build with the sender used to decrypt the onion.
36098  *
36099  * This is later used to encrypt failure packets in the event that the HTLC is failed.
36100  */
36101 void PendingHTLCInfo_set_incoming_shared_secret(struct LDKPendingHTLCInfo *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
36102
36103 /**
36104  * Hash of the payment preimage, to lock the payment until the receiver releases the preimage.
36105  */
36106 const uint8_t (*PendingHTLCInfo_get_payment_hash(const struct LDKPendingHTLCInfo *NONNULL_PTR this_ptr))[32];
36107
36108 /**
36109  * Hash of the payment preimage, to lock the payment until the receiver releases the preimage.
36110  */
36111 void PendingHTLCInfo_set_payment_hash(struct LDKPendingHTLCInfo *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
36112
36113 /**
36114  * Amount received in the incoming HTLC.
36115  *
36116  * This field was added in LDK 0.0.113 and will be `None` for objects written by prior
36117  * versions.
36118  */
36119 struct LDKCOption_u64Z PendingHTLCInfo_get_incoming_amt_msat(const struct LDKPendingHTLCInfo *NONNULL_PTR this_ptr);
36120
36121 /**
36122  * Amount received in the incoming HTLC.
36123  *
36124  * This field was added in LDK 0.0.113 and will be `None` for objects written by prior
36125  * versions.
36126  */
36127 void PendingHTLCInfo_set_incoming_amt_msat(struct LDKPendingHTLCInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
36128
36129 /**
36130  * The amount the sender indicated should be forwarded on to the next hop or amount the sender
36131  * intended for us to receive for received payments.
36132  *
36133  * If the received amount is less than this for received payments, an intermediary hop has
36134  * attempted to steal some of our funds and we should fail the HTLC (the sender should retry
36135  * it along another path).
36136  *
36137  * Because nodes can take less than their required fees, and because senders may wish to
36138  * improve their own privacy, this amount may be less than [`Self::incoming_amt_msat`] for
36139  * received payments. In such cases, recipients must handle this HTLC as if it had received
36140  * [`Self::outgoing_amt_msat`].
36141  */
36142 uint64_t PendingHTLCInfo_get_outgoing_amt_msat(const struct LDKPendingHTLCInfo *NONNULL_PTR this_ptr);
36143
36144 /**
36145  * The amount the sender indicated should be forwarded on to the next hop or amount the sender
36146  * intended for us to receive for received payments.
36147  *
36148  * If the received amount is less than this for received payments, an intermediary hop has
36149  * attempted to steal some of our funds and we should fail the HTLC (the sender should retry
36150  * it along another path).
36151  *
36152  * Because nodes can take less than their required fees, and because senders may wish to
36153  * improve their own privacy, this amount may be less than [`Self::incoming_amt_msat`] for
36154  * received payments. In such cases, recipients must handle this HTLC as if it had received
36155  * [`Self::outgoing_amt_msat`].
36156  */
36157 void PendingHTLCInfo_set_outgoing_amt_msat(struct LDKPendingHTLCInfo *NONNULL_PTR this_ptr, uint64_t val);
36158
36159 /**
36160  * The CLTV the sender has indicated we should set on the forwarded HTLC (or has indicated
36161  * should have been set on the received HTLC for received payments).
36162  */
36163 uint32_t PendingHTLCInfo_get_outgoing_cltv_value(const struct LDKPendingHTLCInfo *NONNULL_PTR this_ptr);
36164
36165 /**
36166  * The CLTV the sender has indicated we should set on the forwarded HTLC (or has indicated
36167  * should have been set on the received HTLC for received payments).
36168  */
36169 void PendingHTLCInfo_set_outgoing_cltv_value(struct LDKPendingHTLCInfo *NONNULL_PTR this_ptr, uint32_t val);
36170
36171 /**
36172  * The fee taken for this HTLC in addition to the standard protocol HTLC fees.
36173  *
36174  * If this is a payment for forwarding, this is the fee we are taking before forwarding the
36175  * HTLC.
36176  *
36177  * If this is a received payment, this is the fee that our counterparty took.
36178  *
36179  * This is used to allow LSPs to take fees as a part of payments, without the sender having to
36180  * shoulder them.
36181  */
36182 struct LDKCOption_u64Z PendingHTLCInfo_get_skimmed_fee_msat(const struct LDKPendingHTLCInfo *NONNULL_PTR this_ptr);
36183
36184 /**
36185  * The fee taken for this HTLC in addition to the standard protocol HTLC fees.
36186  *
36187  * If this is a payment for forwarding, this is the fee we are taking before forwarding the
36188  * HTLC.
36189  *
36190  * If this is a received payment, this is the fee that our counterparty took.
36191  *
36192  * This is used to allow LSPs to take fees as a part of payments, without the sender having to
36193  * shoulder them.
36194  */
36195 void PendingHTLCInfo_set_skimmed_fee_msat(struct LDKPendingHTLCInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
36196
36197 /**
36198  * Constructs a new PendingHTLCInfo given each field
36199  */
36200 MUST_USE_RES struct LDKPendingHTLCInfo PendingHTLCInfo_new(struct LDKPendingHTLCRouting routing_arg, struct LDKThirtyTwoBytes incoming_shared_secret_arg, struct LDKThirtyTwoBytes payment_hash_arg, struct LDKCOption_u64Z incoming_amt_msat_arg, uint64_t outgoing_amt_msat_arg, uint32_t outgoing_cltv_value_arg, struct LDKCOption_u64Z skimmed_fee_msat_arg);
36201
36202 /**
36203  * Creates a copy of the PendingHTLCInfo
36204  */
36205 struct LDKPendingHTLCInfo PendingHTLCInfo_clone(const struct LDKPendingHTLCInfo *NONNULL_PTR orig);
36206
36207 /**
36208  * Creates a copy of the BlindedFailure
36209  */
36210 enum LDKBlindedFailure BlindedFailure_clone(const enum LDKBlindedFailure *NONNULL_PTR orig);
36211
36212 /**
36213  * Utility method to constructs a new FromIntroductionNode-variant BlindedFailure
36214  */
36215 enum LDKBlindedFailure BlindedFailure_from_introduction_node(void);
36216
36217 /**
36218  * Utility method to constructs a new FromBlindedNode-variant BlindedFailure
36219  */
36220 enum LDKBlindedFailure BlindedFailure_from_blinded_node(void);
36221
36222 /**
36223  * Generates a non-cryptographic 64-bit hash of the BlindedFailure.
36224  */
36225 uint64_t BlindedFailure_hash(const enum LDKBlindedFailure *NONNULL_PTR o);
36226
36227 /**
36228  * Checks if two BlindedFailures contain equal inner contents.
36229  * This ignores pointers and is_owned flags and looks at the values in fields.
36230  */
36231 bool BlindedFailure_eq(const enum LDKBlindedFailure *NONNULL_PTR a, const enum LDKBlindedFailure *NONNULL_PTR b);
36232
36233 /**
36234  * Frees any resources used by the FailureCode
36235  */
36236 void FailureCode_free(struct LDKFailureCode this_ptr);
36237
36238 /**
36239  * Creates a copy of the FailureCode
36240  */
36241 struct LDKFailureCode FailureCode_clone(const struct LDKFailureCode *NONNULL_PTR orig);
36242
36243 /**
36244  * Utility method to constructs a new TemporaryNodeFailure-variant FailureCode
36245  */
36246 struct LDKFailureCode FailureCode_temporary_node_failure(void);
36247
36248 /**
36249  * Utility method to constructs a new RequiredNodeFeatureMissing-variant FailureCode
36250  */
36251 struct LDKFailureCode FailureCode_required_node_feature_missing(void);
36252
36253 /**
36254  * Utility method to constructs a new IncorrectOrUnknownPaymentDetails-variant FailureCode
36255  */
36256 struct LDKFailureCode FailureCode_incorrect_or_unknown_payment_details(void);
36257
36258 /**
36259  * Utility method to constructs a new InvalidOnionPayload-variant FailureCode
36260  */
36261 struct LDKFailureCode FailureCode_invalid_onion_payload(struct LDKCOption_C2Tuple_u64u16ZZ a);
36262
36263 /**
36264  * Frees any resources used by the ChannelManager, if is_owned is set and inner is non-NULL.
36265  */
36266 void ChannelManager_free(struct LDKChannelManager this_obj);
36267
36268 /**
36269  * Frees any resources used by the ChainParameters, if is_owned is set and inner is non-NULL.
36270  */
36271 void ChainParameters_free(struct LDKChainParameters this_obj);
36272
36273 /**
36274  * The network for determining the `chain_hash` in Lightning messages.
36275  */
36276 enum LDKNetwork ChainParameters_get_network(const struct LDKChainParameters *NONNULL_PTR this_ptr);
36277
36278 /**
36279  * The network for determining the `chain_hash` in Lightning messages.
36280  */
36281 void ChainParameters_set_network(struct LDKChainParameters *NONNULL_PTR this_ptr, enum LDKNetwork val);
36282
36283 /**
36284  * The hash and height of the latest block successfully connected.
36285  *
36286  * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
36287  */
36288 struct LDKBestBlock ChainParameters_get_best_block(const struct LDKChainParameters *NONNULL_PTR this_ptr);
36289
36290 /**
36291  * The hash and height of the latest block successfully connected.
36292  *
36293  * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
36294  */
36295 void ChainParameters_set_best_block(struct LDKChainParameters *NONNULL_PTR this_ptr, struct LDKBestBlock val);
36296
36297 /**
36298  * Constructs a new ChainParameters given each field
36299  */
36300 MUST_USE_RES struct LDKChainParameters ChainParameters_new(enum LDKNetwork network_arg, struct LDKBestBlock best_block_arg);
36301
36302 /**
36303  * Creates a copy of the ChainParameters
36304  */
36305 struct LDKChainParameters ChainParameters_clone(const struct LDKChainParameters *NONNULL_PTR orig);
36306
36307 /**
36308  * Frees any resources used by the CounterpartyForwardingInfo, if is_owned is set and inner is non-NULL.
36309  */
36310 void CounterpartyForwardingInfo_free(struct LDKCounterpartyForwardingInfo this_obj);
36311
36312 /**
36313  * Base routing fee in millisatoshis.
36314  */
36315 uint32_t CounterpartyForwardingInfo_get_fee_base_msat(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr);
36316
36317 /**
36318  * Base routing fee in millisatoshis.
36319  */
36320 void CounterpartyForwardingInfo_set_fee_base_msat(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint32_t val);
36321
36322 /**
36323  * Amount in millionths of a satoshi the channel will charge per transferred satoshi.
36324  */
36325 uint32_t CounterpartyForwardingInfo_get_fee_proportional_millionths(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr);
36326
36327 /**
36328  * Amount in millionths of a satoshi the channel will charge per transferred satoshi.
36329  */
36330 void CounterpartyForwardingInfo_set_fee_proportional_millionths(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint32_t val);
36331
36332 /**
36333  * The minimum difference in cltv_expiry between an ingoing HTLC and its outgoing counterpart,
36334  * such that the outgoing HTLC is forwardable to this counterparty. See `msgs::ChannelUpdate`'s
36335  * `cltv_expiry_delta` for more details.
36336  */
36337 uint16_t CounterpartyForwardingInfo_get_cltv_expiry_delta(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr);
36338
36339 /**
36340  * The minimum difference in cltv_expiry between an ingoing HTLC and its outgoing counterpart,
36341  * such that the outgoing HTLC is forwardable to this counterparty. See `msgs::ChannelUpdate`'s
36342  * `cltv_expiry_delta` for more details.
36343  */
36344 void CounterpartyForwardingInfo_set_cltv_expiry_delta(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint16_t val);
36345
36346 /**
36347  * Constructs a new CounterpartyForwardingInfo given each field
36348  */
36349 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);
36350
36351 /**
36352  * Creates a copy of the CounterpartyForwardingInfo
36353  */
36354 struct LDKCounterpartyForwardingInfo CounterpartyForwardingInfo_clone(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR orig);
36355
36356 /**
36357  * Frees any resources used by the ChannelCounterparty, if is_owned is set and inner is non-NULL.
36358  */
36359 void ChannelCounterparty_free(struct LDKChannelCounterparty this_obj);
36360
36361 /**
36362  * The node_id of our counterparty
36363  */
36364 struct LDKPublicKey ChannelCounterparty_get_node_id(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
36365
36366 /**
36367  * The node_id of our counterparty
36368  */
36369 void ChannelCounterparty_set_node_id(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKPublicKey val);
36370
36371 /**
36372  * The Features the channel counterparty provided upon last connection.
36373  * Useful for routing as it is the most up-to-date copy of the counterparty's features and
36374  * many routing-relevant features are present in the init context.
36375  */
36376 struct LDKInitFeatures ChannelCounterparty_get_features(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
36377
36378 /**
36379  * The Features the channel counterparty provided upon last connection.
36380  * Useful for routing as it is the most up-to-date copy of the counterparty's features and
36381  * many routing-relevant features are present in the init context.
36382  */
36383 void ChannelCounterparty_set_features(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKInitFeatures val);
36384
36385 /**
36386  * The value, in satoshis, that must always be held in the channel for our counterparty. This
36387  * value ensures that if our counterparty broadcasts a revoked state, we can punish them by
36388  * claiming at least this value on chain.
36389  *
36390  * This value is not included in [`inbound_capacity_msat`] as it can never be spent.
36391  *
36392  * [`inbound_capacity_msat`]: ChannelDetails::inbound_capacity_msat
36393  */
36394 uint64_t ChannelCounterparty_get_unspendable_punishment_reserve(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
36395
36396 /**
36397  * The value, in satoshis, that must always be held in the channel for our counterparty. This
36398  * value ensures that if our counterparty broadcasts a revoked state, we can punish them by
36399  * claiming at least this value on chain.
36400  *
36401  * This value is not included in [`inbound_capacity_msat`] as it can never be spent.
36402  *
36403  * [`inbound_capacity_msat`]: ChannelDetails::inbound_capacity_msat
36404  */
36405 void ChannelCounterparty_set_unspendable_punishment_reserve(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, uint64_t val);
36406
36407 /**
36408  * Information on the fees and requirements that the counterparty requires when forwarding
36409  * payments to us through this channel.
36410  *
36411  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
36412  */
36413 struct LDKCounterpartyForwardingInfo ChannelCounterparty_get_forwarding_info(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
36414
36415 /**
36416  * Information on the fees and requirements that the counterparty requires when forwarding
36417  * payments to us through this channel.
36418  *
36419  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
36420  */
36421 void ChannelCounterparty_set_forwarding_info(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKCounterpartyForwardingInfo val);
36422
36423 /**
36424  * The smallest value HTLC (in msat) the remote peer will accept, for this channel. This field
36425  * is only `None` before we have received either the `OpenChannel` or `AcceptChannel` message
36426  * from the remote peer, or for `ChannelCounterparty` objects serialized prior to LDK 0.0.107.
36427  */
36428 struct LDKCOption_u64Z ChannelCounterparty_get_outbound_htlc_minimum_msat(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
36429
36430 /**
36431  * The smallest value HTLC (in msat) the remote peer will accept, for this channel. This field
36432  * is only `None` before we have received either the `OpenChannel` or `AcceptChannel` message
36433  * from the remote peer, or for `ChannelCounterparty` objects serialized prior to LDK 0.0.107.
36434  */
36435 void ChannelCounterparty_set_outbound_htlc_minimum_msat(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
36436
36437 /**
36438  * The largest value HTLC (in msat) the remote peer currently will accept, for this channel.
36439  */
36440 struct LDKCOption_u64Z ChannelCounterparty_get_outbound_htlc_maximum_msat(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
36441
36442 /**
36443  * The largest value HTLC (in msat) the remote peer currently will accept, for this channel.
36444  */
36445 void ChannelCounterparty_set_outbound_htlc_maximum_msat(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
36446
36447 /**
36448  * Constructs a new ChannelCounterparty given each field
36449  *
36450  * Note that forwarding_info_arg (or a relevant inner pointer) may be NULL or all-0s to represent None
36451  */
36452 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);
36453
36454 /**
36455  * Creates a copy of the ChannelCounterparty
36456  */
36457 struct LDKChannelCounterparty ChannelCounterparty_clone(const struct LDKChannelCounterparty *NONNULL_PTR orig);
36458
36459 /**
36460  * Frees any resources used by the ChannelDetails, if is_owned is set and inner is non-NULL.
36461  */
36462 void ChannelDetails_free(struct LDKChannelDetails this_obj);
36463
36464 /**
36465  * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
36466  * thereafter this is the txid of the funding transaction xor the funding transaction output).
36467  * Note that this means this value is *not* persistent - it can change once during the
36468  * lifetime of the channel.
36469  */
36470 struct LDKChannelId ChannelDetails_get_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
36471
36472 /**
36473  * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
36474  * thereafter this is the txid of the funding transaction xor the funding transaction output).
36475  * Note that this means this value is *not* persistent - it can change once during the
36476  * lifetime of the channel.
36477  */
36478 void ChannelDetails_set_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKChannelId val);
36479
36480 /**
36481  * Parameters which apply to our counterparty. See individual fields for more information.
36482  */
36483 struct LDKChannelCounterparty ChannelDetails_get_counterparty(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
36484
36485 /**
36486  * Parameters which apply to our counterparty. See individual fields for more information.
36487  */
36488 void ChannelDetails_set_counterparty(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKChannelCounterparty val);
36489
36490 /**
36491  * The Channel's funding transaction output, if we've negotiated the funding transaction with
36492  * our counterparty already.
36493  *
36494  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
36495  */
36496 struct LDKOutPoint ChannelDetails_get_funding_txo(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
36497
36498 /**
36499  * The Channel's funding transaction output, if we've negotiated the funding transaction with
36500  * our counterparty already.
36501  *
36502  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
36503  */
36504 void ChannelDetails_set_funding_txo(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKOutPoint val);
36505
36506 /**
36507  * The features which this channel operates with. See individual features for more info.
36508  *
36509  * `None` until negotiation completes and the channel type is finalized.
36510  *
36511  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
36512  */
36513 struct LDKChannelTypeFeatures ChannelDetails_get_channel_type(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
36514
36515 /**
36516  * The features which this channel operates with. See individual features for more info.
36517  *
36518  * `None` until negotiation completes and the channel type is finalized.
36519  *
36520  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
36521  */
36522 void ChannelDetails_set_channel_type(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKChannelTypeFeatures val);
36523
36524 /**
36525  * The position of the funding transaction in the chain. None if the funding transaction has
36526  * not yet been confirmed and the channel fully opened.
36527  *
36528  * Note that if [`inbound_scid_alias`] is set, it must be used for invoices and inbound
36529  * payments instead of this. See [`get_inbound_payment_scid`].
36530  *
36531  * For channels with [`confirmations_required`] set to `Some(0)`, [`outbound_scid_alias`] may
36532  * be used in place of this in outbound routes. See [`get_outbound_payment_scid`].
36533  *
36534  * [`inbound_scid_alias`]: Self::inbound_scid_alias
36535  * [`outbound_scid_alias`]: Self::outbound_scid_alias
36536  * [`get_inbound_payment_scid`]: Self::get_inbound_payment_scid
36537  * [`get_outbound_payment_scid`]: Self::get_outbound_payment_scid
36538  * [`confirmations_required`]: Self::confirmations_required
36539  */
36540 struct LDKCOption_u64Z ChannelDetails_get_short_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
36541
36542 /**
36543  * The position of the funding transaction in the chain. None if the funding transaction has
36544  * not yet been confirmed and the channel fully opened.
36545  *
36546  * Note that if [`inbound_scid_alias`] is set, it must be used for invoices and inbound
36547  * payments instead of this. See [`get_inbound_payment_scid`].
36548  *
36549  * For channels with [`confirmations_required`] set to `Some(0)`, [`outbound_scid_alias`] may
36550  * be used in place of this in outbound routes. See [`get_outbound_payment_scid`].
36551  *
36552  * [`inbound_scid_alias`]: Self::inbound_scid_alias
36553  * [`outbound_scid_alias`]: Self::outbound_scid_alias
36554  * [`get_inbound_payment_scid`]: Self::get_inbound_payment_scid
36555  * [`get_outbound_payment_scid`]: Self::get_outbound_payment_scid
36556  * [`confirmations_required`]: Self::confirmations_required
36557  */
36558 void ChannelDetails_set_short_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
36559
36560 /**
36561  * An optional [`short_channel_id`] alias for this channel, randomly generated by us and
36562  * usable in place of [`short_channel_id`] to reference the channel in outbound routes when
36563  * the channel has not yet been confirmed (as long as [`confirmations_required`] is
36564  * `Some(0)`).
36565  *
36566  * This will be `None` as long as the channel is not available for routing outbound payments.
36567  *
36568  * [`short_channel_id`]: Self::short_channel_id
36569  * [`confirmations_required`]: Self::confirmations_required
36570  */
36571 struct LDKCOption_u64Z ChannelDetails_get_outbound_scid_alias(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
36572
36573 /**
36574  * An optional [`short_channel_id`] alias for this channel, randomly generated by us and
36575  * usable in place of [`short_channel_id`] to reference the channel in outbound routes when
36576  * the channel has not yet been confirmed (as long as [`confirmations_required`] is
36577  * `Some(0)`).
36578  *
36579  * This will be `None` as long as the channel is not available for routing outbound payments.
36580  *
36581  * [`short_channel_id`]: Self::short_channel_id
36582  * [`confirmations_required`]: Self::confirmations_required
36583  */
36584 void ChannelDetails_set_outbound_scid_alias(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
36585
36586 /**
36587  * An optional [`short_channel_id`] alias for this channel, randomly generated by our
36588  * counterparty and usable in place of [`short_channel_id`] in invoice route hints. Our
36589  * counterparty will recognize the alias provided here in place of the [`short_channel_id`]
36590  * when they see a payment to be routed to us.
36591  *
36592  * Our counterparty may choose to rotate this value at any time, though will always recognize
36593  * previous values for inbound payment forwarding.
36594  *
36595  * [`short_channel_id`]: Self::short_channel_id
36596  */
36597 struct LDKCOption_u64Z ChannelDetails_get_inbound_scid_alias(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
36598
36599 /**
36600  * An optional [`short_channel_id`] alias for this channel, randomly generated by our
36601  * counterparty and usable in place of [`short_channel_id`] in invoice route hints. Our
36602  * counterparty will recognize the alias provided here in place of the [`short_channel_id`]
36603  * when they see a payment to be routed to us.
36604  *
36605  * Our counterparty may choose to rotate this value at any time, though will always recognize
36606  * previous values for inbound payment forwarding.
36607  *
36608  * [`short_channel_id`]: Self::short_channel_id
36609  */
36610 void ChannelDetails_set_inbound_scid_alias(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
36611
36612 /**
36613  * The value, in satoshis, of this channel as appears in the funding output
36614  */
36615 uint64_t ChannelDetails_get_channel_value_satoshis(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
36616
36617 /**
36618  * The value, in satoshis, of this channel as appears in the funding output
36619  */
36620 void ChannelDetails_set_channel_value_satoshis(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
36621
36622 /**
36623  * The value, in satoshis, that must always be held in the channel for us. This value ensures
36624  * that if we broadcast a revoked state, our counterparty can punish us by claiming at least
36625  * this value on chain.
36626  *
36627  * This value is not included in [`outbound_capacity_msat`] as it can never be spent.
36628  *
36629  * This value will be `None` for outbound channels until the counterparty accepts the channel.
36630  *
36631  * [`outbound_capacity_msat`]: ChannelDetails::outbound_capacity_msat
36632  */
36633 struct LDKCOption_u64Z ChannelDetails_get_unspendable_punishment_reserve(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
36634
36635 /**
36636  * The value, in satoshis, that must always be held in the channel for us. This value ensures
36637  * that if we broadcast a revoked state, our counterparty can punish us by claiming at least
36638  * this value on chain.
36639  *
36640  * This value is not included in [`outbound_capacity_msat`] as it can never be spent.
36641  *
36642  * This value will be `None` for outbound channels until the counterparty accepts the channel.
36643  *
36644  * [`outbound_capacity_msat`]: ChannelDetails::outbound_capacity_msat
36645  */
36646 void ChannelDetails_set_unspendable_punishment_reserve(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
36647
36648 /**
36649  * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound
36650  * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if
36651  * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise
36652  * `user_channel_id` will be randomized for an inbound channel.  This may be zero for objects
36653  * serialized with LDK versions prior to 0.0.113.
36654  *
36655  * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
36656  * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
36657  * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
36658  */
36659 struct LDKU128 ChannelDetails_get_user_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
36660
36661 /**
36662  * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound
36663  * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if
36664  * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise
36665  * `user_channel_id` will be randomized for an inbound channel.  This may be zero for objects
36666  * serialized with LDK versions prior to 0.0.113.
36667  *
36668  * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
36669  * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
36670  * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
36671  */
36672 void ChannelDetails_set_user_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKU128 val);
36673
36674 /**
36675  * The currently negotiated fee rate denominated in satoshi per 1000 weight units,
36676  * which is applied to commitment and HTLC transactions.
36677  *
36678  * This value will be `None` for objects serialized with LDK versions prior to 0.0.115.
36679  */
36680 struct LDKCOption_u32Z ChannelDetails_get_feerate_sat_per_1000_weight(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
36681
36682 /**
36683  * The currently negotiated fee rate denominated in satoshi per 1000 weight units,
36684  * which is applied to commitment and HTLC transactions.
36685  *
36686  * This value will be `None` for objects serialized with LDK versions prior to 0.0.115.
36687  */
36688 void ChannelDetails_set_feerate_sat_per_1000_weight(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val);
36689
36690 /**
36691  * Our total balance.  This is the amount we would get if we close the channel.
36692  * This value is not exact. Due to various in-flight changes and feerate changes, exactly this
36693  * amount is not likely to be recoverable on close.
36694  *
36695  * This does not include any pending HTLCs which are not yet fully resolved (and, thus, whose
36696  * balance is not available for inclusion in new outbound HTLCs). This further does not include
36697  * any pending outgoing HTLCs which are awaiting some other resolution to be sent.
36698  * This does not consider any on-chain fees.
36699  *
36700  * See also [`ChannelDetails::outbound_capacity_msat`]
36701  */
36702 uint64_t ChannelDetails_get_balance_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
36703
36704 /**
36705  * Our total balance.  This is the amount we would get if we close the channel.
36706  * This value is not exact. Due to various in-flight changes and feerate changes, exactly this
36707  * amount is not likely to be recoverable on close.
36708  *
36709  * This does not include any pending HTLCs which are not yet fully resolved (and, thus, whose
36710  * balance is not available for inclusion in new outbound HTLCs). This further does not include
36711  * any pending outgoing HTLCs which are awaiting some other resolution to be sent.
36712  * This does not consider any on-chain fees.
36713  *
36714  * See also [`ChannelDetails::outbound_capacity_msat`]
36715  */
36716 void ChannelDetails_set_balance_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
36717
36718 /**
36719  * The available outbound capacity for sending HTLCs to the remote peer. This does not include
36720  * any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
36721  * available for inclusion in new outbound HTLCs). This further does not include any pending
36722  * outgoing HTLCs which are awaiting some other resolution to be sent.
36723  *
36724  * See also [`ChannelDetails::balance_msat`]
36725  *
36726  * This value is not exact. Due to various in-flight changes, feerate changes, and our
36727  * conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we
36728  * should be able to spend nearly this amount.
36729  */
36730 uint64_t ChannelDetails_get_outbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
36731
36732 /**
36733  * The available outbound capacity for sending HTLCs to the remote peer. This does not include
36734  * any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
36735  * available for inclusion in new outbound HTLCs). This further does not include any pending
36736  * outgoing HTLCs which are awaiting some other resolution to be sent.
36737  *
36738  * See also [`ChannelDetails::balance_msat`]
36739  *
36740  * This value is not exact. Due to various in-flight changes, feerate changes, and our
36741  * conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we
36742  * should be able to spend nearly this amount.
36743  */
36744 void ChannelDetails_set_outbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
36745
36746 /**
36747  * The available outbound capacity for sending a single HTLC to the remote peer. This is
36748  * similar to [`ChannelDetails::outbound_capacity_msat`] but it may be further restricted by
36749  * the current state and per-HTLC limit(s). This is intended for use when routing, allowing us
36750  * to use a limit as close as possible to the HTLC limit we can currently send.
36751  *
36752  * See also [`ChannelDetails::next_outbound_htlc_minimum_msat`],
36753  * [`ChannelDetails::balance_msat`], and [`ChannelDetails::outbound_capacity_msat`].
36754  */
36755 uint64_t ChannelDetails_get_next_outbound_htlc_limit_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
36756
36757 /**
36758  * The available outbound capacity for sending a single HTLC to the remote peer. This is
36759  * similar to [`ChannelDetails::outbound_capacity_msat`] but it may be further restricted by
36760  * the current state and per-HTLC limit(s). This is intended for use when routing, allowing us
36761  * to use a limit as close as possible to the HTLC limit we can currently send.
36762  *
36763  * See also [`ChannelDetails::next_outbound_htlc_minimum_msat`],
36764  * [`ChannelDetails::balance_msat`], and [`ChannelDetails::outbound_capacity_msat`].
36765  */
36766 void ChannelDetails_set_next_outbound_htlc_limit_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
36767
36768 /**
36769  * The minimum value for sending a single HTLC to the remote peer. This is the equivalent of
36770  * [`ChannelDetails::next_outbound_htlc_limit_msat`] but represents a lower-bound, rather than
36771  * an upper-bound. This is intended for use when routing, allowing us to ensure we pick a
36772  * route which is valid.
36773  */
36774 uint64_t ChannelDetails_get_next_outbound_htlc_minimum_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
36775
36776 /**
36777  * The minimum value for sending a single HTLC to the remote peer. This is the equivalent of
36778  * [`ChannelDetails::next_outbound_htlc_limit_msat`] but represents a lower-bound, rather than
36779  * an upper-bound. This is intended for use when routing, allowing us to ensure we pick a
36780  * route which is valid.
36781  */
36782 void ChannelDetails_set_next_outbound_htlc_minimum_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
36783
36784 /**
36785  * The available inbound capacity for the remote peer to send HTLCs to us. This does not
36786  * include any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
36787  * available for inclusion in new inbound HTLCs).
36788  * Note that there are some corner cases not fully handled here, so the actual available
36789  * inbound capacity may be slightly higher than this.
36790  *
36791  * This value is not exact. Due to various in-flight changes, feerate changes, and our
36792  * counterparty's conflict-avoidance policy, exactly this amount is not likely to be spendable.
36793  * However, our counterparty should be able to spend nearly this amount.
36794  */
36795 uint64_t ChannelDetails_get_inbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
36796
36797 /**
36798  * The available inbound capacity for the remote peer to send HTLCs to us. This does not
36799  * include any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
36800  * available for inclusion in new inbound HTLCs).
36801  * Note that there are some corner cases not fully handled here, so the actual available
36802  * inbound capacity may be slightly higher than this.
36803  *
36804  * This value is not exact. Due to various in-flight changes, feerate changes, and our
36805  * counterparty's conflict-avoidance policy, exactly this amount is not likely to be spendable.
36806  * However, our counterparty should be able to spend nearly this amount.
36807  */
36808 void ChannelDetails_set_inbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
36809
36810 /**
36811  * The number of required confirmations on the funding transaction before the funding will be
36812  * considered \"locked\". This number is selected by the channel fundee (i.e. us if
36813  * [`is_outbound`] is *not* set), and can be selected for inbound channels with
36814  * [`ChannelHandshakeConfig::minimum_depth`] or limited for outbound channels with
36815  * [`ChannelHandshakeLimits::max_minimum_depth`].
36816  *
36817  * This value will be `None` for outbound channels until the counterparty accepts the channel.
36818  *
36819  * [`is_outbound`]: ChannelDetails::is_outbound
36820  * [`ChannelHandshakeConfig::minimum_depth`]: crate::util::config::ChannelHandshakeConfig::minimum_depth
36821  * [`ChannelHandshakeLimits::max_minimum_depth`]: crate::util::config::ChannelHandshakeLimits::max_minimum_depth
36822  */
36823 struct LDKCOption_u32Z ChannelDetails_get_confirmations_required(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
36824
36825 /**
36826  * The number of required confirmations on the funding transaction before the funding will be
36827  * considered \"locked\". This number is selected by the channel fundee (i.e. us if
36828  * [`is_outbound`] is *not* set), and can be selected for inbound channels with
36829  * [`ChannelHandshakeConfig::minimum_depth`] or limited for outbound channels with
36830  * [`ChannelHandshakeLimits::max_minimum_depth`].
36831  *
36832  * This value will be `None` for outbound channels until the counterparty accepts the channel.
36833  *
36834  * [`is_outbound`]: ChannelDetails::is_outbound
36835  * [`ChannelHandshakeConfig::minimum_depth`]: crate::util::config::ChannelHandshakeConfig::minimum_depth
36836  * [`ChannelHandshakeLimits::max_minimum_depth`]: crate::util::config::ChannelHandshakeLimits::max_minimum_depth
36837  */
36838 void ChannelDetails_set_confirmations_required(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val);
36839
36840 /**
36841  * The current number of confirmations on the funding transaction.
36842  *
36843  * This value will be `None` for objects serialized with LDK versions prior to 0.0.113.
36844  */
36845 struct LDKCOption_u32Z ChannelDetails_get_confirmations(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
36846
36847 /**
36848  * The current number of confirmations on the funding transaction.
36849  *
36850  * This value will be `None` for objects serialized with LDK versions prior to 0.0.113.
36851  */
36852 void ChannelDetails_set_confirmations(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val);
36853
36854 /**
36855  * The number of blocks (after our commitment transaction confirms) that we will need to wait
36856  * until we can claim our funds after we force-close the channel. During this time our
36857  * counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty
36858  * force-closes the channel and broadcasts a commitment transaction we do not have to wait any
36859  * time to claim our non-HTLC-encumbered funds.
36860  *
36861  * This value will be `None` for outbound channels until the counterparty accepts the channel.
36862  */
36863 struct LDKCOption_u16Z ChannelDetails_get_force_close_spend_delay(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
36864
36865 /**
36866  * The number of blocks (after our commitment transaction confirms) that we will need to wait
36867  * until we can claim our funds after we force-close the channel. During this time our
36868  * counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty
36869  * force-closes the channel and broadcasts a commitment transaction we do not have to wait any
36870  * time to claim our non-HTLC-encumbered funds.
36871  *
36872  * This value will be `None` for outbound channels until the counterparty accepts the channel.
36873  */
36874 void ChannelDetails_set_force_close_spend_delay(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u16Z val);
36875
36876 /**
36877  * True if the channel was initiated (and thus funded) by us.
36878  */
36879 bool ChannelDetails_get_is_outbound(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
36880
36881 /**
36882  * True if the channel was initiated (and thus funded) by us.
36883  */
36884 void ChannelDetails_set_is_outbound(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
36885
36886 /**
36887  * True if the channel is confirmed, channel_ready messages have been exchanged, and the
36888  * channel is not currently being shut down. `channel_ready` message exchange implies the
36889  * required confirmation count has been reached (and we were connected to the peer at some
36890  * point after the funding transaction received enough confirmations). The required
36891  * confirmation count is provided in [`confirmations_required`].
36892  *
36893  * [`confirmations_required`]: ChannelDetails::confirmations_required
36894  */
36895 bool ChannelDetails_get_is_channel_ready(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
36896
36897 /**
36898  * True if the channel is confirmed, channel_ready messages have been exchanged, and the
36899  * channel is not currently being shut down. `channel_ready` message exchange implies the
36900  * required confirmation count has been reached (and we were connected to the peer at some
36901  * point after the funding transaction received enough confirmations). The required
36902  * confirmation count is provided in [`confirmations_required`].
36903  *
36904  * [`confirmations_required`]: ChannelDetails::confirmations_required
36905  */
36906 void ChannelDetails_set_is_channel_ready(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
36907
36908 /**
36909  * The stage of the channel's shutdown.
36910  * `None` for `ChannelDetails` serialized on LDK versions prior to 0.0.116.
36911  *
36912  * Returns a copy of the field.
36913  */
36914 struct LDKCOption_ChannelShutdownStateZ ChannelDetails_get_channel_shutdown_state(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
36915
36916 /**
36917  * The stage of the channel's shutdown.
36918  * `None` for `ChannelDetails` serialized on LDK versions prior to 0.0.116.
36919  */
36920 void ChannelDetails_set_channel_shutdown_state(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_ChannelShutdownStateZ val);
36921
36922 /**
36923  * True if the channel is (a) confirmed and channel_ready messages have been exchanged, (b)
36924  * the peer is connected, and (c) the channel is not currently negotiating a shutdown.
36925  *
36926  * This is a strict superset of `is_channel_ready`.
36927  */
36928 bool ChannelDetails_get_is_usable(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
36929
36930 /**
36931  * True if the channel is (a) confirmed and channel_ready messages have been exchanged, (b)
36932  * the peer is connected, and (c) the channel is not currently negotiating a shutdown.
36933  *
36934  * This is a strict superset of `is_channel_ready`.
36935  */
36936 void ChannelDetails_set_is_usable(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
36937
36938 /**
36939  * True if this channel is (or will be) publicly-announced.
36940  */
36941 bool ChannelDetails_get_is_public(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
36942
36943 /**
36944  * True if this channel is (or will be) publicly-announced.
36945  */
36946 void ChannelDetails_set_is_public(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
36947
36948 /**
36949  * The smallest value HTLC (in msat) we will accept, for this channel. This field
36950  * is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.107
36951  */
36952 struct LDKCOption_u64Z ChannelDetails_get_inbound_htlc_minimum_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
36953
36954 /**
36955  * The smallest value HTLC (in msat) we will accept, for this channel. This field
36956  * is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.107
36957  */
36958 void ChannelDetails_set_inbound_htlc_minimum_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
36959
36960 /**
36961  * The largest value HTLC (in msat) we currently will accept, for this channel.
36962  */
36963 struct LDKCOption_u64Z ChannelDetails_get_inbound_htlc_maximum_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
36964
36965 /**
36966  * The largest value HTLC (in msat) we currently will accept, for this channel.
36967  */
36968 void ChannelDetails_set_inbound_htlc_maximum_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
36969
36970 /**
36971  * Set of configurable parameters that affect channel operation.
36972  *
36973  * This field is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.109.
36974  *
36975  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
36976  */
36977 struct LDKChannelConfig ChannelDetails_get_config(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
36978
36979 /**
36980  * Set of configurable parameters that affect channel operation.
36981  *
36982  * This field is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.109.
36983  *
36984  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
36985  */
36986 void ChannelDetails_set_config(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKChannelConfig val);
36987
36988 /**
36989  * Creates a copy of the ChannelDetails
36990  */
36991 struct LDKChannelDetails ChannelDetails_clone(const struct LDKChannelDetails *NONNULL_PTR orig);
36992
36993 /**
36994  * Gets the current SCID which should be used to identify this channel for inbound payments.
36995  * This should be used for providing invoice hints or in any other context where our
36996  * counterparty will forward a payment to us.
36997  *
36998  * This is either the [`ChannelDetails::inbound_scid_alias`], if set, or the
36999  * [`ChannelDetails::short_channel_id`]. See those for more information.
37000  */
37001 MUST_USE_RES struct LDKCOption_u64Z ChannelDetails_get_inbound_payment_scid(const struct LDKChannelDetails *NONNULL_PTR this_arg);
37002
37003 /**
37004  * Gets the current SCID which should be used to identify this channel for outbound payments.
37005  * This should be used in [`Route`]s to describe the first hop or in other contexts where
37006  * we're sending or forwarding a payment outbound over this channel.
37007  *
37008  * This is either the [`ChannelDetails::short_channel_id`], if set, or the
37009  * [`ChannelDetails::outbound_scid_alias`]. See those for more information.
37010  */
37011 MUST_USE_RES struct LDKCOption_u64Z ChannelDetails_get_outbound_payment_scid(const struct LDKChannelDetails *NONNULL_PTR this_arg);
37012
37013 /**
37014  * Creates a copy of the ChannelShutdownState
37015  */
37016 enum LDKChannelShutdownState ChannelShutdownState_clone(const enum LDKChannelShutdownState *NONNULL_PTR orig);
37017
37018 /**
37019  * Utility method to constructs a new NotShuttingDown-variant ChannelShutdownState
37020  */
37021 enum LDKChannelShutdownState ChannelShutdownState_not_shutting_down(void);
37022
37023 /**
37024  * Utility method to constructs a new ShutdownInitiated-variant ChannelShutdownState
37025  */
37026 enum LDKChannelShutdownState ChannelShutdownState_shutdown_initiated(void);
37027
37028 /**
37029  * Utility method to constructs a new ResolvingHTLCs-variant ChannelShutdownState
37030  */
37031 enum LDKChannelShutdownState ChannelShutdownState_resolving_htlcs(void);
37032
37033 /**
37034  * Utility method to constructs a new NegotiatingClosingFee-variant ChannelShutdownState
37035  */
37036 enum LDKChannelShutdownState ChannelShutdownState_negotiating_closing_fee(void);
37037
37038 /**
37039  * Utility method to constructs a new ShutdownComplete-variant ChannelShutdownState
37040  */
37041 enum LDKChannelShutdownState ChannelShutdownState_shutdown_complete(void);
37042
37043 /**
37044  * Checks if two ChannelShutdownStates contain equal inner contents.
37045  * This ignores pointers and is_owned flags and looks at the values in fields.
37046  */
37047 bool ChannelShutdownState_eq(const enum LDKChannelShutdownState *NONNULL_PTR a, const enum LDKChannelShutdownState *NONNULL_PTR b);
37048
37049 /**
37050  * Frees any resources used by the RecentPaymentDetails
37051  */
37052 void RecentPaymentDetails_free(struct LDKRecentPaymentDetails this_ptr);
37053
37054 /**
37055  * Creates a copy of the RecentPaymentDetails
37056  */
37057 struct LDKRecentPaymentDetails RecentPaymentDetails_clone(const struct LDKRecentPaymentDetails *NONNULL_PTR orig);
37058
37059 /**
37060  * Utility method to constructs a new AwaitingInvoice-variant RecentPaymentDetails
37061  */
37062 struct LDKRecentPaymentDetails RecentPaymentDetails_awaiting_invoice(struct LDKThirtyTwoBytes payment_id);
37063
37064 /**
37065  * Utility method to constructs a new Pending-variant RecentPaymentDetails
37066  */
37067 struct LDKRecentPaymentDetails RecentPaymentDetails_pending(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, uint64_t total_msat);
37068
37069 /**
37070  * Utility method to constructs a new Fulfilled-variant RecentPaymentDetails
37071  */
37072 struct LDKRecentPaymentDetails RecentPaymentDetails_fulfilled(struct LDKThirtyTwoBytes payment_id, struct LDKCOption_ThirtyTwoBytesZ payment_hash);
37073
37074 /**
37075  * Utility method to constructs a new Abandoned-variant RecentPaymentDetails
37076  */
37077 struct LDKRecentPaymentDetails RecentPaymentDetails_abandoned(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash);
37078
37079 /**
37080  * Frees any resources used by the PhantomRouteHints, if is_owned is set and inner is non-NULL.
37081  */
37082 void PhantomRouteHints_free(struct LDKPhantomRouteHints this_obj);
37083
37084 /**
37085  * The list of channels to be included in the invoice route hints.
37086  */
37087 struct LDKCVec_ChannelDetailsZ PhantomRouteHints_get_channels(const struct LDKPhantomRouteHints *NONNULL_PTR this_ptr);
37088
37089 /**
37090  * The list of channels to be included in the invoice route hints.
37091  */
37092 void PhantomRouteHints_set_channels(struct LDKPhantomRouteHints *NONNULL_PTR this_ptr, struct LDKCVec_ChannelDetailsZ val);
37093
37094 /**
37095  * A fake scid used for representing the phantom node's fake channel in generating the invoice
37096  * route hints.
37097  */
37098 uint64_t PhantomRouteHints_get_phantom_scid(const struct LDKPhantomRouteHints *NONNULL_PTR this_ptr);
37099
37100 /**
37101  * A fake scid used for representing the phantom node's fake channel in generating the invoice
37102  * route hints.
37103  */
37104 void PhantomRouteHints_set_phantom_scid(struct LDKPhantomRouteHints *NONNULL_PTR this_ptr, uint64_t val);
37105
37106 /**
37107  * The pubkey of the real backing node that would ultimately receive the payment.
37108  */
37109 struct LDKPublicKey PhantomRouteHints_get_real_node_pubkey(const struct LDKPhantomRouteHints *NONNULL_PTR this_ptr);
37110
37111 /**
37112  * The pubkey of the real backing node that would ultimately receive the payment.
37113  */
37114 void PhantomRouteHints_set_real_node_pubkey(struct LDKPhantomRouteHints *NONNULL_PTR this_ptr, struct LDKPublicKey val);
37115
37116 /**
37117  * Constructs a new PhantomRouteHints given each field
37118  */
37119 MUST_USE_RES struct LDKPhantomRouteHints PhantomRouteHints_new(struct LDKCVec_ChannelDetailsZ channels_arg, uint64_t phantom_scid_arg, struct LDKPublicKey real_node_pubkey_arg);
37120
37121 /**
37122  * Creates a copy of the PhantomRouteHints
37123  */
37124 struct LDKPhantomRouteHints PhantomRouteHints_clone(const struct LDKPhantomRouteHints *NONNULL_PTR orig);
37125
37126 /**
37127  * Constructs a new `ChannelManager` to hold several channels and route between them.
37128  *
37129  * The current time or latest block header time can be provided as the `current_timestamp`.
37130  *
37131  * This is the main \"logic hub\" for all channel-related actions, and implements
37132  * [`ChannelMessageHandler`].
37133  *
37134  * Non-proportional fees are fixed according to our risk using the provided fee estimator.
37135  *
37136  * Users need to notify the new `ChannelManager` when a new block is connected or
37137  * disconnected using its [`block_connected`] and [`block_disconnected`] methods, starting
37138  * from after [`params.best_block.block_hash`]. See [`chain::Listen`] and [`chain::Confirm`] for
37139  * more details.
37140  *
37141  * [`block_connected`]: chain::Listen::block_connected
37142  * [`block_disconnected`]: chain::Listen::block_disconnected
37143  * [`params.best_block.block_hash`]: chain::BestBlock::block_hash
37144  */
37145 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);
37146
37147 /**
37148  * Gets the current configuration applied to all new channels.
37149  */
37150 MUST_USE_RES struct LDKUserConfig ChannelManager_get_current_default_configuration(const struct LDKChannelManager *NONNULL_PTR this_arg);
37151
37152 /**
37153  * Creates a new outbound channel to the given remote node and with the given value.
37154  *
37155  * `user_channel_id` will be provided back as in
37156  * [`Event::FundingGenerationReady::user_channel_id`] to allow tracking of which events
37157  * correspond with which `create_channel` call. Note that the `user_channel_id` defaults to a
37158  * randomized value for inbound channels. `user_channel_id` has no meaning inside of LDK, it
37159  * is simply copied to events and otherwise ignored.
37160  *
37161  * Raises [`APIError::APIMisuseError`] when `channel_value_satoshis` > 2**24 or `push_msat` is
37162  * greater than `channel_value_satoshis * 1k` or `channel_value_satoshis < 1000`.
37163  *
37164  * Raises [`APIError::ChannelUnavailable`] if the channel cannot be opened due to failing to
37165  * generate a shutdown scriptpubkey or destination script set by
37166  * [`SignerProvider::get_shutdown_scriptpubkey`] or [`SignerProvider::get_destination_script`].
37167  *
37168  * Note that we do not check if you are currently connected to the given peer. If no
37169  * connection is available, the outbound `open_channel` message may fail to send, resulting in
37170  * the channel eventually being silently forgotten (dropped on reload).
37171  *
37172  * If `temporary_channel_id` is specified, it will be used as the temporary channel ID of the
37173  * channel. Otherwise, a random one will be generated for you.
37174  *
37175  * Returns the new Channel's temporary `channel_id`. This ID will appear as
37176  * [`Event::FundingGenerationReady::temporary_channel_id`] and in
37177  * [`ChannelDetails::channel_id`] until after
37178  * [`ChannelManager::funding_transaction_generated`] is called, swapping the Channel's ID for
37179  * one derived from the funding transaction's TXID. If the counterparty rejects the channel
37180  * immediately, this temporary ID will appear in [`Event::ChannelClosed::channel_id`].
37181  *
37182  * [`Event::FundingGenerationReady::user_channel_id`]: events::Event::FundingGenerationReady::user_channel_id
37183  * [`Event::FundingGenerationReady::temporary_channel_id`]: events::Event::FundingGenerationReady::temporary_channel_id
37184  * [`Event::ChannelClosed::channel_id`]: events::Event::ChannelClosed::channel_id
37185  *
37186  * Note that temporary_channel_id (or a relevant inner pointer) may be NULL or all-0s to represent None
37187  * Note that override_config (or a relevant inner pointer) may be NULL or all-0s to represent None
37188  */
37189 MUST_USE_RES struct LDKCResult_ChannelIdAPIErrorZ 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 LDKChannelId temporary_channel_id, struct LDKUserConfig override_config);
37190
37191 /**
37192  * Gets the list of open channels, in random order. See [`ChannelDetails`] field documentation for
37193  * more information.
37194  */
37195 MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
37196
37197 /**
37198  * Gets the list of usable channels, in random order. Useful as an argument to
37199  * [`Router::find_route`] to ensure non-announced channels are used.
37200  *
37201  * These are guaranteed to have their [`ChannelDetails::is_usable`] value set to true, see the
37202  * documentation for [`ChannelDetails::is_usable`] for more info on exactly what the criteria
37203  * are.
37204  */
37205 MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_usable_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
37206
37207 /**
37208  * Gets the list of channels we have with a given counterparty, in random order.
37209  */
37210 MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_channels_with_counterparty(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKPublicKey counterparty_node_id);
37211
37212 /**
37213  * Returns in an undefined order recent payments that -- if not fulfilled -- have yet to find a
37214  * successful path, or have unresolved HTLCs.
37215  *
37216  * This can be useful for payments that may have been prepared, but ultimately not sent, as a
37217  * result of a crash. If such a payment exists, is not listed here, and an
37218  * [`Event::PaymentSent`] has not been received, you may consider resending the payment.
37219  *
37220  * [`Event::PaymentSent`]: events::Event::PaymentSent
37221  */
37222 MUST_USE_RES struct LDKCVec_RecentPaymentDetailsZ ChannelManager_list_recent_payments(const struct LDKChannelManager *NONNULL_PTR this_arg);
37223
37224 /**
37225  * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs
37226  * will be accepted on the given channel, and after additional timeout/the closing of all
37227  * pending HTLCs, the channel will be closed on chain.
37228  *
37229  *  * If we are the channel initiator, we will pay between our [`ChannelCloseMinimum`] and
37230  *    [`ChannelConfig::force_close_avoidance_max_fee_satoshis`] plus our [`NonAnchorChannelFee`]
37231  *    fee estimate.
37232  *  * If our counterparty is the channel initiator, we will require a channel closing
37233  *    transaction feerate of at least our [`ChannelCloseMinimum`] feerate or the feerate which
37234  *    would appear on a force-closure transaction, whichever is lower. We will allow our
37235  *    counterparty to pay as much fee as they'd like, however.
37236  *
37237  * May generate a [`SendShutdown`] message event on success, which should be relayed.
37238  *
37239  * Raises [`APIError::ChannelUnavailable`] if the channel cannot be closed due to failing to
37240  * generate a shutdown scriptpubkey or destination script set by
37241  * [`SignerProvider::get_shutdown_scriptpubkey`]. A force-closure may be needed to close the
37242  * channel.
37243  *
37244  * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]: crate::util::config::ChannelConfig::force_close_avoidance_max_fee_satoshis
37245  * [`ChannelCloseMinimum`]: crate::chain::chaininterface::ConfirmationTarget::ChannelCloseMinimum
37246  * [`NonAnchorChannelFee`]: crate::chain::chaininterface::ConfirmationTarget::NonAnchorChannelFee
37247  * [`SendShutdown`]: crate::events::MessageSendEvent::SendShutdown
37248  */
37249 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKChannelId *NONNULL_PTR channel_id, struct LDKPublicKey counterparty_node_id);
37250
37251 /**
37252  * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs
37253  * will be accepted on the given channel, and after additional timeout/the closing of all
37254  * pending HTLCs, the channel will be closed on chain.
37255  *
37256  * `target_feerate_sat_per_1000_weight` has different meanings depending on if we initiated
37257  * the channel being closed or not:
37258  *  * If we are the channel initiator, we will pay at least this feerate on the closing
37259  *    transaction. The upper-bound is set by
37260  *    [`ChannelConfig::force_close_avoidance_max_fee_satoshis`] plus our [`NonAnchorChannelFee`]
37261  *    fee estimate (or `target_feerate_sat_per_1000_weight`, if it is greater).
37262  *  * If our counterparty is the channel initiator, we will refuse to accept a channel closure
37263  *    transaction feerate below `target_feerate_sat_per_1000_weight` (or the feerate which
37264  *    will appear on a force-closure transaction, whichever is lower).
37265  *
37266  * The `shutdown_script` provided  will be used as the `scriptPubKey` for the closing transaction.
37267  * Will fail if a shutdown script has already been set for this channel by
37268  * ['ChannelHandshakeConfig::commit_upfront_shutdown_pubkey`]. The given shutdown script must
37269  * also be compatible with our and the counterparty's features.
37270  *
37271  * May generate a [`SendShutdown`] message event on success, which should be relayed.
37272  *
37273  * Raises [`APIError::ChannelUnavailable`] if the channel cannot be closed due to failing to
37274  * generate a shutdown scriptpubkey or destination script set by
37275  * [`SignerProvider::get_shutdown_scriptpubkey`]. A force-closure may be needed to close the
37276  * channel.
37277  *
37278  * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]: crate::util::config::ChannelConfig::force_close_avoidance_max_fee_satoshis
37279  * [`NonAnchorChannelFee`]: crate::chain::chaininterface::ConfirmationTarget::NonAnchorChannelFee
37280  * [`SendShutdown`]: crate::events::MessageSendEvent::SendShutdown
37281  *
37282  * Note that shutdown_script (or a relevant inner pointer) may be NULL or all-0s to represent None
37283  */
37284 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_close_channel_with_feerate_and_script(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKChannelId *NONNULL_PTR channel_id, struct LDKPublicKey counterparty_node_id, struct LDKCOption_u32Z target_feerate_sats_per_1000_weight, struct LDKShutdownScript shutdown_script);
37285
37286 /**
37287  * Force closes a channel, immediately broadcasting the latest local transaction(s) and
37288  * rejecting new HTLCs on the given channel. Fails if `channel_id` is unknown to
37289  * the manager, or if the `counterparty_node_id` isn't the counterparty of the corresponding
37290  * channel.
37291  */
37292 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_force_close_broadcasting_latest_txn(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKChannelId *NONNULL_PTR channel_id, struct LDKPublicKey counterparty_node_id);
37293
37294 /**
37295  * Force closes a channel, rejecting new HTLCs on the given channel but skips broadcasting
37296  * the latest local transaction(s). Fails if `channel_id` is unknown to the manager, or if the
37297  * `counterparty_node_id` isn't the counterparty of the corresponding channel.
37298  *
37299  * You can always broadcast the latest local transaction(s) via
37300  * [`ChannelMonitor::broadcast_latest_holder_commitment_txn`].
37301  */
37302 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_force_close_without_broadcasting_txn(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKChannelId *NONNULL_PTR channel_id, struct LDKPublicKey counterparty_node_id);
37303
37304 /**
37305  * Force close all channels, immediately broadcasting the latest local commitment transaction
37306  * for each to the chain and rejecting new HTLCs on each.
37307  */
37308 void ChannelManager_force_close_all_channels_broadcasting_latest_txn(const struct LDKChannelManager *NONNULL_PTR this_arg);
37309
37310 /**
37311  * Force close all channels rejecting new HTLCs on each but without broadcasting the latest
37312  * local transaction(s).
37313  */
37314 void ChannelManager_force_close_all_channels_without_broadcasting_txn(const struct LDKChannelManager *NONNULL_PTR this_arg);
37315
37316 /**
37317  * Sends a payment along a given route.
37318  *
37319  * Value parameters are provided via the last hop in route, see documentation for [`RouteHop`]
37320  * fields for more info.
37321  *
37322  * May generate [`UpdateHTLCs`] message(s) event on success, which should be relayed (e.g. via
37323  * [`PeerManager::process_events`]).
37324  *
37325  * # Avoiding Duplicate Payments
37326  *
37327  * If a pending payment is currently in-flight with the same [`PaymentId`] provided, this
37328  * method will error with an [`APIError::InvalidRoute`]. Note, however, that once a payment
37329  * is no longer pending (either via [`ChannelManager::abandon_payment`], or handling of an
37330  * [`Event::PaymentSent`] or [`Event::PaymentFailed`]) LDK will not stop you from sending a
37331  * second payment with the same [`PaymentId`].
37332  *
37333  * Thus, in order to ensure duplicate payments are not sent, you should implement your own
37334  * tracking of payments, including state to indicate once a payment has completed. Because you
37335  * should also ensure that [`PaymentHash`]es are not re-used, for simplicity, you should
37336  * consider using the [`PaymentHash`] as the key for tracking payments. In that case, the
37337  * [`PaymentId`] should be a copy of the [`PaymentHash`] bytes.
37338  *
37339  * Additionally, in the scenario where we begin the process of sending a payment, but crash
37340  * before `send_payment` returns (or prior to [`ChannelMonitorUpdate`] persistence if you're
37341  * using [`ChannelMonitorUpdateStatus::InProgress`]), the payment may be lost on restart. See
37342  * [`ChannelManager::list_recent_payments`] for more information.
37343  *
37344  * # Possible Error States on [`PaymentSendFailure`]
37345  *
37346  * Each path may have a different return value, and [`PaymentSendFailure`] may return a `Vec` with
37347  * each entry matching the corresponding-index entry in the route paths, see
37348  * [`PaymentSendFailure`] for more info.
37349  *
37350  * In general, a path may raise:
37351  *  * [`APIError::InvalidRoute`] when an invalid route or forwarding parameter (cltv_delta, fee,
37352  *    node public key) is specified.
37353  *  * [`APIError::ChannelUnavailable`] if the next-hop channel is not available as it has been
37354  *    closed, doesn't exist, or the peer is currently disconnected.
37355  *  * [`APIError::MonitorUpdateInProgress`] if a new monitor update failure prevented sending the
37356  *    relevant updates.
37357  *
37358  * Note that depending on the type of the [`PaymentSendFailure`] the HTLC may have been
37359  * irrevocably committed to on our end. In such a case, do NOT retry the payment with a
37360  * different route unless you intend to pay twice!
37361  *
37362  * [`RouteHop`]: crate::routing::router::RouteHop
37363  * [`Event::PaymentSent`]: events::Event::PaymentSent
37364  * [`Event::PaymentFailed`]: events::Event::PaymentFailed
37365  * [`UpdateHTLCs`]: events::MessageSendEvent::UpdateHTLCs
37366  * [`PeerManager::process_events`]: crate::ln::peer_handler::PeerManager::process_events
37367  * [`ChannelMonitorUpdateStatus::InProgress`]: crate::chain::ChannelMonitorUpdateStatus::InProgress
37368  */
37369 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);
37370
37371 /**
37372  * Similar to [`ChannelManager::send_payment_with_route`], but will automatically find a route based on
37373  * `route_params` and retry failed payment paths based on `retry_strategy`.
37374  */
37375 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);
37376
37377 /**
37378  * Signals that no further attempts for the given payment should occur. Useful if you have a
37379  * pending outbound payment with retries remaining, but wish to stop retrying the payment before
37380  * retries are exhausted.
37381  *
37382  * # Event Generation
37383  *
37384  * If no [`Event::PaymentFailed`] event had been generated before, one will be generated as soon
37385  * as there are no remaining pending HTLCs for this payment.
37386  *
37387  * Note that calling this method does *not* prevent a payment from succeeding. You must still
37388  * wait until you receive either a [`Event::PaymentFailed`] or [`Event::PaymentSent`] event to
37389  * determine the ultimate status of a payment.
37390  *
37391  * # Requested Invoices
37392  *
37393  * In the case of paying a [`Bolt12Invoice`] via [`ChannelManager::pay_for_offer`], abandoning
37394  * the payment prior to receiving the invoice will result in an [`Event::InvoiceRequestFailed`]
37395  * and prevent any attempts at paying it once received. The other events may only be generated
37396  * once the invoice has been received.
37397  *
37398  * # Restart Behavior
37399  *
37400  * If an [`Event::PaymentFailed`] is generated and we restart without first persisting the
37401  * [`ChannelManager`], another [`Event::PaymentFailed`] may be generated; likewise for
37402  * [`Event::InvoiceRequestFailed`].
37403  *
37404  * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
37405  */
37406 void ChannelManager_abandon_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_id);
37407
37408 /**
37409  * Send a spontaneous payment, which is a payment that does not require the recipient to have
37410  * generated an invoice. Optionally, you may specify the preimage. If you do choose to specify
37411  * the preimage, it must be a cryptographically secure random value that no intermediate node
37412  * would be able to guess -- otherwise, an intermediate node may claim the payment and it will
37413  * never reach the recipient.
37414  *
37415  * See [`send_payment`] documentation for more details on the return value of this function
37416  * and idempotency guarantees provided by the [`PaymentId`] key.
37417  *
37418  * Similar to regular payments, you MUST NOT reuse a `payment_preimage` value. See
37419  * [`send_payment`] for more information about the risks of duplicate preimage usage.
37420  *
37421  * [`send_payment`]: Self::send_payment
37422  */
37423 MUST_USE_RES struct LDKCResult_ThirtyTwoBytesPaymentSendFailureZ ChannelManager_send_spontaneous_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKCOption_ThirtyTwoBytesZ payment_preimage, struct LDKRecipientOnionFields recipient_onion, struct LDKThirtyTwoBytes payment_id);
37424
37425 /**
37426  * Similar to [`ChannelManager::send_spontaneous_payment`], but will automatically find a route
37427  * based on `route_params` and retry failed payment paths based on `retry_strategy`.
37428  *
37429  * See [`PaymentParameters::for_keysend`] for help in constructing `route_params` for spontaneous
37430  * payments.
37431  *
37432  * [`PaymentParameters::for_keysend`]: crate::routing::router::PaymentParameters::for_keysend
37433  */
37434 MUST_USE_RES struct LDKCResult_ThirtyTwoBytesRetryableSendFailureZ ChannelManager_send_spontaneous_payment_with_retry(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKCOption_ThirtyTwoBytesZ payment_preimage, struct LDKRecipientOnionFields recipient_onion, struct LDKThirtyTwoBytes payment_id, struct LDKRouteParameters route_params, struct LDKRetry retry_strategy);
37435
37436 /**
37437  * Send a payment that is probing the given route for liquidity. We calculate the
37438  * [`PaymentHash`] of probes based on a static secret and a random [`PaymentId`], which allows
37439  * us to easily discern them from real payments.
37440  */
37441 MUST_USE_RES struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ ChannelManager_send_probe(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKPath path);
37442
37443 /**
37444  * Sends payment probes over all paths of a route that would be used to pay the given
37445  * amount to the given `node_id`.
37446  *
37447  * See [`ChannelManager::send_preflight_probes`] for more information.
37448  */
37449 MUST_USE_RES struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ ChannelManager_send_spontaneous_preflight_probes(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKPublicKey node_id, uint64_t amount_msat, uint32_t final_cltv_expiry_delta, struct LDKCOption_u64Z liquidity_limit_multiplier);
37450
37451 /**
37452  * Sends payment probes over all paths of a route that would be used to pay a route found
37453  * according to the given [`RouteParameters`].
37454  *
37455  * This may be used to send \"pre-flight\" probes, i.e., to train our scorer before conducting
37456  * the actual payment. Note this is only useful if there likely is sufficient time for the
37457  * probe to settle before sending out the actual payment, e.g., when waiting for user
37458  * confirmation in a wallet UI.
37459  *
37460  * Otherwise, there is a chance the probe could take up some liquidity needed to complete the
37461  * actual payment. Users should therefore be cautious and might avoid sending probes if
37462  * liquidity is scarce and/or they don't expect the probe to return before they send the
37463  * payment. To mitigate this issue, channels with available liquidity less than the required
37464  * amount times the given `liquidity_limit_multiplier` won't be used to send pre-flight
37465  * probes. If `None` is given as `liquidity_limit_multiplier`, it defaults to `3`.
37466  */
37467 MUST_USE_RES struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ ChannelManager_send_preflight_probes(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKRouteParameters route_params, struct LDKCOption_u64Z liquidity_limit_multiplier);
37468
37469 /**
37470  * Call this upon creation of a funding transaction for the given channel.
37471  *
37472  * Returns an [`APIError::APIMisuseError`] if the funding_transaction spent non-SegWit outputs
37473  * or if no output was found which matches the parameters in [`Event::FundingGenerationReady`].
37474  *
37475  * Returns [`APIError::APIMisuseError`] if the funding transaction is not final for propagation
37476  * across the p2p network.
37477  *
37478  * Returns [`APIError::ChannelUnavailable`] if a funding transaction has already been provided
37479  * for the channel or if the channel has been closed as indicated by [`Event::ChannelClosed`].
37480  *
37481  * May panic if the output found in the funding transaction is duplicative with some other
37482  * channel (note that this should be trivially prevented by using unique funding transaction
37483  * keys per-channel).
37484  *
37485  * Do NOT broadcast the funding transaction yourself. When we have safely received our
37486  * counterparty's signature the funding transaction will automatically be broadcast via the
37487  * [`BroadcasterInterface`] provided when this `ChannelManager` was constructed.
37488  *
37489  * Note that this includes RBF or similar transaction replacement strategies - lightning does
37490  * not currently support replacing a funding transaction on an existing channel. Instead,
37491  * create a new channel with a conflicting funding transaction.
37492  *
37493  * Note to keep the miner incentives aligned in moving the blockchain forward, we recommend
37494  * the wallet software generating the funding transaction to apply anti-fee sniping as
37495  * implemented by Bitcoin Core wallet. See <https://bitcoinops.org/en/topics/fee-sniping/>
37496  * for more details.
37497  *
37498  * [`Event::FundingGenerationReady`]: crate::events::Event::FundingGenerationReady
37499  * [`Event::ChannelClosed`]: crate::events::Event::ChannelClosed
37500  */
37501 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_funding_transaction_generated(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKChannelId *NONNULL_PTR temporary_channel_id, struct LDKPublicKey counterparty_node_id, struct LDKTransaction funding_transaction);
37502
37503 /**
37504  * Call this upon creation of a batch funding transaction for the given channels.
37505  *
37506  * Return values are identical to [`Self::funding_transaction_generated`], respective to
37507  * each individual channel and transaction output.
37508  *
37509  * Do NOT broadcast the funding transaction yourself. This batch funding transaction
37510  * will only be broadcast when we have safely received and persisted the counterparty's
37511  * signature for each channel.
37512  *
37513  * If there is an error, all channels in the batch are to be considered closed.
37514  */
37515 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_batch_funding_transaction_generated(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKCVec_C2Tuple_ChannelIdPublicKeyZZ temporary_channels, struct LDKTransaction funding_transaction);
37516
37517 /**
37518  * Atomically applies partial updates to the [`ChannelConfig`] of the given channels.
37519  *
37520  * Once the updates are applied, each eligible channel (advertised with a known short channel
37521  * ID and a change in [`forwarding_fee_proportional_millionths`], [`forwarding_fee_base_msat`],
37522  * or [`cltv_expiry_delta`]) has a [`BroadcastChannelUpdate`] event message generated
37523  * containing the new [`ChannelUpdate`] message which should be broadcast to the network.
37524  *
37525  * Returns [`ChannelUnavailable`] when a channel is not found or an incorrect
37526  * `counterparty_node_id` is provided.
37527  *
37528  * Returns [`APIMisuseError`] when a [`cltv_expiry_delta`] update is to be applied with a value
37529  * below [`MIN_CLTV_EXPIRY_DELTA`].
37530  *
37531  * If an error is returned, none of the updates should be considered applied.
37532  *
37533  * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths
37534  * [`forwarding_fee_base_msat`]: ChannelConfig::forwarding_fee_base_msat
37535  * [`cltv_expiry_delta`]: ChannelConfig::cltv_expiry_delta
37536  * [`BroadcastChannelUpdate`]: events::MessageSendEvent::BroadcastChannelUpdate
37537  * [`ChannelUpdate`]: msgs::ChannelUpdate
37538  * [`ChannelUnavailable`]: APIError::ChannelUnavailable
37539  * [`APIMisuseError`]: APIError::APIMisuseError
37540  */
37541 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_ChannelIdZ channel_ids, const struct LDKChannelConfigUpdate *NONNULL_PTR config_update);
37542
37543 /**
37544  * Atomically updates the [`ChannelConfig`] for the given channels.
37545  *
37546  * Once the updates are applied, each eligible channel (advertised with a known short channel
37547  * ID and a change in [`forwarding_fee_proportional_millionths`], [`forwarding_fee_base_msat`],
37548  * or [`cltv_expiry_delta`]) has a [`BroadcastChannelUpdate`] event message generated
37549  * containing the new [`ChannelUpdate`] message which should be broadcast to the network.
37550  *
37551  * Returns [`ChannelUnavailable`] when a channel is not found or an incorrect
37552  * `counterparty_node_id` is provided.
37553  *
37554  * Returns [`APIMisuseError`] when a [`cltv_expiry_delta`] update is to be applied with a value
37555  * below [`MIN_CLTV_EXPIRY_DELTA`].
37556  *
37557  * If an error is returned, none of the updates should be considered applied.
37558  *
37559  * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths
37560  * [`forwarding_fee_base_msat`]: ChannelConfig::forwarding_fee_base_msat
37561  * [`cltv_expiry_delta`]: ChannelConfig::cltv_expiry_delta
37562  * [`BroadcastChannelUpdate`]: events::MessageSendEvent::BroadcastChannelUpdate
37563  * [`ChannelUpdate`]: msgs::ChannelUpdate
37564  * [`ChannelUnavailable`]: APIError::ChannelUnavailable
37565  * [`APIMisuseError`]: APIError::APIMisuseError
37566  */
37567 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_update_channel_config(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKPublicKey counterparty_node_id, struct LDKCVec_ChannelIdZ channel_ids, const struct LDKChannelConfig *NONNULL_PTR config);
37568
37569 /**
37570  * Attempts to forward an intercepted HTLC over the provided channel id and with the provided
37571  * amount to forward. Should only be called in response to an [`HTLCIntercepted`] event.
37572  *
37573  * Intercepted HTLCs can be useful for Lightning Service Providers (LSPs) to open a just-in-time
37574  * channel to a receiving node if the node lacks sufficient inbound liquidity.
37575  *
37576  * To make use of intercepted HTLCs, set [`UserConfig::accept_intercept_htlcs`] and use
37577  * [`ChannelManager::get_intercept_scid`] to generate short channel id(s) to put in the
37578  * receiver's invoice route hints. These route hints will signal to LDK to generate an
37579  * [`HTLCIntercepted`] event when it receives the forwarded HTLC, and this method or
37580  * [`ChannelManager::fail_intercepted_htlc`] MUST be called in response to the event.
37581  *
37582  * Note that LDK does not enforce fee requirements in `amt_to_forward_msat`, and will not stop
37583  * you from forwarding more than you received. See
37584  * [`HTLCIntercepted::expected_outbound_amount_msat`] for more on forwarding a different amount
37585  * than expected.
37586  *
37587  * Errors if the event was not handled in time, in which case the HTLC was automatically failed
37588  * backwards.
37589  *
37590  * [`UserConfig::accept_intercept_htlcs`]: crate::util::config::UserConfig::accept_intercept_htlcs
37591  * [`HTLCIntercepted`]: events::Event::HTLCIntercepted
37592  * [`HTLCIntercepted::expected_outbound_amount_msat`]: events::Event::HTLCIntercepted::expected_outbound_amount_msat
37593  */
37594 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_forward_intercepted_htlc(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes intercept_id, const struct LDKChannelId *NONNULL_PTR next_hop_channel_id, struct LDKPublicKey next_node_id, uint64_t amt_to_forward_msat);
37595
37596 /**
37597  * Fails the intercepted HTLC indicated by intercept_id. Should only be called in response to
37598  * an [`HTLCIntercepted`] event. See [`ChannelManager::forward_intercepted_htlc`].
37599  *
37600  * Errors if the event was not handled in time, in which case the HTLC was automatically failed
37601  * backwards.
37602  *
37603  * [`HTLCIntercepted`]: events::Event::HTLCIntercepted
37604  */
37605 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_fail_intercepted_htlc(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes intercept_id);
37606
37607 /**
37608  * Processes HTLCs which are pending waiting on random forward delay.
37609  *
37610  * Should only really ever be called in response to a PendingHTLCsForwardable event.
37611  * Will likely generate further events.
37612  */
37613 void ChannelManager_process_pending_htlc_forwards(const struct LDKChannelManager *NONNULL_PTR this_arg);
37614
37615 /**
37616  * Performs actions which should happen on startup and roughly once per minute thereafter.
37617  *
37618  * This currently includes:
37619  *  * Increasing or decreasing the on-chain feerate estimates for our outbound channels,
37620  *  * Broadcasting [`ChannelUpdate`] messages if we've been disconnected from our peer for more
37621  *    than a minute, informing the network that they should no longer attempt to route over
37622  *    the channel.
37623  *  * Expiring a channel's previous [`ChannelConfig`] if necessary to only allow forwarding HTLCs
37624  *    with the current [`ChannelConfig`].
37625  *  * Removing peers which have disconnected but and no longer have any channels.
37626  *  * Force-closing and removing channels which have not completed establishment in a timely manner.
37627  *  * Forgetting about stale outbound payments, either those that have already been fulfilled
37628  *    or those awaiting an invoice that hasn't been delivered in the necessary amount of time.
37629  *    The latter is determined using the system clock in `std` and the highest seen block time
37630  *    minus two hours in `no-std`.
37631  *
37632  * Note that this may cause reentrancy through [`chain::Watch::update_channel`] calls or feerate
37633  * estimate fetches.
37634  *
37635  * [`ChannelUpdate`]: msgs::ChannelUpdate
37636  * [`ChannelConfig`]: crate::util::config::ChannelConfig
37637  */
37638 void ChannelManager_timer_tick_occurred(const struct LDKChannelManager *NONNULL_PTR this_arg);
37639
37640 /**
37641  * Indicates that the preimage for payment_hash is unknown or the received amount is incorrect
37642  * after a PaymentClaimable event, failing the HTLC back to its origin and freeing resources
37643  * along the path (including in our own channel on which we received it).
37644  *
37645  * Note that in some cases around unclean shutdown, it is possible the payment may have
37646  * already been claimed by you via [`ChannelManager::claim_funds`] prior to you seeing (a
37647  * second copy of) the [`events::Event::PaymentClaimable`] event. Alternatively, the payment
37648  * may have already been failed automatically by LDK if it was nearing its expiration time.
37649  *
37650  * While LDK will never claim a payment automatically on your behalf (i.e. without you calling
37651  * [`ChannelManager::claim_funds`]), you should still monitor for
37652  * [`events::Event::PaymentClaimed`] events even for payments you intend to fail, especially on
37653  * startup during which time claims that were in-progress at shutdown may be replayed.
37654  */
37655 void ChannelManager_fail_htlc_backwards(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32]);
37656
37657 /**
37658  * This is a variant of [`ChannelManager::fail_htlc_backwards`] that allows you to specify the
37659  * reason for the failure.
37660  *
37661  * See [`FailureCode`] for valid failure codes.
37662  */
37663 void ChannelManager_fail_htlc_backwards_with_reason(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32], struct LDKFailureCode failure_code);
37664
37665 /**
37666  * Provides a payment preimage in response to [`Event::PaymentClaimable`], generating any
37667  * [`MessageSendEvent`]s needed to claim the payment.
37668  *
37669  * This method is guaranteed to ensure the payment has been claimed but only if the current
37670  * height is strictly below [`Event::PaymentClaimable::claim_deadline`]. To avoid race
37671  * conditions, you should wait for an [`Event::PaymentClaimed`] before considering the payment
37672  * successful. It will generally be available in the next [`process_pending_events`] call.
37673  *
37674  * Note that if you did not set an `amount_msat` when calling [`create_inbound_payment`] or
37675  * [`create_inbound_payment_for_hash`] you must check that the amount in the `PaymentClaimable`
37676  * event matches your expectation. If you fail to do so and call this method, you may provide
37677  * the sender \"proof-of-payment\" when they did not fulfill the full expected payment.
37678  *
37679  * This function will fail the payment if it has custom TLVs with even type numbers, as we
37680  * will assume they are unknown. If you intend to accept even custom TLVs, you should use
37681  * [`claim_funds_with_known_custom_tlvs`].
37682  *
37683  * [`Event::PaymentClaimable`]: crate::events::Event::PaymentClaimable
37684  * [`Event::PaymentClaimable::claim_deadline`]: crate::events::Event::PaymentClaimable::claim_deadline
37685  * [`Event::PaymentClaimed`]: crate::events::Event::PaymentClaimed
37686  * [`process_pending_events`]: EventsProvider::process_pending_events
37687  * [`create_inbound_payment`]: Self::create_inbound_payment
37688  * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
37689  * [`claim_funds_with_known_custom_tlvs`]: Self::claim_funds_with_known_custom_tlvs
37690  */
37691 void ChannelManager_claim_funds(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_preimage);
37692
37693 /**
37694  * This is a variant of [`claim_funds`] that allows accepting a payment with custom TLVs with
37695  * even type numbers.
37696  *
37697  * # Note
37698  *
37699  * You MUST check you've understood all even TLVs before using this to
37700  * claim, otherwise you may unintentionally agree to some protocol you do not understand.
37701  *
37702  * [`claim_funds`]: Self::claim_funds
37703  */
37704 void ChannelManager_claim_funds_with_known_custom_tlvs(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_preimage);
37705
37706 /**
37707  * Gets the node_id held by this ChannelManager
37708  */
37709 MUST_USE_RES struct LDKPublicKey ChannelManager_get_our_node_id(const struct LDKChannelManager *NONNULL_PTR this_arg);
37710
37711 /**
37712  * Accepts a request to open a channel after a [`Event::OpenChannelRequest`].
37713  *
37714  * The `temporary_channel_id` parameter indicates which inbound channel should be accepted,
37715  * and the `counterparty_node_id` parameter is the id of the peer which has requested to open
37716  * the channel.
37717  *
37718  * The `user_channel_id` parameter will be provided back in
37719  * [`Event::ChannelClosed::user_channel_id`] to allow tracking of which events correspond
37720  * with which `accept_inbound_channel`/`accept_inbound_channel_from_trusted_peer_0conf` call.
37721  *
37722  * Note that this method will return an error and reject the channel, if it requires support
37723  * for zero confirmations. Instead, `accept_inbound_channel_from_trusted_peer_0conf` must be
37724  * used to accept such channels.
37725  *
37726  * [`Event::OpenChannelRequest`]: events::Event::OpenChannelRequest
37727  * [`Event::ChannelClosed::user_channel_id`]: events::Event::ChannelClosed::user_channel_id
37728  */
37729 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_accept_inbound_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKChannelId *NONNULL_PTR temporary_channel_id, struct LDKPublicKey counterparty_node_id, struct LDKU128 user_channel_id);
37730
37731 /**
37732  * Accepts a request to open a channel after a [`events::Event::OpenChannelRequest`], treating
37733  * it as confirmed immediately.
37734  *
37735  * The `user_channel_id` parameter will be provided back in
37736  * [`Event::ChannelClosed::user_channel_id`] to allow tracking of which events correspond
37737  * with which `accept_inbound_channel`/`accept_inbound_channel_from_trusted_peer_0conf` call.
37738  *
37739  * Unlike [`ChannelManager::accept_inbound_channel`], this method accepts the incoming channel
37740  * and (if the counterparty agrees), enables forwarding of payments immediately.
37741  *
37742  * This fully trusts that the counterparty has honestly and correctly constructed the funding
37743  * transaction and blindly assumes that it will eventually confirm.
37744  *
37745  * If it does not confirm before we decide to close the channel, or if the funding transaction
37746  * does not pay to the correct script the correct amount, *you will lose funds*.
37747  *
37748  * [`Event::OpenChannelRequest`]: events::Event::OpenChannelRequest
37749  * [`Event::ChannelClosed::user_channel_id`]: events::Event::ChannelClosed::user_channel_id
37750  */
37751 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_accept_inbound_channel_from_trusted_peer_0conf(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKChannelId *NONNULL_PTR temporary_channel_id, struct LDKPublicKey counterparty_node_id, struct LDKU128 user_channel_id);
37752
37753 /**
37754  * Creates an [`OfferBuilder`] such that the [`Offer`] it builds is recognized by the
37755  * [`ChannelManager`] when handling [`InvoiceRequest`] messages for the offer. The offer will
37756  * not have an expiration unless otherwise set on the builder.
37757  *
37758  * # Privacy
37759  *
37760  * Uses [`MessageRouter::create_blinded_paths`] to construct a [`BlindedPath`] for the offer.
37761  * However, if one is not found, uses a one-hop [`BlindedPath`] with
37762  * [`ChannelManager::get_our_node_id`] as the introduction node instead. In the latter case,
37763  * the node must be announced, otherwise, there is no way to find a path to the introduction in
37764  * order to send the [`InvoiceRequest`].
37765  *
37766  * Also, uses a derived signing pubkey in the offer for recipient privacy.
37767  *
37768  * # Limitations
37769  *
37770  * Requires a direct connection to the introduction node in the responding [`InvoiceRequest`]'s
37771  * reply path.
37772  *
37773  * # Errors
37774  *
37775  * Errors if the parameterized [`Router`] is unable to create a blinded path for the offer.
37776  *
37777  * [`Offer`]: crate::offers::offer::Offer
37778  * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
37779  */
37780 MUST_USE_RES struct LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ ChannelManager_create_offer_builder(const struct LDKChannelManager *NONNULL_PTR this_arg);
37781
37782 /**
37783  * Creates a [`RefundBuilder`] such that the [`Refund`] it builds is recognized by the
37784  * [`ChannelManager`] when handling [`Bolt12Invoice`] messages for the refund.
37785  *
37786  * # Payment
37787  *
37788  * The provided `payment_id` is used to ensure that only one invoice is paid for the refund.
37789  * See [Avoiding Duplicate Payments] for other requirements once the payment has been sent.
37790  *
37791  * The builder will have the provided expiration set. Any changes to the expiration on the
37792  * returned builder will not be honored by [`ChannelManager`]. For `no-std`, the highest seen
37793  * block time minus two hours is used for the current time when determining if the refund has
37794  * expired.
37795  *
37796  * To revoke the refund, use [`ChannelManager::abandon_payment`] prior to receiving the
37797  * invoice. If abandoned, or an invoice isn't received before expiration, the payment will fail
37798  * with an [`Event::InvoiceRequestFailed`].
37799  *
37800  * If `max_total_routing_fee_msat` is not specified, The default from
37801  * [`RouteParameters::from_payment_params_and_value`] is applied.
37802  *
37803  * # Privacy
37804  *
37805  * Uses [`MessageRouter::create_blinded_paths`] to construct a [`BlindedPath`] for the refund.
37806  * However, if one is not found, uses a one-hop [`BlindedPath`] with
37807  * [`ChannelManager::get_our_node_id`] as the introduction node instead. In the latter case,
37808  * the node must be announced, otherwise, there is no way to find a path to the introduction in
37809  * order to send the [`Bolt12Invoice`].
37810  *
37811  * Also, uses a derived payer id in the refund for payer privacy.
37812  *
37813  * # Limitations
37814  *
37815  * Requires a direct connection to an introduction node in the responding
37816  * [`Bolt12Invoice::payment_paths`].
37817  *
37818  * # Errors
37819  *
37820  * Errors if:
37821  * - a duplicate `payment_id` is provided given the caveats in the aforementioned link,
37822  * - `amount_msats` is invalid, or
37823  * - the parameterized [`Router`] is unable to create a blinded path for the refund.
37824  *
37825  * [`Refund`]: crate::offers::refund::Refund
37826  * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
37827  * [`Bolt12Invoice::payment_paths`]: crate::offers::invoice::Bolt12Invoice::payment_paths
37828  * [Avoiding Duplicate Payments]: #avoiding-duplicate-payments
37829  */
37830 MUST_USE_RES struct LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ ChannelManager_create_refund_builder(const struct LDKChannelManager *NONNULL_PTR this_arg, uint64_t amount_msats, uint64_t absolute_expiry, struct LDKThirtyTwoBytes payment_id, struct LDKRetry retry_strategy, struct LDKCOption_u64Z max_total_routing_fee_msat);
37831
37832 /**
37833  * Pays for an [`Offer`] using the given parameters by creating an [`InvoiceRequest`] and
37834  * enqueuing it to be sent via an onion message. [`ChannelManager`] will pay the actual
37835  * [`Bolt12Invoice`] once it is received.
37836  *
37837  * Uses [`InvoiceRequestBuilder`] such that the [`InvoiceRequest`] it builds is recognized by
37838  * the [`ChannelManager`] when handling a [`Bolt12Invoice`] message in response to the request.
37839  * The optional parameters are used in the builder, if `Some`:
37840  * - `quantity` for [`InvoiceRequest::quantity`] which must be set if
37841  *   [`Offer::expects_quantity`] is `true`.
37842  * - `amount_msats` if overpaying what is required for the given `quantity` is desired, and
37843  * - `payer_note` for [`InvoiceRequest::payer_note`].
37844  *
37845  * If `max_total_routing_fee_msat` is not specified, The default from
37846  * [`RouteParameters::from_payment_params_and_value`] is applied.
37847  *
37848  * # Payment
37849  *
37850  * The provided `payment_id` is used to ensure that only one invoice is paid for the request
37851  * when received. See [Avoiding Duplicate Payments] for other requirements once the payment has
37852  * been sent.
37853  *
37854  * To revoke the request, use [`ChannelManager::abandon_payment`] prior to receiving the
37855  * invoice. If abandoned, or an invoice isn't received in a reasonable amount of time, the
37856  * payment will fail with an [`Event::InvoiceRequestFailed`].
37857  *
37858  * # Privacy
37859  *
37860  * Uses a one-hop [`BlindedPath`] for the reply path with [`ChannelManager::get_our_node_id`]
37861  * as the introduction node and a derived payer id for payer privacy. As such, currently, the
37862  * node must be announced. Otherwise, there is no way to find a path to the introduction node
37863  * in order to send the [`Bolt12Invoice`].
37864  *
37865  * # Limitations
37866  *
37867  * Requires a direct connection to an introduction node in [`Offer::paths`] or to
37868  * [`Offer::signing_pubkey`], if empty. A similar restriction applies to the responding
37869  * [`Bolt12Invoice::payment_paths`].
37870  *
37871  * # Errors
37872  *
37873  * Errors if:
37874  * - a duplicate `payment_id` is provided given the caveats in the aforementioned link,
37875  * - the provided parameters are invalid for the offer,
37876  * - the offer is for an unsupported chain, or
37877  * - the parameterized [`Router`] is unable to create a blinded reply path for the invoice
37878  *   request.
37879  *
37880  * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
37881  * [`InvoiceRequest::quantity`]: crate::offers::invoice_request::InvoiceRequest::quantity
37882  * [`InvoiceRequest::payer_note`]: crate::offers::invoice_request::InvoiceRequest::payer_note
37883  * [`InvoiceRequestBuilder`]: crate::offers::invoice_request::InvoiceRequestBuilder
37884  * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
37885  * [`Bolt12Invoice::payment_paths`]: crate::offers::invoice::Bolt12Invoice::payment_paths
37886  * [Avoiding Duplicate Payments]: #avoiding-duplicate-payments
37887  */
37888 MUST_USE_RES struct LDKCResult_NoneBolt12SemanticErrorZ ChannelManager_pay_for_offer(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKOffer *NONNULL_PTR offer, struct LDKCOption_u64Z quantity, struct LDKCOption_u64Z amount_msats, struct LDKCOption_StrZ payer_note, struct LDKThirtyTwoBytes payment_id, struct LDKRetry retry_strategy, struct LDKCOption_u64Z max_total_routing_fee_msat);
37889
37890 /**
37891  * Creates a [`Bolt12Invoice`] for a [`Refund`] and enqueues it to be sent via an onion
37892  * message.
37893  *
37894  * The resulting invoice uses a [`PaymentHash`] recognized by the [`ChannelManager`] and a
37895  * [`BlindedPath`] containing the [`PaymentSecret`] needed to reconstruct the corresponding
37896  * [`PaymentPreimage`]. It is returned purely for informational purposes.
37897  *
37898  * # Limitations
37899  *
37900  * Requires a direct connection to an introduction node in [`Refund::paths`] or to
37901  * [`Refund::payer_id`], if empty. This request is best effort; an invoice will be sent to each
37902  * node meeting the aforementioned criteria, but there's no guarantee that they will be
37903  * received and no retries will be made.
37904  *
37905  * # Errors
37906  *
37907  * Errors if:
37908  * - the refund is for an unsupported chain, or
37909  * - the parameterized [`Router`] is unable to create a blinded payment path or reply path for
37910  *   the invoice.
37911  *
37912  * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
37913  */
37914 MUST_USE_RES struct LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ ChannelManager_request_refund_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRefund *NONNULL_PTR refund);
37915
37916 /**
37917  * Gets a payment secret and payment hash for use in an invoice given to a third party wishing
37918  * to pay us.
37919  *
37920  * This differs from [`create_inbound_payment_for_hash`] only in that it generates the
37921  * [`PaymentHash`] and [`PaymentPreimage`] for you.
37922  *
37923  * The [`PaymentPreimage`] will ultimately be returned to you in the [`PaymentClaimable`] event, which
37924  * will have the [`PaymentClaimable::purpose`] return `Some` for [`PaymentPurpose::preimage`]. That
37925  * should then be passed directly to [`claim_funds`].
37926  *
37927  * See [`create_inbound_payment_for_hash`] for detailed documentation on behavior and requirements.
37928  *
37929  * Note that a malicious eavesdropper can intuit whether an inbound payment was created by
37930  * `create_inbound_payment` or `create_inbound_payment_for_hash` based on runtime.
37931  *
37932  * # Note
37933  *
37934  * If you register an inbound payment with this method, then serialize the `ChannelManager`, then
37935  * deserialize it with a node running 0.0.103 and earlier, the payment will fail to be received.
37936  *
37937  * Errors if `min_value_msat` is greater than total bitcoin supply.
37938  *
37939  * If `min_final_cltv_expiry_delta` is set to some value, then the payment will not be receivable
37940  * on versions of LDK prior to 0.0.114.
37941  *
37942  * [`claim_funds`]: Self::claim_funds
37943  * [`PaymentClaimable`]: events::Event::PaymentClaimable
37944  * [`PaymentClaimable::purpose`]: events::Event::PaymentClaimable::purpose
37945  * [`PaymentPurpose::preimage`]: events::PaymentPurpose::preimage
37946  * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
37947  */
37948 MUST_USE_RES struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ 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);
37949
37950 /**
37951  * Gets a [`PaymentSecret`] for a given [`PaymentHash`], for which the payment preimage is
37952  * stored external to LDK.
37953  *
37954  * A [`PaymentClaimable`] event will only be generated if the [`PaymentSecret`] matches a
37955  * payment secret fetched via this method or [`create_inbound_payment`], and which is at least
37956  * the `min_value_msat` provided here, if one is provided.
37957  *
37958  * The [`PaymentHash`] (and corresponding [`PaymentPreimage`]) should be globally unique, though
37959  * note that LDK will not stop you from registering duplicate payment hashes for inbound
37960  * payments.
37961  *
37962  * `min_value_msat` should be set if the invoice being generated contains a value. Any payment
37963  * received for the returned [`PaymentHash`] will be required to be at least `min_value_msat`
37964  * before a [`PaymentClaimable`] event will be generated, ensuring that we do not provide the
37965  * sender \"proof-of-payment\" unless they have paid the required amount.
37966  *
37967  * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
37968  * in excess of the current time. This should roughly match the expiry time set in the invoice.
37969  * After this many seconds, we will remove the inbound payment, resulting in any attempts to
37970  * pay the invoice failing. The BOLT spec suggests 3,600 secs as a default validity time for
37971  * invoices when no timeout is set.
37972  *
37973  * Note that we use block header time to time-out pending inbound payments (with some margin
37974  * to compensate for the inaccuracy of block header timestamps). Thus, in practice we will
37975  * accept a payment and generate a [`PaymentClaimable`] event for some time after the expiry.
37976  * If you need exact expiry semantics, you should enforce them upon receipt of
37977  * [`PaymentClaimable`].
37978  *
37979  * Note that invoices generated for inbound payments should have their `min_final_cltv_expiry_delta`
37980  * set to at least [`MIN_FINAL_CLTV_EXPIRY_DELTA`].
37981  *
37982  * Note that a malicious eavesdropper can intuit whether an inbound payment was created by
37983  * `create_inbound_payment` or `create_inbound_payment_for_hash` based on runtime.
37984  *
37985  * # Note
37986  *
37987  * If you register an inbound payment with this method, then serialize the `ChannelManager`, then
37988  * deserialize it with a node running 0.0.103 and earlier, the payment will fail to be received.
37989  *
37990  * Errors if `min_value_msat` is greater than total bitcoin supply.
37991  *
37992  * If `min_final_cltv_expiry_delta` is set to some value, then the payment will not be receivable
37993  * on versions of LDK prior to 0.0.114.
37994  *
37995  * [`create_inbound_payment`]: Self::create_inbound_payment
37996  * [`PaymentClaimable`]: events::Event::PaymentClaimable
37997  */
37998 MUST_USE_RES struct LDKCResult_ThirtyTwoBytesNoneZ 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);
37999
38000 /**
38001  * Gets an LDK-generated payment preimage from a payment hash and payment secret that were
38002  * previously returned from [`create_inbound_payment`].
38003  *
38004  * [`create_inbound_payment`]: Self::create_inbound_payment
38005  */
38006 MUST_USE_RES struct LDKCResult_ThirtyTwoBytesAPIErrorZ ChannelManager_get_payment_preimage(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret);
38007
38008 /**
38009  * Gets a fake short channel id for use in receiving [phantom node payments]. These fake scids
38010  * are used when constructing the phantom invoice's route hints.
38011  *
38012  * [phantom node payments]: crate::sign::PhantomKeysManager
38013  */
38014 MUST_USE_RES uint64_t ChannelManager_get_phantom_scid(const struct LDKChannelManager *NONNULL_PTR this_arg);
38015
38016 /**
38017  * Gets route hints for use in receiving [phantom node payments].
38018  *
38019  * [phantom node payments]: crate::sign::PhantomKeysManager
38020  */
38021 MUST_USE_RES struct LDKPhantomRouteHints ChannelManager_get_phantom_route_hints(const struct LDKChannelManager *NONNULL_PTR this_arg);
38022
38023 /**
38024  * Gets a fake short channel id for use in receiving intercepted payments. These fake scids are
38025  * used when constructing the route hints for HTLCs intended to be intercepted. See
38026  * [`ChannelManager::forward_intercepted_htlc`].
38027  *
38028  * Note that this method is not guaranteed to return unique values, you may need to call it a few
38029  * times to get a unique scid.
38030  */
38031 MUST_USE_RES uint64_t ChannelManager_get_intercept_scid(const struct LDKChannelManager *NONNULL_PTR this_arg);
38032
38033 /**
38034  * Gets inflight HTLC information by processing pending outbound payments that are in
38035  * our channels. May be used during pathfinding to account for in-use channel liquidity.
38036  */
38037 MUST_USE_RES struct LDKInFlightHtlcs ChannelManager_compute_inflight_htlcs(const struct LDKChannelManager *NONNULL_PTR this_arg);
38038
38039 /**
38040  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
38041  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
38042  */
38043 struct LDKMessageSendEventsProvider ChannelManager_as_MessageSendEventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
38044
38045 /**
38046  * Constructs a new EventsProvider which calls the relevant methods on this_arg.
38047  * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is
38048  */
38049 struct LDKEventsProvider ChannelManager_as_EventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
38050
38051 /**
38052  * Constructs a new Listen which calls the relevant methods on this_arg.
38053  * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is
38054  */
38055 struct LDKListen ChannelManager_as_Listen(const struct LDKChannelManager *NONNULL_PTR this_arg);
38056
38057 /**
38058  * Constructs a new Confirm which calls the relevant methods on this_arg.
38059  * This copies the `inner` pointer in this_arg and thus the returned Confirm must be freed before this_arg is
38060  */
38061 struct LDKConfirm ChannelManager_as_Confirm(const struct LDKChannelManager *NONNULL_PTR this_arg);
38062
38063 /**
38064  * Gets a [`Future`] that completes when this [`ChannelManager`] may need to be persisted or
38065  * may have events that need processing.
38066  *
38067  * In order to check if this [`ChannelManager`] needs persisting, call
38068  * [`Self::get_and_clear_needs_persistence`].
38069  *
38070  * Note that callbacks registered on the [`Future`] MUST NOT call back into this
38071  * [`ChannelManager`] and should instead register actions to be taken later.
38072  */
38073 MUST_USE_RES struct LDKFuture ChannelManager_get_event_or_persistence_needed_future(const struct LDKChannelManager *NONNULL_PTR this_arg);
38074
38075 /**
38076  * Returns true if this [`ChannelManager`] needs to be persisted.
38077  *
38078  * See [`Self::get_event_or_persistence_needed_future`] for retrieving a [`Future`] that
38079  * indicates this should be checked.
38080  */
38081 MUST_USE_RES bool ChannelManager_get_and_clear_needs_persistence(const struct LDKChannelManager *NONNULL_PTR this_arg);
38082
38083 /**
38084  * Gets the latest best block which was connected either via the [`chain::Listen`] or
38085  * [`chain::Confirm`] interfaces.
38086  */
38087 MUST_USE_RES struct LDKBestBlock ChannelManager_current_best_block(const struct LDKChannelManager *NONNULL_PTR this_arg);
38088
38089 /**
38090  * Fetches the set of [`NodeFeatures`] flags that are provided by or required by
38091  * [`ChannelManager`].
38092  */
38093 MUST_USE_RES struct LDKNodeFeatures ChannelManager_node_features(const struct LDKChannelManager *NONNULL_PTR this_arg);
38094
38095 /**
38096  * Fetches the set of [`ChannelFeatures`] flags that are provided by or required by
38097  * [`ChannelManager`].
38098  */
38099 MUST_USE_RES struct LDKChannelFeatures ChannelManager_channel_features(const struct LDKChannelManager *NONNULL_PTR this_arg);
38100
38101 /**
38102  * Fetches the set of [`ChannelTypeFeatures`] flags that are provided by or required by
38103  * [`ChannelManager`].
38104  */
38105 MUST_USE_RES struct LDKChannelTypeFeatures ChannelManager_channel_type_features(const struct LDKChannelManager *NONNULL_PTR this_arg);
38106
38107 /**
38108  * Fetches the set of [`InitFeatures`] flags that are provided by or required by
38109  * [`ChannelManager`].
38110  */
38111 MUST_USE_RES struct LDKInitFeatures ChannelManager_init_features(const struct LDKChannelManager *NONNULL_PTR this_arg);
38112
38113 /**
38114  * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg.
38115  * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is
38116  */
38117 struct LDKChannelMessageHandler ChannelManager_as_ChannelMessageHandler(const struct LDKChannelManager *NONNULL_PTR this_arg);
38118
38119 /**
38120  * Constructs a new OffersMessageHandler which calls the relevant methods on this_arg.
38121  * This copies the `inner` pointer in this_arg and thus the returned OffersMessageHandler must be freed before this_arg is
38122  */
38123 struct LDKOffersMessageHandler ChannelManager_as_OffersMessageHandler(const struct LDKChannelManager *NONNULL_PTR this_arg);
38124
38125 /**
38126  * Constructs a new NodeIdLookUp which calls the relevant methods on this_arg.
38127  * This copies the `inner` pointer in this_arg and thus the returned NodeIdLookUp must be freed before this_arg is
38128  */
38129 struct LDKNodeIdLookUp ChannelManager_as_NodeIdLookUp(const struct LDKChannelManager *NONNULL_PTR this_arg);
38130
38131 /**
38132  * Fetches the set of [`InitFeatures`] flags that are provided by or required by
38133  * [`ChannelManager`].
38134  */
38135 struct LDKInitFeatures provided_init_features(const struct LDKUserConfig *NONNULL_PTR config);
38136
38137 /**
38138  * Serialize the CounterpartyForwardingInfo object into a byte array which can be read by CounterpartyForwardingInfo_read
38139  */
38140 struct LDKCVec_u8Z CounterpartyForwardingInfo_write(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR obj);
38141
38142 /**
38143  * Read a CounterpartyForwardingInfo from a byte array, created by CounterpartyForwardingInfo_write
38144  */
38145 struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CounterpartyForwardingInfo_read(struct LDKu8slice ser);
38146
38147 /**
38148  * Serialize the ChannelCounterparty object into a byte array which can be read by ChannelCounterparty_read
38149  */
38150 struct LDKCVec_u8Z ChannelCounterparty_write(const struct LDKChannelCounterparty *NONNULL_PTR obj);
38151
38152 /**
38153  * Read a ChannelCounterparty from a byte array, created by ChannelCounterparty_write
38154  */
38155 struct LDKCResult_ChannelCounterpartyDecodeErrorZ ChannelCounterparty_read(struct LDKu8slice ser);
38156
38157 /**
38158  * Serialize the ChannelDetails object into a byte array which can be read by ChannelDetails_read
38159  */
38160 struct LDKCVec_u8Z ChannelDetails_write(const struct LDKChannelDetails *NONNULL_PTR obj);
38161
38162 /**
38163  * Read a ChannelDetails from a byte array, created by ChannelDetails_write
38164  */
38165 struct LDKCResult_ChannelDetailsDecodeErrorZ ChannelDetails_read(struct LDKu8slice ser);
38166
38167 /**
38168  * Serialize the PhantomRouteHints object into a byte array which can be read by PhantomRouteHints_read
38169  */
38170 struct LDKCVec_u8Z PhantomRouteHints_write(const struct LDKPhantomRouteHints *NONNULL_PTR obj);
38171
38172 /**
38173  * Read a PhantomRouteHints from a byte array, created by PhantomRouteHints_write
38174  */
38175 struct LDKCResult_PhantomRouteHintsDecodeErrorZ PhantomRouteHints_read(struct LDKu8slice ser);
38176
38177 /**
38178  * Serialize the BlindedForward object into a byte array which can be read by BlindedForward_read
38179  */
38180 struct LDKCVec_u8Z BlindedForward_write(const struct LDKBlindedForward *NONNULL_PTR obj);
38181
38182 /**
38183  * Read a BlindedForward from a byte array, created by BlindedForward_write
38184  */
38185 struct LDKCResult_BlindedForwardDecodeErrorZ BlindedForward_read(struct LDKu8slice ser);
38186
38187 /**
38188  * Serialize the PendingHTLCRouting object into a byte array which can be read by PendingHTLCRouting_read
38189  */
38190 struct LDKCVec_u8Z PendingHTLCRouting_write(const struct LDKPendingHTLCRouting *NONNULL_PTR obj);
38191
38192 /**
38193  * Read a PendingHTLCRouting from a byte array, created by PendingHTLCRouting_write
38194  */
38195 struct LDKCResult_PendingHTLCRoutingDecodeErrorZ PendingHTLCRouting_read(struct LDKu8slice ser);
38196
38197 /**
38198  * Serialize the PendingHTLCInfo object into a byte array which can be read by PendingHTLCInfo_read
38199  */
38200 struct LDKCVec_u8Z PendingHTLCInfo_write(const struct LDKPendingHTLCInfo *NONNULL_PTR obj);
38201
38202 /**
38203  * Read a PendingHTLCInfo from a byte array, created by PendingHTLCInfo_write
38204  */
38205 struct LDKCResult_PendingHTLCInfoDecodeErrorZ PendingHTLCInfo_read(struct LDKu8slice ser);
38206
38207 /**
38208  * Serialize the BlindedFailure object into a byte array which can be read by BlindedFailure_read
38209  */
38210 struct LDKCVec_u8Z BlindedFailure_write(const enum LDKBlindedFailure *NONNULL_PTR obj);
38211
38212 /**
38213  * Read a BlindedFailure from a byte array, created by BlindedFailure_write
38214  */
38215 struct LDKCResult_BlindedFailureDecodeErrorZ BlindedFailure_read(struct LDKu8slice ser);
38216
38217 /**
38218  * Serialize the ChannelManager object into a byte array which can be read by ChannelManager_read
38219  */
38220 struct LDKCVec_u8Z ChannelManager_write(const struct LDKChannelManager *NONNULL_PTR obj);
38221
38222 /**
38223  * Serialize the ChannelShutdownState object into a byte array which can be read by ChannelShutdownState_read
38224  */
38225 struct LDKCVec_u8Z ChannelShutdownState_write(const enum LDKChannelShutdownState *NONNULL_PTR obj);
38226
38227 /**
38228  * Read a ChannelShutdownState from a byte array, created by ChannelShutdownState_write
38229  */
38230 struct LDKCResult_ChannelShutdownStateDecodeErrorZ ChannelShutdownState_read(struct LDKu8slice ser);
38231
38232 /**
38233  * Frees any resources used by the ChannelManagerReadArgs, if is_owned is set and inner is non-NULL.
38234  */
38235 void ChannelManagerReadArgs_free(struct LDKChannelManagerReadArgs this_obj);
38236
38237 /**
38238  * A cryptographically secure source of entropy.
38239  */
38240 const struct LDKEntropySource *ChannelManagerReadArgs_get_entropy_source(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
38241
38242 /**
38243  * A cryptographically secure source of entropy.
38244  */
38245 void ChannelManagerReadArgs_set_entropy_source(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKEntropySource val);
38246
38247 /**
38248  * A signer that is able to perform node-scoped cryptographic operations.
38249  */
38250 const struct LDKNodeSigner *ChannelManagerReadArgs_get_node_signer(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
38251
38252 /**
38253  * A signer that is able to perform node-scoped cryptographic operations.
38254  */
38255 void ChannelManagerReadArgs_set_node_signer(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKNodeSigner val);
38256
38257 /**
38258  * The keys provider which will give us relevant keys. Some keys will be loaded during
38259  * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
38260  * signing data.
38261  */
38262 const struct LDKSignerProvider *ChannelManagerReadArgs_get_signer_provider(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
38263
38264 /**
38265  * The keys provider which will give us relevant keys. Some keys will be loaded during
38266  * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
38267  * signing data.
38268  */
38269 void ChannelManagerReadArgs_set_signer_provider(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKSignerProvider val);
38270
38271 /**
38272  * The fee_estimator for use in the ChannelManager in the future.
38273  *
38274  * No calls to the FeeEstimator will be made during deserialization.
38275  */
38276 const struct LDKFeeEstimator *ChannelManagerReadArgs_get_fee_estimator(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
38277
38278 /**
38279  * The fee_estimator for use in the ChannelManager in the future.
38280  *
38281  * No calls to the FeeEstimator will be made during deserialization.
38282  */
38283 void ChannelManagerReadArgs_set_fee_estimator(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKFeeEstimator val);
38284
38285 /**
38286  * The chain::Watch for use in the ChannelManager in the future.
38287  *
38288  * No calls to the chain::Watch will be made during deserialization. It is assumed that
38289  * you have deserialized ChannelMonitors separately and will add them to your
38290  * chain::Watch after deserializing this ChannelManager.
38291  */
38292 const struct LDKWatch *ChannelManagerReadArgs_get_chain_monitor(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
38293
38294 /**
38295  * The chain::Watch for use in the ChannelManager in the future.
38296  *
38297  * No calls to the chain::Watch will be made during deserialization. It is assumed that
38298  * you have deserialized ChannelMonitors separately and will add them to your
38299  * chain::Watch after deserializing this ChannelManager.
38300  */
38301 void ChannelManagerReadArgs_set_chain_monitor(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKWatch val);
38302
38303 /**
38304  * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
38305  * used to broadcast the latest local commitment transactions of channels which must be
38306  * force-closed during deserialization.
38307  */
38308 const struct LDKBroadcasterInterface *ChannelManagerReadArgs_get_tx_broadcaster(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
38309
38310 /**
38311  * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
38312  * used to broadcast the latest local commitment transactions of channels which must be
38313  * force-closed during deserialization.
38314  */
38315 void ChannelManagerReadArgs_set_tx_broadcaster(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKBroadcasterInterface val);
38316
38317 /**
38318  * The router which will be used in the ChannelManager in the future for finding routes
38319  * on-the-fly for trampoline payments. Absent in private nodes that don't support forwarding.
38320  *
38321  * No calls to the router will be made during deserialization.
38322  */
38323 const struct LDKRouter *ChannelManagerReadArgs_get_router(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
38324
38325 /**
38326  * The router which will be used in the ChannelManager in the future for finding routes
38327  * on-the-fly for trampoline payments. Absent in private nodes that don't support forwarding.
38328  *
38329  * No calls to the router will be made during deserialization.
38330  */
38331 void ChannelManagerReadArgs_set_router(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKRouter val);
38332
38333 /**
38334  * The Logger for use in the ChannelManager and which may be used to log information during
38335  * deserialization.
38336  */
38337 const struct LDKLogger *ChannelManagerReadArgs_get_logger(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
38338
38339 /**
38340  * The Logger for use in the ChannelManager and which may be used to log information during
38341  * deserialization.
38342  */
38343 void ChannelManagerReadArgs_set_logger(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKLogger val);
38344
38345 /**
38346  * Default settings used for new channels. Any existing channels will continue to use the
38347  * runtime settings which were stored when the ChannelManager was serialized.
38348  */
38349 struct LDKUserConfig ChannelManagerReadArgs_get_default_config(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
38350
38351 /**
38352  * Default settings used for new channels. Any existing channels will continue to use the
38353  * runtime settings which were stored when the ChannelManager was serialized.
38354  */
38355 void ChannelManagerReadArgs_set_default_config(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKUserConfig val);
38356
38357 /**
38358  * Simple utility function to create a ChannelManagerReadArgs which creates the monitor
38359  * HashMap for you. This is primarily useful for C bindings where it is not practical to
38360  * populate a HashMap directly from C.
38361  */
38362 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);
38363
38364 /**
38365  * Read a C2Tuple_ThirtyTwoBytesChannelManagerZ from a byte array, created by C2Tuple_ThirtyTwoBytesChannelManagerZ_write
38366  */
38367 struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ C2Tuple_ThirtyTwoBytesChannelManagerZ_read(struct LDKu8slice ser, struct LDKChannelManagerReadArgs arg);
38368
38369 /**
38370  * Frees any resources used by the DelayedPaymentBasepoint, if is_owned is set and inner is non-NULL.
38371  */
38372 void DelayedPaymentBasepoint_free(struct LDKDelayedPaymentBasepoint this_obj);
38373
38374 struct LDKPublicKey DelayedPaymentBasepoint_get_a(const struct LDKDelayedPaymentBasepoint *NONNULL_PTR this_ptr);
38375
38376 void DelayedPaymentBasepoint_set_a(struct LDKDelayedPaymentBasepoint *NONNULL_PTR this_ptr, struct LDKPublicKey val);
38377
38378 /**
38379  * Constructs a new DelayedPaymentBasepoint given each field
38380  */
38381 MUST_USE_RES struct LDKDelayedPaymentBasepoint DelayedPaymentBasepoint_new(struct LDKPublicKey a_arg);
38382
38383 /**
38384  * Checks if two DelayedPaymentBasepoints contain equal inner contents.
38385  * This ignores pointers and is_owned flags and looks at the values in fields.
38386  * Two objects with NULL inner values will be considered "equal" here.
38387  */
38388 bool DelayedPaymentBasepoint_eq(const struct LDKDelayedPaymentBasepoint *NONNULL_PTR a, const struct LDKDelayedPaymentBasepoint *NONNULL_PTR b);
38389
38390 /**
38391  * Creates a copy of the DelayedPaymentBasepoint
38392  */
38393 struct LDKDelayedPaymentBasepoint DelayedPaymentBasepoint_clone(const struct LDKDelayedPaymentBasepoint *NONNULL_PTR orig);
38394
38395 /**
38396  * Generates a non-cryptographic 64-bit hash of the DelayedPaymentBasepoint.
38397  */
38398 uint64_t DelayedPaymentBasepoint_hash(const struct LDKDelayedPaymentBasepoint *NONNULL_PTR o);
38399
38400 /**
38401  * Get inner Public Key
38402  */
38403 MUST_USE_RES struct LDKPublicKey DelayedPaymentBasepoint_to_public_key(const struct LDKDelayedPaymentBasepoint *NONNULL_PTR this_arg);
38404
38405 /**
38406  *Derives the \"tweak\" used in calculate [`DelayedPaymentKey::from_basepoint`].\n\n[`DelayedPaymentKey::from_basepoint`] calculates a private key as:\n`privkey = basepoint_secret + SHA256(per_commitment_point || basepoint)`\n\nThis calculates the hash part in the tweak derivation process, which is used to\nensure that each key is unique and cannot be guessed by an external party.
38407  */
38408 MUST_USE_RES struct LDKThirtyTwoBytes DelayedPaymentBasepoint_derive_add_tweak(const struct LDKDelayedPaymentBasepoint *NONNULL_PTR this_arg, struct LDKPublicKey per_commitment_point);
38409
38410 /**
38411  * Serialize the DelayedPaymentBasepoint object into a byte array which can be read by DelayedPaymentBasepoint_read
38412  */
38413 struct LDKCVec_u8Z DelayedPaymentBasepoint_write(const struct LDKDelayedPaymentBasepoint *NONNULL_PTR obj);
38414
38415 /**
38416  * Read a DelayedPaymentBasepoint from a byte array, created by DelayedPaymentBasepoint_write
38417  */
38418 struct LDKCResult_DelayedPaymentBasepointDecodeErrorZ DelayedPaymentBasepoint_read(struct LDKu8slice ser);
38419
38420 /**
38421  * Frees any resources used by the DelayedPaymentKey, if is_owned is set and inner is non-NULL.
38422  */
38423 void DelayedPaymentKey_free(struct LDKDelayedPaymentKey this_obj);
38424
38425 struct LDKPublicKey DelayedPaymentKey_get_a(const struct LDKDelayedPaymentKey *NONNULL_PTR this_ptr);
38426
38427 void DelayedPaymentKey_set_a(struct LDKDelayedPaymentKey *NONNULL_PTR this_ptr, struct LDKPublicKey val);
38428
38429 /**
38430  * Constructs a new DelayedPaymentKey given each field
38431  */
38432 MUST_USE_RES struct LDKDelayedPaymentKey DelayedPaymentKey_new(struct LDKPublicKey a_arg);
38433
38434 /**
38435  * Checks if two DelayedPaymentKeys contain equal inner contents.
38436  * This ignores pointers and is_owned flags and looks at the values in fields.
38437  * Two objects with NULL inner values will be considered "equal" here.
38438  */
38439 bool DelayedPaymentKey_eq(const struct LDKDelayedPaymentKey *NONNULL_PTR a, const struct LDKDelayedPaymentKey *NONNULL_PTR b);
38440
38441 /**
38442  * Creates a copy of the DelayedPaymentKey
38443  */
38444 struct LDKDelayedPaymentKey DelayedPaymentKey_clone(const struct LDKDelayedPaymentKey *NONNULL_PTR orig);
38445
38446 /**
38447  *Derive a public delayedpubkey using one node\'s `per_commitment_point` and its countersignatory\'s `basepoint`
38448  */
38449 MUST_USE_RES struct LDKDelayedPaymentKey DelayedPaymentKey_from_basepoint(const struct LDKDelayedPaymentBasepoint *NONNULL_PTR countersignatory_basepoint, struct LDKPublicKey per_commitment_point);
38450
38451 /**
38452  *Build a delayedpubkey directly from an already-derived private key
38453  */
38454 MUST_USE_RES struct LDKDelayedPaymentKey DelayedPaymentKey_from_secret_key(const uint8_t (*sk)[32]);
38455
38456 /**
38457  * Get inner Public Key
38458  */
38459 MUST_USE_RES struct LDKPublicKey DelayedPaymentKey_to_public_key(const struct LDKDelayedPaymentKey *NONNULL_PTR this_arg);
38460
38461 /**
38462  * Serialize the DelayedPaymentKey object into a byte array which can be read by DelayedPaymentKey_read
38463  */
38464 struct LDKCVec_u8Z DelayedPaymentKey_write(const struct LDKDelayedPaymentKey *NONNULL_PTR obj);
38465
38466 /**
38467  * Read a DelayedPaymentKey from a byte array, created by DelayedPaymentKey_write
38468  */
38469 struct LDKCResult_DelayedPaymentKeyDecodeErrorZ DelayedPaymentKey_read(struct LDKu8slice ser);
38470
38471 /**
38472  * Frees any resources used by the HtlcBasepoint, if is_owned is set and inner is non-NULL.
38473  */
38474 void HtlcBasepoint_free(struct LDKHtlcBasepoint this_obj);
38475
38476 struct LDKPublicKey HtlcBasepoint_get_a(const struct LDKHtlcBasepoint *NONNULL_PTR this_ptr);
38477
38478 void HtlcBasepoint_set_a(struct LDKHtlcBasepoint *NONNULL_PTR this_ptr, struct LDKPublicKey val);
38479
38480 /**
38481  * Constructs a new HtlcBasepoint given each field
38482  */
38483 MUST_USE_RES struct LDKHtlcBasepoint HtlcBasepoint_new(struct LDKPublicKey a_arg);
38484
38485 /**
38486  * Checks if two HtlcBasepoints contain equal inner contents.
38487  * This ignores pointers and is_owned flags and looks at the values in fields.
38488  * Two objects with NULL inner values will be considered "equal" here.
38489  */
38490 bool HtlcBasepoint_eq(const struct LDKHtlcBasepoint *NONNULL_PTR a, const struct LDKHtlcBasepoint *NONNULL_PTR b);
38491
38492 /**
38493  * Creates a copy of the HtlcBasepoint
38494  */
38495 struct LDKHtlcBasepoint HtlcBasepoint_clone(const struct LDKHtlcBasepoint *NONNULL_PTR orig);
38496
38497 /**
38498  * Generates a non-cryptographic 64-bit hash of the HtlcBasepoint.
38499  */
38500 uint64_t HtlcBasepoint_hash(const struct LDKHtlcBasepoint *NONNULL_PTR o);
38501
38502 /**
38503  * Get inner Public Key
38504  */
38505 MUST_USE_RES struct LDKPublicKey HtlcBasepoint_to_public_key(const struct LDKHtlcBasepoint *NONNULL_PTR this_arg);
38506
38507 /**
38508  *Derives the \"tweak\" used in calculate [`HtlcKey::from_basepoint`].\n\n[`HtlcKey::from_basepoint`] calculates a private key as:\n`privkey = basepoint_secret + SHA256(per_commitment_point || basepoint)`\n\nThis calculates the hash part in the tweak derivation process, which is used to\nensure that each key is unique and cannot be guessed by an external party.
38509  */
38510 MUST_USE_RES struct LDKThirtyTwoBytes HtlcBasepoint_derive_add_tweak(const struct LDKHtlcBasepoint *NONNULL_PTR this_arg, struct LDKPublicKey per_commitment_point);
38511
38512 /**
38513  * Serialize the HtlcBasepoint object into a byte array which can be read by HtlcBasepoint_read
38514  */
38515 struct LDKCVec_u8Z HtlcBasepoint_write(const struct LDKHtlcBasepoint *NONNULL_PTR obj);
38516
38517 /**
38518  * Read a HtlcBasepoint from a byte array, created by HtlcBasepoint_write
38519  */
38520 struct LDKCResult_HtlcBasepointDecodeErrorZ HtlcBasepoint_read(struct LDKu8slice ser);
38521
38522 /**
38523  * Frees any resources used by the HtlcKey, if is_owned is set and inner is non-NULL.
38524  */
38525 void HtlcKey_free(struct LDKHtlcKey this_obj);
38526
38527 struct LDKPublicKey HtlcKey_get_a(const struct LDKHtlcKey *NONNULL_PTR this_ptr);
38528
38529 void HtlcKey_set_a(struct LDKHtlcKey *NONNULL_PTR this_ptr, struct LDKPublicKey val);
38530
38531 /**
38532  * Constructs a new HtlcKey given each field
38533  */
38534 MUST_USE_RES struct LDKHtlcKey HtlcKey_new(struct LDKPublicKey a_arg);
38535
38536 /**
38537  * Checks if two HtlcKeys contain equal inner contents.
38538  * This ignores pointers and is_owned flags and looks at the values in fields.
38539  * Two objects with NULL inner values will be considered "equal" here.
38540  */
38541 bool HtlcKey_eq(const struct LDKHtlcKey *NONNULL_PTR a, const struct LDKHtlcKey *NONNULL_PTR b);
38542
38543 /**
38544  * Creates a copy of the HtlcKey
38545  */
38546 struct LDKHtlcKey HtlcKey_clone(const struct LDKHtlcKey *NONNULL_PTR orig);
38547
38548 /**
38549  *Derive a public htlcpubkey using one node\'s `per_commitment_point` and its countersignatory\'s `basepoint`
38550  */
38551 MUST_USE_RES struct LDKHtlcKey HtlcKey_from_basepoint(const struct LDKHtlcBasepoint *NONNULL_PTR countersignatory_basepoint, struct LDKPublicKey per_commitment_point);
38552
38553 /**
38554  *Build a htlcpubkey directly from an already-derived private key
38555  */
38556 MUST_USE_RES struct LDKHtlcKey HtlcKey_from_secret_key(const uint8_t (*sk)[32]);
38557
38558 /**
38559  * Get inner Public Key
38560  */
38561 MUST_USE_RES struct LDKPublicKey HtlcKey_to_public_key(const struct LDKHtlcKey *NONNULL_PTR this_arg);
38562
38563 /**
38564  * Serialize the HtlcKey object into a byte array which can be read by HtlcKey_read
38565  */
38566 struct LDKCVec_u8Z HtlcKey_write(const struct LDKHtlcKey *NONNULL_PTR obj);
38567
38568 /**
38569  * Read a HtlcKey from a byte array, created by HtlcKey_write
38570  */
38571 struct LDKCResult_HtlcKeyDecodeErrorZ HtlcKey_read(struct LDKu8slice ser);
38572
38573 /**
38574  * Adds a tweak to a public key to derive a new public key.
38575  *
38576  * May panic if `tweak` is not the output of a SHA-256 hash.
38577  */
38578 struct LDKPublicKey add_public_key_tweak(struct LDKPublicKey base_point, const uint8_t (*tweak)[32]);
38579
38580 /**
38581  * Frees any resources used by the RevocationBasepoint, if is_owned is set and inner is non-NULL.
38582  */
38583 void RevocationBasepoint_free(struct LDKRevocationBasepoint this_obj);
38584
38585 struct LDKPublicKey RevocationBasepoint_get_a(const struct LDKRevocationBasepoint *NONNULL_PTR this_ptr);
38586
38587 void RevocationBasepoint_set_a(struct LDKRevocationBasepoint *NONNULL_PTR this_ptr, struct LDKPublicKey val);
38588
38589 /**
38590  * Constructs a new RevocationBasepoint given each field
38591  */
38592 MUST_USE_RES struct LDKRevocationBasepoint RevocationBasepoint_new(struct LDKPublicKey a_arg);
38593
38594 /**
38595  * Checks if two RevocationBasepoints contain equal inner contents.
38596  * This ignores pointers and is_owned flags and looks at the values in fields.
38597  * Two objects with NULL inner values will be considered "equal" here.
38598  */
38599 bool RevocationBasepoint_eq(const struct LDKRevocationBasepoint *NONNULL_PTR a, const struct LDKRevocationBasepoint *NONNULL_PTR b);
38600
38601 /**
38602  * Creates a copy of the RevocationBasepoint
38603  */
38604 struct LDKRevocationBasepoint RevocationBasepoint_clone(const struct LDKRevocationBasepoint *NONNULL_PTR orig);
38605
38606 /**
38607  * Generates a non-cryptographic 64-bit hash of the RevocationBasepoint.
38608  */
38609 uint64_t RevocationBasepoint_hash(const struct LDKRevocationBasepoint *NONNULL_PTR o);
38610
38611 /**
38612  * Get inner Public Key
38613  */
38614 MUST_USE_RES struct LDKPublicKey RevocationBasepoint_to_public_key(const struct LDKRevocationBasepoint *NONNULL_PTR this_arg);
38615
38616 /**
38617  * Serialize the RevocationBasepoint object into a byte array which can be read by RevocationBasepoint_read
38618  */
38619 struct LDKCVec_u8Z RevocationBasepoint_write(const struct LDKRevocationBasepoint *NONNULL_PTR obj);
38620
38621 /**
38622  * Read a RevocationBasepoint from a byte array, created by RevocationBasepoint_write
38623  */
38624 struct LDKCResult_RevocationBasepointDecodeErrorZ RevocationBasepoint_read(struct LDKu8slice ser);
38625
38626 /**
38627  * Frees any resources used by the RevocationKey, if is_owned is set and inner is non-NULL.
38628  */
38629 void RevocationKey_free(struct LDKRevocationKey this_obj);
38630
38631 struct LDKPublicKey RevocationKey_get_a(const struct LDKRevocationKey *NONNULL_PTR this_ptr);
38632
38633 void RevocationKey_set_a(struct LDKRevocationKey *NONNULL_PTR this_ptr, struct LDKPublicKey val);
38634
38635 /**
38636  * Constructs a new RevocationKey given each field
38637  */
38638 MUST_USE_RES struct LDKRevocationKey RevocationKey_new(struct LDKPublicKey a_arg);
38639
38640 /**
38641  * Checks if two RevocationKeys contain equal inner contents.
38642  * This ignores pointers and is_owned flags and looks at the values in fields.
38643  * Two objects with NULL inner values will be considered "equal" here.
38644  */
38645 bool RevocationKey_eq(const struct LDKRevocationKey *NONNULL_PTR a, const struct LDKRevocationKey *NONNULL_PTR b);
38646
38647 /**
38648  * Creates a copy of the RevocationKey
38649  */
38650 struct LDKRevocationKey RevocationKey_clone(const struct LDKRevocationKey *NONNULL_PTR orig);
38651
38652 /**
38653  * Generates a non-cryptographic 64-bit hash of the RevocationKey.
38654  */
38655 uint64_t RevocationKey_hash(const struct LDKRevocationKey *NONNULL_PTR o);
38656
38657 /**
38658  * Derives a per-commitment-transaction revocation public key from one party's per-commitment
38659  * point and the other party's [`RevocationBasepoint`]. This is the public equivalent of
38660  * [`chan_utils::derive_private_revocation_key`] - using only public keys to derive a public
38661  * key instead of private keys.
38662  *
38663  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
38664  * generated (ie our own).
38665  *
38666  * [`chan_utils::derive_private_revocation_key`]: crate::ln::chan_utils::derive_private_revocation_key
38667  */
38668 MUST_USE_RES struct LDKRevocationKey RevocationKey_from_basepoint(const struct LDKRevocationBasepoint *NONNULL_PTR countersignatory_basepoint, struct LDKPublicKey per_commitment_point);
38669
38670 /**
38671  * Get inner Public Key
38672  */
38673 MUST_USE_RES struct LDKPublicKey RevocationKey_to_public_key(const struct LDKRevocationKey *NONNULL_PTR this_arg);
38674
38675 /**
38676  * Serialize the RevocationKey object into a byte array which can be read by RevocationKey_read
38677  */
38678 struct LDKCVec_u8Z RevocationKey_write(const struct LDKRevocationKey *NONNULL_PTR obj);
38679
38680 /**
38681  * Read a RevocationKey from a byte array, created by RevocationKey_write
38682  */
38683 struct LDKCResult_RevocationKeyDecodeErrorZ RevocationKey_read(struct LDKu8slice ser);
38684
38685 /**
38686  * Frees any resources used by the ExpandedKey, if is_owned is set and inner is non-NULL.
38687  */
38688 void ExpandedKey_free(struct LDKExpandedKey this_obj);
38689
38690 /**
38691  * Create a  new [`ExpandedKey`] for generating an inbound payment hash and secret.
38692  *
38693  * It is recommended to cache this value and not regenerate it for each new inbound payment.
38694  */
38695 MUST_USE_RES struct LDKExpandedKey ExpandedKey_new(const uint8_t (*key_material)[32]);
38696
38697 /**
38698  * Equivalent to [`crate::ln::channelmanager::ChannelManager::create_inbound_payment`], but no
38699  * `ChannelManager` is required. Useful for generating invoices for [phantom node payments] without
38700  * a `ChannelManager`.
38701  *
38702  * `keys` is generated by calling [`NodeSigner::get_inbound_payment_key_material`] and then
38703  * calling [`ExpandedKey::new`] with its result. It is recommended to cache this value and not
38704  * regenerate it for each new inbound payment.
38705  *
38706  * `current_time` is a Unix timestamp representing the current time.
38707  *
38708  * Note that if `min_final_cltv_expiry_delta` is set to some value, then the payment will not be receivable
38709  * on versions of LDK prior to 0.0.114.
38710  *
38711  * [phantom node payments]: crate::sign::PhantomKeysManager
38712  * [`NodeSigner::get_inbound_payment_key_material`]: crate::sign::NodeSigner::get_inbound_payment_key_material
38713  */
38714 struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ 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);
38715
38716 /**
38717  * Equivalent to [`crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash`],
38718  * but no `ChannelManager` is required. Useful for generating invoices for [phantom node payments]
38719  * without a `ChannelManager`.
38720  *
38721  * See [`create`] for information on the `keys` and `current_time` parameters.
38722  *
38723  * Note that if `min_final_cltv_expiry_delta` is set to some value, then the payment will not be receivable
38724  * on versions of LDK prior to 0.0.114.
38725  *
38726  * [phantom node payments]: crate::sign::PhantomKeysManager
38727  */
38728 struct LDKCResult_ThirtyTwoBytesNoneZ 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);
38729
38730 /**
38731  * Frees any resources used by the DecodeError
38732  */
38733 void DecodeError_free(struct LDKDecodeError this_ptr);
38734
38735 /**
38736  * Creates a copy of the DecodeError
38737  */
38738 struct LDKDecodeError DecodeError_clone(const struct LDKDecodeError *NONNULL_PTR orig);
38739
38740 /**
38741  * Utility method to constructs a new UnknownVersion-variant DecodeError
38742  */
38743 struct LDKDecodeError DecodeError_unknown_version(void);
38744
38745 /**
38746  * Utility method to constructs a new UnknownRequiredFeature-variant DecodeError
38747  */
38748 struct LDKDecodeError DecodeError_unknown_required_feature(void);
38749
38750 /**
38751  * Utility method to constructs a new InvalidValue-variant DecodeError
38752  */
38753 struct LDKDecodeError DecodeError_invalid_value(void);
38754
38755 /**
38756  * Utility method to constructs a new ShortRead-variant DecodeError
38757  */
38758 struct LDKDecodeError DecodeError_short_read(void);
38759
38760 /**
38761  * Utility method to constructs a new BadLengthDescriptor-variant DecodeError
38762  */
38763 struct LDKDecodeError DecodeError_bad_length_descriptor(void);
38764
38765 /**
38766  * Utility method to constructs a new Io-variant DecodeError
38767  */
38768 struct LDKDecodeError DecodeError_io(enum LDKIOError a);
38769
38770 /**
38771  * Utility method to constructs a new UnsupportedCompression-variant DecodeError
38772  */
38773 struct LDKDecodeError DecodeError_unsupported_compression(void);
38774
38775 /**
38776  * Utility method to constructs a new DangerousValue-variant DecodeError
38777  */
38778 struct LDKDecodeError DecodeError_dangerous_value(void);
38779
38780 /**
38781  * Generates a non-cryptographic 64-bit hash of the DecodeError.
38782  */
38783 uint64_t DecodeError_hash(const struct LDKDecodeError *NONNULL_PTR o);
38784
38785 /**
38786  * Checks if two DecodeErrors contain equal inner contents.
38787  * This ignores pointers and is_owned flags and looks at the values in fields.
38788  */
38789 bool DecodeError_eq(const struct LDKDecodeError *NONNULL_PTR a, const struct LDKDecodeError *NONNULL_PTR b);
38790
38791 /**
38792  * Frees any resources used by the Init, if is_owned is set and inner is non-NULL.
38793  */
38794 void Init_free(struct LDKInit this_obj);
38795
38796 /**
38797  * The relevant features which the sender supports.
38798  */
38799 struct LDKInitFeatures Init_get_features(const struct LDKInit *NONNULL_PTR this_ptr);
38800
38801 /**
38802  * The relevant features which the sender supports.
38803  */
38804 void Init_set_features(struct LDKInit *NONNULL_PTR this_ptr, struct LDKInitFeatures val);
38805
38806 /**
38807  * Indicates chains the sender is interested in.
38808  *
38809  * If there are no common chains, the connection will be closed.
38810  *
38811  * Returns a copy of the field.
38812  */
38813 struct LDKCOption_CVec_ThirtyTwoBytesZZ Init_get_networks(const struct LDKInit *NONNULL_PTR this_ptr);
38814
38815 /**
38816  * Indicates chains the sender is interested in.
38817  *
38818  * If there are no common chains, the connection will be closed.
38819  */
38820 void Init_set_networks(struct LDKInit *NONNULL_PTR this_ptr, struct LDKCOption_CVec_ThirtyTwoBytesZZ val);
38821
38822 /**
38823  * The receipient's network address.
38824  *
38825  * This adds the option to report a remote IP address back to a connecting peer using the init
38826  * message. A node can decide to use that information to discover a potential update to its
38827  * public IPv4 address (NAT) and use that for a [`NodeAnnouncement`] update message containing
38828  * the new address.
38829  */
38830 struct LDKCOption_SocketAddressZ Init_get_remote_network_address(const struct LDKInit *NONNULL_PTR this_ptr);
38831
38832 /**
38833  * The receipient's network address.
38834  *
38835  * This adds the option to report a remote IP address back to a connecting peer using the init
38836  * message. A node can decide to use that information to discover a potential update to its
38837  * public IPv4 address (NAT) and use that for a [`NodeAnnouncement`] update message containing
38838  * the new address.
38839  */
38840 void Init_set_remote_network_address(struct LDKInit *NONNULL_PTR this_ptr, struct LDKCOption_SocketAddressZ val);
38841
38842 /**
38843  * Constructs a new Init given each field
38844  */
38845 MUST_USE_RES struct LDKInit Init_new(struct LDKInitFeatures features_arg, struct LDKCOption_CVec_ThirtyTwoBytesZZ networks_arg, struct LDKCOption_SocketAddressZ remote_network_address_arg);
38846
38847 /**
38848  * Creates a copy of the Init
38849  */
38850 struct LDKInit Init_clone(const struct LDKInit *NONNULL_PTR orig);
38851
38852 /**
38853  * Generates a non-cryptographic 64-bit hash of the Init.
38854  */
38855 uint64_t Init_hash(const struct LDKInit *NONNULL_PTR o);
38856
38857 /**
38858  * Checks if two Inits contain equal inner contents.
38859  * This ignores pointers and is_owned flags and looks at the values in fields.
38860  * Two objects with NULL inner values will be considered "equal" here.
38861  */
38862 bool Init_eq(const struct LDKInit *NONNULL_PTR a, const struct LDKInit *NONNULL_PTR b);
38863
38864 /**
38865  * Frees any resources used by the ErrorMessage, if is_owned is set and inner is non-NULL.
38866  */
38867 void ErrorMessage_free(struct LDKErrorMessage this_obj);
38868
38869 /**
38870  * The channel ID involved in the error.
38871  *
38872  * All-0s indicates a general error unrelated to a specific channel, after which all channels
38873  * with the sending peer should be closed.
38874  */
38875 struct LDKChannelId ErrorMessage_get_channel_id(const struct LDKErrorMessage *NONNULL_PTR this_ptr);
38876
38877 /**
38878  * The channel ID involved in the error.
38879  *
38880  * All-0s indicates a general error unrelated to a specific channel, after which all channels
38881  * with the sending peer should be closed.
38882  */
38883 void ErrorMessage_set_channel_id(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKChannelId val);
38884
38885 /**
38886  * A possibly human-readable error description.
38887  *
38888  * The string should be sanitized before it is used (e.g., emitted to logs or printed to
38889  * `stdout`). Otherwise, a well crafted error message may trigger a security vulnerability in
38890  * the terminal emulator or the logging subsystem.
38891  */
38892 struct LDKStr ErrorMessage_get_data(const struct LDKErrorMessage *NONNULL_PTR this_ptr);
38893
38894 /**
38895  * A possibly human-readable error description.
38896  *
38897  * The string should be sanitized before it is used (e.g., emitted to logs or printed to
38898  * `stdout`). Otherwise, a well crafted error message may trigger a security vulnerability in
38899  * the terminal emulator or the logging subsystem.
38900  */
38901 void ErrorMessage_set_data(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKStr val);
38902
38903 /**
38904  * Constructs a new ErrorMessage given each field
38905  */
38906 MUST_USE_RES struct LDKErrorMessage ErrorMessage_new(struct LDKChannelId channel_id_arg, struct LDKStr data_arg);
38907
38908 /**
38909  * Creates a copy of the ErrorMessage
38910  */
38911 struct LDKErrorMessage ErrorMessage_clone(const struct LDKErrorMessage *NONNULL_PTR orig);
38912
38913 /**
38914  * Generates a non-cryptographic 64-bit hash of the ErrorMessage.
38915  */
38916 uint64_t ErrorMessage_hash(const struct LDKErrorMessage *NONNULL_PTR o);
38917
38918 /**
38919  * Checks if two ErrorMessages contain equal inner contents.
38920  * This ignores pointers and is_owned flags and looks at the values in fields.
38921  * Two objects with NULL inner values will be considered "equal" here.
38922  */
38923 bool ErrorMessage_eq(const struct LDKErrorMessage *NONNULL_PTR a, const struct LDKErrorMessage *NONNULL_PTR b);
38924
38925 /**
38926  * Frees any resources used by the WarningMessage, if is_owned is set and inner is non-NULL.
38927  */
38928 void WarningMessage_free(struct LDKWarningMessage this_obj);
38929
38930 /**
38931  * The channel ID involved in the warning.
38932  *
38933  * All-0s indicates a warning unrelated to a specific channel.
38934  */
38935 struct LDKChannelId WarningMessage_get_channel_id(const struct LDKWarningMessage *NONNULL_PTR this_ptr);
38936
38937 /**
38938  * The channel ID involved in the warning.
38939  *
38940  * All-0s indicates a warning unrelated to a specific channel.
38941  */
38942 void WarningMessage_set_channel_id(struct LDKWarningMessage *NONNULL_PTR this_ptr, struct LDKChannelId val);
38943
38944 /**
38945  * A possibly human-readable warning description.
38946  *
38947  * The string should be sanitized before it is used (e.g. emitted to logs or printed to
38948  * stdout). Otherwise, a well crafted error message may trigger a security vulnerability in
38949  * the terminal emulator or the logging subsystem.
38950  */
38951 struct LDKStr WarningMessage_get_data(const struct LDKWarningMessage *NONNULL_PTR this_ptr);
38952
38953 /**
38954  * A possibly human-readable warning description.
38955  *
38956  * The string should be sanitized before it is used (e.g. emitted to logs or printed to
38957  * stdout). Otherwise, a well crafted error message may trigger a security vulnerability in
38958  * the terminal emulator or the logging subsystem.
38959  */
38960 void WarningMessage_set_data(struct LDKWarningMessage *NONNULL_PTR this_ptr, struct LDKStr val);
38961
38962 /**
38963  * Constructs a new WarningMessage given each field
38964  */
38965 MUST_USE_RES struct LDKWarningMessage WarningMessage_new(struct LDKChannelId channel_id_arg, struct LDKStr data_arg);
38966
38967 /**
38968  * Creates a copy of the WarningMessage
38969  */
38970 struct LDKWarningMessage WarningMessage_clone(const struct LDKWarningMessage *NONNULL_PTR orig);
38971
38972 /**
38973  * Generates a non-cryptographic 64-bit hash of the WarningMessage.
38974  */
38975 uint64_t WarningMessage_hash(const struct LDKWarningMessage *NONNULL_PTR o);
38976
38977 /**
38978  * Checks if two WarningMessages contain equal inner contents.
38979  * This ignores pointers and is_owned flags and looks at the values in fields.
38980  * Two objects with NULL inner values will be considered "equal" here.
38981  */
38982 bool WarningMessage_eq(const struct LDKWarningMessage *NONNULL_PTR a, const struct LDKWarningMessage *NONNULL_PTR b);
38983
38984 /**
38985  * Frees any resources used by the Ping, if is_owned is set and inner is non-NULL.
38986  */
38987 void Ping_free(struct LDKPing this_obj);
38988
38989 /**
38990  * The desired response length.
38991  */
38992 uint16_t Ping_get_ponglen(const struct LDKPing *NONNULL_PTR this_ptr);
38993
38994 /**
38995  * The desired response length.
38996  */
38997 void Ping_set_ponglen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
38998
38999 /**
39000  * The ping packet size.
39001  *
39002  * This field is not sent on the wire. byteslen zeros are sent.
39003  */
39004 uint16_t Ping_get_byteslen(const struct LDKPing *NONNULL_PTR this_ptr);
39005
39006 /**
39007  * The ping packet size.
39008  *
39009  * This field is not sent on the wire. byteslen zeros are sent.
39010  */
39011 void Ping_set_byteslen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
39012
39013 /**
39014  * Constructs a new Ping given each field
39015  */
39016 MUST_USE_RES struct LDKPing Ping_new(uint16_t ponglen_arg, uint16_t byteslen_arg);
39017
39018 /**
39019  * Creates a copy of the Ping
39020  */
39021 struct LDKPing Ping_clone(const struct LDKPing *NONNULL_PTR orig);
39022
39023 /**
39024  * Generates a non-cryptographic 64-bit hash of the Ping.
39025  */
39026 uint64_t Ping_hash(const struct LDKPing *NONNULL_PTR o);
39027
39028 /**
39029  * Checks if two Pings contain equal inner contents.
39030  * This ignores pointers and is_owned flags and looks at the values in fields.
39031  * Two objects with NULL inner values will be considered "equal" here.
39032  */
39033 bool Ping_eq(const struct LDKPing *NONNULL_PTR a, const struct LDKPing *NONNULL_PTR b);
39034
39035 /**
39036  * Frees any resources used by the Pong, if is_owned is set and inner is non-NULL.
39037  */
39038 void Pong_free(struct LDKPong this_obj);
39039
39040 /**
39041  * The pong packet size.
39042  *
39043  * This field is not sent on the wire. byteslen zeros are sent.
39044  */
39045 uint16_t Pong_get_byteslen(const struct LDKPong *NONNULL_PTR this_ptr);
39046
39047 /**
39048  * The pong packet size.
39049  *
39050  * This field is not sent on the wire. byteslen zeros are sent.
39051  */
39052 void Pong_set_byteslen(struct LDKPong *NONNULL_PTR this_ptr, uint16_t val);
39053
39054 /**
39055  * Constructs a new Pong given each field
39056  */
39057 MUST_USE_RES struct LDKPong Pong_new(uint16_t byteslen_arg);
39058
39059 /**
39060  * Creates a copy of the Pong
39061  */
39062 struct LDKPong Pong_clone(const struct LDKPong *NONNULL_PTR orig);
39063
39064 /**
39065  * Generates a non-cryptographic 64-bit hash of the Pong.
39066  */
39067 uint64_t Pong_hash(const struct LDKPong *NONNULL_PTR o);
39068
39069 /**
39070  * Checks if two Pongs contain equal inner contents.
39071  * This ignores pointers and is_owned flags and looks at the values in fields.
39072  * Two objects with NULL inner values will be considered "equal" here.
39073  */
39074 bool Pong_eq(const struct LDKPong *NONNULL_PTR a, const struct LDKPong *NONNULL_PTR b);
39075
39076 /**
39077  * Frees any resources used by the CommonOpenChannelFields, if is_owned is set and inner is non-NULL.
39078  */
39079 void CommonOpenChannelFields_free(struct LDKCommonOpenChannelFields this_obj);
39080
39081 /**
39082  * The genesis hash of the blockchain where the channel is to be opened
39083  */
39084 const uint8_t (*CommonOpenChannelFields_get_chain_hash(const struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr))[32];
39085
39086 /**
39087  * The genesis hash of the blockchain where the channel is to be opened
39088  */
39089 void CommonOpenChannelFields_set_chain_hash(struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
39090
39091 /**
39092  * A temporary channel ID
39093  * For V2 channels: derived using a zeroed out value for the channel acceptor's revocation basepoint
39094  * For V1 channels: a temporary channel ID, until the funding outpoint is announced
39095  */
39096 struct LDKChannelId CommonOpenChannelFields_get_temporary_channel_id(const struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr);
39097
39098 /**
39099  * A temporary channel ID
39100  * For V2 channels: derived using a zeroed out value for the channel acceptor's revocation basepoint
39101  * For V1 channels: a temporary channel ID, until the funding outpoint is announced
39102  */
39103 void CommonOpenChannelFields_set_temporary_channel_id(struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr, struct LDKChannelId val);
39104
39105 /**
39106  * For V1 channels: The channel value
39107  * For V2 channels: Part of the channel value contributed by the channel initiator
39108  */
39109 uint64_t CommonOpenChannelFields_get_funding_satoshis(const struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr);
39110
39111 /**
39112  * For V1 channels: The channel value
39113  * For V2 channels: Part of the channel value contributed by the channel initiator
39114  */
39115 void CommonOpenChannelFields_set_funding_satoshis(struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr, uint64_t val);
39116
39117 /**
39118  * The threshold below which outputs on transactions broadcast by the channel initiator will be
39119  * omitted
39120  */
39121 uint64_t CommonOpenChannelFields_get_dust_limit_satoshis(const struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr);
39122
39123 /**
39124  * The threshold below which outputs on transactions broadcast by the channel initiator will be
39125  * omitted
39126  */
39127 void CommonOpenChannelFields_set_dust_limit_satoshis(struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr, uint64_t val);
39128
39129 /**
39130  * The maximum inbound HTLC value in flight towards channel initiator, in milli-satoshi
39131  */
39132 uint64_t CommonOpenChannelFields_get_max_htlc_value_in_flight_msat(const struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr);
39133
39134 /**
39135  * The maximum inbound HTLC value in flight towards channel initiator, in milli-satoshi
39136  */
39137 void CommonOpenChannelFields_set_max_htlc_value_in_flight_msat(struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr, uint64_t val);
39138
39139 /**
39140  * The minimum HTLC size incoming to channel initiator, in milli-satoshi
39141  */
39142 uint64_t CommonOpenChannelFields_get_htlc_minimum_msat(const struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr);
39143
39144 /**
39145  * The minimum HTLC size incoming to channel initiator, in milli-satoshi
39146  */
39147 void CommonOpenChannelFields_set_htlc_minimum_msat(struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr, uint64_t val);
39148
39149 /**
39150  * The feerate for the commitment transaction set by the channel initiator until updated by
39151  * [`UpdateFee`]
39152  */
39153 uint32_t CommonOpenChannelFields_get_commitment_feerate_sat_per_1000_weight(const struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr);
39154
39155 /**
39156  * The feerate for the commitment transaction set by the channel initiator until updated by
39157  * [`UpdateFee`]
39158  */
39159 void CommonOpenChannelFields_set_commitment_feerate_sat_per_1000_weight(struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr, uint32_t val);
39160
39161 /**
39162  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they
39163  * broadcast a commitment transaction
39164  */
39165 uint16_t CommonOpenChannelFields_get_to_self_delay(const struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr);
39166
39167 /**
39168  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they
39169  * broadcast a commitment transaction
39170  */
39171 void CommonOpenChannelFields_set_to_self_delay(struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr, uint16_t val);
39172
39173 /**
39174  * The maximum number of inbound HTLCs towards channel initiator
39175  */
39176 uint16_t CommonOpenChannelFields_get_max_accepted_htlcs(const struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr);
39177
39178 /**
39179  * The maximum number of inbound HTLCs towards channel initiator
39180  */
39181 void CommonOpenChannelFields_set_max_accepted_htlcs(struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr, uint16_t val);
39182
39183 /**
39184  * The channel initiator's key controlling the funding transaction
39185  */
39186 struct LDKPublicKey CommonOpenChannelFields_get_funding_pubkey(const struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr);
39187
39188 /**
39189  * The channel initiator's key controlling the funding transaction
39190  */
39191 void CommonOpenChannelFields_set_funding_pubkey(struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr, struct LDKPublicKey val);
39192
39193 /**
39194  * Used to derive a revocation key for transactions broadcast by counterparty
39195  */
39196 struct LDKPublicKey CommonOpenChannelFields_get_revocation_basepoint(const struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr);
39197
39198 /**
39199  * Used to derive a revocation key for transactions broadcast by counterparty
39200  */
39201 void CommonOpenChannelFields_set_revocation_basepoint(struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr, struct LDKPublicKey val);
39202
39203 /**
39204  * A payment key to channel initiator for transactions broadcast by counterparty
39205  */
39206 struct LDKPublicKey CommonOpenChannelFields_get_payment_basepoint(const struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr);
39207
39208 /**
39209  * A payment key to channel initiator for transactions broadcast by counterparty
39210  */
39211 void CommonOpenChannelFields_set_payment_basepoint(struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr, struct LDKPublicKey val);
39212
39213 /**
39214  * Used to derive a payment key to channel initiator for transactions broadcast by channel
39215  * initiator
39216  */
39217 struct LDKPublicKey CommonOpenChannelFields_get_delayed_payment_basepoint(const struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr);
39218
39219 /**
39220  * Used to derive a payment key to channel initiator for transactions broadcast by channel
39221  * initiator
39222  */
39223 void CommonOpenChannelFields_set_delayed_payment_basepoint(struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr, struct LDKPublicKey val);
39224
39225 /**
39226  * Used to derive an HTLC payment key to channel initiator
39227  */
39228 struct LDKPublicKey CommonOpenChannelFields_get_htlc_basepoint(const struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr);
39229
39230 /**
39231  * Used to derive an HTLC payment key to channel initiator
39232  */
39233 void CommonOpenChannelFields_set_htlc_basepoint(struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr, struct LDKPublicKey val);
39234
39235 /**
39236  * The first to-be-broadcast-by-channel-initiator transaction's per commitment point
39237  */
39238 struct LDKPublicKey CommonOpenChannelFields_get_first_per_commitment_point(const struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr);
39239
39240 /**
39241  * The first to-be-broadcast-by-channel-initiator transaction's per commitment point
39242  */
39243 void CommonOpenChannelFields_set_first_per_commitment_point(struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr, struct LDKPublicKey val);
39244
39245 /**
39246  * The channel flags to be used
39247  */
39248 uint8_t CommonOpenChannelFields_get_channel_flags(const struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr);
39249
39250 /**
39251  * The channel flags to be used
39252  */
39253 void CommonOpenChannelFields_set_channel_flags(struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr, uint8_t val);
39254
39255 /**
39256  * Optionally, a request to pre-set the to-channel-initiator output's scriptPubkey for when we
39257  * collaboratively close
39258  */
39259 struct LDKCOption_CVec_u8ZZ CommonOpenChannelFields_get_shutdown_scriptpubkey(const struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr);
39260
39261 /**
39262  * Optionally, a request to pre-set the to-channel-initiator output's scriptPubkey for when we
39263  * collaboratively close
39264  */
39265 void CommonOpenChannelFields_set_shutdown_scriptpubkey(struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr, struct LDKCOption_CVec_u8ZZ val);
39266
39267 /**
39268  * The channel type that this channel will represent
39269  *
39270  * If this is `None`, we derive the channel type from the intersection of our
39271  * feature bits with our counterparty's feature bits from the [`Init`] message.
39272  *
39273  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
39274  */
39275 struct LDKChannelTypeFeatures CommonOpenChannelFields_get_channel_type(const struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr);
39276
39277 /**
39278  * The channel type that this channel will represent
39279  *
39280  * If this is `None`, we derive the channel type from the intersection of our
39281  * feature bits with our counterparty's feature bits from the [`Init`] message.
39282  *
39283  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
39284  */
39285 void CommonOpenChannelFields_set_channel_type(struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr, struct LDKChannelTypeFeatures val);
39286
39287 /**
39288  * Constructs a new CommonOpenChannelFields given each field
39289  *
39290  * Note that channel_type_arg (or a relevant inner pointer) may be NULL or all-0s to represent None
39291  */
39292 MUST_USE_RES struct LDKCommonOpenChannelFields CommonOpenChannelFields_new(struct LDKThirtyTwoBytes chain_hash_arg, struct LDKChannelId 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 commitment_feerate_sat_per_1000_weight_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, uint8_t channel_flags_arg, struct LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg, struct LDKChannelTypeFeatures channel_type_arg);
39293
39294 /**
39295  * Creates a copy of the CommonOpenChannelFields
39296  */
39297 struct LDKCommonOpenChannelFields CommonOpenChannelFields_clone(const struct LDKCommonOpenChannelFields *NONNULL_PTR orig);
39298
39299 /**
39300  * Generates a non-cryptographic 64-bit hash of the CommonOpenChannelFields.
39301  */
39302 uint64_t CommonOpenChannelFields_hash(const struct LDKCommonOpenChannelFields *NONNULL_PTR o);
39303
39304 /**
39305  * Checks if two CommonOpenChannelFieldss contain equal inner contents.
39306  * This ignores pointers and is_owned flags and looks at the values in fields.
39307  * Two objects with NULL inner values will be considered "equal" here.
39308  */
39309 bool CommonOpenChannelFields_eq(const struct LDKCommonOpenChannelFields *NONNULL_PTR a, const struct LDKCommonOpenChannelFields *NONNULL_PTR b);
39310
39311 /**
39312  * Frees any resources used by the OpenChannel, if is_owned is set and inner is non-NULL.
39313  */
39314 void OpenChannel_free(struct LDKOpenChannel this_obj);
39315
39316 /**
39317  * Common fields of `open_channel(2)`-like messages
39318  */
39319 struct LDKCommonOpenChannelFields OpenChannel_get_common_fields(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
39320
39321 /**
39322  * Common fields of `open_channel(2)`-like messages
39323  */
39324 void OpenChannel_set_common_fields(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKCommonOpenChannelFields val);
39325
39326 /**
39327  * The amount to push to the counterparty as part of the open, in milli-satoshi
39328  */
39329 uint64_t OpenChannel_get_push_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
39330
39331 /**
39332  * The amount to push to the counterparty as part of the open, in milli-satoshi
39333  */
39334 void OpenChannel_set_push_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
39335
39336 /**
39337  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
39338  */
39339 uint64_t OpenChannel_get_channel_reserve_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
39340
39341 /**
39342  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
39343  */
39344 void OpenChannel_set_channel_reserve_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
39345
39346 /**
39347  * Constructs a new OpenChannel given each field
39348  */
39349 MUST_USE_RES struct LDKOpenChannel OpenChannel_new(struct LDKCommonOpenChannelFields common_fields_arg, uint64_t push_msat_arg, uint64_t channel_reserve_satoshis_arg);
39350
39351 /**
39352  * Creates a copy of the OpenChannel
39353  */
39354 struct LDKOpenChannel OpenChannel_clone(const struct LDKOpenChannel *NONNULL_PTR orig);
39355
39356 /**
39357  * Generates a non-cryptographic 64-bit hash of the OpenChannel.
39358  */
39359 uint64_t OpenChannel_hash(const struct LDKOpenChannel *NONNULL_PTR o);
39360
39361 /**
39362  * Checks if two OpenChannels contain equal inner contents.
39363  * This ignores pointers and is_owned flags and looks at the values in fields.
39364  * Two objects with NULL inner values will be considered "equal" here.
39365  */
39366 bool OpenChannel_eq(const struct LDKOpenChannel *NONNULL_PTR a, const struct LDKOpenChannel *NONNULL_PTR b);
39367
39368 /**
39369  * Frees any resources used by the OpenChannelV2, if is_owned is set and inner is non-NULL.
39370  */
39371 void OpenChannelV2_free(struct LDKOpenChannelV2 this_obj);
39372
39373 /**
39374  * Common fields of `open_channel(2)`-like messages
39375  */
39376 struct LDKCommonOpenChannelFields OpenChannelV2_get_common_fields(const struct LDKOpenChannelV2 *NONNULL_PTR this_ptr);
39377
39378 /**
39379  * Common fields of `open_channel(2)`-like messages
39380  */
39381 void OpenChannelV2_set_common_fields(struct LDKOpenChannelV2 *NONNULL_PTR this_ptr, struct LDKCommonOpenChannelFields val);
39382
39383 /**
39384  * The feerate for the funding transaction set by the channel initiator
39385  */
39386 uint32_t OpenChannelV2_get_funding_feerate_sat_per_1000_weight(const struct LDKOpenChannelV2 *NONNULL_PTR this_ptr);
39387
39388 /**
39389  * The feerate for the funding transaction set by the channel initiator
39390  */
39391 void OpenChannelV2_set_funding_feerate_sat_per_1000_weight(struct LDKOpenChannelV2 *NONNULL_PTR this_ptr, uint32_t val);
39392
39393 /**
39394  * The locktime for the funding transaction
39395  */
39396 uint32_t OpenChannelV2_get_locktime(const struct LDKOpenChannelV2 *NONNULL_PTR this_ptr);
39397
39398 /**
39399  * The locktime for the funding transaction
39400  */
39401 void OpenChannelV2_set_locktime(struct LDKOpenChannelV2 *NONNULL_PTR this_ptr, uint32_t val);
39402
39403 /**
39404  * The second to-be-broadcast-by-channel-initiator transaction's per commitment point
39405  */
39406 struct LDKPublicKey OpenChannelV2_get_second_per_commitment_point(const struct LDKOpenChannelV2 *NONNULL_PTR this_ptr);
39407
39408 /**
39409  * The second to-be-broadcast-by-channel-initiator transaction's per commitment point
39410  */
39411 void OpenChannelV2_set_second_per_commitment_point(struct LDKOpenChannelV2 *NONNULL_PTR this_ptr, struct LDKPublicKey val);
39412
39413 /**
39414  * Optionally, a requirement that only confirmed inputs can be added
39415  */
39416 enum LDKCOption_NoneZ OpenChannelV2_get_require_confirmed_inputs(const struct LDKOpenChannelV2 *NONNULL_PTR this_ptr);
39417
39418 /**
39419  * Optionally, a requirement that only confirmed inputs can be added
39420  */
39421 void OpenChannelV2_set_require_confirmed_inputs(struct LDKOpenChannelV2 *NONNULL_PTR this_ptr, enum LDKCOption_NoneZ val);
39422
39423 /**
39424  * Constructs a new OpenChannelV2 given each field
39425  */
39426 MUST_USE_RES struct LDKOpenChannelV2 OpenChannelV2_new(struct LDKCommonOpenChannelFields common_fields_arg, uint32_t funding_feerate_sat_per_1000_weight_arg, uint32_t locktime_arg, struct LDKPublicKey second_per_commitment_point_arg, enum LDKCOption_NoneZ require_confirmed_inputs_arg);
39427
39428 /**
39429  * Creates a copy of the OpenChannelV2
39430  */
39431 struct LDKOpenChannelV2 OpenChannelV2_clone(const struct LDKOpenChannelV2 *NONNULL_PTR orig);
39432
39433 /**
39434  * Generates a non-cryptographic 64-bit hash of the OpenChannelV2.
39435  */
39436 uint64_t OpenChannelV2_hash(const struct LDKOpenChannelV2 *NONNULL_PTR o);
39437
39438 /**
39439  * Checks if two OpenChannelV2s contain equal inner contents.
39440  * This ignores pointers and is_owned flags and looks at the values in fields.
39441  * Two objects with NULL inner values will be considered "equal" here.
39442  */
39443 bool OpenChannelV2_eq(const struct LDKOpenChannelV2 *NONNULL_PTR a, const struct LDKOpenChannelV2 *NONNULL_PTR b);
39444
39445 /**
39446  * Frees any resources used by the CommonAcceptChannelFields, if is_owned is set and inner is non-NULL.
39447  */
39448 void CommonAcceptChannelFields_free(struct LDKCommonAcceptChannelFields this_obj);
39449
39450 /**
39451  * The same `temporary_channel_id` received from the initiator's `open_channel2` or `open_channel` message.
39452  */
39453 struct LDKChannelId CommonAcceptChannelFields_get_temporary_channel_id(const struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr);
39454
39455 /**
39456  * The same `temporary_channel_id` received from the initiator's `open_channel2` or `open_channel` message.
39457  */
39458 void CommonAcceptChannelFields_set_temporary_channel_id(struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr, struct LDKChannelId val);
39459
39460 /**
39461  * The threshold below which outputs on transactions broadcast by the channel acceptor will be
39462  * omitted
39463  */
39464 uint64_t CommonAcceptChannelFields_get_dust_limit_satoshis(const struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr);
39465
39466 /**
39467  * The threshold below which outputs on transactions broadcast by the channel acceptor will be
39468  * omitted
39469  */
39470 void CommonAcceptChannelFields_set_dust_limit_satoshis(struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr, uint64_t val);
39471
39472 /**
39473  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
39474  */
39475 uint64_t CommonAcceptChannelFields_get_max_htlc_value_in_flight_msat(const struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr);
39476
39477 /**
39478  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
39479  */
39480 void CommonAcceptChannelFields_set_max_htlc_value_in_flight_msat(struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr, uint64_t val);
39481
39482 /**
39483  * The minimum HTLC size incoming to channel acceptor, in milli-satoshi
39484  */
39485 uint64_t CommonAcceptChannelFields_get_htlc_minimum_msat(const struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr);
39486
39487 /**
39488  * The minimum HTLC size incoming to channel acceptor, in milli-satoshi
39489  */
39490 void CommonAcceptChannelFields_set_htlc_minimum_msat(struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr, uint64_t val);
39491
39492 /**
39493  * Minimum depth of the funding transaction before the channel is considered open
39494  */
39495 uint32_t CommonAcceptChannelFields_get_minimum_depth(const struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr);
39496
39497 /**
39498  * Minimum depth of the funding transaction before the channel is considered open
39499  */
39500 void CommonAcceptChannelFields_set_minimum_depth(struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr, uint32_t val);
39501
39502 /**
39503  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they
39504  * broadcast a commitment transaction
39505  */
39506 uint16_t CommonAcceptChannelFields_get_to_self_delay(const struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr);
39507
39508 /**
39509  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they
39510  * broadcast a commitment transaction
39511  */
39512 void CommonAcceptChannelFields_set_to_self_delay(struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr, uint16_t val);
39513
39514 /**
39515  * The maximum number of inbound HTLCs towards channel acceptor
39516  */
39517 uint16_t CommonAcceptChannelFields_get_max_accepted_htlcs(const struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr);
39518
39519 /**
39520  * The maximum number of inbound HTLCs towards channel acceptor
39521  */
39522 void CommonAcceptChannelFields_set_max_accepted_htlcs(struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr, uint16_t val);
39523
39524 /**
39525  * The channel acceptor's key controlling the funding transaction
39526  */
39527 struct LDKPublicKey CommonAcceptChannelFields_get_funding_pubkey(const struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr);
39528
39529 /**
39530  * The channel acceptor's key controlling the funding transaction
39531  */
39532 void CommonAcceptChannelFields_set_funding_pubkey(struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr, struct LDKPublicKey val);
39533
39534 /**
39535  * Used to derive a revocation key for transactions broadcast by counterparty
39536  */
39537 struct LDKPublicKey CommonAcceptChannelFields_get_revocation_basepoint(const struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr);
39538
39539 /**
39540  * Used to derive a revocation key for transactions broadcast by counterparty
39541  */
39542 void CommonAcceptChannelFields_set_revocation_basepoint(struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr, struct LDKPublicKey val);
39543
39544 /**
39545  * A payment key to channel acceptor for transactions broadcast by counterparty
39546  */
39547 struct LDKPublicKey CommonAcceptChannelFields_get_payment_basepoint(const struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr);
39548
39549 /**
39550  * A payment key to channel acceptor for transactions broadcast by counterparty
39551  */
39552 void CommonAcceptChannelFields_set_payment_basepoint(struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr, struct LDKPublicKey val);
39553
39554 /**
39555  * Used to derive a payment key to channel acceptor for transactions broadcast by channel
39556  * acceptor
39557  */
39558 struct LDKPublicKey CommonAcceptChannelFields_get_delayed_payment_basepoint(const struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr);
39559
39560 /**
39561  * Used to derive a payment key to channel acceptor for transactions broadcast by channel
39562  * acceptor
39563  */
39564 void CommonAcceptChannelFields_set_delayed_payment_basepoint(struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr, struct LDKPublicKey val);
39565
39566 /**
39567  * Used to derive an HTLC payment key to channel acceptor for transactions broadcast by counterparty
39568  */
39569 struct LDKPublicKey CommonAcceptChannelFields_get_htlc_basepoint(const struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr);
39570
39571 /**
39572  * Used to derive an HTLC payment key to channel acceptor for transactions broadcast by counterparty
39573  */
39574 void CommonAcceptChannelFields_set_htlc_basepoint(struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr, struct LDKPublicKey val);
39575
39576 /**
39577  * The first to-be-broadcast-by-channel-acceptor transaction's per commitment point
39578  */
39579 struct LDKPublicKey CommonAcceptChannelFields_get_first_per_commitment_point(const struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr);
39580
39581 /**
39582  * The first to-be-broadcast-by-channel-acceptor transaction's per commitment point
39583  */
39584 void CommonAcceptChannelFields_set_first_per_commitment_point(struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr, struct LDKPublicKey val);
39585
39586 /**
39587  * Optionally, a request to pre-set the to-channel-acceptor output's scriptPubkey for when we
39588  * collaboratively close
39589  */
39590 struct LDKCOption_CVec_u8ZZ CommonAcceptChannelFields_get_shutdown_scriptpubkey(const struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr);
39591
39592 /**
39593  * Optionally, a request to pre-set the to-channel-acceptor output's scriptPubkey for when we
39594  * collaboratively close
39595  */
39596 void CommonAcceptChannelFields_set_shutdown_scriptpubkey(struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr, struct LDKCOption_CVec_u8ZZ val);
39597
39598 /**
39599  * The channel type that this channel will represent. If none is set, we derive the channel
39600  * type from the intersection of our feature bits with our counterparty's feature bits from
39601  * the Init message.
39602  *
39603  * This is required to match the equivalent field in [`OpenChannel`] or [`OpenChannelV2`]'s
39604  * [`CommonOpenChannelFields::channel_type`].
39605  *
39606  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
39607  */
39608 struct LDKChannelTypeFeatures CommonAcceptChannelFields_get_channel_type(const struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr);
39609
39610 /**
39611  * The channel type that this channel will represent. If none is set, we derive the channel
39612  * type from the intersection of our feature bits with our counterparty's feature bits from
39613  * the Init message.
39614  *
39615  * This is required to match the equivalent field in [`OpenChannel`] or [`OpenChannelV2`]'s
39616  * [`CommonOpenChannelFields::channel_type`].
39617  *
39618  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
39619  */
39620 void CommonAcceptChannelFields_set_channel_type(struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr, struct LDKChannelTypeFeatures val);
39621
39622 /**
39623  * Constructs a new CommonAcceptChannelFields given each field
39624  *
39625  * Note that channel_type_arg (or a relevant inner pointer) may be NULL or all-0s to represent None
39626  */
39627 MUST_USE_RES struct LDKCommonAcceptChannelFields CommonAcceptChannelFields_new(struct LDKChannelId temporary_channel_id_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 LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg, struct LDKChannelTypeFeatures channel_type_arg);
39628
39629 /**
39630  * Creates a copy of the CommonAcceptChannelFields
39631  */
39632 struct LDKCommonAcceptChannelFields CommonAcceptChannelFields_clone(const struct LDKCommonAcceptChannelFields *NONNULL_PTR orig);
39633
39634 /**
39635  * Generates a non-cryptographic 64-bit hash of the CommonAcceptChannelFields.
39636  */
39637 uint64_t CommonAcceptChannelFields_hash(const struct LDKCommonAcceptChannelFields *NONNULL_PTR o);
39638
39639 /**
39640  * Checks if two CommonAcceptChannelFieldss contain equal inner contents.
39641  * This ignores pointers and is_owned flags and looks at the values in fields.
39642  * Two objects with NULL inner values will be considered "equal" here.
39643  */
39644 bool CommonAcceptChannelFields_eq(const struct LDKCommonAcceptChannelFields *NONNULL_PTR a, const struct LDKCommonAcceptChannelFields *NONNULL_PTR b);
39645
39646 /**
39647  * Frees any resources used by the AcceptChannel, if is_owned is set and inner is non-NULL.
39648  */
39649 void AcceptChannel_free(struct LDKAcceptChannel this_obj);
39650
39651 /**
39652  * Common fields of `accept_channel(2)`-like messages
39653  */
39654 struct LDKCommonAcceptChannelFields AcceptChannel_get_common_fields(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
39655
39656 /**
39657  * Common fields of `accept_channel(2)`-like messages
39658  */
39659 void AcceptChannel_set_common_fields(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKCommonAcceptChannelFields val);
39660
39661 /**
39662  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
39663  */
39664 uint64_t AcceptChannel_get_channel_reserve_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
39665
39666 /**
39667  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
39668  */
39669 void AcceptChannel_set_channel_reserve_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
39670
39671 /**
39672  * Constructs a new AcceptChannel given each field
39673  */
39674 MUST_USE_RES struct LDKAcceptChannel AcceptChannel_new(struct LDKCommonAcceptChannelFields common_fields_arg, uint64_t channel_reserve_satoshis_arg);
39675
39676 /**
39677  * Creates a copy of the AcceptChannel
39678  */
39679 struct LDKAcceptChannel AcceptChannel_clone(const struct LDKAcceptChannel *NONNULL_PTR orig);
39680
39681 /**
39682  * Generates a non-cryptographic 64-bit hash of the AcceptChannel.
39683  */
39684 uint64_t AcceptChannel_hash(const struct LDKAcceptChannel *NONNULL_PTR o);
39685
39686 /**
39687  * Checks if two AcceptChannels contain equal inner contents.
39688  * This ignores pointers and is_owned flags and looks at the values in fields.
39689  * Two objects with NULL inner values will be considered "equal" here.
39690  */
39691 bool AcceptChannel_eq(const struct LDKAcceptChannel *NONNULL_PTR a, const struct LDKAcceptChannel *NONNULL_PTR b);
39692
39693 /**
39694  * Frees any resources used by the AcceptChannelV2, if is_owned is set and inner is non-NULL.
39695  */
39696 void AcceptChannelV2_free(struct LDKAcceptChannelV2 this_obj);
39697
39698 /**
39699  * Common fields of `accept_channel(2)`-like messages
39700  */
39701 struct LDKCommonAcceptChannelFields AcceptChannelV2_get_common_fields(const struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr);
39702
39703 /**
39704  * Common fields of `accept_channel(2)`-like messages
39705  */
39706 void AcceptChannelV2_set_common_fields(struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr, struct LDKCommonAcceptChannelFields val);
39707
39708 /**
39709  * Part of the channel value contributed by the channel acceptor
39710  */
39711 uint64_t AcceptChannelV2_get_funding_satoshis(const struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr);
39712
39713 /**
39714  * Part of the channel value contributed by the channel acceptor
39715  */
39716 void AcceptChannelV2_set_funding_satoshis(struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr, uint64_t val);
39717
39718 /**
39719  * The second to-be-broadcast-by-channel-acceptor transaction's per commitment point
39720  */
39721 struct LDKPublicKey AcceptChannelV2_get_second_per_commitment_point(const struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr);
39722
39723 /**
39724  * The second to-be-broadcast-by-channel-acceptor transaction's per commitment point
39725  */
39726 void AcceptChannelV2_set_second_per_commitment_point(struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr, struct LDKPublicKey val);
39727
39728 /**
39729  * Optionally, a requirement that only confirmed inputs can be added
39730  */
39731 enum LDKCOption_NoneZ AcceptChannelV2_get_require_confirmed_inputs(const struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr);
39732
39733 /**
39734  * Optionally, a requirement that only confirmed inputs can be added
39735  */
39736 void AcceptChannelV2_set_require_confirmed_inputs(struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr, enum LDKCOption_NoneZ val);
39737
39738 /**
39739  * Constructs a new AcceptChannelV2 given each field
39740  */
39741 MUST_USE_RES struct LDKAcceptChannelV2 AcceptChannelV2_new(struct LDKCommonAcceptChannelFields common_fields_arg, uint64_t funding_satoshis_arg, struct LDKPublicKey second_per_commitment_point_arg, enum LDKCOption_NoneZ require_confirmed_inputs_arg);
39742
39743 /**
39744  * Creates a copy of the AcceptChannelV2
39745  */
39746 struct LDKAcceptChannelV2 AcceptChannelV2_clone(const struct LDKAcceptChannelV2 *NONNULL_PTR orig);
39747
39748 /**
39749  * Generates a non-cryptographic 64-bit hash of the AcceptChannelV2.
39750  */
39751 uint64_t AcceptChannelV2_hash(const struct LDKAcceptChannelV2 *NONNULL_PTR o);
39752
39753 /**
39754  * Checks if two AcceptChannelV2s contain equal inner contents.
39755  * This ignores pointers and is_owned flags and looks at the values in fields.
39756  * Two objects with NULL inner values will be considered "equal" here.
39757  */
39758 bool AcceptChannelV2_eq(const struct LDKAcceptChannelV2 *NONNULL_PTR a, const struct LDKAcceptChannelV2 *NONNULL_PTR b);
39759
39760 /**
39761  * Frees any resources used by the FundingCreated, if is_owned is set and inner is non-NULL.
39762  */
39763 void FundingCreated_free(struct LDKFundingCreated this_obj);
39764
39765 /**
39766  * A temporary channel ID, until the funding is established
39767  */
39768 struct LDKChannelId FundingCreated_get_temporary_channel_id(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
39769
39770 /**
39771  * A temporary channel ID, until the funding is established
39772  */
39773 void FundingCreated_set_temporary_channel_id(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKChannelId val);
39774
39775 /**
39776  * The funding transaction ID
39777  */
39778 const uint8_t (*FundingCreated_get_funding_txid(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32];
39779
39780 /**
39781  * The funding transaction ID
39782  */
39783 void FundingCreated_set_funding_txid(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
39784
39785 /**
39786  * The specific output index funding this channel
39787  */
39788 uint16_t FundingCreated_get_funding_output_index(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
39789
39790 /**
39791  * The specific output index funding this channel
39792  */
39793 void FundingCreated_set_funding_output_index(struct LDKFundingCreated *NONNULL_PTR this_ptr, uint16_t val);
39794
39795 /**
39796  * The signature of the channel initiator (funder) on the initial commitment transaction
39797  */
39798 struct LDKECDSASignature FundingCreated_get_signature(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
39799
39800 /**
39801  * The signature of the channel initiator (funder) on the initial commitment transaction
39802  */
39803 void FundingCreated_set_signature(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKECDSASignature val);
39804
39805 /**
39806  * Constructs a new FundingCreated given each field
39807  */
39808 MUST_USE_RES struct LDKFundingCreated FundingCreated_new(struct LDKChannelId temporary_channel_id_arg, struct LDKThirtyTwoBytes funding_txid_arg, uint16_t funding_output_index_arg, struct LDKECDSASignature signature_arg);
39809
39810 /**
39811  * Creates a copy of the FundingCreated
39812  */
39813 struct LDKFundingCreated FundingCreated_clone(const struct LDKFundingCreated *NONNULL_PTR orig);
39814
39815 /**
39816  * Generates a non-cryptographic 64-bit hash of the FundingCreated.
39817  */
39818 uint64_t FundingCreated_hash(const struct LDKFundingCreated *NONNULL_PTR o);
39819
39820 /**
39821  * Checks if two FundingCreateds contain equal inner contents.
39822  * This ignores pointers and is_owned flags and looks at the values in fields.
39823  * Two objects with NULL inner values will be considered "equal" here.
39824  */
39825 bool FundingCreated_eq(const struct LDKFundingCreated *NONNULL_PTR a, const struct LDKFundingCreated *NONNULL_PTR b);
39826
39827 /**
39828  * Frees any resources used by the FundingSigned, if is_owned is set and inner is non-NULL.
39829  */
39830 void FundingSigned_free(struct LDKFundingSigned this_obj);
39831
39832 /**
39833  * The channel ID
39834  */
39835 struct LDKChannelId FundingSigned_get_channel_id(const struct LDKFundingSigned *NONNULL_PTR this_ptr);
39836
39837 /**
39838  * The channel ID
39839  */
39840 void FundingSigned_set_channel_id(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKChannelId val);
39841
39842 /**
39843  * The signature of the channel acceptor (fundee) on the initial commitment transaction
39844  */
39845 struct LDKECDSASignature FundingSigned_get_signature(const struct LDKFundingSigned *NONNULL_PTR this_ptr);
39846
39847 /**
39848  * The signature of the channel acceptor (fundee) on the initial commitment transaction
39849  */
39850 void FundingSigned_set_signature(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKECDSASignature val);
39851
39852 /**
39853  * Constructs a new FundingSigned given each field
39854  */
39855 MUST_USE_RES struct LDKFundingSigned FundingSigned_new(struct LDKChannelId channel_id_arg, struct LDKECDSASignature signature_arg);
39856
39857 /**
39858  * Creates a copy of the FundingSigned
39859  */
39860 struct LDKFundingSigned FundingSigned_clone(const struct LDKFundingSigned *NONNULL_PTR orig);
39861
39862 /**
39863  * Generates a non-cryptographic 64-bit hash of the FundingSigned.
39864  */
39865 uint64_t FundingSigned_hash(const struct LDKFundingSigned *NONNULL_PTR o);
39866
39867 /**
39868  * Checks if two FundingSigneds contain equal inner contents.
39869  * This ignores pointers and is_owned flags and looks at the values in fields.
39870  * Two objects with NULL inner values will be considered "equal" here.
39871  */
39872 bool FundingSigned_eq(const struct LDKFundingSigned *NONNULL_PTR a, const struct LDKFundingSigned *NONNULL_PTR b);
39873
39874 /**
39875  * Frees any resources used by the ChannelReady, if is_owned is set and inner is non-NULL.
39876  */
39877 void ChannelReady_free(struct LDKChannelReady this_obj);
39878
39879 /**
39880  * The channel ID
39881  */
39882 struct LDKChannelId ChannelReady_get_channel_id(const struct LDKChannelReady *NONNULL_PTR this_ptr);
39883
39884 /**
39885  * The channel ID
39886  */
39887 void ChannelReady_set_channel_id(struct LDKChannelReady *NONNULL_PTR this_ptr, struct LDKChannelId val);
39888
39889 /**
39890  * The per-commitment point of the second commitment transaction
39891  */
39892 struct LDKPublicKey ChannelReady_get_next_per_commitment_point(const struct LDKChannelReady *NONNULL_PTR this_ptr);
39893
39894 /**
39895  * The per-commitment point of the second commitment transaction
39896  */
39897 void ChannelReady_set_next_per_commitment_point(struct LDKChannelReady *NONNULL_PTR this_ptr, struct LDKPublicKey val);
39898
39899 /**
39900  * If set, provides a `short_channel_id` alias for this channel.
39901  *
39902  * The sender will accept payments to be forwarded over this SCID and forward them to this
39903  * messages' recipient.
39904  */
39905 struct LDKCOption_u64Z ChannelReady_get_short_channel_id_alias(const struct LDKChannelReady *NONNULL_PTR this_ptr);
39906
39907 /**
39908  * If set, provides a `short_channel_id` alias for this channel.
39909  *
39910  * The sender will accept payments to be forwarded over this SCID and forward them to this
39911  * messages' recipient.
39912  */
39913 void ChannelReady_set_short_channel_id_alias(struct LDKChannelReady *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
39914
39915 /**
39916  * Constructs a new ChannelReady given each field
39917  */
39918 MUST_USE_RES struct LDKChannelReady ChannelReady_new(struct LDKChannelId channel_id_arg, struct LDKPublicKey next_per_commitment_point_arg, struct LDKCOption_u64Z short_channel_id_alias_arg);
39919
39920 /**
39921  * Creates a copy of the ChannelReady
39922  */
39923 struct LDKChannelReady ChannelReady_clone(const struct LDKChannelReady *NONNULL_PTR orig);
39924
39925 /**
39926  * Generates a non-cryptographic 64-bit hash of the ChannelReady.
39927  */
39928 uint64_t ChannelReady_hash(const struct LDKChannelReady *NONNULL_PTR o);
39929
39930 /**
39931  * Checks if two ChannelReadys contain equal inner contents.
39932  * This ignores pointers and is_owned flags and looks at the values in fields.
39933  * Two objects with NULL inner values will be considered "equal" here.
39934  */
39935 bool ChannelReady_eq(const struct LDKChannelReady *NONNULL_PTR a, const struct LDKChannelReady *NONNULL_PTR b);
39936
39937 /**
39938  * Frees any resources used by the Stfu, if is_owned is set and inner is non-NULL.
39939  */
39940 void Stfu_free(struct LDKStfu this_obj);
39941
39942 /**
39943  * The channel ID where quiescence is intended
39944  */
39945 struct LDKChannelId Stfu_get_channel_id(const struct LDKStfu *NONNULL_PTR this_ptr);
39946
39947 /**
39948  * The channel ID where quiescence is intended
39949  */
39950 void Stfu_set_channel_id(struct LDKStfu *NONNULL_PTR this_ptr, struct LDKChannelId val);
39951
39952 /**
39953  * Initiator flag, 1 if initiating, 0 if replying to an stfu.
39954  */
39955 uint8_t Stfu_get_initiator(const struct LDKStfu *NONNULL_PTR this_ptr);
39956
39957 /**
39958  * Initiator flag, 1 if initiating, 0 if replying to an stfu.
39959  */
39960 void Stfu_set_initiator(struct LDKStfu *NONNULL_PTR this_ptr, uint8_t val);
39961
39962 /**
39963  * Constructs a new Stfu given each field
39964  */
39965 MUST_USE_RES struct LDKStfu Stfu_new(struct LDKChannelId channel_id_arg, uint8_t initiator_arg);
39966
39967 /**
39968  * Creates a copy of the Stfu
39969  */
39970 struct LDKStfu Stfu_clone(const struct LDKStfu *NONNULL_PTR orig);
39971
39972 /**
39973  * Checks if two Stfus contain equal inner contents.
39974  * This ignores pointers and is_owned flags and looks at the values in fields.
39975  * Two objects with NULL inner values will be considered "equal" here.
39976  */
39977 bool Stfu_eq(const struct LDKStfu *NONNULL_PTR a, const struct LDKStfu *NONNULL_PTR b);
39978
39979 /**
39980  * Frees any resources used by the Splice, if is_owned is set and inner is non-NULL.
39981  */
39982 void Splice_free(struct LDKSplice this_obj);
39983
39984 /**
39985  * The channel ID where splicing is intended
39986  */
39987 struct LDKChannelId Splice_get_channel_id(const struct LDKSplice *NONNULL_PTR this_ptr);
39988
39989 /**
39990  * The channel ID where splicing is intended
39991  */
39992 void Splice_set_channel_id(struct LDKSplice *NONNULL_PTR this_ptr, struct LDKChannelId val);
39993
39994 /**
39995  * The genesis hash of the blockchain where the channel is intended to be spliced
39996  */
39997 const uint8_t (*Splice_get_chain_hash(const struct LDKSplice *NONNULL_PTR this_ptr))[32];
39998
39999 /**
40000  * The genesis hash of the blockchain where the channel is intended to be spliced
40001  */
40002 void Splice_set_chain_hash(struct LDKSplice *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
40003
40004 /**
40005  * The intended change in channel capacity: the amount to be added (positive value)
40006  * or removed (negative value) by the sender (splice initiator) by splicing into/from the channel.
40007  */
40008 int64_t Splice_get_relative_satoshis(const struct LDKSplice *NONNULL_PTR this_ptr);
40009
40010 /**
40011  * The intended change in channel capacity: the amount to be added (positive value)
40012  * or removed (negative value) by the sender (splice initiator) by splicing into/from the channel.
40013  */
40014 void Splice_set_relative_satoshis(struct LDKSplice *NONNULL_PTR this_ptr, int64_t val);
40015
40016 /**
40017  * The feerate for the new funding transaction, set by the splice initiator
40018  */
40019 uint32_t Splice_get_funding_feerate_perkw(const struct LDKSplice *NONNULL_PTR this_ptr);
40020
40021 /**
40022  * The feerate for the new funding transaction, set by the splice initiator
40023  */
40024 void Splice_set_funding_feerate_perkw(struct LDKSplice *NONNULL_PTR this_ptr, uint32_t val);
40025
40026 /**
40027  * The locktime for the new funding transaction
40028  */
40029 uint32_t Splice_get_locktime(const struct LDKSplice *NONNULL_PTR this_ptr);
40030
40031 /**
40032  * The locktime for the new funding transaction
40033  */
40034 void Splice_set_locktime(struct LDKSplice *NONNULL_PTR this_ptr, uint32_t val);
40035
40036 /**
40037  * The key of the sender (splice initiator) controlling the new funding transaction
40038  */
40039 struct LDKPublicKey Splice_get_funding_pubkey(const struct LDKSplice *NONNULL_PTR this_ptr);
40040
40041 /**
40042  * The key of the sender (splice initiator) controlling the new funding transaction
40043  */
40044 void Splice_set_funding_pubkey(struct LDKSplice *NONNULL_PTR this_ptr, struct LDKPublicKey val);
40045
40046 /**
40047  * Constructs a new Splice given each field
40048  */
40049 MUST_USE_RES struct LDKSplice Splice_new(struct LDKChannelId channel_id_arg, struct LDKThirtyTwoBytes chain_hash_arg, int64_t relative_satoshis_arg, uint32_t funding_feerate_perkw_arg, uint32_t locktime_arg, struct LDKPublicKey funding_pubkey_arg);
40050
40051 /**
40052  * Creates a copy of the Splice
40053  */
40054 struct LDKSplice Splice_clone(const struct LDKSplice *NONNULL_PTR orig);
40055
40056 /**
40057  * Checks if two Splices contain equal inner contents.
40058  * This ignores pointers and is_owned flags and looks at the values in fields.
40059  * Two objects with NULL inner values will be considered "equal" here.
40060  */
40061 bool Splice_eq(const struct LDKSplice *NONNULL_PTR a, const struct LDKSplice *NONNULL_PTR b);
40062
40063 /**
40064  * Frees any resources used by the SpliceAck, if is_owned is set and inner is non-NULL.
40065  */
40066 void SpliceAck_free(struct LDKSpliceAck this_obj);
40067
40068 /**
40069  * The channel ID where splicing is intended
40070  */
40071 struct LDKChannelId SpliceAck_get_channel_id(const struct LDKSpliceAck *NONNULL_PTR this_ptr);
40072
40073 /**
40074  * The channel ID where splicing is intended
40075  */
40076 void SpliceAck_set_channel_id(struct LDKSpliceAck *NONNULL_PTR this_ptr, struct LDKChannelId val);
40077
40078 /**
40079  * The genesis hash of the blockchain where the channel is intended to be spliced
40080  */
40081 const uint8_t (*SpliceAck_get_chain_hash(const struct LDKSpliceAck *NONNULL_PTR this_ptr))[32];
40082
40083 /**
40084  * The genesis hash of the blockchain where the channel is intended to be spliced
40085  */
40086 void SpliceAck_set_chain_hash(struct LDKSpliceAck *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
40087
40088 /**
40089  * The intended change in channel capacity: the amount to be added (positive value)
40090  * or removed (negative value) by the sender (splice acceptor) by splicing into/from the channel.
40091  */
40092 int64_t SpliceAck_get_relative_satoshis(const struct LDKSpliceAck *NONNULL_PTR this_ptr);
40093
40094 /**
40095  * The intended change in channel capacity: the amount to be added (positive value)
40096  * or removed (negative value) by the sender (splice acceptor) by splicing into/from the channel.
40097  */
40098 void SpliceAck_set_relative_satoshis(struct LDKSpliceAck *NONNULL_PTR this_ptr, int64_t val);
40099
40100 /**
40101  * The key of the sender (splice acceptor) controlling the new funding transaction
40102  */
40103 struct LDKPublicKey SpliceAck_get_funding_pubkey(const struct LDKSpliceAck *NONNULL_PTR this_ptr);
40104
40105 /**
40106  * The key of the sender (splice acceptor) controlling the new funding transaction
40107  */
40108 void SpliceAck_set_funding_pubkey(struct LDKSpliceAck *NONNULL_PTR this_ptr, struct LDKPublicKey val);
40109
40110 /**
40111  * Constructs a new SpliceAck given each field
40112  */
40113 MUST_USE_RES struct LDKSpliceAck SpliceAck_new(struct LDKChannelId channel_id_arg, struct LDKThirtyTwoBytes chain_hash_arg, int64_t relative_satoshis_arg, struct LDKPublicKey funding_pubkey_arg);
40114
40115 /**
40116  * Creates a copy of the SpliceAck
40117  */
40118 struct LDKSpliceAck SpliceAck_clone(const struct LDKSpliceAck *NONNULL_PTR orig);
40119
40120 /**
40121  * Checks if two SpliceAcks contain equal inner contents.
40122  * This ignores pointers and is_owned flags and looks at the values in fields.
40123  * Two objects with NULL inner values will be considered "equal" here.
40124  */
40125 bool SpliceAck_eq(const struct LDKSpliceAck *NONNULL_PTR a, const struct LDKSpliceAck *NONNULL_PTR b);
40126
40127 /**
40128  * Frees any resources used by the SpliceLocked, if is_owned is set and inner is non-NULL.
40129  */
40130 void SpliceLocked_free(struct LDKSpliceLocked this_obj);
40131
40132 /**
40133  * The channel ID
40134  */
40135 struct LDKChannelId SpliceLocked_get_channel_id(const struct LDKSpliceLocked *NONNULL_PTR this_ptr);
40136
40137 /**
40138  * The channel ID
40139  */
40140 void SpliceLocked_set_channel_id(struct LDKSpliceLocked *NONNULL_PTR this_ptr, struct LDKChannelId val);
40141
40142 /**
40143  * Constructs a new SpliceLocked given each field
40144  */
40145 MUST_USE_RES struct LDKSpliceLocked SpliceLocked_new(struct LDKChannelId channel_id_arg);
40146
40147 /**
40148  * Creates a copy of the SpliceLocked
40149  */
40150 struct LDKSpliceLocked SpliceLocked_clone(const struct LDKSpliceLocked *NONNULL_PTR orig);
40151
40152 /**
40153  * Checks if two SpliceLockeds contain equal inner contents.
40154  * This ignores pointers and is_owned flags and looks at the values in fields.
40155  * Two objects with NULL inner values will be considered "equal" here.
40156  */
40157 bool SpliceLocked_eq(const struct LDKSpliceLocked *NONNULL_PTR a, const struct LDKSpliceLocked *NONNULL_PTR b);
40158
40159 /**
40160  * Frees any resources used by the TxAddInput, if is_owned is set and inner is non-NULL.
40161  */
40162 void TxAddInput_free(struct LDKTxAddInput this_obj);
40163
40164 /**
40165  * The channel ID
40166  */
40167 struct LDKChannelId TxAddInput_get_channel_id(const struct LDKTxAddInput *NONNULL_PTR this_ptr);
40168
40169 /**
40170  * The channel ID
40171  */
40172 void TxAddInput_set_channel_id(struct LDKTxAddInput *NONNULL_PTR this_ptr, struct LDKChannelId val);
40173
40174 /**
40175  * A randomly chosen unique identifier for this input, which is even for initiators and odd for
40176  * non-initiators.
40177  */
40178 uint64_t TxAddInput_get_serial_id(const struct LDKTxAddInput *NONNULL_PTR this_ptr);
40179
40180 /**
40181  * A randomly chosen unique identifier for this input, which is even for initiators and odd for
40182  * non-initiators.
40183  */
40184 void TxAddInput_set_serial_id(struct LDKTxAddInput *NONNULL_PTR this_ptr, uint64_t val);
40185
40186 /**
40187  * Serialized transaction that contains the output this input spends to verify that it is non
40188  * malleable.
40189  */
40190 struct LDKTransactionU16LenLimited TxAddInput_get_prevtx(const struct LDKTxAddInput *NONNULL_PTR this_ptr);
40191
40192 /**
40193  * Serialized transaction that contains the output this input spends to verify that it is non
40194  * malleable.
40195  */
40196 void TxAddInput_set_prevtx(struct LDKTxAddInput *NONNULL_PTR this_ptr, struct LDKTransactionU16LenLimited val);
40197
40198 /**
40199  * The index of the output being spent
40200  */
40201 uint32_t TxAddInput_get_prevtx_out(const struct LDKTxAddInput *NONNULL_PTR this_ptr);
40202
40203 /**
40204  * The index of the output being spent
40205  */
40206 void TxAddInput_set_prevtx_out(struct LDKTxAddInput *NONNULL_PTR this_ptr, uint32_t val);
40207
40208 /**
40209  * The sequence number of this input
40210  */
40211 uint32_t TxAddInput_get_sequence(const struct LDKTxAddInput *NONNULL_PTR this_ptr);
40212
40213 /**
40214  * The sequence number of this input
40215  */
40216 void TxAddInput_set_sequence(struct LDKTxAddInput *NONNULL_PTR this_ptr, uint32_t val);
40217
40218 /**
40219  * Constructs a new TxAddInput given each field
40220  */
40221 MUST_USE_RES struct LDKTxAddInput TxAddInput_new(struct LDKChannelId channel_id_arg, uint64_t serial_id_arg, struct LDKTransactionU16LenLimited prevtx_arg, uint32_t prevtx_out_arg, uint32_t sequence_arg);
40222
40223 /**
40224  * Creates a copy of the TxAddInput
40225  */
40226 struct LDKTxAddInput TxAddInput_clone(const struct LDKTxAddInput *NONNULL_PTR orig);
40227
40228 /**
40229  * Generates a non-cryptographic 64-bit hash of the TxAddInput.
40230  */
40231 uint64_t TxAddInput_hash(const struct LDKTxAddInput *NONNULL_PTR o);
40232
40233 /**
40234  * Checks if two TxAddInputs contain equal inner contents.
40235  * This ignores pointers and is_owned flags and looks at the values in fields.
40236  * Two objects with NULL inner values will be considered "equal" here.
40237  */
40238 bool TxAddInput_eq(const struct LDKTxAddInput *NONNULL_PTR a, const struct LDKTxAddInput *NONNULL_PTR b);
40239
40240 /**
40241  * Frees any resources used by the TxAddOutput, if is_owned is set and inner is non-NULL.
40242  */
40243 void TxAddOutput_free(struct LDKTxAddOutput this_obj);
40244
40245 /**
40246  * The channel ID
40247  */
40248 struct LDKChannelId TxAddOutput_get_channel_id(const struct LDKTxAddOutput *NONNULL_PTR this_ptr);
40249
40250 /**
40251  * The channel ID
40252  */
40253 void TxAddOutput_set_channel_id(struct LDKTxAddOutput *NONNULL_PTR this_ptr, struct LDKChannelId val);
40254
40255 /**
40256  * A randomly chosen unique identifier for this output, which is even for initiators and odd for
40257  * non-initiators.
40258  */
40259 uint64_t TxAddOutput_get_serial_id(const struct LDKTxAddOutput *NONNULL_PTR this_ptr);
40260
40261 /**
40262  * A randomly chosen unique identifier for this output, which is even for initiators and odd for
40263  * non-initiators.
40264  */
40265 void TxAddOutput_set_serial_id(struct LDKTxAddOutput *NONNULL_PTR this_ptr, uint64_t val);
40266
40267 /**
40268  * The satoshi value of the output
40269  */
40270 uint64_t TxAddOutput_get_sats(const struct LDKTxAddOutput *NONNULL_PTR this_ptr);
40271
40272 /**
40273  * The satoshi value of the output
40274  */
40275 void TxAddOutput_set_sats(struct LDKTxAddOutput *NONNULL_PTR this_ptr, uint64_t val);
40276
40277 /**
40278  * The scriptPubKey for the output
40279  */
40280 struct LDKCVec_u8Z TxAddOutput_get_script(const struct LDKTxAddOutput *NONNULL_PTR this_ptr);
40281
40282 /**
40283  * The scriptPubKey for the output
40284  */
40285 void TxAddOutput_set_script(struct LDKTxAddOutput *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
40286
40287 /**
40288  * Constructs a new TxAddOutput given each field
40289  */
40290 MUST_USE_RES struct LDKTxAddOutput TxAddOutput_new(struct LDKChannelId channel_id_arg, uint64_t serial_id_arg, uint64_t sats_arg, struct LDKCVec_u8Z script_arg);
40291
40292 /**
40293  * Creates a copy of the TxAddOutput
40294  */
40295 struct LDKTxAddOutput TxAddOutput_clone(const struct LDKTxAddOutput *NONNULL_PTR orig);
40296
40297 /**
40298  * Generates a non-cryptographic 64-bit hash of the TxAddOutput.
40299  */
40300 uint64_t TxAddOutput_hash(const struct LDKTxAddOutput *NONNULL_PTR o);
40301
40302 /**
40303  * Checks if two TxAddOutputs contain equal inner contents.
40304  * This ignores pointers and is_owned flags and looks at the values in fields.
40305  * Two objects with NULL inner values will be considered "equal" here.
40306  */
40307 bool TxAddOutput_eq(const struct LDKTxAddOutput *NONNULL_PTR a, const struct LDKTxAddOutput *NONNULL_PTR b);
40308
40309 /**
40310  * Frees any resources used by the TxRemoveInput, if is_owned is set and inner is non-NULL.
40311  */
40312 void TxRemoveInput_free(struct LDKTxRemoveInput this_obj);
40313
40314 /**
40315  * The channel ID
40316  */
40317 struct LDKChannelId TxRemoveInput_get_channel_id(const struct LDKTxRemoveInput *NONNULL_PTR this_ptr);
40318
40319 /**
40320  * The channel ID
40321  */
40322 void TxRemoveInput_set_channel_id(struct LDKTxRemoveInput *NONNULL_PTR this_ptr, struct LDKChannelId val);
40323
40324 /**
40325  * The serial ID of the input to be removed
40326  */
40327 uint64_t TxRemoveInput_get_serial_id(const struct LDKTxRemoveInput *NONNULL_PTR this_ptr);
40328
40329 /**
40330  * The serial ID of the input to be removed
40331  */
40332 void TxRemoveInput_set_serial_id(struct LDKTxRemoveInput *NONNULL_PTR this_ptr, uint64_t val);
40333
40334 /**
40335  * Constructs a new TxRemoveInput given each field
40336  */
40337 MUST_USE_RES struct LDKTxRemoveInput TxRemoveInput_new(struct LDKChannelId channel_id_arg, uint64_t serial_id_arg);
40338
40339 /**
40340  * Creates a copy of the TxRemoveInput
40341  */
40342 struct LDKTxRemoveInput TxRemoveInput_clone(const struct LDKTxRemoveInput *NONNULL_PTR orig);
40343
40344 /**
40345  * Generates a non-cryptographic 64-bit hash of the TxRemoveInput.
40346  */
40347 uint64_t TxRemoveInput_hash(const struct LDKTxRemoveInput *NONNULL_PTR o);
40348
40349 /**
40350  * Checks if two TxRemoveInputs contain equal inner contents.
40351  * This ignores pointers and is_owned flags and looks at the values in fields.
40352  * Two objects with NULL inner values will be considered "equal" here.
40353  */
40354 bool TxRemoveInput_eq(const struct LDKTxRemoveInput *NONNULL_PTR a, const struct LDKTxRemoveInput *NONNULL_PTR b);
40355
40356 /**
40357  * Frees any resources used by the TxRemoveOutput, if is_owned is set and inner is non-NULL.
40358  */
40359 void TxRemoveOutput_free(struct LDKTxRemoveOutput this_obj);
40360
40361 /**
40362  * The channel ID
40363  */
40364 struct LDKChannelId TxRemoveOutput_get_channel_id(const struct LDKTxRemoveOutput *NONNULL_PTR this_ptr);
40365
40366 /**
40367  * The channel ID
40368  */
40369 void TxRemoveOutput_set_channel_id(struct LDKTxRemoveOutput *NONNULL_PTR this_ptr, struct LDKChannelId val);
40370
40371 /**
40372  * The serial ID of the output to be removed
40373  */
40374 uint64_t TxRemoveOutput_get_serial_id(const struct LDKTxRemoveOutput *NONNULL_PTR this_ptr);
40375
40376 /**
40377  * The serial ID of the output to be removed
40378  */
40379 void TxRemoveOutput_set_serial_id(struct LDKTxRemoveOutput *NONNULL_PTR this_ptr, uint64_t val);
40380
40381 /**
40382  * Constructs a new TxRemoveOutput given each field
40383  */
40384 MUST_USE_RES struct LDKTxRemoveOutput TxRemoveOutput_new(struct LDKChannelId channel_id_arg, uint64_t serial_id_arg);
40385
40386 /**
40387  * Creates a copy of the TxRemoveOutput
40388  */
40389 struct LDKTxRemoveOutput TxRemoveOutput_clone(const struct LDKTxRemoveOutput *NONNULL_PTR orig);
40390
40391 /**
40392  * Generates a non-cryptographic 64-bit hash of the TxRemoveOutput.
40393  */
40394 uint64_t TxRemoveOutput_hash(const struct LDKTxRemoveOutput *NONNULL_PTR o);
40395
40396 /**
40397  * Checks if two TxRemoveOutputs contain equal inner contents.
40398  * This ignores pointers and is_owned flags and looks at the values in fields.
40399  * Two objects with NULL inner values will be considered "equal" here.
40400  */
40401 bool TxRemoveOutput_eq(const struct LDKTxRemoveOutput *NONNULL_PTR a, const struct LDKTxRemoveOutput *NONNULL_PTR b);
40402
40403 /**
40404  * Frees any resources used by the TxComplete, if is_owned is set and inner is non-NULL.
40405  */
40406 void TxComplete_free(struct LDKTxComplete this_obj);
40407
40408 /**
40409  * The channel ID
40410  */
40411 struct LDKChannelId TxComplete_get_channel_id(const struct LDKTxComplete *NONNULL_PTR this_ptr);
40412
40413 /**
40414  * The channel ID
40415  */
40416 void TxComplete_set_channel_id(struct LDKTxComplete *NONNULL_PTR this_ptr, struct LDKChannelId val);
40417
40418 /**
40419  * Constructs a new TxComplete given each field
40420  */
40421 MUST_USE_RES struct LDKTxComplete TxComplete_new(struct LDKChannelId channel_id_arg);
40422
40423 /**
40424  * Creates a copy of the TxComplete
40425  */
40426 struct LDKTxComplete TxComplete_clone(const struct LDKTxComplete *NONNULL_PTR orig);
40427
40428 /**
40429  * Generates a non-cryptographic 64-bit hash of the TxComplete.
40430  */
40431 uint64_t TxComplete_hash(const struct LDKTxComplete *NONNULL_PTR o);
40432
40433 /**
40434  * Checks if two TxCompletes contain equal inner contents.
40435  * This ignores pointers and is_owned flags and looks at the values in fields.
40436  * Two objects with NULL inner values will be considered "equal" here.
40437  */
40438 bool TxComplete_eq(const struct LDKTxComplete *NONNULL_PTR a, const struct LDKTxComplete *NONNULL_PTR b);
40439
40440 /**
40441  * Frees any resources used by the TxSignatures, if is_owned is set and inner is non-NULL.
40442  */
40443 void TxSignatures_free(struct LDKTxSignatures this_obj);
40444
40445 /**
40446  * The channel ID
40447  */
40448 struct LDKChannelId TxSignatures_get_channel_id(const struct LDKTxSignatures *NONNULL_PTR this_ptr);
40449
40450 /**
40451  * The channel ID
40452  */
40453 void TxSignatures_set_channel_id(struct LDKTxSignatures *NONNULL_PTR this_ptr, struct LDKChannelId val);
40454
40455 /**
40456  * The TXID
40457  */
40458 const uint8_t (*TxSignatures_get_tx_hash(const struct LDKTxSignatures *NONNULL_PTR this_ptr))[32];
40459
40460 /**
40461  * The TXID
40462  */
40463 void TxSignatures_set_tx_hash(struct LDKTxSignatures *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
40464
40465 /**
40466  * The list of witnesses
40467  *
40468  * Returns a copy of the field.
40469  */
40470 struct LDKCVec_WitnessZ TxSignatures_get_witnesses(const struct LDKTxSignatures *NONNULL_PTR this_ptr);
40471
40472 /**
40473  * The list of witnesses
40474  */
40475 void TxSignatures_set_witnesses(struct LDKTxSignatures *NONNULL_PTR this_ptr, struct LDKCVec_WitnessZ val);
40476
40477 /**
40478  * Optional signature for the shared input -- the previous funding outpoint -- signed by both peers
40479  */
40480 struct LDKCOption_ECDSASignatureZ TxSignatures_get_funding_outpoint_sig(const struct LDKTxSignatures *NONNULL_PTR this_ptr);
40481
40482 /**
40483  * Optional signature for the shared input -- the previous funding outpoint -- signed by both peers
40484  */
40485 void TxSignatures_set_funding_outpoint_sig(struct LDKTxSignatures *NONNULL_PTR this_ptr, struct LDKCOption_ECDSASignatureZ val);
40486
40487 /**
40488  * Constructs a new TxSignatures given each field
40489  */
40490 MUST_USE_RES struct LDKTxSignatures TxSignatures_new(struct LDKChannelId channel_id_arg, struct LDKThirtyTwoBytes tx_hash_arg, struct LDKCVec_WitnessZ witnesses_arg, struct LDKCOption_ECDSASignatureZ funding_outpoint_sig_arg);
40491
40492 /**
40493  * Creates a copy of the TxSignatures
40494  */
40495 struct LDKTxSignatures TxSignatures_clone(const struct LDKTxSignatures *NONNULL_PTR orig);
40496
40497 /**
40498  * Generates a non-cryptographic 64-bit hash of the TxSignatures.
40499  */
40500 uint64_t TxSignatures_hash(const struct LDKTxSignatures *NONNULL_PTR o);
40501
40502 /**
40503  * Checks if two TxSignaturess contain equal inner contents.
40504  * This ignores pointers and is_owned flags and looks at the values in fields.
40505  * Two objects with NULL inner values will be considered "equal" here.
40506  */
40507 bool TxSignatures_eq(const struct LDKTxSignatures *NONNULL_PTR a, const struct LDKTxSignatures *NONNULL_PTR b);
40508
40509 /**
40510  * Frees any resources used by the TxInitRbf, if is_owned is set and inner is non-NULL.
40511  */
40512 void TxInitRbf_free(struct LDKTxInitRbf this_obj);
40513
40514 /**
40515  * The channel ID
40516  */
40517 struct LDKChannelId TxInitRbf_get_channel_id(const struct LDKTxInitRbf *NONNULL_PTR this_ptr);
40518
40519 /**
40520  * The channel ID
40521  */
40522 void TxInitRbf_set_channel_id(struct LDKTxInitRbf *NONNULL_PTR this_ptr, struct LDKChannelId val);
40523
40524 /**
40525  * The locktime of the transaction
40526  */
40527 uint32_t TxInitRbf_get_locktime(const struct LDKTxInitRbf *NONNULL_PTR this_ptr);
40528
40529 /**
40530  * The locktime of the transaction
40531  */
40532 void TxInitRbf_set_locktime(struct LDKTxInitRbf *NONNULL_PTR this_ptr, uint32_t val);
40533
40534 /**
40535  * The feerate of the transaction
40536  */
40537 uint32_t TxInitRbf_get_feerate_sat_per_1000_weight(const struct LDKTxInitRbf *NONNULL_PTR this_ptr);
40538
40539 /**
40540  * The feerate of the transaction
40541  */
40542 void TxInitRbf_set_feerate_sat_per_1000_weight(struct LDKTxInitRbf *NONNULL_PTR this_ptr, uint32_t val);
40543
40544 /**
40545  * The number of satoshis the sender will contribute to or, if negative, remove from
40546  * (e.g. splice-out) the funding output of the transaction
40547  */
40548 struct LDKCOption_i64Z TxInitRbf_get_funding_output_contribution(const struct LDKTxInitRbf *NONNULL_PTR this_ptr);
40549
40550 /**
40551  * The number of satoshis the sender will contribute to or, if negative, remove from
40552  * (e.g. splice-out) the funding output of the transaction
40553  */
40554 void TxInitRbf_set_funding_output_contribution(struct LDKTxInitRbf *NONNULL_PTR this_ptr, struct LDKCOption_i64Z val);
40555
40556 /**
40557  * Constructs a new TxInitRbf given each field
40558  */
40559 MUST_USE_RES struct LDKTxInitRbf TxInitRbf_new(struct LDKChannelId channel_id_arg, uint32_t locktime_arg, uint32_t feerate_sat_per_1000_weight_arg, struct LDKCOption_i64Z funding_output_contribution_arg);
40560
40561 /**
40562  * Creates a copy of the TxInitRbf
40563  */
40564 struct LDKTxInitRbf TxInitRbf_clone(const struct LDKTxInitRbf *NONNULL_PTR orig);
40565
40566 /**
40567  * Generates a non-cryptographic 64-bit hash of the TxInitRbf.
40568  */
40569 uint64_t TxInitRbf_hash(const struct LDKTxInitRbf *NONNULL_PTR o);
40570
40571 /**
40572  * Checks if two TxInitRbfs contain equal inner contents.
40573  * This ignores pointers and is_owned flags and looks at the values in fields.
40574  * Two objects with NULL inner values will be considered "equal" here.
40575  */
40576 bool TxInitRbf_eq(const struct LDKTxInitRbf *NONNULL_PTR a, const struct LDKTxInitRbf *NONNULL_PTR b);
40577
40578 /**
40579  * Frees any resources used by the TxAckRbf, if is_owned is set and inner is non-NULL.
40580  */
40581 void TxAckRbf_free(struct LDKTxAckRbf this_obj);
40582
40583 /**
40584  * The channel ID
40585  */
40586 struct LDKChannelId TxAckRbf_get_channel_id(const struct LDKTxAckRbf *NONNULL_PTR this_ptr);
40587
40588 /**
40589  * The channel ID
40590  */
40591 void TxAckRbf_set_channel_id(struct LDKTxAckRbf *NONNULL_PTR this_ptr, struct LDKChannelId val);
40592
40593 /**
40594  * The number of satoshis the sender will contribute to or, if negative, remove from
40595  * (e.g. splice-out) the funding output of the transaction
40596  */
40597 struct LDKCOption_i64Z TxAckRbf_get_funding_output_contribution(const struct LDKTxAckRbf *NONNULL_PTR this_ptr);
40598
40599 /**
40600  * The number of satoshis the sender will contribute to or, if negative, remove from
40601  * (e.g. splice-out) the funding output of the transaction
40602  */
40603 void TxAckRbf_set_funding_output_contribution(struct LDKTxAckRbf *NONNULL_PTR this_ptr, struct LDKCOption_i64Z val);
40604
40605 /**
40606  * Constructs a new TxAckRbf given each field
40607  */
40608 MUST_USE_RES struct LDKTxAckRbf TxAckRbf_new(struct LDKChannelId channel_id_arg, struct LDKCOption_i64Z funding_output_contribution_arg);
40609
40610 /**
40611  * Creates a copy of the TxAckRbf
40612  */
40613 struct LDKTxAckRbf TxAckRbf_clone(const struct LDKTxAckRbf *NONNULL_PTR orig);
40614
40615 /**
40616  * Generates a non-cryptographic 64-bit hash of the TxAckRbf.
40617  */
40618 uint64_t TxAckRbf_hash(const struct LDKTxAckRbf *NONNULL_PTR o);
40619
40620 /**
40621  * Checks if two TxAckRbfs contain equal inner contents.
40622  * This ignores pointers and is_owned flags and looks at the values in fields.
40623  * Two objects with NULL inner values will be considered "equal" here.
40624  */
40625 bool TxAckRbf_eq(const struct LDKTxAckRbf *NONNULL_PTR a, const struct LDKTxAckRbf *NONNULL_PTR b);
40626
40627 /**
40628  * Frees any resources used by the TxAbort, if is_owned is set and inner is non-NULL.
40629  */
40630 void TxAbort_free(struct LDKTxAbort this_obj);
40631
40632 /**
40633  * The channel ID
40634  */
40635 struct LDKChannelId TxAbort_get_channel_id(const struct LDKTxAbort *NONNULL_PTR this_ptr);
40636
40637 /**
40638  * The channel ID
40639  */
40640 void TxAbort_set_channel_id(struct LDKTxAbort *NONNULL_PTR this_ptr, struct LDKChannelId val);
40641
40642 /**
40643  * Message data
40644  *
40645  * Returns a copy of the field.
40646  */
40647 struct LDKCVec_u8Z TxAbort_get_data(const struct LDKTxAbort *NONNULL_PTR this_ptr);
40648
40649 /**
40650  * Message data
40651  */
40652 void TxAbort_set_data(struct LDKTxAbort *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
40653
40654 /**
40655  * Constructs a new TxAbort given each field
40656  */
40657 MUST_USE_RES struct LDKTxAbort TxAbort_new(struct LDKChannelId channel_id_arg, struct LDKCVec_u8Z data_arg);
40658
40659 /**
40660  * Creates a copy of the TxAbort
40661  */
40662 struct LDKTxAbort TxAbort_clone(const struct LDKTxAbort *NONNULL_PTR orig);
40663
40664 /**
40665  * Generates a non-cryptographic 64-bit hash of the TxAbort.
40666  */
40667 uint64_t TxAbort_hash(const struct LDKTxAbort *NONNULL_PTR o);
40668
40669 /**
40670  * Checks if two TxAborts contain equal inner contents.
40671  * This ignores pointers and is_owned flags and looks at the values in fields.
40672  * Two objects with NULL inner values will be considered "equal" here.
40673  */
40674 bool TxAbort_eq(const struct LDKTxAbort *NONNULL_PTR a, const struct LDKTxAbort *NONNULL_PTR b);
40675
40676 /**
40677  * Frees any resources used by the Shutdown, if is_owned is set and inner is non-NULL.
40678  */
40679 void Shutdown_free(struct LDKShutdown this_obj);
40680
40681 /**
40682  * The channel ID
40683  */
40684 struct LDKChannelId Shutdown_get_channel_id(const struct LDKShutdown *NONNULL_PTR this_ptr);
40685
40686 /**
40687  * The channel ID
40688  */
40689 void Shutdown_set_channel_id(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKChannelId val);
40690
40691 /**
40692  * The destination of this peer's funds on closing.
40693  *
40694  * Must be in one of these forms: P2PKH, P2SH, P2WPKH, P2WSH, P2TR.
40695  */
40696 struct LDKCVec_u8Z Shutdown_get_scriptpubkey(const struct LDKShutdown *NONNULL_PTR this_ptr);
40697
40698 /**
40699  * The destination of this peer's funds on closing.
40700  *
40701  * Must be in one of these forms: P2PKH, P2SH, P2WPKH, P2WSH, P2TR.
40702  */
40703 void Shutdown_set_scriptpubkey(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
40704
40705 /**
40706  * Constructs a new Shutdown given each field
40707  */
40708 MUST_USE_RES struct LDKShutdown Shutdown_new(struct LDKChannelId channel_id_arg, struct LDKCVec_u8Z scriptpubkey_arg);
40709
40710 /**
40711  * Creates a copy of the Shutdown
40712  */
40713 struct LDKShutdown Shutdown_clone(const struct LDKShutdown *NONNULL_PTR orig);
40714
40715 /**
40716  * Generates a non-cryptographic 64-bit hash of the Shutdown.
40717  */
40718 uint64_t Shutdown_hash(const struct LDKShutdown *NONNULL_PTR o);
40719
40720 /**
40721  * Checks if two Shutdowns contain equal inner contents.
40722  * This ignores pointers and is_owned flags and looks at the values in fields.
40723  * Two objects with NULL inner values will be considered "equal" here.
40724  */
40725 bool Shutdown_eq(const struct LDKShutdown *NONNULL_PTR a, const struct LDKShutdown *NONNULL_PTR b);
40726
40727 /**
40728  * Frees any resources used by the ClosingSignedFeeRange, if is_owned is set and inner is non-NULL.
40729  */
40730 void ClosingSignedFeeRange_free(struct LDKClosingSignedFeeRange this_obj);
40731
40732 /**
40733  * The minimum absolute fee, in satoshis, which the sender is willing to place on the closing
40734  * transaction.
40735  */
40736 uint64_t ClosingSignedFeeRange_get_min_fee_satoshis(const struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr);
40737
40738 /**
40739  * The minimum absolute fee, in satoshis, which the sender is willing to place on the closing
40740  * transaction.
40741  */
40742 void ClosingSignedFeeRange_set_min_fee_satoshis(struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr, uint64_t val);
40743
40744 /**
40745  * The maximum absolute fee, in satoshis, which the sender is willing to place on the closing
40746  * transaction.
40747  */
40748 uint64_t ClosingSignedFeeRange_get_max_fee_satoshis(const struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr);
40749
40750 /**
40751  * The maximum absolute fee, in satoshis, which the sender is willing to place on the closing
40752  * transaction.
40753  */
40754 void ClosingSignedFeeRange_set_max_fee_satoshis(struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr, uint64_t val);
40755
40756 /**
40757  * Constructs a new ClosingSignedFeeRange given each field
40758  */
40759 MUST_USE_RES struct LDKClosingSignedFeeRange ClosingSignedFeeRange_new(uint64_t min_fee_satoshis_arg, uint64_t max_fee_satoshis_arg);
40760
40761 /**
40762  * Creates a copy of the ClosingSignedFeeRange
40763  */
40764 struct LDKClosingSignedFeeRange ClosingSignedFeeRange_clone(const struct LDKClosingSignedFeeRange *NONNULL_PTR orig);
40765
40766 /**
40767  * Generates a non-cryptographic 64-bit hash of the ClosingSignedFeeRange.
40768  */
40769 uint64_t ClosingSignedFeeRange_hash(const struct LDKClosingSignedFeeRange *NONNULL_PTR o);
40770
40771 /**
40772  * Checks if two ClosingSignedFeeRanges contain equal inner contents.
40773  * This ignores pointers and is_owned flags and looks at the values in fields.
40774  * Two objects with NULL inner values will be considered "equal" here.
40775  */
40776 bool ClosingSignedFeeRange_eq(const struct LDKClosingSignedFeeRange *NONNULL_PTR a, const struct LDKClosingSignedFeeRange *NONNULL_PTR b);
40777
40778 /**
40779  * Frees any resources used by the ClosingSigned, if is_owned is set and inner is non-NULL.
40780  */
40781 void ClosingSigned_free(struct LDKClosingSigned this_obj);
40782
40783 /**
40784  * The channel ID
40785  */
40786 struct LDKChannelId ClosingSigned_get_channel_id(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
40787
40788 /**
40789  * The channel ID
40790  */
40791 void ClosingSigned_set_channel_id(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKChannelId val);
40792
40793 /**
40794  * The proposed total fee for the closing transaction
40795  */
40796 uint64_t ClosingSigned_get_fee_satoshis(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
40797
40798 /**
40799  * The proposed total fee for the closing transaction
40800  */
40801 void ClosingSigned_set_fee_satoshis(struct LDKClosingSigned *NONNULL_PTR this_ptr, uint64_t val);
40802
40803 /**
40804  * A signature on the closing transaction
40805  */
40806 struct LDKECDSASignature ClosingSigned_get_signature(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
40807
40808 /**
40809  * A signature on the closing transaction
40810  */
40811 void ClosingSigned_set_signature(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKECDSASignature val);
40812
40813 /**
40814  * The minimum and maximum fees which the sender is willing to accept, provided only by new
40815  * nodes.
40816  *
40817  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
40818  */
40819 struct LDKClosingSignedFeeRange ClosingSigned_get_fee_range(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
40820
40821 /**
40822  * The minimum and maximum fees which the sender is willing to accept, provided only by new
40823  * nodes.
40824  *
40825  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
40826  */
40827 void ClosingSigned_set_fee_range(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKClosingSignedFeeRange val);
40828
40829 /**
40830  * Constructs a new ClosingSigned given each field
40831  *
40832  * Note that fee_range_arg (or a relevant inner pointer) may be NULL or all-0s to represent None
40833  */
40834 MUST_USE_RES struct LDKClosingSigned ClosingSigned_new(struct LDKChannelId channel_id_arg, uint64_t fee_satoshis_arg, struct LDKECDSASignature signature_arg, struct LDKClosingSignedFeeRange fee_range_arg);
40835
40836 /**
40837  * Creates a copy of the ClosingSigned
40838  */
40839 struct LDKClosingSigned ClosingSigned_clone(const struct LDKClosingSigned *NONNULL_PTR orig);
40840
40841 /**
40842  * Generates a non-cryptographic 64-bit hash of the ClosingSigned.
40843  */
40844 uint64_t ClosingSigned_hash(const struct LDKClosingSigned *NONNULL_PTR o);
40845
40846 /**
40847  * Checks if two ClosingSigneds contain equal inner contents.
40848  * This ignores pointers and is_owned flags and looks at the values in fields.
40849  * Two objects with NULL inner values will be considered "equal" here.
40850  */
40851 bool ClosingSigned_eq(const struct LDKClosingSigned *NONNULL_PTR a, const struct LDKClosingSigned *NONNULL_PTR b);
40852
40853 /**
40854  * Frees any resources used by the UpdateAddHTLC, if is_owned is set and inner is non-NULL.
40855  */
40856 void UpdateAddHTLC_free(struct LDKUpdateAddHTLC this_obj);
40857
40858 /**
40859  * The channel ID
40860  */
40861 struct LDKChannelId UpdateAddHTLC_get_channel_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
40862
40863 /**
40864  * The channel ID
40865  */
40866 void UpdateAddHTLC_set_channel_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKChannelId val);
40867
40868 /**
40869  * The HTLC ID
40870  */
40871 uint64_t UpdateAddHTLC_get_htlc_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
40872
40873 /**
40874  * The HTLC ID
40875  */
40876 void UpdateAddHTLC_set_htlc_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
40877
40878 /**
40879  * The HTLC value in milli-satoshi
40880  */
40881 uint64_t UpdateAddHTLC_get_amount_msat(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
40882
40883 /**
40884  * The HTLC value in milli-satoshi
40885  */
40886 void UpdateAddHTLC_set_amount_msat(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
40887
40888 /**
40889  * The payment hash, the pre-image of which controls HTLC redemption
40890  */
40891 const uint8_t (*UpdateAddHTLC_get_payment_hash(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32];
40892
40893 /**
40894  * The payment hash, the pre-image of which controls HTLC redemption
40895  */
40896 void UpdateAddHTLC_set_payment_hash(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
40897
40898 /**
40899  * The expiry height of the HTLC
40900  */
40901 uint32_t UpdateAddHTLC_get_cltv_expiry(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
40902
40903 /**
40904  * The expiry height of the HTLC
40905  */
40906 void UpdateAddHTLC_set_cltv_expiry(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint32_t val);
40907
40908 /**
40909  * The extra fee skimmed by the sender of this message. See
40910  * [`ChannelConfig::accept_underpaying_htlcs`].
40911  *
40912  * [`ChannelConfig::accept_underpaying_htlcs`]: crate::util::config::ChannelConfig::accept_underpaying_htlcs
40913  */
40914 struct LDKCOption_u64Z UpdateAddHTLC_get_skimmed_fee_msat(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
40915
40916 /**
40917  * The extra fee skimmed by the sender of this message. See
40918  * [`ChannelConfig::accept_underpaying_htlcs`].
40919  *
40920  * [`ChannelConfig::accept_underpaying_htlcs`]: crate::util::config::ChannelConfig::accept_underpaying_htlcs
40921  */
40922 void UpdateAddHTLC_set_skimmed_fee_msat(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
40923
40924 /**
40925  * The onion routing packet with encrypted data for the next hop.
40926  */
40927 struct LDKOnionPacket UpdateAddHTLC_get_onion_routing_packet(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
40928
40929 /**
40930  * The onion routing packet with encrypted data for the next hop.
40931  */
40932 void UpdateAddHTLC_set_onion_routing_packet(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKOnionPacket val);
40933
40934 /**
40935  * Provided if we are relaying or receiving a payment within a blinded path, to decrypt the onion
40936  * routing packet and the recipient-provided encrypted payload within.
40937  *
40938  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
40939  */
40940 struct LDKPublicKey UpdateAddHTLC_get_blinding_point(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
40941
40942 /**
40943  * Provided if we are relaying or receiving a payment within a blinded path, to decrypt the onion
40944  * routing packet and the recipient-provided encrypted payload within.
40945  *
40946  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
40947  */
40948 void UpdateAddHTLC_set_blinding_point(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKPublicKey val);
40949
40950 /**
40951  * Constructs a new UpdateAddHTLC given each field
40952  *
40953  * Note that blinding_point_arg (or a relevant inner pointer) may be NULL or all-0s to represent None
40954  */
40955 MUST_USE_RES struct LDKUpdateAddHTLC UpdateAddHTLC_new(struct LDKChannelId channel_id_arg, uint64_t htlc_id_arg, uint64_t amount_msat_arg, struct LDKThirtyTwoBytes payment_hash_arg, uint32_t cltv_expiry_arg, struct LDKCOption_u64Z skimmed_fee_msat_arg, struct LDKOnionPacket onion_routing_packet_arg, struct LDKPublicKey blinding_point_arg);
40956
40957 /**
40958  * Creates a copy of the UpdateAddHTLC
40959  */
40960 struct LDKUpdateAddHTLC UpdateAddHTLC_clone(const struct LDKUpdateAddHTLC *NONNULL_PTR orig);
40961
40962 /**
40963  * Generates a non-cryptographic 64-bit hash of the UpdateAddHTLC.
40964  */
40965 uint64_t UpdateAddHTLC_hash(const struct LDKUpdateAddHTLC *NONNULL_PTR o);
40966
40967 /**
40968  * Checks if two UpdateAddHTLCs contain equal inner contents.
40969  * This ignores pointers and is_owned flags and looks at the values in fields.
40970  * Two objects with NULL inner values will be considered "equal" here.
40971  */
40972 bool UpdateAddHTLC_eq(const struct LDKUpdateAddHTLC *NONNULL_PTR a, const struct LDKUpdateAddHTLC *NONNULL_PTR b);
40973
40974 /**
40975  * Frees any resources used by the OnionMessage, if is_owned is set and inner is non-NULL.
40976  */
40977 void OnionMessage_free(struct LDKOnionMessage this_obj);
40978
40979 /**
40980  * Used in decrypting the onion packet's payload.
40981  */
40982 struct LDKPublicKey OnionMessage_get_blinding_point(const struct LDKOnionMessage *NONNULL_PTR this_ptr);
40983
40984 /**
40985  * Used in decrypting the onion packet's payload.
40986  */
40987 void OnionMessage_set_blinding_point(struct LDKOnionMessage *NONNULL_PTR this_ptr, struct LDKPublicKey val);
40988
40989 /**
40990  * The full onion packet including hop data, pubkey, and hmac
40991  */
40992 struct LDKPacket OnionMessage_get_onion_routing_packet(const struct LDKOnionMessage *NONNULL_PTR this_ptr);
40993
40994 /**
40995  * The full onion packet including hop data, pubkey, and hmac
40996  */
40997 void OnionMessage_set_onion_routing_packet(struct LDKOnionMessage *NONNULL_PTR this_ptr, struct LDKPacket val);
40998
40999 /**
41000  * Constructs a new OnionMessage given each field
41001  */
41002 MUST_USE_RES struct LDKOnionMessage OnionMessage_new(struct LDKPublicKey blinding_point_arg, struct LDKPacket onion_routing_packet_arg);
41003
41004 /**
41005  * Creates a copy of the OnionMessage
41006  */
41007 struct LDKOnionMessage OnionMessage_clone(const struct LDKOnionMessage *NONNULL_PTR orig);
41008
41009 /**
41010  * Generates a non-cryptographic 64-bit hash of the OnionMessage.
41011  */
41012 uint64_t OnionMessage_hash(const struct LDKOnionMessage *NONNULL_PTR o);
41013
41014 /**
41015  * Checks if two OnionMessages contain equal inner contents.
41016  * This ignores pointers and is_owned flags and looks at the values in fields.
41017  * Two objects with NULL inner values will be considered "equal" here.
41018  */
41019 bool OnionMessage_eq(const struct LDKOnionMessage *NONNULL_PTR a, const struct LDKOnionMessage *NONNULL_PTR b);
41020
41021 /**
41022  * Frees any resources used by the UpdateFulfillHTLC, if is_owned is set and inner is non-NULL.
41023  */
41024 void UpdateFulfillHTLC_free(struct LDKUpdateFulfillHTLC this_obj);
41025
41026 /**
41027  * The channel ID
41028  */
41029 struct LDKChannelId UpdateFulfillHTLC_get_channel_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr);
41030
41031 /**
41032  * The channel ID
41033  */
41034 void UpdateFulfillHTLC_set_channel_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKChannelId val);
41035
41036 /**
41037  * The HTLC ID
41038  */
41039 uint64_t UpdateFulfillHTLC_get_htlc_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr);
41040
41041 /**
41042  * The HTLC ID
41043  */
41044 void UpdateFulfillHTLC_set_htlc_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, uint64_t val);
41045
41046 /**
41047  * The pre-image of the payment hash, allowing HTLC redemption
41048  */
41049 const uint8_t (*UpdateFulfillHTLC_get_payment_preimage(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32];
41050
41051 /**
41052  * The pre-image of the payment hash, allowing HTLC redemption
41053  */
41054 void UpdateFulfillHTLC_set_payment_preimage(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
41055
41056 /**
41057  * Constructs a new UpdateFulfillHTLC given each field
41058  */
41059 MUST_USE_RES struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_new(struct LDKChannelId channel_id_arg, uint64_t htlc_id_arg, struct LDKThirtyTwoBytes payment_preimage_arg);
41060
41061 /**
41062  * Creates a copy of the UpdateFulfillHTLC
41063  */
41064 struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_clone(const struct LDKUpdateFulfillHTLC *NONNULL_PTR orig);
41065
41066 /**
41067  * Generates a non-cryptographic 64-bit hash of the UpdateFulfillHTLC.
41068  */
41069 uint64_t UpdateFulfillHTLC_hash(const struct LDKUpdateFulfillHTLC *NONNULL_PTR o);
41070
41071 /**
41072  * Checks if two UpdateFulfillHTLCs contain equal inner contents.
41073  * This ignores pointers and is_owned flags and looks at the values in fields.
41074  * Two objects with NULL inner values will be considered "equal" here.
41075  */
41076 bool UpdateFulfillHTLC_eq(const struct LDKUpdateFulfillHTLC *NONNULL_PTR a, const struct LDKUpdateFulfillHTLC *NONNULL_PTR b);
41077
41078 /**
41079  * Frees any resources used by the UpdateFailHTLC, if is_owned is set and inner is non-NULL.
41080  */
41081 void UpdateFailHTLC_free(struct LDKUpdateFailHTLC this_obj);
41082
41083 /**
41084  * The channel ID
41085  */
41086 struct LDKChannelId UpdateFailHTLC_get_channel_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr);
41087
41088 /**
41089  * The channel ID
41090  */
41091 void UpdateFailHTLC_set_channel_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, struct LDKChannelId val);
41092
41093 /**
41094  * The HTLC ID
41095  */
41096 uint64_t UpdateFailHTLC_get_htlc_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr);
41097
41098 /**
41099  * The HTLC ID
41100  */
41101 void UpdateFailHTLC_set_htlc_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, uint64_t val);
41102
41103 /**
41104  * Creates a copy of the UpdateFailHTLC
41105  */
41106 struct LDKUpdateFailHTLC UpdateFailHTLC_clone(const struct LDKUpdateFailHTLC *NONNULL_PTR orig);
41107
41108 /**
41109  * Generates a non-cryptographic 64-bit hash of the UpdateFailHTLC.
41110  */
41111 uint64_t UpdateFailHTLC_hash(const struct LDKUpdateFailHTLC *NONNULL_PTR o);
41112
41113 /**
41114  * Checks if two UpdateFailHTLCs contain equal inner contents.
41115  * This ignores pointers and is_owned flags and looks at the values in fields.
41116  * Two objects with NULL inner values will be considered "equal" here.
41117  */
41118 bool UpdateFailHTLC_eq(const struct LDKUpdateFailHTLC *NONNULL_PTR a, const struct LDKUpdateFailHTLC *NONNULL_PTR b);
41119
41120 /**
41121  * Frees any resources used by the UpdateFailMalformedHTLC, if is_owned is set and inner is non-NULL.
41122  */
41123 void UpdateFailMalformedHTLC_free(struct LDKUpdateFailMalformedHTLC this_obj);
41124
41125 /**
41126  * The channel ID
41127  */
41128 struct LDKChannelId UpdateFailMalformedHTLC_get_channel_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
41129
41130 /**
41131  * The channel ID
41132  */
41133 void UpdateFailMalformedHTLC_set_channel_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, struct LDKChannelId val);
41134
41135 /**
41136  * The HTLC ID
41137  */
41138 uint64_t UpdateFailMalformedHTLC_get_htlc_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
41139
41140 /**
41141  * The HTLC ID
41142  */
41143 void UpdateFailMalformedHTLC_set_htlc_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint64_t val);
41144
41145 /**
41146  * The failure code
41147  */
41148 uint16_t UpdateFailMalformedHTLC_get_failure_code(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
41149
41150 /**
41151  * The failure code
41152  */
41153 void UpdateFailMalformedHTLC_set_failure_code(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint16_t val);
41154
41155 /**
41156  * Creates a copy of the UpdateFailMalformedHTLC
41157  */
41158 struct LDKUpdateFailMalformedHTLC UpdateFailMalformedHTLC_clone(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR orig);
41159
41160 /**
41161  * Generates a non-cryptographic 64-bit hash of the UpdateFailMalformedHTLC.
41162  */
41163 uint64_t UpdateFailMalformedHTLC_hash(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR o);
41164
41165 /**
41166  * Checks if two UpdateFailMalformedHTLCs contain equal inner contents.
41167  * This ignores pointers and is_owned flags and looks at the values in fields.
41168  * Two objects with NULL inner values will be considered "equal" here.
41169  */
41170 bool UpdateFailMalformedHTLC_eq(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR a, const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR b);
41171
41172 /**
41173  * Frees any resources used by the CommitmentSigned, if is_owned is set and inner is non-NULL.
41174  */
41175 void CommitmentSigned_free(struct LDKCommitmentSigned this_obj);
41176
41177 /**
41178  * The channel ID
41179  */
41180 struct LDKChannelId CommitmentSigned_get_channel_id(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr);
41181
41182 /**
41183  * The channel ID
41184  */
41185 void CommitmentSigned_set_channel_id(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKChannelId val);
41186
41187 /**
41188  * A signature on the commitment transaction
41189  */
41190 struct LDKECDSASignature CommitmentSigned_get_signature(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr);
41191
41192 /**
41193  * A signature on the commitment transaction
41194  */
41195 void CommitmentSigned_set_signature(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKECDSASignature val);
41196
41197 /**
41198  * Signatures on the HTLC transactions
41199  *
41200  * Returns a copy of the field.
41201  */
41202 struct LDKCVec_ECDSASignatureZ CommitmentSigned_get_htlc_signatures(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr);
41203
41204 /**
41205  * Signatures on the HTLC transactions
41206  */
41207 void CommitmentSigned_set_htlc_signatures(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKCVec_ECDSASignatureZ val);
41208
41209 /**
41210  * Constructs a new CommitmentSigned given each field
41211  */
41212 MUST_USE_RES struct LDKCommitmentSigned CommitmentSigned_new(struct LDKChannelId channel_id_arg, struct LDKECDSASignature signature_arg, struct LDKCVec_ECDSASignatureZ htlc_signatures_arg);
41213
41214 /**
41215  * Creates a copy of the CommitmentSigned
41216  */
41217 struct LDKCommitmentSigned CommitmentSigned_clone(const struct LDKCommitmentSigned *NONNULL_PTR orig);
41218
41219 /**
41220  * Generates a non-cryptographic 64-bit hash of the CommitmentSigned.
41221  */
41222 uint64_t CommitmentSigned_hash(const struct LDKCommitmentSigned *NONNULL_PTR o);
41223
41224 /**
41225  * Checks if two CommitmentSigneds contain equal inner contents.
41226  * This ignores pointers and is_owned flags and looks at the values in fields.
41227  * Two objects with NULL inner values will be considered "equal" here.
41228  */
41229 bool CommitmentSigned_eq(const struct LDKCommitmentSigned *NONNULL_PTR a, const struct LDKCommitmentSigned *NONNULL_PTR b);
41230
41231 /**
41232  * Frees any resources used by the RevokeAndACK, if is_owned is set and inner is non-NULL.
41233  */
41234 void RevokeAndACK_free(struct LDKRevokeAndACK this_obj);
41235
41236 /**
41237  * The channel ID
41238  */
41239 struct LDKChannelId RevokeAndACK_get_channel_id(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr);
41240
41241 /**
41242  * The channel ID
41243  */
41244 void RevokeAndACK_set_channel_id(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKChannelId val);
41245
41246 /**
41247  * The secret corresponding to the per-commitment point
41248  */
41249 const uint8_t (*RevokeAndACK_get_per_commitment_secret(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32];
41250
41251 /**
41252  * The secret corresponding to the per-commitment point
41253  */
41254 void RevokeAndACK_set_per_commitment_secret(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
41255
41256 /**
41257  * The next sender-broadcast commitment transaction's per-commitment point
41258  */
41259 struct LDKPublicKey RevokeAndACK_get_next_per_commitment_point(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr);
41260
41261 /**
41262  * The next sender-broadcast commitment transaction's per-commitment point
41263  */
41264 void RevokeAndACK_set_next_per_commitment_point(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKPublicKey val);
41265
41266 /**
41267  * Constructs a new RevokeAndACK given each field
41268  */
41269 MUST_USE_RES struct LDKRevokeAndACK RevokeAndACK_new(struct LDKChannelId channel_id_arg, struct LDKThirtyTwoBytes per_commitment_secret_arg, struct LDKPublicKey next_per_commitment_point_arg);
41270
41271 /**
41272  * Creates a copy of the RevokeAndACK
41273  */
41274 struct LDKRevokeAndACK RevokeAndACK_clone(const struct LDKRevokeAndACK *NONNULL_PTR orig);
41275
41276 /**
41277  * Generates a non-cryptographic 64-bit hash of the RevokeAndACK.
41278  */
41279 uint64_t RevokeAndACK_hash(const struct LDKRevokeAndACK *NONNULL_PTR o);
41280
41281 /**
41282  * Checks if two RevokeAndACKs contain equal inner contents.
41283  * This ignores pointers and is_owned flags and looks at the values in fields.
41284  * Two objects with NULL inner values will be considered "equal" here.
41285  */
41286 bool RevokeAndACK_eq(const struct LDKRevokeAndACK *NONNULL_PTR a, const struct LDKRevokeAndACK *NONNULL_PTR b);
41287
41288 /**
41289  * Frees any resources used by the UpdateFee, if is_owned is set and inner is non-NULL.
41290  */
41291 void UpdateFee_free(struct LDKUpdateFee this_obj);
41292
41293 /**
41294  * The channel ID
41295  */
41296 struct LDKChannelId UpdateFee_get_channel_id(const struct LDKUpdateFee *NONNULL_PTR this_ptr);
41297
41298 /**
41299  * The channel ID
41300  */
41301 void UpdateFee_set_channel_id(struct LDKUpdateFee *NONNULL_PTR this_ptr, struct LDKChannelId val);
41302
41303 /**
41304  * Fee rate per 1000-weight of the transaction
41305  */
41306 uint32_t UpdateFee_get_feerate_per_kw(const struct LDKUpdateFee *NONNULL_PTR this_ptr);
41307
41308 /**
41309  * Fee rate per 1000-weight of the transaction
41310  */
41311 void UpdateFee_set_feerate_per_kw(struct LDKUpdateFee *NONNULL_PTR this_ptr, uint32_t val);
41312
41313 /**
41314  * Constructs a new UpdateFee given each field
41315  */
41316 MUST_USE_RES struct LDKUpdateFee UpdateFee_new(struct LDKChannelId channel_id_arg, uint32_t feerate_per_kw_arg);
41317
41318 /**
41319  * Creates a copy of the UpdateFee
41320  */
41321 struct LDKUpdateFee UpdateFee_clone(const struct LDKUpdateFee *NONNULL_PTR orig);
41322
41323 /**
41324  * Generates a non-cryptographic 64-bit hash of the UpdateFee.
41325  */
41326 uint64_t UpdateFee_hash(const struct LDKUpdateFee *NONNULL_PTR o);
41327
41328 /**
41329  * Checks if two UpdateFees contain equal inner contents.
41330  * This ignores pointers and is_owned flags and looks at the values in fields.
41331  * Two objects with NULL inner values will be considered "equal" here.
41332  */
41333 bool UpdateFee_eq(const struct LDKUpdateFee *NONNULL_PTR a, const struct LDKUpdateFee *NONNULL_PTR b);
41334
41335 /**
41336  * Frees any resources used by the ChannelReestablish, if is_owned is set and inner is non-NULL.
41337  */
41338 void ChannelReestablish_free(struct LDKChannelReestablish this_obj);
41339
41340 /**
41341  * The channel ID
41342  */
41343 struct LDKChannelId ChannelReestablish_get_channel_id(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
41344
41345 /**
41346  * The channel ID
41347  */
41348 void ChannelReestablish_set_channel_id(struct LDKChannelReestablish *NONNULL_PTR this_ptr, struct LDKChannelId val);
41349
41350 /**
41351  * The next commitment number for the sender
41352  */
41353 uint64_t ChannelReestablish_get_next_local_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
41354
41355 /**
41356  * The next commitment number for the sender
41357  */
41358 void ChannelReestablish_set_next_local_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
41359
41360 /**
41361  * The next commitment number for the recipient
41362  */
41363 uint64_t ChannelReestablish_get_next_remote_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
41364
41365 /**
41366  * The next commitment number for the recipient
41367  */
41368 void ChannelReestablish_set_next_remote_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
41369
41370 /**
41371  * Proof that the sender knows the per-commitment secret of a specific commitment transaction
41372  * belonging to the recipient
41373  */
41374 const uint8_t (*ChannelReestablish_get_your_last_per_commitment_secret(const struct LDKChannelReestablish *NONNULL_PTR this_ptr))[32];
41375
41376 /**
41377  * Proof that the sender knows the per-commitment secret of a specific commitment transaction
41378  * belonging to the recipient
41379  */
41380 void ChannelReestablish_set_your_last_per_commitment_secret(struct LDKChannelReestablish *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
41381
41382 /**
41383  * The sender's per-commitment point for their current commitment transaction
41384  */
41385 struct LDKPublicKey ChannelReestablish_get_my_current_per_commitment_point(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
41386
41387 /**
41388  * The sender's per-commitment point for their current commitment transaction
41389  */
41390 void ChannelReestablish_set_my_current_per_commitment_point(struct LDKChannelReestablish *NONNULL_PTR this_ptr, struct LDKPublicKey val);
41391
41392 /**
41393  * The next funding transaction ID
41394  */
41395 struct LDKCOption_ThirtyTwoBytesZ ChannelReestablish_get_next_funding_txid(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
41396
41397 /**
41398  * The next funding transaction ID
41399  */
41400 void ChannelReestablish_set_next_funding_txid(struct LDKChannelReestablish *NONNULL_PTR this_ptr, struct LDKCOption_ThirtyTwoBytesZ val);
41401
41402 /**
41403  * Constructs a new ChannelReestablish given each field
41404  */
41405 MUST_USE_RES struct LDKChannelReestablish ChannelReestablish_new(struct LDKChannelId 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_ThirtyTwoBytesZ next_funding_txid_arg);
41406
41407 /**
41408  * Creates a copy of the ChannelReestablish
41409  */
41410 struct LDKChannelReestablish ChannelReestablish_clone(const struct LDKChannelReestablish *NONNULL_PTR orig);
41411
41412 /**
41413  * Generates a non-cryptographic 64-bit hash of the ChannelReestablish.
41414  */
41415 uint64_t ChannelReestablish_hash(const struct LDKChannelReestablish *NONNULL_PTR o);
41416
41417 /**
41418  * Checks if two ChannelReestablishs contain equal inner contents.
41419  * This ignores pointers and is_owned flags and looks at the values in fields.
41420  * Two objects with NULL inner values will be considered "equal" here.
41421  */
41422 bool ChannelReestablish_eq(const struct LDKChannelReestablish *NONNULL_PTR a, const struct LDKChannelReestablish *NONNULL_PTR b);
41423
41424 /**
41425  * Frees any resources used by the AnnouncementSignatures, if is_owned is set and inner is non-NULL.
41426  */
41427 void AnnouncementSignatures_free(struct LDKAnnouncementSignatures this_obj);
41428
41429 /**
41430  * The channel ID
41431  */
41432 struct LDKChannelId AnnouncementSignatures_get_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
41433
41434 /**
41435  * The channel ID
41436  */
41437 void AnnouncementSignatures_set_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKChannelId val);
41438
41439 /**
41440  * The short channel ID
41441  */
41442 uint64_t AnnouncementSignatures_get_short_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
41443
41444 /**
41445  * The short channel ID
41446  */
41447 void AnnouncementSignatures_set_short_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, uint64_t val);
41448
41449 /**
41450  * A signature by the node key
41451  */
41452 struct LDKECDSASignature AnnouncementSignatures_get_node_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
41453
41454 /**
41455  * A signature by the node key
41456  */
41457 void AnnouncementSignatures_set_node_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKECDSASignature val);
41458
41459 /**
41460  * A signature by the funding key
41461  */
41462 struct LDKECDSASignature AnnouncementSignatures_get_bitcoin_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
41463
41464 /**
41465  * A signature by the funding key
41466  */
41467 void AnnouncementSignatures_set_bitcoin_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKECDSASignature val);
41468
41469 /**
41470  * Constructs a new AnnouncementSignatures given each field
41471  */
41472 MUST_USE_RES struct LDKAnnouncementSignatures AnnouncementSignatures_new(struct LDKChannelId channel_id_arg, uint64_t short_channel_id_arg, struct LDKECDSASignature node_signature_arg, struct LDKECDSASignature bitcoin_signature_arg);
41473
41474 /**
41475  * Creates a copy of the AnnouncementSignatures
41476  */
41477 struct LDKAnnouncementSignatures AnnouncementSignatures_clone(const struct LDKAnnouncementSignatures *NONNULL_PTR orig);
41478
41479 /**
41480  * Generates a non-cryptographic 64-bit hash of the AnnouncementSignatures.
41481  */
41482 uint64_t AnnouncementSignatures_hash(const struct LDKAnnouncementSignatures *NONNULL_PTR o);
41483
41484 /**
41485  * Checks if two AnnouncementSignaturess contain equal inner contents.
41486  * This ignores pointers and is_owned flags and looks at the values in fields.
41487  * Two objects with NULL inner values will be considered "equal" here.
41488  */
41489 bool AnnouncementSignatures_eq(const struct LDKAnnouncementSignatures *NONNULL_PTR a, const struct LDKAnnouncementSignatures *NONNULL_PTR b);
41490
41491 /**
41492  * Frees any resources used by the SocketAddress
41493  */
41494 void SocketAddress_free(struct LDKSocketAddress this_ptr);
41495
41496 /**
41497  * Creates a copy of the SocketAddress
41498  */
41499 struct LDKSocketAddress SocketAddress_clone(const struct LDKSocketAddress *NONNULL_PTR orig);
41500
41501 /**
41502  * Utility method to constructs a new TcpIpV4-variant SocketAddress
41503  */
41504 struct LDKSocketAddress SocketAddress_tcp_ip_v4(struct LDKFourBytes addr, uint16_t port);
41505
41506 /**
41507  * Utility method to constructs a new TcpIpV6-variant SocketAddress
41508  */
41509 struct LDKSocketAddress SocketAddress_tcp_ip_v6(struct LDKSixteenBytes addr, uint16_t port);
41510
41511 /**
41512  * Utility method to constructs a new OnionV2-variant SocketAddress
41513  */
41514 struct LDKSocketAddress SocketAddress_onion_v2(struct LDKTwelveBytes a);
41515
41516 /**
41517  * Utility method to constructs a new OnionV3-variant SocketAddress
41518  */
41519 struct LDKSocketAddress SocketAddress_onion_v3(struct LDKThirtyTwoBytes ed25519_pubkey, uint16_t checksum, uint8_t version, uint16_t port);
41520
41521 /**
41522  * Utility method to constructs a new Hostname-variant SocketAddress
41523  */
41524 struct LDKSocketAddress SocketAddress_hostname(struct LDKHostname hostname, uint16_t port);
41525
41526 /**
41527  * Generates a non-cryptographic 64-bit hash of the SocketAddress.
41528  */
41529 uint64_t SocketAddress_hash(const struct LDKSocketAddress *NONNULL_PTR o);
41530
41531 /**
41532  * Checks if two SocketAddresss contain equal inner contents.
41533  * This ignores pointers and is_owned flags and looks at the values in fields.
41534  */
41535 bool SocketAddress_eq(const struct LDKSocketAddress *NONNULL_PTR a, const struct LDKSocketAddress *NONNULL_PTR b);
41536
41537 /**
41538  * Serialize the SocketAddress object into a byte array which can be read by SocketAddress_read
41539  */
41540 struct LDKCVec_u8Z SocketAddress_write(const struct LDKSocketAddress *NONNULL_PTR obj);
41541
41542 /**
41543  * Read a SocketAddress from a byte array, created by SocketAddress_write
41544  */
41545 struct LDKCResult_SocketAddressDecodeErrorZ SocketAddress_read(struct LDKu8slice ser);
41546
41547 /**
41548  * Creates a copy of the SocketAddressParseError
41549  */
41550 enum LDKSocketAddressParseError SocketAddressParseError_clone(const enum LDKSocketAddressParseError *NONNULL_PTR orig);
41551
41552 /**
41553  * Utility method to constructs a new SocketAddrParse-variant SocketAddressParseError
41554  */
41555 enum LDKSocketAddressParseError SocketAddressParseError_socket_addr_parse(void);
41556
41557 /**
41558  * Utility method to constructs a new InvalidInput-variant SocketAddressParseError
41559  */
41560 enum LDKSocketAddressParseError SocketAddressParseError_invalid_input(void);
41561
41562 /**
41563  * Utility method to constructs a new InvalidPort-variant SocketAddressParseError
41564  */
41565 enum LDKSocketAddressParseError SocketAddressParseError_invalid_port(void);
41566
41567 /**
41568  * Utility method to constructs a new InvalidOnionV3-variant SocketAddressParseError
41569  */
41570 enum LDKSocketAddressParseError SocketAddressParseError_invalid_onion_v3(void);
41571
41572 /**
41573  * Generates a non-cryptographic 64-bit hash of the SocketAddressParseError.
41574  */
41575 uint64_t SocketAddressParseError_hash(const enum LDKSocketAddressParseError *NONNULL_PTR o);
41576
41577 /**
41578  * Checks if two SocketAddressParseErrors contain equal inner contents.
41579  * This ignores pointers and is_owned flags and looks at the values in fields.
41580  */
41581 bool SocketAddressParseError_eq(const enum LDKSocketAddressParseError *NONNULL_PTR a, const enum LDKSocketAddressParseError *NONNULL_PTR b);
41582
41583 /**
41584  * Parses an OnionV3 host and port into a [`SocketAddress::OnionV3`].
41585  *
41586  * The host part must end with \".onion\".
41587  */
41588 struct LDKCResult_SocketAddressSocketAddressParseErrorZ parse_onion_address(struct LDKStr host, uint16_t port);
41589
41590 /**
41591  * Get the string representation of a SocketAddress object
41592  */
41593 struct LDKStr SocketAddress_to_str(const struct LDKSocketAddress *NONNULL_PTR o);
41594
41595 /**
41596  * Read a SocketAddress object from a string
41597  */
41598 struct LDKCResult_SocketAddressSocketAddressParseErrorZ SocketAddress_from_str(struct LDKStr s);
41599
41600 /**
41601  * Frees any resources used by the UnsignedGossipMessage
41602  */
41603 void UnsignedGossipMessage_free(struct LDKUnsignedGossipMessage this_ptr);
41604
41605 /**
41606  * Creates a copy of the UnsignedGossipMessage
41607  */
41608 struct LDKUnsignedGossipMessage UnsignedGossipMessage_clone(const struct LDKUnsignedGossipMessage *NONNULL_PTR orig);
41609
41610 /**
41611  * Utility method to constructs a new ChannelAnnouncement-variant UnsignedGossipMessage
41612  */
41613 struct LDKUnsignedGossipMessage UnsignedGossipMessage_channel_announcement(struct LDKUnsignedChannelAnnouncement a);
41614
41615 /**
41616  * Utility method to constructs a new ChannelUpdate-variant UnsignedGossipMessage
41617  */
41618 struct LDKUnsignedGossipMessage UnsignedGossipMessage_channel_update(struct LDKUnsignedChannelUpdate a);
41619
41620 /**
41621  * Utility method to constructs a new NodeAnnouncement-variant UnsignedGossipMessage
41622  */
41623 struct LDKUnsignedGossipMessage UnsignedGossipMessage_node_announcement(struct LDKUnsignedNodeAnnouncement a);
41624
41625 /**
41626  * Serialize the UnsignedGossipMessage object into a byte array which can be read by UnsignedGossipMessage_read
41627  */
41628 struct LDKCVec_u8Z UnsignedGossipMessage_write(const struct LDKUnsignedGossipMessage *NONNULL_PTR obj);
41629
41630 /**
41631  * Frees any resources used by the UnsignedNodeAnnouncement, if is_owned is set and inner is non-NULL.
41632  */
41633 void UnsignedNodeAnnouncement_free(struct LDKUnsignedNodeAnnouncement this_obj);
41634
41635 /**
41636  * The advertised features
41637  */
41638 struct LDKNodeFeatures UnsignedNodeAnnouncement_get_features(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
41639
41640 /**
41641  * The advertised features
41642  */
41643 void UnsignedNodeAnnouncement_set_features(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
41644
41645 /**
41646  * A strictly monotonic announcement counter, with gaps allowed
41647  */
41648 uint32_t UnsignedNodeAnnouncement_get_timestamp(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
41649
41650 /**
41651  * A strictly monotonic announcement counter, with gaps allowed
41652  */
41653 void UnsignedNodeAnnouncement_set_timestamp(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, uint32_t val);
41654
41655 /**
41656  * The `node_id` this announcement originated from (don't rebroadcast the `node_announcement` back
41657  * to this node).
41658  */
41659 struct LDKNodeId UnsignedNodeAnnouncement_get_node_id(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
41660
41661 /**
41662  * The `node_id` this announcement originated from (don't rebroadcast the `node_announcement` back
41663  * to this node).
41664  */
41665 void UnsignedNodeAnnouncement_set_node_id(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeId val);
41666
41667 /**
41668  * An RGB color for UI purposes
41669  */
41670 const uint8_t (*UnsignedNodeAnnouncement_get_rgb(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[3];
41671
41672 /**
41673  * An RGB color for UI purposes
41674  */
41675 void UnsignedNodeAnnouncement_set_rgb(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
41676
41677 /**
41678  * An alias, for UI purposes.
41679  *
41680  * This should be sanitized before use. There is no guarantee of uniqueness.
41681  */
41682 struct LDKNodeAlias UnsignedNodeAnnouncement_get_alias(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
41683
41684 /**
41685  * An alias, for UI purposes.
41686  *
41687  * This should be sanitized before use. There is no guarantee of uniqueness.
41688  */
41689 void UnsignedNodeAnnouncement_set_alias(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeAlias val);
41690
41691 /**
41692  * List of addresses on which this node is reachable
41693  *
41694  * Returns a copy of the field.
41695  */
41696 struct LDKCVec_SocketAddressZ UnsignedNodeAnnouncement_get_addresses(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
41697
41698 /**
41699  * List of addresses on which this node is reachable
41700  */
41701 void UnsignedNodeAnnouncement_set_addresses(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKCVec_SocketAddressZ val);
41702
41703 /**
41704  * Excess address data which was signed as a part of the message which we do not (yet) understand how
41705  * to decode.
41706  *
41707  * This is stored to ensure forward-compatibility as new address types are added to the lightning gossip protocol.
41708  *
41709  * Returns a copy of the field.
41710  */
41711 struct LDKCVec_u8Z UnsignedNodeAnnouncement_get_excess_address_data(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
41712
41713 /**
41714  * Excess address data which was signed as a part of the message which we do not (yet) understand how
41715  * to decode.
41716  *
41717  * This is stored to ensure forward-compatibility as new address types are added to the lightning gossip protocol.
41718  */
41719 void UnsignedNodeAnnouncement_set_excess_address_data(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
41720
41721 /**
41722  * Excess data which was signed as a part of the message which we do not (yet) understand how
41723  * to decode.
41724  *
41725  * This is stored to ensure forward-compatibility as new fields are added to the lightning gossip protocol.
41726  *
41727  * Returns a copy of the field.
41728  */
41729 struct LDKCVec_u8Z UnsignedNodeAnnouncement_get_excess_data(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
41730
41731 /**
41732  * Excess data which was signed as a part of the message which we do not (yet) understand how
41733  * to decode.
41734  *
41735  * This is stored to ensure forward-compatibility as new fields are added to the lightning gossip protocol.
41736  */
41737 void UnsignedNodeAnnouncement_set_excess_data(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
41738
41739 /**
41740  * Constructs a new UnsignedNodeAnnouncement given each field
41741  */
41742 MUST_USE_RES struct LDKUnsignedNodeAnnouncement UnsignedNodeAnnouncement_new(struct LDKNodeFeatures features_arg, uint32_t timestamp_arg, struct LDKNodeId node_id_arg, struct LDKThreeBytes rgb_arg, struct LDKNodeAlias alias_arg, struct LDKCVec_SocketAddressZ addresses_arg, struct LDKCVec_u8Z excess_address_data_arg, struct LDKCVec_u8Z excess_data_arg);
41743
41744 /**
41745  * Creates a copy of the UnsignedNodeAnnouncement
41746  */
41747 struct LDKUnsignedNodeAnnouncement UnsignedNodeAnnouncement_clone(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR orig);
41748
41749 /**
41750  * Generates a non-cryptographic 64-bit hash of the UnsignedNodeAnnouncement.
41751  */
41752 uint64_t UnsignedNodeAnnouncement_hash(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR o);
41753
41754 /**
41755  * Checks if two UnsignedNodeAnnouncements contain equal inner contents.
41756  * This ignores pointers and is_owned flags and looks at the values in fields.
41757  * Two objects with NULL inner values will be considered "equal" here.
41758  */
41759 bool UnsignedNodeAnnouncement_eq(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR a, const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR b);
41760
41761 /**
41762  * Frees any resources used by the NodeAnnouncement, if is_owned is set and inner is non-NULL.
41763  */
41764 void NodeAnnouncement_free(struct LDKNodeAnnouncement this_obj);
41765
41766 /**
41767  * The signature by the node key
41768  */
41769 struct LDKECDSASignature NodeAnnouncement_get_signature(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
41770
41771 /**
41772  * The signature by the node key
41773  */
41774 void NodeAnnouncement_set_signature(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKECDSASignature val);
41775
41776 /**
41777  * The actual content of the announcement
41778  */
41779 struct LDKUnsignedNodeAnnouncement NodeAnnouncement_get_contents(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
41780
41781 /**
41782  * The actual content of the announcement
41783  */
41784 void NodeAnnouncement_set_contents(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedNodeAnnouncement val);
41785
41786 /**
41787  * Constructs a new NodeAnnouncement given each field
41788  */
41789 MUST_USE_RES struct LDKNodeAnnouncement NodeAnnouncement_new(struct LDKECDSASignature signature_arg, struct LDKUnsignedNodeAnnouncement contents_arg);
41790
41791 /**
41792  * Creates a copy of the NodeAnnouncement
41793  */
41794 struct LDKNodeAnnouncement NodeAnnouncement_clone(const struct LDKNodeAnnouncement *NONNULL_PTR orig);
41795
41796 /**
41797  * Generates a non-cryptographic 64-bit hash of the NodeAnnouncement.
41798  */
41799 uint64_t NodeAnnouncement_hash(const struct LDKNodeAnnouncement *NONNULL_PTR o);
41800
41801 /**
41802  * Checks if two NodeAnnouncements contain equal inner contents.
41803  * This ignores pointers and is_owned flags and looks at the values in fields.
41804  * Two objects with NULL inner values will be considered "equal" here.
41805  */
41806 bool NodeAnnouncement_eq(const struct LDKNodeAnnouncement *NONNULL_PTR a, const struct LDKNodeAnnouncement *NONNULL_PTR b);
41807
41808 /**
41809  * Frees any resources used by the UnsignedChannelAnnouncement, if is_owned is set and inner is non-NULL.
41810  */
41811 void UnsignedChannelAnnouncement_free(struct LDKUnsignedChannelAnnouncement this_obj);
41812
41813 /**
41814  * The advertised channel features
41815  */
41816 struct LDKChannelFeatures UnsignedChannelAnnouncement_get_features(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
41817
41818 /**
41819  * The advertised channel features
41820  */
41821 void UnsignedChannelAnnouncement_set_features(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
41822
41823 /**
41824  * The genesis hash of the blockchain where the channel is to be opened
41825  */
41826 const uint8_t (*UnsignedChannelAnnouncement_get_chain_hash(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr))[32];
41827
41828 /**
41829  * The genesis hash of the blockchain where the channel is to be opened
41830  */
41831 void UnsignedChannelAnnouncement_set_chain_hash(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
41832
41833 /**
41834  * The short channel ID
41835  */
41836 uint64_t UnsignedChannelAnnouncement_get_short_channel_id(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
41837
41838 /**
41839  * The short channel ID
41840  */
41841 void UnsignedChannelAnnouncement_set_short_channel_id(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, uint64_t val);
41842
41843 /**
41844  * One of the two `node_id`s which are endpoints of this channel
41845  */
41846 struct LDKNodeId UnsignedChannelAnnouncement_get_node_id_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
41847
41848 /**
41849  * One of the two `node_id`s which are endpoints of this channel
41850  */
41851 void UnsignedChannelAnnouncement_set_node_id_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeId val);
41852
41853 /**
41854  * The other of the two `node_id`s which are endpoints of this channel
41855  */
41856 struct LDKNodeId UnsignedChannelAnnouncement_get_node_id_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
41857
41858 /**
41859  * The other of the two `node_id`s which are endpoints of this channel
41860  */
41861 void UnsignedChannelAnnouncement_set_node_id_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeId val);
41862
41863 /**
41864  * The funding key for the first node
41865  */
41866 struct LDKNodeId UnsignedChannelAnnouncement_get_bitcoin_key_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
41867
41868 /**
41869  * The funding key for the first node
41870  */
41871 void UnsignedChannelAnnouncement_set_bitcoin_key_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeId val);
41872
41873 /**
41874  * The funding key for the second node
41875  */
41876 struct LDKNodeId UnsignedChannelAnnouncement_get_bitcoin_key_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
41877
41878 /**
41879  * The funding key for the second node
41880  */
41881 void UnsignedChannelAnnouncement_set_bitcoin_key_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeId val);
41882
41883 /**
41884  * Excess data which was signed as a part of the message which we do not (yet) understand how
41885  * to decode.
41886  *
41887  * This is stored to ensure forward-compatibility as new fields are added to the lightning gossip protocol.
41888  *
41889  * Returns a copy of the field.
41890  */
41891 struct LDKCVec_u8Z UnsignedChannelAnnouncement_get_excess_data(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
41892
41893 /**
41894  * Excess data which was signed as a part of the message which we do not (yet) understand how
41895  * to decode.
41896  *
41897  * This is stored to ensure forward-compatibility as new fields are added to the lightning gossip protocol.
41898  */
41899 void UnsignedChannelAnnouncement_set_excess_data(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
41900
41901 /**
41902  * Constructs a new UnsignedChannelAnnouncement given each field
41903  */
41904 MUST_USE_RES struct LDKUnsignedChannelAnnouncement UnsignedChannelAnnouncement_new(struct LDKChannelFeatures features_arg, struct LDKThirtyTwoBytes chain_hash_arg, uint64_t short_channel_id_arg, struct LDKNodeId node_id_1_arg, struct LDKNodeId node_id_2_arg, struct LDKNodeId bitcoin_key_1_arg, struct LDKNodeId bitcoin_key_2_arg, struct LDKCVec_u8Z excess_data_arg);
41905
41906 /**
41907  * Creates a copy of the UnsignedChannelAnnouncement
41908  */
41909 struct LDKUnsignedChannelAnnouncement UnsignedChannelAnnouncement_clone(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR orig);
41910
41911 /**
41912  * Generates a non-cryptographic 64-bit hash of the UnsignedChannelAnnouncement.
41913  */
41914 uint64_t UnsignedChannelAnnouncement_hash(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR o);
41915
41916 /**
41917  * Checks if two UnsignedChannelAnnouncements contain equal inner contents.
41918  * This ignores pointers and is_owned flags and looks at the values in fields.
41919  * Two objects with NULL inner values will be considered "equal" here.
41920  */
41921 bool UnsignedChannelAnnouncement_eq(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR a, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR b);
41922
41923 /**
41924  * Frees any resources used by the ChannelAnnouncement, if is_owned is set and inner is non-NULL.
41925  */
41926 void ChannelAnnouncement_free(struct LDKChannelAnnouncement this_obj);
41927
41928 /**
41929  * Authentication of the announcement by the first public node
41930  */
41931 struct LDKECDSASignature ChannelAnnouncement_get_node_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
41932
41933 /**
41934  * Authentication of the announcement by the first public node
41935  */
41936 void ChannelAnnouncement_set_node_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKECDSASignature val);
41937
41938 /**
41939  * Authentication of the announcement by the second public node
41940  */
41941 struct LDKECDSASignature ChannelAnnouncement_get_node_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
41942
41943 /**
41944  * Authentication of the announcement by the second public node
41945  */
41946 void ChannelAnnouncement_set_node_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKECDSASignature val);
41947
41948 /**
41949  * Proof of funding UTXO ownership by the first public node
41950  */
41951 struct LDKECDSASignature ChannelAnnouncement_get_bitcoin_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
41952
41953 /**
41954  * Proof of funding UTXO ownership by the first public node
41955  */
41956 void ChannelAnnouncement_set_bitcoin_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKECDSASignature val);
41957
41958 /**
41959  * Proof of funding UTXO ownership by the second public node
41960  */
41961 struct LDKECDSASignature ChannelAnnouncement_get_bitcoin_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
41962
41963 /**
41964  * Proof of funding UTXO ownership by the second public node
41965  */
41966 void ChannelAnnouncement_set_bitcoin_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKECDSASignature val);
41967
41968 /**
41969  * The actual announcement
41970  */
41971 struct LDKUnsignedChannelAnnouncement ChannelAnnouncement_get_contents(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
41972
41973 /**
41974  * The actual announcement
41975  */
41976 void ChannelAnnouncement_set_contents(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedChannelAnnouncement val);
41977
41978 /**
41979  * Constructs a new ChannelAnnouncement given each field
41980  */
41981 MUST_USE_RES struct LDKChannelAnnouncement ChannelAnnouncement_new(struct LDKECDSASignature node_signature_1_arg, struct LDKECDSASignature node_signature_2_arg, struct LDKECDSASignature bitcoin_signature_1_arg, struct LDKECDSASignature bitcoin_signature_2_arg, struct LDKUnsignedChannelAnnouncement contents_arg);
41982
41983 /**
41984  * Creates a copy of the ChannelAnnouncement
41985  */
41986 struct LDKChannelAnnouncement ChannelAnnouncement_clone(const struct LDKChannelAnnouncement *NONNULL_PTR orig);
41987
41988 /**
41989  * Generates a non-cryptographic 64-bit hash of the ChannelAnnouncement.
41990  */
41991 uint64_t ChannelAnnouncement_hash(const struct LDKChannelAnnouncement *NONNULL_PTR o);
41992
41993 /**
41994  * Checks if two ChannelAnnouncements contain equal inner contents.
41995  * This ignores pointers and is_owned flags and looks at the values in fields.
41996  * Two objects with NULL inner values will be considered "equal" here.
41997  */
41998 bool ChannelAnnouncement_eq(const struct LDKChannelAnnouncement *NONNULL_PTR a, const struct LDKChannelAnnouncement *NONNULL_PTR b);
41999
42000 /**
42001  * Frees any resources used by the UnsignedChannelUpdate, if is_owned is set and inner is non-NULL.
42002  */
42003 void UnsignedChannelUpdate_free(struct LDKUnsignedChannelUpdate this_obj);
42004
42005 /**
42006  * The genesis hash of the blockchain where the channel is to be opened
42007  */
42008 const uint8_t (*UnsignedChannelUpdate_get_chain_hash(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr))[32];
42009
42010 /**
42011  * The genesis hash of the blockchain where the channel is to be opened
42012  */
42013 void UnsignedChannelUpdate_set_chain_hash(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
42014
42015 /**
42016  * The short channel ID
42017  */
42018 uint64_t UnsignedChannelUpdate_get_short_channel_id(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
42019
42020 /**
42021  * The short channel ID
42022  */
42023 void UnsignedChannelUpdate_set_short_channel_id(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
42024
42025 /**
42026  * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
42027  */
42028 uint32_t UnsignedChannelUpdate_get_timestamp(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
42029
42030 /**
42031  * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
42032  */
42033 void UnsignedChannelUpdate_set_timestamp(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
42034
42035 /**
42036  * Channel flags
42037  */
42038 uint8_t UnsignedChannelUpdate_get_flags(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
42039
42040 /**
42041  * Channel flags
42042  */
42043 void UnsignedChannelUpdate_set_flags(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint8_t val);
42044
42045 /**
42046  * The number of blocks such that if:
42047  * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
42048  * then we need to fail the HTLC backwards. When forwarding an HTLC, `cltv_expiry_delta` determines
42049  * the outgoing HTLC's minimum `cltv_expiry` value -- so, if an incoming HTLC comes in with a
42050  * `cltv_expiry` of 100000, and the node we're forwarding to has a `cltv_expiry_delta` value of 10,
42051  * then we'll check that the outgoing HTLC's `cltv_expiry` value is at least 100010 before
42052  * forwarding. Note that the HTLC sender is the one who originally sets this value when
42053  * constructing the route.
42054  */
42055 uint16_t UnsignedChannelUpdate_get_cltv_expiry_delta(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
42056
42057 /**
42058  * The number of blocks such that if:
42059  * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
42060  * then we need to fail the HTLC backwards. When forwarding an HTLC, `cltv_expiry_delta` determines
42061  * the outgoing HTLC's minimum `cltv_expiry` value -- so, if an incoming HTLC comes in with a
42062  * `cltv_expiry` of 100000, and the node we're forwarding to has a `cltv_expiry_delta` value of 10,
42063  * then we'll check that the outgoing HTLC's `cltv_expiry` value is at least 100010 before
42064  * forwarding. Note that the HTLC sender is the one who originally sets this value when
42065  * constructing the route.
42066  */
42067 void UnsignedChannelUpdate_set_cltv_expiry_delta(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint16_t val);
42068
42069 /**
42070  * The minimum HTLC size incoming to sender, in milli-satoshi
42071  */
42072 uint64_t UnsignedChannelUpdate_get_htlc_minimum_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
42073
42074 /**
42075  * The minimum HTLC size incoming to sender, in milli-satoshi
42076  */
42077 void UnsignedChannelUpdate_set_htlc_minimum_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
42078
42079 /**
42080  * The maximum HTLC value incoming to sender, in milli-satoshi.
42081  *
42082  * This used to be optional.
42083  */
42084 uint64_t UnsignedChannelUpdate_get_htlc_maximum_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
42085
42086 /**
42087  * The maximum HTLC value incoming to sender, in milli-satoshi.
42088  *
42089  * This used to be optional.
42090  */
42091 void UnsignedChannelUpdate_set_htlc_maximum_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
42092
42093 /**
42094  * The base HTLC fee charged by sender, in milli-satoshi
42095  */
42096 uint32_t UnsignedChannelUpdate_get_fee_base_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
42097
42098 /**
42099  * The base HTLC fee charged by sender, in milli-satoshi
42100  */
42101 void UnsignedChannelUpdate_set_fee_base_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
42102
42103 /**
42104  * The amount to fee multiplier, in micro-satoshi
42105  */
42106 uint32_t UnsignedChannelUpdate_get_fee_proportional_millionths(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
42107
42108 /**
42109  * The amount to fee multiplier, in micro-satoshi
42110  */
42111 void UnsignedChannelUpdate_set_fee_proportional_millionths(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
42112
42113 /**
42114  * Excess data which was signed as a part of the message which we do not (yet) understand how
42115  * to decode.
42116  *
42117  * This is stored to ensure forward-compatibility as new fields are added to the lightning gossip protocol.
42118  *
42119  * Returns a copy of the field.
42120  */
42121 struct LDKCVec_u8Z UnsignedChannelUpdate_get_excess_data(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
42122
42123 /**
42124  * Excess data which was signed as a part of the message which we do not (yet) understand how
42125  * to decode.
42126  *
42127  * This is stored to ensure forward-compatibility as new fields are added to the lightning gossip protocol.
42128  */
42129 void UnsignedChannelUpdate_set_excess_data(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
42130
42131 /**
42132  * Constructs a new UnsignedChannelUpdate given each field
42133  */
42134 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);
42135
42136 /**
42137  * Creates a copy of the UnsignedChannelUpdate
42138  */
42139 struct LDKUnsignedChannelUpdate UnsignedChannelUpdate_clone(const struct LDKUnsignedChannelUpdate *NONNULL_PTR orig);
42140
42141 /**
42142  * Generates a non-cryptographic 64-bit hash of the UnsignedChannelUpdate.
42143  */
42144 uint64_t UnsignedChannelUpdate_hash(const struct LDKUnsignedChannelUpdate *NONNULL_PTR o);
42145
42146 /**
42147  * Checks if two UnsignedChannelUpdates contain equal inner contents.
42148  * This ignores pointers and is_owned flags and looks at the values in fields.
42149  * Two objects with NULL inner values will be considered "equal" here.
42150  */
42151 bool UnsignedChannelUpdate_eq(const struct LDKUnsignedChannelUpdate *NONNULL_PTR a, const struct LDKUnsignedChannelUpdate *NONNULL_PTR b);
42152
42153 /**
42154  * Frees any resources used by the ChannelUpdate, if is_owned is set and inner is non-NULL.
42155  */
42156 void ChannelUpdate_free(struct LDKChannelUpdate this_obj);
42157
42158 /**
42159  * A signature of the channel update
42160  */
42161 struct LDKECDSASignature ChannelUpdate_get_signature(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
42162
42163 /**
42164  * A signature of the channel update
42165  */
42166 void ChannelUpdate_set_signature(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKECDSASignature val);
42167
42168 /**
42169  * The actual channel update
42170  */
42171 struct LDKUnsignedChannelUpdate ChannelUpdate_get_contents(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
42172
42173 /**
42174  * The actual channel update
42175  */
42176 void ChannelUpdate_set_contents(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKUnsignedChannelUpdate val);
42177
42178 /**
42179  * Constructs a new ChannelUpdate given each field
42180  */
42181 MUST_USE_RES struct LDKChannelUpdate ChannelUpdate_new(struct LDKECDSASignature signature_arg, struct LDKUnsignedChannelUpdate contents_arg);
42182
42183 /**
42184  * Creates a copy of the ChannelUpdate
42185  */
42186 struct LDKChannelUpdate ChannelUpdate_clone(const struct LDKChannelUpdate *NONNULL_PTR orig);
42187
42188 /**
42189  * Generates a non-cryptographic 64-bit hash of the ChannelUpdate.
42190  */
42191 uint64_t ChannelUpdate_hash(const struct LDKChannelUpdate *NONNULL_PTR o);
42192
42193 /**
42194  * Checks if two ChannelUpdates contain equal inner contents.
42195  * This ignores pointers and is_owned flags and looks at the values in fields.
42196  * Two objects with NULL inner values will be considered "equal" here.
42197  */
42198 bool ChannelUpdate_eq(const struct LDKChannelUpdate *NONNULL_PTR a, const struct LDKChannelUpdate *NONNULL_PTR b);
42199
42200 /**
42201  * Frees any resources used by the QueryChannelRange, if is_owned is set and inner is non-NULL.
42202  */
42203 void QueryChannelRange_free(struct LDKQueryChannelRange this_obj);
42204
42205 /**
42206  * The genesis hash of the blockchain being queried
42207  */
42208 const uint8_t (*QueryChannelRange_get_chain_hash(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr))[32];
42209
42210 /**
42211  * The genesis hash of the blockchain being queried
42212  */
42213 void QueryChannelRange_set_chain_hash(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
42214
42215 /**
42216  * The height of the first block for the channel UTXOs being queried
42217  */
42218 uint32_t QueryChannelRange_get_first_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
42219
42220 /**
42221  * The height of the first block for the channel UTXOs being queried
42222  */
42223 void QueryChannelRange_set_first_blocknum(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
42224
42225 /**
42226  * The number of blocks to include in the query results
42227  */
42228 uint32_t QueryChannelRange_get_number_of_blocks(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
42229
42230 /**
42231  * The number of blocks to include in the query results
42232  */
42233 void QueryChannelRange_set_number_of_blocks(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
42234
42235 /**
42236  * Constructs a new QueryChannelRange given each field
42237  */
42238 MUST_USE_RES struct LDKQueryChannelRange QueryChannelRange_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_blocknum_arg, uint32_t number_of_blocks_arg);
42239
42240 /**
42241  * Creates a copy of the QueryChannelRange
42242  */
42243 struct LDKQueryChannelRange QueryChannelRange_clone(const struct LDKQueryChannelRange *NONNULL_PTR orig);
42244
42245 /**
42246  * Generates a non-cryptographic 64-bit hash of the QueryChannelRange.
42247  */
42248 uint64_t QueryChannelRange_hash(const struct LDKQueryChannelRange *NONNULL_PTR o);
42249
42250 /**
42251  * Checks if two QueryChannelRanges contain equal inner contents.
42252  * This ignores pointers and is_owned flags and looks at the values in fields.
42253  * Two objects with NULL inner values will be considered "equal" here.
42254  */
42255 bool QueryChannelRange_eq(const struct LDKQueryChannelRange *NONNULL_PTR a, const struct LDKQueryChannelRange *NONNULL_PTR b);
42256
42257 /**
42258  * Frees any resources used by the ReplyChannelRange, if is_owned is set and inner is non-NULL.
42259  */
42260 void ReplyChannelRange_free(struct LDKReplyChannelRange this_obj);
42261
42262 /**
42263  * The genesis hash of the blockchain being queried
42264  */
42265 const uint8_t (*ReplyChannelRange_get_chain_hash(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr))[32];
42266
42267 /**
42268  * The genesis hash of the blockchain being queried
42269  */
42270 void ReplyChannelRange_set_chain_hash(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
42271
42272 /**
42273  * The height of the first block in the range of the reply
42274  */
42275 uint32_t ReplyChannelRange_get_first_blocknum(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
42276
42277 /**
42278  * The height of the first block in the range of the reply
42279  */
42280 void ReplyChannelRange_set_first_blocknum(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
42281
42282 /**
42283  * The number of blocks included in the range of the reply
42284  */
42285 uint32_t ReplyChannelRange_get_number_of_blocks(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
42286
42287 /**
42288  * The number of blocks included in the range of the reply
42289  */
42290 void ReplyChannelRange_set_number_of_blocks(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
42291
42292 /**
42293  * True when this is the final reply for a query
42294  */
42295 bool ReplyChannelRange_get_sync_complete(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
42296
42297 /**
42298  * True when this is the final reply for a query
42299  */
42300 void ReplyChannelRange_set_sync_complete(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, bool val);
42301
42302 /**
42303  * The `short_channel_id`s in the channel range
42304  *
42305  * Returns a copy of the field.
42306  */
42307 struct LDKCVec_u64Z ReplyChannelRange_get_short_channel_ids(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
42308
42309 /**
42310  * The `short_channel_id`s in the channel range
42311  */
42312 void ReplyChannelRange_set_short_channel_ids(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
42313
42314 /**
42315  * Constructs a new ReplyChannelRange given each field
42316  */
42317 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);
42318
42319 /**
42320  * Creates a copy of the ReplyChannelRange
42321  */
42322 struct LDKReplyChannelRange ReplyChannelRange_clone(const struct LDKReplyChannelRange *NONNULL_PTR orig);
42323
42324 /**
42325  * Generates a non-cryptographic 64-bit hash of the ReplyChannelRange.
42326  */
42327 uint64_t ReplyChannelRange_hash(const struct LDKReplyChannelRange *NONNULL_PTR o);
42328
42329 /**
42330  * Checks if two ReplyChannelRanges contain equal inner contents.
42331  * This ignores pointers and is_owned flags and looks at the values in fields.
42332  * Two objects with NULL inner values will be considered "equal" here.
42333  */
42334 bool ReplyChannelRange_eq(const struct LDKReplyChannelRange *NONNULL_PTR a, const struct LDKReplyChannelRange *NONNULL_PTR b);
42335
42336 /**
42337  * Frees any resources used by the QueryShortChannelIds, if is_owned is set and inner is non-NULL.
42338  */
42339 void QueryShortChannelIds_free(struct LDKQueryShortChannelIds this_obj);
42340
42341 /**
42342  * The genesis hash of the blockchain being queried
42343  */
42344 const uint8_t (*QueryShortChannelIds_get_chain_hash(const struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr))[32];
42345
42346 /**
42347  * The genesis hash of the blockchain being queried
42348  */
42349 void QueryShortChannelIds_set_chain_hash(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
42350
42351 /**
42352  * The short_channel_ids that are being queried
42353  *
42354  * Returns a copy of the field.
42355  */
42356 struct LDKCVec_u64Z QueryShortChannelIds_get_short_channel_ids(const struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr);
42357
42358 /**
42359  * The short_channel_ids that are being queried
42360  */
42361 void QueryShortChannelIds_set_short_channel_ids(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
42362
42363 /**
42364  * Constructs a new QueryShortChannelIds given each field
42365  */
42366 MUST_USE_RES struct LDKQueryShortChannelIds QueryShortChannelIds_new(struct LDKThirtyTwoBytes chain_hash_arg, struct LDKCVec_u64Z short_channel_ids_arg);
42367
42368 /**
42369  * Creates a copy of the QueryShortChannelIds
42370  */
42371 struct LDKQueryShortChannelIds QueryShortChannelIds_clone(const struct LDKQueryShortChannelIds *NONNULL_PTR orig);
42372
42373 /**
42374  * Generates a non-cryptographic 64-bit hash of the QueryShortChannelIds.
42375  */
42376 uint64_t QueryShortChannelIds_hash(const struct LDKQueryShortChannelIds *NONNULL_PTR o);
42377
42378 /**
42379  * Checks if two QueryShortChannelIdss 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 QueryShortChannelIds_eq(const struct LDKQueryShortChannelIds *NONNULL_PTR a, const struct LDKQueryShortChannelIds *NONNULL_PTR b);
42384
42385 /**
42386  * Frees any resources used by the ReplyShortChannelIdsEnd, if is_owned is set and inner is non-NULL.
42387  */
42388 void ReplyShortChannelIdsEnd_free(struct LDKReplyShortChannelIdsEnd this_obj);
42389
42390 /**
42391  * The genesis hash of the blockchain that was queried
42392  */
42393 const uint8_t (*ReplyShortChannelIdsEnd_get_chain_hash(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr))[32];
42394
42395 /**
42396  * The genesis hash of the blockchain that was queried
42397  */
42398 void ReplyShortChannelIdsEnd_set_chain_hash(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
42399
42400 /**
42401  * Indicates if the query recipient maintains up-to-date channel
42402  * information for the `chain_hash`
42403  */
42404 bool ReplyShortChannelIdsEnd_get_full_information(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr);
42405
42406 /**
42407  * Indicates if the query recipient maintains up-to-date channel
42408  * information for the `chain_hash`
42409  */
42410 void ReplyShortChannelIdsEnd_set_full_information(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, bool val);
42411
42412 /**
42413  * Constructs a new ReplyShortChannelIdsEnd given each field
42414  */
42415 MUST_USE_RES struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_new(struct LDKThirtyTwoBytes chain_hash_arg, bool full_information_arg);
42416
42417 /**
42418  * Creates a copy of the ReplyShortChannelIdsEnd
42419  */
42420 struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_clone(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR orig);
42421
42422 /**
42423  * Generates a non-cryptographic 64-bit hash of the ReplyShortChannelIdsEnd.
42424  */
42425 uint64_t ReplyShortChannelIdsEnd_hash(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR o);
42426
42427 /**
42428  * Checks if two ReplyShortChannelIdsEnds contain equal inner contents.
42429  * This ignores pointers and is_owned flags and looks at the values in fields.
42430  * Two objects with NULL inner values will be considered "equal" here.
42431  */
42432 bool ReplyShortChannelIdsEnd_eq(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR a, const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR b);
42433
42434 /**
42435  * Frees any resources used by the GossipTimestampFilter, if is_owned is set and inner is non-NULL.
42436  */
42437 void GossipTimestampFilter_free(struct LDKGossipTimestampFilter this_obj);
42438
42439 /**
42440  * The genesis hash of the blockchain for channel and node information
42441  */
42442 const uint8_t (*GossipTimestampFilter_get_chain_hash(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr))[32];
42443
42444 /**
42445  * The genesis hash of the blockchain for channel and node information
42446  */
42447 void GossipTimestampFilter_set_chain_hash(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
42448
42449 /**
42450  * The starting unix timestamp
42451  */
42452 uint32_t GossipTimestampFilter_get_first_timestamp(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
42453
42454 /**
42455  * The starting unix timestamp
42456  */
42457 void GossipTimestampFilter_set_first_timestamp(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
42458
42459 /**
42460  * The range of information in seconds
42461  */
42462 uint32_t GossipTimestampFilter_get_timestamp_range(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
42463
42464 /**
42465  * The range of information in seconds
42466  */
42467 void GossipTimestampFilter_set_timestamp_range(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
42468
42469 /**
42470  * Constructs a new GossipTimestampFilter given each field
42471  */
42472 MUST_USE_RES struct LDKGossipTimestampFilter GossipTimestampFilter_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_timestamp_arg, uint32_t timestamp_range_arg);
42473
42474 /**
42475  * Creates a copy of the GossipTimestampFilter
42476  */
42477 struct LDKGossipTimestampFilter GossipTimestampFilter_clone(const struct LDKGossipTimestampFilter *NONNULL_PTR orig);
42478
42479 /**
42480  * Generates a non-cryptographic 64-bit hash of the GossipTimestampFilter.
42481  */
42482 uint64_t GossipTimestampFilter_hash(const struct LDKGossipTimestampFilter *NONNULL_PTR o);
42483
42484 /**
42485  * Checks if two GossipTimestampFilters contain equal inner contents.
42486  * This ignores pointers and is_owned flags and looks at the values in fields.
42487  * Two objects with NULL inner values will be considered "equal" here.
42488  */
42489 bool GossipTimestampFilter_eq(const struct LDKGossipTimestampFilter *NONNULL_PTR a, const struct LDKGossipTimestampFilter *NONNULL_PTR b);
42490
42491 /**
42492  * Frees any resources used by the ErrorAction
42493  */
42494 void ErrorAction_free(struct LDKErrorAction this_ptr);
42495
42496 /**
42497  * Creates a copy of the ErrorAction
42498  */
42499 struct LDKErrorAction ErrorAction_clone(const struct LDKErrorAction *NONNULL_PTR orig);
42500
42501 /**
42502  * Utility method to constructs a new DisconnectPeer-variant ErrorAction
42503  */
42504 struct LDKErrorAction ErrorAction_disconnect_peer(struct LDKErrorMessage msg);
42505
42506 /**
42507  * Utility method to constructs a new DisconnectPeerWithWarning-variant ErrorAction
42508  */
42509 struct LDKErrorAction ErrorAction_disconnect_peer_with_warning(struct LDKWarningMessage msg);
42510
42511 /**
42512  * Utility method to constructs a new IgnoreError-variant ErrorAction
42513  */
42514 struct LDKErrorAction ErrorAction_ignore_error(void);
42515
42516 /**
42517  * Utility method to constructs a new IgnoreAndLog-variant ErrorAction
42518  */
42519 struct LDKErrorAction ErrorAction_ignore_and_log(enum LDKLevel a);
42520
42521 /**
42522  * Utility method to constructs a new IgnoreDuplicateGossip-variant ErrorAction
42523  */
42524 struct LDKErrorAction ErrorAction_ignore_duplicate_gossip(void);
42525
42526 /**
42527  * Utility method to constructs a new SendErrorMessage-variant ErrorAction
42528  */
42529 struct LDKErrorAction ErrorAction_send_error_message(struct LDKErrorMessage msg);
42530
42531 /**
42532  * Utility method to constructs a new SendWarningMessage-variant ErrorAction
42533  */
42534 struct LDKErrorAction ErrorAction_send_warning_message(struct LDKWarningMessage msg, enum LDKLevel log_level);
42535
42536 /**
42537  * Generates a non-cryptographic 64-bit hash of the ErrorAction.
42538  */
42539 uint64_t ErrorAction_hash(const struct LDKErrorAction *NONNULL_PTR o);
42540
42541 /**
42542  * Frees any resources used by the LightningError, if is_owned is set and inner is non-NULL.
42543  */
42544 void LightningError_free(struct LDKLightningError this_obj);
42545
42546 /**
42547  * A human-readable message describing the error
42548  */
42549 struct LDKStr LightningError_get_err(const struct LDKLightningError *NONNULL_PTR this_ptr);
42550
42551 /**
42552  * A human-readable message describing the error
42553  */
42554 void LightningError_set_err(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKStr val);
42555
42556 /**
42557  * The action which should be taken against the offending peer.
42558  */
42559 struct LDKErrorAction LightningError_get_action(const struct LDKLightningError *NONNULL_PTR this_ptr);
42560
42561 /**
42562  * The action which should be taken against the offending peer.
42563  */
42564 void LightningError_set_action(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKErrorAction val);
42565
42566 /**
42567  * Constructs a new LightningError given each field
42568  */
42569 MUST_USE_RES struct LDKLightningError LightningError_new(struct LDKStr err_arg, struct LDKErrorAction action_arg);
42570
42571 /**
42572  * Creates a copy of the LightningError
42573  */
42574 struct LDKLightningError LightningError_clone(const struct LDKLightningError *NONNULL_PTR orig);
42575
42576 /**
42577  * Frees any resources used by the CommitmentUpdate, if is_owned is set and inner is non-NULL.
42578  */
42579 void CommitmentUpdate_free(struct LDKCommitmentUpdate this_obj);
42580
42581 /**
42582  * `update_add_htlc` messages which should be sent
42583  */
42584 struct LDKCVec_UpdateAddHTLCZ CommitmentUpdate_get_update_add_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
42585
42586 /**
42587  * `update_add_htlc` messages which should be sent
42588  */
42589 void CommitmentUpdate_set_update_add_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateAddHTLCZ val);
42590
42591 /**
42592  * `update_fulfill_htlc` messages which should be sent
42593  */
42594 struct LDKCVec_UpdateFulfillHTLCZ CommitmentUpdate_get_update_fulfill_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
42595
42596 /**
42597  * `update_fulfill_htlc` messages which should be sent
42598  */
42599 void CommitmentUpdate_set_update_fulfill_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFulfillHTLCZ val);
42600
42601 /**
42602  * `update_fail_htlc` messages which should be sent
42603  */
42604 struct LDKCVec_UpdateFailHTLCZ CommitmentUpdate_get_update_fail_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
42605
42606 /**
42607  * `update_fail_htlc` messages which should be sent
42608  */
42609 void CommitmentUpdate_set_update_fail_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailHTLCZ val);
42610
42611 /**
42612  * `update_fail_malformed_htlc` messages which should be sent
42613  */
42614 struct LDKCVec_UpdateFailMalformedHTLCZ CommitmentUpdate_get_update_fail_malformed_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
42615
42616 /**
42617  * `update_fail_malformed_htlc` messages which should be sent
42618  */
42619 void CommitmentUpdate_set_update_fail_malformed_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailMalformedHTLCZ val);
42620
42621 /**
42622  * An `update_fee` message which should be sent
42623  *
42624  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
42625  */
42626 struct LDKUpdateFee CommitmentUpdate_get_update_fee(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
42627
42628 /**
42629  * An `update_fee` message which should be sent
42630  *
42631  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
42632  */
42633 void CommitmentUpdate_set_update_fee(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKUpdateFee val);
42634
42635 /**
42636  * A `commitment_signed` message which should be sent
42637  */
42638 struct LDKCommitmentSigned CommitmentUpdate_get_commitment_signed(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
42639
42640 /**
42641  * A `commitment_signed` message which should be sent
42642  */
42643 void CommitmentUpdate_set_commitment_signed(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCommitmentSigned val);
42644
42645 /**
42646  * Constructs a new CommitmentUpdate given each field
42647  *
42648  * Note that update_fee_arg (or a relevant inner pointer) may be NULL or all-0s to represent None
42649  */
42650 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);
42651
42652 /**
42653  * Creates a copy of the CommitmentUpdate
42654  */
42655 struct LDKCommitmentUpdate CommitmentUpdate_clone(const struct LDKCommitmentUpdate *NONNULL_PTR orig);
42656
42657 /**
42658  * Generates a non-cryptographic 64-bit hash of the CommitmentUpdate.
42659  */
42660 uint64_t CommitmentUpdate_hash(const struct LDKCommitmentUpdate *NONNULL_PTR o);
42661
42662 /**
42663  * Checks if two CommitmentUpdates contain equal inner contents.
42664  * This ignores pointers and is_owned flags and looks at the values in fields.
42665  * Two objects with NULL inner values will be considered "equal" here.
42666  */
42667 bool CommitmentUpdate_eq(const struct LDKCommitmentUpdate *NONNULL_PTR a, const struct LDKCommitmentUpdate *NONNULL_PTR b);
42668
42669 /**
42670  * Calls the free function if one is set
42671  */
42672 void ChannelMessageHandler_free(struct LDKChannelMessageHandler this_ptr);
42673
42674 /**
42675  * Calls the free function if one is set
42676  */
42677 void RoutingMessageHandler_free(struct LDKRoutingMessageHandler this_ptr);
42678
42679 /**
42680  * Calls the free function if one is set
42681  */
42682 void OnionMessageHandler_free(struct LDKOnionMessageHandler this_ptr);
42683
42684 /**
42685  * Frees any resources used by the FinalOnionHopData, if is_owned is set and inner is non-NULL.
42686  */
42687 void FinalOnionHopData_free(struct LDKFinalOnionHopData this_obj);
42688
42689 /**
42690  * When sending a multi-part payment, this secret is used to identify a payment across HTLCs.
42691  * Because it is generated by the recipient and included in the invoice, it also provides
42692  * proof to the recipient that the payment was sent by someone with the generated invoice.
42693  */
42694 const uint8_t (*FinalOnionHopData_get_payment_secret(const struct LDKFinalOnionHopData *NONNULL_PTR this_ptr))[32];
42695
42696 /**
42697  * When sending a multi-part payment, this secret is used to identify a payment across HTLCs.
42698  * Because it is generated by the recipient and included in the invoice, it also provides
42699  * proof to the recipient that the payment was sent by someone with the generated invoice.
42700  */
42701 void FinalOnionHopData_set_payment_secret(struct LDKFinalOnionHopData *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
42702
42703 /**
42704  * The intended total amount that this payment is for.
42705  *
42706  * Message serialization may panic if this value is more than 21 million Bitcoin.
42707  */
42708 uint64_t FinalOnionHopData_get_total_msat(const struct LDKFinalOnionHopData *NONNULL_PTR this_ptr);
42709
42710 /**
42711  * The intended total amount that this payment is for.
42712  *
42713  * Message serialization may panic if this value is more than 21 million Bitcoin.
42714  */
42715 void FinalOnionHopData_set_total_msat(struct LDKFinalOnionHopData *NONNULL_PTR this_ptr, uint64_t val);
42716
42717 /**
42718  * Constructs a new FinalOnionHopData given each field
42719  */
42720 MUST_USE_RES struct LDKFinalOnionHopData FinalOnionHopData_new(struct LDKThirtyTwoBytes payment_secret_arg, uint64_t total_msat_arg);
42721
42722 /**
42723  * Creates a copy of the FinalOnionHopData
42724  */
42725 struct LDKFinalOnionHopData FinalOnionHopData_clone(const struct LDKFinalOnionHopData *NONNULL_PTR orig);
42726
42727 /**
42728  * Frees any resources used by the OnionPacket, if is_owned is set and inner is non-NULL.
42729  */
42730 void OnionPacket_free(struct LDKOnionPacket this_obj);
42731
42732 /**
42733  * BOLT 4 version number.
42734  */
42735 uint8_t OnionPacket_get_version(const struct LDKOnionPacket *NONNULL_PTR this_ptr);
42736
42737 /**
42738  * BOLT 4 version number.
42739  */
42740 void OnionPacket_set_version(struct LDKOnionPacket *NONNULL_PTR this_ptr, uint8_t val);
42741
42742 /**
42743  * In order to ensure we always return an error on onion decode in compliance with [BOLT
42744  * #4](https://github.com/lightning/bolts/blob/master/04-onion-routing.md), we have to
42745  * deserialize `OnionPacket`s contained in [`UpdateAddHTLC`] messages even if the ephemeral
42746  * public key (here) is bogus, so we hold a [`Result`] instead of a [`PublicKey`] as we'd
42747  * like.
42748  *
42749  * Returns a copy of the field.
42750  */
42751 struct LDKCResult_PublicKeySecp256k1ErrorZ OnionPacket_get_public_key(const struct LDKOnionPacket *NONNULL_PTR this_ptr);
42752
42753 /**
42754  * In order to ensure we always return an error on onion decode in compliance with [BOLT
42755  * #4](https://github.com/lightning/bolts/blob/master/04-onion-routing.md), we have to
42756  * deserialize `OnionPacket`s contained in [`UpdateAddHTLC`] messages even if the ephemeral
42757  * public key (here) is bogus, so we hold a [`Result`] instead of a [`PublicKey`] as we'd
42758  * like.
42759  */
42760 void OnionPacket_set_public_key(struct LDKOnionPacket *NONNULL_PTR this_ptr, struct LDKCResult_PublicKeySecp256k1ErrorZ val);
42761
42762 /**
42763  * HMAC to verify the integrity of hop_data.
42764  */
42765 const uint8_t (*OnionPacket_get_hmac(const struct LDKOnionPacket *NONNULL_PTR this_ptr))[32];
42766
42767 /**
42768  * HMAC to verify the integrity of hop_data.
42769  */
42770 void OnionPacket_set_hmac(struct LDKOnionPacket *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
42771
42772 /**
42773  * Creates a copy of the OnionPacket
42774  */
42775 struct LDKOnionPacket OnionPacket_clone(const struct LDKOnionPacket *NONNULL_PTR orig);
42776
42777 /**
42778  * Generates a non-cryptographic 64-bit hash of the OnionPacket.
42779  */
42780 uint64_t OnionPacket_hash(const struct LDKOnionPacket *NONNULL_PTR o);
42781
42782 /**
42783  * Checks if two OnionPackets contain equal inner contents.
42784  * This ignores pointers and is_owned flags and looks at the values in fields.
42785  * Two objects with NULL inner values will be considered "equal" here.
42786  */
42787 bool OnionPacket_eq(const struct LDKOnionPacket *NONNULL_PTR a, const struct LDKOnionPacket *NONNULL_PTR b);
42788
42789 /**
42790  * Frees any resources used by the TrampolineOnionPacket, if is_owned is set and inner is non-NULL.
42791  */
42792 void TrampolineOnionPacket_free(struct LDKTrampolineOnionPacket this_obj);
42793
42794 /**
42795  * Bolt 04 version number
42796  */
42797 uint8_t TrampolineOnionPacket_get_version(const struct LDKTrampolineOnionPacket *NONNULL_PTR this_ptr);
42798
42799 /**
42800  * Bolt 04 version number
42801  */
42802 void TrampolineOnionPacket_set_version(struct LDKTrampolineOnionPacket *NONNULL_PTR this_ptr, uint8_t val);
42803
42804 /**
42805  * A random sepc256k1 point, used to build the ECDH shared secret to decrypt hop_data
42806  */
42807 struct LDKPublicKey TrampolineOnionPacket_get_public_key(const struct LDKTrampolineOnionPacket *NONNULL_PTR this_ptr);
42808
42809 /**
42810  * A random sepc256k1 point, used to build the ECDH shared secret to decrypt hop_data
42811  */
42812 void TrampolineOnionPacket_set_public_key(struct LDKTrampolineOnionPacket *NONNULL_PTR this_ptr, struct LDKPublicKey val);
42813
42814 /**
42815  * Encrypted payload for the next hop
42816  *
42817  * Returns a copy of the field.
42818  */
42819 struct LDKCVec_u8Z TrampolineOnionPacket_get_hop_data(const struct LDKTrampolineOnionPacket *NONNULL_PTR this_ptr);
42820
42821 /**
42822  * Encrypted payload for the next hop
42823  */
42824 void TrampolineOnionPacket_set_hop_data(struct LDKTrampolineOnionPacket *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
42825
42826 /**
42827  * HMAC to verify the integrity of hop_data
42828  */
42829 const uint8_t (*TrampolineOnionPacket_get_hmac(const struct LDKTrampolineOnionPacket *NONNULL_PTR this_ptr))[32];
42830
42831 /**
42832  * HMAC to verify the integrity of hop_data
42833  */
42834 void TrampolineOnionPacket_set_hmac(struct LDKTrampolineOnionPacket *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
42835
42836 /**
42837  * Constructs a new TrampolineOnionPacket given each field
42838  */
42839 MUST_USE_RES struct LDKTrampolineOnionPacket TrampolineOnionPacket_new(uint8_t version_arg, struct LDKPublicKey public_key_arg, struct LDKCVec_u8Z hop_data_arg, struct LDKThirtyTwoBytes hmac_arg);
42840
42841 /**
42842  * Creates a copy of the TrampolineOnionPacket
42843  */
42844 struct LDKTrampolineOnionPacket TrampolineOnionPacket_clone(const struct LDKTrampolineOnionPacket *NONNULL_PTR orig);
42845
42846 /**
42847  * Generates a non-cryptographic 64-bit hash of the TrampolineOnionPacket.
42848  */
42849 uint64_t TrampolineOnionPacket_hash(const struct LDKTrampolineOnionPacket *NONNULL_PTR o);
42850
42851 /**
42852  * Checks if two TrampolineOnionPackets contain equal inner contents.
42853  * This ignores pointers and is_owned flags and looks at the values in fields.
42854  * Two objects with NULL inner values will be considered "equal" here.
42855  */
42856 bool TrampolineOnionPacket_eq(const struct LDKTrampolineOnionPacket *NONNULL_PTR a, const struct LDKTrampolineOnionPacket *NONNULL_PTR b);
42857
42858 /**
42859  * Serialize the TrampolineOnionPacket object into a byte array which can be read by TrampolineOnionPacket_read
42860  */
42861 struct LDKCVec_u8Z TrampolineOnionPacket_write(const struct LDKTrampolineOnionPacket *NONNULL_PTR obj);
42862
42863 /**
42864  * Serialize the AcceptChannel object into a byte array which can be read by AcceptChannel_read
42865  */
42866 struct LDKCVec_u8Z AcceptChannel_write(const struct LDKAcceptChannel *NONNULL_PTR obj);
42867
42868 /**
42869  * Read a AcceptChannel from a byte array, created by AcceptChannel_write
42870  */
42871 struct LDKCResult_AcceptChannelDecodeErrorZ AcceptChannel_read(struct LDKu8slice ser);
42872
42873 /**
42874  * Serialize the AcceptChannelV2 object into a byte array which can be read by AcceptChannelV2_read
42875  */
42876 struct LDKCVec_u8Z AcceptChannelV2_write(const struct LDKAcceptChannelV2 *NONNULL_PTR obj);
42877
42878 /**
42879  * Read a AcceptChannelV2 from a byte array, created by AcceptChannelV2_write
42880  */
42881 struct LDKCResult_AcceptChannelV2DecodeErrorZ AcceptChannelV2_read(struct LDKu8slice ser);
42882
42883 /**
42884  * Serialize the Stfu object into a byte array which can be read by Stfu_read
42885  */
42886 struct LDKCVec_u8Z Stfu_write(const struct LDKStfu *NONNULL_PTR obj);
42887
42888 /**
42889  * Read a Stfu from a byte array, created by Stfu_write
42890  */
42891 struct LDKCResult_StfuDecodeErrorZ Stfu_read(struct LDKu8slice ser);
42892
42893 /**
42894  * Serialize the Splice object into a byte array which can be read by Splice_read
42895  */
42896 struct LDKCVec_u8Z Splice_write(const struct LDKSplice *NONNULL_PTR obj);
42897
42898 /**
42899  * Read a Splice from a byte array, created by Splice_write
42900  */
42901 struct LDKCResult_SpliceDecodeErrorZ Splice_read(struct LDKu8slice ser);
42902
42903 /**
42904  * Serialize the SpliceAck object into a byte array which can be read by SpliceAck_read
42905  */
42906 struct LDKCVec_u8Z SpliceAck_write(const struct LDKSpliceAck *NONNULL_PTR obj);
42907
42908 /**
42909  * Read a SpliceAck from a byte array, created by SpliceAck_write
42910  */
42911 struct LDKCResult_SpliceAckDecodeErrorZ SpliceAck_read(struct LDKu8slice ser);
42912
42913 /**
42914  * Serialize the SpliceLocked object into a byte array which can be read by SpliceLocked_read
42915  */
42916 struct LDKCVec_u8Z SpliceLocked_write(const struct LDKSpliceLocked *NONNULL_PTR obj);
42917
42918 /**
42919  * Read a SpliceLocked from a byte array, created by SpliceLocked_write
42920  */
42921 struct LDKCResult_SpliceLockedDecodeErrorZ SpliceLocked_read(struct LDKu8slice ser);
42922
42923 /**
42924  * Serialize the TxAddInput object into a byte array which can be read by TxAddInput_read
42925  */
42926 struct LDKCVec_u8Z TxAddInput_write(const struct LDKTxAddInput *NONNULL_PTR obj);
42927
42928 /**
42929  * Read a TxAddInput from a byte array, created by TxAddInput_write
42930  */
42931 struct LDKCResult_TxAddInputDecodeErrorZ TxAddInput_read(struct LDKu8slice ser);
42932
42933 /**
42934  * Serialize the TxAddOutput object into a byte array which can be read by TxAddOutput_read
42935  */
42936 struct LDKCVec_u8Z TxAddOutput_write(const struct LDKTxAddOutput *NONNULL_PTR obj);
42937
42938 /**
42939  * Read a TxAddOutput from a byte array, created by TxAddOutput_write
42940  */
42941 struct LDKCResult_TxAddOutputDecodeErrorZ TxAddOutput_read(struct LDKu8slice ser);
42942
42943 /**
42944  * Serialize the TxRemoveInput object into a byte array which can be read by TxRemoveInput_read
42945  */
42946 struct LDKCVec_u8Z TxRemoveInput_write(const struct LDKTxRemoveInput *NONNULL_PTR obj);
42947
42948 /**
42949  * Read a TxRemoveInput from a byte array, created by TxRemoveInput_write
42950  */
42951 struct LDKCResult_TxRemoveInputDecodeErrorZ TxRemoveInput_read(struct LDKu8slice ser);
42952
42953 /**
42954  * Serialize the TxRemoveOutput object into a byte array which can be read by TxRemoveOutput_read
42955  */
42956 struct LDKCVec_u8Z TxRemoveOutput_write(const struct LDKTxRemoveOutput *NONNULL_PTR obj);
42957
42958 /**
42959  * Read a TxRemoveOutput from a byte array, created by TxRemoveOutput_write
42960  */
42961 struct LDKCResult_TxRemoveOutputDecodeErrorZ TxRemoveOutput_read(struct LDKu8slice ser);
42962
42963 /**
42964  * Serialize the TxComplete object into a byte array which can be read by TxComplete_read
42965  */
42966 struct LDKCVec_u8Z TxComplete_write(const struct LDKTxComplete *NONNULL_PTR obj);
42967
42968 /**
42969  * Read a TxComplete from a byte array, created by TxComplete_write
42970  */
42971 struct LDKCResult_TxCompleteDecodeErrorZ TxComplete_read(struct LDKu8slice ser);
42972
42973 /**
42974  * Serialize the TxSignatures object into a byte array which can be read by TxSignatures_read
42975  */
42976 struct LDKCVec_u8Z TxSignatures_write(const struct LDKTxSignatures *NONNULL_PTR obj);
42977
42978 /**
42979  * Read a TxSignatures from a byte array, created by TxSignatures_write
42980  */
42981 struct LDKCResult_TxSignaturesDecodeErrorZ TxSignatures_read(struct LDKu8slice ser);
42982
42983 /**
42984  * Serialize the TxInitRbf object into a byte array which can be read by TxInitRbf_read
42985  */
42986 struct LDKCVec_u8Z TxInitRbf_write(const struct LDKTxInitRbf *NONNULL_PTR obj);
42987
42988 /**
42989  * Read a TxInitRbf from a byte array, created by TxInitRbf_write
42990  */
42991 struct LDKCResult_TxInitRbfDecodeErrorZ TxInitRbf_read(struct LDKu8slice ser);
42992
42993 /**
42994  * Serialize the TxAckRbf object into a byte array which can be read by TxAckRbf_read
42995  */
42996 struct LDKCVec_u8Z TxAckRbf_write(const struct LDKTxAckRbf *NONNULL_PTR obj);
42997
42998 /**
42999  * Read a TxAckRbf from a byte array, created by TxAckRbf_write
43000  */
43001 struct LDKCResult_TxAckRbfDecodeErrorZ TxAckRbf_read(struct LDKu8slice ser);
43002
43003 /**
43004  * Serialize the TxAbort object into a byte array which can be read by TxAbort_read
43005  */
43006 struct LDKCVec_u8Z TxAbort_write(const struct LDKTxAbort *NONNULL_PTR obj);
43007
43008 /**
43009  * Read a TxAbort from a byte array, created by TxAbort_write
43010  */
43011 struct LDKCResult_TxAbortDecodeErrorZ TxAbort_read(struct LDKu8slice ser);
43012
43013 /**
43014  * Serialize the AnnouncementSignatures object into a byte array which can be read by AnnouncementSignatures_read
43015  */
43016 struct LDKCVec_u8Z AnnouncementSignatures_write(const struct LDKAnnouncementSignatures *NONNULL_PTR obj);
43017
43018 /**
43019  * Read a AnnouncementSignatures from a byte array, created by AnnouncementSignatures_write
43020  */
43021 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ AnnouncementSignatures_read(struct LDKu8slice ser);
43022
43023 /**
43024  * Serialize the ChannelReestablish object into a byte array which can be read by ChannelReestablish_read
43025  */
43026 struct LDKCVec_u8Z ChannelReestablish_write(const struct LDKChannelReestablish *NONNULL_PTR obj);
43027
43028 /**
43029  * Read a ChannelReestablish from a byte array, created by ChannelReestablish_write
43030  */
43031 struct LDKCResult_ChannelReestablishDecodeErrorZ ChannelReestablish_read(struct LDKu8slice ser);
43032
43033 /**
43034  * Serialize the ClosingSigned object into a byte array which can be read by ClosingSigned_read
43035  */
43036 struct LDKCVec_u8Z ClosingSigned_write(const struct LDKClosingSigned *NONNULL_PTR obj);
43037
43038 /**
43039  * Read a ClosingSigned from a byte array, created by ClosingSigned_write
43040  */
43041 struct LDKCResult_ClosingSignedDecodeErrorZ ClosingSigned_read(struct LDKu8slice ser);
43042
43043 /**
43044  * Serialize the ClosingSignedFeeRange object into a byte array which can be read by ClosingSignedFeeRange_read
43045  */
43046 struct LDKCVec_u8Z ClosingSignedFeeRange_write(const struct LDKClosingSignedFeeRange *NONNULL_PTR obj);
43047
43048 /**
43049  * Read a ClosingSignedFeeRange from a byte array, created by ClosingSignedFeeRange_write
43050  */
43051 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ ClosingSignedFeeRange_read(struct LDKu8slice ser);
43052
43053 /**
43054  * Serialize the CommitmentSigned object into a byte array which can be read by CommitmentSigned_read
43055  */
43056 struct LDKCVec_u8Z CommitmentSigned_write(const struct LDKCommitmentSigned *NONNULL_PTR obj);
43057
43058 /**
43059  * Read a CommitmentSigned from a byte array, created by CommitmentSigned_write
43060  */
43061 struct LDKCResult_CommitmentSignedDecodeErrorZ CommitmentSigned_read(struct LDKu8slice ser);
43062
43063 /**
43064  * Serialize the FundingCreated object into a byte array which can be read by FundingCreated_read
43065  */
43066 struct LDKCVec_u8Z FundingCreated_write(const struct LDKFundingCreated *NONNULL_PTR obj);
43067
43068 /**
43069  * Read a FundingCreated from a byte array, created by FundingCreated_write
43070  */
43071 struct LDKCResult_FundingCreatedDecodeErrorZ FundingCreated_read(struct LDKu8slice ser);
43072
43073 /**
43074  * Serialize the FundingSigned object into a byte array which can be read by FundingSigned_read
43075  */
43076 struct LDKCVec_u8Z FundingSigned_write(const struct LDKFundingSigned *NONNULL_PTR obj);
43077
43078 /**
43079  * Read a FundingSigned from a byte array, created by FundingSigned_write
43080  */
43081 struct LDKCResult_FundingSignedDecodeErrorZ FundingSigned_read(struct LDKu8slice ser);
43082
43083 /**
43084  * Serialize the ChannelReady object into a byte array which can be read by ChannelReady_read
43085  */
43086 struct LDKCVec_u8Z ChannelReady_write(const struct LDKChannelReady *NONNULL_PTR obj);
43087
43088 /**
43089  * Read a ChannelReady from a byte array, created by ChannelReady_write
43090  */
43091 struct LDKCResult_ChannelReadyDecodeErrorZ ChannelReady_read(struct LDKu8slice ser);
43092
43093 /**
43094  * Serialize the Init object into a byte array which can be read by Init_read
43095  */
43096 struct LDKCVec_u8Z Init_write(const struct LDKInit *NONNULL_PTR obj);
43097
43098 /**
43099  * Read a Init from a byte array, created by Init_write
43100  */
43101 struct LDKCResult_InitDecodeErrorZ Init_read(struct LDKu8slice ser);
43102
43103 /**
43104  * Serialize the OpenChannel object into a byte array which can be read by OpenChannel_read
43105  */
43106 struct LDKCVec_u8Z OpenChannel_write(const struct LDKOpenChannel *NONNULL_PTR obj);
43107
43108 /**
43109  * Read a OpenChannel from a byte array, created by OpenChannel_write
43110  */
43111 struct LDKCResult_OpenChannelDecodeErrorZ OpenChannel_read(struct LDKu8slice ser);
43112
43113 /**
43114  * Serialize the OpenChannelV2 object into a byte array which can be read by OpenChannelV2_read
43115  */
43116 struct LDKCVec_u8Z OpenChannelV2_write(const struct LDKOpenChannelV2 *NONNULL_PTR obj);
43117
43118 /**
43119  * Read a OpenChannelV2 from a byte array, created by OpenChannelV2_write
43120  */
43121 struct LDKCResult_OpenChannelV2DecodeErrorZ OpenChannelV2_read(struct LDKu8slice ser);
43122
43123 /**
43124  * Serialize the RevokeAndACK object into a byte array which can be read by RevokeAndACK_read
43125  */
43126 struct LDKCVec_u8Z RevokeAndACK_write(const struct LDKRevokeAndACK *NONNULL_PTR obj);
43127
43128 /**
43129  * Read a RevokeAndACK from a byte array, created by RevokeAndACK_write
43130  */
43131 struct LDKCResult_RevokeAndACKDecodeErrorZ RevokeAndACK_read(struct LDKu8slice ser);
43132
43133 /**
43134  * Serialize the Shutdown object into a byte array which can be read by Shutdown_read
43135  */
43136 struct LDKCVec_u8Z Shutdown_write(const struct LDKShutdown *NONNULL_PTR obj);
43137
43138 /**
43139  * Read a Shutdown from a byte array, created by Shutdown_write
43140  */
43141 struct LDKCResult_ShutdownDecodeErrorZ Shutdown_read(struct LDKu8slice ser);
43142
43143 /**
43144  * Serialize the UpdateFailHTLC object into a byte array which can be read by UpdateFailHTLC_read
43145  */
43146 struct LDKCVec_u8Z UpdateFailHTLC_write(const struct LDKUpdateFailHTLC *NONNULL_PTR obj);
43147
43148 /**
43149  * Read a UpdateFailHTLC from a byte array, created by UpdateFailHTLC_write
43150  */
43151 struct LDKCResult_UpdateFailHTLCDecodeErrorZ UpdateFailHTLC_read(struct LDKu8slice ser);
43152
43153 /**
43154  * Serialize the UpdateFailMalformedHTLC object into a byte array which can be read by UpdateFailMalformedHTLC_read
43155  */
43156 struct LDKCVec_u8Z UpdateFailMalformedHTLC_write(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR obj);
43157
43158 /**
43159  * Read a UpdateFailMalformedHTLC from a byte array, created by UpdateFailMalformedHTLC_write
43160  */
43161 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ UpdateFailMalformedHTLC_read(struct LDKu8slice ser);
43162
43163 /**
43164  * Serialize the UpdateFee object into a byte array which can be read by UpdateFee_read
43165  */
43166 struct LDKCVec_u8Z UpdateFee_write(const struct LDKUpdateFee *NONNULL_PTR obj);
43167
43168 /**
43169  * Read a UpdateFee from a byte array, created by UpdateFee_write
43170  */
43171 struct LDKCResult_UpdateFeeDecodeErrorZ UpdateFee_read(struct LDKu8slice ser);
43172
43173 /**
43174  * Serialize the UpdateFulfillHTLC object into a byte array which can be read by UpdateFulfillHTLC_read
43175  */
43176 struct LDKCVec_u8Z UpdateFulfillHTLC_write(const struct LDKUpdateFulfillHTLC *NONNULL_PTR obj);
43177
43178 /**
43179  * Read a UpdateFulfillHTLC from a byte array, created by UpdateFulfillHTLC_write
43180  */
43181 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ UpdateFulfillHTLC_read(struct LDKu8slice ser);
43182
43183 /**
43184  * Serialize the OnionPacket object into a byte array which can be read by OnionPacket_read
43185  */
43186 struct LDKCVec_u8Z OnionPacket_write(const struct LDKOnionPacket *NONNULL_PTR obj);
43187
43188 /**
43189  * Read a OnionPacket from a byte array, created by OnionPacket_write
43190  */
43191 struct LDKCResult_OnionPacketDecodeErrorZ OnionPacket_read(struct LDKu8slice ser);
43192
43193 /**
43194  * Serialize the UpdateAddHTLC object into a byte array which can be read by UpdateAddHTLC_read
43195  */
43196 struct LDKCVec_u8Z UpdateAddHTLC_write(const struct LDKUpdateAddHTLC *NONNULL_PTR obj);
43197
43198 /**
43199  * Read a UpdateAddHTLC from a byte array, created by UpdateAddHTLC_write
43200  */
43201 struct LDKCResult_UpdateAddHTLCDecodeErrorZ UpdateAddHTLC_read(struct LDKu8slice ser);
43202
43203 /**
43204  * Read a OnionMessage from a byte array, created by OnionMessage_write
43205  */
43206 struct LDKCResult_OnionMessageDecodeErrorZ OnionMessage_read(struct LDKu8slice ser);
43207
43208 /**
43209  * Serialize the OnionMessage object into a byte array which can be read by OnionMessage_read
43210  */
43211 struct LDKCVec_u8Z OnionMessage_write(const struct LDKOnionMessage *NONNULL_PTR obj);
43212
43213 /**
43214  * Serialize the FinalOnionHopData object into a byte array which can be read by FinalOnionHopData_read
43215  */
43216 struct LDKCVec_u8Z FinalOnionHopData_write(const struct LDKFinalOnionHopData *NONNULL_PTR obj);
43217
43218 /**
43219  * Read a FinalOnionHopData from a byte array, created by FinalOnionHopData_write
43220  */
43221 struct LDKCResult_FinalOnionHopDataDecodeErrorZ FinalOnionHopData_read(struct LDKu8slice ser);
43222
43223 /**
43224  * Serialize the Ping object into a byte array which can be read by Ping_read
43225  */
43226 struct LDKCVec_u8Z Ping_write(const struct LDKPing *NONNULL_PTR obj);
43227
43228 /**
43229  * Read a Ping from a byte array, created by Ping_write
43230  */
43231 struct LDKCResult_PingDecodeErrorZ Ping_read(struct LDKu8slice ser);
43232
43233 /**
43234  * Serialize the Pong object into a byte array which can be read by Pong_read
43235  */
43236 struct LDKCVec_u8Z Pong_write(const struct LDKPong *NONNULL_PTR obj);
43237
43238 /**
43239  * Read a Pong from a byte array, created by Pong_write
43240  */
43241 struct LDKCResult_PongDecodeErrorZ Pong_read(struct LDKu8slice ser);
43242
43243 /**
43244  * Serialize the UnsignedChannelAnnouncement object into a byte array which can be read by UnsignedChannelAnnouncement_read
43245  */
43246 struct LDKCVec_u8Z UnsignedChannelAnnouncement_write(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR obj);
43247
43248 /**
43249  * Read a UnsignedChannelAnnouncement from a byte array, created by UnsignedChannelAnnouncement_write
43250  */
43251 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ UnsignedChannelAnnouncement_read(struct LDKu8slice ser);
43252
43253 /**
43254  * Serialize the ChannelAnnouncement object into a byte array which can be read by ChannelAnnouncement_read
43255  */
43256 struct LDKCVec_u8Z ChannelAnnouncement_write(const struct LDKChannelAnnouncement *NONNULL_PTR obj);
43257
43258 /**
43259  * Read a ChannelAnnouncement from a byte array, created by ChannelAnnouncement_write
43260  */
43261 struct LDKCResult_ChannelAnnouncementDecodeErrorZ ChannelAnnouncement_read(struct LDKu8slice ser);
43262
43263 /**
43264  * Serialize the UnsignedChannelUpdate object into a byte array which can be read by UnsignedChannelUpdate_read
43265  */
43266 struct LDKCVec_u8Z UnsignedChannelUpdate_write(const struct LDKUnsignedChannelUpdate *NONNULL_PTR obj);
43267
43268 /**
43269  * Read a UnsignedChannelUpdate from a byte array, created by UnsignedChannelUpdate_write
43270  */
43271 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ UnsignedChannelUpdate_read(struct LDKu8slice ser);
43272
43273 /**
43274  * Serialize the ChannelUpdate object into a byte array which can be read by ChannelUpdate_read
43275  */
43276 struct LDKCVec_u8Z ChannelUpdate_write(const struct LDKChannelUpdate *NONNULL_PTR obj);
43277
43278 /**
43279  * Read a ChannelUpdate from a byte array, created by ChannelUpdate_write
43280  */
43281 struct LDKCResult_ChannelUpdateDecodeErrorZ ChannelUpdate_read(struct LDKu8slice ser);
43282
43283 /**
43284  * Serialize the ErrorMessage object into a byte array which can be read by ErrorMessage_read
43285  */
43286 struct LDKCVec_u8Z ErrorMessage_write(const struct LDKErrorMessage *NONNULL_PTR obj);
43287
43288 /**
43289  * Read a ErrorMessage from a byte array, created by ErrorMessage_write
43290  */
43291 struct LDKCResult_ErrorMessageDecodeErrorZ ErrorMessage_read(struct LDKu8slice ser);
43292
43293 /**
43294  * Serialize the WarningMessage object into a byte array which can be read by WarningMessage_read
43295  */
43296 struct LDKCVec_u8Z WarningMessage_write(const struct LDKWarningMessage *NONNULL_PTR obj);
43297
43298 /**
43299  * Read a WarningMessage from a byte array, created by WarningMessage_write
43300  */
43301 struct LDKCResult_WarningMessageDecodeErrorZ WarningMessage_read(struct LDKu8slice ser);
43302
43303 /**
43304  * Serialize the UnsignedNodeAnnouncement object into a byte array which can be read by UnsignedNodeAnnouncement_read
43305  */
43306 struct LDKCVec_u8Z UnsignedNodeAnnouncement_write(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR obj);
43307
43308 /**
43309  * Read a UnsignedNodeAnnouncement from a byte array, created by UnsignedNodeAnnouncement_write
43310  */
43311 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ UnsignedNodeAnnouncement_read(struct LDKu8slice ser);
43312
43313 /**
43314  * Serialize the NodeAnnouncement object into a byte array which can be read by NodeAnnouncement_read
43315  */
43316 struct LDKCVec_u8Z NodeAnnouncement_write(const struct LDKNodeAnnouncement *NONNULL_PTR obj);
43317
43318 /**
43319  * Read a NodeAnnouncement from a byte array, created by NodeAnnouncement_write
43320  */
43321 struct LDKCResult_NodeAnnouncementDecodeErrorZ NodeAnnouncement_read(struct LDKu8slice ser);
43322
43323 /**
43324  * Read a QueryShortChannelIds from a byte array, created by QueryShortChannelIds_write
43325  */
43326 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ QueryShortChannelIds_read(struct LDKu8slice ser);
43327
43328 /**
43329  * Serialize the QueryShortChannelIds object into a byte array which can be read by QueryShortChannelIds_read
43330  */
43331 struct LDKCVec_u8Z QueryShortChannelIds_write(const struct LDKQueryShortChannelIds *NONNULL_PTR obj);
43332
43333 /**
43334  * Serialize the ReplyShortChannelIdsEnd object into a byte array which can be read by ReplyShortChannelIdsEnd_read
43335  */
43336 struct LDKCVec_u8Z ReplyShortChannelIdsEnd_write(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR obj);
43337
43338 /**
43339  * Read a ReplyShortChannelIdsEnd from a byte array, created by ReplyShortChannelIdsEnd_write
43340  */
43341 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ ReplyShortChannelIdsEnd_read(struct LDKu8slice ser);
43342
43343 /**
43344  * Calculates the overflow safe ending block height for the query.
43345  *
43346  * Overflow returns `0xffffffff`, otherwise returns `first_blocknum + number_of_blocks`.
43347  */
43348 MUST_USE_RES uint32_t QueryChannelRange_end_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_arg);
43349
43350 /**
43351  * Serialize the QueryChannelRange object into a byte array which can be read by QueryChannelRange_read
43352  */
43353 struct LDKCVec_u8Z QueryChannelRange_write(const struct LDKQueryChannelRange *NONNULL_PTR obj);
43354
43355 /**
43356  * Read a QueryChannelRange from a byte array, created by QueryChannelRange_write
43357  */
43358 struct LDKCResult_QueryChannelRangeDecodeErrorZ QueryChannelRange_read(struct LDKu8slice ser);
43359
43360 /**
43361  * Read a ReplyChannelRange from a byte array, created by ReplyChannelRange_write
43362  */
43363 struct LDKCResult_ReplyChannelRangeDecodeErrorZ ReplyChannelRange_read(struct LDKu8slice ser);
43364
43365 /**
43366  * Serialize the ReplyChannelRange object into a byte array which can be read by ReplyChannelRange_read
43367  */
43368 struct LDKCVec_u8Z ReplyChannelRange_write(const struct LDKReplyChannelRange *NONNULL_PTR obj);
43369
43370 /**
43371  * Serialize the GossipTimestampFilter object into a byte array which can be read by GossipTimestampFilter_read
43372  */
43373 struct LDKCVec_u8Z GossipTimestampFilter_write(const struct LDKGossipTimestampFilter *NONNULL_PTR obj);
43374
43375 /**
43376  * Read a GossipTimestampFilter from a byte array, created by GossipTimestampFilter_write
43377  */
43378 struct LDKCResult_GossipTimestampFilterDecodeErrorZ GossipTimestampFilter_read(struct LDKu8slice ser);
43379
43380 /**
43381  * Calls the free function if one is set
43382  */
43383 void CustomMessageHandler_free(struct LDKCustomMessageHandler this_ptr);
43384
43385 /**
43386  * Frees any resources used by the IgnoringMessageHandler, if is_owned is set and inner is non-NULL.
43387  */
43388 void IgnoringMessageHandler_free(struct LDKIgnoringMessageHandler this_obj);
43389
43390 /**
43391  * Constructs a new IgnoringMessageHandler given each field
43392  */
43393 MUST_USE_RES struct LDKIgnoringMessageHandler IgnoringMessageHandler_new(void);
43394
43395 /**
43396  * Constructs a new EventsProvider which calls the relevant methods on this_arg.
43397  * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is
43398  */
43399 struct LDKEventsProvider IgnoringMessageHandler_as_EventsProvider(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
43400
43401 /**
43402  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
43403  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
43404  */
43405 struct LDKMessageSendEventsProvider IgnoringMessageHandler_as_MessageSendEventsProvider(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
43406
43407 /**
43408  * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg.
43409  * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is
43410  */
43411 struct LDKRoutingMessageHandler IgnoringMessageHandler_as_RoutingMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
43412
43413 /**
43414  * Constructs a new OnionMessageHandler which calls the relevant methods on this_arg.
43415  * This copies the `inner` pointer in this_arg and thus the returned OnionMessageHandler must be freed before this_arg is
43416  */
43417 struct LDKOnionMessageHandler IgnoringMessageHandler_as_OnionMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
43418
43419 /**
43420  * Constructs a new OffersMessageHandler which calls the relevant methods on this_arg.
43421  * This copies the `inner` pointer in this_arg and thus the returned OffersMessageHandler must be freed before this_arg is
43422  */
43423 struct LDKOffersMessageHandler IgnoringMessageHandler_as_OffersMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
43424
43425 /**
43426  * Constructs a new CustomOnionMessageHandler which calls the relevant methods on this_arg.
43427  * This copies the `inner` pointer in this_arg and thus the returned CustomOnionMessageHandler must be freed before this_arg is
43428  */
43429 struct LDKCustomOnionMessageHandler IgnoringMessageHandler_as_CustomOnionMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
43430
43431 /**
43432  * Constructs a new CustomMessageReader which calls the relevant methods on this_arg.
43433  * This copies the `inner` pointer in this_arg and thus the returned CustomMessageReader must be freed before this_arg is
43434  */
43435 struct LDKCustomMessageReader IgnoringMessageHandler_as_CustomMessageReader(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
43436
43437 /**
43438  * Constructs a new CustomMessageHandler which calls the relevant methods on this_arg.
43439  * This copies the `inner` pointer in this_arg and thus the returned CustomMessageHandler must be freed before this_arg is
43440  */
43441 struct LDKCustomMessageHandler IgnoringMessageHandler_as_CustomMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
43442
43443 /**
43444  * Frees any resources used by the ErroringMessageHandler, if is_owned is set and inner is non-NULL.
43445  */
43446 void ErroringMessageHandler_free(struct LDKErroringMessageHandler this_obj);
43447
43448 /**
43449  * Constructs a new ErroringMessageHandler
43450  */
43451 MUST_USE_RES struct LDKErroringMessageHandler ErroringMessageHandler_new(void);
43452
43453 /**
43454  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
43455  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
43456  */
43457 struct LDKMessageSendEventsProvider ErroringMessageHandler_as_MessageSendEventsProvider(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg);
43458
43459 /**
43460  * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg.
43461  * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is
43462  */
43463 struct LDKChannelMessageHandler ErroringMessageHandler_as_ChannelMessageHandler(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg);
43464
43465 /**
43466  * Frees any resources used by the MessageHandler, if is_owned is set and inner is non-NULL.
43467  */
43468 void MessageHandler_free(struct LDKMessageHandler this_obj);
43469
43470 /**
43471  * A message handler which handles messages specific to channels. Usually this is just a
43472  * [`ChannelManager`] object or an [`ErroringMessageHandler`].
43473  *
43474  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
43475  */
43476 const struct LDKChannelMessageHandler *MessageHandler_get_chan_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
43477
43478 /**
43479  * A message handler which handles messages specific to channels. Usually this is just a
43480  * [`ChannelManager`] object or an [`ErroringMessageHandler`].
43481  *
43482  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
43483  */
43484 void MessageHandler_set_chan_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKChannelMessageHandler val);
43485
43486 /**
43487  * A message handler which handles messages updating our knowledge of the network channel
43488  * graph. Usually this is just a [`P2PGossipSync`] object or an [`IgnoringMessageHandler`].
43489  *
43490  * [`P2PGossipSync`]: crate::routing::gossip::P2PGossipSync
43491  */
43492 const struct LDKRoutingMessageHandler *MessageHandler_get_route_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
43493
43494 /**
43495  * A message handler which handles messages updating our knowledge of the network channel
43496  * graph. Usually this is just a [`P2PGossipSync`] object or an [`IgnoringMessageHandler`].
43497  *
43498  * [`P2PGossipSync`]: crate::routing::gossip::P2PGossipSync
43499  */
43500 void MessageHandler_set_route_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKRoutingMessageHandler val);
43501
43502 /**
43503  * A message handler which handles onion messages. This should generally be an
43504  * [`OnionMessenger`], but can also be an [`IgnoringMessageHandler`].
43505  *
43506  * [`OnionMessenger`]: crate::onion_message::messenger::OnionMessenger
43507  */
43508 const struct LDKOnionMessageHandler *MessageHandler_get_onion_message_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
43509
43510 /**
43511  * A message handler which handles onion messages. This should generally be an
43512  * [`OnionMessenger`], but can also be an [`IgnoringMessageHandler`].
43513  *
43514  * [`OnionMessenger`]: crate::onion_message::messenger::OnionMessenger
43515  */
43516 void MessageHandler_set_onion_message_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKOnionMessageHandler val);
43517
43518 /**
43519  * A message handler which handles custom messages. The only LDK-provided implementation is
43520  * [`IgnoringMessageHandler`].
43521  */
43522 const struct LDKCustomMessageHandler *MessageHandler_get_custom_message_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
43523
43524 /**
43525  * A message handler which handles custom messages. The only LDK-provided implementation is
43526  * [`IgnoringMessageHandler`].
43527  */
43528 void MessageHandler_set_custom_message_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKCustomMessageHandler val);
43529
43530 /**
43531  * Constructs a new MessageHandler given each field
43532  */
43533 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);
43534
43535 /**
43536  * Creates a copy of a SocketDescriptor
43537  */
43538 struct LDKSocketDescriptor SocketDescriptor_clone(const struct LDKSocketDescriptor *NONNULL_PTR orig);
43539
43540 /**
43541  * Calls the free function if one is set
43542  */
43543 void SocketDescriptor_free(struct LDKSocketDescriptor this_ptr);
43544
43545 /**
43546  * Frees any resources used by the PeerDetails, if is_owned is set and inner is non-NULL.
43547  */
43548 void PeerDetails_free(struct LDKPeerDetails this_obj);
43549
43550 /**
43551  * The node id of the peer.
43552  *
43553  * For outbound connections, this [`PublicKey`] will be the same as the `their_node_id` parameter
43554  * passed in to [`PeerManager::new_outbound_connection`].
43555  */
43556 struct LDKPublicKey PeerDetails_get_counterparty_node_id(const struct LDKPeerDetails *NONNULL_PTR this_ptr);
43557
43558 /**
43559  * The node id of the peer.
43560  *
43561  * For outbound connections, this [`PublicKey`] will be the same as the `their_node_id` parameter
43562  * passed in to [`PeerManager::new_outbound_connection`].
43563  */
43564 void PeerDetails_set_counterparty_node_id(struct LDKPeerDetails *NONNULL_PTR this_ptr, struct LDKPublicKey val);
43565
43566 /**
43567  * The socket address the peer provided in the initial handshake.
43568  *
43569  * Will only be `Some` if an address had been previously provided to
43570  * [`PeerManager::new_outbound_connection`] or [`PeerManager::new_inbound_connection`].
43571  *
43572  * Returns a copy of the field.
43573  */
43574 struct LDKCOption_SocketAddressZ PeerDetails_get_socket_address(const struct LDKPeerDetails *NONNULL_PTR this_ptr);
43575
43576 /**
43577  * The socket address the peer provided in the initial handshake.
43578  *
43579  * Will only be `Some` if an address had been previously provided to
43580  * [`PeerManager::new_outbound_connection`] or [`PeerManager::new_inbound_connection`].
43581  */
43582 void PeerDetails_set_socket_address(struct LDKPeerDetails *NONNULL_PTR this_ptr, struct LDKCOption_SocketAddressZ val);
43583
43584 /**
43585  * The features the peer provided in the initial handshake.
43586  */
43587 struct LDKInitFeatures PeerDetails_get_init_features(const struct LDKPeerDetails *NONNULL_PTR this_ptr);
43588
43589 /**
43590  * The features the peer provided in the initial handshake.
43591  */
43592 void PeerDetails_set_init_features(struct LDKPeerDetails *NONNULL_PTR this_ptr, struct LDKInitFeatures val);
43593
43594 /**
43595  * Indicates the direction of the peer connection.
43596  *
43597  * Will be `true` for inbound connections, and `false` for outbound connections.
43598  */
43599 bool PeerDetails_get_is_inbound_connection(const struct LDKPeerDetails *NONNULL_PTR this_ptr);
43600
43601 /**
43602  * Indicates the direction of the peer connection.
43603  *
43604  * Will be `true` for inbound connections, and `false` for outbound connections.
43605  */
43606 void PeerDetails_set_is_inbound_connection(struct LDKPeerDetails *NONNULL_PTR this_ptr, bool val);
43607
43608 /**
43609  * Constructs a new PeerDetails given each field
43610  */
43611 MUST_USE_RES struct LDKPeerDetails PeerDetails_new(struct LDKPublicKey counterparty_node_id_arg, struct LDKCOption_SocketAddressZ socket_address_arg, struct LDKInitFeatures init_features_arg, bool is_inbound_connection_arg);
43612
43613 /**
43614  * Frees any resources used by the PeerHandleError, if is_owned is set and inner is non-NULL.
43615  */
43616 void PeerHandleError_free(struct LDKPeerHandleError this_obj);
43617
43618 /**
43619  * Constructs a new PeerHandleError given each field
43620  */
43621 MUST_USE_RES struct LDKPeerHandleError PeerHandleError_new(void);
43622
43623 /**
43624  * Creates a copy of the PeerHandleError
43625  */
43626 struct LDKPeerHandleError PeerHandleError_clone(const struct LDKPeerHandleError *NONNULL_PTR orig);
43627
43628 /**
43629  * Frees any resources used by the PeerManager, if is_owned is set and inner is non-NULL.
43630  */
43631 void PeerManager_free(struct LDKPeerManager this_obj);
43632
43633 /**
43634  * Constructs a new `PeerManager` with the given message handlers.
43635  *
43636  * `ephemeral_random_data` is used to derive per-connection ephemeral keys and must be
43637  * cryptographically secure random bytes.
43638  *
43639  * `current_time` is used as an always-increasing counter that survives across restarts and is
43640  * incremented irregularly internally. In general it is best to simply use the current UNIX
43641  * timestamp, however if it is not available a persistent counter that increases once per
43642  * minute should suffice.
43643  */
43644 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);
43645
43646 /**
43647  * Returns a list of [`PeerDetails`] for connected peers that have completed the initial
43648  * handshake.
43649  */
43650 MUST_USE_RES struct LDKCVec_PeerDetailsZ PeerManager_list_peers(const struct LDKPeerManager *NONNULL_PTR this_arg);
43651
43652 /**
43653  * Returns the [`PeerDetails`] of a connected peer that has completed the initial handshake.
43654  *
43655  * Will return `None` if the peer is unknown or it hasn't completed the initial handshake.
43656  *
43657  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
43658  */
43659 MUST_USE_RES struct LDKPeerDetails PeerManager_peer_by_node_id(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey their_node_id);
43660
43661 /**
43662  * Indicates a new outbound connection has been established to a node with the given `node_id`
43663  * and an optional remote network address.
43664  *
43665  * The remote network address adds the option to report a remote IP address back to a connecting
43666  * peer using the init message.
43667  * The user should pass the remote network address of the host they are connected to.
43668  *
43669  * If an `Err` is returned here you must disconnect the connection immediately.
43670  *
43671  * Returns a small number of bytes to send to the remote node (currently always 50).
43672  *
43673  * Panics if descriptor is duplicative with some other descriptor which has not yet been
43674  * [`socket_disconnected`].
43675  *
43676  * [`socket_disconnected`]: PeerManager::socket_disconnected
43677  */
43678 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_SocketAddressZ remote_network_address);
43679
43680 /**
43681  * Indicates a new inbound connection has been established to a node with an optional remote
43682  * network address.
43683  *
43684  * The remote network address adds the option to report a remote IP address back to a connecting
43685  * peer using the init message.
43686  * The user should pass the remote network address of the host they are connected to.
43687  *
43688  * May refuse the connection by returning an Err, but will never write bytes to the remote end
43689  * (outbound connector always speaks first). If an `Err` is returned here you must disconnect
43690  * the connection immediately.
43691  *
43692  * Panics if descriptor is duplicative with some other descriptor which has not yet been
43693  * [`socket_disconnected`].
43694  *
43695  * [`socket_disconnected`]: PeerManager::socket_disconnected
43696  */
43697 MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_new_inbound_connection(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor descriptor, struct LDKCOption_SocketAddressZ remote_network_address);
43698
43699 /**
43700  * Indicates that there is room to write data to the given socket descriptor.
43701  *
43702  * May return an Err to indicate that the connection should be closed.
43703  *
43704  * May call [`send_data`] on the descriptor passed in (or an equal descriptor) before
43705  * returning. Thus, be very careful with reentrancy issues! The invariants around calling
43706  * [`write_buffer_space_avail`] in case a write did not fully complete must still hold - be
43707  * ready to call [`write_buffer_space_avail`] again if a write call generated here isn't
43708  * sufficient!
43709  *
43710  * [`send_data`]: SocketDescriptor::send_data
43711  * [`write_buffer_space_avail`]: PeerManager::write_buffer_space_avail
43712  */
43713 MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_write_buffer_space_avail(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor *NONNULL_PTR descriptor);
43714
43715 /**
43716  * Indicates that data was read from the given socket descriptor.
43717  *
43718  * May return an Err to indicate that the connection should be closed.
43719  *
43720  * Will *not* call back into [`send_data`] on any descriptors to avoid reentrancy complexity.
43721  * Thus, however, you should call [`process_events`] after any `read_event` to generate
43722  * [`send_data`] calls to handle responses.
43723  *
43724  * If `Ok(true)` is returned, further read_events should not be triggered until a
43725  * [`send_data`] call on this descriptor has `resume_read` set (preventing DoS issues in the
43726  * send buffer).
43727  *
43728  * In order to avoid processing too many messages at once per peer, `data` should be on the
43729  * order of 4KiB.
43730  *
43731  * [`send_data`]: SocketDescriptor::send_data
43732  * [`process_events`]: PeerManager::process_events
43733  */
43734 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);
43735
43736 /**
43737  * Checks for any events generated by our handlers and processes them. Includes sending most
43738  * response messages as well as messages generated by calls to handler functions directly (eg
43739  * functions like [`ChannelManager::process_pending_htlc_forwards`] or [`send_payment`]).
43740  *
43741  * May call [`send_data`] on [`SocketDescriptor`]s. Thus, be very careful with reentrancy
43742  * issues!
43743  *
43744  * You don't have to call this function explicitly if you are using [`lightning-net-tokio`]
43745  * or one of the other clients provided in our language bindings.
43746  *
43747  * Note that if there are any other calls to this function waiting on lock(s) this may return
43748  * without doing any work. All available events that need handling will be handled before the
43749  * other calls return.
43750  *
43751  * [`send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
43752  * [`ChannelManager::process_pending_htlc_forwards`]: crate::ln::channelmanager::ChannelManager::process_pending_htlc_forwards
43753  * [`send_data`]: SocketDescriptor::send_data
43754  */
43755 void PeerManager_process_events(const struct LDKPeerManager *NONNULL_PTR this_arg);
43756
43757 /**
43758  * Indicates that the given socket descriptor's connection is now closed.
43759  */
43760 void PeerManager_socket_disconnected(const struct LDKPeerManager *NONNULL_PTR this_arg, const struct LDKSocketDescriptor *NONNULL_PTR descriptor);
43761
43762 /**
43763  * Disconnect a peer given its node id.
43764  *
43765  * If a peer is connected, this will call [`disconnect_socket`] on the descriptor for the
43766  * peer. Thus, be very careful about reentrancy issues.
43767  *
43768  * [`disconnect_socket`]: SocketDescriptor::disconnect_socket
43769  */
43770 void PeerManager_disconnect_by_node_id(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey node_id);
43771
43772 /**
43773  * Disconnects all currently-connected peers. This is useful on platforms where there may be
43774  * an indication that TCP sockets have stalled even if we weren't around to time them out
43775  * using regular ping/pongs.
43776  */
43777 void PeerManager_disconnect_all_peers(const struct LDKPeerManager *NONNULL_PTR this_arg);
43778
43779 /**
43780  * Send pings to each peer and disconnect those which did not respond to the last round of
43781  * pings.
43782  *
43783  * This may be called on any timescale you want, however, roughly once every ten seconds is
43784  * preferred. The call rate determines both how often we send a ping to our peers and how much
43785  * time they have to respond before we disconnect them.
43786  *
43787  * May call [`send_data`] on all [`SocketDescriptor`]s. Thus, be very careful with reentrancy
43788  * issues!
43789  *
43790  * [`send_data`]: SocketDescriptor::send_data
43791  */
43792 void PeerManager_timer_tick_occurred(const struct LDKPeerManager *NONNULL_PTR this_arg);
43793
43794 /**
43795  * Generates a signed node_announcement from the given arguments, sending it to all connected
43796  * peers. Note that peers will likely ignore this message unless we have at least one public
43797  * channel which has at least six confirmations on-chain.
43798  *
43799  * `rgb` is a node \"color\" and `alias` is a printable human-readable string to describe this
43800  * node to humans. They carry no in-protocol meaning.
43801  *
43802  * `addresses` represent the set (possibly empty) of socket addresses on which this node
43803  * accepts incoming connections. These will be included in the node_announcement, publicly
43804  * tying these addresses together and to this node. If you wish to preserve user privacy,
43805  * addresses should likely contain only Tor Onion addresses.
43806  *
43807  * Panics if `addresses` is absurdly large (more than 100).
43808  *
43809  * [`get_and_clear_pending_msg_events`]: MessageSendEventsProvider::get_and_clear_pending_msg_events
43810  */
43811 void PeerManager_broadcast_node_announcement(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKThreeBytes rgb, struct LDKThirtyTwoBytes alias, struct LDKCVec_SocketAddressZ addresses);
43812
43813 /**
43814  * Gets the weight for an HTLC-Success transaction.
43815  */
43816 uint64_t htlc_success_tx_weight(const struct LDKChannelTypeFeatures *NONNULL_PTR channel_type_features);
43817
43818 /**
43819  * Gets the weight for an HTLC-Timeout transaction.
43820  */
43821 uint64_t htlc_timeout_tx_weight(const struct LDKChannelTypeFeatures *NONNULL_PTR channel_type_features);
43822
43823 /**
43824  * Creates a copy of the HTLCClaim
43825  */
43826 enum LDKHTLCClaim HTLCClaim_clone(const enum LDKHTLCClaim *NONNULL_PTR orig);
43827
43828 /**
43829  * Utility method to constructs a new OfferedTimeout-variant HTLCClaim
43830  */
43831 enum LDKHTLCClaim HTLCClaim_offered_timeout(void);
43832
43833 /**
43834  * Utility method to constructs a new OfferedPreimage-variant HTLCClaim
43835  */
43836 enum LDKHTLCClaim HTLCClaim_offered_preimage(void);
43837
43838 /**
43839  * Utility method to constructs a new AcceptedTimeout-variant HTLCClaim
43840  */
43841 enum LDKHTLCClaim HTLCClaim_accepted_timeout(void);
43842
43843 /**
43844  * Utility method to constructs a new AcceptedPreimage-variant HTLCClaim
43845  */
43846 enum LDKHTLCClaim HTLCClaim_accepted_preimage(void);
43847
43848 /**
43849  * Utility method to constructs a new Revocation-variant HTLCClaim
43850  */
43851 enum LDKHTLCClaim HTLCClaim_revocation(void);
43852
43853 /**
43854  * Checks if two HTLCClaims contain equal inner contents.
43855  * This ignores pointers and is_owned flags and looks at the values in fields.
43856  */
43857 bool HTLCClaim_eq(const enum LDKHTLCClaim *NONNULL_PTR a, const enum LDKHTLCClaim *NONNULL_PTR b);
43858
43859 /**
43860  * Check if a given input witness attempts to claim a HTLC.
43861  */
43862 MUST_USE_RES struct LDKCOption_HTLCClaimZ HTLCClaim_from_witness(struct LDKWitness witness);
43863
43864 /**
43865  * Build the commitment secret from the seed and the commitment number
43866  */
43867 struct LDKThirtyTwoBytes build_commitment_secret(const uint8_t (*commitment_seed)[32], uint64_t idx);
43868
43869 /**
43870  * Build a closing transaction
43871  */
43872 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);
43873
43874 /**
43875  * Frees any resources used by the CounterpartyCommitmentSecrets, if is_owned is set and inner is non-NULL.
43876  */
43877 void CounterpartyCommitmentSecrets_free(struct LDKCounterpartyCommitmentSecrets this_obj);
43878
43879 /**
43880  * Creates a copy of the CounterpartyCommitmentSecrets
43881  */
43882 struct LDKCounterpartyCommitmentSecrets CounterpartyCommitmentSecrets_clone(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR orig);
43883
43884 /**
43885  * Creates a new empty `CounterpartyCommitmentSecrets` structure.
43886  */
43887 MUST_USE_RES struct LDKCounterpartyCommitmentSecrets CounterpartyCommitmentSecrets_new(void);
43888
43889 /**
43890  * Returns the minimum index of all stored secrets. Note that indexes start
43891  * at 1 << 48 and get decremented by one for each new secret.
43892  */
43893 MUST_USE_RES uint64_t CounterpartyCommitmentSecrets_get_min_seen_secret(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR this_arg);
43894
43895 /**
43896  * Inserts the `secret` at `idx`. Returns `Ok(())` if the secret
43897  * was generated in accordance with BOLT 3 and is consistent with previous secrets.
43898  */
43899 MUST_USE_RES struct LDKCResult_NoneNoneZ CounterpartyCommitmentSecrets_provide_secret(struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR this_arg, uint64_t idx, struct LDKThirtyTwoBytes secret);
43900
43901 /**
43902  * Returns the secret at `idx`.
43903  * Returns `None` if `idx` is < [`CounterpartyCommitmentSecrets::get_min_seen_secret`].
43904  *
43905  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
43906  */
43907 MUST_USE_RES struct LDKThirtyTwoBytes CounterpartyCommitmentSecrets_get_secret(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR this_arg, uint64_t idx);
43908
43909 /**
43910  * Serialize the CounterpartyCommitmentSecrets object into a byte array which can be read by CounterpartyCommitmentSecrets_read
43911  */
43912 struct LDKCVec_u8Z CounterpartyCommitmentSecrets_write(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR obj);
43913
43914 /**
43915  * Read a CounterpartyCommitmentSecrets from a byte array, created by CounterpartyCommitmentSecrets_write
43916  */
43917 struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CounterpartyCommitmentSecrets_read(struct LDKu8slice ser);
43918
43919 /**
43920  * Derives a per-commitment-transaction private key (eg an htlc key or delayed_payment key)
43921  * from the base secret and the per_commitment_point.
43922  */
43923 struct LDKSecretKey derive_private_key(struct LDKPublicKey per_commitment_point, const uint8_t (*base_secret)[32]);
43924
43925 /**
43926  * Derives a per-commitment-transaction revocation key from its constituent parts.
43927  *
43928  * Only the cheating participant owns a valid witness to propagate a revoked
43929  * commitment transaction, thus per_commitment_secret always come from cheater
43930  * and revocation_base_secret always come from punisher, which is the broadcaster
43931  * of the transaction spending with this key knowledge.
43932  */
43933 struct LDKSecretKey derive_private_revocation_key(const uint8_t (*per_commitment_secret)[32], const uint8_t (*countersignatory_revocation_base_secret)[32]);
43934
43935 /**
43936  * Frees any resources used by the TxCreationKeys, if is_owned is set and inner is non-NULL.
43937  */
43938 void TxCreationKeys_free(struct LDKTxCreationKeys this_obj);
43939
43940 /**
43941  * The broadcaster's per-commitment public key which was used to derive the other keys.
43942  */
43943 struct LDKPublicKey TxCreationKeys_get_per_commitment_point(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
43944
43945 /**
43946  * The broadcaster's per-commitment public key which was used to derive the other keys.
43947  */
43948 void TxCreationKeys_set_per_commitment_point(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
43949
43950 /**
43951  * The revocation key which is used to allow the broadcaster of the commitment
43952  * transaction to provide their counterparty the ability to punish them if they broadcast
43953  * an old state.
43954  */
43955 struct LDKRevocationKey TxCreationKeys_get_revocation_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
43956
43957 /**
43958  * The revocation key which is used to allow the broadcaster of the commitment
43959  * transaction to provide their counterparty the ability to punish them if they broadcast
43960  * an old state.
43961  */
43962 void TxCreationKeys_set_revocation_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKRevocationKey val);
43963
43964 /**
43965  * Broadcaster's HTLC Key
43966  */
43967 struct LDKHtlcKey TxCreationKeys_get_broadcaster_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
43968
43969 /**
43970  * Broadcaster's HTLC Key
43971  */
43972 void TxCreationKeys_set_broadcaster_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKHtlcKey val);
43973
43974 /**
43975  * Countersignatory's HTLC Key
43976  */
43977 struct LDKHtlcKey TxCreationKeys_get_countersignatory_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
43978
43979 /**
43980  * Countersignatory's HTLC Key
43981  */
43982 void TxCreationKeys_set_countersignatory_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKHtlcKey val);
43983
43984 /**
43985  * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
43986  */
43987 struct LDKDelayedPaymentKey TxCreationKeys_get_broadcaster_delayed_payment_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
43988
43989 /**
43990  * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
43991  */
43992 void TxCreationKeys_set_broadcaster_delayed_payment_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKDelayedPaymentKey val);
43993
43994 /**
43995  * Constructs a new TxCreationKeys given each field
43996  */
43997 MUST_USE_RES struct LDKTxCreationKeys TxCreationKeys_new(struct LDKPublicKey per_commitment_point_arg, struct LDKRevocationKey revocation_key_arg, struct LDKHtlcKey broadcaster_htlc_key_arg, struct LDKHtlcKey countersignatory_htlc_key_arg, struct LDKDelayedPaymentKey broadcaster_delayed_payment_key_arg);
43998
43999 /**
44000  * Checks if two TxCreationKeyss contain equal inner contents.
44001  * This ignores pointers and is_owned flags and looks at the values in fields.
44002  * Two objects with NULL inner values will be considered "equal" here.
44003  */
44004 bool TxCreationKeys_eq(const struct LDKTxCreationKeys *NONNULL_PTR a, const struct LDKTxCreationKeys *NONNULL_PTR b);
44005
44006 /**
44007  * Creates a copy of the TxCreationKeys
44008  */
44009 struct LDKTxCreationKeys TxCreationKeys_clone(const struct LDKTxCreationKeys *NONNULL_PTR orig);
44010
44011 /**
44012  * Serialize the TxCreationKeys object into a byte array which can be read by TxCreationKeys_read
44013  */
44014 struct LDKCVec_u8Z TxCreationKeys_write(const struct LDKTxCreationKeys *NONNULL_PTR obj);
44015
44016 /**
44017  * Read a TxCreationKeys from a byte array, created by TxCreationKeys_write
44018  */
44019 struct LDKCResult_TxCreationKeysDecodeErrorZ TxCreationKeys_read(struct LDKu8slice ser);
44020
44021 /**
44022  * Frees any resources used by the ChannelPublicKeys, if is_owned is set and inner is non-NULL.
44023  */
44024 void ChannelPublicKeys_free(struct LDKChannelPublicKeys this_obj);
44025
44026 /**
44027  * The public key which is used to sign all commitment transactions, as it appears in the
44028  * on-chain channel lock-in 2-of-2 multisig output.
44029  */
44030 struct LDKPublicKey ChannelPublicKeys_get_funding_pubkey(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
44031
44032 /**
44033  * The public key which is used to sign all commitment transactions, as it appears in the
44034  * on-chain channel lock-in 2-of-2 multisig output.
44035  */
44036 void ChannelPublicKeys_set_funding_pubkey(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
44037
44038 /**
44039  * The base point which is used (with derive_public_revocation_key) to derive per-commitment
44040  * revocation keys. This is combined with the per-commitment-secret generated by the
44041  * counterparty to create a secret which the counterparty can reveal to revoke previous
44042  * states.
44043  */
44044 struct LDKRevocationBasepoint ChannelPublicKeys_get_revocation_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
44045
44046 /**
44047  * The base point which is used (with derive_public_revocation_key) to derive per-commitment
44048  * revocation keys. This is combined with the per-commitment-secret generated by the
44049  * counterparty to create a secret which the counterparty can reveal to revoke previous
44050  * states.
44051  */
44052 void ChannelPublicKeys_set_revocation_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKRevocationBasepoint val);
44053
44054 /**
44055  * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
44056  * spendable primary channel balance on the broadcaster's commitment transaction. This key is
44057  * static across every commitment transaction.
44058  */
44059 struct LDKPublicKey ChannelPublicKeys_get_payment_point(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
44060
44061 /**
44062  * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
44063  * spendable primary channel balance on the broadcaster's commitment transaction. This key is
44064  * static across every commitment transaction.
44065  */
44066 void ChannelPublicKeys_set_payment_point(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
44067
44068 /**
44069  * The base point which is used (with derive_public_key) to derive a per-commitment payment
44070  * public key which receives non-HTLC-encumbered funds which are only available for spending
44071  * after some delay (or can be claimed via the revocation path).
44072  */
44073 struct LDKDelayedPaymentBasepoint ChannelPublicKeys_get_delayed_payment_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
44074
44075 /**
44076  * The base point which is used (with derive_public_key) to derive a per-commitment payment
44077  * public key which receives non-HTLC-encumbered funds which are only available for spending
44078  * after some delay (or can be claimed via the revocation path).
44079  */
44080 void ChannelPublicKeys_set_delayed_payment_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKDelayedPaymentBasepoint val);
44081
44082 /**
44083  * The base point which is used (with derive_public_key) to derive a per-commitment public key
44084  * which is used to encumber HTLC-in-flight outputs.
44085  */
44086 struct LDKHtlcBasepoint ChannelPublicKeys_get_htlc_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
44087
44088 /**
44089  * The base point which is used (with derive_public_key) to derive a per-commitment public key
44090  * which is used to encumber HTLC-in-flight outputs.
44091  */
44092 void ChannelPublicKeys_set_htlc_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKHtlcBasepoint val);
44093
44094 /**
44095  * Constructs a new ChannelPublicKeys given each field
44096  */
44097 MUST_USE_RES struct LDKChannelPublicKeys ChannelPublicKeys_new(struct LDKPublicKey funding_pubkey_arg, struct LDKRevocationBasepoint revocation_basepoint_arg, struct LDKPublicKey payment_point_arg, struct LDKDelayedPaymentBasepoint delayed_payment_basepoint_arg, struct LDKHtlcBasepoint htlc_basepoint_arg);
44098
44099 /**
44100  * Creates a copy of the ChannelPublicKeys
44101  */
44102 struct LDKChannelPublicKeys ChannelPublicKeys_clone(const struct LDKChannelPublicKeys *NONNULL_PTR orig);
44103
44104 /**
44105  * Generates a non-cryptographic 64-bit hash of the ChannelPublicKeys.
44106  */
44107 uint64_t ChannelPublicKeys_hash(const struct LDKChannelPublicKeys *NONNULL_PTR o);
44108
44109 /**
44110  * Checks if two ChannelPublicKeyss contain equal inner contents.
44111  * This ignores pointers and is_owned flags and looks at the values in fields.
44112  * Two objects with NULL inner values will be considered "equal" here.
44113  */
44114 bool ChannelPublicKeys_eq(const struct LDKChannelPublicKeys *NONNULL_PTR a, const struct LDKChannelPublicKeys *NONNULL_PTR b);
44115
44116 /**
44117  * Serialize the ChannelPublicKeys object into a byte array which can be read by ChannelPublicKeys_read
44118  */
44119 struct LDKCVec_u8Z ChannelPublicKeys_write(const struct LDKChannelPublicKeys *NONNULL_PTR obj);
44120
44121 /**
44122  * Read a ChannelPublicKeys from a byte array, created by ChannelPublicKeys_write
44123  */
44124 struct LDKCResult_ChannelPublicKeysDecodeErrorZ ChannelPublicKeys_read(struct LDKu8slice ser);
44125
44126 /**
44127  * Create per-state keys from channel base points and the per-commitment point.
44128  * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
44129  */
44130 MUST_USE_RES struct LDKTxCreationKeys TxCreationKeys_derive_new(struct LDKPublicKey per_commitment_point, const struct LDKDelayedPaymentBasepoint *NONNULL_PTR broadcaster_delayed_payment_base, const struct LDKHtlcBasepoint *NONNULL_PTR broadcaster_htlc_base, const struct LDKRevocationBasepoint *NONNULL_PTR countersignatory_revocation_base, const struct LDKHtlcBasepoint *NONNULL_PTR countersignatory_htlc_base);
44131
44132 /**
44133  * Generate per-state keys from channel static keys.
44134  * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
44135  */
44136 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);
44137
44138 /**
44139  * A script either spendable by the revocation
44140  * key or the broadcaster_delayed_payment_key and satisfying the relative-locktime OP_CSV constrain.
44141  * Encumbering a `to_holder` output on a commitment transaction or 2nd-stage HTLC transactions.
44142  */
44143 struct LDKCVec_u8Z get_revokeable_redeemscript(const struct LDKRevocationKey *NONNULL_PTR revocation_key, uint16_t contest_delay, const struct LDKDelayedPaymentKey *NONNULL_PTR broadcaster_delayed_payment_key);
44144
44145 /**
44146  * Returns the script for the counterparty's output on a holder's commitment transaction based on
44147  * the channel type.
44148  */
44149 struct LDKCVec_u8Z get_counterparty_payment_script(const struct LDKChannelTypeFeatures *NONNULL_PTR channel_type_features, struct LDKPublicKey payment_key);
44150
44151 /**
44152  * Frees any resources used by the HTLCOutputInCommitment, if is_owned is set and inner is non-NULL.
44153  */
44154 void HTLCOutputInCommitment_free(struct LDKHTLCOutputInCommitment this_obj);
44155
44156 /**
44157  * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
44158  * Note that this is not the same as whether it is ountbound *from us*. To determine that you
44159  * need to compare this value to whether the commitment transaction in question is that of
44160  * the counterparty or our own.
44161  */
44162 bool HTLCOutputInCommitment_get_offered(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
44163
44164 /**
44165  * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
44166  * Note that this is not the same as whether it is ountbound *from us*. To determine that you
44167  * need to compare this value to whether the commitment transaction in question is that of
44168  * the counterparty or our own.
44169  */
44170 void HTLCOutputInCommitment_set_offered(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, bool val);
44171
44172 /**
44173  * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
44174  * this divided by 1000.
44175  */
44176 uint64_t HTLCOutputInCommitment_get_amount_msat(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
44177
44178 /**
44179  * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
44180  * this divided by 1000.
44181  */
44182 void HTLCOutputInCommitment_set_amount_msat(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint64_t val);
44183
44184 /**
44185  * The CLTV lock-time at which this HTLC expires.
44186  */
44187 uint32_t HTLCOutputInCommitment_get_cltv_expiry(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
44188
44189 /**
44190  * The CLTV lock-time at which this HTLC expires.
44191  */
44192 void HTLCOutputInCommitment_set_cltv_expiry(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint32_t val);
44193
44194 /**
44195  * The hash of the preimage which unlocks this HTLC.
44196  */
44197 const uint8_t (*HTLCOutputInCommitment_get_payment_hash(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr))[32];
44198
44199 /**
44200  * The hash of the preimage which unlocks this HTLC.
44201  */
44202 void HTLCOutputInCommitment_set_payment_hash(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
44203
44204 /**
44205  * The position within the commitment transactions' outputs. This may be None if the value is
44206  * below the dust limit (in which case no output appears in the commitment transaction and the
44207  * value is spent to additional transaction fees).
44208  */
44209 struct LDKCOption_u32Z HTLCOutputInCommitment_get_transaction_output_index(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
44210
44211 /**
44212  * The position within the commitment transactions' outputs. This may be None if the value is
44213  * below the dust limit (in which case no output appears in the commitment transaction and the
44214  * value is spent to additional transaction fees).
44215  */
44216 void HTLCOutputInCommitment_set_transaction_output_index(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val);
44217
44218 /**
44219  * Constructs a new HTLCOutputInCommitment given each field
44220  */
44221 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);
44222
44223 /**
44224  * Creates a copy of the HTLCOutputInCommitment
44225  */
44226 struct LDKHTLCOutputInCommitment HTLCOutputInCommitment_clone(const struct LDKHTLCOutputInCommitment *NONNULL_PTR orig);
44227
44228 /**
44229  * Checks if two HTLCOutputInCommitments contain equal inner contents.
44230  * This ignores pointers and is_owned flags and looks at the values in fields.
44231  * Two objects with NULL inner values will be considered "equal" here.
44232  */
44233 bool HTLCOutputInCommitment_eq(const struct LDKHTLCOutputInCommitment *NONNULL_PTR a, const struct LDKHTLCOutputInCommitment *NONNULL_PTR b);
44234
44235 /**
44236  * Serialize the HTLCOutputInCommitment object into a byte array which can be read by HTLCOutputInCommitment_read
44237  */
44238 struct LDKCVec_u8Z HTLCOutputInCommitment_write(const struct LDKHTLCOutputInCommitment *NONNULL_PTR obj);
44239
44240 /**
44241  * Read a HTLCOutputInCommitment from a byte array, created by HTLCOutputInCommitment_write
44242  */
44243 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ HTLCOutputInCommitment_read(struct LDKu8slice ser);
44244
44245 /**
44246  * Gets the witness redeemscript for an HTLC output in a commitment transaction. Note that htlc
44247  * does not need to have its previous_output_index filled.
44248  */
44249 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);
44250
44251 /**
44252  * Gets the redeemscript for a funding output from the two funding public keys.
44253  * Note that the order of funding public keys does not matter.
44254  */
44255 struct LDKCVec_u8Z make_funding_redeemscript(struct LDKPublicKey broadcaster, struct LDKPublicKey countersignatory);
44256
44257 /**
44258  * Builds an unsigned HTLC-Success or HTLC-Timeout transaction from the given channel and HTLC
44259  * parameters. This is used by [`TrustedCommitmentTransaction::get_htlc_sigs`] to fetch the
44260  * transaction which needs signing, and can be used to construct an HTLC transaction which is
44261  * broadcastable given a counterparty HTLC signature.
44262  *
44263  * Panics if htlc.transaction_output_index.is_none() (as such HTLCs do not appear in the
44264  * commitment transaction).
44265  */
44266 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, const struct LDKDelayedPaymentKey *NONNULL_PTR broadcaster_delayed_payment_key, const struct LDKRevocationKey *NONNULL_PTR revocation_key);
44267
44268 /**
44269  * Returns the witness required to satisfy and spend a HTLC input.
44270  */
44271 struct LDKWitness build_htlc_input_witness(struct LDKECDSASignature local_sig, struct LDKECDSASignature remote_sig, struct LDKCOption_ThirtyTwoBytesZ preimage, struct LDKu8slice redeem_script, const struct LDKChannelTypeFeatures *NONNULL_PTR channel_type_features);
44272
44273 /**
44274  * Gets the witnessScript for the to_remote output when anchors are enabled.
44275  */
44276 struct LDKCVec_u8Z get_to_countersignatory_with_anchors_redeemscript(struct LDKPublicKey payment_point);
44277
44278 /**
44279  * Gets the witnessScript for an anchor output from the funding public key.
44280  * The witness in the spending input must be:
44281  * <BIP 143 funding_signature>
44282  * After 16 blocks of confirmation, an alternative satisfying witness could be:
44283  * <>
44284  * (empty vector required to satisfy compliance with MINIMALIF-standard rule)
44285  */
44286 struct LDKCVec_u8Z get_anchor_redeemscript(struct LDKPublicKey funding_pubkey);
44287
44288 /**
44289  * Returns the witness required to satisfy and spend an anchor input.
44290  */
44291 struct LDKWitness build_anchor_input_witness(struct LDKPublicKey funding_key, struct LDKECDSASignature funding_sig);
44292
44293 /**
44294  * Frees any resources used by the ChannelTransactionParameters, if is_owned is set and inner is non-NULL.
44295  */
44296 void ChannelTransactionParameters_free(struct LDKChannelTransactionParameters this_obj);
44297
44298 /**
44299  * Holder public keys
44300  */
44301 struct LDKChannelPublicKeys ChannelTransactionParameters_get_holder_pubkeys(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
44302
44303 /**
44304  * Holder public keys
44305  */
44306 void ChannelTransactionParameters_set_holder_pubkeys(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
44307
44308 /**
44309  * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
44310  */
44311 uint16_t ChannelTransactionParameters_get_holder_selected_contest_delay(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
44312
44313 /**
44314  * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
44315  */
44316 void ChannelTransactionParameters_set_holder_selected_contest_delay(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
44317
44318 /**
44319  * Whether the holder is the initiator of this channel.
44320  * This is an input to the commitment number obscure factor computation.
44321  */
44322 bool ChannelTransactionParameters_get_is_outbound_from_holder(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
44323
44324 /**
44325  * Whether the holder is the initiator of this channel.
44326  * This is an input to the commitment number obscure factor computation.
44327  */
44328 void ChannelTransactionParameters_set_is_outbound_from_holder(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, bool val);
44329
44330 /**
44331  * The late-bound counterparty channel transaction parameters.
44332  * These parameters are populated at the point in the protocol where the counterparty provides them.
44333  *
44334  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
44335  */
44336 struct LDKCounterpartyChannelTransactionParameters ChannelTransactionParameters_get_counterparty_parameters(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
44337
44338 /**
44339  * The late-bound counterparty channel transaction parameters.
44340  * These parameters are populated at the point in the protocol where the counterparty provides them.
44341  *
44342  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
44343  */
44344 void ChannelTransactionParameters_set_counterparty_parameters(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKCounterpartyChannelTransactionParameters val);
44345
44346 /**
44347  * The late-bound funding outpoint
44348  *
44349  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
44350  */
44351 struct LDKOutPoint ChannelTransactionParameters_get_funding_outpoint(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
44352
44353 /**
44354  * The late-bound funding outpoint
44355  *
44356  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
44357  */
44358 void ChannelTransactionParameters_set_funding_outpoint(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKOutPoint val);
44359
44360 /**
44361  * This channel's type, as negotiated during channel open. For old objects where this field
44362  * wasn't serialized, it will default to static_remote_key at deserialization.
44363  */
44364 struct LDKChannelTypeFeatures ChannelTransactionParameters_get_channel_type_features(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
44365
44366 /**
44367  * This channel's type, as negotiated during channel open. For old objects where this field
44368  * wasn't serialized, it will default to static_remote_key at deserialization.
44369  */
44370 void ChannelTransactionParameters_set_channel_type_features(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelTypeFeatures val);
44371
44372 /**
44373  * Constructs a new ChannelTransactionParameters given each field
44374  *
44375  * Note that counterparty_parameters_arg (or a relevant inner pointer) may be NULL or all-0s to represent None
44376  * Note that funding_outpoint_arg (or a relevant inner pointer) may be NULL or all-0s to represent None
44377  */
44378 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);
44379
44380 /**
44381  * Creates a copy of the ChannelTransactionParameters
44382  */
44383 struct LDKChannelTransactionParameters ChannelTransactionParameters_clone(const struct LDKChannelTransactionParameters *NONNULL_PTR orig);
44384
44385 /**
44386  * Generates a non-cryptographic 64-bit hash of the ChannelTransactionParameters.
44387  */
44388 uint64_t ChannelTransactionParameters_hash(const struct LDKChannelTransactionParameters *NONNULL_PTR o);
44389
44390 /**
44391  * Checks if two ChannelTransactionParameterss contain equal inner contents.
44392  * This ignores pointers and is_owned flags and looks at the values in fields.
44393  * Two objects with NULL inner values will be considered "equal" here.
44394  */
44395 bool ChannelTransactionParameters_eq(const struct LDKChannelTransactionParameters *NONNULL_PTR a, const struct LDKChannelTransactionParameters *NONNULL_PTR b);
44396
44397 /**
44398  * Frees any resources used by the CounterpartyChannelTransactionParameters, if is_owned is set and inner is non-NULL.
44399  */
44400 void CounterpartyChannelTransactionParameters_free(struct LDKCounterpartyChannelTransactionParameters this_obj);
44401
44402 /**
44403  * Counter-party public keys
44404  */
44405 struct LDKChannelPublicKeys CounterpartyChannelTransactionParameters_get_pubkeys(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
44406
44407 /**
44408  * Counter-party public keys
44409  */
44410 void CounterpartyChannelTransactionParameters_set_pubkeys(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
44411
44412 /**
44413  * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
44414  */
44415 uint16_t CounterpartyChannelTransactionParameters_get_selected_contest_delay(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
44416
44417 /**
44418  * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
44419  */
44420 void CounterpartyChannelTransactionParameters_set_selected_contest_delay(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
44421
44422 /**
44423  * Constructs a new CounterpartyChannelTransactionParameters given each field
44424  */
44425 MUST_USE_RES struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_new(struct LDKChannelPublicKeys pubkeys_arg, uint16_t selected_contest_delay_arg);
44426
44427 /**
44428  * Creates a copy of the CounterpartyChannelTransactionParameters
44429  */
44430 struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_clone(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR orig);
44431
44432 /**
44433  * Generates a non-cryptographic 64-bit hash of the CounterpartyChannelTransactionParameters.
44434  */
44435 uint64_t CounterpartyChannelTransactionParameters_hash(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR o);
44436
44437 /**
44438  * Checks if two CounterpartyChannelTransactionParameterss contain equal inner contents.
44439  * This ignores pointers and is_owned flags and looks at the values in fields.
44440  * Two objects with NULL inner values will be considered "equal" here.
44441  */
44442 bool CounterpartyChannelTransactionParameters_eq(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR a, const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR b);
44443
44444 /**
44445  * Whether the late bound parameters are populated.
44446  */
44447 MUST_USE_RES bool ChannelTransactionParameters_is_populated(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
44448
44449 /**
44450  * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
44451  * given that the holder is the broadcaster.
44452  *
44453  * self.is_populated() must be true before calling this function.
44454  */
44455 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_holder_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
44456
44457 /**
44458  * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
44459  * given that the counterparty is the broadcaster.
44460  *
44461  * self.is_populated() must be true before calling this function.
44462  */
44463 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_counterparty_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
44464
44465 /**
44466  * Serialize the CounterpartyChannelTransactionParameters object into a byte array which can be read by CounterpartyChannelTransactionParameters_read
44467  */
44468 struct LDKCVec_u8Z CounterpartyChannelTransactionParameters_write(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR obj);
44469
44470 /**
44471  * Read a CounterpartyChannelTransactionParameters from a byte array, created by CounterpartyChannelTransactionParameters_write
44472  */
44473 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CounterpartyChannelTransactionParameters_read(struct LDKu8slice ser);
44474
44475 /**
44476  * Serialize the ChannelTransactionParameters object into a byte array which can be read by ChannelTransactionParameters_read
44477  */
44478 struct LDKCVec_u8Z ChannelTransactionParameters_write(const struct LDKChannelTransactionParameters *NONNULL_PTR obj);
44479
44480 /**
44481  * Read a ChannelTransactionParameters from a byte array, created by ChannelTransactionParameters_write
44482  */
44483 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ ChannelTransactionParameters_read(struct LDKu8slice ser);
44484
44485 /**
44486  * Frees any resources used by the DirectedChannelTransactionParameters, if is_owned is set and inner is non-NULL.
44487  */
44488 void DirectedChannelTransactionParameters_free(struct LDKDirectedChannelTransactionParameters this_obj);
44489
44490 /**
44491  * Get the channel pubkeys for the broadcaster
44492  */
44493 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_broadcaster_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
44494
44495 /**
44496  * Get the channel pubkeys for the countersignatory
44497  */
44498 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_countersignatory_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
44499
44500 /**
44501  * Get the contest delay applicable to the transactions.
44502  * Note that the contest delay was selected by the countersignatory.
44503  */
44504 MUST_USE_RES uint16_t DirectedChannelTransactionParameters_contest_delay(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
44505
44506 /**
44507  * Whether the channel is outbound from the broadcaster.
44508  *
44509  * The boolean representing the side that initiated the channel is
44510  * an input to the commitment number obscure factor computation.
44511  */
44512 MUST_USE_RES bool DirectedChannelTransactionParameters_is_outbound(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
44513
44514 /**
44515  * The funding outpoint
44516  */
44517 MUST_USE_RES struct LDKOutPoint DirectedChannelTransactionParameters_funding_outpoint(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
44518
44519 /**
44520  * Whether to use anchors for this channel
44521  */
44522 MUST_USE_RES struct LDKChannelTypeFeatures DirectedChannelTransactionParameters_channel_type_features(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
44523
44524 /**
44525  * Frees any resources used by the HolderCommitmentTransaction, if is_owned is set and inner is non-NULL.
44526  */
44527 void HolderCommitmentTransaction_free(struct LDKHolderCommitmentTransaction this_obj);
44528
44529 /**
44530  * Our counterparty's signature for the transaction
44531  */
44532 struct LDKECDSASignature HolderCommitmentTransaction_get_counterparty_sig(const struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr);
44533
44534 /**
44535  * Our counterparty's signature for the transaction
44536  */
44537 void HolderCommitmentTransaction_set_counterparty_sig(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKECDSASignature val);
44538
44539 /**
44540  * All non-dust counterparty HTLC signatures, in the order they appear in the transaction
44541  *
44542  * Returns a copy of the field.
44543  */
44544 struct LDKCVec_ECDSASignatureZ HolderCommitmentTransaction_get_counterparty_htlc_sigs(const struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr);
44545
44546 /**
44547  * All non-dust counterparty HTLC signatures, in the order they appear in the transaction
44548  */
44549 void HolderCommitmentTransaction_set_counterparty_htlc_sigs(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKCVec_ECDSASignatureZ val);
44550
44551 /**
44552  * Creates a copy of the HolderCommitmentTransaction
44553  */
44554 struct LDKHolderCommitmentTransaction HolderCommitmentTransaction_clone(const struct LDKHolderCommitmentTransaction *NONNULL_PTR orig);
44555
44556 /**
44557  * Serialize the HolderCommitmentTransaction object into a byte array which can be read by HolderCommitmentTransaction_read
44558  */
44559 struct LDKCVec_u8Z HolderCommitmentTransaction_write(const struct LDKHolderCommitmentTransaction *NONNULL_PTR obj);
44560
44561 /**
44562  * Read a HolderCommitmentTransaction from a byte array, created by HolderCommitmentTransaction_write
44563  */
44564 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ HolderCommitmentTransaction_read(struct LDKu8slice ser);
44565
44566 /**
44567  * Create a new holder transaction with the given counterparty signatures.
44568  * The funding keys are used to figure out which signature should go first when building the transaction for broadcast.
44569  */
44570 MUST_USE_RES struct LDKHolderCommitmentTransaction HolderCommitmentTransaction_new(struct LDKCommitmentTransaction commitment_tx, struct LDKECDSASignature counterparty_sig, struct LDKCVec_ECDSASignatureZ counterparty_htlc_sigs, struct LDKPublicKey holder_funding_key, struct LDKPublicKey counterparty_funding_key);
44571
44572 /**
44573  * Frees any resources used by the BuiltCommitmentTransaction, if is_owned is set and inner is non-NULL.
44574  */
44575 void BuiltCommitmentTransaction_free(struct LDKBuiltCommitmentTransaction this_obj);
44576
44577 /**
44578  * The commitment transaction
44579  */
44580 struct LDKTransaction BuiltCommitmentTransaction_get_transaction(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr);
44581
44582 /**
44583  * The commitment transaction
44584  */
44585 void BuiltCommitmentTransaction_set_transaction(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKTransaction val);
44586
44587 /**
44588  * The txid for the commitment transaction.
44589  *
44590  * This is provided as a performance optimization, instead of calling transaction.txid()
44591  * multiple times.
44592  */
44593 const uint8_t (*BuiltCommitmentTransaction_get_txid(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr))[32];
44594
44595 /**
44596  * The txid for the commitment transaction.
44597  *
44598  * This is provided as a performance optimization, instead of calling transaction.txid()
44599  * multiple times.
44600  */
44601 void BuiltCommitmentTransaction_set_txid(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
44602
44603 /**
44604  * Constructs a new BuiltCommitmentTransaction given each field
44605  */
44606 MUST_USE_RES struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_new(struct LDKTransaction transaction_arg, struct LDKThirtyTwoBytes txid_arg);
44607
44608 /**
44609  * Creates a copy of the BuiltCommitmentTransaction
44610  */
44611 struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_clone(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR orig);
44612
44613 /**
44614  * Serialize the BuiltCommitmentTransaction object into a byte array which can be read by BuiltCommitmentTransaction_read
44615  */
44616 struct LDKCVec_u8Z BuiltCommitmentTransaction_write(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR obj);
44617
44618 /**
44619  * Read a BuiltCommitmentTransaction from a byte array, created by BuiltCommitmentTransaction_write
44620  */
44621 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ BuiltCommitmentTransaction_read(struct LDKu8slice ser);
44622
44623 /**
44624  * Get the SIGHASH_ALL sighash value of the transaction.
44625  *
44626  * This can be used to verify a signature.
44627  */
44628 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);
44629
44630 /**
44631  * Signs the counterparty's commitment transaction.
44632  */
44633 MUST_USE_RES struct LDKECDSASignature 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);
44634
44635 /**
44636  * Signs the holder commitment transaction because we are about to broadcast it.
44637  */
44638 MUST_USE_RES struct LDKECDSASignature 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);
44639
44640 /**
44641  * Frees any resources used by the ClosingTransaction, if is_owned is set and inner is non-NULL.
44642  */
44643 void ClosingTransaction_free(struct LDKClosingTransaction this_obj);
44644
44645 /**
44646  * Creates a copy of the ClosingTransaction
44647  */
44648 struct LDKClosingTransaction ClosingTransaction_clone(const struct LDKClosingTransaction *NONNULL_PTR orig);
44649
44650 /**
44651  * Generates a non-cryptographic 64-bit hash of the ClosingTransaction.
44652  */
44653 uint64_t ClosingTransaction_hash(const struct LDKClosingTransaction *NONNULL_PTR o);
44654
44655 /**
44656  * Checks if two ClosingTransactions contain equal inner contents.
44657  * This ignores pointers and is_owned flags and looks at the values in fields.
44658  * Two objects with NULL inner values will be considered "equal" here.
44659  */
44660 bool ClosingTransaction_eq(const struct LDKClosingTransaction *NONNULL_PTR a, const struct LDKClosingTransaction *NONNULL_PTR b);
44661
44662 /**
44663  * Construct an object of the class
44664  */
44665 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);
44666
44667 /**
44668  * Trust our pre-built transaction.
44669  *
44670  * Applies a wrapper which allows access to the transaction.
44671  *
44672  * This should only be used if you fully trust the builder of this object. It should not
44673  * be used by an external signer - instead use the verify function.
44674  */
44675 MUST_USE_RES struct LDKTrustedClosingTransaction ClosingTransaction_trust(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
44676
44677 /**
44678  * Verify our pre-built transaction.
44679  *
44680  * Applies a wrapper which allows access to the transaction.
44681  *
44682  * An external validating signer must call this method before signing
44683  * or using the built transaction.
44684  */
44685 MUST_USE_RES struct LDKCResult_TrustedClosingTransactionNoneZ ClosingTransaction_verify(const struct LDKClosingTransaction *NONNULL_PTR this_arg, struct LDKOutPoint funding_outpoint);
44686
44687 /**
44688  * The value to be sent to the holder, or zero if the output will be omitted
44689  */
44690 MUST_USE_RES uint64_t ClosingTransaction_to_holder_value_sat(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
44691
44692 /**
44693  * The value to be sent to the counterparty, or zero if the output will be omitted
44694  */
44695 MUST_USE_RES uint64_t ClosingTransaction_to_counterparty_value_sat(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
44696
44697 /**
44698  * The destination of the holder's output
44699  */
44700 MUST_USE_RES struct LDKu8slice ClosingTransaction_to_holder_script(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
44701
44702 /**
44703  * The destination of the counterparty's output
44704  */
44705 MUST_USE_RES struct LDKu8slice ClosingTransaction_to_counterparty_script(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
44706
44707 /**
44708  * Frees any resources used by the TrustedClosingTransaction, if is_owned is set and inner is non-NULL.
44709  */
44710 void TrustedClosingTransaction_free(struct LDKTrustedClosingTransaction this_obj);
44711
44712 /**
44713  * The pre-built Bitcoin commitment transaction
44714  */
44715 MUST_USE_RES struct LDKTransaction TrustedClosingTransaction_built_transaction(const struct LDKTrustedClosingTransaction *NONNULL_PTR this_arg);
44716
44717 /**
44718  * Get the SIGHASH_ALL sighash value of the transaction.
44719  *
44720  * This can be used to verify a signature.
44721  */
44722 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);
44723
44724 /**
44725  * Sign a transaction, either because we are counter-signing the counterparty's transaction or
44726  * because we are about to broadcast a holder transaction.
44727  */
44728 MUST_USE_RES struct LDKECDSASignature TrustedClosingTransaction_sign(const struct LDKTrustedClosingTransaction *NONNULL_PTR this_arg, const uint8_t (*funding_key)[32], struct LDKu8slice funding_redeemscript, uint64_t channel_value_satoshis);
44729
44730 /**
44731  * Frees any resources used by the CommitmentTransaction, if is_owned is set and inner is non-NULL.
44732  */
44733 void CommitmentTransaction_free(struct LDKCommitmentTransaction this_obj);
44734
44735 /**
44736  * Creates a copy of the CommitmentTransaction
44737  */
44738 struct LDKCommitmentTransaction CommitmentTransaction_clone(const struct LDKCommitmentTransaction *NONNULL_PTR orig);
44739
44740 /**
44741  * Serialize the CommitmentTransaction object into a byte array which can be read by CommitmentTransaction_read
44742  */
44743 struct LDKCVec_u8Z CommitmentTransaction_write(const struct LDKCommitmentTransaction *NONNULL_PTR obj);
44744
44745 /**
44746  * Read a CommitmentTransaction from a byte array, created by CommitmentTransaction_write
44747  */
44748 struct LDKCResult_CommitmentTransactionDecodeErrorZ CommitmentTransaction_read(struct LDKu8slice ser);
44749
44750 /**
44751  * The backwards-counting commitment number
44752  */
44753 MUST_USE_RES uint64_t CommitmentTransaction_commitment_number(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
44754
44755 /**
44756  * The per commitment point used by the broadcaster.
44757  */
44758 MUST_USE_RES struct LDKPublicKey CommitmentTransaction_per_commitment_point(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
44759
44760 /**
44761  * The value to be sent to the broadcaster
44762  */
44763 MUST_USE_RES uint64_t CommitmentTransaction_to_broadcaster_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
44764
44765 /**
44766  * The value to be sent to the counterparty
44767  */
44768 MUST_USE_RES uint64_t CommitmentTransaction_to_countersignatory_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
44769
44770 /**
44771  * The feerate paid per 1000-weight-unit in this commitment transaction.
44772  */
44773 MUST_USE_RES uint32_t CommitmentTransaction_feerate_per_kw(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
44774
44775 /**
44776  * Trust our pre-built transaction and derived transaction creation public keys.
44777  *
44778  * Applies a wrapper which allows access to these fields.
44779  *
44780  * This should only be used if you fully trust the builder of this object.  It should not
44781  * be used by an external signer - instead use the verify function.
44782  */
44783 MUST_USE_RES struct LDKTrustedCommitmentTransaction CommitmentTransaction_trust(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
44784
44785 /**
44786  * Verify our pre-built transaction and derived transaction creation public keys.
44787  *
44788  * Applies a wrapper which allows access to these fields.
44789  *
44790  * An external validating signer must call this method before signing
44791  * or using the built transaction.
44792  */
44793 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);
44794
44795 /**
44796  * Frees any resources used by the TrustedCommitmentTransaction, if is_owned is set and inner is non-NULL.
44797  */
44798 void TrustedCommitmentTransaction_free(struct LDKTrustedCommitmentTransaction this_obj);
44799
44800 /**
44801  * The transaction ID of the built Bitcoin transaction
44802  */
44803 MUST_USE_RES struct LDKThirtyTwoBytes TrustedCommitmentTransaction_txid(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
44804
44805 /**
44806  * The pre-built Bitcoin commitment transaction
44807  */
44808 MUST_USE_RES struct LDKBuiltCommitmentTransaction TrustedCommitmentTransaction_built_transaction(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
44809
44810 /**
44811  * The pre-calculated transaction creation public keys.
44812  */
44813 MUST_USE_RES struct LDKTxCreationKeys TrustedCommitmentTransaction_keys(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
44814
44815 /**
44816  * Should anchors be used.
44817  */
44818 MUST_USE_RES struct LDKChannelTypeFeatures TrustedCommitmentTransaction_channel_type_features(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
44819
44820 /**
44821  * Get a signature for each HTLC which was included in the commitment transaction (ie for
44822  * which HTLCOutputInCommitment::transaction_output_index.is_some()).
44823  *
44824  * The returned Vec has one entry for each HTLC, and in the same order.
44825  *
44826  * This function is only valid in the holder commitment context, it always uses EcdsaSighashType::All.
44827  */
44828 MUST_USE_RES struct LDKCResult_CVec_ECDSASignatureZNoneZ 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);
44829
44830 /**
44831  * Returns the index of the revokeable output, i.e. the `to_local` output sending funds to
44832  * the broadcaster, in the built transaction, if any exists.
44833  *
44834  * There are two cases where this may return `None`:
44835  * - The balance of the revokeable output is below the dust limit (only found on commitments
44836  * early in the channel's lifetime, i.e. before the channel reserve is met).
44837  * - This commitment was created before LDK 0.0.117. In this case, the
44838  * commitment transaction previously didn't contain enough information to locate the
44839  * revokeable output.
44840  */
44841 MUST_USE_RES struct LDKCOption_usizeZ TrustedCommitmentTransaction_revokeable_output_index(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
44842
44843 /**
44844  * Helper method to build an unsigned justice transaction spending the revokeable
44845  * `to_local` output to a destination script. Fee estimation accounts for the expected
44846  * revocation witness data that will be added when signed.
44847  *
44848  * This method will error if the given fee rate results in a fee greater than the value
44849  * of the output being spent, or if there exists no revokeable `to_local` output on this
44850  * commitment transaction. See [`Self::revokeable_output_index`] for more details.
44851  *
44852  * The built transaction will allow fee bumping with RBF, and this method takes
44853  * `feerate_per_kw` as an input such that multiple copies of a justice transaction at different
44854  * fee rates may be built.
44855  */
44856 MUST_USE_RES struct LDKCResult_TransactionNoneZ TrustedCommitmentTransaction_build_to_local_justice_tx(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg, uint64_t feerate_per_kw, struct LDKCVec_u8Z destination_script);
44857
44858 /**
44859  * Commitment transaction numbers which appear in the transactions themselves are XOR'd with a
44860  * shared secret first. This prevents on-chain observers from discovering how many commitment
44861  * transactions occurred in a channel before it was closed.
44862  *
44863  * This function gets the shared secret from relevant channel public keys and can be used to
44864  * \"decrypt\" the commitment transaction number given a commitment transaction on-chain.
44865  */
44866 uint64_t get_commitment_transaction_number_obscure_factor(struct LDKPublicKey broadcaster_payment_basepoint, struct LDKPublicKey countersignatory_payment_basepoint, bool outbound_from_broadcaster);
44867
44868 /**
44869  * Checks if two InitFeaturess contain equal inner contents.
44870  * This ignores pointers and is_owned flags and looks at the values in fields.
44871  * Two objects with NULL inner values will be considered "equal" here.
44872  */
44873 bool InitFeatures_eq(const struct LDKInitFeatures *NONNULL_PTR a, const struct LDKInitFeatures *NONNULL_PTR b);
44874
44875 /**
44876  * Checks if two NodeFeaturess contain equal inner contents.
44877  * This ignores pointers and is_owned flags and looks at the values in fields.
44878  * Two objects with NULL inner values will be considered "equal" here.
44879  */
44880 bool NodeFeatures_eq(const struct LDKNodeFeatures *NONNULL_PTR a, const struct LDKNodeFeatures *NONNULL_PTR b);
44881
44882 /**
44883  * Checks if two ChannelFeaturess contain equal inner contents.
44884  * This ignores pointers and is_owned flags and looks at the values in fields.
44885  * Two objects with NULL inner values will be considered "equal" here.
44886  */
44887 bool ChannelFeatures_eq(const struct LDKChannelFeatures *NONNULL_PTR a, const struct LDKChannelFeatures *NONNULL_PTR b);
44888
44889 /**
44890  * Checks if two Bolt11InvoiceFeaturess contain equal inner contents.
44891  * This ignores pointers and is_owned flags and looks at the values in fields.
44892  * Two objects with NULL inner values will be considered "equal" here.
44893  */
44894 bool Bolt11InvoiceFeatures_eq(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR a, const struct LDKBolt11InvoiceFeatures *NONNULL_PTR b);
44895
44896 /**
44897  * Checks if two OfferFeaturess contain equal inner contents.
44898  * This ignores pointers and is_owned flags and looks at the values in fields.
44899  * Two objects with NULL inner values will be considered "equal" here.
44900  */
44901 bool OfferFeatures_eq(const struct LDKOfferFeatures *NONNULL_PTR a, const struct LDKOfferFeatures *NONNULL_PTR b);
44902
44903 /**
44904  * Checks if two InvoiceRequestFeaturess contain equal inner contents.
44905  * This ignores pointers and is_owned flags and looks at the values in fields.
44906  * Two objects with NULL inner values will be considered "equal" here.
44907  */
44908 bool InvoiceRequestFeatures_eq(const struct LDKInvoiceRequestFeatures *NONNULL_PTR a, const struct LDKInvoiceRequestFeatures *NONNULL_PTR b);
44909
44910 /**
44911  * Checks if two Bolt12InvoiceFeaturess contain equal inner contents.
44912  * This ignores pointers and is_owned flags and looks at the values in fields.
44913  * Two objects with NULL inner values will be considered "equal" here.
44914  */
44915 bool Bolt12InvoiceFeatures_eq(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR a, const struct LDKBolt12InvoiceFeatures *NONNULL_PTR b);
44916
44917 /**
44918  * Checks if two BlindedHopFeaturess contain equal inner contents.
44919  * This ignores pointers and is_owned flags and looks at the values in fields.
44920  * Two objects with NULL inner values will be considered "equal" here.
44921  */
44922 bool BlindedHopFeatures_eq(const struct LDKBlindedHopFeatures *NONNULL_PTR a, const struct LDKBlindedHopFeatures *NONNULL_PTR b);
44923
44924 /**
44925  * Checks if two ChannelTypeFeaturess contain equal inner contents.
44926  * This ignores pointers and is_owned flags and looks at the values in fields.
44927  * Two objects with NULL inner values will be considered "equal" here.
44928  */
44929 bool ChannelTypeFeatures_eq(const struct LDKChannelTypeFeatures *NONNULL_PTR a, const struct LDKChannelTypeFeatures *NONNULL_PTR b);
44930
44931 /**
44932  * Creates a copy of the InitFeatures
44933  */
44934 struct LDKInitFeatures InitFeatures_clone(const struct LDKInitFeatures *NONNULL_PTR orig);
44935
44936 /**
44937  * Creates a copy of the NodeFeatures
44938  */
44939 struct LDKNodeFeatures NodeFeatures_clone(const struct LDKNodeFeatures *NONNULL_PTR orig);
44940
44941 /**
44942  * Creates a copy of the ChannelFeatures
44943  */
44944 struct LDKChannelFeatures ChannelFeatures_clone(const struct LDKChannelFeatures *NONNULL_PTR orig);
44945
44946 /**
44947  * Creates a copy of the Bolt11InvoiceFeatures
44948  */
44949 struct LDKBolt11InvoiceFeatures Bolt11InvoiceFeatures_clone(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR orig);
44950
44951 /**
44952  * Creates a copy of the OfferFeatures
44953  */
44954 struct LDKOfferFeatures OfferFeatures_clone(const struct LDKOfferFeatures *NONNULL_PTR orig);
44955
44956 /**
44957  * Creates a copy of the InvoiceRequestFeatures
44958  */
44959 struct LDKInvoiceRequestFeatures InvoiceRequestFeatures_clone(const struct LDKInvoiceRequestFeatures *NONNULL_PTR orig);
44960
44961 /**
44962  * Creates a copy of the Bolt12InvoiceFeatures
44963  */
44964 struct LDKBolt12InvoiceFeatures Bolt12InvoiceFeatures_clone(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR orig);
44965
44966 /**
44967  * Creates a copy of the BlindedHopFeatures
44968  */
44969 struct LDKBlindedHopFeatures BlindedHopFeatures_clone(const struct LDKBlindedHopFeatures *NONNULL_PTR orig);
44970
44971 /**
44972  * Creates a copy of the ChannelTypeFeatures
44973  */
44974 struct LDKChannelTypeFeatures ChannelTypeFeatures_clone(const struct LDKChannelTypeFeatures *NONNULL_PTR orig);
44975
44976 /**
44977  * Generates a non-cryptographic 64-bit hash of the InitFeatures.
44978  */
44979 uint64_t InitFeatures_hash(const struct LDKInitFeatures *NONNULL_PTR o);
44980
44981 /**
44982  * Generates a non-cryptographic 64-bit hash of the NodeFeatures.
44983  */
44984 uint64_t NodeFeatures_hash(const struct LDKNodeFeatures *NONNULL_PTR o);
44985
44986 /**
44987  * Generates a non-cryptographic 64-bit hash of the ChannelFeatures.
44988  */
44989 uint64_t ChannelFeatures_hash(const struct LDKChannelFeatures *NONNULL_PTR o);
44990
44991 /**
44992  * Generates a non-cryptographic 64-bit hash of the Bolt11InvoiceFeatures.
44993  */
44994 uint64_t Bolt11InvoiceFeatures_hash(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR o);
44995
44996 /**
44997  * Generates a non-cryptographic 64-bit hash of the OfferFeatures.
44998  */
44999 uint64_t OfferFeatures_hash(const struct LDKOfferFeatures *NONNULL_PTR o);
45000
45001 /**
45002  * Generates a non-cryptographic 64-bit hash of the InvoiceRequestFeatures.
45003  */
45004 uint64_t InvoiceRequestFeatures_hash(const struct LDKInvoiceRequestFeatures *NONNULL_PTR o);
45005
45006 /**
45007  * Generates a non-cryptographic 64-bit hash of the Bolt12InvoiceFeatures.
45008  */
45009 uint64_t Bolt12InvoiceFeatures_hash(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR o);
45010
45011 /**
45012  * Generates a non-cryptographic 64-bit hash of the BlindedHopFeatures.
45013  */
45014 uint64_t BlindedHopFeatures_hash(const struct LDKBlindedHopFeatures *NONNULL_PTR o);
45015
45016 /**
45017  * Generates a non-cryptographic 64-bit hash of the ChannelTypeFeatures.
45018  */
45019 uint64_t ChannelTypeFeatures_hash(const struct LDKChannelTypeFeatures *NONNULL_PTR o);
45020
45021 /**
45022  * Frees any resources used by the InitFeatures, if is_owned is set and inner is non-NULL.
45023  */
45024 void InitFeatures_free(struct LDKInitFeatures this_obj);
45025
45026 /**
45027  * Frees any resources used by the NodeFeatures, if is_owned is set and inner is non-NULL.
45028  */
45029 void NodeFeatures_free(struct LDKNodeFeatures this_obj);
45030
45031 /**
45032  * Frees any resources used by the ChannelFeatures, if is_owned is set and inner is non-NULL.
45033  */
45034 void ChannelFeatures_free(struct LDKChannelFeatures this_obj);
45035
45036 /**
45037  * Frees any resources used by the Bolt11InvoiceFeatures, if is_owned is set and inner is non-NULL.
45038  */
45039 void Bolt11InvoiceFeatures_free(struct LDKBolt11InvoiceFeatures this_obj);
45040
45041 /**
45042  * Frees any resources used by the OfferFeatures, if is_owned is set and inner is non-NULL.
45043  */
45044 void OfferFeatures_free(struct LDKOfferFeatures this_obj);
45045
45046 /**
45047  * Frees any resources used by the InvoiceRequestFeatures, if is_owned is set and inner is non-NULL.
45048  */
45049 void InvoiceRequestFeatures_free(struct LDKInvoiceRequestFeatures this_obj);
45050
45051 /**
45052  * Frees any resources used by the Bolt12InvoiceFeatures, if is_owned is set and inner is non-NULL.
45053  */
45054 void Bolt12InvoiceFeatures_free(struct LDKBolt12InvoiceFeatures this_obj);
45055
45056 /**
45057  * Frees any resources used by the BlindedHopFeatures, if is_owned is set and inner is non-NULL.
45058  */
45059 void BlindedHopFeatures_free(struct LDKBlindedHopFeatures this_obj);
45060
45061 /**
45062  * Frees any resources used by the ChannelTypeFeatures, if is_owned is set and inner is non-NULL.
45063  */
45064 void ChannelTypeFeatures_free(struct LDKChannelTypeFeatures this_obj);
45065
45066 /**
45067  * Create a blank Features with no features set
45068  */
45069 MUST_USE_RES struct LDKInitFeatures InitFeatures_empty(void);
45070
45071 /**
45072  * Returns true if this `Features` object contains required features unknown by `other`.
45073  */
45074 MUST_USE_RES bool InitFeatures_requires_unknown_bits_from(const struct LDKInitFeatures *NONNULL_PTR this_arg, const struct LDKInitFeatures *NONNULL_PTR other);
45075
45076 /**
45077  * Returns true if this `Features` object contains unknown feature flags which are set as
45078  * \"required\".
45079  */
45080 MUST_USE_RES bool InitFeatures_requires_unknown_bits(const struct LDKInitFeatures *NONNULL_PTR this_arg);
45081
45082 /**
45083  * Sets a required feature bit. Errors if `bit` is outside the feature range as defined
45084  * by [BOLT 9].
45085  *
45086  * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will
45087  * be set instead (i.e., `bit - 1`).
45088  *
45089  * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md
45090  */
45091 MUST_USE_RES struct LDKCResult_NoneNoneZ InitFeatures_set_required_feature_bit(struct LDKInitFeatures *NONNULL_PTR this_arg, uintptr_t bit);
45092
45093 /**
45094  * Sets an optional feature bit. Errors if `bit` is outside the feature range as defined
45095  * by [BOLT 9].
45096  *
45097  * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be
45098  * set instead (i.e., `bit + 1`).
45099  *
45100  * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md
45101  */
45102 MUST_USE_RES struct LDKCResult_NoneNoneZ InitFeatures_set_optional_feature_bit(struct LDKInitFeatures *NONNULL_PTR this_arg, uintptr_t bit);
45103
45104 /**
45105  * Sets a required custom feature bit. Errors if `bit` is outside the custom range as defined
45106  * by [bLIP 2] or if it is a known `T` feature.
45107  *
45108  * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will
45109  * be set instead (i.e., `bit - 1`).
45110  *
45111  * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits
45112  */
45113 MUST_USE_RES struct LDKCResult_NoneNoneZ InitFeatures_set_required_custom_bit(struct LDKInitFeatures *NONNULL_PTR this_arg, uintptr_t bit);
45114
45115 /**
45116  * Sets an optional custom feature bit. Errors if `bit` is outside the custom range as defined
45117  * by [bLIP 2] or if it is a known `T` feature.
45118  *
45119  * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be
45120  * set instead (i.e., `bit + 1`).
45121  *
45122  * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits
45123  */
45124 MUST_USE_RES struct LDKCResult_NoneNoneZ InitFeatures_set_optional_custom_bit(struct LDKInitFeatures *NONNULL_PTR this_arg, uintptr_t bit);
45125
45126 /**
45127  * Create a blank Features with no features set
45128  */
45129 MUST_USE_RES struct LDKNodeFeatures NodeFeatures_empty(void);
45130
45131 /**
45132  * Returns true if this `Features` object contains required features unknown by `other`.
45133  */
45134 MUST_USE_RES bool NodeFeatures_requires_unknown_bits_from(const struct LDKNodeFeatures *NONNULL_PTR this_arg, const struct LDKNodeFeatures *NONNULL_PTR other);
45135
45136 /**
45137  * Returns true if this `Features` object contains unknown feature flags which are set as
45138  * \"required\".
45139  */
45140 MUST_USE_RES bool NodeFeatures_requires_unknown_bits(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
45141
45142 /**
45143  * Sets a required feature bit. Errors if `bit` is outside the feature range as defined
45144  * by [BOLT 9].
45145  *
45146  * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will
45147  * be set instead (i.e., `bit - 1`).
45148  *
45149  * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md
45150  */
45151 MUST_USE_RES struct LDKCResult_NoneNoneZ NodeFeatures_set_required_feature_bit(struct LDKNodeFeatures *NONNULL_PTR this_arg, uintptr_t bit);
45152
45153 /**
45154  * Sets an optional feature bit. Errors if `bit` is outside the feature range as defined
45155  * by [BOLT 9].
45156  *
45157  * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be
45158  * set instead (i.e., `bit + 1`).
45159  *
45160  * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md
45161  */
45162 MUST_USE_RES struct LDKCResult_NoneNoneZ NodeFeatures_set_optional_feature_bit(struct LDKNodeFeatures *NONNULL_PTR this_arg, uintptr_t bit);
45163
45164 /**
45165  * Sets a required custom feature bit. Errors if `bit` is outside the custom range as defined
45166  * by [bLIP 2] or if it is a known `T` feature.
45167  *
45168  * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will
45169  * be set instead (i.e., `bit - 1`).
45170  *
45171  * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits
45172  */
45173 MUST_USE_RES struct LDKCResult_NoneNoneZ NodeFeatures_set_required_custom_bit(struct LDKNodeFeatures *NONNULL_PTR this_arg, uintptr_t bit);
45174
45175 /**
45176  * Sets an optional custom feature bit. Errors if `bit` is outside the custom range as defined
45177  * by [bLIP 2] or if it is a known `T` feature.
45178  *
45179  * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be
45180  * set instead (i.e., `bit + 1`).
45181  *
45182  * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits
45183  */
45184 MUST_USE_RES struct LDKCResult_NoneNoneZ NodeFeatures_set_optional_custom_bit(struct LDKNodeFeatures *NONNULL_PTR this_arg, uintptr_t bit);
45185
45186 /**
45187  * Create a blank Features with no features set
45188  */
45189 MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_empty(void);
45190
45191 /**
45192  * Returns true if this `Features` object contains required features unknown by `other`.
45193  */
45194 MUST_USE_RES bool ChannelFeatures_requires_unknown_bits_from(const struct LDKChannelFeatures *NONNULL_PTR this_arg, const struct LDKChannelFeatures *NONNULL_PTR other);
45195
45196 /**
45197  * Returns true if this `Features` object contains unknown feature flags which are set as
45198  * \"required\".
45199  */
45200 MUST_USE_RES bool ChannelFeatures_requires_unknown_bits(const struct LDKChannelFeatures *NONNULL_PTR this_arg);
45201
45202 /**
45203  * Sets a required feature bit. Errors if `bit` is outside the feature range as defined
45204  * by [BOLT 9].
45205  *
45206  * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will
45207  * be set instead (i.e., `bit - 1`).
45208  *
45209  * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md
45210  */
45211 MUST_USE_RES struct LDKCResult_NoneNoneZ ChannelFeatures_set_required_feature_bit(struct LDKChannelFeatures *NONNULL_PTR this_arg, uintptr_t bit);
45212
45213 /**
45214  * Sets an optional feature bit. Errors if `bit` is outside the feature range as defined
45215  * by [BOLT 9].
45216  *
45217  * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be
45218  * set instead (i.e., `bit + 1`).
45219  *
45220  * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md
45221  */
45222 MUST_USE_RES struct LDKCResult_NoneNoneZ ChannelFeatures_set_optional_feature_bit(struct LDKChannelFeatures *NONNULL_PTR this_arg, uintptr_t bit);
45223
45224 /**
45225  * Sets a required custom feature bit. Errors if `bit` is outside the custom range as defined
45226  * by [bLIP 2] or if it is a known `T` feature.
45227  *
45228  * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will
45229  * be set instead (i.e., `bit - 1`).
45230  *
45231  * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits
45232  */
45233 MUST_USE_RES struct LDKCResult_NoneNoneZ ChannelFeatures_set_required_custom_bit(struct LDKChannelFeatures *NONNULL_PTR this_arg, uintptr_t bit);
45234
45235 /**
45236  * Sets an optional custom feature bit. Errors if `bit` is outside the custom range as defined
45237  * by [bLIP 2] or if it is a known `T` feature.
45238  *
45239  * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be
45240  * set instead (i.e., `bit + 1`).
45241  *
45242  * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits
45243  */
45244 MUST_USE_RES struct LDKCResult_NoneNoneZ ChannelFeatures_set_optional_custom_bit(struct LDKChannelFeatures *NONNULL_PTR this_arg, uintptr_t bit);
45245
45246 /**
45247  * Create a blank Features with no features set
45248  */
45249 MUST_USE_RES struct LDKBolt11InvoiceFeatures Bolt11InvoiceFeatures_empty(void);
45250
45251 /**
45252  * Returns true if this `Features` object contains required features unknown by `other`.
45253  */
45254 MUST_USE_RES bool Bolt11InvoiceFeatures_requires_unknown_bits_from(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg, const struct LDKBolt11InvoiceFeatures *NONNULL_PTR other);
45255
45256 /**
45257  * Returns true if this `Features` object contains unknown feature flags which are set as
45258  * \"required\".
45259  */
45260 MUST_USE_RES bool Bolt11InvoiceFeatures_requires_unknown_bits(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg);
45261
45262 /**
45263  * Sets a required feature bit. Errors if `bit` is outside the feature range as defined
45264  * by [BOLT 9].
45265  *
45266  * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will
45267  * be set instead (i.e., `bit - 1`).
45268  *
45269  * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md
45270  */
45271 MUST_USE_RES struct LDKCResult_NoneNoneZ Bolt11InvoiceFeatures_set_required_feature_bit(struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg, uintptr_t bit);
45272
45273 /**
45274  * Sets an optional feature bit. Errors if `bit` is outside the feature range as defined
45275  * by [BOLT 9].
45276  *
45277  * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be
45278  * set instead (i.e., `bit + 1`).
45279  *
45280  * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md
45281  */
45282 MUST_USE_RES struct LDKCResult_NoneNoneZ Bolt11InvoiceFeatures_set_optional_feature_bit(struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg, uintptr_t bit);
45283
45284 /**
45285  * Sets a required custom feature bit. Errors if `bit` is outside the custom range as defined
45286  * by [bLIP 2] or if it is a known `T` feature.
45287  *
45288  * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will
45289  * be set instead (i.e., `bit - 1`).
45290  *
45291  * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits
45292  */
45293 MUST_USE_RES struct LDKCResult_NoneNoneZ Bolt11InvoiceFeatures_set_required_custom_bit(struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg, uintptr_t bit);
45294
45295 /**
45296  * Sets an optional custom feature bit. Errors if `bit` is outside the custom range as defined
45297  * by [bLIP 2] or if it is a known `T` feature.
45298  *
45299  * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be
45300  * set instead (i.e., `bit + 1`).
45301  *
45302  * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits
45303  */
45304 MUST_USE_RES struct LDKCResult_NoneNoneZ Bolt11InvoiceFeatures_set_optional_custom_bit(struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg, uintptr_t bit);
45305
45306 /**
45307  * Create a blank Features with no features set
45308  */
45309 MUST_USE_RES struct LDKOfferFeatures OfferFeatures_empty(void);
45310
45311 /**
45312  * Returns true if this `Features` object contains required features unknown by `other`.
45313  */
45314 MUST_USE_RES bool OfferFeatures_requires_unknown_bits_from(const struct LDKOfferFeatures *NONNULL_PTR this_arg, const struct LDKOfferFeatures *NONNULL_PTR other);
45315
45316 /**
45317  * Returns true if this `Features` object contains unknown feature flags which are set as
45318  * \"required\".
45319  */
45320 MUST_USE_RES bool OfferFeatures_requires_unknown_bits(const struct LDKOfferFeatures *NONNULL_PTR this_arg);
45321
45322 /**
45323  * Sets a required feature bit. Errors if `bit` is outside the feature range as defined
45324  * by [BOLT 9].
45325  *
45326  * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will
45327  * be set instead (i.e., `bit - 1`).
45328  *
45329  * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md
45330  */
45331 MUST_USE_RES struct LDKCResult_NoneNoneZ OfferFeatures_set_required_feature_bit(struct LDKOfferFeatures *NONNULL_PTR this_arg, uintptr_t bit);
45332
45333 /**
45334  * Sets an optional feature bit. Errors if `bit` is outside the feature range as defined
45335  * by [BOLT 9].
45336  *
45337  * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be
45338  * set instead (i.e., `bit + 1`).
45339  *
45340  * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md
45341  */
45342 MUST_USE_RES struct LDKCResult_NoneNoneZ OfferFeatures_set_optional_feature_bit(struct LDKOfferFeatures *NONNULL_PTR this_arg, uintptr_t bit);
45343
45344 /**
45345  * Sets a required custom feature bit. Errors if `bit` is outside the custom range as defined
45346  * by [bLIP 2] or if it is a known `T` feature.
45347  *
45348  * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will
45349  * be set instead (i.e., `bit - 1`).
45350  *
45351  * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits
45352  */
45353 MUST_USE_RES struct LDKCResult_NoneNoneZ OfferFeatures_set_required_custom_bit(struct LDKOfferFeatures *NONNULL_PTR this_arg, uintptr_t bit);
45354
45355 /**
45356  * Sets an optional custom feature bit. Errors if `bit` is outside the custom range as defined
45357  * by [bLIP 2] or if it is a known `T` feature.
45358  *
45359  * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be
45360  * set instead (i.e., `bit + 1`).
45361  *
45362  * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits
45363  */
45364 MUST_USE_RES struct LDKCResult_NoneNoneZ OfferFeatures_set_optional_custom_bit(struct LDKOfferFeatures *NONNULL_PTR this_arg, uintptr_t bit);
45365
45366 /**
45367  * Create a blank Features with no features set
45368  */
45369 MUST_USE_RES struct LDKInvoiceRequestFeatures InvoiceRequestFeatures_empty(void);
45370
45371 /**
45372  * Returns true if this `Features` object contains required features unknown by `other`.
45373  */
45374 MUST_USE_RES bool InvoiceRequestFeatures_requires_unknown_bits_from(const struct LDKInvoiceRequestFeatures *NONNULL_PTR this_arg, const struct LDKInvoiceRequestFeatures *NONNULL_PTR other);
45375
45376 /**
45377  * Returns true if this `Features` object contains unknown feature flags which are set as
45378  * \"required\".
45379  */
45380 MUST_USE_RES bool InvoiceRequestFeatures_requires_unknown_bits(const struct LDKInvoiceRequestFeatures *NONNULL_PTR this_arg);
45381
45382 /**
45383  * Sets a required feature bit. Errors if `bit` is outside the feature range as defined
45384  * by [BOLT 9].
45385  *
45386  * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will
45387  * be set instead (i.e., `bit - 1`).
45388  *
45389  * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md
45390  */
45391 MUST_USE_RES struct LDKCResult_NoneNoneZ InvoiceRequestFeatures_set_required_feature_bit(struct LDKInvoiceRequestFeatures *NONNULL_PTR this_arg, uintptr_t bit);
45392
45393 /**
45394  * Sets an optional feature bit. Errors if `bit` is outside the feature range as defined
45395  * by [BOLT 9].
45396  *
45397  * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be
45398  * set instead (i.e., `bit + 1`).
45399  *
45400  * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md
45401  */
45402 MUST_USE_RES struct LDKCResult_NoneNoneZ InvoiceRequestFeatures_set_optional_feature_bit(struct LDKInvoiceRequestFeatures *NONNULL_PTR this_arg, uintptr_t bit);
45403
45404 /**
45405  * Sets a required custom feature bit. Errors if `bit` is outside the custom range as defined
45406  * by [bLIP 2] or if it is a known `T` feature.
45407  *
45408  * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will
45409  * be set instead (i.e., `bit - 1`).
45410  *
45411  * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits
45412  */
45413 MUST_USE_RES struct LDKCResult_NoneNoneZ InvoiceRequestFeatures_set_required_custom_bit(struct LDKInvoiceRequestFeatures *NONNULL_PTR this_arg, uintptr_t bit);
45414
45415 /**
45416  * Sets an optional custom feature bit. Errors if `bit` is outside the custom range as defined
45417  * by [bLIP 2] or if it is a known `T` feature.
45418  *
45419  * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be
45420  * set instead (i.e., `bit + 1`).
45421  *
45422  * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits
45423  */
45424 MUST_USE_RES struct LDKCResult_NoneNoneZ InvoiceRequestFeatures_set_optional_custom_bit(struct LDKInvoiceRequestFeatures *NONNULL_PTR this_arg, uintptr_t bit);
45425
45426 /**
45427  * Create a blank Features with no features set
45428  */
45429 MUST_USE_RES struct LDKBolt12InvoiceFeatures Bolt12InvoiceFeatures_empty(void);
45430
45431 /**
45432  * Returns true if this `Features` object contains required features unknown by `other`.
45433  */
45434 MUST_USE_RES bool Bolt12InvoiceFeatures_requires_unknown_bits_from(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg, const struct LDKBolt12InvoiceFeatures *NONNULL_PTR other);
45435
45436 /**
45437  * Returns true if this `Features` object contains unknown feature flags which are set as
45438  * \"required\".
45439  */
45440 MUST_USE_RES bool Bolt12InvoiceFeatures_requires_unknown_bits(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg);
45441
45442 /**
45443  * Sets a required feature bit. Errors if `bit` is outside the feature range as defined
45444  * by [BOLT 9].
45445  *
45446  * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will
45447  * be set instead (i.e., `bit - 1`).
45448  *
45449  * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md
45450  */
45451 MUST_USE_RES struct LDKCResult_NoneNoneZ Bolt12InvoiceFeatures_set_required_feature_bit(struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg, uintptr_t bit);
45452
45453 /**
45454  * Sets an optional feature bit. Errors if `bit` is outside the feature range as defined
45455  * by [BOLT 9].
45456  *
45457  * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be
45458  * set instead (i.e., `bit + 1`).
45459  *
45460  * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md
45461  */
45462 MUST_USE_RES struct LDKCResult_NoneNoneZ Bolt12InvoiceFeatures_set_optional_feature_bit(struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg, uintptr_t bit);
45463
45464 /**
45465  * Sets a required custom feature bit. Errors if `bit` is outside the custom range as defined
45466  * by [bLIP 2] or if it is a known `T` feature.
45467  *
45468  * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will
45469  * be set instead (i.e., `bit - 1`).
45470  *
45471  * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits
45472  */
45473 MUST_USE_RES struct LDKCResult_NoneNoneZ Bolt12InvoiceFeatures_set_required_custom_bit(struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg, uintptr_t bit);
45474
45475 /**
45476  * Sets an optional custom feature bit. Errors if `bit` is outside the custom range as defined
45477  * by [bLIP 2] or if it is a known `T` feature.
45478  *
45479  * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be
45480  * set instead (i.e., `bit + 1`).
45481  *
45482  * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits
45483  */
45484 MUST_USE_RES struct LDKCResult_NoneNoneZ Bolt12InvoiceFeatures_set_optional_custom_bit(struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg, uintptr_t bit);
45485
45486 /**
45487  * Create a blank Features with no features set
45488  */
45489 MUST_USE_RES struct LDKBlindedHopFeatures BlindedHopFeatures_empty(void);
45490
45491 /**
45492  * Returns true if this `Features` object contains required features unknown by `other`.
45493  */
45494 MUST_USE_RES bool BlindedHopFeatures_requires_unknown_bits_from(const struct LDKBlindedHopFeatures *NONNULL_PTR this_arg, const struct LDKBlindedHopFeatures *NONNULL_PTR other);
45495
45496 /**
45497  * Returns true if this `Features` object contains unknown feature flags which are set as
45498  * \"required\".
45499  */
45500 MUST_USE_RES bool BlindedHopFeatures_requires_unknown_bits(const struct LDKBlindedHopFeatures *NONNULL_PTR this_arg);
45501
45502 /**
45503  * Sets a required feature bit. Errors if `bit` is outside the feature range as defined
45504  * by [BOLT 9].
45505  *
45506  * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will
45507  * be set instead (i.e., `bit - 1`).
45508  *
45509  * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md
45510  */
45511 MUST_USE_RES struct LDKCResult_NoneNoneZ BlindedHopFeatures_set_required_feature_bit(struct LDKBlindedHopFeatures *NONNULL_PTR this_arg, uintptr_t bit);
45512
45513 /**
45514  * Sets an optional feature bit. Errors if `bit` is outside the feature range as defined
45515  * by [BOLT 9].
45516  *
45517  * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be
45518  * set instead (i.e., `bit + 1`).
45519  *
45520  * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md
45521  */
45522 MUST_USE_RES struct LDKCResult_NoneNoneZ BlindedHopFeatures_set_optional_feature_bit(struct LDKBlindedHopFeatures *NONNULL_PTR this_arg, uintptr_t bit);
45523
45524 /**
45525  * Sets a required custom feature bit. Errors if `bit` is outside the custom range as defined
45526  * by [bLIP 2] or if it is a known `T` feature.
45527  *
45528  * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will
45529  * be set instead (i.e., `bit - 1`).
45530  *
45531  * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits
45532  */
45533 MUST_USE_RES struct LDKCResult_NoneNoneZ BlindedHopFeatures_set_required_custom_bit(struct LDKBlindedHopFeatures *NONNULL_PTR this_arg, uintptr_t bit);
45534
45535 /**
45536  * Sets an optional custom feature bit. Errors if `bit` is outside the custom range as defined
45537  * by [bLIP 2] or if it is a known `T` feature.
45538  *
45539  * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be
45540  * set instead (i.e., `bit + 1`).
45541  *
45542  * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits
45543  */
45544 MUST_USE_RES struct LDKCResult_NoneNoneZ BlindedHopFeatures_set_optional_custom_bit(struct LDKBlindedHopFeatures *NONNULL_PTR this_arg, uintptr_t bit);
45545
45546 /**
45547  * Create a blank Features with no features set
45548  */
45549 MUST_USE_RES struct LDKChannelTypeFeatures ChannelTypeFeatures_empty(void);
45550
45551 /**
45552  * Returns true if this `Features` object contains required features unknown by `other`.
45553  */
45554 MUST_USE_RES bool ChannelTypeFeatures_requires_unknown_bits_from(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg, const struct LDKChannelTypeFeatures *NONNULL_PTR other);
45555
45556 /**
45557  * Returns true if this `Features` object contains unknown feature flags which are set as
45558  * \"required\".
45559  */
45560 MUST_USE_RES bool ChannelTypeFeatures_requires_unknown_bits(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
45561
45562 /**
45563  * Sets a required feature bit. Errors if `bit` is outside the feature range as defined
45564  * by [BOLT 9].
45565  *
45566  * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will
45567  * be set instead (i.e., `bit - 1`).
45568  *
45569  * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md
45570  */
45571 MUST_USE_RES struct LDKCResult_NoneNoneZ ChannelTypeFeatures_set_required_feature_bit(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg, uintptr_t bit);
45572
45573 /**
45574  * Sets an optional feature bit. Errors if `bit` is outside the feature range as defined
45575  * by [BOLT 9].
45576  *
45577  * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be
45578  * set instead (i.e., `bit + 1`).
45579  *
45580  * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md
45581  */
45582 MUST_USE_RES struct LDKCResult_NoneNoneZ ChannelTypeFeatures_set_optional_feature_bit(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg, uintptr_t bit);
45583
45584 /**
45585  * Sets a required custom feature bit. Errors if `bit` is outside the custom range as defined
45586  * by [bLIP 2] or if it is a known `T` feature.
45587  *
45588  * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will
45589  * be set instead (i.e., `bit - 1`).
45590  *
45591  * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits
45592  */
45593 MUST_USE_RES struct LDKCResult_NoneNoneZ ChannelTypeFeatures_set_required_custom_bit(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg, uintptr_t bit);
45594
45595 /**
45596  * Sets an optional custom feature bit. Errors if `bit` is outside the custom range as defined
45597  * by [bLIP 2] or if it is a known `T` feature.
45598  *
45599  * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be
45600  * set instead (i.e., `bit + 1`).
45601  *
45602  * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits
45603  */
45604 MUST_USE_RES struct LDKCResult_NoneNoneZ ChannelTypeFeatures_set_optional_custom_bit(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg, uintptr_t bit);
45605
45606 /**
45607  * Serialize the InitFeatures object into a byte array which can be read by InitFeatures_read
45608  */
45609 struct LDKCVec_u8Z InitFeatures_write(const struct LDKInitFeatures *NONNULL_PTR obj);
45610
45611 /**
45612  * Read a InitFeatures from a byte array, created by InitFeatures_write
45613  */
45614 struct LDKCResult_InitFeaturesDecodeErrorZ InitFeatures_read(struct LDKu8slice ser);
45615
45616 /**
45617  * Serialize the ChannelFeatures object into a byte array which can be read by ChannelFeatures_read
45618  */
45619 struct LDKCVec_u8Z ChannelFeatures_write(const struct LDKChannelFeatures *NONNULL_PTR obj);
45620
45621 /**
45622  * Read a ChannelFeatures from a byte array, created by ChannelFeatures_write
45623  */
45624 struct LDKCResult_ChannelFeaturesDecodeErrorZ ChannelFeatures_read(struct LDKu8slice ser);
45625
45626 /**
45627  * Serialize the NodeFeatures object into a byte array which can be read by NodeFeatures_read
45628  */
45629 struct LDKCVec_u8Z NodeFeatures_write(const struct LDKNodeFeatures *NONNULL_PTR obj);
45630
45631 /**
45632  * Read a NodeFeatures from a byte array, created by NodeFeatures_write
45633  */
45634 struct LDKCResult_NodeFeaturesDecodeErrorZ NodeFeatures_read(struct LDKu8slice ser);
45635
45636 /**
45637  * Serialize the Bolt11InvoiceFeatures object into a byte array which can be read by Bolt11InvoiceFeatures_read
45638  */
45639 struct LDKCVec_u8Z Bolt11InvoiceFeatures_write(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR obj);
45640
45641 /**
45642  * Read a Bolt11InvoiceFeatures from a byte array, created by Bolt11InvoiceFeatures_write
45643  */
45644 struct LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ Bolt11InvoiceFeatures_read(struct LDKu8slice ser);
45645
45646 /**
45647  * Serialize the Bolt12InvoiceFeatures object into a byte array which can be read by Bolt12InvoiceFeatures_read
45648  */
45649 struct LDKCVec_u8Z Bolt12InvoiceFeatures_write(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR obj);
45650
45651 /**
45652  * Read a Bolt12InvoiceFeatures from a byte array, created by Bolt12InvoiceFeatures_write
45653  */
45654 struct LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ Bolt12InvoiceFeatures_read(struct LDKu8slice ser);
45655
45656 /**
45657  * Serialize the BlindedHopFeatures object into a byte array which can be read by BlindedHopFeatures_read
45658  */
45659 struct LDKCVec_u8Z BlindedHopFeatures_write(const struct LDKBlindedHopFeatures *NONNULL_PTR obj);
45660
45661 /**
45662  * Read a BlindedHopFeatures from a byte array, created by BlindedHopFeatures_write
45663  */
45664 struct LDKCResult_BlindedHopFeaturesDecodeErrorZ BlindedHopFeatures_read(struct LDKu8slice ser);
45665
45666 /**
45667  * Serialize the ChannelTypeFeatures object into a byte array which can be read by ChannelTypeFeatures_read
45668  */
45669 struct LDKCVec_u8Z ChannelTypeFeatures_write(const struct LDKChannelTypeFeatures *NONNULL_PTR obj);
45670
45671 /**
45672  * Read a ChannelTypeFeatures from a byte array, created by ChannelTypeFeatures_write
45673  */
45674 struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ ChannelTypeFeatures_read(struct LDKu8slice ser);
45675
45676 /**
45677  * Set this feature as optional.
45678  */
45679 void InitFeatures_set_data_loss_protect_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
45680
45681 /**
45682  * Set this feature as required.
45683  */
45684 void InitFeatures_set_data_loss_protect_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
45685
45686 /**
45687  * Checks if this feature is supported.
45688  */
45689 MUST_USE_RES bool InitFeatures_supports_data_loss_protect(const struct LDKInitFeatures *NONNULL_PTR this_arg);
45690
45691 /**
45692  * Set this feature as optional.
45693  */
45694 void NodeFeatures_set_data_loss_protect_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
45695
45696 /**
45697  * Set this feature as required.
45698  */
45699 void NodeFeatures_set_data_loss_protect_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
45700
45701 /**
45702  * Checks if this feature is supported.
45703  */
45704 MUST_USE_RES bool NodeFeatures_supports_data_loss_protect(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
45705
45706 /**
45707  * Checks if this feature is required.
45708  */
45709 MUST_USE_RES bool InitFeatures_requires_data_loss_protect(const struct LDKInitFeatures *NONNULL_PTR this_arg);
45710
45711 /**
45712  * Checks if this feature is required.
45713  */
45714 MUST_USE_RES bool NodeFeatures_requires_data_loss_protect(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
45715
45716 /**
45717  * Set this feature as optional.
45718  */
45719 void InitFeatures_set_initial_routing_sync_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
45720
45721 /**
45722  * Set this feature as required.
45723  */
45724 void InitFeatures_set_initial_routing_sync_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
45725
45726 /**
45727  * Checks if this feature is supported.
45728  */
45729 MUST_USE_RES bool InitFeatures_initial_routing_sync(const struct LDKInitFeatures *NONNULL_PTR this_arg);
45730
45731 /**
45732  * Set this feature as optional.
45733  */
45734 void InitFeatures_set_upfront_shutdown_script_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
45735
45736 /**
45737  * Set this feature as required.
45738  */
45739 void InitFeatures_set_upfront_shutdown_script_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
45740
45741 /**
45742  * Checks if this feature is supported.
45743  */
45744 MUST_USE_RES bool InitFeatures_supports_upfront_shutdown_script(const struct LDKInitFeatures *NONNULL_PTR this_arg);
45745
45746 /**
45747  * Set this feature as optional.
45748  */
45749 void NodeFeatures_set_upfront_shutdown_script_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
45750
45751 /**
45752  * Set this feature as required.
45753  */
45754 void NodeFeatures_set_upfront_shutdown_script_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
45755
45756 /**
45757  * Checks if this feature is supported.
45758  */
45759 MUST_USE_RES bool NodeFeatures_supports_upfront_shutdown_script(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
45760
45761 /**
45762  * Checks if this feature is required.
45763  */
45764 MUST_USE_RES bool InitFeatures_requires_upfront_shutdown_script(const struct LDKInitFeatures *NONNULL_PTR this_arg);
45765
45766 /**
45767  * Checks if this feature is required.
45768  */
45769 MUST_USE_RES bool NodeFeatures_requires_upfront_shutdown_script(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
45770
45771 /**
45772  * Set this feature as optional.
45773  */
45774 void InitFeatures_set_gossip_queries_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
45775
45776 /**
45777  * Set this feature as required.
45778  */
45779 void InitFeatures_set_gossip_queries_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
45780
45781 /**
45782  * Checks if this feature is supported.
45783  */
45784 MUST_USE_RES bool InitFeatures_supports_gossip_queries(const struct LDKInitFeatures *NONNULL_PTR this_arg);
45785
45786 /**
45787  * Set this feature as optional.
45788  */
45789 void NodeFeatures_set_gossip_queries_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
45790
45791 /**
45792  * Set this feature as required.
45793  */
45794 void NodeFeatures_set_gossip_queries_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
45795
45796 /**
45797  * Checks if this feature is supported.
45798  */
45799 MUST_USE_RES bool NodeFeatures_supports_gossip_queries(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
45800
45801 /**
45802  * Checks if this feature is required.
45803  */
45804 MUST_USE_RES bool InitFeatures_requires_gossip_queries(const struct LDKInitFeatures *NONNULL_PTR this_arg);
45805
45806 /**
45807  * Checks if this feature is required.
45808  */
45809 MUST_USE_RES bool NodeFeatures_requires_gossip_queries(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
45810
45811 /**
45812  * Set this feature as optional.
45813  */
45814 void InitFeatures_set_variable_length_onion_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
45815
45816 /**
45817  * Set this feature as required.
45818  */
45819 void InitFeatures_set_variable_length_onion_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
45820
45821 /**
45822  * Checks if this feature is supported.
45823  */
45824 MUST_USE_RES bool InitFeatures_supports_variable_length_onion(const struct LDKInitFeatures *NONNULL_PTR this_arg);
45825
45826 /**
45827  * Set this feature as optional.
45828  */
45829 void NodeFeatures_set_variable_length_onion_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
45830
45831 /**
45832  * Set this feature as required.
45833  */
45834 void NodeFeatures_set_variable_length_onion_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
45835
45836 /**
45837  * Checks if this feature is supported.
45838  */
45839 MUST_USE_RES bool NodeFeatures_supports_variable_length_onion(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
45840
45841 /**
45842  * Set this feature as optional.
45843  */
45844 void Bolt11InvoiceFeatures_set_variable_length_onion_optional(struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg);
45845
45846 /**
45847  * Set this feature as required.
45848  */
45849 void Bolt11InvoiceFeatures_set_variable_length_onion_required(struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg);
45850
45851 /**
45852  * Checks if this feature is supported.
45853  */
45854 MUST_USE_RES bool Bolt11InvoiceFeatures_supports_variable_length_onion(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg);
45855
45856 /**
45857  * Checks if this feature is required.
45858  */
45859 MUST_USE_RES bool InitFeatures_requires_variable_length_onion(const struct LDKInitFeatures *NONNULL_PTR this_arg);
45860
45861 /**
45862  * Checks if this feature is required.
45863  */
45864 MUST_USE_RES bool NodeFeatures_requires_variable_length_onion(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
45865
45866 /**
45867  * Checks if this feature is required.
45868  */
45869 MUST_USE_RES bool Bolt11InvoiceFeatures_requires_variable_length_onion(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg);
45870
45871 /**
45872  * Set this feature as optional.
45873  */
45874 void InitFeatures_set_static_remote_key_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
45875
45876 /**
45877  * Set this feature as required.
45878  */
45879 void InitFeatures_set_static_remote_key_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
45880
45881 /**
45882  * Checks if this feature is supported.
45883  */
45884 MUST_USE_RES bool InitFeatures_supports_static_remote_key(const struct LDKInitFeatures *NONNULL_PTR this_arg);
45885
45886 /**
45887  * Set this feature as optional.
45888  */
45889 void NodeFeatures_set_static_remote_key_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
45890
45891 /**
45892  * Set this feature as required.
45893  */
45894 void NodeFeatures_set_static_remote_key_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
45895
45896 /**
45897  * Checks if this feature is supported.
45898  */
45899 MUST_USE_RES bool NodeFeatures_supports_static_remote_key(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
45900
45901 /**
45902  * Set this feature as optional.
45903  */
45904 void ChannelTypeFeatures_set_static_remote_key_optional(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
45905
45906 /**
45907  * Set this feature as required.
45908  */
45909 void ChannelTypeFeatures_set_static_remote_key_required(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
45910
45911 /**
45912  * Checks if this feature is supported.
45913  */
45914 MUST_USE_RES bool ChannelTypeFeatures_supports_static_remote_key(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
45915
45916 /**
45917  * Checks if this feature is required.
45918  */
45919 MUST_USE_RES bool InitFeatures_requires_static_remote_key(const struct LDKInitFeatures *NONNULL_PTR this_arg);
45920
45921 /**
45922  * Checks if this feature is required.
45923  */
45924 MUST_USE_RES bool NodeFeatures_requires_static_remote_key(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
45925
45926 /**
45927  * Checks if this feature is required.
45928  */
45929 MUST_USE_RES bool ChannelTypeFeatures_requires_static_remote_key(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
45930
45931 /**
45932  * Set this feature as optional.
45933  */
45934 void InitFeatures_set_payment_secret_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
45935
45936 /**
45937  * Set this feature as required.
45938  */
45939 void InitFeatures_set_payment_secret_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
45940
45941 /**
45942  * Checks if this feature is supported.
45943  */
45944 MUST_USE_RES bool InitFeatures_supports_payment_secret(const struct LDKInitFeatures *NONNULL_PTR this_arg);
45945
45946 /**
45947  * Set this feature as optional.
45948  */
45949 void NodeFeatures_set_payment_secret_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
45950
45951 /**
45952  * Set this feature as required.
45953  */
45954 void NodeFeatures_set_payment_secret_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
45955
45956 /**
45957  * Checks if this feature is supported.
45958  */
45959 MUST_USE_RES bool NodeFeatures_supports_payment_secret(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
45960
45961 /**
45962  * Set this feature as optional.
45963  */
45964 void Bolt11InvoiceFeatures_set_payment_secret_optional(struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg);
45965
45966 /**
45967  * Set this feature as required.
45968  */
45969 void Bolt11InvoiceFeatures_set_payment_secret_required(struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg);
45970
45971 /**
45972  * Checks if this feature is supported.
45973  */
45974 MUST_USE_RES bool Bolt11InvoiceFeatures_supports_payment_secret(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg);
45975
45976 /**
45977  * Checks if this feature is required.
45978  */
45979 MUST_USE_RES bool InitFeatures_requires_payment_secret(const struct LDKInitFeatures *NONNULL_PTR this_arg);
45980
45981 /**
45982  * Checks if this feature is required.
45983  */
45984 MUST_USE_RES bool NodeFeatures_requires_payment_secret(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
45985
45986 /**
45987  * Checks if this feature is required.
45988  */
45989 MUST_USE_RES bool Bolt11InvoiceFeatures_requires_payment_secret(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg);
45990
45991 /**
45992  * Set this feature as optional.
45993  */
45994 void InitFeatures_set_basic_mpp_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
45995
45996 /**
45997  * Set this feature as required.
45998  */
45999 void InitFeatures_set_basic_mpp_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
46000
46001 /**
46002  * Checks if this feature is supported.
46003  */
46004 MUST_USE_RES bool InitFeatures_supports_basic_mpp(const struct LDKInitFeatures *NONNULL_PTR this_arg);
46005
46006 /**
46007  * Set this feature as optional.
46008  */
46009 void NodeFeatures_set_basic_mpp_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
46010
46011 /**
46012  * Set this feature as required.
46013  */
46014 void NodeFeatures_set_basic_mpp_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
46015
46016 /**
46017  * Checks if this feature is supported.
46018  */
46019 MUST_USE_RES bool NodeFeatures_supports_basic_mpp(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
46020
46021 /**
46022  * Set this feature as optional.
46023  */
46024 void Bolt11InvoiceFeatures_set_basic_mpp_optional(struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg);
46025
46026 /**
46027  * Set this feature as required.
46028  */
46029 void Bolt11InvoiceFeatures_set_basic_mpp_required(struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg);
46030
46031 /**
46032  * Checks if this feature is supported.
46033  */
46034 MUST_USE_RES bool Bolt11InvoiceFeatures_supports_basic_mpp(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg);
46035
46036 /**
46037  * Set this feature as optional.
46038  */
46039 void Bolt12InvoiceFeatures_set_basic_mpp_optional(struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg);
46040
46041 /**
46042  * Set this feature as required.
46043  */
46044 void Bolt12InvoiceFeatures_set_basic_mpp_required(struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg);
46045
46046 /**
46047  * Checks if this feature is supported.
46048  */
46049 MUST_USE_RES bool Bolt12InvoiceFeatures_supports_basic_mpp(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg);
46050
46051 /**
46052  * Checks if this feature is required.
46053  */
46054 MUST_USE_RES bool InitFeatures_requires_basic_mpp(const struct LDKInitFeatures *NONNULL_PTR this_arg);
46055
46056 /**
46057  * Checks if this feature is required.
46058  */
46059 MUST_USE_RES bool NodeFeatures_requires_basic_mpp(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
46060
46061 /**
46062  * Checks if this feature is required.
46063  */
46064 MUST_USE_RES bool Bolt11InvoiceFeatures_requires_basic_mpp(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg);
46065
46066 /**
46067  * Checks if this feature is required.
46068  */
46069 MUST_USE_RES bool Bolt12InvoiceFeatures_requires_basic_mpp(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg);
46070
46071 /**
46072  * Set this feature as optional.
46073  */
46074 void InitFeatures_set_wumbo_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
46075
46076 /**
46077  * Set this feature as required.
46078  */
46079 void InitFeatures_set_wumbo_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
46080
46081 /**
46082  * Checks if this feature is supported.
46083  */
46084 MUST_USE_RES bool InitFeatures_supports_wumbo(const struct LDKInitFeatures *NONNULL_PTR this_arg);
46085
46086 /**
46087  * Set this feature as optional.
46088  */
46089 void NodeFeatures_set_wumbo_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
46090
46091 /**
46092  * Set this feature as required.
46093  */
46094 void NodeFeatures_set_wumbo_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
46095
46096 /**
46097  * Checks if this feature is supported.
46098  */
46099 MUST_USE_RES bool NodeFeatures_supports_wumbo(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
46100
46101 /**
46102  * Checks if this feature is required.
46103  */
46104 MUST_USE_RES bool InitFeatures_requires_wumbo(const struct LDKInitFeatures *NONNULL_PTR this_arg);
46105
46106 /**
46107  * Checks if this feature is required.
46108  */
46109 MUST_USE_RES bool NodeFeatures_requires_wumbo(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
46110
46111 /**
46112  * Set this feature as optional.
46113  */
46114 void InitFeatures_set_anchors_nonzero_fee_htlc_tx_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
46115
46116 /**
46117  * Set this feature as required.
46118  */
46119 void InitFeatures_set_anchors_nonzero_fee_htlc_tx_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
46120
46121 /**
46122  * Checks if this feature is supported.
46123  */
46124 MUST_USE_RES bool InitFeatures_supports_anchors_nonzero_fee_htlc_tx(const struct LDKInitFeatures *NONNULL_PTR this_arg);
46125
46126 /**
46127  * Set this feature as optional.
46128  */
46129 void NodeFeatures_set_anchors_nonzero_fee_htlc_tx_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
46130
46131 /**
46132  * Set this feature as required.
46133  */
46134 void NodeFeatures_set_anchors_nonzero_fee_htlc_tx_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
46135
46136 /**
46137  * Checks if this feature is supported.
46138  */
46139 MUST_USE_RES bool NodeFeatures_supports_anchors_nonzero_fee_htlc_tx(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
46140
46141 /**
46142  * Set this feature as optional.
46143  */
46144 void ChannelTypeFeatures_set_anchors_nonzero_fee_htlc_tx_optional(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
46145
46146 /**
46147  * Set this feature as required.
46148  */
46149 void ChannelTypeFeatures_set_anchors_nonzero_fee_htlc_tx_required(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
46150
46151 /**
46152  * Checks if this feature is supported.
46153  */
46154 MUST_USE_RES bool ChannelTypeFeatures_supports_anchors_nonzero_fee_htlc_tx(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
46155
46156 /**
46157  * Checks if this feature is required.
46158  */
46159 MUST_USE_RES bool InitFeatures_requires_anchors_nonzero_fee_htlc_tx(const struct LDKInitFeatures *NONNULL_PTR this_arg);
46160
46161 /**
46162  * Checks if this feature is required.
46163  */
46164 MUST_USE_RES bool NodeFeatures_requires_anchors_nonzero_fee_htlc_tx(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
46165
46166 /**
46167  * Checks if this feature is required.
46168  */
46169 MUST_USE_RES bool ChannelTypeFeatures_requires_anchors_nonzero_fee_htlc_tx(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
46170
46171 /**
46172  * Set this feature as optional.
46173  */
46174 void InitFeatures_set_anchors_zero_fee_htlc_tx_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
46175
46176 /**
46177  * Set this feature as required.
46178  */
46179 void InitFeatures_set_anchors_zero_fee_htlc_tx_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
46180
46181 /**
46182  * Checks if this feature is supported.
46183  */
46184 MUST_USE_RES bool InitFeatures_supports_anchors_zero_fee_htlc_tx(const struct LDKInitFeatures *NONNULL_PTR this_arg);
46185
46186 /**
46187  * Set this feature as optional.
46188  */
46189 void NodeFeatures_set_anchors_zero_fee_htlc_tx_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
46190
46191 /**
46192  * Set this feature as required.
46193  */
46194 void NodeFeatures_set_anchors_zero_fee_htlc_tx_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
46195
46196 /**
46197  * Checks if this feature is supported.
46198  */
46199 MUST_USE_RES bool NodeFeatures_supports_anchors_zero_fee_htlc_tx(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
46200
46201 /**
46202  * Set this feature as optional.
46203  */
46204 void ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_optional(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
46205
46206 /**
46207  * Set this feature as required.
46208  */
46209 void ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_required(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
46210
46211 /**
46212  * Checks if this feature is supported.
46213  */
46214 MUST_USE_RES bool ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
46215
46216 /**
46217  * Checks if this feature is required.
46218  */
46219 MUST_USE_RES bool InitFeatures_requires_anchors_zero_fee_htlc_tx(const struct LDKInitFeatures *NONNULL_PTR this_arg);
46220
46221 /**
46222  * Checks if this feature is required.
46223  */
46224 MUST_USE_RES bool NodeFeatures_requires_anchors_zero_fee_htlc_tx(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
46225
46226 /**
46227  * Checks if this feature is required.
46228  */
46229 MUST_USE_RES bool ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
46230
46231 /**
46232  * Set this feature as optional.
46233  */
46234 void InitFeatures_set_route_blinding_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
46235
46236 /**
46237  * Set this feature as required.
46238  */
46239 void InitFeatures_set_route_blinding_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
46240
46241 /**
46242  * Checks if this feature is supported.
46243  */
46244 MUST_USE_RES bool InitFeatures_supports_route_blinding(const struct LDKInitFeatures *NONNULL_PTR this_arg);
46245
46246 /**
46247  * Set this feature as optional.
46248  */
46249 void NodeFeatures_set_route_blinding_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
46250
46251 /**
46252  * Set this feature as required.
46253  */
46254 void NodeFeatures_set_route_blinding_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
46255
46256 /**
46257  * Checks if this feature is supported.
46258  */
46259 MUST_USE_RES bool NodeFeatures_supports_route_blinding(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
46260
46261 /**
46262  * Checks if this feature is required.
46263  */
46264 MUST_USE_RES bool InitFeatures_requires_route_blinding(const struct LDKInitFeatures *NONNULL_PTR this_arg);
46265
46266 /**
46267  * Checks if this feature is required.
46268  */
46269 MUST_USE_RES bool NodeFeatures_requires_route_blinding(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
46270
46271 /**
46272  * Set this feature as optional.
46273  */
46274 void InitFeatures_set_shutdown_any_segwit_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
46275
46276 /**
46277  * Set this feature as required.
46278  */
46279 void InitFeatures_set_shutdown_any_segwit_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
46280
46281 /**
46282  * Checks if this feature is supported.
46283  */
46284 MUST_USE_RES bool InitFeatures_supports_shutdown_anysegwit(const struct LDKInitFeatures *NONNULL_PTR this_arg);
46285
46286 /**
46287  * Set this feature as optional.
46288  */
46289 void NodeFeatures_set_shutdown_any_segwit_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
46290
46291 /**
46292  * Set this feature as required.
46293  */
46294 void NodeFeatures_set_shutdown_any_segwit_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
46295
46296 /**
46297  * Checks if this feature is supported.
46298  */
46299 MUST_USE_RES bool NodeFeatures_supports_shutdown_anysegwit(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
46300
46301 /**
46302  * Checks if this feature is required.
46303  */
46304 MUST_USE_RES bool InitFeatures_requires_shutdown_anysegwit(const struct LDKInitFeatures *NONNULL_PTR this_arg);
46305
46306 /**
46307  * Checks if this feature is required.
46308  */
46309 MUST_USE_RES bool NodeFeatures_requires_shutdown_anysegwit(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
46310
46311 /**
46312  * Set this feature as optional.
46313  */
46314 void InitFeatures_set_taproot_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
46315
46316 /**
46317  * Set this feature as required.
46318  */
46319 void InitFeatures_set_taproot_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
46320
46321 /**
46322  * Checks if this feature is supported.
46323  */
46324 MUST_USE_RES bool InitFeatures_supports_taproot(const struct LDKInitFeatures *NONNULL_PTR this_arg);
46325
46326 /**
46327  * Set this feature as optional.
46328  */
46329 void NodeFeatures_set_taproot_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
46330
46331 /**
46332  * Set this feature as required.
46333  */
46334 void NodeFeatures_set_taproot_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
46335
46336 /**
46337  * Checks if this feature is supported.
46338  */
46339 MUST_USE_RES bool NodeFeatures_supports_taproot(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
46340
46341 /**
46342  * Set this feature as optional.
46343  */
46344 void ChannelTypeFeatures_set_taproot_optional(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
46345
46346 /**
46347  * Set this feature as required.
46348  */
46349 void ChannelTypeFeatures_set_taproot_required(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
46350
46351 /**
46352  * Checks if this feature is supported.
46353  */
46354 MUST_USE_RES bool ChannelTypeFeatures_supports_taproot(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
46355
46356 /**
46357  * Checks if this feature is required.
46358  */
46359 MUST_USE_RES bool InitFeatures_requires_taproot(const struct LDKInitFeatures *NONNULL_PTR this_arg);
46360
46361 /**
46362  * Checks if this feature is required.
46363  */
46364 MUST_USE_RES bool NodeFeatures_requires_taproot(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
46365
46366 /**
46367  * Checks if this feature is required.
46368  */
46369 MUST_USE_RES bool ChannelTypeFeatures_requires_taproot(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
46370
46371 /**
46372  * Set this feature as optional.
46373  */
46374 void InitFeatures_set_onion_messages_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
46375
46376 /**
46377  * Set this feature as required.
46378  */
46379 void InitFeatures_set_onion_messages_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
46380
46381 /**
46382  * Checks if this feature is supported.
46383  */
46384 MUST_USE_RES bool InitFeatures_supports_onion_messages(const struct LDKInitFeatures *NONNULL_PTR this_arg);
46385
46386 /**
46387  * Set this feature as optional.
46388  */
46389 void NodeFeatures_set_onion_messages_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
46390
46391 /**
46392  * Set this feature as required.
46393  */
46394 void NodeFeatures_set_onion_messages_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
46395
46396 /**
46397  * Checks if this feature is supported.
46398  */
46399 MUST_USE_RES bool NodeFeatures_supports_onion_messages(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
46400
46401 /**
46402  * Checks if this feature is required.
46403  */
46404 MUST_USE_RES bool InitFeatures_requires_onion_messages(const struct LDKInitFeatures *NONNULL_PTR this_arg);
46405
46406 /**
46407  * Checks if this feature is required.
46408  */
46409 MUST_USE_RES bool NodeFeatures_requires_onion_messages(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
46410
46411 /**
46412  * Set this feature as optional.
46413  */
46414 void InitFeatures_set_channel_type_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
46415
46416 /**
46417  * Set this feature as required.
46418  */
46419 void InitFeatures_set_channel_type_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
46420
46421 /**
46422  * Checks if this feature is supported.
46423  */
46424 MUST_USE_RES bool InitFeatures_supports_channel_type(const struct LDKInitFeatures *NONNULL_PTR this_arg);
46425
46426 /**
46427  * Set this feature as optional.
46428  */
46429 void NodeFeatures_set_channel_type_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
46430
46431 /**
46432  * Set this feature as required.
46433  */
46434 void NodeFeatures_set_channel_type_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
46435
46436 /**
46437  * Checks if this feature is supported.
46438  */
46439 MUST_USE_RES bool NodeFeatures_supports_channel_type(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
46440
46441 /**
46442  * Checks if this feature is required.
46443  */
46444 MUST_USE_RES bool InitFeatures_requires_channel_type(const struct LDKInitFeatures *NONNULL_PTR this_arg);
46445
46446 /**
46447  * Checks if this feature is required.
46448  */
46449 MUST_USE_RES bool NodeFeatures_requires_channel_type(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
46450
46451 /**
46452  * Set this feature as optional.
46453  */
46454 void InitFeatures_set_scid_privacy_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
46455
46456 /**
46457  * Set this feature as required.
46458  */
46459 void InitFeatures_set_scid_privacy_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
46460
46461 /**
46462  * Checks if this feature is supported.
46463  */
46464 MUST_USE_RES bool InitFeatures_supports_scid_privacy(const struct LDKInitFeatures *NONNULL_PTR this_arg);
46465
46466 /**
46467  * Set this feature as optional.
46468  */
46469 void NodeFeatures_set_scid_privacy_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
46470
46471 /**
46472  * Set this feature as required.
46473  */
46474 void NodeFeatures_set_scid_privacy_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
46475
46476 /**
46477  * Checks if this feature is supported.
46478  */
46479 MUST_USE_RES bool NodeFeatures_supports_scid_privacy(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
46480
46481 /**
46482  * Set this feature as optional.
46483  */
46484 void ChannelTypeFeatures_set_scid_privacy_optional(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
46485
46486 /**
46487  * Set this feature as required.
46488  */
46489 void ChannelTypeFeatures_set_scid_privacy_required(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
46490
46491 /**
46492  * Checks if this feature is supported.
46493  */
46494 MUST_USE_RES bool ChannelTypeFeatures_supports_scid_privacy(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
46495
46496 /**
46497  * Checks if this feature is required.
46498  */
46499 MUST_USE_RES bool InitFeatures_requires_scid_privacy(const struct LDKInitFeatures *NONNULL_PTR this_arg);
46500
46501 /**
46502  * Checks if this feature is required.
46503  */
46504 MUST_USE_RES bool NodeFeatures_requires_scid_privacy(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
46505
46506 /**
46507  * Checks if this feature is required.
46508  */
46509 MUST_USE_RES bool ChannelTypeFeatures_requires_scid_privacy(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
46510
46511 /**
46512  * Set this feature as optional.
46513  */
46514 void Bolt11InvoiceFeatures_set_payment_metadata_optional(struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg);
46515
46516 /**
46517  * Set this feature as required.
46518  */
46519 void Bolt11InvoiceFeatures_set_payment_metadata_required(struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg);
46520
46521 /**
46522  * Checks if this feature is supported.
46523  */
46524 MUST_USE_RES bool Bolt11InvoiceFeatures_supports_payment_metadata(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg);
46525
46526 /**
46527  * Checks if this feature is required.
46528  */
46529 MUST_USE_RES bool Bolt11InvoiceFeatures_requires_payment_metadata(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg);
46530
46531 /**
46532  * Set this feature as optional.
46533  */
46534 void InitFeatures_set_zero_conf_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
46535
46536 /**
46537  * Set this feature as required.
46538  */
46539 void InitFeatures_set_zero_conf_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
46540
46541 /**
46542  * Checks if this feature is supported.
46543  */
46544 MUST_USE_RES bool InitFeatures_supports_zero_conf(const struct LDKInitFeatures *NONNULL_PTR this_arg);
46545
46546 /**
46547  * Set this feature as optional.
46548  */
46549 void NodeFeatures_set_zero_conf_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
46550
46551 /**
46552  * Set this feature as required.
46553  */
46554 void NodeFeatures_set_zero_conf_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
46555
46556 /**
46557  * Checks if this feature is supported.
46558  */
46559 MUST_USE_RES bool NodeFeatures_supports_zero_conf(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
46560
46561 /**
46562  * Set this feature as optional.
46563  */
46564 void ChannelTypeFeatures_set_zero_conf_optional(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
46565
46566 /**
46567  * Set this feature as required.
46568  */
46569 void ChannelTypeFeatures_set_zero_conf_required(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
46570
46571 /**
46572  * Checks if this feature is supported.
46573  */
46574 MUST_USE_RES bool ChannelTypeFeatures_supports_zero_conf(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
46575
46576 /**
46577  * Checks if this feature is required.
46578  */
46579 MUST_USE_RES bool InitFeatures_requires_zero_conf(const struct LDKInitFeatures *NONNULL_PTR this_arg);
46580
46581 /**
46582  * Checks if this feature is required.
46583  */
46584 MUST_USE_RES bool NodeFeatures_requires_zero_conf(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
46585
46586 /**
46587  * Checks if this feature is required.
46588  */
46589 MUST_USE_RES bool ChannelTypeFeatures_requires_zero_conf(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
46590
46591 /**
46592  * Set this feature as optional.
46593  */
46594 void NodeFeatures_set_keysend_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
46595
46596 /**
46597  * Set this feature as required.
46598  */
46599 void NodeFeatures_set_keysend_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
46600
46601 /**
46602  * Checks if this feature is supported.
46603  */
46604 MUST_USE_RES bool NodeFeatures_supports_keysend(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
46605
46606 /**
46607  * Checks if this feature is required.
46608  */
46609 MUST_USE_RES bool NodeFeatures_requires_keysend(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
46610
46611 /**
46612  * Set this feature as optional.
46613  */
46614 void InitFeatures_set_trampoline_routing_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
46615
46616 /**
46617  * Set this feature as required.
46618  */
46619 void InitFeatures_set_trampoline_routing_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
46620
46621 /**
46622  * Checks if this feature is supported.
46623  */
46624 MUST_USE_RES bool InitFeatures_supports_trampoline_routing(const struct LDKInitFeatures *NONNULL_PTR this_arg);
46625
46626 /**
46627  * Set this feature as optional.
46628  */
46629 void NodeFeatures_set_trampoline_routing_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
46630
46631 /**
46632  * Set this feature as required.
46633  */
46634 void NodeFeatures_set_trampoline_routing_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
46635
46636 /**
46637  * Checks if this feature is supported.
46638  */
46639 MUST_USE_RES bool NodeFeatures_supports_trampoline_routing(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
46640
46641 /**
46642  * Set this feature as optional.
46643  */
46644 void Bolt11InvoiceFeatures_set_trampoline_routing_optional(struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg);
46645
46646 /**
46647  * Set this feature as required.
46648  */
46649 void Bolt11InvoiceFeatures_set_trampoline_routing_required(struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg);
46650
46651 /**
46652  * Checks if this feature is supported.
46653  */
46654 MUST_USE_RES bool Bolt11InvoiceFeatures_supports_trampoline_routing(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg);
46655
46656 /**
46657  * Checks if this feature is required.
46658  */
46659 MUST_USE_RES bool InitFeatures_requires_trampoline_routing(const struct LDKInitFeatures *NONNULL_PTR this_arg);
46660
46661 /**
46662  * Checks if this feature is required.
46663  */
46664 MUST_USE_RES bool NodeFeatures_requires_trampoline_routing(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
46665
46666 /**
46667  * Checks if this feature is required.
46668  */
46669 MUST_USE_RES bool Bolt11InvoiceFeatures_requires_trampoline_routing(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg);
46670
46671 /**
46672  * Frees any resources used by the ShutdownScript, if is_owned is set and inner is non-NULL.
46673  */
46674 void ShutdownScript_free(struct LDKShutdownScript this_obj);
46675
46676 /**
46677  * Creates a copy of the ShutdownScript
46678  */
46679 struct LDKShutdownScript ShutdownScript_clone(const struct LDKShutdownScript *NONNULL_PTR orig);
46680
46681 /**
46682  * Checks if two ShutdownScripts contain equal inner contents.
46683  * This ignores pointers and is_owned flags and looks at the values in fields.
46684  * Two objects with NULL inner values will be considered "equal" here.
46685  */
46686 bool ShutdownScript_eq(const struct LDKShutdownScript *NONNULL_PTR a, const struct LDKShutdownScript *NONNULL_PTR b);
46687
46688 /**
46689  * Frees any resources used by the InvalidShutdownScript, if is_owned is set and inner is non-NULL.
46690  */
46691 void InvalidShutdownScript_free(struct LDKInvalidShutdownScript this_obj);
46692
46693 /**
46694  * The script that did not meet the requirements from [BOLT #2].
46695  *
46696  * [BOLT #2]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md
46697  */
46698 struct LDKCVec_u8Z InvalidShutdownScript_get_script(const struct LDKInvalidShutdownScript *NONNULL_PTR this_ptr);
46699
46700 /**
46701  * The script that did not meet the requirements from [BOLT #2].
46702  *
46703  * [BOLT #2]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md
46704  */
46705 void InvalidShutdownScript_set_script(struct LDKInvalidShutdownScript *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
46706
46707 /**
46708  * Constructs a new InvalidShutdownScript given each field
46709  */
46710 MUST_USE_RES struct LDKInvalidShutdownScript InvalidShutdownScript_new(struct LDKCVec_u8Z script_arg);
46711
46712 /**
46713  * Creates a copy of the InvalidShutdownScript
46714  */
46715 struct LDKInvalidShutdownScript InvalidShutdownScript_clone(const struct LDKInvalidShutdownScript *NONNULL_PTR orig);
46716
46717 /**
46718  * Serialize the ShutdownScript object into a byte array which can be read by ShutdownScript_read
46719  */
46720 struct LDKCVec_u8Z ShutdownScript_write(const struct LDKShutdownScript *NONNULL_PTR obj);
46721
46722 /**
46723  * Read a ShutdownScript from a byte array, created by ShutdownScript_write
46724  */
46725 struct LDKCResult_ShutdownScriptDecodeErrorZ ShutdownScript_read(struct LDKu8slice ser);
46726
46727 /**
46728  * Generates a P2WPKH script pubkey from the given [`WPubkeyHash`].
46729  */
46730 MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2wpkh(const uint8_t (*pubkey_hash)[20]);
46731
46732 /**
46733  * Generates a P2WSH script pubkey from the given [`WScriptHash`].
46734  */
46735 MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2wsh(const uint8_t (*script_hash)[32]);
46736
46737 /**
46738  * Generates a witness script pubkey from the given segwit version and program.
46739  *
46740  * Note for version-zero witness scripts you must use [`ShutdownScript::new_p2wpkh`] or
46741  * [`ShutdownScript::new_p2wsh`] instead.
46742  *
46743  * # Errors
46744  *
46745  * This function may return an error if `program` is invalid for the segwit `version`.
46746  */
46747 MUST_USE_RES struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ ShutdownScript_new_witness_program(struct LDKWitnessProgram witness_program);
46748
46749 /**
46750  * Converts the shutdown script into the underlying [`ScriptBuf`].
46751  */
46752 MUST_USE_RES struct LDKCVec_u8Z ShutdownScript_into_inner(struct LDKShutdownScript this_arg);
46753
46754 /**
46755  * Returns the [`PublicKey`] used for a P2WPKH shutdown script if constructed directly from it.
46756  *
46757  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
46758  */
46759 MUST_USE_RES struct LDKPublicKey ShutdownScript_as_legacy_pubkey(const struct LDKShutdownScript *NONNULL_PTR this_arg);
46760
46761 /**
46762  * Returns whether the shutdown script is compatible with the features as defined by BOLT #2.
46763  *
46764  * Specifically, checks for compliance with feature `option_shutdown_anysegwit`.
46765  */
46766 MUST_USE_RES bool ShutdownScript_is_compatible(const struct LDKShutdownScript *NONNULL_PTR this_arg, const struct LDKInitFeatures *NONNULL_PTR features);
46767
46768 /**
46769  * Frees any resources used by the ChannelId, if is_owned is set and inner is non-NULL.
46770  */
46771 void ChannelId_free(struct LDKChannelId this_obj);
46772
46773 const uint8_t (*ChannelId_get_a(const struct LDKChannelId *NONNULL_PTR this_ptr))[32];
46774
46775 void ChannelId_set_a(struct LDKChannelId *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
46776
46777 /**
46778  * Constructs a new ChannelId given each field
46779  */
46780 MUST_USE_RES struct LDKChannelId ChannelId_new(struct LDKThirtyTwoBytes a_arg);
46781
46782 /**
46783  * Creates a copy of the ChannelId
46784  */
46785 struct LDKChannelId ChannelId_clone(const struct LDKChannelId *NONNULL_PTR orig);
46786
46787 /**
46788  * Checks if two ChannelIds contain equal inner contents.
46789  * This ignores pointers and is_owned flags and looks at the values in fields.
46790  * Two objects with NULL inner values will be considered "equal" here.
46791  */
46792 bool ChannelId_eq(const struct LDKChannelId *NONNULL_PTR a, const struct LDKChannelId *NONNULL_PTR b);
46793
46794 /**
46795  * Generates a non-cryptographic 64-bit hash of the ChannelId.
46796  */
46797 uint64_t ChannelId_hash(const struct LDKChannelId *NONNULL_PTR o);
46798
46799 /**
46800  * Create _v1_ channel ID based on a funding TX ID and output index
46801  */
46802 MUST_USE_RES struct LDKChannelId ChannelId_v1_from_funding_txid(const uint8_t (*txid)[32], uint16_t output_index);
46803
46804 /**
46805  * Create _v1_ channel ID from a funding tx outpoint
46806  */
46807 MUST_USE_RES struct LDKChannelId ChannelId_v1_from_funding_outpoint(struct LDKOutPoint outpoint);
46808
46809 /**
46810  * Create a _temporary_ channel ID randomly, based on an entropy source.
46811  */
46812 MUST_USE_RES struct LDKChannelId ChannelId_temporary_from_entropy_source(const struct LDKEntropySource *NONNULL_PTR entropy_source);
46813
46814 /**
46815  * Generic constructor; create a new channel ID from the provided data.
46816  * Use a more specific `*_from_*` constructor when possible.
46817  */
46818 MUST_USE_RES struct LDKChannelId ChannelId_from_bytes(struct LDKThirtyTwoBytes data);
46819
46820 /**
46821  * Create a channel ID consisting of all-zeros data (e.g. when uninitialized or a placeholder).
46822  */
46823 MUST_USE_RES struct LDKChannelId ChannelId_new_zero(void);
46824
46825 /**
46826  * Check whether ID is consisting of all zeros (uninitialized)
46827  */
46828 MUST_USE_RES bool ChannelId_is_zero(const struct LDKChannelId *NONNULL_PTR this_arg);
46829
46830 /**
46831  * Create _v2_ channel ID by concatenating the holder revocation basepoint with the counterparty
46832  * revocation basepoint and hashing the result. The basepoints will be concatenated in increasing
46833  * sorted order.
46834  */
46835 MUST_USE_RES struct LDKChannelId ChannelId_v2_from_revocation_basepoints(const struct LDKRevocationBasepoint *NONNULL_PTR ours, const struct LDKRevocationBasepoint *NONNULL_PTR theirs);
46836
46837 /**
46838  * Create temporary _v2_ channel ID by concatenating a zeroed out basepoint with the holder
46839  * revocation basepoint and hashing the result.
46840  */
46841 MUST_USE_RES struct LDKChannelId ChannelId_temporary_v2_from_revocation_basepoint(const struct LDKRevocationBasepoint *NONNULL_PTR our_revocation_basepoint);
46842
46843 /**
46844  * Serialize the ChannelId object into a byte array which can be read by ChannelId_read
46845  */
46846 struct LDKCVec_u8Z ChannelId_write(const struct LDKChannelId *NONNULL_PTR obj);
46847
46848 /**
46849  * Read a ChannelId from a byte array, created by ChannelId_write
46850  */
46851 struct LDKCResult_ChannelIdDecodeErrorZ ChannelId_read(struct LDKu8slice ser);
46852
46853 /**
46854  * Frees any resources used by the Retry
46855  */
46856 void Retry_free(struct LDKRetry this_ptr);
46857
46858 /**
46859  * Creates a copy of the Retry
46860  */
46861 struct LDKRetry Retry_clone(const struct LDKRetry *NONNULL_PTR orig);
46862
46863 /**
46864  * Utility method to constructs a new Attempts-variant Retry
46865  */
46866 struct LDKRetry Retry_attempts(uint32_t a);
46867
46868 /**
46869  * Utility method to constructs a new Timeout-variant Retry
46870  */
46871 struct LDKRetry Retry_timeout(uint64_t a);
46872
46873 /**
46874  * Checks if two Retrys contain equal inner contents.
46875  * This ignores pointers and is_owned flags and looks at the values in fields.
46876  */
46877 bool Retry_eq(const struct LDKRetry *NONNULL_PTR a, const struct LDKRetry *NONNULL_PTR b);
46878
46879 /**
46880  * Generates a non-cryptographic 64-bit hash of the Retry.
46881  */
46882 uint64_t Retry_hash(const struct LDKRetry *NONNULL_PTR o);
46883
46884 /**
46885  * Serialize the Retry object into a byte array which can be read by Retry_read
46886  */
46887 struct LDKCVec_u8Z Retry_write(const struct LDKRetry *NONNULL_PTR obj);
46888
46889 /**
46890  * Read a Retry from a byte array, created by Retry_write
46891  */
46892 struct LDKCResult_RetryDecodeErrorZ Retry_read(struct LDKu8slice ser);
46893
46894 /**
46895  * Creates a copy of the RetryableSendFailure
46896  */
46897 enum LDKRetryableSendFailure RetryableSendFailure_clone(const enum LDKRetryableSendFailure *NONNULL_PTR orig);
46898
46899 /**
46900  * Utility method to constructs a new PaymentExpired-variant RetryableSendFailure
46901  */
46902 enum LDKRetryableSendFailure RetryableSendFailure_payment_expired(void);
46903
46904 /**
46905  * Utility method to constructs a new RouteNotFound-variant RetryableSendFailure
46906  */
46907 enum LDKRetryableSendFailure RetryableSendFailure_route_not_found(void);
46908
46909 /**
46910  * Utility method to constructs a new DuplicatePayment-variant RetryableSendFailure
46911  */
46912 enum LDKRetryableSendFailure RetryableSendFailure_duplicate_payment(void);
46913
46914 /**
46915  * Checks if two RetryableSendFailures contain equal inner contents.
46916  * This ignores pointers and is_owned flags and looks at the values in fields.
46917  */
46918 bool RetryableSendFailure_eq(const enum LDKRetryableSendFailure *NONNULL_PTR a, const enum LDKRetryableSendFailure *NONNULL_PTR b);
46919
46920 /**
46921  * Frees any resources used by the PaymentSendFailure
46922  */
46923 void PaymentSendFailure_free(struct LDKPaymentSendFailure this_ptr);
46924
46925 /**
46926  * Creates a copy of the PaymentSendFailure
46927  */
46928 struct LDKPaymentSendFailure PaymentSendFailure_clone(const struct LDKPaymentSendFailure *NONNULL_PTR orig);
46929
46930 /**
46931  * Utility method to constructs a new ParameterError-variant PaymentSendFailure
46932  */
46933 struct LDKPaymentSendFailure PaymentSendFailure_parameter_error(struct LDKAPIError a);
46934
46935 /**
46936  * Utility method to constructs a new PathParameterError-variant PaymentSendFailure
46937  */
46938 struct LDKPaymentSendFailure PaymentSendFailure_path_parameter_error(struct LDKCVec_CResult_NoneAPIErrorZZ a);
46939
46940 /**
46941  * Utility method to constructs a new AllFailedResendSafe-variant PaymentSendFailure
46942  */
46943 struct LDKPaymentSendFailure PaymentSendFailure_all_failed_resend_safe(struct LDKCVec_APIErrorZ a);
46944
46945 /**
46946  * Utility method to constructs a new DuplicatePayment-variant PaymentSendFailure
46947  */
46948 struct LDKPaymentSendFailure PaymentSendFailure_duplicate_payment(void);
46949
46950 /**
46951  * Utility method to constructs a new PartialFailure-variant PaymentSendFailure
46952  */
46953 struct LDKPaymentSendFailure PaymentSendFailure_partial_failure(struct LDKCVec_CResult_NoneAPIErrorZZ results, struct LDKRouteParameters failed_paths_retry, struct LDKThirtyTwoBytes payment_id);
46954
46955 /**
46956  * Checks if two PaymentSendFailures contain equal inner contents.
46957  * This ignores pointers and is_owned flags and looks at the values in fields.
46958  */
46959 bool PaymentSendFailure_eq(const struct LDKPaymentSendFailure *NONNULL_PTR a, const struct LDKPaymentSendFailure *NONNULL_PTR b);
46960
46961 /**
46962  * Frees any resources used by the ProbeSendFailure
46963  */
46964 void ProbeSendFailure_free(struct LDKProbeSendFailure this_ptr);
46965
46966 /**
46967  * Creates a copy of the ProbeSendFailure
46968  */
46969 struct LDKProbeSendFailure ProbeSendFailure_clone(const struct LDKProbeSendFailure *NONNULL_PTR orig);
46970
46971 /**
46972  * Utility method to constructs a new RouteNotFound-variant ProbeSendFailure
46973  */
46974 struct LDKProbeSendFailure ProbeSendFailure_route_not_found(void);
46975
46976 /**
46977  * Utility method to constructs a new SendingFailed-variant ProbeSendFailure
46978  */
46979 struct LDKProbeSendFailure ProbeSendFailure_sending_failed(struct LDKPaymentSendFailure a);
46980
46981 /**
46982  * Checks if two ProbeSendFailures contain equal inner contents.
46983  * This ignores pointers and is_owned flags and looks at the values in fields.
46984  */
46985 bool ProbeSendFailure_eq(const struct LDKProbeSendFailure *NONNULL_PTR a, const struct LDKProbeSendFailure *NONNULL_PTR b);
46986
46987 /**
46988  * Frees any resources used by the RecipientOnionFields, if is_owned is set and inner is non-NULL.
46989  */
46990 void RecipientOnionFields_free(struct LDKRecipientOnionFields this_obj);
46991
46992 /**
46993  * The [`PaymentSecret`] is an arbitrary 32 bytes provided by the recipient for us to repeat
46994  * in the onion. It is unrelated to `payment_hash` (or [`PaymentPreimage`]) and exists to
46995  * authenticate the sender to the recipient and prevent payment-probing (deanonymization)
46996  * attacks.
46997  *
46998  * If you do not have one, the [`Route`] you pay over must not contain multiple paths as
46999  * multi-path payments require a recipient-provided secret.
47000  *
47001  * Some implementations may reject spontaneous payments with payment secrets, so you may only
47002  * want to provide a secret for a spontaneous payment if MPP is needed and you know your
47003  * recipient will not reject it.
47004  */
47005 struct LDKCOption_ThirtyTwoBytesZ RecipientOnionFields_get_payment_secret(const struct LDKRecipientOnionFields *NONNULL_PTR this_ptr);
47006
47007 /**
47008  * The [`PaymentSecret`] is an arbitrary 32 bytes provided by the recipient for us to repeat
47009  * in the onion. It is unrelated to `payment_hash` (or [`PaymentPreimage`]) and exists to
47010  * authenticate the sender to the recipient and prevent payment-probing (deanonymization)
47011  * attacks.
47012  *
47013  * If you do not have one, the [`Route`] you pay over must not contain multiple paths as
47014  * multi-path payments require a recipient-provided secret.
47015  *
47016  * Some implementations may reject spontaneous payments with payment secrets, so you may only
47017  * want to provide a secret for a spontaneous payment if MPP is needed and you know your
47018  * recipient will not reject it.
47019  */
47020 void RecipientOnionFields_set_payment_secret(struct LDKRecipientOnionFields *NONNULL_PTR this_ptr, struct LDKCOption_ThirtyTwoBytesZ val);
47021
47022 /**
47023  * The payment metadata serves a similar purpose as [`Self::payment_secret`] but is of
47024  * arbitrary length. This gives recipients substantially more flexibility to receive
47025  * additional data.
47026  *
47027  * In LDK, while the [`Self::payment_secret`] is fixed based on an internal authentication
47028  * scheme to authenticate received payments against expected payments and invoices, this field
47029  * is not used in LDK for received payments, and can be used to store arbitrary data in
47030  * invoices which will be received with the payment.
47031  *
47032  * Note that this field was added to the lightning specification more recently than
47033  * [`Self::payment_secret`] and while nearly all lightning senders support secrets, metadata
47034  * may not be supported as universally.
47035  *
47036  * Returns a copy of the field.
47037  */
47038 struct LDKCOption_CVec_u8ZZ RecipientOnionFields_get_payment_metadata(const struct LDKRecipientOnionFields *NONNULL_PTR this_ptr);
47039
47040 /**
47041  * The payment metadata serves a similar purpose as [`Self::payment_secret`] but is of
47042  * arbitrary length. This gives recipients substantially more flexibility to receive
47043  * additional data.
47044  *
47045  * In LDK, while the [`Self::payment_secret`] is fixed based on an internal authentication
47046  * scheme to authenticate received payments against expected payments and invoices, this field
47047  * is not used in LDK for received payments, and can be used to store arbitrary data in
47048  * invoices which will be received with the payment.
47049  *
47050  * Note that this field was added to the lightning specification more recently than
47051  * [`Self::payment_secret`] and while nearly all lightning senders support secrets, metadata
47052  * may not be supported as universally.
47053  */
47054 void RecipientOnionFields_set_payment_metadata(struct LDKRecipientOnionFields *NONNULL_PTR this_ptr, struct LDKCOption_CVec_u8ZZ val);
47055
47056 /**
47057  * Creates a copy of the RecipientOnionFields
47058  */
47059 struct LDKRecipientOnionFields RecipientOnionFields_clone(const struct LDKRecipientOnionFields *NONNULL_PTR orig);
47060
47061 /**
47062  * Checks if two RecipientOnionFieldss contain equal inner contents.
47063  * This ignores pointers and is_owned flags and looks at the values in fields.
47064  * Two objects with NULL inner values will be considered "equal" here.
47065  */
47066 bool RecipientOnionFields_eq(const struct LDKRecipientOnionFields *NONNULL_PTR a, const struct LDKRecipientOnionFields *NONNULL_PTR b);
47067
47068 /**
47069  * Serialize the RecipientOnionFields object into a byte array which can be read by RecipientOnionFields_read
47070  */
47071 struct LDKCVec_u8Z RecipientOnionFields_write(const struct LDKRecipientOnionFields *NONNULL_PTR obj);
47072
47073 /**
47074  * Read a RecipientOnionFields from a byte array, created by RecipientOnionFields_write
47075  */
47076 struct LDKCResult_RecipientOnionFieldsDecodeErrorZ RecipientOnionFields_read(struct LDKu8slice ser);
47077
47078 /**
47079  * Creates a [`RecipientOnionFields`] from only a [`PaymentSecret`]. This is the most common
47080  * set of onion fields for today's BOLT11 invoices - most nodes require a [`PaymentSecret`]
47081  * but do not require or provide any further data.
47082  */
47083 MUST_USE_RES struct LDKRecipientOnionFields RecipientOnionFields_secret_only(struct LDKThirtyTwoBytes payment_secret);
47084
47085 /**
47086  * Creates a new [`RecipientOnionFields`] with no fields. This generally does not create
47087  * payable HTLCs except for single-path spontaneous payments, i.e. this should generally
47088  * only be used for calls to [`ChannelManager::send_spontaneous_payment`]. If you are sending
47089  * a spontaneous MPP this will not work as all MPP require payment secrets; you may
47090  * instead want to use [`RecipientOnionFields::secret_only`].
47091  *
47092  * [`ChannelManager::send_spontaneous_payment`]: super::channelmanager::ChannelManager::send_spontaneous_payment
47093  * [`RecipientOnionFields::secret_only`]: RecipientOnionFields::secret_only
47094  */
47095 MUST_USE_RES struct LDKRecipientOnionFields RecipientOnionFields_spontaneous_empty(void);
47096
47097 /**
47098  * Creates a new [`RecipientOnionFields`] from an existing one, adding custom TLVs. Each
47099  * TLV is provided as a `(u64, Vec<u8>)` for the type number and serialized value
47100  * respectively. TLV type numbers must be unique and within the range
47101  * reserved for custom types, i.e. >= 2^16, otherwise this method will return `Err(())`.
47102  *
47103  * This method will also error for types in the experimental range which have been
47104  * standardized within the protocol, which only includes 5482373484 (keysend) for now.
47105  *
47106  * See [`Self::custom_tlvs`] for more info.
47107  */
47108 MUST_USE_RES struct LDKCResult_RecipientOnionFieldsNoneZ RecipientOnionFields_with_custom_tlvs(struct LDKRecipientOnionFields this_arg, struct LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs);
47109
47110 /**
47111  * Gets the custom TLVs that will be sent or have been received.
47112  *
47113  * Custom TLVs allow sending extra application-specific data with a payment. They provide
47114  * additional flexibility on top of payment metadata, as while other implementations may
47115  * require `payment_metadata` to reflect metadata provided in an invoice, custom TLVs
47116  * do not have this restriction.
47117  *
47118  * Note that if this field is non-empty, it will contain strictly increasing TLVs, each
47119  * represented by a `(u64, Vec<u8>)` for its type number and serialized value respectively.
47120  * This is validated when setting this field using [`Self::with_custom_tlvs`].
47121  */
47122 MUST_USE_RES struct LDKCVec_C2Tuple_u64CVec_u8ZZZ RecipientOnionFields_custom_tlvs(const struct LDKRecipientOnionFields *NONNULL_PTR this_arg);
47123
47124 /**
47125  * Calls the free function if one is set
47126  */
47127 void CustomMessageReader_free(struct LDKCustomMessageReader this_ptr);
47128
47129 /**
47130  * Creates a copy of a Type
47131  */
47132 struct LDKType Type_clone(const struct LDKType *NONNULL_PTR orig);
47133
47134 /**
47135  * Calls the free function if one is set
47136  */
47137 void Type_free(struct LDKType this_ptr);
47138
47139 /**
47140  * Frees any resources used by the OfferId, if is_owned is set and inner is non-NULL.
47141  */
47142 void OfferId_free(struct LDKOfferId this_obj);
47143
47144 const uint8_t (*OfferId_get_a(const struct LDKOfferId *NONNULL_PTR this_ptr))[32];
47145
47146 void OfferId_set_a(struct LDKOfferId *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
47147
47148 /**
47149  * Constructs a new OfferId given each field
47150  */
47151 MUST_USE_RES struct LDKOfferId OfferId_new(struct LDKThirtyTwoBytes a_arg);
47152
47153 /**
47154  * Creates a copy of the OfferId
47155  */
47156 struct LDKOfferId OfferId_clone(const struct LDKOfferId *NONNULL_PTR orig);
47157
47158 /**
47159  * Checks if two OfferIds contain equal inner contents.
47160  * This ignores pointers and is_owned flags and looks at the values in fields.
47161  * Two objects with NULL inner values will be considered "equal" here.
47162  */
47163 bool OfferId_eq(const struct LDKOfferId *NONNULL_PTR a, const struct LDKOfferId *NONNULL_PTR b);
47164
47165 /**
47166  * Serialize the OfferId object into a byte array which can be read by OfferId_read
47167  */
47168 struct LDKCVec_u8Z OfferId_write(const struct LDKOfferId *NONNULL_PTR obj);
47169
47170 /**
47171  * Read a OfferId from a byte array, created by OfferId_write
47172  */
47173 struct LDKCResult_OfferIdDecodeErrorZ OfferId_read(struct LDKu8slice ser);
47174
47175 /**
47176  * Frees any resources used by the OfferWithExplicitMetadataBuilder, if is_owned is set and inner is non-NULL.
47177  */
47178 void OfferWithExplicitMetadataBuilder_free(struct LDKOfferWithExplicitMetadataBuilder this_obj);
47179
47180 /**
47181  * Creates a copy of the OfferWithExplicitMetadataBuilder
47182  */
47183 struct LDKOfferWithExplicitMetadataBuilder OfferWithExplicitMetadataBuilder_clone(const struct LDKOfferWithExplicitMetadataBuilder *NONNULL_PTR orig);
47184
47185 /**
47186  * Frees any resources used by the OfferWithDerivedMetadataBuilder, if is_owned is set and inner is non-NULL.
47187  */
47188 void OfferWithDerivedMetadataBuilder_free(struct LDKOfferWithDerivedMetadataBuilder this_obj);
47189
47190 /**
47191  * Creates a copy of the OfferWithDerivedMetadataBuilder
47192  */
47193 struct LDKOfferWithDerivedMetadataBuilder OfferWithDerivedMetadataBuilder_clone(const struct LDKOfferWithDerivedMetadataBuilder *NONNULL_PTR orig);
47194
47195 /**
47196  * Creates a new builder for an offer using the [`Offer::signing_pubkey`] for signing invoices.
47197  * The associated secret key must be remembered while the offer is valid.
47198  *
47199  * Use a different pubkey per offer to avoid correlating offers.
47200  *
47201  * # Note
47202  *
47203  * If constructing an [`Offer`] for use with a [`ChannelManager`], use
47204  * [`ChannelManager::create_offer_builder`] instead of [`OfferBuilder::new`].
47205  *
47206  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
47207  * [`ChannelManager::create_offer_builder`]: crate::ln::channelmanager::ChannelManager::create_offer_builder
47208  */
47209 MUST_USE_RES struct LDKOfferWithExplicitMetadataBuilder OfferWithExplicitMetadataBuilder_new(struct LDKPublicKey signing_pubkey);
47210
47211 /**
47212  * Sets the [`Offer::metadata`] to the given bytes.
47213  *
47214  * Successive calls to this method will override the previous setting.
47215  */
47216 MUST_USE_RES struct LDKCResult_NoneBolt12SemanticErrorZ OfferWithExplicitMetadataBuilder_metadata(struct LDKOfferWithExplicitMetadataBuilder this_arg, struct LDKCVec_u8Z metadata);
47217
47218 /**
47219  * Adds the chain hash of the given [`Network`] to [`Offer::chains`]. If not called,
47220  * the chain hash of [`Network::Bitcoin`] is assumed to be the only one supported.
47221  *
47222  * See [`Offer::chains`] on how this relates to the payment currency.
47223  *
47224  * Successive calls to this method will add another chain hash.
47225  */
47226 MUST_USE_RES void OfferWithExplicitMetadataBuilder_chain(struct LDKOfferWithExplicitMetadataBuilder this_arg, enum LDKNetwork network);
47227
47228 /**
47229  * Sets the [`Offer::amount`] as an [`Amount::Bitcoin`].
47230  *
47231  * Successive calls to this method will override the previous setting.
47232  */
47233 MUST_USE_RES void OfferWithExplicitMetadataBuilder_amount_msats(struct LDKOfferWithExplicitMetadataBuilder this_arg, uint64_t amount_msats);
47234
47235 /**
47236  * Sets the [`Offer::absolute_expiry`] as seconds since the Unix epoch. Any expiry that has
47237  * already passed is valid and can be checked for using [`Offer::is_expired`].
47238  *
47239  * Successive calls to this method will override the previous setting.
47240  */
47241 MUST_USE_RES void OfferWithExplicitMetadataBuilder_absolute_expiry(struct LDKOfferWithExplicitMetadataBuilder this_arg, uint64_t absolute_expiry);
47242
47243 /**
47244  * Sets the [`Offer::description`].
47245  *
47246  * Successive calls to this method will override the previous setting.
47247  */
47248 MUST_USE_RES void OfferWithExplicitMetadataBuilder_description(struct LDKOfferWithExplicitMetadataBuilder this_arg, struct LDKStr description);
47249
47250 /**
47251  * Sets the [`Offer::issuer`].
47252  *
47253  * Successive calls to this method will override the previous setting.
47254  */
47255 MUST_USE_RES void OfferWithExplicitMetadataBuilder_issuer(struct LDKOfferWithExplicitMetadataBuilder this_arg, struct LDKStr issuer);
47256
47257 /**
47258  * Adds a blinded path to [`Offer::paths`]. Must include at least one path if only connected by
47259  * private channels or if [`Offer::signing_pubkey`] is not a public node id.
47260  *
47261  * Successive calls to this method will add another blinded path. Caller is responsible for not
47262  * adding duplicate paths.
47263  */
47264 MUST_USE_RES void OfferWithExplicitMetadataBuilder_path(struct LDKOfferWithExplicitMetadataBuilder this_arg, struct LDKBlindedPath path);
47265
47266 /**
47267  * Sets the quantity of items for [`Offer::supported_quantity`]. If not called, defaults to
47268  * [`Quantity::One`].
47269  *
47270  * Successive calls to this method will override the previous setting.
47271  */
47272 MUST_USE_RES void OfferWithExplicitMetadataBuilder_supported_quantity(struct LDKOfferWithExplicitMetadataBuilder this_arg, struct LDKQuantity quantity);
47273
47274 /**
47275  * Builds an [`Offer`] from the builder's settings.
47276  */
47277 MUST_USE_RES struct LDKCResult_OfferBolt12SemanticErrorZ OfferWithExplicitMetadataBuilder_build(struct LDKOfferWithExplicitMetadataBuilder this_arg);
47278
47279 /**
47280  * Similar to [`OfferBuilder::new`] except, if [`OfferBuilder::path`] is called, the signing
47281  * pubkey is derived from the given [`ExpandedKey`] and [`EntropySource`]. This provides
47282  * recipient privacy by using a different signing pubkey for each offer. Otherwise, the
47283  * provided `node_id` is used for the signing pubkey.
47284  *
47285  * Also, sets the metadata when [`OfferBuilder::build`] is called such that it can be used by
47286  * [`InvoiceRequest::verify`] to determine if the request was produced for the offer given an
47287  * [`ExpandedKey`].
47288  *
47289  * [`InvoiceRequest::verify`]: crate::offers::invoice_request::InvoiceRequest::verify
47290  * [`ExpandedKey`]: crate::ln::inbound_payment::ExpandedKey
47291  */
47292 MUST_USE_RES struct LDKOfferWithDerivedMetadataBuilder OfferWithDerivedMetadataBuilder_deriving_signing_pubkey(struct LDKPublicKey node_id, const struct LDKExpandedKey *NONNULL_PTR expanded_key, struct LDKEntropySource entropy_source);
47293
47294 /**
47295  * Adds the chain hash of the given [`Network`] to [`Offer::chains`]. If not called,
47296  * the chain hash of [`Network::Bitcoin`] is assumed to be the only one supported.
47297  *
47298  * See [`Offer::chains`] on how this relates to the payment currency.
47299  *
47300  * Successive calls to this method will add another chain hash.
47301  */
47302 MUST_USE_RES void OfferWithDerivedMetadataBuilder_chain(struct LDKOfferWithDerivedMetadataBuilder this_arg, enum LDKNetwork network);
47303
47304 /**
47305  * Sets the [`Offer::amount`] as an [`Amount::Bitcoin`].
47306  *
47307  * Successive calls to this method will override the previous setting.
47308  */
47309 MUST_USE_RES void OfferWithDerivedMetadataBuilder_amount_msats(struct LDKOfferWithDerivedMetadataBuilder this_arg, uint64_t amount_msats);
47310
47311 /**
47312  * Sets the [`Offer::absolute_expiry`] as seconds since the Unix epoch. Any expiry that has
47313  * already passed is valid and can be checked for using [`Offer::is_expired`].
47314  *
47315  * Successive calls to this method will override the previous setting.
47316  */
47317 MUST_USE_RES void OfferWithDerivedMetadataBuilder_absolute_expiry(struct LDKOfferWithDerivedMetadataBuilder this_arg, uint64_t absolute_expiry);
47318
47319 /**
47320  * Sets the [`Offer::description`].
47321  *
47322  * Successive calls to this method will override the previous setting.
47323  */
47324 MUST_USE_RES void OfferWithDerivedMetadataBuilder_description(struct LDKOfferWithDerivedMetadataBuilder this_arg, struct LDKStr description);
47325
47326 /**
47327  * Sets the [`Offer::issuer`].
47328  *
47329  * Successive calls to this method will override the previous setting.
47330  */
47331 MUST_USE_RES void OfferWithDerivedMetadataBuilder_issuer(struct LDKOfferWithDerivedMetadataBuilder this_arg, struct LDKStr issuer);
47332
47333 /**
47334  * Adds a blinded path to [`Offer::paths`]. Must include at least one path if only connected by
47335  * private channels or if [`Offer::signing_pubkey`] is not a public node id.
47336  *
47337  * Successive calls to this method will add another blinded path. Caller is responsible for not
47338  * adding duplicate paths.
47339  */
47340 MUST_USE_RES void OfferWithDerivedMetadataBuilder_path(struct LDKOfferWithDerivedMetadataBuilder this_arg, struct LDKBlindedPath path);
47341
47342 /**
47343  * Sets the quantity of items for [`Offer::supported_quantity`]. If not called, defaults to
47344  * [`Quantity::One`].
47345  *
47346  * Successive calls to this method will override the previous setting.
47347  */
47348 MUST_USE_RES void OfferWithDerivedMetadataBuilder_supported_quantity(struct LDKOfferWithDerivedMetadataBuilder this_arg, struct LDKQuantity quantity);
47349
47350 /**
47351  * Builds an [`Offer`] from the builder's settings.
47352  */
47353 MUST_USE_RES struct LDKCResult_OfferBolt12SemanticErrorZ OfferWithDerivedMetadataBuilder_build(struct LDKOfferWithDerivedMetadataBuilder this_arg);
47354
47355 /**
47356  * Frees any resources used by the Offer, if is_owned is set and inner is non-NULL.
47357  */
47358 void Offer_free(struct LDKOffer this_obj);
47359
47360 /**
47361  * Creates a copy of the Offer
47362  */
47363 struct LDKOffer Offer_clone(const struct LDKOffer *NONNULL_PTR orig);
47364
47365 /**
47366  * The chains that may be used when paying a requested invoice (e.g., bitcoin mainnet).
47367  * Payments must be denominated in units of the minimal lightning-payable unit (e.g., msats)
47368  * for the selected chain.
47369  */
47370 MUST_USE_RES struct LDKCVec_ThirtyTwoBytesZ Offer_chains(const struct LDKOffer *NONNULL_PTR this_arg);
47371
47372 /**
47373  * Opaque bytes set by the originator. Useful for authentication and validating fields since it
47374  * is reflected in `invoice_request` messages along with all the other fields from the `offer`.
47375  */
47376 MUST_USE_RES struct LDKCOption_CVec_u8ZZ Offer_metadata(const struct LDKOffer *NONNULL_PTR this_arg);
47377
47378 /**
47379  * The minimum amount required for a successful payment of a single item.
47380  */
47381 MUST_USE_RES struct LDKCOption_AmountZ Offer_amount(const struct LDKOffer *NONNULL_PTR this_arg);
47382
47383 /**
47384  * A complete description of the purpose of the payment. Intended to be displayed to the user
47385  * but with the caveat that it has not been verified in any way.
47386  *
47387  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
47388  */
47389 MUST_USE_RES struct LDKPrintableString Offer_description(const struct LDKOffer *NONNULL_PTR this_arg);
47390
47391 /**
47392  * Features pertaining to the offer.
47393  */
47394 MUST_USE_RES struct LDKOfferFeatures Offer_offer_features(const struct LDKOffer *NONNULL_PTR this_arg);
47395
47396 /**
47397  * Duration since the Unix epoch when an invoice should no longer be requested.
47398  *
47399  * If `None`, the offer does not expire.
47400  */
47401 MUST_USE_RES struct LDKCOption_u64Z Offer_absolute_expiry(const struct LDKOffer *NONNULL_PTR this_arg);
47402
47403 /**
47404  * The issuer of the offer, possibly beginning with `user@domain` or `domain`. Intended to be
47405  * displayed to the user but with the caveat that it has not been verified in any way.
47406  *
47407  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
47408  */
47409 MUST_USE_RES struct LDKPrintableString Offer_issuer(const struct LDKOffer *NONNULL_PTR this_arg);
47410
47411 /**
47412  * Paths to the recipient originating from publicly reachable nodes. Blinded paths provide
47413  * recipient privacy by obfuscating its node id.
47414  */
47415 MUST_USE_RES struct LDKCVec_BlindedPathZ Offer_paths(const struct LDKOffer *NONNULL_PTR this_arg);
47416
47417 /**
47418  * The quantity of items supported.
47419  */
47420 MUST_USE_RES struct LDKQuantity Offer_supported_quantity(const struct LDKOffer *NONNULL_PTR this_arg);
47421
47422 /**
47423  * The public key used by the recipient to sign invoices.
47424  *
47425  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
47426  */
47427 MUST_USE_RES struct LDKPublicKey Offer_signing_pubkey(const struct LDKOffer *NONNULL_PTR this_arg);
47428
47429 /**
47430  * Returns the id of the offer.
47431  */
47432 MUST_USE_RES struct LDKOfferId Offer_id(const struct LDKOffer *NONNULL_PTR this_arg);
47433
47434 /**
47435  * Returns whether the given chain is supported by the offer.
47436  */
47437 MUST_USE_RES bool Offer_supports_chain(const struct LDKOffer *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes chain);
47438
47439 /**
47440  * Whether the offer has expired.
47441  */
47442 MUST_USE_RES bool Offer_is_expired(const struct LDKOffer *NONNULL_PTR this_arg);
47443
47444 /**
47445  * Whether the offer has expired given the duration since the Unix epoch.
47446  */
47447 MUST_USE_RES bool Offer_is_expired_no_std(const struct LDKOffer *NONNULL_PTR this_arg, uint64_t duration_since_epoch);
47448
47449 /**
47450  * Returns whether the given quantity is valid for the offer.
47451  */
47452 MUST_USE_RES bool Offer_is_valid_quantity(const struct LDKOffer *NONNULL_PTR this_arg, uint64_t quantity);
47453
47454 /**
47455  * Returns whether a quantity is expected in an [`InvoiceRequest`] for the offer.
47456  *
47457  * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
47458  */
47459 MUST_USE_RES bool Offer_expects_quantity(const struct LDKOffer *NONNULL_PTR this_arg);
47460
47461 /**
47462  * Similar to [`Offer::request_invoice`] except it:
47463  * - derives the [`InvoiceRequest::payer_id`] such that a different key can be used for each
47464  *   request,
47465  * - sets [`InvoiceRequest::payer_metadata`] when [`InvoiceRequestBuilder::build`] is called
47466  *   such that it can be used by [`Bolt12Invoice::verify`] to determine if the invoice was
47467  *   requested using a base [`ExpandedKey`] from which the payer id was derived, and
47468  * - includes the [`PaymentId`] encrypted in [`InvoiceRequest::payer_metadata`] so that it can
47469  *   be used when sending the payment for the requested invoice.
47470  *
47471  * Useful to protect the sender's privacy.
47472  *
47473  * [`InvoiceRequest::payer_id`]: crate::offers::invoice_request::InvoiceRequest::payer_id
47474  * [`InvoiceRequest::payer_metadata`]: crate::offers::invoice_request::InvoiceRequest::payer_metadata
47475  * [`Bolt12Invoice::verify`]: crate::offers::invoice::Bolt12Invoice::verify
47476  * [`ExpandedKey`]: crate::ln::inbound_payment::ExpandedKey
47477  */
47478 MUST_USE_RES struct LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ Offer_request_invoice_deriving_payer_id(const struct LDKOffer *NONNULL_PTR this_arg, const struct LDKExpandedKey *NONNULL_PTR expanded_key, struct LDKEntropySource entropy_source, struct LDKThirtyTwoBytes payment_id);
47479
47480 /**
47481  * Similar to [`Offer::request_invoice_deriving_payer_id`] except uses `payer_id` for the
47482  * [`InvoiceRequest::payer_id`] instead of deriving a different key for each request.
47483  *
47484  * Useful for recurring payments using the same `payer_id` with different invoices.
47485  *
47486  * [`InvoiceRequest::payer_id`]: crate::offers::invoice_request::InvoiceRequest::payer_id
47487  */
47488 MUST_USE_RES struct LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ Offer_request_invoice_deriving_metadata(const struct LDKOffer *NONNULL_PTR this_arg, struct LDKPublicKey payer_id, const struct LDKExpandedKey *NONNULL_PTR expanded_key, struct LDKEntropySource entropy_source, struct LDKThirtyTwoBytes payment_id);
47489
47490 /**
47491  * Creates an [`InvoiceRequestBuilder`] for the offer with the given `metadata` and `payer_id`,
47492  * which will be reflected in the `Bolt12Invoice` response.
47493  *
47494  * The `metadata` is useful for including information about the derivation of `payer_id` such
47495  * that invoice response handling can be stateless. Also serves as payer-provided entropy while
47496  * hashing in the signature calculation.
47497  *
47498  * This should not leak any information such as by using a simple BIP-32 derivation path.
47499  * Otherwise, payments may be correlated.
47500  *
47501  * Errors if the offer contains unknown required features.
47502  *
47503  * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
47504  */
47505 MUST_USE_RES struct LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ Offer_request_invoice(const struct LDKOffer *NONNULL_PTR this_arg, struct LDKCVec_u8Z metadata, struct LDKPublicKey payer_id);
47506
47507 /**
47508  * Generates a non-cryptographic 64-bit hash of the Offer.
47509  */
47510 uint64_t Offer_hash(const struct LDKOffer *NONNULL_PTR o);
47511
47512 /**
47513  * Serialize the Offer object into a byte array which can be read by Offer_read
47514  */
47515 struct LDKCVec_u8Z Offer_write(const struct LDKOffer *NONNULL_PTR obj);
47516
47517 /**
47518  * Frees any resources used by the Amount
47519  */
47520 void Amount_free(struct LDKAmount this_ptr);
47521
47522 /**
47523  * Creates a copy of the Amount
47524  */
47525 struct LDKAmount Amount_clone(const struct LDKAmount *NONNULL_PTR orig);
47526
47527 /**
47528  * Utility method to constructs a new Bitcoin-variant Amount
47529  */
47530 struct LDKAmount Amount_bitcoin(uint64_t amount_msats);
47531
47532 /**
47533  * Utility method to constructs a new Currency-variant Amount
47534  */
47535 struct LDKAmount Amount_currency(struct LDKThreeBytes iso4217_code, uint64_t amount);
47536
47537 /**
47538  * Frees any resources used by the Quantity
47539  */
47540 void Quantity_free(struct LDKQuantity this_ptr);
47541
47542 /**
47543  * Creates a copy of the Quantity
47544  */
47545 struct LDKQuantity Quantity_clone(const struct LDKQuantity *NONNULL_PTR orig);
47546
47547 /**
47548  * Utility method to constructs a new Bounded-variant Quantity
47549  */
47550 struct LDKQuantity Quantity_bounded(uint64_t a);
47551
47552 /**
47553  * Utility method to constructs a new Unbounded-variant Quantity
47554  */
47555 struct LDKQuantity Quantity_unbounded(void);
47556
47557 /**
47558  * Utility method to constructs a new One-variant Quantity
47559  */
47560 struct LDKQuantity Quantity_one(void);
47561
47562 /**
47563  * Read a Offer object from a string
47564  */
47565 struct LDKCResult_OfferBolt12ParseErrorZ Offer_from_str(struct LDKStr s);
47566
47567 /**
47568  * Frees any resources used by the InvoiceWithExplicitSigningPubkeyBuilder, if is_owned is set and inner is non-NULL.
47569  */
47570 void InvoiceWithExplicitSigningPubkeyBuilder_free(struct LDKInvoiceWithExplicitSigningPubkeyBuilder this_obj);
47571
47572 /**
47573  * Frees any resources used by the InvoiceWithDerivedSigningPubkeyBuilder, if is_owned is set and inner is non-NULL.
47574  */
47575 void InvoiceWithDerivedSigningPubkeyBuilder_free(struct LDKInvoiceWithDerivedSigningPubkeyBuilder this_obj);
47576
47577 /**
47578  * Builds an unsigned [`Bolt12Invoice`] after checking for valid semantics. It can be signed by
47579  * [`UnsignedBolt12Invoice::sign`].
47580  */
47581 MUST_USE_RES struct LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ InvoiceWithExplicitSigningPubkeyBuilder_build(struct LDKInvoiceWithExplicitSigningPubkeyBuilder this_arg);
47582
47583 /**
47584  * Sets the [`Bolt12Invoice::relative_expiry`] as seconds since [`Bolt12Invoice::created_at`].
47585  * Any expiry that has already passed is valid and can be checked for using
47586  * [`Bolt12Invoice::is_expired`].
47587  *
47588  * Successive calls to this method will override the previous setting.
47589  */
47590 MUST_USE_RES void InvoiceWithExplicitSigningPubkeyBuilder_relative_expiry(struct LDKInvoiceWithExplicitSigningPubkeyBuilder this_arg, uint32_t relative_expiry_secs);
47591
47592 /**
47593  * Adds a P2WSH address to [`Bolt12Invoice::fallbacks`].
47594  *
47595  * Successive calls to this method will add another address. Caller is responsible for not
47596  * adding duplicate addresses and only calling if capable of receiving to P2WSH addresses.
47597  */
47598 MUST_USE_RES void InvoiceWithExplicitSigningPubkeyBuilder_fallback_v0_p2wsh(struct LDKInvoiceWithExplicitSigningPubkeyBuilder this_arg, const uint8_t (*script_hash)[32]);
47599
47600 /**
47601  * Adds a P2WPKH address to [`Bolt12Invoice::fallbacks`].
47602  *
47603  * Successive calls to this method will add another address. Caller is responsible for not
47604  * adding duplicate addresses and only calling if capable of receiving to P2WPKH addresses.
47605  */
47606 MUST_USE_RES void InvoiceWithExplicitSigningPubkeyBuilder_fallback_v0_p2wpkh(struct LDKInvoiceWithExplicitSigningPubkeyBuilder this_arg, const uint8_t (*pubkey_hash)[20]);
47607
47608 /**
47609  * Adds a P2TR address to [`Bolt12Invoice::fallbacks`].
47610  *
47611  * Successive calls to this method will add another address. Caller is responsible for not
47612  * adding duplicate addresses and only calling if capable of receiving to P2TR addresses.
47613  */
47614 MUST_USE_RES void InvoiceWithExplicitSigningPubkeyBuilder_fallback_v1_p2tr_tweaked(struct LDKInvoiceWithExplicitSigningPubkeyBuilder this_arg, struct LDKTweakedPublicKey output_key);
47615
47616 /**
47617  * Sets [`Bolt12Invoice::invoice_features`] to indicate MPP may be used. Otherwise, MPP is
47618  * disallowed.
47619  */
47620 MUST_USE_RES void InvoiceWithExplicitSigningPubkeyBuilder_allow_mpp(struct LDKInvoiceWithExplicitSigningPubkeyBuilder this_arg);
47621
47622 /**
47623  * Builds a signed [`Bolt12Invoice`] after checking for valid semantics.
47624  */
47625 MUST_USE_RES struct LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ InvoiceWithDerivedSigningPubkeyBuilder_build_and_sign(struct LDKInvoiceWithDerivedSigningPubkeyBuilder this_arg);
47626
47627 /**
47628  * Sets the [`Bolt12Invoice::relative_expiry`] as seconds since [`Bolt12Invoice::created_at`].
47629  * Any expiry that has already passed is valid and can be checked for using
47630  * [`Bolt12Invoice::is_expired`].
47631  *
47632  * Successive calls to this method will override the previous setting.
47633  */
47634 MUST_USE_RES void InvoiceWithDerivedSigningPubkeyBuilder_relative_expiry(struct LDKInvoiceWithDerivedSigningPubkeyBuilder this_arg, uint32_t relative_expiry_secs);
47635
47636 /**
47637  * Adds a P2WSH address to [`Bolt12Invoice::fallbacks`].
47638  *
47639  * Successive calls to this method will add another address. Caller is responsible for not
47640  * adding duplicate addresses and only calling if capable of receiving to P2WSH addresses.
47641  */
47642 MUST_USE_RES void InvoiceWithDerivedSigningPubkeyBuilder_fallback_v0_p2wsh(struct LDKInvoiceWithDerivedSigningPubkeyBuilder this_arg, const uint8_t (*script_hash)[32]);
47643
47644 /**
47645  * Adds a P2WPKH address to [`Bolt12Invoice::fallbacks`].
47646  *
47647  * Successive calls to this method will add another address. Caller is responsible for not
47648  * adding duplicate addresses and only calling if capable of receiving to P2WPKH addresses.
47649  */
47650 MUST_USE_RES void InvoiceWithDerivedSigningPubkeyBuilder_fallback_v0_p2wpkh(struct LDKInvoiceWithDerivedSigningPubkeyBuilder this_arg, const uint8_t (*pubkey_hash)[20]);
47651
47652 /**
47653  * Adds a P2TR address to [`Bolt12Invoice::fallbacks`].
47654  *
47655  * Successive calls to this method will add another address. Caller is responsible for not
47656  * adding duplicate addresses and only calling if capable of receiving to P2TR addresses.
47657  */
47658 MUST_USE_RES void InvoiceWithDerivedSigningPubkeyBuilder_fallback_v1_p2tr_tweaked(struct LDKInvoiceWithDerivedSigningPubkeyBuilder this_arg, struct LDKTweakedPublicKey output_key);
47659
47660 /**
47661  * Sets [`Bolt12Invoice::invoice_features`] to indicate MPP may be used. Otherwise, MPP is
47662  * disallowed.
47663  */
47664 MUST_USE_RES void InvoiceWithDerivedSigningPubkeyBuilder_allow_mpp(struct LDKInvoiceWithDerivedSigningPubkeyBuilder this_arg);
47665
47666 /**
47667  * Frees any resources used by the UnsignedBolt12Invoice, if is_owned is set and inner is non-NULL.
47668  */
47669 void UnsignedBolt12Invoice_free(struct LDKUnsignedBolt12Invoice this_obj);
47670
47671 /**
47672  * Creates a copy of the UnsignedBolt12Invoice
47673  */
47674 struct LDKUnsignedBolt12Invoice UnsignedBolt12Invoice_clone(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR orig);
47675
47676 /**
47677  * Calls the free function if one is set
47678  */
47679 void SignBolt12InvoiceFn_free(struct LDKSignBolt12InvoiceFn this_ptr);
47680
47681 /**
47682  * Returns the [`TaggedHash`] of the invoice to sign.
47683  */
47684 MUST_USE_RES struct LDKTaggedHash UnsignedBolt12Invoice_tagged_hash(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg);
47685
47686 /**
47687  * Frees any resources used by the Bolt12Invoice, if is_owned is set and inner is non-NULL.
47688  */
47689 void Bolt12Invoice_free(struct LDKBolt12Invoice this_obj);
47690
47691 /**
47692  * Creates a copy of the Bolt12Invoice
47693  */
47694 struct LDKBolt12Invoice Bolt12Invoice_clone(const struct LDKBolt12Invoice *NONNULL_PTR orig);
47695
47696 /**
47697  * The chains that may be used when paying a requested invoice.
47698  *
47699  * From [`Offer::chains`]; `None` if the invoice was created in response to a [`Refund`].
47700  *
47701  * [`Offer::chains`]: crate::offers::offer::Offer::chains
47702  */
47703 MUST_USE_RES struct LDKCOption_CVec_ThirtyTwoBytesZZ UnsignedBolt12Invoice_offer_chains(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg);
47704
47705 /**
47706  * The chain that must be used when paying the invoice; selected from [`offer_chains`] if the
47707  * invoice originated from an offer.
47708  *
47709  * From [`InvoiceRequest::chain`] or [`Refund::chain`].
47710  *
47711  * [`offer_chains`]: Self::offer_chains
47712  * [`InvoiceRequest::chain`]: crate::offers::invoice_request::InvoiceRequest::chain
47713  */
47714 MUST_USE_RES struct LDKThirtyTwoBytes UnsignedBolt12Invoice_chain(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg);
47715
47716 /**
47717  * Opaque bytes set by the originating [`Offer`].
47718  *
47719  * From [`Offer::metadata`]; `None` if the invoice was created in response to a [`Refund`] or
47720  * if the [`Offer`] did not set it.
47721  *
47722  * [`Offer`]: crate::offers::offer::Offer
47723  * [`Offer::metadata`]: crate::offers::offer::Offer::metadata
47724  */
47725 MUST_USE_RES struct LDKCOption_CVec_u8ZZ UnsignedBolt12Invoice_metadata(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg);
47726
47727 /**
47728  * The minimum amount required for a successful payment of a single item.
47729  *
47730  * From [`Offer::amount`]; `None` if the invoice was created in response to a [`Refund`] or if
47731  * the [`Offer`] did not set it.
47732  *
47733  * [`Offer`]: crate::offers::offer::Offer
47734  * [`Offer::amount`]: crate::offers::offer::Offer::amount
47735  */
47736 MUST_USE_RES struct LDKCOption_AmountZ UnsignedBolt12Invoice_amount(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg);
47737
47738 /**
47739  * Features pertaining to the originating [`Offer`].
47740  *
47741  * From [`Offer::offer_features`]; `None` if the invoice was created in response to a
47742  * [`Refund`].
47743  *
47744  * [`Offer`]: crate::offers::offer::Offer
47745  * [`Offer::offer_features`]: crate::offers::offer::Offer::offer_features
47746  *
47747  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
47748  */
47749 MUST_USE_RES struct LDKOfferFeatures UnsignedBolt12Invoice_offer_features(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg);
47750
47751 /**
47752  * A complete description of the purpose of the originating offer or refund.
47753  *
47754  * From [`Offer::description`] or [`Refund::description`].
47755  *
47756  * [`Offer::description`]: crate::offers::offer::Offer::description
47757  *
47758  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
47759  */
47760 MUST_USE_RES struct LDKPrintableString UnsignedBolt12Invoice_description(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg);
47761
47762 /**
47763  * Duration since the Unix epoch when an invoice should no longer be requested.
47764  *
47765  * From [`Offer::absolute_expiry`] or [`Refund::absolute_expiry`].
47766  *
47767  * [`Offer::absolute_expiry`]: crate::offers::offer::Offer::absolute_expiry
47768  */
47769 MUST_USE_RES struct LDKCOption_u64Z UnsignedBolt12Invoice_absolute_expiry(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg);
47770
47771 /**
47772  * The issuer of the offer or refund.
47773  *
47774  * From [`Offer::issuer`] or [`Refund::issuer`].
47775  *
47776  * [`Offer::issuer`]: crate::offers::offer::Offer::issuer
47777  *
47778  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
47779  */
47780 MUST_USE_RES struct LDKPrintableString UnsignedBolt12Invoice_issuer(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg);
47781
47782 /**
47783  * Paths to the recipient originating from publicly reachable nodes.
47784  *
47785  * From [`Offer::paths`] or [`Refund::paths`].
47786  *
47787  * [`Offer::paths`]: crate::offers::offer::Offer::paths
47788  */
47789 MUST_USE_RES struct LDKCVec_BlindedPathZ UnsignedBolt12Invoice_message_paths(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg);
47790
47791 /**
47792  * The quantity of items supported.
47793  *
47794  * From [`Offer::supported_quantity`]; `None` if the invoice was created in response to a
47795  * [`Refund`].
47796  *
47797  * [`Offer::supported_quantity`]: crate::offers::offer::Offer::supported_quantity
47798  */
47799 MUST_USE_RES struct LDKCOption_QuantityZ UnsignedBolt12Invoice_supported_quantity(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg);
47800
47801 /**
47802  * An unpredictable series of bytes from the payer.
47803  *
47804  * From [`InvoiceRequest::payer_metadata`] or [`Refund::payer_metadata`].
47805  */
47806 MUST_USE_RES struct LDKu8slice UnsignedBolt12Invoice_payer_metadata(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg);
47807
47808 /**
47809  * Features pertaining to requesting an invoice.
47810  *
47811  * From [`InvoiceRequest::invoice_request_features`] or [`Refund::features`].
47812  */
47813 MUST_USE_RES struct LDKInvoiceRequestFeatures UnsignedBolt12Invoice_invoice_request_features(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg);
47814
47815 /**
47816  * The quantity of items requested or refunded for.
47817  *
47818  * From [`InvoiceRequest::quantity`] or [`Refund::quantity`].
47819  */
47820 MUST_USE_RES struct LDKCOption_u64Z UnsignedBolt12Invoice_quantity(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg);
47821
47822 /**
47823  * A possibly transient pubkey used to sign the invoice request or to send an invoice for a
47824  * refund in case there are no [`message_paths`].
47825  *
47826  * [`message_paths`]: Self::message_paths
47827  */
47828 MUST_USE_RES struct LDKPublicKey UnsignedBolt12Invoice_payer_id(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg);
47829
47830 /**
47831  * A payer-provided note reflected back in the invoice.
47832  *
47833  * From [`InvoiceRequest::payer_note`] or [`Refund::payer_note`].
47834  *
47835  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
47836  */
47837 MUST_USE_RES struct LDKPrintableString UnsignedBolt12Invoice_payer_note(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg);
47838
47839 /**
47840  * Duration since the Unix epoch when the invoice was created.
47841  */
47842 MUST_USE_RES uint64_t UnsignedBolt12Invoice_created_at(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg);
47843
47844 /**
47845  * Duration since [`Bolt12Invoice::created_at`] when the invoice has expired and therefore
47846  * should no longer be paid.
47847  */
47848 MUST_USE_RES uint64_t UnsignedBolt12Invoice_relative_expiry(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg);
47849
47850 /**
47851  * Whether the invoice has expired.
47852  */
47853 MUST_USE_RES bool UnsignedBolt12Invoice_is_expired(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg);
47854
47855 /**
47856  * SHA256 hash of the payment preimage that will be given in return for paying the invoice.
47857  */
47858 MUST_USE_RES struct LDKThirtyTwoBytes UnsignedBolt12Invoice_payment_hash(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg);
47859
47860 /**
47861  * The minimum amount required for a successful payment of the invoice.
47862  */
47863 MUST_USE_RES uint64_t UnsignedBolt12Invoice_amount_msats(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg);
47864
47865 /**
47866  * Features pertaining to paying an invoice.
47867  */
47868 MUST_USE_RES struct LDKBolt12InvoiceFeatures UnsignedBolt12Invoice_invoice_features(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg);
47869
47870 /**
47871  * The public key corresponding to the key used to sign the invoice.
47872  */
47873 MUST_USE_RES struct LDKPublicKey UnsignedBolt12Invoice_signing_pubkey(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg);
47874
47875 /**
47876  * The chains that may be used when paying a requested invoice.
47877  *
47878  * From [`Offer::chains`]; `None` if the invoice was created in response to a [`Refund`].
47879  *
47880  * [`Offer::chains`]: crate::offers::offer::Offer::chains
47881  */
47882 MUST_USE_RES struct LDKCOption_CVec_ThirtyTwoBytesZZ Bolt12Invoice_offer_chains(const struct LDKBolt12Invoice *NONNULL_PTR this_arg);
47883
47884 /**
47885  * The chain that must be used when paying the invoice; selected from [`offer_chains`] if the
47886  * invoice originated from an offer.
47887  *
47888  * From [`InvoiceRequest::chain`] or [`Refund::chain`].
47889  *
47890  * [`offer_chains`]: Self::offer_chains
47891  * [`InvoiceRequest::chain`]: crate::offers::invoice_request::InvoiceRequest::chain
47892  */
47893 MUST_USE_RES struct LDKThirtyTwoBytes Bolt12Invoice_chain(const struct LDKBolt12Invoice *NONNULL_PTR this_arg);
47894
47895 /**
47896  * Opaque bytes set by the originating [`Offer`].
47897  *
47898  * From [`Offer::metadata`]; `None` if the invoice was created in response to a [`Refund`] or
47899  * if the [`Offer`] did not set it.
47900  *
47901  * [`Offer`]: crate::offers::offer::Offer
47902  * [`Offer::metadata`]: crate::offers::offer::Offer::metadata
47903  */
47904 MUST_USE_RES struct LDKCOption_CVec_u8ZZ Bolt12Invoice_metadata(const struct LDKBolt12Invoice *NONNULL_PTR this_arg);
47905
47906 /**
47907  * The minimum amount required for a successful payment of a single item.
47908  *
47909  * From [`Offer::amount`]; `None` if the invoice was created in response to a [`Refund`] or if
47910  * the [`Offer`] did not set it.
47911  *
47912  * [`Offer`]: crate::offers::offer::Offer
47913  * [`Offer::amount`]: crate::offers::offer::Offer::amount
47914  */
47915 MUST_USE_RES struct LDKCOption_AmountZ Bolt12Invoice_amount(const struct LDKBolt12Invoice *NONNULL_PTR this_arg);
47916
47917 /**
47918  * Features pertaining to the originating [`Offer`].
47919  *
47920  * From [`Offer::offer_features`]; `None` if the invoice was created in response to a
47921  * [`Refund`].
47922  *
47923  * [`Offer`]: crate::offers::offer::Offer
47924  * [`Offer::offer_features`]: crate::offers::offer::Offer::offer_features
47925  *
47926  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
47927  */
47928 MUST_USE_RES struct LDKOfferFeatures Bolt12Invoice_offer_features(const struct LDKBolt12Invoice *NONNULL_PTR this_arg);
47929
47930 /**
47931  * A complete description of the purpose of the originating offer or refund.
47932  *
47933  * From [`Offer::description`] or [`Refund::description`].
47934  *
47935  * [`Offer::description`]: crate::offers::offer::Offer::description
47936  *
47937  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
47938  */
47939 MUST_USE_RES struct LDKPrintableString Bolt12Invoice_description(const struct LDKBolt12Invoice *NONNULL_PTR this_arg);
47940
47941 /**
47942  * Duration since the Unix epoch when an invoice should no longer be requested.
47943  *
47944  * From [`Offer::absolute_expiry`] or [`Refund::absolute_expiry`].
47945  *
47946  * [`Offer::absolute_expiry`]: crate::offers::offer::Offer::absolute_expiry
47947  */
47948 MUST_USE_RES struct LDKCOption_u64Z Bolt12Invoice_absolute_expiry(const struct LDKBolt12Invoice *NONNULL_PTR this_arg);
47949
47950 /**
47951  * The issuer of the offer or refund.
47952  *
47953  * From [`Offer::issuer`] or [`Refund::issuer`].
47954  *
47955  * [`Offer::issuer`]: crate::offers::offer::Offer::issuer
47956  *
47957  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
47958  */
47959 MUST_USE_RES struct LDKPrintableString Bolt12Invoice_issuer(const struct LDKBolt12Invoice *NONNULL_PTR this_arg);
47960
47961 /**
47962  * Paths to the recipient originating from publicly reachable nodes.
47963  *
47964  * From [`Offer::paths`] or [`Refund::paths`].
47965  *
47966  * [`Offer::paths`]: crate::offers::offer::Offer::paths
47967  */
47968 MUST_USE_RES struct LDKCVec_BlindedPathZ Bolt12Invoice_message_paths(const struct LDKBolt12Invoice *NONNULL_PTR this_arg);
47969
47970 /**
47971  * The quantity of items supported.
47972  *
47973  * From [`Offer::supported_quantity`]; `None` if the invoice was created in response to a
47974  * [`Refund`].
47975  *
47976  * [`Offer::supported_quantity`]: crate::offers::offer::Offer::supported_quantity
47977  */
47978 MUST_USE_RES struct LDKCOption_QuantityZ Bolt12Invoice_supported_quantity(const struct LDKBolt12Invoice *NONNULL_PTR this_arg);
47979
47980 /**
47981  * An unpredictable series of bytes from the payer.
47982  *
47983  * From [`InvoiceRequest::payer_metadata`] or [`Refund::payer_metadata`].
47984  */
47985 MUST_USE_RES struct LDKu8slice Bolt12Invoice_payer_metadata(const struct LDKBolt12Invoice *NONNULL_PTR this_arg);
47986
47987 /**
47988  * Features pertaining to requesting an invoice.
47989  *
47990  * From [`InvoiceRequest::invoice_request_features`] or [`Refund::features`].
47991  */
47992 MUST_USE_RES struct LDKInvoiceRequestFeatures Bolt12Invoice_invoice_request_features(const struct LDKBolt12Invoice *NONNULL_PTR this_arg);
47993
47994 /**
47995  * The quantity of items requested or refunded for.
47996  *
47997  * From [`InvoiceRequest::quantity`] or [`Refund::quantity`].
47998  */
47999 MUST_USE_RES struct LDKCOption_u64Z Bolt12Invoice_quantity(const struct LDKBolt12Invoice *NONNULL_PTR this_arg);
48000
48001 /**
48002  * A possibly transient pubkey used to sign the invoice request or to send an invoice for a
48003  * refund in case there are no [`message_paths`].
48004  *
48005  * [`message_paths`]: Self::message_paths
48006  */
48007 MUST_USE_RES struct LDKPublicKey Bolt12Invoice_payer_id(const struct LDKBolt12Invoice *NONNULL_PTR this_arg);
48008
48009 /**
48010  * A payer-provided note reflected back in the invoice.
48011  *
48012  * From [`InvoiceRequest::payer_note`] or [`Refund::payer_note`].
48013  *
48014  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
48015  */
48016 MUST_USE_RES struct LDKPrintableString Bolt12Invoice_payer_note(const struct LDKBolt12Invoice *NONNULL_PTR this_arg);
48017
48018 /**
48019  * Duration since the Unix epoch when the invoice was created.
48020  */
48021 MUST_USE_RES uint64_t Bolt12Invoice_created_at(const struct LDKBolt12Invoice *NONNULL_PTR this_arg);
48022
48023 /**
48024  * Duration since [`Bolt12Invoice::created_at`] when the invoice has expired and therefore
48025  * should no longer be paid.
48026  */
48027 MUST_USE_RES uint64_t Bolt12Invoice_relative_expiry(const struct LDKBolt12Invoice *NONNULL_PTR this_arg);
48028
48029 /**
48030  * Whether the invoice has expired.
48031  */
48032 MUST_USE_RES bool Bolt12Invoice_is_expired(const struct LDKBolt12Invoice *NONNULL_PTR this_arg);
48033
48034 /**
48035  * SHA256 hash of the payment preimage that will be given in return for paying the invoice.
48036  */
48037 MUST_USE_RES struct LDKThirtyTwoBytes Bolt12Invoice_payment_hash(const struct LDKBolt12Invoice *NONNULL_PTR this_arg);
48038
48039 /**
48040  * The minimum amount required for a successful payment of the invoice.
48041  */
48042 MUST_USE_RES uint64_t Bolt12Invoice_amount_msats(const struct LDKBolt12Invoice *NONNULL_PTR this_arg);
48043
48044 /**
48045  * Features pertaining to paying an invoice.
48046  */
48047 MUST_USE_RES struct LDKBolt12InvoiceFeatures Bolt12Invoice_invoice_features(const struct LDKBolt12Invoice *NONNULL_PTR this_arg);
48048
48049 /**
48050  * The public key corresponding to the key used to sign the invoice.
48051  */
48052 MUST_USE_RES struct LDKPublicKey Bolt12Invoice_signing_pubkey(const struct LDKBolt12Invoice *NONNULL_PTR this_arg);
48053
48054 /**
48055  * Signature of the invoice verified using [`Bolt12Invoice::signing_pubkey`].
48056  */
48057 MUST_USE_RES struct LDKSchnorrSignature Bolt12Invoice_signature(const struct LDKBolt12Invoice *NONNULL_PTR this_arg);
48058
48059 /**
48060  * Hash that was used for signing the invoice.
48061  */
48062 MUST_USE_RES struct LDKThirtyTwoBytes Bolt12Invoice_signable_hash(const struct LDKBolt12Invoice *NONNULL_PTR this_arg);
48063
48064 /**
48065  * Verifies that the invoice was for a request or refund created using the given key. Returns
48066  * the associated [`PaymentId`] to use when sending the payment.
48067  */
48068 MUST_USE_RES struct LDKCResult_ThirtyTwoBytesNoneZ Bolt12Invoice_verify(const struct LDKBolt12Invoice *NONNULL_PTR this_arg, const struct LDKExpandedKey *NONNULL_PTR key);
48069
48070 /**
48071  * Generates a non-cryptographic 64-bit hash of the Bolt12Invoice.
48072  */
48073 uint64_t Bolt12Invoice_hash(const struct LDKBolt12Invoice *NONNULL_PTR o);
48074
48075 /**
48076  * Serialize the UnsignedBolt12Invoice object into a byte array which can be read by UnsignedBolt12Invoice_read
48077  */
48078 struct LDKCVec_u8Z UnsignedBolt12Invoice_write(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR obj);
48079
48080 /**
48081  * Serialize the Bolt12Invoice object into a byte array which can be read by Bolt12Invoice_read
48082  */
48083 struct LDKCVec_u8Z Bolt12Invoice_write(const struct LDKBolt12Invoice *NONNULL_PTR obj);
48084
48085 /**
48086  * Frees any resources used by the BlindedPayInfo, if is_owned is set and inner is non-NULL.
48087  */
48088 void BlindedPayInfo_free(struct LDKBlindedPayInfo this_obj);
48089
48090 /**
48091  * Base fee charged (in millisatoshi) for the entire blinded path.
48092  */
48093 uint32_t BlindedPayInfo_get_fee_base_msat(const struct LDKBlindedPayInfo *NONNULL_PTR this_ptr);
48094
48095 /**
48096  * Base fee charged (in millisatoshi) for the entire blinded path.
48097  */
48098 void BlindedPayInfo_set_fee_base_msat(struct LDKBlindedPayInfo *NONNULL_PTR this_ptr, uint32_t val);
48099
48100 /**
48101  * Liquidity fee charged (in millionths of the amount transferred) for the entire blinded path
48102  * (i.e., 10,000 is 1%).
48103  */
48104 uint32_t BlindedPayInfo_get_fee_proportional_millionths(const struct LDKBlindedPayInfo *NONNULL_PTR this_ptr);
48105
48106 /**
48107  * Liquidity fee charged (in millionths of the amount transferred) for the entire blinded path
48108  * (i.e., 10,000 is 1%).
48109  */
48110 void BlindedPayInfo_set_fee_proportional_millionths(struct LDKBlindedPayInfo *NONNULL_PTR this_ptr, uint32_t val);
48111
48112 /**
48113  * Number of blocks subtracted from an incoming HTLC's `cltv_expiry` for the entire blinded
48114  * path.
48115  */
48116 uint16_t BlindedPayInfo_get_cltv_expiry_delta(const struct LDKBlindedPayInfo *NONNULL_PTR this_ptr);
48117
48118 /**
48119  * Number of blocks subtracted from an incoming HTLC's `cltv_expiry` for the entire blinded
48120  * path.
48121  */
48122 void BlindedPayInfo_set_cltv_expiry_delta(struct LDKBlindedPayInfo *NONNULL_PTR this_ptr, uint16_t val);
48123
48124 /**
48125  * The minimum HTLC value (in millisatoshi) that is acceptable to all channel peers on the
48126  * blinded path from the introduction node to the recipient, accounting for any fees, i.e., as
48127  * seen by the recipient.
48128  */
48129 uint64_t BlindedPayInfo_get_htlc_minimum_msat(const struct LDKBlindedPayInfo *NONNULL_PTR this_ptr);
48130
48131 /**
48132  * The minimum HTLC value (in millisatoshi) that is acceptable to all channel peers on the
48133  * blinded path from the introduction node to the recipient, accounting for any fees, i.e., as
48134  * seen by the recipient.
48135  */
48136 void BlindedPayInfo_set_htlc_minimum_msat(struct LDKBlindedPayInfo *NONNULL_PTR this_ptr, uint64_t val);
48137
48138 /**
48139  * The maximum HTLC value (in millisatoshi) that is acceptable to all channel peers on the
48140  * blinded path from the introduction node to the recipient, accounting for any fees, i.e., as
48141  * seen by the recipient.
48142  */
48143 uint64_t BlindedPayInfo_get_htlc_maximum_msat(const struct LDKBlindedPayInfo *NONNULL_PTR this_ptr);
48144
48145 /**
48146  * The maximum HTLC value (in millisatoshi) that is acceptable to all channel peers on the
48147  * blinded path from the introduction node to the recipient, accounting for any fees, i.e., as
48148  * seen by the recipient.
48149  */
48150 void BlindedPayInfo_set_htlc_maximum_msat(struct LDKBlindedPayInfo *NONNULL_PTR this_ptr, uint64_t val);
48151
48152 /**
48153  * Features set in `encrypted_data_tlv` for the `encrypted_recipient_data` TLV record in an
48154  * onion payload.
48155  */
48156 struct LDKBlindedHopFeatures BlindedPayInfo_get_features(const struct LDKBlindedPayInfo *NONNULL_PTR this_ptr);
48157
48158 /**
48159  * Features set in `encrypted_data_tlv` for the `encrypted_recipient_data` TLV record in an
48160  * onion payload.
48161  */
48162 void BlindedPayInfo_set_features(struct LDKBlindedPayInfo *NONNULL_PTR this_ptr, struct LDKBlindedHopFeatures val);
48163
48164 /**
48165  * Constructs a new BlindedPayInfo given each field
48166  */
48167 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);
48168
48169 /**
48170  * Creates a copy of the BlindedPayInfo
48171  */
48172 struct LDKBlindedPayInfo BlindedPayInfo_clone(const struct LDKBlindedPayInfo *NONNULL_PTR orig);
48173
48174 /**
48175  * Generates a non-cryptographic 64-bit hash of the BlindedPayInfo.
48176  */
48177 uint64_t BlindedPayInfo_hash(const struct LDKBlindedPayInfo *NONNULL_PTR o);
48178
48179 /**
48180  * Checks if two BlindedPayInfos contain equal inner contents.
48181  * This ignores pointers and is_owned flags and looks at the values in fields.
48182  * Two objects with NULL inner values will be considered "equal" here.
48183  */
48184 bool BlindedPayInfo_eq(const struct LDKBlindedPayInfo *NONNULL_PTR a, const struct LDKBlindedPayInfo *NONNULL_PTR b);
48185
48186 /**
48187  * Serialize the BlindedPayInfo object into a byte array which can be read by BlindedPayInfo_read
48188  */
48189 struct LDKCVec_u8Z BlindedPayInfo_write(const struct LDKBlindedPayInfo *NONNULL_PTR obj);
48190
48191 /**
48192  * Read a BlindedPayInfo from a byte array, created by BlindedPayInfo_write
48193  */
48194 struct LDKCResult_BlindedPayInfoDecodeErrorZ BlindedPayInfo_read(struct LDKu8slice ser);
48195
48196 /**
48197  * Frees any resources used by the InvoiceError, if is_owned is set and inner is non-NULL.
48198  */
48199 void InvoiceError_free(struct LDKInvoiceError this_obj);
48200
48201 /**
48202  * The field in the [`InvoiceRequest`] or the [`Bolt12Invoice`] that contained an error.
48203  *
48204  * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
48205  * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
48206  *
48207  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
48208  */
48209 struct LDKErroneousField InvoiceError_get_erroneous_field(const struct LDKInvoiceError *NONNULL_PTR this_ptr);
48210
48211 /**
48212  * The field in the [`InvoiceRequest`] or the [`Bolt12Invoice`] that contained an error.
48213  *
48214  * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
48215  * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
48216  *
48217  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
48218  */
48219 void InvoiceError_set_erroneous_field(struct LDKInvoiceError *NONNULL_PTR this_ptr, struct LDKErroneousField val);
48220
48221 /**
48222  * An explanation of the error.
48223  */
48224 struct LDKUntrustedString InvoiceError_get_message(const struct LDKInvoiceError *NONNULL_PTR this_ptr);
48225
48226 /**
48227  * An explanation of the error.
48228  */
48229 void InvoiceError_set_message(struct LDKInvoiceError *NONNULL_PTR this_ptr, struct LDKUntrustedString val);
48230
48231 /**
48232  * Constructs a new InvoiceError given each field
48233  *
48234  * Note that erroneous_field_arg (or a relevant inner pointer) may be NULL or all-0s to represent None
48235  */
48236 MUST_USE_RES struct LDKInvoiceError InvoiceError_new(struct LDKErroneousField erroneous_field_arg, struct LDKUntrustedString message_arg);
48237
48238 /**
48239  * Creates a copy of the InvoiceError
48240  */
48241 struct LDKInvoiceError InvoiceError_clone(const struct LDKInvoiceError *NONNULL_PTR orig);
48242
48243 /**
48244  * Frees any resources used by the ErroneousField, if is_owned is set and inner is non-NULL.
48245  */
48246 void ErroneousField_free(struct LDKErroneousField this_obj);
48247
48248 /**
48249  * The type number of the TLV field containing the error.
48250  */
48251 uint64_t ErroneousField_get_tlv_fieldnum(const struct LDKErroneousField *NONNULL_PTR this_ptr);
48252
48253 /**
48254  * The type number of the TLV field containing the error.
48255  */
48256 void ErroneousField_set_tlv_fieldnum(struct LDKErroneousField *NONNULL_PTR this_ptr, uint64_t val);
48257
48258 /**
48259  * A value to use for the TLV field to avoid the error.
48260  *
48261  * Returns a copy of the field.
48262  */
48263 struct LDKCOption_CVec_u8ZZ ErroneousField_get_suggested_value(const struct LDKErroneousField *NONNULL_PTR this_ptr);
48264
48265 /**
48266  * A value to use for the TLV field to avoid the error.
48267  */
48268 void ErroneousField_set_suggested_value(struct LDKErroneousField *NONNULL_PTR this_ptr, struct LDKCOption_CVec_u8ZZ val);
48269
48270 /**
48271  * Constructs a new ErroneousField given each field
48272  */
48273 MUST_USE_RES struct LDKErroneousField ErroneousField_new(uint64_t tlv_fieldnum_arg, struct LDKCOption_CVec_u8ZZ suggested_value_arg);
48274
48275 /**
48276  * Creates a copy of the ErroneousField
48277  */
48278 struct LDKErroneousField ErroneousField_clone(const struct LDKErroneousField *NONNULL_PTR orig);
48279
48280 /**
48281  * Creates an [`InvoiceError`] with the given message.
48282  */
48283 MUST_USE_RES struct LDKInvoiceError InvoiceError_from_string(struct LDKStr s);
48284
48285 /**
48286  * Serialize the InvoiceError object into a byte array which can be read by InvoiceError_read
48287  */
48288 struct LDKCVec_u8Z InvoiceError_write(const struct LDKInvoiceError *NONNULL_PTR obj);
48289
48290 /**
48291  * Read a InvoiceError from a byte array, created by InvoiceError_write
48292  */
48293 struct LDKCResult_InvoiceErrorDecodeErrorZ InvoiceError_read(struct LDKu8slice ser);
48294
48295 /**
48296  * Frees any resources used by the InvoiceRequestWithExplicitPayerIdBuilder, if is_owned is set and inner is non-NULL.
48297  */
48298 void InvoiceRequestWithExplicitPayerIdBuilder_free(struct LDKInvoiceRequestWithExplicitPayerIdBuilder this_obj);
48299
48300 /**
48301  * Frees any resources used by the InvoiceRequestWithDerivedPayerIdBuilder, if is_owned is set and inner is non-NULL.
48302  */
48303 void InvoiceRequestWithDerivedPayerIdBuilder_free(struct LDKInvoiceRequestWithDerivedPayerIdBuilder this_obj);
48304
48305 /**
48306  * Builds an unsigned [`InvoiceRequest`] after checking for valid semantics. It can be signed
48307  * by [`UnsignedInvoiceRequest::sign`].
48308  */
48309 MUST_USE_RES struct LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ InvoiceRequestWithExplicitPayerIdBuilder_build(struct LDKInvoiceRequestWithExplicitPayerIdBuilder this_arg);
48310
48311 /**
48312  * Sets the [`InvoiceRequest::chain`] of the given [`Network`] for paying an invoice. If not
48313  * called, [`Network::Bitcoin`] is assumed. Errors if the chain for `network` is not supported
48314  * by the offer.
48315  *
48316  * Successive calls to this method will override the previous setting.
48317  */
48318 MUST_USE_RES struct LDKCResult_NoneBolt12SemanticErrorZ InvoiceRequestWithExplicitPayerIdBuilder_chain(struct LDKInvoiceRequestWithExplicitPayerIdBuilder this_arg, enum LDKNetwork network);
48319
48320 /**
48321  * Sets the [`InvoiceRequest::amount_msats`] for paying an invoice. Errors if `amount_msats` is
48322  * not at least the expected invoice amount (i.e., [`Offer::amount`] times [`quantity`]).
48323  *
48324  * Successive calls to this method will override the previous setting.
48325  *
48326  * [`quantity`]: Self::quantity
48327  */
48328 MUST_USE_RES struct LDKCResult_NoneBolt12SemanticErrorZ InvoiceRequestWithExplicitPayerIdBuilder_amount_msats(struct LDKInvoiceRequestWithExplicitPayerIdBuilder this_arg, uint64_t amount_msats);
48329
48330 /**
48331  * Sets [`InvoiceRequest::quantity`] of items. If not set, `1` is assumed. Errors if `quantity`
48332  * does not conform to [`Offer::is_valid_quantity`].
48333  *
48334  * Successive calls to this method will override the previous setting.
48335  */
48336 MUST_USE_RES struct LDKCResult_NoneBolt12SemanticErrorZ InvoiceRequestWithExplicitPayerIdBuilder_quantity(struct LDKInvoiceRequestWithExplicitPayerIdBuilder this_arg, uint64_t quantity);
48337
48338 /**
48339  * Sets the [`InvoiceRequest::payer_note`].
48340  *
48341  * Successive calls to this method will override the previous setting.
48342  */
48343 MUST_USE_RES void InvoiceRequestWithExplicitPayerIdBuilder_payer_note(struct LDKInvoiceRequestWithExplicitPayerIdBuilder this_arg, struct LDKStr payer_note);
48344
48345 /**
48346  * Builds a signed [`InvoiceRequest`] after checking for valid semantics.
48347  */
48348 MUST_USE_RES struct LDKCResult_InvoiceRequestBolt12SemanticErrorZ InvoiceRequestWithDerivedPayerIdBuilder_build_and_sign(struct LDKInvoiceRequestWithDerivedPayerIdBuilder this_arg);
48349
48350 /**
48351  * Sets the [`InvoiceRequest::chain`] of the given [`Network`] for paying an invoice. If not
48352  * called, [`Network::Bitcoin`] is assumed. Errors if the chain for `network` is not supported
48353  * by the offer.
48354  *
48355  * Successive calls to this method will override the previous setting.
48356  */
48357 MUST_USE_RES struct LDKCResult_NoneBolt12SemanticErrorZ InvoiceRequestWithDerivedPayerIdBuilder_chain(struct LDKInvoiceRequestWithDerivedPayerIdBuilder this_arg, enum LDKNetwork network);
48358
48359 /**
48360  * Sets the [`InvoiceRequest::amount_msats`] for paying an invoice. Errors if `amount_msats` is
48361  * not at least the expected invoice amount (i.e., [`Offer::amount`] times [`quantity`]).
48362  *
48363  * Successive calls to this method will override the previous setting.
48364  *
48365  * [`quantity`]: Self::quantity
48366  */
48367 MUST_USE_RES struct LDKCResult_NoneBolt12SemanticErrorZ InvoiceRequestWithDerivedPayerIdBuilder_amount_msats(struct LDKInvoiceRequestWithDerivedPayerIdBuilder this_arg, uint64_t amount_msats);
48368
48369 /**
48370  * Sets [`InvoiceRequest::quantity`] of items. If not set, `1` is assumed. Errors if `quantity`
48371  * does not conform to [`Offer::is_valid_quantity`].
48372  *
48373  * Successive calls to this method will override the previous setting.
48374  */
48375 MUST_USE_RES struct LDKCResult_NoneBolt12SemanticErrorZ InvoiceRequestWithDerivedPayerIdBuilder_quantity(struct LDKInvoiceRequestWithDerivedPayerIdBuilder this_arg, uint64_t quantity);
48376
48377 /**
48378  * Sets the [`InvoiceRequest::payer_note`].
48379  *
48380  * Successive calls to this method will override the previous setting.
48381  */
48382 MUST_USE_RES void InvoiceRequestWithDerivedPayerIdBuilder_payer_note(struct LDKInvoiceRequestWithDerivedPayerIdBuilder this_arg, struct LDKStr payer_note);
48383
48384 /**
48385  * Frees any resources used by the UnsignedInvoiceRequest, if is_owned is set and inner is non-NULL.
48386  */
48387 void UnsignedInvoiceRequest_free(struct LDKUnsignedInvoiceRequest this_obj);
48388
48389 /**
48390  * Creates a copy of the UnsignedInvoiceRequest
48391  */
48392 struct LDKUnsignedInvoiceRequest UnsignedInvoiceRequest_clone(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR orig);
48393
48394 /**
48395  * Calls the free function if one is set
48396  */
48397 void SignInvoiceRequestFn_free(struct LDKSignInvoiceRequestFn this_ptr);
48398
48399 /**
48400  * Returns the [`TaggedHash`] of the invoice to sign.
48401  */
48402 MUST_USE_RES struct LDKTaggedHash UnsignedInvoiceRequest_tagged_hash(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg);
48403
48404 /**
48405  * Frees any resources used by the InvoiceRequest, if is_owned is set and inner is non-NULL.
48406  */
48407 void InvoiceRequest_free(struct LDKInvoiceRequest this_obj);
48408
48409 /**
48410  * Creates a copy of the InvoiceRequest
48411  */
48412 struct LDKInvoiceRequest InvoiceRequest_clone(const struct LDKInvoiceRequest *NONNULL_PTR orig);
48413
48414 /**
48415  * Frees any resources used by the VerifiedInvoiceRequest, if is_owned is set and inner is non-NULL.
48416  */
48417 void VerifiedInvoiceRequest_free(struct LDKVerifiedInvoiceRequest this_obj);
48418
48419 /**
48420  * The identifier of the [`Offer`] for which the [`InvoiceRequest`] was made.
48421  */
48422 struct LDKOfferId VerifiedInvoiceRequest_get_offer_id(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_ptr);
48423
48424 /**
48425  * The identifier of the [`Offer`] for which the [`InvoiceRequest`] was made.
48426  */
48427 void VerifiedInvoiceRequest_set_offer_id(struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_ptr, struct LDKOfferId val);
48428
48429 /**
48430  * Keys used for signing a [`Bolt12Invoice`] if they can be derived.
48431  *
48432  * If `Some`, must call [`respond_using_derived_keys`] when responding. Otherwise, call
48433  * [`respond_with`].
48434  *
48435  * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
48436  * [`respond_using_derived_keys`]: Self::respond_using_derived_keys
48437  * [`respond_with`]: Self::respond_with
48438  */
48439 struct LDKCOption_SecretKeyZ VerifiedInvoiceRequest_get_keys(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_ptr);
48440
48441 /**
48442  * Keys used for signing a [`Bolt12Invoice`] if they can be derived.
48443  *
48444  * If `Some`, must call [`respond_using_derived_keys`] when responding. Otherwise, call
48445  * [`respond_with`].
48446  *
48447  * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
48448  * [`respond_using_derived_keys`]: Self::respond_using_derived_keys
48449  * [`respond_with`]: Self::respond_with
48450  */
48451 void VerifiedInvoiceRequest_set_keys(struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_ptr, struct LDKCOption_SecretKeyZ val);
48452
48453 /**
48454  * Creates a copy of the VerifiedInvoiceRequest
48455  */
48456 struct LDKVerifiedInvoiceRequest VerifiedInvoiceRequest_clone(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR orig);
48457
48458 /**
48459  * The chains that may be used when paying a requested invoice (e.g., bitcoin mainnet).
48460  * Payments must be denominated in units of the minimal lightning-payable unit (e.g., msats)
48461  * for the selected chain.
48462  */
48463 MUST_USE_RES struct LDKCVec_ThirtyTwoBytesZ UnsignedInvoiceRequest_chains(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg);
48464
48465 /**
48466  * Opaque bytes set by the originator. Useful for authentication and validating fields since it
48467  * is reflected in `invoice_request` messages along with all the other fields from the `offer`.
48468  */
48469 MUST_USE_RES struct LDKCOption_CVec_u8ZZ UnsignedInvoiceRequest_metadata(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg);
48470
48471 /**
48472  * The minimum amount required for a successful payment of a single item.
48473  */
48474 MUST_USE_RES struct LDKCOption_AmountZ UnsignedInvoiceRequest_amount(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg);
48475
48476 /**
48477  * A complete description of the purpose of the payment. Intended to be displayed to the user
48478  * but with the caveat that it has not been verified in any way.
48479  *
48480  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
48481  */
48482 MUST_USE_RES struct LDKPrintableString UnsignedInvoiceRequest_description(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg);
48483
48484 /**
48485  * Features pertaining to the offer.
48486  */
48487 MUST_USE_RES struct LDKOfferFeatures UnsignedInvoiceRequest_offer_features(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg);
48488
48489 /**
48490  * Duration since the Unix epoch when an invoice should no longer be requested.
48491  *
48492  * If `None`, the offer does not expire.
48493  */
48494 MUST_USE_RES struct LDKCOption_u64Z UnsignedInvoiceRequest_absolute_expiry(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg);
48495
48496 /**
48497  * The issuer of the offer, possibly beginning with `user@domain` or `domain`. Intended to be
48498  * displayed to the user but with the caveat that it has not been verified in any way.
48499  *
48500  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
48501  */
48502 MUST_USE_RES struct LDKPrintableString UnsignedInvoiceRequest_issuer(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg);
48503
48504 /**
48505  * Paths to the recipient originating from publicly reachable nodes. Blinded paths provide
48506  * recipient privacy by obfuscating its node id.
48507  */
48508 MUST_USE_RES struct LDKCVec_BlindedPathZ UnsignedInvoiceRequest_paths(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg);
48509
48510 /**
48511  * The quantity of items supported.
48512  */
48513 MUST_USE_RES struct LDKQuantity UnsignedInvoiceRequest_supported_quantity(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg);
48514
48515 /**
48516  * The public key used by the recipient to sign invoices.
48517  *
48518  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
48519  */
48520 MUST_USE_RES struct LDKPublicKey UnsignedInvoiceRequest_signing_pubkey(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg);
48521
48522 /**
48523  * An unpredictable series of bytes, typically containing information about the derivation of
48524  * [`payer_id`].
48525  *
48526  * [`payer_id`]: Self::payer_id
48527  */
48528 MUST_USE_RES struct LDKu8slice UnsignedInvoiceRequest_payer_metadata(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg);
48529
48530 /**
48531  * A chain from [`Offer::chains`] that the offer is valid for.
48532  */
48533 MUST_USE_RES struct LDKThirtyTwoBytes UnsignedInvoiceRequest_chain(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg);
48534
48535 /**
48536  * The amount to pay in msats (i.e., the minimum lightning-payable unit for [`chain`]), which
48537  * must be greater than or equal to [`Offer::amount`], converted if necessary.
48538  *
48539  * [`chain`]: Self::chain
48540  */
48541 MUST_USE_RES struct LDKCOption_u64Z UnsignedInvoiceRequest_amount_msats(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg);
48542
48543 /**
48544  * Features pertaining to requesting an invoice.
48545  */
48546 MUST_USE_RES struct LDKInvoiceRequestFeatures UnsignedInvoiceRequest_invoice_request_features(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg);
48547
48548 /**
48549  * The quantity of the offer's item conforming to [`Offer::is_valid_quantity`].
48550  */
48551 MUST_USE_RES struct LDKCOption_u64Z UnsignedInvoiceRequest_quantity(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg);
48552
48553 /**
48554  * A possibly transient pubkey used to sign the invoice request.
48555  */
48556 MUST_USE_RES struct LDKPublicKey UnsignedInvoiceRequest_payer_id(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg);
48557
48558 /**
48559  * A payer-provided note which will be seen by the recipient and reflected back in the invoice
48560  * response.
48561  *
48562  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
48563  */
48564 MUST_USE_RES struct LDKPrintableString UnsignedInvoiceRequest_payer_note(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg);
48565
48566 /**
48567  * The chains that may be used when paying a requested invoice (e.g., bitcoin mainnet).
48568  * Payments must be denominated in units of the minimal lightning-payable unit (e.g., msats)
48569  * for the selected chain.
48570  */
48571 MUST_USE_RES struct LDKCVec_ThirtyTwoBytesZ InvoiceRequest_chains(const struct LDKInvoiceRequest *NONNULL_PTR this_arg);
48572
48573 /**
48574  * Opaque bytes set by the originator. Useful for authentication and validating fields since it
48575  * is reflected in `invoice_request` messages along with all the other fields from the `offer`.
48576  */
48577 MUST_USE_RES struct LDKCOption_CVec_u8ZZ InvoiceRequest_metadata(const struct LDKInvoiceRequest *NONNULL_PTR this_arg);
48578
48579 /**
48580  * The minimum amount required for a successful payment of a single item.
48581  */
48582 MUST_USE_RES struct LDKCOption_AmountZ InvoiceRequest_amount(const struct LDKInvoiceRequest *NONNULL_PTR this_arg);
48583
48584 /**
48585  * A complete description of the purpose of the payment. Intended to be displayed to the user
48586  * but with the caveat that it has not been verified in any way.
48587  *
48588  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
48589  */
48590 MUST_USE_RES struct LDKPrintableString InvoiceRequest_description(const struct LDKInvoiceRequest *NONNULL_PTR this_arg);
48591
48592 /**
48593  * Features pertaining to the offer.
48594  */
48595 MUST_USE_RES struct LDKOfferFeatures InvoiceRequest_offer_features(const struct LDKInvoiceRequest *NONNULL_PTR this_arg);
48596
48597 /**
48598  * Duration since the Unix epoch when an invoice should no longer be requested.
48599  *
48600  * If `None`, the offer does not expire.
48601  */
48602 MUST_USE_RES struct LDKCOption_u64Z InvoiceRequest_absolute_expiry(const struct LDKInvoiceRequest *NONNULL_PTR this_arg);
48603
48604 /**
48605  * The issuer of the offer, possibly beginning with `user@domain` or `domain`. Intended to be
48606  * displayed to the user but with the caveat that it has not been verified in any way.
48607  *
48608  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
48609  */
48610 MUST_USE_RES struct LDKPrintableString InvoiceRequest_issuer(const struct LDKInvoiceRequest *NONNULL_PTR this_arg);
48611
48612 /**
48613  * Paths to the recipient originating from publicly reachable nodes. Blinded paths provide
48614  * recipient privacy by obfuscating its node id.
48615  */
48616 MUST_USE_RES struct LDKCVec_BlindedPathZ InvoiceRequest_paths(const struct LDKInvoiceRequest *NONNULL_PTR this_arg);
48617
48618 /**
48619  * The quantity of items supported.
48620  */
48621 MUST_USE_RES struct LDKQuantity InvoiceRequest_supported_quantity(const struct LDKInvoiceRequest *NONNULL_PTR this_arg);
48622
48623 /**
48624  * The public key used by the recipient to sign invoices.
48625  *
48626  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
48627  */
48628 MUST_USE_RES struct LDKPublicKey InvoiceRequest_signing_pubkey(const struct LDKInvoiceRequest *NONNULL_PTR this_arg);
48629
48630 /**
48631  * An unpredictable series of bytes, typically containing information about the derivation of
48632  * [`payer_id`].
48633  *
48634  * [`payer_id`]: Self::payer_id
48635  */
48636 MUST_USE_RES struct LDKu8slice InvoiceRequest_payer_metadata(const struct LDKInvoiceRequest *NONNULL_PTR this_arg);
48637
48638 /**
48639  * A chain from [`Offer::chains`] that the offer is valid for.
48640  */
48641 MUST_USE_RES struct LDKThirtyTwoBytes InvoiceRequest_chain(const struct LDKInvoiceRequest *NONNULL_PTR this_arg);
48642
48643 /**
48644  * The amount to pay in msats (i.e., the minimum lightning-payable unit for [`chain`]), which
48645  * must be greater than or equal to [`Offer::amount`], converted if necessary.
48646  *
48647  * [`chain`]: Self::chain
48648  */
48649 MUST_USE_RES struct LDKCOption_u64Z InvoiceRequest_amount_msats(const struct LDKInvoiceRequest *NONNULL_PTR this_arg);
48650
48651 /**
48652  * Features pertaining to requesting an invoice.
48653  */
48654 MUST_USE_RES struct LDKInvoiceRequestFeatures InvoiceRequest_invoice_request_features(const struct LDKInvoiceRequest *NONNULL_PTR this_arg);
48655
48656 /**
48657  * The quantity of the offer's item conforming to [`Offer::is_valid_quantity`].
48658  */
48659 MUST_USE_RES struct LDKCOption_u64Z InvoiceRequest_quantity(const struct LDKInvoiceRequest *NONNULL_PTR this_arg);
48660
48661 /**
48662  * A possibly transient pubkey used to sign the invoice request.
48663  */
48664 MUST_USE_RES struct LDKPublicKey InvoiceRequest_payer_id(const struct LDKInvoiceRequest *NONNULL_PTR this_arg);
48665
48666 /**
48667  * A payer-provided note which will be seen by the recipient and reflected back in the invoice
48668  * response.
48669  *
48670  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
48671  */
48672 MUST_USE_RES struct LDKPrintableString InvoiceRequest_payer_note(const struct LDKInvoiceRequest *NONNULL_PTR this_arg);
48673
48674 /**
48675  * Creates an [`InvoiceBuilder`] for the request with the given required fields and using the
48676  * [`Duration`] since [`std::time::SystemTime::UNIX_EPOCH`] as the creation time.
48677  *
48678  * See [`InvoiceRequest::respond_with_no_std`] for further details where the aforementioned
48679  * creation time is used for the `created_at` parameter.
48680  *
48681  * [`Duration`]: core::time::Duration
48682  */
48683 MUST_USE_RES struct LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ InvoiceRequest_respond_with(const struct LDKInvoiceRequest *NONNULL_PTR this_arg, struct LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ payment_paths, struct LDKThirtyTwoBytes payment_hash);
48684
48685 /**
48686  * Creates an [`InvoiceBuilder`] for the request with the given required fields.
48687  *
48688  * Unless [`InvoiceBuilder::relative_expiry`] is set, the invoice will expire two hours after
48689  * `created_at`, which is used to set [`Bolt12Invoice::created_at`]. Useful for `no-std` builds
48690  * where [`std::time::SystemTime`] is not available.
48691  *
48692  * The caller is expected to remember the preimage of `payment_hash` in order to claim a payment
48693  * for the invoice.
48694  *
48695  * The `payment_paths` parameter is useful for maintaining the payment recipient's privacy. It
48696  * must contain one or more elements ordered from most-preferred to least-preferred, if there's
48697  * a preference. Note, however, that any privacy is lost if a public node id was used for
48698  * [`Offer::signing_pubkey`].
48699  *
48700  * Errors if the request contains unknown required features.
48701  *
48702  * # Note
48703  *
48704  * If the originating [`Offer`] was created using [`OfferBuilder::deriving_signing_pubkey`],
48705  * then use [`InvoiceRequest::verify`] and [`VerifiedInvoiceRequest`] methods instead.
48706  *
48707  * [`Bolt12Invoice::created_at`]: crate::offers::invoice::Bolt12Invoice::created_at
48708  * [`OfferBuilder::deriving_signing_pubkey`]: crate::offers::offer::OfferBuilder::deriving_signing_pubkey
48709  */
48710 MUST_USE_RES struct LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ InvoiceRequest_respond_with_no_std(const struct LDKInvoiceRequest *NONNULL_PTR this_arg, struct LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ payment_paths, struct LDKThirtyTwoBytes payment_hash, uint64_t created_at);
48711
48712 /**
48713  * Verifies that the request was for an offer created using the given key. Returns the verified
48714  * request which contains the derived keys needed to sign a [`Bolt12Invoice`] for the request
48715  * if they could be extracted from the metadata.
48716  *
48717  * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
48718  */
48719 MUST_USE_RES struct LDKCResult_VerifiedInvoiceRequestNoneZ InvoiceRequest_verify(struct LDKInvoiceRequest this_arg, const struct LDKExpandedKey *NONNULL_PTR key);
48720
48721 /**
48722  * Signature of the invoice request using [`payer_id`].
48723  *
48724  * [`payer_id`]: Self::payer_id
48725  */
48726 MUST_USE_RES struct LDKSchnorrSignature InvoiceRequest_signature(const struct LDKInvoiceRequest *NONNULL_PTR this_arg);
48727
48728 /**
48729  * The chains that may be used when paying a requested invoice (e.g., bitcoin mainnet).
48730  * Payments must be denominated in units of the minimal lightning-payable unit (e.g., msats)
48731  * for the selected chain.
48732  */
48733 MUST_USE_RES struct LDKCVec_ThirtyTwoBytesZ VerifiedInvoiceRequest_chains(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg);
48734
48735 /**
48736  * Opaque bytes set by the originator. Useful for authentication and validating fields since it
48737  * is reflected in `invoice_request` messages along with all the other fields from the `offer`.
48738  */
48739 MUST_USE_RES struct LDKCOption_CVec_u8ZZ VerifiedInvoiceRequest_metadata(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg);
48740
48741 /**
48742  * The minimum amount required for a successful payment of a single item.
48743  */
48744 MUST_USE_RES struct LDKCOption_AmountZ VerifiedInvoiceRequest_amount(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg);
48745
48746 /**
48747  * A complete description of the purpose of the payment. Intended to be displayed to the user
48748  * but with the caveat that it has not been verified in any way.
48749  *
48750  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
48751  */
48752 MUST_USE_RES struct LDKPrintableString VerifiedInvoiceRequest_description(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg);
48753
48754 /**
48755  * Features pertaining to the offer.
48756  */
48757 MUST_USE_RES struct LDKOfferFeatures VerifiedInvoiceRequest_offer_features(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg);
48758
48759 /**
48760  * Duration since the Unix epoch when an invoice should no longer be requested.
48761  *
48762  * If `None`, the offer does not expire.
48763  */
48764 MUST_USE_RES struct LDKCOption_u64Z VerifiedInvoiceRequest_absolute_expiry(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg);
48765
48766 /**
48767  * The issuer of the offer, possibly beginning with `user@domain` or `domain`. Intended to be
48768  * displayed to the user but with the caveat that it has not been verified in any way.
48769  *
48770  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
48771  */
48772 MUST_USE_RES struct LDKPrintableString VerifiedInvoiceRequest_issuer(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg);
48773
48774 /**
48775  * Paths to the recipient originating from publicly reachable nodes. Blinded paths provide
48776  * recipient privacy by obfuscating its node id.
48777  */
48778 MUST_USE_RES struct LDKCVec_BlindedPathZ VerifiedInvoiceRequest_paths(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg);
48779
48780 /**
48781  * The quantity of items supported.
48782  */
48783 MUST_USE_RES struct LDKQuantity VerifiedInvoiceRequest_supported_quantity(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg);
48784
48785 /**
48786  * The public key used by the recipient to sign invoices.
48787  *
48788  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
48789  */
48790 MUST_USE_RES struct LDKPublicKey VerifiedInvoiceRequest_signing_pubkey(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg);
48791
48792 /**
48793  * An unpredictable series of bytes, typically containing information about the derivation of
48794  * [`payer_id`].
48795  *
48796  * [`payer_id`]: Self::payer_id
48797  */
48798 MUST_USE_RES struct LDKu8slice VerifiedInvoiceRequest_payer_metadata(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg);
48799
48800 /**
48801  * A chain from [`Offer::chains`] that the offer is valid for.
48802  */
48803 MUST_USE_RES struct LDKThirtyTwoBytes VerifiedInvoiceRequest_chain(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg);
48804
48805 /**
48806  * The amount to pay in msats (i.e., the minimum lightning-payable unit for [`chain`]), which
48807  * must be greater than or equal to [`Offer::amount`], converted if necessary.
48808  *
48809  * [`chain`]: Self::chain
48810  */
48811 MUST_USE_RES struct LDKCOption_u64Z VerifiedInvoiceRequest_amount_msats(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg);
48812
48813 /**
48814  * Features pertaining to requesting an invoice.
48815  */
48816 MUST_USE_RES struct LDKInvoiceRequestFeatures VerifiedInvoiceRequest_invoice_request_features(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg);
48817
48818 /**
48819  * The quantity of the offer's item conforming to [`Offer::is_valid_quantity`].
48820  */
48821 MUST_USE_RES struct LDKCOption_u64Z VerifiedInvoiceRequest_quantity(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg);
48822
48823 /**
48824  * A possibly transient pubkey used to sign the invoice request.
48825  */
48826 MUST_USE_RES struct LDKPublicKey VerifiedInvoiceRequest_payer_id(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg);
48827
48828 /**
48829  * A payer-provided note which will be seen by the recipient and reflected back in the invoice
48830  * response.
48831  *
48832  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
48833  */
48834 MUST_USE_RES struct LDKPrintableString VerifiedInvoiceRequest_payer_note(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg);
48835
48836 /**
48837  * Creates an [`InvoiceBuilder`] for the request with the given required fields and using the
48838  * [`Duration`] since [`std::time::SystemTime::UNIX_EPOCH`] as the creation time.
48839  *
48840  * See [`InvoiceRequest::respond_with_no_std`] for further details where the aforementioned
48841  * creation time is used for the `created_at` parameter.
48842  *
48843  * [`Duration`]: core::time::Duration
48844  */
48845 MUST_USE_RES struct LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ VerifiedInvoiceRequest_respond_with(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg, struct LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ payment_paths, struct LDKThirtyTwoBytes payment_hash);
48846
48847 /**
48848  * Creates an [`InvoiceBuilder`] for the request with the given required fields.
48849  *
48850  * Unless [`InvoiceBuilder::relative_expiry`] is set, the invoice will expire two hours after
48851  * `created_at`, which is used to set [`Bolt12Invoice::created_at`]. Useful for `no-std` builds
48852  * where [`std::time::SystemTime`] is not available.
48853  *
48854  * The caller is expected to remember the preimage of `payment_hash` in order to claim a payment
48855  * for the invoice.
48856  *
48857  * The `payment_paths` parameter is useful for maintaining the payment recipient's privacy. It
48858  * must contain one or more elements ordered from most-preferred to least-preferred, if there's
48859  * a preference. Note, however, that any privacy is lost if a public node id was used for
48860  * [`Offer::signing_pubkey`].
48861  *
48862  * Errors if the request contains unknown required features.
48863  *
48864  * # Note
48865  *
48866  * If the originating [`Offer`] was created using [`OfferBuilder::deriving_signing_pubkey`],
48867  * then use [`InvoiceRequest::verify`] and [`VerifiedInvoiceRequest`] methods instead.
48868  *
48869  * [`Bolt12Invoice::created_at`]: crate::offers::invoice::Bolt12Invoice::created_at
48870  * [`OfferBuilder::deriving_signing_pubkey`]: crate::offers::offer::OfferBuilder::deriving_signing_pubkey
48871  */
48872 MUST_USE_RES struct LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ VerifiedInvoiceRequest_respond_with_no_std(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg, struct LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ payment_paths, struct LDKThirtyTwoBytes payment_hash, uint64_t created_at);
48873
48874 /**
48875  * Creates an [`InvoiceBuilder`] for the request using the given required fields and that uses
48876  * derived signing keys from the originating [`Offer`] to sign the [`Bolt12Invoice`]. Must use
48877  * the same [`ExpandedKey`] as the one used to create the offer.
48878  *
48879  * See [`InvoiceRequest::respond_with`] for further details.
48880  *
48881  * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
48882  */
48883 MUST_USE_RES struct LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ VerifiedInvoiceRequest_respond_using_derived_keys(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg, struct LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ payment_paths, struct LDKThirtyTwoBytes payment_hash);
48884
48885 /**
48886  * Creates an [`InvoiceBuilder`] for the request using the given required fields and that uses
48887  * derived signing keys from the originating [`Offer`] to sign the [`Bolt12Invoice`]. Must use
48888  * the same [`ExpandedKey`] as the one used to create the offer.
48889  *
48890  * See [`InvoiceRequest::respond_with_no_std`] for further details.
48891  *
48892  * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
48893  */
48894 MUST_USE_RES struct LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ VerifiedInvoiceRequest_respond_using_derived_keys_no_std(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg, struct LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ payment_paths, struct LDKThirtyTwoBytes payment_hash, uint64_t created_at);
48895
48896 /**
48897  * Serialize the UnsignedInvoiceRequest object into a byte array which can be read by UnsignedInvoiceRequest_read
48898  */
48899 struct LDKCVec_u8Z UnsignedInvoiceRequest_write(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR obj);
48900
48901 /**
48902  * Serialize the InvoiceRequest object into a byte array which can be read by InvoiceRequest_read
48903  */
48904 struct LDKCVec_u8Z InvoiceRequest_write(const struct LDKInvoiceRequest *NONNULL_PTR obj);
48905
48906 /**
48907  * Frees any resources used by the InvoiceRequestFields, if is_owned is set and inner is non-NULL.
48908  */
48909 void InvoiceRequestFields_free(struct LDKInvoiceRequestFields this_obj);
48910
48911 /**
48912  * A possibly transient pubkey used to sign the invoice request.
48913  */
48914 struct LDKPublicKey InvoiceRequestFields_get_payer_id(const struct LDKInvoiceRequestFields *NONNULL_PTR this_ptr);
48915
48916 /**
48917  * A possibly transient pubkey used to sign the invoice request.
48918  */
48919 void InvoiceRequestFields_set_payer_id(struct LDKInvoiceRequestFields *NONNULL_PTR this_ptr, struct LDKPublicKey val);
48920
48921 /**
48922  * The quantity of the offer's item conforming to [`Offer::is_valid_quantity`].
48923  */
48924 struct LDKCOption_u64Z InvoiceRequestFields_get_quantity(const struct LDKInvoiceRequestFields *NONNULL_PTR this_ptr);
48925
48926 /**
48927  * The quantity of the offer's item conforming to [`Offer::is_valid_quantity`].
48928  */
48929 void InvoiceRequestFields_set_quantity(struct LDKInvoiceRequestFields *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
48930
48931 /**
48932  * A payer-provided note which will be seen by the recipient and reflected back in the invoice
48933  * response. Truncated to [`PAYER_NOTE_LIMIT`] characters.
48934  *
48935  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
48936  */
48937 struct LDKUntrustedString InvoiceRequestFields_get_payer_note_truncated(const struct LDKInvoiceRequestFields *NONNULL_PTR this_ptr);
48938
48939 /**
48940  * A payer-provided note which will be seen by the recipient and reflected back in the invoice
48941  * response. Truncated to [`PAYER_NOTE_LIMIT`] characters.
48942  *
48943  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
48944  */
48945 void InvoiceRequestFields_set_payer_note_truncated(struct LDKInvoiceRequestFields *NONNULL_PTR this_ptr, struct LDKUntrustedString val);
48946
48947 /**
48948  * Constructs a new InvoiceRequestFields given each field
48949  *
48950  * Note that payer_note_truncated_arg (or a relevant inner pointer) may be NULL or all-0s to represent None
48951  */
48952 MUST_USE_RES struct LDKInvoiceRequestFields InvoiceRequestFields_new(struct LDKPublicKey payer_id_arg, struct LDKCOption_u64Z quantity_arg, struct LDKUntrustedString payer_note_truncated_arg);
48953
48954 /**
48955  * Creates a copy of the InvoiceRequestFields
48956  */
48957 struct LDKInvoiceRequestFields InvoiceRequestFields_clone(const struct LDKInvoiceRequestFields *NONNULL_PTR orig);
48958
48959 /**
48960  * Checks if two InvoiceRequestFieldss contain equal inner contents.
48961  * This ignores pointers and is_owned flags and looks at the values in fields.
48962  * Two objects with NULL inner values will be considered "equal" here.
48963  */
48964 bool InvoiceRequestFields_eq(const struct LDKInvoiceRequestFields *NONNULL_PTR a, const struct LDKInvoiceRequestFields *NONNULL_PTR b);
48965
48966 /**
48967  * Serialize the InvoiceRequestFields object into a byte array which can be read by InvoiceRequestFields_read
48968  */
48969 struct LDKCVec_u8Z InvoiceRequestFields_write(const struct LDKInvoiceRequestFields *NONNULL_PTR obj);
48970
48971 /**
48972  * Read a InvoiceRequestFields from a byte array, created by InvoiceRequestFields_write
48973  */
48974 struct LDKCResult_InvoiceRequestFieldsDecodeErrorZ InvoiceRequestFields_read(struct LDKu8slice ser);
48975
48976 /**
48977  * Frees any resources used by the TaggedHash, if is_owned is set and inner is non-NULL.
48978  */
48979 void TaggedHash_free(struct LDKTaggedHash this_obj);
48980
48981 /**
48982  * Creates a copy of the TaggedHash
48983  */
48984 struct LDKTaggedHash TaggedHash_clone(const struct LDKTaggedHash *NONNULL_PTR orig);
48985
48986 /**
48987  * Returns the digest to sign.
48988  */
48989 MUST_USE_RES const uint8_t (*TaggedHash_as_digest(const struct LDKTaggedHash *NONNULL_PTR this_arg))[32];
48990
48991 /**
48992  * Returns the tag used in the tagged hash.
48993  */
48994 MUST_USE_RES struct LDKStr TaggedHash_tag(const struct LDKTaggedHash *NONNULL_PTR this_arg);
48995
48996 /**
48997  * Returns the merkle root used in the tagged hash.
48998  */
48999 MUST_USE_RES struct LDKThirtyTwoBytes TaggedHash_merkle_root(const struct LDKTaggedHash *NONNULL_PTR this_arg);
49000
49001 /**
49002  * Frees any resources used by the SignError
49003  */
49004 void SignError_free(struct LDKSignError this_ptr);
49005
49006 /**
49007  * Creates a copy of the SignError
49008  */
49009 struct LDKSignError SignError_clone(const struct LDKSignError *NONNULL_PTR orig);
49010
49011 /**
49012  * Utility method to constructs a new Signing-variant SignError
49013  */
49014 struct LDKSignError SignError_signing(void);
49015
49016 /**
49017  * Utility method to constructs a new Verification-variant SignError
49018  */
49019 struct LDKSignError SignError_verification(enum LDKSecp256k1Error a);
49020
49021 /**
49022  * Frees any resources used by the Bolt12ParseError, if is_owned is set and inner is non-NULL.
49023  */
49024 void Bolt12ParseError_free(struct LDKBolt12ParseError this_obj);
49025
49026 /**
49027  * Creates a copy of the Bolt12ParseError
49028  */
49029 struct LDKBolt12ParseError Bolt12ParseError_clone(const struct LDKBolt12ParseError *NONNULL_PTR orig);
49030
49031 /**
49032  * Creates a copy of the Bolt12SemanticError
49033  */
49034 enum LDKBolt12SemanticError Bolt12SemanticError_clone(const enum LDKBolt12SemanticError *NONNULL_PTR orig);
49035
49036 /**
49037  * Utility method to constructs a new AlreadyExpired-variant Bolt12SemanticError
49038  */
49039 enum LDKBolt12SemanticError Bolt12SemanticError_already_expired(void);
49040
49041 /**
49042  * Utility method to constructs a new UnsupportedChain-variant Bolt12SemanticError
49043  */
49044 enum LDKBolt12SemanticError Bolt12SemanticError_unsupported_chain(void);
49045
49046 /**
49047  * Utility method to constructs a new UnexpectedChain-variant Bolt12SemanticError
49048  */
49049 enum LDKBolt12SemanticError Bolt12SemanticError_unexpected_chain(void);
49050
49051 /**
49052  * Utility method to constructs a new MissingAmount-variant Bolt12SemanticError
49053  */
49054 enum LDKBolt12SemanticError Bolt12SemanticError_missing_amount(void);
49055
49056 /**
49057  * Utility method to constructs a new InvalidAmount-variant Bolt12SemanticError
49058  */
49059 enum LDKBolt12SemanticError Bolt12SemanticError_invalid_amount(void);
49060
49061 /**
49062  * Utility method to constructs a new InsufficientAmount-variant Bolt12SemanticError
49063  */
49064 enum LDKBolt12SemanticError Bolt12SemanticError_insufficient_amount(void);
49065
49066 /**
49067  * Utility method to constructs a new UnexpectedAmount-variant Bolt12SemanticError
49068  */
49069 enum LDKBolt12SemanticError Bolt12SemanticError_unexpected_amount(void);
49070
49071 /**
49072  * Utility method to constructs a new UnsupportedCurrency-variant Bolt12SemanticError
49073  */
49074 enum LDKBolt12SemanticError Bolt12SemanticError_unsupported_currency(void);
49075
49076 /**
49077  * Utility method to constructs a new UnknownRequiredFeatures-variant Bolt12SemanticError
49078  */
49079 enum LDKBolt12SemanticError Bolt12SemanticError_unknown_required_features(void);
49080
49081 /**
49082  * Utility method to constructs a new UnexpectedFeatures-variant Bolt12SemanticError
49083  */
49084 enum LDKBolt12SemanticError Bolt12SemanticError_unexpected_features(void);
49085
49086 /**
49087  * Utility method to constructs a new MissingDescription-variant Bolt12SemanticError
49088  */
49089 enum LDKBolt12SemanticError Bolt12SemanticError_missing_description(void);
49090
49091 /**
49092  * Utility method to constructs a new MissingSigningPubkey-variant Bolt12SemanticError
49093  */
49094 enum LDKBolt12SemanticError Bolt12SemanticError_missing_signing_pubkey(void);
49095
49096 /**
49097  * Utility method to constructs a new InvalidSigningPubkey-variant Bolt12SemanticError
49098  */
49099 enum LDKBolt12SemanticError Bolt12SemanticError_invalid_signing_pubkey(void);
49100
49101 /**
49102  * Utility method to constructs a new UnexpectedSigningPubkey-variant Bolt12SemanticError
49103  */
49104 enum LDKBolt12SemanticError Bolt12SemanticError_unexpected_signing_pubkey(void);
49105
49106 /**
49107  * Utility method to constructs a new MissingQuantity-variant Bolt12SemanticError
49108  */
49109 enum LDKBolt12SemanticError Bolt12SemanticError_missing_quantity(void);
49110
49111 /**
49112  * Utility method to constructs a new InvalidQuantity-variant Bolt12SemanticError
49113  */
49114 enum LDKBolt12SemanticError Bolt12SemanticError_invalid_quantity(void);
49115
49116 /**
49117  * Utility method to constructs a new UnexpectedQuantity-variant Bolt12SemanticError
49118  */
49119 enum LDKBolt12SemanticError Bolt12SemanticError_unexpected_quantity(void);
49120
49121 /**
49122  * Utility method to constructs a new InvalidMetadata-variant Bolt12SemanticError
49123  */
49124 enum LDKBolt12SemanticError Bolt12SemanticError_invalid_metadata(void);
49125
49126 /**
49127  * Utility method to constructs a new UnexpectedMetadata-variant Bolt12SemanticError
49128  */
49129 enum LDKBolt12SemanticError Bolt12SemanticError_unexpected_metadata(void);
49130
49131 /**
49132  * Utility method to constructs a new MissingPayerMetadata-variant Bolt12SemanticError
49133  */
49134 enum LDKBolt12SemanticError Bolt12SemanticError_missing_payer_metadata(void);
49135
49136 /**
49137  * Utility method to constructs a new MissingPayerId-variant Bolt12SemanticError
49138  */
49139 enum LDKBolt12SemanticError Bolt12SemanticError_missing_payer_id(void);
49140
49141 /**
49142  * Utility method to constructs a new DuplicatePaymentId-variant Bolt12SemanticError
49143  */
49144 enum LDKBolt12SemanticError Bolt12SemanticError_duplicate_payment_id(void);
49145
49146 /**
49147  * Utility method to constructs a new MissingPaths-variant Bolt12SemanticError
49148  */
49149 enum LDKBolt12SemanticError Bolt12SemanticError_missing_paths(void);
49150
49151 /**
49152  * Utility method to constructs a new UnexpectedPaths-variant Bolt12SemanticError
49153  */
49154 enum LDKBolt12SemanticError Bolt12SemanticError_unexpected_paths(void);
49155
49156 /**
49157  * Utility method to constructs a new InvalidPayInfo-variant Bolt12SemanticError
49158  */
49159 enum LDKBolt12SemanticError Bolt12SemanticError_invalid_pay_info(void);
49160
49161 /**
49162  * Utility method to constructs a new MissingCreationTime-variant Bolt12SemanticError
49163  */
49164 enum LDKBolt12SemanticError Bolt12SemanticError_missing_creation_time(void);
49165
49166 /**
49167  * Utility method to constructs a new MissingPaymentHash-variant Bolt12SemanticError
49168  */
49169 enum LDKBolt12SemanticError Bolt12SemanticError_missing_payment_hash(void);
49170
49171 /**
49172  * Utility method to constructs a new MissingSignature-variant Bolt12SemanticError
49173  */
49174 enum LDKBolt12SemanticError Bolt12SemanticError_missing_signature(void);
49175
49176 /**
49177  * Frees any resources used by the RefundMaybeWithDerivedMetadataBuilder, if is_owned is set and inner is non-NULL.
49178  */
49179 void RefundMaybeWithDerivedMetadataBuilder_free(struct LDKRefundMaybeWithDerivedMetadataBuilder this_obj);
49180
49181 /**
49182  * Creates a copy of the RefundMaybeWithDerivedMetadataBuilder
49183  */
49184 struct LDKRefundMaybeWithDerivedMetadataBuilder RefundMaybeWithDerivedMetadataBuilder_clone(const struct LDKRefundMaybeWithDerivedMetadataBuilder *NONNULL_PTR orig);
49185
49186 /**
49187  * Creates a new builder for a refund using the [`Refund::payer_id`] for the public node id to
49188  * send to if no [`Refund::paths`] are set. Otherwise, it may be a transient pubkey.
49189  *
49190  * Additionally, sets the required (empty) [`Refund::description`], [`Refund::payer_metadata`],
49191  * and [`Refund::amount_msats`].
49192  *
49193  * # Note
49194  *
49195  * If constructing a [`Refund`] for use with a [`ChannelManager`], use
49196  * [`ChannelManager::create_refund_builder`] instead of [`RefundBuilder::new`].
49197  *
49198  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
49199  * [`ChannelManager::create_refund_builder`]: crate::ln::channelmanager::ChannelManager::create_refund_builder
49200  */
49201 MUST_USE_RES struct LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ RefundMaybeWithDerivedMetadataBuilder_new(struct LDKCVec_u8Z metadata, struct LDKPublicKey payer_id, uint64_t amount_msats);
49202
49203 /**
49204  * Similar to [`RefundBuilder::new`] except, if [`RefundBuilder::path`] is called, the payer id
49205  * is derived from the given [`ExpandedKey`] and nonce. This provides sender privacy by using a
49206  * different payer id for each refund, assuming a different nonce is used.  Otherwise, the
49207  * provided `node_id` is used for the payer id.
49208  *
49209  * Also, sets the metadata when [`RefundBuilder::build`] is called such that it can be used to
49210  * verify that an [`InvoiceRequest`] was produced for the refund given an [`ExpandedKey`].
49211  *
49212  * The `payment_id` is encrypted in the metadata and should be unique. This ensures that only
49213  * one invoice will be paid for the refund and that payments can be uniquely identified.
49214  *
49215  * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
49216  * [`ExpandedKey`]: crate::ln::inbound_payment::ExpandedKey
49217  */
49218 MUST_USE_RES struct LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ RefundMaybeWithDerivedMetadataBuilder_deriving_payer_id(struct LDKPublicKey node_id, const struct LDKExpandedKey *NONNULL_PTR expanded_key, struct LDKEntropySource entropy_source, uint64_t amount_msats, struct LDKThirtyTwoBytes payment_id);
49219
49220 /**
49221  * Sets the [`Refund::description`].
49222  *
49223  * Successive calls to this method will override the previous setting.
49224  */
49225 MUST_USE_RES void RefundMaybeWithDerivedMetadataBuilder_description(struct LDKRefundMaybeWithDerivedMetadataBuilder this_arg, struct LDKStr description);
49226
49227 /**
49228  * Sets the [`Refund::absolute_expiry`] as seconds since the Unix epoch. Any expiry that has
49229  * already passed is valid and can be checked for using [`Refund::is_expired`].
49230  *
49231  * Successive calls to this method will override the previous setting.
49232  */
49233 MUST_USE_RES void RefundMaybeWithDerivedMetadataBuilder_absolute_expiry(struct LDKRefundMaybeWithDerivedMetadataBuilder this_arg, uint64_t absolute_expiry);
49234
49235 /**
49236  * Sets the [`Refund::issuer`].
49237  *
49238  * Successive calls to this method will override the previous setting.
49239  */
49240 MUST_USE_RES void RefundMaybeWithDerivedMetadataBuilder_issuer(struct LDKRefundMaybeWithDerivedMetadataBuilder this_arg, struct LDKStr issuer);
49241
49242 /**
49243  * Adds a blinded path to [`Refund::paths`]. Must include at least one path if only connected
49244  * by private channels or if [`Refund::payer_id`] is not a public node id.
49245  *
49246  * Successive calls to this method will add another blinded path. Caller is responsible for not
49247  * adding duplicate paths.
49248  */
49249 MUST_USE_RES void RefundMaybeWithDerivedMetadataBuilder_path(struct LDKRefundMaybeWithDerivedMetadataBuilder this_arg, struct LDKBlindedPath path);
49250
49251 /**
49252  * Sets the [`Refund::chain`] of the given [`Network`] for paying an invoice. If not
49253  * called, [`Network::Bitcoin`] is assumed.
49254  *
49255  * Successive calls to this method will override the previous setting.
49256  */
49257 MUST_USE_RES void RefundMaybeWithDerivedMetadataBuilder_chain(struct LDKRefundMaybeWithDerivedMetadataBuilder this_arg, enum LDKNetwork network);
49258
49259 /**
49260  * Sets [`Refund::quantity`] of items. This is purely for informational purposes. It is useful
49261  * when the refund pertains to a [`Bolt12Invoice`] that paid for more than one item from an
49262  * [`Offer`] as specified by [`InvoiceRequest::quantity`].
49263  *
49264  * Successive calls to this method will override the previous setting.
49265  *
49266  * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
49267  * [`InvoiceRequest::quantity`]: crate::offers::invoice_request::InvoiceRequest::quantity
49268  * [`Offer`]: crate::offers::offer::Offer
49269  */
49270 MUST_USE_RES void RefundMaybeWithDerivedMetadataBuilder_quantity(struct LDKRefundMaybeWithDerivedMetadataBuilder this_arg, uint64_t quantity);
49271
49272 /**
49273  * Sets the [`Refund::payer_note`].
49274  *
49275  * Successive calls to this method will override the previous setting.
49276  */
49277 MUST_USE_RES void RefundMaybeWithDerivedMetadataBuilder_payer_note(struct LDKRefundMaybeWithDerivedMetadataBuilder this_arg, struct LDKStr payer_note);
49278
49279 /**
49280  * Builds a [`Refund`] after checking for valid semantics.
49281  */
49282 MUST_USE_RES struct LDKCResult_RefundBolt12SemanticErrorZ RefundMaybeWithDerivedMetadataBuilder_build(struct LDKRefundMaybeWithDerivedMetadataBuilder this_arg);
49283
49284 /**
49285  * Frees any resources used by the Refund, if is_owned is set and inner is non-NULL.
49286  */
49287 void Refund_free(struct LDKRefund this_obj);
49288
49289 /**
49290  * Creates a copy of the Refund
49291  */
49292 struct LDKRefund Refund_clone(const struct LDKRefund *NONNULL_PTR orig);
49293
49294 /**
49295  * A complete description of the purpose of the refund. Intended to be displayed to the user
49296  * but with the caveat that it has not been verified in any way.
49297  */
49298 MUST_USE_RES struct LDKPrintableString Refund_description(const struct LDKRefund *NONNULL_PTR this_arg);
49299
49300 /**
49301  * Duration since the Unix epoch when an invoice should no longer be sent.
49302  *
49303  * If `None`, the refund does not expire.
49304  */
49305 MUST_USE_RES struct LDKCOption_u64Z Refund_absolute_expiry(const struct LDKRefund *NONNULL_PTR this_arg);
49306
49307 /**
49308  * Whether the refund has expired.
49309  */
49310 MUST_USE_RES bool Refund_is_expired(const struct LDKRefund *NONNULL_PTR this_arg);
49311
49312 /**
49313  * Whether the refund has expired given the duration since the Unix epoch.
49314  */
49315 MUST_USE_RES bool Refund_is_expired_no_std(const struct LDKRefund *NONNULL_PTR this_arg, uint64_t duration_since_epoch);
49316
49317 /**
49318  * The issuer of the refund, possibly beginning with `user@domain` or `domain`. Intended to be
49319  * displayed to the user but with the caveat that it has not been verified in any way.
49320  *
49321  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
49322  */
49323 MUST_USE_RES struct LDKPrintableString Refund_issuer(const struct LDKRefund *NONNULL_PTR this_arg);
49324
49325 /**
49326  * Paths to the sender originating from publicly reachable nodes. Blinded paths provide sender
49327  * privacy by obfuscating its node id.
49328  */
49329 MUST_USE_RES struct LDKCVec_BlindedPathZ Refund_paths(const struct LDKRefund *NONNULL_PTR this_arg);
49330
49331 /**
49332  * An unpredictable series of bytes, typically containing information about the derivation of
49333  * [`payer_id`].
49334  *
49335  * [`payer_id`]: Self::payer_id
49336  */
49337 MUST_USE_RES struct LDKu8slice Refund_payer_metadata(const struct LDKRefund *NONNULL_PTR this_arg);
49338
49339 /**
49340  * A chain that the refund is valid for.
49341  */
49342 MUST_USE_RES struct LDKThirtyTwoBytes Refund_chain(const struct LDKRefund *NONNULL_PTR this_arg);
49343
49344 /**
49345  * The amount to refund in msats (i.e., the minimum lightning-payable unit for [`chain`]).
49346  *
49347  * [`chain`]: Self::chain
49348  */
49349 MUST_USE_RES uint64_t Refund_amount_msats(const struct LDKRefund *NONNULL_PTR this_arg);
49350
49351 /**
49352  * Features pertaining to requesting an invoice.
49353  */
49354 MUST_USE_RES struct LDKInvoiceRequestFeatures Refund_features(const struct LDKRefund *NONNULL_PTR this_arg);
49355
49356 /**
49357  * The quantity of an item that refund is for.
49358  */
49359 MUST_USE_RES struct LDKCOption_u64Z Refund_quantity(const struct LDKRefund *NONNULL_PTR this_arg);
49360
49361 /**
49362  * A public node id to send to in the case where there are no [`paths`]. Otherwise, a possibly
49363  * transient pubkey.
49364  *
49365  * [`paths`]: Self::paths
49366  */
49367 MUST_USE_RES struct LDKPublicKey Refund_payer_id(const struct LDKRefund *NONNULL_PTR this_arg);
49368
49369 /**
49370  * Payer provided note to include in the invoice.
49371  *
49372  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
49373  */
49374 MUST_USE_RES struct LDKPrintableString Refund_payer_note(const struct LDKRefund *NONNULL_PTR this_arg);
49375
49376 /**
49377  * Generates a non-cryptographic 64-bit hash of the Refund.
49378  */
49379 uint64_t Refund_hash(const struct LDKRefund *NONNULL_PTR o);
49380
49381 /**
49382  * Serialize the Refund object into a byte array which can be read by Refund_read
49383  */
49384 struct LDKCVec_u8Z Refund_write(const struct LDKRefund *NONNULL_PTR obj);
49385
49386 /**
49387  * Read a Refund object from a string
49388  */
49389 struct LDKCResult_RefundBolt12ParseErrorZ Refund_from_str(struct LDKStr s);
49390
49391 /**
49392  * Creates a copy of the UtxoLookupError
49393  */
49394 enum LDKUtxoLookupError UtxoLookupError_clone(const enum LDKUtxoLookupError *NONNULL_PTR orig);
49395
49396 /**
49397  * Utility method to constructs a new UnknownChain-variant UtxoLookupError
49398  */
49399 enum LDKUtxoLookupError UtxoLookupError_unknown_chain(void);
49400
49401 /**
49402  * Utility method to constructs a new UnknownTx-variant UtxoLookupError
49403  */
49404 enum LDKUtxoLookupError UtxoLookupError_unknown_tx(void);
49405
49406 /**
49407  * Frees any resources used by the UtxoResult
49408  */
49409 void UtxoResult_free(struct LDKUtxoResult this_ptr);
49410
49411 /**
49412  * Creates a copy of the UtxoResult
49413  */
49414 struct LDKUtxoResult UtxoResult_clone(const struct LDKUtxoResult *NONNULL_PTR orig);
49415
49416 /**
49417  * Utility method to constructs a new Sync-variant UtxoResult
49418  */
49419 struct LDKUtxoResult UtxoResult_sync(struct LDKCResult_TxOutUtxoLookupErrorZ a);
49420
49421 /**
49422  * Utility method to constructs a new Async-variant UtxoResult
49423  */
49424 struct LDKUtxoResult UtxoResult_async(struct LDKUtxoFuture a);
49425
49426 /**
49427  * Calls the free function if one is set
49428  */
49429 void UtxoLookup_free(struct LDKUtxoLookup this_ptr);
49430
49431 /**
49432  * Frees any resources used by the UtxoFuture, if is_owned is set and inner is non-NULL.
49433  */
49434 void UtxoFuture_free(struct LDKUtxoFuture this_obj);
49435
49436 /**
49437  * Creates a copy of the UtxoFuture
49438  */
49439 struct LDKUtxoFuture UtxoFuture_clone(const struct LDKUtxoFuture *NONNULL_PTR orig);
49440
49441 /**
49442  * Builds a new future for later resolution.
49443  */
49444 MUST_USE_RES struct LDKUtxoFuture UtxoFuture_new(void);
49445
49446 /**
49447  * Resolves this future against the given `graph` and with the given `result`.
49448  *
49449  * This is identical to calling [`UtxoFuture::resolve`] with a dummy `gossip`, disabling
49450  * forwarding the validated gossip message onwards to peers.
49451  *
49452  * Because this may cause the [`NetworkGraph`]'s [`processing_queue_high`] to flip, in order
49453  * to allow us to interact with peers again, you should call [`PeerManager::process_events`]
49454  * after this.
49455  *
49456  * [`processing_queue_high`]: crate::ln::msgs::RoutingMessageHandler::processing_queue_high
49457  * [`PeerManager::process_events`]: crate::ln::peer_handler::PeerManager::process_events
49458  */
49459 void UtxoFuture_resolve_without_forwarding(const struct LDKUtxoFuture *NONNULL_PTR this_arg, const struct LDKNetworkGraph *NONNULL_PTR graph, struct LDKCResult_TxOutUtxoLookupErrorZ result);
49460
49461 /**
49462  * Resolves this future against the given `graph` and with the given `result`.
49463  *
49464  * The given `gossip` is used to broadcast any validated messages onwards to all peers which
49465  * have available buffer space.
49466  *
49467  * Because this may cause the [`NetworkGraph`]'s [`processing_queue_high`] to flip, in order
49468  * to allow us to interact with peers again, you should call [`PeerManager::process_events`]
49469  * after this.
49470  *
49471  * [`processing_queue_high`]: crate::ln::msgs::RoutingMessageHandler::processing_queue_high
49472  * [`PeerManager::process_events`]: crate::ln::peer_handler::PeerManager::process_events
49473  */
49474 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);
49475
49476 /**
49477  * Frees any resources used by the NodeId, if is_owned is set and inner is non-NULL.
49478  */
49479 void NodeId_free(struct LDKNodeId this_obj);
49480
49481 /**
49482  * Creates a copy of the NodeId
49483  */
49484 struct LDKNodeId NodeId_clone(const struct LDKNodeId *NONNULL_PTR orig);
49485
49486 /**
49487  * Create a new NodeId from a public key
49488  */
49489 MUST_USE_RES struct LDKNodeId NodeId_from_pubkey(struct LDKPublicKey pubkey);
49490
49491 /**
49492  * Create a new NodeId from a slice of bytes
49493  */
49494 MUST_USE_RES struct LDKCResult_NodeIdDecodeErrorZ NodeId_from_slice(struct LDKu8slice bytes);
49495
49496 /**
49497  * Get the public key slice from this NodeId
49498  */
49499 MUST_USE_RES struct LDKu8slice NodeId_as_slice(const struct LDKNodeId *NONNULL_PTR this_arg);
49500
49501 /**
49502  * Get the public key as an array from this NodeId
49503  */
49504 MUST_USE_RES const uint8_t (*NodeId_as_array(const struct LDKNodeId *NONNULL_PTR this_arg))[33];
49505
49506 /**
49507  * Get the public key from this NodeId
49508  */
49509 MUST_USE_RES struct LDKCResult_PublicKeySecp256k1ErrorZ NodeId_as_pubkey(const struct LDKNodeId *NONNULL_PTR this_arg);
49510
49511 /**
49512  * Generates a non-cryptographic 64-bit hash of the NodeId.
49513  */
49514 uint64_t NodeId_hash(const struct LDKNodeId *NONNULL_PTR o);
49515
49516 /**
49517  * Serialize the NodeId object into a byte array which can be read by NodeId_read
49518  */
49519 struct LDKCVec_u8Z NodeId_write(const struct LDKNodeId *NONNULL_PTR obj);
49520
49521 /**
49522  * Read a NodeId from a byte array, created by NodeId_write
49523  */
49524 struct LDKCResult_NodeIdDecodeErrorZ NodeId_read(struct LDKu8slice ser);
49525
49526 /**
49527  * Frees any resources used by the NetworkGraph, if is_owned is set and inner is non-NULL.
49528  */
49529 void NetworkGraph_free(struct LDKNetworkGraph this_obj);
49530
49531 /**
49532  * Frees any resources used by the ReadOnlyNetworkGraph, if is_owned is set and inner is non-NULL.
49533  */
49534 void ReadOnlyNetworkGraph_free(struct LDKReadOnlyNetworkGraph this_obj);
49535
49536 /**
49537  * Frees any resources used by the NetworkUpdate
49538  */
49539 void NetworkUpdate_free(struct LDKNetworkUpdate this_ptr);
49540
49541 /**
49542  * Creates a copy of the NetworkUpdate
49543  */
49544 struct LDKNetworkUpdate NetworkUpdate_clone(const struct LDKNetworkUpdate *NONNULL_PTR orig);
49545
49546 /**
49547  * Utility method to constructs a new ChannelUpdateMessage-variant NetworkUpdate
49548  */
49549 struct LDKNetworkUpdate NetworkUpdate_channel_update_message(struct LDKChannelUpdate msg);
49550
49551 /**
49552  * Utility method to constructs a new ChannelFailure-variant NetworkUpdate
49553  */
49554 struct LDKNetworkUpdate NetworkUpdate_channel_failure(uint64_t short_channel_id, bool is_permanent);
49555
49556 /**
49557  * Utility method to constructs a new NodeFailure-variant NetworkUpdate
49558  */
49559 struct LDKNetworkUpdate NetworkUpdate_node_failure(struct LDKPublicKey node_id, bool is_permanent);
49560
49561 /**
49562  * Checks if two NetworkUpdates contain equal inner contents.
49563  * This ignores pointers and is_owned flags and looks at the values in fields.
49564  */
49565 bool NetworkUpdate_eq(const struct LDKNetworkUpdate *NONNULL_PTR a, const struct LDKNetworkUpdate *NONNULL_PTR b);
49566
49567 /**
49568  * Serialize the NetworkUpdate object into a byte array which can be read by NetworkUpdate_read
49569  */
49570 struct LDKCVec_u8Z NetworkUpdate_write(const struct LDKNetworkUpdate *NONNULL_PTR obj);
49571
49572 /**
49573  * Read a NetworkUpdate from a byte array, created by NetworkUpdate_write
49574  */
49575 struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ NetworkUpdate_read(struct LDKu8slice ser);
49576
49577 /**
49578  * Frees any resources used by the P2PGossipSync, if is_owned is set and inner is non-NULL.
49579  */
49580 void P2PGossipSync_free(struct LDKP2PGossipSync this_obj);
49581
49582 /**
49583  * Creates a new tracker of the actual state of the network of channels and nodes,
49584  * assuming an existing [`NetworkGraph`].
49585  * UTXO lookup is used to make sure announced channels exist on-chain, channel data is
49586  * correct, and the announcement is signed with channel owners' keys.
49587  */
49588 MUST_USE_RES struct LDKP2PGossipSync P2PGossipSync_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKCOption_UtxoLookupZ utxo_lookup, struct LDKLogger logger);
49589
49590 /**
49591  * Adds a provider used to check new announcements. Does not affect
49592  * existing announcements unless they are updated.
49593  * Add, update or remove the provider would replace the current one.
49594  */
49595 void P2PGossipSync_add_utxo_lookup(const struct LDKP2PGossipSync *NONNULL_PTR this_arg, struct LDKCOption_UtxoLookupZ utxo_lookup);
49596
49597 /**
49598  * Handles any network updates originating from [`Event`]s.
49599  * Note that this will skip applying any [`NetworkUpdate::ChannelUpdateMessage`] to avoid
49600  * leaking possibly identifying information of the sender to the public network.
49601  *
49602  * [`Event`]: crate::events::Event
49603  */
49604 void NetworkGraph_handle_network_update(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKNetworkUpdate *NONNULL_PTR network_update);
49605
49606 /**
49607  * Gets the chain hash for this network graph.
49608  */
49609 MUST_USE_RES struct LDKThirtyTwoBytes NetworkGraph_get_chain_hash(const struct LDKNetworkGraph *NONNULL_PTR this_arg);
49610
49611 /**
49612  * Verifies the signature of a [`NodeAnnouncement`].
49613  *
49614  * Returns an error if it is invalid.
49615  */
49616 struct LDKCResult_NoneLightningErrorZ verify_node_announcement(const struct LDKNodeAnnouncement *NONNULL_PTR msg);
49617
49618 /**
49619  * Verifies all signatures included in a [`ChannelAnnouncement`].
49620  *
49621  * Returns an error if one of the signatures is invalid.
49622  */
49623 struct LDKCResult_NoneLightningErrorZ verify_channel_announcement(const struct LDKChannelAnnouncement *NONNULL_PTR msg);
49624
49625 /**
49626  * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg.
49627  * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is
49628  */
49629 struct LDKRoutingMessageHandler P2PGossipSync_as_RoutingMessageHandler(const struct LDKP2PGossipSync *NONNULL_PTR this_arg);
49630
49631 /**
49632  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
49633  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
49634  */
49635 struct LDKMessageSendEventsProvider P2PGossipSync_as_MessageSendEventsProvider(const struct LDKP2PGossipSync *NONNULL_PTR this_arg);
49636
49637 /**
49638  * Frees any resources used by the ChannelUpdateInfo, if is_owned is set and inner is non-NULL.
49639  */
49640 void ChannelUpdateInfo_free(struct LDKChannelUpdateInfo this_obj);
49641
49642 /**
49643  * When the last update to the channel direction was issued.
49644  * Value is opaque, as set in the announcement.
49645  */
49646 uint32_t ChannelUpdateInfo_get_last_update(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
49647
49648 /**
49649  * When the last update to the channel direction was issued.
49650  * Value is opaque, as set in the announcement.
49651  */
49652 void ChannelUpdateInfo_set_last_update(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, uint32_t val);
49653
49654 /**
49655  * Whether the channel can be currently used for payments (in this one direction).
49656  */
49657 bool ChannelUpdateInfo_get_enabled(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
49658
49659 /**
49660  * Whether the channel can be currently used for payments (in this one direction).
49661  */
49662 void ChannelUpdateInfo_set_enabled(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, bool val);
49663
49664 /**
49665  * The difference in CLTV values that you must have when routing through this channel.
49666  */
49667 uint16_t ChannelUpdateInfo_get_cltv_expiry_delta(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
49668
49669 /**
49670  * The difference in CLTV values that you must have when routing through this channel.
49671  */
49672 void ChannelUpdateInfo_set_cltv_expiry_delta(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, uint16_t val);
49673
49674 /**
49675  * The minimum value, which must be relayed to the next hop via the channel
49676  */
49677 uint64_t ChannelUpdateInfo_get_htlc_minimum_msat(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
49678
49679 /**
49680  * The minimum value, which must be relayed to the next hop via the channel
49681  */
49682 void ChannelUpdateInfo_set_htlc_minimum_msat(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, uint64_t val);
49683
49684 /**
49685  * The maximum value which may be relayed to the next hop via the channel.
49686  */
49687 uint64_t ChannelUpdateInfo_get_htlc_maximum_msat(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
49688
49689 /**
49690  * The maximum value which may be relayed to the next hop via the channel.
49691  */
49692 void ChannelUpdateInfo_set_htlc_maximum_msat(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, uint64_t val);
49693
49694 /**
49695  * Fees charged when the channel is used for routing
49696  */
49697 struct LDKRoutingFees ChannelUpdateInfo_get_fees(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
49698
49699 /**
49700  * Fees charged when the channel is used for routing
49701  */
49702 void ChannelUpdateInfo_set_fees(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
49703
49704 /**
49705  * Most recent update for the channel received from the network
49706  * Mostly redundant with the data we store in fields explicitly.
49707  * Everything else is useful only for sending out for initial routing sync.
49708  * Not stored if contains excess data to prevent DoS.
49709  *
49710  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
49711  */
49712 struct LDKChannelUpdate ChannelUpdateInfo_get_last_update_message(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
49713
49714 /**
49715  * Most recent update for the channel received from the network
49716  * Mostly redundant with the data we store in fields explicitly.
49717  * Everything else is useful only for sending out for initial routing sync.
49718  * Not stored if contains excess data to prevent DoS.
49719  *
49720  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
49721  */
49722 void ChannelUpdateInfo_set_last_update_message(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdate val);
49723
49724 /**
49725  * Constructs a new ChannelUpdateInfo given each field
49726  *
49727  * Note that last_update_message_arg (or a relevant inner pointer) may be NULL or all-0s to represent None
49728  */
49729 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);
49730
49731 /**
49732  * Creates a copy of the ChannelUpdateInfo
49733  */
49734 struct LDKChannelUpdateInfo ChannelUpdateInfo_clone(const struct LDKChannelUpdateInfo *NONNULL_PTR orig);
49735
49736 /**
49737  * Checks if two ChannelUpdateInfos contain equal inner contents.
49738  * This ignores pointers and is_owned flags and looks at the values in fields.
49739  * Two objects with NULL inner values will be considered "equal" here.
49740  */
49741 bool ChannelUpdateInfo_eq(const struct LDKChannelUpdateInfo *NONNULL_PTR a, const struct LDKChannelUpdateInfo *NONNULL_PTR b);
49742
49743 /**
49744  * Serialize the ChannelUpdateInfo object into a byte array which can be read by ChannelUpdateInfo_read
49745  */
49746 struct LDKCVec_u8Z ChannelUpdateInfo_write(const struct LDKChannelUpdateInfo *NONNULL_PTR obj);
49747
49748 /**
49749  * Read a ChannelUpdateInfo from a byte array, created by ChannelUpdateInfo_write
49750  */
49751 struct LDKCResult_ChannelUpdateInfoDecodeErrorZ ChannelUpdateInfo_read(struct LDKu8slice ser);
49752
49753 /**
49754  * Frees any resources used by the ChannelInfo, if is_owned is set and inner is non-NULL.
49755  */
49756 void ChannelInfo_free(struct LDKChannelInfo this_obj);
49757
49758 /**
49759  * Protocol features of a channel communicated during its announcement
49760  */
49761 struct LDKChannelFeatures ChannelInfo_get_features(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
49762
49763 /**
49764  * Protocol features of a channel communicated during its announcement
49765  */
49766 void ChannelInfo_set_features(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
49767
49768 /**
49769  * Source node of the first direction of a channel
49770  */
49771 struct LDKNodeId ChannelInfo_get_node_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
49772
49773 /**
49774  * Source node of the first direction of a channel
49775  */
49776 void ChannelInfo_set_node_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKNodeId val);
49777
49778 /**
49779  * Details about the first direction of a channel
49780  *
49781  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
49782  */
49783 struct LDKChannelUpdateInfo ChannelInfo_get_one_to_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
49784
49785 /**
49786  * Details about the first direction of a channel
49787  *
49788  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
49789  */
49790 void ChannelInfo_set_one_to_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdateInfo val);
49791
49792 /**
49793  * Source node of the second direction of a channel
49794  */
49795 struct LDKNodeId ChannelInfo_get_node_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
49796
49797 /**
49798  * Source node of the second direction of a channel
49799  */
49800 void ChannelInfo_set_node_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKNodeId val);
49801
49802 /**
49803  * Details about the second direction of a channel
49804  *
49805  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
49806  */
49807 struct LDKChannelUpdateInfo ChannelInfo_get_two_to_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
49808
49809 /**
49810  * Details about the second direction of a channel
49811  *
49812  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
49813  */
49814 void ChannelInfo_set_two_to_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdateInfo val);
49815
49816 /**
49817  * The channel capacity as seen on-chain, if chain lookup is available.
49818  */
49819 struct LDKCOption_u64Z ChannelInfo_get_capacity_sats(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
49820
49821 /**
49822  * The channel capacity as seen on-chain, if chain lookup is available.
49823  */
49824 void ChannelInfo_set_capacity_sats(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
49825
49826 /**
49827  * An initial announcement of the channel
49828  * Mostly redundant with the data we store in fields explicitly.
49829  * Everything else is useful only for sending out for initial routing sync.
49830  * Not stored if contains excess data to prevent DoS.
49831  *
49832  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
49833  */
49834 struct LDKChannelAnnouncement ChannelInfo_get_announcement_message(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
49835
49836 /**
49837  * An initial announcement of the channel
49838  * Mostly redundant with the data we store in fields explicitly.
49839  * Everything else is useful only for sending out for initial routing sync.
49840  * Not stored if contains excess data to prevent DoS.
49841  *
49842  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
49843  */
49844 void ChannelInfo_set_announcement_message(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelAnnouncement val);
49845
49846 /**
49847  * Creates a copy of the ChannelInfo
49848  */
49849 struct LDKChannelInfo ChannelInfo_clone(const struct LDKChannelInfo *NONNULL_PTR orig);
49850
49851 /**
49852  * Checks if two ChannelInfos contain equal inner contents.
49853  * This ignores pointers and is_owned flags and looks at the values in fields.
49854  * Two objects with NULL inner values will be considered "equal" here.
49855  */
49856 bool ChannelInfo_eq(const struct LDKChannelInfo *NONNULL_PTR a, const struct LDKChannelInfo *NONNULL_PTR b);
49857
49858 /**
49859  * Returns a [`ChannelUpdateInfo`] based on the direction implied by the channel_flag.
49860  *
49861  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
49862  */
49863 MUST_USE_RES struct LDKChannelUpdateInfo ChannelInfo_get_directional_info(const struct LDKChannelInfo *NONNULL_PTR this_arg, uint8_t channel_flags);
49864
49865 /**
49866  * Serialize the ChannelInfo object into a byte array which can be read by ChannelInfo_read
49867  */
49868 struct LDKCVec_u8Z ChannelInfo_write(const struct LDKChannelInfo *NONNULL_PTR obj);
49869
49870 /**
49871  * Read a ChannelInfo from a byte array, created by ChannelInfo_write
49872  */
49873 struct LDKCResult_ChannelInfoDecodeErrorZ ChannelInfo_read(struct LDKu8slice ser);
49874
49875 /**
49876  * Frees any resources used by the DirectedChannelInfo, if is_owned is set and inner is non-NULL.
49877  */
49878 void DirectedChannelInfo_free(struct LDKDirectedChannelInfo this_obj);
49879
49880 /**
49881  * Creates a copy of the DirectedChannelInfo
49882  */
49883 struct LDKDirectedChannelInfo DirectedChannelInfo_clone(const struct LDKDirectedChannelInfo *NONNULL_PTR orig);
49884
49885 /**
49886  * Returns information for the channel.
49887  */
49888 MUST_USE_RES struct LDKChannelInfo DirectedChannelInfo_channel(const struct LDKDirectedChannelInfo *NONNULL_PTR this_arg);
49889
49890 /**
49891  * Returns the [`EffectiveCapacity`] of the channel in the direction.
49892  *
49893  * This is either the total capacity from the funding transaction, if known, or the
49894  * `htlc_maximum_msat` for the direction as advertised by the gossip network, if known,
49895  * otherwise.
49896  */
49897 MUST_USE_RES struct LDKEffectiveCapacity DirectedChannelInfo_effective_capacity(const struct LDKDirectedChannelInfo *NONNULL_PTR this_arg);
49898
49899 /**
49900  * Returns the `node_id` of the source hop.
49901  *
49902  * Refers to the `node_id` forwarding the payment to the next hop.
49903  */
49904 MUST_USE_RES struct LDKNodeId DirectedChannelInfo_source(const struct LDKDirectedChannelInfo *NONNULL_PTR this_arg);
49905
49906 /**
49907  * Returns the `node_id` of the target hop.
49908  *
49909  * Refers to the `node_id` receiving the payment from the previous hop.
49910  */
49911 MUST_USE_RES struct LDKNodeId DirectedChannelInfo_target(const struct LDKDirectedChannelInfo *NONNULL_PTR this_arg);
49912
49913 /**
49914  * Frees any resources used by the EffectiveCapacity
49915  */
49916 void EffectiveCapacity_free(struct LDKEffectiveCapacity this_ptr);
49917
49918 /**
49919  * Creates a copy of the EffectiveCapacity
49920  */
49921 struct LDKEffectiveCapacity EffectiveCapacity_clone(const struct LDKEffectiveCapacity *NONNULL_PTR orig);
49922
49923 /**
49924  * Utility method to constructs a new ExactLiquidity-variant EffectiveCapacity
49925  */
49926 struct LDKEffectiveCapacity EffectiveCapacity_exact_liquidity(uint64_t liquidity_msat);
49927
49928 /**
49929  * Utility method to constructs a new AdvertisedMaxHTLC-variant EffectiveCapacity
49930  */
49931 struct LDKEffectiveCapacity EffectiveCapacity_advertised_max_htlc(uint64_t amount_msat);
49932
49933 /**
49934  * Utility method to constructs a new Total-variant EffectiveCapacity
49935  */
49936 struct LDKEffectiveCapacity EffectiveCapacity_total(uint64_t capacity_msat, uint64_t htlc_maximum_msat);
49937
49938 /**
49939  * Utility method to constructs a new Infinite-variant EffectiveCapacity
49940  */
49941 struct LDKEffectiveCapacity EffectiveCapacity_infinite(void);
49942
49943 /**
49944  * Utility method to constructs a new HintMaxHTLC-variant EffectiveCapacity
49945  */
49946 struct LDKEffectiveCapacity EffectiveCapacity_hint_max_htlc(uint64_t amount_msat);
49947
49948 /**
49949  * Utility method to constructs a new Unknown-variant EffectiveCapacity
49950  */
49951 struct LDKEffectiveCapacity EffectiveCapacity_unknown(void);
49952
49953 /**
49954  * Returns the effective capacity denominated in millisatoshi.
49955  */
49956 MUST_USE_RES uint64_t EffectiveCapacity_as_msat(const struct LDKEffectiveCapacity *NONNULL_PTR this_arg);
49957
49958 /**
49959  * Frees any resources used by the RoutingFees, if is_owned is set and inner is non-NULL.
49960  */
49961 void RoutingFees_free(struct LDKRoutingFees this_obj);
49962
49963 /**
49964  * Flat routing fee in millisatoshis.
49965  */
49966 uint32_t RoutingFees_get_base_msat(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
49967
49968 /**
49969  * Flat routing fee in millisatoshis.
49970  */
49971 void RoutingFees_set_base_msat(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
49972
49973 /**
49974  * Liquidity-based routing fee in millionths of a routed amount.
49975  * In other words, 10000 is 1%.
49976  */
49977 uint32_t RoutingFees_get_proportional_millionths(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
49978
49979 /**
49980  * Liquidity-based routing fee in millionths of a routed amount.
49981  * In other words, 10000 is 1%.
49982  */
49983 void RoutingFees_set_proportional_millionths(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
49984
49985 /**
49986  * Constructs a new RoutingFees given each field
49987  */
49988 MUST_USE_RES struct LDKRoutingFees RoutingFees_new(uint32_t base_msat_arg, uint32_t proportional_millionths_arg);
49989
49990 /**
49991  * Checks if two RoutingFeess contain equal inner contents.
49992  * This ignores pointers and is_owned flags and looks at the values in fields.
49993  * Two objects with NULL inner values will be considered "equal" here.
49994  */
49995 bool RoutingFees_eq(const struct LDKRoutingFees *NONNULL_PTR a, const struct LDKRoutingFees *NONNULL_PTR b);
49996
49997 /**
49998  * Creates a copy of the RoutingFees
49999  */
50000 struct LDKRoutingFees RoutingFees_clone(const struct LDKRoutingFees *NONNULL_PTR orig);
50001
50002 /**
50003  * Generates a non-cryptographic 64-bit hash of the RoutingFees.
50004  */
50005 uint64_t RoutingFees_hash(const struct LDKRoutingFees *NONNULL_PTR o);
50006
50007 /**
50008  * Serialize the RoutingFees object into a byte array which can be read by RoutingFees_read
50009  */
50010 struct LDKCVec_u8Z RoutingFees_write(const struct LDKRoutingFees *NONNULL_PTR obj);
50011
50012 /**
50013  * Read a RoutingFees from a byte array, created by RoutingFees_write
50014  */
50015 struct LDKCResult_RoutingFeesDecodeErrorZ RoutingFees_read(struct LDKu8slice ser);
50016
50017 /**
50018  * Frees any resources used by the NodeAnnouncementInfo, if is_owned is set and inner is non-NULL.
50019  */
50020 void NodeAnnouncementInfo_free(struct LDKNodeAnnouncementInfo this_obj);
50021
50022 /**
50023  * Protocol features the node announced support for
50024  */
50025 struct LDKNodeFeatures NodeAnnouncementInfo_get_features(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
50026
50027 /**
50028  * Protocol features the node announced support for
50029  */
50030 void NodeAnnouncementInfo_set_features(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
50031
50032 /**
50033  * When the last known update to the node state was issued.
50034  * Value is opaque, as set in the announcement.
50035  */
50036 uint32_t NodeAnnouncementInfo_get_last_update(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
50037
50038 /**
50039  * When the last known update to the node state was issued.
50040  * Value is opaque, as set in the announcement.
50041  */
50042 void NodeAnnouncementInfo_set_last_update(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, uint32_t val);
50043
50044 /**
50045  * Color assigned to the node
50046  */
50047 const uint8_t (*NodeAnnouncementInfo_get_rgb(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[3];
50048
50049 /**
50050  * Color assigned to the node
50051  */
50052 void NodeAnnouncementInfo_set_rgb(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
50053
50054 /**
50055  * Moniker assigned to the node.
50056  * May be invalid or malicious (eg control chars),
50057  * should not be exposed to the user.
50058  */
50059 struct LDKNodeAlias NodeAnnouncementInfo_get_alias(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
50060
50061 /**
50062  * Moniker assigned to the node.
50063  * May be invalid or malicious (eg control chars),
50064  * should not be exposed to the user.
50065  */
50066 void NodeAnnouncementInfo_set_alias(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeAlias val);
50067
50068 /**
50069  * An initial announcement of the node
50070  * Mostly redundant with the data we store in fields explicitly.
50071  * Everything else is useful only for sending out for initial routing sync.
50072  * Not stored if contains excess data to prevent DoS.
50073  *
50074  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
50075  */
50076 struct LDKNodeAnnouncement NodeAnnouncementInfo_get_announcement_message(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
50077
50078 /**
50079  * An initial announcement of the node
50080  * Mostly redundant with the data we store in fields explicitly.
50081  * Everything else is useful only for sending out for initial routing sync.
50082  * Not stored if contains excess data to prevent DoS.
50083  *
50084  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
50085  */
50086 void NodeAnnouncementInfo_set_announcement_message(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncement val);
50087
50088 /**
50089  * Constructs a new NodeAnnouncementInfo given each field
50090  *
50091  * Note that announcement_message_arg (or a relevant inner pointer) may be NULL or all-0s to represent None
50092  */
50093 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);
50094
50095 /**
50096  * Creates a copy of the NodeAnnouncementInfo
50097  */
50098 struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_clone(const struct LDKNodeAnnouncementInfo *NONNULL_PTR orig);
50099
50100 /**
50101  * Checks if two NodeAnnouncementInfos contain equal inner contents.
50102  * This ignores pointers and is_owned flags and looks at the values in fields.
50103  * Two objects with NULL inner values will be considered "equal" here.
50104  */
50105 bool NodeAnnouncementInfo_eq(const struct LDKNodeAnnouncementInfo *NONNULL_PTR a, const struct LDKNodeAnnouncementInfo *NONNULL_PTR b);
50106
50107 /**
50108  * Internet-level addresses via which one can connect to the node
50109  */
50110 MUST_USE_RES struct LDKCVec_SocketAddressZ NodeAnnouncementInfo_addresses(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_arg);
50111
50112 /**
50113  * Serialize the NodeAnnouncementInfo object into a byte array which can be read by NodeAnnouncementInfo_read
50114  */
50115 struct LDKCVec_u8Z NodeAnnouncementInfo_write(const struct LDKNodeAnnouncementInfo *NONNULL_PTR obj);
50116
50117 /**
50118  * Read a NodeAnnouncementInfo from a byte array, created by NodeAnnouncementInfo_write
50119  */
50120 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ NodeAnnouncementInfo_read(struct LDKu8slice ser);
50121
50122 /**
50123  * Frees any resources used by the NodeAlias, if is_owned is set and inner is non-NULL.
50124  */
50125 void NodeAlias_free(struct LDKNodeAlias this_obj);
50126
50127 const uint8_t (*NodeAlias_get_a(const struct LDKNodeAlias *NONNULL_PTR this_ptr))[32];
50128
50129 void NodeAlias_set_a(struct LDKNodeAlias *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
50130
50131 /**
50132  * Constructs a new NodeAlias given each field
50133  */
50134 MUST_USE_RES struct LDKNodeAlias NodeAlias_new(struct LDKThirtyTwoBytes a_arg);
50135
50136 /**
50137  * Creates a copy of the NodeAlias
50138  */
50139 struct LDKNodeAlias NodeAlias_clone(const struct LDKNodeAlias *NONNULL_PTR orig);
50140
50141 /**
50142  * Generates a non-cryptographic 64-bit hash of the NodeAlias.
50143  */
50144 uint64_t NodeAlias_hash(const struct LDKNodeAlias *NONNULL_PTR o);
50145
50146 /**
50147  * Checks if two NodeAliass contain equal inner contents.
50148  * This ignores pointers and is_owned flags and looks at the values in fields.
50149  * Two objects with NULL inner values will be considered "equal" here.
50150  */
50151 bool NodeAlias_eq(const struct LDKNodeAlias *NONNULL_PTR a, const struct LDKNodeAlias *NONNULL_PTR b);
50152
50153 /**
50154  * Serialize the NodeAlias object into a byte array which can be read by NodeAlias_read
50155  */
50156 struct LDKCVec_u8Z NodeAlias_write(const struct LDKNodeAlias *NONNULL_PTR obj);
50157
50158 /**
50159  * Read a NodeAlias from a byte array, created by NodeAlias_write
50160  */
50161 struct LDKCResult_NodeAliasDecodeErrorZ NodeAlias_read(struct LDKu8slice ser);
50162
50163 /**
50164  * Frees any resources used by the NodeInfo, if is_owned is set and inner is non-NULL.
50165  */
50166 void NodeInfo_free(struct LDKNodeInfo this_obj);
50167
50168 /**
50169  * All valid channels a node has announced
50170  *
50171  * Returns a copy of the field.
50172  */
50173 struct LDKCVec_u64Z NodeInfo_get_channels(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
50174
50175 /**
50176  * All valid channels a node has announced
50177  */
50178 void NodeInfo_set_channels(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
50179
50180 /**
50181  * More information about a node from node_announcement.
50182  * Optional because we store a Node entry after learning about it from
50183  * a channel announcement, but before receiving a node announcement.
50184  *
50185  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
50186  */
50187 struct LDKNodeAnnouncementInfo NodeInfo_get_announcement_info(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
50188
50189 /**
50190  * More information about a node from node_announcement.
50191  * Optional because we store a Node entry after learning about it from
50192  * a channel announcement, but before receiving a node announcement.
50193  *
50194  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
50195  */
50196 void NodeInfo_set_announcement_info(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncementInfo val);
50197
50198 /**
50199  * Constructs a new NodeInfo given each field
50200  *
50201  * Note that announcement_info_arg (or a relevant inner pointer) may be NULL or all-0s to represent None
50202  */
50203 MUST_USE_RES struct LDKNodeInfo NodeInfo_new(struct LDKCVec_u64Z channels_arg, struct LDKNodeAnnouncementInfo announcement_info_arg);
50204
50205 /**
50206  * Creates a copy of the NodeInfo
50207  */
50208 struct LDKNodeInfo NodeInfo_clone(const struct LDKNodeInfo *NONNULL_PTR orig);
50209
50210 /**
50211  * Checks if two NodeInfos contain equal inner contents.
50212  * This ignores pointers and is_owned flags and looks at the values in fields.
50213  * Two objects with NULL inner values will be considered "equal" here.
50214  */
50215 bool NodeInfo_eq(const struct LDKNodeInfo *NONNULL_PTR a, const struct LDKNodeInfo *NONNULL_PTR b);
50216
50217 /**
50218  * Returns whether the node has only announced Tor addresses.
50219  */
50220 MUST_USE_RES bool NodeInfo_is_tor_only(const struct LDKNodeInfo *NONNULL_PTR this_arg);
50221
50222 /**
50223  * Serialize the NodeInfo object into a byte array which can be read by NodeInfo_read
50224  */
50225 struct LDKCVec_u8Z NodeInfo_write(const struct LDKNodeInfo *NONNULL_PTR obj);
50226
50227 /**
50228  * Read a NodeInfo from a byte array, created by NodeInfo_write
50229  */
50230 struct LDKCResult_NodeInfoDecodeErrorZ NodeInfo_read(struct LDKu8slice ser);
50231
50232 /**
50233  * Serialize the NetworkGraph object into a byte array which can be read by NetworkGraph_read
50234  */
50235 struct LDKCVec_u8Z NetworkGraph_write(const struct LDKNetworkGraph *NONNULL_PTR obj);
50236
50237 /**
50238  * Read a NetworkGraph from a byte array, created by NetworkGraph_write
50239  */
50240 struct LDKCResult_NetworkGraphDecodeErrorZ NetworkGraph_read(struct LDKu8slice ser, struct LDKLogger arg);
50241
50242 /**
50243  * Creates a new, empty, network graph.
50244  */
50245 MUST_USE_RES struct LDKNetworkGraph NetworkGraph_new(enum LDKNetwork network, struct LDKLogger logger);
50246
50247 /**
50248  * Returns a read-only view of the network graph.
50249  */
50250 MUST_USE_RES struct LDKReadOnlyNetworkGraph NetworkGraph_read_only(const struct LDKNetworkGraph *NONNULL_PTR this_arg);
50251
50252 /**
50253  * The unix timestamp provided by the most recent rapid gossip sync.
50254  * It will be set by the rapid sync process after every sync completion.
50255  */
50256 MUST_USE_RES struct LDKCOption_u32Z NetworkGraph_get_last_rapid_gossip_sync_timestamp(const struct LDKNetworkGraph *NONNULL_PTR this_arg);
50257
50258 /**
50259  * Update the unix timestamp provided by the most recent rapid gossip sync.
50260  * This should be done automatically by the rapid sync process after every sync completion.
50261  */
50262 void NetworkGraph_set_last_rapid_gossip_sync_timestamp(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint32_t last_rapid_gossip_sync_timestamp);
50263
50264 /**
50265  * For an already known node (from channel announcements), update its stored properties from a
50266  * given node announcement.
50267  *
50268  * You probably don't want to call this directly, instead relying on a P2PGossipSync's
50269  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
50270  * routing messages from a source using a protocol other than the lightning P2P protocol.
50271  */
50272 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_announcement(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
50273
50274 /**
50275  * For an already known node (from channel announcements), update its stored properties from a
50276  * given node announcement without verifying the associated signatures. Because we aren't
50277  * given the associated signatures here we cannot relay the node announcement to any of our
50278  * peers.
50279  */
50280 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);
50281
50282 /**
50283  * Store or update channel info from a channel announcement.
50284  *
50285  * You probably don't want to call this directly, instead relying on a [`P2PGossipSync`]'s
50286  * [`RoutingMessageHandler`] implementation to call it indirectly. This may be useful to accept
50287  * routing messages from a source using a protocol other than the lightning P2P protocol.
50288  *
50289  * If a [`UtxoLookup`] object is provided via `utxo_lookup`, it will be called to verify
50290  * the corresponding UTXO exists on chain and is correctly-formatted.
50291  */
50292 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);
50293
50294 /**
50295  * Store or update channel info from a channel announcement.
50296  *
50297  * You probably don't want to call this directly, instead relying on a [`P2PGossipSync`]'s
50298  * [`RoutingMessageHandler`] implementation to call it indirectly. This may be useful to accept
50299  * routing messages from a source using a protocol other than the lightning P2P protocol.
50300  *
50301  * This will skip verification of if the channel is actually on-chain.
50302  */
50303 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);
50304
50305 /**
50306  * Store or update channel info from a channel announcement without verifying the associated
50307  * signatures. Because we aren't given the associated signatures here we cannot relay the
50308  * channel announcement to any of our peers.
50309  *
50310  * If a [`UtxoLookup`] object is provided via `utxo_lookup`, it will be called to verify
50311  * the corresponding UTXO exists on chain and is correctly-formatted.
50312  */
50313 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);
50314
50315 /**
50316  * Update channel from partial announcement data received via rapid gossip sync
50317  *
50318  * `timestamp: u64`: Timestamp emulating the backdated original announcement receipt (by the
50319  * rapid gossip sync server)
50320  *
50321  * All other parameters as used in [`msgs::UnsignedChannelAnnouncement`] fields.
50322  */
50323 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);
50324
50325 /**
50326  * Marks a channel in the graph as failed permanently.
50327  *
50328  * The channel and any node for which this was their last channel are removed from the graph.
50329  */
50330 void NetworkGraph_channel_failed_permanent(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id);
50331
50332 /**
50333  * Marks a node in the graph as permanently failed, effectively removing it and its channels
50334  * from local storage.
50335  */
50336 void NetworkGraph_node_failed_permanent(const struct LDKNetworkGraph *NONNULL_PTR this_arg, struct LDKPublicKey node_id);
50337
50338 /**
50339  * Removes information about channels that we haven't heard any updates about in some time.
50340  * This can be used regularly to prune the network graph of channels that likely no longer
50341  * exist.
50342  *
50343  * While there is no formal requirement that nodes regularly re-broadcast their channel
50344  * updates every two weeks, the non-normative section of BOLT 7 currently suggests that
50345  * pruning occur for updates which are at least two weeks old, which we implement here.
50346  *
50347  * Note that for users of the `lightning-background-processor` crate this method may be
50348  * automatically called regularly for you.
50349  *
50350  * This method will also cause us to stop tracking removed nodes and channels if they have been
50351  * in the map for a while so that these can be resynced from gossip in the future.
50352  *
50353  * This method is only available with the `std` feature. See
50354  * [`NetworkGraph::remove_stale_channels_and_tracking_with_time`] for `no-std` use.
50355  */
50356 void NetworkGraph_remove_stale_channels_and_tracking(const struct LDKNetworkGraph *NONNULL_PTR this_arg);
50357
50358 /**
50359  * Removes information about channels that we haven't heard any updates about in some time.
50360  * This can be used regularly to prune the network graph of channels that likely no longer
50361  * exist.
50362  *
50363  * While there is no formal requirement that nodes regularly re-broadcast their channel
50364  * updates every two weeks, the non-normative section of BOLT 7 currently suggests that
50365  * pruning occur for updates which are at least two weeks old, which we implement here.
50366  *
50367  * This method will also cause us to stop tracking removed nodes and channels if they have been
50368  * in the map for a while so that these can be resynced from gossip in the future.
50369  *
50370  * This function takes the current unix time as an argument. For users with the `std` feature
50371  * enabled, [`NetworkGraph::remove_stale_channels_and_tracking`] may be preferable.
50372  */
50373 void NetworkGraph_remove_stale_channels_and_tracking_with_time(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t current_time_unix);
50374
50375 /**
50376  * For an already known (from announcement) channel, update info about one of the directions
50377  * of the channel.
50378  *
50379  * You probably don't want to call this directly, instead relying on a [`P2PGossipSync`]'s
50380  * [`RoutingMessageHandler`] implementation to call it indirectly. This may be useful to accept
50381  * routing messages from a source using a protocol other than the lightning P2P protocol.
50382  *
50383  * If built with `no-std`, any updates with a timestamp more than two weeks in the past or
50384  * materially in the future will be rejected.
50385  */
50386 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
50387
50388 /**
50389  * For an already known (from announcement) channel, update info about one of the directions
50390  * of the channel without verifying the associated signatures. Because we aren't given the
50391  * associated signatures here we cannot relay the channel update to any of our peers.
50392  *
50393  * If built with `no-std`, any updates with a timestamp more than two weeks in the past or
50394  * materially in the future will be rejected.
50395  */
50396 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_unsigned(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelUpdate *NONNULL_PTR msg);
50397
50398 /**
50399  * For an already known (from announcement) channel, verify the given [`ChannelUpdate`].
50400  *
50401  * This checks whether the update currently is applicable by [`Self::update_channel`].
50402  *
50403  * If built with `no-std`, any updates with a timestamp more than two weeks in the past or
50404  * materially in the future will be rejected.
50405  */
50406 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_verify_channel_update(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
50407
50408 /**
50409  * Returns information on a channel with the given id.
50410  *
50411  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
50412  */
50413 MUST_USE_RES struct LDKChannelInfo ReadOnlyNetworkGraph_channel(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id);
50414
50415 /**
50416  * Returns the list of channels in the graph
50417  */
50418 MUST_USE_RES struct LDKCVec_u64Z ReadOnlyNetworkGraph_list_channels(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg);
50419
50420 /**
50421  * Returns information on a node with the given id.
50422  *
50423  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
50424  */
50425 MUST_USE_RES struct LDKNodeInfo ReadOnlyNetworkGraph_node(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR node_id);
50426
50427 /**
50428  * Returns the list of nodes in the graph
50429  */
50430 MUST_USE_RES struct LDKCVec_NodeIdZ ReadOnlyNetworkGraph_list_nodes(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg);
50431
50432 /**
50433  * Get network addresses by node id.
50434  * Returns None if the requested node is completely unknown,
50435  * or if node announcement for the node was never received.
50436  */
50437 MUST_USE_RES struct LDKCOption_CVec_SocketAddressZZ ReadOnlyNetworkGraph_get_addresses(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg, struct LDKPublicKey pubkey);
50438
50439 /**
50440  * Frees any resources used by the DefaultRouter, if is_owned is set and inner is non-NULL.
50441  */
50442 void DefaultRouter_free(struct LDKDefaultRouter this_obj);
50443
50444 /**
50445  * Creates a new router.
50446  */
50447 MUST_USE_RES struct LDKDefaultRouter DefaultRouter_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKLogger logger, struct LDKEntropySource entropy_source, struct LDKLockableScore scorer, struct LDKProbabilisticScoringFeeParameters score_params);
50448
50449 /**
50450  * Constructs a new Router which calls the relevant methods on this_arg.
50451  * This copies the `inner` pointer in this_arg and thus the returned Router must be freed before this_arg is
50452  */
50453 struct LDKRouter DefaultRouter_as_Router(const struct LDKDefaultRouter *NONNULL_PTR this_arg);
50454
50455 /**
50456  * Constructs a new MessageRouter which calls the relevant methods on this_arg.
50457  * This copies the `inner` pointer in this_arg and thus the returned MessageRouter must be freed before this_arg is
50458  */
50459 struct LDKMessageRouter DefaultRouter_as_MessageRouter(const struct LDKDefaultRouter *NONNULL_PTR this_arg);
50460
50461 /**
50462  * Calls the free function if one is set
50463  */
50464 void Router_free(struct LDKRouter this_ptr);
50465
50466 /**
50467  * Frees any resources used by the ScorerAccountingForInFlightHtlcs, if is_owned is set and inner is non-NULL.
50468  */
50469 void ScorerAccountingForInFlightHtlcs_free(struct LDKScorerAccountingForInFlightHtlcs this_obj);
50470
50471 /**
50472  * Initialize a new `ScorerAccountingForInFlightHtlcs`.
50473  */
50474 MUST_USE_RES struct LDKScorerAccountingForInFlightHtlcs ScorerAccountingForInFlightHtlcs_new(struct LDKScoreLookUp scorer, const struct LDKInFlightHtlcs *NONNULL_PTR inflight_htlcs);
50475
50476 /**
50477  * Constructs a new ScoreLookUp which calls the relevant methods on this_arg.
50478  * This copies the `inner` pointer in this_arg and thus the returned ScoreLookUp must be freed before this_arg is
50479  */
50480 struct LDKScoreLookUp ScorerAccountingForInFlightHtlcs_as_ScoreLookUp(const struct LDKScorerAccountingForInFlightHtlcs *NONNULL_PTR this_arg);
50481
50482 /**
50483  * Frees any resources used by the InFlightHtlcs, if is_owned is set and inner is non-NULL.
50484  */
50485 void InFlightHtlcs_free(struct LDKInFlightHtlcs this_obj);
50486
50487 /**
50488  * Creates a copy of the InFlightHtlcs
50489  */
50490 struct LDKInFlightHtlcs InFlightHtlcs_clone(const struct LDKInFlightHtlcs *NONNULL_PTR orig);
50491
50492 /**
50493  * Constructs an empty `InFlightHtlcs`.
50494  */
50495 MUST_USE_RES struct LDKInFlightHtlcs InFlightHtlcs_new(void);
50496
50497 /**
50498  * Takes in a path with payer's node id and adds the path's details to `InFlightHtlcs`.
50499  */
50500 void InFlightHtlcs_process_path(struct LDKInFlightHtlcs *NONNULL_PTR this_arg, const struct LDKPath *NONNULL_PTR path, struct LDKPublicKey payer_node_id);
50501
50502 /**
50503  * Adds a known HTLC given the public key of the HTLC source, target, and short channel
50504  * id.
50505  */
50506 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);
50507
50508 /**
50509  * Returns liquidity in msat given the public key of the HTLC source, target, and short channel
50510  * id.
50511  */
50512 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);
50513
50514 /**
50515  * Serialize the InFlightHtlcs object into a byte array which can be read by InFlightHtlcs_read
50516  */
50517 struct LDKCVec_u8Z InFlightHtlcs_write(const struct LDKInFlightHtlcs *NONNULL_PTR obj);
50518
50519 /**
50520  * Read a InFlightHtlcs from a byte array, created by InFlightHtlcs_write
50521  */
50522 struct LDKCResult_InFlightHtlcsDecodeErrorZ InFlightHtlcs_read(struct LDKu8slice ser);
50523
50524 /**
50525  * Frees any resources used by the RouteHop, if is_owned is set and inner is non-NULL.
50526  */
50527 void RouteHop_free(struct LDKRouteHop this_obj);
50528
50529 /**
50530  * The node_id of the node at this hop.
50531  */
50532 struct LDKPublicKey RouteHop_get_pubkey(const struct LDKRouteHop *NONNULL_PTR this_ptr);
50533
50534 /**
50535  * The node_id of the node at this hop.
50536  */
50537 void RouteHop_set_pubkey(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKPublicKey val);
50538
50539 /**
50540  * The node_announcement features of the node at this hop. For the last hop, these may be
50541  * amended to match the features present in the invoice this node generated.
50542  */
50543 struct LDKNodeFeatures RouteHop_get_node_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
50544
50545 /**
50546  * The node_announcement features of the node at this hop. For the last hop, these may be
50547  * amended to match the features present in the invoice this node generated.
50548  */
50549 void RouteHop_set_node_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
50550
50551 /**
50552  * The channel that should be used from the previous hop to reach this node.
50553  */
50554 uint64_t RouteHop_get_short_channel_id(const struct LDKRouteHop *NONNULL_PTR this_ptr);
50555
50556 /**
50557  * The channel that should be used from the previous hop to reach this node.
50558  */
50559 void RouteHop_set_short_channel_id(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
50560
50561 /**
50562  * The channel_announcement features of the channel that should be used from the previous hop
50563  * to reach this node.
50564  */
50565 struct LDKChannelFeatures RouteHop_get_channel_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
50566
50567 /**
50568  * The channel_announcement features of the channel that should be used from the previous hop
50569  * to reach this node.
50570  */
50571 void RouteHop_set_channel_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
50572
50573 /**
50574  * The fee taken on this hop (for paying for the use of the *next* channel in the path).
50575  * If this is the last hop in [`Path::hops`]:
50576  * * if we're sending to a [`BlindedPath`], this is the fee paid for use of the entire blinded path
50577  * * otherwise, this is the full value of this [`Path`]'s part of the payment
50578  *
50579  * [`BlindedPath`]: crate::blinded_path::BlindedPath
50580  */
50581 uint64_t RouteHop_get_fee_msat(const struct LDKRouteHop *NONNULL_PTR this_ptr);
50582
50583 /**
50584  * The fee taken on this hop (for paying for the use of the *next* channel in the path).
50585  * If this is the last hop in [`Path::hops`]:
50586  * * if we're sending to a [`BlindedPath`], this is the fee paid for use of the entire blinded path
50587  * * otherwise, this is the full value of this [`Path`]'s part of the payment
50588  *
50589  * [`BlindedPath`]: crate::blinded_path::BlindedPath
50590  */
50591 void RouteHop_set_fee_msat(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
50592
50593 /**
50594  * The CLTV delta added for this hop.
50595  * If this is the last hop in [`Path::hops`]:
50596  * * if we're sending to a [`BlindedPath`], this is the CLTV delta for the entire blinded path
50597  * * otherwise, this is the CLTV delta expected at the destination
50598  *
50599  * [`BlindedPath`]: crate::blinded_path::BlindedPath
50600  */
50601 uint32_t RouteHop_get_cltv_expiry_delta(const struct LDKRouteHop *NONNULL_PTR this_ptr);
50602
50603 /**
50604  * The CLTV delta added for this hop.
50605  * If this is the last hop in [`Path::hops`]:
50606  * * if we're sending to a [`BlindedPath`], this is the CLTV delta for the entire blinded path
50607  * * otherwise, this is the CLTV delta expected at the destination
50608  *
50609  * [`BlindedPath`]: crate::blinded_path::BlindedPath
50610  */
50611 void RouteHop_set_cltv_expiry_delta(struct LDKRouteHop *NONNULL_PTR this_ptr, uint32_t val);
50612
50613 /**
50614  * Indicates whether this hop is possibly announced in the public network graph.
50615  *
50616  * Will be `true` if there is a possibility that the channel is publicly known, i.e., if we
50617  * either know for sure it's announced in the public graph, or if any public channels exist
50618  * for which the given `short_channel_id` could be an alias for. Will be `false` if we believe
50619  * the channel to be unannounced.
50620  *
50621  * Will be `true` for objects serialized with LDK version 0.0.116 and before.
50622  */
50623 bool RouteHop_get_maybe_announced_channel(const struct LDKRouteHop *NONNULL_PTR this_ptr);
50624
50625 /**
50626  * Indicates whether this hop is possibly announced in the public network graph.
50627  *
50628  * Will be `true` if there is a possibility that the channel is publicly known, i.e., if we
50629  * either know for sure it's announced in the public graph, or if any public channels exist
50630  * for which the given `short_channel_id` could be an alias for. Will be `false` if we believe
50631  * the channel to be unannounced.
50632  *
50633  * Will be `true` for objects serialized with LDK version 0.0.116 and before.
50634  */
50635 void RouteHop_set_maybe_announced_channel(struct LDKRouteHop *NONNULL_PTR this_ptr, bool val);
50636
50637 /**
50638  * Constructs a new RouteHop given each field
50639  */
50640 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, bool maybe_announced_channel_arg);
50641
50642 /**
50643  * Creates a copy of the RouteHop
50644  */
50645 struct LDKRouteHop RouteHop_clone(const struct LDKRouteHop *NONNULL_PTR orig);
50646
50647 /**
50648  * Generates a non-cryptographic 64-bit hash of the RouteHop.
50649  */
50650 uint64_t RouteHop_hash(const struct LDKRouteHop *NONNULL_PTR o);
50651
50652 /**
50653  * Checks if two RouteHops contain equal inner contents.
50654  * This ignores pointers and is_owned flags and looks at the values in fields.
50655  * Two objects with NULL inner values will be considered "equal" here.
50656  */
50657 bool RouteHop_eq(const struct LDKRouteHop *NONNULL_PTR a, const struct LDKRouteHop *NONNULL_PTR b);
50658
50659 /**
50660  * Serialize the RouteHop object into a byte array which can be read by RouteHop_read
50661  */
50662 struct LDKCVec_u8Z RouteHop_write(const struct LDKRouteHop *NONNULL_PTR obj);
50663
50664 /**
50665  * Read a RouteHop from a byte array, created by RouteHop_write
50666  */
50667 struct LDKCResult_RouteHopDecodeErrorZ RouteHop_read(struct LDKu8slice ser);
50668
50669 /**
50670  * Frees any resources used by the BlindedTail, if is_owned is set and inner is non-NULL.
50671  */
50672 void BlindedTail_free(struct LDKBlindedTail this_obj);
50673
50674 /**
50675  * The hops of the [`BlindedPath`] provided by the recipient.
50676  *
50677  * [`BlindedPath`]: crate::blinded_path::BlindedPath
50678  */
50679 struct LDKCVec_BlindedHopZ BlindedTail_get_hops(const struct LDKBlindedTail *NONNULL_PTR this_ptr);
50680
50681 /**
50682  * The hops of the [`BlindedPath`] provided by the recipient.
50683  *
50684  * [`BlindedPath`]: crate::blinded_path::BlindedPath
50685  */
50686 void BlindedTail_set_hops(struct LDKBlindedTail *NONNULL_PTR this_ptr, struct LDKCVec_BlindedHopZ val);
50687
50688 /**
50689  * The blinding point of the [`BlindedPath`] provided by the recipient.
50690  *
50691  * [`BlindedPath`]: crate::blinded_path::BlindedPath
50692  */
50693 struct LDKPublicKey BlindedTail_get_blinding_point(const struct LDKBlindedTail *NONNULL_PTR this_ptr);
50694
50695 /**
50696  * The blinding point of the [`BlindedPath`] provided by the recipient.
50697  *
50698  * [`BlindedPath`]: crate::blinded_path::BlindedPath
50699  */
50700 void BlindedTail_set_blinding_point(struct LDKBlindedTail *NONNULL_PTR this_ptr, struct LDKPublicKey val);
50701
50702 /**
50703  * Excess CLTV delta added to the recipient's CLTV expiry to deter intermediate nodes from
50704  * inferring the destination. May be 0.
50705  */
50706 uint32_t BlindedTail_get_excess_final_cltv_expiry_delta(const struct LDKBlindedTail *NONNULL_PTR this_ptr);
50707
50708 /**
50709  * Excess CLTV delta added to the recipient's CLTV expiry to deter intermediate nodes from
50710  * inferring the destination. May be 0.
50711  */
50712 void BlindedTail_set_excess_final_cltv_expiry_delta(struct LDKBlindedTail *NONNULL_PTR this_ptr, uint32_t val);
50713
50714 /**
50715  * The total amount paid on this [`Path`], excluding the fees.
50716  */
50717 uint64_t BlindedTail_get_final_value_msat(const struct LDKBlindedTail *NONNULL_PTR this_ptr);
50718
50719 /**
50720  * The total amount paid on this [`Path`], excluding the fees.
50721  */
50722 void BlindedTail_set_final_value_msat(struct LDKBlindedTail *NONNULL_PTR this_ptr, uint64_t val);
50723
50724 /**
50725  * Constructs a new BlindedTail given each field
50726  */
50727 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);
50728
50729 /**
50730  * Creates a copy of the BlindedTail
50731  */
50732 struct LDKBlindedTail BlindedTail_clone(const struct LDKBlindedTail *NONNULL_PTR orig);
50733
50734 /**
50735  * Generates a non-cryptographic 64-bit hash of the BlindedTail.
50736  */
50737 uint64_t BlindedTail_hash(const struct LDKBlindedTail *NONNULL_PTR o);
50738
50739 /**
50740  * Checks if two BlindedTails contain equal inner contents.
50741  * This ignores pointers and is_owned flags and looks at the values in fields.
50742  * Two objects with NULL inner values will be considered "equal" here.
50743  */
50744 bool BlindedTail_eq(const struct LDKBlindedTail *NONNULL_PTR a, const struct LDKBlindedTail *NONNULL_PTR b);
50745
50746 /**
50747  * Serialize the BlindedTail object into a byte array which can be read by BlindedTail_read
50748  */
50749 struct LDKCVec_u8Z BlindedTail_write(const struct LDKBlindedTail *NONNULL_PTR obj);
50750
50751 /**
50752  * Read a BlindedTail from a byte array, created by BlindedTail_write
50753  */
50754 struct LDKCResult_BlindedTailDecodeErrorZ BlindedTail_read(struct LDKu8slice ser);
50755
50756 /**
50757  * Frees any resources used by the Path, if is_owned is set and inner is non-NULL.
50758  */
50759 void Path_free(struct LDKPath this_obj);
50760
50761 /**
50762  * The list of unblinded hops in this [`Path`]. Must be at least length one.
50763  */
50764 struct LDKCVec_RouteHopZ Path_get_hops(const struct LDKPath *NONNULL_PTR this_ptr);
50765
50766 /**
50767  * The list of unblinded hops in this [`Path`]. Must be at least length one.
50768  */
50769 void Path_set_hops(struct LDKPath *NONNULL_PTR this_ptr, struct LDKCVec_RouteHopZ val);
50770
50771 /**
50772  * The blinded path at which this path terminates, if we're sending to one, and its metadata.
50773  *
50774  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
50775  */
50776 struct LDKBlindedTail Path_get_blinded_tail(const struct LDKPath *NONNULL_PTR this_ptr);
50777
50778 /**
50779  * The blinded path at which this path terminates, if we're sending to one, and its metadata.
50780  *
50781  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
50782  */
50783 void Path_set_blinded_tail(struct LDKPath *NONNULL_PTR this_ptr, struct LDKBlindedTail val);
50784
50785 /**
50786  * Constructs a new Path given each field
50787  *
50788  * Note that blinded_tail_arg (or a relevant inner pointer) may be NULL or all-0s to represent None
50789  */
50790 MUST_USE_RES struct LDKPath Path_new(struct LDKCVec_RouteHopZ hops_arg, struct LDKBlindedTail blinded_tail_arg);
50791
50792 /**
50793  * Creates a copy of the Path
50794  */
50795 struct LDKPath Path_clone(const struct LDKPath *NONNULL_PTR orig);
50796
50797 /**
50798  * Generates a non-cryptographic 64-bit hash of the Path.
50799  */
50800 uint64_t Path_hash(const struct LDKPath *NONNULL_PTR o);
50801
50802 /**
50803  * Checks if two Paths contain equal inner contents.
50804  * This ignores pointers and is_owned flags and looks at the values in fields.
50805  * Two objects with NULL inner values will be considered "equal" here.
50806  */
50807 bool Path_eq(const struct LDKPath *NONNULL_PTR a, const struct LDKPath *NONNULL_PTR b);
50808
50809 /**
50810  * Gets the fees for a given path, excluding any excess paid to the recipient.
50811  */
50812 MUST_USE_RES uint64_t Path_fee_msat(const struct LDKPath *NONNULL_PTR this_arg);
50813
50814 /**
50815  * Gets the total amount paid on this [`Path`], excluding the fees.
50816  */
50817 MUST_USE_RES uint64_t Path_final_value_msat(const struct LDKPath *NONNULL_PTR this_arg);
50818
50819 /**
50820  * Gets the final hop's CLTV expiry delta.
50821  */
50822 MUST_USE_RES struct LDKCOption_u32Z Path_final_cltv_expiry_delta(const struct LDKPath *NONNULL_PTR this_arg);
50823
50824 /**
50825  * Frees any resources used by the Route, if is_owned is set and inner is non-NULL.
50826  */
50827 void Route_free(struct LDKRoute this_obj);
50828
50829 /**
50830  * The list of [`Path`]s taken for a single (potentially-)multi-part payment. If no
50831  * [`BlindedTail`]s are present, then the pubkey of the last [`RouteHop`] in each path must be
50832  * the same.
50833  */
50834 struct LDKCVec_PathZ Route_get_paths(const struct LDKRoute *NONNULL_PTR this_ptr);
50835
50836 /**
50837  * The list of [`Path`]s taken for a single (potentially-)multi-part payment. If no
50838  * [`BlindedTail`]s are present, then the pubkey of the last [`RouteHop`] in each path must be
50839  * the same.
50840  */
50841 void Route_set_paths(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKCVec_PathZ val);
50842
50843 /**
50844  * The `route_params` parameter passed to [`find_route`].
50845  *
50846  * This is used by `ChannelManager` to track information which may be required for retries.
50847  *
50848  * Will be `None` for objects serialized with LDK versions prior to 0.0.117.
50849  *
50850  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
50851  */
50852 struct LDKRouteParameters Route_get_route_params(const struct LDKRoute *NONNULL_PTR this_ptr);
50853
50854 /**
50855  * The `route_params` parameter passed to [`find_route`].
50856  *
50857  * This is used by `ChannelManager` to track information which may be required for retries.
50858  *
50859  * Will be `None` for objects serialized with LDK versions prior to 0.0.117.
50860  *
50861  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
50862  */
50863 void Route_set_route_params(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKRouteParameters val);
50864
50865 /**
50866  * Constructs a new Route given each field
50867  *
50868  * Note that route_params_arg (or a relevant inner pointer) may be NULL or all-0s to represent None
50869  */
50870 MUST_USE_RES struct LDKRoute Route_new(struct LDKCVec_PathZ paths_arg, struct LDKRouteParameters route_params_arg);
50871
50872 /**
50873  * Creates a copy of the Route
50874  */
50875 struct LDKRoute Route_clone(const struct LDKRoute *NONNULL_PTR orig);
50876
50877 /**
50878  * Generates a non-cryptographic 64-bit hash of the Route.
50879  */
50880 uint64_t Route_hash(const struct LDKRoute *NONNULL_PTR o);
50881
50882 /**
50883  * Checks if two Routes contain equal inner contents.
50884  * This ignores pointers and is_owned flags and looks at the values in fields.
50885  * Two objects with NULL inner values will be considered "equal" here.
50886  */
50887 bool Route_eq(const struct LDKRoute *NONNULL_PTR a, const struct LDKRoute *NONNULL_PTR b);
50888
50889 /**
50890  * Returns the total amount of fees paid on this [`Route`].
50891  *
50892  * For objects serialized with LDK 0.0.117 and after, this includes any extra payment made to
50893  * the recipient, which can happen in excess of the amount passed to [`find_route`] via
50894  * [`RouteParameters::final_value_msat`], if we had to reach the [`htlc_minimum_msat`] limits.
50895  *
50896  * [`htlc_minimum_msat`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-channel_update-message
50897  */
50898 MUST_USE_RES uint64_t Route_get_total_fees(const struct LDKRoute *NONNULL_PTR this_arg);
50899
50900 /**
50901  * Returns the total amount paid on this [`Route`], excluding the fees.
50902  *
50903  * Might be more than requested as part of the given [`RouteParameters::final_value_msat`] if
50904  * we had to reach the [`htlc_minimum_msat`] limits.
50905  *
50906  * [`htlc_minimum_msat`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-channel_update-message
50907  */
50908 MUST_USE_RES uint64_t Route_get_total_amount(const struct LDKRoute *NONNULL_PTR this_arg);
50909
50910 /**
50911  * Serialize the Route object into a byte array which can be read by Route_read
50912  */
50913 struct LDKCVec_u8Z Route_write(const struct LDKRoute *NONNULL_PTR obj);
50914
50915 /**
50916  * Read a Route from a byte array, created by Route_write
50917  */
50918 struct LDKCResult_RouteDecodeErrorZ Route_read(struct LDKu8slice ser);
50919
50920 /**
50921  * Frees any resources used by the RouteParameters, if is_owned is set and inner is non-NULL.
50922  */
50923 void RouteParameters_free(struct LDKRouteParameters this_obj);
50924
50925 /**
50926  * The parameters of the failed payment path.
50927  */
50928 struct LDKPaymentParameters RouteParameters_get_payment_params(const struct LDKRouteParameters *NONNULL_PTR this_ptr);
50929
50930 /**
50931  * The parameters of the failed payment path.
50932  */
50933 void RouteParameters_set_payment_params(struct LDKRouteParameters *NONNULL_PTR this_ptr, struct LDKPaymentParameters val);
50934
50935 /**
50936  * The amount in msats sent on the failed payment path.
50937  */
50938 uint64_t RouteParameters_get_final_value_msat(const struct LDKRouteParameters *NONNULL_PTR this_ptr);
50939
50940 /**
50941  * The amount in msats sent on the failed payment path.
50942  */
50943 void RouteParameters_set_final_value_msat(struct LDKRouteParameters *NONNULL_PTR this_ptr, uint64_t val);
50944
50945 /**
50946  * The maximum total fees, in millisatoshi, that may accrue during route finding.
50947  *
50948  * This limit also applies to the total fees that may arise while retrying failed payment
50949  * paths.
50950  *
50951  * Note that values below a few sats may result in some paths being spuriously ignored.
50952  */
50953 struct LDKCOption_u64Z RouteParameters_get_max_total_routing_fee_msat(const struct LDKRouteParameters *NONNULL_PTR this_ptr);
50954
50955 /**
50956  * The maximum total fees, in millisatoshi, that may accrue during route finding.
50957  *
50958  * This limit also applies to the total fees that may arise while retrying failed payment
50959  * paths.
50960  *
50961  * Note that values below a few sats may result in some paths being spuriously ignored.
50962  */
50963 void RouteParameters_set_max_total_routing_fee_msat(struct LDKRouteParameters *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
50964
50965 /**
50966  * Constructs a new RouteParameters given each field
50967  */
50968 MUST_USE_RES struct LDKRouteParameters RouteParameters_new(struct LDKPaymentParameters payment_params_arg, uint64_t final_value_msat_arg, struct LDKCOption_u64Z max_total_routing_fee_msat_arg);
50969
50970 /**
50971  * Creates a copy of the RouteParameters
50972  */
50973 struct LDKRouteParameters RouteParameters_clone(const struct LDKRouteParameters *NONNULL_PTR orig);
50974
50975 /**
50976  * Generates a non-cryptographic 64-bit hash of the RouteParameters.
50977  */
50978 uint64_t RouteParameters_hash(const struct LDKRouteParameters *NONNULL_PTR o);
50979
50980 /**
50981  * Checks if two RouteParameterss contain equal inner contents.
50982  * This ignores pointers and is_owned flags and looks at the values in fields.
50983  * Two objects with NULL inner values will be considered "equal" here.
50984  */
50985 bool RouteParameters_eq(const struct LDKRouteParameters *NONNULL_PTR a, const struct LDKRouteParameters *NONNULL_PTR b);
50986
50987 /**
50988  * Constructs [`RouteParameters`] from the given [`PaymentParameters`] and a payment amount.
50989  *
50990  * [`Self::max_total_routing_fee_msat`] defaults to 1% of the payment amount + 50 sats
50991  */
50992 MUST_USE_RES struct LDKRouteParameters RouteParameters_from_payment_params_and_value(struct LDKPaymentParameters payment_params, uint64_t final_value_msat);
50993
50994 /**
50995  * Serialize the RouteParameters object into a byte array which can be read by RouteParameters_read
50996  */
50997 struct LDKCVec_u8Z RouteParameters_write(const struct LDKRouteParameters *NONNULL_PTR obj);
50998
50999 /**
51000  * Read a RouteParameters from a byte array, created by RouteParameters_write
51001  */
51002 struct LDKCResult_RouteParametersDecodeErrorZ RouteParameters_read(struct LDKu8slice ser);
51003
51004 /**
51005  * Frees any resources used by the PaymentParameters, if is_owned is set and inner is non-NULL.
51006  */
51007 void PaymentParameters_free(struct LDKPaymentParameters this_obj);
51008
51009 /**
51010  * Information about the payee, such as their features and route hints for their channels.
51011  */
51012 struct LDKPayee PaymentParameters_get_payee(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
51013
51014 /**
51015  * Information about the payee, such as their features and route hints for their channels.
51016  */
51017 void PaymentParameters_set_payee(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKPayee val);
51018
51019 /**
51020  * Expiration of a payment to the payee, in seconds relative to the UNIX epoch.
51021  */
51022 struct LDKCOption_u64Z PaymentParameters_get_expiry_time(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
51023
51024 /**
51025  * Expiration of a payment to the payee, in seconds relative to the UNIX epoch.
51026  */
51027 void PaymentParameters_set_expiry_time(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
51028
51029 /**
51030  * The maximum total CLTV delta we accept for the route.
51031  * Defaults to [`DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA`].
51032  */
51033 uint32_t PaymentParameters_get_max_total_cltv_expiry_delta(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
51034
51035 /**
51036  * The maximum total CLTV delta we accept for the route.
51037  * Defaults to [`DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA`].
51038  */
51039 void PaymentParameters_set_max_total_cltv_expiry_delta(struct LDKPaymentParameters *NONNULL_PTR this_ptr, uint32_t val);
51040
51041 /**
51042  * The maximum number of paths that may be used by (MPP) payments.
51043  * Defaults to [`DEFAULT_MAX_PATH_COUNT`].
51044  */
51045 uint8_t PaymentParameters_get_max_path_count(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
51046
51047 /**
51048  * The maximum number of paths that may be used by (MPP) payments.
51049  * Defaults to [`DEFAULT_MAX_PATH_COUNT`].
51050  */
51051 void PaymentParameters_set_max_path_count(struct LDKPaymentParameters *NONNULL_PTR this_ptr, uint8_t val);
51052
51053 /**
51054  * Selects the maximum share of a channel's total capacity which will be sent over a channel,
51055  * as a power of 1/2. A higher value prefers to send the payment using more MPP parts whereas
51056  * a lower value prefers to send larger MPP parts, potentially saturating channels and
51057  * increasing failure probability for those paths.
51058  *
51059  * Note that this restriction will be relaxed during pathfinding after paths which meet this
51060  * restriction have been found. While paths which meet this criteria will be searched for, it
51061  * is ultimately up to the scorer to select them over other paths.
51062  *
51063  * A value of 0 will allow payments up to and including a channel's total announced usable
51064  * capacity, a value of one will only use up to half its capacity, two 1/4, etc.
51065  *
51066  * Default value: 2
51067  */
51068 uint8_t PaymentParameters_get_max_channel_saturation_power_of_half(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
51069
51070 /**
51071  * Selects the maximum share of a channel's total capacity which will be sent over a channel,
51072  * as a power of 1/2. A higher value prefers to send the payment using more MPP parts whereas
51073  * a lower value prefers to send larger MPP parts, potentially saturating channels and
51074  * increasing failure probability for those paths.
51075  *
51076  * Note that this restriction will be relaxed during pathfinding after paths which meet this
51077  * restriction have been found. While paths which meet this criteria will be searched for, it
51078  * is ultimately up to the scorer to select them over other paths.
51079  *
51080  * A value of 0 will allow payments up to and including a channel's total announced usable
51081  * capacity, a value of one will only use up to half its capacity, two 1/4, etc.
51082  *
51083  * Default value: 2
51084  */
51085 void PaymentParameters_set_max_channel_saturation_power_of_half(struct LDKPaymentParameters *NONNULL_PTR this_ptr, uint8_t val);
51086
51087 /**
51088  * A list of SCIDs which this payment was previously attempted over and which caused the
51089  * payment to fail. Future attempts for the same payment shouldn't be relayed through any of
51090  * these SCIDs.
51091  *
51092  * Returns a copy of the field.
51093  */
51094 struct LDKCVec_u64Z PaymentParameters_get_previously_failed_channels(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
51095
51096 /**
51097  * A list of SCIDs which this payment was previously attempted over and which caused the
51098  * payment to fail. Future attempts for the same payment shouldn't be relayed through any of
51099  * these SCIDs.
51100  */
51101 void PaymentParameters_set_previously_failed_channels(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
51102
51103 /**
51104  * A list of indices corresponding to blinded paths in [`Payee::Blinded::route_hints`] which this
51105  * payment was previously attempted over and which caused the payment to fail. Future attempts
51106  * for the same payment shouldn't be relayed through any of these blinded paths.
51107  *
51108  * Returns a copy of the field.
51109  */
51110 struct LDKCVec_u64Z PaymentParameters_get_previously_failed_blinded_path_idxs(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
51111
51112 /**
51113  * A list of indices corresponding to blinded paths in [`Payee::Blinded::route_hints`] which this
51114  * payment was previously attempted over and which caused the payment to fail. Future attempts
51115  * for the same payment shouldn't be relayed through any of these blinded paths.
51116  */
51117 void PaymentParameters_set_previously_failed_blinded_path_idxs(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
51118
51119 /**
51120  * Constructs a new PaymentParameters given each field
51121  */
51122 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, struct LDKCVec_u64Z previously_failed_blinded_path_idxs_arg);
51123
51124 /**
51125  * Creates a copy of the PaymentParameters
51126  */
51127 struct LDKPaymentParameters PaymentParameters_clone(const struct LDKPaymentParameters *NONNULL_PTR orig);
51128
51129 /**
51130  * Generates a non-cryptographic 64-bit hash of the PaymentParameters.
51131  */
51132 uint64_t PaymentParameters_hash(const struct LDKPaymentParameters *NONNULL_PTR o);
51133
51134 /**
51135  * Checks if two PaymentParameterss contain equal inner contents.
51136  * This ignores pointers and is_owned flags and looks at the values in fields.
51137  * Two objects with NULL inner values will be considered "equal" here.
51138  */
51139 bool PaymentParameters_eq(const struct LDKPaymentParameters *NONNULL_PTR a, const struct LDKPaymentParameters *NONNULL_PTR b);
51140
51141 /**
51142  * Serialize the PaymentParameters object into a byte array which can be read by PaymentParameters_read
51143  */
51144 struct LDKCVec_u8Z PaymentParameters_write(const struct LDKPaymentParameters *NONNULL_PTR obj);
51145
51146 /**
51147  * Read a PaymentParameters from a byte array, created by PaymentParameters_write
51148  */
51149 struct LDKCResult_PaymentParametersDecodeErrorZ PaymentParameters_read(struct LDKu8slice ser, uint32_t arg);
51150
51151 /**
51152  * Creates a payee with the node id of the given `pubkey`.
51153  *
51154  * The `final_cltv_expiry_delta` should match the expected final CLTV delta the recipient has
51155  * provided.
51156  */
51157 MUST_USE_RES struct LDKPaymentParameters PaymentParameters_from_node_id(struct LDKPublicKey payee_pubkey, uint32_t final_cltv_expiry_delta);
51158
51159 /**
51160  * Creates a payee with the node id of the given `pubkey` to use for keysend payments.
51161  *
51162  * The `final_cltv_expiry_delta` should match the expected final CLTV delta the recipient has
51163  * provided.
51164  *
51165  * Note that MPP keysend is not widely supported yet. The `allow_mpp` lets you choose
51166  * whether your router will be allowed to find a multi-part route for this payment. If you
51167  * set `allow_mpp` to true, you should ensure a payment secret is set on send, likely via
51168  * [`RecipientOnionFields::secret_only`].
51169  *
51170  * [`RecipientOnionFields::secret_only`]: crate::ln::channelmanager::RecipientOnionFields::secret_only
51171  */
51172 MUST_USE_RES struct LDKPaymentParameters PaymentParameters_for_keysend(struct LDKPublicKey payee_pubkey, uint32_t final_cltv_expiry_delta, bool allow_mpp);
51173
51174 /**
51175  * Creates parameters for paying to a blinded payee from the provided invoice. Sets
51176  * [`Payee::Blinded::route_hints`], [`Payee::Blinded::features`], and
51177  * [`PaymentParameters::expiry_time`].
51178  */
51179 MUST_USE_RES struct LDKPaymentParameters PaymentParameters_from_bolt12_invoice(const struct LDKBolt12Invoice *NONNULL_PTR invoice);
51180
51181 /**
51182  * Creates parameters for paying to a blinded payee from the provided blinded route hints.
51183  */
51184 MUST_USE_RES struct LDKPaymentParameters PaymentParameters_blinded(struct LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ blinded_route_hints);
51185
51186 /**
51187  * Frees any resources used by the Payee
51188  */
51189 void Payee_free(struct LDKPayee this_ptr);
51190
51191 /**
51192  * Creates a copy of the Payee
51193  */
51194 struct LDKPayee Payee_clone(const struct LDKPayee *NONNULL_PTR orig);
51195
51196 /**
51197  * Utility method to constructs a new Blinded-variant Payee
51198  */
51199 struct LDKPayee Payee_blinded(struct LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ route_hints, struct LDKBolt12InvoiceFeatures features);
51200
51201 /**
51202  * Utility method to constructs a new Clear-variant Payee
51203  */
51204 struct LDKPayee Payee_clear(struct LDKPublicKey node_id, struct LDKCVec_RouteHintZ route_hints, struct LDKBolt11InvoiceFeatures features, uint32_t final_cltv_expiry_delta);
51205
51206 /**
51207  * Generates a non-cryptographic 64-bit hash of the Payee.
51208  */
51209 uint64_t Payee_hash(const struct LDKPayee *NONNULL_PTR o);
51210
51211 /**
51212  * Checks if two Payees contain equal inner contents.
51213  * This ignores pointers and is_owned flags and looks at the values in fields.
51214  */
51215 bool Payee_eq(const struct LDKPayee *NONNULL_PTR a, const struct LDKPayee *NONNULL_PTR b);
51216
51217 /**
51218  * Frees any resources used by the RouteHint, if is_owned is set and inner is non-NULL.
51219  */
51220 void RouteHint_free(struct LDKRouteHint this_obj);
51221
51222 struct LDKCVec_RouteHintHopZ RouteHint_get_a(const struct LDKRouteHint *NONNULL_PTR this_ptr);
51223
51224 void RouteHint_set_a(struct LDKRouteHint *NONNULL_PTR this_ptr, struct LDKCVec_RouteHintHopZ val);
51225
51226 /**
51227  * Constructs a new RouteHint given each field
51228  */
51229 MUST_USE_RES struct LDKRouteHint RouteHint_new(struct LDKCVec_RouteHintHopZ a_arg);
51230
51231 /**
51232  * Creates a copy of the RouteHint
51233  */
51234 struct LDKRouteHint RouteHint_clone(const struct LDKRouteHint *NONNULL_PTR orig);
51235
51236 /**
51237  * Generates a non-cryptographic 64-bit hash of the RouteHint.
51238  */
51239 uint64_t RouteHint_hash(const struct LDKRouteHint *NONNULL_PTR o);
51240
51241 /**
51242  * Checks if two RouteHints contain equal inner contents.
51243  * This ignores pointers and is_owned flags and looks at the values in fields.
51244  * Two objects with NULL inner values will be considered "equal" here.
51245  */
51246 bool RouteHint_eq(const struct LDKRouteHint *NONNULL_PTR a, const struct LDKRouteHint *NONNULL_PTR b);
51247
51248 /**
51249  * Serialize the RouteHint object into a byte array which can be read by RouteHint_read
51250  */
51251 struct LDKCVec_u8Z RouteHint_write(const struct LDKRouteHint *NONNULL_PTR obj);
51252
51253 /**
51254  * Read a RouteHint from a byte array, created by RouteHint_write
51255  */
51256 struct LDKCResult_RouteHintDecodeErrorZ RouteHint_read(struct LDKu8slice ser);
51257
51258 /**
51259  * Frees any resources used by the RouteHintHop, if is_owned is set and inner is non-NULL.
51260  */
51261 void RouteHintHop_free(struct LDKRouteHintHop this_obj);
51262
51263 /**
51264  * The node_id of the non-target end of the route
51265  */
51266 struct LDKPublicKey RouteHintHop_get_src_node_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
51267
51268 /**
51269  * The node_id of the non-target end of the route
51270  */
51271 void RouteHintHop_set_src_node_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKPublicKey val);
51272
51273 /**
51274  * The short_channel_id of this channel
51275  */
51276 uint64_t RouteHintHop_get_short_channel_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
51277
51278 /**
51279  * The short_channel_id of this channel
51280  */
51281 void RouteHintHop_set_short_channel_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint64_t val);
51282
51283 /**
51284  * The fees which must be paid to use this channel
51285  */
51286 struct LDKRoutingFees RouteHintHop_get_fees(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
51287
51288 /**
51289  * The fees which must be paid to use this channel
51290  */
51291 void RouteHintHop_set_fees(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
51292
51293 /**
51294  * The difference in CLTV values between this node and the next node.
51295  */
51296 uint16_t RouteHintHop_get_cltv_expiry_delta(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
51297
51298 /**
51299  * The difference in CLTV values between this node and the next node.
51300  */
51301 void RouteHintHop_set_cltv_expiry_delta(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint16_t val);
51302
51303 /**
51304  * The minimum value, in msat, which must be relayed to the next hop.
51305  */
51306 struct LDKCOption_u64Z RouteHintHop_get_htlc_minimum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
51307
51308 /**
51309  * The minimum value, in msat, which must be relayed to the next hop.
51310  */
51311 void RouteHintHop_set_htlc_minimum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
51312
51313 /**
51314  * The maximum value in msat available for routing with a single HTLC.
51315  */
51316 struct LDKCOption_u64Z RouteHintHop_get_htlc_maximum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
51317
51318 /**
51319  * The maximum value in msat available for routing with a single HTLC.
51320  */
51321 void RouteHintHop_set_htlc_maximum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
51322
51323 /**
51324  * Constructs a new RouteHintHop given each field
51325  */
51326 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);
51327
51328 /**
51329  * Creates a copy of the RouteHintHop
51330  */
51331 struct LDKRouteHintHop RouteHintHop_clone(const struct LDKRouteHintHop *NONNULL_PTR orig);
51332
51333 /**
51334  * Generates a non-cryptographic 64-bit hash of the RouteHintHop.
51335  */
51336 uint64_t RouteHintHop_hash(const struct LDKRouteHintHop *NONNULL_PTR o);
51337
51338 /**
51339  * Checks if two RouteHintHops contain equal inner contents.
51340  * This ignores pointers and is_owned flags and looks at the values in fields.
51341  * Two objects with NULL inner values will be considered "equal" here.
51342  */
51343 bool RouteHintHop_eq(const struct LDKRouteHintHop *NONNULL_PTR a, const struct LDKRouteHintHop *NONNULL_PTR b);
51344
51345 /**
51346  * Serialize the RouteHintHop object into a byte array which can be read by RouteHintHop_read
51347  */
51348 struct LDKCVec_u8Z RouteHintHop_write(const struct LDKRouteHintHop *NONNULL_PTR obj);
51349
51350 /**
51351  * Read a RouteHintHop from a byte array, created by RouteHintHop_write
51352  */
51353 struct LDKCResult_RouteHintHopDecodeErrorZ RouteHintHop_read(struct LDKu8slice ser);
51354
51355 /**
51356  * Frees any resources used by the FirstHopCandidate, if is_owned is set and inner is non-NULL.
51357  */
51358 void FirstHopCandidate_free(struct LDKFirstHopCandidate this_obj);
51359
51360 /**
51361  * Creates a copy of the FirstHopCandidate
51362  */
51363 struct LDKFirstHopCandidate FirstHopCandidate_clone(const struct LDKFirstHopCandidate *NONNULL_PTR orig);
51364
51365 /**
51366  * Frees any resources used by the PublicHopCandidate, if is_owned is set and inner is non-NULL.
51367  */
51368 void PublicHopCandidate_free(struct LDKPublicHopCandidate this_obj);
51369
51370 /**
51371  * The short channel ID of the channel, i.e. the identifier by which we refer to this
51372  * channel.
51373  */
51374 uint64_t PublicHopCandidate_get_short_channel_id(const struct LDKPublicHopCandidate *NONNULL_PTR this_ptr);
51375
51376 /**
51377  * The short channel ID of the channel, i.e. the identifier by which we refer to this
51378  * channel.
51379  */
51380 void PublicHopCandidate_set_short_channel_id(struct LDKPublicHopCandidate *NONNULL_PTR this_ptr, uint64_t val);
51381
51382 /**
51383  * Creates a copy of the PublicHopCandidate
51384  */
51385 struct LDKPublicHopCandidate PublicHopCandidate_clone(const struct LDKPublicHopCandidate *NONNULL_PTR orig);
51386
51387 /**
51388  * Frees any resources used by the PrivateHopCandidate, if is_owned is set and inner is non-NULL.
51389  */
51390 void PrivateHopCandidate_free(struct LDKPrivateHopCandidate this_obj);
51391
51392 /**
51393  * Creates a copy of the PrivateHopCandidate
51394  */
51395 struct LDKPrivateHopCandidate PrivateHopCandidate_clone(const struct LDKPrivateHopCandidate *NONNULL_PTR orig);
51396
51397 /**
51398  * Frees any resources used by the BlindedPathCandidate, if is_owned is set and inner is non-NULL.
51399  */
51400 void BlindedPathCandidate_free(struct LDKBlindedPathCandidate this_obj);
51401
51402 /**
51403  * Creates a copy of the BlindedPathCandidate
51404  */
51405 struct LDKBlindedPathCandidate BlindedPathCandidate_clone(const struct LDKBlindedPathCandidate *NONNULL_PTR orig);
51406
51407 /**
51408  * Frees any resources used by the OneHopBlindedPathCandidate, if is_owned is set and inner is non-NULL.
51409  */
51410 void OneHopBlindedPathCandidate_free(struct LDKOneHopBlindedPathCandidate this_obj);
51411
51412 /**
51413  * Creates a copy of the OneHopBlindedPathCandidate
51414  */
51415 struct LDKOneHopBlindedPathCandidate OneHopBlindedPathCandidate_clone(const struct LDKOneHopBlindedPathCandidate *NONNULL_PTR orig);
51416
51417 /**
51418  * Frees any resources used by the CandidateRouteHop
51419  */
51420 void CandidateRouteHop_free(struct LDKCandidateRouteHop this_ptr);
51421
51422 /**
51423  * Creates a copy of the CandidateRouteHop
51424  */
51425 struct LDKCandidateRouteHop CandidateRouteHop_clone(const struct LDKCandidateRouteHop *NONNULL_PTR orig);
51426
51427 /**
51428  * Utility method to constructs a new FirstHop-variant CandidateRouteHop
51429  */
51430 struct LDKCandidateRouteHop CandidateRouteHop_first_hop(struct LDKFirstHopCandidate a);
51431
51432 /**
51433  * Utility method to constructs a new PublicHop-variant CandidateRouteHop
51434  */
51435 struct LDKCandidateRouteHop CandidateRouteHop_public_hop(struct LDKPublicHopCandidate a);
51436
51437 /**
51438  * Utility method to constructs a new PrivateHop-variant CandidateRouteHop
51439  */
51440 struct LDKCandidateRouteHop CandidateRouteHop_private_hop(struct LDKPrivateHopCandidate a);
51441
51442 /**
51443  * Utility method to constructs a new Blinded-variant CandidateRouteHop
51444  */
51445 struct LDKCandidateRouteHop CandidateRouteHop_blinded(struct LDKBlindedPathCandidate a);
51446
51447 /**
51448  * Utility method to constructs a new OneHopBlinded-variant CandidateRouteHop
51449  */
51450 struct LDKCandidateRouteHop CandidateRouteHop_one_hop_blinded(struct LDKOneHopBlindedPathCandidate a);
51451
51452 /**
51453  * Returns the globally unique short channel ID for this hop, if one is known.
51454  *
51455  * This only returns `Some` if the channel is public (either our own, or one we've learned
51456  * from the public network graph), and thus the short channel ID we have for this channel is
51457  * globally unique and identifies this channel in a global namespace.
51458  */
51459 MUST_USE_RES struct LDKCOption_u64Z CandidateRouteHop_globally_unique_short_channel_id(const struct LDKCandidateRouteHop *NONNULL_PTR this_arg);
51460
51461 /**
51462  * Returns the required difference in HTLC CLTV expiry between the [`Self::source`] and the
51463  * next-hop for an HTLC taking this hop.
51464  *
51465  * This is the time that the node(s) in this hop have to claim the HTLC on-chain if the
51466  * next-hop goes on chain with a payment preimage.
51467  */
51468 MUST_USE_RES uint32_t CandidateRouteHop_cltv_expiry_delta(const struct LDKCandidateRouteHop *NONNULL_PTR this_arg);
51469
51470 /**
51471  * Returns the minimum amount that can be sent over this hop, in millisatoshis.
51472  */
51473 MUST_USE_RES uint64_t CandidateRouteHop_htlc_minimum_msat(const struct LDKCandidateRouteHop *NONNULL_PTR this_arg);
51474
51475 /**
51476  * Returns the fees that must be paid to route an HTLC over this channel.
51477  */
51478 MUST_USE_RES struct LDKRoutingFees CandidateRouteHop_fees(const struct LDKCandidateRouteHop *NONNULL_PTR this_arg);
51479
51480 /**
51481  * Returns the source node id of current hop.
51482  *
51483  * Source node id refers to the node forwarding the HTLC through this hop.
51484  *
51485  * For [`Self::FirstHop`] we return payer's node id.
51486  */
51487 MUST_USE_RES struct LDKNodeId CandidateRouteHop_source(const struct LDKCandidateRouteHop *NONNULL_PTR this_arg);
51488
51489 /**
51490  * Returns the target node id of this hop, if known.
51491  *
51492  * Target node id refers to the node receiving the HTLC after this hop.
51493  *
51494  * For [`Self::Blinded`] we return `None` because the ultimate destination after the blinded
51495  * path is unknown.
51496  *
51497  * For [`Self::OneHopBlinded`] we return `None` because the target is the same as the source,
51498  * and such a return value would be somewhat nonsensical.
51499  *
51500  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
51501  */
51502 MUST_USE_RES struct LDKNodeId CandidateRouteHop_target(const struct LDKCandidateRouteHop *NONNULL_PTR this_arg);
51503
51504 /**
51505  * Finds a route from us (payer) to the given target node (payee).
51506  *
51507  * If the payee provided features in their invoice, they should be provided via the `payee` field
51508  * in the given [`RouteParameters::payment_params`].
51509  * Without this, MPP will only be used if the payee's features are available in the network graph.
51510  *
51511  * Private routing paths between a public node and the target may be included in the `payee` field
51512  * of [`RouteParameters::payment_params`].
51513  *
51514  * If some channels aren't announced, it may be useful to fill in `first_hops` with the results
51515  * from [`ChannelManager::list_usable_channels`]. If it is filled in, the view of these channels
51516  * from `network_graph` will be ignored, and only those in `first_hops` will be used.
51517  *
51518  * The fees on channels from us to the next hop are ignored as they are assumed to all be equal.
51519  * However, the enabled/disabled bit on such channels as well as the `htlc_minimum_msat` /
51520  * `htlc_maximum_msat` *are* checked as they may change based on the receiving node.
51521  *
51522  * # Panics
51523  *
51524  * Panics if first_hops contains channels without `short_channel_id`s;
51525  * [`ChannelManager::list_usable_channels`] will never include such channels.
51526  *
51527  * [`ChannelManager::list_usable_channels`]: crate::ln::channelmanager::ChannelManager::list_usable_channels
51528  * [`Event::PaymentPathFailed`]: crate::events::Event::PaymentPathFailed
51529  * [`NetworkGraph`]: crate::routing::gossip::NetworkGraph
51530  *
51531  * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None
51532  */
51533 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 LDKScoreLookUp *NONNULL_PTR scorer, const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR score_params, const uint8_t (*random_seed_bytes)[32]);
51534
51535 /**
51536  * Construct a route from us (payer) to the target node (payee) via the given hops (which should
51537  * exclude the payer, but include the payee). This may be useful, e.g., for probing the chosen path.
51538  *
51539  * Re-uses logic from `find_route`, so the restrictions described there also apply here.
51540  */
51541 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]);
51542
51543 /**
51544  * Calls the free function if one is set
51545  */
51546 void ScoreLookUp_free(struct LDKScoreLookUp this_ptr);
51547
51548 /**
51549  * Calls the free function if one is set
51550  */
51551 void ScoreUpdate_free(struct LDKScoreUpdate this_ptr);
51552
51553 /**
51554  * Calls the free function if one is set
51555  */
51556 void Score_free(struct LDKScore this_ptr);
51557
51558 /**
51559  * Calls the free function if one is set
51560  */
51561 void LockableScore_free(struct LDKLockableScore this_ptr);
51562
51563 /**
51564  * Calls the free function if one is set
51565  */
51566 void WriteableScore_free(struct LDKWriteableScore this_ptr);
51567
51568 /**
51569  * Frees any resources used by the MultiThreadedLockableScore, if is_owned is set and inner is non-NULL.
51570  */
51571 void MultiThreadedLockableScore_free(struct LDKMultiThreadedLockableScore this_obj);
51572
51573 /**
51574  * Constructs a new LockableScore which calls the relevant methods on this_arg.
51575  * This copies the `inner` pointer in this_arg and thus the returned LockableScore must be freed before this_arg is
51576  */
51577 struct LDKLockableScore MultiThreadedLockableScore_as_LockableScore(const struct LDKMultiThreadedLockableScore *NONNULL_PTR this_arg);
51578
51579 /**
51580  * Serialize the MultiThreadedLockableScore object into a byte array which can be read by MultiThreadedLockableScore_read
51581  */
51582 struct LDKCVec_u8Z MultiThreadedLockableScore_write(const struct LDKMultiThreadedLockableScore *NONNULL_PTR obj);
51583
51584 /**
51585  * Constructs a new WriteableScore which calls the relevant methods on this_arg.
51586  * This copies the `inner` pointer in this_arg and thus the returned WriteableScore must be freed before this_arg is
51587  */
51588 struct LDKWriteableScore MultiThreadedLockableScore_as_WriteableScore(const struct LDKMultiThreadedLockableScore *NONNULL_PTR this_arg);
51589
51590 /**
51591  * Creates a new [`MultiThreadedLockableScore`] given an underlying [`Score`].
51592  */
51593 MUST_USE_RES struct LDKMultiThreadedLockableScore MultiThreadedLockableScore_new(struct LDKScore score);
51594
51595 /**
51596  * Frees any resources used by the MultiThreadedScoreLockRead, if is_owned is set and inner is non-NULL.
51597  */
51598 void MultiThreadedScoreLockRead_free(struct LDKMultiThreadedScoreLockRead this_obj);
51599
51600 /**
51601  * Frees any resources used by the MultiThreadedScoreLockWrite, if is_owned is set and inner is non-NULL.
51602  */
51603 void MultiThreadedScoreLockWrite_free(struct LDKMultiThreadedScoreLockWrite this_obj);
51604
51605 /**
51606  * Constructs a new ScoreLookUp which calls the relevant methods on this_arg.
51607  * This copies the `inner` pointer in this_arg and thus the returned ScoreLookUp must be freed before this_arg is
51608  */
51609 struct LDKScoreLookUp MultiThreadedScoreLockRead_as_ScoreLookUp(const struct LDKMultiThreadedScoreLockRead *NONNULL_PTR this_arg);
51610
51611 /**
51612  * Serialize the MultiThreadedScoreLockWrite object into a byte array which can be read by MultiThreadedScoreLockWrite_read
51613  */
51614 struct LDKCVec_u8Z MultiThreadedScoreLockWrite_write(const struct LDKMultiThreadedScoreLockWrite *NONNULL_PTR obj);
51615
51616 /**
51617  * Constructs a new ScoreUpdate which calls the relevant methods on this_arg.
51618  * This copies the `inner` pointer in this_arg and thus the returned ScoreUpdate must be freed before this_arg is
51619  */
51620 struct LDKScoreUpdate MultiThreadedScoreLockWrite_as_ScoreUpdate(const struct LDKMultiThreadedScoreLockWrite *NONNULL_PTR this_arg);
51621
51622 /**
51623  * Frees any resources used by the ChannelUsage, if is_owned is set and inner is non-NULL.
51624  */
51625 void ChannelUsage_free(struct LDKChannelUsage this_obj);
51626
51627 /**
51628  * The amount to send through the channel, denominated in millisatoshis.
51629  */
51630 uint64_t ChannelUsage_get_amount_msat(const struct LDKChannelUsage *NONNULL_PTR this_ptr);
51631
51632 /**
51633  * The amount to send through the channel, denominated in millisatoshis.
51634  */
51635 void ChannelUsage_set_amount_msat(struct LDKChannelUsage *NONNULL_PTR this_ptr, uint64_t val);
51636
51637 /**
51638  * Total amount, denominated in millisatoshis, already allocated to send through the channel
51639  * as part of a multi-path payment.
51640  */
51641 uint64_t ChannelUsage_get_inflight_htlc_msat(const struct LDKChannelUsage *NONNULL_PTR this_ptr);
51642
51643 /**
51644  * Total amount, denominated in millisatoshis, already allocated to send through the channel
51645  * as part of a multi-path payment.
51646  */
51647 void ChannelUsage_set_inflight_htlc_msat(struct LDKChannelUsage *NONNULL_PTR this_ptr, uint64_t val);
51648
51649 /**
51650  * The effective capacity of the channel.
51651  */
51652 struct LDKEffectiveCapacity ChannelUsage_get_effective_capacity(const struct LDKChannelUsage *NONNULL_PTR this_ptr);
51653
51654 /**
51655  * The effective capacity of the channel.
51656  */
51657 void ChannelUsage_set_effective_capacity(struct LDKChannelUsage *NONNULL_PTR this_ptr, struct LDKEffectiveCapacity val);
51658
51659 /**
51660  * Constructs a new ChannelUsage given each field
51661  */
51662 MUST_USE_RES struct LDKChannelUsage ChannelUsage_new(uint64_t amount_msat_arg, uint64_t inflight_htlc_msat_arg, struct LDKEffectiveCapacity effective_capacity_arg);
51663
51664 /**
51665  * Creates a copy of the ChannelUsage
51666  */
51667 struct LDKChannelUsage ChannelUsage_clone(const struct LDKChannelUsage *NONNULL_PTR orig);
51668
51669 /**
51670  * Frees any resources used by the FixedPenaltyScorer, if is_owned is set and inner is non-NULL.
51671  */
51672 void FixedPenaltyScorer_free(struct LDKFixedPenaltyScorer this_obj);
51673
51674 /**
51675  * Creates a copy of the FixedPenaltyScorer
51676  */
51677 struct LDKFixedPenaltyScorer FixedPenaltyScorer_clone(const struct LDKFixedPenaltyScorer *NONNULL_PTR orig);
51678
51679 /**
51680  * Creates a new scorer using `penalty_msat`.
51681  */
51682 MUST_USE_RES struct LDKFixedPenaltyScorer FixedPenaltyScorer_with_penalty(uint64_t penalty_msat);
51683
51684 /**
51685  * Constructs a new ScoreLookUp which calls the relevant methods on this_arg.
51686  * This copies the `inner` pointer in this_arg and thus the returned ScoreLookUp must be freed before this_arg is
51687  */
51688 struct LDKScoreLookUp FixedPenaltyScorer_as_ScoreLookUp(const struct LDKFixedPenaltyScorer *NONNULL_PTR this_arg);
51689
51690 /**
51691  * Constructs a new ScoreUpdate which calls the relevant methods on this_arg.
51692  * This copies the `inner` pointer in this_arg and thus the returned ScoreUpdate must be freed before this_arg is
51693  */
51694 struct LDKScoreUpdate FixedPenaltyScorer_as_ScoreUpdate(const struct LDKFixedPenaltyScorer *NONNULL_PTR this_arg);
51695
51696 /**
51697  * Serialize the FixedPenaltyScorer object into a byte array which can be read by FixedPenaltyScorer_read
51698  */
51699 struct LDKCVec_u8Z FixedPenaltyScorer_write(const struct LDKFixedPenaltyScorer *NONNULL_PTR obj);
51700
51701 /**
51702  * Read a FixedPenaltyScorer from a byte array, created by FixedPenaltyScorer_write
51703  */
51704 struct LDKCResult_FixedPenaltyScorerDecodeErrorZ FixedPenaltyScorer_read(struct LDKu8slice ser, uint64_t arg);
51705
51706 /**
51707  * Frees any resources used by the ProbabilisticScorer, if is_owned is set and inner is non-NULL.
51708  */
51709 void ProbabilisticScorer_free(struct LDKProbabilisticScorer this_obj);
51710
51711 /**
51712  * Frees any resources used by the ProbabilisticScoringFeeParameters, if is_owned is set and inner is non-NULL.
51713  */
51714 void ProbabilisticScoringFeeParameters_free(struct LDKProbabilisticScoringFeeParameters this_obj);
51715
51716 /**
51717  * A fixed penalty in msats to apply to each channel.
51718  *
51719  * Default value: 500 msat
51720  */
51721 uint64_t ProbabilisticScoringFeeParameters_get_base_penalty_msat(const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr);
51722
51723 /**
51724  * A fixed penalty in msats to apply to each channel.
51725  *
51726  * Default value: 500 msat
51727  */
51728 void ProbabilisticScoringFeeParameters_set_base_penalty_msat(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr, uint64_t val);
51729
51730 /**
51731  * A multiplier used with the total amount flowing over a channel to calculate a fixed penalty
51732  * applied to each channel, in excess of the [`base_penalty_msat`].
51733  *
51734  * The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e.,
51735  * fees plus penalty) for large payments. The penalty is computed as the product of this
51736  * multiplier and `2^30`ths of the total amount flowing over a channel (i.e. the payment
51737  * amount plus the amount of any other HTLCs flowing we sent over the same channel).
51738  *
51739  * ie `base_penalty_amount_multiplier_msat * amount_msat / 2^30`
51740  *
51741  * Default value: 8,192 msat
51742  *
51743  * [`base_penalty_msat`]: Self::base_penalty_msat
51744  */
51745 uint64_t ProbabilisticScoringFeeParameters_get_base_penalty_amount_multiplier_msat(const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr);
51746
51747 /**
51748  * A multiplier used with the total amount flowing over a channel to calculate a fixed penalty
51749  * applied to each channel, in excess of the [`base_penalty_msat`].
51750  *
51751  * The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e.,
51752  * fees plus penalty) for large payments. The penalty is computed as the product of this
51753  * multiplier and `2^30`ths of the total amount flowing over a channel (i.e. the payment
51754  * amount plus the amount of any other HTLCs flowing we sent over the same channel).
51755  *
51756  * ie `base_penalty_amount_multiplier_msat * amount_msat / 2^30`
51757  *
51758  * Default value: 8,192 msat
51759  *
51760  * [`base_penalty_msat`]: Self::base_penalty_msat
51761  */
51762 void ProbabilisticScoringFeeParameters_set_base_penalty_amount_multiplier_msat(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr, uint64_t val);
51763
51764 /**
51765  * A multiplier used in conjunction with the negative `log10` of the channel's success
51766  * probability for a payment, as determined by our latest estimates of the channel's
51767  * liquidity, to determine the liquidity penalty.
51768  *
51769  * The penalty is based in part on the knowledge learned from prior successful and unsuccessful
51770  * payments. This knowledge is decayed over time based on [`liquidity_offset_half_life`]. The
51771  * penalty is effectively limited to `2 * liquidity_penalty_multiplier_msat` (corresponding to
51772  * lower bounding the success probability to `0.01`) when the amount falls within the
51773  * uncertainty bounds of the channel liquidity balance. Amounts above the upper bound will
51774  * result in a `u64::max_value` penalty, however.
51775  *
51776  * `-log10(success_probability) * liquidity_penalty_multiplier_msat`
51777  *
51778  * Default value: 30,000 msat
51779  *
51780  * [`liquidity_offset_half_life`]: ProbabilisticScoringDecayParameters::liquidity_offset_half_life
51781  */
51782 uint64_t ProbabilisticScoringFeeParameters_get_liquidity_penalty_multiplier_msat(const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr);
51783
51784 /**
51785  * A multiplier used in conjunction with the negative `log10` of the channel's success
51786  * probability for a payment, as determined by our latest estimates of the channel's
51787  * liquidity, to determine the liquidity penalty.
51788  *
51789  * The penalty is based in part on the knowledge learned from prior successful and unsuccessful
51790  * payments. This knowledge is decayed over time based on [`liquidity_offset_half_life`]. The
51791  * penalty is effectively limited to `2 * liquidity_penalty_multiplier_msat` (corresponding to
51792  * lower bounding the success probability to `0.01`) when the amount falls within the
51793  * uncertainty bounds of the channel liquidity balance. Amounts above the upper bound will
51794  * result in a `u64::max_value` penalty, however.
51795  *
51796  * `-log10(success_probability) * liquidity_penalty_multiplier_msat`
51797  *
51798  * Default value: 30,000 msat
51799  *
51800  * [`liquidity_offset_half_life`]: ProbabilisticScoringDecayParameters::liquidity_offset_half_life
51801  */
51802 void ProbabilisticScoringFeeParameters_set_liquidity_penalty_multiplier_msat(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr, uint64_t val);
51803
51804 /**
51805  * A multiplier used in conjunction with the total amount flowing over a channel and the
51806  * negative `log10` of the channel's success probability for the payment, as determined by our
51807  * latest estimates of the channel's liquidity, to determine the amount penalty.
51808  *
51809  * The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e.,
51810  * fees plus penalty) for large payments. The penalty is computed as the product of this
51811  * multiplier and `2^20`ths of the amount flowing over this channel, weighted by the negative
51812  * `log10` of the success probability.
51813  *
51814  * `-log10(success_probability) * liquidity_penalty_amount_multiplier_msat * amount_msat / 2^20`
51815  *
51816  * In practice, this means for 0.1 success probability (`-log10(0.1) == 1`) each `2^20`th of
51817  * the amount will result in a penalty of the multiplier. And, as the success probability
51818  * decreases, the negative `log10` weighting will increase dramatically. For higher success
51819  * probabilities, the multiplier will have a decreasing effect as the negative `log10` will
51820  * fall below `1`.
51821  *
51822  * Default value: 192 msat
51823  */
51824 uint64_t ProbabilisticScoringFeeParameters_get_liquidity_penalty_amount_multiplier_msat(const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr);
51825
51826 /**
51827  * A multiplier used in conjunction with the total amount flowing over a channel and the
51828  * negative `log10` of the channel's success probability for the payment, as determined by our
51829  * latest estimates of the channel's liquidity, to determine the amount penalty.
51830  *
51831  * The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e.,
51832  * fees plus penalty) for large payments. The penalty is computed as the product of this
51833  * multiplier and `2^20`ths of the amount flowing over this channel, weighted by the negative
51834  * `log10` of the success probability.
51835  *
51836  * `-log10(success_probability) * liquidity_penalty_amount_multiplier_msat * amount_msat / 2^20`
51837  *
51838  * In practice, this means for 0.1 success probability (`-log10(0.1) == 1`) each `2^20`th of
51839  * the amount will result in a penalty of the multiplier. And, as the success probability
51840  * decreases, the negative `log10` weighting will increase dramatically. For higher success
51841  * probabilities, the multiplier will have a decreasing effect as the negative `log10` will
51842  * fall below `1`.
51843  *
51844  * Default value: 192 msat
51845  */
51846 void ProbabilisticScoringFeeParameters_set_liquidity_penalty_amount_multiplier_msat(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr, uint64_t val);
51847
51848 /**
51849  * A multiplier used in conjunction with the negative `log10` of the channel's success
51850  * probability for the payment, as determined based on the history of our estimates of the
51851  * channel's available liquidity, to determine a penalty.
51852  *
51853  * This penalty is similar to [`liquidity_penalty_multiplier_msat`], however, instead of using
51854  * only our latest estimate for the current liquidity available in the channel, it estimates
51855  * success probability based on the estimated liquidity available in the channel through
51856  * history. Specifically, every time we update our liquidity bounds on a given channel, we
51857  * track which of several buckets those bounds fall into, exponentially decaying the
51858  * probability of each bucket as new samples are added.
51859  *
51860  * Default value: 10,000 msat
51861  *
51862  * [`liquidity_penalty_multiplier_msat`]: Self::liquidity_penalty_multiplier_msat
51863  */
51864 uint64_t ProbabilisticScoringFeeParameters_get_historical_liquidity_penalty_multiplier_msat(const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr);
51865
51866 /**
51867  * A multiplier used in conjunction with the negative `log10` of the channel's success
51868  * probability for the payment, as determined based on the history of our estimates of the
51869  * channel's available liquidity, to determine a penalty.
51870  *
51871  * This penalty is similar to [`liquidity_penalty_multiplier_msat`], however, instead of using
51872  * only our latest estimate for the current liquidity available in the channel, it estimates
51873  * success probability based on the estimated liquidity available in the channel through
51874  * history. Specifically, every time we update our liquidity bounds on a given channel, we
51875  * track which of several buckets those bounds fall into, exponentially decaying the
51876  * probability of each bucket as new samples are added.
51877  *
51878  * Default value: 10,000 msat
51879  *
51880  * [`liquidity_penalty_multiplier_msat`]: Self::liquidity_penalty_multiplier_msat
51881  */
51882 void ProbabilisticScoringFeeParameters_set_historical_liquidity_penalty_multiplier_msat(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr, uint64_t val);
51883
51884 /**
51885  * A multiplier used in conjunction with the total amount flowing over a channel and the
51886  * negative `log10` of the channel's success probability for the payment, as determined based
51887  * on the history of our estimates of the channel's available liquidity, to determine a
51888  * penalty.
51889  *
51890  * The purpose of the amount penalty is to avoid having fees dominate the channel cost for
51891  * large payments. The penalty is computed as the product of this multiplier and `2^20`ths
51892  * of the amount flowing over this channel, weighted by the negative `log10` of the success
51893  * probability.
51894  *
51895  * This penalty is similar to [`liquidity_penalty_amount_multiplier_msat`], however, instead
51896  * of using only our latest estimate for the current liquidity available in the channel, it
51897  * estimates success probability based on the estimated liquidity available in the channel
51898  * through history. Specifically, every time we update our liquidity bounds on a given
51899  * channel, we track which of several buckets those bounds fall into, exponentially decaying
51900  * the probability of each bucket as new samples are added.
51901  *
51902  * Default value: 64 msat
51903  *
51904  * [`liquidity_penalty_amount_multiplier_msat`]: Self::liquidity_penalty_amount_multiplier_msat
51905  */
51906 uint64_t ProbabilisticScoringFeeParameters_get_historical_liquidity_penalty_amount_multiplier_msat(const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr);
51907
51908 /**
51909  * A multiplier used in conjunction with the total amount flowing over a channel and the
51910  * negative `log10` of the channel's success probability for the payment, as determined based
51911  * on the history of our estimates of the channel's available liquidity, to determine a
51912  * penalty.
51913  *
51914  * The purpose of the amount penalty is to avoid having fees dominate the channel cost for
51915  * large payments. The penalty is computed as the product of this multiplier and `2^20`ths
51916  * of the amount flowing over this channel, weighted by the negative `log10` of the success
51917  * probability.
51918  *
51919  * This penalty is similar to [`liquidity_penalty_amount_multiplier_msat`], however, instead
51920  * of using only our latest estimate for the current liquidity available in the channel, it
51921  * estimates success probability based on the estimated liquidity available in the channel
51922  * through history. Specifically, every time we update our liquidity bounds on a given
51923  * channel, we track which of several buckets those bounds fall into, exponentially decaying
51924  * the probability of each bucket as new samples are added.
51925  *
51926  * Default value: 64 msat
51927  *
51928  * [`liquidity_penalty_amount_multiplier_msat`]: Self::liquidity_penalty_amount_multiplier_msat
51929  */
51930 void ProbabilisticScoringFeeParameters_set_historical_liquidity_penalty_amount_multiplier_msat(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr, uint64_t val);
51931
51932 /**
51933  * This penalty is applied when `htlc_maximum_msat` is equal to or larger than half of the
51934  * channel's capacity, (ie. htlc_maximum_msat >= 0.5 * channel_capacity) which makes us
51935  * prefer nodes with a smaller `htlc_maximum_msat`. We treat such nodes preferentially
51936  * as this makes balance discovery attacks harder to execute, thereby creating an incentive
51937  * to restrict `htlc_maximum_msat` and improve privacy.
51938  *
51939  * Default value: 250 msat
51940  */
51941 uint64_t ProbabilisticScoringFeeParameters_get_anti_probing_penalty_msat(const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr);
51942
51943 /**
51944  * This penalty is applied when `htlc_maximum_msat` is equal to or larger than half of the
51945  * channel's capacity, (ie. htlc_maximum_msat >= 0.5 * channel_capacity) which makes us
51946  * prefer nodes with a smaller `htlc_maximum_msat`. We treat such nodes preferentially
51947  * as this makes balance discovery attacks harder to execute, thereby creating an incentive
51948  * to restrict `htlc_maximum_msat` and improve privacy.
51949  *
51950  * Default value: 250 msat
51951  */
51952 void ProbabilisticScoringFeeParameters_set_anti_probing_penalty_msat(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr, uint64_t val);
51953
51954 /**
51955  * This penalty is applied when the total amount flowing over a channel exceeds our current
51956  * estimate of the channel's available liquidity. The total amount is the amount of the
51957  * current HTLC plus any HTLCs which we've sent over the same channel.
51958  *
51959  * Note that in this case all other penalties, including the
51960  * [`liquidity_penalty_multiplier_msat`] and [`liquidity_penalty_amount_multiplier_msat`]-based
51961  * penalties, as well as the [`base_penalty_msat`] and the [`anti_probing_penalty_msat`], if
51962  * applicable, are still included in the overall penalty.
51963  *
51964  * If you wish to avoid creating paths with such channels entirely, setting this to a value of
51965  * `u64::max_value()` will guarantee that.
51966  *
51967  * Default value: 1_0000_0000_000 msat (1 Bitcoin)
51968  *
51969  * [`liquidity_penalty_multiplier_msat`]: Self::liquidity_penalty_multiplier_msat
51970  * [`liquidity_penalty_amount_multiplier_msat`]: Self::liquidity_penalty_amount_multiplier_msat
51971  * [`base_penalty_msat`]: Self::base_penalty_msat
51972  * [`anti_probing_penalty_msat`]: Self::anti_probing_penalty_msat
51973  */
51974 uint64_t ProbabilisticScoringFeeParameters_get_considered_impossible_penalty_msat(const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr);
51975
51976 /**
51977  * This penalty is applied when the total amount flowing over a channel exceeds our current
51978  * estimate of the channel's available liquidity. The total amount is the amount of the
51979  * current HTLC plus any HTLCs which we've sent over the same channel.
51980  *
51981  * Note that in this case all other penalties, including the
51982  * [`liquidity_penalty_multiplier_msat`] and [`liquidity_penalty_amount_multiplier_msat`]-based
51983  * penalties, as well as the [`base_penalty_msat`] and the [`anti_probing_penalty_msat`], if
51984  * applicable, are still included in the overall penalty.
51985  *
51986  * If you wish to avoid creating paths with such channels entirely, setting this to a value of
51987  * `u64::max_value()` will guarantee that.
51988  *
51989  * Default value: 1_0000_0000_000 msat (1 Bitcoin)
51990  *
51991  * [`liquidity_penalty_multiplier_msat`]: Self::liquidity_penalty_multiplier_msat
51992  * [`liquidity_penalty_amount_multiplier_msat`]: Self::liquidity_penalty_amount_multiplier_msat
51993  * [`base_penalty_msat`]: Self::base_penalty_msat
51994  * [`anti_probing_penalty_msat`]: Self::anti_probing_penalty_msat
51995  */
51996 void ProbabilisticScoringFeeParameters_set_considered_impossible_penalty_msat(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr, uint64_t val);
51997
51998 /**
51999  * In order to calculate most of the scores above, we must first convert a lower and upper
52000  * bound on the available liquidity in a channel into the probability that we think a payment
52001  * will succeed. That probability is derived from a Probability Density Function for where we
52002  * think the liquidity in a channel likely lies, given such bounds.
52003  *
52004  * If this flag is set, that PDF is simply a constant - we assume that the actual available
52005  * liquidity in a channel is just as likely to be at any point between our lower and upper
52006  * bounds.
52007  *
52008  * If this flag is *not* set, that PDF is `(x - 0.5*capacity) ^ 2`. That is, we use an
52009  * exponential curve which expects the liquidity of a channel to lie \"at the edges\". This
52010  * matches experimental results - most routing nodes do not aggressively rebalance their
52011  * channels and flows in the network are often unbalanced, leaving liquidity usually
52012  * unavailable.
52013  *
52014  * Thus, for the \"best\" routes, leave this flag `false`. However, the flag does imply a number
52015  * of floating-point multiplications in the hottest routing code, which may lead to routing
52016  * performance degradation on some machines.
52017  *
52018  * Default value: false
52019  */
52020 bool ProbabilisticScoringFeeParameters_get_linear_success_probability(const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr);
52021
52022 /**
52023  * In order to calculate most of the scores above, we must first convert a lower and upper
52024  * bound on the available liquidity in a channel into the probability that we think a payment
52025  * will succeed. That probability is derived from a Probability Density Function for where we
52026  * think the liquidity in a channel likely lies, given such bounds.
52027  *
52028  * If this flag is set, that PDF is simply a constant - we assume that the actual available
52029  * liquidity in a channel is just as likely to be at any point between our lower and upper
52030  * bounds.
52031  *
52032  * If this flag is *not* set, that PDF is `(x - 0.5*capacity) ^ 2`. That is, we use an
52033  * exponential curve which expects the liquidity of a channel to lie \"at the edges\". This
52034  * matches experimental results - most routing nodes do not aggressively rebalance their
52035  * channels and flows in the network are often unbalanced, leaving liquidity usually
52036  * unavailable.
52037  *
52038  * Thus, for the \"best\" routes, leave this flag `false`. However, the flag does imply a number
52039  * of floating-point multiplications in the hottest routing code, which may lead to routing
52040  * performance degradation on some machines.
52041  *
52042  * Default value: false
52043  */
52044 void ProbabilisticScoringFeeParameters_set_linear_success_probability(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr, bool val);
52045
52046 /**
52047  * Creates a copy of the ProbabilisticScoringFeeParameters
52048  */
52049 struct LDKProbabilisticScoringFeeParameters ProbabilisticScoringFeeParameters_clone(const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR orig);
52050
52051 /**
52052  * Creates a "default" ProbabilisticScoringFeeParameters. See struct and individual field documentaiton for details on which values are used.
52053  */
52054 MUST_USE_RES struct LDKProbabilisticScoringFeeParameters ProbabilisticScoringFeeParameters_default(void);
52055
52056 /**
52057  * Marks the node with the given `node_id` as banned,
52058  * i.e it will be avoided during path finding.
52059  */
52060 void ProbabilisticScoringFeeParameters_add_banned(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR node_id);
52061
52062 /**
52063  * Marks all nodes in the given list as banned, i.e.,
52064  * they will be avoided during path finding.
52065  */
52066 void ProbabilisticScoringFeeParameters_add_banned_from_list(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_arg, struct LDKCVec_NodeIdZ node_ids);
52067
52068 /**
52069  * Removes the node with the given `node_id` from the list of nodes to avoid.
52070  */
52071 void ProbabilisticScoringFeeParameters_remove_banned(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR node_id);
52072
52073 /**
52074  * Sets a manual penalty for the given node.
52075  */
52076 void ProbabilisticScoringFeeParameters_set_manual_penalty(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR node_id, uint64_t penalty);
52077
52078 /**
52079  * Removes the node with the given `node_id` from the list of manual penalties.
52080  */
52081 void ProbabilisticScoringFeeParameters_remove_manual_penalty(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR node_id);
52082
52083 /**
52084  * Clears the list of manual penalties that are applied during path finding.
52085  */
52086 void ProbabilisticScoringFeeParameters_clear_manual_penalties(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_arg);
52087
52088 /**
52089  * Frees any resources used by the ProbabilisticScoringDecayParameters, if is_owned is set and inner is non-NULL.
52090  */
52091 void ProbabilisticScoringDecayParameters_free(struct LDKProbabilisticScoringDecayParameters this_obj);
52092
52093 /**
52094  * If we aren't learning any new datapoints for a channel, the historical liquidity bounds
52095  * tracking can simply live on with increasingly stale data. Instead, when a channel has not
52096  * seen a liquidity estimate update for this amount of time, the historical datapoints are
52097  * decayed by half.
52098  * For an example of historical_no_updates_half_life being used see [`historical_estimated_channel_liquidity_probabilities`]
52099  *
52100  * Note that after 16 or more half lives all historical data will be completely gone.
52101  *
52102  * Default value: 14 days
52103  *
52104  * [`historical_estimated_channel_liquidity_probabilities`]: ProbabilisticScorer::historical_estimated_channel_liquidity_probabilities
52105  */
52106 uint64_t ProbabilisticScoringDecayParameters_get_historical_no_updates_half_life(const struct LDKProbabilisticScoringDecayParameters *NONNULL_PTR this_ptr);
52107
52108 /**
52109  * If we aren't learning any new datapoints for a channel, the historical liquidity bounds
52110  * tracking can simply live on with increasingly stale data. Instead, when a channel has not
52111  * seen a liquidity estimate update for this amount of time, the historical datapoints are
52112  * decayed by half.
52113  * For an example of historical_no_updates_half_life being used see [`historical_estimated_channel_liquidity_probabilities`]
52114  *
52115  * Note that after 16 or more half lives all historical data will be completely gone.
52116  *
52117  * Default value: 14 days
52118  *
52119  * [`historical_estimated_channel_liquidity_probabilities`]: ProbabilisticScorer::historical_estimated_channel_liquidity_probabilities
52120  */
52121 void ProbabilisticScoringDecayParameters_set_historical_no_updates_half_life(struct LDKProbabilisticScoringDecayParameters *NONNULL_PTR this_ptr, uint64_t val);
52122
52123 /**
52124  * Whenever this amount of time elapses since the last update to a channel's liquidity bounds,
52125  * the distance from the bounds to \"zero\" is cut in half. In other words, the lower-bound on
52126  * the available liquidity is halved and the upper-bound moves half-way to the channel's total
52127  * capacity.
52128  *
52129  * Because halving the liquidity bounds grows the uncertainty on the channel's liquidity,
52130  * the penalty for an amount within the new bounds may change. See the [`ProbabilisticScorer`]
52131  * struct documentation for more info on the way the liquidity bounds are used.
52132  *
52133  * For example, if the channel's capacity is 1 million sats, and the current upper and lower
52134  * liquidity bounds are 200,000 sats and 600,000 sats, after this amount of time the upper
52135  * and lower liquidity bounds will be decayed to 100,000 and 800,000 sats.
52136  *
52137  * Default value: 6 hours
52138  *
52139  * # Note
52140  *
52141  * When built with the `no-std` feature, time will never elapse. Therefore, the channel
52142  * liquidity knowledge will never decay except when the bounds cross.
52143  */
52144 uint64_t ProbabilisticScoringDecayParameters_get_liquidity_offset_half_life(const struct LDKProbabilisticScoringDecayParameters *NONNULL_PTR this_ptr);
52145
52146 /**
52147  * Whenever this amount of time elapses since the last update to a channel's liquidity bounds,
52148  * the distance from the bounds to \"zero\" is cut in half. In other words, the lower-bound on
52149  * the available liquidity is halved and the upper-bound moves half-way to the channel's total
52150  * capacity.
52151  *
52152  * Because halving the liquidity bounds grows the uncertainty on the channel's liquidity,
52153  * the penalty for an amount within the new bounds may change. See the [`ProbabilisticScorer`]
52154  * struct documentation for more info on the way the liquidity bounds are used.
52155  *
52156  * For example, if the channel's capacity is 1 million sats, and the current upper and lower
52157  * liquidity bounds are 200,000 sats and 600,000 sats, after this amount of time the upper
52158  * and lower liquidity bounds will be decayed to 100,000 and 800,000 sats.
52159  *
52160  * Default value: 6 hours
52161  *
52162  * # Note
52163  *
52164  * When built with the `no-std` feature, time will never elapse. Therefore, the channel
52165  * liquidity knowledge will never decay except when the bounds cross.
52166  */
52167 void ProbabilisticScoringDecayParameters_set_liquidity_offset_half_life(struct LDKProbabilisticScoringDecayParameters *NONNULL_PTR this_ptr, uint64_t val);
52168
52169 /**
52170  * Constructs a new ProbabilisticScoringDecayParameters given each field
52171  */
52172 MUST_USE_RES struct LDKProbabilisticScoringDecayParameters ProbabilisticScoringDecayParameters_new(uint64_t historical_no_updates_half_life_arg, uint64_t liquidity_offset_half_life_arg);
52173
52174 /**
52175  * Creates a copy of the ProbabilisticScoringDecayParameters
52176  */
52177 struct LDKProbabilisticScoringDecayParameters ProbabilisticScoringDecayParameters_clone(const struct LDKProbabilisticScoringDecayParameters *NONNULL_PTR orig);
52178
52179 /**
52180  * Creates a "default" ProbabilisticScoringDecayParameters. See struct and individual field documentaiton for details on which values are used.
52181  */
52182 MUST_USE_RES struct LDKProbabilisticScoringDecayParameters ProbabilisticScoringDecayParameters_default(void);
52183
52184 /**
52185  * Creates a new scorer using the given scoring parameters for sending payments from a node
52186  * through a network graph.
52187  */
52188 MUST_USE_RES struct LDKProbabilisticScorer ProbabilisticScorer_new(struct LDKProbabilisticScoringDecayParameters decay_params, const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKLogger logger);
52189
52190 /**
52191  * Dump the contents of this scorer into the configured logger.
52192  *
52193  * Note that this writes roughly one line per channel for which we have a liquidity estimate,
52194  * which may be a substantial amount of log output.
52195  */
52196 void ProbabilisticScorer_debug_log_liquidity_stats(const struct LDKProbabilisticScorer *NONNULL_PTR this_arg);
52197
52198 /**
52199  * Query the estimated minimum and maximum liquidity available for sending a payment over the
52200  * channel with `scid` towards the given `target` node.
52201  */
52202 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);
52203
52204 /**
52205  * Query the historical estimated minimum and maximum liquidity available for sending a
52206  * payment over the channel with `scid` towards the given `target` node.
52207  *
52208  * Returns two sets of 32 buckets. The first set describes the lower-bound liquidity history,
52209  * the second set describes the upper-bound liquidity history. Each bucket describes the
52210  * relative frequency at which we've seen a liquidity bound in the bucket's range relative to
52211  * the channel's total capacity, on an arbitrary scale. Because the values are slowly decayed,
52212  * more recent data points are weighted more heavily than older datapoints.
52213  *
52214  * Note that the range of each bucket varies by its location to provide more granular results
52215  * at the edges of a channel's capacity, where it is more likely to sit.
52216  *
52217  * When scoring, the estimated probability that an upper-/lower-bound lies in a given bucket
52218  * is calculated by dividing that bucket's value with the total value of all buckets.
52219  *
52220  * For example, using a lower bucket count for illustrative purposes, a value of
52221  * `[0, 0, 0, ..., 0, 32]` indicates that we believe the probability of a bound being very
52222  * close to the channel's capacity to be 100%, and have never (recently) seen it in any other
52223  * bucket. A value of `[31, 0, 0, ..., 0, 0, 32]` indicates we've seen the bound being both
52224  * in the top and bottom bucket, and roughly with similar (recent) frequency.
52225  *
52226  * Because the datapoints are decayed slowly over time, values will eventually return to
52227  * `Some(([0; 32], [0; 32]))` or `None` if no data remains for a channel.
52228  *
52229  * In order to fetch a single success probability from the buckets provided here, as used in
52230  * the scoring model, see [`Self::historical_estimated_payment_success_probability`].
52231  */
52232 MUST_USE_RES struct LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ ProbabilisticScorer_historical_estimated_channel_liquidity_probabilities(const struct LDKProbabilisticScorer *NONNULL_PTR this_arg, uint64_t scid, const struct LDKNodeId *NONNULL_PTR target);
52233
52234 /**
52235  * Query the probability of payment success sending the given `amount_msat` over the channel
52236  * with `scid` towards the given `target` node, based on the historical estimated liquidity
52237  * bounds.
52238  *
52239  * These are the same bounds as returned by
52240  * [`Self::historical_estimated_channel_liquidity_probabilities`] (but not those returned by
52241  * [`Self::estimated_channel_liquidity_range`]).
52242  */
52243 MUST_USE_RES struct LDKCOption_f64Z ProbabilisticScorer_historical_estimated_payment_success_probability(const struct LDKProbabilisticScorer *NONNULL_PTR this_arg, uint64_t scid, const struct LDKNodeId *NONNULL_PTR target, uint64_t amount_msat, const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR params);
52244
52245 /**
52246  * Constructs a new ScoreLookUp which calls the relevant methods on this_arg.
52247  * This copies the `inner` pointer in this_arg and thus the returned ScoreLookUp must be freed before this_arg is
52248  */
52249 struct LDKScoreLookUp ProbabilisticScorer_as_ScoreLookUp(const struct LDKProbabilisticScorer *NONNULL_PTR this_arg);
52250
52251 /**
52252  * Constructs a new ScoreUpdate which calls the relevant methods on this_arg.
52253  * This copies the `inner` pointer in this_arg and thus the returned ScoreUpdate must be freed before this_arg is
52254  */
52255 struct LDKScoreUpdate ProbabilisticScorer_as_ScoreUpdate(const struct LDKProbabilisticScorer *NONNULL_PTR this_arg);
52256
52257 /**
52258  * Constructs a new Score which calls the relevant methods on this_arg.
52259  * This copies the `inner` pointer in this_arg and thus the returned Score must be freed before this_arg is
52260  */
52261 struct LDKScore ProbabilisticScorer_as_Score(const struct LDKProbabilisticScorer *NONNULL_PTR this_arg);
52262
52263 /**
52264  * Serialize the ProbabilisticScorer object into a byte array which can be read by ProbabilisticScorer_read
52265  */
52266 struct LDKCVec_u8Z ProbabilisticScorer_write(const struct LDKProbabilisticScorer *NONNULL_PTR obj);
52267
52268 /**
52269  * Read a ProbabilisticScorer from a byte array, created by ProbabilisticScorer_write
52270  */
52271 struct LDKCResult_ProbabilisticScorerDecodeErrorZ ProbabilisticScorer_read(struct LDKu8slice ser, struct LDKProbabilisticScoringDecayParameters arg_a, const struct LDKNetworkGraph *NONNULL_PTR arg_b, struct LDKLogger arg_c);
52272
52273 /**
52274  * Frees any resources used by the DelayedPaymentOutputDescriptor, if is_owned is set and inner is non-NULL.
52275  */
52276 void DelayedPaymentOutputDescriptor_free(struct LDKDelayedPaymentOutputDescriptor this_obj);
52277
52278 /**
52279  * The outpoint which is spendable.
52280  */
52281 struct LDKOutPoint DelayedPaymentOutputDescriptor_get_outpoint(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
52282
52283 /**
52284  * The outpoint which is spendable.
52285  */
52286 void DelayedPaymentOutputDescriptor_set_outpoint(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val);
52287
52288 /**
52289  * Per commitment point to derive the delayed payment key by key holder.
52290  */
52291 struct LDKPublicKey DelayedPaymentOutputDescriptor_get_per_commitment_point(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
52292
52293 /**
52294  * Per commitment point to derive the delayed payment key by key holder.
52295  */
52296 void DelayedPaymentOutputDescriptor_set_per_commitment_point(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val);
52297
52298 /**
52299  * The `nSequence` value which must be set in the spending input to satisfy the `OP_CSV` in
52300  * the witness_script.
52301  */
52302 uint16_t DelayedPaymentOutputDescriptor_get_to_self_delay(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
52303
52304 /**
52305  * The `nSequence` value which must be set in the spending input to satisfy the `OP_CSV` in
52306  * the witness_script.
52307  */
52308 void DelayedPaymentOutputDescriptor_set_to_self_delay(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint16_t val);
52309
52310 /**
52311  * The output which is referenced by the given outpoint.
52312  */
52313 struct LDKTxOut DelayedPaymentOutputDescriptor_get_output(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
52314
52315 /**
52316  * The output which is referenced by the given outpoint.
52317  */
52318 void DelayedPaymentOutputDescriptor_set_output(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val);
52319
52320 /**
52321  * The revocation point specific to the commitment transaction which was broadcast. Used to
52322  * derive the witnessScript for this output.
52323  */
52324 struct LDKRevocationKey DelayedPaymentOutputDescriptor_get_revocation_pubkey(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
52325
52326 /**
52327  * The revocation point specific to the commitment transaction which was broadcast. Used to
52328  * derive the witnessScript for this output.
52329  */
52330 void DelayedPaymentOutputDescriptor_set_revocation_pubkey(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKRevocationKey val);
52331
52332 /**
52333  * Arbitrary identification information returned by a call to [`ChannelSigner::channel_keys_id`].
52334  * This may be useful in re-deriving keys used in the channel to spend the output.
52335  */
52336 const uint8_t (*DelayedPaymentOutputDescriptor_get_channel_keys_id(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32];
52337
52338 /**
52339  * Arbitrary identification information returned by a call to [`ChannelSigner::channel_keys_id`].
52340  * This may be useful in re-deriving keys used in the channel to spend the output.
52341  */
52342 void DelayedPaymentOutputDescriptor_set_channel_keys_id(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
52343
52344 /**
52345  * The value of the channel which this output originated from, possibly indirectly.
52346  */
52347 uint64_t DelayedPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
52348
52349 /**
52350  * The value of the channel which this output originated from, possibly indirectly.
52351  */
52352 void DelayedPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val);
52353
52354 /**
52355  * The channel public keys and other parameters needed to generate a spending transaction or
52356  * to provide to a re-derived signer through [`ChannelSigner::provide_channel_parameters`].
52357  *
52358  * Added as optional, but always `Some` if the descriptor was produced in v0.0.123 or later.
52359  *
52360  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
52361  */
52362 struct LDKChannelTransactionParameters DelayedPaymentOutputDescriptor_get_channel_transaction_parameters(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
52363
52364 /**
52365  * The channel public keys and other parameters needed to generate a spending transaction or
52366  * to provide to a re-derived signer through [`ChannelSigner::provide_channel_parameters`].
52367  *
52368  * Added as optional, but always `Some` if the descriptor was produced in v0.0.123 or later.
52369  *
52370  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
52371  */
52372 void DelayedPaymentOutputDescriptor_set_channel_transaction_parameters(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKChannelTransactionParameters val);
52373
52374 /**
52375  * Constructs a new DelayedPaymentOutputDescriptor given each field
52376  *
52377  * Note that channel_transaction_parameters_arg (or a relevant inner pointer) may be NULL or all-0s to represent None
52378  */
52379 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 LDKRevocationKey revocation_pubkey_arg, struct LDKThirtyTwoBytes channel_keys_id_arg, uint64_t channel_value_satoshis_arg, struct LDKChannelTransactionParameters channel_transaction_parameters_arg);
52380
52381 /**
52382  * Creates a copy of the DelayedPaymentOutputDescriptor
52383  */
52384 struct LDKDelayedPaymentOutputDescriptor DelayedPaymentOutputDescriptor_clone(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR orig);
52385
52386 /**
52387  * Generates a non-cryptographic 64-bit hash of the DelayedPaymentOutputDescriptor.
52388  */
52389 uint64_t DelayedPaymentOutputDescriptor_hash(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR o);
52390
52391 /**
52392  * Checks if two DelayedPaymentOutputDescriptors contain equal inner contents.
52393  * This ignores pointers and is_owned flags and looks at the values in fields.
52394  * Two objects with NULL inner values will be considered "equal" here.
52395  */
52396 bool DelayedPaymentOutputDescriptor_eq(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR a, const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR b);
52397
52398 /**
52399  * Serialize the DelayedPaymentOutputDescriptor object into a byte array which can be read by DelayedPaymentOutputDescriptor_read
52400  */
52401 struct LDKCVec_u8Z DelayedPaymentOutputDescriptor_write(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR obj);
52402
52403 /**
52404  * Read a DelayedPaymentOutputDescriptor from a byte array, created by DelayedPaymentOutputDescriptor_write
52405  */
52406 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ DelayedPaymentOutputDescriptor_read(struct LDKu8slice ser);
52407
52408 /**
52409  * Frees any resources used by the StaticPaymentOutputDescriptor, if is_owned is set and inner is non-NULL.
52410  */
52411 void StaticPaymentOutputDescriptor_free(struct LDKStaticPaymentOutputDescriptor this_obj);
52412
52413 /**
52414  * The outpoint which is spendable.
52415  */
52416 struct LDKOutPoint StaticPaymentOutputDescriptor_get_outpoint(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr);
52417
52418 /**
52419  * The outpoint which is spendable.
52420  */
52421 void StaticPaymentOutputDescriptor_set_outpoint(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val);
52422
52423 /**
52424  * The output which is referenced by the given outpoint.
52425  */
52426 struct LDKTxOut StaticPaymentOutputDescriptor_get_output(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr);
52427
52428 /**
52429  * The output which is referenced by the given outpoint.
52430  */
52431 void StaticPaymentOutputDescriptor_set_output(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val);
52432
52433 /**
52434  * Arbitrary identification information returned by a call to [`ChannelSigner::channel_keys_id`].
52435  * This may be useful in re-deriving keys used in the channel to spend the output.
52436  */
52437 const uint8_t (*StaticPaymentOutputDescriptor_get_channel_keys_id(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32];
52438
52439 /**
52440  * Arbitrary identification information returned by a call to [`ChannelSigner::channel_keys_id`].
52441  * This may be useful in re-deriving keys used in the channel to spend the output.
52442  */
52443 void StaticPaymentOutputDescriptor_set_channel_keys_id(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
52444
52445 /**
52446  * The value of the channel which this transactions spends.
52447  */
52448 uint64_t StaticPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr);
52449
52450 /**
52451  * The value of the channel which this transactions spends.
52452  */
52453 void StaticPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val);
52454
52455 /**
52456  * The necessary channel parameters that need to be provided to the re-derived signer through
52457  * [`ChannelSigner::provide_channel_parameters`].
52458  *
52459  * Added as optional, but always `Some` if the descriptor was produced in v0.0.117 or later.
52460  *
52461  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
52462  */
52463 struct LDKChannelTransactionParameters StaticPaymentOutputDescriptor_get_channel_transaction_parameters(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr);
52464
52465 /**
52466  * The necessary channel parameters that need to be provided to the re-derived signer through
52467  * [`ChannelSigner::provide_channel_parameters`].
52468  *
52469  * Added as optional, but always `Some` if the descriptor was produced in v0.0.117 or later.
52470  *
52471  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
52472  */
52473 void StaticPaymentOutputDescriptor_set_channel_transaction_parameters(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKChannelTransactionParameters val);
52474
52475 /**
52476  * Constructs a new StaticPaymentOutputDescriptor given each field
52477  *
52478  * Note that channel_transaction_parameters_arg (or a relevant inner pointer) may be NULL or all-0s to represent None
52479  */
52480 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, struct LDKChannelTransactionParameters channel_transaction_parameters_arg);
52481
52482 /**
52483  * Creates a copy of the StaticPaymentOutputDescriptor
52484  */
52485 struct LDKStaticPaymentOutputDescriptor StaticPaymentOutputDescriptor_clone(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR orig);
52486
52487 /**
52488  * Generates a non-cryptographic 64-bit hash of the StaticPaymentOutputDescriptor.
52489  */
52490 uint64_t StaticPaymentOutputDescriptor_hash(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR o);
52491
52492 /**
52493  * Checks if two StaticPaymentOutputDescriptors contain equal inner contents.
52494  * This ignores pointers and is_owned flags and looks at the values in fields.
52495  * Two objects with NULL inner values will be considered "equal" here.
52496  */
52497 bool StaticPaymentOutputDescriptor_eq(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR a, const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR b);
52498
52499 /**
52500  * Returns the `witness_script` of the spendable output.
52501  *
52502  * Note that this will only return `Some` for [`StaticPaymentOutputDescriptor`]s that
52503  * originated from an anchor outputs channel, as they take the form of a P2WSH script.
52504  */
52505 MUST_USE_RES struct LDKCOption_CVec_u8ZZ StaticPaymentOutputDescriptor_witness_script(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_arg);
52506
52507 /**
52508  * The maximum length a well-formed witness spending one of these should have.
52509  * Note: If you have the grind_signatures feature enabled, this will be at least 1 byte
52510  * shorter.
52511  */
52512 MUST_USE_RES uint64_t StaticPaymentOutputDescriptor_max_witness_length(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_arg);
52513
52514 /**
52515  * Serialize the StaticPaymentOutputDescriptor object into a byte array which can be read by StaticPaymentOutputDescriptor_read
52516  */
52517 struct LDKCVec_u8Z StaticPaymentOutputDescriptor_write(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR obj);
52518
52519 /**
52520  * Read a StaticPaymentOutputDescriptor from a byte array, created by StaticPaymentOutputDescriptor_write
52521  */
52522 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ StaticPaymentOutputDescriptor_read(struct LDKu8slice ser);
52523
52524 /**
52525  * Frees any resources used by the SpendableOutputDescriptor
52526  */
52527 void SpendableOutputDescriptor_free(struct LDKSpendableOutputDescriptor this_ptr);
52528
52529 /**
52530  * Creates a copy of the SpendableOutputDescriptor
52531  */
52532 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_clone(const struct LDKSpendableOutputDescriptor *NONNULL_PTR orig);
52533
52534 /**
52535  * Utility method to constructs a new StaticOutput-variant SpendableOutputDescriptor
52536  */
52537 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_static_output(struct LDKOutPoint outpoint, struct LDKTxOut output, struct LDKThirtyTwoBytes channel_keys_id);
52538
52539 /**
52540  * Utility method to constructs a new DelayedPaymentOutput-variant SpendableOutputDescriptor
52541  */
52542 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_delayed_payment_output(struct LDKDelayedPaymentOutputDescriptor a);
52543
52544 /**
52545  * Utility method to constructs a new StaticPaymentOutput-variant SpendableOutputDescriptor
52546  */
52547 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_static_payment_output(struct LDKStaticPaymentOutputDescriptor a);
52548
52549 /**
52550  * Generates a non-cryptographic 64-bit hash of the SpendableOutputDescriptor.
52551  */
52552 uint64_t SpendableOutputDescriptor_hash(const struct LDKSpendableOutputDescriptor *NONNULL_PTR o);
52553
52554 /**
52555  * Checks if two SpendableOutputDescriptors contain equal inner contents.
52556  * This ignores pointers and is_owned flags and looks at the values in fields.
52557  */
52558 bool SpendableOutputDescriptor_eq(const struct LDKSpendableOutputDescriptor *NONNULL_PTR a, const struct LDKSpendableOutputDescriptor *NONNULL_PTR b);
52559
52560 /**
52561  * Serialize the SpendableOutputDescriptor object into a byte array which can be read by SpendableOutputDescriptor_read
52562  */
52563 struct LDKCVec_u8Z SpendableOutputDescriptor_write(const struct LDKSpendableOutputDescriptor *NONNULL_PTR obj);
52564
52565 /**
52566  * Read a SpendableOutputDescriptor from a byte array, created by SpendableOutputDescriptor_write
52567  */
52568 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ SpendableOutputDescriptor_read(struct LDKu8slice ser);
52569
52570 /**
52571  * Creates an unsigned [`PartiallySignedTransaction`] which spends the given descriptors to
52572  * the given outputs, plus an output to the given change destination (if sufficient
52573  * change value remains). The PSBT will have a feerate, at least, of the given value.
52574  *
52575  * The `locktime` argument is used to set the transaction's locktime. If `None`, the
52576  * transaction will have a locktime of 0. It it recommended to set this to the current block
52577  * height to avoid fee sniping, unless you have some specific reason to use a different
52578  * locktime.
52579  *
52580  * Returns the PSBT and expected max transaction weight.
52581  *
52582  * Returns `Err(())` if the output value is greater than the input value minus required fee,
52583  * if a descriptor was duplicated, or if an output descriptor `script_pubkey`
52584  * does not match the one we can spend.
52585  *
52586  * We do not enforce that outputs meet the dust limit or that any output scripts are standard.
52587  */
52588 MUST_USE_RES struct LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ 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_u32Z locktime);
52589
52590 /**
52591  * Frees any resources used by the ChannelDerivationParameters, if is_owned is set and inner is non-NULL.
52592  */
52593 void ChannelDerivationParameters_free(struct LDKChannelDerivationParameters this_obj);
52594
52595 /**
52596  * The value in satoshis of the channel we're attempting to spend the anchor output of.
52597  */
52598 uint64_t ChannelDerivationParameters_get_value_satoshis(const struct LDKChannelDerivationParameters *NONNULL_PTR this_ptr);
52599
52600 /**
52601  * The value in satoshis of the channel we're attempting to spend the anchor output of.
52602  */
52603 void ChannelDerivationParameters_set_value_satoshis(struct LDKChannelDerivationParameters *NONNULL_PTR this_ptr, uint64_t val);
52604
52605 /**
52606  * The unique identifier to re-derive the signer for the associated channel.
52607  */
52608 const uint8_t (*ChannelDerivationParameters_get_keys_id(const struct LDKChannelDerivationParameters *NONNULL_PTR this_ptr))[32];
52609
52610 /**
52611  * The unique identifier to re-derive the signer for the associated channel.
52612  */
52613 void ChannelDerivationParameters_set_keys_id(struct LDKChannelDerivationParameters *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
52614
52615 /**
52616  * The necessary channel parameters that need to be provided to the re-derived signer through
52617  * [`ChannelSigner::provide_channel_parameters`].
52618  */
52619 struct LDKChannelTransactionParameters ChannelDerivationParameters_get_transaction_parameters(const struct LDKChannelDerivationParameters *NONNULL_PTR this_ptr);
52620
52621 /**
52622  * The necessary channel parameters that need to be provided to the re-derived signer through
52623  * [`ChannelSigner::provide_channel_parameters`].
52624  */
52625 void ChannelDerivationParameters_set_transaction_parameters(struct LDKChannelDerivationParameters *NONNULL_PTR this_ptr, struct LDKChannelTransactionParameters val);
52626
52627 /**
52628  * Constructs a new ChannelDerivationParameters given each field
52629  */
52630 MUST_USE_RES struct LDKChannelDerivationParameters ChannelDerivationParameters_new(uint64_t value_satoshis_arg, struct LDKThirtyTwoBytes keys_id_arg, struct LDKChannelTransactionParameters transaction_parameters_arg);
52631
52632 /**
52633  * Creates a copy of the ChannelDerivationParameters
52634  */
52635 struct LDKChannelDerivationParameters ChannelDerivationParameters_clone(const struct LDKChannelDerivationParameters *NONNULL_PTR orig);
52636
52637 /**
52638  * Checks if two ChannelDerivationParameterss contain equal inner contents.
52639  * This ignores pointers and is_owned flags and looks at the values in fields.
52640  * Two objects with NULL inner values will be considered "equal" here.
52641  */
52642 bool ChannelDerivationParameters_eq(const struct LDKChannelDerivationParameters *NONNULL_PTR a, const struct LDKChannelDerivationParameters *NONNULL_PTR b);
52643
52644 /**
52645  * Serialize the ChannelDerivationParameters object into a byte array which can be read by ChannelDerivationParameters_read
52646  */
52647 struct LDKCVec_u8Z ChannelDerivationParameters_write(const struct LDKChannelDerivationParameters *NONNULL_PTR obj);
52648
52649 /**
52650  * Read a ChannelDerivationParameters from a byte array, created by ChannelDerivationParameters_write
52651  */
52652 struct LDKCResult_ChannelDerivationParametersDecodeErrorZ ChannelDerivationParameters_read(struct LDKu8slice ser);
52653
52654 /**
52655  * Frees any resources used by the HTLCDescriptor, if is_owned is set and inner is non-NULL.
52656  */
52657 void HTLCDescriptor_free(struct LDKHTLCDescriptor this_obj);
52658
52659 /**
52660  * The parameters required to derive the signer for the HTLC input.
52661  */
52662 struct LDKChannelDerivationParameters HTLCDescriptor_get_channel_derivation_parameters(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr);
52663
52664 /**
52665  * The parameters required to derive the signer for the HTLC input.
52666  */
52667 void HTLCDescriptor_set_channel_derivation_parameters(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, struct LDKChannelDerivationParameters val);
52668
52669 /**
52670  * The txid of the commitment transaction in which the HTLC output lives.
52671  */
52672 const uint8_t (*HTLCDescriptor_get_commitment_txid(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr))[32];
52673
52674 /**
52675  * The txid of the commitment transaction in which the HTLC output lives.
52676  */
52677 void HTLCDescriptor_set_commitment_txid(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
52678
52679 /**
52680  * The number of the commitment transaction in which the HTLC output lives.
52681  */
52682 uint64_t HTLCDescriptor_get_per_commitment_number(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr);
52683
52684 /**
52685  * The number of the commitment transaction in which the HTLC output lives.
52686  */
52687 void HTLCDescriptor_set_per_commitment_number(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, uint64_t val);
52688
52689 /**
52690  * The key tweak corresponding to the number of the commitment transaction in which the HTLC
52691  * output lives. This tweak is applied to all the basepoints for both parties in the channel to
52692  * arrive at unique keys per commitment.
52693  *
52694  * See <https://github.com/lightning/bolts/blob/master/03-transactions.md#keys> for more info.
52695  */
52696 struct LDKPublicKey HTLCDescriptor_get_per_commitment_point(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr);
52697
52698 /**
52699  * The key tweak corresponding to the number of the commitment transaction in which the HTLC
52700  * output lives. This tweak is applied to all the basepoints for both parties in the channel to
52701  * arrive at unique keys per commitment.
52702  *
52703  * See <https://github.com/lightning/bolts/blob/master/03-transactions.md#keys> for more info.
52704  */
52705 void HTLCDescriptor_set_per_commitment_point(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val);
52706
52707 /**
52708  * The feerate to use on the HTLC claiming transaction. This is always `0` for HTLCs
52709  * originating from a channel supporting anchor outputs, otherwise it is the channel's
52710  * negotiated feerate at the time the commitment transaction was built.
52711  */
52712 uint32_t HTLCDescriptor_get_feerate_per_kw(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr);
52713
52714 /**
52715  * The feerate to use on the HTLC claiming transaction. This is always `0` for HTLCs
52716  * originating from a channel supporting anchor outputs, otherwise it is the channel's
52717  * negotiated feerate at the time the commitment transaction was built.
52718  */
52719 void HTLCDescriptor_set_feerate_per_kw(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, uint32_t val);
52720
52721 /**
52722  * The details of the HTLC as it appears in the commitment transaction.
52723  */
52724 struct LDKHTLCOutputInCommitment HTLCDescriptor_get_htlc(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr);
52725
52726 /**
52727  * The details of the HTLC as it appears in the commitment transaction.
52728  */
52729 void HTLCDescriptor_set_htlc(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, struct LDKHTLCOutputInCommitment val);
52730
52731 /**
52732  * The preimage, if `Some`, to claim the HTLC output with. If `None`, the timeout path must be
52733  * taken.
52734  */
52735 struct LDKCOption_ThirtyTwoBytesZ HTLCDescriptor_get_preimage(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr);
52736
52737 /**
52738  * The preimage, if `Some`, to claim the HTLC output with. If `None`, the timeout path must be
52739  * taken.
52740  */
52741 void HTLCDescriptor_set_preimage(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, struct LDKCOption_ThirtyTwoBytesZ val);
52742
52743 /**
52744  * The counterparty's signature required to spend the HTLC output.
52745  */
52746 struct LDKECDSASignature HTLCDescriptor_get_counterparty_sig(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr);
52747
52748 /**
52749  * The counterparty's signature required to spend the HTLC output.
52750  */
52751 void HTLCDescriptor_set_counterparty_sig(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, struct LDKECDSASignature val);
52752
52753 /**
52754  * Constructs a new HTLCDescriptor given each field
52755  */
52756 MUST_USE_RES struct LDKHTLCDescriptor HTLCDescriptor_new(struct LDKChannelDerivationParameters channel_derivation_parameters_arg, struct LDKThirtyTwoBytes commitment_txid_arg, uint64_t per_commitment_number_arg, struct LDKPublicKey per_commitment_point_arg, uint32_t feerate_per_kw_arg, struct LDKHTLCOutputInCommitment htlc_arg, struct LDKCOption_ThirtyTwoBytesZ preimage_arg, struct LDKECDSASignature counterparty_sig_arg);
52757
52758 /**
52759  * Creates a copy of the HTLCDescriptor
52760  */
52761 struct LDKHTLCDescriptor HTLCDescriptor_clone(const struct LDKHTLCDescriptor *NONNULL_PTR orig);
52762
52763 /**
52764  * Checks if two HTLCDescriptors contain equal inner contents.
52765  * This ignores pointers and is_owned flags and looks at the values in fields.
52766  * Two objects with NULL inner values will be considered "equal" here.
52767  */
52768 bool HTLCDescriptor_eq(const struct LDKHTLCDescriptor *NONNULL_PTR a, const struct LDKHTLCDescriptor *NONNULL_PTR b);
52769
52770 /**
52771  * Serialize the HTLCDescriptor object into a byte array which can be read by HTLCDescriptor_read
52772  */
52773 struct LDKCVec_u8Z HTLCDescriptor_write(const struct LDKHTLCDescriptor *NONNULL_PTR obj);
52774
52775 /**
52776  * Read a HTLCDescriptor from a byte array, created by HTLCDescriptor_write
52777  */
52778 struct LDKCResult_HTLCDescriptorDecodeErrorZ HTLCDescriptor_read(struct LDKu8slice ser);
52779
52780 /**
52781  * Returns the outpoint of the HTLC output in the commitment transaction. This is the outpoint
52782  * being spent by the HTLC input in the HTLC transaction.
52783  */
52784 MUST_USE_RES struct LDKOutPoint HTLCDescriptor_outpoint(const struct LDKHTLCDescriptor *NONNULL_PTR this_arg);
52785
52786 /**
52787  * Returns the UTXO to be spent by the HTLC input, which can be obtained via
52788  * [`Self::unsigned_tx_input`].
52789  */
52790 MUST_USE_RES struct LDKTxOut HTLCDescriptor_previous_utxo(const struct LDKHTLCDescriptor *NONNULL_PTR this_arg);
52791
52792 /**
52793  * Returns the unsigned transaction input spending the HTLC output in the commitment
52794  * transaction.
52795  */
52796 MUST_USE_RES struct LDKTxIn HTLCDescriptor_unsigned_tx_input(const struct LDKHTLCDescriptor *NONNULL_PTR this_arg);
52797
52798 /**
52799  * Returns the delayed output created as a result of spending the HTLC output in the commitment
52800  * transaction.
52801  */
52802 MUST_USE_RES struct LDKTxOut HTLCDescriptor_tx_output(const struct LDKHTLCDescriptor *NONNULL_PTR this_arg);
52803
52804 /**
52805  * Returns the witness script of the HTLC output in the commitment transaction.
52806  */
52807 MUST_USE_RES struct LDKCVec_u8Z HTLCDescriptor_witness_script(const struct LDKHTLCDescriptor *NONNULL_PTR this_arg);
52808
52809 /**
52810  * Returns the fully signed witness required to spend the HTLC output in the commitment
52811  * transaction.
52812  */
52813 MUST_USE_RES struct LDKWitness HTLCDescriptor_tx_input_witness(const struct LDKHTLCDescriptor *NONNULL_PTR this_arg, struct LDKECDSASignature signature, struct LDKu8slice witness_script);
52814
52815 /**
52816  * Derives the channel signer required to sign the HTLC input.
52817  */
52818 MUST_USE_RES struct LDKWriteableEcdsaChannelSigner HTLCDescriptor_derive_channel_signer(const struct LDKHTLCDescriptor *NONNULL_PTR this_arg, const struct LDKSignerProvider *NONNULL_PTR signer_provider);
52819
52820 /**
52821  * Calls the free function if one is set
52822  */
52823 void ChannelSigner_free(struct LDKChannelSigner this_ptr);
52824
52825 /**
52826  * Creates a copy of the Recipient
52827  */
52828 enum LDKRecipient Recipient_clone(const enum LDKRecipient *NONNULL_PTR orig);
52829
52830 /**
52831  * Utility method to constructs a new Node-variant Recipient
52832  */
52833 enum LDKRecipient Recipient_node(void);
52834
52835 /**
52836  * Utility method to constructs a new PhantomNode-variant Recipient
52837  */
52838 enum LDKRecipient Recipient_phantom_node(void);
52839
52840 /**
52841  * Calls the free function if one is set
52842  */
52843 void EntropySource_free(struct LDKEntropySource this_ptr);
52844
52845 /**
52846  * Calls the free function if one is set
52847  */
52848 void NodeSigner_free(struct LDKNodeSigner this_ptr);
52849
52850 /**
52851  * Calls the free function if one is set
52852  */
52853 void OutputSpender_free(struct LDKOutputSpender this_ptr);
52854
52855 /**
52856  * Calls the free function if one is set
52857  */
52858 void SignerProvider_free(struct LDKSignerProvider this_ptr);
52859
52860 /**
52861  * Calls the free function if one is set
52862  */
52863 void ChangeDestinationSource_free(struct LDKChangeDestinationSource this_ptr);
52864
52865 /**
52866  * Frees any resources used by the InMemorySigner, if is_owned is set and inner is non-NULL.
52867  */
52868 void InMemorySigner_free(struct LDKInMemorySigner this_obj);
52869
52870 /**
52871  * Holder secret key in the 2-of-2 multisig script of a channel. This key also backs the
52872  * holder's anchor output in a commitment transaction, if one is present.
52873  */
52874 const uint8_t (*InMemorySigner_get_funding_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
52875
52876 /**
52877  * Holder secret key in the 2-of-2 multisig script of a channel. This key also backs the
52878  * holder's anchor output in a commitment transaction, if one is present.
52879  */
52880 void InMemorySigner_set_funding_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
52881
52882 /**
52883  * Holder secret key for blinded revocation pubkey.
52884  */
52885 const uint8_t (*InMemorySigner_get_revocation_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
52886
52887 /**
52888  * Holder secret key for blinded revocation pubkey.
52889  */
52890 void InMemorySigner_set_revocation_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
52891
52892 /**
52893  * Holder secret key used for our balance in counterparty-broadcasted commitment transactions.
52894  */
52895 const uint8_t (*InMemorySigner_get_payment_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
52896
52897 /**
52898  * Holder secret key used for our balance in counterparty-broadcasted commitment transactions.
52899  */
52900 void InMemorySigner_set_payment_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
52901
52902 /**
52903  * Holder secret key used in an HTLC transaction.
52904  */
52905 const uint8_t (*InMemorySigner_get_delayed_payment_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
52906
52907 /**
52908  * Holder secret key used in an HTLC transaction.
52909  */
52910 void InMemorySigner_set_delayed_payment_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
52911
52912 /**
52913  * Holder HTLC secret key used in commitment transaction HTLC outputs.
52914  */
52915 const uint8_t (*InMemorySigner_get_htlc_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
52916
52917 /**
52918  * Holder HTLC secret key used in commitment transaction HTLC outputs.
52919  */
52920 void InMemorySigner_set_htlc_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
52921
52922 /**
52923  * Commitment seed.
52924  */
52925 const uint8_t (*InMemorySigner_get_commitment_seed(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
52926
52927 /**
52928  * Commitment seed.
52929  */
52930 void InMemorySigner_set_commitment_seed(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
52931
52932 /**
52933  * Creates a copy of the InMemorySigner
52934  */
52935 struct LDKInMemorySigner InMemorySigner_clone(const struct LDKInMemorySigner *NONNULL_PTR orig);
52936
52937 /**
52938  * Creates a new [`InMemorySigner`].
52939  */
52940 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);
52941
52942 /**
52943  * Returns the counterparty's pubkeys.
52944  *
52945  * Will return `None` if [`ChannelSigner::provide_channel_parameters`] has not been called.
52946  * In general, this is safe to `unwrap` only in [`ChannelSigner`] implementation.
52947  *
52948  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
52949  */
52950 MUST_USE_RES struct LDKChannelPublicKeys InMemorySigner_counterparty_pubkeys(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
52951
52952 /**
52953  * Returns the `contest_delay` value specified by our counterparty and applied on holder-broadcastable
52954  * transactions, i.e., the amount of time that we have to wait to recover our funds if we
52955  * broadcast a transaction.
52956  *
52957  * Will return `None` if [`ChannelSigner::provide_channel_parameters`] has not been called.
52958  * In general, this is safe to `unwrap` only in [`ChannelSigner`] implementation.
52959  */
52960 MUST_USE_RES struct LDKCOption_u16Z InMemorySigner_counterparty_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
52961
52962 /**
52963  * Returns the `contest_delay` value specified by us and applied on transactions broadcastable
52964  * by our counterparty, i.e., the amount of time that they have to wait to recover their funds
52965  * if they broadcast a transaction.
52966  *
52967  * Will return `None` if [`ChannelSigner::provide_channel_parameters`] has not been called.
52968  * In general, this is safe to `unwrap` only in [`ChannelSigner`] implementation.
52969  */
52970 MUST_USE_RES struct LDKCOption_u16Z InMemorySigner_holder_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
52971
52972 /**
52973  * Returns whether the holder is the initiator.
52974  *
52975  * Will return `None` if [`ChannelSigner::provide_channel_parameters`] has not been called.
52976  * In general, this is safe to `unwrap` only in [`ChannelSigner`] implementation.
52977  */
52978 MUST_USE_RES struct LDKCOption_boolZ InMemorySigner_is_outbound(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
52979
52980 /**
52981  * Funding outpoint
52982  *
52983  * Will return `None` if [`ChannelSigner::provide_channel_parameters`] has not been called.
52984  * In general, this is safe to `unwrap` only in [`ChannelSigner`] implementation.
52985  *
52986  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
52987  */
52988 MUST_USE_RES struct LDKOutPoint InMemorySigner_funding_outpoint(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
52989
52990 /**
52991  * Returns a [`ChannelTransactionParameters`] for this channel, to be used when verifying or
52992  * building transactions.
52993  *
52994  * Will return `None` if [`ChannelSigner::provide_channel_parameters`] has not been called.
52995  * In general, this is safe to `unwrap` only in [`ChannelSigner`] implementation.
52996  *
52997  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
52998  */
52999 MUST_USE_RES struct LDKChannelTransactionParameters InMemorySigner_get_channel_parameters(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
53000
53001 /**
53002  * Returns the channel type features of the channel parameters. Should be helpful for
53003  * determining a channel's category, i. e. legacy/anchors/taproot/etc.
53004  *
53005  * Will return `None` if [`ChannelSigner::provide_channel_parameters`] has not been called.
53006  * In general, this is safe to `unwrap` only in [`ChannelSigner`] implementation.
53007  *
53008  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
53009  */
53010 MUST_USE_RES struct LDKChannelTypeFeatures InMemorySigner_channel_type_features(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
53011
53012 /**
53013  * Sign the single input of `spend_tx` at index `input_idx`, which spends the output described
53014  * by `descriptor`, returning the witness stack for the input.
53015  *
53016  * Returns an error if the input at `input_idx` does not exist, has a non-empty `script_sig`,
53017  * is not spending the outpoint described by [`descriptor.outpoint`],
53018  * or if an output descriptor `script_pubkey` does not match the one we can spend.
53019  *
53020  * [`descriptor.outpoint`]: StaticPaymentOutputDescriptor::outpoint
53021  */
53022 MUST_USE_RES struct LDKCResult_WitnessNoneZ 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);
53023
53024 /**
53025  * Sign the single input of `spend_tx` at index `input_idx` which spends the output
53026  * described by `descriptor`, returning the witness stack for the input.
53027  *
53028  * Returns an error if the input at `input_idx` does not exist, has a non-empty `script_sig`,
53029  * is not spending the outpoint described by [`descriptor.outpoint`], does not have a
53030  * sequence set to [`descriptor.to_self_delay`], or if an output descriptor
53031  * `script_pubkey` does not match the one we can spend.
53032  *
53033  * [`descriptor.outpoint`]: DelayedPaymentOutputDescriptor::outpoint
53034  * [`descriptor.to_self_delay`]: DelayedPaymentOutputDescriptor::to_self_delay
53035  */
53036 MUST_USE_RES struct LDKCResult_WitnessNoneZ 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);
53037
53038 /**
53039  * Constructs a new EntropySource which calls the relevant methods on this_arg.
53040  * This copies the `inner` pointer in this_arg and thus the returned EntropySource must be freed before this_arg is
53041  */
53042 struct LDKEntropySource InMemorySigner_as_EntropySource(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
53043
53044 /**
53045  * Constructs a new ChannelSigner which calls the relevant methods on this_arg.
53046  * This copies the `inner` pointer in this_arg and thus the returned ChannelSigner must be freed before this_arg is
53047  */
53048 struct LDKChannelSigner InMemorySigner_as_ChannelSigner(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
53049
53050 /**
53051  * Constructs a new EcdsaChannelSigner which calls the relevant methods on this_arg.
53052  * This copies the `inner` pointer in this_arg and thus the returned EcdsaChannelSigner must be freed before this_arg is
53053  */
53054 struct LDKEcdsaChannelSigner InMemorySigner_as_EcdsaChannelSigner(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
53055
53056 /**
53057  * Constructs a new WriteableEcdsaChannelSigner which calls the relevant methods on this_arg.
53058  * This copies the `inner` pointer in this_arg and thus the returned WriteableEcdsaChannelSigner must be freed before this_arg is
53059  */
53060 struct LDKWriteableEcdsaChannelSigner InMemorySigner_as_WriteableEcdsaChannelSigner(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
53061
53062 /**
53063  * Serialize the InMemorySigner object into a byte array which can be read by InMemorySigner_read
53064  */
53065 struct LDKCVec_u8Z InMemorySigner_write(const struct LDKInMemorySigner *NONNULL_PTR obj);
53066
53067 /**
53068  * Read a InMemorySigner from a byte array, created by InMemorySigner_write
53069  */
53070 struct LDKCResult_InMemorySignerDecodeErrorZ InMemorySigner_read(struct LDKu8slice ser, struct LDKEntropySource arg);
53071
53072 /**
53073  * Frees any resources used by the KeysManager, if is_owned is set and inner is non-NULL.
53074  */
53075 void KeysManager_free(struct LDKKeysManager this_obj);
53076
53077 /**
53078  * Constructs a [`KeysManager`] from a 32-byte seed. If the seed is in some way biased (e.g.,
53079  * your CSRNG is busted) this may panic (but more importantly, you will possibly lose funds).
53080  * `starting_time` isn't strictly required to actually be a time, but it must absolutely,
53081  * without a doubt, be unique to this instance. ie if you start multiple times with the same
53082  * `seed`, `starting_time` must be unique to each run. Thus, the easiest way to achieve this
53083  * is to simply use the current time (with very high precision).
53084  *
53085  * The `seed` MUST be backed up safely prior to use so that the keys can be re-created, however,
53086  * obviously, `starting_time` should be unique every time you reload the library - it is only
53087  * used to generate new ephemeral key data (which will be stored by the individual channel if
53088  * necessary).
53089  *
53090  * Note that the seed is required to recover certain on-chain funds independent of
53091  * [`ChannelMonitor`] data, though a current copy of [`ChannelMonitor`] data is also required
53092  * for any channel, and some on-chain during-closing funds.
53093  *
53094  * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor
53095  */
53096 MUST_USE_RES struct LDKKeysManager KeysManager_new(const uint8_t (*seed)[32], uint64_t starting_time_secs, uint32_t starting_time_nanos);
53097
53098 /**
53099  * Gets the \"node_id\" secret key used to sign gossip announcements, decode onion data, etc.
53100  */
53101 MUST_USE_RES struct LDKSecretKey KeysManager_get_node_secret_key(const struct LDKKeysManager *NONNULL_PTR this_arg);
53102
53103 /**
53104  * Derive an old [`WriteableEcdsaChannelSigner`] containing per-channel secrets based on a key derivation parameters.
53105  */
53106 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]);
53107
53108 /**
53109  * Signs the given [`PartiallySignedTransaction`] which spends the given [`SpendableOutputDescriptor`]s.
53110  * The resulting inputs will be finalized and the PSBT will be ready for broadcast if there
53111  * are no other inputs that need signing.
53112  *
53113  * Returns `Err(())` if the PSBT is missing a descriptor or if we fail to sign.
53114  *
53115  * May panic if the [`SpendableOutputDescriptor`]s were not generated by channels which used
53116  * this [`KeysManager`] or one of the [`InMemorySigner`] created by this [`KeysManager`].
53117  */
53118 MUST_USE_RES struct LDKCResult_CVec_u8ZNoneZ KeysManager_sign_spendable_outputs_psbt(const struct LDKKeysManager *NONNULL_PTR this_arg, struct LDKCVec_SpendableOutputDescriptorZ descriptors, struct LDKCVec_u8Z psbt);
53119
53120 /**
53121  * Constructs a new EntropySource which calls the relevant methods on this_arg.
53122  * This copies the `inner` pointer in this_arg and thus the returned EntropySource must be freed before this_arg is
53123  */
53124 struct LDKEntropySource KeysManager_as_EntropySource(const struct LDKKeysManager *NONNULL_PTR this_arg);
53125
53126 /**
53127  * Constructs a new NodeSigner which calls the relevant methods on this_arg.
53128  * This copies the `inner` pointer in this_arg and thus the returned NodeSigner must be freed before this_arg is
53129  */
53130 struct LDKNodeSigner KeysManager_as_NodeSigner(const struct LDKKeysManager *NONNULL_PTR this_arg);
53131
53132 /**
53133  * Constructs a new OutputSpender which calls the relevant methods on this_arg.
53134  * This copies the `inner` pointer in this_arg and thus the returned OutputSpender must be freed before this_arg is
53135  */
53136 struct LDKOutputSpender KeysManager_as_OutputSpender(const struct LDKKeysManager *NONNULL_PTR this_arg);
53137
53138 /**
53139  * Constructs a new SignerProvider which calls the relevant methods on this_arg.
53140  * This copies the `inner` pointer in this_arg and thus the returned SignerProvider must be freed before this_arg is
53141  */
53142 struct LDKSignerProvider KeysManager_as_SignerProvider(const struct LDKKeysManager *NONNULL_PTR this_arg);
53143
53144 /**
53145  * Frees any resources used by the PhantomKeysManager, if is_owned is set and inner is non-NULL.
53146  */
53147 void PhantomKeysManager_free(struct LDKPhantomKeysManager this_obj);
53148
53149 /**
53150  * Constructs a new EntropySource which calls the relevant methods on this_arg.
53151  * This copies the `inner` pointer in this_arg and thus the returned EntropySource must be freed before this_arg is
53152  */
53153 struct LDKEntropySource PhantomKeysManager_as_EntropySource(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg);
53154
53155 /**
53156  * Constructs a new NodeSigner which calls the relevant methods on this_arg.
53157  * This copies the `inner` pointer in this_arg and thus the returned NodeSigner must be freed before this_arg is
53158  */
53159 struct LDKNodeSigner PhantomKeysManager_as_NodeSigner(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg);
53160
53161 /**
53162  * Constructs a new OutputSpender which calls the relevant methods on this_arg.
53163  * This copies the `inner` pointer in this_arg and thus the returned OutputSpender must be freed before this_arg is
53164  */
53165 struct LDKOutputSpender PhantomKeysManager_as_OutputSpender(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg);
53166
53167 /**
53168  * Constructs a new SignerProvider which calls the relevant methods on this_arg.
53169  * This copies the `inner` pointer in this_arg and thus the returned SignerProvider must be freed before this_arg is
53170  */
53171 struct LDKSignerProvider PhantomKeysManager_as_SignerProvider(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg);
53172
53173 /**
53174  * Constructs a [`PhantomKeysManager`] given a 32-byte seed and an additional `cross_node_seed`
53175  * that is shared across all nodes that intend to participate in [phantom node payments]
53176  * together.
53177  *
53178  * See [`KeysManager::new`] for more information on `seed`, `starting_time_secs`, and
53179  * `starting_time_nanos`.
53180  *
53181  * `cross_node_seed` must be the same across all phantom payment-receiving nodes and also the
53182  * same across restarts, or else inbound payments may fail.
53183  *
53184  * [phantom node payments]: PhantomKeysManager
53185  */
53186 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]);
53187
53188 /**
53189  * See [`KeysManager::derive_channel_keys`] for documentation on this method.
53190  */
53191 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]);
53192
53193 /**
53194  * Gets the \"node_id\" secret key used to sign gossip announcements, decode onion data, etc.
53195  */
53196 MUST_USE_RES struct LDKSecretKey PhantomKeysManager_get_node_secret_key(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg);
53197
53198 /**
53199  * Gets the \"node_id\" secret key of the phantom node used to sign invoices, decode the
53200  * last-hop onion data, etc.
53201  */
53202 MUST_USE_RES struct LDKSecretKey PhantomKeysManager_get_phantom_node_secret_key(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg);
53203
53204 /**
53205  * Frees any resources used by the RandomBytes, if is_owned is set and inner is non-NULL.
53206  */
53207 void RandomBytes_free(struct LDKRandomBytes this_obj);
53208
53209 /**
53210  * Creates a new instance using the given seed.
53211  */
53212 MUST_USE_RES struct LDKRandomBytes RandomBytes_new(struct LDKThirtyTwoBytes seed);
53213
53214 /**
53215  * Constructs a new EntropySource which calls the relevant methods on this_arg.
53216  * This copies the `inner` pointer in this_arg and thus the returned EntropySource must be freed before this_arg is
53217  */
53218 struct LDKEntropySource RandomBytes_as_EntropySource(const struct LDKRandomBytes *NONNULL_PTR this_arg);
53219
53220 /**
53221  * Calls the free function if one is set
53222  */
53223 void EcdsaChannelSigner_free(struct LDKEcdsaChannelSigner this_ptr);
53224
53225 /**
53226  * Creates a copy of a WriteableEcdsaChannelSigner
53227  */
53228 struct LDKWriteableEcdsaChannelSigner WriteableEcdsaChannelSigner_clone(const struct LDKWriteableEcdsaChannelSigner *NONNULL_PTR orig);
53229
53230 /**
53231  * Calls the free function if one is set
53232  */
53233 void WriteableEcdsaChannelSigner_free(struct LDKWriteableEcdsaChannelSigner this_ptr);
53234
53235 /**
53236  * Frees any resources used by the OnionMessenger, if is_owned is set and inner is non-NULL.
53237  */
53238 void OnionMessenger_free(struct LDKOnionMessenger this_obj);
53239
53240 /**
53241  * Calls the free function if one is set
53242  */
53243 void MessageRouter_free(struct LDKMessageRouter this_ptr);
53244
53245 /**
53246  * Frees any resources used by the DefaultMessageRouter, if is_owned is set and inner is non-NULL.
53247  */
53248 void DefaultMessageRouter_free(struct LDKDefaultMessageRouter this_obj);
53249
53250 /**
53251  * Creates a [`DefaultMessageRouter`] using the given [`NetworkGraph`].
53252  */
53253 MUST_USE_RES struct LDKDefaultMessageRouter DefaultMessageRouter_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKEntropySource entropy_source);
53254
53255 /**
53256  * Constructs a new MessageRouter which calls the relevant methods on this_arg.
53257  * This copies the `inner` pointer in this_arg and thus the returned MessageRouter must be freed before this_arg is
53258  */
53259 struct LDKMessageRouter DefaultMessageRouter_as_MessageRouter(const struct LDKDefaultMessageRouter *NONNULL_PTR this_arg);
53260
53261 /**
53262  * Frees any resources used by the OnionMessagePath, if is_owned is set and inner is non-NULL.
53263  */
53264 void OnionMessagePath_free(struct LDKOnionMessagePath this_obj);
53265
53266 /**
53267  * Nodes on the path between the sender and the destination.
53268  *
53269  * Returns a copy of the field.
53270  */
53271 struct LDKCVec_PublicKeyZ OnionMessagePath_get_intermediate_nodes(const struct LDKOnionMessagePath *NONNULL_PTR this_ptr);
53272
53273 /**
53274  * Nodes on the path between the sender and the destination.
53275  */
53276 void OnionMessagePath_set_intermediate_nodes(struct LDKOnionMessagePath *NONNULL_PTR this_ptr, struct LDKCVec_PublicKeyZ val);
53277
53278 /**
53279  * The recipient of the message.
53280  */
53281 struct LDKDestination OnionMessagePath_get_destination(const struct LDKOnionMessagePath *NONNULL_PTR this_ptr);
53282
53283 /**
53284  * The recipient of the message.
53285  */
53286 void OnionMessagePath_set_destination(struct LDKOnionMessagePath *NONNULL_PTR this_ptr, struct LDKDestination val);
53287
53288 /**
53289  * Addresses that may be used to connect to [`OnionMessagePath::first_node`].
53290  *
53291  * Only needs to be set if a connection to the node is required. [`OnionMessenger`] may use
53292  * this to initiate such a connection.
53293  *
53294  * Returns a copy of the field.
53295  */
53296 struct LDKCOption_CVec_SocketAddressZZ OnionMessagePath_get_first_node_addresses(const struct LDKOnionMessagePath *NONNULL_PTR this_ptr);
53297
53298 /**
53299  * Addresses that may be used to connect to [`OnionMessagePath::first_node`].
53300  *
53301  * Only needs to be set if a connection to the node is required. [`OnionMessenger`] may use
53302  * this to initiate such a connection.
53303  */
53304 void OnionMessagePath_set_first_node_addresses(struct LDKOnionMessagePath *NONNULL_PTR this_ptr, struct LDKCOption_CVec_SocketAddressZZ val);
53305
53306 /**
53307  * Constructs a new OnionMessagePath given each field
53308  */
53309 MUST_USE_RES struct LDKOnionMessagePath OnionMessagePath_new(struct LDKCVec_PublicKeyZ intermediate_nodes_arg, struct LDKDestination destination_arg, struct LDKCOption_CVec_SocketAddressZZ first_node_addresses_arg);
53310
53311 /**
53312  * Creates a copy of the OnionMessagePath
53313  */
53314 struct LDKOnionMessagePath OnionMessagePath_clone(const struct LDKOnionMessagePath *NONNULL_PTR orig);
53315
53316 /**
53317  * Returns the first node in the path.
53318  *
53319  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
53320  */
53321 MUST_USE_RES struct LDKPublicKey OnionMessagePath_first_node(const struct LDKOnionMessagePath *NONNULL_PTR this_arg);
53322
53323 /**
53324  * Frees any resources used by the Destination
53325  */
53326 void Destination_free(struct LDKDestination this_ptr);
53327
53328 /**
53329  * Creates a copy of the Destination
53330  */
53331 struct LDKDestination Destination_clone(const struct LDKDestination *NONNULL_PTR orig);
53332
53333 /**
53334  * Utility method to constructs a new Node-variant Destination
53335  */
53336 struct LDKDestination Destination_node(struct LDKPublicKey a);
53337
53338 /**
53339  * Utility method to constructs a new BlindedPath-variant Destination
53340  */
53341 struct LDKDestination Destination_blinded_path(struct LDKBlindedPath a);
53342
53343 /**
53344  * Generates a non-cryptographic 64-bit hash of the Destination.
53345  */
53346 uint64_t Destination_hash(const struct LDKDestination *NONNULL_PTR o);
53347
53348 /**
53349  * Checks if two Destinations contain equal inner contents.
53350  * This ignores pointers and is_owned flags and looks at the values in fields.
53351  */
53352 bool Destination_eq(const struct LDKDestination *NONNULL_PTR a, const struct LDKDestination *NONNULL_PTR b);
53353
53354 /**
53355  * Attempts to resolve the [`IntroductionNode::DirectedShortChannelId`] of a
53356  * [`Destination::BlindedPath`] to a [`IntroductionNode::NodeId`], if applicable, using the
53357  * provided [`ReadOnlyNetworkGraph`].
53358  */
53359 void Destination_resolve(struct LDKDestination *NONNULL_PTR this_arg, const struct LDKReadOnlyNetworkGraph *NONNULL_PTR network_graph);
53360
53361 /**
53362  * Frees any resources used by the SendSuccess
53363  */
53364 void SendSuccess_free(struct LDKSendSuccess this_ptr);
53365
53366 /**
53367  * Creates a copy of the SendSuccess
53368  */
53369 struct LDKSendSuccess SendSuccess_clone(const struct LDKSendSuccess *NONNULL_PTR orig);
53370
53371 /**
53372  * Utility method to constructs a new Buffered-variant SendSuccess
53373  */
53374 struct LDKSendSuccess SendSuccess_buffered(void);
53375
53376 /**
53377  * Utility method to constructs a new BufferedAwaitingConnection-variant SendSuccess
53378  */
53379 struct LDKSendSuccess SendSuccess_buffered_awaiting_connection(struct LDKPublicKey a);
53380
53381 /**
53382  * Generates a non-cryptographic 64-bit hash of the SendSuccess.
53383  */
53384 uint64_t SendSuccess_hash(const struct LDKSendSuccess *NONNULL_PTR o);
53385
53386 /**
53387  * Checks if two SendSuccesss contain equal inner contents.
53388  * This ignores pointers and is_owned flags and looks at the values in fields.
53389  */
53390 bool SendSuccess_eq(const struct LDKSendSuccess *NONNULL_PTR a, const struct LDKSendSuccess *NONNULL_PTR b);
53391
53392 /**
53393  * Frees any resources used by the SendError
53394  */
53395 void SendError_free(struct LDKSendError this_ptr);
53396
53397 /**
53398  * Creates a copy of the SendError
53399  */
53400 struct LDKSendError SendError_clone(const struct LDKSendError *NONNULL_PTR orig);
53401
53402 /**
53403  * Utility method to constructs a new Secp256k1-variant SendError
53404  */
53405 struct LDKSendError SendError_secp256k1(enum LDKSecp256k1Error a);
53406
53407 /**
53408  * Utility method to constructs a new TooBigPacket-variant SendError
53409  */
53410 struct LDKSendError SendError_too_big_packet(void);
53411
53412 /**
53413  * Utility method to constructs a new TooFewBlindedHops-variant SendError
53414  */
53415 struct LDKSendError SendError_too_few_blinded_hops(void);
53416
53417 /**
53418  * Utility method to constructs a new InvalidFirstHop-variant SendError
53419  */
53420 struct LDKSendError SendError_invalid_first_hop(struct LDKPublicKey a);
53421
53422 /**
53423  * Utility method to constructs a new PathNotFound-variant SendError
53424  */
53425 struct LDKSendError SendError_path_not_found(void);
53426
53427 /**
53428  * Utility method to constructs a new InvalidMessage-variant SendError
53429  */
53430 struct LDKSendError SendError_invalid_message(void);
53431
53432 /**
53433  * Utility method to constructs a new BufferFull-variant SendError
53434  */
53435 struct LDKSendError SendError_buffer_full(void);
53436
53437 /**
53438  * Utility method to constructs a new GetNodeIdFailed-variant SendError
53439  */
53440 struct LDKSendError SendError_get_node_id_failed(void);
53441
53442 /**
53443  * Utility method to constructs a new UnresolvedIntroductionNode-variant SendError
53444  */
53445 struct LDKSendError SendError_unresolved_introduction_node(void);
53446
53447 /**
53448  * Utility method to constructs a new BlindedPathAdvanceFailed-variant SendError
53449  */
53450 struct LDKSendError SendError_blinded_path_advance_failed(void);
53451
53452 /**
53453  * Generates a non-cryptographic 64-bit hash of the SendError.
53454  */
53455 uint64_t SendError_hash(const struct LDKSendError *NONNULL_PTR o);
53456
53457 /**
53458  * Checks if two SendErrors contain equal inner contents.
53459  * This ignores pointers and is_owned flags and looks at the values in fields.
53460  */
53461 bool SendError_eq(const struct LDKSendError *NONNULL_PTR a, const struct LDKSendError *NONNULL_PTR b);
53462
53463 /**
53464  * Calls the free function if one is set
53465  */
53466 void CustomOnionMessageHandler_free(struct LDKCustomOnionMessageHandler this_ptr);
53467
53468 /**
53469  * Frees any resources used by the PeeledOnion
53470  */
53471 void PeeledOnion_free(struct LDKPeeledOnion this_ptr);
53472
53473 /**
53474  * Creates a copy of the PeeledOnion
53475  */
53476 struct LDKPeeledOnion PeeledOnion_clone(const struct LDKPeeledOnion *NONNULL_PTR orig);
53477
53478 /**
53479  * Utility method to constructs a new Forward-variant PeeledOnion
53480  */
53481 struct LDKPeeledOnion PeeledOnion_forward(struct LDKNextMessageHop a, struct LDKOnionMessage b);
53482
53483 /**
53484  * Utility method to constructs a new Receive-variant PeeledOnion
53485  */
53486 struct LDKPeeledOnion PeeledOnion_receive(struct LDKParsedOnionMessageContents a, struct LDKThirtyTwoBytes b, struct LDKBlindedPath c);
53487
53488 /**
53489  * Creates an [`OnionMessage`] with the given `contents` for sending to the destination of
53490  * `path`, first calling [`Destination::resolve`] on `path.destination` with the given
53491  * [`ReadOnlyNetworkGraph`].
53492  *
53493  * Returns the node id of the peer to send the message to, the message itself, and any addresses
53494  * needed to connect to the first node.
53495  *
53496  * Note that reply_path (or a relevant inner pointer) may be NULL or all-0s to represent None
53497  */
53498 struct LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ create_onion_message_resolving_destination(const struct LDKEntropySource *NONNULL_PTR entropy_source, const struct LDKNodeSigner *NONNULL_PTR node_signer, const struct LDKNodeIdLookUp *NONNULL_PTR node_id_lookup, const struct LDKReadOnlyNetworkGraph *NONNULL_PTR network_graph, struct LDKOnionMessagePath path, struct LDKOnionMessageContents contents, struct LDKBlindedPath reply_path);
53499
53500 /**
53501  * Creates an [`OnionMessage`] with the given `contents` for sending to the destination of
53502  * `path`.
53503  *
53504  * Returns the node id of the peer to send the message to, the message itself, and any addresses
53505  * needed to connect to the first node.
53506  *
53507  * Returns [`SendError::UnresolvedIntroductionNode`] if:
53508  * - `destination` contains a blinded path with an [`IntroductionNode::DirectedShortChannelId`],
53509  * - unless it can be resolved by [`NodeIdLookUp::next_node_id`].
53510  * Use [`create_onion_message_resolving_destination`] instead to resolve the introduction node
53511  * first with a [`ReadOnlyNetworkGraph`].
53512  *
53513  * Note that reply_path (or a relevant inner pointer) may be NULL or all-0s to represent None
53514  */
53515 struct LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ create_onion_message(const struct LDKEntropySource *NONNULL_PTR entropy_source, const struct LDKNodeSigner *NONNULL_PTR node_signer, const struct LDKNodeIdLookUp *NONNULL_PTR node_id_lookup, struct LDKOnionMessagePath path, struct LDKOnionMessageContents contents, struct LDKBlindedPath reply_path);
53516
53517 /**
53518  * Decode one layer of an incoming [`OnionMessage`].
53519  *
53520  * Returns either the next layer of the onion for forwarding or the decrypted content for the
53521  * receiver.
53522  */
53523 struct LDKCResult_PeeledOnionNoneZ peel_onion_message(const struct LDKOnionMessage *NONNULL_PTR msg, struct LDKNodeSigner node_signer, struct LDKLogger logger, struct LDKCustomOnionMessageHandler custom_handler);
53524
53525 /**
53526  * Constructs a new `OnionMessenger` to send, forward, and delegate received onion messages to
53527  * their respective handlers.
53528  */
53529 MUST_USE_RES struct LDKOnionMessenger OnionMessenger_new(struct LDKEntropySource entropy_source, struct LDKNodeSigner node_signer, struct LDKLogger logger, struct LDKNodeIdLookUp node_id_lookup, struct LDKMessageRouter message_router, struct LDKOffersMessageHandler offers_handler, struct LDKCustomOnionMessageHandler custom_handler);
53530
53531 /**
53532  * Sends an [`OnionMessage`] with the given `contents` to `destination`.
53533  *
53534  * See [`OnionMessenger`] for example usage.
53535  *
53536  * Note that reply_path (or a relevant inner pointer) may be NULL or all-0s to represent None
53537  */
53538 MUST_USE_RES struct LDKCResult_SendSuccessSendErrorZ OnionMessenger_send_onion_message(const struct LDKOnionMessenger *NONNULL_PTR this_arg, struct LDKOnionMessageContents contents, struct LDKDestination destination, struct LDKBlindedPath reply_path);
53539
53540 /**
53541  * Constructs a new OnionMessageHandler which calls the relevant methods on this_arg.
53542  * This copies the `inner` pointer in this_arg and thus the returned OnionMessageHandler must be freed before this_arg is
53543  */
53544 struct LDKOnionMessageHandler OnionMessenger_as_OnionMessageHandler(const struct LDKOnionMessenger *NONNULL_PTR this_arg);
53545
53546 /**
53547  * Calls the free function if one is set
53548  */
53549 void OffersMessageHandler_free(struct LDKOffersMessageHandler this_ptr);
53550
53551 /**
53552  * Frees any resources used by the OffersMessage
53553  */
53554 void OffersMessage_free(struct LDKOffersMessage this_ptr);
53555
53556 /**
53557  * Creates a copy of the OffersMessage
53558  */
53559 struct LDKOffersMessage OffersMessage_clone(const struct LDKOffersMessage *NONNULL_PTR orig);
53560
53561 /**
53562  * Utility method to constructs a new InvoiceRequest-variant OffersMessage
53563  */
53564 struct LDKOffersMessage OffersMessage_invoice_request(struct LDKInvoiceRequest a);
53565
53566 /**
53567  * Utility method to constructs a new Invoice-variant OffersMessage
53568  */
53569 struct LDKOffersMessage OffersMessage_invoice(struct LDKBolt12Invoice a);
53570
53571 /**
53572  * Utility method to constructs a new InvoiceError-variant OffersMessage
53573  */
53574 struct LDKOffersMessage OffersMessage_invoice_error(struct LDKInvoiceError a);
53575
53576 /**
53577  * Returns whether `tlv_type` corresponds to a TLV record for Offers.
53578  */
53579 MUST_USE_RES bool OffersMessage_is_known_type(uint64_t tlv_type);
53580
53581 /**
53582  * Constructs a new OnionMessageContents which calls the relevant methods on this_arg.
53583  * This copies the `inner` pointer in this_arg and thus the returned OnionMessageContents must be freed before this_arg is
53584  */
53585 struct LDKOnionMessageContents OffersMessage_as_OnionMessageContents(const struct LDKOffersMessage *NONNULL_PTR this_arg);
53586
53587 /**
53588  * Serialize the OffersMessage object into a byte array which can be read by OffersMessage_read
53589  */
53590 struct LDKCVec_u8Z OffersMessage_write(const struct LDKOffersMessage *NONNULL_PTR obj);
53591
53592 /**
53593  * Read a OffersMessage from a byte array, created by OffersMessage_write
53594  */
53595 struct LDKCResult_OffersMessageDecodeErrorZ OffersMessage_read(struct LDKu8slice ser, uint64_t arg_a, const struct LDKLogger *NONNULL_PTR arg_b);
53596
53597 /**
53598  * Frees any resources used by the Packet, if is_owned is set and inner is non-NULL.
53599  */
53600 void Packet_free(struct LDKPacket this_obj);
53601
53602 /**
53603  * Bolt 04 version number
53604  */
53605 uint8_t Packet_get_version(const struct LDKPacket *NONNULL_PTR this_ptr);
53606
53607 /**
53608  * Bolt 04 version number
53609  */
53610 void Packet_set_version(struct LDKPacket *NONNULL_PTR this_ptr, uint8_t val);
53611
53612 /**
53613  * A random sepc256k1 point, used to build the ECDH shared secret to decrypt hop_data
53614  */
53615 struct LDKPublicKey Packet_get_public_key(const struct LDKPacket *NONNULL_PTR this_ptr);
53616
53617 /**
53618  * A random sepc256k1 point, used to build the ECDH shared secret to decrypt hop_data
53619  */
53620 void Packet_set_public_key(struct LDKPacket *NONNULL_PTR this_ptr, struct LDKPublicKey val);
53621
53622 /**
53623  * Encrypted payload for the next hop
53624  *
53625  * Returns a copy of the field.
53626  */
53627 struct LDKCVec_u8Z Packet_get_hop_data(const struct LDKPacket *NONNULL_PTR this_ptr);
53628
53629 /**
53630  * Encrypted payload for the next hop
53631  */
53632 void Packet_set_hop_data(struct LDKPacket *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
53633
53634 /**
53635  * HMAC to verify the integrity of hop_data
53636  */
53637 const uint8_t (*Packet_get_hmac(const struct LDKPacket *NONNULL_PTR this_ptr))[32];
53638
53639 /**
53640  * HMAC to verify the integrity of hop_data
53641  */
53642 void Packet_set_hmac(struct LDKPacket *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
53643
53644 /**
53645  * Constructs a new Packet given each field
53646  */
53647 MUST_USE_RES struct LDKPacket Packet_new(uint8_t version_arg, struct LDKPublicKey public_key_arg, struct LDKCVec_u8Z hop_data_arg, struct LDKThirtyTwoBytes hmac_arg);
53648
53649 /**
53650  * Creates a copy of the Packet
53651  */
53652 struct LDKPacket Packet_clone(const struct LDKPacket *NONNULL_PTR orig);
53653
53654 /**
53655  * Generates a non-cryptographic 64-bit hash of the Packet.
53656  */
53657 uint64_t Packet_hash(const struct LDKPacket *NONNULL_PTR o);
53658
53659 /**
53660  * Checks if two Packets contain equal inner contents.
53661  * This ignores pointers and is_owned flags and looks at the values in fields.
53662  * Two objects with NULL inner values will be considered "equal" here.
53663  */
53664 bool Packet_eq(const struct LDKPacket *NONNULL_PTR a, const struct LDKPacket *NONNULL_PTR b);
53665
53666 /**
53667  * Serialize the Packet object into a byte array which can be read by Packet_read
53668  */
53669 struct LDKCVec_u8Z Packet_write(const struct LDKPacket *NONNULL_PTR obj);
53670
53671 /**
53672  * Frees any resources used by the ParsedOnionMessageContents
53673  */
53674 void ParsedOnionMessageContents_free(struct LDKParsedOnionMessageContents this_ptr);
53675
53676 /**
53677  * Creates a copy of the ParsedOnionMessageContents
53678  */
53679 struct LDKParsedOnionMessageContents ParsedOnionMessageContents_clone(const struct LDKParsedOnionMessageContents *NONNULL_PTR orig);
53680
53681 /**
53682  * Utility method to constructs a new Offers-variant ParsedOnionMessageContents
53683  */
53684 struct LDKParsedOnionMessageContents ParsedOnionMessageContents_offers(struct LDKOffersMessage a);
53685
53686 /**
53687  * Utility method to constructs a new Custom-variant ParsedOnionMessageContents
53688  */
53689 struct LDKParsedOnionMessageContents ParsedOnionMessageContents_custom(struct LDKOnionMessageContents a);
53690
53691 /**
53692  * Constructs a new OnionMessageContents which calls the relevant methods on this_arg.
53693  * This copies the `inner` pointer in this_arg and thus the returned OnionMessageContents must be freed before this_arg is
53694  */
53695 struct LDKOnionMessageContents ParsedOnionMessageContents_as_OnionMessageContents(const struct LDKParsedOnionMessageContents *NONNULL_PTR this_arg);
53696
53697 /**
53698  * Serialize the ParsedOnionMessageContents object into a byte array which can be read by ParsedOnionMessageContents_read
53699  */
53700 struct LDKCVec_u8Z ParsedOnionMessageContents_write(const struct LDKParsedOnionMessageContents *NONNULL_PTR obj);
53701
53702 /**
53703  * Creates a copy of a OnionMessageContents
53704  */
53705 struct LDKOnionMessageContents OnionMessageContents_clone(const struct LDKOnionMessageContents *NONNULL_PTR orig);
53706
53707 /**
53708  * Calls the free function if one is set
53709  */
53710 void OnionMessageContents_free(struct LDKOnionMessageContents this_ptr);
53711
53712 /**
53713  * Frees any resources used by the NextMessageHop
53714  */
53715 void NextMessageHop_free(struct LDKNextMessageHop this_ptr);
53716
53717 /**
53718  * Creates a copy of the NextMessageHop
53719  */
53720 struct LDKNextMessageHop NextMessageHop_clone(const struct LDKNextMessageHop *NONNULL_PTR orig);
53721
53722 /**
53723  * Utility method to constructs a new NodeId-variant NextMessageHop
53724  */
53725 struct LDKNextMessageHop NextMessageHop_node_id(struct LDKPublicKey a);
53726
53727 /**
53728  * Utility method to constructs a new ShortChannelId-variant NextMessageHop
53729  */
53730 struct LDKNextMessageHop NextMessageHop_short_channel_id(uint64_t a);
53731
53732 /**
53733  * Generates a non-cryptographic 64-bit hash of the NextMessageHop.
53734  */
53735 uint64_t NextMessageHop_hash(const struct LDKNextMessageHop *NONNULL_PTR o);
53736
53737 /**
53738  * Checks if two NextMessageHops contain equal inner contents.
53739  * This ignores pointers and is_owned flags and looks at the values in fields.
53740  */
53741 bool NextMessageHop_eq(const struct LDKNextMessageHop *NONNULL_PTR a, const struct LDKNextMessageHop *NONNULL_PTR b);
53742
53743 /**
53744  * Frees any resources used by the BlindedPath, if is_owned is set and inner is non-NULL.
53745  */
53746 void BlindedPath_free(struct LDKBlindedPath this_obj);
53747
53748 /**
53749  * To send to a blinded path, the sender first finds a route to the unblinded
53750  * `introduction_node`, which can unblind its [`encrypted_payload`] to find out the onion
53751  * message or payment's next hop and forward it along.
53752  *
53753  * [`encrypted_payload`]: BlindedHop::encrypted_payload
53754  */
53755 struct LDKIntroductionNode BlindedPath_get_introduction_node(const struct LDKBlindedPath *NONNULL_PTR this_ptr);
53756
53757 /**
53758  * To send to a blinded path, the sender first finds a route to the unblinded
53759  * `introduction_node`, which can unblind its [`encrypted_payload`] to find out the onion
53760  * message or payment's next hop and forward it along.
53761  *
53762  * [`encrypted_payload`]: BlindedHop::encrypted_payload
53763  */
53764 void BlindedPath_set_introduction_node(struct LDKBlindedPath *NONNULL_PTR this_ptr, struct LDKIntroductionNode val);
53765
53766 /**
53767  * Used by the introduction node to decrypt its [`encrypted_payload`] to forward the onion
53768  * message or payment.
53769  *
53770  * [`encrypted_payload`]: BlindedHop::encrypted_payload
53771  */
53772 struct LDKPublicKey BlindedPath_get_blinding_point(const struct LDKBlindedPath *NONNULL_PTR this_ptr);
53773
53774 /**
53775  * Used by the introduction node to decrypt its [`encrypted_payload`] to forward the onion
53776  * message or payment.
53777  *
53778  * [`encrypted_payload`]: BlindedHop::encrypted_payload
53779  */
53780 void BlindedPath_set_blinding_point(struct LDKBlindedPath *NONNULL_PTR this_ptr, struct LDKPublicKey val);
53781
53782 /**
53783  * The hops composing the blinded path.
53784  */
53785 struct LDKCVec_BlindedHopZ BlindedPath_get_blinded_hops(const struct LDKBlindedPath *NONNULL_PTR this_ptr);
53786
53787 /**
53788  * The hops composing the blinded path.
53789  */
53790 void BlindedPath_set_blinded_hops(struct LDKBlindedPath *NONNULL_PTR this_ptr, struct LDKCVec_BlindedHopZ val);
53791
53792 /**
53793  * Constructs a new BlindedPath given each field
53794  */
53795 MUST_USE_RES struct LDKBlindedPath BlindedPath_new(struct LDKIntroductionNode introduction_node_arg, struct LDKPublicKey blinding_point_arg, struct LDKCVec_BlindedHopZ blinded_hops_arg);
53796
53797 /**
53798  * Creates a copy of the BlindedPath
53799  */
53800 struct LDKBlindedPath BlindedPath_clone(const struct LDKBlindedPath *NONNULL_PTR orig);
53801
53802 /**
53803  * Generates a non-cryptographic 64-bit hash of the BlindedPath.
53804  */
53805 uint64_t BlindedPath_hash(const struct LDKBlindedPath *NONNULL_PTR o);
53806
53807 /**
53808  * Checks if two BlindedPaths contain equal inner contents.
53809  * This ignores pointers and is_owned flags and looks at the values in fields.
53810  * Two objects with NULL inner values will be considered "equal" here.
53811  */
53812 bool BlindedPath_eq(const struct LDKBlindedPath *NONNULL_PTR a, const struct LDKBlindedPath *NONNULL_PTR b);
53813
53814 /**
53815  * Frees any resources used by the IntroductionNode
53816  */
53817 void IntroductionNode_free(struct LDKIntroductionNode this_ptr);
53818
53819 /**
53820  * Creates a copy of the IntroductionNode
53821  */
53822 struct LDKIntroductionNode IntroductionNode_clone(const struct LDKIntroductionNode *NONNULL_PTR orig);
53823
53824 /**
53825  * Utility method to constructs a new NodeId-variant IntroductionNode
53826  */
53827 struct LDKIntroductionNode IntroductionNode_node_id(struct LDKPublicKey a);
53828
53829 /**
53830  * Utility method to constructs a new DirectedShortChannelId-variant IntroductionNode
53831  */
53832 struct LDKIntroductionNode IntroductionNode_directed_short_channel_id(enum LDKDirection a, uint64_t b);
53833
53834 /**
53835  * Generates a non-cryptographic 64-bit hash of the IntroductionNode.
53836  */
53837 uint64_t IntroductionNode_hash(const struct LDKIntroductionNode *NONNULL_PTR o);
53838
53839 /**
53840  * Checks if two IntroductionNodes contain equal inner contents.
53841  * This ignores pointers and is_owned flags and looks at the values in fields.
53842  */
53843 bool IntroductionNode_eq(const struct LDKIntroductionNode *NONNULL_PTR a, const struct LDKIntroductionNode *NONNULL_PTR b);
53844
53845 /**
53846  * Creates a copy of the Direction
53847  */
53848 enum LDKDirection Direction_clone(const enum LDKDirection *NONNULL_PTR orig);
53849
53850 /**
53851  * Utility method to constructs a new NodeOne-variant Direction
53852  */
53853 enum LDKDirection Direction_node_one(void);
53854
53855 /**
53856  * Utility method to constructs a new NodeTwo-variant Direction
53857  */
53858 enum LDKDirection Direction_node_two(void);
53859
53860 /**
53861  * Generates a non-cryptographic 64-bit hash of the Direction.
53862  */
53863 uint64_t Direction_hash(const enum LDKDirection *NONNULL_PTR o);
53864
53865 /**
53866  * Checks if two Directions contain equal inner contents.
53867  * This ignores pointers and is_owned flags and looks at the values in fields.
53868  */
53869 bool Direction_eq(const enum LDKDirection *NONNULL_PTR a, const enum LDKDirection *NONNULL_PTR b);
53870
53871 /**
53872  * Calls the free function if one is set
53873  */
53874 void NodeIdLookUp_free(struct LDKNodeIdLookUp this_ptr);
53875
53876 /**
53877  * Frees any resources used by the EmptyNodeIdLookUp, if is_owned is set and inner is non-NULL.
53878  */
53879 void EmptyNodeIdLookUp_free(struct LDKEmptyNodeIdLookUp this_obj);
53880
53881 /**
53882  * Constructs a new EmptyNodeIdLookUp given each field
53883  */
53884 MUST_USE_RES struct LDKEmptyNodeIdLookUp EmptyNodeIdLookUp_new(void);
53885
53886 /**
53887  * Constructs a new NodeIdLookUp which calls the relevant methods on this_arg.
53888  * This copies the `inner` pointer in this_arg and thus the returned NodeIdLookUp must be freed before this_arg is
53889  */
53890 struct LDKNodeIdLookUp EmptyNodeIdLookUp_as_NodeIdLookUp(const struct LDKEmptyNodeIdLookUp *NONNULL_PTR this_arg);
53891
53892 /**
53893  * Frees any resources used by the BlindedHop, if is_owned is set and inner is non-NULL.
53894  */
53895 void BlindedHop_free(struct LDKBlindedHop this_obj);
53896
53897 /**
53898  * The blinded node id of this hop in a [`BlindedPath`].
53899  */
53900 struct LDKPublicKey BlindedHop_get_blinded_node_id(const struct LDKBlindedHop *NONNULL_PTR this_ptr);
53901
53902 /**
53903  * The blinded node id of this hop in a [`BlindedPath`].
53904  */
53905 void BlindedHop_set_blinded_node_id(struct LDKBlindedHop *NONNULL_PTR this_ptr, struct LDKPublicKey val);
53906
53907 /**
53908  * The encrypted payload intended for this hop in a [`BlindedPath`].
53909  *
53910  * Returns a copy of the field.
53911  */
53912 struct LDKCVec_u8Z BlindedHop_get_encrypted_payload(const struct LDKBlindedHop *NONNULL_PTR this_ptr);
53913
53914 /**
53915  * The encrypted payload intended for this hop in a [`BlindedPath`].
53916  */
53917 void BlindedHop_set_encrypted_payload(struct LDKBlindedHop *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
53918
53919 /**
53920  * Constructs a new BlindedHop given each field
53921  */
53922 MUST_USE_RES struct LDKBlindedHop BlindedHop_new(struct LDKPublicKey blinded_node_id_arg, struct LDKCVec_u8Z encrypted_payload_arg);
53923
53924 /**
53925  * Creates a copy of the BlindedHop
53926  */
53927 struct LDKBlindedHop BlindedHop_clone(const struct LDKBlindedHop *NONNULL_PTR orig);
53928
53929 /**
53930  * Generates a non-cryptographic 64-bit hash of the BlindedHop.
53931  */
53932 uint64_t BlindedHop_hash(const struct LDKBlindedHop *NONNULL_PTR o);
53933
53934 /**
53935  * Checks if two BlindedHops contain equal inner contents.
53936  * This ignores pointers and is_owned flags and looks at the values in fields.
53937  * Two objects with NULL inner values will be considered "equal" here.
53938  */
53939 bool BlindedHop_eq(const struct LDKBlindedHop *NONNULL_PTR a, const struct LDKBlindedHop *NONNULL_PTR b);
53940
53941 /**
53942  * Create a one-hop blinded path for a message.
53943  */
53944 MUST_USE_RES struct LDKCResult_BlindedPathNoneZ BlindedPath_one_hop_for_message(struct LDKPublicKey recipient_node_id, struct LDKEntropySource entropy_source);
53945
53946 /**
53947  * Create a blinded path for an onion message, to be forwarded along `node_pks`. The last node
53948  * pubkey in `node_pks` will be the destination node.
53949  *
53950  * Errors if no hops are provided or if `node_pk`(s) are invalid.
53951  */
53952 MUST_USE_RES struct LDKCResult_BlindedPathNoneZ BlindedPath_new_for_message(struct LDKCVec_PublicKeyZ node_pks, struct LDKEntropySource entropy_source);
53953
53954 /**
53955  * Create a one-hop blinded path for a payment.
53956  */
53957 MUST_USE_RES struct LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ BlindedPath_one_hop_for_payment(struct LDKPublicKey payee_node_id, struct LDKReceiveTlvs payee_tlvs, uint16_t min_final_cltv_expiry_delta, struct LDKEntropySource entropy_source);
53958
53959 /**
53960  * Create a blinded path for a payment, to be forwarded along `intermediate_nodes`.
53961  *
53962  * Errors if:
53963  * * a provided node id is invalid
53964  * * [`BlindedPayInfo`] calculation results in an integer overflow
53965  * * any unknown features are required in the provided [`ForwardTlvs`]
53966  *
53967  * [`ForwardTlvs`]: crate::blinded_path::payment::ForwardTlvs
53968  */
53969 MUST_USE_RES struct LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ BlindedPath_new_for_payment(struct LDKCVec_ForwardNodeZ intermediate_nodes, struct LDKPublicKey payee_node_id, struct LDKReceiveTlvs payee_tlvs, uint64_t htlc_maximum_msat, uint16_t min_final_cltv_expiry_delta, struct LDKEntropySource entropy_source);
53970
53971 /**
53972  * Returns the introduction [`NodeId`] of the blinded path, if it is publicly reachable (i.e.,
53973  * it is found in the network graph).
53974  *
53975  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
53976  */
53977 MUST_USE_RES struct LDKNodeId BlindedPath_public_introduction_node_id(const struct LDKBlindedPath *NONNULL_PTR this_arg, const struct LDKReadOnlyNetworkGraph *NONNULL_PTR network_graph);
53978
53979 /**
53980  * Serialize the BlindedPath object into a byte array which can be read by BlindedPath_read
53981  */
53982 struct LDKCVec_u8Z BlindedPath_write(const struct LDKBlindedPath *NONNULL_PTR obj);
53983
53984 /**
53985  * Read a BlindedPath from a byte array, created by BlindedPath_write
53986  */
53987 struct LDKCResult_BlindedPathDecodeErrorZ BlindedPath_read(struct LDKu8slice ser);
53988
53989 /**
53990  * Serialize the BlindedHop object into a byte array which can be read by BlindedHop_read
53991  */
53992 struct LDKCVec_u8Z BlindedHop_write(const struct LDKBlindedHop *NONNULL_PTR obj);
53993
53994 /**
53995  * Read a BlindedHop from a byte array, created by BlindedHop_write
53996  */
53997 struct LDKCResult_BlindedHopDecodeErrorZ BlindedHop_read(struct LDKu8slice ser);
53998
53999 /**
54000  * Frees any resources used by the ForwardNode, if is_owned is set and inner is non-NULL.
54001  */
54002 void ForwardNode_free(struct LDKForwardNode this_obj);
54003
54004 /**
54005  * The TLVs for this node's [`BlindedHop`], where the fee parameters contained within are also
54006  * used for [`BlindedPayInfo`] construction.
54007  */
54008 struct LDKForwardTlvs ForwardNode_get_tlvs(const struct LDKForwardNode *NONNULL_PTR this_ptr);
54009
54010 /**
54011  * The TLVs for this node's [`BlindedHop`], where the fee parameters contained within are also
54012  * used for [`BlindedPayInfo`] construction.
54013  */
54014 void ForwardNode_set_tlvs(struct LDKForwardNode *NONNULL_PTR this_ptr, struct LDKForwardTlvs val);
54015
54016 /**
54017  * This node's pubkey.
54018  */
54019 struct LDKPublicKey ForwardNode_get_node_id(const struct LDKForwardNode *NONNULL_PTR this_ptr);
54020
54021 /**
54022  * This node's pubkey.
54023  */
54024 void ForwardNode_set_node_id(struct LDKForwardNode *NONNULL_PTR this_ptr, struct LDKPublicKey val);
54025
54026 /**
54027  * The maximum value, in msat, that may be accepted by this node.
54028  */
54029 uint64_t ForwardNode_get_htlc_maximum_msat(const struct LDKForwardNode *NONNULL_PTR this_ptr);
54030
54031 /**
54032  * The maximum value, in msat, that may be accepted by this node.
54033  */
54034 void ForwardNode_set_htlc_maximum_msat(struct LDKForwardNode *NONNULL_PTR this_ptr, uint64_t val);
54035
54036 /**
54037  * Constructs a new ForwardNode given each field
54038  */
54039 MUST_USE_RES struct LDKForwardNode ForwardNode_new(struct LDKForwardTlvs tlvs_arg, struct LDKPublicKey node_id_arg, uint64_t htlc_maximum_msat_arg);
54040
54041 /**
54042  * Creates a copy of the ForwardNode
54043  */
54044 struct LDKForwardNode ForwardNode_clone(const struct LDKForwardNode *NONNULL_PTR orig);
54045
54046 /**
54047  * Frees any resources used by the ForwardTlvs, if is_owned is set and inner is non-NULL.
54048  */
54049 void ForwardTlvs_free(struct LDKForwardTlvs this_obj);
54050
54051 /**
54052  * The short channel id this payment should be forwarded out over.
54053  */
54054 uint64_t ForwardTlvs_get_short_channel_id(const struct LDKForwardTlvs *NONNULL_PTR this_ptr);
54055
54056 /**
54057  * The short channel id this payment should be forwarded out over.
54058  */
54059 void ForwardTlvs_set_short_channel_id(struct LDKForwardTlvs *NONNULL_PTR this_ptr, uint64_t val);
54060
54061 /**
54062  * Payment parameters for relaying over [`Self::short_channel_id`].
54063  */
54064 struct LDKPaymentRelay ForwardTlvs_get_payment_relay(const struct LDKForwardTlvs *NONNULL_PTR this_ptr);
54065
54066 /**
54067  * Payment parameters for relaying over [`Self::short_channel_id`].
54068  */
54069 void ForwardTlvs_set_payment_relay(struct LDKForwardTlvs *NONNULL_PTR this_ptr, struct LDKPaymentRelay val);
54070
54071 /**
54072  * Payment constraints for relaying over [`Self::short_channel_id`].
54073  */
54074 struct LDKPaymentConstraints ForwardTlvs_get_payment_constraints(const struct LDKForwardTlvs *NONNULL_PTR this_ptr);
54075
54076 /**
54077  * Payment constraints for relaying over [`Self::short_channel_id`].
54078  */
54079 void ForwardTlvs_set_payment_constraints(struct LDKForwardTlvs *NONNULL_PTR this_ptr, struct LDKPaymentConstraints val);
54080
54081 /**
54082  * Supported and required features when relaying a payment onion containing this object's
54083  * corresponding [`BlindedHop::encrypted_payload`].
54084  *
54085  * [`BlindedHop::encrypted_payload`]: crate::blinded_path::BlindedHop::encrypted_payload
54086  */
54087 struct LDKBlindedHopFeatures ForwardTlvs_get_features(const struct LDKForwardTlvs *NONNULL_PTR this_ptr);
54088
54089 /**
54090  * Supported and required features when relaying a payment onion containing this object's
54091  * corresponding [`BlindedHop::encrypted_payload`].
54092  *
54093  * [`BlindedHop::encrypted_payload`]: crate::blinded_path::BlindedHop::encrypted_payload
54094  */
54095 void ForwardTlvs_set_features(struct LDKForwardTlvs *NONNULL_PTR this_ptr, struct LDKBlindedHopFeatures val);
54096
54097 /**
54098  * Constructs a new ForwardTlvs given each field
54099  */
54100 MUST_USE_RES struct LDKForwardTlvs ForwardTlvs_new(uint64_t short_channel_id_arg, struct LDKPaymentRelay payment_relay_arg, struct LDKPaymentConstraints payment_constraints_arg, struct LDKBlindedHopFeatures features_arg);
54101
54102 /**
54103  * Creates a copy of the ForwardTlvs
54104  */
54105 struct LDKForwardTlvs ForwardTlvs_clone(const struct LDKForwardTlvs *NONNULL_PTR orig);
54106
54107 /**
54108  * Frees any resources used by the ReceiveTlvs, if is_owned is set and inner is non-NULL.
54109  */
54110 void ReceiveTlvs_free(struct LDKReceiveTlvs this_obj);
54111
54112 /**
54113  * Used to authenticate the sender of a payment to the receiver and tie MPP HTLCs together.
54114  */
54115 const uint8_t (*ReceiveTlvs_get_payment_secret(const struct LDKReceiveTlvs *NONNULL_PTR this_ptr))[32];
54116
54117 /**
54118  * Used to authenticate the sender of a payment to the receiver and tie MPP HTLCs together.
54119  */
54120 void ReceiveTlvs_set_payment_secret(struct LDKReceiveTlvs *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
54121
54122 /**
54123  * Constraints for the receiver of this payment.
54124  */
54125 struct LDKPaymentConstraints ReceiveTlvs_get_payment_constraints(const struct LDKReceiveTlvs *NONNULL_PTR this_ptr);
54126
54127 /**
54128  * Constraints for the receiver of this payment.
54129  */
54130 void ReceiveTlvs_set_payment_constraints(struct LDKReceiveTlvs *NONNULL_PTR this_ptr, struct LDKPaymentConstraints val);
54131
54132 /**
54133  * Context for the receiver of this payment.
54134  */
54135 struct LDKPaymentContext ReceiveTlvs_get_payment_context(const struct LDKReceiveTlvs *NONNULL_PTR this_ptr);
54136
54137 /**
54138  * Context for the receiver of this payment.
54139  */
54140 void ReceiveTlvs_set_payment_context(struct LDKReceiveTlvs *NONNULL_PTR this_ptr, struct LDKPaymentContext val);
54141
54142 /**
54143  * Constructs a new ReceiveTlvs given each field
54144  */
54145 MUST_USE_RES struct LDKReceiveTlvs ReceiveTlvs_new(struct LDKThirtyTwoBytes payment_secret_arg, struct LDKPaymentConstraints payment_constraints_arg, struct LDKPaymentContext payment_context_arg);
54146
54147 /**
54148  * Creates a copy of the ReceiveTlvs
54149  */
54150 struct LDKReceiveTlvs ReceiveTlvs_clone(const struct LDKReceiveTlvs *NONNULL_PTR orig);
54151
54152 /**
54153  * Frees any resources used by the PaymentRelay, if is_owned is set and inner is non-NULL.
54154  */
54155 void PaymentRelay_free(struct LDKPaymentRelay this_obj);
54156
54157 /**
54158  * Number of blocks subtracted from an incoming HTLC's `cltv_expiry` for this [`BlindedHop`].
54159  */
54160 uint16_t PaymentRelay_get_cltv_expiry_delta(const struct LDKPaymentRelay *NONNULL_PTR this_ptr);
54161
54162 /**
54163  * Number of blocks subtracted from an incoming HTLC's `cltv_expiry` for this [`BlindedHop`].
54164  */
54165 void PaymentRelay_set_cltv_expiry_delta(struct LDKPaymentRelay *NONNULL_PTR this_ptr, uint16_t val);
54166
54167 /**
54168  * Liquidity fee charged (in millionths of the amount transferred) for relaying a payment over
54169  * this [`BlindedHop`], (i.e., 10,000 is 1%).
54170  */
54171 uint32_t PaymentRelay_get_fee_proportional_millionths(const struct LDKPaymentRelay *NONNULL_PTR this_ptr);
54172
54173 /**
54174  * Liquidity fee charged (in millionths of the amount transferred) for relaying a payment over
54175  * this [`BlindedHop`], (i.e., 10,000 is 1%).
54176  */
54177 void PaymentRelay_set_fee_proportional_millionths(struct LDKPaymentRelay *NONNULL_PTR this_ptr, uint32_t val);
54178
54179 /**
54180  * Base fee charged (in millisatoshi) for relaying a payment over this [`BlindedHop`].
54181  */
54182 uint32_t PaymentRelay_get_fee_base_msat(const struct LDKPaymentRelay *NONNULL_PTR this_ptr);
54183
54184 /**
54185  * Base fee charged (in millisatoshi) for relaying a payment over this [`BlindedHop`].
54186  */
54187 void PaymentRelay_set_fee_base_msat(struct LDKPaymentRelay *NONNULL_PTR this_ptr, uint32_t val);
54188
54189 /**
54190  * Constructs a new PaymentRelay given each field
54191  */
54192 MUST_USE_RES struct LDKPaymentRelay PaymentRelay_new(uint16_t cltv_expiry_delta_arg, uint32_t fee_proportional_millionths_arg, uint32_t fee_base_msat_arg);
54193
54194 /**
54195  * Creates a copy of the PaymentRelay
54196  */
54197 struct LDKPaymentRelay PaymentRelay_clone(const struct LDKPaymentRelay *NONNULL_PTR orig);
54198
54199 /**
54200  * Frees any resources used by the PaymentConstraints, if is_owned is set and inner is non-NULL.
54201  */
54202 void PaymentConstraints_free(struct LDKPaymentConstraints this_obj);
54203
54204 /**
54205  * The maximum total CLTV that is acceptable when relaying a payment over this [`BlindedHop`].
54206  */
54207 uint32_t PaymentConstraints_get_max_cltv_expiry(const struct LDKPaymentConstraints *NONNULL_PTR this_ptr);
54208
54209 /**
54210  * The maximum total CLTV that is acceptable when relaying a payment over this [`BlindedHop`].
54211  */
54212 void PaymentConstraints_set_max_cltv_expiry(struct LDKPaymentConstraints *NONNULL_PTR this_ptr, uint32_t val);
54213
54214 /**
54215  * The minimum value, in msat, that may be accepted by the node corresponding to this
54216  * [`BlindedHop`].
54217  */
54218 uint64_t PaymentConstraints_get_htlc_minimum_msat(const struct LDKPaymentConstraints *NONNULL_PTR this_ptr);
54219
54220 /**
54221  * The minimum value, in msat, that may be accepted by the node corresponding to this
54222  * [`BlindedHop`].
54223  */
54224 void PaymentConstraints_set_htlc_minimum_msat(struct LDKPaymentConstraints *NONNULL_PTR this_ptr, uint64_t val);
54225
54226 /**
54227  * Constructs a new PaymentConstraints given each field
54228  */
54229 MUST_USE_RES struct LDKPaymentConstraints PaymentConstraints_new(uint32_t max_cltv_expiry_arg, uint64_t htlc_minimum_msat_arg);
54230
54231 /**
54232  * Creates a copy of the PaymentConstraints
54233  */
54234 struct LDKPaymentConstraints PaymentConstraints_clone(const struct LDKPaymentConstraints *NONNULL_PTR orig);
54235
54236 /**
54237  * Frees any resources used by the PaymentContext
54238  */
54239 void PaymentContext_free(struct LDKPaymentContext this_ptr);
54240
54241 /**
54242  * Creates a copy of the PaymentContext
54243  */
54244 struct LDKPaymentContext PaymentContext_clone(const struct LDKPaymentContext *NONNULL_PTR orig);
54245
54246 /**
54247  * Utility method to constructs a new Unknown-variant PaymentContext
54248  */
54249 struct LDKPaymentContext PaymentContext_unknown(struct LDKUnknownPaymentContext a);
54250
54251 /**
54252  * Utility method to constructs a new Bolt12Offer-variant PaymentContext
54253  */
54254 struct LDKPaymentContext PaymentContext_bolt12_offer(struct LDKBolt12OfferContext a);
54255
54256 /**
54257  * Utility method to constructs a new Bolt12Refund-variant PaymentContext
54258  */
54259 struct LDKPaymentContext PaymentContext_bolt12_refund(struct LDKBolt12RefundContext a);
54260
54261 /**
54262  * Checks if two PaymentContexts contain equal inner contents.
54263  * This ignores pointers and is_owned flags and looks at the values in fields.
54264  */
54265 bool PaymentContext_eq(const struct LDKPaymentContext *NONNULL_PTR a, const struct LDKPaymentContext *NONNULL_PTR b);
54266
54267 /**
54268  * Frees any resources used by the UnknownPaymentContext, if is_owned is set and inner is non-NULL.
54269  */
54270 void UnknownPaymentContext_free(struct LDKUnknownPaymentContext this_obj);
54271
54272 /**
54273  * Creates a copy of the UnknownPaymentContext
54274  */
54275 struct LDKUnknownPaymentContext UnknownPaymentContext_clone(const struct LDKUnknownPaymentContext *NONNULL_PTR orig);
54276
54277 /**
54278  * Checks if two UnknownPaymentContexts contain equal inner contents.
54279  * This ignores pointers and is_owned flags and looks at the values in fields.
54280  * Two objects with NULL inner values will be considered "equal" here.
54281  */
54282 bool UnknownPaymentContext_eq(const struct LDKUnknownPaymentContext *NONNULL_PTR a, const struct LDKUnknownPaymentContext *NONNULL_PTR b);
54283
54284 /**
54285  * Frees any resources used by the Bolt12OfferContext, if is_owned is set and inner is non-NULL.
54286  */
54287 void Bolt12OfferContext_free(struct LDKBolt12OfferContext this_obj);
54288
54289 /**
54290  * The identifier of the [`Offer`].
54291  *
54292  * [`Offer`]: crate::offers::offer::Offer
54293  */
54294 struct LDKOfferId Bolt12OfferContext_get_offer_id(const struct LDKBolt12OfferContext *NONNULL_PTR this_ptr);
54295
54296 /**
54297  * The identifier of the [`Offer`].
54298  *
54299  * [`Offer`]: crate::offers::offer::Offer
54300  */
54301 void Bolt12OfferContext_set_offer_id(struct LDKBolt12OfferContext *NONNULL_PTR this_ptr, struct LDKOfferId val);
54302
54303 /**
54304  * Fields from an [`InvoiceRequest`] sent for a [`Bolt12Invoice`].
54305  *
54306  * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
54307  * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
54308  */
54309 struct LDKInvoiceRequestFields Bolt12OfferContext_get_invoice_request(const struct LDKBolt12OfferContext *NONNULL_PTR this_ptr);
54310
54311 /**
54312  * Fields from an [`InvoiceRequest`] sent for a [`Bolt12Invoice`].
54313  *
54314  * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
54315  * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
54316  */
54317 void Bolt12OfferContext_set_invoice_request(struct LDKBolt12OfferContext *NONNULL_PTR this_ptr, struct LDKInvoiceRequestFields val);
54318
54319 /**
54320  * Constructs a new Bolt12OfferContext given each field
54321  */
54322 MUST_USE_RES struct LDKBolt12OfferContext Bolt12OfferContext_new(struct LDKOfferId offer_id_arg, struct LDKInvoiceRequestFields invoice_request_arg);
54323
54324 /**
54325  * Creates a copy of the Bolt12OfferContext
54326  */
54327 struct LDKBolt12OfferContext Bolt12OfferContext_clone(const struct LDKBolt12OfferContext *NONNULL_PTR orig);
54328
54329 /**
54330  * Checks if two Bolt12OfferContexts contain equal inner contents.
54331  * This ignores pointers and is_owned flags and looks at the values in fields.
54332  * Two objects with NULL inner values will be considered "equal" here.
54333  */
54334 bool Bolt12OfferContext_eq(const struct LDKBolt12OfferContext *NONNULL_PTR a, const struct LDKBolt12OfferContext *NONNULL_PTR b);
54335
54336 /**
54337  * Frees any resources used by the Bolt12RefundContext, if is_owned is set and inner is non-NULL.
54338  */
54339 void Bolt12RefundContext_free(struct LDKBolt12RefundContext this_obj);
54340
54341 /**
54342  * Constructs a new Bolt12RefundContext given each field
54343  */
54344 MUST_USE_RES struct LDKBolt12RefundContext Bolt12RefundContext_new(void);
54345
54346 /**
54347  * Creates a copy of the Bolt12RefundContext
54348  */
54349 struct LDKBolt12RefundContext Bolt12RefundContext_clone(const struct LDKBolt12RefundContext *NONNULL_PTR orig);
54350
54351 /**
54352  * Checks if two Bolt12RefundContexts contain equal inner contents.
54353  * This ignores pointers and is_owned flags and looks at the values in fields.
54354  * Two objects with NULL inner values will be considered "equal" here.
54355  */
54356 bool Bolt12RefundContext_eq(const struct LDKBolt12RefundContext *NONNULL_PTR a, const struct LDKBolt12RefundContext *NONNULL_PTR b);
54357
54358 /**
54359  * Serialize the ForwardTlvs object into a byte array which can be read by ForwardTlvs_read
54360  */
54361 struct LDKCVec_u8Z ForwardTlvs_write(const struct LDKForwardTlvs *NONNULL_PTR obj);
54362
54363 /**
54364  * Serialize the ReceiveTlvs object into a byte array which can be read by ReceiveTlvs_read
54365  */
54366 struct LDKCVec_u8Z ReceiveTlvs_write(const struct LDKReceiveTlvs *NONNULL_PTR obj);
54367
54368 /**
54369  * Serialize the PaymentRelay object into a byte array which can be read by PaymentRelay_read
54370  */
54371 struct LDKCVec_u8Z PaymentRelay_write(const struct LDKPaymentRelay *NONNULL_PTR obj);
54372
54373 /**
54374  * Read a PaymentRelay from a byte array, created by PaymentRelay_write
54375  */
54376 struct LDKCResult_PaymentRelayDecodeErrorZ PaymentRelay_read(struct LDKu8slice ser);
54377
54378 /**
54379  * Serialize the PaymentConstraints object into a byte array which can be read by PaymentConstraints_read
54380  */
54381 struct LDKCVec_u8Z PaymentConstraints_write(const struct LDKPaymentConstraints *NONNULL_PTR obj);
54382
54383 /**
54384  * Read a PaymentConstraints from a byte array, created by PaymentConstraints_write
54385  */
54386 struct LDKCResult_PaymentConstraintsDecodeErrorZ PaymentConstraints_read(struct LDKu8slice ser);
54387
54388 /**
54389  * Serialize the PaymentContext object into a byte array which can be read by PaymentContext_read
54390  */
54391 struct LDKCVec_u8Z PaymentContext_write(const struct LDKPaymentContext *NONNULL_PTR obj);
54392
54393 /**
54394  * Read a PaymentContext from a byte array, created by PaymentContext_write
54395  */
54396 struct LDKCResult_PaymentContextDecodeErrorZ PaymentContext_read(struct LDKu8slice ser);
54397
54398 /**
54399  * Serialize the UnknownPaymentContext object into a byte array which can be read by UnknownPaymentContext_read
54400  */
54401 struct LDKCVec_u8Z UnknownPaymentContext_write(const struct LDKUnknownPaymentContext *NONNULL_PTR obj);
54402
54403 /**
54404  * Read a UnknownPaymentContext from a byte array, created by UnknownPaymentContext_write
54405  */
54406 struct LDKCResult_UnknownPaymentContextDecodeErrorZ UnknownPaymentContext_read(struct LDKu8slice ser);
54407
54408 /**
54409  * Serialize the Bolt12OfferContext object into a byte array which can be read by Bolt12OfferContext_read
54410  */
54411 struct LDKCVec_u8Z Bolt12OfferContext_write(const struct LDKBolt12OfferContext *NONNULL_PTR obj);
54412
54413 /**
54414  * Read a Bolt12OfferContext from a byte array, created by Bolt12OfferContext_write
54415  */
54416 struct LDKCResult_Bolt12OfferContextDecodeErrorZ Bolt12OfferContext_read(struct LDKu8slice ser);
54417
54418 /**
54419  * Serialize the Bolt12RefundContext object into a byte array which can be read by Bolt12RefundContext_read
54420  */
54421 struct LDKCVec_u8Z Bolt12RefundContext_write(const struct LDKBolt12RefundContext *NONNULL_PTR obj);
54422
54423 /**
54424  * Read a Bolt12RefundContext from a byte array, created by Bolt12RefundContext_write
54425  */
54426 struct LDKCResult_Bolt12RefundContextDecodeErrorZ Bolt12RefundContext_read(struct LDKu8slice ser);
54427
54428 /**
54429  * Frees any resources used by the PaymentPurpose
54430  */
54431 void PaymentPurpose_free(struct LDKPaymentPurpose this_ptr);
54432
54433 /**
54434  * Creates a copy of the PaymentPurpose
54435  */
54436 struct LDKPaymentPurpose PaymentPurpose_clone(const struct LDKPaymentPurpose *NONNULL_PTR orig);
54437
54438 /**
54439  * Utility method to constructs a new Bolt11InvoicePayment-variant PaymentPurpose
54440  */
54441 struct LDKPaymentPurpose PaymentPurpose_bolt11_invoice_payment(struct LDKCOption_ThirtyTwoBytesZ payment_preimage, struct LDKThirtyTwoBytes payment_secret);
54442
54443 /**
54444  * Utility method to constructs a new Bolt12OfferPayment-variant PaymentPurpose
54445  */
54446 struct LDKPaymentPurpose PaymentPurpose_bolt12_offer_payment(struct LDKCOption_ThirtyTwoBytesZ payment_preimage, struct LDKThirtyTwoBytes payment_secret, struct LDKBolt12OfferContext payment_context);
54447
54448 /**
54449  * Utility method to constructs a new Bolt12RefundPayment-variant PaymentPurpose
54450  */
54451 struct LDKPaymentPurpose PaymentPurpose_bolt12_refund_payment(struct LDKCOption_ThirtyTwoBytesZ payment_preimage, struct LDKThirtyTwoBytes payment_secret, struct LDKBolt12RefundContext payment_context);
54452
54453 /**
54454  * Utility method to constructs a new SpontaneousPayment-variant PaymentPurpose
54455  */
54456 struct LDKPaymentPurpose PaymentPurpose_spontaneous_payment(struct LDKThirtyTwoBytes a);
54457
54458 /**
54459  * Checks if two PaymentPurposes contain equal inner contents.
54460  * This ignores pointers and is_owned flags and looks at the values in fields.
54461  */
54462 bool PaymentPurpose_eq(const struct LDKPaymentPurpose *NONNULL_PTR a, const struct LDKPaymentPurpose *NONNULL_PTR b);
54463
54464 /**
54465  * Returns the preimage for this payment, if it is known.
54466  */
54467 MUST_USE_RES struct LDKCOption_ThirtyTwoBytesZ PaymentPurpose_preimage(const struct LDKPaymentPurpose *NONNULL_PTR this_arg);
54468
54469 /**
54470  * Serialize the PaymentPurpose object into a byte array which can be read by PaymentPurpose_read
54471  */
54472 struct LDKCVec_u8Z PaymentPurpose_write(const struct LDKPaymentPurpose *NONNULL_PTR obj);
54473
54474 /**
54475  * Read a PaymentPurpose from a byte array, created by PaymentPurpose_write
54476  */
54477 struct LDKCResult_PaymentPurposeDecodeErrorZ PaymentPurpose_read(struct LDKu8slice ser);
54478
54479 /**
54480  * Frees any resources used by the ClaimedHTLC, if is_owned is set and inner is non-NULL.
54481  */
54482 void ClaimedHTLC_free(struct LDKClaimedHTLC this_obj);
54483
54484 /**
54485  * The `channel_id` of the channel over which the HTLC was received.
54486  */
54487 struct LDKChannelId ClaimedHTLC_get_channel_id(const struct LDKClaimedHTLC *NONNULL_PTR this_ptr);
54488
54489 /**
54490  * The `channel_id` of the channel over which the HTLC was received.
54491  */
54492 void ClaimedHTLC_set_channel_id(struct LDKClaimedHTLC *NONNULL_PTR this_ptr, struct LDKChannelId val);
54493
54494 /**
54495  * The `user_channel_id` of the channel over which the HTLC was received. This is the value
54496  * passed in to [`ChannelManager::create_channel`] for outbound channels, or to
54497  * [`ChannelManager::accept_inbound_channel`] for inbound channels if
54498  * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise
54499  * `user_channel_id` will be randomized for an inbound channel.
54500  *
54501  * This field will be zero for a payment that was serialized prior to LDK version 0.0.117. (This
54502  * should only happen in the case that a payment was claimable prior to LDK version 0.0.117, but
54503  * was not actually claimed until after upgrading.)
54504  *
54505  * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
54506  * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
54507  * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
54508  */
54509 struct LDKU128 ClaimedHTLC_get_user_channel_id(const struct LDKClaimedHTLC *NONNULL_PTR this_ptr);
54510
54511 /**
54512  * The `user_channel_id` of the channel over which the HTLC was received. This is the value
54513  * passed in to [`ChannelManager::create_channel`] for outbound channels, or to
54514  * [`ChannelManager::accept_inbound_channel`] for inbound channels if
54515  * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise
54516  * `user_channel_id` will be randomized for an inbound channel.
54517  *
54518  * This field will be zero for a payment that was serialized prior to LDK version 0.0.117. (This
54519  * should only happen in the case that a payment was claimable prior to LDK version 0.0.117, but
54520  * was not actually claimed until after upgrading.)
54521  *
54522  * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
54523  * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
54524  * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
54525  */
54526 void ClaimedHTLC_set_user_channel_id(struct LDKClaimedHTLC *NONNULL_PTR this_ptr, struct LDKU128 val);
54527
54528 /**
54529  * The block height at which this HTLC expires.
54530  */
54531 uint32_t ClaimedHTLC_get_cltv_expiry(const struct LDKClaimedHTLC *NONNULL_PTR this_ptr);
54532
54533 /**
54534  * The block height at which this HTLC expires.
54535  */
54536 void ClaimedHTLC_set_cltv_expiry(struct LDKClaimedHTLC *NONNULL_PTR this_ptr, uint32_t val);
54537
54538 /**
54539  * The amount (in msats) of this part of an MPP.
54540  */
54541 uint64_t ClaimedHTLC_get_value_msat(const struct LDKClaimedHTLC *NONNULL_PTR this_ptr);
54542
54543 /**
54544  * The amount (in msats) of this part of an MPP.
54545  */
54546 void ClaimedHTLC_set_value_msat(struct LDKClaimedHTLC *NONNULL_PTR this_ptr, uint64_t val);
54547
54548 /**
54549  * The extra fee our counterparty skimmed off the top of this HTLC, if any.
54550  *
54551  * This value will always be 0 for [`ClaimedHTLC`]s serialized with LDK versions prior to
54552  * 0.0.119.
54553  */
54554 uint64_t ClaimedHTLC_get_counterparty_skimmed_fee_msat(const struct LDKClaimedHTLC *NONNULL_PTR this_ptr);
54555
54556 /**
54557  * The extra fee our counterparty skimmed off the top of this HTLC, if any.
54558  *
54559  * This value will always be 0 for [`ClaimedHTLC`]s serialized with LDK versions prior to
54560  * 0.0.119.
54561  */
54562 void ClaimedHTLC_set_counterparty_skimmed_fee_msat(struct LDKClaimedHTLC *NONNULL_PTR this_ptr, uint64_t val);
54563
54564 /**
54565  * Constructs a new ClaimedHTLC given each field
54566  */
54567 MUST_USE_RES struct LDKClaimedHTLC ClaimedHTLC_new(struct LDKChannelId channel_id_arg, struct LDKU128 user_channel_id_arg, uint32_t cltv_expiry_arg, uint64_t value_msat_arg, uint64_t counterparty_skimmed_fee_msat_arg);
54568
54569 /**
54570  * Creates a copy of the ClaimedHTLC
54571  */
54572 struct LDKClaimedHTLC ClaimedHTLC_clone(const struct LDKClaimedHTLC *NONNULL_PTR orig);
54573
54574 /**
54575  * Checks if two ClaimedHTLCs contain equal inner contents.
54576  * This ignores pointers and is_owned flags and looks at the values in fields.
54577  * Two objects with NULL inner values will be considered "equal" here.
54578  */
54579 bool ClaimedHTLC_eq(const struct LDKClaimedHTLC *NONNULL_PTR a, const struct LDKClaimedHTLC *NONNULL_PTR b);
54580
54581 /**
54582  * Serialize the ClaimedHTLC object into a byte array which can be read by ClaimedHTLC_read
54583  */
54584 struct LDKCVec_u8Z ClaimedHTLC_write(const struct LDKClaimedHTLC *NONNULL_PTR obj);
54585
54586 /**
54587  * Read a ClaimedHTLC from a byte array, created by ClaimedHTLC_write
54588  */
54589 struct LDKCResult_ClaimedHTLCDecodeErrorZ ClaimedHTLC_read(struct LDKu8slice ser);
54590
54591 /**
54592  * Frees any resources used by the PathFailure
54593  */
54594 void PathFailure_free(struct LDKPathFailure this_ptr);
54595
54596 /**
54597  * Creates a copy of the PathFailure
54598  */
54599 struct LDKPathFailure PathFailure_clone(const struct LDKPathFailure *NONNULL_PTR orig);
54600
54601 /**
54602  * Utility method to constructs a new InitialSend-variant PathFailure
54603  */
54604 struct LDKPathFailure PathFailure_initial_send(struct LDKAPIError err);
54605
54606 /**
54607  * Utility method to constructs a new OnPath-variant PathFailure
54608  */
54609 struct LDKPathFailure PathFailure_on_path(struct LDKCOption_NetworkUpdateZ network_update);
54610
54611 /**
54612  * Checks if two PathFailures contain equal inner contents.
54613  * This ignores pointers and is_owned flags and looks at the values in fields.
54614  */
54615 bool PathFailure_eq(const struct LDKPathFailure *NONNULL_PTR a, const struct LDKPathFailure *NONNULL_PTR b);
54616
54617 /**
54618  * Serialize the PathFailure object into a byte array which can be read by PathFailure_read
54619  */
54620 struct LDKCVec_u8Z PathFailure_write(const struct LDKPathFailure *NONNULL_PTR obj);
54621
54622 /**
54623  * Read a PathFailure from a byte array, created by PathFailure_write
54624  */
54625 struct LDKCResult_COption_PathFailureZDecodeErrorZ PathFailure_read(struct LDKu8slice ser);
54626
54627 /**
54628  * Frees any resources used by the ClosureReason
54629  */
54630 void ClosureReason_free(struct LDKClosureReason this_ptr);
54631
54632 /**
54633  * Creates a copy of the ClosureReason
54634  */
54635 struct LDKClosureReason ClosureReason_clone(const struct LDKClosureReason *NONNULL_PTR orig);
54636
54637 /**
54638  * Utility method to constructs a new CounterpartyForceClosed-variant ClosureReason
54639  */
54640 struct LDKClosureReason ClosureReason_counterparty_force_closed(struct LDKUntrustedString peer_msg);
54641
54642 /**
54643  * Utility method to constructs a new HolderForceClosed-variant ClosureReason
54644  */
54645 struct LDKClosureReason ClosureReason_holder_force_closed(void);
54646
54647 /**
54648  * Utility method to constructs a new LegacyCooperativeClosure-variant ClosureReason
54649  */
54650 struct LDKClosureReason ClosureReason_legacy_cooperative_closure(void);
54651
54652 /**
54653  * Utility method to constructs a new CounterpartyInitiatedCooperativeClosure-variant ClosureReason
54654  */
54655 struct LDKClosureReason ClosureReason_counterparty_initiated_cooperative_closure(void);
54656
54657 /**
54658  * Utility method to constructs a new LocallyInitiatedCooperativeClosure-variant ClosureReason
54659  */
54660 struct LDKClosureReason ClosureReason_locally_initiated_cooperative_closure(void);
54661
54662 /**
54663  * Utility method to constructs a new CommitmentTxConfirmed-variant ClosureReason
54664  */
54665 struct LDKClosureReason ClosureReason_commitment_tx_confirmed(void);
54666
54667 /**
54668  * Utility method to constructs a new FundingTimedOut-variant ClosureReason
54669  */
54670 struct LDKClosureReason ClosureReason_funding_timed_out(void);
54671
54672 /**
54673  * Utility method to constructs a new ProcessingError-variant ClosureReason
54674  */
54675 struct LDKClosureReason ClosureReason_processing_error(struct LDKStr err);
54676
54677 /**
54678  * Utility method to constructs a new DisconnectedPeer-variant ClosureReason
54679  */
54680 struct LDKClosureReason ClosureReason_disconnected_peer(void);
54681
54682 /**
54683  * Utility method to constructs a new OutdatedChannelManager-variant ClosureReason
54684  */
54685 struct LDKClosureReason ClosureReason_outdated_channel_manager(void);
54686
54687 /**
54688  * Utility method to constructs a new CounterpartyCoopClosedUnfundedChannel-variant ClosureReason
54689  */
54690 struct LDKClosureReason ClosureReason_counterparty_coop_closed_unfunded_channel(void);
54691
54692 /**
54693  * Utility method to constructs a new FundingBatchClosure-variant ClosureReason
54694  */
54695 struct LDKClosureReason ClosureReason_funding_batch_closure(void);
54696
54697 /**
54698  * Utility method to constructs a new HTLCsTimedOut-variant ClosureReason
54699  */
54700 struct LDKClosureReason ClosureReason_htlcs_timed_out(void);
54701
54702 /**
54703  * Checks if two ClosureReasons contain equal inner contents.
54704  * This ignores pointers and is_owned flags and looks at the values in fields.
54705  */
54706 bool ClosureReason_eq(const struct LDKClosureReason *NONNULL_PTR a, const struct LDKClosureReason *NONNULL_PTR b);
54707
54708 /**
54709  * Serialize the ClosureReason object into a byte array which can be read by ClosureReason_read
54710  */
54711 struct LDKCVec_u8Z ClosureReason_write(const struct LDKClosureReason *NONNULL_PTR obj);
54712
54713 /**
54714  * Read a ClosureReason from a byte array, created by ClosureReason_write
54715  */
54716 struct LDKCResult_COption_ClosureReasonZDecodeErrorZ ClosureReason_read(struct LDKu8slice ser);
54717
54718 /**
54719  * Frees any resources used by the HTLCDestination
54720  */
54721 void HTLCDestination_free(struct LDKHTLCDestination this_ptr);
54722
54723 /**
54724  * Creates a copy of the HTLCDestination
54725  */
54726 struct LDKHTLCDestination HTLCDestination_clone(const struct LDKHTLCDestination *NONNULL_PTR orig);
54727
54728 /**
54729  * Utility method to constructs a new NextHopChannel-variant HTLCDestination
54730  */
54731 struct LDKHTLCDestination HTLCDestination_next_hop_channel(struct LDKPublicKey node_id, struct LDKChannelId channel_id);
54732
54733 /**
54734  * Utility method to constructs a new UnknownNextHop-variant HTLCDestination
54735  */
54736 struct LDKHTLCDestination HTLCDestination_unknown_next_hop(uint64_t requested_forward_scid);
54737
54738 /**
54739  * Utility method to constructs a new InvalidForward-variant HTLCDestination
54740  */
54741 struct LDKHTLCDestination HTLCDestination_invalid_forward(uint64_t requested_forward_scid);
54742
54743 /**
54744  * Utility method to constructs a new InvalidOnion-variant HTLCDestination
54745  */
54746 struct LDKHTLCDestination HTLCDestination_invalid_onion(void);
54747
54748 /**
54749  * Utility method to constructs a new FailedPayment-variant HTLCDestination
54750  */
54751 struct LDKHTLCDestination HTLCDestination_failed_payment(struct LDKThirtyTwoBytes payment_hash);
54752
54753 /**
54754  * Checks if two HTLCDestinations contain equal inner contents.
54755  * This ignores pointers and is_owned flags and looks at the values in fields.
54756  */
54757 bool HTLCDestination_eq(const struct LDKHTLCDestination *NONNULL_PTR a, const struct LDKHTLCDestination *NONNULL_PTR b);
54758
54759 /**
54760  * Serialize the HTLCDestination object into a byte array which can be read by HTLCDestination_read
54761  */
54762 struct LDKCVec_u8Z HTLCDestination_write(const struct LDKHTLCDestination *NONNULL_PTR obj);
54763
54764 /**
54765  * Read a HTLCDestination from a byte array, created by HTLCDestination_write
54766  */
54767 struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ HTLCDestination_read(struct LDKu8slice ser);
54768
54769 /**
54770  * Creates a copy of the PaymentFailureReason
54771  */
54772 enum LDKPaymentFailureReason PaymentFailureReason_clone(const enum LDKPaymentFailureReason *NONNULL_PTR orig);
54773
54774 /**
54775  * Utility method to constructs a new RecipientRejected-variant PaymentFailureReason
54776  */
54777 enum LDKPaymentFailureReason PaymentFailureReason_recipient_rejected(void);
54778
54779 /**
54780  * Utility method to constructs a new UserAbandoned-variant PaymentFailureReason
54781  */
54782 enum LDKPaymentFailureReason PaymentFailureReason_user_abandoned(void);
54783
54784 /**
54785  * Utility method to constructs a new RetriesExhausted-variant PaymentFailureReason
54786  */
54787 enum LDKPaymentFailureReason PaymentFailureReason_retries_exhausted(void);
54788
54789 /**
54790  * Utility method to constructs a new PaymentExpired-variant PaymentFailureReason
54791  */
54792 enum LDKPaymentFailureReason PaymentFailureReason_payment_expired(void);
54793
54794 /**
54795  * Utility method to constructs a new RouteNotFound-variant PaymentFailureReason
54796  */
54797 enum LDKPaymentFailureReason PaymentFailureReason_route_not_found(void);
54798
54799 /**
54800  * Utility method to constructs a new UnexpectedError-variant PaymentFailureReason
54801  */
54802 enum LDKPaymentFailureReason PaymentFailureReason_unexpected_error(void);
54803
54804 /**
54805  * Checks if two PaymentFailureReasons contain equal inner contents.
54806  * This ignores pointers and is_owned flags and looks at the values in fields.
54807  */
54808 bool PaymentFailureReason_eq(const enum LDKPaymentFailureReason *NONNULL_PTR a, const enum LDKPaymentFailureReason *NONNULL_PTR b);
54809
54810 /**
54811  * Serialize the PaymentFailureReason object into a byte array which can be read by PaymentFailureReason_read
54812  */
54813 struct LDKCVec_u8Z PaymentFailureReason_write(const enum LDKPaymentFailureReason *NONNULL_PTR obj);
54814
54815 /**
54816  * Read a PaymentFailureReason from a byte array, created by PaymentFailureReason_write
54817  */
54818 struct LDKCResult_PaymentFailureReasonDecodeErrorZ PaymentFailureReason_read(struct LDKu8slice ser);
54819
54820 /**
54821  * Frees any resources used by the Event
54822  */
54823 void Event_free(struct LDKEvent this_ptr);
54824
54825 /**
54826  * Creates a copy of the Event
54827  */
54828 struct LDKEvent Event_clone(const struct LDKEvent *NONNULL_PTR orig);
54829
54830 /**
54831  * Utility method to constructs a new FundingGenerationReady-variant Event
54832  */
54833 struct LDKEvent Event_funding_generation_ready(struct LDKChannelId temporary_channel_id, struct LDKPublicKey counterparty_node_id, uint64_t channel_value_satoshis, struct LDKCVec_u8Z output_script, struct LDKU128 user_channel_id);
54834
54835 /**
54836  * Utility method to constructs a new PaymentClaimable-variant Event
54837  */
54838 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 LDKChannelId via_channel_id, struct LDKCOption_U128Z via_user_channel_id, struct LDKCOption_u32Z claim_deadline);
54839
54840 /**
54841  * Utility method to constructs a new PaymentClaimed-variant Event
54842  */
54843 struct LDKEvent Event_payment_claimed(struct LDKPublicKey receiver_node_id, struct LDKThirtyTwoBytes payment_hash, uint64_t amount_msat, struct LDKPaymentPurpose purpose, struct LDKCVec_ClaimedHTLCZ htlcs, struct LDKCOption_u64Z sender_intended_total_msat);
54844
54845 /**
54846  * Utility method to constructs a new ConnectionNeeded-variant Event
54847  */
54848 struct LDKEvent Event_connection_needed(struct LDKPublicKey node_id, struct LDKCVec_SocketAddressZ addresses);
54849
54850 /**
54851  * Utility method to constructs a new InvoiceRequestFailed-variant Event
54852  */
54853 struct LDKEvent Event_invoice_request_failed(struct LDKThirtyTwoBytes payment_id);
54854
54855 /**
54856  * Utility method to constructs a new PaymentSent-variant Event
54857  */
54858 struct LDKEvent Event_payment_sent(struct LDKCOption_ThirtyTwoBytesZ payment_id, struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_hash, struct LDKCOption_u64Z fee_paid_msat);
54859
54860 /**
54861  * Utility method to constructs a new PaymentFailed-variant Event
54862  */
54863 struct LDKEvent Event_payment_failed(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, struct LDKCOption_PaymentFailureReasonZ reason);
54864
54865 /**
54866  * Utility method to constructs a new PaymentPathSuccessful-variant Event
54867  */
54868 struct LDKEvent Event_payment_path_successful(struct LDKThirtyTwoBytes payment_id, struct LDKCOption_ThirtyTwoBytesZ payment_hash, struct LDKPath path);
54869
54870 /**
54871  * Utility method to constructs a new PaymentPathFailed-variant Event
54872  */
54873 struct LDKEvent Event_payment_path_failed(struct LDKCOption_ThirtyTwoBytesZ payment_id, struct LDKThirtyTwoBytes payment_hash, bool payment_failed_permanently, struct LDKPathFailure failure, struct LDKPath path, struct LDKCOption_u64Z short_channel_id);
54874
54875 /**
54876  * Utility method to constructs a new ProbeSuccessful-variant Event
54877  */
54878 struct LDKEvent Event_probe_successful(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, struct LDKPath path);
54879
54880 /**
54881  * Utility method to constructs a new ProbeFailed-variant Event
54882  */
54883 struct LDKEvent Event_probe_failed(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, struct LDKPath path, struct LDKCOption_u64Z short_channel_id);
54884
54885 /**
54886  * Utility method to constructs a new PendingHTLCsForwardable-variant Event
54887  */
54888 struct LDKEvent Event_pending_htlcs_forwardable(uint64_t time_forwardable);
54889
54890 /**
54891  * Utility method to constructs a new HTLCIntercepted-variant Event
54892  */
54893 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);
54894
54895 /**
54896  * Utility method to constructs a new SpendableOutputs-variant Event
54897  */
54898 struct LDKEvent Event_spendable_outputs(struct LDKCVec_SpendableOutputDescriptorZ outputs, struct LDKChannelId channel_id);
54899
54900 /**
54901  * Utility method to constructs a new PaymentForwarded-variant Event
54902  */
54903 struct LDKEvent Event_payment_forwarded(struct LDKChannelId prev_channel_id, struct LDKChannelId next_channel_id, struct LDKCOption_U128Z prev_user_channel_id, struct LDKCOption_U128Z next_user_channel_id, struct LDKCOption_u64Z total_fee_earned_msat, struct LDKCOption_u64Z skimmed_fee_msat, bool claim_from_onchain_tx, struct LDKCOption_u64Z outbound_amount_forwarded_msat);
54904
54905 /**
54906  * Utility method to constructs a new ChannelPending-variant Event
54907  */
54908 struct LDKEvent Event_channel_pending(struct LDKChannelId channel_id, struct LDKU128 user_channel_id, struct LDKChannelId former_temporary_channel_id, struct LDKPublicKey counterparty_node_id, struct LDKOutPoint funding_txo, struct LDKChannelTypeFeatures channel_type);
54909
54910 /**
54911  * Utility method to constructs a new ChannelReady-variant Event
54912  */
54913 struct LDKEvent Event_channel_ready(struct LDKChannelId channel_id, struct LDKU128 user_channel_id, struct LDKPublicKey counterparty_node_id, struct LDKChannelTypeFeatures channel_type);
54914
54915 /**
54916  * Utility method to constructs a new ChannelClosed-variant Event
54917  */
54918 struct LDKEvent Event_channel_closed(struct LDKChannelId channel_id, struct LDKU128 user_channel_id, struct LDKClosureReason reason, struct LDKPublicKey counterparty_node_id, struct LDKCOption_u64Z channel_capacity_sats, struct LDKOutPoint channel_funding_txo);
54919
54920 /**
54921  * Utility method to constructs a new DiscardFunding-variant Event
54922  */
54923 struct LDKEvent Event_discard_funding(struct LDKChannelId channel_id, struct LDKTransaction transaction);
54924
54925 /**
54926  * Utility method to constructs a new OpenChannelRequest-variant Event
54927  */
54928 struct LDKEvent Event_open_channel_request(struct LDKChannelId temporary_channel_id, struct LDKPublicKey counterparty_node_id, uint64_t funding_satoshis, uint64_t push_msat, struct LDKChannelTypeFeatures channel_type);
54929
54930 /**
54931  * Utility method to constructs a new HTLCHandlingFailed-variant Event
54932  */
54933 struct LDKEvent Event_htlchandling_failed(struct LDKChannelId prev_channel_id, struct LDKHTLCDestination failed_next_destination);
54934
54935 /**
54936  * Utility method to constructs a new BumpTransaction-variant Event
54937  */
54938 struct LDKEvent Event_bump_transaction(struct LDKBumpTransactionEvent a);
54939
54940 /**
54941  * Checks if two Events contain equal inner contents.
54942  * This ignores pointers and is_owned flags and looks at the values in fields.
54943  */
54944 bool Event_eq(const struct LDKEvent *NONNULL_PTR a, const struct LDKEvent *NONNULL_PTR b);
54945
54946 /**
54947  * Serialize the Event object into a byte array which can be read by Event_read
54948  */
54949 struct LDKCVec_u8Z Event_write(const struct LDKEvent *NONNULL_PTR obj);
54950
54951 /**
54952  * Read a Event from a byte array, created by Event_write
54953  */
54954 struct LDKCResult_COption_EventZDecodeErrorZ Event_read(struct LDKu8slice ser);
54955
54956 /**
54957  * Frees any resources used by the MessageSendEvent
54958  */
54959 void MessageSendEvent_free(struct LDKMessageSendEvent this_ptr);
54960
54961 /**
54962  * Creates a copy of the MessageSendEvent
54963  */
54964 struct LDKMessageSendEvent MessageSendEvent_clone(const struct LDKMessageSendEvent *NONNULL_PTR orig);
54965
54966 /**
54967  * Utility method to constructs a new SendAcceptChannel-variant MessageSendEvent
54968  */
54969 struct LDKMessageSendEvent MessageSendEvent_send_accept_channel(struct LDKPublicKey node_id, struct LDKAcceptChannel msg);
54970
54971 /**
54972  * Utility method to constructs a new SendAcceptChannelV2-variant MessageSendEvent
54973  */
54974 struct LDKMessageSendEvent MessageSendEvent_send_accept_channel_v2(struct LDKPublicKey node_id, struct LDKAcceptChannelV2 msg);
54975
54976 /**
54977  * Utility method to constructs a new SendOpenChannel-variant MessageSendEvent
54978  */
54979 struct LDKMessageSendEvent MessageSendEvent_send_open_channel(struct LDKPublicKey node_id, struct LDKOpenChannel msg);
54980
54981 /**
54982  * Utility method to constructs a new SendOpenChannelV2-variant MessageSendEvent
54983  */
54984 struct LDKMessageSendEvent MessageSendEvent_send_open_channel_v2(struct LDKPublicKey node_id, struct LDKOpenChannelV2 msg);
54985
54986 /**
54987  * Utility method to constructs a new SendFundingCreated-variant MessageSendEvent
54988  */
54989 struct LDKMessageSendEvent MessageSendEvent_send_funding_created(struct LDKPublicKey node_id, struct LDKFundingCreated msg);
54990
54991 /**
54992  * Utility method to constructs a new SendFundingSigned-variant MessageSendEvent
54993  */
54994 struct LDKMessageSendEvent MessageSendEvent_send_funding_signed(struct LDKPublicKey node_id, struct LDKFundingSigned msg);
54995
54996 /**
54997  * Utility method to constructs a new SendStfu-variant MessageSendEvent
54998  */
54999 struct LDKMessageSendEvent MessageSendEvent_send_stfu(struct LDKPublicKey node_id, struct LDKStfu msg);
55000
55001 /**
55002  * Utility method to constructs a new SendSplice-variant MessageSendEvent
55003  */
55004 struct LDKMessageSendEvent MessageSendEvent_send_splice(struct LDKPublicKey node_id, struct LDKSplice msg);
55005
55006 /**
55007  * Utility method to constructs a new SendSpliceAck-variant MessageSendEvent
55008  */
55009 struct LDKMessageSendEvent MessageSendEvent_send_splice_ack(struct LDKPublicKey node_id, struct LDKSpliceAck msg);
55010
55011 /**
55012  * Utility method to constructs a new SendSpliceLocked-variant MessageSendEvent
55013  */
55014 struct LDKMessageSendEvent MessageSendEvent_send_splice_locked(struct LDKPublicKey node_id, struct LDKSpliceLocked msg);
55015
55016 /**
55017  * Utility method to constructs a new SendTxAddInput-variant MessageSendEvent
55018  */
55019 struct LDKMessageSendEvent MessageSendEvent_send_tx_add_input(struct LDKPublicKey node_id, struct LDKTxAddInput msg);
55020
55021 /**
55022  * Utility method to constructs a new SendTxAddOutput-variant MessageSendEvent
55023  */
55024 struct LDKMessageSendEvent MessageSendEvent_send_tx_add_output(struct LDKPublicKey node_id, struct LDKTxAddOutput msg);
55025
55026 /**
55027  * Utility method to constructs a new SendTxRemoveInput-variant MessageSendEvent
55028  */
55029 struct LDKMessageSendEvent MessageSendEvent_send_tx_remove_input(struct LDKPublicKey node_id, struct LDKTxRemoveInput msg);
55030
55031 /**
55032  * Utility method to constructs a new SendTxRemoveOutput-variant MessageSendEvent
55033  */
55034 struct LDKMessageSendEvent MessageSendEvent_send_tx_remove_output(struct LDKPublicKey node_id, struct LDKTxRemoveOutput msg);
55035
55036 /**
55037  * Utility method to constructs a new SendTxComplete-variant MessageSendEvent
55038  */
55039 struct LDKMessageSendEvent MessageSendEvent_send_tx_complete(struct LDKPublicKey node_id, struct LDKTxComplete msg);
55040
55041 /**
55042  * Utility method to constructs a new SendTxSignatures-variant MessageSendEvent
55043  */
55044 struct LDKMessageSendEvent MessageSendEvent_send_tx_signatures(struct LDKPublicKey node_id, struct LDKTxSignatures msg);
55045
55046 /**
55047  * Utility method to constructs a new SendTxInitRbf-variant MessageSendEvent
55048  */
55049 struct LDKMessageSendEvent MessageSendEvent_send_tx_init_rbf(struct LDKPublicKey node_id, struct LDKTxInitRbf msg);
55050
55051 /**
55052  * Utility method to constructs a new SendTxAckRbf-variant MessageSendEvent
55053  */
55054 struct LDKMessageSendEvent MessageSendEvent_send_tx_ack_rbf(struct LDKPublicKey node_id, struct LDKTxAckRbf msg);
55055
55056 /**
55057  * Utility method to constructs a new SendTxAbort-variant MessageSendEvent
55058  */
55059 struct LDKMessageSendEvent MessageSendEvent_send_tx_abort(struct LDKPublicKey node_id, struct LDKTxAbort msg);
55060
55061 /**
55062  * Utility method to constructs a new SendChannelReady-variant MessageSendEvent
55063  */
55064 struct LDKMessageSendEvent MessageSendEvent_send_channel_ready(struct LDKPublicKey node_id, struct LDKChannelReady msg);
55065
55066 /**
55067  * Utility method to constructs a new SendAnnouncementSignatures-variant MessageSendEvent
55068  */
55069 struct LDKMessageSendEvent MessageSendEvent_send_announcement_signatures(struct LDKPublicKey node_id, struct LDKAnnouncementSignatures msg);
55070
55071 /**
55072  * Utility method to constructs a new UpdateHTLCs-variant MessageSendEvent
55073  */
55074 struct LDKMessageSendEvent MessageSendEvent_update_htlcs(struct LDKPublicKey node_id, struct LDKCommitmentUpdate updates);
55075
55076 /**
55077  * Utility method to constructs a new SendRevokeAndACK-variant MessageSendEvent
55078  */
55079 struct LDKMessageSendEvent MessageSendEvent_send_revoke_and_ack(struct LDKPublicKey node_id, struct LDKRevokeAndACK msg);
55080
55081 /**
55082  * Utility method to constructs a new SendClosingSigned-variant MessageSendEvent
55083  */
55084 struct LDKMessageSendEvent MessageSendEvent_send_closing_signed(struct LDKPublicKey node_id, struct LDKClosingSigned msg);
55085
55086 /**
55087  * Utility method to constructs a new SendShutdown-variant MessageSendEvent
55088  */
55089 struct LDKMessageSendEvent MessageSendEvent_send_shutdown(struct LDKPublicKey node_id, struct LDKShutdown msg);
55090
55091 /**
55092  * Utility method to constructs a new SendChannelReestablish-variant MessageSendEvent
55093  */
55094 struct LDKMessageSendEvent MessageSendEvent_send_channel_reestablish(struct LDKPublicKey node_id, struct LDKChannelReestablish msg);
55095
55096 /**
55097  * Utility method to constructs a new SendChannelAnnouncement-variant MessageSendEvent
55098  */
55099 struct LDKMessageSendEvent MessageSendEvent_send_channel_announcement(struct LDKPublicKey node_id, struct LDKChannelAnnouncement msg, struct LDKChannelUpdate update_msg);
55100
55101 /**
55102  * Utility method to constructs a new BroadcastChannelAnnouncement-variant MessageSendEvent
55103  */
55104 struct LDKMessageSendEvent MessageSendEvent_broadcast_channel_announcement(struct LDKChannelAnnouncement msg, struct LDKChannelUpdate update_msg);
55105
55106 /**
55107  * Utility method to constructs a new BroadcastChannelUpdate-variant MessageSendEvent
55108  */
55109 struct LDKMessageSendEvent MessageSendEvent_broadcast_channel_update(struct LDKChannelUpdate msg);
55110
55111 /**
55112  * Utility method to constructs a new BroadcastNodeAnnouncement-variant MessageSendEvent
55113  */
55114 struct LDKMessageSendEvent MessageSendEvent_broadcast_node_announcement(struct LDKNodeAnnouncement msg);
55115
55116 /**
55117  * Utility method to constructs a new SendChannelUpdate-variant MessageSendEvent
55118  */
55119 struct LDKMessageSendEvent MessageSendEvent_send_channel_update(struct LDKPublicKey node_id, struct LDKChannelUpdate msg);
55120
55121 /**
55122  * Utility method to constructs a new HandleError-variant MessageSendEvent
55123  */
55124 struct LDKMessageSendEvent MessageSendEvent_handle_error(struct LDKPublicKey node_id, struct LDKErrorAction action);
55125
55126 /**
55127  * Utility method to constructs a new SendChannelRangeQuery-variant MessageSendEvent
55128  */
55129 struct LDKMessageSendEvent MessageSendEvent_send_channel_range_query(struct LDKPublicKey node_id, struct LDKQueryChannelRange msg);
55130
55131 /**
55132  * Utility method to constructs a new SendShortIdsQuery-variant MessageSendEvent
55133  */
55134 struct LDKMessageSendEvent MessageSendEvent_send_short_ids_query(struct LDKPublicKey node_id, struct LDKQueryShortChannelIds msg);
55135
55136 /**
55137  * Utility method to constructs a new SendReplyChannelRange-variant MessageSendEvent
55138  */
55139 struct LDKMessageSendEvent MessageSendEvent_send_reply_channel_range(struct LDKPublicKey node_id, struct LDKReplyChannelRange msg);
55140
55141 /**
55142  * Utility method to constructs a new SendGossipTimestampFilter-variant MessageSendEvent
55143  */
55144 struct LDKMessageSendEvent MessageSendEvent_send_gossip_timestamp_filter(struct LDKPublicKey node_id, struct LDKGossipTimestampFilter msg);
55145
55146 /**
55147  * Calls the free function if one is set
55148  */
55149 void MessageSendEventsProvider_free(struct LDKMessageSendEventsProvider this_ptr);
55150
55151 /**
55152  * Calls the free function if one is set
55153  */
55154 void EventsProvider_free(struct LDKEventsProvider this_ptr);
55155
55156 /**
55157  * Calls the free function if one is set
55158  */
55159 void EventHandler_free(struct LDKEventHandler this_ptr);
55160
55161 /**
55162  * Frees any resources used by the AnchorDescriptor, if is_owned is set and inner is non-NULL.
55163  */
55164 void AnchorDescriptor_free(struct LDKAnchorDescriptor this_obj);
55165
55166 /**
55167  * The parameters required to derive the signer for the anchor input.
55168  */
55169 struct LDKChannelDerivationParameters AnchorDescriptor_get_channel_derivation_parameters(const struct LDKAnchorDescriptor *NONNULL_PTR this_ptr);
55170
55171 /**
55172  * The parameters required to derive the signer for the anchor input.
55173  */
55174 void AnchorDescriptor_set_channel_derivation_parameters(struct LDKAnchorDescriptor *NONNULL_PTR this_ptr, struct LDKChannelDerivationParameters val);
55175
55176 /**
55177  * The transaction input's outpoint corresponding to the commitment transaction's anchor
55178  * output.
55179  */
55180 struct LDKOutPoint AnchorDescriptor_get_outpoint(const struct LDKAnchorDescriptor *NONNULL_PTR this_ptr);
55181
55182 /**
55183  * The transaction input's outpoint corresponding to the commitment transaction's anchor
55184  * output.
55185  */
55186 void AnchorDescriptor_set_outpoint(struct LDKAnchorDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val);
55187
55188 /**
55189  * Constructs a new AnchorDescriptor given each field
55190  */
55191 MUST_USE_RES struct LDKAnchorDescriptor AnchorDescriptor_new(struct LDKChannelDerivationParameters channel_derivation_parameters_arg, struct LDKOutPoint outpoint_arg);
55192
55193 /**
55194  * Creates a copy of the AnchorDescriptor
55195  */
55196 struct LDKAnchorDescriptor AnchorDescriptor_clone(const struct LDKAnchorDescriptor *NONNULL_PTR orig);
55197
55198 /**
55199  * Checks if two AnchorDescriptors contain equal inner contents.
55200  * This ignores pointers and is_owned flags and looks at the values in fields.
55201  * Two objects with NULL inner values will be considered "equal" here.
55202  */
55203 bool AnchorDescriptor_eq(const struct LDKAnchorDescriptor *NONNULL_PTR a, const struct LDKAnchorDescriptor *NONNULL_PTR b);
55204
55205 /**
55206  * Returns the UTXO to be spent by the anchor input, which can be obtained via
55207  * [`Self::unsigned_tx_input`].
55208  */
55209 MUST_USE_RES struct LDKTxOut AnchorDescriptor_previous_utxo(const struct LDKAnchorDescriptor *NONNULL_PTR this_arg);
55210
55211 /**
55212  * Returns the unsigned transaction input spending the anchor output in the commitment
55213  * transaction.
55214  */
55215 MUST_USE_RES struct LDKTxIn AnchorDescriptor_unsigned_tx_input(const struct LDKAnchorDescriptor *NONNULL_PTR this_arg);
55216
55217 /**
55218  * Returns the witness script of the anchor output in the commitment transaction.
55219  */
55220 MUST_USE_RES struct LDKCVec_u8Z AnchorDescriptor_witness_script(const struct LDKAnchorDescriptor *NONNULL_PTR this_arg);
55221
55222 /**
55223  * Returns the fully signed witness required to spend the anchor output in the commitment
55224  * transaction.
55225  */
55226 MUST_USE_RES struct LDKWitness AnchorDescriptor_tx_input_witness(const struct LDKAnchorDescriptor *NONNULL_PTR this_arg, struct LDKECDSASignature signature);
55227
55228 /**
55229  * Derives the channel signer required to sign the anchor input.
55230  */
55231 MUST_USE_RES struct LDKWriteableEcdsaChannelSigner AnchorDescriptor_derive_channel_signer(const struct LDKAnchorDescriptor *NONNULL_PTR this_arg, const struct LDKSignerProvider *NONNULL_PTR signer_provider);
55232
55233 /**
55234  * Frees any resources used by the BumpTransactionEvent
55235  */
55236 void BumpTransactionEvent_free(struct LDKBumpTransactionEvent this_ptr);
55237
55238 /**
55239  * Creates a copy of the BumpTransactionEvent
55240  */
55241 struct LDKBumpTransactionEvent BumpTransactionEvent_clone(const struct LDKBumpTransactionEvent *NONNULL_PTR orig);
55242
55243 /**
55244  * Utility method to constructs a new ChannelClose-variant BumpTransactionEvent
55245  */
55246 struct LDKBumpTransactionEvent BumpTransactionEvent_channel_close(struct LDKChannelId channel_id, struct LDKPublicKey counterparty_node_id, 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);
55247
55248 /**
55249  * Utility method to constructs a new HTLCResolution-variant BumpTransactionEvent
55250  */
55251 struct LDKBumpTransactionEvent BumpTransactionEvent_htlcresolution(struct LDKChannelId channel_id, struct LDKPublicKey counterparty_node_id, struct LDKThirtyTwoBytes claim_id, uint32_t target_feerate_sat_per_1000_weight, struct LDKCVec_HTLCDescriptorZ htlc_descriptors, uint32_t tx_lock_time);
55252
55253 /**
55254  * Checks if two BumpTransactionEvents contain equal inner contents.
55255  * This ignores pointers and is_owned flags and looks at the values in fields.
55256  */
55257 bool BumpTransactionEvent_eq(const struct LDKBumpTransactionEvent *NONNULL_PTR a, const struct LDKBumpTransactionEvent *NONNULL_PTR b);
55258
55259 /**
55260  * Frees any resources used by the Input, if is_owned is set and inner is non-NULL.
55261  */
55262 void Input_free(struct LDKInput this_obj);
55263
55264 /**
55265  * The unique identifier of the input.
55266  */
55267 struct LDKOutPoint Input_get_outpoint(const struct LDKInput *NONNULL_PTR this_ptr);
55268
55269 /**
55270  * The unique identifier of the input.
55271  */
55272 void Input_set_outpoint(struct LDKInput *NONNULL_PTR this_ptr, struct LDKOutPoint val);
55273
55274 /**
55275  * The UTXO being spent by the input.
55276  */
55277 struct LDKTxOut Input_get_previous_utxo(const struct LDKInput *NONNULL_PTR this_ptr);
55278
55279 /**
55280  * The UTXO being spent by the input.
55281  */
55282 void Input_set_previous_utxo(struct LDKInput *NONNULL_PTR this_ptr, struct LDKTxOut val);
55283
55284 /**
55285  * The upper-bound weight consumed by the input's full [`TxIn::script_sig`] and
55286  * [`TxIn::witness`], each with their lengths included, required to satisfy the output's
55287  * script.
55288  */
55289 uint64_t Input_get_satisfaction_weight(const struct LDKInput *NONNULL_PTR this_ptr);
55290
55291 /**
55292  * The upper-bound weight consumed by the input's full [`TxIn::script_sig`] and
55293  * [`TxIn::witness`], each with their lengths included, required to satisfy the output's
55294  * script.
55295  */
55296 void Input_set_satisfaction_weight(struct LDKInput *NONNULL_PTR this_ptr, uint64_t val);
55297
55298 /**
55299  * Constructs a new Input given each field
55300  */
55301 MUST_USE_RES struct LDKInput Input_new(struct LDKOutPoint outpoint_arg, struct LDKTxOut previous_utxo_arg, uint64_t satisfaction_weight_arg);
55302
55303 /**
55304  * Creates a copy of the Input
55305  */
55306 struct LDKInput Input_clone(const struct LDKInput *NONNULL_PTR orig);
55307
55308 /**
55309  * Generates a non-cryptographic 64-bit hash of the Input.
55310  */
55311 uint64_t Input_hash(const struct LDKInput *NONNULL_PTR o);
55312
55313 /**
55314  * Checks if two Inputs contain equal inner contents.
55315  * This ignores pointers and is_owned flags and looks at the values in fields.
55316  * Two objects with NULL inner values will be considered "equal" here.
55317  */
55318 bool Input_eq(const struct LDKInput *NONNULL_PTR a, const struct LDKInput *NONNULL_PTR b);
55319
55320 /**
55321  * Frees any resources used by the Utxo, if is_owned is set and inner is non-NULL.
55322  */
55323 void Utxo_free(struct LDKUtxo this_obj);
55324
55325 /**
55326  * The unique identifier of the output.
55327  */
55328 struct LDKOutPoint Utxo_get_outpoint(const struct LDKUtxo *NONNULL_PTR this_ptr);
55329
55330 /**
55331  * The unique identifier of the output.
55332  */
55333 void Utxo_set_outpoint(struct LDKUtxo *NONNULL_PTR this_ptr, struct LDKOutPoint val);
55334
55335 /**
55336  * The output to spend.
55337  */
55338 struct LDKTxOut Utxo_get_output(const struct LDKUtxo *NONNULL_PTR this_ptr);
55339
55340 /**
55341  * The output to spend.
55342  */
55343 void Utxo_set_output(struct LDKUtxo *NONNULL_PTR this_ptr, struct LDKTxOut val);
55344
55345 /**
55346  * The upper-bound weight consumed by the input's full [`TxIn::script_sig`] and [`TxIn::witness`], each
55347  * with their lengths included, required to satisfy the output's script. The weight consumed by
55348  * the input's `script_sig` must account for [`WITNESS_SCALE_FACTOR`].
55349  */
55350 uint64_t Utxo_get_satisfaction_weight(const struct LDKUtxo *NONNULL_PTR this_ptr);
55351
55352 /**
55353  * The upper-bound weight consumed by the input's full [`TxIn::script_sig`] and [`TxIn::witness`], each
55354  * with their lengths included, required to satisfy the output's script. The weight consumed by
55355  * the input's `script_sig` must account for [`WITNESS_SCALE_FACTOR`].
55356  */
55357 void Utxo_set_satisfaction_weight(struct LDKUtxo *NONNULL_PTR this_ptr, uint64_t val);
55358
55359 /**
55360  * Constructs a new Utxo given each field
55361  */
55362 MUST_USE_RES struct LDKUtxo Utxo_new(struct LDKOutPoint outpoint_arg, struct LDKTxOut output_arg, uint64_t satisfaction_weight_arg);
55363
55364 /**
55365  * Creates a copy of the Utxo
55366  */
55367 struct LDKUtxo Utxo_clone(const struct LDKUtxo *NONNULL_PTR orig);
55368
55369 /**
55370  * Generates a non-cryptographic 64-bit hash of the Utxo.
55371  */
55372 uint64_t Utxo_hash(const struct LDKUtxo *NONNULL_PTR o);
55373
55374 /**
55375  * Checks if two Utxos contain equal inner contents.
55376  * This ignores pointers and is_owned flags and looks at the values in fields.
55377  * Two objects with NULL inner values will be considered "equal" here.
55378  */
55379 bool Utxo_eq(const struct LDKUtxo *NONNULL_PTR a, const struct LDKUtxo *NONNULL_PTR b);
55380
55381 /**
55382  * Returns a `Utxo` with the `satisfaction_weight` estimate for a legacy P2PKH output.
55383  */
55384 MUST_USE_RES struct LDKUtxo Utxo_new_p2pkh(struct LDKOutPoint outpoint, uint64_t value, const uint8_t (*pubkey_hash)[20]);
55385
55386 /**
55387  * Frees any resources used by the CoinSelection, if is_owned is set and inner is non-NULL.
55388  */
55389 void CoinSelection_free(struct LDKCoinSelection this_obj);
55390
55391 /**
55392  * The set of UTXOs (with at least 1 confirmation) to spend and use within a transaction
55393  * requiring additional fees.
55394  */
55395 struct LDKCVec_UtxoZ CoinSelection_get_confirmed_utxos(const struct LDKCoinSelection *NONNULL_PTR this_ptr);
55396
55397 /**
55398  * The set of UTXOs (with at least 1 confirmation) to spend and use within a transaction
55399  * requiring additional fees.
55400  */
55401 void CoinSelection_set_confirmed_utxos(struct LDKCoinSelection *NONNULL_PTR this_ptr, struct LDKCVec_UtxoZ val);
55402
55403 /**
55404  * An additional output tracking whether any change remained after coin selection. This output
55405  * should always have a value above dust for its given `script_pubkey`. It should not be
55406  * spent until the transaction it belongs to confirms to ensure mempool descendant limits are
55407  * not met. This implies no other party should be able to spend it except us.
55408  */
55409 struct LDKCOption_TxOutZ CoinSelection_get_change_output(const struct LDKCoinSelection *NONNULL_PTR this_ptr);
55410
55411 /**
55412  * An additional output tracking whether any change remained after coin selection. This output
55413  * should always have a value above dust for its given `script_pubkey`. It should not be
55414  * spent until the transaction it belongs to confirms to ensure mempool descendant limits are
55415  * not met. This implies no other party should be able to spend it except us.
55416  */
55417 void CoinSelection_set_change_output(struct LDKCoinSelection *NONNULL_PTR this_ptr, struct LDKCOption_TxOutZ val);
55418
55419 /**
55420  * Constructs a new CoinSelection given each field
55421  */
55422 MUST_USE_RES struct LDKCoinSelection CoinSelection_new(struct LDKCVec_UtxoZ confirmed_utxos_arg, struct LDKCOption_TxOutZ change_output_arg);
55423
55424 /**
55425  * Creates a copy of the CoinSelection
55426  */
55427 struct LDKCoinSelection CoinSelection_clone(const struct LDKCoinSelection *NONNULL_PTR orig);
55428
55429 /**
55430  * Calls the free function if one is set
55431  */
55432 void CoinSelectionSource_free(struct LDKCoinSelectionSource this_ptr);
55433
55434 /**
55435  * Calls the free function if one is set
55436  */
55437 void WalletSource_free(struct LDKWalletSource this_ptr);
55438
55439 /**
55440  * Frees any resources used by the Wallet, if is_owned is set and inner is non-NULL.
55441  */
55442 void Wallet_free(struct LDKWallet this_obj);
55443
55444 /**
55445  * Returns a new instance backed by the given [`WalletSource`] that serves as an implementation
55446  * of [`CoinSelectionSource`].
55447  */
55448 MUST_USE_RES struct LDKWallet Wallet_new(struct LDKWalletSource source, struct LDKLogger logger);
55449
55450 /**
55451  * Constructs a new CoinSelectionSource which calls the relevant methods on this_arg.
55452  * This copies the `inner` pointer in this_arg and thus the returned CoinSelectionSource must be freed before this_arg is
55453  */
55454 struct LDKCoinSelectionSource Wallet_as_CoinSelectionSource(const struct LDKWallet *NONNULL_PTR this_arg);
55455
55456 /**
55457  * Frees any resources used by the BumpTransactionEventHandler, if is_owned is set and inner is non-NULL.
55458  */
55459 void BumpTransactionEventHandler_free(struct LDKBumpTransactionEventHandler this_obj);
55460
55461 /**
55462  * Returns a new instance capable of handling [`Event::BumpTransaction`] events.
55463  *
55464  * [`Event::BumpTransaction`]: crate::events::Event::BumpTransaction
55465  */
55466 MUST_USE_RES struct LDKBumpTransactionEventHandler BumpTransactionEventHandler_new(struct LDKBroadcasterInterface broadcaster, struct LDKCoinSelectionSource utxo_source, struct LDKSignerProvider signer_provider, struct LDKLogger logger);
55467
55468 /**
55469  * Handles all variants of [`BumpTransactionEvent`].
55470  */
55471 void BumpTransactionEventHandler_handle_event(const struct LDKBumpTransactionEventHandler *NONNULL_PTR this_arg, const struct LDKBumpTransactionEvent *NONNULL_PTR event);
55472
55473 /**
55474  * Frees any resources used by the FilesystemStore, if is_owned is set and inner is non-NULL.
55475  */
55476 void FilesystemStore_free(struct LDKFilesystemStore this_obj);
55477
55478 /**
55479  * Constructs a new [`FilesystemStore`].
55480  */
55481 MUST_USE_RES struct LDKFilesystemStore FilesystemStore_new(struct LDKStr data_dir);
55482
55483 /**
55484  * Returns the data directory.
55485  */
55486 MUST_USE_RES struct LDKStr FilesystemStore_get_data_dir(const struct LDKFilesystemStore *NONNULL_PTR this_arg);
55487
55488 /**
55489  * Constructs a new KVStore which calls the relevant methods on this_arg.
55490  * This copies the `inner` pointer in this_arg and thus the returned KVStore must be freed before this_arg is
55491  */
55492 struct LDKKVStore FilesystemStore_as_KVStore(const struct LDKFilesystemStore *NONNULL_PTR this_arg);
55493
55494 /**
55495  * Frees any resources used by the BackgroundProcessor, if is_owned is set and inner is non-NULL.
55496  */
55497 void BackgroundProcessor_free(struct LDKBackgroundProcessor this_obj);
55498
55499 /**
55500  * Frees any resources used by the GossipSync
55501  */
55502 void GossipSync_free(struct LDKGossipSync this_ptr);
55503
55504 /**
55505  * Utility method to constructs a new P2P-variant GossipSync
55506  */
55507 struct LDKGossipSync GossipSync_p2_p(const struct LDKP2PGossipSync *NONNULL_PTR a);
55508
55509 /**
55510  * Utility method to constructs a new Rapid-variant GossipSync
55511  */
55512 struct LDKGossipSync GossipSync_rapid(const struct LDKRapidGossipSync *NONNULL_PTR a);
55513
55514 /**
55515  * Utility method to constructs a new None-variant GossipSync
55516  */
55517 struct LDKGossipSync GossipSync_none(void);
55518
55519 /**
55520  * Start a background thread that takes care of responsibilities enumerated in the [top-level
55521  * documentation].
55522  *
55523  * The thread runs indefinitely unless the object is dropped, [`stop`] is called, or
55524  * [`Persister::persist_manager`] returns an error. In case of an error, the error is retrieved by calling
55525  * either [`join`] or [`stop`].
55526  *
55527  * # Data Persistence
55528  *
55529  * [`Persister::persist_manager`] is responsible for writing out the [`ChannelManager`] to disk, and/or
55530  * uploading to one or more backup services. See [`ChannelManager::write`] for writing out a
55531  * [`ChannelManager`]. See the `lightning-persister` crate for LDK's
55532  * provided implementation.
55533  *
55534  * [`Persister::persist_graph`] is responsible for writing out the [`NetworkGraph`] to disk, if
55535  * [`GossipSync`] is supplied. See [`NetworkGraph::write`] for writing out a [`NetworkGraph`].
55536  * See the `lightning-persister` crate for LDK's provided implementation.
55537  *
55538  * Typically, users should either implement [`Persister::persist_manager`] to never return an
55539  * error or call [`join`] and handle any error that may arise. For the latter case,
55540  * `BackgroundProcessor` must be restarted by calling `start` again after handling the error.
55541  *
55542  * # Event Handling
55543  *
55544  * `event_handler` is responsible for handling events that users should be notified of (e.g.,
55545  * payment failed). [`BackgroundProcessor`] may decorate the given [`EventHandler`] with common
55546  * functionality implemented by other handlers.
55547  * * [`P2PGossipSync`] if given will update the [`NetworkGraph`] based on payment failures.
55548  *
55549  * # Rapid Gossip Sync
55550  *
55551  * If rapid gossip sync is meant to run at startup, pass [`RapidGossipSync`] via `gossip_sync`
55552  * to indicate that the [`BackgroundProcessor`] should not prune the [`NetworkGraph`] instance
55553  * until the [`RapidGossipSync`] instance completes its first sync.
55554  *
55555  * [top-level documentation]: BackgroundProcessor
55556  * [`join`]: Self::join
55557  * [`stop`]: Self::stop
55558  * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
55559  * [`ChannelManager::write`]: lightning::ln::channelmanager::ChannelManager#impl-Writeable
55560  * [`Persister::persist_manager`]: lightning::util::persist::Persister::persist_manager
55561  * [`Persister::persist_graph`]: lightning::util::persist::Persister::persist_graph
55562  * [`NetworkGraph`]: lightning::routing::gossip::NetworkGraph
55563  * [`NetworkGraph::write`]: lightning::routing::gossip::NetworkGraph#impl-Writeable
55564  */
55565 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);
55566
55567 /**
55568  * Join `BackgroundProcessor`'s thread, returning any error that occurred while persisting
55569  * [`ChannelManager`].
55570  *
55571  * # Panics
55572  *
55573  * This function panics if the background thread has panicked such as while persisting or
55574  * handling events.
55575  *
55576  * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
55577  */
55578 MUST_USE_RES struct LDKCResult_NoneIOErrorZ BackgroundProcessor_join(struct LDKBackgroundProcessor this_arg);
55579
55580 /**
55581  * Stop `BackgroundProcessor`'s thread, returning any error that occurred while persisting
55582  * [`ChannelManager`].
55583  *
55584  * # Panics
55585  *
55586  * This function panics if the background thread has panicked such as while persisting or
55587  * handling events.
55588  *
55589  * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
55590  */
55591 MUST_USE_RES struct LDKCResult_NoneIOErrorZ BackgroundProcessor_stop(struct LDKBackgroundProcessor this_arg);
55592
55593 /**
55594  * Frees any resources used by the Bolt11ParseError
55595  */
55596 void Bolt11ParseError_free(struct LDKBolt11ParseError this_ptr);
55597
55598 /**
55599  * Creates a copy of the Bolt11ParseError
55600  */
55601 struct LDKBolt11ParseError Bolt11ParseError_clone(const struct LDKBolt11ParseError *NONNULL_PTR orig);
55602
55603 /**
55604  * Utility method to constructs a new Bech32Error-variant Bolt11ParseError
55605  */
55606 struct LDKBolt11ParseError Bolt11ParseError_bech32_error(struct LDKBech32Error a);
55607
55608 /**
55609  * Utility method to constructs a new ParseAmountError-variant Bolt11ParseError
55610  */
55611 struct LDKBolt11ParseError Bolt11ParseError_parse_amount_error(struct LDKError a);
55612
55613 /**
55614  * Utility method to constructs a new MalformedSignature-variant Bolt11ParseError
55615  */
55616 struct LDKBolt11ParseError Bolt11ParseError_malformed_signature(enum LDKSecp256k1Error a);
55617
55618 /**
55619  * Utility method to constructs a new BadPrefix-variant Bolt11ParseError
55620  */
55621 struct LDKBolt11ParseError Bolt11ParseError_bad_prefix(void);
55622
55623 /**
55624  * Utility method to constructs a new UnknownCurrency-variant Bolt11ParseError
55625  */
55626 struct LDKBolt11ParseError Bolt11ParseError_unknown_currency(void);
55627
55628 /**
55629  * Utility method to constructs a new UnknownSiPrefix-variant Bolt11ParseError
55630  */
55631 struct LDKBolt11ParseError Bolt11ParseError_unknown_si_prefix(void);
55632
55633 /**
55634  * Utility method to constructs a new MalformedHRP-variant Bolt11ParseError
55635  */
55636 struct LDKBolt11ParseError Bolt11ParseError_malformed_hrp(void);
55637
55638 /**
55639  * Utility method to constructs a new TooShortDataPart-variant Bolt11ParseError
55640  */
55641 struct LDKBolt11ParseError Bolt11ParseError_too_short_data_part(void);
55642
55643 /**
55644  * Utility method to constructs a new UnexpectedEndOfTaggedFields-variant Bolt11ParseError
55645  */
55646 struct LDKBolt11ParseError Bolt11ParseError_unexpected_end_of_tagged_fields(void);
55647
55648 /**
55649  * Utility method to constructs a new DescriptionDecodeError-variant Bolt11ParseError
55650  */
55651 struct LDKBolt11ParseError Bolt11ParseError_description_decode_error(struct LDKError a);
55652
55653 /**
55654  * Utility method to constructs a new PaddingError-variant Bolt11ParseError
55655  */
55656 struct LDKBolt11ParseError Bolt11ParseError_padding_error(void);
55657
55658 /**
55659  * Utility method to constructs a new IntegerOverflowError-variant Bolt11ParseError
55660  */
55661 struct LDKBolt11ParseError Bolt11ParseError_integer_overflow_error(void);
55662
55663 /**
55664  * Utility method to constructs a new InvalidSegWitProgramLength-variant Bolt11ParseError
55665  */
55666 struct LDKBolt11ParseError Bolt11ParseError_invalid_seg_wit_program_length(void);
55667
55668 /**
55669  * Utility method to constructs a new InvalidPubKeyHashLength-variant Bolt11ParseError
55670  */
55671 struct LDKBolt11ParseError Bolt11ParseError_invalid_pub_key_hash_length(void);
55672
55673 /**
55674  * Utility method to constructs a new InvalidScriptHashLength-variant Bolt11ParseError
55675  */
55676 struct LDKBolt11ParseError Bolt11ParseError_invalid_script_hash_length(void);
55677
55678 /**
55679  * Utility method to constructs a new InvalidRecoveryId-variant Bolt11ParseError
55680  */
55681 struct LDKBolt11ParseError Bolt11ParseError_invalid_recovery_id(void);
55682
55683 /**
55684  * Utility method to constructs a new InvalidSliceLength-variant Bolt11ParseError
55685  */
55686 struct LDKBolt11ParseError Bolt11ParseError_invalid_slice_length(struct LDKStr a);
55687
55688 /**
55689  * Utility method to constructs a new Skip-variant Bolt11ParseError
55690  */
55691 struct LDKBolt11ParseError Bolt11ParseError_skip(void);
55692
55693 /**
55694  * Checks if two Bolt11ParseErrors contain equal inner contents.
55695  * This ignores pointers and is_owned flags and looks at the values in fields.
55696  */
55697 bool Bolt11ParseError_eq(const struct LDKBolt11ParseError *NONNULL_PTR a, const struct LDKBolt11ParseError *NONNULL_PTR b);
55698
55699 /**
55700  * Frees any resources used by the ParseOrSemanticError
55701  */
55702 void ParseOrSemanticError_free(struct LDKParseOrSemanticError this_ptr);
55703
55704 /**
55705  * Creates a copy of the ParseOrSemanticError
55706  */
55707 struct LDKParseOrSemanticError ParseOrSemanticError_clone(const struct LDKParseOrSemanticError *NONNULL_PTR orig);
55708
55709 /**
55710  * Utility method to constructs a new ParseError-variant ParseOrSemanticError
55711  */
55712 struct LDKParseOrSemanticError ParseOrSemanticError_parse_error(struct LDKBolt11ParseError a);
55713
55714 /**
55715  * Utility method to constructs a new SemanticError-variant ParseOrSemanticError
55716  */
55717 struct LDKParseOrSemanticError ParseOrSemanticError_semantic_error(enum LDKBolt11SemanticError a);
55718
55719 /**
55720  * Checks if two ParseOrSemanticErrors contain equal inner contents.
55721  * This ignores pointers and is_owned flags and looks at the values in fields.
55722  */
55723 bool ParseOrSemanticError_eq(const struct LDKParseOrSemanticError *NONNULL_PTR a, const struct LDKParseOrSemanticError *NONNULL_PTR b);
55724
55725 /**
55726  * Frees any resources used by the Bolt11Invoice, if is_owned is set and inner is non-NULL.
55727  */
55728 void Bolt11Invoice_free(struct LDKBolt11Invoice this_obj);
55729
55730 /**
55731  * Checks if two Bolt11Invoices contain equal inner contents.
55732  * This ignores pointers and is_owned flags and looks at the values in fields.
55733  * Two objects with NULL inner values will be considered "equal" here.
55734  */
55735 bool Bolt11Invoice_eq(const struct LDKBolt11Invoice *NONNULL_PTR a, const struct LDKBolt11Invoice *NONNULL_PTR b);
55736
55737 /**
55738  * Creates a copy of the Bolt11Invoice
55739  */
55740 struct LDKBolt11Invoice Bolt11Invoice_clone(const struct LDKBolt11Invoice *NONNULL_PTR orig);
55741
55742 /**
55743  * Generates a non-cryptographic 64-bit hash of the Bolt11Invoice.
55744  */
55745 uint64_t Bolt11Invoice_hash(const struct LDKBolt11Invoice *NONNULL_PTR o);
55746
55747 /**
55748  * Frees any resources used by the SignedRawBolt11Invoice, if is_owned is set and inner is non-NULL.
55749  */
55750 void SignedRawBolt11Invoice_free(struct LDKSignedRawBolt11Invoice this_obj);
55751
55752 /**
55753  * Checks if two SignedRawBolt11Invoices contain equal inner contents.
55754  * This ignores pointers and is_owned flags and looks at the values in fields.
55755  * Two objects with NULL inner values will be considered "equal" here.
55756  */
55757 bool SignedRawBolt11Invoice_eq(const struct LDKSignedRawBolt11Invoice *NONNULL_PTR a, const struct LDKSignedRawBolt11Invoice *NONNULL_PTR b);
55758
55759 /**
55760  * Creates a copy of the SignedRawBolt11Invoice
55761  */
55762 struct LDKSignedRawBolt11Invoice SignedRawBolt11Invoice_clone(const struct LDKSignedRawBolt11Invoice *NONNULL_PTR orig);
55763
55764 /**
55765  * Generates a non-cryptographic 64-bit hash of the SignedRawBolt11Invoice.
55766  */
55767 uint64_t SignedRawBolt11Invoice_hash(const struct LDKSignedRawBolt11Invoice *NONNULL_PTR o);
55768
55769 /**
55770  * Frees any resources used by the RawBolt11Invoice, if is_owned is set and inner is non-NULL.
55771  */
55772 void RawBolt11Invoice_free(struct LDKRawBolt11Invoice this_obj);
55773
55774 /**
55775  * data part
55776  */
55777 struct LDKRawDataPart RawBolt11Invoice_get_data(const struct LDKRawBolt11Invoice *NONNULL_PTR this_ptr);
55778
55779 /**
55780  * data part
55781  */
55782 void RawBolt11Invoice_set_data(struct LDKRawBolt11Invoice *NONNULL_PTR this_ptr, struct LDKRawDataPart val);
55783
55784 /**
55785  * Checks if two RawBolt11Invoices contain equal inner contents.
55786  * This ignores pointers and is_owned flags and looks at the values in fields.
55787  * Two objects with NULL inner values will be considered "equal" here.
55788  */
55789 bool RawBolt11Invoice_eq(const struct LDKRawBolt11Invoice *NONNULL_PTR a, const struct LDKRawBolt11Invoice *NONNULL_PTR b);
55790
55791 /**
55792  * Creates a copy of the RawBolt11Invoice
55793  */
55794 struct LDKRawBolt11Invoice RawBolt11Invoice_clone(const struct LDKRawBolt11Invoice *NONNULL_PTR orig);
55795
55796 /**
55797  * Generates a non-cryptographic 64-bit hash of the RawBolt11Invoice.
55798  */
55799 uint64_t RawBolt11Invoice_hash(const struct LDKRawBolt11Invoice *NONNULL_PTR o);
55800
55801 /**
55802  * Frees any resources used by the RawDataPart, if is_owned is set and inner is non-NULL.
55803  */
55804 void RawDataPart_free(struct LDKRawDataPart this_obj);
55805
55806 /**
55807  * generation time of the invoice
55808  */
55809 struct LDKPositiveTimestamp RawDataPart_get_timestamp(const struct LDKRawDataPart *NONNULL_PTR this_ptr);
55810
55811 /**
55812  * generation time of the invoice
55813  */
55814 void RawDataPart_set_timestamp(struct LDKRawDataPart *NONNULL_PTR this_ptr, struct LDKPositiveTimestamp val);
55815
55816 /**
55817  * Checks if two RawDataParts contain equal inner contents.
55818  * This ignores pointers and is_owned flags and looks at the values in fields.
55819  * Two objects with NULL inner values will be considered "equal" here.
55820  */
55821 bool RawDataPart_eq(const struct LDKRawDataPart *NONNULL_PTR a, const struct LDKRawDataPart *NONNULL_PTR b);
55822
55823 /**
55824  * Creates a copy of the RawDataPart
55825  */
55826 struct LDKRawDataPart RawDataPart_clone(const struct LDKRawDataPart *NONNULL_PTR orig);
55827
55828 /**
55829  * Generates a non-cryptographic 64-bit hash of the RawDataPart.
55830  */
55831 uint64_t RawDataPart_hash(const struct LDKRawDataPart *NONNULL_PTR o);
55832
55833 /**
55834  * Frees any resources used by the PositiveTimestamp, if is_owned is set and inner is non-NULL.
55835  */
55836 void PositiveTimestamp_free(struct LDKPositiveTimestamp this_obj);
55837
55838 /**
55839  * Checks if two PositiveTimestamps contain equal inner contents.
55840  * This ignores pointers and is_owned flags and looks at the values in fields.
55841  * Two objects with NULL inner values will be considered "equal" here.
55842  */
55843 bool PositiveTimestamp_eq(const struct LDKPositiveTimestamp *NONNULL_PTR a, const struct LDKPositiveTimestamp *NONNULL_PTR b);
55844
55845 /**
55846  * Creates a copy of the PositiveTimestamp
55847  */
55848 struct LDKPositiveTimestamp PositiveTimestamp_clone(const struct LDKPositiveTimestamp *NONNULL_PTR orig);
55849
55850 /**
55851  * Generates a non-cryptographic 64-bit hash of the PositiveTimestamp.
55852  */
55853 uint64_t PositiveTimestamp_hash(const struct LDKPositiveTimestamp *NONNULL_PTR o);
55854
55855 /**
55856  * Creates a copy of the SiPrefix
55857  */
55858 enum LDKSiPrefix SiPrefix_clone(const enum LDKSiPrefix *NONNULL_PTR orig);
55859
55860 /**
55861  * Utility method to constructs a new Milli-variant SiPrefix
55862  */
55863 enum LDKSiPrefix SiPrefix_milli(void);
55864
55865 /**
55866  * Utility method to constructs a new Micro-variant SiPrefix
55867  */
55868 enum LDKSiPrefix SiPrefix_micro(void);
55869
55870 /**
55871  * Utility method to constructs a new Nano-variant SiPrefix
55872  */
55873 enum LDKSiPrefix SiPrefix_nano(void);
55874
55875 /**
55876  * Utility method to constructs a new Pico-variant SiPrefix
55877  */
55878 enum LDKSiPrefix SiPrefix_pico(void);
55879
55880 /**
55881  * Checks if two SiPrefixs contain equal inner contents.
55882  * This ignores pointers and is_owned flags and looks at the values in fields.
55883  */
55884 bool SiPrefix_eq(const enum LDKSiPrefix *NONNULL_PTR a, const enum LDKSiPrefix *NONNULL_PTR b);
55885
55886 /**
55887  * Generates a non-cryptographic 64-bit hash of the SiPrefix.
55888  */
55889 uint64_t SiPrefix_hash(const enum LDKSiPrefix *NONNULL_PTR o);
55890
55891 /**
55892  * Returns the multiplier to go from a BTC value to picoBTC implied by this SiPrefix.
55893  * This is effectively 10^12 * the prefix multiplier
55894  */
55895 MUST_USE_RES uint64_t SiPrefix_multiplier(const enum LDKSiPrefix *NONNULL_PTR this_arg);
55896
55897 /**
55898  * Creates a copy of the Currency
55899  */
55900 enum LDKCurrency Currency_clone(const enum LDKCurrency *NONNULL_PTR orig);
55901
55902 /**
55903  * Utility method to constructs a new Bitcoin-variant Currency
55904  */
55905 enum LDKCurrency Currency_bitcoin(void);
55906
55907 /**
55908  * Utility method to constructs a new BitcoinTestnet-variant Currency
55909  */
55910 enum LDKCurrency Currency_bitcoin_testnet(void);
55911
55912 /**
55913  * Utility method to constructs a new Regtest-variant Currency
55914  */
55915 enum LDKCurrency Currency_regtest(void);
55916
55917 /**
55918  * Utility method to constructs a new Simnet-variant Currency
55919  */
55920 enum LDKCurrency Currency_simnet(void);
55921
55922 /**
55923  * Utility method to constructs a new Signet-variant Currency
55924  */
55925 enum LDKCurrency Currency_signet(void);
55926
55927 /**
55928  * Generates a non-cryptographic 64-bit hash of the Currency.
55929  */
55930 uint64_t Currency_hash(const enum LDKCurrency *NONNULL_PTR o);
55931
55932 /**
55933  * Checks if two Currencys contain equal inner contents.
55934  * This ignores pointers and is_owned flags and looks at the values in fields.
55935  */
55936 bool Currency_eq(const enum LDKCurrency *NONNULL_PTR a, const enum LDKCurrency *NONNULL_PTR b);
55937
55938 /**
55939  * Frees any resources used by the Sha256, if is_owned is set and inner is non-NULL.
55940  */
55941 void Sha256_free(struct LDKSha256 this_obj);
55942
55943 /**
55944  * Creates a copy of the Sha256
55945  */
55946 struct LDKSha256 Sha256_clone(const struct LDKSha256 *NONNULL_PTR orig);
55947
55948 /**
55949  * Generates a non-cryptographic 64-bit hash of the Sha256.
55950  */
55951 uint64_t Sha256_hash(const struct LDKSha256 *NONNULL_PTR o);
55952
55953 /**
55954  * Checks if two Sha256s contain equal inner contents.
55955  * This ignores pointers and is_owned flags and looks at the values in fields.
55956  * Two objects with NULL inner values will be considered "equal" here.
55957  */
55958 bool Sha256_eq(const struct LDKSha256 *NONNULL_PTR a, const struct LDKSha256 *NONNULL_PTR b);
55959
55960 /**
55961  * Constructs a new [`Sha256`] from the given bytes, which are assumed to be the output of a
55962  * single sha256 hash.
55963  */
55964 MUST_USE_RES struct LDKSha256 Sha256_from_bytes(const uint8_t (*bytes)[32]);
55965
55966 /**
55967  * Frees any resources used by the Description, if is_owned is set and inner is non-NULL.
55968  */
55969 void Description_free(struct LDKDescription this_obj);
55970
55971 /**
55972  * Creates a copy of the Description
55973  */
55974 struct LDKDescription Description_clone(const struct LDKDescription *NONNULL_PTR orig);
55975
55976 /**
55977  * Generates a non-cryptographic 64-bit hash of the Description.
55978  */
55979 uint64_t Description_hash(const struct LDKDescription *NONNULL_PTR o);
55980
55981 /**
55982  * Checks if two Descriptions contain equal inner contents.
55983  * This ignores pointers and is_owned flags and looks at the values in fields.
55984  * Two objects with NULL inner values will be considered "equal" here.
55985  */
55986 bool Description_eq(const struct LDKDescription *NONNULL_PTR a, const struct LDKDescription *NONNULL_PTR b);
55987
55988 /**
55989  * Frees any resources used by the PayeePubKey, if is_owned is set and inner is non-NULL.
55990  */
55991 void PayeePubKey_free(struct LDKPayeePubKey this_obj);
55992
55993 struct LDKPublicKey PayeePubKey_get_a(const struct LDKPayeePubKey *NONNULL_PTR this_ptr);
55994
55995 void PayeePubKey_set_a(struct LDKPayeePubKey *NONNULL_PTR this_ptr, struct LDKPublicKey val);
55996
55997 /**
55998  * Constructs a new PayeePubKey given each field
55999  */
56000 MUST_USE_RES struct LDKPayeePubKey PayeePubKey_new(struct LDKPublicKey a_arg);
56001
56002 /**
56003  * Creates a copy of the PayeePubKey
56004  */
56005 struct LDKPayeePubKey PayeePubKey_clone(const struct LDKPayeePubKey *NONNULL_PTR orig);
56006
56007 /**
56008  * Generates a non-cryptographic 64-bit hash of the PayeePubKey.
56009  */
56010 uint64_t PayeePubKey_hash(const struct LDKPayeePubKey *NONNULL_PTR o);
56011
56012 /**
56013  * Checks if two PayeePubKeys contain equal inner contents.
56014  * This ignores pointers and is_owned flags and looks at the values in fields.
56015  * Two objects with NULL inner values will be considered "equal" here.
56016  */
56017 bool PayeePubKey_eq(const struct LDKPayeePubKey *NONNULL_PTR a, const struct LDKPayeePubKey *NONNULL_PTR b);
56018
56019 /**
56020  * Frees any resources used by the ExpiryTime, if is_owned is set and inner is non-NULL.
56021  */
56022 void ExpiryTime_free(struct LDKExpiryTime this_obj);
56023
56024 /**
56025  * Creates a copy of the ExpiryTime
56026  */
56027 struct LDKExpiryTime ExpiryTime_clone(const struct LDKExpiryTime *NONNULL_PTR orig);
56028
56029 /**
56030  * Generates a non-cryptographic 64-bit hash of the ExpiryTime.
56031  */
56032 uint64_t ExpiryTime_hash(const struct LDKExpiryTime *NONNULL_PTR o);
56033
56034 /**
56035  * Checks if two ExpiryTimes contain equal inner contents.
56036  * This ignores pointers and is_owned flags and looks at the values in fields.
56037  * Two objects with NULL inner values will be considered "equal" here.
56038  */
56039 bool ExpiryTime_eq(const struct LDKExpiryTime *NONNULL_PTR a, const struct LDKExpiryTime *NONNULL_PTR b);
56040
56041 /**
56042  * Frees any resources used by the MinFinalCltvExpiryDelta, if is_owned is set and inner is non-NULL.
56043  */
56044 void MinFinalCltvExpiryDelta_free(struct LDKMinFinalCltvExpiryDelta this_obj);
56045
56046 uint64_t MinFinalCltvExpiryDelta_get_a(const struct LDKMinFinalCltvExpiryDelta *NONNULL_PTR this_ptr);
56047
56048 void MinFinalCltvExpiryDelta_set_a(struct LDKMinFinalCltvExpiryDelta *NONNULL_PTR this_ptr, uint64_t val);
56049
56050 /**
56051  * Constructs a new MinFinalCltvExpiryDelta given each field
56052  */
56053 MUST_USE_RES struct LDKMinFinalCltvExpiryDelta MinFinalCltvExpiryDelta_new(uint64_t a_arg);
56054
56055 /**
56056  * Creates a copy of the MinFinalCltvExpiryDelta
56057  */
56058 struct LDKMinFinalCltvExpiryDelta MinFinalCltvExpiryDelta_clone(const struct LDKMinFinalCltvExpiryDelta *NONNULL_PTR orig);
56059
56060 /**
56061  * Generates a non-cryptographic 64-bit hash of the MinFinalCltvExpiryDelta.
56062  */
56063 uint64_t MinFinalCltvExpiryDelta_hash(const struct LDKMinFinalCltvExpiryDelta *NONNULL_PTR o);
56064
56065 /**
56066  * Checks if two MinFinalCltvExpiryDeltas contain equal inner contents.
56067  * This ignores pointers and is_owned flags and looks at the values in fields.
56068  * Two objects with NULL inner values will be considered "equal" here.
56069  */
56070 bool MinFinalCltvExpiryDelta_eq(const struct LDKMinFinalCltvExpiryDelta *NONNULL_PTR a, const struct LDKMinFinalCltvExpiryDelta *NONNULL_PTR b);
56071
56072 /**
56073  * Frees any resources used by the Fallback
56074  */
56075 void Fallback_free(struct LDKFallback this_ptr);
56076
56077 /**
56078  * Creates a copy of the Fallback
56079  */
56080 struct LDKFallback Fallback_clone(const struct LDKFallback *NONNULL_PTR orig);
56081
56082 /**
56083  * Utility method to constructs a new SegWitProgram-variant Fallback
56084  */
56085 struct LDKFallback Fallback_seg_wit_program(struct LDKWitnessVersion version, struct LDKCVec_u8Z program);
56086
56087 /**
56088  * Utility method to constructs a new PubKeyHash-variant Fallback
56089  */
56090 struct LDKFallback Fallback_pub_key_hash(struct LDKTwentyBytes a);
56091
56092 /**
56093  * Utility method to constructs a new ScriptHash-variant Fallback
56094  */
56095 struct LDKFallback Fallback_script_hash(struct LDKTwentyBytes a);
56096
56097 /**
56098  * Generates a non-cryptographic 64-bit hash of the Fallback.
56099  */
56100 uint64_t Fallback_hash(const struct LDKFallback *NONNULL_PTR o);
56101
56102 /**
56103  * Checks if two Fallbacks contain equal inner contents.
56104  * This ignores pointers and is_owned flags and looks at the values in fields.
56105  */
56106 bool Fallback_eq(const struct LDKFallback *NONNULL_PTR a, const struct LDKFallback *NONNULL_PTR b);
56107
56108 /**
56109  * Frees any resources used by the Bolt11InvoiceSignature, if is_owned is set and inner is non-NULL.
56110  */
56111 void Bolt11InvoiceSignature_free(struct LDKBolt11InvoiceSignature this_obj);
56112
56113 /**
56114  * Creates a copy of the Bolt11InvoiceSignature
56115  */
56116 struct LDKBolt11InvoiceSignature Bolt11InvoiceSignature_clone(const struct LDKBolt11InvoiceSignature *NONNULL_PTR orig);
56117
56118 /**
56119  * Generates a non-cryptographic 64-bit hash of the Bolt11InvoiceSignature.
56120  */
56121 uint64_t Bolt11InvoiceSignature_hash(const struct LDKBolt11InvoiceSignature *NONNULL_PTR o);
56122
56123 /**
56124  * Checks if two Bolt11InvoiceSignatures contain equal inner contents.
56125  * This ignores pointers and is_owned flags and looks at the values in fields.
56126  * Two objects with NULL inner values will be considered "equal" here.
56127  */
56128 bool Bolt11InvoiceSignature_eq(const struct LDKBolt11InvoiceSignature *NONNULL_PTR a, const struct LDKBolt11InvoiceSignature *NONNULL_PTR b);
56129
56130 /**
56131  * Frees any resources used by the PrivateRoute, if is_owned is set and inner is non-NULL.
56132  */
56133 void PrivateRoute_free(struct LDKPrivateRoute this_obj);
56134
56135 /**
56136  * Creates a copy of the PrivateRoute
56137  */
56138 struct LDKPrivateRoute PrivateRoute_clone(const struct LDKPrivateRoute *NONNULL_PTR orig);
56139
56140 /**
56141  * Generates a non-cryptographic 64-bit hash of the PrivateRoute.
56142  */
56143 uint64_t PrivateRoute_hash(const struct LDKPrivateRoute *NONNULL_PTR o);
56144
56145 /**
56146  * Checks if two PrivateRoutes contain equal inner contents.
56147  * This ignores pointers and is_owned flags and looks at the values in fields.
56148  * Two objects with NULL inner values will be considered "equal" here.
56149  */
56150 bool PrivateRoute_eq(const struct LDKPrivateRoute *NONNULL_PTR a, const struct LDKPrivateRoute *NONNULL_PTR b);
56151
56152 /**
56153  * Disassembles the `SignedRawBolt11Invoice` into its three parts:
56154  *  1. raw invoice
56155  *  2. hash of the raw invoice
56156  *  3. signature
56157  */
56158 MUST_USE_RES struct LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ SignedRawBolt11Invoice_into_parts(struct LDKSignedRawBolt11Invoice this_arg);
56159
56160 /**
56161  * The [`RawBolt11Invoice`] which was signed.
56162  */
56163 MUST_USE_RES struct LDKRawBolt11Invoice SignedRawBolt11Invoice_raw_invoice(const struct LDKSignedRawBolt11Invoice *NONNULL_PTR this_arg);
56164
56165 /**
56166  * The hash of the [`RawBolt11Invoice`] that was signed.
56167  */
56168 MUST_USE_RES const uint8_t (*SignedRawBolt11Invoice_signable_hash(const struct LDKSignedRawBolt11Invoice *NONNULL_PTR this_arg))[32];
56169
56170 /**
56171  * Signature for the invoice.
56172  */
56173 MUST_USE_RES struct LDKBolt11InvoiceSignature SignedRawBolt11Invoice_signature(const struct LDKSignedRawBolt11Invoice *NONNULL_PTR this_arg);
56174
56175 /**
56176  * Recovers the public key used for signing the invoice from the recoverable signature.
56177  */
56178 MUST_USE_RES struct LDKCResult_PayeePubKeySecp256k1ErrorZ SignedRawBolt11Invoice_recover_payee_pub_key(const struct LDKSignedRawBolt11Invoice *NONNULL_PTR this_arg);
56179
56180 /**
56181  * Checks if the signature is valid for the included payee public key or if none exists if it's
56182  * valid for the recovered signature (which should always be true?).
56183  */
56184 MUST_USE_RES bool SignedRawBolt11Invoice_check_signature(const struct LDKSignedRawBolt11Invoice *NONNULL_PTR this_arg);
56185
56186 /**
56187  * Calculate the hash of the encoded `RawBolt11Invoice` which should be signed.
56188  */
56189 MUST_USE_RES struct LDKThirtyTwoBytes RawBolt11Invoice_signable_hash(const struct LDKRawBolt11Invoice *NONNULL_PTR this_arg);
56190
56191 /**
56192  *
56193  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
56194  */
56195 MUST_USE_RES struct LDKSha256 RawBolt11Invoice_payment_hash(const struct LDKRawBolt11Invoice *NONNULL_PTR this_arg);
56196
56197 /**
56198  *
56199  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
56200  */
56201 MUST_USE_RES struct LDKDescription RawBolt11Invoice_description(const struct LDKRawBolt11Invoice *NONNULL_PTR this_arg);
56202
56203 /**
56204  *
56205  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
56206  */
56207 MUST_USE_RES struct LDKPayeePubKey RawBolt11Invoice_payee_pub_key(const struct LDKRawBolt11Invoice *NONNULL_PTR this_arg);
56208
56209 /**
56210  *
56211  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
56212  */
56213 MUST_USE_RES struct LDKSha256 RawBolt11Invoice_description_hash(const struct LDKRawBolt11Invoice *NONNULL_PTR this_arg);
56214
56215 /**
56216  *
56217  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
56218  */
56219 MUST_USE_RES struct LDKExpiryTime RawBolt11Invoice_expiry_time(const struct LDKRawBolt11Invoice *NONNULL_PTR this_arg);
56220
56221 /**
56222  *
56223  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
56224  */
56225 MUST_USE_RES struct LDKMinFinalCltvExpiryDelta RawBolt11Invoice_min_final_cltv_expiry_delta(const struct LDKRawBolt11Invoice *NONNULL_PTR this_arg);
56226
56227 MUST_USE_RES struct LDKCOption_ThirtyTwoBytesZ RawBolt11Invoice_payment_secret(const struct LDKRawBolt11Invoice *NONNULL_PTR this_arg);
56228
56229 MUST_USE_RES struct LDKCOption_CVec_u8ZZ RawBolt11Invoice_payment_metadata(const struct LDKRawBolt11Invoice *NONNULL_PTR this_arg);
56230
56231 /**
56232  *
56233  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
56234  */
56235 MUST_USE_RES struct LDKBolt11InvoiceFeatures RawBolt11Invoice_features(const struct LDKRawBolt11Invoice *NONNULL_PTR this_arg);
56236
56237 MUST_USE_RES struct LDKCVec_PrivateRouteZ RawBolt11Invoice_private_routes(const struct LDKRawBolt11Invoice *NONNULL_PTR this_arg);
56238
56239 /**
56240  * Returns `None` if no amount is set or on overflow.
56241  */
56242 MUST_USE_RES struct LDKCOption_u64Z RawBolt11Invoice_amount_pico_btc(const struct LDKRawBolt11Invoice *NONNULL_PTR this_arg);
56243
56244 MUST_USE_RES enum LDKCurrency RawBolt11Invoice_currency(const struct LDKRawBolt11Invoice *NONNULL_PTR this_arg);
56245
56246 /**
56247  * Creates a `PositiveTimestamp` from a Unix timestamp in the range `0..=MAX_TIMESTAMP`.
56248  *
56249  * Otherwise, returns a [`CreationError::TimestampOutOfBounds`].
56250  */
56251 MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp_from_unix_timestamp(uint64_t unix_seconds);
56252
56253 /**
56254  * Creates a `PositiveTimestamp` from a [`SystemTime`] with a corresponding Unix timestamp in
56255  * the range `0..=MAX_TIMESTAMP`.
56256  *
56257  * Note that the subsecond part is dropped as it is not representable in BOLT 11 invoices.
56258  *
56259  * Otherwise, returns a [`CreationError::TimestampOutOfBounds`].
56260  */
56261 MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp_from_system_time(uint64_t time);
56262
56263 /**
56264  * Creates a `PositiveTimestamp` from a [`Duration`] since the Unix epoch in the range
56265  * `0..=MAX_TIMESTAMP`.
56266  *
56267  * Note that the subsecond part is dropped as it is not representable in BOLT 11 invoices.
56268  *
56269  * Otherwise, returns a [`CreationError::TimestampOutOfBounds`].
56270  */
56271 MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp_from_duration_since_epoch(uint64_t duration);
56272
56273 /**
56274  * Returns the Unix timestamp representing the stored time
56275  */
56276 MUST_USE_RES uint64_t PositiveTimestamp_as_unix_timestamp(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg);
56277
56278 /**
56279  * Returns the duration of the stored time since the Unix epoch
56280  */
56281 MUST_USE_RES uint64_t PositiveTimestamp_as_duration_since_epoch(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg);
56282
56283 /**
56284  * Returns the [`SystemTime`] representing the stored time
56285  */
56286 MUST_USE_RES uint64_t PositiveTimestamp_as_time(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg);
56287
56288 /**
56289  * The hash of the [`RawBolt11Invoice`] that was signed.
56290  */
56291 MUST_USE_RES struct LDKThirtyTwoBytes Bolt11Invoice_signable_hash(const struct LDKBolt11Invoice *NONNULL_PTR this_arg);
56292
56293 /**
56294  * Transform the `Bolt11Invoice` into its unchecked version.
56295  */
56296 MUST_USE_RES struct LDKSignedRawBolt11Invoice Bolt11Invoice_into_signed_raw(struct LDKBolt11Invoice this_arg);
56297
56298 /**
56299  * Check that the invoice is signed correctly and that key recovery works
56300  */
56301 MUST_USE_RES struct LDKCResult_NoneBolt11SemanticErrorZ Bolt11Invoice_check_signature(const struct LDKBolt11Invoice *NONNULL_PTR this_arg);
56302
56303 /**
56304  * Constructs a `Bolt11Invoice` from a [`SignedRawBolt11Invoice`] by checking all its invariants.
56305  * ```
56306  * use lightning_invoice::*;
56307  *
56308  * let invoice = \"lnbc100p1psj9jhxdqud3jxktt5w46x7unfv9kz6mn0v3jsnp4q0d3p2sfluzdx45tqcs\\
56309  * h2pu5qc7lgq0xs578ngs6s0s68ua4h7cvspp5q6rmq35js88zp5dvwrv9m459tnk2zunwj5jalqtyxqulh0l\\
56310  * 5gflssp5nf55ny5gcrfl30xuhzj3nphgj27rstekmr9fw3ny5989s300gyus9qyysgqcqpcrzjqw2sxwe993\\
56311  * h5pcm4dxzpvttgza8zhkqxpgffcrf5v25nwpr3cmfg7z54kuqq8rgqqqqqqqq2qqqqq9qq9qrzjqd0ylaqcl\\
56312  * j9424x9m8h2vcukcgnm6s56xfgu3j78zyqzhgs4hlpzvznlugqq9vsqqqqqqqlgqqqqqeqq9qrzjqwldmj9d\\
56313  * ha74df76zhx6l9we0vjdquygcdt3kssupehe64g6yyp5yz5rhuqqwccqqyqqqqlgqqqqjcqq9qrzjqf9e58a\\
56314  * guqr0rcun0ajlvmzq3ek63cw2w282gv3z5uupmuwvgjtq2z55qsqqg6qqqyqqqrtnqqqzq3cqygrzjqvphms\\
56315  * ywntrrhqjcraumvc4y6r8v4z5v593trte429v4hredj7ms5z52usqq9ngqqqqqqqlgqqqqqqgq9qrzjq2v0v\\
56316  * p62g49p7569ev48cmulecsxe59lvaw3wlxm7r982zxa9zzj7z5l0cqqxusqqyqqqqlgqqqqqzsqygarl9fh3\\
56317  * 8s0gyuxjjgux34w75dnc6xp2l35j7es3jd4ugt3lu0xzre26yg5m7ke54n2d5sym4xcmxtl8238xxvw5h5h5\\
56318  * j5r6drg6k6zcqj0fcwg\";
56319  *
56320  * let signed = invoice.parse::<SignedRawBolt11Invoice>().unwrap();
56321  *
56322  * assert!(Bolt11Invoice::from_signed(signed).is_ok());
56323  * ```
56324  */
56325 MUST_USE_RES struct LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ Bolt11Invoice_from_signed(struct LDKSignedRawBolt11Invoice signed_invoice);
56326
56327 /**
56328  * Returns the `Bolt11Invoice`'s timestamp (should equal its creation time)
56329  */
56330 MUST_USE_RES uint64_t Bolt11Invoice_timestamp(const struct LDKBolt11Invoice *NONNULL_PTR this_arg);
56331
56332 /**
56333  * Returns the `Bolt11Invoice`'s timestamp as a duration since the Unix epoch
56334  */
56335 MUST_USE_RES uint64_t Bolt11Invoice_duration_since_epoch(const struct LDKBolt11Invoice *NONNULL_PTR this_arg);
56336
56337 /**
56338  * Returns the hash to which we will receive the preimage on completion of the payment
56339  */
56340 MUST_USE_RES const uint8_t (*Bolt11Invoice_payment_hash(const struct LDKBolt11Invoice *NONNULL_PTR this_arg))[32];
56341
56342 /**
56343  * Get the payee's public key if one was included in the invoice
56344  *
56345  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
56346  */
56347 MUST_USE_RES struct LDKPublicKey Bolt11Invoice_payee_pub_key(const struct LDKBolt11Invoice *NONNULL_PTR this_arg);
56348
56349 /**
56350  * Get the payment secret if one was included in the invoice
56351  */
56352 MUST_USE_RES const uint8_t (*Bolt11Invoice_payment_secret(const struct LDKBolt11Invoice *NONNULL_PTR this_arg))[32];
56353
56354 /**
56355  * Get the payment metadata blob if one was included in the invoice
56356  */
56357 MUST_USE_RES struct LDKCOption_CVec_u8ZZ Bolt11Invoice_payment_metadata(const struct LDKBolt11Invoice *NONNULL_PTR this_arg);
56358
56359 /**
56360  * Get the invoice features if they were included in the invoice
56361  *
56362  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
56363  */
56364 MUST_USE_RES struct LDKBolt11InvoiceFeatures Bolt11Invoice_features(const struct LDKBolt11Invoice *NONNULL_PTR this_arg);
56365
56366 /**
56367  * Recover the payee's public key (only to be used if none was included in the invoice)
56368  */
56369 MUST_USE_RES struct LDKPublicKey Bolt11Invoice_recover_payee_pub_key(const struct LDKBolt11Invoice *NONNULL_PTR this_arg);
56370
56371 /**
56372  * Recover the payee's public key if one was included in the invoice, otherwise return the
56373  * recovered public key from the signature
56374  */
56375 MUST_USE_RES struct LDKPublicKey Bolt11Invoice_get_payee_pub_key(const struct LDKBolt11Invoice *NONNULL_PTR this_arg);
56376
56377 /**
56378  * Returns the Duration since the Unix epoch at which the invoice expires.
56379  * Returning None if overflow occurred.
56380  */
56381 MUST_USE_RES struct LDKCOption_u64Z Bolt11Invoice_expires_at(const struct LDKBolt11Invoice *NONNULL_PTR this_arg);
56382
56383 /**
56384  * Returns the invoice's expiry time, if present, otherwise [`DEFAULT_EXPIRY_TIME`].
56385  */
56386 MUST_USE_RES uint64_t Bolt11Invoice_expiry_time(const struct LDKBolt11Invoice *NONNULL_PTR this_arg);
56387
56388 /**
56389  * Returns whether the invoice has expired.
56390  */
56391 MUST_USE_RES bool Bolt11Invoice_is_expired(const struct LDKBolt11Invoice *NONNULL_PTR this_arg);
56392
56393 /**
56394  * Returns the Duration remaining until the invoice expires.
56395  */
56396 MUST_USE_RES uint64_t Bolt11Invoice_duration_until_expiry(const struct LDKBolt11Invoice *NONNULL_PTR this_arg);
56397
56398 /**
56399  * Returns the Duration remaining until the invoice expires given the current time.
56400  * `time` is the timestamp as a duration since the Unix epoch.
56401  */
56402 MUST_USE_RES uint64_t Bolt11Invoice_expiration_remaining_from_epoch(const struct LDKBolt11Invoice *NONNULL_PTR this_arg, uint64_t time);
56403
56404 /**
56405  * Returns whether the expiry time would pass at the given point in time.
56406  * `at_time` is the timestamp as a duration since the Unix epoch.
56407  */
56408 MUST_USE_RES bool Bolt11Invoice_would_expire(const struct LDKBolt11Invoice *NONNULL_PTR this_arg, uint64_t at_time);
56409
56410 /**
56411  * Returns the invoice's `min_final_cltv_expiry_delta` time, if present, otherwise
56412  * [`DEFAULT_MIN_FINAL_CLTV_EXPIRY_DELTA`].
56413  */
56414 MUST_USE_RES uint64_t Bolt11Invoice_min_final_cltv_expiry_delta(const struct LDKBolt11Invoice *NONNULL_PTR this_arg);
56415
56416 /**
56417  * Returns a list of all fallback addresses as [`Address`]es
56418  */
56419 MUST_USE_RES struct LDKCVec_StrZ Bolt11Invoice_fallback_addresses(const struct LDKBolt11Invoice *NONNULL_PTR this_arg);
56420
56421 /**
56422  * Returns a list of all routes included in the invoice
56423  */
56424 MUST_USE_RES struct LDKCVec_PrivateRouteZ Bolt11Invoice_private_routes(const struct LDKBolt11Invoice *NONNULL_PTR this_arg);
56425
56426 /**
56427  * Returns a list of all routes included in the invoice as the underlying hints
56428  */
56429 MUST_USE_RES struct LDKCVec_RouteHintZ Bolt11Invoice_route_hints(const struct LDKBolt11Invoice *NONNULL_PTR this_arg);
56430
56431 /**
56432  * Returns the currency for which the invoice was issued
56433  */
56434 MUST_USE_RES enum LDKCurrency Bolt11Invoice_currency(const struct LDKBolt11Invoice *NONNULL_PTR this_arg);
56435
56436 /**
56437  * Returns the amount if specified in the invoice as millisatoshis.
56438  */
56439 MUST_USE_RES struct LDKCOption_u64Z Bolt11Invoice_amount_milli_satoshis(const struct LDKBolt11Invoice *NONNULL_PTR this_arg);
56440
56441 /**
56442  * Creates a new `Description` if `description` is at most 1023 __bytes__ long,
56443  * returns [`CreationError::DescriptionTooLong`] otherwise
56444  *
56445  * Please note that single characters may use more than one byte due to UTF8 encoding.
56446  */
56447 MUST_USE_RES struct LDKCResult_DescriptionCreationErrorZ Description_new(struct LDKStr description);
56448
56449 /**
56450  * Returns the underlying description [`UntrustedString`]
56451  */
56452 MUST_USE_RES struct LDKUntrustedString Description_into_inner(struct LDKDescription this_arg);
56453
56454 /**
56455  * Get the string representation of a Description object
56456  */
56457 struct LDKStr Description_to_str(const struct LDKDescription *NONNULL_PTR o);
56458
56459 /**
56460  * Construct an `ExpiryTime` from seconds.
56461  */
56462 MUST_USE_RES struct LDKExpiryTime ExpiryTime_from_seconds(uint64_t seconds);
56463
56464 /**
56465  * Construct an `ExpiryTime` from a [`Duration`], dropping the sub-second part.
56466  */
56467 MUST_USE_RES struct LDKExpiryTime ExpiryTime_from_duration(uint64_t duration);
56468
56469 /**
56470  * Returns the expiry time in seconds
56471  */
56472 MUST_USE_RES uint64_t ExpiryTime_as_seconds(const struct LDKExpiryTime *NONNULL_PTR this_arg);
56473
56474 /**
56475  * Returns a reference to the underlying [`Duration`] (=expiry time)
56476  */
56477 MUST_USE_RES uint64_t ExpiryTime_as_duration(const struct LDKExpiryTime *NONNULL_PTR this_arg);
56478
56479 /**
56480  * Creates a new (partial) route from a list of hops
56481  */
56482 MUST_USE_RES struct LDKCResult_PrivateRouteCreationErrorZ PrivateRoute_new(struct LDKRouteHint hops);
56483
56484 /**
56485  * Returns the underlying list of hops
56486  */
56487 MUST_USE_RES struct LDKRouteHint PrivateRoute_into_inner(struct LDKPrivateRoute this_arg);
56488
56489 /**
56490  * Creates a copy of the CreationError
56491  */
56492 enum LDKCreationError CreationError_clone(const enum LDKCreationError *NONNULL_PTR orig);
56493
56494 /**
56495  * Utility method to constructs a new DescriptionTooLong-variant CreationError
56496  */
56497 enum LDKCreationError CreationError_description_too_long(void);
56498
56499 /**
56500  * Utility method to constructs a new RouteTooLong-variant CreationError
56501  */
56502 enum LDKCreationError CreationError_route_too_long(void);
56503
56504 /**
56505  * Utility method to constructs a new TimestampOutOfBounds-variant CreationError
56506  */
56507 enum LDKCreationError CreationError_timestamp_out_of_bounds(void);
56508
56509 /**
56510  * Utility method to constructs a new InvalidAmount-variant CreationError
56511  */
56512 enum LDKCreationError CreationError_invalid_amount(void);
56513
56514 /**
56515  * Utility method to constructs a new MissingRouteHints-variant CreationError
56516  */
56517 enum LDKCreationError CreationError_missing_route_hints(void);
56518
56519 /**
56520  * Utility method to constructs a new MinFinalCltvExpiryDeltaTooShort-variant CreationError
56521  */
56522 enum LDKCreationError CreationError_min_final_cltv_expiry_delta_too_short(void);
56523
56524 /**
56525  * Checks if two CreationErrors contain equal inner contents.
56526  * This ignores pointers and is_owned flags and looks at the values in fields.
56527  */
56528 bool CreationError_eq(const enum LDKCreationError *NONNULL_PTR a, const enum LDKCreationError *NONNULL_PTR b);
56529
56530 /**
56531  * Get the string representation of a CreationError object
56532  */
56533 struct LDKStr CreationError_to_str(const enum LDKCreationError *NONNULL_PTR o);
56534
56535 /**
56536  * Creates a copy of the Bolt11SemanticError
56537  */
56538 enum LDKBolt11SemanticError Bolt11SemanticError_clone(const enum LDKBolt11SemanticError *NONNULL_PTR orig);
56539
56540 /**
56541  * Utility method to constructs a new NoPaymentHash-variant Bolt11SemanticError
56542  */
56543 enum LDKBolt11SemanticError Bolt11SemanticError_no_payment_hash(void);
56544
56545 /**
56546  * Utility method to constructs a new MultiplePaymentHashes-variant Bolt11SemanticError
56547  */
56548 enum LDKBolt11SemanticError Bolt11SemanticError_multiple_payment_hashes(void);
56549
56550 /**
56551  * Utility method to constructs a new NoDescription-variant Bolt11SemanticError
56552  */
56553 enum LDKBolt11SemanticError Bolt11SemanticError_no_description(void);
56554
56555 /**
56556  * Utility method to constructs a new MultipleDescriptions-variant Bolt11SemanticError
56557  */
56558 enum LDKBolt11SemanticError Bolt11SemanticError_multiple_descriptions(void);
56559
56560 /**
56561  * Utility method to constructs a new NoPaymentSecret-variant Bolt11SemanticError
56562  */
56563 enum LDKBolt11SemanticError Bolt11SemanticError_no_payment_secret(void);
56564
56565 /**
56566  * Utility method to constructs a new MultiplePaymentSecrets-variant Bolt11SemanticError
56567  */
56568 enum LDKBolt11SemanticError Bolt11SemanticError_multiple_payment_secrets(void);
56569
56570 /**
56571  * Utility method to constructs a new InvalidFeatures-variant Bolt11SemanticError
56572  */
56573 enum LDKBolt11SemanticError Bolt11SemanticError_invalid_features(void);
56574
56575 /**
56576  * Utility method to constructs a new InvalidRecoveryId-variant Bolt11SemanticError
56577  */
56578 enum LDKBolt11SemanticError Bolt11SemanticError_invalid_recovery_id(void);
56579
56580 /**
56581  * Utility method to constructs a new InvalidSignature-variant Bolt11SemanticError
56582  */
56583 enum LDKBolt11SemanticError Bolt11SemanticError_invalid_signature(void);
56584
56585 /**
56586  * Utility method to constructs a new ImpreciseAmount-variant Bolt11SemanticError
56587  */
56588 enum LDKBolt11SemanticError Bolt11SemanticError_imprecise_amount(void);
56589
56590 /**
56591  * Checks if two Bolt11SemanticErrors contain equal inner contents.
56592  * This ignores pointers and is_owned flags and looks at the values in fields.
56593  */
56594 bool Bolt11SemanticError_eq(const enum LDKBolt11SemanticError *NONNULL_PTR a, const enum LDKBolt11SemanticError *NONNULL_PTR b);
56595
56596 /**
56597  * Get the string representation of a Bolt11SemanticError object
56598  */
56599 struct LDKStr Bolt11SemanticError_to_str(const enum LDKBolt11SemanticError *NONNULL_PTR o);
56600
56601 /**
56602  * Frees any resources used by the SignOrCreationError
56603  */
56604 void SignOrCreationError_free(struct LDKSignOrCreationError this_ptr);
56605
56606 /**
56607  * Creates a copy of the SignOrCreationError
56608  */
56609 struct LDKSignOrCreationError SignOrCreationError_clone(const struct LDKSignOrCreationError *NONNULL_PTR orig);
56610
56611 /**
56612  * Utility method to constructs a new SignError-variant SignOrCreationError
56613  */
56614 struct LDKSignOrCreationError SignOrCreationError_sign_error(void);
56615
56616 /**
56617  * Utility method to constructs a new CreationError-variant SignOrCreationError
56618  */
56619 struct LDKSignOrCreationError SignOrCreationError_creation_error(enum LDKCreationError a);
56620
56621 /**
56622  * Checks if two SignOrCreationErrors contain equal inner contents.
56623  * This ignores pointers and is_owned flags and looks at the values in fields.
56624  */
56625 bool SignOrCreationError_eq(const struct LDKSignOrCreationError *NONNULL_PTR a, const struct LDKSignOrCreationError *NONNULL_PTR b);
56626
56627 /**
56628  * Get the string representation of a SignOrCreationError object
56629  */
56630 struct LDKStr SignOrCreationError_to_str(const struct LDKSignOrCreationError *NONNULL_PTR o);
56631
56632 /**
56633  * Builds the necessary parameters to pay or pre-flight probe the given zero-amount
56634  * [`Bolt11Invoice`] using [`ChannelManager::send_payment`] or
56635  * [`ChannelManager::send_preflight_probes`].
56636  *
56637  * Prior to paying, you must ensure that the [`Bolt11Invoice::payment_hash`] is unique and the
56638  * same [`PaymentHash`] has never been paid before.
56639  *
56640  * Will always succeed unless the invoice has an amount specified, in which case
56641  * [`payment_parameters_from_invoice`] should be used.
56642  *
56643  * [`ChannelManager::send_payment`]: lightning::ln::channelmanager::ChannelManager::send_payment
56644  * [`ChannelManager::send_preflight_probes`]: lightning::ln::channelmanager::ChannelManager::send_preflight_probes
56645  */
56646 struct LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ payment_parameters_from_zero_amount_invoice(const struct LDKBolt11Invoice *NONNULL_PTR invoice, uint64_t amount_msat);
56647
56648 /**
56649  * Builds the necessary parameters to pay or pre-flight probe the given [`Bolt11Invoice`] using
56650  * [`ChannelManager::send_payment`] or [`ChannelManager::send_preflight_probes`].
56651  *
56652  * Prior to paying, you must ensure that the [`Bolt11Invoice::payment_hash`] is unique and the
56653  * same [`PaymentHash`] has never been paid before.
56654  *
56655  * Will always succeed unless the invoice has no amount specified, in which case
56656  * [`payment_parameters_from_zero_amount_invoice`] should be used.
56657  *
56658  * [`ChannelManager::send_payment`]: lightning::ln::channelmanager::ChannelManager::send_payment
56659  * [`ChannelManager::send_preflight_probes`]: lightning::ln::channelmanager::ChannelManager::send_preflight_probes
56660  */
56661 struct LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ payment_parameters_from_invoice(const struct LDKBolt11Invoice *NONNULL_PTR invoice);
56662
56663 /**
56664  * Utility to create an invoice that can be paid to one of multiple nodes, or a \"phantom invoice.\"
56665  * See [`PhantomKeysManager`] for more information on phantom node payments.
56666  *
56667  * `phantom_route_hints` parameter:
56668  * * Contains channel info for all nodes participating in the phantom invoice
56669  * * Entries are retrieved from a call to [`ChannelManager::get_phantom_route_hints`] on each
56670  *   participating node
56671  * * It is fine to cache `phantom_route_hints` and reuse it across invoices, as long as the data is
56672  *   updated when a channel becomes disabled or closes
56673  * * Note that if too many channels are included in [`PhantomRouteHints::channels`], the invoice
56674  *   may be too long for QR code scanning. To fix this, `PhantomRouteHints::channels` may be pared
56675  *   down
56676  *
56677  * `payment_hash` can be specified if you have a specific need for a custom payment hash (see the difference
56678  * between [`ChannelManager::create_inbound_payment`] and [`ChannelManager::create_inbound_payment_for_hash`]).
56679  * If `None` is provided for `payment_hash`, then one will be created.
56680  *
56681  * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
56682  * in excess of the current time.
56683  *
56684  * `duration_since_epoch` is the current time since epoch in seconds.
56685  *
56686  * You can specify a custom `min_final_cltv_expiry_delta`, or let LDK default it to
56687  * [`MIN_FINAL_CLTV_EXPIRY_DELTA`]. The provided expiry must be at least [`MIN_FINAL_CLTV_EXPIRY_DELTA`] - 3.
56688  * Note that LDK will add a buffer of 3 blocks to the delta to allow for up to a few new block
56689  * confirmations during routing.
56690  *
56691  * Note that the provided `keys_manager`'s `NodeSigner` implementation must support phantom
56692  * invoices in its `sign_invoice` implementation ([`PhantomKeysManager`] satisfies this
56693  * requirement).
56694  *
56695  * [`PhantomKeysManager`]: lightning::sign::PhantomKeysManager
56696  * [`ChannelManager::get_phantom_route_hints`]: lightning::ln::channelmanager::ChannelManager::get_phantom_route_hints
56697  * [`ChannelManager::create_inbound_payment`]: lightning::ln::channelmanager::ChannelManager::create_inbound_payment
56698  * [`ChannelManager::create_inbound_payment_for_hash`]: lightning::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
56699  * [`PhantomRouteHints::channels`]: lightning::ln::channelmanager::PhantomRouteHints::channels
56700  * [`MIN_FINAL_CLTV_EXPIRY_DETLA`]: lightning::ln::channelmanager::MIN_FINAL_CLTV_EXPIRY_DELTA
56701  *
56702  * This can be used in a `no_std` environment, where [`std::time::SystemTime`] is not
56703  * available and the current time is supplied by the caller.
56704  */
56705 struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ create_phantom_invoice(struct LDKCOption_u64Z amt_msat, struct LDKCOption_ThirtyTwoBytesZ 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);
56706
56707 /**
56708  * Utility to create an invoice that can be paid to one of multiple nodes, or a \"phantom invoice.\"
56709  * See [`PhantomKeysManager`] for more information on phantom node payments.
56710  *
56711  * `phantom_route_hints` parameter:
56712  * * Contains channel info for all nodes participating in the phantom invoice
56713  * * Entries are retrieved from a call to [`ChannelManager::get_phantom_route_hints`] on each
56714  *   participating node
56715  * * It is fine to cache `phantom_route_hints` and reuse it across invoices, as long as the data is
56716  *   updated when a channel becomes disabled or closes
56717  * * Note that the route hints generated from `phantom_route_hints` will be limited to a maximum
56718  *   of 3 hints to ensure that the invoice can be scanned in a QR code. These hints are selected
56719  *   in the order that the nodes in `PhantomRouteHints` are specified, selecting one hint per node
56720  *   until the maximum is hit. Callers may provide as many `PhantomRouteHints::channels` as
56721  *   desired, but note that some nodes will be trimmed if more than 3 nodes are provided.
56722  *
56723  * `description_hash` is a SHA-256 hash of the description text
56724  *
56725  * `payment_hash` can be specified if you have a specific need for a custom payment hash (see the difference
56726  * between [`ChannelManager::create_inbound_payment`] and [`ChannelManager::create_inbound_payment_for_hash`]).
56727  * If `None` is provided for `payment_hash`, then one will be created.
56728  *
56729  * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
56730  * in excess of the current time.
56731  *
56732  * `duration_since_epoch` is the current time since epoch in seconds.
56733  *
56734  * Note that the provided `keys_manager`'s `NodeSigner` implementation must support phantom
56735  * invoices in its `sign_invoice` implementation ([`PhantomKeysManager`] satisfies this
56736  * requirement).
56737  *
56738  * [`PhantomKeysManager`]: lightning::sign::PhantomKeysManager
56739  * [`ChannelManager::get_phantom_route_hints`]: lightning::ln::channelmanager::ChannelManager::get_phantom_route_hints
56740  * [`ChannelManager::create_inbound_payment`]: lightning::ln::channelmanager::ChannelManager::create_inbound_payment
56741  * [`ChannelManager::create_inbound_payment_for_hash`]: lightning::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
56742  * [`PhantomRouteHints::channels`]: lightning::ln::channelmanager::PhantomRouteHints::channels
56743  *
56744  * This can be used in a `no_std` environment, where [`std::time::SystemTime`] is not
56745  * available and the current time is supplied by the caller.
56746  */
56747 struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ create_phantom_invoice_with_description_hash(struct LDKCOption_u64Z amt_msat, struct LDKCOption_ThirtyTwoBytesZ 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);
56748
56749 /**
56750  * Utility to construct an invoice. Generally, unless you want to do something like a custom
56751  * cltv_expiry, this is what you should be using to create an invoice. The reason being, this
56752  * method stores the invoice's payment secret and preimage in `ChannelManager`, so (a) the user
56753  * doesn't have to store preimage/payment secret information and (b) `ChannelManager` can verify
56754  * that the payment secret is valid when the invoice is paid.
56755  *
56756  * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
56757  * in excess of the current time.
56758  *
56759  * You can specify a custom `min_final_cltv_expiry_delta`, or let LDK default it to
56760  * [`MIN_FINAL_CLTV_EXPIRY_DELTA`]. The provided expiry must be at least [`MIN_FINAL_CLTV_EXPIRY_DELTA`].
56761  * Note that LDK will add a buffer of 3 blocks to the delta to allow for up to a few new block
56762  * confirmations during routing.
56763  *
56764  * [`MIN_FINAL_CLTV_EXPIRY_DETLA`]: lightning::ln::channelmanager::MIN_FINAL_CLTV_EXPIRY_DELTA
56765  */
56766 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);
56767
56768 /**
56769  * Utility to construct an invoice. Generally, unless you want to do something like a custom
56770  * cltv_expiry, this is what you should be using to create an invoice. The reason being, this
56771  * method stores the invoice's payment secret and preimage in `ChannelManager`, so (a) the user
56772  * doesn't have to store preimage/payment secret information and (b) `ChannelManager` can verify
56773  * that the payment secret is valid when the invoice is paid.
56774  * Use this variant if you want to pass the `description_hash` to the invoice.
56775  *
56776  * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
56777  * in excess of the current time.
56778  *
56779  * You can specify a custom `min_final_cltv_expiry_delta`, or let LDK default it to
56780  * [`MIN_FINAL_CLTV_EXPIRY_DELTA`]. The provided expiry must be at least [`MIN_FINAL_CLTV_EXPIRY_DELTA`].
56781  * Note that LDK will add a buffer of 3 blocks to the delta to allow for up to a few new block
56782  * confirmations during routing.
56783  *
56784  * [`MIN_FINAL_CLTV_EXPIRY_DETLA`]: lightning::ln::channelmanager::MIN_FINAL_CLTV_EXPIRY_DELTA
56785  */
56786 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);
56787
56788 /**
56789  * See [`create_invoice_from_channelmanager_with_description_hash`]
56790  * This version can be used in a `no_std` environment, where [`std::time::SystemTime`] is not
56791  * available and the current time is supplied by the caller.
56792  */
56793 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);
56794
56795 /**
56796  * See [`create_invoice_from_channelmanager`]
56797  * This version can be used in a `no_std` environment, where [`std::time::SystemTime`] is not
56798  * available and the current time is supplied by the caller.
56799  */
56800 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);
56801
56802 /**
56803  * See [`create_invoice_from_channelmanager_and_duration_since_epoch`]
56804  * This version allows for providing a custom [`PaymentHash`] for the invoice.
56805  * This may be useful if you're building an on-chain swap or involving another protocol where
56806  * the payment hash is also involved outside the scope of lightning.
56807  */
56808 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);
56809
56810 /**
56811  * Read a SiPrefix object from a string
56812  */
56813 struct LDKCResult_SiPrefixBolt11ParseErrorZ SiPrefix_from_str(struct LDKStr s);
56814
56815 /**
56816  * Read a Bolt11Invoice object from a string
56817  */
56818 struct LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ Bolt11Invoice_from_str(struct LDKStr s);
56819
56820 /**
56821  * Read a SignedRawBolt11Invoice object from a string
56822  */
56823 struct LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ SignedRawBolt11Invoice_from_str(struct LDKStr s);
56824
56825 /**
56826  * Get the string representation of a Bolt11ParseError object
56827  */
56828 struct LDKStr Bolt11ParseError_to_str(const struct LDKBolt11ParseError *NONNULL_PTR o);
56829
56830 /**
56831  * Get the string representation of a ParseOrSemanticError object
56832  */
56833 struct LDKStr ParseOrSemanticError_to_str(const struct LDKParseOrSemanticError *NONNULL_PTR o);
56834
56835 /**
56836  * Get the string representation of a Bolt11Invoice object
56837  */
56838 struct LDKStr Bolt11Invoice_to_str(const struct LDKBolt11Invoice *NONNULL_PTR o);
56839
56840 /**
56841  * Get the string representation of a SignedRawBolt11Invoice object
56842  */
56843 struct LDKStr SignedRawBolt11Invoice_to_str(const struct LDKSignedRawBolt11Invoice *NONNULL_PTR o);
56844
56845 /**
56846  * Get the string representation of a Currency object
56847  */
56848 struct LDKStr Currency_to_str(const enum LDKCurrency *NONNULL_PTR o);
56849
56850 /**
56851  * Get the string representation of a SiPrefix object
56852  */
56853 struct LDKStr SiPrefix_to_str(const enum LDKSiPrefix *NONNULL_PTR o);
56854
56855 /**
56856  * Frees any resources used by the GraphSyncError
56857  */
56858 void GraphSyncError_free(struct LDKGraphSyncError this_ptr);
56859
56860 /**
56861  * Creates a copy of the GraphSyncError
56862  */
56863 struct LDKGraphSyncError GraphSyncError_clone(const struct LDKGraphSyncError *NONNULL_PTR orig);
56864
56865 /**
56866  * Utility method to constructs a new DecodeError-variant GraphSyncError
56867  */
56868 struct LDKGraphSyncError GraphSyncError_decode_error(struct LDKDecodeError a);
56869
56870 /**
56871  * Utility method to constructs a new LightningError-variant GraphSyncError
56872  */
56873 struct LDKGraphSyncError GraphSyncError_lightning_error(struct LDKLightningError a);
56874
56875 /**
56876  * Frees any resources used by the RapidGossipSync, if is_owned is set and inner is non-NULL.
56877  */
56878 void RapidGossipSync_free(struct LDKRapidGossipSync this_obj);
56879
56880 /**
56881  * Instantiate a new [`RapidGossipSync`] instance.
56882  */
56883 MUST_USE_RES struct LDKRapidGossipSync RapidGossipSync_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKLogger logger);
56884
56885 /**
56886  * Sync gossip data from a file.
56887  * Returns the last sync timestamp to be used the next time rapid sync data is queried.
56888  *
56889  * `network_graph`: The network graph to apply the updates to
56890  *
56891  * `sync_path`: Path to the file where the gossip update data is located
56892  *
56893  */
56894 MUST_USE_RES struct LDKCResult_u32GraphSyncErrorZ RapidGossipSync_sync_network_graph_with_file_path(const struct LDKRapidGossipSync *NONNULL_PTR this_arg, struct LDKStr sync_path);
56895
56896 /**
56897  * Update network graph from binary data.
56898  * Returns the last sync timestamp to be used the next time rapid sync data is queried.
56899  *
56900  * `update_data`: `&[u8]` binary stream that comprises the update data
56901  */
56902 MUST_USE_RES struct LDKCResult_u32GraphSyncErrorZ RapidGossipSync_update_network_graph(const struct LDKRapidGossipSync *NONNULL_PTR this_arg, struct LDKu8slice update_data);
56903
56904 /**
56905  * Update network graph from binary data.
56906  * Returns the last sync timestamp to be used the next time rapid sync data is queried.
56907  *
56908  * `update_data`: `&[u8]` binary stream that comprises the update data
56909  * `current_time_unix`: `Option<u64>` optional current timestamp to verify data age
56910  */
56911 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);
56912
56913 /**
56914  * Returns whether a rapid gossip sync has completed at least once.
56915  */
56916 MUST_USE_RES bool RapidGossipSync_is_initial_sync_complete(const struct LDKRapidGossipSync *NONNULL_PTR this_arg);
56917
56918 #endif /* LDK_C_BINDINGS_H */
56919
56920 #include "ldk_ver.h"