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 {
206 typedef struct LDKCVecTempl_u8 {
211 typedef LDKCVecTempl_u8 LDKCVec_u8Z;
214 * A transaction output including a scriptPubKey and value.
215 * This type *does* own its own memory, so must be free'd appropriately.
217 typedef struct LDKTxOut {
218 LDKCVec_u8Z script_pubkey;
222 typedef struct LDKC2TupleTempl_usize__Transaction {
225 } LDKC2TupleTempl_usize__Transaction;
227 typedef LDKC2TupleTempl_usize__Transaction LDKC2Tuple_usizeTransactionZ;
229 typedef union LDKCResultPtr_u8__ChannelMonitorUpdateErr {
231 LDKChannelMonitorUpdateErr *err;
232 } LDKCResultPtr_u8__ChannelMonitorUpdateErr;
234 typedef struct LDKCResultTempl_u8__ChannelMonitorUpdateErr {
235 LDKCResultPtr_u8__ChannelMonitorUpdateErr contents;
237 } LDKCResultTempl_u8__ChannelMonitorUpdateErr;
239 typedef LDKCResultTempl_u8__ChannelMonitorUpdateErr LDKCResult_NoneChannelMonitorUpdateErrZ;
244 * General Err type for ChannelMonitor actions. Generally, this implies that the data provided is
245 * inconsistent with the ChannelMonitor being called. eg for ChannelMonitor::update_monitor this
246 * means you tried to update a monitor for a different channel or the ChannelMonitorUpdate was
248 * Contains a human-readable error message.
250 typedef struct MUST_USE_STRUCT LDKMonitorUpdateError {
252 * Nearly everyhwere, inner must be non-null, however in places where
253 * the Rust equivalent takes an Option, it may be set to null to indicate None.
255 LDKnativeMonitorUpdateError *inner;
257 } LDKMonitorUpdateError;
259 typedef union LDKCResultPtr_u8__MonitorUpdateError {
261 LDKMonitorUpdateError *err;
262 } LDKCResultPtr_u8__MonitorUpdateError;
264 typedef struct LDKCResultTempl_u8__MonitorUpdateError {
265 LDKCResultPtr_u8__MonitorUpdateError contents;
267 } LDKCResultTempl_u8__MonitorUpdateError;
269 typedef LDKCResultTempl_u8__MonitorUpdateError LDKCResult_NoneMonitorUpdateErrorZ;
274 * A reference to a transaction output.
276 * Differs from bitcoin::blockdata::transaction::OutPoint as the index is a u16 instead of u32
277 * due to LN's restrictions on index values. Should reduce (possibly) unsafe conversions this way.
279 typedef struct MUST_USE_STRUCT LDKOutPoint {
281 * Nearly everyhwere, inner must be non-null, however in places where
282 * the Rust equivalent takes an Option, it may be set to null to indicate None.
284 LDKnativeOutPoint *inner;
288 typedef struct LDKC2TupleTempl_OutPoint__CVec_u8Z {
291 } LDKC2TupleTempl_OutPoint__CVec_u8Z;
293 typedef LDKC2TupleTempl_OutPoint__CVec_u8Z LDKC2Tuple_OutPointScriptZ;
296 * Arbitrary 32 bytes, which could represent one of a few different things. You probably want to
297 * look up the corresponding function in rust-lightning's docs.
299 typedef struct LDKThirtyTwoBytes {
303 typedef struct LDKCVecTempl_TxOut {
306 } LDKCVecTempl_TxOut;
308 typedef struct LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut {
309 LDKThirtyTwoBytes *a;
310 LDKCVecTempl_TxOut *b;
311 } LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut;
313 typedef LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut LDKC2Tuple_TxidCVec_TxOutZZ;
315 typedef LDKCVecTempl_TxOut LDKCVec_TxOutZ;
317 typedef struct LDKC2TupleTempl_u64__u64 {
320 } LDKC2TupleTempl_u64__u64;
322 typedef LDKC2TupleTempl_u64__u64 LDKC2Tuple_u64u64Z;
324 typedef struct LDKSignature {
325 uint8_t compact_form[64];
328 typedef struct LDKCVecTempl_Signature {
331 } LDKCVecTempl_Signature;
333 typedef struct LDKC2TupleTempl_Signature__CVecTempl_Signature {
335 LDKCVecTempl_Signature *b;
336 } LDKC2TupleTempl_Signature__CVecTempl_Signature;
338 typedef LDKC2TupleTempl_Signature__CVecTempl_Signature LDKC2Tuple_SignatureCVec_SignatureZZ;
340 typedef LDKCVecTempl_Signature LDKCVec_SignatureZ;
342 typedef union LDKCResultPtr_C2TupleTempl_Signature__CVecTempl_Signature________u8 {
343 LDKC2TupleTempl_Signature__CVecTempl_Signature *result;
345 } LDKCResultPtr_C2TupleTempl_Signature__CVecTempl_Signature________u8;
347 typedef struct LDKCResultTempl_C2TupleTempl_Signature__CVecTempl_Signature________u8 {
348 LDKCResultPtr_C2TupleTempl_Signature__CVecTempl_Signature________u8 contents;
350 } LDKCResultTempl_C2TupleTempl_Signature__CVecTempl_Signature________u8;
352 typedef LDKCResultTempl_C2TupleTempl_Signature__CVecTempl_Signature________u8 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ;
354 typedef union LDKCResultPtr_Signature__u8 {
355 LDKSignature *result;
357 } LDKCResultPtr_Signature__u8;
359 typedef struct LDKCResultTempl_Signature__u8 {
360 LDKCResultPtr_Signature__u8 contents;
362 } LDKCResultTempl_Signature__u8;
364 typedef LDKCResultTempl_Signature__u8 LDKCResult_SignatureNoneZ;
366 typedef union LDKCResultPtr_CVecTempl_Signature_____u8 {
367 LDKCVecTempl_Signature *result;
369 } LDKCResultPtr_CVecTempl_Signature_____u8;
371 typedef struct LDKCResultTempl_CVecTempl_Signature_____u8 {
372 LDKCResultPtr_CVecTempl_Signature_____u8 contents;
374 } LDKCResultTempl_CVecTempl_Signature_____u8;
376 typedef LDKCResultTempl_CVecTempl_Signature_____u8 LDKCResult_CVec_SignatureZNoneZ;
379 * A Rust str object, ie a reference to a UTF8-valid string.
380 * This is *not* null-terminated so cannot be used directly as a C string!
382 typedef struct LDKStr {
383 const uint8_t *chars;
388 * Indicates an error on the client's part (usually some variant of attempting to use too-low or
391 typedef enum LDKAPIError_Tag {
393 * Indicates the API was wholly misused (see err for more). Cases where these can be returned
394 * are documented, but generally indicates some precondition of a function was violated.
396 LDKAPIError_APIMisuseError,
398 * Due to a high feerate, we were unable to complete the request.
399 * For example, this may be returned if the feerate implies we cannot open a channel at the
400 * requested value, but opening a larger channel would succeed.
402 LDKAPIError_FeeRateTooHigh,
404 * A malformed Route was provided (eg overflowed value, node id mismatch, overly-looped route,
405 * too-many-hops, etc).
407 LDKAPIError_RouteError,
409 * We were unable to complete the request as the Channel required to do so is unable to
410 * complete the request (or was not found). This can take many forms, including disconnected
411 * peer, channel at capacity, channel shutting down, etc.
413 LDKAPIError_ChannelUnavailable,
415 * An attempt to call watch/update_channel returned an Err (ie you did this!), causing the
416 * attempted action to fail.
418 LDKAPIError_MonitorUpdateFailed,
420 * Must be last for serialization purposes
422 LDKAPIError_Sentinel,
425 typedef struct LDKAPIError_LDKAPIMisuseError_Body {
427 } LDKAPIError_LDKAPIMisuseError_Body;
429 typedef struct LDKAPIError_LDKFeeRateTooHigh_Body {
432 } LDKAPIError_LDKFeeRateTooHigh_Body;
434 typedef struct LDKAPIError_LDKRouteError_Body {
436 } LDKAPIError_LDKRouteError_Body;
438 typedef struct LDKAPIError_LDKChannelUnavailable_Body {
440 } LDKAPIError_LDKChannelUnavailable_Body;
442 typedef struct LDKAPIError {
445 LDKAPIError_LDKAPIMisuseError_Body api_misuse_error;
446 LDKAPIError_LDKFeeRateTooHigh_Body fee_rate_too_high;
447 LDKAPIError_LDKRouteError_Body route_error;
448 LDKAPIError_LDKChannelUnavailable_Body channel_unavailable;
452 typedef union LDKCResultPtr_u8__APIError {
455 } LDKCResultPtr_u8__APIError;
457 typedef struct LDKCResultTempl_u8__APIError {
458 LDKCResultPtr_u8__APIError contents;
460 } LDKCResultTempl_u8__APIError;
462 typedef LDKCResultTempl_u8__APIError LDKCResult_NoneAPIErrorZ;
467 * If a payment fails to send, it can be in one of several states. This enum is returned as the
468 * Err() type describing which state the payment is in, see the description of individual enum
471 typedef struct MUST_USE_STRUCT LDKPaymentSendFailure {
473 * Nearly everyhwere, inner must be non-null, however in places where
474 * the Rust equivalent takes an Option, it may be set to null to indicate None.
476 LDKnativePaymentSendFailure *inner;
478 } LDKPaymentSendFailure;
480 typedef union LDKCResultPtr_u8__PaymentSendFailure {
482 LDKPaymentSendFailure *err;
483 } LDKCResultPtr_u8__PaymentSendFailure;
485 typedef struct LDKCResultTempl_u8__PaymentSendFailure {
486 LDKCResultPtr_u8__PaymentSendFailure contents;
488 } LDKCResultTempl_u8__PaymentSendFailure;
490 typedef LDKCResultTempl_u8__PaymentSendFailure LDKCResult_NonePaymentSendFailureZ;
495 * A channel_announcement message to be sent or received from a peer
497 typedef struct MUST_USE_STRUCT LDKChannelAnnouncement {
499 * Nearly everyhwere, inner must be non-null, however in places where
500 * the Rust equivalent takes an Option, it may be set to null to indicate None.
502 LDKnativeChannelAnnouncement *inner;
504 } LDKChannelAnnouncement;
509 * A channel_update message to be sent or received from a peer
511 typedef struct MUST_USE_STRUCT LDKChannelUpdate {
513 * Nearly everyhwere, inner must be non-null, however in places where
514 * the Rust equivalent takes an Option, it may be set to null to indicate None.
516 LDKnativeChannelUpdate *inner;
520 typedef struct LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate {
521 LDKChannelAnnouncement *a;
524 } LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate;
526 typedef LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ;
531 * Error for PeerManager errors. If you get one of these, you must disconnect the socket and
532 * generate no further read_event/write_buffer_space_avail calls for the descriptor, only
533 * triggering a single socket_disconnected call (unless it was provided in response to a
534 * new_*_connection event, in which case no such socket_disconnected() must be called and the
535 * socket silently disconencted).
537 typedef struct MUST_USE_STRUCT LDKPeerHandleError {
539 * Nearly everyhwere, inner must be non-null, however in places where
540 * the Rust equivalent takes an Option, it may be set to null to indicate None.
542 LDKnativePeerHandleError *inner;
544 } LDKPeerHandleError;
546 typedef union LDKCResultPtr_u8__PeerHandleError {
548 LDKPeerHandleError *err;
549 } LDKCResultPtr_u8__PeerHandleError;
551 typedef struct LDKCResultTempl_u8__PeerHandleError {
552 LDKCResultPtr_u8__PeerHandleError contents;
554 } LDKCResultTempl_u8__PeerHandleError;
556 typedef LDKCResultTempl_u8__PeerHandleError LDKCResult_NonePeerHandleErrorZ;
561 * Information about an HTLC as it appears in a commitment transaction
563 typedef struct MUST_USE_STRUCT LDKHTLCOutputInCommitment {
565 * Nearly everyhwere, inner must be non-null, however in places where
566 * the Rust equivalent takes an Option, it may be set to null to indicate None.
568 LDKnativeHTLCOutputInCommitment *inner;
570 } LDKHTLCOutputInCommitment;
572 typedef struct LDKC2TupleTempl_HTLCOutputInCommitment__Signature {
573 LDKHTLCOutputInCommitment *a;
575 } LDKC2TupleTempl_HTLCOutputInCommitment__Signature;
577 typedef LDKC2TupleTempl_HTLCOutputInCommitment__Signature LDKC2Tuple_HTLCOutputInCommitmentSignatureZ;
579 typedef struct LDKPublicKey {
580 uint8_t compressed_form[33];
584 * When on-chain outputs are created by rust-lightning (which our counterparty is not able to
585 * claim at any point in the future) an event is generated which you must track and be able to
586 * spend on-chain. The information needed to do this is provided in this enum, including the
587 * outpoint describing which txid and output index is available, the full output which exists at
588 * that txid/index, and any keys or other information required to sign.
590 typedef enum LDKSpendableOutputDescriptor_Tag {
592 * An output to a script which was provided via KeysInterface, thus you should already know
593 * how to spend it. No keys are provided as rust-lightning was never given any keys - only the
594 * script_pubkey as it appears in the output.
595 * These may include outputs from a transaction punishing our counterparty or claiming an HTLC
596 * on-chain using the payment preimage or after it has timed out.
598 LDKSpendableOutputDescriptor_StaticOutput,
600 * An output to a P2WSH script which can be spent with a single signature after a CSV delay.
602 * The witness in the spending input should be:
603 * <BIP 143 signature> <empty vector> (MINIMALIF standard rule) <provided witnessScript>
605 * Note that the nSequence field in the spending input must be set to to_self_delay
606 * (which means the transaction is not broadcastable until at least to_self_delay
607 * blocks after the outpoint confirms).
609 * These are generally the result of a \"revocable\" output to us, spendable only by us unless
610 * it is an output from an old state which we broadcast (which should never happen).
612 * To derive the delayed_payment key which is used to sign for this input, you must pass the
613 * holder delayed_payment_base_key (ie the private key which corresponds to the pubkey in
614 * ChannelKeys::pubkeys().delayed_payment_basepoint) and the provided per_commitment_point to
615 * chan_utils::derive_private_key. The public key can be generated without the secret key
616 * using chan_utils::derive_public_key and only the delayed_payment_basepoint which appears in
617 * ChannelKeys::pubkeys().
619 * To derive the revocation_pubkey provided here (which is used in the witness
620 * script generation), you must pass the counterparty revocation_basepoint (which appears in the
621 * call to ChannelKeys::on_accept) and the provided per_commitment point
622 * to chan_utils::derive_public_revocation_key.
624 * The witness script which is hashed and included in the output script_pubkey may be
625 * regenerated by passing the revocation_pubkey (derived as above), our delayed_payment pubkey
626 * (derived as above), and the to_self_delay contained here to
627 * chan_utils::get_revokeable_redeemscript.
629 LDKSpendableOutputDescriptor_DynamicOutputP2WSH,
631 * An output to a P2WPKH, spendable exclusively by our payment key (ie the private key which
632 * corresponds to the public key in ChannelKeys::pubkeys().payment_point).
633 * The witness in the spending input, is, thus, simply:
634 * <BIP 143 signature> <payment key>
636 * These are generally the result of our counterparty having broadcast the current state,
637 * allowing us to claim the non-HTLC-encumbered outputs immediately.
639 LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment,
641 * Must be last for serialization purposes
643 LDKSpendableOutputDescriptor_Sentinel,
644 } LDKSpendableOutputDescriptor_Tag;
646 typedef struct LDKSpendableOutputDescriptor_LDKStaticOutput_Body {
647 LDKOutPoint outpoint;
649 } LDKSpendableOutputDescriptor_LDKStaticOutput_Body;
651 typedef struct LDKSpendableOutputDescriptor_LDKDynamicOutputP2WSH_Body {
652 LDKOutPoint outpoint;
653 LDKPublicKey per_commitment_point;
654 uint16_t to_self_delay;
656 LDKC2Tuple_u64u64Z key_derivation_params;
657 LDKPublicKey revocation_pubkey;
658 } LDKSpendableOutputDescriptor_LDKDynamicOutputP2WSH_Body;
660 typedef struct LDKSpendableOutputDescriptor_LDKStaticOutputCounterpartyPayment_Body {
661 LDKOutPoint outpoint;
663 LDKC2Tuple_u64u64Z key_derivation_params;
664 } LDKSpendableOutputDescriptor_LDKStaticOutputCounterpartyPayment_Body;
666 typedef struct LDKSpendableOutputDescriptor {
667 LDKSpendableOutputDescriptor_Tag tag;
669 LDKSpendableOutputDescriptor_LDKStaticOutput_Body static_output;
670 LDKSpendableOutputDescriptor_LDKDynamicOutputP2WSH_Body dynamic_output_p2wsh;
671 LDKSpendableOutputDescriptor_LDKStaticOutputCounterpartyPayment_Body static_output_counterparty_payment;
673 } LDKSpendableOutputDescriptor;
675 typedef struct LDKCVecTempl_SpendableOutputDescriptor {
676 LDKSpendableOutputDescriptor *data;
678 } LDKCVecTempl_SpendableOutputDescriptor;
680 typedef LDKCVecTempl_SpendableOutputDescriptor LDKCVec_SpendableOutputDescriptorZ;
683 * An Event which you should probably take some action in response to.
685 * Note that while Writeable and Readable are implemented for Event, you probably shouldn't use
686 * them directly as they don't round-trip exactly (for example FundingGenerationReady is never
687 * written as it makes no sense to respond to it after reconnecting to peers).
689 typedef enum LDKEvent_Tag {
691 * Used to indicate that the client should generate a funding transaction with the given
692 * parameters and then call ChannelManager::funding_transaction_generated.
693 * Generated in ChannelManager message handling.
694 * Note that *all inputs* in the funding transaction must spend SegWit outputs or your
695 * counterparty can steal your funds!
697 LDKEvent_FundingGenerationReady,
699 * Used to indicate that the client may now broadcast the funding transaction it created for a
700 * channel. Broadcasting such a transaction prior to this event may lead to our counterparty
701 * trivially stealing all funds in the funding transaction!
703 LDKEvent_FundingBroadcastSafe,
705 * Indicates we've received money! Just gotta dig out that payment preimage and feed it to
706 * ChannelManager::claim_funds to get it....
707 * Note that if the preimage is not known or the amount paid is incorrect, you should call
708 * ChannelManager::fail_htlc_backwards to free up resources for this HTLC and avoid
709 * network congestion.
710 * The amount paid should be considered 'incorrect' when it is less than or more than twice
711 * the amount expected.
712 * If you fail to call either ChannelManager::claim_funds or
713 * ChannelManager::fail_htlc_backwards within the HTLC's timeout, the HTLC will be
714 * automatically failed.
716 LDKEvent_PaymentReceived,
718 * Indicates an outbound payment we made succeeded (ie it made it all the way to its target
719 * and we got back the payment preimage for it).
720 * Note that duplicative PaymentSent Events may be generated - it is your responsibility to
721 * deduplicate them by payment_preimage (which MUST be unique)!
723 LDKEvent_PaymentSent,
725 * Indicates an outbound payment we made failed. Probably some intermediary node dropped
726 * something. You may wish to retry with a different route.
727 * Note that duplicative PaymentFailed Events may be generated - it is your responsibility to
728 * deduplicate them by payment_hash (which MUST be unique)!
730 LDKEvent_PaymentFailed,
732 * Used to indicate that ChannelManager::process_pending_htlc_forwards should be called at a
733 * time in the future.
735 LDKEvent_PendingHTLCsForwardable,
737 * Used to indicate that an output was generated on-chain which you should know how to spend.
738 * Such an output will *not* ever be spent by rust-lightning, and are not at risk of your
739 * counterparty spending them due to some kind of timeout. Thus, you need to store them
740 * somewhere and spend them when you create on-chain transactions.
742 LDKEvent_SpendableOutputs,
744 * Must be last for serialization purposes
749 typedef struct LDKEvent_LDKFundingGenerationReady_Body {
750 LDKThirtyTwoBytes temporary_channel_id;
751 uint64_t channel_value_satoshis;
752 LDKCVec_u8Z output_script;
753 uint64_t user_channel_id;
754 } LDKEvent_LDKFundingGenerationReady_Body;
756 typedef struct LDKEvent_LDKFundingBroadcastSafe_Body {
757 LDKOutPoint funding_txo;
758 uint64_t user_channel_id;
759 } LDKEvent_LDKFundingBroadcastSafe_Body;
761 typedef struct LDKEvent_LDKPaymentReceived_Body {
762 LDKThirtyTwoBytes payment_hash;
763 LDKThirtyTwoBytes payment_secret;
765 } LDKEvent_LDKPaymentReceived_Body;
767 typedef struct LDKEvent_LDKPaymentSent_Body {
768 LDKThirtyTwoBytes payment_preimage;
769 } LDKEvent_LDKPaymentSent_Body;
771 typedef struct LDKEvent_LDKPaymentFailed_Body {
772 LDKThirtyTwoBytes payment_hash;
773 bool rejected_by_dest;
774 } LDKEvent_LDKPaymentFailed_Body;
776 typedef struct LDKEvent_LDKPendingHTLCsForwardable_Body {
777 uint64_t time_forwardable;
778 } LDKEvent_LDKPendingHTLCsForwardable_Body;
780 typedef struct LDKEvent_LDKSpendableOutputs_Body {
781 LDKCVec_SpendableOutputDescriptorZ outputs;
782 } LDKEvent_LDKSpendableOutputs_Body;
784 typedef struct LDKEvent {
787 LDKEvent_LDKFundingGenerationReady_Body funding_generation_ready;
788 LDKEvent_LDKFundingBroadcastSafe_Body funding_broadcast_safe;
789 LDKEvent_LDKPaymentReceived_Body payment_received;
790 LDKEvent_LDKPaymentSent_Body payment_sent;
791 LDKEvent_LDKPaymentFailed_Body payment_failed;
792 LDKEvent_LDKPendingHTLCsForwardable_Body pending_htl_cs_forwardable;
793 LDKEvent_LDKSpendableOutputs_Body spendable_outputs;
800 * An accept_channel message to be sent or received from a peer
802 typedef struct MUST_USE_STRUCT LDKAcceptChannel {
804 * Nearly everyhwere, inner must be non-null, however in places where
805 * the Rust equivalent takes an Option, it may be set to null to indicate None.
807 LDKnativeAcceptChannel *inner;
814 * An open_channel message to be sent or received from a peer
816 typedef struct MUST_USE_STRUCT LDKOpenChannel {
818 * Nearly everyhwere, inner must be non-null, however in places where
819 * the Rust equivalent takes an Option, it may be set to null to indicate None.
821 LDKnativeOpenChannel *inner;
828 * A funding_created message to be sent or received from a peer
830 typedef struct MUST_USE_STRUCT LDKFundingCreated {
832 * Nearly everyhwere, inner must be non-null, however in places where
833 * the Rust equivalent takes an Option, it may be set to null to indicate None.
835 LDKnativeFundingCreated *inner;
842 * A funding_signed message to be sent or received from a peer
844 typedef struct MUST_USE_STRUCT LDKFundingSigned {
846 * Nearly everyhwere, inner must be non-null, however in places where
847 * the Rust equivalent takes an Option, it may be set to null to indicate None.
849 LDKnativeFundingSigned *inner;
856 * A funding_locked message to be sent or received from a peer
858 typedef struct MUST_USE_STRUCT LDKFundingLocked {
860 * Nearly everyhwere, inner must be non-null, however in places where
861 * the Rust equivalent takes an Option, it may be set to null to indicate None.
863 LDKnativeFundingLocked *inner;
870 * An announcement_signatures message to be sent or received from a peer
872 typedef struct MUST_USE_STRUCT LDKAnnouncementSignatures {
874 * Nearly everyhwere, inner must be non-null, however in places where
875 * the Rust equivalent takes an Option, it may be set to null to indicate None.
877 LDKnativeAnnouncementSignatures *inner;
879 } LDKAnnouncementSignatures;
884 * Struct used to return values from revoke_and_ack messages, containing a bunch of commitment
885 * transaction updates if they were pending.
887 typedef struct MUST_USE_STRUCT LDKCommitmentUpdate {
889 * Nearly everyhwere, inner must be non-null, however in places where
890 * the Rust equivalent takes an Option, it may be set to null to indicate None.
892 LDKnativeCommitmentUpdate *inner;
894 } LDKCommitmentUpdate;
899 * A revoke_and_ack message to be sent or received from a peer
901 typedef struct MUST_USE_STRUCT LDKRevokeAndACK {
903 * Nearly everyhwere, inner must be non-null, however in places where
904 * the Rust equivalent takes an Option, it may be set to null to indicate None.
906 LDKnativeRevokeAndACK *inner;
913 * A closing_signed message to be sent or received from a peer
915 typedef struct MUST_USE_STRUCT LDKClosingSigned {
917 * Nearly everyhwere, inner must be non-null, however in places where
918 * the Rust equivalent takes an Option, it may be set to null to indicate None.
920 LDKnativeClosingSigned *inner;
927 * A shutdown message to be sent or received from a peer
929 typedef struct MUST_USE_STRUCT LDKShutdown {
931 * Nearly everyhwere, inner must be non-null, however in places where
932 * the Rust equivalent takes an Option, it may be set to null to indicate None.
934 LDKnativeShutdown *inner;
941 * A channel_reestablish message to be sent or received from a peer
943 typedef struct MUST_USE_STRUCT LDKChannelReestablish {
945 * Nearly everyhwere, inner must be non-null, however in places where
946 * the Rust equivalent takes an Option, it may be set to null to indicate None.
948 LDKnativeChannelReestablish *inner;
950 } LDKChannelReestablish;
955 * A node_announcement message to be sent or received from a peer
957 typedef struct MUST_USE_STRUCT LDKNodeAnnouncement {
959 * Nearly everyhwere, inner must be non-null, however in places where
960 * the Rust equivalent takes an Option, it may be set to null to indicate None.
962 LDKnativeNodeAnnouncement *inner;
964 } LDKNodeAnnouncement;
969 * An error message to be sent or received from a peer
971 typedef struct MUST_USE_STRUCT LDKErrorMessage {
973 * Nearly everyhwere, inner must be non-null, however in places where
974 * the Rust equivalent takes an Option, it may be set to null to indicate None.
976 LDKnativeErrorMessage *inner;
981 * Used to put an error message in a LightningError
983 typedef enum LDKErrorAction_Tag {
985 * The peer took some action which made us think they were useless. Disconnect them.
987 LDKErrorAction_DisconnectPeer,
989 * The peer did something harmless that we weren't able to process, just log and ignore
991 LDKErrorAction_IgnoreError,
993 * The peer did something incorrect. Tell them.
995 LDKErrorAction_SendErrorMessage,
997 * Must be last for serialization purposes
999 LDKErrorAction_Sentinel,
1000 } LDKErrorAction_Tag;
1002 typedef struct LDKErrorAction_LDKDisconnectPeer_Body {
1003 LDKErrorMessage msg;
1004 } LDKErrorAction_LDKDisconnectPeer_Body;
1006 typedef struct LDKErrorAction_LDKSendErrorMessage_Body {
1007 LDKErrorMessage msg;
1008 } LDKErrorAction_LDKSendErrorMessage_Body;
1010 typedef struct LDKErrorAction {
1011 LDKErrorAction_Tag tag;
1013 LDKErrorAction_LDKDisconnectPeer_Body disconnect_peer;
1014 LDKErrorAction_LDKSendErrorMessage_Body send_error_message;
1019 * The information we received from a peer along the route of a payment we originated. This is
1020 * returned by ChannelMessageHandler::handle_update_fail_htlc to be passed into
1021 * RoutingMessageHandler::handle_htlc_fail_channel_update to update our network map.
1023 typedef enum LDKHTLCFailChannelUpdate_Tag {
1025 * We received an error which included a full ChannelUpdate message.
1027 LDKHTLCFailChannelUpdate_ChannelUpdateMessage,
1029 * We received an error which indicated only that a channel has been closed
1031 LDKHTLCFailChannelUpdate_ChannelClosed,
1033 * We received an error which indicated only that a node has failed
1035 LDKHTLCFailChannelUpdate_NodeFailure,
1037 * Must be last for serialization purposes
1039 LDKHTLCFailChannelUpdate_Sentinel,
1040 } LDKHTLCFailChannelUpdate_Tag;
1042 typedef struct LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body {
1043 LDKChannelUpdate msg;
1044 } LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body;
1046 typedef struct LDKHTLCFailChannelUpdate_LDKChannelClosed_Body {
1047 uint64_t short_channel_id;
1049 } LDKHTLCFailChannelUpdate_LDKChannelClosed_Body;
1051 typedef struct LDKHTLCFailChannelUpdate_LDKNodeFailure_Body {
1052 LDKPublicKey node_id;
1054 } LDKHTLCFailChannelUpdate_LDKNodeFailure_Body;
1056 typedef struct LDKHTLCFailChannelUpdate {
1057 LDKHTLCFailChannelUpdate_Tag tag;
1059 LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body channel_update_message;
1060 LDKHTLCFailChannelUpdate_LDKChannelClosed_Body channel_closed;
1061 LDKHTLCFailChannelUpdate_LDKNodeFailure_Body node_failure;
1063 } LDKHTLCFailChannelUpdate;
1066 * An event generated by ChannelManager which indicates a message should be sent to a peer (or
1067 * broadcast to most peers).
1068 * These events are handled by PeerManager::process_events if you are using a PeerManager.
1070 typedef enum LDKMessageSendEvent_Tag {
1072 * Used to indicate that we've accepted a channel open and should send the accept_channel
1073 * message provided to the given peer.
1075 LDKMessageSendEvent_SendAcceptChannel,
1077 * Used to indicate that we've initiated a channel open and should send the open_channel
1078 * message provided to the given peer.
1080 LDKMessageSendEvent_SendOpenChannel,
1082 * Used to indicate that a funding_created message should be sent to the peer with the given node_id.
1084 LDKMessageSendEvent_SendFundingCreated,
1086 * Used to indicate that a funding_signed message should be sent to the peer with the given node_id.
1088 LDKMessageSendEvent_SendFundingSigned,
1090 * Used to indicate that a funding_locked message should be sent to the peer with the given node_id.
1092 LDKMessageSendEvent_SendFundingLocked,
1094 * Used to indicate that an announcement_signatures message should be sent to the peer with the given node_id.
1096 LDKMessageSendEvent_SendAnnouncementSignatures,
1098 * Used to indicate that a series of HTLC update messages, as well as a commitment_signed
1099 * message should be sent to the peer with the given node_id.
1101 LDKMessageSendEvent_UpdateHTLCs,
1103 * Used to indicate that a revoke_and_ack message should be sent to the peer with the given node_id.
1105 LDKMessageSendEvent_SendRevokeAndACK,
1107 * Used to indicate that a closing_signed message should be sent to the peer with the given node_id.
1109 LDKMessageSendEvent_SendClosingSigned,
1111 * Used to indicate that a shutdown message should be sent to the peer with the given node_id.
1113 LDKMessageSendEvent_SendShutdown,
1115 * Used to indicate that a channel_reestablish message should be sent to the peer with the given node_id.
1117 LDKMessageSendEvent_SendChannelReestablish,
1119 * Used to indicate that a channel_announcement and channel_update should be broadcast to all
1120 * peers (except the peer with node_id either msg.contents.node_id_1 or msg.contents.node_id_2).
1122 * Note that after doing so, you very likely (unless you did so very recently) want to call
1123 * ChannelManager::broadcast_node_announcement to trigger a BroadcastNodeAnnouncement event.
1124 * This ensures that any nodes which see our channel_announcement also have a relevant
1125 * node_announcement, including relevant feature flags which may be important for routing
1128 LDKMessageSendEvent_BroadcastChannelAnnouncement,
1130 * Used to indicate that a node_announcement should be broadcast to all peers.
1132 LDKMessageSendEvent_BroadcastNodeAnnouncement,
1134 * Used to indicate that a channel_update should be broadcast to all peers.
1136 LDKMessageSendEvent_BroadcastChannelUpdate,
1138 * Broadcast an error downstream to be handled
1140 LDKMessageSendEvent_HandleError,
1142 * When a payment fails we may receive updates back from the hop where it failed. In such
1143 * cases this event is generated so that we can inform the network graph of this information.
1145 LDKMessageSendEvent_PaymentFailureNetworkUpdate,
1147 * Must be last for serialization purposes
1149 LDKMessageSendEvent_Sentinel,
1150 } LDKMessageSendEvent_Tag;
1152 typedef struct LDKMessageSendEvent_LDKSendAcceptChannel_Body {
1153 LDKPublicKey node_id;
1154 LDKAcceptChannel msg;
1155 } LDKMessageSendEvent_LDKSendAcceptChannel_Body;
1157 typedef struct LDKMessageSendEvent_LDKSendOpenChannel_Body {
1158 LDKPublicKey node_id;
1160 } LDKMessageSendEvent_LDKSendOpenChannel_Body;
1162 typedef struct LDKMessageSendEvent_LDKSendFundingCreated_Body {
1163 LDKPublicKey node_id;
1164 LDKFundingCreated msg;
1165 } LDKMessageSendEvent_LDKSendFundingCreated_Body;
1167 typedef struct LDKMessageSendEvent_LDKSendFundingSigned_Body {
1168 LDKPublicKey node_id;
1169 LDKFundingSigned msg;
1170 } LDKMessageSendEvent_LDKSendFundingSigned_Body;
1172 typedef struct LDKMessageSendEvent_LDKSendFundingLocked_Body {
1173 LDKPublicKey node_id;
1174 LDKFundingLocked msg;
1175 } LDKMessageSendEvent_LDKSendFundingLocked_Body;
1177 typedef struct LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body {
1178 LDKPublicKey node_id;
1179 LDKAnnouncementSignatures msg;
1180 } LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body;
1182 typedef struct LDKMessageSendEvent_LDKUpdateHTLCs_Body {
1183 LDKPublicKey node_id;
1184 LDKCommitmentUpdate updates;
1185 } LDKMessageSendEvent_LDKUpdateHTLCs_Body;
1187 typedef struct LDKMessageSendEvent_LDKSendRevokeAndACK_Body {
1188 LDKPublicKey node_id;
1189 LDKRevokeAndACK msg;
1190 } LDKMessageSendEvent_LDKSendRevokeAndACK_Body;
1192 typedef struct LDKMessageSendEvent_LDKSendClosingSigned_Body {
1193 LDKPublicKey node_id;
1194 LDKClosingSigned msg;
1195 } LDKMessageSendEvent_LDKSendClosingSigned_Body;
1197 typedef struct LDKMessageSendEvent_LDKSendShutdown_Body {
1198 LDKPublicKey node_id;
1200 } LDKMessageSendEvent_LDKSendShutdown_Body;
1202 typedef struct LDKMessageSendEvent_LDKSendChannelReestablish_Body {
1203 LDKPublicKey node_id;
1204 LDKChannelReestablish msg;
1205 } LDKMessageSendEvent_LDKSendChannelReestablish_Body;
1207 typedef struct LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body {
1208 LDKChannelAnnouncement msg;
1209 LDKChannelUpdate update_msg;
1210 } LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body;
1212 typedef struct LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body {
1213 LDKNodeAnnouncement msg;
1214 } LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body;
1216 typedef struct LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body {
1217 LDKChannelUpdate msg;
1218 } LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body;
1220 typedef struct LDKMessageSendEvent_LDKHandleError_Body {
1221 LDKPublicKey node_id;
1222 LDKErrorAction action;
1223 } LDKMessageSendEvent_LDKHandleError_Body;
1225 typedef struct LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body {
1226 LDKHTLCFailChannelUpdate update;
1227 } LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body;
1229 typedef struct LDKMessageSendEvent {
1230 LDKMessageSendEvent_Tag tag;
1232 LDKMessageSendEvent_LDKSendAcceptChannel_Body send_accept_channel;
1233 LDKMessageSendEvent_LDKSendOpenChannel_Body send_open_channel;
1234 LDKMessageSendEvent_LDKSendFundingCreated_Body send_funding_created;
1235 LDKMessageSendEvent_LDKSendFundingSigned_Body send_funding_signed;
1236 LDKMessageSendEvent_LDKSendFundingLocked_Body send_funding_locked;
1237 LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body send_announcement_signatures;
1238 LDKMessageSendEvent_LDKUpdateHTLCs_Body update_htl_cs;
1239 LDKMessageSendEvent_LDKSendRevokeAndACK_Body send_revoke_and_ack;
1240 LDKMessageSendEvent_LDKSendClosingSigned_Body send_closing_signed;
1241 LDKMessageSendEvent_LDKSendShutdown_Body send_shutdown;
1242 LDKMessageSendEvent_LDKSendChannelReestablish_Body send_channel_reestablish;
1243 LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body broadcast_channel_announcement;
1244 LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body broadcast_node_announcement;
1245 LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body broadcast_channel_update;
1246 LDKMessageSendEvent_LDKHandleError_Body handle_error;
1247 LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body payment_failure_network_update;
1249 } LDKMessageSendEvent;
1251 typedef struct LDKCVecTempl_MessageSendEvent {
1252 LDKMessageSendEvent *data;
1254 } LDKCVecTempl_MessageSendEvent;
1256 typedef LDKCVecTempl_MessageSendEvent LDKCVec_MessageSendEventZ;
1259 * A trait indicating an object may generate message send events
1261 typedef struct LDKMessageSendEventsProvider {
1264 * Gets the list of pending events which were generated by previous actions, clearing the list
1267 LDKCVec_MessageSendEventZ (*get_and_clear_pending_msg_events)(const void *this_arg);
1268 void (*free)(void *this_arg);
1269 } LDKMessageSendEventsProvider;
1271 typedef struct LDKCVecTempl_Event {
1274 } LDKCVecTempl_Event;
1276 typedef LDKCVecTempl_Event LDKCVec_EventZ;
1279 * A trait indicating an object may generate events
1281 typedef struct LDKEventsProvider {
1284 * Gets the list of pending events which were generated by previous actions, clearing the list
1287 LDKCVec_EventZ (*get_and_clear_pending_events)(const void *this_arg);
1288 void (*free)(void *this_arg);
1289 } LDKEventsProvider;
1292 * A trait encapsulating the operations required of a logger
1294 typedef struct LDKLogger {
1299 void (*log)(const void *this_arg, const char *record);
1300 void (*free)(void *this_arg);
1306 * Configuration we set when applicable.
1308 * Default::default() provides sane defaults.
1310 typedef struct MUST_USE_STRUCT LDKChannelHandshakeConfig {
1312 * Nearly everyhwere, inner must be non-null, however in places where
1313 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1315 LDKnativeChannelHandshakeConfig *inner;
1317 } LDKChannelHandshakeConfig;
1322 * Optional channel limits which are applied during channel creation.
1324 * These limits are only applied to our counterparty's limits, not our own.
1326 * Use 0/<type>::max_value() as appropriate to skip checking.
1328 * Provides sane defaults for most configurations.
1330 * Most additional limits are disabled except those with which specify a default in individual
1331 * field documentation. Note that this may result in barely-usable channels, but since they
1332 * are applied mostly only to incoming channels that's not much of a problem.
1334 typedef struct MUST_USE_STRUCT LDKChannelHandshakeLimits {
1336 * Nearly everyhwere, inner must be non-null, however in places where
1337 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1339 LDKnativeChannelHandshakeLimits *inner;
1341 } LDKChannelHandshakeLimits;
1346 * Options which apply on a per-channel basis and may change at runtime or based on negotiation
1347 * with our counterparty.
1349 typedef struct MUST_USE_STRUCT LDKChannelConfig {
1351 * Nearly everyhwere, inner must be non-null, however in places where
1352 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1354 LDKnativeChannelConfig *inner;
1358 typedef struct LDKu8slice {
1359 const uint8_t *data;
1366 * Top-level config which holds ChannelHandshakeLimits and ChannelConfig.
1368 * Default::default() provides sane defaults for most configurations
1369 * (but currently with 0 relay fees!)
1371 typedef struct MUST_USE_STRUCT LDKUserConfig {
1373 * Nearly everyhwere, inner must be non-null, however in places where
1374 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1376 LDKnativeUserConfig *inner;
1380 typedef union LDKCResultPtr_TxOut__AccessError {
1382 LDKAccessError *err;
1383 } LDKCResultPtr_TxOut__AccessError;
1385 typedef struct LDKCResultTempl_TxOut__AccessError {
1386 LDKCResultPtr_TxOut__AccessError contents;
1388 } LDKCResultTempl_TxOut__AccessError;
1390 typedef LDKCResultTempl_TxOut__AccessError LDKCResult_TxOutAccessErrorZ;
1393 * The `Access` trait defines behavior for accessing chain data and state, such as blocks and
1396 typedef struct LDKAccess {
1399 * Returns the transaction output of a funding transaction encoded by [`short_channel_id`].
1400 * Returns an error if `genesis_hash` is for a different chain or if such a transaction output
1403 * [`short_channel_id`]: https://github.com/lightningnetwork/lightning-rfc/blob/master/07-routing-gossip.md#definition-of-short_channel_id
1405 LDKCResult_TxOutAccessErrorZ (*get_utxo)(const void *this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id);
1406 void (*free)(void *this_arg);
1412 * One counterparty's public keys which do not change over the life of a channel.
1414 typedef struct MUST_USE_STRUCT LDKChannelPublicKeys {
1416 * Nearly everyhwere, inner must be non-null, however in places where
1417 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1419 LDKnativeChannelPublicKeys *inner;
1421 } LDKChannelPublicKeys;
1426 * The per-commitment point and a set of pre-calculated public keys used for transaction creation
1428 * The pre-calculated keys are an optimization, because ChannelKeys has enough
1429 * information to re-derive them.
1431 typedef struct MUST_USE_STRUCT LDKPreCalculatedTxCreationKeys {
1433 * Nearly everyhwere, inner must be non-null, however in places where
1434 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1436 LDKnativePreCalculatedTxCreationKeys *inner;
1438 } LDKPreCalculatedTxCreationKeys;
1440 typedef struct LDKCVecTempl_HTLCOutputInCommitment {
1441 LDKHTLCOutputInCommitment *data;
1443 } LDKCVecTempl_HTLCOutputInCommitment;
1445 typedef LDKCVecTempl_HTLCOutputInCommitment LDKCVec_HTLCOutputInCommitmentZ;
1450 * We use this to track holder commitment transactions and put off signing them until we are ready
1451 * to broadcast. This class can be used inside a signer implementation to generate a signature
1452 * given the relevant secret key.
1454 typedef struct MUST_USE_STRUCT LDKHolderCommitmentTransaction {
1456 * Nearly everyhwere, inner must be non-null, however in places where
1457 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1459 LDKnativeHolderCommitmentTransaction *inner;
1461 } LDKHolderCommitmentTransaction;
1466 * The unsigned part of a channel_announcement
1468 typedef struct MUST_USE_STRUCT LDKUnsignedChannelAnnouncement {
1470 * Nearly everyhwere, inner must be non-null, however in places where
1471 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1473 LDKnativeUnsignedChannelAnnouncement *inner;
1475 } LDKUnsignedChannelAnnouncement;
1478 * Set of lightning keys needed to operate a channel as described in BOLT 3.
1480 * Signing services could be implemented on a hardware wallet. In this case,
1481 * the current ChannelKeys would be a front-end on top of a communication
1482 * channel connected to your secure device and lightning key material wouldn't
1483 * reside on a hot server. Nevertheless, a this deployment would still need
1484 * to trust the ChannelManager to avoid loss of funds as this latest component
1485 * could ask to sign commitment transaction with HTLCs paying to attacker pubkeys.
1487 * A more secure iteration would be to use hashlock (or payment points) to pair
1488 * invoice/incoming HTLCs with outgoing HTLCs to implement a no-trust-ChannelManager
1489 * at the price of more state and computation on the hardware wallet side. In the future,
1490 * we are looking forward to design such interface.
1492 * In any case, ChannelMonitor or fallback watchtowers are always going to be trusted
1493 * to act, as liveness and breach reply correctness are always going to be hard requirements
1494 * of LN security model, orthogonal of key management issues.
1496 * If you're implementing a custom signer, you almost certainly want to implement
1497 * Readable/Writable to serialize out a unique reference to this set of keys so
1498 * that you can serialize the full ChannelManager object.
1501 typedef struct LDKChannelKeys {
1504 * Gets the per-commitment point for a specific commitment number
1506 * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
1508 LDKPublicKey (*get_per_commitment_point)(const void *this_arg, uint64_t idx);
1510 * Gets the commitment secret for a specific commitment number as part of the revocation process
1512 * An external signer implementation should error here if the commitment was already signed
1513 * and should refuse to sign it in the future.
1515 * May be called more than once for the same index.
1517 * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
1518 * TODO: return a Result so we can signal a validation error
1520 LDKThirtyTwoBytes (*release_commitment_secret)(const void *this_arg, uint64_t idx);
1522 * Gets the holder's channel public keys and basepoints
1524 LDKChannelPublicKeys pubkeys;
1526 * Fill in the pubkeys field as a reference to it will be given to Rust after this returns
1527 * Note that this takes a pointer to this object, not the this_ptr like other methods do
1528 * This function pointer may be NULL if pubkeys is filled in when this object is created and never needs updating.
1530 void (*set_pubkeys)(const LDKChannelKeys*);
1532 * Gets arbitrary identifiers describing the set of keys which are provided back to you in
1533 * some SpendableOutputDescriptor types. These should be sufficient to identify this
1534 * ChannelKeys object uniquely and lookup or re-derive its keys.
1536 LDKC2Tuple_u64u64Z (*key_derivation_params)(const void *this_arg);
1538 * Create a signature for a counterparty's commitment transaction and associated HTLC transactions.
1540 * Note that if signing fails or is rejected, the channel will be force-closed.
1542 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);
1544 * Create a signature for a holder's commitment transaction. This will only ever be called with
1545 * the same holder_commitment_tx (or a copy thereof), though there are currently no guarantees
1546 * that it will not be called multiple times.
1547 * An external signer implementation should check that the commitment has not been revoked.
1549 LDKCResult_SignatureNoneZ (*sign_holder_commitment)(const void *this_arg, const LDKHolderCommitmentTransaction *holder_commitment_tx);
1551 * Create a signature for each HTLC transaction spending a holder's commitment transaction.
1553 * Unlike sign_holder_commitment, this may be called multiple times with *different*
1554 * holder_commitment_tx values. While this will never be called with a revoked
1555 * holder_commitment_tx, it is possible that it is called with the second-latest
1556 * holder_commitment_tx (only if we haven't yet revoked it) if some watchtower/secondary
1557 * ChannelMonitor decided to broadcast before it had been updated to the latest.
1559 * Either an Err should be returned, or a Vec with one entry for each HTLC which exists in
1560 * holder_commitment_tx. For those HTLCs which have transaction_output_index set to None
1561 * (implying they were considered dust at the time the commitment transaction was negotiated),
1562 * a corresponding None should be included in the return value. All other positions in the
1563 * return value must contain a signature.
1565 LDKCResult_CVec_SignatureZNoneZ (*sign_holder_commitment_htlc_transactions)(const void *this_arg, const LDKHolderCommitmentTransaction *holder_commitment_tx);
1567 * Create a signature for the given input in a transaction spending an HTLC or commitment
1568 * transaction output when our counterparty broadcasts an old state.
1570 * A justice transaction may claim multiples outputs at the same time if timelocks are
1571 * similar, but only a signature for the input at index `input` should be signed for here.
1572 * It may be called multiples time for same output(s) if a fee-bump is needed with regards
1573 * to an upcoming timelock expiration.
1575 * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
1577 * per_commitment_key is revocation secret which was provided by our counterparty when they
1578 * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
1579 * not allow the spending of any funds by itself (you need our holder revocation_secret to do
1582 * htlc holds HTLC elements (hash, timelock) if the output being spent is a HTLC output, thus
1583 * changing the format of the witness script (which is committed to in the BIP 143
1586 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);
1588 * Create a signature for a claiming transaction for a HTLC output on a counterparty's commitment
1589 * transaction, either offered or received.
1591 * Such a transaction may claim multiples offered outputs at same time if we know the
1592 * preimage for each when we create it, but only the input at index `input` should be
1593 * signed for here. It may be called multiple times for same output(s) if a fee-bump is
1594 * needed with regards to an upcoming timelock expiration.
1596 * Witness_script is either a offered or received script as defined in BOLT3 for HTLC
1599 * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
1601 * Per_commitment_point is the dynamic point corresponding to the channel state
1602 * detected onchain. It has been generated by our counterparty and is used to derive
1603 * channel state keys, which are then included in the witness script and committed to in the
1604 * BIP 143 signature.
1606 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);
1608 * Create a signature for a (proposed) closing transaction.
1610 * Note that, due to rounding, there may be one \"missing\" satoshi, and either party may have
1611 * chosen to forgo their output as dust.
1613 LDKCResult_SignatureNoneZ (*sign_closing_transaction)(const void *this_arg, LDKTransaction closing_tx);
1615 * Signs a channel announcement message with our funding key, proving it comes from one
1616 * of the channel participants.
1618 * Note that if this fails or is rejected, the channel will not be publicly announced and
1619 * our counterparty may (though likely will not) close the channel on us for violating the
1622 LDKCResult_SignatureNoneZ (*sign_channel_announcement)(const void *this_arg, const LDKUnsignedChannelAnnouncement *msg);
1624 * Set the counterparty channel basepoints and counterparty_selected/holder_selected_contest_delay.
1625 * This is done immediately on incoming channels and as soon as the channel is accepted on outgoing channels.
1627 * We bind holder_selected_contest_delay late here for API convenience.
1629 * Will be called before any signatures are applied.
1631 void (*on_accept)(void *this_arg, const LDKChannelPublicKeys *channel_points, uint16_t counterparty_selected_contest_delay, uint16_t holder_selected_contest_delay);
1632 void *(*clone)(const void *this_arg);
1633 void (*free)(void *this_arg);
1639 * A ChannelMonitor handles chain events (blocks connected and disconnected) and generates
1640 * on-chain transactions to ensure no loss of funds occurs.
1642 * You MUST ensure that no ChannelMonitors for a given channel anywhere contain out-of-date
1643 * information and are actively monitoring the chain.
1645 * Pending Events or updated HTLCs which have not yet been read out by
1646 * get_and_clear_pending_monitor_events or get_and_clear_pending_events are serialized to disk and
1647 * reloaded at deserialize-time. Thus, you must ensure that, when handling events, all events
1648 * gotten are fully handled before re-serializing the new state.
1650 typedef struct MUST_USE_STRUCT LDKChannelMonitor {
1652 * Nearly everyhwere, inner must be non-null, however in places where
1653 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1655 LDKnativeChannelMonitor *inner;
1657 } LDKChannelMonitor;
1662 * An update generated by the underlying Channel itself which contains some new information the
1663 * ChannelMonitor should be made aware of.
1665 typedef struct MUST_USE_STRUCT LDKChannelMonitorUpdate {
1667 * Nearly everyhwere, inner must be non-null, however in places where
1668 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1670 LDKnativeChannelMonitorUpdate *inner;
1672 } LDKChannelMonitorUpdate;
1677 * An event to be processed by the ChannelManager.
1679 typedef struct MUST_USE_STRUCT LDKMonitorEvent {
1681 * Nearly everyhwere, inner must be non-null, however in places where
1682 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1684 LDKnativeMonitorEvent *inner;
1688 typedef struct LDKCVecTempl_MonitorEvent {
1689 LDKMonitorEvent *data;
1691 } LDKCVecTempl_MonitorEvent;
1693 typedef LDKCVecTempl_MonitorEvent LDKCVec_MonitorEventZ;
1696 * The `Watch` trait defines behavior for watching on-chain activity pertaining to channels as
1697 * blocks are connected and disconnected.
1699 * Each channel is associated with a [`ChannelMonitor`]. Implementations of this trait are
1700 * responsible for maintaining a set of monitors such that they can be updated accordingly as
1701 * channel state changes and HTLCs are resolved. See method documentation for specific
1704 * Implementations **must** ensure that updates are successfully applied and persisted upon method
1705 * completion. If an update fails with a [`PermanentFailure`], then it must immediately shut down
1706 * without taking any further action such as persisting the current state.
1708 * If an implementation maintains multiple instances of a channel's monitor (e.g., by storing
1709 * backup copies), then it must ensure that updates are applied across all instances. Otherwise, it
1710 * could result in a revoked transaction being broadcast, allowing the counterparty to claim all
1711 * funds in the channel. See [`ChannelMonitorUpdateErr`] for more details about how to handle
1712 * multiple instances.
1714 * [`ChannelMonitor`]: channelmonitor/struct.ChannelMonitor.html
1715 * [`ChannelMonitorUpdateErr`]: channelmonitor/enum.ChannelMonitorUpdateErr.html
1716 * [`PermanentFailure`]: channelmonitor/enum.ChannelMonitorUpdateErr.html#variant.PermanentFailure
1718 typedef struct LDKWatch {
1721 * Watches a channel identified by `funding_txo` using `monitor`.
1723 * Implementations are responsible for watching the chain for the funding transaction along
1724 * with any spends of outputs returned by [`get_outputs_to_watch`]. In practice, this means
1725 * calling [`block_connected`] and [`block_disconnected`] on the monitor.
1727 * [`get_outputs_to_watch`]: channelmonitor/struct.ChannelMonitor.html#method.get_outputs_to_watch
1728 * [`block_connected`]: channelmonitor/struct.ChannelMonitor.html#method.block_connected
1729 * [`block_disconnected`]: channelmonitor/struct.ChannelMonitor.html#method.block_disconnected
1731 LDKCResult_NoneChannelMonitorUpdateErrZ (*watch_channel)(const void *this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor);
1733 * Updates a channel identified by `funding_txo` by applying `update` to its monitor.
1735 * Implementations must call [`update_monitor`] with the given update. See
1736 * [`ChannelMonitorUpdateErr`] for invariants around returning an error.
1738 * [`update_monitor`]: channelmonitor/struct.ChannelMonitor.html#method.update_monitor
1739 * [`ChannelMonitorUpdateErr`]: channelmonitor/enum.ChannelMonitorUpdateErr.html
1741 LDKCResult_NoneChannelMonitorUpdateErrZ (*update_channel)(const void *this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update);
1743 * Returns any monitor events since the last call. Subsequent calls must only return new
1746 LDKCVec_MonitorEventZ (*release_pending_monitor_events)(const void *this_arg);
1747 void (*free)(void *this_arg);
1751 * The `Filter` trait defines behavior for indicating chain activity of interest pertaining to
1754 * This is useful in order to have a [`Watch`] implementation convey to a chain source which
1755 * transactions to be notified of. Notification may take the form of pre-filtering blocks or, in
1756 * the case of [BIP 157]/[BIP 158], only fetching a block if the compact filter matches. If
1757 * receiving full blocks from a chain source, any further filtering is unnecessary.
1759 * After an output has been registered, subsequent block retrievals from the chain source must not
1760 * exclude any transactions matching the new criteria nor any in-block descendants of such
1763 * Note that use as part of a [`Watch`] implementation involves reentrancy. Therefore, the `Filter`
1764 * should not block on I/O. Implementations should instead queue the newly monitored data to be
1765 * processed later. Then, in order to block until the data has been processed, any `Watch`
1766 * invocation that has called the `Filter` must return [`TemporaryFailure`].
1768 * [`Watch`]: trait.Watch.html
1769 * [`TemporaryFailure`]: channelmonitor/enum.ChannelMonitorUpdateErr.html#variant.TemporaryFailure
1770 * [BIP 157]: https://github.com/bitcoin/bips/blob/master/bip-0157.mediawiki
1771 * [BIP 158]: https://github.com/bitcoin/bips/blob/master/bip-0158.mediawiki
1773 typedef struct LDKFilter {
1776 * Registers interest in a transaction with `txid` and having an output with `script_pubkey` as
1777 * a spending condition.
1779 void (*register_tx)(const void *this_arg, const uint8_t (*txid)[32], LDKu8slice script_pubkey);
1781 * Registers interest in spends of a transaction output identified by `outpoint` having
1782 * `script_pubkey` as the spending condition.
1784 void (*register_output)(const void *this_arg, const LDKOutPoint *outpoint, LDKu8slice script_pubkey);
1785 void (*free)(void *this_arg);
1789 * An interface to send a transaction to the Bitcoin network.
1791 typedef struct LDKBroadcasterInterface {
1794 * Sends a transaction out to (hopefully) be mined.
1796 void (*broadcast_transaction)(const void *this_arg, LDKTransaction tx);
1797 void (*free)(void *this_arg);
1798 } LDKBroadcasterInterface;
1801 * A trait which should be implemented to provide feerate information on a number of time
1804 * Note that all of the functions implemented here *must* be reentrant-safe (obviously - they're
1805 * called from inside the library in response to chain events, P2P events, or timer events).
1807 typedef struct LDKFeeEstimator {
1810 * Gets estimated satoshis of fee required per 1000 Weight-Units.
1812 * Must be no smaller than 253 (ie 1 satoshi-per-byte rounded up to ensure later round-downs
1813 * don't put us below 1 satoshi-per-byte).
1815 * This translates to:
1816 * * satoshis-per-byte * 250
1817 * * ceil(satoshis-per-kbyte / 4)
1819 uint32_t (*get_est_sat_per_1000_weight)(const void *this_arg, LDKConfirmationTarget confirmation_target);
1820 void (*free)(void *this_arg);
1826 * An implementation of [`chain::Watch`] for monitoring channels.
1828 * Connected and disconnected blocks must be provided to `ChainMonitor` as documented by
1829 * [`chain::Watch`]. May be used in conjunction with [`ChannelManager`] to monitor channels locally
1830 * or used independently to monitor channels remotely. See the [module-level documentation] for
1833 * [`chain::Watch`]: ../trait.Watch.html
1834 * [`ChannelManager`]: ../../ln/channelmanager/struct.ChannelManager.html
1835 * [module-level documentation]: index.html
1837 typedef struct MUST_USE_STRUCT LDKChainMonitor {
1839 * Nearly everyhwere, inner must be non-null, however in places where
1840 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1842 LDKnativeChainMonitor *inner;
1846 typedef struct LDKCVecTempl_C2TupleTempl_usize__Transaction {
1847 LDKC2TupleTempl_usize__Transaction *data;
1849 } LDKCVecTempl_C2TupleTempl_usize__Transaction;
1851 typedef LDKCVecTempl_C2TupleTempl_usize__Transaction LDKCVec_C2Tuple_usizeTransactionZZ;
1856 * Simple structure sent back by `chain::Watch` when an HTLC from a forward channel is detected on
1857 * chain. Used to update the corresponding HTLC in the backward channel. Failing to pass the
1858 * preimage claim backward will lead to loss of funds.
1860 * [`chain::Watch`]: ../trait.Watch.html
1862 typedef struct MUST_USE_STRUCT LDKHTLCUpdate {
1864 * Nearly everyhwere, inner must be non-null, however in places where
1865 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1867 LDKnativeHTLCUpdate *inner;
1871 typedef struct LDKCVecTempl_Transaction {
1872 LDKTransaction *data;
1874 } LDKCVecTempl_Transaction;
1876 typedef LDKCVecTempl_Transaction LDKCVec_TransactionZ;
1878 typedef struct LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut {
1879 LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut *data;
1881 } LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut;
1883 typedef LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut LDKCVec_C2Tuple_TxidCVec_TxOutZZZ;
1885 typedef struct LDKSecretKey {
1890 * A trait to describe an object which can get user secrets and key material.
1892 typedef struct LDKKeysInterface {
1895 * Get node secret key (aka node_id or network_key)
1897 LDKSecretKey (*get_node_secret)(const void *this_arg);
1899 * Get destination redeemScript to encumber static protocol exit points.
1901 LDKCVec_u8Z (*get_destination_script)(const void *this_arg);
1903 * Get shutdown_pubkey to use as PublicKey at channel closure
1905 LDKPublicKey (*get_shutdown_pubkey)(const void *this_arg);
1907 * Get a new set of ChannelKeys for per-channel secrets. These MUST be unique even if you
1908 * restarted with some stale data!
1910 LDKChannelKeys (*get_channel_keys)(const void *this_arg, bool inbound, uint64_t channel_value_satoshis);
1912 * Gets a unique, cryptographically-secure, random 32 byte value. This is used for encrypting
1913 * onion packets and for temporary channel IDs. There is no requirement that these be
1914 * persisted anywhere, though they must be unique across restarts.
1916 LDKThirtyTwoBytes (*get_secure_random_bytes)(const void *this_arg);
1917 void (*free)(void *this_arg);
1923 * A simple implementation of ChannelKeys that just keeps the private keys in memory.
1925 typedef struct MUST_USE_STRUCT LDKInMemoryChannelKeys {
1927 * Nearly everyhwere, inner must be non-null, however in places where
1928 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1930 LDKnativeInMemoryChannelKeys *inner;
1932 } LDKInMemoryChannelKeys;
1937 * Simple KeysInterface implementor that takes a 32-byte seed for use as a BIP 32 extended key
1938 * and derives keys from that.
1940 * Your node_id is seed/0'
1941 * ChannelMonitor closes may use seed/1'
1942 * Cooperative closes may use seed/2'
1943 * The two close keys may be needed to claim on-chain funds!
1945 typedef struct MUST_USE_STRUCT LDKKeysManager {
1947 * Nearly everyhwere, inner must be non-null, however in places where
1948 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1950 LDKnativeKeysManager *inner;
1957 * Manager which keeps track of a number of channels and sends messages to the appropriate
1958 * channel, also tracking HTLC preimages and forwarding onion packets appropriately.
1960 * Implements ChannelMessageHandler, handling the multi-channel parts and passing things through
1961 * to individual Channels.
1963 * Implements Writeable to write out all channel state to disk. Implies peer_disconnected() for
1964 * all peers during write/read (though does not modify this instance, only the instance being
1965 * serialized). This will result in any channels which have not yet exchanged funding_created (ie
1966 * called funding_transaction_generated for outbound channels).
1968 * Note that you can be a bit lazier about writing out ChannelManager than you can be with
1969 * ChannelMonitors. With ChannelMonitors you MUST write each monitor update out to disk before
1970 * returning from chain::Watch::watch_/update_channel, with ChannelManagers, writing updates
1971 * happens out-of-band (and will prevent any other ChannelManager operations from occurring during
1972 * the serialization process). If the deserialized version is out-of-date compared to the
1973 * ChannelMonitors passed by reference to read(), those channels will be force-closed based on the
1974 * ChannelMonitor state and no funds will be lost (mod on-chain transaction fees).
1976 * Note that the deserializer is only implemented for (Sha256dHash, ChannelManager), which
1977 * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
1978 * the \"reorg path\" (ie call block_disconnected() until you get to a common block and then call
1979 * block_connected() to step towards your best block) upon deserialization before using the
1982 * Note that ChannelManager is responsible for tracking liveness of its channels and generating
1983 * ChannelUpdate messages informing peers that the channel is temporarily disabled. To avoid
1984 * spam due to quick disconnection/reconnection, updates are not sent until the channel has been
1985 * offline for a full minute. In order to track this, you must call
1986 * timer_chan_freshness_every_min roughly once per minute, though it doesn't have to be perfect.
1988 * Rather than using a plain ChannelManager, it is preferable to use either a SimpleArcChannelManager
1989 * a SimpleRefChannelManager, for conciseness. See their documentation for more details, but
1990 * essentially you should default to using a SimpleRefChannelManager, and use a
1991 * SimpleArcChannelManager when you require a ChannelManager with a static lifetime, such as when
1992 * you're using lightning-net-tokio.
1994 typedef struct MUST_USE_STRUCT LDKChannelManager {
1996 * Nearly everyhwere, inner must be non-null, however in places where
1997 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1999 LDKnativeChannelManager *inner;
2001 } LDKChannelManager;
2006 * Details of a channel, as returned by ChannelManager::list_channels and ChannelManager::list_usable_channels
2008 typedef struct MUST_USE_STRUCT LDKChannelDetails {
2010 * Nearly everyhwere, inner must be non-null, however in places where
2011 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2013 LDKnativeChannelDetails *inner;
2015 } LDKChannelDetails;
2020 * Features used within an `init` message.
2022 typedef struct MUST_USE_STRUCT LDKInitFeatures {
2024 * Nearly everyhwere, inner must be non-null, however in places where
2025 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2027 LDKnativeInitFeatures *inner;
2031 typedef struct LDKCVecTempl_ChannelDetails {
2032 LDKChannelDetails *data;
2034 } LDKCVecTempl_ChannelDetails;
2036 typedef LDKCVecTempl_ChannelDetails LDKCVec_ChannelDetailsZ;
2041 * A route directs a payment from the sender (us) to the recipient. If the recipient supports MPP,
2042 * it can take multiple paths. Each path is composed of one or more hops through the network.
2044 typedef struct MUST_USE_STRUCT LDKRoute {
2046 * Nearly everyhwere, inner must be non-null, however in places where
2047 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2049 LDKnativeRoute *inner;
2053 typedef struct LDKThreeBytes {
2057 typedef struct LDKFourBytes {
2061 typedef struct LDKSixteenBytes {
2065 typedef struct LDKTenBytes {
2070 * An address which can be used to connect to a remote peer
2072 typedef enum LDKNetAddress_Tag {
2074 * An IPv4 address/port on which the peer is listening.
2078 * An IPv6 address/port on which the peer is listening.
2082 * An old-style Tor onion address/port on which the peer is listening.
2084 LDKNetAddress_OnionV2,
2086 * A new-style Tor onion address/port on which the peer is listening.
2087 * To create the human-readable \"hostname\", concatenate ed25519_pubkey, checksum, and version,
2088 * wrap as base32 and append \".onion\".
2090 LDKNetAddress_OnionV3,
2092 * Must be last for serialization purposes
2094 LDKNetAddress_Sentinel,
2095 } LDKNetAddress_Tag;
2097 typedef struct LDKNetAddress_LDKIPv4_Body {
2100 } LDKNetAddress_LDKIPv4_Body;
2102 typedef struct LDKNetAddress_LDKIPv6_Body {
2103 LDKSixteenBytes addr;
2105 } LDKNetAddress_LDKIPv6_Body;
2107 typedef struct LDKNetAddress_LDKOnionV2_Body {
2110 } LDKNetAddress_LDKOnionV2_Body;
2112 typedef struct LDKNetAddress_LDKOnionV3_Body {
2113 LDKThirtyTwoBytes ed25519_pubkey;
2117 } LDKNetAddress_LDKOnionV3_Body;
2119 typedef struct LDKNetAddress {
2120 LDKNetAddress_Tag tag;
2122 LDKNetAddress_LDKIPv4_Body i_pv4;
2123 LDKNetAddress_LDKIPv6_Body i_pv6;
2124 LDKNetAddress_LDKOnionV2_Body onion_v2;
2125 LDKNetAddress_LDKOnionV3_Body onion_v3;
2129 typedef struct LDKCVecTempl_NetAddress {
2130 LDKNetAddress *data;
2132 } LDKCVecTempl_NetAddress;
2134 typedef LDKCVecTempl_NetAddress LDKCVec_NetAddressZ;
2139 * An update_add_htlc message to be sent or received from a peer
2141 typedef struct MUST_USE_STRUCT LDKUpdateAddHTLC {
2143 * Nearly everyhwere, inner must be non-null, however in places where
2144 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2146 LDKnativeUpdateAddHTLC *inner;
2153 * An update_fulfill_htlc message to be sent or received from a peer
2155 typedef struct MUST_USE_STRUCT LDKUpdateFulfillHTLC {
2157 * Nearly everyhwere, inner must be non-null, however in places where
2158 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2160 LDKnativeUpdateFulfillHTLC *inner;
2162 } LDKUpdateFulfillHTLC;
2167 * An update_fail_htlc message to be sent or received from a peer
2169 typedef struct MUST_USE_STRUCT LDKUpdateFailHTLC {
2171 * Nearly everyhwere, inner must be non-null, however in places where
2172 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2174 LDKnativeUpdateFailHTLC *inner;
2176 } LDKUpdateFailHTLC;
2181 * An update_fail_malformed_htlc message to be sent or received from a peer
2183 typedef struct MUST_USE_STRUCT LDKUpdateFailMalformedHTLC {
2185 * Nearly everyhwere, inner must be non-null, however in places where
2186 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2188 LDKnativeUpdateFailMalformedHTLC *inner;
2190 } LDKUpdateFailMalformedHTLC;
2195 * A commitment_signed message to be sent or received from a peer
2197 typedef struct MUST_USE_STRUCT LDKCommitmentSigned {
2199 * Nearly everyhwere, inner must be non-null, however in places where
2200 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2202 LDKnativeCommitmentSigned *inner;
2204 } LDKCommitmentSigned;
2209 * An update_fee message to be sent or received from a peer
2211 typedef struct MUST_USE_STRUCT LDKUpdateFee {
2213 * Nearly everyhwere, inner must be non-null, however in places where
2214 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2216 LDKnativeUpdateFee *inner;
2223 * An init message to be sent or received from a peer
2225 typedef struct MUST_USE_STRUCT LDKInit {
2227 * Nearly everyhwere, inner must be non-null, however in places where
2228 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2230 LDKnativeInit *inner;
2235 * A trait to describe an object which can receive channel messages.
2237 * Messages MAY be called in parallel when they originate from different their_node_ids, however
2238 * they MUST NOT be called in parallel when the two calls have the same their_node_id.
2240 typedef struct LDKChannelMessageHandler {
2243 * Handle an incoming open_channel message from the given peer.
2245 void (*handle_open_channel)(const void *this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel *msg);
2247 * Handle an incoming accept_channel message from the given peer.
2249 void (*handle_accept_channel)(const void *this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel *msg);
2251 * Handle an incoming funding_created message from the given peer.
2253 void (*handle_funding_created)(const void *this_arg, LDKPublicKey their_node_id, const LDKFundingCreated *msg);
2255 * Handle an incoming funding_signed message from the given peer.
2257 void (*handle_funding_signed)(const void *this_arg, LDKPublicKey their_node_id, const LDKFundingSigned *msg);
2259 * Handle an incoming funding_locked message from the given peer.
2261 void (*handle_funding_locked)(const void *this_arg, LDKPublicKey their_node_id, const LDKFundingLocked *msg);
2263 * Handle an incoming shutdown message from the given peer.
2265 void (*handle_shutdown)(const void *this_arg, LDKPublicKey their_node_id, const LDKShutdown *msg);
2267 * Handle an incoming closing_signed message from the given peer.
2269 void (*handle_closing_signed)(const void *this_arg, LDKPublicKey their_node_id, const LDKClosingSigned *msg);
2271 * Handle an incoming update_add_htlc message from the given peer.
2273 void (*handle_update_add_htlc)(const void *this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC *msg);
2275 * Handle an incoming update_fulfill_htlc message from the given peer.
2277 void (*handle_update_fulfill_htlc)(const void *this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC *msg);
2279 * Handle an incoming update_fail_htlc message from the given peer.
2281 void (*handle_update_fail_htlc)(const void *this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC *msg);
2283 * Handle an incoming update_fail_malformed_htlc message from the given peer.
2285 void (*handle_update_fail_malformed_htlc)(const void *this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC *msg);
2287 * Handle an incoming commitment_signed message from the given peer.
2289 void (*handle_commitment_signed)(const void *this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned *msg);
2291 * Handle an incoming revoke_and_ack message from the given peer.
2293 void (*handle_revoke_and_ack)(const void *this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK *msg);
2295 * Handle an incoming update_fee message from the given peer.
2297 void (*handle_update_fee)(const void *this_arg, LDKPublicKey their_node_id, const LDKUpdateFee *msg);
2299 * Handle an incoming announcement_signatures message from the given peer.
2301 void (*handle_announcement_signatures)(const void *this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures *msg);
2303 * Indicates a connection to the peer failed/an existing connection was lost. If no connection
2304 * is believed to be possible in the future (eg they're sending us messages we don't
2305 * understand or indicate they require unknown feature bits), no_connection_possible is set
2306 * and any outstanding channels should be failed.
2308 void (*peer_disconnected)(const void *this_arg, LDKPublicKey their_node_id, bool no_connection_possible);
2310 * Handle a peer reconnecting, possibly generating channel_reestablish message(s).
2312 void (*peer_connected)(const void *this_arg, LDKPublicKey their_node_id, const LDKInit *msg);
2314 * Handle an incoming channel_reestablish message from the given peer.
2316 void (*handle_channel_reestablish)(const void *this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish *msg);
2318 * Handle an incoming error message from the given peer.
2320 void (*handle_error)(const void *this_arg, LDKPublicKey their_node_id, const LDKErrorMessage *msg);
2321 LDKMessageSendEventsProvider MessageSendEventsProvider;
2322 void (*free)(void *this_arg);
2323 } LDKChannelMessageHandler;
2328 * Arguments for the creation of a ChannelManager that are not deserialized.
2330 * At a high-level, the process for deserializing a ChannelManager and resuming normal operation
2332 * 1) Deserialize all stored ChannelMonitors.
2333 * 2) Deserialize the ChannelManager by filling in this struct and calling <(Sha256dHash,
2334 * ChannelManager)>::read(reader, args).
2335 * This may result in closing some Channels if the ChannelMonitor is newer than the stored
2336 * ChannelManager state to ensure no loss of funds. Thus, transactions may be broadcasted.
2337 * 3) Register all relevant ChannelMonitor outpoints with your chain watch mechanism using
2338 * ChannelMonitor::get_outputs_to_watch() and ChannelMonitor::get_funding_txo().
2339 * 4) Reconnect blocks on your ChannelMonitors.
2340 * 5) Move the ChannelMonitors into your local chain::Watch.
2341 * 6) Disconnect/connect blocks on the ChannelManager.
2343 typedef struct MUST_USE_STRUCT LDKChannelManagerReadArgs {
2345 * Nearly everyhwere, inner must be non-null, however in places where
2346 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2348 LDKnativeChannelManagerReadArgs *inner;
2350 } LDKChannelManagerReadArgs;
2352 typedef struct LDKCVecTempl_ChannelMonitor {
2353 LDKChannelMonitor *data;
2355 } LDKCVecTempl_ChannelMonitor;
2357 typedef LDKCVecTempl_ChannelMonitor LDKCVec_ChannelMonitorZ;
2362 * An error in decoding a message or struct.
2364 typedef struct MUST_USE_STRUCT LDKDecodeError {
2366 * Nearly everyhwere, inner must be non-null, however in places where
2367 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2369 LDKnativeDecodeError *inner;
2376 * A ping message to be sent or received from a peer
2378 typedef struct MUST_USE_STRUCT LDKPing {
2380 * Nearly everyhwere, inner must be non-null, however in places where
2381 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2383 LDKnativePing *inner;
2390 * A pong message to be sent or received from a peer
2392 typedef struct MUST_USE_STRUCT LDKPong {
2394 * Nearly everyhwere, inner must be non-null, however in places where
2395 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2397 LDKnativePong *inner;
2404 * Proof that the sender knows the per-commitment secret of the previous commitment transaction.
2405 * This is used to convince the recipient that the channel is at a certain commitment
2406 * number even if they lost that data due to a local failure. Of course, the peer may lie
2407 * and even later commitments may have been revoked.
2409 typedef struct MUST_USE_STRUCT LDKDataLossProtect {
2411 * Nearly everyhwere, inner must be non-null, however in places where
2412 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2414 LDKnativeDataLossProtect *inner;
2416 } LDKDataLossProtect;
2421 * The unsigned part of a node_announcement
2423 typedef struct MUST_USE_STRUCT LDKUnsignedNodeAnnouncement {
2425 * Nearly everyhwere, inner must be non-null, however in places where
2426 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2428 LDKnativeUnsignedNodeAnnouncement *inner;
2430 } LDKUnsignedNodeAnnouncement;
2435 * Features used within a `node_announcement` message.
2437 typedef struct MUST_USE_STRUCT LDKNodeFeatures {
2439 * Nearly everyhwere, inner must be non-null, however in places where
2440 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2442 LDKnativeNodeFeatures *inner;
2449 * Features used within a `channel_announcement` message.
2451 typedef struct MUST_USE_STRUCT LDKChannelFeatures {
2453 * Nearly everyhwere, inner must be non-null, however in places where
2454 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2456 LDKnativeChannelFeatures *inner;
2458 } LDKChannelFeatures;
2463 * The unsigned part of a channel_update
2465 typedef struct MUST_USE_STRUCT LDKUnsignedChannelUpdate {
2467 * Nearly everyhwere, inner must be non-null, however in places where
2468 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2470 LDKnativeUnsignedChannelUpdate *inner;
2472 } LDKUnsignedChannelUpdate;
2477 * A query_channel_range message is used to query a peer for channel
2478 * UTXOs in a range of blocks. The recipient of a query makes a best
2479 * effort to reply to the query using one or more reply_channel_range
2482 typedef struct MUST_USE_STRUCT LDKQueryChannelRange {
2484 * Nearly everyhwere, inner must be non-null, however in places where
2485 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2487 LDKnativeQueryChannelRange *inner;
2489 } LDKQueryChannelRange;
2494 * A reply_channel_range message is a reply to a query_channel_range
2495 * message. Multiple reply_channel_range messages can be sent in reply
2496 * to a single query_channel_range message. The query recipient makes a
2497 * best effort to respond based on their local network view which may
2498 * not be a perfect view of the network. The short_channel_ids in the
2499 * reply are encoded. We only support encoding_type=0 uncompressed
2500 * serialization and do not support encoding_type=1 zlib serialization.
2502 typedef struct MUST_USE_STRUCT LDKReplyChannelRange {
2504 * Nearly everyhwere, inner must be non-null, however in places where
2505 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2507 LDKnativeReplyChannelRange *inner;
2509 } LDKReplyChannelRange;
2511 typedef struct LDKCVecTempl_u64 {
2516 typedef LDKCVecTempl_u64 LDKCVec_u64Z;
2521 * A query_short_channel_ids message is used to query a peer for
2522 * routing gossip messages related to one or more short_channel_ids.
2523 * The query recipient will reply with the latest, if available,
2524 * channel_announcement, channel_update and node_announcement messages
2525 * it maintains for the requested short_channel_ids followed by a
2526 * reply_short_channel_ids_end message. The short_channel_ids sent in
2527 * this query are encoded. We only support encoding_type=0 uncompressed
2528 * serialization and do not support encoding_type=1 zlib serialization.
2530 typedef struct MUST_USE_STRUCT LDKQueryShortChannelIds {
2532 * Nearly everyhwere, inner must be non-null, however in places where
2533 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2535 LDKnativeQueryShortChannelIds *inner;
2537 } LDKQueryShortChannelIds;
2542 * A reply_short_channel_ids_end message is sent as a reply to a
2543 * query_short_channel_ids message. The query recipient makes a best
2544 * effort to respond based on their local network view which may not be
2545 * a perfect view of the network.
2547 typedef struct MUST_USE_STRUCT LDKReplyShortChannelIdsEnd {
2549 * Nearly everyhwere, inner must be non-null, however in places where
2550 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2552 LDKnativeReplyShortChannelIdsEnd *inner;
2554 } LDKReplyShortChannelIdsEnd;
2559 * A gossip_timestamp_filter message is used by a node to request
2560 * gossip relay for messages in the requested time range when the
2561 * gossip_queries feature has been negotiated.
2563 typedef struct MUST_USE_STRUCT LDKGossipTimestampFilter {
2565 * Nearly everyhwere, inner must be non-null, however in places where
2566 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2568 LDKnativeGossipTimestampFilter *inner;
2570 } LDKGossipTimestampFilter;
2575 * An Err type for failure to process messages.
2577 typedef struct MUST_USE_STRUCT LDKLightningError {
2579 * Nearly everyhwere, inner must be non-null, however in places where
2580 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2582 LDKnativeLightningError *inner;
2584 } LDKLightningError;
2586 typedef struct LDKCVecTempl_UpdateAddHTLC {
2587 LDKUpdateAddHTLC *data;
2589 } LDKCVecTempl_UpdateAddHTLC;
2591 typedef LDKCVecTempl_UpdateAddHTLC LDKCVec_UpdateAddHTLCZ;
2593 typedef struct LDKCVecTempl_UpdateFulfillHTLC {
2594 LDKUpdateFulfillHTLC *data;
2596 } LDKCVecTempl_UpdateFulfillHTLC;
2598 typedef LDKCVecTempl_UpdateFulfillHTLC LDKCVec_UpdateFulfillHTLCZ;
2600 typedef struct LDKCVecTempl_UpdateFailHTLC {
2601 LDKUpdateFailHTLC *data;
2603 } LDKCVecTempl_UpdateFailHTLC;
2605 typedef LDKCVecTempl_UpdateFailHTLC LDKCVec_UpdateFailHTLCZ;
2607 typedef struct LDKCVecTempl_UpdateFailMalformedHTLC {
2608 LDKUpdateFailMalformedHTLC *data;
2610 } LDKCVecTempl_UpdateFailMalformedHTLC;
2612 typedef LDKCVecTempl_UpdateFailMalformedHTLC LDKCVec_UpdateFailMalformedHTLCZ;
2614 typedef union LDKCResultPtr_bool__LightningError {
2616 LDKLightningError *err;
2617 } LDKCResultPtr_bool__LightningError;
2619 typedef struct LDKCResultTempl_bool__LightningError {
2620 LDKCResultPtr_bool__LightningError contents;
2622 } LDKCResultTempl_bool__LightningError;
2624 typedef LDKCResultTempl_bool__LightningError LDKCResult_boolLightningErrorZ;
2626 typedef struct LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate {
2627 LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate *data;
2629 } LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate;
2631 typedef LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ;
2633 typedef struct LDKCVecTempl_NodeAnnouncement {
2634 LDKNodeAnnouncement *data;
2636 } LDKCVecTempl_NodeAnnouncement;
2638 typedef LDKCVecTempl_NodeAnnouncement LDKCVec_NodeAnnouncementZ;
2641 * A trait to describe an object which can receive routing messages.
2643 typedef struct LDKRoutingMessageHandler {
2646 * Handle an incoming node_announcement message, returning true if it should be forwarded on,
2647 * false or returning an Err otherwise.
2649 LDKCResult_boolLightningErrorZ (*handle_node_announcement)(const void *this_arg, const LDKNodeAnnouncement *msg);
2651 * Handle a channel_announcement message, returning true if it should be forwarded on, false
2652 * or returning an Err otherwise.
2654 LDKCResult_boolLightningErrorZ (*handle_channel_announcement)(const void *this_arg, const LDKChannelAnnouncement *msg);
2656 * Handle an incoming channel_update message, returning true if it should be forwarded on,
2657 * false or returning an Err otherwise.
2659 LDKCResult_boolLightningErrorZ (*handle_channel_update)(const void *this_arg, const LDKChannelUpdate *msg);
2661 * Handle some updates to the route graph that we learned due to an outbound failed payment.
2663 void (*handle_htlc_fail_channel_update)(const void *this_arg, const LDKHTLCFailChannelUpdate *update);
2665 * Gets a subset of the channel announcements and updates required to dump our routing table
2666 * to a remote node, starting at the short_channel_id indicated by starting_point and
2667 * including the batch_amount entries immediately higher in numerical value than starting_point.
2669 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ (*get_next_channel_announcements)(const void *this_arg, uint64_t starting_point, uint8_t batch_amount);
2671 * Gets a subset of the node announcements required to dump our routing table to a remote node,
2672 * starting at the node *after* the provided publickey and including batch_amount entries
2673 * immediately higher (as defined by <PublicKey as Ord>::cmp) than starting_point.
2674 * If None is provided for starting_point, we start at the first node.
2676 LDKCVec_NodeAnnouncementZ (*get_next_node_announcements)(const void *this_arg, LDKPublicKey starting_point, uint8_t batch_amount);
2678 * Returns whether a full sync should be requested from a peer.
2680 bool (*should_request_full_sync)(const void *this_arg, LDKPublicKey node_id);
2681 void (*free)(void *this_arg);
2682 } LDKRoutingMessageHandler;
2687 * Provides references to trait impls which handle different types of messages.
2689 typedef struct MUST_USE_STRUCT LDKMessageHandler {
2691 * Nearly everyhwere, inner must be non-null, however in places where
2692 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2694 LDKnativeMessageHandler *inner;
2696 } LDKMessageHandler;
2699 * Provides an object which can be used to send data to and which uniquely identifies a connection
2700 * to a remote host. You will need to be able to generate multiple of these which meet Eq and
2701 * implement Hash to meet the PeerManager API.
2703 * For efficiency, Clone should be relatively cheap for this type.
2705 * You probably want to just extend an int and put a file descriptor in a struct and implement
2706 * send_data. Note that if you are using a higher-level net library that may call close() itself,
2707 * be careful to ensure you don't have races whereby you might register a new connection with an
2708 * fd which is the same as a previous one which has yet to be removed via
2709 * PeerManager::socket_disconnected().
2711 typedef struct LDKSocketDescriptor {
2714 * Attempts to send some data from the given slice to the peer.
2716 * Returns the amount of data which was sent, possibly 0 if the socket has since disconnected.
2717 * Note that in the disconnected case, socket_disconnected must still fire and further write
2718 * attempts may occur until that time.
2720 * If the returned size is smaller than data.len(), a write_available event must
2721 * trigger the next time more data can be written. Additionally, until the a send_data event
2722 * completes fully, no further read_events should trigger on the same peer!
2724 * If a read_event on this descriptor had previously returned true (indicating that read
2725 * events should be paused to prevent DoS in the send buffer), resume_read may be set
2726 * indicating that read events on this descriptor should resume. A resume_read of false does
2727 * *not* imply that further read events should be paused.
2729 uintptr_t (*send_data)(void *this_arg, LDKu8slice data, bool resume_read);
2731 * Disconnect the socket pointed to by this SocketDescriptor. Once this function returns, no
2732 * more calls to write_buffer_space_avail, read_event or socket_disconnected may be made with
2733 * this descriptor. No socket_disconnected call should be generated as a result of this call,
2734 * though races may occur whereby disconnect_socket is called after a call to
2735 * socket_disconnected but prior to socket_disconnected returning.
2737 void (*disconnect_socket)(void *this_arg);
2738 bool (*eq)(const void *this_arg, const void *other_arg);
2739 uint64_t (*hash)(const void *this_arg);
2740 void *(*clone)(const void *this_arg);
2741 void (*free)(void *this_arg);
2742 } LDKSocketDescriptor;
2747 * A PeerManager manages a set of peers, described by their SocketDescriptor and marshalls socket
2748 * events into messages which it passes on to its MessageHandlers.
2750 * Rather than using a plain PeerManager, it is preferable to use either a SimpleArcPeerManager
2751 * a SimpleRefPeerManager, for conciseness. See their documentation for more details, but
2752 * essentially you should default to using a SimpleRefPeerManager, and use a
2753 * SimpleArcPeerManager when you require a PeerManager with a static lifetime, such as when
2754 * you're using lightning-net-tokio.
2756 typedef struct MUST_USE_STRUCT LDKPeerManager {
2758 * Nearly everyhwere, inner must be non-null, however in places where
2759 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2761 LDKnativePeerManager *inner;
2765 typedef struct LDKCVecTempl_PublicKey {
2768 } LDKCVecTempl_PublicKey;
2770 typedef LDKCVecTempl_PublicKey LDKCVec_PublicKeyZ;
2772 typedef union LDKCResultPtr_CVecTempl_u8_____PeerHandleError {
2773 LDKCVecTempl_u8 *result;
2774 LDKPeerHandleError *err;
2775 } LDKCResultPtr_CVecTempl_u8_____PeerHandleError;
2777 typedef struct LDKCResultTempl_CVecTempl_u8_____PeerHandleError {
2778 LDKCResultPtr_CVecTempl_u8_____PeerHandleError contents;
2780 } LDKCResultTempl_CVecTempl_u8_____PeerHandleError;
2782 typedef LDKCResultTempl_CVecTempl_u8_____PeerHandleError LDKCResult_CVec_u8ZPeerHandleErrorZ;
2784 typedef union LDKCResultPtr_bool__PeerHandleError {
2786 LDKPeerHandleError *err;
2787 } LDKCResultPtr_bool__PeerHandleError;
2789 typedef struct LDKCResultTempl_bool__PeerHandleError {
2790 LDKCResultPtr_bool__PeerHandleError contents;
2792 } LDKCResultTempl_bool__PeerHandleError;
2794 typedef LDKCResultTempl_bool__PeerHandleError LDKCResult_boolPeerHandleErrorZ;
2796 typedef union LDKCResultPtr_SecretKey__Secp256k1Error {
2797 LDKSecretKey *result;
2798 LDKSecp256k1Error *err;
2799 } LDKCResultPtr_SecretKey__Secp256k1Error;
2801 typedef struct LDKCResultTempl_SecretKey__Secp256k1Error {
2802 LDKCResultPtr_SecretKey__Secp256k1Error contents;
2804 } LDKCResultTempl_SecretKey__Secp256k1Error;
2806 typedef LDKCResultTempl_SecretKey__Secp256k1Error LDKCResult_SecretKeySecpErrorZ;
2808 typedef union LDKCResultPtr_PublicKey__Secp256k1Error {
2809 LDKPublicKey *result;
2810 LDKSecp256k1Error *err;
2811 } LDKCResultPtr_PublicKey__Secp256k1Error;
2813 typedef struct LDKCResultTempl_PublicKey__Secp256k1Error {
2814 LDKCResultPtr_PublicKey__Secp256k1Error contents;
2816 } LDKCResultTempl_PublicKey__Secp256k1Error;
2818 typedef LDKCResultTempl_PublicKey__Secp256k1Error LDKCResult_PublicKeySecpErrorZ;
2823 * The set of public keys which are used in the creation of one commitment transaction.
2824 * These are derived from the channel base keys and per-commitment data.
2826 * A broadcaster key is provided from potential broadcaster of the computed transaction.
2827 * A countersignatory key is coming from a protocol participant unable to broadcast the
2830 * These keys are assumed to be good, either because the code derived them from
2831 * channel basepoints via the new function, or they were obtained via
2832 * PreCalculatedTxCreationKeys.trust_key_derivation because we trusted the source of the
2833 * pre-calculated keys.
2835 typedef struct MUST_USE_STRUCT LDKTxCreationKeys {
2837 * Nearly everyhwere, inner must be non-null, however in places where
2838 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2840 LDKnativeTxCreationKeys *inner;
2842 } LDKTxCreationKeys;
2844 typedef union LDKCResultPtr_TxCreationKeys__Secp256k1Error {
2845 LDKTxCreationKeys *result;
2846 LDKSecp256k1Error *err;
2847 } LDKCResultPtr_TxCreationKeys__Secp256k1Error;
2849 typedef struct LDKCResultTempl_TxCreationKeys__Secp256k1Error {
2850 LDKCResultPtr_TxCreationKeys__Secp256k1Error contents;
2852 } LDKCResultTempl_TxCreationKeys__Secp256k1Error;
2854 typedef LDKCResultTempl_TxCreationKeys__Secp256k1Error LDKCResult_TxCreationKeysSecpErrorZ;
2856 typedef struct LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature {
2857 LDKC2TupleTempl_HTLCOutputInCommitment__Signature *data;
2859 } LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature;
2861 typedef LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ;
2868 typedef struct MUST_USE_STRUCT LDKRouteHop {
2870 * Nearly everyhwere, inner must be non-null, however in places where
2871 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2873 LDKnativeRouteHop *inner;
2877 typedef struct LDKCVecTempl_RouteHop {
2880 } LDKCVecTempl_RouteHop;
2882 typedef struct LDKCVecTempl_CVecTempl_RouteHop {
2883 LDKCVecTempl_RouteHop *data;
2885 } LDKCVecTempl_CVecTempl_RouteHop;
2887 typedef LDKCVecTempl_CVecTempl_RouteHop LDKCVec_CVec_RouteHopZZ;
2892 * A channel descriptor which provides a last-hop route to get_route
2894 typedef struct MUST_USE_STRUCT LDKRouteHint {
2896 * Nearly everyhwere, inner must be non-null, however in places where
2897 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2899 LDKnativeRouteHint *inner;
2906 * Fees for routing via a given channel or a node
2908 typedef struct MUST_USE_STRUCT LDKRoutingFees {
2910 * Nearly everyhwere, inner must be non-null, however in places where
2911 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2913 LDKnativeRoutingFees *inner;
2917 typedef union LDKCResultPtr_Route__LightningError {
2919 LDKLightningError *err;
2920 } LDKCResultPtr_Route__LightningError;
2922 typedef struct LDKCResultTempl_Route__LightningError {
2923 LDKCResultPtr_Route__LightningError contents;
2925 } LDKCResultTempl_Route__LightningError;
2927 typedef LDKCResultTempl_Route__LightningError LDKCResult_RouteLightningErrorZ;
2932 * Represents the network as nodes and channels between them
2934 typedef struct MUST_USE_STRUCT LDKNetworkGraph {
2936 * Nearly everyhwere, inner must be non-null, however in places where
2937 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2939 LDKnativeNetworkGraph *inner;
2943 typedef struct LDKCVecTempl_RouteHint {
2946 } LDKCVecTempl_RouteHint;
2948 typedef LDKCVecTempl_RouteHint LDKCVec_RouteHintZ;
2953 * A simple newtype for RwLockReadGuard<'a, NetworkGraph>.
2954 * This exists only to make accessing a RwLock<NetworkGraph> possible from
2955 * the C bindings, as it can be done directly in Rust code.
2957 typedef struct MUST_USE_STRUCT LDKLockedNetworkGraph {
2959 * Nearly everyhwere, inner must be non-null, however in places where
2960 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2962 LDKnativeLockedNetworkGraph *inner;
2964 } LDKLockedNetworkGraph;
2969 * Receives and validates network updates from peers,
2970 * stores authentic and relevant data as a network graph.
2971 * This network graph is then used for routing payments.
2972 * Provides interface to help with initial routing sync by
2973 * serving historical announcements.
2975 typedef struct MUST_USE_STRUCT LDKNetGraphMsgHandler {
2977 * Nearly everyhwere, inner must be non-null, however in places where
2978 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2980 LDKnativeNetGraphMsgHandler *inner;
2982 } LDKNetGraphMsgHandler;
2987 * Details about one direction of a channel. Received
2988 * within a channel update.
2990 typedef struct MUST_USE_STRUCT LDKDirectionalChannelInfo {
2992 * Nearly everyhwere, inner must be non-null, however in places where
2993 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2995 LDKnativeDirectionalChannelInfo *inner;
2997 } LDKDirectionalChannelInfo;
3002 * Details about a channel (both directions).
3003 * Received within a channel announcement.
3005 typedef struct MUST_USE_STRUCT LDKChannelInfo {
3007 * Nearly everyhwere, inner must be non-null, however in places where
3008 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3010 LDKnativeChannelInfo *inner;
3017 * Information received in the latest node_announcement from this node.
3019 typedef struct MUST_USE_STRUCT LDKNodeAnnouncementInfo {
3021 * Nearly everyhwere, inner must be non-null, however in places where
3022 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3024 LDKnativeNodeAnnouncementInfo *inner;
3026 } LDKNodeAnnouncementInfo;
3031 * Details about a node in the network, known from the network announcement.
3033 typedef struct MUST_USE_STRUCT LDKNodeInfo {
3035 * Nearly everyhwere, inner must be non-null, however in places where
3036 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3038 LDKnativeNodeInfo *inner;
3042 typedef LDKCVecTempl_RouteHop LDKCVec_RouteHopZ;
3044 extern const void (*C2Tuple_HTLCOutputInCommitmentSignatureZ_free)(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ);
3046 extern const void (*C2Tuple_OutPointScriptZ_free)(LDKC2Tuple_OutPointScriptZ);
3048 extern const void (*C2Tuple_SignatureCVec_SignatureZZ_free)(LDKC2Tuple_SignatureCVec_SignatureZZ);
3050 extern const void (*C2Tuple_TxidCVec_TxOutZZ_free)(LDKC2Tuple_TxidCVec_TxOutZZ);
3052 extern const void (*C2Tuple_u64u64Z_free)(LDKC2Tuple_u64u64Z);
3054 extern const void (*C2Tuple_usizeTransactionZ_free)(LDKC2Tuple_usizeTransactionZ);
3056 extern const void (*C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free)(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ);
3058 extern const void (*CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free)(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ);
3060 extern const LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok)(LDKC2Tuple_SignatureCVec_SignatureZZ);
3062 extern const void (*CResult_CVec_SignatureZNoneZ_free)(LDKCResult_CVec_SignatureZNoneZ);
3064 extern const LDKCResult_CVec_SignatureZNoneZ (*CResult_CVec_SignatureZNoneZ_ok)(LDKCVec_SignatureZ);
3066 extern const LDKCResult_CVec_u8ZPeerHandleErrorZ (*CResult_CVec_u8ZPeerHandleErrorZ_err)(LDKPeerHandleError);
3068 extern const void (*CResult_CVec_u8ZPeerHandleErrorZ_free)(LDKCResult_CVec_u8ZPeerHandleErrorZ);
3070 extern const LDKCResult_CVec_u8ZPeerHandleErrorZ (*CResult_CVec_u8ZPeerHandleErrorZ_ok)(LDKCVec_u8Z);
3072 extern const LDKCResult_NoneAPIErrorZ (*CResult_NoneAPIErrorZ_err)(LDKAPIError);
3074 extern const void (*CResult_NoneAPIErrorZ_free)(LDKCResult_NoneAPIErrorZ);
3076 extern const LDKCResult_NoneChannelMonitorUpdateErrZ (*CResult_NoneChannelMonitorUpdateErrZ_err)(LDKChannelMonitorUpdateErr);
3078 extern const void (*CResult_NoneChannelMonitorUpdateErrZ_free)(LDKCResult_NoneChannelMonitorUpdateErrZ);
3080 extern const LDKCResult_NoneMonitorUpdateErrorZ (*CResult_NoneMonitorUpdateErrorZ_err)(LDKMonitorUpdateError);
3082 extern const void (*CResult_NoneMonitorUpdateErrorZ_free)(LDKCResult_NoneMonitorUpdateErrorZ);
3084 extern const LDKCResult_NonePaymentSendFailureZ (*CResult_NonePaymentSendFailureZ_err)(LDKPaymentSendFailure);
3086 extern const void (*CResult_NonePaymentSendFailureZ_free)(LDKCResult_NonePaymentSendFailureZ);
3088 extern const LDKCResult_NonePeerHandleErrorZ (*CResult_NonePeerHandleErrorZ_err)(LDKPeerHandleError);
3090 extern const void (*CResult_NonePeerHandleErrorZ_free)(LDKCResult_NonePeerHandleErrorZ);
3092 extern const LDKCResult_PublicKeySecpErrorZ (*CResult_PublicKeySecpErrorZ_err)(LDKSecp256k1Error);
3094 extern const void (*CResult_PublicKeySecpErrorZ_free)(LDKCResult_PublicKeySecpErrorZ);
3096 extern const LDKCResult_PublicKeySecpErrorZ (*CResult_PublicKeySecpErrorZ_ok)(LDKPublicKey);
3098 extern const LDKCResult_RouteLightningErrorZ (*CResult_RouteLightningErrorZ_err)(LDKLightningError);
3100 extern const void (*CResult_RouteLightningErrorZ_free)(LDKCResult_RouteLightningErrorZ);
3102 extern const LDKCResult_RouteLightningErrorZ (*CResult_RouteLightningErrorZ_ok)(LDKRoute);
3104 extern const LDKCResult_SecretKeySecpErrorZ (*CResult_SecretKeySecpErrorZ_err)(LDKSecp256k1Error);
3106 extern const void (*CResult_SecretKeySecpErrorZ_free)(LDKCResult_SecretKeySecpErrorZ);
3108 extern const LDKCResult_SecretKeySecpErrorZ (*CResult_SecretKeySecpErrorZ_ok)(LDKSecretKey);
3110 extern const void (*CResult_SignatureNoneZ_free)(LDKCResult_SignatureNoneZ);
3112 extern const LDKCResult_SignatureNoneZ (*CResult_SignatureNoneZ_ok)(LDKSignature);
3114 extern const LDKCResult_TxCreationKeysSecpErrorZ (*CResult_TxCreationKeysSecpErrorZ_err)(LDKSecp256k1Error);
3116 extern const void (*CResult_TxCreationKeysSecpErrorZ_free)(LDKCResult_TxCreationKeysSecpErrorZ);
3118 extern const LDKCResult_TxCreationKeysSecpErrorZ (*CResult_TxCreationKeysSecpErrorZ_ok)(LDKTxCreationKeys);
3120 extern const LDKCResult_TxOutAccessErrorZ (*CResult_TxOutAccessErrorZ_err)(LDKAccessError);
3122 extern const void (*CResult_TxOutAccessErrorZ_free)(LDKCResult_TxOutAccessErrorZ);
3124 extern const LDKCResult_TxOutAccessErrorZ (*CResult_TxOutAccessErrorZ_ok)(LDKTxOut);
3126 extern const LDKCResult_boolLightningErrorZ (*CResult_boolLightningErrorZ_err)(LDKLightningError);
3128 extern const void (*CResult_boolLightningErrorZ_free)(LDKCResult_boolLightningErrorZ);
3130 extern const LDKCResult_boolLightningErrorZ (*CResult_boolLightningErrorZ_ok)(bool);
3132 extern const LDKCResult_boolPeerHandleErrorZ (*CResult_boolPeerHandleErrorZ_err)(LDKPeerHandleError);
3134 extern const void (*CResult_boolPeerHandleErrorZ_free)(LDKCResult_boolPeerHandleErrorZ);
3136 extern const LDKCResult_boolPeerHandleErrorZ (*CResult_boolPeerHandleErrorZ_ok)(bool);
3138 extern const void (*CVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ_free)(LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ);
3140 extern const void (*CVec_C2Tuple_TxidCVec_TxOutZZZ_free)(LDKCVec_C2Tuple_TxidCVec_TxOutZZZ);
3142 extern const void (*CVec_C2Tuple_usizeTransactionZZ_free)(LDKCVec_C2Tuple_usizeTransactionZZ);
3144 extern const void (*CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free)(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ);
3146 extern const void (*CVec_CVec_RouteHopZZ_free)(LDKCVec_CVec_RouteHopZZ);
3148 extern const void (*CVec_ChannelDetailsZ_free)(LDKCVec_ChannelDetailsZ);
3150 extern const void (*CVec_ChannelMonitorZ_free)(LDKCVec_ChannelMonitorZ);
3152 extern const void (*CVec_EventZ_free)(LDKCVec_EventZ);
3154 extern const void (*CVec_HTLCOutputInCommitmentZ_free)(LDKCVec_HTLCOutputInCommitmentZ);
3156 extern const void (*CVec_MessageSendEventZ_free)(LDKCVec_MessageSendEventZ);
3158 extern const void (*CVec_MonitorEventZ_free)(LDKCVec_MonitorEventZ);
3160 extern const void (*CVec_NetAddressZ_free)(LDKCVec_NetAddressZ);
3162 extern const void (*CVec_NodeAnnouncementZ_free)(LDKCVec_NodeAnnouncementZ);
3164 extern const void (*CVec_PublicKeyZ_free)(LDKCVec_PublicKeyZ);
3166 extern const void (*CVec_RouteHintZ_free)(LDKCVec_RouteHintZ);
3168 extern const void (*CVec_RouteHopZ_free)(LDKCVec_RouteHopZ);
3170 extern const void (*CVec_SignatureZ_free)(LDKCVec_SignatureZ);
3172 extern const void (*CVec_SpendableOutputDescriptorZ_free)(LDKCVec_SpendableOutputDescriptorZ);
3174 extern const void (*CVec_TransactionZ_free)(LDKCVec_TransactionZ);
3176 extern const void (*CVec_TxOutZ_free)(LDKCVec_TxOutZ);
3178 extern const void (*CVec_UpdateAddHTLCZ_free)(LDKCVec_UpdateAddHTLCZ);
3180 extern const void (*CVec_UpdateFailHTLCZ_free)(LDKCVec_UpdateFailHTLCZ);
3182 extern const void (*CVec_UpdateFailMalformedHTLCZ_free)(LDKCVec_UpdateFailMalformedHTLCZ);
3184 extern const void (*CVec_UpdateFulfillHTLCZ_free)(LDKCVec_UpdateFulfillHTLCZ);
3186 extern const void (*CVec_u64Z_free)(LDKCVec_u64Z);
3188 extern const void (*CVec_u8Z_free)(LDKCVec_u8Z);
3190 extern const uint64_t MIN_RELAY_FEE_SAT_PER_1000_WEIGHT;
3192 void Transaction_free(LDKTransaction _res);
3194 void TxOut_free(LDKTxOut _res);
3196 LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_new(uintptr_t a, LDKTransaction b);
3198 LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_ok(void);
3200 LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_ok(void);
3202 LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_new(LDKOutPoint a, LDKCVec_u8Z b);
3204 LDKC2Tuple_TxidCVec_TxOutZZ C2Tuple_TxidCVec_TxOutZZ_new(LDKThirtyTwoBytes a, LDKCVec_TxOutZ b);
3206 LDKC2Tuple_u64u64Z C2Tuple_u64u64Z_new(uint64_t a, uint64_t b);
3208 LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_new(LDKSignature a, LDKCVec_SignatureZ b);
3210 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err(void);
3212 LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_err(void);
3214 LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_err(void);
3216 LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_ok(void);
3218 LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_ok(void);
3220 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(LDKChannelAnnouncement a, LDKChannelUpdate b, LDKChannelUpdate c);
3222 LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_ok(void);
3224 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ C2Tuple_HTLCOutputInCommitmentSignatureZ_new(LDKHTLCOutputInCommitment a, LDKSignature b);
3226 void Event_free(LDKEvent this_ptr);
3228 void MessageSendEvent_free(LDKMessageSendEvent this_ptr);
3231 * Calls the free function if one is set
3233 void MessageSendEventsProvider_free(LDKMessageSendEventsProvider this_ptr);
3236 * Calls the free function if one is set
3238 void EventsProvider_free(LDKEventsProvider this_ptr);
3240 void APIError_free(LDKAPIError this_ptr);
3243 * Returns the most verbose logging level.
3245 MUST_USE_RES LDKLevel Level_max(void);
3248 * Calls the free function if one is set
3250 void Logger_free(LDKLogger this_ptr);
3252 void ChannelHandshakeConfig_free(LDKChannelHandshakeConfig this_ptr);
3255 * Confirmations we will wait for before considering the channel locked in.
3256 * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
3257 * equivalent limit applied to outbound channels).
3261 uint32_t ChannelHandshakeConfig_get_minimum_depth(const LDKChannelHandshakeConfig *this_ptr);
3264 * Confirmations we will wait for before considering the channel locked in.
3265 * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
3266 * equivalent limit applied to outbound channels).
3270 void ChannelHandshakeConfig_set_minimum_depth(LDKChannelHandshakeConfig *this_ptr, uint32_t val);
3273 * Set to the amount of time we require our counterparty to wait to claim their money.
3275 * It's one of the main parameter of our security model. We (or one of our watchtowers) MUST
3276 * be online to check for peer having broadcast a revoked transaction to steal our funds
3277 * at least once every our_to_self_delay blocks.
3279 * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
3280 * case of an honest unilateral channel close, which implicitly decrease the economic value of
3283 * Default value: BREAKDOWN_TIMEOUT (currently 144), we enforce it as a minimum at channel
3284 * opening so you can tweak config to ask for more security, not less.
3286 uint16_t ChannelHandshakeConfig_get_our_to_self_delay(const LDKChannelHandshakeConfig *this_ptr);
3289 * Set to the amount of time we require our counterparty to wait to claim their money.
3291 * It's one of the main parameter of our security model. We (or one of our watchtowers) MUST
3292 * be online to check for peer having broadcast a revoked transaction to steal our funds
3293 * at least once every our_to_self_delay blocks.
3295 * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
3296 * case of an honest unilateral channel close, which implicitly decrease the economic value of
3299 * Default value: BREAKDOWN_TIMEOUT (currently 144), we enforce it as a minimum at channel
3300 * opening so you can tweak config to ask for more security, not less.
3302 void ChannelHandshakeConfig_set_our_to_self_delay(LDKChannelHandshakeConfig *this_ptr, uint16_t val);
3305 * Set to the smallest value HTLC we will accept to process.
3307 * This value is sent to our counterparty on channel-open and we close the channel any time
3308 * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
3310 * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
3313 uint64_t ChannelHandshakeConfig_get_our_htlc_minimum_msat(const LDKChannelHandshakeConfig *this_ptr);
3316 * Set to the smallest value HTLC we will accept to process.
3318 * This value is sent to our counterparty on channel-open and we close the channel any time
3319 * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
3321 * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
3324 void ChannelHandshakeConfig_set_our_htlc_minimum_msat(LDKChannelHandshakeConfig *this_ptr, uint64_t val);
3326 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);
3328 MUST_USE_RES LDKChannelHandshakeConfig ChannelHandshakeConfig_default(void);
3330 void ChannelHandshakeLimits_free(LDKChannelHandshakeLimits this_ptr);
3333 * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
3334 * only applies to inbound channels.
3338 uint64_t ChannelHandshakeLimits_get_min_funding_satoshis(const LDKChannelHandshakeLimits *this_ptr);
3341 * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
3342 * only applies to inbound channels.
3346 void ChannelHandshakeLimits_set_min_funding_satoshis(LDKChannelHandshakeLimits *this_ptr, uint64_t val);
3349 * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
3350 * you to limit the maximum minimum-size they can require.
3352 * Default value: u64::max_value.
3354 uint64_t ChannelHandshakeLimits_get_max_htlc_minimum_msat(const LDKChannelHandshakeLimits *this_ptr);
3357 * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
3358 * you to limit the maximum minimum-size they can require.
3360 * Default value: u64::max_value.
3362 void ChannelHandshakeLimits_set_max_htlc_minimum_msat(LDKChannelHandshakeLimits *this_ptr, uint64_t val);
3365 * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
3366 * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
3370 uint64_t ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(const LDKChannelHandshakeLimits *this_ptr);
3373 * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
3374 * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
3378 void ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(LDKChannelHandshakeLimits *this_ptr, uint64_t val);
3381 * The remote node will require we keep a certain amount in direct payment to ourselves at all
3382 * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
3383 * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
3385 * Default value: u64::max_value.
3387 uint64_t ChannelHandshakeLimits_get_max_channel_reserve_satoshis(const LDKChannelHandshakeLimits *this_ptr);
3390 * The remote node will require we keep a certain amount in direct payment to ourselves at all
3391 * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
3392 * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
3394 * Default value: u64::max_value.
3396 void ChannelHandshakeLimits_set_max_channel_reserve_satoshis(LDKChannelHandshakeLimits *this_ptr, uint64_t val);
3399 * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
3400 * time. This allows you to set a minimum such value.
3404 uint16_t ChannelHandshakeLimits_get_min_max_accepted_htlcs(const LDKChannelHandshakeLimits *this_ptr);
3407 * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
3408 * time. This allows you to set a minimum such value.
3412 void ChannelHandshakeLimits_set_min_max_accepted_htlcs(LDKChannelHandshakeLimits *this_ptr, uint16_t val);
3415 * Outputs below a certain value will not be added to on-chain transactions. The dust value is
3416 * required to always be higher than this value so this only applies to HTLC outputs (and
3417 * potentially to-self outputs before any payments have been made).
3418 * Thus, HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
3419 * This setting allows you to set a minimum dust limit for their commitment transactions,
3420 * reflecting the reality that tiny outputs are not considered standard transactions and will
3421 * not propagate through the Bitcoin network.
3423 * Default value: 546, the current dust limit on the Bitcoin network.
3425 uint64_t ChannelHandshakeLimits_get_min_dust_limit_satoshis(const LDKChannelHandshakeLimits *this_ptr);
3428 * Outputs below a certain value will not be added to on-chain transactions. The dust value is
3429 * required to always be higher than this value so this only applies to HTLC outputs (and
3430 * potentially to-self outputs before any payments have been made).
3431 * Thus, HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
3432 * This setting allows you to set a minimum dust limit for their commitment transactions,
3433 * reflecting the reality that tiny outputs are not considered standard transactions and will
3434 * not propagate through the Bitcoin network.
3436 * Default value: 546, the current dust limit on the Bitcoin network.
3438 void ChannelHandshakeLimits_set_min_dust_limit_satoshis(LDKChannelHandshakeLimits *this_ptr, uint64_t val);
3441 * Maximum allowed threshold above which outputs will not be generated in their commitment
3443 * HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
3445 * Default value: u64::max_value.
3447 uint64_t ChannelHandshakeLimits_get_max_dust_limit_satoshis(const LDKChannelHandshakeLimits *this_ptr);
3450 * Maximum allowed threshold above which outputs will not be generated in their commitment
3452 * HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
3454 * Default value: u64::max_value.
3456 void ChannelHandshakeLimits_set_max_dust_limit_satoshis(LDKChannelHandshakeLimits *this_ptr, uint64_t val);
3459 * Before a channel is usable the funding transaction will need to be confirmed by at least a
3460 * certain number of blocks, specified by the node which is not the funder (as the funder can
3461 * assume they aren't going to double-spend themselves).
3462 * This config allows you to set a limit on the maximum amount of time to wait.
3464 * Default value: 144, or roughly one day and only applies to outbound channels.
3466 uint32_t ChannelHandshakeLimits_get_max_minimum_depth(const LDKChannelHandshakeLimits *this_ptr);
3469 * Before a channel is usable the funding transaction will need to be confirmed by at least a
3470 * certain number of blocks, specified by the node which is not the funder (as the funder can
3471 * assume they aren't going to double-spend themselves).
3472 * This config allows you to set a limit on the maximum amount of time to wait.
3474 * Default value: 144, or roughly one day and only applies to outbound channels.
3476 void ChannelHandshakeLimits_set_max_minimum_depth(LDKChannelHandshakeLimits *this_ptr, uint32_t val);
3479 * Set to force the incoming channel to match our announced channel preference in
3482 * Default value: true, to make the default that no announced channels are possible (which is
3483 * appropriate for any nodes which are not online very reliably).
3485 bool ChannelHandshakeLimits_get_force_announced_channel_preference(const LDKChannelHandshakeLimits *this_ptr);
3488 * Set to force the incoming channel to match our announced channel preference in
3491 * Default value: true, to make the default that no announced channels are possible (which is
3492 * appropriate for any nodes which are not online very reliably).
3494 void ChannelHandshakeLimits_set_force_announced_channel_preference(LDKChannelHandshakeLimits *this_ptr, bool val);
3497 * Set to the amount of time we're willing to wait to claim money back to us.
3499 * Not checking this value would be a security issue, as our peer would be able to set it to
3500 * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
3502 * Default value: MAX_LOCAL_BREAKDOWN_TIMEOUT (1008), which we also enforce as a maximum value
3503 * so you can tweak config to reduce the loss of having useless locked funds (if your peer accepts)
3505 uint16_t ChannelHandshakeLimits_get_their_to_self_delay(const LDKChannelHandshakeLimits *this_ptr);
3508 * Set to the amount of time we're willing to wait to claim money back to us.
3510 * Not checking this value would be a security issue, as our peer would be able to set it to
3511 * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
3513 * Default value: MAX_LOCAL_BREAKDOWN_TIMEOUT (1008), which we also enforce as a maximum value
3514 * so you can tweak config to reduce the loss of having useless locked funds (if your peer accepts)
3516 void ChannelHandshakeLimits_set_their_to_self_delay(LDKChannelHandshakeLimits *this_ptr, uint16_t val);
3518 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);
3520 MUST_USE_RES LDKChannelHandshakeLimits ChannelHandshakeLimits_default(void);
3522 void ChannelConfig_free(LDKChannelConfig this_ptr);
3525 * Amount (in millionths of a satoshi) the channel will charge per transferred satoshi.
3526 * This may be allowed to change at runtime in a later update, however doing so must result in
3527 * update messages sent to notify all nodes of our updated relay fee.
3531 uint32_t ChannelConfig_get_fee_proportional_millionths(const LDKChannelConfig *this_ptr);
3534 * Amount (in millionths of a satoshi) the channel will charge per transferred satoshi.
3535 * This may be allowed to change at runtime in a later update, however doing so must result in
3536 * update messages sent to notify all nodes of our updated relay fee.
3540 void ChannelConfig_set_fee_proportional_millionths(LDKChannelConfig *this_ptr, uint32_t val);
3543 * Set to announce the channel publicly and notify all nodes that they can route via this
3546 * This should only be set to true for nodes which expect to be online reliably.
3548 * As the node which funds a channel picks this value this will only apply for new outbound
3549 * channels unless ChannelHandshakeLimits::force_announced_channel_preferences is set.
3551 * This cannot be changed after the initial channel handshake.
3553 * Default value: false.
3555 bool ChannelConfig_get_announced_channel(const LDKChannelConfig *this_ptr);
3558 * Set to announce the channel publicly and notify all nodes that they can route via this
3561 * This should only be set to true for nodes which expect to be online reliably.
3563 * As the node which funds a channel picks this value this will only apply for new outbound
3564 * channels unless ChannelHandshakeLimits::force_announced_channel_preferences is set.
3566 * This cannot be changed after the initial channel handshake.
3568 * Default value: false.
3570 void ChannelConfig_set_announced_channel(LDKChannelConfig *this_ptr, bool val);
3573 * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
3574 * supports it, they will then enforce the mutual-close output to us matches what we provided
3575 * at intialization, preventing us from closing to an alternate pubkey.
3577 * This is set to true by default to provide a slight increase in security, though ultimately
3578 * any attacker who is able to take control of a channel can just as easily send the funds via
3579 * lightning payments, so we never require that our counterparties support this option.
3581 * This cannot be changed after a channel has been initialized.
3583 * Default value: true.
3585 bool ChannelConfig_get_commit_upfront_shutdown_pubkey(const LDKChannelConfig *this_ptr);
3588 * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
3589 * supports it, they will then enforce the mutual-close output to us matches what we provided
3590 * at intialization, preventing us from closing to an alternate pubkey.
3592 * This is set to true by default to provide a slight increase in security, though ultimately
3593 * any attacker who is able to take control of a channel can just as easily send the funds via
3594 * lightning payments, so we never require that our counterparties support this option.
3596 * This cannot be changed after a channel has been initialized.
3598 * Default value: true.
3600 void ChannelConfig_set_commit_upfront_shutdown_pubkey(LDKChannelConfig *this_ptr, bool val);
3602 MUST_USE_RES LDKChannelConfig ChannelConfig_new(uint32_t fee_proportional_millionths_arg, bool announced_channel_arg, bool commit_upfront_shutdown_pubkey_arg);
3604 MUST_USE_RES LDKChannelConfig ChannelConfig_default(void);
3606 LDKCVec_u8Z ChannelConfig_write(const LDKChannelConfig *obj);
3608 LDKChannelConfig ChannelConfig_read(LDKu8slice ser);
3610 void UserConfig_free(LDKUserConfig this_ptr);
3613 * Channel config that we propose to our counterparty.
3615 LDKChannelHandshakeConfig UserConfig_get_own_channel_config(const LDKUserConfig *this_ptr);
3618 * Channel config that we propose to our counterparty.
3620 void UserConfig_set_own_channel_config(LDKUserConfig *this_ptr, LDKChannelHandshakeConfig val);
3623 * Limits applied to our counterparty's proposed channel config settings.
3625 LDKChannelHandshakeLimits UserConfig_get_peer_channel_config_limits(const LDKUserConfig *this_ptr);
3628 * Limits applied to our counterparty's proposed channel config settings.
3630 void UserConfig_set_peer_channel_config_limits(LDKUserConfig *this_ptr, LDKChannelHandshakeLimits val);
3633 * Channel config which affects behavior during channel lifetime.
3635 LDKChannelConfig UserConfig_get_channel_options(const LDKUserConfig *this_ptr);
3638 * Channel config which affects behavior during channel lifetime.
3640 void UserConfig_set_channel_options(LDKUserConfig *this_ptr, LDKChannelConfig val);
3642 MUST_USE_RES LDKUserConfig UserConfig_new(LDKChannelHandshakeConfig own_channel_config_arg, LDKChannelHandshakeLimits peer_channel_config_limits_arg, LDKChannelConfig channel_options_arg);
3644 MUST_USE_RES LDKUserConfig UserConfig_default(void);
3647 * Calls the free function if one is set
3649 void Access_free(LDKAccess this_ptr);
3652 * Calls the free function if one is set
3654 void Watch_free(LDKWatch this_ptr);
3657 * Calls the free function if one is set
3659 void Filter_free(LDKFilter this_ptr);
3662 * Calls the free function if one is set
3664 void BroadcasterInterface_free(LDKBroadcasterInterface this_ptr);
3667 * Calls the free function if one is set
3669 void FeeEstimator_free(LDKFeeEstimator this_ptr);
3671 void ChainMonitor_free(LDKChainMonitor this_ptr);
3674 * Dispatches to per-channel monitors, which are responsible for updating their on-chain view
3675 * of a channel and reacting accordingly based on transactions in the connected block. See
3676 * [`ChannelMonitor::block_connected`] for details. Any HTLCs that were resolved on chain will
3677 * be returned by [`chain::Watch::release_pending_monitor_events`].
3679 * Calls back to [`chain::Filter`] if any monitor indicated new outputs to watch. Subsequent
3680 * calls must not exclude any transactions matching the new outputs nor any in-block
3681 * descendants of such transactions. It is not necessary to re-fetch the block to obtain
3684 * [`ChannelMonitor::block_connected`]: ../channelmonitor/struct.ChannelMonitor.html#method.block_connected
3685 * [`chain::Watch::release_pending_monitor_events`]: ../trait.Watch.html#tymethod.release_pending_monitor_events
3686 * [`chain::Filter`]: ../trait.Filter.html
3688 void ChainMonitor_block_connected(const LDKChainMonitor *this_arg, const uint8_t (*header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height);
3691 * Dispatches to per-channel monitors, which are responsible for updating their on-chain view
3692 * of a channel based on the disconnected block. See [`ChannelMonitor::block_disconnected`] for
3695 * [`ChannelMonitor::block_disconnected`]: ../channelmonitor/struct.ChannelMonitor.html#method.block_disconnected
3697 void ChainMonitor_block_disconnected(const LDKChainMonitor *this_arg, const uint8_t (*header)[80], uint32_t disconnected_height);
3700 * Creates a new `ChainMonitor` used to watch on-chain activity pertaining to channels.
3702 * When an optional chain source implementing [`chain::Filter`] is provided, the chain monitor
3703 * will call back to it indicating transactions and outputs of interest. This allows clients to
3704 * pre-filter blocks or only fetch blocks matching a compact filter. Otherwise, clients may
3705 * always need to fetch full blocks absent another means for determining which blocks contain
3706 * transactions relevant to the watched channels.
3708 * [`chain::Filter`]: ../trait.Filter.html
3710 MUST_USE_RES LDKChainMonitor ChainMonitor_new(LDKFilter *chain_source, LDKBroadcasterInterface broadcaster, LDKLogger logger, LDKFeeEstimator feeest);
3712 LDKWatch ChainMonitor_as_Watch(const LDKChainMonitor *this_arg);
3714 LDKEventsProvider ChainMonitor_as_EventsProvider(const LDKChainMonitor *this_arg);
3716 void ChannelMonitorUpdate_free(LDKChannelMonitorUpdate this_ptr);
3719 * The sequence number of this update. Updates *must* be replayed in-order according to this
3720 * sequence number (and updates may panic if they are not). The update_id values are strictly
3721 * increasing and increase by one for each new update.
3723 * This sequence number is also used to track up to which points updates which returned
3724 * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
3725 * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
3727 uint64_t ChannelMonitorUpdate_get_update_id(const LDKChannelMonitorUpdate *this_ptr);
3730 * The sequence number of this update. Updates *must* be replayed in-order according to this
3731 * sequence number (and updates may panic if they are not). The update_id values are strictly
3732 * increasing and increase by one for each new update.
3734 * This sequence number is also used to track up to which points updates which returned
3735 * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
3736 * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
3738 void ChannelMonitorUpdate_set_update_id(LDKChannelMonitorUpdate *this_ptr, uint64_t val);
3740 LDKCVec_u8Z ChannelMonitorUpdate_write(const LDKChannelMonitorUpdate *obj);
3742 LDKChannelMonitorUpdate ChannelMonitorUpdate_read(LDKu8slice ser);
3744 void MonitorUpdateError_free(LDKMonitorUpdateError this_ptr);
3746 void MonitorEvent_free(LDKMonitorEvent this_ptr);
3748 void HTLCUpdate_free(LDKHTLCUpdate this_ptr);
3750 LDKCVec_u8Z HTLCUpdate_write(const LDKHTLCUpdate *obj);
3752 LDKHTLCUpdate HTLCUpdate_read(LDKu8slice ser);
3754 void ChannelMonitor_free(LDKChannelMonitor this_ptr);
3757 * Updates a ChannelMonitor on the basis of some new information provided by the Channel
3760 * panics if the given update is not the next update by update_id.
3762 MUST_USE_RES LDKCResult_NoneMonitorUpdateErrorZ ChannelMonitor_update_monitor(LDKChannelMonitor *this_arg, LDKChannelMonitorUpdate updates, const LDKBroadcasterInterface *broadcaster, const LDKLogger *logger);
3765 * Gets the update_id from the latest ChannelMonitorUpdate which was applied to this
3768 MUST_USE_RES uint64_t ChannelMonitor_get_latest_update_id(const LDKChannelMonitor *this_arg);
3771 * Gets the funding transaction outpoint of the channel this ChannelMonitor is monitoring for.
3773 MUST_USE_RES LDKC2Tuple_OutPointScriptZ ChannelMonitor_get_funding_txo(const LDKChannelMonitor *this_arg);
3776 * Get the list of HTLCs who's status has been updated on chain. This should be called by
3777 * ChannelManager via [`chain::Watch::release_pending_monitor_events`].
3779 * [`chain::Watch::release_pending_monitor_events`]: ../trait.Watch.html#tymethod.release_pending_monitor_events
3781 MUST_USE_RES LDKCVec_MonitorEventZ ChannelMonitor_get_and_clear_pending_monitor_events(LDKChannelMonitor *this_arg);
3784 * Gets the list of pending events which were generated by previous actions, clearing the list
3787 * This is called by ChainMonitor::get_and_clear_pending_events() and is equivalent to
3788 * EventsProvider::get_and_clear_pending_events() except that it requires &mut self as we do
3789 * no internal locking in ChannelMonitors.
3791 MUST_USE_RES LDKCVec_EventZ ChannelMonitor_get_and_clear_pending_events(LDKChannelMonitor *this_arg);
3794 * Used by ChannelManager deserialization to broadcast the latest holder state if its copy of
3795 * the Channel was out-of-date. You may use it to get a broadcastable holder toxic tx in case of
3796 * fallen-behind, i.e when receiving a channel_reestablish with a proof that our counterparty side knows
3797 * a higher revocation secret than the holder commitment number we are aware of. Broadcasting these
3798 * transactions are UNSAFE, as they allow counterparty side to punish you. Nevertheless you may want to
3799 * broadcast them if counterparty don't close channel with his higher commitment transaction after a
3800 * substantial amount of time (a month or even a year) to get back funds. Best may be to contact
3801 * out-of-band the other node operator to coordinate with him if option is available to you.
3802 * In any-case, choice is up to the user.
3804 MUST_USE_RES LDKCVec_TransactionZ ChannelMonitor_get_latest_holder_commitment_txn(LDKChannelMonitor *this_arg, const LDKLogger *logger);
3807 * Processes transactions in a newly connected block, which may result in any of the following:
3808 * - update the monitor's state against resolved HTLCs
3809 * - punish the counterparty in the case of seeing a revoked commitment transaction
3810 * - force close the channel and claim/timeout incoming/outgoing HTLCs if near expiration
3811 * - detect settled outputs for later spending
3812 * - schedule and bump any in-flight claims
3814 * Returns any new outputs to watch from `txdata`; after called, these are also included in
3815 * [`get_outputs_to_watch`].
3817 * [`get_outputs_to_watch`]: #method.get_outputs_to_watch
3819 MUST_USE_RES LDKCVec_C2Tuple_TxidCVec_TxOutZZZ 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);
3822 * Determines if the disconnected block contained any transactions of interest and updates
3825 void ChannelMonitor_block_disconnected(LDKChannelMonitor *this_arg, const uint8_t (*header)[80], uint32_t height, LDKBroadcasterInterface broadcaster, LDKFeeEstimator fee_estimator, LDKLogger logger);
3827 void OutPoint_free(LDKOutPoint this_ptr);
3830 * The referenced transaction's txid.
3832 const uint8_t (*OutPoint_get_txid(const LDKOutPoint *this_ptr))[32];
3835 * The referenced transaction's txid.
3837 void OutPoint_set_txid(LDKOutPoint *this_ptr, LDKThirtyTwoBytes val);
3840 * The index of the referenced output in its transaction's vout.
3842 uint16_t OutPoint_get_index(const LDKOutPoint *this_ptr);
3845 * The index of the referenced output in its transaction's vout.
3847 void OutPoint_set_index(LDKOutPoint *this_ptr, uint16_t val);
3849 MUST_USE_RES LDKOutPoint OutPoint_new(LDKThirtyTwoBytes txid_arg, uint16_t index_arg);
3852 * Convert an `OutPoint` to a lightning channel id.
3854 MUST_USE_RES LDKThirtyTwoBytes OutPoint_to_channel_id(const LDKOutPoint *this_arg);
3856 LDKCVec_u8Z OutPoint_write(const LDKOutPoint *obj);
3858 LDKOutPoint OutPoint_read(LDKu8slice ser);
3860 void SpendableOutputDescriptor_free(LDKSpendableOutputDescriptor this_ptr);
3863 * Calls the free function if one is set
3865 void ChannelKeys_free(LDKChannelKeys this_ptr);
3868 * Calls the free function if one is set
3870 void KeysInterface_free(LDKKeysInterface this_ptr);
3872 void InMemoryChannelKeys_free(LDKInMemoryChannelKeys this_ptr);
3875 * Private key of anchor tx
3877 const uint8_t (*InMemoryChannelKeys_get_funding_key(const LDKInMemoryChannelKeys *this_ptr))[32];
3880 * Private key of anchor tx
3882 void InMemoryChannelKeys_set_funding_key(LDKInMemoryChannelKeys *this_ptr, LDKSecretKey val);
3885 * Holder secret key for blinded revocation pubkey
3887 const uint8_t (*InMemoryChannelKeys_get_revocation_base_key(const LDKInMemoryChannelKeys *this_ptr))[32];
3890 * Holder secret key for blinded revocation pubkey
3892 void InMemoryChannelKeys_set_revocation_base_key(LDKInMemoryChannelKeys *this_ptr, LDKSecretKey val);
3895 * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
3897 const uint8_t (*InMemoryChannelKeys_get_payment_key(const LDKInMemoryChannelKeys *this_ptr))[32];
3900 * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
3902 void InMemoryChannelKeys_set_payment_key(LDKInMemoryChannelKeys *this_ptr, LDKSecretKey val);
3905 * Holder secret key used in HTLC tx
3907 const uint8_t (*InMemoryChannelKeys_get_delayed_payment_base_key(const LDKInMemoryChannelKeys *this_ptr))[32];
3910 * Holder secret key used in HTLC tx
3912 void InMemoryChannelKeys_set_delayed_payment_base_key(LDKInMemoryChannelKeys *this_ptr, LDKSecretKey val);
3915 * Holder htlc secret key used in commitment tx htlc outputs
3917 const uint8_t (*InMemoryChannelKeys_get_htlc_base_key(const LDKInMemoryChannelKeys *this_ptr))[32];
3920 * Holder htlc secret key used in commitment tx htlc outputs
3922 void InMemoryChannelKeys_set_htlc_base_key(LDKInMemoryChannelKeys *this_ptr, LDKSecretKey val);
3927 const uint8_t (*InMemoryChannelKeys_get_commitment_seed(const LDKInMemoryChannelKeys *this_ptr))[32];
3932 void InMemoryChannelKeys_set_commitment_seed(LDKInMemoryChannelKeys *this_ptr, LDKThirtyTwoBytes val);
3935 * Create a new InMemoryChannelKeys
3937 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);
3940 * Counterparty pubkeys.
3941 * Will panic if on_accept wasn't called.
3943 MUST_USE_RES LDKChannelPublicKeys InMemoryChannelKeys_counterparty_pubkeys(const LDKInMemoryChannelKeys *this_arg);
3946 * The contest_delay value specified by our counterparty and applied on holder-broadcastable
3947 * transactions, ie the amount of time that we have to wait to recover our funds if we
3948 * broadcast a transaction. You'll likely want to pass this to the
3949 * ln::chan_utils::build*_transaction functions when signing holder's transactions.
3950 * Will panic if on_accept wasn't called.
3952 MUST_USE_RES uint16_t InMemoryChannelKeys_counterparty_selected_contest_delay(const LDKInMemoryChannelKeys *this_arg);
3955 * The contest_delay value specified by us and applied on transactions broadcastable
3956 * by our counterparty, ie the amount of time that they have to wait to recover their funds
3957 * if they broadcast a transaction.
3958 * Will panic if on_accept wasn't called.
3960 MUST_USE_RES uint16_t InMemoryChannelKeys_holder_selected_contest_delay(const LDKInMemoryChannelKeys *this_arg);
3962 LDKChannelKeys InMemoryChannelKeys_as_ChannelKeys(const LDKInMemoryChannelKeys *this_arg);
3964 LDKCVec_u8Z InMemoryChannelKeys_write(const LDKInMemoryChannelKeys *obj);
3966 LDKInMemoryChannelKeys InMemoryChannelKeys_read(LDKu8slice ser);
3968 void KeysManager_free(LDKKeysManager this_ptr);
3971 * Constructs a KeysManager from a 32-byte seed. If the seed is in some way biased (eg your
3972 * CSRNG is busted) this may panic (but more importantly, you will possibly lose funds).
3973 * starting_time isn't strictly required to actually be a time, but it must absolutely,
3974 * without a doubt, be unique to this instance. ie if you start multiple times with the same
3975 * seed, starting_time must be unique to each run. Thus, the easiest way to achieve this is to
3976 * simply use the current time (with very high precision).
3978 * The seed MUST be backed up safely prior to use so that the keys can be re-created, however,
3979 * obviously, starting_time should be unique every time you reload the library - it is only
3980 * used to generate new ephemeral key data (which will be stored by the individual channel if
3983 * Note that the seed is required to recover certain on-chain funds independent of
3984 * ChannelMonitor data, though a current copy of ChannelMonitor data is also required for any
3985 * channel, and some on-chain during-closing funds.
3987 * Note that until the 0.1 release there is no guarantee of backward compatibility between
3988 * versions. Once the library is more fully supported, the docs will be updated to include a
3989 * detailed description of the guarantee.
3991 MUST_USE_RES LDKKeysManager KeysManager_new(const uint8_t (*seed)[32], LDKNetwork network, uint64_t starting_time_secs, uint32_t starting_time_nanos);
3994 * Derive an old set of ChannelKeys for per-channel secrets based on a key derivation
3996 * Key derivation parameters are accessible through a per-channel secrets
3997 * ChannelKeys::key_derivation_params and is provided inside DynamicOuputP2WSH in case of
3998 * onchain output detection for which a corresponding delayed_payment_key must be derived.
4000 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);
4002 LDKKeysInterface KeysManager_as_KeysInterface(const LDKKeysManager *this_arg);
4004 void ChannelManager_free(LDKChannelManager this_ptr);
4006 void ChannelDetails_free(LDKChannelDetails this_ptr);
4009 * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
4010 * thereafter this is the txid of the funding transaction xor the funding transaction output).
4011 * Note that this means this value is *not* persistent - it can change once during the
4012 * lifetime of the channel.
4014 const uint8_t (*ChannelDetails_get_channel_id(const LDKChannelDetails *this_ptr))[32];
4017 * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
4018 * thereafter this is the txid of the funding transaction xor the funding transaction output).
4019 * Note that this means this value is *not* persistent - it can change once during the
4020 * lifetime of the channel.
4022 void ChannelDetails_set_channel_id(LDKChannelDetails *this_ptr, LDKThirtyTwoBytes val);
4025 * The node_id of our counterparty
4027 LDKPublicKey ChannelDetails_get_remote_network_id(const LDKChannelDetails *this_ptr);
4030 * The node_id of our counterparty
4032 void ChannelDetails_set_remote_network_id(LDKChannelDetails *this_ptr, LDKPublicKey val);
4035 * The Features the channel counterparty provided upon last connection.
4036 * Useful for routing as it is the most up-to-date copy of the counterparty's features and
4037 * many routing-relevant features are present in the init context.
4039 LDKInitFeatures ChannelDetails_get_counterparty_features(const LDKChannelDetails *this_ptr);
4042 * The Features the channel counterparty provided upon last connection.
4043 * Useful for routing as it is the most up-to-date copy of the counterparty's features and
4044 * many routing-relevant features are present in the init context.
4046 void ChannelDetails_set_counterparty_features(LDKChannelDetails *this_ptr, LDKInitFeatures val);
4049 * The value, in satoshis, of this channel as appears in the funding output
4051 uint64_t ChannelDetails_get_channel_value_satoshis(const LDKChannelDetails *this_ptr);
4054 * The value, in satoshis, of this channel as appears in the funding output
4056 void ChannelDetails_set_channel_value_satoshis(LDKChannelDetails *this_ptr, uint64_t val);
4059 * The user_id passed in to create_channel, or 0 if the channel was inbound.
4061 uint64_t ChannelDetails_get_user_id(const LDKChannelDetails *this_ptr);
4064 * The user_id passed in to create_channel, or 0 if the channel was inbound.
4066 void ChannelDetails_set_user_id(LDKChannelDetails *this_ptr, uint64_t val);
4069 * The available outbound capacity for sending HTLCs to the remote peer. This does not include
4070 * any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
4071 * available for inclusion in new outbound HTLCs). This further does not include any pending
4072 * outgoing HTLCs which are awaiting some other resolution to be sent.
4074 uint64_t ChannelDetails_get_outbound_capacity_msat(const LDKChannelDetails *this_ptr);
4077 * The available outbound capacity for sending HTLCs to the remote peer. This does not include
4078 * any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
4079 * available for inclusion in new outbound HTLCs). This further does not include any pending
4080 * outgoing HTLCs which are awaiting some other resolution to be sent.
4082 void ChannelDetails_set_outbound_capacity_msat(LDKChannelDetails *this_ptr, uint64_t val);
4085 * The available inbound capacity for the remote peer to send HTLCs to us. This does not
4086 * include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
4087 * available for inclusion in new inbound HTLCs).
4088 * Note that there are some corner cases not fully handled here, so the actual available
4089 * inbound capacity may be slightly higher than this.
4091 uint64_t ChannelDetails_get_inbound_capacity_msat(const LDKChannelDetails *this_ptr);
4094 * The available inbound capacity for the remote peer to send HTLCs to us. This does not
4095 * include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
4096 * available for inclusion in new inbound HTLCs).
4097 * Note that there are some corner cases not fully handled here, so the actual available
4098 * inbound capacity may be slightly higher than this.
4100 void ChannelDetails_set_inbound_capacity_msat(LDKChannelDetails *this_ptr, uint64_t val);
4103 * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
4104 * the peer is connected, and (c) no monitor update failure is pending resolution.
4106 bool ChannelDetails_get_is_live(const LDKChannelDetails *this_ptr);
4109 * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
4110 * the peer is connected, and (c) no monitor update failure is pending resolution.
4112 void ChannelDetails_set_is_live(LDKChannelDetails *this_ptr, bool val);
4114 void PaymentSendFailure_free(LDKPaymentSendFailure this_ptr);
4117 * Constructs a new ChannelManager to hold several channels and route between them.
4119 * This is the main \"logic hub\" for all channel-related actions, and implements
4120 * ChannelMessageHandler.
4122 * Non-proportional fees are fixed according to our risk using the provided fee estimator.
4124 * panics if channel_value_satoshis is >= `MAX_FUNDING_SATOSHIS`!
4126 * Users must provide the current blockchain height from which to track onchain channel
4127 * funding outpoints and send payments with reliable timelocks.
4129 * Users need to notify the new ChannelManager when a new block is connected or
4130 * disconnected using its `block_connected` and `block_disconnected` methods.
4132 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);
4135 * Creates a new outbound channel to the given remote node and with the given value.
4137 * user_id will be provided back as user_channel_id in FundingGenerationReady and
4138 * FundingBroadcastSafe events to allow tracking of which events correspond with which
4139 * create_channel call. Note that user_channel_id defaults to 0 for inbound channels, so you
4140 * may wish to avoid using 0 for user_id here.
4142 * If successful, will generate a SendOpenChannel message event, so you should probably poll
4143 * PeerManager::process_events afterwards.
4145 * Raises APIError::APIMisuseError when channel_value_satoshis > 2**24 or push_msat is
4146 * greater than channel_value_satoshis * 1k or channel_value_satoshis is < 1000.
4148 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);
4151 * Gets the list of open channels, in random order. See ChannelDetail field documentation for
4154 MUST_USE_RES LDKCVec_ChannelDetailsZ ChannelManager_list_channels(const LDKChannelManager *this_arg);
4157 * Gets the list of usable channels, in random order. Useful as an argument to
4158 * get_route to ensure non-announced channels are used.
4160 * These are guaranteed to have their is_live value set to true, see the documentation for
4161 * ChannelDetails::is_live for more info on exactly what the criteria are.
4163 MUST_USE_RES LDKCVec_ChannelDetailsZ ChannelManager_list_usable_channels(const LDKChannelManager *this_arg);
4166 * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs
4167 * will be accepted on the given channel, and after additional timeout/the closing of all
4168 * pending HTLCs, the channel will be closed on chain.
4170 * May generate a SendShutdown message event on success, which should be relayed.
4172 MUST_USE_RES LDKCResult_NoneAPIErrorZ ChannelManager_close_channel(const LDKChannelManager *this_arg, const uint8_t (*channel_id)[32]);
4175 * Force closes a channel, immediately broadcasting the latest local commitment transaction to
4176 * the chain and rejecting new HTLCs on the given channel.
4178 void ChannelManager_force_close_channel(const LDKChannelManager *this_arg, const uint8_t (*channel_id)[32]);
4181 * Force close all channels, immediately broadcasting the latest local commitment transaction
4182 * for each to the chain and rejecting new HTLCs on each.
4184 void ChannelManager_force_close_all_channels(const LDKChannelManager *this_arg);
4187 * Sends a payment along a given route.
4189 * Value parameters are provided via the last hop in route, see documentation for RouteHop
4190 * fields for more info.
4192 * Note that if the payment_hash already exists elsewhere (eg you're sending a duplicative
4193 * payment), we don't do anything to stop you! We always try to ensure that if the provided
4194 * next hop knows the preimage to payment_hash they can claim an additional amount as
4195 * specified in the last hop in the route! Thus, you should probably do your own
4196 * payment_preimage tracking (which you should already be doing as they represent \"proof of
4197 * payment\") and prevent double-sends yourself.
4199 * May generate SendHTLCs message(s) event on success, which should be relayed.
4201 * Each path may have a different return value, and PaymentSendValue may return a Vec with
4202 * each entry matching the corresponding-index entry in the route paths, see
4203 * PaymentSendFailure for more info.
4205 * In general, a path may raise:
4206 * * APIError::RouteError when an invalid route or forwarding parameter (cltv_delta, fee,
4207 * node public key) is specified.
4208 * * APIError::ChannelUnavailable if the next-hop channel is not available for updates
4209 * (including due to previous monitor update failure or new permanent monitor update
4211 * * APIError::MonitorUpdateFailed if a new monitor update failure prevented sending the
4214 * Note that depending on the type of the PaymentSendFailure the HTLC may have been
4215 * irrevocably committed to on our end. In such a case, do NOT retry the payment with a
4216 * different route unless you intend to pay twice!
4218 * payment_secret is unrelated to payment_hash (or PaymentPreimage) and exists to authenticate
4219 * the sender to the recipient and prevent payment-probing (deanonymization) attacks. For
4220 * newer nodes, it will be provided to you in the invoice. If you do not have one, the Route
4221 * must not contain multiple paths as multi-path payments require a recipient-provided
4223 * If a payment_secret *is* provided, we assume that the invoice had the payment_secret feature
4224 * bit set (either as required or as available). If multiple paths are present in the Route,
4225 * we assume the invoice had the basic_mpp feature set.
4227 MUST_USE_RES LDKCResult_NonePaymentSendFailureZ ChannelManager_send_payment(const LDKChannelManager *this_arg, const LDKRoute *route, LDKThirtyTwoBytes payment_hash, LDKThirtyTwoBytes payment_secret);
4230 * Call this upon creation of a funding transaction for the given channel.
4232 * Note that ALL inputs in the transaction pointed to by funding_txo MUST spend SegWit outputs
4233 * or your counterparty can steal your funds!
4235 * Panics if a funding transaction has already been provided for this channel.
4237 * May panic if the funding_txo is duplicative with some other channel (note that this should
4238 * be trivially prevented by using unique funding transaction keys per-channel).
4240 void ChannelManager_funding_transaction_generated(const LDKChannelManager *this_arg, const uint8_t (*temporary_channel_id)[32], LDKOutPoint funding_txo);
4243 * Generates a signed node_announcement from the given arguments and creates a
4244 * BroadcastNodeAnnouncement event. Note that such messages will be ignored unless peers have
4245 * seen a channel_announcement from us (ie unless we have public channels open).
4247 * RGB is a node \"color\" and alias is a printable human-readable string to describe this node
4248 * to humans. They carry no in-protocol meaning.
4250 * addresses represent the set (possibly empty) of socket addresses on which this node accepts
4251 * incoming connections. These will be broadcast to the network, publicly tying these
4252 * addresses together. If you wish to preserve user privacy, addresses should likely contain
4253 * only Tor Onion addresses.
4255 * Panics if addresses is absurdly large (more than 500).
4257 void ChannelManager_broadcast_node_announcement(const LDKChannelManager *this_arg, LDKThreeBytes rgb, LDKThirtyTwoBytes alias, LDKCVec_NetAddressZ addresses);
4260 * Processes HTLCs which are pending waiting on random forward delay.
4262 * Should only really ever be called in response to a PendingHTLCsForwardable event.
4263 * Will likely generate further events.
4265 void ChannelManager_process_pending_htlc_forwards(const LDKChannelManager *this_arg);
4268 * If a peer is disconnected we mark any channels with that peer as 'disabled'.
4269 * After some time, if channels are still disabled we need to broadcast a ChannelUpdate
4270 * to inform the network about the uselessness of these channels.
4272 * This method handles all the details, and must be called roughly once per minute.
4274 void ChannelManager_timer_chan_freshness_every_min(const LDKChannelManager *this_arg);
4277 * Indicates that the preimage for payment_hash is unknown or the received amount is incorrect
4278 * after a PaymentReceived event, failing the HTLC back to its origin and freeing resources
4279 * along the path (including in our own channel on which we received it).
4280 * Returns false if no payment was found to fail backwards, true if the process of failing the
4281 * HTLC backwards has been started.
4283 MUST_USE_RES bool ChannelManager_fail_htlc_backwards(const LDKChannelManager *this_arg, const uint8_t (*payment_hash)[32], LDKThirtyTwoBytes payment_secret);
4286 * Provides a payment preimage in response to a PaymentReceived event, returning true and
4287 * generating message events for the net layer to claim the payment, if possible. Thus, you
4288 * should probably kick the net layer to go send messages if this returns true!
4290 * You must specify the expected amounts for this HTLC, and we will only claim HTLCs
4291 * available within a few percent of the expected amount. This is critical for several
4292 * reasons : a) it avoids providing senders with `proof-of-payment` (in the form of the
4293 * payment_preimage without having provided the full value and b) it avoids certain
4294 * privacy-breaking recipient-probing attacks which may reveal payment activity to
4295 * motivated attackers.
4297 * Note that the privacy concerns in (b) are not relevant in payments with a payment_secret
4298 * set. Thus, for such payments we will claim any payments which do not under-pay.
4300 * May panic if called except in response to a PaymentReceived event.
4302 MUST_USE_RES bool ChannelManager_claim_funds(const LDKChannelManager *this_arg, LDKThirtyTwoBytes payment_preimage, LDKThirtyTwoBytes payment_secret, uint64_t expected_amount);
4305 * Gets the node_id held by this ChannelManager
4307 MUST_USE_RES LDKPublicKey ChannelManager_get_our_node_id(const LDKChannelManager *this_arg);
4310 * Restores a single, given channel to normal operation after a
4311 * ChannelMonitorUpdateErr::TemporaryFailure was returned from a channel monitor update
4314 * All ChannelMonitor updates up to and including highest_applied_update_id must have been
4315 * fully committed in every copy of the given channels' ChannelMonitors.
4317 * Note that there is no effect to calling with a highest_applied_update_id other than the
4318 * current latest ChannelMonitorUpdate and one call to this function after multiple
4319 * ChannelMonitorUpdateErr::TemporaryFailures is fine. The highest_applied_update_id field
4320 * exists largely only to prevent races between this and concurrent update_monitor calls.
4322 * Thus, the anticipated use is, at a high level:
4323 * 1) You register a chain::Watch with this ChannelManager,
4324 * 2) it stores each update to disk, and begins updating any remote (eg watchtower) copies of
4325 * said ChannelMonitors as it can, returning ChannelMonitorUpdateErr::TemporaryFailures
4326 * any time it cannot do so instantly,
4327 * 3) update(s) are applied to each remote copy of a ChannelMonitor,
4328 * 4) once all remote copies are updated, you call this function with the update_id that
4329 * completed, and once it is the latest the Channel will be re-enabled.
4331 void ChannelManager_channel_monitor_updated(const LDKChannelManager *this_arg, const LDKOutPoint *funding_txo, uint64_t highest_applied_update_id);
4333 LDKMessageSendEventsProvider ChannelManager_as_MessageSendEventsProvider(const LDKChannelManager *this_arg);
4335 LDKEventsProvider ChannelManager_as_EventsProvider(const LDKChannelManager *this_arg);
4338 * Updates channel state based on transactions seen in a connected block.
4340 void ChannelManager_block_connected(const LDKChannelManager *this_arg, const uint8_t (*header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height);
4343 * Updates channel state based on a disconnected block.
4345 * If necessary, the channel may be force-closed without letting the counterparty participate
4348 void ChannelManager_block_disconnected(const LDKChannelManager *this_arg, const uint8_t (*header)[80]);
4350 LDKChannelMessageHandler ChannelManager_as_ChannelMessageHandler(const LDKChannelManager *this_arg);
4352 void ChannelManagerReadArgs_free(LDKChannelManagerReadArgs this_ptr);
4355 * The keys provider which will give us relevant keys. Some keys will be loaded during
4358 const LDKKeysInterface *ChannelManagerReadArgs_get_keys_manager(const LDKChannelManagerReadArgs *this_ptr);
4361 * The keys provider which will give us relevant keys. Some keys will be loaded during
4364 void ChannelManagerReadArgs_set_keys_manager(LDKChannelManagerReadArgs *this_ptr, LDKKeysInterface val);
4367 * The fee_estimator for use in the ChannelManager in the future.
4369 * No calls to the FeeEstimator will be made during deserialization.
4371 const LDKFeeEstimator *ChannelManagerReadArgs_get_fee_estimator(const LDKChannelManagerReadArgs *this_ptr);
4374 * The fee_estimator for use in the ChannelManager in the future.
4376 * No calls to the FeeEstimator will be made during deserialization.
4378 void ChannelManagerReadArgs_set_fee_estimator(LDKChannelManagerReadArgs *this_ptr, LDKFeeEstimator val);
4381 * The chain::Watch for use in the ChannelManager in the future.
4383 * No calls to the chain::Watch will be made during deserialization. It is assumed that
4384 * you have deserialized ChannelMonitors separately and will add them to your
4385 * chain::Watch after deserializing this ChannelManager.
4387 const LDKWatch *ChannelManagerReadArgs_get_chain_monitor(const LDKChannelManagerReadArgs *this_ptr);
4390 * The chain::Watch for use in the ChannelManager in the future.
4392 * No calls to the chain::Watch will be made during deserialization. It is assumed that
4393 * you have deserialized ChannelMonitors separately and will add them to your
4394 * chain::Watch after deserializing this ChannelManager.
4396 void ChannelManagerReadArgs_set_chain_monitor(LDKChannelManagerReadArgs *this_ptr, LDKWatch val);
4399 * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
4400 * used to broadcast the latest local commitment transactions of channels which must be
4401 * force-closed during deserialization.
4403 const LDKBroadcasterInterface *ChannelManagerReadArgs_get_tx_broadcaster(const LDKChannelManagerReadArgs *this_ptr);
4406 * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
4407 * used to broadcast the latest local commitment transactions of channels which must be
4408 * force-closed during deserialization.
4410 void ChannelManagerReadArgs_set_tx_broadcaster(LDKChannelManagerReadArgs *this_ptr, LDKBroadcasterInterface val);
4413 * The Logger for use in the ChannelManager and which may be used to log information during
4416 const LDKLogger *ChannelManagerReadArgs_get_logger(const LDKChannelManagerReadArgs *this_ptr);
4419 * The Logger for use in the ChannelManager and which may be used to log information during
4422 void ChannelManagerReadArgs_set_logger(LDKChannelManagerReadArgs *this_ptr, LDKLogger val);
4425 * Default settings used for new channels. Any existing channels will continue to use the
4426 * runtime settings which were stored when the ChannelManager was serialized.
4428 LDKUserConfig ChannelManagerReadArgs_get_default_config(const LDKChannelManagerReadArgs *this_ptr);
4431 * Default settings used for new channels. Any existing channels will continue to use the
4432 * runtime settings which were stored when the ChannelManager was serialized.
4434 void ChannelManagerReadArgs_set_default_config(LDKChannelManagerReadArgs *this_ptr, LDKUserConfig val);
4437 * Simple utility function to create a ChannelManagerReadArgs which creates the monitor
4438 * HashMap for you. This is primarily useful for C bindings where it is not practical to
4439 * populate a HashMap directly from C.
4441 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);
4443 void DecodeError_free(LDKDecodeError this_ptr);
4445 void Init_free(LDKInit this_ptr);
4447 void ErrorMessage_free(LDKErrorMessage this_ptr);
4450 * The channel ID involved in the error
4452 const uint8_t (*ErrorMessage_get_channel_id(const LDKErrorMessage *this_ptr))[32];
4455 * The channel ID involved in the error
4457 void ErrorMessage_set_channel_id(LDKErrorMessage *this_ptr, LDKThirtyTwoBytes val);
4460 * A possibly human-readable error description.
4461 * The string should be sanitized before it is used (e.g. emitted to logs
4462 * or printed to stdout). Otherwise, a well crafted error message may trigger a security
4463 * vulnerability in the terminal emulator or the logging subsystem.
4465 LDKStr ErrorMessage_get_data(const LDKErrorMessage *this_ptr);
4468 * A possibly human-readable error description.
4469 * The string should be sanitized before it is used (e.g. emitted to logs
4470 * or printed to stdout). Otherwise, a well crafted error message may trigger a security
4471 * vulnerability in the terminal emulator or the logging subsystem.
4473 void ErrorMessage_set_data(LDKErrorMessage *this_ptr, LDKCVec_u8Z val);
4475 MUST_USE_RES LDKErrorMessage ErrorMessage_new(LDKThirtyTwoBytes channel_id_arg, LDKCVec_u8Z data_arg);
4477 void Ping_free(LDKPing this_ptr);
4480 * The desired response length
4482 uint16_t Ping_get_ponglen(const LDKPing *this_ptr);
4485 * The desired response length
4487 void Ping_set_ponglen(LDKPing *this_ptr, uint16_t val);
4490 * The ping packet size.
4491 * This field is not sent on the wire. byteslen zeros are sent.
4493 uint16_t Ping_get_byteslen(const LDKPing *this_ptr);
4496 * The ping packet size.
4497 * This field is not sent on the wire. byteslen zeros are sent.
4499 void Ping_set_byteslen(LDKPing *this_ptr, uint16_t val);
4501 MUST_USE_RES LDKPing Ping_new(uint16_t ponglen_arg, uint16_t byteslen_arg);
4503 void Pong_free(LDKPong this_ptr);
4506 * The pong packet size.
4507 * This field is not sent on the wire. byteslen zeros are sent.
4509 uint16_t Pong_get_byteslen(const LDKPong *this_ptr);
4512 * The pong packet size.
4513 * This field is not sent on the wire. byteslen zeros are sent.
4515 void Pong_set_byteslen(LDKPong *this_ptr, uint16_t val);
4517 MUST_USE_RES LDKPong Pong_new(uint16_t byteslen_arg);
4519 void OpenChannel_free(LDKOpenChannel this_ptr);
4522 * The genesis hash of the blockchain where the channel is to be opened
4524 const uint8_t (*OpenChannel_get_chain_hash(const LDKOpenChannel *this_ptr))[32];
4527 * The genesis hash of the blockchain where the channel is to be opened
4529 void OpenChannel_set_chain_hash(LDKOpenChannel *this_ptr, LDKThirtyTwoBytes val);
4532 * A temporary channel ID, until the funding outpoint is announced
4534 const uint8_t (*OpenChannel_get_temporary_channel_id(const LDKOpenChannel *this_ptr))[32];
4537 * A temporary channel ID, until the funding outpoint is announced
4539 void OpenChannel_set_temporary_channel_id(LDKOpenChannel *this_ptr, LDKThirtyTwoBytes val);
4544 uint64_t OpenChannel_get_funding_satoshis(const LDKOpenChannel *this_ptr);
4549 void OpenChannel_set_funding_satoshis(LDKOpenChannel *this_ptr, uint64_t val);
4552 * The amount to push to the counterparty as part of the open, in milli-satoshi
4554 uint64_t OpenChannel_get_push_msat(const LDKOpenChannel *this_ptr);
4557 * The amount to push to the counterparty as part of the open, in milli-satoshi
4559 void OpenChannel_set_push_msat(LDKOpenChannel *this_ptr, uint64_t val);
4562 * The threshold below which outputs on transactions broadcast by sender will be omitted
4564 uint64_t OpenChannel_get_dust_limit_satoshis(const LDKOpenChannel *this_ptr);
4567 * The threshold below which outputs on transactions broadcast by sender will be omitted
4569 void OpenChannel_set_dust_limit_satoshis(LDKOpenChannel *this_ptr, uint64_t val);
4572 * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
4574 uint64_t OpenChannel_get_max_htlc_value_in_flight_msat(const LDKOpenChannel *this_ptr);
4577 * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
4579 void OpenChannel_set_max_htlc_value_in_flight_msat(LDKOpenChannel *this_ptr, uint64_t val);
4582 * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
4584 uint64_t OpenChannel_get_channel_reserve_satoshis(const LDKOpenChannel *this_ptr);
4587 * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
4589 void OpenChannel_set_channel_reserve_satoshis(LDKOpenChannel *this_ptr, uint64_t val);
4592 * The minimum HTLC size incoming to sender, in milli-satoshi
4594 uint64_t OpenChannel_get_htlc_minimum_msat(const LDKOpenChannel *this_ptr);
4597 * The minimum HTLC size incoming to sender, in milli-satoshi
4599 void OpenChannel_set_htlc_minimum_msat(LDKOpenChannel *this_ptr, uint64_t val);
4602 * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
4604 uint32_t OpenChannel_get_feerate_per_kw(const LDKOpenChannel *this_ptr);
4607 * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
4609 void OpenChannel_set_feerate_per_kw(LDKOpenChannel *this_ptr, uint32_t val);
4612 * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
4614 uint16_t OpenChannel_get_to_self_delay(const LDKOpenChannel *this_ptr);
4617 * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
4619 void OpenChannel_set_to_self_delay(LDKOpenChannel *this_ptr, uint16_t val);
4622 * The maximum number of inbound HTLCs towards sender
4624 uint16_t OpenChannel_get_max_accepted_htlcs(const LDKOpenChannel *this_ptr);
4627 * The maximum number of inbound HTLCs towards sender
4629 void OpenChannel_set_max_accepted_htlcs(LDKOpenChannel *this_ptr, uint16_t val);
4632 * The sender's key controlling the funding transaction
4634 LDKPublicKey OpenChannel_get_funding_pubkey(const LDKOpenChannel *this_ptr);
4637 * The sender's key controlling the funding transaction
4639 void OpenChannel_set_funding_pubkey(LDKOpenChannel *this_ptr, LDKPublicKey val);
4642 * Used to derive a revocation key for transactions broadcast by counterparty
4644 LDKPublicKey OpenChannel_get_revocation_basepoint(const LDKOpenChannel *this_ptr);
4647 * Used to derive a revocation key for transactions broadcast by counterparty
4649 void OpenChannel_set_revocation_basepoint(LDKOpenChannel *this_ptr, LDKPublicKey val);
4652 * A payment key to sender for transactions broadcast by counterparty
4654 LDKPublicKey OpenChannel_get_payment_point(const LDKOpenChannel *this_ptr);
4657 * A payment key to sender for transactions broadcast by counterparty
4659 void OpenChannel_set_payment_point(LDKOpenChannel *this_ptr, LDKPublicKey val);
4662 * Used to derive a payment key to sender for transactions broadcast by sender
4664 LDKPublicKey OpenChannel_get_delayed_payment_basepoint(const LDKOpenChannel *this_ptr);
4667 * Used to derive a payment key to sender for transactions broadcast by sender
4669 void OpenChannel_set_delayed_payment_basepoint(LDKOpenChannel *this_ptr, LDKPublicKey val);
4672 * Used to derive an HTLC payment key to sender
4674 LDKPublicKey OpenChannel_get_htlc_basepoint(const LDKOpenChannel *this_ptr);
4677 * Used to derive an HTLC payment key to sender
4679 void OpenChannel_set_htlc_basepoint(LDKOpenChannel *this_ptr, LDKPublicKey val);
4682 * The first to-be-broadcast-by-sender transaction's per commitment point
4684 LDKPublicKey OpenChannel_get_first_per_commitment_point(const LDKOpenChannel *this_ptr);
4687 * The first to-be-broadcast-by-sender transaction's per commitment point
4689 void OpenChannel_set_first_per_commitment_point(LDKOpenChannel *this_ptr, LDKPublicKey val);
4694 uint8_t OpenChannel_get_channel_flags(const LDKOpenChannel *this_ptr);
4699 void OpenChannel_set_channel_flags(LDKOpenChannel *this_ptr, uint8_t val);
4701 void AcceptChannel_free(LDKAcceptChannel this_ptr);
4704 * A temporary channel ID, until the funding outpoint is announced
4706 const uint8_t (*AcceptChannel_get_temporary_channel_id(const LDKAcceptChannel *this_ptr))[32];
4709 * A temporary channel ID, until the funding outpoint is announced
4711 void AcceptChannel_set_temporary_channel_id(LDKAcceptChannel *this_ptr, LDKThirtyTwoBytes val);
4714 * The threshold below which outputs on transactions broadcast by sender will be omitted
4716 uint64_t AcceptChannel_get_dust_limit_satoshis(const LDKAcceptChannel *this_ptr);
4719 * The threshold below which outputs on transactions broadcast by sender will be omitted
4721 void AcceptChannel_set_dust_limit_satoshis(LDKAcceptChannel *this_ptr, uint64_t val);
4724 * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
4726 uint64_t AcceptChannel_get_max_htlc_value_in_flight_msat(const LDKAcceptChannel *this_ptr);
4729 * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
4731 void AcceptChannel_set_max_htlc_value_in_flight_msat(LDKAcceptChannel *this_ptr, uint64_t val);
4734 * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
4736 uint64_t AcceptChannel_get_channel_reserve_satoshis(const LDKAcceptChannel *this_ptr);
4739 * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
4741 void AcceptChannel_set_channel_reserve_satoshis(LDKAcceptChannel *this_ptr, uint64_t val);
4744 * The minimum HTLC size incoming to sender, in milli-satoshi
4746 uint64_t AcceptChannel_get_htlc_minimum_msat(const LDKAcceptChannel *this_ptr);
4749 * The minimum HTLC size incoming to sender, in milli-satoshi
4751 void AcceptChannel_set_htlc_minimum_msat(LDKAcceptChannel *this_ptr, uint64_t val);
4754 * Minimum depth of the funding transaction before the channel is considered open
4756 uint32_t AcceptChannel_get_minimum_depth(const LDKAcceptChannel *this_ptr);
4759 * Minimum depth of the funding transaction before the channel is considered open
4761 void AcceptChannel_set_minimum_depth(LDKAcceptChannel *this_ptr, uint32_t val);
4764 * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
4766 uint16_t AcceptChannel_get_to_self_delay(const LDKAcceptChannel *this_ptr);
4769 * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
4771 void AcceptChannel_set_to_self_delay(LDKAcceptChannel *this_ptr, uint16_t val);
4774 * The maximum number of inbound HTLCs towards sender
4776 uint16_t AcceptChannel_get_max_accepted_htlcs(const LDKAcceptChannel *this_ptr);
4779 * The maximum number of inbound HTLCs towards sender
4781 void AcceptChannel_set_max_accepted_htlcs(LDKAcceptChannel *this_ptr, uint16_t val);
4784 * The sender's key controlling the funding transaction
4786 LDKPublicKey AcceptChannel_get_funding_pubkey(const LDKAcceptChannel *this_ptr);
4789 * The sender's key controlling the funding transaction
4791 void AcceptChannel_set_funding_pubkey(LDKAcceptChannel *this_ptr, LDKPublicKey val);
4794 * Used to derive a revocation key for transactions broadcast by counterparty
4796 LDKPublicKey AcceptChannel_get_revocation_basepoint(const LDKAcceptChannel *this_ptr);
4799 * Used to derive a revocation key for transactions broadcast by counterparty
4801 void AcceptChannel_set_revocation_basepoint(LDKAcceptChannel *this_ptr, LDKPublicKey val);
4804 * A payment key to sender for transactions broadcast by counterparty
4806 LDKPublicKey AcceptChannel_get_payment_point(const LDKAcceptChannel *this_ptr);
4809 * A payment key to sender for transactions broadcast by counterparty
4811 void AcceptChannel_set_payment_point(LDKAcceptChannel *this_ptr, LDKPublicKey val);
4814 * Used to derive a payment key to sender for transactions broadcast by sender
4816 LDKPublicKey AcceptChannel_get_delayed_payment_basepoint(const LDKAcceptChannel *this_ptr);
4819 * Used to derive a payment key to sender for transactions broadcast by sender
4821 void AcceptChannel_set_delayed_payment_basepoint(LDKAcceptChannel *this_ptr, LDKPublicKey val);
4824 * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
4826 LDKPublicKey AcceptChannel_get_htlc_basepoint(const LDKAcceptChannel *this_ptr);
4829 * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
4831 void AcceptChannel_set_htlc_basepoint(LDKAcceptChannel *this_ptr, LDKPublicKey val);
4834 * The first to-be-broadcast-by-sender transaction's per commitment point
4836 LDKPublicKey AcceptChannel_get_first_per_commitment_point(const LDKAcceptChannel *this_ptr);
4839 * The first to-be-broadcast-by-sender transaction's per commitment point
4841 void AcceptChannel_set_first_per_commitment_point(LDKAcceptChannel *this_ptr, LDKPublicKey val);
4843 void FundingCreated_free(LDKFundingCreated this_ptr);
4846 * A temporary channel ID, until the funding is established
4848 const uint8_t (*FundingCreated_get_temporary_channel_id(const LDKFundingCreated *this_ptr))[32];
4851 * A temporary channel ID, until the funding is established
4853 void FundingCreated_set_temporary_channel_id(LDKFundingCreated *this_ptr, LDKThirtyTwoBytes val);
4856 * The funding transaction ID
4858 const uint8_t (*FundingCreated_get_funding_txid(const LDKFundingCreated *this_ptr))[32];
4861 * The funding transaction ID
4863 void FundingCreated_set_funding_txid(LDKFundingCreated *this_ptr, LDKThirtyTwoBytes val);
4866 * The specific output index funding this channel
4868 uint16_t FundingCreated_get_funding_output_index(const LDKFundingCreated *this_ptr);
4871 * The specific output index funding this channel
4873 void FundingCreated_set_funding_output_index(LDKFundingCreated *this_ptr, uint16_t val);
4876 * The signature of the channel initiator (funder) on the funding transaction
4878 LDKSignature FundingCreated_get_signature(const LDKFundingCreated *this_ptr);
4881 * The signature of the channel initiator (funder) on the funding transaction
4883 void FundingCreated_set_signature(LDKFundingCreated *this_ptr, LDKSignature val);
4885 MUST_USE_RES LDKFundingCreated FundingCreated_new(LDKThirtyTwoBytes temporary_channel_id_arg, LDKThirtyTwoBytes funding_txid_arg, uint16_t funding_output_index_arg, LDKSignature signature_arg);
4887 void FundingSigned_free(LDKFundingSigned this_ptr);
4892 const uint8_t (*FundingSigned_get_channel_id(const LDKFundingSigned *this_ptr))[32];
4897 void FundingSigned_set_channel_id(LDKFundingSigned *this_ptr, LDKThirtyTwoBytes val);
4900 * The signature of the channel acceptor (fundee) on the funding transaction
4902 LDKSignature FundingSigned_get_signature(const LDKFundingSigned *this_ptr);
4905 * The signature of the channel acceptor (fundee) on the funding transaction
4907 void FundingSigned_set_signature(LDKFundingSigned *this_ptr, LDKSignature val);
4909 MUST_USE_RES LDKFundingSigned FundingSigned_new(LDKThirtyTwoBytes channel_id_arg, LDKSignature signature_arg);
4911 void FundingLocked_free(LDKFundingLocked this_ptr);
4916 const uint8_t (*FundingLocked_get_channel_id(const LDKFundingLocked *this_ptr))[32];
4921 void FundingLocked_set_channel_id(LDKFundingLocked *this_ptr, LDKThirtyTwoBytes val);
4924 * The per-commitment point of the second commitment transaction
4926 LDKPublicKey FundingLocked_get_next_per_commitment_point(const LDKFundingLocked *this_ptr);
4929 * The per-commitment point of the second commitment transaction
4931 void FundingLocked_set_next_per_commitment_point(LDKFundingLocked *this_ptr, LDKPublicKey val);
4933 MUST_USE_RES LDKFundingLocked FundingLocked_new(LDKThirtyTwoBytes channel_id_arg, LDKPublicKey next_per_commitment_point_arg);
4935 void Shutdown_free(LDKShutdown this_ptr);
4940 const uint8_t (*Shutdown_get_channel_id(const LDKShutdown *this_ptr))[32];
4945 void Shutdown_set_channel_id(LDKShutdown *this_ptr, LDKThirtyTwoBytes val);
4948 * The destination of this peer's funds on closing.
4949 * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
4951 LDKu8slice Shutdown_get_scriptpubkey(const LDKShutdown *this_ptr);
4954 * The destination of this peer's funds on closing.
4955 * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
4957 void Shutdown_set_scriptpubkey(LDKShutdown *this_ptr, LDKCVec_u8Z val);
4959 MUST_USE_RES LDKShutdown Shutdown_new(LDKThirtyTwoBytes channel_id_arg, LDKCVec_u8Z scriptpubkey_arg);
4961 void ClosingSigned_free(LDKClosingSigned this_ptr);
4966 const uint8_t (*ClosingSigned_get_channel_id(const LDKClosingSigned *this_ptr))[32];
4971 void ClosingSigned_set_channel_id(LDKClosingSigned *this_ptr, LDKThirtyTwoBytes val);
4974 * The proposed total fee for the closing transaction
4976 uint64_t ClosingSigned_get_fee_satoshis(const LDKClosingSigned *this_ptr);
4979 * The proposed total fee for the closing transaction
4981 void ClosingSigned_set_fee_satoshis(LDKClosingSigned *this_ptr, uint64_t val);
4984 * A signature on the closing transaction
4986 LDKSignature ClosingSigned_get_signature(const LDKClosingSigned *this_ptr);
4989 * A signature on the closing transaction
4991 void ClosingSigned_set_signature(LDKClosingSigned *this_ptr, LDKSignature val);
4993 MUST_USE_RES LDKClosingSigned ClosingSigned_new(LDKThirtyTwoBytes channel_id_arg, uint64_t fee_satoshis_arg, LDKSignature signature_arg);
4995 void UpdateAddHTLC_free(LDKUpdateAddHTLC this_ptr);
5000 const uint8_t (*UpdateAddHTLC_get_channel_id(const LDKUpdateAddHTLC *this_ptr))[32];
5005 void UpdateAddHTLC_set_channel_id(LDKUpdateAddHTLC *this_ptr, LDKThirtyTwoBytes val);
5010 uint64_t UpdateAddHTLC_get_htlc_id(const LDKUpdateAddHTLC *this_ptr);
5015 void UpdateAddHTLC_set_htlc_id(LDKUpdateAddHTLC *this_ptr, uint64_t val);
5018 * The HTLC value in milli-satoshi
5020 uint64_t UpdateAddHTLC_get_amount_msat(const LDKUpdateAddHTLC *this_ptr);
5023 * The HTLC value in milli-satoshi
5025 void UpdateAddHTLC_set_amount_msat(LDKUpdateAddHTLC *this_ptr, uint64_t val);
5028 * The payment hash, the pre-image of which controls HTLC redemption
5030 const uint8_t (*UpdateAddHTLC_get_payment_hash(const LDKUpdateAddHTLC *this_ptr))[32];
5033 * The payment hash, the pre-image of which controls HTLC redemption
5035 void UpdateAddHTLC_set_payment_hash(LDKUpdateAddHTLC *this_ptr, LDKThirtyTwoBytes val);
5038 * The expiry height of the HTLC
5040 uint32_t UpdateAddHTLC_get_cltv_expiry(const LDKUpdateAddHTLC *this_ptr);
5043 * The expiry height of the HTLC
5045 void UpdateAddHTLC_set_cltv_expiry(LDKUpdateAddHTLC *this_ptr, uint32_t val);
5047 void UpdateFulfillHTLC_free(LDKUpdateFulfillHTLC this_ptr);
5052 const uint8_t (*UpdateFulfillHTLC_get_channel_id(const LDKUpdateFulfillHTLC *this_ptr))[32];
5057 void UpdateFulfillHTLC_set_channel_id(LDKUpdateFulfillHTLC *this_ptr, LDKThirtyTwoBytes val);
5062 uint64_t UpdateFulfillHTLC_get_htlc_id(const LDKUpdateFulfillHTLC *this_ptr);
5067 void UpdateFulfillHTLC_set_htlc_id(LDKUpdateFulfillHTLC *this_ptr, uint64_t val);
5070 * The pre-image of the payment hash, allowing HTLC redemption
5072 const uint8_t (*UpdateFulfillHTLC_get_payment_preimage(const LDKUpdateFulfillHTLC *this_ptr))[32];
5075 * The pre-image of the payment hash, allowing HTLC redemption
5077 void UpdateFulfillHTLC_set_payment_preimage(LDKUpdateFulfillHTLC *this_ptr, LDKThirtyTwoBytes val);
5079 MUST_USE_RES LDKUpdateFulfillHTLC UpdateFulfillHTLC_new(LDKThirtyTwoBytes channel_id_arg, uint64_t htlc_id_arg, LDKThirtyTwoBytes payment_preimage_arg);
5081 void UpdateFailHTLC_free(LDKUpdateFailHTLC this_ptr);
5086 const uint8_t (*UpdateFailHTLC_get_channel_id(const LDKUpdateFailHTLC *this_ptr))[32];
5091 void UpdateFailHTLC_set_channel_id(LDKUpdateFailHTLC *this_ptr, LDKThirtyTwoBytes val);
5096 uint64_t UpdateFailHTLC_get_htlc_id(const LDKUpdateFailHTLC *this_ptr);
5101 void UpdateFailHTLC_set_htlc_id(LDKUpdateFailHTLC *this_ptr, uint64_t val);
5103 void UpdateFailMalformedHTLC_free(LDKUpdateFailMalformedHTLC this_ptr);
5108 const uint8_t (*UpdateFailMalformedHTLC_get_channel_id(const LDKUpdateFailMalformedHTLC *this_ptr))[32];
5113 void UpdateFailMalformedHTLC_set_channel_id(LDKUpdateFailMalformedHTLC *this_ptr, LDKThirtyTwoBytes val);
5118 uint64_t UpdateFailMalformedHTLC_get_htlc_id(const LDKUpdateFailMalformedHTLC *this_ptr);
5123 void UpdateFailMalformedHTLC_set_htlc_id(LDKUpdateFailMalformedHTLC *this_ptr, uint64_t val);
5128 uint16_t UpdateFailMalformedHTLC_get_failure_code(const LDKUpdateFailMalformedHTLC *this_ptr);
5133 void UpdateFailMalformedHTLC_set_failure_code(LDKUpdateFailMalformedHTLC *this_ptr, uint16_t val);
5135 void CommitmentSigned_free(LDKCommitmentSigned this_ptr);
5140 const uint8_t (*CommitmentSigned_get_channel_id(const LDKCommitmentSigned *this_ptr))[32];
5145 void CommitmentSigned_set_channel_id(LDKCommitmentSigned *this_ptr, LDKThirtyTwoBytes val);
5148 * A signature on the commitment transaction
5150 LDKSignature CommitmentSigned_get_signature(const LDKCommitmentSigned *this_ptr);
5153 * A signature on the commitment transaction
5155 void CommitmentSigned_set_signature(LDKCommitmentSigned *this_ptr, LDKSignature val);
5158 * Signatures on the HTLC transactions
5160 void CommitmentSigned_set_htlc_signatures(LDKCommitmentSigned *this_ptr, LDKCVec_SignatureZ val);
5162 MUST_USE_RES LDKCommitmentSigned CommitmentSigned_new(LDKThirtyTwoBytes channel_id_arg, LDKSignature signature_arg, LDKCVec_SignatureZ htlc_signatures_arg);
5164 void RevokeAndACK_free(LDKRevokeAndACK this_ptr);
5169 const uint8_t (*RevokeAndACK_get_channel_id(const LDKRevokeAndACK *this_ptr))[32];
5174 void RevokeAndACK_set_channel_id(LDKRevokeAndACK *this_ptr, LDKThirtyTwoBytes val);
5177 * The secret corresponding to the per-commitment point
5179 const uint8_t (*RevokeAndACK_get_per_commitment_secret(const LDKRevokeAndACK *this_ptr))[32];
5182 * The secret corresponding to the per-commitment point
5184 void RevokeAndACK_set_per_commitment_secret(LDKRevokeAndACK *this_ptr, LDKThirtyTwoBytes val);
5187 * The next sender-broadcast commitment transaction's per-commitment point
5189 LDKPublicKey RevokeAndACK_get_next_per_commitment_point(const LDKRevokeAndACK *this_ptr);
5192 * The next sender-broadcast commitment transaction's per-commitment point
5194 void RevokeAndACK_set_next_per_commitment_point(LDKRevokeAndACK *this_ptr, LDKPublicKey val);
5196 MUST_USE_RES LDKRevokeAndACK RevokeAndACK_new(LDKThirtyTwoBytes channel_id_arg, LDKThirtyTwoBytes per_commitment_secret_arg, LDKPublicKey next_per_commitment_point_arg);
5198 void UpdateFee_free(LDKUpdateFee this_ptr);
5203 const uint8_t (*UpdateFee_get_channel_id(const LDKUpdateFee *this_ptr))[32];
5208 void UpdateFee_set_channel_id(LDKUpdateFee *this_ptr, LDKThirtyTwoBytes val);
5211 * Fee rate per 1000-weight of the transaction
5213 uint32_t UpdateFee_get_feerate_per_kw(const LDKUpdateFee *this_ptr);
5216 * Fee rate per 1000-weight of the transaction
5218 void UpdateFee_set_feerate_per_kw(LDKUpdateFee *this_ptr, uint32_t val);
5220 MUST_USE_RES LDKUpdateFee UpdateFee_new(LDKThirtyTwoBytes channel_id_arg, uint32_t feerate_per_kw_arg);
5222 void DataLossProtect_free(LDKDataLossProtect this_ptr);
5225 * Proof that the sender knows the per-commitment secret of a specific commitment transaction
5226 * belonging to the recipient
5228 const uint8_t (*DataLossProtect_get_your_last_per_commitment_secret(const LDKDataLossProtect *this_ptr))[32];
5231 * Proof that the sender knows the per-commitment secret of a specific commitment transaction
5232 * belonging to the recipient
5234 void DataLossProtect_set_your_last_per_commitment_secret(LDKDataLossProtect *this_ptr, LDKThirtyTwoBytes val);
5237 * The sender's per-commitment point for their current commitment transaction
5239 LDKPublicKey DataLossProtect_get_my_current_per_commitment_point(const LDKDataLossProtect *this_ptr);
5242 * The sender's per-commitment point for their current commitment transaction
5244 void DataLossProtect_set_my_current_per_commitment_point(LDKDataLossProtect *this_ptr, LDKPublicKey val);
5246 MUST_USE_RES LDKDataLossProtect DataLossProtect_new(LDKThirtyTwoBytes your_last_per_commitment_secret_arg, LDKPublicKey my_current_per_commitment_point_arg);
5248 void ChannelReestablish_free(LDKChannelReestablish this_ptr);
5253 const uint8_t (*ChannelReestablish_get_channel_id(const LDKChannelReestablish *this_ptr))[32];
5258 void ChannelReestablish_set_channel_id(LDKChannelReestablish *this_ptr, LDKThirtyTwoBytes val);
5261 * The next commitment number for the sender
5263 uint64_t ChannelReestablish_get_next_local_commitment_number(const LDKChannelReestablish *this_ptr);
5266 * The next commitment number for the sender
5268 void ChannelReestablish_set_next_local_commitment_number(LDKChannelReestablish *this_ptr, uint64_t val);
5271 * The next commitment number for the recipient
5273 uint64_t ChannelReestablish_get_next_remote_commitment_number(const LDKChannelReestablish *this_ptr);
5276 * The next commitment number for the recipient
5278 void ChannelReestablish_set_next_remote_commitment_number(LDKChannelReestablish *this_ptr, uint64_t val);
5280 void AnnouncementSignatures_free(LDKAnnouncementSignatures this_ptr);
5285 const uint8_t (*AnnouncementSignatures_get_channel_id(const LDKAnnouncementSignatures *this_ptr))[32];
5290 void AnnouncementSignatures_set_channel_id(LDKAnnouncementSignatures *this_ptr, LDKThirtyTwoBytes val);
5293 * The short channel ID
5295 uint64_t AnnouncementSignatures_get_short_channel_id(const LDKAnnouncementSignatures *this_ptr);
5298 * The short channel ID
5300 void AnnouncementSignatures_set_short_channel_id(LDKAnnouncementSignatures *this_ptr, uint64_t val);
5303 * A signature by the node key
5305 LDKSignature AnnouncementSignatures_get_node_signature(const LDKAnnouncementSignatures *this_ptr);
5308 * A signature by the node key
5310 void AnnouncementSignatures_set_node_signature(LDKAnnouncementSignatures *this_ptr, LDKSignature val);
5313 * A signature by the funding key
5315 LDKSignature AnnouncementSignatures_get_bitcoin_signature(const LDKAnnouncementSignatures *this_ptr);
5318 * A signature by the funding key
5320 void AnnouncementSignatures_set_bitcoin_signature(LDKAnnouncementSignatures *this_ptr, LDKSignature val);
5322 MUST_USE_RES LDKAnnouncementSignatures AnnouncementSignatures_new(LDKThirtyTwoBytes channel_id_arg, uint64_t short_channel_id_arg, LDKSignature node_signature_arg, LDKSignature bitcoin_signature_arg);
5324 void NetAddress_free(LDKNetAddress this_ptr);
5326 void UnsignedNodeAnnouncement_free(LDKUnsignedNodeAnnouncement this_ptr);
5329 * The advertised features
5331 LDKNodeFeatures UnsignedNodeAnnouncement_get_features(const LDKUnsignedNodeAnnouncement *this_ptr);
5334 * The advertised features
5336 void UnsignedNodeAnnouncement_set_features(LDKUnsignedNodeAnnouncement *this_ptr, LDKNodeFeatures val);
5339 * A strictly monotonic announcement counter, with gaps allowed
5341 uint32_t UnsignedNodeAnnouncement_get_timestamp(const LDKUnsignedNodeAnnouncement *this_ptr);
5344 * A strictly monotonic announcement counter, with gaps allowed
5346 void UnsignedNodeAnnouncement_set_timestamp(LDKUnsignedNodeAnnouncement *this_ptr, uint32_t val);
5349 * The node_id this announcement originated from (don't rebroadcast the node_announcement back
5352 LDKPublicKey UnsignedNodeAnnouncement_get_node_id(const LDKUnsignedNodeAnnouncement *this_ptr);
5355 * The node_id this announcement originated from (don't rebroadcast the node_announcement back
5358 void UnsignedNodeAnnouncement_set_node_id(LDKUnsignedNodeAnnouncement *this_ptr, LDKPublicKey val);
5361 * An RGB color for UI purposes
5363 const uint8_t (*UnsignedNodeAnnouncement_get_rgb(const LDKUnsignedNodeAnnouncement *this_ptr))[3];
5366 * An RGB color for UI purposes
5368 void UnsignedNodeAnnouncement_set_rgb(LDKUnsignedNodeAnnouncement *this_ptr, LDKThreeBytes val);
5371 * An alias, for UI purposes. This should be sanitized before use. There is no guarantee
5374 const uint8_t (*UnsignedNodeAnnouncement_get_alias(const LDKUnsignedNodeAnnouncement *this_ptr))[32];
5377 * An alias, for UI purposes. This should be sanitized before use. There is no guarantee
5380 void UnsignedNodeAnnouncement_set_alias(LDKUnsignedNodeAnnouncement *this_ptr, LDKThirtyTwoBytes val);
5383 * List of addresses on which this node is reachable
5385 void UnsignedNodeAnnouncement_set_addresses(LDKUnsignedNodeAnnouncement *this_ptr, LDKCVec_NetAddressZ val);
5387 void NodeAnnouncement_free(LDKNodeAnnouncement this_ptr);
5390 * The signature by the node key
5392 LDKSignature NodeAnnouncement_get_signature(const LDKNodeAnnouncement *this_ptr);
5395 * The signature by the node key
5397 void NodeAnnouncement_set_signature(LDKNodeAnnouncement *this_ptr, LDKSignature val);
5400 * The actual content of the announcement
5402 LDKUnsignedNodeAnnouncement NodeAnnouncement_get_contents(const LDKNodeAnnouncement *this_ptr);
5405 * The actual content of the announcement
5407 void NodeAnnouncement_set_contents(LDKNodeAnnouncement *this_ptr, LDKUnsignedNodeAnnouncement val);
5409 MUST_USE_RES LDKNodeAnnouncement NodeAnnouncement_new(LDKSignature signature_arg, LDKUnsignedNodeAnnouncement contents_arg);
5411 void UnsignedChannelAnnouncement_free(LDKUnsignedChannelAnnouncement this_ptr);
5414 * The advertised channel features
5416 LDKChannelFeatures UnsignedChannelAnnouncement_get_features(const LDKUnsignedChannelAnnouncement *this_ptr);
5419 * The advertised channel features
5421 void UnsignedChannelAnnouncement_set_features(LDKUnsignedChannelAnnouncement *this_ptr, LDKChannelFeatures val);
5424 * The genesis hash of the blockchain where the channel is to be opened
5426 const uint8_t (*UnsignedChannelAnnouncement_get_chain_hash(const LDKUnsignedChannelAnnouncement *this_ptr))[32];
5429 * The genesis hash of the blockchain where the channel is to be opened
5431 void UnsignedChannelAnnouncement_set_chain_hash(LDKUnsignedChannelAnnouncement *this_ptr, LDKThirtyTwoBytes val);
5434 * The short channel ID
5436 uint64_t UnsignedChannelAnnouncement_get_short_channel_id(const LDKUnsignedChannelAnnouncement *this_ptr);
5439 * The short channel ID
5441 void UnsignedChannelAnnouncement_set_short_channel_id(LDKUnsignedChannelAnnouncement *this_ptr, uint64_t val);
5444 * One of the two node_ids which are endpoints of this channel
5446 LDKPublicKey UnsignedChannelAnnouncement_get_node_id_1(const LDKUnsignedChannelAnnouncement *this_ptr);
5449 * One of the two node_ids which are endpoints of this channel
5451 void UnsignedChannelAnnouncement_set_node_id_1(LDKUnsignedChannelAnnouncement *this_ptr, LDKPublicKey val);
5454 * The other of the two node_ids which are endpoints of this channel
5456 LDKPublicKey UnsignedChannelAnnouncement_get_node_id_2(const LDKUnsignedChannelAnnouncement *this_ptr);
5459 * The other of the two node_ids which are endpoints of this channel
5461 void UnsignedChannelAnnouncement_set_node_id_2(LDKUnsignedChannelAnnouncement *this_ptr, LDKPublicKey val);
5464 * The funding key for the first node
5466 LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_1(const LDKUnsignedChannelAnnouncement *this_ptr);
5469 * The funding key for the first node
5471 void UnsignedChannelAnnouncement_set_bitcoin_key_1(LDKUnsignedChannelAnnouncement *this_ptr, LDKPublicKey val);
5474 * The funding key for the second node
5476 LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_2(const LDKUnsignedChannelAnnouncement *this_ptr);
5479 * The funding key for the second node
5481 void UnsignedChannelAnnouncement_set_bitcoin_key_2(LDKUnsignedChannelAnnouncement *this_ptr, LDKPublicKey val);
5483 void ChannelAnnouncement_free(LDKChannelAnnouncement this_ptr);
5486 * Authentication of the announcement by the first public node
5488 LDKSignature ChannelAnnouncement_get_node_signature_1(const LDKChannelAnnouncement *this_ptr);
5491 * Authentication of the announcement by the first public node
5493 void ChannelAnnouncement_set_node_signature_1(LDKChannelAnnouncement *this_ptr, LDKSignature val);
5496 * Authentication of the announcement by the second public node
5498 LDKSignature ChannelAnnouncement_get_node_signature_2(const LDKChannelAnnouncement *this_ptr);
5501 * Authentication of the announcement by the second public node
5503 void ChannelAnnouncement_set_node_signature_2(LDKChannelAnnouncement *this_ptr, LDKSignature val);
5506 * Proof of funding UTXO ownership by the first public node
5508 LDKSignature ChannelAnnouncement_get_bitcoin_signature_1(const LDKChannelAnnouncement *this_ptr);
5511 * Proof of funding UTXO ownership by the first public node
5513 void ChannelAnnouncement_set_bitcoin_signature_1(LDKChannelAnnouncement *this_ptr, LDKSignature val);
5516 * Proof of funding UTXO ownership by the second public node
5518 LDKSignature ChannelAnnouncement_get_bitcoin_signature_2(const LDKChannelAnnouncement *this_ptr);
5521 * Proof of funding UTXO ownership by the second public node
5523 void ChannelAnnouncement_set_bitcoin_signature_2(LDKChannelAnnouncement *this_ptr, LDKSignature val);
5526 * The actual announcement
5528 LDKUnsignedChannelAnnouncement ChannelAnnouncement_get_contents(const LDKChannelAnnouncement *this_ptr);
5531 * The actual announcement
5533 void ChannelAnnouncement_set_contents(LDKChannelAnnouncement *this_ptr, LDKUnsignedChannelAnnouncement val);
5535 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);
5537 void UnsignedChannelUpdate_free(LDKUnsignedChannelUpdate this_ptr);
5540 * The genesis hash of the blockchain where the channel is to be opened
5542 const uint8_t (*UnsignedChannelUpdate_get_chain_hash(const LDKUnsignedChannelUpdate *this_ptr))[32];
5545 * The genesis hash of the blockchain where the channel is to be opened
5547 void UnsignedChannelUpdate_set_chain_hash(LDKUnsignedChannelUpdate *this_ptr, LDKThirtyTwoBytes val);
5550 * The short channel ID
5552 uint64_t UnsignedChannelUpdate_get_short_channel_id(const LDKUnsignedChannelUpdate *this_ptr);
5555 * The short channel ID
5557 void UnsignedChannelUpdate_set_short_channel_id(LDKUnsignedChannelUpdate *this_ptr, uint64_t val);
5560 * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
5562 uint32_t UnsignedChannelUpdate_get_timestamp(const LDKUnsignedChannelUpdate *this_ptr);
5565 * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
5567 void UnsignedChannelUpdate_set_timestamp(LDKUnsignedChannelUpdate *this_ptr, uint32_t val);
5572 uint8_t UnsignedChannelUpdate_get_flags(const LDKUnsignedChannelUpdate *this_ptr);
5577 void UnsignedChannelUpdate_set_flags(LDKUnsignedChannelUpdate *this_ptr, uint8_t val);
5580 * The number of blocks to subtract from incoming HTLC cltv_expiry values
5582 uint16_t UnsignedChannelUpdate_get_cltv_expiry_delta(const LDKUnsignedChannelUpdate *this_ptr);
5585 * The number of blocks to subtract from incoming HTLC cltv_expiry values
5587 void UnsignedChannelUpdate_set_cltv_expiry_delta(LDKUnsignedChannelUpdate *this_ptr, uint16_t val);
5590 * The minimum HTLC size incoming to sender, in milli-satoshi
5592 uint64_t UnsignedChannelUpdate_get_htlc_minimum_msat(const LDKUnsignedChannelUpdate *this_ptr);
5595 * The minimum HTLC size incoming to sender, in milli-satoshi
5597 void UnsignedChannelUpdate_set_htlc_minimum_msat(LDKUnsignedChannelUpdate *this_ptr, uint64_t val);
5600 * The base HTLC fee charged by sender, in milli-satoshi
5602 uint32_t UnsignedChannelUpdate_get_fee_base_msat(const LDKUnsignedChannelUpdate *this_ptr);
5605 * The base HTLC fee charged by sender, in milli-satoshi
5607 void UnsignedChannelUpdate_set_fee_base_msat(LDKUnsignedChannelUpdate *this_ptr, uint32_t val);
5610 * The amount to fee multiplier, in micro-satoshi
5612 uint32_t UnsignedChannelUpdate_get_fee_proportional_millionths(const LDKUnsignedChannelUpdate *this_ptr);
5615 * The amount to fee multiplier, in micro-satoshi
5617 void UnsignedChannelUpdate_set_fee_proportional_millionths(LDKUnsignedChannelUpdate *this_ptr, uint32_t val);
5619 void ChannelUpdate_free(LDKChannelUpdate this_ptr);
5622 * A signature of the channel update
5624 LDKSignature ChannelUpdate_get_signature(const LDKChannelUpdate *this_ptr);
5627 * A signature of the channel update
5629 void ChannelUpdate_set_signature(LDKChannelUpdate *this_ptr, LDKSignature val);
5632 * The actual channel update
5634 LDKUnsignedChannelUpdate ChannelUpdate_get_contents(const LDKChannelUpdate *this_ptr);
5637 * The actual channel update
5639 void ChannelUpdate_set_contents(LDKChannelUpdate *this_ptr, LDKUnsignedChannelUpdate val);
5641 MUST_USE_RES LDKChannelUpdate ChannelUpdate_new(LDKSignature signature_arg, LDKUnsignedChannelUpdate contents_arg);
5643 void QueryChannelRange_free(LDKQueryChannelRange this_ptr);
5646 * The genesis hash of the blockchain being queried
5648 const uint8_t (*QueryChannelRange_get_chain_hash(const LDKQueryChannelRange *this_ptr))[32];
5651 * The genesis hash of the blockchain being queried
5653 void QueryChannelRange_set_chain_hash(LDKQueryChannelRange *this_ptr, LDKThirtyTwoBytes val);
5656 * The height of the first block for the channel UTXOs being queried
5658 uint32_t QueryChannelRange_get_first_blocknum(const LDKQueryChannelRange *this_ptr);
5661 * The height of the first block for the channel UTXOs being queried
5663 void QueryChannelRange_set_first_blocknum(LDKQueryChannelRange *this_ptr, uint32_t val);
5666 * The number of blocks to include in the query results
5668 uint32_t QueryChannelRange_get_number_of_blocks(const LDKQueryChannelRange *this_ptr);
5671 * The number of blocks to include in the query results
5673 void QueryChannelRange_set_number_of_blocks(LDKQueryChannelRange *this_ptr, uint32_t val);
5675 MUST_USE_RES LDKQueryChannelRange QueryChannelRange_new(LDKThirtyTwoBytes chain_hash_arg, uint32_t first_blocknum_arg, uint32_t number_of_blocks_arg);
5677 void ReplyChannelRange_free(LDKReplyChannelRange this_ptr);
5680 * The genesis hash of the blockchain being queried
5682 const uint8_t (*ReplyChannelRange_get_chain_hash(const LDKReplyChannelRange *this_ptr))[32];
5685 * The genesis hash of the blockchain being queried
5687 void ReplyChannelRange_set_chain_hash(LDKReplyChannelRange *this_ptr, LDKThirtyTwoBytes val);
5690 * The height of the first block in the range of the reply
5692 uint32_t ReplyChannelRange_get_first_blocknum(const LDKReplyChannelRange *this_ptr);
5695 * The height of the first block in the range of the reply
5697 void ReplyChannelRange_set_first_blocknum(LDKReplyChannelRange *this_ptr, uint32_t val);
5700 * The number of blocks included in the range of the reply
5702 uint32_t ReplyChannelRange_get_number_of_blocks(const LDKReplyChannelRange *this_ptr);
5705 * The number of blocks included in the range of the reply
5707 void ReplyChannelRange_set_number_of_blocks(LDKReplyChannelRange *this_ptr, uint32_t val);
5710 * Indicates if the query recipient maintains up-to-date channel
5711 * information for the chain_hash
5713 bool ReplyChannelRange_get_full_information(const LDKReplyChannelRange *this_ptr);
5716 * Indicates if the query recipient maintains up-to-date channel
5717 * information for the chain_hash
5719 void ReplyChannelRange_set_full_information(LDKReplyChannelRange *this_ptr, bool val);
5722 * The short_channel_ids in the channel range
5724 void ReplyChannelRange_set_short_channel_ids(LDKReplyChannelRange *this_ptr, LDKCVec_u64Z val);
5726 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);
5728 void QueryShortChannelIds_free(LDKQueryShortChannelIds this_ptr);
5731 * The genesis hash of the blockchain being queried
5733 const uint8_t (*QueryShortChannelIds_get_chain_hash(const LDKQueryShortChannelIds *this_ptr))[32];
5736 * The genesis hash of the blockchain being queried
5738 void QueryShortChannelIds_set_chain_hash(LDKQueryShortChannelIds *this_ptr, LDKThirtyTwoBytes val);
5741 * The short_channel_ids that are being queried
5743 void QueryShortChannelIds_set_short_channel_ids(LDKQueryShortChannelIds *this_ptr, LDKCVec_u64Z val);
5745 MUST_USE_RES LDKQueryShortChannelIds QueryShortChannelIds_new(LDKThirtyTwoBytes chain_hash_arg, LDKCVec_u64Z short_channel_ids_arg);
5747 void ReplyShortChannelIdsEnd_free(LDKReplyShortChannelIdsEnd this_ptr);
5750 * The genesis hash of the blockchain that was queried
5752 const uint8_t (*ReplyShortChannelIdsEnd_get_chain_hash(const LDKReplyShortChannelIdsEnd *this_ptr))[32];
5755 * The genesis hash of the blockchain that was queried
5757 void ReplyShortChannelIdsEnd_set_chain_hash(LDKReplyShortChannelIdsEnd *this_ptr, LDKThirtyTwoBytes val);
5760 * Indicates if the query recipient maintains up-to-date channel
5761 * information for the chain_hash
5763 bool ReplyShortChannelIdsEnd_get_full_information(const LDKReplyShortChannelIdsEnd *this_ptr);
5766 * Indicates if the query recipient maintains up-to-date channel
5767 * information for the chain_hash
5769 void ReplyShortChannelIdsEnd_set_full_information(LDKReplyShortChannelIdsEnd *this_ptr, bool val);
5771 MUST_USE_RES LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_new(LDKThirtyTwoBytes chain_hash_arg, bool full_information_arg);
5773 void GossipTimestampFilter_free(LDKGossipTimestampFilter this_ptr);
5776 * The genesis hash of the blockchain for channel and node information
5778 const uint8_t (*GossipTimestampFilter_get_chain_hash(const LDKGossipTimestampFilter *this_ptr))[32];
5781 * The genesis hash of the blockchain for channel and node information
5783 void GossipTimestampFilter_set_chain_hash(LDKGossipTimestampFilter *this_ptr, LDKThirtyTwoBytes val);
5786 * The starting unix timestamp
5788 uint32_t GossipTimestampFilter_get_first_timestamp(const LDKGossipTimestampFilter *this_ptr);
5791 * The starting unix timestamp
5793 void GossipTimestampFilter_set_first_timestamp(LDKGossipTimestampFilter *this_ptr, uint32_t val);
5796 * The range of information in seconds
5798 uint32_t GossipTimestampFilter_get_timestamp_range(const LDKGossipTimestampFilter *this_ptr);
5801 * The range of information in seconds
5803 void GossipTimestampFilter_set_timestamp_range(LDKGossipTimestampFilter *this_ptr, uint32_t val);
5805 MUST_USE_RES LDKGossipTimestampFilter GossipTimestampFilter_new(LDKThirtyTwoBytes chain_hash_arg, uint32_t first_timestamp_arg, uint32_t timestamp_range_arg);
5807 void ErrorAction_free(LDKErrorAction this_ptr);
5809 void LightningError_free(LDKLightningError this_ptr);
5812 * A human-readable message describing the error
5814 LDKStr LightningError_get_err(const LDKLightningError *this_ptr);
5817 * A human-readable message describing the error
5819 void LightningError_set_err(LDKLightningError *this_ptr, LDKCVec_u8Z val);
5822 * The action which should be taken against the offending peer.
5824 LDKErrorAction LightningError_get_action(const LDKLightningError *this_ptr);
5827 * The action which should be taken against the offending peer.
5829 void LightningError_set_action(LDKLightningError *this_ptr, LDKErrorAction val);
5831 MUST_USE_RES LDKLightningError LightningError_new(LDKCVec_u8Z err_arg, LDKErrorAction action_arg);
5833 void CommitmentUpdate_free(LDKCommitmentUpdate this_ptr);
5836 * update_add_htlc messages which should be sent
5838 void CommitmentUpdate_set_update_add_htlcs(LDKCommitmentUpdate *this_ptr, LDKCVec_UpdateAddHTLCZ val);
5841 * update_fulfill_htlc messages which should be sent
5843 void CommitmentUpdate_set_update_fulfill_htlcs(LDKCommitmentUpdate *this_ptr, LDKCVec_UpdateFulfillHTLCZ val);
5846 * update_fail_htlc messages which should be sent
5848 void CommitmentUpdate_set_update_fail_htlcs(LDKCommitmentUpdate *this_ptr, LDKCVec_UpdateFailHTLCZ val);
5851 * update_fail_malformed_htlc messages which should be sent
5853 void CommitmentUpdate_set_update_fail_malformed_htlcs(LDKCommitmentUpdate *this_ptr, LDKCVec_UpdateFailMalformedHTLCZ val);
5856 * An update_fee message which should be sent
5858 LDKUpdateFee CommitmentUpdate_get_update_fee(const LDKCommitmentUpdate *this_ptr);
5861 * An update_fee message which should be sent
5863 void CommitmentUpdate_set_update_fee(LDKCommitmentUpdate *this_ptr, LDKUpdateFee val);
5866 * Finally, the commitment_signed message which should be sent
5868 LDKCommitmentSigned CommitmentUpdate_get_commitment_signed(const LDKCommitmentUpdate *this_ptr);
5871 * Finally, the commitment_signed message which should be sent
5873 void CommitmentUpdate_set_commitment_signed(LDKCommitmentUpdate *this_ptr, LDKCommitmentSigned val);
5875 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);
5877 void HTLCFailChannelUpdate_free(LDKHTLCFailChannelUpdate this_ptr);
5880 * Calls the free function if one is set
5882 void ChannelMessageHandler_free(LDKChannelMessageHandler this_ptr);
5885 * Calls the free function if one is set
5887 void RoutingMessageHandler_free(LDKRoutingMessageHandler this_ptr);
5889 LDKCVec_u8Z AcceptChannel_write(const LDKAcceptChannel *obj);
5891 LDKAcceptChannel AcceptChannel_read(LDKu8slice ser);
5893 LDKCVec_u8Z AnnouncementSignatures_write(const LDKAnnouncementSignatures *obj);
5895 LDKAnnouncementSignatures AnnouncementSignatures_read(LDKu8slice ser);
5897 LDKCVec_u8Z ChannelReestablish_write(const LDKChannelReestablish *obj);
5899 LDKChannelReestablish ChannelReestablish_read(LDKu8slice ser);
5901 LDKCVec_u8Z ClosingSigned_write(const LDKClosingSigned *obj);
5903 LDKClosingSigned ClosingSigned_read(LDKu8slice ser);
5905 LDKCVec_u8Z CommitmentSigned_write(const LDKCommitmentSigned *obj);
5907 LDKCommitmentSigned CommitmentSigned_read(LDKu8slice ser);
5909 LDKCVec_u8Z FundingCreated_write(const LDKFundingCreated *obj);
5911 LDKFundingCreated FundingCreated_read(LDKu8slice ser);
5913 LDKCVec_u8Z FundingSigned_write(const LDKFundingSigned *obj);
5915 LDKFundingSigned FundingSigned_read(LDKu8slice ser);
5917 LDKCVec_u8Z FundingLocked_write(const LDKFundingLocked *obj);
5919 LDKFundingLocked FundingLocked_read(LDKu8slice ser);
5921 LDKCVec_u8Z Init_write(const LDKInit *obj);
5923 LDKInit Init_read(LDKu8slice ser);
5925 LDKCVec_u8Z OpenChannel_write(const LDKOpenChannel *obj);
5927 LDKOpenChannel OpenChannel_read(LDKu8slice ser);
5929 LDKCVec_u8Z RevokeAndACK_write(const LDKRevokeAndACK *obj);
5931 LDKRevokeAndACK RevokeAndACK_read(LDKu8slice ser);
5933 LDKCVec_u8Z Shutdown_write(const LDKShutdown *obj);
5935 LDKShutdown Shutdown_read(LDKu8slice ser);
5937 LDKCVec_u8Z UpdateFailHTLC_write(const LDKUpdateFailHTLC *obj);
5939 LDKUpdateFailHTLC UpdateFailHTLC_read(LDKu8slice ser);
5941 LDKCVec_u8Z UpdateFailMalformedHTLC_write(const LDKUpdateFailMalformedHTLC *obj);
5943 LDKUpdateFailMalformedHTLC UpdateFailMalformedHTLC_read(LDKu8slice ser);
5945 LDKCVec_u8Z UpdateFee_write(const LDKUpdateFee *obj);
5947 LDKUpdateFee UpdateFee_read(LDKu8slice ser);
5949 LDKCVec_u8Z UpdateFulfillHTLC_write(const LDKUpdateFulfillHTLC *obj);
5951 LDKUpdateFulfillHTLC UpdateFulfillHTLC_read(LDKu8slice ser);
5953 LDKCVec_u8Z UpdateAddHTLC_write(const LDKUpdateAddHTLC *obj);
5955 LDKUpdateAddHTLC UpdateAddHTLC_read(LDKu8slice ser);
5957 LDKCVec_u8Z Ping_write(const LDKPing *obj);
5959 LDKPing Ping_read(LDKu8slice ser);
5961 LDKCVec_u8Z Pong_write(const LDKPong *obj);
5963 LDKPong Pong_read(LDKu8slice ser);
5965 LDKCVec_u8Z UnsignedChannelAnnouncement_write(const LDKUnsignedChannelAnnouncement *obj);
5967 LDKUnsignedChannelAnnouncement UnsignedChannelAnnouncement_read(LDKu8slice ser);
5969 LDKCVec_u8Z ChannelAnnouncement_write(const LDKChannelAnnouncement *obj);
5971 LDKChannelAnnouncement ChannelAnnouncement_read(LDKu8slice ser);
5973 LDKCVec_u8Z UnsignedChannelUpdate_write(const LDKUnsignedChannelUpdate *obj);
5975 LDKUnsignedChannelUpdate UnsignedChannelUpdate_read(LDKu8slice ser);
5977 LDKCVec_u8Z ChannelUpdate_write(const LDKChannelUpdate *obj);
5979 LDKChannelUpdate ChannelUpdate_read(LDKu8slice ser);
5981 LDKCVec_u8Z ErrorMessage_write(const LDKErrorMessage *obj);
5983 LDKErrorMessage ErrorMessage_read(LDKu8slice ser);
5985 LDKCVec_u8Z UnsignedNodeAnnouncement_write(const LDKUnsignedNodeAnnouncement *obj);
5987 LDKUnsignedNodeAnnouncement UnsignedNodeAnnouncement_read(LDKu8slice ser);
5989 LDKCVec_u8Z NodeAnnouncement_write(const LDKNodeAnnouncement *obj);
5991 LDKNodeAnnouncement NodeAnnouncement_read(LDKu8slice ser);
5993 LDKQueryShortChannelIds QueryShortChannelIds_read(LDKu8slice ser);
5995 LDKCVec_u8Z QueryShortChannelIds_write(const LDKQueryShortChannelIds *obj);
5997 LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_read(LDKu8slice ser);
5999 LDKCVec_u8Z ReplyShortChannelIdsEnd_write(const LDKReplyShortChannelIdsEnd *obj);
6001 LDKQueryChannelRange QueryChannelRange_read(LDKu8slice ser);
6003 LDKCVec_u8Z QueryChannelRange_write(const LDKQueryChannelRange *obj);
6005 LDKReplyChannelRange ReplyChannelRange_read(LDKu8slice ser);
6007 LDKCVec_u8Z ReplyChannelRange_write(const LDKReplyChannelRange *obj);
6009 LDKGossipTimestampFilter GossipTimestampFilter_read(LDKu8slice ser);
6011 LDKCVec_u8Z GossipTimestampFilter_write(const LDKGossipTimestampFilter *obj);
6013 void MessageHandler_free(LDKMessageHandler this_ptr);
6016 * A message handler which handles messages specific to channels. Usually this is just a
6017 * ChannelManager object.
6019 const LDKChannelMessageHandler *MessageHandler_get_chan_handler(const LDKMessageHandler *this_ptr);
6022 * A message handler which handles messages specific to channels. Usually this is just a
6023 * ChannelManager object.
6025 void MessageHandler_set_chan_handler(LDKMessageHandler *this_ptr, LDKChannelMessageHandler val);
6028 * A message handler which handles messages updating our knowledge of the network channel
6029 * graph. Usually this is just a NetGraphMsgHandlerMonitor object.
6031 const LDKRoutingMessageHandler *MessageHandler_get_route_handler(const LDKMessageHandler *this_ptr);
6034 * A message handler which handles messages updating our knowledge of the network channel
6035 * graph. Usually this is just a NetGraphMsgHandlerMonitor object.
6037 void MessageHandler_set_route_handler(LDKMessageHandler *this_ptr, LDKRoutingMessageHandler val);
6039 MUST_USE_RES LDKMessageHandler MessageHandler_new(LDKChannelMessageHandler chan_handler_arg, LDKRoutingMessageHandler route_handler_arg);
6042 * Calls the free function if one is set
6044 void SocketDescriptor_free(LDKSocketDescriptor this_ptr);
6046 void PeerHandleError_free(LDKPeerHandleError this_ptr);
6049 * Used to indicate that we probably can't make any future connections to this peer, implying
6050 * we should go ahead and force-close any channels we have with it.
6052 bool PeerHandleError_get_no_connection_possible(const LDKPeerHandleError *this_ptr);
6055 * Used to indicate that we probably can't make any future connections to this peer, implying
6056 * we should go ahead and force-close any channels we have with it.
6058 void PeerHandleError_set_no_connection_possible(LDKPeerHandleError *this_ptr, bool val);
6060 MUST_USE_RES LDKPeerHandleError PeerHandleError_new(bool no_connection_possible_arg);
6062 void PeerManager_free(LDKPeerManager this_ptr);
6065 * Constructs a new PeerManager with the given message handlers and node_id secret key
6066 * ephemeral_random_data is used to derive per-connection ephemeral keys and must be
6067 * cryptographically secure random bytes.
6069 MUST_USE_RES LDKPeerManager PeerManager_new(LDKMessageHandler message_handler, LDKSecretKey our_node_secret, const uint8_t (*ephemeral_random_data)[32], LDKLogger logger);
6072 * Get the list of node ids for peers which have completed the initial handshake.
6074 * For outbound connections, this will be the same as the their_node_id parameter passed in to
6075 * new_outbound_connection, however entries will only appear once the initial handshake has
6076 * completed and we are sure the remote peer has the private key for the given node_id.
6078 MUST_USE_RES LDKCVec_PublicKeyZ PeerManager_get_peer_node_ids(const LDKPeerManager *this_arg);
6081 * Indicates a new outbound connection has been established to a node with the given node_id.
6082 * Note that if an Err is returned here you MUST NOT call socket_disconnected for the new
6083 * descriptor but must disconnect the connection immediately.
6085 * Returns a small number of bytes to send to the remote node (currently always 50).
6087 * Panics if descriptor is duplicative with some other descriptor which has not yet had a
6088 * socket_disconnected().
6090 MUST_USE_RES LDKCResult_CVec_u8ZPeerHandleErrorZ PeerManager_new_outbound_connection(const LDKPeerManager *this_arg, LDKPublicKey their_node_id, LDKSocketDescriptor descriptor);
6093 * Indicates a new inbound connection has been established.
6095 * May refuse the connection by returning an Err, but will never write bytes to the remote end
6096 * (outbound connector always speaks first). Note that if an Err is returned here you MUST NOT
6097 * call socket_disconnected for the new descriptor but must disconnect the connection
6100 * Panics if descriptor is duplicative with some other descriptor which has not yet had
6101 * socket_disconnected called.
6103 MUST_USE_RES LDKCResult_NonePeerHandleErrorZ PeerManager_new_inbound_connection(const LDKPeerManager *this_arg, LDKSocketDescriptor descriptor);
6106 * Indicates that there is room to write data to the given socket descriptor.
6108 * May return an Err to indicate that the connection should be closed.
6110 * Will most likely call send_data on the descriptor passed in (or the descriptor handed into
6111 * new_*\\_connection) before returning. Thus, be very careful with reentrancy issues! The
6112 * invariants around calling write_buffer_space_avail in case a write did not fully complete
6113 * must still hold - be ready to call write_buffer_space_avail again if a write call generated
6114 * here isn't sufficient! Panics if the descriptor was not previously registered in a
6115 * new_\\*_connection event.
6117 MUST_USE_RES LDKCResult_NonePeerHandleErrorZ PeerManager_write_buffer_space_avail(const LDKPeerManager *this_arg, LDKSocketDescriptor *descriptor);
6120 * Indicates that data was read from the given socket descriptor.
6122 * May return an Err to indicate that the connection should be closed.
6124 * Will *not* call back into send_data on any descriptors to avoid reentrancy complexity.
6125 * Thus, however, you almost certainly want to call process_events() after any read_event to
6126 * generate send_data calls to handle responses.
6128 * If Ok(true) is returned, further read_events should not be triggered until a send_data call
6129 * on this file descriptor has resume_read set (preventing DoS issues in the send buffer).
6131 * Panics if the descriptor was not previously registered in a new_*_connection event.
6133 MUST_USE_RES LDKCResult_boolPeerHandleErrorZ PeerManager_read_event(const LDKPeerManager *this_arg, LDKSocketDescriptor *peer_descriptor, LDKu8slice data);
6136 * Checks for any events generated by our handlers and processes them. Includes sending most
6137 * response messages as well as messages generated by calls to handler functions directly (eg
6138 * functions like ChannelManager::process_pending_htlc_forward or send_payment).
6140 void PeerManager_process_events(const LDKPeerManager *this_arg);
6143 * Indicates that the given socket descriptor's connection is now closed.
6145 * This must only be called if the socket has been disconnected by the peer or your own
6146 * decision to disconnect it and must NOT be called in any case where other parts of this
6147 * library (eg PeerHandleError, explicit disconnect_socket calls) instruct you to disconnect
6150 * Panics if the descriptor was not previously registered in a successful new_*_connection event.
6152 void PeerManager_socket_disconnected(const LDKPeerManager *this_arg, const LDKSocketDescriptor *descriptor);
6155 * This function should be called roughly once every 30 seconds.
6156 * It will send pings to each peer and disconnect those which did not respond to the last round of pings.
6157 * Will most likely call send_data on all of the registered descriptors, thus, be very careful with reentrancy issues!
6159 void PeerManager_timer_tick_occured(const LDKPeerManager *this_arg);
6162 * Build the commitment secret from the seed and the commitment number
6164 LDKThirtyTwoBytes build_commitment_secret(const uint8_t (*commitment_seed)[32], uint64_t idx);
6167 * Derives a per-commitment-transaction private key (eg an htlc key or delayed_payment key)
6168 * from the base secret and the per_commitment_point.
6170 * Note that this is infallible iff we trust that at least one of the two input keys are randomly
6171 * generated (ie our own).
6173 LDKCResult_SecretKeySecpErrorZ derive_private_key(LDKPublicKey per_commitment_point, const uint8_t (*base_secret)[32]);
6176 * Derives a per-commitment-transaction public key (eg an htlc key or a delayed_payment key)
6177 * from the base point and the per_commitment_key. This is the public equivalent of
6178 * derive_private_key - using only public keys to derive a public key instead of private keys.
6180 * Note that this is infallible iff we trust that at least one of the two input keys are randomly
6181 * generated (ie our own).
6183 LDKCResult_PublicKeySecpErrorZ derive_public_key(LDKPublicKey per_commitment_point, LDKPublicKey base_point);
6186 * Derives a per-commitment-transaction revocation key from its constituent parts.
6188 * Only the cheating participant owns a valid witness to propagate a revoked
6189 * commitment transaction, thus per_commitment_secret always come from cheater
6190 * and revocation_base_secret always come from punisher, which is the broadcaster
6191 * of the transaction spending with this key knowledge.
6193 * Note that this is infallible iff we trust that at least one of the two input keys are randomly
6194 * generated (ie our own).
6196 LDKCResult_SecretKeySecpErrorZ derive_private_revocation_key(const uint8_t (*per_commitment_secret)[32], const uint8_t (*countersignatory_revocation_base_secret)[32]);
6199 * Derives a per-commitment-transaction revocation public key from its constituent parts. This is
6200 * the public equivalend of derive_private_revocation_key - using only public keys to derive a
6201 * public key instead of private keys.
6203 * Only the cheating participant owns a valid witness to propagate a revoked
6204 * commitment transaction, thus per_commitment_point always come from cheater
6205 * and revocation_base_point always come from punisher, which is the broadcaster
6206 * of the transaction spending with this key knowledge.
6208 * Note that this is infallible iff we trust that at least one of the two input keys are randomly
6209 * generated (ie our own).
6211 LDKCResult_PublicKeySecpErrorZ derive_public_revocation_key(LDKPublicKey per_commitment_point, LDKPublicKey countersignatory_revocation_base_point);
6213 void TxCreationKeys_free(LDKTxCreationKeys this_ptr);
6216 * The broadcaster's per-commitment public key which was used to derive the other keys.
6218 LDKPublicKey TxCreationKeys_get_per_commitment_point(const LDKTxCreationKeys *this_ptr);
6221 * The broadcaster's per-commitment public key which was used to derive the other keys.
6223 void TxCreationKeys_set_per_commitment_point(LDKTxCreationKeys *this_ptr, LDKPublicKey val);
6226 * The revocation key which is used to allow the broadcaster of the commitment
6227 * transaction to provide their counterparty the ability to punish them if they broadcast
6230 LDKPublicKey TxCreationKeys_get_revocation_key(const LDKTxCreationKeys *this_ptr);
6233 * The revocation key which is used to allow the broadcaster of the commitment
6234 * transaction to provide their counterparty the ability to punish them if they broadcast
6237 void TxCreationKeys_set_revocation_key(LDKTxCreationKeys *this_ptr, LDKPublicKey val);
6240 * Broadcaster's HTLC Key
6242 LDKPublicKey TxCreationKeys_get_broadcaster_htlc_key(const LDKTxCreationKeys *this_ptr);
6245 * Broadcaster's HTLC Key
6247 void TxCreationKeys_set_broadcaster_htlc_key(LDKTxCreationKeys *this_ptr, LDKPublicKey val);
6250 * Countersignatory's HTLC Key
6252 LDKPublicKey TxCreationKeys_get_countersignatory_htlc_key(const LDKTxCreationKeys *this_ptr);
6255 * Countersignatory's HTLC Key
6257 void TxCreationKeys_set_countersignatory_htlc_key(LDKTxCreationKeys *this_ptr, LDKPublicKey val);
6260 * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
6262 LDKPublicKey TxCreationKeys_get_broadcaster_delayed_payment_key(const LDKTxCreationKeys *this_ptr);
6265 * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
6267 void TxCreationKeys_set_broadcaster_delayed_payment_key(LDKTxCreationKeys *this_ptr, LDKPublicKey val);
6269 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);
6271 LDKCVec_u8Z TxCreationKeys_write(const LDKTxCreationKeys *obj);
6273 LDKTxCreationKeys TxCreationKeys_read(LDKu8slice ser);
6275 void PreCalculatedTxCreationKeys_free(LDKPreCalculatedTxCreationKeys this_ptr);
6278 * Create a new PreCalculatedTxCreationKeys from TxCreationKeys
6280 MUST_USE_RES LDKPreCalculatedTxCreationKeys PreCalculatedTxCreationKeys_new(LDKTxCreationKeys keys);
6283 * The pre-calculated transaction creation public keys.
6284 * An external validating signer should not trust these keys.
6286 MUST_USE_RES LDKTxCreationKeys PreCalculatedTxCreationKeys_trust_key_derivation(const LDKPreCalculatedTxCreationKeys *this_arg);
6289 * The transaction per-commitment point
6291 MUST_USE_RES LDKPublicKey PreCalculatedTxCreationKeys_per_commitment_point(const LDKPreCalculatedTxCreationKeys *this_arg);
6293 void ChannelPublicKeys_free(LDKChannelPublicKeys this_ptr);
6296 * The public key which is used to sign all commitment transactions, as it appears in the
6297 * on-chain channel lock-in 2-of-2 multisig output.
6299 LDKPublicKey ChannelPublicKeys_get_funding_pubkey(const LDKChannelPublicKeys *this_ptr);
6302 * The public key which is used to sign all commitment transactions, as it appears in the
6303 * on-chain channel lock-in 2-of-2 multisig output.
6305 void ChannelPublicKeys_set_funding_pubkey(LDKChannelPublicKeys *this_ptr, LDKPublicKey val);
6308 * The base point which is used (with derive_public_revocation_key) to derive per-commitment
6309 * revocation keys. This is combined with the per-commitment-secret generated by the
6310 * counterparty to create a secret which the counterparty can reveal to revoke previous
6313 LDKPublicKey ChannelPublicKeys_get_revocation_basepoint(const LDKChannelPublicKeys *this_ptr);
6316 * The base point which is used (with derive_public_revocation_key) to derive per-commitment
6317 * revocation keys. This is combined with the per-commitment-secret generated by the
6318 * counterparty to create a secret which the counterparty can reveal to revoke previous
6321 void ChannelPublicKeys_set_revocation_basepoint(LDKChannelPublicKeys *this_ptr, LDKPublicKey val);
6324 * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
6325 * spendable primary channel balance on the broadcaster's commitment transaction. This key is
6326 * static across every commitment transaction.
6328 LDKPublicKey ChannelPublicKeys_get_payment_point(const LDKChannelPublicKeys *this_ptr);
6331 * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
6332 * spendable primary channel balance on the broadcaster's commitment transaction. This key is
6333 * static across every commitment transaction.
6335 void ChannelPublicKeys_set_payment_point(LDKChannelPublicKeys *this_ptr, LDKPublicKey val);
6338 * The base point which is used (with derive_public_key) to derive a per-commitment payment
6339 * public key which receives non-HTLC-encumbered funds which are only available for spending
6340 * after some delay (or can be claimed via the revocation path).
6342 LDKPublicKey ChannelPublicKeys_get_delayed_payment_basepoint(const LDKChannelPublicKeys *this_ptr);
6345 * The base point which is used (with derive_public_key) to derive a per-commitment payment
6346 * public key which receives non-HTLC-encumbered funds which are only available for spending
6347 * after some delay (or can be claimed via the revocation path).
6349 void ChannelPublicKeys_set_delayed_payment_basepoint(LDKChannelPublicKeys *this_ptr, LDKPublicKey val);
6352 * The base point which is used (with derive_public_key) to derive a per-commitment public key
6353 * which is used to encumber HTLC-in-flight outputs.
6355 LDKPublicKey ChannelPublicKeys_get_htlc_basepoint(const LDKChannelPublicKeys *this_ptr);
6358 * The base point which is used (with derive_public_key) to derive a per-commitment public key
6359 * which is used to encumber HTLC-in-flight outputs.
6361 void ChannelPublicKeys_set_htlc_basepoint(LDKChannelPublicKeys *this_ptr, LDKPublicKey val);
6363 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);
6365 LDKCVec_u8Z ChannelPublicKeys_write(const LDKChannelPublicKeys *obj);
6367 LDKChannelPublicKeys ChannelPublicKeys_read(LDKu8slice ser);
6370 * Create a new TxCreationKeys from channel base points and the per-commitment point
6372 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);
6375 * A script either spendable by the revocation
6376 * key or the broadcaster_delayed_payment_key and satisfying the relative-locktime OP_CSV constrain.
6377 * Encumbering a `to_holder` output on a commitment transaction or 2nd-stage HTLC transactions.
6379 LDKCVec_u8Z get_revokeable_redeemscript(LDKPublicKey revocation_key, uint16_t contest_delay, LDKPublicKey broadcaster_delayed_payment_key);
6381 void HTLCOutputInCommitment_free(LDKHTLCOutputInCommitment this_ptr);
6384 * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
6385 * Note that this is not the same as whether it is ountbound *from us*. To determine that you
6386 * need to compare this value to whether the commitment transaction in question is that of
6387 * the counterparty or our own.
6389 bool HTLCOutputInCommitment_get_offered(const LDKHTLCOutputInCommitment *this_ptr);
6392 * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
6393 * Note that this is not the same as whether it is ountbound *from us*. To determine that you
6394 * need to compare this value to whether the commitment transaction in question is that of
6395 * the counterparty or our own.
6397 void HTLCOutputInCommitment_set_offered(LDKHTLCOutputInCommitment *this_ptr, bool val);
6400 * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
6401 * this divided by 1000.
6403 uint64_t HTLCOutputInCommitment_get_amount_msat(const LDKHTLCOutputInCommitment *this_ptr);
6406 * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
6407 * this divided by 1000.
6409 void HTLCOutputInCommitment_set_amount_msat(LDKHTLCOutputInCommitment *this_ptr, uint64_t val);
6412 * The CLTV lock-time at which this HTLC expires.
6414 uint32_t HTLCOutputInCommitment_get_cltv_expiry(const LDKHTLCOutputInCommitment *this_ptr);
6417 * The CLTV lock-time at which this HTLC expires.
6419 void HTLCOutputInCommitment_set_cltv_expiry(LDKHTLCOutputInCommitment *this_ptr, uint32_t val);
6422 * The hash of the preimage which unlocks this HTLC.
6424 const uint8_t (*HTLCOutputInCommitment_get_payment_hash(const LDKHTLCOutputInCommitment *this_ptr))[32];
6427 * The hash of the preimage which unlocks this HTLC.
6429 void HTLCOutputInCommitment_set_payment_hash(LDKHTLCOutputInCommitment *this_ptr, LDKThirtyTwoBytes val);
6431 LDKCVec_u8Z HTLCOutputInCommitment_write(const LDKHTLCOutputInCommitment *obj);
6433 LDKHTLCOutputInCommitment HTLCOutputInCommitment_read(LDKu8slice ser);
6436 * Gets the witness redeemscript for an HTLC output in a commitment transaction. Note that htlc
6437 * does not need to have its previous_output_index filled.
6439 LDKCVec_u8Z get_htlc_redeemscript(const LDKHTLCOutputInCommitment *htlc, const LDKTxCreationKeys *keys);
6442 * Gets the redeemscript for a funding output from the two funding public keys.
6443 * Note that the order of funding public keys does not matter.
6445 LDKCVec_u8Z make_funding_redeemscript(LDKPublicKey broadcaster, LDKPublicKey countersignatory);
6448 * panics if htlc.transaction_output_index.is_none()!
6450 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);
6452 void HolderCommitmentTransaction_free(LDKHolderCommitmentTransaction this_ptr);
6455 * The commitment transaction itself, in unsigned form.
6457 LDKTransaction HolderCommitmentTransaction_get_unsigned_tx(const LDKHolderCommitmentTransaction *this_ptr);
6460 * The commitment transaction itself, in unsigned form.
6462 void HolderCommitmentTransaction_set_unsigned_tx(LDKHolderCommitmentTransaction *this_ptr, LDKTransaction val);
6465 * Our counterparty's signature for the transaction, above.
6467 LDKSignature HolderCommitmentTransaction_get_counterparty_sig(const LDKHolderCommitmentTransaction *this_ptr);
6470 * Our counterparty's signature for the transaction, above.
6472 void HolderCommitmentTransaction_set_counterparty_sig(LDKHolderCommitmentTransaction *this_ptr, LDKSignature val);
6475 * The feerate paid per 1000-weight-unit in this commitment transaction. This value is
6476 * controlled by the channel initiator.
6478 uint32_t HolderCommitmentTransaction_get_feerate_per_kw(const LDKHolderCommitmentTransaction *this_ptr);
6481 * The feerate paid per 1000-weight-unit in this commitment transaction. This value is
6482 * controlled by the channel initiator.
6484 void HolderCommitmentTransaction_set_feerate_per_kw(LDKHolderCommitmentTransaction *this_ptr, uint32_t val);
6487 * The HTLCs and counterparty htlc signatures which were included in this commitment transaction.
6489 * Note that this includes all HTLCs, including ones which were considered dust and not
6490 * actually included in the transaction as it appears on-chain, but who's value is burned as
6491 * fees and not included in the to_holder or to_counterparty outputs.
6493 * The counterparty HTLC signatures in the second element will always be set for non-dust HTLCs, ie
6494 * those for which transaction_output_index.is_some().
6496 void HolderCommitmentTransaction_set_per_htlc(LDKHolderCommitmentTransaction *this_ptr, LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ val);
6499 * Generate a new HolderCommitmentTransaction based on a raw commitment transaction,
6500 * counterparty signature and both parties keys.
6502 * The unsigned transaction outputs must be consistent with htlc_data. This function
6503 * only checks that the shape and amounts are consistent, but does not check the scriptPubkey.
6505 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);
6508 * The pre-calculated transaction creation public keys.
6509 * An external validating signer should not trust these keys.
6511 MUST_USE_RES LDKTxCreationKeys HolderCommitmentTransaction_trust_key_derivation(const LDKHolderCommitmentTransaction *this_arg);
6514 * Get the txid of the holder commitment transaction contained in this
6515 * HolderCommitmentTransaction
6517 MUST_USE_RES LDKThirtyTwoBytes HolderCommitmentTransaction_txid(const LDKHolderCommitmentTransaction *this_arg);
6520 * Gets holder signature for the contained commitment transaction given holder funding private key.
6522 * Funding key is your key included in the 2-2 funding_outpoint lock. Should be provided
6523 * by your ChannelKeys.
6524 * Funding redeemscript is script locking funding_outpoint. This is the mutlsig script
6525 * between your own funding key and your counterparty's. Currently, this is provided in
6526 * ChannelKeys::sign_holder_commitment() calls directly.
6527 * Channel value is amount locked in funding_outpoint.
6529 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);
6532 * Get a signature for each HTLC which was included in the commitment transaction (ie for
6533 * which HTLCOutputInCommitment::transaction_output_index.is_some()).
6535 * The returned Vec has one entry for each HTLC, and in the same order. For HTLCs which were
6536 * considered dust and not included, a None entry exists, for all others a signature is
6539 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);
6541 LDKCVec_u8Z HolderCommitmentTransaction_write(const LDKHolderCommitmentTransaction *obj);
6543 LDKHolderCommitmentTransaction HolderCommitmentTransaction_read(LDKu8slice ser);
6545 void InitFeatures_free(LDKInitFeatures this_ptr);
6547 void NodeFeatures_free(LDKNodeFeatures this_ptr);
6549 void ChannelFeatures_free(LDKChannelFeatures this_ptr);
6551 void RouteHop_free(LDKRouteHop this_ptr);
6554 * The node_id of the node at this hop.
6556 LDKPublicKey RouteHop_get_pubkey(const LDKRouteHop *this_ptr);
6559 * The node_id of the node at this hop.
6561 void RouteHop_set_pubkey(LDKRouteHop *this_ptr, LDKPublicKey val);
6564 * The node_announcement features of the node at this hop. For the last hop, these may be
6565 * amended to match the features present in the invoice this node generated.
6567 LDKNodeFeatures RouteHop_get_node_features(const LDKRouteHop *this_ptr);
6570 * The node_announcement features of the node at this hop. For the last hop, these may be
6571 * amended to match the features present in the invoice this node generated.
6573 void RouteHop_set_node_features(LDKRouteHop *this_ptr, LDKNodeFeatures val);
6576 * The channel that should be used from the previous hop to reach this node.
6578 uint64_t RouteHop_get_short_channel_id(const LDKRouteHop *this_ptr);
6581 * The channel that should be used from the previous hop to reach this node.
6583 void RouteHop_set_short_channel_id(LDKRouteHop *this_ptr, uint64_t val);
6586 * The channel_announcement features of the channel that should be used from the previous hop
6587 * to reach this node.
6589 LDKChannelFeatures RouteHop_get_channel_features(const LDKRouteHop *this_ptr);
6592 * The channel_announcement features of the channel that should be used from the previous hop
6593 * to reach this node.
6595 void RouteHop_set_channel_features(LDKRouteHop *this_ptr, LDKChannelFeatures val);
6598 * The fee taken on this hop. For the last hop, this should be the full value of the payment.
6600 uint64_t RouteHop_get_fee_msat(const LDKRouteHop *this_ptr);
6603 * The fee taken on this hop. For the last hop, this should be the full value of the payment.
6605 void RouteHop_set_fee_msat(LDKRouteHop *this_ptr, uint64_t val);
6608 * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
6609 * expected at the destination, in excess of the current block height.
6611 uint32_t RouteHop_get_cltv_expiry_delta(const LDKRouteHop *this_ptr);
6614 * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
6615 * expected at the destination, in excess of the current block height.
6617 void RouteHop_set_cltv_expiry_delta(LDKRouteHop *this_ptr, uint32_t val);
6619 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);
6621 void Route_free(LDKRoute this_ptr);
6624 * The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the
6625 * last RouteHop in each path must be the same.
6626 * Each entry represents a list of hops, NOT INCLUDING our own, where the last hop is the
6627 * destination. Thus, this must always be at least length one. While the maximum length of any
6628 * given path is variable, keeping the length of any path to less than 20 should currently
6629 * ensure it is viable.
6631 void Route_set_paths(LDKRoute *this_ptr, LDKCVec_CVec_RouteHopZZ val);
6633 MUST_USE_RES LDKRoute Route_new(LDKCVec_CVec_RouteHopZZ paths_arg);
6635 LDKCVec_u8Z Route_write(const LDKRoute *obj);
6637 LDKRoute Route_read(LDKu8slice ser);
6639 void RouteHint_free(LDKRouteHint this_ptr);
6642 * The node_id of the non-target end of the route
6644 LDKPublicKey RouteHint_get_src_node_id(const LDKRouteHint *this_ptr);
6647 * The node_id of the non-target end of the route
6649 void RouteHint_set_src_node_id(LDKRouteHint *this_ptr, LDKPublicKey val);
6652 * The short_channel_id of this channel
6654 uint64_t RouteHint_get_short_channel_id(const LDKRouteHint *this_ptr);
6657 * The short_channel_id of this channel
6659 void RouteHint_set_short_channel_id(LDKRouteHint *this_ptr, uint64_t val);
6662 * The fees which must be paid to use this channel
6664 LDKRoutingFees RouteHint_get_fees(const LDKRouteHint *this_ptr);
6667 * The fees which must be paid to use this channel
6669 void RouteHint_set_fees(LDKRouteHint *this_ptr, LDKRoutingFees val);
6672 * The difference in CLTV values between this node and the next node.
6674 uint16_t RouteHint_get_cltv_expiry_delta(const LDKRouteHint *this_ptr);
6677 * The difference in CLTV values between this node and the next node.
6679 void RouteHint_set_cltv_expiry_delta(LDKRouteHint *this_ptr, uint16_t val);
6682 * The minimum value, in msat, which must be relayed to the next hop.
6684 uint64_t RouteHint_get_htlc_minimum_msat(const LDKRouteHint *this_ptr);
6687 * The minimum value, in msat, which must be relayed to the next hop.
6689 void RouteHint_set_htlc_minimum_msat(LDKRouteHint *this_ptr, uint64_t val);
6691 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);
6694 * Gets a route from us to the given target node.
6696 * Extra routing hops between known nodes and the target will be used if they are included in
6699 * If some channels aren't announced, it may be useful to fill in a first_hops with the
6700 * results from a local ChannelManager::list_usable_channels() call. If it is filled in, our
6701 * view of our local channels (from net_graph_msg_handler) will be ignored, and only those in first_hops
6704 * Panics if first_hops contains channels without short_channel_ids
6705 * (ChannelManager::list_usable_channels will never include such channels).
6707 * The fees on channels from us to next-hops are ignored (as they are assumed to all be
6708 * equal), however the enabled/disabled bit on such channels as well as the htlc_minimum_msat
6709 * *is* checked as they may change based on the receiving node.
6711 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);
6713 void NetworkGraph_free(LDKNetworkGraph this_ptr);
6715 void LockedNetworkGraph_free(LDKLockedNetworkGraph this_ptr);
6717 void NetGraphMsgHandler_free(LDKNetGraphMsgHandler this_ptr);
6720 * Creates a new tracker of the actual state of the network of channels and nodes,
6721 * assuming a fresh network graph.
6722 * Chain monitor is used to make sure announced channels exist on-chain,
6723 * channel data is correct, and that the announcement is signed with
6724 * channel owners' keys.
6726 MUST_USE_RES LDKNetGraphMsgHandler NetGraphMsgHandler_new(LDKAccess *chain_access, LDKLogger logger);
6729 * Creates a new tracker of the actual state of the network of channels and nodes,
6730 * assuming an existing Network Graph.
6732 MUST_USE_RES LDKNetGraphMsgHandler NetGraphMsgHandler_from_net_graph(LDKAccess *chain_access, LDKLogger logger, LDKNetworkGraph network_graph);
6735 * Take a read lock on the network_graph and return it in the C-bindings
6736 * newtype helper. This is likely only useful when called via the C
6737 * bindings as you can call `self.network_graph.read().unwrap()` in Rust
6740 MUST_USE_RES LDKLockedNetworkGraph NetGraphMsgHandler_read_locked_graph(const LDKNetGraphMsgHandler *this_arg);
6743 * Get a reference to the NetworkGraph which this read-lock contains.
6745 MUST_USE_RES LDKNetworkGraph LockedNetworkGraph_graph(const LDKLockedNetworkGraph *this_arg);
6747 LDKRoutingMessageHandler NetGraphMsgHandler_as_RoutingMessageHandler(const LDKNetGraphMsgHandler *this_arg);
6749 void DirectionalChannelInfo_free(LDKDirectionalChannelInfo this_ptr);
6752 * When the last update to the channel direction was issued.
6753 * Value is opaque, as set in the announcement.
6755 uint32_t DirectionalChannelInfo_get_last_update(const LDKDirectionalChannelInfo *this_ptr);
6758 * When the last update to the channel direction was issued.
6759 * Value is opaque, as set in the announcement.
6761 void DirectionalChannelInfo_set_last_update(LDKDirectionalChannelInfo *this_ptr, uint32_t val);
6764 * Whether the channel can be currently used for payments (in this one direction).
6766 bool DirectionalChannelInfo_get_enabled(const LDKDirectionalChannelInfo *this_ptr);
6769 * Whether the channel can be currently used for payments (in this one direction).
6771 void DirectionalChannelInfo_set_enabled(LDKDirectionalChannelInfo *this_ptr, bool val);
6774 * The difference in CLTV values that you must have when routing through this channel.
6776 uint16_t DirectionalChannelInfo_get_cltv_expiry_delta(const LDKDirectionalChannelInfo *this_ptr);
6779 * The difference in CLTV values that you must have when routing through this channel.
6781 void DirectionalChannelInfo_set_cltv_expiry_delta(LDKDirectionalChannelInfo *this_ptr, uint16_t val);
6784 * The minimum value, which must be relayed to the next hop via the channel
6786 uint64_t DirectionalChannelInfo_get_htlc_minimum_msat(const LDKDirectionalChannelInfo *this_ptr);
6789 * The minimum value, which must be relayed to the next hop via the channel
6791 void DirectionalChannelInfo_set_htlc_minimum_msat(LDKDirectionalChannelInfo *this_ptr, uint64_t val);
6794 * Most recent update for the channel received from the network
6795 * Mostly redundant with the data we store in fields explicitly.
6796 * Everything else is useful only for sending out for initial routing sync.
6797 * Not stored if contains excess data to prevent DoS.
6799 LDKChannelUpdate DirectionalChannelInfo_get_last_update_message(const LDKDirectionalChannelInfo *this_ptr);
6802 * Most recent update for the channel received from the network
6803 * Mostly redundant with the data we store in fields explicitly.
6804 * Everything else is useful only for sending out for initial routing sync.
6805 * Not stored if contains excess data to prevent DoS.
6807 void DirectionalChannelInfo_set_last_update_message(LDKDirectionalChannelInfo *this_ptr, LDKChannelUpdate val);
6809 LDKCVec_u8Z DirectionalChannelInfo_write(const LDKDirectionalChannelInfo *obj);
6811 LDKDirectionalChannelInfo DirectionalChannelInfo_read(LDKu8slice ser);
6813 void ChannelInfo_free(LDKChannelInfo this_ptr);
6816 * Protocol features of a channel communicated during its announcement
6818 LDKChannelFeatures ChannelInfo_get_features(const LDKChannelInfo *this_ptr);
6821 * Protocol features of a channel communicated during its announcement
6823 void ChannelInfo_set_features(LDKChannelInfo *this_ptr, LDKChannelFeatures val);
6826 * Source node of the first direction of a channel
6828 LDKPublicKey ChannelInfo_get_node_one(const LDKChannelInfo *this_ptr);
6831 * Source node of the first direction of a channel
6833 void ChannelInfo_set_node_one(LDKChannelInfo *this_ptr, LDKPublicKey val);
6836 * Details about the first direction of a channel
6838 LDKDirectionalChannelInfo ChannelInfo_get_one_to_two(const LDKChannelInfo *this_ptr);
6841 * Details about the first direction of a channel
6843 void ChannelInfo_set_one_to_two(LDKChannelInfo *this_ptr, LDKDirectionalChannelInfo val);
6846 * Source node of the second direction of a channel
6848 LDKPublicKey ChannelInfo_get_node_two(const LDKChannelInfo *this_ptr);
6851 * Source node of the second direction of a channel
6853 void ChannelInfo_set_node_two(LDKChannelInfo *this_ptr, LDKPublicKey val);
6856 * Details about the second direction of a channel
6858 LDKDirectionalChannelInfo ChannelInfo_get_two_to_one(const LDKChannelInfo *this_ptr);
6861 * Details about the second direction of a channel
6863 void ChannelInfo_set_two_to_one(LDKChannelInfo *this_ptr, LDKDirectionalChannelInfo val);
6866 * An initial announcement of the channel
6867 * Mostly redundant with the data we store in fields explicitly.
6868 * Everything else is useful only for sending out for initial routing sync.
6869 * Not stored if contains excess data to prevent DoS.
6871 LDKChannelAnnouncement ChannelInfo_get_announcement_message(const LDKChannelInfo *this_ptr);
6874 * An initial announcement of the channel
6875 * Mostly redundant with the data we store in fields explicitly.
6876 * Everything else is useful only for sending out for initial routing sync.
6877 * Not stored if contains excess data to prevent DoS.
6879 void ChannelInfo_set_announcement_message(LDKChannelInfo *this_ptr, LDKChannelAnnouncement val);
6881 LDKCVec_u8Z ChannelInfo_write(const LDKChannelInfo *obj);
6883 LDKChannelInfo ChannelInfo_read(LDKu8slice ser);
6885 void RoutingFees_free(LDKRoutingFees this_ptr);
6888 * Flat routing fee in satoshis
6890 uint32_t RoutingFees_get_base_msat(const LDKRoutingFees *this_ptr);
6893 * Flat routing fee in satoshis
6895 void RoutingFees_set_base_msat(LDKRoutingFees *this_ptr, uint32_t val);
6898 * Liquidity-based routing fee in millionths of a routed amount.
6899 * In other words, 10000 is 1%.
6901 uint32_t RoutingFees_get_proportional_millionths(const LDKRoutingFees *this_ptr);
6904 * Liquidity-based routing fee in millionths of a routed amount.
6905 * In other words, 10000 is 1%.
6907 void RoutingFees_set_proportional_millionths(LDKRoutingFees *this_ptr, uint32_t val);
6909 MUST_USE_RES LDKRoutingFees RoutingFees_new(uint32_t base_msat_arg, uint32_t proportional_millionths_arg);
6911 LDKRoutingFees RoutingFees_read(LDKu8slice ser);
6913 LDKCVec_u8Z RoutingFees_write(const LDKRoutingFees *obj);
6915 void NodeAnnouncementInfo_free(LDKNodeAnnouncementInfo this_ptr);
6918 * Protocol features the node announced support for
6920 LDKNodeFeatures NodeAnnouncementInfo_get_features(const LDKNodeAnnouncementInfo *this_ptr);
6923 * Protocol features the node announced support for
6925 void NodeAnnouncementInfo_set_features(LDKNodeAnnouncementInfo *this_ptr, LDKNodeFeatures val);
6928 * When the last known update to the node state was issued.
6929 * Value is opaque, as set in the announcement.
6931 uint32_t NodeAnnouncementInfo_get_last_update(const LDKNodeAnnouncementInfo *this_ptr);
6934 * When the last known update to the node state was issued.
6935 * Value is opaque, as set in the announcement.
6937 void NodeAnnouncementInfo_set_last_update(LDKNodeAnnouncementInfo *this_ptr, uint32_t val);
6940 * Color assigned to the node
6942 const uint8_t (*NodeAnnouncementInfo_get_rgb(const LDKNodeAnnouncementInfo *this_ptr))[3];
6945 * Color assigned to the node
6947 void NodeAnnouncementInfo_set_rgb(LDKNodeAnnouncementInfo *this_ptr, LDKThreeBytes val);
6950 * Moniker assigned to the node.
6951 * May be invalid or malicious (eg control chars),
6952 * should not be exposed to the user.
6954 const uint8_t (*NodeAnnouncementInfo_get_alias(const LDKNodeAnnouncementInfo *this_ptr))[32];
6957 * Moniker assigned to the node.
6958 * May be invalid or malicious (eg control chars),
6959 * should not be exposed to the user.
6961 void NodeAnnouncementInfo_set_alias(LDKNodeAnnouncementInfo *this_ptr, LDKThirtyTwoBytes val);
6964 * Internet-level addresses via which one can connect to the node
6966 void NodeAnnouncementInfo_set_addresses(LDKNodeAnnouncementInfo *this_ptr, LDKCVec_NetAddressZ val);
6969 * An initial announcement of the node
6970 * Mostly redundant with the data we store in fields explicitly.
6971 * Everything else is useful only for sending out for initial routing sync.
6972 * Not stored if contains excess data to prevent DoS.
6974 LDKNodeAnnouncement NodeAnnouncementInfo_get_announcement_message(const LDKNodeAnnouncementInfo *this_ptr);
6977 * An initial announcement of the node
6978 * Mostly redundant with the data we store in fields explicitly.
6979 * Everything else is useful only for sending out for initial routing sync.
6980 * Not stored if contains excess data to prevent DoS.
6982 void NodeAnnouncementInfo_set_announcement_message(LDKNodeAnnouncementInfo *this_ptr, LDKNodeAnnouncement val);
6984 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);
6986 LDKCVec_u8Z NodeAnnouncementInfo_write(const LDKNodeAnnouncementInfo *obj);
6988 LDKNodeAnnouncementInfo NodeAnnouncementInfo_read(LDKu8slice ser);
6990 void NodeInfo_free(LDKNodeInfo this_ptr);
6993 * All valid channels a node has announced
6995 void NodeInfo_set_channels(LDKNodeInfo *this_ptr, LDKCVec_u64Z val);
6998 * Lowest fees enabling routing via any of the enabled, known channels to a node.
6999 * The two fields (flat and proportional fee) are independent,
7000 * meaning they don't have to refer to the same channel.
7002 LDKRoutingFees NodeInfo_get_lowest_inbound_channel_fees(const LDKNodeInfo *this_ptr);
7005 * Lowest fees enabling routing via any of the enabled, known channels to a node.
7006 * The two fields (flat and proportional fee) are independent,
7007 * meaning they don't have to refer to the same channel.
7009 void NodeInfo_set_lowest_inbound_channel_fees(LDKNodeInfo *this_ptr, LDKRoutingFees val);
7012 * More information about a node from node_announcement.
7013 * Optional because we store a Node entry after learning about it from
7014 * a channel announcement, but before receiving a node announcement.
7016 LDKNodeAnnouncementInfo NodeInfo_get_announcement_info(const LDKNodeInfo *this_ptr);
7019 * More information about a node from node_announcement.
7020 * Optional because we store a Node entry after learning about it from
7021 * a channel announcement, but before receiving a node announcement.
7023 void NodeInfo_set_announcement_info(LDKNodeInfo *this_ptr, LDKNodeAnnouncementInfo val);
7025 MUST_USE_RES LDKNodeInfo NodeInfo_new(LDKCVec_u64Z channels_arg, LDKRoutingFees lowest_inbound_channel_fees_arg, LDKNodeAnnouncementInfo announcement_info_arg);
7027 LDKCVec_u8Z NodeInfo_write(const LDKNodeInfo *obj);
7029 LDKNodeInfo NodeInfo_read(LDKu8slice ser);
7031 LDKCVec_u8Z NetworkGraph_write(const LDKNetworkGraph *obj);
7033 LDKNetworkGraph NetworkGraph_read(LDKu8slice ser);
7036 * Creates a new, empty, network graph.
7038 MUST_USE_RES LDKNetworkGraph NetworkGraph_new(void);
7041 * Close a channel if a corresponding HTLC fail was sent.
7042 * If permanent, removes a channel from the local storage.
7043 * May cause the removal of nodes too, if this was their last channel.
7044 * If not permanent, makes channels unavailable for routing.
7046 void NetworkGraph_close_channel_from_update(LDKNetworkGraph *this_arg, uint64_t short_channel_id, bool is_permanent);
7048 /* Text to put at the end of the generated file */