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;
589 typedef struct LDKPublicKey {
590 uint8_t compressed_form[33];
594 * When on-chain outputs are created by rust-lightning (which our counterparty is not able to
595 * claim at any point in the future) an event is generated which you must track and be able to
596 * spend on-chain. The information needed to do this is provided in this enum, including the
597 * outpoint describing which txid and output index is available, the full output which exists at
598 * that txid/index, and any keys or other information required to sign.
600 typedef enum LDKSpendableOutputDescriptor_Tag {
602 * An output to a script which was provided via KeysInterface, thus you should already know
603 * how to spend it. No keys are provided as rust-lightning was never given any keys - only the
604 * script_pubkey as it appears in the output.
605 * These may include outputs from a transaction punishing our counterparty or claiming an HTLC
606 * on-chain using the payment preimage or after it has timed out.
608 LDKSpendableOutputDescriptor_StaticOutput,
610 * An output to a P2WSH script which can be spent with a single signature after a CSV delay.
612 * The witness in the spending input should be:
613 * <BIP 143 signature> <empty vector> (MINIMALIF standard rule) <provided witnessScript>
615 * Note that the nSequence field in the spending input must be set to to_self_delay
616 * (which means the transaction is not broadcastable until at least to_self_delay
617 * blocks after the outpoint confirms).
619 * These are generally the result of a \"revocable\" output to us, spendable only by us unless
620 * it is an output from an old state which we broadcast (which should never happen).
622 * To derive the delayed_payment key which is used to sign for this input, you must pass the
623 * holder delayed_payment_base_key (ie the private key which corresponds to the pubkey in
624 * ChannelKeys::pubkeys().delayed_payment_basepoint) and the provided per_commitment_point to
625 * chan_utils::derive_private_key. The public key can be generated without the secret key
626 * using chan_utils::derive_public_key and only the delayed_payment_basepoint which appears in
627 * ChannelKeys::pubkeys().
629 * To derive the revocation_pubkey provided here (which is used in the witness
630 * script generation), you must pass the counterparty revocation_basepoint (which appears in the
631 * call to ChannelKeys::on_accept) and the provided per_commitment point
632 * to chan_utils::derive_public_revocation_key.
634 * The witness script which is hashed and included in the output script_pubkey may be
635 * regenerated by passing the revocation_pubkey (derived as above), our delayed_payment pubkey
636 * (derived as above), and the to_self_delay contained here to
637 * chan_utils::get_revokeable_redeemscript.
639 LDKSpendableOutputDescriptor_DynamicOutputP2WSH,
641 * An output to a P2WPKH, spendable exclusively by our payment key (ie the private key which
642 * corresponds to the public key in ChannelKeys::pubkeys().payment_point).
643 * The witness in the spending input, is, thus, simply:
644 * <BIP 143 signature> <payment key>
646 * These are generally the result of our counterparty having broadcast the current state,
647 * allowing us to claim the non-HTLC-encumbered outputs immediately.
649 LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment,
651 * Must be last for serialization purposes
653 LDKSpendableOutputDescriptor_Sentinel,
654 } LDKSpendableOutputDescriptor_Tag;
656 typedef struct LDKSpendableOutputDescriptor_LDKStaticOutput_Body {
657 LDKOutPoint outpoint;
659 } LDKSpendableOutputDescriptor_LDKStaticOutput_Body;
661 typedef struct LDKSpendableOutputDescriptor_LDKDynamicOutputP2WSH_Body {
662 LDKOutPoint outpoint;
663 LDKPublicKey per_commitment_point;
664 uint16_t to_self_delay;
666 LDKC2Tuple_u64u64Z key_derivation_params;
667 LDKPublicKey revocation_pubkey;
668 } LDKSpendableOutputDescriptor_LDKDynamicOutputP2WSH_Body;
670 typedef struct LDKSpendableOutputDescriptor_LDKStaticOutputCounterpartyPayment_Body {
671 LDKOutPoint outpoint;
673 LDKC2Tuple_u64u64Z key_derivation_params;
674 } LDKSpendableOutputDescriptor_LDKStaticOutputCounterpartyPayment_Body;
676 typedef struct LDKSpendableOutputDescriptor {
677 LDKSpendableOutputDescriptor_Tag tag;
679 LDKSpendableOutputDescriptor_LDKStaticOutput_Body static_output;
680 LDKSpendableOutputDescriptor_LDKDynamicOutputP2WSH_Body dynamic_output_p2wsh;
681 LDKSpendableOutputDescriptor_LDKStaticOutputCounterpartyPayment_Body static_output_counterparty_payment;
683 } LDKSpendableOutputDescriptor;
685 typedef struct LDKCVecTempl_SpendableOutputDescriptor {
686 LDKSpendableOutputDescriptor *data;
688 } LDKCVecTempl_SpendableOutputDescriptor;
690 typedef LDKCVecTempl_SpendableOutputDescriptor LDKCVec_SpendableOutputDescriptorZ;
693 * An Event which you should probably take some action in response to.
695 * Note that while Writeable and Readable are implemented for Event, you probably shouldn't use
696 * them directly as they don't round-trip exactly (for example FundingGenerationReady is never
697 * written as it makes no sense to respond to it after reconnecting to peers).
699 typedef enum LDKEvent_Tag {
701 * Used to indicate that the client should generate a funding transaction with the given
702 * parameters and then call ChannelManager::funding_transaction_generated.
703 * Generated in ChannelManager message handling.
704 * Note that *all inputs* in the funding transaction must spend SegWit outputs or your
705 * counterparty can steal your funds!
707 LDKEvent_FundingGenerationReady,
709 * Used to indicate that the client may now broadcast the funding transaction it created for a
710 * channel. Broadcasting such a transaction prior to this event may lead to our counterparty
711 * trivially stealing all funds in the funding transaction!
713 LDKEvent_FundingBroadcastSafe,
715 * Indicates we've received money! Just gotta dig out that payment preimage and feed it to
716 * ChannelManager::claim_funds to get it....
717 * Note that if the preimage is not known or the amount paid is incorrect, you should call
718 * ChannelManager::fail_htlc_backwards to free up resources for this HTLC and avoid
719 * network congestion.
720 * The amount paid should be considered 'incorrect' when it is less than or more than twice
721 * the amount expected.
722 * If you fail to call either ChannelManager::claim_funds or
723 * ChannelManager::fail_htlc_backwards within the HTLC's timeout, the HTLC will be
724 * automatically failed.
726 LDKEvent_PaymentReceived,
728 * Indicates an outbound payment we made succeeded (ie it made it all the way to its target
729 * and we got back the payment preimage for it).
730 * Note that duplicative PaymentSent Events may be generated - it is your responsibility to
731 * deduplicate them by payment_preimage (which MUST be unique)!
733 LDKEvent_PaymentSent,
735 * Indicates an outbound payment we made failed. Probably some intermediary node dropped
736 * something. You may wish to retry with a different route.
737 * Note that duplicative PaymentFailed Events may be generated - it is your responsibility to
738 * deduplicate them by payment_hash (which MUST be unique)!
740 LDKEvent_PaymentFailed,
742 * Used to indicate that ChannelManager::process_pending_htlc_forwards should be called at a
743 * time in the future.
745 LDKEvent_PendingHTLCsForwardable,
747 * Used to indicate that an output was generated on-chain which you should know how to spend.
748 * Such an output will *not* ever be spent by rust-lightning, and are not at risk of your
749 * counterparty spending them due to some kind of timeout. Thus, you need to store them
750 * somewhere and spend them when you create on-chain transactions.
752 LDKEvent_SpendableOutputs,
754 * Must be last for serialization purposes
759 typedef struct LDKEvent_LDKFundingGenerationReady_Body {
760 LDKThirtyTwoBytes temporary_channel_id;
761 uint64_t channel_value_satoshis;
762 LDKCVec_u8Z output_script;
763 uint64_t user_channel_id;
764 } LDKEvent_LDKFundingGenerationReady_Body;
766 typedef struct LDKEvent_LDKFundingBroadcastSafe_Body {
767 LDKOutPoint funding_txo;
768 uint64_t user_channel_id;
769 } LDKEvent_LDKFundingBroadcastSafe_Body;
771 typedef struct LDKEvent_LDKPaymentReceived_Body {
772 LDKThirtyTwoBytes payment_hash;
773 LDKThirtyTwoBytes payment_secret;
775 } LDKEvent_LDKPaymentReceived_Body;
777 typedef struct LDKEvent_LDKPaymentSent_Body {
778 LDKThirtyTwoBytes payment_preimage;
779 } LDKEvent_LDKPaymentSent_Body;
781 typedef struct LDKEvent_LDKPaymentFailed_Body {
782 LDKThirtyTwoBytes payment_hash;
783 bool rejected_by_dest;
784 } LDKEvent_LDKPaymentFailed_Body;
786 typedef struct LDKEvent_LDKPendingHTLCsForwardable_Body {
787 uint64_t time_forwardable;
788 } LDKEvent_LDKPendingHTLCsForwardable_Body;
790 typedef struct LDKEvent_LDKSpendableOutputs_Body {
791 LDKCVec_SpendableOutputDescriptorZ outputs;
792 } LDKEvent_LDKSpendableOutputs_Body;
794 typedef struct LDKEvent {
797 LDKEvent_LDKFundingGenerationReady_Body funding_generation_ready;
798 LDKEvent_LDKFundingBroadcastSafe_Body funding_broadcast_safe;
799 LDKEvent_LDKPaymentReceived_Body payment_received;
800 LDKEvent_LDKPaymentSent_Body payment_sent;
801 LDKEvent_LDKPaymentFailed_Body payment_failed;
802 LDKEvent_LDKPendingHTLCsForwardable_Body pending_htl_cs_forwardable;
803 LDKEvent_LDKSpendableOutputs_Body spendable_outputs;
810 * An accept_channel message to be sent or received from a peer
812 typedef struct MUST_USE_STRUCT LDKAcceptChannel {
814 * Nearly everywhere, inner must be non-null, however in places where
815 * the Rust equivalent takes an Option, it may be set to null to indicate None.
817 LDKnativeAcceptChannel *inner;
824 * An open_channel message to be sent or received from a peer
826 typedef struct MUST_USE_STRUCT LDKOpenChannel {
828 * Nearly everywhere, inner must be non-null, however in places where
829 * the Rust equivalent takes an Option, it may be set to null to indicate None.
831 LDKnativeOpenChannel *inner;
838 * A funding_created message to be sent or received from a peer
840 typedef struct MUST_USE_STRUCT LDKFundingCreated {
842 * Nearly everywhere, inner must be non-null, however in places where
843 * the Rust equivalent takes an Option, it may be set to null to indicate None.
845 LDKnativeFundingCreated *inner;
852 * A funding_signed message to be sent or received from a peer
854 typedef struct MUST_USE_STRUCT LDKFundingSigned {
856 * Nearly everywhere, inner must be non-null, however in places where
857 * the Rust equivalent takes an Option, it may be set to null to indicate None.
859 LDKnativeFundingSigned *inner;
866 * A funding_locked message to be sent or received from a peer
868 typedef struct MUST_USE_STRUCT LDKFundingLocked {
870 * Nearly everywhere, inner must be non-null, however in places where
871 * the Rust equivalent takes an Option, it may be set to null to indicate None.
873 LDKnativeFundingLocked *inner;
880 * An announcement_signatures message to be sent or received from a peer
882 typedef struct MUST_USE_STRUCT LDKAnnouncementSignatures {
884 * Nearly everywhere, inner must be non-null, however in places where
885 * the Rust equivalent takes an Option, it may be set to null to indicate None.
887 LDKnativeAnnouncementSignatures *inner;
889 } LDKAnnouncementSignatures;
894 * Struct used to return values from revoke_and_ack messages, containing a bunch of commitment
895 * transaction updates if they were pending.
897 typedef struct MUST_USE_STRUCT LDKCommitmentUpdate {
899 * Nearly everywhere, inner must be non-null, however in places where
900 * the Rust equivalent takes an Option, it may be set to null to indicate None.
902 LDKnativeCommitmentUpdate *inner;
904 } LDKCommitmentUpdate;
909 * A revoke_and_ack message to be sent or received from a peer
911 typedef struct MUST_USE_STRUCT LDKRevokeAndACK {
913 * Nearly everywhere, inner must be non-null, however in places where
914 * the Rust equivalent takes an Option, it may be set to null to indicate None.
916 LDKnativeRevokeAndACK *inner;
923 * A closing_signed message to be sent or received from a peer
925 typedef struct MUST_USE_STRUCT LDKClosingSigned {
927 * Nearly everywhere, inner must be non-null, however in places where
928 * the Rust equivalent takes an Option, it may be set to null to indicate None.
930 LDKnativeClosingSigned *inner;
937 * A shutdown message to be sent or received from a peer
939 typedef struct MUST_USE_STRUCT LDKShutdown {
941 * Nearly everywhere, inner must be non-null, however in places where
942 * the Rust equivalent takes an Option, it may be set to null to indicate None.
944 LDKnativeShutdown *inner;
951 * A channel_reestablish message to be sent or received from a peer
953 typedef struct MUST_USE_STRUCT LDKChannelReestablish {
955 * Nearly everywhere, inner must be non-null, however in places where
956 * the Rust equivalent takes an Option, it may be set to null to indicate None.
958 LDKnativeChannelReestablish *inner;
960 } LDKChannelReestablish;
965 * A node_announcement message to be sent or received from a peer
967 typedef struct MUST_USE_STRUCT LDKNodeAnnouncement {
969 * Nearly everywhere, inner must be non-null, however in places where
970 * the Rust equivalent takes an Option, it may be set to null to indicate None.
972 LDKnativeNodeAnnouncement *inner;
974 } LDKNodeAnnouncement;
979 * An error message to be sent or received from a peer
981 typedef struct MUST_USE_STRUCT LDKErrorMessage {
983 * Nearly everywhere, inner must be non-null, however in places where
984 * the Rust equivalent takes an Option, it may be set to null to indicate None.
986 LDKnativeErrorMessage *inner;
991 * Used to put an error message in a LightningError
993 typedef enum LDKErrorAction_Tag {
995 * The peer took some action which made us think they were useless. Disconnect them.
997 LDKErrorAction_DisconnectPeer,
999 * The peer did something harmless that we weren't able to process, just log and ignore
1001 LDKErrorAction_IgnoreError,
1003 * The peer did something incorrect. Tell them.
1005 LDKErrorAction_SendErrorMessage,
1007 * Must be last for serialization purposes
1009 LDKErrorAction_Sentinel,
1010 } LDKErrorAction_Tag;
1012 typedef struct LDKErrorAction_LDKDisconnectPeer_Body {
1013 LDKErrorMessage msg;
1014 } LDKErrorAction_LDKDisconnectPeer_Body;
1016 typedef struct LDKErrorAction_LDKSendErrorMessage_Body {
1017 LDKErrorMessage msg;
1018 } LDKErrorAction_LDKSendErrorMessage_Body;
1020 typedef struct LDKErrorAction {
1021 LDKErrorAction_Tag tag;
1023 LDKErrorAction_LDKDisconnectPeer_Body disconnect_peer;
1024 LDKErrorAction_LDKSendErrorMessage_Body send_error_message;
1029 * The information we received from a peer along the route of a payment we originated. This is
1030 * returned by ChannelMessageHandler::handle_update_fail_htlc to be passed into
1031 * RoutingMessageHandler::handle_htlc_fail_channel_update to update our network map.
1033 typedef enum LDKHTLCFailChannelUpdate_Tag {
1035 * We received an error which included a full ChannelUpdate message.
1037 LDKHTLCFailChannelUpdate_ChannelUpdateMessage,
1039 * We received an error which indicated only that a channel has been closed
1041 LDKHTLCFailChannelUpdate_ChannelClosed,
1043 * We received an error which indicated only that a node has failed
1045 LDKHTLCFailChannelUpdate_NodeFailure,
1047 * Must be last for serialization purposes
1049 LDKHTLCFailChannelUpdate_Sentinel,
1050 } LDKHTLCFailChannelUpdate_Tag;
1052 typedef struct LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body {
1053 LDKChannelUpdate msg;
1054 } LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body;
1056 typedef struct LDKHTLCFailChannelUpdate_LDKChannelClosed_Body {
1057 uint64_t short_channel_id;
1059 } LDKHTLCFailChannelUpdate_LDKChannelClosed_Body;
1061 typedef struct LDKHTLCFailChannelUpdate_LDKNodeFailure_Body {
1062 LDKPublicKey node_id;
1064 } LDKHTLCFailChannelUpdate_LDKNodeFailure_Body;
1066 typedef struct LDKHTLCFailChannelUpdate {
1067 LDKHTLCFailChannelUpdate_Tag tag;
1069 LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body channel_update_message;
1070 LDKHTLCFailChannelUpdate_LDKChannelClosed_Body channel_closed;
1071 LDKHTLCFailChannelUpdate_LDKNodeFailure_Body node_failure;
1073 } LDKHTLCFailChannelUpdate;
1076 * An event generated by ChannelManager which indicates a message should be sent to a peer (or
1077 * broadcast to most peers).
1078 * These events are handled by PeerManager::process_events if you are using a PeerManager.
1080 typedef enum LDKMessageSendEvent_Tag {
1082 * Used to indicate that we've accepted a channel open and should send the accept_channel
1083 * message provided to the given peer.
1085 LDKMessageSendEvent_SendAcceptChannel,
1087 * Used to indicate that we've initiated a channel open and should send the open_channel
1088 * message provided to the given peer.
1090 LDKMessageSendEvent_SendOpenChannel,
1092 * Used to indicate that a funding_created message should be sent to the peer with the given node_id.
1094 LDKMessageSendEvent_SendFundingCreated,
1096 * Used to indicate that a funding_signed message should be sent to the peer with the given node_id.
1098 LDKMessageSendEvent_SendFundingSigned,
1100 * Used to indicate that a funding_locked message should be sent to the peer with the given node_id.
1102 LDKMessageSendEvent_SendFundingLocked,
1104 * Used to indicate that an announcement_signatures message should be sent to the peer with the given node_id.
1106 LDKMessageSendEvent_SendAnnouncementSignatures,
1108 * Used to indicate that a series of HTLC update messages, as well as a commitment_signed
1109 * message should be sent to the peer with the given node_id.
1111 LDKMessageSendEvent_UpdateHTLCs,
1113 * Used to indicate that a revoke_and_ack message should be sent to the peer with the given node_id.
1115 LDKMessageSendEvent_SendRevokeAndACK,
1117 * Used to indicate that a closing_signed message should be sent to the peer with the given node_id.
1119 LDKMessageSendEvent_SendClosingSigned,
1121 * Used to indicate that a shutdown message should be sent to the peer with the given node_id.
1123 LDKMessageSendEvent_SendShutdown,
1125 * Used to indicate that a channel_reestablish message should be sent to the peer with the given node_id.
1127 LDKMessageSendEvent_SendChannelReestablish,
1129 * Used to indicate that a channel_announcement and channel_update should be broadcast to all
1130 * peers (except the peer with node_id either msg.contents.node_id_1 or msg.contents.node_id_2).
1132 * Note that after doing so, you very likely (unless you did so very recently) want to call
1133 * ChannelManager::broadcast_node_announcement to trigger a BroadcastNodeAnnouncement event.
1134 * This ensures that any nodes which see our channel_announcement also have a relevant
1135 * node_announcement, including relevant feature flags which may be important for routing
1138 LDKMessageSendEvent_BroadcastChannelAnnouncement,
1140 * Used to indicate that a node_announcement should be broadcast to all peers.
1142 LDKMessageSendEvent_BroadcastNodeAnnouncement,
1144 * Used to indicate that a channel_update should be broadcast to all peers.
1146 LDKMessageSendEvent_BroadcastChannelUpdate,
1148 * Broadcast an error downstream to be handled
1150 LDKMessageSendEvent_HandleError,
1152 * When a payment fails we may receive updates back from the hop where it failed. In such
1153 * cases this event is generated so that we can inform the network graph of this information.
1155 LDKMessageSendEvent_PaymentFailureNetworkUpdate,
1157 * Must be last for serialization purposes
1159 LDKMessageSendEvent_Sentinel,
1160 } LDKMessageSendEvent_Tag;
1162 typedef struct LDKMessageSendEvent_LDKSendAcceptChannel_Body {
1163 LDKPublicKey node_id;
1164 LDKAcceptChannel msg;
1165 } LDKMessageSendEvent_LDKSendAcceptChannel_Body;
1167 typedef struct LDKMessageSendEvent_LDKSendOpenChannel_Body {
1168 LDKPublicKey node_id;
1170 } LDKMessageSendEvent_LDKSendOpenChannel_Body;
1172 typedef struct LDKMessageSendEvent_LDKSendFundingCreated_Body {
1173 LDKPublicKey node_id;
1174 LDKFundingCreated msg;
1175 } LDKMessageSendEvent_LDKSendFundingCreated_Body;
1177 typedef struct LDKMessageSendEvent_LDKSendFundingSigned_Body {
1178 LDKPublicKey node_id;
1179 LDKFundingSigned msg;
1180 } LDKMessageSendEvent_LDKSendFundingSigned_Body;
1182 typedef struct LDKMessageSendEvent_LDKSendFundingLocked_Body {
1183 LDKPublicKey node_id;
1184 LDKFundingLocked msg;
1185 } LDKMessageSendEvent_LDKSendFundingLocked_Body;
1187 typedef struct LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body {
1188 LDKPublicKey node_id;
1189 LDKAnnouncementSignatures msg;
1190 } LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body;
1192 typedef struct LDKMessageSendEvent_LDKUpdateHTLCs_Body {
1193 LDKPublicKey node_id;
1194 LDKCommitmentUpdate updates;
1195 } LDKMessageSendEvent_LDKUpdateHTLCs_Body;
1197 typedef struct LDKMessageSendEvent_LDKSendRevokeAndACK_Body {
1198 LDKPublicKey node_id;
1199 LDKRevokeAndACK msg;
1200 } LDKMessageSendEvent_LDKSendRevokeAndACK_Body;
1202 typedef struct LDKMessageSendEvent_LDKSendClosingSigned_Body {
1203 LDKPublicKey node_id;
1204 LDKClosingSigned msg;
1205 } LDKMessageSendEvent_LDKSendClosingSigned_Body;
1207 typedef struct LDKMessageSendEvent_LDKSendShutdown_Body {
1208 LDKPublicKey node_id;
1210 } LDKMessageSendEvent_LDKSendShutdown_Body;
1212 typedef struct LDKMessageSendEvent_LDKSendChannelReestablish_Body {
1213 LDKPublicKey node_id;
1214 LDKChannelReestablish msg;
1215 } LDKMessageSendEvent_LDKSendChannelReestablish_Body;
1217 typedef struct LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body {
1218 LDKChannelAnnouncement msg;
1219 LDKChannelUpdate update_msg;
1220 } LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body;
1222 typedef struct LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body {
1223 LDKNodeAnnouncement msg;
1224 } LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body;
1226 typedef struct LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body {
1227 LDKChannelUpdate msg;
1228 } LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body;
1230 typedef struct LDKMessageSendEvent_LDKHandleError_Body {
1231 LDKPublicKey node_id;
1232 LDKErrorAction action;
1233 } LDKMessageSendEvent_LDKHandleError_Body;
1235 typedef struct LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body {
1236 LDKHTLCFailChannelUpdate update;
1237 } LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body;
1239 typedef struct LDKMessageSendEvent {
1240 LDKMessageSendEvent_Tag tag;
1242 LDKMessageSendEvent_LDKSendAcceptChannel_Body send_accept_channel;
1243 LDKMessageSendEvent_LDKSendOpenChannel_Body send_open_channel;
1244 LDKMessageSendEvent_LDKSendFundingCreated_Body send_funding_created;
1245 LDKMessageSendEvent_LDKSendFundingSigned_Body send_funding_signed;
1246 LDKMessageSendEvent_LDKSendFundingLocked_Body send_funding_locked;
1247 LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body send_announcement_signatures;
1248 LDKMessageSendEvent_LDKUpdateHTLCs_Body update_htl_cs;
1249 LDKMessageSendEvent_LDKSendRevokeAndACK_Body send_revoke_and_ack;
1250 LDKMessageSendEvent_LDKSendClosingSigned_Body send_closing_signed;
1251 LDKMessageSendEvent_LDKSendShutdown_Body send_shutdown;
1252 LDKMessageSendEvent_LDKSendChannelReestablish_Body send_channel_reestablish;
1253 LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body broadcast_channel_announcement;
1254 LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body broadcast_node_announcement;
1255 LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body broadcast_channel_update;
1256 LDKMessageSendEvent_LDKHandleError_Body handle_error;
1257 LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body payment_failure_network_update;
1259 } LDKMessageSendEvent;
1261 typedef struct LDKCVecTempl_MessageSendEvent {
1262 LDKMessageSendEvent *data;
1264 } LDKCVecTempl_MessageSendEvent;
1266 typedef LDKCVecTempl_MessageSendEvent LDKCVec_MessageSendEventZ;
1269 * A trait indicating an object may generate message send events
1271 typedef struct LDKMessageSendEventsProvider {
1274 * Gets the list of pending events which were generated by previous actions, clearing the list
1277 LDKCVec_MessageSendEventZ (*get_and_clear_pending_msg_events)(const void *this_arg);
1278 void (*free)(void *this_arg);
1279 } LDKMessageSendEventsProvider;
1281 typedef struct LDKCVecTempl_Event {
1284 } LDKCVecTempl_Event;
1286 typedef LDKCVecTempl_Event LDKCVec_EventZ;
1289 * A trait indicating an object may generate events
1291 typedef struct LDKEventsProvider {
1294 * Gets the list of pending events which were generated by previous actions, clearing the list
1297 LDKCVec_EventZ (*get_and_clear_pending_events)(const void *this_arg);
1298 void (*free)(void *this_arg);
1299 } LDKEventsProvider;
1302 * A trait encapsulating the operations required of a logger
1304 typedef struct LDKLogger {
1309 void (*log)(const void *this_arg, const char *record);
1310 void (*free)(void *this_arg);
1316 * Configuration we set when applicable.
1318 * Default::default() provides sane defaults.
1320 typedef struct MUST_USE_STRUCT LDKChannelHandshakeConfig {
1322 * Nearly everywhere, inner must be non-null, however in places where
1323 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1325 LDKnativeChannelHandshakeConfig *inner;
1327 } LDKChannelHandshakeConfig;
1332 * Optional channel limits which are applied during channel creation.
1334 * These limits are only applied to our counterparty's limits, not our own.
1336 * Use 0/<type>::max_value() as appropriate to skip checking.
1338 * Provides sane defaults for most configurations.
1340 * Most additional limits are disabled except those with which specify a default in individual
1341 * field documentation. Note that this may result in barely-usable channels, but since they
1342 * are applied mostly only to incoming channels that's not much of a problem.
1344 typedef struct MUST_USE_STRUCT LDKChannelHandshakeLimits {
1346 * Nearly everywhere, inner must be non-null, however in places where
1347 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1349 LDKnativeChannelHandshakeLimits *inner;
1351 } LDKChannelHandshakeLimits;
1356 * Options which apply on a per-channel basis and may change at runtime or based on negotiation
1357 * with our counterparty.
1359 typedef struct MUST_USE_STRUCT LDKChannelConfig {
1361 * Nearly everywhere, inner must be non-null, however in places where
1362 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1364 LDKnativeChannelConfig *inner;
1368 typedef struct LDKu8slice {
1369 const uint8_t *data;
1376 * Top-level config which holds ChannelHandshakeLimits and ChannelConfig.
1378 * Default::default() provides sane defaults for most configurations
1379 * (but currently with 0 relay fees!)
1381 typedef struct MUST_USE_STRUCT LDKUserConfig {
1383 * Nearly everywhere, inner must be non-null, however in places where
1384 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1386 LDKnativeUserConfig *inner;
1390 typedef union LDKCResultPtr_TxOut__AccessError {
1392 LDKAccessError *err;
1393 } LDKCResultPtr_TxOut__AccessError;
1395 typedef struct LDKCResultTempl_TxOut__AccessError {
1396 LDKCResultPtr_TxOut__AccessError contents;
1398 } LDKCResultTempl_TxOut__AccessError;
1400 typedef LDKCResultTempl_TxOut__AccessError LDKCResult_TxOutAccessErrorZ;
1403 * The `Access` trait defines behavior for accessing chain data and state, such as blocks and
1406 typedef struct LDKAccess {
1409 * Returns the transaction output of a funding transaction encoded by [`short_channel_id`].
1410 * Returns an error if `genesis_hash` is for a different chain or if such a transaction output
1413 * [`short_channel_id`]: https://github.com/lightningnetwork/lightning-rfc/blob/master/07-routing-gossip.md#definition-of-short_channel_id
1415 LDKCResult_TxOutAccessErrorZ (*get_utxo)(const void *this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id);
1416 void (*free)(void *this_arg);
1422 * One counterparty's public keys which do not change over the life of a channel.
1424 typedef struct MUST_USE_STRUCT LDKChannelPublicKeys {
1426 * Nearly everywhere, inner must be non-null, however in places where
1427 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1429 LDKnativeChannelPublicKeys *inner;
1431 } LDKChannelPublicKeys;
1436 * The per-commitment point and a set of pre-calculated public keys used for transaction creation
1438 * The pre-calculated keys are an optimization, because ChannelKeys has enough
1439 * information to re-derive them.
1441 typedef struct MUST_USE_STRUCT LDKPreCalculatedTxCreationKeys {
1443 * Nearly everywhere, inner must be non-null, however in places where
1444 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1446 LDKnativePreCalculatedTxCreationKeys *inner;
1448 } LDKPreCalculatedTxCreationKeys;
1450 typedef struct LDKCVecTempl_HTLCOutputInCommitment {
1451 LDKHTLCOutputInCommitment *data;
1453 } LDKCVecTempl_HTLCOutputInCommitment;
1455 typedef LDKCVecTempl_HTLCOutputInCommitment LDKCVec_HTLCOutputInCommitmentZ;
1460 * We use this to track holder commitment transactions and put off signing them until we are ready
1461 * to broadcast. This class can be used inside a signer implementation to generate a signature
1462 * given the relevant secret key.
1464 typedef struct MUST_USE_STRUCT LDKHolderCommitmentTransaction {
1466 * Nearly everywhere, inner must be non-null, however in places where
1467 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1469 LDKnativeHolderCommitmentTransaction *inner;
1471 } LDKHolderCommitmentTransaction;
1476 * The unsigned part of a channel_announcement
1478 typedef struct MUST_USE_STRUCT LDKUnsignedChannelAnnouncement {
1480 * Nearly everywhere, inner must be non-null, however in places where
1481 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1483 LDKnativeUnsignedChannelAnnouncement *inner;
1485 } LDKUnsignedChannelAnnouncement;
1488 * Set of lightning keys needed to operate a channel as described in BOLT 3.
1490 * Signing services could be implemented on a hardware wallet. In this case,
1491 * the current ChannelKeys would be a front-end on top of a communication
1492 * channel connected to your secure device and lightning key material wouldn't
1493 * reside on a hot server. Nevertheless, a this deployment would still need
1494 * to trust the ChannelManager to avoid loss of funds as this latest component
1495 * could ask to sign commitment transaction with HTLCs paying to attacker pubkeys.
1497 * A more secure iteration would be to use hashlock (or payment points) to pair
1498 * invoice/incoming HTLCs with outgoing HTLCs to implement a no-trust-ChannelManager
1499 * at the price of more state and computation on the hardware wallet side. In the future,
1500 * we are looking forward to design such interface.
1502 * In any case, ChannelMonitor or fallback watchtowers are always going to be trusted
1503 * to act, as liveness and breach reply correctness are always going to be hard requirements
1504 * of LN security model, orthogonal of key management issues.
1506 * If you're implementing a custom signer, you almost certainly want to implement
1507 * Readable/Writable to serialize out a unique reference to this set of keys so
1508 * that you can serialize the full ChannelManager object.
1511 typedef struct LDKChannelKeys {
1514 * Gets the per-commitment point for a specific commitment number
1516 * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
1518 LDKPublicKey (*get_per_commitment_point)(const void *this_arg, uint64_t idx);
1520 * Gets the commitment secret for a specific commitment number as part of the revocation process
1522 * An external signer implementation should error here if the commitment was already signed
1523 * and should refuse to sign it in the future.
1525 * May be called more than once for the same index.
1527 * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
1528 * TODO: return a Result so we can signal a validation error
1530 LDKThirtyTwoBytes (*release_commitment_secret)(const void *this_arg, uint64_t idx);
1532 * Gets the holder's channel public keys and basepoints
1534 LDKChannelPublicKeys pubkeys;
1536 * Fill in the pubkeys field as a reference to it will be given to Rust after this returns
1537 * Note that this takes a pointer to this object, not the this_ptr like other methods do
1538 * This function pointer may be NULL if pubkeys is filled in when this object is created and never needs updating.
1540 void (*set_pubkeys)(const LDKChannelKeys*);
1542 * Gets arbitrary identifiers describing the set of keys which are provided back to you in
1543 * some SpendableOutputDescriptor types. These should be sufficient to identify this
1544 * ChannelKeys object uniquely and lookup or re-derive its keys.
1546 LDKC2Tuple_u64u64Z (*key_derivation_params)(const void *this_arg);
1548 * Create a signature for a counterparty's commitment transaction and associated HTLC transactions.
1550 * Note that if signing fails or is rejected, the channel will be force-closed.
1552 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);
1554 * Create a signature for a holder's commitment transaction. This will only ever be called with
1555 * the same holder_commitment_tx (or a copy thereof), though there are currently no guarantees
1556 * that it will not be called multiple times.
1557 * An external signer implementation should check that the commitment has not been revoked.
1559 LDKCResult_SignatureNoneZ (*sign_holder_commitment)(const void *this_arg, const LDKHolderCommitmentTransaction *holder_commitment_tx);
1561 * Create a signature for each HTLC transaction spending a holder's commitment transaction.
1563 * Unlike sign_holder_commitment, this may be called multiple times with *different*
1564 * holder_commitment_tx values. While this will never be called with a revoked
1565 * holder_commitment_tx, it is possible that it is called with the second-latest
1566 * holder_commitment_tx (only if we haven't yet revoked it) if some watchtower/secondary
1567 * ChannelMonitor decided to broadcast before it had been updated to the latest.
1569 * Either an Err should be returned, or a Vec with one entry for each HTLC which exists in
1570 * holder_commitment_tx. For those HTLCs which have transaction_output_index set to None
1571 * (implying they were considered dust at the time the commitment transaction was negotiated),
1572 * a corresponding None should be included in the return value. All other positions in the
1573 * return value must contain a signature.
1575 LDKCResult_CVec_SignatureZNoneZ (*sign_holder_commitment_htlc_transactions)(const void *this_arg, const LDKHolderCommitmentTransaction *holder_commitment_tx);
1577 * Create a signature for the given input in a transaction spending an HTLC or commitment
1578 * transaction output when our counterparty broadcasts an old state.
1580 * A justice transaction may claim multiples outputs at the same time if timelocks are
1581 * similar, but only a signature for the input at index `input` should be signed for here.
1582 * It may be called multiples time for same output(s) if a fee-bump is needed with regards
1583 * to an upcoming timelock expiration.
1585 * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
1587 * per_commitment_key is revocation secret which was provided by our counterparty when they
1588 * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
1589 * not allow the spending of any funds by itself (you need our holder revocation_secret to do
1592 * htlc holds HTLC elements (hash, timelock) if the output being spent is a HTLC output, thus
1593 * changing the format of the witness script (which is committed to in the BIP 143
1596 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);
1598 * Create a signature for a claiming transaction for a HTLC output on a counterparty's commitment
1599 * transaction, either offered or received.
1601 * Such a transaction may claim multiples offered outputs at same time if we know the
1602 * preimage for each when we create it, but only the input at index `input` should be
1603 * signed for here. It may be called multiple times for same output(s) if a fee-bump is
1604 * needed with regards to an upcoming timelock expiration.
1606 * Witness_script is either a offered or received script as defined in BOLT3 for HTLC
1609 * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
1611 * Per_commitment_point is the dynamic point corresponding to the channel state
1612 * detected onchain. It has been generated by our counterparty and is used to derive
1613 * channel state keys, which are then included in the witness script and committed to in the
1614 * BIP 143 signature.
1616 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);
1618 * Create a signature for a (proposed) closing transaction.
1620 * Note that, due to rounding, there may be one \"missing\" satoshi, and either party may have
1621 * chosen to forgo their output as dust.
1623 LDKCResult_SignatureNoneZ (*sign_closing_transaction)(const void *this_arg, LDKTransaction closing_tx);
1625 * Signs a channel announcement message with our funding key, proving it comes from one
1626 * of the channel participants.
1628 * Note that if this fails or is rejected, the channel will not be publicly announced and
1629 * our counterparty may (though likely will not) close the channel on us for violating the
1632 LDKCResult_SignatureNoneZ (*sign_channel_announcement)(const void *this_arg, const LDKUnsignedChannelAnnouncement *msg);
1634 * Set the counterparty channel basepoints and counterparty_selected/holder_selected_contest_delay.
1635 * This is done immediately on incoming channels and as soon as the channel is accepted on outgoing channels.
1637 * We bind holder_selected_contest_delay late here for API convenience.
1639 * Will be called before any signatures are applied.
1641 void (*on_accept)(void *this_arg, const LDKChannelPublicKeys *channel_points, uint16_t counterparty_selected_contest_delay, uint16_t holder_selected_contest_delay);
1642 void *(*clone)(const void *this_arg);
1643 void (*free)(void *this_arg);
1649 * A ChannelMonitor handles chain events (blocks connected and disconnected) and generates
1650 * on-chain transactions to ensure no loss of funds occurs.
1652 * You MUST ensure that no ChannelMonitors for a given channel anywhere contain out-of-date
1653 * information and are actively monitoring the chain.
1655 * Pending Events or updated HTLCs which have not yet been read out by
1656 * get_and_clear_pending_monitor_events or get_and_clear_pending_events are serialized to disk and
1657 * reloaded at deserialize-time. Thus, you must ensure that, when handling events, all events
1658 * gotten are fully handled before re-serializing the new state.
1660 typedef struct MUST_USE_STRUCT LDKChannelMonitor {
1662 * Nearly everywhere, inner must be non-null, however in places where
1663 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1665 LDKnativeChannelMonitor *inner;
1667 } LDKChannelMonitor;
1672 * An update generated by the underlying Channel itself which contains some new information the
1673 * ChannelMonitor should be made aware of.
1675 typedef struct MUST_USE_STRUCT LDKChannelMonitorUpdate {
1677 * Nearly everywhere, inner must be non-null, however in places where
1678 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1680 LDKnativeChannelMonitorUpdate *inner;
1682 } LDKChannelMonitorUpdate;
1687 * An event to be processed by the ChannelManager.
1689 typedef struct MUST_USE_STRUCT LDKMonitorEvent {
1691 * Nearly everywhere, inner must be non-null, however in places where
1692 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1694 LDKnativeMonitorEvent *inner;
1698 typedef struct LDKCVecTempl_MonitorEvent {
1699 LDKMonitorEvent *data;
1701 } LDKCVecTempl_MonitorEvent;
1703 typedef LDKCVecTempl_MonitorEvent LDKCVec_MonitorEventZ;
1706 * The `Watch` trait defines behavior for watching on-chain activity pertaining to channels as
1707 * blocks are connected and disconnected.
1709 * Each channel is associated with a [`ChannelMonitor`]. Implementations of this trait are
1710 * responsible for maintaining a set of monitors such that they can be updated accordingly as
1711 * channel state changes and HTLCs are resolved. See method documentation for specific
1714 * Implementations **must** ensure that updates are successfully applied and persisted upon method
1715 * completion. If an update fails with a [`PermanentFailure`], then it must immediately shut down
1716 * without taking any further action such as persisting the current state.
1718 * If an implementation maintains multiple instances of a channel's monitor (e.g., by storing
1719 * backup copies), then it must ensure that updates are applied across all instances. Otherwise, it
1720 * could result in a revoked transaction being broadcast, allowing the counterparty to claim all
1721 * funds in the channel. See [`ChannelMonitorUpdateErr`] for more details about how to handle
1722 * multiple instances.
1724 * [`ChannelMonitor`]: channelmonitor/struct.ChannelMonitor.html
1725 * [`ChannelMonitorUpdateErr`]: channelmonitor/enum.ChannelMonitorUpdateErr.html
1726 * [`PermanentFailure`]: channelmonitor/enum.ChannelMonitorUpdateErr.html#variant.PermanentFailure
1728 typedef struct LDKWatch {
1731 * Watches a channel identified by `funding_txo` using `monitor`.
1733 * Implementations are responsible for watching the chain for the funding transaction along
1734 * with any spends of outputs returned by [`get_outputs_to_watch`]. In practice, this means
1735 * calling [`block_connected`] and [`block_disconnected`] on the monitor.
1737 * [`get_outputs_to_watch`]: channelmonitor/struct.ChannelMonitor.html#method.get_outputs_to_watch
1738 * [`block_connected`]: channelmonitor/struct.ChannelMonitor.html#method.block_connected
1739 * [`block_disconnected`]: channelmonitor/struct.ChannelMonitor.html#method.block_disconnected
1741 LDKCResult_NoneChannelMonitorUpdateErrZ (*watch_channel)(const void *this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor);
1743 * Updates a channel identified by `funding_txo` by applying `update` to its monitor.
1745 * Implementations must call [`update_monitor`] with the given update. See
1746 * [`ChannelMonitorUpdateErr`] for invariants around returning an error.
1748 * [`update_monitor`]: channelmonitor/struct.ChannelMonitor.html#method.update_monitor
1749 * [`ChannelMonitorUpdateErr`]: channelmonitor/enum.ChannelMonitorUpdateErr.html
1751 LDKCResult_NoneChannelMonitorUpdateErrZ (*update_channel)(const void *this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update);
1753 * Returns any monitor events since the last call. Subsequent calls must only return new
1756 LDKCVec_MonitorEventZ (*release_pending_monitor_events)(const void *this_arg);
1757 void (*free)(void *this_arg);
1761 * The `Filter` trait defines behavior for indicating chain activity of interest pertaining to
1764 * This is useful in order to have a [`Watch`] implementation convey to a chain source which
1765 * transactions to be notified of. Notification may take the form of pre-filtering blocks or, in
1766 * the case of [BIP 157]/[BIP 158], only fetching a block if the compact filter matches. If
1767 * receiving full blocks from a chain source, any further filtering is unnecessary.
1769 * After an output has been registered, subsequent block retrievals from the chain source must not
1770 * exclude any transactions matching the new criteria nor any in-block descendants of such
1773 * Note that use as part of a [`Watch`] implementation involves reentrancy. Therefore, the `Filter`
1774 * should not block on I/O. Implementations should instead queue the newly monitored data to be
1775 * processed later. Then, in order to block until the data has been processed, any `Watch`
1776 * invocation that has called the `Filter` must return [`TemporaryFailure`].
1778 * [`Watch`]: trait.Watch.html
1779 * [`TemporaryFailure`]: channelmonitor/enum.ChannelMonitorUpdateErr.html#variant.TemporaryFailure
1780 * [BIP 157]: https://github.com/bitcoin/bips/blob/master/bip-0157.mediawiki
1781 * [BIP 158]: https://github.com/bitcoin/bips/blob/master/bip-0158.mediawiki
1783 typedef struct LDKFilter {
1786 * Registers interest in a transaction with `txid` and having an output with `script_pubkey` as
1787 * a spending condition.
1789 void (*register_tx)(const void *this_arg, const uint8_t (*txid)[32], LDKu8slice script_pubkey);
1791 * Registers interest in spends of a transaction output identified by `outpoint` having
1792 * `script_pubkey` as the spending condition.
1794 void (*register_output)(const void *this_arg, const LDKOutPoint *outpoint, LDKu8slice script_pubkey);
1795 void (*free)(void *this_arg);
1799 * An interface to send a transaction to the Bitcoin network.
1801 typedef struct LDKBroadcasterInterface {
1804 * Sends a transaction out to (hopefully) be mined.
1806 void (*broadcast_transaction)(const void *this_arg, LDKTransaction tx);
1807 void (*free)(void *this_arg);
1808 } LDKBroadcasterInterface;
1811 * A trait which should be implemented to provide feerate information on a number of time
1814 * Note that all of the functions implemented here *must* be reentrant-safe (obviously - they're
1815 * called from inside the library in response to chain events, P2P events, or timer events).
1817 typedef struct LDKFeeEstimator {
1820 * Gets estimated satoshis of fee required per 1000 Weight-Units.
1822 * Must be no smaller than 253 (ie 1 satoshi-per-byte rounded up to ensure later round-downs
1823 * don't put us below 1 satoshi-per-byte).
1825 * This translates to:
1826 * * satoshis-per-byte * 250
1827 * * ceil(satoshis-per-kbyte / 4)
1829 uint32_t (*get_est_sat_per_1000_weight)(const void *this_arg, LDKConfirmationTarget confirmation_target);
1830 void (*free)(void *this_arg);
1834 * `Persist` defines behavior for persisting channel monitors: this could mean
1835 * writing once to disk, and/or uploading to one or more backup services.
1837 * Note that for every new monitor, you **must** persist the new `ChannelMonitor`
1838 * to disk/backups. And, on every update, you **must** persist either the
1839 * `ChannelMonitorUpdate` or the updated monitor itself. Otherwise, there is risk
1840 * of situations such as revoking a transaction, then crashing before this
1841 * revocation can be persisted, then unintentionally broadcasting a revoked
1842 * transaction and losing money. This is a risk because previous channel states
1843 * are toxic, so it's important that whatever channel state is persisted is
1846 typedef struct LDKPersist {
1849 * Persist a new channel's data. The data can be stored any way you want, but
1850 * the identifier provided by Rust-Lightning is the channel's outpoint (and
1851 * it is up to you to maintain a correct mapping between the outpoint and the
1852 * stored channel data). Note that you **must** persist every new monitor to
1853 * disk. See the `Persist` trait documentation for more details.
1855 * See [`ChannelMonitor::serialize_for_disk`] for writing out a `ChannelMonitor`,
1856 * and [`ChannelMonitorUpdateErr`] for requirements when returning errors.
1858 * [`ChannelMonitor::serialize_for_disk`]: struct.ChannelMonitor.html#method.serialize_for_disk
1859 * [`ChannelMonitorUpdateErr`]: enum.ChannelMonitorUpdateErr.html
1861 LDKCResult_NoneChannelMonitorUpdateErrZ (*persist_new_channel)(const void *this_arg, LDKOutPoint id, const LDKChannelMonitor *data);
1863 * Update one channel's data. The provided `ChannelMonitor` has already
1864 * applied the given update.
1866 * Note that on every update, you **must** persist either the
1867 * `ChannelMonitorUpdate` or the updated monitor itself to disk/backups. See
1868 * the `Persist` trait documentation for more details.
1870 * If an implementer chooses to persist the updates only, they need to make
1871 * sure that all the updates are applied to the `ChannelMonitors` *before*
1872 * the set of channel monitors is given to the `ChannelManager`
1873 * deserialization routine. See [`ChannelMonitor::update_monitor`] for
1874 * applying a monitor update to a monitor. If full `ChannelMonitors` are
1875 * persisted, then there is no need to persist individual updates.
1877 * Note that there could be a performance tradeoff between persisting complete
1878 * channel monitors on every update vs. persisting only updates and applying
1879 * them in batches. The size of each monitor grows `O(number of state updates)`
1880 * whereas updates are small and `O(1)`.
1882 * See [`ChannelMonitor::serialize_for_disk`] for writing out a `ChannelMonitor`,
1883 * [`ChannelMonitorUpdate::write`] for writing out an update, and
1884 * [`ChannelMonitorUpdateErr`] for requirements when returning errors.
1886 * [`ChannelMonitor::update_monitor`]: struct.ChannelMonitor.html#impl-1
1887 * [`ChannelMonitor::serialize_for_disk`]: struct.ChannelMonitor.html#method.serialize_for_disk
1888 * [`ChannelMonitorUpdate::write`]: struct.ChannelMonitorUpdate.html#method.write
1889 * [`ChannelMonitorUpdateErr`]: enum.ChannelMonitorUpdateErr.html
1891 LDKCResult_NoneChannelMonitorUpdateErrZ (*update_persisted_channel)(const void *this_arg, LDKOutPoint id, const LDKChannelMonitorUpdate *update, const LDKChannelMonitor *data);
1892 void (*free)(void *this_arg);
1898 * An implementation of [`chain::Watch`] for monitoring channels.
1900 * Connected and disconnected blocks must be provided to `ChainMonitor` as documented by
1901 * [`chain::Watch`]. May be used in conjunction with [`ChannelManager`] to monitor channels locally
1902 * or used independently to monitor channels remotely. See the [module-level documentation] for
1905 * [`chain::Watch`]: ../trait.Watch.html
1906 * [`ChannelManager`]: ../../ln/channelmanager/struct.ChannelManager.html
1907 * [module-level documentation]: index.html
1909 typedef struct MUST_USE_STRUCT LDKChainMonitor {
1911 * Nearly everywhere, inner must be non-null, however in places where
1912 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1914 LDKnativeChainMonitor *inner;
1918 typedef struct LDKCVecTempl_C2TupleTempl_usize__Transaction {
1919 LDKC2TupleTempl_usize__Transaction *data;
1921 } LDKCVecTempl_C2TupleTempl_usize__Transaction;
1923 typedef LDKCVecTempl_C2TupleTempl_usize__Transaction LDKCVec_C2Tuple_usizeTransactionZZ;
1928 * Simple structure sent back by `chain::Watch` when an HTLC from a forward channel is detected on
1929 * chain. Used to update the corresponding HTLC in the backward channel. Failing to pass the
1930 * preimage claim backward will lead to loss of funds.
1932 * [`chain::Watch`]: ../trait.Watch.html
1934 typedef struct MUST_USE_STRUCT LDKHTLCUpdate {
1936 * Nearly everywhere, inner must be non-null, however in places where
1937 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1939 LDKnativeHTLCUpdate *inner;
1943 typedef struct LDKCVecTempl_Transaction {
1944 LDKTransaction *data;
1946 } LDKCVecTempl_Transaction;
1948 typedef LDKCVecTempl_Transaction LDKCVec_TransactionZ;
1950 typedef struct LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_C2TupleTempl_u32__TxOut {
1951 LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_C2TupleTempl_u32__TxOut *data;
1953 } LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_C2TupleTempl_u32__TxOut;
1955 typedef LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_C2TupleTempl_u32__TxOut LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ;
1957 typedef struct LDKSecretKey {
1962 * A trait to describe an object which can get user secrets and key material.
1964 typedef struct LDKKeysInterface {
1967 * Get node secret key (aka node_id or network_key)
1969 LDKSecretKey (*get_node_secret)(const void *this_arg);
1971 * Get destination redeemScript to encumber static protocol exit points.
1973 LDKCVec_u8Z (*get_destination_script)(const void *this_arg);
1975 * Get shutdown_pubkey to use as PublicKey at channel closure
1977 LDKPublicKey (*get_shutdown_pubkey)(const void *this_arg);
1979 * Get a new set of ChannelKeys for per-channel secrets. These MUST be unique even if you
1980 * restarted with some stale data!
1982 LDKChannelKeys (*get_channel_keys)(const void *this_arg, bool inbound, uint64_t channel_value_satoshis);
1984 * Gets a unique, cryptographically-secure, random 32 byte value. This is used for encrypting
1985 * onion packets and for temporary channel IDs. There is no requirement that these be
1986 * persisted anywhere, though they must be unique across restarts.
1988 LDKThirtyTwoBytes (*get_secure_random_bytes)(const void *this_arg);
1989 void (*free)(void *this_arg);
1995 * A simple implementation of ChannelKeys that just keeps the private keys in memory.
1997 typedef struct MUST_USE_STRUCT LDKInMemoryChannelKeys {
1999 * Nearly everywhere, inner must be non-null, however in places where
2000 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2002 LDKnativeInMemoryChannelKeys *inner;
2004 } LDKInMemoryChannelKeys;
2009 * Simple KeysInterface implementor that takes a 32-byte seed for use as a BIP 32 extended key
2010 * and derives keys from that.
2012 * Your node_id is seed/0'
2013 * ChannelMonitor closes may use seed/1'
2014 * Cooperative closes may use seed/2'
2015 * The two close keys may be needed to claim on-chain funds!
2017 typedef struct MUST_USE_STRUCT LDKKeysManager {
2019 * Nearly everywhere, inner must be non-null, however in places where
2020 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2022 LDKnativeKeysManager *inner;
2029 * Manager which keeps track of a number of channels and sends messages to the appropriate
2030 * channel, also tracking HTLC preimages and forwarding onion packets appropriately.
2032 * Implements ChannelMessageHandler, handling the multi-channel parts and passing things through
2033 * to individual Channels.
2035 * Implements Writeable to write out all channel state to disk. Implies peer_disconnected() for
2036 * all peers during write/read (though does not modify this instance, only the instance being
2037 * serialized). This will result in any channels which have not yet exchanged funding_created (ie
2038 * called funding_transaction_generated for outbound channels).
2040 * Note that you can be a bit lazier about writing out ChannelManager than you can be with
2041 * ChannelMonitors. With ChannelMonitors you MUST write each monitor update out to disk before
2042 * returning from chain::Watch::watch_/update_channel, with ChannelManagers, writing updates
2043 * happens out-of-band (and will prevent any other ChannelManager operations from occurring during
2044 * the serialization process). If the deserialized version is out-of-date compared to the
2045 * ChannelMonitors passed by reference to read(), those channels will be force-closed based on the
2046 * ChannelMonitor state and no funds will be lost (mod on-chain transaction fees).
2048 * Note that the deserializer is only implemented for (Sha256dHash, ChannelManager), which
2049 * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
2050 * the \"reorg path\" (ie call block_disconnected() until you get to a common block and then call
2051 * block_connected() to step towards your best block) upon deserialization before using the
2054 * Note that ChannelManager is responsible for tracking liveness of its channels and generating
2055 * ChannelUpdate messages informing peers that the channel is temporarily disabled. To avoid
2056 * spam due to quick disconnection/reconnection, updates are not sent until the channel has been
2057 * offline for a full minute. In order to track this, you must call
2058 * timer_chan_freshness_every_min roughly once per minute, though it doesn't have to be perfect.
2060 * Rather than using a plain ChannelManager, it is preferable to use either a SimpleArcChannelManager
2061 * a SimpleRefChannelManager, for conciseness. See their documentation for more details, but
2062 * essentially you should default to using a SimpleRefChannelManager, and use a
2063 * SimpleArcChannelManager when you require a ChannelManager with a static lifetime, such as when
2064 * you're using lightning-net-tokio.
2066 typedef struct MUST_USE_STRUCT LDKChannelManager {
2068 * Nearly everywhere, inner must be non-null, however in places where
2069 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2071 LDKnativeChannelManager *inner;
2073 } LDKChannelManager;
2078 * Details of a channel, as returned by ChannelManager::list_channels and ChannelManager::list_usable_channels
2080 typedef struct MUST_USE_STRUCT LDKChannelDetails {
2082 * Nearly everywhere, inner must be non-null, however in places where
2083 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2085 LDKnativeChannelDetails *inner;
2087 } LDKChannelDetails;
2092 * Features used within an `init` message.
2094 typedef struct MUST_USE_STRUCT LDKInitFeatures {
2096 * Nearly everywhere, inner must be non-null, however in places where
2097 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2099 LDKnativeInitFeatures *inner;
2103 typedef struct LDKCVecTempl_ChannelDetails {
2104 LDKChannelDetails *data;
2106 } LDKCVecTempl_ChannelDetails;
2108 typedef LDKCVecTempl_ChannelDetails LDKCVec_ChannelDetailsZ;
2113 * A route directs a payment from the sender (us) to the recipient. If the recipient supports MPP,
2114 * it can take multiple paths. Each path is composed of one or more hops through the network.
2116 typedef struct MUST_USE_STRUCT LDKRoute {
2118 * Nearly everywhere, inner must be non-null, however in places where
2119 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2121 LDKnativeRoute *inner;
2125 typedef struct LDKThreeBytes {
2129 typedef struct LDKFourBytes {
2133 typedef struct LDKSixteenBytes {
2137 typedef struct LDKTenBytes {
2142 * An address which can be used to connect to a remote peer
2144 typedef enum LDKNetAddress_Tag {
2146 * An IPv4 address/port on which the peer is listening.
2150 * An IPv6 address/port on which the peer is listening.
2154 * An old-style Tor onion address/port on which the peer is listening.
2156 LDKNetAddress_OnionV2,
2158 * A new-style Tor onion address/port on which the peer is listening.
2159 * To create the human-readable \"hostname\", concatenate ed25519_pubkey, checksum, and version,
2160 * wrap as base32 and append \".onion\".
2162 LDKNetAddress_OnionV3,
2164 * Must be last for serialization purposes
2166 LDKNetAddress_Sentinel,
2167 } LDKNetAddress_Tag;
2169 typedef struct LDKNetAddress_LDKIPv4_Body {
2172 } LDKNetAddress_LDKIPv4_Body;
2174 typedef struct LDKNetAddress_LDKIPv6_Body {
2175 LDKSixteenBytes addr;
2177 } LDKNetAddress_LDKIPv6_Body;
2179 typedef struct LDKNetAddress_LDKOnionV2_Body {
2182 } LDKNetAddress_LDKOnionV2_Body;
2184 typedef struct LDKNetAddress_LDKOnionV3_Body {
2185 LDKThirtyTwoBytes ed25519_pubkey;
2189 } LDKNetAddress_LDKOnionV3_Body;
2191 typedef struct LDKNetAddress {
2192 LDKNetAddress_Tag tag;
2194 LDKNetAddress_LDKIPv4_Body i_pv4;
2195 LDKNetAddress_LDKIPv6_Body i_pv6;
2196 LDKNetAddress_LDKOnionV2_Body onion_v2;
2197 LDKNetAddress_LDKOnionV3_Body onion_v3;
2201 typedef struct LDKCVecTempl_NetAddress {
2202 LDKNetAddress *data;
2204 } LDKCVecTempl_NetAddress;
2206 typedef LDKCVecTempl_NetAddress LDKCVec_NetAddressZ;
2211 * An update_add_htlc message to be sent or received from a peer
2213 typedef struct MUST_USE_STRUCT LDKUpdateAddHTLC {
2215 * Nearly everywhere, inner must be non-null, however in places where
2216 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2218 LDKnativeUpdateAddHTLC *inner;
2225 * An update_fulfill_htlc message to be sent or received from a peer
2227 typedef struct MUST_USE_STRUCT LDKUpdateFulfillHTLC {
2229 * Nearly everywhere, inner must be non-null, however in places where
2230 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2232 LDKnativeUpdateFulfillHTLC *inner;
2234 } LDKUpdateFulfillHTLC;
2239 * An update_fail_htlc message to be sent or received from a peer
2241 typedef struct MUST_USE_STRUCT LDKUpdateFailHTLC {
2243 * Nearly everywhere, inner must be non-null, however in places where
2244 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2246 LDKnativeUpdateFailHTLC *inner;
2248 } LDKUpdateFailHTLC;
2253 * An update_fail_malformed_htlc message to be sent or received from a peer
2255 typedef struct MUST_USE_STRUCT LDKUpdateFailMalformedHTLC {
2257 * Nearly everywhere, inner must be non-null, however in places where
2258 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2260 LDKnativeUpdateFailMalformedHTLC *inner;
2262 } LDKUpdateFailMalformedHTLC;
2267 * A commitment_signed message to be sent or received from a peer
2269 typedef struct MUST_USE_STRUCT LDKCommitmentSigned {
2271 * Nearly everywhere, inner must be non-null, however in places where
2272 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2274 LDKnativeCommitmentSigned *inner;
2276 } LDKCommitmentSigned;
2281 * An update_fee message to be sent or received from a peer
2283 typedef struct MUST_USE_STRUCT LDKUpdateFee {
2285 * Nearly everywhere, inner must be non-null, however in places where
2286 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2288 LDKnativeUpdateFee *inner;
2295 * An init message to be sent or received from a peer
2297 typedef struct MUST_USE_STRUCT LDKInit {
2299 * Nearly everywhere, inner must be non-null, however in places where
2300 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2302 LDKnativeInit *inner;
2307 * A trait to describe an object which can receive channel messages.
2309 * Messages MAY be called in parallel when they originate from different their_node_ids, however
2310 * they MUST NOT be called in parallel when the two calls have the same their_node_id.
2312 typedef struct LDKChannelMessageHandler {
2315 * Handle an incoming open_channel message from the given peer.
2317 void (*handle_open_channel)(const void *this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel *msg);
2319 * Handle an incoming accept_channel message from the given peer.
2321 void (*handle_accept_channel)(const void *this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel *msg);
2323 * Handle an incoming funding_created message from the given peer.
2325 void (*handle_funding_created)(const void *this_arg, LDKPublicKey their_node_id, const LDKFundingCreated *msg);
2327 * Handle an incoming funding_signed message from the given peer.
2329 void (*handle_funding_signed)(const void *this_arg, LDKPublicKey their_node_id, const LDKFundingSigned *msg);
2331 * Handle an incoming funding_locked message from the given peer.
2333 void (*handle_funding_locked)(const void *this_arg, LDKPublicKey their_node_id, const LDKFundingLocked *msg);
2335 * Handle an incoming shutdown message from the given peer.
2337 void (*handle_shutdown)(const void *this_arg, LDKPublicKey their_node_id, const LDKShutdown *msg);
2339 * Handle an incoming closing_signed message from the given peer.
2341 void (*handle_closing_signed)(const void *this_arg, LDKPublicKey their_node_id, const LDKClosingSigned *msg);
2343 * Handle an incoming update_add_htlc message from the given peer.
2345 void (*handle_update_add_htlc)(const void *this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC *msg);
2347 * Handle an incoming update_fulfill_htlc message from the given peer.
2349 void (*handle_update_fulfill_htlc)(const void *this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC *msg);
2351 * Handle an incoming update_fail_htlc message from the given peer.
2353 void (*handle_update_fail_htlc)(const void *this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC *msg);
2355 * Handle an incoming update_fail_malformed_htlc message from the given peer.
2357 void (*handle_update_fail_malformed_htlc)(const void *this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC *msg);
2359 * Handle an incoming commitment_signed message from the given peer.
2361 void (*handle_commitment_signed)(const void *this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned *msg);
2363 * Handle an incoming revoke_and_ack message from the given peer.
2365 void (*handle_revoke_and_ack)(const void *this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK *msg);
2367 * Handle an incoming update_fee message from the given peer.
2369 void (*handle_update_fee)(const void *this_arg, LDKPublicKey their_node_id, const LDKUpdateFee *msg);
2371 * Handle an incoming announcement_signatures message from the given peer.
2373 void (*handle_announcement_signatures)(const void *this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures *msg);
2375 * Indicates a connection to the peer failed/an existing connection was lost. If no connection
2376 * is believed to be possible in the future (eg they're sending us messages we don't
2377 * understand or indicate they require unknown feature bits), no_connection_possible is set
2378 * and any outstanding channels should be failed.
2380 void (*peer_disconnected)(const void *this_arg, LDKPublicKey their_node_id, bool no_connection_possible);
2382 * Handle a peer reconnecting, possibly generating channel_reestablish message(s).
2384 void (*peer_connected)(const void *this_arg, LDKPublicKey their_node_id, const LDKInit *msg);
2386 * Handle an incoming channel_reestablish message from the given peer.
2388 void (*handle_channel_reestablish)(const void *this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish *msg);
2390 * Handle an incoming error message from the given peer.
2392 void (*handle_error)(const void *this_arg, LDKPublicKey their_node_id, const LDKErrorMessage *msg);
2393 LDKMessageSendEventsProvider MessageSendEventsProvider;
2394 void (*free)(void *this_arg);
2395 } LDKChannelMessageHandler;
2400 * Arguments for the creation of a ChannelManager that are not deserialized.
2402 * At a high-level, the process for deserializing a ChannelManager and resuming normal operation
2404 * 1) Deserialize all stored ChannelMonitors.
2405 * 2) Deserialize the ChannelManager by filling in this struct and calling <(Sha256dHash,
2406 * ChannelManager)>::read(reader, args).
2407 * This may result in closing some Channels if the ChannelMonitor is newer than the stored
2408 * ChannelManager state to ensure no loss of funds. Thus, transactions may be broadcasted.
2409 * 3) Register all relevant ChannelMonitor outpoints with your chain watch mechanism using
2410 * ChannelMonitor::get_outputs_to_watch() and ChannelMonitor::get_funding_txo().
2411 * 4) Reconnect blocks on your ChannelMonitors.
2412 * 5) Move the ChannelMonitors into your local chain::Watch.
2413 * 6) Disconnect/connect blocks on the ChannelManager.
2415 typedef struct MUST_USE_STRUCT LDKChannelManagerReadArgs {
2417 * Nearly everywhere, inner must be non-null, however in places where
2418 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2420 LDKnativeChannelManagerReadArgs *inner;
2422 } LDKChannelManagerReadArgs;
2424 typedef struct LDKCVecTempl_ChannelMonitor {
2425 LDKChannelMonitor *data;
2427 } LDKCVecTempl_ChannelMonitor;
2429 typedef LDKCVecTempl_ChannelMonitor LDKCVec_ChannelMonitorZ;
2434 * An error in decoding a message or struct.
2436 typedef struct MUST_USE_STRUCT LDKDecodeError {
2438 * Nearly everywhere, inner must be non-null, however in places where
2439 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2441 LDKnativeDecodeError *inner;
2448 * A ping message to be sent or received from a peer
2450 typedef struct MUST_USE_STRUCT LDKPing {
2452 * Nearly everywhere, inner must be non-null, however in places where
2453 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2455 LDKnativePing *inner;
2462 * A pong message to be sent or received from a peer
2464 typedef struct MUST_USE_STRUCT LDKPong {
2466 * Nearly everywhere, inner must be non-null, however in places where
2467 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2469 LDKnativePong *inner;
2476 * Proof that the sender knows the per-commitment secret of the previous commitment transaction.
2477 * This is used to convince the recipient that the channel is at a certain commitment
2478 * number even if they lost that data due to a local failure. Of course, the peer may lie
2479 * and even later commitments may have been revoked.
2481 typedef struct MUST_USE_STRUCT LDKDataLossProtect {
2483 * Nearly everywhere, inner must be non-null, however in places where
2484 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2486 LDKnativeDataLossProtect *inner;
2488 } LDKDataLossProtect;
2493 * The unsigned part of a node_announcement
2495 typedef struct MUST_USE_STRUCT LDKUnsignedNodeAnnouncement {
2497 * Nearly everywhere, inner must be non-null, however in places where
2498 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2500 LDKnativeUnsignedNodeAnnouncement *inner;
2502 } LDKUnsignedNodeAnnouncement;
2507 * Features used within a `node_announcement` message.
2509 typedef struct MUST_USE_STRUCT LDKNodeFeatures {
2511 * Nearly everywhere, inner must be non-null, however in places where
2512 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2514 LDKnativeNodeFeatures *inner;
2521 * Features used within a `channel_announcement` message.
2523 typedef struct MUST_USE_STRUCT LDKChannelFeatures {
2525 * Nearly everywhere, inner must be non-null, however in places where
2526 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2528 LDKnativeChannelFeatures *inner;
2530 } LDKChannelFeatures;
2535 * The unsigned part of a channel_update
2537 typedef struct MUST_USE_STRUCT LDKUnsignedChannelUpdate {
2539 * Nearly everywhere, inner must be non-null, however in places where
2540 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2542 LDKnativeUnsignedChannelUpdate *inner;
2544 } LDKUnsignedChannelUpdate;
2549 * A query_channel_range message is used to query a peer for channel
2550 * UTXOs in a range of blocks. The recipient of a query makes a best
2551 * effort to reply to the query using one or more reply_channel_range
2554 typedef struct MUST_USE_STRUCT LDKQueryChannelRange {
2556 * Nearly everywhere, inner must be non-null, however in places where
2557 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2559 LDKnativeQueryChannelRange *inner;
2561 } LDKQueryChannelRange;
2566 * A reply_channel_range message is a reply to a query_channel_range
2567 * message. Multiple reply_channel_range messages can be sent in reply
2568 * to a single query_channel_range message. The query recipient makes a
2569 * best effort to respond based on their local network view which may
2570 * not be a perfect view of the network. The short_channel_ids in the
2571 * reply are encoded. We only support encoding_type=0 uncompressed
2572 * serialization and do not support encoding_type=1 zlib serialization.
2574 typedef struct MUST_USE_STRUCT LDKReplyChannelRange {
2576 * Nearly everywhere, inner must be non-null, however in places where
2577 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2579 LDKnativeReplyChannelRange *inner;
2581 } LDKReplyChannelRange;
2583 typedef struct LDKCVecTempl_u64 {
2588 typedef LDKCVecTempl_u64 LDKCVec_u64Z;
2593 * A query_short_channel_ids message is used to query a peer for
2594 * routing gossip messages related to one or more short_channel_ids.
2595 * The query recipient will reply with the latest, if available,
2596 * channel_announcement, channel_update and node_announcement messages
2597 * it maintains for the requested short_channel_ids followed by a
2598 * reply_short_channel_ids_end message. The short_channel_ids sent in
2599 * this query are encoded. We only support encoding_type=0 uncompressed
2600 * serialization and do not support encoding_type=1 zlib serialization.
2602 typedef struct MUST_USE_STRUCT LDKQueryShortChannelIds {
2604 * Nearly everywhere, inner must be non-null, however in places where
2605 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2607 LDKnativeQueryShortChannelIds *inner;
2609 } LDKQueryShortChannelIds;
2614 * A reply_short_channel_ids_end message is sent as a reply to a
2615 * query_short_channel_ids message. The query recipient makes a best
2616 * effort to respond based on their local network view which may not be
2617 * a perfect view of the network.
2619 typedef struct MUST_USE_STRUCT LDKReplyShortChannelIdsEnd {
2621 * Nearly everywhere, inner must be non-null, however in places where
2622 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2624 LDKnativeReplyShortChannelIdsEnd *inner;
2626 } LDKReplyShortChannelIdsEnd;
2631 * A gossip_timestamp_filter message is used by a node to request
2632 * gossip relay for messages in the requested time range when the
2633 * gossip_queries feature has been negotiated.
2635 typedef struct MUST_USE_STRUCT LDKGossipTimestampFilter {
2637 * Nearly everywhere, inner must be non-null, however in places where
2638 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2640 LDKnativeGossipTimestampFilter *inner;
2642 } LDKGossipTimestampFilter;
2647 * An Err type for failure to process messages.
2649 typedef struct MUST_USE_STRUCT LDKLightningError {
2651 * Nearly everywhere, inner must be non-null, however in places where
2652 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2654 LDKnativeLightningError *inner;
2656 } LDKLightningError;
2658 typedef struct LDKCVecTempl_UpdateAddHTLC {
2659 LDKUpdateAddHTLC *data;
2661 } LDKCVecTempl_UpdateAddHTLC;
2663 typedef LDKCVecTempl_UpdateAddHTLC LDKCVec_UpdateAddHTLCZ;
2665 typedef struct LDKCVecTempl_UpdateFulfillHTLC {
2666 LDKUpdateFulfillHTLC *data;
2668 } LDKCVecTempl_UpdateFulfillHTLC;
2670 typedef LDKCVecTempl_UpdateFulfillHTLC LDKCVec_UpdateFulfillHTLCZ;
2672 typedef struct LDKCVecTempl_UpdateFailHTLC {
2673 LDKUpdateFailHTLC *data;
2675 } LDKCVecTempl_UpdateFailHTLC;
2677 typedef LDKCVecTempl_UpdateFailHTLC LDKCVec_UpdateFailHTLCZ;
2679 typedef struct LDKCVecTempl_UpdateFailMalformedHTLC {
2680 LDKUpdateFailMalformedHTLC *data;
2682 } LDKCVecTempl_UpdateFailMalformedHTLC;
2684 typedef LDKCVecTempl_UpdateFailMalformedHTLC LDKCVec_UpdateFailMalformedHTLCZ;
2686 typedef union LDKCResultPtr_bool__LightningError {
2688 LDKLightningError *err;
2689 } LDKCResultPtr_bool__LightningError;
2691 typedef struct LDKCResultTempl_bool__LightningError {
2692 LDKCResultPtr_bool__LightningError contents;
2694 } LDKCResultTempl_bool__LightningError;
2696 typedef LDKCResultTempl_bool__LightningError LDKCResult_boolLightningErrorZ;
2698 typedef struct LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate {
2699 LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate *data;
2701 } LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate;
2703 typedef LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ;
2705 typedef struct LDKCVecTempl_NodeAnnouncement {
2706 LDKNodeAnnouncement *data;
2708 } LDKCVecTempl_NodeAnnouncement;
2710 typedef LDKCVecTempl_NodeAnnouncement LDKCVec_NodeAnnouncementZ;
2713 * A trait to describe an object which can receive routing messages.
2715 typedef struct LDKRoutingMessageHandler {
2718 * Handle an incoming node_announcement message, returning true if it should be forwarded on,
2719 * false or returning an Err otherwise.
2721 LDKCResult_boolLightningErrorZ (*handle_node_announcement)(const void *this_arg, const LDKNodeAnnouncement *msg);
2723 * Handle a channel_announcement message, returning true if it should be forwarded on, false
2724 * or returning an Err otherwise.
2726 LDKCResult_boolLightningErrorZ (*handle_channel_announcement)(const void *this_arg, const LDKChannelAnnouncement *msg);
2728 * Handle an incoming channel_update message, returning true if it should be forwarded on,
2729 * false or returning an Err otherwise.
2731 LDKCResult_boolLightningErrorZ (*handle_channel_update)(const void *this_arg, const LDKChannelUpdate *msg);
2733 * Handle some updates to the route graph that we learned due to an outbound failed payment.
2735 void (*handle_htlc_fail_channel_update)(const void *this_arg, const LDKHTLCFailChannelUpdate *update);
2737 * Gets a subset of the channel announcements and updates required to dump our routing table
2738 * to a remote node, starting at the short_channel_id indicated by starting_point and
2739 * including the batch_amount entries immediately higher in numerical value than starting_point.
2741 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ (*get_next_channel_announcements)(const void *this_arg, uint64_t starting_point, uint8_t batch_amount);
2743 * Gets a subset of the node announcements required to dump our routing table to a remote node,
2744 * starting at the node *after* the provided publickey and including batch_amount entries
2745 * immediately higher (as defined by <PublicKey as Ord>::cmp) than starting_point.
2746 * If None is provided for starting_point, we start at the first node.
2748 LDKCVec_NodeAnnouncementZ (*get_next_node_announcements)(const void *this_arg, LDKPublicKey starting_point, uint8_t batch_amount);
2750 * Returns whether a full sync should be requested from a peer.
2752 bool (*should_request_full_sync)(const void *this_arg, LDKPublicKey node_id);
2753 void (*free)(void *this_arg);
2754 } LDKRoutingMessageHandler;
2759 * Provides references to trait impls which handle different types of messages.
2761 typedef struct MUST_USE_STRUCT LDKMessageHandler {
2763 * Nearly everywhere, inner must be non-null, however in places where
2764 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2766 LDKnativeMessageHandler *inner;
2768 } LDKMessageHandler;
2771 * Provides an object which can be used to send data to and which uniquely identifies a connection
2772 * to a remote host. You will need to be able to generate multiple of these which meet Eq and
2773 * implement Hash to meet the PeerManager API.
2775 * For efficiency, Clone should be relatively cheap for this type.
2777 * You probably want to just extend an int and put a file descriptor in a struct and implement
2778 * send_data. Note that if you are using a higher-level net library that may call close() itself,
2779 * be careful to ensure you don't have races whereby you might register a new connection with an
2780 * fd which is the same as a previous one which has yet to be removed via
2781 * PeerManager::socket_disconnected().
2783 typedef struct LDKSocketDescriptor {
2786 * Attempts to send some data from the given slice to the peer.
2788 * Returns the amount of data which was sent, possibly 0 if the socket has since disconnected.
2789 * Note that in the disconnected case, socket_disconnected must still fire and further write
2790 * attempts may occur until that time.
2792 * If the returned size is smaller than data.len(), a write_available event must
2793 * trigger the next time more data can be written. Additionally, until the a send_data event
2794 * completes fully, no further read_events should trigger on the same peer!
2796 * If a read_event on this descriptor had previously returned true (indicating that read
2797 * events should be paused to prevent DoS in the send buffer), resume_read may be set
2798 * indicating that read events on this descriptor should resume. A resume_read of false does
2799 * *not* imply that further read events should be paused.
2801 uintptr_t (*send_data)(void *this_arg, LDKu8slice data, bool resume_read);
2803 * Disconnect the socket pointed to by this SocketDescriptor. Once this function returns, no
2804 * more calls to write_buffer_space_avail, read_event or socket_disconnected may be made with
2805 * this descriptor. No socket_disconnected call should be generated as a result of this call,
2806 * though races may occur whereby disconnect_socket is called after a call to
2807 * socket_disconnected but prior to socket_disconnected returning.
2809 void (*disconnect_socket)(void *this_arg);
2810 bool (*eq)(const void *this_arg, const LDKSocketDescriptor *other_arg);
2811 uint64_t (*hash)(const void *this_arg);
2812 void *(*clone)(const void *this_arg);
2813 void (*free)(void *this_arg);
2814 } LDKSocketDescriptor;
2819 * A PeerManager manages a set of peers, described by their SocketDescriptor and marshalls socket
2820 * events into messages which it passes on to its MessageHandlers.
2822 * Rather than using a plain PeerManager, it is preferable to use either a SimpleArcPeerManager
2823 * a SimpleRefPeerManager, for conciseness. See their documentation for more details, but
2824 * essentially you should default to using a SimpleRefPeerManager, and use a
2825 * SimpleArcPeerManager when you require a PeerManager with a static lifetime, such as when
2826 * you're using lightning-net-tokio.
2828 typedef struct MUST_USE_STRUCT LDKPeerManager {
2830 * Nearly everywhere, inner must be non-null, however in places where
2831 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2833 LDKnativePeerManager *inner;
2837 typedef struct LDKCVecTempl_PublicKey {
2840 } LDKCVecTempl_PublicKey;
2842 typedef LDKCVecTempl_PublicKey LDKCVec_PublicKeyZ;
2844 typedef union LDKCResultPtr_CVecTempl_u8_____PeerHandleError {
2845 LDKCVecTempl_u8 *result;
2846 LDKPeerHandleError *err;
2847 } LDKCResultPtr_CVecTempl_u8_____PeerHandleError;
2849 typedef struct LDKCResultTempl_CVecTempl_u8_____PeerHandleError {
2850 LDKCResultPtr_CVecTempl_u8_____PeerHandleError contents;
2852 } LDKCResultTempl_CVecTempl_u8_____PeerHandleError;
2854 typedef LDKCResultTempl_CVecTempl_u8_____PeerHandleError LDKCResult_CVec_u8ZPeerHandleErrorZ;
2856 typedef union LDKCResultPtr_bool__PeerHandleError {
2858 LDKPeerHandleError *err;
2859 } LDKCResultPtr_bool__PeerHandleError;
2861 typedef struct LDKCResultTempl_bool__PeerHandleError {
2862 LDKCResultPtr_bool__PeerHandleError contents;
2864 } LDKCResultTempl_bool__PeerHandleError;
2866 typedef LDKCResultTempl_bool__PeerHandleError LDKCResult_boolPeerHandleErrorZ;
2868 typedef union LDKCResultPtr_SecretKey__Secp256k1Error {
2869 LDKSecretKey *result;
2870 LDKSecp256k1Error *err;
2871 } LDKCResultPtr_SecretKey__Secp256k1Error;
2873 typedef struct LDKCResultTempl_SecretKey__Secp256k1Error {
2874 LDKCResultPtr_SecretKey__Secp256k1Error contents;
2876 } LDKCResultTempl_SecretKey__Secp256k1Error;
2878 typedef LDKCResultTempl_SecretKey__Secp256k1Error LDKCResult_SecretKeySecpErrorZ;
2880 typedef union LDKCResultPtr_PublicKey__Secp256k1Error {
2881 LDKPublicKey *result;
2882 LDKSecp256k1Error *err;
2883 } LDKCResultPtr_PublicKey__Secp256k1Error;
2885 typedef struct LDKCResultTempl_PublicKey__Secp256k1Error {
2886 LDKCResultPtr_PublicKey__Secp256k1Error contents;
2888 } LDKCResultTempl_PublicKey__Secp256k1Error;
2890 typedef LDKCResultTempl_PublicKey__Secp256k1Error LDKCResult_PublicKeySecpErrorZ;
2895 * The set of public keys which are used in the creation of one commitment transaction.
2896 * These are derived from the channel base keys and per-commitment data.
2898 * A broadcaster key is provided from potential broadcaster of the computed transaction.
2899 * A countersignatory key is coming from a protocol participant unable to broadcast the
2902 * These keys are assumed to be good, either because the code derived them from
2903 * channel basepoints via the new function, or they were obtained via
2904 * PreCalculatedTxCreationKeys.trust_key_derivation because we trusted the source of the
2905 * pre-calculated keys.
2907 typedef struct MUST_USE_STRUCT LDKTxCreationKeys {
2909 * Nearly everywhere, inner must be non-null, however in places where
2910 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2912 LDKnativeTxCreationKeys *inner;
2914 } LDKTxCreationKeys;
2916 typedef union LDKCResultPtr_TxCreationKeys__Secp256k1Error {
2917 LDKTxCreationKeys *result;
2918 LDKSecp256k1Error *err;
2919 } LDKCResultPtr_TxCreationKeys__Secp256k1Error;
2921 typedef struct LDKCResultTempl_TxCreationKeys__Secp256k1Error {
2922 LDKCResultPtr_TxCreationKeys__Secp256k1Error contents;
2924 } LDKCResultTempl_TxCreationKeys__Secp256k1Error;
2926 typedef LDKCResultTempl_TxCreationKeys__Secp256k1Error LDKCResult_TxCreationKeysSecpErrorZ;
2928 typedef struct LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature {
2929 LDKC2TupleTempl_HTLCOutputInCommitment__Signature *data;
2931 } LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature;
2933 typedef LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ;
2940 typedef struct MUST_USE_STRUCT LDKRouteHop {
2942 * Nearly everywhere, inner must be non-null, however in places where
2943 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2945 LDKnativeRouteHop *inner;
2949 typedef struct LDKCVecTempl_RouteHop {
2952 } LDKCVecTempl_RouteHop;
2954 typedef struct LDKCVecTempl_CVecTempl_RouteHop {
2955 LDKCVecTempl_RouteHop *data;
2957 } LDKCVecTempl_CVecTempl_RouteHop;
2959 typedef LDKCVecTempl_CVecTempl_RouteHop LDKCVec_CVec_RouteHopZZ;
2964 * A channel descriptor which provides a last-hop route to get_route
2966 typedef struct MUST_USE_STRUCT LDKRouteHint {
2968 * Nearly everywhere, inner must be non-null, however in places where
2969 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2971 LDKnativeRouteHint *inner;
2978 * Fees for routing via a given channel or a node
2980 typedef struct MUST_USE_STRUCT LDKRoutingFees {
2982 * Nearly everywhere, inner must be non-null, however in places where
2983 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2985 LDKnativeRoutingFees *inner;
2989 typedef union LDKCResultPtr_Route__LightningError {
2991 LDKLightningError *err;
2992 } LDKCResultPtr_Route__LightningError;
2994 typedef struct LDKCResultTempl_Route__LightningError {
2995 LDKCResultPtr_Route__LightningError contents;
2997 } LDKCResultTempl_Route__LightningError;
2999 typedef LDKCResultTempl_Route__LightningError LDKCResult_RouteLightningErrorZ;
3004 * Represents the network as nodes and channels between them
3006 typedef struct MUST_USE_STRUCT LDKNetworkGraph {
3008 * Nearly everywhere, inner must be non-null, however in places where
3009 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3011 LDKnativeNetworkGraph *inner;
3015 typedef struct LDKCVecTempl_RouteHint {
3018 } LDKCVecTempl_RouteHint;
3020 typedef LDKCVecTempl_RouteHint LDKCVec_RouteHintZ;
3025 * A simple newtype for RwLockReadGuard<'a, NetworkGraph>.
3026 * This exists only to make accessing a RwLock<NetworkGraph> possible from
3027 * the C bindings, as it can be done directly in Rust code.
3029 typedef struct MUST_USE_STRUCT LDKLockedNetworkGraph {
3031 * Nearly everywhere, inner must be non-null, however in places where
3032 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3034 LDKnativeLockedNetworkGraph *inner;
3036 } LDKLockedNetworkGraph;
3041 * Receives and validates network updates from peers,
3042 * stores authentic and relevant data as a network graph.
3043 * This network graph is then used for routing payments.
3044 * Provides interface to help with initial routing sync by
3045 * serving historical announcements.
3047 typedef struct MUST_USE_STRUCT LDKNetGraphMsgHandler {
3049 * Nearly everywhere, inner must be non-null, however in places where
3050 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3052 LDKnativeNetGraphMsgHandler *inner;
3054 } LDKNetGraphMsgHandler;
3059 * Details about one direction of a channel. Received
3060 * within a channel update.
3062 typedef struct MUST_USE_STRUCT LDKDirectionalChannelInfo {
3064 * Nearly everywhere, inner must be non-null, however in places where
3065 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3067 LDKnativeDirectionalChannelInfo *inner;
3069 } LDKDirectionalChannelInfo;
3074 * Details about a channel (both directions).
3075 * Received within a channel announcement.
3077 typedef struct MUST_USE_STRUCT LDKChannelInfo {
3079 * Nearly everywhere, inner must be non-null, however in places where
3080 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3082 LDKnativeChannelInfo *inner;
3089 * Information received in the latest node_announcement from this node.
3091 typedef struct MUST_USE_STRUCT LDKNodeAnnouncementInfo {
3093 * Nearly everywhere, inner must be non-null, however in places where
3094 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3096 LDKnativeNodeAnnouncementInfo *inner;
3098 } LDKNodeAnnouncementInfo;
3103 * Details about a node in the network, known from the network announcement.
3105 typedef struct MUST_USE_STRUCT LDKNodeInfo {
3107 * Nearly everywhere, inner must be non-null, however in places where
3108 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3110 LDKnativeNodeInfo *inner;
3114 typedef LDKCVecTempl_RouteHop LDKCVec_RouteHopZ;
3116 extern const void (*C2Tuple_HTLCOutputInCommitmentSignatureZ_free)(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ);
3118 extern const void (*C2Tuple_OutPointScriptZ_free)(LDKC2Tuple_OutPointScriptZ);
3120 extern const void (*C2Tuple_SignatureCVec_SignatureZZ_free)(LDKC2Tuple_SignatureCVec_SignatureZZ);
3122 extern const void (*C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free)(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ);
3124 extern const void (*C2Tuple_u32TxOutZ_free)(LDKC2Tuple_u32TxOutZ);
3126 extern const void (*C2Tuple_u64u64Z_free)(LDKC2Tuple_u64u64Z);
3128 extern const void (*C2Tuple_usizeTransactionZ_free)(LDKC2Tuple_usizeTransactionZ);
3130 extern const void (*C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free)(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ);
3132 extern const uint64_t CLOSED_CHANNEL_UPDATE_ID;
3134 extern const void (*CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free)(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ);
3136 extern const LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok)(LDKC2Tuple_SignatureCVec_SignatureZZ);
3138 extern const void (*CResult_CVec_SignatureZNoneZ_free)(LDKCResult_CVec_SignatureZNoneZ);
3140 extern const LDKCResult_CVec_SignatureZNoneZ (*CResult_CVec_SignatureZNoneZ_ok)(LDKCVec_SignatureZ);
3142 extern const LDKCResult_CVec_u8ZPeerHandleErrorZ (*CResult_CVec_u8ZPeerHandleErrorZ_err)(LDKPeerHandleError);
3144 extern const void (*CResult_CVec_u8ZPeerHandleErrorZ_free)(LDKCResult_CVec_u8ZPeerHandleErrorZ);
3146 extern const LDKCResult_CVec_u8ZPeerHandleErrorZ (*CResult_CVec_u8ZPeerHandleErrorZ_ok)(LDKCVec_u8Z);
3148 extern const LDKCResult_NoneAPIErrorZ (*CResult_NoneAPIErrorZ_err)(LDKAPIError);
3150 extern const void (*CResult_NoneAPIErrorZ_free)(LDKCResult_NoneAPIErrorZ);
3152 extern const LDKCResult_NoneChannelMonitorUpdateErrZ (*CResult_NoneChannelMonitorUpdateErrZ_err)(LDKChannelMonitorUpdateErr);
3154 extern const void (*CResult_NoneChannelMonitorUpdateErrZ_free)(LDKCResult_NoneChannelMonitorUpdateErrZ);
3156 extern const LDKCResult_NoneMonitorUpdateErrorZ (*CResult_NoneMonitorUpdateErrorZ_err)(LDKMonitorUpdateError);
3158 extern const void (*CResult_NoneMonitorUpdateErrorZ_free)(LDKCResult_NoneMonitorUpdateErrorZ);
3160 extern const LDKCResult_NonePaymentSendFailureZ (*CResult_NonePaymentSendFailureZ_err)(LDKPaymentSendFailure);
3162 extern const void (*CResult_NonePaymentSendFailureZ_free)(LDKCResult_NonePaymentSendFailureZ);
3164 extern const LDKCResult_NonePeerHandleErrorZ (*CResult_NonePeerHandleErrorZ_err)(LDKPeerHandleError);
3166 extern const void (*CResult_NonePeerHandleErrorZ_free)(LDKCResult_NonePeerHandleErrorZ);
3168 extern const LDKCResult_PublicKeySecpErrorZ (*CResult_PublicKeySecpErrorZ_err)(LDKSecp256k1Error);
3170 extern const void (*CResult_PublicKeySecpErrorZ_free)(LDKCResult_PublicKeySecpErrorZ);
3172 extern const LDKCResult_PublicKeySecpErrorZ (*CResult_PublicKeySecpErrorZ_ok)(LDKPublicKey);
3174 extern const LDKCResult_RouteLightningErrorZ (*CResult_RouteLightningErrorZ_err)(LDKLightningError);
3176 extern const void (*CResult_RouteLightningErrorZ_free)(LDKCResult_RouteLightningErrorZ);
3178 extern const LDKCResult_RouteLightningErrorZ (*CResult_RouteLightningErrorZ_ok)(LDKRoute);
3180 extern const LDKCResult_SecretKeySecpErrorZ (*CResult_SecretKeySecpErrorZ_err)(LDKSecp256k1Error);
3182 extern const void (*CResult_SecretKeySecpErrorZ_free)(LDKCResult_SecretKeySecpErrorZ);
3184 extern const LDKCResult_SecretKeySecpErrorZ (*CResult_SecretKeySecpErrorZ_ok)(LDKSecretKey);
3186 extern const void (*CResult_SignatureNoneZ_free)(LDKCResult_SignatureNoneZ);
3188 extern const LDKCResult_SignatureNoneZ (*CResult_SignatureNoneZ_ok)(LDKSignature);
3190 extern const LDKCResult_TxCreationKeysSecpErrorZ (*CResult_TxCreationKeysSecpErrorZ_err)(LDKSecp256k1Error);
3192 extern const void (*CResult_TxCreationKeysSecpErrorZ_free)(LDKCResult_TxCreationKeysSecpErrorZ);
3194 extern const LDKCResult_TxCreationKeysSecpErrorZ (*CResult_TxCreationKeysSecpErrorZ_ok)(LDKTxCreationKeys);
3196 extern const LDKCResult_TxOutAccessErrorZ (*CResult_TxOutAccessErrorZ_err)(LDKAccessError);
3198 extern const void (*CResult_TxOutAccessErrorZ_free)(LDKCResult_TxOutAccessErrorZ);
3200 extern const LDKCResult_TxOutAccessErrorZ (*CResult_TxOutAccessErrorZ_ok)(LDKTxOut);
3202 extern const LDKCResult_boolLightningErrorZ (*CResult_boolLightningErrorZ_err)(LDKLightningError);
3204 extern const void (*CResult_boolLightningErrorZ_free)(LDKCResult_boolLightningErrorZ);
3206 extern const LDKCResult_boolLightningErrorZ (*CResult_boolLightningErrorZ_ok)(bool);
3208 extern const LDKCResult_boolPeerHandleErrorZ (*CResult_boolPeerHandleErrorZ_err)(LDKPeerHandleError);
3210 extern const void (*CResult_boolPeerHandleErrorZ_free)(LDKCResult_boolPeerHandleErrorZ);
3212 extern const LDKCResult_boolPeerHandleErrorZ (*CResult_boolPeerHandleErrorZ_ok)(bool);
3214 extern const void (*CVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ_free)(LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ);
3216 extern const void (*CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free)(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ);
3218 extern const void (*CVec_C2Tuple_u32TxOutZZ_free)(LDKCVec_C2Tuple_u32TxOutZZ);
3220 extern const void (*CVec_C2Tuple_usizeTransactionZZ_free)(LDKCVec_C2Tuple_usizeTransactionZZ);
3222 extern const void (*CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free)(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ);
3224 extern const void (*CVec_CVec_RouteHopZZ_free)(LDKCVec_CVec_RouteHopZZ);
3226 extern const void (*CVec_ChannelDetailsZ_free)(LDKCVec_ChannelDetailsZ);
3228 extern const void (*CVec_ChannelMonitorZ_free)(LDKCVec_ChannelMonitorZ);
3230 extern const void (*CVec_EventZ_free)(LDKCVec_EventZ);
3232 extern const void (*CVec_HTLCOutputInCommitmentZ_free)(LDKCVec_HTLCOutputInCommitmentZ);
3234 extern const void (*CVec_MessageSendEventZ_free)(LDKCVec_MessageSendEventZ);
3236 extern const void (*CVec_MonitorEventZ_free)(LDKCVec_MonitorEventZ);
3238 extern const void (*CVec_NetAddressZ_free)(LDKCVec_NetAddressZ);
3240 extern const void (*CVec_NodeAnnouncementZ_free)(LDKCVec_NodeAnnouncementZ);
3242 extern const void (*CVec_PublicKeyZ_free)(LDKCVec_PublicKeyZ);
3244 extern const void (*CVec_RouteHintZ_free)(LDKCVec_RouteHintZ);
3246 extern const void (*CVec_RouteHopZ_free)(LDKCVec_RouteHopZ);
3248 extern const void (*CVec_SignatureZ_free)(LDKCVec_SignatureZ);
3250 extern const void (*CVec_SpendableOutputDescriptorZ_free)(LDKCVec_SpendableOutputDescriptorZ);
3252 extern const void (*CVec_TransactionZ_free)(LDKCVec_TransactionZ);
3254 extern const void (*CVec_UpdateAddHTLCZ_free)(LDKCVec_UpdateAddHTLCZ);
3256 extern const void (*CVec_UpdateFailHTLCZ_free)(LDKCVec_UpdateFailHTLCZ);
3258 extern const void (*CVec_UpdateFailMalformedHTLCZ_free)(LDKCVec_UpdateFailMalformedHTLCZ);
3260 extern const void (*CVec_UpdateFulfillHTLCZ_free)(LDKCVec_UpdateFulfillHTLCZ);
3262 extern const void (*CVec_u64Z_free)(LDKCVec_u64Z);
3264 extern const void (*CVec_u8Z_free)(LDKCVec_u8Z);
3266 extern const uint64_t MIN_RELAY_FEE_SAT_PER_1000_WEIGHT;
3268 void Transaction_free(LDKTransaction _res);
3270 void TxOut_free(LDKTxOut _res);
3272 LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_new(uintptr_t a, LDKTransaction b);
3274 LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_ok(void);
3276 LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_ok(void);
3278 LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_new(LDKOutPoint a, LDKCVec_u8Z b);
3280 LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_new(uint32_t a, LDKTxOut b);
3282 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(LDKThirtyTwoBytes a, LDKCVec_C2Tuple_u32TxOutZZ b);
3284 LDKC2Tuple_u64u64Z C2Tuple_u64u64Z_new(uint64_t a, uint64_t b);
3286 LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_new(LDKSignature a, LDKCVec_SignatureZ b);
3288 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err(void);
3290 LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_err(void);
3292 LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_err(void);
3294 LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_ok(void);
3296 LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_ok(void);
3298 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(LDKChannelAnnouncement a, LDKChannelUpdate b, LDKChannelUpdate c);
3300 LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_ok(void);
3302 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ C2Tuple_HTLCOutputInCommitmentSignatureZ_new(LDKHTLCOutputInCommitment a, LDKSignature b);
3304 void Event_free(LDKEvent this_ptr);
3306 LDKEvent Event_clone(const LDKEvent *orig);
3308 void MessageSendEvent_free(LDKMessageSendEvent this_ptr);
3310 LDKMessageSendEvent MessageSendEvent_clone(const LDKMessageSendEvent *orig);
3313 * Calls the free function if one is set
3315 void MessageSendEventsProvider_free(LDKMessageSendEventsProvider this_ptr);
3318 * Calls the free function if one is set
3320 void EventsProvider_free(LDKEventsProvider this_ptr);
3322 void APIError_free(LDKAPIError this_ptr);
3324 LDKAPIError APIError_clone(const LDKAPIError *orig);
3326 LDKLevel Level_clone(const LDKLevel *orig);
3329 * Returns the most verbose logging level.
3331 MUST_USE_RES LDKLevel Level_max(void);
3334 * Calls the free function if one is set
3336 void Logger_free(LDKLogger this_ptr);
3338 void ChannelHandshakeConfig_free(LDKChannelHandshakeConfig this_ptr);
3340 LDKChannelHandshakeConfig ChannelHandshakeConfig_clone(const LDKChannelHandshakeConfig *orig);
3343 * Confirmations we will wait for before considering the channel locked in.
3344 * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
3345 * equivalent limit applied to outbound channels).
3349 uint32_t ChannelHandshakeConfig_get_minimum_depth(const LDKChannelHandshakeConfig *this_ptr);
3352 * Confirmations we will wait for before considering the channel locked in.
3353 * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
3354 * equivalent limit applied to outbound channels).
3358 void ChannelHandshakeConfig_set_minimum_depth(LDKChannelHandshakeConfig *this_ptr, uint32_t val);
3361 * Set to the amount of time we require our counterparty to wait to claim their money.
3363 * It's one of the main parameter of our security model. We (or one of our watchtowers) MUST
3364 * be online to check for peer having broadcast a revoked transaction to steal our funds
3365 * at least once every our_to_self_delay blocks.
3367 * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
3368 * case of an honest unilateral channel close, which implicitly decrease the economic value of
3371 * Default value: BREAKDOWN_TIMEOUT (currently 144), we enforce it as a minimum at channel
3372 * opening so you can tweak config to ask for more security, not less.
3374 uint16_t ChannelHandshakeConfig_get_our_to_self_delay(const LDKChannelHandshakeConfig *this_ptr);
3377 * Set to the amount of time we require our counterparty to wait to claim their money.
3379 * It's one of the main parameter of our security model. We (or one of our watchtowers) MUST
3380 * be online to check for peer having broadcast a revoked transaction to steal our funds
3381 * at least once every our_to_self_delay blocks.
3383 * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
3384 * case of an honest unilateral channel close, which implicitly decrease the economic value of
3387 * Default value: BREAKDOWN_TIMEOUT (currently 144), we enforce it as a minimum at channel
3388 * opening so you can tweak config to ask for more security, not less.
3390 void ChannelHandshakeConfig_set_our_to_self_delay(LDKChannelHandshakeConfig *this_ptr, uint16_t val);
3393 * Set to the smallest value HTLC we will accept to process.
3395 * This value is sent to our counterparty on channel-open and we close the channel any time
3396 * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
3398 * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
3401 uint64_t ChannelHandshakeConfig_get_our_htlc_minimum_msat(const LDKChannelHandshakeConfig *this_ptr);
3404 * Set to the smallest value HTLC we will accept to process.
3406 * This value is sent to our counterparty on channel-open and we close the channel any time
3407 * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
3409 * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
3412 void ChannelHandshakeConfig_set_our_htlc_minimum_msat(LDKChannelHandshakeConfig *this_ptr, uint64_t val);
3414 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);
3416 MUST_USE_RES LDKChannelHandshakeConfig ChannelHandshakeConfig_default(void);
3418 void ChannelHandshakeLimits_free(LDKChannelHandshakeLimits this_ptr);
3420 LDKChannelHandshakeLimits ChannelHandshakeLimits_clone(const LDKChannelHandshakeLimits *orig);
3423 * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
3424 * only applies to inbound channels.
3428 uint64_t ChannelHandshakeLimits_get_min_funding_satoshis(const LDKChannelHandshakeLimits *this_ptr);
3431 * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
3432 * only applies to inbound channels.
3436 void ChannelHandshakeLimits_set_min_funding_satoshis(LDKChannelHandshakeLimits *this_ptr, uint64_t val);
3439 * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
3440 * you to limit the maximum minimum-size they can require.
3442 * Default value: u64::max_value.
3444 uint64_t ChannelHandshakeLimits_get_max_htlc_minimum_msat(const LDKChannelHandshakeLimits *this_ptr);
3447 * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
3448 * you to limit the maximum minimum-size they can require.
3450 * Default value: u64::max_value.
3452 void ChannelHandshakeLimits_set_max_htlc_minimum_msat(LDKChannelHandshakeLimits *this_ptr, uint64_t val);
3455 * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
3456 * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
3460 uint64_t ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(const LDKChannelHandshakeLimits *this_ptr);
3463 * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
3464 * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
3468 void ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(LDKChannelHandshakeLimits *this_ptr, uint64_t val);
3471 * The remote node will require we keep a certain amount in direct payment to ourselves at all
3472 * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
3473 * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
3475 * Default value: u64::max_value.
3477 uint64_t ChannelHandshakeLimits_get_max_channel_reserve_satoshis(const LDKChannelHandshakeLimits *this_ptr);
3480 * The remote node will require we keep a certain amount in direct payment to ourselves at all
3481 * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
3482 * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
3484 * Default value: u64::max_value.
3486 void ChannelHandshakeLimits_set_max_channel_reserve_satoshis(LDKChannelHandshakeLimits *this_ptr, uint64_t val);
3489 * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
3490 * time. This allows you to set a minimum such value.
3494 uint16_t ChannelHandshakeLimits_get_min_max_accepted_htlcs(const LDKChannelHandshakeLimits *this_ptr);
3497 * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
3498 * time. This allows you to set a minimum such value.
3502 void ChannelHandshakeLimits_set_min_max_accepted_htlcs(LDKChannelHandshakeLimits *this_ptr, uint16_t val);
3505 * Outputs below a certain value will not be added to on-chain transactions. The dust value is
3506 * required to always be higher than this value so this only applies to HTLC outputs (and
3507 * potentially to-self outputs before any payments have been made).
3508 * Thus, HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
3509 * This setting allows you to set a minimum dust limit for their commitment transactions,
3510 * reflecting the reality that tiny outputs are not considered standard transactions and will
3511 * not propagate through the Bitcoin network.
3513 * Default value: 546, the current dust limit on the Bitcoin network.
3515 uint64_t ChannelHandshakeLimits_get_min_dust_limit_satoshis(const LDKChannelHandshakeLimits *this_ptr);
3518 * Outputs below a certain value will not be added to on-chain transactions. The dust value is
3519 * required to always be higher than this value so this only applies to HTLC outputs (and
3520 * potentially to-self outputs before any payments have been made).
3521 * Thus, HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
3522 * This setting allows you to set a minimum dust limit for their commitment transactions,
3523 * reflecting the reality that tiny outputs are not considered standard transactions and will
3524 * not propagate through the Bitcoin network.
3526 * Default value: 546, the current dust limit on the Bitcoin network.
3528 void ChannelHandshakeLimits_set_min_dust_limit_satoshis(LDKChannelHandshakeLimits *this_ptr, uint64_t val);
3531 * Maximum allowed threshold above which outputs will not be generated in their commitment
3533 * HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
3535 * Default value: u64::max_value.
3537 uint64_t ChannelHandshakeLimits_get_max_dust_limit_satoshis(const LDKChannelHandshakeLimits *this_ptr);
3540 * Maximum allowed threshold above which outputs will not be generated in their commitment
3542 * HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
3544 * Default value: u64::max_value.
3546 void ChannelHandshakeLimits_set_max_dust_limit_satoshis(LDKChannelHandshakeLimits *this_ptr, uint64_t val);
3549 * Before a channel is usable the funding transaction will need to be confirmed by at least a
3550 * certain number of blocks, specified by the node which is not the funder (as the funder can
3551 * assume they aren't going to double-spend themselves).
3552 * This config allows you to set a limit on the maximum amount of time to wait.
3554 * Default value: 144, or roughly one day and only applies to outbound channels.
3556 uint32_t ChannelHandshakeLimits_get_max_minimum_depth(const LDKChannelHandshakeLimits *this_ptr);
3559 * Before a channel is usable the funding transaction will need to be confirmed by at least a
3560 * certain number of blocks, specified by the node which is not the funder (as the funder can
3561 * assume they aren't going to double-spend themselves).
3562 * This config allows you to set a limit on the maximum amount of time to wait.
3564 * Default value: 144, or roughly one day and only applies to outbound channels.
3566 void ChannelHandshakeLimits_set_max_minimum_depth(LDKChannelHandshakeLimits *this_ptr, uint32_t val);
3569 * Set to force the incoming channel to match our announced channel preference in
3572 * Default value: true, to make the default that no announced channels are possible (which is
3573 * appropriate for any nodes which are not online very reliably).
3575 bool ChannelHandshakeLimits_get_force_announced_channel_preference(const LDKChannelHandshakeLimits *this_ptr);
3578 * Set to force the incoming channel to match our announced channel preference in
3581 * Default value: true, to make the default that no announced channels are possible (which is
3582 * appropriate for any nodes which are not online very reliably).
3584 void ChannelHandshakeLimits_set_force_announced_channel_preference(LDKChannelHandshakeLimits *this_ptr, bool val);
3587 * Set to the amount of time we're willing to wait to claim money back to us.
3589 * Not checking this value would be a security issue, as our peer would be able to set it to
3590 * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
3592 * Default value: MAX_LOCAL_BREAKDOWN_TIMEOUT (1008), which we also enforce as a maximum value
3593 * so you can tweak config to reduce the loss of having useless locked funds (if your peer accepts)
3595 uint16_t ChannelHandshakeLimits_get_their_to_self_delay(const LDKChannelHandshakeLimits *this_ptr);
3598 * Set to the amount of time we're willing to wait to claim money back to us.
3600 * Not checking this value would be a security issue, as our peer would be able to set it to
3601 * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
3603 * Default value: MAX_LOCAL_BREAKDOWN_TIMEOUT (1008), which we also enforce as a maximum value
3604 * so you can tweak config to reduce the loss of having useless locked funds (if your peer accepts)
3606 void ChannelHandshakeLimits_set_their_to_self_delay(LDKChannelHandshakeLimits *this_ptr, uint16_t val);
3608 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);
3610 MUST_USE_RES LDKChannelHandshakeLimits ChannelHandshakeLimits_default(void);
3612 void ChannelConfig_free(LDKChannelConfig this_ptr);
3614 LDKChannelConfig ChannelConfig_clone(const LDKChannelConfig *orig);
3617 * Amount (in millionths of a satoshi) the channel will charge per transferred satoshi.
3618 * This may be allowed to change at runtime in a later update, however doing so must result in
3619 * update messages sent to notify all nodes of our updated relay fee.
3623 uint32_t ChannelConfig_get_fee_proportional_millionths(const LDKChannelConfig *this_ptr);
3626 * Amount (in millionths of a satoshi) the channel will charge per transferred satoshi.
3627 * This may be allowed to change at runtime in a later update, however doing so must result in
3628 * update messages sent to notify all nodes of our updated relay fee.
3632 void ChannelConfig_set_fee_proportional_millionths(LDKChannelConfig *this_ptr, uint32_t val);
3635 * Set to announce the channel publicly and notify all nodes that they can route via this
3638 * This should only be set to true for nodes which expect to be online reliably.
3640 * As the node which funds a channel picks this value this will only apply for new outbound
3641 * channels unless ChannelHandshakeLimits::force_announced_channel_preferences is set.
3643 * This cannot be changed after the initial channel handshake.
3645 * Default value: false.
3647 bool ChannelConfig_get_announced_channel(const LDKChannelConfig *this_ptr);
3650 * Set to announce the channel publicly and notify all nodes that they can route via this
3653 * This should only be set to true for nodes which expect to be online reliably.
3655 * As the node which funds a channel picks this value this will only apply for new outbound
3656 * channels unless ChannelHandshakeLimits::force_announced_channel_preferences is set.
3658 * This cannot be changed after the initial channel handshake.
3660 * Default value: false.
3662 void ChannelConfig_set_announced_channel(LDKChannelConfig *this_ptr, bool val);
3665 * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
3666 * supports it, they will then enforce the mutual-close output to us matches what we provided
3667 * at intialization, preventing us from closing to an alternate pubkey.
3669 * This is set to true by default to provide a slight increase in security, though ultimately
3670 * any attacker who is able to take control of a channel can just as easily send the funds via
3671 * lightning payments, so we never require that our counterparties support this option.
3673 * This cannot be changed after a channel has been initialized.
3675 * Default value: true.
3677 bool ChannelConfig_get_commit_upfront_shutdown_pubkey(const LDKChannelConfig *this_ptr);
3680 * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
3681 * supports it, they will then enforce the mutual-close output to us matches what we provided
3682 * at intialization, preventing us from closing to an alternate pubkey.
3684 * This is set to true by default to provide a slight increase in security, though ultimately
3685 * any attacker who is able to take control of a channel can just as easily send the funds via
3686 * lightning payments, so we never require that our counterparties support this option.
3688 * This cannot be changed after a channel has been initialized.
3690 * Default value: true.
3692 void ChannelConfig_set_commit_upfront_shutdown_pubkey(LDKChannelConfig *this_ptr, bool val);
3694 MUST_USE_RES LDKChannelConfig ChannelConfig_new(uint32_t fee_proportional_millionths_arg, bool announced_channel_arg, bool commit_upfront_shutdown_pubkey_arg);
3696 MUST_USE_RES LDKChannelConfig ChannelConfig_default(void);
3698 LDKCVec_u8Z ChannelConfig_write(const LDKChannelConfig *obj);
3700 LDKChannelConfig ChannelConfig_read(LDKu8slice ser);
3702 void UserConfig_free(LDKUserConfig this_ptr);
3704 LDKUserConfig UserConfig_clone(const LDKUserConfig *orig);
3707 * Channel config that we propose to our counterparty.
3709 LDKChannelHandshakeConfig UserConfig_get_own_channel_config(const LDKUserConfig *this_ptr);
3712 * Channel config that we propose to our counterparty.
3714 void UserConfig_set_own_channel_config(LDKUserConfig *this_ptr, LDKChannelHandshakeConfig val);
3717 * Limits applied to our counterparty's proposed channel config settings.
3719 LDKChannelHandshakeLimits UserConfig_get_peer_channel_config_limits(const LDKUserConfig *this_ptr);
3722 * Limits applied to our counterparty's proposed channel config settings.
3724 void UserConfig_set_peer_channel_config_limits(LDKUserConfig *this_ptr, LDKChannelHandshakeLimits val);
3727 * Channel config which affects behavior during channel lifetime.
3729 LDKChannelConfig UserConfig_get_channel_options(const LDKUserConfig *this_ptr);
3732 * Channel config which affects behavior during channel lifetime.
3734 void UserConfig_set_channel_options(LDKUserConfig *this_ptr, LDKChannelConfig val);
3736 MUST_USE_RES LDKUserConfig UserConfig_new(LDKChannelHandshakeConfig own_channel_config_arg, LDKChannelHandshakeLimits peer_channel_config_limits_arg, LDKChannelConfig channel_options_arg);
3738 MUST_USE_RES LDKUserConfig UserConfig_default(void);
3740 LDKAccessError AccessError_clone(const LDKAccessError *orig);
3743 * Calls the free function if one is set
3745 void Access_free(LDKAccess this_ptr);
3748 * Calls the free function if one is set
3750 void Watch_free(LDKWatch this_ptr);
3753 * Calls the free function if one is set
3755 void Filter_free(LDKFilter this_ptr);
3758 * Calls the free function if one is set
3760 void BroadcasterInterface_free(LDKBroadcasterInterface this_ptr);
3762 LDKConfirmationTarget ConfirmationTarget_clone(const LDKConfirmationTarget *orig);
3765 * Calls the free function if one is set
3767 void FeeEstimator_free(LDKFeeEstimator this_ptr);
3769 void ChainMonitor_free(LDKChainMonitor this_ptr);
3772 * Dispatches to per-channel monitors, which are responsible for updating their on-chain view
3773 * of a channel and reacting accordingly based on transactions in the connected block. See
3774 * [`ChannelMonitor::block_connected`] for details. Any HTLCs that were resolved on chain will
3775 * be returned by [`chain::Watch::release_pending_monitor_events`].
3777 * Calls back to [`chain::Filter`] if any monitor indicated new outputs to watch. Subsequent
3778 * calls must not exclude any transactions matching the new outputs nor any in-block
3779 * descendants of such transactions. It is not necessary to re-fetch the block to obtain
3782 * [`ChannelMonitor::block_connected`]: ../channelmonitor/struct.ChannelMonitor.html#method.block_connected
3783 * [`chain::Watch::release_pending_monitor_events`]: ../trait.Watch.html#tymethod.release_pending_monitor_events
3784 * [`chain::Filter`]: ../trait.Filter.html
3786 void ChainMonitor_block_connected(const LDKChainMonitor *this_arg, const uint8_t (*header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height);
3789 * Dispatches to per-channel monitors, which are responsible for updating their on-chain view
3790 * of a channel based on the disconnected block. See [`ChannelMonitor::block_disconnected`] for
3793 * [`ChannelMonitor::block_disconnected`]: ../channelmonitor/struct.ChannelMonitor.html#method.block_disconnected
3795 void ChainMonitor_block_disconnected(const LDKChainMonitor *this_arg, const uint8_t (*header)[80], uint32_t disconnected_height);
3798 * Creates a new `ChainMonitor` used to watch on-chain activity pertaining to channels.
3800 * When an optional chain source implementing [`chain::Filter`] is provided, the chain monitor
3801 * will call back to it indicating transactions and outputs of interest. This allows clients to
3802 * pre-filter blocks or only fetch blocks matching a compact filter. Otherwise, clients may
3803 * always need to fetch full blocks absent another means for determining which blocks contain
3804 * transactions relevant to the watched channels.
3806 * [`chain::Filter`]: ../trait.Filter.html
3808 MUST_USE_RES LDKChainMonitor ChainMonitor_new(LDKFilter *chain_source, LDKBroadcasterInterface broadcaster, LDKLogger logger, LDKFeeEstimator feeest, LDKPersist persister);
3810 LDKWatch ChainMonitor_as_Watch(const LDKChainMonitor *this_arg);
3812 LDKEventsProvider ChainMonitor_as_EventsProvider(const LDKChainMonitor *this_arg);
3814 void ChannelMonitorUpdate_free(LDKChannelMonitorUpdate this_ptr);
3816 LDKChannelMonitorUpdate ChannelMonitorUpdate_clone(const LDKChannelMonitorUpdate *orig);
3819 * The sequence number of this update. Updates *must* be replayed in-order according to this
3820 * sequence number (and updates may panic if they are not). The update_id values are strictly
3821 * increasing and increase by one for each new update, with one exception specified below.
3823 * This sequence number is also used to track up to which points updates which returned
3824 * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
3825 * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
3827 * The only instance where update_id values are not strictly increasing is the case where we
3828 * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
3829 * its docs for more details.
3831 * [`CLOSED_CHANNEL_UPDATE_ID`]: constant.CLOSED_CHANNEL_UPDATE_ID.html
3833 uint64_t ChannelMonitorUpdate_get_update_id(const LDKChannelMonitorUpdate *this_ptr);
3836 * The sequence number of this update. Updates *must* be replayed in-order according to this
3837 * sequence number (and updates may panic if they are not). The update_id values are strictly
3838 * increasing and increase by one for each new update, with one exception specified below.
3840 * This sequence number is also used to track up to which points updates which returned
3841 * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
3842 * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
3844 * The only instance where update_id values are not strictly increasing is the case where we
3845 * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
3846 * its docs for more details.
3848 * [`CLOSED_CHANNEL_UPDATE_ID`]: constant.CLOSED_CHANNEL_UPDATE_ID.html
3850 void ChannelMonitorUpdate_set_update_id(LDKChannelMonitorUpdate *this_ptr, uint64_t val);
3852 LDKCVec_u8Z ChannelMonitorUpdate_write(const LDKChannelMonitorUpdate *obj);
3854 LDKChannelMonitorUpdate ChannelMonitorUpdate_read(LDKu8slice ser);
3856 LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_clone(const LDKChannelMonitorUpdateErr *orig);
3858 void MonitorUpdateError_free(LDKMonitorUpdateError this_ptr);
3860 void MonitorEvent_free(LDKMonitorEvent this_ptr);
3862 LDKMonitorEvent MonitorEvent_clone(const LDKMonitorEvent *orig);
3864 void HTLCUpdate_free(LDKHTLCUpdate this_ptr);
3866 LDKHTLCUpdate HTLCUpdate_clone(const LDKHTLCUpdate *orig);
3868 LDKCVec_u8Z HTLCUpdate_write(const LDKHTLCUpdate *obj);
3870 LDKHTLCUpdate HTLCUpdate_read(LDKu8slice ser);
3872 void ChannelMonitor_free(LDKChannelMonitor this_ptr);
3875 * Updates a ChannelMonitor on the basis of some new information provided by the Channel
3878 * panics if the given update is not the next update by update_id.
3880 MUST_USE_RES LDKCResult_NoneMonitorUpdateErrorZ ChannelMonitor_update_monitor(LDKChannelMonitor *this_arg, const LDKChannelMonitorUpdate *updates, const LDKBroadcasterInterface *broadcaster, const LDKFeeEstimator *fee_estimator, const LDKLogger *logger);
3883 * Gets the update_id from the latest ChannelMonitorUpdate which was applied to this
3886 MUST_USE_RES uint64_t ChannelMonitor_get_latest_update_id(const LDKChannelMonitor *this_arg);
3889 * Gets the funding transaction outpoint of the channel this ChannelMonitor is monitoring for.
3891 MUST_USE_RES LDKC2Tuple_OutPointScriptZ ChannelMonitor_get_funding_txo(const LDKChannelMonitor *this_arg);
3894 * Get the list of HTLCs who's status has been updated on chain. This should be called by
3895 * ChannelManager via [`chain::Watch::release_pending_monitor_events`].
3897 * [`chain::Watch::release_pending_monitor_events`]: ../trait.Watch.html#tymethod.release_pending_monitor_events
3899 MUST_USE_RES LDKCVec_MonitorEventZ ChannelMonitor_get_and_clear_pending_monitor_events(LDKChannelMonitor *this_arg);
3902 * Gets the list of pending events which were generated by previous actions, clearing the list
3905 * This is called by ChainMonitor::get_and_clear_pending_events() and is equivalent to
3906 * EventsProvider::get_and_clear_pending_events() except that it requires &mut self as we do
3907 * no internal locking in ChannelMonitors.
3909 MUST_USE_RES LDKCVec_EventZ ChannelMonitor_get_and_clear_pending_events(LDKChannelMonitor *this_arg);
3912 * Used by ChannelManager deserialization to broadcast the latest holder state if its copy of
3913 * the Channel was out-of-date. You may use it to get a broadcastable holder toxic tx in case of
3914 * fallen-behind, i.e when receiving a channel_reestablish with a proof that our counterparty side knows
3915 * a higher revocation secret than the holder commitment number we are aware of. Broadcasting these
3916 * transactions are UNSAFE, as they allow counterparty side to punish you. Nevertheless you may want to
3917 * broadcast them if counterparty don't close channel with his higher commitment transaction after a
3918 * substantial amount of time (a month or even a year) to get back funds. Best may be to contact
3919 * out-of-band the other node operator to coordinate with him if option is available to you.
3920 * In any-case, choice is up to the user.
3922 MUST_USE_RES LDKCVec_TransactionZ ChannelMonitor_get_latest_holder_commitment_txn(LDKChannelMonitor *this_arg, const LDKLogger *logger);
3925 * Processes transactions in a newly connected block, which may result in any of the following:
3926 * - update the monitor's state against resolved HTLCs
3927 * - punish the counterparty in the case of seeing a revoked commitment transaction
3928 * - force close the channel and claim/timeout incoming/outgoing HTLCs if near expiration
3929 * - detect settled outputs for later spending
3930 * - schedule and bump any in-flight claims
3932 * Returns any new outputs to watch from `txdata`; after called, these are also included in
3933 * [`get_outputs_to_watch`].
3935 * [`get_outputs_to_watch`]: #method.get_outputs_to_watch
3937 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);
3940 * Determines if the disconnected block contained any transactions of interest and updates
3943 void ChannelMonitor_block_disconnected(LDKChannelMonitor *this_arg, const uint8_t (*header)[80], uint32_t height, LDKBroadcasterInterface broadcaster, LDKFeeEstimator fee_estimator, LDKLogger logger);
3946 * Calls the free function if one is set
3948 void Persist_free(LDKPersist this_ptr);
3950 void OutPoint_free(LDKOutPoint this_ptr);
3952 LDKOutPoint OutPoint_clone(const LDKOutPoint *orig);
3955 * The referenced transaction's txid.
3957 const uint8_t (*OutPoint_get_txid(const LDKOutPoint *this_ptr))[32];
3960 * The referenced transaction's txid.
3962 void OutPoint_set_txid(LDKOutPoint *this_ptr, LDKThirtyTwoBytes val);
3965 * The index of the referenced output in its transaction's vout.
3967 uint16_t OutPoint_get_index(const LDKOutPoint *this_ptr);
3970 * The index of the referenced output in its transaction's vout.
3972 void OutPoint_set_index(LDKOutPoint *this_ptr, uint16_t val);
3974 MUST_USE_RES LDKOutPoint OutPoint_new(LDKThirtyTwoBytes txid_arg, uint16_t index_arg);
3977 * Convert an `OutPoint` to a lightning channel id.
3979 MUST_USE_RES LDKThirtyTwoBytes OutPoint_to_channel_id(const LDKOutPoint *this_arg);
3981 LDKCVec_u8Z OutPoint_write(const LDKOutPoint *obj);
3983 LDKOutPoint OutPoint_read(LDKu8slice ser);
3985 void SpendableOutputDescriptor_free(LDKSpendableOutputDescriptor this_ptr);
3987 LDKSpendableOutputDescriptor SpendableOutputDescriptor_clone(const LDKSpendableOutputDescriptor *orig);
3989 LDKChannelKeys ChannelKeys_clone(const LDKChannelKeys *orig);
3992 * Calls the free function if one is set
3994 void ChannelKeys_free(LDKChannelKeys this_ptr);
3997 * Calls the free function if one is set
3999 void KeysInterface_free(LDKKeysInterface this_ptr);
4001 void InMemoryChannelKeys_free(LDKInMemoryChannelKeys this_ptr);
4003 LDKInMemoryChannelKeys InMemoryChannelKeys_clone(const LDKInMemoryChannelKeys *orig);
4006 * Private key of anchor tx
4008 const uint8_t (*InMemoryChannelKeys_get_funding_key(const LDKInMemoryChannelKeys *this_ptr))[32];
4011 * Private key of anchor tx
4013 void InMemoryChannelKeys_set_funding_key(LDKInMemoryChannelKeys *this_ptr, LDKSecretKey val);
4016 * Holder secret key for blinded revocation pubkey
4018 const uint8_t (*InMemoryChannelKeys_get_revocation_base_key(const LDKInMemoryChannelKeys *this_ptr))[32];
4021 * Holder secret key for blinded revocation pubkey
4023 void InMemoryChannelKeys_set_revocation_base_key(LDKInMemoryChannelKeys *this_ptr, LDKSecretKey val);
4026 * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
4028 const uint8_t (*InMemoryChannelKeys_get_payment_key(const LDKInMemoryChannelKeys *this_ptr))[32];
4031 * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
4033 void InMemoryChannelKeys_set_payment_key(LDKInMemoryChannelKeys *this_ptr, LDKSecretKey val);
4036 * Holder secret key used in HTLC tx
4038 const uint8_t (*InMemoryChannelKeys_get_delayed_payment_base_key(const LDKInMemoryChannelKeys *this_ptr))[32];
4041 * Holder secret key used in HTLC tx
4043 void InMemoryChannelKeys_set_delayed_payment_base_key(LDKInMemoryChannelKeys *this_ptr, LDKSecretKey val);
4046 * Holder htlc secret key used in commitment tx htlc outputs
4048 const uint8_t (*InMemoryChannelKeys_get_htlc_base_key(const LDKInMemoryChannelKeys *this_ptr))[32];
4051 * Holder htlc secret key used in commitment tx htlc outputs
4053 void InMemoryChannelKeys_set_htlc_base_key(LDKInMemoryChannelKeys *this_ptr, LDKSecretKey val);
4058 const uint8_t (*InMemoryChannelKeys_get_commitment_seed(const LDKInMemoryChannelKeys *this_ptr))[32];
4063 void InMemoryChannelKeys_set_commitment_seed(LDKInMemoryChannelKeys *this_ptr, LDKThirtyTwoBytes val);
4066 * Create a new InMemoryChannelKeys
4068 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);
4071 * Counterparty pubkeys.
4072 * Will panic if on_accept wasn't called.
4074 MUST_USE_RES LDKChannelPublicKeys InMemoryChannelKeys_counterparty_pubkeys(const LDKInMemoryChannelKeys *this_arg);
4077 * The contest_delay value specified by our counterparty and applied on holder-broadcastable
4078 * transactions, ie the amount of time that we have to wait to recover our funds if we
4079 * broadcast a transaction. You'll likely want to pass this to the
4080 * ln::chan_utils::build*_transaction functions when signing holder's transactions.
4081 * Will panic if on_accept wasn't called.
4083 MUST_USE_RES uint16_t InMemoryChannelKeys_counterparty_selected_contest_delay(const LDKInMemoryChannelKeys *this_arg);
4086 * The contest_delay value specified by us and applied on transactions broadcastable
4087 * by our counterparty, ie the amount of time that they have to wait to recover their funds
4088 * if they broadcast a transaction.
4089 * Will panic if on_accept wasn't called.
4091 MUST_USE_RES uint16_t InMemoryChannelKeys_holder_selected_contest_delay(const LDKInMemoryChannelKeys *this_arg);
4093 LDKChannelKeys InMemoryChannelKeys_as_ChannelKeys(const LDKInMemoryChannelKeys *this_arg);
4095 LDKCVec_u8Z InMemoryChannelKeys_write(const LDKInMemoryChannelKeys *obj);
4097 LDKInMemoryChannelKeys InMemoryChannelKeys_read(LDKu8slice ser);
4099 void KeysManager_free(LDKKeysManager this_ptr);
4102 * Constructs a KeysManager from a 32-byte seed. If the seed is in some way biased (eg your
4103 * CSRNG is busted) this may panic (but more importantly, you will possibly lose funds).
4104 * starting_time isn't strictly required to actually be a time, but it must absolutely,
4105 * without a doubt, be unique to this instance. ie if you start multiple times with the same
4106 * seed, starting_time must be unique to each run. Thus, the easiest way to achieve this is to
4107 * simply use the current time (with very high precision).
4109 * The seed MUST be backed up safely prior to use so that the keys can be re-created, however,
4110 * obviously, starting_time should be unique every time you reload the library - it is only
4111 * used to generate new ephemeral key data (which will be stored by the individual channel if
4114 * Note that the seed is required to recover certain on-chain funds independent of
4115 * ChannelMonitor data, though a current copy of ChannelMonitor data is also required for any
4116 * channel, and some on-chain during-closing funds.
4118 * Note that until the 0.1 release there is no guarantee of backward compatibility between
4119 * versions. Once the library is more fully supported, the docs will be updated to include a
4120 * detailed description of the guarantee.
4122 MUST_USE_RES LDKKeysManager KeysManager_new(const uint8_t (*seed)[32], LDKNetwork network, uint64_t starting_time_secs, uint32_t starting_time_nanos);
4125 * Derive an old set of ChannelKeys for per-channel secrets based on a key derivation
4127 * Key derivation parameters are accessible through a per-channel secrets
4128 * ChannelKeys::key_derivation_params and is provided inside DynamicOuputP2WSH in case of
4129 * onchain output detection for which a corresponding delayed_payment_key must be derived.
4131 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);
4133 LDKKeysInterface KeysManager_as_KeysInterface(const LDKKeysManager *this_arg);
4135 void ChannelManager_free(LDKChannelManager this_ptr);
4137 void ChannelDetails_free(LDKChannelDetails this_ptr);
4139 LDKChannelDetails ChannelDetails_clone(const LDKChannelDetails *orig);
4142 * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
4143 * thereafter this is the txid of the funding transaction xor the funding transaction output).
4144 * Note that this means this value is *not* persistent - it can change once during the
4145 * lifetime of the channel.
4147 const uint8_t (*ChannelDetails_get_channel_id(const LDKChannelDetails *this_ptr))[32];
4150 * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
4151 * thereafter this is the txid of the funding transaction xor the funding transaction output).
4152 * Note that this means this value is *not* persistent - it can change once during the
4153 * lifetime of the channel.
4155 void ChannelDetails_set_channel_id(LDKChannelDetails *this_ptr, LDKThirtyTwoBytes val);
4158 * The node_id of our counterparty
4160 LDKPublicKey ChannelDetails_get_remote_network_id(const LDKChannelDetails *this_ptr);
4163 * The node_id of our counterparty
4165 void ChannelDetails_set_remote_network_id(LDKChannelDetails *this_ptr, LDKPublicKey val);
4168 * The Features the channel counterparty provided upon last connection.
4169 * Useful for routing as it is the most up-to-date copy of the counterparty's features and
4170 * many routing-relevant features are present in the init context.
4172 LDKInitFeatures ChannelDetails_get_counterparty_features(const LDKChannelDetails *this_ptr);
4175 * The Features the channel counterparty provided upon last connection.
4176 * Useful for routing as it is the most up-to-date copy of the counterparty's features and
4177 * many routing-relevant features are present in the init context.
4179 void ChannelDetails_set_counterparty_features(LDKChannelDetails *this_ptr, LDKInitFeatures val);
4182 * The value, in satoshis, of this channel as appears in the funding output
4184 uint64_t ChannelDetails_get_channel_value_satoshis(const LDKChannelDetails *this_ptr);
4187 * The value, in satoshis, of this channel as appears in the funding output
4189 void ChannelDetails_set_channel_value_satoshis(LDKChannelDetails *this_ptr, uint64_t val);
4192 * The user_id passed in to create_channel, or 0 if the channel was inbound.
4194 uint64_t ChannelDetails_get_user_id(const LDKChannelDetails *this_ptr);
4197 * The user_id passed in to create_channel, or 0 if the channel was inbound.
4199 void ChannelDetails_set_user_id(LDKChannelDetails *this_ptr, uint64_t val);
4202 * The available outbound capacity for sending HTLCs to the remote peer. This does not include
4203 * any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
4204 * available for inclusion in new outbound HTLCs). This further does not include any pending
4205 * outgoing HTLCs which are awaiting some other resolution to be sent.
4207 uint64_t ChannelDetails_get_outbound_capacity_msat(const LDKChannelDetails *this_ptr);
4210 * The available outbound capacity for sending HTLCs to the remote peer. This does not include
4211 * any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
4212 * available for inclusion in new outbound HTLCs). This further does not include any pending
4213 * outgoing HTLCs which are awaiting some other resolution to be sent.
4215 void ChannelDetails_set_outbound_capacity_msat(LDKChannelDetails *this_ptr, uint64_t val);
4218 * The available inbound capacity for the remote peer to send HTLCs to us. This does not
4219 * include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
4220 * available for inclusion in new inbound HTLCs).
4221 * Note that there are some corner cases not fully handled here, so the actual available
4222 * inbound capacity may be slightly higher than this.
4224 uint64_t ChannelDetails_get_inbound_capacity_msat(const LDKChannelDetails *this_ptr);
4227 * The available inbound capacity for the remote peer to send HTLCs to us. This does not
4228 * include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
4229 * available for inclusion in new inbound HTLCs).
4230 * Note that there are some corner cases not fully handled here, so the actual available
4231 * inbound capacity may be slightly higher than this.
4233 void ChannelDetails_set_inbound_capacity_msat(LDKChannelDetails *this_ptr, uint64_t val);
4236 * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
4237 * the peer is connected, and (c) no monitor update failure is pending resolution.
4239 bool ChannelDetails_get_is_live(const LDKChannelDetails *this_ptr);
4242 * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
4243 * the peer is connected, and (c) no monitor update failure is pending resolution.
4245 void ChannelDetails_set_is_live(LDKChannelDetails *this_ptr, bool val);
4247 void PaymentSendFailure_free(LDKPaymentSendFailure this_ptr);
4250 * Constructs a new ChannelManager to hold several channels and route between them.
4252 * This is the main \"logic hub\" for all channel-related actions, and implements
4253 * ChannelMessageHandler.
4255 * Non-proportional fees are fixed according to our risk using the provided fee estimator.
4257 * panics if channel_value_satoshis is >= `MAX_FUNDING_SATOSHIS`!
4259 * Users must provide the current blockchain height from which to track onchain channel
4260 * funding outpoints and send payments with reliable timelocks.
4262 * Users need to notify the new ChannelManager when a new block is connected or
4263 * disconnected using its `block_connected` and `block_disconnected` methods.
4265 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);
4268 * Creates a new outbound channel to the given remote node and with the given value.
4270 * user_id will be provided back as user_channel_id in FundingGenerationReady and
4271 * FundingBroadcastSafe events to allow tracking of which events correspond with which
4272 * create_channel call. Note that user_channel_id defaults to 0 for inbound channels, so you
4273 * may wish to avoid using 0 for user_id here.
4275 * If successful, will generate a SendOpenChannel message event, so you should probably poll
4276 * PeerManager::process_events afterwards.
4278 * Raises APIError::APIMisuseError when channel_value_satoshis > 2**24 or push_msat is
4279 * greater than channel_value_satoshis * 1k or channel_value_satoshis is < 1000.
4281 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);
4284 * Gets the list of open channels, in random order. See ChannelDetail field documentation for
4287 MUST_USE_RES LDKCVec_ChannelDetailsZ ChannelManager_list_channels(const LDKChannelManager *this_arg);
4290 * Gets the list of usable channels, in random order. Useful as an argument to
4291 * get_route to ensure non-announced channels are used.
4293 * These are guaranteed to have their is_live value set to true, see the documentation for
4294 * ChannelDetails::is_live for more info on exactly what the criteria are.
4296 MUST_USE_RES LDKCVec_ChannelDetailsZ ChannelManager_list_usable_channels(const LDKChannelManager *this_arg);
4299 * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs
4300 * will be accepted on the given channel, and after additional timeout/the closing of all
4301 * pending HTLCs, the channel will be closed on chain.
4303 * May generate a SendShutdown message event on success, which should be relayed.
4305 MUST_USE_RES LDKCResult_NoneAPIErrorZ ChannelManager_close_channel(const LDKChannelManager *this_arg, const uint8_t (*channel_id)[32]);
4308 * Force closes a channel, immediately broadcasting the latest local commitment transaction to
4309 * the chain and rejecting new HTLCs on the given channel.
4311 void ChannelManager_force_close_channel(const LDKChannelManager *this_arg, const uint8_t (*channel_id)[32]);
4314 * Force close all channels, immediately broadcasting the latest local commitment transaction
4315 * for each to the chain and rejecting new HTLCs on each.
4317 void ChannelManager_force_close_all_channels(const LDKChannelManager *this_arg);
4320 * Sends a payment along a given route.
4322 * Value parameters are provided via the last hop in route, see documentation for RouteHop
4323 * fields for more info.
4325 * Note that if the payment_hash already exists elsewhere (eg you're sending a duplicative
4326 * payment), we don't do anything to stop you! We always try to ensure that if the provided
4327 * next hop knows the preimage to payment_hash they can claim an additional amount as
4328 * specified in the last hop in the route! Thus, you should probably do your own
4329 * payment_preimage tracking (which you should already be doing as they represent \"proof of
4330 * payment\") and prevent double-sends yourself.
4332 * May generate SendHTLCs message(s) event on success, which should be relayed.
4334 * Each path may have a different return value, and PaymentSendValue may return a Vec with
4335 * each entry matching the corresponding-index entry in the route paths, see
4336 * PaymentSendFailure for more info.
4338 * In general, a path may raise:
4339 * * APIError::RouteError when an invalid route or forwarding parameter (cltv_delta, fee,
4340 * node public key) is specified.
4341 * * APIError::ChannelUnavailable if the next-hop channel is not available for updates
4342 * (including due to previous monitor update failure or new permanent monitor update
4344 * * APIError::MonitorUpdateFailed if a new monitor update failure prevented sending the
4347 * Note that depending on the type of the PaymentSendFailure the HTLC may have been
4348 * irrevocably committed to on our end. In such a case, do NOT retry the payment with a
4349 * different route unless you intend to pay twice!
4351 * payment_secret is unrelated to payment_hash (or PaymentPreimage) and exists to authenticate
4352 * the sender to the recipient and prevent payment-probing (deanonymization) attacks. For
4353 * newer nodes, it will be provided to you in the invoice. If you do not have one, the Route
4354 * must not contain multiple paths as multi-path payments require a recipient-provided
4356 * If a payment_secret *is* provided, we assume that the invoice had the payment_secret feature
4357 * bit set (either as required or as available). If multiple paths are present in the Route,
4358 * we assume the invoice had the basic_mpp feature set.
4360 MUST_USE_RES LDKCResult_NonePaymentSendFailureZ ChannelManager_send_payment(const LDKChannelManager *this_arg, const LDKRoute *route, LDKThirtyTwoBytes payment_hash, LDKThirtyTwoBytes payment_secret);
4363 * Call this upon creation of a funding transaction for the given channel.
4365 * Note that ALL inputs in the transaction pointed to by funding_txo MUST spend SegWit outputs
4366 * or your counterparty can steal your funds!
4368 * Panics if a funding transaction has already been provided for this channel.
4370 * May panic if the funding_txo is duplicative with some other channel (note that this should
4371 * be trivially prevented by using unique funding transaction keys per-channel).
4373 void ChannelManager_funding_transaction_generated(const LDKChannelManager *this_arg, const uint8_t (*temporary_channel_id)[32], LDKOutPoint funding_txo);
4376 * Generates a signed node_announcement from the given arguments and creates a
4377 * BroadcastNodeAnnouncement event. Note that such messages will be ignored unless peers have
4378 * seen a channel_announcement from us (ie unless we have public channels open).
4380 * RGB is a node \"color\" and alias is a printable human-readable string to describe this node
4381 * to humans. They carry no in-protocol meaning.
4383 * addresses represent the set (possibly empty) of socket addresses on which this node accepts
4384 * incoming connections. These will be broadcast to the network, publicly tying these
4385 * addresses together. If you wish to preserve user privacy, addresses should likely contain
4386 * only Tor Onion addresses.
4388 * Panics if addresses is absurdly large (more than 500).
4390 void ChannelManager_broadcast_node_announcement(const LDKChannelManager *this_arg, LDKThreeBytes rgb, LDKThirtyTwoBytes alias, LDKCVec_NetAddressZ addresses);
4393 * Processes HTLCs which are pending waiting on random forward delay.
4395 * Should only really ever be called in response to a PendingHTLCsForwardable event.
4396 * Will likely generate further events.
4398 void ChannelManager_process_pending_htlc_forwards(const LDKChannelManager *this_arg);
4401 * If a peer is disconnected we mark any channels with that peer as 'disabled'.
4402 * After some time, if channels are still disabled we need to broadcast a ChannelUpdate
4403 * to inform the network about the uselessness of these channels.
4405 * This method handles all the details, and must be called roughly once per minute.
4407 void ChannelManager_timer_chan_freshness_every_min(const LDKChannelManager *this_arg);
4410 * Indicates that the preimage for payment_hash is unknown or the received amount is incorrect
4411 * after a PaymentReceived event, failing the HTLC back to its origin and freeing resources
4412 * along the path (including in our own channel on which we received it).
4413 * Returns false if no payment was found to fail backwards, true if the process of failing the
4414 * HTLC backwards has been started.
4416 MUST_USE_RES bool ChannelManager_fail_htlc_backwards(const LDKChannelManager *this_arg, const uint8_t (*payment_hash)[32], LDKThirtyTwoBytes payment_secret);
4419 * Provides a payment preimage in response to a PaymentReceived event, returning true and
4420 * generating message events for the net layer to claim the payment, if possible. Thus, you
4421 * should probably kick the net layer to go send messages if this returns true!
4423 * You must specify the expected amounts for this HTLC, and we will only claim HTLCs
4424 * available within a few percent of the expected amount. This is critical for several
4425 * reasons : a) it avoids providing senders with `proof-of-payment` (in the form of the
4426 * payment_preimage without having provided the full value and b) it avoids certain
4427 * privacy-breaking recipient-probing attacks which may reveal payment activity to
4428 * motivated attackers.
4430 * Note that the privacy concerns in (b) are not relevant in payments with a payment_secret
4431 * set. Thus, for such payments we will claim any payments which do not under-pay.
4433 * May panic if called except in response to a PaymentReceived event.
4435 MUST_USE_RES bool ChannelManager_claim_funds(const LDKChannelManager *this_arg, LDKThirtyTwoBytes payment_preimage, LDKThirtyTwoBytes payment_secret, uint64_t expected_amount);
4438 * Gets the node_id held by this ChannelManager
4440 MUST_USE_RES LDKPublicKey ChannelManager_get_our_node_id(const LDKChannelManager *this_arg);
4443 * Restores a single, given channel to normal operation after a
4444 * ChannelMonitorUpdateErr::TemporaryFailure was returned from a channel monitor update
4447 * All ChannelMonitor updates up to and including highest_applied_update_id must have been
4448 * fully committed in every copy of the given channels' ChannelMonitors.
4450 * Note that there is no effect to calling with a highest_applied_update_id other than the
4451 * current latest ChannelMonitorUpdate and one call to this function after multiple
4452 * ChannelMonitorUpdateErr::TemporaryFailures is fine. The highest_applied_update_id field
4453 * exists largely only to prevent races between this and concurrent update_monitor calls.
4455 * Thus, the anticipated use is, at a high level:
4456 * 1) You register a chain::Watch with this ChannelManager,
4457 * 2) it stores each update to disk, and begins updating any remote (eg watchtower) copies of
4458 * said ChannelMonitors as it can, returning ChannelMonitorUpdateErr::TemporaryFailures
4459 * any time it cannot do so instantly,
4460 * 3) update(s) are applied to each remote copy of a ChannelMonitor,
4461 * 4) once all remote copies are updated, you call this function with the update_id that
4462 * completed, and once it is the latest the Channel will be re-enabled.
4464 void ChannelManager_channel_monitor_updated(const LDKChannelManager *this_arg, const LDKOutPoint *funding_txo, uint64_t highest_applied_update_id);
4466 LDKMessageSendEventsProvider ChannelManager_as_MessageSendEventsProvider(const LDKChannelManager *this_arg);
4468 LDKEventsProvider ChannelManager_as_EventsProvider(const LDKChannelManager *this_arg);
4471 * Updates channel state based on transactions seen in a connected block.
4473 void ChannelManager_block_connected(const LDKChannelManager *this_arg, const uint8_t (*header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height);
4476 * Updates channel state based on a disconnected block.
4478 * If necessary, the channel may be force-closed without letting the counterparty participate
4481 void ChannelManager_block_disconnected(const LDKChannelManager *this_arg, const uint8_t (*header)[80]);
4483 LDKChannelMessageHandler ChannelManager_as_ChannelMessageHandler(const LDKChannelManager *this_arg);
4485 void ChannelManagerReadArgs_free(LDKChannelManagerReadArgs this_ptr);
4488 * The keys provider which will give us relevant keys. Some keys will be loaded during
4491 const LDKKeysInterface *ChannelManagerReadArgs_get_keys_manager(const LDKChannelManagerReadArgs *this_ptr);
4494 * The keys provider which will give us relevant keys. Some keys will be loaded during
4497 void ChannelManagerReadArgs_set_keys_manager(LDKChannelManagerReadArgs *this_ptr, LDKKeysInterface val);
4500 * The fee_estimator for use in the ChannelManager in the future.
4502 * No calls to the FeeEstimator will be made during deserialization.
4504 const LDKFeeEstimator *ChannelManagerReadArgs_get_fee_estimator(const LDKChannelManagerReadArgs *this_ptr);
4507 * The fee_estimator for use in the ChannelManager in the future.
4509 * No calls to the FeeEstimator will be made during deserialization.
4511 void ChannelManagerReadArgs_set_fee_estimator(LDKChannelManagerReadArgs *this_ptr, LDKFeeEstimator val);
4514 * The chain::Watch for use in the ChannelManager in the future.
4516 * No calls to the chain::Watch will be made during deserialization. It is assumed that
4517 * you have deserialized ChannelMonitors separately and will add them to your
4518 * chain::Watch after deserializing this ChannelManager.
4520 const LDKWatch *ChannelManagerReadArgs_get_chain_monitor(const LDKChannelManagerReadArgs *this_ptr);
4523 * The chain::Watch for use in the ChannelManager in the future.
4525 * No calls to the chain::Watch will be made during deserialization. It is assumed that
4526 * you have deserialized ChannelMonitors separately and will add them to your
4527 * chain::Watch after deserializing this ChannelManager.
4529 void ChannelManagerReadArgs_set_chain_monitor(LDKChannelManagerReadArgs *this_ptr, LDKWatch val);
4532 * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
4533 * used to broadcast the latest local commitment transactions of channels which must be
4534 * force-closed during deserialization.
4536 const LDKBroadcasterInterface *ChannelManagerReadArgs_get_tx_broadcaster(const LDKChannelManagerReadArgs *this_ptr);
4539 * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
4540 * used to broadcast the latest local commitment transactions of channels which must be
4541 * force-closed during deserialization.
4543 void ChannelManagerReadArgs_set_tx_broadcaster(LDKChannelManagerReadArgs *this_ptr, LDKBroadcasterInterface val);
4546 * The Logger for use in the ChannelManager and which may be used to log information during
4549 const LDKLogger *ChannelManagerReadArgs_get_logger(const LDKChannelManagerReadArgs *this_ptr);
4552 * The Logger for use in the ChannelManager and which may be used to log information during
4555 void ChannelManagerReadArgs_set_logger(LDKChannelManagerReadArgs *this_ptr, LDKLogger val);
4558 * Default settings used for new channels. Any existing channels will continue to use the
4559 * runtime settings which were stored when the ChannelManager was serialized.
4561 LDKUserConfig ChannelManagerReadArgs_get_default_config(const LDKChannelManagerReadArgs *this_ptr);
4564 * Default settings used for new channels. Any existing channels will continue to use the
4565 * runtime settings which were stored when the ChannelManager was serialized.
4567 void ChannelManagerReadArgs_set_default_config(LDKChannelManagerReadArgs *this_ptr, LDKUserConfig val);
4570 * Simple utility function to create a ChannelManagerReadArgs which creates the monitor
4571 * HashMap for you. This is primarily useful for C bindings where it is not practical to
4572 * populate a HashMap directly from C.
4574 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);
4576 void DecodeError_free(LDKDecodeError this_ptr);
4578 void Init_free(LDKInit this_ptr);
4580 LDKInit Init_clone(const LDKInit *orig);
4582 void ErrorMessage_free(LDKErrorMessage this_ptr);
4584 LDKErrorMessage ErrorMessage_clone(const LDKErrorMessage *orig);
4587 * The channel ID involved in the error
4589 const uint8_t (*ErrorMessage_get_channel_id(const LDKErrorMessage *this_ptr))[32];
4592 * The channel ID involved in the error
4594 void ErrorMessage_set_channel_id(LDKErrorMessage *this_ptr, LDKThirtyTwoBytes val);
4597 * A possibly human-readable error description.
4598 * The string should be sanitized before it is used (e.g. emitted to logs
4599 * or printed to stdout). Otherwise, a well crafted error message may trigger a security
4600 * vulnerability in the terminal emulator or the logging subsystem.
4602 LDKStr ErrorMessage_get_data(const LDKErrorMessage *this_ptr);
4605 * A possibly human-readable error description.
4606 * The string should be sanitized before it is used (e.g. emitted to logs
4607 * or printed to stdout). Otherwise, a well crafted error message may trigger a security
4608 * vulnerability in the terminal emulator or the logging subsystem.
4610 void ErrorMessage_set_data(LDKErrorMessage *this_ptr, LDKCVec_u8Z val);
4612 MUST_USE_RES LDKErrorMessage ErrorMessage_new(LDKThirtyTwoBytes channel_id_arg, LDKCVec_u8Z data_arg);
4614 void Ping_free(LDKPing this_ptr);
4616 LDKPing Ping_clone(const LDKPing *orig);
4619 * The desired response length
4621 uint16_t Ping_get_ponglen(const LDKPing *this_ptr);
4624 * The desired response length
4626 void Ping_set_ponglen(LDKPing *this_ptr, uint16_t val);
4629 * The ping packet size.
4630 * This field is not sent on the wire. byteslen zeros are sent.
4632 uint16_t Ping_get_byteslen(const LDKPing *this_ptr);
4635 * The ping packet size.
4636 * This field is not sent on the wire. byteslen zeros are sent.
4638 void Ping_set_byteslen(LDKPing *this_ptr, uint16_t val);
4640 MUST_USE_RES LDKPing Ping_new(uint16_t ponglen_arg, uint16_t byteslen_arg);
4642 void Pong_free(LDKPong this_ptr);
4644 LDKPong Pong_clone(const LDKPong *orig);
4647 * The pong packet size.
4648 * This field is not sent on the wire. byteslen zeros are sent.
4650 uint16_t Pong_get_byteslen(const LDKPong *this_ptr);
4653 * The pong packet size.
4654 * This field is not sent on the wire. byteslen zeros are sent.
4656 void Pong_set_byteslen(LDKPong *this_ptr, uint16_t val);
4658 MUST_USE_RES LDKPong Pong_new(uint16_t byteslen_arg);
4660 void OpenChannel_free(LDKOpenChannel this_ptr);
4662 LDKOpenChannel OpenChannel_clone(const LDKOpenChannel *orig);
4665 * The genesis hash of the blockchain where the channel is to be opened
4667 const uint8_t (*OpenChannel_get_chain_hash(const LDKOpenChannel *this_ptr))[32];
4670 * The genesis hash of the blockchain where the channel is to be opened
4672 void OpenChannel_set_chain_hash(LDKOpenChannel *this_ptr, LDKThirtyTwoBytes val);
4675 * A temporary channel ID, until the funding outpoint is announced
4677 const uint8_t (*OpenChannel_get_temporary_channel_id(const LDKOpenChannel *this_ptr))[32];
4680 * A temporary channel ID, until the funding outpoint is announced
4682 void OpenChannel_set_temporary_channel_id(LDKOpenChannel *this_ptr, LDKThirtyTwoBytes val);
4687 uint64_t OpenChannel_get_funding_satoshis(const LDKOpenChannel *this_ptr);
4692 void OpenChannel_set_funding_satoshis(LDKOpenChannel *this_ptr, uint64_t val);
4695 * The amount to push to the counterparty as part of the open, in milli-satoshi
4697 uint64_t OpenChannel_get_push_msat(const LDKOpenChannel *this_ptr);
4700 * The amount to push to the counterparty as part of the open, in milli-satoshi
4702 void OpenChannel_set_push_msat(LDKOpenChannel *this_ptr, uint64_t val);
4705 * The threshold below which outputs on transactions broadcast by sender will be omitted
4707 uint64_t OpenChannel_get_dust_limit_satoshis(const LDKOpenChannel *this_ptr);
4710 * The threshold below which outputs on transactions broadcast by sender will be omitted
4712 void OpenChannel_set_dust_limit_satoshis(LDKOpenChannel *this_ptr, uint64_t val);
4715 * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
4717 uint64_t OpenChannel_get_max_htlc_value_in_flight_msat(const LDKOpenChannel *this_ptr);
4720 * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
4722 void OpenChannel_set_max_htlc_value_in_flight_msat(LDKOpenChannel *this_ptr, uint64_t val);
4725 * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
4727 uint64_t OpenChannel_get_channel_reserve_satoshis(const LDKOpenChannel *this_ptr);
4730 * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
4732 void OpenChannel_set_channel_reserve_satoshis(LDKOpenChannel *this_ptr, uint64_t val);
4735 * The minimum HTLC size incoming to sender, in milli-satoshi
4737 uint64_t OpenChannel_get_htlc_minimum_msat(const LDKOpenChannel *this_ptr);
4740 * The minimum HTLC size incoming to sender, in milli-satoshi
4742 void OpenChannel_set_htlc_minimum_msat(LDKOpenChannel *this_ptr, uint64_t val);
4745 * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
4747 uint32_t OpenChannel_get_feerate_per_kw(const LDKOpenChannel *this_ptr);
4750 * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
4752 void OpenChannel_set_feerate_per_kw(LDKOpenChannel *this_ptr, uint32_t val);
4755 * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
4757 uint16_t OpenChannel_get_to_self_delay(const LDKOpenChannel *this_ptr);
4760 * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
4762 void OpenChannel_set_to_self_delay(LDKOpenChannel *this_ptr, uint16_t val);
4765 * The maximum number of inbound HTLCs towards sender
4767 uint16_t OpenChannel_get_max_accepted_htlcs(const LDKOpenChannel *this_ptr);
4770 * The maximum number of inbound HTLCs towards sender
4772 void OpenChannel_set_max_accepted_htlcs(LDKOpenChannel *this_ptr, uint16_t val);
4775 * The sender's key controlling the funding transaction
4777 LDKPublicKey OpenChannel_get_funding_pubkey(const LDKOpenChannel *this_ptr);
4780 * The sender's key controlling the funding transaction
4782 void OpenChannel_set_funding_pubkey(LDKOpenChannel *this_ptr, LDKPublicKey val);
4785 * Used to derive a revocation key for transactions broadcast by counterparty
4787 LDKPublicKey OpenChannel_get_revocation_basepoint(const LDKOpenChannel *this_ptr);
4790 * Used to derive a revocation key for transactions broadcast by counterparty
4792 void OpenChannel_set_revocation_basepoint(LDKOpenChannel *this_ptr, LDKPublicKey val);
4795 * A payment key to sender for transactions broadcast by counterparty
4797 LDKPublicKey OpenChannel_get_payment_point(const LDKOpenChannel *this_ptr);
4800 * A payment key to sender for transactions broadcast by counterparty
4802 void OpenChannel_set_payment_point(LDKOpenChannel *this_ptr, LDKPublicKey val);
4805 * Used to derive a payment key to sender for transactions broadcast by sender
4807 LDKPublicKey OpenChannel_get_delayed_payment_basepoint(const LDKOpenChannel *this_ptr);
4810 * Used to derive a payment key to sender for transactions broadcast by sender
4812 void OpenChannel_set_delayed_payment_basepoint(LDKOpenChannel *this_ptr, LDKPublicKey val);
4815 * Used to derive an HTLC payment key to sender
4817 LDKPublicKey OpenChannel_get_htlc_basepoint(const LDKOpenChannel *this_ptr);
4820 * Used to derive an HTLC payment key to sender
4822 void OpenChannel_set_htlc_basepoint(LDKOpenChannel *this_ptr, LDKPublicKey val);
4825 * The first to-be-broadcast-by-sender transaction's per commitment point
4827 LDKPublicKey OpenChannel_get_first_per_commitment_point(const LDKOpenChannel *this_ptr);
4830 * The first to-be-broadcast-by-sender transaction's per commitment point
4832 void OpenChannel_set_first_per_commitment_point(LDKOpenChannel *this_ptr, LDKPublicKey val);
4837 uint8_t OpenChannel_get_channel_flags(const LDKOpenChannel *this_ptr);
4842 void OpenChannel_set_channel_flags(LDKOpenChannel *this_ptr, uint8_t val);
4844 void AcceptChannel_free(LDKAcceptChannel this_ptr);
4846 LDKAcceptChannel AcceptChannel_clone(const LDKAcceptChannel *orig);
4849 * A temporary channel ID, until the funding outpoint is announced
4851 const uint8_t (*AcceptChannel_get_temporary_channel_id(const LDKAcceptChannel *this_ptr))[32];
4854 * A temporary channel ID, until the funding outpoint is announced
4856 void AcceptChannel_set_temporary_channel_id(LDKAcceptChannel *this_ptr, LDKThirtyTwoBytes val);
4859 * The threshold below which outputs on transactions broadcast by sender will be omitted
4861 uint64_t AcceptChannel_get_dust_limit_satoshis(const LDKAcceptChannel *this_ptr);
4864 * The threshold below which outputs on transactions broadcast by sender will be omitted
4866 void AcceptChannel_set_dust_limit_satoshis(LDKAcceptChannel *this_ptr, uint64_t val);
4869 * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
4871 uint64_t AcceptChannel_get_max_htlc_value_in_flight_msat(const LDKAcceptChannel *this_ptr);
4874 * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
4876 void AcceptChannel_set_max_htlc_value_in_flight_msat(LDKAcceptChannel *this_ptr, uint64_t val);
4879 * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
4881 uint64_t AcceptChannel_get_channel_reserve_satoshis(const LDKAcceptChannel *this_ptr);
4884 * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
4886 void AcceptChannel_set_channel_reserve_satoshis(LDKAcceptChannel *this_ptr, uint64_t val);
4889 * The minimum HTLC size incoming to sender, in milli-satoshi
4891 uint64_t AcceptChannel_get_htlc_minimum_msat(const LDKAcceptChannel *this_ptr);
4894 * The minimum HTLC size incoming to sender, in milli-satoshi
4896 void AcceptChannel_set_htlc_minimum_msat(LDKAcceptChannel *this_ptr, uint64_t val);
4899 * Minimum depth of the funding transaction before the channel is considered open
4901 uint32_t AcceptChannel_get_minimum_depth(const LDKAcceptChannel *this_ptr);
4904 * Minimum depth of the funding transaction before the channel is considered open
4906 void AcceptChannel_set_minimum_depth(LDKAcceptChannel *this_ptr, uint32_t val);
4909 * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
4911 uint16_t AcceptChannel_get_to_self_delay(const LDKAcceptChannel *this_ptr);
4914 * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
4916 void AcceptChannel_set_to_self_delay(LDKAcceptChannel *this_ptr, uint16_t val);
4919 * The maximum number of inbound HTLCs towards sender
4921 uint16_t AcceptChannel_get_max_accepted_htlcs(const LDKAcceptChannel *this_ptr);
4924 * The maximum number of inbound HTLCs towards sender
4926 void AcceptChannel_set_max_accepted_htlcs(LDKAcceptChannel *this_ptr, uint16_t val);
4929 * The sender's key controlling the funding transaction
4931 LDKPublicKey AcceptChannel_get_funding_pubkey(const LDKAcceptChannel *this_ptr);
4934 * The sender's key controlling the funding transaction
4936 void AcceptChannel_set_funding_pubkey(LDKAcceptChannel *this_ptr, LDKPublicKey val);
4939 * Used to derive a revocation key for transactions broadcast by counterparty
4941 LDKPublicKey AcceptChannel_get_revocation_basepoint(const LDKAcceptChannel *this_ptr);
4944 * Used to derive a revocation key for transactions broadcast by counterparty
4946 void AcceptChannel_set_revocation_basepoint(LDKAcceptChannel *this_ptr, LDKPublicKey val);
4949 * A payment key to sender for transactions broadcast by counterparty
4951 LDKPublicKey AcceptChannel_get_payment_point(const LDKAcceptChannel *this_ptr);
4954 * A payment key to sender for transactions broadcast by counterparty
4956 void AcceptChannel_set_payment_point(LDKAcceptChannel *this_ptr, LDKPublicKey val);
4959 * Used to derive a payment key to sender for transactions broadcast by sender
4961 LDKPublicKey AcceptChannel_get_delayed_payment_basepoint(const LDKAcceptChannel *this_ptr);
4964 * Used to derive a payment key to sender for transactions broadcast by sender
4966 void AcceptChannel_set_delayed_payment_basepoint(LDKAcceptChannel *this_ptr, LDKPublicKey val);
4969 * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
4971 LDKPublicKey AcceptChannel_get_htlc_basepoint(const LDKAcceptChannel *this_ptr);
4974 * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
4976 void AcceptChannel_set_htlc_basepoint(LDKAcceptChannel *this_ptr, LDKPublicKey val);
4979 * The first to-be-broadcast-by-sender transaction's per commitment point
4981 LDKPublicKey AcceptChannel_get_first_per_commitment_point(const LDKAcceptChannel *this_ptr);
4984 * The first to-be-broadcast-by-sender transaction's per commitment point
4986 void AcceptChannel_set_first_per_commitment_point(LDKAcceptChannel *this_ptr, LDKPublicKey val);
4988 void FundingCreated_free(LDKFundingCreated this_ptr);
4990 LDKFundingCreated FundingCreated_clone(const LDKFundingCreated *orig);
4993 * A temporary channel ID, until the funding is established
4995 const uint8_t (*FundingCreated_get_temporary_channel_id(const LDKFundingCreated *this_ptr))[32];
4998 * A temporary channel ID, until the funding is established
5000 void FundingCreated_set_temporary_channel_id(LDKFundingCreated *this_ptr, LDKThirtyTwoBytes val);
5003 * The funding transaction ID
5005 const uint8_t (*FundingCreated_get_funding_txid(const LDKFundingCreated *this_ptr))[32];
5008 * The funding transaction ID
5010 void FundingCreated_set_funding_txid(LDKFundingCreated *this_ptr, LDKThirtyTwoBytes val);
5013 * The specific output index funding this channel
5015 uint16_t FundingCreated_get_funding_output_index(const LDKFundingCreated *this_ptr);
5018 * The specific output index funding this channel
5020 void FundingCreated_set_funding_output_index(LDKFundingCreated *this_ptr, uint16_t val);
5023 * The signature of the channel initiator (funder) on the funding transaction
5025 LDKSignature FundingCreated_get_signature(const LDKFundingCreated *this_ptr);
5028 * The signature of the channel initiator (funder) on the funding transaction
5030 void FundingCreated_set_signature(LDKFundingCreated *this_ptr, LDKSignature val);
5032 MUST_USE_RES LDKFundingCreated FundingCreated_new(LDKThirtyTwoBytes temporary_channel_id_arg, LDKThirtyTwoBytes funding_txid_arg, uint16_t funding_output_index_arg, LDKSignature signature_arg);
5034 void FundingSigned_free(LDKFundingSigned this_ptr);
5036 LDKFundingSigned FundingSigned_clone(const LDKFundingSigned *orig);
5041 const uint8_t (*FundingSigned_get_channel_id(const LDKFundingSigned *this_ptr))[32];
5046 void FundingSigned_set_channel_id(LDKFundingSigned *this_ptr, LDKThirtyTwoBytes val);
5049 * The signature of the channel acceptor (fundee) on the funding transaction
5051 LDKSignature FundingSigned_get_signature(const LDKFundingSigned *this_ptr);
5054 * The signature of the channel acceptor (fundee) on the funding transaction
5056 void FundingSigned_set_signature(LDKFundingSigned *this_ptr, LDKSignature val);
5058 MUST_USE_RES LDKFundingSigned FundingSigned_new(LDKThirtyTwoBytes channel_id_arg, LDKSignature signature_arg);
5060 void FundingLocked_free(LDKFundingLocked this_ptr);
5062 LDKFundingLocked FundingLocked_clone(const LDKFundingLocked *orig);
5067 const uint8_t (*FundingLocked_get_channel_id(const LDKFundingLocked *this_ptr))[32];
5072 void FundingLocked_set_channel_id(LDKFundingLocked *this_ptr, LDKThirtyTwoBytes val);
5075 * The per-commitment point of the second commitment transaction
5077 LDKPublicKey FundingLocked_get_next_per_commitment_point(const LDKFundingLocked *this_ptr);
5080 * The per-commitment point of the second commitment transaction
5082 void FundingLocked_set_next_per_commitment_point(LDKFundingLocked *this_ptr, LDKPublicKey val);
5084 MUST_USE_RES LDKFundingLocked FundingLocked_new(LDKThirtyTwoBytes channel_id_arg, LDKPublicKey next_per_commitment_point_arg);
5086 void Shutdown_free(LDKShutdown this_ptr);
5088 LDKShutdown Shutdown_clone(const LDKShutdown *orig);
5093 const uint8_t (*Shutdown_get_channel_id(const LDKShutdown *this_ptr))[32];
5098 void Shutdown_set_channel_id(LDKShutdown *this_ptr, LDKThirtyTwoBytes val);
5101 * The destination of this peer's funds on closing.
5102 * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
5104 LDKu8slice Shutdown_get_scriptpubkey(const LDKShutdown *this_ptr);
5107 * The destination of this peer's funds on closing.
5108 * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
5110 void Shutdown_set_scriptpubkey(LDKShutdown *this_ptr, LDKCVec_u8Z val);
5112 MUST_USE_RES LDKShutdown Shutdown_new(LDKThirtyTwoBytes channel_id_arg, LDKCVec_u8Z scriptpubkey_arg);
5114 void ClosingSigned_free(LDKClosingSigned this_ptr);
5116 LDKClosingSigned ClosingSigned_clone(const LDKClosingSigned *orig);
5121 const uint8_t (*ClosingSigned_get_channel_id(const LDKClosingSigned *this_ptr))[32];
5126 void ClosingSigned_set_channel_id(LDKClosingSigned *this_ptr, LDKThirtyTwoBytes val);
5129 * The proposed total fee for the closing transaction
5131 uint64_t ClosingSigned_get_fee_satoshis(const LDKClosingSigned *this_ptr);
5134 * The proposed total fee for the closing transaction
5136 void ClosingSigned_set_fee_satoshis(LDKClosingSigned *this_ptr, uint64_t val);
5139 * A signature on the closing transaction
5141 LDKSignature ClosingSigned_get_signature(const LDKClosingSigned *this_ptr);
5144 * A signature on the closing transaction
5146 void ClosingSigned_set_signature(LDKClosingSigned *this_ptr, LDKSignature val);
5148 MUST_USE_RES LDKClosingSigned ClosingSigned_new(LDKThirtyTwoBytes channel_id_arg, uint64_t fee_satoshis_arg, LDKSignature signature_arg);
5150 void UpdateAddHTLC_free(LDKUpdateAddHTLC this_ptr);
5152 LDKUpdateAddHTLC UpdateAddHTLC_clone(const LDKUpdateAddHTLC *orig);
5157 const uint8_t (*UpdateAddHTLC_get_channel_id(const LDKUpdateAddHTLC *this_ptr))[32];
5162 void UpdateAddHTLC_set_channel_id(LDKUpdateAddHTLC *this_ptr, LDKThirtyTwoBytes val);
5167 uint64_t UpdateAddHTLC_get_htlc_id(const LDKUpdateAddHTLC *this_ptr);
5172 void UpdateAddHTLC_set_htlc_id(LDKUpdateAddHTLC *this_ptr, uint64_t val);
5175 * The HTLC value in milli-satoshi
5177 uint64_t UpdateAddHTLC_get_amount_msat(const LDKUpdateAddHTLC *this_ptr);
5180 * The HTLC value in milli-satoshi
5182 void UpdateAddHTLC_set_amount_msat(LDKUpdateAddHTLC *this_ptr, uint64_t val);
5185 * The payment hash, the pre-image of which controls HTLC redemption
5187 const uint8_t (*UpdateAddHTLC_get_payment_hash(const LDKUpdateAddHTLC *this_ptr))[32];
5190 * The payment hash, the pre-image of which controls HTLC redemption
5192 void UpdateAddHTLC_set_payment_hash(LDKUpdateAddHTLC *this_ptr, LDKThirtyTwoBytes val);
5195 * The expiry height of the HTLC
5197 uint32_t UpdateAddHTLC_get_cltv_expiry(const LDKUpdateAddHTLC *this_ptr);
5200 * The expiry height of the HTLC
5202 void UpdateAddHTLC_set_cltv_expiry(LDKUpdateAddHTLC *this_ptr, uint32_t val);
5204 void UpdateFulfillHTLC_free(LDKUpdateFulfillHTLC this_ptr);
5206 LDKUpdateFulfillHTLC UpdateFulfillHTLC_clone(const LDKUpdateFulfillHTLC *orig);
5211 const uint8_t (*UpdateFulfillHTLC_get_channel_id(const LDKUpdateFulfillHTLC *this_ptr))[32];
5216 void UpdateFulfillHTLC_set_channel_id(LDKUpdateFulfillHTLC *this_ptr, LDKThirtyTwoBytes val);
5221 uint64_t UpdateFulfillHTLC_get_htlc_id(const LDKUpdateFulfillHTLC *this_ptr);
5226 void UpdateFulfillHTLC_set_htlc_id(LDKUpdateFulfillHTLC *this_ptr, uint64_t val);
5229 * The pre-image of the payment hash, allowing HTLC redemption
5231 const uint8_t (*UpdateFulfillHTLC_get_payment_preimage(const LDKUpdateFulfillHTLC *this_ptr))[32];
5234 * The pre-image of the payment hash, allowing HTLC redemption
5236 void UpdateFulfillHTLC_set_payment_preimage(LDKUpdateFulfillHTLC *this_ptr, LDKThirtyTwoBytes val);
5238 MUST_USE_RES LDKUpdateFulfillHTLC UpdateFulfillHTLC_new(LDKThirtyTwoBytes channel_id_arg, uint64_t htlc_id_arg, LDKThirtyTwoBytes payment_preimage_arg);
5240 void UpdateFailHTLC_free(LDKUpdateFailHTLC this_ptr);
5242 LDKUpdateFailHTLC UpdateFailHTLC_clone(const LDKUpdateFailHTLC *orig);
5247 const uint8_t (*UpdateFailHTLC_get_channel_id(const LDKUpdateFailHTLC *this_ptr))[32];
5252 void UpdateFailHTLC_set_channel_id(LDKUpdateFailHTLC *this_ptr, LDKThirtyTwoBytes val);
5257 uint64_t UpdateFailHTLC_get_htlc_id(const LDKUpdateFailHTLC *this_ptr);
5262 void UpdateFailHTLC_set_htlc_id(LDKUpdateFailHTLC *this_ptr, uint64_t val);
5264 void UpdateFailMalformedHTLC_free(LDKUpdateFailMalformedHTLC this_ptr);
5266 LDKUpdateFailMalformedHTLC UpdateFailMalformedHTLC_clone(const LDKUpdateFailMalformedHTLC *orig);
5271 const uint8_t (*UpdateFailMalformedHTLC_get_channel_id(const LDKUpdateFailMalformedHTLC *this_ptr))[32];
5276 void UpdateFailMalformedHTLC_set_channel_id(LDKUpdateFailMalformedHTLC *this_ptr, LDKThirtyTwoBytes val);
5281 uint64_t UpdateFailMalformedHTLC_get_htlc_id(const LDKUpdateFailMalformedHTLC *this_ptr);
5286 void UpdateFailMalformedHTLC_set_htlc_id(LDKUpdateFailMalformedHTLC *this_ptr, uint64_t val);
5291 uint16_t UpdateFailMalformedHTLC_get_failure_code(const LDKUpdateFailMalformedHTLC *this_ptr);
5296 void UpdateFailMalformedHTLC_set_failure_code(LDKUpdateFailMalformedHTLC *this_ptr, uint16_t val);
5298 void CommitmentSigned_free(LDKCommitmentSigned this_ptr);
5300 LDKCommitmentSigned CommitmentSigned_clone(const LDKCommitmentSigned *orig);
5305 const uint8_t (*CommitmentSigned_get_channel_id(const LDKCommitmentSigned *this_ptr))[32];
5310 void CommitmentSigned_set_channel_id(LDKCommitmentSigned *this_ptr, LDKThirtyTwoBytes val);
5313 * A signature on the commitment transaction
5315 LDKSignature CommitmentSigned_get_signature(const LDKCommitmentSigned *this_ptr);
5318 * A signature on the commitment transaction
5320 void CommitmentSigned_set_signature(LDKCommitmentSigned *this_ptr, LDKSignature val);
5323 * Signatures on the HTLC transactions
5325 void CommitmentSigned_set_htlc_signatures(LDKCommitmentSigned *this_ptr, LDKCVec_SignatureZ val);
5327 MUST_USE_RES LDKCommitmentSigned CommitmentSigned_new(LDKThirtyTwoBytes channel_id_arg, LDKSignature signature_arg, LDKCVec_SignatureZ htlc_signatures_arg);
5329 void RevokeAndACK_free(LDKRevokeAndACK this_ptr);
5331 LDKRevokeAndACK RevokeAndACK_clone(const LDKRevokeAndACK *orig);
5336 const uint8_t (*RevokeAndACK_get_channel_id(const LDKRevokeAndACK *this_ptr))[32];
5341 void RevokeAndACK_set_channel_id(LDKRevokeAndACK *this_ptr, LDKThirtyTwoBytes val);
5344 * The secret corresponding to the per-commitment point
5346 const uint8_t (*RevokeAndACK_get_per_commitment_secret(const LDKRevokeAndACK *this_ptr))[32];
5349 * The secret corresponding to the per-commitment point
5351 void RevokeAndACK_set_per_commitment_secret(LDKRevokeAndACK *this_ptr, LDKThirtyTwoBytes val);
5354 * The next sender-broadcast commitment transaction's per-commitment point
5356 LDKPublicKey RevokeAndACK_get_next_per_commitment_point(const LDKRevokeAndACK *this_ptr);
5359 * The next sender-broadcast commitment transaction's per-commitment point
5361 void RevokeAndACK_set_next_per_commitment_point(LDKRevokeAndACK *this_ptr, LDKPublicKey val);
5363 MUST_USE_RES LDKRevokeAndACK RevokeAndACK_new(LDKThirtyTwoBytes channel_id_arg, LDKThirtyTwoBytes per_commitment_secret_arg, LDKPublicKey next_per_commitment_point_arg);
5365 void UpdateFee_free(LDKUpdateFee this_ptr);
5367 LDKUpdateFee UpdateFee_clone(const LDKUpdateFee *orig);
5372 const uint8_t (*UpdateFee_get_channel_id(const LDKUpdateFee *this_ptr))[32];
5377 void UpdateFee_set_channel_id(LDKUpdateFee *this_ptr, LDKThirtyTwoBytes val);
5380 * Fee rate per 1000-weight of the transaction
5382 uint32_t UpdateFee_get_feerate_per_kw(const LDKUpdateFee *this_ptr);
5385 * Fee rate per 1000-weight of the transaction
5387 void UpdateFee_set_feerate_per_kw(LDKUpdateFee *this_ptr, uint32_t val);
5389 MUST_USE_RES LDKUpdateFee UpdateFee_new(LDKThirtyTwoBytes channel_id_arg, uint32_t feerate_per_kw_arg);
5391 void DataLossProtect_free(LDKDataLossProtect this_ptr);
5393 LDKDataLossProtect DataLossProtect_clone(const LDKDataLossProtect *orig);
5396 * Proof that the sender knows the per-commitment secret of a specific commitment transaction
5397 * belonging to the recipient
5399 const uint8_t (*DataLossProtect_get_your_last_per_commitment_secret(const LDKDataLossProtect *this_ptr))[32];
5402 * Proof that the sender knows the per-commitment secret of a specific commitment transaction
5403 * belonging to the recipient
5405 void DataLossProtect_set_your_last_per_commitment_secret(LDKDataLossProtect *this_ptr, LDKThirtyTwoBytes val);
5408 * The sender's per-commitment point for their current commitment transaction
5410 LDKPublicKey DataLossProtect_get_my_current_per_commitment_point(const LDKDataLossProtect *this_ptr);
5413 * The sender's per-commitment point for their current commitment transaction
5415 void DataLossProtect_set_my_current_per_commitment_point(LDKDataLossProtect *this_ptr, LDKPublicKey val);
5417 MUST_USE_RES LDKDataLossProtect DataLossProtect_new(LDKThirtyTwoBytes your_last_per_commitment_secret_arg, LDKPublicKey my_current_per_commitment_point_arg);
5419 void ChannelReestablish_free(LDKChannelReestablish this_ptr);
5421 LDKChannelReestablish ChannelReestablish_clone(const LDKChannelReestablish *orig);
5426 const uint8_t (*ChannelReestablish_get_channel_id(const LDKChannelReestablish *this_ptr))[32];
5431 void ChannelReestablish_set_channel_id(LDKChannelReestablish *this_ptr, LDKThirtyTwoBytes val);
5434 * The next commitment number for the sender
5436 uint64_t ChannelReestablish_get_next_local_commitment_number(const LDKChannelReestablish *this_ptr);
5439 * The next commitment number for the sender
5441 void ChannelReestablish_set_next_local_commitment_number(LDKChannelReestablish *this_ptr, uint64_t val);
5444 * The next commitment number for the recipient
5446 uint64_t ChannelReestablish_get_next_remote_commitment_number(const LDKChannelReestablish *this_ptr);
5449 * The next commitment number for the recipient
5451 void ChannelReestablish_set_next_remote_commitment_number(LDKChannelReestablish *this_ptr, uint64_t val);
5453 void AnnouncementSignatures_free(LDKAnnouncementSignatures this_ptr);
5455 LDKAnnouncementSignatures AnnouncementSignatures_clone(const LDKAnnouncementSignatures *orig);
5460 const uint8_t (*AnnouncementSignatures_get_channel_id(const LDKAnnouncementSignatures *this_ptr))[32];
5465 void AnnouncementSignatures_set_channel_id(LDKAnnouncementSignatures *this_ptr, LDKThirtyTwoBytes val);
5468 * The short channel ID
5470 uint64_t AnnouncementSignatures_get_short_channel_id(const LDKAnnouncementSignatures *this_ptr);
5473 * The short channel ID
5475 void AnnouncementSignatures_set_short_channel_id(LDKAnnouncementSignatures *this_ptr, uint64_t val);
5478 * A signature by the node key
5480 LDKSignature AnnouncementSignatures_get_node_signature(const LDKAnnouncementSignatures *this_ptr);
5483 * A signature by the node key
5485 void AnnouncementSignatures_set_node_signature(LDKAnnouncementSignatures *this_ptr, LDKSignature val);
5488 * A signature by the funding key
5490 LDKSignature AnnouncementSignatures_get_bitcoin_signature(const LDKAnnouncementSignatures *this_ptr);
5493 * A signature by the funding key
5495 void AnnouncementSignatures_set_bitcoin_signature(LDKAnnouncementSignatures *this_ptr, LDKSignature val);
5497 MUST_USE_RES LDKAnnouncementSignatures AnnouncementSignatures_new(LDKThirtyTwoBytes channel_id_arg, uint64_t short_channel_id_arg, LDKSignature node_signature_arg, LDKSignature bitcoin_signature_arg);
5499 void NetAddress_free(LDKNetAddress this_ptr);
5501 LDKNetAddress NetAddress_clone(const LDKNetAddress *orig);
5503 void UnsignedNodeAnnouncement_free(LDKUnsignedNodeAnnouncement this_ptr);
5505 LDKUnsignedNodeAnnouncement UnsignedNodeAnnouncement_clone(const LDKUnsignedNodeAnnouncement *orig);
5508 * The advertised features
5510 LDKNodeFeatures UnsignedNodeAnnouncement_get_features(const LDKUnsignedNodeAnnouncement *this_ptr);
5513 * The advertised features
5515 void UnsignedNodeAnnouncement_set_features(LDKUnsignedNodeAnnouncement *this_ptr, LDKNodeFeatures val);
5518 * A strictly monotonic announcement counter, with gaps allowed
5520 uint32_t UnsignedNodeAnnouncement_get_timestamp(const LDKUnsignedNodeAnnouncement *this_ptr);
5523 * A strictly monotonic announcement counter, with gaps allowed
5525 void UnsignedNodeAnnouncement_set_timestamp(LDKUnsignedNodeAnnouncement *this_ptr, uint32_t val);
5528 * The node_id this announcement originated from (don't rebroadcast the node_announcement back
5531 LDKPublicKey UnsignedNodeAnnouncement_get_node_id(const LDKUnsignedNodeAnnouncement *this_ptr);
5534 * The node_id this announcement originated from (don't rebroadcast the node_announcement back
5537 void UnsignedNodeAnnouncement_set_node_id(LDKUnsignedNodeAnnouncement *this_ptr, LDKPublicKey val);
5540 * An RGB color for UI purposes
5542 const uint8_t (*UnsignedNodeAnnouncement_get_rgb(const LDKUnsignedNodeAnnouncement *this_ptr))[3];
5545 * An RGB color for UI purposes
5547 void UnsignedNodeAnnouncement_set_rgb(LDKUnsignedNodeAnnouncement *this_ptr, LDKThreeBytes val);
5550 * An alias, for UI purposes. This should be sanitized before use. There is no guarantee
5553 const uint8_t (*UnsignedNodeAnnouncement_get_alias(const LDKUnsignedNodeAnnouncement *this_ptr))[32];
5556 * An alias, for UI purposes. This should be sanitized before use. There is no guarantee
5559 void UnsignedNodeAnnouncement_set_alias(LDKUnsignedNodeAnnouncement *this_ptr, LDKThirtyTwoBytes val);
5562 * List of addresses on which this node is reachable
5564 void UnsignedNodeAnnouncement_set_addresses(LDKUnsignedNodeAnnouncement *this_ptr, LDKCVec_NetAddressZ val);
5566 void NodeAnnouncement_free(LDKNodeAnnouncement this_ptr);
5568 LDKNodeAnnouncement NodeAnnouncement_clone(const LDKNodeAnnouncement *orig);
5571 * The signature by the node key
5573 LDKSignature NodeAnnouncement_get_signature(const LDKNodeAnnouncement *this_ptr);
5576 * The signature by the node key
5578 void NodeAnnouncement_set_signature(LDKNodeAnnouncement *this_ptr, LDKSignature val);
5581 * The actual content of the announcement
5583 LDKUnsignedNodeAnnouncement NodeAnnouncement_get_contents(const LDKNodeAnnouncement *this_ptr);
5586 * The actual content of the announcement
5588 void NodeAnnouncement_set_contents(LDKNodeAnnouncement *this_ptr, LDKUnsignedNodeAnnouncement val);
5590 MUST_USE_RES LDKNodeAnnouncement NodeAnnouncement_new(LDKSignature signature_arg, LDKUnsignedNodeAnnouncement contents_arg);
5592 void UnsignedChannelAnnouncement_free(LDKUnsignedChannelAnnouncement this_ptr);
5594 LDKUnsignedChannelAnnouncement UnsignedChannelAnnouncement_clone(const LDKUnsignedChannelAnnouncement *orig);
5597 * The advertised channel features
5599 LDKChannelFeatures UnsignedChannelAnnouncement_get_features(const LDKUnsignedChannelAnnouncement *this_ptr);
5602 * The advertised channel features
5604 void UnsignedChannelAnnouncement_set_features(LDKUnsignedChannelAnnouncement *this_ptr, LDKChannelFeatures val);
5607 * The genesis hash of the blockchain where the channel is to be opened
5609 const uint8_t (*UnsignedChannelAnnouncement_get_chain_hash(const LDKUnsignedChannelAnnouncement *this_ptr))[32];
5612 * The genesis hash of the blockchain where the channel is to be opened
5614 void UnsignedChannelAnnouncement_set_chain_hash(LDKUnsignedChannelAnnouncement *this_ptr, LDKThirtyTwoBytes val);
5617 * The short channel ID
5619 uint64_t UnsignedChannelAnnouncement_get_short_channel_id(const LDKUnsignedChannelAnnouncement *this_ptr);
5622 * The short channel ID
5624 void UnsignedChannelAnnouncement_set_short_channel_id(LDKUnsignedChannelAnnouncement *this_ptr, uint64_t val);
5627 * One of the two node_ids which are endpoints of this channel
5629 LDKPublicKey UnsignedChannelAnnouncement_get_node_id_1(const LDKUnsignedChannelAnnouncement *this_ptr);
5632 * One of the two node_ids which are endpoints of this channel
5634 void UnsignedChannelAnnouncement_set_node_id_1(LDKUnsignedChannelAnnouncement *this_ptr, LDKPublicKey val);
5637 * The other of the two node_ids which are endpoints of this channel
5639 LDKPublicKey UnsignedChannelAnnouncement_get_node_id_2(const LDKUnsignedChannelAnnouncement *this_ptr);
5642 * The other of the two node_ids which are endpoints of this channel
5644 void UnsignedChannelAnnouncement_set_node_id_2(LDKUnsignedChannelAnnouncement *this_ptr, LDKPublicKey val);
5647 * The funding key for the first node
5649 LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_1(const LDKUnsignedChannelAnnouncement *this_ptr);
5652 * The funding key for the first node
5654 void UnsignedChannelAnnouncement_set_bitcoin_key_1(LDKUnsignedChannelAnnouncement *this_ptr, LDKPublicKey val);
5657 * The funding key for the second node
5659 LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_2(const LDKUnsignedChannelAnnouncement *this_ptr);
5662 * The funding key for the second node
5664 void UnsignedChannelAnnouncement_set_bitcoin_key_2(LDKUnsignedChannelAnnouncement *this_ptr, LDKPublicKey val);
5666 void ChannelAnnouncement_free(LDKChannelAnnouncement this_ptr);
5668 LDKChannelAnnouncement ChannelAnnouncement_clone(const LDKChannelAnnouncement *orig);
5671 * Authentication of the announcement by the first public node
5673 LDKSignature ChannelAnnouncement_get_node_signature_1(const LDKChannelAnnouncement *this_ptr);
5676 * Authentication of the announcement by the first public node
5678 void ChannelAnnouncement_set_node_signature_1(LDKChannelAnnouncement *this_ptr, LDKSignature val);
5681 * Authentication of the announcement by the second public node
5683 LDKSignature ChannelAnnouncement_get_node_signature_2(const LDKChannelAnnouncement *this_ptr);
5686 * Authentication of the announcement by the second public node
5688 void ChannelAnnouncement_set_node_signature_2(LDKChannelAnnouncement *this_ptr, LDKSignature val);
5691 * Proof of funding UTXO ownership by the first public node
5693 LDKSignature ChannelAnnouncement_get_bitcoin_signature_1(const LDKChannelAnnouncement *this_ptr);
5696 * Proof of funding UTXO ownership by the first public node
5698 void ChannelAnnouncement_set_bitcoin_signature_1(LDKChannelAnnouncement *this_ptr, LDKSignature val);
5701 * Proof of funding UTXO ownership by the second public node
5703 LDKSignature ChannelAnnouncement_get_bitcoin_signature_2(const LDKChannelAnnouncement *this_ptr);
5706 * Proof of funding UTXO ownership by the second public node
5708 void ChannelAnnouncement_set_bitcoin_signature_2(LDKChannelAnnouncement *this_ptr, LDKSignature val);
5711 * The actual announcement
5713 LDKUnsignedChannelAnnouncement ChannelAnnouncement_get_contents(const LDKChannelAnnouncement *this_ptr);
5716 * The actual announcement
5718 void ChannelAnnouncement_set_contents(LDKChannelAnnouncement *this_ptr, LDKUnsignedChannelAnnouncement val);
5720 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);
5722 void UnsignedChannelUpdate_free(LDKUnsignedChannelUpdate this_ptr);
5724 LDKUnsignedChannelUpdate UnsignedChannelUpdate_clone(const LDKUnsignedChannelUpdate *orig);
5727 * The genesis hash of the blockchain where the channel is to be opened
5729 const uint8_t (*UnsignedChannelUpdate_get_chain_hash(const LDKUnsignedChannelUpdate *this_ptr))[32];
5732 * The genesis hash of the blockchain where the channel is to be opened
5734 void UnsignedChannelUpdate_set_chain_hash(LDKUnsignedChannelUpdate *this_ptr, LDKThirtyTwoBytes val);
5737 * The short channel ID
5739 uint64_t UnsignedChannelUpdate_get_short_channel_id(const LDKUnsignedChannelUpdate *this_ptr);
5742 * The short channel ID
5744 void UnsignedChannelUpdate_set_short_channel_id(LDKUnsignedChannelUpdate *this_ptr, uint64_t val);
5747 * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
5749 uint32_t UnsignedChannelUpdate_get_timestamp(const LDKUnsignedChannelUpdate *this_ptr);
5752 * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
5754 void UnsignedChannelUpdate_set_timestamp(LDKUnsignedChannelUpdate *this_ptr, uint32_t val);
5759 uint8_t UnsignedChannelUpdate_get_flags(const LDKUnsignedChannelUpdate *this_ptr);
5764 void UnsignedChannelUpdate_set_flags(LDKUnsignedChannelUpdate *this_ptr, uint8_t val);
5767 * The number of blocks to subtract from incoming HTLC cltv_expiry values
5769 uint16_t UnsignedChannelUpdate_get_cltv_expiry_delta(const LDKUnsignedChannelUpdate *this_ptr);
5772 * The number of blocks to subtract from incoming HTLC cltv_expiry values
5774 void UnsignedChannelUpdate_set_cltv_expiry_delta(LDKUnsignedChannelUpdate *this_ptr, uint16_t val);
5777 * The minimum HTLC size incoming to sender, in milli-satoshi
5779 uint64_t UnsignedChannelUpdate_get_htlc_minimum_msat(const LDKUnsignedChannelUpdate *this_ptr);
5782 * The minimum HTLC size incoming to sender, in milli-satoshi
5784 void UnsignedChannelUpdate_set_htlc_minimum_msat(LDKUnsignedChannelUpdate *this_ptr, uint64_t val);
5787 * The base HTLC fee charged by sender, in milli-satoshi
5789 uint32_t UnsignedChannelUpdate_get_fee_base_msat(const LDKUnsignedChannelUpdate *this_ptr);
5792 * The base HTLC fee charged by sender, in milli-satoshi
5794 void UnsignedChannelUpdate_set_fee_base_msat(LDKUnsignedChannelUpdate *this_ptr, uint32_t val);
5797 * The amount to fee multiplier, in micro-satoshi
5799 uint32_t UnsignedChannelUpdate_get_fee_proportional_millionths(const LDKUnsignedChannelUpdate *this_ptr);
5802 * The amount to fee multiplier, in micro-satoshi
5804 void UnsignedChannelUpdate_set_fee_proportional_millionths(LDKUnsignedChannelUpdate *this_ptr, uint32_t val);
5806 void ChannelUpdate_free(LDKChannelUpdate this_ptr);
5808 LDKChannelUpdate ChannelUpdate_clone(const LDKChannelUpdate *orig);
5811 * A signature of the channel update
5813 LDKSignature ChannelUpdate_get_signature(const LDKChannelUpdate *this_ptr);
5816 * A signature of the channel update
5818 void ChannelUpdate_set_signature(LDKChannelUpdate *this_ptr, LDKSignature val);
5821 * The actual channel update
5823 LDKUnsignedChannelUpdate ChannelUpdate_get_contents(const LDKChannelUpdate *this_ptr);
5826 * The actual channel update
5828 void ChannelUpdate_set_contents(LDKChannelUpdate *this_ptr, LDKUnsignedChannelUpdate val);
5830 MUST_USE_RES LDKChannelUpdate ChannelUpdate_new(LDKSignature signature_arg, LDKUnsignedChannelUpdate contents_arg);
5832 void QueryChannelRange_free(LDKQueryChannelRange this_ptr);
5834 LDKQueryChannelRange QueryChannelRange_clone(const LDKQueryChannelRange *orig);
5837 * The genesis hash of the blockchain being queried
5839 const uint8_t (*QueryChannelRange_get_chain_hash(const LDKQueryChannelRange *this_ptr))[32];
5842 * The genesis hash of the blockchain being queried
5844 void QueryChannelRange_set_chain_hash(LDKQueryChannelRange *this_ptr, LDKThirtyTwoBytes val);
5847 * The height of the first block for the channel UTXOs being queried
5849 uint32_t QueryChannelRange_get_first_blocknum(const LDKQueryChannelRange *this_ptr);
5852 * The height of the first block for the channel UTXOs being queried
5854 void QueryChannelRange_set_first_blocknum(LDKQueryChannelRange *this_ptr, uint32_t val);
5857 * The number of blocks to include in the query results
5859 uint32_t QueryChannelRange_get_number_of_blocks(const LDKQueryChannelRange *this_ptr);
5862 * The number of blocks to include in the query results
5864 void QueryChannelRange_set_number_of_blocks(LDKQueryChannelRange *this_ptr, uint32_t val);
5866 MUST_USE_RES LDKQueryChannelRange QueryChannelRange_new(LDKThirtyTwoBytes chain_hash_arg, uint32_t first_blocknum_arg, uint32_t number_of_blocks_arg);
5868 void ReplyChannelRange_free(LDKReplyChannelRange this_ptr);
5870 LDKReplyChannelRange ReplyChannelRange_clone(const LDKReplyChannelRange *orig);
5873 * The genesis hash of the blockchain being queried
5875 const uint8_t (*ReplyChannelRange_get_chain_hash(const LDKReplyChannelRange *this_ptr))[32];
5878 * The genesis hash of the blockchain being queried
5880 void ReplyChannelRange_set_chain_hash(LDKReplyChannelRange *this_ptr, LDKThirtyTwoBytes val);
5883 * The height of the first block in the range of the reply
5885 uint32_t ReplyChannelRange_get_first_blocknum(const LDKReplyChannelRange *this_ptr);
5888 * The height of the first block in the range of the reply
5890 void ReplyChannelRange_set_first_blocknum(LDKReplyChannelRange *this_ptr, uint32_t val);
5893 * The number of blocks included in the range of the reply
5895 uint32_t ReplyChannelRange_get_number_of_blocks(const LDKReplyChannelRange *this_ptr);
5898 * The number of blocks included in the range of the reply
5900 void ReplyChannelRange_set_number_of_blocks(LDKReplyChannelRange *this_ptr, uint32_t val);
5903 * Indicates if the query recipient maintains up-to-date channel
5904 * information for the chain_hash
5906 bool ReplyChannelRange_get_full_information(const LDKReplyChannelRange *this_ptr);
5909 * Indicates if the query recipient maintains up-to-date channel
5910 * information for the chain_hash
5912 void ReplyChannelRange_set_full_information(LDKReplyChannelRange *this_ptr, bool val);
5915 * The short_channel_ids in the channel range
5917 void ReplyChannelRange_set_short_channel_ids(LDKReplyChannelRange *this_ptr, LDKCVec_u64Z val);
5919 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);
5921 void QueryShortChannelIds_free(LDKQueryShortChannelIds this_ptr);
5923 LDKQueryShortChannelIds QueryShortChannelIds_clone(const LDKQueryShortChannelIds *orig);
5926 * The genesis hash of the blockchain being queried
5928 const uint8_t (*QueryShortChannelIds_get_chain_hash(const LDKQueryShortChannelIds *this_ptr))[32];
5931 * The genesis hash of the blockchain being queried
5933 void QueryShortChannelIds_set_chain_hash(LDKQueryShortChannelIds *this_ptr, LDKThirtyTwoBytes val);
5936 * The short_channel_ids that are being queried
5938 void QueryShortChannelIds_set_short_channel_ids(LDKQueryShortChannelIds *this_ptr, LDKCVec_u64Z val);
5940 MUST_USE_RES LDKQueryShortChannelIds QueryShortChannelIds_new(LDKThirtyTwoBytes chain_hash_arg, LDKCVec_u64Z short_channel_ids_arg);
5942 void ReplyShortChannelIdsEnd_free(LDKReplyShortChannelIdsEnd this_ptr);
5944 LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_clone(const LDKReplyShortChannelIdsEnd *orig);
5947 * The genesis hash of the blockchain that was queried
5949 const uint8_t (*ReplyShortChannelIdsEnd_get_chain_hash(const LDKReplyShortChannelIdsEnd *this_ptr))[32];
5952 * The genesis hash of the blockchain that was queried
5954 void ReplyShortChannelIdsEnd_set_chain_hash(LDKReplyShortChannelIdsEnd *this_ptr, LDKThirtyTwoBytes val);
5957 * Indicates if the query recipient maintains up-to-date channel
5958 * information for the chain_hash
5960 bool ReplyShortChannelIdsEnd_get_full_information(const LDKReplyShortChannelIdsEnd *this_ptr);
5963 * Indicates if the query recipient maintains up-to-date channel
5964 * information for the chain_hash
5966 void ReplyShortChannelIdsEnd_set_full_information(LDKReplyShortChannelIdsEnd *this_ptr, bool val);
5968 MUST_USE_RES LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_new(LDKThirtyTwoBytes chain_hash_arg, bool full_information_arg);
5970 void GossipTimestampFilter_free(LDKGossipTimestampFilter this_ptr);
5972 LDKGossipTimestampFilter GossipTimestampFilter_clone(const LDKGossipTimestampFilter *orig);
5975 * The genesis hash of the blockchain for channel and node information
5977 const uint8_t (*GossipTimestampFilter_get_chain_hash(const LDKGossipTimestampFilter *this_ptr))[32];
5980 * The genesis hash of the blockchain for channel and node information
5982 void GossipTimestampFilter_set_chain_hash(LDKGossipTimestampFilter *this_ptr, LDKThirtyTwoBytes val);
5985 * The starting unix timestamp
5987 uint32_t GossipTimestampFilter_get_first_timestamp(const LDKGossipTimestampFilter *this_ptr);
5990 * The starting unix timestamp
5992 void GossipTimestampFilter_set_first_timestamp(LDKGossipTimestampFilter *this_ptr, uint32_t val);
5995 * The range of information in seconds
5997 uint32_t GossipTimestampFilter_get_timestamp_range(const LDKGossipTimestampFilter *this_ptr);
6000 * The range of information in seconds
6002 void GossipTimestampFilter_set_timestamp_range(LDKGossipTimestampFilter *this_ptr, uint32_t val);
6004 MUST_USE_RES LDKGossipTimestampFilter GossipTimestampFilter_new(LDKThirtyTwoBytes chain_hash_arg, uint32_t first_timestamp_arg, uint32_t timestamp_range_arg);
6006 void ErrorAction_free(LDKErrorAction this_ptr);
6008 LDKErrorAction ErrorAction_clone(const LDKErrorAction *orig);
6010 void LightningError_free(LDKLightningError this_ptr);
6013 * A human-readable message describing the error
6015 LDKStr LightningError_get_err(const LDKLightningError *this_ptr);
6018 * A human-readable message describing the error
6020 void LightningError_set_err(LDKLightningError *this_ptr, LDKCVec_u8Z val);
6023 * The action which should be taken against the offending peer.
6025 LDKErrorAction LightningError_get_action(const LDKLightningError *this_ptr);
6028 * The action which should be taken against the offending peer.
6030 void LightningError_set_action(LDKLightningError *this_ptr, LDKErrorAction val);
6032 MUST_USE_RES LDKLightningError LightningError_new(LDKCVec_u8Z err_arg, LDKErrorAction action_arg);
6034 void CommitmentUpdate_free(LDKCommitmentUpdate this_ptr);
6036 LDKCommitmentUpdate CommitmentUpdate_clone(const LDKCommitmentUpdate *orig);
6039 * update_add_htlc messages which should be sent
6041 void CommitmentUpdate_set_update_add_htlcs(LDKCommitmentUpdate *this_ptr, LDKCVec_UpdateAddHTLCZ val);
6044 * update_fulfill_htlc messages which should be sent
6046 void CommitmentUpdate_set_update_fulfill_htlcs(LDKCommitmentUpdate *this_ptr, LDKCVec_UpdateFulfillHTLCZ val);
6049 * update_fail_htlc messages which should be sent
6051 void CommitmentUpdate_set_update_fail_htlcs(LDKCommitmentUpdate *this_ptr, LDKCVec_UpdateFailHTLCZ val);
6054 * update_fail_malformed_htlc messages which should be sent
6056 void CommitmentUpdate_set_update_fail_malformed_htlcs(LDKCommitmentUpdate *this_ptr, LDKCVec_UpdateFailMalformedHTLCZ val);
6059 * An update_fee message which should be sent
6061 LDKUpdateFee CommitmentUpdate_get_update_fee(const LDKCommitmentUpdate *this_ptr);
6064 * An update_fee message which should be sent
6066 void CommitmentUpdate_set_update_fee(LDKCommitmentUpdate *this_ptr, LDKUpdateFee val);
6069 * Finally, the commitment_signed message which should be sent
6071 LDKCommitmentSigned CommitmentUpdate_get_commitment_signed(const LDKCommitmentUpdate *this_ptr);
6074 * Finally, the commitment_signed message which should be sent
6076 void CommitmentUpdate_set_commitment_signed(LDKCommitmentUpdate *this_ptr, LDKCommitmentSigned val);
6078 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);
6080 void HTLCFailChannelUpdate_free(LDKHTLCFailChannelUpdate this_ptr);
6082 LDKHTLCFailChannelUpdate HTLCFailChannelUpdate_clone(const LDKHTLCFailChannelUpdate *orig);
6085 * Calls the free function if one is set
6087 void ChannelMessageHandler_free(LDKChannelMessageHandler this_ptr);
6090 * Calls the free function if one is set
6092 void RoutingMessageHandler_free(LDKRoutingMessageHandler this_ptr);
6094 LDKCVec_u8Z AcceptChannel_write(const LDKAcceptChannel *obj);
6096 LDKAcceptChannel AcceptChannel_read(LDKu8slice ser);
6098 LDKCVec_u8Z AnnouncementSignatures_write(const LDKAnnouncementSignatures *obj);
6100 LDKAnnouncementSignatures AnnouncementSignatures_read(LDKu8slice ser);
6102 LDKCVec_u8Z ChannelReestablish_write(const LDKChannelReestablish *obj);
6104 LDKChannelReestablish ChannelReestablish_read(LDKu8slice ser);
6106 LDKCVec_u8Z ClosingSigned_write(const LDKClosingSigned *obj);
6108 LDKClosingSigned ClosingSigned_read(LDKu8slice ser);
6110 LDKCVec_u8Z CommitmentSigned_write(const LDKCommitmentSigned *obj);
6112 LDKCommitmentSigned CommitmentSigned_read(LDKu8slice ser);
6114 LDKCVec_u8Z FundingCreated_write(const LDKFundingCreated *obj);
6116 LDKFundingCreated FundingCreated_read(LDKu8slice ser);
6118 LDKCVec_u8Z FundingSigned_write(const LDKFundingSigned *obj);
6120 LDKFundingSigned FundingSigned_read(LDKu8slice ser);
6122 LDKCVec_u8Z FundingLocked_write(const LDKFundingLocked *obj);
6124 LDKFundingLocked FundingLocked_read(LDKu8slice ser);
6126 LDKCVec_u8Z Init_write(const LDKInit *obj);
6128 LDKInit Init_read(LDKu8slice ser);
6130 LDKCVec_u8Z OpenChannel_write(const LDKOpenChannel *obj);
6132 LDKOpenChannel OpenChannel_read(LDKu8slice ser);
6134 LDKCVec_u8Z RevokeAndACK_write(const LDKRevokeAndACK *obj);
6136 LDKRevokeAndACK RevokeAndACK_read(LDKu8slice ser);
6138 LDKCVec_u8Z Shutdown_write(const LDKShutdown *obj);
6140 LDKShutdown Shutdown_read(LDKu8slice ser);
6142 LDKCVec_u8Z UpdateFailHTLC_write(const LDKUpdateFailHTLC *obj);
6144 LDKUpdateFailHTLC UpdateFailHTLC_read(LDKu8slice ser);
6146 LDKCVec_u8Z UpdateFailMalformedHTLC_write(const LDKUpdateFailMalformedHTLC *obj);
6148 LDKUpdateFailMalformedHTLC UpdateFailMalformedHTLC_read(LDKu8slice ser);
6150 LDKCVec_u8Z UpdateFee_write(const LDKUpdateFee *obj);
6152 LDKUpdateFee UpdateFee_read(LDKu8slice ser);
6154 LDKCVec_u8Z UpdateFulfillHTLC_write(const LDKUpdateFulfillHTLC *obj);
6156 LDKUpdateFulfillHTLC UpdateFulfillHTLC_read(LDKu8slice ser);
6158 LDKCVec_u8Z UpdateAddHTLC_write(const LDKUpdateAddHTLC *obj);
6160 LDKUpdateAddHTLC UpdateAddHTLC_read(LDKu8slice ser);
6162 LDKCVec_u8Z Ping_write(const LDKPing *obj);
6164 LDKPing Ping_read(LDKu8slice ser);
6166 LDKCVec_u8Z Pong_write(const LDKPong *obj);
6168 LDKPong Pong_read(LDKu8slice ser);
6170 LDKCVec_u8Z UnsignedChannelAnnouncement_write(const LDKUnsignedChannelAnnouncement *obj);
6172 LDKUnsignedChannelAnnouncement UnsignedChannelAnnouncement_read(LDKu8slice ser);
6174 LDKCVec_u8Z ChannelAnnouncement_write(const LDKChannelAnnouncement *obj);
6176 LDKChannelAnnouncement ChannelAnnouncement_read(LDKu8slice ser);
6178 LDKCVec_u8Z UnsignedChannelUpdate_write(const LDKUnsignedChannelUpdate *obj);
6180 LDKUnsignedChannelUpdate UnsignedChannelUpdate_read(LDKu8slice ser);
6182 LDKCVec_u8Z ChannelUpdate_write(const LDKChannelUpdate *obj);
6184 LDKChannelUpdate ChannelUpdate_read(LDKu8slice ser);
6186 LDKCVec_u8Z ErrorMessage_write(const LDKErrorMessage *obj);
6188 LDKErrorMessage ErrorMessage_read(LDKu8slice ser);
6190 LDKCVec_u8Z UnsignedNodeAnnouncement_write(const LDKUnsignedNodeAnnouncement *obj);
6192 LDKUnsignedNodeAnnouncement UnsignedNodeAnnouncement_read(LDKu8slice ser);
6194 LDKCVec_u8Z NodeAnnouncement_write(const LDKNodeAnnouncement *obj);
6196 LDKNodeAnnouncement NodeAnnouncement_read(LDKu8slice ser);
6198 LDKQueryShortChannelIds QueryShortChannelIds_read(LDKu8slice ser);
6200 LDKCVec_u8Z QueryShortChannelIds_write(const LDKQueryShortChannelIds *obj);
6202 LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_read(LDKu8slice ser);
6204 LDKCVec_u8Z ReplyShortChannelIdsEnd_write(const LDKReplyShortChannelIdsEnd *obj);
6206 LDKQueryChannelRange QueryChannelRange_read(LDKu8slice ser);
6208 LDKCVec_u8Z QueryChannelRange_write(const LDKQueryChannelRange *obj);
6210 LDKReplyChannelRange ReplyChannelRange_read(LDKu8slice ser);
6212 LDKCVec_u8Z ReplyChannelRange_write(const LDKReplyChannelRange *obj);
6214 LDKGossipTimestampFilter GossipTimestampFilter_read(LDKu8slice ser);
6216 LDKCVec_u8Z GossipTimestampFilter_write(const LDKGossipTimestampFilter *obj);
6218 void MessageHandler_free(LDKMessageHandler this_ptr);
6221 * A message handler which handles messages specific to channels. Usually this is just a
6222 * ChannelManager object.
6224 const LDKChannelMessageHandler *MessageHandler_get_chan_handler(const LDKMessageHandler *this_ptr);
6227 * A message handler which handles messages specific to channels. Usually this is just a
6228 * ChannelManager object.
6230 void MessageHandler_set_chan_handler(LDKMessageHandler *this_ptr, LDKChannelMessageHandler val);
6233 * A message handler which handles messages updating our knowledge of the network channel
6234 * graph. Usually this is just a NetGraphMsgHandlerMonitor object.
6236 const LDKRoutingMessageHandler *MessageHandler_get_route_handler(const LDKMessageHandler *this_ptr);
6239 * A message handler which handles messages updating our knowledge of the network channel
6240 * graph. Usually this is just a NetGraphMsgHandlerMonitor object.
6242 void MessageHandler_set_route_handler(LDKMessageHandler *this_ptr, LDKRoutingMessageHandler val);
6244 MUST_USE_RES LDKMessageHandler MessageHandler_new(LDKChannelMessageHandler chan_handler_arg, LDKRoutingMessageHandler route_handler_arg);
6246 LDKSocketDescriptor SocketDescriptor_clone(const LDKSocketDescriptor *orig);
6249 * Calls the free function if one is set
6251 void SocketDescriptor_free(LDKSocketDescriptor this_ptr);
6253 void PeerHandleError_free(LDKPeerHandleError this_ptr);
6256 * Used to indicate that we probably can't make any future connections to this peer, implying
6257 * we should go ahead and force-close any channels we have with it.
6259 bool PeerHandleError_get_no_connection_possible(const LDKPeerHandleError *this_ptr);
6262 * Used to indicate that we probably can't make any future connections to this peer, implying
6263 * we should go ahead and force-close any channels we have with it.
6265 void PeerHandleError_set_no_connection_possible(LDKPeerHandleError *this_ptr, bool val);
6267 MUST_USE_RES LDKPeerHandleError PeerHandleError_new(bool no_connection_possible_arg);
6269 void PeerManager_free(LDKPeerManager this_ptr);
6272 * Constructs a new PeerManager with the given message handlers and node_id secret key
6273 * ephemeral_random_data is used to derive per-connection ephemeral keys and must be
6274 * cryptographically secure random bytes.
6276 MUST_USE_RES LDKPeerManager PeerManager_new(LDKMessageHandler message_handler, LDKSecretKey our_node_secret, const uint8_t (*ephemeral_random_data)[32], LDKLogger logger);
6279 * Get the list of node ids for peers which have completed the initial handshake.
6281 * For outbound connections, this will be the same as the their_node_id parameter passed in to
6282 * new_outbound_connection, however entries will only appear once the initial handshake has
6283 * completed and we are sure the remote peer has the private key for the given node_id.
6285 MUST_USE_RES LDKCVec_PublicKeyZ PeerManager_get_peer_node_ids(const LDKPeerManager *this_arg);
6288 * Indicates a new outbound connection has been established to a node with the given node_id.
6289 * Note that if an Err is returned here you MUST NOT call socket_disconnected for the new
6290 * descriptor but must disconnect the connection immediately.
6292 * Returns a small number of bytes to send to the remote node (currently always 50).
6294 * Panics if descriptor is duplicative with some other descriptor which has not yet had a
6295 * socket_disconnected().
6297 MUST_USE_RES LDKCResult_CVec_u8ZPeerHandleErrorZ PeerManager_new_outbound_connection(const LDKPeerManager *this_arg, LDKPublicKey their_node_id, LDKSocketDescriptor descriptor);
6300 * Indicates a new inbound connection has been established.
6302 * May refuse the connection by returning an Err, but will never write bytes to the remote end
6303 * (outbound connector always speaks first). Note that if an Err is returned here you MUST NOT
6304 * call socket_disconnected for the new descriptor but must disconnect the connection
6307 * Panics if descriptor is duplicative with some other descriptor which has not yet had
6308 * socket_disconnected called.
6310 MUST_USE_RES LDKCResult_NonePeerHandleErrorZ PeerManager_new_inbound_connection(const LDKPeerManager *this_arg, LDKSocketDescriptor descriptor);
6313 * Indicates that there is room to write data to the given socket descriptor.
6315 * May return an Err to indicate that the connection should be closed.
6317 * Will most likely call send_data on the descriptor passed in (or the descriptor handed into
6318 * new_*\\_connection) before returning. Thus, be very careful with reentrancy issues! The
6319 * invariants around calling write_buffer_space_avail in case a write did not fully complete
6320 * must still hold - be ready to call write_buffer_space_avail again if a write call generated
6321 * here isn't sufficient! Panics if the descriptor was not previously registered in a
6322 * new_\\*_connection event.
6324 MUST_USE_RES LDKCResult_NonePeerHandleErrorZ PeerManager_write_buffer_space_avail(const LDKPeerManager *this_arg, LDKSocketDescriptor *descriptor);
6327 * Indicates that data was read from the given socket descriptor.
6329 * May return an Err to indicate that the connection should be closed.
6331 * Will *not* call back into send_data on any descriptors to avoid reentrancy complexity.
6332 * Thus, however, you almost certainly want to call process_events() after any read_event to
6333 * generate send_data calls to handle responses.
6335 * If Ok(true) is returned, further read_events should not be triggered until a send_data call
6336 * on this file descriptor has resume_read set (preventing DoS issues in the send buffer).
6338 * Panics if the descriptor was not previously registered in a new_*_connection event.
6340 MUST_USE_RES LDKCResult_boolPeerHandleErrorZ PeerManager_read_event(const LDKPeerManager *this_arg, LDKSocketDescriptor *peer_descriptor, LDKu8slice data);
6343 * Checks for any events generated by our handlers and processes them. Includes sending most
6344 * response messages as well as messages generated by calls to handler functions directly (eg
6345 * functions like ChannelManager::process_pending_htlc_forward or send_payment).
6347 void PeerManager_process_events(const LDKPeerManager *this_arg);
6350 * Indicates that the given socket descriptor's connection is now closed.
6352 * This must only be called if the socket has been disconnected by the peer or your own
6353 * decision to disconnect it and must NOT be called in any case where other parts of this
6354 * library (eg PeerHandleError, explicit disconnect_socket calls) instruct you to disconnect
6357 * Panics if the descriptor was not previously registered in a successful new_*_connection event.
6359 void PeerManager_socket_disconnected(const LDKPeerManager *this_arg, const LDKSocketDescriptor *descriptor);
6362 * This function should be called roughly once every 30 seconds.
6363 * It will send pings to each peer and disconnect those which did not respond to the last round of pings.
6364 * Will most likely call send_data on all of the registered descriptors, thus, be very careful with reentrancy issues!
6366 void PeerManager_timer_tick_occured(const LDKPeerManager *this_arg);
6369 * Build the commitment secret from the seed and the commitment number
6371 LDKThirtyTwoBytes build_commitment_secret(const uint8_t (*commitment_seed)[32], uint64_t idx);
6374 * Derives a per-commitment-transaction private key (eg an htlc key or delayed_payment key)
6375 * from the base secret and the per_commitment_point.
6377 * Note that this is infallible iff we trust that at least one of the two input keys are randomly
6378 * generated (ie our own).
6380 LDKCResult_SecretKeySecpErrorZ derive_private_key(LDKPublicKey per_commitment_point, const uint8_t (*base_secret)[32]);
6383 * Derives a per-commitment-transaction public key (eg an htlc key or a delayed_payment key)
6384 * from the base point and the per_commitment_key. This is the public equivalent of
6385 * derive_private_key - using only public keys to derive a public key instead of private keys.
6387 * Note that this is infallible iff we trust that at least one of the two input keys are randomly
6388 * generated (ie our own).
6390 LDKCResult_PublicKeySecpErrorZ derive_public_key(LDKPublicKey per_commitment_point, LDKPublicKey base_point);
6393 * Derives a per-commitment-transaction revocation key from its constituent parts.
6395 * Only the cheating participant owns a valid witness to propagate a revoked
6396 * commitment transaction, thus per_commitment_secret always come from cheater
6397 * and revocation_base_secret always come from punisher, which is the broadcaster
6398 * of the transaction spending with this key knowledge.
6400 * Note that this is infallible iff we trust that at least one of the two input keys are randomly
6401 * generated (ie our own).
6403 LDKCResult_SecretKeySecpErrorZ derive_private_revocation_key(const uint8_t (*per_commitment_secret)[32], const uint8_t (*countersignatory_revocation_base_secret)[32]);
6406 * Derives a per-commitment-transaction revocation public key from its constituent parts. This is
6407 * the public equivalend of derive_private_revocation_key - using only public keys to derive a
6408 * public key instead of private keys.
6410 * Only the cheating participant owns a valid witness to propagate a revoked
6411 * commitment transaction, thus per_commitment_point always come from cheater
6412 * and revocation_base_point always come from punisher, which is the broadcaster
6413 * of the transaction spending with this key knowledge.
6415 * Note that this is infallible iff we trust that at least one of the two input keys are randomly
6416 * generated (ie our own).
6418 LDKCResult_PublicKeySecpErrorZ derive_public_revocation_key(LDKPublicKey per_commitment_point, LDKPublicKey countersignatory_revocation_base_point);
6420 void TxCreationKeys_free(LDKTxCreationKeys this_ptr);
6422 LDKTxCreationKeys TxCreationKeys_clone(const LDKTxCreationKeys *orig);
6425 * The broadcaster's per-commitment public key which was used to derive the other keys.
6427 LDKPublicKey TxCreationKeys_get_per_commitment_point(const LDKTxCreationKeys *this_ptr);
6430 * The broadcaster's per-commitment public key which was used to derive the other keys.
6432 void TxCreationKeys_set_per_commitment_point(LDKTxCreationKeys *this_ptr, LDKPublicKey val);
6435 * The revocation key which is used to allow the broadcaster of the commitment
6436 * transaction to provide their counterparty the ability to punish them if they broadcast
6439 LDKPublicKey TxCreationKeys_get_revocation_key(const LDKTxCreationKeys *this_ptr);
6442 * The revocation key which is used to allow the broadcaster of the commitment
6443 * transaction to provide their counterparty the ability to punish them if they broadcast
6446 void TxCreationKeys_set_revocation_key(LDKTxCreationKeys *this_ptr, LDKPublicKey val);
6449 * Broadcaster's HTLC Key
6451 LDKPublicKey TxCreationKeys_get_broadcaster_htlc_key(const LDKTxCreationKeys *this_ptr);
6454 * Broadcaster's HTLC Key
6456 void TxCreationKeys_set_broadcaster_htlc_key(LDKTxCreationKeys *this_ptr, LDKPublicKey val);
6459 * Countersignatory's HTLC Key
6461 LDKPublicKey TxCreationKeys_get_countersignatory_htlc_key(const LDKTxCreationKeys *this_ptr);
6464 * Countersignatory's HTLC Key
6466 void TxCreationKeys_set_countersignatory_htlc_key(LDKTxCreationKeys *this_ptr, LDKPublicKey val);
6469 * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
6471 LDKPublicKey TxCreationKeys_get_broadcaster_delayed_payment_key(const LDKTxCreationKeys *this_ptr);
6474 * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
6476 void TxCreationKeys_set_broadcaster_delayed_payment_key(LDKTxCreationKeys *this_ptr, LDKPublicKey val);
6478 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);
6480 LDKCVec_u8Z TxCreationKeys_write(const LDKTxCreationKeys *obj);
6482 LDKTxCreationKeys TxCreationKeys_read(LDKu8slice ser);
6484 void PreCalculatedTxCreationKeys_free(LDKPreCalculatedTxCreationKeys this_ptr);
6486 LDKPreCalculatedTxCreationKeys PreCalculatedTxCreationKeys_clone(const LDKPreCalculatedTxCreationKeys *orig);
6489 * Create a new PreCalculatedTxCreationKeys from TxCreationKeys
6491 MUST_USE_RES LDKPreCalculatedTxCreationKeys PreCalculatedTxCreationKeys_new(LDKTxCreationKeys keys);
6494 * The pre-calculated transaction creation public keys.
6495 * An external validating signer should not trust these keys.
6497 MUST_USE_RES LDKTxCreationKeys PreCalculatedTxCreationKeys_trust_key_derivation(const LDKPreCalculatedTxCreationKeys *this_arg);
6500 * The transaction per-commitment point
6502 MUST_USE_RES LDKPublicKey PreCalculatedTxCreationKeys_per_commitment_point(const LDKPreCalculatedTxCreationKeys *this_arg);
6504 void ChannelPublicKeys_free(LDKChannelPublicKeys this_ptr);
6506 LDKChannelPublicKeys ChannelPublicKeys_clone(const LDKChannelPublicKeys *orig);
6509 * The public key which is used to sign all commitment transactions, as it appears in the
6510 * on-chain channel lock-in 2-of-2 multisig output.
6512 LDKPublicKey ChannelPublicKeys_get_funding_pubkey(const LDKChannelPublicKeys *this_ptr);
6515 * The public key which is used to sign all commitment transactions, as it appears in the
6516 * on-chain channel lock-in 2-of-2 multisig output.
6518 void ChannelPublicKeys_set_funding_pubkey(LDKChannelPublicKeys *this_ptr, LDKPublicKey val);
6521 * The base point which is used (with derive_public_revocation_key) to derive per-commitment
6522 * revocation keys. This is combined with the per-commitment-secret generated by the
6523 * counterparty to create a secret which the counterparty can reveal to revoke previous
6526 LDKPublicKey ChannelPublicKeys_get_revocation_basepoint(const LDKChannelPublicKeys *this_ptr);
6529 * The base point which is used (with derive_public_revocation_key) to derive per-commitment
6530 * revocation keys. This is combined with the per-commitment-secret generated by the
6531 * counterparty to create a secret which the counterparty can reveal to revoke previous
6534 void ChannelPublicKeys_set_revocation_basepoint(LDKChannelPublicKeys *this_ptr, LDKPublicKey val);
6537 * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
6538 * spendable primary channel balance on the broadcaster's commitment transaction. This key is
6539 * static across every commitment transaction.
6541 LDKPublicKey ChannelPublicKeys_get_payment_point(const LDKChannelPublicKeys *this_ptr);
6544 * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
6545 * spendable primary channel balance on the broadcaster's commitment transaction. This key is
6546 * static across every commitment transaction.
6548 void ChannelPublicKeys_set_payment_point(LDKChannelPublicKeys *this_ptr, LDKPublicKey val);
6551 * The base point which is used (with derive_public_key) to derive a per-commitment payment
6552 * public key which receives non-HTLC-encumbered funds which are only available for spending
6553 * after some delay (or can be claimed via the revocation path).
6555 LDKPublicKey ChannelPublicKeys_get_delayed_payment_basepoint(const LDKChannelPublicKeys *this_ptr);
6558 * The base point which is used (with derive_public_key) to derive a per-commitment payment
6559 * public key which receives non-HTLC-encumbered funds which are only available for spending
6560 * after some delay (or can be claimed via the revocation path).
6562 void ChannelPublicKeys_set_delayed_payment_basepoint(LDKChannelPublicKeys *this_ptr, LDKPublicKey val);
6565 * The base point which is used (with derive_public_key) to derive a per-commitment public key
6566 * which is used to encumber HTLC-in-flight outputs.
6568 LDKPublicKey ChannelPublicKeys_get_htlc_basepoint(const LDKChannelPublicKeys *this_ptr);
6571 * The base point which is used (with derive_public_key) to derive a per-commitment public key
6572 * which is used to encumber HTLC-in-flight outputs.
6574 void ChannelPublicKeys_set_htlc_basepoint(LDKChannelPublicKeys *this_ptr, LDKPublicKey val);
6576 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);
6578 LDKCVec_u8Z ChannelPublicKeys_write(const LDKChannelPublicKeys *obj);
6580 LDKChannelPublicKeys ChannelPublicKeys_read(LDKu8slice ser);
6583 * Create a new TxCreationKeys from channel base points and the per-commitment point
6585 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);
6588 * A script either spendable by the revocation
6589 * key or the broadcaster_delayed_payment_key and satisfying the relative-locktime OP_CSV constrain.
6590 * Encumbering a `to_holder` output on a commitment transaction or 2nd-stage HTLC transactions.
6592 LDKCVec_u8Z get_revokeable_redeemscript(LDKPublicKey revocation_key, uint16_t contest_delay, LDKPublicKey broadcaster_delayed_payment_key);
6594 void HTLCOutputInCommitment_free(LDKHTLCOutputInCommitment this_ptr);
6596 LDKHTLCOutputInCommitment HTLCOutputInCommitment_clone(const LDKHTLCOutputInCommitment *orig);
6599 * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
6600 * Note that this is not the same as whether it is ountbound *from us*. To determine that you
6601 * need to compare this value to whether the commitment transaction in question is that of
6602 * the counterparty or our own.
6604 bool HTLCOutputInCommitment_get_offered(const LDKHTLCOutputInCommitment *this_ptr);
6607 * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
6608 * Note that this is not the same as whether it is ountbound *from us*. To determine that you
6609 * need to compare this value to whether the commitment transaction in question is that of
6610 * the counterparty or our own.
6612 void HTLCOutputInCommitment_set_offered(LDKHTLCOutputInCommitment *this_ptr, bool val);
6615 * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
6616 * this divided by 1000.
6618 uint64_t HTLCOutputInCommitment_get_amount_msat(const LDKHTLCOutputInCommitment *this_ptr);
6621 * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
6622 * this divided by 1000.
6624 void HTLCOutputInCommitment_set_amount_msat(LDKHTLCOutputInCommitment *this_ptr, uint64_t val);
6627 * The CLTV lock-time at which this HTLC expires.
6629 uint32_t HTLCOutputInCommitment_get_cltv_expiry(const LDKHTLCOutputInCommitment *this_ptr);
6632 * The CLTV lock-time at which this HTLC expires.
6634 void HTLCOutputInCommitment_set_cltv_expiry(LDKHTLCOutputInCommitment *this_ptr, uint32_t val);
6637 * The hash of the preimage which unlocks this HTLC.
6639 const uint8_t (*HTLCOutputInCommitment_get_payment_hash(const LDKHTLCOutputInCommitment *this_ptr))[32];
6642 * The hash of the preimage which unlocks this HTLC.
6644 void HTLCOutputInCommitment_set_payment_hash(LDKHTLCOutputInCommitment *this_ptr, LDKThirtyTwoBytes val);
6646 LDKCVec_u8Z HTLCOutputInCommitment_write(const LDKHTLCOutputInCommitment *obj);
6648 LDKHTLCOutputInCommitment HTLCOutputInCommitment_read(LDKu8slice ser);
6651 * Gets the witness redeemscript for an HTLC output in a commitment transaction. Note that htlc
6652 * does not need to have its previous_output_index filled.
6654 LDKCVec_u8Z get_htlc_redeemscript(const LDKHTLCOutputInCommitment *htlc, const LDKTxCreationKeys *keys);
6657 * Gets the redeemscript for a funding output from the two funding public keys.
6658 * Note that the order of funding public keys does not matter.
6660 LDKCVec_u8Z make_funding_redeemscript(LDKPublicKey broadcaster, LDKPublicKey countersignatory);
6663 * panics if htlc.transaction_output_index.is_none()!
6665 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);
6667 void HolderCommitmentTransaction_free(LDKHolderCommitmentTransaction this_ptr);
6669 LDKHolderCommitmentTransaction HolderCommitmentTransaction_clone(const LDKHolderCommitmentTransaction *orig);
6672 * The commitment transaction itself, in unsigned form.
6674 LDKTransaction HolderCommitmentTransaction_get_unsigned_tx(const LDKHolderCommitmentTransaction *this_ptr);
6677 * The commitment transaction itself, in unsigned form.
6679 void HolderCommitmentTransaction_set_unsigned_tx(LDKHolderCommitmentTransaction *this_ptr, LDKTransaction val);
6682 * Our counterparty's signature for the transaction, above.
6684 LDKSignature HolderCommitmentTransaction_get_counterparty_sig(const LDKHolderCommitmentTransaction *this_ptr);
6687 * Our counterparty's signature for the transaction, above.
6689 void HolderCommitmentTransaction_set_counterparty_sig(LDKHolderCommitmentTransaction *this_ptr, LDKSignature val);
6692 * The feerate paid per 1000-weight-unit in this commitment transaction. This value is
6693 * controlled by the channel initiator.
6695 uint32_t HolderCommitmentTransaction_get_feerate_per_kw(const LDKHolderCommitmentTransaction *this_ptr);
6698 * The feerate paid per 1000-weight-unit in this commitment transaction. This value is
6699 * controlled by the channel initiator.
6701 void HolderCommitmentTransaction_set_feerate_per_kw(LDKHolderCommitmentTransaction *this_ptr, uint32_t val);
6704 * The HTLCs and counterparty htlc signatures which were included in this commitment transaction.
6706 * Note that this includes all HTLCs, including ones which were considered dust and not
6707 * actually included in the transaction as it appears on-chain, but who's value is burned as
6708 * fees and not included in the to_holder or to_counterparty outputs.
6710 * The counterparty HTLC signatures in the second element will always be set for non-dust HTLCs, ie
6711 * those for which transaction_output_index.is_some().
6713 void HolderCommitmentTransaction_set_per_htlc(LDKHolderCommitmentTransaction *this_ptr, LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ val);
6716 * Generate a new HolderCommitmentTransaction based on a raw commitment transaction,
6717 * counterparty signature and both parties keys.
6719 * The unsigned transaction outputs must be consistent with htlc_data. This function
6720 * only checks that the shape and amounts are consistent, but does not check the scriptPubkey.
6722 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);
6725 * The pre-calculated transaction creation public keys.
6726 * An external validating signer should not trust these keys.
6728 MUST_USE_RES LDKTxCreationKeys HolderCommitmentTransaction_trust_key_derivation(const LDKHolderCommitmentTransaction *this_arg);
6731 * Get the txid of the holder commitment transaction contained in this
6732 * HolderCommitmentTransaction
6734 MUST_USE_RES LDKThirtyTwoBytes HolderCommitmentTransaction_txid(const LDKHolderCommitmentTransaction *this_arg);
6737 * Gets holder signature for the contained commitment transaction given holder funding private key.
6739 * Funding key is your key included in the 2-2 funding_outpoint lock. Should be provided
6740 * by your ChannelKeys.
6741 * Funding redeemscript is script locking funding_outpoint. This is the mutlsig script
6742 * between your own funding key and your counterparty's. Currently, this is provided in
6743 * ChannelKeys::sign_holder_commitment() calls directly.
6744 * Channel value is amount locked in funding_outpoint.
6746 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);
6749 * Get a signature for each HTLC which was included in the commitment transaction (ie for
6750 * which HTLCOutputInCommitment::transaction_output_index.is_some()).
6752 * The returned Vec has one entry for each HTLC, and in the same order. For HTLCs which were
6753 * considered dust and not included, a None entry exists, for all others a signature is
6756 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);
6758 LDKCVec_u8Z HolderCommitmentTransaction_write(const LDKHolderCommitmentTransaction *obj);
6760 LDKHolderCommitmentTransaction HolderCommitmentTransaction_read(LDKu8slice ser);
6762 void InitFeatures_free(LDKInitFeatures this_ptr);
6764 void NodeFeatures_free(LDKNodeFeatures this_ptr);
6766 void ChannelFeatures_free(LDKChannelFeatures this_ptr);
6768 void RouteHop_free(LDKRouteHop this_ptr);
6770 LDKRouteHop RouteHop_clone(const LDKRouteHop *orig);
6773 * The node_id of the node at this hop.
6775 LDKPublicKey RouteHop_get_pubkey(const LDKRouteHop *this_ptr);
6778 * The node_id of the node at this hop.
6780 void RouteHop_set_pubkey(LDKRouteHop *this_ptr, LDKPublicKey val);
6783 * The node_announcement features of the node at this hop. For the last hop, these may be
6784 * amended to match the features present in the invoice this node generated.
6786 LDKNodeFeatures RouteHop_get_node_features(const LDKRouteHop *this_ptr);
6789 * The node_announcement features of the node at this hop. For the last hop, these may be
6790 * amended to match the features present in the invoice this node generated.
6792 void RouteHop_set_node_features(LDKRouteHop *this_ptr, LDKNodeFeatures val);
6795 * The channel that should be used from the previous hop to reach this node.
6797 uint64_t RouteHop_get_short_channel_id(const LDKRouteHop *this_ptr);
6800 * The channel that should be used from the previous hop to reach this node.
6802 void RouteHop_set_short_channel_id(LDKRouteHop *this_ptr, uint64_t val);
6805 * The channel_announcement features of the channel that should be used from the previous hop
6806 * to reach this node.
6808 LDKChannelFeatures RouteHop_get_channel_features(const LDKRouteHop *this_ptr);
6811 * The channel_announcement features of the channel that should be used from the previous hop
6812 * to reach this node.
6814 void RouteHop_set_channel_features(LDKRouteHop *this_ptr, LDKChannelFeatures val);
6817 * The fee taken on this hop. For the last hop, this should be the full value of the payment.
6819 uint64_t RouteHop_get_fee_msat(const LDKRouteHop *this_ptr);
6822 * The fee taken on this hop. For the last hop, this should be the full value of the payment.
6824 void RouteHop_set_fee_msat(LDKRouteHop *this_ptr, uint64_t val);
6827 * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
6828 * expected at the destination, in excess of the current block height.
6830 uint32_t RouteHop_get_cltv_expiry_delta(const LDKRouteHop *this_ptr);
6833 * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
6834 * expected at the destination, in excess of the current block height.
6836 void RouteHop_set_cltv_expiry_delta(LDKRouteHop *this_ptr, uint32_t val);
6838 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);
6840 void Route_free(LDKRoute this_ptr);
6842 LDKRoute Route_clone(const LDKRoute *orig);
6845 * The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the
6846 * last RouteHop in each path must be the same.
6847 * Each entry represents a list of hops, NOT INCLUDING our own, where the last hop is the
6848 * destination. Thus, this must always be at least length one. While the maximum length of any
6849 * given path is variable, keeping the length of any path to less than 20 should currently
6850 * ensure it is viable.
6852 void Route_set_paths(LDKRoute *this_ptr, LDKCVec_CVec_RouteHopZZ val);
6854 MUST_USE_RES LDKRoute Route_new(LDKCVec_CVec_RouteHopZZ paths_arg);
6856 LDKCVec_u8Z Route_write(const LDKRoute *obj);
6858 LDKRoute Route_read(LDKu8slice ser);
6860 void RouteHint_free(LDKRouteHint this_ptr);
6862 LDKRouteHint RouteHint_clone(const LDKRouteHint *orig);
6865 * The node_id of the non-target end of the route
6867 LDKPublicKey RouteHint_get_src_node_id(const LDKRouteHint *this_ptr);
6870 * The node_id of the non-target end of the route
6872 void RouteHint_set_src_node_id(LDKRouteHint *this_ptr, LDKPublicKey val);
6875 * The short_channel_id of this channel
6877 uint64_t RouteHint_get_short_channel_id(const LDKRouteHint *this_ptr);
6880 * The short_channel_id of this channel
6882 void RouteHint_set_short_channel_id(LDKRouteHint *this_ptr, uint64_t val);
6885 * The fees which must be paid to use this channel
6887 LDKRoutingFees RouteHint_get_fees(const LDKRouteHint *this_ptr);
6890 * The fees which must be paid to use this channel
6892 void RouteHint_set_fees(LDKRouteHint *this_ptr, LDKRoutingFees val);
6895 * The difference in CLTV values between this node and the next node.
6897 uint16_t RouteHint_get_cltv_expiry_delta(const LDKRouteHint *this_ptr);
6900 * The difference in CLTV values between this node and the next node.
6902 void RouteHint_set_cltv_expiry_delta(LDKRouteHint *this_ptr, uint16_t val);
6905 * The minimum value, in msat, which must be relayed to the next hop.
6907 uint64_t RouteHint_get_htlc_minimum_msat(const LDKRouteHint *this_ptr);
6910 * The minimum value, in msat, which must be relayed to the next hop.
6912 void RouteHint_set_htlc_minimum_msat(LDKRouteHint *this_ptr, uint64_t val);
6914 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);
6917 * Gets a route from us to the given target node.
6919 * Extra routing hops between known nodes and the target will be used if they are included in
6922 * If some channels aren't announced, it may be useful to fill in a first_hops with the
6923 * results from a local ChannelManager::list_usable_channels() call. If it is filled in, our
6924 * view of our local channels (from net_graph_msg_handler) will be ignored, and only those in first_hops
6927 * Panics if first_hops contains channels without short_channel_ids
6928 * (ChannelManager::list_usable_channels will never include such channels).
6930 * The fees on channels from us to next-hops are ignored (as they are assumed to all be
6931 * equal), however the enabled/disabled bit on such channels as well as the htlc_minimum_msat
6932 * *is* checked as they may change based on the receiving node.
6934 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);
6936 void NetworkGraph_free(LDKNetworkGraph this_ptr);
6938 void LockedNetworkGraph_free(LDKLockedNetworkGraph this_ptr);
6940 void NetGraphMsgHandler_free(LDKNetGraphMsgHandler this_ptr);
6943 * Creates a new tracker of the actual state of the network of channels and nodes,
6944 * assuming a fresh network graph.
6945 * Chain monitor is used to make sure announced channels exist on-chain,
6946 * channel data is correct, and that the announcement is signed with
6947 * channel owners' keys.
6949 MUST_USE_RES LDKNetGraphMsgHandler NetGraphMsgHandler_new(LDKAccess *chain_access, LDKLogger logger);
6952 * Creates a new tracker of the actual state of the network of channels and nodes,
6953 * assuming an existing Network Graph.
6955 MUST_USE_RES LDKNetGraphMsgHandler NetGraphMsgHandler_from_net_graph(LDKAccess *chain_access, LDKLogger logger, LDKNetworkGraph network_graph);
6958 * Take a read lock on the network_graph and return it in the C-bindings
6959 * newtype helper. This is likely only useful when called via the C
6960 * bindings as you can call `self.network_graph.read().unwrap()` in Rust
6963 MUST_USE_RES LDKLockedNetworkGraph NetGraphMsgHandler_read_locked_graph(const LDKNetGraphMsgHandler *this_arg);
6966 * Get a reference to the NetworkGraph which this read-lock contains.
6968 MUST_USE_RES LDKNetworkGraph LockedNetworkGraph_graph(const LDKLockedNetworkGraph *this_arg);
6970 LDKRoutingMessageHandler NetGraphMsgHandler_as_RoutingMessageHandler(const LDKNetGraphMsgHandler *this_arg);
6972 void DirectionalChannelInfo_free(LDKDirectionalChannelInfo this_ptr);
6975 * When the last update to the channel direction was issued.
6976 * Value is opaque, as set in the announcement.
6978 uint32_t DirectionalChannelInfo_get_last_update(const LDKDirectionalChannelInfo *this_ptr);
6981 * When the last update to the channel direction was issued.
6982 * Value is opaque, as set in the announcement.
6984 void DirectionalChannelInfo_set_last_update(LDKDirectionalChannelInfo *this_ptr, uint32_t val);
6987 * Whether the channel can be currently used for payments (in this one direction).
6989 bool DirectionalChannelInfo_get_enabled(const LDKDirectionalChannelInfo *this_ptr);
6992 * Whether the channel can be currently used for payments (in this one direction).
6994 void DirectionalChannelInfo_set_enabled(LDKDirectionalChannelInfo *this_ptr, bool val);
6997 * The difference in CLTV values that you must have when routing through this channel.
6999 uint16_t DirectionalChannelInfo_get_cltv_expiry_delta(const LDKDirectionalChannelInfo *this_ptr);
7002 * The difference in CLTV values that you must have when routing through this channel.
7004 void DirectionalChannelInfo_set_cltv_expiry_delta(LDKDirectionalChannelInfo *this_ptr, uint16_t val);
7007 * The minimum value, which must be relayed to the next hop via the channel
7009 uint64_t DirectionalChannelInfo_get_htlc_minimum_msat(const LDKDirectionalChannelInfo *this_ptr);
7012 * The minimum value, which must be relayed to the next hop via the channel
7014 void DirectionalChannelInfo_set_htlc_minimum_msat(LDKDirectionalChannelInfo *this_ptr, uint64_t val);
7017 * Most recent update for the channel received from the network
7018 * Mostly redundant with the data we store in fields explicitly.
7019 * Everything else is useful only for sending out for initial routing sync.
7020 * Not stored if contains excess data to prevent DoS.
7022 LDKChannelUpdate DirectionalChannelInfo_get_last_update_message(const LDKDirectionalChannelInfo *this_ptr);
7025 * Most recent update for the channel received from the network
7026 * Mostly redundant with the data we store in fields explicitly.
7027 * Everything else is useful only for sending out for initial routing sync.
7028 * Not stored if contains excess data to prevent DoS.
7030 void DirectionalChannelInfo_set_last_update_message(LDKDirectionalChannelInfo *this_ptr, LDKChannelUpdate val);
7032 LDKCVec_u8Z DirectionalChannelInfo_write(const LDKDirectionalChannelInfo *obj);
7034 LDKDirectionalChannelInfo DirectionalChannelInfo_read(LDKu8slice ser);
7036 void ChannelInfo_free(LDKChannelInfo this_ptr);
7039 * Protocol features of a channel communicated during its announcement
7041 LDKChannelFeatures ChannelInfo_get_features(const LDKChannelInfo *this_ptr);
7044 * Protocol features of a channel communicated during its announcement
7046 void ChannelInfo_set_features(LDKChannelInfo *this_ptr, LDKChannelFeatures val);
7049 * Source node of the first direction of a channel
7051 LDKPublicKey ChannelInfo_get_node_one(const LDKChannelInfo *this_ptr);
7054 * Source node of the first direction of a channel
7056 void ChannelInfo_set_node_one(LDKChannelInfo *this_ptr, LDKPublicKey val);
7059 * Details about the first direction of a channel
7061 LDKDirectionalChannelInfo ChannelInfo_get_one_to_two(const LDKChannelInfo *this_ptr);
7064 * Details about the first direction of a channel
7066 void ChannelInfo_set_one_to_two(LDKChannelInfo *this_ptr, LDKDirectionalChannelInfo val);
7069 * Source node of the second direction of a channel
7071 LDKPublicKey ChannelInfo_get_node_two(const LDKChannelInfo *this_ptr);
7074 * Source node of the second direction of a channel
7076 void ChannelInfo_set_node_two(LDKChannelInfo *this_ptr, LDKPublicKey val);
7079 * Details about the second direction of a channel
7081 LDKDirectionalChannelInfo ChannelInfo_get_two_to_one(const LDKChannelInfo *this_ptr);
7084 * Details about the second direction of a channel
7086 void ChannelInfo_set_two_to_one(LDKChannelInfo *this_ptr, LDKDirectionalChannelInfo val);
7089 * An initial announcement of the channel
7090 * Mostly redundant with the data we store in fields explicitly.
7091 * Everything else is useful only for sending out for initial routing sync.
7092 * Not stored if contains excess data to prevent DoS.
7094 LDKChannelAnnouncement ChannelInfo_get_announcement_message(const LDKChannelInfo *this_ptr);
7097 * An initial announcement of the channel
7098 * Mostly redundant with the data we store in fields explicitly.
7099 * Everything else is useful only for sending out for initial routing sync.
7100 * Not stored if contains excess data to prevent DoS.
7102 void ChannelInfo_set_announcement_message(LDKChannelInfo *this_ptr, LDKChannelAnnouncement val);
7104 LDKCVec_u8Z ChannelInfo_write(const LDKChannelInfo *obj);
7106 LDKChannelInfo ChannelInfo_read(LDKu8slice ser);
7108 void RoutingFees_free(LDKRoutingFees this_ptr);
7110 LDKRoutingFees RoutingFees_clone(const LDKRoutingFees *orig);
7113 * Flat routing fee in satoshis
7115 uint32_t RoutingFees_get_base_msat(const LDKRoutingFees *this_ptr);
7118 * Flat routing fee in satoshis
7120 void RoutingFees_set_base_msat(LDKRoutingFees *this_ptr, uint32_t val);
7123 * Liquidity-based routing fee in millionths of a routed amount.
7124 * In other words, 10000 is 1%.
7126 uint32_t RoutingFees_get_proportional_millionths(const LDKRoutingFees *this_ptr);
7129 * Liquidity-based routing fee in millionths of a routed amount.
7130 * In other words, 10000 is 1%.
7132 void RoutingFees_set_proportional_millionths(LDKRoutingFees *this_ptr, uint32_t val);
7134 MUST_USE_RES LDKRoutingFees RoutingFees_new(uint32_t base_msat_arg, uint32_t proportional_millionths_arg);
7136 LDKRoutingFees RoutingFees_read(LDKu8slice ser);
7138 LDKCVec_u8Z RoutingFees_write(const LDKRoutingFees *obj);
7140 void NodeAnnouncementInfo_free(LDKNodeAnnouncementInfo this_ptr);
7143 * Protocol features the node announced support for
7145 LDKNodeFeatures NodeAnnouncementInfo_get_features(const LDKNodeAnnouncementInfo *this_ptr);
7148 * Protocol features the node announced support for
7150 void NodeAnnouncementInfo_set_features(LDKNodeAnnouncementInfo *this_ptr, LDKNodeFeatures val);
7153 * When the last known update to the node state was issued.
7154 * Value is opaque, as set in the announcement.
7156 uint32_t NodeAnnouncementInfo_get_last_update(const LDKNodeAnnouncementInfo *this_ptr);
7159 * When the last known update to the node state was issued.
7160 * Value is opaque, as set in the announcement.
7162 void NodeAnnouncementInfo_set_last_update(LDKNodeAnnouncementInfo *this_ptr, uint32_t val);
7165 * Color assigned to the node
7167 const uint8_t (*NodeAnnouncementInfo_get_rgb(const LDKNodeAnnouncementInfo *this_ptr))[3];
7170 * Color assigned to the node
7172 void NodeAnnouncementInfo_set_rgb(LDKNodeAnnouncementInfo *this_ptr, LDKThreeBytes val);
7175 * Moniker assigned to the node.
7176 * May be invalid or malicious (eg control chars),
7177 * should not be exposed to the user.
7179 const uint8_t (*NodeAnnouncementInfo_get_alias(const LDKNodeAnnouncementInfo *this_ptr))[32];
7182 * Moniker assigned to the node.
7183 * May be invalid or malicious (eg control chars),
7184 * should not be exposed to the user.
7186 void NodeAnnouncementInfo_set_alias(LDKNodeAnnouncementInfo *this_ptr, LDKThirtyTwoBytes val);
7189 * Internet-level addresses via which one can connect to the node
7191 void NodeAnnouncementInfo_set_addresses(LDKNodeAnnouncementInfo *this_ptr, LDKCVec_NetAddressZ val);
7194 * An initial announcement of the node
7195 * Mostly redundant with the data we store in fields explicitly.
7196 * Everything else is useful only for sending out for initial routing sync.
7197 * Not stored if contains excess data to prevent DoS.
7199 LDKNodeAnnouncement NodeAnnouncementInfo_get_announcement_message(const LDKNodeAnnouncementInfo *this_ptr);
7202 * An initial announcement of the node
7203 * Mostly redundant with the data we store in fields explicitly.
7204 * Everything else is useful only for sending out for initial routing sync.
7205 * Not stored if contains excess data to prevent DoS.
7207 void NodeAnnouncementInfo_set_announcement_message(LDKNodeAnnouncementInfo *this_ptr, LDKNodeAnnouncement val);
7209 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);
7211 LDKCVec_u8Z NodeAnnouncementInfo_write(const LDKNodeAnnouncementInfo *obj);
7213 LDKNodeAnnouncementInfo NodeAnnouncementInfo_read(LDKu8slice ser);
7215 void NodeInfo_free(LDKNodeInfo this_ptr);
7218 * All valid channels a node has announced
7220 void NodeInfo_set_channels(LDKNodeInfo *this_ptr, LDKCVec_u64Z val);
7223 * Lowest fees enabling routing via any of the enabled, known channels to a node.
7224 * The two fields (flat and proportional fee) are independent,
7225 * meaning they don't have to refer to the same channel.
7227 LDKRoutingFees NodeInfo_get_lowest_inbound_channel_fees(const LDKNodeInfo *this_ptr);
7230 * Lowest fees enabling routing via any of the enabled, known channels to a node.
7231 * The two fields (flat and proportional fee) are independent,
7232 * meaning they don't have to refer to the same channel.
7234 void NodeInfo_set_lowest_inbound_channel_fees(LDKNodeInfo *this_ptr, LDKRoutingFees val);
7237 * More information about a node from node_announcement.
7238 * Optional because we store a Node entry after learning about it from
7239 * a channel announcement, but before receiving a node announcement.
7241 LDKNodeAnnouncementInfo NodeInfo_get_announcement_info(const LDKNodeInfo *this_ptr);
7244 * More information about a node from node_announcement.
7245 * Optional because we store a Node entry after learning about it from
7246 * a channel announcement, but before receiving a node announcement.
7248 void NodeInfo_set_announcement_info(LDKNodeInfo *this_ptr, LDKNodeAnnouncementInfo val);
7250 MUST_USE_RES LDKNodeInfo NodeInfo_new(LDKCVec_u64Z channels_arg, LDKRoutingFees lowest_inbound_channel_fees_arg, LDKNodeAnnouncementInfo announcement_info_arg);
7252 LDKCVec_u8Z NodeInfo_write(const LDKNodeInfo *obj);
7254 LDKNodeInfo NodeInfo_read(LDKu8slice ser);
7256 LDKCVec_u8Z NetworkGraph_write(const LDKNetworkGraph *obj);
7258 LDKNetworkGraph NetworkGraph_read(LDKu8slice ser);
7261 * Creates a new, empty, network graph.
7263 MUST_USE_RES LDKNetworkGraph NetworkGraph_new(void);
7266 * Close a channel if a corresponding HTLC fail was sent.
7267 * If permanent, removes a channel from the local storage.
7268 * May cause the removal of nodes too, if this was their last channel.
7269 * If not permanent, makes channels unavailable for routing.
7271 void NetworkGraph_close_channel_from_update(LDKNetworkGraph *this_arg, uint64_t short_channel_id, bool is_permanent);
7273 /* Text to put at the end of the generated file */