1 /* Text to put at the beginning of the generated file. Probably a license. */
3 /* Generated with cbindgen:0.14.4 */
5 /* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */
13 * An error when accessing the chain via [`Access`].
15 * [`Access`]: trait.Access.html
17 typedef enum LDKAccessError {
19 * The requested chain is unknown.
21 LDKAccessError_UnknownChain,
23 * The requested transaction doesn't exist or hasn't confirmed.
25 LDKAccessError_UnknownTx,
27 * Must be last for serialization purposes
29 LDKAccessError_Sentinel,
33 * An error enum representing a failure to persist a channel monitor update.
35 typedef enum LDKChannelMonitorUpdateErr {
37 * Used to indicate a temporary failure (eg connection to a watchtower or remote backup of
38 * our state failed, but is expected to succeed at some point in the future).
40 * Such a failure will \"freeze\" a channel, preventing us from revoking old states or
41 * submitting new commitment transactions to the counterparty. Once the update(s) which failed
42 * have been successfully applied, ChannelManager::channel_monitor_updated can be used to
43 * restore the channel to an operational state.
45 * Note that a given ChannelManager will *never* re-generate a given ChannelMonitorUpdate. If
46 * you return a TemporaryFailure you must ensure that it is written to disk safely before
47 * writing out the latest ChannelManager state.
49 * Even when a channel has been \"frozen\" updates to the ChannelMonitor can continue to occur
50 * (eg if an inbound HTLC which we forwarded was claimed upstream resulting in us attempting
51 * to claim it on this channel) and those updates must be applied wherever they can be. At
52 * least one such updated ChannelMonitor must be persisted otherwise PermanentFailure should
53 * be returned to get things on-chain ASAP using only the in-memory copy. Obviously updates to
54 * the channel which would invalidate previous ChannelMonitors are not made when a channel has
57 * Note that even if updates made after TemporaryFailure succeed you must still call
58 * channel_monitor_updated to ensure you have the latest monitor and re-enable normal channel
61 * Note that the update being processed here will not be replayed for you when you call
62 * ChannelManager::channel_monitor_updated, so you must store the update itself along
63 * with the persisted ChannelMonitor on your own local disk prior to returning a
64 * TemporaryFailure. You may, of course, employ a journaling approach, storing only the
65 * ChannelMonitorUpdate on disk without updating the monitor itself, replaying the journal at
68 * For deployments where a copy of ChannelMonitors and other local state are backed up in a
69 * remote location (with local copies persisted immediately), it is anticipated that all
70 * updates will return TemporaryFailure until the remote copies could be updated.
72 LDKChannelMonitorUpdateErr_TemporaryFailure,
74 * Used to indicate no further channel monitor updates will be allowed (eg we've moved on to a
75 * different watchtower and cannot update with all watchtowers that were previously informed
78 * At reception of this error, ChannelManager will force-close the channel and return at
79 * least a final ChannelMonitorUpdate::ChannelForceClosed which must be delivered to at
80 * least one ChannelMonitor copy. Revocation secret MUST NOT be released and offchain channel
81 * update must be rejected.
83 * This failure may also signal a failure to update the local persisted copy of one of
84 * the channel monitor instance.
86 * Note that even when you fail a holder commitment transaction update, you must store the
87 * update to ensure you can claim from it in case of a duplicate copy of this ChannelMonitor
88 * broadcasts it (e.g distributed channel-monitor deployment)
90 * In case of distributed watchtowers deployment, the new version must be written to disk, as
91 * state may have been stored but rejected due to a block forcing a commitment broadcast. This
92 * storage is used to claim outputs of rejected state confirmed onchain by another watchtower,
93 * lagging behind on block processing.
95 LDKChannelMonitorUpdateErr_PermanentFailure,
97 * Must be last for serialization purposes
99 LDKChannelMonitorUpdateErr_Sentinel,
100 } LDKChannelMonitorUpdateErr;
103 * An enum that represents the speed at which we want a transaction to confirm used for feerate
106 typedef enum LDKConfirmationTarget {
108 * We are happy with this transaction confirming slowly when feerate drops some.
110 LDKConfirmationTarget_Background,
112 * We'd like this transaction to confirm without major delay, but 12-18 blocks is fine.
114 LDKConfirmationTarget_Normal,
116 * We'd like this transaction to confirm in the next few blocks.
118 LDKConfirmationTarget_HighPriority,
120 * Must be last for serialization purposes
122 LDKConfirmationTarget_Sentinel,
123 } LDKConfirmationTarget;
126 * An enum representing the available verbosity levels of the logger.
128 typedef enum LDKLevel {
130 *Designates logger being silent
134 * Designates very serious errors
138 * Designates hazardous situations
142 * Designates useful information
146 * Designates lower priority information
150 * Designates very low priority, often extremely verbose, information
154 * Must be last for serialization purposes
159 typedef enum LDKNetwork {
164 * Must be last for serialization purposes
169 typedef enum LDKSecp256k1Error {
170 LDKSecp256k1Error_IncorrectSignature,
171 LDKSecp256k1Error_InvalidMessage,
172 LDKSecp256k1Error_InvalidPublicKey,
173 LDKSecp256k1Error_InvalidSignature,
174 LDKSecp256k1Error_InvalidSecretKey,
175 LDKSecp256k1Error_InvalidRecoveryId,
176 LDKSecp256k1Error_InvalidTweak,
177 LDKSecp256k1Error_NotEnoughMemory,
178 LDKSecp256k1Error_CallbackPanicked,
180 * Must be last for serialization purposes
182 LDKSecp256k1Error_Sentinel,
186 * A serialized transaction, in (pointer, length) form.
188 * This type optionally owns its own memory, and thus the semantics around access change based on
189 * the `data_is_owned` flag. If `data_is_owned` is set, you must call `Transaction_free` to free
190 * the underlying buffer before the object goes out of scope. If `data_is_owned` is not set, any
191 * access to the buffer after the scope in which the object was provided to you is invalid. eg,
192 * access after you return from the call in which a `!data_is_owned` `Transaction` is provided to
193 * you would be invalid.
195 * Note that, while it may change in the future, because transactions on the Rust side are stored
196 * in a deserialized form, all `Transaction`s generated on the Rust side will have `data_is_owned`
197 * set. Similarly, while it may change in the future, all `Transaction`s you pass to Rust may have
198 * `data_is_owned` either set or unset at your discretion.
200 typedef struct LDKTransaction {
202 * This is non-const for your convenience, an object passed to Rust is never written to.
209 typedef struct LDKCVecTempl_u8 {
214 typedef LDKCVecTempl_u8 LDKCVec_u8Z;
217 * A transaction output including a scriptPubKey and value.
218 * This type *does* own its own memory, so must be free'd appropriately.
220 typedef struct LDKTxOut {
221 LDKCVec_u8Z script_pubkey;
225 typedef struct LDKC2TupleTempl_usize__Transaction {
228 } LDKC2TupleTempl_usize__Transaction;
230 typedef LDKC2TupleTempl_usize__Transaction LDKC2Tuple_usizeTransactionZ;
232 typedef union LDKCResultPtr_u8__ChannelMonitorUpdateErr {
234 LDKChannelMonitorUpdateErr *err;
235 } LDKCResultPtr_u8__ChannelMonitorUpdateErr;
237 typedef struct LDKCResultTempl_u8__ChannelMonitorUpdateErr {
238 LDKCResultPtr_u8__ChannelMonitorUpdateErr contents;
240 } LDKCResultTempl_u8__ChannelMonitorUpdateErr;
242 typedef LDKCResultTempl_u8__ChannelMonitorUpdateErr LDKCResult_NoneChannelMonitorUpdateErrZ;
247 * General Err type for ChannelMonitor actions. Generally, this implies that the data provided is
248 * inconsistent with the ChannelMonitor being called. eg for ChannelMonitor::update_monitor this
249 * means you tried to update a monitor for a different channel or the ChannelMonitorUpdate was
251 * Contains a developer-readable error message.
253 typedef struct MUST_USE_STRUCT LDKMonitorUpdateError {
255 * Nearly everywhere, inner must be non-null, however in places where
256 * the Rust equivalent takes an Option, it may be set to null to indicate None.
258 LDKnativeMonitorUpdateError *inner;
260 } LDKMonitorUpdateError;
262 typedef union LDKCResultPtr_u8__MonitorUpdateError {
264 LDKMonitorUpdateError *err;
265 } LDKCResultPtr_u8__MonitorUpdateError;
267 typedef struct LDKCResultTempl_u8__MonitorUpdateError {
268 LDKCResultPtr_u8__MonitorUpdateError contents;
270 } LDKCResultTempl_u8__MonitorUpdateError;
272 typedef LDKCResultTempl_u8__MonitorUpdateError LDKCResult_NoneMonitorUpdateErrorZ;
277 * A reference to a transaction output.
279 * Differs from bitcoin::blockdata::transaction::OutPoint as the index is a u16 instead of u32
280 * due to LN's restrictions on index values. Should reduce (possibly) unsafe conversions this way.
282 typedef struct MUST_USE_STRUCT LDKOutPoint {
284 * Nearly everywhere, inner must be non-null, however in places where
285 * the Rust equivalent takes an Option, it may be set to null to indicate None.
287 LDKnativeOutPoint *inner;
291 typedef struct LDKC2TupleTempl_OutPoint__CVec_u8Z {
294 } LDKC2TupleTempl_OutPoint__CVec_u8Z;
296 typedef LDKC2TupleTempl_OutPoint__CVec_u8Z LDKC2Tuple_OutPointScriptZ;
298 typedef struct LDKC2TupleTempl_u32__TxOut {
301 } LDKC2TupleTempl_u32__TxOut;
303 typedef LDKC2TupleTempl_u32__TxOut LDKC2Tuple_u32TxOutZ;
306 * Arbitrary 32 bytes, which could represent one of a few different things. You probably want to
307 * look up the corresponding function in rust-lightning's docs.
309 typedef struct LDKThirtyTwoBytes {
313 typedef struct LDKCVecTempl_C2TupleTempl_u32__TxOut {
314 LDKC2TupleTempl_u32__TxOut *data;
316 } LDKCVecTempl_C2TupleTempl_u32__TxOut;
318 typedef struct LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_C2TupleTempl_u32__TxOut {
320 LDKCVecTempl_C2TupleTempl_u32__TxOut b;
321 } LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_C2TupleTempl_u32__TxOut;
323 typedef LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_C2TupleTempl_u32__TxOut LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ;
325 typedef LDKCVecTempl_C2TupleTempl_u32__TxOut LDKCVec_C2Tuple_u32TxOutZZ;
327 typedef struct LDKC2TupleTempl_u64__u64 {
330 } LDKC2TupleTempl_u64__u64;
332 typedef LDKC2TupleTempl_u64__u64 LDKC2Tuple_u64u64Z;
334 typedef struct LDKSignature {
335 uint8_t compact_form[64];
338 typedef struct LDKCVecTempl_Signature {
341 } LDKCVecTempl_Signature;
343 typedef struct LDKC2TupleTempl_Signature__CVecTempl_Signature {
345 LDKCVecTempl_Signature b;
346 } LDKC2TupleTempl_Signature__CVecTempl_Signature;
348 typedef LDKC2TupleTempl_Signature__CVecTempl_Signature LDKC2Tuple_SignatureCVec_SignatureZZ;
350 typedef LDKCVecTempl_Signature LDKCVec_SignatureZ;
352 typedef union LDKCResultPtr_C2TupleTempl_Signature__CVecTempl_Signature________u8 {
353 LDKC2TupleTempl_Signature__CVecTempl_Signature *result;
355 } LDKCResultPtr_C2TupleTempl_Signature__CVecTempl_Signature________u8;
357 typedef struct LDKCResultTempl_C2TupleTempl_Signature__CVecTempl_Signature________u8 {
358 LDKCResultPtr_C2TupleTempl_Signature__CVecTempl_Signature________u8 contents;
360 } LDKCResultTempl_C2TupleTempl_Signature__CVecTempl_Signature________u8;
362 typedef LDKCResultTempl_C2TupleTempl_Signature__CVecTempl_Signature________u8 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ;
364 typedef union LDKCResultPtr_Signature__u8 {
365 LDKSignature *result;
367 } LDKCResultPtr_Signature__u8;
369 typedef struct LDKCResultTempl_Signature__u8 {
370 LDKCResultPtr_Signature__u8 contents;
372 } LDKCResultTempl_Signature__u8;
374 typedef LDKCResultTempl_Signature__u8 LDKCResult_SignatureNoneZ;
376 typedef union LDKCResultPtr_CVecTempl_Signature_____u8 {
377 LDKCVecTempl_Signature *result;
379 } LDKCResultPtr_CVecTempl_Signature_____u8;
381 typedef struct LDKCResultTempl_CVecTempl_Signature_____u8 {
382 LDKCResultPtr_CVecTempl_Signature_____u8 contents;
384 } LDKCResultTempl_CVecTempl_Signature_____u8;
386 typedef LDKCResultTempl_CVecTempl_Signature_____u8 LDKCResult_CVec_SignatureZNoneZ;
389 * A Rust str object, ie a reference to a UTF8-valid string.
390 * This is *not* null-terminated so cannot be used directly as a C string!
392 typedef struct LDKStr {
393 const uint8_t *chars;
398 * Indicates an error on the client's part (usually some variant of attempting to use too-low or
401 typedef enum LDKAPIError_Tag {
403 * Indicates the API was wholly misused (see err for more). Cases where these can be returned
404 * are documented, but generally indicates some precondition of a function was violated.
406 LDKAPIError_APIMisuseError,
408 * Due to a high feerate, we were unable to complete the request.
409 * For example, this may be returned if the feerate implies we cannot open a channel at the
410 * requested value, but opening a larger channel would succeed.
412 LDKAPIError_FeeRateTooHigh,
414 * A malformed Route was provided (eg overflowed value, node id mismatch, overly-looped route,
415 * too-many-hops, etc).
417 LDKAPIError_RouteError,
419 * We were unable to complete the request as the Channel required to do so is unable to
420 * complete the request (or was not found). This can take many forms, including disconnected
421 * peer, channel at capacity, channel shutting down, etc.
423 LDKAPIError_ChannelUnavailable,
425 * An attempt to call watch/update_channel returned an Err (ie you did this!), causing the
426 * attempted action to fail.
428 LDKAPIError_MonitorUpdateFailed,
430 * Must be last for serialization purposes
432 LDKAPIError_Sentinel,
435 typedef struct LDKAPIError_LDKAPIMisuseError_Body {
437 } LDKAPIError_LDKAPIMisuseError_Body;
439 typedef struct LDKAPIError_LDKFeeRateTooHigh_Body {
442 } LDKAPIError_LDKFeeRateTooHigh_Body;
444 typedef struct LDKAPIError_LDKRouteError_Body {
446 } LDKAPIError_LDKRouteError_Body;
448 typedef struct LDKAPIError_LDKChannelUnavailable_Body {
450 } LDKAPIError_LDKChannelUnavailable_Body;
452 typedef struct LDKAPIError {
455 LDKAPIError_LDKAPIMisuseError_Body api_misuse_error;
456 LDKAPIError_LDKFeeRateTooHigh_Body fee_rate_too_high;
457 LDKAPIError_LDKRouteError_Body route_error;
458 LDKAPIError_LDKChannelUnavailable_Body channel_unavailable;
462 typedef union LDKCResultPtr_u8__APIError {
465 } LDKCResultPtr_u8__APIError;
467 typedef struct LDKCResultTempl_u8__APIError {
468 LDKCResultPtr_u8__APIError contents;
470 } LDKCResultTempl_u8__APIError;
472 typedef LDKCResultTempl_u8__APIError LDKCResult_NoneAPIErrorZ;
477 * If a payment fails to send, it can be in one of several states. This enum is returned as the
478 * Err() type describing which state the payment is in, see the description of individual enum
481 typedef struct MUST_USE_STRUCT LDKPaymentSendFailure {
483 * Nearly everywhere, inner must be non-null, however in places where
484 * the Rust equivalent takes an Option, it may be set to null to indicate None.
486 LDKnativePaymentSendFailure *inner;
488 } LDKPaymentSendFailure;
490 typedef union LDKCResultPtr_u8__PaymentSendFailure {
492 LDKPaymentSendFailure *err;
493 } LDKCResultPtr_u8__PaymentSendFailure;
495 typedef struct LDKCResultTempl_u8__PaymentSendFailure {
496 LDKCResultPtr_u8__PaymentSendFailure contents;
498 } LDKCResultTempl_u8__PaymentSendFailure;
500 typedef LDKCResultTempl_u8__PaymentSendFailure LDKCResult_NonePaymentSendFailureZ;
505 * A channel_announcement message to be sent or received from a peer
507 typedef struct MUST_USE_STRUCT LDKChannelAnnouncement {
509 * Nearly everywhere, inner must be non-null, however in places where
510 * the Rust equivalent takes an Option, it may be set to null to indicate None.
512 LDKnativeChannelAnnouncement *inner;
514 } LDKChannelAnnouncement;
519 * A channel_update message to be sent or received from a peer
521 typedef struct MUST_USE_STRUCT LDKChannelUpdate {
523 * Nearly everywhere, inner must be non-null, however in places where
524 * the Rust equivalent takes an Option, it may be set to null to indicate None.
526 LDKnativeChannelUpdate *inner;
530 typedef struct LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate {
531 LDKChannelAnnouncement a;
534 } LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate;
536 typedef LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ;
541 * Error for PeerManager errors. If you get one of these, you must disconnect the socket and
542 * generate no further read_event/write_buffer_space_avail calls for the descriptor, only
543 * triggering a single socket_disconnected call (unless it was provided in response to a
544 * new_*_connection event, in which case no such socket_disconnected() must be called and the
545 * socket silently disconencted).
547 typedef struct MUST_USE_STRUCT LDKPeerHandleError {
549 * Nearly everywhere, inner must be non-null, however in places where
550 * the Rust equivalent takes an Option, it may be set to null to indicate None.
552 LDKnativePeerHandleError *inner;
554 } LDKPeerHandleError;
556 typedef union LDKCResultPtr_u8__PeerHandleError {
558 LDKPeerHandleError *err;
559 } LDKCResultPtr_u8__PeerHandleError;
561 typedef struct LDKCResultTempl_u8__PeerHandleError {
562 LDKCResultPtr_u8__PeerHandleError contents;
564 } LDKCResultTempl_u8__PeerHandleError;
566 typedef LDKCResultTempl_u8__PeerHandleError LDKCResult_NonePeerHandleErrorZ;
571 * Information about an HTLC as it appears in a commitment transaction
573 typedef struct MUST_USE_STRUCT LDKHTLCOutputInCommitment {
575 * Nearly everywhere, inner must be non-null, however in places where
576 * the Rust equivalent takes an Option, it may be set to null to indicate None.
578 LDKnativeHTLCOutputInCommitment *inner;
580 } LDKHTLCOutputInCommitment;
582 typedef struct LDKC2TupleTempl_HTLCOutputInCommitment__Signature {
583 LDKHTLCOutputInCommitment a;
585 } LDKC2TupleTempl_HTLCOutputInCommitment__Signature;
587 typedef LDKC2TupleTempl_HTLCOutputInCommitment__Signature LDKC2Tuple_HTLCOutputInCommitmentSignatureZ;
592 * An Err type for failure to process messages.
594 typedef struct MUST_USE_STRUCT LDKLightningError {
596 * Nearly everywhere, inner must be non-null, however in places where
597 * the Rust equivalent takes an Option, it may be set to null to indicate None.
599 LDKnativeLightningError *inner;
603 typedef union LDKCResultPtr_u8__LightningError {
605 LDKLightningError *err;
606 } LDKCResultPtr_u8__LightningError;
608 typedef struct LDKCResultTempl_u8__LightningError {
609 LDKCResultPtr_u8__LightningError contents;
611 } LDKCResultTempl_u8__LightningError;
613 typedef LDKCResultTempl_u8__LightningError LDKCResult_NoneLightningErrorZ;
615 typedef struct LDKPublicKey {
616 uint8_t compressed_form[33];
620 * When on-chain outputs are created by rust-lightning (which our counterparty is not able to
621 * claim at any point in the future) an event is generated which you must track and be able to
622 * spend on-chain. The information needed to do this is provided in this enum, including the
623 * outpoint describing which txid and output index is available, the full output which exists at
624 * that txid/index, and any keys or other information required to sign.
626 typedef enum LDKSpendableOutputDescriptor_Tag {
628 * An output to a script which was provided via KeysInterface, thus you should already know
629 * how to spend it. No keys are provided as rust-lightning was never given any keys - only the
630 * script_pubkey as it appears in the output.
631 * These may include outputs from a transaction punishing our counterparty or claiming an HTLC
632 * on-chain using the payment preimage or after it has timed out.
634 LDKSpendableOutputDescriptor_StaticOutput,
636 * An output to a P2WSH script which can be spent with a single signature after a CSV delay.
638 * The witness in the spending input should be:
639 * <BIP 143 signature> <empty vector> (MINIMALIF standard rule) <provided witnessScript>
641 * Note that the nSequence field in the spending input must be set to to_self_delay
642 * (which means the transaction is not broadcastable until at least to_self_delay
643 * blocks after the outpoint confirms).
645 * These are generally the result of a \"revocable\" output to us, spendable only by us unless
646 * it is an output from an old state which we broadcast (which should never happen).
648 * To derive the delayed_payment key which is used to sign for this input, you must pass the
649 * holder delayed_payment_base_key (ie the private key which corresponds to the pubkey in
650 * ChannelKeys::pubkeys().delayed_payment_basepoint) and the provided per_commitment_point to
651 * chan_utils::derive_private_key. The public key can be generated without the secret key
652 * using chan_utils::derive_public_key and only the delayed_payment_basepoint which appears in
653 * ChannelKeys::pubkeys().
655 * To derive the revocation_pubkey provided here (which is used in the witness
656 * script generation), you must pass the counterparty revocation_basepoint (which appears in the
657 * call to ChannelKeys::on_accept) and the provided per_commitment point
658 * to chan_utils::derive_public_revocation_key.
660 * The witness script which is hashed and included in the output script_pubkey may be
661 * regenerated by passing the revocation_pubkey (derived as above), our delayed_payment pubkey
662 * (derived as above), and the to_self_delay contained here to
663 * chan_utils::get_revokeable_redeemscript.
665 LDKSpendableOutputDescriptor_DynamicOutputP2WSH,
667 * An output to a P2WPKH, spendable exclusively by our payment key (ie the private key which
668 * corresponds to the public key in ChannelKeys::pubkeys().payment_point).
669 * The witness in the spending input, is, thus, simply:
670 * <BIP 143 signature> <payment key>
672 * These are generally the result of our counterparty having broadcast the current state,
673 * allowing us to claim the non-HTLC-encumbered outputs immediately.
675 LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment,
677 * Must be last for serialization purposes
679 LDKSpendableOutputDescriptor_Sentinel,
680 } LDKSpendableOutputDescriptor_Tag;
682 typedef struct LDKSpendableOutputDescriptor_LDKStaticOutput_Body {
683 LDKOutPoint outpoint;
685 } LDKSpendableOutputDescriptor_LDKStaticOutput_Body;
687 typedef struct LDKSpendableOutputDescriptor_LDKDynamicOutputP2WSH_Body {
688 LDKOutPoint outpoint;
689 LDKPublicKey per_commitment_point;
690 uint16_t to_self_delay;
692 LDKC2Tuple_u64u64Z key_derivation_params;
693 LDKPublicKey revocation_pubkey;
694 } LDKSpendableOutputDescriptor_LDKDynamicOutputP2WSH_Body;
696 typedef struct LDKSpendableOutputDescriptor_LDKStaticOutputCounterpartyPayment_Body {
697 LDKOutPoint outpoint;
699 LDKC2Tuple_u64u64Z key_derivation_params;
700 } LDKSpendableOutputDescriptor_LDKStaticOutputCounterpartyPayment_Body;
702 typedef struct LDKSpendableOutputDescriptor {
703 LDKSpendableOutputDescriptor_Tag tag;
705 LDKSpendableOutputDescriptor_LDKStaticOutput_Body static_output;
706 LDKSpendableOutputDescriptor_LDKDynamicOutputP2WSH_Body dynamic_output_p2wsh;
707 LDKSpendableOutputDescriptor_LDKStaticOutputCounterpartyPayment_Body static_output_counterparty_payment;
709 } LDKSpendableOutputDescriptor;
711 typedef struct LDKCVecTempl_SpendableOutputDescriptor {
712 LDKSpendableOutputDescriptor *data;
714 } LDKCVecTempl_SpendableOutputDescriptor;
716 typedef LDKCVecTempl_SpendableOutputDescriptor LDKCVec_SpendableOutputDescriptorZ;
719 * An Event which you should probably take some action in response to.
721 * Note that while Writeable and Readable are implemented for Event, you probably shouldn't use
722 * them directly as they don't round-trip exactly (for example FundingGenerationReady is never
723 * written as it makes no sense to respond to it after reconnecting to peers).
725 typedef enum LDKEvent_Tag {
727 * Used to indicate that the client should generate a funding transaction with the given
728 * parameters and then call ChannelManager::funding_transaction_generated.
729 * Generated in ChannelManager message handling.
730 * Note that *all inputs* in the funding transaction must spend SegWit outputs or your
731 * counterparty can steal your funds!
733 LDKEvent_FundingGenerationReady,
735 * Used to indicate that the client may now broadcast the funding transaction it created for a
736 * channel. Broadcasting such a transaction prior to this event may lead to our counterparty
737 * trivially stealing all funds in the funding transaction!
739 LDKEvent_FundingBroadcastSafe,
741 * Indicates we've received money! Just gotta dig out that payment preimage and feed it to
742 * ChannelManager::claim_funds to get it....
743 * Note that if the preimage is not known or the amount paid is incorrect, you should call
744 * ChannelManager::fail_htlc_backwards to free up resources for this HTLC and avoid
745 * network congestion.
746 * The amount paid should be considered 'incorrect' when it is less than or more than twice
747 * the amount expected.
748 * If you fail to call either ChannelManager::claim_funds or
749 * ChannelManager::fail_htlc_backwards within the HTLC's timeout, the HTLC will be
750 * automatically failed.
752 LDKEvent_PaymentReceived,
754 * Indicates an outbound payment we made succeeded (ie it made it all the way to its target
755 * and we got back the payment preimage for it).
756 * Note that duplicative PaymentSent Events may be generated - it is your responsibility to
757 * deduplicate them by payment_preimage (which MUST be unique)!
759 LDKEvent_PaymentSent,
761 * Indicates an outbound payment we made failed. Probably some intermediary node dropped
762 * something. You may wish to retry with a different route.
763 * Note that duplicative PaymentFailed Events may be generated - it is your responsibility to
764 * deduplicate them by payment_hash (which MUST be unique)!
766 LDKEvent_PaymentFailed,
768 * Used to indicate that ChannelManager::process_pending_htlc_forwards should be called at a
769 * time in the future.
771 LDKEvent_PendingHTLCsForwardable,
773 * Used to indicate that an output was generated on-chain which you should know how to spend.
774 * Such an output will *not* ever be spent by rust-lightning, and are not at risk of your
775 * counterparty spending them due to some kind of timeout. Thus, you need to store them
776 * somewhere and spend them when you create on-chain transactions.
778 LDKEvent_SpendableOutputs,
780 * Must be last for serialization purposes
785 typedef struct LDKEvent_LDKFundingGenerationReady_Body {
786 LDKThirtyTwoBytes temporary_channel_id;
787 uint64_t channel_value_satoshis;
788 LDKCVec_u8Z output_script;
789 uint64_t user_channel_id;
790 } LDKEvent_LDKFundingGenerationReady_Body;
792 typedef struct LDKEvent_LDKFundingBroadcastSafe_Body {
793 LDKOutPoint funding_txo;
794 uint64_t user_channel_id;
795 } LDKEvent_LDKFundingBroadcastSafe_Body;
797 typedef struct LDKEvent_LDKPaymentReceived_Body {
798 LDKThirtyTwoBytes payment_hash;
799 LDKThirtyTwoBytes payment_secret;
801 } LDKEvent_LDKPaymentReceived_Body;
803 typedef struct LDKEvent_LDKPaymentSent_Body {
804 LDKThirtyTwoBytes payment_preimage;
805 } LDKEvent_LDKPaymentSent_Body;
807 typedef struct LDKEvent_LDKPaymentFailed_Body {
808 LDKThirtyTwoBytes payment_hash;
809 bool rejected_by_dest;
810 } LDKEvent_LDKPaymentFailed_Body;
812 typedef struct LDKEvent_LDKPendingHTLCsForwardable_Body {
813 uint64_t time_forwardable;
814 } LDKEvent_LDKPendingHTLCsForwardable_Body;
816 typedef struct LDKEvent_LDKSpendableOutputs_Body {
817 LDKCVec_SpendableOutputDescriptorZ outputs;
818 } LDKEvent_LDKSpendableOutputs_Body;
820 typedef struct LDKEvent {
823 LDKEvent_LDKFundingGenerationReady_Body funding_generation_ready;
824 LDKEvent_LDKFundingBroadcastSafe_Body funding_broadcast_safe;
825 LDKEvent_LDKPaymentReceived_Body payment_received;
826 LDKEvent_LDKPaymentSent_Body payment_sent;
827 LDKEvent_LDKPaymentFailed_Body payment_failed;
828 LDKEvent_LDKPendingHTLCsForwardable_Body pending_htl_cs_forwardable;
829 LDKEvent_LDKSpendableOutputs_Body spendable_outputs;
836 * An accept_channel message to be sent or received from a peer
838 typedef struct MUST_USE_STRUCT LDKAcceptChannel {
840 * Nearly everywhere, inner must be non-null, however in places where
841 * the Rust equivalent takes an Option, it may be set to null to indicate None.
843 LDKnativeAcceptChannel *inner;
850 * An open_channel message to be sent or received from a peer
852 typedef struct MUST_USE_STRUCT LDKOpenChannel {
854 * Nearly everywhere, inner must be non-null, however in places where
855 * the Rust equivalent takes an Option, it may be set to null to indicate None.
857 LDKnativeOpenChannel *inner;
864 * A funding_created message to be sent or received from a peer
866 typedef struct MUST_USE_STRUCT LDKFundingCreated {
868 * Nearly everywhere, inner must be non-null, however in places where
869 * the Rust equivalent takes an Option, it may be set to null to indicate None.
871 LDKnativeFundingCreated *inner;
878 * A funding_signed message to be sent or received from a peer
880 typedef struct MUST_USE_STRUCT LDKFundingSigned {
882 * Nearly everywhere, inner must be non-null, however in places where
883 * the Rust equivalent takes an Option, it may be set to null to indicate None.
885 LDKnativeFundingSigned *inner;
892 * A funding_locked message to be sent or received from a peer
894 typedef struct MUST_USE_STRUCT LDKFundingLocked {
896 * Nearly everywhere, inner must be non-null, however in places where
897 * the Rust equivalent takes an Option, it may be set to null to indicate None.
899 LDKnativeFundingLocked *inner;
906 * An announcement_signatures message to be sent or received from a peer
908 typedef struct MUST_USE_STRUCT LDKAnnouncementSignatures {
910 * Nearly everywhere, inner must be non-null, however in places where
911 * the Rust equivalent takes an Option, it may be set to null to indicate None.
913 LDKnativeAnnouncementSignatures *inner;
915 } LDKAnnouncementSignatures;
920 * Struct used to return values from revoke_and_ack messages, containing a bunch of commitment
921 * transaction updates if they were pending.
923 typedef struct MUST_USE_STRUCT LDKCommitmentUpdate {
925 * Nearly everywhere, inner must be non-null, however in places where
926 * the Rust equivalent takes an Option, it may be set to null to indicate None.
928 LDKnativeCommitmentUpdate *inner;
930 } LDKCommitmentUpdate;
935 * A revoke_and_ack message to be sent or received from a peer
937 typedef struct MUST_USE_STRUCT LDKRevokeAndACK {
939 * Nearly everywhere, inner must be non-null, however in places where
940 * the Rust equivalent takes an Option, it may be set to null to indicate None.
942 LDKnativeRevokeAndACK *inner;
949 * A closing_signed message to be sent or received from a peer
951 typedef struct MUST_USE_STRUCT LDKClosingSigned {
953 * Nearly everywhere, inner must be non-null, however in places where
954 * the Rust equivalent takes an Option, it may be set to null to indicate None.
956 LDKnativeClosingSigned *inner;
963 * A shutdown message to be sent or received from a peer
965 typedef struct MUST_USE_STRUCT LDKShutdown {
967 * Nearly everywhere, inner must be non-null, however in places where
968 * the Rust equivalent takes an Option, it may be set to null to indicate None.
970 LDKnativeShutdown *inner;
977 * A channel_reestablish message to be sent or received from a peer
979 typedef struct MUST_USE_STRUCT LDKChannelReestablish {
981 * Nearly everywhere, inner must be non-null, however in places where
982 * the Rust equivalent takes an Option, it may be set to null to indicate None.
984 LDKnativeChannelReestablish *inner;
986 } LDKChannelReestablish;
991 * A node_announcement message to be sent or received from a peer
993 typedef struct MUST_USE_STRUCT LDKNodeAnnouncement {
995 * Nearly everywhere, inner must be non-null, however in places where
996 * the Rust equivalent takes an Option, it may be set to null to indicate None.
998 LDKnativeNodeAnnouncement *inner;
1000 } LDKNodeAnnouncement;
1005 * An error message to be sent or received from a peer
1007 typedef struct MUST_USE_STRUCT LDKErrorMessage {
1009 * Nearly everywhere, inner must be non-null, however in places where
1010 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1012 LDKnativeErrorMessage *inner;
1017 * Used to put an error message in a LightningError
1019 typedef enum LDKErrorAction_Tag {
1021 * The peer took some action which made us think they were useless. Disconnect them.
1023 LDKErrorAction_DisconnectPeer,
1025 * The peer did something harmless that we weren't able to process, just log and ignore
1027 LDKErrorAction_IgnoreError,
1029 * The peer did something incorrect. Tell them.
1031 LDKErrorAction_SendErrorMessage,
1033 * Must be last for serialization purposes
1035 LDKErrorAction_Sentinel,
1036 } LDKErrorAction_Tag;
1038 typedef struct LDKErrorAction_LDKDisconnectPeer_Body {
1039 LDKErrorMessage msg;
1040 } LDKErrorAction_LDKDisconnectPeer_Body;
1042 typedef struct LDKErrorAction_LDKSendErrorMessage_Body {
1043 LDKErrorMessage msg;
1044 } LDKErrorAction_LDKSendErrorMessage_Body;
1046 typedef struct LDKErrorAction {
1047 LDKErrorAction_Tag tag;
1049 LDKErrorAction_LDKDisconnectPeer_Body disconnect_peer;
1050 LDKErrorAction_LDKSendErrorMessage_Body send_error_message;
1055 * The information we received from a peer along the route of a payment we originated. This is
1056 * returned by ChannelMessageHandler::handle_update_fail_htlc to be passed into
1057 * RoutingMessageHandler::handle_htlc_fail_channel_update to update our network map.
1059 typedef enum LDKHTLCFailChannelUpdate_Tag {
1061 * We received an error which included a full ChannelUpdate message.
1063 LDKHTLCFailChannelUpdate_ChannelUpdateMessage,
1065 * We received an error which indicated only that a channel has been closed
1067 LDKHTLCFailChannelUpdate_ChannelClosed,
1069 * We received an error which indicated only that a node has failed
1071 LDKHTLCFailChannelUpdate_NodeFailure,
1073 * Must be last for serialization purposes
1075 LDKHTLCFailChannelUpdate_Sentinel,
1076 } LDKHTLCFailChannelUpdate_Tag;
1078 typedef struct LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body {
1079 LDKChannelUpdate msg;
1080 } LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body;
1082 typedef struct LDKHTLCFailChannelUpdate_LDKChannelClosed_Body {
1083 uint64_t short_channel_id;
1085 } LDKHTLCFailChannelUpdate_LDKChannelClosed_Body;
1087 typedef struct LDKHTLCFailChannelUpdate_LDKNodeFailure_Body {
1088 LDKPublicKey node_id;
1090 } LDKHTLCFailChannelUpdate_LDKNodeFailure_Body;
1092 typedef struct LDKHTLCFailChannelUpdate {
1093 LDKHTLCFailChannelUpdate_Tag tag;
1095 LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body channel_update_message;
1096 LDKHTLCFailChannelUpdate_LDKChannelClosed_Body channel_closed;
1097 LDKHTLCFailChannelUpdate_LDKNodeFailure_Body node_failure;
1099 } LDKHTLCFailChannelUpdate;
1102 * An event generated by ChannelManager which indicates a message should be sent to a peer (or
1103 * broadcast to most peers).
1104 * These events are handled by PeerManager::process_events if you are using a PeerManager.
1106 typedef enum LDKMessageSendEvent_Tag {
1108 * Used to indicate that we've accepted a channel open and should send the accept_channel
1109 * message provided to the given peer.
1111 LDKMessageSendEvent_SendAcceptChannel,
1113 * Used to indicate that we've initiated a channel open and should send the open_channel
1114 * message provided to the given peer.
1116 LDKMessageSendEvent_SendOpenChannel,
1118 * Used to indicate that a funding_created message should be sent to the peer with the given node_id.
1120 LDKMessageSendEvent_SendFundingCreated,
1122 * Used to indicate that a funding_signed message should be sent to the peer with the given node_id.
1124 LDKMessageSendEvent_SendFundingSigned,
1126 * Used to indicate that a funding_locked message should be sent to the peer with the given node_id.
1128 LDKMessageSendEvent_SendFundingLocked,
1130 * Used to indicate that an announcement_signatures message should be sent to the peer with the given node_id.
1132 LDKMessageSendEvent_SendAnnouncementSignatures,
1134 * Used to indicate that a series of HTLC update messages, as well as a commitment_signed
1135 * message should be sent to the peer with the given node_id.
1137 LDKMessageSendEvent_UpdateHTLCs,
1139 * Used to indicate that a revoke_and_ack message should be sent to the peer with the given node_id.
1141 LDKMessageSendEvent_SendRevokeAndACK,
1143 * Used to indicate that a closing_signed message should be sent to the peer with the given node_id.
1145 LDKMessageSendEvent_SendClosingSigned,
1147 * Used to indicate that a shutdown message should be sent to the peer with the given node_id.
1149 LDKMessageSendEvent_SendShutdown,
1151 * Used to indicate that a channel_reestablish message should be sent to the peer with the given node_id.
1153 LDKMessageSendEvent_SendChannelReestablish,
1155 * Used to indicate that a channel_announcement and channel_update should be broadcast to all
1156 * peers (except the peer with node_id either msg.contents.node_id_1 or msg.contents.node_id_2).
1158 * Note that after doing so, you very likely (unless you did so very recently) want to call
1159 * ChannelManager::broadcast_node_announcement to trigger a BroadcastNodeAnnouncement event.
1160 * This ensures that any nodes which see our channel_announcement also have a relevant
1161 * node_announcement, including relevant feature flags which may be important for routing
1164 LDKMessageSendEvent_BroadcastChannelAnnouncement,
1166 * Used to indicate that a node_announcement should be broadcast to all peers.
1168 LDKMessageSendEvent_BroadcastNodeAnnouncement,
1170 * Used to indicate that a channel_update should be broadcast to all peers.
1172 LDKMessageSendEvent_BroadcastChannelUpdate,
1174 * Broadcast an error downstream to be handled
1176 LDKMessageSendEvent_HandleError,
1178 * When a payment fails we may receive updates back from the hop where it failed. In such
1179 * cases this event is generated so that we can inform the network graph of this information.
1181 LDKMessageSendEvent_PaymentFailureNetworkUpdate,
1183 * Must be last for serialization purposes
1185 LDKMessageSendEvent_Sentinel,
1186 } LDKMessageSendEvent_Tag;
1188 typedef struct LDKMessageSendEvent_LDKSendAcceptChannel_Body {
1189 LDKPublicKey node_id;
1190 LDKAcceptChannel msg;
1191 } LDKMessageSendEvent_LDKSendAcceptChannel_Body;
1193 typedef struct LDKMessageSendEvent_LDKSendOpenChannel_Body {
1194 LDKPublicKey node_id;
1196 } LDKMessageSendEvent_LDKSendOpenChannel_Body;
1198 typedef struct LDKMessageSendEvent_LDKSendFundingCreated_Body {
1199 LDKPublicKey node_id;
1200 LDKFundingCreated msg;
1201 } LDKMessageSendEvent_LDKSendFundingCreated_Body;
1203 typedef struct LDKMessageSendEvent_LDKSendFundingSigned_Body {
1204 LDKPublicKey node_id;
1205 LDKFundingSigned msg;
1206 } LDKMessageSendEvent_LDKSendFundingSigned_Body;
1208 typedef struct LDKMessageSendEvent_LDKSendFundingLocked_Body {
1209 LDKPublicKey node_id;
1210 LDKFundingLocked msg;
1211 } LDKMessageSendEvent_LDKSendFundingLocked_Body;
1213 typedef struct LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body {
1214 LDKPublicKey node_id;
1215 LDKAnnouncementSignatures msg;
1216 } LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body;
1218 typedef struct LDKMessageSendEvent_LDKUpdateHTLCs_Body {
1219 LDKPublicKey node_id;
1220 LDKCommitmentUpdate updates;
1221 } LDKMessageSendEvent_LDKUpdateHTLCs_Body;
1223 typedef struct LDKMessageSendEvent_LDKSendRevokeAndACK_Body {
1224 LDKPublicKey node_id;
1225 LDKRevokeAndACK msg;
1226 } LDKMessageSendEvent_LDKSendRevokeAndACK_Body;
1228 typedef struct LDKMessageSendEvent_LDKSendClosingSigned_Body {
1229 LDKPublicKey node_id;
1230 LDKClosingSigned msg;
1231 } LDKMessageSendEvent_LDKSendClosingSigned_Body;
1233 typedef struct LDKMessageSendEvent_LDKSendShutdown_Body {
1234 LDKPublicKey node_id;
1236 } LDKMessageSendEvent_LDKSendShutdown_Body;
1238 typedef struct LDKMessageSendEvent_LDKSendChannelReestablish_Body {
1239 LDKPublicKey node_id;
1240 LDKChannelReestablish msg;
1241 } LDKMessageSendEvent_LDKSendChannelReestablish_Body;
1243 typedef struct LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body {
1244 LDKChannelAnnouncement msg;
1245 LDKChannelUpdate update_msg;
1246 } LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body;
1248 typedef struct LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body {
1249 LDKNodeAnnouncement msg;
1250 } LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body;
1252 typedef struct LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body {
1253 LDKChannelUpdate msg;
1254 } LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body;
1256 typedef struct LDKMessageSendEvent_LDKHandleError_Body {
1257 LDKPublicKey node_id;
1258 LDKErrorAction action;
1259 } LDKMessageSendEvent_LDKHandleError_Body;
1261 typedef struct LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body {
1262 LDKHTLCFailChannelUpdate update;
1263 } LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body;
1265 typedef struct LDKMessageSendEvent {
1266 LDKMessageSendEvent_Tag tag;
1268 LDKMessageSendEvent_LDKSendAcceptChannel_Body send_accept_channel;
1269 LDKMessageSendEvent_LDKSendOpenChannel_Body send_open_channel;
1270 LDKMessageSendEvent_LDKSendFundingCreated_Body send_funding_created;
1271 LDKMessageSendEvent_LDKSendFundingSigned_Body send_funding_signed;
1272 LDKMessageSendEvent_LDKSendFundingLocked_Body send_funding_locked;
1273 LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body send_announcement_signatures;
1274 LDKMessageSendEvent_LDKUpdateHTLCs_Body update_htl_cs;
1275 LDKMessageSendEvent_LDKSendRevokeAndACK_Body send_revoke_and_ack;
1276 LDKMessageSendEvent_LDKSendClosingSigned_Body send_closing_signed;
1277 LDKMessageSendEvent_LDKSendShutdown_Body send_shutdown;
1278 LDKMessageSendEvent_LDKSendChannelReestablish_Body send_channel_reestablish;
1279 LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body broadcast_channel_announcement;
1280 LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body broadcast_node_announcement;
1281 LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body broadcast_channel_update;
1282 LDKMessageSendEvent_LDKHandleError_Body handle_error;
1283 LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body payment_failure_network_update;
1285 } LDKMessageSendEvent;
1287 typedef struct LDKCVecTempl_MessageSendEvent {
1288 LDKMessageSendEvent *data;
1290 } LDKCVecTempl_MessageSendEvent;
1292 typedef LDKCVecTempl_MessageSendEvent LDKCVec_MessageSendEventZ;
1295 * A trait indicating an object may generate message send events
1297 typedef struct LDKMessageSendEventsProvider {
1300 * Gets the list of pending events which were generated by previous actions, clearing the list
1303 LDKCVec_MessageSendEventZ (*get_and_clear_pending_msg_events)(const void *this_arg);
1304 void (*free)(void *this_arg);
1305 } LDKMessageSendEventsProvider;
1307 typedef struct LDKCVecTempl_Event {
1310 } LDKCVecTempl_Event;
1312 typedef LDKCVecTempl_Event LDKCVec_EventZ;
1315 * A trait indicating an object may generate events
1317 typedef struct LDKEventsProvider {
1320 * Gets the list of pending events which were generated by previous actions, clearing the list
1323 LDKCVec_EventZ (*get_and_clear_pending_events)(const void *this_arg);
1324 void (*free)(void *this_arg);
1325 } LDKEventsProvider;
1328 * A trait encapsulating the operations required of a logger
1330 typedef struct LDKLogger {
1335 void (*log)(const void *this_arg, const char *record);
1336 void (*free)(void *this_arg);
1342 * Configuration we set when applicable.
1344 * Default::default() provides sane defaults.
1346 typedef struct MUST_USE_STRUCT LDKChannelHandshakeConfig {
1348 * Nearly everywhere, inner must be non-null, however in places where
1349 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1351 LDKnativeChannelHandshakeConfig *inner;
1353 } LDKChannelHandshakeConfig;
1358 * Optional channel limits which are applied during channel creation.
1360 * These limits are only applied to our counterparty's limits, not our own.
1362 * Use 0/<type>::max_value() as appropriate to skip checking.
1364 * Provides sane defaults for most configurations.
1366 * Most additional limits are disabled except those with which specify a default in individual
1367 * field documentation. Note that this may result in barely-usable channels, but since they
1368 * are applied mostly only to incoming channels that's not much of a problem.
1370 typedef struct MUST_USE_STRUCT LDKChannelHandshakeLimits {
1372 * Nearly everywhere, inner must be non-null, however in places where
1373 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1375 LDKnativeChannelHandshakeLimits *inner;
1377 } LDKChannelHandshakeLimits;
1382 * Options which apply on a per-channel basis and may change at runtime or based on negotiation
1383 * with our counterparty.
1385 typedef struct MUST_USE_STRUCT LDKChannelConfig {
1387 * Nearly everywhere, inner must be non-null, however in places where
1388 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1390 LDKnativeChannelConfig *inner;
1394 typedef struct LDKu8slice {
1395 const uint8_t *data;
1402 * Top-level config which holds ChannelHandshakeLimits and ChannelConfig.
1404 * Default::default() provides sane defaults for most configurations
1405 * (but currently with 0 relay fees!)
1407 typedef struct MUST_USE_STRUCT LDKUserConfig {
1409 * Nearly everywhere, inner must be non-null, however in places where
1410 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1412 LDKnativeUserConfig *inner;
1416 typedef union LDKCResultPtr_TxOut__AccessError {
1418 LDKAccessError *err;
1419 } LDKCResultPtr_TxOut__AccessError;
1421 typedef struct LDKCResultTempl_TxOut__AccessError {
1422 LDKCResultPtr_TxOut__AccessError contents;
1424 } LDKCResultTempl_TxOut__AccessError;
1426 typedef LDKCResultTempl_TxOut__AccessError LDKCResult_TxOutAccessErrorZ;
1429 * The `Access` trait defines behavior for accessing chain data and state, such as blocks and
1432 typedef struct LDKAccess {
1435 * Returns the transaction output of a funding transaction encoded by [`short_channel_id`].
1436 * Returns an error if `genesis_hash` is for a different chain or if such a transaction output
1439 * [`short_channel_id`]: https://github.com/lightningnetwork/lightning-rfc/blob/master/07-routing-gossip.md#definition-of-short_channel_id
1441 LDKCResult_TxOutAccessErrorZ (*get_utxo)(const void *this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id);
1442 void (*free)(void *this_arg);
1448 * One counterparty's public keys which do not change over the life of a channel.
1450 typedef struct MUST_USE_STRUCT LDKChannelPublicKeys {
1452 * Nearly everywhere, inner must be non-null, however in places where
1453 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1455 LDKnativeChannelPublicKeys *inner;
1457 } LDKChannelPublicKeys;
1462 * The per-commitment point and a set of pre-calculated public keys used for transaction creation
1464 * The pre-calculated keys are an optimization, because ChannelKeys has enough
1465 * information to re-derive them.
1467 typedef struct MUST_USE_STRUCT LDKPreCalculatedTxCreationKeys {
1469 * Nearly everywhere, inner must be non-null, however in places where
1470 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1472 LDKnativePreCalculatedTxCreationKeys *inner;
1474 } LDKPreCalculatedTxCreationKeys;
1476 typedef struct LDKCVecTempl_HTLCOutputInCommitment {
1477 LDKHTLCOutputInCommitment *data;
1479 } LDKCVecTempl_HTLCOutputInCommitment;
1481 typedef LDKCVecTempl_HTLCOutputInCommitment LDKCVec_HTLCOutputInCommitmentZ;
1486 * We use this to track holder commitment transactions and put off signing them until we are ready
1487 * to broadcast. This class can be used inside a signer implementation to generate a signature
1488 * given the relevant secret key.
1490 typedef struct MUST_USE_STRUCT LDKHolderCommitmentTransaction {
1492 * Nearly everywhere, inner must be non-null, however in places where
1493 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1495 LDKnativeHolderCommitmentTransaction *inner;
1497 } LDKHolderCommitmentTransaction;
1502 * The unsigned part of a channel_announcement
1504 typedef struct MUST_USE_STRUCT LDKUnsignedChannelAnnouncement {
1506 * Nearly everywhere, inner must be non-null, however in places where
1507 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1509 LDKnativeUnsignedChannelAnnouncement *inner;
1511 } LDKUnsignedChannelAnnouncement;
1514 * Set of lightning keys needed to operate a channel as described in BOLT 3.
1516 * Signing services could be implemented on a hardware wallet. In this case,
1517 * the current ChannelKeys would be a front-end on top of a communication
1518 * channel connected to your secure device and lightning key material wouldn't
1519 * reside on a hot server. Nevertheless, a this deployment would still need
1520 * to trust the ChannelManager to avoid loss of funds as this latest component
1521 * could ask to sign commitment transaction with HTLCs paying to attacker pubkeys.
1523 * A more secure iteration would be to use hashlock (or payment points) to pair
1524 * invoice/incoming HTLCs with outgoing HTLCs to implement a no-trust-ChannelManager
1525 * at the price of more state and computation on the hardware wallet side. In the future,
1526 * we are looking forward to design such interface.
1528 * In any case, ChannelMonitor or fallback watchtowers are always going to be trusted
1529 * to act, as liveness and breach reply correctness are always going to be hard requirements
1530 * of LN security model, orthogonal of key management issues.
1532 * If you're implementing a custom signer, you almost certainly want to implement
1533 * Readable/Writable to serialize out a unique reference to this set of keys so
1534 * that you can serialize the full ChannelManager object.
1537 typedef struct LDKChannelKeys {
1540 * Gets the per-commitment point for a specific commitment number
1542 * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
1544 LDKPublicKey (*get_per_commitment_point)(const void *this_arg, uint64_t idx);
1546 * Gets the commitment secret for a specific commitment number as part of the revocation process
1548 * An external signer implementation should error here if the commitment was already signed
1549 * and should refuse to sign it in the future.
1551 * May be called more than once for the same index.
1553 * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
1554 * TODO: return a Result so we can signal a validation error
1556 LDKThirtyTwoBytes (*release_commitment_secret)(const void *this_arg, uint64_t idx);
1558 * Gets the holder's channel public keys and basepoints
1560 LDKChannelPublicKeys pubkeys;
1562 * Fill in the pubkeys field as a reference to it will be given to Rust after this returns
1563 * Note that this takes a pointer to this object, not the this_ptr like other methods do
1564 * This function pointer may be NULL if pubkeys is filled in when this object is created and never needs updating.
1566 void (*set_pubkeys)(const LDKChannelKeys*);
1568 * Gets arbitrary identifiers describing the set of keys which are provided back to you in
1569 * some SpendableOutputDescriptor types. These should be sufficient to identify this
1570 * ChannelKeys object uniquely and lookup or re-derive its keys.
1572 LDKC2Tuple_u64u64Z (*key_derivation_params)(const void *this_arg);
1574 * Create a signature for a counterparty's commitment transaction and associated HTLC transactions.
1576 * Note that if signing fails or is rejected, the channel will be force-closed.
1578 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_counterparty_commitment)(const void *this_arg, uint32_t feerate_per_kw, LDKTransaction commitment_tx, const LDKPreCalculatedTxCreationKeys *keys, LDKCVec_HTLCOutputInCommitmentZ htlcs);
1580 * Create a signature for a holder's commitment transaction. This will only ever be called with
1581 * the same holder_commitment_tx (or a copy thereof), though there are currently no guarantees
1582 * that it will not be called multiple times.
1583 * An external signer implementation should check that the commitment has not been revoked.
1585 LDKCResult_SignatureNoneZ (*sign_holder_commitment)(const void *this_arg, const LDKHolderCommitmentTransaction *holder_commitment_tx);
1587 * Create a signature for each HTLC transaction spending a holder's commitment transaction.
1589 * Unlike sign_holder_commitment, this may be called multiple times with *different*
1590 * holder_commitment_tx values. While this will never be called with a revoked
1591 * holder_commitment_tx, it is possible that it is called with the second-latest
1592 * holder_commitment_tx (only if we haven't yet revoked it) if some watchtower/secondary
1593 * ChannelMonitor decided to broadcast before it had been updated to the latest.
1595 * Either an Err should be returned, or a Vec with one entry for each HTLC which exists in
1596 * holder_commitment_tx. For those HTLCs which have transaction_output_index set to None
1597 * (implying they were considered dust at the time the commitment transaction was negotiated),
1598 * a corresponding None should be included in the return value. All other positions in the
1599 * return value must contain a signature.
1601 LDKCResult_CVec_SignatureZNoneZ (*sign_holder_commitment_htlc_transactions)(const void *this_arg, const LDKHolderCommitmentTransaction *holder_commitment_tx);
1603 * Create a signature for the given input in a transaction spending an HTLC or commitment
1604 * transaction output when our counterparty broadcasts an old state.
1606 * A justice transaction may claim multiples outputs at the same time if timelocks are
1607 * similar, but only a signature for the input at index `input` should be signed for here.
1608 * It may be called multiples time for same output(s) if a fee-bump is needed with regards
1609 * to an upcoming timelock expiration.
1611 * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
1613 * per_commitment_key is revocation secret which was provided by our counterparty when they
1614 * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
1615 * not allow the spending of any funds by itself (you need our holder revocation_secret to do
1618 * htlc holds HTLC elements (hash, timelock) if the output being spent is a HTLC output, thus
1619 * changing the format of the witness script (which is committed to in the BIP 143
1622 LDKCResult_SignatureNoneZ (*sign_justice_transaction)(const void *this_arg, LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (*per_commitment_key)[32], const LDKHTLCOutputInCommitment *htlc);
1624 * Create a signature for a claiming transaction for a HTLC output on a counterparty's commitment
1625 * transaction, either offered or received.
1627 * Such a transaction may claim multiples offered outputs at same time if we know the
1628 * preimage for each when we create it, but only the input at index `input` should be
1629 * signed for here. It may be called multiple times for same output(s) if a fee-bump is
1630 * needed with regards to an upcoming timelock expiration.
1632 * Witness_script is either a offered or received script as defined in BOLT3 for HTLC
1635 * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
1637 * Per_commitment_point is the dynamic point corresponding to the channel state
1638 * detected onchain. It has been generated by our counterparty and is used to derive
1639 * channel state keys, which are then included in the witness script and committed to in the
1640 * BIP 143 signature.
1642 LDKCResult_SignatureNoneZ (*sign_counterparty_htlc_transaction)(const void *this_arg, LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, LDKPublicKey per_commitment_point, const LDKHTLCOutputInCommitment *htlc);
1644 * Create a signature for a (proposed) closing transaction.
1646 * Note that, due to rounding, there may be one \"missing\" satoshi, and either party may have
1647 * chosen to forgo their output as dust.
1649 LDKCResult_SignatureNoneZ (*sign_closing_transaction)(const void *this_arg, LDKTransaction closing_tx);
1651 * Signs a channel announcement message with our funding key, proving it comes from one
1652 * of the channel participants.
1654 * Note that if this fails or is rejected, the channel will not be publicly announced and
1655 * our counterparty may (though likely will not) close the channel on us for violating the
1658 LDKCResult_SignatureNoneZ (*sign_channel_announcement)(const void *this_arg, const LDKUnsignedChannelAnnouncement *msg);
1660 * Set the counterparty channel basepoints and counterparty_selected/holder_selected_contest_delay.
1661 * This is done immediately on incoming channels and as soon as the channel is accepted on outgoing channels.
1663 * We bind holder_selected_contest_delay late here for API convenience.
1665 * Will be called before any signatures are applied.
1667 void (*on_accept)(void *this_arg, const LDKChannelPublicKeys *channel_points, uint16_t counterparty_selected_contest_delay, uint16_t holder_selected_contest_delay);
1668 void *(*clone)(const void *this_arg);
1669 void (*free)(void *this_arg);
1675 * A ChannelMonitor handles chain events (blocks connected and disconnected) and generates
1676 * on-chain transactions to ensure no loss of funds occurs.
1678 * You MUST ensure that no ChannelMonitors for a given channel anywhere contain out-of-date
1679 * information and are actively monitoring the chain.
1681 * Pending Events or updated HTLCs which have not yet been read out by
1682 * get_and_clear_pending_monitor_events or get_and_clear_pending_events are serialized to disk and
1683 * reloaded at deserialize-time. Thus, you must ensure that, when handling events, all events
1684 * gotten are fully handled before re-serializing the new state.
1686 typedef struct MUST_USE_STRUCT LDKChannelMonitor {
1688 * Nearly everywhere, inner must be non-null, however in places where
1689 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1691 LDKnativeChannelMonitor *inner;
1693 } LDKChannelMonitor;
1698 * An update generated by the underlying Channel itself which contains some new information the
1699 * ChannelMonitor should be made aware of.
1701 typedef struct MUST_USE_STRUCT LDKChannelMonitorUpdate {
1703 * Nearly everywhere, inner must be non-null, however in places where
1704 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1706 LDKnativeChannelMonitorUpdate *inner;
1708 } LDKChannelMonitorUpdate;
1713 * An event to be processed by the ChannelManager.
1715 typedef struct MUST_USE_STRUCT LDKMonitorEvent {
1717 * Nearly everywhere, inner must be non-null, however in places where
1718 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1720 LDKnativeMonitorEvent *inner;
1724 typedef struct LDKCVecTempl_MonitorEvent {
1725 LDKMonitorEvent *data;
1727 } LDKCVecTempl_MonitorEvent;
1729 typedef LDKCVecTempl_MonitorEvent LDKCVec_MonitorEventZ;
1732 * The `Watch` trait defines behavior for watching on-chain activity pertaining to channels as
1733 * blocks are connected and disconnected.
1735 * Each channel is associated with a [`ChannelMonitor`]. Implementations of this trait are
1736 * responsible for maintaining a set of monitors such that they can be updated accordingly as
1737 * channel state changes and HTLCs are resolved. See method documentation for specific
1740 * Implementations **must** ensure that updates are successfully applied and persisted upon method
1741 * completion. If an update fails with a [`PermanentFailure`], then it must immediately shut down
1742 * without taking any further action such as persisting the current state.
1744 * If an implementation maintains multiple instances of a channel's monitor (e.g., by storing
1745 * backup copies), then it must ensure that updates are applied across all instances. Otherwise, it
1746 * could result in a revoked transaction being broadcast, allowing the counterparty to claim all
1747 * funds in the channel. See [`ChannelMonitorUpdateErr`] for more details about how to handle
1748 * multiple instances.
1750 * [`ChannelMonitor`]: channelmonitor/struct.ChannelMonitor.html
1751 * [`ChannelMonitorUpdateErr`]: channelmonitor/enum.ChannelMonitorUpdateErr.html
1752 * [`PermanentFailure`]: channelmonitor/enum.ChannelMonitorUpdateErr.html#variant.PermanentFailure
1754 typedef struct LDKWatch {
1757 * Watches a channel identified by `funding_txo` using `monitor`.
1759 * Implementations are responsible for watching the chain for the funding transaction along
1760 * with any spends of outputs returned by [`get_outputs_to_watch`]. In practice, this means
1761 * calling [`block_connected`] and [`block_disconnected`] on the monitor.
1763 * [`get_outputs_to_watch`]: channelmonitor/struct.ChannelMonitor.html#method.get_outputs_to_watch
1764 * [`block_connected`]: channelmonitor/struct.ChannelMonitor.html#method.block_connected
1765 * [`block_disconnected`]: channelmonitor/struct.ChannelMonitor.html#method.block_disconnected
1767 LDKCResult_NoneChannelMonitorUpdateErrZ (*watch_channel)(const void *this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor);
1769 * Updates a channel identified by `funding_txo` by applying `update` to its monitor.
1771 * Implementations must call [`update_monitor`] with the given update. See
1772 * [`ChannelMonitorUpdateErr`] for invariants around returning an error.
1774 * [`update_monitor`]: channelmonitor/struct.ChannelMonitor.html#method.update_monitor
1775 * [`ChannelMonitorUpdateErr`]: channelmonitor/enum.ChannelMonitorUpdateErr.html
1777 LDKCResult_NoneChannelMonitorUpdateErrZ (*update_channel)(const void *this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update);
1779 * Returns any monitor events since the last call. Subsequent calls must only return new
1782 LDKCVec_MonitorEventZ (*release_pending_monitor_events)(const void *this_arg);
1783 void (*free)(void *this_arg);
1787 * The `Filter` trait defines behavior for indicating chain activity of interest pertaining to
1790 * This is useful in order to have a [`Watch`] implementation convey to a chain source which
1791 * transactions to be notified of. Notification may take the form of pre-filtering blocks or, in
1792 * the case of [BIP 157]/[BIP 158], only fetching a block if the compact filter matches. If
1793 * receiving full blocks from a chain source, any further filtering is unnecessary.
1795 * After an output has been registered, subsequent block retrievals from the chain source must not
1796 * exclude any transactions matching the new criteria nor any in-block descendants of such
1799 * Note that use as part of a [`Watch`] implementation involves reentrancy. Therefore, the `Filter`
1800 * should not block on I/O. Implementations should instead queue the newly monitored data to be
1801 * processed later. Then, in order to block until the data has been processed, any `Watch`
1802 * invocation that has called the `Filter` must return [`TemporaryFailure`].
1804 * [`Watch`]: trait.Watch.html
1805 * [`TemporaryFailure`]: channelmonitor/enum.ChannelMonitorUpdateErr.html#variant.TemporaryFailure
1806 * [BIP 157]: https://github.com/bitcoin/bips/blob/master/bip-0157.mediawiki
1807 * [BIP 158]: https://github.com/bitcoin/bips/blob/master/bip-0158.mediawiki
1809 typedef struct LDKFilter {
1812 * Registers interest in a transaction with `txid` and having an output with `script_pubkey` as
1813 * a spending condition.
1815 void (*register_tx)(const void *this_arg, const uint8_t (*txid)[32], LDKu8slice script_pubkey);
1817 * Registers interest in spends of a transaction output identified by `outpoint` having
1818 * `script_pubkey` as the spending condition.
1820 void (*register_output)(const void *this_arg, const LDKOutPoint *outpoint, LDKu8slice script_pubkey);
1821 void (*free)(void *this_arg);
1825 * An interface to send a transaction to the Bitcoin network.
1827 typedef struct LDKBroadcasterInterface {
1830 * Sends a transaction out to (hopefully) be mined.
1832 void (*broadcast_transaction)(const void *this_arg, LDKTransaction tx);
1833 void (*free)(void *this_arg);
1834 } LDKBroadcasterInterface;
1837 * A trait which should be implemented to provide feerate information on a number of time
1840 * Note that all of the functions implemented here *must* be reentrant-safe (obviously - they're
1841 * called from inside the library in response to chain events, P2P events, or timer events).
1843 typedef struct LDKFeeEstimator {
1846 * Gets estimated satoshis of fee required per 1000 Weight-Units.
1848 * Must be no smaller than 253 (ie 1 satoshi-per-byte rounded up to ensure later round-downs
1849 * don't put us below 1 satoshi-per-byte).
1851 * This translates to:
1852 * * satoshis-per-byte * 250
1853 * * ceil(satoshis-per-kbyte / 4)
1855 uint32_t (*get_est_sat_per_1000_weight)(const void *this_arg, LDKConfirmationTarget confirmation_target);
1856 void (*free)(void *this_arg);
1860 * `Persist` defines behavior for persisting channel monitors: this could mean
1861 * writing once to disk, and/or uploading to one or more backup services.
1863 * Note that for every new monitor, you **must** persist the new `ChannelMonitor`
1864 * to disk/backups. And, on every update, you **must** persist either the
1865 * `ChannelMonitorUpdate` or the updated monitor itself. Otherwise, there is risk
1866 * of situations such as revoking a transaction, then crashing before this
1867 * revocation can be persisted, then unintentionally broadcasting a revoked
1868 * transaction and losing money. This is a risk because previous channel states
1869 * are toxic, so it's important that whatever channel state is persisted is
1872 typedef struct LDKPersist {
1875 * Persist a new channel's data. The data can be stored any way you want, but
1876 * the identifier provided by Rust-Lightning is the channel's outpoint (and
1877 * it is up to you to maintain a correct mapping between the outpoint and the
1878 * stored channel data). Note that you **must** persist every new monitor to
1879 * disk. See the `Persist` trait documentation for more details.
1881 * See [`ChannelMonitor::serialize_for_disk`] for writing out a `ChannelMonitor`,
1882 * and [`ChannelMonitorUpdateErr`] for requirements when returning errors.
1884 * [`ChannelMonitor::serialize_for_disk`]: struct.ChannelMonitor.html#method.serialize_for_disk
1885 * [`ChannelMonitorUpdateErr`]: enum.ChannelMonitorUpdateErr.html
1887 LDKCResult_NoneChannelMonitorUpdateErrZ (*persist_new_channel)(const void *this_arg, LDKOutPoint id, const LDKChannelMonitor *data);
1889 * Update one channel's data. The provided `ChannelMonitor` has already
1890 * applied the given update.
1892 * Note that on every update, you **must** persist either the
1893 * `ChannelMonitorUpdate` or the updated monitor itself to disk/backups. See
1894 * the `Persist` trait documentation for more details.
1896 * If an implementer chooses to persist the updates only, they need to make
1897 * sure that all the updates are applied to the `ChannelMonitors` *before*
1898 * the set of channel monitors is given to the `ChannelManager`
1899 * deserialization routine. See [`ChannelMonitor::update_monitor`] for
1900 * applying a monitor update to a monitor. If full `ChannelMonitors` are
1901 * persisted, then there is no need to persist individual updates.
1903 * Note that there could be a performance tradeoff between persisting complete
1904 * channel monitors on every update vs. persisting only updates and applying
1905 * them in batches. The size of each monitor grows `O(number of state updates)`
1906 * whereas updates are small and `O(1)`.
1908 * See [`ChannelMonitor::serialize_for_disk`] for writing out a `ChannelMonitor`,
1909 * [`ChannelMonitorUpdate::write`] for writing out an update, and
1910 * [`ChannelMonitorUpdateErr`] for requirements when returning errors.
1912 * [`ChannelMonitor::update_monitor`]: struct.ChannelMonitor.html#impl-1
1913 * [`ChannelMonitor::serialize_for_disk`]: struct.ChannelMonitor.html#method.serialize_for_disk
1914 * [`ChannelMonitorUpdate::write`]: struct.ChannelMonitorUpdate.html#method.write
1915 * [`ChannelMonitorUpdateErr`]: enum.ChannelMonitorUpdateErr.html
1917 LDKCResult_NoneChannelMonitorUpdateErrZ (*update_persisted_channel)(const void *this_arg, LDKOutPoint id, const LDKChannelMonitorUpdate *update, const LDKChannelMonitor *data);
1918 void (*free)(void *this_arg);
1924 * An implementation of [`chain::Watch`] for monitoring channels.
1926 * Connected and disconnected blocks must be provided to `ChainMonitor` as documented by
1927 * [`chain::Watch`]. May be used in conjunction with [`ChannelManager`] to monitor channels locally
1928 * or used independently to monitor channels remotely. See the [module-level documentation] for
1931 * [`chain::Watch`]: ../trait.Watch.html
1932 * [`ChannelManager`]: ../../ln/channelmanager/struct.ChannelManager.html
1933 * [module-level documentation]: index.html
1935 typedef struct MUST_USE_STRUCT LDKChainMonitor {
1937 * Nearly everywhere, inner must be non-null, however in places where
1938 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1940 LDKnativeChainMonitor *inner;
1944 typedef struct LDKCVecTempl_C2TupleTempl_usize__Transaction {
1945 LDKC2TupleTempl_usize__Transaction *data;
1947 } LDKCVecTempl_C2TupleTempl_usize__Transaction;
1949 typedef LDKCVecTempl_C2TupleTempl_usize__Transaction LDKCVec_C2Tuple_usizeTransactionZZ;
1954 * Simple structure sent back by `chain::Watch` when an HTLC from a forward channel is detected on
1955 * chain. Used to update the corresponding HTLC in the backward channel. Failing to pass the
1956 * preimage claim backward will lead to loss of funds.
1958 * [`chain::Watch`]: ../trait.Watch.html
1960 typedef struct MUST_USE_STRUCT LDKHTLCUpdate {
1962 * Nearly everywhere, inner must be non-null, however in places where
1963 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1965 LDKnativeHTLCUpdate *inner;
1969 typedef struct LDKCVecTempl_Transaction {
1970 LDKTransaction *data;
1972 } LDKCVecTempl_Transaction;
1974 typedef LDKCVecTempl_Transaction LDKCVec_TransactionZ;
1976 typedef struct LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_C2TupleTempl_u32__TxOut {
1977 LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_C2TupleTempl_u32__TxOut *data;
1979 } LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_C2TupleTempl_u32__TxOut;
1981 typedef LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_C2TupleTempl_u32__TxOut LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ;
1983 typedef struct LDKSecretKey {
1988 * A trait to describe an object which can get user secrets and key material.
1990 typedef struct LDKKeysInterface {
1993 * Get node secret key (aka node_id or network_key)
1995 LDKSecretKey (*get_node_secret)(const void *this_arg);
1997 * Get destination redeemScript to encumber static protocol exit points.
1999 LDKCVec_u8Z (*get_destination_script)(const void *this_arg);
2001 * Get shutdown_pubkey to use as PublicKey at channel closure
2003 LDKPublicKey (*get_shutdown_pubkey)(const void *this_arg);
2005 * Get a new set of ChannelKeys for per-channel secrets. These MUST be unique even if you
2006 * restarted with some stale data!
2008 LDKChannelKeys (*get_channel_keys)(const void *this_arg, bool inbound, uint64_t channel_value_satoshis);
2010 * Gets a unique, cryptographically-secure, random 32 byte value. This is used for encrypting
2011 * onion packets and for temporary channel IDs. There is no requirement that these be
2012 * persisted anywhere, though they must be unique across restarts.
2014 LDKThirtyTwoBytes (*get_secure_random_bytes)(const void *this_arg);
2015 void (*free)(void *this_arg);
2021 * A simple implementation of ChannelKeys that just keeps the private keys in memory.
2023 typedef struct MUST_USE_STRUCT LDKInMemoryChannelKeys {
2025 * Nearly everywhere, inner must be non-null, however in places where
2026 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2028 LDKnativeInMemoryChannelKeys *inner;
2030 } LDKInMemoryChannelKeys;
2035 * Simple KeysInterface implementor that takes a 32-byte seed for use as a BIP 32 extended key
2036 * and derives keys from that.
2038 * Your node_id is seed/0'
2039 * ChannelMonitor closes may use seed/1'
2040 * Cooperative closes may use seed/2'
2041 * The two close keys may be needed to claim on-chain funds!
2043 typedef struct MUST_USE_STRUCT LDKKeysManager {
2045 * Nearly everywhere, inner must be non-null, however in places where
2046 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2048 LDKnativeKeysManager *inner;
2055 * Manager which keeps track of a number of channels and sends messages to the appropriate
2056 * channel, also tracking HTLC preimages and forwarding onion packets appropriately.
2058 * Implements ChannelMessageHandler, handling the multi-channel parts and passing things through
2059 * to individual Channels.
2061 * Implements Writeable to write out all channel state to disk. Implies peer_disconnected() for
2062 * all peers during write/read (though does not modify this instance, only the instance being
2063 * serialized). This will result in any channels which have not yet exchanged funding_created (ie
2064 * called funding_transaction_generated for outbound channels).
2066 * Note that you can be a bit lazier about writing out ChannelManager than you can be with
2067 * ChannelMonitors. With ChannelMonitors you MUST write each monitor update out to disk before
2068 * returning from chain::Watch::watch_/update_channel, with ChannelManagers, writing updates
2069 * happens out-of-band (and will prevent any other ChannelManager operations from occurring during
2070 * the serialization process). If the deserialized version is out-of-date compared to the
2071 * ChannelMonitors passed by reference to read(), those channels will be force-closed based on the
2072 * ChannelMonitor state and no funds will be lost (mod on-chain transaction fees).
2074 * Note that the deserializer is only implemented for (Sha256dHash, ChannelManager), which
2075 * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
2076 * the \"reorg path\" (ie call block_disconnected() until you get to a common block and then call
2077 * block_connected() to step towards your best block) upon deserialization before using the
2080 * Note that ChannelManager is responsible for tracking liveness of its channels and generating
2081 * ChannelUpdate messages informing peers that the channel is temporarily disabled. To avoid
2082 * spam due to quick disconnection/reconnection, updates are not sent until the channel has been
2083 * offline for a full minute. In order to track this, you must call
2084 * timer_chan_freshness_every_min roughly once per minute, though it doesn't have to be perfect.
2086 * Rather than using a plain ChannelManager, it is preferable to use either a SimpleArcChannelManager
2087 * a SimpleRefChannelManager, for conciseness. See their documentation for more details, but
2088 * essentially you should default to using a SimpleRefChannelManager, and use a
2089 * SimpleArcChannelManager when you require a ChannelManager with a static lifetime, such as when
2090 * you're using lightning-net-tokio.
2092 typedef struct MUST_USE_STRUCT LDKChannelManager {
2094 * Nearly everywhere, inner must be non-null, however in places where
2095 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2097 LDKnativeChannelManager *inner;
2099 } LDKChannelManager;
2104 * Details of a channel, as returned by ChannelManager::list_channels and ChannelManager::list_usable_channels
2106 typedef struct MUST_USE_STRUCT LDKChannelDetails {
2108 * Nearly everywhere, inner must be non-null, however in places where
2109 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2111 LDKnativeChannelDetails *inner;
2113 } LDKChannelDetails;
2118 * Features used within an `init` message.
2120 typedef struct MUST_USE_STRUCT LDKInitFeatures {
2122 * Nearly everywhere, inner must be non-null, however in places where
2123 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2125 LDKnativeInitFeatures *inner;
2129 typedef struct LDKCVecTempl_ChannelDetails {
2130 LDKChannelDetails *data;
2132 } LDKCVecTempl_ChannelDetails;
2134 typedef LDKCVecTempl_ChannelDetails LDKCVec_ChannelDetailsZ;
2139 * A route directs a payment from the sender (us) to the recipient. If the recipient supports MPP,
2140 * it can take multiple paths. Each path is composed of one or more hops through the network.
2142 typedef struct MUST_USE_STRUCT LDKRoute {
2144 * Nearly everywhere, inner must be non-null, however in places where
2145 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2147 LDKnativeRoute *inner;
2151 typedef struct LDKThreeBytes {
2155 typedef struct LDKFourBytes {
2159 typedef struct LDKSixteenBytes {
2163 typedef struct LDKTenBytes {
2168 * An address which can be used to connect to a remote peer
2170 typedef enum LDKNetAddress_Tag {
2172 * An IPv4 address/port on which the peer is listening.
2176 * An IPv6 address/port on which the peer is listening.
2180 * An old-style Tor onion address/port on which the peer is listening.
2182 LDKNetAddress_OnionV2,
2184 * A new-style Tor onion address/port on which the peer is listening.
2185 * To create the human-readable \"hostname\", concatenate ed25519_pubkey, checksum, and version,
2186 * wrap as base32 and append \".onion\".
2188 LDKNetAddress_OnionV3,
2190 * Must be last for serialization purposes
2192 LDKNetAddress_Sentinel,
2193 } LDKNetAddress_Tag;
2195 typedef struct LDKNetAddress_LDKIPv4_Body {
2198 } LDKNetAddress_LDKIPv4_Body;
2200 typedef struct LDKNetAddress_LDKIPv6_Body {
2201 LDKSixteenBytes addr;
2203 } LDKNetAddress_LDKIPv6_Body;
2205 typedef struct LDKNetAddress_LDKOnionV2_Body {
2208 } LDKNetAddress_LDKOnionV2_Body;
2210 typedef struct LDKNetAddress_LDKOnionV3_Body {
2211 LDKThirtyTwoBytes ed25519_pubkey;
2215 } LDKNetAddress_LDKOnionV3_Body;
2217 typedef struct LDKNetAddress {
2218 LDKNetAddress_Tag tag;
2220 LDKNetAddress_LDKIPv4_Body i_pv4;
2221 LDKNetAddress_LDKIPv6_Body i_pv6;
2222 LDKNetAddress_LDKOnionV2_Body onion_v2;
2223 LDKNetAddress_LDKOnionV3_Body onion_v3;
2227 typedef struct LDKCVecTempl_NetAddress {
2228 LDKNetAddress *data;
2230 } LDKCVecTempl_NetAddress;
2232 typedef LDKCVecTempl_NetAddress LDKCVec_NetAddressZ;
2237 * An update_add_htlc message to be sent or received from a peer
2239 typedef struct MUST_USE_STRUCT LDKUpdateAddHTLC {
2241 * Nearly everywhere, inner must be non-null, however in places where
2242 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2244 LDKnativeUpdateAddHTLC *inner;
2251 * An update_fulfill_htlc message to be sent or received from a peer
2253 typedef struct MUST_USE_STRUCT LDKUpdateFulfillHTLC {
2255 * Nearly everywhere, inner must be non-null, however in places where
2256 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2258 LDKnativeUpdateFulfillHTLC *inner;
2260 } LDKUpdateFulfillHTLC;
2265 * An update_fail_htlc message to be sent or received from a peer
2267 typedef struct MUST_USE_STRUCT LDKUpdateFailHTLC {
2269 * Nearly everywhere, inner must be non-null, however in places where
2270 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2272 LDKnativeUpdateFailHTLC *inner;
2274 } LDKUpdateFailHTLC;
2279 * An update_fail_malformed_htlc message to be sent or received from a peer
2281 typedef struct MUST_USE_STRUCT LDKUpdateFailMalformedHTLC {
2283 * Nearly everywhere, inner must be non-null, however in places where
2284 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2286 LDKnativeUpdateFailMalformedHTLC *inner;
2288 } LDKUpdateFailMalformedHTLC;
2293 * A commitment_signed message to be sent or received from a peer
2295 typedef struct MUST_USE_STRUCT LDKCommitmentSigned {
2297 * Nearly everywhere, inner must be non-null, however in places where
2298 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2300 LDKnativeCommitmentSigned *inner;
2302 } LDKCommitmentSigned;
2307 * An update_fee message to be sent or received from a peer
2309 typedef struct MUST_USE_STRUCT LDKUpdateFee {
2311 * Nearly everywhere, inner must be non-null, however in places where
2312 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2314 LDKnativeUpdateFee *inner;
2321 * An init message to be sent or received from a peer
2323 typedef struct MUST_USE_STRUCT LDKInit {
2325 * Nearly everywhere, inner must be non-null, however in places where
2326 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2328 LDKnativeInit *inner;
2333 * A trait to describe an object which can receive channel messages.
2335 * Messages MAY be called in parallel when they originate from different their_node_ids, however
2336 * they MUST NOT be called in parallel when the two calls have the same their_node_id.
2338 typedef struct LDKChannelMessageHandler {
2341 * Handle an incoming open_channel message from the given peer.
2343 void (*handle_open_channel)(const void *this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel *msg);
2345 * Handle an incoming accept_channel message from the given peer.
2347 void (*handle_accept_channel)(const void *this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel *msg);
2349 * Handle an incoming funding_created message from the given peer.
2351 void (*handle_funding_created)(const void *this_arg, LDKPublicKey their_node_id, const LDKFundingCreated *msg);
2353 * Handle an incoming funding_signed message from the given peer.
2355 void (*handle_funding_signed)(const void *this_arg, LDKPublicKey their_node_id, const LDKFundingSigned *msg);
2357 * Handle an incoming funding_locked message from the given peer.
2359 void (*handle_funding_locked)(const void *this_arg, LDKPublicKey their_node_id, const LDKFundingLocked *msg);
2361 * Handle an incoming shutdown message from the given peer.
2363 void (*handle_shutdown)(const void *this_arg, LDKPublicKey their_node_id, const LDKShutdown *msg);
2365 * Handle an incoming closing_signed message from the given peer.
2367 void (*handle_closing_signed)(const void *this_arg, LDKPublicKey their_node_id, const LDKClosingSigned *msg);
2369 * Handle an incoming update_add_htlc message from the given peer.
2371 void (*handle_update_add_htlc)(const void *this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC *msg);
2373 * Handle an incoming update_fulfill_htlc message from the given peer.
2375 void (*handle_update_fulfill_htlc)(const void *this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC *msg);
2377 * Handle an incoming update_fail_htlc message from the given peer.
2379 void (*handle_update_fail_htlc)(const void *this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC *msg);
2381 * Handle an incoming update_fail_malformed_htlc message from the given peer.
2383 void (*handle_update_fail_malformed_htlc)(const void *this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC *msg);
2385 * Handle an incoming commitment_signed message from the given peer.
2387 void (*handle_commitment_signed)(const void *this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned *msg);
2389 * Handle an incoming revoke_and_ack message from the given peer.
2391 void (*handle_revoke_and_ack)(const void *this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK *msg);
2393 * Handle an incoming update_fee message from the given peer.
2395 void (*handle_update_fee)(const void *this_arg, LDKPublicKey their_node_id, const LDKUpdateFee *msg);
2397 * Handle an incoming announcement_signatures message from the given peer.
2399 void (*handle_announcement_signatures)(const void *this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures *msg);
2401 * Indicates a connection to the peer failed/an existing connection was lost. If no connection
2402 * is believed to be possible in the future (eg they're sending us messages we don't
2403 * understand or indicate they require unknown feature bits), no_connection_possible is set
2404 * and any outstanding channels should be failed.
2406 void (*peer_disconnected)(const void *this_arg, LDKPublicKey their_node_id, bool no_connection_possible);
2408 * Handle a peer reconnecting, possibly generating channel_reestablish message(s).
2410 void (*peer_connected)(const void *this_arg, LDKPublicKey their_node_id, const LDKInit *msg);
2412 * Handle an incoming channel_reestablish message from the given peer.
2414 void (*handle_channel_reestablish)(const void *this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish *msg);
2416 * Handle an incoming error message from the given peer.
2418 void (*handle_error)(const void *this_arg, LDKPublicKey their_node_id, const LDKErrorMessage *msg);
2419 LDKMessageSendEventsProvider MessageSendEventsProvider;
2420 void (*free)(void *this_arg);
2421 } LDKChannelMessageHandler;
2426 * Arguments for the creation of a ChannelManager that are not deserialized.
2428 * At a high-level, the process for deserializing a ChannelManager and resuming normal operation
2430 * 1) Deserialize all stored ChannelMonitors.
2431 * 2) Deserialize the ChannelManager by filling in this struct and calling <(Sha256dHash,
2432 * ChannelManager)>::read(reader, args).
2433 * This may result in closing some Channels if the ChannelMonitor is newer than the stored
2434 * ChannelManager state to ensure no loss of funds. Thus, transactions may be broadcasted.
2435 * 3) Register all relevant ChannelMonitor outpoints with your chain watch mechanism using
2436 * ChannelMonitor::get_outputs_to_watch() and ChannelMonitor::get_funding_txo().
2437 * 4) Reconnect blocks on your ChannelMonitors.
2438 * 5) Move the ChannelMonitors into your local chain::Watch.
2439 * 6) Disconnect/connect blocks on the ChannelManager.
2441 typedef struct MUST_USE_STRUCT LDKChannelManagerReadArgs {
2443 * Nearly everywhere, inner must be non-null, however in places where
2444 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2446 LDKnativeChannelManagerReadArgs *inner;
2448 } LDKChannelManagerReadArgs;
2450 typedef struct LDKCVecTempl_ChannelMonitor {
2451 LDKChannelMonitor *data;
2453 } LDKCVecTempl_ChannelMonitor;
2455 typedef LDKCVecTempl_ChannelMonitor LDKCVec_ChannelMonitorZ;
2460 * An error in decoding a message or struct.
2462 typedef struct MUST_USE_STRUCT LDKDecodeError {
2464 * Nearly everywhere, inner must be non-null, however in places where
2465 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2467 LDKnativeDecodeError *inner;
2474 * A ping message to be sent or received from a peer
2476 typedef struct MUST_USE_STRUCT LDKPing {
2478 * Nearly everywhere, inner must be non-null, however in places where
2479 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2481 LDKnativePing *inner;
2488 * A pong message to be sent or received from a peer
2490 typedef struct MUST_USE_STRUCT LDKPong {
2492 * Nearly everywhere, inner must be non-null, however in places where
2493 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2495 LDKnativePong *inner;
2502 * Proof that the sender knows the per-commitment secret of the previous commitment transaction.
2503 * This is used to convince the recipient that the channel is at a certain commitment
2504 * number even if they lost that data due to a local failure. Of course, the peer may lie
2505 * and even later commitments may have been revoked.
2507 typedef struct MUST_USE_STRUCT LDKDataLossProtect {
2509 * Nearly everywhere, inner must be non-null, however in places where
2510 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2512 LDKnativeDataLossProtect *inner;
2514 } LDKDataLossProtect;
2519 * The unsigned part of a node_announcement
2521 typedef struct MUST_USE_STRUCT LDKUnsignedNodeAnnouncement {
2523 * Nearly everywhere, inner must be non-null, however in places where
2524 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2526 LDKnativeUnsignedNodeAnnouncement *inner;
2528 } LDKUnsignedNodeAnnouncement;
2533 * Features used within a `node_announcement` message.
2535 typedef struct MUST_USE_STRUCT LDKNodeFeatures {
2537 * Nearly everywhere, inner must be non-null, however in places where
2538 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2540 LDKnativeNodeFeatures *inner;
2547 * Features used within a `channel_announcement` message.
2549 typedef struct MUST_USE_STRUCT LDKChannelFeatures {
2551 * Nearly everywhere, inner must be non-null, however in places where
2552 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2554 LDKnativeChannelFeatures *inner;
2556 } LDKChannelFeatures;
2561 * The unsigned part of a channel_update
2563 typedef struct MUST_USE_STRUCT LDKUnsignedChannelUpdate {
2565 * Nearly everywhere, inner must be non-null, however in places where
2566 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2568 LDKnativeUnsignedChannelUpdate *inner;
2570 } LDKUnsignedChannelUpdate;
2575 * A query_channel_range message is used to query a peer for channel
2576 * UTXOs in a range of blocks. The recipient of a query makes a best
2577 * effort to reply to the query using one or more reply_channel_range
2580 typedef struct MUST_USE_STRUCT LDKQueryChannelRange {
2582 * Nearly everywhere, inner must be non-null, however in places where
2583 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2585 LDKnativeQueryChannelRange *inner;
2587 } LDKQueryChannelRange;
2592 * A reply_channel_range message is a reply to a query_channel_range
2593 * message. Multiple reply_channel_range messages can be sent in reply
2594 * to a single query_channel_range message. The query recipient makes a
2595 * best effort to respond based on their local network view which may
2596 * not be a perfect view of the network. The short_channel_ids in the
2597 * reply are encoded. We only support encoding_type=0 uncompressed
2598 * serialization and do not support encoding_type=1 zlib serialization.
2600 typedef struct MUST_USE_STRUCT LDKReplyChannelRange {
2602 * Nearly everywhere, inner must be non-null, however in places where
2603 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2605 LDKnativeReplyChannelRange *inner;
2607 } LDKReplyChannelRange;
2609 typedef struct LDKCVecTempl_u64 {
2614 typedef LDKCVecTempl_u64 LDKCVec_u64Z;
2619 * A query_short_channel_ids message is used to query a peer for
2620 * routing gossip messages related to one or more short_channel_ids.
2621 * The query recipient will reply with the latest, if available,
2622 * channel_announcement, channel_update and node_announcement messages
2623 * it maintains for the requested short_channel_ids followed by a
2624 * reply_short_channel_ids_end message. The short_channel_ids sent in
2625 * this query are encoded. We only support encoding_type=0 uncompressed
2626 * serialization and do not support encoding_type=1 zlib serialization.
2628 typedef struct MUST_USE_STRUCT LDKQueryShortChannelIds {
2630 * Nearly everywhere, inner must be non-null, however in places where
2631 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2633 LDKnativeQueryShortChannelIds *inner;
2635 } LDKQueryShortChannelIds;
2640 * A reply_short_channel_ids_end message is sent as a reply to a
2641 * query_short_channel_ids message. The query recipient makes a best
2642 * effort to respond based on their local network view which may not be
2643 * a perfect view of the network.
2645 typedef struct MUST_USE_STRUCT LDKReplyShortChannelIdsEnd {
2647 * Nearly everywhere, inner must be non-null, however in places where
2648 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2650 LDKnativeReplyShortChannelIdsEnd *inner;
2652 } LDKReplyShortChannelIdsEnd;
2657 * A gossip_timestamp_filter message is used by a node to request
2658 * gossip relay for messages in the requested time range when the
2659 * gossip_queries feature has been negotiated.
2661 typedef struct MUST_USE_STRUCT LDKGossipTimestampFilter {
2663 * Nearly everywhere, inner must be non-null, however in places where
2664 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2666 LDKnativeGossipTimestampFilter *inner;
2668 } LDKGossipTimestampFilter;
2670 typedef struct LDKCVecTempl_UpdateAddHTLC {
2671 LDKUpdateAddHTLC *data;
2673 } LDKCVecTempl_UpdateAddHTLC;
2675 typedef LDKCVecTempl_UpdateAddHTLC LDKCVec_UpdateAddHTLCZ;
2677 typedef struct LDKCVecTempl_UpdateFulfillHTLC {
2678 LDKUpdateFulfillHTLC *data;
2680 } LDKCVecTempl_UpdateFulfillHTLC;
2682 typedef LDKCVecTempl_UpdateFulfillHTLC LDKCVec_UpdateFulfillHTLCZ;
2684 typedef struct LDKCVecTempl_UpdateFailHTLC {
2685 LDKUpdateFailHTLC *data;
2687 } LDKCVecTempl_UpdateFailHTLC;
2689 typedef LDKCVecTempl_UpdateFailHTLC LDKCVec_UpdateFailHTLCZ;
2691 typedef struct LDKCVecTempl_UpdateFailMalformedHTLC {
2692 LDKUpdateFailMalformedHTLC *data;
2694 } LDKCVecTempl_UpdateFailMalformedHTLC;
2696 typedef LDKCVecTempl_UpdateFailMalformedHTLC LDKCVec_UpdateFailMalformedHTLCZ;
2698 typedef union LDKCResultPtr_bool__LightningError {
2700 LDKLightningError *err;
2701 } LDKCResultPtr_bool__LightningError;
2703 typedef struct LDKCResultTempl_bool__LightningError {
2704 LDKCResultPtr_bool__LightningError contents;
2706 } LDKCResultTempl_bool__LightningError;
2708 typedef LDKCResultTempl_bool__LightningError LDKCResult_boolLightningErrorZ;
2710 typedef struct LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate {
2711 LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate *data;
2713 } LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate;
2715 typedef LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ;
2717 typedef struct LDKCVecTempl_NodeAnnouncement {
2718 LDKNodeAnnouncement *data;
2720 } LDKCVecTempl_NodeAnnouncement;
2722 typedef LDKCVecTempl_NodeAnnouncement LDKCVec_NodeAnnouncementZ;
2725 * A trait to describe an object which can receive routing messages.
2727 typedef struct LDKRoutingMessageHandler {
2730 * Handle an incoming node_announcement message, returning true if it should be forwarded on,
2731 * false or returning an Err otherwise.
2733 LDKCResult_boolLightningErrorZ (*handle_node_announcement)(const void *this_arg, const LDKNodeAnnouncement *msg);
2735 * Handle a channel_announcement message, returning true if it should be forwarded on, false
2736 * or returning an Err otherwise.
2738 LDKCResult_boolLightningErrorZ (*handle_channel_announcement)(const void *this_arg, const LDKChannelAnnouncement *msg);
2740 * Handle an incoming channel_update message, returning true if it should be forwarded on,
2741 * false or returning an Err otherwise.
2743 LDKCResult_boolLightningErrorZ (*handle_channel_update)(const void *this_arg, const LDKChannelUpdate *msg);
2745 * Handle some updates to the route graph that we learned due to an outbound failed payment.
2747 void (*handle_htlc_fail_channel_update)(const void *this_arg, const LDKHTLCFailChannelUpdate *update);
2749 * Gets a subset of the channel announcements and updates required to dump our routing table
2750 * to a remote node, starting at the short_channel_id indicated by starting_point and
2751 * including the batch_amount entries immediately higher in numerical value than starting_point.
2753 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ (*get_next_channel_announcements)(const void *this_arg, uint64_t starting_point, uint8_t batch_amount);
2755 * Gets a subset of the node announcements required to dump our routing table to a remote node,
2756 * starting at the node *after* the provided publickey and including batch_amount entries
2757 * immediately higher (as defined by <PublicKey as Ord>::cmp) than starting_point.
2758 * If None is provided for starting_point, we start at the first node.
2760 LDKCVec_NodeAnnouncementZ (*get_next_node_announcements)(const void *this_arg, LDKPublicKey starting_point, uint8_t batch_amount);
2762 * Returns whether a full sync should be requested from a peer.
2764 bool (*should_request_full_sync)(const void *this_arg, LDKPublicKey node_id);
2765 void (*free)(void *this_arg);
2766 } LDKRoutingMessageHandler;
2771 * Provides references to trait impls which handle different types of messages.
2773 typedef struct MUST_USE_STRUCT LDKMessageHandler {
2775 * Nearly everywhere, inner must be non-null, however in places where
2776 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2778 LDKnativeMessageHandler *inner;
2780 } LDKMessageHandler;
2783 * Provides an object which can be used to send data to and which uniquely identifies a connection
2784 * to a remote host. You will need to be able to generate multiple of these which meet Eq and
2785 * implement Hash to meet the PeerManager API.
2787 * For efficiency, Clone should be relatively cheap for this type.
2789 * You probably want to just extend an int and put a file descriptor in a struct and implement
2790 * send_data. Note that if you are using a higher-level net library that may call close() itself,
2791 * be careful to ensure you don't have races whereby you might register a new connection with an
2792 * fd which is the same as a previous one which has yet to be removed via
2793 * PeerManager::socket_disconnected().
2795 typedef struct LDKSocketDescriptor {
2798 * Attempts to send some data from the given slice to the peer.
2800 * Returns the amount of data which was sent, possibly 0 if the socket has since disconnected.
2801 * Note that in the disconnected case, socket_disconnected must still fire and further write
2802 * attempts may occur until that time.
2804 * If the returned size is smaller than data.len(), a write_available event must
2805 * trigger the next time more data can be written. Additionally, until the a send_data event
2806 * completes fully, no further read_events should trigger on the same peer!
2808 * If a read_event on this descriptor had previously returned true (indicating that read
2809 * events should be paused to prevent DoS in the send buffer), resume_read may be set
2810 * indicating that read events on this descriptor should resume. A resume_read of false does
2811 * *not* imply that further read events should be paused.
2813 uintptr_t (*send_data)(void *this_arg, LDKu8slice data, bool resume_read);
2815 * Disconnect the socket pointed to by this SocketDescriptor. Once this function returns, no
2816 * more calls to write_buffer_space_avail, read_event or socket_disconnected may be made with
2817 * this descriptor. No socket_disconnected call should be generated as a result of this call,
2818 * though races may occur whereby disconnect_socket is called after a call to
2819 * socket_disconnected but prior to socket_disconnected returning.
2821 void (*disconnect_socket)(void *this_arg);
2822 bool (*eq)(const void *this_arg, const LDKSocketDescriptor *other_arg);
2823 uint64_t (*hash)(const void *this_arg);
2824 void *(*clone)(const void *this_arg);
2825 void (*free)(void *this_arg);
2826 } LDKSocketDescriptor;
2831 * A PeerManager manages a set of peers, described by their SocketDescriptor and marshalls socket
2832 * events into messages which it passes on to its MessageHandlers.
2834 * Rather than using a plain PeerManager, it is preferable to use either a SimpleArcPeerManager
2835 * a SimpleRefPeerManager, for conciseness. See their documentation for more details, but
2836 * essentially you should default to using a SimpleRefPeerManager, and use a
2837 * SimpleArcPeerManager when you require a PeerManager with a static lifetime, such as when
2838 * you're using lightning-net-tokio.
2840 typedef struct MUST_USE_STRUCT LDKPeerManager {
2842 * Nearly everywhere, inner must be non-null, however in places where
2843 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2845 LDKnativePeerManager *inner;
2849 typedef struct LDKCVecTempl_PublicKey {
2852 } LDKCVecTempl_PublicKey;
2854 typedef LDKCVecTempl_PublicKey LDKCVec_PublicKeyZ;
2856 typedef union LDKCResultPtr_CVecTempl_u8_____PeerHandleError {
2857 LDKCVecTempl_u8 *result;
2858 LDKPeerHandleError *err;
2859 } LDKCResultPtr_CVecTempl_u8_____PeerHandleError;
2861 typedef struct LDKCResultTempl_CVecTempl_u8_____PeerHandleError {
2862 LDKCResultPtr_CVecTempl_u8_____PeerHandleError contents;
2864 } LDKCResultTempl_CVecTempl_u8_____PeerHandleError;
2866 typedef LDKCResultTempl_CVecTempl_u8_____PeerHandleError LDKCResult_CVec_u8ZPeerHandleErrorZ;
2868 typedef union LDKCResultPtr_bool__PeerHandleError {
2870 LDKPeerHandleError *err;
2871 } LDKCResultPtr_bool__PeerHandleError;
2873 typedef struct LDKCResultTempl_bool__PeerHandleError {
2874 LDKCResultPtr_bool__PeerHandleError contents;
2876 } LDKCResultTempl_bool__PeerHandleError;
2878 typedef LDKCResultTempl_bool__PeerHandleError LDKCResult_boolPeerHandleErrorZ;
2880 typedef union LDKCResultPtr_SecretKey__Secp256k1Error {
2881 LDKSecretKey *result;
2882 LDKSecp256k1Error *err;
2883 } LDKCResultPtr_SecretKey__Secp256k1Error;
2885 typedef struct LDKCResultTempl_SecretKey__Secp256k1Error {
2886 LDKCResultPtr_SecretKey__Secp256k1Error contents;
2888 } LDKCResultTempl_SecretKey__Secp256k1Error;
2890 typedef LDKCResultTempl_SecretKey__Secp256k1Error LDKCResult_SecretKeySecpErrorZ;
2892 typedef union LDKCResultPtr_PublicKey__Secp256k1Error {
2893 LDKPublicKey *result;
2894 LDKSecp256k1Error *err;
2895 } LDKCResultPtr_PublicKey__Secp256k1Error;
2897 typedef struct LDKCResultTempl_PublicKey__Secp256k1Error {
2898 LDKCResultPtr_PublicKey__Secp256k1Error contents;
2900 } LDKCResultTempl_PublicKey__Secp256k1Error;
2902 typedef LDKCResultTempl_PublicKey__Secp256k1Error LDKCResult_PublicKeySecpErrorZ;
2907 * The set of public keys which are used in the creation of one commitment transaction.
2908 * These are derived from the channel base keys and per-commitment data.
2910 * A broadcaster key is provided from potential broadcaster of the computed transaction.
2911 * A countersignatory key is coming from a protocol participant unable to broadcast the
2914 * These keys are assumed to be good, either because the code derived them from
2915 * channel basepoints via the new function, or they were obtained via
2916 * PreCalculatedTxCreationKeys.trust_key_derivation because we trusted the source of the
2917 * pre-calculated keys.
2919 typedef struct MUST_USE_STRUCT LDKTxCreationKeys {
2921 * Nearly everywhere, inner must be non-null, however in places where
2922 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2924 LDKnativeTxCreationKeys *inner;
2926 } LDKTxCreationKeys;
2928 typedef union LDKCResultPtr_TxCreationKeys__Secp256k1Error {
2929 LDKTxCreationKeys *result;
2930 LDKSecp256k1Error *err;
2931 } LDKCResultPtr_TxCreationKeys__Secp256k1Error;
2933 typedef struct LDKCResultTempl_TxCreationKeys__Secp256k1Error {
2934 LDKCResultPtr_TxCreationKeys__Secp256k1Error contents;
2936 } LDKCResultTempl_TxCreationKeys__Secp256k1Error;
2938 typedef LDKCResultTempl_TxCreationKeys__Secp256k1Error LDKCResult_TxCreationKeysSecpErrorZ;
2940 typedef struct LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature {
2941 LDKC2TupleTempl_HTLCOutputInCommitment__Signature *data;
2943 } LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature;
2945 typedef LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ;
2952 typedef struct MUST_USE_STRUCT LDKRouteHop {
2954 * Nearly everywhere, inner must be non-null, however in places where
2955 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2957 LDKnativeRouteHop *inner;
2961 typedef struct LDKCVecTempl_RouteHop {
2964 } LDKCVecTempl_RouteHop;
2966 typedef struct LDKCVecTempl_CVecTempl_RouteHop {
2967 LDKCVecTempl_RouteHop *data;
2969 } LDKCVecTempl_CVecTempl_RouteHop;
2971 typedef LDKCVecTempl_CVecTempl_RouteHop LDKCVec_CVec_RouteHopZZ;
2976 * A channel descriptor which provides a last-hop route to get_route
2978 typedef struct MUST_USE_STRUCT LDKRouteHint {
2980 * Nearly everywhere, inner must be non-null, however in places where
2981 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2983 LDKnativeRouteHint *inner;
2990 * Fees for routing via a given channel or a node
2992 typedef struct MUST_USE_STRUCT LDKRoutingFees {
2994 * Nearly everywhere, inner must be non-null, however in places where
2995 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2997 LDKnativeRoutingFees *inner;
3001 typedef union LDKCResultPtr_Route__LightningError {
3003 LDKLightningError *err;
3004 } LDKCResultPtr_Route__LightningError;
3006 typedef struct LDKCResultTempl_Route__LightningError {
3007 LDKCResultPtr_Route__LightningError contents;
3009 } LDKCResultTempl_Route__LightningError;
3011 typedef LDKCResultTempl_Route__LightningError LDKCResult_RouteLightningErrorZ;
3016 * Represents the network as nodes and channels between them
3018 typedef struct MUST_USE_STRUCT LDKNetworkGraph {
3020 * Nearly everywhere, inner must be non-null, however in places where
3021 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3023 LDKnativeNetworkGraph *inner;
3027 typedef struct LDKCVecTempl_RouteHint {
3030 } LDKCVecTempl_RouteHint;
3032 typedef LDKCVecTempl_RouteHint LDKCVec_RouteHintZ;
3037 * A simple newtype for RwLockReadGuard<'a, NetworkGraph>.
3038 * This exists only to make accessing a RwLock<NetworkGraph> possible from
3039 * the C bindings, as it can be done directly in Rust code.
3041 typedef struct MUST_USE_STRUCT LDKLockedNetworkGraph {
3043 * Nearly everywhere, inner must be non-null, however in places where
3044 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3046 LDKnativeLockedNetworkGraph *inner;
3048 } LDKLockedNetworkGraph;
3053 * Receives and validates network updates from peers,
3054 * stores authentic and relevant data as a network graph.
3055 * This network graph is then used for routing payments.
3056 * Provides interface to help with initial routing sync by
3057 * serving historical announcements.
3059 typedef struct MUST_USE_STRUCT LDKNetGraphMsgHandler {
3061 * Nearly everywhere, inner must be non-null, however in places where
3062 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3064 LDKnativeNetGraphMsgHandler *inner;
3066 } LDKNetGraphMsgHandler;
3071 * Details about one direction of a channel. Received
3072 * within a channel update.
3074 typedef struct MUST_USE_STRUCT LDKDirectionalChannelInfo {
3076 * Nearly everywhere, inner must be non-null, however in places where
3077 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3079 LDKnativeDirectionalChannelInfo *inner;
3081 } LDKDirectionalChannelInfo;
3086 * Details about a channel (both directions).
3087 * Received within a channel announcement.
3089 typedef struct MUST_USE_STRUCT LDKChannelInfo {
3091 * Nearly everywhere, inner must be non-null, however in places where
3092 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3094 LDKnativeChannelInfo *inner;
3101 * Information received in the latest node_announcement from this node.
3103 typedef struct MUST_USE_STRUCT LDKNodeAnnouncementInfo {
3105 * Nearly everywhere, inner must be non-null, however in places where
3106 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3108 LDKnativeNodeAnnouncementInfo *inner;
3110 } LDKNodeAnnouncementInfo;
3115 * Details about a node in the network, known from the network announcement.
3117 typedef struct MUST_USE_STRUCT LDKNodeInfo {
3119 * Nearly everywhere, inner must be non-null, however in places where
3120 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3122 LDKnativeNodeInfo *inner;
3126 typedef LDKCVecTempl_RouteHop LDKCVec_RouteHopZ;
3128 extern const void (*C2Tuple_HTLCOutputInCommitmentSignatureZ_free)(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ);
3130 extern const void (*C2Tuple_OutPointScriptZ_free)(LDKC2Tuple_OutPointScriptZ);
3132 extern const void (*C2Tuple_SignatureCVec_SignatureZZ_free)(LDKC2Tuple_SignatureCVec_SignatureZZ);
3134 extern const void (*C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free)(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ);
3136 extern const void (*C2Tuple_u32TxOutZ_free)(LDKC2Tuple_u32TxOutZ);
3138 extern const void (*C2Tuple_u64u64Z_free)(LDKC2Tuple_u64u64Z);
3140 extern const void (*C2Tuple_usizeTransactionZ_free)(LDKC2Tuple_usizeTransactionZ);
3142 extern const void (*C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free)(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ);
3144 extern const uint64_t CLOSED_CHANNEL_UPDATE_ID;
3146 extern const void (*CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free)(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ);
3148 extern const LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok)(LDKC2Tuple_SignatureCVec_SignatureZZ);
3150 extern const void (*CResult_CVec_SignatureZNoneZ_free)(LDKCResult_CVec_SignatureZNoneZ);
3152 extern const LDKCResult_CVec_SignatureZNoneZ (*CResult_CVec_SignatureZNoneZ_ok)(LDKCVec_SignatureZ);
3154 extern const LDKCResult_CVec_u8ZPeerHandleErrorZ (*CResult_CVec_u8ZPeerHandleErrorZ_err)(LDKPeerHandleError);
3156 extern const void (*CResult_CVec_u8ZPeerHandleErrorZ_free)(LDKCResult_CVec_u8ZPeerHandleErrorZ);
3158 extern const LDKCResult_CVec_u8ZPeerHandleErrorZ (*CResult_CVec_u8ZPeerHandleErrorZ_ok)(LDKCVec_u8Z);
3160 extern const LDKCResult_NoneAPIErrorZ (*CResult_NoneAPIErrorZ_err)(LDKAPIError);
3162 extern const void (*CResult_NoneAPIErrorZ_free)(LDKCResult_NoneAPIErrorZ);
3164 extern const LDKCResult_NoneChannelMonitorUpdateErrZ (*CResult_NoneChannelMonitorUpdateErrZ_err)(LDKChannelMonitorUpdateErr);
3166 extern const void (*CResult_NoneChannelMonitorUpdateErrZ_free)(LDKCResult_NoneChannelMonitorUpdateErrZ);
3168 extern const LDKCResult_NoneLightningErrorZ (*CResult_NoneLightningErrorZ_err)(LDKLightningError);
3170 extern const void (*CResult_NoneLightningErrorZ_free)(LDKCResult_NoneLightningErrorZ);
3172 extern const LDKCResult_NoneMonitorUpdateErrorZ (*CResult_NoneMonitorUpdateErrorZ_err)(LDKMonitorUpdateError);
3174 extern const void (*CResult_NoneMonitorUpdateErrorZ_free)(LDKCResult_NoneMonitorUpdateErrorZ);
3176 extern const LDKCResult_NonePaymentSendFailureZ (*CResult_NonePaymentSendFailureZ_err)(LDKPaymentSendFailure);
3178 extern const void (*CResult_NonePaymentSendFailureZ_free)(LDKCResult_NonePaymentSendFailureZ);
3180 extern const LDKCResult_NonePeerHandleErrorZ (*CResult_NonePeerHandleErrorZ_err)(LDKPeerHandleError);
3182 extern const void (*CResult_NonePeerHandleErrorZ_free)(LDKCResult_NonePeerHandleErrorZ);
3184 extern const LDKCResult_PublicKeySecpErrorZ (*CResult_PublicKeySecpErrorZ_err)(LDKSecp256k1Error);
3186 extern const void (*CResult_PublicKeySecpErrorZ_free)(LDKCResult_PublicKeySecpErrorZ);
3188 extern const LDKCResult_PublicKeySecpErrorZ (*CResult_PublicKeySecpErrorZ_ok)(LDKPublicKey);
3190 extern const LDKCResult_RouteLightningErrorZ (*CResult_RouteLightningErrorZ_err)(LDKLightningError);
3192 extern const void (*CResult_RouteLightningErrorZ_free)(LDKCResult_RouteLightningErrorZ);
3194 extern const LDKCResult_RouteLightningErrorZ (*CResult_RouteLightningErrorZ_ok)(LDKRoute);
3196 extern const LDKCResult_SecretKeySecpErrorZ (*CResult_SecretKeySecpErrorZ_err)(LDKSecp256k1Error);
3198 extern const void (*CResult_SecretKeySecpErrorZ_free)(LDKCResult_SecretKeySecpErrorZ);
3200 extern const LDKCResult_SecretKeySecpErrorZ (*CResult_SecretKeySecpErrorZ_ok)(LDKSecretKey);
3202 extern const void (*CResult_SignatureNoneZ_free)(LDKCResult_SignatureNoneZ);
3204 extern const LDKCResult_SignatureNoneZ (*CResult_SignatureNoneZ_ok)(LDKSignature);
3206 extern const LDKCResult_TxCreationKeysSecpErrorZ (*CResult_TxCreationKeysSecpErrorZ_err)(LDKSecp256k1Error);
3208 extern const void (*CResult_TxCreationKeysSecpErrorZ_free)(LDKCResult_TxCreationKeysSecpErrorZ);
3210 extern const LDKCResult_TxCreationKeysSecpErrorZ (*CResult_TxCreationKeysSecpErrorZ_ok)(LDKTxCreationKeys);
3212 extern const LDKCResult_TxOutAccessErrorZ (*CResult_TxOutAccessErrorZ_err)(LDKAccessError);
3214 extern const void (*CResult_TxOutAccessErrorZ_free)(LDKCResult_TxOutAccessErrorZ);
3216 extern const LDKCResult_TxOutAccessErrorZ (*CResult_TxOutAccessErrorZ_ok)(LDKTxOut);
3218 extern const LDKCResult_boolLightningErrorZ (*CResult_boolLightningErrorZ_err)(LDKLightningError);
3220 extern const void (*CResult_boolLightningErrorZ_free)(LDKCResult_boolLightningErrorZ);
3222 extern const LDKCResult_boolLightningErrorZ (*CResult_boolLightningErrorZ_ok)(bool);
3224 extern const LDKCResult_boolPeerHandleErrorZ (*CResult_boolPeerHandleErrorZ_err)(LDKPeerHandleError);
3226 extern const void (*CResult_boolPeerHandleErrorZ_free)(LDKCResult_boolPeerHandleErrorZ);
3228 extern const LDKCResult_boolPeerHandleErrorZ (*CResult_boolPeerHandleErrorZ_ok)(bool);
3230 extern const void (*CVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ_free)(LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ);
3232 extern const void (*CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free)(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ);
3234 extern const void (*CVec_C2Tuple_u32TxOutZZ_free)(LDKCVec_C2Tuple_u32TxOutZZ);
3236 extern const void (*CVec_C2Tuple_usizeTransactionZZ_free)(LDKCVec_C2Tuple_usizeTransactionZZ);
3238 extern const void (*CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free)(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ);
3240 extern const void (*CVec_CVec_RouteHopZZ_free)(LDKCVec_CVec_RouteHopZZ);
3242 extern const void (*CVec_ChannelDetailsZ_free)(LDKCVec_ChannelDetailsZ);
3244 extern const void (*CVec_ChannelMonitorZ_free)(LDKCVec_ChannelMonitorZ);
3246 extern const void (*CVec_EventZ_free)(LDKCVec_EventZ);
3248 extern const void (*CVec_HTLCOutputInCommitmentZ_free)(LDKCVec_HTLCOutputInCommitmentZ);
3250 extern const void (*CVec_MessageSendEventZ_free)(LDKCVec_MessageSendEventZ);
3252 extern const void (*CVec_MonitorEventZ_free)(LDKCVec_MonitorEventZ);
3254 extern const void (*CVec_NetAddressZ_free)(LDKCVec_NetAddressZ);
3256 extern const void (*CVec_NodeAnnouncementZ_free)(LDKCVec_NodeAnnouncementZ);
3258 extern const void (*CVec_PublicKeyZ_free)(LDKCVec_PublicKeyZ);
3260 extern const void (*CVec_RouteHintZ_free)(LDKCVec_RouteHintZ);
3262 extern const void (*CVec_RouteHopZ_free)(LDKCVec_RouteHopZ);
3264 extern const void (*CVec_SignatureZ_free)(LDKCVec_SignatureZ);
3266 extern const void (*CVec_SpendableOutputDescriptorZ_free)(LDKCVec_SpendableOutputDescriptorZ);
3268 extern const void (*CVec_TransactionZ_free)(LDKCVec_TransactionZ);
3270 extern const void (*CVec_UpdateAddHTLCZ_free)(LDKCVec_UpdateAddHTLCZ);
3272 extern const void (*CVec_UpdateFailHTLCZ_free)(LDKCVec_UpdateFailHTLCZ);
3274 extern const void (*CVec_UpdateFailMalformedHTLCZ_free)(LDKCVec_UpdateFailMalformedHTLCZ);
3276 extern const void (*CVec_UpdateFulfillHTLCZ_free)(LDKCVec_UpdateFulfillHTLCZ);
3278 extern const void (*CVec_u64Z_free)(LDKCVec_u64Z);
3280 extern const void (*CVec_u8Z_free)(LDKCVec_u8Z);
3282 extern const uint64_t MIN_RELAY_FEE_SAT_PER_1000_WEIGHT;
3284 void Transaction_free(LDKTransaction _res);
3286 void TxOut_free(LDKTxOut _res);
3288 LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_new(uintptr_t a, LDKTransaction b);
3290 LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_ok(void);
3292 LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_ok(void);
3294 LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_new(LDKOutPoint a, LDKCVec_u8Z b);
3296 LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_new(uint32_t a, LDKTxOut b);
3298 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(LDKThirtyTwoBytes a, LDKCVec_C2Tuple_u32TxOutZZ b);
3300 LDKC2Tuple_u64u64Z C2Tuple_u64u64Z_new(uint64_t a, uint64_t b);
3302 LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_new(LDKSignature a, LDKCVec_SignatureZ b);
3304 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err(void);
3306 LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_err(void);
3308 LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_err(void);
3310 LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_ok(void);
3312 LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_ok(void);
3314 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(LDKChannelAnnouncement a, LDKChannelUpdate b, LDKChannelUpdate c);
3316 LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_ok(void);
3318 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ C2Tuple_HTLCOutputInCommitmentSignatureZ_new(LDKHTLCOutputInCommitment a, LDKSignature b);
3320 LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_ok(void);
3322 void Event_free(LDKEvent this_ptr);
3324 LDKEvent Event_clone(const LDKEvent *orig);
3326 void MessageSendEvent_free(LDKMessageSendEvent this_ptr);
3328 LDKMessageSendEvent MessageSendEvent_clone(const LDKMessageSendEvent *orig);
3331 * Calls the free function if one is set
3333 void MessageSendEventsProvider_free(LDKMessageSendEventsProvider this_ptr);
3336 * Calls the free function if one is set
3338 void EventsProvider_free(LDKEventsProvider this_ptr);
3340 void APIError_free(LDKAPIError this_ptr);
3342 LDKAPIError APIError_clone(const LDKAPIError *orig);
3344 LDKLevel Level_clone(const LDKLevel *orig);
3347 * Returns the most verbose logging level.
3349 MUST_USE_RES LDKLevel Level_max(void);
3352 * Calls the free function if one is set
3354 void Logger_free(LDKLogger this_ptr);
3356 void ChannelHandshakeConfig_free(LDKChannelHandshakeConfig this_ptr);
3358 LDKChannelHandshakeConfig ChannelHandshakeConfig_clone(const LDKChannelHandshakeConfig *orig);
3361 * Confirmations we will wait for before considering the channel locked in.
3362 * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
3363 * equivalent limit applied to outbound channels).
3367 uint32_t ChannelHandshakeConfig_get_minimum_depth(const LDKChannelHandshakeConfig *this_ptr);
3370 * Confirmations we will wait for before considering the channel locked in.
3371 * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
3372 * equivalent limit applied to outbound channels).
3376 void ChannelHandshakeConfig_set_minimum_depth(LDKChannelHandshakeConfig *this_ptr, uint32_t val);
3379 * Set to the amount of time we require our counterparty to wait to claim their money.
3381 * It's one of the main parameter of our security model. We (or one of our watchtowers) MUST
3382 * be online to check for peer having broadcast a revoked transaction to steal our funds
3383 * at least once every our_to_self_delay blocks.
3385 * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
3386 * case of an honest unilateral channel close, which implicitly decrease the economic value of
3389 * Default value: BREAKDOWN_TIMEOUT (currently 144), we enforce it as a minimum at channel
3390 * opening so you can tweak config to ask for more security, not less.
3392 uint16_t ChannelHandshakeConfig_get_our_to_self_delay(const LDKChannelHandshakeConfig *this_ptr);
3395 * Set to the amount of time we require our counterparty to wait to claim their money.
3397 * It's one of the main parameter of our security model. We (or one of our watchtowers) MUST
3398 * be online to check for peer having broadcast a revoked transaction to steal our funds
3399 * at least once every our_to_self_delay blocks.
3401 * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
3402 * case of an honest unilateral channel close, which implicitly decrease the economic value of
3405 * Default value: BREAKDOWN_TIMEOUT (currently 144), we enforce it as a minimum at channel
3406 * opening so you can tweak config to ask for more security, not less.
3408 void ChannelHandshakeConfig_set_our_to_self_delay(LDKChannelHandshakeConfig *this_ptr, uint16_t val);
3411 * Set to the smallest value HTLC we will accept to process.
3413 * This value is sent to our counterparty on channel-open and we close the channel any time
3414 * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
3416 * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
3419 uint64_t ChannelHandshakeConfig_get_our_htlc_minimum_msat(const LDKChannelHandshakeConfig *this_ptr);
3422 * Set to the smallest value HTLC we will accept to process.
3424 * This value is sent to our counterparty on channel-open and we close the channel any time
3425 * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
3427 * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
3430 void ChannelHandshakeConfig_set_our_htlc_minimum_msat(LDKChannelHandshakeConfig *this_ptr, uint64_t val);
3432 MUST_USE_RES LDKChannelHandshakeConfig ChannelHandshakeConfig_new(uint32_t minimum_depth_arg, uint16_t our_to_self_delay_arg, uint64_t our_htlc_minimum_msat_arg);
3434 MUST_USE_RES LDKChannelHandshakeConfig ChannelHandshakeConfig_default(void);
3436 void ChannelHandshakeLimits_free(LDKChannelHandshakeLimits this_ptr);
3438 LDKChannelHandshakeLimits ChannelHandshakeLimits_clone(const LDKChannelHandshakeLimits *orig);
3441 * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
3442 * only applies to inbound channels.
3446 uint64_t ChannelHandshakeLimits_get_min_funding_satoshis(const LDKChannelHandshakeLimits *this_ptr);
3449 * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
3450 * only applies to inbound channels.
3454 void ChannelHandshakeLimits_set_min_funding_satoshis(LDKChannelHandshakeLimits *this_ptr, uint64_t val);
3457 * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
3458 * you to limit the maximum minimum-size they can require.
3460 * Default value: u64::max_value.
3462 uint64_t ChannelHandshakeLimits_get_max_htlc_minimum_msat(const LDKChannelHandshakeLimits *this_ptr);
3465 * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
3466 * you to limit the maximum minimum-size they can require.
3468 * Default value: u64::max_value.
3470 void ChannelHandshakeLimits_set_max_htlc_minimum_msat(LDKChannelHandshakeLimits *this_ptr, uint64_t val);
3473 * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
3474 * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
3478 uint64_t ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(const LDKChannelHandshakeLimits *this_ptr);
3481 * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
3482 * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
3486 void ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(LDKChannelHandshakeLimits *this_ptr, uint64_t val);
3489 * The remote node will require we keep a certain amount in direct payment to ourselves at all
3490 * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
3491 * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
3493 * Default value: u64::max_value.
3495 uint64_t ChannelHandshakeLimits_get_max_channel_reserve_satoshis(const LDKChannelHandshakeLimits *this_ptr);
3498 * The remote node will require we keep a certain amount in direct payment to ourselves at all
3499 * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
3500 * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
3502 * Default value: u64::max_value.
3504 void ChannelHandshakeLimits_set_max_channel_reserve_satoshis(LDKChannelHandshakeLimits *this_ptr, uint64_t val);
3507 * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
3508 * time. This allows you to set a minimum such value.
3512 uint16_t ChannelHandshakeLimits_get_min_max_accepted_htlcs(const LDKChannelHandshakeLimits *this_ptr);
3515 * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
3516 * time. This allows you to set a minimum such value.
3520 void ChannelHandshakeLimits_set_min_max_accepted_htlcs(LDKChannelHandshakeLimits *this_ptr, uint16_t val);
3523 * Outputs below a certain value will not be added to on-chain transactions. The dust value is
3524 * required to always be higher than this value so this only applies to HTLC outputs (and
3525 * potentially to-self outputs before any payments have been made).
3526 * Thus, HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
3527 * This setting allows you to set a minimum dust limit for their commitment transactions,
3528 * reflecting the reality that tiny outputs are not considered standard transactions and will
3529 * not propagate through the Bitcoin network.
3531 * Default value: 546, the current dust limit on the Bitcoin network.
3533 uint64_t ChannelHandshakeLimits_get_min_dust_limit_satoshis(const LDKChannelHandshakeLimits *this_ptr);
3536 * Outputs below a certain value will not be added to on-chain transactions. The dust value is
3537 * required to always be higher than this value so this only applies to HTLC outputs (and
3538 * potentially to-self outputs before any payments have been made).
3539 * Thus, HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
3540 * This setting allows you to set a minimum dust limit for their commitment transactions,
3541 * reflecting the reality that tiny outputs are not considered standard transactions and will
3542 * not propagate through the Bitcoin network.
3544 * Default value: 546, the current dust limit on the Bitcoin network.
3546 void ChannelHandshakeLimits_set_min_dust_limit_satoshis(LDKChannelHandshakeLimits *this_ptr, uint64_t val);
3549 * Maximum allowed threshold above which outputs will not be generated in their commitment
3551 * HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
3553 * Default value: u64::max_value.
3555 uint64_t ChannelHandshakeLimits_get_max_dust_limit_satoshis(const LDKChannelHandshakeLimits *this_ptr);
3558 * Maximum allowed threshold above which outputs will not be generated in their commitment
3560 * HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
3562 * Default value: u64::max_value.
3564 void ChannelHandshakeLimits_set_max_dust_limit_satoshis(LDKChannelHandshakeLimits *this_ptr, uint64_t val);
3567 * Before a channel is usable the funding transaction will need to be confirmed by at least a
3568 * certain number of blocks, specified by the node which is not the funder (as the funder can
3569 * assume they aren't going to double-spend themselves).
3570 * This config allows you to set a limit on the maximum amount of time to wait.
3572 * Default value: 144, or roughly one day and only applies to outbound channels.
3574 uint32_t ChannelHandshakeLimits_get_max_minimum_depth(const LDKChannelHandshakeLimits *this_ptr);
3577 * Before a channel is usable the funding transaction will need to be confirmed by at least a
3578 * certain number of blocks, specified by the node which is not the funder (as the funder can
3579 * assume they aren't going to double-spend themselves).
3580 * This config allows you to set a limit on the maximum amount of time to wait.
3582 * Default value: 144, or roughly one day and only applies to outbound channels.
3584 void ChannelHandshakeLimits_set_max_minimum_depth(LDKChannelHandshakeLimits *this_ptr, uint32_t val);
3587 * Set to force the incoming channel to match our announced channel preference in
3590 * Default value: true, to make the default that no announced channels are possible (which is
3591 * appropriate for any nodes which are not online very reliably).
3593 bool ChannelHandshakeLimits_get_force_announced_channel_preference(const LDKChannelHandshakeLimits *this_ptr);
3596 * Set to force the incoming channel to match our announced channel preference in
3599 * Default value: true, to make the default that no announced channels are possible (which is
3600 * appropriate for any nodes which are not online very reliably).
3602 void ChannelHandshakeLimits_set_force_announced_channel_preference(LDKChannelHandshakeLimits *this_ptr, bool val);
3605 * Set to the amount of time we're willing to wait to claim money back to us.
3607 * Not checking this value would be a security issue, as our peer would be able to set it to
3608 * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
3610 * Default value: MAX_LOCAL_BREAKDOWN_TIMEOUT (1008), which we also enforce as a maximum value
3611 * so you can tweak config to reduce the loss of having useless locked funds (if your peer accepts)
3613 uint16_t ChannelHandshakeLimits_get_their_to_self_delay(const LDKChannelHandshakeLimits *this_ptr);
3616 * Set to the amount of time we're willing to wait to claim money back to us.
3618 * Not checking this value would be a security issue, as our peer would be able to set it to
3619 * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
3621 * Default value: MAX_LOCAL_BREAKDOWN_TIMEOUT (1008), which we also enforce as a maximum value
3622 * so you can tweak config to reduce the loss of having useless locked funds (if your peer accepts)
3624 void ChannelHandshakeLimits_set_their_to_self_delay(LDKChannelHandshakeLimits *this_ptr, uint16_t val);
3626 MUST_USE_RES LDKChannelHandshakeLimits ChannelHandshakeLimits_new(uint64_t min_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, uint64_t min_dust_limit_satoshis_arg, uint64_t max_dust_limit_satoshis_arg, uint32_t max_minimum_depth_arg, bool force_announced_channel_preference_arg, uint16_t their_to_self_delay_arg);
3628 MUST_USE_RES LDKChannelHandshakeLimits ChannelHandshakeLimits_default(void);
3630 void ChannelConfig_free(LDKChannelConfig this_ptr);
3632 LDKChannelConfig ChannelConfig_clone(const LDKChannelConfig *orig);
3635 * Amount (in millionths of a satoshi) the channel will charge per transferred satoshi.
3636 * This may be allowed to change at runtime in a later update, however doing so must result in
3637 * update messages sent to notify all nodes of our updated relay fee.
3641 uint32_t ChannelConfig_get_fee_proportional_millionths(const LDKChannelConfig *this_ptr);
3644 * Amount (in millionths of a satoshi) the channel will charge per transferred satoshi.
3645 * This may be allowed to change at runtime in a later update, however doing so must result in
3646 * update messages sent to notify all nodes of our updated relay fee.
3650 void ChannelConfig_set_fee_proportional_millionths(LDKChannelConfig *this_ptr, uint32_t val);
3653 * Set to announce the channel publicly and notify all nodes that they can route via this
3656 * This should only be set to true for nodes which expect to be online reliably.
3658 * As the node which funds a channel picks this value this will only apply for new outbound
3659 * channels unless ChannelHandshakeLimits::force_announced_channel_preferences is set.
3661 * This cannot be changed after the initial channel handshake.
3663 * Default value: false.
3665 bool ChannelConfig_get_announced_channel(const LDKChannelConfig *this_ptr);
3668 * Set to announce the channel publicly and notify all nodes that they can route via this
3671 * This should only be set to true for nodes which expect to be online reliably.
3673 * As the node which funds a channel picks this value this will only apply for new outbound
3674 * channels unless ChannelHandshakeLimits::force_announced_channel_preferences is set.
3676 * This cannot be changed after the initial channel handshake.
3678 * Default value: false.
3680 void ChannelConfig_set_announced_channel(LDKChannelConfig *this_ptr, bool val);
3683 * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
3684 * supports it, they will then enforce the mutual-close output to us matches what we provided
3685 * at intialization, preventing us from closing to an alternate pubkey.
3687 * This is set to true by default to provide a slight increase in security, though ultimately
3688 * any attacker who is able to take control of a channel can just as easily send the funds via
3689 * lightning payments, so we never require that our counterparties support this option.
3691 * This cannot be changed after a channel has been initialized.
3693 * Default value: true.
3695 bool ChannelConfig_get_commit_upfront_shutdown_pubkey(const LDKChannelConfig *this_ptr);
3698 * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
3699 * supports it, they will then enforce the mutual-close output to us matches what we provided
3700 * at intialization, preventing us from closing to an alternate pubkey.
3702 * This is set to true by default to provide a slight increase in security, though ultimately
3703 * any attacker who is able to take control of a channel can just as easily send the funds via
3704 * lightning payments, so we never require that our counterparties support this option.
3706 * This cannot be changed after a channel has been initialized.
3708 * Default value: true.
3710 void ChannelConfig_set_commit_upfront_shutdown_pubkey(LDKChannelConfig *this_ptr, bool val);
3712 MUST_USE_RES LDKChannelConfig ChannelConfig_new(uint32_t fee_proportional_millionths_arg, bool announced_channel_arg, bool commit_upfront_shutdown_pubkey_arg);
3714 MUST_USE_RES LDKChannelConfig ChannelConfig_default(void);
3716 LDKCVec_u8Z ChannelConfig_write(const LDKChannelConfig *obj);
3718 LDKChannelConfig ChannelConfig_read(LDKu8slice ser);
3720 void UserConfig_free(LDKUserConfig this_ptr);
3722 LDKUserConfig UserConfig_clone(const LDKUserConfig *orig);
3725 * Channel config that we propose to our counterparty.
3727 LDKChannelHandshakeConfig UserConfig_get_own_channel_config(const LDKUserConfig *this_ptr);
3730 * Channel config that we propose to our counterparty.
3732 void UserConfig_set_own_channel_config(LDKUserConfig *this_ptr, LDKChannelHandshakeConfig val);
3735 * Limits applied to our counterparty's proposed channel config settings.
3737 LDKChannelHandshakeLimits UserConfig_get_peer_channel_config_limits(const LDKUserConfig *this_ptr);
3740 * Limits applied to our counterparty's proposed channel config settings.
3742 void UserConfig_set_peer_channel_config_limits(LDKUserConfig *this_ptr, LDKChannelHandshakeLimits val);
3745 * Channel config which affects behavior during channel lifetime.
3747 LDKChannelConfig UserConfig_get_channel_options(const LDKUserConfig *this_ptr);
3750 * Channel config which affects behavior during channel lifetime.
3752 void UserConfig_set_channel_options(LDKUserConfig *this_ptr, LDKChannelConfig val);
3754 MUST_USE_RES LDKUserConfig UserConfig_new(LDKChannelHandshakeConfig own_channel_config_arg, LDKChannelHandshakeLimits peer_channel_config_limits_arg, LDKChannelConfig channel_options_arg);
3756 MUST_USE_RES LDKUserConfig UserConfig_default(void);
3758 LDKAccessError AccessError_clone(const LDKAccessError *orig);
3761 * Calls the free function if one is set
3763 void Access_free(LDKAccess this_ptr);
3766 * Calls the free function if one is set
3768 void Watch_free(LDKWatch this_ptr);
3771 * Calls the free function if one is set
3773 void Filter_free(LDKFilter this_ptr);
3776 * Calls the free function if one is set
3778 void BroadcasterInterface_free(LDKBroadcasterInterface this_ptr);
3780 LDKConfirmationTarget ConfirmationTarget_clone(const LDKConfirmationTarget *orig);
3783 * Calls the free function if one is set
3785 void FeeEstimator_free(LDKFeeEstimator this_ptr);
3787 void ChainMonitor_free(LDKChainMonitor this_ptr);
3790 * Dispatches to per-channel monitors, which are responsible for updating their on-chain view
3791 * of a channel and reacting accordingly based on transactions in the connected block. See
3792 * [`ChannelMonitor::block_connected`] for details. Any HTLCs that were resolved on chain will
3793 * be returned by [`chain::Watch::release_pending_monitor_events`].
3795 * Calls back to [`chain::Filter`] if any monitor indicated new outputs to watch. Subsequent
3796 * calls must not exclude any transactions matching the new outputs nor any in-block
3797 * descendants of such transactions. It is not necessary to re-fetch the block to obtain
3800 * [`ChannelMonitor::block_connected`]: ../channelmonitor/struct.ChannelMonitor.html#method.block_connected
3801 * [`chain::Watch::release_pending_monitor_events`]: ../trait.Watch.html#tymethod.release_pending_monitor_events
3802 * [`chain::Filter`]: ../trait.Filter.html
3804 void ChainMonitor_block_connected(const LDKChainMonitor *this_arg, const uint8_t (*header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height);
3807 * Dispatches to per-channel monitors, which are responsible for updating their on-chain view
3808 * of a channel based on the disconnected block. See [`ChannelMonitor::block_disconnected`] for
3811 * [`ChannelMonitor::block_disconnected`]: ../channelmonitor/struct.ChannelMonitor.html#method.block_disconnected
3813 void ChainMonitor_block_disconnected(const LDKChainMonitor *this_arg, const uint8_t (*header)[80], uint32_t disconnected_height);
3816 * Creates a new `ChainMonitor` used to watch on-chain activity pertaining to channels.
3818 * When an optional chain source implementing [`chain::Filter`] is provided, the chain monitor
3819 * will call back to it indicating transactions and outputs of interest. This allows clients to
3820 * pre-filter blocks or only fetch blocks matching a compact filter. Otherwise, clients may
3821 * always need to fetch full blocks absent another means for determining which blocks contain
3822 * transactions relevant to the watched channels.
3824 * [`chain::Filter`]: ../trait.Filter.html
3826 MUST_USE_RES LDKChainMonitor ChainMonitor_new(LDKFilter *chain_source, LDKBroadcasterInterface broadcaster, LDKLogger logger, LDKFeeEstimator feeest, LDKPersist persister);
3828 LDKWatch ChainMonitor_as_Watch(const LDKChainMonitor *this_arg);
3830 LDKEventsProvider ChainMonitor_as_EventsProvider(const LDKChainMonitor *this_arg);
3832 void ChannelMonitorUpdate_free(LDKChannelMonitorUpdate this_ptr);
3834 LDKChannelMonitorUpdate ChannelMonitorUpdate_clone(const LDKChannelMonitorUpdate *orig);
3837 * The sequence number of this update. Updates *must* be replayed in-order according to this
3838 * sequence number (and updates may panic if they are not). The update_id values are strictly
3839 * increasing and increase by one for each new update, with one exception specified below.
3841 * This sequence number is also used to track up to which points updates which returned
3842 * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
3843 * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
3845 * The only instance where update_id values are not strictly increasing is the case where we
3846 * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
3847 * its docs for more details.
3849 * [`CLOSED_CHANNEL_UPDATE_ID`]: constant.CLOSED_CHANNEL_UPDATE_ID.html
3851 uint64_t ChannelMonitorUpdate_get_update_id(const LDKChannelMonitorUpdate *this_ptr);
3854 * The sequence number of this update. Updates *must* be replayed in-order according to this
3855 * sequence number (and updates may panic if they are not). The update_id values are strictly
3856 * increasing and increase by one for each new update, with one exception specified below.
3858 * This sequence number is also used to track up to which points updates which returned
3859 * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
3860 * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
3862 * The only instance where update_id values are not strictly increasing is the case where we
3863 * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
3864 * its docs for more details.
3866 * [`CLOSED_CHANNEL_UPDATE_ID`]: constant.CLOSED_CHANNEL_UPDATE_ID.html
3868 void ChannelMonitorUpdate_set_update_id(LDKChannelMonitorUpdate *this_ptr, uint64_t val);
3870 LDKCVec_u8Z ChannelMonitorUpdate_write(const LDKChannelMonitorUpdate *obj);
3872 LDKChannelMonitorUpdate ChannelMonitorUpdate_read(LDKu8slice ser);
3874 LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_clone(const LDKChannelMonitorUpdateErr *orig);
3876 void MonitorUpdateError_free(LDKMonitorUpdateError this_ptr);
3878 void MonitorEvent_free(LDKMonitorEvent this_ptr);
3880 LDKMonitorEvent MonitorEvent_clone(const LDKMonitorEvent *orig);
3882 void HTLCUpdate_free(LDKHTLCUpdate this_ptr);
3884 LDKHTLCUpdate HTLCUpdate_clone(const LDKHTLCUpdate *orig);
3886 LDKCVec_u8Z HTLCUpdate_write(const LDKHTLCUpdate *obj);
3888 LDKHTLCUpdate HTLCUpdate_read(LDKu8slice ser);
3890 void ChannelMonitor_free(LDKChannelMonitor this_ptr);
3893 * Updates a ChannelMonitor on the basis of some new information provided by the Channel
3896 * panics if the given update is not the next update by update_id.
3898 MUST_USE_RES LDKCResult_NoneMonitorUpdateErrorZ ChannelMonitor_update_monitor(LDKChannelMonitor *this_arg, const LDKChannelMonitorUpdate *updates, const LDKBroadcasterInterface *broadcaster, const LDKFeeEstimator *fee_estimator, const LDKLogger *logger);
3901 * Gets the update_id from the latest ChannelMonitorUpdate which was applied to this
3904 MUST_USE_RES uint64_t ChannelMonitor_get_latest_update_id(const LDKChannelMonitor *this_arg);
3907 * Gets the funding transaction outpoint of the channel this ChannelMonitor is monitoring for.
3909 MUST_USE_RES LDKC2Tuple_OutPointScriptZ ChannelMonitor_get_funding_txo(const LDKChannelMonitor *this_arg);
3912 * Get the list of HTLCs who's status has been updated on chain. This should be called by
3913 * ChannelManager via [`chain::Watch::release_pending_monitor_events`].
3915 * [`chain::Watch::release_pending_monitor_events`]: ../trait.Watch.html#tymethod.release_pending_monitor_events
3917 MUST_USE_RES LDKCVec_MonitorEventZ ChannelMonitor_get_and_clear_pending_monitor_events(LDKChannelMonitor *this_arg);
3920 * Gets the list of pending events which were generated by previous actions, clearing the list
3923 * This is called by ChainMonitor::get_and_clear_pending_events() and is equivalent to
3924 * EventsProvider::get_and_clear_pending_events() except that it requires &mut self as we do
3925 * no internal locking in ChannelMonitors.
3927 MUST_USE_RES LDKCVec_EventZ ChannelMonitor_get_and_clear_pending_events(LDKChannelMonitor *this_arg);
3930 * Used by ChannelManager deserialization to broadcast the latest holder state if its copy of
3931 * the Channel was out-of-date. You may use it to get a broadcastable holder toxic tx in case of
3932 * fallen-behind, i.e when receiving a channel_reestablish with a proof that our counterparty side knows
3933 * a higher revocation secret than the holder commitment number we are aware of. Broadcasting these
3934 * transactions are UNSAFE, as they allow counterparty side to punish you. Nevertheless you may want to
3935 * broadcast them if counterparty don't close channel with his higher commitment transaction after a
3936 * substantial amount of time (a month or even a year) to get back funds. Best may be to contact
3937 * out-of-band the other node operator to coordinate with him if option is available to you.
3938 * In any-case, choice is up to the user.
3940 MUST_USE_RES LDKCVec_TransactionZ ChannelMonitor_get_latest_holder_commitment_txn(LDKChannelMonitor *this_arg, const LDKLogger *logger);
3943 * Processes transactions in a newly connected block, which may result in any of the following:
3944 * - update the monitor's state against resolved HTLCs
3945 * - punish the counterparty in the case of seeing a revoked commitment transaction
3946 * - force close the channel and claim/timeout incoming/outgoing HTLCs if near expiration
3947 * - detect settled outputs for later spending
3948 * - schedule and bump any in-flight claims
3950 * Returns any new outputs to watch from `txdata`; after called, these are also included in
3951 * [`get_outputs_to_watch`].
3953 * [`get_outputs_to_watch`]: #method.get_outputs_to_watch
3955 MUST_USE_RES LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ChannelMonitor_block_connected(LDKChannelMonitor *this_arg, const uint8_t (*header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height, LDKBroadcasterInterface broadcaster, LDKFeeEstimator fee_estimator, LDKLogger logger);
3958 * Determines if the disconnected block contained any transactions of interest and updates
3961 void ChannelMonitor_block_disconnected(LDKChannelMonitor *this_arg, const uint8_t (*header)[80], uint32_t height, LDKBroadcasterInterface broadcaster, LDKFeeEstimator fee_estimator, LDKLogger logger);
3964 * Calls the free function if one is set
3966 void Persist_free(LDKPersist this_ptr);
3968 void OutPoint_free(LDKOutPoint this_ptr);
3970 LDKOutPoint OutPoint_clone(const LDKOutPoint *orig);
3973 * The referenced transaction's txid.
3975 const uint8_t (*OutPoint_get_txid(const LDKOutPoint *this_ptr))[32];
3978 * The referenced transaction's txid.
3980 void OutPoint_set_txid(LDKOutPoint *this_ptr, LDKThirtyTwoBytes val);
3983 * The index of the referenced output in its transaction's vout.
3985 uint16_t OutPoint_get_index(const LDKOutPoint *this_ptr);
3988 * The index of the referenced output in its transaction's vout.
3990 void OutPoint_set_index(LDKOutPoint *this_ptr, uint16_t val);
3992 MUST_USE_RES LDKOutPoint OutPoint_new(LDKThirtyTwoBytes txid_arg, uint16_t index_arg);
3995 * Convert an `OutPoint` to a lightning channel id.
3997 MUST_USE_RES LDKThirtyTwoBytes OutPoint_to_channel_id(const LDKOutPoint *this_arg);
3999 LDKCVec_u8Z OutPoint_write(const LDKOutPoint *obj);
4001 LDKOutPoint OutPoint_read(LDKu8slice ser);
4003 void SpendableOutputDescriptor_free(LDKSpendableOutputDescriptor this_ptr);
4005 LDKSpendableOutputDescriptor SpendableOutputDescriptor_clone(const LDKSpendableOutputDescriptor *orig);
4007 LDKChannelKeys ChannelKeys_clone(const LDKChannelKeys *orig);
4010 * Calls the free function if one is set
4012 void ChannelKeys_free(LDKChannelKeys this_ptr);
4015 * Calls the free function if one is set
4017 void KeysInterface_free(LDKKeysInterface this_ptr);
4019 void InMemoryChannelKeys_free(LDKInMemoryChannelKeys this_ptr);
4021 LDKInMemoryChannelKeys InMemoryChannelKeys_clone(const LDKInMemoryChannelKeys *orig);
4024 * Private key of anchor tx
4026 const uint8_t (*InMemoryChannelKeys_get_funding_key(const LDKInMemoryChannelKeys *this_ptr))[32];
4029 * Private key of anchor tx
4031 void InMemoryChannelKeys_set_funding_key(LDKInMemoryChannelKeys *this_ptr, LDKSecretKey val);
4034 * Holder secret key for blinded revocation pubkey
4036 const uint8_t (*InMemoryChannelKeys_get_revocation_base_key(const LDKInMemoryChannelKeys *this_ptr))[32];
4039 * Holder secret key for blinded revocation pubkey
4041 void InMemoryChannelKeys_set_revocation_base_key(LDKInMemoryChannelKeys *this_ptr, LDKSecretKey val);
4044 * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
4046 const uint8_t (*InMemoryChannelKeys_get_payment_key(const LDKInMemoryChannelKeys *this_ptr))[32];
4049 * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
4051 void InMemoryChannelKeys_set_payment_key(LDKInMemoryChannelKeys *this_ptr, LDKSecretKey val);
4054 * Holder secret key used in HTLC tx
4056 const uint8_t (*InMemoryChannelKeys_get_delayed_payment_base_key(const LDKInMemoryChannelKeys *this_ptr))[32];
4059 * Holder secret key used in HTLC tx
4061 void InMemoryChannelKeys_set_delayed_payment_base_key(LDKInMemoryChannelKeys *this_ptr, LDKSecretKey val);
4064 * Holder htlc secret key used in commitment tx htlc outputs
4066 const uint8_t (*InMemoryChannelKeys_get_htlc_base_key(const LDKInMemoryChannelKeys *this_ptr))[32];
4069 * Holder htlc secret key used in commitment tx htlc outputs
4071 void InMemoryChannelKeys_set_htlc_base_key(LDKInMemoryChannelKeys *this_ptr, LDKSecretKey val);
4076 const uint8_t (*InMemoryChannelKeys_get_commitment_seed(const LDKInMemoryChannelKeys *this_ptr))[32];
4081 void InMemoryChannelKeys_set_commitment_seed(LDKInMemoryChannelKeys *this_ptr, LDKThirtyTwoBytes val);
4084 * Create a new InMemoryChannelKeys
4086 MUST_USE_RES LDKInMemoryChannelKeys InMemoryChannelKeys_new(LDKSecretKey funding_key, LDKSecretKey revocation_base_key, LDKSecretKey payment_key, LDKSecretKey delayed_payment_base_key, LDKSecretKey htlc_base_key, LDKThirtyTwoBytes commitment_seed, uint64_t channel_value_satoshis, LDKC2Tuple_u64u64Z key_derivation_params);
4089 * Counterparty pubkeys.
4090 * Will panic if on_accept wasn't called.
4092 MUST_USE_RES LDKChannelPublicKeys InMemoryChannelKeys_counterparty_pubkeys(const LDKInMemoryChannelKeys *this_arg);
4095 * The contest_delay value specified by our counterparty and applied on holder-broadcastable
4096 * transactions, ie the amount of time that we have to wait to recover our funds if we
4097 * broadcast a transaction. You'll likely want to pass this to the
4098 * ln::chan_utils::build*_transaction functions when signing holder's transactions.
4099 * Will panic if on_accept wasn't called.
4101 MUST_USE_RES uint16_t InMemoryChannelKeys_counterparty_selected_contest_delay(const LDKInMemoryChannelKeys *this_arg);
4104 * The contest_delay value specified by us and applied on transactions broadcastable
4105 * by our counterparty, ie the amount of time that they have to wait to recover their funds
4106 * if they broadcast a transaction.
4107 * Will panic if on_accept wasn't called.
4109 MUST_USE_RES uint16_t InMemoryChannelKeys_holder_selected_contest_delay(const LDKInMemoryChannelKeys *this_arg);
4111 LDKChannelKeys InMemoryChannelKeys_as_ChannelKeys(const LDKInMemoryChannelKeys *this_arg);
4113 LDKCVec_u8Z InMemoryChannelKeys_write(const LDKInMemoryChannelKeys *obj);
4115 LDKInMemoryChannelKeys InMemoryChannelKeys_read(LDKu8slice ser);
4117 void KeysManager_free(LDKKeysManager this_ptr);
4120 * Constructs a KeysManager from a 32-byte seed. If the seed is in some way biased (eg your
4121 * CSRNG is busted) this may panic (but more importantly, you will possibly lose funds).
4122 * starting_time isn't strictly required to actually be a time, but it must absolutely,
4123 * without a doubt, be unique to this instance. ie if you start multiple times with the same
4124 * seed, starting_time must be unique to each run. Thus, the easiest way to achieve this is to
4125 * simply use the current time (with very high precision).
4127 * The seed MUST be backed up safely prior to use so that the keys can be re-created, however,
4128 * obviously, starting_time should be unique every time you reload the library - it is only
4129 * used to generate new ephemeral key data (which will be stored by the individual channel if
4132 * Note that the seed is required to recover certain on-chain funds independent of
4133 * ChannelMonitor data, though a current copy of ChannelMonitor data is also required for any
4134 * channel, and some on-chain during-closing funds.
4136 * Note that until the 0.1 release there is no guarantee of backward compatibility between
4137 * versions. Once the library is more fully supported, the docs will be updated to include a
4138 * detailed description of the guarantee.
4140 MUST_USE_RES LDKKeysManager KeysManager_new(const uint8_t (*seed)[32], LDKNetwork network, uint64_t starting_time_secs, uint32_t starting_time_nanos);
4143 * Derive an old set of ChannelKeys for per-channel secrets based on a key derivation
4145 * Key derivation parameters are accessible through a per-channel secrets
4146 * ChannelKeys::key_derivation_params and is provided inside DynamicOuputP2WSH in case of
4147 * onchain output detection for which a corresponding delayed_payment_key must be derived.
4149 MUST_USE_RES LDKInMemoryChannelKeys KeysManager_derive_channel_keys(const LDKKeysManager *this_arg, uint64_t channel_value_satoshis, uint64_t params_1, uint64_t params_2);
4151 LDKKeysInterface KeysManager_as_KeysInterface(const LDKKeysManager *this_arg);
4153 void ChannelManager_free(LDKChannelManager this_ptr);
4155 void ChannelDetails_free(LDKChannelDetails this_ptr);
4157 LDKChannelDetails ChannelDetails_clone(const LDKChannelDetails *orig);
4160 * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
4161 * thereafter this is the txid of the funding transaction xor the funding transaction output).
4162 * Note that this means this value is *not* persistent - it can change once during the
4163 * lifetime of the channel.
4165 const uint8_t (*ChannelDetails_get_channel_id(const LDKChannelDetails *this_ptr))[32];
4168 * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
4169 * thereafter this is the txid of the funding transaction xor the funding transaction output).
4170 * Note that this means this value is *not* persistent - it can change once during the
4171 * lifetime of the channel.
4173 void ChannelDetails_set_channel_id(LDKChannelDetails *this_ptr, LDKThirtyTwoBytes val);
4176 * The node_id of our counterparty
4178 LDKPublicKey ChannelDetails_get_remote_network_id(const LDKChannelDetails *this_ptr);
4181 * The node_id of our counterparty
4183 void ChannelDetails_set_remote_network_id(LDKChannelDetails *this_ptr, LDKPublicKey val);
4186 * The Features the channel counterparty provided upon last connection.
4187 * Useful for routing as it is the most up-to-date copy of the counterparty's features and
4188 * many routing-relevant features are present in the init context.
4190 LDKInitFeatures ChannelDetails_get_counterparty_features(const LDKChannelDetails *this_ptr);
4193 * The Features the channel counterparty provided upon last connection.
4194 * Useful for routing as it is the most up-to-date copy of the counterparty's features and
4195 * many routing-relevant features are present in the init context.
4197 void ChannelDetails_set_counterparty_features(LDKChannelDetails *this_ptr, LDKInitFeatures val);
4200 * The value, in satoshis, of this channel as appears in the funding output
4202 uint64_t ChannelDetails_get_channel_value_satoshis(const LDKChannelDetails *this_ptr);
4205 * The value, in satoshis, of this channel as appears in the funding output
4207 void ChannelDetails_set_channel_value_satoshis(LDKChannelDetails *this_ptr, uint64_t val);
4210 * The user_id passed in to create_channel, or 0 if the channel was inbound.
4212 uint64_t ChannelDetails_get_user_id(const LDKChannelDetails *this_ptr);
4215 * The user_id passed in to create_channel, or 0 if the channel was inbound.
4217 void ChannelDetails_set_user_id(LDKChannelDetails *this_ptr, uint64_t val);
4220 * The available outbound capacity for sending HTLCs to the remote peer. This does not include
4221 * any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
4222 * available for inclusion in new outbound HTLCs). This further does not include any pending
4223 * outgoing HTLCs which are awaiting some other resolution to be sent.
4225 uint64_t ChannelDetails_get_outbound_capacity_msat(const LDKChannelDetails *this_ptr);
4228 * The available outbound capacity for sending HTLCs to the remote peer. This does not include
4229 * any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
4230 * available for inclusion in new outbound HTLCs). This further does not include any pending
4231 * outgoing HTLCs which are awaiting some other resolution to be sent.
4233 void ChannelDetails_set_outbound_capacity_msat(LDKChannelDetails *this_ptr, uint64_t val);
4236 * The available inbound capacity for the remote peer to send HTLCs to us. This does not
4237 * include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
4238 * available for inclusion in new inbound HTLCs).
4239 * Note that there are some corner cases not fully handled here, so the actual available
4240 * inbound capacity may be slightly higher than this.
4242 uint64_t ChannelDetails_get_inbound_capacity_msat(const LDKChannelDetails *this_ptr);
4245 * The available inbound capacity for the remote peer to send HTLCs to us. This does not
4246 * include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
4247 * available for inclusion in new inbound HTLCs).
4248 * Note that there are some corner cases not fully handled here, so the actual available
4249 * inbound capacity may be slightly higher than this.
4251 void ChannelDetails_set_inbound_capacity_msat(LDKChannelDetails *this_ptr, uint64_t val);
4254 * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
4255 * the peer is connected, and (c) no monitor update failure is pending resolution.
4257 bool ChannelDetails_get_is_live(const LDKChannelDetails *this_ptr);
4260 * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
4261 * the peer is connected, and (c) no monitor update failure is pending resolution.
4263 void ChannelDetails_set_is_live(LDKChannelDetails *this_ptr, bool val);
4265 void PaymentSendFailure_free(LDKPaymentSendFailure this_ptr);
4268 * Constructs a new ChannelManager to hold several channels and route between them.
4270 * This is the main \"logic hub\" for all channel-related actions, and implements
4271 * ChannelMessageHandler.
4273 * Non-proportional fees are fixed according to our risk using the provided fee estimator.
4275 * panics if channel_value_satoshis is >= `MAX_FUNDING_SATOSHIS`!
4277 * Users must provide the current blockchain height from which to track onchain channel
4278 * funding outpoints and send payments with reliable timelocks.
4280 * Users need to notify the new ChannelManager when a new block is connected or
4281 * disconnected using its `block_connected` and `block_disconnected` methods.
4283 MUST_USE_RES LDKChannelManager ChannelManager_new(LDKNetwork network, LDKFeeEstimator fee_est, LDKWatch chain_monitor, LDKBroadcasterInterface tx_broadcaster, LDKLogger logger, LDKKeysInterface keys_manager, LDKUserConfig config, uintptr_t current_blockchain_height);
4286 * Creates a new outbound channel to the given remote node and with the given value.
4288 * user_id will be provided back as user_channel_id in FundingGenerationReady and
4289 * FundingBroadcastSafe events to allow tracking of which events correspond with which
4290 * create_channel call. Note that user_channel_id defaults to 0 for inbound channels, so you
4291 * may wish to avoid using 0 for user_id here.
4293 * If successful, will generate a SendOpenChannel message event, so you should probably poll
4294 * PeerManager::process_events afterwards.
4296 * Raises APIError::APIMisuseError when channel_value_satoshis > 2**24 or push_msat is
4297 * greater than channel_value_satoshis * 1k or channel_value_satoshis is < 1000.
4299 MUST_USE_RES LDKCResult_NoneAPIErrorZ ChannelManager_create_channel(const LDKChannelManager *this_arg, LDKPublicKey their_network_key, uint64_t channel_value_satoshis, uint64_t push_msat, uint64_t user_id, LDKUserConfig override_config);
4302 * Gets the list of open channels, in random order. See ChannelDetail field documentation for
4305 MUST_USE_RES LDKCVec_ChannelDetailsZ ChannelManager_list_channels(const LDKChannelManager *this_arg);
4308 * Gets the list of usable channels, in random order. Useful as an argument to
4309 * get_route to ensure non-announced channels are used.
4311 * These are guaranteed to have their is_live value set to true, see the documentation for
4312 * ChannelDetails::is_live for more info on exactly what the criteria are.
4314 MUST_USE_RES LDKCVec_ChannelDetailsZ ChannelManager_list_usable_channels(const LDKChannelManager *this_arg);
4317 * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs
4318 * will be accepted on the given channel, and after additional timeout/the closing of all
4319 * pending HTLCs, the channel will be closed on chain.
4321 * May generate a SendShutdown message event on success, which should be relayed.
4323 MUST_USE_RES LDKCResult_NoneAPIErrorZ ChannelManager_close_channel(const LDKChannelManager *this_arg, const uint8_t (*channel_id)[32]);
4326 * Force closes a channel, immediately broadcasting the latest local commitment transaction to
4327 * the chain and rejecting new HTLCs on the given channel.
4329 void ChannelManager_force_close_channel(const LDKChannelManager *this_arg, const uint8_t (*channel_id)[32]);
4332 * Force close all channels, immediately broadcasting the latest local commitment transaction
4333 * for each to the chain and rejecting new HTLCs on each.
4335 void ChannelManager_force_close_all_channels(const LDKChannelManager *this_arg);
4338 * Sends a payment along a given route.
4340 * Value parameters are provided via the last hop in route, see documentation for RouteHop
4341 * fields for more info.
4343 * Note that if the payment_hash already exists elsewhere (eg you're sending a duplicative
4344 * payment), we don't do anything to stop you! We always try to ensure that if the provided
4345 * next hop knows the preimage to payment_hash they can claim an additional amount as
4346 * specified in the last hop in the route! Thus, you should probably do your own
4347 * payment_preimage tracking (which you should already be doing as they represent \"proof of
4348 * payment\") and prevent double-sends yourself.
4350 * May generate SendHTLCs message(s) event on success, which should be relayed.
4352 * Each path may have a different return value, and PaymentSendValue may return a Vec with
4353 * each entry matching the corresponding-index entry in the route paths, see
4354 * PaymentSendFailure for more info.
4356 * In general, a path may raise:
4357 * * APIError::RouteError when an invalid route or forwarding parameter (cltv_delta, fee,
4358 * node public key) is specified.
4359 * * APIError::ChannelUnavailable if the next-hop channel is not available for updates
4360 * (including due to previous monitor update failure or new permanent monitor update
4362 * * APIError::MonitorUpdateFailed if a new monitor update failure prevented sending the
4365 * Note that depending on the type of the PaymentSendFailure the HTLC may have been
4366 * irrevocably committed to on our end. In such a case, do NOT retry the payment with a
4367 * different route unless you intend to pay twice!
4369 * payment_secret is unrelated to payment_hash (or PaymentPreimage) and exists to authenticate
4370 * the sender to the recipient and prevent payment-probing (deanonymization) attacks. For
4371 * newer nodes, it will be provided to you in the invoice. If you do not have one, the Route
4372 * must not contain multiple paths as multi-path payments require a recipient-provided
4374 * If a payment_secret *is* provided, we assume that the invoice had the payment_secret feature
4375 * bit set (either as required or as available). If multiple paths are present in the Route,
4376 * we assume the invoice had the basic_mpp feature set.
4378 MUST_USE_RES LDKCResult_NonePaymentSendFailureZ ChannelManager_send_payment(const LDKChannelManager *this_arg, const LDKRoute *route, LDKThirtyTwoBytes payment_hash, LDKThirtyTwoBytes payment_secret);
4381 * Call this upon creation of a funding transaction for the given channel.
4383 * Note that ALL inputs in the transaction pointed to by funding_txo MUST spend SegWit outputs
4384 * or your counterparty can steal your funds!
4386 * Panics if a funding transaction has already been provided for this channel.
4388 * May panic if the funding_txo is duplicative with some other channel (note that this should
4389 * be trivially prevented by using unique funding transaction keys per-channel).
4391 void ChannelManager_funding_transaction_generated(const LDKChannelManager *this_arg, const uint8_t (*temporary_channel_id)[32], LDKOutPoint funding_txo);
4394 * Generates a signed node_announcement from the given arguments and creates a
4395 * BroadcastNodeAnnouncement event. Note that such messages will be ignored unless peers have
4396 * seen a channel_announcement from us (ie unless we have public channels open).
4398 * RGB is a node \"color\" and alias is a printable human-readable string to describe this node
4399 * to humans. They carry no in-protocol meaning.
4401 * addresses represent the set (possibly empty) of socket addresses on which this node accepts
4402 * incoming connections. These will be broadcast to the network, publicly tying these
4403 * addresses together. If you wish to preserve user privacy, addresses should likely contain
4404 * only Tor Onion addresses.
4406 * Panics if addresses is absurdly large (more than 500).
4408 void ChannelManager_broadcast_node_announcement(const LDKChannelManager *this_arg, LDKThreeBytes rgb, LDKThirtyTwoBytes alias, LDKCVec_NetAddressZ addresses);
4411 * Processes HTLCs which are pending waiting on random forward delay.
4413 * Should only really ever be called in response to a PendingHTLCsForwardable event.
4414 * Will likely generate further events.
4416 void ChannelManager_process_pending_htlc_forwards(const LDKChannelManager *this_arg);
4419 * If a peer is disconnected we mark any channels with that peer as 'disabled'.
4420 * After some time, if channels are still disabled we need to broadcast a ChannelUpdate
4421 * to inform the network about the uselessness of these channels.
4423 * This method handles all the details, and must be called roughly once per minute.
4425 void ChannelManager_timer_chan_freshness_every_min(const LDKChannelManager *this_arg);
4428 * Indicates that the preimage for payment_hash is unknown or the received amount is incorrect
4429 * after a PaymentReceived event, failing the HTLC back to its origin and freeing resources
4430 * along the path (including in our own channel on which we received it).
4431 * Returns false if no payment was found to fail backwards, true if the process of failing the
4432 * HTLC backwards has been started.
4434 MUST_USE_RES bool ChannelManager_fail_htlc_backwards(const LDKChannelManager *this_arg, const uint8_t (*payment_hash)[32], LDKThirtyTwoBytes payment_secret);
4437 * Provides a payment preimage in response to a PaymentReceived event, returning true and
4438 * generating message events for the net layer to claim the payment, if possible. Thus, you
4439 * should probably kick the net layer to go send messages if this returns true!
4441 * You must specify the expected amounts for this HTLC, and we will only claim HTLCs
4442 * available within a few percent of the expected amount. This is critical for several
4443 * reasons : a) it avoids providing senders with `proof-of-payment` (in the form of the
4444 * payment_preimage without having provided the full value and b) it avoids certain
4445 * privacy-breaking recipient-probing attacks which may reveal payment activity to
4446 * motivated attackers.
4448 * Note that the privacy concerns in (b) are not relevant in payments with a payment_secret
4449 * set. Thus, for such payments we will claim any payments which do not under-pay.
4451 * May panic if called except in response to a PaymentReceived event.
4453 MUST_USE_RES bool ChannelManager_claim_funds(const LDKChannelManager *this_arg, LDKThirtyTwoBytes payment_preimage, LDKThirtyTwoBytes payment_secret, uint64_t expected_amount);
4456 * Gets the node_id held by this ChannelManager
4458 MUST_USE_RES LDKPublicKey ChannelManager_get_our_node_id(const LDKChannelManager *this_arg);
4461 * Restores a single, given channel to normal operation after a
4462 * ChannelMonitorUpdateErr::TemporaryFailure was returned from a channel monitor update
4465 * All ChannelMonitor updates up to and including highest_applied_update_id must have been
4466 * fully committed in every copy of the given channels' ChannelMonitors.
4468 * Note that there is no effect to calling with a highest_applied_update_id other than the
4469 * current latest ChannelMonitorUpdate and one call to this function after multiple
4470 * ChannelMonitorUpdateErr::TemporaryFailures is fine. The highest_applied_update_id field
4471 * exists largely only to prevent races between this and concurrent update_monitor calls.
4473 * Thus, the anticipated use is, at a high level:
4474 * 1) You register a chain::Watch with this ChannelManager,
4475 * 2) it stores each update to disk, and begins updating any remote (eg watchtower) copies of
4476 * said ChannelMonitors as it can, returning ChannelMonitorUpdateErr::TemporaryFailures
4477 * any time it cannot do so instantly,
4478 * 3) update(s) are applied to each remote copy of a ChannelMonitor,
4479 * 4) once all remote copies are updated, you call this function with the update_id that
4480 * completed, and once it is the latest the Channel will be re-enabled.
4482 void ChannelManager_channel_monitor_updated(const LDKChannelManager *this_arg, const LDKOutPoint *funding_txo, uint64_t highest_applied_update_id);
4484 LDKMessageSendEventsProvider ChannelManager_as_MessageSendEventsProvider(const LDKChannelManager *this_arg);
4486 LDKEventsProvider ChannelManager_as_EventsProvider(const LDKChannelManager *this_arg);
4489 * Updates channel state based on transactions seen in a connected block.
4491 void ChannelManager_block_connected(const LDKChannelManager *this_arg, const uint8_t (*header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height);
4494 * Updates channel state based on a disconnected block.
4496 * If necessary, the channel may be force-closed without letting the counterparty participate
4499 void ChannelManager_block_disconnected(const LDKChannelManager *this_arg, const uint8_t (*header)[80]);
4501 LDKChannelMessageHandler ChannelManager_as_ChannelMessageHandler(const LDKChannelManager *this_arg);
4503 void ChannelManagerReadArgs_free(LDKChannelManagerReadArgs this_ptr);
4506 * The keys provider which will give us relevant keys. Some keys will be loaded during
4509 const LDKKeysInterface *ChannelManagerReadArgs_get_keys_manager(const LDKChannelManagerReadArgs *this_ptr);
4512 * The keys provider which will give us relevant keys. Some keys will be loaded during
4515 void ChannelManagerReadArgs_set_keys_manager(LDKChannelManagerReadArgs *this_ptr, LDKKeysInterface val);
4518 * The fee_estimator for use in the ChannelManager in the future.
4520 * No calls to the FeeEstimator will be made during deserialization.
4522 const LDKFeeEstimator *ChannelManagerReadArgs_get_fee_estimator(const LDKChannelManagerReadArgs *this_ptr);
4525 * The fee_estimator for use in the ChannelManager in the future.
4527 * No calls to the FeeEstimator will be made during deserialization.
4529 void ChannelManagerReadArgs_set_fee_estimator(LDKChannelManagerReadArgs *this_ptr, LDKFeeEstimator val);
4532 * The chain::Watch for use in the ChannelManager in the future.
4534 * No calls to the chain::Watch will be made during deserialization. It is assumed that
4535 * you have deserialized ChannelMonitors separately and will add them to your
4536 * chain::Watch after deserializing this ChannelManager.
4538 const LDKWatch *ChannelManagerReadArgs_get_chain_monitor(const LDKChannelManagerReadArgs *this_ptr);
4541 * The chain::Watch for use in the ChannelManager in the future.
4543 * No calls to the chain::Watch will be made during deserialization. It is assumed that
4544 * you have deserialized ChannelMonitors separately and will add them to your
4545 * chain::Watch after deserializing this ChannelManager.
4547 void ChannelManagerReadArgs_set_chain_monitor(LDKChannelManagerReadArgs *this_ptr, LDKWatch val);
4550 * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
4551 * used to broadcast the latest local commitment transactions of channels which must be
4552 * force-closed during deserialization.
4554 const LDKBroadcasterInterface *ChannelManagerReadArgs_get_tx_broadcaster(const LDKChannelManagerReadArgs *this_ptr);
4557 * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
4558 * used to broadcast the latest local commitment transactions of channels which must be
4559 * force-closed during deserialization.
4561 void ChannelManagerReadArgs_set_tx_broadcaster(LDKChannelManagerReadArgs *this_ptr, LDKBroadcasterInterface val);
4564 * The Logger for use in the ChannelManager and which may be used to log information during
4567 const LDKLogger *ChannelManagerReadArgs_get_logger(const LDKChannelManagerReadArgs *this_ptr);
4570 * The Logger for use in the ChannelManager and which may be used to log information during
4573 void ChannelManagerReadArgs_set_logger(LDKChannelManagerReadArgs *this_ptr, LDKLogger val);
4576 * Default settings used for new channels. Any existing channels will continue to use the
4577 * runtime settings which were stored when the ChannelManager was serialized.
4579 LDKUserConfig ChannelManagerReadArgs_get_default_config(const LDKChannelManagerReadArgs *this_ptr);
4582 * Default settings used for new channels. Any existing channels will continue to use the
4583 * runtime settings which were stored when the ChannelManager was serialized.
4585 void ChannelManagerReadArgs_set_default_config(LDKChannelManagerReadArgs *this_ptr, LDKUserConfig val);
4588 * Simple utility function to create a ChannelManagerReadArgs which creates the monitor
4589 * HashMap for you. This is primarily useful for C bindings where it is not practical to
4590 * populate a HashMap directly from C.
4592 MUST_USE_RES LDKChannelManagerReadArgs ChannelManagerReadArgs_new(LDKKeysInterface keys_manager, LDKFeeEstimator fee_estimator, LDKWatch chain_monitor, LDKBroadcasterInterface tx_broadcaster, LDKLogger logger, LDKUserConfig default_config, LDKCVec_ChannelMonitorZ channel_monitors);
4594 void DecodeError_free(LDKDecodeError this_ptr);
4596 void Init_free(LDKInit this_ptr);
4598 LDKInit Init_clone(const LDKInit *orig);
4600 void ErrorMessage_free(LDKErrorMessage this_ptr);
4602 LDKErrorMessage ErrorMessage_clone(const LDKErrorMessage *orig);
4605 * The channel ID involved in the error
4607 const uint8_t (*ErrorMessage_get_channel_id(const LDKErrorMessage *this_ptr))[32];
4610 * The channel ID involved in the error
4612 void ErrorMessage_set_channel_id(LDKErrorMessage *this_ptr, LDKThirtyTwoBytes val);
4615 * A possibly human-readable error description.
4616 * The string should be sanitized before it is used (e.g. emitted to logs
4617 * or printed to stdout). Otherwise, a well crafted error message may trigger a security
4618 * vulnerability in the terminal emulator or the logging subsystem.
4620 LDKStr ErrorMessage_get_data(const LDKErrorMessage *this_ptr);
4623 * A possibly human-readable error description.
4624 * The string should be sanitized before it is used (e.g. emitted to logs
4625 * or printed to stdout). Otherwise, a well crafted error message may trigger a security
4626 * vulnerability in the terminal emulator or the logging subsystem.
4628 void ErrorMessage_set_data(LDKErrorMessage *this_ptr, LDKCVec_u8Z val);
4630 MUST_USE_RES LDKErrorMessage ErrorMessage_new(LDKThirtyTwoBytes channel_id_arg, LDKCVec_u8Z data_arg);
4632 void Ping_free(LDKPing this_ptr);
4634 LDKPing Ping_clone(const LDKPing *orig);
4637 * The desired response length
4639 uint16_t Ping_get_ponglen(const LDKPing *this_ptr);
4642 * The desired response length
4644 void Ping_set_ponglen(LDKPing *this_ptr, uint16_t val);
4647 * The ping packet size.
4648 * This field is not sent on the wire. byteslen zeros are sent.
4650 uint16_t Ping_get_byteslen(const LDKPing *this_ptr);
4653 * The ping packet size.
4654 * This field is not sent on the wire. byteslen zeros are sent.
4656 void Ping_set_byteslen(LDKPing *this_ptr, uint16_t val);
4658 MUST_USE_RES LDKPing Ping_new(uint16_t ponglen_arg, uint16_t byteslen_arg);
4660 void Pong_free(LDKPong this_ptr);
4662 LDKPong Pong_clone(const LDKPong *orig);
4665 * The pong packet size.
4666 * This field is not sent on the wire. byteslen zeros are sent.
4668 uint16_t Pong_get_byteslen(const LDKPong *this_ptr);
4671 * The pong packet size.
4672 * This field is not sent on the wire. byteslen zeros are sent.
4674 void Pong_set_byteslen(LDKPong *this_ptr, uint16_t val);
4676 MUST_USE_RES LDKPong Pong_new(uint16_t byteslen_arg);
4678 void OpenChannel_free(LDKOpenChannel this_ptr);
4680 LDKOpenChannel OpenChannel_clone(const LDKOpenChannel *orig);
4683 * The genesis hash of the blockchain where the channel is to be opened
4685 const uint8_t (*OpenChannel_get_chain_hash(const LDKOpenChannel *this_ptr))[32];
4688 * The genesis hash of the blockchain where the channel is to be opened
4690 void OpenChannel_set_chain_hash(LDKOpenChannel *this_ptr, LDKThirtyTwoBytes val);
4693 * A temporary channel ID, until the funding outpoint is announced
4695 const uint8_t (*OpenChannel_get_temporary_channel_id(const LDKOpenChannel *this_ptr))[32];
4698 * A temporary channel ID, until the funding outpoint is announced
4700 void OpenChannel_set_temporary_channel_id(LDKOpenChannel *this_ptr, LDKThirtyTwoBytes val);
4705 uint64_t OpenChannel_get_funding_satoshis(const LDKOpenChannel *this_ptr);
4710 void OpenChannel_set_funding_satoshis(LDKOpenChannel *this_ptr, uint64_t val);
4713 * The amount to push to the counterparty as part of the open, in milli-satoshi
4715 uint64_t OpenChannel_get_push_msat(const LDKOpenChannel *this_ptr);
4718 * The amount to push to the counterparty as part of the open, in milli-satoshi
4720 void OpenChannel_set_push_msat(LDKOpenChannel *this_ptr, uint64_t val);
4723 * The threshold below which outputs on transactions broadcast by sender will be omitted
4725 uint64_t OpenChannel_get_dust_limit_satoshis(const LDKOpenChannel *this_ptr);
4728 * The threshold below which outputs on transactions broadcast by sender will be omitted
4730 void OpenChannel_set_dust_limit_satoshis(LDKOpenChannel *this_ptr, uint64_t val);
4733 * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
4735 uint64_t OpenChannel_get_max_htlc_value_in_flight_msat(const LDKOpenChannel *this_ptr);
4738 * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
4740 void OpenChannel_set_max_htlc_value_in_flight_msat(LDKOpenChannel *this_ptr, uint64_t val);
4743 * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
4745 uint64_t OpenChannel_get_channel_reserve_satoshis(const LDKOpenChannel *this_ptr);
4748 * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
4750 void OpenChannel_set_channel_reserve_satoshis(LDKOpenChannel *this_ptr, uint64_t val);
4753 * The minimum HTLC size incoming to sender, in milli-satoshi
4755 uint64_t OpenChannel_get_htlc_minimum_msat(const LDKOpenChannel *this_ptr);
4758 * The minimum HTLC size incoming to sender, in milli-satoshi
4760 void OpenChannel_set_htlc_minimum_msat(LDKOpenChannel *this_ptr, uint64_t val);
4763 * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
4765 uint32_t OpenChannel_get_feerate_per_kw(const LDKOpenChannel *this_ptr);
4768 * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
4770 void OpenChannel_set_feerate_per_kw(LDKOpenChannel *this_ptr, uint32_t val);
4773 * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
4775 uint16_t OpenChannel_get_to_self_delay(const LDKOpenChannel *this_ptr);
4778 * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
4780 void OpenChannel_set_to_self_delay(LDKOpenChannel *this_ptr, uint16_t val);
4783 * The maximum number of inbound HTLCs towards sender
4785 uint16_t OpenChannel_get_max_accepted_htlcs(const LDKOpenChannel *this_ptr);
4788 * The maximum number of inbound HTLCs towards sender
4790 void OpenChannel_set_max_accepted_htlcs(LDKOpenChannel *this_ptr, uint16_t val);
4793 * The sender's key controlling the funding transaction
4795 LDKPublicKey OpenChannel_get_funding_pubkey(const LDKOpenChannel *this_ptr);
4798 * The sender's key controlling the funding transaction
4800 void OpenChannel_set_funding_pubkey(LDKOpenChannel *this_ptr, LDKPublicKey val);
4803 * Used to derive a revocation key for transactions broadcast by counterparty
4805 LDKPublicKey OpenChannel_get_revocation_basepoint(const LDKOpenChannel *this_ptr);
4808 * Used to derive a revocation key for transactions broadcast by counterparty
4810 void OpenChannel_set_revocation_basepoint(LDKOpenChannel *this_ptr, LDKPublicKey val);
4813 * A payment key to sender for transactions broadcast by counterparty
4815 LDKPublicKey OpenChannel_get_payment_point(const LDKOpenChannel *this_ptr);
4818 * A payment key to sender for transactions broadcast by counterparty
4820 void OpenChannel_set_payment_point(LDKOpenChannel *this_ptr, LDKPublicKey val);
4823 * Used to derive a payment key to sender for transactions broadcast by sender
4825 LDKPublicKey OpenChannel_get_delayed_payment_basepoint(const LDKOpenChannel *this_ptr);
4828 * Used to derive a payment key to sender for transactions broadcast by sender
4830 void OpenChannel_set_delayed_payment_basepoint(LDKOpenChannel *this_ptr, LDKPublicKey val);
4833 * Used to derive an HTLC payment key to sender
4835 LDKPublicKey OpenChannel_get_htlc_basepoint(const LDKOpenChannel *this_ptr);
4838 * Used to derive an HTLC payment key to sender
4840 void OpenChannel_set_htlc_basepoint(LDKOpenChannel *this_ptr, LDKPublicKey val);
4843 * The first to-be-broadcast-by-sender transaction's per commitment point
4845 LDKPublicKey OpenChannel_get_first_per_commitment_point(const LDKOpenChannel *this_ptr);
4848 * The first to-be-broadcast-by-sender transaction's per commitment point
4850 void OpenChannel_set_first_per_commitment_point(LDKOpenChannel *this_ptr, LDKPublicKey val);
4855 uint8_t OpenChannel_get_channel_flags(const LDKOpenChannel *this_ptr);
4860 void OpenChannel_set_channel_flags(LDKOpenChannel *this_ptr, uint8_t val);
4862 void AcceptChannel_free(LDKAcceptChannel this_ptr);
4864 LDKAcceptChannel AcceptChannel_clone(const LDKAcceptChannel *orig);
4867 * A temporary channel ID, until the funding outpoint is announced
4869 const uint8_t (*AcceptChannel_get_temporary_channel_id(const LDKAcceptChannel *this_ptr))[32];
4872 * A temporary channel ID, until the funding outpoint is announced
4874 void AcceptChannel_set_temporary_channel_id(LDKAcceptChannel *this_ptr, LDKThirtyTwoBytes val);
4877 * The threshold below which outputs on transactions broadcast by sender will be omitted
4879 uint64_t AcceptChannel_get_dust_limit_satoshis(const LDKAcceptChannel *this_ptr);
4882 * The threshold below which outputs on transactions broadcast by sender will be omitted
4884 void AcceptChannel_set_dust_limit_satoshis(LDKAcceptChannel *this_ptr, uint64_t val);
4887 * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
4889 uint64_t AcceptChannel_get_max_htlc_value_in_flight_msat(const LDKAcceptChannel *this_ptr);
4892 * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
4894 void AcceptChannel_set_max_htlc_value_in_flight_msat(LDKAcceptChannel *this_ptr, uint64_t val);
4897 * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
4899 uint64_t AcceptChannel_get_channel_reserve_satoshis(const LDKAcceptChannel *this_ptr);
4902 * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
4904 void AcceptChannel_set_channel_reserve_satoshis(LDKAcceptChannel *this_ptr, uint64_t val);
4907 * The minimum HTLC size incoming to sender, in milli-satoshi
4909 uint64_t AcceptChannel_get_htlc_minimum_msat(const LDKAcceptChannel *this_ptr);
4912 * The minimum HTLC size incoming to sender, in milli-satoshi
4914 void AcceptChannel_set_htlc_minimum_msat(LDKAcceptChannel *this_ptr, uint64_t val);
4917 * Minimum depth of the funding transaction before the channel is considered open
4919 uint32_t AcceptChannel_get_minimum_depth(const LDKAcceptChannel *this_ptr);
4922 * Minimum depth of the funding transaction before the channel is considered open
4924 void AcceptChannel_set_minimum_depth(LDKAcceptChannel *this_ptr, uint32_t val);
4927 * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
4929 uint16_t AcceptChannel_get_to_self_delay(const LDKAcceptChannel *this_ptr);
4932 * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
4934 void AcceptChannel_set_to_self_delay(LDKAcceptChannel *this_ptr, uint16_t val);
4937 * The maximum number of inbound HTLCs towards sender
4939 uint16_t AcceptChannel_get_max_accepted_htlcs(const LDKAcceptChannel *this_ptr);
4942 * The maximum number of inbound HTLCs towards sender
4944 void AcceptChannel_set_max_accepted_htlcs(LDKAcceptChannel *this_ptr, uint16_t val);
4947 * The sender's key controlling the funding transaction
4949 LDKPublicKey AcceptChannel_get_funding_pubkey(const LDKAcceptChannel *this_ptr);
4952 * The sender's key controlling the funding transaction
4954 void AcceptChannel_set_funding_pubkey(LDKAcceptChannel *this_ptr, LDKPublicKey val);
4957 * Used to derive a revocation key for transactions broadcast by counterparty
4959 LDKPublicKey AcceptChannel_get_revocation_basepoint(const LDKAcceptChannel *this_ptr);
4962 * Used to derive a revocation key for transactions broadcast by counterparty
4964 void AcceptChannel_set_revocation_basepoint(LDKAcceptChannel *this_ptr, LDKPublicKey val);
4967 * A payment key to sender for transactions broadcast by counterparty
4969 LDKPublicKey AcceptChannel_get_payment_point(const LDKAcceptChannel *this_ptr);
4972 * A payment key to sender for transactions broadcast by counterparty
4974 void AcceptChannel_set_payment_point(LDKAcceptChannel *this_ptr, LDKPublicKey val);
4977 * Used to derive a payment key to sender for transactions broadcast by sender
4979 LDKPublicKey AcceptChannel_get_delayed_payment_basepoint(const LDKAcceptChannel *this_ptr);
4982 * Used to derive a payment key to sender for transactions broadcast by sender
4984 void AcceptChannel_set_delayed_payment_basepoint(LDKAcceptChannel *this_ptr, LDKPublicKey val);
4987 * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
4989 LDKPublicKey AcceptChannel_get_htlc_basepoint(const LDKAcceptChannel *this_ptr);
4992 * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
4994 void AcceptChannel_set_htlc_basepoint(LDKAcceptChannel *this_ptr, LDKPublicKey val);
4997 * The first to-be-broadcast-by-sender transaction's per commitment point
4999 LDKPublicKey AcceptChannel_get_first_per_commitment_point(const LDKAcceptChannel *this_ptr);
5002 * The first to-be-broadcast-by-sender transaction's per commitment point
5004 void AcceptChannel_set_first_per_commitment_point(LDKAcceptChannel *this_ptr, LDKPublicKey val);
5006 void FundingCreated_free(LDKFundingCreated this_ptr);
5008 LDKFundingCreated FundingCreated_clone(const LDKFundingCreated *orig);
5011 * A temporary channel ID, until the funding is established
5013 const uint8_t (*FundingCreated_get_temporary_channel_id(const LDKFundingCreated *this_ptr))[32];
5016 * A temporary channel ID, until the funding is established
5018 void FundingCreated_set_temporary_channel_id(LDKFundingCreated *this_ptr, LDKThirtyTwoBytes val);
5021 * The funding transaction ID
5023 const uint8_t (*FundingCreated_get_funding_txid(const LDKFundingCreated *this_ptr))[32];
5026 * The funding transaction ID
5028 void FundingCreated_set_funding_txid(LDKFundingCreated *this_ptr, LDKThirtyTwoBytes val);
5031 * The specific output index funding this channel
5033 uint16_t FundingCreated_get_funding_output_index(const LDKFundingCreated *this_ptr);
5036 * The specific output index funding this channel
5038 void FundingCreated_set_funding_output_index(LDKFundingCreated *this_ptr, uint16_t val);
5041 * The signature of the channel initiator (funder) on the funding transaction
5043 LDKSignature FundingCreated_get_signature(const LDKFundingCreated *this_ptr);
5046 * The signature of the channel initiator (funder) on the funding transaction
5048 void FundingCreated_set_signature(LDKFundingCreated *this_ptr, LDKSignature val);
5050 MUST_USE_RES LDKFundingCreated FundingCreated_new(LDKThirtyTwoBytes temporary_channel_id_arg, LDKThirtyTwoBytes funding_txid_arg, uint16_t funding_output_index_arg, LDKSignature signature_arg);
5052 void FundingSigned_free(LDKFundingSigned this_ptr);
5054 LDKFundingSigned FundingSigned_clone(const LDKFundingSigned *orig);
5059 const uint8_t (*FundingSigned_get_channel_id(const LDKFundingSigned *this_ptr))[32];
5064 void FundingSigned_set_channel_id(LDKFundingSigned *this_ptr, LDKThirtyTwoBytes val);
5067 * The signature of the channel acceptor (fundee) on the funding transaction
5069 LDKSignature FundingSigned_get_signature(const LDKFundingSigned *this_ptr);
5072 * The signature of the channel acceptor (fundee) on the funding transaction
5074 void FundingSigned_set_signature(LDKFundingSigned *this_ptr, LDKSignature val);
5076 MUST_USE_RES LDKFundingSigned FundingSigned_new(LDKThirtyTwoBytes channel_id_arg, LDKSignature signature_arg);
5078 void FundingLocked_free(LDKFundingLocked this_ptr);
5080 LDKFundingLocked FundingLocked_clone(const LDKFundingLocked *orig);
5085 const uint8_t (*FundingLocked_get_channel_id(const LDKFundingLocked *this_ptr))[32];
5090 void FundingLocked_set_channel_id(LDKFundingLocked *this_ptr, LDKThirtyTwoBytes val);
5093 * The per-commitment point of the second commitment transaction
5095 LDKPublicKey FundingLocked_get_next_per_commitment_point(const LDKFundingLocked *this_ptr);
5098 * The per-commitment point of the second commitment transaction
5100 void FundingLocked_set_next_per_commitment_point(LDKFundingLocked *this_ptr, LDKPublicKey val);
5102 MUST_USE_RES LDKFundingLocked FundingLocked_new(LDKThirtyTwoBytes channel_id_arg, LDKPublicKey next_per_commitment_point_arg);
5104 void Shutdown_free(LDKShutdown this_ptr);
5106 LDKShutdown Shutdown_clone(const LDKShutdown *orig);
5111 const uint8_t (*Shutdown_get_channel_id(const LDKShutdown *this_ptr))[32];
5116 void Shutdown_set_channel_id(LDKShutdown *this_ptr, LDKThirtyTwoBytes val);
5119 * The destination of this peer's funds on closing.
5120 * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
5122 LDKu8slice Shutdown_get_scriptpubkey(const LDKShutdown *this_ptr);
5125 * The destination of this peer's funds on closing.
5126 * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
5128 void Shutdown_set_scriptpubkey(LDKShutdown *this_ptr, LDKCVec_u8Z val);
5130 MUST_USE_RES LDKShutdown Shutdown_new(LDKThirtyTwoBytes channel_id_arg, LDKCVec_u8Z scriptpubkey_arg);
5132 void ClosingSigned_free(LDKClosingSigned this_ptr);
5134 LDKClosingSigned ClosingSigned_clone(const LDKClosingSigned *orig);
5139 const uint8_t (*ClosingSigned_get_channel_id(const LDKClosingSigned *this_ptr))[32];
5144 void ClosingSigned_set_channel_id(LDKClosingSigned *this_ptr, LDKThirtyTwoBytes val);
5147 * The proposed total fee for the closing transaction
5149 uint64_t ClosingSigned_get_fee_satoshis(const LDKClosingSigned *this_ptr);
5152 * The proposed total fee for the closing transaction
5154 void ClosingSigned_set_fee_satoshis(LDKClosingSigned *this_ptr, uint64_t val);
5157 * A signature on the closing transaction
5159 LDKSignature ClosingSigned_get_signature(const LDKClosingSigned *this_ptr);
5162 * A signature on the closing transaction
5164 void ClosingSigned_set_signature(LDKClosingSigned *this_ptr, LDKSignature val);
5166 MUST_USE_RES LDKClosingSigned ClosingSigned_new(LDKThirtyTwoBytes channel_id_arg, uint64_t fee_satoshis_arg, LDKSignature signature_arg);
5168 void UpdateAddHTLC_free(LDKUpdateAddHTLC this_ptr);
5170 LDKUpdateAddHTLC UpdateAddHTLC_clone(const LDKUpdateAddHTLC *orig);
5175 const uint8_t (*UpdateAddHTLC_get_channel_id(const LDKUpdateAddHTLC *this_ptr))[32];
5180 void UpdateAddHTLC_set_channel_id(LDKUpdateAddHTLC *this_ptr, LDKThirtyTwoBytes val);
5185 uint64_t UpdateAddHTLC_get_htlc_id(const LDKUpdateAddHTLC *this_ptr);
5190 void UpdateAddHTLC_set_htlc_id(LDKUpdateAddHTLC *this_ptr, uint64_t val);
5193 * The HTLC value in milli-satoshi
5195 uint64_t UpdateAddHTLC_get_amount_msat(const LDKUpdateAddHTLC *this_ptr);
5198 * The HTLC value in milli-satoshi
5200 void UpdateAddHTLC_set_amount_msat(LDKUpdateAddHTLC *this_ptr, uint64_t val);
5203 * The payment hash, the pre-image of which controls HTLC redemption
5205 const uint8_t (*UpdateAddHTLC_get_payment_hash(const LDKUpdateAddHTLC *this_ptr))[32];
5208 * The payment hash, the pre-image of which controls HTLC redemption
5210 void UpdateAddHTLC_set_payment_hash(LDKUpdateAddHTLC *this_ptr, LDKThirtyTwoBytes val);
5213 * The expiry height of the HTLC
5215 uint32_t UpdateAddHTLC_get_cltv_expiry(const LDKUpdateAddHTLC *this_ptr);
5218 * The expiry height of the HTLC
5220 void UpdateAddHTLC_set_cltv_expiry(LDKUpdateAddHTLC *this_ptr, uint32_t val);
5222 void UpdateFulfillHTLC_free(LDKUpdateFulfillHTLC this_ptr);
5224 LDKUpdateFulfillHTLC UpdateFulfillHTLC_clone(const LDKUpdateFulfillHTLC *orig);
5229 const uint8_t (*UpdateFulfillHTLC_get_channel_id(const LDKUpdateFulfillHTLC *this_ptr))[32];
5234 void UpdateFulfillHTLC_set_channel_id(LDKUpdateFulfillHTLC *this_ptr, LDKThirtyTwoBytes val);
5239 uint64_t UpdateFulfillHTLC_get_htlc_id(const LDKUpdateFulfillHTLC *this_ptr);
5244 void UpdateFulfillHTLC_set_htlc_id(LDKUpdateFulfillHTLC *this_ptr, uint64_t val);
5247 * The pre-image of the payment hash, allowing HTLC redemption
5249 const uint8_t (*UpdateFulfillHTLC_get_payment_preimage(const LDKUpdateFulfillHTLC *this_ptr))[32];
5252 * The pre-image of the payment hash, allowing HTLC redemption
5254 void UpdateFulfillHTLC_set_payment_preimage(LDKUpdateFulfillHTLC *this_ptr, LDKThirtyTwoBytes val);
5256 MUST_USE_RES LDKUpdateFulfillHTLC UpdateFulfillHTLC_new(LDKThirtyTwoBytes channel_id_arg, uint64_t htlc_id_arg, LDKThirtyTwoBytes payment_preimage_arg);
5258 void UpdateFailHTLC_free(LDKUpdateFailHTLC this_ptr);
5260 LDKUpdateFailHTLC UpdateFailHTLC_clone(const LDKUpdateFailHTLC *orig);
5265 const uint8_t (*UpdateFailHTLC_get_channel_id(const LDKUpdateFailHTLC *this_ptr))[32];
5270 void UpdateFailHTLC_set_channel_id(LDKUpdateFailHTLC *this_ptr, LDKThirtyTwoBytes val);
5275 uint64_t UpdateFailHTLC_get_htlc_id(const LDKUpdateFailHTLC *this_ptr);
5280 void UpdateFailHTLC_set_htlc_id(LDKUpdateFailHTLC *this_ptr, uint64_t val);
5282 void UpdateFailMalformedHTLC_free(LDKUpdateFailMalformedHTLC this_ptr);
5284 LDKUpdateFailMalformedHTLC UpdateFailMalformedHTLC_clone(const LDKUpdateFailMalformedHTLC *orig);
5289 const uint8_t (*UpdateFailMalformedHTLC_get_channel_id(const LDKUpdateFailMalformedHTLC *this_ptr))[32];
5294 void UpdateFailMalformedHTLC_set_channel_id(LDKUpdateFailMalformedHTLC *this_ptr, LDKThirtyTwoBytes val);
5299 uint64_t UpdateFailMalformedHTLC_get_htlc_id(const LDKUpdateFailMalformedHTLC *this_ptr);
5304 void UpdateFailMalformedHTLC_set_htlc_id(LDKUpdateFailMalformedHTLC *this_ptr, uint64_t val);
5309 uint16_t UpdateFailMalformedHTLC_get_failure_code(const LDKUpdateFailMalformedHTLC *this_ptr);
5314 void UpdateFailMalformedHTLC_set_failure_code(LDKUpdateFailMalformedHTLC *this_ptr, uint16_t val);
5316 void CommitmentSigned_free(LDKCommitmentSigned this_ptr);
5318 LDKCommitmentSigned CommitmentSigned_clone(const LDKCommitmentSigned *orig);
5323 const uint8_t (*CommitmentSigned_get_channel_id(const LDKCommitmentSigned *this_ptr))[32];
5328 void CommitmentSigned_set_channel_id(LDKCommitmentSigned *this_ptr, LDKThirtyTwoBytes val);
5331 * A signature on the commitment transaction
5333 LDKSignature CommitmentSigned_get_signature(const LDKCommitmentSigned *this_ptr);
5336 * A signature on the commitment transaction
5338 void CommitmentSigned_set_signature(LDKCommitmentSigned *this_ptr, LDKSignature val);
5341 * Signatures on the HTLC transactions
5343 void CommitmentSigned_set_htlc_signatures(LDKCommitmentSigned *this_ptr, LDKCVec_SignatureZ val);
5345 MUST_USE_RES LDKCommitmentSigned CommitmentSigned_new(LDKThirtyTwoBytes channel_id_arg, LDKSignature signature_arg, LDKCVec_SignatureZ htlc_signatures_arg);
5347 void RevokeAndACK_free(LDKRevokeAndACK this_ptr);
5349 LDKRevokeAndACK RevokeAndACK_clone(const LDKRevokeAndACK *orig);
5354 const uint8_t (*RevokeAndACK_get_channel_id(const LDKRevokeAndACK *this_ptr))[32];
5359 void RevokeAndACK_set_channel_id(LDKRevokeAndACK *this_ptr, LDKThirtyTwoBytes val);
5362 * The secret corresponding to the per-commitment point
5364 const uint8_t (*RevokeAndACK_get_per_commitment_secret(const LDKRevokeAndACK *this_ptr))[32];
5367 * The secret corresponding to the per-commitment point
5369 void RevokeAndACK_set_per_commitment_secret(LDKRevokeAndACK *this_ptr, LDKThirtyTwoBytes val);
5372 * The next sender-broadcast commitment transaction's per-commitment point
5374 LDKPublicKey RevokeAndACK_get_next_per_commitment_point(const LDKRevokeAndACK *this_ptr);
5377 * The next sender-broadcast commitment transaction's per-commitment point
5379 void RevokeAndACK_set_next_per_commitment_point(LDKRevokeAndACK *this_ptr, LDKPublicKey val);
5381 MUST_USE_RES LDKRevokeAndACK RevokeAndACK_new(LDKThirtyTwoBytes channel_id_arg, LDKThirtyTwoBytes per_commitment_secret_arg, LDKPublicKey next_per_commitment_point_arg);
5383 void UpdateFee_free(LDKUpdateFee this_ptr);
5385 LDKUpdateFee UpdateFee_clone(const LDKUpdateFee *orig);
5390 const uint8_t (*UpdateFee_get_channel_id(const LDKUpdateFee *this_ptr))[32];
5395 void UpdateFee_set_channel_id(LDKUpdateFee *this_ptr, LDKThirtyTwoBytes val);
5398 * Fee rate per 1000-weight of the transaction
5400 uint32_t UpdateFee_get_feerate_per_kw(const LDKUpdateFee *this_ptr);
5403 * Fee rate per 1000-weight of the transaction
5405 void UpdateFee_set_feerate_per_kw(LDKUpdateFee *this_ptr, uint32_t val);
5407 MUST_USE_RES LDKUpdateFee UpdateFee_new(LDKThirtyTwoBytes channel_id_arg, uint32_t feerate_per_kw_arg);
5409 void DataLossProtect_free(LDKDataLossProtect this_ptr);
5411 LDKDataLossProtect DataLossProtect_clone(const LDKDataLossProtect *orig);
5414 * Proof that the sender knows the per-commitment secret of a specific commitment transaction
5415 * belonging to the recipient
5417 const uint8_t (*DataLossProtect_get_your_last_per_commitment_secret(const LDKDataLossProtect *this_ptr))[32];
5420 * Proof that the sender knows the per-commitment secret of a specific commitment transaction
5421 * belonging to the recipient
5423 void DataLossProtect_set_your_last_per_commitment_secret(LDKDataLossProtect *this_ptr, LDKThirtyTwoBytes val);
5426 * The sender's per-commitment point for their current commitment transaction
5428 LDKPublicKey DataLossProtect_get_my_current_per_commitment_point(const LDKDataLossProtect *this_ptr);
5431 * The sender's per-commitment point for their current commitment transaction
5433 void DataLossProtect_set_my_current_per_commitment_point(LDKDataLossProtect *this_ptr, LDKPublicKey val);
5435 MUST_USE_RES LDKDataLossProtect DataLossProtect_new(LDKThirtyTwoBytes your_last_per_commitment_secret_arg, LDKPublicKey my_current_per_commitment_point_arg);
5437 void ChannelReestablish_free(LDKChannelReestablish this_ptr);
5439 LDKChannelReestablish ChannelReestablish_clone(const LDKChannelReestablish *orig);
5444 const uint8_t (*ChannelReestablish_get_channel_id(const LDKChannelReestablish *this_ptr))[32];
5449 void ChannelReestablish_set_channel_id(LDKChannelReestablish *this_ptr, LDKThirtyTwoBytes val);
5452 * The next commitment number for the sender
5454 uint64_t ChannelReestablish_get_next_local_commitment_number(const LDKChannelReestablish *this_ptr);
5457 * The next commitment number for the sender
5459 void ChannelReestablish_set_next_local_commitment_number(LDKChannelReestablish *this_ptr, uint64_t val);
5462 * The next commitment number for the recipient
5464 uint64_t ChannelReestablish_get_next_remote_commitment_number(const LDKChannelReestablish *this_ptr);
5467 * The next commitment number for the recipient
5469 void ChannelReestablish_set_next_remote_commitment_number(LDKChannelReestablish *this_ptr, uint64_t val);
5471 void AnnouncementSignatures_free(LDKAnnouncementSignatures this_ptr);
5473 LDKAnnouncementSignatures AnnouncementSignatures_clone(const LDKAnnouncementSignatures *orig);
5478 const uint8_t (*AnnouncementSignatures_get_channel_id(const LDKAnnouncementSignatures *this_ptr))[32];
5483 void AnnouncementSignatures_set_channel_id(LDKAnnouncementSignatures *this_ptr, LDKThirtyTwoBytes val);
5486 * The short channel ID
5488 uint64_t AnnouncementSignatures_get_short_channel_id(const LDKAnnouncementSignatures *this_ptr);
5491 * The short channel ID
5493 void AnnouncementSignatures_set_short_channel_id(LDKAnnouncementSignatures *this_ptr, uint64_t val);
5496 * A signature by the node key
5498 LDKSignature AnnouncementSignatures_get_node_signature(const LDKAnnouncementSignatures *this_ptr);
5501 * A signature by the node key
5503 void AnnouncementSignatures_set_node_signature(LDKAnnouncementSignatures *this_ptr, LDKSignature val);
5506 * A signature by the funding key
5508 LDKSignature AnnouncementSignatures_get_bitcoin_signature(const LDKAnnouncementSignatures *this_ptr);
5511 * A signature by the funding key
5513 void AnnouncementSignatures_set_bitcoin_signature(LDKAnnouncementSignatures *this_ptr, LDKSignature val);
5515 MUST_USE_RES LDKAnnouncementSignatures AnnouncementSignatures_new(LDKThirtyTwoBytes channel_id_arg, uint64_t short_channel_id_arg, LDKSignature node_signature_arg, LDKSignature bitcoin_signature_arg);
5517 void NetAddress_free(LDKNetAddress this_ptr);
5519 LDKNetAddress NetAddress_clone(const LDKNetAddress *orig);
5521 void UnsignedNodeAnnouncement_free(LDKUnsignedNodeAnnouncement this_ptr);
5523 LDKUnsignedNodeAnnouncement UnsignedNodeAnnouncement_clone(const LDKUnsignedNodeAnnouncement *orig);
5526 * The advertised features
5528 LDKNodeFeatures UnsignedNodeAnnouncement_get_features(const LDKUnsignedNodeAnnouncement *this_ptr);
5531 * The advertised features
5533 void UnsignedNodeAnnouncement_set_features(LDKUnsignedNodeAnnouncement *this_ptr, LDKNodeFeatures val);
5536 * A strictly monotonic announcement counter, with gaps allowed
5538 uint32_t UnsignedNodeAnnouncement_get_timestamp(const LDKUnsignedNodeAnnouncement *this_ptr);
5541 * A strictly monotonic announcement counter, with gaps allowed
5543 void UnsignedNodeAnnouncement_set_timestamp(LDKUnsignedNodeAnnouncement *this_ptr, uint32_t val);
5546 * The node_id this announcement originated from (don't rebroadcast the node_announcement back
5549 LDKPublicKey UnsignedNodeAnnouncement_get_node_id(const LDKUnsignedNodeAnnouncement *this_ptr);
5552 * The node_id this announcement originated from (don't rebroadcast the node_announcement back
5555 void UnsignedNodeAnnouncement_set_node_id(LDKUnsignedNodeAnnouncement *this_ptr, LDKPublicKey val);
5558 * An RGB color for UI purposes
5560 const uint8_t (*UnsignedNodeAnnouncement_get_rgb(const LDKUnsignedNodeAnnouncement *this_ptr))[3];
5563 * An RGB color for UI purposes
5565 void UnsignedNodeAnnouncement_set_rgb(LDKUnsignedNodeAnnouncement *this_ptr, LDKThreeBytes val);
5568 * An alias, for UI purposes. This should be sanitized before use. There is no guarantee
5571 const uint8_t (*UnsignedNodeAnnouncement_get_alias(const LDKUnsignedNodeAnnouncement *this_ptr))[32];
5574 * An alias, for UI purposes. This should be sanitized before use. There is no guarantee
5577 void UnsignedNodeAnnouncement_set_alias(LDKUnsignedNodeAnnouncement *this_ptr, LDKThirtyTwoBytes val);
5580 * List of addresses on which this node is reachable
5582 void UnsignedNodeAnnouncement_set_addresses(LDKUnsignedNodeAnnouncement *this_ptr, LDKCVec_NetAddressZ val);
5584 void NodeAnnouncement_free(LDKNodeAnnouncement this_ptr);
5586 LDKNodeAnnouncement NodeAnnouncement_clone(const LDKNodeAnnouncement *orig);
5589 * The signature by the node key
5591 LDKSignature NodeAnnouncement_get_signature(const LDKNodeAnnouncement *this_ptr);
5594 * The signature by the node key
5596 void NodeAnnouncement_set_signature(LDKNodeAnnouncement *this_ptr, LDKSignature val);
5599 * The actual content of the announcement
5601 LDKUnsignedNodeAnnouncement NodeAnnouncement_get_contents(const LDKNodeAnnouncement *this_ptr);
5604 * The actual content of the announcement
5606 void NodeAnnouncement_set_contents(LDKNodeAnnouncement *this_ptr, LDKUnsignedNodeAnnouncement val);
5608 MUST_USE_RES LDKNodeAnnouncement NodeAnnouncement_new(LDKSignature signature_arg, LDKUnsignedNodeAnnouncement contents_arg);
5610 void UnsignedChannelAnnouncement_free(LDKUnsignedChannelAnnouncement this_ptr);
5612 LDKUnsignedChannelAnnouncement UnsignedChannelAnnouncement_clone(const LDKUnsignedChannelAnnouncement *orig);
5615 * The advertised channel features
5617 LDKChannelFeatures UnsignedChannelAnnouncement_get_features(const LDKUnsignedChannelAnnouncement *this_ptr);
5620 * The advertised channel features
5622 void UnsignedChannelAnnouncement_set_features(LDKUnsignedChannelAnnouncement *this_ptr, LDKChannelFeatures val);
5625 * The genesis hash of the blockchain where the channel is to be opened
5627 const uint8_t (*UnsignedChannelAnnouncement_get_chain_hash(const LDKUnsignedChannelAnnouncement *this_ptr))[32];
5630 * The genesis hash of the blockchain where the channel is to be opened
5632 void UnsignedChannelAnnouncement_set_chain_hash(LDKUnsignedChannelAnnouncement *this_ptr, LDKThirtyTwoBytes val);
5635 * The short channel ID
5637 uint64_t UnsignedChannelAnnouncement_get_short_channel_id(const LDKUnsignedChannelAnnouncement *this_ptr);
5640 * The short channel ID
5642 void UnsignedChannelAnnouncement_set_short_channel_id(LDKUnsignedChannelAnnouncement *this_ptr, uint64_t val);
5645 * One of the two node_ids which are endpoints of this channel
5647 LDKPublicKey UnsignedChannelAnnouncement_get_node_id_1(const LDKUnsignedChannelAnnouncement *this_ptr);
5650 * One of the two node_ids which are endpoints of this channel
5652 void UnsignedChannelAnnouncement_set_node_id_1(LDKUnsignedChannelAnnouncement *this_ptr, LDKPublicKey val);
5655 * The other of the two node_ids which are endpoints of this channel
5657 LDKPublicKey UnsignedChannelAnnouncement_get_node_id_2(const LDKUnsignedChannelAnnouncement *this_ptr);
5660 * The other of the two node_ids which are endpoints of this channel
5662 void UnsignedChannelAnnouncement_set_node_id_2(LDKUnsignedChannelAnnouncement *this_ptr, LDKPublicKey val);
5665 * The funding key for the first node
5667 LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_1(const LDKUnsignedChannelAnnouncement *this_ptr);
5670 * The funding key for the first node
5672 void UnsignedChannelAnnouncement_set_bitcoin_key_1(LDKUnsignedChannelAnnouncement *this_ptr, LDKPublicKey val);
5675 * The funding key for the second node
5677 LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_2(const LDKUnsignedChannelAnnouncement *this_ptr);
5680 * The funding key for the second node
5682 void UnsignedChannelAnnouncement_set_bitcoin_key_2(LDKUnsignedChannelAnnouncement *this_ptr, LDKPublicKey val);
5684 void ChannelAnnouncement_free(LDKChannelAnnouncement this_ptr);
5686 LDKChannelAnnouncement ChannelAnnouncement_clone(const LDKChannelAnnouncement *orig);
5689 * Authentication of the announcement by the first public node
5691 LDKSignature ChannelAnnouncement_get_node_signature_1(const LDKChannelAnnouncement *this_ptr);
5694 * Authentication of the announcement by the first public node
5696 void ChannelAnnouncement_set_node_signature_1(LDKChannelAnnouncement *this_ptr, LDKSignature val);
5699 * Authentication of the announcement by the second public node
5701 LDKSignature ChannelAnnouncement_get_node_signature_2(const LDKChannelAnnouncement *this_ptr);
5704 * Authentication of the announcement by the second public node
5706 void ChannelAnnouncement_set_node_signature_2(LDKChannelAnnouncement *this_ptr, LDKSignature val);
5709 * Proof of funding UTXO ownership by the first public node
5711 LDKSignature ChannelAnnouncement_get_bitcoin_signature_1(const LDKChannelAnnouncement *this_ptr);
5714 * Proof of funding UTXO ownership by the first public node
5716 void ChannelAnnouncement_set_bitcoin_signature_1(LDKChannelAnnouncement *this_ptr, LDKSignature val);
5719 * Proof of funding UTXO ownership by the second public node
5721 LDKSignature ChannelAnnouncement_get_bitcoin_signature_2(const LDKChannelAnnouncement *this_ptr);
5724 * Proof of funding UTXO ownership by the second public node
5726 void ChannelAnnouncement_set_bitcoin_signature_2(LDKChannelAnnouncement *this_ptr, LDKSignature val);
5729 * The actual announcement
5731 LDKUnsignedChannelAnnouncement ChannelAnnouncement_get_contents(const LDKChannelAnnouncement *this_ptr);
5734 * The actual announcement
5736 void ChannelAnnouncement_set_contents(LDKChannelAnnouncement *this_ptr, LDKUnsignedChannelAnnouncement val);
5738 MUST_USE_RES LDKChannelAnnouncement ChannelAnnouncement_new(LDKSignature node_signature_1_arg, LDKSignature node_signature_2_arg, LDKSignature bitcoin_signature_1_arg, LDKSignature bitcoin_signature_2_arg, LDKUnsignedChannelAnnouncement contents_arg);
5740 void UnsignedChannelUpdate_free(LDKUnsignedChannelUpdate this_ptr);
5742 LDKUnsignedChannelUpdate UnsignedChannelUpdate_clone(const LDKUnsignedChannelUpdate *orig);
5745 * The genesis hash of the blockchain where the channel is to be opened
5747 const uint8_t (*UnsignedChannelUpdate_get_chain_hash(const LDKUnsignedChannelUpdate *this_ptr))[32];
5750 * The genesis hash of the blockchain where the channel is to be opened
5752 void UnsignedChannelUpdate_set_chain_hash(LDKUnsignedChannelUpdate *this_ptr, LDKThirtyTwoBytes val);
5755 * The short channel ID
5757 uint64_t UnsignedChannelUpdate_get_short_channel_id(const LDKUnsignedChannelUpdate *this_ptr);
5760 * The short channel ID
5762 void UnsignedChannelUpdate_set_short_channel_id(LDKUnsignedChannelUpdate *this_ptr, uint64_t val);
5765 * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
5767 uint32_t UnsignedChannelUpdate_get_timestamp(const LDKUnsignedChannelUpdate *this_ptr);
5770 * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
5772 void UnsignedChannelUpdate_set_timestamp(LDKUnsignedChannelUpdate *this_ptr, uint32_t val);
5777 uint8_t UnsignedChannelUpdate_get_flags(const LDKUnsignedChannelUpdate *this_ptr);
5782 void UnsignedChannelUpdate_set_flags(LDKUnsignedChannelUpdate *this_ptr, uint8_t val);
5785 * The number of blocks to subtract from incoming HTLC cltv_expiry values
5787 uint16_t UnsignedChannelUpdate_get_cltv_expiry_delta(const LDKUnsignedChannelUpdate *this_ptr);
5790 * The number of blocks to subtract from incoming HTLC cltv_expiry values
5792 void UnsignedChannelUpdate_set_cltv_expiry_delta(LDKUnsignedChannelUpdate *this_ptr, uint16_t val);
5795 * The minimum HTLC size incoming to sender, in milli-satoshi
5797 uint64_t UnsignedChannelUpdate_get_htlc_minimum_msat(const LDKUnsignedChannelUpdate *this_ptr);
5800 * The minimum HTLC size incoming to sender, in milli-satoshi
5802 void UnsignedChannelUpdate_set_htlc_minimum_msat(LDKUnsignedChannelUpdate *this_ptr, uint64_t val);
5805 * The base HTLC fee charged by sender, in milli-satoshi
5807 uint32_t UnsignedChannelUpdate_get_fee_base_msat(const LDKUnsignedChannelUpdate *this_ptr);
5810 * The base HTLC fee charged by sender, in milli-satoshi
5812 void UnsignedChannelUpdate_set_fee_base_msat(LDKUnsignedChannelUpdate *this_ptr, uint32_t val);
5815 * The amount to fee multiplier, in micro-satoshi
5817 uint32_t UnsignedChannelUpdate_get_fee_proportional_millionths(const LDKUnsignedChannelUpdate *this_ptr);
5820 * The amount to fee multiplier, in micro-satoshi
5822 void UnsignedChannelUpdate_set_fee_proportional_millionths(LDKUnsignedChannelUpdate *this_ptr, uint32_t val);
5824 void ChannelUpdate_free(LDKChannelUpdate this_ptr);
5826 LDKChannelUpdate ChannelUpdate_clone(const LDKChannelUpdate *orig);
5829 * A signature of the channel update
5831 LDKSignature ChannelUpdate_get_signature(const LDKChannelUpdate *this_ptr);
5834 * A signature of the channel update
5836 void ChannelUpdate_set_signature(LDKChannelUpdate *this_ptr, LDKSignature val);
5839 * The actual channel update
5841 LDKUnsignedChannelUpdate ChannelUpdate_get_contents(const LDKChannelUpdate *this_ptr);
5844 * The actual channel update
5846 void ChannelUpdate_set_contents(LDKChannelUpdate *this_ptr, LDKUnsignedChannelUpdate val);
5848 MUST_USE_RES LDKChannelUpdate ChannelUpdate_new(LDKSignature signature_arg, LDKUnsignedChannelUpdate contents_arg);
5850 void QueryChannelRange_free(LDKQueryChannelRange this_ptr);
5852 LDKQueryChannelRange QueryChannelRange_clone(const LDKQueryChannelRange *orig);
5855 * The genesis hash of the blockchain being queried
5857 const uint8_t (*QueryChannelRange_get_chain_hash(const LDKQueryChannelRange *this_ptr))[32];
5860 * The genesis hash of the blockchain being queried
5862 void QueryChannelRange_set_chain_hash(LDKQueryChannelRange *this_ptr, LDKThirtyTwoBytes val);
5865 * The height of the first block for the channel UTXOs being queried
5867 uint32_t QueryChannelRange_get_first_blocknum(const LDKQueryChannelRange *this_ptr);
5870 * The height of the first block for the channel UTXOs being queried
5872 void QueryChannelRange_set_first_blocknum(LDKQueryChannelRange *this_ptr, uint32_t val);
5875 * The number of blocks to include in the query results
5877 uint32_t QueryChannelRange_get_number_of_blocks(const LDKQueryChannelRange *this_ptr);
5880 * The number of blocks to include in the query results
5882 void QueryChannelRange_set_number_of_blocks(LDKQueryChannelRange *this_ptr, uint32_t val);
5884 MUST_USE_RES LDKQueryChannelRange QueryChannelRange_new(LDKThirtyTwoBytes chain_hash_arg, uint32_t first_blocknum_arg, uint32_t number_of_blocks_arg);
5886 void ReplyChannelRange_free(LDKReplyChannelRange this_ptr);
5888 LDKReplyChannelRange ReplyChannelRange_clone(const LDKReplyChannelRange *orig);
5891 * The genesis hash of the blockchain being queried
5893 const uint8_t (*ReplyChannelRange_get_chain_hash(const LDKReplyChannelRange *this_ptr))[32];
5896 * The genesis hash of the blockchain being queried
5898 void ReplyChannelRange_set_chain_hash(LDKReplyChannelRange *this_ptr, LDKThirtyTwoBytes val);
5901 * The height of the first block in the range of the reply
5903 uint32_t ReplyChannelRange_get_first_blocknum(const LDKReplyChannelRange *this_ptr);
5906 * The height of the first block in the range of the reply
5908 void ReplyChannelRange_set_first_blocknum(LDKReplyChannelRange *this_ptr, uint32_t val);
5911 * The number of blocks included in the range of the reply
5913 uint32_t ReplyChannelRange_get_number_of_blocks(const LDKReplyChannelRange *this_ptr);
5916 * The number of blocks included in the range of the reply
5918 void ReplyChannelRange_set_number_of_blocks(LDKReplyChannelRange *this_ptr, uint32_t val);
5921 * Indicates if the query recipient maintains up-to-date channel
5922 * information for the chain_hash
5924 bool ReplyChannelRange_get_full_information(const LDKReplyChannelRange *this_ptr);
5927 * Indicates if the query recipient maintains up-to-date channel
5928 * information for the chain_hash
5930 void ReplyChannelRange_set_full_information(LDKReplyChannelRange *this_ptr, bool val);
5933 * The short_channel_ids in the channel range
5935 void ReplyChannelRange_set_short_channel_ids(LDKReplyChannelRange *this_ptr, LDKCVec_u64Z val);
5937 MUST_USE_RES LDKReplyChannelRange ReplyChannelRange_new(LDKThirtyTwoBytes chain_hash_arg, uint32_t first_blocknum_arg, uint32_t number_of_blocks_arg, bool full_information_arg, LDKCVec_u64Z short_channel_ids_arg);
5939 void QueryShortChannelIds_free(LDKQueryShortChannelIds this_ptr);
5941 LDKQueryShortChannelIds QueryShortChannelIds_clone(const LDKQueryShortChannelIds *orig);
5944 * The genesis hash of the blockchain being queried
5946 const uint8_t (*QueryShortChannelIds_get_chain_hash(const LDKQueryShortChannelIds *this_ptr))[32];
5949 * The genesis hash of the blockchain being queried
5951 void QueryShortChannelIds_set_chain_hash(LDKQueryShortChannelIds *this_ptr, LDKThirtyTwoBytes val);
5954 * The short_channel_ids that are being queried
5956 void QueryShortChannelIds_set_short_channel_ids(LDKQueryShortChannelIds *this_ptr, LDKCVec_u64Z val);
5958 MUST_USE_RES LDKQueryShortChannelIds QueryShortChannelIds_new(LDKThirtyTwoBytes chain_hash_arg, LDKCVec_u64Z short_channel_ids_arg);
5960 void ReplyShortChannelIdsEnd_free(LDKReplyShortChannelIdsEnd this_ptr);
5962 LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_clone(const LDKReplyShortChannelIdsEnd *orig);
5965 * The genesis hash of the blockchain that was queried
5967 const uint8_t (*ReplyShortChannelIdsEnd_get_chain_hash(const LDKReplyShortChannelIdsEnd *this_ptr))[32];
5970 * The genesis hash of the blockchain that was queried
5972 void ReplyShortChannelIdsEnd_set_chain_hash(LDKReplyShortChannelIdsEnd *this_ptr, LDKThirtyTwoBytes val);
5975 * Indicates if the query recipient maintains up-to-date channel
5976 * information for the chain_hash
5978 bool ReplyShortChannelIdsEnd_get_full_information(const LDKReplyShortChannelIdsEnd *this_ptr);
5981 * Indicates if the query recipient maintains up-to-date channel
5982 * information for the chain_hash
5984 void ReplyShortChannelIdsEnd_set_full_information(LDKReplyShortChannelIdsEnd *this_ptr, bool val);
5986 MUST_USE_RES LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_new(LDKThirtyTwoBytes chain_hash_arg, bool full_information_arg);
5988 void GossipTimestampFilter_free(LDKGossipTimestampFilter this_ptr);
5990 LDKGossipTimestampFilter GossipTimestampFilter_clone(const LDKGossipTimestampFilter *orig);
5993 * The genesis hash of the blockchain for channel and node information
5995 const uint8_t (*GossipTimestampFilter_get_chain_hash(const LDKGossipTimestampFilter *this_ptr))[32];
5998 * The genesis hash of the blockchain for channel and node information
6000 void GossipTimestampFilter_set_chain_hash(LDKGossipTimestampFilter *this_ptr, LDKThirtyTwoBytes val);
6003 * The starting unix timestamp
6005 uint32_t GossipTimestampFilter_get_first_timestamp(const LDKGossipTimestampFilter *this_ptr);
6008 * The starting unix timestamp
6010 void GossipTimestampFilter_set_first_timestamp(LDKGossipTimestampFilter *this_ptr, uint32_t val);
6013 * The range of information in seconds
6015 uint32_t GossipTimestampFilter_get_timestamp_range(const LDKGossipTimestampFilter *this_ptr);
6018 * The range of information in seconds
6020 void GossipTimestampFilter_set_timestamp_range(LDKGossipTimestampFilter *this_ptr, uint32_t val);
6022 MUST_USE_RES LDKGossipTimestampFilter GossipTimestampFilter_new(LDKThirtyTwoBytes chain_hash_arg, uint32_t first_timestamp_arg, uint32_t timestamp_range_arg);
6024 void ErrorAction_free(LDKErrorAction this_ptr);
6026 LDKErrorAction ErrorAction_clone(const LDKErrorAction *orig);
6028 void LightningError_free(LDKLightningError this_ptr);
6031 * A human-readable message describing the error
6033 LDKStr LightningError_get_err(const LDKLightningError *this_ptr);
6036 * A human-readable message describing the error
6038 void LightningError_set_err(LDKLightningError *this_ptr, LDKCVec_u8Z val);
6041 * The action which should be taken against the offending peer.
6043 LDKErrorAction LightningError_get_action(const LDKLightningError *this_ptr);
6046 * The action which should be taken against the offending peer.
6048 void LightningError_set_action(LDKLightningError *this_ptr, LDKErrorAction val);
6050 MUST_USE_RES LDKLightningError LightningError_new(LDKCVec_u8Z err_arg, LDKErrorAction action_arg);
6052 void CommitmentUpdate_free(LDKCommitmentUpdate this_ptr);
6054 LDKCommitmentUpdate CommitmentUpdate_clone(const LDKCommitmentUpdate *orig);
6057 * update_add_htlc messages which should be sent
6059 void CommitmentUpdate_set_update_add_htlcs(LDKCommitmentUpdate *this_ptr, LDKCVec_UpdateAddHTLCZ val);
6062 * update_fulfill_htlc messages which should be sent
6064 void CommitmentUpdate_set_update_fulfill_htlcs(LDKCommitmentUpdate *this_ptr, LDKCVec_UpdateFulfillHTLCZ val);
6067 * update_fail_htlc messages which should be sent
6069 void CommitmentUpdate_set_update_fail_htlcs(LDKCommitmentUpdate *this_ptr, LDKCVec_UpdateFailHTLCZ val);
6072 * update_fail_malformed_htlc messages which should be sent
6074 void CommitmentUpdate_set_update_fail_malformed_htlcs(LDKCommitmentUpdate *this_ptr, LDKCVec_UpdateFailMalformedHTLCZ val);
6077 * An update_fee message which should be sent
6079 LDKUpdateFee CommitmentUpdate_get_update_fee(const LDKCommitmentUpdate *this_ptr);
6082 * An update_fee message which should be sent
6084 void CommitmentUpdate_set_update_fee(LDKCommitmentUpdate *this_ptr, LDKUpdateFee val);
6087 * Finally, the commitment_signed message which should be sent
6089 LDKCommitmentSigned CommitmentUpdate_get_commitment_signed(const LDKCommitmentUpdate *this_ptr);
6092 * Finally, the commitment_signed message which should be sent
6094 void CommitmentUpdate_set_commitment_signed(LDKCommitmentUpdate *this_ptr, LDKCommitmentSigned val);
6096 MUST_USE_RES LDKCommitmentUpdate CommitmentUpdate_new(LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg, LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg, LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg, LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg, LDKUpdateFee update_fee_arg, LDKCommitmentSigned commitment_signed_arg);
6098 void HTLCFailChannelUpdate_free(LDKHTLCFailChannelUpdate this_ptr);
6100 LDKHTLCFailChannelUpdate HTLCFailChannelUpdate_clone(const LDKHTLCFailChannelUpdate *orig);
6103 * Calls the free function if one is set
6105 void ChannelMessageHandler_free(LDKChannelMessageHandler this_ptr);
6108 * Calls the free function if one is set
6110 void RoutingMessageHandler_free(LDKRoutingMessageHandler this_ptr);
6112 LDKCVec_u8Z AcceptChannel_write(const LDKAcceptChannel *obj);
6114 LDKAcceptChannel AcceptChannel_read(LDKu8slice ser);
6116 LDKCVec_u8Z AnnouncementSignatures_write(const LDKAnnouncementSignatures *obj);
6118 LDKAnnouncementSignatures AnnouncementSignatures_read(LDKu8slice ser);
6120 LDKCVec_u8Z ChannelReestablish_write(const LDKChannelReestablish *obj);
6122 LDKChannelReestablish ChannelReestablish_read(LDKu8slice ser);
6124 LDKCVec_u8Z ClosingSigned_write(const LDKClosingSigned *obj);
6126 LDKClosingSigned ClosingSigned_read(LDKu8slice ser);
6128 LDKCVec_u8Z CommitmentSigned_write(const LDKCommitmentSigned *obj);
6130 LDKCommitmentSigned CommitmentSigned_read(LDKu8slice ser);
6132 LDKCVec_u8Z FundingCreated_write(const LDKFundingCreated *obj);
6134 LDKFundingCreated FundingCreated_read(LDKu8slice ser);
6136 LDKCVec_u8Z FundingSigned_write(const LDKFundingSigned *obj);
6138 LDKFundingSigned FundingSigned_read(LDKu8slice ser);
6140 LDKCVec_u8Z FundingLocked_write(const LDKFundingLocked *obj);
6142 LDKFundingLocked FundingLocked_read(LDKu8slice ser);
6144 LDKCVec_u8Z Init_write(const LDKInit *obj);
6146 LDKInit Init_read(LDKu8slice ser);
6148 LDKCVec_u8Z OpenChannel_write(const LDKOpenChannel *obj);
6150 LDKOpenChannel OpenChannel_read(LDKu8slice ser);
6152 LDKCVec_u8Z RevokeAndACK_write(const LDKRevokeAndACK *obj);
6154 LDKRevokeAndACK RevokeAndACK_read(LDKu8slice ser);
6156 LDKCVec_u8Z Shutdown_write(const LDKShutdown *obj);
6158 LDKShutdown Shutdown_read(LDKu8slice ser);
6160 LDKCVec_u8Z UpdateFailHTLC_write(const LDKUpdateFailHTLC *obj);
6162 LDKUpdateFailHTLC UpdateFailHTLC_read(LDKu8slice ser);
6164 LDKCVec_u8Z UpdateFailMalformedHTLC_write(const LDKUpdateFailMalformedHTLC *obj);
6166 LDKUpdateFailMalformedHTLC UpdateFailMalformedHTLC_read(LDKu8slice ser);
6168 LDKCVec_u8Z UpdateFee_write(const LDKUpdateFee *obj);
6170 LDKUpdateFee UpdateFee_read(LDKu8slice ser);
6172 LDKCVec_u8Z UpdateFulfillHTLC_write(const LDKUpdateFulfillHTLC *obj);
6174 LDKUpdateFulfillHTLC UpdateFulfillHTLC_read(LDKu8slice ser);
6176 LDKCVec_u8Z UpdateAddHTLC_write(const LDKUpdateAddHTLC *obj);
6178 LDKUpdateAddHTLC UpdateAddHTLC_read(LDKu8slice ser);
6180 LDKCVec_u8Z Ping_write(const LDKPing *obj);
6182 LDKPing Ping_read(LDKu8slice ser);
6184 LDKCVec_u8Z Pong_write(const LDKPong *obj);
6186 LDKPong Pong_read(LDKu8slice ser);
6188 LDKCVec_u8Z UnsignedChannelAnnouncement_write(const LDKUnsignedChannelAnnouncement *obj);
6190 LDKUnsignedChannelAnnouncement UnsignedChannelAnnouncement_read(LDKu8slice ser);
6192 LDKCVec_u8Z ChannelAnnouncement_write(const LDKChannelAnnouncement *obj);
6194 LDKChannelAnnouncement ChannelAnnouncement_read(LDKu8slice ser);
6196 LDKCVec_u8Z UnsignedChannelUpdate_write(const LDKUnsignedChannelUpdate *obj);
6198 LDKUnsignedChannelUpdate UnsignedChannelUpdate_read(LDKu8slice ser);
6200 LDKCVec_u8Z ChannelUpdate_write(const LDKChannelUpdate *obj);
6202 LDKChannelUpdate ChannelUpdate_read(LDKu8slice ser);
6204 LDKCVec_u8Z ErrorMessage_write(const LDKErrorMessage *obj);
6206 LDKErrorMessage ErrorMessage_read(LDKu8slice ser);
6208 LDKCVec_u8Z UnsignedNodeAnnouncement_write(const LDKUnsignedNodeAnnouncement *obj);
6210 LDKUnsignedNodeAnnouncement UnsignedNodeAnnouncement_read(LDKu8slice ser);
6212 LDKCVec_u8Z NodeAnnouncement_write(const LDKNodeAnnouncement *obj);
6214 LDKNodeAnnouncement NodeAnnouncement_read(LDKu8slice ser);
6216 LDKQueryShortChannelIds QueryShortChannelIds_read(LDKu8slice ser);
6218 LDKCVec_u8Z QueryShortChannelIds_write(const LDKQueryShortChannelIds *obj);
6220 LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_read(LDKu8slice ser);
6222 LDKCVec_u8Z ReplyShortChannelIdsEnd_write(const LDKReplyShortChannelIdsEnd *obj);
6224 LDKQueryChannelRange QueryChannelRange_read(LDKu8slice ser);
6226 LDKCVec_u8Z QueryChannelRange_write(const LDKQueryChannelRange *obj);
6228 LDKReplyChannelRange ReplyChannelRange_read(LDKu8slice ser);
6230 LDKCVec_u8Z ReplyChannelRange_write(const LDKReplyChannelRange *obj);
6232 LDKGossipTimestampFilter GossipTimestampFilter_read(LDKu8slice ser);
6234 LDKCVec_u8Z GossipTimestampFilter_write(const LDKGossipTimestampFilter *obj);
6236 void MessageHandler_free(LDKMessageHandler this_ptr);
6239 * A message handler which handles messages specific to channels. Usually this is just a
6240 * ChannelManager object.
6242 const LDKChannelMessageHandler *MessageHandler_get_chan_handler(const LDKMessageHandler *this_ptr);
6245 * A message handler which handles messages specific to channels. Usually this is just a
6246 * ChannelManager object.
6248 void MessageHandler_set_chan_handler(LDKMessageHandler *this_ptr, LDKChannelMessageHandler val);
6251 * A message handler which handles messages updating our knowledge of the network channel
6252 * graph. Usually this is just a NetGraphMsgHandlerMonitor object.
6254 const LDKRoutingMessageHandler *MessageHandler_get_route_handler(const LDKMessageHandler *this_ptr);
6257 * A message handler which handles messages updating our knowledge of the network channel
6258 * graph. Usually this is just a NetGraphMsgHandlerMonitor object.
6260 void MessageHandler_set_route_handler(LDKMessageHandler *this_ptr, LDKRoutingMessageHandler val);
6262 MUST_USE_RES LDKMessageHandler MessageHandler_new(LDKChannelMessageHandler chan_handler_arg, LDKRoutingMessageHandler route_handler_arg);
6264 LDKSocketDescriptor SocketDescriptor_clone(const LDKSocketDescriptor *orig);
6267 * Calls the free function if one is set
6269 void SocketDescriptor_free(LDKSocketDescriptor this_ptr);
6271 void PeerHandleError_free(LDKPeerHandleError this_ptr);
6274 * Used to indicate that we probably can't make any future connections to this peer, implying
6275 * we should go ahead and force-close any channels we have with it.
6277 bool PeerHandleError_get_no_connection_possible(const LDKPeerHandleError *this_ptr);
6280 * Used to indicate that we probably can't make any future connections to this peer, implying
6281 * we should go ahead and force-close any channels we have with it.
6283 void PeerHandleError_set_no_connection_possible(LDKPeerHandleError *this_ptr, bool val);
6285 MUST_USE_RES LDKPeerHandleError PeerHandleError_new(bool no_connection_possible_arg);
6287 void PeerManager_free(LDKPeerManager this_ptr);
6290 * Constructs a new PeerManager with the given message handlers and node_id secret key
6291 * ephemeral_random_data is used to derive per-connection ephemeral keys and must be
6292 * cryptographically secure random bytes.
6294 MUST_USE_RES LDKPeerManager PeerManager_new(LDKMessageHandler message_handler, LDKSecretKey our_node_secret, const uint8_t (*ephemeral_random_data)[32], LDKLogger logger);
6297 * Get the list of node ids for peers which have completed the initial handshake.
6299 * For outbound connections, this will be the same as the their_node_id parameter passed in to
6300 * new_outbound_connection, however entries will only appear once the initial handshake has
6301 * completed and we are sure the remote peer has the private key for the given node_id.
6303 MUST_USE_RES LDKCVec_PublicKeyZ PeerManager_get_peer_node_ids(const LDKPeerManager *this_arg);
6306 * Indicates a new outbound connection has been established to a node with the given node_id.
6307 * Note that if an Err is returned here you MUST NOT call socket_disconnected for the new
6308 * descriptor but must disconnect the connection immediately.
6310 * Returns a small number of bytes to send to the remote node (currently always 50).
6312 * Panics if descriptor is duplicative with some other descriptor which has not yet had a
6313 * socket_disconnected().
6315 MUST_USE_RES LDKCResult_CVec_u8ZPeerHandleErrorZ PeerManager_new_outbound_connection(const LDKPeerManager *this_arg, LDKPublicKey their_node_id, LDKSocketDescriptor descriptor);
6318 * Indicates a new inbound connection has been established.
6320 * May refuse the connection by returning an Err, but will never write bytes to the remote end
6321 * (outbound connector always speaks first). Note that if an Err is returned here you MUST NOT
6322 * call socket_disconnected for the new descriptor but must disconnect the connection
6325 * Panics if descriptor is duplicative with some other descriptor which has not yet had
6326 * socket_disconnected called.
6328 MUST_USE_RES LDKCResult_NonePeerHandleErrorZ PeerManager_new_inbound_connection(const LDKPeerManager *this_arg, LDKSocketDescriptor descriptor);
6331 * Indicates that there is room to write data to the given socket descriptor.
6333 * May return an Err to indicate that the connection should be closed.
6335 * Will most likely call send_data on the descriptor passed in (or the descriptor handed into
6336 * new_*\\_connection) before returning. Thus, be very careful with reentrancy issues! The
6337 * invariants around calling write_buffer_space_avail in case a write did not fully complete
6338 * must still hold - be ready to call write_buffer_space_avail again if a write call generated
6339 * here isn't sufficient! Panics if the descriptor was not previously registered in a
6340 * new_\\*_connection event.
6342 MUST_USE_RES LDKCResult_NonePeerHandleErrorZ PeerManager_write_buffer_space_avail(const LDKPeerManager *this_arg, LDKSocketDescriptor *descriptor);
6345 * Indicates that data was read from the given socket descriptor.
6347 * May return an Err to indicate that the connection should be closed.
6349 * Will *not* call back into send_data on any descriptors to avoid reentrancy complexity.
6350 * Thus, however, you almost certainly want to call process_events() after any read_event to
6351 * generate send_data calls to handle responses.
6353 * If Ok(true) is returned, further read_events should not be triggered until a send_data call
6354 * on this file descriptor has resume_read set (preventing DoS issues in the send buffer).
6356 * Panics if the descriptor was not previously registered in a new_*_connection event.
6358 MUST_USE_RES LDKCResult_boolPeerHandleErrorZ PeerManager_read_event(const LDKPeerManager *this_arg, LDKSocketDescriptor *peer_descriptor, LDKu8slice data);
6361 * Checks for any events generated by our handlers and processes them. Includes sending most
6362 * response messages as well as messages generated by calls to handler functions directly (eg
6363 * functions like ChannelManager::process_pending_htlc_forward or send_payment).
6365 void PeerManager_process_events(const LDKPeerManager *this_arg);
6368 * Indicates that the given socket descriptor's connection is now closed.
6370 * This must only be called if the socket has been disconnected by the peer or your own
6371 * decision to disconnect it and must NOT be called in any case where other parts of this
6372 * library (eg PeerHandleError, explicit disconnect_socket calls) instruct you to disconnect
6375 * Panics if the descriptor was not previously registered in a successful new_*_connection event.
6377 void PeerManager_socket_disconnected(const LDKPeerManager *this_arg, const LDKSocketDescriptor *descriptor);
6380 * This function should be called roughly once every 30 seconds.
6381 * It will send pings to each peer and disconnect those which did not respond to the last round of pings.
6382 * Will most likely call send_data on all of the registered descriptors, thus, be very careful with reentrancy issues!
6384 void PeerManager_timer_tick_occured(const LDKPeerManager *this_arg);
6387 * Build the commitment secret from the seed and the commitment number
6389 LDKThirtyTwoBytes build_commitment_secret(const uint8_t (*commitment_seed)[32], uint64_t idx);
6392 * Derives a per-commitment-transaction private key (eg an htlc key or delayed_payment key)
6393 * from the base secret and the per_commitment_point.
6395 * Note that this is infallible iff we trust that at least one of the two input keys are randomly
6396 * generated (ie our own).
6398 LDKCResult_SecretKeySecpErrorZ derive_private_key(LDKPublicKey per_commitment_point, const uint8_t (*base_secret)[32]);
6401 * Derives a per-commitment-transaction public key (eg an htlc key or a delayed_payment key)
6402 * from the base point and the per_commitment_key. This is the public equivalent of
6403 * derive_private_key - using only public keys to derive a public key instead of private keys.
6405 * Note that this is infallible iff we trust that at least one of the two input keys are randomly
6406 * generated (ie our own).
6408 LDKCResult_PublicKeySecpErrorZ derive_public_key(LDKPublicKey per_commitment_point, LDKPublicKey base_point);
6411 * Derives a per-commitment-transaction revocation key from its constituent parts.
6413 * Only the cheating participant owns a valid witness to propagate a revoked
6414 * commitment transaction, thus per_commitment_secret always come from cheater
6415 * and revocation_base_secret always come from punisher, which is the broadcaster
6416 * of the transaction spending with this key knowledge.
6418 * Note that this is infallible iff we trust that at least one of the two input keys are randomly
6419 * generated (ie our own).
6421 LDKCResult_SecretKeySecpErrorZ derive_private_revocation_key(const uint8_t (*per_commitment_secret)[32], const uint8_t (*countersignatory_revocation_base_secret)[32]);
6424 * Derives a per-commitment-transaction revocation public key from its constituent parts. This is
6425 * the public equivalend of derive_private_revocation_key - using only public keys to derive a
6426 * public key instead of private keys.
6428 * Only the cheating participant owns a valid witness to propagate a revoked
6429 * commitment transaction, thus per_commitment_point always come from cheater
6430 * and revocation_base_point always come from punisher, which is the broadcaster
6431 * of the transaction spending with this key knowledge.
6433 * Note that this is infallible iff we trust that at least one of the two input keys are randomly
6434 * generated (ie our own).
6436 LDKCResult_PublicKeySecpErrorZ derive_public_revocation_key(LDKPublicKey per_commitment_point, LDKPublicKey countersignatory_revocation_base_point);
6438 void TxCreationKeys_free(LDKTxCreationKeys this_ptr);
6440 LDKTxCreationKeys TxCreationKeys_clone(const LDKTxCreationKeys *orig);
6443 * The broadcaster's per-commitment public key which was used to derive the other keys.
6445 LDKPublicKey TxCreationKeys_get_per_commitment_point(const LDKTxCreationKeys *this_ptr);
6448 * The broadcaster's per-commitment public key which was used to derive the other keys.
6450 void TxCreationKeys_set_per_commitment_point(LDKTxCreationKeys *this_ptr, LDKPublicKey val);
6453 * The revocation key which is used to allow the broadcaster of the commitment
6454 * transaction to provide their counterparty the ability to punish them if they broadcast
6457 LDKPublicKey TxCreationKeys_get_revocation_key(const LDKTxCreationKeys *this_ptr);
6460 * The revocation key which is used to allow the broadcaster of the commitment
6461 * transaction to provide their counterparty the ability to punish them if they broadcast
6464 void TxCreationKeys_set_revocation_key(LDKTxCreationKeys *this_ptr, LDKPublicKey val);
6467 * Broadcaster's HTLC Key
6469 LDKPublicKey TxCreationKeys_get_broadcaster_htlc_key(const LDKTxCreationKeys *this_ptr);
6472 * Broadcaster's HTLC Key
6474 void TxCreationKeys_set_broadcaster_htlc_key(LDKTxCreationKeys *this_ptr, LDKPublicKey val);
6477 * Countersignatory's HTLC Key
6479 LDKPublicKey TxCreationKeys_get_countersignatory_htlc_key(const LDKTxCreationKeys *this_ptr);
6482 * Countersignatory's HTLC Key
6484 void TxCreationKeys_set_countersignatory_htlc_key(LDKTxCreationKeys *this_ptr, LDKPublicKey val);
6487 * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
6489 LDKPublicKey TxCreationKeys_get_broadcaster_delayed_payment_key(const LDKTxCreationKeys *this_ptr);
6492 * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
6494 void TxCreationKeys_set_broadcaster_delayed_payment_key(LDKTxCreationKeys *this_ptr, LDKPublicKey val);
6496 MUST_USE_RES LDKTxCreationKeys TxCreationKeys_new(LDKPublicKey per_commitment_point_arg, LDKPublicKey revocation_key_arg, LDKPublicKey broadcaster_htlc_key_arg, LDKPublicKey countersignatory_htlc_key_arg, LDKPublicKey broadcaster_delayed_payment_key_arg);
6498 LDKCVec_u8Z TxCreationKeys_write(const LDKTxCreationKeys *obj);
6500 LDKTxCreationKeys TxCreationKeys_read(LDKu8slice ser);
6502 void PreCalculatedTxCreationKeys_free(LDKPreCalculatedTxCreationKeys this_ptr);
6504 LDKPreCalculatedTxCreationKeys PreCalculatedTxCreationKeys_clone(const LDKPreCalculatedTxCreationKeys *orig);
6507 * Create a new PreCalculatedTxCreationKeys from TxCreationKeys
6509 MUST_USE_RES LDKPreCalculatedTxCreationKeys PreCalculatedTxCreationKeys_new(LDKTxCreationKeys keys);
6512 * The pre-calculated transaction creation public keys.
6513 * An external validating signer should not trust these keys.
6515 MUST_USE_RES LDKTxCreationKeys PreCalculatedTxCreationKeys_trust_key_derivation(const LDKPreCalculatedTxCreationKeys *this_arg);
6518 * The transaction per-commitment point
6520 MUST_USE_RES LDKPublicKey PreCalculatedTxCreationKeys_per_commitment_point(const LDKPreCalculatedTxCreationKeys *this_arg);
6522 void ChannelPublicKeys_free(LDKChannelPublicKeys this_ptr);
6524 LDKChannelPublicKeys ChannelPublicKeys_clone(const LDKChannelPublicKeys *orig);
6527 * The public key which is used to sign all commitment transactions, as it appears in the
6528 * on-chain channel lock-in 2-of-2 multisig output.
6530 LDKPublicKey ChannelPublicKeys_get_funding_pubkey(const LDKChannelPublicKeys *this_ptr);
6533 * The public key which is used to sign all commitment transactions, as it appears in the
6534 * on-chain channel lock-in 2-of-2 multisig output.
6536 void ChannelPublicKeys_set_funding_pubkey(LDKChannelPublicKeys *this_ptr, LDKPublicKey val);
6539 * The base point which is used (with derive_public_revocation_key) to derive per-commitment
6540 * revocation keys. This is combined with the per-commitment-secret generated by the
6541 * counterparty to create a secret which the counterparty can reveal to revoke previous
6544 LDKPublicKey ChannelPublicKeys_get_revocation_basepoint(const LDKChannelPublicKeys *this_ptr);
6547 * The base point which is used (with derive_public_revocation_key) to derive per-commitment
6548 * revocation keys. This is combined with the per-commitment-secret generated by the
6549 * counterparty to create a secret which the counterparty can reveal to revoke previous
6552 void ChannelPublicKeys_set_revocation_basepoint(LDKChannelPublicKeys *this_ptr, LDKPublicKey val);
6555 * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
6556 * spendable primary channel balance on the broadcaster's commitment transaction. This key is
6557 * static across every commitment transaction.
6559 LDKPublicKey ChannelPublicKeys_get_payment_point(const LDKChannelPublicKeys *this_ptr);
6562 * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
6563 * spendable primary channel balance on the broadcaster's commitment transaction. This key is
6564 * static across every commitment transaction.
6566 void ChannelPublicKeys_set_payment_point(LDKChannelPublicKeys *this_ptr, LDKPublicKey val);
6569 * The base point which is used (with derive_public_key) to derive a per-commitment payment
6570 * public key which receives non-HTLC-encumbered funds which are only available for spending
6571 * after some delay (or can be claimed via the revocation path).
6573 LDKPublicKey ChannelPublicKeys_get_delayed_payment_basepoint(const LDKChannelPublicKeys *this_ptr);
6576 * The base point which is used (with derive_public_key) to derive a per-commitment payment
6577 * public key which receives non-HTLC-encumbered funds which are only available for spending
6578 * after some delay (or can be claimed via the revocation path).
6580 void ChannelPublicKeys_set_delayed_payment_basepoint(LDKChannelPublicKeys *this_ptr, LDKPublicKey val);
6583 * The base point which is used (with derive_public_key) to derive a per-commitment public key
6584 * which is used to encumber HTLC-in-flight outputs.
6586 LDKPublicKey ChannelPublicKeys_get_htlc_basepoint(const LDKChannelPublicKeys *this_ptr);
6589 * The base point which is used (with derive_public_key) to derive a per-commitment public key
6590 * which is used to encumber HTLC-in-flight outputs.
6592 void ChannelPublicKeys_set_htlc_basepoint(LDKChannelPublicKeys *this_ptr, LDKPublicKey val);
6594 MUST_USE_RES LDKChannelPublicKeys ChannelPublicKeys_new(LDKPublicKey funding_pubkey_arg, LDKPublicKey revocation_basepoint_arg, LDKPublicKey payment_point_arg, LDKPublicKey delayed_payment_basepoint_arg, LDKPublicKey htlc_basepoint_arg);
6596 LDKCVec_u8Z ChannelPublicKeys_write(const LDKChannelPublicKeys *obj);
6598 LDKChannelPublicKeys ChannelPublicKeys_read(LDKu8slice ser);
6601 * Create a new TxCreationKeys from channel base points and the per-commitment point
6603 MUST_USE_RES LDKCResult_TxCreationKeysSecpErrorZ TxCreationKeys_derive_new(LDKPublicKey per_commitment_point, LDKPublicKey broadcaster_delayed_payment_base, LDKPublicKey broadcaster_htlc_base, LDKPublicKey countersignatory_revocation_base, LDKPublicKey countersignatory_htlc_base);
6606 * A script either spendable by the revocation
6607 * key or the broadcaster_delayed_payment_key and satisfying the relative-locktime OP_CSV constrain.
6608 * Encumbering a `to_holder` output on a commitment transaction or 2nd-stage HTLC transactions.
6610 LDKCVec_u8Z get_revokeable_redeemscript(LDKPublicKey revocation_key, uint16_t contest_delay, LDKPublicKey broadcaster_delayed_payment_key);
6612 void HTLCOutputInCommitment_free(LDKHTLCOutputInCommitment this_ptr);
6614 LDKHTLCOutputInCommitment HTLCOutputInCommitment_clone(const LDKHTLCOutputInCommitment *orig);
6617 * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
6618 * Note that this is not the same as whether it is ountbound *from us*. To determine that you
6619 * need to compare this value to whether the commitment transaction in question is that of
6620 * the counterparty or our own.
6622 bool HTLCOutputInCommitment_get_offered(const LDKHTLCOutputInCommitment *this_ptr);
6625 * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
6626 * Note that this is not the same as whether it is ountbound *from us*. To determine that you
6627 * need to compare this value to whether the commitment transaction in question is that of
6628 * the counterparty or our own.
6630 void HTLCOutputInCommitment_set_offered(LDKHTLCOutputInCommitment *this_ptr, bool val);
6633 * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
6634 * this divided by 1000.
6636 uint64_t HTLCOutputInCommitment_get_amount_msat(const LDKHTLCOutputInCommitment *this_ptr);
6639 * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
6640 * this divided by 1000.
6642 void HTLCOutputInCommitment_set_amount_msat(LDKHTLCOutputInCommitment *this_ptr, uint64_t val);
6645 * The CLTV lock-time at which this HTLC expires.
6647 uint32_t HTLCOutputInCommitment_get_cltv_expiry(const LDKHTLCOutputInCommitment *this_ptr);
6650 * The CLTV lock-time at which this HTLC expires.
6652 void HTLCOutputInCommitment_set_cltv_expiry(LDKHTLCOutputInCommitment *this_ptr, uint32_t val);
6655 * The hash of the preimage which unlocks this HTLC.
6657 const uint8_t (*HTLCOutputInCommitment_get_payment_hash(const LDKHTLCOutputInCommitment *this_ptr))[32];
6660 * The hash of the preimage which unlocks this HTLC.
6662 void HTLCOutputInCommitment_set_payment_hash(LDKHTLCOutputInCommitment *this_ptr, LDKThirtyTwoBytes val);
6664 LDKCVec_u8Z HTLCOutputInCommitment_write(const LDKHTLCOutputInCommitment *obj);
6666 LDKHTLCOutputInCommitment HTLCOutputInCommitment_read(LDKu8slice ser);
6669 * Gets the witness redeemscript for an HTLC output in a commitment transaction. Note that htlc
6670 * does not need to have its previous_output_index filled.
6672 LDKCVec_u8Z get_htlc_redeemscript(const LDKHTLCOutputInCommitment *htlc, const LDKTxCreationKeys *keys);
6675 * Gets the redeemscript for a funding output from the two funding public keys.
6676 * Note that the order of funding public keys does not matter.
6678 LDKCVec_u8Z make_funding_redeemscript(LDKPublicKey broadcaster, LDKPublicKey countersignatory);
6681 * panics if htlc.transaction_output_index.is_none()!
6683 LDKTransaction build_htlc_transaction(const uint8_t (*prev_hash)[32], uint32_t feerate_per_kw, uint16_t contest_delay, const LDKHTLCOutputInCommitment *htlc, LDKPublicKey broadcaster_delayed_payment_key, LDKPublicKey revocation_key);
6685 void HolderCommitmentTransaction_free(LDKHolderCommitmentTransaction this_ptr);
6687 LDKHolderCommitmentTransaction HolderCommitmentTransaction_clone(const LDKHolderCommitmentTransaction *orig);
6690 * The commitment transaction itself, in unsigned form.
6692 LDKTransaction HolderCommitmentTransaction_get_unsigned_tx(const LDKHolderCommitmentTransaction *this_ptr);
6695 * The commitment transaction itself, in unsigned form.
6697 void HolderCommitmentTransaction_set_unsigned_tx(LDKHolderCommitmentTransaction *this_ptr, LDKTransaction val);
6700 * Our counterparty's signature for the transaction, above.
6702 LDKSignature HolderCommitmentTransaction_get_counterparty_sig(const LDKHolderCommitmentTransaction *this_ptr);
6705 * Our counterparty's signature for the transaction, above.
6707 void HolderCommitmentTransaction_set_counterparty_sig(LDKHolderCommitmentTransaction *this_ptr, LDKSignature val);
6710 * The feerate paid per 1000-weight-unit in this commitment transaction. This value is
6711 * controlled by the channel initiator.
6713 uint32_t HolderCommitmentTransaction_get_feerate_per_kw(const LDKHolderCommitmentTransaction *this_ptr);
6716 * The feerate paid per 1000-weight-unit in this commitment transaction. This value is
6717 * controlled by the channel initiator.
6719 void HolderCommitmentTransaction_set_feerate_per_kw(LDKHolderCommitmentTransaction *this_ptr, uint32_t val);
6722 * The HTLCs and counterparty htlc signatures which were included in this commitment transaction.
6724 * Note that this includes all HTLCs, including ones which were considered dust and not
6725 * actually included in the transaction as it appears on-chain, but who's value is burned as
6726 * fees and not included in the to_holder or to_counterparty outputs.
6728 * The counterparty HTLC signatures in the second element will always be set for non-dust HTLCs, ie
6729 * those for which transaction_output_index.is_some().
6731 void HolderCommitmentTransaction_set_per_htlc(LDKHolderCommitmentTransaction *this_ptr, LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ val);
6734 * Generate a new HolderCommitmentTransaction based on a raw commitment transaction,
6735 * counterparty signature and both parties keys.
6737 * The unsigned transaction outputs must be consistent with htlc_data. This function
6738 * only checks that the shape and amounts are consistent, but does not check the scriptPubkey.
6740 MUST_USE_RES LDKHolderCommitmentTransaction HolderCommitmentTransaction_new_missing_holder_sig(LDKTransaction unsigned_tx, LDKSignature counterparty_sig, LDKPublicKey holder_funding_key, LDKPublicKey counterparty_funding_key, LDKTxCreationKeys keys, uint32_t feerate_per_kw, LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ htlc_data);
6743 * The pre-calculated transaction creation public keys.
6744 * An external validating signer should not trust these keys.
6746 MUST_USE_RES LDKTxCreationKeys HolderCommitmentTransaction_trust_key_derivation(const LDKHolderCommitmentTransaction *this_arg);
6749 * Get the txid of the holder commitment transaction contained in this
6750 * HolderCommitmentTransaction
6752 MUST_USE_RES LDKThirtyTwoBytes HolderCommitmentTransaction_txid(const LDKHolderCommitmentTransaction *this_arg);
6755 * Gets holder signature for the contained commitment transaction given holder funding private key.
6757 * Funding key is your key included in the 2-2 funding_outpoint lock. Should be provided
6758 * by your ChannelKeys.
6759 * Funding redeemscript is script locking funding_outpoint. This is the mutlsig script
6760 * between your own funding key and your counterparty's. Currently, this is provided in
6761 * ChannelKeys::sign_holder_commitment() calls directly.
6762 * Channel value is amount locked in funding_outpoint.
6764 MUST_USE_RES LDKSignature HolderCommitmentTransaction_get_holder_sig(const LDKHolderCommitmentTransaction *this_arg, const uint8_t (*funding_key)[32], LDKu8slice funding_redeemscript, uint64_t channel_value_satoshis);
6767 * Get a signature for each HTLC which was included in the commitment transaction (ie for
6768 * which HTLCOutputInCommitment::transaction_output_index.is_some()).
6770 * The returned Vec has one entry for each HTLC, and in the same order. For HTLCs which were
6771 * considered dust and not included, a None entry exists, for all others a signature is
6774 MUST_USE_RES LDKCResult_CVec_SignatureZNoneZ HolderCommitmentTransaction_get_htlc_sigs(const LDKHolderCommitmentTransaction *this_arg, const uint8_t (*htlc_base_key)[32], uint16_t counterparty_selected_contest_delay);
6776 LDKCVec_u8Z HolderCommitmentTransaction_write(const LDKHolderCommitmentTransaction *obj);
6778 LDKHolderCommitmentTransaction HolderCommitmentTransaction_read(LDKu8slice ser);
6780 void InitFeatures_free(LDKInitFeatures this_ptr);
6782 void NodeFeatures_free(LDKNodeFeatures this_ptr);
6784 void ChannelFeatures_free(LDKChannelFeatures this_ptr);
6786 void RouteHop_free(LDKRouteHop this_ptr);
6788 LDKRouteHop RouteHop_clone(const LDKRouteHop *orig);
6791 * The node_id of the node at this hop.
6793 LDKPublicKey RouteHop_get_pubkey(const LDKRouteHop *this_ptr);
6796 * The node_id of the node at this hop.
6798 void RouteHop_set_pubkey(LDKRouteHop *this_ptr, LDKPublicKey val);
6801 * The node_announcement features of the node at this hop. For the last hop, these may be
6802 * amended to match the features present in the invoice this node generated.
6804 LDKNodeFeatures RouteHop_get_node_features(const LDKRouteHop *this_ptr);
6807 * The node_announcement features of the node at this hop. For the last hop, these may be
6808 * amended to match the features present in the invoice this node generated.
6810 void RouteHop_set_node_features(LDKRouteHop *this_ptr, LDKNodeFeatures val);
6813 * The channel that should be used from the previous hop to reach this node.
6815 uint64_t RouteHop_get_short_channel_id(const LDKRouteHop *this_ptr);
6818 * The channel that should be used from the previous hop to reach this node.
6820 void RouteHop_set_short_channel_id(LDKRouteHop *this_ptr, uint64_t val);
6823 * The channel_announcement features of the channel that should be used from the previous hop
6824 * to reach this node.
6826 LDKChannelFeatures RouteHop_get_channel_features(const LDKRouteHop *this_ptr);
6829 * The channel_announcement features of the channel that should be used from the previous hop
6830 * to reach this node.
6832 void RouteHop_set_channel_features(LDKRouteHop *this_ptr, LDKChannelFeatures val);
6835 * The fee taken on this hop. For the last hop, this should be the full value of the payment.
6837 uint64_t RouteHop_get_fee_msat(const LDKRouteHop *this_ptr);
6840 * The fee taken on this hop. For the last hop, this should be the full value of the payment.
6842 void RouteHop_set_fee_msat(LDKRouteHop *this_ptr, uint64_t val);
6845 * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
6846 * expected at the destination, in excess of the current block height.
6848 uint32_t RouteHop_get_cltv_expiry_delta(const LDKRouteHop *this_ptr);
6851 * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
6852 * expected at the destination, in excess of the current block height.
6854 void RouteHop_set_cltv_expiry_delta(LDKRouteHop *this_ptr, uint32_t val);
6856 MUST_USE_RES LDKRouteHop RouteHop_new(LDKPublicKey pubkey_arg, LDKNodeFeatures node_features_arg, uint64_t short_channel_id_arg, LDKChannelFeatures channel_features_arg, uint64_t fee_msat_arg, uint32_t cltv_expiry_delta_arg);
6858 void Route_free(LDKRoute this_ptr);
6860 LDKRoute Route_clone(const LDKRoute *orig);
6863 * The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the
6864 * last RouteHop in each path must be the same.
6865 * Each entry represents a list of hops, NOT INCLUDING our own, where the last hop is the
6866 * destination. Thus, this must always be at least length one. While the maximum length of any
6867 * given path is variable, keeping the length of any path to less than 20 should currently
6868 * ensure it is viable.
6870 void Route_set_paths(LDKRoute *this_ptr, LDKCVec_CVec_RouteHopZZ val);
6872 MUST_USE_RES LDKRoute Route_new(LDKCVec_CVec_RouteHopZZ paths_arg);
6874 LDKCVec_u8Z Route_write(const LDKRoute *obj);
6876 LDKRoute Route_read(LDKu8slice ser);
6878 void RouteHint_free(LDKRouteHint this_ptr);
6880 LDKRouteHint RouteHint_clone(const LDKRouteHint *orig);
6883 * The node_id of the non-target end of the route
6885 LDKPublicKey RouteHint_get_src_node_id(const LDKRouteHint *this_ptr);
6888 * The node_id of the non-target end of the route
6890 void RouteHint_set_src_node_id(LDKRouteHint *this_ptr, LDKPublicKey val);
6893 * The short_channel_id of this channel
6895 uint64_t RouteHint_get_short_channel_id(const LDKRouteHint *this_ptr);
6898 * The short_channel_id of this channel
6900 void RouteHint_set_short_channel_id(LDKRouteHint *this_ptr, uint64_t val);
6903 * The fees which must be paid to use this channel
6905 LDKRoutingFees RouteHint_get_fees(const LDKRouteHint *this_ptr);
6908 * The fees which must be paid to use this channel
6910 void RouteHint_set_fees(LDKRouteHint *this_ptr, LDKRoutingFees val);
6913 * The difference in CLTV values between this node and the next node.
6915 uint16_t RouteHint_get_cltv_expiry_delta(const LDKRouteHint *this_ptr);
6918 * The difference in CLTV values between this node and the next node.
6920 void RouteHint_set_cltv_expiry_delta(LDKRouteHint *this_ptr, uint16_t val);
6923 * The minimum value, in msat, which must be relayed to the next hop.
6925 uint64_t RouteHint_get_htlc_minimum_msat(const LDKRouteHint *this_ptr);
6928 * The minimum value, in msat, which must be relayed to the next hop.
6930 void RouteHint_set_htlc_minimum_msat(LDKRouteHint *this_ptr, uint64_t val);
6932 MUST_USE_RES LDKRouteHint RouteHint_new(LDKPublicKey src_node_id_arg, uint64_t short_channel_id_arg, LDKRoutingFees fees_arg, uint16_t cltv_expiry_delta_arg, uint64_t htlc_minimum_msat_arg);
6935 * Gets a route from us to the given target node.
6937 * Extra routing hops between known nodes and the target will be used if they are included in
6940 * If some channels aren't announced, it may be useful to fill in a first_hops with the
6941 * results from a local ChannelManager::list_usable_channels() call. If it is filled in, our
6942 * view of our local channels (from net_graph_msg_handler) will be ignored, and only those in first_hops
6945 * Panics if first_hops contains channels without short_channel_ids
6946 * (ChannelManager::list_usable_channels will never include such channels).
6948 * The fees on channels from us to next-hops are ignored (as they are assumed to all be
6949 * equal), however the enabled/disabled bit on such channels as well as the htlc_minimum_msat
6950 * *is* checked as they may change based on the receiving node.
6952 LDKCResult_RouteLightningErrorZ get_route(LDKPublicKey our_node_id, const LDKNetworkGraph *network, LDKPublicKey target, LDKCVec_ChannelDetailsZ *first_hops, LDKCVec_RouteHintZ last_hops, uint64_t final_value_msat, uint32_t final_cltv, LDKLogger logger);
6954 void NetworkGraph_free(LDKNetworkGraph this_ptr);
6956 void LockedNetworkGraph_free(LDKLockedNetworkGraph this_ptr);
6958 void NetGraphMsgHandler_free(LDKNetGraphMsgHandler this_ptr);
6961 * Creates a new tracker of the actual state of the network of channels and nodes,
6962 * assuming a fresh network graph.
6963 * Chain monitor is used to make sure announced channels exist on-chain,
6964 * channel data is correct, and that the announcement is signed with
6965 * channel owners' keys.
6967 MUST_USE_RES LDKNetGraphMsgHandler NetGraphMsgHandler_new(LDKAccess *chain_access, LDKLogger logger);
6970 * Creates a new tracker of the actual state of the network of channels and nodes,
6971 * assuming an existing Network Graph.
6973 MUST_USE_RES LDKNetGraphMsgHandler NetGraphMsgHandler_from_net_graph(LDKAccess *chain_access, LDKLogger logger, LDKNetworkGraph network_graph);
6976 * Take a read lock on the network_graph and return it in the C-bindings
6977 * newtype helper. This is likely only useful when called via the C
6978 * bindings as you can call `self.network_graph.read().unwrap()` in Rust
6981 MUST_USE_RES LDKLockedNetworkGraph NetGraphMsgHandler_read_locked_graph(const LDKNetGraphMsgHandler *this_arg);
6984 * Get a reference to the NetworkGraph which this read-lock contains.
6986 MUST_USE_RES LDKNetworkGraph LockedNetworkGraph_graph(const LDKLockedNetworkGraph *this_arg);
6988 LDKRoutingMessageHandler NetGraphMsgHandler_as_RoutingMessageHandler(const LDKNetGraphMsgHandler *this_arg);
6990 void DirectionalChannelInfo_free(LDKDirectionalChannelInfo this_ptr);
6993 * When the last update to the channel direction was issued.
6994 * Value is opaque, as set in the announcement.
6996 uint32_t DirectionalChannelInfo_get_last_update(const LDKDirectionalChannelInfo *this_ptr);
6999 * When the last update to the channel direction was issued.
7000 * Value is opaque, as set in the announcement.
7002 void DirectionalChannelInfo_set_last_update(LDKDirectionalChannelInfo *this_ptr, uint32_t val);
7005 * Whether the channel can be currently used for payments (in this one direction).
7007 bool DirectionalChannelInfo_get_enabled(const LDKDirectionalChannelInfo *this_ptr);
7010 * Whether the channel can be currently used for payments (in this one direction).
7012 void DirectionalChannelInfo_set_enabled(LDKDirectionalChannelInfo *this_ptr, bool val);
7015 * The difference in CLTV values that you must have when routing through this channel.
7017 uint16_t DirectionalChannelInfo_get_cltv_expiry_delta(const LDKDirectionalChannelInfo *this_ptr);
7020 * The difference in CLTV values that you must have when routing through this channel.
7022 void DirectionalChannelInfo_set_cltv_expiry_delta(LDKDirectionalChannelInfo *this_ptr, uint16_t val);
7025 * The minimum value, which must be relayed to the next hop via the channel
7027 uint64_t DirectionalChannelInfo_get_htlc_minimum_msat(const LDKDirectionalChannelInfo *this_ptr);
7030 * The minimum value, which must be relayed to the next hop via the channel
7032 void DirectionalChannelInfo_set_htlc_minimum_msat(LDKDirectionalChannelInfo *this_ptr, uint64_t val);
7035 * Most recent update for the channel received from the network
7036 * Mostly redundant with the data we store in fields explicitly.
7037 * Everything else is useful only for sending out for initial routing sync.
7038 * Not stored if contains excess data to prevent DoS.
7040 LDKChannelUpdate DirectionalChannelInfo_get_last_update_message(const LDKDirectionalChannelInfo *this_ptr);
7043 * Most recent update for the channel received from the network
7044 * Mostly redundant with the data we store in fields explicitly.
7045 * Everything else is useful only for sending out for initial routing sync.
7046 * Not stored if contains excess data to prevent DoS.
7048 void DirectionalChannelInfo_set_last_update_message(LDKDirectionalChannelInfo *this_ptr, LDKChannelUpdate val);
7050 LDKCVec_u8Z DirectionalChannelInfo_write(const LDKDirectionalChannelInfo *obj);
7052 LDKDirectionalChannelInfo DirectionalChannelInfo_read(LDKu8slice ser);
7054 void ChannelInfo_free(LDKChannelInfo this_ptr);
7057 * Protocol features of a channel communicated during its announcement
7059 LDKChannelFeatures ChannelInfo_get_features(const LDKChannelInfo *this_ptr);
7062 * Protocol features of a channel communicated during its announcement
7064 void ChannelInfo_set_features(LDKChannelInfo *this_ptr, LDKChannelFeatures val);
7067 * Source node of the first direction of a channel
7069 LDKPublicKey ChannelInfo_get_node_one(const LDKChannelInfo *this_ptr);
7072 * Source node of the first direction of a channel
7074 void ChannelInfo_set_node_one(LDKChannelInfo *this_ptr, LDKPublicKey val);
7077 * Details about the first direction of a channel
7079 LDKDirectionalChannelInfo ChannelInfo_get_one_to_two(const LDKChannelInfo *this_ptr);
7082 * Details about the first direction of a channel
7084 void ChannelInfo_set_one_to_two(LDKChannelInfo *this_ptr, LDKDirectionalChannelInfo val);
7087 * Source node of the second direction of a channel
7089 LDKPublicKey ChannelInfo_get_node_two(const LDKChannelInfo *this_ptr);
7092 * Source node of the second direction of a channel
7094 void ChannelInfo_set_node_two(LDKChannelInfo *this_ptr, LDKPublicKey val);
7097 * Details about the second direction of a channel
7099 LDKDirectionalChannelInfo ChannelInfo_get_two_to_one(const LDKChannelInfo *this_ptr);
7102 * Details about the second direction of a channel
7104 void ChannelInfo_set_two_to_one(LDKChannelInfo *this_ptr, LDKDirectionalChannelInfo val);
7107 * An initial announcement of the channel
7108 * Mostly redundant with the data we store in fields explicitly.
7109 * Everything else is useful only for sending out for initial routing sync.
7110 * Not stored if contains excess data to prevent DoS.
7112 LDKChannelAnnouncement ChannelInfo_get_announcement_message(const LDKChannelInfo *this_ptr);
7115 * An initial announcement of the channel
7116 * Mostly redundant with the data we store in fields explicitly.
7117 * Everything else is useful only for sending out for initial routing sync.
7118 * Not stored if contains excess data to prevent DoS.
7120 void ChannelInfo_set_announcement_message(LDKChannelInfo *this_ptr, LDKChannelAnnouncement val);
7122 LDKCVec_u8Z ChannelInfo_write(const LDKChannelInfo *obj);
7124 LDKChannelInfo ChannelInfo_read(LDKu8slice ser);
7126 void RoutingFees_free(LDKRoutingFees this_ptr);
7128 LDKRoutingFees RoutingFees_clone(const LDKRoutingFees *orig);
7131 * Flat routing fee in satoshis
7133 uint32_t RoutingFees_get_base_msat(const LDKRoutingFees *this_ptr);
7136 * Flat routing fee in satoshis
7138 void RoutingFees_set_base_msat(LDKRoutingFees *this_ptr, uint32_t val);
7141 * Liquidity-based routing fee in millionths of a routed amount.
7142 * In other words, 10000 is 1%.
7144 uint32_t RoutingFees_get_proportional_millionths(const LDKRoutingFees *this_ptr);
7147 * Liquidity-based routing fee in millionths of a routed amount.
7148 * In other words, 10000 is 1%.
7150 void RoutingFees_set_proportional_millionths(LDKRoutingFees *this_ptr, uint32_t val);
7152 MUST_USE_RES LDKRoutingFees RoutingFees_new(uint32_t base_msat_arg, uint32_t proportional_millionths_arg);
7154 LDKRoutingFees RoutingFees_read(LDKu8slice ser);
7156 LDKCVec_u8Z RoutingFees_write(const LDKRoutingFees *obj);
7158 void NodeAnnouncementInfo_free(LDKNodeAnnouncementInfo this_ptr);
7161 * Protocol features the node announced support for
7163 LDKNodeFeatures NodeAnnouncementInfo_get_features(const LDKNodeAnnouncementInfo *this_ptr);
7166 * Protocol features the node announced support for
7168 void NodeAnnouncementInfo_set_features(LDKNodeAnnouncementInfo *this_ptr, LDKNodeFeatures val);
7171 * When the last known update to the node state was issued.
7172 * Value is opaque, as set in the announcement.
7174 uint32_t NodeAnnouncementInfo_get_last_update(const LDKNodeAnnouncementInfo *this_ptr);
7177 * When the last known update to the node state was issued.
7178 * Value is opaque, as set in the announcement.
7180 void NodeAnnouncementInfo_set_last_update(LDKNodeAnnouncementInfo *this_ptr, uint32_t val);
7183 * Color assigned to the node
7185 const uint8_t (*NodeAnnouncementInfo_get_rgb(const LDKNodeAnnouncementInfo *this_ptr))[3];
7188 * Color assigned to the node
7190 void NodeAnnouncementInfo_set_rgb(LDKNodeAnnouncementInfo *this_ptr, LDKThreeBytes val);
7193 * Moniker assigned to the node.
7194 * May be invalid or malicious (eg control chars),
7195 * should not be exposed to the user.
7197 const uint8_t (*NodeAnnouncementInfo_get_alias(const LDKNodeAnnouncementInfo *this_ptr))[32];
7200 * Moniker assigned to the node.
7201 * May be invalid or malicious (eg control chars),
7202 * should not be exposed to the user.
7204 void NodeAnnouncementInfo_set_alias(LDKNodeAnnouncementInfo *this_ptr, LDKThirtyTwoBytes val);
7207 * Internet-level addresses via which one can connect to the node
7209 void NodeAnnouncementInfo_set_addresses(LDKNodeAnnouncementInfo *this_ptr, LDKCVec_NetAddressZ val);
7212 * An initial announcement of the node
7213 * Mostly redundant with the data we store in fields explicitly.
7214 * Everything else is useful only for sending out for initial routing sync.
7215 * Not stored if contains excess data to prevent DoS.
7217 LDKNodeAnnouncement NodeAnnouncementInfo_get_announcement_message(const LDKNodeAnnouncementInfo *this_ptr);
7220 * An initial announcement of the node
7221 * Mostly redundant with the data we store in fields explicitly.
7222 * Everything else is useful only for sending out for initial routing sync.
7223 * Not stored if contains excess data to prevent DoS.
7225 void NodeAnnouncementInfo_set_announcement_message(LDKNodeAnnouncementInfo *this_ptr, LDKNodeAnnouncement val);
7227 MUST_USE_RES LDKNodeAnnouncementInfo NodeAnnouncementInfo_new(LDKNodeFeatures features_arg, uint32_t last_update_arg, LDKThreeBytes rgb_arg, LDKThirtyTwoBytes alias_arg, LDKCVec_NetAddressZ addresses_arg, LDKNodeAnnouncement announcement_message_arg);
7229 LDKCVec_u8Z NodeAnnouncementInfo_write(const LDKNodeAnnouncementInfo *obj);
7231 LDKNodeAnnouncementInfo NodeAnnouncementInfo_read(LDKu8slice ser);
7233 void NodeInfo_free(LDKNodeInfo this_ptr);
7236 * All valid channels a node has announced
7238 void NodeInfo_set_channels(LDKNodeInfo *this_ptr, LDKCVec_u64Z val);
7241 * Lowest fees enabling routing via any of the enabled, known channels to a node.
7242 * The two fields (flat and proportional fee) are independent,
7243 * meaning they don't have to refer to the same channel.
7245 LDKRoutingFees NodeInfo_get_lowest_inbound_channel_fees(const LDKNodeInfo *this_ptr);
7248 * Lowest fees enabling routing via any of the enabled, known channels to a node.
7249 * The two fields (flat and proportional fee) are independent,
7250 * meaning they don't have to refer to the same channel.
7252 void NodeInfo_set_lowest_inbound_channel_fees(LDKNodeInfo *this_ptr, LDKRoutingFees val);
7255 * More information about a node from node_announcement.
7256 * Optional because we store a Node entry after learning about it from
7257 * a channel announcement, but before receiving a node announcement.
7259 LDKNodeAnnouncementInfo NodeInfo_get_announcement_info(const LDKNodeInfo *this_ptr);
7262 * More information about a node from node_announcement.
7263 * Optional because we store a Node entry after learning about it from
7264 * a channel announcement, but before receiving a node announcement.
7266 void NodeInfo_set_announcement_info(LDKNodeInfo *this_ptr, LDKNodeAnnouncementInfo val);
7268 MUST_USE_RES LDKNodeInfo NodeInfo_new(LDKCVec_u64Z channels_arg, LDKRoutingFees lowest_inbound_channel_fees_arg, LDKNodeAnnouncementInfo announcement_info_arg);
7270 LDKCVec_u8Z NodeInfo_write(const LDKNodeInfo *obj);
7272 LDKNodeInfo NodeInfo_read(LDKu8slice ser);
7274 LDKCVec_u8Z NetworkGraph_write(const LDKNetworkGraph *obj);
7276 LDKNetworkGraph NetworkGraph_read(LDKu8slice ser);
7279 * Creates a new, empty, network graph.
7281 MUST_USE_RES LDKNetworkGraph NetworkGraph_new(void);
7284 * For an already known node (from channel announcements), update its stored properties from a
7285 * given node announcement.
7287 * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
7288 * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
7289 * routing messages from a source using a protocol other than the lightning P2P protocol.
7291 MUST_USE_RES LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_announcement(LDKNetworkGraph *this_arg, const LDKNodeAnnouncement *msg);
7294 * For an already known node (from channel announcements), update its stored properties from a
7295 * given node announcement without verifying the associated signatures. Because we aren't
7296 * given the associated signatures here we cannot relay the node announcement to any of our
7299 MUST_USE_RES LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_unsigned_announcement(LDKNetworkGraph *this_arg, const LDKUnsignedNodeAnnouncement *msg);
7302 * Store or update channel info from a channel announcement.
7304 * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
7305 * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
7306 * routing messages from a source using a protocol other than the lightning P2P protocol.
7308 * If a `chain::Access` object is provided via `chain_access`, it will be called to verify
7309 * the corresponding UTXO exists on chain and is correctly-formatted.
7311 MUST_USE_RES LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_from_announcement(LDKNetworkGraph *this_arg, const LDKChannelAnnouncement *msg, LDKAccess *chain_access);
7314 * Store or update channel info from a channel announcement without verifying the associated
7315 * signatures. Because we aren't given the associated signatures here we cannot relay the
7316 * channel announcement to any of our peers.
7318 * If a `chain::Access` object is provided via `chain_access`, it will be called to verify
7319 * the corresponding UTXO exists on chain and is correctly-formatted.
7321 MUST_USE_RES LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_from_unsigned_announcement(LDKNetworkGraph *this_arg, const LDKUnsignedChannelAnnouncement *msg, LDKAccess *chain_access);
7324 * Close a channel if a corresponding HTLC fail was sent.
7325 * If permanent, removes a channel from the local storage.
7326 * May cause the removal of nodes too, if this was their last channel.
7327 * If not permanent, makes channels unavailable for routing.
7329 void NetworkGraph_close_channel_from_update(LDKNetworkGraph *this_arg, uint64_t short_channel_id, bool is_permanent);
7332 * For an already known (from announcement) channel, update info about one of the directions
7335 * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
7336 * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
7337 * routing messages from a source using a protocol other than the lightning P2P protocol.
7339 MUST_USE_RES LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel(LDKNetworkGraph *this_arg, const LDKChannelUpdate *msg);
7342 * For an already known (from announcement) channel, update info about one of the directions
7343 * of the channel without verifying the associated signatures. Because we aren't given the
7344 * associated signatures here we cannot relay the channel update to any of our peers.
7346 MUST_USE_RES LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_unsigned(LDKNetworkGraph *this_arg, const LDKUnsignedChannelUpdate *msg);
7348 /* Text to put at the end of the generated file */